react-router 0.0.0-experimental-e613d4238 → 0.0.0-experimental-4e44d47
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/dist/development/{chunk-YJ6T7YSE.js → chunk-7B7CUJYE.js} +345 -66
- package/dist/development/{chunk-XXC4LMW2.js → chunk-MTLWRICG.js} +164 -161
- package/dist/development/{chunk-2YVPYFDJ.mjs → chunk-PSQFTIPQ.mjs} +67 -51
- package/dist/development/{chunk-5P3HEZQU.mjs → chunk-XVVWTPHF.mjs} +307 -25
- package/dist/development/dom-export.d.mts +59 -4
- package/dist/development/dom-export.d.ts +59 -3
- package/dist/development/dom-export.js +8 -5
- package/dist/development/dom-export.mjs +8 -5
- package/dist/development/{index-react-server-client-DKvU8YRr.d.ts → index-react-server-client-83aVZHgI.d.ts} +198 -134
- package/dist/{production/index-react-server-client-2EDmGlsZ.d.mts → development/index-react-server-client-BDG19ZQl.d.mts} +140 -77
- package/dist/development/index-react-server-client.d.mts +3 -3
- package/dist/development/index-react-server-client.d.ts +3 -2
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.d.mts +106 -1
- package/dist/development/index-react-server.d.ts +106 -1
- package/dist/development/index-react-server.js +181 -8
- package/dist/development/index-react-server.mjs +181 -8
- package/dist/development/index.d.mts +13 -18
- package/dist/development/index.d.ts +13 -16
- package/dist/development/index.js +161 -147
- package/dist/development/index.mjs +3 -5
- package/dist/development/instrumentation-XYmrzhe3.d.ts +1138 -0
- package/dist/development/lib/types/internal.d.mts +3 -3
- package/dist/development/lib/types/internal.d.ts +3 -2
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{register-BrVEYTED.d.mts → register-DiOIlEq5.d.mts} +1 -7
- package/dist/{production/register-BrVEYTED.d.mts → development/register-DiOIlEq5.d.ts} +1 -7
- package/dist/development/{routeModules-BmVo7q9e.d.ts → routeModules-Bu1JamQV.d.ts} +73 -1046
- package/dist/development/{route-data-CDwqkzPE.d.mts → routeModules-CtCOLGtG.d.mts} +157 -147
- package/dist/development/{context-BqL5Eckq.d.mts → router-2BoB34m1.d.mts} +1403 -1250
- package/dist/production/{chunk-VNGQS422.mjs → chunk-GSSVRQ6M.mjs} +307 -25
- package/dist/production/{chunk-5MHETEIL.mjs → chunk-IZVJSKMU.mjs} +67 -51
- package/dist/production/{chunk-QBUHFRYZ.js → chunk-OXRQQZPR.js} +345 -66
- package/dist/production/{chunk-E4G6PZCJ.js → chunk-UNIYMJFU.js} +164 -161
- package/dist/production/dom-export.d.mts +59 -4
- package/dist/production/dom-export.d.ts +59 -3
- package/dist/production/dom-export.js +8 -5
- package/dist/production/dom-export.mjs +8 -5
- package/dist/{development/index-react-server-client-2EDmGlsZ.d.mts → production/index-react-server-client-83aVZHgI.d.ts} +140 -77
- package/dist/production/{index-react-server-client-DKvU8YRr.d.ts → index-react-server-client-BDG19ZQl.d.mts} +198 -134
- package/dist/production/index-react-server-client.d.mts +3 -3
- package/dist/production/index-react-server-client.d.ts +3 -2
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.d.mts +106 -1
- package/dist/production/index-react-server.d.ts +106 -1
- package/dist/production/index-react-server.js +181 -8
- package/dist/production/index-react-server.mjs +181 -8
- package/dist/production/index.d.mts +13 -18
- package/dist/production/index.d.ts +13 -16
- package/dist/production/index.js +161 -147
- package/dist/production/index.mjs +3 -5
- package/dist/production/instrumentation-XYmrzhe3.d.ts +1138 -0
- package/dist/production/lib/types/internal.d.mts +3 -3
- package/dist/production/lib/types/internal.d.ts +3 -2
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/{development/register-D8NQoPsO.d.ts → production/register-DiOIlEq5.d.mts} +1 -7
- package/dist/production/{register-D8NQoPsO.d.ts → register-DiOIlEq5.d.ts} +1 -7
- package/dist/production/{routeModules-BmVo7q9e.d.ts → routeModules-Bu1JamQV.d.ts} +73 -1046
- package/dist/production/{route-data-CDwqkzPE.d.mts → routeModules-CtCOLGtG.d.mts} +157 -147
- package/dist/production/{context-BqL5Eckq.d.mts → router-2BoB34m1.d.mts} +1403 -1250
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-4e44d47
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -454,19 +454,23 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath = [],
|
|
|
454
454
|
if (isIndexRoute(route)) {
|
|
455
455
|
let indexRoute = {
|
|
456
456
|
...route,
|
|
457
|
-
...mapRouteProperties(route),
|
|
458
457
|
id
|
|
459
458
|
};
|
|
460
|
-
manifest[id] =
|
|
459
|
+
manifest[id] = mergeRouteUpdates(
|
|
460
|
+
indexRoute,
|
|
461
|
+
mapRouteProperties(indexRoute)
|
|
462
|
+
);
|
|
461
463
|
return indexRoute;
|
|
462
464
|
} else {
|
|
463
465
|
let pathOrLayoutRoute = {
|
|
464
466
|
...route,
|
|
465
|
-
...mapRouteProperties(route),
|
|
466
467
|
id,
|
|
467
468
|
children: void 0
|
|
468
469
|
};
|
|
469
|
-
manifest[id] =
|
|
470
|
+
manifest[id] = mergeRouteUpdates(
|
|
471
|
+
pathOrLayoutRoute,
|
|
472
|
+
mapRouteProperties(pathOrLayoutRoute)
|
|
473
|
+
);
|
|
470
474
|
if (route.children) {
|
|
471
475
|
pathOrLayoutRoute.children = convertRoutesToDataRoutes(
|
|
472
476
|
route.children,
|
|
@@ -480,6 +484,17 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath = [],
|
|
|
480
484
|
}
|
|
481
485
|
});
|
|
482
486
|
}
|
|
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
|
+
}
|
|
483
498
|
function matchRoutes(routes, locationArg, basename = "/") {
|
|
484
499
|
return matchRoutesImpl(routes, locationArg, basename, false);
|
|
485
500
|
}
|
|
@@ -935,6 +950,229 @@ var ErrorResponseImpl = class {
|
|
|
935
950
|
function isRouteErrorResponse(error) {
|
|
936
951
|
return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
|
|
937
952
|
}
|
|
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
|
+
}
|
|
938
1176
|
|
|
939
1177
|
// lib/router/router.ts
|
|
940
1178
|
var validMutationMethodsArr = [
|
|
@@ -994,7 +1232,20 @@ function createRouter(init) {
|
|
|
994
1232
|
"You must provide a non-empty routes array to createRouter"
|
|
995
1233
|
);
|
|
996
1234
|
let hydrationRouteProperties = init.hydrationRouteProperties || [];
|
|
997
|
-
let
|
|
1235
|
+
let _mapRouteProperties = init.mapRouteProperties || defaultMapRouteProperties;
|
|
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
|
+
}
|
|
998
1249
|
let manifest = {};
|
|
999
1250
|
let dataRoutes = convertRoutesToDataRoutes(
|
|
1000
1251
|
init.routes,
|
|
@@ -2746,6 +2997,12 @@ function createRouter(init) {
|
|
|
2746
2997
|
updateState(newState);
|
|
2747
2998
|
}
|
|
2748
2999
|
};
|
|
3000
|
+
if (init.unstable_instrumentations) {
|
|
3001
|
+
router = instrumentClientSideRouter(
|
|
3002
|
+
router,
|
|
3003
|
+
init.unstable_instrumentations.map((i) => i.router).filter(Boolean)
|
|
3004
|
+
);
|
|
3005
|
+
}
|
|
2749
3006
|
return router;
|
|
2750
3007
|
}
|
|
2751
3008
|
function createStaticHandler(routes, opts) {
|
|
@@ -2755,7 +3012,20 @@ function createStaticHandler(routes, opts) {
|
|
|
2755
3012
|
);
|
|
2756
3013
|
let manifest = {};
|
|
2757
3014
|
let basename = (opts ? opts.basename : null) || "/";
|
|
2758
|
-
let
|
|
3015
|
+
let _mapRouteProperties = _optionalChain([opts, 'optionalAccess', _16 => _16.mapRouteProperties]) || defaultMapRouteProperties;
|
|
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
|
+
}
|
|
2759
3029
|
let dataRoutes = convertRoutesToDataRoutes(
|
|
2760
3030
|
routes,
|
|
2761
3031
|
mapRouteProperties,
|
|
@@ -2825,6 +3095,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2825
3095
|
let response = await runServerMiddlewarePipeline(
|
|
2826
3096
|
{
|
|
2827
3097
|
request,
|
|
3098
|
+
pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
2828
3099
|
matches,
|
|
2829
3100
|
params: matches[0].params,
|
|
2830
3101
|
// If we're calling middleware then it must be enabled so we can cast
|
|
@@ -2888,9 +3159,9 @@ function createStaticHandler(routes, opts) {
|
|
|
2888
3159
|
} else {
|
|
2889
3160
|
let boundaryRouteId = skipLoaderErrorBubbling ? routeId : findNearestBoundary(
|
|
2890
3161
|
matches,
|
|
2891
|
-
_optionalChain([matches, 'access',
|
|
3162
|
+
_optionalChain([matches, 'access', _18 => _18.find, 'call', _19 => _19(
|
|
2892
3163
|
(m) => m.route.id === routeId || m.route.loader
|
|
2893
|
-
), 'optionalAccess',
|
|
3164
|
+
), 'optionalAccess', _20 => _20.route, 'access', _21 => _21.id]) || routeId
|
|
2894
3165
|
).route.id;
|
|
2895
3166
|
let staticContext = {
|
|
2896
3167
|
matches,
|
|
@@ -2970,6 +3241,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2970
3241
|
let response = await runServerMiddlewarePipeline(
|
|
2971
3242
|
{
|
|
2972
3243
|
request,
|
|
3244
|
+
pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
2973
3245
|
matches,
|
|
2974
3246
|
params: matches[0].params,
|
|
2975
3247
|
// If we're calling middleware then it must be enabled so we can cast
|
|
@@ -3222,11 +3494,11 @@ function createStaticHandler(routes, opts) {
|
|
|
3222
3494
|
}
|
|
3223
3495
|
async function loadRouteData(request, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad, pendingActionResult) {
|
|
3224
3496
|
let isRouteRequest = routeMatch != null;
|
|
3225
|
-
if (isRouteRequest && !_optionalChain([routeMatch, 'optionalAccess',
|
|
3497
|
+
if (isRouteRequest && !_optionalChain([routeMatch, 'optionalAccess', _22 => _22.route, 'access', _23 => _23.loader]) && !_optionalChain([routeMatch, 'optionalAccess', _24 => _24.route, 'access', _25 => _25.lazy])) {
|
|
3226
3498
|
throw getInternalRouterError(400, {
|
|
3227
3499
|
method: request.method,
|
|
3228
3500
|
pathname: new URL(request.url).pathname,
|
|
3229
|
-
routeId: _optionalChain([routeMatch, 'optionalAccess',
|
|
3501
|
+
routeId: _optionalChain([routeMatch, 'optionalAccess', _26 => _26.route, 'access', _27 => _27.id])
|
|
3230
3502
|
});
|
|
3231
3503
|
}
|
|
3232
3504
|
let dsMatches;
|
|
@@ -3251,6 +3523,7 @@ function createStaticHandler(routes, opts) {
|
|
|
3251
3523
|
mapRouteProperties,
|
|
3252
3524
|
manifest,
|
|
3253
3525
|
request,
|
|
3526
|
+
getRoutePattern(matches.map((m) => m.route.path)),
|
|
3254
3527
|
match,
|
|
3255
3528
|
[],
|
|
3256
3529
|
requestContext,
|
|
@@ -3261,6 +3534,7 @@ function createStaticHandler(routes, opts) {
|
|
|
3261
3534
|
mapRouteProperties,
|
|
3262
3535
|
manifest,
|
|
3263
3536
|
request,
|
|
3537
|
+
getRoutePattern(matches.map((m) => m.route.path)),
|
|
3264
3538
|
match,
|
|
3265
3539
|
[],
|
|
3266
3540
|
requestContext,
|
|
@@ -3534,7 +3808,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest,
|
|
|
3534
3808
|
let shouldSkipRevalidation = actionStatus && actionStatus >= 400;
|
|
3535
3809
|
let baseShouldRevalidateArgs = {
|
|
3536
3810
|
currentUrl,
|
|
3537
|
-
currentParams: _optionalChain([state, 'access',
|
|
3811
|
+
currentParams: _optionalChain([state, 'access', _28 => _28.matches, 'access', _29 => _29[0], 'optionalAccess', _30 => _30.params]) || {},
|
|
3538
3812
|
nextUrl,
|
|
3539
3813
|
nextParams: matches[0].params,
|
|
3540
3814
|
...submission,
|
|
@@ -3564,6 +3838,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest,
|
|
|
3564
3838
|
mapRouteProperties,
|
|
3565
3839
|
manifest,
|
|
3566
3840
|
request,
|
|
3841
|
+
getRoutePattern(matches.map((m) => m.route.path)),
|
|
3567
3842
|
match,
|
|
3568
3843
|
lazyRoutePropertiesToSkip,
|
|
3569
3844
|
scopedContext,
|
|
@@ -3584,6 +3859,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest,
|
|
|
3584
3859
|
mapRouteProperties,
|
|
3585
3860
|
manifest,
|
|
3586
3861
|
request,
|
|
3862
|
+
getRoutePattern(matches.map((m) => m.route.path)),
|
|
3587
3863
|
match,
|
|
3588
3864
|
lazyRoutePropertiesToSkip,
|
|
3589
3865
|
scopedContext,
|
|
@@ -3758,7 +4034,7 @@ function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRoutePrope
|
|
|
3758
4034
|
let newRoutes = convertRoutesToDataRoutes(
|
|
3759
4035
|
uniqueChildren,
|
|
3760
4036
|
mapRouteProperties,
|
|
3761
|
-
[routeId || "_", "patch", String(_optionalChain([childrenToPatch, 'optionalAccess',
|
|
4037
|
+
[routeId || "_", "patch", String(_optionalChain([childrenToPatch, 'optionalAccess', _31 => _31.length]) || "0")],
|
|
3762
4038
|
manifest
|
|
3763
4039
|
);
|
|
3764
4040
|
childrenToPatch.push(...newRoutes);
|
|
@@ -3795,7 +4071,7 @@ function isSameRoute(newRoute, existingRoute) {
|
|
|
3795
4071
|
return true;
|
|
3796
4072
|
}
|
|
3797
4073
|
return newRoute.children.every(
|
|
3798
|
-
(aChild, i) => _optionalChain([existingRoute, 'access',
|
|
4074
|
+
(aChild, i) => _optionalChain([existingRoute, 'access', _32 => _32.children, 'optionalAccess', _33 => _33.some, 'call', _34 => _34((bChild) => isSameRoute(aChild, bChild))])
|
|
3799
4075
|
);
|
|
3800
4076
|
}
|
|
3801
4077
|
var lazyRoutePropertyCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -3943,9 +4219,9 @@ function loadLazyRoute(route, type, manifest, mapRouteProperties, lazyRoutePrope
|
|
|
3943
4219
|
}
|
|
3944
4220
|
let lazyRoutePromise = lazyPropertyPromises.length > 0 ? Promise.all(lazyPropertyPromises).then(() => {
|
|
3945
4221
|
}) : void 0;
|
|
3946
|
-
_optionalChain([lazyRoutePromise, 'optionalAccess',
|
|
4222
|
+
_optionalChain([lazyRoutePromise, 'optionalAccess', _35 => _35.catch, 'call', _36 => _36(() => {
|
|
3947
4223
|
})]);
|
|
3948
|
-
_optionalChain([lazyHandlerPromise, 'optionalAccess',
|
|
4224
|
+
_optionalChain([lazyHandlerPromise, 'optionalAccess', _37 => _37.catch, 'call', _38 => _38(() => {
|
|
3949
4225
|
})]);
|
|
3950
4226
|
return {
|
|
3951
4227
|
lazyRoutePromise,
|
|
@@ -4042,7 +4318,12 @@ async function runMiddlewarePipeline(args, handler, processResult, isResult, err
|
|
|
4042
4318
|
(m) => m.route.middleware ? m.route.middleware.map((fn) => [m.route.id, fn]) : []
|
|
4043
4319
|
);
|
|
4044
4320
|
let result = await callRouteMiddleware(
|
|
4045
|
-
{
|
|
4321
|
+
{
|
|
4322
|
+
request,
|
|
4323
|
+
params,
|
|
4324
|
+
context,
|
|
4325
|
+
pattern: getRoutePattern(matches.map((m) => m.route.path))
|
|
4326
|
+
},
|
|
4046
4327
|
tuples,
|
|
4047
4328
|
handler,
|
|
4048
4329
|
processResult,
|
|
@@ -4120,7 +4401,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request,
|
|
|
4120
4401
|
handler: lazyRoutePromises.lazyHandlerPromise
|
|
4121
4402
|
};
|
|
4122
4403
|
}
|
|
4123
|
-
function getDataStrategyMatch(mapRouteProperties, manifest, request, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, unstable_shouldRevalidateArgs = null) {
|
|
4404
|
+
function getDataStrategyMatch(mapRouteProperties, manifest, request, pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, unstable_shouldRevalidateArgs = null) {
|
|
4124
4405
|
let isUsingNewApi = false;
|
|
4125
4406
|
let _lazyPromises = getDataStrategyMatchLazyPromises(
|
|
4126
4407
|
mapRouteProperties,
|
|
@@ -4154,9 +4435,10 @@ function getDataStrategyMatch(mapRouteProperties, manifest, request, match, lazy
|
|
|
4154
4435
|
if (callHandler && !isMiddlewareOnlyRoute) {
|
|
4155
4436
|
return callLoaderOrAction({
|
|
4156
4437
|
request,
|
|
4438
|
+
pattern,
|
|
4157
4439
|
match,
|
|
4158
|
-
lazyHandlerPromise: _optionalChain([_lazyPromises, 'optionalAccess',
|
|
4159
|
-
lazyRoutePromise: _optionalChain([_lazyPromises, 'optionalAccess',
|
|
4440
|
+
lazyHandlerPromise: _optionalChain([_lazyPromises, 'optionalAccess', _39 => _39.handler]),
|
|
4441
|
+
lazyRoutePromise: _optionalChain([_lazyPromises, 'optionalAccess', _40 => _40.route]),
|
|
4160
4442
|
handlerOverride,
|
|
4161
4443
|
scopedContext
|
|
4162
4444
|
});
|
|
@@ -4187,6 +4469,7 @@ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, m
|
|
|
4187
4469
|
mapRouteProperties,
|
|
4188
4470
|
manifest,
|
|
4189
4471
|
request,
|
|
4472
|
+
getRoutePattern(matches.map((m) => m.route.path)),
|
|
4190
4473
|
match,
|
|
4191
4474
|
lazyRoutePropertiesToSkip,
|
|
4192
4475
|
scopedContext,
|
|
@@ -4196,11 +4479,12 @@ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, m
|
|
|
4196
4479
|
});
|
|
4197
4480
|
}
|
|
4198
4481
|
async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherKey, scopedContext, isStaticHandler) {
|
|
4199
|
-
if (matches.some((m) => _optionalChain([m, 'access',
|
|
4200
|
-
await Promise.all(matches.map((m) => _optionalChain([m, 'access',
|
|
4482
|
+
if (matches.some((m) => _optionalChain([m, 'access', _41 => _41._lazyPromises, 'optionalAccess', _42 => _42.middleware]))) {
|
|
4483
|
+
await Promise.all(matches.map((m) => _optionalChain([m, 'access', _43 => _43._lazyPromises, 'optionalAccess', _44 => _44.middleware])));
|
|
4201
4484
|
}
|
|
4202
4485
|
let dataStrategyArgs = {
|
|
4203
4486
|
request,
|
|
4487
|
+
pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
4204
4488
|
params: matches[0].params,
|
|
4205
4489
|
context: scopedContext,
|
|
4206
4490
|
matches
|
|
@@ -4231,8 +4515,8 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
4231
4515
|
try {
|
|
4232
4516
|
await Promise.all(
|
|
4233
4517
|
matches.flatMap((m) => [
|
|
4234
|
-
_optionalChain([m, 'access',
|
|
4235
|
-
_optionalChain([m, 'access',
|
|
4518
|
+
_optionalChain([m, 'access', _45 => _45._lazyPromises, 'optionalAccess', _46 => _46.handler]),
|
|
4519
|
+
_optionalChain([m, 'access', _47 => _47._lazyPromises, 'optionalAccess', _48 => _48.route])
|
|
4236
4520
|
])
|
|
4237
4521
|
);
|
|
4238
4522
|
} catch (e) {
|
|
@@ -4241,6 +4525,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
4241
4525
|
}
|
|
4242
4526
|
async function callLoaderOrAction({
|
|
4243
4527
|
request,
|
|
4528
|
+
pattern,
|
|
4244
4529
|
match,
|
|
4245
4530
|
lazyHandlerPromise,
|
|
4246
4531
|
lazyRoutePromise,
|
|
@@ -4267,6 +4552,7 @@ async function callLoaderOrAction({
|
|
|
4267
4552
|
return handler(
|
|
4268
4553
|
{
|
|
4269
4554
|
request,
|
|
4555
|
+
pattern,
|
|
4270
4556
|
params: match.params,
|
|
4271
4557
|
context: scopedContext
|
|
4272
4558
|
},
|
|
@@ -4375,19 +4661,19 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
|
4375
4661
|
return {
|
|
4376
4662
|
type: "error" /* error */,
|
|
4377
4663
|
error: result.data,
|
|
4378
|
-
statusCode: _optionalChain([result, 'access',
|
|
4379
|
-
headers: _optionalChain([result, 'access',
|
|
4664
|
+
statusCode: _optionalChain([result, 'access', _49 => _49.init, 'optionalAccess', _50 => _50.status]),
|
|
4665
|
+
headers: _optionalChain([result, 'access', _51 => _51.init, 'optionalAccess', _52 => _52.headers]) ? new Headers(result.init.headers) : void 0
|
|
4380
4666
|
};
|
|
4381
4667
|
}
|
|
4382
4668
|
return {
|
|
4383
4669
|
type: "error" /* error */,
|
|
4384
4670
|
error: new ErrorResponseImpl(
|
|
4385
|
-
_optionalChain([result, 'access',
|
|
4671
|
+
_optionalChain([result, 'access', _53 => _53.init, 'optionalAccess', _54 => _54.status]) || 500,
|
|
4386
4672
|
void 0,
|
|
4387
4673
|
result.data
|
|
4388
4674
|
),
|
|
4389
4675
|
statusCode: isRouteErrorResponse(result) ? result.status : void 0,
|
|
4390
|
-
headers: _optionalChain([result, 'access',
|
|
4676
|
+
headers: _optionalChain([result, 'access', _55 => _55.init, 'optionalAccess', _56 => _56.headers]) ? new Headers(result.init.headers) : void 0
|
|
4391
4677
|
};
|
|
4392
4678
|
}
|
|
4393
4679
|
return {
|
|
@@ -4400,8 +4686,8 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
|
4400
4686
|
return {
|
|
4401
4687
|
type: "data" /* data */,
|
|
4402
4688
|
data: result.data,
|
|
4403
|
-
statusCode: _optionalChain([result, 'access',
|
|
4404
|
-
headers: _optionalChain([result, 'access',
|
|
4689
|
+
statusCode: _optionalChain([result, 'access', _57 => _57.init, 'optionalAccess', _58 => _58.status]),
|
|
4690
|
+
headers: _optionalChain([result, 'access', _59 => _59.init, 'optionalAccess', _60 => _60.headers]) ? new Headers(result.init.headers) : void 0
|
|
4405
4691
|
};
|
|
4406
4692
|
}
|
|
4407
4693
|
return { type: "data" /* data */, data: result };
|
|
@@ -4550,7 +4836,7 @@ function processLoaderData(state, matches, results, pendingActionResult, revalid
|
|
|
4550
4836
|
let result = fetcherResults[key];
|
|
4551
4837
|
invariant(result, "Did not find corresponding fetcher result");
|
|
4552
4838
|
if (isErrorResult(result)) {
|
|
4553
|
-
let boundaryMatch = findNearestBoundary(state.matches, _optionalChain([match, 'optionalAccess',
|
|
4839
|
+
let boundaryMatch = findNearestBoundary(state.matches, _optionalChain([match, 'optionalAccess', _61 => _61.route, 'access', _62 => _62.id]));
|
|
4554
4840
|
if (!(errors && errors[boundaryMatch.route.id])) {
|
|
4555
4841
|
errors = {
|
|
4556
4842
|
...errors,
|
|
@@ -4684,8 +4970,8 @@ function dataWithResponseInitToResponse(data2) {
|
|
|
4684
4970
|
}
|
|
4685
4971
|
function dataWithResponseInitToErrorResponse(data2) {
|
|
4686
4972
|
return new ErrorResponseImpl(
|
|
4687
|
-
_nullishCoalesce(_optionalChain([data2, 'access',
|
|
4688
|
-
_nullishCoalesce(_optionalChain([data2, 'access',
|
|
4973
|
+
_nullishCoalesce(_optionalChain([data2, 'access', _63 => _63.init, 'optionalAccess', _64 => _64.status]), () => ( 500)),
|
|
4974
|
+
_nullishCoalesce(_optionalChain([data2, 'access', _65 => _65.init, 'optionalAccess', _66 => _66.statusText]), () => ( "Internal Server Error")),
|
|
4689
4975
|
data2.data
|
|
4690
4976
|
);
|
|
4691
4977
|
}
|
|
@@ -5717,7 +6003,7 @@ function getTurboStreamSingleFetchDataStrategy(getRouter, manifest, routeModules
|
|
|
5717
6003
|
return {
|
|
5718
6004
|
hasLoader: manifestRoute.hasLoader,
|
|
5719
6005
|
hasClientLoader: manifestRoute.hasClientLoader,
|
|
5720
|
-
hasShouldRevalidate: Boolean(_optionalChain([routeModule, 'optionalAccess',
|
|
6006
|
+
hasShouldRevalidate: Boolean(_optionalChain([routeModule, 'optionalAccess', _67 => _67.shouldRevalidate]))
|
|
5721
6007
|
};
|
|
5722
6008
|
},
|
|
5723
6009
|
fetchAndDecodeViaTurboStream,
|
|
@@ -5884,7 +6170,7 @@ async function bubbleMiddlewareErrors(singleFetchPromise, matches, routesParams,
|
|
|
5884
6170
|
let routeResult = fetchedData.routes[match.route.id];
|
|
5885
6171
|
if ("error" in routeResult) {
|
|
5886
6172
|
middlewareError = routeResult.error;
|
|
5887
|
-
if (_optionalChain([results, 'access',
|
|
6173
|
+
if (_optionalChain([results, 'access', _68 => _68[match.route.id], 'optionalAccess', _69 => _69.result]) == null) {
|
|
5888
6174
|
results[match.route.id] = {
|
|
5889
6175
|
type: "error",
|
|
5890
6176
|
result: middlewareError
|
|
@@ -5997,7 +6283,7 @@ async function fetchAndDecodeViaTurboStream(args, basename, targetRoutes) {
|
|
|
5997
6283
|
}
|
|
5998
6284
|
} else {
|
|
5999
6285
|
let typed = decoded.value;
|
|
6000
|
-
let routeId = _optionalChain([targetRoutes, 'optionalAccess',
|
|
6286
|
+
let routeId = _optionalChain([targetRoutes, 'optionalAccess', _70 => _70[0]]);
|
|
6001
6287
|
invariant2(routeId, "No routeId found for single fetch call decoding");
|
|
6002
6288
|
if ("redirect" in typed) {
|
|
6003
6289
|
data2 = { redirect: typed };
|
|
@@ -6309,7 +6595,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
6309
6595
|
if (locationArg) {
|
|
6310
6596
|
let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
|
6311
6597
|
invariant(
|
|
6312
|
-
parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access',
|
|
6598
|
+
parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access', _71 => _71.pathname, 'optionalAccess', _72 => _72.startsWith, 'call', _73 => _73(parentPathnameBase)]),
|
|
6313
6599
|
`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.`
|
|
6314
6600
|
);
|
|
6315
6601
|
location = parsedLocationArg;
|
|
@@ -6471,10 +6757,10 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, uns
|
|
|
6471
6757
|
}
|
|
6472
6758
|
}
|
|
6473
6759
|
let renderedMatches = matches;
|
|
6474
|
-
let errors = _optionalChain([dataRouterState, 'optionalAccess',
|
|
6760
|
+
let errors = _optionalChain([dataRouterState, 'optionalAccess', _74 => _74.errors]);
|
|
6475
6761
|
if (errors != null) {
|
|
6476
6762
|
let errorIndex = renderedMatches.findIndex(
|
|
6477
|
-
(m) => m.route.id && _optionalChain([errors, 'optionalAccess',
|
|
6763
|
+
(m) => m.route.id && _optionalChain([errors, 'optionalAccess', _75 => _75[m.route.id]]) !== void 0
|
|
6478
6764
|
);
|
|
6479
6765
|
invariant(
|
|
6480
6766
|
errorIndex >= 0,
|
|
@@ -6652,15 +6938,15 @@ function useRouteError() {
|
|
|
6652
6938
|
if (error !== void 0) {
|
|
6653
6939
|
return error;
|
|
6654
6940
|
}
|
|
6655
|
-
return _optionalChain([state, 'access',
|
|
6941
|
+
return _optionalChain([state, 'access', _76 => _76.errors, 'optionalAccess', _77 => _77[routeId]]);
|
|
6656
6942
|
}
|
|
6657
6943
|
function useAsyncValue() {
|
|
6658
6944
|
let value = React3.useContext(AwaitContext);
|
|
6659
|
-
return _optionalChain([value, 'optionalAccess',
|
|
6945
|
+
return _optionalChain([value, 'optionalAccess', _78 => _78._data]);
|
|
6660
6946
|
}
|
|
6661
6947
|
function useAsyncError() {
|
|
6662
6948
|
let value = React3.useContext(AwaitContext);
|
|
6663
|
-
return _optionalChain([value, 'optionalAccess',
|
|
6949
|
+
return _optionalChain([value, 'optionalAccess', _79 => _79._error]);
|
|
6664
6950
|
}
|
|
6665
6951
|
var blockerId = 0;
|
|
6666
6952
|
function useBlocker(shouldBlock) {
|
|
@@ -6730,15 +7016,6 @@ function warningOnce(key, cond, message) {
|
|
|
6730
7016
|
warning(false, message);
|
|
6731
7017
|
}
|
|
6732
7018
|
}
|
|
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
|
-
}
|
|
6742
7019
|
|
|
6743
7020
|
// lib/dom/ssr/errorBoundaries.tsx
|
|
6744
7021
|
|
|
@@ -6781,7 +7058,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
|
|
|
6781
7058
|
let route = manifest.routes[match.route.id];
|
|
6782
7059
|
return [
|
|
6783
7060
|
route && route.css ? route.css.map((href) => ({ rel: "stylesheet", href })) : [],
|
|
6784
|
-
_optionalChain([module, 'optionalAccess',
|
|
7061
|
+
_optionalChain([module, 'optionalAccess', _80 => _80.links, 'optionalCall', _81 => _81()]) || []
|
|
6785
7062
|
];
|
|
6786
7063
|
}).flat(2);
|
|
6787
7064
|
let preloads = getModuleLinkHrefs(matches, manifest);
|
|
@@ -6882,7 +7159,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
|
|
|
6882
7159
|
// param change, /users/123 -> /users/456
|
|
6883
7160
|
currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
|
|
6884
7161
|
// e.g. /files/images/avatar.jpg -> files/finances.xls
|
|
6885
|
-
_optionalChain([currentMatches, 'access',
|
|
7162
|
+
_optionalChain([currentMatches, 'access', _82 => _82[index], 'access', _83 => _83.route, 'access', _84 => _84.path, 'optionalAccess', _85 => _85.endsWith, 'call', _86 => _86("*")]) && currentMatches[index].params["*"] !== match.params["*"]
|
|
6886
7163
|
);
|
|
6887
7164
|
};
|
|
6888
7165
|
if (mode === "assets") {
|
|
@@ -6905,7 +7182,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
|
|
|
6905
7182
|
location.pathname + location.search + location.hash,
|
|
6906
7183
|
window.origin
|
|
6907
7184
|
),
|
|
6908
|
-
currentParams: _optionalChain([currentMatches, 'access',
|
|
7185
|
+
currentParams: _optionalChain([currentMatches, 'access', _87 => _87[0], 'optionalAccess', _88 => _88.params]) || {},
|
|
6909
7186
|
nextUrl: new URL(page, window.origin),
|
|
6910
7187
|
nextParams: match.params,
|
|
6911
7188
|
defaultShouldRevalidate: true
|
|
@@ -7177,11 +7454,11 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
7177
7454
|
)
|
|
7178
7455
|
});
|
|
7179
7456
|
let hasInitialData = initialState && initialState.loaderData && route.id in initialState.loaderData;
|
|
7180
|
-
let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess',
|
|
7457
|
+
let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess', _89 => _89.loaderData, 'optionalAccess', _90 => _90[route.id]]) : void 0;
|
|
7181
7458
|
let hasInitialError = initialState && initialState.errors && route.id in initialState.errors;
|
|
7182
|
-
let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess',
|
|
7183
|
-
let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access',
|
|
7184
|
-
dataRoute.loader = async ({ request, params, context }, singleFetch) => {
|
|
7459
|
+
let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess', _91 => _91.errors, 'optionalAccess', _92 => _92[route.id]]) : void 0;
|
|
7460
|
+
let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access', _93 => _93.clientLoader, 'optionalAccess', _94 => _94.hydrate]) === true || !route.hasLoader);
|
|
7461
|
+
dataRoute.loader = async ({ request, params, context, pattern }, singleFetch) => {
|
|
7185
7462
|
try {
|
|
7186
7463
|
let result = await prefetchStylesAndCallHandler(async () => {
|
|
7187
7464
|
invariant2(
|
|
@@ -7195,6 +7472,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
7195
7472
|
request,
|
|
7196
7473
|
params,
|
|
7197
7474
|
context,
|
|
7475
|
+
pattern,
|
|
7198
7476
|
async serverLoader() {
|
|
7199
7477
|
preventInvalidServerHandlerCall("loader", route);
|
|
7200
7478
|
if (isHydrationRequest) {
|
|
@@ -7220,7 +7498,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
7220
7498
|
route.hasLoader,
|
|
7221
7499
|
isSpaMode
|
|
7222
7500
|
);
|
|
7223
|
-
dataRoute.action = ({ request, params, context }, singleFetch) => {
|
|
7501
|
+
dataRoute.action = ({ request, params, context, pattern }, singleFetch) => {
|
|
7224
7502
|
return prefetchStylesAndCallHandler(async () => {
|
|
7225
7503
|
invariant2(
|
|
7226
7504
|
routeModule,
|
|
@@ -7236,6 +7514,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
7236
7514
|
request,
|
|
7237
7515
|
params,
|
|
7238
7516
|
context,
|
|
7517
|
+
pattern,
|
|
7239
7518
|
async serverAction() {
|
|
7240
7519
|
preventInvalidServerHandlerCall("action", route);
|
|
7241
7520
|
return fetchServerAction(singleFetch);
|
|
@@ -7474,7 +7753,7 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDi
|
|
|
7474
7753
|
function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
|
|
7475
7754
|
React6.useEffect(() => {
|
|
7476
7755
|
if (!isFogOfWarEnabled(routeDiscovery, ssr) || // @ts-expect-error - TS doesn't know about this yet
|
|
7477
|
-
_optionalChain([window, 'access',
|
|
7756
|
+
_optionalChain([window, 'access', _95 => _95.navigator, 'optionalAccess', _96 => _96.connection, 'optionalAccess', _97 => _97.saveData]) === true) {
|
|
7478
7757
|
return;
|
|
7479
7758
|
}
|
|
7480
7759
|
function registerElement(el) {
|
|
@@ -7583,7 +7862,7 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
|
|
|
7583
7862
|
}
|
|
7584
7863
|
serverPatches = await res.json();
|
|
7585
7864
|
} catch (e) {
|
|
7586
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
7865
|
+
if (_optionalChain([signal, 'optionalAccess', _98 => _98.aborted])) return;
|
|
7587
7866
|
throw e;
|
|
7588
7867
|
}
|
|
7589
7868
|
let knownRoutes = new Set(Object.keys(manifest.routes));
|
|
@@ -7824,7 +8103,7 @@ function PrefetchPageLinksImpl({
|
|
|
7824
8103
|
if (!manifestRoute || !manifestRoute.hasLoader) {
|
|
7825
8104
|
return;
|
|
7826
8105
|
}
|
|
7827
|
-
if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access',
|
|
8106
|
+
if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access', _99 => _99[m.route.id], 'optionalAccess', _100 => _100.shouldRevalidate])) {
|
|
7828
8107
|
foundOptOutRoute = true;
|
|
7829
8108
|
} else if (manifestRoute.hasClientLoader) {
|
|
7830
8109
|
foundOptOutRoute = true;
|
|
@@ -7898,7 +8177,7 @@ function Meta() {
|
|
|
7898
8177
|
error
|
|
7899
8178
|
};
|
|
7900
8179
|
matches[i] = match;
|
|
7901
|
-
if (_optionalChain([routeModule, 'optionalAccess',
|
|
8180
|
+
if (_optionalChain([routeModule, 'optionalAccess', _101 => _101.meta])) {
|
|
7902
8181
|
routeMeta = typeof routeModule.meta === "function" ? routeModule.meta({
|
|
7903
8182
|
data: data2,
|
|
7904
8183
|
loaderData: data2,
|
|
@@ -7997,7 +8276,7 @@ function Scripts(scriptProps) {
|
|
|
7997
8276
|
}
|
|
7998
8277
|
let streamScript = "window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());";
|
|
7999
8278
|
let contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};${streamScript}` : " ";
|
|
8000
|
-
let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access',
|
|
8279
|
+
let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access', _102 => _102.hmr, 'optionalAccess', _103 => _103.runtime]) ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
|
|
8001
8280
|
${matches.map((match, routeIndex) => {
|
|
8002
8281
|
let routeVarName = `route${routeIndex}`;
|
|
8003
8282
|
let manifestEntry = manifest.routes[match.route.id];
|
|
@@ -8227,7 +8506,7 @@ function BoundaryShell({
|
|
|
8227
8506
|
children
|
|
8228
8507
|
}) {
|
|
8229
8508
|
let { routeModules } = useFrameworkContext();
|
|
8230
|
-
if (_optionalChain([routeModules, 'access',
|
|
8509
|
+
if (_optionalChain([routeModules, 'access', _104 => _104.root, 'optionalAccess', _105 => _105.Layout]) && !isOutsideRemixApp) {
|
|
8231
8510
|
return children;
|
|
8232
8511
|
}
|
|
8233
8512
|
return /* @__PURE__ */ React8.createElement("html", { lang: "en" }, /* @__PURE__ */ React8.createElement("head", null, /* @__PURE__ */ React8.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ React8.createElement(
|
|
@@ -8343,4 +8622,4 @@ function BoundaryShell({
|
|
|
8343
8622
|
|
|
8344
8623
|
|
|
8345
8624
|
|
|
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.
|
|
8625
|
+
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.instrumentHandler = instrumentHandler; 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.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;
|