react-router 0.0.0-experimental-e0b6ce9 → 0.0.0-experimental-de3b900

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