one
Version:
One is a new React Framework that makes Vite serve both native and web.
42 lines (41 loc) • 2.02 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: !0 });
}, __copyProps = (to, from, except, desc) => {
if (from && typeof from == "object" || typeof from == "function")
for (let key of __getOwnPropNames(from))
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
var getRouteInfo_exports = {};
__export(getRouteInfo_exports, {
getRouteInfo: () => getRouteInfo
});
module.exports = __toCommonJS(getRouteInfo_exports);
var import_getPathFromState = require("../fork/getPathFromState"), import_getStateFromPath_mods = require("../fork/getStateFromPath-mods"), import_getNormalizedStatePath = require("./getNormalizedStatePath"), import_isIndexPath = require("./isIndexPath"), import_linkingConfig = require("./linkingConfig");
function getRouteInfo(state) {
return getRouteInfoFromState(
(state2, asPath) => (0, import_getPathFromState.getPathDataFromState)(state2, {
screens: [],
...(0, import_linkingConfig.getLinking)()?.config,
preserveDynamicRoutes: asPath,
preserveGroups: asPath
}),
state
);
}
function getRouteInfoFromState(getPathFromState, state, baseUrl) {
const { path } = getPathFromState(state, !1), qualified = getPathFromState(state, !0);
return {
unstable_globalHref: path,
pathname: (0, import_getStateFromPath_mods.stripBaseUrl)(path, baseUrl).split("?")[0],
isIndex: (0, import_isIndexPath.isIndexPath)(state),
...(0, import_getNormalizedStatePath.getNormalizedStatePath)(qualified, baseUrl)
};
}
//# sourceMappingURL=getRouteInfo.js.map