@tanstack/router-core 0.0.1-beta.193 → 0.0.1-beta.194
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/fileRoute.js.map +1 -1
- package/build/cjs/route.js.map +1 -1
- package/build/cjs/router.js +1 -1
- package/build/cjs/router.js.map +1 -1
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/index.js +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +124 -124
- package/build/types/fileRoute.d.ts +3 -2
- package/build/types/route.d.ts +43 -17
- package/build/types/routeInfo.d.ts +1 -1
- package/build/types/utils.d.ts +1 -1
- package/build/umd/index.development.js +1 -1
- 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/fileRoute.ts +9 -9
- package/src/route.ts +49 -74
- package/src/routeInfo.ts +0 -2
- package/src/router.ts +1 -1
- package/src/utils.ts +1 -1
package/package.json
CHANGED
package/src/fileRoute.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
TrimPathLeft,
|
|
16
16
|
RouteConstraints,
|
|
17
17
|
} from './route'
|
|
18
|
+
import { DeepMergeAll, Expand, IsAny } from './utils'
|
|
18
19
|
|
|
19
20
|
export interface FileRoutesByPath {
|
|
20
21
|
// '/': {
|
|
@@ -99,12 +100,15 @@ export class FileRoute<
|
|
|
99
100
|
TParentRoute['types']['allParams'],
|
|
100
101
|
TParams
|
|
101
102
|
>,
|
|
102
|
-
TParentContext extends RouteConstraints['TParentContext'] = TParentRoute['types']['routeContext'],
|
|
103
|
-
TAllParentContext extends RouteConstraints['TAllParentContext'] = TParentRoute['types']['context'],
|
|
104
103
|
TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext,
|
|
105
|
-
TContext extends RouteConstraints['TAllContext'] =
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
TContext extends RouteConstraints['TAllContext'] = Expand<
|
|
105
|
+
DeepMergeAll<
|
|
106
|
+
[
|
|
107
|
+
IsAny<TParentRoute['types']['context'], {}>,
|
|
108
|
+
TLoaderContext,
|
|
109
|
+
TRouteContext,
|
|
110
|
+
]
|
|
111
|
+
>
|
|
108
112
|
>,
|
|
109
113
|
TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,
|
|
110
114
|
TChildren extends RouteConstraints['TChildren'] = unknown,
|
|
@@ -121,8 +125,6 @@ export class FileRoute<
|
|
|
121
125
|
TFullSearchSchema,
|
|
122
126
|
TParams,
|
|
123
127
|
TAllParams,
|
|
124
|
-
TParentContext,
|
|
125
|
-
TAllParentContext,
|
|
126
128
|
TRouteContext,
|
|
127
129
|
TContext
|
|
128
130
|
>,
|
|
@@ -148,8 +150,6 @@ export class FileRoute<
|
|
|
148
150
|
TFullSearchSchema,
|
|
149
151
|
TParams,
|
|
150
152
|
TAllParams,
|
|
151
|
-
TParentContext,
|
|
152
|
-
TAllParentContext,
|
|
153
153
|
TRouteContext,
|
|
154
154
|
TContext,
|
|
155
155
|
TRouterContext,
|
package/src/route.ts
CHANGED
|
@@ -206,8 +206,6 @@ export type RouteOptions<
|
|
|
206
206
|
TFullSearchSchema extends Record<string, any> = TSearchSchema,
|
|
207
207
|
TParams extends AnyPathParams = AnyPathParams,
|
|
208
208
|
TAllParams extends AnyPathParams = TParams,
|
|
209
|
-
TParentContext extends Record<string, any> = AnyContext,
|
|
210
|
-
TAllParentContext extends Record<string, any> = AnyContext,
|
|
211
209
|
TRouteContext extends RouteContext = RouteContext,
|
|
212
210
|
TAllContext extends Record<string, any> = AnyContext,
|
|
213
211
|
> = BaseRouteOptions<
|
|
@@ -220,8 +218,6 @@ export type RouteOptions<
|
|
|
220
218
|
TFullSearchSchema,
|
|
221
219
|
TParams,
|
|
222
220
|
TAllParams,
|
|
223
|
-
TParentContext,
|
|
224
|
-
TAllParentContext,
|
|
225
221
|
TRouteContext,
|
|
226
222
|
TAllContext
|
|
227
223
|
> &
|
|
@@ -253,8 +249,6 @@ export type BaseRouteOptions<
|
|
|
253
249
|
TFullSearchSchema extends Record<string, any> = TSearchSchema,
|
|
254
250
|
TParams extends AnyPathParams = {},
|
|
255
251
|
TAllParams = ParamsFallback<TPath, TParams>,
|
|
256
|
-
TParentContext extends Record<string, any> = AnyContext,
|
|
257
|
-
TAllParentContext extends Record<string, any> = AnyContext,
|
|
258
252
|
TRouteContext extends RouteContext = RouteContext,
|
|
259
253
|
TAllContext extends Record<string, any> = AnyContext,
|
|
260
254
|
> = RoutePathOptions<TCustomId, TPath> & {
|
|
@@ -270,7 +264,6 @@ export type BaseRouteOptions<
|
|
|
270
264
|
beforeLoad?: BeforeLoadFn<
|
|
271
265
|
TParentRoute,
|
|
272
266
|
TAllParams,
|
|
273
|
-
TAllParentContext,
|
|
274
267
|
NoInfer<TLoaderContext>,
|
|
275
268
|
TRouteContext
|
|
276
269
|
>
|
|
@@ -279,7 +272,6 @@ export type BaseRouteOptions<
|
|
|
279
272
|
beforeLoad: BeforeLoadFn<
|
|
280
273
|
TParentRoute,
|
|
281
274
|
TAllParams,
|
|
282
|
-
TAllParentContext,
|
|
283
275
|
NoInfer<TLoaderContext>,
|
|
284
276
|
TRouteContext
|
|
285
277
|
>
|
|
@@ -315,16 +307,15 @@ export type BaseRouteOptions<
|
|
|
315
307
|
)
|
|
316
308
|
|
|
317
309
|
type BeforeLoadFn<
|
|
318
|
-
TParentRoute,
|
|
310
|
+
TParentRoute extends AnyRoute,
|
|
319
311
|
TAllParams,
|
|
320
|
-
TParentContext,
|
|
321
312
|
TLoaderContext,
|
|
322
313
|
TRouteContext,
|
|
323
314
|
> = (opts: {
|
|
324
315
|
abortController: AbortController
|
|
325
316
|
preload: boolean
|
|
326
317
|
params: TAllParams
|
|
327
|
-
context: Expand<
|
|
318
|
+
context: Expand<TParentRoute['types']['context'] & TLoaderContext>
|
|
328
319
|
}) => Promise<TRouteContext> | TRouteContext | void
|
|
329
320
|
|
|
330
321
|
export type UpdatableRouteOptions<
|
|
@@ -489,8 +480,6 @@ export interface AnyRoute
|
|
|
489
480
|
any,
|
|
490
481
|
any,
|
|
491
482
|
any,
|
|
492
|
-
any,
|
|
493
|
-
any,
|
|
494
483
|
any
|
|
495
484
|
> {}
|
|
496
485
|
|
|
@@ -535,7 +524,6 @@ export type RouteConstraints = {
|
|
|
535
524
|
TParams: Record<string, any>
|
|
536
525
|
TAllParams: Record<string, any>
|
|
537
526
|
TParentContext: AnyContext
|
|
538
|
-
TAllParentContext: AnyContext
|
|
539
527
|
TRouteContext: RouteContext
|
|
540
528
|
TAllContext: AnyContext
|
|
541
529
|
TRouterContext: AnyContext
|
|
@@ -556,7 +544,7 @@ export class Route<
|
|
|
556
544
|
TCustomId,
|
|
557
545
|
TPath
|
|
558
546
|
>,
|
|
559
|
-
TLoaderContext extends RouteConstraints['TLoaderContext'] =
|
|
547
|
+
TLoaderContext extends RouteConstraints['TLoaderContext'] = {},
|
|
560
548
|
TLoader = unknown,
|
|
561
549
|
TSearchSchema extends RouteConstraints['TSearchSchema'] = {},
|
|
562
550
|
TFullSearchSchema extends RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<
|
|
@@ -570,12 +558,15 @@ export class Route<
|
|
|
570
558
|
TParentRoute,
|
|
571
559
|
TParams
|
|
572
560
|
>,
|
|
573
|
-
TParentContext extends RouteConstraints['TParentContext'] = TParentRoute['types']['routeContext'],
|
|
574
|
-
TAllParentContext extends RouteConstraints['TAllParentContext'] = TParentRoute['types']['context'],
|
|
575
561
|
TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext,
|
|
576
|
-
TAllContext extends RouteConstraints['TAllContext'] =
|
|
577
|
-
|
|
578
|
-
|
|
562
|
+
TAllContext extends RouteConstraints['TAllContext'] = Expand<
|
|
563
|
+
DeepMergeAll<
|
|
564
|
+
[
|
|
565
|
+
IsAny<TParentRoute['types']['context'], {}>,
|
|
566
|
+
TLoaderContext,
|
|
567
|
+
TRouteContext,
|
|
568
|
+
]
|
|
569
|
+
>
|
|
579
570
|
>,
|
|
580
571
|
TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,
|
|
581
572
|
TChildren extends RouteConstraints['TChildren'] = unknown,
|
|
@@ -593,8 +584,6 @@ export class Route<
|
|
|
593
584
|
fullSearchSchema: TFullSearchSchema
|
|
594
585
|
params: TParams
|
|
595
586
|
allParams: TAllParams
|
|
596
|
-
parentContext: TParentContext
|
|
597
|
-
allParentContext: TAllParentContext
|
|
598
587
|
routeContext: TRouteContext
|
|
599
588
|
context: TAllContext
|
|
600
589
|
children: TChildren
|
|
@@ -612,8 +601,6 @@ export class Route<
|
|
|
612
601
|
TFullSearchSchema,
|
|
613
602
|
TParams,
|
|
614
603
|
TAllParams,
|
|
615
|
-
TParentContext,
|
|
616
|
-
TAllParentContext,
|
|
617
604
|
TRouteContext,
|
|
618
605
|
TAllContext
|
|
619
606
|
>
|
|
@@ -643,8 +630,6 @@ export class Route<
|
|
|
643
630
|
TFullSearchSchema,
|
|
644
631
|
TParams,
|
|
645
632
|
TAllParams,
|
|
646
|
-
TParentContext,
|
|
647
|
-
TAllParentContext,
|
|
648
633
|
TRouteContext,
|
|
649
634
|
TAllContext
|
|
650
635
|
> &
|
|
@@ -676,8 +661,6 @@ export class Route<
|
|
|
676
661
|
TFullSearchSchema,
|
|
677
662
|
TParams,
|
|
678
663
|
TAllParams,
|
|
679
|
-
TParentContext,
|
|
680
|
-
TAllParentContext,
|
|
681
664
|
TRouteContext,
|
|
682
665
|
TAllContext
|
|
683
666
|
> &
|
|
@@ -747,8 +730,6 @@ export class Route<
|
|
|
747
730
|
TFullSearchSchema,
|
|
748
731
|
TParams,
|
|
749
732
|
TAllParams,
|
|
750
|
-
TParentContext,
|
|
751
|
-
TAllParentContext,
|
|
752
733
|
TRouteContext,
|
|
753
734
|
TAllContext,
|
|
754
735
|
TRouterContext,
|
|
@@ -792,19 +773,17 @@ export class RouterContext<TRouterContext extends {}> {
|
|
|
792
773
|
>(
|
|
793
774
|
options?: Omit<
|
|
794
775
|
RouteOptions<
|
|
795
|
-
AnyRoute,
|
|
796
|
-
RootRouteId,
|
|
797
|
-
'',
|
|
798
|
-
TLoaderContext,
|
|
799
|
-
TLoader,
|
|
800
|
-
TSearchSchema,
|
|
801
|
-
TSearchSchema,
|
|
802
|
-
{},
|
|
803
|
-
{},
|
|
804
|
-
|
|
805
|
-
TRouterContext,
|
|
806
|
-
TRouteContext,
|
|
807
|
-
MergeFromFromParent<TRouterContext, TRouteContext>
|
|
776
|
+
AnyRoute, // TParentRoute
|
|
777
|
+
RootRouteId, // TCustomId
|
|
778
|
+
'', // TPath
|
|
779
|
+
TLoaderContext, // TLoaderContext
|
|
780
|
+
TLoader, // TLoader
|
|
781
|
+
TSearchSchema, // TSearchSchema
|
|
782
|
+
TSearchSchema, // TFullSearchSchema
|
|
783
|
+
{}, // TParams
|
|
784
|
+
{}, // TAllParams
|
|
785
|
+
TRouteContext, // TRouteContext
|
|
786
|
+
DeepMergeAll<[TRouterContext, TLoaderContext, TRouteContext]> // TAllContext
|
|
808
787
|
>,
|
|
809
788
|
| 'path'
|
|
810
789
|
| 'id'
|
|
@@ -831,41 +810,37 @@ export class RootRoute<
|
|
|
831
810
|
TRouteContext extends RouteContext = RouteContext,
|
|
832
811
|
TRouterContext extends {} = {},
|
|
833
812
|
> extends Route<
|
|
834
|
-
any,
|
|
835
|
-
'/',
|
|
836
|
-
'/',
|
|
837
|
-
string,
|
|
838
|
-
RootRouteId,
|
|
839
|
-
TLoaderContext,
|
|
840
|
-
TLoader,
|
|
841
|
-
TSearchSchema,
|
|
842
|
-
TSearchSchema,
|
|
843
|
-
{},
|
|
844
|
-
{},
|
|
845
|
-
|
|
846
|
-
TRouterContext,
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
any,
|
|
851
|
-
any
|
|
813
|
+
any, // TParentRoute
|
|
814
|
+
'/', // TPath
|
|
815
|
+
'/', // TFullPath
|
|
816
|
+
string, // TCustomId
|
|
817
|
+
RootRouteId, // TId
|
|
818
|
+
TLoaderContext, // TLoaderContext
|
|
819
|
+
TLoader, // TLoader
|
|
820
|
+
TSearchSchema, // TSearchSchema
|
|
821
|
+
TSearchSchema, // TFullSearchSchema
|
|
822
|
+
{}, // TParams
|
|
823
|
+
{}, // TAllParams
|
|
824
|
+
TRouteContext, // TRouteContext
|
|
825
|
+
DeepMergeAll<[TRouterContext, TLoaderContext, TRouteContext]>, // TAllContext
|
|
826
|
+
TRouterContext, // TRouterContext
|
|
827
|
+
any, // TChildren
|
|
828
|
+
any // TRouteTree
|
|
852
829
|
> {
|
|
853
830
|
constructor(
|
|
854
831
|
options?: Omit<
|
|
855
832
|
RouteOptions<
|
|
856
|
-
AnyRoute,
|
|
857
|
-
RootRouteId,
|
|
858
|
-
'',
|
|
859
|
-
TLoaderContext,
|
|
860
|
-
TLoader,
|
|
861
|
-
TSearchSchema,
|
|
862
|
-
TSearchSchema,
|
|
863
|
-
{},
|
|
864
|
-
{},
|
|
865
|
-
|
|
866
|
-
TRouterContext,
|
|
867
|
-
TRouteContext,
|
|
868
|
-
MergeFromFromParent<TRouterContext, TRouteContext>
|
|
833
|
+
AnyRoute, // TParentRoute
|
|
834
|
+
RootRouteId, // TCustomId
|
|
835
|
+
'', // TPath
|
|
836
|
+
TLoaderContext, // TLoaderContext
|
|
837
|
+
TLoader, // TLoader
|
|
838
|
+
TSearchSchema, // TSearchSchema
|
|
839
|
+
TSearchSchema, // TFullSearchSchema
|
|
840
|
+
{}, // TParams
|
|
841
|
+
{}, // TAllParams
|
|
842
|
+
TRouteContext, // TRouteContext
|
|
843
|
+
DeepMergeAll<[TRouterContext, TLoaderContext, TRouteContext]> // TAllContext
|
|
869
844
|
>,
|
|
870
845
|
| 'path'
|
|
871
846
|
| 'id'
|
package/src/routeInfo.ts
CHANGED
package/src/router.ts
CHANGED
package/src/utils.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type NoInfer<T> = [T][T extends any ? 0 : never]
|
|
2
|
-
export type IsAny<T, Y, N> = 1 extends 0 & T ? Y : N
|
|
2
|
+
export type IsAny<T, Y, N = T> = 1 extends 0 & T ? Y : N
|
|
3
3
|
export type IsAnyBoolean<T> = 1 extends 0 & T ? true : false
|
|
4
4
|
export type IsKnown<T, Y, N> = unknown extends T ? N : Y
|
|
5
5
|
export type PickAsRequired<T, K extends keyof T> = Omit<T, K> &
|