react-router 0.0.0-experimental-818f8e08d → 0.0.0-experimental-aecfb0db1
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/dist/development/{chunk-4O47XL4L.mjs → chunk-RXFCVJK2.mjs} +782 -101
- package/dist/development/dom-export.d.mts +2 -2
- package/dist/development/dom-export.js +1 -1
- package/dist/development/dom-export.mjs +2 -2
- package/dist/development/index.d.mts +8 -5
- package/dist/development/index.d.ts +1 -8
- package/dist/development/index.js +784 -103
- package/dist/development/index.mjs +2 -2
- 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/{production/fog-of-war-B1MWugqW.d.mts → development/lib-BJBhVBWN.d.mts} +2 -12
- package/dist/development/{route-data-BvrN3Sw4.d.mts → route-data-BmDen1H_.d.mts} +1 -1
- package/dist/production/{chunk-P2C2EGLF.mjs → chunk-TLRBG5AD.mjs} +782 -101
- package/dist/production/dom-export.d.mts +2 -2
- package/dist/production/dom-export.js +1 -1
- package/dist/production/dom-export.mjs +2 -2
- package/dist/production/index.d.mts +8 -5
- package/dist/production/index.d.ts +1 -8
- package/dist/production/index.js +784 -103
- package/dist/production/index.mjs +2 -2
- 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/{development/fog-of-war-B1MWugqW.d.mts → production/lib-BJBhVBWN.d.mts} +2 -12
- package/dist/production/{route-data-BvrN3Sw4.d.mts → route-data-BmDen1H_.d.mts} +1 -1
- package/package.json +5 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-aecfb0db1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -307,14 +307,7 @@ function getUrlBasedHistory(getLocation, createHref2, validateLocation, options
|
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
309
|
function createURL(to) {
|
|
310
|
-
|
|
311
|
-
let href2 = typeof to === "string" ? to : createPath(to);
|
|
312
|
-
href2 = href2.replace(/ $/, "%20");
|
|
313
|
-
invariant(
|
|
314
|
-
base,
|
|
315
|
-
`No window.location.(origin|href) available to create URL for href: ${href2}`
|
|
316
|
-
);
|
|
317
|
-
return new URL(href2, base);
|
|
310
|
+
return createBrowserURLImpl(to);
|
|
318
311
|
}
|
|
319
312
|
let history = {
|
|
320
313
|
get action() {
|
|
@@ -354,6 +347,19 @@ function getUrlBasedHistory(getLocation, createHref2, validateLocation, options
|
|
|
354
347
|
};
|
|
355
348
|
return history;
|
|
356
349
|
}
|
|
350
|
+
function createBrowserURLImpl(to, isAbsolute = false) {
|
|
351
|
+
let base = "http://localhost";
|
|
352
|
+
if (typeof window !== "undefined") {
|
|
353
|
+
base = window.location.origin !== "null" ? window.location.origin : window.location.href;
|
|
354
|
+
}
|
|
355
|
+
invariant(base, "No window.location.(origin|href) available to create URL");
|
|
356
|
+
let href2 = typeof to === "string" ? to : createPath(to);
|
|
357
|
+
href2 = href2.replace(/ $/, "%20");
|
|
358
|
+
if (!isAbsolute && href2.startsWith("//")) {
|
|
359
|
+
href2 = base + href2;
|
|
360
|
+
}
|
|
361
|
+
return new URL(href2, base);
|
|
362
|
+
}
|
|
357
363
|
|
|
358
364
|
// lib/router/utils.ts
|
|
359
365
|
function unstable_createContext(defaultValue) {
|
|
@@ -650,19 +656,19 @@ function generatePath(originalPath, params = {}) {
|
|
|
650
656
|
path = path.replace(/\*$/, "/*");
|
|
651
657
|
}
|
|
652
658
|
const prefix = path.startsWith("/") ? "/" : "";
|
|
653
|
-
const
|
|
659
|
+
const stringify2 = (p) => p == null ? "" : typeof p === "string" ? p : String(p);
|
|
654
660
|
const segments = path.split(/\/+/).map((segment, index, array) => {
|
|
655
661
|
const isLastSegment = index === array.length - 1;
|
|
656
662
|
if (isLastSegment && segment === "*") {
|
|
657
663
|
const star = "*";
|
|
658
|
-
return
|
|
664
|
+
return stringify2(params[star]);
|
|
659
665
|
}
|
|
660
666
|
const keyMatch = segment.match(/^:([\w-]+)(\??)$/);
|
|
661
667
|
if (keyMatch) {
|
|
662
668
|
const [, key, optional] = keyMatch;
|
|
663
669
|
let param = params[key];
|
|
664
670
|
invariant(optional === "?" || param != null, `Missing ":${key}" param`);
|
|
665
|
-
return
|
|
671
|
+
return stringify2(param);
|
|
666
672
|
}
|
|
667
673
|
return segment.replace(/\?$/g, "");
|
|
668
674
|
}).filter((segment) => !!segment);
|
|
@@ -974,53 +980,57 @@ function createRouter(init) {
|
|
|
974
980
|
let initialMatches = matchRoutes(dataRoutes, init.history.location, basename);
|
|
975
981
|
let initialMatchesIsFOW = false;
|
|
976
982
|
let initialErrors = null;
|
|
983
|
+
let initialized;
|
|
977
984
|
if (initialMatches == null && !init.patchRoutesOnNavigation) {
|
|
978
985
|
let error = getInternalRouterError(404, {
|
|
979
986
|
pathname: init.history.location.pathname
|
|
980
987
|
});
|
|
981
988
|
let { matches, route } = getShortCircuitMatches(dataRoutes);
|
|
989
|
+
initialized = true;
|
|
982
990
|
initialMatches = matches;
|
|
983
991
|
initialErrors = { [route.id]: error };
|
|
984
|
-
}
|
|
985
|
-
if (initialMatches && !init.hydrationData) {
|
|
986
|
-
let fogOfWar = checkFogOfWar(
|
|
987
|
-
initialMatches,
|
|
988
|
-
dataRoutes,
|
|
989
|
-
init.history.location.pathname
|
|
990
|
-
);
|
|
991
|
-
if (fogOfWar.active) {
|
|
992
|
-
initialMatches = null;
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
let initialized;
|
|
996
|
-
if (!initialMatches) {
|
|
997
|
-
initialized = false;
|
|
998
|
-
initialMatches = [];
|
|
999
|
-
let fogOfWar = checkFogOfWar(
|
|
1000
|
-
null,
|
|
1001
|
-
dataRoutes,
|
|
1002
|
-
init.history.location.pathname
|
|
1003
|
-
);
|
|
1004
|
-
if (fogOfWar.active && fogOfWar.matches) {
|
|
1005
|
-
initialMatchesIsFOW = true;
|
|
1006
|
-
initialMatches = fogOfWar.matches;
|
|
1007
|
-
}
|
|
1008
|
-
} else if (initialMatches.some((m) => m.route.lazy)) {
|
|
1009
|
-
initialized = false;
|
|
1010
|
-
} else if (!initialMatches.some((m) => m.route.loader)) {
|
|
1011
|
-
initialized = true;
|
|
1012
992
|
} else {
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
993
|
+
if (initialMatches && !init.hydrationData) {
|
|
994
|
+
let fogOfWar = checkFogOfWar(
|
|
995
|
+
initialMatches,
|
|
996
|
+
dataRoutes,
|
|
997
|
+
init.history.location.pathname
|
|
1018
998
|
);
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
999
|
+
if (fogOfWar.active) {
|
|
1000
|
+
initialMatches = null;
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
if (!initialMatches) {
|
|
1004
|
+
initialized = false;
|
|
1005
|
+
initialMatches = [];
|
|
1006
|
+
let fogOfWar = checkFogOfWar(
|
|
1007
|
+
null,
|
|
1008
|
+
dataRoutes,
|
|
1009
|
+
init.history.location.pathname
|
|
1023
1010
|
);
|
|
1011
|
+
if (fogOfWar.active && fogOfWar.matches) {
|
|
1012
|
+
initialMatchesIsFOW = true;
|
|
1013
|
+
initialMatches = fogOfWar.matches;
|
|
1014
|
+
}
|
|
1015
|
+
} else if (initialMatches.some((m) => m.route.lazy)) {
|
|
1016
|
+
initialized = false;
|
|
1017
|
+
} else if (!initialMatches.some((m) => m.route.loader)) {
|
|
1018
|
+
initialized = true;
|
|
1019
|
+
} else {
|
|
1020
|
+
let loaderData = init.hydrationData ? init.hydrationData.loaderData : null;
|
|
1021
|
+
let errors = init.hydrationData ? init.hydrationData.errors : null;
|
|
1022
|
+
if (errors) {
|
|
1023
|
+
let idx = initialMatches.findIndex(
|
|
1024
|
+
(m) => errors[m.route.id] !== void 0
|
|
1025
|
+
);
|
|
1026
|
+
initialized = initialMatches.slice(0, idx + 1).every(
|
|
1027
|
+
(m) => !shouldLoadRouteOnHydration(m.route, loaderData, errors)
|
|
1028
|
+
);
|
|
1029
|
+
} else {
|
|
1030
|
+
initialized = initialMatches.every(
|
|
1031
|
+
(m) => !shouldLoadRouteOnHydration(m.route, loaderData, errors)
|
|
1032
|
+
);
|
|
1033
|
+
}
|
|
1024
1034
|
}
|
|
1025
1035
|
}
|
|
1026
1036
|
let router;
|
|
@@ -2036,6 +2046,10 @@ function createRouter(init) {
|
|
|
2036
2046
|
fetchReloadIds.delete(key);
|
|
2037
2047
|
fetchControllers.delete(key);
|
|
2038
2048
|
revalidatingFetchers.forEach((r) => fetchControllers.delete(r.key));
|
|
2049
|
+
if (state.fetchers.has(key)) {
|
|
2050
|
+
let doneFetcher = getDoneFetcher(actionResult.data);
|
|
2051
|
+
state.fetchers.set(key, doneFetcher);
|
|
2052
|
+
}
|
|
2039
2053
|
let redirect2 = findRedirect(loaderResults);
|
|
2040
2054
|
if (redirect2) {
|
|
2041
2055
|
return startRedirectNavigation(
|
|
@@ -2063,10 +2077,6 @@ function createRouter(init) {
|
|
|
2063
2077
|
revalidatingFetchers,
|
|
2064
2078
|
fetcherResults
|
|
2065
2079
|
);
|
|
2066
|
-
if (state.fetchers.has(key)) {
|
|
2067
|
-
let doneFetcher = getDoneFetcher(actionResult.data);
|
|
2068
|
-
state.fetchers.set(key, doneFetcher);
|
|
2069
|
-
}
|
|
2070
2080
|
abortStaleFetchLoads(loadId);
|
|
2071
2081
|
if (state.navigation.state === "loading" && loadId > pendingNavigationLoadId) {
|
|
2072
2082
|
invariant(pendingAction, "Expected pending action");
|
|
@@ -2202,7 +2212,7 @@ function createRouter(init) {
|
|
|
2202
2212
|
if (redirect2.response.headers.has("X-Remix-Reload-Document")) {
|
|
2203
2213
|
isDocumentReload = true;
|
|
2204
2214
|
} else if (ABSOLUTE_URL_REGEX.test(location)) {
|
|
2205
|
-
const url =
|
|
2215
|
+
const url = createBrowserURLImpl(location, true);
|
|
2206
2216
|
isDocumentReload = // Hard reload if it's an absolute URL to a new origin
|
|
2207
2217
|
url.origin !== routerWindow.location.origin || // Hard reload if it's an absolute URL that does not match our basename
|
|
2208
2218
|
stripBasename(url.pathname, basename) == null;
|
|
@@ -2269,6 +2279,9 @@ function createRouter(init) {
|
|
|
2269
2279
|
});
|
|
2270
2280
|
return dataResults;
|
|
2271
2281
|
}
|
|
2282
|
+
if (request.signal.aborted) {
|
|
2283
|
+
return dataResults;
|
|
2284
|
+
}
|
|
2272
2285
|
for (let [routeId, result] of Object.entries(results)) {
|
|
2273
2286
|
if (isRedirectDataStrategyResult(result)) {
|
|
2274
2287
|
let response = result.result;
|
|
@@ -3575,7 +3588,7 @@ function shouldLoadRouteOnHydration(route, loaderData, errors) {
|
|
|
3575
3588
|
if (!route.loader) {
|
|
3576
3589
|
return false;
|
|
3577
3590
|
}
|
|
3578
|
-
let hasData = loaderData != null &&
|
|
3591
|
+
let hasData = loaderData != null && route.id in loaderData;
|
|
3579
3592
|
let hasError = errors != null && errors[route.id] !== void 0;
|
|
3580
3593
|
if (!hasData && hasError) {
|
|
3581
3594
|
return false;
|
|
@@ -4784,10 +4797,10 @@ var RouteContext = React.createContext({
|
|
|
4784
4797
|
RouteContext.displayName = "Route";
|
|
4785
4798
|
var RouteErrorContext = React.createContext(null);
|
|
4786
4799
|
RouteErrorContext.displayName = "RouteError";
|
|
4800
|
+
var ENABLE_DEV_WARNINGS = true;
|
|
4787
4801
|
|
|
4788
4802
|
// lib/hooks.tsx
|
|
4789
4803
|
import * as React2 from "react";
|
|
4790
|
-
var ENABLE_DEV_WARNINGS = true;
|
|
4791
4804
|
function useHref(to, { relative } = {}) {
|
|
4792
4805
|
invariant(
|
|
4793
4806
|
useInRouterContext(),
|
|
@@ -4795,13 +4808,13 @@ function useHref(to, { relative } = {}) {
|
|
|
4795
4808
|
// router loaded. We can help them understand how to avoid that.
|
|
4796
4809
|
`useHref() may be used only in the context of a <Router> component.`
|
|
4797
4810
|
);
|
|
4798
|
-
let { basename, navigator
|
|
4811
|
+
let { basename, navigator } = React2.useContext(NavigationContext);
|
|
4799
4812
|
let { hash, pathname, search } = useResolvedPath(to, { relative });
|
|
4800
4813
|
let joinedPathname = pathname;
|
|
4801
4814
|
if (basename !== "/") {
|
|
4802
4815
|
joinedPathname = pathname === "/" ? basename : joinPaths([basename, pathname]);
|
|
4803
4816
|
}
|
|
4804
|
-
return
|
|
4817
|
+
return navigator.createHref({ pathname: joinedPathname, search, hash });
|
|
4805
4818
|
}
|
|
4806
4819
|
function useInRouterContext() {
|
|
4807
4820
|
return React2.useContext(LocationContext) != null;
|
|
@@ -4850,7 +4863,7 @@ function useNavigateUnstable() {
|
|
|
4850
4863
|
`useNavigate() may be used only in the context of a <Router> component.`
|
|
4851
4864
|
);
|
|
4852
4865
|
let dataRouterContext = React2.useContext(DataRouterContext);
|
|
4853
|
-
let { basename, navigator
|
|
4866
|
+
let { basename, navigator } = React2.useContext(NavigationContext);
|
|
4854
4867
|
let { matches } = React2.useContext(RouteContext);
|
|
4855
4868
|
let { pathname: locationPathname } = useLocation();
|
|
4856
4869
|
let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
|
|
@@ -4863,7 +4876,7 @@ function useNavigateUnstable() {
|
|
|
4863
4876
|
warning(activeRef.current, navigateEffectWarning);
|
|
4864
4877
|
if (!activeRef.current) return;
|
|
4865
4878
|
if (typeof to === "number") {
|
|
4866
|
-
|
|
4879
|
+
navigator.go(to);
|
|
4867
4880
|
return;
|
|
4868
4881
|
}
|
|
4869
4882
|
let path = resolveTo(
|
|
@@ -4875,7 +4888,7 @@ function useNavigateUnstable() {
|
|
|
4875
4888
|
if (dataRouterContext == null && basename !== "/") {
|
|
4876
4889
|
path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
|
|
4877
4890
|
}
|
|
4878
|
-
(!!options.replace ?
|
|
4891
|
+
(!!options.replace ? navigator.replace : navigator.push)(
|
|
4879
4892
|
path,
|
|
4880
4893
|
options.state,
|
|
4881
4894
|
options
|
|
@@ -4883,7 +4896,7 @@ function useNavigateUnstable() {
|
|
|
4883
4896
|
},
|
|
4884
4897
|
[
|
|
4885
4898
|
basename,
|
|
4886
|
-
|
|
4899
|
+
navigator,
|
|
4887
4900
|
routePathnamesJson,
|
|
4888
4901
|
locationPathname,
|
|
4889
4902
|
dataRouterContext
|
|
@@ -4931,7 +4944,7 @@ function useRoutesImpl(routes, locationArg, dataRouterState, future) {
|
|
|
4931
4944
|
// router loaded. We can help them understand how to avoid that.
|
|
4932
4945
|
`useRoutes() may be used only in the context of a <Router> component.`
|
|
4933
4946
|
);
|
|
4934
|
-
let { navigator
|
|
4947
|
+
let { navigator, static: isStatic } = React2.useContext(NavigationContext);
|
|
4935
4948
|
let { matches: parentMatches } = React2.useContext(RouteContext);
|
|
4936
4949
|
let routeMatch = parentMatches[parentMatches.length - 1];
|
|
4937
4950
|
let parentParams = routeMatch ? routeMatch.params : {};
|
|
@@ -4985,12 +4998,12 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
4985
4998
|
pathname: joinPaths([
|
|
4986
4999
|
parentPathnameBase,
|
|
4987
5000
|
// Re-encode pathnames that were decoded inside matchRoutes
|
|
4988
|
-
|
|
5001
|
+
navigator.encodeLocation ? navigator.encodeLocation(match.pathname).pathname : match.pathname
|
|
4989
5002
|
]),
|
|
4990
5003
|
pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : joinPaths([
|
|
4991
5004
|
parentPathnameBase,
|
|
4992
5005
|
// Re-encode pathnames that were decoded inside matchRoutes
|
|
4993
|
-
|
|
5006
|
+
navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase).pathname : match.pathnameBase
|
|
4994
5007
|
])
|
|
4995
5008
|
})
|
|
4996
5009
|
),
|
|
@@ -5369,7 +5382,6 @@ function warnOnce(condition, message) {
|
|
|
5369
5382
|
}
|
|
5370
5383
|
|
|
5371
5384
|
// lib/components.tsx
|
|
5372
|
-
var ENABLE_DEV_WARNINGS2 = true;
|
|
5373
5385
|
function mapRouteProperties(route) {
|
|
5374
5386
|
let updates = {
|
|
5375
5387
|
// Note: this check also occurs in createRoutesFromChildren so update
|
|
@@ -5377,7 +5389,7 @@ function mapRouteProperties(route) {
|
|
|
5377
5389
|
hasErrorBoundary: route.hasErrorBoundary || route.ErrorBoundary != null || route.errorElement != null
|
|
5378
5390
|
};
|
|
5379
5391
|
if (route.Component) {
|
|
5380
|
-
if (
|
|
5392
|
+
if (ENABLE_DEV_WARNINGS) {
|
|
5381
5393
|
if (route.element) {
|
|
5382
5394
|
warning(
|
|
5383
5395
|
false,
|
|
@@ -5391,7 +5403,7 @@ function mapRouteProperties(route) {
|
|
|
5391
5403
|
});
|
|
5392
5404
|
}
|
|
5393
5405
|
if (route.HydrateFallback) {
|
|
5394
|
-
if (
|
|
5406
|
+
if (ENABLE_DEV_WARNINGS) {
|
|
5395
5407
|
if (route.hydrateFallbackElement) {
|
|
5396
5408
|
warning(
|
|
5397
5409
|
false,
|
|
@@ -5405,7 +5417,7 @@ function mapRouteProperties(route) {
|
|
|
5405
5417
|
});
|
|
5406
5418
|
}
|
|
5407
5419
|
if (route.ErrorBoundary) {
|
|
5408
|
-
if (
|
|
5420
|
+
if (ENABLE_DEV_WARNINGS) {
|
|
5409
5421
|
if (route.errorElement) {
|
|
5410
5422
|
warning(
|
|
5411
5423
|
false,
|
|
@@ -5490,11 +5502,25 @@ function RouterProvider({
|
|
|
5490
5502
|
viewTransitionOpts == null || isViewTransitionAvailable,
|
|
5491
5503
|
"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."
|
|
5492
5504
|
);
|
|
5505
|
+
const resetTransition = () => {
|
|
5506
|
+
setRenderDfd(void 0);
|
|
5507
|
+
setTransition(void 0);
|
|
5508
|
+
setPendingState(void 0);
|
|
5509
|
+
setVtContext({ isTransitioning: false });
|
|
5510
|
+
};
|
|
5493
5511
|
if (!viewTransitionOpts || !isViewTransitionAvailable) {
|
|
5512
|
+
renderDfd?.resolve();
|
|
5513
|
+
transition?.skipTransition();
|
|
5494
5514
|
if (reactDomFlushSyncImpl && flushSync) {
|
|
5495
|
-
reactDomFlushSyncImpl(() =>
|
|
5515
|
+
reactDomFlushSyncImpl(() => {
|
|
5516
|
+
setStateImpl(newState);
|
|
5517
|
+
resetTransition();
|
|
5518
|
+
});
|
|
5496
5519
|
} else {
|
|
5497
|
-
React3.startTransition(() =>
|
|
5520
|
+
React3.startTransition(() => {
|
|
5521
|
+
setStateImpl(newState);
|
|
5522
|
+
resetTransition();
|
|
5523
|
+
});
|
|
5498
5524
|
}
|
|
5499
5525
|
return;
|
|
5500
5526
|
}
|
|
@@ -5515,12 +5541,7 @@ function RouterProvider({
|
|
|
5515
5541
|
reactDomFlushSyncImpl(() => setStateImpl(newState));
|
|
5516
5542
|
});
|
|
5517
5543
|
t.finished.finally(() => {
|
|
5518
|
-
reactDomFlushSyncImpl(() =>
|
|
5519
|
-
setRenderDfd(void 0);
|
|
5520
|
-
setTransition(void 0);
|
|
5521
|
-
setPendingState(void 0);
|
|
5522
|
-
setVtContext({ isTransitioning: false });
|
|
5523
|
-
});
|
|
5544
|
+
reactDomFlushSyncImpl(() => resetTransition());
|
|
5524
5545
|
});
|
|
5525
5546
|
reactDomFlushSyncImpl(() => setTransition(t));
|
|
5526
5547
|
return;
|
|
@@ -5585,7 +5606,7 @@ function RouterProvider({
|
|
|
5585
5606
|
setInterruption(void 0);
|
|
5586
5607
|
}
|
|
5587
5608
|
}, [vtContext.isTransitioning, interruption]);
|
|
5588
|
-
let
|
|
5609
|
+
let navigator = React3.useMemo(() => {
|
|
5589
5610
|
return {
|
|
5590
5611
|
createHref: router.createHref,
|
|
5591
5612
|
encodeLocation: router.encodeLocation,
|
|
@@ -5605,11 +5626,11 @@ function RouterProvider({
|
|
|
5605
5626
|
let dataRouterContext = React3.useMemo(
|
|
5606
5627
|
() => ({
|
|
5607
5628
|
router,
|
|
5608
|
-
navigator
|
|
5629
|
+
navigator,
|
|
5609
5630
|
static: false,
|
|
5610
5631
|
basename
|
|
5611
5632
|
}),
|
|
5612
|
-
[router,
|
|
5633
|
+
[router, navigator, basename]
|
|
5613
5634
|
);
|
|
5614
5635
|
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(
|
|
5615
5636
|
Router,
|
|
@@ -5617,7 +5638,7 @@ function RouterProvider({
|
|
|
5617
5638
|
basename,
|
|
5618
5639
|
location: state.location,
|
|
5619
5640
|
navigationType: state.historyAction,
|
|
5620
|
-
navigator
|
|
5641
|
+
navigator
|
|
5621
5642
|
},
|
|
5622
5643
|
/* @__PURE__ */ React3.createElement(
|
|
5623
5644
|
MemoizedDataRoutes,
|
|
@@ -5720,7 +5741,7 @@ function Router({
|
|
|
5720
5741
|
children = null,
|
|
5721
5742
|
location: locationProp,
|
|
5722
5743
|
navigationType = "POP" /* Pop */,
|
|
5723
|
-
navigator
|
|
5744
|
+
navigator,
|
|
5724
5745
|
static: staticProp = false
|
|
5725
5746
|
}) {
|
|
5726
5747
|
invariant(
|
|
@@ -5731,11 +5752,11 @@ function Router({
|
|
|
5731
5752
|
let navigationContext = React3.useMemo(
|
|
5732
5753
|
() => ({
|
|
5733
5754
|
basename,
|
|
5734
|
-
navigator
|
|
5755
|
+
navigator,
|
|
5735
5756
|
static: staticProp,
|
|
5736
5757
|
future: {}
|
|
5737
5758
|
}),
|
|
5738
|
-
[basename,
|
|
5759
|
+
[basename, navigator, staticProp]
|
|
5739
5760
|
);
|
|
5740
5761
|
if (typeof locationProp === "string") {
|
|
5741
5762
|
locationProp = parsePath(locationProp);
|
|
@@ -6293,7 +6314,669 @@ function createHtml(html) {
|
|
|
6293
6314
|
|
|
6294
6315
|
// lib/dom/ssr/single-fetch.tsx
|
|
6295
6316
|
import * as React4 from "react";
|
|
6296
|
-
|
|
6317
|
+
|
|
6318
|
+
// vendor/turbo-stream-v2/utils.ts
|
|
6319
|
+
var HOLE = -1;
|
|
6320
|
+
var NAN = -2;
|
|
6321
|
+
var NEGATIVE_INFINITY = -3;
|
|
6322
|
+
var NEGATIVE_ZERO = -4;
|
|
6323
|
+
var NULL = -5;
|
|
6324
|
+
var POSITIVE_INFINITY = -6;
|
|
6325
|
+
var UNDEFINED = -7;
|
|
6326
|
+
var TYPE_BIGINT = "B";
|
|
6327
|
+
var TYPE_DATE = "D";
|
|
6328
|
+
var TYPE_ERROR = "E";
|
|
6329
|
+
var TYPE_MAP = "M";
|
|
6330
|
+
var TYPE_NULL_OBJECT = "N";
|
|
6331
|
+
var TYPE_PROMISE = "P";
|
|
6332
|
+
var TYPE_REGEXP = "R";
|
|
6333
|
+
var TYPE_SET = "S";
|
|
6334
|
+
var TYPE_SYMBOL = "Y";
|
|
6335
|
+
var TYPE_URL = "U";
|
|
6336
|
+
var TYPE_PREVIOUS_RESOLVED = "Z";
|
|
6337
|
+
var Deferred2 = class {
|
|
6338
|
+
constructor() {
|
|
6339
|
+
this.promise = new Promise((resolve, reject) => {
|
|
6340
|
+
this.resolve = resolve;
|
|
6341
|
+
this.reject = reject;
|
|
6342
|
+
});
|
|
6343
|
+
}
|
|
6344
|
+
};
|
|
6345
|
+
function createLineSplittingTransform() {
|
|
6346
|
+
const decoder = new TextDecoder();
|
|
6347
|
+
let leftover = "";
|
|
6348
|
+
return new TransformStream({
|
|
6349
|
+
transform(chunk, controller) {
|
|
6350
|
+
const str = decoder.decode(chunk, { stream: true });
|
|
6351
|
+
const parts = (leftover + str).split("\n");
|
|
6352
|
+
leftover = parts.pop() || "";
|
|
6353
|
+
for (const part of parts) {
|
|
6354
|
+
controller.enqueue(part);
|
|
6355
|
+
}
|
|
6356
|
+
},
|
|
6357
|
+
flush(controller) {
|
|
6358
|
+
if (leftover) {
|
|
6359
|
+
controller.enqueue(leftover);
|
|
6360
|
+
}
|
|
6361
|
+
}
|
|
6362
|
+
});
|
|
6363
|
+
}
|
|
6364
|
+
|
|
6365
|
+
// vendor/turbo-stream-v2/flatten.ts
|
|
6366
|
+
function flatten(input) {
|
|
6367
|
+
const { indices } = this;
|
|
6368
|
+
const existing = indices.get(input);
|
|
6369
|
+
if (existing) return [existing];
|
|
6370
|
+
if (input === void 0) return UNDEFINED;
|
|
6371
|
+
if (input === null) return NULL;
|
|
6372
|
+
if (Number.isNaN(input)) return NAN;
|
|
6373
|
+
if (input === Number.POSITIVE_INFINITY) return POSITIVE_INFINITY;
|
|
6374
|
+
if (input === Number.NEGATIVE_INFINITY) return NEGATIVE_INFINITY;
|
|
6375
|
+
if (input === 0 && 1 / input < 0) return NEGATIVE_ZERO;
|
|
6376
|
+
const index = this.index++;
|
|
6377
|
+
indices.set(input, index);
|
|
6378
|
+
stringify.call(this, input, index);
|
|
6379
|
+
return index;
|
|
6380
|
+
}
|
|
6381
|
+
function stringify(input, index) {
|
|
6382
|
+
const { deferred, plugins, postPlugins } = this;
|
|
6383
|
+
const str = this.stringified;
|
|
6384
|
+
const stack = [[input, index]];
|
|
6385
|
+
while (stack.length > 0) {
|
|
6386
|
+
const [input2, index2] = stack.pop();
|
|
6387
|
+
const partsForObj = (obj) => Object.keys(obj).map((k) => `"_${flatten.call(this, k)}":${flatten.call(this, obj[k])}`).join(",");
|
|
6388
|
+
let error = null;
|
|
6389
|
+
switch (typeof input2) {
|
|
6390
|
+
case "boolean":
|
|
6391
|
+
case "number":
|
|
6392
|
+
case "string":
|
|
6393
|
+
str[index2] = JSON.stringify(input2);
|
|
6394
|
+
break;
|
|
6395
|
+
case "bigint":
|
|
6396
|
+
str[index2] = `["${TYPE_BIGINT}","${input2}"]`;
|
|
6397
|
+
break;
|
|
6398
|
+
case "symbol": {
|
|
6399
|
+
const keyFor = Symbol.keyFor(input2);
|
|
6400
|
+
if (!keyFor) {
|
|
6401
|
+
error = new Error(
|
|
6402
|
+
"Cannot encode symbol unless created with Symbol.for()"
|
|
6403
|
+
);
|
|
6404
|
+
} else {
|
|
6405
|
+
str[index2] = `["${TYPE_SYMBOL}",${JSON.stringify(keyFor)}]`;
|
|
6406
|
+
}
|
|
6407
|
+
break;
|
|
6408
|
+
}
|
|
6409
|
+
case "object": {
|
|
6410
|
+
if (!input2) {
|
|
6411
|
+
str[index2] = `${NULL}`;
|
|
6412
|
+
break;
|
|
6413
|
+
}
|
|
6414
|
+
const isArray = Array.isArray(input2);
|
|
6415
|
+
let pluginHandled = false;
|
|
6416
|
+
if (!isArray && plugins) {
|
|
6417
|
+
for (const plugin of plugins) {
|
|
6418
|
+
const pluginResult = plugin(input2);
|
|
6419
|
+
if (Array.isArray(pluginResult)) {
|
|
6420
|
+
pluginHandled = true;
|
|
6421
|
+
const [pluginIdentifier, ...rest] = pluginResult;
|
|
6422
|
+
str[index2] = `[${JSON.stringify(pluginIdentifier)}`;
|
|
6423
|
+
if (rest.length > 0) {
|
|
6424
|
+
str[index2] += `,${rest.map((v) => flatten.call(this, v)).join(",")}`;
|
|
6425
|
+
}
|
|
6426
|
+
str[index2] += "]";
|
|
6427
|
+
break;
|
|
6428
|
+
}
|
|
6429
|
+
}
|
|
6430
|
+
}
|
|
6431
|
+
if (!pluginHandled) {
|
|
6432
|
+
let result = isArray ? "[" : "{";
|
|
6433
|
+
if (isArray) {
|
|
6434
|
+
for (let i = 0; i < input2.length; i++)
|
|
6435
|
+
result += (i ? "," : "") + (i in input2 ? flatten.call(this, input2[i]) : HOLE);
|
|
6436
|
+
str[index2] = `${result}]`;
|
|
6437
|
+
} else if (input2 instanceof Date) {
|
|
6438
|
+
str[index2] = `["${TYPE_DATE}",${input2.getTime()}]`;
|
|
6439
|
+
} else if (input2 instanceof URL) {
|
|
6440
|
+
str[index2] = `["${TYPE_URL}",${JSON.stringify(input2.href)}]`;
|
|
6441
|
+
} else if (input2 instanceof RegExp) {
|
|
6442
|
+
str[index2] = `["${TYPE_REGEXP}",${JSON.stringify(
|
|
6443
|
+
input2.source
|
|
6444
|
+
)},${JSON.stringify(input2.flags)}]`;
|
|
6445
|
+
} else if (input2 instanceof Set) {
|
|
6446
|
+
if (input2.size > 0) {
|
|
6447
|
+
str[index2] = `["${TYPE_SET}",${[...input2].map((val) => flatten.call(this, val)).join(",")}]`;
|
|
6448
|
+
} else {
|
|
6449
|
+
str[index2] = `["${TYPE_SET}"]`;
|
|
6450
|
+
}
|
|
6451
|
+
} else if (input2 instanceof Map) {
|
|
6452
|
+
if (input2.size > 0) {
|
|
6453
|
+
str[index2] = `["${TYPE_MAP}",${[...input2].flatMap(([k, v]) => [
|
|
6454
|
+
flatten.call(this, k),
|
|
6455
|
+
flatten.call(this, v)
|
|
6456
|
+
]).join(",")}]`;
|
|
6457
|
+
} else {
|
|
6458
|
+
str[index2] = `["${TYPE_MAP}"]`;
|
|
6459
|
+
}
|
|
6460
|
+
} else if (input2 instanceof Promise) {
|
|
6461
|
+
str[index2] = `["${TYPE_PROMISE}",${index2}]`;
|
|
6462
|
+
deferred[index2] = input2;
|
|
6463
|
+
} else if (input2 instanceof Error) {
|
|
6464
|
+
str[index2] = `["${TYPE_ERROR}",${JSON.stringify(input2.message)}`;
|
|
6465
|
+
if (input2.name !== "Error") {
|
|
6466
|
+
str[index2] += `,${JSON.stringify(input2.name)}`;
|
|
6467
|
+
}
|
|
6468
|
+
str[index2] += "]";
|
|
6469
|
+
} else if (Object.getPrototypeOf(input2) === null) {
|
|
6470
|
+
str[index2] = `["${TYPE_NULL_OBJECT}",{${partsForObj(input2)}}]`;
|
|
6471
|
+
} else if (isPlainObject(input2)) {
|
|
6472
|
+
str[index2] = `{${partsForObj(input2)}}`;
|
|
6473
|
+
} else {
|
|
6474
|
+
error = new Error("Cannot encode object with prototype");
|
|
6475
|
+
}
|
|
6476
|
+
}
|
|
6477
|
+
break;
|
|
6478
|
+
}
|
|
6479
|
+
default: {
|
|
6480
|
+
const isArray = Array.isArray(input2);
|
|
6481
|
+
let pluginHandled = false;
|
|
6482
|
+
if (!isArray && plugins) {
|
|
6483
|
+
for (const plugin of plugins) {
|
|
6484
|
+
const pluginResult = plugin(input2);
|
|
6485
|
+
if (Array.isArray(pluginResult)) {
|
|
6486
|
+
pluginHandled = true;
|
|
6487
|
+
const [pluginIdentifier, ...rest] = pluginResult;
|
|
6488
|
+
str[index2] = `[${JSON.stringify(pluginIdentifier)}`;
|
|
6489
|
+
if (rest.length > 0) {
|
|
6490
|
+
str[index2] += `,${rest.map((v) => flatten.call(this, v)).join(",")}`;
|
|
6491
|
+
}
|
|
6492
|
+
str[index2] += "]";
|
|
6493
|
+
break;
|
|
6494
|
+
}
|
|
6495
|
+
}
|
|
6496
|
+
}
|
|
6497
|
+
if (!pluginHandled) {
|
|
6498
|
+
error = new Error("Cannot encode function or unexpected type");
|
|
6499
|
+
}
|
|
6500
|
+
}
|
|
6501
|
+
}
|
|
6502
|
+
if (error) {
|
|
6503
|
+
let pluginHandled = false;
|
|
6504
|
+
if (postPlugins) {
|
|
6505
|
+
for (const plugin of postPlugins) {
|
|
6506
|
+
const pluginResult = plugin(input2);
|
|
6507
|
+
if (Array.isArray(pluginResult)) {
|
|
6508
|
+
pluginHandled = true;
|
|
6509
|
+
const [pluginIdentifier, ...rest] = pluginResult;
|
|
6510
|
+
str[index2] = `[${JSON.stringify(pluginIdentifier)}`;
|
|
6511
|
+
if (rest.length > 0) {
|
|
6512
|
+
str[index2] += `,${rest.map((v) => flatten.call(this, v)).join(",")}`;
|
|
6513
|
+
}
|
|
6514
|
+
str[index2] += "]";
|
|
6515
|
+
break;
|
|
6516
|
+
}
|
|
6517
|
+
}
|
|
6518
|
+
}
|
|
6519
|
+
if (!pluginHandled) {
|
|
6520
|
+
throw error;
|
|
6521
|
+
}
|
|
6522
|
+
}
|
|
6523
|
+
}
|
|
6524
|
+
}
|
|
6525
|
+
var objectProtoNames = Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
|
|
6526
|
+
function isPlainObject(thing) {
|
|
6527
|
+
const proto = Object.getPrototypeOf(thing);
|
|
6528
|
+
return proto === Object.prototype || proto === null || Object.getOwnPropertyNames(proto).sort().join("\0") === objectProtoNames;
|
|
6529
|
+
}
|
|
6530
|
+
|
|
6531
|
+
// vendor/turbo-stream-v2/unflatten.ts
|
|
6532
|
+
var globalObj = typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : void 0;
|
|
6533
|
+
function unflatten(parsed) {
|
|
6534
|
+
const { hydrated, values } = this;
|
|
6535
|
+
if (typeof parsed === "number") return hydrate.call(this, parsed);
|
|
6536
|
+
if (!Array.isArray(parsed) || !parsed.length) throw new SyntaxError();
|
|
6537
|
+
const startIndex = values.length;
|
|
6538
|
+
for (const value of parsed) {
|
|
6539
|
+
values.push(value);
|
|
6540
|
+
}
|
|
6541
|
+
hydrated.length = values.length;
|
|
6542
|
+
return hydrate.call(this, startIndex);
|
|
6543
|
+
}
|
|
6544
|
+
function hydrate(index) {
|
|
6545
|
+
const { hydrated, values, deferred, plugins } = this;
|
|
6546
|
+
let result;
|
|
6547
|
+
const stack = [
|
|
6548
|
+
[
|
|
6549
|
+
index,
|
|
6550
|
+
(v) => {
|
|
6551
|
+
result = v;
|
|
6552
|
+
}
|
|
6553
|
+
]
|
|
6554
|
+
];
|
|
6555
|
+
let postRun = [];
|
|
6556
|
+
while (stack.length > 0) {
|
|
6557
|
+
const [index2, set] = stack.pop();
|
|
6558
|
+
switch (index2) {
|
|
6559
|
+
case UNDEFINED:
|
|
6560
|
+
set(void 0);
|
|
6561
|
+
continue;
|
|
6562
|
+
case NULL:
|
|
6563
|
+
set(null);
|
|
6564
|
+
continue;
|
|
6565
|
+
case NAN:
|
|
6566
|
+
set(NaN);
|
|
6567
|
+
continue;
|
|
6568
|
+
case POSITIVE_INFINITY:
|
|
6569
|
+
set(Infinity);
|
|
6570
|
+
continue;
|
|
6571
|
+
case NEGATIVE_INFINITY:
|
|
6572
|
+
set(-Infinity);
|
|
6573
|
+
continue;
|
|
6574
|
+
case NEGATIVE_ZERO:
|
|
6575
|
+
set(-0);
|
|
6576
|
+
continue;
|
|
6577
|
+
}
|
|
6578
|
+
if (hydrated[index2]) {
|
|
6579
|
+
set(hydrated[index2]);
|
|
6580
|
+
continue;
|
|
6581
|
+
}
|
|
6582
|
+
const value = values[index2];
|
|
6583
|
+
if (!value || typeof value !== "object") {
|
|
6584
|
+
hydrated[index2] = value;
|
|
6585
|
+
set(value);
|
|
6586
|
+
continue;
|
|
6587
|
+
}
|
|
6588
|
+
if (Array.isArray(value)) {
|
|
6589
|
+
if (typeof value[0] === "string") {
|
|
6590
|
+
const [type, b, c] = value;
|
|
6591
|
+
switch (type) {
|
|
6592
|
+
case TYPE_DATE:
|
|
6593
|
+
set(hydrated[index2] = new Date(b));
|
|
6594
|
+
continue;
|
|
6595
|
+
case TYPE_URL:
|
|
6596
|
+
set(hydrated[index2] = new URL(b));
|
|
6597
|
+
continue;
|
|
6598
|
+
case TYPE_BIGINT:
|
|
6599
|
+
set(hydrated[index2] = BigInt(b));
|
|
6600
|
+
continue;
|
|
6601
|
+
case TYPE_REGEXP:
|
|
6602
|
+
set(hydrated[index2] = new RegExp(b, c));
|
|
6603
|
+
continue;
|
|
6604
|
+
case TYPE_SYMBOL:
|
|
6605
|
+
set(hydrated[index2] = Symbol.for(b));
|
|
6606
|
+
continue;
|
|
6607
|
+
case TYPE_SET:
|
|
6608
|
+
const newSet = /* @__PURE__ */ new Set();
|
|
6609
|
+
hydrated[index2] = newSet;
|
|
6610
|
+
for (let i = value.length - 1; i > 0; i--)
|
|
6611
|
+
stack.push([
|
|
6612
|
+
value[i],
|
|
6613
|
+
(v) => {
|
|
6614
|
+
newSet.add(v);
|
|
6615
|
+
}
|
|
6616
|
+
]);
|
|
6617
|
+
set(newSet);
|
|
6618
|
+
continue;
|
|
6619
|
+
case TYPE_MAP:
|
|
6620
|
+
const map = /* @__PURE__ */ new Map();
|
|
6621
|
+
hydrated[index2] = map;
|
|
6622
|
+
for (let i = value.length - 2; i > 0; i -= 2) {
|
|
6623
|
+
const r = [];
|
|
6624
|
+
stack.push([
|
|
6625
|
+
value[i + 1],
|
|
6626
|
+
(v) => {
|
|
6627
|
+
r[1] = v;
|
|
6628
|
+
}
|
|
6629
|
+
]);
|
|
6630
|
+
stack.push([
|
|
6631
|
+
value[i],
|
|
6632
|
+
(k) => {
|
|
6633
|
+
r[0] = k;
|
|
6634
|
+
}
|
|
6635
|
+
]);
|
|
6636
|
+
postRun.push(() => {
|
|
6637
|
+
map.set(r[0], r[1]);
|
|
6638
|
+
});
|
|
6639
|
+
}
|
|
6640
|
+
set(map);
|
|
6641
|
+
continue;
|
|
6642
|
+
case TYPE_NULL_OBJECT:
|
|
6643
|
+
const obj = /* @__PURE__ */ Object.create(null);
|
|
6644
|
+
hydrated[index2] = obj;
|
|
6645
|
+
for (const key of Object.keys(b).reverse()) {
|
|
6646
|
+
const r = [];
|
|
6647
|
+
stack.push([
|
|
6648
|
+
b[key],
|
|
6649
|
+
(v) => {
|
|
6650
|
+
r[1] = v;
|
|
6651
|
+
}
|
|
6652
|
+
]);
|
|
6653
|
+
stack.push([
|
|
6654
|
+
Number(key.slice(1)),
|
|
6655
|
+
(k) => {
|
|
6656
|
+
r[0] = k;
|
|
6657
|
+
}
|
|
6658
|
+
]);
|
|
6659
|
+
postRun.push(() => {
|
|
6660
|
+
obj[r[0]] = r[1];
|
|
6661
|
+
});
|
|
6662
|
+
}
|
|
6663
|
+
set(obj);
|
|
6664
|
+
continue;
|
|
6665
|
+
case TYPE_PROMISE:
|
|
6666
|
+
if (hydrated[b]) {
|
|
6667
|
+
set(hydrated[index2] = hydrated[b]);
|
|
6668
|
+
} else {
|
|
6669
|
+
const d = new Deferred2();
|
|
6670
|
+
deferred[b] = d;
|
|
6671
|
+
set(hydrated[index2] = d.promise);
|
|
6672
|
+
}
|
|
6673
|
+
continue;
|
|
6674
|
+
case TYPE_ERROR:
|
|
6675
|
+
const [, message, errorType] = value;
|
|
6676
|
+
let error = errorType && globalObj && globalObj[errorType] ? new globalObj[errorType](message) : new Error(message);
|
|
6677
|
+
hydrated[index2] = error;
|
|
6678
|
+
set(error);
|
|
6679
|
+
continue;
|
|
6680
|
+
case TYPE_PREVIOUS_RESOLVED:
|
|
6681
|
+
set(hydrated[index2] = hydrated[b]);
|
|
6682
|
+
continue;
|
|
6683
|
+
default:
|
|
6684
|
+
if (Array.isArray(plugins)) {
|
|
6685
|
+
const r = [];
|
|
6686
|
+
const vals = value.slice(1);
|
|
6687
|
+
for (let i = 0; i < vals.length; i++) {
|
|
6688
|
+
const v = vals[i];
|
|
6689
|
+
stack.push([
|
|
6690
|
+
v,
|
|
6691
|
+
(v2) => {
|
|
6692
|
+
r[i] = v2;
|
|
6693
|
+
}
|
|
6694
|
+
]);
|
|
6695
|
+
}
|
|
6696
|
+
postRun.push(() => {
|
|
6697
|
+
for (const plugin of plugins) {
|
|
6698
|
+
const result2 = plugin(value[0], ...r);
|
|
6699
|
+
if (result2) {
|
|
6700
|
+
set(hydrated[index2] = result2.value);
|
|
6701
|
+
return;
|
|
6702
|
+
}
|
|
6703
|
+
}
|
|
6704
|
+
throw new SyntaxError();
|
|
6705
|
+
});
|
|
6706
|
+
continue;
|
|
6707
|
+
}
|
|
6708
|
+
throw new SyntaxError();
|
|
6709
|
+
}
|
|
6710
|
+
} else {
|
|
6711
|
+
const array = [];
|
|
6712
|
+
hydrated[index2] = array;
|
|
6713
|
+
for (let i = 0; i < value.length; i++) {
|
|
6714
|
+
const n = value[i];
|
|
6715
|
+
if (n !== HOLE) {
|
|
6716
|
+
stack.push([
|
|
6717
|
+
n,
|
|
6718
|
+
(v) => {
|
|
6719
|
+
array[i] = v;
|
|
6720
|
+
}
|
|
6721
|
+
]);
|
|
6722
|
+
}
|
|
6723
|
+
}
|
|
6724
|
+
set(array);
|
|
6725
|
+
continue;
|
|
6726
|
+
}
|
|
6727
|
+
} else {
|
|
6728
|
+
const object = {};
|
|
6729
|
+
hydrated[index2] = object;
|
|
6730
|
+
for (const key of Object.keys(value).reverse()) {
|
|
6731
|
+
const r = [];
|
|
6732
|
+
stack.push([
|
|
6733
|
+
value[key],
|
|
6734
|
+
(v) => {
|
|
6735
|
+
r[1] = v;
|
|
6736
|
+
}
|
|
6737
|
+
]);
|
|
6738
|
+
stack.push([
|
|
6739
|
+
Number(key.slice(1)),
|
|
6740
|
+
(k) => {
|
|
6741
|
+
r[0] = k;
|
|
6742
|
+
}
|
|
6743
|
+
]);
|
|
6744
|
+
postRun.push(() => {
|
|
6745
|
+
object[r[0]] = r[1];
|
|
6746
|
+
});
|
|
6747
|
+
}
|
|
6748
|
+
set(object);
|
|
6749
|
+
continue;
|
|
6750
|
+
}
|
|
6751
|
+
}
|
|
6752
|
+
while (postRun.length > 0) {
|
|
6753
|
+
postRun.pop()();
|
|
6754
|
+
}
|
|
6755
|
+
return result;
|
|
6756
|
+
}
|
|
6757
|
+
|
|
6758
|
+
// vendor/turbo-stream-v2/turbo-stream.ts
|
|
6759
|
+
async function decode(readable, options) {
|
|
6760
|
+
const { plugins } = options ?? {};
|
|
6761
|
+
const done = new Deferred2();
|
|
6762
|
+
const reader = readable.pipeThrough(createLineSplittingTransform()).getReader();
|
|
6763
|
+
const decoder = {
|
|
6764
|
+
values: [],
|
|
6765
|
+
hydrated: [],
|
|
6766
|
+
deferred: {},
|
|
6767
|
+
plugins
|
|
6768
|
+
};
|
|
6769
|
+
const decoded = await decodeInitial.call(decoder, reader);
|
|
6770
|
+
let donePromise = done.promise;
|
|
6771
|
+
if (decoded.done) {
|
|
6772
|
+
done.resolve();
|
|
6773
|
+
} else {
|
|
6774
|
+
donePromise = decodeDeferred.call(decoder, reader).then(done.resolve).catch((reason) => {
|
|
6775
|
+
for (const deferred of Object.values(decoder.deferred)) {
|
|
6776
|
+
deferred.reject(reason);
|
|
6777
|
+
}
|
|
6778
|
+
done.reject(reason);
|
|
6779
|
+
});
|
|
6780
|
+
}
|
|
6781
|
+
return {
|
|
6782
|
+
done: donePromise.then(() => reader.closed),
|
|
6783
|
+
value: decoded.value
|
|
6784
|
+
};
|
|
6785
|
+
}
|
|
6786
|
+
async function decodeInitial(reader) {
|
|
6787
|
+
const read = await reader.read();
|
|
6788
|
+
if (!read.value) {
|
|
6789
|
+
throw new SyntaxError();
|
|
6790
|
+
}
|
|
6791
|
+
let line;
|
|
6792
|
+
try {
|
|
6793
|
+
line = JSON.parse(read.value);
|
|
6794
|
+
} catch (reason) {
|
|
6795
|
+
throw new SyntaxError();
|
|
6796
|
+
}
|
|
6797
|
+
return {
|
|
6798
|
+
done: read.done,
|
|
6799
|
+
value: unflatten.call(this, line)
|
|
6800
|
+
};
|
|
6801
|
+
}
|
|
6802
|
+
async function decodeDeferred(reader) {
|
|
6803
|
+
let read = await reader.read();
|
|
6804
|
+
while (!read.done) {
|
|
6805
|
+
if (!read.value) continue;
|
|
6806
|
+
const line = read.value;
|
|
6807
|
+
switch (line[0]) {
|
|
6808
|
+
case TYPE_PROMISE: {
|
|
6809
|
+
const colonIndex = line.indexOf(":");
|
|
6810
|
+
const deferredId = Number(line.slice(1, colonIndex));
|
|
6811
|
+
const deferred = this.deferred[deferredId];
|
|
6812
|
+
if (!deferred) {
|
|
6813
|
+
throw new Error(`Deferred ID ${deferredId} not found in stream`);
|
|
6814
|
+
}
|
|
6815
|
+
const lineData = line.slice(colonIndex + 1);
|
|
6816
|
+
let jsonLine;
|
|
6817
|
+
try {
|
|
6818
|
+
jsonLine = JSON.parse(lineData);
|
|
6819
|
+
} catch (reason) {
|
|
6820
|
+
throw new SyntaxError();
|
|
6821
|
+
}
|
|
6822
|
+
const value = unflatten.call(this, jsonLine);
|
|
6823
|
+
deferred.resolve(value);
|
|
6824
|
+
break;
|
|
6825
|
+
}
|
|
6826
|
+
case TYPE_ERROR: {
|
|
6827
|
+
const colonIndex = line.indexOf(":");
|
|
6828
|
+
const deferredId = Number(line.slice(1, colonIndex));
|
|
6829
|
+
const deferred = this.deferred[deferredId];
|
|
6830
|
+
if (!deferred) {
|
|
6831
|
+
throw new Error(`Deferred ID ${deferredId} not found in stream`);
|
|
6832
|
+
}
|
|
6833
|
+
const lineData = line.slice(colonIndex + 1);
|
|
6834
|
+
let jsonLine;
|
|
6835
|
+
try {
|
|
6836
|
+
jsonLine = JSON.parse(lineData);
|
|
6837
|
+
} catch (reason) {
|
|
6838
|
+
throw new SyntaxError();
|
|
6839
|
+
}
|
|
6840
|
+
const value = unflatten.call(this, jsonLine);
|
|
6841
|
+
deferred.reject(value);
|
|
6842
|
+
break;
|
|
6843
|
+
}
|
|
6844
|
+
default:
|
|
6845
|
+
throw new SyntaxError();
|
|
6846
|
+
}
|
|
6847
|
+
read = await reader.read();
|
|
6848
|
+
}
|
|
6849
|
+
}
|
|
6850
|
+
function encode(input, options) {
|
|
6851
|
+
const { plugins, postPlugins, signal } = options ?? {};
|
|
6852
|
+
const encoder2 = {
|
|
6853
|
+
deferred: {},
|
|
6854
|
+
index: 0,
|
|
6855
|
+
indices: /* @__PURE__ */ new Map(),
|
|
6856
|
+
stringified: [],
|
|
6857
|
+
plugins,
|
|
6858
|
+
postPlugins,
|
|
6859
|
+
signal
|
|
6860
|
+
};
|
|
6861
|
+
const textEncoder = new TextEncoder();
|
|
6862
|
+
let lastSentIndex = 0;
|
|
6863
|
+
const readable = new ReadableStream({
|
|
6864
|
+
async start(controller) {
|
|
6865
|
+
const id = flatten.call(encoder2, input);
|
|
6866
|
+
if (Array.isArray(id)) {
|
|
6867
|
+
throw new Error("This should never happen");
|
|
6868
|
+
}
|
|
6869
|
+
if (id < 0) {
|
|
6870
|
+
controller.enqueue(textEncoder.encode(`${id}
|
|
6871
|
+
`));
|
|
6872
|
+
} else {
|
|
6873
|
+
controller.enqueue(
|
|
6874
|
+
textEncoder.encode(`[${encoder2.stringified.join(",")}]
|
|
6875
|
+
`)
|
|
6876
|
+
);
|
|
6877
|
+
lastSentIndex = encoder2.stringified.length - 1;
|
|
6878
|
+
}
|
|
6879
|
+
const seenPromises = /* @__PURE__ */ new WeakSet();
|
|
6880
|
+
if (Object.keys(encoder2.deferred).length) {
|
|
6881
|
+
let raceDone;
|
|
6882
|
+
const racePromise = new Promise((resolve, reject) => {
|
|
6883
|
+
raceDone = resolve;
|
|
6884
|
+
if (signal) {
|
|
6885
|
+
const rejectPromise = () => reject(signal.reason || new Error("Signal was aborted."));
|
|
6886
|
+
if (signal.aborted) {
|
|
6887
|
+
rejectPromise();
|
|
6888
|
+
} else {
|
|
6889
|
+
signal.addEventListener("abort", (event) => {
|
|
6890
|
+
rejectPromise();
|
|
6891
|
+
});
|
|
6892
|
+
}
|
|
6893
|
+
}
|
|
6894
|
+
});
|
|
6895
|
+
while (Object.keys(encoder2.deferred).length > 0) {
|
|
6896
|
+
for (const [deferredId, deferred] of Object.entries(
|
|
6897
|
+
encoder2.deferred
|
|
6898
|
+
)) {
|
|
6899
|
+
if (seenPromises.has(deferred)) continue;
|
|
6900
|
+
seenPromises.add(
|
|
6901
|
+
// biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
|
|
6902
|
+
encoder2.deferred[Number(deferredId)] = Promise.race([
|
|
6903
|
+
racePromise,
|
|
6904
|
+
deferred
|
|
6905
|
+
]).then(
|
|
6906
|
+
(resolved) => {
|
|
6907
|
+
const id2 = flatten.call(encoder2, resolved);
|
|
6908
|
+
if (Array.isArray(id2)) {
|
|
6909
|
+
controller.enqueue(
|
|
6910
|
+
textEncoder.encode(
|
|
6911
|
+
`${TYPE_PROMISE}${deferredId}:[["${TYPE_PREVIOUS_RESOLVED}",${id2[0]}]]
|
|
6912
|
+
`
|
|
6913
|
+
)
|
|
6914
|
+
);
|
|
6915
|
+
encoder2.index++;
|
|
6916
|
+
lastSentIndex++;
|
|
6917
|
+
} else if (id2 < 0) {
|
|
6918
|
+
controller.enqueue(
|
|
6919
|
+
textEncoder.encode(
|
|
6920
|
+
`${TYPE_PROMISE}${deferredId}:${id2}
|
|
6921
|
+
`
|
|
6922
|
+
)
|
|
6923
|
+
);
|
|
6924
|
+
} else {
|
|
6925
|
+
const values = encoder2.stringified.slice(lastSentIndex + 1).join(",");
|
|
6926
|
+
controller.enqueue(
|
|
6927
|
+
textEncoder.encode(
|
|
6928
|
+
`${TYPE_PROMISE}${deferredId}:[${values}]
|
|
6929
|
+
`
|
|
6930
|
+
)
|
|
6931
|
+
);
|
|
6932
|
+
lastSentIndex = encoder2.stringified.length - 1;
|
|
6933
|
+
}
|
|
6934
|
+
},
|
|
6935
|
+
(reason) => {
|
|
6936
|
+
if (!reason || typeof reason !== "object" || !(reason instanceof Error)) {
|
|
6937
|
+
reason = new Error("An unknown error occurred");
|
|
6938
|
+
}
|
|
6939
|
+
const id2 = flatten.call(encoder2, reason);
|
|
6940
|
+
if (Array.isArray(id2)) {
|
|
6941
|
+
controller.enqueue(
|
|
6942
|
+
textEncoder.encode(
|
|
6943
|
+
`${TYPE_ERROR}${deferredId}:[["${TYPE_PREVIOUS_RESOLVED}",${id2[0]}]]
|
|
6944
|
+
`
|
|
6945
|
+
)
|
|
6946
|
+
);
|
|
6947
|
+
encoder2.index++;
|
|
6948
|
+
lastSentIndex++;
|
|
6949
|
+
} else if (id2 < 0) {
|
|
6950
|
+
controller.enqueue(
|
|
6951
|
+
textEncoder.encode(`${TYPE_ERROR}${deferredId}:${id2}
|
|
6952
|
+
`)
|
|
6953
|
+
);
|
|
6954
|
+
} else {
|
|
6955
|
+
const values = encoder2.stringified.slice(lastSentIndex + 1).join(",");
|
|
6956
|
+
controller.enqueue(
|
|
6957
|
+
textEncoder.encode(
|
|
6958
|
+
`${TYPE_ERROR}${deferredId}:[${values}]
|
|
6959
|
+
`
|
|
6960
|
+
)
|
|
6961
|
+
);
|
|
6962
|
+
lastSentIndex = encoder2.stringified.length - 1;
|
|
6963
|
+
}
|
|
6964
|
+
}
|
|
6965
|
+
).finally(() => {
|
|
6966
|
+
delete encoder2.deferred[Number(deferredId)];
|
|
6967
|
+
})
|
|
6968
|
+
);
|
|
6969
|
+
}
|
|
6970
|
+
await Promise.race(Object.values(encoder2.deferred));
|
|
6971
|
+
}
|
|
6972
|
+
raceDone();
|
|
6973
|
+
}
|
|
6974
|
+
await Promise.all(Object.values(encoder2.deferred));
|
|
6975
|
+
controller.close();
|
|
6976
|
+
}
|
|
6977
|
+
});
|
|
6978
|
+
return readable;
|
|
6979
|
+
}
|
|
6297
6980
|
|
|
6298
6981
|
// lib/dom/ssr/data.ts
|
|
6299
6982
|
async function createRequestInit(request) {
|
|
@@ -6446,7 +7129,7 @@ async function singleFetchActionStrategy(args, fetchAndDecode, basename) {
|
|
|
6446
7129
|
});
|
|
6447
7130
|
return result2;
|
|
6448
7131
|
});
|
|
6449
|
-
if (isResponse(result.result) || isRouteErrorResponse(result.result)) {
|
|
7132
|
+
if (isResponse(result.result) || isRouteErrorResponse(result.result) || isDataWithResponseInit(result.result)) {
|
|
6450
7133
|
return { [actionMatch.route.id]: result };
|
|
6451
7134
|
}
|
|
6452
7135
|
return {
|
|
@@ -6787,14 +7470,14 @@ function RemixRootDefaultErrorBoundary({
|
|
|
6787
7470
|
dangerouslySetInnerHTML: {
|
|
6788
7471
|
__html: `
|
|
6789
7472
|
console.log(
|
|
6790
|
-
"\u{1F4BF} Hey developer \u{1F44B}. You can provide a way better UX than this when your app throws errors. Check out https://
|
|
7473
|
+
"\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."
|
|
6791
7474
|
);
|
|
6792
7475
|
`
|
|
6793
7476
|
}
|
|
6794
7477
|
}
|
|
6795
7478
|
);
|
|
6796
7479
|
if (isRouteErrorResponse(error)) {
|
|
6797
|
-
return /* @__PURE__ */ React5.createElement(BoundaryShell, { title: "Unhandled Thrown Response!" }, /* @__PURE__ */ React5.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText), heyDeveloper);
|
|
7480
|
+
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);
|
|
6798
7481
|
}
|
|
6799
7482
|
let errorInstance;
|
|
6800
7483
|
if (error instanceof Error) {
|
|
@@ -6847,7 +7530,7 @@ function BoundaryShell({
|
|
|
6847
7530
|
// lib/dom/ssr/fallback.tsx
|
|
6848
7531
|
import * as React6 from "react";
|
|
6849
7532
|
function RemixRootDefaultHydrateFallback() {
|
|
6850
|
-
return /* @__PURE__ */ React6.createElement(BoundaryShell, { title: "Loading...", renderScripts: true }, /* @__PURE__ */ React6.createElement(
|
|
7533
|
+
return /* @__PURE__ */ React6.createElement(BoundaryShell, { title: "Loading...", renderScripts: true }, ENABLE_DEV_WARNINGS ? /* @__PURE__ */ React6.createElement(
|
|
6851
7534
|
"script",
|
|
6852
7535
|
{
|
|
6853
7536
|
dangerouslySetInnerHTML: {
|
|
@@ -6855,13 +7538,13 @@ function RemixRootDefaultHydrateFallback() {
|
|
|
6855
7538
|
console.log(
|
|
6856
7539
|
"\u{1F4BF} Hey developer \u{1F44B}. You can provide a way better UX than this " +
|
|
6857
7540
|
"when your app is loading JS modules and/or running \`clientLoader\` " +
|
|
6858
|
-
"functions. Check out https://
|
|
7541
|
+
"functions. Check out https://reactrouter.com/start/framework/route-module#hydratefallback " +
|
|
6859
7542
|
"for more information."
|
|
6860
7543
|
);
|
|
6861
7544
|
`
|
|
6862
7545
|
}
|
|
6863
7546
|
}
|
|
6864
|
-
));
|
|
7547
|
+
) : null);
|
|
6865
7548
|
}
|
|
6866
7549
|
|
|
6867
7550
|
// lib/dom/ssr/routes.tsx
|
|
@@ -7326,7 +8009,8 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDi
|
|
|
7326
8009
|
}
|
|
7327
8010
|
function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
|
|
7328
8011
|
React8.useEffect(() => {
|
|
7329
|
-
if (!isFogOfWarEnabled(routeDiscovery, ssr) ||
|
|
8012
|
+
if (!isFogOfWarEnabled(routeDiscovery, ssr) || // @ts-expect-error - TS doesn't know about this yet
|
|
8013
|
+
window.navigator?.connection?.saveData === true) {
|
|
7330
8014
|
return;
|
|
7331
8015
|
}
|
|
7332
8016
|
function registerElement(el) {
|
|
@@ -7965,7 +8649,7 @@ function mergeRefs(...refs) {
|
|
|
7965
8649
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
7966
8650
|
try {
|
|
7967
8651
|
if (isBrowser) {
|
|
7968
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
8652
|
+
window.__reactRouterVersion = "0.0.0-experimental-aecfb0db1";
|
|
7969
8653
|
}
|
|
7970
8654
|
} catch (e) {
|
|
7971
8655
|
}
|
|
@@ -8225,11 +8909,11 @@ var NavLink = React10.forwardRef(
|
|
|
8225
8909
|
let path = useResolvedPath(to, { relative: rest.relative });
|
|
8226
8910
|
let location = useLocation();
|
|
8227
8911
|
let routerState = React10.useContext(DataRouterStateContext);
|
|
8228
|
-
let { navigator
|
|
8912
|
+
let { navigator, basename } = React10.useContext(NavigationContext);
|
|
8229
8913
|
let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
|
|
8230
8914
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
8231
8915
|
useViewTransitionState(path) && viewTransition === true;
|
|
8232
|
-
let toPathname =
|
|
8916
|
+
let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;
|
|
8233
8917
|
let locationPathname = location.pathname;
|
|
8234
8918
|
let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
|
|
8235
8919
|
if (!caseSensitive) {
|
|
@@ -8806,7 +9490,7 @@ function StaticRouter({
|
|
|
8806
9490
|
function StaticRouterProvider({
|
|
8807
9491
|
context,
|
|
8808
9492
|
router,
|
|
8809
|
-
hydrate = true,
|
|
9493
|
+
hydrate: hydrate2 = true,
|
|
8810
9494
|
nonce
|
|
8811
9495
|
}) {
|
|
8812
9496
|
invariant(
|
|
@@ -8822,7 +9506,7 @@ function StaticRouterProvider({
|
|
|
8822
9506
|
};
|
|
8823
9507
|
let fetchersContext = /* @__PURE__ */ new Map();
|
|
8824
9508
|
let hydrateScript = "";
|
|
8825
|
-
if (
|
|
9509
|
+
if (hydrate2 !== false) {
|
|
8826
9510
|
let data2 = {
|
|
8827
9511
|
loaderData: context.loaderData,
|
|
8828
9512
|
actionData: context.actionData,
|
|
@@ -9224,7 +9908,7 @@ function processRoutes(routes, manifest, routeModules, parentId) {
|
|
|
9224
9908
|
import { parse, serialize } from "cookie";
|
|
9225
9909
|
|
|
9226
9910
|
// lib/server-runtime/crypto.ts
|
|
9227
|
-
var encoder = new TextEncoder();
|
|
9911
|
+
var encoder = /* @__PURE__ */ new TextEncoder();
|
|
9228
9912
|
var sign = async (value, secret) => {
|
|
9229
9913
|
let data2 = encoder.encode(value);
|
|
9230
9914
|
let key = await createKey2(secret, ["sign"]);
|
|
@@ -9674,9 +10358,6 @@ function createServerHandoffString(serverHandoff) {
|
|
|
9674
10358
|
return escapeHtml2(JSON.stringify(serverHandoff));
|
|
9675
10359
|
}
|
|
9676
10360
|
|
|
9677
|
-
// lib/server-runtime/single-fetch.ts
|
|
9678
|
-
import { encode } from "turbo-stream";
|
|
9679
|
-
|
|
9680
10361
|
// lib/server-runtime/headers.ts
|
|
9681
10362
|
import { splitCookiesString } from "set-cookie-parser";
|
|
9682
10363
|
function getDocumentHeaders(build, context) {
|