react-router 0.0.0-experimental-4303fcb98 → 0.0.0-experimental-d431f1b65
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-Dr0PjLWi.d.mts} +5 -2
- package/dist/development/{chunk-3HEPIEBR.mjs → chunk-F37344ZN.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 +5 -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.d.mts +4 -1
- package/dist/development/rsc-export.d.ts +4 -1
- package/dist/development/rsc-export.js +16 -6
- package/dist/development/rsc-export.mjs +16 -6
- package/dist/production/{browser-DQVA_cmy.d.mts → browser-Dr0PjLWi.d.mts} +5 -2
- package/dist/production/{chunk-EOWVQJO2.mjs → chunk-LTAAPV3T.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 +5 -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.d.mts +4 -1
- package/dist/production/rsc-export.d.ts +4 -1
- package/dist/production/rsc-export.js +16 -6
- package/dist/production/rsc-export.mjs +16 -6
- package/package.json +1 -1
|
@@ -2168,6 +2168,7 @@ type ServerRenderPayload = {
|
|
|
2168
2168
|
matches: ServerRouteMatch[];
|
|
2169
2169
|
patches?: RenderedRoute[];
|
|
2170
2170
|
nonce?: string;
|
|
2171
|
+
formState?: unknown;
|
|
2171
2172
|
};
|
|
2172
2173
|
type ServerManifestPayload = {
|
|
2173
2174
|
type: "manifest";
|
|
@@ -2196,12 +2197,14 @@ declare global {
|
|
|
2196
2197
|
__routerActionID: number;
|
|
2197
2198
|
}
|
|
2198
2199
|
}
|
|
2199
|
-
declare function createCallServer({ decode, encodeAction, }: {
|
|
2200
|
+
declare function createCallServer({ decode, encodeAction, fetch: fetchImplementation, }: {
|
|
2200
2201
|
decode: DecodeServerResponseFunction;
|
|
2201
2202
|
encodeAction: EncodeActionFunction;
|
|
2203
|
+
fetch?: (request: Request) => Promise<Response>;
|
|
2202
2204
|
}): (id: string, args: unknown[]) => Promise<unknown>;
|
|
2203
|
-
declare function RSCHydratedRouter({ decode, payload, routeDiscovery, }: {
|
|
2205
|
+
declare function RSCHydratedRouter({ decode, fetch: fetchImplementation, payload, routeDiscovery, }: {
|
|
2204
2206
|
decode: DecodeServerResponseFunction;
|
|
2207
|
+
fetch?: (request: Request) => Promise<Response>;
|
|
2205
2208
|
payload: ServerPayload;
|
|
2206
2209
|
routeDiscovery?: "eager" | "lazy";
|
|
2207
2210
|
}): React.JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-d431f1b65
|
|
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-d431f1b65";
|
|
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-Dr0PjLWi.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-d431f1b65
|
|
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-F37344ZN.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-Dr0PjLWi.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-Dr0PjLWi.mjs';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import React__default, { ReactElement } from 'react';
|
|
7
7
|
import { ParseOptions, SerializeOptions } from 'cookie';
|
|
@@ -2546,6 +2546,7 @@ type ServerRenderPayload = {
|
|
|
2546
2546
|
matches: ServerRouteMatch[];
|
|
2547
2547
|
patches?: RenderedRoute[];
|
|
2548
2548
|
nonce?: string;
|
|
2549
|
+
formState?: unknown;
|
|
2549
2550
|
};
|
|
2550
2551
|
type ServerManifestPayload = {
|
|
2551
2552
|
type: "manifest";
|
|
@@ -2574,12 +2575,14 @@ declare global {
|
|
|
2574
2575
|
__routerActionID: number;
|
|
2575
2576
|
}
|
|
2576
2577
|
}
|
|
2577
|
-
declare function createCallServer({ decode, encodeAction, }: {
|
|
2578
|
+
declare function createCallServer({ decode, encodeAction, fetch: fetchImplementation, }: {
|
|
2578
2579
|
decode: DecodeServerResponseFunction;
|
|
2579
2580
|
encodeAction: EncodeActionFunction;
|
|
2581
|
+
fetch?: (request: Request) => Promise<Response>;
|
|
2580
2582
|
}): (id: string, args: unknown[]) => Promise<unknown>;
|
|
2581
|
-
declare function RSCHydratedRouter({ decode, payload, routeDiscovery, }: {
|
|
2583
|
+
declare function RSCHydratedRouter({ decode, fetch: fetchImplementation, payload, routeDiscovery, }: {
|
|
2582
2584
|
decode: DecodeServerResponseFunction;
|
|
2585
|
+
fetch?: (request: Request) => Promise<Response>;
|
|
2583
2586
|
payload: ServerPayload;
|
|
2584
2587
|
routeDiscovery?: "eager" | "lazy";
|
|
2585
2588
|
}): React.JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-d431f1b65
|
|
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-d431f1b65";
|
|
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-d431f1b65
|
|
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-F37344ZN.mjs";
|
|
139
139
|
export {
|
|
140
140
|
Await,
|
|
141
141
|
BrowserRouter,
|
|
@@ -1801,6 +1801,7 @@ type ServerRenderPayload = {
|
|
|
1801
1801
|
matches: ServerRouteMatch[];
|
|
1802
1802
|
patches?: RenderedRoute[];
|
|
1803
1803
|
nonce?: string;
|
|
1804
|
+
formState?: unknown;
|
|
1804
1805
|
};
|
|
1805
1806
|
type ServerManifestPayload = {
|
|
1806
1807
|
type: "manifest";
|
|
@@ -1826,9 +1827,11 @@ type ServerMatch = {
|
|
|
1826
1827
|
};
|
|
1827
1828
|
type DecodeCallServerFunction = (id: string, reply: FormData | string) => Promise<() => Promise<unknown>>;
|
|
1828
1829
|
type DecodeFormActionFunction = (formData: FormData) => Promise<() => Promise<void>>;
|
|
1829
|
-
|
|
1830
|
+
type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
|
|
1831
|
+
declare function matchRSCServerRequest({ decodeCallServer, decodeFormAction, decodeFormState, onError, request, routes, generateResponse, }: {
|
|
1830
1832
|
decodeCallServer?: DecodeCallServerFunction;
|
|
1831
1833
|
decodeFormAction?: DecodeFormActionFunction;
|
|
1834
|
+
decodeFormState?: DecodeFormStateFunction;
|
|
1832
1835
|
onError?: (error: unknown) => void;
|
|
1833
1836
|
request: Request;
|
|
1834
1837
|
routes: ServerRouteObject[];
|
|
@@ -1801,6 +1801,7 @@ type ServerRenderPayload = {
|
|
|
1801
1801
|
matches: ServerRouteMatch[];
|
|
1802
1802
|
patches?: RenderedRoute[];
|
|
1803
1803
|
nonce?: string;
|
|
1804
|
+
formState?: unknown;
|
|
1804
1805
|
};
|
|
1805
1806
|
type ServerManifestPayload = {
|
|
1806
1807
|
type: "manifest";
|
|
@@ -1826,9 +1827,11 @@ type ServerMatch = {
|
|
|
1826
1827
|
};
|
|
1827
1828
|
type DecodeCallServerFunction = (id: string, reply: FormData | string) => Promise<() => Promise<unknown>>;
|
|
1828
1829
|
type DecodeFormActionFunction = (formData: FormData) => Promise<() => Promise<void>>;
|
|
1829
|
-
|
|
1830
|
+
type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
|
|
1831
|
+
declare function matchRSCServerRequest({ decodeCallServer, decodeFormAction, decodeFormState, onError, request, routes, generateResponse, }: {
|
|
1830
1832
|
decodeCallServer?: DecodeCallServerFunction;
|
|
1831
1833
|
decodeFormAction?: DecodeFormActionFunction;
|
|
1834
|
+
decodeFormState?: DecodeFormStateFunction;
|
|
1832
1835
|
onError?: (error: unknown) => void;
|
|
1833
1836
|
request: Request;
|
|
1834
1837
|
routes: ServerRouteObject[];
|
|
@@ -25,7 +25,7 @@ function _interopNamespace(e) {
|
|
|
25
25
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* react-router v0.0.0-experimental-
|
|
28
|
+
* react-router v0.0.0-experimental-d431f1b65
|
|
29
29
|
*
|
|
30
30
|
* Copyright (c) Remix Software Inc.
|
|
31
31
|
*
|
|
@@ -2448,6 +2448,7 @@ function prependCookies(parentHeaders, childHeaders) {
|
|
|
2448
2448
|
async function matchRSCServerRequest({
|
|
2449
2449
|
decodeCallServer,
|
|
2450
2450
|
decodeFormAction,
|
|
2451
|
+
decodeFormState,
|
|
2451
2452
|
onError,
|
|
2452
2453
|
request,
|
|
2453
2454
|
routes,
|
|
@@ -2494,6 +2495,7 @@ async function matchRSCServerRequest({
|
|
|
2494
2495
|
isDataRequest,
|
|
2495
2496
|
decodeCallServer,
|
|
2496
2497
|
decodeFormAction,
|
|
2498
|
+
decodeFormState,
|
|
2497
2499
|
onError,
|
|
2498
2500
|
generateResponse
|
|
2499
2501
|
);
|
|
@@ -2534,7 +2536,7 @@ async function generateManifestResponse(routes, request, generateResponse) {
|
|
|
2534
2536
|
payload
|
|
2535
2537
|
});
|
|
2536
2538
|
}
|
|
2537
|
-
async function processServerAction(request, decodeCallServer, decodeFormAction, onError) {
|
|
2539
|
+
async function processServerAction(request, decodeCallServer, decodeFormAction, decodeFormState, onError) {
|
|
2538
2540
|
const getRevalidationRequest = () => new Request(request.url, {
|
|
2539
2541
|
method: "GET",
|
|
2540
2542
|
headers: request.headers,
|
|
@@ -2574,8 +2576,10 @@ async function processServerAction(request, decodeCallServer, decodeFormAction,
|
|
|
2574
2576
|
);
|
|
2575
2577
|
}
|
|
2576
2578
|
const action = await decodeFormAction(formData);
|
|
2579
|
+
let formState = void 0;
|
|
2577
2580
|
try {
|
|
2578
|
-
await action();
|
|
2581
|
+
const result = await action();
|
|
2582
|
+
formState = decodeFormState?.(result, formData);
|
|
2579
2583
|
} catch (error) {
|
|
2580
2584
|
if (isResponse(error)) {
|
|
2581
2585
|
return error;
|
|
@@ -2583,6 +2587,7 @@ async function processServerAction(request, decodeCallServer, decodeFormAction,
|
|
|
2583
2587
|
onError?.(error);
|
|
2584
2588
|
}
|
|
2585
2589
|
return {
|
|
2590
|
+
formState,
|
|
2586
2591
|
revalidationRequest: getRevalidationRequest()
|
|
2587
2592
|
};
|
|
2588
2593
|
}
|
|
@@ -2628,7 +2633,7 @@ async function generateResourceResponse(request, routes, routeId, onError) {
|
|
|
2628
2633
|
headers
|
|
2629
2634
|
});
|
|
2630
2635
|
}
|
|
2631
|
-
async function generateRenderResponse(request, routes, isDataRequest, decodeCallServer, decodeFormAction, onError, generateResponse) {
|
|
2636
|
+
async function generateRenderResponse(request, routes, isDataRequest, decodeCallServer, decodeFormAction, decodeFormState, onError, generateResponse) {
|
|
2632
2637
|
let statusCode = 200;
|
|
2633
2638
|
let url = new URL(request.url);
|
|
2634
2639
|
let isSubmission = isMutationMethod(request.method);
|
|
@@ -2644,17 +2649,20 @@ async function generateRenderResponse(request, routes, isDataRequest, decodeCall
|
|
|
2644
2649
|
...routeIdsToLoad ? { filterMatchesToLoad: (m) => routeIdsToLoad.includes(m.route.id) } : null,
|
|
2645
2650
|
async unstable_stream(_, query) {
|
|
2646
2651
|
let actionResult;
|
|
2652
|
+
let formState;
|
|
2647
2653
|
if (request.method === "POST") {
|
|
2648
2654
|
let result2 = await processServerAction(
|
|
2649
2655
|
request,
|
|
2650
2656
|
decodeCallServer,
|
|
2651
2657
|
decodeFormAction,
|
|
2658
|
+
decodeFormState,
|
|
2652
2659
|
onError
|
|
2653
2660
|
);
|
|
2654
2661
|
if (isResponse(result2)) {
|
|
2655
2662
|
return generateRedirectResponse(statusCode, result2, generateResponse);
|
|
2656
2663
|
}
|
|
2657
2664
|
actionResult = result2?.actionResult;
|
|
2665
|
+
formState = result2?.formState;
|
|
2658
2666
|
request = result2?.revalidationRequest ?? request;
|
|
2659
2667
|
}
|
|
2660
2668
|
let staticContext = await query(request);
|
|
@@ -2673,6 +2681,7 @@ async function generateRenderResponse(request, routes, isDataRequest, decodeCall
|
|
|
2673
2681
|
isDataRequest,
|
|
2674
2682
|
isSubmission,
|
|
2675
2683
|
actionResult,
|
|
2684
|
+
formState,
|
|
2676
2685
|
staticContext
|
|
2677
2686
|
);
|
|
2678
2687
|
}
|
|
@@ -2700,7 +2709,7 @@ function generateRedirectResponse(statusCode, response, generateResponse) {
|
|
|
2700
2709
|
payload
|
|
2701
2710
|
});
|
|
2702
2711
|
}
|
|
2703
|
-
async function generateStaticContextResponse(routes, generateResponse, statusCode, routeIdsToLoad, isDataRequest, isSubmission, actionResult, staticContext) {
|
|
2712
|
+
async function generateStaticContextResponse(routes, generateResponse, statusCode, routeIdsToLoad, isDataRequest, isSubmission, actionResult, formState, staticContext) {
|
|
2704
2713
|
statusCode = staticContext.statusCode ?? statusCode;
|
|
2705
2714
|
if (staticContext.errors) {
|
|
2706
2715
|
staticContext.errors = Object.fromEntries(
|
|
@@ -2724,7 +2733,8 @@ async function generateStaticContextResponse(routes, generateResponse, statusCod
|
|
|
2724
2733
|
actionData: staticContext.actionData,
|
|
2725
2734
|
errors: staticContext.errors,
|
|
2726
2735
|
loaderData: staticContext.loaderData,
|
|
2727
|
-
location: staticContext.location
|
|
2736
|
+
location: staticContext.location,
|
|
2737
|
+
formState
|
|
2728
2738
|
};
|
|
2729
2739
|
const renderPayloadPromise = () => getRenderPayload(
|
|
2730
2740
|
baseRenderPayload,
|