react-router 0.0.0-experimental-4303fcb98 → 0.0.0-experimental-ab9ed70c6
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/{browser-DQVA_cmy.d.mts → browser-BPyO7zih.d.mts} +4 -2
- package/dist/development/{chunk-3HEPIEBR.mjs → chunk-44SHGOVW.mjs} +40 -24
- package/dist/development/dom-export.d.mts +1 -1
- package/dist/development/dom-export.js +1 -1
- package/dist/development/dom-export.mjs +2 -2
- package/dist/development/index.d.mts +2 -2
- package/dist/development/index.d.ts +4 -2
- package/dist/development/index.js +40 -24
- package/dist/development/index.mjs +2 -2
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/rsc-export.js +1 -1
- package/dist/development/rsc-export.mjs +1 -1
- package/dist/production/{browser-DQVA_cmy.d.mts → browser-BPyO7zih.d.mts} +4 -2
- package/dist/production/{chunk-EOWVQJO2.mjs → chunk-OMKPJEIF.mjs} +40 -24
- package/dist/production/dom-export.d.mts +1 -1
- package/dist/production/dom-export.js +1 -1
- package/dist/production/dom-export.mjs +2 -2
- package/dist/production/index.d.mts +2 -2
- package/dist/production/index.d.ts +4 -2
- package/dist/production/index.js +40 -24
- package/dist/production/index.mjs +2 -2
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/rsc-export.js +1 -1
- package/dist/production/rsc-export.mjs +1 -1
- package/package.json +1 -1
|
@@ -2196,12 +2196,14 @@ declare global {
|
|
|
2196
2196
|
__routerActionID: number;
|
|
2197
2197
|
}
|
|
2198
2198
|
}
|
|
2199
|
-
declare function createCallServer({ decode, encodeAction, }: {
|
|
2199
|
+
declare function createCallServer({ decode, encodeAction, fetch: fetchImplementation, }: {
|
|
2200
2200
|
decode: DecodeServerResponseFunction;
|
|
2201
2201
|
encodeAction: EncodeActionFunction;
|
|
2202
|
+
fetch?: (request: Request) => Promise<Response>;
|
|
2202
2203
|
}): (id: string, args: unknown[]) => Promise<unknown>;
|
|
2203
|
-
declare function RSCHydratedRouter({ decode, payload, routeDiscovery, }: {
|
|
2204
|
+
declare function RSCHydratedRouter({ decode, fetch: fetchImplementation, payload, routeDiscovery, }: {
|
|
2204
2205
|
decode: DecodeServerResponseFunction;
|
|
2206
|
+
fetch?: (request: Request) => Promise<Response>;
|
|
2205
2207
|
payload: ServerPayload;
|
|
2206
2208
|
routeDiscovery?: "eager" | "lazy";
|
|
2207
2209
|
}): React.JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-ab9ed70c6
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -8804,7 +8804,7 @@ function mergeRefs(...refs) {
|
|
|
8804
8804
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
8805
8805
|
try {
|
|
8806
8806
|
if (isBrowser) {
|
|
8807
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
8807
|
+
window.__reactRouterVersion = "0.0.0-experimental-ab9ed70c6";
|
|
8808
8808
|
}
|
|
8809
8809
|
} catch (e) {
|
|
8810
8810
|
}
|
|
@@ -11621,19 +11621,22 @@ function RSCDefaultRootErrorBoundary({
|
|
|
11621
11621
|
// lib/rsc/browser.tsx
|
|
11622
11622
|
function createCallServer({
|
|
11623
11623
|
decode: decode2,
|
|
11624
|
-
encodeAction
|
|
11624
|
+
encodeAction,
|
|
11625
|
+
fetch: fetchImplementation = fetch
|
|
11625
11626
|
}) {
|
|
11626
11627
|
let landedActionId = 0;
|
|
11627
11628
|
return async (id, args) => {
|
|
11628
11629
|
let actionId = window.__routerActionID = (window.__routerActionID ?? (window.__routerActionID = 0)) + 1;
|
|
11629
|
-
const response = await
|
|
11630
|
-
|
|
11631
|
-
|
|
11632
|
-
|
|
11633
|
-
|
|
11634
|
-
|
|
11635
|
-
|
|
11636
|
-
|
|
11630
|
+
const response = await fetchImplementation(
|
|
11631
|
+
new Request(location.href, {
|
|
11632
|
+
body: await encodeAction(args),
|
|
11633
|
+
method: "POST",
|
|
11634
|
+
headers: {
|
|
11635
|
+
Accept: "text/x-component",
|
|
11636
|
+
"rsc-action-id": id
|
|
11637
|
+
}
|
|
11638
|
+
})
|
|
11639
|
+
);
|
|
11637
11640
|
if (!response.body) {
|
|
11638
11641
|
throw new Error("No response body");
|
|
11639
11642
|
}
|
|
@@ -11708,6 +11711,7 @@ function createCallServer({
|
|
|
11708
11711
|
};
|
|
11709
11712
|
}
|
|
11710
11713
|
function createRouterFromPayload({
|
|
11714
|
+
fetchImplementation,
|
|
11711
11715
|
decode: decode2,
|
|
11712
11716
|
payload
|
|
11713
11717
|
}) {
|
|
@@ -11765,14 +11769,20 @@ function createRouterFromPayload({
|
|
|
11765
11769
|
if (discoveredPaths2.has(path)) {
|
|
11766
11770
|
return;
|
|
11767
11771
|
}
|
|
11768
|
-
await fetchAndApplyManifestPatches2(
|
|
11772
|
+
await fetchAndApplyManifestPatches2(
|
|
11773
|
+
[path],
|
|
11774
|
+
decode2,
|
|
11775
|
+
fetchImplementation,
|
|
11776
|
+
signal
|
|
11777
|
+
);
|
|
11769
11778
|
},
|
|
11770
11779
|
// FIXME: Pass `build.ssr` and `build.basename` into this function
|
|
11771
11780
|
dataStrategy: getRSCSingleFetchDataStrategy(
|
|
11772
11781
|
() => window.__router,
|
|
11773
11782
|
true,
|
|
11774
11783
|
void 0,
|
|
11775
|
-
decode2
|
|
11784
|
+
decode2,
|
|
11785
|
+
fetchImplementation
|
|
11776
11786
|
)
|
|
11777
11787
|
});
|
|
11778
11788
|
if (window.__router.state.initialized) {
|
|
@@ -11790,7 +11800,7 @@ function createRouterFromPayload({
|
|
|
11790
11800
|
return window.__router;
|
|
11791
11801
|
}
|
|
11792
11802
|
var renderedRoutesContext = unstable_createContext();
|
|
11793
|
-
function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, decode2) {
|
|
11803
|
+
function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, decode2, fetchImplementation) {
|
|
11794
11804
|
let dataStrategy = getSingleFetchDataStrategyImpl(
|
|
11795
11805
|
getRouter,
|
|
11796
11806
|
(match) => {
|
|
@@ -11805,7 +11815,7 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, decode2) {
|
|
|
11805
11815
|
};
|
|
11806
11816
|
},
|
|
11807
11817
|
// pass map into fetchAndDecode so it can add payloads
|
|
11808
|
-
getFetchAndDecodeViaRSC(decode2),
|
|
11818
|
+
getFetchAndDecodeViaRSC(decode2, fetchImplementation),
|
|
11809
11819
|
ssr,
|
|
11810
11820
|
basename,
|
|
11811
11821
|
// If the route has a component but we don't have an element, we need to hit
|
|
@@ -11842,7 +11852,7 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, decode2) {
|
|
|
11842
11852
|
return results;
|
|
11843
11853
|
});
|
|
11844
11854
|
}
|
|
11845
|
-
function getFetchAndDecodeViaRSC(decode2) {
|
|
11855
|
+
function getFetchAndDecodeViaRSC(decode2, fetchImplementation) {
|
|
11846
11856
|
return async (args, basename, targetRoutes) => {
|
|
11847
11857
|
let { request, context } = args;
|
|
11848
11858
|
let url = singleFetchUrl(request.url, basename, "rsc");
|
|
@@ -11852,7 +11862,9 @@ function getFetchAndDecodeViaRSC(decode2) {
|
|
|
11852
11862
|
url.searchParams.set("_routes", targetRoutes.join(","));
|
|
11853
11863
|
}
|
|
11854
11864
|
}
|
|
11855
|
-
let res = await
|
|
11865
|
+
let res = await fetchImplementation(
|
|
11866
|
+
new Request(url, await createRequestInit(request))
|
|
11867
|
+
);
|
|
11856
11868
|
if (res.status === 404 && !res.headers.has("X-Remix-Response")) {
|
|
11857
11869
|
throw new ErrorResponseImpl(404, "Not Found", true);
|
|
11858
11870
|
}
|
|
@@ -11895,14 +11907,18 @@ function getFetchAndDecodeViaRSC(decode2) {
|
|
|
11895
11907
|
}
|
|
11896
11908
|
function RSCHydratedRouter({
|
|
11897
11909
|
decode: decode2,
|
|
11910
|
+
fetch: fetchImplementation = fetch,
|
|
11898
11911
|
payload,
|
|
11899
11912
|
routeDiscovery = "eager"
|
|
11900
11913
|
}) {
|
|
11901
11914
|
if (payload.type !== "render") throw new Error("Invalid payload type");
|
|
11902
11915
|
let router = React15.useMemo(
|
|
11903
|
-
() => createRouterFromPayload({
|
|
11904
|
-
|
|
11905
|
-
|
|
11916
|
+
() => createRouterFromPayload({
|
|
11917
|
+
decode: decode2,
|
|
11918
|
+
payload,
|
|
11919
|
+
fetchImplementation
|
|
11920
|
+
}),
|
|
11921
|
+
[decode2, payload, fetchImplementation]
|
|
11906
11922
|
);
|
|
11907
11923
|
React15.useLayoutEffect(() => {
|
|
11908
11924
|
if (!window.__routerInitialized) {
|
|
@@ -11947,7 +11963,7 @@ function RSCHydratedRouter({
|
|
|
11947
11963
|
return;
|
|
11948
11964
|
}
|
|
11949
11965
|
try {
|
|
11950
|
-
await fetchAndApplyManifestPatches2(paths, decode2);
|
|
11966
|
+
await fetchAndApplyManifestPatches2(paths, decode2, fetchImplementation);
|
|
11951
11967
|
} catch (e) {
|
|
11952
11968
|
console.error("Failed to fetch manifest patches", e);
|
|
11953
11969
|
}
|
|
@@ -11961,7 +11977,7 @@ function RSCHydratedRouter({
|
|
|
11961
11977
|
attributes: true,
|
|
11962
11978
|
attributeFilter: ["data-discover", "href", "action"]
|
|
11963
11979
|
});
|
|
11964
|
-
}, [routeDiscovery, decode2]);
|
|
11980
|
+
}, [routeDiscovery, decode2, fetchImplementation]);
|
|
11965
11981
|
const frameworkContext = {
|
|
11966
11982
|
future: {
|
|
11967
11983
|
// These flags have no runtime impact so can always be false. If we add
|
|
@@ -12082,7 +12098,7 @@ var nextPaths2 = /* @__PURE__ */ new Set();
|
|
|
12082
12098
|
var discoveredPathsMaxSize2 = 1e3;
|
|
12083
12099
|
var discoveredPaths2 = /* @__PURE__ */ new Set();
|
|
12084
12100
|
var URL_LIMIT2 = 7680;
|
|
12085
|
-
async function fetchAndApplyManifestPatches2(paths, decode2, signal) {
|
|
12101
|
+
async function fetchAndApplyManifestPatches2(paths, decode2, fetchImplementation, signal) {
|
|
12086
12102
|
let basename = (window.__router.basename ?? "").replace(/^\/|\/$/g, "");
|
|
12087
12103
|
let url = new URL(`${basename}/.manifest`, window.location.origin);
|
|
12088
12104
|
paths.sort().forEach((path) => url.searchParams.append("p", path));
|
|
@@ -12090,7 +12106,7 @@ async function fetchAndApplyManifestPatches2(paths, decode2, signal) {
|
|
|
12090
12106
|
nextPaths2.clear();
|
|
12091
12107
|
return;
|
|
12092
12108
|
}
|
|
12093
|
-
let response = await
|
|
12109
|
+
let response = await fetchImplementation(new Request(url, { signal }));
|
|
12094
12110
|
if (!response.body || response.status < 200 || response.status >= 300) {
|
|
12095
12111
|
throw new Error("Unable to fetch new route matches from the server");
|
|
12096
12112
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterProviderProps$1 } from './browser-
|
|
2
|
+
import { R as RouterProviderProps$1 } from './browser-BPyO7zih.mjs';
|
|
3
3
|
import { R as RouterInit } from './route-data-C8_wxpLo.mjs';
|
|
4
4
|
|
|
5
5
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-ab9ed70c6
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
invariant,
|
|
27
27
|
mapRouteProperties,
|
|
28
28
|
useFogOFWarDiscovery
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-44SHGOVW.mjs";
|
|
30
30
|
|
|
31
31
|
// lib/dom-export/dom-router-provider.tsx
|
|
32
32
|
import * as React from "react";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as Router, b as RouteModules, D as DataStrategyFunction, L as Location, S as StaticHandlerContext, c as RouteObject, C as CreateStaticHandlerOptions$1, d as StaticHandler, F as FutureConfig, I as InitialEntry, H as HydrationState, e as IndexRouteObject, f as LoaderFunction, A as ActionFunction, M as MetaFunction, g as LinksFunction, N as NonIndexRouteObject, u as unstable_InitialContext, h as MiddlewareEnabled, i as AppLoadContext, E as Equal, j as RouterState, P as PatchRoutesOnNavigationFunction, k as DataRouteObject, l as ClientLoaderFunction, m as Path } from './route-data-C8_wxpLo.mjs';
|
|
2
2
|
export { y as ActionFunctionArgs, B as Blocker, s as BlockerFunction, au as ClientActionFunction, av as ClientActionFunctionArgs, aw as ClientLoaderFunctionArgs, ap as DataRouteMatch, z as DataStrategyFunctionArgs, J as DataStrategyMatch, K as DataStrategyResult, Q as ErrorResponse, o as Fetcher, U as FormEncType, V as FormMethod, aE as Future, G as GetScrollPositionFunction, n as GetScrollRestorationKeyFunction, W as HTMLFormMethod, ax as HeadersArgs, ay as HeadersFunction, aC as HtmlLinkDescriptor, af as IDLE_BLOCKER, ae as IDLE_FETCHER, ad as IDLE_NAVIGATION, X as LazyRouteFunction, aD as LinkDescriptor, Y as LoaderFunctionArgs, az as MetaArgs, aA as MetaDescriptor, aq as NavigateOptions, p as Navigation, q as NavigationStates, aa as NavigationType, ar as Navigator, aB as PageLinkDescriptor, _ as ParamParseKey, $ as Params, as as PatchRoutesOnNavigationFunctionArgs, a0 as PathMatch, a1 as PathParam, a2 as PathPattern, a3 as RedirectFunction, r as RelativeRoutingType, x as RevalidationState, at as RouteMatch, w as RouterFetchOptions, R as RouterInit, v as RouterNavigateOptions, t as RouterSubscriber, a5 as ShouldRevalidateFunction, a6 as ShouldRevalidateFunctionArgs, T as To, a7 as UIMatch, aK as UNSAFE_DataRouterContext, aL as UNSAFE_DataRouterStateContext, O as UNSAFE_DataWithResponseInit, aJ as UNSAFE_ErrorResponseImpl, aM as UNSAFE_FetchersContext, aN as UNSAFE_LocationContext, aO as UNSAFE_NavigationContext, aP as UNSAFE_RouteContext, aQ as UNSAFE_ViewTransitionContext, aG as UNSAFE_createBrowserHistory, aI as UNSAFE_createRouter, aH as UNSAFE_invariant, ab as createPath, ag as data, ah as generatePath, ai as isRouteErrorResponse, aj as matchPath, ak as matchRoutes, ac as parsePath, al as redirect, am as redirectDocument, an as replace, ao as resolvePath, Z as unstable_MiddlewareFunction, a4 as unstable_RouterContext, a9 as unstable_RouterContextProvider, aF as unstable_SerializesTo, a8 as unstable_createContext } from './route-data-C8_wxpLo.mjs';
|
|
3
|
-
import { A as AssetsManifest, E as EntryContext, F as FutureConfig$1, a as RouteComponentType, H as HydrateFallbackType, b as ErrorBoundaryType, S as ServerBuild, c as ServerPayload } from './browser-
|
|
4
|
-
export { i as Await, d as AwaitProps, ag as BrowserRouter, a0 as BrowserRouterProps, a1 as DOMRouterOpts, a7 as FetcherFormProps, ac as FetcherSubmitFunction, aw as FetcherSubmitOptions, ad as FetcherWithComponents, al as Form, a8 as FormProps, aH as HandleDataRequestFunction, aI as HandleDocumentRequestFunction, aJ as HandleErrorFunction, ah as HashRouter, a2 as HashRouterProps, a3 as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, ai as Link, a4 as LinkProps, aD as Links, j as MemoryRouter, M as MemoryRouterOpts, e as MemoryRouterProps, aC as Meta, ak as NavLink, a5 as NavLinkProps, a6 as NavLinkRenderProps, k as Navigate, u as NavigateFunction, N as NavigateProps, l as Outlet, O as OutletProps, ax as ParamKeyValuePair, P as PathRouteProps, aF as PrefetchPageLinks, m as Route, f as RouteProps, n as Router, g as RouterProps, o as RouterProvider, R as RouterProviderProps, p as Routes, h as RoutesProps, aE as Scripts, aG as ScriptsProps, am as ScrollRestoration, a9 as ScrollRestorationProps, aK as ServerEntryModule, aa as SetURLSearchParams, ab as SubmitFunction, ay as SubmitOptions, aA as SubmitTarget, aV as UNSAFE_FrameworkContext, aW as UNSAFE_createClientRoutes, aX as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, aQ as UNSAFE_hydrationRouteProperties, aR as UNSAFE_mapRouteProperties, aY as UNSAFE_shouldHydrateRouteLoader, aZ as UNSAFE_useScrollRestoration, aS as UNSAFE_withComponentProps, aU as UNSAFE_withErrorBoundaryProps, aT as UNSAFE_withHydrateFallbackProps, az as URLSearchParamsInit, ae as createBrowserRouter, af as createHashRouter, q as createMemoryRouter, r as createRoutesFromChildren, s as createRoutesFromElements, aB as createSearchParams, t as renderMatches, aL as unstable_DecodeServerResponseFunction, aM as unstable_EncodeActionFunction, aj as unstable_HistoryRouter, aO as unstable_RSCHydratedRouter, aN as unstable_createCallServer, aP as unstable_getServerStream, au as unstable_usePrompt, w as useActionData, x as useAsyncError, y as useAsyncValue, at as useBeforeUnload, v as useBlocker, ar as useFetcher, as as useFetchers, aq as useFormAction, z as useHref, B as useInRouterContext, an as useLinkClickHandler, C as useLoaderData, D as useLocation, G as useMatch, J as useMatches, K as useNavigate, Q as useNavigation, T as useNavigationType, U as useOutlet, V as useOutletContext, W as useParams, X as useResolvedPath, Y as useRevalidator, Z as useRouteError, _ as useRouteLoaderData, $ as useRoutes, ao as useSearchParams, ap as useSubmit, av as useViewTransitionState } from './browser-
|
|
3
|
+
import { A as AssetsManifest, E as EntryContext, F as FutureConfig$1, a as RouteComponentType, H as HydrateFallbackType, b as ErrorBoundaryType, S as ServerBuild, c as ServerPayload } from './browser-BPyO7zih.mjs';
|
|
4
|
+
export { i as Await, d as AwaitProps, ag as BrowserRouter, a0 as BrowserRouterProps, a1 as DOMRouterOpts, a7 as FetcherFormProps, ac as FetcherSubmitFunction, aw as FetcherSubmitOptions, ad as FetcherWithComponents, al as Form, a8 as FormProps, aH as HandleDataRequestFunction, aI as HandleDocumentRequestFunction, aJ as HandleErrorFunction, ah as HashRouter, a2 as HashRouterProps, a3 as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, ai as Link, a4 as LinkProps, aD as Links, j as MemoryRouter, M as MemoryRouterOpts, e as MemoryRouterProps, aC as Meta, ak as NavLink, a5 as NavLinkProps, a6 as NavLinkRenderProps, k as Navigate, u as NavigateFunction, N as NavigateProps, l as Outlet, O as OutletProps, ax as ParamKeyValuePair, P as PathRouteProps, aF as PrefetchPageLinks, m as Route, f as RouteProps, n as Router, g as RouterProps, o as RouterProvider, R as RouterProviderProps, p as Routes, h as RoutesProps, aE as Scripts, aG as ScriptsProps, am as ScrollRestoration, a9 as ScrollRestorationProps, aK as ServerEntryModule, aa as SetURLSearchParams, ab as SubmitFunction, ay as SubmitOptions, aA as SubmitTarget, aV as UNSAFE_FrameworkContext, aW as UNSAFE_createClientRoutes, aX as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, aQ as UNSAFE_hydrationRouteProperties, aR as UNSAFE_mapRouteProperties, aY as UNSAFE_shouldHydrateRouteLoader, aZ as UNSAFE_useScrollRestoration, aS as UNSAFE_withComponentProps, aU as UNSAFE_withErrorBoundaryProps, aT as UNSAFE_withHydrateFallbackProps, az as URLSearchParamsInit, ae as createBrowserRouter, af as createHashRouter, q as createMemoryRouter, r as createRoutesFromChildren, s as createRoutesFromElements, aB as createSearchParams, t as renderMatches, aL as unstable_DecodeServerResponseFunction, aM as unstable_EncodeActionFunction, aj as unstable_HistoryRouter, aO as unstable_RSCHydratedRouter, aN as unstable_createCallServer, aP as unstable_getServerStream, au as unstable_usePrompt, w as useActionData, x as useAsyncError, y as useAsyncValue, at as useBeforeUnload, v as useBlocker, ar as useFetcher, as as useFetchers, aq as useFormAction, z as useHref, B as useInRouterContext, an as useLinkClickHandler, C as useLoaderData, D as useLocation, G as useMatch, J as useMatches, K as useNavigate, Q as useNavigation, T as useNavigationType, U as useOutlet, V as useOutletContext, W as useParams, X as useResolvedPath, Y as useRevalidator, Z as useRouteError, _ as useRouteLoaderData, $ as useRoutes, ao as useSearchParams, ap as useSubmit, av as useViewTransitionState } from './browser-BPyO7zih.mjs';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import React__default, { ReactElement } from 'react';
|
|
7
7
|
import { ParseOptions, SerializeOptions } from 'cookie';
|
|
@@ -2574,12 +2574,14 @@ declare global {
|
|
|
2574
2574
|
__routerActionID: number;
|
|
2575
2575
|
}
|
|
2576
2576
|
}
|
|
2577
|
-
declare function createCallServer({ decode, encodeAction, }: {
|
|
2577
|
+
declare function createCallServer({ decode, encodeAction, fetch: fetchImplementation, }: {
|
|
2578
2578
|
decode: DecodeServerResponseFunction;
|
|
2579
2579
|
encodeAction: EncodeActionFunction;
|
|
2580
|
+
fetch?: (request: Request) => Promise<Response>;
|
|
2580
2581
|
}): (id: string, args: unknown[]) => Promise<unknown>;
|
|
2581
|
-
declare function RSCHydratedRouter({ decode, payload, routeDiscovery, }: {
|
|
2582
|
+
declare function RSCHydratedRouter({ decode, fetch: fetchImplementation, payload, routeDiscovery, }: {
|
|
2582
2583
|
decode: DecodeServerResponseFunction;
|
|
2584
|
+
fetch?: (request: Request) => Promise<Response>;
|
|
2583
2585
|
payload: ServerPayload;
|
|
2584
2586
|
routeDiscovery?: "eager" | "lazy";
|
|
2585
2587
|
}): React.JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-ab9ed70c6
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -8964,7 +8964,7 @@ function mergeRefs(...refs) {
|
|
|
8964
8964
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
8965
8965
|
try {
|
|
8966
8966
|
if (isBrowser) {
|
|
8967
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
8967
|
+
window.__reactRouterVersion = "0.0.0-experimental-ab9ed70c6";
|
|
8968
8968
|
}
|
|
8969
8969
|
} catch (e) {
|
|
8970
8970
|
}
|
|
@@ -11781,19 +11781,22 @@ function RSCDefaultRootErrorBoundary({
|
|
|
11781
11781
|
// lib/rsc/browser.tsx
|
|
11782
11782
|
function createCallServer({
|
|
11783
11783
|
decode: decode2,
|
|
11784
|
-
encodeAction
|
|
11784
|
+
encodeAction,
|
|
11785
|
+
fetch: fetchImplementation = fetch
|
|
11785
11786
|
}) {
|
|
11786
11787
|
let landedActionId = 0;
|
|
11787
11788
|
return async (id, args) => {
|
|
11788
11789
|
let actionId = window.__routerActionID = (window.__routerActionID ?? (window.__routerActionID = 0)) + 1;
|
|
11789
|
-
const response = await
|
|
11790
|
-
|
|
11791
|
-
|
|
11792
|
-
|
|
11793
|
-
|
|
11794
|
-
|
|
11795
|
-
|
|
11796
|
-
|
|
11790
|
+
const response = await fetchImplementation(
|
|
11791
|
+
new Request(location.href, {
|
|
11792
|
+
body: await encodeAction(args),
|
|
11793
|
+
method: "POST",
|
|
11794
|
+
headers: {
|
|
11795
|
+
Accept: "text/x-component",
|
|
11796
|
+
"rsc-action-id": id
|
|
11797
|
+
}
|
|
11798
|
+
})
|
|
11799
|
+
);
|
|
11797
11800
|
if (!response.body) {
|
|
11798
11801
|
throw new Error("No response body");
|
|
11799
11802
|
}
|
|
@@ -11868,6 +11871,7 @@ function createCallServer({
|
|
|
11868
11871
|
};
|
|
11869
11872
|
}
|
|
11870
11873
|
function createRouterFromPayload({
|
|
11874
|
+
fetchImplementation,
|
|
11871
11875
|
decode: decode2,
|
|
11872
11876
|
payload
|
|
11873
11877
|
}) {
|
|
@@ -11925,14 +11929,20 @@ function createRouterFromPayload({
|
|
|
11925
11929
|
if (discoveredPaths2.has(path)) {
|
|
11926
11930
|
return;
|
|
11927
11931
|
}
|
|
11928
|
-
await fetchAndApplyManifestPatches2(
|
|
11932
|
+
await fetchAndApplyManifestPatches2(
|
|
11933
|
+
[path],
|
|
11934
|
+
decode2,
|
|
11935
|
+
fetchImplementation,
|
|
11936
|
+
signal
|
|
11937
|
+
);
|
|
11929
11938
|
},
|
|
11930
11939
|
// FIXME: Pass `build.ssr` and `build.basename` into this function
|
|
11931
11940
|
dataStrategy: getRSCSingleFetchDataStrategy(
|
|
11932
11941
|
() => window.__router,
|
|
11933
11942
|
true,
|
|
11934
11943
|
void 0,
|
|
11935
|
-
decode2
|
|
11944
|
+
decode2,
|
|
11945
|
+
fetchImplementation
|
|
11936
11946
|
)
|
|
11937
11947
|
});
|
|
11938
11948
|
if (window.__router.state.initialized) {
|
|
@@ -11950,7 +11960,7 @@ function createRouterFromPayload({
|
|
|
11950
11960
|
return window.__router;
|
|
11951
11961
|
}
|
|
11952
11962
|
var renderedRoutesContext = unstable_createContext();
|
|
11953
|
-
function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, decode2) {
|
|
11963
|
+
function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, decode2, fetchImplementation) {
|
|
11954
11964
|
let dataStrategy = getSingleFetchDataStrategyImpl(
|
|
11955
11965
|
getRouter,
|
|
11956
11966
|
(match) => {
|
|
@@ -11965,7 +11975,7 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, decode2) {
|
|
|
11965
11975
|
};
|
|
11966
11976
|
},
|
|
11967
11977
|
// pass map into fetchAndDecode so it can add payloads
|
|
11968
|
-
getFetchAndDecodeViaRSC(decode2),
|
|
11978
|
+
getFetchAndDecodeViaRSC(decode2, fetchImplementation),
|
|
11969
11979
|
ssr,
|
|
11970
11980
|
basename,
|
|
11971
11981
|
// If the route has a component but we don't have an element, we need to hit
|
|
@@ -12002,7 +12012,7 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, decode2) {
|
|
|
12002
12012
|
return results;
|
|
12003
12013
|
});
|
|
12004
12014
|
}
|
|
12005
|
-
function getFetchAndDecodeViaRSC(decode2) {
|
|
12015
|
+
function getFetchAndDecodeViaRSC(decode2, fetchImplementation) {
|
|
12006
12016
|
return async (args, basename, targetRoutes) => {
|
|
12007
12017
|
let { request, context } = args;
|
|
12008
12018
|
let url = singleFetchUrl(request.url, basename, "rsc");
|
|
@@ -12012,7 +12022,9 @@ function getFetchAndDecodeViaRSC(decode2) {
|
|
|
12012
12022
|
url.searchParams.set("_routes", targetRoutes.join(","));
|
|
12013
12023
|
}
|
|
12014
12024
|
}
|
|
12015
|
-
let res = await
|
|
12025
|
+
let res = await fetchImplementation(
|
|
12026
|
+
new Request(url, await createRequestInit(request))
|
|
12027
|
+
);
|
|
12016
12028
|
if (res.status === 404 && !res.headers.has("X-Remix-Response")) {
|
|
12017
12029
|
throw new ErrorResponseImpl(404, "Not Found", true);
|
|
12018
12030
|
}
|
|
@@ -12055,14 +12067,18 @@ function getFetchAndDecodeViaRSC(decode2) {
|
|
|
12055
12067
|
}
|
|
12056
12068
|
function RSCHydratedRouter({
|
|
12057
12069
|
decode: decode2,
|
|
12070
|
+
fetch: fetchImplementation = fetch,
|
|
12058
12071
|
payload,
|
|
12059
12072
|
routeDiscovery = "eager"
|
|
12060
12073
|
}) {
|
|
12061
12074
|
if (payload.type !== "render") throw new Error("Invalid payload type");
|
|
12062
12075
|
let router = React15.useMemo(
|
|
12063
|
-
() => createRouterFromPayload({
|
|
12064
|
-
|
|
12065
|
-
|
|
12076
|
+
() => createRouterFromPayload({
|
|
12077
|
+
decode: decode2,
|
|
12078
|
+
payload,
|
|
12079
|
+
fetchImplementation
|
|
12080
|
+
}),
|
|
12081
|
+
[decode2, payload, fetchImplementation]
|
|
12066
12082
|
);
|
|
12067
12083
|
React15.useLayoutEffect(() => {
|
|
12068
12084
|
if (!window.__routerInitialized) {
|
|
@@ -12107,7 +12123,7 @@ function RSCHydratedRouter({
|
|
|
12107
12123
|
return;
|
|
12108
12124
|
}
|
|
12109
12125
|
try {
|
|
12110
|
-
await fetchAndApplyManifestPatches2(paths, decode2);
|
|
12126
|
+
await fetchAndApplyManifestPatches2(paths, decode2, fetchImplementation);
|
|
12111
12127
|
} catch (e) {
|
|
12112
12128
|
console.error("Failed to fetch manifest patches", e);
|
|
12113
12129
|
}
|
|
@@ -12121,7 +12137,7 @@ function RSCHydratedRouter({
|
|
|
12121
12137
|
attributes: true,
|
|
12122
12138
|
attributeFilter: ["data-discover", "href", "action"]
|
|
12123
12139
|
});
|
|
12124
|
-
}, [routeDiscovery, decode2]);
|
|
12140
|
+
}, [routeDiscovery, decode2, fetchImplementation]);
|
|
12125
12141
|
const frameworkContext = {
|
|
12126
12142
|
future: {
|
|
12127
12143
|
// These flags have no runtime impact so can always be false. If we add
|
|
@@ -12242,7 +12258,7 @@ var nextPaths2 = /* @__PURE__ */ new Set();
|
|
|
12242
12258
|
var discoveredPathsMaxSize2 = 1e3;
|
|
12243
12259
|
var discoveredPaths2 = /* @__PURE__ */ new Set();
|
|
12244
12260
|
var URL_LIMIT2 = 7680;
|
|
12245
|
-
async function fetchAndApplyManifestPatches2(paths, decode2, signal) {
|
|
12261
|
+
async function fetchAndApplyManifestPatches2(paths, decode2, fetchImplementation, signal) {
|
|
12246
12262
|
let basename = (window.__router.basename ?? "").replace(/^\/|\/$/g, "");
|
|
12247
12263
|
let url = new URL(`${basename}/.manifest`, window.location.origin);
|
|
12248
12264
|
paths.sort().forEach((path) => url.searchParams.append("p", path));
|
|
@@ -12250,7 +12266,7 @@ async function fetchAndApplyManifestPatches2(paths, decode2, signal) {
|
|
|
12250
12266
|
nextPaths2.clear();
|
|
12251
12267
|
return;
|
|
12252
12268
|
}
|
|
12253
|
-
let response = await
|
|
12269
|
+
let response = await fetchImplementation(new Request(url, { signal }));
|
|
12254
12270
|
if (!response.body || response.status < 200 || response.status >= 300) {
|
|
12255
12271
|
throw new Error("Unable to fetch new route matches from the server");
|
|
12256
12272
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-ab9ed70c6
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -135,7 +135,7 @@ import {
|
|
|
135
135
|
withComponentProps,
|
|
136
136
|
withErrorBoundaryProps,
|
|
137
137
|
withHydrateFallbackProps
|
|
138
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-44SHGOVW.mjs";
|
|
139
139
|
export {
|
|
140
140
|
Await,
|
|
141
141
|
BrowserRouter,
|
|
@@ -2196,12 +2196,14 @@ declare global {
|
|
|
2196
2196
|
__routerActionID: number;
|
|
2197
2197
|
}
|
|
2198
2198
|
}
|
|
2199
|
-
declare function createCallServer({ decode, encodeAction, }: {
|
|
2199
|
+
declare function createCallServer({ decode, encodeAction, fetch: fetchImplementation, }: {
|
|
2200
2200
|
decode: DecodeServerResponseFunction;
|
|
2201
2201
|
encodeAction: EncodeActionFunction;
|
|
2202
|
+
fetch?: (request: Request) => Promise<Response>;
|
|
2202
2203
|
}): (id: string, args: unknown[]) => Promise<unknown>;
|
|
2203
|
-
declare function RSCHydratedRouter({ decode, payload, routeDiscovery, }: {
|
|
2204
|
+
declare function RSCHydratedRouter({ decode, fetch: fetchImplementation, payload, routeDiscovery, }: {
|
|
2204
2205
|
decode: DecodeServerResponseFunction;
|
|
2206
|
+
fetch?: (request: Request) => Promise<Response>;
|
|
2205
2207
|
payload: ServerPayload;
|
|
2206
2208
|
routeDiscovery?: "eager" | "lazy";
|
|
2207
2209
|
}): React.JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-ab9ed70c6
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -8804,7 +8804,7 @@ function mergeRefs(...refs) {
|
|
|
8804
8804
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
8805
8805
|
try {
|
|
8806
8806
|
if (isBrowser) {
|
|
8807
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
8807
|
+
window.__reactRouterVersion = "0.0.0-experimental-ab9ed70c6";
|
|
8808
8808
|
}
|
|
8809
8809
|
} catch (e) {
|
|
8810
8810
|
}
|
|
@@ -11621,19 +11621,22 @@ function RSCDefaultRootErrorBoundary({
|
|
|
11621
11621
|
// lib/rsc/browser.tsx
|
|
11622
11622
|
function createCallServer({
|
|
11623
11623
|
decode: decode2,
|
|
11624
|
-
encodeAction
|
|
11624
|
+
encodeAction,
|
|
11625
|
+
fetch: fetchImplementation = fetch
|
|
11625
11626
|
}) {
|
|
11626
11627
|
let landedActionId = 0;
|
|
11627
11628
|
return async (id, args) => {
|
|
11628
11629
|
let actionId = window.__routerActionID = (window.__routerActionID ?? (window.__routerActionID = 0)) + 1;
|
|
11629
|
-
const response = await
|
|
11630
|
-
|
|
11631
|
-
|
|
11632
|
-
|
|
11633
|
-
|
|
11634
|
-
|
|
11635
|
-
|
|
11636
|
-
|
|
11630
|
+
const response = await fetchImplementation(
|
|
11631
|
+
new Request(location.href, {
|
|
11632
|
+
body: await encodeAction(args),
|
|
11633
|
+
method: "POST",
|
|
11634
|
+
headers: {
|
|
11635
|
+
Accept: "text/x-component",
|
|
11636
|
+
"rsc-action-id": id
|
|
11637
|
+
}
|
|
11638
|
+
})
|
|
11639
|
+
);
|
|
11637
11640
|
if (!response.body) {
|
|
11638
11641
|
throw new Error("No response body");
|
|
11639
11642
|
}
|
|
@@ -11708,6 +11711,7 @@ function createCallServer({
|
|
|
11708
11711
|
};
|
|
11709
11712
|
}
|
|
11710
11713
|
function createRouterFromPayload({
|
|
11714
|
+
fetchImplementation,
|
|
11711
11715
|
decode: decode2,
|
|
11712
11716
|
payload
|
|
11713
11717
|
}) {
|
|
@@ -11765,14 +11769,20 @@ function createRouterFromPayload({
|
|
|
11765
11769
|
if (discoveredPaths2.has(path)) {
|
|
11766
11770
|
return;
|
|
11767
11771
|
}
|
|
11768
|
-
await fetchAndApplyManifestPatches2(
|
|
11772
|
+
await fetchAndApplyManifestPatches2(
|
|
11773
|
+
[path],
|
|
11774
|
+
decode2,
|
|
11775
|
+
fetchImplementation,
|
|
11776
|
+
signal
|
|
11777
|
+
);
|
|
11769
11778
|
},
|
|
11770
11779
|
// FIXME: Pass `build.ssr` and `build.basename` into this function
|
|
11771
11780
|
dataStrategy: getRSCSingleFetchDataStrategy(
|
|
11772
11781
|
() => window.__router,
|
|
11773
11782
|
true,
|
|
11774
11783
|
void 0,
|
|
11775
|
-
decode2
|
|
11784
|
+
decode2,
|
|
11785
|
+
fetchImplementation
|
|
11776
11786
|
)
|
|
11777
11787
|
});
|
|
11778
11788
|
if (window.__router.state.initialized) {
|
|
@@ -11790,7 +11800,7 @@ function createRouterFromPayload({
|
|
|
11790
11800
|
return window.__router;
|
|
11791
11801
|
}
|
|
11792
11802
|
var renderedRoutesContext = unstable_createContext();
|
|
11793
|
-
function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, decode2) {
|
|
11803
|
+
function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, decode2, fetchImplementation) {
|
|
11794
11804
|
let dataStrategy = getSingleFetchDataStrategyImpl(
|
|
11795
11805
|
getRouter,
|
|
11796
11806
|
(match) => {
|
|
@@ -11805,7 +11815,7 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, decode2) {
|
|
|
11805
11815
|
};
|
|
11806
11816
|
},
|
|
11807
11817
|
// pass map into fetchAndDecode so it can add payloads
|
|
11808
|
-
getFetchAndDecodeViaRSC(decode2),
|
|
11818
|
+
getFetchAndDecodeViaRSC(decode2, fetchImplementation),
|
|
11809
11819
|
ssr,
|
|
11810
11820
|
basename,
|
|
11811
11821
|
// If the route has a component but we don't have an element, we need to hit
|
|
@@ -11842,7 +11852,7 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, decode2) {
|
|
|
11842
11852
|
return results;
|
|
11843
11853
|
});
|
|
11844
11854
|
}
|
|
11845
|
-
function getFetchAndDecodeViaRSC(decode2) {
|
|
11855
|
+
function getFetchAndDecodeViaRSC(decode2, fetchImplementation) {
|
|
11846
11856
|
return async (args, basename, targetRoutes) => {
|
|
11847
11857
|
let { request, context } = args;
|
|
11848
11858
|
let url = singleFetchUrl(request.url, basename, "rsc");
|
|
@@ -11852,7 +11862,9 @@ function getFetchAndDecodeViaRSC(decode2) {
|
|
|
11852
11862
|
url.searchParams.set("_routes", targetRoutes.join(","));
|
|
11853
11863
|
}
|
|
11854
11864
|
}
|
|
11855
|
-
let res = await
|
|
11865
|
+
let res = await fetchImplementation(
|
|
11866
|
+
new Request(url, await createRequestInit(request))
|
|
11867
|
+
);
|
|
11856
11868
|
if (res.status === 404 && !res.headers.has("X-Remix-Response")) {
|
|
11857
11869
|
throw new ErrorResponseImpl(404, "Not Found", true);
|
|
11858
11870
|
}
|
|
@@ -11895,14 +11907,18 @@ function getFetchAndDecodeViaRSC(decode2) {
|
|
|
11895
11907
|
}
|
|
11896
11908
|
function RSCHydratedRouter({
|
|
11897
11909
|
decode: decode2,
|
|
11910
|
+
fetch: fetchImplementation = fetch,
|
|
11898
11911
|
payload,
|
|
11899
11912
|
routeDiscovery = "eager"
|
|
11900
11913
|
}) {
|
|
11901
11914
|
if (payload.type !== "render") throw new Error("Invalid payload type");
|
|
11902
11915
|
let router = React15.useMemo(
|
|
11903
|
-
() => createRouterFromPayload({
|
|
11904
|
-
|
|
11905
|
-
|
|
11916
|
+
() => createRouterFromPayload({
|
|
11917
|
+
decode: decode2,
|
|
11918
|
+
payload,
|
|
11919
|
+
fetchImplementation
|
|
11920
|
+
}),
|
|
11921
|
+
[decode2, payload, fetchImplementation]
|
|
11906
11922
|
);
|
|
11907
11923
|
React15.useLayoutEffect(() => {
|
|
11908
11924
|
if (!window.__routerInitialized) {
|
|
@@ -11947,7 +11963,7 @@ function RSCHydratedRouter({
|
|
|
11947
11963
|
return;
|
|
11948
11964
|
}
|
|
11949
11965
|
try {
|
|
11950
|
-
await fetchAndApplyManifestPatches2(paths, decode2);
|
|
11966
|
+
await fetchAndApplyManifestPatches2(paths, decode2, fetchImplementation);
|
|
11951
11967
|
} catch (e) {
|
|
11952
11968
|
console.error("Failed to fetch manifest patches", e);
|
|
11953
11969
|
}
|
|
@@ -11961,7 +11977,7 @@ function RSCHydratedRouter({
|
|
|
11961
11977
|
attributes: true,
|
|
11962
11978
|
attributeFilter: ["data-discover", "href", "action"]
|
|
11963
11979
|
});
|
|
11964
|
-
}, [routeDiscovery, decode2]);
|
|
11980
|
+
}, [routeDiscovery, decode2, fetchImplementation]);
|
|
11965
11981
|
const frameworkContext = {
|
|
11966
11982
|
future: {
|
|
11967
11983
|
// These flags have no runtime impact so can always be false. If we add
|
|
@@ -12082,7 +12098,7 @@ var nextPaths2 = /* @__PURE__ */ new Set();
|
|
|
12082
12098
|
var discoveredPathsMaxSize2 = 1e3;
|
|
12083
12099
|
var discoveredPaths2 = /* @__PURE__ */ new Set();
|
|
12084
12100
|
var URL_LIMIT2 = 7680;
|
|
12085
|
-
async function fetchAndApplyManifestPatches2(paths, decode2, signal) {
|
|
12101
|
+
async function fetchAndApplyManifestPatches2(paths, decode2, fetchImplementation, signal) {
|
|
12086
12102
|
let basename = (window.__router.basename ?? "").replace(/^\/|\/$/g, "");
|
|
12087
12103
|
let url = new URL(`${basename}/.manifest`, window.location.origin);
|
|
12088
12104
|
paths.sort().forEach((path) => url.searchParams.append("p", path));
|
|
@@ -12090,7 +12106,7 @@ async function fetchAndApplyManifestPatches2(paths, decode2, signal) {
|
|
|
12090
12106
|
nextPaths2.clear();
|
|
12091
12107
|
return;
|
|
12092
12108
|
}
|
|
12093
|
-
let response = await
|
|
12109
|
+
let response = await fetchImplementation(new Request(url, { signal }));
|
|
12094
12110
|
if (!response.body || response.status < 200 || response.status >= 300) {
|
|
12095
12111
|
throw new Error("Unable to fetch new route matches from the server");
|
|
12096
12112
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterProviderProps$1 } from './browser-
|
|
2
|
+
import { R as RouterProviderProps$1 } from './browser-BPyO7zih.mjs';
|
|
3
3
|
import { R as RouterInit } from './route-data-C8_wxpLo.mjs';
|
|
4
4
|
|
|
5
5
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-ab9ed70c6
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
invariant,
|
|
27
27
|
mapRouteProperties,
|
|
28
28
|
useFogOFWarDiscovery
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-OMKPJEIF.mjs";
|
|
30
30
|
|
|
31
31
|
// lib/dom-export/dom-router-provider.tsx
|
|
32
32
|
import * as React from "react";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as Router, b as RouteModules, D as DataStrategyFunction, L as Location, S as StaticHandlerContext, c as RouteObject, C as CreateStaticHandlerOptions$1, d as StaticHandler, F as FutureConfig, I as InitialEntry, H as HydrationState, e as IndexRouteObject, f as LoaderFunction, A as ActionFunction, M as MetaFunction, g as LinksFunction, N as NonIndexRouteObject, u as unstable_InitialContext, h as MiddlewareEnabled, i as AppLoadContext, E as Equal, j as RouterState, P as PatchRoutesOnNavigationFunction, k as DataRouteObject, l as ClientLoaderFunction, m as Path } from './route-data-C8_wxpLo.mjs';
|
|
2
2
|
export { y as ActionFunctionArgs, B as Blocker, s as BlockerFunction, au as ClientActionFunction, av as ClientActionFunctionArgs, aw as ClientLoaderFunctionArgs, ap as DataRouteMatch, z as DataStrategyFunctionArgs, J as DataStrategyMatch, K as DataStrategyResult, Q as ErrorResponse, o as Fetcher, U as FormEncType, V as FormMethod, aE as Future, G as GetScrollPositionFunction, n as GetScrollRestorationKeyFunction, W as HTMLFormMethod, ax as HeadersArgs, ay as HeadersFunction, aC as HtmlLinkDescriptor, af as IDLE_BLOCKER, ae as IDLE_FETCHER, ad as IDLE_NAVIGATION, X as LazyRouteFunction, aD as LinkDescriptor, Y as LoaderFunctionArgs, az as MetaArgs, aA as MetaDescriptor, aq as NavigateOptions, p as Navigation, q as NavigationStates, aa as NavigationType, ar as Navigator, aB as PageLinkDescriptor, _ as ParamParseKey, $ as Params, as as PatchRoutesOnNavigationFunctionArgs, a0 as PathMatch, a1 as PathParam, a2 as PathPattern, a3 as RedirectFunction, r as RelativeRoutingType, x as RevalidationState, at as RouteMatch, w as RouterFetchOptions, R as RouterInit, v as RouterNavigateOptions, t as RouterSubscriber, a5 as ShouldRevalidateFunction, a6 as ShouldRevalidateFunctionArgs, T as To, a7 as UIMatch, aK as UNSAFE_DataRouterContext, aL as UNSAFE_DataRouterStateContext, O as UNSAFE_DataWithResponseInit, aJ as UNSAFE_ErrorResponseImpl, aM as UNSAFE_FetchersContext, aN as UNSAFE_LocationContext, aO as UNSAFE_NavigationContext, aP as UNSAFE_RouteContext, aQ as UNSAFE_ViewTransitionContext, aG as UNSAFE_createBrowserHistory, aI as UNSAFE_createRouter, aH as UNSAFE_invariant, ab as createPath, ag as data, ah as generatePath, ai as isRouteErrorResponse, aj as matchPath, ak as matchRoutes, ac as parsePath, al as redirect, am as redirectDocument, an as replace, ao as resolvePath, Z as unstable_MiddlewareFunction, a4 as unstable_RouterContext, a9 as unstable_RouterContextProvider, aF as unstable_SerializesTo, a8 as unstable_createContext } from './route-data-C8_wxpLo.mjs';
|
|
3
|
-
import { A as AssetsManifest, E as EntryContext, F as FutureConfig$1, a as RouteComponentType, H as HydrateFallbackType, b as ErrorBoundaryType, S as ServerBuild, c as ServerPayload } from './browser-
|
|
4
|
-
export { i as Await, d as AwaitProps, ag as BrowserRouter, a0 as BrowserRouterProps, a1 as DOMRouterOpts, a7 as FetcherFormProps, ac as FetcherSubmitFunction, aw as FetcherSubmitOptions, ad as FetcherWithComponents, al as Form, a8 as FormProps, aH as HandleDataRequestFunction, aI as HandleDocumentRequestFunction, aJ as HandleErrorFunction, ah as HashRouter, a2 as HashRouterProps, a3 as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, ai as Link, a4 as LinkProps, aD as Links, j as MemoryRouter, M as MemoryRouterOpts, e as MemoryRouterProps, aC as Meta, ak as NavLink, a5 as NavLinkProps, a6 as NavLinkRenderProps, k as Navigate, u as NavigateFunction, N as NavigateProps, l as Outlet, O as OutletProps, ax as ParamKeyValuePair, P as PathRouteProps, aF as PrefetchPageLinks, m as Route, f as RouteProps, n as Router, g as RouterProps, o as RouterProvider, R as RouterProviderProps, p as Routes, h as RoutesProps, aE as Scripts, aG as ScriptsProps, am as ScrollRestoration, a9 as ScrollRestorationProps, aK as ServerEntryModule, aa as SetURLSearchParams, ab as SubmitFunction, ay as SubmitOptions, aA as SubmitTarget, aV as UNSAFE_FrameworkContext, aW as UNSAFE_createClientRoutes, aX as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, aQ as UNSAFE_hydrationRouteProperties, aR as UNSAFE_mapRouteProperties, aY as UNSAFE_shouldHydrateRouteLoader, aZ as UNSAFE_useScrollRestoration, aS as UNSAFE_withComponentProps, aU as UNSAFE_withErrorBoundaryProps, aT as UNSAFE_withHydrateFallbackProps, az as URLSearchParamsInit, ae as createBrowserRouter, af as createHashRouter, q as createMemoryRouter, r as createRoutesFromChildren, s as createRoutesFromElements, aB as createSearchParams, t as renderMatches, aL as unstable_DecodeServerResponseFunction, aM as unstable_EncodeActionFunction, aj as unstable_HistoryRouter, aO as unstable_RSCHydratedRouter, aN as unstable_createCallServer, aP as unstable_getServerStream, au as unstable_usePrompt, w as useActionData, x as useAsyncError, y as useAsyncValue, at as useBeforeUnload, v as useBlocker, ar as useFetcher, as as useFetchers, aq as useFormAction, z as useHref, B as useInRouterContext, an as useLinkClickHandler, C as useLoaderData, D as useLocation, G as useMatch, J as useMatches, K as useNavigate, Q as useNavigation, T as useNavigationType, U as useOutlet, V as useOutletContext, W as useParams, X as useResolvedPath, Y as useRevalidator, Z as useRouteError, _ as useRouteLoaderData, $ as useRoutes, ao as useSearchParams, ap as useSubmit, av as useViewTransitionState } from './browser-
|
|
3
|
+
import { A as AssetsManifest, E as EntryContext, F as FutureConfig$1, a as RouteComponentType, H as HydrateFallbackType, b as ErrorBoundaryType, S as ServerBuild, c as ServerPayload } from './browser-BPyO7zih.mjs';
|
|
4
|
+
export { i as Await, d as AwaitProps, ag as BrowserRouter, a0 as BrowserRouterProps, a1 as DOMRouterOpts, a7 as FetcherFormProps, ac as FetcherSubmitFunction, aw as FetcherSubmitOptions, ad as FetcherWithComponents, al as Form, a8 as FormProps, aH as HandleDataRequestFunction, aI as HandleDocumentRequestFunction, aJ as HandleErrorFunction, ah as HashRouter, a2 as HashRouterProps, a3 as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, ai as Link, a4 as LinkProps, aD as Links, j as MemoryRouter, M as MemoryRouterOpts, e as MemoryRouterProps, aC as Meta, ak as NavLink, a5 as NavLinkProps, a6 as NavLinkRenderProps, k as Navigate, u as NavigateFunction, N as NavigateProps, l as Outlet, O as OutletProps, ax as ParamKeyValuePair, P as PathRouteProps, aF as PrefetchPageLinks, m as Route, f as RouteProps, n as Router, g as RouterProps, o as RouterProvider, R as RouterProviderProps, p as Routes, h as RoutesProps, aE as Scripts, aG as ScriptsProps, am as ScrollRestoration, a9 as ScrollRestorationProps, aK as ServerEntryModule, aa as SetURLSearchParams, ab as SubmitFunction, ay as SubmitOptions, aA as SubmitTarget, aV as UNSAFE_FrameworkContext, aW as UNSAFE_createClientRoutes, aX as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, aQ as UNSAFE_hydrationRouteProperties, aR as UNSAFE_mapRouteProperties, aY as UNSAFE_shouldHydrateRouteLoader, aZ as UNSAFE_useScrollRestoration, aS as UNSAFE_withComponentProps, aU as UNSAFE_withErrorBoundaryProps, aT as UNSAFE_withHydrateFallbackProps, az as URLSearchParamsInit, ae as createBrowserRouter, af as createHashRouter, q as createMemoryRouter, r as createRoutesFromChildren, s as createRoutesFromElements, aB as createSearchParams, t as renderMatches, aL as unstable_DecodeServerResponseFunction, aM as unstable_EncodeActionFunction, aj as unstable_HistoryRouter, aO as unstable_RSCHydratedRouter, aN as unstable_createCallServer, aP as unstable_getServerStream, au as unstable_usePrompt, w as useActionData, x as useAsyncError, y as useAsyncValue, at as useBeforeUnload, v as useBlocker, ar as useFetcher, as as useFetchers, aq as useFormAction, z as useHref, B as useInRouterContext, an as useLinkClickHandler, C as useLoaderData, D as useLocation, G as useMatch, J as useMatches, K as useNavigate, Q as useNavigation, T as useNavigationType, U as useOutlet, V as useOutletContext, W as useParams, X as useResolvedPath, Y as useRevalidator, Z as useRouteError, _ as useRouteLoaderData, $ as useRoutes, ao as useSearchParams, ap as useSubmit, av as useViewTransitionState } from './browser-BPyO7zih.mjs';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import React__default, { ReactElement } from 'react';
|
|
7
7
|
import { ParseOptions, SerializeOptions } from 'cookie';
|
|
@@ -2574,12 +2574,14 @@ declare global {
|
|
|
2574
2574
|
__routerActionID: number;
|
|
2575
2575
|
}
|
|
2576
2576
|
}
|
|
2577
|
-
declare function createCallServer({ decode, encodeAction, }: {
|
|
2577
|
+
declare function createCallServer({ decode, encodeAction, fetch: fetchImplementation, }: {
|
|
2578
2578
|
decode: DecodeServerResponseFunction;
|
|
2579
2579
|
encodeAction: EncodeActionFunction;
|
|
2580
|
+
fetch?: (request: Request) => Promise<Response>;
|
|
2580
2581
|
}): (id: string, args: unknown[]) => Promise<unknown>;
|
|
2581
|
-
declare function RSCHydratedRouter({ decode, payload, routeDiscovery, }: {
|
|
2582
|
+
declare function RSCHydratedRouter({ decode, fetch: fetchImplementation, payload, routeDiscovery, }: {
|
|
2582
2583
|
decode: DecodeServerResponseFunction;
|
|
2584
|
+
fetch?: (request: Request) => Promise<Response>;
|
|
2583
2585
|
payload: ServerPayload;
|
|
2584
2586
|
routeDiscovery?: "eager" | "lazy";
|
|
2585
2587
|
}): React.JSX.Element;
|
package/dist/production/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-ab9ed70c6
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -8964,7 +8964,7 @@ function mergeRefs(...refs) {
|
|
|
8964
8964
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
8965
8965
|
try {
|
|
8966
8966
|
if (isBrowser) {
|
|
8967
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
8967
|
+
window.__reactRouterVersion = "0.0.0-experimental-ab9ed70c6";
|
|
8968
8968
|
}
|
|
8969
8969
|
} catch (e) {
|
|
8970
8970
|
}
|
|
@@ -11781,19 +11781,22 @@ function RSCDefaultRootErrorBoundary({
|
|
|
11781
11781
|
// lib/rsc/browser.tsx
|
|
11782
11782
|
function createCallServer({
|
|
11783
11783
|
decode: decode2,
|
|
11784
|
-
encodeAction
|
|
11784
|
+
encodeAction,
|
|
11785
|
+
fetch: fetchImplementation = fetch
|
|
11785
11786
|
}) {
|
|
11786
11787
|
let landedActionId = 0;
|
|
11787
11788
|
return async (id, args) => {
|
|
11788
11789
|
let actionId = window.__routerActionID = (window.__routerActionID ?? (window.__routerActionID = 0)) + 1;
|
|
11789
|
-
const response = await
|
|
11790
|
-
|
|
11791
|
-
|
|
11792
|
-
|
|
11793
|
-
|
|
11794
|
-
|
|
11795
|
-
|
|
11796
|
-
|
|
11790
|
+
const response = await fetchImplementation(
|
|
11791
|
+
new Request(location.href, {
|
|
11792
|
+
body: await encodeAction(args),
|
|
11793
|
+
method: "POST",
|
|
11794
|
+
headers: {
|
|
11795
|
+
Accept: "text/x-component",
|
|
11796
|
+
"rsc-action-id": id
|
|
11797
|
+
}
|
|
11798
|
+
})
|
|
11799
|
+
);
|
|
11797
11800
|
if (!response.body) {
|
|
11798
11801
|
throw new Error("No response body");
|
|
11799
11802
|
}
|
|
@@ -11868,6 +11871,7 @@ function createCallServer({
|
|
|
11868
11871
|
};
|
|
11869
11872
|
}
|
|
11870
11873
|
function createRouterFromPayload({
|
|
11874
|
+
fetchImplementation,
|
|
11871
11875
|
decode: decode2,
|
|
11872
11876
|
payload
|
|
11873
11877
|
}) {
|
|
@@ -11925,14 +11929,20 @@ function createRouterFromPayload({
|
|
|
11925
11929
|
if (discoveredPaths2.has(path)) {
|
|
11926
11930
|
return;
|
|
11927
11931
|
}
|
|
11928
|
-
await fetchAndApplyManifestPatches2(
|
|
11932
|
+
await fetchAndApplyManifestPatches2(
|
|
11933
|
+
[path],
|
|
11934
|
+
decode2,
|
|
11935
|
+
fetchImplementation,
|
|
11936
|
+
signal
|
|
11937
|
+
);
|
|
11929
11938
|
},
|
|
11930
11939
|
// FIXME: Pass `build.ssr` and `build.basename` into this function
|
|
11931
11940
|
dataStrategy: getRSCSingleFetchDataStrategy(
|
|
11932
11941
|
() => window.__router,
|
|
11933
11942
|
true,
|
|
11934
11943
|
void 0,
|
|
11935
|
-
decode2
|
|
11944
|
+
decode2,
|
|
11945
|
+
fetchImplementation
|
|
11936
11946
|
)
|
|
11937
11947
|
});
|
|
11938
11948
|
if (window.__router.state.initialized) {
|
|
@@ -11950,7 +11960,7 @@ function createRouterFromPayload({
|
|
|
11950
11960
|
return window.__router;
|
|
11951
11961
|
}
|
|
11952
11962
|
var renderedRoutesContext = unstable_createContext();
|
|
11953
|
-
function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, decode2) {
|
|
11963
|
+
function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, decode2, fetchImplementation) {
|
|
11954
11964
|
let dataStrategy = getSingleFetchDataStrategyImpl(
|
|
11955
11965
|
getRouter,
|
|
11956
11966
|
(match) => {
|
|
@@ -11965,7 +11975,7 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, decode2) {
|
|
|
11965
11975
|
};
|
|
11966
11976
|
},
|
|
11967
11977
|
// pass map into fetchAndDecode so it can add payloads
|
|
11968
|
-
getFetchAndDecodeViaRSC(decode2),
|
|
11978
|
+
getFetchAndDecodeViaRSC(decode2, fetchImplementation),
|
|
11969
11979
|
ssr,
|
|
11970
11980
|
basename,
|
|
11971
11981
|
// If the route has a component but we don't have an element, we need to hit
|
|
@@ -12002,7 +12012,7 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, decode2) {
|
|
|
12002
12012
|
return results;
|
|
12003
12013
|
});
|
|
12004
12014
|
}
|
|
12005
|
-
function getFetchAndDecodeViaRSC(decode2) {
|
|
12015
|
+
function getFetchAndDecodeViaRSC(decode2, fetchImplementation) {
|
|
12006
12016
|
return async (args, basename, targetRoutes) => {
|
|
12007
12017
|
let { request, context } = args;
|
|
12008
12018
|
let url = singleFetchUrl(request.url, basename, "rsc");
|
|
@@ -12012,7 +12022,9 @@ function getFetchAndDecodeViaRSC(decode2) {
|
|
|
12012
12022
|
url.searchParams.set("_routes", targetRoutes.join(","));
|
|
12013
12023
|
}
|
|
12014
12024
|
}
|
|
12015
|
-
let res = await
|
|
12025
|
+
let res = await fetchImplementation(
|
|
12026
|
+
new Request(url, await createRequestInit(request))
|
|
12027
|
+
);
|
|
12016
12028
|
if (res.status === 404 && !res.headers.has("X-Remix-Response")) {
|
|
12017
12029
|
throw new ErrorResponseImpl(404, "Not Found", true);
|
|
12018
12030
|
}
|
|
@@ -12055,14 +12067,18 @@ function getFetchAndDecodeViaRSC(decode2) {
|
|
|
12055
12067
|
}
|
|
12056
12068
|
function RSCHydratedRouter({
|
|
12057
12069
|
decode: decode2,
|
|
12070
|
+
fetch: fetchImplementation = fetch,
|
|
12058
12071
|
payload,
|
|
12059
12072
|
routeDiscovery = "eager"
|
|
12060
12073
|
}) {
|
|
12061
12074
|
if (payload.type !== "render") throw new Error("Invalid payload type");
|
|
12062
12075
|
let router = React15.useMemo(
|
|
12063
|
-
() => createRouterFromPayload({
|
|
12064
|
-
|
|
12065
|
-
|
|
12076
|
+
() => createRouterFromPayload({
|
|
12077
|
+
decode: decode2,
|
|
12078
|
+
payload,
|
|
12079
|
+
fetchImplementation
|
|
12080
|
+
}),
|
|
12081
|
+
[decode2, payload, fetchImplementation]
|
|
12066
12082
|
);
|
|
12067
12083
|
React15.useLayoutEffect(() => {
|
|
12068
12084
|
if (!window.__routerInitialized) {
|
|
@@ -12107,7 +12123,7 @@ function RSCHydratedRouter({
|
|
|
12107
12123
|
return;
|
|
12108
12124
|
}
|
|
12109
12125
|
try {
|
|
12110
|
-
await fetchAndApplyManifestPatches2(paths, decode2);
|
|
12126
|
+
await fetchAndApplyManifestPatches2(paths, decode2, fetchImplementation);
|
|
12111
12127
|
} catch (e) {
|
|
12112
12128
|
console.error("Failed to fetch manifest patches", e);
|
|
12113
12129
|
}
|
|
@@ -12121,7 +12137,7 @@ function RSCHydratedRouter({
|
|
|
12121
12137
|
attributes: true,
|
|
12122
12138
|
attributeFilter: ["data-discover", "href", "action"]
|
|
12123
12139
|
});
|
|
12124
|
-
}, [routeDiscovery, decode2]);
|
|
12140
|
+
}, [routeDiscovery, decode2, fetchImplementation]);
|
|
12125
12141
|
const frameworkContext = {
|
|
12126
12142
|
future: {
|
|
12127
12143
|
// These flags have no runtime impact so can always be false. If we add
|
|
@@ -12242,7 +12258,7 @@ var nextPaths2 = /* @__PURE__ */ new Set();
|
|
|
12242
12258
|
var discoveredPathsMaxSize2 = 1e3;
|
|
12243
12259
|
var discoveredPaths2 = /* @__PURE__ */ new Set();
|
|
12244
12260
|
var URL_LIMIT2 = 7680;
|
|
12245
|
-
async function fetchAndApplyManifestPatches2(paths, decode2, signal) {
|
|
12261
|
+
async function fetchAndApplyManifestPatches2(paths, decode2, fetchImplementation, signal) {
|
|
12246
12262
|
let basename = (window.__router.basename ?? "").replace(/^\/|\/$/g, "");
|
|
12247
12263
|
let url = new URL(`${basename}/.manifest`, window.location.origin);
|
|
12248
12264
|
paths.sort().forEach((path) => url.searchParams.append("p", path));
|
|
@@ -12250,7 +12266,7 @@ async function fetchAndApplyManifestPatches2(paths, decode2, signal) {
|
|
|
12250
12266
|
nextPaths2.clear();
|
|
12251
12267
|
return;
|
|
12252
12268
|
}
|
|
12253
|
-
let response = await
|
|
12269
|
+
let response = await fetchImplementation(new Request(url, { signal }));
|
|
12254
12270
|
if (!response.body || response.status < 200 || response.status >= 300) {
|
|
12255
12271
|
throw new Error("Unable to fetch new route matches from the server");
|
|
12256
12272
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-ab9ed70c6
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -135,7 +135,7 @@ import {
|
|
|
135
135
|
withComponentProps,
|
|
136
136
|
withErrorBoundaryProps,
|
|
137
137
|
withHydrateFallbackProps
|
|
138
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-OMKPJEIF.mjs";
|
|
139
139
|
export {
|
|
140
140
|
Await,
|
|
141
141
|
BrowserRouter,
|