@tanstack/router-core 1.121.20 → 1.121.27

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 (124) hide show
  1. package/dist/cjs/Matches.cjs +13 -0
  2. package/dist/cjs/Matches.cjs.map +1 -0
  3. package/dist/cjs/Matches.d.cts +109 -0
  4. package/dist/cjs/RouterProvider.d.cts +26 -0
  5. package/dist/cjs/defer.cjs +25 -0
  6. package/dist/cjs/defer.cjs.map +1 -0
  7. package/dist/cjs/defer.d.cts +20 -0
  8. package/dist/cjs/fileRoute.d.cts +23 -0
  9. package/dist/cjs/history.d.cts +8 -0
  10. package/dist/cjs/index.cjs +79 -0
  11. package/dist/cjs/index.cjs.map +1 -0
  12. package/dist/cjs/index.d.cts +41 -0
  13. package/dist/cjs/link.cjs +5 -0
  14. package/dist/cjs/link.cjs.map +1 -0
  15. package/dist/cjs/link.d.cts +212 -0
  16. package/dist/cjs/location.d.cts +12 -0
  17. package/dist/cjs/manifest.d.cts +24 -0
  18. package/dist/cjs/not-found.cjs +13 -0
  19. package/dist/cjs/not-found.cjs.map +1 -0
  20. package/dist/cjs/not-found.d.cts +20 -0
  21. package/dist/cjs/path.cjs +412 -0
  22. package/dist/cjs/path.cjs.map +1 -0
  23. package/dist/cjs/path.d.cts +56 -0
  24. package/dist/cjs/qss.cjs +36 -0
  25. package/dist/cjs/qss.cjs.map +1 -0
  26. package/dist/cjs/qss.d.cts +31 -0
  27. package/dist/cjs/redirect.cjs +42 -0
  28. package/dist/cjs/redirect.cjs.map +1 -0
  29. package/dist/cjs/redirect.d.cts +41 -0
  30. package/dist/cjs/root.cjs +5 -0
  31. package/dist/cjs/root.cjs.map +1 -0
  32. package/dist/cjs/root.d.cts +2 -0
  33. package/dist/cjs/route.cjs +119 -0
  34. package/dist/cjs/route.cjs.map +1 -0
  35. package/dist/cjs/route.d.cts +432 -0
  36. package/dist/cjs/routeInfo.d.cts +54 -0
  37. package/dist/cjs/router.cjs +1805 -0
  38. package/dist/cjs/router.cjs.map +1 -0
  39. package/dist/cjs/router.d.cts +627 -0
  40. package/dist/cjs/scroll-restoration.cjs +207 -0
  41. package/dist/cjs/scroll-restoration.cjs.map +1 -0
  42. package/dist/cjs/scroll-restoration.d.cts +38 -0
  43. package/dist/cjs/searchMiddleware.cjs +42 -0
  44. package/dist/cjs/searchMiddleware.cjs.map +1 -0
  45. package/dist/cjs/searchMiddleware.d.cts +5 -0
  46. package/dist/cjs/searchParams.cjs +61 -0
  47. package/dist/cjs/searchParams.cjs.map +1 -0
  48. package/dist/cjs/searchParams.d.cts +7 -0
  49. package/dist/cjs/serializer.d.cts +22 -0
  50. package/dist/cjs/structuralSharing.d.cts +4 -0
  51. package/dist/cjs/typePrimitives.d.cts +65 -0
  52. package/dist/cjs/useLoaderData.d.cts +5 -0
  53. package/dist/cjs/useLoaderDeps.d.cts +5 -0
  54. package/dist/cjs/useNavigate.d.cts +3 -0
  55. package/dist/cjs/useParams.d.cts +5 -0
  56. package/dist/cjs/useRouteContext.d.cts +9 -0
  57. package/dist/cjs/useSearch.d.cts +5 -0
  58. package/dist/cjs/utils.cjs +165 -0
  59. package/dist/cjs/utils.cjs.map +1 -0
  60. package/dist/cjs/utils.d.cts +94 -0
  61. package/dist/cjs/validators.d.cts +51 -0
  62. package/dist/esm/Matches.d.ts +109 -0
  63. package/dist/esm/Matches.js +13 -0
  64. package/dist/esm/Matches.js.map +1 -0
  65. package/dist/esm/RouterProvider.d.ts +26 -0
  66. package/dist/esm/defer.d.ts +20 -0
  67. package/dist/esm/defer.js +25 -0
  68. package/dist/esm/defer.js.map +1 -0
  69. package/dist/esm/fileRoute.d.ts +23 -0
  70. package/dist/esm/history.d.ts +8 -0
  71. package/dist/esm/index.d.ts +41 -0
  72. package/dist/esm/index.js +79 -0
  73. package/dist/esm/index.js.map +1 -0
  74. package/dist/esm/link.d.ts +212 -0
  75. package/dist/esm/link.js +5 -0
  76. package/dist/esm/link.js.map +1 -0
  77. package/dist/esm/location.d.ts +12 -0
  78. package/dist/esm/manifest.d.ts +24 -0
  79. package/dist/esm/not-found.d.ts +20 -0
  80. package/dist/esm/not-found.js +13 -0
  81. package/dist/esm/not-found.js.map +1 -0
  82. package/dist/esm/path.d.ts +56 -0
  83. package/dist/esm/path.js +412 -0
  84. package/dist/esm/path.js.map +1 -0
  85. package/dist/esm/qss.d.ts +31 -0
  86. package/dist/esm/qss.js +36 -0
  87. package/dist/esm/qss.js.map +1 -0
  88. package/dist/esm/redirect.d.ts +41 -0
  89. package/dist/esm/redirect.js +42 -0
  90. package/dist/esm/redirect.js.map +1 -0
  91. package/dist/esm/root.d.ts +2 -0
  92. package/dist/esm/root.js +5 -0
  93. package/dist/esm/root.js.map +1 -0
  94. package/dist/esm/route.d.ts +432 -0
  95. package/dist/esm/route.js +119 -0
  96. package/dist/esm/route.js.map +1 -0
  97. package/dist/esm/routeInfo.d.ts +54 -0
  98. package/dist/esm/router.d.ts +627 -0
  99. package/dist/esm/router.js +1805 -0
  100. package/dist/esm/router.js.map +1 -0
  101. package/dist/esm/scroll-restoration.d.ts +38 -0
  102. package/dist/esm/scroll-restoration.js +207 -0
  103. package/dist/esm/scroll-restoration.js.map +1 -0
  104. package/dist/esm/searchMiddleware.d.ts +5 -0
  105. package/dist/esm/searchMiddleware.js +42 -0
  106. package/dist/esm/searchMiddleware.js.map +1 -0
  107. package/dist/esm/searchParams.d.ts +7 -0
  108. package/dist/esm/searchParams.js +61 -0
  109. package/dist/esm/searchParams.js.map +1 -0
  110. package/dist/esm/serializer.d.ts +22 -0
  111. package/dist/esm/structuralSharing.d.ts +4 -0
  112. package/dist/esm/typePrimitives.d.ts +65 -0
  113. package/dist/esm/useLoaderData.d.ts +5 -0
  114. package/dist/esm/useLoaderDeps.d.ts +5 -0
  115. package/dist/esm/useNavigate.d.ts +3 -0
  116. package/dist/esm/useParams.d.ts +5 -0
  117. package/dist/esm/useRouteContext.d.ts +9 -0
  118. package/dist/esm/useSearch.d.ts +5 -0
  119. package/dist/esm/utils.d.ts +94 -0
  120. package/dist/esm/utils.js +165 -0
  121. package/dist/esm/utils.js.map +1 -0
  122. package/dist/esm/validators.d.ts +51 -0
  123. package/package.json +2 -2
  124. package/src/index.ts +6 -1
@@ -0,0 +1,432 @@
1
+ import { LazyRoute } from './fileRoute.cjs';
2
+ import { NotFoundError } from './not-found.cjs';
3
+ import { NavigateOptions, ParsePathParams } from './link.cjs';
4
+ import { ParsedLocation } from './location.cjs';
5
+ import { AnyRouteMatch, MakeRouteMatchFromRoute, MakeRouteMatchUnion, RouteMatch } from './Matches.cjs';
6
+ import { RootRouteId } from './root.cjs';
7
+ import { ParseRoute, RouteById, RoutePaths } from './routeInfo.cjs';
8
+ import { AnyRouter, RegisteredRouter } from './router.cjs';
9
+ import { BuildLocationFn, NavigateFn } from './RouterProvider.cjs';
10
+ import { Assign, Awaitable, Constrain, Expand, IntersectAssign, LooseAsyncReturnType, LooseReturnType, NoInfer } from './utils.cjs';
11
+ import { AnySchema, AnyStandardSchemaValidator, AnyValidator, AnyValidatorAdapter, AnyValidatorObj, DefaultValidator, ResolveSearchValidatorInput, ResolveValidatorOutput, StandardSchemaValidator, ValidatorAdapter, ValidatorFn, ValidatorObj } from './validators.cjs';
12
+ export type AnyPathParams = {};
13
+ export type SearchSchemaInput = {
14
+ __TSearchSchemaInput__: 'TSearchSchemaInput';
15
+ };
16
+ export type AnyContext = {};
17
+ export interface RouteContext {
18
+ }
19
+ export type PreloadableObj = {
20
+ preload?: () => Promise<void>;
21
+ };
22
+ export type RoutePathOptions<TCustomId, TPath> = {
23
+ path: TPath;
24
+ } | {
25
+ id: TCustomId;
26
+ };
27
+ export interface StaticDataRouteOption {
28
+ }
29
+ export type RoutePathOptionsIntersection<TCustomId, TPath> = {
30
+ path: TPath;
31
+ id: TCustomId;
32
+ };
33
+ export type SearchFilter<TInput, TResult = TInput> = (prev: TInput) => TResult;
34
+ export type SearchMiddlewareContext<TSearchSchema> = {
35
+ search: TSearchSchema;
36
+ next: (newSearch: TSearchSchema) => TSearchSchema;
37
+ };
38
+ export type SearchMiddleware<TSearchSchema> = (ctx: SearchMiddlewareContext<TSearchSchema>) => TSearchSchema;
39
+ export type ResolveId<TParentRoute, TCustomId extends string, TPath extends string> = TParentRoute extends {
40
+ id: infer TParentId extends string;
41
+ } ? RoutePrefix<TParentId, string extends TCustomId ? TPath : TCustomId> : RootRouteId;
42
+ export type InferFullSearchSchema<TRoute> = TRoute extends {
43
+ types: {
44
+ fullSearchSchema: infer TFullSearchSchema;
45
+ };
46
+ } ? TFullSearchSchema : {};
47
+ export type InferFullSearchSchemaInput<TRoute> = TRoute extends {
48
+ types: {
49
+ fullSearchSchemaInput: infer TFullSearchSchemaInput;
50
+ };
51
+ } ? TFullSearchSchemaInput : {};
52
+ export type InferAllParams<TRoute> = TRoute extends {
53
+ types: {
54
+ allParams: infer TAllParams;
55
+ };
56
+ } ? TAllParams : {};
57
+ export type InferAllContext<TRoute> = unknown extends TRoute ? TRoute : TRoute extends {
58
+ types: {
59
+ allContext: infer TAllContext;
60
+ };
61
+ } ? TAllContext : {};
62
+ export type ResolveSearchSchemaFnInput<TSearchValidator> = TSearchValidator extends (input: infer TSearchSchemaInput) => any ? TSearchSchemaInput extends SearchSchemaInput ? Omit<TSearchSchemaInput, keyof SearchSchemaInput> : ResolveSearchSchemaFn<TSearchValidator> : AnySchema;
63
+ export type ResolveSearchSchemaInput<TSearchValidator> = TSearchValidator extends AnyStandardSchemaValidator ? NonNullable<TSearchValidator['~standard']['types']>['input'] : TSearchValidator extends AnyValidatorAdapter ? TSearchValidator['types']['input'] : TSearchValidator extends AnyValidatorObj ? ResolveSearchSchemaFnInput<TSearchValidator['parse']> : ResolveSearchSchemaFnInput<TSearchValidator>;
64
+ export type ResolveSearchSchemaFn<TSearchValidator> = TSearchValidator extends (...args: any) => infer TSearchSchema ? TSearchSchema : AnySchema;
65
+ export type ResolveSearchSchema<TSearchValidator> = unknown extends TSearchValidator ? TSearchValidator : TSearchValidator extends AnyStandardSchemaValidator ? NonNullable<TSearchValidator['~standard']['types']>['output'] : TSearchValidator extends AnyValidatorAdapter ? TSearchValidator['types']['output'] : TSearchValidator extends AnyValidatorObj ? ResolveSearchSchemaFn<TSearchValidator['parse']> : ResolveSearchSchemaFn<TSearchValidator>;
66
+ export type ResolveRequiredParams<TPath extends string, T> = {
67
+ [K in ParsePathParams<TPath>['required']]: T;
68
+ };
69
+ export type ResolveOptionalParams<TPath extends string, T> = {
70
+ [K in ParsePathParams<TPath>['optional']]?: T;
71
+ };
72
+ export type ResolveParams<TPath extends string, T = string> = ResolveRequiredParams<TPath, T> & ResolveOptionalParams<TPath, T>;
73
+ export type ParseParamsFn<in out TPath extends string, in out TParams> = (rawParams: Expand<ResolveParams<TPath>>) => TParams extends ResolveParams<TPath, any> ? TParams : ResolveParams<TPath, any>;
74
+ export type StringifyParamsFn<in out TPath extends string, in out TParams> = (params: TParams) => ResolveParams<TPath>;
75
+ export type ParamsOptions<in out TPath extends string, in out TParams> = {
76
+ params?: {
77
+ parse?: ParseParamsFn<TPath, TParams>;
78
+ stringify?: StringifyParamsFn<TPath, TParams>;
79
+ };
80
+ /**
81
+ @deprecated Use params.parse instead
82
+ */
83
+ parseParams?: ParseParamsFn<TPath, TParams>;
84
+ /**
85
+ @deprecated Use params.stringify instead
86
+ */
87
+ stringifyParams?: StringifyParamsFn<TPath, TParams>;
88
+ };
89
+ interface RequiredStaticDataRouteOption {
90
+ staticData: StaticDataRouteOption;
91
+ }
92
+ interface OptionalStaticDataRouteOption {
93
+ staticData?: StaticDataRouteOption;
94
+ }
95
+ export type UpdatableStaticRouteOption = {} extends StaticDataRouteOption ? OptionalStaticDataRouteOption : RequiredStaticDataRouteOption;
96
+ export type MetaDescriptor = {
97
+ charSet: 'utf-8';
98
+ } | {
99
+ title: string;
100
+ } | {
101
+ name: string;
102
+ content: string;
103
+ } | {
104
+ property: string;
105
+ content: string;
106
+ } | {
107
+ httpEquiv: string;
108
+ content: string;
109
+ } | {
110
+ 'script:ld+json': LdJsonObject;
111
+ } | {
112
+ tagName: 'meta' | 'link';
113
+ [name: string]: string;
114
+ } | Record<string, unknown>;
115
+ type LdJsonObject = {
116
+ [Key in string]: LdJsonValue;
117
+ } & {
118
+ [Key in string]?: LdJsonValue | undefined;
119
+ };
120
+ type LdJsonArray = Array<LdJsonValue> | ReadonlyArray<LdJsonValue>;
121
+ type LdJsonPrimitive = string | number | boolean | null;
122
+ type LdJsonValue = LdJsonPrimitive | LdJsonObject | LdJsonArray;
123
+ export type RouteLinkEntry = {};
124
+ export type SearchValidator<TInput, TOutput> = ValidatorObj<TInput, TOutput> | ValidatorFn<TInput, TOutput> | ValidatorAdapter<TInput, TOutput> | StandardSchemaValidator<TInput, TOutput> | undefined;
125
+ export type AnySearchValidator = SearchValidator<any, any>;
126
+ export type DefaultSearchValidator = SearchValidator<Record<string, unknown>, AnySchema>;
127
+ export type RoutePrefix<TPrefix extends string, TPath extends string> = string extends TPath ? RootRouteId : TPath extends string ? TPrefix extends RootRouteId ? TPath extends '/' ? '/' : `/${TrimPath<TPath>}` : `${TPrefix}/${TPath}` extends '/' ? '/' : `/${TrimPathLeft<`${TrimPathRight<TPrefix>}/${TrimPath<TPath>}`>}` : never;
128
+ export type TrimPath<T extends string> = '' extends T ? '' : TrimPathRight<TrimPathLeft<T>>;
129
+ export type TrimPathLeft<T extends string> = T extends `${RootRouteId}/${infer U}` ? TrimPathLeft<U> : T extends `/${infer U}` ? TrimPathLeft<U> : T;
130
+ export type TrimPathRight<T extends string> = T extends '/' ? '/' : T extends `${infer U}/` ? TrimPathRight<U> : T;
131
+ export type ContextReturnType<TContextFn> = unknown extends TContextFn ? TContextFn : LooseReturnType<TContextFn> extends never ? AnyContext : LooseReturnType<TContextFn>;
132
+ export type ContextAsyncReturnType<TContextFn> = unknown extends TContextFn ? TContextFn : LooseAsyncReturnType<TContextFn> extends never ? AnyContext : LooseAsyncReturnType<TContextFn>;
133
+ export type ResolveRouteContext<TRouteContextFn, TBeforeLoadFn> = Assign<ContextReturnType<TRouteContextFn>, ContextAsyncReturnType<TBeforeLoadFn>>;
134
+ export type ResolveLoaderData<TLoaderFn> = unknown extends TLoaderFn ? TLoaderFn : LooseAsyncReturnType<TLoaderFn> extends never ? undefined : LooseAsyncReturnType<TLoaderFn>;
135
+ export type ResolveFullSearchSchema<TParentRoute extends AnyRoute, TSearchValidator> = unknown extends TParentRoute ? ResolveValidatorOutput<TSearchValidator> : IntersectAssign<InferFullSearchSchema<TParentRoute>, ResolveValidatorOutput<TSearchValidator>>;
136
+ export type ResolveFullSearchSchemaInput<TParentRoute extends AnyRoute, TSearchValidator> = IntersectAssign<InferFullSearchSchemaInput<TParentRoute>, ResolveSearchValidatorInput<TSearchValidator>>;
137
+ export type ResolveAllParamsFromParent<TParentRoute extends AnyRoute, TParams> = Assign<InferAllParams<TParentRoute>, TParams>;
138
+ export type RouteContextParameter<TParentRoute extends AnyRoute, TRouterContext> = unknown extends TParentRoute ? TRouterContext : Assign<TRouterContext, InferAllContext<TParentRoute>>;
139
+ export type BeforeLoadContextParameter<TParentRoute extends AnyRoute, TRouterContext, TRouteContextFn> = Assign<RouteContextParameter<TParentRoute, TRouterContext>, ContextReturnType<TRouteContextFn>>;
140
+ export type ResolveAllContext<TParentRoute extends AnyRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn> = Assign<BeforeLoadContextParameter<TParentRoute, TRouterContext, TRouteContextFn>, ContextAsyncReturnType<TBeforeLoadFn>>;
141
+ export interface FullSearchSchemaOption<in out TParentRoute extends AnyRoute, in out TSearchValidator> {
142
+ search: Expand<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>;
143
+ }
144
+ export interface RemountDepsOptions<in out TRouteId, in out TFullSearchSchema, in out TAllParams, in out TLoaderDeps> {
145
+ routeId: TRouteId;
146
+ search: TFullSearchSchema;
147
+ params: TAllParams;
148
+ loaderDeps: TLoaderDeps;
149
+ }
150
+ export type MakeRemountDepsOptionsUnion<TRouteTree extends AnyRoute = RegisteredRouter['routeTree']> = ParseRoute<TRouteTree> extends infer TRoute extends AnyRoute ? TRoute extends any ? RemountDepsOptions<TRoute['id'], TRoute['types']['fullSearchSchema'], TRoute['types']['allParams'], TRoute['types']['loaderDeps']> : never : never;
151
+ export interface RouteTypes<in out TParentRoute extends AnyRoute, in out TPath extends string, in out TFullPath extends string, in out TCustomId extends string, in out TId extends string, in out TSearchValidator, in out TParams, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn, in out TLoaderDeps, in out TLoaderFn, in out TChildren, in out TFileRouteTypes> {
152
+ parentRoute: TParentRoute;
153
+ path: TPath;
154
+ to: TrimPathRight<TFullPath>;
155
+ fullPath: TFullPath;
156
+ customId: TCustomId;
157
+ id: TId;
158
+ searchSchema: ResolveValidatorOutput<TSearchValidator>;
159
+ searchSchemaInput: ResolveSearchValidatorInput<TSearchValidator>;
160
+ searchValidator: TSearchValidator;
161
+ fullSearchSchema: ResolveFullSearchSchema<TParentRoute, TSearchValidator>;
162
+ fullSearchSchemaInput: ResolveFullSearchSchemaInput<TParentRoute, TSearchValidator>;
163
+ params: TParams;
164
+ allParams: ResolveAllParamsFromParent<TParentRoute, TParams>;
165
+ routerContext: TRouterContext;
166
+ routeContext: ResolveRouteContext<TRouteContextFn, TBeforeLoadFn>;
167
+ routeContextFn: TRouteContextFn;
168
+ beforeLoadFn: TBeforeLoadFn;
169
+ allContext: ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>;
170
+ children: TChildren;
171
+ loaderData: ResolveLoaderData<TLoaderFn>;
172
+ loaderDeps: TLoaderDeps;
173
+ fileRouteTypes: TFileRouteTypes;
174
+ }
175
+ export type ResolveFullPath<TParentRoute extends AnyRoute, TPath extends string, TPrefixed = RoutePrefix<TParentRoute['fullPath'], TPath>> = TPrefixed extends RootRouteId ? '/' : TPrefixed;
176
+ export interface RouteExtensions<in out TId, in out TFullPath> {
177
+ id: TId;
178
+ fullPath: TFullPath;
179
+ }
180
+ export type RouteLazyFn<TRoute extends AnyRoute> = (lazyFn: () => Promise<LazyRoute<TRoute>>) => TRoute;
181
+ export type RouteAddChildrenFn<in out TParentRoute extends AnyRoute, in out TPath extends string, in out TFullPath extends string, in out TCustomId extends string, in out TId extends string, in out TSearchValidator, in out TParams, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn, in out TLoaderDeps extends Record<string, any>, in out TLoaderFn, in out TFileRouteTypes> = <const TNewChildren>(children: Constrain<TNewChildren, ReadonlyArray<AnyRoute> | Record<string, AnyRoute>>) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TNewChildren, TFileRouteTypes>;
182
+ export type RouteAddFileChildrenFn<in out TParentRoute extends AnyRoute, in out TPath extends string, in out TFullPath extends string, in out TCustomId extends string, in out TId extends string, in out TSearchValidator, in out TParams, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn, in out TLoaderDeps extends Record<string, any>, in out TLoaderFn, in out TFileRouteTypes> = <const TNewChildren>(children: TNewChildren) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TNewChildren, TFileRouteTypes>;
183
+ export type RouteAddFileTypesFn<TParentRoute extends AnyRoute, TPath extends string, TFullPath extends string, TCustomId extends string, TId extends string, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps extends Record<string, any>, TLoaderFn, TChildren> = <TNewFileRouteTypes>() => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TNewFileRouteTypes>;
184
+ export interface Route<in out TParentRoute extends AnyRoute, in out TPath extends string, in out TFullPath extends string, in out TCustomId extends string, in out TId extends string, in out TSearchValidator, in out TParams, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn, in out TLoaderDeps extends Record<string, any>, in out TLoaderFn, in out TChildren, in out TFileRouteTypes> extends RouteExtensions<TId, TFullPath> {
185
+ path: TPath;
186
+ parentRoute: TParentRoute;
187
+ children?: TChildren;
188
+ types: RouteTypes<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes>;
189
+ options: RouteOptions<TParentRoute, TId, TCustomId, TFullPath, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn>;
190
+ isRoot: TParentRoute extends AnyRoute ? true : false;
191
+ _componentsPromise?: Promise<Array<void>>;
192
+ lazyFn?: () => Promise<LazyRoute<Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes>>>;
193
+ _lazyPromise?: Promise<void>;
194
+ rank: number;
195
+ to: TrimPathRight<TFullPath>;
196
+ init: (opts: {
197
+ originalIndex: number;
198
+ defaultSsr?: boolean;
199
+ }) => void;
200
+ update: (options: UpdatableRouteOptions<TParentRoute, TCustomId, TFullPath, TParams, TSearchValidator, TLoaderFn, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn>) => this;
201
+ lazy: RouteLazyFn<Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes>>;
202
+ addChildren: RouteAddChildrenFn<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TFileRouteTypes>;
203
+ _addFileChildren: RouteAddFileChildrenFn<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TFileRouteTypes>;
204
+ _addFileTypes: RouteAddFileTypesFn<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren>;
205
+ }
206
+ export type AnyRoute = Route<any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
207
+ export type AnyRouteWithContext<TContext> = AnyRoute & {
208
+ types: {
209
+ allContext: TContext;
210
+ };
211
+ };
212
+ export type RouteOptions<TParentRoute extends AnyRoute = AnyRoute, TId extends string = string, TCustomId extends string = string, TFullPath extends string = string, TPath extends string = string, TSearchValidator = undefined, TParams = AnyPathParams, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TRouterContext = {}, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext> = BaseRouteOptions<TParentRoute, TId, TCustomId, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn> & UpdatableRouteOptions<NoInfer<TParentRoute>, NoInfer<TCustomId>, NoInfer<TFullPath>, NoInfer<TParams>, NoInfer<TSearchValidator>, NoInfer<TLoaderFn>, NoInfer<TLoaderDeps>, NoInfer<TRouterContext>, NoInfer<TRouteContextFn>, NoInfer<TBeforeLoadFn>>;
213
+ export type RouteContextFn<in out TParentRoute extends AnyRoute, in out TSearchValidator, in out TParams, in out TRouterContext> = (ctx: RouteContextOptions<TParentRoute, TSearchValidator, TParams, TRouterContext>) => any;
214
+ export type BeforeLoadFn<in out TParentRoute extends AnyRoute, in out TSearchValidator, in out TParams, in out TRouterContext, in out TRouteContextFn> = (ctx: BeforeLoadContextOptions<TParentRoute, TSearchValidator, TParams, TRouterContext, TRouteContextFn>) => any;
215
+ export type FileBaseRouteOptions<TParentRoute extends AnyRoute = AnyRoute, TId extends string = string, TPath extends string = string, TSearchValidator = undefined, TParams = {}, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TRouterContext = {}, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TRemountDepsFn = AnyContext> = ParamsOptions<TPath, TParams> & {
216
+ validateSearch?: Constrain<TSearchValidator, AnyValidator, DefaultValidator>;
217
+ shouldReload?: boolean | ((match: LoaderFnContext<TParentRoute, TId, TParams, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn>) => any);
218
+ context?: Constrain<TRouteContextFn, (ctx: RouteContextOptions<TParentRoute, TParams, TRouterContext, TLoaderDeps>) => any>;
219
+ beforeLoad?: Constrain<TBeforeLoadFn, (ctx: BeforeLoadContextOptions<TParentRoute, TSearchValidator, TParams, TRouterContext, TRouteContextFn>) => any>;
220
+ loaderDeps?: (opts: FullSearchSchemaOption<TParentRoute, TSearchValidator>) => TLoaderDeps;
221
+ remountDeps?: Constrain<TRemountDepsFn, (opt: RemountDepsOptions<TId, FullSearchSchemaOption<TParentRoute, TSearchValidator>, Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>, TLoaderDeps>) => any>;
222
+ loader?: Constrain<TLoaderFn, (ctx: LoaderFnContext<TParentRoute, TId, TParams, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn>) => any>;
223
+ };
224
+ export type BaseRouteOptions<TParentRoute extends AnyRoute = AnyRoute, TId extends string = string, TCustomId extends string = string, TPath extends string = string, TSearchValidator = undefined, TParams = {}, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TRouterContext = {}, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext> = RoutePathOptions<TCustomId, TPath> & FileBaseRouteOptions<TParentRoute, TId, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn> & {
225
+ getParentRoute: () => TParentRoute;
226
+ };
227
+ export interface ContextOptions<in out TParentRoute extends AnyRoute, in out TParams> {
228
+ abortController: AbortController;
229
+ preload: boolean;
230
+ params: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>;
231
+ location: ParsedLocation;
232
+ /**
233
+ * @deprecated Use `throw redirect({ to: '/somewhere' })` instead
234
+ **/
235
+ navigate: NavigateFn;
236
+ buildLocation: BuildLocationFn;
237
+ cause: 'preload' | 'enter' | 'stay';
238
+ matches: Array<MakeRouteMatchUnion>;
239
+ }
240
+ export interface RouteContextOptions<in out TParentRoute extends AnyRoute, in out TParams, in out TRouterContext, in out TLoaderDeps> extends ContextOptions<TParentRoute, TParams> {
241
+ deps: TLoaderDeps;
242
+ context: Expand<RouteContextParameter<TParentRoute, TRouterContext>>;
243
+ }
244
+ export interface BeforeLoadContextOptions<in out TParentRoute extends AnyRoute, in out TSearchValidator, in out TParams, in out TRouterContext, in out TRouteContextFn> extends ContextOptions<TParentRoute, TParams>, FullSearchSchemaOption<TParentRoute, TSearchValidator> {
245
+ context: Expand<BeforeLoadContextParameter<TParentRoute, TRouterContext, TRouteContextFn>>;
246
+ }
247
+ type AssetFnContextOptions<in out TRouteId, in out TFullPath, in out TParentRoute extends AnyRoute, in out TParams, in out TSearchValidator, in out TLoaderFn, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn, in out TLoaderDeps> = {
248
+ matches: Array<RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>>;
249
+ match: RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>;
250
+ params: ResolveAllParamsFromParent<TParentRoute, TParams>;
251
+ loaderData?: ResolveLoaderData<TLoaderFn>;
252
+ };
253
+ export interface DefaultUpdatableRouteOptionsExtensions {
254
+ component?: unknown;
255
+ errorComponent?: unknown;
256
+ notFoundComponent?: unknown;
257
+ pendingComponent?: unknown;
258
+ }
259
+ export interface UpdatableRouteOptionsExtensions extends DefaultUpdatableRouteOptionsExtensions {
260
+ }
261
+ export interface UpdatableRouteOptions<in out TParentRoute extends AnyRoute, in out TRouteId, in out TFullPath, in out TParams, in out TSearchValidator, in out TLoaderFn, in out TLoaderDeps, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn> extends UpdatableStaticRouteOption, UpdatableRouteOptionsExtensions {
262
+ caseSensitive?: boolean;
263
+ wrapInSuspense?: boolean;
264
+ pendingMs?: number;
265
+ pendingMinMs?: number;
266
+ staleTime?: number;
267
+ gcTime?: number;
268
+ preload?: boolean;
269
+ preloadStaleTime?: number;
270
+ preloadGcTime?: number;
271
+ search?: {
272
+ middlewares?: Array<SearchMiddleware<ResolveFullSearchSchemaInput<TParentRoute, TSearchValidator>>>;
273
+ };
274
+ /**
275
+ @deprecated Use search.middlewares instead
276
+ */
277
+ preSearchFilters?: Array<SearchFilter<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>>;
278
+ /**
279
+ @deprecated Use search.middlewares instead
280
+ */
281
+ postSearchFilters?: Array<SearchFilter<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>>;
282
+ onCatch?: (error: Error) => void;
283
+ onError?: (err: any) => void;
284
+ onEnter?: (match: RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>) => void;
285
+ onStay?: (match: RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>) => void;
286
+ onLeave?: (match: RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>) => void;
287
+ headers?: (ctx: AssetFnContextOptions<TRouteId, TFullPath, TParentRoute, TParams, TSearchValidator, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps>) => Awaitable<Record<string, string>>;
288
+ head?: (ctx: AssetFnContextOptions<TRouteId, TFullPath, TParentRoute, TParams, TSearchValidator, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps>) => Awaitable<{
289
+ links?: AnyRouteMatch['links'];
290
+ scripts?: AnyRouteMatch['headScripts'];
291
+ meta?: AnyRouteMatch['meta'];
292
+ }>;
293
+ scripts?: (ctx: AssetFnContextOptions<TRouteId, TFullPath, TParentRoute, TParams, TSearchValidator, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps>) => Awaitable<AnyRouteMatch['scripts']>;
294
+ ssr?: boolean;
295
+ codeSplitGroupings?: Array<Array<'loader' | 'component' | 'pendingComponent' | 'notFoundComponent' | 'errorComponent'>>;
296
+ }
297
+ export type RouteLoaderFn<in out TParentRoute extends AnyRoute = AnyRoute, in out TId extends string = string, in out TParams = {}, in out TLoaderDeps = {}, in out TRouterContext = {}, in out TRouteContextFn = AnyContext, in out TBeforeLoadFn = AnyContext> = (match: LoaderFnContext<TParentRoute, TId, TParams, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn>) => any;
298
+ export interface LoaderFnContext<in out TParentRoute extends AnyRoute = AnyRoute, in out TId extends string = string, in out TParams = {}, in out TLoaderDeps = {}, in out TRouterContext = {}, in out TRouteContextFn = AnyContext, in out TBeforeLoadFn = AnyContext> {
299
+ abortController: AbortController;
300
+ preload: boolean;
301
+ params: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>;
302
+ deps: TLoaderDeps;
303
+ context: Expand<ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>>;
304
+ location: ParsedLocation;
305
+ /**
306
+ * @deprecated Use `throw redirect({ to: '/somewhere' })` instead
307
+ **/
308
+ navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void;
309
+ parentMatchPromise: TId extends RootRouteId ? never : Promise<MakeRouteMatchFromRoute<TParentRoute>>;
310
+ cause: 'preload' | 'enter' | 'stay';
311
+ route: AnyRoute;
312
+ }
313
+ export type RootRouteOptions<TSearchValidator = undefined, TRouterContext = {}, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined> = Omit<RouteOptions<any, // TParentRoute
314
+ RootRouteId, // TId
315
+ RootRouteId, // TCustomId
316
+ '', // TFullPath
317
+ '', // TPath
318
+ TSearchValidator, {}, // TParams
319
+ TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn>, 'path' | 'id' | 'getParentRoute' | 'caseSensitive' | 'parseParams' | 'stringifyParams' | 'params'>;
320
+ export type RouteConstraints = {
321
+ TParentRoute: AnyRoute;
322
+ TPath: string;
323
+ TFullPath: string;
324
+ TCustomId: string;
325
+ TId: string;
326
+ TSearchSchema: AnySchema;
327
+ TFullSearchSchema: AnySchema;
328
+ TParams: Record<string, any>;
329
+ TAllParams: Record<string, any>;
330
+ TParentContext: AnyContext;
331
+ TRouteContext: RouteContext;
332
+ TAllContext: AnyContext;
333
+ TRouterContext: AnyContext;
334
+ TChildren: unknown;
335
+ TRouteTree: AnyRoute;
336
+ };
337
+ export type RouteTypesById<TRouter extends AnyRouter, TId> = RouteById<TRouter['routeTree'], TId>['types'];
338
+ export type RouteMask<TRouteTree extends AnyRoute> = {
339
+ routeTree: TRouteTree;
340
+ from: RoutePaths<TRouteTree>;
341
+ to?: any;
342
+ params?: any;
343
+ search?: any;
344
+ hash?: any;
345
+ state?: any;
346
+ unmaskOnReload?: boolean;
347
+ };
348
+ /**
349
+ * @deprecated Use `ErrorComponentProps` instead.
350
+ */
351
+ export type ErrorRouteProps = {
352
+ error: unknown;
353
+ info?: {
354
+ componentStack: string;
355
+ };
356
+ reset: () => void;
357
+ };
358
+ export type ErrorComponentProps = {
359
+ error: Error;
360
+ info?: {
361
+ componentStack: string;
362
+ };
363
+ reset: () => void;
364
+ };
365
+ export type NotFoundRouteProps = {
366
+ data: unknown;
367
+ };
368
+ export declare class BaseRoute<in out TParentRoute extends AnyRoute = AnyRoute, in out TPath extends string = '/', in out TFullPath extends string = ResolveFullPath<TParentRoute, TPath>, in out TCustomId extends string = string, in out TId extends string = ResolveId<TParentRoute, TCustomId, TPath>, in out TSearchValidator = undefined, in out TParams = ResolveParams<TPath>, in out TRouterContext = AnyContext, in out TRouteContextFn = AnyContext, in out TBeforeLoadFn = AnyContext, in out TLoaderDeps extends Record<string, any> = {}, in out TLoaderFn = undefined, in out TChildren = unknown, in out TFileRouteTypes = unknown> {
369
+ isRoot: TParentRoute extends AnyRoute ? true : false;
370
+ options: RouteOptions<TParentRoute, TId, TCustomId, TFullPath, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn>;
371
+ parentRoute: TParentRoute;
372
+ private _id;
373
+ private _path;
374
+ private _fullPath;
375
+ private _to;
376
+ private _ssr;
377
+ get to(): TrimPathRight<TFullPath>;
378
+ get id(): TId;
379
+ get path(): TPath;
380
+ get fullPath(): TFullPath;
381
+ get ssr(): boolean;
382
+ children?: TChildren;
383
+ originalIndex?: number;
384
+ rank: number;
385
+ lazyFn?: () => Promise<LazyRoute<Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes>>>;
386
+ _lazyPromise?: Promise<void>;
387
+ _componentsPromise?: Promise<Array<void>>;
388
+ constructor(options?: RouteOptions<TParentRoute, TId, TCustomId, TFullPath, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn>);
389
+ types: RouteTypes<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes>;
390
+ init: (opts: {
391
+ originalIndex: number;
392
+ defaultSsr?: boolean;
393
+ }) => void;
394
+ clone: (other: typeof this) => void;
395
+ addChildren: RouteAddChildrenFn<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TFileRouteTypes>;
396
+ _addFileChildren: RouteAddFileChildrenFn<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TFileRouteTypes>;
397
+ _addFileTypes: RouteAddFileTypesFn<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren>;
398
+ updateLoader: <TNewLoaderFn>(options: {
399
+ loader: Constrain<TNewLoaderFn, RouteLoaderFn<TParentRoute, TCustomId, TParams, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn>>;
400
+ }) => BaseRoute<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TNewLoaderFn, TChildren, TFileRouteTypes>;
401
+ update: (options: UpdatableRouteOptions<TParentRoute, TCustomId, TFullPath, TParams, TSearchValidator, TLoaderFn, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn>) => this;
402
+ lazy: RouteLazyFn<Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes>>;
403
+ }
404
+ export declare class BaseRouteApi<TId, TRouter extends AnyRouter = RegisteredRouter> {
405
+ id: TId;
406
+ constructor({ id }: {
407
+ id: TId;
408
+ });
409
+ notFound: (opts?: NotFoundError) => NotFoundError;
410
+ }
411
+ export interface RootRoute<in out TSearchValidator = undefined, in out TRouterContext = {}, in out TRouteContextFn = AnyContext, in out TBeforeLoadFn = AnyContext, in out TLoaderDeps extends Record<string, any> = {}, in out TLoaderFn = undefined, in out TChildren = unknown, in out TFileRouteTypes = unknown> extends Route<any, // TParentRoute
412
+ '/', // TPath
413
+ '/', // TFullPath
414
+ string, // TCustomId
415
+ RootRouteId, // TId
416
+ TSearchValidator, // TSearchValidator
417
+ {}, // TParams
418
+ TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, // TChildren
419
+ TFileRouteTypes> {
420
+ }
421
+ export declare class BaseRootRoute<in out TSearchValidator = undefined, in out TRouterContext = {}, in out TRouteContextFn = AnyContext, in out TBeforeLoadFn = AnyContext, in out TLoaderDeps extends Record<string, any> = {}, in out TLoaderFn = undefined, in out TChildren = unknown, in out TFileRouteTypes = unknown> extends BaseRoute<any, // TParentRoute
422
+ '/', // TPath
423
+ '/', // TFullPath
424
+ string, // TCustomId
425
+ RootRouteId, // TId
426
+ TSearchValidator, // TSearchValidator
427
+ {}, // TParams
428
+ TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, // TChildren
429
+ TFileRouteTypes> {
430
+ constructor(options?: RootRouteOptions<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn>);
431
+ }
432
+ export {};
@@ -0,0 +1,54 @@
1
+ import { InferFileRouteTypes } from './fileRoute.cjs';
2
+ import { AddTrailingSlash, RemoveTrailingSlashes } from './link.cjs';
3
+ import { AnyRoute } from './route.cjs';
4
+ import { AnyRouter, TrailingSlashOption } from './router.cjs';
5
+ import { PartialMergeAll } from './utils.cjs';
6
+ export type ParseRoute<TRouteTree, TAcc = TRouteTree> = TRouteTree extends {
7
+ types: {
8
+ children: infer TChildren;
9
+ };
10
+ } ? unknown extends TChildren ? TAcc : TChildren extends ReadonlyArray<any> ? ParseRoute<TChildren[number], TAcc | TChildren[number]> : ParseRoute<TChildren[keyof TChildren], TAcc | TChildren[keyof TChildren]> : TAcc;
11
+ export type ParseRouteWithoutBranches<TRouteTree> = ParseRoute<TRouteTree> extends infer TRoute extends AnyRoute ? TRoute extends any ? unknown extends TRoute['types']['children'] ? TRoute : TRoute['types']['children'] extends ReadonlyArray<any> ? '/' extends TRoute['types']['children'][number]['path'] ? never : TRoute : '/' extends TRoute['types']['children'][keyof TRoute['types']['children']]['path'] ? never : TRoute : never : never;
12
+ export type CodeRoutesById<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? {
13
+ [K in TRoutes as K['id']]: K;
14
+ } : never;
15
+ export type RoutesById<TRouteTree extends AnyRoute> = InferFileRouteTypes<TRouteTree> extends never ? CodeRoutesById<TRouteTree> : InferFileRouteTypes<TRouteTree>['fileRoutesById'];
16
+ export type RouteById<TRouteTree extends AnyRoute, TId> = Extract<RoutesById<TRouteTree>[TId & keyof RoutesById<TRouteTree>], AnyRoute>;
17
+ export type CodeRouteIds<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? TRoutes['id'] : never;
18
+ export type RouteIds<TRouteTree extends AnyRoute> = InferFileRouteTypes<TRouteTree> extends never ? CodeRouteIds<TRouteTree> : InferFileRouteTypes<TRouteTree>['id'];
19
+ export type ParentPath<TRouter extends AnyRouter> = TrailingSlashOptionByRouter<TRouter> extends 'always' ? '../' : TrailingSlashOptionByRouter<TRouter> extends 'never' ? '..' : '../' | '..';
20
+ export type CurrentPath<TRouter extends AnyRouter> = TrailingSlashOptionByRouter<TRouter> extends 'always' ? './' : TrailingSlashOptionByRouter<TRouter> extends 'never' ? '.' : './' | '.';
21
+ export type ToPath<TRouter extends AnyRouter, TTo extends string> = TrailingSlashOptionByRouter<TRouter> extends 'always' ? AddTrailingSlash<TTo> : TrailingSlashOptionByRouter<TRouter> extends 'never' ? RemoveTrailingSlashes<TTo> : AddTrailingSlash<TTo> | RemoveTrailingSlashes<TTo>;
22
+ export type CatchAllPaths<TRouter extends AnyRouter> = CurrentPath<TRouter> | ParentPath<TRouter>;
23
+ export type CodeRoutesByPath<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? {
24
+ [K in TRoutes as K['fullPath']]: K;
25
+ } : never;
26
+ export type RoutesByPath<TRouteTree extends AnyRoute> = InferFileRouteTypes<TRouteTree> extends never ? CodeRoutesByPath<TRouteTree> : InferFileRouteTypes<TRouteTree>['fileRoutesByFullPath'];
27
+ export type RouteByPath<TRouteTree extends AnyRoute, TPath> = Extract<RoutesByPath<TRouteTree>[TPath & keyof RoutesByPath<TRouteTree>], AnyRoute>;
28
+ export type CodeRoutePaths<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? TRoutes['fullPath'] : never;
29
+ export type RoutePaths<TRouteTree extends AnyRoute> = unknown extends TRouteTree ? string : (InferFileRouteTypes<TRouteTree> extends never ? CodeRoutePaths<TRouteTree> : InferFileRouteTypes<TRouteTree>['fullPaths']) | '/';
30
+ export type RouteToPathAlwaysTrailingSlash<TRoute extends AnyRoute> = TRoute['path'] extends '/' ? TRoute['fullPath'] : TRoute['fullPath'] extends '/' ? TRoute['fullPath'] : `${TRoute['fullPath']}/`;
31
+ export type RouteToPathNeverTrailingSlash<TRoute extends AnyRoute> = TRoute['path'] extends '/' ? TRoute['fullPath'] extends '/' ? TRoute['fullPath'] : RemoveTrailingSlashes<TRoute['fullPath']> : TRoute['fullPath'];
32
+ export type RouteToPathPreserveTrailingSlash<TRoute extends AnyRoute> = RouteToPathNeverTrailingSlash<TRoute> | RouteToPathAlwaysTrailingSlash<TRoute>;
33
+ export type RouteToPathByTrailingSlashOption<TRoute extends AnyRoute> = {
34
+ always: RouteToPathAlwaysTrailingSlash<TRoute>;
35
+ preserve: RouteToPathPreserveTrailingSlash<TRoute>;
36
+ never: RouteToPathNeverTrailingSlash<TRoute>;
37
+ };
38
+ export type TrailingSlashOptionByRouter<TRouter extends AnyRouter> = TrailingSlashOption extends TRouter['options']['trailingSlash'] ? 'never' : NonNullable<TRouter['options']['trailingSlash']>;
39
+ export type RouteToByRouter<TRouter extends AnyRouter, TRoute extends AnyRoute> = RouteToPathByTrailingSlashOption<TRoute>[TrailingSlashOptionByRouter<TRouter>];
40
+ export type CodeRouteToPath<TRouter extends AnyRouter> = ParseRouteWithoutBranches<TRouter['routeTree']> extends infer TRoute extends AnyRoute ? TRoute extends any ? RouteToByRouter<TRouter, TRoute> : never : never;
41
+ export type FileRouteToPath<TRouter extends AnyRouter, TTo = InferFileRouteTypes<TRouter['routeTree']>['to'], TTrailingSlashOption = TrailingSlashOptionByRouter<TRouter>> = 'never' extends TTrailingSlashOption ? TTo : 'always' extends TTrailingSlashOption ? AddTrailingSlash<TTo> : TTo | AddTrailingSlash<TTo>;
42
+ export type RouteToPath<TRouter extends AnyRouter> = unknown extends TRouter ? string : InferFileRouteTypes<TRouter['routeTree']> extends never ? CodeRouteToPath<TRouter> : FileRouteToPath<TRouter>;
43
+ export type CodeRoutesByToPath<TRouter extends AnyRouter> = ParseRouteWithoutBranches<TRouter['routeTree']> extends infer TRoutes extends AnyRoute ? {
44
+ [TRoute in TRoutes as RouteToByRouter<TRouter, TRoute>]: TRoute;
45
+ } : never;
46
+ export type RoutesByToPath<TRouter extends AnyRouter> = InferFileRouteTypes<TRouter['routeTree']> extends never ? CodeRoutesByToPath<TRouter> : InferFileRouteTypes<TRouter['routeTree']>['fileRoutesByTo'];
47
+ export type CodeRouteByToPath<TRouter extends AnyRouter, TTo> = Extract<RoutesByToPath<TRouter>[TTo & keyof RoutesByToPath<TRouter>], AnyRoute>;
48
+ export type FileRouteByToPath<TRouter extends AnyRouter, TTo> = 'never' extends TrailingSlashOptionByRouter<TRouter> ? CodeRouteByToPath<TRouter, TTo> : 'always' extends TrailingSlashOptionByRouter<TRouter> ? TTo extends '/' ? CodeRouteByToPath<TRouter, TTo> : TTo extends `${infer TPath}/` ? CodeRouteByToPath<TRouter, TPath> : never : CodeRouteByToPath<TRouter, TTo extends '/' ? TTo : RemoveTrailingSlashes<TTo>>;
49
+ export type RouteByToPath<TRouter extends AnyRouter, TTo> = InferFileRouteTypes<TRouter['routeTree']> extends never ? CodeRouteByToPath<TRouter, TTo> : FileRouteByToPath<TRouter, TTo>;
50
+ export type FullSearchSchema<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? PartialMergeAll<TRoutes['types']['fullSearchSchema']> : never;
51
+ export type FullSearchSchemaInput<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? PartialMergeAll<TRoutes['types']['fullSearchSchemaInput']> : never;
52
+ export type AllParams<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? PartialMergeAll<TRoutes['types']['allParams']> : never;
53
+ export type AllContext<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? PartialMergeAll<TRoutes['types']['allContext']> : never;
54
+ export type AllLoaderData<TRouteTree extends AnyRoute> = ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute ? PartialMergeAll<TRoutes['types']['loaderData']> : never;