@tanstack/router-core 1.126.2 → 1.127.2
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/Matches.cjs.map +1 -1
- package/dist/cjs/Matches.d.cts +1 -1
- package/dist/cjs/index.d.cts +1 -2
- package/dist/cjs/router.cjs +8 -25
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +9 -57
- package/dist/cjs/ssr/client.cjs +0 -2
- package/dist/cjs/ssr/client.cjs.map +1 -1
- package/dist/cjs/ssr/client.d.cts +1 -2
- package/dist/cjs/ssr/createRequestHandler.cjs +2 -1
- package/dist/cjs/ssr/createRequestHandler.cjs.map +1 -1
- package/dist/cjs/ssr/seroval-plugins.cjs +34 -0
- package/dist/cjs/ssr/seroval-plugins.cjs.map +1 -0
- package/dist/cjs/ssr/seroval-plugins.d.cts +10 -0
- package/dist/cjs/ssr/server.cjs +0 -4
- package/dist/cjs/ssr/server.cjs.map +1 -1
- package/dist/cjs/ssr/server.d.cts +1 -3
- package/dist/cjs/ssr/ssr-client.cjs +18 -56
- package/dist/cjs/ssr/ssr-client.cjs.map +1 -1
- package/dist/cjs/ssr/ssr-client.d.cts +17 -57
- package/dist/cjs/ssr/ssr-server.cjs +75 -220
- package/dist/cjs/ssr/ssr-server.cjs.map +1 -1
- package/dist/cjs/ssr/ssr-server.d.cts +14 -28
- package/dist/cjs/ssr/transformStreamWithRouter.cjs +1 -0
- package/dist/cjs/ssr/transformStreamWithRouter.cjs.map +1 -1
- package/dist/cjs/ssr/tsrScript.cjs +1 -1
- package/dist/cjs/ssr/tsrScript.cjs.map +1 -1
- package/dist/cjs/ssr/tsrScript.d.cts +0 -1
- package/dist/esm/Matches.d.ts +1 -1
- package/dist/esm/Matches.js.map +1 -1
- package/dist/esm/index.d.ts +1 -2
- package/dist/esm/router.d.ts +9 -57
- package/dist/esm/router.js +8 -25
- package/dist/esm/router.js.map +1 -1
- package/dist/esm/ssr/client.d.ts +1 -2
- package/dist/esm/ssr/client.js +1 -3
- package/dist/esm/ssr/client.js.map +1 -1
- package/dist/esm/ssr/createRequestHandler.js +3 -2
- package/dist/esm/ssr/createRequestHandler.js.map +1 -1
- package/dist/esm/ssr/seroval-plugins.d.ts +10 -0
- package/dist/esm/ssr/seroval-plugins.js +34 -0
- package/dist/esm/ssr/seroval-plugins.js.map +1 -0
- package/dist/esm/ssr/server.d.ts +1 -3
- package/dist/esm/ssr/server.js +1 -5
- package/dist/esm/ssr/ssr-client.d.ts +17 -57
- package/dist/esm/ssr/ssr-client.js +18 -56
- package/dist/esm/ssr/ssr-client.js.map +1 -1
- package/dist/esm/ssr/ssr-server.d.ts +14 -28
- package/dist/esm/ssr/ssr-server.js +76 -221
- package/dist/esm/ssr/ssr-server.js.map +1 -1
- package/dist/esm/ssr/transformStreamWithRouter.js +1 -0
- package/dist/esm/ssr/transformStreamWithRouter.js.map +1 -1
- package/dist/esm/ssr/tsrScript.d.ts +0 -1
- package/dist/esm/ssr/tsrScript.js +1 -1
- package/dist/esm/ssr/tsrScript.js.map +1 -1
- package/package.json +3 -3
- package/src/Matches.ts +1 -1
- package/src/index.ts +0 -18
- package/src/router.ts +15 -82
- package/src/ssr/client.ts +1 -11
- package/src/ssr/createRequestHandler.ts +2 -2
- package/src/ssr/seroval-plugins.ts +43 -0
- package/src/ssr/server.ts +1 -14
- package/src/ssr/ssr-client.ts +35 -128
- package/src/ssr/ssr-server.ts +89 -307
- package/src/ssr/transformStreamWithRouter.ts +1 -0
- package/src/ssr/tsrScript.ts +4 -88
- package/dist/cjs/serializer.cjs +0 -146
- package/dist/cjs/serializer.cjs.map +0 -1
- package/dist/cjs/serializer.d.cts +0 -28
- package/dist/esm/serializer.d.ts +0 -28
- package/dist/esm/serializer.js +0 -146
- package/dist/esm/serializer.js.map +0 -1
- package/src/serializer.ts +0 -205
package/dist/cjs/Matches.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Matches.cjs","sources":["../../src/Matches.ts"],"sourcesContent":["import type { AnyRoute, StaticDataRouteOption } from './route'\nimport type {\n AllContext,\n AllLoaderData,\n AllParams,\n FullSearchSchema,\n ParseRoute,\n RouteById,\n RouteIds,\n} from './routeInfo'\nimport type { AnyRouter, RegisteredRouter } from './router'\nimport type { Constrain, ControlledPromise } from './utils'\n\nexport type AnyMatchAndValue = { match: any; value: any }\n\nexport type FindValueByIndex<\n TKey,\n TValue extends ReadonlyArray<any>,\n> = TKey extends `${infer TIndex extends number}` ? TValue[TIndex] : never\n\nexport type FindValueByKey<TKey, TValue> =\n TValue extends ReadonlyArray<any>\n ? FindValueByIndex<TKey, TValue>\n : TValue[TKey & keyof TValue]\n\nexport type CreateMatchAndValue<TMatch, TValue> = TValue extends any\n ? {\n match: TMatch\n value: TValue\n }\n : never\n\nexport type NextMatchAndValue<\n TKey,\n TMatchAndValue extends AnyMatchAndValue,\n> = TMatchAndValue extends any\n ? CreateMatchAndValue<\n TMatchAndValue['match'],\n FindValueByKey<TKey, TMatchAndValue['value']>\n >\n : never\n\nexport type IsMatchKeyOf<TValue> =\n TValue extends ReadonlyArray<any>\n ? number extends TValue['length']\n ? `${number}`\n : keyof TValue & `${number}`\n : TValue extends object\n ? keyof TValue & string\n : never\n\nexport type IsMatchPath<\n TParentPath extends string,\n TMatchAndValue extends AnyMatchAndValue,\n> = `${TParentPath}${IsMatchKeyOf<TMatchAndValue['value']>}`\n\nexport type IsMatchResult<\n TKey,\n TMatchAndValue extends AnyMatchAndValue,\n> = TMatchAndValue extends any\n ? TKey extends keyof TMatchAndValue['value']\n ? TMatchAndValue['match']\n : never\n : never\n\nexport type IsMatchParse<\n TPath,\n TMatchAndValue extends AnyMatchAndValue,\n TParentPath extends string = '',\n> = TPath extends `${string}.${string}`\n ? TPath extends `${infer TFirst}.${infer TRest}`\n ? IsMatchParse<\n TRest,\n NextMatchAndValue<TFirst, TMatchAndValue>,\n `${TParentPath}${TFirst}.`\n >\n : never\n : {\n path: IsMatchPath<TParentPath, TMatchAndValue>\n result: IsMatchResult<TPath, TMatchAndValue>\n }\n\nexport type IsMatch<TMatch, TPath> = IsMatchParse<\n TPath,\n TMatch extends any ? { match: TMatch; value: TMatch } : never\n>\n\n/**\n * Narrows matches based on a path\n * @experimental\n */\nexport const isMatch = <TMatch, TPath extends string>(\n match: TMatch,\n path: Constrain<TPath, IsMatch<TMatch, TPath>['path']>,\n): match is IsMatch<TMatch, TPath>['result'] => {\n const parts = (path as string).split('.')\n let part\n let value: any = match\n\n while ((part = parts.shift()) != null && value != null) {\n value = value[part]\n }\n\n return value != null\n}\n\nexport interface DefaultRouteMatchExtensions {\n scripts?: unknown\n links?: unknown\n headScripts?: unknown\n meta?: unknown\n styles?: unknown\n}\n\nexport interface RouteMatchExtensions extends DefaultRouteMatchExtensions {}\n\nexport interface RouteMatch<\n out TRouteId,\n out TFullPath,\n out TAllParams,\n out TFullSearchSchema,\n out TLoaderData,\n out TAllContext,\n out TLoaderDeps,\n> extends RouteMatchExtensions {\n id: string\n routeId: TRouteId\n fullPath: TFullPath\n index: number\n pathname: string\n params: TAllParams\n _strictParams: TAllParams\n status: 'pending' | 'success' | 'error' | 'redirected' | 'notFound'\n isFetching: false | 'beforeLoad' | 'loader'\n error: unknown\n paramsError: unknown\n searchError: unknown\n updatedAt: number\n loadPromise?: ControlledPromise<void>\n beforeLoadPromise?: ControlledPromise<void>\n loaderPromise?: ControlledPromise<void>\n loaderData?: TLoaderData\n __routeContext: Record<string, unknown>\n __beforeLoadContext
|
|
1
|
+
{"version":3,"file":"Matches.cjs","sources":["../../src/Matches.ts"],"sourcesContent":["import type { AnyRoute, StaticDataRouteOption } from './route'\nimport type {\n AllContext,\n AllLoaderData,\n AllParams,\n FullSearchSchema,\n ParseRoute,\n RouteById,\n RouteIds,\n} from './routeInfo'\nimport type { AnyRouter, RegisteredRouter } from './router'\nimport type { Constrain, ControlledPromise } from './utils'\n\nexport type AnyMatchAndValue = { match: any; value: any }\n\nexport type FindValueByIndex<\n TKey,\n TValue extends ReadonlyArray<any>,\n> = TKey extends `${infer TIndex extends number}` ? TValue[TIndex] : never\n\nexport type FindValueByKey<TKey, TValue> =\n TValue extends ReadonlyArray<any>\n ? FindValueByIndex<TKey, TValue>\n : TValue[TKey & keyof TValue]\n\nexport type CreateMatchAndValue<TMatch, TValue> = TValue extends any\n ? {\n match: TMatch\n value: TValue\n }\n : never\n\nexport type NextMatchAndValue<\n TKey,\n TMatchAndValue extends AnyMatchAndValue,\n> = TMatchAndValue extends any\n ? CreateMatchAndValue<\n TMatchAndValue['match'],\n FindValueByKey<TKey, TMatchAndValue['value']>\n >\n : never\n\nexport type IsMatchKeyOf<TValue> =\n TValue extends ReadonlyArray<any>\n ? number extends TValue['length']\n ? `${number}`\n : keyof TValue & `${number}`\n : TValue extends object\n ? keyof TValue & string\n : never\n\nexport type IsMatchPath<\n TParentPath extends string,\n TMatchAndValue extends AnyMatchAndValue,\n> = `${TParentPath}${IsMatchKeyOf<TMatchAndValue['value']>}`\n\nexport type IsMatchResult<\n TKey,\n TMatchAndValue extends AnyMatchAndValue,\n> = TMatchAndValue extends any\n ? TKey extends keyof TMatchAndValue['value']\n ? TMatchAndValue['match']\n : never\n : never\n\nexport type IsMatchParse<\n TPath,\n TMatchAndValue extends AnyMatchAndValue,\n TParentPath extends string = '',\n> = TPath extends `${string}.${string}`\n ? TPath extends `${infer TFirst}.${infer TRest}`\n ? IsMatchParse<\n TRest,\n NextMatchAndValue<TFirst, TMatchAndValue>,\n `${TParentPath}${TFirst}.`\n >\n : never\n : {\n path: IsMatchPath<TParentPath, TMatchAndValue>\n result: IsMatchResult<TPath, TMatchAndValue>\n }\n\nexport type IsMatch<TMatch, TPath> = IsMatchParse<\n TPath,\n TMatch extends any ? { match: TMatch; value: TMatch } : never\n>\n\n/**\n * Narrows matches based on a path\n * @experimental\n */\nexport const isMatch = <TMatch, TPath extends string>(\n match: TMatch,\n path: Constrain<TPath, IsMatch<TMatch, TPath>['path']>,\n): match is IsMatch<TMatch, TPath>['result'] => {\n const parts = (path as string).split('.')\n let part\n let value: any = match\n\n while ((part = parts.shift()) != null && value != null) {\n value = value[part]\n }\n\n return value != null\n}\n\nexport interface DefaultRouteMatchExtensions {\n scripts?: unknown\n links?: unknown\n headScripts?: unknown\n meta?: unknown\n styles?: unknown\n}\n\nexport interface RouteMatchExtensions extends DefaultRouteMatchExtensions {}\n\nexport interface RouteMatch<\n out TRouteId,\n out TFullPath,\n out TAllParams,\n out TFullSearchSchema,\n out TLoaderData,\n out TAllContext,\n out TLoaderDeps,\n> extends RouteMatchExtensions {\n id: string\n routeId: TRouteId\n fullPath: TFullPath\n index: number\n pathname: string\n params: TAllParams\n _strictParams: TAllParams\n status: 'pending' | 'success' | 'error' | 'redirected' | 'notFound'\n isFetching: false | 'beforeLoad' | 'loader'\n error: unknown\n paramsError: unknown\n searchError: unknown\n updatedAt: number\n loadPromise?: ControlledPromise<void>\n beforeLoadPromise?: ControlledPromise<void>\n loaderPromise?: ControlledPromise<void>\n loaderData?: TLoaderData\n __routeContext: Record<string, unknown>\n __beforeLoadContext?: Record<string, unknown>\n context: TAllContext\n search: TFullSearchSchema\n _strictSearch: TFullSearchSchema\n fetchCount: number\n abortController: AbortController\n cause: 'preload' | 'enter' | 'stay'\n loaderDeps: TLoaderDeps\n preload: boolean\n invalid: boolean\n headers?: Record<string, string>\n globalNotFound?: boolean\n staticData: StaticDataRouteOption\n minPendingPromise?: ControlledPromise<void>\n pendingTimeout?: ReturnType<typeof setTimeout>\n ssr?: boolean | 'data-only'\n _dehydrated?: boolean\n _forcePending?: boolean\n displayPendingPromise?: Promise<void>\n _displayPending?: boolean\n}\n\nexport interface PreValidationErrorHandlingRouteMatch<\n TRouteId,\n TFullPath,\n TAllParams,\n TFullSearchSchema,\n> {\n id: string\n routeId: TRouteId\n fullPath: TFullPath\n index: number\n pathname: string\n search:\n | { status: 'success'; value: TFullSearchSchema }\n | { status: 'error'; error: unknown }\n params:\n | { status: 'success'; value: TAllParams }\n | { status: 'error'; error: unknown }\n staticData: StaticDataRouteOption\n ssr?: boolean | 'data-only'\n}\n\nexport type MakePreValidationErrorHandlingRouteMatchUnion<\n TRouter extends AnyRouter = RegisteredRouter,\n TRoute extends AnyRoute = ParseRoute<TRouter['routeTree']>,\n> = TRoute extends any\n ? PreValidationErrorHandlingRouteMatch<\n TRoute['id'],\n TRoute['fullPath'],\n TRoute['types']['allParams'],\n TRoute['types']['fullSearchSchema']\n >\n : never\n\nexport type MakeRouteMatchFromRoute<TRoute extends AnyRoute> = RouteMatch<\n TRoute['types']['id'],\n TRoute['types']['fullPath'],\n TRoute['types']['allParams'],\n TRoute['types']['fullSearchSchema'],\n TRoute['types']['loaderData'],\n TRoute['types']['allContext'],\n TRoute['types']['loaderDeps']\n>\n\nexport type MakeRouteMatch<\n TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n TRouteId = RouteIds<TRouteTree>,\n TStrict extends boolean = true,\n> = RouteMatch<\n TRouteId,\n RouteById<TRouteTree, TRouteId>['types']['fullPath'],\n TStrict extends false\n ? AllParams<TRouteTree>\n : RouteById<TRouteTree, TRouteId>['types']['allParams'],\n TStrict extends false\n ? FullSearchSchema<TRouteTree>\n : RouteById<TRouteTree, TRouteId>['types']['fullSearchSchema'],\n TStrict extends false\n ? AllLoaderData<TRouteTree>\n : RouteById<TRouteTree, TRouteId>['types']['loaderData'],\n TStrict extends false\n ? AllContext<TRouteTree>\n : RouteById<TRouteTree, TRouteId>['types']['allContext'],\n RouteById<TRouteTree, TRouteId>['types']['loaderDeps']\n>\n\nexport type AnyRouteMatch = RouteMatch<any, any, any, any, any, any, any>\n\nexport type MakeRouteMatchUnion<\n TRouter extends AnyRouter = RegisteredRouter,\n TRoute extends AnyRoute = ParseRoute<TRouter['routeTree']>,\n> = TRoute extends any\n ? RouteMatch<\n TRoute['id'],\n TRoute['fullPath'],\n TRoute['types']['allParams'],\n TRoute['types']['fullSearchSchema'],\n TRoute['types']['loaderData'],\n TRoute['types']['allContext'],\n TRoute['types']['loaderDeps']\n >\n : never\n\n/**\n * The `MatchRouteOptions` type is used to describe the options that can be used when matching a route.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#matchrouteoptions-type)\n */\nexport interface MatchRouteOptions {\n /**\n * If `true`, will match against pending location instead of the current location.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#pending-property)\n */\n pending?: boolean\n /**\n * If `true`, will match against the current location with case sensitivity.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#casesensitive-property)\n */\n caseSensitive?: boolean\n /**\n * If `true`, will match against the current location's search params using a deep inclusive check. e.g. `{ a: 1 }` will match for a current location of `{ a: 1, b: 2 }`.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#includesearch-property)\n */\n includeSearch?: boolean\n /**\n * If `true`, will match against the current location using a fuzzy match. e.g. `/posts` will match for a current location of `/posts/123`.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#fuzzy-property)\n */\n fuzzy?: boolean\n}\n"],"names":[],"mappings":";;AA2Fa,MAAA,UAAU,CACrB,OACA,SAC8C;AACxC,QAAA,QAAS,KAAgB,MAAM,GAAG;AACpC,MAAA;AACJ,MAAI,QAAa;AAEjB,UAAQ,OAAO,MAAM,MAAY,MAAA,QAAQ,SAAS,MAAM;AACtD,YAAQ,MAAM,IAAI;AAAA,EAAA;AAGpB,SAAO,SAAS;AAClB;;"}
|
package/dist/cjs/Matches.d.cts
CHANGED
|
@@ -57,7 +57,7 @@ export interface RouteMatch<out TRouteId, out TFullPath, out TAllParams, out TFu
|
|
|
57
57
|
loaderPromise?: ControlledPromise<void>;
|
|
58
58
|
loaderData?: TLoaderData;
|
|
59
59
|
__routeContext: Record<string, unknown>;
|
|
60
|
-
__beforeLoadContext
|
|
60
|
+
__beforeLoadContext?: Record<string, unknown>;
|
|
61
61
|
context: TAllContext;
|
|
62
62
|
search: TFullSearchSchema;
|
|
63
63
|
_strictSearch: TFullSearchSchema;
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -4,7 +4,6 @@ export { preloadWarning } from './link.cjs';
|
|
|
4
4
|
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.cjs';
|
|
5
5
|
export type { RouteToPath, TrailingSlashOptionByRouter, ParseRoute, CodeRouteToPath, RouteIds, FullSearchSchema, FullSearchSchemaInput, AllParams, RouteById, AllContext, RoutePaths, RoutesById, RoutesByPath, AllLoaderData, RouteByPath, } from './routeInfo.cjs';
|
|
6
6
|
export type { InferFileRouteTypes, FileRouteTypes, FileRoutesByPath, CreateFileRoute, LazyRoute, LazyRouteOptions, CreateLazyFileRoute, } from './fileRoute.cjs';
|
|
7
|
-
export type { TsrSerializer, StartSerializer, Serializable, SerializerParse, SerializerParseBy, SerializerStringify, SerializerStringifyBy, SerializerExtensions, } from './serializer.cjs';
|
|
8
7
|
export type { ParsedLocation } from './location.cjs';
|
|
9
8
|
export type { Manifest, RouterManagedTag } from './manifest.cjs';
|
|
10
9
|
export { isMatch } from './Matches.cjs';
|
|
@@ -17,7 +16,7 @@ export type { RootRouteId } from './root.cjs';
|
|
|
17
16
|
export { BaseRoute, BaseRouteApi, BaseRootRoute } from './route.cjs';
|
|
18
17
|
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.cjs';
|
|
19
18
|
export { defaultSerializeError, getLocationChangeInfo, RouterCore, componentTypes, lazyFn, SearchParamError, PathParamError, getInitialRouterState, processRouteTree, getMatchedRoutes, } from './router.cjs';
|
|
20
|
-
export type { ViewTransitionOptions,
|
|
19
|
+
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.cjs';
|
|
21
20
|
export type { MatchLocation, CommitLocationOptions, NavigateFn, BuildLocationFn, } from './RouterProvider.cjs';
|
|
22
21
|
export { retainSearchParams, stripSearchParams } from './searchMiddleware.cjs';
|
|
23
22
|
export { defaultParseSearch, defaultStringifySearch, parseSearchWith, stringifySearchWith, } from './searchParams.cjs';
|
package/dist/cjs/router.cjs
CHANGED
|
@@ -747,7 +747,7 @@ class RouterCore {
|
|
|
747
747
|
triggerOnReady();
|
|
748
748
|
}
|
|
749
749
|
const handleRedirectAndNotFound = (match, err) => {
|
|
750
|
-
var _a, _b, _c
|
|
750
|
+
var _a, _b, _c;
|
|
751
751
|
if (redirect.isRedirect(err) || notFound.isNotFound(err)) {
|
|
752
752
|
if (redirect.isRedirect(err)) {
|
|
753
753
|
if (err.redirectHandled) {
|
|
@@ -780,10 +780,6 @@ class RouterCore {
|
|
|
780
780
|
this._handleNotFound(matches, err, {
|
|
781
781
|
updateMatch
|
|
782
782
|
});
|
|
783
|
-
(_d = this.serverSsr) == null ? void 0 : _d.onMatchSettled({
|
|
784
|
-
router: this,
|
|
785
|
-
match: this.getMatch(match.id)
|
|
786
|
-
});
|
|
787
783
|
throw err;
|
|
788
784
|
}
|
|
789
785
|
}
|
|
@@ -970,7 +966,7 @@ class RouterCore {
|
|
|
970
966
|
cause: preload ? "preload" : cause,
|
|
971
967
|
matches
|
|
972
968
|
};
|
|
973
|
-
const beforeLoadContext = await ((_d = (_c = route.options).beforeLoad) == null ? void 0 : _d.call(_c, beforeLoadFnContext))
|
|
969
|
+
const beforeLoadContext = await ((_d = (_c = route.options).beforeLoad) == null ? void 0 : _d.call(_c, beforeLoadFnContext));
|
|
974
970
|
if (redirect.isRedirect(beforeLoadContext) || notFound.isNotFound(beforeLoadContext)) {
|
|
975
971
|
handleSerialError(index, beforeLoadContext, "BEFORE_LOAD");
|
|
976
972
|
}
|
|
@@ -1005,12 +1001,11 @@ class RouterCore {
|
|
|
1005
1001
|
validResolvedMatches.forEach(({ id: matchId, routeId }, index) => {
|
|
1006
1002
|
matchPromises.push(
|
|
1007
1003
|
(async () => {
|
|
1008
|
-
var _a2, _b2;
|
|
1009
1004
|
let loaderShouldRunAsync = false;
|
|
1010
1005
|
let loaderIsRunningAsync = false;
|
|
1011
1006
|
const route = this.looseRoutesById[routeId];
|
|
1012
1007
|
const executeHead = async () => {
|
|
1013
|
-
var
|
|
1008
|
+
var _a2, _b2, _c2, _d2, _e, _f;
|
|
1014
1009
|
const match = this.getMatch(matchId);
|
|
1015
1010
|
if (!match) {
|
|
1016
1011
|
return;
|
|
@@ -1021,7 +1016,7 @@ class RouterCore {
|
|
|
1021
1016
|
params: match.params,
|
|
1022
1017
|
loaderData: match.loaderData
|
|
1023
1018
|
};
|
|
1024
|
-
const headFnContent = await ((
|
|
1019
|
+
const headFnContent = await ((_b2 = (_a2 = route.options).head) == null ? void 0 : _b2.call(_a2, assetContext));
|
|
1025
1020
|
const meta = headFnContent == null ? void 0 : headFnContent.meta;
|
|
1026
1021
|
const links = headFnContent == null ? void 0 : headFnContent.links;
|
|
1027
1022
|
const headScripts = headFnContent == null ? void 0 : headFnContent.scripts;
|
|
@@ -1051,10 +1046,6 @@ class RouterCore {
|
|
|
1051
1046
|
...prev,
|
|
1052
1047
|
...head
|
|
1053
1048
|
}));
|
|
1054
|
-
(_a2 = this.serverSsr) == null ? void 0 : _a2.onMatchSettled({
|
|
1055
|
-
router: this,
|
|
1056
|
-
match: this.getMatch(matchId)
|
|
1057
|
-
});
|
|
1058
1049
|
return this.getMatch(matchId);
|
|
1059
1050
|
} else {
|
|
1060
1051
|
await potentialPendingMinPromise();
|
|
@@ -1103,7 +1094,7 @@ class RouterCore {
|
|
|
1103
1094
|
preload: !!preload && !this.state.matches.find((d) => d.id === matchId)
|
|
1104
1095
|
}));
|
|
1105
1096
|
const runLoader = async () => {
|
|
1106
|
-
var
|
|
1097
|
+
var _a2, _b2, _c2, _d2;
|
|
1107
1098
|
try {
|
|
1108
1099
|
try {
|
|
1109
1100
|
if (!this.isServer || this.isServer && this.getMatch(matchId).ssr === true) {
|
|
@@ -1113,7 +1104,7 @@ class RouterCore {
|
|
|
1113
1104
|
...prev,
|
|
1114
1105
|
isFetching: "loader"
|
|
1115
1106
|
}));
|
|
1116
|
-
const loaderData = await ((
|
|
1107
|
+
const loaderData = await ((_b2 = (_a2 = route.options).loader) == null ? void 0 : _b2.call(_a2, getLoaderContext()));
|
|
1117
1108
|
handleRedirectAndNotFound(
|
|
1118
1109
|
this.getMatch(matchId),
|
|
1119
1110
|
loaderData
|
|
@@ -1156,10 +1147,6 @@ class RouterCore {
|
|
|
1156
1147
|
...head
|
|
1157
1148
|
}));
|
|
1158
1149
|
}
|
|
1159
|
-
(_e = this.serverSsr) == null ? void 0 : _e.onMatchSettled({
|
|
1160
|
-
router: this,
|
|
1161
|
-
match: this.getMatch(matchId)
|
|
1162
|
-
});
|
|
1163
1150
|
} catch (err) {
|
|
1164
1151
|
const head = await executeHead();
|
|
1165
1152
|
updateMatch(matchId, (prev) => ({
|
|
@@ -1202,10 +1189,6 @@ class RouterCore {
|
|
|
1202
1189
|
...prev,
|
|
1203
1190
|
...head
|
|
1204
1191
|
}));
|
|
1205
|
-
(_b2 = this.serverSsr) == null ? void 0 : _b2.onMatchSettled({
|
|
1206
|
-
router: this,
|
|
1207
|
-
match: this.getMatch(matchId)
|
|
1208
|
-
});
|
|
1209
1192
|
}
|
|
1210
1193
|
}
|
|
1211
1194
|
if (!loaderIsRunningAsync) {
|
|
@@ -1477,7 +1460,7 @@ class RouterCore {
|
|
|
1477
1460
|
parseSearch: options.parseSearch ?? searchParams.defaultParseSearch
|
|
1478
1461
|
});
|
|
1479
1462
|
if (typeof document !== "undefined") {
|
|
1480
|
-
|
|
1463
|
+
self.__TSR_ROUTER__ = this;
|
|
1481
1464
|
}
|
|
1482
1465
|
}
|
|
1483
1466
|
get state() {
|
|
@@ -1623,7 +1606,7 @@ class RouterCore {
|
|
|
1623
1606
|
error: void 0,
|
|
1624
1607
|
paramsError: parseErrors[index],
|
|
1625
1608
|
__routeContext: {},
|
|
1626
|
-
__beforeLoadContext:
|
|
1609
|
+
__beforeLoadContext: void 0,
|
|
1627
1610
|
context: {},
|
|
1628
1611
|
abortController: new AbortController(),
|
|
1629
1612
|
fetchCount: 0,
|