@benjavicente/router-core 1.168.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +5 -0
- package/bin/intent.js +25 -0
- package/dist/cjs/Matches.cjs +17 -0
- package/dist/cjs/Matches.cjs.map +1 -0
- package/dist/cjs/Matches.d.cts +139 -0
- package/dist/cjs/RouterProvider.d.cts +27 -0
- package/dist/cjs/config.cjs +11 -0
- package/dist/cjs/config.cjs.map +1 -0
- package/dist/cjs/config.d.cts +17 -0
- package/dist/cjs/defer.cjs +41 -0
- package/dist/cjs/defer.cjs.map +1 -0
- package/dist/cjs/defer.d.cts +37 -0
- package/dist/cjs/fileRoute.d.cts +24 -0
- package/dist/cjs/global.d.cts +7 -0
- package/dist/cjs/hash-scroll.cjs +20 -0
- package/dist/cjs/hash-scroll.cjs.map +1 -0
- package/dist/cjs/hash-scroll.d.cts +7 -0
- package/dist/cjs/history.d.cts +8 -0
- package/dist/cjs/index.cjs +96 -0
- package/dist/cjs/index.d.cts +53 -0
- package/dist/cjs/invariant.cjs +8 -0
- package/dist/cjs/invariant.cjs.map +1 -0
- package/dist/cjs/invariant.d.cts +1 -0
- package/dist/cjs/isServer/client.cjs +7 -0
- package/dist/cjs/isServer/client.cjs.map +1 -0
- package/dist/cjs/isServer/client.d.cts +1 -0
- package/dist/cjs/isServer/development.cjs +7 -0
- package/dist/cjs/isServer/development.cjs.map +1 -0
- package/dist/cjs/isServer/development.d.cts +1 -0
- package/dist/cjs/isServer/server.cjs +7 -0
- package/dist/cjs/isServer/server.cjs.map +1 -0
- package/dist/cjs/isServer/server.d.cts +1 -0
- package/dist/cjs/link.cjs +6 -0
- package/dist/cjs/link.cjs.map +1 -0
- package/dist/cjs/link.d.cts +221 -0
- package/dist/cjs/load-matches.cjs +659 -0
- package/dist/cjs/load-matches.cjs.map +1 -0
- package/dist/cjs/load-matches.d.cts +18 -0
- package/dist/cjs/location.d.cts +50 -0
- package/dist/cjs/lru-cache.cjs +70 -0
- package/dist/cjs/lru-cache.cjs.map +1 -0
- package/dist/cjs/lru-cache.d.cts +6 -0
- package/dist/cjs/manifest.cjs +18 -0
- package/dist/cjs/manifest.cjs.map +1 -0
- package/dist/cjs/manifest.d.cts +35 -0
- package/dist/cjs/new-process-route-tree.cjs +754 -0
- package/dist/cjs/new-process-route-tree.cjs.map +1 -0
- package/dist/cjs/new-process-route-tree.d.cts +236 -0
- package/dist/cjs/not-found.cjs +26 -0
- package/dist/cjs/not-found.cjs.map +1 -0
- package/dist/cjs/not-found.d.cts +32 -0
- package/dist/cjs/path.cjs +252 -0
- package/dist/cjs/path.cjs.map +1 -0
- package/dist/cjs/path.d.cts +56 -0
- package/dist/cjs/qss.cjs +70 -0
- package/dist/cjs/qss.cjs.map +1 -0
- package/dist/cjs/qss.d.cts +33 -0
- package/dist/cjs/redirect.cjs +56 -0
- package/dist/cjs/redirect.cjs.map +1 -0
- package/dist/cjs/redirect.d.cts +77 -0
- package/dist/cjs/rewrite.cjs +68 -0
- package/dist/cjs/rewrite.cjs.map +1 -0
- package/dist/cjs/rewrite.d.cts +30 -0
- package/dist/cjs/root.cjs +7 -0
- package/dist/cjs/root.cjs.map +1 -0
- package/dist/cjs/root.d.cts +3 -0
- package/dist/cjs/route.cjs +100 -0
- package/dist/cjs/route.cjs.map +1 -0
- package/dist/cjs/route.d.cts +552 -0
- package/dist/cjs/routeInfo.d.cts +54 -0
- package/dist/cjs/router.cjs +1173 -0
- package/dist/cjs/router.cjs.map +1 -0
- package/dist/cjs/router.d.cts +734 -0
- package/dist/cjs/scroll-restoration-inline.cjs +6 -0
- package/dist/cjs/scroll-restoration-inline.cjs.map +1 -0
- package/dist/cjs/scroll-restoration-inline.d.cts +6 -0
- package/dist/cjs/scroll-restoration-script/client.cjs +9 -0
- package/dist/cjs/scroll-restoration-script/client.cjs.map +1 -0
- package/dist/cjs/scroll-restoration-script/client.d.cts +2 -0
- package/dist/cjs/scroll-restoration-script/server.cjs +30 -0
- package/dist/cjs/scroll-restoration-script/server.cjs.map +1 -0
- package/dist/cjs/scroll-restoration-script/server.d.cts +2 -0
- package/dist/cjs/scroll-restoration.cjs +191 -0
- package/dist/cjs/scroll-restoration.cjs.map +1 -0
- package/dist/cjs/scroll-restoration.d.cts +38 -0
- package/dist/cjs/searchMiddleware.cjs +55 -0
- package/dist/cjs/searchMiddleware.cjs.map +1 -0
- package/dist/cjs/searchMiddleware.d.cts +25 -0
- package/dist/cjs/searchParams.cjs +65 -0
- package/dist/cjs/searchParams.cjs.map +1 -0
- package/dist/cjs/searchParams.d.cts +31 -0
- package/dist/cjs/ssr/client.cjs +7 -0
- package/dist/cjs/ssr/client.d.cts +6 -0
- package/dist/cjs/ssr/constants.cjs +8 -0
- package/dist/cjs/ssr/constants.cjs.map +1 -0
- package/dist/cjs/ssr/constants.d.cts +3 -0
- package/dist/cjs/ssr/createRequestHandler.cjs +44 -0
- package/dist/cjs/ssr/createRequestHandler.cjs.map +1 -0
- package/dist/cjs/ssr/createRequestHandler.d.cts +9 -0
- package/dist/cjs/ssr/handlerCallback.cjs +8 -0
- package/dist/cjs/ssr/handlerCallback.cjs.map +1 -0
- package/dist/cjs/ssr/handlerCallback.d.cts +9 -0
- package/dist/cjs/ssr/headers.cjs +21 -0
- package/dist/cjs/ssr/headers.cjs.map +1 -0
- package/dist/cjs/ssr/headers.d.cts +3 -0
- package/dist/cjs/ssr/json.cjs +11 -0
- package/dist/cjs/ssr/json.cjs.map +1 -0
- package/dist/cjs/ssr/json.d.cts +10 -0
- package/dist/cjs/ssr/serializer/RawStream.cjs +287 -0
- package/dist/cjs/ssr/serializer/RawStream.cjs.map +1 -0
- package/dist/cjs/ssr/serializer/RawStream.d.cts +64 -0
- package/dist/cjs/ssr/serializer/ShallowErrorPlugin.cjs +32 -0
- package/dist/cjs/ssr/serializer/ShallowErrorPlugin.cjs.map +1 -0
- package/dist/cjs/ssr/serializer/ShallowErrorPlugin.d.cts +9 -0
- package/dist/cjs/ssr/serializer/seroval-plugins.cjs +13 -0
- package/dist/cjs/ssr/serializer/seroval-plugins.cjs.map +1 -0
- package/dist/cjs/ssr/serializer/seroval-plugins.d.cts +2 -0
- package/dist/cjs/ssr/serializer/transformer.cjs +53 -0
- package/dist/cjs/ssr/serializer/transformer.cjs.map +1 -0
- package/dist/cjs/ssr/serializer/transformer.d.cts +91 -0
- package/dist/cjs/ssr/server.cjs +13 -0
- package/dist/cjs/ssr/server.d.cts +6 -0
- package/dist/cjs/ssr/ssr-client.cjs +183 -0
- package/dist/cjs/ssr/ssr-client.cjs.map +1 -0
- package/dist/cjs/ssr/ssr-client.d.cts +10 -0
- package/dist/cjs/ssr/ssr-match-id.cjs +12 -0
- package/dist/cjs/ssr/ssr-match-id.cjs.map +1 -0
- package/dist/cjs/ssr/ssr-match-id.d.cts +2 -0
- package/dist/cjs/ssr/ssr-server.cjs +279 -0
- package/dist/cjs/ssr/ssr-server.cjs.map +1 -0
- package/dist/cjs/ssr/ssr-server.d.cts +42 -0
- package/dist/cjs/ssr/transformStreamWithRouter.cjs +327 -0
- package/dist/cjs/ssr/transformStreamWithRouter.cjs.map +1 -0
- package/dist/cjs/ssr/transformStreamWithRouter.d.cts +11 -0
- package/dist/cjs/ssr/tsrScript.cjs +6 -0
- package/dist/cjs/ssr/tsrScript.cjs.map +1 -0
- package/dist/cjs/ssr/tsrScript.d.cts +1 -0
- package/dist/cjs/ssr/types.d.cts +30 -0
- package/dist/cjs/stores.cjs +148 -0
- package/dist/cjs/stores.cjs.map +1 -0
- package/dist/cjs/stores.d.cts +70 -0
- package/dist/cjs/structuralSharing.d.cts +4 -0
- package/dist/cjs/typePrimitives.d.cts +65 -0
- package/dist/cjs/useLoaderData.d.cts +5 -0
- package/dist/cjs/useLoaderDeps.d.cts +5 -0
- package/dist/cjs/useNavigate.d.cts +3 -0
- package/dist/cjs/useParams.d.cts +5 -0
- package/dist/cjs/useRouteContext.d.cts +9 -0
- package/dist/cjs/useSearch.d.cts +5 -0
- package/dist/cjs/utils.cjs +339 -0
- package/dist/cjs/utils.cjs.map +1 -0
- package/dist/cjs/utils.d.cts +178 -0
- package/dist/cjs/validators.d.cts +51 -0
- package/dist/esm/Matches.d.ts +139 -0
- package/dist/esm/Matches.js +17 -0
- package/dist/esm/Matches.js.map +1 -0
- package/dist/esm/RouterProvider.d.ts +27 -0
- package/dist/esm/config.d.ts +17 -0
- package/dist/esm/config.js +11 -0
- package/dist/esm/config.js.map +1 -0
- package/dist/esm/defer.d.ts +37 -0
- package/dist/esm/defer.js +40 -0
- package/dist/esm/defer.js.map +1 -0
- package/dist/esm/fileRoute.d.ts +24 -0
- package/dist/esm/global.d.ts +7 -0
- package/dist/esm/hash-scroll.d.ts +7 -0
- package/dist/esm/hash-scroll.js +20 -0
- package/dist/esm/hash-scroll.js.map +1 -0
- package/dist/esm/history.d.ts +8 -0
- package/dist/esm/index.d.ts +53 -0
- package/dist/esm/index.js +24 -0
- package/dist/esm/invariant.d.ts +1 -0
- package/dist/esm/invariant.js +8 -0
- package/dist/esm/invariant.js.map +1 -0
- package/dist/esm/isServer/client.d.ts +1 -0
- package/dist/esm/isServer/client.js +6 -0
- package/dist/esm/isServer/client.js.map +1 -0
- package/dist/esm/isServer/development.d.ts +1 -0
- package/dist/esm/isServer/development.js +6 -0
- package/dist/esm/isServer/development.js.map +1 -0
- package/dist/esm/isServer/server.d.ts +1 -0
- package/dist/esm/isServer/server.js +6 -0
- package/dist/esm/isServer/server.js.map +1 -0
- package/dist/esm/link.d.ts +221 -0
- package/dist/esm/link.js +6 -0
- package/dist/esm/link.js.map +1 -0
- package/dist/esm/load-matches.d.ts +18 -0
- package/dist/esm/load-matches.js +657 -0
- package/dist/esm/load-matches.js.map +1 -0
- package/dist/esm/location.d.ts +50 -0
- package/dist/esm/lru-cache.d.ts +6 -0
- package/dist/esm/lru-cache.js +70 -0
- package/dist/esm/lru-cache.js.map +1 -0
- package/dist/esm/manifest.d.ts +35 -0
- package/dist/esm/manifest.js +17 -0
- package/dist/esm/manifest.js.map +1 -0
- package/dist/esm/new-process-route-tree.d.ts +236 -0
- package/dist/esm/new-process-route-tree.js +749 -0
- package/dist/esm/new-process-route-tree.js.map +1 -0
- package/dist/esm/not-found.d.ts +32 -0
- package/dist/esm/not-found.js +25 -0
- package/dist/esm/not-found.js.map +1 -0
- package/dist/esm/path.d.ts +56 -0
- package/dist/esm/path.js +243 -0
- package/dist/esm/path.js.map +1 -0
- package/dist/esm/qss.d.ts +33 -0
- package/dist/esm/qss.js +69 -0
- package/dist/esm/qss.js.map +1 -0
- package/dist/esm/redirect.d.ts +77 -0
- package/dist/esm/redirect.js +53 -0
- package/dist/esm/redirect.js.map +1 -0
- package/dist/esm/rewrite.d.ts +30 -0
- package/dist/esm/rewrite.js +65 -0
- package/dist/esm/rewrite.js.map +1 -0
- package/dist/esm/root.d.ts +3 -0
- package/dist/esm/root.js +7 -0
- package/dist/esm/root.js.map +1 -0
- package/dist/esm/route.d.ts +552 -0
- package/dist/esm/route.js +98 -0
- package/dist/esm/route.js.map +1 -0
- package/dist/esm/routeInfo.d.ts +54 -0
- package/dist/esm/router.d.ts +734 -0
- package/dist/esm/router.js +1165 -0
- package/dist/esm/router.js.map +1 -0
- package/dist/esm/scroll-restoration-inline.d.ts +6 -0
- package/dist/esm/scroll-restoration-inline.js +6 -0
- package/dist/esm/scroll-restoration-inline.js.map +1 -0
- package/dist/esm/scroll-restoration-script/client.d.ts +2 -0
- package/dist/esm/scroll-restoration-script/client.js +8 -0
- package/dist/esm/scroll-restoration-script/client.js.map +1 -0
- package/dist/esm/scroll-restoration-script/server.d.ts +2 -0
- package/dist/esm/scroll-restoration-script/server.js +29 -0
- package/dist/esm/scroll-restoration-script/server.js.map +1 -0
- package/dist/esm/scroll-restoration.d.ts +38 -0
- package/dist/esm/scroll-restoration.js +187 -0
- package/dist/esm/scroll-restoration.js.map +1 -0
- package/dist/esm/searchMiddleware.d.ts +25 -0
- package/dist/esm/searchMiddleware.js +54 -0
- package/dist/esm/searchMiddleware.js.map +1 -0
- package/dist/esm/searchParams.d.ts +31 -0
- package/dist/esm/searchParams.js +62 -0
- package/dist/esm/searchParams.js.map +1 -0
- package/dist/esm/ssr/client.d.ts +6 -0
- package/dist/esm/ssr/client.js +4 -0
- package/dist/esm/ssr/constants.d.ts +3 -0
- package/dist/esm/ssr/constants.js +7 -0
- package/dist/esm/ssr/constants.js.map +1 -0
- package/dist/esm/ssr/createRequestHandler.d.ts +9 -0
- package/dist/esm/ssr/createRequestHandler.js +44 -0
- package/dist/esm/ssr/createRequestHandler.js.map +1 -0
- package/dist/esm/ssr/handlerCallback.d.ts +9 -0
- package/dist/esm/ssr/handlerCallback.js +8 -0
- package/dist/esm/ssr/handlerCallback.js.map +1 -0
- package/dist/esm/ssr/headers.d.ts +3 -0
- package/dist/esm/ssr/headers.js +21 -0
- package/dist/esm/ssr/headers.js.map +1 -0
- package/dist/esm/ssr/json.d.ts +10 -0
- package/dist/esm/ssr/json.js +11 -0
- package/dist/esm/ssr/json.js.map +1 -0
- package/dist/esm/ssr/serializer/RawStream.d.ts +64 -0
- package/dist/esm/ssr/serializer/RawStream.js +282 -0
- package/dist/esm/ssr/serializer/RawStream.js.map +1 -0
- package/dist/esm/ssr/serializer/ShallowErrorPlugin.d.ts +9 -0
- package/dist/esm/ssr/serializer/ShallowErrorPlugin.js +33 -0
- package/dist/esm/ssr/serializer/ShallowErrorPlugin.js.map +1 -0
- package/dist/esm/ssr/serializer/seroval-plugins.d.ts +2 -0
- package/dist/esm/ssr/serializer/seroval-plugins.js +13 -0
- package/dist/esm/ssr/serializer/seroval-plugins.js.map +1 -0
- package/dist/esm/ssr/serializer/transformer.d.ts +91 -0
- package/dist/esm/ssr/serializer/transformer.js +51 -0
- package/dist/esm/ssr/serializer/transformer.js.map +1 -0
- package/dist/esm/ssr/server.d.ts +6 -0
- package/dist/esm/ssr/server.js +5 -0
- package/dist/esm/ssr/ssr-client.d.ts +10 -0
- package/dist/esm/ssr/ssr-client.js +183 -0
- package/dist/esm/ssr/ssr-client.js.map +1 -0
- package/dist/esm/ssr/ssr-match-id.d.ts +2 -0
- package/dist/esm/ssr/ssr-match-id.js +11 -0
- package/dist/esm/ssr/ssr-match-id.js.map +1 -0
- package/dist/esm/ssr/ssr-server.d.ts +42 -0
- package/dist/esm/ssr/ssr-server.js +277 -0
- package/dist/esm/ssr/ssr-server.js.map +1 -0
- package/dist/esm/ssr/transformStreamWithRouter.d.ts +11 -0
- package/dist/esm/ssr/transformStreamWithRouter.js +325 -0
- package/dist/esm/ssr/transformStreamWithRouter.js.map +1 -0
- package/dist/esm/ssr/tsrScript.d.ts +0 -0
- package/dist/esm/ssr/tsrScript.js +6 -0
- package/dist/esm/ssr/tsrScript.js.map +1 -0
- package/dist/esm/ssr/types.d.ts +30 -0
- package/dist/esm/stores.d.ts +70 -0
- package/dist/esm/stores.js +146 -0
- package/dist/esm/stores.js.map +1 -0
- package/dist/esm/structuralSharing.d.ts +4 -0
- package/dist/esm/typePrimitives.d.ts +65 -0
- package/dist/esm/useLoaderData.d.ts +5 -0
- package/dist/esm/useLoaderDeps.d.ts +5 -0
- package/dist/esm/useNavigate.d.ts +3 -0
- package/dist/esm/useParams.d.ts +5 -0
- package/dist/esm/useRouteContext.d.ts +9 -0
- package/dist/esm/useSearch.d.ts +5 -0
- package/dist/esm/utils.d.ts +178 -0
- package/dist/esm/utils.js +322 -0
- package/dist/esm/utils.js.map +1 -0
- package/dist/esm/validators.d.ts +51 -0
- package/package.json +200 -0
- package/skills/router-core/SKILL.md +139 -0
- package/skills/router-core/auth-and-guards/SKILL.md +458 -0
- package/skills/router-core/code-splitting/SKILL.md +322 -0
- package/skills/router-core/data-loading/SKILL.md +485 -0
- package/skills/router-core/navigation/SKILL.md +448 -0
- package/skills/router-core/not-found-and-errors/SKILL.md +435 -0
- package/skills/router-core/path-params/SKILL.md +382 -0
- package/skills/router-core/search-params/SKILL.md +349 -0
- package/skills/router-core/search-params/references/validation-patterns.md +379 -0
- package/skills/router-core/ssr/SKILL.md +437 -0
- package/skills/router-core/type-safety/SKILL.md +497 -0
- package/src/Matches.ts +291 -0
- package/src/RouterProvider.ts +47 -0
- package/src/config.ts +42 -0
- package/src/defer.ts +69 -0
- package/src/fileRoute.ts +164 -0
- package/src/global.ts +9 -0
- package/src/hash-scroll.ts +21 -0
- package/src/history.ts +9 -0
- package/src/index.ts +471 -0
- package/src/invariant.ts +3 -0
- package/src/isServer/client.ts +1 -0
- package/src/isServer/development.ts +2 -0
- package/src/isServer/server.ts +1 -0
- package/src/link.ts +704 -0
- package/src/load-matches.ts +1281 -0
- package/src/location.ts +51 -0
- package/src/lru-cache.ts +74 -0
- package/src/manifest.ts +68 -0
- package/src/new-process-route-tree.ts +1387 -0
- package/src/not-found.ts +41 -0
- package/src/path.ts +436 -0
- package/src/qss.ts +81 -0
- package/src/redirect.ts +179 -0
- package/src/rewrite.ts +93 -0
- package/src/root.ts +3 -0
- package/src/route.ts +2235 -0
- package/src/routeInfo.ts +235 -0
- package/src/router.ts +3207 -0
- package/src/scroll-restoration-inline.ts +81 -0
- package/src/scroll-restoration-script/client.ts +5 -0
- package/src/scroll-restoration-script/server.ts +64 -0
- package/src/scroll-restoration.ts +357 -0
- package/src/searchMiddleware.ts +76 -0
- package/src/searchParams.ts +90 -0
- package/src/ssr/client.ts +6 -0
- package/src/ssr/constants.ts +3 -0
- package/src/ssr/createRequestHandler.ts +98 -0
- package/src/ssr/handlerCallback.ts +15 -0
- package/src/ssr/headers.ts +40 -0
- package/src/ssr/json.ts +16 -0
- package/src/ssr/serializer/RawStream.ts +464 -0
- package/src/ssr/serializer/ShallowErrorPlugin.ts +43 -0
- package/src/ssr/serializer/seroval-plugins.ts +12 -0
- package/src/ssr/serializer/transformer.ts +312 -0
- package/src/ssr/server.ts +14 -0
- package/src/ssr/ssr-client.ts +313 -0
- package/src/ssr/ssr-match-id.ts +7 -0
- package/src/ssr/ssr-server.ts +425 -0
- package/src/ssr/transformStreamWithRouter.ts +493 -0
- package/src/ssr/tsrScript.ts +20 -0
- package/src/ssr/types.ts +41 -0
- package/src/stores.ts +342 -0
- package/src/structuralSharing.ts +7 -0
- package/src/typePrimitives.ts +181 -0
- package/src/useLoaderData.ts +20 -0
- package/src/useLoaderDeps.ts +13 -0
- package/src/useNavigate.ts +13 -0
- package/src/useParams.ts +20 -0
- package/src/useRouteContext.ts +39 -0
- package/src/useSearch.ts +20 -0
- package/src/utils.ts +708 -0
- package/src/validators.ts +121 -0
- package/src/vite-env.d.ts +4 -0
|
@@ -0,0 +1,734 @@
|
|
|
1
|
+
import { loadRouteChunk } from './load-matches.js';
|
|
2
|
+
import { LRUCache } from './lru-cache.js';
|
|
3
|
+
import { ProcessRouteTreeResult, ProcessedTree } from './new-process-route-tree.js';
|
|
4
|
+
import { SearchParser, SearchSerializer } from './searchParams.js';
|
|
5
|
+
import { AnyRedirect, ResolvedRedirect } from './redirect.js';
|
|
6
|
+
import { HistoryLocation, HistoryState, ParsedHistoryState, RouterHistory } from '@benjavicente/history';
|
|
7
|
+
import { Awaitable, Constrain, ControlledPromise, NoInfer, NonNullableUpdater, PickAsRequired, Updater } from './utils.js';
|
|
8
|
+
import { ParsedLocation } from './location.js';
|
|
9
|
+
import { AnyContext, AnyRoute, AnyRouteWithContext, LoaderStaleReloadMode, MakeRemountDepsOptionsUnion, RouteLike, RouteMask } from './route.js';
|
|
10
|
+
import { FullSearchSchema, RouteById, RoutePaths, RoutesById, RoutesByPath } from './routeInfo.js';
|
|
11
|
+
import { AnyRouteMatch, MakeRouteMatchUnion, MatchRouteOptions } from './Matches.js';
|
|
12
|
+
import { BuildLocationFn, CommitLocationOptions, NavigateFn } from './RouterProvider.js';
|
|
13
|
+
import { Manifest, RouterManagedTag } from './manifest.js';
|
|
14
|
+
import { AnySchema } from './validators.js';
|
|
15
|
+
import { NavigateOptions, ResolveRelativePath, ToOptions } from './link.js';
|
|
16
|
+
import { AnySerializationAdapter, ValidateSerializableInput } from './ssr/serializer/transformer.js';
|
|
17
|
+
import { GetStoreConfig, RouterStores } from './stores.js';
|
|
18
|
+
export type ControllablePromise<T = any> = Promise<T> & {
|
|
19
|
+
resolve: (value: T) => void;
|
|
20
|
+
reject: (value?: any) => void;
|
|
21
|
+
};
|
|
22
|
+
export type InjectedHtmlEntry = Promise<string>;
|
|
23
|
+
export interface Register {
|
|
24
|
+
}
|
|
25
|
+
export type RegisteredSsr<TRegister = Register> = TRegister extends {
|
|
26
|
+
ssr: infer TSSR;
|
|
27
|
+
} ? TSSR : false;
|
|
28
|
+
export type RegisteredRouter<TRegister = Register> = TRegister extends {
|
|
29
|
+
router: infer TRouter;
|
|
30
|
+
} ? TRouter : AnyRouter;
|
|
31
|
+
export type RegisteredConfigType<TRegister, TKey> = TRegister extends {
|
|
32
|
+
config: infer TConfig;
|
|
33
|
+
} ? TConfig extends {
|
|
34
|
+
'~types': infer TTypes;
|
|
35
|
+
} ? TKey extends keyof TTypes ? TTypes[TKey] : unknown : unknown : unknown;
|
|
36
|
+
export type DefaultRemountDepsFn<TRouteTree extends AnyRoute> = (opts: MakeRemountDepsOptionsUnion<TRouteTree>) => any;
|
|
37
|
+
export interface DefaultRouterOptionsExtensions {
|
|
38
|
+
}
|
|
39
|
+
export interface RouterOptionsExtensions extends DefaultRouterOptionsExtensions {
|
|
40
|
+
}
|
|
41
|
+
export type SSROption = boolean | 'data-only';
|
|
42
|
+
export interface RouterOptions<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean = false, TRouterHistory extends RouterHistory = RouterHistory, TDehydrated = undefined> extends RouterOptionsExtensions {
|
|
43
|
+
/**
|
|
44
|
+
* The history object that will be used to manage the browser history.
|
|
45
|
+
*
|
|
46
|
+
* If not provided, a new createBrowserHistory instance will be created and used.
|
|
47
|
+
*
|
|
48
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#history-property)
|
|
49
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/history-types)
|
|
50
|
+
*/
|
|
51
|
+
history?: TRouterHistory;
|
|
52
|
+
/**
|
|
53
|
+
* A function that will be used to stringify search params when generating links.
|
|
54
|
+
*
|
|
55
|
+
* @default defaultStringifySearch
|
|
56
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#stringifysearch-method)
|
|
57
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization)
|
|
58
|
+
*/
|
|
59
|
+
stringifySearch?: SearchSerializer;
|
|
60
|
+
/**
|
|
61
|
+
* A function that will be used to parse search params when parsing the current location.
|
|
62
|
+
*
|
|
63
|
+
* @default defaultParseSearch
|
|
64
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#parsesearch-method)
|
|
65
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization)
|
|
66
|
+
*/
|
|
67
|
+
parseSearch?: SearchParser;
|
|
68
|
+
/**
|
|
69
|
+
* If `false`, routes will not be preloaded by default in any way.
|
|
70
|
+
*
|
|
71
|
+
* If `'intent'`, routes will be preloaded by default when the user hovers over a link or a `touchstart` event is detected on a `<Link>`.
|
|
72
|
+
*
|
|
73
|
+
* If `'viewport'`, routes will be preloaded by default when they are within the viewport.
|
|
74
|
+
*
|
|
75
|
+
* @default false
|
|
76
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreload-property)
|
|
77
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)
|
|
78
|
+
*/
|
|
79
|
+
defaultPreload?: false | 'intent' | 'viewport' | 'render';
|
|
80
|
+
/**
|
|
81
|
+
* The delay in milliseconds that a route must be hovered over or touched before it is preloaded.
|
|
82
|
+
*
|
|
83
|
+
* @default 50
|
|
84
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloaddelay-property)
|
|
85
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading#preload-delay)
|
|
86
|
+
*/
|
|
87
|
+
defaultPreloadDelay?: number;
|
|
88
|
+
/**
|
|
89
|
+
* The default `preloadIntentProximity` a route should use if no preloadIntentProximity is provided.
|
|
90
|
+
*
|
|
91
|
+
* @default 0
|
|
92
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloadintentproximity-property)
|
|
93
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading#preload-intent-proximity)
|
|
94
|
+
*/
|
|
95
|
+
defaultPreloadIntentProximity?: number;
|
|
96
|
+
/**
|
|
97
|
+
* The default `pendingMs` a route should use if no pendingMs is provided.
|
|
98
|
+
*
|
|
99
|
+
* @default 1000
|
|
100
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingms-property)
|
|
101
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#avoiding-pending-component-flash)
|
|
102
|
+
*/
|
|
103
|
+
defaultPendingMs?: number;
|
|
104
|
+
/**
|
|
105
|
+
* The default `pendingMinMs` a route should use if no pendingMinMs is provided.
|
|
106
|
+
*
|
|
107
|
+
* @default 500
|
|
108
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingminms-property)
|
|
109
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#avoiding-pending-component-flash)
|
|
110
|
+
*/
|
|
111
|
+
defaultPendingMinMs?: number;
|
|
112
|
+
/**
|
|
113
|
+
* The default `staleTime` a route should use if no staleTime is provided. This is the time in milliseconds that a route will be considered fresh.
|
|
114
|
+
*
|
|
115
|
+
* @default 0
|
|
116
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultstaletime-property)
|
|
117
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#key-options)
|
|
118
|
+
*/
|
|
119
|
+
defaultStaleTime?: number;
|
|
120
|
+
/**
|
|
121
|
+
* The default stale reload mode a route loader should use if no `loader.staleReloadMode` is provided.
|
|
122
|
+
*
|
|
123
|
+
* `'background'` preserves the current stale-while-revalidate behavior.
|
|
124
|
+
* `'blocking'` waits for stale loader reloads to complete before resolving navigation.
|
|
125
|
+
*
|
|
126
|
+
* @default 'background'
|
|
127
|
+
*/
|
|
128
|
+
defaultStaleReloadMode?: LoaderStaleReloadMode;
|
|
129
|
+
/**
|
|
130
|
+
* The default `preloadStaleTime` a route should use if no preloadStaleTime is provided.
|
|
131
|
+
*
|
|
132
|
+
* @default 30_000 `(30 seconds)`
|
|
133
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloadstaletime-property)
|
|
134
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)
|
|
135
|
+
*/
|
|
136
|
+
defaultPreloadStaleTime?: number;
|
|
137
|
+
/**
|
|
138
|
+
* The default `defaultPreloadGcTime` a route should use if no preloadGcTime is provided.
|
|
139
|
+
*
|
|
140
|
+
* @default 1_800_000 `(30 minutes)`
|
|
141
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloadgctime-property)
|
|
142
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)
|
|
143
|
+
*/
|
|
144
|
+
defaultPreloadGcTime?: number;
|
|
145
|
+
/**
|
|
146
|
+
* If `true`, route navigations will called using `document.startViewTransition()`.
|
|
147
|
+
*
|
|
148
|
+
* If the browser does not support this api, this option will be ignored.
|
|
149
|
+
*
|
|
150
|
+
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition) for more information on how this function works.
|
|
151
|
+
*
|
|
152
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultviewtransition-property)
|
|
153
|
+
*/
|
|
154
|
+
defaultViewTransition?: boolean | ViewTransitionOptions;
|
|
155
|
+
/**
|
|
156
|
+
* The default `hashScrollIntoView` a route should use if no hashScrollIntoView is provided while navigating
|
|
157
|
+
*
|
|
158
|
+
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView) for more information on `ScrollIntoViewOptions`.
|
|
159
|
+
*
|
|
160
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaulthashscrollintoview-property)
|
|
161
|
+
*/
|
|
162
|
+
defaultHashScrollIntoView?: boolean | ScrollIntoViewOptions;
|
|
163
|
+
/**
|
|
164
|
+
* @default 'fuzzy'
|
|
165
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#notfoundmode-property)
|
|
166
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/not-found-errors#the-notfoundmode-option)
|
|
167
|
+
*/
|
|
168
|
+
notFoundMode?: 'root' | 'fuzzy';
|
|
169
|
+
/**
|
|
170
|
+
* The default `gcTime` a route should use if no gcTime is provided.
|
|
171
|
+
*
|
|
172
|
+
* @default 1_800_000 `(30 minutes)`
|
|
173
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultgctime-property)
|
|
174
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#key-options)
|
|
175
|
+
*/
|
|
176
|
+
defaultGcTime?: number;
|
|
177
|
+
/**
|
|
178
|
+
* If `true`, all routes will be matched as case-sensitive.
|
|
179
|
+
*
|
|
180
|
+
* @default false
|
|
181
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#casesensitive-property)
|
|
182
|
+
*/
|
|
183
|
+
caseSensitive?: boolean;
|
|
184
|
+
/**
|
|
185
|
+
*
|
|
186
|
+
* The route tree that will be used to configure the router instance.
|
|
187
|
+
*
|
|
188
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#routetree-property)
|
|
189
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/routing/route-trees)
|
|
190
|
+
*/
|
|
191
|
+
routeTree?: TRouteTree;
|
|
192
|
+
/**
|
|
193
|
+
* The basepath for then entire router. This is useful for mounting a router instance at a subpath.
|
|
194
|
+
* ```
|
|
195
|
+
* @default '/'
|
|
196
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#basepath-property)
|
|
197
|
+
*/
|
|
198
|
+
basepath?: string;
|
|
199
|
+
/**
|
|
200
|
+
* The root context that will be provided to all routes in the route tree.
|
|
201
|
+
*
|
|
202
|
+
* This can be used to provide a context to all routes in the tree without having to provide it to each route individually.
|
|
203
|
+
*
|
|
204
|
+
* Optional or required if the root route was created with [`createRootRouteWithContext()`](https://tanstack.com/router/latest/docs/framework/react/api/router/createRootRouteWithContextFunction).
|
|
205
|
+
*
|
|
206
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#context-property)
|
|
207
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/router-context)
|
|
208
|
+
*/
|
|
209
|
+
context?: InferRouterContext<TRouteTree>;
|
|
210
|
+
additionalContext?: any;
|
|
211
|
+
/**
|
|
212
|
+
* A function that will be called when the router is dehydrated.
|
|
213
|
+
*
|
|
214
|
+
* The return value of this function will be serialized and stored in the router's dehydrated state.
|
|
215
|
+
*
|
|
216
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#dehydrate-method)
|
|
217
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/external-data-loading#critical-dehydrationhydration)
|
|
218
|
+
*/
|
|
219
|
+
dehydrate?: () => Constrain<TDehydrated, ValidateSerializableInput<Register, TDehydrated>>;
|
|
220
|
+
/**
|
|
221
|
+
* A function that will be called when the router is hydrated.
|
|
222
|
+
*
|
|
223
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#hydrate-method)
|
|
224
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/external-data-loading#critical-dehydrationhydration)
|
|
225
|
+
*/
|
|
226
|
+
hydrate?: (dehydrated: TDehydrated) => Awaitable<void>;
|
|
227
|
+
/**
|
|
228
|
+
* An array of route masks that will be used to mask routes in the route tree.
|
|
229
|
+
*
|
|
230
|
+
* Route masking is when you display a route at a different path than the one it is configured to match, like a modal popup that when shared will unmask to the modal's content instead of the modal's context.
|
|
231
|
+
*
|
|
232
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#routemasks-property)
|
|
233
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/route-masking)
|
|
234
|
+
*/
|
|
235
|
+
routeMasks?: Array<RouteMask<TRouteTree>>;
|
|
236
|
+
/**
|
|
237
|
+
* If `true`, route masks will, by default, be removed when the page is reloaded.
|
|
238
|
+
*
|
|
239
|
+
* This can be overridden on a per-mask basis by setting the `unmaskOnReload` option on the mask, or on a per-navigation basis by setting the `unmaskOnReload` option in the `Navigate` options.
|
|
240
|
+
*
|
|
241
|
+
* @default false
|
|
242
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#unmaskonreload-property)
|
|
243
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/route-masking#unmasking-on-page-reload)
|
|
244
|
+
*/
|
|
245
|
+
unmaskOnReload?: boolean;
|
|
246
|
+
/**
|
|
247
|
+
* Use `notFoundComponent` instead.
|
|
248
|
+
*
|
|
249
|
+
* @deprecated
|
|
250
|
+
* See https://tanstack.com/router/v1/docs/guide/not-found-errors#migrating-from-notfoundroute for more info.
|
|
251
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#notfoundroute-property)
|
|
252
|
+
*/
|
|
253
|
+
notFoundRoute?: AnyRoute;
|
|
254
|
+
/**
|
|
255
|
+
* Configures how trailing slashes are treated.
|
|
256
|
+
*
|
|
257
|
+
* - `'always'` will add a trailing slash if not present
|
|
258
|
+
* - `'never'` will remove the trailing slash if present
|
|
259
|
+
* - `'preserve'` will not modify the trailing slash.
|
|
260
|
+
*
|
|
261
|
+
* @default 'never'
|
|
262
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#trailingslash-property)
|
|
263
|
+
*/
|
|
264
|
+
trailingSlash?: TTrailingSlashOption;
|
|
265
|
+
/**
|
|
266
|
+
* While usually automatic, sometimes it can be useful to force the router into a server-side state, e.g. when using the router in a non-browser environment that has access to a global.document object.
|
|
267
|
+
*
|
|
268
|
+
* @default typeof document !== 'undefined'
|
|
269
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#isserver-property)
|
|
270
|
+
*/
|
|
271
|
+
isServer?: boolean;
|
|
272
|
+
/**
|
|
273
|
+
* @default false
|
|
274
|
+
*/
|
|
275
|
+
isShell?: boolean;
|
|
276
|
+
/**
|
|
277
|
+
* @default false
|
|
278
|
+
*/
|
|
279
|
+
isPrerendering?: boolean;
|
|
280
|
+
/**
|
|
281
|
+
* The default `ssr` a route should use if no `ssr` is provided.
|
|
282
|
+
*
|
|
283
|
+
* @default true
|
|
284
|
+
*/
|
|
285
|
+
defaultSsr?: SSROption;
|
|
286
|
+
search?: {
|
|
287
|
+
/**
|
|
288
|
+
* Configures how unknown search params (= not returned by any `validateSearch`) are treated.
|
|
289
|
+
*
|
|
290
|
+
* @default false
|
|
291
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#search.strict-property)
|
|
292
|
+
*/
|
|
293
|
+
strict?: boolean;
|
|
294
|
+
};
|
|
295
|
+
/**
|
|
296
|
+
* Configures whether structural sharing is enabled by default for fine-grained selectors.
|
|
297
|
+
*
|
|
298
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultstructuralsharing-property)
|
|
299
|
+
*/
|
|
300
|
+
defaultStructuralSharing?: TDefaultStructuralSharingOption;
|
|
301
|
+
/**
|
|
302
|
+
* Configures which URI characters are allowed in path params that would ordinarily be escaped by encodeURIComponent.
|
|
303
|
+
*
|
|
304
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#pathparamsallowedcharacters-property)
|
|
305
|
+
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/path-params#allowed-characters)
|
|
306
|
+
*/
|
|
307
|
+
pathParamsAllowedCharacters?: Array<';' | ':' | '@' | '&' | '=' | '+' | '$' | ','>;
|
|
308
|
+
defaultRemountDeps?: DefaultRemountDepsFn<TRouteTree>;
|
|
309
|
+
/**
|
|
310
|
+
* If `true`, scroll restoration will be enabled
|
|
311
|
+
*
|
|
312
|
+
* @default false
|
|
313
|
+
*/
|
|
314
|
+
scrollRestoration?: boolean | ((opts: {
|
|
315
|
+
location: ParsedLocation;
|
|
316
|
+
}) => boolean);
|
|
317
|
+
/**
|
|
318
|
+
* A function that will be called to get the key for the scroll restoration cache.
|
|
319
|
+
*
|
|
320
|
+
* @default (location) => location.href
|
|
321
|
+
*/
|
|
322
|
+
getScrollRestorationKey?: (location: ParsedLocation) => string;
|
|
323
|
+
/**
|
|
324
|
+
* The default behavior for scroll restoration.
|
|
325
|
+
*
|
|
326
|
+
* @default 'auto'
|
|
327
|
+
*/
|
|
328
|
+
scrollRestorationBehavior?: ScrollBehavior;
|
|
329
|
+
/**
|
|
330
|
+
* An array of selectors that will be used to scroll to the top of the page in addition to `window`
|
|
331
|
+
*
|
|
332
|
+
* @default ['window']
|
|
333
|
+
*/
|
|
334
|
+
scrollToTopSelectors?: Array<string | (() => Element | null | undefined)>;
|
|
335
|
+
/**
|
|
336
|
+
* When `true`, disables the global catch boundary that normally wraps all route matches.
|
|
337
|
+
* This allows unhandled errors to bubble up to top-level error handlers in the browser.
|
|
338
|
+
*
|
|
339
|
+
* Useful for testing tools (like Storybook Test Runner), error reporting services,
|
|
340
|
+
* and debugging scenarios where you want errors to reach the browser's global error handlers.
|
|
341
|
+
*
|
|
342
|
+
* @default false
|
|
343
|
+
*/
|
|
344
|
+
disableGlobalCatchBoundary?: boolean;
|
|
345
|
+
/**
|
|
346
|
+
* An array of URL protocols to allow in links, redirects, and navigation.
|
|
347
|
+
* Absolute URLs with protocols not in this list will be rejected.
|
|
348
|
+
*
|
|
349
|
+
* @default DEFAULT_PROTOCOL_ALLOWLIST (http:, https:, mailto:, tel:)
|
|
350
|
+
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#protocolallowlist-property)
|
|
351
|
+
*/
|
|
352
|
+
protocolAllowlist?: Array<string>;
|
|
353
|
+
serializationAdapters?: ReadonlyArray<AnySerializationAdapter>;
|
|
354
|
+
/**
|
|
355
|
+
* Configures how the router will rewrite the location between the actual href and the internal href of the router.
|
|
356
|
+
*
|
|
357
|
+
* @default undefined
|
|
358
|
+
* @description You can provide a custom rewrite pair (in/out).
|
|
359
|
+
* This is useful for shifting data from the origin to the path (for things like subdomain routing), or other advanced use cases.
|
|
360
|
+
*/
|
|
361
|
+
rewrite?: LocationRewrite;
|
|
362
|
+
origin?: string;
|
|
363
|
+
ssr?: {
|
|
364
|
+
nonce?: string;
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
export type LocationRewrite = {
|
|
368
|
+
/**
|
|
369
|
+
* A function that will be called to rewrite the URL before it is interpreted by the router from the history instance.
|
|
370
|
+
*
|
|
371
|
+
* @default undefined
|
|
372
|
+
*/
|
|
373
|
+
input?: LocationRewriteFunction;
|
|
374
|
+
/**
|
|
375
|
+
* A function that will be called to rewrite the URL before it is committed to the actual history instance from the router.
|
|
376
|
+
*
|
|
377
|
+
* @default undefined
|
|
378
|
+
*/
|
|
379
|
+
output?: LocationRewriteFunction;
|
|
380
|
+
};
|
|
381
|
+
/**
|
|
382
|
+
* A function that will be called to rewrite the URL.
|
|
383
|
+
*
|
|
384
|
+
* @param url The URL to rewrite.
|
|
385
|
+
* @returns The rewritten URL (as a URL instance or full href string) or undefined if no rewrite is needed.
|
|
386
|
+
*/
|
|
387
|
+
export type LocationRewriteFunction = ({ url, }: {
|
|
388
|
+
url: URL;
|
|
389
|
+
}) => undefined | string | URL;
|
|
390
|
+
export interface RouterState<in out TRouteTree extends AnyRoute = AnyRoute, in out TRouteMatch = MakeRouteMatchUnion> {
|
|
391
|
+
status: 'pending' | 'idle';
|
|
392
|
+
loadedAt: number;
|
|
393
|
+
isLoading: boolean;
|
|
394
|
+
isTransitioning: boolean;
|
|
395
|
+
matches: Array<TRouteMatch>;
|
|
396
|
+
location: ParsedLocation<FullSearchSchema<TRouteTree>>;
|
|
397
|
+
resolvedLocation?: ParsedLocation<FullSearchSchema<TRouteTree>>;
|
|
398
|
+
statusCode: number;
|
|
399
|
+
redirect?: AnyRedirect;
|
|
400
|
+
}
|
|
401
|
+
export interface BuildNextOptions {
|
|
402
|
+
to?: string | number | null;
|
|
403
|
+
params?: true | Updater<unknown>;
|
|
404
|
+
search?: true | Updater<unknown>;
|
|
405
|
+
hash?: true | Updater<string>;
|
|
406
|
+
state?: true | NonNullableUpdater<ParsedHistoryState, HistoryState>;
|
|
407
|
+
mask?: {
|
|
408
|
+
to?: string | number | null;
|
|
409
|
+
params?: true | Updater<unknown>;
|
|
410
|
+
search?: true | Updater<unknown>;
|
|
411
|
+
hash?: true | Updater<string>;
|
|
412
|
+
state?: true | NonNullableUpdater<ParsedHistoryState, HistoryState>;
|
|
413
|
+
unmaskOnReload?: boolean;
|
|
414
|
+
};
|
|
415
|
+
from?: string;
|
|
416
|
+
href?: string;
|
|
417
|
+
_fromLocation?: ParsedLocation;
|
|
418
|
+
unsafeRelative?: 'path';
|
|
419
|
+
_isNavigate?: boolean;
|
|
420
|
+
}
|
|
421
|
+
type NavigationEventInfo = {
|
|
422
|
+
fromLocation?: ParsedLocation;
|
|
423
|
+
toLocation: ParsedLocation;
|
|
424
|
+
pathChanged: boolean;
|
|
425
|
+
hrefChanged: boolean;
|
|
426
|
+
hashChanged: boolean;
|
|
427
|
+
};
|
|
428
|
+
export interface RouterEvents {
|
|
429
|
+
onBeforeNavigate: {
|
|
430
|
+
type: 'onBeforeNavigate';
|
|
431
|
+
} & NavigationEventInfo;
|
|
432
|
+
onBeforeLoad: {
|
|
433
|
+
type: 'onBeforeLoad';
|
|
434
|
+
} & NavigationEventInfo;
|
|
435
|
+
onLoad: {
|
|
436
|
+
type: 'onLoad';
|
|
437
|
+
} & NavigationEventInfo;
|
|
438
|
+
onResolved: {
|
|
439
|
+
type: 'onResolved';
|
|
440
|
+
} & NavigationEventInfo;
|
|
441
|
+
onBeforeRouteMount: {
|
|
442
|
+
type: 'onBeforeRouteMount';
|
|
443
|
+
} & NavigationEventInfo;
|
|
444
|
+
onRendered: {
|
|
445
|
+
type: 'onRendered';
|
|
446
|
+
} & NavigationEventInfo;
|
|
447
|
+
}
|
|
448
|
+
export type RouterEvent = RouterEvents[keyof RouterEvents];
|
|
449
|
+
export type ListenerFn<TEvent extends RouterEvent> = (event: TEvent) => void;
|
|
450
|
+
export type RouterListener<TRouterEvent extends RouterEvent> = {
|
|
451
|
+
eventType: TRouterEvent['type'];
|
|
452
|
+
fn: ListenerFn<TRouterEvent>;
|
|
453
|
+
};
|
|
454
|
+
export type SubscribeFn = <TType extends keyof RouterEvents>(eventType: TType, fn: ListenerFn<RouterEvents[TType]>) => () => void;
|
|
455
|
+
export interface MatchRoutesOpts {
|
|
456
|
+
preload?: boolean;
|
|
457
|
+
throwOnError?: boolean;
|
|
458
|
+
dest?: BuildNextOptions;
|
|
459
|
+
}
|
|
460
|
+
export type InferRouterContext<TRouteTree extends AnyRoute> = TRouteTree['types']['routerContext'];
|
|
461
|
+
export type RouterContextOptions<TRouteTree extends AnyRoute> = AnyContext extends InferRouterContext<TRouteTree> ? {
|
|
462
|
+
context?: InferRouterContext<TRouteTree>;
|
|
463
|
+
} : {
|
|
464
|
+
context: InferRouterContext<TRouteTree>;
|
|
465
|
+
};
|
|
466
|
+
export type RouterConstructorOptions<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean, TRouterHistory extends RouterHistory, TDehydrated extends Record<string, any>> = Omit<RouterOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>, 'context' | 'serializationAdapters' | 'defaultSsr'> & RouterContextOptions<TRouteTree>;
|
|
467
|
+
export type PreloadRouteFn<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean, TRouterHistory extends RouterHistory> = <TFrom extends RoutePaths<TRouteTree> | string = string, TTo extends string | undefined = undefined, TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom, TMaskTo extends string = ''>(opts: NavigateOptions<RouterCore<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory>, TFrom, TTo, TMaskFrom, TMaskTo> & {}) => Promise<Array<AnyRouteMatch> | undefined>;
|
|
468
|
+
export type MatchRouteFn<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean, TRouterHistory extends RouterHistory> = <TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string | undefined = undefined, TResolved = ResolveRelativePath<TFrom, NoInfer<TTo>>>(location: ToOptions<RouterCore<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory>, TFrom, TTo>, opts?: MatchRouteOptions) => false | RouteById<TRouteTree, TResolved>['types']['allParams'];
|
|
469
|
+
export type UpdateFn<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean, TRouterHistory extends RouterHistory, TDehydrated extends Record<string, any>> = (newOptions: RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>) => void;
|
|
470
|
+
export type InvalidateFn<TRouter extends AnyRouter> = (opts?: {
|
|
471
|
+
filter?: (d: MakeRouteMatchUnion<TRouter>) => boolean;
|
|
472
|
+
sync?: boolean;
|
|
473
|
+
forcePending?: boolean;
|
|
474
|
+
}) => Promise<void>;
|
|
475
|
+
export type ParseLocationFn<TRouteTree extends AnyRoute> = (locationToParse: HistoryLocation, previousLocation?: ParsedLocation<FullSearchSchema<TRouteTree>>) => ParsedLocation<FullSearchSchema<TRouteTree>>;
|
|
476
|
+
export type GetMatchRoutesFn = (pathname: string) => {
|
|
477
|
+
matchedRoutes: ReadonlyArray<AnyRoute>;
|
|
478
|
+
/** exhaustive params, still in their string form */
|
|
479
|
+
routeParams: Record<string, string>;
|
|
480
|
+
/** partial params, parsed from routeParams during matching */
|
|
481
|
+
parsedParams: Record<string, unknown> | undefined;
|
|
482
|
+
foundRoute: AnyRoute | undefined;
|
|
483
|
+
parseError?: unknown;
|
|
484
|
+
};
|
|
485
|
+
export type EmitFn = (routerEvent: RouterEvent) => void;
|
|
486
|
+
export type LoadFn = (opts?: {
|
|
487
|
+
sync?: boolean;
|
|
488
|
+
}) => Promise<void>;
|
|
489
|
+
export type CommitLocationFn = ({ viewTransition, ignoreBlocker, ...next }: ParsedLocation & CommitLocationOptions) => Promise<void>;
|
|
490
|
+
export type StartTransitionFn = (fn: () => void) => void;
|
|
491
|
+
export interface MatchRoutesFn {
|
|
492
|
+
(pathname: string, locationSearch?: AnySchema, opts?: MatchRoutesOpts): Array<MakeRouteMatchUnion>;
|
|
493
|
+
/**
|
|
494
|
+
* @deprecated use the following signature instead
|
|
495
|
+
*/
|
|
496
|
+
(next: ParsedLocation, opts?: MatchRoutesOpts): Array<AnyRouteMatch>;
|
|
497
|
+
(pathnameOrNext: string | ParsedLocation, locationSearchOrOpts?: AnySchema | MatchRoutesOpts, opts?: MatchRoutesOpts): Array<AnyRouteMatch>;
|
|
498
|
+
}
|
|
499
|
+
export type GetMatchFn = (matchId: string) => AnyRouteMatch | undefined;
|
|
500
|
+
export type UpdateMatchFn = (id: string, updater: (match: AnyRouteMatch) => AnyRouteMatch) => void;
|
|
501
|
+
export type LoadRouteChunkFn = (route: AnyRoute) => Promise<Array<void>>;
|
|
502
|
+
export type ResolveRedirect = (err: AnyRedirect) => ResolvedRedirect;
|
|
503
|
+
export type ClearCacheFn<TRouter extends AnyRouter> = (opts?: {
|
|
504
|
+
filter?: (d: MakeRouteMatchUnion<TRouter>) => boolean;
|
|
505
|
+
}) => void;
|
|
506
|
+
export interface ServerSsr {
|
|
507
|
+
/**
|
|
508
|
+
* Injects HTML synchronously into the stream.
|
|
509
|
+
* Emits an onInjectedHtml event that listeners can handle.
|
|
510
|
+
* If no subscriber is listening, the HTML is buffered and can be retrieved via takeBufferedHtml().
|
|
511
|
+
*/
|
|
512
|
+
injectHtml: (html: string) => void;
|
|
513
|
+
/**
|
|
514
|
+
* Injects a script tag synchronously into the stream.
|
|
515
|
+
*/
|
|
516
|
+
injectScript: (script: string) => void;
|
|
517
|
+
isDehydrated: () => boolean;
|
|
518
|
+
isSerializationFinished: () => boolean;
|
|
519
|
+
onRenderFinished: (listener: () => void) => void;
|
|
520
|
+
setRenderFinished: () => void;
|
|
521
|
+
cleanup: () => void;
|
|
522
|
+
onSerializationFinished: (listener: () => void) => void;
|
|
523
|
+
dehydrate: () => Promise<void>;
|
|
524
|
+
takeBufferedScripts: () => RouterManagedTag | undefined;
|
|
525
|
+
/**
|
|
526
|
+
* Takes any buffered HTML that was injected.
|
|
527
|
+
* Returns the buffered HTML string (which may include multiple script tags) or undefined if empty.
|
|
528
|
+
*/
|
|
529
|
+
takeBufferedHtml: () => string | undefined;
|
|
530
|
+
liftScriptBarrier: () => void;
|
|
531
|
+
}
|
|
532
|
+
export type AnyRouterWithContext<TContext> = RouterCore<AnyRouteWithContext<TContext>, any, any, any, any>;
|
|
533
|
+
export type AnyRouter = RouterCore<any, any, any, any, any>;
|
|
534
|
+
export interface ViewTransitionOptions {
|
|
535
|
+
types: Array<string> | ((locationChangeInfo: {
|
|
536
|
+
fromLocation?: ParsedLocation;
|
|
537
|
+
toLocation: ParsedLocation;
|
|
538
|
+
pathChanged: boolean;
|
|
539
|
+
hrefChanged: boolean;
|
|
540
|
+
hashChanged: boolean;
|
|
541
|
+
}) => Array<string> | false);
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Convert an unknown error into a minimal, serializable object.
|
|
545
|
+
* Includes name and message (and stack in development).
|
|
546
|
+
*/
|
|
547
|
+
export declare function defaultSerializeError(err: unknown): {
|
|
548
|
+
name: string;
|
|
549
|
+
message: string;
|
|
550
|
+
} | {
|
|
551
|
+
data: unknown;
|
|
552
|
+
};
|
|
553
|
+
/** Options for configuring trailing-slash behavior. */
|
|
554
|
+
export declare const trailingSlashOptions: {
|
|
555
|
+
readonly always: "always";
|
|
556
|
+
readonly never: "never";
|
|
557
|
+
readonly preserve: "preserve";
|
|
558
|
+
};
|
|
559
|
+
export type TrailingSlashOption = (typeof trailingSlashOptions)[keyof typeof trailingSlashOptions];
|
|
560
|
+
/**
|
|
561
|
+
* Compute whether path, href or hash changed between previous and current
|
|
562
|
+
* resolved locations.
|
|
563
|
+
*/
|
|
564
|
+
export declare function getLocationChangeInfo(location: ParsedLocation, resolvedLocation?: ParsedLocation): {
|
|
565
|
+
fromLocation: ParsedLocation<{}> | undefined;
|
|
566
|
+
toLocation: ParsedLocation<{}>;
|
|
567
|
+
pathChanged: boolean;
|
|
568
|
+
hrefChanged: boolean;
|
|
569
|
+
hashChanged: boolean;
|
|
570
|
+
};
|
|
571
|
+
export type CreateRouterFn = <TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption = 'never', TDefaultStructuralSharingOption extends boolean = false, TRouterHistory extends RouterHistory = RouterHistory, TDehydrated extends Record<string, any> = Record<string, any>>(options: undefined extends number ? 'strictNullChecks must be enabled in tsconfig.json' : RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>) => RouterCore<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>;
|
|
572
|
+
declare global {
|
|
573
|
+
var __TSR_CACHE__: {
|
|
574
|
+
routeTree: AnyRoute;
|
|
575
|
+
processRouteTreeResult: ProcessRouteTreeResult<AnyRoute>;
|
|
576
|
+
resolvePathCache: LRUCache<string, string>;
|
|
577
|
+
} | undefined;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Core, framework-agnostic router engine that powers TanStack Router.
|
|
581
|
+
*
|
|
582
|
+
* Provides navigation, matching, loading, preloading, caching and event APIs
|
|
583
|
+
* used by framework adapters (React/Solid). Prefer framework helpers like
|
|
584
|
+
* `createRouter` in app code.
|
|
585
|
+
*
|
|
586
|
+
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/RouterType
|
|
587
|
+
*/
|
|
588
|
+
export declare class RouterCore<in out TRouteTree extends AnyRoute, in out TTrailingSlashOption extends TrailingSlashOption, in out TDefaultStructuralSharingOption extends boolean, in out TRouterHistory extends RouterHistory = RouterHistory, in out TDehydrated extends Record<string, any> = Record<string, any>> {
|
|
589
|
+
tempLocationKey: string | undefined;
|
|
590
|
+
resetNextScroll: boolean;
|
|
591
|
+
shouldViewTransition?: boolean | ViewTransitionOptions;
|
|
592
|
+
isViewTransitionTypesSupported?: boolean;
|
|
593
|
+
subscribers: Set<RouterListener<RouterEvent>>;
|
|
594
|
+
viewTransitionPromise?: ControlledPromise<true>;
|
|
595
|
+
isScrollRestoring: boolean;
|
|
596
|
+
isScrollRestorationSetup: boolean;
|
|
597
|
+
stores: RouterStores<TRouteTree>;
|
|
598
|
+
private getStoreConfig;
|
|
599
|
+
batch: (fn: () => void) => void;
|
|
600
|
+
options: PickAsRequired<RouterOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>, 'stringifySearch' | 'parseSearch' | 'context'>;
|
|
601
|
+
history: TRouterHistory;
|
|
602
|
+
rewrite?: LocationRewrite;
|
|
603
|
+
origin?: string;
|
|
604
|
+
latestLocation: ParsedLocation<FullSearchSchema<TRouteTree>>;
|
|
605
|
+
pendingBuiltLocation?: ParsedLocation<FullSearchSchema<TRouteTree>>;
|
|
606
|
+
basepath: string;
|
|
607
|
+
routeTree: TRouteTree;
|
|
608
|
+
routesById: RoutesById<TRouteTree>;
|
|
609
|
+
routesByPath: RoutesByPath<TRouteTree>;
|
|
610
|
+
processedTree: ProcessedTree<TRouteTree, any, any>;
|
|
611
|
+
resolvePathCache: LRUCache<string, string>;
|
|
612
|
+
isServer: boolean;
|
|
613
|
+
pathParamsDecoder?: (encoded: string) => string;
|
|
614
|
+
protocolAllowlist: Set<string>;
|
|
615
|
+
/**
|
|
616
|
+
* @deprecated Use the `createRouter` function instead
|
|
617
|
+
*/
|
|
618
|
+
constructor(options: RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>, getStoreConfig: GetStoreConfig);
|
|
619
|
+
startTransition: StartTransitionFn;
|
|
620
|
+
isShell(): boolean;
|
|
621
|
+
isPrerendering(): boolean;
|
|
622
|
+
update: UpdateFn<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>;
|
|
623
|
+
get state(): RouterState<TRouteTree>;
|
|
624
|
+
updateLatestLocation: () => void;
|
|
625
|
+
buildRouteTree: () => ProcessRouteTreeResult<TRouteTree>;
|
|
626
|
+
setRoutes({ routesById, routesByPath, processedTree, }: ProcessRouteTreeResult<TRouteTree>): void;
|
|
627
|
+
/**
|
|
628
|
+
* Subscribe to router lifecycle events like `onBeforeNavigate`, `onLoad`,
|
|
629
|
+
* `onResolved`, etc. Returns an unsubscribe function.
|
|
630
|
+
*
|
|
631
|
+
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/RouterEventsType
|
|
632
|
+
*/
|
|
633
|
+
subscribe: SubscribeFn;
|
|
634
|
+
emit: EmitFn;
|
|
635
|
+
/**
|
|
636
|
+
* Parse a HistoryLocation into a strongly-typed ParsedLocation using the
|
|
637
|
+
* current router options, rewrite rules and search parser/stringifier.
|
|
638
|
+
*/
|
|
639
|
+
parseLocation: ParseLocationFn<TRouteTree>;
|
|
640
|
+
/** Resolve a path against the router basepath and trailing-slash policy. */
|
|
641
|
+
resolvePathWithBase: (from: string, path: string) => string;
|
|
642
|
+
get looseRoutesById(): Record<string, AnyRoute>;
|
|
643
|
+
matchRoutes: MatchRoutesFn;
|
|
644
|
+
private getParentContext;
|
|
645
|
+
private matchRoutesInternal;
|
|
646
|
+
getMatchedRoutes: GetMatchRoutesFn;
|
|
647
|
+
/**
|
|
648
|
+
* Lightweight route matching for buildLocation.
|
|
649
|
+
* Only computes fullPath, accumulated search, and params - skipping expensive
|
|
650
|
+
* operations like AbortController, ControlledPromise, loaderDeps, and full match objects.
|
|
651
|
+
*/
|
|
652
|
+
private matchRoutesLightweight;
|
|
653
|
+
cancelMatch: (id: string) => void;
|
|
654
|
+
cancelMatches: () => void;
|
|
655
|
+
/**
|
|
656
|
+
* Build the next ParsedLocation from navigation options without committing.
|
|
657
|
+
* Resolves `to`/`from`, params/search/hash/state, applies search validation
|
|
658
|
+
* and middlewares, and returns a stable, stringified location object.
|
|
659
|
+
*
|
|
660
|
+
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/RouterType#buildlocation-method
|
|
661
|
+
*/
|
|
662
|
+
buildLocation: BuildLocationFn;
|
|
663
|
+
commitLocationPromise: undefined | ControlledPromise<void>;
|
|
664
|
+
/**
|
|
665
|
+
* Commit a previously built location to history (push/replace), optionally
|
|
666
|
+
* using view transitions and scroll restoration options.
|
|
667
|
+
*/
|
|
668
|
+
commitLocation: CommitLocationFn;
|
|
669
|
+
/** Convenience helper: build a location from options, then commit it. */
|
|
670
|
+
buildAndCommitLocation: ({ replace, resetScroll, hashScrollIntoView, viewTransition, ignoreBlocker, href, ...rest }?: BuildNextOptions & CommitLocationOptions) => Promise<void>;
|
|
671
|
+
/**
|
|
672
|
+
* Imperatively navigate using standard `NavigateOptions`. When `reloadDocument`
|
|
673
|
+
* or an absolute `href` is provided, performs a full document navigation.
|
|
674
|
+
* Otherwise, builds and commits a client-side location.
|
|
675
|
+
*
|
|
676
|
+
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType
|
|
677
|
+
*/
|
|
678
|
+
navigate: NavigateFn;
|
|
679
|
+
latestLoadPromise: undefined | Promise<void>;
|
|
680
|
+
beforeLoad: () => void;
|
|
681
|
+
load: LoadFn;
|
|
682
|
+
startViewTransition: (fn: () => Promise<void>) => void;
|
|
683
|
+
updateMatch: UpdateMatchFn;
|
|
684
|
+
getMatch: GetMatchFn;
|
|
685
|
+
/**
|
|
686
|
+
* Invalidate the current matches and optionally force them back into a pending state.
|
|
687
|
+
*
|
|
688
|
+
* - Marks all matches that pass the optional `filter` as `invalid: true`.
|
|
689
|
+
* - If `forcePending` is true, or a match is currently in `'error'` or `'notFound'` status,
|
|
690
|
+
* its status is reset to `'pending'` and its `error` cleared so that the loader is re-run
|
|
691
|
+
* on the next `load()` call (eg. after HMR or a manual invalidation).
|
|
692
|
+
*/
|
|
693
|
+
invalidate: InvalidateFn<RouterCore<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>>;
|
|
694
|
+
getParsedLocationHref: (location: ParsedLocation) => string;
|
|
695
|
+
resolveRedirect: (redirect: AnyRedirect) => AnyRedirect;
|
|
696
|
+
clearCache: ClearCacheFn<this>;
|
|
697
|
+
clearExpiredCache: () => void;
|
|
698
|
+
loadRouteChunk: typeof loadRouteChunk;
|
|
699
|
+
preloadRoute: PreloadRouteFn<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory>;
|
|
700
|
+
matchRoute: MatchRouteFn<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory>;
|
|
701
|
+
ssr?: {
|
|
702
|
+
manifest: Manifest | undefined;
|
|
703
|
+
};
|
|
704
|
+
serverSsr?: ServerSsr;
|
|
705
|
+
hasNotFoundMatch: () => boolean;
|
|
706
|
+
}
|
|
707
|
+
/** Error thrown when search parameter validation fails. */
|
|
708
|
+
export declare class SearchParamError extends Error {
|
|
709
|
+
}
|
|
710
|
+
/** Error thrown when path parameter parsing/validation fails. */
|
|
711
|
+
export declare class PathParamError extends Error {
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Lazily import a module function and forward arguments to it, retaining
|
|
715
|
+
* parameter and return types for the selected export key.
|
|
716
|
+
*/
|
|
717
|
+
export declare function lazyFn<T extends Record<string, (...args: Array<any>) => any>, TKey extends keyof T = 'default'>(fn: () => Promise<T>, key?: TKey): (...args: Parameters<T[TKey]>) => Promise<Awaited<ReturnType<T[TKey]>>>;
|
|
718
|
+
/** Create an initial RouterState from a parsed location. */
|
|
719
|
+
export declare function getInitialRouterState(location: ParsedLocation): RouterState<any>;
|
|
720
|
+
/**
|
|
721
|
+
* Build the matched route chain and extract params for a pathname.
|
|
722
|
+
* Falls back to the root route if no specific route is found.
|
|
723
|
+
*/
|
|
724
|
+
export declare function getMatchedRoutes<TRouteLike extends RouteLike>({ pathname, routesById, processedTree, }: {
|
|
725
|
+
pathname: string;
|
|
726
|
+
routesById: Record<string, TRouteLike>;
|
|
727
|
+
processedTree: ProcessedTree<any, any, any>;
|
|
728
|
+
}): {
|
|
729
|
+
matchedRoutes: readonly TRouteLike[];
|
|
730
|
+
routeParams: Record<string, string>;
|
|
731
|
+
foundRoute: TRouteLike | undefined;
|
|
732
|
+
parsedParams: Record<string, unknown> | undefined;
|
|
733
|
+
};
|
|
734
|
+
export {};
|