@tanstack/router-core 1.131.19 → 1.131.21
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/dist/cjs/index.cjs +2 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2 -1
- package/dist/cjs/load-matches.cjs +671 -0
- package/dist/cjs/load-matches.cjs.map +1 -0
- package/dist/cjs/load-matches.d.cts +16 -0
- package/dist/cjs/router.cjs +8 -694
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +3 -27
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/load-matches.d.ts +16 -0
- package/dist/esm/load-matches.js +671 -0
- package/dist/esm/load-matches.js.map +1 -0
- package/dist/esm/router.d.ts +3 -27
- package/dist/esm/router.js +8 -694
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -1
- package/src/load-matches.ts +982 -0
- package/src/router.ts +7 -1004
package/dist/cjs/router.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Store } from '@tanstack/store';
|
|
2
|
+
import { loadRouteChunk } from './load-matches.cjs';
|
|
2
3
|
import { ParsePathnameCache } from './path.cjs';
|
|
3
4
|
import { SearchParser, SearchSerializer } from './searchParams.cjs';
|
|
4
5
|
import { AnyRedirect, ResolvedRedirect } from './redirect.cjs';
|
|
@@ -7,7 +8,7 @@ import { Awaitable, ControlledPromise, NoInfer, NonNullableUpdater, PickAsRequir
|
|
|
7
8
|
import { ParsedLocation } from './location.cjs';
|
|
8
9
|
import { AnyContext, AnyRoute, AnyRouteWithContext, MakeRemountDepsOptionsUnion, RouteMask } from './route.cjs';
|
|
9
10
|
import { FullSearchSchema, RouteById, RoutePaths, RoutesById, RoutesByPath } from './routeInfo.cjs';
|
|
10
|
-
import { AnyRouteMatch,
|
|
11
|
+
import { AnyRouteMatch, MakeRouteMatchUnion, MatchRouteOptions } from './Matches.cjs';
|
|
11
12
|
import { BuildLocationFn, CommitLocationOptions, NavigateFn } from './RouterProvider.cjs';
|
|
12
13
|
import { Manifest } from './manifest.cjs';
|
|
13
14
|
import { AnySchema } from './validators.cjs';
|
|
@@ -528,41 +529,17 @@ export declare class RouterCore<in out TRouteTree extends AnyRoute, in out TTrai
|
|
|
528
529
|
startViewTransition: (fn: () => Promise<void>) => void;
|
|
529
530
|
updateMatch: UpdateMatchFn;
|
|
530
531
|
getMatch: GetMatchFn;
|
|
531
|
-
private triggerOnReady;
|
|
532
|
-
private resolvePreload;
|
|
533
|
-
private handleRedirectAndNotFound;
|
|
534
|
-
private shouldSkipLoader;
|
|
535
|
-
private handleSerialError;
|
|
536
|
-
private isBeforeLoadSsr;
|
|
537
|
-
private setupPendingTimeout;
|
|
538
|
-
private shouldExecuteBeforeLoad;
|
|
539
|
-
private executeBeforeLoad;
|
|
540
|
-
private handleBeforeLoad;
|
|
541
|
-
private executeHead;
|
|
542
|
-
private potentialPendingMinPromise;
|
|
543
|
-
private getLoaderContext;
|
|
544
|
-
private runLoader;
|
|
545
|
-
private loadRouteMatch;
|
|
546
|
-
loadMatches: (baseContext: {
|
|
547
|
-
location: ParsedLocation;
|
|
548
|
-
matches: Array<AnyRouteMatch>;
|
|
549
|
-
preload?: boolean;
|
|
550
|
-
onReady?: () => Promise<void>;
|
|
551
|
-
updateMatch?: UpdateMatchFn;
|
|
552
|
-
sync?: boolean;
|
|
553
|
-
}) => Promise<Array<MakeRouteMatch>>;
|
|
554
532
|
invalidate: InvalidateFn<RouterCore<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>>;
|
|
555
533
|
resolveRedirect: (redirect: AnyRedirect) => AnyRedirect;
|
|
556
534
|
clearCache: ClearCacheFn<this>;
|
|
557
535
|
clearExpiredCache: () => void;
|
|
558
|
-
loadRouteChunk:
|
|
536
|
+
loadRouteChunk: typeof loadRouteChunk;
|
|
559
537
|
preloadRoute: PreloadRouteFn<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory>;
|
|
560
538
|
matchRoute: MatchRouteFn<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory>;
|
|
561
539
|
ssr?: {
|
|
562
540
|
manifest: Manifest | undefined;
|
|
563
541
|
};
|
|
564
542
|
serverSsr?: ServerSsr;
|
|
565
|
-
private _handleNotFound;
|
|
566
543
|
hasNotFoundMatch: () => boolean;
|
|
567
544
|
}
|
|
568
545
|
export declare class SearchParamError extends Error {
|
|
@@ -571,7 +548,6 @@ export declare class PathParamError extends Error {
|
|
|
571
548
|
}
|
|
572
549
|
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]>>>;
|
|
573
550
|
export declare function getInitialRouterState(location: ParsedLocation): RouterState<any>;
|
|
574
|
-
export declare const componentTypes: readonly ["component", "errorComponent", "pendingComponent", "notFoundComponent"];
|
|
575
551
|
interface RouteLike {
|
|
576
552
|
id: string;
|
|
577
553
|
isRoot?: boolean;
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { TSR_DEFERRED_PROMISE, defer } from './defer.js';
|
|
|
3
3
|
export type { DeferredPromiseState, DeferredPromise } from './defer.js';
|
|
4
4
|
export { preloadWarning } from './link.js';
|
|
5
5
|
export type { IsRequiredParams, AddTrailingSlash, RemoveTrailingSlashes, AddLeadingSlash, RemoveLeadingSlashes, ActiveOptions, LinkOptionsProps, ResolveCurrentPath, ResolveParentPath, ResolveRelativePath, LinkCurrentTargetElement, FindDescendantToPaths, InferDescendantToPaths, RelativeToPath, RelativeToParentPath, RelativeToCurrentPath, AbsoluteToPath, RelativeToPathAutoComplete, NavigateOptions, ToOptions, ToMaskOptions, ToSubOptions, ResolveRoute, SearchParamOptions, PathParamOptions, ToPathOption, LinkOptions, MakeOptionalPathParams, FromPathOption, MakeOptionalSearchParams, MaskOptions, ToSubOptionsProps, RequiredToOptions, } from './link.js';
|
|
6
|
+
export { componentTypes } from './load-matches.js';
|
|
6
7
|
export type { RouteToPath, TrailingSlashOptionByRouter, ParseRoute, CodeRouteToPath, RouteIds, FullSearchSchema, FullSearchSchemaInput, AllParams, RouteById, AllContext, RoutePaths, RoutesById, RoutesByPath, AllLoaderData, RouteByPath, } from './routeInfo.js';
|
|
7
8
|
export type { InferFileRouteTypes, FileRouteTypes, FileRoutesByPath, CreateFileRoute, LazyRoute, LazyRouteOptions, CreateLazyFileRoute, } from './fileRoute.js';
|
|
8
9
|
export type { ParsedLocation } from './location.js';
|
|
@@ -16,7 +17,7 @@ export { rootRouteId } from './root.js';
|
|
|
16
17
|
export type { RootRouteId } from './root.js';
|
|
17
18
|
export { BaseRoute, BaseRouteApi, BaseRootRoute } from './route.js';
|
|
18
19
|
export type { AnyPathParams, SearchSchemaInput, AnyContext, RouteContext, PreloadableObj, RoutePathOptions, StaticDataRouteOption, RoutePathOptionsIntersection, SearchFilter, SearchMiddlewareContext, SearchMiddleware, ResolveId, InferFullSearchSchema, InferFullSearchSchemaInput, InferAllParams, InferAllContext, MetaDescriptor, RouteLinkEntry, SearchValidator, AnySearchValidator, DefaultSearchValidator, ErrorRouteProps, ErrorComponentProps, NotFoundRouteProps, ResolveParams, ParseParamsFn, StringifyParamsFn, ParamsOptions, UpdatableStaticRouteOption, ContextReturnType, ContextAsyncReturnType, ResolveRouteContext, ResolveLoaderData, RoutePrefix, TrimPath, TrimPathLeft, TrimPathRight, ResolveSearchSchemaFnInput, ResolveSearchSchemaInput, ResolveSearchSchemaFn, ResolveSearchSchema, ResolveFullSearchSchema, ResolveFullSearchSchemaInput, ResolveAllContext, BeforeLoadContextParameter, RouteContextParameter, ResolveAllParamsFromParent, AnyRoute, Route, RouteTypes, FullSearchSchemaOption, RemountDepsOptions, MakeRemountDepsOptionsUnion, ResolveFullPath, AnyRouteWithContext, RouteOptions, FileBaseRouteOptions, BaseRouteOptions, UpdatableRouteOptions, RouteLoaderFn, LoaderFnContext, RouteContextFn, BeforeLoadFn, ContextOptions, RouteContextOptions, BeforeLoadContextOptions, RootRouteOptions, RootRouteOptionsExtensions, UpdatableRouteOptionsExtensions, RouteConstraints, RouteTypesById, RouteMask, RouteExtensions, RouteLazyFn, RouteAddChildrenFn, RouteAddFileChildrenFn, RouteAddFileTypesFn, ResolveOptionalParams, ResolveRequiredParams, RootRoute, } from './route.js';
|
|
19
|
-
export { defaultSerializeError, getLocationChangeInfo, RouterCore,
|
|
20
|
+
export { defaultSerializeError, getLocationChangeInfo, RouterCore, lazyFn, SearchParamError, PathParamError, getInitialRouterState, processRouteTree, getMatchedRoutes, } from './router.js';
|
|
20
21
|
export type { ViewTransitionOptions, TrailingSlashOption, Register, AnyRouter, AnyRouterWithContext, RegisteredRouter, RouterState, BuildNextOptions, RouterListener, RouterEvent, ListenerFn, RouterEvents, MatchRoutesOpts, RouterOptionsExtensions, DefaultRemountDepsFn, PreloadRouteFn, MatchRouteFn, RouterContextOptions, RouterOptions, RouterConstructorOptions, UpdateFn, ParseLocationFn, InvalidateFn, ControllablePromise, InjectedHtmlEntry, EmitFn, LoadFn, GetMatchFn, SubscribeFn, UpdateMatchFn, CommitLocationFn, GetMatchRoutesFn, MatchRoutesFn, StartTransitionFn, LoadRouteChunkFn, ClearCacheFn, CreateRouterFn, ProcessRouteTreeResult, } from './router.js';
|
|
21
22
|
export type { MatchLocation, CommitLocationOptions, NavigateFn, BuildLocationFn, } from './RouterProvider.js';
|
|
22
23
|
export { retainSearchParams, stripSearchParams } from './searchMiddleware.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { TSR_DEFERRED_PROMISE, defer } from "./defer.js";
|
|
2
2
|
import { preloadWarning } from "./link.js";
|
|
3
|
+
import { componentTypes } from "./load-matches.js";
|
|
3
4
|
import { isMatch } from "./Matches.js";
|
|
4
5
|
import { cleanPath, exactPathTest, interpolatePath, joinPaths, matchByPath, matchPathname, parsePathname, removeBasepath, removeTrailingSlash, resolvePath, trimPath, trimPathLeft, trimPathRight } from "./path.js";
|
|
5
6
|
import { decode, encode } from "./qss.js";
|
|
6
7
|
import { rootRouteId } from "./root.js";
|
|
7
8
|
import { BaseRootRoute, BaseRoute, BaseRouteApi } from "./route.js";
|
|
8
|
-
import { PathParamError, RouterCore, SearchParamError,
|
|
9
|
+
import { PathParamError, RouterCore, SearchParamError, defaultSerializeError, getInitialRouterState, getLocationChangeInfo, getMatchedRoutes, lazyFn, processRouteTree } from "./router.js";
|
|
9
10
|
import { retainSearchParams, stripSearchParams } from "./searchMiddleware.js";
|
|
10
11
|
import { defaultParseSearch, defaultStringifySearch, parseSearchWith, stringifySearchWith } from "./searchParams.js";
|
|
11
12
|
import { createControlledPromise, deepEqual, escapeJSON, functionalUpdate, isModuleNotFoundError, isPlainArray, isPlainObject, last, pick, replaceEqualDeep, shallow } from "./utils.js";
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ParsedLocation } from './location.js';
|
|
2
|
+
import { AnyRoute } from './route.js';
|
|
3
|
+
import { AnyRouteMatch, MakeRouteMatch } from './Matches.js';
|
|
4
|
+
import { AnyRouter, UpdateMatchFn } from './router.js';
|
|
5
|
+
export declare function loadMatches(arg: {
|
|
6
|
+
router: AnyRouter;
|
|
7
|
+
location: ParsedLocation;
|
|
8
|
+
matches: Array<AnyRouteMatch>;
|
|
9
|
+
preload?: boolean;
|
|
10
|
+
onReady?: () => Promise<void>;
|
|
11
|
+
updateMatch: UpdateMatchFn;
|
|
12
|
+
sync?: boolean;
|
|
13
|
+
}): Promise<Array<MakeRouteMatch>>;
|
|
14
|
+
export declare function loadRouteChunk(route: AnyRoute): Promise<void | undefined>;
|
|
15
|
+
export declare function routeNeedsPreload(route: AnyRoute): boolean;
|
|
16
|
+
export declare const componentTypes: readonly ["component", "errorComponent", "pendingComponent", "notFoundComponent"];
|