react-router 7.9.4 → 7.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -0
- package/dist/development/browser-BbBXFHbO.d.ts +310 -0
- package/dist/development/browser-C07r42Tt.d.mts +310 -0
- package/dist/development/{chunk-OIYGIGL5.mjs → chunk-4WY6JWTD.mjs} +458 -43
- package/dist/development/{chunk-DI2QHYMJ.js → chunk-AMVS5XVJ.js} +1314 -138
- package/dist/development/{chunk-WY5IRSCW.mjs → chunk-G3INQAYP.mjs} +197 -857
- package/dist/development/chunk-O4JVZSOY.js +1310 -0
- package/dist/development/chunk-PZWDWJAY.js +188 -0
- package/dist/development/dom-export.d.mts +103 -6
- package/dist/development/dom-export.d.ts +103 -4
- package/dist/development/dom-export.js +708 -20
- package/dist/development/dom-export.mjs +692 -11
- package/dist/{production/index-react-server-client-BbRcBjrA.d.ts → development/index-react-server-client-Da3kmxNd.d.ts} +195 -135
- package/dist/{production/index-react-server-client-BIz4AUNd.d.mts → development/index-react-server-client-rcoGPJhU.d.mts} +137 -78
- package/dist/development/index-react-server-client.d.mts +2 -3
- package/dist/development/index-react-server-client.d.ts +2 -2
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.d.mts +107 -3
- package/dist/development/index-react-server.d.ts +107 -3
- package/dist/development/index-react-server.js +259 -13
- package/dist/development/index-react-server.mjs +259 -13
- package/dist/development/index.d.mts +14 -320
- package/dist/development/index.d.ts +14 -362
- package/dist/development/index.js +146 -962
- package/dist/development/index.mjs +3 -9
- package/dist/development/{routeModules-D5iJ6JYT.d.ts → instrumentation-Unc20tLk.d.ts} +178 -25
- package/dist/development/lib/types/internal.d.mts +2 -3
- package/dist/development/lib/types/internal.d.ts +2 -2
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/{production/register-C34pU-in.d.ts → development/register-BpU9rFBJ.d.ts} +1 -1
- package/dist/development/{register-CI4bTprK.d.mts → register-QkB3HGjm.d.mts} +1 -1
- package/dist/{production/context-DSyS5mLj.d.mts → development/router-CAvh_Drx.d.mts} +1877 -1254
- package/dist/production/browser-BbBXFHbO.d.ts +310 -0
- package/dist/production/browser-C07r42Tt.d.mts +310 -0
- package/dist/production/{chunk-4E5LHRQP.js → chunk-EAIF67OW.js} +1314 -138
- package/dist/production/{chunk-FR6HSPLK.mjs → chunk-FDUMZGKM.mjs} +197 -857
- package/dist/production/{chunk-3TADTUL4.mjs → chunk-FUSXQSWG.mjs} +458 -43
- package/dist/production/chunk-G5A35OQU.js +188 -0
- package/dist/production/chunk-QN64DHI4.js +1310 -0
- package/dist/production/dom-export.d.mts +103 -6
- package/dist/production/dom-export.d.ts +103 -4
- package/dist/production/dom-export.js +708 -20
- package/dist/production/dom-export.mjs +692 -11
- package/dist/{development/index-react-server-client-BIz4AUNd.d.mts → production/index-react-server-client-Da3kmxNd.d.ts} +137 -78
- package/dist/{development/index-react-server-client-BbRcBjrA.d.ts → production/index-react-server-client-rcoGPJhU.d.mts} +195 -135
- package/dist/production/index-react-server-client.d.mts +2 -3
- package/dist/production/index-react-server-client.d.ts +2 -2
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.d.mts +107 -3
- package/dist/production/index-react-server.d.ts +107 -3
- package/dist/production/index-react-server.js +259 -13
- package/dist/production/index-react-server.mjs +259 -13
- package/dist/production/index.d.mts +14 -320
- package/dist/production/index.d.ts +14 -362
- package/dist/production/index.js +146 -962
- package/dist/production/index.mjs +3 -9
- package/dist/production/{routeModules-D5iJ6JYT.d.ts → instrumentation-Unc20tLk.d.ts} +178 -25
- package/dist/production/lib/types/internal.d.mts +2 -3
- package/dist/production/lib/types/internal.d.ts +2 -2
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/{development/register-C34pU-in.d.ts → production/register-BpU9rFBJ.d.ts} +1 -1
- package/dist/production/{register-CI4bTprK.d.mts → register-QkB3HGjm.d.mts} +1 -1
- package/dist/{development/context-DSyS5mLj.d.mts → production/router-CAvh_Drx.d.mts} +1877 -1254
- package/package.json +1 -1
- package/dist/development/browser-z32v5KVN.d.mts +0 -46
- package/dist/development/chunk-72XNTZCV.js +0 -2089
- package/dist/development/route-data-DZQOUSqV.d.mts +0 -473
- package/dist/production/browser-z32v5KVN.d.mts +0 -46
- package/dist/production/chunk-WNLQ53P5.js +0 -2089
- package/dist/production/route-data-DZQOUSqV.d.mts +0 -473
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.9.
|
|
2
|
+
* react-router v7.9.6
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -454,19 +454,23 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties2, parentPath = [],
|
|
|
454
454
|
if (isIndexRoute(route)) {
|
|
455
455
|
let indexRoute = {
|
|
456
456
|
...route,
|
|
457
|
-
...mapRouteProperties2(route),
|
|
458
457
|
id
|
|
459
458
|
};
|
|
460
|
-
manifest[id] =
|
|
459
|
+
manifest[id] = mergeRouteUpdates(
|
|
460
|
+
indexRoute,
|
|
461
|
+
mapRouteProperties2(indexRoute)
|
|
462
|
+
);
|
|
461
463
|
return indexRoute;
|
|
462
464
|
} else {
|
|
463
465
|
let pathOrLayoutRoute = {
|
|
464
466
|
...route,
|
|
465
|
-
...mapRouteProperties2(route),
|
|
466
467
|
id,
|
|
467
468
|
children: void 0
|
|
468
469
|
};
|
|
469
|
-
manifest[id] =
|
|
470
|
+
manifest[id] = mergeRouteUpdates(
|
|
471
|
+
pathOrLayoutRoute,
|
|
472
|
+
mapRouteProperties2(pathOrLayoutRoute)
|
|
473
|
+
);
|
|
470
474
|
if (route.children) {
|
|
471
475
|
pathOrLayoutRoute.children = convertRoutesToDataRoutes(
|
|
472
476
|
route.children,
|
|
@@ -480,6 +484,17 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties2, 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
|
}
|
|
@@ -796,13 +811,36 @@ function prependBasename({
|
|
|
796
811
|
}) {
|
|
797
812
|
return pathname === "/" ? basename : joinPaths([basename, pathname]);
|
|
798
813
|
}
|
|
814
|
+
var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
815
|
+
var isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX.test(url);
|
|
799
816
|
function resolvePath(to, fromPathname = "/") {
|
|
800
817
|
let {
|
|
801
818
|
pathname: toPathname,
|
|
802
819
|
search = "",
|
|
803
820
|
hash = ""
|
|
804
821
|
} = typeof to === "string" ? parsePath(to) : to;
|
|
805
|
-
let pathname
|
|
822
|
+
let pathname;
|
|
823
|
+
if (toPathname) {
|
|
824
|
+
if (isAbsoluteUrl(toPathname)) {
|
|
825
|
+
pathname = toPathname;
|
|
826
|
+
} else {
|
|
827
|
+
if (toPathname.includes("//")) {
|
|
828
|
+
let oldPathname = toPathname;
|
|
829
|
+
toPathname = toPathname.replace(/\/\/+/g, "/");
|
|
830
|
+
warning(
|
|
831
|
+
false,
|
|
832
|
+
`Pathnames cannot have embedded double slashes - normalizing ${oldPathname} -> ${toPathname}`
|
|
833
|
+
);
|
|
834
|
+
}
|
|
835
|
+
if (toPathname.startsWith("/")) {
|
|
836
|
+
pathname = resolvePathname(toPathname.substring(1), "/");
|
|
837
|
+
} else {
|
|
838
|
+
pathname = resolvePathname(toPathname, fromPathname);
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
} else {
|
|
842
|
+
pathname = fromPathname;
|
|
843
|
+
}
|
|
806
844
|
return {
|
|
807
845
|
pathname,
|
|
808
846
|
search: normalizeSearch(search),
|
|
@@ -935,6 +973,277 @@ var ErrorResponseImpl = class {
|
|
|
935
973
|
function isRouteErrorResponse(error) {
|
|
936
974
|
return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
|
|
937
975
|
}
|
|
976
|
+
function getRoutePattern(paths) {
|
|
977
|
+
return paths.filter(Boolean).join("/").replace(/\/\/*/g, "/") || "/";
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
// lib/router/instrumentation.ts
|
|
981
|
+
var UninstrumentedSymbol = Symbol("Uninstrumented");
|
|
982
|
+
function getRouteInstrumentationUpdates(fns, route) {
|
|
983
|
+
let aggregated = {
|
|
984
|
+
lazy: [],
|
|
985
|
+
"lazy.loader": [],
|
|
986
|
+
"lazy.action": [],
|
|
987
|
+
"lazy.middleware": [],
|
|
988
|
+
middleware: [],
|
|
989
|
+
loader: [],
|
|
990
|
+
action: []
|
|
991
|
+
};
|
|
992
|
+
fns.forEach(
|
|
993
|
+
(fn) => fn({
|
|
994
|
+
id: route.id,
|
|
995
|
+
index: route.index,
|
|
996
|
+
path: route.path,
|
|
997
|
+
instrument(i) {
|
|
998
|
+
let keys = Object.keys(aggregated);
|
|
999
|
+
for (let key of keys) {
|
|
1000
|
+
if (i[key]) {
|
|
1001
|
+
aggregated[key].push(i[key]);
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
})
|
|
1006
|
+
);
|
|
1007
|
+
let updates = {};
|
|
1008
|
+
if (typeof route.lazy === "function" && aggregated.lazy.length > 0) {
|
|
1009
|
+
let instrumented = wrapImpl(aggregated.lazy, route.lazy, () => void 0);
|
|
1010
|
+
if (instrumented) {
|
|
1011
|
+
updates.lazy = instrumented;
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
if (typeof route.lazy === "object") {
|
|
1015
|
+
let lazyObject = route.lazy;
|
|
1016
|
+
["middleware", "loader", "action"].forEach((key) => {
|
|
1017
|
+
let lazyFn = lazyObject[key];
|
|
1018
|
+
let instrumentations = aggregated[`lazy.${key}`];
|
|
1019
|
+
if (typeof lazyFn === "function" && instrumentations.length > 0) {
|
|
1020
|
+
let instrumented = wrapImpl(instrumentations, lazyFn, () => void 0);
|
|
1021
|
+
if (instrumented) {
|
|
1022
|
+
updates.lazy = Object.assign(updates.lazy || {}, {
|
|
1023
|
+
[key]: instrumented
|
|
1024
|
+
});
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
["loader", "action"].forEach((key) => {
|
|
1030
|
+
let handler = route[key];
|
|
1031
|
+
if (typeof handler === "function" && aggregated[key].length > 0) {
|
|
1032
|
+
let original = handler[UninstrumentedSymbol] ?? handler;
|
|
1033
|
+
let instrumented = wrapImpl(
|
|
1034
|
+
aggregated[key],
|
|
1035
|
+
original,
|
|
1036
|
+
(...args) => getHandlerInfo(args[0])
|
|
1037
|
+
);
|
|
1038
|
+
if (instrumented) {
|
|
1039
|
+
instrumented[UninstrumentedSymbol] = original;
|
|
1040
|
+
updates[key] = instrumented;
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
});
|
|
1044
|
+
if (route.middleware && route.middleware.length > 0 && aggregated.middleware.length > 0) {
|
|
1045
|
+
updates.middleware = route.middleware.map((middleware) => {
|
|
1046
|
+
let original = middleware[UninstrumentedSymbol] ?? middleware;
|
|
1047
|
+
let instrumented = wrapImpl(
|
|
1048
|
+
aggregated.middleware,
|
|
1049
|
+
original,
|
|
1050
|
+
(...args) => getHandlerInfo(args[0])
|
|
1051
|
+
);
|
|
1052
|
+
if (instrumented) {
|
|
1053
|
+
instrumented[UninstrumentedSymbol] = original;
|
|
1054
|
+
return instrumented;
|
|
1055
|
+
}
|
|
1056
|
+
return middleware;
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1059
|
+
return updates;
|
|
1060
|
+
}
|
|
1061
|
+
function instrumentClientSideRouter(router, fns) {
|
|
1062
|
+
let aggregated = {
|
|
1063
|
+
navigate: [],
|
|
1064
|
+
fetch: []
|
|
1065
|
+
};
|
|
1066
|
+
fns.forEach(
|
|
1067
|
+
(fn) => fn({
|
|
1068
|
+
instrument(i) {
|
|
1069
|
+
let keys = Object.keys(i);
|
|
1070
|
+
for (let key of keys) {
|
|
1071
|
+
if (i[key]) {
|
|
1072
|
+
aggregated[key].push(i[key]);
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
})
|
|
1077
|
+
);
|
|
1078
|
+
if (aggregated.navigate.length > 0) {
|
|
1079
|
+
let navigate = router.navigate[UninstrumentedSymbol] ?? router.navigate;
|
|
1080
|
+
let instrumentedNavigate = wrapImpl(
|
|
1081
|
+
aggregated.navigate,
|
|
1082
|
+
navigate,
|
|
1083
|
+
(...args) => {
|
|
1084
|
+
let [to, opts] = args;
|
|
1085
|
+
return {
|
|
1086
|
+
to: typeof to === "number" || typeof to === "string" ? to : to ? createPath(to) : ".",
|
|
1087
|
+
...getRouterInfo(router, opts ?? {})
|
|
1088
|
+
};
|
|
1089
|
+
}
|
|
1090
|
+
);
|
|
1091
|
+
if (instrumentedNavigate) {
|
|
1092
|
+
instrumentedNavigate[UninstrumentedSymbol] = navigate;
|
|
1093
|
+
router.navigate = instrumentedNavigate;
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
if (aggregated.fetch.length > 0) {
|
|
1097
|
+
let fetch2 = router.fetch[UninstrumentedSymbol] ?? router.fetch;
|
|
1098
|
+
let instrumentedFetch = wrapImpl(aggregated.fetch, fetch2, (...args) => {
|
|
1099
|
+
let [key, , href, opts] = args;
|
|
1100
|
+
return {
|
|
1101
|
+
href: href ?? ".",
|
|
1102
|
+
fetcherKey: key,
|
|
1103
|
+
...getRouterInfo(router, opts ?? {})
|
|
1104
|
+
};
|
|
1105
|
+
});
|
|
1106
|
+
if (instrumentedFetch) {
|
|
1107
|
+
instrumentedFetch[UninstrumentedSymbol] = fetch2;
|
|
1108
|
+
router.fetch = instrumentedFetch;
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
return router;
|
|
1112
|
+
}
|
|
1113
|
+
function instrumentHandler(handler, fns) {
|
|
1114
|
+
let aggregated = {
|
|
1115
|
+
request: []
|
|
1116
|
+
};
|
|
1117
|
+
fns.forEach(
|
|
1118
|
+
(fn) => fn({
|
|
1119
|
+
instrument(i) {
|
|
1120
|
+
let keys = Object.keys(i);
|
|
1121
|
+
for (let key of keys) {
|
|
1122
|
+
if (i[key]) {
|
|
1123
|
+
aggregated[key].push(i[key]);
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
})
|
|
1128
|
+
);
|
|
1129
|
+
let instrumentedHandler = handler;
|
|
1130
|
+
if (aggregated.request.length > 0) {
|
|
1131
|
+
instrumentedHandler = wrapImpl(aggregated.request, handler, (...args) => {
|
|
1132
|
+
let [request, context] = args;
|
|
1133
|
+
return {
|
|
1134
|
+
request: getReadonlyRequest(request),
|
|
1135
|
+
context: context != null ? getReadonlyContext(context) : context
|
|
1136
|
+
};
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1139
|
+
return instrumentedHandler;
|
|
1140
|
+
}
|
|
1141
|
+
function wrapImpl(impls, handler, getInfo) {
|
|
1142
|
+
if (impls.length === 0) {
|
|
1143
|
+
return null;
|
|
1144
|
+
}
|
|
1145
|
+
return async (...args) => {
|
|
1146
|
+
let result = await recurseRight(
|
|
1147
|
+
impls,
|
|
1148
|
+
getInfo(...args),
|
|
1149
|
+
() => handler(...args),
|
|
1150
|
+
impls.length - 1
|
|
1151
|
+
);
|
|
1152
|
+
if (result.type === "error") {
|
|
1153
|
+
throw result.value;
|
|
1154
|
+
}
|
|
1155
|
+
return result.value;
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1158
|
+
async function recurseRight(impls, info, handler, index) {
|
|
1159
|
+
let impl = impls[index];
|
|
1160
|
+
let result;
|
|
1161
|
+
if (!impl) {
|
|
1162
|
+
try {
|
|
1163
|
+
let value = await handler();
|
|
1164
|
+
result = { type: "success", value };
|
|
1165
|
+
} catch (e) {
|
|
1166
|
+
result = { type: "error", value: e };
|
|
1167
|
+
}
|
|
1168
|
+
} else {
|
|
1169
|
+
let handlerPromise = void 0;
|
|
1170
|
+
let callHandler = async () => {
|
|
1171
|
+
if (handlerPromise) {
|
|
1172
|
+
console.error("You cannot call instrumented handlers more than once");
|
|
1173
|
+
} else {
|
|
1174
|
+
handlerPromise = recurseRight(impls, info, handler, index - 1);
|
|
1175
|
+
}
|
|
1176
|
+
result = await handlerPromise;
|
|
1177
|
+
invariant(result, "Expected a result");
|
|
1178
|
+
if (result.type === "error" && result.value instanceof Error) {
|
|
1179
|
+
return { status: "error", error: result.value };
|
|
1180
|
+
}
|
|
1181
|
+
return { status: "success", error: void 0 };
|
|
1182
|
+
};
|
|
1183
|
+
try {
|
|
1184
|
+
await impl(callHandler, info);
|
|
1185
|
+
} catch (e) {
|
|
1186
|
+
console.error("An instrumentation function threw an error:", e);
|
|
1187
|
+
}
|
|
1188
|
+
if (!handlerPromise) {
|
|
1189
|
+
await callHandler();
|
|
1190
|
+
}
|
|
1191
|
+
await handlerPromise;
|
|
1192
|
+
}
|
|
1193
|
+
if (result) {
|
|
1194
|
+
return result;
|
|
1195
|
+
}
|
|
1196
|
+
return {
|
|
1197
|
+
type: "error",
|
|
1198
|
+
value: new Error("No result assigned in instrumentation chain.")
|
|
1199
|
+
};
|
|
1200
|
+
}
|
|
1201
|
+
function getHandlerInfo(args) {
|
|
1202
|
+
let { request, context, params, unstable_pattern } = args;
|
|
1203
|
+
return {
|
|
1204
|
+
request: getReadonlyRequest(request),
|
|
1205
|
+
params: { ...params },
|
|
1206
|
+
unstable_pattern,
|
|
1207
|
+
context: getReadonlyContext(context)
|
|
1208
|
+
};
|
|
1209
|
+
}
|
|
1210
|
+
function getRouterInfo(router, opts) {
|
|
1211
|
+
return {
|
|
1212
|
+
currentUrl: createPath(router.state.location),
|
|
1213
|
+
..."formMethod" in opts ? { formMethod: opts.formMethod } : {},
|
|
1214
|
+
..."formEncType" in opts ? { formEncType: opts.formEncType } : {},
|
|
1215
|
+
..."formData" in opts ? { formData: opts.formData } : {},
|
|
1216
|
+
..."body" in opts ? { body: opts.body } : {}
|
|
1217
|
+
};
|
|
1218
|
+
}
|
|
1219
|
+
function getReadonlyRequest(request) {
|
|
1220
|
+
return {
|
|
1221
|
+
method: request.method,
|
|
1222
|
+
url: request.url,
|
|
1223
|
+
headers: {
|
|
1224
|
+
get: (...args) => request.headers.get(...args)
|
|
1225
|
+
}
|
|
1226
|
+
};
|
|
1227
|
+
}
|
|
1228
|
+
function getReadonlyContext(context) {
|
|
1229
|
+
if (isPlainObject(context)) {
|
|
1230
|
+
let frozen = { ...context };
|
|
1231
|
+
Object.freeze(frozen);
|
|
1232
|
+
return frozen;
|
|
1233
|
+
} else {
|
|
1234
|
+
return {
|
|
1235
|
+
get: (ctx) => context.get(ctx)
|
|
1236
|
+
};
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
var objectProtoNames = Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
|
|
1240
|
+
function isPlainObject(thing) {
|
|
1241
|
+
if (thing === null || typeof thing !== "object") {
|
|
1242
|
+
return false;
|
|
1243
|
+
}
|
|
1244
|
+
const proto = Object.getPrototypeOf(thing);
|
|
1245
|
+
return proto === Object.prototype || proto === null || Object.getOwnPropertyNames(proto).sort().join("\0") === objectProtoNames;
|
|
1246
|
+
}
|
|
938
1247
|
|
|
939
1248
|
// lib/router/router.ts
|
|
940
1249
|
var validMutationMethodsArr = [
|
|
@@ -979,8 +1288,6 @@ var IDLE_BLOCKER = {
|
|
|
979
1288
|
reset: void 0,
|
|
980
1289
|
location: void 0
|
|
981
1290
|
};
|
|
982
|
-
var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
983
|
-
var isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX.test(url);
|
|
984
1291
|
var defaultMapRouteProperties = (route) => ({
|
|
985
1292
|
hasErrorBoundary: Boolean(route.hasErrorBoundary)
|
|
986
1293
|
});
|
|
@@ -994,7 +1301,20 @@ function createRouter(init) {
|
|
|
994
1301
|
"You must provide a non-empty routes array to createRouter"
|
|
995
1302
|
);
|
|
996
1303
|
let hydrationRouteProperties2 = init.hydrationRouteProperties || [];
|
|
997
|
-
let
|
|
1304
|
+
let _mapRouteProperties = init.mapRouteProperties || defaultMapRouteProperties;
|
|
1305
|
+
let mapRouteProperties2 = _mapRouteProperties;
|
|
1306
|
+
if (init.unstable_instrumentations) {
|
|
1307
|
+
let instrumentations = init.unstable_instrumentations;
|
|
1308
|
+
mapRouteProperties2 = (route) => {
|
|
1309
|
+
return {
|
|
1310
|
+
..._mapRouteProperties(route),
|
|
1311
|
+
...getRouteInstrumentationUpdates(
|
|
1312
|
+
instrumentations.map((i) => i.route).filter(Boolean),
|
|
1313
|
+
route
|
|
1314
|
+
)
|
|
1315
|
+
};
|
|
1316
|
+
};
|
|
1317
|
+
}
|
|
998
1318
|
let manifest = {};
|
|
999
1319
|
let dataRoutes = convertRoutesToDataRoutes(
|
|
1000
1320
|
init.routes,
|
|
@@ -2007,6 +2327,14 @@ function createRouter(init) {
|
|
|
2007
2327
|
key
|
|
2008
2328
|
);
|
|
2009
2329
|
let actionResult = actionResults[match.route.id];
|
|
2330
|
+
if (!actionResult) {
|
|
2331
|
+
for (let match2 of fetchMatches) {
|
|
2332
|
+
if (actionResults[match2.route.id]) {
|
|
2333
|
+
actionResult = actionResults[match2.route.id];
|
|
2334
|
+
break;
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2010
2338
|
if (fetchRequest.signal.aborted) {
|
|
2011
2339
|
if (fetchControllers.get(key) === abortController) {
|
|
2012
2340
|
fetchControllers.delete(key);
|
|
@@ -2663,23 +2991,43 @@ function createRouter(init) {
|
|
|
2663
2991
|
return { type: "aborted" };
|
|
2664
2992
|
}
|
|
2665
2993
|
let newMatches = matchRoutes(routesToUse, pathname, basename);
|
|
2994
|
+
let newPartialMatches = null;
|
|
2666
2995
|
if (newMatches) {
|
|
2667
|
-
|
|
2996
|
+
if (Object.keys(newMatches[0].params).length === 0) {
|
|
2997
|
+
return { type: "success", matches: newMatches };
|
|
2998
|
+
} else {
|
|
2999
|
+
newPartialMatches = matchRoutesImpl(
|
|
3000
|
+
routesToUse,
|
|
3001
|
+
pathname,
|
|
3002
|
+
basename,
|
|
3003
|
+
true
|
|
3004
|
+
);
|
|
3005
|
+
let matchedDeeper = newPartialMatches && partialMatches.length < newPartialMatches.length && compareMatches(
|
|
3006
|
+
partialMatches,
|
|
3007
|
+
newPartialMatches.slice(0, partialMatches.length)
|
|
3008
|
+
);
|
|
3009
|
+
if (!matchedDeeper) {
|
|
3010
|
+
return { type: "success", matches: newMatches };
|
|
3011
|
+
}
|
|
3012
|
+
}
|
|
2668
3013
|
}
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
)) {
|
|
3014
|
+
if (!newPartialMatches) {
|
|
3015
|
+
newPartialMatches = matchRoutesImpl(
|
|
3016
|
+
routesToUse,
|
|
3017
|
+
pathname,
|
|
3018
|
+
basename,
|
|
3019
|
+
true
|
|
3020
|
+
);
|
|
3021
|
+
}
|
|
3022
|
+
if (!newPartialMatches || compareMatches(partialMatches, newPartialMatches)) {
|
|
2678
3023
|
return { type: "success", matches: null };
|
|
2679
3024
|
}
|
|
2680
3025
|
partialMatches = newPartialMatches;
|
|
2681
3026
|
}
|
|
2682
3027
|
}
|
|
3028
|
+
function compareMatches(a, b) {
|
|
3029
|
+
return a.length === b.length && a.every((m, i) => m.route.id === b[i].route.id);
|
|
3030
|
+
}
|
|
2683
3031
|
function _internalSetRoutes(newRoutes) {
|
|
2684
3032
|
manifest = {};
|
|
2685
3033
|
inFlightDataRoutes = convertRoutesToDataRoutes(
|
|
@@ -2746,6 +3094,12 @@ function createRouter(init) {
|
|
|
2746
3094
|
updateState(newState);
|
|
2747
3095
|
}
|
|
2748
3096
|
};
|
|
3097
|
+
if (init.unstable_instrumentations) {
|
|
3098
|
+
router = instrumentClientSideRouter(
|
|
3099
|
+
router,
|
|
3100
|
+
init.unstable_instrumentations.map((i) => i.router).filter(Boolean)
|
|
3101
|
+
);
|
|
3102
|
+
}
|
|
2749
3103
|
return router;
|
|
2750
3104
|
}
|
|
2751
3105
|
function createStaticHandler(routes, opts) {
|
|
@@ -2755,7 +3109,20 @@ function createStaticHandler(routes, opts) {
|
|
|
2755
3109
|
);
|
|
2756
3110
|
let manifest = {};
|
|
2757
3111
|
let basename = (opts ? opts.basename : null) || "/";
|
|
2758
|
-
let
|
|
3112
|
+
let _mapRouteProperties = opts?.mapRouteProperties || defaultMapRouteProperties;
|
|
3113
|
+
let mapRouteProperties2 = _mapRouteProperties;
|
|
3114
|
+
if (opts?.unstable_instrumentations) {
|
|
3115
|
+
let instrumentations = opts.unstable_instrumentations;
|
|
3116
|
+
mapRouteProperties2 = (route) => {
|
|
3117
|
+
return {
|
|
3118
|
+
..._mapRouteProperties(route),
|
|
3119
|
+
...getRouteInstrumentationUpdates(
|
|
3120
|
+
instrumentations.map((i) => i.route).filter(Boolean),
|
|
3121
|
+
route
|
|
3122
|
+
)
|
|
3123
|
+
};
|
|
3124
|
+
};
|
|
3125
|
+
}
|
|
2759
3126
|
let dataRoutes = convertRoutesToDataRoutes(
|
|
2760
3127
|
routes,
|
|
2761
3128
|
mapRouteProperties2,
|
|
@@ -2825,6 +3192,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2825
3192
|
let response = await runServerMiddlewarePipeline(
|
|
2826
3193
|
{
|
|
2827
3194
|
request,
|
|
3195
|
+
unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
2828
3196
|
matches,
|
|
2829
3197
|
params: matches[0].params,
|
|
2830
3198
|
// If we're calling middleware then it must be enabled so we can cast
|
|
@@ -2970,6 +3338,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2970
3338
|
let response = await runServerMiddlewarePipeline(
|
|
2971
3339
|
{
|
|
2972
3340
|
request,
|
|
3341
|
+
unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
2973
3342
|
matches,
|
|
2974
3343
|
params: matches[0].params,
|
|
2975
3344
|
// If we're calling middleware then it must be enabled so we can cast
|
|
@@ -3245,12 +3614,14 @@ function createStaticHandler(routes, opts) {
|
|
|
3245
3614
|
// Up to but not including the boundary
|
|
3246
3615
|
matches.findIndex((m) => m.route.id === pendingActionResult[0]) - 1
|
|
3247
3616
|
) : void 0;
|
|
3617
|
+
let pattern = getRoutePattern(matches.map((m) => m.route.path));
|
|
3248
3618
|
dsMatches = matches.map((match, index) => {
|
|
3249
3619
|
if (maxIdx != null && index > maxIdx) {
|
|
3250
3620
|
return getDataStrategyMatch(
|
|
3251
3621
|
mapRouteProperties2,
|
|
3252
3622
|
manifest,
|
|
3253
3623
|
request,
|
|
3624
|
+
pattern,
|
|
3254
3625
|
match,
|
|
3255
3626
|
[],
|
|
3256
3627
|
requestContext,
|
|
@@ -3261,6 +3632,7 @@ function createStaticHandler(routes, opts) {
|
|
|
3261
3632
|
mapRouteProperties2,
|
|
3262
3633
|
manifest,
|
|
3263
3634
|
request,
|
|
3635
|
+
pattern,
|
|
3264
3636
|
match,
|
|
3265
3637
|
[],
|
|
3266
3638
|
requestContext,
|
|
@@ -3541,6 +3913,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
|
|
|
3541
3913
|
actionResult,
|
|
3542
3914
|
actionStatus
|
|
3543
3915
|
};
|
|
3916
|
+
let pattern = getRoutePattern(matches.map((m) => m.route.path));
|
|
3544
3917
|
let dsMatches = matches.map((match, index) => {
|
|
3545
3918
|
let { route } = match;
|
|
3546
3919
|
let forceShouldLoad = null;
|
|
@@ -3564,6 +3937,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
|
|
|
3564
3937
|
mapRouteProperties2,
|
|
3565
3938
|
manifest,
|
|
3566
3939
|
request,
|
|
3940
|
+
pattern,
|
|
3567
3941
|
match,
|
|
3568
3942
|
lazyRoutePropertiesToSkip,
|
|
3569
3943
|
scopedContext,
|
|
@@ -3584,6 +3958,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
|
|
|
3584
3958
|
mapRouteProperties2,
|
|
3585
3959
|
manifest,
|
|
3586
3960
|
request,
|
|
3961
|
+
pattern,
|
|
3587
3962
|
match,
|
|
3588
3963
|
lazyRoutePropertiesToSkip,
|
|
3589
3964
|
scopedContext,
|
|
@@ -4037,12 +4412,17 @@ function runClientMiddlewarePipeline(args, handler) {
|
|
|
4037
4412
|
}
|
|
4038
4413
|
}
|
|
4039
4414
|
async function runMiddlewarePipeline(args, handler, processResult, isResult, errorHandler) {
|
|
4040
|
-
let { matches, request, params, context } = args;
|
|
4415
|
+
let { matches, request, params, context, unstable_pattern } = args;
|
|
4041
4416
|
let tuples = matches.flatMap(
|
|
4042
4417
|
(m) => m.route.middleware ? m.route.middleware.map((fn) => [m.route.id, fn]) : []
|
|
4043
4418
|
);
|
|
4044
4419
|
let result = await callRouteMiddleware(
|
|
4045
|
-
{
|
|
4420
|
+
{
|
|
4421
|
+
request,
|
|
4422
|
+
params,
|
|
4423
|
+
context,
|
|
4424
|
+
unstable_pattern
|
|
4425
|
+
},
|
|
4046
4426
|
tuples,
|
|
4047
4427
|
handler,
|
|
4048
4428
|
processResult,
|
|
@@ -4120,7 +4500,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties2, manifest, request
|
|
|
4120
4500
|
handler: lazyRoutePromises.lazyHandlerPromise
|
|
4121
4501
|
};
|
|
4122
4502
|
}
|
|
4123
|
-
function getDataStrategyMatch(mapRouteProperties2, manifest, request, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, unstable_shouldRevalidateArgs = null) {
|
|
4503
|
+
function getDataStrategyMatch(mapRouteProperties2, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, unstable_shouldRevalidateArgs = null) {
|
|
4124
4504
|
let isUsingNewApi = false;
|
|
4125
4505
|
let _lazyPromises = getDataStrategyMatchLazyPromises(
|
|
4126
4506
|
mapRouteProperties2,
|
|
@@ -4151,9 +4531,10 @@ function getDataStrategyMatch(mapRouteProperties2, manifest, request, match, laz
|
|
|
4151
4531
|
let { lazy, loader, middleware } = match.route;
|
|
4152
4532
|
let callHandler = isUsingNewApi || shouldLoad || handlerOverride && !isMutationMethod(request.method) && (lazy || loader);
|
|
4153
4533
|
let isMiddlewareOnlyRoute = middleware && middleware.length > 0 && !loader && !lazy;
|
|
4154
|
-
if (callHandler && !isMiddlewareOnlyRoute) {
|
|
4534
|
+
if (callHandler && (isMutationMethod(request.method) || !isMiddlewareOnlyRoute)) {
|
|
4155
4535
|
return callLoaderOrAction({
|
|
4156
4536
|
request,
|
|
4537
|
+
unstable_pattern,
|
|
4157
4538
|
match,
|
|
4158
4539
|
lazyHandlerPromise: _lazyPromises?.handler,
|
|
4159
4540
|
lazyRoutePromise: _lazyPromises?.route,
|
|
@@ -4187,6 +4568,7 @@ function getTargetedDataStrategyMatches(mapRouteProperties2, manifest, request,
|
|
|
4187
4568
|
mapRouteProperties2,
|
|
4188
4569
|
manifest,
|
|
4189
4570
|
request,
|
|
4571
|
+
getRoutePattern(matches.map((m) => m.route.path)),
|
|
4190
4572
|
match,
|
|
4191
4573
|
lazyRoutePropertiesToSkip,
|
|
4192
4574
|
scopedContext,
|
|
@@ -4201,6 +4583,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
4201
4583
|
}
|
|
4202
4584
|
let dataStrategyArgs = {
|
|
4203
4585
|
request,
|
|
4586
|
+
unstable_pattern: getRoutePattern(matches.map((m) => m.route.path)),
|
|
4204
4587
|
params: matches[0].params,
|
|
4205
4588
|
context: scopedContext,
|
|
4206
4589
|
matches
|
|
@@ -4241,6 +4624,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
4241
4624
|
}
|
|
4242
4625
|
async function callLoaderOrAction({
|
|
4243
4626
|
request,
|
|
4627
|
+
unstable_pattern,
|
|
4244
4628
|
match,
|
|
4245
4629
|
lazyHandlerPromise,
|
|
4246
4630
|
lazyRoutePromise,
|
|
@@ -4267,6 +4651,7 @@ async function callLoaderOrAction({
|
|
|
4267
4651
|
return handler(
|
|
4268
4652
|
{
|
|
4269
4653
|
request,
|
|
4654
|
+
unstable_pattern,
|
|
4270
4655
|
params: match.params,
|
|
4271
4656
|
context: scopedContext
|
|
4272
4657
|
},
|
|
@@ -5253,8 +5638,8 @@ var RenderErrorBoundary = class extends React2.Component {
|
|
|
5253
5638
|
};
|
|
5254
5639
|
}
|
|
5255
5640
|
componentDidCatch(error, errorInfo) {
|
|
5256
|
-
if (this.props.
|
|
5257
|
-
this.props.
|
|
5641
|
+
if (this.props.onError) {
|
|
5642
|
+
this.props.onError(error, errorInfo);
|
|
5258
5643
|
} else {
|
|
5259
5644
|
console.error(
|
|
5260
5645
|
"React Router caught the following error during render",
|
|
@@ -5332,6 +5717,13 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, uns
|
|
|
5332
5717
|
}
|
|
5333
5718
|
}
|
|
5334
5719
|
}
|
|
5720
|
+
let onError = dataRouterState && unstable_onError ? (error, errorInfo) => {
|
|
5721
|
+
unstable_onError(error, {
|
|
5722
|
+
location: dataRouterState.location,
|
|
5723
|
+
params: dataRouterState.matches?.[0]?.params ?? {},
|
|
5724
|
+
errorInfo
|
|
5725
|
+
});
|
|
5726
|
+
} : void 0;
|
|
5335
5727
|
return renderedMatches.reduceRight(
|
|
5336
5728
|
(outlet, match, index) => {
|
|
5337
5729
|
let error;
|
|
@@ -5392,7 +5784,7 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, uns
|
|
|
5392
5784
|
error,
|
|
5393
5785
|
children: getChildren(),
|
|
5394
5786
|
routeContext: { outlet: null, matches: matches2, isDataRoute: true },
|
|
5395
|
-
|
|
5787
|
+
onError
|
|
5396
5788
|
}
|
|
5397
5789
|
) : getChildren();
|
|
5398
5790
|
},
|
|
@@ -5557,10 +5949,11 @@ function useRoute(...args) {
|
|
|
5557
5949
|
"useRoute" /* UseRoute */
|
|
5558
5950
|
);
|
|
5559
5951
|
const id = args[0] ?? currentRouteId;
|
|
5560
|
-
const state = useDataRouterState("
|
|
5952
|
+
const state = useDataRouterState("useRoute" /* UseRoute */);
|
|
5561
5953
|
const route = state.matches.find(({ route: route2 }) => route2.id === id);
|
|
5562
5954
|
if (route === void 0) return void 0;
|
|
5563
5955
|
return {
|
|
5956
|
+
handle: route.route.handle,
|
|
5564
5957
|
loaderData: state.loaderData[id],
|
|
5565
5958
|
actionData: state.actionData?.[id]
|
|
5566
5959
|
};
|
|
@@ -5647,7 +6040,8 @@ function createMemoryRouter(routes, opts) {
|
|
|
5647
6040
|
hydrationRouteProperties,
|
|
5648
6041
|
mapRouteProperties,
|
|
5649
6042
|
dataStrategy: opts?.dataStrategy,
|
|
5650
|
-
patchRoutesOnNavigation: opts?.patchRoutesOnNavigation
|
|
6043
|
+
patchRoutesOnNavigation: opts?.patchRoutesOnNavigation,
|
|
6044
|
+
unstable_instrumentations: opts?.unstable_instrumentations
|
|
5651
6045
|
}).initialize();
|
|
5652
6046
|
}
|
|
5653
6047
|
var Deferred = class {
|
|
@@ -5802,7 +6196,10 @@ function RouterProvider({
|
|
|
5802
6196
|
if (newState.errors && unstable_onError) {
|
|
5803
6197
|
Object.entries(newState.errors).forEach(([routeId, error]) => {
|
|
5804
6198
|
if (prevState.errors?.[routeId] !== error) {
|
|
5805
|
-
unstable_onError(error
|
|
6199
|
+
unstable_onError(error, {
|
|
6200
|
+
location: newState.location,
|
|
6201
|
+
params: newState.matches[0]?.params ?? {}
|
|
6202
|
+
});
|
|
5806
6203
|
}
|
|
5807
6204
|
});
|
|
5808
6205
|
}
|
|
@@ -6131,12 +6528,25 @@ function Await({
|
|
|
6131
6528
|
resolve
|
|
6132
6529
|
}) {
|
|
6133
6530
|
let dataRouterContext = React3.useContext(DataRouterContext);
|
|
6531
|
+
let dataRouterStateContext = React3.useContext(DataRouterStateContext);
|
|
6532
|
+
let onError = React3.useCallback(
|
|
6533
|
+
(error, errorInfo) => {
|
|
6534
|
+
if (dataRouterContext && dataRouterContext.unstable_onError && dataRouterStateContext) {
|
|
6535
|
+
dataRouterContext.unstable_onError(error, {
|
|
6536
|
+
location: dataRouterStateContext.location,
|
|
6537
|
+
params: dataRouterStateContext.matches?.[0]?.params || {},
|
|
6538
|
+
errorInfo
|
|
6539
|
+
});
|
|
6540
|
+
}
|
|
6541
|
+
},
|
|
6542
|
+
[dataRouterContext, dataRouterStateContext]
|
|
6543
|
+
);
|
|
6134
6544
|
return /* @__PURE__ */ React3.createElement(
|
|
6135
6545
|
AwaitErrorBoundary,
|
|
6136
6546
|
{
|
|
6137
6547
|
resolve,
|
|
6138
6548
|
errorElement,
|
|
6139
|
-
|
|
6549
|
+
onError
|
|
6140
6550
|
},
|
|
6141
6551
|
/* @__PURE__ */ React3.createElement(ResolveAwait, null, children)
|
|
6142
6552
|
);
|
|
@@ -6150,8 +6560,8 @@ var AwaitErrorBoundary = class extends React3.Component {
|
|
|
6150
6560
|
return { error };
|
|
6151
6561
|
}
|
|
6152
6562
|
componentDidCatch(error, errorInfo) {
|
|
6153
|
-
if (this.props.
|
|
6154
|
-
this.props.
|
|
6563
|
+
if (this.props.onError) {
|
|
6564
|
+
this.props.onError(error, errorInfo);
|
|
6155
6565
|
} else {
|
|
6156
6566
|
console.error(
|
|
6157
6567
|
"<Await> caught the following error during render",
|
|
@@ -6185,7 +6595,7 @@ var AwaitErrorBoundary = class extends React3.Component {
|
|
|
6185
6595
|
promise = resolve.then(
|
|
6186
6596
|
(data2) => Object.defineProperty(resolve, "_data", { get: () => data2 }),
|
|
6187
6597
|
(error) => {
|
|
6188
|
-
this.props.
|
|
6598
|
+
this.props.onError?.(error);
|
|
6189
6599
|
Object.defineProperty(resolve, "_error", { get: () => error });
|
|
6190
6600
|
}
|
|
6191
6601
|
);
|
|
@@ -6609,7 +7019,7 @@ function stringify(input, index) {
|
|
|
6609
7019
|
str[index2] += "]";
|
|
6610
7020
|
} else if (Object.getPrototypeOf(input2) === null) {
|
|
6611
7021
|
str[index2] = `["${TYPE_NULL_OBJECT}",{${partsForObj(input2)}}]`;
|
|
6612
|
-
} else if (
|
|
7022
|
+
} else if (isPlainObject2(input2)) {
|
|
6613
7023
|
str[index2] = `{${partsForObj(input2)}}`;
|
|
6614
7024
|
} else {
|
|
6615
7025
|
error = new Error("Cannot encode object with prototype");
|
|
@@ -6663,10 +7073,10 @@ function stringify(input, index) {
|
|
|
6663
7073
|
}
|
|
6664
7074
|
}
|
|
6665
7075
|
}
|
|
6666
|
-
var
|
|
6667
|
-
function
|
|
7076
|
+
var objectProtoNames2 = Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
|
|
7077
|
+
function isPlainObject2(thing) {
|
|
6668
7078
|
const proto = Object.getPrototypeOf(thing);
|
|
6669
|
-
return proto === Object.prototype || proto === null || Object.getOwnPropertyNames(proto).sort().join("\0") ===
|
|
7079
|
+
return proto === Object.prototype || proto === null || Object.getOwnPropertyNames(proto).sort().join("\0") === objectProtoNames2;
|
|
6670
7080
|
}
|
|
6671
7081
|
|
|
6672
7082
|
// vendor/turbo-stream-v2/unflatten.ts
|
|
@@ -8062,7 +8472,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
8062
8472
|
let hasInitialError = initialState && initialState.errors && route.id in initialState.errors;
|
|
8063
8473
|
let initialError = hasInitialError ? initialState?.errors?.[route.id] : void 0;
|
|
8064
8474
|
let isHydrationRequest = needsRevalidation == null && (routeModule.clientLoader?.hydrate === true || !route.hasLoader);
|
|
8065
|
-
dataRoute.loader = async ({ request, params, context }, singleFetch) => {
|
|
8475
|
+
dataRoute.loader = async ({ request, params, context, unstable_pattern }, singleFetch) => {
|
|
8066
8476
|
try {
|
|
8067
8477
|
let result = await prefetchStylesAndCallHandler(async () => {
|
|
8068
8478
|
invariant2(
|
|
@@ -8076,6 +8486,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
8076
8486
|
request,
|
|
8077
8487
|
params,
|
|
8078
8488
|
context,
|
|
8489
|
+
unstable_pattern,
|
|
8079
8490
|
async serverLoader() {
|
|
8080
8491
|
preventInvalidServerHandlerCall("loader", route);
|
|
8081
8492
|
if (isHydrationRequest) {
|
|
@@ -8101,7 +8512,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
8101
8512
|
route.hasLoader,
|
|
8102
8513
|
isSpaMode
|
|
8103
8514
|
);
|
|
8104
|
-
dataRoute.action = ({ request, params, context }, singleFetch) => {
|
|
8515
|
+
dataRoute.action = ({ request, params, context, unstable_pattern }, singleFetch) => {
|
|
8105
8516
|
return prefetchStylesAndCallHandler(async () => {
|
|
8106
8517
|
invariant2(
|
|
8107
8518
|
routeModule,
|
|
@@ -8117,6 +8528,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
8117
8528
|
request,
|
|
8118
8529
|
params,
|
|
8119
8530
|
context,
|
|
8531
|
+
unstable_pattern,
|
|
8120
8532
|
async serverAction() {
|
|
8121
8533
|
preventInvalidServerHandlerCall("action", route);
|
|
8122
8534
|
return fetchServerAction(singleFetch);
|
|
@@ -9126,7 +9538,7 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
|
|
|
9126
9538
|
try {
|
|
9127
9539
|
if (isBrowser) {
|
|
9128
9540
|
window.__reactRouterVersion = // @ts-expect-error
|
|
9129
|
-
"7.9.
|
|
9541
|
+
"7.9.6";
|
|
9130
9542
|
}
|
|
9131
9543
|
} catch (e) {
|
|
9132
9544
|
}
|
|
@@ -9142,7 +9554,8 @@ function createBrowserRouter(routes, opts) {
|
|
|
9142
9554
|
hydrationRouteProperties,
|
|
9143
9555
|
dataStrategy: opts?.dataStrategy,
|
|
9144
9556
|
patchRoutesOnNavigation: opts?.patchRoutesOnNavigation,
|
|
9145
|
-
window: opts?.window
|
|
9557
|
+
window: opts?.window,
|
|
9558
|
+
unstable_instrumentations: opts?.unstable_instrumentations
|
|
9146
9559
|
}).initialize();
|
|
9147
9560
|
}
|
|
9148
9561
|
function createHashRouter(routes, opts) {
|
|
@@ -9157,7 +9570,8 @@ function createHashRouter(routes, opts) {
|
|
|
9157
9570
|
hydrationRouteProperties,
|
|
9158
9571
|
dataStrategy: opts?.dataStrategy,
|
|
9159
9572
|
patchRoutesOnNavigation: opts?.patchRoutesOnNavigation,
|
|
9160
|
-
window: opts?.window
|
|
9573
|
+
window: opts?.window,
|
|
9574
|
+
unstable_instrumentations: opts?.unstable_instrumentations
|
|
9161
9575
|
}).initialize();
|
|
9162
9576
|
}
|
|
9163
9577
|
function parseHydrationData() {
|
|
@@ -10242,6 +10656,7 @@ export {
|
|
|
10242
10656
|
replace,
|
|
10243
10657
|
ErrorResponseImpl,
|
|
10244
10658
|
isRouteErrorResponse,
|
|
10659
|
+
instrumentHandler,
|
|
10245
10660
|
IDLE_NAVIGATION,
|
|
10246
10661
|
IDLE_FETCHER,
|
|
10247
10662
|
IDLE_BLOCKER,
|