@tanstack/router-core 1.125.4 → 1.127.0

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.
Files changed (77) hide show
  1. package/dist/cjs/Matches.cjs.map +1 -1
  2. package/dist/cjs/Matches.d.cts +1 -1
  3. package/dist/cjs/RouterProvider.d.cts +1 -0
  4. package/dist/cjs/index.d.cts +1 -2
  5. package/dist/cjs/router.cjs +26 -33
  6. package/dist/cjs/router.cjs.map +1 -1
  7. package/dist/cjs/router.d.cts +10 -57
  8. package/dist/cjs/ssr/client.cjs +0 -2
  9. package/dist/cjs/ssr/client.cjs.map +1 -1
  10. package/dist/cjs/ssr/client.d.cts +1 -2
  11. package/dist/cjs/ssr/createRequestHandler.cjs +2 -1
  12. package/dist/cjs/ssr/createRequestHandler.cjs.map +1 -1
  13. package/dist/cjs/ssr/seroval-plugins.cjs +34 -0
  14. package/dist/cjs/ssr/seroval-plugins.cjs.map +1 -0
  15. package/dist/cjs/ssr/seroval-plugins.d.cts +10 -0
  16. package/dist/cjs/ssr/server.cjs +0 -4
  17. package/dist/cjs/ssr/server.cjs.map +1 -1
  18. package/dist/cjs/ssr/server.d.cts +1 -3
  19. package/dist/cjs/ssr/ssr-client.cjs +18 -56
  20. package/dist/cjs/ssr/ssr-client.cjs.map +1 -1
  21. package/dist/cjs/ssr/ssr-client.d.cts +17 -57
  22. package/dist/cjs/ssr/ssr-server.cjs +75 -220
  23. package/dist/cjs/ssr/ssr-server.cjs.map +1 -1
  24. package/dist/cjs/ssr/ssr-server.d.cts +14 -28
  25. package/dist/cjs/ssr/transformStreamWithRouter.cjs +1 -0
  26. package/dist/cjs/ssr/transformStreamWithRouter.cjs.map +1 -1
  27. package/dist/cjs/ssr/tsrScript.cjs +1 -1
  28. package/dist/cjs/ssr/tsrScript.cjs.map +1 -1
  29. package/dist/cjs/ssr/tsrScript.d.cts +0 -1
  30. package/dist/esm/Matches.d.ts +1 -1
  31. package/dist/esm/Matches.js.map +1 -1
  32. package/dist/esm/RouterProvider.d.ts +1 -0
  33. package/dist/esm/index.d.ts +1 -2
  34. package/dist/esm/router.d.ts +10 -57
  35. package/dist/esm/router.js +26 -33
  36. package/dist/esm/router.js.map +1 -1
  37. package/dist/esm/ssr/client.d.ts +1 -2
  38. package/dist/esm/ssr/client.js +1 -3
  39. package/dist/esm/ssr/client.js.map +1 -1
  40. package/dist/esm/ssr/createRequestHandler.js +3 -2
  41. package/dist/esm/ssr/createRequestHandler.js.map +1 -1
  42. package/dist/esm/ssr/seroval-plugins.d.ts +10 -0
  43. package/dist/esm/ssr/seroval-plugins.js +34 -0
  44. package/dist/esm/ssr/seroval-plugins.js.map +1 -0
  45. package/dist/esm/ssr/server.d.ts +1 -3
  46. package/dist/esm/ssr/server.js +1 -5
  47. package/dist/esm/ssr/ssr-client.d.ts +17 -57
  48. package/dist/esm/ssr/ssr-client.js +18 -56
  49. package/dist/esm/ssr/ssr-client.js.map +1 -1
  50. package/dist/esm/ssr/ssr-server.d.ts +14 -28
  51. package/dist/esm/ssr/ssr-server.js +76 -221
  52. package/dist/esm/ssr/ssr-server.js.map +1 -1
  53. package/dist/esm/ssr/transformStreamWithRouter.js +1 -0
  54. package/dist/esm/ssr/transformStreamWithRouter.js.map +1 -1
  55. package/dist/esm/ssr/tsrScript.d.ts +0 -1
  56. package/dist/esm/ssr/tsrScript.js +1 -1
  57. package/dist/esm/ssr/tsrScript.js.map +1 -1
  58. package/package.json +3 -1
  59. package/src/Matches.ts +1 -1
  60. package/src/RouterProvider.ts +1 -0
  61. package/src/index.ts +0 -18
  62. package/src/router.ts +41 -89
  63. package/src/ssr/client.ts +1 -11
  64. package/src/ssr/createRequestHandler.ts +2 -2
  65. package/src/ssr/seroval-plugins.ts +43 -0
  66. package/src/ssr/server.ts +1 -14
  67. package/src/ssr/ssr-client.ts +35 -128
  68. package/src/ssr/ssr-server.ts +89 -307
  69. package/src/ssr/transformStreamWithRouter.ts +1 -0
  70. package/src/ssr/tsrScript.ts +4 -88
  71. package/dist/cjs/serializer.cjs +0 -146
  72. package/dist/cjs/serializer.cjs.map +0 -1
  73. package/dist/cjs/serializer.d.cts +0 -28
  74. package/dist/esm/serializer.d.ts +0 -28
  75. package/dist/esm/serializer.js +0 -146
  76. package/dist/esm/serializer.js.map +0 -1
  77. package/src/serializer.ts +0 -205
@@ -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: 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;;"}
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;;"}
@@ -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: Record<string, unknown>;
60
+ __beforeLoadContext?: Record<string, unknown>;
61
61
  context: TAllContext;
62
62
  search: TFullSearchSchema;
63
63
  _strictSearch: TFullSearchSchema;
@@ -23,4 +23,5 @@ export type NavigateFn = <TRouter extends RegisteredRouter, TTo extends string |
23
23
  export type BuildLocationFn = <TRouter extends RegisteredRouter, TTo extends string | undefined, TFrom extends RoutePaths<TRouter['routeTree']> | string = string, TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = ''>(opts: ToOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {
24
24
  leaveParams?: boolean;
25
25
  _includeValidateSearch?: boolean;
26
+ _isNavigate?: boolean;
26
27
  }) => ParsedLocation;
@@ -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, ExtractedBaseEntry, ExtractedStream, ExtractedPromise, ExtractedEntry, StreamState, TrailingSlashOption, Register, AnyRouter, AnyRouterWithContext, RegisteredRouter, RouterState, BuildNextOptions, RouterListener, RouterEvent, ListenerFn, RouterEvents, MatchRoutesOpts, RouterOptionsExtensions, DefaultRemountDepsFn, PreloadRouteFn, MatchRouteFn, RouterContextOptions, RouterOptions, RouterConstructorOptions, UpdateFn, ParseLocationFn, InvalidateFn, ControllablePromise, InjectedHtmlEntry, RouterErrorSerializer, EmitFn, LoadFn, GetMatchFn, SubscribeFn, UpdateMatchFn, CommitLocationFn, GetMatchRoutesFn, MatchRoutesFn, StartTransitionFn, LoadRouteChunkFn, ServerSrr, ClearCacheFn, CreateRouterFn, ProcessRouteTreeResult, } from './router.cjs';
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';
@@ -231,10 +231,10 @@ class RouterCore {
231
231
  const build = (dest = {}) => {
232
232
  var _a;
233
233
  const currentLocation = dest._fromLocation || this.latestLocation;
234
- const allFromMatches = this.matchRoutes(currentLocation, {
234
+ const allCurrentLocationMatches = this.matchRoutes(currentLocation, {
235
235
  _buildLocation: true
236
236
  });
237
- const lastMatch = utils.last(allFromMatches);
237
+ const lastMatch = utils.last(allCurrentLocationMatches);
238
238
  let fromPath = lastMatch.fullPath;
239
239
  const toPath = dest.to ? this.resolvePathWithBase(fromPath, `${dest.to}`) : this.resolvePathWithBase(fromPath, ".");
240
240
  const routeIsChanging = !!dest.to && !this.comparePaths(dest.to.toString(), fromPath) && !this.comparePaths(toPath, fromPath);
@@ -242,11 +242,20 @@ class RouterCore {
242
242
  fromPath = currentLocation.pathname;
243
243
  } else if (routeIsChanging && dest.from) {
244
244
  fromPath = dest.from;
245
- const existingFrom = [...allFromMatches].reverse().find((d) => {
246
- return this.comparePaths(d.fullPath, fromPath);
247
- });
248
- if (!existingFrom) {
249
- console.warn(`Could not find match for from: ${fromPath}`);
245
+ if (process.env.NODE_ENV !== "production" && dest._isNavigate) {
246
+ const allFromMatches = this.getMatchedRoutes(
247
+ dest.from,
248
+ void 0
249
+ ).matchedRoutes;
250
+ const matchedFrom = [...allCurrentLocationMatches].reverse().find((d) => {
251
+ return this.comparePaths(d.fullPath, fromPath);
252
+ });
253
+ const matchedCurrent = [...allFromMatches].reverse().find((d) => {
254
+ return this.comparePaths(d.fullPath, currentLocation.pathname);
255
+ });
256
+ if (!matchedFrom && !matchedCurrent) {
257
+ console.warn(`Could not find match for from: ${fromPath}`);
258
+ }
250
259
  }
251
260
  }
252
261
  const fromSearch = lastMatch.search;
@@ -484,7 +493,8 @@ class RouterCore {
484
493
  return this.buildAndCommitLocation({
485
494
  ...rest,
486
495
  href,
487
- to
496
+ to,
497
+ _isNavigate: true
488
498
  });
489
499
  };
490
500
  this.beforeLoad = () => {
@@ -737,7 +747,7 @@ class RouterCore {
737
747
  triggerOnReady();
738
748
  }
739
749
  const handleRedirectAndNotFound = (match, err) => {
740
- var _a, _b, _c, _d;
750
+ var _a, _b, _c;
741
751
  if (redirect.isRedirect(err) || notFound.isNotFound(err)) {
742
752
  if (redirect.isRedirect(err)) {
743
753
  if (err.redirectHandled) {
@@ -770,10 +780,6 @@ class RouterCore {
770
780
  this._handleNotFound(matches, err, {
771
781
  updateMatch
772
782
  });
773
- (_d = this.serverSsr) == null ? void 0 : _d.onMatchSettled({
774
- router: this,
775
- match: this.getMatch(match.id)
776
- });
777
783
  throw err;
778
784
  }
779
785
  }
@@ -960,7 +966,7 @@ class RouterCore {
960
966
  cause: preload ? "preload" : cause,
961
967
  matches
962
968
  };
963
- 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));
964
970
  if (redirect.isRedirect(beforeLoadContext) || notFound.isNotFound(beforeLoadContext)) {
965
971
  handleSerialError(index, beforeLoadContext, "BEFORE_LOAD");
966
972
  }
@@ -995,12 +1001,11 @@ class RouterCore {
995
1001
  validResolvedMatches.forEach(({ id: matchId, routeId }, index) => {
996
1002
  matchPromises.push(
997
1003
  (async () => {
998
- var _a2, _b2;
999
1004
  let loaderShouldRunAsync = false;
1000
1005
  let loaderIsRunningAsync = false;
1001
1006
  const route = this.looseRoutesById[routeId];
1002
1007
  const executeHead = async () => {
1003
- var _a3, _b3, _c2, _d2, _e, _f;
1008
+ var _a2, _b2, _c2, _d2, _e, _f;
1004
1009
  const match = this.getMatch(matchId);
1005
1010
  if (!match) {
1006
1011
  return;
@@ -1011,7 +1016,7 @@ class RouterCore {
1011
1016
  params: match.params,
1012
1017
  loaderData: match.loaderData
1013
1018
  };
1014
- const headFnContent = await ((_b3 = (_a3 = route.options).head) == null ? void 0 : _b3.call(_a3, assetContext));
1019
+ const headFnContent = await ((_b2 = (_a2 = route.options).head) == null ? void 0 : _b2.call(_a2, assetContext));
1015
1020
  const meta = headFnContent == null ? void 0 : headFnContent.meta;
1016
1021
  const links = headFnContent == null ? void 0 : headFnContent.links;
1017
1022
  const headScripts = headFnContent == null ? void 0 : headFnContent.scripts;
@@ -1041,10 +1046,6 @@ class RouterCore {
1041
1046
  ...prev,
1042
1047
  ...head
1043
1048
  }));
1044
- (_a2 = this.serverSsr) == null ? void 0 : _a2.onMatchSettled({
1045
- router: this,
1046
- match: this.getMatch(matchId)
1047
- });
1048
1049
  return this.getMatch(matchId);
1049
1050
  } else {
1050
1051
  await potentialPendingMinPromise();
@@ -1093,7 +1094,7 @@ class RouterCore {
1093
1094
  preload: !!preload && !this.state.matches.find((d) => d.id === matchId)
1094
1095
  }));
1095
1096
  const runLoader = async () => {
1096
- var _a3, _b3, _c2, _d2, _e;
1097
+ var _a2, _b2, _c2, _d2;
1097
1098
  try {
1098
1099
  try {
1099
1100
  if (!this.isServer || this.isServer && this.getMatch(matchId).ssr === true) {
@@ -1103,7 +1104,7 @@ class RouterCore {
1103
1104
  ...prev,
1104
1105
  isFetching: "loader"
1105
1106
  }));
1106
- const loaderData = await ((_b3 = (_a3 = route.options).loader) == null ? void 0 : _b3.call(_a3, getLoaderContext()));
1107
+ const loaderData = await ((_b2 = (_a2 = route.options).loader) == null ? void 0 : _b2.call(_a2, getLoaderContext()));
1107
1108
  handleRedirectAndNotFound(
1108
1109
  this.getMatch(matchId),
1109
1110
  loaderData
@@ -1146,10 +1147,6 @@ class RouterCore {
1146
1147
  ...head
1147
1148
  }));
1148
1149
  }
1149
- (_e = this.serverSsr) == null ? void 0 : _e.onMatchSettled({
1150
- router: this,
1151
- match: this.getMatch(matchId)
1152
- });
1153
1150
  } catch (err) {
1154
1151
  const head = await executeHead();
1155
1152
  updateMatch(matchId, (prev) => ({
@@ -1192,10 +1189,6 @@ class RouterCore {
1192
1189
  ...prev,
1193
1190
  ...head
1194
1191
  }));
1195
- (_b2 = this.serverSsr) == null ? void 0 : _b2.onMatchSettled({
1196
- router: this,
1197
- match: this.getMatch(matchId)
1198
- });
1199
1192
  }
1200
1193
  }
1201
1194
  if (!loaderIsRunningAsync) {
@@ -1467,7 +1460,7 @@ class RouterCore {
1467
1460
  parseSearch: options.parseSearch ?? searchParams.defaultParseSearch
1468
1461
  });
1469
1462
  if (typeof document !== "undefined") {
1470
- window.__TSR_ROUTER__ = this;
1463
+ self.__TSR_ROUTER__ = this;
1471
1464
  }
1472
1465
  }
1473
1466
  get state() {
@@ -1613,7 +1606,7 @@ class RouterCore {
1613
1606
  error: void 0,
1614
1607
  paramsError: parseErrors[index],
1615
1608
  __routeContext: {},
1616
- __beforeLoadContext: {},
1609
+ __beforeLoadContext: void 0,
1617
1610
  context: {},
1618
1611
  abortController: new AbortController(),
1619
1612
  fetchCount: 0,