UNPKG

one

Version:

One is a new React Framework that makes Vite serve both native and web.

34 lines (33 loc) 1.43 kB
import { getPathDataFromState } from "../fork/getPathFromState.native.js"; import { stripBaseUrl } from "../fork/getStateFromPath-mods.native.js"; import { getNormalizedStatePath } from "./getNormalizedStatePath.native.js"; import { isIndexPath } from "./isIndexPath.native.js"; import { getResolvedLinking } from "./linkingConfig.native.js"; import { stripPathSuffix } from "./path.native.js"; function getRouteInfo(state) { return getRouteInfoFromState(function (state2, asPath) { var _getResolvedLinking; return getPathDataFromState(state2, { screens: [], ...((_getResolvedLinking = getResolvedLinking()) === null || _getResolvedLinking === void 0 ? void 0 : _getResolvedLinking.config), preserveDynamicRoutes: asPath, preserveGroups: asPath }); }, state); } function getRouteInfoFromState(getPathFromState, state, baseUrl) { var { path } = getPathFromState(state, false); var qualified = getPathFromState(state, true); return { unstable_globalHref: path, // a hash href serializes as /page#section; the pathname the router compares // against pending navigation and the URL must drop the hash as well as the query pathname: stripPathSuffix(stripBaseUrl(path, baseUrl)), isIndex: isIndexPath(state), ...getNormalizedStatePath(qualified, baseUrl) }; } export { getRouteInfo, getRouteInfoFromState }; //# sourceMappingURL=getRouteInfo.native.js.map