react-router 0.0.0-experimental-73e447577 → 0.0.0-experimental-e613d4238
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 +35 -0
- package/dist/development/{chunk-NKIXC2FA.mjs → chunk-2YVPYFDJ.mjs} +120 -131
- package/dist/development/{chunk-PF7FO4KS.mjs → chunk-5P3HEZQU.mjs} +145 -310
- package/dist/development/{chunk-SOMUQ5BV.js → chunk-XXC4LMW2.js} +265 -154
- package/dist/development/{chunk-WQE2SM7S.js → chunk-YJ6T7YSE.js} +72 -348
- package/dist/development/{router-2BoB34m1.d.mts → context-BqL5Eckq.d.mts} +1288 -1441
- package/dist/development/dom-export.d.mts +4 -59
- package/dist/development/dom-export.d.ts +3 -59
- package/dist/development/dom-export.js +5 -8
- package/dist/development/dom-export.mjs +5 -8
- package/dist/{production/index-react-server-client-BDG19ZQl.d.mts → development/index-react-server-client-2EDmGlsZ.d.mts} +77 -140
- package/dist/development/{index-react-server-client-BDG19ZQl.d.mts → index-react-server-client-DKvU8YRr.d.ts} +134 -198
- package/dist/development/index-react-server-client.d.mts +3 -3
- package/dist/development/index-react-server-client.d.ts +2 -3
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.d.mts +1 -106
- package/dist/development/index-react-server.d.ts +1 -106
- package/dist/development/index-react-server.js +12 -182
- package/dist/development/index-react-server.mjs +12 -182
- package/dist/development/index.d.mts +18 -13
- package/dist/development/index.d.ts +16 -13
- package/dist/development/index.js +214 -223
- package/dist/development/index.mjs +5 -3
- package/dist/development/lib/types/internal.d.mts +3 -3
- package/dist/development/lib/types/internal.d.ts +2 -3
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{register-DiOIlEq5.d.mts → register-BrVEYTED.d.mts} +7 -1
- package/dist/{production/register-DiOIlEq5.d.mts → development/register-D8NQoPsO.d.ts} +7 -1
- package/dist/development/{routeModules-CtCOLGtG.d.mts → route-data-CDwqkzPE.d.mts} +147 -157
- package/dist/{production/routeModules-Bu1JamQV.d.ts → development/routeModules-BmVo7q9e.d.ts} +1046 -73
- package/dist/production/{chunk-TUGDEB6V.mjs → chunk-5MHETEIL.mjs} +120 -131
- package/dist/production/{chunk-TA3WUUL6.js → chunk-E4G6PZCJ.js} +265 -154
- package/dist/production/{chunk-VRFRIIGI.js → chunk-QBUHFRYZ.js} +72 -348
- package/dist/production/{chunk-YUNRQEIK.mjs → chunk-VNGQS422.mjs} +145 -310
- package/dist/production/{router-2BoB34m1.d.mts → context-BqL5Eckq.d.mts} +1288 -1441
- package/dist/production/dom-export.d.mts +4 -59
- package/dist/production/dom-export.d.ts +3 -59
- package/dist/production/dom-export.js +5 -8
- package/dist/production/dom-export.mjs +5 -8
- package/dist/{development/index-react-server-client-83aVZHgI.d.ts → production/index-react-server-client-2EDmGlsZ.d.mts} +77 -140
- package/dist/production/{index-react-server-client-83aVZHgI.d.ts → index-react-server-client-DKvU8YRr.d.ts} +134 -198
- package/dist/production/index-react-server-client.d.mts +3 -3
- package/dist/production/index-react-server-client.d.ts +2 -3
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.d.mts +1 -106
- package/dist/production/index-react-server.d.ts +1 -106
- package/dist/production/index-react-server.js +12 -182
- package/dist/production/index-react-server.mjs +12 -182
- package/dist/production/index.d.mts +18 -13
- package/dist/production/index.d.ts +16 -13
- package/dist/production/index.js +214 -223
- package/dist/production/index.mjs +5 -3
- package/dist/production/lib/types/internal.d.mts +3 -3
- package/dist/production/lib/types/internal.d.ts +2 -3
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/{development/register-DiOIlEq5.d.ts → production/register-BrVEYTED.d.mts} +7 -1
- package/dist/production/{register-DiOIlEq5.d.ts → register-D8NQoPsO.d.ts} +7 -1
- package/dist/production/{routeModules-CtCOLGtG.d.mts → route-data-CDwqkzPE.d.mts} +147 -157
- package/dist/{development/routeModules-Bu1JamQV.d.ts → production/routeModules-BmVo7q9e.d.ts} +1046 -73
- package/package.json +1 -1
- package/dist/development/instrumentation-XYmrzhe3.d.ts +0 -1138
- package/dist/production/instrumentation-XYmrzhe3.d.ts +0 -1138
|
@@ -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-e613d4238
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -454,23 +454,19 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath = [],
|
|
|
454
454
|
if (isIndexRoute(route)) {
|
|
455
455
|
let indexRoute = {
|
|
456
456
|
...route,
|
|
457
|
+
...mapRouteProperties(route),
|
|
457
458
|
id
|
|
458
459
|
};
|
|
459
|
-
manifest[id] =
|
|
460
|
-
indexRoute,
|
|
461
|
-
mapRouteProperties(indexRoute)
|
|
462
|
-
);
|
|
460
|
+
manifest[id] = indexRoute;
|
|
463
461
|
return indexRoute;
|
|
464
462
|
} else {
|
|
465
463
|
let pathOrLayoutRoute = {
|
|
466
464
|
...route,
|
|
465
|
+
...mapRouteProperties(route),
|
|
467
466
|
id,
|
|
468
467
|
children: void 0
|
|
469
468
|
};
|
|
470
|
-
manifest[id] =
|
|
471
|
-
pathOrLayoutRoute,
|
|
472
|
-
mapRouteProperties(pathOrLayoutRoute)
|
|
473
|
-
);
|
|
469
|
+
manifest[id] = pathOrLayoutRoute;
|
|
474
470
|
if (route.children) {
|
|
475
471
|
pathOrLayoutRoute.children = convertRoutesToDataRoutes(
|
|
476
472
|
route.children,
|
|
@@ -484,17 +480,6 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath = [],
|
|
|
484
480
|
}
|
|
485
481
|
});
|
|
486
482
|
}
|
|
487
|
-
function mergeRouteUpdates(route, updates) {
|
|
488
|
-
return Object.assign(route, {
|
|
489
|
-
...updates,
|
|
490
|
-
...typeof updates.lazy === "object" && updates.lazy != null ? {
|
|
491
|
-
lazy: {
|
|
492
|
-
...route.lazy,
|
|
493
|
-
...updates.lazy
|
|
494
|
-
}
|
|
495
|
-
} : {}
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
483
|
function matchRoutes(routes, locationArg, basename = "/") {
|
|
499
484
|
return matchRoutesImpl(routes, locationArg, basename, false);
|
|
500
485
|
}
|
|
@@ -950,229 +935,6 @@ var ErrorResponseImpl = class {
|
|
|
950
935
|
function isRouteErrorResponse(error) {
|
|
951
936
|
return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
|
|
952
937
|
}
|
|
953
|
-
function getRoutePattern(paths) {
|
|
954
|
-
return paths.filter(Boolean).join("/").replace(/\/\/*/g, "/");
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
// lib/router/instrumentation.ts
|
|
958
|
-
var UninstrumentedSymbol = Symbol("Uninstrumented");
|
|
959
|
-
function getInstrumentedImplementation(impls, handler, getInfo = () => void 0) {
|
|
960
|
-
if (impls.length === 0) {
|
|
961
|
-
return null;
|
|
962
|
-
}
|
|
963
|
-
return async (...args) => {
|
|
964
|
-
let value;
|
|
965
|
-
let info = getInfo(...args);
|
|
966
|
-
await recurseRight(
|
|
967
|
-
impls,
|
|
968
|
-
info,
|
|
969
|
-
async () => {
|
|
970
|
-
value = await handler(...args);
|
|
971
|
-
},
|
|
972
|
-
impls.length - 1
|
|
973
|
-
);
|
|
974
|
-
return value;
|
|
975
|
-
};
|
|
976
|
-
}
|
|
977
|
-
async function recurseRight(impls, info, handler, index) {
|
|
978
|
-
let impl = impls[index];
|
|
979
|
-
if (!impl) {
|
|
980
|
-
await handler();
|
|
981
|
-
} else {
|
|
982
|
-
await impl(async () => {
|
|
983
|
-
await recurseRight(impls, info, handler, index - 1);
|
|
984
|
-
}, info);
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
function getInstrumentationInfo(args) {
|
|
988
|
-
let { request, context, params, pattern } = args;
|
|
989
|
-
return {
|
|
990
|
-
// pseudo "Request" with the info they may want to read from
|
|
991
|
-
request: {
|
|
992
|
-
method: request.method,
|
|
993
|
-
url: request.url,
|
|
994
|
-
// Maybe make this a proxy that only supports `get`?
|
|
995
|
-
headers: {
|
|
996
|
-
get: (...args2) => request.headers.get(...args2)
|
|
997
|
-
}
|
|
998
|
-
},
|
|
999
|
-
params: { ...params },
|
|
1000
|
-
pattern,
|
|
1001
|
-
context: {
|
|
1002
|
-
get: (...args2) => context.get(...args2)
|
|
1003
|
-
}
|
|
1004
|
-
};
|
|
1005
|
-
}
|
|
1006
|
-
function getInstrumentationsByType(instrumentations, key) {
|
|
1007
|
-
let value = [];
|
|
1008
|
-
for (let i in instrumentations) {
|
|
1009
|
-
let instrumentation = instrumentations[i];
|
|
1010
|
-
if (key in instrumentation && instrumentation[key] != null) {
|
|
1011
|
-
value.push(instrumentation[key]);
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
return value;
|
|
1015
|
-
}
|
|
1016
|
-
function getInstrumentationUpdates(fns, route) {
|
|
1017
|
-
let instrumentations = [];
|
|
1018
|
-
fns.forEach(
|
|
1019
|
-
(fn) => fn({
|
|
1020
|
-
id: route.id,
|
|
1021
|
-
index: route.index,
|
|
1022
|
-
path: route.path,
|
|
1023
|
-
instrument(i) {
|
|
1024
|
-
instrumentations.push(i);
|
|
1025
|
-
}
|
|
1026
|
-
})
|
|
1027
|
-
);
|
|
1028
|
-
let updates = {};
|
|
1029
|
-
if (instrumentations.length > 0) {
|
|
1030
|
-
["lazy", "loader", "action"].forEach((key) => {
|
|
1031
|
-
let func = route[key];
|
|
1032
|
-
if (typeof func === "function") {
|
|
1033
|
-
let original = _nullishCoalesce(func[UninstrumentedSymbol], () => ( func));
|
|
1034
|
-
let instrumented = getInstrumentedImplementation(
|
|
1035
|
-
getInstrumentationsByType(instrumentations, key),
|
|
1036
|
-
original,
|
|
1037
|
-
key === "lazy" ? () => void 0 : (...args) => getInstrumentationInfo(
|
|
1038
|
-
args[0]
|
|
1039
|
-
)
|
|
1040
|
-
);
|
|
1041
|
-
if (instrumented) {
|
|
1042
|
-
instrumented[UninstrumentedSymbol] = original;
|
|
1043
|
-
updates[key] = instrumented;
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
});
|
|
1047
|
-
if (route.middleware && route.middleware.length > 0) {
|
|
1048
|
-
updates.middleware = route.middleware.map((middleware) => {
|
|
1049
|
-
let original = _nullishCoalesce(middleware[UninstrumentedSymbol], () => ( middleware));
|
|
1050
|
-
let instrumented = getInstrumentedImplementation(
|
|
1051
|
-
getInstrumentationsByType(instrumentations, "middleware"),
|
|
1052
|
-
original,
|
|
1053
|
-
(...args) => getInstrumentationInfo(
|
|
1054
|
-
args[0]
|
|
1055
|
-
)
|
|
1056
|
-
);
|
|
1057
|
-
if (instrumented) {
|
|
1058
|
-
instrumented[UninstrumentedSymbol] = original;
|
|
1059
|
-
return instrumented;
|
|
1060
|
-
}
|
|
1061
|
-
return middleware;
|
|
1062
|
-
});
|
|
1063
|
-
}
|
|
1064
|
-
if (typeof route.lazy === "object") {
|
|
1065
|
-
let lazyObject = route.lazy;
|
|
1066
|
-
["middleware", "loader", "action"].forEach((key) => {
|
|
1067
|
-
let func = lazyObject[key];
|
|
1068
|
-
if (typeof func === "function") {
|
|
1069
|
-
let instrumented = getInstrumentedImplementation(
|
|
1070
|
-
getInstrumentationsByType(instrumentations, `lazy.${key}`),
|
|
1071
|
-
func
|
|
1072
|
-
);
|
|
1073
|
-
if (instrumented) {
|
|
1074
|
-
updates.lazy = Object.assign(updates.lazy || {}, {
|
|
1075
|
-
[key]: instrumented
|
|
1076
|
-
});
|
|
1077
|
-
}
|
|
1078
|
-
}
|
|
1079
|
-
});
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
return updates;
|
|
1083
|
-
}
|
|
1084
|
-
function instrumentClientSideRouter(router, fns) {
|
|
1085
|
-
let instrumentations = [];
|
|
1086
|
-
fns.forEach(
|
|
1087
|
-
(fn) => fn({
|
|
1088
|
-
instrument(i) {
|
|
1089
|
-
instrumentations.push(i);
|
|
1090
|
-
}
|
|
1091
|
-
})
|
|
1092
|
-
);
|
|
1093
|
-
if (instrumentations.length > 0) {
|
|
1094
|
-
let navigate = _nullishCoalesce(router.navigate[UninstrumentedSymbol], () => ( router.navigate));
|
|
1095
|
-
let instrumentedNavigate = getInstrumentedImplementation(
|
|
1096
|
-
getInstrumentationsByType(instrumentations, "navigate"),
|
|
1097
|
-
navigate,
|
|
1098
|
-
(...args) => {
|
|
1099
|
-
let [to, opts] = args;
|
|
1100
|
-
opts = _nullishCoalesce(opts, () => ( {}));
|
|
1101
|
-
let info = {
|
|
1102
|
-
to: typeof to === "number" || typeof to === "string" ? to : to ? createPath(to) : ".",
|
|
1103
|
-
currentUrl: createPath(router.state.location),
|
|
1104
|
-
..."formMethod" in opts ? { formMethod: opts.formMethod } : {},
|
|
1105
|
-
..."formEncType" in opts ? { formEncType: opts.formEncType } : {},
|
|
1106
|
-
..."formData" in opts ? { formData: opts.formData } : {},
|
|
1107
|
-
..."body" in opts ? { body: opts.body } : {}
|
|
1108
|
-
};
|
|
1109
|
-
return info;
|
|
1110
|
-
}
|
|
1111
|
-
);
|
|
1112
|
-
if (instrumentedNavigate) {
|
|
1113
|
-
instrumentedNavigate[UninstrumentedSymbol] = navigate;
|
|
1114
|
-
router.navigate = instrumentedNavigate;
|
|
1115
|
-
}
|
|
1116
|
-
let fetch2 = _nullishCoalesce(router.fetch[UninstrumentedSymbol], () => ( router.fetch));
|
|
1117
|
-
let instrumentedFetch = getInstrumentedImplementation(
|
|
1118
|
-
getInstrumentationsByType(instrumentations, "fetch"),
|
|
1119
|
-
fetch2,
|
|
1120
|
-
(...args) => {
|
|
1121
|
-
let [key, , href, opts] = args;
|
|
1122
|
-
opts = _nullishCoalesce(opts, () => ( {}));
|
|
1123
|
-
let info = {
|
|
1124
|
-
href: _nullishCoalesce(href, () => ( ".")),
|
|
1125
|
-
currentUrl: createPath(router.state.location),
|
|
1126
|
-
fetcherKey: key,
|
|
1127
|
-
..."formMethod" in opts ? { formMethod: opts.formMethod } : {},
|
|
1128
|
-
..."formEncType" in opts ? { formEncType: opts.formEncType } : {},
|
|
1129
|
-
..."formData" in opts ? { formData: opts.formData } : {},
|
|
1130
|
-
..."body" in opts ? { body: opts.body } : {}
|
|
1131
|
-
};
|
|
1132
|
-
return info;
|
|
1133
|
-
}
|
|
1134
|
-
);
|
|
1135
|
-
if (instrumentedFetch) {
|
|
1136
|
-
instrumentedFetch[UninstrumentedSymbol] = fetch2;
|
|
1137
|
-
router.fetch = instrumentedFetch;
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1140
|
-
return router;
|
|
1141
|
-
}
|
|
1142
|
-
function instrumentHandler(handler, fns) {
|
|
1143
|
-
let instrumentations = [];
|
|
1144
|
-
fns.forEach(
|
|
1145
|
-
(fn) => fn({
|
|
1146
|
-
instrument(i) {
|
|
1147
|
-
instrumentations.push(i);
|
|
1148
|
-
}
|
|
1149
|
-
})
|
|
1150
|
-
);
|
|
1151
|
-
if (instrumentations.length === 0) {
|
|
1152
|
-
return handler;
|
|
1153
|
-
}
|
|
1154
|
-
let instrumentedHandler = getInstrumentedImplementation(
|
|
1155
|
-
getInstrumentationsByType(instrumentations, "request"),
|
|
1156
|
-
handler,
|
|
1157
|
-
(...args) => {
|
|
1158
|
-
let [request, context] = args;
|
|
1159
|
-
let info = {
|
|
1160
|
-
request: {
|
|
1161
|
-
method: request.method,
|
|
1162
|
-
url: request.url,
|
|
1163
|
-
headers: {
|
|
1164
|
-
get: (...args2) => request.headers.get(...args2)
|
|
1165
|
-
}
|
|
1166
|
-
},
|
|
1167
|
-
context: {
|
|
1168
|
-
get: (ctx) => context ? context.get(ctx) : void 0
|
|
1169
|
-
}
|
|
1170
|
-
};
|
|
1171
|
-
return info;
|
|
1172
|
-
}
|
|
1173
|
-
);
|
|
1174
|
-
return _nullishCoalesce(instrumentedHandler, () => ( handler));
|
|
1175
|
-
}
|
|
1176
938
|
|
|
1177
939
|
// lib/router/router.ts
|
|
1178
940
|
var validMutationMethodsArr = [
|
|
@@ -1232,20 +994,7 @@ function createRouter(init) {
|
|
|
1232
994
|
"You must provide a non-empty routes array to createRouter"
|
|
1233
995
|
);
|
|
1234
996
|
let hydrationRouteProperties = init.hydrationRouteProperties || [];
|
|
1235
|
-
let
|
|
1236
|
-
let mapRouteProperties = _mapRouteProperties;
|
|
1237
|
-
if (init.unstable_instrumentations) {
|
|
1238
|
-
let instrumentations = init.unstable_instrumentations;
|
|
1239
|
-
mapRouteProperties = (route) => {
|
|
1240
|
-
return {
|
|
1241
|
-
..._mapRouteProperties(route),
|
|
1242
|
-
...getInstrumentationUpdates(
|
|
1243
|
-
instrumentations.map((i) => i.route).filter(Boolean),
|
|
1244
|
-
route
|
|
1245
|
-
)
|
|
1246
|
-
};
|
|
1247
|
-
};
|
|
1248
|
-
}
|
|
997
|
+
let mapRouteProperties = init.mapRouteProperties || defaultMapRouteProperties;
|
|
1249
998
|
let manifest = {};
|
|
1250
999
|
let dataRoutes = convertRoutesToDataRoutes(
|
|
1251
1000
|
init.routes,
|
|
@@ -2997,12 +2746,6 @@ function createRouter(init) {
|
|
|
2997
2746
|
updateState(newState);
|
|
2998
2747
|
}
|
|
2999
2748
|
};
|
|
3000
|
-
if (init.unstable_instrumentations) {
|
|
3001
|
-
router = instrumentClientSideRouter(
|
|
3002
|
-
router,
|
|
3003
|
-
init.unstable_instrumentations.map((i) => i.router).filter(Boolean)
|
|
3004
|
-
);
|
|
3005
|
-
}
|
|
3006
2749
|
return router;
|
|
3007
2750
|
}
|
|
3008
2751
|
function createStaticHandler(routes, opts) {
|
|
@@ -3012,20 +2755,7 @@ function createStaticHandler(routes, opts) {
|
|
|
3012
2755
|
);
|
|
3013
2756
|
let manifest = {};
|
|
3014
2757
|
let basename = (opts ? opts.basename : null) || "/";
|
|
3015
|
-
let
|
|
3016
|
-
let mapRouteProperties = _mapRouteProperties;
|
|
3017
|
-
if (_optionalChain([opts, 'optionalAccess', _17 => _17.unstable_instrumentations])) {
|
|
3018
|
-
let instrumentations = opts.unstable_instrumentations;
|
|
3019
|
-
mapRouteProperties = (route) => {
|
|
3020
|
-
return {
|
|
3021
|
-
..._mapRouteProperties(route),
|
|
3022
|
-
...getInstrumentationUpdates(
|
|
3023
|
-
instrumentations.map((i) => i.route).filter(Boolean),
|
|
3024
|
-
route
|
|
3025
|
-
)
|
|
3026
|
-
};
|
|
3027
|
-
};
|
|
3028
|
-
}
|
|
2758
|
+
let mapRouteProperties = _optionalChain([opts, 'optionalAccess', _16 => _16.mapRouteProperties]) || defaultMapRouteProperties;
|
|
3029
2759
|
let dataRoutes = convertRoutesToDataRoutes(
|
|
3030
2760
|
routes,
|
|
3031
2761
|
mapRouteProperties,
|
|
@@ -3095,7 +2825,6 @@ function createStaticHandler(routes, opts) {
|
|
|
3095
2825
|
let response = await runServerMiddlewarePipeline(
|
|
3096
2826
|
{
|
|
3097
2827
|
request,
|
|
3098
|
-
pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
3099
2828
|
matches,
|
|
3100
2829
|
params: matches[0].params,
|
|
3101
2830
|
// If we're calling middleware then it must be enabled so we can cast
|
|
@@ -3159,9 +2888,9 @@ function createStaticHandler(routes, opts) {
|
|
|
3159
2888
|
} else {
|
|
3160
2889
|
let boundaryRouteId = skipLoaderErrorBubbling ? routeId : findNearestBoundary(
|
|
3161
2890
|
matches,
|
|
3162
|
-
_optionalChain([matches, 'access',
|
|
2891
|
+
_optionalChain([matches, 'access', _17 => _17.find, 'call', _18 => _18(
|
|
3163
2892
|
(m) => m.route.id === routeId || m.route.loader
|
|
3164
|
-
), 'optionalAccess',
|
|
2893
|
+
), 'optionalAccess', _19 => _19.route, 'access', _20 => _20.id]) || routeId
|
|
3165
2894
|
).route.id;
|
|
3166
2895
|
let staticContext = {
|
|
3167
2896
|
matches,
|
|
@@ -3241,7 +2970,6 @@ function createStaticHandler(routes, opts) {
|
|
|
3241
2970
|
let response = await runServerMiddlewarePipeline(
|
|
3242
2971
|
{
|
|
3243
2972
|
request,
|
|
3244
|
-
pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
3245
2973
|
matches,
|
|
3246
2974
|
params: matches[0].params,
|
|
3247
2975
|
// If we're calling middleware then it must be enabled so we can cast
|
|
@@ -3494,11 +3222,11 @@ function createStaticHandler(routes, opts) {
|
|
|
3494
3222
|
}
|
|
3495
3223
|
async function loadRouteData(request, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad, pendingActionResult) {
|
|
3496
3224
|
let isRouteRequest = routeMatch != null;
|
|
3497
|
-
if (isRouteRequest && !_optionalChain([routeMatch, 'optionalAccess',
|
|
3225
|
+
if (isRouteRequest && !_optionalChain([routeMatch, 'optionalAccess', _21 => _21.route, 'access', _22 => _22.loader]) && !_optionalChain([routeMatch, 'optionalAccess', _23 => _23.route, 'access', _24 => _24.lazy])) {
|
|
3498
3226
|
throw getInternalRouterError(400, {
|
|
3499
3227
|
method: request.method,
|
|
3500
3228
|
pathname: new URL(request.url).pathname,
|
|
3501
|
-
routeId: _optionalChain([routeMatch, 'optionalAccess',
|
|
3229
|
+
routeId: _optionalChain([routeMatch, 'optionalAccess', _25 => _25.route, 'access', _26 => _26.id])
|
|
3502
3230
|
});
|
|
3503
3231
|
}
|
|
3504
3232
|
let dsMatches;
|
|
@@ -3523,7 +3251,6 @@ function createStaticHandler(routes, opts) {
|
|
|
3523
3251
|
mapRouteProperties,
|
|
3524
3252
|
manifest,
|
|
3525
3253
|
request,
|
|
3526
|
-
getRoutePattern(matches.map((m) => m.route.path)),
|
|
3527
3254
|
match,
|
|
3528
3255
|
[],
|
|
3529
3256
|
requestContext,
|
|
@@ -3534,7 +3261,6 @@ function createStaticHandler(routes, opts) {
|
|
|
3534
3261
|
mapRouteProperties,
|
|
3535
3262
|
manifest,
|
|
3536
3263
|
request,
|
|
3537
|
-
getRoutePattern(matches.map((m) => m.route.path)),
|
|
3538
3264
|
match,
|
|
3539
3265
|
[],
|
|
3540
3266
|
requestContext,
|
|
@@ -3808,7 +3534,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest,
|
|
|
3808
3534
|
let shouldSkipRevalidation = actionStatus && actionStatus >= 400;
|
|
3809
3535
|
let baseShouldRevalidateArgs = {
|
|
3810
3536
|
currentUrl,
|
|
3811
|
-
currentParams: _optionalChain([state, 'access',
|
|
3537
|
+
currentParams: _optionalChain([state, 'access', _27 => _27.matches, 'access', _28 => _28[0], 'optionalAccess', _29 => _29.params]) || {},
|
|
3812
3538
|
nextUrl,
|
|
3813
3539
|
nextParams: matches[0].params,
|
|
3814
3540
|
...submission,
|
|
@@ -3838,7 +3564,6 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest,
|
|
|
3838
3564
|
mapRouteProperties,
|
|
3839
3565
|
manifest,
|
|
3840
3566
|
request,
|
|
3841
|
-
getRoutePattern(matches.map((m) => m.route.path)),
|
|
3842
3567
|
match,
|
|
3843
3568
|
lazyRoutePropertiesToSkip,
|
|
3844
3569
|
scopedContext,
|
|
@@ -3859,7 +3584,6 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest,
|
|
|
3859
3584
|
mapRouteProperties,
|
|
3860
3585
|
manifest,
|
|
3861
3586
|
request,
|
|
3862
|
-
getRoutePattern(matches.map((m) => m.route.path)),
|
|
3863
3587
|
match,
|
|
3864
3588
|
lazyRoutePropertiesToSkip,
|
|
3865
3589
|
scopedContext,
|
|
@@ -4034,7 +3758,7 @@ function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRoutePrope
|
|
|
4034
3758
|
let newRoutes = convertRoutesToDataRoutes(
|
|
4035
3759
|
uniqueChildren,
|
|
4036
3760
|
mapRouteProperties,
|
|
4037
|
-
[routeId || "_", "patch", String(_optionalChain([childrenToPatch, 'optionalAccess',
|
|
3761
|
+
[routeId || "_", "patch", String(_optionalChain([childrenToPatch, 'optionalAccess', _30 => _30.length]) || "0")],
|
|
4038
3762
|
manifest
|
|
4039
3763
|
);
|
|
4040
3764
|
childrenToPatch.push(...newRoutes);
|
|
@@ -4071,7 +3795,7 @@ function isSameRoute(newRoute, existingRoute) {
|
|
|
4071
3795
|
return true;
|
|
4072
3796
|
}
|
|
4073
3797
|
return newRoute.children.every(
|
|
4074
|
-
(aChild, i) => _optionalChain([existingRoute, 'access',
|
|
3798
|
+
(aChild, i) => _optionalChain([existingRoute, 'access', _31 => _31.children, 'optionalAccess', _32 => _32.some, 'call', _33 => _33((bChild) => isSameRoute(aChild, bChild))])
|
|
4075
3799
|
);
|
|
4076
3800
|
}
|
|
4077
3801
|
var lazyRoutePropertyCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -4219,9 +3943,9 @@ function loadLazyRoute(route, type, manifest, mapRouteProperties, lazyRoutePrope
|
|
|
4219
3943
|
}
|
|
4220
3944
|
let lazyRoutePromise = lazyPropertyPromises.length > 0 ? Promise.all(lazyPropertyPromises).then(() => {
|
|
4221
3945
|
}) : void 0;
|
|
4222
|
-
_optionalChain([lazyRoutePromise, 'optionalAccess',
|
|
3946
|
+
_optionalChain([lazyRoutePromise, 'optionalAccess', _34 => _34.catch, 'call', _35 => _35(() => {
|
|
4223
3947
|
})]);
|
|
4224
|
-
_optionalChain([lazyHandlerPromise, 'optionalAccess',
|
|
3948
|
+
_optionalChain([lazyHandlerPromise, 'optionalAccess', _36 => _36.catch, 'call', _37 => _37(() => {
|
|
4225
3949
|
})]);
|
|
4226
3950
|
return {
|
|
4227
3951
|
lazyRoutePromise,
|
|
@@ -4318,12 +4042,7 @@ async function runMiddlewarePipeline(args, handler, processResult, isResult, err
|
|
|
4318
4042
|
(m) => m.route.middleware ? m.route.middleware.map((fn) => [m.route.id, fn]) : []
|
|
4319
4043
|
);
|
|
4320
4044
|
let result = await callRouteMiddleware(
|
|
4321
|
-
{
|
|
4322
|
-
request,
|
|
4323
|
-
params,
|
|
4324
|
-
context,
|
|
4325
|
-
pattern: getRoutePattern(matches.map((m) => m.route.path))
|
|
4326
|
-
},
|
|
4045
|
+
{ request, params, context },
|
|
4327
4046
|
tuples,
|
|
4328
4047
|
handler,
|
|
4329
4048
|
processResult,
|
|
@@ -4401,7 +4120,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request,
|
|
|
4401
4120
|
handler: lazyRoutePromises.lazyHandlerPromise
|
|
4402
4121
|
};
|
|
4403
4122
|
}
|
|
4404
|
-
function getDataStrategyMatch(mapRouteProperties, manifest, request,
|
|
4123
|
+
function getDataStrategyMatch(mapRouteProperties, manifest, request, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, unstable_shouldRevalidateArgs = null) {
|
|
4405
4124
|
let isUsingNewApi = false;
|
|
4406
4125
|
let _lazyPromises = getDataStrategyMatchLazyPromises(
|
|
4407
4126
|
mapRouteProperties,
|
|
@@ -4429,13 +4148,15 @@ function getDataStrategyMatch(mapRouteProperties, manifest, request, pattern, ma
|
|
|
4429
4148
|
return shouldRevalidateLoader(match, unstable_shouldRevalidateArgs);
|
|
4430
4149
|
},
|
|
4431
4150
|
resolve(handlerOverride) {
|
|
4432
|
-
|
|
4151
|
+
let { lazy, loader, middleware } = match.route;
|
|
4152
|
+
let callHandler = isUsingNewApi || shouldLoad || handlerOverride && !isMutationMethod(request.method) && (lazy || loader);
|
|
4153
|
+
let isMiddlewareOnlyRoute = middleware && middleware.length > 0 && !loader && !lazy;
|
|
4154
|
+
if (callHandler && !isMiddlewareOnlyRoute) {
|
|
4433
4155
|
return callLoaderOrAction({
|
|
4434
4156
|
request,
|
|
4435
|
-
pattern,
|
|
4436
4157
|
match,
|
|
4437
|
-
lazyHandlerPromise: _optionalChain([_lazyPromises, 'optionalAccess',
|
|
4438
|
-
lazyRoutePromise: _optionalChain([_lazyPromises, 'optionalAccess',
|
|
4158
|
+
lazyHandlerPromise: _optionalChain([_lazyPromises, 'optionalAccess', _38 => _38.handler]),
|
|
4159
|
+
lazyRoutePromise: _optionalChain([_lazyPromises, 'optionalAccess', _39 => _39.route]),
|
|
4439
4160
|
handlerOverride,
|
|
4440
4161
|
scopedContext
|
|
4441
4162
|
});
|
|
@@ -4466,7 +4187,6 @@ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, m
|
|
|
4466
4187
|
mapRouteProperties,
|
|
4467
4188
|
manifest,
|
|
4468
4189
|
request,
|
|
4469
|
-
getRoutePattern(matches.map((m) => m.route.path)),
|
|
4470
4190
|
match,
|
|
4471
4191
|
lazyRoutePropertiesToSkip,
|
|
4472
4192
|
scopedContext,
|
|
@@ -4476,12 +4196,11 @@ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, m
|
|
|
4476
4196
|
});
|
|
4477
4197
|
}
|
|
4478
4198
|
async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherKey, scopedContext, isStaticHandler) {
|
|
4479
|
-
if (matches.some((m) => _optionalChain([m, 'access',
|
|
4480
|
-
await Promise.all(matches.map((m) => _optionalChain([m, 'access',
|
|
4199
|
+
if (matches.some((m) => _optionalChain([m, 'access', _40 => _40._lazyPromises, 'optionalAccess', _41 => _41.middleware]))) {
|
|
4200
|
+
await Promise.all(matches.map((m) => _optionalChain([m, 'access', _42 => _42._lazyPromises, 'optionalAccess', _43 => _43.middleware])));
|
|
4481
4201
|
}
|
|
4482
4202
|
let dataStrategyArgs = {
|
|
4483
4203
|
request,
|
|
4484
|
-
pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
4485
4204
|
params: matches[0].params,
|
|
4486
4205
|
context: scopedContext,
|
|
4487
4206
|
matches
|
|
@@ -4512,8 +4231,8 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
4512
4231
|
try {
|
|
4513
4232
|
await Promise.all(
|
|
4514
4233
|
matches.flatMap((m) => [
|
|
4515
|
-
_optionalChain([m, 'access',
|
|
4516
|
-
_optionalChain([m, 'access',
|
|
4234
|
+
_optionalChain([m, 'access', _44 => _44._lazyPromises, 'optionalAccess', _45 => _45.handler]),
|
|
4235
|
+
_optionalChain([m, 'access', _46 => _46._lazyPromises, 'optionalAccess', _47 => _47.route])
|
|
4517
4236
|
])
|
|
4518
4237
|
);
|
|
4519
4238
|
} catch (e) {
|
|
@@ -4522,7 +4241,6 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
4522
4241
|
}
|
|
4523
4242
|
async function callLoaderOrAction({
|
|
4524
4243
|
request,
|
|
4525
|
-
pattern,
|
|
4526
4244
|
match,
|
|
4527
4245
|
lazyHandlerPromise,
|
|
4528
4246
|
lazyRoutePromise,
|
|
@@ -4549,7 +4267,6 @@ async function callLoaderOrAction({
|
|
|
4549
4267
|
return handler(
|
|
4550
4268
|
{
|
|
4551
4269
|
request,
|
|
4552
|
-
pattern,
|
|
4553
4270
|
params: match.params,
|
|
4554
4271
|
context: scopedContext
|
|
4555
4272
|
},
|
|
@@ -4658,19 +4375,19 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
|
4658
4375
|
return {
|
|
4659
4376
|
type: "error" /* error */,
|
|
4660
4377
|
error: result.data,
|
|
4661
|
-
statusCode: _optionalChain([result, 'access',
|
|
4662
|
-
headers: _optionalChain([result, 'access',
|
|
4378
|
+
statusCode: _optionalChain([result, 'access', _48 => _48.init, 'optionalAccess', _49 => _49.status]),
|
|
4379
|
+
headers: _optionalChain([result, 'access', _50 => _50.init, 'optionalAccess', _51 => _51.headers]) ? new Headers(result.init.headers) : void 0
|
|
4663
4380
|
};
|
|
4664
4381
|
}
|
|
4665
4382
|
return {
|
|
4666
4383
|
type: "error" /* error */,
|
|
4667
4384
|
error: new ErrorResponseImpl(
|
|
4668
|
-
_optionalChain([result, 'access',
|
|
4385
|
+
_optionalChain([result, 'access', _52 => _52.init, 'optionalAccess', _53 => _53.status]) || 500,
|
|
4669
4386
|
void 0,
|
|
4670
4387
|
result.data
|
|
4671
4388
|
),
|
|
4672
4389
|
statusCode: isRouteErrorResponse(result) ? result.status : void 0,
|
|
4673
|
-
headers: _optionalChain([result, 'access',
|
|
4390
|
+
headers: _optionalChain([result, 'access', _54 => _54.init, 'optionalAccess', _55 => _55.headers]) ? new Headers(result.init.headers) : void 0
|
|
4674
4391
|
};
|
|
4675
4392
|
}
|
|
4676
4393
|
return {
|
|
@@ -4683,8 +4400,8 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
|
4683
4400
|
return {
|
|
4684
4401
|
type: "data" /* data */,
|
|
4685
4402
|
data: result.data,
|
|
4686
|
-
statusCode: _optionalChain([result, 'access',
|
|
4687
|
-
headers: _optionalChain([result, 'access',
|
|
4403
|
+
statusCode: _optionalChain([result, 'access', _56 => _56.init, 'optionalAccess', _57 => _57.status]),
|
|
4404
|
+
headers: _optionalChain([result, 'access', _58 => _58.init, 'optionalAccess', _59 => _59.headers]) ? new Headers(result.init.headers) : void 0
|
|
4688
4405
|
};
|
|
4689
4406
|
}
|
|
4690
4407
|
return { type: "data" /* data */, data: result };
|
|
@@ -4833,7 +4550,7 @@ function processLoaderData(state, matches, results, pendingActionResult, revalid
|
|
|
4833
4550
|
let result = fetcherResults[key];
|
|
4834
4551
|
invariant(result, "Did not find corresponding fetcher result");
|
|
4835
4552
|
if (isErrorResult(result)) {
|
|
4836
|
-
let boundaryMatch = findNearestBoundary(state.matches, _optionalChain([match, 'optionalAccess',
|
|
4553
|
+
let boundaryMatch = findNearestBoundary(state.matches, _optionalChain([match, 'optionalAccess', _60 => _60.route, 'access', _61 => _61.id]));
|
|
4837
4554
|
if (!(errors && errors[boundaryMatch.route.id])) {
|
|
4838
4555
|
errors = {
|
|
4839
4556
|
...errors,
|
|
@@ -4967,8 +4684,8 @@ function dataWithResponseInitToResponse(data2) {
|
|
|
4967
4684
|
}
|
|
4968
4685
|
function dataWithResponseInitToErrorResponse(data2) {
|
|
4969
4686
|
return new ErrorResponseImpl(
|
|
4970
|
-
_nullishCoalesce(_optionalChain([data2, 'access',
|
|
4971
|
-
_nullishCoalesce(_optionalChain([data2, 'access',
|
|
4687
|
+
_nullishCoalesce(_optionalChain([data2, 'access', _62 => _62.init, 'optionalAccess', _63 => _63.status]), () => ( 500)),
|
|
4688
|
+
_nullishCoalesce(_optionalChain([data2, 'access', _64 => _64.init, 'optionalAccess', _65 => _65.statusText]), () => ( "Internal Server Error")),
|
|
4972
4689
|
data2.data
|
|
4973
4690
|
);
|
|
4974
4691
|
}
|
|
@@ -6000,7 +5717,7 @@ function getTurboStreamSingleFetchDataStrategy(getRouter, manifest, routeModules
|
|
|
6000
5717
|
return {
|
|
6001
5718
|
hasLoader: manifestRoute.hasLoader,
|
|
6002
5719
|
hasClientLoader: manifestRoute.hasClientLoader,
|
|
6003
|
-
hasShouldRevalidate: Boolean(_optionalChain([routeModule, 'optionalAccess',
|
|
5720
|
+
hasShouldRevalidate: Boolean(_optionalChain([routeModule, 'optionalAccess', _66 => _66.shouldRevalidate]))
|
|
6004
5721
|
};
|
|
6005
5722
|
},
|
|
6006
5723
|
fetchAndDecodeViaTurboStream,
|
|
@@ -6167,7 +5884,7 @@ async function bubbleMiddlewareErrors(singleFetchPromise, matches, routesParams,
|
|
|
6167
5884
|
let routeResult = fetchedData.routes[match.route.id];
|
|
6168
5885
|
if ("error" in routeResult) {
|
|
6169
5886
|
middlewareError = routeResult.error;
|
|
6170
|
-
if (_optionalChain([results, 'access',
|
|
5887
|
+
if (_optionalChain([results, 'access', _67 => _67[match.route.id], 'optionalAccess', _68 => _68.result]) == null) {
|
|
6171
5888
|
results[match.route.id] = {
|
|
6172
5889
|
type: "error",
|
|
6173
5890
|
result: middlewareError
|
|
@@ -6240,8 +5957,8 @@ async function fetchAndDecodeViaTurboStream(args, basename, targetRoutes) {
|
|
|
6240
5957
|
}
|
|
6241
5958
|
}
|
|
6242
5959
|
let res = await fetch(url, await createRequestInit(request));
|
|
6243
|
-
if (res.status
|
|
6244
|
-
throw new ErrorResponseImpl(
|
|
5960
|
+
if (res.status >= 400 && !res.headers.has("X-Remix-Response")) {
|
|
5961
|
+
throw new ErrorResponseImpl(res.status, res.statusText, await res.text());
|
|
6245
5962
|
}
|
|
6246
5963
|
if (res.status === 204 && res.headers.has("X-Remix-Redirect")) {
|
|
6247
5964
|
return {
|
|
@@ -6280,7 +5997,7 @@ async function fetchAndDecodeViaTurboStream(args, basename, targetRoutes) {
|
|
|
6280
5997
|
}
|
|
6281
5998
|
} else {
|
|
6282
5999
|
let typed = decoded.value;
|
|
6283
|
-
let routeId = _optionalChain([targetRoutes, 'optionalAccess',
|
|
6000
|
+
let routeId = _optionalChain([targetRoutes, 'optionalAccess', _69 => _69[0]]);
|
|
6284
6001
|
invariant2(routeId, "No routeId found for single fetch call decoding");
|
|
6285
6002
|
if ("redirect" in typed) {
|
|
6286
6003
|
data2 = { redirect: typed };
|
|
@@ -6592,7 +6309,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
6592
6309
|
if (locationArg) {
|
|
6593
6310
|
let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
|
6594
6311
|
invariant(
|
|
6595
|
-
parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access',
|
|
6312
|
+
parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access', _70 => _70.pathname, 'optionalAccess', _71 => _71.startsWith, 'call', _72 => _72(parentPathnameBase)]),
|
|
6596
6313
|
`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.`
|
|
6597
6314
|
);
|
|
6598
6315
|
location = parsedLocationArg;
|
|
@@ -6754,10 +6471,10 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, uns
|
|
|
6754
6471
|
}
|
|
6755
6472
|
}
|
|
6756
6473
|
let renderedMatches = matches;
|
|
6757
|
-
let errors = _optionalChain([dataRouterState, 'optionalAccess',
|
|
6474
|
+
let errors = _optionalChain([dataRouterState, 'optionalAccess', _73 => _73.errors]);
|
|
6758
6475
|
if (errors != null) {
|
|
6759
6476
|
let errorIndex = renderedMatches.findIndex(
|
|
6760
|
-
(m) => m.route.id && _optionalChain([errors, 'optionalAccess',
|
|
6477
|
+
(m) => m.route.id && _optionalChain([errors, 'optionalAccess', _74 => _74[m.route.id]]) !== void 0
|
|
6761
6478
|
);
|
|
6762
6479
|
invariant(
|
|
6763
6480
|
errorIndex >= 0,
|
|
@@ -6935,15 +6652,15 @@ function useRouteError() {
|
|
|
6935
6652
|
if (error !== void 0) {
|
|
6936
6653
|
return error;
|
|
6937
6654
|
}
|
|
6938
|
-
return _optionalChain([state, 'access',
|
|
6655
|
+
return _optionalChain([state, 'access', _75 => _75.errors, 'optionalAccess', _76 => _76[routeId]]);
|
|
6939
6656
|
}
|
|
6940
6657
|
function useAsyncValue() {
|
|
6941
6658
|
let value = React3.useContext(AwaitContext);
|
|
6942
|
-
return _optionalChain([value, 'optionalAccess',
|
|
6659
|
+
return _optionalChain([value, 'optionalAccess', _77 => _77._data]);
|
|
6943
6660
|
}
|
|
6944
6661
|
function useAsyncError() {
|
|
6945
6662
|
let value = React3.useContext(AwaitContext);
|
|
6946
|
-
return _optionalChain([value, 'optionalAccess',
|
|
6663
|
+
return _optionalChain([value, 'optionalAccess', _78 => _78._error]);
|
|
6947
6664
|
}
|
|
6948
6665
|
var blockerId = 0;
|
|
6949
6666
|
function useBlocker(shouldBlock) {
|
|
@@ -7013,6 +6730,15 @@ function warningOnce(key, cond, message) {
|
|
|
7013
6730
|
warning(false, message);
|
|
7014
6731
|
}
|
|
7015
6732
|
}
|
|
6733
|
+
function useRoute(routeId) {
|
|
6734
|
+
const state = useDataRouterState("useRouteLoaderData" /* UseRouteLoaderData */);
|
|
6735
|
+
const route = state.matches.find(({ route: route2 }) => route2.id === routeId);
|
|
6736
|
+
if (route === void 0) return void 0;
|
|
6737
|
+
return {
|
|
6738
|
+
loaderData: state.loaderData[routeId],
|
|
6739
|
+
actionData: _optionalChain([state, 'access', _79 => _79.actionData, 'optionalAccess', _80 => _80[routeId]])
|
|
6740
|
+
};
|
|
6741
|
+
}
|
|
7016
6742
|
|
|
7017
6743
|
// lib/dom/ssr/errorBoundaries.tsx
|
|
7018
6744
|
|
|
@@ -7055,7 +6781,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
|
|
|
7055
6781
|
let route = manifest.routes[match.route.id];
|
|
7056
6782
|
return [
|
|
7057
6783
|
route && route.css ? route.css.map((href) => ({ rel: "stylesheet", href })) : [],
|
|
7058
|
-
_optionalChain([module, 'optionalAccess',
|
|
6784
|
+
_optionalChain([module, 'optionalAccess', _81 => _81.links, 'optionalCall', _82 => _82()]) || []
|
|
7059
6785
|
];
|
|
7060
6786
|
}).flat(2);
|
|
7061
6787
|
let preloads = getModuleLinkHrefs(matches, manifest);
|
|
@@ -7156,7 +6882,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
|
|
|
7156
6882
|
// param change, /users/123 -> /users/456
|
|
7157
6883
|
currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
|
|
7158
6884
|
// e.g. /files/images/avatar.jpg -> files/finances.xls
|
|
7159
|
-
_optionalChain([currentMatches, 'access',
|
|
6885
|
+
_optionalChain([currentMatches, 'access', _83 => _83[index], 'access', _84 => _84.route, 'access', _85 => _85.path, 'optionalAccess', _86 => _86.endsWith, 'call', _87 => _87("*")]) && currentMatches[index].params["*"] !== match.params["*"]
|
|
7160
6886
|
);
|
|
7161
6887
|
};
|
|
7162
6888
|
if (mode === "assets") {
|
|
@@ -7179,7 +6905,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
|
|
|
7179
6905
|
location.pathname + location.search + location.hash,
|
|
7180
6906
|
window.origin
|
|
7181
6907
|
),
|
|
7182
|
-
currentParams: _optionalChain([currentMatches, 'access',
|
|
6908
|
+
currentParams: _optionalChain([currentMatches, 'access', _88 => _88[0], 'optionalAccess', _89 => _89.params]) || {},
|
|
7183
6909
|
nextUrl: new URL(page, window.origin),
|
|
7184
6910
|
nextParams: match.params,
|
|
7185
6911
|
defaultShouldRevalidate: true
|
|
@@ -7451,11 +7177,11 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
7451
7177
|
)
|
|
7452
7178
|
});
|
|
7453
7179
|
let hasInitialData = initialState && initialState.loaderData && route.id in initialState.loaderData;
|
|
7454
|
-
let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess',
|
|
7180
|
+
let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess', _90 => _90.loaderData, 'optionalAccess', _91 => _91[route.id]]) : void 0;
|
|
7455
7181
|
let hasInitialError = initialState && initialState.errors && route.id in initialState.errors;
|
|
7456
|
-
let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess',
|
|
7457
|
-
let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access',
|
|
7458
|
-
dataRoute.loader = async ({ request, params, context
|
|
7182
|
+
let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess', _92 => _92.errors, 'optionalAccess', _93 => _93[route.id]]) : void 0;
|
|
7183
|
+
let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access', _94 => _94.clientLoader, 'optionalAccess', _95 => _95.hydrate]) === true || !route.hasLoader);
|
|
7184
|
+
dataRoute.loader = async ({ request, params, context }, singleFetch) => {
|
|
7459
7185
|
try {
|
|
7460
7186
|
let result = await prefetchStylesAndCallHandler(async () => {
|
|
7461
7187
|
invariant2(
|
|
@@ -7469,7 +7195,6 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
7469
7195
|
request,
|
|
7470
7196
|
params,
|
|
7471
7197
|
context,
|
|
7472
|
-
pattern,
|
|
7473
7198
|
async serverLoader() {
|
|
7474
7199
|
preventInvalidServerHandlerCall("loader", route);
|
|
7475
7200
|
if (isHydrationRequest) {
|
|
@@ -7495,7 +7220,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
7495
7220
|
route.hasLoader,
|
|
7496
7221
|
isSpaMode
|
|
7497
7222
|
);
|
|
7498
|
-
dataRoute.action = ({ request, params, context
|
|
7223
|
+
dataRoute.action = ({ request, params, context }, singleFetch) => {
|
|
7499
7224
|
return prefetchStylesAndCallHandler(async () => {
|
|
7500
7225
|
invariant2(
|
|
7501
7226
|
routeModule,
|
|
@@ -7511,7 +7236,6 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
7511
7236
|
request,
|
|
7512
7237
|
params,
|
|
7513
7238
|
context,
|
|
7514
|
-
pattern,
|
|
7515
7239
|
async serverAction() {
|
|
7516
7240
|
preventInvalidServerHandlerCall("action", route);
|
|
7517
7241
|
return fetchServerAction(singleFetch);
|
|
@@ -7750,7 +7474,7 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDi
|
|
|
7750
7474
|
function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
|
|
7751
7475
|
React6.useEffect(() => {
|
|
7752
7476
|
if (!isFogOfWarEnabled(routeDiscovery, ssr) || // @ts-expect-error - TS doesn't know about this yet
|
|
7753
|
-
_optionalChain([window, 'access',
|
|
7477
|
+
_optionalChain([window, 'access', _96 => _96.navigator, 'optionalAccess', _97 => _97.connection, 'optionalAccess', _98 => _98.saveData]) === true) {
|
|
7754
7478
|
return;
|
|
7755
7479
|
}
|
|
7756
7480
|
function registerElement(el) {
|
|
@@ -7859,7 +7583,7 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
|
|
|
7859
7583
|
}
|
|
7860
7584
|
serverPatches = await res.json();
|
|
7861
7585
|
} catch (e) {
|
|
7862
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
7586
|
+
if (_optionalChain([signal, 'optionalAccess', _99 => _99.aborted])) return;
|
|
7863
7587
|
throw e;
|
|
7864
7588
|
}
|
|
7865
7589
|
let knownRoutes = new Set(Object.keys(manifest.routes));
|
|
@@ -8100,7 +7824,7 @@ function PrefetchPageLinksImpl({
|
|
|
8100
7824
|
if (!manifestRoute || !manifestRoute.hasLoader) {
|
|
8101
7825
|
return;
|
|
8102
7826
|
}
|
|
8103
|
-
if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access',
|
|
7827
|
+
if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access', _100 => _100[m.route.id], 'optionalAccess', _101 => _101.shouldRevalidate])) {
|
|
8104
7828
|
foundOptOutRoute = true;
|
|
8105
7829
|
} else if (manifestRoute.hasClientLoader) {
|
|
8106
7830
|
foundOptOutRoute = true;
|
|
@@ -8174,7 +7898,7 @@ function Meta() {
|
|
|
8174
7898
|
error
|
|
8175
7899
|
};
|
|
8176
7900
|
matches[i] = match;
|
|
8177
|
-
if (_optionalChain([routeModule, 'optionalAccess',
|
|
7901
|
+
if (_optionalChain([routeModule, 'optionalAccess', _102 => _102.meta])) {
|
|
8178
7902
|
routeMeta = typeof routeModule.meta === "function" ? routeModule.meta({
|
|
8179
7903
|
data: data2,
|
|
8180
7904
|
loaderData: data2,
|
|
@@ -8273,7 +7997,7 @@ function Scripts(scriptProps) {
|
|
|
8273
7997
|
}
|
|
8274
7998
|
let streamScript = "window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());";
|
|
8275
7999
|
let contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};${streamScript}` : " ";
|
|
8276
|
-
let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access',
|
|
8000
|
+
let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access', _103 => _103.hmr, 'optionalAccess', _104 => _104.runtime]) ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
|
|
8277
8001
|
${matches.map((match, routeIndex) => {
|
|
8278
8002
|
let routeVarName = `route${routeIndex}`;
|
|
8279
8003
|
let manifestEntry = manifest.routes[match.route.id];
|
|
@@ -8503,7 +8227,7 @@ function BoundaryShell({
|
|
|
8503
8227
|
children
|
|
8504
8228
|
}) {
|
|
8505
8229
|
let { routeModules } = useFrameworkContext();
|
|
8506
|
-
if (_optionalChain([routeModules, 'access',
|
|
8230
|
+
if (_optionalChain([routeModules, 'access', _105 => _105.root, 'optionalAccess', _106 => _106.Layout]) && !isOutsideRemixApp) {
|
|
8507
8231
|
return children;
|
|
8508
8232
|
}
|
|
8509
8233
|
return /* @__PURE__ */ React8.createElement("html", { lang: "en" }, /* @__PURE__ */ React8.createElement("head", null, /* @__PURE__ */ React8.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ React8.createElement(
|
|
@@ -8619,4 +8343,4 @@ function BoundaryShell({
|
|
|
8619
8343
|
|
|
8620
8344
|
|
|
8621
8345
|
|
|
8622
|
-
exports.Action = Action; exports.createMemoryHistory = createMemoryHistory; exports.createBrowserHistory = createBrowserHistory; exports.createHashHistory = createHashHistory; exports.invariant = invariant; exports.warning = warning; exports.createPath = createPath; exports.parsePath = parsePath; exports.createContext = createContext; exports.RouterContextProvider = RouterContextProvider; exports.convertRoutesToDataRoutes = convertRoutesToDataRoutes; exports.matchRoutes = matchRoutes; exports.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.escapeHtml = escapeHtml; exports.encode = encode; exports.
|
|
8346
|
+
exports.Action = Action; exports.createMemoryHistory = createMemoryHistory; exports.createBrowserHistory = createBrowserHistory; exports.createHashHistory = createHashHistory; exports.invariant = invariant; exports.warning = warning; exports.createPath = createPath; exports.parsePath = parsePath; exports.createContext = createContext; exports.RouterContextProvider = RouterContextProvider; exports.convertRoutesToDataRoutes = convertRoutesToDataRoutes; exports.matchRoutes = matchRoutes; exports.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.escapeHtml = escapeHtml; exports.encode = encode; exports.IDLE_NAVIGATION = IDLE_NAVIGATION; exports.IDLE_FETCHER = IDLE_FETCHER; exports.IDLE_BLOCKER = IDLE_BLOCKER; exports.createRouter = createRouter; exports.createStaticHandler = createStaticHandler; exports.getStaticContextFromError = getStaticContextFromError; exports.isDataWithResponseInit = isDataWithResponseInit; exports.isResponse = isResponse; exports.isRedirectStatusCode = isRedirectStatusCode; exports.isRedirectResponse = isRedirectResponse; exports.isMutationMethod = isMutationMethod; exports.createRequestInit = createRequestInit; exports.SingleFetchRedirectSymbol = SingleFetchRedirectSymbol; exports.SINGLE_FETCH_REDIRECT_STATUS = SINGLE_FETCH_REDIRECT_STATUS; exports.NO_BODY_STATUS_CODES = NO_BODY_STATUS_CODES; exports.StreamTransfer = StreamTransfer; exports.getTurboStreamSingleFetchDataStrategy = getTurboStreamSingleFetchDataStrategy; exports.getSingleFetchDataStrategyImpl = getSingleFetchDataStrategyImpl; exports.stripIndexParam = stripIndexParam; exports.singleFetchUrl = singleFetchUrl; exports.decodeViaTurboStream = decodeViaTurboStream; exports.DataRouterContext = DataRouterContext; exports.DataRouterStateContext = DataRouterStateContext; exports.RSCRouterContext = RSCRouterContext; exports.ViewTransitionContext = ViewTransitionContext; exports.FetchersContext = FetchersContext; exports.AwaitContext = AwaitContext; exports.AwaitContextProvider = AwaitContextProvider; exports.NavigationContext = NavigationContext; exports.LocationContext = LocationContext; exports.RouteContext = RouteContext; exports.ENABLE_DEV_WARNINGS = ENABLE_DEV_WARNINGS; exports.warnOnce = warnOnce; exports.useHref = useHref; exports.useInRouterContext = useInRouterContext; exports.useLocation = useLocation; exports.useNavigationType = useNavigationType; exports.useMatch = useMatch; exports.useNavigate = useNavigate; exports.useOutletContext = useOutletContext; exports.useOutlet = useOutlet; exports.useParams = useParams; exports.useResolvedPath = useResolvedPath; exports.useRoutes = useRoutes; exports.useRoutesImpl = useRoutesImpl; exports._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.useRoute = useRoute; exports.RemixErrorBoundary = RemixErrorBoundary; exports.createServerRoutes = createServerRoutes; exports.createClientRoutesWithHMRRevalidationOptOut = createClientRoutesWithHMRRevalidationOptOut; exports.noActionDefinedError = noActionDefinedError; exports.createClientRoutes = createClientRoutes; exports.shouldHydrateRouteLoader = shouldHydrateRouteLoader; exports.getPatchRoutesOnNavigationFunction = getPatchRoutesOnNavigationFunction; exports.useFogOFWarDiscovery = useFogOFWarDiscovery; exports.getManifestPath = getManifestPath; exports.FrameworkContext = FrameworkContext; exports.usePrefetchBehavior = usePrefetchBehavior; exports.CRITICAL_CSS_DATA_ATTRIBUTE = CRITICAL_CSS_DATA_ATTRIBUTE; exports.Links = Links; exports.PrefetchPageLinks = PrefetchPageLinks; exports.Meta = Meta; exports.setIsHydrated = setIsHydrated; exports.Scripts = Scripts; exports.mergeRefs = mergeRefs;
|