react-router 0.0.0-experimental-de3b900 → 0.0.0-experimental-66357d4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/CHANGELOG.md +0 -105
  2. package/dist/development/browser-z32v5KVN.d.mts +46 -0
  3. package/dist/development/chunk-AUR3D34A.js +2092 -0
  4. package/dist/development/{chunk-OVO62ONG.mjs → chunk-HS5MTFS5.mjs} +361 -35
  5. package/dist/development/{chunk-K3XLKYJI.js → chunk-LTIKPFLE.js} +456 -896
  6. package/dist/development/{chunk-5VDQAMOM.mjs → chunk-XPUZCADB.mjs} +873 -181
  7. package/dist/development/dom-export.d.mts +58 -51
  8. package/dist/development/dom-export.d.ts +57 -51
  9. package/dist/development/dom-export.js +23 -705
  10. package/dist/development/dom-export.mjs +14 -689
  11. package/dist/development/{index-react-server-client-BOJoTiaG.d.ts → index-react-server-client-DfG69UJB.d.mts} +137 -76
  12. package/dist/{production/index-react-server-client-BOJoTiaG.d.ts → development/index-react-server-client-yVB1-HLg.d.ts} +137 -76
  13. package/dist/development/index-react-server-client.d.mts +3 -2
  14. package/dist/development/index-react-server-client.d.ts +3 -2
  15. package/dist/development/index-react-server-client.js +4 -4
  16. package/dist/development/index-react-server-client.mjs +2 -2
  17. package/dist/development/index-react-server.d.mts +105 -1
  18. package/dist/development/index-react-server.d.ts +105 -1
  19. package/dist/development/index-react-server.js +233 -9
  20. package/dist/development/index-react-server.mjs +233 -9
  21. package/dist/development/index.d.mts +320 -21
  22. package/dist/development/index.d.ts +364 -21
  23. package/dist/development/index.js +977 -131
  24. package/dist/development/index.mjs +9 -5
  25. package/dist/development/instrumentation-DtvuKjF4.d.ts +1137 -0
  26. package/dist/development/lib/types/internal.d.mts +3 -2
  27. package/dist/development/lib/types/internal.d.ts +3 -2
  28. package/dist/development/lib/types/internal.js +1 -1
  29. package/dist/development/lib/types/internal.mjs +1 -1
  30. package/dist/development/{register-BblEgJPm.d.mts → register-DiOIlEq5.d.mts} +1 -7
  31. package/dist/{production/register-BblEgJPm.d.mts → development/register-DiOIlEq5.d.ts} +1 -7
  32. package/dist/{production/routeModules-9wlxglVk.d.ts → development/routeModules-CFZBJATH.d.ts} +65 -1051
  33. package/dist/development/routeModules-HBmR8g6L.d.mts +473 -0
  34. package/dist/{production/route-data-nQS6GSUI.d.mts → development/router-CMQtiIzS.d.mts} +900 -1221
  35. package/dist/production/browser-z32v5KVN.d.mts +46 -0
  36. package/dist/production/chunk-5S426J27.js +2092 -0
  37. package/dist/production/{chunk-XOCFS75J.mjs → chunk-PFLHSZTM.mjs} +873 -181
  38. package/dist/production/{chunk-63YB5VLY.js → chunk-TWSUV4HV.js} +456 -896
  39. package/dist/production/{chunk-U25H5FTL.mjs → chunk-WOV726ZF.mjs} +361 -35
  40. package/dist/production/dom-export.d.mts +58 -51
  41. package/dist/production/dom-export.d.ts +57 -51
  42. package/dist/production/dom-export.js +23 -705
  43. package/dist/production/dom-export.mjs +14 -689
  44. package/dist/{development/index-react-server-client-CuQLmpku.d.mts → production/index-react-server-client-DfG69UJB.d.mts} +137 -76
  45. package/dist/production/{index-react-server-client-CuQLmpku.d.mts → index-react-server-client-yVB1-HLg.d.ts} +137 -76
  46. package/dist/production/index-react-server-client.d.mts +3 -2
  47. package/dist/production/index-react-server-client.d.ts +3 -2
  48. package/dist/production/index-react-server-client.js +4 -4
  49. package/dist/production/index-react-server-client.mjs +2 -2
  50. package/dist/production/index-react-server.d.mts +105 -1
  51. package/dist/production/index-react-server.d.ts +105 -1
  52. package/dist/production/index-react-server.js +233 -9
  53. package/dist/production/index-react-server.mjs +233 -9
  54. package/dist/production/index.d.mts +320 -21
  55. package/dist/production/index.d.ts +364 -21
  56. package/dist/production/index.js +977 -131
  57. package/dist/production/index.mjs +9 -5
  58. package/dist/production/instrumentation-DtvuKjF4.d.ts +1137 -0
  59. package/dist/production/lib/types/internal.d.mts +3 -2
  60. package/dist/production/lib/types/internal.d.ts +3 -2
  61. package/dist/production/lib/types/internal.js +1 -1
  62. package/dist/production/lib/types/internal.mjs +1 -1
  63. package/dist/{development/register-D18raRVf.d.ts → production/register-DiOIlEq5.d.mts} +1 -7
  64. package/dist/production/{register-D18raRVf.d.ts → register-DiOIlEq5.d.ts} +1 -7
  65. package/dist/{development/routeModules-9wlxglVk.d.ts → production/routeModules-CFZBJATH.d.ts} +65 -1051
  66. package/dist/production/routeModules-HBmR8g6L.d.mts +473 -0
  67. package/dist/{development/route-data-nQS6GSUI.d.mts → production/router-CMQtiIzS.d.mts} +900 -1221
  68. package/package.json +1 -1
  69. package/dist/development/browser-B4aBBnx8.d.ts +0 -310
  70. package/dist/development/browser-CN2w9Cbu.d.mts +0 -310
  71. package/dist/development/chunk-JEIV2ESS.js +0 -1308
  72. package/dist/development/chunk-UPBUMW2M.js +0 -188
  73. package/dist/production/browser-B4aBBnx8.d.ts +0 -310
  74. package/dist/production/browser-CN2w9Cbu.d.mts +0 -310
  75. package/dist/production/chunk-IE722GR6.js +0 -188
  76. package/dist/production/chunk-VX4OHTGR.js +0 -1308
package/CHANGELOG.md CHANGED
@@ -1,110 +1,5 @@
1
1
  # `react-router`
2
2
 
3
- ## 7.9.4
4
-
5
- ### Patch Changes
6
-
7
- - handle external redirects in from server actions ([#14400](https://github.com/remix-run/react-router/pull/14400))
8
- - New (unstable) `useRoute` hook for accessing data from specific routes ([#14407](https://github.com/remix-run/react-router/pull/14407))
9
-
10
- For example, let's say you have an `admin` route somewhere in your app and you want any child routes of `admin` to all have access to the `loaderData` and `actionData` from `admin.`
11
-
12
- ```tsx
13
- // app/routes/admin.tsx
14
- import { Outlet } from "react-router";
15
-
16
- export const loader = () => ({ message: "Hello, loader!" });
17
-
18
- export const action = () => ({ count: 1 });
19
-
20
- export default function Component() {
21
- return (
22
- <div>
23
- {/* ... */}
24
- <Outlet />
25
- {/* ... */}
26
- </div>
27
- );
28
- }
29
- ```
30
-
31
- You might even want to create a reusable widget that all of the routes nested under `admin` could use:
32
-
33
- ```tsx
34
- import { unstable_useRoute as useRoute } from "react-router";
35
-
36
- export function AdminWidget() {
37
- // How to get `message` and `count` from `admin` route?
38
- }
39
- ```
40
-
41
- In framework mode, `useRoute` knows all your app's routes and gives you TS errors when invalid route IDs are passed in:
42
-
43
- ```tsx
44
- export function AdminWidget() {
45
- const admin = useRoute("routes/dmin");
46
- // ^^^^^^^^^^^
47
- }
48
- ```
49
-
50
- `useRoute` returns `undefined` if the route is not part of the current page:
51
-
52
- ```tsx
53
- export function AdminWidget() {
54
- const admin = useRoute("routes/admin");
55
- if (!admin) {
56
- throw new Error(`AdminWidget used outside of "routes/admin"`);
57
- }
58
- }
59
- ```
60
-
61
- Note: the `root` route is the exception since it is guaranteed to be part of the current page.
62
- As a result, `useRoute` never returns `undefined` for `root`.
63
-
64
- `loaderData` and `actionData` are marked as optional since they could be accessed before the `action` is triggered or after the `loader` threw an error:
65
-
66
- ```tsx
67
- export function AdminWidget() {
68
- const admin = useRoute("routes/admin");
69
- if (!admin) {
70
- throw new Error(`AdminWidget used outside of "routes/admin"`);
71
- }
72
- const { loaderData, actionData } = admin;
73
- console.log(loaderData);
74
- // ^? { message: string } | undefined
75
- console.log(actionData);
76
- // ^? { count: number } | undefined
77
- }
78
- ```
79
-
80
- If instead of a specific route, you wanted access to the _current_ route's `loaderData` and `actionData`, you can call `useRoute` without arguments:
81
-
82
- ```tsx
83
- export function AdminWidget() {
84
- const currentRoute = useRoute();
85
- currentRoute.loaderData;
86
- currentRoute.actionData;
87
- }
88
- ```
89
-
90
- This usage is equivalent to calling `useLoaderData` and `useActionData`, but consolidates all route data access into one hook: `useRoute`.
91
-
92
- Note: when calling `useRoute()` (without a route ID), TS has no way to know which route is the current route.
93
- As a result, `loaderData` and `actionData` are typed as `unknown`.
94
- If you want more type-safety, you can either narrow the type yourself with something like `zod` or you can refactor your app to pass down typed props to your `AdminWidget`:
95
-
96
- ```tsx
97
- export function AdminWidget({
98
- message,
99
- count,
100
- }: {
101
- message: string;
102
- count: number;
103
- }) {
104
- /* ... */
105
- }
106
- ```
107
-
108
3
  ## 7.9.3
109
4
 
110
5
  ### Patch Changes
@@ -0,0 +1,46 @@
1
+ declare global {
2
+ interface Window {
3
+ __FLIGHT_DATA: any[];
4
+ }
5
+ }
6
+ /**
7
+ * Get the prerendered [RSC](https://react.dev/reference/rsc/server-components)
8
+ * stream for hydration. Usually passed directly to your
9
+ * `react-server-dom-xyz/client`'s `createFromReadableStream`.
10
+ *
11
+ * @example
12
+ * import { startTransition, StrictMode } from "react";
13
+ * import { hydrateRoot } from "react-dom/client";
14
+ * import {
15
+ * unstable_getRSCStream as getRSCStream,
16
+ * unstable_RSCHydratedRouter as RSCHydratedRouter,
17
+ * } from "react-router";
18
+ * import type { unstable_RSCPayload as RSCPayload } from "react-router";
19
+ *
20
+ * createFromReadableStream(getRSCStream()).then(
21
+ * (payload: RSCServerPayload) => {
22
+ * startTransition(async () => {
23
+ * hydrateRoot(
24
+ * document,
25
+ * <StrictMode>
26
+ * <RSCHydratedRouter {...props} />
27
+ * </StrictMode>,
28
+ * {
29
+ * // Options
30
+ * }
31
+ * );
32
+ * });
33
+ * }
34
+ * );
35
+ *
36
+ * @name unstable_getRSCStream
37
+ * @public
38
+ * @category RSC
39
+ * @mode data
40
+ * @returns A [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream)
41
+ * that contains the [RSC](https://react.dev/reference/rsc/server-components)
42
+ * data for hydration.
43
+ */
44
+ declare function getRSCStream(): ReadableStream;
45
+
46
+ export { getRSCStream as g };