react-router 7.13.0 → 7.13.1-pre.0
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/CHANGELOG.md +70 -20
- package/dist/development/{browser-BEPxnEBW.d.mts → browser-DzsJABDQ.d.mts} +3 -2
- package/dist/{production/browser-BEPxnEBW.d.mts → development/browser-sPQ7eaK4.d.ts} +3 -2
- package/dist/{production/chunk-GSFLVUYQ.mjs → development/chunk-BPFEYQ6M.mjs} +13 -4
- package/dist/{production/chunk-NGWWS4QJ.js → development/chunk-CGPAOPIJ.js} +7 -7
- package/dist/development/{chunk-WICQJKU6.js → chunk-LF5SS6XE.js} +203 -128
- package/dist/development/{chunk-HMDR2CVH.js → chunk-TC44ITIJ.js} +124 -107
- package/dist/development/{chunk-JZWAC4HX.mjs → chunk-WQZSGSJA.mjs} +153 -63
- package/dist/development/dom-export.d.mts +2 -2
- package/dist/development/dom-export.d.ts +2 -2
- package/dist/development/dom-export.js +34 -27
- package/dist/development/dom-export.mjs +10 -3
- package/dist/development/{index-react-server-client-1TI9M9o1.d.ts → index-react-server-client-C4tCIird.d.ts} +54 -2
- package/dist/development/{index-react-server-client-MKTlCGL3.d.mts → index-react-server-client-EzWJGpN_.d.mts} +54 -2
- package/dist/development/index-react-server-client.d.mts +2 -2
- package/dist/development/index-react-server-client.d.ts +2 -2
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.d.mts +12 -1
- package/dist/development/index-react-server.d.ts +12 -1
- package/dist/development/index-react-server.js +80 -44
- package/dist/development/index-react-server.mjs +80 -45
- package/dist/development/index.d.mts +11 -10
- package/dist/development/index.d.ts +11 -10
- package/dist/development/index.js +94 -85
- package/dist/development/index.mjs +3 -3
- package/dist/{production/instrumentation-DvHY1sgY.d.ts → development/instrumentation--6Pioq_G.d.ts} +14 -2
- package/dist/development/lib/types/internal.d.mts +4 -4
- package/dist/development/lib/types/internal.d.ts +4 -4
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{register-Bm80E9qL.d.ts → register-CBoanF80.d.ts} +1 -1
- package/dist/development/{register-CS_tiXsm.d.mts → register-cRYJ3CjG.d.mts} +1 -1
- package/dist/{production/router-5iOvts3c.d.mts → development/router-cLsU7kHk.d.mts} +14 -2
- package/dist/{development/browser-CJ9_du-U.d.ts → production/browser-DzsJABDQ.d.mts} +3 -2
- package/dist/production/{browser-CJ9_du-U.d.ts → browser-sPQ7eaK4.d.ts} +3 -2
- package/dist/production/{chunk-Y3R63HEB.mjs → chunk-2K4LVAAG.mjs} +153 -63
- package/dist/{development/chunk-7PAHGFS4.js → production/chunk-I63A6YSE.js} +7 -7
- package/dist/{development/chunk-4LKRSAEJ.mjs → production/chunk-ROHSFSEU.mjs} +13 -4
- package/dist/production/{chunk-QSNCZFX5.js → chunk-XCKC4VBJ.js} +203 -128
- package/dist/production/{chunk-N2HZAAIG.js → chunk-ZXYVKLN7.js} +124 -107
- package/dist/production/dom-export.d.mts +2 -2
- package/dist/production/dom-export.d.ts +2 -2
- package/dist/production/dom-export.js +34 -27
- package/dist/production/dom-export.mjs +10 -3
- package/dist/production/{index-react-server-client-1TI9M9o1.d.ts → index-react-server-client-C4tCIird.d.ts} +54 -2
- package/dist/production/{index-react-server-client-MKTlCGL3.d.mts → index-react-server-client-EzWJGpN_.d.mts} +54 -2
- package/dist/production/index-react-server-client.d.mts +2 -2
- package/dist/production/index-react-server-client.d.ts +2 -2
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.d.mts +12 -1
- package/dist/production/index-react-server.d.ts +12 -1
- package/dist/production/index-react-server.js +80 -44
- package/dist/production/index-react-server.mjs +80 -45
- package/dist/production/index.d.mts +11 -10
- package/dist/production/index.d.ts +11 -10
- package/dist/production/index.js +94 -85
- package/dist/production/index.mjs +3 -3
- package/dist/{development/instrumentation-DvHY1sgY.d.ts → production/instrumentation--6Pioq_G.d.ts} +14 -2
- package/dist/production/lib/types/internal.d.mts +4 -4
- package/dist/production/lib/types/internal.d.ts +4 -4
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/{register-Bm80E9qL.d.ts → register-CBoanF80.d.ts} +1 -1
- package/dist/production/{register-CS_tiXsm.d.mts → register-cRYJ3CjG.d.mts} +1 -1
- package/dist/{development/router-5iOvts3c.d.mts → production/router-cLsU7kHk.d.mts} +14 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.13.0
|
|
2
|
+
* react-router v7.13.1-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -23,6 +23,9 @@ var Action = /* @__PURE__ */ ((Action2) => {
|
|
|
23
23
|
return Action2;
|
|
24
24
|
})(Action || {});
|
|
25
25
|
var PopStateEventType = "popstate";
|
|
26
|
+
function isLocation(obj) {
|
|
27
|
+
return typeof obj === "object" && obj != null && "pathname" in obj && "search" in obj && "hash" in obj && "state" in obj && "key" in obj;
|
|
28
|
+
}
|
|
26
29
|
function createMemoryHistory(options = {}) {
|
|
27
30
|
let { initialEntries = ["/"], initialIndex, v5Compat = false } = options;
|
|
28
31
|
let entries;
|
|
@@ -30,7 +33,8 @@ function createMemoryHistory(options = {}) {
|
|
|
30
33
|
(entry, index2) => createMemoryLocation(
|
|
31
34
|
entry,
|
|
32
35
|
typeof entry === "string" ? null : entry.state,
|
|
33
|
-
index2 === 0 ? "default" : void 0
|
|
36
|
+
index2 === 0 ? "default" : void 0,
|
|
37
|
+
typeof entry === "string" ? void 0 : entry.unstable_mask
|
|
34
38
|
)
|
|
35
39
|
);
|
|
36
40
|
let index = clampIndex(
|
|
@@ -44,12 +48,13 @@ function createMemoryHistory(options = {}) {
|
|
|
44
48
|
function getCurrentLocation() {
|
|
45
49
|
return entries[index];
|
|
46
50
|
}
|
|
47
|
-
function createMemoryLocation(to, state = null, key) {
|
|
51
|
+
function createMemoryLocation(to, state = null, key, unstable_mask) {
|
|
48
52
|
let location = createLocation(
|
|
49
53
|
entries ? getCurrentLocation().pathname : "/",
|
|
50
54
|
to,
|
|
51
55
|
state,
|
|
52
|
-
key
|
|
56
|
+
key,
|
|
57
|
+
unstable_mask
|
|
53
58
|
);
|
|
54
59
|
warning(
|
|
55
60
|
location.pathname.charAt(0) === "/",
|
|
@@ -86,7 +91,7 @@ function createMemoryHistory(options = {}) {
|
|
|
86
91
|
},
|
|
87
92
|
push(to, state) {
|
|
88
93
|
action = "PUSH" /* Push */;
|
|
89
|
-
let nextLocation = createMemoryLocation(to, state);
|
|
94
|
+
let nextLocation = isLocation(to) ? to : createMemoryLocation(to, state);
|
|
90
95
|
index += 1;
|
|
91
96
|
entries.splice(index, entries.length, nextLocation);
|
|
92
97
|
if (v5Compat && listener) {
|
|
@@ -95,7 +100,7 @@ function createMemoryHistory(options = {}) {
|
|
|
95
100
|
},
|
|
96
101
|
replace(to, state) {
|
|
97
102
|
action = "REPLACE" /* Replace */;
|
|
98
|
-
let nextLocation = createMemoryLocation(to, state);
|
|
103
|
+
let nextLocation = isLocation(to) ? to : createMemoryLocation(to, state);
|
|
99
104
|
entries[index] = nextLocation;
|
|
100
105
|
if (v5Compat && listener) {
|
|
101
106
|
listener({ action, location: nextLocation, delta: 0 });
|
|
@@ -121,13 +126,19 @@ function createMemoryHistory(options = {}) {
|
|
|
121
126
|
}
|
|
122
127
|
function createBrowserHistory(options = {}) {
|
|
123
128
|
function createBrowserLocation(window2, globalHistory) {
|
|
124
|
-
let
|
|
129
|
+
let maskedLocation = globalHistory.state?.masked;
|
|
130
|
+
let { pathname, search, hash } = maskedLocation || window2.location;
|
|
125
131
|
return createLocation(
|
|
126
132
|
"",
|
|
127
133
|
{ pathname, search, hash },
|
|
128
134
|
// state defaults to `null` because `window.history.state` does
|
|
129
135
|
globalHistory.state && globalHistory.state.usr || null,
|
|
130
|
-
globalHistory.state && globalHistory.state.key || "default"
|
|
136
|
+
globalHistory.state && globalHistory.state.key || "default",
|
|
137
|
+
maskedLocation ? {
|
|
138
|
+
pathname: window2.location.pathname,
|
|
139
|
+
search: window2.location.search,
|
|
140
|
+
hash: window2.location.hash
|
|
141
|
+
} : void 0
|
|
131
142
|
);
|
|
132
143
|
}
|
|
133
144
|
function createBrowserHref(window2, to) {
|
|
@@ -204,10 +215,15 @@ function getHistoryState(location, index) {
|
|
|
204
215
|
return {
|
|
205
216
|
usr: location.state,
|
|
206
217
|
key: location.key,
|
|
207
|
-
idx: index
|
|
218
|
+
idx: index,
|
|
219
|
+
masked: location.unstable_mask ? {
|
|
220
|
+
pathname: location.pathname,
|
|
221
|
+
search: location.search,
|
|
222
|
+
hash: location.hash
|
|
223
|
+
} : void 0
|
|
208
224
|
};
|
|
209
225
|
}
|
|
210
|
-
function createLocation(current, to, state = null, key) {
|
|
226
|
+
function createLocation(current, to, state = null, key, unstable_mask) {
|
|
211
227
|
let location = {
|
|
212
228
|
pathname: typeof current === "string" ? current : current.pathname,
|
|
213
229
|
search: "",
|
|
@@ -218,7 +234,8 @@ function createLocation(current, to, state = null, key) {
|
|
|
218
234
|
// full Locations now and avoid the need to run through this flow at all
|
|
219
235
|
// But that's a pretty big refactor to the current test suite so going to
|
|
220
236
|
// keep as is for the time being and just let any incoming keys take precedence
|
|
221
|
-
key: to && to.key || key || createKey()
|
|
237
|
+
key: to && to.key || key || createKey(),
|
|
238
|
+
unstable_mask
|
|
222
239
|
};
|
|
223
240
|
return location;
|
|
224
241
|
}
|
|
@@ -277,11 +294,11 @@ function getUrlBasedHistory(getLocation, createHref2, validateLocation, options
|
|
|
277
294
|
}
|
|
278
295
|
function push(to, state) {
|
|
279
296
|
action = "PUSH" /* Push */;
|
|
280
|
-
let location = createLocation(history.location, to, state);
|
|
297
|
+
let location = isLocation(to) ? to : createLocation(history.location, to, state);
|
|
281
298
|
if (validateLocation) validateLocation(location, to);
|
|
282
299
|
index = getIndex() + 1;
|
|
283
300
|
let historyState = getHistoryState(location, index);
|
|
284
|
-
let url = history.createHref(location);
|
|
301
|
+
let url = history.createHref(location.unstable_mask || location);
|
|
285
302
|
try {
|
|
286
303
|
globalHistory.pushState(historyState, "", url);
|
|
287
304
|
} catch (error) {
|
|
@@ -296,11 +313,11 @@ function getUrlBasedHistory(getLocation, createHref2, validateLocation, options
|
|
|
296
313
|
}
|
|
297
314
|
function replace2(to, state) {
|
|
298
315
|
action = "REPLACE" /* Replace */;
|
|
299
|
-
let location = createLocation(history.location, to, state);
|
|
316
|
+
let location = isLocation(to) ? to : createLocation(history.location, to, state);
|
|
300
317
|
if (validateLocation) validateLocation(location, to);
|
|
301
318
|
index = getIndex();
|
|
302
319
|
let historyState = getHistoryState(location, index);
|
|
303
|
-
let url = history.createHref(location);
|
|
320
|
+
let url = history.createHref(location.unstable_mask || location);
|
|
304
321
|
globalHistory.replaceState(historyState, "", url);
|
|
305
322
|
if (v5Compat && listener) {
|
|
306
323
|
listener({ action, location: history.location, delta: 0 });
|
|
@@ -765,9 +782,16 @@ function compilePath(path, caseSensitive = false, end = true) {
|
|
|
765
782
|
let params = [];
|
|
766
783
|
let regexpSource = "^" + path.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(
|
|
767
784
|
/\/:([\w-]+)(\?)?/g,
|
|
768
|
-
(
|
|
785
|
+
(match, paramName, isOptional, index, str) => {
|
|
769
786
|
params.push({ paramName, isOptional: isOptional != null });
|
|
770
|
-
|
|
787
|
+
if (isOptional) {
|
|
788
|
+
let nextChar = str.charAt(index + match.length);
|
|
789
|
+
if (nextChar && nextChar !== "/") {
|
|
790
|
+
return "/([^\\/]*)";
|
|
791
|
+
}
|
|
792
|
+
return "(?:/([^\\/]*))?";
|
|
793
|
+
}
|
|
794
|
+
return "/([^\\/]+)";
|
|
771
795
|
}
|
|
772
796
|
).replace(/\/([\w-]+)\?(\/|$)/g, "(/$1)?$2");
|
|
773
797
|
if (path.endsWith("*")) {
|
|
@@ -1368,12 +1392,14 @@ function createRouter(init) {
|
|
|
1368
1392
|
let initialMatchesIsFOW = false;
|
|
1369
1393
|
let initialErrors = null;
|
|
1370
1394
|
let initialized;
|
|
1395
|
+
let renderFallback;
|
|
1371
1396
|
if (initialMatches == null && !init.patchRoutesOnNavigation) {
|
|
1372
1397
|
let error = getInternalRouterError(404, {
|
|
1373
1398
|
pathname: init.history.location.pathname
|
|
1374
1399
|
});
|
|
1375
1400
|
let { matches, route } = getShortCircuitMatches(dataRoutes);
|
|
1376
1401
|
initialized = true;
|
|
1402
|
+
renderFallback = !initialized;
|
|
1377
1403
|
initialMatches = matches;
|
|
1378
1404
|
initialErrors = { [route.id]: error };
|
|
1379
1405
|
} else {
|
|
@@ -1389,6 +1415,7 @@ function createRouter(init) {
|
|
|
1389
1415
|
}
|
|
1390
1416
|
if (!initialMatches) {
|
|
1391
1417
|
initialized = false;
|
|
1418
|
+
renderFallback = !initialized;
|
|
1392
1419
|
initialMatches = [];
|
|
1393
1420
|
let fogOfWar = checkFogOfWar(
|
|
1394
1421
|
null,
|
|
@@ -1401,23 +1428,26 @@ function createRouter(init) {
|
|
|
1401
1428
|
}
|
|
1402
1429
|
} else if (initialMatches.some((m) => m.route.lazy)) {
|
|
1403
1430
|
initialized = false;
|
|
1431
|
+
renderFallback = !initialized;
|
|
1404
1432
|
} else if (!initialMatches.some((m) => routeHasLoaderOrMiddleware(m.route))) {
|
|
1405
1433
|
initialized = true;
|
|
1434
|
+
renderFallback = !initialized;
|
|
1406
1435
|
} else {
|
|
1407
1436
|
let loaderData = init.hydrationData ? init.hydrationData.loaderData : null;
|
|
1408
1437
|
let errors = init.hydrationData ? init.hydrationData.errors : null;
|
|
1438
|
+
let relevantMatches = initialMatches;
|
|
1409
1439
|
if (errors) {
|
|
1410
1440
|
let idx = initialMatches.findIndex(
|
|
1411
1441
|
(m) => errors[m.route.id] !== void 0
|
|
1412
1442
|
);
|
|
1413
|
-
|
|
1414
|
-
(m) => !shouldLoadRouteOnHydration(m.route, loaderData, errors)
|
|
1415
|
-
);
|
|
1416
|
-
} else {
|
|
1417
|
-
initialized = initialMatches.every(
|
|
1418
|
-
(m) => !shouldLoadRouteOnHydration(m.route, loaderData, errors)
|
|
1419
|
-
);
|
|
1443
|
+
relevantMatches = relevantMatches.slice(0, idx + 1);
|
|
1420
1444
|
}
|
|
1445
|
+
renderFallback = false;
|
|
1446
|
+
initialized = relevantMatches.every((m) => {
|
|
1447
|
+
let status = getRouteHydrationStatus(m.route, loaderData, errors);
|
|
1448
|
+
renderFallback = renderFallback || status.renderFallback;
|
|
1449
|
+
return !status.shouldLoad;
|
|
1450
|
+
});
|
|
1421
1451
|
}
|
|
1422
1452
|
}
|
|
1423
1453
|
let router;
|
|
@@ -1426,6 +1456,7 @@ function createRouter(init) {
|
|
|
1426
1456
|
location: init.history.location,
|
|
1427
1457
|
matches: initialMatches,
|
|
1428
1458
|
initialized,
|
|
1459
|
+
renderFallback,
|
|
1429
1460
|
navigation: IDLE_NAVIGATION,
|
|
1430
1461
|
// Don't restore on initial updateState() if we were SSR'd
|
|
1431
1462
|
restoreScrollPosition: init.hydrationData != null ? false : null,
|
|
@@ -1653,6 +1684,7 @@ function createRouter(init) {
|
|
|
1653
1684
|
historyAction: pendingAction,
|
|
1654
1685
|
location,
|
|
1655
1686
|
initialized: true,
|
|
1687
|
+
renderFallback: false,
|
|
1656
1688
|
navigation: IDLE_NAVIGATION,
|
|
1657
1689
|
revalidation: "idle",
|
|
1658
1690
|
restoreScrollPosition,
|
|
@@ -1698,8 +1730,27 @@ function createRouter(init) {
|
|
|
1698
1730
|
normalizedPath,
|
|
1699
1731
|
opts
|
|
1700
1732
|
);
|
|
1733
|
+
let maskPath;
|
|
1734
|
+
if (opts?.unstable_mask) {
|
|
1735
|
+
let partialPath = typeof opts.unstable_mask === "string" ? parsePath(opts.unstable_mask) : {
|
|
1736
|
+
...state.location.unstable_mask,
|
|
1737
|
+
...opts.unstable_mask
|
|
1738
|
+
};
|
|
1739
|
+
maskPath = {
|
|
1740
|
+
pathname: "",
|
|
1741
|
+
search: "",
|
|
1742
|
+
hash: "",
|
|
1743
|
+
...partialPath
|
|
1744
|
+
};
|
|
1745
|
+
}
|
|
1701
1746
|
let currentLocation = state.location;
|
|
1702
|
-
let nextLocation = createLocation(
|
|
1747
|
+
let nextLocation = createLocation(
|
|
1748
|
+
currentLocation,
|
|
1749
|
+
path,
|
|
1750
|
+
opts && opts.state,
|
|
1751
|
+
void 0,
|
|
1752
|
+
maskPath
|
|
1753
|
+
);
|
|
1703
1754
|
nextLocation = {
|
|
1704
1755
|
...nextLocation,
|
|
1705
1756
|
...init.history.encodeLocation(nextLocation)
|
|
@@ -3989,11 +4040,12 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
|
|
|
3989
4040
|
} else if (!routeHasLoaderOrMiddleware(route)) {
|
|
3990
4041
|
forceShouldLoad = false;
|
|
3991
4042
|
} else if (initialHydration) {
|
|
3992
|
-
|
|
4043
|
+
let { shouldLoad: shouldLoad2 } = getRouteHydrationStatus(
|
|
3993
4044
|
route,
|
|
3994
4045
|
state.loaderData,
|
|
3995
4046
|
state.errors
|
|
3996
4047
|
);
|
|
4048
|
+
forceShouldLoad = shouldLoad2;
|
|
3997
4049
|
} else if (isNewLoader(state.loaderData, state.matches[index], match)) {
|
|
3998
4050
|
forceShouldLoad = true;
|
|
3999
4051
|
}
|
|
@@ -4141,22 +4193,23 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
|
|
|
4141
4193
|
function routeHasLoaderOrMiddleware(route) {
|
|
4142
4194
|
return route.loader != null || route.middleware != null && route.middleware.length > 0;
|
|
4143
4195
|
}
|
|
4144
|
-
function
|
|
4196
|
+
function getRouteHydrationStatus(route, loaderData, errors) {
|
|
4145
4197
|
if (route.lazy) {
|
|
4146
|
-
return true;
|
|
4198
|
+
return { shouldLoad: true, renderFallback: true };
|
|
4147
4199
|
}
|
|
4148
4200
|
if (!routeHasLoaderOrMiddleware(route)) {
|
|
4149
|
-
return false;
|
|
4201
|
+
return { shouldLoad: false, renderFallback: false };
|
|
4150
4202
|
}
|
|
4151
4203
|
let hasData = loaderData != null && route.id in loaderData;
|
|
4152
4204
|
let hasError = errors != null && errors[route.id] !== void 0;
|
|
4153
4205
|
if (!hasData && hasError) {
|
|
4154
|
-
return false;
|
|
4206
|
+
return { shouldLoad: false, renderFallback: false };
|
|
4155
4207
|
}
|
|
4156
4208
|
if (typeof route.loader === "function" && route.loader.hydrate === true) {
|
|
4157
|
-
return true;
|
|
4209
|
+
return { shouldLoad: true, renderFallback: !hasData };
|
|
4158
4210
|
}
|
|
4159
|
-
|
|
4211
|
+
let shouldLoad = !hasData && !hasError;
|
|
4212
|
+
return { shouldLoad, renderFallback: shouldLoad };
|
|
4160
4213
|
}
|
|
4161
4214
|
function isNewLoader(currentLoaderData, currentMatch, match) {
|
|
4162
4215
|
let isNew = (
|
|
@@ -4252,9 +4305,9 @@ function isSameRoute(newRoute, existingRoute) {
|
|
|
4252
4305
|
if ((!newRoute.children || newRoute.children.length === 0) && (!existingRoute.children || existingRoute.children.length === 0)) {
|
|
4253
4306
|
return true;
|
|
4254
4307
|
}
|
|
4255
|
-
return newRoute.children
|
|
4308
|
+
return newRoute.children?.every(
|
|
4256
4309
|
(aChild, i) => existingRoute.children?.some((bChild) => isSameRoute(aChild, bChild))
|
|
4257
|
-
);
|
|
4310
|
+
) ?? false;
|
|
4258
4311
|
}
|
|
4259
4312
|
var lazyRoutePropertyCache = /* @__PURE__ */ new WeakMap();
|
|
4260
4313
|
var loadLazyRouteProperty = ({
|
|
@@ -5634,7 +5687,7 @@ function useResolvedPath(to, { relative } = {}) {
|
|
|
5634
5687
|
function useRoutes(routes, locationArg) {
|
|
5635
5688
|
return useRoutesImpl(routes, locationArg);
|
|
5636
5689
|
}
|
|
5637
|
-
function useRoutesImpl(routes, locationArg,
|
|
5690
|
+
function useRoutesImpl(routes, locationArg, dataRouterOpts) {
|
|
5638
5691
|
invariant(
|
|
5639
5692
|
useInRouterContext(),
|
|
5640
5693
|
// TODO: This error is probably because they somehow have 2 versions of the
|
|
@@ -5715,9 +5768,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
5715
5768
|
})
|
|
5716
5769
|
),
|
|
5717
5770
|
parentMatches,
|
|
5718
|
-
|
|
5719
|
-
onError,
|
|
5720
|
-
future
|
|
5771
|
+
dataRouterOpts
|
|
5721
5772
|
);
|
|
5722
5773
|
if (locationArg && renderedMatches) {
|
|
5723
5774
|
return /* @__PURE__ */ React2.createElement(
|
|
@@ -5730,6 +5781,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
5730
5781
|
hash: "",
|
|
5731
5782
|
state: null,
|
|
5732
5783
|
key: "default",
|
|
5784
|
+
unstable_mask: void 0,
|
|
5733
5785
|
...location
|
|
5734
5786
|
},
|
|
5735
5787
|
navigationType: "POP" /* Pop */
|
|
@@ -5857,7 +5909,8 @@ function RenderedRoute({ routeContext, match, children }) {
|
|
|
5857
5909
|
}
|
|
5858
5910
|
return /* @__PURE__ */ React2.createElement(RouteContext.Provider, { value: routeContext }, children);
|
|
5859
5911
|
}
|
|
5860
|
-
function _renderMatches(matches, parentMatches = [],
|
|
5912
|
+
function _renderMatches(matches, parentMatches = [], dataRouterOpts) {
|
|
5913
|
+
let dataRouterState = dataRouterOpts?.state;
|
|
5861
5914
|
if (matches == null) {
|
|
5862
5915
|
if (!dataRouterState) {
|
|
5863
5916
|
return null;
|
|
@@ -5889,7 +5942,8 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, onE
|
|
|
5889
5942
|
}
|
|
5890
5943
|
let renderFallback = false;
|
|
5891
5944
|
let fallbackIndex = -1;
|
|
5892
|
-
if (dataRouterState) {
|
|
5945
|
+
if (dataRouterOpts && dataRouterState) {
|
|
5946
|
+
renderFallback = dataRouterState.renderFallback;
|
|
5893
5947
|
for (let i = 0; i < renderedMatches.length; i++) {
|
|
5894
5948
|
let match = renderedMatches[i];
|
|
5895
5949
|
if (match.route.HydrateFallback || match.route.hydrateFallbackElement) {
|
|
@@ -5899,7 +5953,9 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, onE
|
|
|
5899
5953
|
let { loaderData, errors: errors2 } = dataRouterState;
|
|
5900
5954
|
let needsToRunLoader = match.route.loader && !loaderData.hasOwnProperty(match.route.id) && (!errors2 || errors2[match.route.id] === void 0);
|
|
5901
5955
|
if (match.route.lazy || needsToRunLoader) {
|
|
5902
|
-
|
|
5956
|
+
if (dataRouterOpts.isStatic) {
|
|
5957
|
+
renderFallback = true;
|
|
5958
|
+
}
|
|
5903
5959
|
if (fallbackIndex >= 0) {
|
|
5904
5960
|
renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);
|
|
5905
5961
|
} else {
|
|
@@ -5910,6 +5966,7 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, onE
|
|
|
5910
5966
|
}
|
|
5911
5967
|
}
|
|
5912
5968
|
}
|
|
5969
|
+
let onErrorHandler = dataRouterOpts?.onError;
|
|
5913
5970
|
let onError = dataRouterState && onErrorHandler ? (error, errorInfo) => {
|
|
5914
5971
|
onErrorHandler(error, {
|
|
5915
5972
|
location: dataRouterState.location,
|
|
@@ -6478,6 +6535,7 @@ function RouterProvider({
|
|
|
6478
6535
|
routes: router.routes,
|
|
6479
6536
|
future: router.future,
|
|
6480
6537
|
state,
|
|
6538
|
+
isStatic: false,
|
|
6481
6539
|
onError
|
|
6482
6540
|
}
|
|
6483
6541
|
)
|
|
@@ -6502,9 +6560,10 @@ function DataRoutes({
|
|
|
6502
6560
|
routes,
|
|
6503
6561
|
future,
|
|
6504
6562
|
state,
|
|
6563
|
+
isStatic,
|
|
6505
6564
|
onError
|
|
6506
6565
|
}) {
|
|
6507
|
-
return useRoutesImpl(routes, void 0, state, onError, future);
|
|
6566
|
+
return useRoutesImpl(routes, void 0, { state, isStatic, onError, future });
|
|
6508
6567
|
}
|
|
6509
6568
|
function MemoryRouter({
|
|
6510
6569
|
basename,
|
|
@@ -6622,7 +6681,8 @@ function Router({
|
|
|
6622
6681
|
search = "",
|
|
6623
6682
|
hash = "",
|
|
6624
6683
|
state = null,
|
|
6625
|
-
key = "default"
|
|
6684
|
+
key = "default",
|
|
6685
|
+
unstable_mask
|
|
6626
6686
|
} = locationProp;
|
|
6627
6687
|
let locationContext = React3.useMemo(() => {
|
|
6628
6688
|
let trailingPathname = stripBasename(pathname, basename);
|
|
@@ -6635,11 +6695,21 @@ function Router({
|
|
|
6635
6695
|
search,
|
|
6636
6696
|
hash,
|
|
6637
6697
|
state,
|
|
6638
|
-
key
|
|
6698
|
+
key,
|
|
6699
|
+
unstable_mask
|
|
6639
6700
|
},
|
|
6640
6701
|
navigationType
|
|
6641
6702
|
};
|
|
6642
|
-
}, [
|
|
6703
|
+
}, [
|
|
6704
|
+
basename,
|
|
6705
|
+
pathname,
|
|
6706
|
+
search,
|
|
6707
|
+
hash,
|
|
6708
|
+
state,
|
|
6709
|
+
key,
|
|
6710
|
+
navigationType,
|
|
6711
|
+
unstable_mask
|
|
6712
|
+
]);
|
|
6643
6713
|
warning(
|
|
6644
6714
|
locationContext != null,
|
|
6645
6715
|
`<Router basename="${basename}"> is not able to match the URL "${pathname}${search}${hash}" because it does not start with the basename, so the <Router> won't render anything.`
|
|
@@ -7533,7 +7603,7 @@ async function decodeDeferred(reader) {
|
|
|
7533
7603
|
}
|
|
7534
7604
|
}
|
|
7535
7605
|
function encode(input, options) {
|
|
7536
|
-
const { plugins, postPlugins, signal } = options ?? {};
|
|
7606
|
+
const { plugins, postPlugins, signal, onComplete } = options ?? {};
|
|
7537
7607
|
const encoder = {
|
|
7538
7608
|
deferred: {},
|
|
7539
7609
|
index: 0,
|
|
@@ -7659,6 +7729,7 @@ function encode(input, options) {
|
|
|
7659
7729
|
raceDone();
|
|
7660
7730
|
}
|
|
7661
7731
|
await Promise.all(Object.values(encoder.deferred));
|
|
7732
|
+
onComplete?.();
|
|
7662
7733
|
controller.close();
|
|
7663
7734
|
}
|
|
7664
7735
|
});
|
|
@@ -8916,7 +8987,7 @@ function getPartialManifest({ sri, ...manifest }, router) {
|
|
|
8916
8987
|
sri: sri ? true : void 0
|
|
8917
8988
|
};
|
|
8918
8989
|
}
|
|
8919
|
-
function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDiscovery, isSpaMode, basename) {
|
|
8990
|
+
function getPatchRoutesOnNavigationFunction(getRouter, manifest, routeModules, ssr, routeDiscovery, isSpaMode, basename) {
|
|
8920
8991
|
if (!isFogOfWarEnabled(routeDiscovery, ssr)) {
|
|
8921
8992
|
return void 0;
|
|
8922
8993
|
}
|
|
@@ -8924,9 +8995,12 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDi
|
|
|
8924
8995
|
if (discoveredPaths.has(path)) {
|
|
8925
8996
|
return;
|
|
8926
8997
|
}
|
|
8998
|
+
let { state } = getRouter();
|
|
8927
8999
|
await fetchAndApplyManifestPatches(
|
|
8928
9000
|
[path],
|
|
8929
|
-
|
|
9001
|
+
// If we're patching for a fetcher call, reload the current location
|
|
9002
|
+
// Otherwise prefer any ongoing navigation location
|
|
9003
|
+
fetcherKey ? window.location.href : createPath(state.navigation.location || state.location),
|
|
8930
9004
|
manifest,
|
|
8931
9005
|
routeModules,
|
|
8932
9006
|
ssr,
|
|
@@ -9412,7 +9486,7 @@ function Meta() {
|
|
|
9412
9486
|
routeMeta = routeMeta || [];
|
|
9413
9487
|
if (!Array.isArray(routeMeta)) {
|
|
9414
9488
|
throw new Error(
|
|
9415
|
-
"The route at " + _match.route.path + " returns an invalid value. All route meta functions must return an array of meta objects.\n\nTo reference the meta function API, see https://
|
|
9489
|
+
"The route at " + _match.route.path + " returns an invalid value. All route meta functions must return an array of meta objects.\n\nTo reference the meta function API, see https://reactrouter.com/start/framework/route-module#meta"
|
|
9416
9490
|
);
|
|
9417
9491
|
}
|
|
9418
9492
|
match.meta = routeMeta;
|
|
@@ -9745,7 +9819,7 @@ var isBrowser2 = typeof window !== "undefined" && typeof window.document !== "un
|
|
|
9745
9819
|
try {
|
|
9746
9820
|
if (isBrowser2) {
|
|
9747
9821
|
window.__reactRouterVersion = // @ts-expect-error
|
|
9748
|
-
"7.13.0";
|
|
9822
|
+
"7.13.1-pre.0";
|
|
9749
9823
|
}
|
|
9750
9824
|
} catch (e) {
|
|
9751
9825
|
}
|
|
@@ -9945,6 +10019,7 @@ var Link = React10.forwardRef(
|
|
|
9945
10019
|
relative,
|
|
9946
10020
|
reloadDocument,
|
|
9947
10021
|
replace: replace2,
|
|
10022
|
+
unstable_mask,
|
|
9948
10023
|
state,
|
|
9949
10024
|
target,
|
|
9950
10025
|
to,
|
|
@@ -9953,17 +10028,32 @@ var Link = React10.forwardRef(
|
|
|
9953
10028
|
unstable_defaultShouldRevalidate,
|
|
9954
10029
|
...rest
|
|
9955
10030
|
}, forwardedRef) {
|
|
9956
|
-
let { basename, unstable_useTransitions } = React10.useContext(NavigationContext);
|
|
10031
|
+
let { basename, navigator, unstable_useTransitions } = React10.useContext(NavigationContext);
|
|
9957
10032
|
let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX2.test(to);
|
|
9958
10033
|
let parsed = parseToInfo(to, basename);
|
|
9959
10034
|
to = parsed.to;
|
|
9960
10035
|
let href = useHref(to, { relative });
|
|
10036
|
+
let location = useLocation();
|
|
10037
|
+
let maskedHref = null;
|
|
10038
|
+
if (unstable_mask) {
|
|
10039
|
+
let resolved = resolveTo(
|
|
10040
|
+
unstable_mask,
|
|
10041
|
+
[],
|
|
10042
|
+
location.unstable_mask ? location.unstable_mask.pathname : "/",
|
|
10043
|
+
true
|
|
10044
|
+
);
|
|
10045
|
+
if (basename !== "/") {
|
|
10046
|
+
resolved.pathname = resolved.pathname === "/" ? basename : joinPaths([basename, resolved.pathname]);
|
|
10047
|
+
}
|
|
10048
|
+
maskedHref = navigator.createHref(resolved);
|
|
10049
|
+
}
|
|
9961
10050
|
let [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(
|
|
9962
10051
|
prefetch,
|
|
9963
10052
|
rest
|
|
9964
10053
|
);
|
|
9965
10054
|
let internalOnClick = useLinkClickHandler(to, {
|
|
9966
10055
|
replace: replace2,
|
|
10056
|
+
unstable_mask,
|
|
9967
10057
|
state,
|
|
9968
10058
|
target,
|
|
9969
10059
|
preventScrollReset,
|
|
@@ -9978,6 +10068,7 @@ var Link = React10.forwardRef(
|
|
|
9978
10068
|
internalOnClick(event);
|
|
9979
10069
|
}
|
|
9980
10070
|
}
|
|
10071
|
+
let isSpaLink = !(parsed.isExternal || reloadDocument);
|
|
9981
10072
|
let link = (
|
|
9982
10073
|
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
9983
10074
|
/* @__PURE__ */ React10.createElement(
|
|
@@ -9985,8 +10076,8 @@ var Link = React10.forwardRef(
|
|
|
9985
10076
|
{
|
|
9986
10077
|
...rest,
|
|
9987
10078
|
...prefetchHandlers,
|
|
9988
|
-
href: parsed.absoluteURL || href,
|
|
9989
|
-
onClick:
|
|
10079
|
+
href: (isSpaLink ? maskedHref : void 0) || parsed.absoluteURL || href,
|
|
10080
|
+
onClick: isSpaLink ? handleClick : onClick,
|
|
9990
10081
|
ref: mergeRefs(forwardedRef, prefetchRef),
|
|
9991
10082
|
target,
|
|
9992
10083
|
"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
|
|
@@ -10197,6 +10288,7 @@ function useDataRouterState2(hookName) {
|
|
|
10197
10288
|
function useLinkClickHandler(to, {
|
|
10198
10289
|
target,
|
|
10199
10290
|
replace: replaceProp,
|
|
10291
|
+
unstable_mask,
|
|
10200
10292
|
state,
|
|
10201
10293
|
preventScrollReset,
|
|
10202
10294
|
relative,
|
|
@@ -10214,6 +10306,7 @@ function useLinkClickHandler(to, {
|
|
|
10214
10306
|
let replace2 = replaceProp !== void 0 ? replaceProp : createPath(location) === createPath(path);
|
|
10215
10307
|
let doNavigate = () => navigate(to, {
|
|
10216
10308
|
replace: replace2,
|
|
10309
|
+
unstable_mask,
|
|
10217
10310
|
state,
|
|
10218
10311
|
preventScrollReset,
|
|
10219
10312
|
relative,
|
|
@@ -10232,6 +10325,7 @@ function useLinkClickHandler(to, {
|
|
|
10232
10325
|
navigate,
|
|
10233
10326
|
path,
|
|
10234
10327
|
replaceProp,
|
|
10328
|
+
unstable_mask,
|
|
10235
10329
|
state,
|
|
10236
10330
|
target,
|
|
10237
10331
|
to,
|
|
@@ -10612,7 +10706,8 @@ function StaticRouter({
|
|
|
10612
10706
|
search: locationProp.search || "",
|
|
10613
10707
|
hash: locationProp.hash || "",
|
|
10614
10708
|
state: locationProp.state != null ? locationProp.state : null,
|
|
10615
|
-
key: locationProp.key || "default"
|
|
10709
|
+
key: locationProp.key || "default",
|
|
10710
|
+
unstable_mask: void 0
|
|
10616
10711
|
};
|
|
10617
10712
|
let staticNavigator = getStatelessNavigator();
|
|
10618
10713
|
return /* @__PURE__ */ React11.createElement(
|
|
@@ -10668,11 +10763,12 @@ function StaticRouterProvider({
|
|
|
10668
10763
|
unstable_useTransitions: false
|
|
10669
10764
|
},
|
|
10670
10765
|
/* @__PURE__ */ React11.createElement(
|
|
10671
|
-
|
|
10766
|
+
DataRoutes,
|
|
10672
10767
|
{
|
|
10673
10768
|
routes: router.routes,
|
|
10674
10769
|
future: router.future,
|
|
10675
|
-
state
|
|
10770
|
+
state,
|
|
10771
|
+
isStatic: true
|
|
10676
10772
|
}
|
|
10677
10773
|
)
|
|
10678
10774
|
))))), hydrateScript ? /* @__PURE__ */ React11.createElement(
|
|
@@ -10684,13 +10780,6 @@ function StaticRouterProvider({
|
|
|
10684
10780
|
}
|
|
10685
10781
|
) : null);
|
|
10686
10782
|
}
|
|
10687
|
-
function DataRoutes2({
|
|
10688
|
-
routes,
|
|
10689
|
-
future,
|
|
10690
|
-
state
|
|
10691
|
-
}) {
|
|
10692
|
-
return useRoutesImpl(routes, void 0, state, void 0, future);
|
|
10693
|
-
}
|
|
10694
10783
|
function serializeErrors(errors) {
|
|
10695
10784
|
if (!errors) return null;
|
|
10696
10785
|
let entries = Object.entries(errors);
|
|
@@ -10786,6 +10875,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
10786
10875
|
actionData: context.actionData,
|
|
10787
10876
|
errors: context.errors,
|
|
10788
10877
|
initialized: true,
|
|
10878
|
+
renderFallback: false,
|
|
10789
10879
|
navigation: IDLE_NAVIGATION,
|
|
10790
10880
|
restoreScrollPosition: null,
|
|
10791
10881
|
preventScrollReset: false,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }/**
|
|
2
|
-
* react-router v7.13.0
|
|
2
|
+
* react-router v7.13.1-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkXCKC4VBJjs = require('./chunk-XCKC4VBJ.js');
|
|
18
18
|
|
|
19
19
|
// lib/dom/ssr/hydration.tsx
|
|
20
20
|
function getHydrationData({
|
|
@@ -29,12 +29,12 @@ function getHydrationData({
|
|
|
29
29
|
...state,
|
|
30
30
|
loaderData: { ...state.loaderData }
|
|
31
31
|
};
|
|
32
|
-
let initialMatches =
|
|
32
|
+
let initialMatches = _chunkXCKC4VBJjs.matchRoutes.call(void 0, routes, location, basename);
|
|
33
33
|
if (initialMatches) {
|
|
34
34
|
for (let match of initialMatches) {
|
|
35
35
|
let routeId = match.route.id;
|
|
36
36
|
let routeInfo = getRouteInfo(routeId);
|
|
37
|
-
if (
|
|
37
|
+
if (_chunkXCKC4VBJjs.shouldHydrateRouteLoader.call(void 0,
|
|
38
38
|
routeId,
|
|
39
39
|
routeInfo.clientLoader,
|
|
40
40
|
routeInfo.hasLoader,
|
|
@@ -112,7 +112,7 @@ function RSCDefaultRootErrorBoundaryImpl({
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
);
|
|
115
|
-
if (
|
|
115
|
+
if (_chunkXCKC4VBJjs.isRouteErrorResponse.call(void 0, error)) {
|
|
116
116
|
return /* @__PURE__ */ _react2.default.createElement(
|
|
117
117
|
ErrorWrapper,
|
|
118
118
|
{
|
|
@@ -120,7 +120,7 @@ function RSCDefaultRootErrorBoundaryImpl({
|
|
|
120
120
|
title: "Unhandled Thrown Response!"
|
|
121
121
|
},
|
|
122
122
|
/* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText),
|
|
123
|
-
|
|
123
|
+
_chunkXCKC4VBJjs.ENABLE_DEV_WARNINGS ? heyDeveloper : null
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
126
|
let errorInstance;
|
|
@@ -146,7 +146,7 @@ function RSCDefaultRootErrorBoundaryImpl({
|
|
|
146
146
|
function RSCDefaultRootErrorBoundary({
|
|
147
147
|
hasRootLayout
|
|
148
148
|
}) {
|
|
149
|
-
let error =
|
|
149
|
+
let error = _chunkXCKC4VBJjs.useRouteError.call(void 0, );
|
|
150
150
|
if (hasRootLayout === void 0) {
|
|
151
151
|
throw new Error("Missing 'hasRootLayout' prop");
|
|
152
152
|
}
|