react-router 7.9.5 → 7.9.6-pre.1
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 +37 -10
- package/dist/development/{browser-DM83uryY.d.ts → browser-BbBXFHbO.d.ts} +1 -1
- package/dist/development/{browser-DfMfSvsC.d.mts → browser-C07r42Tt.d.mts} +1 -1
- package/dist/development/{chunk-VNR6V74N.js → chunk-CYHICRRW.js} +124 -52
- package/dist/development/{chunk-UIGDSWPH.mjs → chunk-DKSAHU2I.mjs} +95 -23
- package/dist/{production/chunk-ERPFE3MR.js → development/chunk-HSVNPM3C.js} +93 -93
- package/dist/{production/chunk-CWEARR4H.js → development/chunk-OLIKX45O.js} +7 -7
- package/dist/development/{chunk-JG3XND5A.mjs → chunk-RGKEVI2W.mjs} +2 -2
- package/dist/development/dom-export.d.mts +2 -2
- package/dist/development/dom-export.d.ts +2 -2
- package/dist/development/dom-export.js +26 -26
- package/dist/development/dom-export.mjs +3 -3
- package/dist/{production/index-react-server-client-BSxMvS7Z.d.ts → development/index-react-server-client-Da3kmxNd.d.ts} +1 -1
- package/dist/development/{index-react-server-client-B0vnxMMk.d.mts → index-react-server-client-rcoGPJhU.d.mts} +1 -1
- package/dist/development/index-react-server-client.d.mts +2 -2
- package/dist/development/index-react-server-client.d.ts +2 -2
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.js +25 -4
- package/dist/development/index-react-server.mjs +25 -4
- package/dist/development/index.d.mts +8 -8
- package/dist/development/index.d.ts +8 -8
- package/dist/development/index.js +76 -76
- package/dist/development/index.mjs +3 -3
- package/dist/{production/instrumentation-iAqbU5Q4.d.ts → development/instrumentation-Unc20tLk.d.ts} +5 -1
- package/dist/development/lib/types/internal.d.mts +2 -2
- package/dist/development/lib/types/internal.d.ts +2 -2
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{register-c-dooqKE.d.ts → register-BpU9rFBJ.d.ts} +1 -1
- package/dist/development/{register-_G476ptB.d.mts → register-QkB3HGjm.d.mts} +1 -1
- package/dist/development/{router-DIAPGK5f.d.mts → router-CAvh_Drx.d.mts} +5 -1
- package/dist/production/{browser-DM83uryY.d.ts → browser-BbBXFHbO.d.ts} +1 -1
- package/dist/production/{browser-DfMfSvsC.d.mts → browser-C07r42Tt.d.mts} +1 -1
- package/dist/production/{chunk-EAE7427A.js → chunk-2DNJUQK6.js} +124 -52
- package/dist/{development/chunk-IXESJAGJ.js → production/chunk-EDK3MRM6.js} +93 -93
- package/dist/{development/chunk-FQEOJFGW.js → production/chunk-JLDESRHY.js} +7 -7
- package/dist/production/{chunk-TPBVZP6U.mjs → chunk-LC2OWLJG.mjs} +2 -2
- package/dist/production/{chunk-RZ6LZWMW.mjs → chunk-LESYMMDQ.mjs} +95 -23
- package/dist/production/dom-export.d.mts +2 -2
- package/dist/production/dom-export.d.ts +2 -2
- package/dist/production/dom-export.js +26 -26
- package/dist/production/dom-export.mjs +3 -3
- package/dist/{development/index-react-server-client-BSxMvS7Z.d.ts → production/index-react-server-client-Da3kmxNd.d.ts} +1 -1
- package/dist/production/{index-react-server-client-B0vnxMMk.d.mts → index-react-server-client-rcoGPJhU.d.mts} +1 -1
- package/dist/production/index-react-server-client.d.mts +2 -2
- package/dist/production/index-react-server-client.d.ts +2 -2
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.js +25 -4
- package/dist/production/index-react-server.mjs +25 -4
- package/dist/production/index.d.mts +8 -8
- package/dist/production/index.d.ts +8 -8
- package/dist/production/index.js +76 -76
- package/dist/production/index.mjs +3 -3
- package/dist/{development/instrumentation-iAqbU5Q4.d.ts → production/instrumentation-Unc20tLk.d.ts} +5 -1
- package/dist/production/lib/types/internal.d.mts +2 -2
- package/dist/production/lib/types/internal.d.ts +2 -2
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/{register-c-dooqKE.d.ts → register-BpU9rFBJ.d.ts} +1 -1
- package/dist/production/{register-_G476ptB.d.mts → register-QkB3HGjm.d.mts} +1 -1
- package/dist/production/{router-DIAPGK5f.d.mts → router-CAvh_Drx.d.mts} +5 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RouteModule } from './instrumentation-
|
|
1
|
+
import { R as RouteModule } from './instrumentation-Unc20tLk.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
|
|
@@ -1178,7 +1178,11 @@ declare function createMemoryRouter(routes: RouteObject[], opts?: MemoryRouterOp
|
|
|
1178
1178
|
* and rendering errors via `componentDidCatch`
|
|
1179
1179
|
*/
|
|
1180
1180
|
interface unstable_ClientOnErrorFunction {
|
|
1181
|
-
(error: unknown,
|
|
1181
|
+
(error: unknown, info: {
|
|
1182
|
+
location: Location;
|
|
1183
|
+
params: Params;
|
|
1184
|
+
errorInfo?: React.ErrorInfo;
|
|
1185
|
+
}): void;
|
|
1182
1186
|
}
|
|
1183
1187
|
/**
|
|
1184
1188
|
* @category Types
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction, e as RouterInit } from './instrumentation-
|
|
2
|
+
import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction, e as RouterInit } from './instrumentation-Unc20tLk.js';
|
|
3
3
|
|
|
4
4
|
type RSCRouteConfigEntryBase = {
|
|
5
5
|
action?: ActionFunction;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction, e as RouterInit } from './router-
|
|
2
|
+
import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction, e as RouterInit } from './router-CAvh_Drx.mjs';
|
|
3
3
|
|
|
4
4
|
type RSCRouteConfigEntryBase = {
|
|
5
5
|
action?: ActionFunction;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
|
|
2
|
-
* react-router v7.9.
|
|
2
|
+
* react-router v7.9.6-pre.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -811,13 +811,36 @@ function prependBasename({
|
|
|
811
811
|
}) {
|
|
812
812
|
return pathname === "/" ? basename : joinPaths([basename, pathname]);
|
|
813
813
|
}
|
|
814
|
+
var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
815
|
+
var isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX.test(url);
|
|
814
816
|
function resolvePath(to, fromPathname = "/") {
|
|
815
817
|
let {
|
|
816
818
|
pathname: toPathname,
|
|
817
819
|
search = "",
|
|
818
820
|
hash = ""
|
|
819
821
|
} = typeof to === "string" ? parsePath(to) : to;
|
|
820
|
-
let pathname
|
|
822
|
+
let pathname;
|
|
823
|
+
if (toPathname) {
|
|
824
|
+
if (isAbsoluteUrl(toPathname)) {
|
|
825
|
+
pathname = toPathname;
|
|
826
|
+
} else {
|
|
827
|
+
if (toPathname.includes("//")) {
|
|
828
|
+
let oldPathname = toPathname;
|
|
829
|
+
toPathname = toPathname.replace(/\/\/+/g, "/");
|
|
830
|
+
warning(
|
|
831
|
+
false,
|
|
832
|
+
`Pathnames cannot have embedded double slashes - normalizing ${oldPathname} -> ${toPathname}`
|
|
833
|
+
);
|
|
834
|
+
}
|
|
835
|
+
if (toPathname.startsWith("/")) {
|
|
836
|
+
pathname = resolvePathname(toPathname.substring(1), "/");
|
|
837
|
+
} else {
|
|
838
|
+
pathname = resolvePathname(toPathname, fromPathname);
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
} else {
|
|
842
|
+
pathname = fromPathname;
|
|
843
|
+
}
|
|
821
844
|
return {
|
|
822
845
|
pathname,
|
|
823
846
|
search: normalizeSearch(search),
|
|
@@ -1265,8 +1288,6 @@ var IDLE_BLOCKER = {
|
|
|
1265
1288
|
reset: void 0,
|
|
1266
1289
|
location: void 0
|
|
1267
1290
|
};
|
|
1268
|
-
var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
1269
|
-
var isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX.test(url);
|
|
1270
1291
|
var defaultMapRouteProperties = (route) => ({
|
|
1271
1292
|
hasErrorBoundary: Boolean(route.hasErrorBoundary)
|
|
1272
1293
|
});
|
|
@@ -2306,6 +2327,14 @@ function createRouter(init) {
|
|
|
2306
2327
|
key
|
|
2307
2328
|
);
|
|
2308
2329
|
let actionResult = actionResults[match.route.id];
|
|
2330
|
+
if (!actionResult) {
|
|
2331
|
+
for (let match2 of fetchMatches) {
|
|
2332
|
+
if (actionResults[match2.route.id]) {
|
|
2333
|
+
actionResult = actionResults[match2.route.id];
|
|
2334
|
+
break;
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2309
2338
|
if (fetchRequest.signal.aborted) {
|
|
2310
2339
|
if (fetchControllers.get(key) === abortController) {
|
|
2311
2340
|
fetchControllers.delete(key);
|
|
@@ -2962,23 +2991,43 @@ function createRouter(init) {
|
|
|
2962
2991
|
return { type: "aborted" };
|
|
2963
2992
|
}
|
|
2964
2993
|
let newMatches = matchRoutes(routesToUse, pathname, basename);
|
|
2994
|
+
let newPartialMatches = null;
|
|
2965
2995
|
if (newMatches) {
|
|
2966
|
-
|
|
2996
|
+
if (Object.keys(newMatches[0].params).length === 0) {
|
|
2997
|
+
return { type: "success", matches: newMatches };
|
|
2998
|
+
} else {
|
|
2999
|
+
newPartialMatches = matchRoutesImpl(
|
|
3000
|
+
routesToUse,
|
|
3001
|
+
pathname,
|
|
3002
|
+
basename,
|
|
3003
|
+
true
|
|
3004
|
+
);
|
|
3005
|
+
let matchedDeeper = newPartialMatches && partialMatches.length < newPartialMatches.length && compareMatches(
|
|
3006
|
+
partialMatches,
|
|
3007
|
+
newPartialMatches.slice(0, partialMatches.length)
|
|
3008
|
+
);
|
|
3009
|
+
if (!matchedDeeper) {
|
|
3010
|
+
return { type: "success", matches: newMatches };
|
|
3011
|
+
}
|
|
3012
|
+
}
|
|
2967
3013
|
}
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
)) {
|
|
3014
|
+
if (!newPartialMatches) {
|
|
3015
|
+
newPartialMatches = matchRoutesImpl(
|
|
3016
|
+
routesToUse,
|
|
3017
|
+
pathname,
|
|
3018
|
+
basename,
|
|
3019
|
+
true
|
|
3020
|
+
);
|
|
3021
|
+
}
|
|
3022
|
+
if (!newPartialMatches || compareMatches(partialMatches, newPartialMatches)) {
|
|
2977
3023
|
return { type: "success", matches: null };
|
|
2978
3024
|
}
|
|
2979
3025
|
partialMatches = newPartialMatches;
|
|
2980
3026
|
}
|
|
2981
3027
|
}
|
|
3028
|
+
function compareMatches(a, b) {
|
|
3029
|
+
return a.length === b.length && a.every((m, i) => m.route.id === b[i].route.id);
|
|
3030
|
+
}
|
|
2982
3031
|
function _internalSetRoutes(newRoutes) {
|
|
2983
3032
|
manifest = {};
|
|
2984
3033
|
inFlightDataRoutes = convertRoutesToDataRoutes(
|
|
@@ -6767,8 +6816,8 @@ var RenderErrorBoundary = class extends React3.Component {
|
|
|
6767
6816
|
};
|
|
6768
6817
|
}
|
|
6769
6818
|
componentDidCatch(error, errorInfo) {
|
|
6770
|
-
if (this.props.
|
|
6771
|
-
this.props.
|
|
6819
|
+
if (this.props.onError) {
|
|
6820
|
+
this.props.onError(error, errorInfo);
|
|
6772
6821
|
} else {
|
|
6773
6822
|
console.error(
|
|
6774
6823
|
"React Router caught the following error during render",
|
|
@@ -6846,6 +6895,13 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, uns
|
|
|
6846
6895
|
}
|
|
6847
6896
|
}
|
|
6848
6897
|
}
|
|
6898
|
+
let onError = dataRouterState && unstable_onError ? (error, errorInfo) => {
|
|
6899
|
+
unstable_onError(error, {
|
|
6900
|
+
location: dataRouterState.location,
|
|
6901
|
+
params: _nullishCoalesce(_optionalChain([dataRouterState, 'access', _76 => _76.matches, 'optionalAccess', _77 => _77[0], 'optionalAccess', _78 => _78.params]), () => ( {})),
|
|
6902
|
+
errorInfo
|
|
6903
|
+
});
|
|
6904
|
+
} : void 0;
|
|
6849
6905
|
return renderedMatches.reduceRight(
|
|
6850
6906
|
(outlet, match, index) => {
|
|
6851
6907
|
let error;
|
|
@@ -6906,7 +6962,7 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, uns
|
|
|
6906
6962
|
error,
|
|
6907
6963
|
children: getChildren(),
|
|
6908
6964
|
routeContext: { outlet: null, matches: matches2, isDataRoute: true },
|
|
6909
|
-
|
|
6965
|
+
onError
|
|
6910
6966
|
}
|
|
6911
6967
|
) : getChildren();
|
|
6912
6968
|
},
|
|
@@ -6988,15 +7044,15 @@ function useRouteError() {
|
|
|
6988
7044
|
if (error !== void 0) {
|
|
6989
7045
|
return error;
|
|
6990
7046
|
}
|
|
6991
|
-
return _optionalChain([state, 'access',
|
|
7047
|
+
return _optionalChain([state, 'access', _79 => _79.errors, 'optionalAccess', _80 => _80[routeId]]);
|
|
6992
7048
|
}
|
|
6993
7049
|
function useAsyncValue() {
|
|
6994
7050
|
let value = React3.useContext(AwaitContext);
|
|
6995
|
-
return _optionalChain([value, 'optionalAccess',
|
|
7051
|
+
return _optionalChain([value, 'optionalAccess', _81 => _81._data]);
|
|
6996
7052
|
}
|
|
6997
7053
|
function useAsyncError() {
|
|
6998
7054
|
let value = React3.useContext(AwaitContext);
|
|
6999
|
-
return _optionalChain([value, 'optionalAccess',
|
|
7055
|
+
return _optionalChain([value, 'optionalAccess', _82 => _82._error]);
|
|
7000
7056
|
}
|
|
7001
7057
|
var blockerId = 0;
|
|
7002
7058
|
function useBlocker(shouldBlock) {
|
|
@@ -7077,7 +7133,7 @@ function useRoute(...args) {
|
|
|
7077
7133
|
return {
|
|
7078
7134
|
handle: route.route.handle,
|
|
7079
7135
|
loaderData: state.loaderData[id],
|
|
7080
|
-
actionData: _optionalChain([state, 'access',
|
|
7136
|
+
actionData: _optionalChain([state, 'access', _83 => _83.actionData, 'optionalAccess', _84 => _84[id]])
|
|
7081
7137
|
};
|
|
7082
7138
|
}
|
|
7083
7139
|
|
|
@@ -7122,7 +7178,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
|
|
|
7122
7178
|
let route = manifest.routes[match.route.id];
|
|
7123
7179
|
return [
|
|
7124
7180
|
route && route.css ? route.css.map((href) => ({ rel: "stylesheet", href })) : [],
|
|
7125
|
-
_optionalChain([module, 'optionalAccess',
|
|
7181
|
+
_optionalChain([module, 'optionalAccess', _85 => _85.links, 'optionalCall', _86 => _86()]) || []
|
|
7126
7182
|
];
|
|
7127
7183
|
}).flat(2);
|
|
7128
7184
|
let preloads = getModuleLinkHrefs(matches, manifest);
|
|
@@ -7223,7 +7279,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
|
|
|
7223
7279
|
// param change, /users/123 -> /users/456
|
|
7224
7280
|
currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
|
|
7225
7281
|
// e.g. /files/images/avatar.jpg -> files/finances.xls
|
|
7226
|
-
_optionalChain([currentMatches, 'access',
|
|
7282
|
+
_optionalChain([currentMatches, 'access', _87 => _87[index], 'access', _88 => _88.route, 'access', _89 => _89.path, 'optionalAccess', _90 => _90.endsWith, 'call', _91 => _91("*")]) && currentMatches[index].params["*"] !== match.params["*"]
|
|
7227
7283
|
);
|
|
7228
7284
|
};
|
|
7229
7285
|
if (mode === "assets") {
|
|
@@ -7246,7 +7302,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
|
|
|
7246
7302
|
location.pathname + location.search + location.hash,
|
|
7247
7303
|
window.origin
|
|
7248
7304
|
),
|
|
7249
|
-
currentParams: _optionalChain([currentMatches, 'access',
|
|
7305
|
+
currentParams: _optionalChain([currentMatches, 'access', _92 => _92[0], 'optionalAccess', _93 => _93.params]) || {},
|
|
7250
7306
|
nextUrl: new URL(page, window.origin),
|
|
7251
7307
|
nextParams: match.params,
|
|
7252
7308
|
defaultShouldRevalidate: true
|
|
@@ -7518,10 +7574,10 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
7518
7574
|
)
|
|
7519
7575
|
});
|
|
7520
7576
|
let hasInitialData = initialState && initialState.loaderData && route.id in initialState.loaderData;
|
|
7521
|
-
let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess',
|
|
7577
|
+
let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess', _94 => _94.loaderData, 'optionalAccess', _95 => _95[route.id]]) : void 0;
|
|
7522
7578
|
let hasInitialError = initialState && initialState.errors && route.id in initialState.errors;
|
|
7523
|
-
let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess',
|
|
7524
|
-
let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access',
|
|
7579
|
+
let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess', _96 => _96.errors, 'optionalAccess', _97 => _97[route.id]]) : void 0;
|
|
7580
|
+
let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access', _98 => _98.clientLoader, 'optionalAccess', _99 => _99.hydrate]) === true || !route.hasLoader);
|
|
7525
7581
|
dataRoute.loader = async ({ request, params, context, unstable_pattern }, singleFetch) => {
|
|
7526
7582
|
try {
|
|
7527
7583
|
let result = await prefetchStylesAndCallHandler(async () => {
|
|
@@ -7817,7 +7873,7 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDi
|
|
|
7817
7873
|
function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
|
|
7818
7874
|
React6.useEffect(() => {
|
|
7819
7875
|
if (!isFogOfWarEnabled(routeDiscovery, ssr) || // @ts-expect-error - TS doesn't know about this yet
|
|
7820
|
-
_optionalChain([window, 'access',
|
|
7876
|
+
_optionalChain([window, 'access', _100 => _100.navigator, 'optionalAccess', _101 => _101.connection, 'optionalAccess', _102 => _102.saveData]) === true) {
|
|
7821
7877
|
return;
|
|
7822
7878
|
}
|
|
7823
7879
|
function registerElement(el) {
|
|
@@ -7926,7 +7982,7 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
|
|
|
7926
7982
|
}
|
|
7927
7983
|
serverPatches = await res.json();
|
|
7928
7984
|
} catch (e) {
|
|
7929
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
7985
|
+
if (_optionalChain([signal, 'optionalAccess', _103 => _103.aborted])) return;
|
|
7930
7986
|
throw e;
|
|
7931
7987
|
}
|
|
7932
7988
|
let knownRoutes = new Set(Object.keys(manifest.routes));
|
|
@@ -8167,7 +8223,7 @@ function PrefetchPageLinksImpl({
|
|
|
8167
8223
|
if (!manifestRoute || !manifestRoute.hasLoader) {
|
|
8168
8224
|
return;
|
|
8169
8225
|
}
|
|
8170
|
-
if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access',
|
|
8226
|
+
if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access', _104 => _104[m.route.id], 'optionalAccess', _105 => _105.shouldRevalidate])) {
|
|
8171
8227
|
foundOptOutRoute = true;
|
|
8172
8228
|
} else if (manifestRoute.hasClientLoader) {
|
|
8173
8229
|
foundOptOutRoute = true;
|
|
@@ -8241,7 +8297,7 @@ function Meta() {
|
|
|
8241
8297
|
error
|
|
8242
8298
|
};
|
|
8243
8299
|
matches[i] = match;
|
|
8244
|
-
if (_optionalChain([routeModule, 'optionalAccess',
|
|
8300
|
+
if (_optionalChain([routeModule, 'optionalAccess', _106 => _106.meta])) {
|
|
8245
8301
|
routeMeta = typeof routeModule.meta === "function" ? routeModule.meta({
|
|
8246
8302
|
data: data2,
|
|
8247
8303
|
loaderData: data2,
|
|
@@ -8340,7 +8396,7 @@ function Scripts(scriptProps) {
|
|
|
8340
8396
|
}
|
|
8341
8397
|
let streamScript = "window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());";
|
|
8342
8398
|
let contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};${streamScript}` : " ";
|
|
8343
|
-
let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access',
|
|
8399
|
+
let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access', _107 => _107.hmr, 'optionalAccess', _108 => _108.runtime]) ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
|
|
8344
8400
|
${matches.map((match, routeIndex) => {
|
|
8345
8401
|
let routeVarName = `route${routeIndex}`;
|
|
8346
8402
|
let manifestEntry = manifest.routes[match.route.id];
|
|
@@ -8570,7 +8626,7 @@ function BoundaryShell({
|
|
|
8570
8626
|
children
|
|
8571
8627
|
}) {
|
|
8572
8628
|
let { routeModules } = useFrameworkContext();
|
|
8573
|
-
if (_optionalChain([routeModules, 'access',
|
|
8629
|
+
if (_optionalChain([routeModules, 'access', _109 => _109.root, 'optionalAccess', _110 => _110.Layout]) && !isOutsideRemixApp) {
|
|
8574
8630
|
return children;
|
|
8575
8631
|
}
|
|
8576
8632
|
return /* @__PURE__ */ React8.createElement("html", { lang: "en" }, /* @__PURE__ */ React8.createElement("head", null, /* @__PURE__ */ React8.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ React8.createElement(
|
|
@@ -8640,20 +8696,20 @@ var hydrationRouteProperties = [
|
|
|
8640
8696
|
];
|
|
8641
8697
|
function createMemoryRouter(routes, opts) {
|
|
8642
8698
|
return createRouter({
|
|
8643
|
-
basename: _optionalChain([opts, 'optionalAccess',
|
|
8644
|
-
getContext: _optionalChain([opts, 'optionalAccess',
|
|
8645
|
-
future: _optionalChain([opts, 'optionalAccess',
|
|
8699
|
+
basename: _optionalChain([opts, 'optionalAccess', _111 => _111.basename]),
|
|
8700
|
+
getContext: _optionalChain([opts, 'optionalAccess', _112 => _112.getContext]),
|
|
8701
|
+
future: _optionalChain([opts, 'optionalAccess', _113 => _113.future]),
|
|
8646
8702
|
history: createMemoryHistory({
|
|
8647
|
-
initialEntries: _optionalChain([opts, 'optionalAccess',
|
|
8648
|
-
initialIndex: _optionalChain([opts, 'optionalAccess',
|
|
8703
|
+
initialEntries: _optionalChain([opts, 'optionalAccess', _114 => _114.initialEntries]),
|
|
8704
|
+
initialIndex: _optionalChain([opts, 'optionalAccess', _115 => _115.initialIndex])
|
|
8649
8705
|
}),
|
|
8650
|
-
hydrationData: _optionalChain([opts, 'optionalAccess',
|
|
8706
|
+
hydrationData: _optionalChain([opts, 'optionalAccess', _116 => _116.hydrationData]),
|
|
8651
8707
|
routes,
|
|
8652
8708
|
hydrationRouteProperties,
|
|
8653
8709
|
mapRouteProperties,
|
|
8654
|
-
dataStrategy: _optionalChain([opts, 'optionalAccess',
|
|
8655
|
-
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess',
|
|
8656
|
-
unstable_instrumentations: _optionalChain([opts, 'optionalAccess',
|
|
8710
|
+
dataStrategy: _optionalChain([opts, 'optionalAccess', _117 => _117.dataStrategy]),
|
|
8711
|
+
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _118 => _118.patchRoutesOnNavigation]),
|
|
8712
|
+
unstable_instrumentations: _optionalChain([opts, 'optionalAccess', _119 => _119.unstable_instrumentations])
|
|
8657
8713
|
}).initialize();
|
|
8658
8714
|
}
|
|
8659
8715
|
var Deferred2 = class {
|
|
@@ -8715,12 +8771,12 @@ function UNSTABLE_TransitionEnabledRouterProvider({
|
|
|
8715
8771
|
go: (n) => router.navigate(n),
|
|
8716
8772
|
push: (to, state2, opts) => router.navigate(to, {
|
|
8717
8773
|
state: state2,
|
|
8718
|
-
preventScrollReset: _optionalChain([opts, 'optionalAccess',
|
|
8774
|
+
preventScrollReset: _optionalChain([opts, 'optionalAccess', _120 => _120.preventScrollReset])
|
|
8719
8775
|
}),
|
|
8720
8776
|
replace: (to, state2, opts) => router.navigate(to, {
|
|
8721
8777
|
replace: true,
|
|
8722
8778
|
state: state2,
|
|
8723
|
-
preventScrollReset: _optionalChain([opts, 'optionalAccess',
|
|
8779
|
+
preventScrollReset: _optionalChain([opts, 'optionalAccess', _121 => _121.preventScrollReset])
|
|
8724
8780
|
})
|
|
8725
8781
|
};
|
|
8726
8782
|
}, [router]);
|
|
@@ -8807,8 +8863,11 @@ function RouterProvider({
|
|
|
8807
8863
|
setStateImpl((prevState) => {
|
|
8808
8864
|
if (newState.errors && unstable_onError) {
|
|
8809
8865
|
Object.entries(newState.errors).forEach(([routeId, error]) => {
|
|
8810
|
-
if (_optionalChain([prevState, 'access',
|
|
8811
|
-
unstable_onError(error
|
|
8866
|
+
if (_optionalChain([prevState, 'access', _122 => _122.errors, 'optionalAccess', _123 => _123[routeId]]) !== error) {
|
|
8867
|
+
unstable_onError(error, {
|
|
8868
|
+
location: newState.location,
|
|
8869
|
+
params: _nullishCoalesce(_optionalChain([newState, 'access', _124 => _124.matches, 'access', _125 => _125[0], 'optionalAccess', _126 => _126.params]), () => ( {}))
|
|
8870
|
+
});
|
|
8812
8871
|
}
|
|
8813
8872
|
});
|
|
8814
8873
|
}
|
|
@@ -8942,12 +9001,12 @@ function RouterProvider({
|
|
|
8942
9001
|
go: (n) => router.navigate(n),
|
|
8943
9002
|
push: (to, state2, opts) => router.navigate(to, {
|
|
8944
9003
|
state: state2,
|
|
8945
|
-
preventScrollReset: _optionalChain([opts, 'optionalAccess',
|
|
9004
|
+
preventScrollReset: _optionalChain([opts, 'optionalAccess', _127 => _127.preventScrollReset])
|
|
8946
9005
|
}),
|
|
8947
9006
|
replace: (to, state2, opts) => router.navigate(to, {
|
|
8948
9007
|
replace: true,
|
|
8949
9008
|
state: state2,
|
|
8950
|
-
preventScrollReset: _optionalChain([opts, 'optionalAccess',
|
|
9009
|
+
preventScrollReset: _optionalChain([opts, 'optionalAccess', _128 => _128.preventScrollReset])
|
|
8951
9010
|
})
|
|
8952
9011
|
};
|
|
8953
9012
|
}, [router]);
|
|
@@ -9137,12 +9196,25 @@ function Await({
|
|
|
9137
9196
|
resolve
|
|
9138
9197
|
}) {
|
|
9139
9198
|
let dataRouterContext = React9.useContext(DataRouterContext);
|
|
9199
|
+
let dataRouterStateContext = React9.useContext(DataRouterStateContext);
|
|
9200
|
+
let onError = React9.useCallback(
|
|
9201
|
+
(error, errorInfo) => {
|
|
9202
|
+
if (dataRouterContext && dataRouterContext.unstable_onError && dataRouterStateContext) {
|
|
9203
|
+
dataRouterContext.unstable_onError(error, {
|
|
9204
|
+
location: dataRouterStateContext.location,
|
|
9205
|
+
params: _optionalChain([dataRouterStateContext, 'access', _129 => _129.matches, 'optionalAccess', _130 => _130[0], 'optionalAccess', _131 => _131.params]) || {},
|
|
9206
|
+
errorInfo
|
|
9207
|
+
});
|
|
9208
|
+
}
|
|
9209
|
+
},
|
|
9210
|
+
[dataRouterContext, dataRouterStateContext]
|
|
9211
|
+
);
|
|
9140
9212
|
return /* @__PURE__ */ React9.createElement(
|
|
9141
9213
|
AwaitErrorBoundary,
|
|
9142
9214
|
{
|
|
9143
9215
|
resolve,
|
|
9144
9216
|
errorElement,
|
|
9145
|
-
|
|
9217
|
+
onError
|
|
9146
9218
|
},
|
|
9147
9219
|
/* @__PURE__ */ React9.createElement(ResolveAwait, null, children)
|
|
9148
9220
|
);
|
|
@@ -9156,8 +9228,8 @@ var AwaitErrorBoundary = class extends React9.Component {
|
|
|
9156
9228
|
return { error };
|
|
9157
9229
|
}
|
|
9158
9230
|
componentDidCatch(error, errorInfo) {
|
|
9159
|
-
if (this.props.
|
|
9160
|
-
this.props.
|
|
9231
|
+
if (this.props.onError) {
|
|
9232
|
+
this.props.onError(error, errorInfo);
|
|
9161
9233
|
} else {
|
|
9162
9234
|
console.error(
|
|
9163
9235
|
"<Await> caught the following error during render",
|
|
@@ -9191,7 +9263,7 @@ var AwaitErrorBoundary = class extends React9.Component {
|
|
|
9191
9263
|
promise = resolve.then(
|
|
9192
9264
|
(data2) => Object.defineProperty(resolve, "_data", { get: () => data2 }),
|
|
9193
9265
|
(error) => {
|
|
9194
|
-
_optionalChain([this, 'access',
|
|
9266
|
+
_optionalChain([this, 'access', _132 => _132.props, 'access', _133 => _133.onError, 'optionalCall', _134 => _134(error)]);
|
|
9195
9267
|
Object.defineProperty(resolve, "_error", { get: () => error });
|
|
9196
9268
|
}
|
|
9197
9269
|
);
|