@tanstack/react-router 0.0.1-beta.62 → 0.0.1-beta.63
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":"cf24-89","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","uid":"cf24-91"},{"name":"packages","children":[{"name":"store/build/esm/index.js","uid":"cf24-93"},{"name":"router/build/esm/index.js","uid":"cf24-95"},{"name":"react-store/build/esm/index.js","uid":"cf24-97"},{"name":"react-router/src/index.tsx","uid":"cf24-99"}]}]}],"isRoot":true},"nodeParts":{"cf24-89":{"renderedLength":429,"gzipLength":238,"brotliLength":0,"mainUid":"cf24-88"},"cf24-91":{"renderedLength":181,"gzipLength":129,"brotliLength":0,"mainUid":"cf24-90"},"cf24-93":{"renderedLength":1288,"gzipLength":497,"brotliLength":0,"mainUid":"cf24-92"},"cf24-95":{"renderedLength":44953,"gzipLength":10850,"brotliLength":0,"mainUid":"cf24-94"},"cf24-97":{"renderedLength":1571,"gzipLength":594,"brotliLength":0,"mainUid":"cf24-96"},"cf24-99":{"renderedLength":12098,"gzipLength":3161,"brotliLength":0,"mainUid":"cf24-98"}},"nodeMetas":{"cf24-88":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"cf24-89"},"imported":[],"importedBy":[{"uid":"cf24-98"}]},"cf24-90":{"id":"/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","moduleParts":{"index.production.js":"cf24-91"},"imported":[],"importedBy":[{"uid":"cf24-94"}]},"cf24-92":{"id":"/packages/store/build/esm/index.js","moduleParts":{"index.production.js":"cf24-93"},"imported":[],"importedBy":[{"uid":"cf24-94"}]},"cf24-94":{"id":"/packages/router/build/esm/index.js","moduleParts":{"index.production.js":"cf24-95"},"imported":[{"uid":"cf24-90"},{"uid":"cf24-92"}],"importedBy":[{"uid":"cf24-98"}]},"cf24-96":{"id":"/packages/react-store/build/esm/index.js","moduleParts":{"index.production.js":"cf24-97"},"imported":[{"uid":"cf24-101"}],"importedBy":[{"uid":"cf24-98"}]},"cf24-98":{"id":"/packages/react-router/src/index.tsx","moduleParts":{"index.production.js":"cf24-99"},"imported":[{"uid":"cf24-88"},{"uid":"cf24-100"},{"uid":"cf24-94"},{"uid":"cf24-96"}],"importedBy":[],"isEntry":true},"cf24-100":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"cf24-98"}],"isExternal":true},"cf24-101":{"id":"use-sync-external-store/shim/with-selector","moduleParts":{},"imported":[],"importedBy":[{"uid":"cf24-96"}],"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,31 +7,31 @@
|
|
|
7
7
|
"name": "index.production.js",
|
|
8
8
|
"children": [
|
|
9
9
|
{
|
|
10
|
-
"uid": "
|
|
10
|
+
"uid": "cf24-103",
|
|
11
11
|
"name": "\u0000rollupPluginBabelHelpers.js"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"name": "node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
|
|
15
|
-
"uid": "
|
|
15
|
+
"uid": "cf24-105"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
"name": "packages",
|
|
19
19
|
"children": [
|
|
20
20
|
{
|
|
21
21
|
"name": "store/build/esm/index.js",
|
|
22
|
-
"uid": "
|
|
22
|
+
"uid": "cf24-107"
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
"name": "router/build/esm/index.js",
|
|
26
|
-
"uid": "
|
|
26
|
+
"uid": "cf24-109"
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
"name": "react-store/build/esm/index.js",
|
|
30
|
-
"uid": "
|
|
30
|
+
"uid": "cf24-111"
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
"name": "react-router/src/index.tsx",
|
|
34
|
-
"uid": "
|
|
34
|
+
"uid": "cf24-113"
|
|
35
35
|
}
|
|
36
36
|
]
|
|
37
37
|
}
|
|
@@ -41,155 +41,155 @@
|
|
|
41
41
|
"isRoot": true
|
|
42
42
|
},
|
|
43
43
|
"nodeParts": {
|
|
44
|
-
"
|
|
44
|
+
"cf24-103": {
|
|
45
45
|
"renderedLength": 429,
|
|
46
46
|
"gzipLength": 238,
|
|
47
47
|
"brotliLength": 0,
|
|
48
|
-
"mainUid": "
|
|
48
|
+
"mainUid": "cf24-102"
|
|
49
49
|
},
|
|
50
|
-
"
|
|
50
|
+
"cf24-105": {
|
|
51
51
|
"renderedLength": 181,
|
|
52
52
|
"gzipLength": 129,
|
|
53
53
|
"brotliLength": 0,
|
|
54
|
-
"mainUid": "
|
|
54
|
+
"mainUid": "cf24-104"
|
|
55
55
|
},
|
|
56
|
-
"
|
|
56
|
+
"cf24-107": {
|
|
57
57
|
"renderedLength": 1288,
|
|
58
58
|
"gzipLength": 497,
|
|
59
59
|
"brotliLength": 0,
|
|
60
|
-
"mainUid": "
|
|
60
|
+
"mainUid": "cf24-106"
|
|
61
61
|
},
|
|
62
|
-
"
|
|
63
|
-
"renderedLength":
|
|
64
|
-
"gzipLength":
|
|
62
|
+
"cf24-109": {
|
|
63
|
+
"renderedLength": 44953,
|
|
64
|
+
"gzipLength": 10850,
|
|
65
65
|
"brotliLength": 0,
|
|
66
|
-
"mainUid": "
|
|
66
|
+
"mainUid": "cf24-108"
|
|
67
67
|
},
|
|
68
|
-
"
|
|
68
|
+
"cf24-111": {
|
|
69
69
|
"renderedLength": 1571,
|
|
70
70
|
"gzipLength": 594,
|
|
71
71
|
"brotliLength": 0,
|
|
72
|
-
"mainUid": "
|
|
72
|
+
"mainUid": "cf24-110"
|
|
73
73
|
},
|
|
74
|
-
"
|
|
74
|
+
"cf24-113": {
|
|
75
75
|
"renderedLength": 12098,
|
|
76
76
|
"gzipLength": 3161,
|
|
77
77
|
"brotliLength": 0,
|
|
78
|
-
"mainUid": "
|
|
78
|
+
"mainUid": "cf24-112"
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
"nodeMetas": {
|
|
82
|
-
"
|
|
82
|
+
"cf24-102": {
|
|
83
83
|
"id": "\u0000rollupPluginBabelHelpers.js",
|
|
84
84
|
"moduleParts": {
|
|
85
|
-
"index.production.js": "
|
|
85
|
+
"index.production.js": "cf24-103"
|
|
86
86
|
},
|
|
87
87
|
"imported": [],
|
|
88
88
|
"importedBy": [
|
|
89
89
|
{
|
|
90
|
-
"uid": "
|
|
90
|
+
"uid": "cf24-112"
|
|
91
91
|
}
|
|
92
92
|
]
|
|
93
93
|
},
|
|
94
|
-
"
|
|
94
|
+
"cf24-104": {
|
|
95
95
|
"id": "/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
|
|
96
96
|
"moduleParts": {
|
|
97
|
-
"index.production.js": "
|
|
97
|
+
"index.production.js": "cf24-105"
|
|
98
98
|
},
|
|
99
99
|
"imported": [],
|
|
100
100
|
"importedBy": [
|
|
101
101
|
{
|
|
102
|
-
"uid": "
|
|
102
|
+
"uid": "cf24-108"
|
|
103
103
|
}
|
|
104
104
|
]
|
|
105
105
|
},
|
|
106
|
-
"
|
|
106
|
+
"cf24-106": {
|
|
107
107
|
"id": "/packages/store/build/esm/index.js",
|
|
108
108
|
"moduleParts": {
|
|
109
|
-
"index.production.js": "
|
|
109
|
+
"index.production.js": "cf24-107"
|
|
110
110
|
},
|
|
111
111
|
"imported": [],
|
|
112
112
|
"importedBy": [
|
|
113
113
|
{
|
|
114
|
-
"uid": "
|
|
114
|
+
"uid": "cf24-108"
|
|
115
115
|
}
|
|
116
116
|
]
|
|
117
117
|
},
|
|
118
|
-
"
|
|
118
|
+
"cf24-108": {
|
|
119
119
|
"id": "/packages/router/build/esm/index.js",
|
|
120
120
|
"moduleParts": {
|
|
121
|
-
"index.production.js": "
|
|
121
|
+
"index.production.js": "cf24-109"
|
|
122
122
|
},
|
|
123
123
|
"imported": [
|
|
124
124
|
{
|
|
125
|
-
"uid": "
|
|
125
|
+
"uid": "cf24-104"
|
|
126
126
|
},
|
|
127
127
|
{
|
|
128
|
-
"uid": "
|
|
128
|
+
"uid": "cf24-106"
|
|
129
129
|
}
|
|
130
130
|
],
|
|
131
131
|
"importedBy": [
|
|
132
132
|
{
|
|
133
|
-
"uid": "
|
|
133
|
+
"uid": "cf24-112"
|
|
134
134
|
}
|
|
135
135
|
]
|
|
136
136
|
},
|
|
137
|
-
"
|
|
137
|
+
"cf24-110": {
|
|
138
138
|
"id": "/packages/react-store/build/esm/index.js",
|
|
139
139
|
"moduleParts": {
|
|
140
|
-
"index.production.js": "
|
|
140
|
+
"index.production.js": "cf24-111"
|
|
141
141
|
},
|
|
142
142
|
"imported": [
|
|
143
143
|
{
|
|
144
|
-
"uid": "
|
|
144
|
+
"uid": "cf24-115"
|
|
145
145
|
}
|
|
146
146
|
],
|
|
147
147
|
"importedBy": [
|
|
148
148
|
{
|
|
149
|
-
"uid": "
|
|
149
|
+
"uid": "cf24-112"
|
|
150
150
|
}
|
|
151
151
|
]
|
|
152
152
|
},
|
|
153
|
-
"
|
|
153
|
+
"cf24-112": {
|
|
154
154
|
"id": "/packages/react-router/src/index.tsx",
|
|
155
155
|
"moduleParts": {
|
|
156
|
-
"index.production.js": "
|
|
156
|
+
"index.production.js": "cf24-113"
|
|
157
157
|
},
|
|
158
158
|
"imported": [
|
|
159
159
|
{
|
|
160
|
-
"uid": "
|
|
160
|
+
"uid": "cf24-102"
|
|
161
161
|
},
|
|
162
162
|
{
|
|
163
|
-
"uid": "
|
|
163
|
+
"uid": "cf24-114"
|
|
164
164
|
},
|
|
165
165
|
{
|
|
166
|
-
"uid": "
|
|
166
|
+
"uid": "cf24-108"
|
|
167
167
|
},
|
|
168
168
|
{
|
|
169
|
-
"uid": "
|
|
169
|
+
"uid": "cf24-110"
|
|
170
170
|
}
|
|
171
171
|
],
|
|
172
172
|
"importedBy": [],
|
|
173
173
|
"isEntry": true
|
|
174
174
|
},
|
|
175
|
-
"
|
|
175
|
+
"cf24-114": {
|
|
176
176
|
"id": "react",
|
|
177
177
|
"moduleParts": {},
|
|
178
178
|
"imported": [],
|
|
179
179
|
"importedBy": [
|
|
180
180
|
{
|
|
181
|
-
"uid": "
|
|
181
|
+
"uid": "cf24-112"
|
|
182
182
|
}
|
|
183
183
|
],
|
|
184
184
|
"isExternal": true
|
|
185
185
|
},
|
|
186
|
-
"
|
|
186
|
+
"cf24-115": {
|
|
187
187
|
"id": "use-sync-external-store/shim/with-selector",
|
|
188
188
|
"moduleParts": {},
|
|
189
189
|
"imported": [],
|
|
190
190
|
"importedBy": [
|
|
191
191
|
{
|
|
192
|
-
"uid": "
|
|
192
|
+
"uid": "cf24-110"
|
|
193
193
|
}
|
|
194
194
|
],
|
|
195
195
|
"isExternal": true
|
|
@@ -345,6 +345,21 @@
|
|
|
345
345
|
function hasObjectPrototype(o) {
|
|
346
346
|
return Object.prototype.toString.call(o) === '[object Object]';
|
|
347
347
|
}
|
|
348
|
+
function partialDeepEqual(a, b) {
|
|
349
|
+
if (a === b) {
|
|
350
|
+
return true;
|
|
351
|
+
}
|
|
352
|
+
if (typeof a !== typeof b) {
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
if (isPlainObject(a) && isPlainObject(b)) {
|
|
356
|
+
return !Object.keys(b).some(key => !partialDeepEqual(a[key], b[key]));
|
|
357
|
+
}
|
|
358
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
359
|
+
return a.length === b.length && a.every((item, index) => partialDeepEqual(item, b[index]));
|
|
360
|
+
}
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
348
363
|
|
|
349
364
|
function joinPaths(paths) {
|
|
350
365
|
return cleanPath(paths.filter(Boolean).join('/'));
|
|
@@ -614,15 +629,10 @@
|
|
|
614
629
|
this.children = children;
|
|
615
630
|
return this;
|
|
616
631
|
};
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
// false,
|
|
621
|
-
// `routeConfig.generate() is used by TanStack Router's file-based routing code generation and should not actually be called during runtime. `,
|
|
622
|
-
// )
|
|
623
|
-
// },
|
|
632
|
+
generate = options => {
|
|
633
|
+
invariant(false, `route.generate() is used by TanStack Router's file-based routing code generation and should not actually be called during runtime. `);
|
|
634
|
+
};
|
|
624
635
|
}
|
|
625
|
-
|
|
626
636
|
class RootRoute extends Route {
|
|
627
637
|
constructor(options) {
|
|
628
638
|
super(options);
|
|
@@ -1246,7 +1256,7 @@
|
|
|
1246
1256
|
};
|
|
1247
1257
|
navigate = async ({
|
|
1248
1258
|
from,
|
|
1249
|
-
to = '
|
|
1259
|
+
to = '',
|
|
1250
1260
|
search,
|
|
1251
1261
|
hash,
|
|
1252
1262
|
replace,
|
|
@@ -1280,19 +1290,22 @@
|
|
|
1280
1290
|
to: location.to ? this.resolvePath(location.from ?? '', location.to) : undefined
|
|
1281
1291
|
};
|
|
1282
1292
|
const next = this.buildNext(location);
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
}
|
|
1287
|
-
return matchPathname(this.basepath, this.state.pendingLocation.pathname, {
|
|
1288
|
-
...opts,
|
|
1289
|
-
to: next.pathname
|
|
1290
|
-
});
|
|
1293
|
+
const baseLocation = opts?.pending ? this.state.pendingLocation : this.state.currentLocation;
|
|
1294
|
+
if (!baseLocation) {
|
|
1295
|
+
return false;
|
|
1291
1296
|
}
|
|
1292
|
-
|
|
1297
|
+
const match = matchPathname(this.basepath, baseLocation.pathname, {
|
|
1293
1298
|
...opts,
|
|
1294
1299
|
to: next.pathname
|
|
1295
1300
|
});
|
|
1301
|
+
if (!match) {
|
|
1302
|
+
return false;
|
|
1303
|
+
}
|
|
1304
|
+
if (opts?.includeSearch ?? true) {
|
|
1305
|
+
console.log(baseLocation.search, next.search, partialDeepEqual(baseLocation.search, next.search));
|
|
1306
|
+
return partialDeepEqual(baseLocation.search, next.search) ? match : false;
|
|
1307
|
+
}
|
|
1308
|
+
return match;
|
|
1296
1309
|
};
|
|
1297
1310
|
buildLink = ({
|
|
1298
1311
|
from,
|
|
@@ -1335,17 +1348,16 @@
|
|
|
1335
1348
|
const preloadDelay = userPreloadDelay ?? this.options.defaultPreloadDelay ?? 0;
|
|
1336
1349
|
|
|
1337
1350
|
// Compare path/hash for matches
|
|
1338
|
-
const pathIsEqual = this.state.currentLocation.pathname === next.pathname;
|
|
1339
1351
|
const currentPathSplit = this.state.currentLocation.pathname.split('/');
|
|
1340
1352
|
const nextPathSplit = next.pathname.split('/');
|
|
1341
1353
|
const pathIsFuzzyEqual = nextPathSplit.every((d, i) => d === currentPathSplit[i]);
|
|
1342
|
-
const hashIsEqual = this.state.currentLocation.hash === next.hash;
|
|
1343
1354
|
// Combine the matches based on user options
|
|
1344
|
-
const pathTest = activeOptions?.exact ?
|
|
1345
|
-
const hashTest = activeOptions?.includeHash ?
|
|
1355
|
+
const pathTest = activeOptions?.exact ? this.state.currentLocation.pathname === next.pathname : pathIsFuzzyEqual;
|
|
1356
|
+
const hashTest = activeOptions?.includeHash ? this.state.currentLocation.hash === next.hash : true;
|
|
1357
|
+
const searchTest = activeOptions?.includeSearch ?? true ? partialDeepEqual(this.state.currentLocation.search, next.search) : true;
|
|
1346
1358
|
|
|
1347
1359
|
// The final "active" test
|
|
1348
|
-
const isActive = pathTest && hashTest;
|
|
1360
|
+
const isActive = pathTest && hashTest && searchTest;
|
|
1349
1361
|
|
|
1350
1362
|
// The click handler
|
|
1351
1363
|
const handleClick = e => {
|
|
@@ -1478,8 +1490,9 @@
|
|
|
1478
1490
|
this.load();
|
|
1479
1491
|
};
|
|
1480
1492
|
#buildLocation = (dest = {}) => {
|
|
1493
|
+
dest.fromCurrent = dest.fromCurrent ?? dest.to === '';
|
|
1481
1494
|
const fromPathname = dest.fromCurrent ? this.state.latestLocation.pathname : dest.from ?? this.state.latestLocation.pathname;
|
|
1482
|
-
let pathname = resolvePath(this.basepath ?? '/', fromPathname, `${dest.to ?? '
|
|
1495
|
+
let pathname = resolvePath(this.basepath ?? '/', fromPathname, `${dest.to ?? ''}`);
|
|
1483
1496
|
const fromMatches = this.matchRoutes(this.state.latestLocation.pathname, {
|
|
1484
1497
|
strictParseParams: true
|
|
1485
1498
|
});
|
|
@@ -2042,6 +2055,7 @@
|
|
|
2042
2055
|
exports.matchesContext = matchesContext;
|
|
2043
2056
|
exports.parsePathname = parsePathname;
|
|
2044
2057
|
exports.parseSearchWith = parseSearchWith;
|
|
2058
|
+
exports.partialDeepEqual = partialDeepEqual;
|
|
2045
2059
|
exports.pick = pick;
|
|
2046
2060
|
exports.replaceEqualDeep = replaceEqualDeep;
|
|
2047
2061
|
exports.resolvePath = resolvePath;
|