react-router 0.0.0-experimental-3d7dcee → 0.0.0-experimental-7ed11be
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 +15 -2
- package/dist/development/{chunk-QMIAKNRH.mjs → chunk-2OYLVAZB.mjs} +2 -2
- package/dist/development/{chunk-S2WJDCRE.js → chunk-BELBAVMB.js} +193 -254
- package/dist/development/{chunk-WJ2QP6HN.mjs → chunk-MUVPFEOF.mjs} +154 -210
- package/dist/development/{chunk-LSB26UC6.js → chunk-X5OYM2ET.js} +137 -132
- package/dist/{production/context-DnZM5brG.d.mts → development/context-CRZ6DK7I.d.mts} +11 -1
- package/dist/development/dom-export.d.mts +1 -1
- package/dist/development/dom-export.js +3 -3
- package/dist/development/dom-export.mjs +3 -3
- package/dist/development/{index-react-server-client-zr5eNeut.d.ts → index-react-server-client-DM3R9ovf.d.ts} +39 -23
- package/dist/{production/index-react-server-client-9rHNv-U3.d.mts → development/index-react-server-client-DbUtZHNh.d.mts} +40 -24
- package/dist/development/index-react-server-client.d.mts +3 -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.d.mts +49 -2
- package/dist/development/index-react-server.d.ts +49 -2
- package/dist/development/index-react-server.js +72 -81
- package/dist/development/index-react-server.mjs +72 -82
- package/dist/development/index.d.mts +44 -6
- package/dist/development/index.d.ts +42 -4
- package/dist/development/index.js +102 -102
- package/dist/development/index.mjs +3 -3
- package/dist/development/lib/types/internal.d.mts +8 -5
- package/dist/development/lib/types/internal.d.ts +7 -4
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{route-data-C24VEkoE.d.mts → route-data-gwXJPIqL.d.mts} +3 -3
- package/dist/development/{routeModules-FY5IBiA_.d.ts → routeModules-Dz64j-T-.d.ts} +12 -2
- package/dist/production/{chunk-OFC37UQM.mjs → chunk-7A6GBCQS.mjs} +2 -2
- package/dist/production/{chunk-7CWVKQLP.js → chunk-A4J35SEJ.js} +193 -254
- package/dist/production/{chunk-2BFZ6QQU.mjs → chunk-IC5TORKA.mjs} +154 -210
- package/dist/production/{chunk-NIW37A6Q.js → chunk-W6BB3ISI.js} +137 -132
- package/dist/{development/context-DnZM5brG.d.mts → production/context-CRZ6DK7I.d.mts} +11 -1
- package/dist/production/dom-export.d.mts +1 -1
- package/dist/production/dom-export.js +3 -3
- package/dist/production/dom-export.mjs +3 -3
- package/dist/production/{index-react-server-client-zr5eNeut.d.ts → index-react-server-client-DM3R9ovf.d.ts} +39 -23
- package/dist/{development/index-react-server-client-9rHNv-U3.d.mts → production/index-react-server-client-DbUtZHNh.d.mts} +40 -24
- package/dist/production/index-react-server-client.d.mts +3 -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.d.mts +49 -2
- package/dist/production/index-react-server.d.ts +49 -2
- package/dist/production/index-react-server.js +72 -81
- package/dist/production/index-react-server.mjs +72 -82
- package/dist/production/index.d.mts +44 -6
- package/dist/production/index.d.ts +42 -4
- package/dist/production/index.js +102 -102
- package/dist/production/index.mjs +3 -3
- package/dist/production/lib/types/internal.d.mts +8 -5
- package/dist/production/lib/types/internal.d.ts +7 -4
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/{route-data-C24VEkoE.d.mts → route-data-gwXJPIqL.d.mts} +3 -3
- package/dist/production/{routeModules-FY5IBiA_.d.ts → routeModules-Dz64j-T-.d.ts} +12 -2
- 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 v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-7ed11be
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -699,7 +699,7 @@ function generatePath(originalPath, params = {}) {
|
|
|
699
699
|
const [, key, optional] = keyMatch;
|
|
700
700
|
let param = params[key];
|
|
701
701
|
invariant(optional === "?" || param != null, `Missing ":${key}" param`);
|
|
702
|
-
return stringify2(param);
|
|
702
|
+
return encodeURIComponent(stringify2(param));
|
|
703
703
|
}
|
|
704
704
|
return segment.replace(/\?$/g, "");
|
|
705
705
|
}).filter((segment) => !!segment);
|
|
@@ -1004,6 +1004,9 @@ function createRouter(init) {
|
|
|
1004
1004
|
);
|
|
1005
1005
|
let inFlightDataRoutes;
|
|
1006
1006
|
let basename = init.basename || "/";
|
|
1007
|
+
if (!basename.startsWith("/")) {
|
|
1008
|
+
basename = `/${basename}`;
|
|
1009
|
+
}
|
|
1007
1010
|
let dataStrategyImpl = init.dataStrategy || defaultDataStrategyWithMiddleware;
|
|
1008
1011
|
let future = {
|
|
1009
1012
|
unstable_middleware: false,
|
|
@@ -1553,6 +1556,19 @@ function createRouter(init) {
|
|
|
1553
1556
|
if (discoverResult.type === "aborted") {
|
|
1554
1557
|
return { shortCircuited: true };
|
|
1555
1558
|
} else if (discoverResult.type === "error") {
|
|
1559
|
+
if (discoverResult.partialMatches.length === 0) {
|
|
1560
|
+
let { matches: matches2, route } = getShortCircuitMatches(dataRoutes);
|
|
1561
|
+
return {
|
|
1562
|
+
matches: matches2,
|
|
1563
|
+
pendingActionResult: [
|
|
1564
|
+
route.id,
|
|
1565
|
+
{
|
|
1566
|
+
type: "error" /* error */,
|
|
1567
|
+
error: discoverResult.error
|
|
1568
|
+
}
|
|
1569
|
+
]
|
|
1570
|
+
};
|
|
1571
|
+
}
|
|
1556
1572
|
let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;
|
|
1557
1573
|
return {
|
|
1558
1574
|
matches: discoverResult.partialMatches,
|
|
@@ -1684,6 +1700,16 @@ function createRouter(init) {
|
|
|
1684
1700
|
if (discoverResult.type === "aborted") {
|
|
1685
1701
|
return { shortCircuited: true };
|
|
1686
1702
|
} else if (discoverResult.type === "error") {
|
|
1703
|
+
if (discoverResult.partialMatches.length === 0) {
|
|
1704
|
+
let { matches: matches2, route } = getShortCircuitMatches(dataRoutes);
|
|
1705
|
+
return {
|
|
1706
|
+
matches: matches2,
|
|
1707
|
+
loaderData: {},
|
|
1708
|
+
errors: {
|
|
1709
|
+
[route.id]: discoverResult.error
|
|
1710
|
+
}
|
|
1711
|
+
};
|
|
1712
|
+
}
|
|
1687
1713
|
let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;
|
|
1688
1714
|
return {
|
|
1689
1715
|
matches: discoverResult.partialMatches,
|
|
@@ -2412,6 +2438,10 @@ function createRouter(init) {
|
|
|
2412
2438
|
}
|
|
2413
2439
|
return state.fetchers.get(key) || IDLE_FETCHER;
|
|
2414
2440
|
}
|
|
2441
|
+
function resetFetcher(key, opts) {
|
|
2442
|
+
abortFetcher(key, _optionalChain([opts, 'optionalAccess', _15 => _15.reason]));
|
|
2443
|
+
updateFetcherState(key, getDoneFetcher(null));
|
|
2444
|
+
}
|
|
2415
2445
|
function deleteFetcher(key) {
|
|
2416
2446
|
let fetcher = state.fetchers.get(key);
|
|
2417
2447
|
if (fetchControllers.has(key) && !(fetcher && fetcher.state === "loading" && fetchReloadIds.has(key))) {
|
|
@@ -2434,10 +2464,10 @@ function createRouter(init) {
|
|
|
2434
2464
|
}
|
|
2435
2465
|
updateState({ fetchers: new Map(state.fetchers) });
|
|
2436
2466
|
}
|
|
2437
|
-
function abortFetcher(key) {
|
|
2467
|
+
function abortFetcher(key, reason) {
|
|
2438
2468
|
let controller = fetchControllers.get(key);
|
|
2439
2469
|
if (controller) {
|
|
2440
|
-
controller.abort();
|
|
2470
|
+
controller.abort(reason);
|
|
2441
2471
|
fetchControllers.delete(key);
|
|
2442
2472
|
}
|
|
2443
2473
|
}
|
|
@@ -2701,6 +2731,7 @@ function createRouter(init) {
|
|
|
2701
2731
|
createHref: (to) => init.history.createHref(to),
|
|
2702
2732
|
encodeLocation: (to) => init.history.encodeLocation(to),
|
|
2703
2733
|
getFetcher,
|
|
2734
|
+
resetFetcher,
|
|
2704
2735
|
deleteFetcher: queueFetcherForDeletion,
|
|
2705
2736
|
dispose,
|
|
2706
2737
|
getBlocker,
|
|
@@ -2723,7 +2754,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2723
2754
|
);
|
|
2724
2755
|
let manifest = {};
|
|
2725
2756
|
let basename = (opts ? opts.basename : null) || "/";
|
|
2726
|
-
let mapRouteProperties = _optionalChain([opts, 'optionalAccess',
|
|
2757
|
+
let mapRouteProperties = _optionalChain([opts, 'optionalAccess', _16 => _16.mapRouteProperties]) || defaultMapRouteProperties;
|
|
2727
2758
|
let dataRoutes = convertRoutesToDataRoutes(
|
|
2728
2759
|
routes,
|
|
2729
2760
|
mapRouteProperties,
|
|
@@ -2823,9 +2854,23 @@ function createStaticHandler(routes, opts) {
|
|
|
2823
2854
|
return res;
|
|
2824
2855
|
},
|
|
2825
2856
|
async (error, routeId) => {
|
|
2826
|
-
if (
|
|
2857
|
+
if (isRedirectResponse(error)) {
|
|
2827
2858
|
return error;
|
|
2828
2859
|
}
|
|
2860
|
+
if (isResponse(error)) {
|
|
2861
|
+
try {
|
|
2862
|
+
error = new ErrorResponseImpl(
|
|
2863
|
+
error.status,
|
|
2864
|
+
error.statusText,
|
|
2865
|
+
await parseResponseBody(error)
|
|
2866
|
+
);
|
|
2867
|
+
} catch (e) {
|
|
2868
|
+
error = e;
|
|
2869
|
+
}
|
|
2870
|
+
}
|
|
2871
|
+
if (isDataWithResponseInit(error)) {
|
|
2872
|
+
error = dataWithResponseInitToErrorResponse(error);
|
|
2873
|
+
}
|
|
2829
2874
|
if (renderedStaticContext) {
|
|
2830
2875
|
if (routeId in renderedStaticContext.loaderData) {
|
|
2831
2876
|
renderedStaticContext.loaderData[routeId] = void 0;
|
|
@@ -2842,9 +2887,9 @@ function createStaticHandler(routes, opts) {
|
|
|
2842
2887
|
} else {
|
|
2843
2888
|
let boundaryRouteId = skipLoaderErrorBubbling ? routeId : findNearestBoundary(
|
|
2844
2889
|
matches,
|
|
2845
|
-
_optionalChain([matches, 'access',
|
|
2890
|
+
_optionalChain([matches, 'access', _17 => _17.find, 'call', _18 => _18(
|
|
2846
2891
|
(m) => m.route.id === routeId || m.route.loader
|
|
2847
|
-
), 'optionalAccess',
|
|
2892
|
+
), 'optionalAccess', _19 => _19.route, 'access', _20 => _20.id]) || routeId
|
|
2848
2893
|
).route.id;
|
|
2849
2894
|
let staticContext = {
|
|
2850
2895
|
matches,
|
|
@@ -2951,8 +2996,8 @@ function createStaticHandler(routes, opts) {
|
|
|
2951
2996
|
return res;
|
|
2952
2997
|
},
|
|
2953
2998
|
(error) => {
|
|
2954
|
-
if (
|
|
2955
|
-
return Promise.resolve(
|
|
2999
|
+
if (isDataWithResponseInit(error)) {
|
|
3000
|
+
return Promise.resolve(dataWithResponseInitToResponse(error));
|
|
2956
3001
|
}
|
|
2957
3002
|
if (isResponse(error)) {
|
|
2958
3003
|
return Promise.resolve(error);
|
|
@@ -3176,11 +3221,11 @@ function createStaticHandler(routes, opts) {
|
|
|
3176
3221
|
}
|
|
3177
3222
|
async function loadRouteData(request, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad, pendingActionResult) {
|
|
3178
3223
|
let isRouteRequest = routeMatch != null;
|
|
3179
|
-
if (isRouteRequest && !_optionalChain([routeMatch, 'optionalAccess',
|
|
3224
|
+
if (isRouteRequest && !_optionalChain([routeMatch, 'optionalAccess', _21 => _21.route, 'access', _22 => _22.loader]) && !_optionalChain([routeMatch, 'optionalAccess', _23 => _23.route, 'access', _24 => _24.lazy])) {
|
|
3180
3225
|
throw getInternalRouterError(400, {
|
|
3181
3226
|
method: request.method,
|
|
3182
3227
|
pathname: new URL(request.url).pathname,
|
|
3183
|
-
routeId: _optionalChain([routeMatch, 'optionalAccess',
|
|
3228
|
+
routeId: _optionalChain([routeMatch, 'optionalAccess', _25 => _25.route, 'access', _26 => _26.id])
|
|
3184
3229
|
});
|
|
3185
3230
|
}
|
|
3186
3231
|
let dsMatches;
|
|
@@ -3281,8 +3326,12 @@ function createStaticHandler(routes, opts) {
|
|
|
3281
3326
|
basename
|
|
3282
3327
|
);
|
|
3283
3328
|
}
|
|
3284
|
-
if (
|
|
3285
|
-
|
|
3329
|
+
if (isRouteRequest) {
|
|
3330
|
+
if (isResponse(result.result)) {
|
|
3331
|
+
throw result;
|
|
3332
|
+
} else if (isDataWithResponseInit(result.result)) {
|
|
3333
|
+
throw dataWithResponseInitToResponse(result.result);
|
|
3334
|
+
}
|
|
3286
3335
|
}
|
|
3287
3336
|
dataResults[match.route.id] = await convertDataStrategyResultToDataResult(result);
|
|
3288
3337
|
})
|
|
@@ -3484,7 +3533,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest,
|
|
|
3484
3533
|
let shouldSkipRevalidation = actionStatus && actionStatus >= 400;
|
|
3485
3534
|
let baseShouldRevalidateArgs = {
|
|
3486
3535
|
currentUrl,
|
|
3487
|
-
currentParams: _optionalChain([state, 'access',
|
|
3536
|
+
currentParams: _optionalChain([state, 'access', _27 => _27.matches, 'access', _28 => _28[0], 'optionalAccess', _29 => _29.params]) || {},
|
|
3488
3537
|
nextUrl,
|
|
3489
3538
|
nextParams: matches[0].params,
|
|
3490
3539
|
...submission,
|
|
@@ -3705,7 +3754,7 @@ function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRoutePrope
|
|
|
3705
3754
|
let newRoutes = convertRoutesToDataRoutes(
|
|
3706
3755
|
uniqueChildren,
|
|
3707
3756
|
mapRouteProperties,
|
|
3708
|
-
[routeId || "_", "patch", String(_optionalChain([childrenToPatch, 'optionalAccess',
|
|
3757
|
+
[routeId || "_", "patch", String(_optionalChain([childrenToPatch, 'optionalAccess', _30 => _30.length]) || "0")],
|
|
3709
3758
|
manifest
|
|
3710
3759
|
);
|
|
3711
3760
|
childrenToPatch.push(...newRoutes);
|
|
@@ -3742,7 +3791,7 @@ function isSameRoute(newRoute, existingRoute) {
|
|
|
3742
3791
|
return true;
|
|
3743
3792
|
}
|
|
3744
3793
|
return newRoute.children.every(
|
|
3745
|
-
(aChild, i) => _optionalChain([existingRoute, 'access',
|
|
3794
|
+
(aChild, i) => _optionalChain([existingRoute, 'access', _31 => _31.children, 'optionalAccess', _32 => _32.some, 'call', _33 => _33((bChild) => isSameRoute(aChild, bChild))])
|
|
3746
3795
|
);
|
|
3747
3796
|
}
|
|
3748
3797
|
var lazyRoutePropertyCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -3890,9 +3939,9 @@ function loadLazyRoute(route, type, manifest, mapRouteProperties, lazyRoutePrope
|
|
|
3890
3939
|
}
|
|
3891
3940
|
let lazyRoutePromise = lazyPropertyPromises.length > 0 ? Promise.all(lazyPropertyPromises).then(() => {
|
|
3892
3941
|
}) : void 0;
|
|
3893
|
-
_optionalChain([lazyRoutePromise, 'optionalAccess',
|
|
3942
|
+
_optionalChain([lazyRoutePromise, 'optionalAccess', _34 => _34.catch, 'call', _35 => _35(() => {
|
|
3894
3943
|
})]);
|
|
3895
|
-
_optionalChain([lazyHandlerPromise, 'optionalAccess',
|
|
3944
|
+
_optionalChain([lazyHandlerPromise, 'optionalAccess', _36 => _36.catch, 'call', _37 => _37(() => {
|
|
3896
3945
|
})]);
|
|
3897
3946
|
return {
|
|
3898
3947
|
lazyRoutePromise,
|
|
@@ -3929,206 +3978,116 @@ async function defaultDataStrategyWithMiddleware(args) {
|
|
|
3929
3978
|
if (!args.matches.some((m) => m.route.unstable_middleware)) {
|
|
3930
3979
|
return defaultDataStrategy(args);
|
|
3931
3980
|
}
|
|
3932
|
-
|
|
3933
|
-
|
|
3981
|
+
return runClientMiddlewarePipeline(args, () => defaultDataStrategy(args));
|
|
3982
|
+
}
|
|
3983
|
+
function runServerMiddlewarePipeline(args, handler, errorHandler) {
|
|
3984
|
+
return runMiddlewarePipeline(
|
|
3934
3985
|
args,
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
(error, routeId) => clientMiddlewareErrorHandler(
|
|
3940
|
-
error,
|
|
3941
|
-
routeId,
|
|
3942
|
-
args.matches,
|
|
3943
|
-
didCallHandler
|
|
3944
|
-
)
|
|
3986
|
+
handler,
|
|
3987
|
+
processResult,
|
|
3988
|
+
isResponse,
|
|
3989
|
+
errorHandler
|
|
3945
3990
|
);
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
if (didCallHandler) {
|
|
3949
|
-
return {
|
|
3950
|
-
[routeId]: { type: "error", result: error }
|
|
3951
|
-
};
|
|
3952
|
-
} else {
|
|
3953
|
-
let maxBoundaryIdx = Math.min(
|
|
3954
|
-
// Throwing route
|
|
3955
|
-
matches.findIndex((m) => m.route.id === routeId) || 0,
|
|
3956
|
-
// or the shallowest route that needs to load data
|
|
3957
|
-
matches.findIndex((m) => m.unstable_shouldCallHandler()) || 0
|
|
3958
|
-
);
|
|
3959
|
-
let boundaryRouteId = findNearestBoundary(
|
|
3960
|
-
matches,
|
|
3961
|
-
matches[maxBoundaryIdx].route.id
|
|
3962
|
-
).route.id;
|
|
3963
|
-
return {
|
|
3964
|
-
[boundaryRouteId]: { type: "error", result: error }
|
|
3965
|
-
};
|
|
3991
|
+
function processResult(result) {
|
|
3992
|
+
return isDataWithResponseInit(result) ? dataWithResponseInitToResponse(result) : result;
|
|
3966
3993
|
}
|
|
3967
3994
|
}
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
(m) => m.route.unstable_middleware ? m.route.unstable_middleware.map((fn) => [m.route.id, fn]) : []
|
|
3972
|
-
);
|
|
3973
|
-
let result = await callServerRouteMiddleware(
|
|
3974
|
-
{ request, params, context },
|
|
3975
|
-
tuples,
|
|
3995
|
+
function runClientMiddlewarePipeline(args, handler) {
|
|
3996
|
+
return runMiddlewarePipeline(
|
|
3997
|
+
args,
|
|
3976
3998
|
handler,
|
|
3999
|
+
(r) => r,
|
|
4000
|
+
// No post-processing needed on the client
|
|
4001
|
+
isDataStrategyResults,
|
|
3977
4002
|
errorHandler
|
|
3978
4003
|
);
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
}
|
|
3984
|
-
|
|
3985
|
-
let { request } = args;
|
|
3986
|
-
if (request.signal.aborted) {
|
|
3987
|
-
if (request.signal.reason) {
|
|
3988
|
-
throw request.signal.reason;
|
|
3989
|
-
}
|
|
3990
|
-
throw new Error(
|
|
3991
|
-
`Request aborted without an \`AbortSignal.reason\`: ${request.method} ${request.url}`
|
|
3992
|
-
);
|
|
3993
|
-
}
|
|
3994
|
-
let tuple = middlewares[idx];
|
|
3995
|
-
if (!tuple) {
|
|
3996
|
-
let result = await handler();
|
|
3997
|
-
return result;
|
|
3998
|
-
}
|
|
3999
|
-
let [routeId, middleware] = tuple;
|
|
4000
|
-
let nextCalled = false;
|
|
4001
|
-
let nextResult = void 0;
|
|
4002
|
-
let next = async () => {
|
|
4003
|
-
if (nextCalled) {
|
|
4004
|
-
throw new Error("You may only call `next()` once per middleware");
|
|
4005
|
-
}
|
|
4006
|
-
nextCalled = true;
|
|
4007
|
-
try {
|
|
4008
|
-
let result = await callServerRouteMiddleware(
|
|
4009
|
-
args,
|
|
4010
|
-
middlewares,
|
|
4011
|
-
handler,
|
|
4012
|
-
errorHandler,
|
|
4013
|
-
idx + 1
|
|
4014
|
-
);
|
|
4015
|
-
if (isDataWithResponseInit(result)) {
|
|
4016
|
-
result = dataWithResponseInitToResponse(result);
|
|
4017
|
-
}
|
|
4018
|
-
nextResult = result;
|
|
4019
|
-
return nextResult;
|
|
4020
|
-
} catch (e) {
|
|
4021
|
-
nextResult = await errorHandler(
|
|
4022
|
-
// Convert thrown data() values to ErrorResponses
|
|
4023
|
-
isDataWithResponseInit(e) ? dataWithResponseInitToErrorResponse(e) : e,
|
|
4024
|
-
routeId
|
|
4004
|
+
function errorHandler(error, routeId, nextResult) {
|
|
4005
|
+
if (nextResult) {
|
|
4006
|
+
return Promise.resolve(
|
|
4007
|
+
Object.assign(nextResult.value, {
|
|
4008
|
+
[routeId]: { type: "error", result: error }
|
|
4009
|
+
})
|
|
4025
4010
|
);
|
|
4026
|
-
return nextResult;
|
|
4027
|
-
}
|
|
4028
|
-
};
|
|
4029
|
-
try {
|
|
4030
|
-
let result = await middleware(
|
|
4031
|
-
{
|
|
4032
|
-
request: args.request,
|
|
4033
|
-
params: args.params,
|
|
4034
|
-
context: args.context
|
|
4035
|
-
},
|
|
4036
|
-
next
|
|
4037
|
-
);
|
|
4038
|
-
if (isDataWithResponseInit(result)) {
|
|
4039
|
-
result = dataWithResponseInitToResponse(result);
|
|
4040
|
-
}
|
|
4041
|
-
if (nextCalled) {
|
|
4042
|
-
return typeof result === "undefined" ? nextResult : result;
|
|
4043
|
-
} else if (isResponse(result)) {
|
|
4044
|
-
return result;
|
|
4045
4011
|
} else {
|
|
4046
|
-
|
|
4047
|
-
|
|
4012
|
+
let { matches } = args;
|
|
4013
|
+
let maxBoundaryIdx = Math.min(
|
|
4014
|
+
// Throwing route
|
|
4015
|
+
matches.findIndex((m) => m.route.id === routeId) || 0,
|
|
4016
|
+
// or the shallowest route that needs to load data
|
|
4017
|
+
matches.findIndex((m) => m.unstable_shouldCallHandler()) || 0
|
|
4018
|
+
);
|
|
4019
|
+
let boundaryRouteId = findNearestBoundary(
|
|
4020
|
+
matches,
|
|
4021
|
+
matches[maxBoundaryIdx].route.id
|
|
4022
|
+
).route.id;
|
|
4023
|
+
return Promise.resolve({
|
|
4024
|
+
[boundaryRouteId]: { type: "error", result: error }
|
|
4025
|
+
});
|
|
4048
4026
|
}
|
|
4049
|
-
} catch (e) {
|
|
4050
|
-
let response = await errorHandler(
|
|
4051
|
-
// Convert thrown data() values to ErrorResponses
|
|
4052
|
-
isDataWithResponseInit(e) ? dataWithResponseInitToErrorResponse(e) : e,
|
|
4053
|
-
routeId
|
|
4054
|
-
);
|
|
4055
|
-
return response;
|
|
4056
4027
|
}
|
|
4057
4028
|
}
|
|
4058
|
-
async function
|
|
4029
|
+
async function runMiddlewarePipeline(args, handler, processResult, isResult, errorHandler) {
|
|
4059
4030
|
let { matches, request, params, context } = args;
|
|
4060
4031
|
let tuples = matches.flatMap(
|
|
4061
4032
|
(m) => m.route.unstable_middleware ? m.route.unstable_middleware.map((fn) => [m.route.id, fn]) : []
|
|
4062
4033
|
);
|
|
4063
|
-
let
|
|
4064
|
-
await callClientRouteMiddleware(
|
|
4034
|
+
let result = await callRouteMiddleware(
|
|
4065
4035
|
{ request, params, context },
|
|
4066
4036
|
tuples,
|
|
4067
4037
|
handler,
|
|
4068
|
-
|
|
4069
|
-
|
|
4038
|
+
processResult,
|
|
4039
|
+
isResult,
|
|
4040
|
+
errorHandler
|
|
4070
4041
|
);
|
|
4071
|
-
return
|
|
4042
|
+
return result;
|
|
4072
4043
|
}
|
|
4073
|
-
async function
|
|
4044
|
+
async function callRouteMiddleware(args, middlewares, handler, processResult, isResult, errorHandler, idx = 0) {
|
|
4074
4045
|
let { request } = args;
|
|
4075
4046
|
if (request.signal.aborted) {
|
|
4076
|
-
|
|
4077
|
-
throw request.signal.reason;
|
|
4078
|
-
}
|
|
4079
|
-
throw new Error(
|
|
4080
|
-
`Request aborted without an \`AbortSignal.reason\`: ${request.method} ${request.url}`
|
|
4081
|
-
);
|
|
4047
|
+
throw _nullishCoalesce(request.signal.reason, () => ( new Error(`Request aborted: ${request.method} ${request.url}`)));
|
|
4082
4048
|
}
|
|
4083
4049
|
let tuple = middlewares[idx];
|
|
4084
4050
|
if (!tuple) {
|
|
4085
4051
|
let result = await handler();
|
|
4086
|
-
|
|
4087
|
-
return;
|
|
4052
|
+
return result;
|
|
4088
4053
|
}
|
|
4089
4054
|
let [routeId, middleware] = tuple;
|
|
4090
|
-
let
|
|
4055
|
+
let nextResult;
|
|
4091
4056
|
let next = async () => {
|
|
4092
|
-
if (
|
|
4057
|
+
if (nextResult) {
|
|
4093
4058
|
throw new Error("You may only call `next()` once per middleware");
|
|
4094
4059
|
}
|
|
4095
|
-
nextCalled = true;
|
|
4096
4060
|
try {
|
|
4097
|
-
let result = await
|
|
4061
|
+
let result = await callRouteMiddleware(
|
|
4098
4062
|
args,
|
|
4099
4063
|
middlewares,
|
|
4100
4064
|
handler,
|
|
4065
|
+
processResult,
|
|
4066
|
+
isResult,
|
|
4101
4067
|
errorHandler,
|
|
4102
|
-
handlerResult,
|
|
4103
4068
|
idx + 1
|
|
4104
4069
|
);
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4070
|
+
nextResult = { value: result };
|
|
4071
|
+
return nextResult.value;
|
|
4072
|
+
} catch (error) {
|
|
4073
|
+
nextResult = { value: await errorHandler(error, routeId, nextResult) };
|
|
4074
|
+
return nextResult.value;
|
|
4109
4075
|
}
|
|
4110
4076
|
};
|
|
4111
4077
|
try {
|
|
4112
|
-
let
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
console.warn(
|
|
4122
|
-
"client middlewares are not intended to return values, the value will be ignored",
|
|
4123
|
-
result
|
|
4124
|
-
);
|
|
4125
|
-
}
|
|
4126
|
-
if (!nextCalled) {
|
|
4127
|
-
await next();
|
|
4078
|
+
let value = await middleware(args, next);
|
|
4079
|
+
let result = value != null ? processResult(value) : void 0;
|
|
4080
|
+
if (isResult(result)) {
|
|
4081
|
+
return result;
|
|
4082
|
+
} else if (nextResult) {
|
|
4083
|
+
return _nullishCoalesce(result, () => ( nextResult.value));
|
|
4084
|
+
} else {
|
|
4085
|
+
nextResult = { value: await next() };
|
|
4086
|
+
return nextResult.value;
|
|
4128
4087
|
}
|
|
4129
4088
|
} catch (error) {
|
|
4130
|
-
let
|
|
4131
|
-
|
|
4089
|
+
let response = await errorHandler(error, routeId, nextResult);
|
|
4090
|
+
return response;
|
|
4132
4091
|
}
|
|
4133
4092
|
}
|
|
4134
4093
|
function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request, match, lazyRoutePropertiesToSkip) {
|
|
@@ -4183,8 +4142,8 @@ function getDataStrategyMatch(mapRouteProperties, manifest, request, match, lazy
|
|
|
4183
4142
|
return callLoaderOrAction({
|
|
4184
4143
|
request,
|
|
4185
4144
|
match,
|
|
4186
|
-
lazyHandlerPromise: _optionalChain([_lazyPromises, 'optionalAccess',
|
|
4187
|
-
lazyRoutePromise: _optionalChain([_lazyPromises, 'optionalAccess',
|
|
4145
|
+
lazyHandlerPromise: _optionalChain([_lazyPromises, 'optionalAccess', _38 => _38.handler]),
|
|
4146
|
+
lazyRoutePromise: _optionalChain([_lazyPromises, 'optionalAccess', _39 => _39.route]),
|
|
4188
4147
|
handlerOverride,
|
|
4189
4148
|
scopedContext
|
|
4190
4149
|
});
|
|
@@ -4224,8 +4183,8 @@ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, m
|
|
|
4224
4183
|
});
|
|
4225
4184
|
}
|
|
4226
4185
|
async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherKey, scopedContext, isStaticHandler) {
|
|
4227
|
-
if (matches.some((m) => _optionalChain([m, 'access',
|
|
4228
|
-
await Promise.all(matches.map((m) => _optionalChain([m, 'access',
|
|
4186
|
+
if (matches.some((m) => _optionalChain([m, 'access', _40 => _40._lazyPromises, 'optionalAccess', _41 => _41.middleware]))) {
|
|
4187
|
+
await Promise.all(matches.map((m) => _optionalChain([m, 'access', _42 => _42._lazyPromises, 'optionalAccess', _43 => _43.middleware])));
|
|
4229
4188
|
}
|
|
4230
4189
|
let dataStrategyArgs = {
|
|
4231
4190
|
request,
|
|
@@ -4239,28 +4198,17 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
4239
4198
|
);
|
|
4240
4199
|
} : (cb) => {
|
|
4241
4200
|
let typedDataStrategyArgs = dataStrategyArgs;
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
);
|
|
4254
|
-
}
|
|
4255
|
-
});
|
|
4256
|
-
},
|
|
4257
|
-
(error, routeId) => clientMiddlewareErrorHandler(
|
|
4258
|
-
error,
|
|
4259
|
-
routeId,
|
|
4260
|
-
matches,
|
|
4261
|
-
didCallHandler
|
|
4262
|
-
)
|
|
4263
|
-
);
|
|
4201
|
+
return runClientMiddlewarePipeline(typedDataStrategyArgs, () => {
|
|
4202
|
+
return cb({
|
|
4203
|
+
...typedDataStrategyArgs,
|
|
4204
|
+
fetcherKey,
|
|
4205
|
+
unstable_runClientMiddleware: () => {
|
|
4206
|
+
throw new Error(
|
|
4207
|
+
"Cannot call `unstable_runClientMiddleware()` from within an `unstable_runClientMiddleware` handler"
|
|
4208
|
+
);
|
|
4209
|
+
}
|
|
4210
|
+
});
|
|
4211
|
+
});
|
|
4264
4212
|
};
|
|
4265
4213
|
let results = await dataStrategyImpl({
|
|
4266
4214
|
...dataStrategyArgs,
|
|
@@ -4270,8 +4218,8 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
4270
4218
|
try {
|
|
4271
4219
|
await Promise.all(
|
|
4272
4220
|
matches.flatMap((m) => [
|
|
4273
|
-
_optionalChain([m, 'access',
|
|
4274
|
-
_optionalChain([m, 'access',
|
|
4221
|
+
_optionalChain([m, 'access', _44 => _44._lazyPromises, 'optionalAccess', _45 => _45.handler]),
|
|
4222
|
+
_optionalChain([m, 'access', _46 => _46._lazyPromises, 'optionalAccess', _47 => _47.route])
|
|
4275
4223
|
])
|
|
4276
4224
|
);
|
|
4277
4225
|
} catch (e) {
|
|
@@ -4377,21 +4325,19 @@ async function callLoaderOrAction({
|
|
|
4377
4325
|
}
|
|
4378
4326
|
return result;
|
|
4379
4327
|
}
|
|
4328
|
+
async function parseResponseBody(response) {
|
|
4329
|
+
let contentType = response.headers.get("Content-Type");
|
|
4330
|
+
if (contentType && /\bapplication\/json\b/.test(contentType)) {
|
|
4331
|
+
return response.body == null ? null : response.json();
|
|
4332
|
+
}
|
|
4333
|
+
return response.text();
|
|
4334
|
+
}
|
|
4380
4335
|
async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
4381
4336
|
let { result, type } = dataStrategyResult;
|
|
4382
4337
|
if (isResponse(result)) {
|
|
4383
4338
|
let data2;
|
|
4384
4339
|
try {
|
|
4385
|
-
|
|
4386
|
-
if (contentType && /\bapplication\/json\b/.test(contentType)) {
|
|
4387
|
-
if (result.body == null) {
|
|
4388
|
-
data2 = null;
|
|
4389
|
-
} else {
|
|
4390
|
-
data2 = await result.json();
|
|
4391
|
-
}
|
|
4392
|
-
} else {
|
|
4393
|
-
data2 = await result.text();
|
|
4394
|
-
}
|
|
4340
|
+
data2 = await parseResponseBody(result);
|
|
4395
4341
|
} catch (e) {
|
|
4396
4342
|
return { type: "error" /* error */, error: e };
|
|
4397
4343
|
}
|
|
@@ -4416,19 +4362,19 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
|
4416
4362
|
return {
|
|
4417
4363
|
type: "error" /* error */,
|
|
4418
4364
|
error: result.data,
|
|
4419
|
-
statusCode: _optionalChain([result, 'access',
|
|
4420
|
-
headers: _optionalChain([result, 'access',
|
|
4365
|
+
statusCode: _optionalChain([result, 'access', _48 => _48.init, 'optionalAccess', _49 => _49.status]),
|
|
4366
|
+
headers: _optionalChain([result, 'access', _50 => _50.init, 'optionalAccess', _51 => _51.headers]) ? new Headers(result.init.headers) : void 0
|
|
4421
4367
|
};
|
|
4422
4368
|
}
|
|
4423
4369
|
return {
|
|
4424
4370
|
type: "error" /* error */,
|
|
4425
4371
|
error: new ErrorResponseImpl(
|
|
4426
|
-
_optionalChain([result, 'access',
|
|
4372
|
+
_optionalChain([result, 'access', _52 => _52.init, 'optionalAccess', _53 => _53.status]) || 500,
|
|
4427
4373
|
void 0,
|
|
4428
4374
|
result.data
|
|
4429
4375
|
),
|
|
4430
4376
|
statusCode: isRouteErrorResponse(result) ? result.status : void 0,
|
|
4431
|
-
headers: _optionalChain([result, 'access',
|
|
4377
|
+
headers: _optionalChain([result, 'access', _54 => _54.init, 'optionalAccess', _55 => _55.headers]) ? new Headers(result.init.headers) : void 0
|
|
4432
4378
|
};
|
|
4433
4379
|
}
|
|
4434
4380
|
return {
|
|
@@ -4441,8 +4387,8 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
|
4441
4387
|
return {
|
|
4442
4388
|
type: "data" /* data */,
|
|
4443
4389
|
data: result.data,
|
|
4444
|
-
statusCode: _optionalChain([result, 'access',
|
|
4445
|
-
headers: _optionalChain([result, 'access',
|
|
4390
|
+
statusCode: _optionalChain([result, 'access', _56 => _56.init, 'optionalAccess', _57 => _57.status]),
|
|
4391
|
+
headers: _optionalChain([result, 'access', _58 => _58.init, 'optionalAccess', _59 => _59.headers]) ? new Headers(result.init.headers) : void 0
|
|
4446
4392
|
};
|
|
4447
4393
|
}
|
|
4448
4394
|
return { type: "data" /* data */, data: result };
|
|
@@ -4591,7 +4537,7 @@ function processLoaderData(state, matches, results, pendingActionResult, revalid
|
|
|
4591
4537
|
let result = fetcherResults[key];
|
|
4592
4538
|
invariant(result, "Did not find corresponding fetcher result");
|
|
4593
4539
|
if (isErrorResult(result)) {
|
|
4594
|
-
let boundaryMatch = findNearestBoundary(state.matches, _optionalChain([match, 'optionalAccess',
|
|
4540
|
+
let boundaryMatch = findNearestBoundary(state.matches, _optionalChain([match, 'optionalAccess', _60 => _60.route, 'access', _61 => _61.id]));
|
|
4595
4541
|
if (!(errors && errors[boundaryMatch.route.id])) {
|
|
4596
4542
|
errors = {
|
|
4597
4543
|
...errors,
|
|
@@ -4721,25 +4667,18 @@ function isHashChangeOnly(a, b) {
|
|
|
4721
4667
|
return false;
|
|
4722
4668
|
}
|
|
4723
4669
|
function dataWithResponseInitToResponse(data2) {
|
|
4724
|
-
return
|
|
4725
|
-
typeof data2.data === "string" ? data2.data : JSON.stringify(data2.data),
|
|
4726
|
-
data2.init || void 0
|
|
4727
|
-
);
|
|
4670
|
+
return Response.json(data2.data, _nullishCoalesce(data2.init, () => ( void 0)));
|
|
4728
4671
|
}
|
|
4729
4672
|
function dataWithResponseInitToErrorResponse(data2) {
|
|
4730
4673
|
return new ErrorResponseImpl(
|
|
4731
|
-
_nullishCoalesce(_optionalChain([data2, 'access',
|
|
4732
|
-
_nullishCoalesce(_optionalChain([data2, 'access',
|
|
4674
|
+
_nullishCoalesce(_optionalChain([data2, 'access', _62 => _62.init, 'optionalAccess', _63 => _63.status]), () => ( 500)),
|
|
4675
|
+
_nullishCoalesce(_optionalChain([data2, 'access', _64 => _64.init, 'optionalAccess', _65 => _65.statusText]), () => ( "Internal Server Error")),
|
|
4733
4676
|
data2.data
|
|
4734
4677
|
);
|
|
4735
4678
|
}
|
|
4736
|
-
function
|
|
4737
|
-
return
|
|
4738
|
-
typeof
|
|
4739
|
-
{
|
|
4740
|
-
status: error.status,
|
|
4741
|
-
statusText: error.statusText
|
|
4742
|
-
}
|
|
4679
|
+
function isDataStrategyResults(result) {
|
|
4680
|
+
return result != null && typeof result === "object" && Object.entries(result).every(
|
|
4681
|
+
([key, value]) => typeof key === "string" && isDataStrategyResult(value)
|
|
4743
4682
|
);
|
|
4744
4683
|
}
|
|
4745
4684
|
function isDataStrategyResult(result) {
|
|
@@ -5768,7 +5707,7 @@ function getTurboStreamSingleFetchDataStrategy(getRouter, manifest, routeModules
|
|
|
5768
5707
|
return {
|
|
5769
5708
|
hasLoader: manifestRoute.hasLoader,
|
|
5770
5709
|
hasClientLoader: manifestRoute.hasClientLoader,
|
|
5771
|
-
hasShouldRevalidate: Boolean(_optionalChain([routeModule, 'optionalAccess',
|
|
5710
|
+
hasShouldRevalidate: Boolean(_optionalChain([routeModule, 'optionalAccess', _66 => _66.shouldRevalidate]))
|
|
5772
5711
|
};
|
|
5773
5712
|
},
|
|
5774
5713
|
fetchAndDecodeViaTurboStream,
|
|
@@ -5935,7 +5874,7 @@ async function bubbleMiddlewareErrors(singleFetchPromise, matches, routesParams,
|
|
|
5935
5874
|
let routeResult = fetchedData.routes[match.route.id];
|
|
5936
5875
|
if ("error" in routeResult) {
|
|
5937
5876
|
middlewareError = routeResult.error;
|
|
5938
|
-
if (_optionalChain([results, 'access',
|
|
5877
|
+
if (_optionalChain([results, 'access', _67 => _67[match.route.id], 'optionalAccess', _68 => _68.result]) == null) {
|
|
5939
5878
|
results[match.route.id] = {
|
|
5940
5879
|
type: "error",
|
|
5941
5880
|
result: middlewareError
|
|
@@ -6048,7 +5987,7 @@ async function fetchAndDecodeViaTurboStream(args, basename, targetRoutes) {
|
|
|
6048
5987
|
}
|
|
6049
5988
|
} else {
|
|
6050
5989
|
let typed = decoded.value;
|
|
6051
|
-
let routeId = _optionalChain([targetRoutes, 'optionalAccess',
|
|
5990
|
+
let routeId = _optionalChain([targetRoutes, 'optionalAccess', _69 => _69[0]]);
|
|
6052
5991
|
invariant2(routeId, "No routeId found for single fetch call decoding");
|
|
6053
5992
|
if ("redirect" in typed) {
|
|
6054
5993
|
data2 = { redirect: typed };
|
|
@@ -6359,7 +6298,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
6359
6298
|
if (locationArg) {
|
|
6360
6299
|
let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
|
6361
6300
|
invariant(
|
|
6362
|
-
parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access',
|
|
6301
|
+
parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access', _70 => _70.pathname, 'optionalAccess', _71 => _71.startsWith, 'call', _72 => _72(parentPathnameBase)]),
|
|
6363
6302
|
`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${parentPathnameBase}" but pathname "${parsedLocationArg.pathname}" was given in the \`location\` prop.`
|
|
6364
6303
|
);
|
|
6365
6304
|
location = parsedLocationArg;
|
|
@@ -6511,10 +6450,10 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, uns
|
|
|
6511
6450
|
}
|
|
6512
6451
|
}
|
|
6513
6452
|
let renderedMatches = matches;
|
|
6514
|
-
let errors = _optionalChain([dataRouterState, 'optionalAccess',
|
|
6453
|
+
let errors = _optionalChain([dataRouterState, 'optionalAccess', _73 => _73.errors]);
|
|
6515
6454
|
if (errors != null) {
|
|
6516
6455
|
let errorIndex = renderedMatches.findIndex(
|
|
6517
|
-
(m) => m.route.id && _optionalChain([errors, 'optionalAccess',
|
|
6456
|
+
(m) => m.route.id && _optionalChain([errors, 'optionalAccess', _74 => _74[m.route.id]]) !== void 0
|
|
6518
6457
|
);
|
|
6519
6458
|
invariant(
|
|
6520
6459
|
errorIndex >= 0,
|
|
@@ -6692,15 +6631,15 @@ function useRouteError() {
|
|
|
6692
6631
|
if (error !== void 0) {
|
|
6693
6632
|
return error;
|
|
6694
6633
|
}
|
|
6695
|
-
return _optionalChain([state, 'access',
|
|
6634
|
+
return _optionalChain([state, 'access', _75 => _75.errors, 'optionalAccess', _76 => _76[routeId]]);
|
|
6696
6635
|
}
|
|
6697
6636
|
function useAsyncValue() {
|
|
6698
6637
|
let value = React3.useContext(AwaitContext);
|
|
6699
|
-
return _optionalChain([value, 'optionalAccess',
|
|
6638
|
+
return _optionalChain([value, 'optionalAccess', _77 => _77._data]);
|
|
6700
6639
|
}
|
|
6701
6640
|
function useAsyncError() {
|
|
6702
6641
|
let value = React3.useContext(AwaitContext);
|
|
6703
|
-
return _optionalChain([value, 'optionalAccess',
|
|
6642
|
+
return _optionalChain([value, 'optionalAccess', _78 => _78._error]);
|
|
6704
6643
|
}
|
|
6705
6644
|
var blockerId = 0;
|
|
6706
6645
|
function useBlocker(shouldBlock) {
|
|
@@ -6812,7 +6751,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
|
|
|
6812
6751
|
let route = manifest.routes[match.route.id];
|
|
6813
6752
|
return [
|
|
6814
6753
|
route && route.css ? route.css.map((href) => ({ rel: "stylesheet", href })) : [],
|
|
6815
|
-
_optionalChain([module, 'optionalAccess',
|
|
6754
|
+
_optionalChain([module, 'optionalAccess', _79 => _79.links, 'optionalCall', _80 => _80()]) || []
|
|
6816
6755
|
];
|
|
6817
6756
|
}).flat(2);
|
|
6818
6757
|
let preloads = getModuleLinkHrefs(matches, manifest);
|
|
@@ -6913,7 +6852,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
|
|
|
6913
6852
|
// param change, /users/123 -> /users/456
|
|
6914
6853
|
currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
|
|
6915
6854
|
// e.g. /files/images/avatar.jpg -> files/finances.xls
|
|
6916
|
-
_optionalChain([currentMatches, 'access',
|
|
6855
|
+
_optionalChain([currentMatches, 'access', _81 => _81[index], 'access', _82 => _82.route, 'access', _83 => _83.path, 'optionalAccess', _84 => _84.endsWith, 'call', _85 => _85("*")]) && currentMatches[index].params["*"] !== match.params["*"]
|
|
6917
6856
|
);
|
|
6918
6857
|
};
|
|
6919
6858
|
if (mode === "assets") {
|
|
@@ -6936,7 +6875,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
|
|
|
6936
6875
|
location.pathname + location.search + location.hash,
|
|
6937
6876
|
window.origin
|
|
6938
6877
|
),
|
|
6939
|
-
currentParams: _optionalChain([currentMatches, 'access',
|
|
6878
|
+
currentParams: _optionalChain([currentMatches, 'access', _86 => _86[0], 'optionalAccess', _87 => _87.params]) || {},
|
|
6940
6879
|
nextUrl: new URL(page, window.origin),
|
|
6941
6880
|
nextParams: match.params,
|
|
6942
6881
|
defaultShouldRevalidate: true
|
|
@@ -7208,10 +7147,10 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
7208
7147
|
)
|
|
7209
7148
|
});
|
|
7210
7149
|
let hasInitialData = initialState && initialState.loaderData && route.id in initialState.loaderData;
|
|
7211
|
-
let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess',
|
|
7150
|
+
let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess', _88 => _88.loaderData, 'optionalAccess', _89 => _89[route.id]]) : void 0;
|
|
7212
7151
|
let hasInitialError = initialState && initialState.errors && route.id in initialState.errors;
|
|
7213
|
-
let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess',
|
|
7214
|
-
let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access',
|
|
7152
|
+
let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess', _90 => _90.errors, 'optionalAccess', _91 => _91[route.id]]) : void 0;
|
|
7153
|
+
let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access', _92 => _92.clientLoader, 'optionalAccess', _93 => _93.hydrate]) === true || !route.hasLoader);
|
|
7215
7154
|
dataRoute.loader = async ({ request, params, context }, singleFetch) => {
|
|
7216
7155
|
try {
|
|
7217
7156
|
let result = await prefetchStylesAndCallHandler(async () => {
|
|
@@ -7508,7 +7447,7 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDi
|
|
|
7508
7447
|
function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
|
|
7509
7448
|
React6.useEffect(() => {
|
|
7510
7449
|
if (!isFogOfWarEnabled(routeDiscovery, ssr) || // @ts-expect-error - TS doesn't know about this yet
|
|
7511
|
-
_optionalChain([window, 'access',
|
|
7450
|
+
_optionalChain([window, 'access', _94 => _94.navigator, 'optionalAccess', _95 => _95.connection, 'optionalAccess', _96 => _96.saveData]) === true) {
|
|
7512
7451
|
return;
|
|
7513
7452
|
}
|
|
7514
7453
|
function registerElement(el) {
|
|
@@ -7611,7 +7550,7 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
|
|
|
7611
7550
|
sessionStorage.removeItem(MANIFEST_VERSION_STORAGE_KEY);
|
|
7612
7551
|
serverPatches = await res.json();
|
|
7613
7552
|
} catch (e) {
|
|
7614
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
7553
|
+
if (_optionalChain([signal, 'optionalAccess', _97 => _97.aborted])) return;
|
|
7615
7554
|
throw e;
|
|
7616
7555
|
}
|
|
7617
7556
|
let knownRoutes = new Set(Object.keys(manifest.routes));
|
|
@@ -7852,7 +7791,7 @@ function PrefetchPageLinksImpl({
|
|
|
7852
7791
|
if (!manifestRoute || !manifestRoute.hasLoader) {
|
|
7853
7792
|
return;
|
|
7854
7793
|
}
|
|
7855
|
-
if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access',
|
|
7794
|
+
if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access', _98 => _98[m.route.id], 'optionalAccess', _99 => _99.shouldRevalidate])) {
|
|
7856
7795
|
foundOptOutRoute = true;
|
|
7857
7796
|
} else if (manifestRoute.hasClientLoader) {
|
|
7858
7797
|
foundOptOutRoute = true;
|
|
@@ -7926,7 +7865,7 @@ function Meta() {
|
|
|
7926
7865
|
error
|
|
7927
7866
|
};
|
|
7928
7867
|
matches[i] = match;
|
|
7929
|
-
if (_optionalChain([routeModule, 'optionalAccess',
|
|
7868
|
+
if (_optionalChain([routeModule, 'optionalAccess', _100 => _100.meta])) {
|
|
7930
7869
|
routeMeta = typeof routeModule.meta === "function" ? routeModule.meta({
|
|
7931
7870
|
data: data2,
|
|
7932
7871
|
loaderData: data2,
|
|
@@ -8025,7 +7964,7 @@ function Scripts(scriptProps) {
|
|
|
8025
7964
|
}
|
|
8026
7965
|
let streamScript = "window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());";
|
|
8027
7966
|
let contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};${streamScript}` : " ";
|
|
8028
|
-
let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access',
|
|
7967
|
+
let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access', _101 => _101.hmr, 'optionalAccess', _102 => _102.runtime]) ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
|
|
8029
7968
|
${matches.map((match, routeIndex) => {
|
|
8030
7969
|
let routeVarName = `route${routeIndex}`;
|
|
8031
7970
|
let manifestEntry = manifest.routes[match.route.id];
|
|
@@ -8255,7 +8194,7 @@ function BoundaryShell({
|
|
|
8255
8194
|
children
|
|
8256
8195
|
}) {
|
|
8257
8196
|
let { routeModules } = useFrameworkContext();
|
|
8258
|
-
if (_optionalChain([routeModules, 'access',
|
|
8197
|
+
if (_optionalChain([routeModules, 'access', _103 => _103.root, 'optionalAccess', _104 => _104.Layout]) && !isOutsideRemixApp) {
|
|
8259
8198
|
return children;
|
|
8260
8199
|
}
|
|
8261
8200
|
return /* @__PURE__ */ React8.createElement("html", { lang: "en" }, /* @__PURE__ */ React8.createElement("head", null, /* @__PURE__ */ React8.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ React8.createElement(
|