@tanstack/router-core 1.132.0-alpha.4 → 1.132.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 (104) hide show
  1. package/dist/cjs/Matches.cjs +2 -1
  2. package/dist/cjs/Matches.cjs.map +1 -1
  3. package/dist/cjs/Matches.d.cts +2 -2
  4. package/dist/cjs/config.cjs +10 -0
  5. package/dist/cjs/config.cjs.map +1 -0
  6. package/dist/cjs/config.d.cts +17 -0
  7. package/dist/cjs/fileRoute.d.cts +3 -2
  8. package/dist/cjs/index.cjs +9 -2
  9. package/dist/cjs/index.cjs.map +1 -1
  10. package/dist/cjs/index.d.cts +10 -5
  11. package/dist/cjs/load-matches.cjs +5 -3
  12. package/dist/cjs/load-matches.cjs.map +1 -1
  13. package/dist/cjs/location.d.cts +38 -0
  14. package/dist/cjs/path.cjs +27 -64
  15. package/dist/cjs/path.cjs.map +1 -1
  16. package/dist/cjs/path.d.cts +6 -7
  17. package/dist/cjs/process-route-tree.cjs +144 -0
  18. package/dist/cjs/process-route-tree.cjs.map +1 -0
  19. package/dist/cjs/process-route-tree.d.cts +10 -0
  20. package/dist/cjs/redirect.cjs +1 -1
  21. package/dist/cjs/redirect.cjs.map +1 -1
  22. package/dist/cjs/rewrite.cjs +63 -0
  23. package/dist/cjs/rewrite.cjs.map +1 -0
  24. package/dist/cjs/rewrite.d.cts +22 -0
  25. package/dist/cjs/route.cjs.map +1 -1
  26. package/dist/cjs/route.d.cts +62 -44
  27. package/dist/cjs/router.cjs +102 -210
  28. package/dist/cjs/router.cjs.map +1 -1
  29. package/dist/cjs/router.d.cts +81 -44
  30. package/dist/cjs/scroll-restoration.cjs.map +1 -1
  31. package/dist/cjs/scroll-restoration.d.cts +9 -0
  32. package/dist/cjs/ssr/createRequestHandler.cjs +4 -1
  33. package/dist/cjs/ssr/createRequestHandler.cjs.map +1 -1
  34. package/dist/cjs/ssr/serializer/transformer.cjs +14 -12
  35. package/dist/cjs/ssr/serializer/transformer.cjs.map +1 -1
  36. package/dist/cjs/ssr/serializer/transformer.d.cts +55 -15
  37. package/dist/cjs/ssr/ssr-client.cjs.map +1 -1
  38. package/dist/cjs/ssr/ssr-server.cjs +5 -2
  39. package/dist/cjs/ssr/ssr-server.cjs.map +1 -1
  40. package/dist/cjs/ssr/ssr-server.d.cts +4 -1
  41. package/dist/cjs/utils.cjs +68 -46
  42. package/dist/cjs/utils.cjs.map +1 -1
  43. package/dist/esm/Matches.d.ts +2 -2
  44. package/dist/esm/Matches.js +2 -1
  45. package/dist/esm/Matches.js.map +1 -1
  46. package/dist/esm/config.d.ts +17 -0
  47. package/dist/esm/config.js +10 -0
  48. package/dist/esm/config.js.map +1 -0
  49. package/dist/esm/fileRoute.d.ts +3 -2
  50. package/dist/esm/index.d.ts +10 -5
  51. package/dist/esm/index.js +10 -3
  52. package/dist/esm/index.js.map +1 -1
  53. package/dist/esm/load-matches.js +5 -3
  54. package/dist/esm/load-matches.js.map +1 -1
  55. package/dist/esm/location.d.ts +38 -0
  56. package/dist/esm/path.d.ts +6 -7
  57. package/dist/esm/path.js +27 -64
  58. package/dist/esm/path.js.map +1 -1
  59. package/dist/esm/process-route-tree.d.ts +10 -0
  60. package/dist/esm/process-route-tree.js +144 -0
  61. package/dist/esm/process-route-tree.js.map +1 -0
  62. package/dist/esm/redirect.js +1 -1
  63. package/dist/esm/redirect.js.map +1 -1
  64. package/dist/esm/rewrite.d.ts +22 -0
  65. package/dist/esm/rewrite.js +63 -0
  66. package/dist/esm/rewrite.js.map +1 -0
  67. package/dist/esm/route.d.ts +62 -44
  68. package/dist/esm/route.js.map +1 -1
  69. package/dist/esm/router.d.ts +81 -44
  70. package/dist/esm/router.js +104 -212
  71. package/dist/esm/router.js.map +1 -1
  72. package/dist/esm/scroll-restoration.d.ts +9 -0
  73. package/dist/esm/scroll-restoration.js.map +1 -1
  74. package/dist/esm/ssr/createRequestHandler.js +4 -1
  75. package/dist/esm/ssr/createRequestHandler.js.map +1 -1
  76. package/dist/esm/ssr/serializer/transformer.d.ts +55 -15
  77. package/dist/esm/ssr/serializer/transformer.js +14 -12
  78. package/dist/esm/ssr/serializer/transformer.js.map +1 -1
  79. package/dist/esm/ssr/ssr-client.js.map +1 -1
  80. package/dist/esm/ssr/ssr-server.d.ts +4 -1
  81. package/dist/esm/ssr/ssr-server.js +5 -2
  82. package/dist/esm/ssr/ssr-server.js.map +1 -1
  83. package/dist/esm/utils.js +68 -46
  84. package/dist/esm/utils.js.map +1 -1
  85. package/package.json +2 -2
  86. package/src/Matches.ts +4 -3
  87. package/src/config.ts +42 -0
  88. package/src/fileRoute.ts +25 -3
  89. package/src/index.ts +23 -6
  90. package/src/load-matches.ts +31 -21
  91. package/src/location.ts +38 -0
  92. package/src/path.ts +44 -82
  93. package/src/process-route-tree.ts +233 -0
  94. package/src/redirect.ts +1 -1
  95. package/src/rewrite.ts +70 -0
  96. package/src/route.ts +311 -74
  97. package/src/router.ts +263 -389
  98. package/src/scroll-restoration.ts +1 -1
  99. package/src/ssr/createRequestHandler.ts +4 -1
  100. package/src/ssr/serializer/transformer.ts +168 -31
  101. package/src/ssr/server.ts +6 -0
  102. package/src/ssr/ssr-client.ts +2 -2
  103. package/src/ssr/ssr-server.ts +10 -7
  104. package/src/utils.ts +83 -61
@@ -4,32 +4,38 @@ import { ParsePathnameCache } from './path.js';
4
4
  import { SearchParser, SearchSerializer } from './searchParams.js';
5
5
  import { AnyRedirect, ResolvedRedirect } from './redirect.js';
6
6
  import { HistoryLocation, HistoryState, ParsedHistoryState, RouterHistory } from '@tanstack/history';
7
- import { Awaitable, ControlledPromise, NoInfer, NonNullableUpdater, PickAsRequired, Updater } from './utils.js';
7
+ import { Awaitable, Constrain, ControlledPromise, NoInfer, NonNullableUpdater, PickAsRequired, Updater } from './utils.js';
8
8
  import { ParsedLocation } from './location.js';
9
- import { AnyContext, AnyRoute, AnyRouteWithContext, MakeRemountDepsOptionsUnion, RouteMask } from './route.js';
9
+ import { AnyContext, AnyRoute, AnyRouteWithContext, MakeRemountDepsOptionsUnion, RouteLike, RouteMask } from './route.js';
10
10
  import { FullSearchSchema, RouteById, RoutePaths, RoutesById, RoutesByPath } from './routeInfo.js';
11
11
  import { AnyRouteMatch, MakeRouteMatchUnion, MatchRouteOptions } from './Matches.js';
12
12
  import { BuildLocationFn, CommitLocationOptions, NavigateFn } from './RouterProvider.js';
13
13
  import { Manifest } from './manifest.js';
14
14
  import { AnySchema } from './validators.js';
15
15
  import { NavigateOptions, ResolveRelativePath, ToOptions } from './link.js';
16
+ import { AnySerializationAdapter, ValidateSerializableInput } from './ssr/serializer/transformer.js';
16
17
  export type ControllablePromise<T = any> = Promise<T> & {
17
18
  resolve: (value: T) => void;
18
19
  reject: (value?: any) => void;
19
20
  };
20
21
  export type InjectedHtmlEntry = Promise<string>;
21
- export interface DefaultRegister {
22
- router: AnyRouter;
22
+ export interface Register {
23
23
  }
24
- export interface Register extends DefaultRegister {
25
- }
26
- export type RegisteredRouter = Register['router'];
24
+ export type RegisteredRouter<TRegister = Register> = TRegister extends {
25
+ router: infer TRouter;
26
+ } ? TRouter : AnyRouter;
27
+ export type RegisteredConfigType<TRegister, TKey> = TRegister extends {
28
+ config: infer TConfig;
29
+ } ? TConfig extends {
30
+ '~types': infer TTypes;
31
+ } ? TKey extends keyof TTypes ? TTypes[TKey] : unknown : unknown : unknown;
27
32
  export type DefaultRemountDepsFn<TRouteTree extends AnyRoute> = (opts: MakeRemountDepsOptionsUnion<TRouteTree>) => any;
28
33
  export interface DefaultRouterOptionsExtensions {
29
34
  }
30
35
  export interface RouterOptionsExtensions extends DefaultRouterOptionsExtensions {
31
36
  }
32
- export interface RouterOptions<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean = false, TRouterHistory extends RouterHistory = RouterHistory, TDehydrated extends Record<string, any> = Record<string, any>, TTransformerConfig = any> extends RouterOptionsExtensions {
37
+ export type SSROption = boolean | 'data-only';
38
+ export interface RouterOptions<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean = false, TRouterHistory extends RouterHistory = RouterHistory, TDehydrated = undefined> extends RouterOptionsExtensions {
33
39
  /**
34
40
  * The history object that will be used to manage the browser history.
35
41
  *
@@ -173,6 +179,18 @@ export interface RouterOptions<TRouteTree extends AnyRoute, TTrailingSlashOption
173
179
  /**
174
180
  * The basepath for then entire router. This is useful for mounting a router instance at a subpath.
175
181
  *
182
+ * @deprecated - use `rewrite.input` with the new `rewriteBasepath` utility instead:
183
+ * ```ts
184
+ * const router = createRouter({
185
+ * routeTree,
186
+ * rewrite: rewriteBasepath('/basepath')
187
+ * // Or wrap existing rewrite functionality
188
+ * rewrite: rewriteBasepath('/basepath', {
189
+ * output: ({ url }) => {...},
190
+ * input: ({ url }) => {...},
191
+ * })
192
+ * })
193
+ * ```
176
194
  * @default '/'
177
195
  * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#basepath-property)
178
196
  */
@@ -188,6 +206,7 @@ export interface RouterOptions<TRouteTree extends AnyRoute, TTrailingSlashOption
188
206
  * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/router-context)
189
207
  */
190
208
  context?: InferRouterContext<TRouteTree>;
209
+ additionalContext?: any;
191
210
  /**
192
211
  * A function that will be called when the router is dehydrated.
193
212
  *
@@ -196,7 +215,7 @@ export interface RouterOptions<TRouteTree extends AnyRoute, TTrailingSlashOption
196
215
  * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#dehydrate-method)
197
216
  * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/external-data-loading#critical-dehydrationhydration)
198
217
  */
199
- dehydrate?: () => Awaitable<TDehydrated>;
218
+ dehydrate?: () => Constrain<TDehydrated, ValidateSerializableInput<Register, TDehydrated>>;
200
219
  /**
201
220
  * A function that will be called when the router is hydrated.
202
221
  *
@@ -262,7 +281,7 @@ export interface RouterOptions<TRouteTree extends AnyRoute, TTrailingSlashOption
262
281
  *
263
282
  * @default true
264
283
  */
265
- defaultSsr?: boolean | 'data-only';
284
+ defaultSsr?: SSROption;
266
285
  search?: {
267
286
  /**
268
287
  * Configures how unknown search params (= not returned by any `validateSearch`) are treated.
@@ -322,8 +341,45 @@ export interface RouterOptions<TRouteTree extends AnyRoute, TTrailingSlashOption
322
341
  * @default false
323
342
  */
324
343
  disableGlobalCatchBoundary?: boolean;
325
- serializationAdapters?: TTransformerConfig;
344
+ serializationAdapters?: ReadonlyArray<AnySerializationAdapter>;
345
+ /**
346
+ * Configures how the router will rewrite the location between the actual href and the internal href of the router.
347
+ *
348
+ * @default undefined
349
+ * @description You can provide a custom rewrite pair (in/out) or use the utilities like `rewriteBasepath` as a convenience for common use cases, or even do both!
350
+ * This is useful for basepath rewriting, shifting data from the origin to the path (for things like )
351
+ */
352
+ rewrite?: LocationRewrite;
353
+ origin?: string;
354
+ ssr?: {
355
+ nonce?: string;
356
+ };
326
357
  }
358
+ export type LocationRewrite = {
359
+ /**
360
+ * A function that will be called to rewrite the URL before it is interpreted by the router from the history instance.
361
+ * Utilities like `rewriteBasepath` are provided as a convenience for common use cases.
362
+ *
363
+ * @default undefined
364
+ */
365
+ input?: LocationRewriteFunction;
366
+ /**
367
+ * A function that will be called to rewrite the URL before it is committed to the actual history instance from the router.
368
+ * Utilities like `rewriteBasepath` are provided as a convenience for common use cases.
369
+ *
370
+ * @default undefined
371
+ */
372
+ output?: LocationRewriteFunction;
373
+ };
374
+ /**
375
+ * A function that will be called to rewrite the URL.
376
+ *
377
+ * @param url The URL to rewrite.
378
+ * @returns The rewritten URL (as a URL instance or full href string) or undefined if no rewrite is needed.
379
+ */
380
+ export type LocationRewriteFunction = ({ url, }: {
381
+ url: URL;
382
+ }) => undefined | string | URL;
327
383
  export interface RouterState<in out TRouteTree extends AnyRoute = AnyRoute, in out TRouteMatch = MakeRouteMatchUnion> {
328
384
  status: 'pending' | 'idle';
329
385
  loadedAt: number;
@@ -403,16 +459,16 @@ export type RouterContextOptions<TRouteTree extends AnyRoute> = AnyContext exten
403
459
  } : {
404
460
  context: InferRouterContext<TRouteTree>;
405
461
  };
406
- export type RouterConstructorOptions<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean, TRouterHistory extends RouterHistory, TDehydrated extends Record<string, any>, TTransformerConfig> = Omit<RouterOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated, TTransformerConfig>, 'context'> & RouterContextOptions<TRouteTree>;
462
+ 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>;
407
463
  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>;
408
464
  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'];
409
- export type UpdateFn<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean, TRouterHistory extends RouterHistory, TDehydrated extends Record<string, any>, TTransformerConfig extends any> = (newOptions: RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated, TTransformerConfig>) => void;
465
+ 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;
410
466
  export type InvalidateFn<TRouter extends AnyRouter> = (opts?: {
411
467
  filter?: (d: MakeRouteMatchUnion<TRouter>) => boolean;
412
468
  sync?: boolean;
413
469
  forcePending?: boolean;
414
470
  }) => Promise<void>;
415
- export type ParseLocationFn<TRouteTree extends AnyRoute> = (previousLocation?: ParsedLocation<FullSearchSchema<TRouteTree>>, locationToParse?: HistoryLocation) => ParsedLocation<FullSearchSchema<TRouteTree>>;
471
+ export type ParseLocationFn<TRouteTree extends AnyRoute> = (locationToParse: HistoryLocation, previousLocation?: ParsedLocation<FullSearchSchema<TRouteTree>>) => ParsedLocation<FullSearchSchema<TRouteTree>>;
416
472
  export type GetMatchRoutesFn = (pathname: string, routePathname: string | undefined) => {
417
473
  matchedRoutes: Array<AnyRoute>;
418
474
  routeParams: Record<string, string>;
@@ -449,8 +505,8 @@ export interface ServerSsr {
449
505
  onRenderFinished: (listener: () => void) => void;
450
506
  dehydrate: () => Promise<void>;
451
507
  }
452
- export type AnyRouterWithContext<TContext> = RouterCore<AnyRouteWithContext<TContext>, any, any, any, any, any>;
453
- export type AnyRouter = RouterCore<any, any, any, any, any, any>;
508
+ export type AnyRouterWithContext<TContext> = RouterCore<AnyRouteWithContext<TContext>, any, any, any, any>;
509
+ export type AnyRouter = RouterCore<any, any, any, any, any>;
454
510
  export interface ViewTransitionOptions {
455
511
  types: Array<string> | ((locationChangeInfo: {
456
512
  fromLocation?: ParsedLocation;
@@ -477,8 +533,8 @@ export declare function getLocationChangeInfo(routerState: {
477
533
  hrefChanged: boolean;
478
534
  hashChanged: boolean;
479
535
  };
480
- 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>, TTransformerConfig = any>(options: undefined extends number ? 'strictNullChecks must be enabled in tsconfig.json' : RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated, TTransformerConfig>) => RouterCore<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated, TTransformerConfig>;
481
- 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>, in out TTransformerConfig = any> {
536
+ 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>;
537
+ 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>> {
482
538
  tempLocationKey: string | undefined;
483
539
  resetNextScroll: boolean;
484
540
  shouldViewTransition?: boolean | ViewTransitionOptions;
@@ -488,8 +544,10 @@ export declare class RouterCore<in out TRouteTree extends AnyRoute, in out TTrai
488
544
  isScrollRestoring: boolean;
489
545
  isScrollRestorationSetup: boolean;
490
546
  __store: Store<RouterState<TRouteTree>>;
491
- options: PickAsRequired<RouterOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated, TTransformerConfig>, 'stringifySearch' | 'parseSearch' | 'context'>;
547
+ options: PickAsRequired<RouterOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>, 'stringifySearch' | 'parseSearch' | 'context'>;
492
548
  history: TRouterHistory;
549
+ rewrite?: LocationRewrite;
550
+ origin?: string;
493
551
  latestLocation: ParsedLocation<FullSearchSchema<TRouteTree>>;
494
552
  basepath: string;
495
553
  routeTree: TRouteTree;
@@ -501,12 +559,13 @@ export declare class RouterCore<in out TRouteTree extends AnyRoute, in out TTrai
501
559
  /**
502
560
  * @deprecated Use the `createRouter` function instead
503
561
  */
504
- constructor(options: RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated, TTransformerConfig>);
562
+ constructor(options: RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>);
505
563
  startTransition: StartTransitionFn;
506
564
  isShell(): boolean;
507
565
  isPrerendering(): boolean;
508
- update: UpdateFn<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated, TTransformerConfig>;
566
+ update: UpdateFn<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>;
509
567
  get state(): RouterState<TRouteTree>;
568
+ updateLatestLocation: () => void;
510
569
  buildRouteTree: () => void;
511
570
  subscribe: SubscribeFn;
512
571
  emit: EmitFn;
@@ -550,31 +609,9 @@ export declare class PathParamError extends Error {
550
609
  }
551
610
  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]>>>;
552
611
  export declare function getInitialRouterState(location: ParsedLocation): RouterState<any>;
553
- interface RouteLike {
554
- id: string;
555
- isRoot?: boolean;
556
- path?: string;
557
- fullPath: string;
558
- rank?: number;
559
- parentRoute?: RouteLike;
560
- children?: Array<RouteLike>;
561
- options?: {
562
- caseSensitive?: boolean;
563
- };
564
- }
565
- export type ProcessRouteTreeResult<TRouteLike extends RouteLike> = {
566
- routesById: Record<string, TRouteLike>;
567
- routesByPath: Record<string, TRouteLike>;
568
- flatRoutes: Array<TRouteLike>;
569
- };
570
- export declare function processRouteTree<TRouteLike extends RouteLike>({ routeTree, initRoute, }: {
571
- routeTree: TRouteLike;
572
- initRoute?: (route: TRouteLike, index: number) => void;
573
- }): ProcessRouteTreeResult<TRouteLike>;
574
- export declare function getMatchedRoutes<TRouteLike extends RouteLike>({ pathname, routePathname, basepath, caseSensitive, routesByPath, routesById, flatRoutes, parseCache, }: {
612
+ export declare function getMatchedRoutes<TRouteLike extends RouteLike>({ pathname, routePathname, caseSensitive, routesByPath, routesById, flatRoutes, parseCache, }: {
575
613
  pathname: string;
576
614
  routePathname?: string;
577
- basepath: string;
578
615
  caseSensitive?: boolean;
579
616
  routesByPath: Record<string, TRouteLike>;
580
617
  routesById: Record<string, TRouteLike>;