react-router 7.7.0-pre.2 → 7.7.1-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 (68) hide show
  1. package/CHANGELOG.md +16 -37
  2. package/dist/development/{browser-CcxeZJcQ.d.mts → browser-7LYX59NK.d.mts} +97 -1
  3. package/dist/development/{chunk-3JI27NJZ.js → chunk-4DODSFAK.js} +79 -76
  4. package/dist/development/{chunk-XPO7SIPX.mjs → chunk-FSG5FGWQ.mjs} +83 -80
  5. package/dist/development/{chunk-XUCF2MWW.js → chunk-JKVEU2V7.js} +132 -132
  6. package/dist/{production/chunk-RXNLZWLS.mjs → development/chunk-KFHXRAUZ.mjs} +3 -5
  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/development/{route-data-DjzmHYNR.d.mts → route-data-CqEmXQub.d.mts} +48 -2
  31. package/dist/development/{routeModules-g5PTiDfO.d.ts → routeModules-BR2FO0ix.d.ts} +48 -2
  32. package/dist/production/{browser-CcxeZJcQ.d.mts → browser-7LYX59NK.d.mts} +97 -1
  33. package/dist/production/{chunk-LW7Q6L7E.js → chunk-BPUKNCMM.js} +79 -76
  34. package/dist/production/{chunk-V7D4RPWA.mjs → chunk-J4LDCI7O.mjs} +83 -80
  35. package/dist/{development/chunk-NMPYIXDO.mjs → production/chunk-MZVTKUZ4.mjs} +3 -5
  36. package/dist/production/{chunk-CLUOEFXR.js → chunk-PVPY6FX7.js} +132 -132
  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/production/{route-data-DjzmHYNR.d.mts → route-data-CqEmXQub.d.mts} +48 -2
  61. package/dist/production/{routeModules-g5PTiDfO.d.ts → 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,18 +1,13 @@
1
1
  # `react-router`
2
2
 
3
- ## 7.7.0-pre.2
3
+ ## 7.7.1-pre.0
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - [REMOVE] Inject client route component props during RSC render ([#14007](https://github.com/remix-run/react-router/pull/14007))
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))
8
9
 
9
- ## 7.7.0-pre.1
10
-
11
- ### Patch Changes
12
-
13
- - [REMOVE] (continuation of #13872) In Framework Mode, remove leftover critical CSS elements in development after initial render if there's a hydration mismatch ([#13995](https://github.com/remix-run/react-router/pull/13995))
14
-
15
- ## 7.7.0-pre.0
10
+ ## 7.7.0
16
11
 
17
12
  ### Minor Changes
18
13
 
@@ -23,13 +18,21 @@
23
18
  ### Patch Changes
24
19
 
25
20
  - Handle `InvalidCharacterError` when validating cookie signature ([#13847](https://github.com/remix-run/react-router/pull/13847))
21
+
26
22
  - Pass a copy of `searchParams` to the `setSearchParams` callback function to avoid muations of the internal `searchParams` instance. This was an issue when navigations were blocked because the internal instance be out of sync with `useLocation().search`. ([#12784](https://github.com/remix-run/react-router/pull/12784))
23
+
27
24
  - Support invalid `Date` in `turbo-stream` v2 fork ([#13684](https://github.com/remix-run/react-router/pull/13684))
25
+
28
26
  - In Framework Mode, clear critical CSS in development after initial render ([#13872](https://github.com/remix-run/react-router/pull/13872))
27
+
29
28
  - Strip search parameters from `patchRoutesOnNavigation` `path` param for fetcher calls ([#13911](https://github.com/remix-run/react-router/pull/13911))
29
+
30
30
  - Skip scroll restoration on useRevalidator() calls because they're not new locations ([#13671](https://github.com/remix-run/react-router/pull/13671))
31
+
31
32
  - Support unencoded UTF-8 routes in prerender config with `ssr` set to `false` ([#13699](https://github.com/remix-run/react-router/pull/13699))
33
+
32
34
  - Do not throw if the url hash is not a valid URI component ([#13247](https://github.com/remix-run/react-router/pull/13247))
35
+
33
36
  - Fix a regression in `createRoutesStub` introduced with the middleware feature. ([#13946](https://github.com/remix-run/react-router/pull/13946))
34
37
 
35
38
  As part of that work we altered the signature to align with the new middleware APIs without making it backwards compatible with the prior `AppLoadContext` API. This permitted `createRoutesStub` to work if you were opting into middleware and the updated `context` typings, but broke `createRoutesStub` for users not yet opting into middleware.
@@ -177,7 +180,6 @@
177
180
  ### Minor Changes
178
181
 
179
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))
180
-
181
183
  - By default, Lazy Route Discovery is enabled and makes manifest requests to the `/__manifest` path:
182
184
  - `routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" }`
183
185
  - You can modify the manifest path used:
@@ -223,7 +225,6 @@
223
225
  - Preserve status code if a `clientAction` throws a `data()` result in framework mode ([#13522](https://github.com/remix-run/react-router/pull/13522))
224
226
 
225
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))
226
-
227
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)`
228
229
 
229
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))
@@ -239,7 +240,6 @@
239
240
  - UNSTABLE: Fix a few bugs with error bubbling in middleware use-cases ([#13538](https://github.com/remix-run/react-router/pull/13538))
240
241
 
241
242
  - Short circuit post-processing on aborted `dataStrategy` requests ([#13521](https://github.com/remix-run/react-router/pull/13521))
242
-
243
243
  - This resolves non-user-facing console errors of the form `Cannot read properties of undefined (reading 'result')`
244
244
 
245
245
  ## 7.5.3
@@ -254,7 +254,6 @@
254
254
  ### Patch Changes
255
255
 
256
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))
257
-
258
257
  - This allows applications to return a redirect on `.data` requests from outside the scope of React Router (i.e., an `express`/`hono` middleware)
259
258
  - ⚠️ Please note that doing so relies on implementation details that are subject to change without a SemVer major release
260
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
@@ -292,7 +291,6 @@
292
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))
293
292
 
294
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))
295
-
296
294
  - This was a Remix v2 implementation detail inadvertently left in for React Router v7
297
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
298
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
@@ -371,7 +369,6 @@
371
369
  ### Minor Changes
372
370
 
373
371
  - Add `fetcherKey` as a parameter to `patchRoutesOnNavigation` ([#13061](https://github.com/remix-run/react-router/pull/13061))
374
-
375
372
  - In framework mode, Lazy Route Discovery will now detect manifest version mismatches after a new deploy
376
373
  - On navigations to undiscovered routes, this mismatch will trigger a document reload of the destination path
377
374
  - On `fetcher` calls to undiscovered routes, this mismatch will trigger a document reload of the current path
@@ -429,7 +426,7 @@
429
426
  ```tsx
430
427
  const clientLogger: Route.unstable_ClientMiddlewareFunction = async (
431
428
  { request },
432
- next
429
+ next,
433
430
  ) => {
434
431
  let start = performance.now();
435
432
 
@@ -448,7 +445,7 @@
448
445
  ```tsx
449
446
  const serverLogger: Route.unstable_MiddlewareFunction = async (
450
447
  { request, params, context },
451
- next
448
+ next,
452
449
  ) => {
453
450
  let start = performance.now();
454
451
 
@@ -469,7 +466,7 @@
469
466
  import { sessionContext } from "../context";
470
467
  const serverAuth: Route.unstable_MiddlewareFunction = (
471
468
  { request, params, context },
472
- next
469
+ next,
473
470
  ) => {
474
471
  let session = context.get(sessionContext);
475
472
  let user = session.get("user");
@@ -607,7 +604,6 @@
607
604
  ```
608
605
 
609
606
  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:
610
-
611
607
  - Library mode - `createBrowserRouter(routes, { unstable_getContext })`
612
608
  - Framework mode - `<HydratedRouter unstable_getContext>`
613
609
 
@@ -664,7 +660,6 @@
664
660
  - 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))
665
661
 
666
662
  - Properly handle revalidations to across a prerender/SPA boundary ([#13021](https://github.com/remix-run/react-router/pull/13021))
667
-
668
663
  - 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
669
664
  - We don't know all the pre-rendered paths client-side, however:
670
665
  - All `loader` data in `ssr:false` mode is static because it's generated at build time
@@ -674,7 +669,6 @@
674
669
  - This ensures that the route doesn't cause a `.data` request that would 404 after a submission
675
670
 
676
671
  - 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))
677
-
678
672
  - A parent route has only a `loader` (does not have a `clientLoader`)
679
673
  - The parent route is pre-rendered
680
674
  - The parent route has children routes which are not prerendered
@@ -687,7 +681,6 @@
687
681
  - 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))
688
682
 
689
683
  - Align dev server behavior with static file server behavior when `ssr:false` is set ([#12948](https://github.com/remix-run/react-router/pull/12948))
690
-
691
684
  - When no `prerender` config exists, only SSR down to the root `HydrateFallback` (SPA Mode)
692
685
  - When a `prerender` config exists but the current path is not prerendered, only SSR down to the root `HydrateFallback` (SPA Fallback)
693
686
  - Return a 404 on `.data` requests to non-pre-rendered paths
@@ -695,7 +688,6 @@
695
688
  - Improve prefetch performance of CSS side effects in framework mode ([#12889](https://github.com/remix-run/react-router/pull/12889))
696
689
 
697
690
  - 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))
698
-
699
691
  - 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
700
692
  - 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
701
693
 
@@ -772,7 +764,6 @@ _No changes_
772
764
  ### Major Changes
773
765
 
774
766
  - 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))
775
-
776
767
  - `defer`
777
768
  - `AbortedDeferredError`
778
769
  - `type TypedDeferredData`
@@ -800,7 +791,6 @@ _No changes_
800
791
  - Remove `future.v7_normalizeFormMethod` future flag ([#11697](https://github.com/remix-run/react-router/pull/11697))
801
792
 
802
793
  - 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))
803
-
804
794
  - `createCookie`
805
795
  - `createCookieSessionStorage`
806
796
  - `createMemorySessionStorage`
@@ -809,14 +799,12 @@ _No changes_
809
799
  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)
810
800
 
811
801
  Since platform-specific packages no longer need to implement this API, the following low-level APIs have been removed:
812
-
813
802
  - `createCookieFactory`
814
803
  - `createSessionStorageFactory`
815
804
  - `createCookieSessionStorageFactory`
816
805
  - `createMemorySessionStorageFactory`
817
806
 
818
807
  - Imports/Exports cleanup ([#11840](https://github.com/remix-run/react-router/pull/11840))
819
-
820
808
  - Removed the following exports that were previously public API from `@remix-run/router`
821
809
  - types
822
810
  - `AgnosticDataIndexRouteObject`
@@ -853,7 +841,6 @@ _No changes_
853
841
  - Remove `future.v7_prependBasename` from the ionternalized `@remix-run/router` package ([#11726](https://github.com/remix-run/react-router/pull/11726))
854
842
 
855
843
  - Migrate Remix type generics to React Router ([#12180](https://github.com/remix-run/react-router/pull/12180))
856
-
857
844
  - These generics are provided for Remix v2 migration purposes
858
845
  - These generics and the APIs they exist on should be considered informally deprecated in favor of the new `Route.*` types
859
846
  - Anyone migrating from React Router v6 should probably not leverage these new generics and should migrate straight to the `Route.*` types
@@ -893,11 +880,9 @@ _No changes_
893
880
  - Remove `v7_relativeSplatPath` future flag ([#11695](https://github.com/remix-run/react-router/pull/11695))
894
881
 
895
882
  - Drop support for Node 18, update minimum Node vestion to 20 ([#12171](https://github.com/remix-run/react-router/pull/12171))
896
-
897
883
  - Remove `installGlobals()` as this should no longer be necessary
898
884
 
899
885
  - Remove remaining future flags ([#11820](https://github.com/remix-run/react-router/pull/11820))
900
-
901
886
  - React Router `v7_skipActionErrorRevalidation`
902
887
  - Remix `v3_fetcherPersist`, `v3_relativeSplatPath`, `v3_throwAbortReason`
903
888
 
@@ -906,7 +891,6 @@ _No changes_
906
891
  - Remove `@remix-run/router` deprecated `detectErrorBoundary` option in favor of `mapRouteProperties` ([#11751](https://github.com/remix-run/react-router/pull/11751))
907
892
 
908
893
  - 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))
909
-
910
894
  - 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
911
895
  - DOM environments should import from `react-router/dom` to get the proper component that makes `ReactDOM.flushSync()` available:
912
896
  - If you are using the Vite plugin, use this in your `entry.client.tsx`:
@@ -970,7 +954,6 @@ _No changes_
970
954
  ```
971
955
 
972
956
  This initial implementation targets type inference for:
973
-
974
957
  - `Params` : Path parameters from your routing config in `routes.ts` including file-based routing
975
958
  - `LoaderData` : Loader data from `loader` and/or `clientLoader` within your route module
976
959
  - `ActionData` : Action data from `action` and/or `clientAction` within your route module
@@ -985,7 +968,6 @@ _No changes_
985
968
  ```
986
969
 
987
970
  Check out our docs for more:
988
-
989
971
  - [_Explanations > Type Safety_](https://reactrouter.com/dev/guides/explanation/type-safety)
990
972
  - [_How-To > Setting up type safety_](https://reactrouter.com/dev/guides/how-to/setting-up-type-safety)
991
973
 
@@ -1010,7 +992,6 @@ _No changes_
1010
992
  - Replace `substr` with `substring` ([#12080](https://github.com/remix-run/react-router/pull/12080))
1011
993
 
1012
994
  - Remove the deprecated `json` utility ([#12146](https://github.com/remix-run/react-router/pull/12146))
1013
-
1014
995
  - 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
1015
996
 
1016
997
  - Remove unneeded dependency on source-map ([#12275](https://github.com/remix-run/react-router/pull/12275))
@@ -1364,7 +1345,6 @@ No significant changes to this package were made in this release. [See the repo
1364
1345
  - 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))
1365
1346
 
1366
1347
  - 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))
1367
-
1368
1348
  - ⚠️ 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.
1369
1349
 
1370
1350
  - Updated dependencies:
@@ -1531,7 +1511,6 @@ No significant changes to this package were made in this release. [See the repo
1531
1511
  ### Minor Changes
1532
1512
 
1533
1513
  - 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))
1534
-
1535
1514
  - When `future.v7_normalizeFormMethod === false` (default v6 behavior),
1536
1515
  - `useNavigation().formMethod` is lowercase
1537
1516
  - `useFetcher().formMethod` is lowercase
@@ -1604,7 +1583,7 @@ No significant changes to this package were made in this release. [See the repo
1604
1583
  <Route index element={<Home />} />
1605
1584
  <Route path="a" lazy={() => import("./a")} />
1606
1585
  <Route path="b" lazy={() => import("./b")} />
1607
- </Route>
1586
+ </Route>,
1608
1587
  );
1609
1588
  ```
1610
1589
 
@@ -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
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
2
- * react-router v7.7.0-pre.2
2
+ * react-router v7.7.1-pre.0
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) => [_optionalChain([m, 'access', _43 => _43._lazyPromises, 'optionalAccess', _44 => _44.handler]), _optionalChain([m, 'access', _45 => _45._lazyPromises, 'optionalAccess', _46 => _46.route])])
4164
+ matches.flatMap((m) => [
4165
+ _optionalChain([m, 'access', _43 => _43._lazyPromises, 'optionalAccess', _44 => _44.handler]),
4166
+ _optionalChain([m, 'access', _45 => _45._lazyPromises, 'optionalAccess', _46 => _46.route])
4167
+ ])
4167
4168
  );
4168
4169
  } catch (e) {
4169
4170
  }
@@ -5478,8 +5479,10 @@ function encode(input, options) {
5478
5479
  lastSentIndex++;
5479
5480
  } else if (id2 < 0) {
5480
5481
  controller.enqueue(
5481
- textEncoder.encode(`${TYPE_ERROR}${deferredId}:${id2}
5482
- `)
5482
+ textEncoder.encode(
5483
+ `${TYPE_ERROR}${deferredId}:${id2}
5484
+ `
5485
+ )
5483
5486
  );
5484
5487
  } else {
5485
5488
  const values = encoder.stringified.slice(lastSentIndex + 1).join(",");
@@ -6406,68 +6409,71 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, fut
6406
6409
  }
6407
6410
  }
6408
6411
  }
6409
- return renderedMatches.reduceRight((outlet, match, index) => {
6410
- let error;
6411
- let shouldRenderHydrateFallback = false;
6412
- let errorElement = null;
6413
- let hydrateFallbackElement = null;
6414
- if (dataRouterState) {
6415
- error = errors && match.route.id ? errors[match.route.id] : void 0;
6416
- errorElement = match.route.errorElement || defaultErrorElement;
6417
- if (renderFallback) {
6418
- if (fallbackIndex < 0 && index === 0) {
6419
- warningOnce(
6420
- "route-fallback",
6421
- false,
6422
- "No `HydrateFallback` element provided to render during initial hydration"
6423
- );
6424
- shouldRenderHydrateFallback = true;
6425
- hydrateFallbackElement = null;
6426
- } else if (fallbackIndex === index) {
6427
- shouldRenderHydrateFallback = true;
6428
- hydrateFallbackElement = match.route.hydrateFallbackElement || null;
6412
+ return renderedMatches.reduceRight(
6413
+ (outlet, match, index) => {
6414
+ let error;
6415
+ let shouldRenderHydrateFallback = false;
6416
+ let errorElement = null;
6417
+ let hydrateFallbackElement = null;
6418
+ if (dataRouterState) {
6419
+ error = errors && match.route.id ? errors[match.route.id] : void 0;
6420
+ errorElement = match.route.errorElement || defaultErrorElement;
6421
+ if (renderFallback) {
6422
+ if (fallbackIndex < 0 && index === 0) {
6423
+ warningOnce(
6424
+ "route-fallback",
6425
+ false,
6426
+ "No `HydrateFallback` element provided to render during initial hydration"
6427
+ );
6428
+ shouldRenderHydrateFallback = true;
6429
+ hydrateFallbackElement = null;
6430
+ } else if (fallbackIndex === index) {
6431
+ shouldRenderHydrateFallback = true;
6432
+ hydrateFallbackElement = match.route.hydrateFallbackElement || null;
6433
+ }
6429
6434
  }
6430
6435
  }
6431
- }
6432
- let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1));
6433
- let getChildren = () => {
6434
- let children;
6435
- if (error) {
6436
- children = errorElement;
6437
- } else if (shouldRenderHydrateFallback) {
6438
- children = hydrateFallbackElement;
6439
- } else if (match.route.Component) {
6440
- children = /* @__PURE__ */ React3.createElement(match.route.Component, null);
6441
- } else if (match.route.element) {
6442
- children = match.route.element;
6443
- } else {
6444
- children = outlet;
6445
- }
6446
- return /* @__PURE__ */ React3.createElement(
6447
- RenderedRoute,
6436
+ let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1));
6437
+ let getChildren = () => {
6438
+ let children;
6439
+ if (error) {
6440
+ children = errorElement;
6441
+ } else if (shouldRenderHydrateFallback) {
6442
+ children = hydrateFallbackElement;
6443
+ } else if (match.route.Component) {
6444
+ children = /* @__PURE__ */ React3.createElement(match.route.Component, null);
6445
+ } else if (match.route.element) {
6446
+ children = match.route.element;
6447
+ } else {
6448
+ children = outlet;
6449
+ }
6450
+ return /* @__PURE__ */ React3.createElement(
6451
+ RenderedRoute,
6452
+ {
6453
+ match,
6454
+ routeContext: {
6455
+ outlet,
6456
+ matches: matches2,
6457
+ isDataRoute: dataRouterState != null
6458
+ },
6459
+ children
6460
+ }
6461
+ );
6462
+ };
6463
+ return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ React3.createElement(
6464
+ RenderErrorBoundary,
6448
6465
  {
6449
- match,
6450
- routeContext: {
6451
- outlet,
6452
- matches: matches2,
6453
- isDataRoute: dataRouterState != null
6454
- },
6455
- children
6466
+ location: dataRouterState.location,
6467
+ revalidation: dataRouterState.revalidation,
6468
+ component: errorElement,
6469
+ error,
6470
+ children: getChildren(),
6471
+ routeContext: { outlet: null, matches: matches2, isDataRoute: true }
6456
6472
  }
6457
- );
6458
- };
6459
- return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ React3.createElement(
6460
- RenderErrorBoundary,
6461
- {
6462
- location: dataRouterState.location,
6463
- revalidation: dataRouterState.revalidation,
6464
- component: errorElement,
6465
- error,
6466
- children: getChildren(),
6467
- routeContext: { outlet: null, matches: matches2, isDataRoute: true }
6468
- }
6469
- ) : getChildren();
6470
- }, null);
6473
+ ) : getChildren();
6474
+ },
6475
+ null
6476
+ );
6471
6477
  }
6472
6478
  function getDataRouterConsoleError(hookName) {
6473
6479
  return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
@@ -7630,10 +7636,7 @@ function Links() {
7630
7636
  ({ key, link }) => isPageLinkDescriptor(link) ? /* @__PURE__ */ React7.createElement(PrefetchPageLinks, { key, ...link }) : /* @__PURE__ */ React7.createElement("link", { key, ...link })
7631
7637
  ));
7632
7638
  }
7633
- function PrefetchPageLinks({
7634
- page,
7635
- ...dataLinkProps
7636
- }) {
7639
+ function PrefetchPageLinks({ page, ...linkProps }) {
7637
7640
  let { router } = useDataRouterContext2();
7638
7641
  let matches = React7.useMemo(
7639
7642
  () => matchRoutes(router.routes, page, router.basename),
@@ -7642,7 +7645,7 @@ function PrefetchPageLinks({
7642
7645
  if (!matches) {
7643
7646
  return null;
7644
7647
  }
7645
- return /* @__PURE__ */ React7.createElement(PrefetchPageLinksImpl, { page, matches, ...dataLinkProps });
7648
+ return /* @__PURE__ */ React7.createElement(PrefetchPageLinksImpl, { page, matches, ...linkProps });
7646
7649
  }
7647
7650
  function useKeyedPrefetchLinks(matches) {
7648
7651
  let { manifest, routeModules } = useFrameworkContext();
@@ -7846,7 +7849,7 @@ function isValidMetaTag(tagName) {
7846
7849
  return typeof tagName === "string" && /^(meta|link)$/.test(tagName);
7847
7850
  }
7848
7851
  var isHydrated = false;
7849
- function Scripts(props) {
7852
+ function Scripts(scriptProps) {
7850
7853
  let {
7851
7854
  manifest,
7852
7855
  serverHandoffString,
@@ -7932,7 +7935,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
7932
7935
  return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(
7933
7936
  "script",
7934
7937
  {
7935
- ...props,
7938
+ ...scriptProps,
7936
7939
  suppressHydrationWarning: true,
7937
7940
  dangerouslySetInnerHTML: createHtml(contextScript),
7938
7941
  type: void 0
@@ -7940,7 +7943,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
7940
7943
  ), /* @__PURE__ */ React7.createElement(
7941
7944
  "script",
7942
7945
  {
7943
- ...props,
7946
+ ...scriptProps,
7944
7947
  suppressHydrationWarning: true,
7945
7948
  dangerouslySetInnerHTML: createHtml(routeModulesScript),
7946
7949
  type: "module",
@@ -7977,7 +7980,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
7977
7980
  {
7978
7981
  rel: "modulepreload",
7979
7982
  href: manifest.url,
7980
- crossOrigin: props.crossOrigin,
7983
+ crossOrigin: scriptProps.crossOrigin,
7981
7984
  integrity: sri[manifest.url],
7982
7985
  suppressHydrationWarning: true
7983
7986
  }
@@ -7986,7 +7989,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
7986
7989
  {
7987
7990
  rel: "modulepreload",
7988
7991
  href: manifest.entry.module,
7989
- crossOrigin: props.crossOrigin,
7992
+ crossOrigin: scriptProps.crossOrigin,
7990
7993
  integrity: sri[manifest.entry.module],
7991
7994
  suppressHydrationWarning: true
7992
7995
  }
@@ -7996,7 +7999,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
7996
7999
  key: path,
7997
8000
  rel: "modulepreload",
7998
8001
  href: path,
7999
- crossOrigin: props.crossOrigin,
8002
+ crossOrigin: scriptProps.crossOrigin,
8000
8003
  integrity: sri[path],
8001
8004
  suppressHydrationWarning: true
8002
8005
  }