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