react-router 7.13.1 → 7.13.2
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 +53 -0
- package/dist/{production/browser-DzsJABDQ.d.mts → development/browser-Bfn3xw9E.d.ts} +2 -1
- package/dist/development/{browser-DzsJABDQ.d.mts → browser-Di6-vSl-.d.mts} +2 -1
- package/dist/development/{chunk-XOLAXE2Z.js → chunk-GO74ODU3.js} +190 -111
- package/dist/{production/chunk-B5UMK6O7.js → development/chunk-HPFFRPKK.js} +100 -99
- package/dist/development/{chunk-KSEWV2VO.js → chunk-LLP6DRWX.js} +7 -7
- package/dist/{production/chunk-TXB4YXR2.mjs → development/chunk-UALY5CBT.mjs} +83 -49
- package/dist/development/{chunk-LFPYN7LY.mjs → chunk-UVKPFVEO.mjs} +124 -44
- package/dist/development/context-phCt_zmH.d.mts +1713 -0
- package/dist/development/dom-export.d.mts +3 -2
- package/dist/development/dom-export.d.ts +3 -2
- package/dist/development/dom-export.js +45 -29
- package/dist/development/dom-export.mjs +21 -5
- package/dist/development/{index-react-server-client-C4tCIird.d.ts → index-react-server-client-BcrVT7Dd.d.mts} +4 -2
- package/dist/{production/index-react-server-client-EzWJGpN_.d.mts → development/index-react-server-client-CCwMoQIT.d.ts} +1067 -10
- package/dist/development/index-react-server-client.d.mts +3 -2
- package/dist/development/index-react-server-client.d.ts +3 -2
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.d.mts +293 -246
- package/dist/development/index-react-server.d.ts +293 -246
- package/dist/development/index-react-server.js +121 -43
- package/dist/development/index-react-server.mjs +121 -43
- package/dist/development/index.d.mts +15 -13
- package/dist/development/index.d.ts +15 -13
- package/dist/development/index.js +176 -142
- package/dist/development/index.mjs +3 -3
- package/dist/development/instrumentation-BYr6ff5D.d.ts +657 -0
- package/dist/development/lib/types/internal.d.mts +2 -2
- 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/development/{register-CBoanF80.d.ts → register-CTxsJBKQ.d.mts} +1 -1
- package/dist/development/{register-cRYJ3CjG.d.mts → register-CkcGwv27.d.ts} +1 -1
- package/dist/development/routeModules-BRrCYrSL.d.mts +1693 -0
- package/dist/development/routeModules-CA7kSxJJ.d.ts +1693 -0
- package/dist/production/{browser-sPQ7eaK4.d.ts → browser-Bfn3xw9E.d.ts} +2 -1
- package/dist/{development/browser-sPQ7eaK4.d.ts → production/browser-Di6-vSl-.d.mts} +2 -1
- package/dist/production/{chunk-RJCJ3EYF.mjs → chunk-2BDJPJTA.mjs} +124 -44
- package/dist/production/{chunk-ZJMCM6KT.js → chunk-CAFVLUDY.js} +7 -7
- package/dist/production/{chunk-772H4TVR.js → chunk-LKUVSIBA.js} +190 -111
- package/dist/{development/chunk-JPUPSTYD.mjs → production/chunk-PY35PE22.mjs} +83 -49
- package/dist/{development/chunk-2YMDXNOJ.js → production/chunk-XAAX7KIK.js} +100 -99
- package/dist/production/context-phCt_zmH.d.mts +1713 -0
- package/dist/production/dom-export.d.mts +3 -2
- package/dist/production/dom-export.d.ts +3 -2
- package/dist/production/dom-export.js +45 -29
- package/dist/production/dom-export.mjs +21 -5
- package/dist/{development/index-react-server-client-EzWJGpN_.d.mts → production/index-react-server-client-BcrVT7Dd.d.mts} +4 -2
- package/dist/production/{index-react-server-client-C4tCIird.d.ts → index-react-server-client-CCwMoQIT.d.ts} +1067 -10
- package/dist/production/index-react-server-client.d.mts +3 -2
- package/dist/production/index-react-server-client.d.ts +3 -2
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.d.mts +293 -246
- package/dist/production/index-react-server.d.ts +293 -246
- package/dist/production/index-react-server.js +121 -43
- package/dist/production/index-react-server.mjs +121 -43
- package/dist/production/index.d.mts +15 -13
- package/dist/production/index.d.ts +15 -13
- package/dist/production/index.js +176 -142
- package/dist/production/index.mjs +3 -3
- package/dist/production/instrumentation-BYr6ff5D.d.ts +657 -0
- package/dist/production/lib/types/internal.d.mts +2 -2
- 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/production/{register-CBoanF80.d.ts → register-CTxsJBKQ.d.mts} +1 -1
- package/dist/production/{register-cRYJ3CjG.d.mts → register-CkcGwv27.d.ts} +1 -1
- package/dist/production/routeModules-BRrCYrSL.d.mts +1693 -0
- package/dist/production/routeModules-CA7kSxJJ.d.ts +1693 -0
- package/package.json +1 -1
- package/dist/development/instrumentation--6Pioq_G.d.ts +0 -3344
- package/dist/development/router-cLsU7kHk.d.mts +0 -3344
- package/dist/production/instrumentation--6Pioq_G.d.ts +0 -3344
- package/dist/production/router-cLsU7kHk.d.mts +0 -3344
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.13.
|
|
2
|
+
* react-router v7.13.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
withComponentProps,
|
|
52
52
|
withErrorBoundaryProps,
|
|
53
53
|
withHydrateFallbackProps
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-2BDJPJTA.mjs";
|
|
55
55
|
|
|
56
56
|
// lib/dom/ssr/server.tsx
|
|
57
57
|
import * as React from "react";
|
|
@@ -137,6 +137,7 @@ function createRoutesStub(routes, _context) {
|
|
|
137
137
|
if (routerRef.current == null) {
|
|
138
138
|
frameworkContextRef.current = {
|
|
139
139
|
future: {
|
|
140
|
+
unstable_passThroughRequests: future?.unstable_passThroughRequests === true,
|
|
140
141
|
unstable_subResourceIntegrity: future?.unstable_subResourceIntegrity === true,
|
|
141
142
|
v8_middleware: future?.v8_middleware === true,
|
|
142
143
|
unstable_trailingSlashAwareDataRequests: future?.unstable_trailingSlashAwareDataRequests === true
|
|
@@ -154,7 +155,7 @@ function createRoutesStub(routes, _context) {
|
|
|
154
155
|
};
|
|
155
156
|
let patched = processRoutes(
|
|
156
157
|
// @ts-expect-error `StubRouteObject` is stricter about `loader`/`action`
|
|
157
|
-
// types compared to `
|
|
158
|
+
// types compared to `RouteObject`
|
|
158
159
|
convertRoutesToDataRoutes(routes, (r) => r),
|
|
159
160
|
_context !== void 0 ? _context : future?.v8_middleware ? new RouterContextProvider() : {},
|
|
160
161
|
frameworkContextRef.current.manifest,
|
|
@@ -505,9 +506,10 @@ function matchServerRoutes(routes, pathname, basename) {
|
|
|
505
506
|
}
|
|
506
507
|
|
|
507
508
|
// lib/server-runtime/data.ts
|
|
508
|
-
async function callRouteHandler(handler, args) {
|
|
509
|
+
async function callRouteHandler(handler, args, future) {
|
|
509
510
|
let result = await handler({
|
|
510
|
-
request: stripRoutesParam(stripIndexParam(args.request)),
|
|
511
|
+
request: future.unstable_passThroughRequests ? args.request : stripRoutesParam(stripIndexParam(args.request)),
|
|
512
|
+
unstable_url: args.unstable_url,
|
|
511
513
|
params: args.params,
|
|
512
514
|
context: args.context,
|
|
513
515
|
unstable_pattern: args.unstable_pattern
|
|
@@ -656,10 +658,14 @@ function createStaticHandlerDataRoutes(manifest, future, parentId = "", routesBy
|
|
|
656
658
|
return result.data;
|
|
657
659
|
}
|
|
658
660
|
}
|
|
659
|
-
let val = await callRouteHandler(
|
|
661
|
+
let val = await callRouteHandler(
|
|
662
|
+
route.module.loader,
|
|
663
|
+
args,
|
|
664
|
+
future
|
|
665
|
+
);
|
|
660
666
|
return val;
|
|
661
667
|
} : void 0,
|
|
662
|
-
action: route.module.action ? (args) => callRouteHandler(route.module.action, args) : void 0,
|
|
668
|
+
action: route.module.action ? (args) => callRouteHandler(route.module.action, args, future) : void 0,
|
|
663
669
|
handle: route.module.handle
|
|
664
670
|
};
|
|
665
671
|
return route.index ? {
|
|
@@ -838,6 +844,41 @@ function parseHostHeader(headers) {
|
|
|
838
844
|
} : void 0;
|
|
839
845
|
}
|
|
840
846
|
|
|
847
|
+
// lib/server-runtime/urls.ts
|
|
848
|
+
function getNormalizedPath(request, basename, future) {
|
|
849
|
+
basename = basename || "/";
|
|
850
|
+
let url = new URL(request.url);
|
|
851
|
+
let pathname = url.pathname;
|
|
852
|
+
if (future?.unstable_trailingSlashAwareDataRequests) {
|
|
853
|
+
if (pathname.endsWith("/_.data")) {
|
|
854
|
+
pathname = pathname.replace(/_\.data$/, "");
|
|
855
|
+
} else {
|
|
856
|
+
pathname = pathname.replace(/\.data$/, "");
|
|
857
|
+
}
|
|
858
|
+
} else {
|
|
859
|
+
if (stripBasename(pathname, basename) === "/_root.data") {
|
|
860
|
+
pathname = basename;
|
|
861
|
+
} else if (pathname.endsWith(".data")) {
|
|
862
|
+
pathname = pathname.replace(/\.data$/, "");
|
|
863
|
+
}
|
|
864
|
+
if (stripBasename(pathname, basename) !== "/" && pathname.endsWith("/")) {
|
|
865
|
+
pathname = pathname.slice(0, -1);
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
let searchParams = new URLSearchParams(url.search);
|
|
869
|
+
searchParams.delete("_routes");
|
|
870
|
+
let search = searchParams.toString();
|
|
871
|
+
if (search) {
|
|
872
|
+
search = `?${search}`;
|
|
873
|
+
}
|
|
874
|
+
return {
|
|
875
|
+
pathname,
|
|
876
|
+
search,
|
|
877
|
+
// No hashes on the server
|
|
878
|
+
hash: ""
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
|
|
841
882
|
// lib/server-runtime/single-fetch.ts
|
|
842
883
|
var SERVER_NO_BODY_STATUS_CODES = /* @__PURE__ */ new Set([
|
|
843
884
|
...NO_BODY_STATUS_CODES,
|
|
@@ -853,7 +894,7 @@ async function singleFetchAction(build, serverMode, staticHandler, request, hand
|
|
|
853
894
|
} catch (e) {
|
|
854
895
|
return handleQueryError(new Error("Bad Request"), 400);
|
|
855
896
|
}
|
|
856
|
-
let handlerRequest = new Request(handlerUrl, {
|
|
897
|
+
let handlerRequest = build.future.unstable_passThroughRequests ? request : new Request(handlerUrl, {
|
|
857
898
|
method: request.method,
|
|
858
899
|
body: request.body,
|
|
859
900
|
headers: request.headers,
|
|
@@ -871,7 +912,8 @@ async function singleFetchAction(build, serverMode, staticHandler, request, hand
|
|
|
871
912
|
} catch (error) {
|
|
872
913
|
return handleQueryError(error);
|
|
873
914
|
}
|
|
874
|
-
} : void 0
|
|
915
|
+
} : void 0,
|
|
916
|
+
unstable_normalizePath: (r) => getNormalizedPath(r, build.basename, build.future)
|
|
875
917
|
});
|
|
876
918
|
return handleQueryResult(result);
|
|
877
919
|
} catch (error) {
|
|
@@ -920,7 +962,7 @@ async function singleFetchLoaders(build, serverMode, staticHandler, request, han
|
|
|
920
962
|
let routesParam = new URL(request.url).searchParams.get("_routes");
|
|
921
963
|
let loadRouteIds = routesParam ? new Set(routesParam.split(",")) : null;
|
|
922
964
|
try {
|
|
923
|
-
let handlerRequest = new Request(handlerUrl, {
|
|
965
|
+
let handlerRequest = build.future.unstable_passThroughRequests ? request : new Request(handlerUrl, {
|
|
924
966
|
headers: request.headers,
|
|
925
967
|
signal: request.signal
|
|
926
968
|
});
|
|
@@ -935,7 +977,8 @@ async function singleFetchLoaders(build, serverMode, staticHandler, request, han
|
|
|
935
977
|
} catch (error) {
|
|
936
978
|
return handleQueryError(error);
|
|
937
979
|
}
|
|
938
|
-
} : void 0
|
|
980
|
+
} : void 0,
|
|
981
|
+
unstable_normalizePath: (r) => getNormalizedPath(r, build.basename, build.future)
|
|
939
982
|
});
|
|
940
983
|
return handleQueryResult(result);
|
|
941
984
|
} catch (error) {
|
|
@@ -1132,36 +1175,23 @@ function derive(build, mode) {
|
|
|
1132
1175
|
} else {
|
|
1133
1176
|
loadContext = initialContext || {};
|
|
1134
1177
|
}
|
|
1135
|
-
let
|
|
1136
|
-
let
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
} else {
|
|
1142
|
-
normalizedPath = normalizedPath.replace(/\.data$/, "");
|
|
1143
|
-
}
|
|
1144
|
-
} else {
|
|
1145
|
-
if (stripBasename(normalizedPath, normalizedBasename) === "/_root.data") {
|
|
1146
|
-
normalizedPath = normalizedBasename;
|
|
1147
|
-
} else if (normalizedPath.endsWith(".data")) {
|
|
1148
|
-
normalizedPath = normalizedPath.replace(/\.data$/, "");
|
|
1149
|
-
}
|
|
1150
|
-
if (stripBasename(normalizedPath, normalizedBasename) !== "/" && normalizedPath.endsWith("/")) {
|
|
1151
|
-
normalizedPath = normalizedPath.slice(0, -1);
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1178
|
+
let requestUrl = new URL(request.url);
|
|
1179
|
+
let normalizedPathname = getNormalizedPath(
|
|
1180
|
+
request,
|
|
1181
|
+
build.basename,
|
|
1182
|
+
build.future
|
|
1183
|
+
).pathname;
|
|
1154
1184
|
let isSpaMode = getBuildTimeHeader(request, "X-React-Router-SPA-Mode") === "yes";
|
|
1155
1185
|
if (!build.ssr) {
|
|
1156
|
-
let decodedPath = decodeURI(
|
|
1157
|
-
if (
|
|
1158
|
-
let strippedPath = stripBasename(decodedPath,
|
|
1186
|
+
let decodedPath = decodeURI(normalizedPathname);
|
|
1187
|
+
if (build.basename && build.basename !== "/") {
|
|
1188
|
+
let strippedPath = stripBasename(decodedPath, build.basename);
|
|
1159
1189
|
if (strippedPath == null) {
|
|
1160
1190
|
errorHandler(
|
|
1161
1191
|
new ErrorResponseImpl(
|
|
1162
1192
|
404,
|
|
1163
1193
|
"Not Found",
|
|
1164
|
-
`Refusing to prerender the \`${decodedPath}\` path because it does not start with the basename \`${
|
|
1194
|
+
`Refusing to prerender the \`${decodedPath}\` path because it does not start with the basename \`${build.basename}\``
|
|
1165
1195
|
),
|
|
1166
1196
|
{
|
|
1167
1197
|
context: loadContext,
|
|
@@ -1179,7 +1209,7 @@ function derive(build, mode) {
|
|
|
1179
1209
|
if (build.prerender.length === 0) {
|
|
1180
1210
|
isSpaMode = true;
|
|
1181
1211
|
} else if (!build.prerender.includes(decodedPath) && !build.prerender.includes(decodedPath + "/")) {
|
|
1182
|
-
if (
|
|
1212
|
+
if (requestUrl.pathname.endsWith(".data")) {
|
|
1183
1213
|
errorHandler(
|
|
1184
1214
|
new ErrorResponseImpl(
|
|
1185
1215
|
404,
|
|
@@ -1203,28 +1233,26 @@ function derive(build, mode) {
|
|
|
1203
1233
|
}
|
|
1204
1234
|
let manifestUrl = getManifestPath(
|
|
1205
1235
|
build.routeDiscovery.manifestPath,
|
|
1206
|
-
|
|
1236
|
+
build.basename
|
|
1207
1237
|
);
|
|
1208
|
-
if (
|
|
1238
|
+
if (requestUrl.pathname === manifestUrl) {
|
|
1209
1239
|
try {
|
|
1210
|
-
let res = await handleManifestRequest(build, routes,
|
|
1240
|
+
let res = await handleManifestRequest(build, routes, requestUrl);
|
|
1211
1241
|
return res;
|
|
1212
1242
|
} catch (e) {
|
|
1213
1243
|
handleError(e);
|
|
1214
1244
|
return new Response("Unknown Server Error", { status: 500 });
|
|
1215
1245
|
}
|
|
1216
1246
|
}
|
|
1217
|
-
let matches = matchServerRoutes(routes,
|
|
1247
|
+
let matches = matchServerRoutes(routes, normalizedPathname, build.basename);
|
|
1218
1248
|
if (matches && matches.length > 0) {
|
|
1219
1249
|
Object.assign(params, matches[0].params);
|
|
1220
1250
|
}
|
|
1221
1251
|
let response;
|
|
1222
|
-
if (
|
|
1223
|
-
let handlerUrl = new URL(request.url);
|
|
1224
|
-
handlerUrl.pathname = normalizedPath;
|
|
1252
|
+
if (requestUrl.pathname.endsWith(".data")) {
|
|
1225
1253
|
let singleFetchMatches = matchServerRoutes(
|
|
1226
1254
|
routes,
|
|
1227
|
-
|
|
1255
|
+
normalizedPathname,
|
|
1228
1256
|
build.basename
|
|
1229
1257
|
);
|
|
1230
1258
|
response = await handleSingleFetchRequest(
|
|
@@ -1232,7 +1260,7 @@ function derive(build, mode) {
|
|
|
1232
1260
|
build,
|
|
1233
1261
|
staticHandler,
|
|
1234
1262
|
request,
|
|
1235
|
-
|
|
1263
|
+
normalizedPathname,
|
|
1236
1264
|
loadContext,
|
|
1237
1265
|
handleError
|
|
1238
1266
|
);
|
|
@@ -1270,7 +1298,7 @@ function derive(build, mode) {
|
|
|
1270
1298
|
handleError
|
|
1271
1299
|
);
|
|
1272
1300
|
} else {
|
|
1273
|
-
let { pathname } =
|
|
1301
|
+
let { pathname } = requestUrl;
|
|
1274
1302
|
let criticalCss = void 0;
|
|
1275
1303
|
if (build.unstable_getCriticalCss) {
|
|
1276
1304
|
criticalCss = await build.unstable_getCriticalCss({ pathname });
|
|
@@ -1383,7 +1411,9 @@ async function handleManifestRequest(build, routes, url) {
|
|
|
1383
1411
|
}
|
|
1384
1412
|
return new Response("Invalid Request", { status: 400 });
|
|
1385
1413
|
}
|
|
1386
|
-
async function handleSingleFetchRequest(serverMode, build, staticHandler, request,
|
|
1414
|
+
async function handleSingleFetchRequest(serverMode, build, staticHandler, request, normalizedPath, loadContext, handleError) {
|
|
1415
|
+
let handlerUrl = new URL(request.url);
|
|
1416
|
+
handlerUrl.pathname = normalizedPath;
|
|
1387
1417
|
let response = request.method !== "GET" ? await singleFetchAction(
|
|
1388
1418
|
build,
|
|
1389
1419
|
serverMode,
|
|
@@ -1429,7 +1459,8 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
|
|
|
1429
1459
|
handleError(error);
|
|
1430
1460
|
return new Response(null, { status: 500 });
|
|
1431
1461
|
}
|
|
1432
|
-
} : void 0
|
|
1462
|
+
} : void 0,
|
|
1463
|
+
unstable_normalizePath: (r) => getNormalizedPath(r, build.basename, build.future)
|
|
1433
1464
|
});
|
|
1434
1465
|
if (!isResponse(result)) {
|
|
1435
1466
|
result = await renderHtml(result, isSpaMode);
|
|
@@ -1561,7 +1592,8 @@ async function handleResourceRequest(serverMode, build, staticHandler, routeId,
|
|
|
1561
1592
|
} catch (error) {
|
|
1562
1593
|
return handleQueryRouteError(error);
|
|
1563
1594
|
}
|
|
1564
|
-
} : void 0
|
|
1595
|
+
} : void 0,
|
|
1596
|
+
unstable_normalizePath: (r) => getNormalizedPath(r, build.basename, build.future)
|
|
1565
1597
|
});
|
|
1566
1598
|
return handleQueryRouteResult(result);
|
|
1567
1599
|
} catch (error) {
|
|
@@ -2388,7 +2420,9 @@ function RSCStaticRouter({ getPayload }) {
|
|
|
2388
2420
|
// flags that drive runtime behavior they'll need to be proxied through.
|
|
2389
2421
|
v8_middleware: false,
|
|
2390
2422
|
unstable_subResourceIntegrity: false,
|
|
2391
|
-
unstable_trailingSlashAwareDataRequests: true
|
|
2423
|
+
unstable_trailingSlashAwareDataRequests: true,
|
|
2424
|
+
// always on for RSC
|
|
2425
|
+
unstable_passThroughRequests: true
|
|
2392
2426
|
// always on for RSC
|
|
2393
2427
|
},
|
|
2394
2428
|
isSpaMode: false,
|