react-router 7.5.3 → 7.6.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 +70 -0
- package/dist/development/{chunk-AYJ5UCUI.mjs → chunk-D4RADZKF.mjs} +903 -139
- package/dist/development/dom-export.d.mts +2 -2
- package/dist/development/dom-export.d.ts +1 -2
- package/dist/development/dom-export.js +34 -6102
- package/dist/development/dom-export.mjs +6 -3
- package/dist/development/index.d.mts +33 -67
- package/dist/development/index.d.ts +1893 -197
- package/dist/development/index.js +905 -141
- package/dist/development/index.mjs +2 -2
- package/dist/development/lib/types/route-module.d.mts +1 -2
- package/dist/development/lib/types/route-module.d.ts +1 -2
- package/dist/development/lib/types/route-module.js +1 -1
- package/dist/development/lib/types/route-module.mjs +1 -1
- package/dist/{production/fog-of-war-BLArG-qZ.d.ts → development/lib-CCSAGgcP.d.mts} +57 -12
- package/dist/{production/route-data-C12CLHiN.d.mts → development/route-data-B9_30zbP.d.ts} +11 -1
- package/dist/development/{route-data-C12CLHiN.d.mts → route-data-C6QaL0wu.d.mts} +11 -1
- package/dist/production/{chunk-KKWFQRUV.mjs → chunk-CVXGOGHQ.mjs} +903 -139
- package/dist/production/dom-export.d.mts +2 -2
- package/dist/production/dom-export.d.ts +1 -2
- package/dist/production/dom-export.js +34 -6102
- package/dist/production/dom-export.mjs +6 -3
- package/dist/production/index.d.mts +33 -67
- package/dist/production/index.d.ts +1893 -197
- package/dist/production/index.js +905 -141
- package/dist/production/index.mjs +2 -2
- package/dist/production/lib/types/route-module.d.mts +1 -2
- package/dist/production/lib/types/route-module.d.ts +1 -2
- package/dist/production/lib/types/route-module.js +1 -1
- package/dist/production/lib/types/route-module.mjs +1 -1
- package/dist/{development/fog-of-war-BLArG-qZ.d.ts → production/lib-CCSAGgcP.d.mts} +57 -12
- package/dist/{development/route-data-C12CLHiN.d.ts → production/route-data-B9_30zbP.d.ts} +11 -1
- package/dist/production/{route-data-C12CLHiN.d.ts → route-data-C6QaL0wu.d.mts} +11 -1
- package/package.json +5 -3
- package/dist/development/data-CQbyyGzl.d.mts +0 -11
- package/dist/development/data-CQbyyGzl.d.ts +0 -11
- package/dist/development/fog-of-war-D2zsXvum.d.mts +0 -1691
- package/dist/production/data-CQbyyGzl.d.mts +0 -11
- package/dist/production/data-CQbyyGzl.d.ts +0 -11
- package/dist/production/fog-of-war-D2zsXvum.d.mts +0 -1691
package/dist/production/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.
|
|
2
|
+
* react-router v7.6.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -457,14 +457,7 @@ function getUrlBasedHistory(getLocation, createHref2, validateLocation, options
|
|
|
457
457
|
}
|
|
458
458
|
}
|
|
459
459
|
function createURL(to) {
|
|
460
|
-
|
|
461
|
-
let href2 = typeof to === "string" ? to : createPath(to);
|
|
462
|
-
href2 = href2.replace(/ $/, "%20");
|
|
463
|
-
invariant(
|
|
464
|
-
base,
|
|
465
|
-
`No window.location.(origin|href) available to create URL for href: ${href2}`
|
|
466
|
-
);
|
|
467
|
-
return new URL(href2, base);
|
|
460
|
+
return createBrowserURLImpl(to);
|
|
468
461
|
}
|
|
469
462
|
let history = {
|
|
470
463
|
get action() {
|
|
@@ -504,6 +497,19 @@ function getUrlBasedHistory(getLocation, createHref2, validateLocation, options
|
|
|
504
497
|
};
|
|
505
498
|
return history;
|
|
506
499
|
}
|
|
500
|
+
function createBrowserURLImpl(to, isAbsolute = false) {
|
|
501
|
+
let base = "http://localhost";
|
|
502
|
+
if (typeof window !== "undefined") {
|
|
503
|
+
base = window.location.origin !== "null" ? window.location.origin : window.location.href;
|
|
504
|
+
}
|
|
505
|
+
invariant(base, "No window.location.(origin|href) available to create URL");
|
|
506
|
+
let href2 = typeof to === "string" ? to : createPath(to);
|
|
507
|
+
href2 = href2.replace(/ $/, "%20");
|
|
508
|
+
if (!isAbsolute && href2.startsWith("//")) {
|
|
509
|
+
href2 = base + href2;
|
|
510
|
+
}
|
|
511
|
+
return new URL(href2, base);
|
|
512
|
+
}
|
|
507
513
|
|
|
508
514
|
// lib/router/utils.ts
|
|
509
515
|
function unstable_createContext(defaultValue) {
|
|
@@ -800,19 +806,19 @@ function generatePath(originalPath, params = {}) {
|
|
|
800
806
|
path = path.replace(/\*$/, "/*");
|
|
801
807
|
}
|
|
802
808
|
const prefix = path.startsWith("/") ? "/" : "";
|
|
803
|
-
const
|
|
809
|
+
const stringify2 = (p) => p == null ? "" : typeof p === "string" ? p : String(p);
|
|
804
810
|
const segments = path.split(/\/+/).map((segment, index, array) => {
|
|
805
811
|
const isLastSegment = index === array.length - 1;
|
|
806
812
|
if (isLastSegment && segment === "*") {
|
|
807
813
|
const star = "*";
|
|
808
|
-
return
|
|
814
|
+
return stringify2(params[star]);
|
|
809
815
|
}
|
|
810
816
|
const keyMatch = segment.match(/^:([\w-]+)(\??)$/);
|
|
811
817
|
if (keyMatch) {
|
|
812
818
|
const [, key, optional] = keyMatch;
|
|
813
819
|
let param = params[key];
|
|
814
820
|
invariant(optional === "?" || param != null, `Missing ":${key}" param`);
|
|
815
|
-
return
|
|
821
|
+
return stringify2(param);
|
|
816
822
|
}
|
|
817
823
|
return segment.replace(/\?$/g, "");
|
|
818
824
|
}).filter((segment) => !!segment);
|
|
@@ -1124,53 +1130,57 @@ function createRouter(init) {
|
|
|
1124
1130
|
let initialMatches = matchRoutes(dataRoutes, init.history.location, basename);
|
|
1125
1131
|
let initialMatchesIsFOW = false;
|
|
1126
1132
|
let initialErrors = null;
|
|
1133
|
+
let initialized;
|
|
1127
1134
|
if (initialMatches == null && !init.patchRoutesOnNavigation) {
|
|
1128
1135
|
let error = getInternalRouterError(404, {
|
|
1129
1136
|
pathname: init.history.location.pathname
|
|
1130
1137
|
});
|
|
1131
1138
|
let { matches, route } = getShortCircuitMatches(dataRoutes);
|
|
1139
|
+
initialized = true;
|
|
1132
1140
|
initialMatches = matches;
|
|
1133
1141
|
initialErrors = { [route.id]: error };
|
|
1134
|
-
}
|
|
1135
|
-
if (initialMatches && !init.hydrationData) {
|
|
1136
|
-
let fogOfWar = checkFogOfWar(
|
|
1137
|
-
initialMatches,
|
|
1138
|
-
dataRoutes,
|
|
1139
|
-
init.history.location.pathname
|
|
1140
|
-
);
|
|
1141
|
-
if (fogOfWar.active) {
|
|
1142
|
-
initialMatches = null;
|
|
1143
|
-
}
|
|
1144
|
-
}
|
|
1145
|
-
let initialized;
|
|
1146
|
-
if (!initialMatches) {
|
|
1147
|
-
initialized = false;
|
|
1148
|
-
initialMatches = [];
|
|
1149
|
-
let fogOfWar = checkFogOfWar(
|
|
1150
|
-
null,
|
|
1151
|
-
dataRoutes,
|
|
1152
|
-
init.history.location.pathname
|
|
1153
|
-
);
|
|
1154
|
-
if (fogOfWar.active && fogOfWar.matches) {
|
|
1155
|
-
initialMatchesIsFOW = true;
|
|
1156
|
-
initialMatches = fogOfWar.matches;
|
|
1157
|
-
}
|
|
1158
|
-
} else if (initialMatches.some((m) => m.route.lazy)) {
|
|
1159
|
-
initialized = false;
|
|
1160
|
-
} else if (!initialMatches.some((m) => m.route.loader)) {
|
|
1161
|
-
initialized = true;
|
|
1162
1142
|
} else {
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1143
|
+
if (initialMatches && !init.hydrationData) {
|
|
1144
|
+
let fogOfWar = checkFogOfWar(
|
|
1145
|
+
initialMatches,
|
|
1146
|
+
dataRoutes,
|
|
1147
|
+
init.history.location.pathname
|
|
1168
1148
|
);
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1149
|
+
if (fogOfWar.active) {
|
|
1150
|
+
initialMatches = null;
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
if (!initialMatches) {
|
|
1154
|
+
initialized = false;
|
|
1155
|
+
initialMatches = [];
|
|
1156
|
+
let fogOfWar = checkFogOfWar(
|
|
1157
|
+
null,
|
|
1158
|
+
dataRoutes,
|
|
1159
|
+
init.history.location.pathname
|
|
1173
1160
|
);
|
|
1161
|
+
if (fogOfWar.active && fogOfWar.matches) {
|
|
1162
|
+
initialMatchesIsFOW = true;
|
|
1163
|
+
initialMatches = fogOfWar.matches;
|
|
1164
|
+
}
|
|
1165
|
+
} else if (initialMatches.some((m) => m.route.lazy)) {
|
|
1166
|
+
initialized = false;
|
|
1167
|
+
} else if (!initialMatches.some((m) => m.route.loader)) {
|
|
1168
|
+
initialized = true;
|
|
1169
|
+
} else {
|
|
1170
|
+
let loaderData = init.hydrationData ? init.hydrationData.loaderData : null;
|
|
1171
|
+
let errors = init.hydrationData ? init.hydrationData.errors : null;
|
|
1172
|
+
if (errors) {
|
|
1173
|
+
let idx = initialMatches.findIndex(
|
|
1174
|
+
(m) => errors[m.route.id] !== void 0
|
|
1175
|
+
);
|
|
1176
|
+
initialized = initialMatches.slice(0, idx + 1).every(
|
|
1177
|
+
(m) => !shouldLoadRouteOnHydration(m.route, loaderData, errors)
|
|
1178
|
+
);
|
|
1179
|
+
} else {
|
|
1180
|
+
initialized = initialMatches.every(
|
|
1181
|
+
(m) => !shouldLoadRouteOnHydration(m.route, loaderData, errors)
|
|
1182
|
+
);
|
|
1183
|
+
}
|
|
1174
1184
|
}
|
|
1175
1185
|
}
|
|
1176
1186
|
let router;
|
|
@@ -2186,6 +2196,10 @@ function createRouter(init) {
|
|
|
2186
2196
|
fetchReloadIds.delete(key);
|
|
2187
2197
|
fetchControllers.delete(key);
|
|
2188
2198
|
revalidatingFetchers.forEach((r) => fetchControllers.delete(r.key));
|
|
2199
|
+
if (state.fetchers.has(key)) {
|
|
2200
|
+
let doneFetcher = getDoneFetcher(actionResult.data);
|
|
2201
|
+
state.fetchers.set(key, doneFetcher);
|
|
2202
|
+
}
|
|
2189
2203
|
let redirect2 = findRedirect(loaderResults);
|
|
2190
2204
|
if (redirect2) {
|
|
2191
2205
|
return startRedirectNavigation(
|
|
@@ -2213,10 +2227,6 @@ function createRouter(init) {
|
|
|
2213
2227
|
revalidatingFetchers,
|
|
2214
2228
|
fetcherResults
|
|
2215
2229
|
);
|
|
2216
|
-
if (state.fetchers.has(key)) {
|
|
2217
|
-
let doneFetcher = getDoneFetcher(actionResult.data);
|
|
2218
|
-
state.fetchers.set(key, doneFetcher);
|
|
2219
|
-
}
|
|
2220
2230
|
abortStaleFetchLoads(loadId);
|
|
2221
2231
|
if (state.navigation.state === "loading" && loadId > pendingNavigationLoadId) {
|
|
2222
2232
|
invariant(pendingAction, "Expected pending action");
|
|
@@ -2352,7 +2362,7 @@ function createRouter(init) {
|
|
|
2352
2362
|
if (redirect2.response.headers.has("X-Remix-Reload-Document")) {
|
|
2353
2363
|
isDocumentReload = true;
|
|
2354
2364
|
} else if (ABSOLUTE_URL_REGEX.test(location)) {
|
|
2355
|
-
const url =
|
|
2365
|
+
const url = createBrowserURLImpl(location, true);
|
|
2356
2366
|
isDocumentReload = // Hard reload if it's an absolute URL to a new origin
|
|
2357
2367
|
url.origin !== routerWindow.location.origin || // Hard reload if it's an absolute URL that does not match our basename
|
|
2358
2368
|
stripBasename(url.pathname, basename) == null;
|
|
@@ -2419,6 +2429,9 @@ function createRouter(init) {
|
|
|
2419
2429
|
});
|
|
2420
2430
|
return dataResults;
|
|
2421
2431
|
}
|
|
2432
|
+
if (request.signal.aborted) {
|
|
2433
|
+
return dataResults;
|
|
2434
|
+
}
|
|
2422
2435
|
for (let [routeId, result] of Object.entries(results)) {
|
|
2423
2436
|
if (isRedirectDataStrategyResult(result)) {
|
|
2424
2437
|
let response = result.result;
|
|
@@ -2933,12 +2946,16 @@ function createStaticHandler(routes, opts) {
|
|
|
2933
2946
|
dataRoutes,
|
|
2934
2947
|
renderedStaticContext,
|
|
2935
2948
|
error,
|
|
2936
|
-
findNearestBoundary(matches, routeId).route.id
|
|
2949
|
+
skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id
|
|
2937
2950
|
)
|
|
2938
2951
|
);
|
|
2939
2952
|
} else {
|
|
2940
|
-
let
|
|
2941
|
-
|
|
2953
|
+
let boundaryRouteId = skipLoaderErrorBubbling ? routeId : findNearestBoundary(
|
|
2954
|
+
matches,
|
|
2955
|
+
matches.find(
|
|
2956
|
+
(m) => m.route.id === routeId || m.route.loader
|
|
2957
|
+
)?.route.id || routeId
|
|
2958
|
+
).route.id;
|
|
2942
2959
|
return respond({
|
|
2943
2960
|
matches,
|
|
2944
2961
|
location,
|
|
@@ -2946,7 +2963,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2946
2963
|
loaderData: {},
|
|
2947
2964
|
actionData: null,
|
|
2948
2965
|
errors: {
|
|
2949
|
-
[
|
|
2966
|
+
[boundaryRouteId]: error
|
|
2950
2967
|
},
|
|
2951
2968
|
statusCode: isRouteErrorResponse(error) ? error.status : 500,
|
|
2952
2969
|
actionHeaders: {},
|
|
@@ -3725,7 +3742,7 @@ function shouldLoadRouteOnHydration(route, loaderData, errors) {
|
|
|
3725
3742
|
if (!route.loader) {
|
|
3726
3743
|
return false;
|
|
3727
3744
|
}
|
|
3728
|
-
let hasData = loaderData != null &&
|
|
3745
|
+
let hasData = loaderData != null && route.id in loaderData;
|
|
3729
3746
|
let hasError = errors != null && errors[route.id] !== void 0;
|
|
3730
3747
|
if (!hasData && hasError) {
|
|
3731
3748
|
return false;
|
|
@@ -4934,10 +4951,10 @@ var RouteContext = React.createContext({
|
|
|
4934
4951
|
RouteContext.displayName = "Route";
|
|
4935
4952
|
var RouteErrorContext = React.createContext(null);
|
|
4936
4953
|
RouteErrorContext.displayName = "RouteError";
|
|
4954
|
+
var ENABLE_DEV_WARNINGS = false;
|
|
4937
4955
|
|
|
4938
4956
|
// lib/hooks.tsx
|
|
4939
4957
|
var React2 = __toESM(require("react"));
|
|
4940
|
-
var ENABLE_DEV_WARNINGS = false;
|
|
4941
4958
|
function useHref(to, { relative } = {}) {
|
|
4942
4959
|
invariant(
|
|
4943
4960
|
useInRouterContext(),
|
|
@@ -4945,13 +4962,13 @@ function useHref(to, { relative } = {}) {
|
|
|
4945
4962
|
// router loaded. We can help them understand how to avoid that.
|
|
4946
4963
|
`useHref() may be used only in the context of a <Router> component.`
|
|
4947
4964
|
);
|
|
4948
|
-
let { basename, navigator
|
|
4965
|
+
let { basename, navigator } = React2.useContext(NavigationContext);
|
|
4949
4966
|
let { hash, pathname, search } = useResolvedPath(to, { relative });
|
|
4950
4967
|
let joinedPathname = pathname;
|
|
4951
4968
|
if (basename !== "/") {
|
|
4952
4969
|
joinedPathname = pathname === "/" ? basename : joinPaths([basename, pathname]);
|
|
4953
4970
|
}
|
|
4954
|
-
return
|
|
4971
|
+
return navigator.createHref({ pathname: joinedPathname, search, hash });
|
|
4955
4972
|
}
|
|
4956
4973
|
function useInRouterContext() {
|
|
4957
4974
|
return React2.useContext(LocationContext) != null;
|
|
@@ -5000,7 +5017,7 @@ function useNavigateUnstable() {
|
|
|
5000
5017
|
`useNavigate() may be used only in the context of a <Router> component.`
|
|
5001
5018
|
);
|
|
5002
5019
|
let dataRouterContext = React2.useContext(DataRouterContext);
|
|
5003
|
-
let { basename, navigator
|
|
5020
|
+
let { basename, navigator } = React2.useContext(NavigationContext);
|
|
5004
5021
|
let { matches } = React2.useContext(RouteContext);
|
|
5005
5022
|
let { pathname: locationPathname } = useLocation();
|
|
5006
5023
|
let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
|
|
@@ -5013,7 +5030,7 @@ function useNavigateUnstable() {
|
|
|
5013
5030
|
warning(activeRef.current, navigateEffectWarning);
|
|
5014
5031
|
if (!activeRef.current) return;
|
|
5015
5032
|
if (typeof to === "number") {
|
|
5016
|
-
|
|
5033
|
+
navigator.go(to);
|
|
5017
5034
|
return;
|
|
5018
5035
|
}
|
|
5019
5036
|
let path = resolveTo(
|
|
@@ -5025,7 +5042,7 @@ function useNavigateUnstable() {
|
|
|
5025
5042
|
if (dataRouterContext == null && basename !== "/") {
|
|
5026
5043
|
path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
|
|
5027
5044
|
}
|
|
5028
|
-
(!!options.replace ?
|
|
5045
|
+
(!!options.replace ? navigator.replace : navigator.push)(
|
|
5029
5046
|
path,
|
|
5030
5047
|
options.state,
|
|
5031
5048
|
options
|
|
@@ -5033,7 +5050,7 @@ function useNavigateUnstable() {
|
|
|
5033
5050
|
},
|
|
5034
5051
|
[
|
|
5035
5052
|
basename,
|
|
5036
|
-
|
|
5053
|
+
navigator,
|
|
5037
5054
|
routePathnamesJson,
|
|
5038
5055
|
locationPathname,
|
|
5039
5056
|
dataRouterContext
|
|
@@ -5081,7 +5098,7 @@ function useRoutesImpl(routes, locationArg, dataRouterState, future) {
|
|
|
5081
5098
|
// router loaded. We can help them understand how to avoid that.
|
|
5082
5099
|
`useRoutes() may be used only in the context of a <Router> component.`
|
|
5083
5100
|
);
|
|
5084
|
-
let { navigator
|
|
5101
|
+
let { navigator, static: isStatic } = React2.useContext(NavigationContext);
|
|
5085
5102
|
let { matches: parentMatches } = React2.useContext(RouteContext);
|
|
5086
5103
|
let routeMatch = parentMatches[parentMatches.length - 1];
|
|
5087
5104
|
let parentParams = routeMatch ? routeMatch.params : {};
|
|
@@ -5135,12 +5152,12 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
5135
5152
|
pathname: joinPaths([
|
|
5136
5153
|
parentPathnameBase,
|
|
5137
5154
|
// Re-encode pathnames that were decoded inside matchRoutes
|
|
5138
|
-
|
|
5155
|
+
navigator.encodeLocation ? navigator.encodeLocation(match.pathname).pathname : match.pathname
|
|
5139
5156
|
]),
|
|
5140
5157
|
pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : joinPaths([
|
|
5141
5158
|
parentPathnameBase,
|
|
5142
5159
|
// Re-encode pathnames that were decoded inside matchRoutes
|
|
5143
|
-
|
|
5160
|
+
navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase).pathname : match.pathnameBase
|
|
5144
5161
|
])
|
|
5145
5162
|
})
|
|
5146
5163
|
),
|
|
@@ -5390,14 +5407,12 @@ function useNavigation() {
|
|
|
5390
5407
|
function useRevalidator() {
|
|
5391
5408
|
let dataRouterContext = useDataRouterContext("useRevalidator" /* UseRevalidator */);
|
|
5392
5409
|
let state = useDataRouterState("useRevalidator" /* UseRevalidator */);
|
|
5410
|
+
let revalidate = React2.useCallback(async () => {
|
|
5411
|
+
await dataRouterContext.router.revalidate();
|
|
5412
|
+
}, [dataRouterContext.router]);
|
|
5393
5413
|
return React2.useMemo(
|
|
5394
|
-
() => ({
|
|
5395
|
-
|
|
5396
|
-
await dataRouterContext.router.revalidate();
|
|
5397
|
-
},
|
|
5398
|
-
state: state.revalidation
|
|
5399
|
-
}),
|
|
5400
|
-
[dataRouterContext.router, state.revalidation]
|
|
5414
|
+
() => ({ revalidate, state: state.revalidation }),
|
|
5415
|
+
[revalidate, state.revalidation]
|
|
5401
5416
|
);
|
|
5402
5417
|
}
|
|
5403
5418
|
function useMatches() {
|
|
@@ -5519,7 +5534,6 @@ function warnOnce(condition, message) {
|
|
|
5519
5534
|
}
|
|
5520
5535
|
|
|
5521
5536
|
// lib/components.tsx
|
|
5522
|
-
var ENABLE_DEV_WARNINGS2 = false;
|
|
5523
5537
|
function mapRouteProperties(route) {
|
|
5524
5538
|
let updates = {
|
|
5525
5539
|
// Note: this check also occurs in createRoutesFromChildren so update
|
|
@@ -5527,7 +5541,7 @@ function mapRouteProperties(route) {
|
|
|
5527
5541
|
hasErrorBoundary: route.hasErrorBoundary || route.ErrorBoundary != null || route.errorElement != null
|
|
5528
5542
|
};
|
|
5529
5543
|
if (route.Component) {
|
|
5530
|
-
if (
|
|
5544
|
+
if (ENABLE_DEV_WARNINGS) {
|
|
5531
5545
|
if (route.element) {
|
|
5532
5546
|
warning(
|
|
5533
5547
|
false,
|
|
@@ -5541,7 +5555,7 @@ function mapRouteProperties(route) {
|
|
|
5541
5555
|
});
|
|
5542
5556
|
}
|
|
5543
5557
|
if (route.HydrateFallback) {
|
|
5544
|
-
if (
|
|
5558
|
+
if (ENABLE_DEV_WARNINGS) {
|
|
5545
5559
|
if (route.hydrateFallbackElement) {
|
|
5546
5560
|
warning(
|
|
5547
5561
|
false,
|
|
@@ -5555,7 +5569,7 @@ function mapRouteProperties(route) {
|
|
|
5555
5569
|
});
|
|
5556
5570
|
}
|
|
5557
5571
|
if (route.ErrorBoundary) {
|
|
5558
|
-
if (
|
|
5572
|
+
if (ENABLE_DEV_WARNINGS) {
|
|
5559
5573
|
if (route.errorElement) {
|
|
5560
5574
|
warning(
|
|
5561
5575
|
false,
|
|
@@ -5735,7 +5749,7 @@ function RouterProvider({
|
|
|
5735
5749
|
setInterruption(void 0);
|
|
5736
5750
|
}
|
|
5737
5751
|
}, [vtContext.isTransitioning, interruption]);
|
|
5738
|
-
let
|
|
5752
|
+
let navigator = React3.useMemo(() => {
|
|
5739
5753
|
return {
|
|
5740
5754
|
createHref: router.createHref,
|
|
5741
5755
|
encodeLocation: router.encodeLocation,
|
|
@@ -5755,11 +5769,11 @@ function RouterProvider({
|
|
|
5755
5769
|
let dataRouterContext = React3.useMemo(
|
|
5756
5770
|
() => ({
|
|
5757
5771
|
router,
|
|
5758
|
-
navigator
|
|
5772
|
+
navigator,
|
|
5759
5773
|
static: false,
|
|
5760
5774
|
basename
|
|
5761
5775
|
}),
|
|
5762
|
-
[router,
|
|
5776
|
+
[router, navigator, basename]
|
|
5763
5777
|
);
|
|
5764
5778
|
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React3.createElement(DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React3.createElement(FetchersContext.Provider, { value: fetcherData.current }, /* @__PURE__ */ React3.createElement(ViewTransitionContext.Provider, { value: vtContext }, /* @__PURE__ */ React3.createElement(
|
|
5765
5779
|
Router,
|
|
@@ -5767,7 +5781,7 @@ function RouterProvider({
|
|
|
5767
5781
|
basename,
|
|
5768
5782
|
location: state.location,
|
|
5769
5783
|
navigationType: state.historyAction,
|
|
5770
|
-
navigator
|
|
5784
|
+
navigator
|
|
5771
5785
|
},
|
|
5772
5786
|
/* @__PURE__ */ React3.createElement(
|
|
5773
5787
|
MemoizedDataRoutes,
|
|
@@ -5870,7 +5884,7 @@ function Router({
|
|
|
5870
5884
|
children = null,
|
|
5871
5885
|
location: locationProp,
|
|
5872
5886
|
navigationType = "POP" /* Pop */,
|
|
5873
|
-
navigator
|
|
5887
|
+
navigator,
|
|
5874
5888
|
static: staticProp = false
|
|
5875
5889
|
}) {
|
|
5876
5890
|
invariant(
|
|
@@ -5881,11 +5895,11 @@ function Router({
|
|
|
5881
5895
|
let navigationContext = React3.useMemo(
|
|
5882
5896
|
() => ({
|
|
5883
5897
|
basename,
|
|
5884
|
-
navigator
|
|
5898
|
+
navigator,
|
|
5885
5899
|
static: staticProp,
|
|
5886
5900
|
future: {}
|
|
5887
5901
|
}),
|
|
5888
|
-
[basename,
|
|
5902
|
+
[basename, navigator, staticProp]
|
|
5889
5903
|
);
|
|
5890
5904
|
if (typeof locationProp === "string") {
|
|
5891
5905
|
locationProp = parsePath(locationProp);
|
|
@@ -6443,7 +6457,669 @@ function createHtml(html) {
|
|
|
6443
6457
|
|
|
6444
6458
|
// lib/dom/ssr/single-fetch.tsx
|
|
6445
6459
|
var React4 = __toESM(require("react"));
|
|
6446
|
-
|
|
6460
|
+
|
|
6461
|
+
// vendor/turbo-stream-v2/utils.ts
|
|
6462
|
+
var HOLE = -1;
|
|
6463
|
+
var NAN = -2;
|
|
6464
|
+
var NEGATIVE_INFINITY = -3;
|
|
6465
|
+
var NEGATIVE_ZERO = -4;
|
|
6466
|
+
var NULL = -5;
|
|
6467
|
+
var POSITIVE_INFINITY = -6;
|
|
6468
|
+
var UNDEFINED = -7;
|
|
6469
|
+
var TYPE_BIGINT = "B";
|
|
6470
|
+
var TYPE_DATE = "D";
|
|
6471
|
+
var TYPE_ERROR = "E";
|
|
6472
|
+
var TYPE_MAP = "M";
|
|
6473
|
+
var TYPE_NULL_OBJECT = "N";
|
|
6474
|
+
var TYPE_PROMISE = "P";
|
|
6475
|
+
var TYPE_REGEXP = "R";
|
|
6476
|
+
var TYPE_SET = "S";
|
|
6477
|
+
var TYPE_SYMBOL = "Y";
|
|
6478
|
+
var TYPE_URL = "U";
|
|
6479
|
+
var TYPE_PREVIOUS_RESOLVED = "Z";
|
|
6480
|
+
var Deferred2 = class {
|
|
6481
|
+
constructor() {
|
|
6482
|
+
this.promise = new Promise((resolve, reject) => {
|
|
6483
|
+
this.resolve = resolve;
|
|
6484
|
+
this.reject = reject;
|
|
6485
|
+
});
|
|
6486
|
+
}
|
|
6487
|
+
};
|
|
6488
|
+
function createLineSplittingTransform() {
|
|
6489
|
+
const decoder = new TextDecoder();
|
|
6490
|
+
let leftover = "";
|
|
6491
|
+
return new TransformStream({
|
|
6492
|
+
transform(chunk, controller) {
|
|
6493
|
+
const str = decoder.decode(chunk, { stream: true });
|
|
6494
|
+
const parts = (leftover + str).split("\n");
|
|
6495
|
+
leftover = parts.pop() || "";
|
|
6496
|
+
for (const part of parts) {
|
|
6497
|
+
controller.enqueue(part);
|
|
6498
|
+
}
|
|
6499
|
+
},
|
|
6500
|
+
flush(controller) {
|
|
6501
|
+
if (leftover) {
|
|
6502
|
+
controller.enqueue(leftover);
|
|
6503
|
+
}
|
|
6504
|
+
}
|
|
6505
|
+
});
|
|
6506
|
+
}
|
|
6507
|
+
|
|
6508
|
+
// vendor/turbo-stream-v2/flatten.ts
|
|
6509
|
+
function flatten(input) {
|
|
6510
|
+
const { indices } = this;
|
|
6511
|
+
const existing = indices.get(input);
|
|
6512
|
+
if (existing) return [existing];
|
|
6513
|
+
if (input === void 0) return UNDEFINED;
|
|
6514
|
+
if (input === null) return NULL;
|
|
6515
|
+
if (Number.isNaN(input)) return NAN;
|
|
6516
|
+
if (input === Number.POSITIVE_INFINITY) return POSITIVE_INFINITY;
|
|
6517
|
+
if (input === Number.NEGATIVE_INFINITY) return NEGATIVE_INFINITY;
|
|
6518
|
+
if (input === 0 && 1 / input < 0) return NEGATIVE_ZERO;
|
|
6519
|
+
const index = this.index++;
|
|
6520
|
+
indices.set(input, index);
|
|
6521
|
+
stringify.call(this, input, index);
|
|
6522
|
+
return index;
|
|
6523
|
+
}
|
|
6524
|
+
function stringify(input, index) {
|
|
6525
|
+
const { deferred, plugins, postPlugins } = this;
|
|
6526
|
+
const str = this.stringified;
|
|
6527
|
+
const stack = [[input, index]];
|
|
6528
|
+
while (stack.length > 0) {
|
|
6529
|
+
const [input2, index2] = stack.pop();
|
|
6530
|
+
const partsForObj = (obj) => Object.keys(obj).map((k) => `"_${flatten.call(this, k)}":${flatten.call(this, obj[k])}`).join(",");
|
|
6531
|
+
let error = null;
|
|
6532
|
+
switch (typeof input2) {
|
|
6533
|
+
case "boolean":
|
|
6534
|
+
case "number":
|
|
6535
|
+
case "string":
|
|
6536
|
+
str[index2] = JSON.stringify(input2);
|
|
6537
|
+
break;
|
|
6538
|
+
case "bigint":
|
|
6539
|
+
str[index2] = `["${TYPE_BIGINT}","${input2}"]`;
|
|
6540
|
+
break;
|
|
6541
|
+
case "symbol": {
|
|
6542
|
+
const keyFor = Symbol.keyFor(input2);
|
|
6543
|
+
if (!keyFor) {
|
|
6544
|
+
error = new Error(
|
|
6545
|
+
"Cannot encode symbol unless created with Symbol.for()"
|
|
6546
|
+
);
|
|
6547
|
+
} else {
|
|
6548
|
+
str[index2] = `["${TYPE_SYMBOL}",${JSON.stringify(keyFor)}]`;
|
|
6549
|
+
}
|
|
6550
|
+
break;
|
|
6551
|
+
}
|
|
6552
|
+
case "object": {
|
|
6553
|
+
if (!input2) {
|
|
6554
|
+
str[index2] = `${NULL}`;
|
|
6555
|
+
break;
|
|
6556
|
+
}
|
|
6557
|
+
const isArray = Array.isArray(input2);
|
|
6558
|
+
let pluginHandled = false;
|
|
6559
|
+
if (!isArray && plugins) {
|
|
6560
|
+
for (const plugin of plugins) {
|
|
6561
|
+
const pluginResult = plugin(input2);
|
|
6562
|
+
if (Array.isArray(pluginResult)) {
|
|
6563
|
+
pluginHandled = true;
|
|
6564
|
+
const [pluginIdentifier, ...rest] = pluginResult;
|
|
6565
|
+
str[index2] = `[${JSON.stringify(pluginIdentifier)}`;
|
|
6566
|
+
if (rest.length > 0) {
|
|
6567
|
+
str[index2] += `,${rest.map((v) => flatten.call(this, v)).join(",")}`;
|
|
6568
|
+
}
|
|
6569
|
+
str[index2] += "]";
|
|
6570
|
+
break;
|
|
6571
|
+
}
|
|
6572
|
+
}
|
|
6573
|
+
}
|
|
6574
|
+
if (!pluginHandled) {
|
|
6575
|
+
let result = isArray ? "[" : "{";
|
|
6576
|
+
if (isArray) {
|
|
6577
|
+
for (let i = 0; i < input2.length; i++)
|
|
6578
|
+
result += (i ? "," : "") + (i in input2 ? flatten.call(this, input2[i]) : HOLE);
|
|
6579
|
+
str[index2] = `${result}]`;
|
|
6580
|
+
} else if (input2 instanceof Date) {
|
|
6581
|
+
str[index2] = `["${TYPE_DATE}",${input2.getTime()}]`;
|
|
6582
|
+
} else if (input2 instanceof URL) {
|
|
6583
|
+
str[index2] = `["${TYPE_URL}",${JSON.stringify(input2.href)}]`;
|
|
6584
|
+
} else if (input2 instanceof RegExp) {
|
|
6585
|
+
str[index2] = `["${TYPE_REGEXP}",${JSON.stringify(
|
|
6586
|
+
input2.source
|
|
6587
|
+
)},${JSON.stringify(input2.flags)}]`;
|
|
6588
|
+
} else if (input2 instanceof Set) {
|
|
6589
|
+
if (input2.size > 0) {
|
|
6590
|
+
str[index2] = `["${TYPE_SET}",${[...input2].map((val) => flatten.call(this, val)).join(",")}]`;
|
|
6591
|
+
} else {
|
|
6592
|
+
str[index2] = `["${TYPE_SET}"]`;
|
|
6593
|
+
}
|
|
6594
|
+
} else if (input2 instanceof Map) {
|
|
6595
|
+
if (input2.size > 0) {
|
|
6596
|
+
str[index2] = `["${TYPE_MAP}",${[...input2].flatMap(([k, v]) => [
|
|
6597
|
+
flatten.call(this, k),
|
|
6598
|
+
flatten.call(this, v)
|
|
6599
|
+
]).join(",")}]`;
|
|
6600
|
+
} else {
|
|
6601
|
+
str[index2] = `["${TYPE_MAP}"]`;
|
|
6602
|
+
}
|
|
6603
|
+
} else if (input2 instanceof Promise) {
|
|
6604
|
+
str[index2] = `["${TYPE_PROMISE}",${index2}]`;
|
|
6605
|
+
deferred[index2] = input2;
|
|
6606
|
+
} else if (input2 instanceof Error) {
|
|
6607
|
+
str[index2] = `["${TYPE_ERROR}",${JSON.stringify(input2.message)}`;
|
|
6608
|
+
if (input2.name !== "Error") {
|
|
6609
|
+
str[index2] += `,${JSON.stringify(input2.name)}`;
|
|
6610
|
+
}
|
|
6611
|
+
str[index2] += "]";
|
|
6612
|
+
} else if (Object.getPrototypeOf(input2) === null) {
|
|
6613
|
+
str[index2] = `["${TYPE_NULL_OBJECT}",{${partsForObj(input2)}}]`;
|
|
6614
|
+
} else if (isPlainObject(input2)) {
|
|
6615
|
+
str[index2] = `{${partsForObj(input2)}}`;
|
|
6616
|
+
} else {
|
|
6617
|
+
error = new Error("Cannot encode object with prototype");
|
|
6618
|
+
}
|
|
6619
|
+
}
|
|
6620
|
+
break;
|
|
6621
|
+
}
|
|
6622
|
+
default: {
|
|
6623
|
+
const isArray = Array.isArray(input2);
|
|
6624
|
+
let pluginHandled = false;
|
|
6625
|
+
if (!isArray && plugins) {
|
|
6626
|
+
for (const plugin of plugins) {
|
|
6627
|
+
const pluginResult = plugin(input2);
|
|
6628
|
+
if (Array.isArray(pluginResult)) {
|
|
6629
|
+
pluginHandled = true;
|
|
6630
|
+
const [pluginIdentifier, ...rest] = pluginResult;
|
|
6631
|
+
str[index2] = `[${JSON.stringify(pluginIdentifier)}`;
|
|
6632
|
+
if (rest.length > 0) {
|
|
6633
|
+
str[index2] += `,${rest.map((v) => flatten.call(this, v)).join(",")}`;
|
|
6634
|
+
}
|
|
6635
|
+
str[index2] += "]";
|
|
6636
|
+
break;
|
|
6637
|
+
}
|
|
6638
|
+
}
|
|
6639
|
+
}
|
|
6640
|
+
if (!pluginHandled) {
|
|
6641
|
+
error = new Error("Cannot encode function or unexpected type");
|
|
6642
|
+
}
|
|
6643
|
+
}
|
|
6644
|
+
}
|
|
6645
|
+
if (error) {
|
|
6646
|
+
let pluginHandled = false;
|
|
6647
|
+
if (postPlugins) {
|
|
6648
|
+
for (const plugin of postPlugins) {
|
|
6649
|
+
const pluginResult = plugin(input2);
|
|
6650
|
+
if (Array.isArray(pluginResult)) {
|
|
6651
|
+
pluginHandled = true;
|
|
6652
|
+
const [pluginIdentifier, ...rest] = pluginResult;
|
|
6653
|
+
str[index2] = `[${JSON.stringify(pluginIdentifier)}`;
|
|
6654
|
+
if (rest.length > 0) {
|
|
6655
|
+
str[index2] += `,${rest.map((v) => flatten.call(this, v)).join(",")}`;
|
|
6656
|
+
}
|
|
6657
|
+
str[index2] += "]";
|
|
6658
|
+
break;
|
|
6659
|
+
}
|
|
6660
|
+
}
|
|
6661
|
+
}
|
|
6662
|
+
if (!pluginHandled) {
|
|
6663
|
+
throw error;
|
|
6664
|
+
}
|
|
6665
|
+
}
|
|
6666
|
+
}
|
|
6667
|
+
}
|
|
6668
|
+
var objectProtoNames = Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
|
|
6669
|
+
function isPlainObject(thing) {
|
|
6670
|
+
const proto = Object.getPrototypeOf(thing);
|
|
6671
|
+
return proto === Object.prototype || proto === null || Object.getOwnPropertyNames(proto).sort().join("\0") === objectProtoNames;
|
|
6672
|
+
}
|
|
6673
|
+
|
|
6674
|
+
// vendor/turbo-stream-v2/unflatten.ts
|
|
6675
|
+
var globalObj = typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : void 0;
|
|
6676
|
+
function unflatten(parsed) {
|
|
6677
|
+
const { hydrated, values } = this;
|
|
6678
|
+
if (typeof parsed === "number") return hydrate.call(this, parsed);
|
|
6679
|
+
if (!Array.isArray(parsed) || !parsed.length) throw new SyntaxError();
|
|
6680
|
+
const startIndex = values.length;
|
|
6681
|
+
for (const value of parsed) {
|
|
6682
|
+
values.push(value);
|
|
6683
|
+
}
|
|
6684
|
+
hydrated.length = values.length;
|
|
6685
|
+
return hydrate.call(this, startIndex);
|
|
6686
|
+
}
|
|
6687
|
+
function hydrate(index) {
|
|
6688
|
+
const { hydrated, values, deferred, plugins } = this;
|
|
6689
|
+
let result;
|
|
6690
|
+
const stack = [
|
|
6691
|
+
[
|
|
6692
|
+
index,
|
|
6693
|
+
(v) => {
|
|
6694
|
+
result = v;
|
|
6695
|
+
}
|
|
6696
|
+
]
|
|
6697
|
+
];
|
|
6698
|
+
let postRun = [];
|
|
6699
|
+
while (stack.length > 0) {
|
|
6700
|
+
const [index2, set] = stack.pop();
|
|
6701
|
+
switch (index2) {
|
|
6702
|
+
case UNDEFINED:
|
|
6703
|
+
set(void 0);
|
|
6704
|
+
continue;
|
|
6705
|
+
case NULL:
|
|
6706
|
+
set(null);
|
|
6707
|
+
continue;
|
|
6708
|
+
case NAN:
|
|
6709
|
+
set(NaN);
|
|
6710
|
+
continue;
|
|
6711
|
+
case POSITIVE_INFINITY:
|
|
6712
|
+
set(Infinity);
|
|
6713
|
+
continue;
|
|
6714
|
+
case NEGATIVE_INFINITY:
|
|
6715
|
+
set(-Infinity);
|
|
6716
|
+
continue;
|
|
6717
|
+
case NEGATIVE_ZERO:
|
|
6718
|
+
set(-0);
|
|
6719
|
+
continue;
|
|
6720
|
+
}
|
|
6721
|
+
if (hydrated[index2]) {
|
|
6722
|
+
set(hydrated[index2]);
|
|
6723
|
+
continue;
|
|
6724
|
+
}
|
|
6725
|
+
const value = values[index2];
|
|
6726
|
+
if (!value || typeof value !== "object") {
|
|
6727
|
+
hydrated[index2] = value;
|
|
6728
|
+
set(value);
|
|
6729
|
+
continue;
|
|
6730
|
+
}
|
|
6731
|
+
if (Array.isArray(value)) {
|
|
6732
|
+
if (typeof value[0] === "string") {
|
|
6733
|
+
const [type, b, c] = value;
|
|
6734
|
+
switch (type) {
|
|
6735
|
+
case TYPE_DATE:
|
|
6736
|
+
set(hydrated[index2] = new Date(b));
|
|
6737
|
+
continue;
|
|
6738
|
+
case TYPE_URL:
|
|
6739
|
+
set(hydrated[index2] = new URL(b));
|
|
6740
|
+
continue;
|
|
6741
|
+
case TYPE_BIGINT:
|
|
6742
|
+
set(hydrated[index2] = BigInt(b));
|
|
6743
|
+
continue;
|
|
6744
|
+
case TYPE_REGEXP:
|
|
6745
|
+
set(hydrated[index2] = new RegExp(b, c));
|
|
6746
|
+
continue;
|
|
6747
|
+
case TYPE_SYMBOL:
|
|
6748
|
+
set(hydrated[index2] = Symbol.for(b));
|
|
6749
|
+
continue;
|
|
6750
|
+
case TYPE_SET:
|
|
6751
|
+
const newSet = /* @__PURE__ */ new Set();
|
|
6752
|
+
hydrated[index2] = newSet;
|
|
6753
|
+
for (let i = value.length - 1; i > 0; i--)
|
|
6754
|
+
stack.push([
|
|
6755
|
+
value[i],
|
|
6756
|
+
(v) => {
|
|
6757
|
+
newSet.add(v);
|
|
6758
|
+
}
|
|
6759
|
+
]);
|
|
6760
|
+
set(newSet);
|
|
6761
|
+
continue;
|
|
6762
|
+
case TYPE_MAP:
|
|
6763
|
+
const map = /* @__PURE__ */ new Map();
|
|
6764
|
+
hydrated[index2] = map;
|
|
6765
|
+
for (let i = value.length - 2; i > 0; i -= 2) {
|
|
6766
|
+
const r = [];
|
|
6767
|
+
stack.push([
|
|
6768
|
+
value[i + 1],
|
|
6769
|
+
(v) => {
|
|
6770
|
+
r[1] = v;
|
|
6771
|
+
}
|
|
6772
|
+
]);
|
|
6773
|
+
stack.push([
|
|
6774
|
+
value[i],
|
|
6775
|
+
(k) => {
|
|
6776
|
+
r[0] = k;
|
|
6777
|
+
}
|
|
6778
|
+
]);
|
|
6779
|
+
postRun.push(() => {
|
|
6780
|
+
map.set(r[0], r[1]);
|
|
6781
|
+
});
|
|
6782
|
+
}
|
|
6783
|
+
set(map);
|
|
6784
|
+
continue;
|
|
6785
|
+
case TYPE_NULL_OBJECT:
|
|
6786
|
+
const obj = /* @__PURE__ */ Object.create(null);
|
|
6787
|
+
hydrated[index2] = obj;
|
|
6788
|
+
for (const key of Object.keys(b).reverse()) {
|
|
6789
|
+
const r = [];
|
|
6790
|
+
stack.push([
|
|
6791
|
+
b[key],
|
|
6792
|
+
(v) => {
|
|
6793
|
+
r[1] = v;
|
|
6794
|
+
}
|
|
6795
|
+
]);
|
|
6796
|
+
stack.push([
|
|
6797
|
+
Number(key.slice(1)),
|
|
6798
|
+
(k) => {
|
|
6799
|
+
r[0] = k;
|
|
6800
|
+
}
|
|
6801
|
+
]);
|
|
6802
|
+
postRun.push(() => {
|
|
6803
|
+
obj[r[0]] = r[1];
|
|
6804
|
+
});
|
|
6805
|
+
}
|
|
6806
|
+
set(obj);
|
|
6807
|
+
continue;
|
|
6808
|
+
case TYPE_PROMISE:
|
|
6809
|
+
if (hydrated[b]) {
|
|
6810
|
+
set(hydrated[index2] = hydrated[b]);
|
|
6811
|
+
} else {
|
|
6812
|
+
const d = new Deferred2();
|
|
6813
|
+
deferred[b] = d;
|
|
6814
|
+
set(hydrated[index2] = d.promise);
|
|
6815
|
+
}
|
|
6816
|
+
continue;
|
|
6817
|
+
case TYPE_ERROR:
|
|
6818
|
+
const [, message, errorType] = value;
|
|
6819
|
+
let error = errorType && globalObj && globalObj[errorType] ? new globalObj[errorType](message) : new Error(message);
|
|
6820
|
+
hydrated[index2] = error;
|
|
6821
|
+
set(error);
|
|
6822
|
+
continue;
|
|
6823
|
+
case TYPE_PREVIOUS_RESOLVED:
|
|
6824
|
+
set(hydrated[index2] = hydrated[b]);
|
|
6825
|
+
continue;
|
|
6826
|
+
default:
|
|
6827
|
+
if (Array.isArray(plugins)) {
|
|
6828
|
+
const r = [];
|
|
6829
|
+
const vals = value.slice(1);
|
|
6830
|
+
for (let i = 0; i < vals.length; i++) {
|
|
6831
|
+
const v = vals[i];
|
|
6832
|
+
stack.push([
|
|
6833
|
+
v,
|
|
6834
|
+
(v2) => {
|
|
6835
|
+
r[i] = v2;
|
|
6836
|
+
}
|
|
6837
|
+
]);
|
|
6838
|
+
}
|
|
6839
|
+
postRun.push(() => {
|
|
6840
|
+
for (const plugin of plugins) {
|
|
6841
|
+
const result2 = plugin(value[0], ...r);
|
|
6842
|
+
if (result2) {
|
|
6843
|
+
set(hydrated[index2] = result2.value);
|
|
6844
|
+
return;
|
|
6845
|
+
}
|
|
6846
|
+
}
|
|
6847
|
+
throw new SyntaxError();
|
|
6848
|
+
});
|
|
6849
|
+
continue;
|
|
6850
|
+
}
|
|
6851
|
+
throw new SyntaxError();
|
|
6852
|
+
}
|
|
6853
|
+
} else {
|
|
6854
|
+
const array = [];
|
|
6855
|
+
hydrated[index2] = array;
|
|
6856
|
+
for (let i = 0; i < value.length; i++) {
|
|
6857
|
+
const n = value[i];
|
|
6858
|
+
if (n !== HOLE) {
|
|
6859
|
+
stack.push([
|
|
6860
|
+
n,
|
|
6861
|
+
(v) => {
|
|
6862
|
+
array[i] = v;
|
|
6863
|
+
}
|
|
6864
|
+
]);
|
|
6865
|
+
}
|
|
6866
|
+
}
|
|
6867
|
+
set(array);
|
|
6868
|
+
continue;
|
|
6869
|
+
}
|
|
6870
|
+
} else {
|
|
6871
|
+
const object = {};
|
|
6872
|
+
hydrated[index2] = object;
|
|
6873
|
+
for (const key of Object.keys(value).reverse()) {
|
|
6874
|
+
const r = [];
|
|
6875
|
+
stack.push([
|
|
6876
|
+
value[key],
|
|
6877
|
+
(v) => {
|
|
6878
|
+
r[1] = v;
|
|
6879
|
+
}
|
|
6880
|
+
]);
|
|
6881
|
+
stack.push([
|
|
6882
|
+
Number(key.slice(1)),
|
|
6883
|
+
(k) => {
|
|
6884
|
+
r[0] = k;
|
|
6885
|
+
}
|
|
6886
|
+
]);
|
|
6887
|
+
postRun.push(() => {
|
|
6888
|
+
object[r[0]] = r[1];
|
|
6889
|
+
});
|
|
6890
|
+
}
|
|
6891
|
+
set(object);
|
|
6892
|
+
continue;
|
|
6893
|
+
}
|
|
6894
|
+
}
|
|
6895
|
+
while (postRun.length > 0) {
|
|
6896
|
+
postRun.pop()();
|
|
6897
|
+
}
|
|
6898
|
+
return result;
|
|
6899
|
+
}
|
|
6900
|
+
|
|
6901
|
+
// vendor/turbo-stream-v2/turbo-stream.ts
|
|
6902
|
+
async function decode(readable, options) {
|
|
6903
|
+
const { plugins } = options ?? {};
|
|
6904
|
+
const done = new Deferred2();
|
|
6905
|
+
const reader = readable.pipeThrough(createLineSplittingTransform()).getReader();
|
|
6906
|
+
const decoder = {
|
|
6907
|
+
values: [],
|
|
6908
|
+
hydrated: [],
|
|
6909
|
+
deferred: {},
|
|
6910
|
+
plugins
|
|
6911
|
+
};
|
|
6912
|
+
const decoded = await decodeInitial.call(decoder, reader);
|
|
6913
|
+
let donePromise = done.promise;
|
|
6914
|
+
if (decoded.done) {
|
|
6915
|
+
done.resolve();
|
|
6916
|
+
} else {
|
|
6917
|
+
donePromise = decodeDeferred.call(decoder, reader).then(done.resolve).catch((reason) => {
|
|
6918
|
+
for (const deferred of Object.values(decoder.deferred)) {
|
|
6919
|
+
deferred.reject(reason);
|
|
6920
|
+
}
|
|
6921
|
+
done.reject(reason);
|
|
6922
|
+
});
|
|
6923
|
+
}
|
|
6924
|
+
return {
|
|
6925
|
+
done: donePromise.then(() => reader.closed),
|
|
6926
|
+
value: decoded.value
|
|
6927
|
+
};
|
|
6928
|
+
}
|
|
6929
|
+
async function decodeInitial(reader) {
|
|
6930
|
+
const read = await reader.read();
|
|
6931
|
+
if (!read.value) {
|
|
6932
|
+
throw new SyntaxError();
|
|
6933
|
+
}
|
|
6934
|
+
let line;
|
|
6935
|
+
try {
|
|
6936
|
+
line = JSON.parse(read.value);
|
|
6937
|
+
} catch (reason) {
|
|
6938
|
+
throw new SyntaxError();
|
|
6939
|
+
}
|
|
6940
|
+
return {
|
|
6941
|
+
done: read.done,
|
|
6942
|
+
value: unflatten.call(this, line)
|
|
6943
|
+
};
|
|
6944
|
+
}
|
|
6945
|
+
async function decodeDeferred(reader) {
|
|
6946
|
+
let read = await reader.read();
|
|
6947
|
+
while (!read.done) {
|
|
6948
|
+
if (!read.value) continue;
|
|
6949
|
+
const line = read.value;
|
|
6950
|
+
switch (line[0]) {
|
|
6951
|
+
case TYPE_PROMISE: {
|
|
6952
|
+
const colonIndex = line.indexOf(":");
|
|
6953
|
+
const deferredId = Number(line.slice(1, colonIndex));
|
|
6954
|
+
const deferred = this.deferred[deferredId];
|
|
6955
|
+
if (!deferred) {
|
|
6956
|
+
throw new Error(`Deferred ID ${deferredId} not found in stream`);
|
|
6957
|
+
}
|
|
6958
|
+
const lineData = line.slice(colonIndex + 1);
|
|
6959
|
+
let jsonLine;
|
|
6960
|
+
try {
|
|
6961
|
+
jsonLine = JSON.parse(lineData);
|
|
6962
|
+
} catch (reason) {
|
|
6963
|
+
throw new SyntaxError();
|
|
6964
|
+
}
|
|
6965
|
+
const value = unflatten.call(this, jsonLine);
|
|
6966
|
+
deferred.resolve(value);
|
|
6967
|
+
break;
|
|
6968
|
+
}
|
|
6969
|
+
case TYPE_ERROR: {
|
|
6970
|
+
const colonIndex = line.indexOf(":");
|
|
6971
|
+
const deferredId = Number(line.slice(1, colonIndex));
|
|
6972
|
+
const deferred = this.deferred[deferredId];
|
|
6973
|
+
if (!deferred) {
|
|
6974
|
+
throw new Error(`Deferred ID ${deferredId} not found in stream`);
|
|
6975
|
+
}
|
|
6976
|
+
const lineData = line.slice(colonIndex + 1);
|
|
6977
|
+
let jsonLine;
|
|
6978
|
+
try {
|
|
6979
|
+
jsonLine = JSON.parse(lineData);
|
|
6980
|
+
} catch (reason) {
|
|
6981
|
+
throw new SyntaxError();
|
|
6982
|
+
}
|
|
6983
|
+
const value = unflatten.call(this, jsonLine);
|
|
6984
|
+
deferred.reject(value);
|
|
6985
|
+
break;
|
|
6986
|
+
}
|
|
6987
|
+
default:
|
|
6988
|
+
throw new SyntaxError();
|
|
6989
|
+
}
|
|
6990
|
+
read = await reader.read();
|
|
6991
|
+
}
|
|
6992
|
+
}
|
|
6993
|
+
function encode(input, options) {
|
|
6994
|
+
const { plugins, postPlugins, signal } = options ?? {};
|
|
6995
|
+
const encoder2 = {
|
|
6996
|
+
deferred: {},
|
|
6997
|
+
index: 0,
|
|
6998
|
+
indices: /* @__PURE__ */ new Map(),
|
|
6999
|
+
stringified: [],
|
|
7000
|
+
plugins,
|
|
7001
|
+
postPlugins,
|
|
7002
|
+
signal
|
|
7003
|
+
};
|
|
7004
|
+
const textEncoder = new TextEncoder();
|
|
7005
|
+
let lastSentIndex = 0;
|
|
7006
|
+
const readable = new ReadableStream({
|
|
7007
|
+
async start(controller) {
|
|
7008
|
+
const id = flatten.call(encoder2, input);
|
|
7009
|
+
if (Array.isArray(id)) {
|
|
7010
|
+
throw new Error("This should never happen");
|
|
7011
|
+
}
|
|
7012
|
+
if (id < 0) {
|
|
7013
|
+
controller.enqueue(textEncoder.encode(`${id}
|
|
7014
|
+
`));
|
|
7015
|
+
} else {
|
|
7016
|
+
controller.enqueue(
|
|
7017
|
+
textEncoder.encode(`[${encoder2.stringified.join(",")}]
|
|
7018
|
+
`)
|
|
7019
|
+
);
|
|
7020
|
+
lastSentIndex = encoder2.stringified.length - 1;
|
|
7021
|
+
}
|
|
7022
|
+
const seenPromises = /* @__PURE__ */ new WeakSet();
|
|
7023
|
+
if (Object.keys(encoder2.deferred).length) {
|
|
7024
|
+
let raceDone;
|
|
7025
|
+
const racePromise = new Promise((resolve, reject) => {
|
|
7026
|
+
raceDone = resolve;
|
|
7027
|
+
if (signal) {
|
|
7028
|
+
const rejectPromise = () => reject(signal.reason || new Error("Signal was aborted."));
|
|
7029
|
+
if (signal.aborted) {
|
|
7030
|
+
rejectPromise();
|
|
7031
|
+
} else {
|
|
7032
|
+
signal.addEventListener("abort", (event) => {
|
|
7033
|
+
rejectPromise();
|
|
7034
|
+
});
|
|
7035
|
+
}
|
|
7036
|
+
}
|
|
7037
|
+
});
|
|
7038
|
+
while (Object.keys(encoder2.deferred).length > 0) {
|
|
7039
|
+
for (const [deferredId, deferred] of Object.entries(
|
|
7040
|
+
encoder2.deferred
|
|
7041
|
+
)) {
|
|
7042
|
+
if (seenPromises.has(deferred)) continue;
|
|
7043
|
+
seenPromises.add(
|
|
7044
|
+
// biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
|
|
7045
|
+
encoder2.deferred[Number(deferredId)] = Promise.race([
|
|
7046
|
+
racePromise,
|
|
7047
|
+
deferred
|
|
7048
|
+
]).then(
|
|
7049
|
+
(resolved) => {
|
|
7050
|
+
const id2 = flatten.call(encoder2, resolved);
|
|
7051
|
+
if (Array.isArray(id2)) {
|
|
7052
|
+
controller.enqueue(
|
|
7053
|
+
textEncoder.encode(
|
|
7054
|
+
`${TYPE_PROMISE}${deferredId}:[["${TYPE_PREVIOUS_RESOLVED}",${id2[0]}]]
|
|
7055
|
+
`
|
|
7056
|
+
)
|
|
7057
|
+
);
|
|
7058
|
+
encoder2.index++;
|
|
7059
|
+
lastSentIndex++;
|
|
7060
|
+
} else if (id2 < 0) {
|
|
7061
|
+
controller.enqueue(
|
|
7062
|
+
textEncoder.encode(
|
|
7063
|
+
`${TYPE_PROMISE}${deferredId}:${id2}
|
|
7064
|
+
`
|
|
7065
|
+
)
|
|
7066
|
+
);
|
|
7067
|
+
} else {
|
|
7068
|
+
const values = encoder2.stringified.slice(lastSentIndex + 1).join(",");
|
|
7069
|
+
controller.enqueue(
|
|
7070
|
+
textEncoder.encode(
|
|
7071
|
+
`${TYPE_PROMISE}${deferredId}:[${values}]
|
|
7072
|
+
`
|
|
7073
|
+
)
|
|
7074
|
+
);
|
|
7075
|
+
lastSentIndex = encoder2.stringified.length - 1;
|
|
7076
|
+
}
|
|
7077
|
+
},
|
|
7078
|
+
(reason) => {
|
|
7079
|
+
if (!reason || typeof reason !== "object" || !(reason instanceof Error)) {
|
|
7080
|
+
reason = new Error("An unknown error occurred");
|
|
7081
|
+
}
|
|
7082
|
+
const id2 = flatten.call(encoder2, reason);
|
|
7083
|
+
if (Array.isArray(id2)) {
|
|
7084
|
+
controller.enqueue(
|
|
7085
|
+
textEncoder.encode(
|
|
7086
|
+
`${TYPE_ERROR}${deferredId}:[["${TYPE_PREVIOUS_RESOLVED}",${id2[0]}]]
|
|
7087
|
+
`
|
|
7088
|
+
)
|
|
7089
|
+
);
|
|
7090
|
+
encoder2.index++;
|
|
7091
|
+
lastSentIndex++;
|
|
7092
|
+
} else if (id2 < 0) {
|
|
7093
|
+
controller.enqueue(
|
|
7094
|
+
textEncoder.encode(`${TYPE_ERROR}${deferredId}:${id2}
|
|
7095
|
+
`)
|
|
7096
|
+
);
|
|
7097
|
+
} else {
|
|
7098
|
+
const values = encoder2.stringified.slice(lastSentIndex + 1).join(",");
|
|
7099
|
+
controller.enqueue(
|
|
7100
|
+
textEncoder.encode(
|
|
7101
|
+
`${TYPE_ERROR}${deferredId}:[${values}]
|
|
7102
|
+
`
|
|
7103
|
+
)
|
|
7104
|
+
);
|
|
7105
|
+
lastSentIndex = encoder2.stringified.length - 1;
|
|
7106
|
+
}
|
|
7107
|
+
}
|
|
7108
|
+
).finally(() => {
|
|
7109
|
+
delete encoder2.deferred[Number(deferredId)];
|
|
7110
|
+
})
|
|
7111
|
+
);
|
|
7112
|
+
}
|
|
7113
|
+
await Promise.race(Object.values(encoder2.deferred));
|
|
7114
|
+
}
|
|
7115
|
+
raceDone();
|
|
7116
|
+
}
|
|
7117
|
+
await Promise.all(Object.values(encoder2.deferred));
|
|
7118
|
+
controller.close();
|
|
7119
|
+
}
|
|
7120
|
+
});
|
|
7121
|
+
return readable;
|
|
7122
|
+
}
|
|
6447
7123
|
|
|
6448
7124
|
// lib/dom/ssr/data.ts
|
|
6449
7125
|
async function createRequestInit(request) {
|
|
@@ -6468,6 +7144,8 @@ async function createRequestInit(request) {
|
|
|
6468
7144
|
|
|
6469
7145
|
// lib/dom/ssr/single-fetch.tsx
|
|
6470
7146
|
var SingleFetchRedirectSymbol = Symbol("SingleFetchRedirect");
|
|
7147
|
+
var SingleFetchNoResultError = class extends Error {
|
|
7148
|
+
};
|
|
6471
7149
|
var SINGLE_FETCH_REDIRECT_STATUS = 202;
|
|
6472
7150
|
var NO_BODY_STATUS_CODES = /* @__PURE__ */ new Set([100, 101, 204, 205]);
|
|
6473
7151
|
function StreamTransfer({
|
|
@@ -6596,7 +7274,7 @@ async function singleFetchActionStrategy(args, fetchAndDecode, basename) {
|
|
|
6596
7274
|
});
|
|
6597
7275
|
return result2;
|
|
6598
7276
|
});
|
|
6599
|
-
if (isResponse(result.result) || isRouteErrorResponse(result.result)) {
|
|
7277
|
+
if (isResponse(result.result) || isRouteErrorResponse(result.result) || isDataWithResponseInit(result.result)) {
|
|
6600
7278
|
return { [actionMatch.route.id]: result };
|
|
6601
7279
|
}
|
|
6602
7280
|
return {
|
|
@@ -6694,8 +7372,39 @@ async function singleFetchLoaderNavigationStrategy(args, router, getRouteInfo, f
|
|
|
6694
7372
|
}
|
|
6695
7373
|
}
|
|
6696
7374
|
await resolvePromise;
|
|
7375
|
+
await bubbleMiddlewareErrors(
|
|
7376
|
+
singleFetchDfd.promise,
|
|
7377
|
+
args.matches,
|
|
7378
|
+
routesParams,
|
|
7379
|
+
results
|
|
7380
|
+
);
|
|
6697
7381
|
return results;
|
|
6698
7382
|
}
|
|
7383
|
+
async function bubbleMiddlewareErrors(singleFetchPromise, matches, routesParams, results) {
|
|
7384
|
+
try {
|
|
7385
|
+
let middlewareError;
|
|
7386
|
+
let fetchedData = await singleFetchPromise;
|
|
7387
|
+
if ("routes" in fetchedData) {
|
|
7388
|
+
for (let match of matches) {
|
|
7389
|
+
if (match.route.id in fetchedData.routes) {
|
|
7390
|
+
let routeResult = fetchedData.routes[match.route.id];
|
|
7391
|
+
if ("error" in routeResult) {
|
|
7392
|
+
middlewareError = routeResult.error;
|
|
7393
|
+
break;
|
|
7394
|
+
}
|
|
7395
|
+
}
|
|
7396
|
+
}
|
|
7397
|
+
}
|
|
7398
|
+
if (middlewareError !== void 0) {
|
|
7399
|
+
Array.from(routesParams.values()).forEach((routeId) => {
|
|
7400
|
+
if (results[routeId].result instanceof SingleFetchNoResultError) {
|
|
7401
|
+
results[routeId].result = middlewareError;
|
|
7402
|
+
}
|
|
7403
|
+
});
|
|
7404
|
+
}
|
|
7405
|
+
} catch (e) {
|
|
7406
|
+
}
|
|
7407
|
+
}
|
|
6699
7408
|
async function singleFetchLoaderFetcherStrategy(args, fetchAndDecode, basename) {
|
|
6700
7409
|
let fetcherMatch = args.matches.find((m) => m.unstable_shouldCallHandler());
|
|
6701
7410
|
invariant2(fetcherMatch, "No fetcher match found");
|
|
@@ -6802,7 +7511,7 @@ async function fetchAndDecodeViaTurboStream(args, basename, targetRoutes) {
|
|
|
6802
7511
|
}
|
|
6803
7512
|
}
|
|
6804
7513
|
function decodeViaTurboStream(body, global2) {
|
|
6805
|
-
return
|
|
7514
|
+
return decode(body, {
|
|
6806
7515
|
plugins: [
|
|
6807
7516
|
(type, ...rest) => {
|
|
6808
7517
|
if (type === "SanitizedError") {
|
|
@@ -6854,12 +7563,16 @@ function unwrapSingleFetchResult(result, routeId) {
|
|
|
6854
7563
|
});
|
|
6855
7564
|
}
|
|
6856
7565
|
let routeResult = result.routes[routeId];
|
|
6857
|
-
if (
|
|
7566
|
+
if (routeResult == null) {
|
|
7567
|
+
throw new SingleFetchNoResultError(
|
|
7568
|
+
`No result found for routeId "${routeId}"`
|
|
7569
|
+
);
|
|
7570
|
+
} else if ("error" in routeResult) {
|
|
6858
7571
|
throw routeResult.error;
|
|
6859
7572
|
} else if ("data" in routeResult) {
|
|
6860
7573
|
return routeResult.data;
|
|
6861
7574
|
} else {
|
|
6862
|
-
throw new Error(`
|
|
7575
|
+
throw new Error(`Invalid response found for routeId "${routeId}"`);
|
|
6863
7576
|
}
|
|
6864
7577
|
}
|
|
6865
7578
|
function createDeferred2() {
|
|
@@ -6937,14 +7650,14 @@ function RemixRootDefaultErrorBoundary({
|
|
|
6937
7650
|
dangerouslySetInnerHTML: {
|
|
6938
7651
|
__html: `
|
|
6939
7652
|
console.log(
|
|
6940
|
-
"\u{1F4BF} Hey developer \u{1F44B}. You can provide a way better UX than this when your app throws errors. Check out https://
|
|
7653
|
+
"\u{1F4BF} Hey developer \u{1F44B}. You can provide a way better UX than this when your app throws errors. Check out https://reactrouter.com/how-to/error-boundary for more information."
|
|
6941
7654
|
);
|
|
6942
7655
|
`
|
|
6943
7656
|
}
|
|
6944
7657
|
}
|
|
6945
7658
|
);
|
|
6946
7659
|
if (isRouteErrorResponse(error)) {
|
|
6947
|
-
return /* @__PURE__ */ React5.createElement(BoundaryShell, { title: "Unhandled Thrown Response!" }, /* @__PURE__ */ React5.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText), heyDeveloper);
|
|
7660
|
+
return /* @__PURE__ */ React5.createElement(BoundaryShell, { title: "Unhandled Thrown Response!" }, /* @__PURE__ */ React5.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText), ENABLE_DEV_WARNINGS ? heyDeveloper : null);
|
|
6948
7661
|
}
|
|
6949
7662
|
let errorInstance;
|
|
6950
7663
|
if (error instanceof Error) {
|
|
@@ -6997,7 +7710,7 @@ function BoundaryShell({
|
|
|
6997
7710
|
// lib/dom/ssr/fallback.tsx
|
|
6998
7711
|
var React6 = __toESM(require("react"));
|
|
6999
7712
|
function RemixRootDefaultHydrateFallback() {
|
|
7000
|
-
return /* @__PURE__ */ React6.createElement(BoundaryShell, { title: "Loading...", renderScripts: true }, /* @__PURE__ */ React6.createElement(
|
|
7713
|
+
return /* @__PURE__ */ React6.createElement(BoundaryShell, { title: "Loading...", renderScripts: true }, ENABLE_DEV_WARNINGS ? /* @__PURE__ */ React6.createElement(
|
|
7001
7714
|
"script",
|
|
7002
7715
|
{
|
|
7003
7716
|
dangerouslySetInnerHTML: {
|
|
@@ -7005,13 +7718,13 @@ function RemixRootDefaultHydrateFallback() {
|
|
|
7005
7718
|
console.log(
|
|
7006
7719
|
"\u{1F4BF} Hey developer \u{1F44B}. You can provide a way better UX than this " +
|
|
7007
7720
|
"when your app is loading JS modules and/or running \`clientLoader\` " +
|
|
7008
|
-
"functions. Check out https://
|
|
7721
|
+
"functions. Check out https://reactrouter.com/start/framework/route-module#hydratefallback " +
|
|
7009
7722
|
"for more information."
|
|
7010
7723
|
);
|
|
7011
7724
|
`
|
|
7012
7725
|
}
|
|
7013
7726
|
}
|
|
7014
|
-
));
|
|
7727
|
+
) : null);
|
|
7015
7728
|
}
|
|
7016
7729
|
|
|
7017
7730
|
// lib/dom/ssr/routes.tsx
|
|
@@ -7424,8 +8137,8 @@ var nextPaths = /* @__PURE__ */ new Set();
|
|
|
7424
8137
|
var discoveredPathsMaxSize = 1e3;
|
|
7425
8138
|
var discoveredPaths = /* @__PURE__ */ new Set();
|
|
7426
8139
|
var URL_LIMIT = 7680;
|
|
7427
|
-
function isFogOfWarEnabled(ssr) {
|
|
7428
|
-
return ssr === true;
|
|
8140
|
+
function isFogOfWarEnabled(routeDiscovery, ssr) {
|
|
8141
|
+
return routeDiscovery.mode === "lazy" && ssr === true;
|
|
7429
8142
|
}
|
|
7430
8143
|
function getPartialManifest({ sri, ...manifest }, router) {
|
|
7431
8144
|
let routeIds = new Set(router.state.matches.map((m) => m.route.id));
|
|
@@ -7452,8 +8165,8 @@ function getPartialManifest({ sri, ...manifest }, router) {
|
|
|
7452
8165
|
sri: sri ? true : void 0
|
|
7453
8166
|
};
|
|
7454
8167
|
}
|
|
7455
|
-
function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, isSpaMode, basename) {
|
|
7456
|
-
if (!isFogOfWarEnabled(ssr)) {
|
|
8168
|
+
function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDiscovery, isSpaMode, basename) {
|
|
8169
|
+
if (!isFogOfWarEnabled(routeDiscovery, ssr)) {
|
|
7457
8170
|
return void 0;
|
|
7458
8171
|
}
|
|
7459
8172
|
return async ({ path, patch, signal, fetcherKey }) => {
|
|
@@ -7468,14 +8181,16 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, isSpaMo
|
|
|
7468
8181
|
ssr,
|
|
7469
8182
|
isSpaMode,
|
|
7470
8183
|
basename,
|
|
8184
|
+
routeDiscovery.manifestPath,
|
|
7471
8185
|
patch,
|
|
7472
8186
|
signal
|
|
7473
8187
|
);
|
|
7474
8188
|
};
|
|
7475
8189
|
}
|
|
7476
|
-
function useFogOFWarDiscovery(router, manifest, routeModules, ssr, isSpaMode) {
|
|
8190
|
+
function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
|
|
7477
8191
|
React8.useEffect(() => {
|
|
7478
|
-
if (!isFogOfWarEnabled(ssr) ||
|
|
8192
|
+
if (!isFogOfWarEnabled(routeDiscovery, ssr) || // @ts-expect-error - TS doesn't know about this yet
|
|
8193
|
+
window.navigator?.connection?.saveData === true) {
|
|
7479
8194
|
return;
|
|
7480
8195
|
}
|
|
7481
8196
|
function registerElement(el) {
|
|
@@ -7509,6 +8224,7 @@ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, isSpaMode) {
|
|
|
7509
8224
|
ssr,
|
|
7510
8225
|
isSpaMode,
|
|
7511
8226
|
router.basename,
|
|
8227
|
+
routeDiscovery.manifestPath,
|
|
7512
8228
|
router.patchRoutes
|
|
7513
8229
|
);
|
|
7514
8230
|
} catch (e) {
|
|
@@ -7525,15 +8241,21 @@ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, isSpaMode) {
|
|
|
7525
8241
|
attributeFilter: ["data-discover", "href", "action"]
|
|
7526
8242
|
});
|
|
7527
8243
|
return () => observer.disconnect();
|
|
7528
|
-
}, [ssr, isSpaMode, manifest, routeModules, router]);
|
|
8244
|
+
}, [ssr, isSpaMode, manifest, routeModules, router, routeDiscovery]);
|
|
8245
|
+
}
|
|
8246
|
+
function getManifestPath(_manifestPath, basename) {
|
|
8247
|
+
let manifestPath = _manifestPath || "/__manifest";
|
|
8248
|
+
if (basename == null) {
|
|
8249
|
+
return manifestPath;
|
|
8250
|
+
}
|
|
8251
|
+
return `${basename}${manifestPath}`.replace(/\/+/g, "/");
|
|
7529
8252
|
}
|
|
7530
8253
|
var MANIFEST_VERSION_STORAGE_KEY = "react-router-manifest-version";
|
|
7531
|
-
async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, routeModules, ssr, isSpaMode, basename, patchRoutes, signal) {
|
|
7532
|
-
let
|
|
7533
|
-
|
|
7534
|
-
|
|
8254
|
+
async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, routeModules, ssr, isSpaMode, basename, manifestPath, patchRoutes, signal) {
|
|
8255
|
+
let url = new URL(
|
|
8256
|
+
getManifestPath(manifestPath, basename),
|
|
8257
|
+
window.location.origin
|
|
7535
8258
|
);
|
|
7536
|
-
let url = new URL(manifestPath, window.location.origin);
|
|
7537
8259
|
paths.sort().forEach((path) => url.searchParams.append("p", path));
|
|
7538
8260
|
url.searchParams.set("version", manifest.version);
|
|
7539
8261
|
if (url.toString().length > URL_LIMIT) {
|
|
@@ -7560,7 +8282,9 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
|
|
|
7560
8282
|
}
|
|
7561
8283
|
sessionStorage.setItem(MANIFEST_VERSION_STORAGE_KEY, manifest.version);
|
|
7562
8284
|
window.location.href = errorReloadPath;
|
|
7563
|
-
|
|
8285
|
+
console.warn("Detected manifest version mismatch, reloading...");
|
|
8286
|
+
await new Promise(() => {
|
|
8287
|
+
});
|
|
7564
8288
|
} else if (res.status >= 400) {
|
|
7565
8289
|
throw new Error(await res.text());
|
|
7566
8290
|
}
|
|
@@ -7939,10 +8663,17 @@ function isValidMetaTag(tagName) {
|
|
|
7939
8663
|
}
|
|
7940
8664
|
var isHydrated = false;
|
|
7941
8665
|
function Scripts(props) {
|
|
7942
|
-
let {
|
|
8666
|
+
let {
|
|
8667
|
+
manifest,
|
|
8668
|
+
serverHandoffString,
|
|
8669
|
+
isSpaMode,
|
|
8670
|
+
renderMeta,
|
|
8671
|
+
routeDiscovery,
|
|
8672
|
+
ssr
|
|
8673
|
+
} = useFrameworkContext();
|
|
7943
8674
|
let { router, static: isStatic, staticContext } = useDataRouterContext2();
|
|
7944
8675
|
let { matches: routerMatches } = useDataRouterStateContext();
|
|
7945
|
-
let enableFogOfWar = isFogOfWarEnabled(ssr);
|
|
8676
|
+
let enableFogOfWar = isFogOfWarEnabled(routeDiscovery, ssr);
|
|
7946
8677
|
if (renderMeta) {
|
|
7947
8678
|
renderMeta.didRenderScripts = true;
|
|
7948
8679
|
}
|
|
@@ -8098,7 +8829,7 @@ function mergeRefs(...refs) {
|
|
|
8098
8829
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
8099
8830
|
try {
|
|
8100
8831
|
if (isBrowser) {
|
|
8101
|
-
window.__reactRouterVersion = "7.
|
|
8832
|
+
window.__reactRouterVersion = "7.6.0";
|
|
8102
8833
|
}
|
|
8103
8834
|
} catch (e) {
|
|
8104
8835
|
}
|
|
@@ -8358,11 +9089,11 @@ var NavLink = React10.forwardRef(
|
|
|
8358
9089
|
let path = useResolvedPath(to, { relative: rest.relative });
|
|
8359
9090
|
let location = useLocation();
|
|
8360
9091
|
let routerState = React10.useContext(DataRouterStateContext);
|
|
8361
|
-
let { navigator
|
|
9092
|
+
let { navigator, basename } = React10.useContext(NavigationContext);
|
|
8362
9093
|
let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
|
|
8363
9094
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
8364
9095
|
useViewTransitionState(path) && viewTransition === true;
|
|
8365
|
-
let toPathname =
|
|
9096
|
+
let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;
|
|
8366
9097
|
let locationPathname = location.pathname;
|
|
8367
9098
|
let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
|
|
8368
9099
|
if (!caseSensitive) {
|
|
@@ -8939,7 +9670,7 @@ function StaticRouter({
|
|
|
8939
9670
|
function StaticRouterProvider({
|
|
8940
9671
|
context,
|
|
8941
9672
|
router,
|
|
8942
|
-
hydrate = true,
|
|
9673
|
+
hydrate: hydrate2 = true,
|
|
8943
9674
|
nonce
|
|
8944
9675
|
}) {
|
|
8945
9676
|
invariant(
|
|
@@ -8955,7 +9686,7 @@ function StaticRouterProvider({
|
|
|
8955
9686
|
};
|
|
8956
9687
|
let fetchersContext = /* @__PURE__ */ new Map();
|
|
8957
9688
|
let hydrateScript = "";
|
|
8958
|
-
if (
|
|
9689
|
+
if (hydrate2 !== false) {
|
|
8959
9690
|
let data2 = {
|
|
8960
9691
|
loaderData: context.loaderData,
|
|
8961
9692
|
actionData: context.actionData,
|
|
@@ -9222,6 +9953,7 @@ function ServerRouter({
|
|
|
9222
9953
|
future: context.future,
|
|
9223
9954
|
ssr: context.ssr,
|
|
9224
9955
|
isSpaMode: context.isSpaMode,
|
|
9956
|
+
routeDiscovery: context.routeDiscovery,
|
|
9225
9957
|
serializeError: context.serializeError,
|
|
9226
9958
|
renderMeta: context.renderMeta
|
|
9227
9959
|
}
|
|
@@ -9271,7 +10003,8 @@ function createRoutesStub(routes, unstable_getContext) {
|
|
|
9271
10003
|
},
|
|
9272
10004
|
routeModules: {},
|
|
9273
10005
|
ssr: false,
|
|
9274
|
-
isSpaMode: false
|
|
10006
|
+
isSpaMode: false,
|
|
10007
|
+
routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" }
|
|
9275
10008
|
};
|
|
9276
10009
|
let patched = processRoutes(
|
|
9277
10010
|
// @ts-expect-error `StubRouteObject` is stricter about `loader`/`action`
|
|
@@ -9290,6 +10023,37 @@ function createRoutesStub(routes, unstable_getContext) {
|
|
|
9290
10023
|
return /* @__PURE__ */ React13.createElement(FrameworkContext.Provider, { value: remixContextRef.current }, /* @__PURE__ */ React13.createElement(RouterProvider, { router: routerRef.current }));
|
|
9291
10024
|
};
|
|
9292
10025
|
}
|
|
10026
|
+
function withComponentProps(Component4) {
|
|
10027
|
+
return function Wrapped() {
|
|
10028
|
+
return React13.createElement(Component4, {
|
|
10029
|
+
params: useParams(),
|
|
10030
|
+
loaderData: useLoaderData(),
|
|
10031
|
+
actionData: useActionData(),
|
|
10032
|
+
matches: useMatches()
|
|
10033
|
+
});
|
|
10034
|
+
};
|
|
10035
|
+
}
|
|
10036
|
+
function withHydrateFallbackProps(HydrateFallback) {
|
|
10037
|
+
return function Wrapped() {
|
|
10038
|
+
const props = {
|
|
10039
|
+
params: useParams(),
|
|
10040
|
+
loaderData: useLoaderData(),
|
|
10041
|
+
actionData: useActionData()
|
|
10042
|
+
};
|
|
10043
|
+
return React13.createElement(HydrateFallback, props);
|
|
10044
|
+
};
|
|
10045
|
+
}
|
|
10046
|
+
function withErrorBoundaryProps(ErrorBoundary) {
|
|
10047
|
+
return function Wrapped() {
|
|
10048
|
+
const props = {
|
|
10049
|
+
params: useParams(),
|
|
10050
|
+
loaderData: useLoaderData(),
|
|
10051
|
+
actionData: useActionData(),
|
|
10052
|
+
error: useRouteError()
|
|
10053
|
+
};
|
|
10054
|
+
return React13.createElement(ErrorBoundary, props);
|
|
10055
|
+
};
|
|
10056
|
+
}
|
|
9293
10057
|
function processRoutes(routes, manifest, routeModules, parentId) {
|
|
9294
10058
|
return routes.map((route) => {
|
|
9295
10059
|
if (!route.id) {
|
|
@@ -9301,9 +10065,9 @@ function processRoutes(routes, manifest, routeModules, parentId) {
|
|
|
9301
10065
|
id: route.id,
|
|
9302
10066
|
path: route.path,
|
|
9303
10067
|
index: route.index,
|
|
9304
|
-
Component: route.Component,
|
|
9305
|
-
HydrateFallback: route.HydrateFallback,
|
|
9306
|
-
ErrorBoundary: route.ErrorBoundary,
|
|
10068
|
+
Component: route.Component ? withComponentProps(route.Component) : void 0,
|
|
10069
|
+
HydrateFallback: route.HydrateFallback ? withHydrateFallbackProps(route.HydrateFallback) : void 0,
|
|
10070
|
+
ErrorBoundary: route.ErrorBoundary ? withErrorBoundaryProps(route.ErrorBoundary) : void 0,
|
|
9307
10071
|
action: route.action,
|
|
9308
10072
|
loader: route.loader,
|
|
9309
10073
|
handle: route.handle,
|
|
@@ -9332,8 +10096,8 @@ function processRoutes(routes, manifest, routeModules, parentId) {
|
|
|
9332
10096
|
};
|
|
9333
10097
|
manifest.routes[newRoute.id] = entryRoute;
|
|
9334
10098
|
routeModules[route.id] = {
|
|
9335
|
-
default:
|
|
9336
|
-
ErrorBoundary:
|
|
10099
|
+
default: newRoute.Component || Outlet,
|
|
10100
|
+
ErrorBoundary: newRoute.ErrorBoundary || void 0,
|
|
9337
10101
|
handle: route.handle,
|
|
9338
10102
|
links: route.links,
|
|
9339
10103
|
meta: route.meta,
|
|
@@ -9355,7 +10119,7 @@ function processRoutes(routes, manifest, routeModules, parentId) {
|
|
|
9355
10119
|
var import_cookie = require("cookie");
|
|
9356
10120
|
|
|
9357
10121
|
// lib/server-runtime/crypto.ts
|
|
9358
|
-
var encoder = new TextEncoder();
|
|
10122
|
+
var encoder = /* @__PURE__ */ new TextEncoder();
|
|
9359
10123
|
var sign = async (value, secret) => {
|
|
9360
10124
|
let data2 = encoder.encode(value);
|
|
9361
10125
|
let key = await createKey2(secret, ["sign"]);
|
|
@@ -9805,9 +10569,6 @@ function createServerHandoffString(serverHandoff) {
|
|
|
9805
10569
|
return escapeHtml2(JSON.stringify(serverHandoff));
|
|
9806
10570
|
}
|
|
9807
10571
|
|
|
9808
|
-
// lib/server-runtime/single-fetch.ts
|
|
9809
|
-
var import_turbo_stream2 = require("turbo-stream");
|
|
9810
|
-
|
|
9811
10572
|
// lib/server-runtime/headers.ts
|
|
9812
10573
|
var import_set_cookie_parser = require("set-cookie-parser");
|
|
9813
10574
|
function getDocumentHeaders(build, context) {
|
|
@@ -10093,7 +10854,7 @@ function encodeViaTurboStream(data2, requestSignal, streamTimeout, serverMode) {
|
|
|
10093
10854
|
typeof streamTimeout === "number" ? streamTimeout : 4950
|
|
10094
10855
|
);
|
|
10095
10856
|
requestSignal.addEventListener("abort", () => clearTimeout(timeoutId));
|
|
10096
|
-
return
|
|
10857
|
+
return encode(data2, {
|
|
10097
10858
|
signal: controller.signal,
|
|
10098
10859
|
plugins: [
|
|
10099
10860
|
(value) => {
|
|
@@ -10240,7 +11001,10 @@ Error: ${e instanceof Error ? e.toString() : e}`
|
|
|
10240
11001
|
}
|
|
10241
11002
|
}
|
|
10242
11003
|
}
|
|
10243
|
-
let manifestUrl =
|
|
11004
|
+
let manifestUrl = getManifestPath(
|
|
11005
|
+
_build.routeDiscovery.manifestPath,
|
|
11006
|
+
normalizedBasename
|
|
11007
|
+
);
|
|
10244
11008
|
if (url.pathname === manifestUrl) {
|
|
10245
11009
|
try {
|
|
10246
11010
|
let res = await handleManifestRequest(_build, routes, url);
|
|
@@ -10250,7 +11014,7 @@ Error: ${e instanceof Error ? e.toString() : e}`
|
|
|
10250
11014
|
return new Response("Unknown Server Error", { status: 500 });
|
|
10251
11015
|
}
|
|
10252
11016
|
}
|
|
10253
|
-
let matches = matchServerRoutes(routes,
|
|
11017
|
+
let matches = matchServerRoutes(routes, normalizedPath, _build.basename);
|
|
10254
11018
|
if (matches && matches.length > 0) {
|
|
10255
11019
|
Object.assign(params, matches[0].params);
|
|
10256
11020
|
}
|
|
@@ -10438,17 +11202,21 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
|
|
|
10438
11202
|
actionData: context.actionData,
|
|
10439
11203
|
errors: serializeErrors2(context.errors, serverMode)
|
|
10440
11204
|
};
|
|
11205
|
+
let baseServerHandoff = {
|
|
11206
|
+
basename: build.basename,
|
|
11207
|
+
future: build.future,
|
|
11208
|
+
routeDiscovery: build.routeDiscovery,
|
|
11209
|
+
ssr: build.ssr,
|
|
11210
|
+
isSpaMode: isSpaMode2
|
|
11211
|
+
};
|
|
10441
11212
|
let entryContext = {
|
|
10442
11213
|
manifest: build.assets,
|
|
10443
11214
|
routeModules: createEntryRouteModules(build.routes),
|
|
10444
11215
|
staticHandlerContext: context,
|
|
10445
11216
|
criticalCss,
|
|
10446
11217
|
serverHandoffString: createServerHandoffString({
|
|
10447
|
-
|
|
10448
|
-
criticalCss
|
|
10449
|
-
future: build.future,
|
|
10450
|
-
ssr: build.ssr,
|
|
10451
|
-
isSpaMode: isSpaMode2
|
|
11218
|
+
...baseServerHandoff,
|
|
11219
|
+
criticalCss
|
|
10452
11220
|
}),
|
|
10453
11221
|
serverHandoffStream: encodeViaTurboStream(
|
|
10454
11222
|
state,
|
|
@@ -10459,6 +11227,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
|
|
|
10459
11227
|
renderMeta: {},
|
|
10460
11228
|
future: build.future,
|
|
10461
11229
|
ssr: build.ssr,
|
|
11230
|
+
routeDiscovery: build.routeDiscovery,
|
|
10462
11231
|
isSpaMode: isSpaMode2,
|
|
10463
11232
|
serializeError: (err) => serializeError(err, serverMode)
|
|
10464
11233
|
};
|
|
@@ -10501,12 +11270,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
|
|
|
10501
11270
|
entryContext = {
|
|
10502
11271
|
...entryContext,
|
|
10503
11272
|
staticHandlerContext: context,
|
|
10504
|
-
serverHandoffString: createServerHandoffString(
|
|
10505
|
-
basename: build.basename,
|
|
10506
|
-
future: build.future,
|
|
10507
|
-
ssr: build.ssr,
|
|
10508
|
-
isSpaMode: isSpaMode2
|
|
10509
|
-
}),
|
|
11273
|
+
serverHandoffString: createServerHandoffString(baseServerHandoff),
|
|
10510
11274
|
serverHandoffStream: encodeViaTurboStream(
|
|
10511
11275
|
state2,
|
|
10512
11276
|
request.signal,
|