react-router 0.0.0-experimental-28357fd2a → 0.0.0-experimental-3d7dcee
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 +51 -48
- package/dist/development/{chunk-5CCVAEBF.js → chunk-LSB26UC6.js} +210 -169
- package/dist/development/{chunk-QT7WPDUY.mjs → chunk-QMIAKNRH.mjs} +147 -33
- package/dist/development/{chunk-EU7MB5YT.js → chunk-S2WJDCRE.js} +77 -53
- package/dist/development/{chunk-Z4HFX7Q2.mjs → chunk-WJ2QP6HN.mjs} +102 -37
- package/dist/{production/context-DohQKLID.d.mts → development/context-DnZM5brG.d.mts} +843 -6
- package/dist/development/dom-export.d.mts +20 -2
- package/dist/development/dom-export.d.ts +20 -1
- package/dist/development/dom-export.js +10 -4
- package/dist/development/dom-export.mjs +10 -4
- package/dist/development/{index-react-server-client-DXb0OgpJ.d.mts → index-react-server-client-9rHNv-U3.d.mts} +2 -3
- package/dist/{production/index-react-server-client-CMphySRb.d.ts → development/index-react-server-client-zr5eNeut.d.ts} +6 -816
- package/dist/development/index-react-server-client.d.mts +3 -4
- 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 +21 -7
- package/dist/development/index-react-server.mjs +21 -7
- package/dist/development/index.d.mts +7 -9
- package/dist/development/index.d.ts +5 -5
- package/dist/development/index.js +242 -128
- package/dist/development/index.mjs +3 -3
- package/dist/development/lib/types/internal.d.mts +2 -2
- package/dist/development/lib/types/internal.d.ts +1 -1
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{route-data-CpB5xtMm.d.mts → route-data-C24VEkoE.d.mts} +1 -1
- package/dist/development/{routeModules-qBivMBjd.d.ts → routeModules-FY5IBiA_.d.ts} +843 -6
- package/dist/production/{chunk-EQ3NKH5J.mjs → chunk-2BFZ6QQU.mjs} +102 -37
- package/dist/production/{chunk-2DWPJCWX.js → chunk-7CWVKQLP.js} +77 -53
- package/dist/production/{chunk-DOZCQHLU.js → chunk-NIW37A6Q.js} +210 -169
- package/dist/production/{chunk-GPXYCHV5.mjs → chunk-OFC37UQM.mjs} +147 -33
- package/dist/{development/context-DohQKLID.d.mts → production/context-DnZM5brG.d.mts} +843 -6
- package/dist/production/dom-export.d.mts +20 -2
- package/dist/production/dom-export.d.ts +20 -1
- package/dist/production/dom-export.js +10 -4
- package/dist/production/dom-export.mjs +10 -4
- package/dist/production/{index-react-server-client-DXb0OgpJ.d.mts → index-react-server-client-9rHNv-U3.d.mts} +2 -3
- package/dist/{development/index-react-server-client-CMphySRb.d.ts → production/index-react-server-client-zr5eNeut.d.ts} +6 -816
- package/dist/production/index-react-server-client.d.mts +3 -4
- 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 +21 -7
- package/dist/production/index-react-server.mjs +21 -7
- package/dist/production/index.d.mts +7 -9
- package/dist/production/index.d.ts +5 -5
- package/dist/production/index.js +242 -128
- package/dist/production/index.mjs +3 -3
- package/dist/production/lib/types/internal.d.mts +2 -2
- package/dist/production/lib/types/internal.d.ts +1 -1
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/{route-data-CpB5xtMm.d.mts → route-data-C24VEkoE.d.mts} +1 -1
- package/dist/production/{routeModules-qBivMBjd.d.ts → routeModules-FY5IBiA_.d.ts} +843 -6
- package/package.json +1 -1
- package/dist/development/components-CuPfnyiZ.d.mts +0 -814
- package/dist/production/components-CuPfnyiZ.d.mts +0 -814
|
@@ -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-3d7dcee
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -513,8 +513,8 @@ function convertRouteMatchToUiMatch(match, loaderData) {
|
|
|
513
513
|
handle: route.handle
|
|
514
514
|
};
|
|
515
515
|
}
|
|
516
|
-
function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "") {
|
|
517
|
-
let flattenRoute = (route, index, relativePath) => {
|
|
516
|
+
function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) {
|
|
517
|
+
let flattenRoute = (route, index, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {
|
|
518
518
|
let meta = {
|
|
519
519
|
relativePath: relativePath === void 0 ? route.path || "" : relativePath,
|
|
520
520
|
caseSensitive: route.caseSensitive === true,
|
|
@@ -522,6 +522,9 @@ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "")
|
|
|
522
522
|
route
|
|
523
523
|
};
|
|
524
524
|
if (meta.relativePath.startsWith("/")) {
|
|
525
|
+
if (!meta.relativePath.startsWith(parentPath) && hasParentOptionalSegments) {
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
525
528
|
invariant(
|
|
526
529
|
meta.relativePath.startsWith(parentPath),
|
|
527
530
|
`Absolute route path "${meta.relativePath}" nested under path "${parentPath}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
|
|
@@ -537,7 +540,13 @@ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "")
|
|
|
537
540
|
route.index !== true,
|
|
538
541
|
`Index routes must not have child routes. Please remove all child routes from route path "${path}".`
|
|
539
542
|
);
|
|
540
|
-
flattenRoutes(
|
|
543
|
+
flattenRoutes(
|
|
544
|
+
route.children,
|
|
545
|
+
branches,
|
|
546
|
+
routesMeta,
|
|
547
|
+
path,
|
|
548
|
+
hasParentOptionalSegments
|
|
549
|
+
);
|
|
541
550
|
}
|
|
542
551
|
if (route.path == null && !route.index) {
|
|
543
552
|
return;
|
|
@@ -553,7 +562,7 @@ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "")
|
|
|
553
562
|
flattenRoute(route, index);
|
|
554
563
|
} else {
|
|
555
564
|
for (let exploded of explodeOptionalSegments(route.path)) {
|
|
556
|
-
flattenRoute(route, index, exploded);
|
|
565
|
+
flattenRoute(route, index, true, exploded);
|
|
557
566
|
}
|
|
558
567
|
}
|
|
559
568
|
});
|
|
@@ -745,7 +754,7 @@ function compilePath(path, caseSensitive = false, end = true) {
|
|
|
745
754
|
params.push({ paramName, isOptional: isOptional != null });
|
|
746
755
|
return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
|
|
747
756
|
}
|
|
748
|
-
);
|
|
757
|
+
).replace(/\/([\w-]+)\?(\/|$)/g, "(/$1)?$2");
|
|
749
758
|
if (path.endsWith("*")) {
|
|
750
759
|
params.push({ paramName: "*" });
|
|
751
760
|
regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
|
|
@@ -3941,9 +3950,15 @@ function clientMiddlewareErrorHandler(error, routeId, matches, didCallHandler) {
|
|
|
3941
3950
|
[routeId]: { type: "error", result: error }
|
|
3942
3951
|
};
|
|
3943
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
|
+
);
|
|
3944
3959
|
let boundaryRouteId = findNearestBoundary(
|
|
3945
3960
|
matches,
|
|
3946
|
-
|
|
3961
|
+
matches[maxBoundaryIdx].route.id
|
|
3947
3962
|
).route.id;
|
|
3948
3963
|
return {
|
|
3949
3964
|
[boundaryRouteId]: { type: "error", result: error }
|
|
@@ -4168,8 +4183,8 @@ function getDataStrategyMatch(mapRouteProperties, manifest, request, match, lazy
|
|
|
4168
4183
|
return callLoaderOrAction({
|
|
4169
4184
|
request,
|
|
4170
4185
|
match,
|
|
4171
|
-
lazyHandlerPromise: _optionalChain([_lazyPromises, 'optionalAccess',
|
|
4172
|
-
lazyRoutePromise: _optionalChain([_lazyPromises, 'optionalAccess',
|
|
4186
|
+
lazyHandlerPromise: _optionalChain([_lazyPromises, 'optionalAccess', _37 => _37.handler]),
|
|
4187
|
+
lazyRoutePromise: _optionalChain([_lazyPromises, 'optionalAccess', _38 => _38.route]),
|
|
4173
4188
|
handlerOverride,
|
|
4174
4189
|
scopedContext
|
|
4175
4190
|
});
|
|
@@ -4209,8 +4224,8 @@ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, m
|
|
|
4209
4224
|
});
|
|
4210
4225
|
}
|
|
4211
4226
|
async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherKey, scopedContext, isStaticHandler) {
|
|
4212
|
-
if (matches.some((m) => _optionalChain([m, 'access',
|
|
4213
|
-
await Promise.all(matches.map((m) => _optionalChain([m, 'access',
|
|
4227
|
+
if (matches.some((m) => _optionalChain([m, 'access', _39 => _39._lazyPromises, 'optionalAccess', _40 => _40.middleware]))) {
|
|
4228
|
+
await Promise.all(matches.map((m) => _optionalChain([m, 'access', _41 => _41._lazyPromises, 'optionalAccess', _42 => _42.middleware])));
|
|
4214
4229
|
}
|
|
4215
4230
|
let dataStrategyArgs = {
|
|
4216
4231
|
request,
|
|
@@ -4255,8 +4270,8 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
4255
4270
|
try {
|
|
4256
4271
|
await Promise.all(
|
|
4257
4272
|
matches.flatMap((m) => [
|
|
4258
|
-
_optionalChain([m, 'access',
|
|
4259
|
-
_optionalChain([m, 'access',
|
|
4273
|
+
_optionalChain([m, 'access', _43 => _43._lazyPromises, 'optionalAccess', _44 => _44.handler]),
|
|
4274
|
+
_optionalChain([m, 'access', _45 => _45._lazyPromises, 'optionalAccess', _46 => _46.route])
|
|
4260
4275
|
])
|
|
4261
4276
|
);
|
|
4262
4277
|
} catch (e) {
|
|
@@ -4401,19 +4416,19 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
|
4401
4416
|
return {
|
|
4402
4417
|
type: "error" /* error */,
|
|
4403
4418
|
error: result.data,
|
|
4404
|
-
statusCode: _optionalChain([result, 'access',
|
|
4405
|
-
headers: _optionalChain([result, 'access',
|
|
4419
|
+
statusCode: _optionalChain([result, 'access', _47 => _47.init, 'optionalAccess', _48 => _48.status]),
|
|
4420
|
+
headers: _optionalChain([result, 'access', _49 => _49.init, 'optionalAccess', _50 => _50.headers]) ? new Headers(result.init.headers) : void 0
|
|
4406
4421
|
};
|
|
4407
4422
|
}
|
|
4408
4423
|
return {
|
|
4409
4424
|
type: "error" /* error */,
|
|
4410
4425
|
error: new ErrorResponseImpl(
|
|
4411
|
-
_optionalChain([result, 'access',
|
|
4426
|
+
_optionalChain([result, 'access', _51 => _51.init, 'optionalAccess', _52 => _52.status]) || 500,
|
|
4412
4427
|
void 0,
|
|
4413
4428
|
result.data
|
|
4414
4429
|
),
|
|
4415
4430
|
statusCode: isRouteErrorResponse(result) ? result.status : void 0,
|
|
4416
|
-
headers: _optionalChain([result, 'access',
|
|
4431
|
+
headers: _optionalChain([result, 'access', _53 => _53.init, 'optionalAccess', _54 => _54.headers]) ? new Headers(result.init.headers) : void 0
|
|
4417
4432
|
};
|
|
4418
4433
|
}
|
|
4419
4434
|
return {
|
|
@@ -4426,8 +4441,8 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
|
4426
4441
|
return {
|
|
4427
4442
|
type: "data" /* data */,
|
|
4428
4443
|
data: result.data,
|
|
4429
|
-
statusCode: _optionalChain([result, 'access',
|
|
4430
|
-
headers: _optionalChain([result, 'access',
|
|
4444
|
+
statusCode: _optionalChain([result, 'access', _55 => _55.init, 'optionalAccess', _56 => _56.status]),
|
|
4445
|
+
headers: _optionalChain([result, 'access', _57 => _57.init, 'optionalAccess', _58 => _58.headers]) ? new Headers(result.init.headers) : void 0
|
|
4431
4446
|
};
|
|
4432
4447
|
}
|
|
4433
4448
|
return { type: "data" /* data */, data: result };
|
|
@@ -4576,7 +4591,7 @@ function processLoaderData(state, matches, results, pendingActionResult, revalid
|
|
|
4576
4591
|
let result = fetcherResults[key];
|
|
4577
4592
|
invariant(result, "Did not find corresponding fetcher result");
|
|
4578
4593
|
if (isErrorResult(result)) {
|
|
4579
|
-
let boundaryMatch = findNearestBoundary(state.matches, _optionalChain([match, 'optionalAccess',
|
|
4594
|
+
let boundaryMatch = findNearestBoundary(state.matches, _optionalChain([match, 'optionalAccess', _59 => _59.route, 'access', _60 => _60.id]));
|
|
4580
4595
|
if (!(errors && errors[boundaryMatch.route.id])) {
|
|
4581
4596
|
errors = {
|
|
4582
4597
|
...errors,
|
|
@@ -4713,8 +4728,8 @@ function dataWithResponseInitToResponse(data2) {
|
|
|
4713
4728
|
}
|
|
4714
4729
|
function dataWithResponseInitToErrorResponse(data2) {
|
|
4715
4730
|
return new ErrorResponseImpl(
|
|
4716
|
-
_nullishCoalesce(_optionalChain([data2, 'access',
|
|
4717
|
-
_nullishCoalesce(_optionalChain([data2, 'access',
|
|
4731
|
+
_nullishCoalesce(_optionalChain([data2, 'access', _61 => _61.init, 'optionalAccess', _62 => _62.status]), () => ( 500)),
|
|
4732
|
+
_nullishCoalesce(_optionalChain([data2, 'access', _63 => _63.init, 'optionalAccess', _64 => _64.statusText]), () => ( "Internal Server Error")),
|
|
4718
4733
|
data2.data
|
|
4719
4734
|
);
|
|
4720
4735
|
}
|
|
@@ -5753,7 +5768,7 @@ function getTurboStreamSingleFetchDataStrategy(getRouter, manifest, routeModules
|
|
|
5753
5768
|
return {
|
|
5754
5769
|
hasLoader: manifestRoute.hasLoader,
|
|
5755
5770
|
hasClientLoader: manifestRoute.hasClientLoader,
|
|
5756
|
-
hasShouldRevalidate: Boolean(_optionalChain([routeModule, 'optionalAccess',
|
|
5771
|
+
hasShouldRevalidate: Boolean(_optionalChain([routeModule, 'optionalAccess', _65 => _65.shouldRevalidate]))
|
|
5757
5772
|
};
|
|
5758
5773
|
},
|
|
5759
5774
|
fetchAndDecodeViaTurboStream,
|
|
@@ -5920,7 +5935,7 @@ async function bubbleMiddlewareErrors(singleFetchPromise, matches, routesParams,
|
|
|
5920
5935
|
let routeResult = fetchedData.routes[match.route.id];
|
|
5921
5936
|
if ("error" in routeResult) {
|
|
5922
5937
|
middlewareError = routeResult.error;
|
|
5923
|
-
if (_optionalChain([results, 'access',
|
|
5938
|
+
if (_optionalChain([results, 'access', _66 => _66[match.route.id], 'optionalAccess', _67 => _67.result]) == null) {
|
|
5924
5939
|
results[match.route.id] = {
|
|
5925
5940
|
type: "error",
|
|
5926
5941
|
result: middlewareError
|
|
@@ -6033,7 +6048,7 @@ async function fetchAndDecodeViaTurboStream(args, basename, targetRoutes) {
|
|
|
6033
6048
|
}
|
|
6034
6049
|
} else {
|
|
6035
6050
|
let typed = decoded.value;
|
|
6036
|
-
let routeId = _optionalChain([targetRoutes, 'optionalAccess',
|
|
6051
|
+
let routeId = _optionalChain([targetRoutes, 'optionalAccess', _68 => _68[0]]);
|
|
6037
6052
|
invariant2(routeId, "No routeId found for single fetch call decoding");
|
|
6038
6053
|
if ("redirect" in typed) {
|
|
6039
6054
|
data2 = { redirect: typed };
|
|
@@ -6315,7 +6330,7 @@ function useResolvedPath(to, { relative } = {}) {
|
|
|
6315
6330
|
function useRoutes(routes, locationArg) {
|
|
6316
6331
|
return useRoutesImpl(routes, locationArg);
|
|
6317
6332
|
}
|
|
6318
|
-
function useRoutesImpl(routes, locationArg, dataRouterState, future) {
|
|
6333
|
+
function useRoutesImpl(routes, locationArg, dataRouterState, unstable_onError, future) {
|
|
6319
6334
|
invariant(
|
|
6320
6335
|
useInRouterContext(),
|
|
6321
6336
|
// TODO: This error is probably because they somehow have 2 versions of the
|
|
@@ -6344,7 +6359,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
6344
6359
|
if (locationArg) {
|
|
6345
6360
|
let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
|
6346
6361
|
invariant(
|
|
6347
|
-
parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access',
|
|
6362
|
+
parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access', _69 => _69.pathname, 'optionalAccess', _70 => _70.startsWith, 'call', _71 => _71(parentPathnameBase)]),
|
|
6348
6363
|
`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.`
|
|
6349
6364
|
);
|
|
6350
6365
|
location = parsedLocationArg;
|
|
@@ -6387,6 +6402,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
6387
6402
|
),
|
|
6388
6403
|
parentMatches,
|
|
6389
6404
|
dataRouterState,
|
|
6405
|
+
unstable_onError,
|
|
6390
6406
|
future
|
|
6391
6407
|
);
|
|
6392
6408
|
if (locationArg && renderedMatches) {
|
|
@@ -6455,11 +6471,14 @@ var RenderErrorBoundary = class extends React3.Component {
|
|
|
6455
6471
|
};
|
|
6456
6472
|
}
|
|
6457
6473
|
componentDidCatch(error, errorInfo) {
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6474
|
+
if (this.props.unstable_onError) {
|
|
6475
|
+
this.props.unstable_onError(error, errorInfo);
|
|
6476
|
+
} else {
|
|
6477
|
+
console.error(
|
|
6478
|
+
"React Router caught the following error during render",
|
|
6479
|
+
error
|
|
6480
|
+
);
|
|
6481
|
+
}
|
|
6463
6482
|
}
|
|
6464
6483
|
render() {
|
|
6465
6484
|
return this.state.error !== void 0 ? /* @__PURE__ */ React3.createElement(RouteContext.Provider, { value: this.props.routeContext }, /* @__PURE__ */ React3.createElement(
|
|
@@ -6478,7 +6497,7 @@ function RenderedRoute({ routeContext, match, children }) {
|
|
|
6478
6497
|
}
|
|
6479
6498
|
return /* @__PURE__ */ React3.createElement(RouteContext.Provider, { value: routeContext }, children);
|
|
6480
6499
|
}
|
|
6481
|
-
function _renderMatches(matches, parentMatches = [], dataRouterState = null, future = null) {
|
|
6500
|
+
function _renderMatches(matches, parentMatches = [], dataRouterState = null, unstable_onError = null, future = null) {
|
|
6482
6501
|
if (matches == null) {
|
|
6483
6502
|
if (!dataRouterState) {
|
|
6484
6503
|
return null;
|
|
@@ -6492,10 +6511,10 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, fut
|
|
|
6492
6511
|
}
|
|
6493
6512
|
}
|
|
6494
6513
|
let renderedMatches = matches;
|
|
6495
|
-
let errors = _optionalChain([dataRouterState, 'optionalAccess',
|
|
6514
|
+
let errors = _optionalChain([dataRouterState, 'optionalAccess', _72 => _72.errors]);
|
|
6496
6515
|
if (errors != null) {
|
|
6497
6516
|
let errorIndex = renderedMatches.findIndex(
|
|
6498
|
-
(m) => m.route.id && _optionalChain([errors, 'optionalAccess',
|
|
6517
|
+
(m) => m.route.id && _optionalChain([errors, 'optionalAccess', _73 => _73[m.route.id]]) !== void 0
|
|
6499
6518
|
);
|
|
6500
6519
|
invariant(
|
|
6501
6520
|
errorIndex >= 0,
|
|
@@ -6590,7 +6609,8 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, fut
|
|
|
6590
6609
|
component: errorElement,
|
|
6591
6610
|
error,
|
|
6592
6611
|
children: getChildren(),
|
|
6593
|
-
routeContext: { outlet: null, matches: matches2, isDataRoute: true }
|
|
6612
|
+
routeContext: { outlet: null, matches: matches2, isDataRoute: true },
|
|
6613
|
+
unstable_onError
|
|
6594
6614
|
}
|
|
6595
6615
|
) : getChildren();
|
|
6596
6616
|
},
|
|
@@ -6672,15 +6692,15 @@ function useRouteError() {
|
|
|
6672
6692
|
if (error !== void 0) {
|
|
6673
6693
|
return error;
|
|
6674
6694
|
}
|
|
6675
|
-
return _optionalChain([state, 'access',
|
|
6695
|
+
return _optionalChain([state, 'access', _74 => _74.errors, 'optionalAccess', _75 => _75[routeId]]);
|
|
6676
6696
|
}
|
|
6677
6697
|
function useAsyncValue() {
|
|
6678
6698
|
let value = React3.useContext(AwaitContext);
|
|
6679
|
-
return _optionalChain([value, 'optionalAccess',
|
|
6699
|
+
return _optionalChain([value, 'optionalAccess', _76 => _76._data]);
|
|
6680
6700
|
}
|
|
6681
6701
|
function useAsyncError() {
|
|
6682
6702
|
let value = React3.useContext(AwaitContext);
|
|
6683
|
-
return _optionalChain([value, 'optionalAccess',
|
|
6703
|
+
return _optionalChain([value, 'optionalAccess', _77 => _77._error]);
|
|
6684
6704
|
}
|
|
6685
6705
|
var blockerId = 0;
|
|
6686
6706
|
function useBlocker(shouldBlock) {
|
|
@@ -6792,7 +6812,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
|
|
|
6792
6812
|
let route = manifest.routes[match.route.id];
|
|
6793
6813
|
return [
|
|
6794
6814
|
route && route.css ? route.css.map((href) => ({ rel: "stylesheet", href })) : [],
|
|
6795
|
-
_optionalChain([module, 'optionalAccess',
|
|
6815
|
+
_optionalChain([module, 'optionalAccess', _78 => _78.links, 'optionalCall', _79 => _79()]) || []
|
|
6796
6816
|
];
|
|
6797
6817
|
}).flat(2);
|
|
6798
6818
|
let preloads = getModuleLinkHrefs(matches, manifest);
|
|
@@ -6893,7 +6913,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
|
|
|
6893
6913
|
// param change, /users/123 -> /users/456
|
|
6894
6914
|
currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
|
|
6895
6915
|
// e.g. /files/images/avatar.jpg -> files/finances.xls
|
|
6896
|
-
_optionalChain([currentMatches, 'access',
|
|
6916
|
+
_optionalChain([currentMatches, 'access', _80 => _80[index], 'access', _81 => _81.route, 'access', _82 => _82.path, 'optionalAccess', _83 => _83.endsWith, 'call', _84 => _84("*")]) && currentMatches[index].params["*"] !== match.params["*"]
|
|
6897
6917
|
);
|
|
6898
6918
|
};
|
|
6899
6919
|
if (mode === "assets") {
|
|
@@ -6916,7 +6936,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
|
|
|
6916
6936
|
location.pathname + location.search + location.hash,
|
|
6917
6937
|
window.origin
|
|
6918
6938
|
),
|
|
6919
|
-
currentParams: _optionalChain([currentMatches, 'access',
|
|
6939
|
+
currentParams: _optionalChain([currentMatches, 'access', _85 => _85[0], 'optionalAccess', _86 => _86.params]) || {},
|
|
6920
6940
|
nextUrl: new URL(page, window.origin),
|
|
6921
6941
|
nextParams: match.params,
|
|
6922
6942
|
defaultShouldRevalidate: true
|
|
@@ -7188,10 +7208,10 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
7188
7208
|
)
|
|
7189
7209
|
});
|
|
7190
7210
|
let hasInitialData = initialState && initialState.loaderData && route.id in initialState.loaderData;
|
|
7191
|
-
let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess',
|
|
7211
|
+
let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess', _87 => _87.loaderData, 'optionalAccess', _88 => _88[route.id]]) : void 0;
|
|
7192
7212
|
let hasInitialError = initialState && initialState.errors && route.id in initialState.errors;
|
|
7193
|
-
let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess',
|
|
7194
|
-
let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access',
|
|
7213
|
+
let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess', _89 => _89.errors, 'optionalAccess', _90 => _90[route.id]]) : void 0;
|
|
7214
|
+
let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access', _91 => _91.clientLoader, 'optionalAccess', _92 => _92.hydrate]) === true || !route.hasLoader);
|
|
7195
7215
|
dataRoute.loader = async ({ request, params, context }, singleFetch) => {
|
|
7196
7216
|
try {
|
|
7197
7217
|
let result = await prefetchStylesAndCallHandler(async () => {
|
|
@@ -7488,7 +7508,7 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDi
|
|
|
7488
7508
|
function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
|
|
7489
7509
|
React6.useEffect(() => {
|
|
7490
7510
|
if (!isFogOfWarEnabled(routeDiscovery, ssr) || // @ts-expect-error - TS doesn't know about this yet
|
|
7491
|
-
_optionalChain([window, 'access',
|
|
7511
|
+
_optionalChain([window, 'access', _93 => _93.navigator, 'optionalAccess', _94 => _94.connection, 'optionalAccess', _95 => _95.saveData]) === true) {
|
|
7492
7512
|
return;
|
|
7493
7513
|
}
|
|
7494
7514
|
function registerElement(el) {
|
|
@@ -7591,7 +7611,7 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
|
|
|
7591
7611
|
sessionStorage.removeItem(MANIFEST_VERSION_STORAGE_KEY);
|
|
7592
7612
|
serverPatches = await res.json();
|
|
7593
7613
|
} catch (e) {
|
|
7594
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
7614
|
+
if (_optionalChain([signal, 'optionalAccess', _96 => _96.aborted])) return;
|
|
7595
7615
|
throw e;
|
|
7596
7616
|
}
|
|
7597
7617
|
let knownRoutes = new Set(Object.keys(manifest.routes));
|
|
@@ -7832,7 +7852,7 @@ function PrefetchPageLinksImpl({
|
|
|
7832
7852
|
if (!manifestRoute || !manifestRoute.hasLoader) {
|
|
7833
7853
|
return;
|
|
7834
7854
|
}
|
|
7835
|
-
if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access',
|
|
7855
|
+
if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access', _97 => _97[m.route.id], 'optionalAccess', _98 => _98.shouldRevalidate])) {
|
|
7836
7856
|
foundOptOutRoute = true;
|
|
7837
7857
|
} else if (manifestRoute.hasClientLoader) {
|
|
7838
7858
|
foundOptOutRoute = true;
|
|
@@ -7906,7 +7926,7 @@ function Meta() {
|
|
|
7906
7926
|
error
|
|
7907
7927
|
};
|
|
7908
7928
|
matches[i] = match;
|
|
7909
|
-
if (_optionalChain([routeModule, 'optionalAccess',
|
|
7929
|
+
if (_optionalChain([routeModule, 'optionalAccess', _99 => _99.meta])) {
|
|
7910
7930
|
routeMeta = typeof routeModule.meta === "function" ? routeModule.meta({
|
|
7911
7931
|
data: data2,
|
|
7912
7932
|
loaderData: data2,
|
|
@@ -7976,6 +7996,9 @@ function isValidMetaTag(tagName) {
|
|
|
7976
7996
|
return typeof tagName === "string" && /^(meta|link)$/.test(tagName);
|
|
7977
7997
|
}
|
|
7978
7998
|
var isHydrated = false;
|
|
7999
|
+
function setIsHydrated() {
|
|
8000
|
+
isHydrated = true;
|
|
8001
|
+
}
|
|
7979
8002
|
function Scripts(scriptProps) {
|
|
7980
8003
|
let {
|
|
7981
8004
|
manifest,
|
|
@@ -7994,7 +8017,7 @@ function Scripts(scriptProps) {
|
|
|
7994
8017
|
}
|
|
7995
8018
|
let matches = getActiveMatches(routerMatches, null, isSpaMode);
|
|
7996
8019
|
React7.useEffect(() => {
|
|
7997
|
-
|
|
8020
|
+
setIsHydrated();
|
|
7998
8021
|
}, []);
|
|
7999
8022
|
let initialScripts = React7.useMemo(() => {
|
|
8000
8023
|
if (isRSCRouterContext) {
|
|
@@ -8002,7 +8025,7 @@ function Scripts(scriptProps) {
|
|
|
8002
8025
|
}
|
|
8003
8026
|
let streamScript = "window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());";
|
|
8004
8027
|
let contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};${streamScript}` : " ";
|
|
8005
|
-
let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access',
|
|
8028
|
+
let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access', _100 => _100.hmr, 'optionalAccess', _101 => _101.runtime]) ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
|
|
8006
8029
|
${matches.map((match, routeIndex) => {
|
|
8007
8030
|
let routeVarName = `route${routeIndex}`;
|
|
8008
8031
|
let manifestEntry = manifest.routes[match.route.id];
|
|
@@ -8232,7 +8255,7 @@ function BoundaryShell({
|
|
|
8232
8255
|
children
|
|
8233
8256
|
}) {
|
|
8234
8257
|
let { routeModules } = useFrameworkContext();
|
|
8235
|
-
if (_optionalChain([routeModules, 'access',
|
|
8258
|
+
if (_optionalChain([routeModules, 'access', _102 => _102.root, 'optionalAccess', _103 => _103.Layout]) && !isOutsideRemixApp) {
|
|
8236
8259
|
return children;
|
|
8237
8260
|
}
|
|
8238
8261
|
return /* @__PURE__ */ React8.createElement("html", { lang: "en" }, /* @__PURE__ */ React8.createElement("head", null, /* @__PURE__ */ React8.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ React8.createElement(
|
|
@@ -8344,4 +8367,5 @@ function BoundaryShell({
|
|
|
8344
8367
|
|
|
8345
8368
|
|
|
8346
8369
|
|
|
8347
|
-
|
|
8370
|
+
|
|
8371
|
+
exports.Action = Action; exports.createMemoryHistory = createMemoryHistory; exports.createBrowserHistory = createBrowserHistory; exports.createHashHistory = createHashHistory; exports.invariant = invariant; exports.warning = warning; exports.createPath = createPath; exports.parsePath = parsePath; exports.unstable_createContext = unstable_createContext; exports.unstable_RouterContextProvider = unstable_RouterContextProvider; exports.convertRoutesToDataRoutes = convertRoutesToDataRoutes; exports.matchRoutes = matchRoutes; exports.generatePath = generatePath; exports.matchPath = matchPath; exports.stripBasename = stripBasename; exports.resolvePath = resolvePath; exports.getResolveToMatches = getResolveToMatches; exports.resolveTo = resolveTo; exports.joinPaths = joinPaths; exports.data = data; exports.redirect = redirect; exports.redirectDocument = redirectDocument; exports.replace = replace; exports.ErrorResponseImpl = ErrorResponseImpl; exports.isRouteErrorResponse = isRouteErrorResponse; exports.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.AwaitContext = AwaitContext; 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._renderMatches = _renderMatches; 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.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;
|