react-router 7.5.1-pre.0 → 7.5.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 +19 -1
- package/dist/development/{chunk-QP2GE2RJ.mjs → chunk-BAXFHI7N.mjs} +104 -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 +89 -61
- package/dist/development/dom-export.mjs +17 -41
- package/dist/{production/fog-of-war-CyHis97d.d.mts → development/fog-of-war-BLArG-qZ.d.ts} +2 -2
- package/dist/development/{fog-of-war-D4x86-Xc.d.ts → fog-of-war-D2zsXvum.d.mts} +2 -2
- package/dist/development/index.d.mts +19 -16
- package/dist/development/index.d.ts +19 -16
- package/dist/development/index.js +105 -35
- package/dist/development/index.mjs +6 -4
- package/dist/development/lib/types/route-module.d.mts +1 -1
- package/dist/development/lib/types/route-module.d.ts +1 -1
- package/dist/development/lib/types/route-module.js +1 -1
- package/dist/development/lib/types/route-module.mjs +1 -1
- package/dist/development/{route-data-OcOrqK13.d.ts → route-data-C12CLHiN.d.mts} +1 -1
- package/dist/{production/route-data-OcOrqK13.d.mts → development/route-data-C12CLHiN.d.ts} +1 -1
- package/dist/production/{chunk-TOAG3JKW.mjs → chunk-XAHXRTXS.mjs} +104 -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 +89 -61
- package/dist/production/dom-export.mjs +17 -41
- package/dist/{development/fog-of-war-CyHis97d.d.mts → production/fog-of-war-BLArG-qZ.d.ts} +2 -2
- package/dist/production/{fog-of-war-D4x86-Xc.d.ts → fog-of-war-D2zsXvum.d.mts} +2 -2
- package/dist/production/index.d.mts +19 -16
- package/dist/production/index.d.ts +19 -16
- package/dist/production/index.js +105 -35
- package/dist/production/index.mjs +6 -4
- package/dist/production/lib/types/route-module.d.mts +1 -1
- package/dist/production/lib/types/route-module.d.ts +1 -1
- package/dist/production/lib/types/route-module.js +1 -1
- package/dist/production/lib/types/route-module.mjs +1 -1
- package/dist/production/{route-data-OcOrqK13.d.ts → route-data-C12CLHiN.d.mts} +1 -1
- package/dist/{development/route-data-OcOrqK13.d.mts → production/route-data-C12CLHiN.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.5.
|
|
2
|
+
* react-router v7.5.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -189,7 +189,7 @@ function getUrlBasedHistory(getLocation, createHref, validateLocation, options =
|
|
|
189
189
|
listener({ action, location: history.location, delta: 1 });
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
function
|
|
192
|
+
function replace(to, state) {
|
|
193
193
|
action = "REPLACE" /* Replace */;
|
|
194
194
|
let location = createLocation(history.location, to, state);
|
|
195
195
|
if (validateLocation) validateLocation(location, to);
|
|
@@ -242,7 +242,7 @@ function getUrlBasedHistory(getLocation, createHref, validateLocation, options =
|
|
|
242
242
|
};
|
|
243
243
|
},
|
|
244
244
|
push,
|
|
245
|
-
replace
|
|
245
|
+
replace,
|
|
246
246
|
go(n) {
|
|
247
247
|
return globalHistory.go(n);
|
|
248
248
|
}
|
|
@@ -1420,20 +1420,20 @@ function createRouter(init) {
|
|
|
1420
1420
|
}
|
|
1421
1421
|
}
|
|
1422
1422
|
if (isRedirectResult(result)) {
|
|
1423
|
-
let
|
|
1423
|
+
let replace;
|
|
1424
1424
|
if (opts && opts.replace != null) {
|
|
1425
|
-
|
|
1425
|
+
replace = opts.replace;
|
|
1426
1426
|
} else {
|
|
1427
1427
|
let location2 = normalizeRedirectLocation(
|
|
1428
1428
|
result.response.headers.get("Location"),
|
|
1429
1429
|
new URL(request.url),
|
|
1430
1430
|
basename
|
|
1431
1431
|
);
|
|
1432
|
-
|
|
1432
|
+
replace = location2 === state.location.pathname + state.location.search;
|
|
1433
1433
|
}
|
|
1434
1434
|
await startRedirectNavigation(request, result, true, {
|
|
1435
1435
|
submission,
|
|
1436
|
-
replace
|
|
1436
|
+
replace
|
|
1437
1437
|
});
|
|
1438
1438
|
return { shortCircuited: true };
|
|
1439
1439
|
}
|
|
@@ -1452,7 +1452,7 @@ function createRouter(init) {
|
|
|
1452
1452
|
pendingActionResult: [actionMatch.route.id, result]
|
|
1453
1453
|
};
|
|
1454
1454
|
}
|
|
1455
|
-
async function handleLoaders(request, location, matches, scopedContext, isFogOfWar, overrideNavigation, submission, fetcherSubmission,
|
|
1455
|
+
async function handleLoaders(request, location, matches, scopedContext, isFogOfWar, overrideNavigation, submission, fetcherSubmission, replace, initialHydration, flushSync2, pendingActionResult) {
|
|
1456
1456
|
let loadingNavigation = overrideNavigation || getLoadingNavigation(location, submission);
|
|
1457
1457
|
let activeSubmission = submission || fetcherSubmission || getSubmissionFromNavigation(loadingNavigation);
|
|
1458
1458
|
let shouldUpdateNavigationState = !isUninterruptedRevalidation && !initialHydration;
|
|
@@ -1585,7 +1585,7 @@ function createRouter(init) {
|
|
|
1585
1585
|
let redirect2 = findRedirect(loaderResults);
|
|
1586
1586
|
if (redirect2) {
|
|
1587
1587
|
await startRedirectNavigation(request, redirect2.result, true, {
|
|
1588
|
-
replace
|
|
1588
|
+
replace
|
|
1589
1589
|
});
|
|
1590
1590
|
return { shortCircuited: true };
|
|
1591
1591
|
}
|
|
@@ -1593,7 +1593,7 @@ function createRouter(init) {
|
|
|
1593
1593
|
if (redirect2) {
|
|
1594
1594
|
fetchRedirectIds.add(redirect2.key);
|
|
1595
1595
|
await startRedirectNavigation(request, redirect2.result, true, {
|
|
1596
|
-
replace
|
|
1596
|
+
replace
|
|
1597
1597
|
});
|
|
1598
1598
|
return { shortCircuited: true };
|
|
1599
1599
|
}
|
|
@@ -2032,7 +2032,7 @@ function createRouter(init) {
|
|
|
2032
2032
|
submission,
|
|
2033
2033
|
fetcherSubmission,
|
|
2034
2034
|
preventScrollReset,
|
|
2035
|
-
replace
|
|
2035
|
+
replace
|
|
2036
2036
|
} = {}) {
|
|
2037
2037
|
if (redirect2.response.headers.has("X-Remix-Revalidate")) {
|
|
2038
2038
|
isRevalidationRequired = true;
|
|
@@ -2058,7 +2058,7 @@ function createRouter(init) {
|
|
|
2058
2058
|
stripBasename(url.pathname, basename) == null;
|
|
2059
2059
|
}
|
|
2060
2060
|
if (isDocumentReload) {
|
|
2061
|
-
if (
|
|
2061
|
+
if (replace) {
|
|
2062
2062
|
routerWindow.location.replace(location);
|
|
2063
2063
|
} else {
|
|
2064
2064
|
routerWindow.location.assign(location);
|
|
@@ -2067,7 +2067,7 @@ function createRouter(init) {
|
|
|
2067
2067
|
}
|
|
2068
2068
|
}
|
|
2069
2069
|
pendingNavigationController = null;
|
|
2070
|
-
let redirectNavigationType =
|
|
2070
|
+
let redirectNavigationType = replace === true || redirect2.response.headers.has("X-Remix-Replace") ? "REPLACE" /* Replace */ : "PUSH" /* Push */;
|
|
2071
2071
|
let { formMethod, formAction, formEncType } = state.navigation;
|
|
2072
2072
|
if (!submission && !fetcherSubmission && formMethod && formAction && formEncType) {
|
|
2073
2073
|
submission = getSubmissionFromNavigation(state.navigation);
|
|
@@ -4835,11 +4835,21 @@ async function createRequestInit(request) {
|
|
|
4835
4835
|
|
|
4836
4836
|
// lib/dom/ssr/single-fetch.tsx
|
|
4837
4837
|
var SingleFetchRedirectSymbol = Symbol("SingleFetchRedirect");
|
|
4838
|
+
var SINGLE_FETCH_REDIRECT_STATUS = 202;
|
|
4838
4839
|
var NO_BODY_STATUS_CODES = /* @__PURE__ */ new Set([100, 101, 204, 205]);
|
|
4839
|
-
function
|
|
4840
|
+
function getTurboStreamSingleFetchDataStrategy(getRouter, manifest, routeModules, ssr, basename) {
|
|
4840
4841
|
let dataStrategy = getSingleFetchDataStrategyImpl(
|
|
4841
4842
|
getRouter,
|
|
4842
|
-
|
|
4843
|
+
(match) => {
|
|
4844
|
+
let manifestRoute = manifest.routes[match.route.id];
|
|
4845
|
+
invariant2(manifestRoute, "Route not found in manifest");
|
|
4846
|
+
let routeModule = routeModules[match.route.id];
|
|
4847
|
+
return {
|
|
4848
|
+
hasLoader: manifestRoute.hasLoader,
|
|
4849
|
+
hasClientLoader: manifestRoute.hasClientLoader,
|
|
4850
|
+
hasShouldRevalidate: Boolean(routeModule?.shouldRevalidate)
|
|
4851
|
+
};
|
|
4852
|
+
},
|
|
4843
4853
|
fetchAndDecodeViaTurboStream,
|
|
4844
4854
|
ssr,
|
|
4845
4855
|
basename
|
|
@@ -4854,7 +4864,7 @@ function getSingleFetchDataStrategyImpl(getRouter, getRouteInfo, fetchAndDecode,
|
|
|
4854
4864
|
return singleFetchActionStrategy(args, fetchAndDecode, basename);
|
|
4855
4865
|
}
|
|
4856
4866
|
let foundRevalidatingServerLoader = matches.some((m) => {
|
|
4857
|
-
let { hasLoader, hasClientLoader } = getRouteInfo(m
|
|
4867
|
+
let { hasLoader, hasClientLoader } = getRouteInfo(m);
|
|
4858
4868
|
return m.unstable_shouldCallHandler() && hasLoader && !hasClientLoader;
|
|
4859
4869
|
});
|
|
4860
4870
|
if (!ssr && !foundRevalidatingServerLoader) {
|
|
@@ -4906,7 +4916,7 @@ async function nonSsrStrategy(args, getRouteInfo, fetchAndDecode, basename) {
|
|
|
4906
4916
|
matchesToLoad.map(
|
|
4907
4917
|
(m) => m.resolve(async (handler) => {
|
|
4908
4918
|
try {
|
|
4909
|
-
let { hasClientLoader } = getRouteInfo(m
|
|
4919
|
+
let { hasClientLoader } = getRouteInfo(m);
|
|
4910
4920
|
let routeId = m.route.id;
|
|
4911
4921
|
let result = hasClientLoader ? await handler(async () => {
|
|
4912
4922
|
let { data: data2 } = await fetchAndDecode(args, basename, [routeId]);
|
|
@@ -4932,7 +4942,7 @@ async function singleFetchLoaderNavigationStrategy(args, router2, getRouteInfo,
|
|
|
4932
4942
|
async (m, i) => m.resolve(async (handler) => {
|
|
4933
4943
|
routeDfds[i].resolve();
|
|
4934
4944
|
let routeId = m.route.id;
|
|
4935
|
-
let { hasLoader, hasClientLoader, hasShouldRevalidate } = getRouteInfo(
|
|
4945
|
+
let { hasLoader, hasClientLoader, hasShouldRevalidate } = getRouteInfo(m);
|
|
4936
4946
|
let defaultShouldRevalidate = !m.unstable_shouldRevalidateArgs || m.unstable_shouldRevalidateArgs.actionStatus == null || m.unstable_shouldRevalidateArgs.actionStatus < 400;
|
|
4937
4947
|
let shouldCall = m.unstable_shouldCallHandler(defaultShouldRevalidate);
|
|
4938
4948
|
if (!shouldCall) {
|
|
@@ -4973,7 +4983,7 @@ async function singleFetchLoaderNavigationStrategy(args, router2, getRouteInfo,
|
|
|
4973
4983
|
);
|
|
4974
4984
|
await Promise.all(routeDfds.map((d) => d.promise));
|
|
4975
4985
|
if ((!router2.state.initialized || routesParams.size === 0) && !window.__reactRouterHdrActive) {
|
|
4976
|
-
singleFetchDfd.resolve({});
|
|
4986
|
+
singleFetchDfd.resolve({ routes: {} });
|
|
4977
4987
|
} else {
|
|
4978
4988
|
let targetRoutes = ssr && foundOptOutRoute && routesParams.size > 0 ? [...routesParams.keys()] : void 0;
|
|
4979
4989
|
try {
|
|
@@ -5041,6 +5051,20 @@ async function fetchAndDecodeViaTurboStream(args, basename, targetRoutes) {
|
|
|
5041
5051
|
if (res.status === 404 && !res.headers.has("X-Remix-Response")) {
|
|
5042
5052
|
throw new ErrorResponseImpl(404, "Not Found", true);
|
|
5043
5053
|
}
|
|
5054
|
+
if (res.status === 204 && res.headers.has("X-Remix-Redirect")) {
|
|
5055
|
+
return {
|
|
5056
|
+
status: SINGLE_FETCH_REDIRECT_STATUS,
|
|
5057
|
+
data: {
|
|
5058
|
+
redirect: {
|
|
5059
|
+
redirect: res.headers.get("X-Remix-Redirect"),
|
|
5060
|
+
status: Number(res.headers.get("X-Remix-Status") || "302"),
|
|
5061
|
+
revalidate: res.headers.get("X-Remix-Revalidate") === "true",
|
|
5062
|
+
reload: res.headers.get("X-Remix-Reload-Document") === "true",
|
|
5063
|
+
replace: res.headers.get("X-Remix-Replace") === "true"
|
|
5064
|
+
}
|
|
5065
|
+
}
|
|
5066
|
+
};
|
|
5067
|
+
}
|
|
5044
5068
|
if (NO_BODY_STATUS_CODES.has(res.status)) {
|
|
5045
5069
|
let routes = {};
|
|
5046
5070
|
if (targetRoutes && request.method !== "GET") {
|
|
@@ -5116,7 +5140,7 @@ function unwrapSingleFetchResult(result, routeId) {
|
|
|
5116
5140
|
redirect: location,
|
|
5117
5141
|
revalidate,
|
|
5118
5142
|
reload,
|
|
5119
|
-
replace
|
|
5143
|
+
replace,
|
|
5120
5144
|
status
|
|
5121
5145
|
} = result.redirect;
|
|
5122
5146
|
throw redirect(location, {
|
|
@@ -5125,7 +5149,7 @@ function unwrapSingleFetchResult(result, routeId) {
|
|
|
5125
5149
|
// Three R's of redirecting (lol Veep)
|
|
5126
5150
|
...revalidate ? { "X-Remix-Revalidate": "yes" } : null,
|
|
5127
5151
|
...reload ? { "X-Remix-Reload-Document": "yes" } : null,
|
|
5128
|
-
...
|
|
5152
|
+
...replace ? { "X-Remix-Replace": "yes" } : null
|
|
5129
5153
|
}
|
|
5130
5154
|
});
|
|
5131
5155
|
}
|
|
@@ -5451,8 +5475,9 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
5451
5475
|
}
|
|
5452
5476
|
};
|
|
5453
5477
|
dataRoute.loader.hydrate = shouldHydrateRouteLoader(
|
|
5454
|
-
route,
|
|
5455
|
-
routeModule,
|
|
5478
|
+
route.id,
|
|
5479
|
+
routeModule.clientLoader,
|
|
5480
|
+
route.hasLoader,
|
|
5456
5481
|
isSpaMode
|
|
5457
5482
|
);
|
|
5458
5483
|
dataRoute.action = ({ request, params, context }, singleFetch) => {
|
|
@@ -5650,8 +5675,8 @@ function getRouteModuleComponent(routeModule) {
|
|
|
5650
5675
|
return routeModule.default;
|
|
5651
5676
|
}
|
|
5652
5677
|
}
|
|
5653
|
-
function shouldHydrateRouteLoader(
|
|
5654
|
-
return isSpaMode &&
|
|
5678
|
+
function shouldHydrateRouteLoader(routeId, clientLoader, hasLoader, isSpaMode) {
|
|
5679
|
+
return isSpaMode && routeId !== "root" || clientLoader != null && (clientLoader.hydrate === true || hasLoader !== true);
|
|
5655
5680
|
}
|
|
5656
5681
|
|
|
5657
5682
|
// lib/dom/ssr/fog-of-war.ts
|
|
@@ -6062,6 +6087,32 @@ function deserializeErrors(errors) {
|
|
|
6062
6087
|
return serialized;
|
|
6063
6088
|
}
|
|
6064
6089
|
|
|
6090
|
+
// lib/dom/ssr/hydration.tsx
|
|
6091
|
+
function getHydrationData(state, routes, getRouteInfo, location, basename, isSpaMode) {
|
|
6092
|
+
let hydrationData = {
|
|
6093
|
+
...state,
|
|
6094
|
+
loaderData: { ...state.loaderData }
|
|
6095
|
+
};
|
|
6096
|
+
let initialMatches = matchRoutes(routes, location, basename);
|
|
6097
|
+
if (initialMatches) {
|
|
6098
|
+
for (let match of initialMatches) {
|
|
6099
|
+
let routeId = match.route.id;
|
|
6100
|
+
let routeInfo = getRouteInfo(routeId);
|
|
6101
|
+
if (shouldHydrateRouteLoader(
|
|
6102
|
+
routeId,
|
|
6103
|
+
routeInfo.clientLoader,
|
|
6104
|
+
routeInfo.hasLoader,
|
|
6105
|
+
isSpaMode
|
|
6106
|
+
) && (routeInfo.hasHydrateFallback || !routeInfo.hasLoader)) {
|
|
6107
|
+
delete hydrationData.loaderData[routeId];
|
|
6108
|
+
} else if (!routeInfo.hasLoader) {
|
|
6109
|
+
hydrationData.loaderData[routeId] = null;
|
|
6110
|
+
}
|
|
6111
|
+
}
|
|
6112
|
+
}
|
|
6113
|
+
return hydrationData;
|
|
6114
|
+
}
|
|
6115
|
+
|
|
6065
6116
|
// lib/dom-export/dom-router-provider.tsx
|
|
6066
6117
|
function RouterProvider2(props) {
|
|
6067
6118
|
return /* @__PURE__ */ React10.createElement(RouterProvider, { flushSync: ReactDOM.flushSync, ...props });
|
|
@@ -6130,8 +6181,8 @@ function createHydratedRouter({
|
|
|
6130
6181
|
ssrInfo.context.isSpaMode
|
|
6131
6182
|
);
|
|
6132
6183
|
let hydrationData = void 0;
|
|
6133
|
-
let loaderData = ssrInfo.context.state.loaderData;
|
|
6134
6184
|
if (ssrInfo.context.isSpaMode) {
|
|
6185
|
+
let { loaderData } = ssrInfo.context.state;
|
|
6135
6186
|
if (ssrInfo.manifest.routes.root?.hasLoader && loaderData && "root" in loaderData) {
|
|
6136
6187
|
hydrationData = {
|
|
6137
6188
|
loaderData: {
|
|
@@ -6140,31 +6191,18 @@ function createHydratedRouter({
|
|
|
6140
6191
|
};
|
|
6141
6192
|
}
|
|
6142
6193
|
} else {
|
|
6143
|
-
hydrationData =
|
|
6144
|
-
|
|
6145
|
-
loaderData: { ...loaderData }
|
|
6146
|
-
};
|
|
6147
|
-
let initialMatches = matchRoutes(
|
|
6194
|
+
hydrationData = getHydrationData(
|
|
6195
|
+
ssrInfo.context.state,
|
|
6148
6196
|
routes,
|
|
6197
|
+
(routeId) => ({
|
|
6198
|
+
clientLoader: ssrInfo.routeModules[routeId]?.clientLoader,
|
|
6199
|
+
hasLoader: ssrInfo.manifest.routes[routeId]?.hasLoader === true,
|
|
6200
|
+
hasHydrateFallback: ssrInfo.routeModules[routeId]?.HydrateFallback != null
|
|
6201
|
+
}),
|
|
6149
6202
|
window.location,
|
|
6150
|
-
window.__reactRouterContext?.basename
|
|
6203
|
+
window.__reactRouterContext?.basename,
|
|
6204
|
+
ssrInfo.context.isSpaMode
|
|
6151
6205
|
);
|
|
6152
|
-
if (initialMatches) {
|
|
6153
|
-
for (let match of initialMatches) {
|
|
6154
|
-
let routeId = match.route.id;
|
|
6155
|
-
let route = ssrInfo.routeModules[routeId];
|
|
6156
|
-
let manifestRoute = ssrInfo.manifest.routes[routeId];
|
|
6157
|
-
if (route && manifestRoute && shouldHydrateRouteLoader(
|
|
6158
|
-
manifestRoute,
|
|
6159
|
-
route,
|
|
6160
|
-
ssrInfo.context.isSpaMode
|
|
6161
|
-
) && (route.HydrateFallback || !manifestRoute.hasLoader)) {
|
|
6162
|
-
delete hydrationData.loaderData[routeId];
|
|
6163
|
-
} else if (manifestRoute && !manifestRoute.hasLoader) {
|
|
6164
|
-
hydrationData.loaderData[routeId] = null;
|
|
6165
|
-
}
|
|
6166
|
-
}
|
|
6167
|
-
}
|
|
6168
6206
|
if (hydrationData && hydrationData.errors) {
|
|
6169
6207
|
hydrationData.errors = deserializeErrors(hydrationData.errors);
|
|
6170
6208
|
}
|
|
@@ -6180,20 +6218,10 @@ function createHydratedRouter({
|
|
|
6180
6218
|
future: {
|
|
6181
6219
|
unstable_middleware: ssrInfo.context.future.unstable_middleware
|
|
6182
6220
|
},
|
|
6183
|
-
dataStrategy:
|
|
6221
|
+
dataStrategy: getTurboStreamSingleFetchDataStrategy(
|
|
6184
6222
|
() => router2,
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
invariant(manifestRoute, "Route not found in manifest/routeModules");
|
|
6188
|
-
let routeModule = ssrInfo.routeModules[routeId];
|
|
6189
|
-
return {
|
|
6190
|
-
hasLoader: manifestRoute.hasLoader,
|
|
6191
|
-
hasClientLoader: manifestRoute.hasClientLoader,
|
|
6192
|
-
// In some cases the module may not be loaded yet and we don't care
|
|
6193
|
-
// if it's got shouldRevalidate or not
|
|
6194
|
-
hasShouldRevalidate: routeModule ? routeModule.shouldRevalidate != null : void 0
|
|
6195
|
-
};
|
|
6196
|
-
},
|
|
6223
|
+
ssrInfo.manifest,
|
|
6224
|
+
ssrInfo.routeModules,
|
|
6197
6225
|
ssrInfo.context.ssr,
|
|
6198
6226
|
ssrInfo.context.basename
|
|
6199
6227
|
),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.5.
|
|
2
|
+
* react-router v7.5.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -18,15 +18,14 @@ import {
|
|
|
18
18
|
createRouter,
|
|
19
19
|
decodeViaTurboStream,
|
|
20
20
|
deserializeErrors,
|
|
21
|
+
getHydrationData,
|
|
21
22
|
getPatchRoutesOnNavigationFunction,
|
|
22
|
-
|
|
23
|
+
getTurboStreamSingleFetchDataStrategy,
|
|
23
24
|
hydrationRouteProperties,
|
|
24
25
|
invariant,
|
|
25
26
|
mapRouteProperties,
|
|
26
|
-
matchRoutes,
|
|
27
|
-
shouldHydrateRouteLoader,
|
|
28
27
|
useFogOFWarDiscovery
|
|
29
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-BAXFHI7N.mjs";
|
|
30
29
|
|
|
31
30
|
// lib/dom-export/dom-router-provider.tsx
|
|
32
31
|
import * as React from "react";
|
|
@@ -98,8 +97,8 @@ function createHydratedRouter({
|
|
|
98
97
|
ssrInfo.context.isSpaMode
|
|
99
98
|
);
|
|
100
99
|
let hydrationData = void 0;
|
|
101
|
-
let loaderData = ssrInfo.context.state.loaderData;
|
|
102
100
|
if (ssrInfo.context.isSpaMode) {
|
|
101
|
+
let { loaderData } = ssrInfo.context.state;
|
|
103
102
|
if (ssrInfo.manifest.routes.root?.hasLoader && loaderData && "root" in loaderData) {
|
|
104
103
|
hydrationData = {
|
|
105
104
|
loaderData: {
|
|
@@ -108,31 +107,18 @@ function createHydratedRouter({
|
|
|
108
107
|
};
|
|
109
108
|
}
|
|
110
109
|
} else {
|
|
111
|
-
hydrationData =
|
|
112
|
-
|
|
113
|
-
loaderData: { ...loaderData }
|
|
114
|
-
};
|
|
115
|
-
let initialMatches = matchRoutes(
|
|
110
|
+
hydrationData = getHydrationData(
|
|
111
|
+
ssrInfo.context.state,
|
|
116
112
|
routes,
|
|
113
|
+
(routeId) => ({
|
|
114
|
+
clientLoader: ssrInfo.routeModules[routeId]?.clientLoader,
|
|
115
|
+
hasLoader: ssrInfo.manifest.routes[routeId]?.hasLoader === true,
|
|
116
|
+
hasHydrateFallback: ssrInfo.routeModules[routeId]?.HydrateFallback != null
|
|
117
|
+
}),
|
|
117
118
|
window.location,
|
|
118
|
-
window.__reactRouterContext?.basename
|
|
119
|
+
window.__reactRouterContext?.basename,
|
|
120
|
+
ssrInfo.context.isSpaMode
|
|
119
121
|
);
|
|
120
|
-
if (initialMatches) {
|
|
121
|
-
for (let match of initialMatches) {
|
|
122
|
-
let routeId = match.route.id;
|
|
123
|
-
let route = ssrInfo.routeModules[routeId];
|
|
124
|
-
let manifestRoute = ssrInfo.manifest.routes[routeId];
|
|
125
|
-
if (route && manifestRoute && shouldHydrateRouteLoader(
|
|
126
|
-
manifestRoute,
|
|
127
|
-
route,
|
|
128
|
-
ssrInfo.context.isSpaMode
|
|
129
|
-
) && (route.HydrateFallback || !manifestRoute.hasLoader)) {
|
|
130
|
-
delete hydrationData.loaderData[routeId];
|
|
131
|
-
} else if (manifestRoute && !manifestRoute.hasLoader) {
|
|
132
|
-
hydrationData.loaderData[routeId] = null;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
122
|
if (hydrationData && hydrationData.errors) {
|
|
137
123
|
hydrationData.errors = deserializeErrors(hydrationData.errors);
|
|
138
124
|
}
|
|
@@ -148,20 +134,10 @@ function createHydratedRouter({
|
|
|
148
134
|
future: {
|
|
149
135
|
unstable_middleware: ssrInfo.context.future.unstable_middleware
|
|
150
136
|
},
|
|
151
|
-
dataStrategy:
|
|
137
|
+
dataStrategy: getTurboStreamSingleFetchDataStrategy(
|
|
152
138
|
() => router2,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
invariant(manifestRoute, "Route not found in manifest/routeModules");
|
|
156
|
-
let routeModule = ssrInfo.routeModules[routeId];
|
|
157
|
-
return {
|
|
158
|
-
hasLoader: manifestRoute.hasLoader,
|
|
159
|
-
hasClientLoader: manifestRoute.hasClientLoader,
|
|
160
|
-
// In some cases the module may not be loaded yet and we don't care
|
|
161
|
-
// if it's got shouldRevalidate or not
|
|
162
|
-
hasShouldRevalidate: routeModule ? routeModule.shouldRevalidate != null : void 0
|
|
163
|
-
};
|
|
164
|
-
},
|
|
139
|
+
ssrInfo.manifest,
|
|
140
|
+
ssrInfo.routeModules,
|
|
165
141
|
ssrInfo.context.ssr,
|
|
166
142
|
ssrInfo.context.basename
|
|
167
143
|
),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { k as RouteObject, R as RouterInit, F as FutureConfig$1, H as HydrationState, I as InitialEntry, D as DataStrategyFunction, at as PatchRoutesOnNavigationFunction, a as Router$1, T as To, d as RelativeRoutingType, y as NonIndexRouteObject, a5 as LazyRouteFunction, s as IndexRouteObject, e as Location, f as Action, as as Navigator, av as RouteMatch, p as StaticHandlerContext, c as RouteManifest, b as RouteModules, G as DataRouteObject, J as ClientLoaderFunction, a4 as HTMLFormMethod, a2 as FormEncType, aD as PageLinkDescriptor, aT as History, O as GetScrollRestorationKeyFunction, N as NavigateOptions, Q as Fetcher, n as SerializeFrom, B as BlockerFunction } from './route-data-C12CLHiN.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @private
|
|
@@ -488,7 +488,7 @@ interface EntryRoute extends Route {
|
|
|
488
488
|
}
|
|
489
489
|
declare function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation: Set<string>, manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState, ssr: boolean, isSpaMode: boolean): DataRouteObject[];
|
|
490
490
|
declare function createClientRoutes(manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState | null, ssr: boolean, isSpaMode: boolean, parentId?: string, routesByParentId?: Record<string, Omit<EntryRoute, "children">[]>, needsRevalidation?: Set<string>): DataRouteObject[];
|
|
491
|
-
declare function shouldHydrateRouteLoader(
|
|
491
|
+
declare function shouldHydrateRouteLoader(routeId: string, clientLoader: ClientLoaderFunction | undefined, hasLoader: boolean, isSpaMode: boolean): boolean;
|
|
492
492
|
|
|
493
493
|
type ParamKeyValuePair = [string, string];
|
|
494
494
|
type URLSearchParamsInit = string | ParamKeyValuePair[] | Record<string, string | string[]> | URLSearchParams;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { k as RouteObject, R as RouterInit, F as FutureConfig$1, H as HydrationState, I as InitialEntry, D as DataStrategyFunction, at as PatchRoutesOnNavigationFunction, a as Router$1, T as To, d as RelativeRoutingType, y as NonIndexRouteObject, a5 as LazyRouteFunction, s as IndexRouteObject, e as Location, f as Action, as as Navigator, av as RouteMatch, p as StaticHandlerContext, c as RouteManifest, b as RouteModules, G as DataRouteObject, J as ClientLoaderFunction, a4 as HTMLFormMethod, a2 as FormEncType, aD as PageLinkDescriptor, aT as History, O as GetScrollRestorationKeyFunction, N as NavigateOptions, Q as Fetcher, n as SerializeFrom, B as BlockerFunction } from './route-data-C12CLHiN.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @private
|
|
@@ -488,7 +488,7 @@ interface EntryRoute extends Route {
|
|
|
488
488
|
}
|
|
489
489
|
declare function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation: Set<string>, manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState, ssr: boolean, isSpaMode: boolean): DataRouteObject[];
|
|
490
490
|
declare function createClientRoutes(manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState | null, ssr: boolean, isSpaMode: boolean, parentId?: string, routesByParentId?: Record<string, Omit<EntryRoute, "children">[]>, needsRevalidation?: Set<string>): DataRouteObject[];
|
|
491
|
-
declare function shouldHydrateRouteLoader(
|
|
491
|
+
declare function shouldHydrateRouteLoader(routeId: string, clientLoader: ClientLoaderFunction | undefined, hasLoader: boolean, isSpaMode: boolean): boolean;
|
|
492
492
|
|
|
493
493
|
type ParamKeyValuePair = [string, string];
|
|
494
494
|
type URLSearchParamsInit = string | ParamKeyValuePair[] | Record<string, string | string[]> | URLSearchParams;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as Router, D as DataStrategyFunction,
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
export { g as Await, b as AwaitProps, T as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, w as FetcherFormProps, G as FetcherSubmitFunction, a7 as FetcherSubmitOptions, J as FetcherWithComponents, Y as Form, x as FormProps, U as HashRouter, H as HashRouterProps, s as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, V as Link, t as LinkProps, ae as Links, h as MemoryRouter, M as MemoryRouterOpts, c as MemoryRouterProps, ad as Meta, X as NavLink, u as NavLinkProps, v as NavLinkRenderProps, i as Navigate, N as NavigateProps, j as Outlet, O as OutletProps, a8 as ParamKeyValuePair, P as PathRouteProps, ag as PrefetchPageLinks, k as Route, d as RouteProps, l as Router, e as RouterProps, m as RouterProvider, R as RouterProviderProps, n as Routes, f as RoutesProps, af as Scripts, ah as ScriptsProps, Z as ScrollRestoration, S as ScrollRestorationProps, y as SetURLSearchParams, z as SubmitFunction, a9 as SubmitOptions, ab as SubmitTarget, ak as UNSAFE_FrameworkContext, an as UNSAFE_createClientRoutes, ao as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, al as UNSAFE_getPatchRoutesOnNavigationFunction, ai as UNSAFE_hydrationRouteProperties, aj as UNSAFE_mapRouteProperties, ap as UNSAFE_shouldHydrateRouteLoader, am as UNSAFE_useFogOFWarDiscovery, aq as UNSAFE_useScrollRestoration, aa as URLSearchParamsInit, K as createBrowserRouter, Q as createHashRouter, o as createMemoryRouter, p as createRoutesFromChildren, q as createRoutesFromElements, ac as createSearchParams, r as renderMatches, W as unstable_HistoryRouter, a5 as unstable_usePrompt, a4 as useBeforeUnload, a2 as useFetcher, a3 as useFetchers, a1 as useFormAction, _ as useLinkClickHandler, $ as useSearchParams, a0 as useSubmit, a6 as useViewTransitionState } from './fog-of-war-
|
|
1
|
+
import { a as Router, b as RouteModules, D as DataStrategyFunction, c as RouteManifest, S as ServerRouteModule, M as MiddlewareEnabled, u as unstable_RouterContextProvider, L as LoaderFunctionArgs, A as ActionFunctionArgs, T as To, d as RelativeRoutingType, e as Location, f as Action, P as ParamParseKey, g as Path, h as PathPattern, i as PathMatch, N as NavigateOptions, j as Params$1, k as RouteObject, l as Navigation, m as RevalidationState, U as UIMatch, n as SerializeFrom, B as BlockerFunction, o as Blocker, p as StaticHandlerContext, q as StaticHandler, F as FutureConfig$1, C as CreateStaticHandlerOptions$1, I as InitialEntry, H as HydrationState, r as unstable_InitialContext, s as IndexRouteObject, t as LoaderFunction, v as ActionFunction, w as MetaFunction, x as LinksFunction, y as NonIndexRouteObject, E as Equal, z as RouterState, G as DataRouteObject, J as ClientLoaderFunction } from './route-data-C12CLHiN.mjs';
|
|
2
|
+
export { aw as ClientActionFunction, ax as ClientActionFunctionArgs, ay as ClientLoaderFunctionArgs, ar as DataRouteMatch, Z as DataStrategyFunctionArgs, _ as DataStrategyMatch, $ as DataStrategyResult, a1 as ErrorResponse, Q as Fetcher, a2 as FormEncType, a3 as FormMethod, aG as Future, K as GetScrollPositionFunction, O as GetScrollRestorationKeyFunction, a4 as HTMLFormMethod, az as HeadersArgs, aA as HeadersFunction, aE as HtmlLinkDescriptor, ah as IDLE_BLOCKER, ag as IDLE_FETCHER, af as IDLE_NAVIGATION, a5 as LazyRouteFunction, aF as LinkDescriptor, aB as MetaArgs, aC as MetaDescriptor, V as NavigationStates, as as Navigator, aD as PageLinkDescriptor, at as PatchRoutesOnNavigationFunction, au as PatchRoutesOnNavigationFunctionArgs, a7 as PathParam, a8 as RedirectFunction, av as RouteMatch, Y as RouterFetchOptions, R as RouterInit, X as RouterNavigateOptions, W as RouterSubscriber, aa as ShouldRevalidateFunction, ab as ShouldRevalidateFunctionArgs, aM as UNSAFE_DataRouterContext, aN as UNSAFE_DataRouterStateContext, a0 as UNSAFE_DataWithResponseInit, aL as UNSAFE_ErrorResponseImpl, aO as UNSAFE_FetchersContext, aP as UNSAFE_LocationContext, aQ as UNSAFE_NavigationContext, aR as UNSAFE_RouteContext, aS as UNSAFE_ViewTransitionContext, aI as UNSAFE_createBrowserHistory, aK as UNSAFE_createRouter, aJ as UNSAFE_invariant, ad as createPath, ai as data, aj as generatePath, ak as isRouteErrorResponse, al as matchPath, am as matchRoutes, ae as parsePath, an as redirect, ao as redirectDocument, ap as replace, aq as resolvePath, a6 as unstable_MiddlewareFunction, a9 as unstable_RouterContext, aH as unstable_SerializesTo, ac as unstable_createContext } from './route-data-C12CLHiN.mjs';
|
|
3
|
+
import { A as AssetsManifest, a as Route, F as FutureConfig, E as EntryContext, C as CriticalCss } from './fog-of-war-D2zsXvum.mjs';
|
|
4
|
+
export { g as Await, b as AwaitProps, T as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, w as FetcherFormProps, G as FetcherSubmitFunction, a7 as FetcherSubmitOptions, J as FetcherWithComponents, Y as Form, x as FormProps, U as HashRouter, H as HashRouterProps, s as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, V as Link, t as LinkProps, ae as Links, h as MemoryRouter, M as MemoryRouterOpts, c as MemoryRouterProps, ad as Meta, X as NavLink, u as NavLinkProps, v as NavLinkRenderProps, i as Navigate, N as NavigateProps, j as Outlet, O as OutletProps, a8 as ParamKeyValuePair, P as PathRouteProps, ag as PrefetchPageLinks, k as Route, d as RouteProps, l as Router, e as RouterProps, m as RouterProvider, R as RouterProviderProps, n as Routes, f as RoutesProps, af as Scripts, ah as ScriptsProps, Z as ScrollRestoration, S as ScrollRestorationProps, y as SetURLSearchParams, z as SubmitFunction, a9 as SubmitOptions, ab as SubmitTarget, ak as UNSAFE_FrameworkContext, an as UNSAFE_createClientRoutes, ao as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, al as UNSAFE_getPatchRoutesOnNavigationFunction, ai as UNSAFE_hydrationRouteProperties, aj as UNSAFE_mapRouteProperties, ap as UNSAFE_shouldHydrateRouteLoader, am as UNSAFE_useFogOFWarDiscovery, aq as UNSAFE_useScrollRestoration, aa as URLSearchParamsInit, K as createBrowserRouter, Q as createHashRouter, o as createMemoryRouter, p as createRoutesFromChildren, q as createRoutesFromElements, ac as createSearchParams, r as renderMatches, W as unstable_HistoryRouter, a5 as unstable_usePrompt, a4 as useBeforeUnload, a2 as useFetcher, a3 as useFetchers, a1 as useFormAction, _ as useLinkClickHandler, $ as useSearchParams, a0 as useSubmit, a6 as useViewTransitionState } from './fog-of-war-D2zsXvum.mjs';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { ReactElement } from 'react';
|
|
7
7
|
import { ParseOptions, SerializeOptions } from 'cookie';
|
|
@@ -9,12 +9,7 @@ export { ParseOptions as CookieParseOptions, SerializeOptions as CookieSerialize
|
|
|
9
9
|
import { A as AppLoadContext } from './data-CQbyyGzl.mjs';
|
|
10
10
|
|
|
11
11
|
declare const SingleFetchRedirectSymbol: unique symbol;
|
|
12
|
-
|
|
13
|
-
hasLoader: boolean;
|
|
14
|
-
hasClientLoader: boolean;
|
|
15
|
-
hasShouldRevalidate: boolean | undefined;
|
|
16
|
-
};
|
|
17
|
-
declare function getSingleFetchDataStrategy(getRouter: () => Router, getRouteInfo: GetRouteInfoFunction, ssr: boolean, basename: string | undefined): DataStrategyFunction;
|
|
12
|
+
declare function getTurboStreamSingleFetchDataStrategy(getRouter: () => Router, manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, basename: string | undefined): DataStrategyFunction;
|
|
18
13
|
declare function decodeViaTurboStream(body: ReadableStream<Uint8Array>, global: Window | typeof globalThis): Promise<{
|
|
19
14
|
done: Promise<undefined>;
|
|
20
15
|
value: unknown;
|
|
@@ -620,7 +615,7 @@ interface SessionData {
|
|
|
620
615
|
/**
|
|
621
616
|
* Session persists data across HTTP requests.
|
|
622
617
|
*
|
|
623
|
-
* @see https://
|
|
618
|
+
* @see https://reactrouter.com/explanation/sessions-and-cookies#sessions
|
|
624
619
|
*/
|
|
625
620
|
interface Session<Data = SessionData, FlashData = Data> {
|
|
626
621
|
/**
|
|
@@ -670,15 +665,13 @@ type CreateSessionFunction = <Data = SessionData, FlashData = Data>(initialData?
|
|
|
670
665
|
*
|
|
671
666
|
* Note: This function is typically not invoked directly by application code.
|
|
672
667
|
* Instead, use a `SessionStorage` object's `getSession` method.
|
|
673
|
-
*
|
|
674
|
-
* @see https://remix.run/utils/sessions#createsession
|
|
675
668
|
*/
|
|
676
669
|
declare const createSession: CreateSessionFunction;
|
|
677
670
|
type IsSessionFunction = (object: any) => object is Session;
|
|
678
671
|
/**
|
|
679
|
-
* Returns true if an object is a
|
|
672
|
+
* Returns true if an object is a React Router session.
|
|
680
673
|
*
|
|
681
|
-
* @see https://
|
|
674
|
+
* @see https://reactrouter.com/api/utils/isSession
|
|
682
675
|
*/
|
|
683
676
|
declare const isSession: IsSessionFunction;
|
|
684
677
|
/**
|
|
@@ -842,4 +835,14 @@ declare class RemixErrorBoundary extends React.Component<RemixErrorBoundaryProps
|
|
|
842
835
|
render(): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
|
|
843
836
|
}
|
|
844
837
|
|
|
845
|
-
|
|
838
|
+
declare function getHydrationData(state: {
|
|
839
|
+
loaderData?: Router["state"]["loaderData"];
|
|
840
|
+
actionData?: Router["state"]["actionData"];
|
|
841
|
+
errors?: Router["state"]["errors"];
|
|
842
|
+
}, routes: DataRouteObject[], getRouteInfo: (routeId: string) => {
|
|
843
|
+
clientLoader: ClientLoaderFunction | undefined;
|
|
844
|
+
hasLoader: boolean;
|
|
845
|
+
hasHydrateFallback: boolean;
|
|
846
|
+
}, location: Path, basename: string | undefined, isSpaMode: boolean): HydrationState;
|
|
847
|
+
|
|
848
|
+
export { ActionFunction, ActionFunctionArgs, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, type HandleDataRequestFunction, type HandleDocumentRequestFunction, type HandleErrorFunction, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, LoaderFunctionArgs, Location, MetaFunction, type NavigateFunction, NavigateOptions, Navigation, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params$1 as Params, Path, PathMatch, PathPattern, type Register, RelativeRoutingType, type RequestHandler, RevalidationState, RouteObject, RouterState, type RoutesTestStubProps, type ServerBuild, type ServerEntryModule, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, StaticHandler, StaticHandlerContext, StaticRouter, type StaticRouterProps, StaticRouterProvider, type StaticRouterProviderProps, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, createStaticHandler, createStaticRouter, href, isCookie, isSession, unstable_InitialContext, unstable_RouterContextProvider, setDevServerHooks as unstable_setDevServerHooks, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|