react-router 7.7.1 → 7.8.0-pre.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 (66) hide show
  1. package/CHANGELOG.md +87 -5
  2. package/dist/development/browser-z32v5KVN.d.mts +46 -0
  3. package/dist/development/{chunk-R73PQUJU.js → chunk-4EVDZJGM.js} +130 -130
  4. package/dist/{production/chunk-K3SBCRK4.mjs → development/chunk-I22FVTOY.mjs} +177 -134
  5. package/dist/development/{chunk-K7YFBME3.js → chunk-NGF2R4G7.js} +285 -189
  6. package/dist/development/{chunk-C37GKA54.mjs → chunk-XFFANEXU.mjs} +266 -170
  7. package/dist/development/{components-CjQijYga.d.mts → components-CuPfnyiZ.d.mts} +33 -21
  8. package/dist/{production/route-data-CqEmXQub.d.mts → development/context-DohQKLID.d.mts} +312 -525
  9. package/dist/development/dom-export.d.mts +16 -12
  10. package/dist/development/dom-export.d.ts +13 -8
  11. package/dist/development/dom-export.js +3 -3
  12. package/dist/development/dom-export.mjs +3 -3
  13. package/dist/development/{index-react-server-client-Bi_fx8qz.d.ts → index-react-server-client-BzBbJLAD.d.ts} +357 -219
  14. package/dist/{production/index-react-server-client-KLg-U4nr.d.mts → development/index-react-server-client-CuajY2vy.d.mts} +327 -200
  15. package/dist/development/index-react-server-client.d.mts +4 -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 +291 -71
  20. package/dist/development/index-react-server.d.ts +291 -71
  21. package/dist/development/index-react-server.js +209 -182
  22. package/dist/development/index-react-server.mjs +209 -182
  23. package/dist/development/index.d.mts +294 -86
  24. package/dist/development/index.d.ts +136 -105
  25. package/dist/development/index.js +258 -215
  26. package/dist/development/index.mjs +3 -3
  27. package/dist/development/lib/types/internal.d.mts +13 -2
  28. package/dist/development/lib/types/internal.d.ts +12 -2
  29. package/dist/development/lib/types/internal.js +1 -1
  30. package/dist/development/lib/types/internal.mjs +1 -1
  31. package/dist/development/route-data-CpB5xtMm.d.mts +473 -0
  32. package/dist/{production/routeModules-BR2FO0ix.d.ts → development/routeModules-qBivMBjd.d.ts} +325 -68
  33. package/dist/production/browser-z32v5KVN.d.mts +46 -0
  34. package/dist/production/{chunk-4DGLNKXF.js → chunk-4PESVXQ2.js} +130 -130
  35. package/dist/{development/chunk-KIUJAIYX.mjs → production/chunk-JJOMWYJ4.mjs} +177 -134
  36. package/dist/production/{chunk-IZ57JD2V.mjs → chunk-P2ZJHOXZ.mjs} +266 -170
  37. package/dist/production/{chunk-7OQROU2D.js → chunk-RLJ23MYZ.js} +285 -189
  38. package/dist/production/{components-CjQijYga.d.mts → components-CuPfnyiZ.d.mts} +33 -21
  39. package/dist/{development/route-data-CqEmXQub.d.mts → production/context-DohQKLID.d.mts} +312 -525
  40. package/dist/production/dom-export.d.mts +16 -12
  41. package/dist/production/dom-export.d.ts +13 -8
  42. package/dist/production/dom-export.js +3 -3
  43. package/dist/production/dom-export.mjs +3 -3
  44. package/dist/production/{index-react-server-client-Bi_fx8qz.d.ts → index-react-server-client-BzBbJLAD.d.ts} +357 -219
  45. package/dist/{development/index-react-server-client-KLg-U4nr.d.mts → production/index-react-server-client-CuajY2vy.d.mts} +327 -200
  46. package/dist/production/index-react-server-client.d.mts +4 -3
  47. package/dist/production/index-react-server-client.d.ts +2 -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 +291 -71
  51. package/dist/production/index-react-server.d.ts +291 -71
  52. package/dist/production/index-react-server.js +209 -182
  53. package/dist/production/index-react-server.mjs +209 -182
  54. package/dist/production/index.d.mts +294 -86
  55. package/dist/production/index.d.ts +136 -105
  56. package/dist/production/index.js +258 -215
  57. package/dist/production/index.mjs +3 -3
  58. package/dist/production/lib/types/internal.d.mts +13 -2
  59. package/dist/production/lib/types/internal.d.ts +12 -2
  60. package/dist/production/lib/types/internal.js +1 -1
  61. package/dist/production/lib/types/internal.mjs +1 -1
  62. package/dist/production/route-data-CpB5xtMm.d.mts +473 -0
  63. package/dist/{development/routeModules-BR2FO0ix.d.ts → production/routeModules-qBivMBjd.d.ts} +325 -68
  64. package/package.json +1 -1
  65. package/dist/development/browser-7LYX59NK.d.mts +0 -226
  66. package/dist/production/browser-7LYX59NK.d.mts +0 -226
@@ -1,226 +0,0 @@
1
- import { AsyncLocalStorage } from 'node:async_hooks';
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-CqEmXQub.mjs';
4
-
5
- type ServerContext = {
6
- redirect?: Response;
7
- };
8
- declare global {
9
- var ___reactRouterServerStorage___: AsyncLocalStorage<ServerContext> | undefined;
10
- }
11
- type RSCRouteConfigEntryBase = {
12
- action?: ActionFunction;
13
- clientAction?: ClientActionFunction;
14
- clientLoader?: ClientLoaderFunction;
15
- ErrorBoundary?: React.ComponentType<any>;
16
- handle?: any;
17
- headers?: HeadersFunction;
18
- HydrateFallback?: React.ComponentType<any>;
19
- Layout?: React.ComponentType<any>;
20
- links?: LinksFunction;
21
- loader?: LoaderFunction;
22
- meta?: MetaFunction;
23
- shouldRevalidate?: ShouldRevalidateFunction;
24
- };
25
- type RSCRouteConfigEntry = RSCRouteConfigEntryBase & {
26
- id: string;
27
- path?: string;
28
- Component?: React.ComponentType<any>;
29
- lazy?: () => Promise<RSCRouteConfigEntryBase & ({
30
- default?: React.ComponentType<any>;
31
- Component?: never;
32
- } | {
33
- default?: never;
34
- Component?: React.ComponentType<any>;
35
- })>;
36
- } & ({
37
- index: true;
38
- } | {
39
- children?: RSCRouteConfigEntry[];
40
- });
41
- type RSCRouteConfig = Array<RSCRouteConfigEntry>;
42
- type RSCRouteManifest = {
43
- clientAction?: ClientActionFunction;
44
- clientLoader?: ClientLoaderFunction;
45
- element?: React.ReactElement | false;
46
- errorElement?: React.ReactElement;
47
- handle?: any;
48
- hasAction: boolean;
49
- hasComponent: boolean;
50
- hasErrorBoundary: boolean;
51
- hasLoader: boolean;
52
- hydrateFallbackElement?: React.ReactElement;
53
- id: string;
54
- index?: boolean;
55
- links?: LinksFunction;
56
- meta?: MetaFunction;
57
- parentId?: string;
58
- path?: string;
59
- shouldRevalidate?: ShouldRevalidateFunction;
60
- };
61
- type RSCRouteMatch = RSCRouteManifest & {
62
- params: Params;
63
- pathname: string;
64
- pathnameBase: string;
65
- };
66
- type RSCRenderPayload = {
67
- type: "render";
68
- actionData: Record<string, any> | null;
69
- basename: string | undefined;
70
- errors: Record<string, any> | null;
71
- loaderData: Record<string, any>;
72
- location: Location;
73
- matches: RSCRouteMatch[];
74
- patches?: RSCRouteManifest[];
75
- nonce?: string;
76
- formState?: unknown;
77
- };
78
- type RSCManifestPayload = {
79
- type: "manifest";
80
- patches: RSCRouteManifest[];
81
- };
82
- type RSCActionPayload = {
83
- type: "action";
84
- actionResult: Promise<unknown>;
85
- rerender?: Promise<RSCRenderPayload | RSCRedirectPayload>;
86
- };
87
- type RSCRedirectPayload = {
88
- type: "redirect";
89
- status: number;
90
- location: string;
91
- replace: boolean;
92
- reload: boolean;
93
- actionResult?: Promise<unknown>;
94
- };
95
- type RSCPayload = RSCRenderPayload | RSCManifestPayload | RSCActionPayload | RSCRedirectPayload;
96
- type RSCMatch = {
97
- statusCode: number;
98
- headers: Headers;
99
- payload: RSCPayload;
100
- };
101
- type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>;
102
- type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
103
- type DecodeReplyFunction = (reply: FormData | string, { temporaryReferences }: {
104
- temporaryReferences: unknown;
105
- }) => Promise<unknown[]>;
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
- */
168
- declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename, decodeReply, requestContext, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
169
- createTemporaryReferenceSet: () => unknown;
170
- basename?: string;
171
- decodeReply?: DecodeReplyFunction;
172
- decodeAction?: DecodeActionFunction;
173
- decodeFormState?: DecodeFormStateFunction;
174
- requestContext?: unstable_RouterContextProvider;
175
- loadServerAction?: LoadServerActionFunction;
176
- onError?: (error: unknown) => void;
177
- request: Request;
178
- routes: RSCRouteConfigEntry[];
179
- generateResponse: (match: RSCMatch, { temporaryReferences, }: {
180
- temporaryReferences: unknown;
181
- }) => Response;
182
- }): Promise<Response>;
183
-
184
- declare global {
185
- interface Window {
186
- __FLIGHT_DATA: any[];
187
- }
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
- */
224
- declare function getRSCStream(): ReadableStream<any>;
225
-
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,226 +0,0 @@
1
- import { AsyncLocalStorage } from 'node:async_hooks';
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-CqEmXQub.mjs';
4
-
5
- type ServerContext = {
6
- redirect?: Response;
7
- };
8
- declare global {
9
- var ___reactRouterServerStorage___: AsyncLocalStorage<ServerContext> | undefined;
10
- }
11
- type RSCRouteConfigEntryBase = {
12
- action?: ActionFunction;
13
- clientAction?: ClientActionFunction;
14
- clientLoader?: ClientLoaderFunction;
15
- ErrorBoundary?: React.ComponentType<any>;
16
- handle?: any;
17
- headers?: HeadersFunction;
18
- HydrateFallback?: React.ComponentType<any>;
19
- Layout?: React.ComponentType<any>;
20
- links?: LinksFunction;
21
- loader?: LoaderFunction;
22
- meta?: MetaFunction;
23
- shouldRevalidate?: ShouldRevalidateFunction;
24
- };
25
- type RSCRouteConfigEntry = RSCRouteConfigEntryBase & {
26
- id: string;
27
- path?: string;
28
- Component?: React.ComponentType<any>;
29
- lazy?: () => Promise<RSCRouteConfigEntryBase & ({
30
- default?: React.ComponentType<any>;
31
- Component?: never;
32
- } | {
33
- default?: never;
34
- Component?: React.ComponentType<any>;
35
- })>;
36
- } & ({
37
- index: true;
38
- } | {
39
- children?: RSCRouteConfigEntry[];
40
- });
41
- type RSCRouteConfig = Array<RSCRouteConfigEntry>;
42
- type RSCRouteManifest = {
43
- clientAction?: ClientActionFunction;
44
- clientLoader?: ClientLoaderFunction;
45
- element?: React.ReactElement | false;
46
- errorElement?: React.ReactElement;
47
- handle?: any;
48
- hasAction: boolean;
49
- hasComponent: boolean;
50
- hasErrorBoundary: boolean;
51
- hasLoader: boolean;
52
- hydrateFallbackElement?: React.ReactElement;
53
- id: string;
54
- index?: boolean;
55
- links?: LinksFunction;
56
- meta?: MetaFunction;
57
- parentId?: string;
58
- path?: string;
59
- shouldRevalidate?: ShouldRevalidateFunction;
60
- };
61
- type RSCRouteMatch = RSCRouteManifest & {
62
- params: Params;
63
- pathname: string;
64
- pathnameBase: string;
65
- };
66
- type RSCRenderPayload = {
67
- type: "render";
68
- actionData: Record<string, any> | null;
69
- basename: string | undefined;
70
- errors: Record<string, any> | null;
71
- loaderData: Record<string, any>;
72
- location: Location;
73
- matches: RSCRouteMatch[];
74
- patches?: RSCRouteManifest[];
75
- nonce?: string;
76
- formState?: unknown;
77
- };
78
- type RSCManifestPayload = {
79
- type: "manifest";
80
- patches: RSCRouteManifest[];
81
- };
82
- type RSCActionPayload = {
83
- type: "action";
84
- actionResult: Promise<unknown>;
85
- rerender?: Promise<RSCRenderPayload | RSCRedirectPayload>;
86
- };
87
- type RSCRedirectPayload = {
88
- type: "redirect";
89
- status: number;
90
- location: string;
91
- replace: boolean;
92
- reload: boolean;
93
- actionResult?: Promise<unknown>;
94
- };
95
- type RSCPayload = RSCRenderPayload | RSCManifestPayload | RSCActionPayload | RSCRedirectPayload;
96
- type RSCMatch = {
97
- statusCode: number;
98
- headers: Headers;
99
- payload: RSCPayload;
100
- };
101
- type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>;
102
- type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
103
- type DecodeReplyFunction = (reply: FormData | string, { temporaryReferences }: {
104
- temporaryReferences: unknown;
105
- }) => Promise<unknown[]>;
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
- */
168
- declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename, decodeReply, requestContext, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
169
- createTemporaryReferenceSet: () => unknown;
170
- basename?: string;
171
- decodeReply?: DecodeReplyFunction;
172
- decodeAction?: DecodeActionFunction;
173
- decodeFormState?: DecodeFormStateFunction;
174
- requestContext?: unstable_RouterContextProvider;
175
- loadServerAction?: LoadServerActionFunction;
176
- onError?: (error: unknown) => void;
177
- request: Request;
178
- routes: RSCRouteConfigEntry[];
179
- generateResponse: (match: RSCMatch, { temporaryReferences, }: {
180
- temporaryReferences: unknown;
181
- }) => Response;
182
- }): Promise<Response>;
183
-
184
- declare global {
185
- interface Window {
186
- __FLIGHT_DATA: any[];
187
- }
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
- */
224
- declare function getRSCStream(): ReadableStream<any>;
225
-
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 };