react-router 7.11.0-pre.0 → 7.12.0-pre.0
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 +52 -2
- package/dist/development/{browser-Cv4JZyZ5.d.mts → browser-BEPxnEBW.d.mts} +4 -2
- package/dist/{production/browser-Cv4JZyZ5.d.mts → development/browser-CJ9_du-U.d.ts} +4 -2
- package/dist/development/{chunk-QMKP6CC3.mjs → chunk-2RQJSHF5.mjs} +111 -11
- package/dist/development/{chunk-JKMHOZYW.js → chunk-AUGQXA25.js} +98 -108
- package/dist/development/{chunk-OVG6YSZ5.js → chunk-JBLDGBX7.js} +7 -7
- package/dist/development/{chunk-KRMLYMWA.mjs → chunk-KYKH2NCS.mjs} +122 -50
- package/dist/development/{chunk-UO7KGW2U.js → chunk-MNTWZBMV.js} +117 -35
- package/dist/development/dom-export.d.mts +2 -2
- package/dist/development/dom-export.d.ts +2 -2
- package/dist/development/dom-export.js +35 -30
- package/dist/development/dom-export.mjs +12 -7
- package/dist/development/{index-react-server-client-P7VgYu6T.d.mts → index-react-server-client-IoJGLOqV.d.mts} +3 -1
- package/dist/{production/index-react-server-client-Cv5Q9lf0.d.ts → development/index-react-server-client-gGyf-7Xp.d.ts} +3 -1
- package/dist/development/index-react-server-client.d.mts +2 -2
- 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 +3 -1
- package/dist/development/index-react-server.d.ts +3 -1
- package/dist/development/index-react-server.js +92 -7
- package/dist/development/index-react-server.mjs +92 -7
- package/dist/development/index.d.mts +9 -9
- package/dist/development/index.d.ts +9 -9
- package/dist/development/index.js +205 -101
- package/dist/development/index.mjs +7 -3
- package/dist/{production/instrumentation-BlrVzjbg.d.ts → development/instrumentation-DvHY1sgY.d.ts} +45 -1
- 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-BGQUMCK4.d.ts → register-Bm80E9qL.d.ts} +1 -1
- package/dist/development/{register-DTJJbt1o.d.mts → register-CS_tiXsm.d.mts} +1 -1
- package/dist/development/{router-5fbeEIMQ.d.mts → router-5iOvts3c.d.mts} +45 -1
- package/dist/{development/browser-o-qhcuhA.d.ts → production/browser-BEPxnEBW.d.mts} +4 -2
- package/dist/production/{browser-o-qhcuhA.d.ts → browser-CJ9_du-U.d.ts} +4 -2
- package/dist/production/{chunk-IDHO4Q57.mjs → chunk-HFQUWXEK.mjs} +122 -50
- package/dist/production/{chunk-J4JITZ76.mjs → chunk-ILRYJQTC.mjs} +111 -11
- package/dist/production/{chunk-YGB3JEIP.js → chunk-O6YLM5NB.js} +7 -7
- package/dist/production/{chunk-M5W3Q3T5.js → chunk-QWJQISZK.js} +98 -108
- package/dist/production/{chunk-AO22ZXHI.js → chunk-ZR2NIBH2.js} +117 -35
- package/dist/production/dom-export.d.mts +2 -2
- package/dist/production/dom-export.d.ts +2 -2
- package/dist/production/dom-export.js +35 -30
- package/dist/production/dom-export.mjs +12 -7
- package/dist/production/{index-react-server-client-P7VgYu6T.d.mts → index-react-server-client-IoJGLOqV.d.mts} +3 -1
- package/dist/{development/index-react-server-client-Cv5Q9lf0.d.ts → production/index-react-server-client-gGyf-7Xp.d.ts} +3 -1
- package/dist/production/index-react-server-client.d.mts +2 -2
- 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 +3 -1
- package/dist/production/index-react-server.d.ts +3 -1
- package/dist/production/index-react-server.js +92 -7
- package/dist/production/index-react-server.mjs +92 -7
- package/dist/production/index.d.mts +9 -9
- package/dist/production/index.d.ts +9 -9
- package/dist/production/index.js +205 -101
- package/dist/production/index.mjs +7 -3
- package/dist/{development/instrumentation-BlrVzjbg.d.ts → production/instrumentation-DvHY1sgY.d.ts} +45 -1
- 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-BGQUMCK4.d.ts → register-Bm80E9qL.d.ts} +1 -1
- package/dist/production/{register-DTJJbt1o.d.mts → register-CS_tiXsm.d.mts} +1 -1
- package/dist/production/{router-5fbeEIMQ.d.mts → router-5iOvts3c.d.mts} +45 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
|
|
2
|
-
* react-router v7.
|
|
2
|
+
* react-router v7.12.0-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -709,12 +709,12 @@ function generatePath(originalPath, params = {}) {
|
|
|
709
709
|
const star = "*";
|
|
710
710
|
return stringify2(params[star]);
|
|
711
711
|
}
|
|
712
|
-
const keyMatch = segment.match(/^:([\w-]+)(\??)
|
|
712
|
+
const keyMatch = segment.match(/^:([\w-]+)(\??)(.*)/);
|
|
713
713
|
if (keyMatch) {
|
|
714
|
-
const [, key, optional] = keyMatch;
|
|
714
|
+
const [, key, optional, suffix] = keyMatch;
|
|
715
715
|
let param = params[key];
|
|
716
716
|
invariant(optional === "?" || param != null, `Missing ":${key}" param`);
|
|
717
|
-
return encodeURIComponent(stringify2(param));
|
|
717
|
+
return encodeURIComponent(stringify2(param)) + suffix;
|
|
718
718
|
}
|
|
719
719
|
return segment.replace(/\?$/g, "");
|
|
720
720
|
}).filter((segment) => !!segment);
|
|
@@ -1071,6 +1071,9 @@ function getRouteInstrumentationUpdates(fns, route) {
|
|
|
1071
1071
|
(...args) => getHandlerInfo(args[0])
|
|
1072
1072
|
);
|
|
1073
1073
|
if (instrumented) {
|
|
1074
|
+
if (key === "loader" && original.hydrate === true) {
|
|
1075
|
+
instrumented.hydrate = true;
|
|
1076
|
+
}
|
|
1074
1077
|
instrumented[UninstrumentedSymbol] = original;
|
|
1075
1078
|
updates[key] = instrumented;
|
|
1076
1079
|
}
|
|
@@ -2014,7 +2017,8 @@ function createRouter(init) {
|
|
|
2014
2017
|
let location2 = normalizeRedirectLocation(
|
|
2015
2018
|
result.response.headers.get("Location"),
|
|
2016
2019
|
new URL(request.url),
|
|
2017
|
-
basename
|
|
2020
|
+
basename,
|
|
2021
|
+
init.history
|
|
2018
2022
|
);
|
|
2019
2023
|
replace2 = location2 === state.location.pathname + state.location.search;
|
|
2020
2024
|
}
|
|
@@ -2648,7 +2652,8 @@ function createRouter(init) {
|
|
|
2648
2652
|
location = normalizeRedirectLocation(
|
|
2649
2653
|
location,
|
|
2650
2654
|
new URL(request.url),
|
|
2651
|
-
basename
|
|
2655
|
+
basename,
|
|
2656
|
+
init.history
|
|
2652
2657
|
);
|
|
2653
2658
|
let redirectLocation = createLocation(state.location, location, {
|
|
2654
2659
|
_isRedirect: true
|
|
@@ -4907,15 +4912,38 @@ function normalizeRelativeRoutingRedirectResponse(response, request, routeId, ma
|
|
|
4907
4912
|
}
|
|
4908
4913
|
return response;
|
|
4909
4914
|
}
|
|
4910
|
-
function normalizeRedirectLocation(location, currentUrl, basename) {
|
|
4915
|
+
function normalizeRedirectLocation(location, currentUrl, basename, historyInstance) {
|
|
4916
|
+
let invalidProtocols = [
|
|
4917
|
+
"about:",
|
|
4918
|
+
"blob:",
|
|
4919
|
+
"chrome:",
|
|
4920
|
+
"chrome-untrusted:",
|
|
4921
|
+
"content:",
|
|
4922
|
+
"data:",
|
|
4923
|
+
"devtools:",
|
|
4924
|
+
"file:",
|
|
4925
|
+
"filesystem:",
|
|
4926
|
+
// eslint-disable-next-line no-script-url
|
|
4927
|
+
"javascript:"
|
|
4928
|
+
];
|
|
4911
4929
|
if (isAbsoluteUrl(location)) {
|
|
4912
4930
|
let normalizedLocation = location;
|
|
4913
4931
|
let url = normalizedLocation.startsWith("//") ? new URL(currentUrl.protocol + normalizedLocation) : new URL(normalizedLocation);
|
|
4932
|
+
if (invalidProtocols.includes(url.protocol)) {
|
|
4933
|
+
throw new Error("Invalid redirect location");
|
|
4934
|
+
}
|
|
4914
4935
|
let isSameBasename = stripBasename(url.pathname, basename) != null;
|
|
4915
4936
|
if (url.origin === currentUrl.origin && isSameBasename) {
|
|
4916
4937
|
return url.pathname + url.search + url.hash;
|
|
4917
4938
|
}
|
|
4918
4939
|
}
|
|
4940
|
+
try {
|
|
4941
|
+
let url = historyInstance.createURL(location);
|
|
4942
|
+
if (invalidProtocols.includes(url.protocol)) {
|
|
4943
|
+
throw new Error("Invalid redirect location");
|
|
4944
|
+
}
|
|
4945
|
+
} catch (e) {
|
|
4946
|
+
}
|
|
4919
4947
|
return location;
|
|
4920
4948
|
}
|
|
4921
4949
|
function createClientSideRequest(history, location, signal, submission) {
|
|
@@ -6187,7 +6215,7 @@ function StreamTransfer({
|
|
|
6187
6215
|
)));
|
|
6188
6216
|
}
|
|
6189
6217
|
}
|
|
6190
|
-
function getTurboStreamSingleFetchDataStrategy(getRouter, manifest, routeModules, ssr, basename) {
|
|
6218
|
+
function getTurboStreamSingleFetchDataStrategy(getRouter, manifest, routeModules, ssr, basename, trailingSlashAware) {
|
|
6191
6219
|
let dataStrategy = getSingleFetchDataStrategyImpl(
|
|
6192
6220
|
getRouter,
|
|
6193
6221
|
(match) => {
|
|
@@ -6202,26 +6230,43 @@ function getTurboStreamSingleFetchDataStrategy(getRouter, manifest, routeModules
|
|
|
6202
6230
|
},
|
|
6203
6231
|
fetchAndDecodeViaTurboStream,
|
|
6204
6232
|
ssr,
|
|
6205
|
-
basename
|
|
6233
|
+
basename,
|
|
6234
|
+
trailingSlashAware
|
|
6206
6235
|
);
|
|
6207
6236
|
return async (args) => args.runClientMiddleware(dataStrategy);
|
|
6208
6237
|
}
|
|
6209
|
-
function getSingleFetchDataStrategyImpl(getRouter, getRouteInfo, fetchAndDecode, ssr, basename, shouldAllowOptOut = () => true) {
|
|
6238
|
+
function getSingleFetchDataStrategyImpl(getRouter, getRouteInfo, fetchAndDecode, ssr, basename, trailingSlashAware, shouldAllowOptOut = () => true) {
|
|
6210
6239
|
return async (args) => {
|
|
6211
6240
|
let { request, matches, fetcherKey } = args;
|
|
6212
6241
|
let router = getRouter();
|
|
6213
6242
|
if (request.method !== "GET") {
|
|
6214
|
-
return singleFetchActionStrategy(
|
|
6243
|
+
return singleFetchActionStrategy(
|
|
6244
|
+
args,
|
|
6245
|
+
fetchAndDecode,
|
|
6246
|
+
basename,
|
|
6247
|
+
trailingSlashAware
|
|
6248
|
+
);
|
|
6215
6249
|
}
|
|
6216
6250
|
let foundRevalidatingServerLoader = matches.some((m) => {
|
|
6217
6251
|
let { hasLoader, hasClientLoader } = getRouteInfo(m);
|
|
6218
6252
|
return m.shouldCallHandler() && hasLoader && !hasClientLoader;
|
|
6219
6253
|
});
|
|
6220
6254
|
if (!ssr && !foundRevalidatingServerLoader) {
|
|
6221
|
-
return nonSsrStrategy(
|
|
6255
|
+
return nonSsrStrategy(
|
|
6256
|
+
args,
|
|
6257
|
+
getRouteInfo,
|
|
6258
|
+
fetchAndDecode,
|
|
6259
|
+
basename,
|
|
6260
|
+
trailingSlashAware
|
|
6261
|
+
);
|
|
6222
6262
|
}
|
|
6223
6263
|
if (fetcherKey) {
|
|
6224
|
-
return singleFetchLoaderFetcherStrategy(
|
|
6264
|
+
return singleFetchLoaderFetcherStrategy(
|
|
6265
|
+
args,
|
|
6266
|
+
fetchAndDecode,
|
|
6267
|
+
basename,
|
|
6268
|
+
trailingSlashAware
|
|
6269
|
+
);
|
|
6225
6270
|
}
|
|
6226
6271
|
return singleFetchLoaderNavigationStrategy(
|
|
6227
6272
|
args,
|
|
@@ -6230,19 +6275,23 @@ function getSingleFetchDataStrategyImpl(getRouter, getRouteInfo, fetchAndDecode,
|
|
|
6230
6275
|
fetchAndDecode,
|
|
6231
6276
|
ssr,
|
|
6232
6277
|
basename,
|
|
6278
|
+
trailingSlashAware,
|
|
6233
6279
|
shouldAllowOptOut
|
|
6234
6280
|
);
|
|
6235
6281
|
};
|
|
6236
6282
|
}
|
|
6237
|
-
async function singleFetchActionStrategy(args, fetchAndDecode, basename) {
|
|
6283
|
+
async function singleFetchActionStrategy(args, fetchAndDecode, basename, trailingSlashAware) {
|
|
6238
6284
|
let actionMatch = args.matches.find((m) => m.shouldCallHandler());
|
|
6239
6285
|
invariant2(actionMatch, "No action match found");
|
|
6240
6286
|
let actionStatus = void 0;
|
|
6241
6287
|
let result = await actionMatch.resolve(async (handler) => {
|
|
6242
6288
|
let result2 = await handler(async () => {
|
|
6243
|
-
let { data: data2, status } = await fetchAndDecode(
|
|
6244
|
-
|
|
6245
|
-
|
|
6289
|
+
let { data: data2, status } = await fetchAndDecode(
|
|
6290
|
+
args,
|
|
6291
|
+
basename,
|
|
6292
|
+
trailingSlashAware,
|
|
6293
|
+
[actionMatch.route.id]
|
|
6294
|
+
);
|
|
6246
6295
|
actionStatus = status;
|
|
6247
6296
|
return unwrapSingleFetchResult(data2, actionMatch.route.id);
|
|
6248
6297
|
});
|
|
@@ -6258,7 +6307,7 @@ async function singleFetchActionStrategy(args, fetchAndDecode, basename) {
|
|
|
6258
6307
|
}
|
|
6259
6308
|
};
|
|
6260
6309
|
}
|
|
6261
|
-
async function nonSsrStrategy(args, getRouteInfo, fetchAndDecode, basename) {
|
|
6310
|
+
async function nonSsrStrategy(args, getRouteInfo, fetchAndDecode, basename, trailingSlashAware) {
|
|
6262
6311
|
let matchesToLoad = args.matches.filter((m) => m.shouldCallHandler());
|
|
6263
6312
|
let results = {};
|
|
6264
6313
|
await Promise.all(
|
|
@@ -6268,7 +6317,12 @@ async function nonSsrStrategy(args, getRouteInfo, fetchAndDecode, basename) {
|
|
|
6268
6317
|
let { hasClientLoader } = getRouteInfo(m);
|
|
6269
6318
|
let routeId = m.route.id;
|
|
6270
6319
|
let result = hasClientLoader ? await handler(async () => {
|
|
6271
|
-
let { data: data2 } = await fetchAndDecode(
|
|
6320
|
+
let { data: data2 } = await fetchAndDecode(
|
|
6321
|
+
args,
|
|
6322
|
+
basename,
|
|
6323
|
+
trailingSlashAware,
|
|
6324
|
+
[routeId]
|
|
6325
|
+
);
|
|
6272
6326
|
return unwrapSingleFetchResult(data2, routeId);
|
|
6273
6327
|
}) : await handler();
|
|
6274
6328
|
results[m.route.id] = { type: "data", result };
|
|
@@ -6280,7 +6334,7 @@ async function nonSsrStrategy(args, getRouteInfo, fetchAndDecode, basename) {
|
|
|
6280
6334
|
);
|
|
6281
6335
|
return results;
|
|
6282
6336
|
}
|
|
6283
|
-
async function singleFetchLoaderNavigationStrategy(args, router, getRouteInfo, fetchAndDecode, ssr, basename, shouldAllowOptOut = () => true) {
|
|
6337
|
+
async function singleFetchLoaderNavigationStrategy(args, router, getRouteInfo, fetchAndDecode, ssr, basename, trailingSlashAware, shouldAllowOptOut = () => true) {
|
|
6284
6338
|
let routesParams = /* @__PURE__ */ new Set();
|
|
6285
6339
|
let foundOptOutRoute = false;
|
|
6286
6340
|
let routeDfds = args.matches.map(() => createDeferred2());
|
|
@@ -6306,7 +6360,12 @@ async function singleFetchLoaderNavigationStrategy(args, router, getRouteInfo, f
|
|
|
6306
6360
|
}
|
|
6307
6361
|
try {
|
|
6308
6362
|
let result = await handler(async () => {
|
|
6309
|
-
let { data: data2 } = await fetchAndDecode(
|
|
6363
|
+
let { data: data2 } = await fetchAndDecode(
|
|
6364
|
+
args,
|
|
6365
|
+
basename,
|
|
6366
|
+
trailingSlashAware,
|
|
6367
|
+
[routeId]
|
|
6368
|
+
);
|
|
6310
6369
|
return unwrapSingleFetchResult(data2, routeId);
|
|
6311
6370
|
});
|
|
6312
6371
|
results[routeId] = { type: "data", result };
|
|
@@ -6337,7 +6396,12 @@ async function singleFetchLoaderNavigationStrategy(args, router, getRouteInfo, f
|
|
|
6337
6396
|
} else {
|
|
6338
6397
|
let targetRoutes = ssr && foundOptOutRoute && routesParams.size > 0 ? [...routesParams.keys()] : void 0;
|
|
6339
6398
|
try {
|
|
6340
|
-
let data2 = await fetchAndDecode(
|
|
6399
|
+
let data2 = await fetchAndDecode(
|
|
6400
|
+
args,
|
|
6401
|
+
basename,
|
|
6402
|
+
trailingSlashAware,
|
|
6403
|
+
targetRoutes
|
|
6404
|
+
);
|
|
6341
6405
|
singleFetchDfd.resolve(data2.data);
|
|
6342
6406
|
} catch (e) {
|
|
6343
6407
|
singleFetchDfd.reject(e);
|
|
@@ -6383,13 +6447,15 @@ async function bubbleMiddlewareErrors(singleFetchPromise, matches, routesParams,
|
|
|
6383
6447
|
} catch (e) {
|
|
6384
6448
|
}
|
|
6385
6449
|
}
|
|
6386
|
-
async function singleFetchLoaderFetcherStrategy(args, fetchAndDecode, basename) {
|
|
6450
|
+
async function singleFetchLoaderFetcherStrategy(args, fetchAndDecode, basename, trailingSlashAware) {
|
|
6387
6451
|
let fetcherMatch = args.matches.find((m) => m.shouldCallHandler());
|
|
6388
6452
|
invariant2(fetcherMatch, "No fetcher match found");
|
|
6389
6453
|
let routeId = fetcherMatch.route.id;
|
|
6390
6454
|
let result = await fetcherMatch.resolve(
|
|
6391
6455
|
async (handler) => handler(async () => {
|
|
6392
|
-
let { data: data2 } = await fetchAndDecode(args, basename, [
|
|
6456
|
+
let { data: data2 } = await fetchAndDecode(args, basename, trailingSlashAware, [
|
|
6457
|
+
routeId
|
|
6458
|
+
]);
|
|
6393
6459
|
return unwrapSingleFetchResult(data2, routeId);
|
|
6394
6460
|
})
|
|
6395
6461
|
);
|
|
@@ -6409,25 +6475,33 @@ function stripIndexParam(url) {
|
|
|
6409
6475
|
}
|
|
6410
6476
|
return url;
|
|
6411
6477
|
}
|
|
6412
|
-
function singleFetchUrl(reqUrl, basename, extension) {
|
|
6478
|
+
function singleFetchUrl(reqUrl, basename, trailingSlashAware, extension) {
|
|
6413
6479
|
let url = typeof reqUrl === "string" ? new URL(
|
|
6414
6480
|
reqUrl,
|
|
6415
6481
|
// This can be called during the SSR flow via PrefetchPageLinksImpl so
|
|
6416
6482
|
// don't assume window is available
|
|
6417
6483
|
typeof window === "undefined" ? "server://singlefetch/" : window.location.origin
|
|
6418
6484
|
) : reqUrl;
|
|
6419
|
-
if (
|
|
6420
|
-
url.pathname
|
|
6421
|
-
|
|
6422
|
-
|
|
6485
|
+
if (trailingSlashAware) {
|
|
6486
|
+
if (url.pathname.endsWith("/")) {
|
|
6487
|
+
url.pathname = `${url.pathname}_.${extension}`;
|
|
6488
|
+
} else {
|
|
6489
|
+
url.pathname = `${url.pathname}.${extension}`;
|
|
6490
|
+
}
|
|
6423
6491
|
} else {
|
|
6424
|
-
url.pathname
|
|
6492
|
+
if (url.pathname === "/") {
|
|
6493
|
+
url.pathname = `_root.${extension}`;
|
|
6494
|
+
} else if (basename && stripBasename(url.pathname, basename) === "/") {
|
|
6495
|
+
url.pathname = `${basename.replace(/\/$/, "")}/_root.${extension}`;
|
|
6496
|
+
} else {
|
|
6497
|
+
url.pathname = `${url.pathname.replace(/\/$/, "")}.${extension}`;
|
|
6498
|
+
}
|
|
6425
6499
|
}
|
|
6426
6500
|
return url;
|
|
6427
6501
|
}
|
|
6428
|
-
async function fetchAndDecodeViaTurboStream(args, basename, targetRoutes) {
|
|
6502
|
+
async function fetchAndDecodeViaTurboStream(args, basename, trailingSlashAware, targetRoutes) {
|
|
6429
6503
|
let { request } = args;
|
|
6430
|
-
let url = singleFetchUrl(request.url, basename, "data");
|
|
6504
|
+
let url = singleFetchUrl(request.url, basename, trailingSlashAware, "data");
|
|
6431
6505
|
if (request.method === "GET") {
|
|
6432
6506
|
url = stripIndexParam(url);
|
|
6433
6507
|
if (targetRoutes) {
|
|
@@ -8358,7 +8432,7 @@ function PrefetchPageLinksImpl({
|
|
|
8358
8432
|
...linkProps
|
|
8359
8433
|
}) {
|
|
8360
8434
|
let location = useLocation();
|
|
8361
|
-
let { manifest, routeModules } = useFrameworkContext();
|
|
8435
|
+
let { future, manifest, routeModules } = useFrameworkContext();
|
|
8362
8436
|
let { basename } = useDataRouterContext2();
|
|
8363
8437
|
let { loaderData, matches } = useDataRouterStateContext();
|
|
8364
8438
|
let newMatchesForData = React7.useMemo(
|
|
@@ -8405,7 +8479,12 @@ function PrefetchPageLinksImpl({
|
|
|
8405
8479
|
if (routesParams.size === 0) {
|
|
8406
8480
|
return [];
|
|
8407
8481
|
}
|
|
8408
|
-
let url = singleFetchUrl(
|
|
8482
|
+
let url = singleFetchUrl(
|
|
8483
|
+
page,
|
|
8484
|
+
basename,
|
|
8485
|
+
future.unstable_trailingSlashAwareDataRequests,
|
|
8486
|
+
"data"
|
|
8487
|
+
);
|
|
8409
8488
|
if (foundOptOutRoute && routesParams.size > 0) {
|
|
8410
8489
|
url.searchParams.set(
|
|
8411
8490
|
"_routes",
|
|
@@ -8415,6 +8494,7 @@ function PrefetchPageLinksImpl({
|
|
|
8415
8494
|
return [url.pathname + url.search];
|
|
8416
8495
|
}, [
|
|
8417
8496
|
basename,
|
|
8497
|
+
future.unstable_trailingSlashAwareDataRequests,
|
|
8418
8498
|
loaderData,
|
|
8419
8499
|
location,
|
|
8420
8500
|
manifest,
|
|
@@ -8658,6 +8738,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
|
|
|
8658
8738
|
return isHydrated || isRSCRouterContext ? null : /* @__PURE__ */ React7.createElement(React7.Fragment, null, typeof manifest.sri === "object" ? /* @__PURE__ */ React7.createElement(
|
|
8659
8739
|
"script",
|
|
8660
8740
|
{
|
|
8741
|
+
...scriptProps,
|
|
8661
8742
|
"rr-importmap": "",
|
|
8662
8743
|
type: "importmap",
|
|
8663
8744
|
suppressHydrationWarning: true,
|
|
@@ -9636,4 +9717,5 @@ function withErrorBoundaryProps(ErrorBoundary) {
|
|
|
9636
9717
|
|
|
9637
9718
|
|
|
9638
9719
|
|
|
9639
|
-
|
|
9720
|
+
|
|
9721
|
+
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.joinPaths = joinPaths; exports.data = data; exports.redirect = redirect; exports.redirectDocument = redirectDocument; exports.replace = replace; exports.ErrorResponseImpl = ErrorResponseImpl; exports.isRouteErrorResponse = isRouteErrorResponse; exports.parseToInfo = parseToInfo; exports.escapeHtml = escapeHtml; exports.encode = encode; exports.instrumentHandler = instrumentHandler; exports.IDLE_NAVIGATION = IDLE_NAVIGATION; exports.IDLE_FETCHER = IDLE_FETCHER; exports.IDLE_BLOCKER = IDLE_BLOCKER; exports.createRouter = createRouter; exports.createStaticHandler = createStaticHandler; exports.getStaticContextFromError = getStaticContextFromError; exports.isDataWithResponseInit = isDataWithResponseInit; exports.isResponse = isResponse; exports.isRedirectStatusCode = isRedirectStatusCode; exports.isRedirectResponse = isRedirectResponse; exports.isMutationMethod = isMutationMethod; exports.createRequestInit = createRequestInit; exports.SingleFetchRedirectSymbol = SingleFetchRedirectSymbol; exports.SINGLE_FETCH_REDIRECT_STATUS = SINGLE_FETCH_REDIRECT_STATUS; exports.NO_BODY_STATUS_CODES = NO_BODY_STATUS_CODES; exports.StreamTransfer = StreamTransfer; exports.getTurboStreamSingleFetchDataStrategy = getTurboStreamSingleFetchDataStrategy; exports.getSingleFetchDataStrategyImpl = getSingleFetchDataStrategyImpl; exports.stripIndexParam = stripIndexParam; exports.singleFetchUrl = singleFetchUrl; exports.decodeViaTurboStream = decodeViaTurboStream; exports.DataRouterContext = DataRouterContext; exports.DataRouterStateContext = DataRouterStateContext; exports.RSCRouterContext = RSCRouterContext; exports.ViewTransitionContext = ViewTransitionContext; exports.FetchersContext = FetchersContext; exports.AwaitContextProvider = AwaitContextProvider; exports.NavigationContext = NavigationContext; exports.LocationContext = LocationContext; exports.RouteContext = RouteContext; exports.ENABLE_DEV_WARNINGS = ENABLE_DEV_WARNINGS; exports.warnOnce = warnOnce; exports.decodeRedirectErrorDigest = decodeRedirectErrorDigest; exports.decodeRouteErrorResponseDigest = decodeRouteErrorResponseDigest; 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.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; exports.mapRouteProperties = mapRouteProperties; exports.hydrationRouteProperties = hydrationRouteProperties; exports.createMemoryRouter = createMemoryRouter; exports.RouterProvider = RouterProvider; exports.MemoryRouter = MemoryRouter; exports.Navigate = Navigate; exports.Outlet = Outlet; exports.Route = Route; exports.Router = Router; exports.Routes = Routes; exports.Await = Await; exports.createRoutesFromChildren = createRoutesFromChildren; exports.createRoutesFromElements = createRoutesFromElements; exports.renderMatches = renderMatches; exports.WithComponentProps = WithComponentProps; exports.withComponentProps = withComponentProps; exports.WithHydrateFallbackProps = WithHydrateFallbackProps; exports.withHydrateFallbackProps = withHydrateFallbackProps; exports.WithErrorBoundaryProps = WithErrorBoundaryProps; exports.withErrorBoundaryProps = withErrorBoundaryProps;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { f as RouterProviderProps$1, e as RouterInit, u as unstable_ClientInstrumentation, g as ClientOnErrorFunction } from './router-
|
|
3
|
-
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-
|
|
2
|
+
import { f as RouterProviderProps$1, e as RouterInit, u as unstable_ClientInstrumentation, g as ClientOnErrorFunction } from './router-5iOvts3c.mjs';
|
|
3
|
+
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-BEPxnEBW.mjs';
|
|
4
4
|
|
|
5
5
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
6
6
|
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { RouterProviderProps as RouterProviderProps$1, RouterInit, ClientOnErrorFunction } from 'react-router';
|
|
3
|
-
import { u as unstable_ClientInstrumentation } from './instrumentation-
|
|
4
|
-
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-
|
|
3
|
+
import { u as unstable_ClientInstrumentation } from './instrumentation-DvHY1sgY.js';
|
|
4
|
+
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-CJ9_du-U.js';
|
|
5
5
|
|
|
6
6
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
7
7
|
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
|
@@ -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 v7.
|
|
2
|
+
* react-router v7.12.0-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkO6YLM5NBjs = require('./chunk-O6YLM5NB.js');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
@@ -32,7 +32,7 @@ var _chunkYGB3JEIPjs = require('./chunk-YGB3JEIP.js');
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
var
|
|
35
|
+
var _chunkZR2NIBH2js = require('./chunk-ZR2NIBH2.js');
|
|
36
36
|
|
|
37
37
|
// lib/dom-export/dom-router-provider.tsx
|
|
38
38
|
var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react);
|
|
@@ -166,7 +166,8 @@ function createHydratedRouter({
|
|
|
166
166
|
ssrInfo.manifest,
|
|
167
167
|
ssrInfo.routeModules,
|
|
168
168
|
ssrInfo.context.ssr,
|
|
169
|
-
ssrInfo.context.basename
|
|
169
|
+
ssrInfo.context.basename,
|
|
170
|
+
ssrInfo.context.future.unstable_trailingSlashAwareDataRequests
|
|
170
171
|
),
|
|
171
172
|
patchRoutesOnNavigation: _reactrouter.UNSAFE_getPatchRoutesOnNavigationFunction.call(void 0,
|
|
172
173
|
ssrInfo.manifest,
|
|
@@ -204,7 +205,7 @@ function HydratedRouter(props) {
|
|
|
204
205
|
}, []);
|
|
205
206
|
React2.useEffect(() => {
|
|
206
207
|
if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
|
|
207
|
-
document.querySelectorAll(`[${
|
|
208
|
+
document.querySelectorAll(`[${_chunkZR2NIBH2js.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
|
|
208
209
|
}
|
|
209
210
|
}, [criticalCss]);
|
|
210
211
|
let [location2, setLocation] = React2.useState(router.state.location);
|
|
@@ -376,10 +377,10 @@ function createRouterFromPayload({
|
|
|
376
377
|
};
|
|
377
378
|
if (payload.type !== "render") throw new Error("Invalid payload type");
|
|
378
379
|
globalVar.__reactRouterRouteModules = _nullishCoalesce(globalVar.__reactRouterRouteModules, () => ( {}));
|
|
379
|
-
|
|
380
|
+
_chunkO6YLM5NBjs.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
|
|
380
381
|
let patches = /* @__PURE__ */ new Map();
|
|
381
382
|
_optionalChain([payload, 'access', _22 => _22.patches, 'optionalAccess', _23 => _23.forEach, 'call', _24 => _24((patch) => {
|
|
382
|
-
|
|
383
|
+
_chunkZR2NIBH2js.invariant.call(void 0, patch.parentId, "Invalid patch parentId");
|
|
383
384
|
if (!patches.has(patch.parentId)) {
|
|
384
385
|
patches.set(patch.parentId, []);
|
|
385
386
|
}
|
|
@@ -401,12 +402,12 @@ function createRouterFromPayload({
|
|
|
401
402
|
}
|
|
402
403
|
return [route];
|
|
403
404
|
}, []);
|
|
404
|
-
globalVar.__reactRouterDataRouter =
|
|
405
|
+
globalVar.__reactRouterDataRouter = _chunkZR2NIBH2js.createRouter.call(void 0, {
|
|
405
406
|
routes,
|
|
406
407
|
getContext,
|
|
407
408
|
basename: payload.basename,
|
|
408
|
-
history:
|
|
409
|
-
hydrationData:
|
|
409
|
+
history: _chunkZR2NIBH2js.createBrowserHistory.call(void 0, ),
|
|
410
|
+
hydrationData: _chunkO6YLM5NBjs.getHydrationData.call(void 0, {
|
|
410
411
|
state: {
|
|
411
412
|
loaderData: payload.loaderData,
|
|
412
413
|
actionData: payload.actionData,
|
|
@@ -415,7 +416,7 @@ function createRouterFromPayload({
|
|
|
415
416
|
routes,
|
|
416
417
|
getRouteInfo: (routeId) => {
|
|
417
418
|
let match = payload.matches.find((m) => m.id === routeId);
|
|
418
|
-
|
|
419
|
+
_chunkZR2NIBH2js.invariant.call(void 0, match, "Route not found in payload");
|
|
419
420
|
return {
|
|
420
421
|
clientLoader: match.clientLoader,
|
|
421
422
|
hasLoader: match.hasLoader,
|
|
@@ -513,9 +514,9 @@ function createRouterFromPayload({
|
|
|
513
514
|
routeModules: globalVar.__reactRouterRouteModules
|
|
514
515
|
};
|
|
515
516
|
}
|
|
516
|
-
var renderedRoutesContext =
|
|
517
|
+
var renderedRoutesContext = _chunkZR2NIBH2js.createContext.call(void 0, );
|
|
517
518
|
function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReadableStream, fetchImplementation) {
|
|
518
|
-
let dataStrategy =
|
|
519
|
+
let dataStrategy = _chunkZR2NIBH2js.getSingleFetchDataStrategyImpl.call(void 0,
|
|
519
520
|
getRouter,
|
|
520
521
|
(match) => {
|
|
521
522
|
let M = match;
|
|
@@ -532,6 +533,8 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
|
|
|
532
533
|
getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation),
|
|
533
534
|
ssr,
|
|
534
535
|
basename,
|
|
536
|
+
// .rsc requests are always trailing slash aware
|
|
537
|
+
true,
|
|
535
538
|
// If the route has a component but we don't have an element, we need to hit
|
|
536
539
|
// the server loader flow regardless of whether the client loader calls
|
|
537
540
|
// `serverLoader` or not, otherwise we'll have nothing to render.
|
|
@@ -569,22 +572,22 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
|
|
|
569
572
|
});
|
|
570
573
|
}
|
|
571
574
|
function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation) {
|
|
572
|
-
return async (args, basename, targetRoutes) => {
|
|
575
|
+
return async (args, basename, trailingSlashAware, targetRoutes) => {
|
|
573
576
|
let { request, context } = args;
|
|
574
|
-
let url =
|
|
577
|
+
let url = _chunkZR2NIBH2js.singleFetchUrl.call(void 0, request.url, basename, trailingSlashAware, "rsc");
|
|
575
578
|
if (request.method === "GET") {
|
|
576
|
-
url =
|
|
579
|
+
url = _chunkZR2NIBH2js.stripIndexParam.call(void 0, url);
|
|
577
580
|
if (targetRoutes) {
|
|
578
581
|
url.searchParams.set("_routes", targetRoutes.join(","));
|
|
579
582
|
}
|
|
580
583
|
}
|
|
581
584
|
let res = await fetchImplementation(
|
|
582
|
-
new Request(url, await
|
|
585
|
+
new Request(url, await _chunkZR2NIBH2js.createRequestInit.call(void 0, request))
|
|
583
586
|
);
|
|
584
587
|
if (res.status >= 400 && !res.headers.has("X-Remix-Response")) {
|
|
585
|
-
throw new (0,
|
|
588
|
+
throw new (0, _chunkZR2NIBH2js.ErrorResponseImpl)(res.status, res.statusText, await res.text());
|
|
586
589
|
}
|
|
587
|
-
|
|
590
|
+
_chunkZR2NIBH2js.invariant.call(void 0, res.body, "No response body to decode");
|
|
588
591
|
try {
|
|
589
592
|
const payload = await createFromReadableStream(res.body, {
|
|
590
593
|
temporaryReferences: void 0
|
|
@@ -608,7 +611,7 @@ function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation)
|
|
|
608
611
|
}
|
|
609
612
|
context.get(renderedRoutesContext).push(...payload.matches);
|
|
610
613
|
let results = { routes: {} };
|
|
611
|
-
const dataKey =
|
|
614
|
+
const dataKey = _chunkZR2NIBH2js.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
|
|
612
615
|
for (let [routeId, data] of Object.entries(payload[dataKey] || {})) {
|
|
613
616
|
results.routes[routeId] = { data };
|
|
614
617
|
}
|
|
@@ -641,7 +644,7 @@ function RSCHydratedRouter({
|
|
|
641
644
|
[createFromReadableStream, payload, fetchImplementation, getContext]
|
|
642
645
|
);
|
|
643
646
|
React3.useEffect(() => {
|
|
644
|
-
|
|
647
|
+
_chunkZR2NIBH2js.setIsHydrated.call(void 0, );
|
|
645
648
|
}, []);
|
|
646
649
|
React3.useLayoutEffect(() => {
|
|
647
650
|
const globalVar = window;
|
|
@@ -726,7 +729,9 @@ function RSCHydratedRouter({
|
|
|
726
729
|
// These flags have no runtime impact so can always be false. If we add
|
|
727
730
|
// flags that drive runtime behavior they'll need to be proxied through.
|
|
728
731
|
v8_middleware: false,
|
|
729
|
-
unstable_subResourceIntegrity: false
|
|
732
|
+
unstable_subResourceIntegrity: false,
|
|
733
|
+
unstable_trailingSlashAwareDataRequests: true
|
|
734
|
+
// always on for RSC
|
|
730
735
|
},
|
|
731
736
|
isSpaMode: false,
|
|
732
737
|
ssr: true,
|
|
@@ -743,8 +748,8 @@ function RSCHydratedRouter({
|
|
|
743
748
|
routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" },
|
|
744
749
|
routeModules
|
|
745
750
|
};
|
|
746
|
-
return /* @__PURE__ */ React3.createElement(
|
|
747
|
-
|
|
751
|
+
return /* @__PURE__ */ React3.createElement(_chunkZR2NIBH2js.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkO6YLM5NBjs.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkZR2NIBH2js.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
|
|
752
|
+
_chunkZR2NIBH2js.RouterProvider,
|
|
748
753
|
{
|
|
749
754
|
router: transitionEnabledRouter,
|
|
750
755
|
flushSync: ReactDOM2.flushSync
|
|
@@ -760,8 +765,8 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
760
765
|
// the server loader flow regardless of whether the client loader calls
|
|
761
766
|
// `serverLoader` or not, otherwise we'll have nothing to render.
|
|
762
767
|
match.hasComponent && !match.element;
|
|
763
|
-
|
|
764
|
-
|
|
768
|
+
_chunkZR2NIBH2js.invariant.call(void 0, window.__reactRouterRouteModules);
|
|
769
|
+
_chunkO6YLM5NBjs.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
|
|
765
770
|
let dataRoute = {
|
|
766
771
|
id: match.id,
|
|
767
772
|
element: match.element,
|
|
@@ -811,7 +816,7 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
811
816
|
return await callSingleFetch(singleFetch);
|
|
812
817
|
}
|
|
813
818
|
}) : match.hasAction ? (_, singleFetch) => callSingleFetch(singleFetch) : () => {
|
|
814
|
-
throw
|
|
819
|
+
throw _chunkZR2NIBH2js.noActionDefinedError.call(void 0, "action", match.id);
|
|
815
820
|
},
|
|
816
821
|
path: match.path,
|
|
817
822
|
shouldRevalidate: match.shouldRevalidate,
|
|
@@ -824,7 +829,7 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
824
829
|
hasShouldRevalidate: match.shouldRevalidate != null
|
|
825
830
|
};
|
|
826
831
|
if (typeof dataRoute.loader === "function") {
|
|
827
|
-
dataRoute.loader.hydrate =
|
|
832
|
+
dataRoute.loader.hydrate = _chunkZR2NIBH2js.shouldHydrateRouteLoader.call(void 0,
|
|
828
833
|
match.id,
|
|
829
834
|
match.clientLoader,
|
|
830
835
|
match.hasLoader,
|
|
@@ -834,7 +839,7 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
834
839
|
return dataRoute;
|
|
835
840
|
}
|
|
836
841
|
function callSingleFetch(singleFetch) {
|
|
837
|
-
|
|
842
|
+
_chunkZR2NIBH2js.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
|
|
838
843
|
return singleFetch();
|
|
839
844
|
}
|
|
840
845
|
function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
|
|
@@ -842,7 +847,7 @@ function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
|
|
|
842
847
|
let fn = type === "action" ? "serverAction()" : "serverLoader()";
|
|
843
848
|
let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${routeId}")`;
|
|
844
849
|
console.error(msg);
|
|
845
|
-
throw new (0,
|
|
850
|
+
throw new (0, _chunkZR2NIBH2js.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
|
|
846
851
|
}
|
|
847
852
|
}
|
|
848
853
|
var nextPaths = /* @__PURE__ */ new Set();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.
|
|
2
|
+
* react-router v7.12.0-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
deserializeErrors,
|
|
15
15
|
getHydrationData,
|
|
16
16
|
populateRSCRouteModules
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-ILRYJQTC.mjs";
|
|
18
18
|
import {
|
|
19
19
|
CRITICAL_CSS_DATA_ATTRIBUTE,
|
|
20
20
|
ErrorResponseImpl,
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
singleFetchUrl,
|
|
43
43
|
stripIndexParam,
|
|
44
44
|
useFogOFWarDiscovery
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-HFQUWXEK.mjs";
|
|
46
46
|
|
|
47
47
|
// lib/dom-export/dom-router-provider.tsx
|
|
48
48
|
import * as React from "react";
|
|
@@ -158,7 +158,8 @@ function createHydratedRouter({
|
|
|
158
158
|
ssrInfo.manifest,
|
|
159
159
|
ssrInfo.routeModules,
|
|
160
160
|
ssrInfo.context.ssr,
|
|
161
|
-
ssrInfo.context.basename
|
|
161
|
+
ssrInfo.context.basename,
|
|
162
|
+
ssrInfo.context.future.unstable_trailingSlashAwareDataRequests
|
|
162
163
|
),
|
|
163
164
|
patchRoutesOnNavigation: getPatchRoutesOnNavigationFunction(
|
|
164
165
|
ssrInfo.manifest,
|
|
@@ -524,6 +525,8 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
|
|
|
524
525
|
getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation),
|
|
525
526
|
ssr,
|
|
526
527
|
basename,
|
|
528
|
+
// .rsc requests are always trailing slash aware
|
|
529
|
+
true,
|
|
527
530
|
// If the route has a component but we don't have an element, we need to hit
|
|
528
531
|
// the server loader flow regardless of whether the client loader calls
|
|
529
532
|
// `serverLoader` or not, otherwise we'll have nothing to render.
|
|
@@ -561,9 +564,9 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
|
|
|
561
564
|
});
|
|
562
565
|
}
|
|
563
566
|
function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation) {
|
|
564
|
-
return async (args, basename, targetRoutes) => {
|
|
567
|
+
return async (args, basename, trailingSlashAware, targetRoutes) => {
|
|
565
568
|
let { request, context } = args;
|
|
566
|
-
let url = singleFetchUrl(request.url, basename, "rsc");
|
|
569
|
+
let url = singleFetchUrl(request.url, basename, trailingSlashAware, "rsc");
|
|
567
570
|
if (request.method === "GET") {
|
|
568
571
|
url = stripIndexParam(url);
|
|
569
572
|
if (targetRoutes) {
|
|
@@ -718,7 +721,9 @@ function RSCHydratedRouter({
|
|
|
718
721
|
// These flags have no runtime impact so can always be false. If we add
|
|
719
722
|
// flags that drive runtime behavior they'll need to be proxied through.
|
|
720
723
|
v8_middleware: false,
|
|
721
|
-
unstable_subResourceIntegrity: false
|
|
724
|
+
unstable_subResourceIntegrity: false,
|
|
725
|
+
unstable_trailingSlashAwareDataRequests: true
|
|
726
|
+
// always on for RSC
|
|
722
727
|
},
|
|
723
728
|
isSpaMode: false,
|
|
724
729
|
ssr: true,
|