react-router 7.9.4 → 7.9.5-pre.0

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 +35 -9
  2. package/dist/development/browser-DM83uryY.d.ts +310 -0
  3. package/dist/development/browser-DfMfSvsC.d.mts +310 -0
  4. package/dist/development/{chunk-OIYGIGL5.mjs → chunk-76L3QNAV.mjs} +365 -22
  5. package/dist/development/{chunk-WY5IRSCW.mjs → chunk-B6QYCHJF.mjs} +197 -857
  6. package/dist/development/chunk-FXLUBU25.js +1310 -0
  7. package/dist/development/chunk-KXZSW2DO.js +188 -0
  8. package/dist/development/{chunk-DI2QHYMJ.js → chunk-TSYPWE43.js} +1226 -122
  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-BIz4AUNd.d.mts → development/index-react-server-client-B0vnxMMk.d.mts} +137 -78
  14. package/dist/{production/index-react-server-client-BbRcBjrA.d.ts → development/index-react-server-client-BSxMvS7Z.d.ts} +195 -135
  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 +235 -10
  22. package/dist/development/index-react-server.mjs +235 -10
  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-iAqbU5Q4.d.ts} +173 -24
  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/development/{register-CI4bTprK.d.mts → register-_G476ptB.d.mts} +1 -1
  33. package/dist/{production/register-C34pU-in.d.ts → development/register-c-dooqKE.d.ts} +1 -1
  34. package/dist/{production/context-DSyS5mLj.d.mts → development/router-DIAPGK5f.d.mts} +1873 -1254
  35. package/dist/production/browser-DM83uryY.d.ts +310 -0
  36. package/dist/production/browser-DfMfSvsC.d.mts +310 -0
  37. package/dist/production/{chunk-FR6HSPLK.mjs → chunk-4JX2RDWY.mjs} +197 -857
  38. package/dist/production/chunk-4SZHQXEM.js +188 -0
  39. package/dist/production/{chunk-3TADTUL4.mjs → chunk-7EXEUENX.mjs} +365 -22
  40. package/dist/production/{chunk-4E5LHRQP.js → chunk-ARKB3I5K.js} +1226 -122
  41. package/dist/production/chunk-OB3KSCCZ.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-BbRcBjrA.d.ts → production/index-react-server-client-B0vnxMMk.d.mts} +195 -135
  47. package/dist/{development/index-react-server-client-BIz4AUNd.d.mts → production/index-react-server-client-BSxMvS7Z.d.ts} +137 -78
  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 +235 -10
  55. package/dist/production/index-react-server.mjs +235 -10
  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-iAqbU5Q4.d.ts} +173 -24
  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/production/{register-CI4bTprK.d.mts → register-_G476ptB.d.mts} +1 -1
  66. package/dist/{development/register-C34pU-in.d.ts → production/register-c-dooqKE.d.ts} +1 -1
  67. package/dist/{development/context-DSyS5mLj.d.mts → production/router-DIAPGK5f.d.mts} +1873 -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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # `react-router`
2
2
 
3
+ ## 7.9.5-pre.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Move RSCHydratedRouter and utils to `/dom` export. ([#14457](https://github.com/remix-run/react-router/pull/14457))
8
+ - useRoute: return type-safe `handle` ([#14462](https://github.com/remix-run/react-router/pull/14462))
9
+
10
+ For example:
11
+
12
+ ```ts
13
+ // app/routes/admin.tsx
14
+ const handle = { hello: "world" };
15
+ ```
16
+
17
+ ```ts
18
+ // app/routes/some-other-route.tsx
19
+ export default function Component() {
20
+ const admin = useRoute("routes/admin");
21
+ if (!admin) throw new Error("Not nested within 'routes/admin'");
22
+ console.log(admin.handle);
23
+ // ^? { hello: string }
24
+ }
25
+ ```
26
+
27
+ - Ensure action handlers run for routes with middleware even if no loader is present ([#14443](https://github.com/remix-run/react-router/pull/14443))
28
+ - Add `unstable_instrumentations` API to allow users to add observablity to their apps by instrumenting route loaders, actions, middlewares, lazy, as well as server-side request handlers and client side navigations/fetches ([#14412](https://github.com/remix-run/react-router/pull/14412))
29
+ - Framework Mode:
30
+ - `entry.server.tsx`: `export const unstable_instrumentations = [...]`
31
+ - `entry.client.tsx`: `<HydratedRouter unstable_instrumentations={[...]} />`
32
+ - Data Mode
33
+ - `createBrowserRouter(routes, { unstable_instrumentations: [...] })`
34
+
35
+ This also adds a new `unstable_pattern` parameter to loaders/actions/middleware which contains the un-interpolated route pattern (i.e., `/blog/:slug`) which is useful for aggregating performance metrics by route
36
+
3
37
  ## 7.9.4
4
38
 
5
39
  ### Patch Changes
@@ -153,7 +187,6 @@
153
187
  - Stabilize middleware and context APIs. ([#14215](https://github.com/remix-run/react-router/pull/14215))
154
188
 
155
189
  We have removed the `unstable_` prefix from the following APIs and they are now considered stable and ready for production use:
156
-
157
190
  - [`RouterContextProvider`](https://reactrouter.com/api/utils/RouterContextProvider)
158
191
  - [`createContext`](https://reactrouter.com/api/utils/createContext)
159
192
  - `createBrowserRouter` [`getContext`](https://reactrouter.com/api/data-routers/createBrowserRouter#optsgetcontext) option
@@ -180,7 +213,7 @@
180
213
 
181
214
  - \[UNSTABLE] Add `<RouterProvider unstable_onError>`/`<HydratedRouter unstable_onError>` prop for client side error reporting ([#14162](https://github.com/remix-run/react-router/pull/14162))
182
215
 
183
- - server action revalidation opt out via $SKIP\_REVALIDATION field ([#14154](https://github.com/remix-run/react-router/pull/14154))
216
+ - server action revalidation opt out via $SKIP_REVALIDATION field ([#14154](https://github.com/remix-run/react-router/pull/14154))
184
217
 
185
218
  - Properly escape interpolated param values in `generatePath()` ([#13530](https://github.com/remix-run/react-router/pull/13530))
186
219
 
@@ -229,7 +262,6 @@
229
262
  - Remove dependency on `@types/node` in TypeScript declaration files ([#14059](https://github.com/remix-run/react-router/pull/14059))
230
263
 
231
264
  - Fix types for `UIMatch` to reflect that the `loaderData`/`data` properties may be `undefined` ([#12206](https://github.com/remix-run/react-router/pull/12206))
232
-
233
265
  - When an `ErrorBoundary` is being rendered, not all active matches will have loader data available, since it may have been their `loader` that threw to trigger the boundary
234
266
  - The `UIMatch.data` type was not correctly handing this and would always reflect the presence of data, leading to the unexpected runtime errors when an `ErrorBoundary` was rendered
235
267
  - ⚠️ This may cause some type errors to show up in your code for unguarded `match.data` accesses - you should properly guard for `undefined` values in those scenarios.
@@ -263,7 +295,6 @@
263
295
  - \[UNSTABLE] When middleware is enabled, make the `context` parameter read-only (via `Readonly<unstable_RouterContextProvider>`) so that TypeScript will not allow you to write arbitrary fields to it in loaders, actions, or middleware. ([#14097](https://github.com/remix-run/react-router/pull/14097))
264
296
 
265
297
  - \[UNSTABLE] Rename and alter the signature/functionality of the `unstable_respond` API in `staticHandler.query`/`staticHandler.queryRoute` ([#14103](https://github.com/remix-run/react-router/pull/14103))
266
-
267
298
  - The API has been renamed to `unstable_generateMiddlewareResponse` for clarity
268
299
  - The main functional change is that instead of running the loaders/actions before calling `unstable_respond` and handing you the result, we now pass a `query`/`queryRoute` function as a parameter and you execute the loaders/actions inside your callback, giving you full access to pre-processing and error handling
269
300
  - The `query` version of the API now has a signature of `(query: (r: Request) => Promise<StaticHandlerContext | Response>) => Promise<Response>`
@@ -909,7 +940,6 @@
909
940
  ```
910
941
 
911
942
  Similar to server-side requests, a fresh `context` will be created per navigation (or `fetcher` call). If you have initial data you'd like to populate in the context for every request, you can provide an `unstable_getContext` function at the root of your app:
912
-
913
943
  - Library mode - `createBrowserRouter(routes, { unstable_getContext })`
914
944
  - Framework mode - `<HydratedRouter unstable_getContext>`
915
945
 
@@ -1097,7 +1127,6 @@ _No changes_
1097
1127
  - Remove `future.v7_normalizeFormMethod` future flag ([#11697](https://github.com/remix-run/react-router/pull/11697))
1098
1128
 
1099
1129
  - For Remix consumers migrating to React Router, the `crypto` global from the [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) is now required when using cookie and session APIs. This means that the following APIs are provided from `react-router` rather than platform-specific packages: ([#11837](https://github.com/remix-run/react-router/pull/11837))
1100
-
1101
1130
  - `createCookie`
1102
1131
  - `createCookieSessionStorage`
1103
1132
  - `createMemorySessionStorage`
@@ -1106,7 +1135,6 @@ _No changes_
1106
1135
  For consumers running older versions of Node, the `installGlobals` function from `@remix-run/node` has been updated to define `globalThis.crypto`, using [Node's `require('node:crypto').webcrypto` implementation.](https://nodejs.org/api/webcrypto.html)
1107
1136
 
1108
1137
  Since platform-specific packages no longer need to implement this API, the following low-level APIs have been removed:
1109
-
1110
1138
  - `createCookieFactory`
1111
1139
  - `createSessionStorageFactory`
1112
1140
  - `createCookieSessionStorageFactory`
@@ -1262,7 +1290,6 @@ _No changes_
1262
1290
  ```
1263
1291
 
1264
1292
  This initial implementation targets type inference for:
1265
-
1266
1293
  - `Params` : Path parameters from your routing config in `routes.ts` including file-based routing
1267
1294
  - `LoaderData` : Loader data from `loader` and/or `clientLoader` within your route module
1268
1295
  - `ActionData` : Action data from `action` and/or `clientAction` within your route module
@@ -1277,7 +1304,6 @@ _No changes_
1277
1304
  ```
1278
1305
 
1279
1306
  Check out our docs for more:
1280
-
1281
1307
  - [_Explanations > Type Safety_](https://reactrouter.com/dev/guides/explanation/type-safety)
1282
1308
  - [_How-To > Setting up type safety_](https://reactrouter.com/dev/guides/how-to/setting-up-type-safety)
1283
1309
 
@@ -0,0 +1,310 @@
1
+ import * as React from 'react';
2
+ import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction, e as RouterInit } from './instrumentation-iAqbU5Q4.js';
3
+
4
+ type RSCRouteConfigEntryBase = {
5
+ action?: ActionFunction;
6
+ clientAction?: ClientActionFunction;
7
+ clientLoader?: ClientLoaderFunction;
8
+ ErrorBoundary?: React.ComponentType<any>;
9
+ handle?: any;
10
+ headers?: HeadersFunction;
11
+ HydrateFallback?: React.ComponentType<any>;
12
+ Layout?: React.ComponentType<any>;
13
+ links?: LinksFunction;
14
+ loader?: LoaderFunction;
15
+ meta?: MetaFunction;
16
+ shouldRevalidate?: ShouldRevalidateFunction;
17
+ };
18
+ type RSCRouteConfigEntry = RSCRouteConfigEntryBase & {
19
+ id: string;
20
+ path?: string;
21
+ Component?: React.ComponentType<any>;
22
+ lazy?: () => Promise<RSCRouteConfigEntryBase & ({
23
+ default?: React.ComponentType<any>;
24
+ Component?: never;
25
+ } | {
26
+ default?: never;
27
+ Component?: React.ComponentType<any>;
28
+ })>;
29
+ } & ({
30
+ index: true;
31
+ } | {
32
+ children?: RSCRouteConfigEntry[];
33
+ });
34
+ type RSCRouteConfig = Array<RSCRouteConfigEntry>;
35
+ type RSCRouteManifest = {
36
+ clientAction?: ClientActionFunction;
37
+ clientLoader?: ClientLoaderFunction;
38
+ element?: React.ReactElement | false;
39
+ errorElement?: React.ReactElement;
40
+ handle?: any;
41
+ hasAction: boolean;
42
+ hasComponent: boolean;
43
+ hasErrorBoundary: boolean;
44
+ hasLoader: boolean;
45
+ hydrateFallbackElement?: React.ReactElement;
46
+ id: string;
47
+ index?: boolean;
48
+ links?: LinksFunction;
49
+ meta?: MetaFunction;
50
+ parentId?: string;
51
+ path?: string;
52
+ shouldRevalidate?: ShouldRevalidateFunction;
53
+ };
54
+ type RSCRouteMatch = RSCRouteManifest & {
55
+ params: Params;
56
+ pathname: string;
57
+ pathnameBase: string;
58
+ };
59
+ type RSCRenderPayload = {
60
+ type: "render";
61
+ actionData: Record<string, any> | null;
62
+ basename: string | undefined;
63
+ errors: Record<string, any> | null;
64
+ loaderData: Record<string, any>;
65
+ location: Location;
66
+ matches: RSCRouteMatch[];
67
+ patches?: RSCRouteManifest[];
68
+ nonce?: string;
69
+ formState?: unknown;
70
+ };
71
+ type RSCManifestPayload = {
72
+ type: "manifest";
73
+ patches: RSCRouteManifest[];
74
+ };
75
+ type RSCActionPayload = {
76
+ type: "action";
77
+ actionResult: Promise<unknown>;
78
+ rerender?: Promise<RSCRenderPayload | RSCRedirectPayload>;
79
+ };
80
+ type RSCRedirectPayload = {
81
+ type: "redirect";
82
+ status: number;
83
+ location: string;
84
+ replace: boolean;
85
+ reload: boolean;
86
+ actionResult?: Promise<unknown>;
87
+ };
88
+ type RSCPayload = RSCRenderPayload | RSCManifestPayload | RSCActionPayload | RSCRedirectPayload;
89
+ type RSCMatch = {
90
+ statusCode: number;
91
+ headers: Headers;
92
+ payload: RSCPayload;
93
+ };
94
+ type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>;
95
+ type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
96
+ type DecodeReplyFunction = (reply: FormData | string, { temporaryReferences }: {
97
+ temporaryReferences: unknown;
98
+ }) => Promise<unknown[]>;
99
+ type LoadServerActionFunction = (id: string) => Promise<Function>;
100
+ /**
101
+ * Matches the given routes to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
102
+ * and returns an [RSC](https://react.dev/reference/rsc/server-components)
103
+ * [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
104
+ * encoding an {@link unstable_RSCPayload} for consumption by an [RSC](https://react.dev/reference/rsc/server-components)
105
+ * enabled client router.
106
+ *
107
+ * @example
108
+ * import {
109
+ * createTemporaryReferenceSet,
110
+ * decodeAction,
111
+ * decodeReply,
112
+ * loadServerAction,
113
+ * renderToReadableStream,
114
+ * } from "@vitejs/plugin-rsc/rsc";
115
+ * import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router";
116
+ *
117
+ * matchRSCServerRequest({
118
+ * createTemporaryReferenceSet,
119
+ * decodeAction,
120
+ * decodeFormState,
121
+ * decodeReply,
122
+ * loadServerAction,
123
+ * request,
124
+ * routes: routes(),
125
+ * generateResponse(match) {
126
+ * return new Response(
127
+ * renderToReadableStream(match.payload),
128
+ * {
129
+ * status: match.statusCode,
130
+ * headers: match.headers,
131
+ * }
132
+ * );
133
+ * },
134
+ * });
135
+ *
136
+ * @name unstable_matchRSCServerRequest
137
+ * @public
138
+ * @category RSC
139
+ * @mode data
140
+ * @param opts Options
141
+ * @param opts.basename The basename to use when matching the request.
142
+ * @param opts.createTemporaryReferenceSet A function that returns a temporary
143
+ * reference set for the request, used to track temporary references in the [RSC](https://react.dev/reference/rsc/server-components)
144
+ * stream.
145
+ * @param opts.decodeAction Your `react-server-dom-xyz/server`'s `decodeAction`
146
+ * function, responsible for loading a server action.
147
+ * @param opts.decodeFormState A function responsible for decoding form state for
148
+ * progressively enhanceable forms with React's [`useActionState`](https://react.dev/reference/react/useActionState)
149
+ * using your `react-server-dom-xyz/server`'s `decodeFormState`.
150
+ * @param opts.decodeReply Your `react-server-dom-xyz/server`'s `decodeReply`
151
+ * function, used to decode the server function's arguments and bind them to the
152
+ * implementation for invocation by the router.
153
+ * @param opts.generateResponse A function responsible for using your
154
+ * `renderToReadableStream` to generate a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
155
+ * encoding the {@link unstable_RSCPayload}.
156
+ * @param opts.loadServerAction Your `react-server-dom-xyz/server`'s
157
+ * `loadServerAction` function, used to load a server action by ID.
158
+ * @param opts.onError An optional error handler that will be called with any
159
+ * errors that occur during the request processing.
160
+ * @param opts.request The [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
161
+ * to match against.
162
+ * @param opts.requestContext An instance of {@link RouterContextProvider}
163
+ * that should be created per request, to be passed to [`action`](../../start/data/route-object#action)s,
164
+ * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
165
+ * @param opts.routes Your {@link unstable_RSCRouteConfigEntry | route definitions}.
166
+ * @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
167
+ * that contains the [RSC](https://react.dev/reference/rsc/server-components)
168
+ * data for hydration.
169
+ */
170
+ declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename, decodeReply, requestContext, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
171
+ createTemporaryReferenceSet: () => unknown;
172
+ basename?: string;
173
+ decodeReply?: DecodeReplyFunction;
174
+ decodeAction?: DecodeActionFunction;
175
+ decodeFormState?: DecodeFormStateFunction;
176
+ requestContext?: RouterContextProvider;
177
+ loadServerAction?: LoadServerActionFunction;
178
+ onError?: (error: unknown) => void;
179
+ request: Request;
180
+ routes: RSCRouteConfigEntry[];
181
+ generateResponse: (match: RSCMatch, { temporaryReferences, }: {
182
+ temporaryReferences: unknown;
183
+ }) => Response;
184
+ }): Promise<Response>;
185
+
186
+ type BrowserCreateFromReadableStreamFunction = (body: ReadableStream<Uint8Array>, { temporaryReferences, }: {
187
+ temporaryReferences: unknown;
188
+ }) => Promise<unknown>;
189
+ type EncodeReplyFunction = (args: unknown[], options: {
190
+ temporaryReferences: unknown;
191
+ }) => Promise<BodyInit>;
192
+ /**
193
+ * Create a React `callServer` implementation for React Router.
194
+ *
195
+ * @example
196
+ * import {
197
+ * createFromReadableStream,
198
+ * createTemporaryReferenceSet,
199
+ * encodeReply,
200
+ * setServerCallback,
201
+ * } from "@vitejs/plugin-rsc/browser";
202
+ * import { unstable_createCallServer as createCallServer } from "react-router";
203
+ *
204
+ * setServerCallback(
205
+ * createCallServer({
206
+ * createFromReadableStream,
207
+ * createTemporaryReferenceSet,
208
+ * encodeReply,
209
+ * })
210
+ * );
211
+ *
212
+ * @name unstable_createCallServer
213
+ * @public
214
+ * @category RSC
215
+ * @mode data
216
+ * @param opts Options
217
+ * @param opts.createFromReadableStream Your `react-server-dom-xyz/client`'s
218
+ * `createFromReadableStream`. Used to decode payloads from the server.
219
+ * @param opts.createTemporaryReferenceSet A function that creates a temporary
220
+ * reference set for the [RSC](https://react.dev/reference/rsc/server-components)
221
+ * payload.
222
+ * @param opts.encodeReply Your `react-server-dom-xyz/client`'s `encodeReply`.
223
+ * Used when sending payloads to the server.
224
+ * @param opts.fetch Optional [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
225
+ * implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch).
226
+ * @returns A function that can be used to call server actions.
227
+ */
228
+ declare function createCallServer({ createFromReadableStream, createTemporaryReferenceSet, encodeReply, fetch: fetchImplementation, }: {
229
+ createFromReadableStream: BrowserCreateFromReadableStreamFunction;
230
+ createTemporaryReferenceSet: () => unknown;
231
+ encodeReply: EncodeReplyFunction;
232
+ fetch?: (request: Request) => Promise<Response>;
233
+ }): (id: string, args: unknown[]) => Promise<unknown>;
234
+ /**
235
+ * Props for the {@link unstable_RSCHydratedRouter} component.
236
+ *
237
+ * @name unstable_RSCHydratedRouterProps
238
+ * @category Types
239
+ */
240
+ interface RSCHydratedRouterProps {
241
+ /**
242
+ * Your `react-server-dom-xyz/client`'s `createFromReadableStream` function,
243
+ * used to decode payloads from the server.
244
+ */
245
+ createFromReadableStream: BrowserCreateFromReadableStreamFunction;
246
+ /**
247
+ * Optional fetch implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch).
248
+ */
249
+ fetch?: (request: Request) => Promise<Response>;
250
+ /**
251
+ * The decoded {@link unstable_RSCPayload} to hydrate.
252
+ */
253
+ payload: RSCPayload;
254
+ /**
255
+ * `"eager"` or `"lazy"` - Determines if links are eagerly discovered, or
256
+ * delayed until clicked.
257
+ */
258
+ routeDiscovery?: "eager" | "lazy";
259
+ /**
260
+ * A function that returns an {@link RouterContextProvider} instance
261
+ * which is provided as the `context` argument to client [`action`](../../start/data/route-object#action)s,
262
+ * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
263
+ * This function is called to generate a fresh `context` instance on each
264
+ * navigation or fetcher call.
265
+ */
266
+ getContext?: RouterInit["getContext"];
267
+ }
268
+ /**
269
+ * Hydrates a server rendered {@link unstable_RSCPayload} in the browser.
270
+ *
271
+ * @example
272
+ * import { startTransition, StrictMode } from "react";
273
+ * import { hydrateRoot } from "react-dom/client";
274
+ * import {
275
+ * unstable_getRSCStream as getRSCStream,
276
+ * unstable_RSCHydratedRouter as RSCHydratedRouter,
277
+ * } from "react-router";
278
+ * import type { unstable_RSCPayload as RSCPayload } from "react-router";
279
+ *
280
+ * createFromReadableStream(getRSCStream()).then((payload) =>
281
+ * startTransition(async () => {
282
+ * hydrateRoot(
283
+ * document,
284
+ * <StrictMode>
285
+ * <RSCHydratedRouter
286
+ * createFromReadableStream={createFromReadableStream}
287
+ * payload={payload}
288
+ * />
289
+ * </StrictMode>,
290
+ * { formState: await getFormState(payload) },
291
+ * );
292
+ * }),
293
+ * );
294
+ *
295
+ * @name unstable_RSCHydratedRouter
296
+ * @public
297
+ * @category RSC
298
+ * @mode data
299
+ * @param props Props
300
+ * @param {unstable_RSCHydratedRouterProps.createFromReadableStream} props.createFromReadableStream n/a
301
+ * @param {unstable_RSCHydratedRouterProps.fetch} props.fetch n/a
302
+ * @param {unstable_RSCHydratedRouterProps.getContext} props.getContext n/a
303
+ * @param {unstable_RSCHydratedRouterProps.payload} props.payload n/a
304
+ * @param {unstable_RSCHydratedRouterProps.routeDiscovery} props.routeDiscovery n/a
305
+ * @returns A hydrated {@link DataRouter} that can be used to navigate and
306
+ * render routes.
307
+ */
308
+ declare function RSCHydratedRouter({ createFromReadableStream, fetch: fetchImplementation, payload, routeDiscovery, getContext, }: RSCHydratedRouterProps): React.JSX.Element;
309
+
310
+ export { type BrowserCreateFromReadableStreamFunction as B, type DecodeActionFunction as D, type EncodeReplyFunction as E, type LoadServerActionFunction as L, RSCHydratedRouter as R, type DecodeFormStateFunction as a, type DecodeReplyFunction as b, createCallServer as c, type RSCManifestPayload as d, type RSCPayload as e, type RSCRenderPayload as f, type RSCHydratedRouterProps as g, type RSCMatch as h, type RSCRouteManifest as i, type RSCRouteMatch as j, type RSCRouteConfigEntry as k, type RSCRouteConfig as l, matchRSCServerRequest as m };