UNPKG

one

Version:

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

33 lines (32 loc) 1.26 kB
import { getPathDataFromState } from "../fork/getPathFromState.mjs"; import { stripBaseUrl } from "../fork/getStateFromPath-mods.mjs"; import { getNormalizedStatePath } from "./getNormalizedStatePath.mjs"; import { isIndexPath } from "./isIndexPath.mjs"; import { getResolvedLinking } from "./linkingConfig.mjs"; import { stripPathSuffix } from "./path.mjs"; function getRouteInfo(state) { return getRouteInfoFromState((state2, asPath) => { return getPathDataFromState(state2, { screens: [], ...getResolvedLinking()?.config, preserveDynamicRoutes: asPath, preserveGroups: asPath }); }, state); } function getRouteInfoFromState(getPathFromState, state, baseUrl) { const { path } = getPathFromState(state, false); const 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.mjs.map