react-router 7.9.4 → 7.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -0
- package/dist/development/browser-BbBXFHbO.d.ts +310 -0
- package/dist/development/browser-C07r42Tt.d.mts +310 -0
- package/dist/development/{chunk-OIYGIGL5.mjs → chunk-4WY6JWTD.mjs} +458 -43
- package/dist/development/{chunk-DI2QHYMJ.js → chunk-AMVS5XVJ.js} +1314 -138
- package/dist/development/{chunk-WY5IRSCW.mjs → chunk-G3INQAYP.mjs} +197 -857
- package/dist/development/chunk-O4JVZSOY.js +1310 -0
- package/dist/development/chunk-PZWDWJAY.js +188 -0
- package/dist/development/dom-export.d.mts +103 -6
- package/dist/development/dom-export.d.ts +103 -4
- package/dist/development/dom-export.js +708 -20
- package/dist/development/dom-export.mjs +692 -11
- package/dist/{production/index-react-server-client-BbRcBjrA.d.ts → development/index-react-server-client-Da3kmxNd.d.ts} +195 -135
- package/dist/{production/index-react-server-client-BIz4AUNd.d.mts → development/index-react-server-client-rcoGPJhU.d.mts} +137 -78
- package/dist/development/index-react-server-client.d.mts +2 -3
- package/dist/development/index-react-server-client.d.ts +2 -2
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.d.mts +107 -3
- package/dist/development/index-react-server.d.ts +107 -3
- package/dist/development/index-react-server.js +259 -13
- package/dist/development/index-react-server.mjs +259 -13
- package/dist/development/index.d.mts +14 -320
- package/dist/development/index.d.ts +14 -362
- package/dist/development/index.js +146 -962
- package/dist/development/index.mjs +3 -9
- package/dist/development/{routeModules-D5iJ6JYT.d.ts → instrumentation-Unc20tLk.d.ts} +178 -25
- package/dist/development/lib/types/internal.d.mts +2 -3
- package/dist/development/lib/types/internal.d.ts +2 -2
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/{production/register-C34pU-in.d.ts → development/register-BpU9rFBJ.d.ts} +1 -1
- package/dist/development/{register-CI4bTprK.d.mts → register-QkB3HGjm.d.mts} +1 -1
- package/dist/{production/context-DSyS5mLj.d.mts → development/router-CAvh_Drx.d.mts} +1877 -1254
- package/dist/production/browser-BbBXFHbO.d.ts +310 -0
- package/dist/production/browser-C07r42Tt.d.mts +310 -0
- package/dist/production/{chunk-4E5LHRQP.js → chunk-EAIF67OW.js} +1314 -138
- package/dist/production/{chunk-FR6HSPLK.mjs → chunk-FDUMZGKM.mjs} +197 -857
- package/dist/production/{chunk-3TADTUL4.mjs → chunk-FUSXQSWG.mjs} +458 -43
- package/dist/production/chunk-G5A35OQU.js +188 -0
- package/dist/production/chunk-QN64DHI4.js +1310 -0
- package/dist/production/dom-export.d.mts +103 -6
- package/dist/production/dom-export.d.ts +103 -4
- package/dist/production/dom-export.js +708 -20
- package/dist/production/dom-export.mjs +692 -11
- package/dist/{development/index-react-server-client-BIz4AUNd.d.mts → production/index-react-server-client-Da3kmxNd.d.ts} +137 -78
- package/dist/{development/index-react-server-client-BbRcBjrA.d.ts → production/index-react-server-client-rcoGPJhU.d.mts} +195 -135
- package/dist/production/index-react-server-client.d.mts +2 -3
- package/dist/production/index-react-server-client.d.ts +2 -2
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.d.mts +107 -3
- package/dist/production/index-react-server.d.ts +107 -3
- package/dist/production/index-react-server.js +259 -13
- package/dist/production/index-react-server.mjs +259 -13
- package/dist/production/index.d.mts +14 -320
- package/dist/production/index.d.ts +14 -362
- package/dist/production/index.js +146 -962
- package/dist/production/index.mjs +3 -9
- package/dist/production/{routeModules-D5iJ6JYT.d.ts → instrumentation-Unc20tLk.d.ts} +178 -25
- package/dist/production/lib/types/internal.d.mts +2 -3
- package/dist/production/lib/types/internal.d.ts +2 -2
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/{development/register-C34pU-in.d.ts → production/register-BpU9rFBJ.d.ts} +1 -1
- package/dist/production/{register-CI4bTprK.d.mts → register-QkB3HGjm.d.mts} +1 -1
- package/dist/{development/context-DSyS5mLj.d.mts → production/router-CAvh_Drx.d.mts} +1877 -1254
- package/package.json +1 -1
- package/dist/development/browser-z32v5KVN.d.mts +0 -46
- package/dist/development/chunk-72XNTZCV.js +0 -2089
- package/dist/development/route-data-DZQOUSqV.d.mts +0 -473
- package/dist/production/browser-z32v5KVN.d.mts +0 -46
- package/dist/production/chunk-WNLQ53P5.js +0 -2089
- package/dist/production/route-data-DZQOUSqV.d.mts +0 -473
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { p as Router, q as RouteModules, r as DataStrategyFunction, s as MiddlewareEnabled, c as RouterContextProvider, t as AppLoadContext, T as To, v as NavigateOptions, B as BlockerFunction, w as Blocker, x as SerializeFrom, y as RelativeRoutingType, L as Location, z as ParamParseKey, E as Path, I as PathPattern, J as PathMatch, U as UIMatch, K as Navigation, O as Action, P as Params, Q as RouteObject, G as GetLoaderData, o as GetActionData, V as InitialEntry, W as HydrationState, X as IndexRouteObject, Y as RouteComponentType, Z as HydrateFallbackType, _ as ErrorBoundaryType, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, $ as NonIndexRouteObject, a0 as Equal, a1 as RouterState, a2 as PatchRoutesOnNavigationFunction, a3 as DataRouteObject, a as ClientLoaderFunction } from './router-CAvh_Drx.mjs';
|
|
2
|
+
export { ae as ActionFunctionArgs, b1 as Await, aS as AwaitProps, C as ClientActionFunction, bd as ClientActionFunctionArgs, be as ClientLoaderFunctionArgs, aN as DataRouteMatch, af as DataStrategyFunctionArgs, ag as DataStrategyMatch, D as DataStrategyResult, ai as ErrorResponse, a8 as Fetcher, aj as FormEncType, ak as FormMethod, bj as Future, a5 as GetScrollPositionFunction, a6 as GetScrollRestorationKeyFunction, al as HTMLFormMethod, bf as HeadersArgs, H as HeadersFunction, bi as HtmlLinkDescriptor, aD as IDLE_BLOCKER, aC as IDLE_FETCHER, aB as IDLE_NAVIGATION, aT as IndexRouteProps, aU as LayoutRouteProps, am as LazyRouteFunction, h as LinkDescriptor, an as LoaderFunctionArgs, b2 as MemoryRouter, aV as MemoryRouterOpts, aW as MemoryRouterProps, bg as MetaArgs, j as MetaDescriptor, ao as MiddlewareFunction, b3 as Navigate, aX as NavigateProps, a9 as NavigationStates, aO as Navigator, b4 as Outlet, aY as OutletProps, bh as PageLinkDescriptor, aP as PatchRoutesOnNavigationFunctionArgs, ap as PathParam, aZ as PathRouteProps, aq as RedirectFunction, ad as RevalidationState, b5 as Route, aQ as RouteMatch, a_ as RouteProps, b6 as Router, ar as RouterContext, ac as RouterFetchOptions, e as RouterInit, ab as RouterNavigateOptions, a$ as RouterProps, b7 as RouterProvider, f as RouterProviderProps, aa as RouterSubscriber, b8 as Routes, b0 as RoutesProps, S as ShouldRevalidateFunction, as as ShouldRevalidateFunctionArgs, a4 as StaticHandler, a7 as StaticHandlerContext, aR as UNSAFE_AwaitContextProvider, bp as UNSAFE_DataRouterContext, bq as UNSAFE_DataRouterStateContext, ah as UNSAFE_DataWithResponseInit, bo as UNSAFE_ErrorResponseImpl, br as UNSAFE_FetchersContext, bs as UNSAFE_LocationContext, bt as UNSAFE_NavigationContext, bu as UNSAFE_RouteContext, bv as UNSAFE_ViewTransitionContext, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps, bl as UNSAFE_createBrowserHistory, bn as UNSAFE_createRouter, bw as UNSAFE_hydrationRouteProperties, bm as UNSAFE_invariant, bx as UNSAFE_mapRouteProperties, bz as UNSAFE_withComponentProps, bD as UNSAFE_withErrorBoundaryProps, bB as UNSAFE_withHydrateFallbackProps, at as createContext, b9 as createMemoryRouter, au as createPath, ba as createRoutesFromChildren, bb as createRoutesFromElements, aE as data, aF as generatePath, aG as isRouteErrorResponse, aH as matchPath, aI as matchRoutes, av as parsePath, aJ as redirect, aK as redirectDocument, bc as renderMatches, aL as replace, aM as resolvePath, u as unstable_ClientInstrumentation, g as unstable_ClientOnErrorFunction, ax as unstable_InstrumentRequestHandlerFunction, az as unstable_InstrumentRouteFunction, ay as unstable_InstrumentRouterFunction, aA as unstable_InstrumentationHandlerResult, bk as unstable_SerializesTo, aw as unstable_ServerInstrumentation } from './router-CAvh_Drx.mjs';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import React__default, { ReactElement } from 'react';
|
|
5
|
-
import {
|
|
6
|
-
export {
|
|
7
|
-
import {
|
|
8
|
-
export { b as
|
|
9
|
-
import { A as AssetsManifest, E as EntryContext, F as FutureConfig, S as ServerBuild } from './index-react-server-client-BIz4AUNd.mjs';
|
|
10
|
-
export { l as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, a1 as DiscoverBehavior, c as FetcherFormProps, h as FetcherSubmitFunction, G as FetcherSubmitOptions, i as FetcherWithComponents, q as Form, d as FormProps, a2 as HandleDataRequestFunction, a3 as HandleDocumentRequestFunction, a4 as HandleErrorFunction, m as HashRouter, H as HashRouterProps, a as HistoryRouterProps, n as Link, L as LinkProps, X as Links, _ as LinksProps, W as Meta, p as NavLink, N as NavLinkProps, b as NavLinkRenderProps, P as ParamKeyValuePair, a0 as PrefetchBehavior, Z as PrefetchPageLinks, Y as Scripts, $ as ScriptsProps, r as ScrollRestoration, e as ScrollRestorationProps, a5 as ServerEntryModule, f as SetURLSearchParams, T as StaticRouter, M as StaticRouterProps, V as StaticRouterProvider, O as StaticRouterProviderProps, g as SubmitFunction, I as SubmitOptions, J as SubmitTarget, a6 as UNSAFE_FrameworkContext, a7 as UNSAFE_createClientRoutes, a8 as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, a9 as UNSAFE_shouldHydrateRouteLoader, aa as UNSAFE_useScrollRestoration, U as URLSearchParamsInit, j as createBrowserRouter, k as createHashRouter, K as createSearchParams, Q as createStaticHandler, R as createStaticRouter, o as unstable_HistoryRouter, z as unstable_usePrompt, y as useBeforeUnload, w as useFetcher, x as useFetchers, v as useFormAction, u as useLinkClickHandler, s as useSearchParams, t as useSubmit, C as useViewTransitionState } from './index-react-server-client-BIz4AUNd.mjs';
|
|
5
|
+
import { a as RouteModules$1, P as Pages } from './register-QkB3HGjm.mjs';
|
|
6
|
+
export { b as Register } from './register-QkB3HGjm.mjs';
|
|
7
|
+
import { A as AssetsManifest, S as ServerBuild, E as EntryContext, F as FutureConfig } from './index-react-server-client-rcoGPJhU.mjs';
|
|
8
|
+
export { l as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, a1 as DiscoverBehavior, c as FetcherFormProps, h as FetcherSubmitFunction, G as FetcherSubmitOptions, i as FetcherWithComponents, q as Form, d as FormProps, a2 as HandleDataRequestFunction, a3 as HandleDocumentRequestFunction, a4 as HandleErrorFunction, m as HashRouter, H as HashRouterProps, a as HistoryRouterProps, n as Link, L as LinkProps, X as Links, _ as LinksProps, W as Meta, p as NavLink, N as NavLinkProps, b as NavLinkRenderProps, P as ParamKeyValuePair, a0 as PrefetchBehavior, Z as PrefetchPageLinks, Y as Scripts, $ as ScriptsProps, r as ScrollRestoration, e as ScrollRestorationProps, a5 as ServerEntryModule, f as SetURLSearchParams, T as StaticRouter, M as StaticRouterProps, V as StaticRouterProvider, O as StaticRouterProviderProps, g as SubmitFunction, I as SubmitOptions, J as SubmitTarget, a6 as UNSAFE_FrameworkContext, a7 as UNSAFE_createClientRoutes, a8 as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, a9 as UNSAFE_shouldHydrateRouteLoader, aa as UNSAFE_useScrollRestoration, U as URLSearchParamsInit, j as createBrowserRouter, k as createHashRouter, K as createSearchParams, Q as createStaticHandler, R as createStaticRouter, o as unstable_HistoryRouter, z as unstable_usePrompt, y as useBeforeUnload, w as useFetcher, x as useFetchers, v as useFormAction, u as useLinkClickHandler, s as useSearchParams, t as useSubmit, C as useViewTransitionState } from './index-react-server-client-rcoGPJhU.mjs';
|
|
11
9
|
import { ParseOptions, SerializeOptions } from 'cookie';
|
|
12
10
|
export { ParseOptions as CookieParseOptions, SerializeOptions as CookieSerializeOptions } from 'cookie';
|
|
13
|
-
|
|
11
|
+
import { e as RSCPayload, m as matchRSCServerRequest } from './browser-C07r42Tt.mjs';
|
|
12
|
+
export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, g as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, h as unstable_RSCMatch, f as unstable_RSCRenderPayload, l as unstable_RSCRouteConfig, k as unstable_RSCRouteConfigEntry, i as unstable_RSCRouteManifest, j as unstable_RSCRouteMatch } from './browser-C07r42Tt.mjs';
|
|
14
13
|
|
|
15
14
|
declare const SingleFetchRedirectSymbol: unique symbol;
|
|
16
15
|
declare function getTurboStreamSingleFetchDataStrategy(getRouter: () => Router, manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, basename: string | undefined): DataStrategyFunction;
|
|
@@ -28,6 +27,10 @@ declare enum ServerMode {
|
|
|
28
27
|
Test = "test"
|
|
29
28
|
}
|
|
30
29
|
|
|
30
|
+
type RequestHandler = (request: Request, loadContext?: MiddlewareEnabled extends true ? RouterContextProvider : AppLoadContext) => Promise<Response>;
|
|
31
|
+
type CreateRequestHandlerFunction = (build: ServerBuild | (() => ServerBuild | Promise<ServerBuild>), mode?: string) => RequestHandler;
|
|
32
|
+
declare const createRequestHandler: CreateRequestHandlerFunction;
|
|
33
|
+
|
|
31
34
|
/**
|
|
32
35
|
* Resolves a URL against the current {@link Location}.
|
|
33
36
|
*
|
|
@@ -864,6 +867,7 @@ declare function useBlocker(shouldBlock: boolean | BlockerFunction): Blocker;
|
|
|
864
867
|
type UseRouteArgs = [] | [routeId: keyof RouteModules$1];
|
|
865
868
|
type UseRouteResult<Args extends UseRouteArgs> = Args extends [] ? UseRoute<unknown> : Args extends ["root"] ? UseRoute<"root"> : Args extends [infer RouteId extends keyof RouteModules$1] ? UseRoute<RouteId> | undefined : never;
|
|
866
869
|
type UseRoute<RouteId extends keyof RouteModules$1 | unknown> = {
|
|
870
|
+
handle: RouteId extends keyof RouteModules$1 ? RouteModules$1[RouteId]["handle"] : unknown;
|
|
867
871
|
loaderData: RouteId extends keyof RouteModules$1 ? GetLoaderData<RouteModules$1[RouteId]> | undefined : unknown;
|
|
868
872
|
actionData: RouteId extends keyof RouteModules$1 ? GetActionData<RouteModules$1[RouteId]> | undefined : unknown;
|
|
869
873
|
};
|
|
@@ -1014,10 +1018,6 @@ type IsCookieFunction = (object: any) => object is Cookie;
|
|
|
1014
1018
|
*/
|
|
1015
1019
|
declare const isCookie: IsCookieFunction;
|
|
1016
1020
|
|
|
1017
|
-
type RequestHandler = (request: Request, loadContext?: MiddlewareEnabled extends true ? RouterContextProvider : AppLoadContext) => Promise<Response>;
|
|
1018
|
-
type CreateRequestHandlerFunction = (build: ServerBuild | (() => ServerBuild | Promise<ServerBuild>), mode?: string) => RequestHandler;
|
|
1019
|
-
declare const createRequestHandler: CreateRequestHandlerFunction;
|
|
1020
|
-
|
|
1021
1021
|
/**
|
|
1022
1022
|
* An object of name/value pairs to be used in the session.
|
|
1023
1023
|
*/
|
|
@@ -1211,312 +1211,6 @@ type ToArgs<Params extends Record<string, string | undefined>> = Equal<Params, {
|
|
|
1211
1211
|
*/
|
|
1212
1212
|
declare function href<Path extends keyof Args>(path: Path, ...args: Args[Path]): string;
|
|
1213
1213
|
|
|
1214
|
-
type RSCRouteConfigEntryBase = {
|
|
1215
|
-
action?: ActionFunction;
|
|
1216
|
-
clientAction?: ClientActionFunction;
|
|
1217
|
-
clientLoader?: ClientLoaderFunction;
|
|
1218
|
-
ErrorBoundary?: React.ComponentType<any>;
|
|
1219
|
-
handle?: any;
|
|
1220
|
-
headers?: HeadersFunction;
|
|
1221
|
-
HydrateFallback?: React.ComponentType<any>;
|
|
1222
|
-
Layout?: React.ComponentType<any>;
|
|
1223
|
-
links?: LinksFunction;
|
|
1224
|
-
loader?: LoaderFunction;
|
|
1225
|
-
meta?: MetaFunction;
|
|
1226
|
-
shouldRevalidate?: ShouldRevalidateFunction;
|
|
1227
|
-
};
|
|
1228
|
-
type RSCRouteConfigEntry = RSCRouteConfigEntryBase & {
|
|
1229
|
-
id: string;
|
|
1230
|
-
path?: string;
|
|
1231
|
-
Component?: React.ComponentType<any>;
|
|
1232
|
-
lazy?: () => Promise<RSCRouteConfigEntryBase & ({
|
|
1233
|
-
default?: React.ComponentType<any>;
|
|
1234
|
-
Component?: never;
|
|
1235
|
-
} | {
|
|
1236
|
-
default?: never;
|
|
1237
|
-
Component?: React.ComponentType<any>;
|
|
1238
|
-
})>;
|
|
1239
|
-
} & ({
|
|
1240
|
-
index: true;
|
|
1241
|
-
} | {
|
|
1242
|
-
children?: RSCRouteConfigEntry[];
|
|
1243
|
-
});
|
|
1244
|
-
type RSCRouteConfig = Array<RSCRouteConfigEntry>;
|
|
1245
|
-
type RSCRouteManifest = {
|
|
1246
|
-
clientAction?: ClientActionFunction;
|
|
1247
|
-
clientLoader?: ClientLoaderFunction;
|
|
1248
|
-
element?: React.ReactElement | false;
|
|
1249
|
-
errorElement?: React.ReactElement;
|
|
1250
|
-
handle?: any;
|
|
1251
|
-
hasAction: boolean;
|
|
1252
|
-
hasComponent: boolean;
|
|
1253
|
-
hasErrorBoundary: boolean;
|
|
1254
|
-
hasLoader: boolean;
|
|
1255
|
-
hydrateFallbackElement?: React.ReactElement;
|
|
1256
|
-
id: string;
|
|
1257
|
-
index?: boolean;
|
|
1258
|
-
links?: LinksFunction;
|
|
1259
|
-
meta?: MetaFunction;
|
|
1260
|
-
parentId?: string;
|
|
1261
|
-
path?: string;
|
|
1262
|
-
shouldRevalidate?: ShouldRevalidateFunction;
|
|
1263
|
-
};
|
|
1264
|
-
type RSCRouteMatch = RSCRouteManifest & {
|
|
1265
|
-
params: Params;
|
|
1266
|
-
pathname: string;
|
|
1267
|
-
pathnameBase: string;
|
|
1268
|
-
};
|
|
1269
|
-
type RSCRenderPayload = {
|
|
1270
|
-
type: "render";
|
|
1271
|
-
actionData: Record<string, any> | null;
|
|
1272
|
-
basename: string | undefined;
|
|
1273
|
-
errors: Record<string, any> | null;
|
|
1274
|
-
loaderData: Record<string, any>;
|
|
1275
|
-
location: Location;
|
|
1276
|
-
matches: RSCRouteMatch[];
|
|
1277
|
-
patches?: RSCRouteManifest[];
|
|
1278
|
-
nonce?: string;
|
|
1279
|
-
formState?: unknown;
|
|
1280
|
-
};
|
|
1281
|
-
type RSCManifestPayload = {
|
|
1282
|
-
type: "manifest";
|
|
1283
|
-
patches: RSCRouteManifest[];
|
|
1284
|
-
};
|
|
1285
|
-
type RSCActionPayload = {
|
|
1286
|
-
type: "action";
|
|
1287
|
-
actionResult: Promise<unknown>;
|
|
1288
|
-
rerender?: Promise<RSCRenderPayload | RSCRedirectPayload>;
|
|
1289
|
-
};
|
|
1290
|
-
type RSCRedirectPayload = {
|
|
1291
|
-
type: "redirect";
|
|
1292
|
-
status: number;
|
|
1293
|
-
location: string;
|
|
1294
|
-
replace: boolean;
|
|
1295
|
-
reload: boolean;
|
|
1296
|
-
actionResult?: Promise<unknown>;
|
|
1297
|
-
};
|
|
1298
|
-
type RSCPayload = RSCRenderPayload | RSCManifestPayload | RSCActionPayload | RSCRedirectPayload;
|
|
1299
|
-
type RSCMatch = {
|
|
1300
|
-
statusCode: number;
|
|
1301
|
-
headers: Headers;
|
|
1302
|
-
payload: RSCPayload;
|
|
1303
|
-
};
|
|
1304
|
-
type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>;
|
|
1305
|
-
type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
|
|
1306
|
-
type DecodeReplyFunction = (reply: FormData | string, { temporaryReferences }: {
|
|
1307
|
-
temporaryReferences: unknown;
|
|
1308
|
-
}) => Promise<unknown[]>;
|
|
1309
|
-
type LoadServerActionFunction = (id: string) => Promise<Function>;
|
|
1310
|
-
/**
|
|
1311
|
-
* Matches the given routes to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
|
1312
|
-
* and returns an [RSC](https://react.dev/reference/rsc/server-components)
|
|
1313
|
-
* [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
|
1314
|
-
* encoding an {@link unstable_RSCPayload} for consumption by an [RSC](https://react.dev/reference/rsc/server-components)
|
|
1315
|
-
* enabled client router.
|
|
1316
|
-
*
|
|
1317
|
-
* @example
|
|
1318
|
-
* import {
|
|
1319
|
-
* createTemporaryReferenceSet,
|
|
1320
|
-
* decodeAction,
|
|
1321
|
-
* decodeReply,
|
|
1322
|
-
* loadServerAction,
|
|
1323
|
-
* renderToReadableStream,
|
|
1324
|
-
* } from "@vitejs/plugin-rsc/rsc";
|
|
1325
|
-
* import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router";
|
|
1326
|
-
*
|
|
1327
|
-
* matchRSCServerRequest({
|
|
1328
|
-
* createTemporaryReferenceSet,
|
|
1329
|
-
* decodeAction,
|
|
1330
|
-
* decodeFormState,
|
|
1331
|
-
* decodeReply,
|
|
1332
|
-
* loadServerAction,
|
|
1333
|
-
* request,
|
|
1334
|
-
* routes: routes(),
|
|
1335
|
-
* generateResponse(match) {
|
|
1336
|
-
* return new Response(
|
|
1337
|
-
* renderToReadableStream(match.payload),
|
|
1338
|
-
* {
|
|
1339
|
-
* status: match.statusCode,
|
|
1340
|
-
* headers: match.headers,
|
|
1341
|
-
* }
|
|
1342
|
-
* );
|
|
1343
|
-
* },
|
|
1344
|
-
* });
|
|
1345
|
-
*
|
|
1346
|
-
* @name unstable_matchRSCServerRequest
|
|
1347
|
-
* @public
|
|
1348
|
-
* @category RSC
|
|
1349
|
-
* @mode data
|
|
1350
|
-
* @param opts Options
|
|
1351
|
-
* @param opts.basename The basename to use when matching the request.
|
|
1352
|
-
* @param opts.createTemporaryReferenceSet A function that returns a temporary
|
|
1353
|
-
* reference set for the request, used to track temporary references in the [RSC](https://react.dev/reference/rsc/server-components)
|
|
1354
|
-
* stream.
|
|
1355
|
-
* @param opts.decodeAction Your `react-server-dom-xyz/server`'s `decodeAction`
|
|
1356
|
-
* function, responsible for loading a server action.
|
|
1357
|
-
* @param opts.decodeFormState A function responsible for decoding form state for
|
|
1358
|
-
* progressively enhanceable forms with React's [`useActionState`](https://react.dev/reference/react/useActionState)
|
|
1359
|
-
* using your `react-server-dom-xyz/server`'s `decodeFormState`.
|
|
1360
|
-
* @param opts.decodeReply Your `react-server-dom-xyz/server`'s `decodeReply`
|
|
1361
|
-
* function, used to decode the server function's arguments and bind them to the
|
|
1362
|
-
* implementation for invocation by the router.
|
|
1363
|
-
* @param opts.generateResponse A function responsible for using your
|
|
1364
|
-
* `renderToReadableStream` to generate a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
|
1365
|
-
* encoding the {@link unstable_RSCPayload}.
|
|
1366
|
-
* @param opts.loadServerAction Your `react-server-dom-xyz/server`'s
|
|
1367
|
-
* `loadServerAction` function, used to load a server action by ID.
|
|
1368
|
-
* @param opts.onError An optional error handler that will be called with any
|
|
1369
|
-
* errors that occur during the request processing.
|
|
1370
|
-
* @param opts.request The [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
|
1371
|
-
* to match against.
|
|
1372
|
-
* @param opts.requestContext An instance of {@link RouterContextProvider}
|
|
1373
|
-
* that should be created per request, to be passed to [`action`](../../start/data/route-object#action)s,
|
|
1374
|
-
* [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
|
|
1375
|
-
* @param opts.routes Your {@link unstable_RSCRouteConfigEntry | route definitions}.
|
|
1376
|
-
* @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
|
1377
|
-
* that contains the [RSC](https://react.dev/reference/rsc/server-components)
|
|
1378
|
-
* data for hydration.
|
|
1379
|
-
*/
|
|
1380
|
-
declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename, decodeReply, requestContext, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
|
|
1381
|
-
createTemporaryReferenceSet: () => unknown;
|
|
1382
|
-
basename?: string;
|
|
1383
|
-
decodeReply?: DecodeReplyFunction;
|
|
1384
|
-
decodeAction?: DecodeActionFunction;
|
|
1385
|
-
decodeFormState?: DecodeFormStateFunction;
|
|
1386
|
-
requestContext?: RouterContextProvider;
|
|
1387
|
-
loadServerAction?: LoadServerActionFunction;
|
|
1388
|
-
onError?: (error: unknown) => void;
|
|
1389
|
-
request: Request;
|
|
1390
|
-
routes: RSCRouteConfigEntry[];
|
|
1391
|
-
generateResponse: (match: RSCMatch, { temporaryReferences, }: {
|
|
1392
|
-
temporaryReferences: unknown;
|
|
1393
|
-
}) => Response;
|
|
1394
|
-
}): Promise<Response>;
|
|
1395
|
-
|
|
1396
|
-
type BrowserCreateFromReadableStreamFunction = (body: ReadableStream<Uint8Array>, { temporaryReferences, }: {
|
|
1397
|
-
temporaryReferences: unknown;
|
|
1398
|
-
}) => Promise<unknown>;
|
|
1399
|
-
type EncodeReplyFunction = (args: unknown[], options: {
|
|
1400
|
-
temporaryReferences: unknown;
|
|
1401
|
-
}) => Promise<BodyInit>;
|
|
1402
|
-
/**
|
|
1403
|
-
* Create a React `callServer` implementation for React Router.
|
|
1404
|
-
*
|
|
1405
|
-
* @example
|
|
1406
|
-
* import {
|
|
1407
|
-
* createFromReadableStream,
|
|
1408
|
-
* createTemporaryReferenceSet,
|
|
1409
|
-
* encodeReply,
|
|
1410
|
-
* setServerCallback,
|
|
1411
|
-
* } from "@vitejs/plugin-rsc/browser";
|
|
1412
|
-
* import { unstable_createCallServer as createCallServer } from "react-router";
|
|
1413
|
-
*
|
|
1414
|
-
* setServerCallback(
|
|
1415
|
-
* createCallServer({
|
|
1416
|
-
* createFromReadableStream,
|
|
1417
|
-
* createTemporaryReferenceSet,
|
|
1418
|
-
* encodeReply,
|
|
1419
|
-
* })
|
|
1420
|
-
* );
|
|
1421
|
-
*
|
|
1422
|
-
* @name unstable_createCallServer
|
|
1423
|
-
* @public
|
|
1424
|
-
* @category RSC
|
|
1425
|
-
* @mode data
|
|
1426
|
-
* @param opts Options
|
|
1427
|
-
* @param opts.createFromReadableStream Your `react-server-dom-xyz/client`'s
|
|
1428
|
-
* `createFromReadableStream`. Used to decode payloads from the server.
|
|
1429
|
-
* @param opts.createTemporaryReferenceSet A function that creates a temporary
|
|
1430
|
-
* reference set for the [RSC](https://react.dev/reference/rsc/server-components)
|
|
1431
|
-
* payload.
|
|
1432
|
-
* @param opts.encodeReply Your `react-server-dom-xyz/client`'s `encodeReply`.
|
|
1433
|
-
* Used when sending payloads to the server.
|
|
1434
|
-
* @param opts.fetch Optional [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
|
|
1435
|
-
* implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch).
|
|
1436
|
-
* @returns A function that can be used to call server actions.
|
|
1437
|
-
*/
|
|
1438
|
-
declare function createCallServer({ createFromReadableStream, createTemporaryReferenceSet, encodeReply, fetch: fetchImplementation, }: {
|
|
1439
|
-
createFromReadableStream: BrowserCreateFromReadableStreamFunction;
|
|
1440
|
-
createTemporaryReferenceSet: () => unknown;
|
|
1441
|
-
encodeReply: EncodeReplyFunction;
|
|
1442
|
-
fetch?: (request: Request) => Promise<Response>;
|
|
1443
|
-
}): (id: string, args: unknown[]) => Promise<unknown>;
|
|
1444
|
-
/**
|
|
1445
|
-
* Props for the {@link unstable_RSCHydratedRouter} component.
|
|
1446
|
-
*
|
|
1447
|
-
* @name unstable_RSCHydratedRouterProps
|
|
1448
|
-
* @category Types
|
|
1449
|
-
*/
|
|
1450
|
-
interface RSCHydratedRouterProps {
|
|
1451
|
-
/**
|
|
1452
|
-
* Your `react-server-dom-xyz/client`'s `createFromReadableStream` function,
|
|
1453
|
-
* used to decode payloads from the server.
|
|
1454
|
-
*/
|
|
1455
|
-
createFromReadableStream: BrowserCreateFromReadableStreamFunction;
|
|
1456
|
-
/**
|
|
1457
|
-
* Optional fetch implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch).
|
|
1458
|
-
*/
|
|
1459
|
-
fetch?: (request: Request) => Promise<Response>;
|
|
1460
|
-
/**
|
|
1461
|
-
* The decoded {@link unstable_RSCPayload} to hydrate.
|
|
1462
|
-
*/
|
|
1463
|
-
payload: RSCPayload;
|
|
1464
|
-
/**
|
|
1465
|
-
* `"eager"` or `"lazy"` - Determines if links are eagerly discovered, or
|
|
1466
|
-
* delayed until clicked.
|
|
1467
|
-
*/
|
|
1468
|
-
routeDiscovery?: "eager" | "lazy";
|
|
1469
|
-
/**
|
|
1470
|
-
* A function that returns an {@link RouterContextProvider} instance
|
|
1471
|
-
* which is provided as the `context` argument to client [`action`](../../start/data/route-object#action)s,
|
|
1472
|
-
* [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
|
|
1473
|
-
* This function is called to generate a fresh `context` instance on each
|
|
1474
|
-
* navigation or fetcher call.
|
|
1475
|
-
*/
|
|
1476
|
-
getContext?: RouterInit["getContext"];
|
|
1477
|
-
}
|
|
1478
|
-
/**
|
|
1479
|
-
* Hydrates a server rendered {@link unstable_RSCPayload} in the browser.
|
|
1480
|
-
*
|
|
1481
|
-
* @example
|
|
1482
|
-
* import { startTransition, StrictMode } from "react";
|
|
1483
|
-
* import { hydrateRoot } from "react-dom/client";
|
|
1484
|
-
* import {
|
|
1485
|
-
* unstable_getRSCStream as getRSCStream,
|
|
1486
|
-
* unstable_RSCHydratedRouter as RSCHydratedRouter,
|
|
1487
|
-
* } from "react-router";
|
|
1488
|
-
* import type { unstable_RSCPayload as RSCPayload } from "react-router";
|
|
1489
|
-
*
|
|
1490
|
-
* createFromReadableStream(getRSCStream()).then((payload) =>
|
|
1491
|
-
* startTransition(async () => {
|
|
1492
|
-
* hydrateRoot(
|
|
1493
|
-
* document,
|
|
1494
|
-
* <StrictMode>
|
|
1495
|
-
* <RSCHydratedRouter
|
|
1496
|
-
* createFromReadableStream={createFromReadableStream}
|
|
1497
|
-
* payload={payload}
|
|
1498
|
-
* />
|
|
1499
|
-
* </StrictMode>,
|
|
1500
|
-
* { formState: await getFormState(payload) },
|
|
1501
|
-
* );
|
|
1502
|
-
* }),
|
|
1503
|
-
* );
|
|
1504
|
-
*
|
|
1505
|
-
* @name unstable_RSCHydratedRouter
|
|
1506
|
-
* @public
|
|
1507
|
-
* @category RSC
|
|
1508
|
-
* @mode data
|
|
1509
|
-
* @param props Props
|
|
1510
|
-
* @param {unstable_RSCHydratedRouterProps.createFromReadableStream} props.createFromReadableStream n/a
|
|
1511
|
-
* @param {unstable_RSCHydratedRouterProps.fetch} props.fetch n/a
|
|
1512
|
-
* @param {unstable_RSCHydratedRouterProps.getContext} props.getContext n/a
|
|
1513
|
-
* @param {unstable_RSCHydratedRouterProps.payload} props.payload n/a
|
|
1514
|
-
* @param {unstable_RSCHydratedRouterProps.routeDiscovery} props.routeDiscovery n/a
|
|
1515
|
-
* @returns A hydrated {@link DataRouter} that can be used to navigate and
|
|
1516
|
-
* render routes.
|
|
1517
|
-
*/
|
|
1518
|
-
declare function RSCHydratedRouter({ createFromReadableStream, fetch: fetchImplementation, payload, routeDiscovery, getContext, }: RSCHydratedRouterProps): React.JSX.Element;
|
|
1519
|
-
|
|
1520
1214
|
type DecodedPayload = Promise<RSCPayload> & {
|
|
1521
1215
|
_deepestRenderedBoundaryId?: string | null;
|
|
1522
1216
|
formState: Promise<any>;
|
|
@@ -1685,4 +1379,4 @@ declare function getHydrationData({ state, routes, getRouteInfo, location, basen
|
|
|
1685
1379
|
|
|
1686
1380
|
declare const unstable_matchRSCServerRequest: typeof matchRSCServerRequest;
|
|
1687
1381
|
|
|
1688
|
-
export { ActionFunction, AppLoadContext, Blocker, BlockerFunction,
|
|
1382
|
+
export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, Navigation, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|