react-router 7.14.1 → 7.15.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 +105 -0
- package/dist/development/{browser-D-3-U2Jj.d.mts → browser-CRsXgNrY.d.mts} +2 -2
- package/dist/{production/browser-D-3-U2Jj.d.mts → development/browser-wDl1FZEL.d.ts} +2 -2
- package/dist/{production/chunk-3SUPTI2U.js → development/chunk-2D5H3HU3.js} +7 -7
- package/dist/development/{chunk-OE4NN4TA.mjs → chunk-5KNZJZUH.mjs} +362 -213
- package/dist/development/{chunk-YMKMFAYZ.js → chunk-AM3XM4LS.js} +314 -172
- package/dist/development/{chunk-BFXCU3MI.mjs → chunk-RMD3H4O3.mjs} +81 -62
- package/dist/development/{chunk-3F6IB66O.js → chunk-Z5YQYACE.js} +146 -139
- package/dist/{production/context-BzhbVly6.d.mts → development/context-BQs41HrG.d.mts} +94 -42
- package/dist/development/{routeModules-CM_clkdE.d.ts → data-BVUf681J.d.mts} +89 -56
- package/dist/{production/routeModules-CM_clkdE.d.ts → development/data-BqZ2x964.d.ts} +79 -46
- package/dist/development/dom-export.d.mts +9 -9
- package/dist/development/dom-export.d.ts +9 -9
- package/dist/development/dom-export.js +37 -40
- package/dist/development/dom-export.mjs +12 -15
- package/dist/development/{index-react-server-client-CimaPp9o.d.ts → index-react-server-client-CSv-KZBk.d.ts} +123 -121
- package/dist/{production/index-react-server-client-WSaoxloq.d.mts → development/index-react-server-client-Ck_yZ1qL.d.mts} +102 -100
- package/dist/development/index-react-server-client.d.mts +3 -3
- package/dist/development/index-react-server-client.d.ts +3 -3
- 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 +107 -36
- package/dist/development/index-react-server.d.ts +107 -36
- package/dist/development/index-react-server.js +60 -33
- package/dist/development/index-react-server.mjs +60 -33
- package/dist/development/index.d.mts +11 -11
- package/dist/development/index.d.ts +11 -11
- package/dist/development/index.js +174 -155
- package/dist/development/index.mjs +3 -3
- package/dist/{production/instrumentation-CMVbvxj9.d.ts → development/instrumentation-DlJ2QV7d.d.ts} +73 -21
- package/dist/development/lib/types/internal.d.mts +2 -2
- package/dist/development/lib/types/internal.d.ts +2 -2
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{register-D1WlEpq9.d.ts → register-Bsscfj79.d.ts} +1 -1
- package/dist/{production/register-D1WlEpq9.d.ts → development/register-Df8okEea.d.mts} +1 -1
- package/dist/production/{browser-CtktEGQs.d.ts → browser-CRsXgNrY.d.mts} +2 -2
- package/dist/{development/browser-CtktEGQs.d.ts → production/browser-wDl1FZEL.d.ts} +2 -2
- package/dist/production/{chunk-G5ZWO7Q6.mjs → chunk-23ZOHYE5.mjs} +81 -62
- package/dist/{development/chunk-7VLQJKNG.js → production/chunk-7YXKJMLN.js} +7 -7
- package/dist/production/{chunk-SPR7R4GU.mjs → chunk-GM3PW4GX.mjs} +362 -213
- package/dist/production/{chunk-UVEQGZIH.js → chunk-LCJTIOKZ.js} +314 -172
- package/dist/production/{chunk-LIOP3ILM.js → chunk-YBQJ3ABE.js} +146 -139
- package/dist/{development/context-BzhbVly6.d.mts → production/context-BQs41HrG.d.mts} +94 -42
- package/dist/{development/routeModules-Djumx26z.d.mts → production/data-BVUf681J.d.mts} +79 -46
- package/dist/production/{routeModules-Djumx26z.d.mts → data-BqZ2x964.d.ts} +89 -56
- package/dist/production/dom-export.d.mts +9 -9
- package/dist/production/dom-export.d.ts +9 -9
- package/dist/production/dom-export.js +37 -40
- package/dist/production/dom-export.mjs +12 -15
- package/dist/production/{index-react-server-client-CimaPp9o.d.ts → index-react-server-client-CSv-KZBk.d.ts} +123 -121
- package/dist/{development/index-react-server-client-WSaoxloq.d.mts → production/index-react-server-client-Ck_yZ1qL.d.mts} +102 -100
- package/dist/production/index-react-server-client.d.mts +3 -3
- package/dist/production/index-react-server-client.d.ts +3 -3
- 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 +107 -36
- package/dist/production/index-react-server.d.ts +107 -36
- package/dist/production/index-react-server.js +60 -33
- package/dist/production/index-react-server.mjs +60 -33
- package/dist/production/index.d.mts +11 -11
- package/dist/production/index.d.ts +11 -11
- package/dist/production/index.js +174 -155
- package/dist/production/index.mjs +3 -3
- package/dist/{development/instrumentation-CMVbvxj9.d.ts → production/instrumentation-DlJ2QV7d.d.ts} +73 -21
- package/dist/production/lib/types/internal.d.mts +2 -2
- package/dist/production/lib/types/internal.d.ts +2 -2
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/{development/register-aE9ob3TK.d.mts → production/register-Bsscfj79.d.ts} +1 -1
- package/dist/production/{register-aE9ob3TK.d.mts → register-Df8okEea.d.mts} +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
|
|
2
|
-
* react-router v7.
|
|
2
|
+
* react-router v7.15.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -14,6 +14,7 @@ var __typeError = (msg) => {
|
|
|
14
14
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
15
15
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
16
16
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
17
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
17
18
|
|
|
18
19
|
// lib/router/history.ts
|
|
19
20
|
var Action = /* @__PURE__ */ ((Action2) => {
|
|
@@ -34,7 +35,7 @@ function createMemoryHistory(options = {}) {
|
|
|
34
35
|
entry,
|
|
35
36
|
typeof entry === "string" ? null : entry.state,
|
|
36
37
|
index2 === 0 ? "default" : void 0,
|
|
37
|
-
typeof entry === "string" ? void 0 : entry.
|
|
38
|
+
typeof entry === "string" ? void 0 : entry.mask
|
|
38
39
|
)
|
|
39
40
|
);
|
|
40
41
|
let index = clampIndex(
|
|
@@ -48,13 +49,13 @@ function createMemoryHistory(options = {}) {
|
|
|
48
49
|
function getCurrentLocation() {
|
|
49
50
|
return entries[index];
|
|
50
51
|
}
|
|
51
|
-
function createMemoryLocation(to, state = null, key,
|
|
52
|
+
function createMemoryLocation(to, state = null, key, mask) {
|
|
52
53
|
let location = createLocation(
|
|
53
54
|
entries ? getCurrentLocation().pathname : "/",
|
|
54
55
|
to,
|
|
55
56
|
state,
|
|
56
57
|
key,
|
|
57
|
-
|
|
58
|
+
mask
|
|
58
59
|
);
|
|
59
60
|
warning(
|
|
60
61
|
location.pathname.charAt(0) === "/",
|
|
@@ -216,14 +217,14 @@ function getHistoryState(location, index) {
|
|
|
216
217
|
usr: location.state,
|
|
217
218
|
key: location.key,
|
|
218
219
|
idx: index,
|
|
219
|
-
masked: location.
|
|
220
|
+
masked: location.mask ? {
|
|
220
221
|
pathname: location.pathname,
|
|
221
222
|
search: location.search,
|
|
222
223
|
hash: location.hash
|
|
223
224
|
} : void 0
|
|
224
225
|
};
|
|
225
226
|
}
|
|
226
|
-
function createLocation(current, to, state = null, key,
|
|
227
|
+
function createLocation(current, to, state = null, key, mask) {
|
|
227
228
|
let location = {
|
|
228
229
|
pathname: typeof current === "string" ? current : current.pathname,
|
|
229
230
|
search: "",
|
|
@@ -235,7 +236,7 @@ function createLocation(current, to, state = null, key, unstable_mask) {
|
|
|
235
236
|
// But that's a pretty big refactor to the current test suite so going to
|
|
236
237
|
// keep as is for the time being and just let any incoming keys take precedence
|
|
237
238
|
key: to && to.key || key || createKey(),
|
|
238
|
-
|
|
239
|
+
mask
|
|
239
240
|
};
|
|
240
241
|
return location;
|
|
241
242
|
}
|
|
@@ -298,7 +299,7 @@ function getUrlBasedHistory(getLocation, createHref, validateLocation, options =
|
|
|
298
299
|
if (validateLocation) validateLocation(location, to);
|
|
299
300
|
index = getIndex() + 1;
|
|
300
301
|
let historyState = getHistoryState(location, index);
|
|
301
|
-
let url = history.createHref(location.
|
|
302
|
+
let url = history.createHref(location.mask || location);
|
|
302
303
|
try {
|
|
303
304
|
globalHistory.pushState(historyState, "", url);
|
|
304
305
|
} catch (error) {
|
|
@@ -317,7 +318,7 @@ function getUrlBasedHistory(getLocation, createHref, validateLocation, options =
|
|
|
317
318
|
if (validateLocation) validateLocation(location, to);
|
|
318
319
|
index = getIndex();
|
|
319
320
|
let historyState = getHistoryState(location, index);
|
|
320
|
-
let url = history.createHref(location.
|
|
321
|
+
let url = history.createHref(location.mask || location);
|
|
321
322
|
globalHistory.replaceState(historyState, "", url);
|
|
322
323
|
if (v5Compat && listener) {
|
|
323
324
|
listener({ action, location: history.location, delta: 0 });
|
|
@@ -515,17 +516,16 @@ function mergeRouteUpdates(route, updates) {
|
|
|
515
516
|
function matchRoutes(routes, locationArg, basename = "/") {
|
|
516
517
|
return matchRoutesImpl(routes, locationArg, basename, false);
|
|
517
518
|
}
|
|
518
|
-
function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
|
|
519
|
+
function matchRoutesImpl(routes, locationArg, basename, allowPartial, precomputedBranches) {
|
|
519
520
|
let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
|
520
521
|
let pathname = stripBasename(location.pathname || "/", basename);
|
|
521
522
|
if (pathname == null) {
|
|
522
523
|
return null;
|
|
523
524
|
}
|
|
524
|
-
let branches =
|
|
525
|
-
rankRouteBranches(branches);
|
|
525
|
+
let branches = _nullishCoalesce(precomputedBranches, () => ( flattenAndRankRoutes(routes)));
|
|
526
526
|
let matches = null;
|
|
527
|
+
let decoded = decodePath(pathname);
|
|
527
528
|
for (let i = 0; matches == null && i < branches.length; ++i) {
|
|
528
|
-
let decoded = decodePath(pathname);
|
|
529
529
|
matches = matchRouteBranch(
|
|
530
530
|
branches[i],
|
|
531
531
|
decoded,
|
|
@@ -545,6 +545,11 @@ function convertRouteMatchToUiMatch(match, loaderData) {
|
|
|
545
545
|
handle: route.handle
|
|
546
546
|
};
|
|
547
547
|
}
|
|
548
|
+
function flattenAndRankRoutes(routes) {
|
|
549
|
+
let branches = flattenRoutes(routes);
|
|
550
|
+
rankRouteBranches(branches);
|
|
551
|
+
return branches;
|
|
552
|
+
}
|
|
548
553
|
function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) {
|
|
549
554
|
let flattenRoute = (route, index, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {
|
|
550
555
|
let meta = {
|
|
@@ -723,8 +728,7 @@ function generatePath(originalPath, params = {}) {
|
|
|
723
728
|
const segments = path.split(/\/+/).map((segment, index, array) => {
|
|
724
729
|
const isLastSegment = index === array.length - 1;
|
|
725
730
|
if (isLastSegment && segment === "*") {
|
|
726
|
-
|
|
727
|
-
return stringify2(params[star]);
|
|
731
|
+
return stringify2(params["*"]);
|
|
728
732
|
}
|
|
729
733
|
const keyMatch = segment.match(/^:([\w-]+)(\??)(.*)/);
|
|
730
734
|
if (keyMatch) {
|
|
@@ -1253,11 +1257,11 @@ async function recurseRight(impls, info, handler, index) {
|
|
|
1253
1257
|
};
|
|
1254
1258
|
}
|
|
1255
1259
|
function getHandlerInfo(args) {
|
|
1256
|
-
let { request, context, params,
|
|
1260
|
+
let { request, context, params, pattern } = args;
|
|
1257
1261
|
return {
|
|
1258
1262
|
request: getReadonlyRequest(request),
|
|
1259
1263
|
params: { ...params },
|
|
1260
|
-
|
|
1264
|
+
pattern,
|
|
1261
1265
|
context: getReadonlyContext(context)
|
|
1262
1266
|
};
|
|
1263
1267
|
}
|
|
@@ -1347,6 +1351,55 @@ var defaultMapRouteProperties = (route) => ({
|
|
|
1347
1351
|
});
|
|
1348
1352
|
var TRANSITIONS_STORAGE_KEY = "remix-router-transitions";
|
|
1349
1353
|
var ResetLoaderDataSymbol = Symbol("ResetLoaderData");
|
|
1354
|
+
var _routes, _branches, _hmrRoutes, _hmrBranches;
|
|
1355
|
+
var DataRoutes = class {
|
|
1356
|
+
constructor(routes) {
|
|
1357
|
+
__privateAdd(this, _routes);
|
|
1358
|
+
__privateAdd(this, _branches);
|
|
1359
|
+
__privateAdd(this, _hmrRoutes);
|
|
1360
|
+
__privateAdd(this, _hmrBranches);
|
|
1361
|
+
__privateSet(this, _routes, routes);
|
|
1362
|
+
__privateSet(this, _branches, flattenAndRankRoutes(routes));
|
|
1363
|
+
}
|
|
1364
|
+
/** The stable route tree */
|
|
1365
|
+
get stableRoutes() {
|
|
1366
|
+
return __privateGet(this, _routes);
|
|
1367
|
+
}
|
|
1368
|
+
/** The in-flight route tree if one is active, otherwise the stable tree */
|
|
1369
|
+
get activeRoutes() {
|
|
1370
|
+
return _nullishCoalesce(__privateGet(this, _hmrRoutes), () => ( __privateGet(this, _routes)));
|
|
1371
|
+
}
|
|
1372
|
+
/** Pre-computed branches */
|
|
1373
|
+
get branches() {
|
|
1374
|
+
return _nullishCoalesce(__privateGet(this, _hmrBranches), () => ( __privateGet(this, _branches)));
|
|
1375
|
+
}
|
|
1376
|
+
get hasHMRRoutes() {
|
|
1377
|
+
return __privateGet(this, _hmrRoutes) != null;
|
|
1378
|
+
}
|
|
1379
|
+
/** Replace the stable route tree and recompute its branches */
|
|
1380
|
+
setRoutes(routes) {
|
|
1381
|
+
__privateSet(this, _routes, routes);
|
|
1382
|
+
__privateSet(this, _branches, flattenAndRankRoutes(routes));
|
|
1383
|
+
}
|
|
1384
|
+
/** Set a new in-flight route tree and recompute its branches */
|
|
1385
|
+
setHmrRoutes(routes) {
|
|
1386
|
+
__privateSet(this, _hmrRoutes, routes);
|
|
1387
|
+
__privateSet(this, _hmrBranches, flattenAndRankRoutes(routes));
|
|
1388
|
+
}
|
|
1389
|
+
/** Commit in-flight routes/branches to the stable slot and clear in-flight */
|
|
1390
|
+
commitHmrRoutes() {
|
|
1391
|
+
if (__privateGet(this, _hmrRoutes)) {
|
|
1392
|
+
__privateSet(this, _routes, __privateGet(this, _hmrRoutes));
|
|
1393
|
+
__privateSet(this, _branches, __privateGet(this, _hmrBranches));
|
|
1394
|
+
__privateSet(this, _hmrRoutes, void 0);
|
|
1395
|
+
__privateSet(this, _hmrBranches, void 0);
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
};
|
|
1399
|
+
_routes = new WeakMap();
|
|
1400
|
+
_branches = new WeakMap();
|
|
1401
|
+
_hmrRoutes = new WeakMap();
|
|
1402
|
+
_hmrBranches = new WeakMap();
|
|
1350
1403
|
function createRouter(init) {
|
|
1351
1404
|
const routerWindow = init.window ? init.window : typeof window !== "undefined" ? window : void 0;
|
|
1352
1405
|
const isBrowser2 = typeof routerWindow !== "undefined" && typeof routerWindow.document !== "undefined" && typeof routerWindow.document.createElement !== "undefined";
|
|
@@ -1357,8 +1410,8 @@ function createRouter(init) {
|
|
|
1357
1410
|
let hydrationRouteProperties2 = init.hydrationRouteProperties || [];
|
|
1358
1411
|
let _mapRouteProperties = init.mapRouteProperties || defaultMapRouteProperties;
|
|
1359
1412
|
let mapRouteProperties2 = _mapRouteProperties;
|
|
1360
|
-
if (init.
|
|
1361
|
-
let instrumentations = init.
|
|
1413
|
+
if (init.instrumentations) {
|
|
1414
|
+
let instrumentations = init.instrumentations;
|
|
1362
1415
|
mapRouteProperties2 = (route) => {
|
|
1363
1416
|
return {
|
|
1364
1417
|
..._mapRouteProperties(route),
|
|
@@ -1370,20 +1423,20 @@ function createRouter(init) {
|
|
|
1370
1423
|
};
|
|
1371
1424
|
}
|
|
1372
1425
|
let manifest = {};
|
|
1373
|
-
let dataRoutes =
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1426
|
+
let dataRoutes = new DataRoutes(
|
|
1427
|
+
convertRoutesToDataRoutes(
|
|
1428
|
+
init.routes,
|
|
1429
|
+
mapRouteProperties2,
|
|
1430
|
+
void 0,
|
|
1431
|
+
manifest
|
|
1432
|
+
)
|
|
1378
1433
|
);
|
|
1379
|
-
let inFlightDataRoutes;
|
|
1380
1434
|
let basename = init.basename || "/";
|
|
1381
1435
|
if (!basename.startsWith("/")) {
|
|
1382
1436
|
basename = `/${basename}`;
|
|
1383
1437
|
}
|
|
1384
1438
|
let dataStrategyImpl = init.dataStrategy || defaultDataStrategyWithMiddleware;
|
|
1385
1439
|
let future = {
|
|
1386
|
-
unstable_passThroughRequests: false,
|
|
1387
1440
|
...init.future
|
|
1388
1441
|
};
|
|
1389
1442
|
let unlistenHistory = null;
|
|
@@ -1392,7 +1445,13 @@ function createRouter(init) {
|
|
|
1392
1445
|
let getScrollRestorationKey = null;
|
|
1393
1446
|
let getScrollPosition = null;
|
|
1394
1447
|
let initialScrollRestored = init.hydrationData != null;
|
|
1395
|
-
let initialMatches =
|
|
1448
|
+
let initialMatches = matchRoutesImpl(
|
|
1449
|
+
dataRoutes.activeRoutes,
|
|
1450
|
+
init.history.location,
|
|
1451
|
+
basename,
|
|
1452
|
+
false,
|
|
1453
|
+
dataRoutes.branches
|
|
1454
|
+
);
|
|
1396
1455
|
let initialMatchesIsFOW = false;
|
|
1397
1456
|
let initialErrors = null;
|
|
1398
1457
|
let initialized;
|
|
@@ -1401,7 +1460,7 @@ function createRouter(init) {
|
|
|
1401
1460
|
let error = getInternalRouterError(404, {
|
|
1402
1461
|
pathname: init.history.location.pathname
|
|
1403
1462
|
});
|
|
1404
|
-
let { matches, route } = getShortCircuitMatches(dataRoutes);
|
|
1463
|
+
let { matches, route } = getShortCircuitMatches(dataRoutes.activeRoutes);
|
|
1405
1464
|
initialized = true;
|
|
1406
1465
|
renderFallback = !initialized;
|
|
1407
1466
|
initialMatches = matches;
|
|
@@ -1410,7 +1469,7 @@ function createRouter(init) {
|
|
|
1410
1469
|
if (initialMatches && !init.hydrationData) {
|
|
1411
1470
|
let fogOfWar = checkFogOfWar(
|
|
1412
1471
|
initialMatches,
|
|
1413
|
-
dataRoutes,
|
|
1472
|
+
dataRoutes.activeRoutes,
|
|
1414
1473
|
init.history.location.pathname
|
|
1415
1474
|
);
|
|
1416
1475
|
if (fogOfWar.active) {
|
|
@@ -1423,7 +1482,7 @@ function createRouter(init) {
|
|
|
1423
1482
|
initialMatches = [];
|
|
1424
1483
|
let fogOfWar = checkFogOfWar(
|
|
1425
1484
|
null,
|
|
1426
|
-
dataRoutes,
|
|
1485
|
+
dataRoutes.activeRoutes,
|
|
1427
1486
|
init.history.location.pathname
|
|
1428
1487
|
);
|
|
1429
1488
|
if (fogOfWar.active && fogOfWar.matches) {
|
|
@@ -1642,10 +1701,7 @@ function createRouter(init) {
|
|
|
1642
1701
|
}
|
|
1643
1702
|
let restoreScrollPosition = isUninterruptedRevalidation ? false : getSavedScrollPosition(location, newState.matches || state.matches);
|
|
1644
1703
|
let preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && _optionalChain([location, 'access', _11 => _11.state, 'optionalAccess', _12 => _12._isRedirect]) !== true;
|
|
1645
|
-
|
|
1646
|
-
dataRoutes = inFlightDataRoutes;
|
|
1647
|
-
inFlightDataRoutes = void 0;
|
|
1648
|
-
}
|
|
1704
|
+
dataRoutes.commitHmrRoutes();
|
|
1649
1705
|
if (isUninterruptedRevalidation) {
|
|
1650
1706
|
} else if (pendingAction === "POP" /* Pop */) {
|
|
1651
1707
|
} else if (pendingAction === "PUSH" /* Push */) {
|
|
@@ -1736,10 +1792,10 @@ function createRouter(init) {
|
|
|
1736
1792
|
opts
|
|
1737
1793
|
);
|
|
1738
1794
|
let maskPath;
|
|
1739
|
-
if (_optionalChain([opts, 'optionalAccess', _21 => _21.
|
|
1740
|
-
let partialPath = typeof opts.
|
|
1741
|
-
...state.location.
|
|
1742
|
-
...opts.
|
|
1795
|
+
if (_optionalChain([opts, 'optionalAccess', _21 => _21.mask])) {
|
|
1796
|
+
let partialPath = typeof opts.mask === "string" ? parsePath(opts.mask) : {
|
|
1797
|
+
...state.location.mask,
|
|
1798
|
+
...opts.mask
|
|
1743
1799
|
};
|
|
1744
1800
|
maskPath = {
|
|
1745
1801
|
pathname: "",
|
|
@@ -1805,7 +1861,7 @@ function createRouter(init) {
|
|
|
1805
1861
|
replace: opts && opts.replace,
|
|
1806
1862
|
enableViewTransition: opts && opts.viewTransition,
|
|
1807
1863
|
flushSync,
|
|
1808
|
-
callSiteDefaultShouldRevalidate: opts && opts.
|
|
1864
|
+
callSiteDefaultShouldRevalidate: opts && opts.defaultShouldRevalidate
|
|
1809
1865
|
});
|
|
1810
1866
|
}
|
|
1811
1867
|
function revalidate() {
|
|
@@ -1843,12 +1899,18 @@ function createRouter(init) {
|
|
|
1843
1899
|
saveScrollPosition(state.location, state.matches);
|
|
1844
1900
|
pendingPreventScrollReset = (opts && opts.preventScrollReset) === true;
|
|
1845
1901
|
pendingViewTransitionEnabled = (opts && opts.enableViewTransition) === true;
|
|
1846
|
-
let routesToUse =
|
|
1902
|
+
let routesToUse = dataRoutes.activeRoutes;
|
|
1847
1903
|
let loadingNavigation = opts && opts.overrideNavigation;
|
|
1848
1904
|
let matches = _optionalChain([opts, 'optionalAccess', _22 => _22.initialHydration]) && state.matches && state.matches.length > 0 && !initialMatchesIsFOW ? (
|
|
1849
1905
|
// `matchRoutes()` has already been called if we're in here via `router.initialize()`
|
|
1850
1906
|
state.matches
|
|
1851
|
-
) :
|
|
1907
|
+
) : matchRoutesImpl(
|
|
1908
|
+
routesToUse,
|
|
1909
|
+
location,
|
|
1910
|
+
basename,
|
|
1911
|
+
false,
|
|
1912
|
+
dataRoutes.branches
|
|
1913
|
+
);
|
|
1852
1914
|
let flushSync = (opts && opts.flushSync) === true;
|
|
1853
1915
|
if (matches && state.initialized && !isRevalidationRequired && isHashChangeOnly(state.location, location) && !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))) {
|
|
1854
1916
|
completeNavigation(location, { matches }, { flushSync });
|
|
@@ -1973,7 +2035,9 @@ function createRouter(init) {
|
|
|
1973
2035
|
return { shortCircuited: true };
|
|
1974
2036
|
} else if (discoverResult.type === "error") {
|
|
1975
2037
|
if (discoverResult.partialMatches.length === 0) {
|
|
1976
|
-
let { matches: matches2, route } = getShortCircuitMatches(
|
|
2038
|
+
let { matches: matches2, route } = getShortCircuitMatches(
|
|
2039
|
+
dataRoutes.activeRoutes
|
|
2040
|
+
);
|
|
1977
2041
|
return {
|
|
1978
2042
|
matches: matches2,
|
|
1979
2043
|
pendingActionResult: [
|
|
@@ -2120,7 +2184,9 @@ function createRouter(init) {
|
|
|
2120
2184
|
return { shortCircuited: true };
|
|
2121
2185
|
} else if (discoverResult.type === "error") {
|
|
2122
2186
|
if (discoverResult.partialMatches.length === 0) {
|
|
2123
|
-
let { matches: matches2, route } = getShortCircuitMatches(
|
|
2187
|
+
let { matches: matches2, route } = getShortCircuitMatches(
|
|
2188
|
+
dataRoutes.activeRoutes
|
|
2189
|
+
);
|
|
2124
2190
|
return {
|
|
2125
2191
|
matches: matches2,
|
|
2126
2192
|
loaderData: {},
|
|
@@ -2152,7 +2218,7 @@ function createRouter(init) {
|
|
|
2152
2218
|
matches = discoverResult.matches;
|
|
2153
2219
|
}
|
|
2154
2220
|
}
|
|
2155
|
-
let routesToUse =
|
|
2221
|
+
let routesToUse = dataRoutes.activeRoutes;
|
|
2156
2222
|
let { dsMatches, revalidatingFetchers } = getMatchesToLoad(
|
|
2157
2223
|
request,
|
|
2158
2224
|
scopedContext,
|
|
@@ -2173,6 +2239,7 @@ function createRouter(init) {
|
|
|
2173
2239
|
routesToUse,
|
|
2174
2240
|
basename,
|
|
2175
2241
|
init.patchRoutesOnNavigation != null,
|
|
2242
|
+
dataRoutes.branches,
|
|
2176
2243
|
pendingActionResult,
|
|
2177
2244
|
callSiteDefaultShouldRevalidate
|
|
2178
2245
|
);
|
|
@@ -2302,7 +2369,7 @@ function createRouter(init) {
|
|
|
2302
2369
|
async function fetch2(key, routeId, href, opts) {
|
|
2303
2370
|
abortFetcher(key);
|
|
2304
2371
|
let flushSync = (opts && opts.flushSync) === true;
|
|
2305
|
-
let routesToUse =
|
|
2372
|
+
let routesToUse = dataRoutes.activeRoutes;
|
|
2306
2373
|
let normalizedPath = normalizeTo(
|
|
2307
2374
|
state.location,
|
|
2308
2375
|
state.matches,
|
|
@@ -2311,7 +2378,13 @@ function createRouter(init) {
|
|
|
2311
2378
|
routeId,
|
|
2312
2379
|
_optionalChain([opts, 'optionalAccess', _23 => _23.relative])
|
|
2313
2380
|
);
|
|
2314
|
-
let matches =
|
|
2381
|
+
let matches = matchRoutesImpl(
|
|
2382
|
+
routesToUse,
|
|
2383
|
+
normalizedPath,
|
|
2384
|
+
basename,
|
|
2385
|
+
false,
|
|
2386
|
+
dataRoutes.branches
|
|
2387
|
+
);
|
|
2315
2388
|
let fogOfWar = checkFogOfWar(matches, routesToUse, normalizedPath);
|
|
2316
2389
|
if (fogOfWar.active && fogOfWar.matches) {
|
|
2317
2390
|
matches = fogOfWar.matches;
|
|
@@ -2347,7 +2420,7 @@ function createRouter(init) {
|
|
|
2347
2420
|
flushSync,
|
|
2348
2421
|
preventScrollReset,
|
|
2349
2422
|
submission,
|
|
2350
|
-
opts && opts.
|
|
2423
|
+
opts && opts.defaultShouldRevalidate
|
|
2351
2424
|
);
|
|
2352
2425
|
return;
|
|
2353
2426
|
}
|
|
@@ -2477,8 +2550,14 @@ function createRouter(init) {
|
|
|
2477
2550
|
nextLocation,
|
|
2478
2551
|
abortController.signal
|
|
2479
2552
|
);
|
|
2480
|
-
let routesToUse =
|
|
2481
|
-
let matches = state.navigation.state !== "idle" ?
|
|
2553
|
+
let routesToUse = dataRoutes.activeRoutes;
|
|
2554
|
+
let matches = state.navigation.state !== "idle" ? matchRoutesImpl(
|
|
2555
|
+
routesToUse,
|
|
2556
|
+
state.navigation.location,
|
|
2557
|
+
basename,
|
|
2558
|
+
false,
|
|
2559
|
+
dataRoutes.branches
|
|
2560
|
+
) : state.matches;
|
|
2482
2561
|
invariant(matches, "Didn't find any matches after fetcher action");
|
|
2483
2562
|
let loadId = ++incrementingLoadId;
|
|
2484
2563
|
fetchReloadIds.set(key, loadId);
|
|
@@ -2504,6 +2583,7 @@ function createRouter(init) {
|
|
|
2504
2583
|
routesToUse,
|
|
2505
2584
|
basename,
|
|
2506
2585
|
init.patchRoutesOnNavigation != null,
|
|
2586
|
+
dataRoutes.branches,
|
|
2507
2587
|
[match.route.id, actionResult],
|
|
2508
2588
|
callSiteDefaultShouldRevalidate
|
|
2509
2589
|
);
|
|
@@ -2659,6 +2739,14 @@ function createRouter(init) {
|
|
|
2659
2739
|
key
|
|
2660
2740
|
);
|
|
2661
2741
|
let result = results[match.route.id];
|
|
2742
|
+
if (!result) {
|
|
2743
|
+
for (let match2 of matches) {
|
|
2744
|
+
if (results[match2.route.id]) {
|
|
2745
|
+
result = results[match2.route.id];
|
|
2746
|
+
break;
|
|
2747
|
+
}
|
|
2748
|
+
}
|
|
2749
|
+
}
|
|
2662
2750
|
if (fetchControllers.get(key) === abortController) {
|
|
2663
2751
|
fetchControllers.delete(key);
|
|
2664
2752
|
}
|
|
@@ -3014,7 +3102,7 @@ function createRouter(init) {
|
|
|
3014
3102
|
}
|
|
3015
3103
|
function handleNavigational404(pathname) {
|
|
3016
3104
|
let error = getInternalRouterError(404, { pathname });
|
|
3017
|
-
let routesToUse =
|
|
3105
|
+
let routesToUse = dataRoutes.activeRoutes;
|
|
3018
3106
|
let { matches, route } = getShortCircuitMatches(routesToUse);
|
|
3019
3107
|
return { notFoundMatches: matches, route, error };
|
|
3020
3108
|
}
|
|
@@ -3063,12 +3151,14 @@ function createRouter(init) {
|
|
|
3063
3151
|
}
|
|
3064
3152
|
function checkFogOfWar(matches, routesToUse, pathname) {
|
|
3065
3153
|
if (init.patchRoutesOnNavigation) {
|
|
3154
|
+
let activeBranches = dataRoutes.branches;
|
|
3066
3155
|
if (!matches) {
|
|
3067
3156
|
let fogMatches = matchRoutesImpl(
|
|
3068
3157
|
routesToUse,
|
|
3069
3158
|
pathname,
|
|
3070
3159
|
basename,
|
|
3071
|
-
true
|
|
3160
|
+
true,
|
|
3161
|
+
activeBranches
|
|
3072
3162
|
);
|
|
3073
3163
|
return { active: true, matches: fogMatches || [] };
|
|
3074
3164
|
} else {
|
|
@@ -3077,7 +3167,8 @@ function createRouter(init) {
|
|
|
3077
3167
|
routesToUse,
|
|
3078
3168
|
pathname,
|
|
3079
3169
|
basename,
|
|
3080
|
-
true
|
|
3170
|
+
true,
|
|
3171
|
+
activeBranches
|
|
3081
3172
|
);
|
|
3082
3173
|
return { active: true, matches: partialMatches };
|
|
3083
3174
|
}
|
|
@@ -3091,8 +3182,6 @@ function createRouter(init) {
|
|
|
3091
3182
|
}
|
|
3092
3183
|
let partialMatches = matches;
|
|
3093
3184
|
while (true) {
|
|
3094
|
-
let isNonHMR = inFlightDataRoutes == null;
|
|
3095
|
-
let routesToUse = inFlightDataRoutes || dataRoutes;
|
|
3096
3185
|
let localManifest = manifest;
|
|
3097
3186
|
try {
|
|
3098
3187
|
await init.patchRoutesOnNavigation({
|
|
@@ -3105,7 +3194,7 @@ function createRouter(init) {
|
|
|
3105
3194
|
patchRoutesImpl(
|
|
3106
3195
|
routeId,
|
|
3107
3196
|
children,
|
|
3108
|
-
|
|
3197
|
+
dataRoutes,
|
|
3109
3198
|
localManifest,
|
|
3110
3199
|
mapRouteProperties2,
|
|
3111
3200
|
false
|
|
@@ -3114,25 +3203,29 @@ function createRouter(init) {
|
|
|
3114
3203
|
});
|
|
3115
3204
|
} catch (e) {
|
|
3116
3205
|
return { type: "error", error: e, partialMatches };
|
|
3117
|
-
} finally {
|
|
3118
|
-
if (isNonHMR && !signal.aborted) {
|
|
3119
|
-
dataRoutes = [...dataRoutes];
|
|
3120
|
-
}
|
|
3121
3206
|
}
|
|
3122
3207
|
if (signal.aborted) {
|
|
3123
3208
|
return { type: "aborted" };
|
|
3124
3209
|
}
|
|
3125
|
-
let
|
|
3210
|
+
let activeBranches = dataRoutes.branches;
|
|
3211
|
+
let newMatches = matchRoutesImpl(
|
|
3212
|
+
dataRoutes.activeRoutes,
|
|
3213
|
+
pathname,
|
|
3214
|
+
basename,
|
|
3215
|
+
false,
|
|
3216
|
+
activeBranches
|
|
3217
|
+
);
|
|
3126
3218
|
let newPartialMatches = null;
|
|
3127
3219
|
if (newMatches) {
|
|
3128
3220
|
if (Object.keys(newMatches[0].params).length === 0) {
|
|
3129
3221
|
return { type: "success", matches: newMatches };
|
|
3130
3222
|
} else {
|
|
3131
3223
|
newPartialMatches = matchRoutesImpl(
|
|
3132
|
-
|
|
3224
|
+
dataRoutes.activeRoutes,
|
|
3133
3225
|
pathname,
|
|
3134
3226
|
basename,
|
|
3135
|
-
true
|
|
3227
|
+
true,
|
|
3228
|
+
activeBranches
|
|
3136
3229
|
);
|
|
3137
3230
|
let matchedDeeper = newPartialMatches && partialMatches.length < newPartialMatches.length && compareMatches(
|
|
3138
3231
|
partialMatches,
|
|
@@ -3145,10 +3238,11 @@ function createRouter(init) {
|
|
|
3145
3238
|
}
|
|
3146
3239
|
if (!newPartialMatches) {
|
|
3147
3240
|
newPartialMatches = matchRoutesImpl(
|
|
3148
|
-
|
|
3241
|
+
dataRoutes.activeRoutes,
|
|
3149
3242
|
pathname,
|
|
3150
3243
|
basename,
|
|
3151
|
-
true
|
|
3244
|
+
true,
|
|
3245
|
+
activeBranches
|
|
3152
3246
|
);
|
|
3153
3247
|
}
|
|
3154
3248
|
if (!newPartialMatches || compareMatches(partialMatches, newPartialMatches)) {
|
|
@@ -3162,26 +3256,25 @@ function createRouter(init) {
|
|
|
3162
3256
|
}
|
|
3163
3257
|
function _internalSetRoutes(newRoutes) {
|
|
3164
3258
|
manifest = {};
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3259
|
+
dataRoutes.setHmrRoutes(
|
|
3260
|
+
convertRoutesToDataRoutes(
|
|
3261
|
+
newRoutes,
|
|
3262
|
+
mapRouteProperties2,
|
|
3263
|
+
void 0,
|
|
3264
|
+
manifest
|
|
3265
|
+
)
|
|
3170
3266
|
);
|
|
3171
3267
|
}
|
|
3172
3268
|
function patchRoutes(routeId, children, unstable_allowElementMutations = false) {
|
|
3173
|
-
let isNonHMR = inFlightDataRoutes == null;
|
|
3174
|
-
let routesToUse = inFlightDataRoutes || dataRoutes;
|
|
3175
3269
|
patchRoutesImpl(
|
|
3176
3270
|
routeId,
|
|
3177
3271
|
children,
|
|
3178
|
-
|
|
3272
|
+
dataRoutes,
|
|
3179
3273
|
manifest,
|
|
3180
3274
|
mapRouteProperties2,
|
|
3181
3275
|
unstable_allowElementMutations
|
|
3182
3276
|
);
|
|
3183
|
-
if (
|
|
3184
|
-
dataRoutes = [...dataRoutes];
|
|
3277
|
+
if (!dataRoutes.hasHMRRoutes) {
|
|
3185
3278
|
updateState({});
|
|
3186
3279
|
}
|
|
3187
3280
|
}
|
|
@@ -3196,7 +3289,13 @@ function createRouter(init) {
|
|
|
3196
3289
|
return state;
|
|
3197
3290
|
},
|
|
3198
3291
|
get routes() {
|
|
3199
|
-
return dataRoutes;
|
|
3292
|
+
return dataRoutes.stableRoutes;
|
|
3293
|
+
},
|
|
3294
|
+
get branches() {
|
|
3295
|
+
return dataRoutes.branches;
|
|
3296
|
+
},
|
|
3297
|
+
get manifest() {
|
|
3298
|
+
return manifest;
|
|
3200
3299
|
},
|
|
3201
3300
|
get window() {
|
|
3202
3301
|
return routerWindow;
|
|
@@ -3226,10 +3325,10 @@ function createRouter(init) {
|
|
|
3226
3325
|
updateState(newState);
|
|
3227
3326
|
}
|
|
3228
3327
|
};
|
|
3229
|
-
if (init.
|
|
3328
|
+
if (init.instrumentations) {
|
|
3230
3329
|
router = instrumentClientSideRouter(
|
|
3231
3330
|
router,
|
|
3232
|
-
init.
|
|
3331
|
+
init.instrumentations.map((i) => i.router).filter(Boolean)
|
|
3233
3332
|
);
|
|
3234
3333
|
}
|
|
3235
3334
|
return router;
|
|
@@ -3244,12 +3343,10 @@ function createStaticHandler(routes, opts) {
|
|
|
3244
3343
|
let _mapRouteProperties = _optionalChain([opts, 'optionalAccess', _29 => _29.mapRouteProperties]) || defaultMapRouteProperties;
|
|
3245
3344
|
let mapRouteProperties2 = _mapRouteProperties;
|
|
3246
3345
|
let future = {
|
|
3247
|
-
unstable_passThroughRequests: false,
|
|
3248
|
-
// unused in static handler
|
|
3249
3346
|
..._optionalChain([opts, 'optionalAccess', _30 => _30.future])
|
|
3250
3347
|
};
|
|
3251
|
-
if (_optionalChain([opts, 'optionalAccess', _31 => _31.
|
|
3252
|
-
let instrumentations = opts.
|
|
3348
|
+
if (_optionalChain([opts, 'optionalAccess', _31 => _31.instrumentations])) {
|
|
3349
|
+
let instrumentations = opts.instrumentations;
|
|
3253
3350
|
mapRouteProperties2 = (route) => {
|
|
3254
3351
|
return {
|
|
3255
3352
|
..._mapRouteProperties(route),
|
|
@@ -3266,6 +3363,7 @@ function createStaticHandler(routes, opts) {
|
|
|
3266
3363
|
void 0,
|
|
3267
3364
|
manifest
|
|
3268
3365
|
);
|
|
3366
|
+
let routeBranches = flattenAndRankRoutes(dataRoutes);
|
|
3269
3367
|
async function query(request, {
|
|
3270
3368
|
requestContext,
|
|
3271
3369
|
filterMatchesToLoad,
|
|
@@ -3273,12 +3371,23 @@ function createStaticHandler(routes, opts) {
|
|
|
3273
3371
|
skipRevalidation,
|
|
3274
3372
|
dataStrategy,
|
|
3275
3373
|
generateMiddlewareResponse,
|
|
3276
|
-
|
|
3374
|
+
normalizePath
|
|
3277
3375
|
} = {}) {
|
|
3278
|
-
let
|
|
3376
|
+
let normalizePathImpl = normalizePath || defaultNormalizePath;
|
|
3279
3377
|
let method = request.method;
|
|
3280
|
-
let location = createLocation(
|
|
3281
|
-
|
|
3378
|
+
let location = createLocation(
|
|
3379
|
+
"",
|
|
3380
|
+
normalizePathImpl(request),
|
|
3381
|
+
null,
|
|
3382
|
+
"default"
|
|
3383
|
+
);
|
|
3384
|
+
let matches = matchRoutesImpl(
|
|
3385
|
+
dataRoutes,
|
|
3386
|
+
location,
|
|
3387
|
+
basename,
|
|
3388
|
+
false,
|
|
3389
|
+
routeBranches
|
|
3390
|
+
);
|
|
3282
3391
|
requestContext = requestContext != null ? requestContext : new RouterContextProvider();
|
|
3283
3392
|
if (!isValidMethod(method) && method !== "HEAD") {
|
|
3284
3393
|
let error = getInternalRouterError(405, { method });
|
|
@@ -3330,8 +3439,8 @@ function createStaticHandler(routes, opts) {
|
|
|
3330
3439
|
let response = await runServerMiddlewarePipeline(
|
|
3331
3440
|
{
|
|
3332
3441
|
request,
|
|
3333
|
-
|
|
3334
|
-
|
|
3442
|
+
url: createDataFunctionUrl(request, location),
|
|
3443
|
+
pattern: getRoutePattern(matches),
|
|
3335
3444
|
matches,
|
|
3336
3445
|
params: matches[0].params,
|
|
3337
3446
|
// If we're calling middleware then it must be enabled so we can cast
|
|
@@ -3448,12 +3557,23 @@ function createStaticHandler(routes, opts) {
|
|
|
3448
3557
|
requestContext,
|
|
3449
3558
|
dataStrategy,
|
|
3450
3559
|
generateMiddlewareResponse,
|
|
3451
|
-
|
|
3560
|
+
normalizePath
|
|
3452
3561
|
} = {}) {
|
|
3453
|
-
let
|
|
3562
|
+
let normalizePathImpl = normalizePath || defaultNormalizePath;
|
|
3454
3563
|
let method = request.method;
|
|
3455
|
-
let location = createLocation(
|
|
3456
|
-
|
|
3564
|
+
let location = createLocation(
|
|
3565
|
+
"",
|
|
3566
|
+
normalizePathImpl(request),
|
|
3567
|
+
null,
|
|
3568
|
+
"default"
|
|
3569
|
+
);
|
|
3570
|
+
let matches = matchRoutesImpl(
|
|
3571
|
+
dataRoutes,
|
|
3572
|
+
location,
|
|
3573
|
+
basename,
|
|
3574
|
+
false,
|
|
3575
|
+
routeBranches
|
|
3576
|
+
);
|
|
3457
3577
|
requestContext = requestContext != null ? requestContext : new RouterContextProvider();
|
|
3458
3578
|
if (!isValidMethod(method) && method !== "HEAD" && method !== "OPTIONS") {
|
|
3459
3579
|
throw getInternalRouterError(405, { method });
|
|
@@ -3478,8 +3598,8 @@ function createStaticHandler(routes, opts) {
|
|
|
3478
3598
|
let response = await runServerMiddlewarePipeline(
|
|
3479
3599
|
{
|
|
3480
3600
|
request,
|
|
3481
|
-
|
|
3482
|
-
|
|
3601
|
+
url: createDataFunctionUrl(request, location),
|
|
3602
|
+
pattern: getRoutePattern(matches),
|
|
3483
3603
|
matches,
|
|
3484
3604
|
params: matches[0].params,
|
|
3485
3605
|
// If we're calling middleware then it must be enabled so we can cast
|
|
@@ -3865,6 +3985,7 @@ function createStaticHandler(routes, opts) {
|
|
|
3865
3985
|
}
|
|
3866
3986
|
return {
|
|
3867
3987
|
dataRoutes,
|
|
3988
|
+
_internalRouteBranches: routeBranches,
|
|
3868
3989
|
query,
|
|
3869
3990
|
queryRoute
|
|
3870
3991
|
};
|
|
@@ -4050,7 +4171,7 @@ function normalizeNavigateOptions(isFetcher, path, opts) {
|
|
|
4050
4171
|
parsedPath.search = `?${searchParams}`;
|
|
4051
4172
|
return { path: createPath(parsedPath), submission };
|
|
4052
4173
|
}
|
|
4053
|
-
function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest, history, state, matches, submission, location, lazyRoutePropertiesToSkip, initialHydration, isRevalidationRequired, cancelledFetcherLoads, fetchersQueuedForDeletion, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, hasPatchRoutesOnNavigation, pendingActionResult, callSiteDefaultShouldRevalidate) {
|
|
4174
|
+
function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest, history, state, matches, submission, location, lazyRoutePropertiesToSkip, initialHydration, isRevalidationRequired, cancelledFetcherLoads, fetchersQueuedForDeletion, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, hasPatchRoutesOnNavigation, branches, pendingActionResult, callSiteDefaultShouldRevalidate) {
|
|
4054
4175
|
let actionResult = pendingActionResult ? isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : pendingActionResult[1].data : void 0;
|
|
4055
4176
|
let currentUrl = history.createURL(state.location);
|
|
4056
4177
|
let nextUrl = history.createURL(location);
|
|
@@ -4146,7 +4267,13 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
|
|
|
4146
4267
|
}
|
|
4147
4268
|
let fetcher = state.fetchers.get(key);
|
|
4148
4269
|
let isMidInitialLoad = fetcher && fetcher.state !== "idle" && fetcher.data === void 0;
|
|
4149
|
-
let fetcherMatches =
|
|
4270
|
+
let fetcherMatches = matchRoutesImpl(
|
|
4271
|
+
routesToUse,
|
|
4272
|
+
f.path,
|
|
4273
|
+
_nullishCoalesce(basename, () => ( "/")),
|
|
4274
|
+
false,
|
|
4275
|
+
branches
|
|
4276
|
+
);
|
|
4150
4277
|
if (!fetcherMatches) {
|
|
4151
4278
|
if (hasPatchRoutesOnNavigation && isMidInitialLoad) {
|
|
4152
4279
|
return;
|
|
@@ -4287,7 +4414,7 @@ function shouldRevalidateLoader(loaderMatch, arg) {
|
|
|
4287
4414
|
}
|
|
4288
4415
|
return arg.defaultShouldRevalidate;
|
|
4289
4416
|
}
|
|
4290
|
-
function patchRoutesImpl(routeId, children,
|
|
4417
|
+
function patchRoutesImpl(routeId, children, dataRoutes, manifest, mapRouteProperties2, allowElementMutations) {
|
|
4291
4418
|
let childrenToPatch;
|
|
4292
4419
|
if (routeId) {
|
|
4293
4420
|
let route = manifest[routeId];
|
|
@@ -4300,7 +4427,7 @@ function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRoutePrope
|
|
|
4300
4427
|
}
|
|
4301
4428
|
childrenToPatch = route.children;
|
|
4302
4429
|
} else {
|
|
4303
|
-
childrenToPatch =
|
|
4430
|
+
childrenToPatch = dataRoutes.activeRoutes;
|
|
4304
4431
|
}
|
|
4305
4432
|
let uniqueChildren = [];
|
|
4306
4433
|
let existingChildren = [];
|
|
@@ -4343,6 +4470,9 @@ function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRoutePrope
|
|
|
4343
4470
|
});
|
|
4344
4471
|
}
|
|
4345
4472
|
}
|
|
4473
|
+
if (!dataRoutes.hasHMRRoutes) {
|
|
4474
|
+
dataRoutes.setRoutes([...dataRoutes.activeRoutes]);
|
|
4475
|
+
}
|
|
4346
4476
|
}
|
|
4347
4477
|
function isSameRoute(newRoute, existingRoute) {
|
|
4348
4478
|
if ("id" in newRoute && "id" in existingRoute && newRoute.id === existingRoute.id) {
|
|
@@ -4684,7 +4814,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties2, manifest, request
|
|
|
4684
4814
|
handler: lazyRoutePromises.lazyHandlerPromise
|
|
4685
4815
|
};
|
|
4686
4816
|
}
|
|
4687
|
-
function getDataStrategyMatch(mapRouteProperties2, manifest, request, path,
|
|
4817
|
+
function getDataStrategyMatch(mapRouteProperties2, manifest, request, path, pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {
|
|
4688
4818
|
let isUsingNewApi = false;
|
|
4689
4819
|
let _lazyPromises = getDataStrategyMatchLazyPromises(
|
|
4690
4820
|
mapRouteProperties2,
|
|
@@ -4725,7 +4855,7 @@ function getDataStrategyMatch(mapRouteProperties2, manifest, request, path, unst
|
|
|
4725
4855
|
return callLoaderOrAction({
|
|
4726
4856
|
request,
|
|
4727
4857
|
path,
|
|
4728
|
-
|
|
4858
|
+
pattern,
|
|
4729
4859
|
match,
|
|
4730
4860
|
lazyHandlerPromise: _optionalChain([_lazyPromises, 'optionalAccess', _56 => _56.handler]),
|
|
4731
4861
|
lazyRoutePromise: _optionalChain([_lazyPromises, 'optionalAccess', _57 => _57.route]),
|
|
@@ -4775,8 +4905,8 @@ async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fe
|
|
|
4775
4905
|
}
|
|
4776
4906
|
let dataStrategyArgs = {
|
|
4777
4907
|
request,
|
|
4778
|
-
|
|
4779
|
-
|
|
4908
|
+
url: createDataFunctionUrl(request, path),
|
|
4909
|
+
pattern: getRoutePattern(matches),
|
|
4780
4910
|
params: matches[0].params,
|
|
4781
4911
|
context: scopedContext,
|
|
4782
4912
|
matches
|
|
@@ -4818,7 +4948,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fe
|
|
|
4818
4948
|
async function callLoaderOrAction({
|
|
4819
4949
|
request,
|
|
4820
4950
|
path,
|
|
4821
|
-
|
|
4951
|
+
pattern,
|
|
4822
4952
|
match,
|
|
4823
4953
|
lazyHandlerPromise,
|
|
4824
4954
|
lazyRoutePromise,
|
|
@@ -4845,8 +4975,8 @@ async function callLoaderOrAction({
|
|
|
4845
4975
|
return handler(
|
|
4846
4976
|
{
|
|
4847
4977
|
request,
|
|
4848
|
-
|
|
4849
|
-
|
|
4978
|
+
url: createDataFunctionUrl(request, path),
|
|
4979
|
+
pattern,
|
|
4850
4980
|
params: match.params,
|
|
4851
4981
|
context: scopedContext
|
|
4852
4982
|
},
|
|
@@ -5564,6 +5694,14 @@ var TYPE_SET = "S";
|
|
|
5564
5694
|
var TYPE_SYMBOL = "Y";
|
|
5565
5695
|
var TYPE_URL = "U";
|
|
5566
5696
|
var TYPE_PREVIOUS_RESOLVED = "Z";
|
|
5697
|
+
var SUPPORTED_ERROR_TYPES = [
|
|
5698
|
+
"EvalError",
|
|
5699
|
+
"RangeError",
|
|
5700
|
+
"ReferenceError",
|
|
5701
|
+
"SyntaxError",
|
|
5702
|
+
"TypeError",
|
|
5703
|
+
"URIError"
|
|
5704
|
+
];
|
|
5567
5705
|
var Deferred = class {
|
|
5568
5706
|
constructor() {
|
|
5569
5707
|
this.promise = new Promise((resolve, reject) => {
|
|
@@ -5925,7 +6063,7 @@ function hydrate(index) {
|
|
|
5925
6063
|
continue;
|
|
5926
6064
|
case TYPE_ERROR:
|
|
5927
6065
|
const [, message, errorType] = value;
|
|
5928
|
-
let error = errorType && globalObj && globalObj[errorType] ? new globalObj[errorType](message) : new Error(message);
|
|
6066
|
+
let error = errorType && globalObj && SUPPORTED_ERROR_TYPES.includes(errorType) && errorType in globalObj && typeof globalObj[errorType] === "function" ? new globalObj[errorType](message) : new Error(message);
|
|
5929
6067
|
hydrated[index2] = error;
|
|
5930
6068
|
set(error);
|
|
5931
6069
|
continue;
|
|
@@ -6360,11 +6498,9 @@ function getTurboStreamSingleFetchDataStrategy(getRouter, manifest, routeModules
|
|
|
6360
6498
|
(match) => {
|
|
6361
6499
|
let manifestRoute = manifest.routes[match.route.id];
|
|
6362
6500
|
invariant2(manifestRoute, "Route not found in manifest");
|
|
6363
|
-
let routeModule = routeModules[match.route.id];
|
|
6364
6501
|
return {
|
|
6365
6502
|
hasLoader: manifestRoute.hasLoader,
|
|
6366
|
-
hasClientLoader: manifestRoute.hasClientLoader
|
|
6367
|
-
hasShouldRevalidate: Boolean(_optionalChain([routeModule, 'optionalAccess', _83 => _83.shouldRevalidate]))
|
|
6503
|
+
hasClientLoader: manifestRoute.hasClientLoader
|
|
6368
6504
|
};
|
|
6369
6505
|
},
|
|
6370
6506
|
fetchAndDecodeViaTurboStream,
|
|
@@ -6484,13 +6620,12 @@ async function singleFetchLoaderNavigationStrategy(args, router, getRouteInfo, f
|
|
|
6484
6620
|
async (m, i) => m.resolve(async (handler) => {
|
|
6485
6621
|
routeDfds[i].resolve();
|
|
6486
6622
|
let routeId = m.route.id;
|
|
6487
|
-
let { hasLoader, hasClientLoader
|
|
6623
|
+
let { hasLoader, hasClientLoader } = getRouteInfo(m);
|
|
6488
6624
|
let defaultShouldRevalidate = !m.shouldRevalidateArgs || m.shouldRevalidateArgs.actionStatus == null || m.shouldRevalidateArgs.actionStatus < 400;
|
|
6489
6625
|
let shouldCall = m.shouldCallHandler(defaultShouldRevalidate);
|
|
6490
6626
|
if (!shouldCall) {
|
|
6491
6627
|
foundOptOutRoute || (foundOptOutRoute = m.shouldRevalidateArgs != null && // This is a revalidation,
|
|
6492
|
-
hasLoader
|
|
6493
|
-
hasShouldRevalidate === true);
|
|
6628
|
+
hasLoader);
|
|
6494
6629
|
return;
|
|
6495
6630
|
}
|
|
6496
6631
|
if (shouldAllowOptOut(m) && hasClientLoader) {
|
|
@@ -6565,7 +6700,7 @@ async function bubbleMiddlewareErrors(singleFetchPromise, matches, routesParams,
|
|
|
6565
6700
|
let routeResult = fetchedData.routes[match.route.id];
|
|
6566
6701
|
if ("error" in routeResult) {
|
|
6567
6702
|
middlewareError = routeResult.error;
|
|
6568
|
-
if (_optionalChain([results, 'access',
|
|
6703
|
+
if (_optionalChain([results, 'access', _83 => _83[match.route.id], 'optionalAccess', _84 => _84.result]) == null) {
|
|
6569
6704
|
results[match.route.id] = {
|
|
6570
6705
|
type: "error",
|
|
6571
6706
|
result: middlewareError
|
|
@@ -6688,7 +6823,7 @@ async function fetchAndDecodeViaTurboStream(args, basename, trailingSlashAware,
|
|
|
6688
6823
|
}
|
|
6689
6824
|
} else {
|
|
6690
6825
|
let typed = decoded.value;
|
|
6691
|
-
let routeId = _optionalChain([targetRoutes, 'optionalAccess',
|
|
6826
|
+
let routeId = _optionalChain([targetRoutes, 'optionalAccess', _85 => _85[0]]);
|
|
6692
6827
|
invariant2(routeId, "No routeId found for single fetch call decoding");
|
|
6693
6828
|
if ("redirect" in typed) {
|
|
6694
6829
|
data2 = { redirect: typed };
|
|
@@ -6708,7 +6843,8 @@ function decodeViaTurboStream(body, global) {
|
|
|
6708
6843
|
if (type === "SanitizedError") {
|
|
6709
6844
|
let [name, message, stack] = rest;
|
|
6710
6845
|
let Constructor = Error;
|
|
6711
|
-
if (name && name in global &&
|
|
6846
|
+
if (name && SUPPORTED_ERROR_TYPES.includes(name) && name in global && // @ts-expect-error
|
|
6847
|
+
typeof global[name] === "function") {
|
|
6712
6848
|
Constructor = global[name];
|
|
6713
6849
|
}
|
|
6714
6850
|
let error = new Constructor(message);
|
|
@@ -6987,7 +7123,7 @@ function useOutlet(context) {
|
|
|
6987
7123
|
function useParams() {
|
|
6988
7124
|
let { matches } = React3.useContext(RouteContext);
|
|
6989
7125
|
let routeMatch = matches[matches.length - 1];
|
|
6990
|
-
return routeMatch
|
|
7126
|
+
return _nullishCoalesce(_optionalChain([routeMatch, 'optionalAccess', _86 => _86.params]), () => ( {}));
|
|
6991
7127
|
}
|
|
6992
7128
|
function useResolvedPath(to, { relative } = {}) {
|
|
6993
7129
|
let { matches } = React3.useContext(RouteContext);
|
|
@@ -7049,7 +7185,15 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
7049
7185
|
let segments = pathname.replace(/^\//, "").split("/");
|
|
7050
7186
|
remainingPathname = "/" + segments.slice(parentSegments.length).join("/");
|
|
7051
7187
|
}
|
|
7052
|
-
let matches =
|
|
7188
|
+
let matches = dataRouterOpts && dataRouterOpts.state.matches.length ? (
|
|
7189
|
+
// If we're in a data router, use the matches we've already identified but ensure
|
|
7190
|
+
// we have the latest route instances from the manifest in case elements have changed
|
|
7191
|
+
dataRouterOpts.state.matches.map(
|
|
7192
|
+
(m) => Object.assign(m, {
|
|
7193
|
+
route: dataRouterOpts.manifest[m.route.id] || m.route
|
|
7194
|
+
})
|
|
7195
|
+
)
|
|
7196
|
+
) : matchRoutes(routes, { pathname: remainingPathname });
|
|
7053
7197
|
if (ENABLE_DEV_WARNINGS) {
|
|
7054
7198
|
warning(
|
|
7055
7199
|
parentRoute || matches != null,
|
|
@@ -7100,7 +7244,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
7100
7244
|
hash: "",
|
|
7101
7245
|
state: null,
|
|
7102
7246
|
key: "default",
|
|
7103
|
-
|
|
7247
|
+
mask: void 0,
|
|
7104
7248
|
...location
|
|
7105
7249
|
},
|
|
7106
7250
|
navigationType: "POP" /* Pop */
|
|
@@ -7290,7 +7434,7 @@ function _renderMatches(matches, parentMatches = [], dataRouterOpts) {
|
|
|
7290
7434
|
onErrorHandler(error, {
|
|
7291
7435
|
location: dataRouterState.location,
|
|
7292
7436
|
params: _nullishCoalesce(_optionalChain([dataRouterState, 'access', _94 => _94.matches, 'optionalAccess', _95 => _95[0], 'optionalAccess', _96 => _96.params]), () => ( {})),
|
|
7293
|
-
|
|
7437
|
+
pattern: getRoutePattern(dataRouterState.matches),
|
|
7294
7438
|
errorInfo
|
|
7295
7439
|
});
|
|
7296
7440
|
} : void 0;
|
|
@@ -7970,13 +8114,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
7970
8114
|
let hasInitialError = initialState && initialState.errors && route.id in initialState.errors;
|
|
7971
8115
|
let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess', _114 => _114.errors, 'optionalAccess', _115 => _115[route.id]]) : void 0;
|
|
7972
8116
|
let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access', _116 => _116.clientLoader, 'optionalAccess', _117 => _117.hydrate]) === true || !route.hasLoader);
|
|
7973
|
-
dataRoute.loader = async ({
|
|
7974
|
-
request,
|
|
7975
|
-
params,
|
|
7976
|
-
context,
|
|
7977
|
-
unstable_pattern,
|
|
7978
|
-
unstable_url
|
|
7979
|
-
}, singleFetch) => {
|
|
8117
|
+
dataRoute.loader = async ({ request, params, context, pattern, url }, singleFetch) => {
|
|
7980
8118
|
try {
|
|
7981
8119
|
let result = await prefetchStylesAndCallHandler(async () => {
|
|
7982
8120
|
invariant2(
|
|
@@ -7990,8 +8128,8 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
7990
8128
|
request,
|
|
7991
8129
|
params,
|
|
7992
8130
|
context,
|
|
7993
|
-
|
|
7994
|
-
|
|
8131
|
+
pattern,
|
|
8132
|
+
url,
|
|
7995
8133
|
async serverLoader() {
|
|
7996
8134
|
preventInvalidServerHandlerCall("loader", route);
|
|
7997
8135
|
if (isHydrationRequest) {
|
|
@@ -8017,13 +8155,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
8017
8155
|
route.hasLoader,
|
|
8018
8156
|
isSpaMode
|
|
8019
8157
|
);
|
|
8020
|
-
dataRoute.action = ({
|
|
8021
|
-
request,
|
|
8022
|
-
params,
|
|
8023
|
-
context,
|
|
8024
|
-
unstable_pattern,
|
|
8025
|
-
unstable_url
|
|
8026
|
-
}, singleFetch) => {
|
|
8158
|
+
dataRoute.action = ({ request, params, context, pattern, url }, singleFetch) => {
|
|
8027
8159
|
return prefetchStylesAndCallHandler(async () => {
|
|
8028
8160
|
invariant2(
|
|
8029
8161
|
routeModule,
|
|
@@ -8039,8 +8171,8 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
8039
8171
|
request,
|
|
8040
8172
|
params,
|
|
8041
8173
|
context,
|
|
8042
|
-
|
|
8043
|
-
|
|
8174
|
+
pattern,
|
|
8175
|
+
url,
|
|
8044
8176
|
async serverAction() {
|
|
8045
8177
|
preventInvalidServerHandlerCall("action", route);
|
|
8046
8178
|
return fetchServerAction(singleFetch);
|
|
@@ -8235,7 +8367,13 @@ function getPartialManifest({ sri, ...manifest }, router) {
|
|
|
8235
8367
|
segments.pop();
|
|
8236
8368
|
}
|
|
8237
8369
|
paths.forEach((path) => {
|
|
8238
|
-
let matches =
|
|
8370
|
+
let matches = matchRoutesImpl(
|
|
8371
|
+
router.routes,
|
|
8372
|
+
path,
|
|
8373
|
+
router.basename || "/",
|
|
8374
|
+
false,
|
|
8375
|
+
router.branches
|
|
8376
|
+
);
|
|
8239
8377
|
if (matches) {
|
|
8240
8378
|
matches.forEach((m) => routeIds.add(m.route.id));
|
|
8241
8379
|
}
|
|
@@ -8982,6 +9120,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
|
|
|
8982
9120
|
href: manifest.url,
|
|
8983
9121
|
crossOrigin: scriptProps.crossOrigin,
|
|
8984
9122
|
integrity: sri[manifest.url],
|
|
9123
|
+
nonce: scriptProps.nonce,
|
|
8985
9124
|
suppressHydrationWarning: true
|
|
8986
9125
|
}
|
|
8987
9126
|
) : null, /* @__PURE__ */ React7.createElement(
|
|
@@ -8991,6 +9130,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
|
|
|
8991
9130
|
href: manifest.entry.module,
|
|
8992
9131
|
crossOrigin: scriptProps.crossOrigin,
|
|
8993
9132
|
integrity: sri[manifest.entry.module],
|
|
9133
|
+
nonce: scriptProps.nonce,
|
|
8994
9134
|
suppressHydrationWarning: true
|
|
8995
9135
|
}
|
|
8996
9136
|
), preloads.map((path) => /* @__PURE__ */ React7.createElement(
|
|
@@ -9001,6 +9141,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
|
|
|
9001
9141
|
href: path,
|
|
9002
9142
|
crossOrigin: scriptProps.crossOrigin,
|
|
9003
9143
|
integrity: sri[path],
|
|
9144
|
+
nonce: scriptProps.nonce,
|
|
9004
9145
|
suppressHydrationWarning: true
|
|
9005
9146
|
}
|
|
9006
9147
|
)), initialScripts);
|
|
@@ -9198,7 +9339,7 @@ function createMemoryRouter(routes, opts) {
|
|
|
9198
9339
|
mapRouteProperties,
|
|
9199
9340
|
dataStrategy: _optionalChain([opts, 'optionalAccess', _135 => _135.dataStrategy]),
|
|
9200
9341
|
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _136 => _136.patchRoutesOnNavigation]),
|
|
9201
|
-
|
|
9342
|
+
instrumentations: _optionalChain([opts, 'optionalAccess', _137 => _137.instrumentations])
|
|
9202
9343
|
}).initialize();
|
|
9203
9344
|
}
|
|
9204
9345
|
var Deferred2 = class {
|
|
@@ -9224,10 +9365,10 @@ function RouterProvider({
|
|
|
9224
9365
|
router,
|
|
9225
9366
|
flushSync: reactDomFlushSyncImpl,
|
|
9226
9367
|
onError,
|
|
9227
|
-
|
|
9368
|
+
useTransitions
|
|
9228
9369
|
}) {
|
|
9229
9370
|
let unstable_rsc = useIsRSCRouterContext();
|
|
9230
|
-
|
|
9371
|
+
useTransitions = unstable_rsc || useTransitions;
|
|
9231
9372
|
let [_state, setStateImpl] = React9.useState(router.state);
|
|
9232
9373
|
let [state, setOptimisticState] = useOptimisticSafe(_state);
|
|
9233
9374
|
let [pendingState, setPendingState] = React9.useState();
|
|
@@ -9245,7 +9386,7 @@ function RouterProvider({
|
|
|
9245
9386
|
(error) => onError(error, {
|
|
9246
9387
|
location: newState.location,
|
|
9247
9388
|
params: _nullishCoalesce(_optionalChain([newState, 'access', _138 => _138.matches, 'access', _139 => _139[0], 'optionalAccess', _140 => _140.params]), () => ( {})),
|
|
9248
|
-
|
|
9389
|
+
pattern: getRoutePattern(newState.matches)
|
|
9249
9390
|
})
|
|
9250
9391
|
);
|
|
9251
9392
|
}
|
|
@@ -9267,11 +9408,11 @@ function RouterProvider({
|
|
|
9267
9408
|
if (!viewTransitionOpts || !isViewTransitionAvailable) {
|
|
9268
9409
|
if (reactDomFlushSyncImpl && flushSync) {
|
|
9269
9410
|
reactDomFlushSyncImpl(() => setStateImpl(newState));
|
|
9270
|
-
} else if (
|
|
9411
|
+
} else if (useTransitions === false) {
|
|
9271
9412
|
setStateImpl(newState);
|
|
9272
9413
|
} else {
|
|
9273
9414
|
React9.startTransition(() => {
|
|
9274
|
-
if (
|
|
9415
|
+
if (useTransitions === true) {
|
|
9275
9416
|
setOptimisticState((s) => getOptimisticRouterState(s, newState));
|
|
9276
9417
|
}
|
|
9277
9418
|
setStateImpl(newState);
|
|
@@ -9329,7 +9470,7 @@ function RouterProvider({
|
|
|
9329
9470
|
reactDomFlushSyncImpl,
|
|
9330
9471
|
transition,
|
|
9331
9472
|
renderDfd,
|
|
9332
|
-
|
|
9473
|
+
useTransitions,
|
|
9333
9474
|
setOptimisticState,
|
|
9334
9475
|
onError
|
|
9335
9476
|
]
|
|
@@ -9355,11 +9496,11 @@ function RouterProvider({
|
|
|
9355
9496
|
let newState = pendingState;
|
|
9356
9497
|
let renderPromise = renderDfd.promise;
|
|
9357
9498
|
let transition2 = router.window.document.startViewTransition(async () => {
|
|
9358
|
-
if (
|
|
9499
|
+
if (useTransitions === false) {
|
|
9359
9500
|
setStateImpl(newState);
|
|
9360
9501
|
} else {
|
|
9361
9502
|
React9.startTransition(() => {
|
|
9362
|
-
if (
|
|
9503
|
+
if (useTransitions === true) {
|
|
9363
9504
|
setOptimisticState((s) => getOptimisticRouterState(s, newState));
|
|
9364
9505
|
}
|
|
9365
9506
|
setStateImpl(newState);
|
|
@@ -9379,7 +9520,7 @@ function RouterProvider({
|
|
|
9379
9520
|
pendingState,
|
|
9380
9521
|
renderDfd,
|
|
9381
9522
|
router.window,
|
|
9382
|
-
|
|
9523
|
+
useTransitions,
|
|
9383
9524
|
setOptimisticState
|
|
9384
9525
|
]);
|
|
9385
9526
|
React9.useEffect(() => {
|
|
@@ -9433,12 +9574,13 @@ function RouterProvider({
|
|
|
9433
9574
|
location: state.location,
|
|
9434
9575
|
navigationType: state.historyAction,
|
|
9435
9576
|
navigator,
|
|
9436
|
-
|
|
9577
|
+
useTransitions
|
|
9437
9578
|
},
|
|
9438
9579
|
/* @__PURE__ */ React9.createElement(
|
|
9439
9580
|
MemoizedDataRoutes,
|
|
9440
9581
|
{
|
|
9441
9582
|
routes: router.routes,
|
|
9583
|
+
manifest: router.manifest,
|
|
9442
9584
|
future: router.future,
|
|
9443
9585
|
state,
|
|
9444
9586
|
isStatic: false,
|
|
@@ -9461,22 +9603,29 @@ function getOptimisticRouterState(currentState, newState) {
|
|
|
9461
9603
|
fetchers: newState.fetchers
|
|
9462
9604
|
};
|
|
9463
9605
|
}
|
|
9464
|
-
var MemoizedDataRoutes = React9.memo(
|
|
9465
|
-
function
|
|
9606
|
+
var MemoizedDataRoutes = React9.memo(DataRoutes2);
|
|
9607
|
+
function DataRoutes2({
|
|
9466
9608
|
routes,
|
|
9609
|
+
manifest,
|
|
9467
9610
|
future,
|
|
9468
9611
|
state,
|
|
9469
9612
|
isStatic,
|
|
9470
9613
|
onError
|
|
9471
9614
|
}) {
|
|
9472
|
-
return useRoutesImpl(routes, void 0, {
|
|
9615
|
+
return useRoutesImpl(routes, void 0, {
|
|
9616
|
+
manifest,
|
|
9617
|
+
state,
|
|
9618
|
+
isStatic,
|
|
9619
|
+
onError,
|
|
9620
|
+
future
|
|
9621
|
+
});
|
|
9473
9622
|
}
|
|
9474
9623
|
function MemoryRouter({
|
|
9475
9624
|
basename,
|
|
9476
9625
|
children,
|
|
9477
9626
|
initialEntries,
|
|
9478
9627
|
initialIndex,
|
|
9479
|
-
|
|
9628
|
+
useTransitions
|
|
9480
9629
|
}) {
|
|
9481
9630
|
let historyRef = React9.useRef();
|
|
9482
9631
|
if (historyRef.current == null) {
|
|
@@ -9493,13 +9642,13 @@ function MemoryRouter({
|
|
|
9493
9642
|
});
|
|
9494
9643
|
let setState = React9.useCallback(
|
|
9495
9644
|
(newState) => {
|
|
9496
|
-
if (
|
|
9645
|
+
if (useTransitions === false) {
|
|
9497
9646
|
setStateImpl(newState);
|
|
9498
9647
|
} else {
|
|
9499
9648
|
React9.startTransition(() => setStateImpl(newState));
|
|
9500
9649
|
}
|
|
9501
9650
|
},
|
|
9502
|
-
[
|
|
9651
|
+
[useTransitions]
|
|
9503
9652
|
);
|
|
9504
9653
|
React9.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
9505
9654
|
return /* @__PURE__ */ React9.createElement(
|
|
@@ -9510,7 +9659,7 @@ function MemoryRouter({
|
|
|
9510
9659
|
location: state.location,
|
|
9511
9660
|
navigationType: state.action,
|
|
9512
9661
|
navigator: history,
|
|
9513
|
-
|
|
9662
|
+
useTransitions
|
|
9514
9663
|
}
|
|
9515
9664
|
);
|
|
9516
9665
|
}
|
|
@@ -9562,7 +9711,7 @@ function Router({
|
|
|
9562
9711
|
navigationType = "POP" /* Pop */,
|
|
9563
9712
|
navigator,
|
|
9564
9713
|
static: staticProp = false,
|
|
9565
|
-
|
|
9714
|
+
useTransitions
|
|
9566
9715
|
}) {
|
|
9567
9716
|
invariant(
|
|
9568
9717
|
!useInRouterContext(),
|
|
@@ -9574,10 +9723,10 @@ function Router({
|
|
|
9574
9723
|
basename,
|
|
9575
9724
|
navigator,
|
|
9576
9725
|
static: staticProp,
|
|
9577
|
-
|
|
9726
|
+
useTransitions,
|
|
9578
9727
|
future: {}
|
|
9579
9728
|
}),
|
|
9580
|
-
[basename, navigator, staticProp,
|
|
9729
|
+
[basename, navigator, staticProp, useTransitions]
|
|
9581
9730
|
);
|
|
9582
9731
|
if (typeof locationProp === "string") {
|
|
9583
9732
|
locationProp = parsePath(locationProp);
|
|
@@ -9588,7 +9737,7 @@ function Router({
|
|
|
9588
9737
|
hash = "",
|
|
9589
9738
|
state = null,
|
|
9590
9739
|
key = "default",
|
|
9591
|
-
|
|
9740
|
+
mask
|
|
9592
9741
|
} = locationProp;
|
|
9593
9742
|
let locationContext = React9.useMemo(() => {
|
|
9594
9743
|
let trailingPathname = stripBasename(pathname, basename);
|
|
@@ -9602,20 +9751,11 @@ function Router({
|
|
|
9602
9751
|
hash,
|
|
9603
9752
|
state,
|
|
9604
9753
|
key,
|
|
9605
|
-
|
|
9754
|
+
mask
|
|
9606
9755
|
},
|
|
9607
9756
|
navigationType
|
|
9608
9757
|
};
|
|
9609
|
-
}, [
|
|
9610
|
-
basename,
|
|
9611
|
-
pathname,
|
|
9612
|
-
search,
|
|
9613
|
-
hash,
|
|
9614
|
-
state,
|
|
9615
|
-
key,
|
|
9616
|
-
navigationType,
|
|
9617
|
-
unstable_mask
|
|
9618
|
-
]);
|
|
9758
|
+
}, [basename, pathname, search, hash, state, key, navigationType, mask]);
|
|
9619
9759
|
warning(
|
|
9620
9760
|
locationContext != null,
|
|
9621
9761
|
`<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.`
|
|
@@ -9644,7 +9784,7 @@ function Await({
|
|
|
9644
9784
|
dataRouterContext.onError(error, {
|
|
9645
9785
|
location: dataRouterStateContext.location,
|
|
9646
9786
|
params: _optionalChain([dataRouterStateContext, 'access', _147 => _147.matches, 'access', _148 => _148[0], 'optionalAccess', _149 => _149.params]) || {},
|
|
9647
|
-
|
|
9787
|
+
pattern: getRoutePattern(dataRouterStateContext.matches),
|
|
9648
9788
|
errorInfo
|
|
9649
9789
|
});
|
|
9650
9790
|
}
|
|
@@ -9970,4 +10110,6 @@ function withErrorBoundaryProps(ErrorBoundary) {
|
|
|
9970
10110
|
|
|
9971
10111
|
|
|
9972
10112
|
|
|
9973
|
-
|
|
10113
|
+
|
|
10114
|
+
|
|
10115
|
+
exports.Action = Action; exports.createMemoryHistory = createMemoryHistory; exports.createBrowserHistory = createBrowserHistory; exports.createHashHistory = createHashHistory; exports.invariant = invariant; exports.warning = warning; exports.createPath = createPath; exports.parsePath = parsePath; exports.createContext = createContext; exports.RouterContextProvider = RouterContextProvider; exports.convertRoutesToDataRoutes = convertRoutesToDataRoutes; exports.matchRoutes = matchRoutes; exports.matchRoutesImpl = matchRoutesImpl; exports.generatePath = generatePath; exports.matchPath = matchPath; exports.stripBasename = stripBasename; exports.resolvePath = resolvePath; exports.resolveTo = resolveTo; exports.joinPaths = joinPaths; exports.data = data; exports.redirect = redirect; exports.redirectDocument = redirectDocument; exports.replace = replace; exports.ErrorResponseImpl = ErrorResponseImpl; exports.isRouteErrorResponse = isRouteErrorResponse; exports.parseToInfo = parseToInfo; exports.escapeHtml = escapeHtml; exports.encode = encode; exports.instrumentHandler = instrumentHandler; exports.IDLE_NAVIGATION = IDLE_NAVIGATION; exports.IDLE_FETCHER = IDLE_FETCHER; exports.IDLE_BLOCKER = IDLE_BLOCKER; exports.createRouter = createRouter; exports.createStaticHandler = createStaticHandler; exports.getStaticContextFromError = getStaticContextFromError; exports.invalidProtocols = invalidProtocols; exports.isDataWithResponseInit = isDataWithResponseInit; exports.isResponse = isResponse; exports.isRedirectStatusCode = isRedirectStatusCode; exports.isRedirectResponse = isRedirectResponse; exports.isMutationMethod = isMutationMethod; exports.createRequestInit = createRequestInit; exports.SingleFetchRedirectSymbol = SingleFetchRedirectSymbol; exports.SINGLE_FETCH_REDIRECT_STATUS = SINGLE_FETCH_REDIRECT_STATUS; exports.NO_BODY_STATUS_CODES = NO_BODY_STATUS_CODES; exports.StreamTransfer = StreamTransfer; exports.getTurboStreamSingleFetchDataStrategy = getTurboStreamSingleFetchDataStrategy; exports.getSingleFetchDataStrategyImpl = getSingleFetchDataStrategyImpl; exports.stripIndexParam = stripIndexParam; exports.singleFetchUrl = singleFetchUrl; exports.decodeViaTurboStream = decodeViaTurboStream; exports.DataRouterContext = DataRouterContext; exports.DataRouterStateContext = DataRouterStateContext; exports.RSCRouterContext = RSCRouterContext; exports.ViewTransitionContext = ViewTransitionContext; exports.FetchersContext = FetchersContext; exports.AwaitContextProvider = AwaitContextProvider; exports.NavigationContext = NavigationContext; exports.LocationContext = LocationContext; exports.RouteContext = RouteContext; exports.ENABLE_DEV_WARNINGS = ENABLE_DEV_WARNINGS; exports.warnOnce = warnOnce; exports.decodeRedirectErrorDigest = decodeRedirectErrorDigest; exports.decodeRouteErrorResponseDigest = decodeRouteErrorResponseDigest; exports.useHref = useHref; exports.useInRouterContext = useInRouterContext; exports.useLocation = useLocation; exports.useNavigationType = useNavigationType; exports.useMatch = useMatch; exports.useNavigate = useNavigate; exports.useOutletContext = useOutletContext; exports.useOutlet = useOutlet; exports.useParams = useParams; exports.useResolvedPath = useResolvedPath; exports.useRoutes = useRoutes; exports.useRouteId = useRouteId; exports.useNavigation = useNavigation; exports.useRevalidator = useRevalidator; exports.useMatches = useMatches; exports.useLoaderData = useLoaderData; exports.useRouteLoaderData = useRouteLoaderData; exports.useActionData = useActionData; exports.useRouteError = useRouteError; exports.useAsyncValue = useAsyncValue; exports.useAsyncError = useAsyncError; exports.useBlocker = useBlocker; exports.useRoute = useRoute; exports.RemixErrorBoundary = RemixErrorBoundary; exports.createServerRoutes = createServerRoutes; exports.createClientRoutesWithHMRRevalidationOptOut = createClientRoutesWithHMRRevalidationOptOut; exports.noActionDefinedError = noActionDefinedError; exports.createClientRoutes = createClientRoutes; exports.shouldHydrateRouteLoader = shouldHydrateRouteLoader; exports.URL_LIMIT = URL_LIMIT; exports.getPatchRoutesOnNavigationFunction = getPatchRoutesOnNavigationFunction; exports.useFogOFWarDiscovery = useFogOFWarDiscovery; exports.getManifestPath = getManifestPath; exports.FrameworkContext = FrameworkContext; exports.usePrefetchBehavior = usePrefetchBehavior; exports.CRITICAL_CSS_DATA_ATTRIBUTE = CRITICAL_CSS_DATA_ATTRIBUTE; exports.Links = Links; exports.PrefetchPageLinks = PrefetchPageLinks; exports.Meta = Meta; exports.setIsHydrated = setIsHydrated; exports.Scripts = Scripts; exports.mergeRefs = mergeRefs; exports.mapRouteProperties = mapRouteProperties; exports.hydrationRouteProperties = hydrationRouteProperties; exports.createMemoryRouter = createMemoryRouter; exports.RouterProvider = RouterProvider; exports.DataRoutes = DataRoutes2; exports.MemoryRouter = MemoryRouter; exports.Navigate = Navigate; exports.Outlet = Outlet; exports.Route = Route; exports.Router = Router; exports.Routes = Routes; exports.Await = Await; exports.createRoutesFromChildren = createRoutesFromChildren; exports.createRoutesFromElements = createRoutesFromElements; exports.renderMatches = renderMatches; exports.WithComponentProps = WithComponentProps; exports.withComponentProps = withComponentProps; exports.WithHydrateFallbackProps = WithHydrateFallbackProps; exports.withHydrateFallbackProps = withHydrateFallbackProps; exports.WithErrorBoundaryProps = WithErrorBoundaryProps; exports.withErrorBoundaryProps = withErrorBoundaryProps;
|