@tanstack/react-router 1.1.12 → 1.2.1
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/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +361 -361
- package/build/types/fileRoute.d.ts +2 -2
- package/build/types/route.d.ts +12 -12
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/fileRoute.ts +4 -3
- package/src/route.ts +21 -5
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-router",
|
|
3
3
|
"author": "Tanner Linsley",
|
|
4
|
-
"version": "1.1
|
|
4
|
+
"version": "1.2.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "tanstack/router",
|
|
7
7
|
"homepage": "https://tanstack.com/router",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@tanstack/store": "^0.1.3",
|
|
45
45
|
"tiny-invariant": "^1.3.1",
|
|
46
46
|
"tiny-warning": "^1.0.3",
|
|
47
|
-
"@tanstack/history": "1.1
|
|
47
|
+
"@tanstack/history": "1.2.1"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "rollup --config rollup.config.js"
|
package/src/fileRoute.ts
CHANGED
|
@@ -132,7 +132,7 @@ export class FileRoute<
|
|
|
132
132
|
] extends [never]
|
|
133
133
|
? RouteContext
|
|
134
134
|
: TRouteContextReturn,
|
|
135
|
-
|
|
135
|
+
TAllContext extends Expand<
|
|
136
136
|
Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>
|
|
137
137
|
> = Expand<
|
|
138
138
|
Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>
|
|
@@ -157,7 +157,8 @@ export class FileRoute<
|
|
|
157
157
|
TAllParams,
|
|
158
158
|
TRouteContextReturn,
|
|
159
159
|
TRouteContext,
|
|
160
|
-
|
|
160
|
+
TRouterContext,
|
|
161
|
+
TAllContext,
|
|
161
162
|
TLoaderDeps,
|
|
162
163
|
TLoaderData
|
|
163
164
|
>,
|
|
@@ -179,7 +180,7 @@ export class FileRoute<
|
|
|
179
180
|
TAllParams,
|
|
180
181
|
TRouteContextReturn,
|
|
181
182
|
TRouteContext,
|
|
182
|
-
|
|
183
|
+
TAllContext,
|
|
183
184
|
TRouterContext,
|
|
184
185
|
TLoaderDeps,
|
|
185
186
|
TLoaderData,
|
package/src/route.ts
CHANGED
|
@@ -69,6 +69,7 @@ export type RouteOptions<
|
|
|
69
69
|
TAllParams extends AnyPathParams = TParams,
|
|
70
70
|
TRouteContextReturn extends RouteContext = RouteContext,
|
|
71
71
|
TRouteContext extends RouteContext = RouteContext,
|
|
72
|
+
TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,
|
|
72
73
|
TAllContext extends Record<string, any> = AnyContext,
|
|
73
74
|
TLoaderDeps extends Record<string, any> = {},
|
|
74
75
|
TLoaderData extends any = unknown,
|
|
@@ -85,6 +86,7 @@ export type RouteOptions<
|
|
|
85
86
|
TAllParams,
|
|
86
87
|
TRouteContextReturn,
|
|
87
88
|
TRouteContext,
|
|
89
|
+
TRouterContext,
|
|
88
90
|
TAllContext,
|
|
89
91
|
TLoaderDeps,
|
|
90
92
|
TLoaderData
|
|
@@ -109,6 +111,7 @@ export type BaseRouteOptions<
|
|
|
109
111
|
TAllParams = ParamsFallback<TPath, TParams>,
|
|
110
112
|
TRouteContextReturn extends RouteContext = RouteContext,
|
|
111
113
|
TRouteContext extends RouteContext = RouteContext,
|
|
114
|
+
TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,
|
|
112
115
|
TAllContext extends Record<string, any> = AnyContext,
|
|
113
116
|
TLoaderDeps extends Record<string, any> = {},
|
|
114
117
|
TLoaderData extends any = unknown,
|
|
@@ -134,7 +137,8 @@ export type BaseRouteOptions<
|
|
|
134
137
|
TFullSearchSchema,
|
|
135
138
|
TParentRoute,
|
|
136
139
|
TAllParams,
|
|
137
|
-
TRouteContextReturn
|
|
140
|
+
TRouteContextReturn,
|
|
141
|
+
TRouterContext
|
|
138
142
|
>
|
|
139
143
|
} & {
|
|
140
144
|
loaderDeps?: (opts: { search: TFullSearchSchema }) => TLoaderDeps
|
|
@@ -168,12 +172,14 @@ type BeforeLoadFn<
|
|
|
168
172
|
TParentRoute extends AnyRoute,
|
|
169
173
|
TAllParams,
|
|
170
174
|
TRouteContextReturn extends RouteContext,
|
|
175
|
+
TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,
|
|
176
|
+
TContext = IsAny<TParentRoute['types']['allContext'], TRouterContext>,
|
|
171
177
|
> = (opts: {
|
|
172
178
|
search: TFullSearchSchema
|
|
173
179
|
abortController: AbortController
|
|
174
180
|
preload: boolean
|
|
175
181
|
params: TAllParams
|
|
176
|
-
context:
|
|
182
|
+
context: TContext
|
|
177
183
|
location: ParsedLocation
|
|
178
184
|
navigate: NavigateFn<AnyRoute>
|
|
179
185
|
buildLocation: BuildLocationFn<TParentRoute>
|
|
@@ -497,6 +503,7 @@ export class Route<
|
|
|
497
503
|
TAllParams,
|
|
498
504
|
TRouteContextReturn,
|
|
499
505
|
TRouteContext,
|
|
506
|
+
TRouterContext,
|
|
500
507
|
TAllContext,
|
|
501
508
|
TLoaderDeps,
|
|
502
509
|
TLoaderData
|
|
@@ -534,6 +541,7 @@ export class Route<
|
|
|
534
541
|
TAllParams,
|
|
535
542
|
TRouteContextReturn,
|
|
536
543
|
TRouteContext,
|
|
544
|
+
TRouterContext,
|
|
537
545
|
TAllContext,
|
|
538
546
|
TLoaderDeps,
|
|
539
547
|
TLoaderData
|
|
@@ -587,6 +595,7 @@ export class Route<
|
|
|
587
595
|
TAllParams,
|
|
588
596
|
TRouteContextReturn,
|
|
589
597
|
TRouteContext,
|
|
598
|
+
TRouterContext,
|
|
590
599
|
TAllContext,
|
|
591
600
|
TLoaderDeps,
|
|
592
601
|
TLoaderData
|
|
@@ -759,7 +768,9 @@ export function rootRouteWithContext<TRouterContext extends {}>() {
|
|
|
759
768
|
TSearchSchema extends Record<string, any> = RootSearchSchema,
|
|
760
769
|
TSearchSchemaUsed extends Record<string, any> = RootSearchSchema,
|
|
761
770
|
TRouteContextReturn extends RouteContext = RouteContext,
|
|
762
|
-
TRouteContext extends RouteContext =
|
|
771
|
+
TRouteContext extends RouteContext = [TRouteContextReturn] extends [never]
|
|
772
|
+
? RouteContext
|
|
773
|
+
: TRouteContextReturn,
|
|
763
774
|
TLoaderDeps extends Record<string, any> = {},
|
|
764
775
|
TLoaderData extends any = unknown,
|
|
765
776
|
>(
|
|
@@ -777,6 +788,7 @@ export function rootRouteWithContext<TRouterContext extends {}>() {
|
|
|
777
788
|
{}, // TAllParams
|
|
778
789
|
TRouteContextReturn, // TRouteContextReturn
|
|
779
790
|
TRouteContext, // TRouteContext
|
|
791
|
+
TRouterContext,
|
|
780
792
|
Assign<TRouterContext, TRouteContext>, // TAllContext
|
|
781
793
|
TLoaderDeps,
|
|
782
794
|
TLoaderData // TLoaderData,
|
|
@@ -809,7 +821,9 @@ export class RootRoute<
|
|
|
809
821
|
TSearchSchema extends Record<string, any> = RootSearchSchema,
|
|
810
822
|
TSearchSchemaUsed extends Record<string, any> = RootSearchSchema,
|
|
811
823
|
TRouteContextReturn extends RouteContext = RouteContext,
|
|
812
|
-
TRouteContext extends RouteContext =
|
|
824
|
+
TRouteContext extends RouteContext = [TRouteContextReturn] extends [never]
|
|
825
|
+
? RouteContext
|
|
826
|
+
: TRouteContextReturn,
|
|
813
827
|
TRouterContext extends {} = {},
|
|
814
828
|
TLoaderDeps extends Record<string, any> = {},
|
|
815
829
|
TLoaderData extends any = unknown,
|
|
@@ -850,6 +864,7 @@ export class RootRoute<
|
|
|
850
864
|
{}, // TAllParams
|
|
851
865
|
TRouteContextReturn, // TRouteContextReturn
|
|
852
866
|
TRouteContext, // TRouteContext
|
|
867
|
+
TRouterContext,
|
|
853
868
|
Assign<TRouterContext, TRouteContext>, // TAllContext
|
|
854
869
|
TLoaderDeps,
|
|
855
870
|
TLoaderData
|
|
@@ -962,13 +977,13 @@ export class NotFoundRoute<
|
|
|
962
977
|
TParentRoute,
|
|
963
978
|
TSearchSchema
|
|
964
979
|
>,
|
|
980
|
+
TRouteContextReturn extends RouteConstraints['TRouteContext'] = AnyContext,
|
|
965
981
|
TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext,
|
|
966
982
|
TAllContext extends Expand<
|
|
967
983
|
Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>
|
|
968
984
|
> = Expand<
|
|
969
985
|
Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>
|
|
970
986
|
>,
|
|
971
|
-
TRouteContextReturn extends RouteConstraints['TRouterContext'] = AnyContext,
|
|
972
987
|
TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,
|
|
973
988
|
TLoaderDeps extends Record<string, any> = {},
|
|
974
989
|
TLoaderData extends any = unknown,
|
|
@@ -1011,6 +1026,7 @@ export class NotFoundRoute<
|
|
|
1011
1026
|
{},
|
|
1012
1027
|
TRouteContextReturn,
|
|
1013
1028
|
TRouteContext,
|
|
1029
|
+
TRouterContext,
|
|
1014
1030
|
TAllContext,
|
|
1015
1031
|
TLoaderDeps,
|
|
1016
1032
|
TLoaderData
|