@tanstack/react-router 0.0.1-beta.75 → 0.0.1-beta.77
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/stats-html.html
CHANGED
|
@@ -4024,7 +4024,7 @@ var drawChart = (function (exports) {
|
|
|
4024
4024
|
</script>
|
|
4025
4025
|
<script>
|
|
4026
4026
|
/*<!--*/
|
|
4027
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"uid":"
|
|
4027
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"uid":"5d99-93","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"node_modules/.pnpm","children":[{"name":"tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","uid":"5d99-95"},{"name":"tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js","uid":"5d99-97"}]},{"name":"packages","children":[{"name":"store/build/esm/index.js","uid":"5d99-99"},{"name":"router/build/esm/index.js","uid":"5d99-101"},{"name":"react-store/build/esm/index.js","uid":"5d99-103"},{"name":"react-router/src/index.tsx","uid":"5d99-105"}]}]}],"isRoot":true},"nodeParts":{"5d99-93":{"renderedLength":429,"gzipLength":238,"brotliLength":0,"mainUid":"5d99-92"},"5d99-95":{"renderedLength":181,"gzipLength":129,"brotliLength":0,"mainUid":"5d99-94"},"5d99-97":{"renderedLength":44,"gzipLength":62,"brotliLength":0,"mainUid":"5d99-96"},"5d99-99":{"renderedLength":1288,"gzipLength":497,"brotliLength":0,"mainUid":"5d99-98"},"5d99-101":{"renderedLength":48257,"gzipLength":11461,"brotliLength":0,"mainUid":"5d99-100"},"5d99-103":{"renderedLength":1571,"gzipLength":594,"brotliLength":0,"mainUid":"5d99-102"},"5d99-105":{"renderedLength":12591,"gzipLength":3262,"brotliLength":0,"mainUid":"5d99-104"}},"nodeMetas":{"5d99-92":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"5d99-93"},"imported":[],"importedBy":[{"uid":"5d99-104"}]},"5d99-94":{"id":"/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","moduleParts":{"index.production.js":"5d99-95"},"imported":[],"importedBy":[{"uid":"5d99-100"}]},"5d99-96":{"id":"/node_modules/.pnpm/tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js","moduleParts":{"index.production.js":"5d99-97"},"imported":[],"importedBy":[{"uid":"5d99-100"}]},"5d99-98":{"id":"/packages/store/build/esm/index.js","moduleParts":{"index.production.js":"5d99-99"},"imported":[],"importedBy":[{"uid":"5d99-100"}]},"5d99-100":{"id":"/packages/router/build/esm/index.js","moduleParts":{"index.production.js":"5d99-101"},"imported":[{"uid":"5d99-94"},{"uid":"5d99-96"},{"uid":"5d99-98"}],"importedBy":[{"uid":"5d99-104"}]},"5d99-102":{"id":"/packages/react-store/build/esm/index.js","moduleParts":{"index.production.js":"5d99-103"},"imported":[{"uid":"5d99-107"}],"importedBy":[{"uid":"5d99-104"}]},"5d99-104":{"id":"/packages/react-router/src/index.tsx","moduleParts":{"index.production.js":"5d99-105"},"imported":[{"uid":"5d99-92"},{"uid":"5d99-106"},{"uid":"5d99-100"},{"uid":"5d99-102"}],"importedBy":[],"isEntry":true},"5d99-106":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"5d99-104"}],"isExternal":true},"5d99-107":{"id":"use-sync-external-store/shim/with-selector","moduleParts":{},"imported":[],"importedBy":[{"uid":"5d99-102"}],"isExternal":true}},"env":{"rollup":"2.79.1"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
4028
4028
|
|
|
4029
4029
|
const run = () => {
|
|
4030
4030
|
const width = window.innerWidth;
|
package/build/stats-react.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"name": "index.production.js",
|
|
8
8
|
"children": [
|
|
9
9
|
{
|
|
10
|
-
"uid": "
|
|
10
|
+
"uid": "5d99-109",
|
|
11
11
|
"name": "\u0000rollupPluginBabelHelpers.js"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"children": [
|
|
16
16
|
{
|
|
17
17
|
"name": "tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
|
|
18
|
-
"uid": "
|
|
18
|
+
"uid": "5d99-111"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"name": "tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
|
|
22
|
-
"uid": "
|
|
22
|
+
"uid": "5d99-113"
|
|
23
23
|
}
|
|
24
24
|
]
|
|
25
25
|
},
|
|
@@ -28,19 +28,19 @@
|
|
|
28
28
|
"children": [
|
|
29
29
|
{
|
|
30
30
|
"name": "store/build/esm/index.js",
|
|
31
|
-
"uid": "
|
|
31
|
+
"uid": "5d99-115"
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
"name": "router/build/esm/index.js",
|
|
35
|
-
"uid": "
|
|
35
|
+
"uid": "5d99-117"
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
"name": "react-store/build/esm/index.js",
|
|
39
|
-
"uid": "
|
|
39
|
+
"uid": "5d99-119"
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
"name": "react-router/src/index.tsx",
|
|
43
|
-
"uid": "
|
|
43
|
+
"uid": "5d99-121"
|
|
44
44
|
}
|
|
45
45
|
]
|
|
46
46
|
}
|
|
@@ -50,176 +50,176 @@
|
|
|
50
50
|
"isRoot": true
|
|
51
51
|
},
|
|
52
52
|
"nodeParts": {
|
|
53
|
-
"
|
|
53
|
+
"5d99-109": {
|
|
54
54
|
"renderedLength": 429,
|
|
55
55
|
"gzipLength": 238,
|
|
56
56
|
"brotliLength": 0,
|
|
57
|
-
"mainUid": "
|
|
57
|
+
"mainUid": "5d99-108"
|
|
58
58
|
},
|
|
59
|
-
"
|
|
59
|
+
"5d99-111": {
|
|
60
60
|
"renderedLength": 181,
|
|
61
61
|
"gzipLength": 129,
|
|
62
62
|
"brotliLength": 0,
|
|
63
|
-
"mainUid": "
|
|
63
|
+
"mainUid": "5d99-110"
|
|
64
64
|
},
|
|
65
|
-
"
|
|
65
|
+
"5d99-113": {
|
|
66
66
|
"renderedLength": 44,
|
|
67
67
|
"gzipLength": 62,
|
|
68
68
|
"brotliLength": 0,
|
|
69
|
-
"mainUid": "
|
|
69
|
+
"mainUid": "5d99-112"
|
|
70
70
|
},
|
|
71
|
-
"
|
|
71
|
+
"5d99-115": {
|
|
72
72
|
"renderedLength": 1288,
|
|
73
73
|
"gzipLength": 497,
|
|
74
74
|
"brotliLength": 0,
|
|
75
|
-
"mainUid": "
|
|
75
|
+
"mainUid": "5d99-114"
|
|
76
76
|
},
|
|
77
|
-
"
|
|
78
|
-
"renderedLength":
|
|
79
|
-
"gzipLength":
|
|
77
|
+
"5d99-117": {
|
|
78
|
+
"renderedLength": 48257,
|
|
79
|
+
"gzipLength": 11461,
|
|
80
80
|
"brotliLength": 0,
|
|
81
|
-
"mainUid": "
|
|
81
|
+
"mainUid": "5d99-116"
|
|
82
82
|
},
|
|
83
|
-
"
|
|
83
|
+
"5d99-119": {
|
|
84
84
|
"renderedLength": 1571,
|
|
85
85
|
"gzipLength": 594,
|
|
86
86
|
"brotliLength": 0,
|
|
87
|
-
"mainUid": "
|
|
87
|
+
"mainUid": "5d99-118"
|
|
88
88
|
},
|
|
89
|
-
"
|
|
89
|
+
"5d99-121": {
|
|
90
90
|
"renderedLength": 12591,
|
|
91
91
|
"gzipLength": 3262,
|
|
92
92
|
"brotliLength": 0,
|
|
93
|
-
"mainUid": "
|
|
93
|
+
"mainUid": "5d99-120"
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
96
|
"nodeMetas": {
|
|
97
|
-
"
|
|
97
|
+
"5d99-108": {
|
|
98
98
|
"id": "\u0000rollupPluginBabelHelpers.js",
|
|
99
99
|
"moduleParts": {
|
|
100
|
-
"index.production.js": "
|
|
100
|
+
"index.production.js": "5d99-109"
|
|
101
101
|
},
|
|
102
102
|
"imported": [],
|
|
103
103
|
"importedBy": [
|
|
104
104
|
{
|
|
105
|
-
"uid": "
|
|
105
|
+
"uid": "5d99-120"
|
|
106
106
|
}
|
|
107
107
|
]
|
|
108
108
|
},
|
|
109
|
-
"
|
|
109
|
+
"5d99-110": {
|
|
110
110
|
"id": "/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
|
|
111
111
|
"moduleParts": {
|
|
112
|
-
"index.production.js": "
|
|
112
|
+
"index.production.js": "5d99-111"
|
|
113
113
|
},
|
|
114
114
|
"imported": [],
|
|
115
115
|
"importedBy": [
|
|
116
116
|
{
|
|
117
|
-
"uid": "
|
|
117
|
+
"uid": "5d99-116"
|
|
118
118
|
}
|
|
119
119
|
]
|
|
120
120
|
},
|
|
121
|
-
"
|
|
121
|
+
"5d99-112": {
|
|
122
122
|
"id": "/node_modules/.pnpm/tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
|
|
123
123
|
"moduleParts": {
|
|
124
|
-
"index.production.js": "
|
|
124
|
+
"index.production.js": "5d99-113"
|
|
125
125
|
},
|
|
126
126
|
"imported": [],
|
|
127
127
|
"importedBy": [
|
|
128
128
|
{
|
|
129
|
-
"uid": "
|
|
129
|
+
"uid": "5d99-116"
|
|
130
130
|
}
|
|
131
131
|
]
|
|
132
132
|
},
|
|
133
|
-
"
|
|
133
|
+
"5d99-114": {
|
|
134
134
|
"id": "/packages/store/build/esm/index.js",
|
|
135
135
|
"moduleParts": {
|
|
136
|
-
"index.production.js": "
|
|
136
|
+
"index.production.js": "5d99-115"
|
|
137
137
|
},
|
|
138
138
|
"imported": [],
|
|
139
139
|
"importedBy": [
|
|
140
140
|
{
|
|
141
|
-
"uid": "
|
|
141
|
+
"uid": "5d99-116"
|
|
142
142
|
}
|
|
143
143
|
]
|
|
144
144
|
},
|
|
145
|
-
"
|
|
145
|
+
"5d99-116": {
|
|
146
146
|
"id": "/packages/router/build/esm/index.js",
|
|
147
147
|
"moduleParts": {
|
|
148
|
-
"index.production.js": "
|
|
148
|
+
"index.production.js": "5d99-117"
|
|
149
149
|
},
|
|
150
150
|
"imported": [
|
|
151
151
|
{
|
|
152
|
-
"uid": "
|
|
152
|
+
"uid": "5d99-110"
|
|
153
153
|
},
|
|
154
154
|
{
|
|
155
|
-
"uid": "
|
|
155
|
+
"uid": "5d99-112"
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
|
-
"uid": "
|
|
158
|
+
"uid": "5d99-114"
|
|
159
159
|
}
|
|
160
160
|
],
|
|
161
161
|
"importedBy": [
|
|
162
162
|
{
|
|
163
|
-
"uid": "
|
|
163
|
+
"uid": "5d99-120"
|
|
164
164
|
}
|
|
165
165
|
]
|
|
166
166
|
},
|
|
167
|
-
"
|
|
167
|
+
"5d99-118": {
|
|
168
168
|
"id": "/packages/react-store/build/esm/index.js",
|
|
169
169
|
"moduleParts": {
|
|
170
|
-
"index.production.js": "
|
|
170
|
+
"index.production.js": "5d99-119"
|
|
171
171
|
},
|
|
172
172
|
"imported": [
|
|
173
173
|
{
|
|
174
|
-
"uid": "
|
|
174
|
+
"uid": "5d99-123"
|
|
175
175
|
}
|
|
176
176
|
],
|
|
177
177
|
"importedBy": [
|
|
178
178
|
{
|
|
179
|
-
"uid": "
|
|
179
|
+
"uid": "5d99-120"
|
|
180
180
|
}
|
|
181
181
|
]
|
|
182
182
|
},
|
|
183
|
-
"
|
|
183
|
+
"5d99-120": {
|
|
184
184
|
"id": "/packages/react-router/src/index.tsx",
|
|
185
185
|
"moduleParts": {
|
|
186
|
-
"index.production.js": "
|
|
186
|
+
"index.production.js": "5d99-121"
|
|
187
187
|
},
|
|
188
188
|
"imported": [
|
|
189
189
|
{
|
|
190
|
-
"uid": "
|
|
190
|
+
"uid": "5d99-108"
|
|
191
191
|
},
|
|
192
192
|
{
|
|
193
|
-
"uid": "
|
|
193
|
+
"uid": "5d99-122"
|
|
194
194
|
},
|
|
195
195
|
{
|
|
196
|
-
"uid": "
|
|
196
|
+
"uid": "5d99-116"
|
|
197
197
|
},
|
|
198
198
|
{
|
|
199
|
-
"uid": "
|
|
199
|
+
"uid": "5d99-118"
|
|
200
200
|
}
|
|
201
201
|
],
|
|
202
202
|
"importedBy": [],
|
|
203
203
|
"isEntry": true
|
|
204
204
|
},
|
|
205
|
-
"
|
|
205
|
+
"5d99-122": {
|
|
206
206
|
"id": "react",
|
|
207
207
|
"moduleParts": {},
|
|
208
208
|
"imported": [],
|
|
209
209
|
"importedBy": [
|
|
210
210
|
{
|
|
211
|
-
"uid": "
|
|
211
|
+
"uid": "5d99-120"
|
|
212
212
|
}
|
|
213
213
|
],
|
|
214
214
|
"isExternal": true
|
|
215
215
|
},
|
|
216
|
-
"
|
|
216
|
+
"5d99-123": {
|
|
217
217
|
"id": "use-sync-external-store/shim/with-selector",
|
|
218
218
|
"moduleParts": {},
|
|
219
219
|
"imported": [],
|
|
220
220
|
"importedBy": [
|
|
221
221
|
{
|
|
222
|
-
"uid": "
|
|
222
|
+
"uid": "5d99-118"
|
|
223
223
|
}
|
|
224
224
|
],
|
|
225
225
|
"isExternal": true
|
|
@@ -612,11 +612,11 @@
|
|
|
612
612
|
this.router = opts.router;
|
|
613
613
|
const allOptions = this.options;
|
|
614
614
|
const isRoot = !allOptions?.path && !allOptions?.id;
|
|
615
|
-
|
|
615
|
+
this.parentRoute = this.options?.getParentRoute?.();
|
|
616
616
|
if (isRoot) {
|
|
617
617
|
this.path = rootRouteId;
|
|
618
618
|
} else {
|
|
619
|
-
invariant(
|
|
619
|
+
invariant(this.parentRoute, `Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.`);
|
|
620
620
|
}
|
|
621
621
|
let path = isRoot ? rootRouteId : allOptions.path;
|
|
622
622
|
|
|
@@ -627,14 +627,14 @@
|
|
|
627
627
|
const customId = allOptions?.id || path;
|
|
628
628
|
|
|
629
629
|
// Strip the parentId prefix from the first level of children
|
|
630
|
-
let id = isRoot ? rootRouteId : joinPaths([
|
|
630
|
+
let id = isRoot ? rootRouteId : joinPaths([this.parentRoute.id === rootRouteId ? '' : this.parentRoute.id, customId]);
|
|
631
631
|
if (path === rootRouteId) {
|
|
632
632
|
path = '/';
|
|
633
633
|
}
|
|
634
634
|
if (id !== rootRouteId) {
|
|
635
635
|
id = joinPaths(['/', id]);
|
|
636
636
|
}
|
|
637
|
-
const fullPath = id === rootRouteId ? '/' : trimPathRight(joinPaths([
|
|
637
|
+
const fullPath = id === rootRouteId ? '/' : trimPathRight(joinPaths([this.parentRoute.fullPath, path]));
|
|
638
638
|
this.path = path;
|
|
639
639
|
this.id = id;
|
|
640
640
|
// this.customId = customId as TCustomId
|
|
@@ -644,10 +644,34 @@
|
|
|
644
644
|
this.children = children;
|
|
645
645
|
return this;
|
|
646
646
|
};
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
647
|
+
|
|
648
|
+
// generate = (
|
|
649
|
+
// options: Omit<
|
|
650
|
+
// RouteOptions<
|
|
651
|
+
// TParentRoute,
|
|
652
|
+
// TCustomId,
|
|
653
|
+
// TPath,
|
|
654
|
+
// InferFullSearchSchema<TParentRoute>,
|
|
655
|
+
// TSearchSchema,
|
|
656
|
+
// TFullSearchSchema,
|
|
657
|
+
// TParentRoute['__types']['allParams'],
|
|
658
|
+
// TParams,
|
|
659
|
+
// TAllParams,
|
|
660
|
+
// TParentContext,
|
|
661
|
+
// TAllParentContext,
|
|
662
|
+
// TRouteContext,
|
|
663
|
+
// TContext
|
|
664
|
+
// >,
|
|
665
|
+
// 'path'
|
|
666
|
+
// >,
|
|
667
|
+
// ) => {
|
|
668
|
+
// invariant(
|
|
669
|
+
// false,
|
|
670
|
+
// `route.generate() is used by TanStack Router's file-based routing code generation and should not actually be called during runtime. `,
|
|
671
|
+
// )
|
|
672
|
+
// }
|
|
650
673
|
}
|
|
674
|
+
|
|
651
675
|
class RootRoute extends Route {
|
|
652
676
|
constructor(options) {
|
|
653
677
|
super(options);
|
|
@@ -1291,19 +1315,14 @@
|
|
|
1291
1315
|
});
|
|
1292
1316
|
};
|
|
1293
1317
|
#buildRouteTree = routeTree => {
|
|
1294
|
-
const recurseRoutes = routes => {
|
|
1318
|
+
const recurseRoutes = (routes, parentRoute) => {
|
|
1295
1319
|
routes.forEach((route, i) => {
|
|
1296
1320
|
route.init({
|
|
1297
1321
|
originalIndex: i,
|
|
1298
1322
|
router: this
|
|
1299
1323
|
});
|
|
1300
1324
|
const existingRoute = this.routesById[route.id];
|
|
1301
|
-
|
|
1302
|
-
{
|
|
1303
|
-
console.warn(`Duplicate routes found with id: ${String(route.id)}`, this.routesById, route);
|
|
1304
|
-
}
|
|
1305
|
-
throw new Error();
|
|
1306
|
-
}
|
|
1325
|
+
invariant(!existingRoute, `Duplicate routes found with id: ${String(route.id)}`);
|
|
1307
1326
|
this.routesById[route.id] = route;
|
|
1308
1327
|
const children = route.children;
|
|
1309
1328
|
if (children?.length) {
|
|
@@ -1343,6 +1362,19 @@
|
|
|
1343
1362
|
});
|
|
1344
1363
|
};
|
|
1345
1364
|
recurseRoutes([routeTree]);
|
|
1365
|
+
const recurceCheckRoutes = (routes, parentRoute) => {
|
|
1366
|
+
routes.forEach(route => {
|
|
1367
|
+
if (route.isRoot) {
|
|
1368
|
+
invariant(!parentRoute, 'Root routes can only be used as the root of a route tree.');
|
|
1369
|
+
} else {
|
|
1370
|
+
invariant(parentRoute ? route.parentRoute === parentRoute : true, `Expected a route with path "${route.path}" to be passed to its parent route "${route.parentRoute?.id}" in an addChildren() call, but was instead passed as a child of the "${parentRoute?.id}" route.`);
|
|
1371
|
+
}
|
|
1372
|
+
if (route.children) {
|
|
1373
|
+
recurceCheckRoutes(route.children, route);
|
|
1374
|
+
}
|
|
1375
|
+
});
|
|
1376
|
+
};
|
|
1377
|
+
recurceCheckRoutes([routeTree], undefined);
|
|
1346
1378
|
return routeTree;
|
|
1347
1379
|
};
|
|
1348
1380
|
#parseLocation = previousLocation => {
|
|
@@ -1464,7 +1496,6 @@
|
|
|
1464
1496
|
const componentTypes = ['component', 'errorComponent', 'pendingComponent'];
|
|
1465
1497
|
class RouteMatch {
|
|
1466
1498
|
abortController = new AbortController();
|
|
1467
|
-
onLoaderDataListeners = new Set();
|
|
1468
1499
|
constructor(router, route, opts) {
|
|
1469
1500
|
Object.assign(this, {
|
|
1470
1501
|
route,
|