@tanstack/router-core 0.0.1-beta.24 → 0.0.1-beta.26
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/build/cjs/packages/router-core/src/path.js +2 -2
- package/build/cjs/packages/router-core/src/path.js.map +1 -1
- package/build/cjs/packages/router-core/src/routeConfig.js +5 -2
- package/build/cjs/packages/router-core/src/routeConfig.js.map +1 -1
- package/build/cjs/packages/router-core/src/routeMatch.js.map +1 -1
- package/build/cjs/packages/router-core/src/router.js.map +1 -1
- package/build/cjs/packages/router-core/src/utils.js.map +1 -1
- package/build/esm/index.js +6 -4
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +136 -130
- package/build/types/index.d.ts +22 -23
- package/build/umd/index.development.js +6 -4
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/frameworks.ts +1 -0
- package/src/link.ts +2 -2
- package/src/path.ts +2 -2
- package/src/routeConfig.ts +72 -54
- package/src/routeInfo.ts +11 -6
- package/src/routeMatch.ts +3 -3
- package/src/router.ts +1 -1
- package/src/utils.ts +2 -2
package/build/types/index.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ interface RouteMatch<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo
|
|
|
35
35
|
invalidAt: number;
|
|
36
36
|
__: {
|
|
37
37
|
component?: GetFrameworkGeneric<'Component'>;
|
|
38
|
-
errorComponent?: GetFrameworkGeneric<'
|
|
38
|
+
errorComponent?: GetFrameworkGeneric<'ErrorComponent'>;
|
|
39
39
|
pendingComponent?: GetFrameworkGeneric<'Component'>;
|
|
40
40
|
loadPromise?: Promise<void>;
|
|
41
41
|
componentsPromise?: Promise<void>;
|
|
@@ -95,7 +95,7 @@ type ValueKeys<O> = Extract<keyof O, PropertyKey>;
|
|
|
95
95
|
type DeepAwaited<T> = T extends Promise<infer A> ? DeepAwaited<A> : T extends Record<infer A, Promise<infer B>> ? {
|
|
96
96
|
[K in A]: DeepAwaited<B>;
|
|
97
97
|
} : T;
|
|
98
|
-
type PathParamMask<TRoutePath extends string> = TRoutePath extends `${infer L}
|
|
98
|
+
type PathParamMask<TRoutePath extends string> = TRoutePath extends `${infer L}/$${infer C}/${infer R}` ? PathParamMask<`${L}/${string}/${R}`> : TRoutePath extends `${infer L}/$${infer C}` ? PathParamMask<`${L}/${string}`> : TRoutePath;
|
|
99
99
|
type Timeout = ReturnType<typeof setTimeout>;
|
|
100
100
|
type Updater<TPrevious, TResult = TPrevious> = TResult | ((prev?: TPrevious) => TResult);
|
|
101
101
|
type PickExtract<T, U> = {
|
|
@@ -145,7 +145,7 @@ interface RouterOptions<TRouteConfig extends AnyRouteConfig> {
|
|
|
145
145
|
defaultPreloadGcMaxAge?: number;
|
|
146
146
|
defaultPreloadDelay?: number;
|
|
147
147
|
defaultComponent?: GetFrameworkGeneric<'Component'>;
|
|
148
|
-
defaultErrorComponent?: GetFrameworkGeneric<'
|
|
148
|
+
defaultErrorComponent?: GetFrameworkGeneric<'ErrorComponent'>;
|
|
149
149
|
defaultPendingComponent?: GetFrameworkGeneric<'Component'>;
|
|
150
150
|
defaultLoaderMaxAge?: number;
|
|
151
151
|
defaultLoaderGcMaxAge?: number;
|
|
@@ -367,8 +367,8 @@ type ParseRouteChildren<TRouteConfig> = TRouteConfig extends AnyRouteConfigWithC
|
|
|
367
367
|
type ParseRouteChild<TRouteConfig, TId> = TRouteConfig & {
|
|
368
368
|
id: TId;
|
|
369
369
|
} extends AnyRouteConfig ? ParseRouteConfig<TRouteConfig> : never;
|
|
370
|
-
type RouteConfigRoute<TRouteConfig> = TRouteConfig extends RouteConfig<infer TId, infer TRouteId, infer TPath, infer TFullPath, infer
|
|
371
|
-
interface RoutesInfoInner<TRouteConfig extends AnyRouteConfig, TRouteInfo extends RouteInfo<string, string, any, any, any, any, any, any, any, any, any, any, any, any, any> = RouteInfo, TRouteInfoById = {
|
|
370
|
+
type RouteConfigRoute<TRouteConfig> = TRouteConfig extends RouteConfig<infer TId, infer TRouteId, infer TPath, infer TFullPath, infer TParentRouteLoaderData, infer TRouteLoaderData, infer TParentLoaderData, infer TLoaderData, infer TActionPayload, infer TActionResponse, infer TParentSearchSchema, infer TSearchSchema, infer TFullSearchSchema, infer TParentParams, infer TParams, infer TAllParams, any> ? string extends TRouteId ? never : RouteInfo<TId, TRouteId, TPath, TFullPath, TParentRouteLoaderData, TRouteLoaderData, TParentLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams> : never;
|
|
371
|
+
interface RoutesInfoInner<TRouteConfig extends AnyRouteConfig, TRouteInfo extends RouteInfo<string, string, any, any, any, any, any, any, any, any, any, any, any, any, any, any> = RouteInfo, TRouteInfoById = {
|
|
372
372
|
'/': TRouteInfo;
|
|
373
373
|
} & {
|
|
374
374
|
[TInfo in TRouteInfo as TInfo['id']]: TInfo;
|
|
@@ -385,15 +385,16 @@ interface RoutesInfoInner<TRouteConfig extends AnyRouteConfig, TRouteInfo extend
|
|
|
385
385
|
routePaths: keyof TRouteInfoByFullPath;
|
|
386
386
|
fullSearchSchema: Partial<UnionToIntersection<TRouteInfo['fullSearchSchema']>>;
|
|
387
387
|
}
|
|
388
|
-
interface AnyRouteInfo extends RouteInfo<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any> {
|
|
388
|
+
interface AnyRouteInfo extends RouteInfo<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any> {
|
|
389
389
|
}
|
|
390
|
-
interface RouteInfo<TId extends string = string, TRouteId extends string = string, TPath extends string = string, TFullPath extends string = string, TParentRouteLoaderData extends AnyLoaderData = {}, TRouteLoaderData extends AnyLoaderData = {}, TLoaderData extends AnyLoaderData = {}, TActionPayload = unknown, TActionResponse = unknown, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = {}, TParentParams extends AnyPathParams = {}, TParams extends
|
|
390
|
+
interface RouteInfo<TId extends string = string, TRouteId extends string = string, TPath extends string = string, TFullPath extends string = string, TParentRouteLoaderData extends AnyLoaderData = {}, TRouteLoaderData extends AnyLoaderData = {}, TParentLoaderData extends AnyLoaderData = {}, TLoaderData extends AnyLoaderData = {}, TActionPayload = unknown, TActionResponse = unknown, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = {}, TParentParams extends AnyPathParams = {}, TParams extends AnyPathParams = {}, TAllParams extends AnyPathParams = {}> {
|
|
391
391
|
id: TId;
|
|
392
392
|
routeId: TRouteId;
|
|
393
393
|
path: TPath;
|
|
394
394
|
fullPath: TFullPath;
|
|
395
395
|
parentRouteLoaderData: TParentRouteLoaderData;
|
|
396
396
|
routeLoaderData: TRouteLoaderData;
|
|
397
|
+
parentLoaderData: TParentLoaderData;
|
|
397
398
|
loaderData: TLoaderData;
|
|
398
399
|
actionPayload: TActionPayload;
|
|
399
400
|
actionResponse: TActionResponse;
|
|
@@ -402,7 +403,7 @@ interface RouteInfo<TId extends string = string, TRouteId extends string = strin
|
|
|
402
403
|
parentParams: TParentParams;
|
|
403
404
|
params: TParams;
|
|
404
405
|
allParams: TAllParams;
|
|
405
|
-
options: RouteOptions<TRouteId, TPath, TParentRouteLoaderData, TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams>;
|
|
406
|
+
options: RouteOptions<TRouteId, TPath, TParentRouteLoaderData, TRouteLoaderData, TParentLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams>;
|
|
406
407
|
}
|
|
407
408
|
type RoutesById<TAllRouteInfo extends AnyAllRouteInfo> = {
|
|
408
409
|
[K in keyof TAllRouteInfo['routeInfoById']]: Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][K]>;
|
|
@@ -429,7 +430,7 @@ type DefinedPathParamWarning = 'Path params cannot be redefined by child routes!
|
|
|
429
430
|
type ParentParams<TParentParams> = AnyPathParams extends TParentParams ? {} : {
|
|
430
431
|
[Key in keyof TParentParams]?: DefinedPathParamWarning;
|
|
431
432
|
};
|
|
432
|
-
type LoaderFn<TRouteLoaderData extends AnyLoaderData = {}, TFullSearchSchema extends AnySearchSchema = {}, TAllParams extends AnyPathParams = {}> = (loaderContext: LoaderContext<TFullSearchSchema, TAllParams>) => Promise<TRouteLoaderData>;
|
|
433
|
+
type LoaderFn<TRouteLoaderData extends AnyLoaderData = {}, TFullSearchSchema extends AnySearchSchema = {}, TAllParams extends AnyPathParams = {}> = (loaderContext: LoaderContext<TFullSearchSchema, TAllParams>) => TRouteLoaderData | Promise<TRouteLoaderData>;
|
|
433
434
|
interface LoaderContext<TFullSearchSchema extends AnySearchSchema = {}, TAllParams extends AnyPathParams = {}> {
|
|
434
435
|
params: TAllParams;
|
|
435
436
|
search: TFullSearchSchema;
|
|
@@ -437,7 +438,7 @@ interface LoaderContext<TFullSearchSchema extends AnySearchSchema = {}, TAllPara
|
|
|
437
438
|
}
|
|
438
439
|
type ActionFn<TActionPayload = unknown, TActionResponse = unknown> = (submission: TActionPayload) => TActionResponse | Promise<TActionResponse>;
|
|
439
440
|
type UnloaderFn<TPath extends string> = (routeMatch: RouteMatch<any, RouteInfo<string, TPath>>) => void;
|
|
440
|
-
type RouteOptions<TRouteId extends string = string, TPath extends string = string, TParentRouteLoaderData extends AnyLoaderData = {}, TRouteLoaderData extends AnyLoaderData = {}, TLoaderData extends AnyLoaderData = {}, TActionPayload = unknown, TActionResponse = unknown, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = TSearchSchema, TParentParams extends AnyPathParams = {}, TParams extends Record<ParsePathParams<TPath>, unknown> = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams = {}> = ({
|
|
441
|
+
type RouteOptions<TRouteId extends string = string, TPath extends string = string, TParentRouteLoaderData extends AnyLoaderData = {}, TRouteLoaderData extends AnyLoaderData = {}, TParentLoaderData extends AnyLoaderData = {}, TLoaderData extends AnyLoaderData = {}, TActionPayload = unknown, TActionResponse = unknown, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = TSearchSchema, TParentParams extends AnyPathParams = {}, TParams extends Record<ParsePathParams<TPath>, unknown> = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams = {}> = ({
|
|
441
442
|
path: TPath;
|
|
442
443
|
} | {
|
|
443
444
|
id: TRouteId;
|
|
@@ -447,7 +448,7 @@ type RouteOptions<TRouteId extends string = string, TPath extends string = strin
|
|
|
447
448
|
preSearchFilters?: SearchFilter<TFullSearchSchema>[];
|
|
448
449
|
postSearchFilters?: SearchFilter<TFullSearchSchema>[];
|
|
449
450
|
component?: GetFrameworkGeneric<'Component'>;
|
|
450
|
-
errorComponent?: GetFrameworkGeneric<'
|
|
451
|
+
errorComponent?: GetFrameworkGeneric<'ErrorComponent'>;
|
|
451
452
|
pendingComponent?: GetFrameworkGeneric<'Component'>;
|
|
452
453
|
loader?: LoaderFn<TRouteLoaderData, TFullSearchSchema, TAllParams>;
|
|
453
454
|
loaderMaxAge?: number;
|
|
@@ -476,31 +477,29 @@ type RouteOptions<TRouteId extends string = string, TPath extends string = strin
|
|
|
476
477
|
stringifyParams: (params: TParams) => Record<ParsePathParams<TPath>, string>;
|
|
477
478
|
}) & (PickUnsafe<TParentParams, ParsePathParams<TPath>> extends never ? {} : 'Cannot redefined path params in child routes!');
|
|
478
479
|
type SearchFilter<T, U = T> = (prev: T) => U;
|
|
479
|
-
interface RouteConfig<TId extends string = string, TRouteId extends string = string, TPath extends string = string, TFullPath extends string = string, TParentRouteLoaderData extends AnyLoaderData = AnyLoaderData, TRouteLoaderData extends AnyLoaderData = AnyLoaderData, TLoaderData extends AnyLoaderData = AnyLoaderData, TActionPayload = unknown, TActionResponse = unknown, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = {}, TParentParams extends AnyPathParams = {}, TParams extends
|
|
480
|
+
interface RouteConfig<TId extends string = string, TRouteId extends string = string, TPath extends string = string, TFullPath extends string = string, TParentRouteLoaderData extends AnyLoaderData = AnyLoaderData, TRouteLoaderData extends AnyLoaderData = AnyLoaderData, TParentLoaderData extends AnyLoaderData = {}, TLoaderData extends AnyLoaderData = AnyLoaderData, TActionPayload = unknown, TActionResponse = unknown, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = {}, TParentParams extends AnyPathParams = {}, TParams extends AnyPathParams = {}, TAllParams extends AnyPathParams = {}, TKnownChildren = unknown> {
|
|
480
481
|
id: TId;
|
|
481
482
|
routeId: TRouteId;
|
|
482
483
|
path: NoInfer<TPath>;
|
|
483
484
|
fullPath: TFullPath;
|
|
484
|
-
options: RouteOptions<TRouteId, TPath, TParentRouteLoaderData, TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams>;
|
|
485
|
+
options: RouteOptions<TRouteId, TPath, TParentRouteLoaderData, TRouteLoaderData, TParentLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams>;
|
|
485
486
|
children?: TKnownChildren;
|
|
486
487
|
addChildren: IsAny<TId, any, <TNewChildren extends any>(children: TNewChildren extends AnyRouteConfig[] ? TNewChildren : {
|
|
487
488
|
error: 'Invalid route detected';
|
|
488
489
|
route: TNewChildren;
|
|
489
|
-
}) => RouteConfig<TId, TRouteId, TPath, TFullPath, TParentRouteLoaderData, TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams, TNewChildren>>;
|
|
490
|
-
createChildren: IsAny<TId, any, <TNewChildren extends any>(cb: (createChildRoute: CreateRouteConfigFn<false, TId, TFullPath, TRouteLoaderData, TLoaderData, TFullSearchSchema, TAllParams>) => TNewChildren extends AnyRouteConfig[] ? TNewChildren : {
|
|
491
|
-
error: 'Invalid route detected';
|
|
492
|
-
route: TNewChildren;
|
|
493
|
-
}) => RouteConfig<TId, TRouteId, TPath, TFullPath, TParentRouteLoaderData, TRouteLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams, TNewChildren>>;
|
|
490
|
+
}) => RouteConfig<TId, TRouteId, TPath, TFullPath, TParentRouteLoaderData, TRouteLoaderData, TParentLoaderData, TLoaderData, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, TFullSearchSchema, TParentParams, TParams, TAllParams, TNewChildren>>;
|
|
494
491
|
createRoute: CreateRouteConfigFn<false, TId, TFullPath, TRouteLoaderData, TLoaderData, TFullSearchSchema, TAllParams>;
|
|
492
|
+
generate: GenerateFn<TRouteId, TPath, TParentRouteLoaderData, TParentLoaderData, TParentSearchSchema, TParentParams>;
|
|
495
493
|
}
|
|
496
|
-
type
|
|
494
|
+
type GenerateFn<TRouteId extends string = string, TPath extends string = string, TParentRouteLoaderData extends AnyLoaderData = AnyLoaderData, TParentLoaderData extends AnyLoaderData = {}, TParentSearchSchema extends {} = {}, TParentParams extends AnyPathParams = {}> = <TRouteLoaderData extends AnyLoaderData = AnyLoaderData, TActionPayload = unknown, TActionResponse = unknown, TSearchSchema extends AnySearchSchema = {}, TParams extends Record<ParsePathParams<TPath>, unknown> = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams extends TParams ? Record<ParsePathParams<TPath>, string> : NoInfer<TParams> = AnyPathParams extends TParams ? Record<ParsePathParams<TPath>, string> : NoInfer<TParams>>(options: Omit<RouteOptions<TRouteId, TPath, TParentRouteLoaderData, TRouteLoaderData, TParentLoaderData, Expand<TParentLoaderData & NoInfer<TRouteLoaderData>>, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, Expand<TParentSearchSchema & TSearchSchema>, TParentParams, TParams, Expand<TParentParams & TAllParams>>, 'path'>) => void;
|
|
495
|
+
type CreateRouteConfigFn<TIsRoot extends boolean = false, TParentId extends string = string, TParentPath extends string = string, TParentRouteLoaderData extends AnyLoaderData = {}, TParentLoaderData extends AnyLoaderData = {}, TParentSearchSchema extends AnySearchSchema = {}, TParentParams extends AnyPathParams = {}> = <TRouteId extends string, TPath extends string, TRouteLoaderData extends AnyLoaderData, TActionPayload, TActionResponse, TSearchSchema extends AnySearchSchema = AnySearchSchema, TParams extends Record<ParsePathParams<TPath>, unknown> = Record<ParsePathParams<TPath>, string>, TAllParams extends AnyPathParams extends TParams ? Record<ParsePathParams<TPath>, string> : NoInfer<TParams> = AnyPathParams extends TParams ? Record<ParsePathParams<TPath>, string> : NoInfer<TParams>, TKnownChildren extends RouteConfig[] = RouteConfig[], TResolvedId extends string = string extends TRouteId ? string extends TPath ? string : TPath : TRouteId>(options?: TIsRoot extends true ? Omit<RouteOptions<TRouteId, TPath, TParentRouteLoaderData, TRouteLoaderData, TParentLoaderData, Expand<TParentLoaderData & NoInfer<TRouteLoaderData>>, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, Expand<TParentSearchSchema & TSearchSchema>, TParentParams, TParams, Expand<TParentParams & TAllParams>>, 'path'> & {
|
|
497
496
|
path?: never;
|
|
498
|
-
} : RouteOptions<TRouteId, TPath, TParentRouteLoaderData, TRouteLoaderData, Expand<TParentLoaderData &
|
|
497
|
+
} : RouteOptions<TRouteId, TPath, TParentRouteLoaderData, TRouteLoaderData, TParentLoaderData, Expand<TParentLoaderData & NoInfer<TRouteLoaderData>>, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, Expand<TParentSearchSchema & TSearchSchema>, TParentParams, TParams, Expand<TParentParams & TAllParams>>, children?: TKnownChildren, isRoot?: boolean, parentId?: string, parentPath?: string) => RouteConfig<RoutePrefix<TParentId, TResolvedId>, TResolvedId, TPath, string extends TPath ? '' : RoutePath<RoutePrefix<TParentPath, TPath>>, TParentRouteLoaderData, TRouteLoaderData, TParentLoaderData, Expand<TParentLoaderData & NoInfer<TRouteLoaderData>>, TActionPayload, TActionResponse, TParentSearchSchema, TSearchSchema, Expand<TParentSearchSchema & TSearchSchema>, TParentParams, TParams, Expand<TParentParams & TAllParams>, TKnownChildren>;
|
|
499
498
|
type RoutePath<T extends string> = T extends RootRouteId ? '/' : TrimPathRight<`${T}`>;
|
|
500
499
|
type RoutePrefix<TPrefix extends string, TId extends string> = string extends TId ? RootRouteId : TId extends string ? `${TPrefix}/${TId}` extends '/' ? '/' : `/${TrimPathLeft<`${TrimPathRight<TPrefix>}/${TrimPath<TId>}`>}` : never;
|
|
501
|
-
interface AnyRouteConfig extends RouteConfig<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any> {
|
|
500
|
+
interface AnyRouteConfig extends RouteConfig<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any> {
|
|
502
501
|
}
|
|
503
|
-
interface AnyRouteConfigWithChildren<TChildren> extends RouteConfig<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, TChildren> {
|
|
502
|
+
interface AnyRouteConfigWithChildren<TChildren> extends RouteConfig<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, TChildren> {
|
|
504
503
|
}
|
|
505
504
|
type TrimPath<T extends string> = '' extends T ? '' : TrimPathRight<TrimPathLeft<T>>;
|
|
506
505
|
type TrimPathLeft<T extends string> = T extends `${RootRouteId}/${infer U}` ? TrimPathLeft<U> : T extends `/${infer U}` ? TrimPathLeft<U> : T;
|
|
@@ -523,7 +522,7 @@ type LinkInfo = {
|
|
|
523
522
|
type StartsWith<A, B> = A extends `${B extends string ? B : never}${infer _}` ? true : false;
|
|
524
523
|
type CleanPath<T extends string> = T extends `${infer L}//${infer R}` ? CleanPath<`${CleanPath<L>}/${CleanPath<R>}`> : T extends `${infer L}//` ? `${CleanPath<L>}/` : T extends `//${infer L}` ? `/${CleanPath<L>}` : T;
|
|
525
524
|
type Split<S, TIncludeTrailingSlash = true> = S extends unknown ? string extends S ? string[] : S extends string ? CleanPath<S> extends '' ? [] : TIncludeTrailingSlash extends true ? CleanPath<S> extends `${infer T}/` ? [...Split<T>, '/'] : CleanPath<S> extends `/${infer U}` ? Split<U> : CleanPath<S> extends `${infer T}/${infer U}` ? [...Split<T>, ...Split<U>] : [S] : CleanPath<S> extends `${infer T}/${infer U}` ? [...Split<T>, ...Split<U>] : S extends string ? [S] : never : never : never;
|
|
526
|
-
type ParsePathParams<T extends string> = Split<T>[number] extends infer U ? U extends
|
|
525
|
+
type ParsePathParams<T extends string> = Split<T>[number] extends infer U ? U extends `$${infer V}` ? V : never : never;
|
|
527
526
|
type Join<T> = T extends [] ? '' : T extends [infer L extends string] ? L : T extends [infer L extends string, ...infer Tail extends [...string[]]] ? CleanPath<`${L}/${Join<Tail>}`> : never;
|
|
528
527
|
type RelativeToPathAutoComplete<AllPaths extends string, TFrom extends string, TTo extends string, SplitPaths extends string[] = Split<AllPaths, false>> = TTo extends `..${infer _}` ? SplitPaths extends [
|
|
529
528
|
...Split<ResolveRelativePath<TFrom, TTo>, false>,
|
|
@@ -1009,7 +1009,7 @@
|
|
|
1009
1009
|
};
|
|
1010
1010
|
}
|
|
1011
1011
|
|
|
1012
|
-
if (part.charAt(0) === '
|
|
1012
|
+
if (part.charAt(0) === '$') {
|
|
1013
1013
|
return {
|
|
1014
1014
|
type: 'param',
|
|
1015
1015
|
value: part
|
|
@@ -1106,7 +1106,7 @@
|
|
|
1106
1106
|
return false;
|
|
1107
1107
|
}
|
|
1108
1108
|
|
|
1109
|
-
if (
|
|
1109
|
+
if (baseSegment.value.charAt(0) !== '$') {
|
|
1110
1110
|
params[routeSegment.value.substring(1)] = baseSegment.value;
|
|
1111
1111
|
}
|
|
1112
1112
|
}
|
|
@@ -1368,9 +1368,11 @@
|
|
|
1368
1368
|
fullPath: fullPath,
|
|
1369
1369
|
options: options,
|
|
1370
1370
|
children,
|
|
1371
|
-
createChildren: cb => createRouteConfig(options, cb(childOptions => createRouteConfig(childOptions, undefined, false, id, fullPath)), false, parentId, parentPath),
|
|
1372
1371
|
addChildren: children => createRouteConfig(options, children, false, parentId, parentPath),
|
|
1373
|
-
createRoute: childOptions => createRouteConfig(childOptions, undefined, false, id, fullPath)
|
|
1372
|
+
createRoute: childOptions => createRouteConfig(childOptions, undefined, false, id, fullPath),
|
|
1373
|
+
generate: () => {
|
|
1374
|
+
invariant(false, "routeConfig.generate() is used by TanStack Router's file-based routing code generation and should not actually be called during runtime. ");
|
|
1375
|
+
}
|
|
1374
1376
|
};
|
|
1375
1377
|
};
|
|
1376
1378
|
|