react-router 0.0.0-experimental-c19b79d → 0.0.0-experimental-31a822c5f
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-B4aBBnx8.d.ts +310 -0
- package/dist/development/browser-CN2w9Cbu.d.mts +310 -0
- package/dist/development/{chunk-LUB73E44.js → chunk-CZ7KRWQZ.js} +827 -64
- package/dist/development/{chunk-AGOH44BE.mjs → chunk-FXUONXY4.mjs} +132 -808
- package/dist/development/chunk-SE36CWVW.js +1308 -0
- package/dist/development/chunk-T5RKBXBV.js +188 -0
- package/dist/development/{chunk-IMKEG5CI.mjs → chunk-WTUOISGV.mjs} +2 -2
- package/dist/development/dom-export.d.mts +48 -3
- package/dist/development/dom-export.d.ts +48 -1
- package/dist/development/dom-export.js +703 -18
- package/dist/development/dom-export.mjs +687 -9
- package/dist/development/{index-react-server-client-DKvU8YRr.d.ts → index-react-server-client-BOJoTiaG.d.ts} +134 -134
- package/dist/{production/index-react-server-client-2EDmGlsZ.d.mts → development/index-react-server-client-CuQLmpku.d.mts} +1 -2
- package/dist/development/index-react-server-client.d.mts +2 -3
- 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.js +1 -1
- package/dist/development/index-react-server.mjs +1 -1
- package/dist/development/index.d.mts +9 -316
- package/dist/development/index.d.ts +9 -358
- package/dist/development/index.js +82 -914
- package/dist/development/index.mjs +3 -9
- package/dist/development/lib/types/internal.d.mts +2 -3
- 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/{production/register-BrVEYTED.d.mts → development/register-BblEgJPm.d.mts} +1 -1
- package/dist/development/{register-D8NQoPsO.d.ts → register-D18raRVf.d.ts} +1 -1
- package/dist/development/{context-BqL5Eckq.d.mts → route-data-nQS6GSUI.d.mts} +472 -2
- package/dist/development/{routeModules-BmVo7q9e.d.ts → routeModules-9wlxglVk.d.ts} +12 -12
- package/dist/production/browser-B4aBBnx8.d.ts +310 -0
- package/dist/production/browser-CN2w9Cbu.d.mts +310 -0
- package/dist/production/{chunk-2L5AG5Y5.js → chunk-DRKUM6HW.js} +827 -64
- package/dist/production/{chunk-AODJW4D3.mjs → chunk-IGF74WUC.mjs} +132 -808
- package/dist/production/{chunk-UOQCOPF6.mjs → chunk-RUSRTUHT.mjs} +2 -2
- package/dist/production/chunk-UU3LJMU6.js +188 -0
- package/dist/production/chunk-YVVCGSEG.js +1308 -0
- package/dist/production/dom-export.d.mts +48 -3
- package/dist/production/dom-export.d.ts +48 -1
- package/dist/production/dom-export.js +703 -18
- package/dist/production/dom-export.mjs +687 -9
- package/dist/production/{index-react-server-client-DKvU8YRr.d.ts → index-react-server-client-BOJoTiaG.d.ts} +134 -134
- package/dist/{development/index-react-server-client-2EDmGlsZ.d.mts → production/index-react-server-client-CuQLmpku.d.mts} +1 -2
- package/dist/production/index-react-server-client.d.mts +2 -3
- 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.js +1 -1
- package/dist/production/index-react-server.mjs +1 -1
- package/dist/production/index.d.mts +9 -316
- package/dist/production/index.d.ts +9 -358
- package/dist/production/index.js +82 -914
- package/dist/production/index.mjs +3 -9
- package/dist/production/lib/types/internal.d.mts +2 -3
- 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-BrVEYTED.d.mts → production/register-BblEgJPm.d.mts} +1 -1
- package/dist/production/{register-D8NQoPsO.d.ts → register-D18raRVf.d.ts} +1 -1
- package/dist/production/{context-BqL5Eckq.d.mts → route-data-nQS6GSUI.d.mts} +472 -2
- package/dist/production/{routeModules-BmVo7q9e.d.ts → routeModules-9wlxglVk.d.ts} +12 -12
- package/package.json +1 -1
- package/dist/development/browser-z32v5KVN.d.mts +0 -46
- package/dist/development/chunk-2G2U5HGB.js +0 -2089
- package/dist/development/route-data-CDwqkzPE.d.mts +0 -473
- package/dist/production/browser-z32v5KVN.d.mts +0 -46
- package/dist/production/chunk-FGRCWJDI.js +0 -2089
- package/dist/production/route-data-CDwqkzPE.d.mts +0 -473
|
@@ -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 v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-31a822c5f
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -439,7 +439,7 @@ function isUnsupportedLazyRouteFunctionKey(key) {
|
|
|
439
439
|
function isIndexRoute(route) {
|
|
440
440
|
return route.index === true;
|
|
441
441
|
}
|
|
442
|
-
function convertRoutesToDataRoutes(routes,
|
|
442
|
+
function convertRoutesToDataRoutes(routes, mapRouteProperties2, parentPath = [], manifest = {}, allowInPlaceMutations = false) {
|
|
443
443
|
return routes.map((route, index) => {
|
|
444
444
|
let treePath = [...parentPath, String(index)];
|
|
445
445
|
let id = typeof route.id === "string" ? route.id : treePath.join("-");
|
|
@@ -454,7 +454,7 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath = [],
|
|
|
454
454
|
if (isIndexRoute(route)) {
|
|
455
455
|
let indexRoute = {
|
|
456
456
|
...route,
|
|
457
|
-
...
|
|
457
|
+
...mapRouteProperties2(route),
|
|
458
458
|
id
|
|
459
459
|
};
|
|
460
460
|
manifest[id] = indexRoute;
|
|
@@ -462,7 +462,7 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath = [],
|
|
|
462
462
|
} else {
|
|
463
463
|
let pathOrLayoutRoute = {
|
|
464
464
|
...route,
|
|
465
|
-
...
|
|
465
|
+
...mapRouteProperties2(route),
|
|
466
466
|
id,
|
|
467
467
|
children: void 0
|
|
468
468
|
};
|
|
@@ -470,7 +470,7 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath = [],
|
|
|
470
470
|
if (route.children) {
|
|
471
471
|
pathOrLayoutRoute.children = convertRoutesToDataRoutes(
|
|
472
472
|
route.children,
|
|
473
|
-
|
|
473
|
+
mapRouteProperties2,
|
|
474
474
|
treePath,
|
|
475
475
|
manifest,
|
|
476
476
|
allowInPlaceMutations
|
|
@@ -720,18 +720,18 @@ function matchPath(pattern, pathname) {
|
|
|
720
720
|
let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
|
|
721
721
|
let captureGroups = match.slice(1);
|
|
722
722
|
let params = compiledParams.reduce(
|
|
723
|
-
(
|
|
723
|
+
(memo2, { paramName, isOptional }, index) => {
|
|
724
724
|
if (paramName === "*") {
|
|
725
725
|
let splatValue = captureGroups[index] || "";
|
|
726
726
|
pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1");
|
|
727
727
|
}
|
|
728
728
|
const value = captureGroups[index];
|
|
729
729
|
if (isOptional && !value) {
|
|
730
|
-
|
|
730
|
+
memo2[paramName] = void 0;
|
|
731
731
|
} else {
|
|
732
|
-
|
|
732
|
+
memo2[paramName] = (value || "").replace(/%2F/g, "/");
|
|
733
733
|
}
|
|
734
|
-
return
|
|
734
|
+
return memo2;
|
|
735
735
|
},
|
|
736
736
|
{}
|
|
737
737
|
);
|
|
@@ -993,12 +993,12 @@ function createRouter(init) {
|
|
|
993
993
|
init.routes.length > 0,
|
|
994
994
|
"You must provide a non-empty routes array to createRouter"
|
|
995
995
|
);
|
|
996
|
-
let
|
|
997
|
-
let
|
|
996
|
+
let hydrationRouteProperties2 = init.hydrationRouteProperties || [];
|
|
997
|
+
let mapRouteProperties2 = init.mapRouteProperties || defaultMapRouteProperties;
|
|
998
998
|
let manifest = {};
|
|
999
999
|
let dataRoutes = convertRoutesToDataRoutes(
|
|
1000
1000
|
init.routes,
|
|
1001
|
-
|
|
1001
|
+
mapRouteProperties2,
|
|
1002
1002
|
void 0,
|
|
1003
1003
|
manifest
|
|
1004
1004
|
);
|
|
@@ -1610,12 +1610,12 @@ function createRouter(init) {
|
|
|
1610
1610
|
};
|
|
1611
1611
|
} else {
|
|
1612
1612
|
let dsMatches = getTargetedDataStrategyMatches(
|
|
1613
|
-
|
|
1613
|
+
mapRouteProperties2,
|
|
1614
1614
|
manifest,
|
|
1615
1615
|
request,
|
|
1616
1616
|
matches,
|
|
1617
1617
|
actionMatch,
|
|
1618
|
-
initialHydration ? [] :
|
|
1618
|
+
initialHydration ? [] : hydrationRouteProperties2,
|
|
1619
1619
|
scopedContext
|
|
1620
1620
|
);
|
|
1621
1621
|
let results = await callDataStrategy(
|
|
@@ -1736,14 +1736,14 @@ function createRouter(init) {
|
|
|
1736
1736
|
let { dsMatches, revalidatingFetchers } = getMatchesToLoad(
|
|
1737
1737
|
request,
|
|
1738
1738
|
scopedContext,
|
|
1739
|
-
|
|
1739
|
+
mapRouteProperties2,
|
|
1740
1740
|
manifest,
|
|
1741
1741
|
init.history,
|
|
1742
1742
|
state,
|
|
1743
1743
|
matches,
|
|
1744
1744
|
activeSubmission,
|
|
1745
1745
|
location,
|
|
1746
|
-
initialHydration ? [] :
|
|
1746
|
+
initialHydration ? [] : hydrationRouteProperties2,
|
|
1747
1747
|
initialHydration === true,
|
|
1748
1748
|
isRevalidationRequired,
|
|
1749
1749
|
cancelledFetcherLoads,
|
|
@@ -1992,12 +1992,12 @@ function createRouter(init) {
|
|
|
1992
1992
|
fetchControllers.set(key, abortController);
|
|
1993
1993
|
let originatingLoadId = incrementingLoadId;
|
|
1994
1994
|
let fetchMatches = getTargetedDataStrategyMatches(
|
|
1995
|
-
|
|
1995
|
+
mapRouteProperties2,
|
|
1996
1996
|
manifest,
|
|
1997
1997
|
fetchRequest,
|
|
1998
1998
|
requestMatches,
|
|
1999
1999
|
match,
|
|
2000
|
-
|
|
2000
|
+
hydrationRouteProperties2,
|
|
2001
2001
|
scopedContext
|
|
2002
2002
|
);
|
|
2003
2003
|
let actionResults = await callDataStrategy(
|
|
@@ -2054,14 +2054,14 @@ function createRouter(init) {
|
|
|
2054
2054
|
let { dsMatches, revalidatingFetchers } = getMatchesToLoad(
|
|
2055
2055
|
revalidationRequest,
|
|
2056
2056
|
scopedContext,
|
|
2057
|
-
|
|
2057
|
+
mapRouteProperties2,
|
|
2058
2058
|
manifest,
|
|
2059
2059
|
init.history,
|
|
2060
2060
|
state,
|
|
2061
2061
|
matches,
|
|
2062
2062
|
submission,
|
|
2063
2063
|
nextLocation,
|
|
2064
|
-
|
|
2064
|
+
hydrationRouteProperties2,
|
|
2065
2065
|
false,
|
|
2066
2066
|
isRevalidationRequired,
|
|
2067
2067
|
cancelledFetcherLoads,
|
|
@@ -2207,12 +2207,12 @@ function createRouter(init) {
|
|
|
2207
2207
|
fetchControllers.set(key, abortController);
|
|
2208
2208
|
let originatingLoadId = incrementingLoadId;
|
|
2209
2209
|
let dsMatches = getTargetedDataStrategyMatches(
|
|
2210
|
-
|
|
2210
|
+
mapRouteProperties2,
|
|
2211
2211
|
manifest,
|
|
2212
2212
|
fetchRequest,
|
|
2213
2213
|
matches,
|
|
2214
2214
|
match,
|
|
2215
|
-
|
|
2215
|
+
hydrationRouteProperties2,
|
|
2216
2216
|
scopedContext
|
|
2217
2217
|
);
|
|
2218
2218
|
let results = await callDataStrategy(
|
|
@@ -2647,7 +2647,7 @@ function createRouter(init) {
|
|
|
2647
2647
|
children,
|
|
2648
2648
|
routesToUse,
|
|
2649
2649
|
localManifest,
|
|
2650
|
-
|
|
2650
|
+
mapRouteProperties2,
|
|
2651
2651
|
false
|
|
2652
2652
|
);
|
|
2653
2653
|
}
|
|
@@ -2684,7 +2684,7 @@ function createRouter(init) {
|
|
|
2684
2684
|
manifest = {};
|
|
2685
2685
|
inFlightDataRoutes = convertRoutesToDataRoutes(
|
|
2686
2686
|
newRoutes,
|
|
2687
|
-
|
|
2687
|
+
mapRouteProperties2,
|
|
2688
2688
|
void 0,
|
|
2689
2689
|
manifest
|
|
2690
2690
|
);
|
|
@@ -2697,7 +2697,7 @@ function createRouter(init) {
|
|
|
2697
2697
|
children,
|
|
2698
2698
|
routesToUse,
|
|
2699
2699
|
manifest,
|
|
2700
|
-
|
|
2700
|
+
mapRouteProperties2,
|
|
2701
2701
|
unstable_allowElementMutations
|
|
2702
2702
|
);
|
|
2703
2703
|
if (isNonHMR) {
|
|
@@ -2755,10 +2755,10 @@ function createStaticHandler(routes, opts) {
|
|
|
2755
2755
|
);
|
|
2756
2756
|
let manifest = {};
|
|
2757
2757
|
let basename = (opts ? opts.basename : null) || "/";
|
|
2758
|
-
let
|
|
2758
|
+
let mapRouteProperties2 = _optionalChain([opts, 'optionalAccess', _16 => _16.mapRouteProperties]) || defaultMapRouteProperties;
|
|
2759
2759
|
let dataRoutes = convertRoutesToDataRoutes(
|
|
2760
2760
|
routes,
|
|
2761
|
-
|
|
2761
|
+
mapRouteProperties2,
|
|
2762
2762
|
void 0,
|
|
2763
2763
|
manifest
|
|
2764
2764
|
);
|
|
@@ -2819,7 +2819,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2819
2819
|
await loadLazyMiddlewareForMatches(
|
|
2820
2820
|
matches,
|
|
2821
2821
|
manifest,
|
|
2822
|
-
|
|
2822
|
+
mapRouteProperties2
|
|
2823
2823
|
);
|
|
2824
2824
|
let renderedStaticContext;
|
|
2825
2825
|
let response = await runServerMiddlewarePipeline(
|
|
@@ -2966,7 +2966,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2966
2966
|
requestContext instanceof RouterContextProvider,
|
|
2967
2967
|
"When using middleware in `staticHandler.queryRoute()`, any provided `requestContext` must be an instance of `RouterContextProvider`"
|
|
2968
2968
|
);
|
|
2969
|
-
await loadLazyMiddlewareForMatches(matches, manifest,
|
|
2969
|
+
await loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties2);
|
|
2970
2970
|
let response = await runServerMiddlewarePipeline(
|
|
2971
2971
|
{
|
|
2972
2972
|
request,
|
|
@@ -3101,7 +3101,7 @@ function createStaticHandler(routes, opts) {
|
|
|
3101
3101
|
};
|
|
3102
3102
|
} else {
|
|
3103
3103
|
let dsMatches = getTargetedDataStrategyMatches(
|
|
3104
|
-
|
|
3104
|
+
mapRouteProperties2,
|
|
3105
3105
|
manifest,
|
|
3106
3106
|
request,
|
|
3107
3107
|
matches,
|
|
@@ -3232,7 +3232,7 @@ function createStaticHandler(routes, opts) {
|
|
|
3232
3232
|
let dsMatches;
|
|
3233
3233
|
if (routeMatch) {
|
|
3234
3234
|
dsMatches = getTargetedDataStrategyMatches(
|
|
3235
|
-
|
|
3235
|
+
mapRouteProperties2,
|
|
3236
3236
|
manifest,
|
|
3237
3237
|
request,
|
|
3238
3238
|
matches,
|
|
@@ -3248,7 +3248,7 @@ function createStaticHandler(routes, opts) {
|
|
|
3248
3248
|
dsMatches = matches.map((match, index) => {
|
|
3249
3249
|
if (maxIdx != null && index > maxIdx) {
|
|
3250
3250
|
return getDataStrategyMatch(
|
|
3251
|
-
|
|
3251
|
+
mapRouteProperties2,
|
|
3252
3252
|
manifest,
|
|
3253
3253
|
request,
|
|
3254
3254
|
match,
|
|
@@ -3258,7 +3258,7 @@ function createStaticHandler(routes, opts) {
|
|
|
3258
3258
|
);
|
|
3259
3259
|
}
|
|
3260
3260
|
return getDataStrategyMatch(
|
|
3261
|
-
|
|
3261
|
+
mapRouteProperties2,
|
|
3262
3262
|
manifest,
|
|
3263
3263
|
request,
|
|
3264
3264
|
match,
|
|
@@ -3518,7 +3518,7 @@ function normalizeNavigateOptions(isFetcher, path, opts) {
|
|
|
3518
3518
|
parsedPath.search = `?${searchParams}`;
|
|
3519
3519
|
return { path: createPath(parsedPath), submission };
|
|
3520
3520
|
}
|
|
3521
|
-
function getMatchesToLoad(request, scopedContext,
|
|
3521
|
+
function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest, history, state, matches, submission, location, lazyRoutePropertiesToSkip, initialHydration, isRevalidationRequired, cancelledFetcherLoads, fetchersQueuedForDeletion, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, hasPatchRoutesOnNavigation, pendingActionResult) {
|
|
3522
3522
|
let actionResult = pendingActionResult ? isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : pendingActionResult[1].data : void 0;
|
|
3523
3523
|
let currentUrl = history.createURL(state.location);
|
|
3524
3524
|
let nextUrl = history.createURL(location);
|
|
@@ -3561,7 +3561,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest,
|
|
|
3561
3561
|
}
|
|
3562
3562
|
if (forceShouldLoad !== null) {
|
|
3563
3563
|
return getDataStrategyMatch(
|
|
3564
|
-
|
|
3564
|
+
mapRouteProperties2,
|
|
3565
3565
|
manifest,
|
|
3566
3566
|
request,
|
|
3567
3567
|
match,
|
|
@@ -3581,7 +3581,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest,
|
|
|
3581
3581
|
};
|
|
3582
3582
|
let shouldLoad = shouldRevalidateLoader(match, shouldRevalidateArgs);
|
|
3583
3583
|
return getDataStrategyMatch(
|
|
3584
|
-
|
|
3584
|
+
mapRouteProperties2,
|
|
3585
3585
|
manifest,
|
|
3586
3586
|
request,
|
|
3587
3587
|
match,
|
|
@@ -3628,7 +3628,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest,
|
|
|
3628
3628
|
if (cancelledFetcherLoads.has(key)) {
|
|
3629
3629
|
cancelledFetcherLoads.delete(key);
|
|
3630
3630
|
fetcherDsMatches = getTargetedDataStrategyMatches(
|
|
3631
|
-
|
|
3631
|
+
mapRouteProperties2,
|
|
3632
3632
|
manifest,
|
|
3633
3633
|
fetchRequest,
|
|
3634
3634
|
fetcherMatches,
|
|
@@ -3639,7 +3639,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest,
|
|
|
3639
3639
|
} else if (isMidInitialLoad) {
|
|
3640
3640
|
if (isRevalidationRequired) {
|
|
3641
3641
|
fetcherDsMatches = getTargetedDataStrategyMatches(
|
|
3642
|
-
|
|
3642
|
+
mapRouteProperties2,
|
|
3643
3643
|
manifest,
|
|
3644
3644
|
fetchRequest,
|
|
3645
3645
|
fetcherMatches,
|
|
@@ -3655,7 +3655,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest,
|
|
|
3655
3655
|
};
|
|
3656
3656
|
if (shouldRevalidateLoader(fetcherMatch, shouldRevalidateArgs)) {
|
|
3657
3657
|
fetcherDsMatches = getTargetedDataStrategyMatches(
|
|
3658
|
-
|
|
3658
|
+
mapRouteProperties2,
|
|
3659
3659
|
manifest,
|
|
3660
3660
|
fetchRequest,
|
|
3661
3661
|
fetcherMatches,
|
|
@@ -3727,7 +3727,7 @@ function shouldRevalidateLoader(loaderMatch, arg) {
|
|
|
3727
3727
|
}
|
|
3728
3728
|
return arg.defaultShouldRevalidate;
|
|
3729
3729
|
}
|
|
3730
|
-
function patchRoutesImpl(routeId, children, routesToUse, manifest,
|
|
3730
|
+
function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties2, allowElementMutations) {
|
|
3731
3731
|
let childrenToPatch;
|
|
3732
3732
|
if (routeId) {
|
|
3733
3733
|
let route = manifest[routeId];
|
|
@@ -3757,7 +3757,7 @@ function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRoutePrope
|
|
|
3757
3757
|
if (uniqueChildren.length > 0) {
|
|
3758
3758
|
let newRoutes = convertRoutesToDataRoutes(
|
|
3759
3759
|
uniqueChildren,
|
|
3760
|
-
|
|
3760
|
+
mapRouteProperties2,
|
|
3761
3761
|
[routeId || "_", "patch", String(_optionalChain([childrenToPatch, 'optionalAccess', _30 => _30.length]) || "0")],
|
|
3762
3762
|
manifest
|
|
3763
3763
|
);
|
|
@@ -3769,7 +3769,7 @@ function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRoutePrope
|
|
|
3769
3769
|
let existingRouteTyped = existingRoute;
|
|
3770
3770
|
let [newRouteTyped] = convertRoutesToDataRoutes(
|
|
3771
3771
|
[newRoute],
|
|
3772
|
-
|
|
3772
|
+
mapRouteProperties2,
|
|
3773
3773
|
[],
|
|
3774
3774
|
// Doesn't matter for mutated routes since they already have an id
|
|
3775
3775
|
{},
|
|
@@ -3803,7 +3803,7 @@ var loadLazyRouteProperty = ({
|
|
|
3803
3803
|
key,
|
|
3804
3804
|
route,
|
|
3805
3805
|
manifest,
|
|
3806
|
-
mapRouteProperties
|
|
3806
|
+
mapRouteProperties: mapRouteProperties2
|
|
3807
3807
|
}) => {
|
|
3808
3808
|
let routeToUpdate = manifest[route.id];
|
|
3809
3809
|
invariant(routeToUpdate, "No route found in manifest");
|
|
@@ -3842,7 +3842,7 @@ var loadLazyRouteProperty = ({
|
|
|
3842
3842
|
let value = await lazyFn();
|
|
3843
3843
|
if (value != null) {
|
|
3844
3844
|
Object.assign(routeToUpdate, { [key]: value });
|
|
3845
|
-
Object.assign(routeToUpdate,
|
|
3845
|
+
Object.assign(routeToUpdate, mapRouteProperties2(routeToUpdate));
|
|
3846
3846
|
}
|
|
3847
3847
|
}
|
|
3848
3848
|
if (typeof routeToUpdate.lazy === "object") {
|
|
@@ -3856,7 +3856,7 @@ var loadLazyRouteProperty = ({
|
|
|
3856
3856
|
return propertyPromise;
|
|
3857
3857
|
};
|
|
3858
3858
|
var lazyRouteFunctionCache = /* @__PURE__ */ new WeakMap();
|
|
3859
|
-
function loadLazyRoute(route, type, manifest,
|
|
3859
|
+
function loadLazyRoute(route, type, manifest, mapRouteProperties2, lazyRoutePropertiesToSkip) {
|
|
3860
3860
|
let routeToUpdate = manifest[route.id];
|
|
3861
3861
|
invariant(routeToUpdate, "No route found in manifest");
|
|
3862
3862
|
if (!route.lazy) {
|
|
@@ -3909,7 +3909,7 @@ function loadLazyRoute(route, type, manifest, mapRouteProperties, lazyRoutePrope
|
|
|
3909
3909
|
// To keep things framework agnostic, we use the provided `mapRouteProperties`
|
|
3910
3910
|
// function to set the framework-aware properties (`element`/`hasErrorBoundary`)
|
|
3911
3911
|
// since the logic will differ between frameworks.
|
|
3912
|
-
...
|
|
3912
|
+
...mapRouteProperties2(routeToUpdate),
|
|
3913
3913
|
lazy: void 0
|
|
3914
3914
|
});
|
|
3915
3915
|
})();
|
|
@@ -3932,7 +3932,7 @@ function loadLazyRoute(route, type, manifest, mapRouteProperties, lazyRoutePrope
|
|
|
3932
3932
|
key,
|
|
3933
3933
|
route,
|
|
3934
3934
|
manifest,
|
|
3935
|
-
mapRouteProperties
|
|
3935
|
+
mapRouteProperties: mapRouteProperties2
|
|
3936
3936
|
});
|
|
3937
3937
|
if (promise) {
|
|
3938
3938
|
lazyPropertyPromises.push(promise);
|
|
@@ -3955,7 +3955,7 @@ function loadLazyRoute(route, type, manifest, mapRouteProperties, lazyRoutePrope
|
|
|
3955
3955
|
function isNonNullable(value) {
|
|
3956
3956
|
return value !== void 0;
|
|
3957
3957
|
}
|
|
3958
|
-
function loadLazyMiddlewareForMatches(matches, manifest,
|
|
3958
|
+
function loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties2) {
|
|
3959
3959
|
let promises = matches.map(({ route }) => {
|
|
3960
3960
|
if (typeof route.lazy !== "object" || !route.lazy.middleware) {
|
|
3961
3961
|
return void 0;
|
|
@@ -3964,7 +3964,7 @@ function loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties) {
|
|
|
3964
3964
|
key: "middleware",
|
|
3965
3965
|
route,
|
|
3966
3966
|
manifest,
|
|
3967
|
-
mapRouteProperties
|
|
3967
|
+
mapRouteProperties: mapRouteProperties2
|
|
3968
3968
|
});
|
|
3969
3969
|
}).filter(isNonNullable);
|
|
3970
3970
|
return promises.length > 0 ? Promise.all(promises) : void 0;
|
|
@@ -4100,18 +4100,18 @@ async function callRouteMiddleware(args, middlewares, handler, processResult, is
|
|
|
4100
4100
|
return response;
|
|
4101
4101
|
}
|
|
4102
4102
|
}
|
|
4103
|
-
function getDataStrategyMatchLazyPromises(
|
|
4103
|
+
function getDataStrategyMatchLazyPromises(mapRouteProperties2, manifest, request, match, lazyRoutePropertiesToSkip) {
|
|
4104
4104
|
let lazyMiddlewarePromise = loadLazyRouteProperty({
|
|
4105
4105
|
key: "middleware",
|
|
4106
4106
|
route: match.route,
|
|
4107
4107
|
manifest,
|
|
4108
|
-
mapRouteProperties
|
|
4108
|
+
mapRouteProperties: mapRouteProperties2
|
|
4109
4109
|
});
|
|
4110
4110
|
let lazyRoutePromises = loadLazyRoute(
|
|
4111
4111
|
match.route,
|
|
4112
4112
|
isMutationMethod(request.method) ? "action" : "loader",
|
|
4113
4113
|
manifest,
|
|
4114
|
-
|
|
4114
|
+
mapRouteProperties2,
|
|
4115
4115
|
lazyRoutePropertiesToSkip
|
|
4116
4116
|
);
|
|
4117
4117
|
return {
|
|
@@ -4120,10 +4120,10 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request,
|
|
|
4120
4120
|
handler: lazyRoutePromises.lazyHandlerPromise
|
|
4121
4121
|
};
|
|
4122
4122
|
}
|
|
4123
|
-
function getDataStrategyMatch(
|
|
4123
|
+
function getDataStrategyMatch(mapRouteProperties2, manifest, request, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, unstable_shouldRevalidateArgs = null) {
|
|
4124
4124
|
let isUsingNewApi = false;
|
|
4125
4125
|
let _lazyPromises = getDataStrategyMatchLazyPromises(
|
|
4126
|
-
|
|
4126
|
+
mapRouteProperties2,
|
|
4127
4127
|
manifest,
|
|
4128
4128
|
request,
|
|
4129
4129
|
match,
|
|
@@ -4165,7 +4165,7 @@ function getDataStrategyMatch(mapRouteProperties, manifest, request, match, lazy
|
|
|
4165
4165
|
}
|
|
4166
4166
|
};
|
|
4167
4167
|
}
|
|
4168
|
-
function getTargetedDataStrategyMatches(
|
|
4168
|
+
function getTargetedDataStrategyMatches(mapRouteProperties2, manifest, request, matches, targetMatch, lazyRoutePropertiesToSkip, scopedContext, shouldRevalidateArgs = null) {
|
|
4169
4169
|
return matches.map((match) => {
|
|
4170
4170
|
if (match.route.id !== targetMatch.route.id) {
|
|
4171
4171
|
return {
|
|
@@ -4174,7 +4174,7 @@ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, m
|
|
|
4174
4174
|
unstable_shouldRevalidateArgs: shouldRevalidateArgs,
|
|
4175
4175
|
unstable_shouldCallHandler: () => false,
|
|
4176
4176
|
_lazyPromises: getDataStrategyMatchLazyPromises(
|
|
4177
|
-
|
|
4177
|
+
mapRouteProperties2,
|
|
4178
4178
|
manifest,
|
|
4179
4179
|
request,
|
|
4180
4180
|
match,
|
|
@@ -4184,7 +4184,7 @@ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, m
|
|
|
4184
4184
|
};
|
|
4185
4185
|
}
|
|
4186
4186
|
return getDataStrategyMatch(
|
|
4187
|
-
|
|
4187
|
+
mapRouteProperties2,
|
|
4188
4188
|
manifest,
|
|
4189
4189
|
request,
|
|
4190
4190
|
match,
|
|
@@ -4926,7 +4926,7 @@ function createDeferred() {
|
|
|
4926
4926
|
}
|
|
4927
4927
|
|
|
4928
4928
|
// lib/dom/ssr/single-fetch.tsx
|
|
4929
|
-
var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react); var React8 = _interopRequireWildcard(_react); var React7 = _interopRequireWildcard(_react); var React6 = _interopRequireWildcard(_react); var React5 = _interopRequireWildcard(_react); var React4 = _interopRequireWildcard(_react);
|
|
4929
|
+
var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react); var React8 = _interopRequireWildcard(_react); var React7 = _interopRequireWildcard(_react); var React6 = _interopRequireWildcard(_react); var React5 = _interopRequireWildcard(_react); var React4 = _interopRequireWildcard(_react); var React9 = _interopRequireWildcard(_react);
|
|
4930
4930
|
|
|
4931
4931
|
// vendor/turbo-stream-v2/utils.ts
|
|
4932
4932
|
var HOLE = -1;
|
|
@@ -7033,14 +7033,14 @@ function groupRoutesByParentId(manifest) {
|
|
|
7033
7033
|
return routes;
|
|
7034
7034
|
}
|
|
7035
7035
|
function getRouteComponents(route, routeModule, isSpaMode) {
|
|
7036
|
-
let
|
|
7036
|
+
let Component4 = getRouteModuleComponent(routeModule);
|
|
7037
7037
|
let HydrateFallback = routeModule.HydrateFallback && (!isSpaMode || route.id === "root") ? routeModule.HydrateFallback : route.id === "root" ? RemixRootDefaultHydrateFallback : void 0;
|
|
7038
7038
|
let ErrorBoundary = routeModule.ErrorBoundary ? routeModule.ErrorBoundary : route.id === "root" ? () => /* @__PURE__ */ React5.createElement(RemixRootDefaultErrorBoundary, { error: useRouteError() }) : void 0;
|
|
7039
7039
|
if (route.id === "root" && routeModule.Layout) {
|
|
7040
7040
|
return {
|
|
7041
|
-
...
|
|
7042
|
-
element: /* @__PURE__ */ React5.createElement(routeModule.Layout, null, /* @__PURE__ */ React5.createElement(
|
|
7043
|
-
} : { Component:
|
|
7041
|
+
...Component4 ? {
|
|
7042
|
+
element: /* @__PURE__ */ React5.createElement(routeModule.Layout, null, /* @__PURE__ */ React5.createElement(Component4, null))
|
|
7043
|
+
} : { Component: Component4 },
|
|
7044
7044
|
...ErrorBoundary ? {
|
|
7045
7045
|
errorElement: /* @__PURE__ */ React5.createElement(routeModule.Layout, null, /* @__PURE__ */ React5.createElement(ErrorBoundary, null))
|
|
7046
7046
|
} : { ErrorBoundary },
|
|
@@ -7049,7 +7049,7 @@ function getRouteComponents(route, routeModule, isSpaMode) {
|
|
|
7049
7049
|
} : { HydrateFallback }
|
|
7050
7050
|
};
|
|
7051
7051
|
}
|
|
7052
|
-
return { Component:
|
|
7052
|
+
return { Component: Component4, ErrorBoundary, HydrateFallback };
|
|
7053
7053
|
}
|
|
7054
7054
|
function createServerRoutes(manifest, routeModules, future, isSpaMode, parentId = "", routesByParentId = groupRoutesByParentId(manifest), spaModeLazyPromise = Promise.resolve({ Component: () => null })) {
|
|
7055
7055
|
return (routesByParentId[parentId] || []).map((route) => {
|
|
@@ -8243,6 +8243,769 @@ function BoundaryShell({
|
|
|
8243
8243
|
), /* @__PURE__ */ React8.createElement("title", null, title)), /* @__PURE__ */ React8.createElement("body", null, /* @__PURE__ */ React8.createElement("main", { style: { fontFamily: "system-ui, sans-serif", padding: "2rem" } }, children, renderScripts ? /* @__PURE__ */ React8.createElement(Scripts, null) : null)));
|
|
8244
8244
|
}
|
|
8245
8245
|
|
|
8246
|
+
// lib/components.tsx
|
|
8247
|
+
|
|
8248
|
+
function mapRouteProperties(route) {
|
|
8249
|
+
let updates = {
|
|
8250
|
+
// Note: this check also occurs in createRoutesFromChildren so update
|
|
8251
|
+
// there if you change this -- please and thank you!
|
|
8252
|
+
hasErrorBoundary: route.hasErrorBoundary || route.ErrorBoundary != null || route.errorElement != null
|
|
8253
|
+
};
|
|
8254
|
+
if (route.Component) {
|
|
8255
|
+
if (ENABLE_DEV_WARNINGS) {
|
|
8256
|
+
if (route.element) {
|
|
8257
|
+
warning(
|
|
8258
|
+
false,
|
|
8259
|
+
"You should not include both `Component` and `element` on your route - `Component` will be used."
|
|
8260
|
+
);
|
|
8261
|
+
}
|
|
8262
|
+
}
|
|
8263
|
+
Object.assign(updates, {
|
|
8264
|
+
element: React9.createElement(route.Component),
|
|
8265
|
+
Component: void 0
|
|
8266
|
+
});
|
|
8267
|
+
}
|
|
8268
|
+
if (route.HydrateFallback) {
|
|
8269
|
+
if (ENABLE_DEV_WARNINGS) {
|
|
8270
|
+
if (route.hydrateFallbackElement) {
|
|
8271
|
+
warning(
|
|
8272
|
+
false,
|
|
8273
|
+
"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."
|
|
8274
|
+
);
|
|
8275
|
+
}
|
|
8276
|
+
}
|
|
8277
|
+
Object.assign(updates, {
|
|
8278
|
+
hydrateFallbackElement: React9.createElement(route.HydrateFallback),
|
|
8279
|
+
HydrateFallback: void 0
|
|
8280
|
+
});
|
|
8281
|
+
}
|
|
8282
|
+
if (route.ErrorBoundary) {
|
|
8283
|
+
if (ENABLE_DEV_WARNINGS) {
|
|
8284
|
+
if (route.errorElement) {
|
|
8285
|
+
warning(
|
|
8286
|
+
false,
|
|
8287
|
+
"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."
|
|
8288
|
+
);
|
|
8289
|
+
}
|
|
8290
|
+
}
|
|
8291
|
+
Object.assign(updates, {
|
|
8292
|
+
errorElement: React9.createElement(route.ErrorBoundary),
|
|
8293
|
+
ErrorBoundary: void 0
|
|
8294
|
+
});
|
|
8295
|
+
}
|
|
8296
|
+
return updates;
|
|
8297
|
+
}
|
|
8298
|
+
var hydrationRouteProperties = [
|
|
8299
|
+
"HydrateFallback",
|
|
8300
|
+
"hydrateFallbackElement"
|
|
8301
|
+
];
|
|
8302
|
+
function createMemoryRouter(routes, opts) {
|
|
8303
|
+
return createRouter({
|
|
8304
|
+
basename: _optionalChain([opts, 'optionalAccess', _107 => _107.basename]),
|
|
8305
|
+
getContext: _optionalChain([opts, 'optionalAccess', _108 => _108.getContext]),
|
|
8306
|
+
future: _optionalChain([opts, 'optionalAccess', _109 => _109.future]),
|
|
8307
|
+
history: createMemoryHistory({
|
|
8308
|
+
initialEntries: _optionalChain([opts, 'optionalAccess', _110 => _110.initialEntries]),
|
|
8309
|
+
initialIndex: _optionalChain([opts, 'optionalAccess', _111 => _111.initialIndex])
|
|
8310
|
+
}),
|
|
8311
|
+
hydrationData: _optionalChain([opts, 'optionalAccess', _112 => _112.hydrationData]),
|
|
8312
|
+
routes,
|
|
8313
|
+
hydrationRouteProperties,
|
|
8314
|
+
mapRouteProperties,
|
|
8315
|
+
dataStrategy: _optionalChain([opts, 'optionalAccess', _113 => _113.dataStrategy]),
|
|
8316
|
+
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _114 => _114.patchRoutesOnNavigation])
|
|
8317
|
+
}).initialize();
|
|
8318
|
+
}
|
|
8319
|
+
var Deferred2 = class {
|
|
8320
|
+
constructor() {
|
|
8321
|
+
this.status = "pending";
|
|
8322
|
+
this.promise = new Promise((resolve, reject) => {
|
|
8323
|
+
this.resolve = (value) => {
|
|
8324
|
+
if (this.status === "pending") {
|
|
8325
|
+
this.status = "resolved";
|
|
8326
|
+
resolve(value);
|
|
8327
|
+
}
|
|
8328
|
+
};
|
|
8329
|
+
this.reject = (reason) => {
|
|
8330
|
+
if (this.status === "pending") {
|
|
8331
|
+
this.status = "rejected";
|
|
8332
|
+
reject(reason);
|
|
8333
|
+
}
|
|
8334
|
+
};
|
|
8335
|
+
});
|
|
8336
|
+
}
|
|
8337
|
+
};
|
|
8338
|
+
function shallowDiff(a, b) {
|
|
8339
|
+
if (a === b) {
|
|
8340
|
+
return false;
|
|
8341
|
+
}
|
|
8342
|
+
let aKeys = Object.keys(a);
|
|
8343
|
+
let bKeys = Object.keys(b);
|
|
8344
|
+
if (aKeys.length !== bKeys.length) {
|
|
8345
|
+
return true;
|
|
8346
|
+
}
|
|
8347
|
+
for (let key of aKeys) {
|
|
8348
|
+
if (a[key] !== b[key]) {
|
|
8349
|
+
return true;
|
|
8350
|
+
}
|
|
8351
|
+
}
|
|
8352
|
+
return false;
|
|
8353
|
+
}
|
|
8354
|
+
function UNSTABLE_TransitionEnabledRouterProvider({
|
|
8355
|
+
router,
|
|
8356
|
+
flushSync: reactDomFlushSyncImpl,
|
|
8357
|
+
unstable_onError
|
|
8358
|
+
}) {
|
|
8359
|
+
let fetcherData = React9.useRef(/* @__PURE__ */ new Map());
|
|
8360
|
+
let [revalidating, startRevalidation] = React9.useTransition();
|
|
8361
|
+
let [state, setState] = React9.useState(router.state);
|
|
8362
|
+
router.__setPendingRerender = (promise) => startRevalidation(
|
|
8363
|
+
// @ts-expect-error - need react 19 types for this to be async
|
|
8364
|
+
async () => {
|
|
8365
|
+
const rerender = await promise;
|
|
8366
|
+
startRevalidation(() => {
|
|
8367
|
+
rerender();
|
|
8368
|
+
});
|
|
8369
|
+
}
|
|
8370
|
+
);
|
|
8371
|
+
let navigator = React9.useMemo(() => {
|
|
8372
|
+
return {
|
|
8373
|
+
createHref: router.createHref,
|
|
8374
|
+
encodeLocation: router.encodeLocation,
|
|
8375
|
+
go: (n) => router.navigate(n),
|
|
8376
|
+
push: (to, state2, opts) => router.navigate(to, {
|
|
8377
|
+
state: state2,
|
|
8378
|
+
preventScrollReset: _optionalChain([opts, 'optionalAccess', _115 => _115.preventScrollReset])
|
|
8379
|
+
}),
|
|
8380
|
+
replace: (to, state2, opts) => router.navigate(to, {
|
|
8381
|
+
replace: true,
|
|
8382
|
+
state: state2,
|
|
8383
|
+
preventScrollReset: _optionalChain([opts, 'optionalAccess', _116 => _116.preventScrollReset])
|
|
8384
|
+
})
|
|
8385
|
+
};
|
|
8386
|
+
}, [router]);
|
|
8387
|
+
let basename = router.basename || "/";
|
|
8388
|
+
let dataRouterContext = React9.useMemo(
|
|
8389
|
+
() => ({
|
|
8390
|
+
router,
|
|
8391
|
+
navigator,
|
|
8392
|
+
static: false,
|
|
8393
|
+
basename,
|
|
8394
|
+
unstable_onError
|
|
8395
|
+
}),
|
|
8396
|
+
[router, navigator, basename, unstable_onError]
|
|
8397
|
+
);
|
|
8398
|
+
React9.useLayoutEffect(() => {
|
|
8399
|
+
return router.subscribe(
|
|
8400
|
+
(newState, { deletedFetchers, flushSync, viewTransitionOpts }) => {
|
|
8401
|
+
newState.fetchers.forEach((fetcher, key) => {
|
|
8402
|
+
if (fetcher.data !== void 0) {
|
|
8403
|
+
fetcherData.current.set(key, fetcher.data);
|
|
8404
|
+
}
|
|
8405
|
+
});
|
|
8406
|
+
deletedFetchers.forEach((key) => fetcherData.current.delete(key));
|
|
8407
|
+
const diff = shallowDiff(state, newState);
|
|
8408
|
+
if (!diff) return;
|
|
8409
|
+
if (flushSync) {
|
|
8410
|
+
if (reactDomFlushSyncImpl) {
|
|
8411
|
+
reactDomFlushSyncImpl(() => setState(newState));
|
|
8412
|
+
} else {
|
|
8413
|
+
setState(newState);
|
|
8414
|
+
}
|
|
8415
|
+
} else {
|
|
8416
|
+
React9.startTransition(() => {
|
|
8417
|
+
setState(newState);
|
|
8418
|
+
});
|
|
8419
|
+
}
|
|
8420
|
+
}
|
|
8421
|
+
);
|
|
8422
|
+
}, [router, reactDomFlushSyncImpl, state]);
|
|
8423
|
+
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React9.createElement(
|
|
8424
|
+
DataRouterStateContext.Provider,
|
|
8425
|
+
{
|
|
8426
|
+
value: {
|
|
8427
|
+
...state,
|
|
8428
|
+
revalidation: revalidating ? "loading" : state.revalidation
|
|
8429
|
+
}
|
|
8430
|
+
},
|
|
8431
|
+
/* @__PURE__ */ React9.createElement(FetchersContext.Provider, { value: fetcherData.current }, /* @__PURE__ */ React9.createElement(
|
|
8432
|
+
Router,
|
|
8433
|
+
{
|
|
8434
|
+
basename,
|
|
8435
|
+
location: state.location,
|
|
8436
|
+
navigationType: state.historyAction,
|
|
8437
|
+
navigator
|
|
8438
|
+
},
|
|
8439
|
+
/* @__PURE__ */ React9.createElement(
|
|
8440
|
+
MemoizedDataRoutes,
|
|
8441
|
+
{
|
|
8442
|
+
routes: router.routes,
|
|
8443
|
+
future: router.future,
|
|
8444
|
+
state,
|
|
8445
|
+
unstable_onError
|
|
8446
|
+
}
|
|
8447
|
+
)
|
|
8448
|
+
))
|
|
8449
|
+
)), null);
|
|
8450
|
+
}
|
|
8451
|
+
function RouterProvider({
|
|
8452
|
+
router,
|
|
8453
|
+
flushSync: reactDomFlushSyncImpl,
|
|
8454
|
+
unstable_onError
|
|
8455
|
+
}) {
|
|
8456
|
+
let [state, setStateImpl] = React9.useState(router.state);
|
|
8457
|
+
let [pendingState, setPendingState] = React9.useState();
|
|
8458
|
+
let [vtContext, setVtContext] = React9.useState({
|
|
8459
|
+
isTransitioning: false
|
|
8460
|
+
});
|
|
8461
|
+
let [renderDfd, setRenderDfd] = React9.useState();
|
|
8462
|
+
let [transition, setTransition] = React9.useState();
|
|
8463
|
+
let [interruption, setInterruption] = React9.useState();
|
|
8464
|
+
let fetcherData = React9.useRef(/* @__PURE__ */ new Map());
|
|
8465
|
+
let logErrorsAndSetState = React9.useCallback(
|
|
8466
|
+
(newState) => {
|
|
8467
|
+
setStateImpl((prevState) => {
|
|
8468
|
+
if (newState.errors && unstable_onError) {
|
|
8469
|
+
Object.entries(newState.errors).forEach(([routeId, error]) => {
|
|
8470
|
+
if (_optionalChain([prevState, 'access', _117 => _117.errors, 'optionalAccess', _118 => _118[routeId]]) !== error) {
|
|
8471
|
+
unstable_onError(error);
|
|
8472
|
+
}
|
|
8473
|
+
});
|
|
8474
|
+
}
|
|
8475
|
+
return newState;
|
|
8476
|
+
});
|
|
8477
|
+
},
|
|
8478
|
+
[unstable_onError]
|
|
8479
|
+
);
|
|
8480
|
+
let setState = React9.useCallback(
|
|
8481
|
+
(newState, { deletedFetchers, flushSync, viewTransitionOpts }) => {
|
|
8482
|
+
newState.fetchers.forEach((fetcher, key) => {
|
|
8483
|
+
if (fetcher.data !== void 0) {
|
|
8484
|
+
fetcherData.current.set(key, fetcher.data);
|
|
8485
|
+
}
|
|
8486
|
+
});
|
|
8487
|
+
deletedFetchers.forEach((key) => fetcherData.current.delete(key));
|
|
8488
|
+
warnOnce(
|
|
8489
|
+
flushSync === false || reactDomFlushSyncImpl != null,
|
|
8490
|
+
'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.'
|
|
8491
|
+
);
|
|
8492
|
+
let isViewTransitionAvailable = router.window != null && router.window.document != null && typeof router.window.document.startViewTransition === "function";
|
|
8493
|
+
warnOnce(
|
|
8494
|
+
viewTransitionOpts == null || isViewTransitionAvailable,
|
|
8495
|
+
"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."
|
|
8496
|
+
);
|
|
8497
|
+
if (!viewTransitionOpts || !isViewTransitionAvailable) {
|
|
8498
|
+
if (reactDomFlushSyncImpl && flushSync) {
|
|
8499
|
+
reactDomFlushSyncImpl(() => logErrorsAndSetState(newState));
|
|
8500
|
+
} else {
|
|
8501
|
+
React9.startTransition(() => logErrorsAndSetState(newState));
|
|
8502
|
+
}
|
|
8503
|
+
return;
|
|
8504
|
+
}
|
|
8505
|
+
if (reactDomFlushSyncImpl && flushSync) {
|
|
8506
|
+
reactDomFlushSyncImpl(() => {
|
|
8507
|
+
if (transition) {
|
|
8508
|
+
renderDfd && renderDfd.resolve();
|
|
8509
|
+
transition.skipTransition();
|
|
8510
|
+
}
|
|
8511
|
+
setVtContext({
|
|
8512
|
+
isTransitioning: true,
|
|
8513
|
+
flushSync: true,
|
|
8514
|
+
currentLocation: viewTransitionOpts.currentLocation,
|
|
8515
|
+
nextLocation: viewTransitionOpts.nextLocation
|
|
8516
|
+
});
|
|
8517
|
+
});
|
|
8518
|
+
let t = router.window.document.startViewTransition(() => {
|
|
8519
|
+
reactDomFlushSyncImpl(() => logErrorsAndSetState(newState));
|
|
8520
|
+
});
|
|
8521
|
+
t.finished.finally(() => {
|
|
8522
|
+
reactDomFlushSyncImpl(() => {
|
|
8523
|
+
setRenderDfd(void 0);
|
|
8524
|
+
setTransition(void 0);
|
|
8525
|
+
setPendingState(void 0);
|
|
8526
|
+
setVtContext({ isTransitioning: false });
|
|
8527
|
+
});
|
|
8528
|
+
});
|
|
8529
|
+
reactDomFlushSyncImpl(() => setTransition(t));
|
|
8530
|
+
return;
|
|
8531
|
+
}
|
|
8532
|
+
if (transition) {
|
|
8533
|
+
renderDfd && renderDfd.resolve();
|
|
8534
|
+
transition.skipTransition();
|
|
8535
|
+
setInterruption({
|
|
8536
|
+
state: newState,
|
|
8537
|
+
currentLocation: viewTransitionOpts.currentLocation,
|
|
8538
|
+
nextLocation: viewTransitionOpts.nextLocation
|
|
8539
|
+
});
|
|
8540
|
+
} else {
|
|
8541
|
+
setPendingState(newState);
|
|
8542
|
+
setVtContext({
|
|
8543
|
+
isTransitioning: true,
|
|
8544
|
+
flushSync: false,
|
|
8545
|
+
currentLocation: viewTransitionOpts.currentLocation,
|
|
8546
|
+
nextLocation: viewTransitionOpts.nextLocation
|
|
8547
|
+
});
|
|
8548
|
+
}
|
|
8549
|
+
},
|
|
8550
|
+
[
|
|
8551
|
+
router.window,
|
|
8552
|
+
reactDomFlushSyncImpl,
|
|
8553
|
+
transition,
|
|
8554
|
+
renderDfd,
|
|
8555
|
+
logErrorsAndSetState
|
|
8556
|
+
]
|
|
8557
|
+
);
|
|
8558
|
+
React9.useLayoutEffect(() => router.subscribe(setState), [router, setState]);
|
|
8559
|
+
React9.useEffect(() => {
|
|
8560
|
+
if (vtContext.isTransitioning && !vtContext.flushSync) {
|
|
8561
|
+
setRenderDfd(new Deferred2());
|
|
8562
|
+
}
|
|
8563
|
+
}, [vtContext]);
|
|
8564
|
+
React9.useEffect(() => {
|
|
8565
|
+
if (renderDfd && pendingState && router.window) {
|
|
8566
|
+
let newState = pendingState;
|
|
8567
|
+
let renderPromise = renderDfd.promise;
|
|
8568
|
+
let transition2 = router.window.document.startViewTransition(async () => {
|
|
8569
|
+
React9.startTransition(() => logErrorsAndSetState(newState));
|
|
8570
|
+
await renderPromise;
|
|
8571
|
+
});
|
|
8572
|
+
transition2.finished.finally(() => {
|
|
8573
|
+
setRenderDfd(void 0);
|
|
8574
|
+
setTransition(void 0);
|
|
8575
|
+
setPendingState(void 0);
|
|
8576
|
+
setVtContext({ isTransitioning: false });
|
|
8577
|
+
});
|
|
8578
|
+
setTransition(transition2);
|
|
8579
|
+
}
|
|
8580
|
+
}, [pendingState, renderDfd, router.window, logErrorsAndSetState]);
|
|
8581
|
+
React9.useEffect(() => {
|
|
8582
|
+
if (renderDfd && pendingState && state.location.key === pendingState.location.key) {
|
|
8583
|
+
renderDfd.resolve();
|
|
8584
|
+
}
|
|
8585
|
+
}, [renderDfd, transition, state.location, pendingState]);
|
|
8586
|
+
React9.useEffect(() => {
|
|
8587
|
+
if (!vtContext.isTransitioning && interruption) {
|
|
8588
|
+
setPendingState(interruption.state);
|
|
8589
|
+
setVtContext({
|
|
8590
|
+
isTransitioning: true,
|
|
8591
|
+
flushSync: false,
|
|
8592
|
+
currentLocation: interruption.currentLocation,
|
|
8593
|
+
nextLocation: interruption.nextLocation
|
|
8594
|
+
});
|
|
8595
|
+
setInterruption(void 0);
|
|
8596
|
+
}
|
|
8597
|
+
}, [vtContext.isTransitioning, interruption]);
|
|
8598
|
+
let navigator = React9.useMemo(() => {
|
|
8599
|
+
return {
|
|
8600
|
+
createHref: router.createHref,
|
|
8601
|
+
encodeLocation: router.encodeLocation,
|
|
8602
|
+
go: (n) => router.navigate(n),
|
|
8603
|
+
push: (to, state2, opts) => router.navigate(to, {
|
|
8604
|
+
state: state2,
|
|
8605
|
+
preventScrollReset: _optionalChain([opts, 'optionalAccess', _119 => _119.preventScrollReset])
|
|
8606
|
+
}),
|
|
8607
|
+
replace: (to, state2, opts) => router.navigate(to, {
|
|
8608
|
+
replace: true,
|
|
8609
|
+
state: state2,
|
|
8610
|
+
preventScrollReset: _optionalChain([opts, 'optionalAccess', _120 => _120.preventScrollReset])
|
|
8611
|
+
})
|
|
8612
|
+
};
|
|
8613
|
+
}, [router]);
|
|
8614
|
+
let basename = router.basename || "/";
|
|
8615
|
+
let dataRouterContext = React9.useMemo(
|
|
8616
|
+
() => ({
|
|
8617
|
+
router,
|
|
8618
|
+
navigator,
|
|
8619
|
+
static: false,
|
|
8620
|
+
basename,
|
|
8621
|
+
unstable_onError
|
|
8622
|
+
}),
|
|
8623
|
+
[router, navigator, basename, unstable_onError]
|
|
8624
|
+
);
|
|
8625
|
+
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React9.createElement(DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React9.createElement(FetchersContext.Provider, { value: fetcherData.current }, /* @__PURE__ */ React9.createElement(ViewTransitionContext.Provider, { value: vtContext }, /* @__PURE__ */ React9.createElement(
|
|
8626
|
+
Router,
|
|
8627
|
+
{
|
|
8628
|
+
basename,
|
|
8629
|
+
location: state.location,
|
|
8630
|
+
navigationType: state.historyAction,
|
|
8631
|
+
navigator
|
|
8632
|
+
},
|
|
8633
|
+
/* @__PURE__ */ React9.createElement(
|
|
8634
|
+
MemoizedDataRoutes,
|
|
8635
|
+
{
|
|
8636
|
+
routes: router.routes,
|
|
8637
|
+
future: router.future,
|
|
8638
|
+
state,
|
|
8639
|
+
unstable_onError
|
|
8640
|
+
}
|
|
8641
|
+
)
|
|
8642
|
+
))))), null);
|
|
8643
|
+
}
|
|
8644
|
+
var MemoizedDataRoutes = React9.memo(DataRoutes);
|
|
8645
|
+
function DataRoutes({
|
|
8646
|
+
routes,
|
|
8647
|
+
future,
|
|
8648
|
+
state,
|
|
8649
|
+
unstable_onError
|
|
8650
|
+
}) {
|
|
8651
|
+
return useRoutesImpl(routes, void 0, state, unstable_onError, future);
|
|
8652
|
+
}
|
|
8653
|
+
function MemoryRouter({
|
|
8654
|
+
basename,
|
|
8655
|
+
children,
|
|
8656
|
+
initialEntries,
|
|
8657
|
+
initialIndex
|
|
8658
|
+
}) {
|
|
8659
|
+
let historyRef = React9.useRef();
|
|
8660
|
+
if (historyRef.current == null) {
|
|
8661
|
+
historyRef.current = createMemoryHistory({
|
|
8662
|
+
initialEntries,
|
|
8663
|
+
initialIndex,
|
|
8664
|
+
v5Compat: true
|
|
8665
|
+
});
|
|
8666
|
+
}
|
|
8667
|
+
let history = historyRef.current;
|
|
8668
|
+
let [state, setStateImpl] = React9.useState({
|
|
8669
|
+
action: history.action,
|
|
8670
|
+
location: history.location
|
|
8671
|
+
});
|
|
8672
|
+
let setState = React9.useCallback(
|
|
8673
|
+
(newState) => {
|
|
8674
|
+
React9.startTransition(() => setStateImpl(newState));
|
|
8675
|
+
},
|
|
8676
|
+
[setStateImpl]
|
|
8677
|
+
);
|
|
8678
|
+
React9.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
8679
|
+
return /* @__PURE__ */ React9.createElement(
|
|
8680
|
+
Router,
|
|
8681
|
+
{
|
|
8682
|
+
basename,
|
|
8683
|
+
children,
|
|
8684
|
+
location: state.location,
|
|
8685
|
+
navigationType: state.action,
|
|
8686
|
+
navigator: history
|
|
8687
|
+
}
|
|
8688
|
+
);
|
|
8689
|
+
}
|
|
8690
|
+
function Navigate({
|
|
8691
|
+
to,
|
|
8692
|
+
replace: replace2,
|
|
8693
|
+
state,
|
|
8694
|
+
relative
|
|
8695
|
+
}) {
|
|
8696
|
+
invariant(
|
|
8697
|
+
useInRouterContext(),
|
|
8698
|
+
// TODO: This error is probably because they somehow have 2 versions of
|
|
8699
|
+
// the router loaded. We can help them understand how to avoid that.
|
|
8700
|
+
`<Navigate> may be used only in the context of a <Router> component.`
|
|
8701
|
+
);
|
|
8702
|
+
let { static: isStatic } = React9.useContext(NavigationContext);
|
|
8703
|
+
warning(
|
|
8704
|
+
!isStatic,
|
|
8705
|
+
`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`
|
|
8706
|
+
);
|
|
8707
|
+
let { matches } = React9.useContext(RouteContext);
|
|
8708
|
+
let { pathname: locationPathname } = useLocation();
|
|
8709
|
+
let navigate = useNavigate();
|
|
8710
|
+
let path = resolveTo(
|
|
8711
|
+
to,
|
|
8712
|
+
getResolveToMatches(matches),
|
|
8713
|
+
locationPathname,
|
|
8714
|
+
relative === "path"
|
|
8715
|
+
);
|
|
8716
|
+
let jsonPath = JSON.stringify(path);
|
|
8717
|
+
React9.useEffect(() => {
|
|
8718
|
+
navigate(JSON.parse(jsonPath), { replace: replace2, state, relative });
|
|
8719
|
+
}, [navigate, jsonPath, relative, replace2, state]);
|
|
8720
|
+
return null;
|
|
8721
|
+
}
|
|
8722
|
+
function Outlet(props) {
|
|
8723
|
+
return useOutlet(props.context);
|
|
8724
|
+
}
|
|
8725
|
+
function Route(props) {
|
|
8726
|
+
invariant(
|
|
8727
|
+
false,
|
|
8728
|
+
`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`
|
|
8729
|
+
);
|
|
8730
|
+
}
|
|
8731
|
+
function Router({
|
|
8732
|
+
basename: basenameProp = "/",
|
|
8733
|
+
children = null,
|
|
8734
|
+
location: locationProp,
|
|
8735
|
+
navigationType = "POP" /* Pop */,
|
|
8736
|
+
navigator,
|
|
8737
|
+
static: staticProp = false
|
|
8738
|
+
}) {
|
|
8739
|
+
invariant(
|
|
8740
|
+
!useInRouterContext(),
|
|
8741
|
+
`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`
|
|
8742
|
+
);
|
|
8743
|
+
let basename = basenameProp.replace(/^\/*/, "/");
|
|
8744
|
+
let navigationContext = React9.useMemo(
|
|
8745
|
+
() => ({
|
|
8746
|
+
basename,
|
|
8747
|
+
navigator,
|
|
8748
|
+
static: staticProp,
|
|
8749
|
+
future: {}
|
|
8750
|
+
}),
|
|
8751
|
+
[basename, navigator, staticProp]
|
|
8752
|
+
);
|
|
8753
|
+
if (typeof locationProp === "string") {
|
|
8754
|
+
locationProp = parsePath(locationProp);
|
|
8755
|
+
}
|
|
8756
|
+
let {
|
|
8757
|
+
pathname = "/",
|
|
8758
|
+
search = "",
|
|
8759
|
+
hash = "",
|
|
8760
|
+
state = null,
|
|
8761
|
+
key = "default"
|
|
8762
|
+
} = locationProp;
|
|
8763
|
+
let locationContext = React9.useMemo(() => {
|
|
8764
|
+
let trailingPathname = stripBasename(pathname, basename);
|
|
8765
|
+
if (trailingPathname == null) {
|
|
8766
|
+
return null;
|
|
8767
|
+
}
|
|
8768
|
+
return {
|
|
8769
|
+
location: {
|
|
8770
|
+
pathname: trailingPathname,
|
|
8771
|
+
search,
|
|
8772
|
+
hash,
|
|
8773
|
+
state,
|
|
8774
|
+
key
|
|
8775
|
+
},
|
|
8776
|
+
navigationType
|
|
8777
|
+
};
|
|
8778
|
+
}, [basename, pathname, search, hash, state, key, navigationType]);
|
|
8779
|
+
warning(
|
|
8780
|
+
locationContext != null,
|
|
8781
|
+
`<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.`
|
|
8782
|
+
);
|
|
8783
|
+
if (locationContext == null) {
|
|
8784
|
+
return null;
|
|
8785
|
+
}
|
|
8786
|
+
return /* @__PURE__ */ React9.createElement(NavigationContext.Provider, { value: navigationContext }, /* @__PURE__ */ React9.createElement(LocationContext.Provider, { children, value: locationContext }));
|
|
8787
|
+
}
|
|
8788
|
+
function Routes({
|
|
8789
|
+
children,
|
|
8790
|
+
location
|
|
8791
|
+
}) {
|
|
8792
|
+
return useRoutes(createRoutesFromChildren(children), location);
|
|
8793
|
+
}
|
|
8794
|
+
function Await({
|
|
8795
|
+
children,
|
|
8796
|
+
errorElement,
|
|
8797
|
+
resolve
|
|
8798
|
+
}) {
|
|
8799
|
+
let dataRouterContext = React9.useContext(DataRouterContext);
|
|
8800
|
+
return /* @__PURE__ */ React9.createElement(
|
|
8801
|
+
AwaitErrorBoundary,
|
|
8802
|
+
{
|
|
8803
|
+
resolve,
|
|
8804
|
+
errorElement,
|
|
8805
|
+
unstable_onError: _optionalChain([dataRouterContext, 'optionalAccess', _121 => _121.unstable_onError])
|
|
8806
|
+
},
|
|
8807
|
+
/* @__PURE__ */ React9.createElement(ResolveAwait, null, children)
|
|
8808
|
+
);
|
|
8809
|
+
}
|
|
8810
|
+
var AwaitErrorBoundary = class extends React9.Component {
|
|
8811
|
+
constructor(props) {
|
|
8812
|
+
super(props);
|
|
8813
|
+
this.state = { error: null };
|
|
8814
|
+
}
|
|
8815
|
+
static getDerivedStateFromError(error) {
|
|
8816
|
+
return { error };
|
|
8817
|
+
}
|
|
8818
|
+
componentDidCatch(error, errorInfo) {
|
|
8819
|
+
if (this.props.unstable_onError) {
|
|
8820
|
+
this.props.unstable_onError(error, errorInfo);
|
|
8821
|
+
} else {
|
|
8822
|
+
console.error(
|
|
8823
|
+
"<Await> caught the following error during render",
|
|
8824
|
+
error,
|
|
8825
|
+
errorInfo
|
|
8826
|
+
);
|
|
8827
|
+
}
|
|
8828
|
+
}
|
|
8829
|
+
render() {
|
|
8830
|
+
let { children, errorElement, resolve } = this.props;
|
|
8831
|
+
let promise = null;
|
|
8832
|
+
let status = 0 /* pending */;
|
|
8833
|
+
if (!(resolve instanceof Promise)) {
|
|
8834
|
+
status = 1 /* success */;
|
|
8835
|
+
promise = Promise.resolve();
|
|
8836
|
+
Object.defineProperty(promise, "_tracked", { get: () => true });
|
|
8837
|
+
Object.defineProperty(promise, "_data", { get: () => resolve });
|
|
8838
|
+
} else if (this.state.error) {
|
|
8839
|
+
status = 2 /* error */;
|
|
8840
|
+
let renderError = this.state.error;
|
|
8841
|
+
promise = Promise.reject().catch(() => {
|
|
8842
|
+
});
|
|
8843
|
+
Object.defineProperty(promise, "_tracked", { get: () => true });
|
|
8844
|
+
Object.defineProperty(promise, "_error", { get: () => renderError });
|
|
8845
|
+
} else if (resolve._tracked) {
|
|
8846
|
+
promise = resolve;
|
|
8847
|
+
status = "_error" in promise ? 2 /* error */ : "_data" in promise ? 1 /* success */ : 0 /* pending */;
|
|
8848
|
+
} else {
|
|
8849
|
+
status = 0 /* pending */;
|
|
8850
|
+
Object.defineProperty(resolve, "_tracked", { get: () => true });
|
|
8851
|
+
promise = resolve.then(
|
|
8852
|
+
(data2) => Object.defineProperty(resolve, "_data", { get: () => data2 }),
|
|
8853
|
+
(error) => {
|
|
8854
|
+
_optionalChain([this, 'access', _122 => _122.props, 'access', _123 => _123.unstable_onError, 'optionalCall', _124 => _124(error)]);
|
|
8855
|
+
Object.defineProperty(resolve, "_error", { get: () => error });
|
|
8856
|
+
}
|
|
8857
|
+
);
|
|
8858
|
+
}
|
|
8859
|
+
if (status === 2 /* error */ && !errorElement) {
|
|
8860
|
+
throw promise._error;
|
|
8861
|
+
}
|
|
8862
|
+
if (status === 2 /* error */) {
|
|
8863
|
+
return /* @__PURE__ */ React9.createElement(AwaitContext.Provider, { value: promise, children: errorElement });
|
|
8864
|
+
}
|
|
8865
|
+
if (status === 1 /* success */) {
|
|
8866
|
+
return /* @__PURE__ */ React9.createElement(AwaitContext.Provider, { value: promise, children });
|
|
8867
|
+
}
|
|
8868
|
+
throw promise;
|
|
8869
|
+
}
|
|
8870
|
+
};
|
|
8871
|
+
function ResolveAwait({
|
|
8872
|
+
children
|
|
8873
|
+
}) {
|
|
8874
|
+
let data2 = useAsyncValue();
|
|
8875
|
+
let toRender = typeof children === "function" ? children(data2) : children;
|
|
8876
|
+
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, toRender);
|
|
8877
|
+
}
|
|
8878
|
+
function createRoutesFromChildren(children, parentPath = []) {
|
|
8879
|
+
let routes = [];
|
|
8880
|
+
React9.Children.forEach(children, (element, index) => {
|
|
8881
|
+
if (!React9.isValidElement(element)) {
|
|
8882
|
+
return;
|
|
8883
|
+
}
|
|
8884
|
+
let treePath = [...parentPath, index];
|
|
8885
|
+
if (element.type === React9.Fragment) {
|
|
8886
|
+
routes.push.apply(
|
|
8887
|
+
routes,
|
|
8888
|
+
createRoutesFromChildren(element.props.children, treePath)
|
|
8889
|
+
);
|
|
8890
|
+
return;
|
|
8891
|
+
}
|
|
8892
|
+
invariant(
|
|
8893
|
+
element.type === Route,
|
|
8894
|
+
`[${typeof element.type === "string" ? element.type : element.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`
|
|
8895
|
+
);
|
|
8896
|
+
invariant(
|
|
8897
|
+
!element.props.index || !element.props.children,
|
|
8898
|
+
"An index route cannot have child routes."
|
|
8899
|
+
);
|
|
8900
|
+
let route = {
|
|
8901
|
+
id: element.props.id || treePath.join("-"),
|
|
8902
|
+
caseSensitive: element.props.caseSensitive,
|
|
8903
|
+
element: element.props.element,
|
|
8904
|
+
Component: element.props.Component,
|
|
8905
|
+
index: element.props.index,
|
|
8906
|
+
path: element.props.path,
|
|
8907
|
+
middleware: element.props.middleware,
|
|
8908
|
+
loader: element.props.loader,
|
|
8909
|
+
action: element.props.action,
|
|
8910
|
+
hydrateFallbackElement: element.props.hydrateFallbackElement,
|
|
8911
|
+
HydrateFallback: element.props.HydrateFallback,
|
|
8912
|
+
errorElement: element.props.errorElement,
|
|
8913
|
+
ErrorBoundary: element.props.ErrorBoundary,
|
|
8914
|
+
hasErrorBoundary: element.props.hasErrorBoundary === true || element.props.ErrorBoundary != null || element.props.errorElement != null,
|
|
8915
|
+
shouldRevalidate: element.props.shouldRevalidate,
|
|
8916
|
+
handle: element.props.handle,
|
|
8917
|
+
lazy: element.props.lazy
|
|
8918
|
+
};
|
|
8919
|
+
if (element.props.children) {
|
|
8920
|
+
route.children = createRoutesFromChildren(
|
|
8921
|
+
element.props.children,
|
|
8922
|
+
treePath
|
|
8923
|
+
);
|
|
8924
|
+
}
|
|
8925
|
+
routes.push(route);
|
|
8926
|
+
});
|
|
8927
|
+
return routes;
|
|
8928
|
+
}
|
|
8929
|
+
var createRoutesFromElements = createRoutesFromChildren;
|
|
8930
|
+
function renderMatches(matches) {
|
|
8931
|
+
return _renderMatches(matches);
|
|
8932
|
+
}
|
|
8933
|
+
function useRouteComponentProps() {
|
|
8934
|
+
return {
|
|
8935
|
+
params: useParams(),
|
|
8936
|
+
loaderData: useLoaderData(),
|
|
8937
|
+
actionData: useActionData(),
|
|
8938
|
+
matches: useMatches()
|
|
8939
|
+
};
|
|
8940
|
+
}
|
|
8941
|
+
function WithComponentProps({
|
|
8942
|
+
children
|
|
8943
|
+
}) {
|
|
8944
|
+
const props = useRouteComponentProps();
|
|
8945
|
+
return React9.cloneElement(children, props);
|
|
8946
|
+
}
|
|
8947
|
+
function withComponentProps(Component4) {
|
|
8948
|
+
return function WithComponentProps2() {
|
|
8949
|
+
const props = useRouteComponentProps();
|
|
8950
|
+
return React9.createElement(Component4, props);
|
|
8951
|
+
};
|
|
8952
|
+
}
|
|
8953
|
+
function useHydrateFallbackProps() {
|
|
8954
|
+
return {
|
|
8955
|
+
params: useParams(),
|
|
8956
|
+
loaderData: useLoaderData(),
|
|
8957
|
+
actionData: useActionData()
|
|
8958
|
+
};
|
|
8959
|
+
}
|
|
8960
|
+
function WithHydrateFallbackProps({
|
|
8961
|
+
children
|
|
8962
|
+
}) {
|
|
8963
|
+
const props = useHydrateFallbackProps();
|
|
8964
|
+
return React9.cloneElement(children, props);
|
|
8965
|
+
}
|
|
8966
|
+
function withHydrateFallbackProps(HydrateFallback) {
|
|
8967
|
+
return function WithHydrateFallbackProps2() {
|
|
8968
|
+
const props = useHydrateFallbackProps();
|
|
8969
|
+
return React9.createElement(HydrateFallback, props);
|
|
8970
|
+
};
|
|
8971
|
+
}
|
|
8972
|
+
function useErrorBoundaryProps() {
|
|
8973
|
+
return {
|
|
8974
|
+
params: useParams(),
|
|
8975
|
+
loaderData: useLoaderData(),
|
|
8976
|
+
actionData: useActionData(),
|
|
8977
|
+
error: useRouteError()
|
|
8978
|
+
};
|
|
8979
|
+
}
|
|
8980
|
+
function WithErrorBoundaryProps({
|
|
8981
|
+
children
|
|
8982
|
+
}) {
|
|
8983
|
+
const props = useErrorBoundaryProps();
|
|
8984
|
+
return React9.cloneElement(children, props);
|
|
8985
|
+
}
|
|
8986
|
+
function withErrorBoundaryProps(ErrorBoundary) {
|
|
8987
|
+
return function WithErrorBoundaryProps2() {
|
|
8988
|
+
const props = useErrorBoundaryProps();
|
|
8989
|
+
return React9.createElement(ErrorBoundary, props);
|
|
8990
|
+
};
|
|
8991
|
+
}
|
|
8992
|
+
|
|
8993
|
+
|
|
8994
|
+
|
|
8995
|
+
|
|
8996
|
+
|
|
8997
|
+
|
|
8998
|
+
|
|
8999
|
+
|
|
9000
|
+
|
|
9001
|
+
|
|
9002
|
+
|
|
9003
|
+
|
|
9004
|
+
|
|
9005
|
+
|
|
9006
|
+
|
|
9007
|
+
|
|
9008
|
+
|
|
8246
9009
|
|
|
8247
9010
|
|
|
8248
9011
|
|
|
@@ -8347,4 +9110,4 @@ function BoundaryShell({
|
|
|
8347
9110
|
|
|
8348
9111
|
|
|
8349
9112
|
|
|
8350
|
-
exports.Action = Action; exports.
|
|
9113
|
+
exports.Action = Action; 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.generatePath = generatePath; exports.matchPath = matchPath; exports.stripBasename = stripBasename; exports.resolvePath = resolvePath; exports.joinPaths = joinPaths; exports.data = data; exports.redirect = redirect; exports.redirectDocument = redirectDocument; exports.replace = replace; exports.ErrorResponseImpl = ErrorResponseImpl; exports.isRouteErrorResponse = isRouteErrorResponse; exports.escapeHtml = escapeHtml; exports.encode = encode; 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.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.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.useRoutesImpl = useRoutesImpl; 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.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.UNSTABLE_TransitionEnabledRouterProvider = UNSTABLE_TransitionEnabledRouterProvider; exports.RouterProvider = RouterProvider; 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;
|