react-router 0.0.0-experimental-a65d6f5 → 0.0.0-experimental-c19b79d
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-ZLVXSGFL.js → chunk-2G2U5HGB.js} +161 -164
- package/dist/development/{chunk-CWSJ6RYI.mjs → chunk-AGOH44BE.mjs} +51 -67
- package/dist/development/{chunk-47MIYFLC.mjs → chunk-IMKEG5CI.mjs} +29 -309
- package/dist/development/{chunk-QOFB7XZ5.js → chunk-LUB73E44.js} +70 -347
- package/dist/development/{router-DQIRhYoj.d.mts → context-BqL5Eckq.d.mts} +1288 -1441
- package/dist/development/dom-export.d.mts +4 -59
- package/dist/development/dom-export.d.ts +3 -59
- package/dist/development/dom-export.js +5 -8
- package/dist/development/dom-export.mjs +5 -8
- package/dist/{production/index-react-server-client-lf74v6ET.d.mts → development/index-react-server-client-2EDmGlsZ.d.mts} +77 -140
- package/dist/development/{index-react-server-client-lf74v6ET.d.mts → index-react-server-client-DKvU8YRr.d.ts} +134 -198
- package/dist/development/index-react-server-client.d.mts +3 -3
- package/dist/development/index-react-server-client.d.ts +2 -3
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.d.mts +1 -106
- package/dist/development/index-react-server.d.ts +1 -106
- package/dist/development/index-react-server.js +8 -181
- package/dist/development/index-react-server.mjs +8 -181
- package/dist/development/index.d.mts +20 -13
- package/dist/development/index.d.ts +18 -13
- package/dist/development/index.js +147 -161
- package/dist/development/index.mjs +5 -3
- package/dist/development/lib/types/internal.d.mts +3 -3
- package/dist/development/lib/types/internal.d.ts +2 -3
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{register-DiOIlEq5.d.mts → register-BrVEYTED.d.mts} +7 -1
- package/dist/{production/register-DiOIlEq5.d.mts → development/register-D8NQoPsO.d.ts} +7 -1
- package/dist/development/{routeModules--SgCTStn.d.mts → route-data-CDwqkzPE.d.mts} +147 -157
- package/dist/{production/routeModules-rxNxBmdR.d.ts → development/routeModules-BmVo7q9e.d.ts} +1046 -73
- package/dist/production/{chunk-ZOHTOBOT.js → chunk-2L5AG5Y5.js} +70 -347
- package/dist/production/{chunk-UAAA7FTX.mjs → chunk-AODJW4D3.mjs} +51 -67
- package/dist/production/{chunk-4SPSFXAZ.js → chunk-FGRCWJDI.js} +161 -164
- package/dist/production/{chunk-MMAHTIVZ.mjs → chunk-UOQCOPF6.mjs} +29 -309
- package/dist/production/{router-DQIRhYoj.d.mts → context-BqL5Eckq.d.mts} +1288 -1441
- package/dist/production/dom-export.d.mts +4 -59
- package/dist/production/dom-export.d.ts +3 -59
- package/dist/production/dom-export.js +5 -8
- package/dist/production/dom-export.mjs +5 -8
- package/dist/{development/index-react-server-client-Iw2PMej2.d.ts → production/index-react-server-client-2EDmGlsZ.d.mts} +77 -140
- package/dist/production/{index-react-server-client-Iw2PMej2.d.ts → index-react-server-client-DKvU8YRr.d.ts} +134 -198
- package/dist/production/index-react-server-client.d.mts +3 -3
- package/dist/production/index-react-server-client.d.ts +2 -3
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.d.mts +1 -106
- package/dist/production/index-react-server.d.ts +1 -106
- package/dist/production/index-react-server.js +8 -181
- package/dist/production/index-react-server.mjs +8 -181
- package/dist/production/index.d.mts +20 -13
- package/dist/production/index.d.ts +18 -13
- package/dist/production/index.js +147 -161
- package/dist/production/index.mjs +5 -3
- package/dist/production/lib/types/internal.d.mts +3 -3
- package/dist/production/lib/types/internal.d.ts +2 -3
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/{development/register-DiOIlEq5.d.ts → production/register-BrVEYTED.d.mts} +7 -1
- package/dist/production/{register-DiOIlEq5.d.ts → register-D8NQoPsO.d.ts} +7 -1
- package/dist/production/{routeModules--SgCTStn.d.mts → route-data-CDwqkzPE.d.mts} +147 -157
- package/dist/{development/routeModules-rxNxBmdR.d.ts → production/routeModules-BmVo7q9e.d.ts} +1046 -73
- package/package.json +1 -1
- package/dist/development/instrumentation-BWRz1MRU.d.ts +0 -1138
- package/dist/production/instrumentation-BWRz1MRU.d.ts +0 -1138
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-c19b79d
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -454,23 +454,19 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath = [],
|
|
|
454
454
|
if (isIndexRoute(route)) {
|
|
455
455
|
let indexRoute = {
|
|
456
456
|
...route,
|
|
457
|
+
...mapRouteProperties(route),
|
|
457
458
|
id
|
|
458
459
|
};
|
|
459
|
-
manifest[id] =
|
|
460
|
-
indexRoute,
|
|
461
|
-
mapRouteProperties(indexRoute)
|
|
462
|
-
);
|
|
460
|
+
manifest[id] = indexRoute;
|
|
463
461
|
return indexRoute;
|
|
464
462
|
} else {
|
|
465
463
|
let pathOrLayoutRoute = {
|
|
466
464
|
...route,
|
|
465
|
+
...mapRouteProperties(route),
|
|
467
466
|
id,
|
|
468
467
|
children: void 0
|
|
469
468
|
};
|
|
470
|
-
manifest[id] =
|
|
471
|
-
pathOrLayoutRoute,
|
|
472
|
-
mapRouteProperties(pathOrLayoutRoute)
|
|
473
|
-
);
|
|
469
|
+
manifest[id] = pathOrLayoutRoute;
|
|
474
470
|
if (route.children) {
|
|
475
471
|
pathOrLayoutRoute.children = convertRoutesToDataRoutes(
|
|
476
472
|
route.children,
|
|
@@ -484,17 +480,6 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath = [],
|
|
|
484
480
|
}
|
|
485
481
|
});
|
|
486
482
|
}
|
|
487
|
-
function mergeRouteUpdates(route, updates) {
|
|
488
|
-
return Object.assign(route, {
|
|
489
|
-
...updates,
|
|
490
|
-
...typeof updates.lazy === "object" && updates.lazy != null ? {
|
|
491
|
-
lazy: {
|
|
492
|
-
...route.lazy,
|
|
493
|
-
...updates.lazy
|
|
494
|
-
}
|
|
495
|
-
} : {}
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
483
|
function matchRoutes(routes, locationArg, basename = "/") {
|
|
499
484
|
return matchRoutesImpl(routes, locationArg, basename, false);
|
|
500
485
|
}
|
|
@@ -950,229 +935,6 @@ var ErrorResponseImpl = class {
|
|
|
950
935
|
function isRouteErrorResponse(error) {
|
|
951
936
|
return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
|
|
952
937
|
}
|
|
953
|
-
function getRoutePattern(paths) {
|
|
954
|
-
return paths.filter(Boolean).join("/").replace(/\/\/*/g, "/");
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
// lib/router/instrumentation.ts
|
|
958
|
-
var UninstrumentedSymbol = Symbol("Uninstrumented");
|
|
959
|
-
function getInstrumentedImplementation(impls, handler, getInfo = () => void 0) {
|
|
960
|
-
if (impls.length === 0) {
|
|
961
|
-
return null;
|
|
962
|
-
}
|
|
963
|
-
return async (...args) => {
|
|
964
|
-
let value;
|
|
965
|
-
let info = getInfo(...args);
|
|
966
|
-
await recurseRight(
|
|
967
|
-
impls,
|
|
968
|
-
info,
|
|
969
|
-
async () => {
|
|
970
|
-
value = await handler(...args);
|
|
971
|
-
},
|
|
972
|
-
impls.length - 1
|
|
973
|
-
);
|
|
974
|
-
return value;
|
|
975
|
-
};
|
|
976
|
-
}
|
|
977
|
-
async function recurseRight(impls, info, handler, index) {
|
|
978
|
-
let impl = impls[index];
|
|
979
|
-
if (!impl) {
|
|
980
|
-
await handler();
|
|
981
|
-
} else {
|
|
982
|
-
await impl(async () => {
|
|
983
|
-
await recurseRight(impls, info, handler, index - 1);
|
|
984
|
-
}, info);
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
function getInstrumentationInfo(args) {
|
|
988
|
-
let { request, context, params, 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
|
-
}
|
|
1176
938
|
|
|
1177
939
|
// lib/router/router.ts
|
|
1178
940
|
var validMutationMethodsArr = [
|
|
@@ -1232,20 +994,7 @@ function createRouter(init) {
|
|
|
1232
994
|
"You must provide a non-empty routes array to createRouter"
|
|
1233
995
|
);
|
|
1234
996
|
let hydrationRouteProperties = init.hydrationRouteProperties || [];
|
|
1235
|
-
let
|
|
1236
|
-
let mapRouteProperties = _mapRouteProperties;
|
|
1237
|
-
if (init.unstable_instrumentations) {
|
|
1238
|
-
let instrumentations = init.unstable_instrumentations;
|
|
1239
|
-
mapRouteProperties = (route) => {
|
|
1240
|
-
return {
|
|
1241
|
-
..._mapRouteProperties(route),
|
|
1242
|
-
...getInstrumentationUpdates(
|
|
1243
|
-
instrumentations.map((i) => i.route).filter(Boolean),
|
|
1244
|
-
route
|
|
1245
|
-
)
|
|
1246
|
-
};
|
|
1247
|
-
};
|
|
1248
|
-
}
|
|
997
|
+
let mapRouteProperties = init.mapRouteProperties || defaultMapRouteProperties;
|
|
1249
998
|
let manifest = {};
|
|
1250
999
|
let dataRoutes = convertRoutesToDataRoutes(
|
|
1251
1000
|
init.routes,
|
|
@@ -2997,12 +2746,6 @@ function createRouter(init) {
|
|
|
2997
2746
|
updateState(newState);
|
|
2998
2747
|
}
|
|
2999
2748
|
};
|
|
3000
|
-
if (init.unstable_instrumentations) {
|
|
3001
|
-
router = instrumentClientSideRouter(
|
|
3002
|
-
router,
|
|
3003
|
-
init.unstable_instrumentations.map((i) => i.router).filter(Boolean)
|
|
3004
|
-
);
|
|
3005
|
-
}
|
|
3006
2749
|
return router;
|
|
3007
2750
|
}
|
|
3008
2751
|
function createStaticHandler(routes, opts) {
|
|
@@ -3012,20 +2755,7 @@ function createStaticHandler(routes, opts) {
|
|
|
3012
2755
|
);
|
|
3013
2756
|
let manifest = {};
|
|
3014
2757
|
let basename = (opts ? opts.basename : null) || "/";
|
|
3015
|
-
let
|
|
3016
|
-
let mapRouteProperties = _mapRouteProperties;
|
|
3017
|
-
if (_optionalChain([opts, 'optionalAccess', _17 => _17.unstable_instrumentations])) {
|
|
3018
|
-
let instrumentations = opts.unstable_instrumentations;
|
|
3019
|
-
mapRouteProperties = (route) => {
|
|
3020
|
-
return {
|
|
3021
|
-
..._mapRouteProperties(route),
|
|
3022
|
-
...getInstrumentationUpdates(
|
|
3023
|
-
instrumentations.map((i) => i.route).filter(Boolean),
|
|
3024
|
-
route
|
|
3025
|
-
)
|
|
3026
|
-
};
|
|
3027
|
-
};
|
|
3028
|
-
}
|
|
2758
|
+
let mapRouteProperties = _optionalChain([opts, 'optionalAccess', _16 => _16.mapRouteProperties]) || defaultMapRouteProperties;
|
|
3029
2759
|
let dataRoutes = convertRoutesToDataRoutes(
|
|
3030
2760
|
routes,
|
|
3031
2761
|
mapRouteProperties,
|
|
@@ -3095,7 +2825,6 @@ function createStaticHandler(routes, opts) {
|
|
|
3095
2825
|
let response = await runServerMiddlewarePipeline(
|
|
3096
2826
|
{
|
|
3097
2827
|
request,
|
|
3098
|
-
unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
3099
2828
|
matches,
|
|
3100
2829
|
params: matches[0].params,
|
|
3101
2830
|
// If we're calling middleware then it must be enabled so we can cast
|
|
@@ -3159,9 +2888,9 @@ function createStaticHandler(routes, opts) {
|
|
|
3159
2888
|
} else {
|
|
3160
2889
|
let boundaryRouteId = skipLoaderErrorBubbling ? routeId : findNearestBoundary(
|
|
3161
2890
|
matches,
|
|
3162
|
-
_optionalChain([matches, 'access',
|
|
2891
|
+
_optionalChain([matches, 'access', _17 => _17.find, 'call', _18 => _18(
|
|
3163
2892
|
(m) => m.route.id === routeId || m.route.loader
|
|
3164
|
-
), 'optionalAccess',
|
|
2893
|
+
), 'optionalAccess', _19 => _19.route, 'access', _20 => _20.id]) || routeId
|
|
3165
2894
|
).route.id;
|
|
3166
2895
|
let staticContext = {
|
|
3167
2896
|
matches,
|
|
@@ -3241,7 +2970,6 @@ function createStaticHandler(routes, opts) {
|
|
|
3241
2970
|
let response = await runServerMiddlewarePipeline(
|
|
3242
2971
|
{
|
|
3243
2972
|
request,
|
|
3244
|
-
unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
3245
2973
|
matches,
|
|
3246
2974
|
params: matches[0].params,
|
|
3247
2975
|
// If we're calling middleware then it must be enabled so we can cast
|
|
@@ -3494,11 +3222,11 @@ function createStaticHandler(routes, opts) {
|
|
|
3494
3222
|
}
|
|
3495
3223
|
async function loadRouteData(request, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad, pendingActionResult) {
|
|
3496
3224
|
let isRouteRequest = routeMatch != null;
|
|
3497
|
-
if (isRouteRequest && !_optionalChain([routeMatch, 'optionalAccess',
|
|
3225
|
+
if (isRouteRequest && !_optionalChain([routeMatch, 'optionalAccess', _21 => _21.route, 'access', _22 => _22.loader]) && !_optionalChain([routeMatch, 'optionalAccess', _23 => _23.route, 'access', _24 => _24.lazy])) {
|
|
3498
3226
|
throw getInternalRouterError(400, {
|
|
3499
3227
|
method: request.method,
|
|
3500
3228
|
pathname: new URL(request.url).pathname,
|
|
3501
|
-
routeId: _optionalChain([routeMatch, 'optionalAccess',
|
|
3229
|
+
routeId: _optionalChain([routeMatch, 'optionalAccess', _25 => _25.route, 'access', _26 => _26.id])
|
|
3502
3230
|
});
|
|
3503
3231
|
}
|
|
3504
3232
|
let dsMatches;
|
|
@@ -3523,7 +3251,6 @@ function createStaticHandler(routes, opts) {
|
|
|
3523
3251
|
mapRouteProperties,
|
|
3524
3252
|
manifest,
|
|
3525
3253
|
request,
|
|
3526
|
-
getRoutePattern(matches.map((m) => m.route.path)),
|
|
3527
3254
|
match,
|
|
3528
3255
|
[],
|
|
3529
3256
|
requestContext,
|
|
@@ -3534,7 +3261,6 @@ function createStaticHandler(routes, opts) {
|
|
|
3534
3261
|
mapRouteProperties,
|
|
3535
3262
|
manifest,
|
|
3536
3263
|
request,
|
|
3537
|
-
getRoutePattern(matches.map((m) => m.route.path)),
|
|
3538
3264
|
match,
|
|
3539
3265
|
[],
|
|
3540
3266
|
requestContext,
|
|
@@ -3808,15 +3534,13 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest,
|
|
|
3808
3534
|
let shouldSkipRevalidation = actionStatus && actionStatus >= 400;
|
|
3809
3535
|
let baseShouldRevalidateArgs = {
|
|
3810
3536
|
currentUrl,
|
|
3811
|
-
currentParams: _optionalChain([state, 'access',
|
|
3537
|
+
currentParams: _optionalChain([state, 'access', _27 => _27.matches, 'access', _28 => _28[0], 'optionalAccess', _29 => _29.params]) || {},
|
|
3812
3538
|
nextUrl,
|
|
3813
3539
|
nextParams: matches[0].params,
|
|
3814
3540
|
...submission,
|
|
3815
3541
|
actionResult,
|
|
3816
3542
|
actionStatus
|
|
3817
3543
|
};
|
|
3818
|
-
let pattern = getRoutePattern(matches.map((m) => m.route.path));
|
|
3819
|
-
console.log(pattern, matches);
|
|
3820
3544
|
let dsMatches = matches.map((match, index) => {
|
|
3821
3545
|
let { route } = match;
|
|
3822
3546
|
let forceShouldLoad = null;
|
|
@@ -3840,7 +3564,6 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest,
|
|
|
3840
3564
|
mapRouteProperties,
|
|
3841
3565
|
manifest,
|
|
3842
3566
|
request,
|
|
3843
|
-
pattern,
|
|
3844
3567
|
match,
|
|
3845
3568
|
lazyRoutePropertiesToSkip,
|
|
3846
3569
|
scopedContext,
|
|
@@ -3861,7 +3584,6 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest,
|
|
|
3861
3584
|
mapRouteProperties,
|
|
3862
3585
|
manifest,
|
|
3863
3586
|
request,
|
|
3864
|
-
pattern,
|
|
3865
3587
|
match,
|
|
3866
3588
|
lazyRoutePropertiesToSkip,
|
|
3867
3589
|
scopedContext,
|
|
@@ -4036,7 +3758,7 @@ function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRoutePrope
|
|
|
4036
3758
|
let newRoutes = convertRoutesToDataRoutes(
|
|
4037
3759
|
uniqueChildren,
|
|
4038
3760
|
mapRouteProperties,
|
|
4039
|
-
[routeId || "_", "patch", String(_optionalChain([childrenToPatch, 'optionalAccess',
|
|
3761
|
+
[routeId || "_", "patch", String(_optionalChain([childrenToPatch, 'optionalAccess', _30 => _30.length]) || "0")],
|
|
4040
3762
|
manifest
|
|
4041
3763
|
);
|
|
4042
3764
|
childrenToPatch.push(...newRoutes);
|
|
@@ -4073,7 +3795,7 @@ function isSameRoute(newRoute, existingRoute) {
|
|
|
4073
3795
|
return true;
|
|
4074
3796
|
}
|
|
4075
3797
|
return newRoute.children.every(
|
|
4076
|
-
(aChild, i) => _optionalChain([existingRoute, 'access',
|
|
3798
|
+
(aChild, i) => _optionalChain([existingRoute, 'access', _31 => _31.children, 'optionalAccess', _32 => _32.some, 'call', _33 => _33((bChild) => isSameRoute(aChild, bChild))])
|
|
4077
3799
|
);
|
|
4078
3800
|
}
|
|
4079
3801
|
var lazyRoutePropertyCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -4221,9 +3943,9 @@ function loadLazyRoute(route, type, manifest, mapRouteProperties, lazyRoutePrope
|
|
|
4221
3943
|
}
|
|
4222
3944
|
let lazyRoutePromise = lazyPropertyPromises.length > 0 ? Promise.all(lazyPropertyPromises).then(() => {
|
|
4223
3945
|
}) : void 0;
|
|
4224
|
-
_optionalChain([lazyRoutePromise, 'optionalAccess',
|
|
3946
|
+
_optionalChain([lazyRoutePromise, 'optionalAccess', _34 => _34.catch, 'call', _35 => _35(() => {
|
|
4225
3947
|
})]);
|
|
4226
|
-
_optionalChain([lazyHandlerPromise, 'optionalAccess',
|
|
3948
|
+
_optionalChain([lazyHandlerPromise, 'optionalAccess', _36 => _36.catch, 'call', _37 => _37(() => {
|
|
4227
3949
|
})]);
|
|
4228
3950
|
return {
|
|
4229
3951
|
lazyRoutePromise,
|
|
@@ -4320,12 +4042,7 @@ async function runMiddlewarePipeline(args, handler, processResult, isResult, err
|
|
|
4320
4042
|
(m) => m.route.middleware ? m.route.middleware.map((fn) => [m.route.id, fn]) : []
|
|
4321
4043
|
);
|
|
4322
4044
|
let result = await callRouteMiddleware(
|
|
4323
|
-
{
|
|
4324
|
-
request,
|
|
4325
|
-
params,
|
|
4326
|
-
context,
|
|
4327
|
-
unstable_pattern: getRoutePattern(matches.map((m) => m.route.path))
|
|
4328
|
-
},
|
|
4045
|
+
{ request, params, context },
|
|
4329
4046
|
tuples,
|
|
4330
4047
|
handler,
|
|
4331
4048
|
processResult,
|
|
@@ -4403,7 +4120,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request,
|
|
|
4403
4120
|
handler: lazyRoutePromises.lazyHandlerPromise
|
|
4404
4121
|
};
|
|
4405
4122
|
}
|
|
4406
|
-
function getDataStrategyMatch(mapRouteProperties, manifest, request,
|
|
4123
|
+
function getDataStrategyMatch(mapRouteProperties, manifest, request, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, unstable_shouldRevalidateArgs = null) {
|
|
4407
4124
|
let isUsingNewApi = false;
|
|
4408
4125
|
let _lazyPromises = getDataStrategyMatchLazyPromises(
|
|
4409
4126
|
mapRouteProperties,
|
|
@@ -4437,10 +4154,9 @@ function getDataStrategyMatch(mapRouteProperties, manifest, request, unstable_pa
|
|
|
4437
4154
|
if (callHandler && !isMiddlewareOnlyRoute) {
|
|
4438
4155
|
return callLoaderOrAction({
|
|
4439
4156
|
request,
|
|
4440
|
-
unstable_pattern,
|
|
4441
4157
|
match,
|
|
4442
|
-
lazyHandlerPromise: _optionalChain([_lazyPromises, 'optionalAccess',
|
|
4443
|
-
lazyRoutePromise: _optionalChain([_lazyPromises, 'optionalAccess',
|
|
4158
|
+
lazyHandlerPromise: _optionalChain([_lazyPromises, 'optionalAccess', _38 => _38.handler]),
|
|
4159
|
+
lazyRoutePromise: _optionalChain([_lazyPromises, 'optionalAccess', _39 => _39.route]),
|
|
4444
4160
|
handlerOverride,
|
|
4445
4161
|
scopedContext
|
|
4446
4162
|
});
|
|
@@ -4471,7 +4187,6 @@ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, m
|
|
|
4471
4187
|
mapRouteProperties,
|
|
4472
4188
|
manifest,
|
|
4473
4189
|
request,
|
|
4474
|
-
getRoutePattern(matches.map((m) => m.route.path)),
|
|
4475
4190
|
match,
|
|
4476
4191
|
lazyRoutePropertiesToSkip,
|
|
4477
4192
|
scopedContext,
|
|
@@ -4481,12 +4196,11 @@ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, m
|
|
|
4481
4196
|
});
|
|
4482
4197
|
}
|
|
4483
4198
|
async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherKey, scopedContext, isStaticHandler) {
|
|
4484
|
-
if (matches.some((m) => _optionalChain([m, 'access',
|
|
4485
|
-
await Promise.all(matches.map((m) => _optionalChain([m, 'access',
|
|
4199
|
+
if (matches.some((m) => _optionalChain([m, 'access', _40 => _40._lazyPromises, 'optionalAccess', _41 => _41.middleware]))) {
|
|
4200
|
+
await Promise.all(matches.map((m) => _optionalChain([m, 'access', _42 => _42._lazyPromises, 'optionalAccess', _43 => _43.middleware])));
|
|
4486
4201
|
}
|
|
4487
4202
|
let dataStrategyArgs = {
|
|
4488
4203
|
request,
|
|
4489
|
-
unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
4490
4204
|
params: matches[0].params,
|
|
4491
4205
|
context: scopedContext,
|
|
4492
4206
|
matches
|
|
@@ -4517,8 +4231,8 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
4517
4231
|
try {
|
|
4518
4232
|
await Promise.all(
|
|
4519
4233
|
matches.flatMap((m) => [
|
|
4520
|
-
_optionalChain([m, 'access',
|
|
4521
|
-
_optionalChain([m, 'access',
|
|
4234
|
+
_optionalChain([m, 'access', _44 => _44._lazyPromises, 'optionalAccess', _45 => _45.handler]),
|
|
4235
|
+
_optionalChain([m, 'access', _46 => _46._lazyPromises, 'optionalAccess', _47 => _47.route])
|
|
4522
4236
|
])
|
|
4523
4237
|
);
|
|
4524
4238
|
} catch (e) {
|
|
@@ -4527,7 +4241,6 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
4527
4241
|
}
|
|
4528
4242
|
async function callLoaderOrAction({
|
|
4529
4243
|
request,
|
|
4530
|
-
unstable_pattern,
|
|
4531
4244
|
match,
|
|
4532
4245
|
lazyHandlerPromise,
|
|
4533
4246
|
lazyRoutePromise,
|
|
@@ -4554,7 +4267,6 @@ async function callLoaderOrAction({
|
|
|
4554
4267
|
return handler(
|
|
4555
4268
|
{
|
|
4556
4269
|
request,
|
|
4557
|
-
unstable_pattern,
|
|
4558
4270
|
params: match.params,
|
|
4559
4271
|
context: scopedContext
|
|
4560
4272
|
},
|
|
@@ -4663,19 +4375,19 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
|
4663
4375
|
return {
|
|
4664
4376
|
type: "error" /* error */,
|
|
4665
4377
|
error: result.data,
|
|
4666
|
-
statusCode: _optionalChain([result, 'access',
|
|
4667
|
-
headers: _optionalChain([result, 'access',
|
|
4378
|
+
statusCode: _optionalChain([result, 'access', _48 => _48.init, 'optionalAccess', _49 => _49.status]),
|
|
4379
|
+
headers: _optionalChain([result, 'access', _50 => _50.init, 'optionalAccess', _51 => _51.headers]) ? new Headers(result.init.headers) : void 0
|
|
4668
4380
|
};
|
|
4669
4381
|
}
|
|
4670
4382
|
return {
|
|
4671
4383
|
type: "error" /* error */,
|
|
4672
4384
|
error: new ErrorResponseImpl(
|
|
4673
|
-
_optionalChain([result, 'access',
|
|
4385
|
+
_optionalChain([result, 'access', _52 => _52.init, 'optionalAccess', _53 => _53.status]) || 500,
|
|
4674
4386
|
void 0,
|
|
4675
4387
|
result.data
|
|
4676
4388
|
),
|
|
4677
4389
|
statusCode: isRouteErrorResponse(result) ? result.status : void 0,
|
|
4678
|
-
headers: _optionalChain([result, 'access',
|
|
4390
|
+
headers: _optionalChain([result, 'access', _54 => _54.init, 'optionalAccess', _55 => _55.headers]) ? new Headers(result.init.headers) : void 0
|
|
4679
4391
|
};
|
|
4680
4392
|
}
|
|
4681
4393
|
return {
|
|
@@ -4688,8 +4400,8 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
|
4688
4400
|
return {
|
|
4689
4401
|
type: "data" /* data */,
|
|
4690
4402
|
data: result.data,
|
|
4691
|
-
statusCode: _optionalChain([result, 'access',
|
|
4692
|
-
headers: _optionalChain([result, 'access',
|
|
4403
|
+
statusCode: _optionalChain([result, 'access', _56 => _56.init, 'optionalAccess', _57 => _57.status]),
|
|
4404
|
+
headers: _optionalChain([result, 'access', _58 => _58.init, 'optionalAccess', _59 => _59.headers]) ? new Headers(result.init.headers) : void 0
|
|
4693
4405
|
};
|
|
4694
4406
|
}
|
|
4695
4407
|
return { type: "data" /* data */, data: result };
|
|
@@ -4838,7 +4550,7 @@ function processLoaderData(state, matches, results, pendingActionResult, revalid
|
|
|
4838
4550
|
let result = fetcherResults[key];
|
|
4839
4551
|
invariant(result, "Did not find corresponding fetcher result");
|
|
4840
4552
|
if (isErrorResult(result)) {
|
|
4841
|
-
let boundaryMatch = findNearestBoundary(state.matches, _optionalChain([match, 'optionalAccess',
|
|
4553
|
+
let boundaryMatch = findNearestBoundary(state.matches, _optionalChain([match, 'optionalAccess', _60 => _60.route, 'access', _61 => _61.id]));
|
|
4842
4554
|
if (!(errors && errors[boundaryMatch.route.id])) {
|
|
4843
4555
|
errors = {
|
|
4844
4556
|
...errors,
|
|
@@ -4972,8 +4684,8 @@ function dataWithResponseInitToResponse(data2) {
|
|
|
4972
4684
|
}
|
|
4973
4685
|
function dataWithResponseInitToErrorResponse(data2) {
|
|
4974
4686
|
return new ErrorResponseImpl(
|
|
4975
|
-
_nullishCoalesce(_optionalChain([data2, 'access',
|
|
4976
|
-
_nullishCoalesce(_optionalChain([data2, 'access',
|
|
4687
|
+
_nullishCoalesce(_optionalChain([data2, 'access', _62 => _62.init, 'optionalAccess', _63 => _63.status]), () => ( 500)),
|
|
4688
|
+
_nullishCoalesce(_optionalChain([data2, 'access', _64 => _64.init, 'optionalAccess', _65 => _65.statusText]), () => ( "Internal Server Error")),
|
|
4977
4689
|
data2.data
|
|
4978
4690
|
);
|
|
4979
4691
|
}
|
|
@@ -6005,7 +5717,7 @@ function getTurboStreamSingleFetchDataStrategy(getRouter, manifest, routeModules
|
|
|
6005
5717
|
return {
|
|
6006
5718
|
hasLoader: manifestRoute.hasLoader,
|
|
6007
5719
|
hasClientLoader: manifestRoute.hasClientLoader,
|
|
6008
|
-
hasShouldRevalidate: Boolean(_optionalChain([routeModule, 'optionalAccess',
|
|
5720
|
+
hasShouldRevalidate: Boolean(_optionalChain([routeModule, 'optionalAccess', _66 => _66.shouldRevalidate]))
|
|
6009
5721
|
};
|
|
6010
5722
|
},
|
|
6011
5723
|
fetchAndDecodeViaTurboStream,
|
|
@@ -6172,7 +5884,7 @@ async function bubbleMiddlewareErrors(singleFetchPromise, matches, routesParams,
|
|
|
6172
5884
|
let routeResult = fetchedData.routes[match.route.id];
|
|
6173
5885
|
if ("error" in routeResult) {
|
|
6174
5886
|
middlewareError = routeResult.error;
|
|
6175
|
-
if (_optionalChain([results, 'access',
|
|
5887
|
+
if (_optionalChain([results, 'access', _67 => _67[match.route.id], 'optionalAccess', _68 => _68.result]) == null) {
|
|
6176
5888
|
results[match.route.id] = {
|
|
6177
5889
|
type: "error",
|
|
6178
5890
|
result: middlewareError
|
|
@@ -6285,7 +5997,7 @@ async function fetchAndDecodeViaTurboStream(args, basename, targetRoutes) {
|
|
|
6285
5997
|
}
|
|
6286
5998
|
} else {
|
|
6287
5999
|
let typed = decoded.value;
|
|
6288
|
-
let routeId = _optionalChain([targetRoutes, 'optionalAccess',
|
|
6000
|
+
let routeId = _optionalChain([targetRoutes, 'optionalAccess', _69 => _69[0]]);
|
|
6289
6001
|
invariant2(routeId, "No routeId found for single fetch call decoding");
|
|
6290
6002
|
if ("redirect" in typed) {
|
|
6291
6003
|
data2 = { redirect: typed };
|
|
@@ -6597,7 +6309,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
6597
6309
|
if (locationArg) {
|
|
6598
6310
|
let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
|
6599
6311
|
invariant(
|
|
6600
|
-
parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access',
|
|
6312
|
+
parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access', _70 => _70.pathname, 'optionalAccess', _71 => _71.startsWith, 'call', _72 => _72(parentPathnameBase)]),
|
|
6601
6313
|
`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${parentPathnameBase}" but pathname "${parsedLocationArg.pathname}" was given in the \`location\` prop.`
|
|
6602
6314
|
);
|
|
6603
6315
|
location = parsedLocationArg;
|
|
@@ -6759,10 +6471,10 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, uns
|
|
|
6759
6471
|
}
|
|
6760
6472
|
}
|
|
6761
6473
|
let renderedMatches = matches;
|
|
6762
|
-
let errors = _optionalChain([dataRouterState, 'optionalAccess',
|
|
6474
|
+
let errors = _optionalChain([dataRouterState, 'optionalAccess', _73 => _73.errors]);
|
|
6763
6475
|
if (errors != null) {
|
|
6764
6476
|
let errorIndex = renderedMatches.findIndex(
|
|
6765
|
-
(m) => m.route.id && _optionalChain([errors, 'optionalAccess',
|
|
6477
|
+
(m) => m.route.id && _optionalChain([errors, 'optionalAccess', _74 => _74[m.route.id]]) !== void 0
|
|
6766
6478
|
);
|
|
6767
6479
|
invariant(
|
|
6768
6480
|
errorIndex >= 0,
|
|
@@ -6940,15 +6652,15 @@ function useRouteError() {
|
|
|
6940
6652
|
if (error !== void 0) {
|
|
6941
6653
|
return error;
|
|
6942
6654
|
}
|
|
6943
|
-
return _optionalChain([state, 'access',
|
|
6655
|
+
return _optionalChain([state, 'access', _75 => _75.errors, 'optionalAccess', _76 => _76[routeId]]);
|
|
6944
6656
|
}
|
|
6945
6657
|
function useAsyncValue() {
|
|
6946
6658
|
let value = React3.useContext(AwaitContext);
|
|
6947
|
-
return _optionalChain([value, 'optionalAccess',
|
|
6659
|
+
return _optionalChain([value, 'optionalAccess', _77 => _77._data]);
|
|
6948
6660
|
}
|
|
6949
6661
|
function useAsyncError() {
|
|
6950
6662
|
let value = React3.useContext(AwaitContext);
|
|
6951
|
-
return _optionalChain([value, 'optionalAccess',
|
|
6663
|
+
return _optionalChain([value, 'optionalAccess', _78 => _78._error]);
|
|
6952
6664
|
}
|
|
6953
6665
|
var blockerId = 0;
|
|
6954
6666
|
function useBlocker(shouldBlock) {
|
|
@@ -7018,6 +6730,19 @@ function warningOnce(key, cond, message) {
|
|
|
7018
6730
|
warning(false, message);
|
|
7019
6731
|
}
|
|
7020
6732
|
}
|
|
6733
|
+
function useRoute(...args) {
|
|
6734
|
+
const currentRouteId = useCurrentRouteId(
|
|
6735
|
+
"useRoute" /* UseRoute */
|
|
6736
|
+
);
|
|
6737
|
+
const id = _nullishCoalesce(args[0], () => ( currentRouteId));
|
|
6738
|
+
const state = useDataRouterState("useRouteLoaderData" /* UseRouteLoaderData */);
|
|
6739
|
+
const route = state.matches.find(({ route: route2 }) => route2.id === id);
|
|
6740
|
+
if (route === void 0) return void 0;
|
|
6741
|
+
return {
|
|
6742
|
+
loaderData: state.loaderData[id],
|
|
6743
|
+
actionData: _optionalChain([state, 'access', _79 => _79.actionData, 'optionalAccess', _80 => _80[id]])
|
|
6744
|
+
};
|
|
6745
|
+
}
|
|
7021
6746
|
|
|
7022
6747
|
// lib/dom/ssr/errorBoundaries.tsx
|
|
7023
6748
|
|
|
@@ -7060,7 +6785,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
|
|
|
7060
6785
|
let route = manifest.routes[match.route.id];
|
|
7061
6786
|
return [
|
|
7062
6787
|
route && route.css ? route.css.map((href) => ({ rel: "stylesheet", href })) : [],
|
|
7063
|
-
_optionalChain([module, 'optionalAccess',
|
|
6788
|
+
_optionalChain([module, 'optionalAccess', _81 => _81.links, 'optionalCall', _82 => _82()]) || []
|
|
7064
6789
|
];
|
|
7065
6790
|
}).flat(2);
|
|
7066
6791
|
let preloads = getModuleLinkHrefs(matches, manifest);
|
|
@@ -7161,7 +6886,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
|
|
|
7161
6886
|
// param change, /users/123 -> /users/456
|
|
7162
6887
|
currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
|
|
7163
6888
|
// e.g. /files/images/avatar.jpg -> files/finances.xls
|
|
7164
|
-
_optionalChain([currentMatches, 'access',
|
|
6889
|
+
_optionalChain([currentMatches, 'access', _83 => _83[index], 'access', _84 => _84.route, 'access', _85 => _85.path, 'optionalAccess', _86 => _86.endsWith, 'call', _87 => _87("*")]) && currentMatches[index].params["*"] !== match.params["*"]
|
|
7165
6890
|
);
|
|
7166
6891
|
};
|
|
7167
6892
|
if (mode === "assets") {
|
|
@@ -7184,7 +6909,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
|
|
|
7184
6909
|
location.pathname + location.search + location.hash,
|
|
7185
6910
|
window.origin
|
|
7186
6911
|
),
|
|
7187
|
-
currentParams: _optionalChain([currentMatches, 'access',
|
|
6912
|
+
currentParams: _optionalChain([currentMatches, 'access', _88 => _88[0], 'optionalAccess', _89 => _89.params]) || {},
|
|
7188
6913
|
nextUrl: new URL(page, window.origin),
|
|
7189
6914
|
nextParams: match.params,
|
|
7190
6915
|
defaultShouldRevalidate: true
|
|
@@ -7456,11 +7181,11 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
7456
7181
|
)
|
|
7457
7182
|
});
|
|
7458
7183
|
let hasInitialData = initialState && initialState.loaderData && route.id in initialState.loaderData;
|
|
7459
|
-
let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess',
|
|
7184
|
+
let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess', _90 => _90.loaderData, 'optionalAccess', _91 => _91[route.id]]) : void 0;
|
|
7460
7185
|
let hasInitialError = initialState && initialState.errors && route.id in initialState.errors;
|
|
7461
|
-
let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess',
|
|
7462
|
-
let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access',
|
|
7463
|
-
dataRoute.loader = async ({ request, params, context
|
|
7186
|
+
let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess', _92 => _92.errors, 'optionalAccess', _93 => _93[route.id]]) : void 0;
|
|
7187
|
+
let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access', _94 => _94.clientLoader, 'optionalAccess', _95 => _95.hydrate]) === true || !route.hasLoader);
|
|
7188
|
+
dataRoute.loader = async ({ request, params, context }, singleFetch) => {
|
|
7464
7189
|
try {
|
|
7465
7190
|
let result = await prefetchStylesAndCallHandler(async () => {
|
|
7466
7191
|
invariant2(
|
|
@@ -7474,7 +7199,6 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
7474
7199
|
request,
|
|
7475
7200
|
params,
|
|
7476
7201
|
context,
|
|
7477
|
-
unstable_pattern,
|
|
7478
7202
|
async serverLoader() {
|
|
7479
7203
|
preventInvalidServerHandlerCall("loader", route);
|
|
7480
7204
|
if (isHydrationRequest) {
|
|
@@ -7500,7 +7224,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
7500
7224
|
route.hasLoader,
|
|
7501
7225
|
isSpaMode
|
|
7502
7226
|
);
|
|
7503
|
-
dataRoute.action = ({ request, params, context
|
|
7227
|
+
dataRoute.action = ({ request, params, context }, singleFetch) => {
|
|
7504
7228
|
return prefetchStylesAndCallHandler(async () => {
|
|
7505
7229
|
invariant2(
|
|
7506
7230
|
routeModule,
|
|
@@ -7516,7 +7240,6 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
7516
7240
|
request,
|
|
7517
7241
|
params,
|
|
7518
7242
|
context,
|
|
7519
|
-
unstable_pattern,
|
|
7520
7243
|
async serverAction() {
|
|
7521
7244
|
preventInvalidServerHandlerCall("action", route);
|
|
7522
7245
|
return fetchServerAction(singleFetch);
|
|
@@ -7755,7 +7478,7 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDi
|
|
|
7755
7478
|
function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
|
|
7756
7479
|
React6.useEffect(() => {
|
|
7757
7480
|
if (!isFogOfWarEnabled(routeDiscovery, ssr) || // @ts-expect-error - TS doesn't know about this yet
|
|
7758
|
-
_optionalChain([window, 'access',
|
|
7481
|
+
_optionalChain([window, 'access', _96 => _96.navigator, 'optionalAccess', _97 => _97.connection, 'optionalAccess', _98 => _98.saveData]) === true) {
|
|
7759
7482
|
return;
|
|
7760
7483
|
}
|
|
7761
7484
|
function registerElement(el) {
|
|
@@ -7864,7 +7587,7 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
|
|
|
7864
7587
|
}
|
|
7865
7588
|
serverPatches = await res.json();
|
|
7866
7589
|
} catch (e) {
|
|
7867
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
7590
|
+
if (_optionalChain([signal, 'optionalAccess', _99 => _99.aborted])) return;
|
|
7868
7591
|
throw e;
|
|
7869
7592
|
}
|
|
7870
7593
|
let knownRoutes = new Set(Object.keys(manifest.routes));
|
|
@@ -8105,7 +7828,7 @@ function PrefetchPageLinksImpl({
|
|
|
8105
7828
|
if (!manifestRoute || !manifestRoute.hasLoader) {
|
|
8106
7829
|
return;
|
|
8107
7830
|
}
|
|
8108
|
-
if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access',
|
|
7831
|
+
if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access', _100 => _100[m.route.id], 'optionalAccess', _101 => _101.shouldRevalidate])) {
|
|
8109
7832
|
foundOptOutRoute = true;
|
|
8110
7833
|
} else if (manifestRoute.hasClientLoader) {
|
|
8111
7834
|
foundOptOutRoute = true;
|
|
@@ -8179,7 +7902,7 @@ function Meta() {
|
|
|
8179
7902
|
error
|
|
8180
7903
|
};
|
|
8181
7904
|
matches[i] = match;
|
|
8182
|
-
if (_optionalChain([routeModule, 'optionalAccess',
|
|
7905
|
+
if (_optionalChain([routeModule, 'optionalAccess', _102 => _102.meta])) {
|
|
8183
7906
|
routeMeta = typeof routeModule.meta === "function" ? routeModule.meta({
|
|
8184
7907
|
data: data2,
|
|
8185
7908
|
loaderData: data2,
|
|
@@ -8278,7 +8001,7 @@ function Scripts(scriptProps) {
|
|
|
8278
8001
|
}
|
|
8279
8002
|
let streamScript = "window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());";
|
|
8280
8003
|
let contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};${streamScript}` : " ";
|
|
8281
|
-
let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access',
|
|
8004
|
+
let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access', _103 => _103.hmr, 'optionalAccess', _104 => _104.runtime]) ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
|
|
8282
8005
|
${matches.map((match, routeIndex) => {
|
|
8283
8006
|
let routeVarName = `route${routeIndex}`;
|
|
8284
8007
|
let manifestEntry = manifest.routes[match.route.id];
|
|
@@ -8508,7 +8231,7 @@ function BoundaryShell({
|
|
|
8508
8231
|
children
|
|
8509
8232
|
}) {
|
|
8510
8233
|
let { routeModules } = useFrameworkContext();
|
|
8511
|
-
if (_optionalChain([routeModules, 'access',
|
|
8234
|
+
if (_optionalChain([routeModules, 'access', _105 => _105.root, 'optionalAccess', _106 => _106.Layout]) && !isOutsideRemixApp) {
|
|
8512
8235
|
return children;
|
|
8513
8236
|
}
|
|
8514
8237
|
return /* @__PURE__ */ React8.createElement("html", { lang: "en" }, /* @__PURE__ */ React8.createElement("head", null, /* @__PURE__ */ React8.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ React8.createElement(
|
|
@@ -8624,4 +8347,4 @@ function BoundaryShell({
|
|
|
8624
8347
|
|
|
8625
8348
|
|
|
8626
8349
|
|
|
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.
|
|
8350
|
+
exports.Action = Action; exports.createMemoryHistory = createMemoryHistory; exports.createBrowserHistory = createBrowserHistory; exports.createHashHistory = createHashHistory; exports.invariant = invariant; exports.warning = warning; exports.createPath = createPath; exports.parsePath = parsePath; exports.createContext = createContext; exports.RouterContextProvider = RouterContextProvider; exports.convertRoutesToDataRoutes = convertRoutesToDataRoutes; exports.matchRoutes = matchRoutes; exports.generatePath = generatePath; exports.matchPath = matchPath; exports.stripBasename = stripBasename; exports.resolvePath = resolvePath; exports.getResolveToMatches = getResolveToMatches; exports.resolveTo = resolveTo; exports.joinPaths = joinPaths; exports.data = data; exports.redirect = redirect; exports.redirectDocument = redirectDocument; exports.replace = replace; exports.ErrorResponseImpl = ErrorResponseImpl; exports.isRouteErrorResponse = isRouteErrorResponse; exports.escapeHtml = escapeHtml; exports.encode = encode; exports.IDLE_NAVIGATION = IDLE_NAVIGATION; exports.IDLE_FETCHER = IDLE_FETCHER; exports.IDLE_BLOCKER = IDLE_BLOCKER; exports.createRouter = createRouter; exports.createStaticHandler = createStaticHandler; exports.getStaticContextFromError = getStaticContextFromError; exports.isDataWithResponseInit = isDataWithResponseInit; exports.isResponse = isResponse; exports.isRedirectStatusCode = isRedirectStatusCode; exports.isRedirectResponse = isRedirectResponse; exports.isMutationMethod = isMutationMethod; exports.createRequestInit = createRequestInit; exports.SingleFetchRedirectSymbol = SingleFetchRedirectSymbol; exports.SINGLE_FETCH_REDIRECT_STATUS = SINGLE_FETCH_REDIRECT_STATUS; exports.NO_BODY_STATUS_CODES = NO_BODY_STATUS_CODES; exports.StreamTransfer = StreamTransfer; exports.getTurboStreamSingleFetchDataStrategy = getTurboStreamSingleFetchDataStrategy; exports.getSingleFetchDataStrategyImpl = getSingleFetchDataStrategyImpl; exports.stripIndexParam = stripIndexParam; exports.singleFetchUrl = singleFetchUrl; exports.decodeViaTurboStream = decodeViaTurboStream; exports.DataRouterContext = DataRouterContext; exports.DataRouterStateContext = DataRouterStateContext; exports.RSCRouterContext = RSCRouterContext; exports.ViewTransitionContext = ViewTransitionContext; exports.FetchersContext = FetchersContext; exports.AwaitContext = AwaitContext; exports.AwaitContextProvider = AwaitContextProvider; exports.NavigationContext = NavigationContext; exports.LocationContext = LocationContext; exports.RouteContext = RouteContext; exports.ENABLE_DEV_WARNINGS = ENABLE_DEV_WARNINGS; exports.warnOnce = warnOnce; exports.useHref = useHref; exports.useInRouterContext = useInRouterContext; exports.useLocation = useLocation; exports.useNavigationType = useNavigationType; exports.useMatch = useMatch; exports.useNavigate = useNavigate; exports.useOutletContext = useOutletContext; exports.useOutlet = useOutlet; exports.useParams = useParams; exports.useResolvedPath = useResolvedPath; exports.useRoutes = useRoutes; exports.useRoutesImpl = useRoutesImpl; exports._renderMatches = _renderMatches; exports.useRouteId = useRouteId; exports.useNavigation = useNavigation; exports.useRevalidator = useRevalidator; exports.useMatches = useMatches; exports.useLoaderData = useLoaderData; exports.useRouteLoaderData = useRouteLoaderData; exports.useActionData = useActionData; exports.useRouteError = useRouteError; exports.useAsyncValue = useAsyncValue; exports.useAsyncError = useAsyncError; exports.useBlocker = useBlocker; exports.useRoute = useRoute; exports.RemixErrorBoundary = RemixErrorBoundary; exports.createServerRoutes = createServerRoutes; exports.createClientRoutesWithHMRRevalidationOptOut = createClientRoutesWithHMRRevalidationOptOut; exports.noActionDefinedError = noActionDefinedError; exports.createClientRoutes = createClientRoutes; exports.shouldHydrateRouteLoader = shouldHydrateRouteLoader; exports.getPatchRoutesOnNavigationFunction = getPatchRoutesOnNavigationFunction; exports.useFogOFWarDiscovery = useFogOFWarDiscovery; exports.getManifestPath = getManifestPath; exports.FrameworkContext = FrameworkContext; exports.usePrefetchBehavior = usePrefetchBehavior; exports.CRITICAL_CSS_DATA_ATTRIBUTE = CRITICAL_CSS_DATA_ATTRIBUTE; exports.Links = Links; exports.PrefetchPageLinks = PrefetchPageLinks; exports.Meta = Meta; exports.setIsHydrated = setIsHydrated; exports.Scripts = Scripts; exports.mergeRefs = mergeRefs;
|