@tanstack/router-core 1.111.6 → 1.112.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.
- package/dist/cjs/Matches.cjs.map +1 -1
- package/dist/cjs/Matches.d.cts +51 -1
- package/dist/cjs/index.d.cts +3 -3
- package/dist/cjs/path.cjs +1 -1
- package/dist/cjs/path.cjs.map +1 -1
- package/dist/cjs/route.d.cts +117 -4
- package/dist/cjs/serializer.d.cts +1 -1
- package/dist/cjs/typePrimitives.d.cts +0 -0
- package/dist/esm/Matches.d.ts +51 -1
- package/dist/esm/Matches.js.map +1 -1
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/path.js +1 -1
- package/dist/esm/path.js.map +1 -1
- package/dist/esm/route.d.ts +117 -4
- package/dist/esm/serializer.d.ts +1 -1
- package/dist/esm/typePrimitives.d.ts +0 -0
- package/package.json +1 -1
- package/src/Matches.ts +114 -1
- package/src/index.ts +20 -0
- package/src/path.ts +6 -1
- package/src/route.ts +530 -3
- package/src/serializer.ts +1 -7
- package/src/typePrimitives.ts +0 -0
package/dist/esm/route.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { ParsePathParams } from './link.js';
|
|
1
|
+
import { NavigateOptions, ParsePathParams } from './link.js';
|
|
2
|
+
import { ParsedLocation } from './location.js';
|
|
3
|
+
import { AnyRouteMatch, MakeRouteMatchFromRoute, MakeRouteMatchUnion, RouteMatch } from './Matches.js';
|
|
2
4
|
import { RootRouteId } from './root.js';
|
|
3
5
|
import { ParseRoute } from './routeInfo.js';
|
|
4
|
-
import { RegisteredRouter } from './router.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
6
|
+
import { AnyRouter, RegisteredRouter } from './router.js';
|
|
7
|
+
import { BuildLocationFn, NavigateFn } from './RouterProvider.js';
|
|
8
|
+
import { Assign, Constrain, Expand, IntersectAssign, NoInfer } from './utils.js';
|
|
9
|
+
import { AnySchema, AnyStandardSchemaValidator, AnyValidator, AnyValidatorAdapter, AnyValidatorObj, DefaultValidator, ResolveSearchValidatorInput, ResolveValidatorOutput, StandardSchemaValidator, ValidatorAdapter, ValidatorFn, ValidatorObj } from './validators.js';
|
|
7
10
|
export type AnyPathParams = {};
|
|
8
11
|
export type SearchSchemaInput = {
|
|
9
12
|
__TSearchSchemaInput__: 'TSearchSchemaInput';
|
|
@@ -190,6 +193,116 @@ export type AnyRouteWithContext<TContext> = AnyRoute & {
|
|
|
190
193
|
allContext: TContext;
|
|
191
194
|
};
|
|
192
195
|
};
|
|
196
|
+
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>>;
|
|
197
|
+
export type RouteContextFn<in out TParentRoute extends AnyRoute, in out TSearchValidator, in out TParams, in out TRouterContext> = (ctx: RouteContextOptions<TParentRoute, TSearchValidator, TParams, TRouterContext>) => any;
|
|
198
|
+
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;
|
|
199
|
+
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> & {
|
|
200
|
+
validateSearch?: Constrain<TSearchValidator, AnyValidator, DefaultValidator>;
|
|
201
|
+
shouldReload?: boolean | ((match: LoaderFnContext<TParentRoute, TId, TParams, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn>) => any);
|
|
202
|
+
context?: Constrain<TRouteContextFn, (ctx: RouteContextOptions<TParentRoute, TParams, TRouterContext, TLoaderDeps>) => any>;
|
|
203
|
+
beforeLoad?: Constrain<TBeforeLoadFn, (ctx: BeforeLoadContextOptions<TParentRoute, TSearchValidator, TParams, TRouterContext, TRouteContextFn>) => any>;
|
|
204
|
+
loaderDeps?: (opts: FullSearchSchemaOption<TParentRoute, TSearchValidator>) => TLoaderDeps;
|
|
205
|
+
remountDeps?: Constrain<TRemountDepsFn, (opt: RemountDepsOptions<TId, FullSearchSchemaOption<TParentRoute, TSearchValidator>, Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>, TLoaderDeps>) => any>;
|
|
206
|
+
loader?: Constrain<TLoaderFn, (ctx: LoaderFnContext<TParentRoute, TId, TParams, TLoaderDeps, TRouterContext, TRouteContextFn, TBeforeLoadFn>) => any>;
|
|
207
|
+
};
|
|
208
|
+
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> & {
|
|
209
|
+
getParentRoute: () => TParentRoute;
|
|
210
|
+
};
|
|
211
|
+
export interface ContextOptions<in out TParentRoute extends AnyRoute, in out TParams> {
|
|
212
|
+
abortController: AbortController;
|
|
213
|
+
preload: boolean;
|
|
214
|
+
params: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>;
|
|
215
|
+
location: ParsedLocation;
|
|
216
|
+
/**
|
|
217
|
+
* @deprecated Use `throw redirect({ to: '/somewhere' })` instead
|
|
218
|
+
**/
|
|
219
|
+
navigate: NavigateFn;
|
|
220
|
+
buildLocation: BuildLocationFn;
|
|
221
|
+
cause: 'preload' | 'enter' | 'stay';
|
|
222
|
+
matches: Array<MakeRouteMatchUnion>;
|
|
223
|
+
}
|
|
224
|
+
export interface RouteContextOptions<in out TParentRoute extends AnyRoute, in out TParams, in out TRouterContext, in out TLoaderDeps> extends ContextOptions<TParentRoute, TParams> {
|
|
225
|
+
deps: TLoaderDeps;
|
|
226
|
+
context: Expand<RouteContextParameter<TParentRoute, TRouterContext>>;
|
|
227
|
+
}
|
|
228
|
+
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> {
|
|
229
|
+
context: Expand<BeforeLoadContextParameter<TParentRoute, TRouterContext, TRouteContextFn>>;
|
|
230
|
+
}
|
|
231
|
+
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> = {
|
|
232
|
+
matches: Array<RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>>;
|
|
233
|
+
match: RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>;
|
|
234
|
+
params: ResolveAllParamsFromParent<TParentRoute, TParams>;
|
|
235
|
+
loaderData: ResolveLoaderData<TLoaderFn>;
|
|
236
|
+
};
|
|
237
|
+
export interface DefaultUpdatableRouteOptionsExtensions {
|
|
238
|
+
component?: unknown;
|
|
239
|
+
errorComponent?: unknown;
|
|
240
|
+
notFoundComponent?: unknown;
|
|
241
|
+
pendingComponent?: unknown;
|
|
242
|
+
}
|
|
243
|
+
export interface UpdatableRouteOptionsExtensions {
|
|
244
|
+
}
|
|
245
|
+
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 {
|
|
246
|
+
caseSensitive?: boolean;
|
|
247
|
+
wrapInSuspense?: boolean;
|
|
248
|
+
pendingMs?: number;
|
|
249
|
+
pendingMinMs?: number;
|
|
250
|
+
staleTime?: number;
|
|
251
|
+
gcTime?: number;
|
|
252
|
+
preload?: boolean;
|
|
253
|
+
preloadStaleTime?: number;
|
|
254
|
+
preloadGcTime?: number;
|
|
255
|
+
search?: {
|
|
256
|
+
middlewares?: Array<SearchMiddleware<ResolveFullSearchSchemaInput<TParentRoute, TSearchValidator>>>;
|
|
257
|
+
};
|
|
258
|
+
/**
|
|
259
|
+
@deprecated Use search.middlewares instead
|
|
260
|
+
*/
|
|
261
|
+
preSearchFilters?: Array<SearchFilter<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>>;
|
|
262
|
+
/**
|
|
263
|
+
@deprecated Use search.middlewares instead
|
|
264
|
+
*/
|
|
265
|
+
postSearchFilters?: Array<SearchFilter<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>>;
|
|
266
|
+
onCatch?: (error: Error) => void;
|
|
267
|
+
onError?: (err: any) => void;
|
|
268
|
+
onEnter?: (match: RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>) => void;
|
|
269
|
+
onStay?: (match: RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>) => void;
|
|
270
|
+
onLeave?: (match: RouteMatch<TRouteId, TFullPath, ResolveAllParamsFromParent<TParentRoute, TParams>, ResolveFullSearchSchema<TParentRoute, TSearchValidator>, ResolveLoaderData<TLoaderFn>, ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>, TLoaderDeps>) => void;
|
|
271
|
+
headers?: (ctx: {
|
|
272
|
+
loaderData: ResolveLoaderData<TLoaderFn>;
|
|
273
|
+
}) => Record<string, string>;
|
|
274
|
+
head?: (ctx: AssetFnContextOptions<TRouteId, TFullPath, TParentRoute, TParams, TSearchValidator, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps>) => {
|
|
275
|
+
links?: AnyRouteMatch['links'];
|
|
276
|
+
scripts?: AnyRouteMatch['headScripts'];
|
|
277
|
+
meta?: AnyRouteMatch['meta'];
|
|
278
|
+
};
|
|
279
|
+
scripts?: (ctx: AssetFnContextOptions<TRouteId, TFullPath, TParentRoute, TParams, TSearchValidator, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps>) => AnyRouteMatch['scripts'];
|
|
280
|
+
ssr?: boolean;
|
|
281
|
+
codeSplitGroupings?: Array<Array<'loader' | 'component' | 'pendingComponent' | 'notFoundComponent' | 'errorComponent'>>;
|
|
282
|
+
}
|
|
283
|
+
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;
|
|
284
|
+
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> {
|
|
285
|
+
abortController: AbortController;
|
|
286
|
+
preload: boolean;
|
|
287
|
+
params: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>;
|
|
288
|
+
deps: TLoaderDeps;
|
|
289
|
+
context: Expand<ResolveAllContext<TParentRoute, TRouterContext, TRouteContextFn, TBeforeLoadFn>>;
|
|
290
|
+
location: ParsedLocation;
|
|
291
|
+
/**
|
|
292
|
+
* @deprecated Use `throw redirect({ to: '/somewhere' })` instead
|
|
293
|
+
**/
|
|
294
|
+
navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void;
|
|
295
|
+
parentMatchPromise: TId extends RootRouteId ? never : Promise<MakeRouteMatchFromRoute<TParentRoute>>;
|
|
296
|
+
cause: 'preload' | 'enter' | 'stay';
|
|
297
|
+
route: AnyRoute;
|
|
298
|
+
}
|
|
299
|
+
export type RootRouteOptions<TSearchValidator = undefined, TRouterContext = {}, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined> = Omit<RouteOptions<any, // TParentRoute
|
|
300
|
+
RootRouteId, // TId
|
|
301
|
+
RootRouteId, // TCustomId
|
|
302
|
+
'', // TFullPath
|
|
303
|
+
'', // TPath
|
|
304
|
+
TSearchValidator, {}, // TParams
|
|
305
|
+
TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn>, 'path' | 'id' | 'getParentRoute' | 'caseSensitive' | 'parseParams' | 'stringifyParams' | 'params'>;
|
|
193
306
|
/**
|
|
194
307
|
* @deprecated Use `ErrorComponentProps` instead.
|
|
195
308
|
*/
|
package/dist/esm/serializer.d.ts
CHANGED
|
@@ -10,6 +10,6 @@ export type SerializerStringifyBy<T, TSerializable> = T extends TSerializable ?
|
|
|
10
10
|
export type SerializerParseBy<T, TSerializable> = T extends TSerializable ? T : T extends React.JSX.Element ? ReadableStream : {
|
|
11
11
|
[K in keyof T]: SerializerParseBy<T[K], TSerializable>;
|
|
12
12
|
};
|
|
13
|
-
export type Serializable = Date | undefined | Error | FormData |
|
|
13
|
+
export type Serializable = Date | undefined | Error | FormData | bigint;
|
|
14
14
|
export type SerializerStringify<T> = SerializerStringifyBy<T, Serializable>;
|
|
15
15
|
export type SerializerParse<T> = SerializerParseBy<T, Serializable>;
|
|
File without changes
|
package/package.json
CHANGED
package/src/Matches.ts
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AnyRoute, StaticDataRouteOption } from './route'
|
|
2
|
+
import type {
|
|
3
|
+
AllContext,
|
|
4
|
+
AllLoaderData,
|
|
5
|
+
AllParams,
|
|
6
|
+
FullSearchSchema,
|
|
7
|
+
ParseRoute,
|
|
8
|
+
RouteById,
|
|
9
|
+
RouteIds,
|
|
10
|
+
} from './routeInfo'
|
|
11
|
+
import type { AnyRouter, RegisteredRouter } from './router'
|
|
12
|
+
import type { Constrain, ControlledPromise } from './utils'
|
|
2
13
|
|
|
3
14
|
export type AnyMatchAndValue = { match: any; value: any }
|
|
4
15
|
|
|
@@ -92,3 +103,105 @@ export const isMatch = <TMatch, TPath extends string>(
|
|
|
92
103
|
|
|
93
104
|
return value != null
|
|
94
105
|
}
|
|
106
|
+
|
|
107
|
+
export interface DefaultRouteMatchExtensions {
|
|
108
|
+
scripts?: unknown
|
|
109
|
+
links?: unknown
|
|
110
|
+
headScripts?: unknown
|
|
111
|
+
meta?: unknown
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface RouteMatchExtensions extends DefaultRouteMatchExtensions {}
|
|
115
|
+
|
|
116
|
+
export interface RouteMatch<
|
|
117
|
+
out TRouteId,
|
|
118
|
+
out TFullPath,
|
|
119
|
+
out TAllParams,
|
|
120
|
+
out TFullSearchSchema,
|
|
121
|
+
out TLoaderData,
|
|
122
|
+
out TAllContext,
|
|
123
|
+
out TLoaderDeps,
|
|
124
|
+
> extends RouteMatchExtensions {
|
|
125
|
+
id: string
|
|
126
|
+
routeId: TRouteId
|
|
127
|
+
fullPath: TFullPath
|
|
128
|
+
index: number
|
|
129
|
+
pathname: string
|
|
130
|
+
params: TAllParams
|
|
131
|
+
_strictParams: TAllParams
|
|
132
|
+
status: 'pending' | 'success' | 'error' | 'redirected' | 'notFound'
|
|
133
|
+
isFetching: false | 'beforeLoad' | 'loader'
|
|
134
|
+
error: unknown
|
|
135
|
+
paramsError: unknown
|
|
136
|
+
searchError: unknown
|
|
137
|
+
updatedAt: number
|
|
138
|
+
loadPromise?: ControlledPromise<void>
|
|
139
|
+
beforeLoadPromise?: ControlledPromise<void>
|
|
140
|
+
loaderPromise?: ControlledPromise<void>
|
|
141
|
+
loaderData?: TLoaderData
|
|
142
|
+
__routeContext: Record<string, unknown>
|
|
143
|
+
__beforeLoadContext: Record<string, unknown>
|
|
144
|
+
context: TAllContext
|
|
145
|
+
search: TFullSearchSchema
|
|
146
|
+
_strictSearch: TFullSearchSchema
|
|
147
|
+
fetchCount: number
|
|
148
|
+
abortController: AbortController
|
|
149
|
+
cause: 'preload' | 'enter' | 'stay'
|
|
150
|
+
loaderDeps: TLoaderDeps
|
|
151
|
+
preload: boolean
|
|
152
|
+
invalid: boolean
|
|
153
|
+
headers?: Record<string, string>
|
|
154
|
+
globalNotFound?: boolean
|
|
155
|
+
staticData: StaticDataRouteOption
|
|
156
|
+
minPendingPromise?: ControlledPromise<void>
|
|
157
|
+
pendingTimeout?: ReturnType<typeof setTimeout>
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export type MakeRouteMatchFromRoute<TRoute extends AnyRoute> = RouteMatch<
|
|
161
|
+
TRoute['types']['id'],
|
|
162
|
+
TRoute['types']['fullPath'],
|
|
163
|
+
TRoute['types']['allParams'],
|
|
164
|
+
TRoute['types']['fullSearchSchema'],
|
|
165
|
+
TRoute['types']['loaderData'],
|
|
166
|
+
TRoute['types']['allContext'],
|
|
167
|
+
TRoute['types']['loaderDeps']
|
|
168
|
+
>
|
|
169
|
+
|
|
170
|
+
export type MakeRouteMatch<
|
|
171
|
+
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
172
|
+
TRouteId = RouteIds<TRouteTree>,
|
|
173
|
+
TStrict extends boolean = true,
|
|
174
|
+
> = RouteMatch<
|
|
175
|
+
TRouteId,
|
|
176
|
+
RouteById<TRouteTree, TRouteId>['types']['fullPath'],
|
|
177
|
+
TStrict extends false
|
|
178
|
+
? AllParams<TRouteTree>
|
|
179
|
+
: RouteById<TRouteTree, TRouteId>['types']['allParams'],
|
|
180
|
+
TStrict extends false
|
|
181
|
+
? FullSearchSchema<TRouteTree>
|
|
182
|
+
: RouteById<TRouteTree, TRouteId>['types']['fullSearchSchema'],
|
|
183
|
+
TStrict extends false
|
|
184
|
+
? AllLoaderData<TRouteTree>
|
|
185
|
+
: RouteById<TRouteTree, TRouteId>['types']['loaderData'],
|
|
186
|
+
TStrict extends false
|
|
187
|
+
? AllContext<TRouteTree>
|
|
188
|
+
: RouteById<TRouteTree, TRouteId>['types']['allContext'],
|
|
189
|
+
RouteById<TRouteTree, TRouteId>['types']['loaderDeps']
|
|
190
|
+
>
|
|
191
|
+
|
|
192
|
+
export type AnyRouteMatch = RouteMatch<any, any, any, any, any, any, any>
|
|
193
|
+
|
|
194
|
+
export type MakeRouteMatchUnion<
|
|
195
|
+
TRouter extends AnyRouter = RegisteredRouter,
|
|
196
|
+
TRoute extends AnyRoute = ParseRoute<TRouter['routeTree']>,
|
|
197
|
+
> = TRoute extends any
|
|
198
|
+
? RouteMatch<
|
|
199
|
+
TRoute['id'],
|
|
200
|
+
TRoute['fullPath'],
|
|
201
|
+
TRoute['types']['allParams'],
|
|
202
|
+
TRoute['types']['fullSearchSchema'],
|
|
203
|
+
TRoute['types']['loaderData'],
|
|
204
|
+
TRoute['types']['allContext'],
|
|
205
|
+
TRoute['types']['loaderDeps']
|
|
206
|
+
>
|
|
207
|
+
: never
|
package/src/index.ts
CHANGED
|
@@ -85,6 +85,12 @@ export type {
|
|
|
85
85
|
IsMatchResult,
|
|
86
86
|
IsMatchParse,
|
|
87
87
|
IsMatch,
|
|
88
|
+
RouteMatch,
|
|
89
|
+
RouteMatchExtensions,
|
|
90
|
+
MakeRouteMatchUnion,
|
|
91
|
+
MakeRouteMatch,
|
|
92
|
+
AnyRouteMatch,
|
|
93
|
+
MakeRouteMatchFromRoute,
|
|
88
94
|
} from './Matches'
|
|
89
95
|
export {
|
|
90
96
|
joinPaths,
|
|
@@ -167,6 +173,19 @@ export type {
|
|
|
167
173
|
MakeRemountDepsOptionsUnion,
|
|
168
174
|
ResolveFullPath,
|
|
169
175
|
AnyRouteWithContext,
|
|
176
|
+
RouteOptions,
|
|
177
|
+
FileBaseRouteOptions,
|
|
178
|
+
BaseRouteOptions,
|
|
179
|
+
UpdatableRouteOptions,
|
|
180
|
+
RouteLoaderFn,
|
|
181
|
+
LoaderFnContext,
|
|
182
|
+
RouteContextFn,
|
|
183
|
+
RouteContextOptions,
|
|
184
|
+
BeforeLoadFn,
|
|
185
|
+
BeforeLoadContextOptions,
|
|
186
|
+
ContextOptions,
|
|
187
|
+
RootRouteOptions,
|
|
188
|
+
UpdatableRouteOptionsExtensions,
|
|
170
189
|
} from './route'
|
|
171
190
|
|
|
172
191
|
export { defaultSerializeError, getLocationChangeInfo } from './router'
|
|
@@ -181,6 +200,7 @@ export type {
|
|
|
181
200
|
Register,
|
|
182
201
|
AnyRouter,
|
|
183
202
|
AnyRouterWithContext,
|
|
203
|
+
RegisteredRouter,
|
|
184
204
|
} from './router'
|
|
185
205
|
|
|
186
206
|
export type {
|
package/src/path.ts
CHANGED
|
@@ -183,7 +183,12 @@ export function parsePathname(pathname?: string): Array<Segment> {
|
|
|
183
183
|
|
|
184
184
|
return {
|
|
185
185
|
type: 'pathname',
|
|
186
|
-
value:
|
|
186
|
+
value: part.includes('%25')
|
|
187
|
+
? part
|
|
188
|
+
.split('%25')
|
|
189
|
+
.map((segment) => decodeURI(segment))
|
|
190
|
+
.join('%25')
|
|
191
|
+
: decodeURI(part),
|
|
187
192
|
}
|
|
188
193
|
}),
|
|
189
194
|
)
|