react-router 7.7.0 → 7.7.1

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 (68) hide show
  1. package/CHANGELOG.md +11 -23
  2. package/dist/development/{browser-CcxeZJcQ.d.mts → browser-7LYX59NK.d.mts} +97 -1
  3. package/dist/development/{chunk-EF7DTUVF.mjs → chunk-C37GKA54.mjs} +83 -80
  4. package/dist/development/{chunk-V6PEDDZI.js → chunk-K7YFBME3.js} +79 -76
  5. package/dist/{production/chunk-GNZILI6H.mjs → development/chunk-KIUJAIYX.mjs} +3 -5
  6. package/dist/{production/chunk-2TYFPE3B.js → development/chunk-R73PQUJU.js} +132 -132
  7. package/dist/development/components-CjQijYga.d.mts +802 -0
  8. package/dist/development/dom-export.d.mts +13 -6
  9. package/dist/development/dom-export.d.ts +10 -3
  10. package/dist/development/dom-export.js +3 -3
  11. package/dist/development/dom-export.mjs +3 -3
  12. package/dist/development/index-react-server-client-Bi_fx8qz.d.ts +3163 -0
  13. package/dist/development/index-react-server-client-KLg-U4nr.d.mts +2366 -0
  14. package/dist/development/index-react-server-client.d.mts +3 -3
  15. package/dist/development/index-react-server-client.d.ts +2 -2
  16. package/dist/development/index-react-server-client.js +4 -4
  17. package/dist/development/index-react-server-client.mjs +2 -2
  18. package/dist/development/index-react-server.d.mts +109 -2
  19. package/dist/development/index-react-server.d.ts +109 -2
  20. package/dist/development/index-react-server.js +28 -20
  21. package/dist/development/index-react-server.mjs +29 -21
  22. package/dist/development/index.d.mts +918 -287
  23. package/dist/development/index.d.ts +1010 -283
  24. package/dist/development/index.js +98 -100
  25. package/dist/development/index.mjs +3 -3
  26. package/dist/development/lib/types/internal.d.mts +1 -1
  27. package/dist/development/lib/types/internal.d.ts +1 -1
  28. package/dist/development/lib/types/internal.js +1 -1
  29. package/dist/development/lib/types/internal.mjs +1 -1
  30. package/dist/{production/route-data-DjzmHYNR.d.mts → development/route-data-CqEmXQub.d.mts} +48 -2
  31. package/dist/{production/routeModules-g5PTiDfO.d.ts → development/routeModules-BR2FO0ix.d.ts} +48 -2
  32. package/dist/production/{browser-CcxeZJcQ.d.mts → browser-7LYX59NK.d.mts} +97 -1
  33. package/dist/{development/chunk-4ADB4KIO.js → production/chunk-4DGLNKXF.js} +132 -132
  34. package/dist/production/{chunk-5KHO4FML.js → chunk-7OQROU2D.js} +79 -76
  35. package/dist/production/{chunk-WPPIQDYG.mjs → chunk-IZ57JD2V.mjs} +83 -80
  36. package/dist/{development/chunk-T3VM44WY.mjs → production/chunk-K3SBCRK4.mjs} +3 -5
  37. package/dist/production/components-CjQijYga.d.mts +802 -0
  38. package/dist/production/dom-export.d.mts +13 -6
  39. package/dist/production/dom-export.d.ts +10 -3
  40. package/dist/production/dom-export.js +3 -3
  41. package/dist/production/dom-export.mjs +3 -3
  42. package/dist/production/index-react-server-client-Bi_fx8qz.d.ts +3163 -0
  43. package/dist/production/index-react-server-client-KLg-U4nr.d.mts +2366 -0
  44. package/dist/production/index-react-server-client.d.mts +3 -3
  45. package/dist/production/index-react-server-client.d.ts +2 -2
  46. package/dist/production/index-react-server-client.js +4 -4
  47. package/dist/production/index-react-server-client.mjs +2 -2
  48. package/dist/production/index-react-server.d.mts +109 -2
  49. package/dist/production/index-react-server.d.ts +109 -2
  50. package/dist/production/index-react-server.js +28 -20
  51. package/dist/production/index-react-server.mjs +29 -21
  52. package/dist/production/index.d.mts +918 -287
  53. package/dist/production/index.d.ts +1010 -283
  54. package/dist/production/index.js +98 -100
  55. package/dist/production/index.mjs +3 -3
  56. package/dist/production/lib/types/internal.d.mts +1 -1
  57. package/dist/production/lib/types/internal.d.ts +1 -1
  58. package/dist/production/lib/types/internal.js +1 -1
  59. package/dist/production/lib/types/internal.mjs +1 -1
  60. package/dist/{development/route-data-DjzmHYNR.d.mts → production/route-data-CqEmXQub.d.mts} +48 -2
  61. package/dist/{development/routeModules-g5PTiDfO.d.ts → production/routeModules-BR2FO0ix.d.ts} +48 -2
  62. package/package.json +1 -1
  63. package/dist/development/components-DzqPLVI1.d.mts +0 -464
  64. package/dist/development/index-react-server-client-CUidsuu_.d.mts +0 -1360
  65. package/dist/development/index-react-server-client-kY8DvDF3.d.ts +0 -1819
  66. package/dist/production/components-DzqPLVI1.d.mts +0 -464
  67. package/dist/production/index-react-server-client-CUidsuu_.d.mts +0 -1360
  68. package/dist/production/index-react-server-client-kY8DvDF3.d.ts +0 -1819
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # `react-router`
2
2
 
3
+ ## 7.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - In RSC Data Mode, fix bug where routes with errors weren't forced to revalidate when `shouldRevalidate` returned false ([#14026](https://github.com/remix-run/react-router/pull/14026))
8
+ - In RSC Data Mode, fix `Matched leaf route at location "/..." does not have an element or Component` warnings when error boundaries are rendered. ([#14021](https://github.com/remix-run/react-router/pull/14021))
9
+
3
10
  ## 7.7.0
4
11
 
5
12
  ### Minor Changes
@@ -173,7 +180,6 @@
173
180
  ### Minor Changes
174
181
 
175
182
  - Added a new `react-router.config.ts` `routeDiscovery` option to configure Lazy Route Discovery behavior. ([#13451](https://github.com/remix-run/react-router/pull/13451))
176
-
177
183
  - By default, Lazy Route Discovery is enabled and makes manifest requests to the `/__manifest` path:
178
184
  - `routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" }`
179
185
  - You can modify the manifest path used:
@@ -219,7 +225,6 @@
219
225
  - Preserve status code if a `clientAction` throws a `data()` result in framework mode ([#13522](https://github.com/remix-run/react-router/pull/13522))
220
226
 
221
227
  - Be defensive against leading double slashes in paths to avoid `Invalid URL` errors from the URL constructor ([#13510](https://github.com/remix-run/react-router/pull/13510))
222
-
223
228
  - Note we do not sanitize/normalize these paths - we only detect them so we can avoid the error that would be thrown by `new URL("//", window.location.origin)`
224
229
 
225
230
  - Remove `Navigator` declaration for `navigator.connection.saveData` to avoid messing with any other types beyond `saveData` in userland ([#13512](https://github.com/remix-run/react-router/pull/13512))
@@ -235,7 +240,6 @@
235
240
  - UNSTABLE: Fix a few bugs with error bubbling in middleware use-cases ([#13538](https://github.com/remix-run/react-router/pull/13538))
236
241
 
237
242
  - Short circuit post-processing on aborted `dataStrategy` requests ([#13521](https://github.com/remix-run/react-router/pull/13521))
238
-
239
243
  - This resolves non-user-facing console errors of the form `Cannot read properties of undefined (reading 'result')`
240
244
 
241
245
  ## 7.5.3
@@ -250,7 +254,6 @@
250
254
  ### Patch Changes
251
255
 
252
256
  - Update Single Fetch to also handle the 204 redirects used in `?_data` requests in Remix v2 ([#13364](https://github.com/remix-run/react-router/pull/13364))
253
-
254
257
  - This allows applications to return a redirect on `.data` requests from outside the scope of React Router (i.e., an `express`/`hono` middleware)
255
258
  - ⚠️ Please note that doing so relies on implementation details that are subject to change without a SemVer major release
256
259
  - This is primarily done to ease upgrading to Single Fetch for existing Remix v2 applications, but the recommended way to handle this is redirecting from a route middleware
@@ -288,7 +291,6 @@
288
291
  - UNSTABLE: Add better error messaging when `getLoadContext` is not updated to return a `Map`" ([#13242](https://github.com/remix-run/react-router/pull/13242))
289
292
 
290
293
  - Do not automatically add `null` to `staticHandler.query()` `context.loaderData` if routes do not have loaders ([#13223](https://github.com/remix-run/react-router/pull/13223))
291
-
292
294
  - This was a Remix v2 implementation detail inadvertently left in for React Router v7
293
295
  - Now that we allow returning `undefined` from loaders, our prior check of `loaderData[routeId] !== undefined` was no longer sufficient and was changed to a `routeId in loaderData` check - these `null` values can cause issues for this new check
294
296
  - ⚠️ This could be a "breaking bug fix" for you if you are doing manual SSR with `createStaticHandler()`/`<StaticRouterProvider>`, and using `context.loaderData` to control `<RouterProvider>` hydration behavior on the client
@@ -367,7 +369,6 @@
367
369
  ### Minor Changes
368
370
 
369
371
  - Add `fetcherKey` as a parameter to `patchRoutesOnNavigation` ([#13061](https://github.com/remix-run/react-router/pull/13061))
370
-
371
372
  - In framework mode, Lazy Route Discovery will now detect manifest version mismatches after a new deploy
372
373
  - On navigations to undiscovered routes, this mismatch will trigger a document reload of the destination path
373
374
  - On `fetcher` calls to undiscovered routes, this mismatch will trigger a document reload of the current path
@@ -425,7 +426,7 @@
425
426
  ```tsx
426
427
  const clientLogger: Route.unstable_ClientMiddlewareFunction = async (
427
428
  { request },
428
- next
429
+ next,
429
430
  ) => {
430
431
  let start = performance.now();
431
432
 
@@ -444,7 +445,7 @@
444
445
  ```tsx
445
446
  const serverLogger: Route.unstable_MiddlewareFunction = async (
446
447
  { request, params, context },
447
- next
448
+ next,
448
449
  ) => {
449
450
  let start = performance.now();
450
451
 
@@ -465,7 +466,7 @@
465
466
  import { sessionContext } from "../context";
466
467
  const serverAuth: Route.unstable_MiddlewareFunction = (
467
468
  { request, params, context },
468
- next
469
+ next,
469
470
  ) => {
470
471
  let session = context.get(sessionContext);
471
472
  let user = session.get("user");
@@ -660,7 +661,6 @@
660
661
  - Don't apply Single Fetch revalidation de-optimization when in SPA mode since there is no server HTTP request ([#12948](https://github.com/remix-run/react-router/pull/12948))
661
662
 
662
663
  - Properly handle revalidations to across a prerender/SPA boundary ([#13021](https://github.com/remix-run/react-router/pull/13021))
663
-
664
664
  - In "hybrid" applications where some routes are pre-rendered and some are served from a SPA fallback, we need to avoid making `.data` requests if the path wasn't pre-rendered because the request will 404
665
665
  - We don't know all the pre-rendered paths client-side, however:
666
666
  - All `loader` data in `ssr:false` mode is static because it's generated at build time
@@ -670,7 +670,6 @@
670
670
  - This ensures that the route doesn't cause a `.data` request that would 404 after a submission
671
671
 
672
672
  - Error at build time in `ssr:false` + `prerender` apps for the edge case scenario of: ([#13021](https://github.com/remix-run/react-router/pull/13021))
673
-
674
673
  - A parent route has only a `loader` (does not have a `clientLoader`)
675
674
  - The parent route is pre-rendered
676
675
  - The parent route has children routes which are not prerendered
@@ -683,7 +682,6 @@
683
682
  - Add `unstable_SerializesTo` brand type for library authors to register types serializable by React Router's streaming format (`turbo-stream`) ([`ab5b05b02`](https://github.com/remix-run/react-router/commit/ab5b05b02f99f062edb3c536c392197c88eb6c77))
684
683
 
685
684
  - Align dev server behavior with static file server behavior when `ssr:false` is set ([#12948](https://github.com/remix-run/react-router/pull/12948))
686
-
687
685
  - When no `prerender` config exists, only SSR down to the root `HydrateFallback` (SPA Mode)
688
686
  - When a `prerender` config exists but the current path is not prerendered, only SSR down to the root `HydrateFallback` (SPA Fallback)
689
687
  - Return a 404 on `.data` requests to non-pre-rendered paths
@@ -691,7 +689,6 @@
691
689
  - Improve prefetch performance of CSS side effects in framework mode ([#12889](https://github.com/remix-run/react-router/pull/12889))
692
690
 
693
691
  - Disable Lazy Route Discovery for all `ssr:false` apps and not just "SPA Mode" because there is no runtime server to serve the search-param-configured `__manifest` requests ([#12894](https://github.com/remix-run/react-router/pull/12894))
694
-
695
692
  - We previously only disabled this for "SPA Mode" which is `ssr:false` and no `prerender` config but we realized it should apply to all `ssr:false` apps, including those prerendering multiple pages
696
693
  - In those `prerender` scenarios we would prerender the `/__manifest` file assuming the static file server would serve it but that makes some unneccesary assumptions about the static file server behaviors
697
694
 
@@ -768,7 +765,6 @@ _No changes_
768
765
  ### Major Changes
769
766
 
770
767
  - Remove the original `defer` implementation in favor of using raw promises via single fetch and `turbo-stream`. This removes these exports from React Router: ([#11744](https://github.com/remix-run/react-router/pull/11744))
771
-
772
768
  - `defer`
773
769
  - `AbortedDeferredError`
774
770
  - `type TypedDeferredData`
@@ -812,7 +808,6 @@ _No changes_
812
808
  - `createMemorySessionStorageFactory`
813
809
 
814
810
  - Imports/Exports cleanup ([#11840](https://github.com/remix-run/react-router/pull/11840))
815
-
816
811
  - Removed the following exports that were previously public API from `@remix-run/router`
817
812
  - types
818
813
  - `AgnosticDataIndexRouteObject`
@@ -849,7 +844,6 @@ _No changes_
849
844
  - Remove `future.v7_prependBasename` from the ionternalized `@remix-run/router` package ([#11726](https://github.com/remix-run/react-router/pull/11726))
850
845
 
851
846
  - Migrate Remix type generics to React Router ([#12180](https://github.com/remix-run/react-router/pull/12180))
852
-
853
847
  - These generics are provided for Remix v2 migration purposes
854
848
  - These generics and the APIs they exist on should be considered informally deprecated in favor of the new `Route.*` types
855
849
  - Anyone migrating from React Router v6 should probably not leverage these new generics and should migrate straight to the `Route.*` types
@@ -889,11 +883,9 @@ _No changes_
889
883
  - Remove `v7_relativeSplatPath` future flag ([#11695](https://github.com/remix-run/react-router/pull/11695))
890
884
 
891
885
  - Drop support for Node 18, update minimum Node vestion to 20 ([#12171](https://github.com/remix-run/react-router/pull/12171))
892
-
893
886
  - Remove `installGlobals()` as this should no longer be necessary
894
887
 
895
888
  - Remove remaining future flags ([#11820](https://github.com/remix-run/react-router/pull/11820))
896
-
897
889
  - React Router `v7_skipActionErrorRevalidation`
898
890
  - Remix `v3_fetcherPersist`, `v3_relativeSplatPath`, `v3_throwAbortReason`
899
891
 
@@ -902,7 +894,6 @@ _No changes_
902
894
  - Remove `@remix-run/router` deprecated `detectErrorBoundary` option in favor of `mapRouteProperties` ([#11751](https://github.com/remix-run/react-router/pull/11751))
903
895
 
904
896
  - Add `react-router/dom` subpath export to properly enable `react-dom` as an optional `peerDependency` ([#11851](https://github.com/remix-run/react-router/pull/11851))
905
-
906
897
  - This ensures that we don't blindly `import ReactDOM from "react-dom"` in `<RouterProvider>` in order to access `ReactDOM.flushSync()`, since that would break `createMemoryRouter` use cases in non-DOM environments
907
898
  - DOM environments should import from `react-router/dom` to get the proper component that makes `ReactDOM.flushSync()` available:
908
899
  - If you are using the Vite plugin, use this in your `entry.client.tsx`:
@@ -1006,7 +997,6 @@ _No changes_
1006
997
  - Replace `substr` with `substring` ([#12080](https://github.com/remix-run/react-router/pull/12080))
1007
998
 
1008
999
  - Remove the deprecated `json` utility ([#12146](https://github.com/remix-run/react-router/pull/12146))
1009
-
1010
1000
  - You can use [`Response.json`](https://developer.mozilla.org/en-US/docs/Web/API/Response/json_static) if you still need to construct JSON responses in your app
1011
1001
 
1012
1002
  - Remove unneeded dependency on source-map ([#12275](https://github.com/remix-run/react-router/pull/12275))
@@ -1360,7 +1350,6 @@ No significant changes to this package were made in this release. [See the repo
1360
1350
  - Fix `useActionData` so it returns proper contextual action data and not _any_ action data in the tree ([#11023](https://github.com/remix-run/react-router/pull/11023))
1361
1351
 
1362
1352
  - Fix bug in `useResolvedPath` that would cause `useResolvedPath(".")` in a splat route to lose the splat portion of the URL path. ([#10983](https://github.com/remix-run/react-router/pull/10983))
1363
-
1364
1353
  - ⚠️ This fixes a quite long-standing bug specifically for `"."` paths inside a splat route which incorrectly dropped the splat portion of the URL. If you are relative routing via `"."` inside a splat route in your application you should double check that your logic is not relying on this buggy behavior and update accordingly.
1365
1354
 
1366
1355
  - Updated dependencies:
@@ -1527,7 +1516,6 @@ No significant changes to this package were made in this release. [See the repo
1527
1516
  ### Minor Changes
1528
1517
 
1529
1518
  - Added support for [**Future Flags**](https://reactrouter.com/v6/guides/api-development-strategy) in React Router. The first flag being introduced is `future.v7_normalizeFormMethod` which will normalize the exposed `useNavigation()/useFetcher()` `formMethod` fields as uppercase HTTP methods to align with the `fetch()` behavior. ([#10207](https://github.com/remix-run/react-router/pull/10207))
1530
-
1531
1519
  - When `future.v7_normalizeFormMethod === false` (default v6 behavior),
1532
1520
  - `useNavigation().formMethod` is lowercase
1533
1521
  - `useFetcher().formMethod` is lowercase
@@ -1600,7 +1588,7 @@ No significant changes to this package were made in this release. [See the repo
1600
1588
  <Route index element={<Home />} />
1601
1589
  <Route path="a" lazy={() => import("./a")} />
1602
1590
  <Route path="b" lazy={() => import("./b")} />
1603
- </Route>
1591
+ </Route>,
1604
1592
  );
1605
1593
  ```
1606
1594
 
@@ -1,6 +1,6 @@
1
1
  import { AsyncLocalStorage } from 'node:async_hooks';
2
2
  import * as React from 'react';
3
- import { u as unstable_RouterContextProvider, i as ActionFunction, C as ClientActionFunction, j as ClientLoaderFunction, k as HeadersFunction, l as LinksFunction, m as LoaderFunction, M as MetaFunction, S as ShouldRevalidateFunction, c as Location, h as Params } from './route-data-DjzmHYNR.mjs';
3
+ import { u as unstable_RouterContextProvider, i as ActionFunction, C as ClientActionFunction, j as ClientLoaderFunction, k as HeadersFunction, l as LinksFunction, m as LoaderFunction, M as MetaFunction, S as ShouldRevalidateFunction, c as Location, h as Params } from './route-data-CqEmXQub.mjs';
4
4
 
5
5
  type ServerContext = {
6
6
  redirect?: Response;
@@ -104,6 +104,67 @@ type DecodeReplyFunction = (reply: FormData | string, { temporaryReferences }: {
104
104
  temporaryReferences: unknown;
105
105
  }) => Promise<unknown[]>;
106
106
  type LoadServerActionFunction = (id: string) => Promise<Function>;
107
+ /**
108
+ * Matches the given routes to a Request and returns a RSC Response encoding an
109
+ * `RSCPayload` for consumption by a RSC enabled client router.
110
+ *
111
+ * @example
112
+ * import {
113
+ * createTemporaryReferenceSet,
114
+ * decodeAction,
115
+ * decodeReply,
116
+ * loadServerAction,
117
+ * renderToReadableStream,
118
+ * } from "@vitejs/plugin-rsc/rsc";
119
+ * import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router";
120
+ *
121
+ * matchRSCServerRequest({
122
+ * createTemporaryReferenceSet,
123
+ * decodeAction,
124
+ * decodeFormState,
125
+ * decodeReply,
126
+ * loadServerAction,
127
+ * request,
128
+ * routes: routes(),
129
+ * generateResponse(match) {
130
+ * return new Response(
131
+ * renderToReadableStream(match.payload),
132
+ * {
133
+ * status: match.statusCode,
134
+ * headers: match.headers,
135
+ * }
136
+ * );
137
+ * },
138
+ * });
139
+ *
140
+ * @name unstable_matchRSCServerRequest
141
+ * @public
142
+ * @category RSC
143
+ * @mode data
144
+ * @param opts Options
145
+ * @param opts.basename The basename to use when matching the request.
146
+ * @param opts.decodeAction Your `react-server-dom-xyz/server`'s `decodeAction`
147
+ * function, responsible for loading a server action.
148
+ * @param opts.decodeReply Your `react-server-dom-xyz/server`'s `decodeReply`
149
+ * function, used to decode the server function's arguments and bind them to the
150
+ * implementation for invocation by the router.
151
+ * @param opts.decodeFormState A function responsible for decoding form state for
152
+ * progressively enhanceable forms with `useActionState` using your
153
+ * `react-server-dom-xyz/server`'s `decodeFormState`.
154
+ * @param opts.generateResponse A function responsible for using your
155
+ * `renderToReadableStream` to generate a Response encoding the `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.request The request to match against.
159
+ * @param opts.requestContext An instance of `unstable_RouterContextProvider`
160
+ * that should be created per request, to be passed to loaders, actions and middleware.
161
+ * @param opts.routes Your route definitions.
162
+ * @param opts.createTemporaryReferenceSet A function that returns a temporary
163
+ * reference set for the request, used to track temporary references in the RSC stream.
164
+ * @param opts.onError An optional error handler that will be called with any
165
+ * errors that occur during the request processing.
166
+ * @returns A Response that contains the RSC data for hydration.
167
+ */
107
168
  declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename, decodeReply, requestContext, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
108
169
  createTemporaryReferenceSet: () => unknown;
109
170
  basename?: string;
@@ -125,6 +186,41 @@ declare global {
125
186
  __FLIGHT_DATA: any[];
126
187
  }
127
188
  }
189
+ /**
190
+ * Get the prerendered RSC stream for hydration. Usually passed directly to your
191
+ * `react-server-dom-xyz/client`'s `createFromReadableStream`.
192
+ *
193
+ * @example
194
+ * import { startTransition, StrictMode } from "react";
195
+ * import { hydrateRoot } from "react-dom/client";
196
+ * import {
197
+ * unstable_getRSCStream as getRSCStream,
198
+ * unstable_RSCHydratedRouter as RSCHydratedRouter,
199
+ * } from "react-router";
200
+ * import type { unstable_RSCPayload as RSCPayload } from "react-router";
201
+ *
202
+ * createFromReadableStream(getRSCStream()).then(
203
+ * (payload: RSCServerPayload) => {
204
+ * startTransition(async () => {
205
+ * hydrateRoot(
206
+ * document,
207
+ * <StrictMode>
208
+ * <RSCHydratedRouter ...props />
209
+ * </StrictMode>,
210
+ * {
211
+ * // Options
212
+ * }
213
+ * );
214
+ * });
215
+ * }
216
+ * );
217
+ *
218
+ * @name unstable_getRSCStream
219
+ * @public
220
+ * @category RSC
221
+ * @mode data
222
+ * @returns A `ReadableStream` that contains the RSC data for hydration.
223
+ */
128
224
  declare function getRSCStream(): ReadableStream<any>;
129
225
 
130
226
  export { type DecodeActionFunction as D, type LoadServerActionFunction as L, type RSCPayload as R, type DecodeFormStateFunction as a, type DecodeReplyFunction as b, type RSCManifestPayload as c, type RSCMatch as d, type RSCRenderPayload as e, type RSCRouteManifest as f, getRSCStream as g, type RSCRouteMatch as h, type RSCRouteConfigEntry as i, type RSCRouteConfig as j, matchRSCServerRequest as m };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.7.0
2
+ * react-router v7.7.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -2305,9 +2305,7 @@ function createRouter(init) {
2305
2305
  )
2306
2306
  };
2307
2307
  } else {
2308
- dataResults[routeId] = await convertDataStrategyResultToDataResult(
2309
- result
2310
- );
2308
+ dataResults[routeId] = await convertDataStrategyResultToDataResult(result);
2311
2309
  }
2312
2310
  }
2313
2311
  return dataResults;
@@ -4163,7 +4161,10 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
4163
4161
  });
4164
4162
  try {
4165
4163
  await Promise.all(
4166
- matches.flatMap((m) => [m._lazyPromises?.handler, m._lazyPromises?.route])
4164
+ matches.flatMap((m) => [
4165
+ m._lazyPromises?.handler,
4166
+ m._lazyPromises?.route
4167
+ ])
4167
4168
  );
4168
4169
  } catch (e) {
4169
4170
  }
@@ -5233,68 +5234,71 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, fut
5233
5234
  }
5234
5235
  }
5235
5236
  }
5236
- return renderedMatches.reduceRight((outlet, match, index) => {
5237
- let error;
5238
- let shouldRenderHydrateFallback = false;
5239
- let errorElement = null;
5240
- let hydrateFallbackElement = null;
5241
- if (dataRouterState) {
5242
- error = errors && match.route.id ? errors[match.route.id] : void 0;
5243
- errorElement = match.route.errorElement || defaultErrorElement;
5244
- if (renderFallback) {
5245
- if (fallbackIndex < 0 && index === 0) {
5246
- warningOnce(
5247
- "route-fallback",
5248
- false,
5249
- "No `HydrateFallback` element provided to render during initial hydration"
5250
- );
5251
- shouldRenderHydrateFallback = true;
5252
- hydrateFallbackElement = null;
5253
- } else if (fallbackIndex === index) {
5254
- shouldRenderHydrateFallback = true;
5255
- hydrateFallbackElement = match.route.hydrateFallbackElement || null;
5237
+ return renderedMatches.reduceRight(
5238
+ (outlet, match, index) => {
5239
+ let error;
5240
+ let shouldRenderHydrateFallback = false;
5241
+ let errorElement = null;
5242
+ let hydrateFallbackElement = null;
5243
+ if (dataRouterState) {
5244
+ error = errors && match.route.id ? errors[match.route.id] : void 0;
5245
+ errorElement = match.route.errorElement || defaultErrorElement;
5246
+ if (renderFallback) {
5247
+ if (fallbackIndex < 0 && index === 0) {
5248
+ warningOnce(
5249
+ "route-fallback",
5250
+ false,
5251
+ "No `HydrateFallback` element provided to render during initial hydration"
5252
+ );
5253
+ shouldRenderHydrateFallback = true;
5254
+ hydrateFallbackElement = null;
5255
+ } else if (fallbackIndex === index) {
5256
+ shouldRenderHydrateFallback = true;
5257
+ hydrateFallbackElement = match.route.hydrateFallbackElement || null;
5258
+ }
5256
5259
  }
5257
5260
  }
5258
- }
5259
- let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1));
5260
- let getChildren = () => {
5261
- let children;
5262
- if (error) {
5263
- children = errorElement;
5264
- } else if (shouldRenderHydrateFallback) {
5265
- children = hydrateFallbackElement;
5266
- } else if (match.route.Component) {
5267
- children = /* @__PURE__ */ React2.createElement(match.route.Component, null);
5268
- } else if (match.route.element) {
5269
- children = match.route.element;
5270
- } else {
5271
- children = outlet;
5272
- }
5273
- return /* @__PURE__ */ React2.createElement(
5274
- RenderedRoute,
5261
+ let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1));
5262
+ let getChildren = () => {
5263
+ let children;
5264
+ if (error) {
5265
+ children = errorElement;
5266
+ } else if (shouldRenderHydrateFallback) {
5267
+ children = hydrateFallbackElement;
5268
+ } else if (match.route.Component) {
5269
+ children = /* @__PURE__ */ React2.createElement(match.route.Component, null);
5270
+ } else if (match.route.element) {
5271
+ children = match.route.element;
5272
+ } else {
5273
+ children = outlet;
5274
+ }
5275
+ return /* @__PURE__ */ React2.createElement(
5276
+ RenderedRoute,
5277
+ {
5278
+ match,
5279
+ routeContext: {
5280
+ outlet,
5281
+ matches: matches2,
5282
+ isDataRoute: dataRouterState != null
5283
+ },
5284
+ children
5285
+ }
5286
+ );
5287
+ };
5288
+ return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ React2.createElement(
5289
+ RenderErrorBoundary,
5275
5290
  {
5276
- match,
5277
- routeContext: {
5278
- outlet,
5279
- matches: matches2,
5280
- isDataRoute: dataRouterState != null
5281
- },
5282
- children
5291
+ location: dataRouterState.location,
5292
+ revalidation: dataRouterState.revalidation,
5293
+ component: errorElement,
5294
+ error,
5295
+ children: getChildren(),
5296
+ routeContext: { outlet: null, matches: matches2, isDataRoute: true }
5283
5297
  }
5284
- );
5285
- };
5286
- return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ React2.createElement(
5287
- RenderErrorBoundary,
5288
- {
5289
- location: dataRouterState.location,
5290
- revalidation: dataRouterState.revalidation,
5291
- component: errorElement,
5292
- error,
5293
- children: getChildren(),
5294
- routeContext: { outlet: null, matches: matches2, isDataRoute: true }
5295
- }
5296
- ) : getChildren();
5297
- }, null);
5298
+ ) : getChildren();
5299
+ },
5300
+ null
5301
+ );
5298
5302
  }
5299
5303
  function getDataRouterConsoleError(hookName) {
5300
5304
  return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
@@ -5802,7 +5806,7 @@ function Navigate({
5802
5806
  function Outlet(props) {
5803
5807
  return useOutlet(props.context);
5804
5808
  }
5805
- function Route(_props) {
5809
+ function Route(props) {
5806
5810
  invariant(
5807
5811
  false,
5808
5812
  `A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`
@@ -6818,8 +6822,10 @@ function encode(input, options) {
6818
6822
  lastSentIndex++;
6819
6823
  } else if (id2 < 0) {
6820
6824
  controller.enqueue(
6821
- textEncoder.encode(`${TYPE_ERROR}${deferredId}:${id2}
6822
- `)
6825
+ textEncoder.encode(
6826
+ `${TYPE_ERROR}${deferredId}:${id2}
6827
+ `
6828
+ )
6823
6829
  );
6824
6830
  } else {
6825
6831
  const values = encoder.stringified.slice(lastSentIndex + 1).join(",");
@@ -8352,10 +8358,7 @@ function Links() {
8352
8358
  ({ key, link }) => isPageLinkDescriptor(link) ? /* @__PURE__ */ React8.createElement(PrefetchPageLinks, { key, ...link }) : /* @__PURE__ */ React8.createElement("link", { key, ...link })
8353
8359
  ));
8354
8360
  }
8355
- function PrefetchPageLinks({
8356
- page,
8357
- ...dataLinkProps
8358
- }) {
8361
+ function PrefetchPageLinks({ page, ...linkProps }) {
8359
8362
  let { router } = useDataRouterContext2();
8360
8363
  let matches = React8.useMemo(
8361
8364
  () => matchRoutes(router.routes, page, router.basename),
@@ -8364,7 +8367,7 @@ function PrefetchPageLinks({
8364
8367
  if (!matches) {
8365
8368
  return null;
8366
8369
  }
8367
- return /* @__PURE__ */ React8.createElement(PrefetchPageLinksImpl, { page, matches, ...dataLinkProps });
8370
+ return /* @__PURE__ */ React8.createElement(PrefetchPageLinksImpl, { page, matches, ...linkProps });
8368
8371
  }
8369
8372
  function useKeyedPrefetchLinks(matches) {
8370
8373
  let { manifest, routeModules } = useFrameworkContext();
@@ -8568,7 +8571,7 @@ function isValidMetaTag(tagName) {
8568
8571
  return typeof tagName === "string" && /^(meta|link)$/.test(tagName);
8569
8572
  }
8570
8573
  var isHydrated = false;
8571
- function Scripts(props) {
8574
+ function Scripts(scriptProps) {
8572
8575
  let {
8573
8576
  manifest,
8574
8577
  serverHandoffString,
@@ -8654,7 +8657,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
8654
8657
  return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(
8655
8658
  "script",
8656
8659
  {
8657
- ...props,
8660
+ ...scriptProps,
8658
8661
  suppressHydrationWarning: true,
8659
8662
  dangerouslySetInnerHTML: createHtml(contextScript),
8660
8663
  type: void 0
@@ -8662,7 +8665,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
8662
8665
  ), /* @__PURE__ */ React8.createElement(
8663
8666
  "script",
8664
8667
  {
8665
- ...props,
8668
+ ...scriptProps,
8666
8669
  suppressHydrationWarning: true,
8667
8670
  dangerouslySetInnerHTML: createHtml(routeModulesScript),
8668
8671
  type: "module",
@@ -8699,7 +8702,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
8699
8702
  {
8700
8703
  rel: "modulepreload",
8701
8704
  href: manifest.url,
8702
- crossOrigin: props.crossOrigin,
8705
+ crossOrigin: scriptProps.crossOrigin,
8703
8706
  integrity: sri[manifest.url],
8704
8707
  suppressHydrationWarning: true
8705
8708
  }
@@ -8708,7 +8711,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
8708
8711
  {
8709
8712
  rel: "modulepreload",
8710
8713
  href: manifest.entry.module,
8711
- crossOrigin: props.crossOrigin,
8714
+ crossOrigin: scriptProps.crossOrigin,
8712
8715
  integrity: sri[manifest.entry.module],
8713
8716
  suppressHydrationWarning: true
8714
8717
  }
@@ -8718,7 +8721,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
8718
8721
  key: path,
8719
8722
  rel: "modulepreload",
8720
8723
  href: path,
8721
- crossOrigin: props.crossOrigin,
8724
+ crossOrigin: scriptProps.crossOrigin,
8722
8725
  integrity: sri[path],
8723
8726
  suppressHydrationWarning: true
8724
8727
  }
@@ -8842,7 +8845,7 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
8842
8845
  try {
8843
8846
  if (isBrowser) {
8844
8847
  window.__reactRouterVersion = // @ts-expect-error
8845
- "7.7.0";
8848
+ "7.7.1";
8846
8849
  }
8847
8850
  } catch (e) {
8848
8851
  }
@@ -9640,7 +9643,7 @@ function usePrompt({
9640
9643
  }
9641
9644
  }, [blocker, when]);
9642
9645
  }
9643
- function useViewTransitionState(to, opts = {}) {
9646
+ function useViewTransitionState(to, { relative } = {}) {
9644
9647
  let vtContext = React10.useContext(ViewTransitionContext);
9645
9648
  invariant(
9646
9649
  vtContext != null,
@@ -9649,7 +9652,7 @@ function useViewTransitionState(to, opts = {}) {
9649
9652
  let { basename } = useDataRouterContext3(
9650
9653
  "useViewTransitionState" /* useViewTransitionState */
9651
9654
  );
9652
- let path = useResolvedPath(to, { relative: opts.relative });
9655
+ let path = useResolvedPath(to, { relative });
9653
9656
  if (!vtContext.isTransitioning) {
9654
9657
  return false;
9655
9658
  }