react-router 0.0.0-experimental-e613d4238 → 0.0.0-experimental-3df673e
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-2YVPYFDJ.mjs → chunk-27W3PGKT.mjs} +67 -51
- package/dist/development/{chunk-5P3HEZQU.mjs → chunk-5FNKA3AJ.mjs} +309 -25
- package/dist/{production/chunk-E4G6PZCJ.js → development/chunk-HMTR6AB3.js} +164 -161
- package/dist/development/{chunk-YJ6T7YSE.js → chunk-OAO2BCWA.js} +347 -66
- 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-CCykjjOv.d.ts} +198 -134
- package/dist/{production/index-react-server-client-2EDmGlsZ.d.mts → development/index-react-server-client-vPxdwQO-.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-BsMyG4uF.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-BsBQDHG4.d.ts} +73 -1046
- package/dist/development/{route-data-CDwqkzPE.d.mts → routeModules-DSpLybMz.d.mts} +157 -147
- package/dist/development/{context-BqL5Eckq.d.mts → router-B02dMGKy.d.mts} +1403 -1250
- package/dist/{development/chunk-XXC4LMW2.js → production/chunk-BJWGLTLV.js} +164 -161
- package/dist/production/{chunk-5MHETEIL.mjs → chunk-IFXZKZUN.mjs} +67 -51
- package/dist/production/{chunk-QBUHFRYZ.js → chunk-NZTFTCSL.js} +347 -66
- package/dist/production/{chunk-VNGQS422.mjs → chunk-XWLYGPB7.mjs} +309 -25
- 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-CCykjjOv.d.ts} +140 -77
- package/dist/production/{index-react-server-client-DKvU8YRr.d.ts → index-react-server-client-vPxdwQO-.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-BsMyG4uF.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-BsBQDHG4.d.ts} +73 -1046
- package/dist/production/{route-data-CDwqkzPE.d.mts → routeModules-DSpLybMz.d.mts} +157 -147
- package/dist/production/{context-BqL5Eckq.d.mts → router-B02dMGKy.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-3df673e
|
|
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, unstable_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
|
+
unstable_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
|
+
unstable_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
|
+
unstable_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,13 +3808,15 @@ 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,
|
|
3541
3815
|
actionResult,
|
|
3542
3816
|
actionStatus
|
|
3543
3817
|
};
|
|
3818
|
+
let pattern = getRoutePattern(matches.map((m) => m.route.path));
|
|
3819
|
+
console.log(pattern, matches);
|
|
3544
3820
|
let dsMatches = matches.map((match, index) => {
|
|
3545
3821
|
let { route } = match;
|
|
3546
3822
|
let forceShouldLoad = null;
|
|
@@ -3564,6 +3840,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest,
|
|
|
3564
3840
|
mapRouteProperties,
|
|
3565
3841
|
manifest,
|
|
3566
3842
|
request,
|
|
3843
|
+
pattern,
|
|
3567
3844
|
match,
|
|
3568
3845
|
lazyRoutePropertiesToSkip,
|
|
3569
3846
|
scopedContext,
|
|
@@ -3584,6 +3861,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest,
|
|
|
3584
3861
|
mapRouteProperties,
|
|
3585
3862
|
manifest,
|
|
3586
3863
|
request,
|
|
3864
|
+
pattern,
|
|
3587
3865
|
match,
|
|
3588
3866
|
lazyRoutePropertiesToSkip,
|
|
3589
3867
|
scopedContext,
|
|
@@ -3758,7 +4036,7 @@ function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRoutePrope
|
|
|
3758
4036
|
let newRoutes = convertRoutesToDataRoutes(
|
|
3759
4037
|
uniqueChildren,
|
|
3760
4038
|
mapRouteProperties,
|
|
3761
|
-
[routeId || "_", "patch", String(_optionalChain([childrenToPatch, 'optionalAccess',
|
|
4039
|
+
[routeId || "_", "patch", String(_optionalChain([childrenToPatch, 'optionalAccess', _31 => _31.length]) || "0")],
|
|
3762
4040
|
manifest
|
|
3763
4041
|
);
|
|
3764
4042
|
childrenToPatch.push(...newRoutes);
|
|
@@ -3795,7 +4073,7 @@ function isSameRoute(newRoute, existingRoute) {
|
|
|
3795
4073
|
return true;
|
|
3796
4074
|
}
|
|
3797
4075
|
return newRoute.children.every(
|
|
3798
|
-
(aChild, i) => _optionalChain([existingRoute, 'access',
|
|
4076
|
+
(aChild, i) => _optionalChain([existingRoute, 'access', _32 => _32.children, 'optionalAccess', _33 => _33.some, 'call', _34 => _34((bChild) => isSameRoute(aChild, bChild))])
|
|
3799
4077
|
);
|
|
3800
4078
|
}
|
|
3801
4079
|
var lazyRoutePropertyCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -3943,9 +4221,9 @@ function loadLazyRoute(route, type, manifest, mapRouteProperties, lazyRoutePrope
|
|
|
3943
4221
|
}
|
|
3944
4222
|
let lazyRoutePromise = lazyPropertyPromises.length > 0 ? Promise.all(lazyPropertyPromises).then(() => {
|
|
3945
4223
|
}) : void 0;
|
|
3946
|
-
_optionalChain([lazyRoutePromise, 'optionalAccess',
|
|
4224
|
+
_optionalChain([lazyRoutePromise, 'optionalAccess', _35 => _35.catch, 'call', _36 => _36(() => {
|
|
3947
4225
|
})]);
|
|
3948
|
-
_optionalChain([lazyHandlerPromise, 'optionalAccess',
|
|
4226
|
+
_optionalChain([lazyHandlerPromise, 'optionalAccess', _37 => _37.catch, 'call', _38 => _38(() => {
|
|
3949
4227
|
})]);
|
|
3950
4228
|
return {
|
|
3951
4229
|
lazyRoutePromise,
|
|
@@ -4042,7 +4320,12 @@ async function runMiddlewarePipeline(args, handler, processResult, isResult, err
|
|
|
4042
4320
|
(m) => m.route.middleware ? m.route.middleware.map((fn) => [m.route.id, fn]) : []
|
|
4043
4321
|
);
|
|
4044
4322
|
let result = await callRouteMiddleware(
|
|
4045
|
-
{
|
|
4323
|
+
{
|
|
4324
|
+
request,
|
|
4325
|
+
params,
|
|
4326
|
+
context,
|
|
4327
|
+
unstable_pattern: getRoutePattern(matches.map((m) => m.route.path))
|
|
4328
|
+
},
|
|
4046
4329
|
tuples,
|
|
4047
4330
|
handler,
|
|
4048
4331
|
processResult,
|
|
@@ -4120,7 +4403,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request,
|
|
|
4120
4403
|
handler: lazyRoutePromises.lazyHandlerPromise
|
|
4121
4404
|
};
|
|
4122
4405
|
}
|
|
4123
|
-
function getDataStrategyMatch(mapRouteProperties, manifest, request, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, unstable_shouldRevalidateArgs = null) {
|
|
4406
|
+
function getDataStrategyMatch(mapRouteProperties, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, unstable_shouldRevalidateArgs = null) {
|
|
4124
4407
|
let isUsingNewApi = false;
|
|
4125
4408
|
let _lazyPromises = getDataStrategyMatchLazyPromises(
|
|
4126
4409
|
mapRouteProperties,
|
|
@@ -4154,9 +4437,10 @@ function getDataStrategyMatch(mapRouteProperties, manifest, request, match, lazy
|
|
|
4154
4437
|
if (callHandler && !isMiddlewareOnlyRoute) {
|
|
4155
4438
|
return callLoaderOrAction({
|
|
4156
4439
|
request,
|
|
4440
|
+
unstable_pattern,
|
|
4157
4441
|
match,
|
|
4158
|
-
lazyHandlerPromise: _optionalChain([_lazyPromises, 'optionalAccess',
|
|
4159
|
-
lazyRoutePromise: _optionalChain([_lazyPromises, 'optionalAccess',
|
|
4442
|
+
lazyHandlerPromise: _optionalChain([_lazyPromises, 'optionalAccess', _39 => _39.handler]),
|
|
4443
|
+
lazyRoutePromise: _optionalChain([_lazyPromises, 'optionalAccess', _40 => _40.route]),
|
|
4160
4444
|
handlerOverride,
|
|
4161
4445
|
scopedContext
|
|
4162
4446
|
});
|
|
@@ -4187,6 +4471,7 @@ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, m
|
|
|
4187
4471
|
mapRouteProperties,
|
|
4188
4472
|
manifest,
|
|
4189
4473
|
request,
|
|
4474
|
+
getRoutePattern(matches.map((m) => m.route.path)),
|
|
4190
4475
|
match,
|
|
4191
4476
|
lazyRoutePropertiesToSkip,
|
|
4192
4477
|
scopedContext,
|
|
@@ -4196,11 +4481,12 @@ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, m
|
|
|
4196
4481
|
});
|
|
4197
4482
|
}
|
|
4198
4483
|
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',
|
|
4484
|
+
if (matches.some((m) => _optionalChain([m, 'access', _41 => _41._lazyPromises, 'optionalAccess', _42 => _42.middleware]))) {
|
|
4485
|
+
await Promise.all(matches.map((m) => _optionalChain([m, 'access', _43 => _43._lazyPromises, 'optionalAccess', _44 => _44.middleware])));
|
|
4201
4486
|
}
|
|
4202
4487
|
let dataStrategyArgs = {
|
|
4203
4488
|
request,
|
|
4489
|
+
unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
4204
4490
|
params: matches[0].params,
|
|
4205
4491
|
context: scopedContext,
|
|
4206
4492
|
matches
|
|
@@ -4231,8 +4517,8 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
4231
4517
|
try {
|
|
4232
4518
|
await Promise.all(
|
|
4233
4519
|
matches.flatMap((m) => [
|
|
4234
|
-
_optionalChain([m, 'access',
|
|
4235
|
-
_optionalChain([m, 'access',
|
|
4520
|
+
_optionalChain([m, 'access', _45 => _45._lazyPromises, 'optionalAccess', _46 => _46.handler]),
|
|
4521
|
+
_optionalChain([m, 'access', _47 => _47._lazyPromises, 'optionalAccess', _48 => _48.route])
|
|
4236
4522
|
])
|
|
4237
4523
|
);
|
|
4238
4524
|
} catch (e) {
|
|
@@ -4241,6 +4527,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
4241
4527
|
}
|
|
4242
4528
|
async function callLoaderOrAction({
|
|
4243
4529
|
request,
|
|
4530
|
+
unstable_pattern,
|
|
4244
4531
|
match,
|
|
4245
4532
|
lazyHandlerPromise,
|
|
4246
4533
|
lazyRoutePromise,
|
|
@@ -4267,6 +4554,7 @@ async function callLoaderOrAction({
|
|
|
4267
4554
|
return handler(
|
|
4268
4555
|
{
|
|
4269
4556
|
request,
|
|
4557
|
+
unstable_pattern,
|
|
4270
4558
|
params: match.params,
|
|
4271
4559
|
context: scopedContext
|
|
4272
4560
|
},
|
|
@@ -4375,19 +4663,19 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
|
4375
4663
|
return {
|
|
4376
4664
|
type: "error" /* error */,
|
|
4377
4665
|
error: result.data,
|
|
4378
|
-
statusCode: _optionalChain([result, 'access',
|
|
4379
|
-
headers: _optionalChain([result, 'access',
|
|
4666
|
+
statusCode: _optionalChain([result, 'access', _49 => _49.init, 'optionalAccess', _50 => _50.status]),
|
|
4667
|
+
headers: _optionalChain([result, 'access', _51 => _51.init, 'optionalAccess', _52 => _52.headers]) ? new Headers(result.init.headers) : void 0
|
|
4380
4668
|
};
|
|
4381
4669
|
}
|
|
4382
4670
|
return {
|
|
4383
4671
|
type: "error" /* error */,
|
|
4384
4672
|
error: new ErrorResponseImpl(
|
|
4385
|
-
_optionalChain([result, 'access',
|
|
4673
|
+
_optionalChain([result, 'access', _53 => _53.init, 'optionalAccess', _54 => _54.status]) || 500,
|
|
4386
4674
|
void 0,
|
|
4387
4675
|
result.data
|
|
4388
4676
|
),
|
|
4389
4677
|
statusCode: isRouteErrorResponse(result) ? result.status : void 0,
|
|
4390
|
-
headers: _optionalChain([result, 'access',
|
|
4678
|
+
headers: _optionalChain([result, 'access', _55 => _55.init, 'optionalAccess', _56 => _56.headers]) ? new Headers(result.init.headers) : void 0
|
|
4391
4679
|
};
|
|
4392
4680
|
}
|
|
4393
4681
|
return {
|
|
@@ -4400,8 +4688,8 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
|
4400
4688
|
return {
|
|
4401
4689
|
type: "data" /* data */,
|
|
4402
4690
|
data: result.data,
|
|
4403
|
-
statusCode: _optionalChain([result, 'access',
|
|
4404
|
-
headers: _optionalChain([result, 'access',
|
|
4691
|
+
statusCode: _optionalChain([result, 'access', _57 => _57.init, 'optionalAccess', _58 => _58.status]),
|
|
4692
|
+
headers: _optionalChain([result, 'access', _59 => _59.init, 'optionalAccess', _60 => _60.headers]) ? new Headers(result.init.headers) : void 0
|
|
4405
4693
|
};
|
|
4406
4694
|
}
|
|
4407
4695
|
return { type: "data" /* data */, data: result };
|
|
@@ -4550,7 +4838,7 @@ function processLoaderData(state, matches, results, pendingActionResult, revalid
|
|
|
4550
4838
|
let result = fetcherResults[key];
|
|
4551
4839
|
invariant(result, "Did not find corresponding fetcher result");
|
|
4552
4840
|
if (isErrorResult(result)) {
|
|
4553
|
-
let boundaryMatch = findNearestBoundary(state.matches, _optionalChain([match, 'optionalAccess',
|
|
4841
|
+
let boundaryMatch = findNearestBoundary(state.matches, _optionalChain([match, 'optionalAccess', _61 => _61.route, 'access', _62 => _62.id]));
|
|
4554
4842
|
if (!(errors && errors[boundaryMatch.route.id])) {
|
|
4555
4843
|
errors = {
|
|
4556
4844
|
...errors,
|
|
@@ -4684,8 +4972,8 @@ function dataWithResponseInitToResponse(data2) {
|
|
|
4684
4972
|
}
|
|
4685
4973
|
function dataWithResponseInitToErrorResponse(data2) {
|
|
4686
4974
|
return new ErrorResponseImpl(
|
|
4687
|
-
_nullishCoalesce(_optionalChain([data2, 'access',
|
|
4688
|
-
_nullishCoalesce(_optionalChain([data2, 'access',
|
|
4975
|
+
_nullishCoalesce(_optionalChain([data2, 'access', _63 => _63.init, 'optionalAccess', _64 => _64.status]), () => ( 500)),
|
|
4976
|
+
_nullishCoalesce(_optionalChain([data2, 'access', _65 => _65.init, 'optionalAccess', _66 => _66.statusText]), () => ( "Internal Server Error")),
|
|
4689
4977
|
data2.data
|
|
4690
4978
|
);
|
|
4691
4979
|
}
|
|
@@ -5717,7 +6005,7 @@ function getTurboStreamSingleFetchDataStrategy(getRouter, manifest, routeModules
|
|
|
5717
6005
|
return {
|
|
5718
6006
|
hasLoader: manifestRoute.hasLoader,
|
|
5719
6007
|
hasClientLoader: manifestRoute.hasClientLoader,
|
|
5720
|
-
hasShouldRevalidate: Boolean(_optionalChain([routeModule, 'optionalAccess',
|
|
6008
|
+
hasShouldRevalidate: Boolean(_optionalChain([routeModule, 'optionalAccess', _67 => _67.shouldRevalidate]))
|
|
5721
6009
|
};
|
|
5722
6010
|
},
|
|
5723
6011
|
fetchAndDecodeViaTurboStream,
|
|
@@ -5884,7 +6172,7 @@ async function bubbleMiddlewareErrors(singleFetchPromise, matches, routesParams,
|
|
|
5884
6172
|
let routeResult = fetchedData.routes[match.route.id];
|
|
5885
6173
|
if ("error" in routeResult) {
|
|
5886
6174
|
middlewareError = routeResult.error;
|
|
5887
|
-
if (_optionalChain([results, 'access',
|
|
6175
|
+
if (_optionalChain([results, 'access', _68 => _68[match.route.id], 'optionalAccess', _69 => _69.result]) == null) {
|
|
5888
6176
|
results[match.route.id] = {
|
|
5889
6177
|
type: "error",
|
|
5890
6178
|
result: middlewareError
|
|
@@ -5997,7 +6285,7 @@ async function fetchAndDecodeViaTurboStream(args, basename, targetRoutes) {
|
|
|
5997
6285
|
}
|
|
5998
6286
|
} else {
|
|
5999
6287
|
let typed = decoded.value;
|
|
6000
|
-
let routeId = _optionalChain([targetRoutes, 'optionalAccess',
|
|
6288
|
+
let routeId = _optionalChain([targetRoutes, 'optionalAccess', _70 => _70[0]]);
|
|
6001
6289
|
invariant2(routeId, "No routeId found for single fetch call decoding");
|
|
6002
6290
|
if ("redirect" in typed) {
|
|
6003
6291
|
data2 = { redirect: typed };
|
|
@@ -6309,7 +6597,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
6309
6597
|
if (locationArg) {
|
|
6310
6598
|
let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
|
6311
6599
|
invariant(
|
|
6312
|
-
parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access',
|
|
6600
|
+
parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access', _71 => _71.pathname, 'optionalAccess', _72 => _72.startsWith, 'call', _73 => _73(parentPathnameBase)]),
|
|
6313
6601
|
`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
6602
|
);
|
|
6315
6603
|
location = parsedLocationArg;
|
|
@@ -6471,10 +6759,10 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, uns
|
|
|
6471
6759
|
}
|
|
6472
6760
|
}
|
|
6473
6761
|
let renderedMatches = matches;
|
|
6474
|
-
let errors = _optionalChain([dataRouterState, 'optionalAccess',
|
|
6762
|
+
let errors = _optionalChain([dataRouterState, 'optionalAccess', _74 => _74.errors]);
|
|
6475
6763
|
if (errors != null) {
|
|
6476
6764
|
let errorIndex = renderedMatches.findIndex(
|
|
6477
|
-
(m) => m.route.id && _optionalChain([errors, 'optionalAccess',
|
|
6765
|
+
(m) => m.route.id && _optionalChain([errors, 'optionalAccess', _75 => _75[m.route.id]]) !== void 0
|
|
6478
6766
|
);
|
|
6479
6767
|
invariant(
|
|
6480
6768
|
errorIndex >= 0,
|
|
@@ -6652,15 +6940,15 @@ function useRouteError() {
|
|
|
6652
6940
|
if (error !== void 0) {
|
|
6653
6941
|
return error;
|
|
6654
6942
|
}
|
|
6655
|
-
return _optionalChain([state, 'access',
|
|
6943
|
+
return _optionalChain([state, 'access', _76 => _76.errors, 'optionalAccess', _77 => _77[routeId]]);
|
|
6656
6944
|
}
|
|
6657
6945
|
function useAsyncValue() {
|
|
6658
6946
|
let value = React3.useContext(AwaitContext);
|
|
6659
|
-
return _optionalChain([value, 'optionalAccess',
|
|
6947
|
+
return _optionalChain([value, 'optionalAccess', _78 => _78._data]);
|
|
6660
6948
|
}
|
|
6661
6949
|
function useAsyncError() {
|
|
6662
6950
|
let value = React3.useContext(AwaitContext);
|
|
6663
|
-
return _optionalChain([value, 'optionalAccess',
|
|
6951
|
+
return _optionalChain([value, 'optionalAccess', _79 => _79._error]);
|
|
6664
6952
|
}
|
|
6665
6953
|
var blockerId = 0;
|
|
6666
6954
|
function useBlocker(shouldBlock) {
|
|
@@ -6730,15 +7018,6 @@ function warningOnce(key, cond, message) {
|
|
|
6730
7018
|
warning(false, message);
|
|
6731
7019
|
}
|
|
6732
7020
|
}
|
|
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
7021
|
|
|
6743
7022
|
// lib/dom/ssr/errorBoundaries.tsx
|
|
6744
7023
|
|
|
@@ -6781,7 +7060,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
|
|
|
6781
7060
|
let route = manifest.routes[match.route.id];
|
|
6782
7061
|
return [
|
|
6783
7062
|
route && route.css ? route.css.map((href) => ({ rel: "stylesheet", href })) : [],
|
|
6784
|
-
_optionalChain([module, 'optionalAccess',
|
|
7063
|
+
_optionalChain([module, 'optionalAccess', _80 => _80.links, 'optionalCall', _81 => _81()]) || []
|
|
6785
7064
|
];
|
|
6786
7065
|
}).flat(2);
|
|
6787
7066
|
let preloads = getModuleLinkHrefs(matches, manifest);
|
|
@@ -6882,7 +7161,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
|
|
|
6882
7161
|
// param change, /users/123 -> /users/456
|
|
6883
7162
|
currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
|
|
6884
7163
|
// e.g. /files/images/avatar.jpg -> files/finances.xls
|
|
6885
|
-
_optionalChain([currentMatches, 'access',
|
|
7164
|
+
_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
7165
|
);
|
|
6887
7166
|
};
|
|
6888
7167
|
if (mode === "assets") {
|
|
@@ -6905,7 +7184,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
|
|
|
6905
7184
|
location.pathname + location.search + location.hash,
|
|
6906
7185
|
window.origin
|
|
6907
7186
|
),
|
|
6908
|
-
currentParams: _optionalChain([currentMatches, 'access',
|
|
7187
|
+
currentParams: _optionalChain([currentMatches, 'access', _87 => _87[0], 'optionalAccess', _88 => _88.params]) || {},
|
|
6909
7188
|
nextUrl: new URL(page, window.origin),
|
|
6910
7189
|
nextParams: match.params,
|
|
6911
7190
|
defaultShouldRevalidate: true
|
|
@@ -7177,11 +7456,11 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
7177
7456
|
)
|
|
7178
7457
|
});
|
|
7179
7458
|
let hasInitialData = initialState && initialState.loaderData && route.id in initialState.loaderData;
|
|
7180
|
-
let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess',
|
|
7459
|
+
let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess', _89 => _89.loaderData, 'optionalAccess', _90 => _90[route.id]]) : void 0;
|
|
7181
7460
|
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) => {
|
|
7461
|
+
let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess', _91 => _91.errors, 'optionalAccess', _92 => _92[route.id]]) : void 0;
|
|
7462
|
+
let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access', _93 => _93.clientLoader, 'optionalAccess', _94 => _94.hydrate]) === true || !route.hasLoader);
|
|
7463
|
+
dataRoute.loader = async ({ request, params, context, unstable_pattern }, singleFetch) => {
|
|
7185
7464
|
try {
|
|
7186
7465
|
let result = await prefetchStylesAndCallHandler(async () => {
|
|
7187
7466
|
invariant2(
|
|
@@ -7195,6 +7474,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
7195
7474
|
request,
|
|
7196
7475
|
params,
|
|
7197
7476
|
context,
|
|
7477
|
+
unstable_pattern,
|
|
7198
7478
|
async serverLoader() {
|
|
7199
7479
|
preventInvalidServerHandlerCall("loader", route);
|
|
7200
7480
|
if (isHydrationRequest) {
|
|
@@ -7220,7 +7500,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
7220
7500
|
route.hasLoader,
|
|
7221
7501
|
isSpaMode
|
|
7222
7502
|
);
|
|
7223
|
-
dataRoute.action = ({ request, params, context }, singleFetch) => {
|
|
7503
|
+
dataRoute.action = ({ request, params, context, unstable_pattern }, singleFetch) => {
|
|
7224
7504
|
return prefetchStylesAndCallHandler(async () => {
|
|
7225
7505
|
invariant2(
|
|
7226
7506
|
routeModule,
|
|
@@ -7236,6 +7516,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
7236
7516
|
request,
|
|
7237
7517
|
params,
|
|
7238
7518
|
context,
|
|
7519
|
+
unstable_pattern,
|
|
7239
7520
|
async serverAction() {
|
|
7240
7521
|
preventInvalidServerHandlerCall("action", route);
|
|
7241
7522
|
return fetchServerAction(singleFetch);
|
|
@@ -7474,7 +7755,7 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDi
|
|
|
7474
7755
|
function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
|
|
7475
7756
|
React6.useEffect(() => {
|
|
7476
7757
|
if (!isFogOfWarEnabled(routeDiscovery, ssr) || // @ts-expect-error - TS doesn't know about this yet
|
|
7477
|
-
_optionalChain([window, 'access',
|
|
7758
|
+
_optionalChain([window, 'access', _95 => _95.navigator, 'optionalAccess', _96 => _96.connection, 'optionalAccess', _97 => _97.saveData]) === true) {
|
|
7478
7759
|
return;
|
|
7479
7760
|
}
|
|
7480
7761
|
function registerElement(el) {
|
|
@@ -7583,7 +7864,7 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
|
|
|
7583
7864
|
}
|
|
7584
7865
|
serverPatches = await res.json();
|
|
7585
7866
|
} catch (e) {
|
|
7586
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
7867
|
+
if (_optionalChain([signal, 'optionalAccess', _98 => _98.aborted])) return;
|
|
7587
7868
|
throw e;
|
|
7588
7869
|
}
|
|
7589
7870
|
let knownRoutes = new Set(Object.keys(manifest.routes));
|
|
@@ -7824,7 +8105,7 @@ function PrefetchPageLinksImpl({
|
|
|
7824
8105
|
if (!manifestRoute || !manifestRoute.hasLoader) {
|
|
7825
8106
|
return;
|
|
7826
8107
|
}
|
|
7827
|
-
if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access',
|
|
8108
|
+
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
8109
|
foundOptOutRoute = true;
|
|
7829
8110
|
} else if (manifestRoute.hasClientLoader) {
|
|
7830
8111
|
foundOptOutRoute = true;
|
|
@@ -7898,7 +8179,7 @@ function Meta() {
|
|
|
7898
8179
|
error
|
|
7899
8180
|
};
|
|
7900
8181
|
matches[i] = match;
|
|
7901
|
-
if (_optionalChain([routeModule, 'optionalAccess',
|
|
8182
|
+
if (_optionalChain([routeModule, 'optionalAccess', _101 => _101.meta])) {
|
|
7902
8183
|
routeMeta = typeof routeModule.meta === "function" ? routeModule.meta({
|
|
7903
8184
|
data: data2,
|
|
7904
8185
|
loaderData: data2,
|
|
@@ -7997,7 +8278,7 @@ function Scripts(scriptProps) {
|
|
|
7997
8278
|
}
|
|
7998
8279
|
let streamScript = "window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());";
|
|
7999
8280
|
let contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};${streamScript}` : " ";
|
|
8000
|
-
let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access',
|
|
8281
|
+
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
8282
|
${matches.map((match, routeIndex) => {
|
|
8002
8283
|
let routeVarName = `route${routeIndex}`;
|
|
8003
8284
|
let manifestEntry = manifest.routes[match.route.id];
|
|
@@ -8227,7 +8508,7 @@ function BoundaryShell({
|
|
|
8227
8508
|
children
|
|
8228
8509
|
}) {
|
|
8229
8510
|
let { routeModules } = useFrameworkContext();
|
|
8230
|
-
if (_optionalChain([routeModules, 'access',
|
|
8511
|
+
if (_optionalChain([routeModules, 'access', _104 => _104.root, 'optionalAccess', _105 => _105.Layout]) && !isOutsideRemixApp) {
|
|
8231
8512
|
return children;
|
|
8232
8513
|
}
|
|
8233
8514
|
return /* @__PURE__ */ React8.createElement("html", { lang: "en" }, /* @__PURE__ */ React8.createElement("head", null, /* @__PURE__ */ React8.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ React8.createElement(
|
|
@@ -8343,4 +8624,4 @@ function BoundaryShell({
|
|
|
8343
8624
|
|
|
8344
8625
|
|
|
8345
8626
|
|
|
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.
|
|
8627
|
+
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;
|