react-router 0.0.0-experimental-b588f7e → 0.0.0-experimental-23decd7bc

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 (64) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/development/browser-CmIT056Z.d.mts +154 -0
  3. package/dist/development/chunk-3E3CD4NY.mjs +2669 -0
  4. package/dist/development/{chunk-3HOZPCHX.mjs → chunk-GJVCYY62.mjs} +1445 -3021
  5. package/dist/development/chunk-H2M6MMUH.js +10007 -0
  6. package/dist/development/chunk-I3MHZ4NU.js +21 -0
  7. package/dist/development/components-CwtESh53.d.mts +816 -0
  8. package/dist/development/dom-export.d.mts +4 -2
  9. package/dist/development/dom-export.js +53 -72
  10. package/dist/development/dom-export.mjs +7 -4
  11. package/dist/development/index-react-server-client-CzKQ01cq.d.mts +1360 -0
  12. package/dist/development/{lib-oW7CoPA6.d.mts → index-react-server-client-unV28389.d.ts} +39 -39
  13. package/dist/development/index-react-server-client.d.mts +4 -0
  14. package/dist/development/index-react-server-client.d.ts +3 -0
  15. package/dist/development/index-react-server-client.js +54 -0
  16. package/dist/development/index-react-server-client.mjs +53 -0
  17. package/dist/development/index-react-server.d.mts +1861 -0
  18. package/dist/development/index-react-server.d.ts +1861 -0
  19. package/dist/development/index-react-server.js +3137 -0
  20. package/dist/development/index-react-server.mjs +3025 -0
  21. package/dist/development/index.d.mts +32 -46
  22. package/dist/development/index.d.ts +191 -2223
  23. package/dist/development/index.js +2577 -11464
  24. package/dist/development/index.mjs +33 -22
  25. package/dist/development/lib/types/internal.d.mts +8 -72
  26. package/dist/development/lib/types/internal.d.ts +8 -71
  27. package/dist/development/lib/types/internal.js +2 -20
  28. package/dist/development/lib/types/internal.mjs +1 -1
  29. package/dist/{production/register-DeIo2iHO.d.mts → development/register-DiOIlEq5.d.mts} +1 -1
  30. package/dist/development/{register-DeIo2iHO.d.mts → register-DiOIlEq5.d.ts} +1 -1
  31. package/dist/development/{route-data-ByAYLHuM.d.mts → route-data-Csr8hE3v.d.mts} +80 -3
  32. package/dist/{production/register-DCE0tH5m.d.ts → development/route-data-x_b_BLCv.d.ts} +90 -36
  33. package/dist/production/browser-CmIT056Z.d.mts +154 -0
  34. package/dist/production/chunk-7TUGB72O.js +10007 -0
  35. package/dist/production/chunk-I3MHZ4NU.js +21 -0
  36. package/dist/production/chunk-XNTCWHOK.mjs +2669 -0
  37. package/dist/production/{chunk-UROK22QK.mjs → chunk-YWCG2M57.mjs} +1445 -3021
  38. package/dist/production/components-CwtESh53.d.mts +816 -0
  39. package/dist/production/dom-export.d.mts +4 -2
  40. package/dist/production/dom-export.js +53 -72
  41. package/dist/production/dom-export.mjs +7 -4
  42. package/dist/production/index-react-server-client-CzKQ01cq.d.mts +1360 -0
  43. package/dist/production/{lib-oW7CoPA6.d.mts → index-react-server-client-unV28389.d.ts} +39 -39
  44. package/dist/production/index-react-server-client.d.mts +4 -0
  45. package/dist/production/index-react-server-client.d.ts +3 -0
  46. package/dist/production/index-react-server-client.js +54 -0
  47. package/dist/production/index-react-server-client.mjs +53 -0
  48. package/dist/production/index-react-server.d.mts +1861 -0
  49. package/dist/production/index-react-server.d.ts +1861 -0
  50. package/dist/production/index-react-server.js +3137 -0
  51. package/dist/production/index-react-server.mjs +3025 -0
  52. package/dist/production/index.d.mts +32 -46
  53. package/dist/production/index.d.ts +191 -2223
  54. package/dist/production/index.js +2577 -11464
  55. package/dist/production/index.mjs +33 -22
  56. package/dist/production/lib/types/internal.d.mts +8 -72
  57. package/dist/production/lib/types/internal.d.ts +8 -71
  58. package/dist/production/lib/types/internal.js +2 -20
  59. package/dist/production/lib/types/internal.mjs +1 -1
  60. package/dist/production/register-DiOIlEq5.d.mts +24 -0
  61. package/dist/production/register-DiOIlEq5.d.ts +24 -0
  62. package/dist/{development/register-DCE0tH5m.d.ts → production/route-data-Csr8hE3v.d.mts} +80 -26
  63. package/dist/production/{route-data-ByAYLHuM.d.mts → route-data-x_b_BLCv.d.ts} +90 -13
  64. package/package.json +49 -10
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-b588f7e
2
+ * react-router v0.0.0-experimental-23decd7bc
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -8,8 +8,31 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
+ "use client";
12
+ import {
13
+ RSCDefaultRootErrorBoundary,
14
+ RSCHydratedRouter,
15
+ RSCStaticRouter,
16
+ ServerMode,
17
+ ServerRouter,
18
+ createCallServer,
19
+ createCookie,
20
+ createCookieSessionStorage,
21
+ createMemorySessionStorage,
22
+ createRequestHandler,
23
+ createRoutesStub,
24
+ createSession,
25
+ createSessionStorage,
26
+ deserializeErrors,
27
+ getHydrationData,
28
+ getRSCStream,
29
+ href,
30
+ isCookie,
31
+ isSession,
32
+ routeRSCServerRequest,
33
+ setDevServerHooks
34
+ } from "./chunk-3E3CD4NY.mjs";
11
35
  import {
12
- AbsoluteRoutes,
13
36
  Action,
14
37
  Await,
15
38
  BrowserRouter,
@@ -42,8 +65,6 @@ import {
42
65
  Routes,
43
66
  Scripts,
44
67
  ScrollRestoration,
45
- ServerMode,
46
- ServerRouter,
47
68
  SingleFetchRedirectSymbol,
48
69
  StaticRouter,
49
70
  StaticRouterProvider,
@@ -52,35 +73,23 @@ import {
52
73
  createBrowserRouter,
53
74
  createClientRoutes,
54
75
  createClientRoutesWithHMRRevalidationOptOut,
55
- createCookie,
56
- createCookieSessionStorage,
57
76
  createHashRouter,
58
77
  createMemoryRouter,
59
- createMemorySessionStorage,
60
78
  createPath,
61
- createRequestHandler,
62
79
  createRouter,
63
80
  createRoutesFromChildren,
64
81
  createRoutesFromElements,
65
- createRoutesStub,
66
82
  createSearchParams,
67
- createSession,
68
- createSessionStorage,
69
- createStaticHandler,
83
+ createStaticHandler2 as createStaticHandler,
70
84
  createStaticRouter,
71
85
  data,
72
86
  decodeViaTurboStream,
73
- deserializeErrors,
74
87
  generatePath,
75
- getHydrationData,
76
88
  getPatchRoutesOnNavigationFunction,
77
89
  getTurboStreamSingleFetchDataStrategy,
78
- href,
79
90
  hydrationRouteProperties,
80
91
  invariant,
81
- isCookie,
82
92
  isRouteErrorResponse,
83
- isSession,
84
93
  mapRouteProperties,
85
94
  matchPath,
86
95
  matchRoutes,
@@ -90,11 +99,9 @@ import {
90
99
  renderMatches,
91
100
  replace,
92
101
  resolvePath,
93
- setDevServerHooks,
94
102
  shouldHydrateRouteLoader,
95
103
  unstable_RouterContextProvider,
96
104
  unstable_createContext,
97
- useAbsoluteRoutes,
98
105
  useActionData,
99
106
  useAsyncError,
100
107
  useAsyncValue,
@@ -130,7 +137,7 @@ import {
130
137
  withComponentProps,
131
138
  withErrorBoundaryProps,
132
139
  withHydrateFallbackProps
133
- } from "./chunk-3HOZPCHX.mjs";
140
+ } from "./chunk-GJVCYY62.mjs";
134
141
  export {
135
142
  Await,
136
143
  BrowserRouter,
@@ -164,6 +171,7 @@ export {
164
171
  FrameworkContext as UNSAFE_FrameworkContext,
165
172
  LocationContext as UNSAFE_LocationContext,
166
173
  NavigationContext as UNSAFE_NavigationContext,
174
+ RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary,
167
175
  RemixErrorBoundary as UNSAFE_RemixErrorBoundary,
168
176
  RouteContext as UNSAFE_RouteContext,
169
177
  ServerMode as UNSAFE_ServerMode,
@@ -217,12 +225,15 @@ export {
217
225
  renderMatches,
218
226
  replace,
219
227
  resolvePath,
220
- AbsoluteRoutes as unstable_AbsoluteRoutes,
221
228
  HistoryRouter as unstable_HistoryRouter,
229
+ RSCHydratedRouter as unstable_RSCHydratedRouter,
230
+ RSCStaticRouter as unstable_RSCStaticRouter,
222
231
  unstable_RouterContextProvider,
232
+ createCallServer as unstable_createCallServer,
223
233
  unstable_createContext,
234
+ getRSCStream as unstable_getRSCStream,
235
+ routeRSCServerRequest as unstable_routeRSCServerRequest,
224
236
  setDevServerHooks as unstable_setDevServerHooks,
225
- useAbsoluteRoutes as unstable_useAbsoluteRoutes,
226
237
  usePrompt as unstable_usePrompt,
227
238
  useActionData,
228
239
  useAsyncError,
@@ -1,5 +1,5 @@
1
- import { aD as LinkDescriptor, aV as RouteModule, L as Location, aA as MetaDescriptor, aW as unstable_MiddlewareNextFunction, aX as ServerDataFrom, a9 as unstable_RouterContextProvider, h as MiddlewareEnabled, i as AppLoadContext, aY as Pretty, aZ as GetLoaderData, a_ as Normalize, a$ as GetActionData } from '../../route-data-ByAYLHuM.mjs';
2
- import { a as RouteFiles, P as Pages } from '../../register-DeIo2iHO.mjs';
1
+ import { v as RouteModule, w as LinkDescriptor, L as Location, x as Pretty, y as MetaDescriptor, G as GetLoaderData, z as ServerDataFunctionArgs, E as unstable_MiddlewareNextFunction, J as ClientDataFunctionArgs, K as ServerDataFrom, O as Normalize, Q as GetActionData } from '../../route-data-Csr8hE3v.mjs';
2
+ import { R as RouteFiles, P as Pages } from '../../register-DiOIlEq5.mjs';
3
3
  import 'react';
4
4
 
5
5
  type MaybePromise<T> = T | Promise<T>;
@@ -45,79 +45,15 @@ type HeadersArgs = {
45
45
  actionHeaders: Headers;
46
46
  errorHeaders: Headers | undefined;
47
47
  };
48
- type ClientDataFunctionArgs<T extends RouteInfo> = {
49
- /**
50
- * A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the URL, the method, the "content-type" header, and the request body from the request.
51
- *
52
- * @note Because client data functions are called before a network request is made, the Request object does not include the headers which the browser automatically adds. React Router infers the "content-type" header from the enc-type of the form that performed the submission.
53
- **/
54
- request: Request;
55
- /**
56
- * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
57
- * @example
58
- * // app/routes.ts
59
- * route("teams/:teamId", "./team.tsx"),
60
- *
61
- * // app/team.tsx
62
- * export function clientLoader({
63
- * params,
64
- * }: Route.ClientLoaderArgs) {
65
- * params.teamId;
66
- * // ^ string
67
- * }
68
- **/
69
- params: T["params"];
70
- /**
71
- * When `future.unstable_middleware` is not enabled, this is undefined.
72
- *
73
- * When `future.unstable_middleware` is enabled, this is an instance of
74
- * `unstable_RouterContextProvider` and can be used to access context values
75
- * from your route middlewares. You may pass in initial context values in your
76
- * `<HydratedRouter unstable_getContext>` prop
77
- */
78
- context: unstable_RouterContextProvider;
79
- };
80
- type ServerDataFunctionArgs<T extends RouteInfo> = {
81
- /** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the url, method, headers (such as cookies), and request body from the request. */
82
- request: Request;
83
- /**
84
- * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
85
- * @example
86
- * // app/routes.ts
87
- * route("teams/:teamId", "./team.tsx"),
88
- *
89
- * // app/team.tsx
90
- * export function loader({
91
- * params,
92
- * }: Route.LoaderArgs) {
93
- * params.teamId;
94
- * // ^ string
95
- * }
96
- **/
97
- params: T["params"];
98
- /**
99
- * Without `future.unstable_middleware` enabled, this is the context passed in
100
- * to your server adapter's `getLoadContext` function. It's a way to bridge the
101
- * gap between the adapter's request/response API with your React Router app.
102
- * It is only applicable if you are using a custom server adapter.
103
- *
104
- * With `future.unstable_middleware` enabled, this is an instance of
105
- * `unstable_RouterContextProvider` and can be used for type-safe access to
106
- * context value set in your route middlewares. If you are using a custom
107
- * server adapter, you may provide an initial set of context values from your
108
- * `getLoadContext` function.
109
- */
110
- context: MiddlewareEnabled extends true ? unstable_RouterContextProvider : AppLoadContext;
111
- };
112
- type CreateServerMiddlewareFunction<T extends RouteInfo> = (args: ServerDataFunctionArgs<T>, next: unstable_MiddlewareNextFunction<Response>) => MaybePromise<Response | void>;
113
- type CreateClientMiddlewareFunction<T extends RouteInfo> = (args: ClientDataFunctionArgs<T>, next: unstable_MiddlewareNextFunction<undefined>) => MaybePromise<void>;
114
- type CreateServerLoaderArgs<T extends RouteInfo> = ServerDataFunctionArgs<T>;
115
- type CreateClientLoaderArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
48
+ type CreateServerMiddlewareFunction<T extends RouteInfo> = (args: ServerDataFunctionArgs<T["params"]>, next: unstable_MiddlewareNextFunction<Response>) => MaybePromise<Response | void>;
49
+ type CreateClientMiddlewareFunction<T extends RouteInfo> = (args: ClientDataFunctionArgs<T["params"]>, next: unstable_MiddlewareNextFunction<undefined>) => MaybePromise<void>;
50
+ type CreateServerLoaderArgs<T extends RouteInfo> = ServerDataFunctionArgs<T["params"]>;
51
+ type CreateClientLoaderArgs<T extends RouteInfo> = ClientDataFunctionArgs<T["params"]> & {
116
52
  /** This is an asynchronous function to get the data from the server loader for this route. On client-side navigations, this will make a {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server loader. If you opt-into running your clientLoader on hydration, then this function will return the data that was already loaded on the server (via Promise.resolve). */
117
53
  serverLoader: () => Promise<ServerDataFrom<T["module"]["loader"]>>;
118
54
  };
119
- type CreateServerActionArgs<T extends RouteInfo> = ServerDataFunctionArgs<T>;
120
- type CreateClientActionArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
55
+ type CreateServerActionArgs<T extends RouteInfo> = ServerDataFunctionArgs<T["params"]>;
56
+ type CreateClientActionArgs<T extends RouteInfo> = ClientDataFunctionArgs<T["params"]> & {
121
57
  /** This is an asynchronous function that makes the {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server action for this route. */
122
58
  serverAction: () => Promise<ServerDataFrom<T["module"]["action"]>>;
123
59
  };
@@ -1,4 +1,5 @@
1
- import { aI as LinkDescriptor, aX as RouteModule, g as Location, aG as MetaDescriptor, aY as unstable_MiddlewareNextFunction, aZ as ServerDataFrom, u as unstable_RouterContextProvider, M as MiddlewareEnabled, A as AppLoadContext, a_ as Pretty, a$ as GetLoaderData, b0 as RouteFiles, b1 as Normalize, _ as Pages, b2 as GetActionData } from '../../register-DCE0tH5m.js';
1
+ import { R as RouteModule, L as LinkDescriptor, a as Location, P as Pretty, M as MetaDescriptor, G as GetLoaderData, S as ServerDataFunctionArgs, u as unstable_MiddlewareNextFunction, C as ClientDataFunctionArgs, b as ServerDataFrom, N as Normalize, c as GetActionData } from '../../route-data-x_b_BLCv.js';
2
+ import { R as RouteFiles, P as Pages } from '../../register-DiOIlEq5.js';
2
3
  import 'react';
3
4
 
4
5
  type MaybePromise<T> = T | Promise<T>;
@@ -44,79 +45,15 @@ type HeadersArgs = {
44
45
  actionHeaders: Headers;
45
46
  errorHeaders: Headers | undefined;
46
47
  };
47
- type ClientDataFunctionArgs<T extends RouteInfo> = {
48
- /**
49
- * A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the URL, the method, the "content-type" header, and the request body from the request.
50
- *
51
- * @note Because client data functions are called before a network request is made, the Request object does not include the headers which the browser automatically adds. React Router infers the "content-type" header from the enc-type of the form that performed the submission.
52
- **/
53
- request: Request;
54
- /**
55
- * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
56
- * @example
57
- * // app/routes.ts
58
- * route("teams/:teamId", "./team.tsx"),
59
- *
60
- * // app/team.tsx
61
- * export function clientLoader({
62
- * params,
63
- * }: Route.ClientLoaderArgs) {
64
- * params.teamId;
65
- * // ^ string
66
- * }
67
- **/
68
- params: T["params"];
69
- /**
70
- * When `future.unstable_middleware` is not enabled, this is undefined.
71
- *
72
- * When `future.unstable_middleware` is enabled, this is an instance of
73
- * `unstable_RouterContextProvider` and can be used to access context values
74
- * from your route middlewares. You may pass in initial context values in your
75
- * `<HydratedRouter unstable_getContext>` prop
76
- */
77
- context: unstable_RouterContextProvider;
78
- };
79
- type ServerDataFunctionArgs<T extends RouteInfo> = {
80
- /** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the url, method, headers (such as cookies), and request body from the request. */
81
- request: Request;
82
- /**
83
- * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
84
- * @example
85
- * // app/routes.ts
86
- * route("teams/:teamId", "./team.tsx"),
87
- *
88
- * // app/team.tsx
89
- * export function loader({
90
- * params,
91
- * }: Route.LoaderArgs) {
92
- * params.teamId;
93
- * // ^ string
94
- * }
95
- **/
96
- params: T["params"];
97
- /**
98
- * Without `future.unstable_middleware` enabled, this is the context passed in
99
- * to your server adapter's `getLoadContext` function. It's a way to bridge the
100
- * gap between the adapter's request/response API with your React Router app.
101
- * It is only applicable if you are using a custom server adapter.
102
- *
103
- * With `future.unstable_middleware` enabled, this is an instance of
104
- * `unstable_RouterContextProvider` and can be used for type-safe access to
105
- * context value set in your route middlewares. If you are using a custom
106
- * server adapter, you may provide an initial set of context values from your
107
- * `getLoadContext` function.
108
- */
109
- context: MiddlewareEnabled extends true ? unstable_RouterContextProvider : AppLoadContext;
110
- };
111
- type CreateServerMiddlewareFunction<T extends RouteInfo> = (args: ServerDataFunctionArgs<T>, next: unstable_MiddlewareNextFunction<Response>) => MaybePromise<Response | void>;
112
- type CreateClientMiddlewareFunction<T extends RouteInfo> = (args: ClientDataFunctionArgs<T>, next: unstable_MiddlewareNextFunction<undefined>) => MaybePromise<void>;
113
- type CreateServerLoaderArgs<T extends RouteInfo> = ServerDataFunctionArgs<T>;
114
- type CreateClientLoaderArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
48
+ type CreateServerMiddlewareFunction<T extends RouteInfo> = (args: ServerDataFunctionArgs<T["params"]>, next: unstable_MiddlewareNextFunction<Response>) => MaybePromise<Response | void>;
49
+ type CreateClientMiddlewareFunction<T extends RouteInfo> = (args: ClientDataFunctionArgs<T["params"]>, next: unstable_MiddlewareNextFunction<undefined>) => MaybePromise<void>;
50
+ type CreateServerLoaderArgs<T extends RouteInfo> = ServerDataFunctionArgs<T["params"]>;
51
+ type CreateClientLoaderArgs<T extends RouteInfo> = ClientDataFunctionArgs<T["params"]> & {
115
52
  /** This is an asynchronous function to get the data from the server loader for this route. On client-side navigations, this will make a {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server loader. If you opt-into running your clientLoader on hydration, then this function will return the data that was already loaded on the server (via Promise.resolve). */
116
53
  serverLoader: () => Promise<ServerDataFrom<T["module"]["loader"]>>;
117
54
  };
118
- type CreateServerActionArgs<T extends RouteInfo> = ServerDataFunctionArgs<T>;
119
- type CreateClientActionArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
55
+ type CreateServerActionArgs<T extends RouteInfo> = ServerDataFunctionArgs<T["params"]>;
56
+ type CreateClientActionArgs<T extends RouteInfo> = ClientDataFunctionArgs<T["params"]> & {
120
57
  /** This is an asynchronous function that makes the {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server action for this route. */
121
58
  serverAction: () => Promise<ServerDataFrom<T["module"]["action"]>>;
122
59
  };
@@ -1,5 +1,5 @@
1
- /**
2
- * react-router v0.0.0-experimental-b588f7e
1
+ "use strict";/**
2
+ * react-router v0.0.0-experimental-23decd7bc
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -8,21 +8,3 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- "use strict";
12
- var __defProp = Object.defineProperty;
13
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
14
- var __getOwnPropNames = Object.getOwnPropertyNames;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __copyProps = (to, from, except, desc) => {
17
- if (from && typeof from === "object" || typeof from === "function") {
18
- for (let key of __getOwnPropNames(from))
19
- if (!__hasOwnProp.call(to, key) && key !== except)
20
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
- }
22
- return to;
23
- };
24
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
-
26
- // lib/types/internal.ts
27
- var internal_exports = {};
28
- module.exports = __toCommonJS(internal_exports);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-b588f7e
2
+ * react-router v0.0.0-experimental-23decd7bc
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -21,4 +21,4 @@ type RouteFiles = Register extends {
21
21
  routeFiles: infer Registered extends AnyRouteFiles;
22
22
  } ? Registered : AnyRouteFiles;
23
23
 
24
- export type { Pages as P, Register as R, RouteFiles as a };
24
+ export type { Pages as P, RouteFiles as R, Register as a };
@@ -21,4 +21,4 @@ type RouteFiles = Register extends {
21
21
  routeFiles: infer Registered extends AnyRouteFiles;
22
22
  } ? Registered : AnyRouteFiles;
23
23
 
24
- export type { Pages as P, Register as R, RouteFiles as a };
24
+ export type { Pages as P, RouteFiles as R, Register as a };
@@ -912,8 +912,11 @@ interface Router {
912
912
  * @param routeId The parent route id or a callback function accepting `patch`
913
913
  * to perform batch patching
914
914
  * @param children The additional children routes
915
+ * @param unstable_allowElementMutations Allow mutation or route elements on
916
+ * existing routes. Intended for RSC-usage
917
+ * only.
915
918
  */
916
- patchRoutes(routeId: string | null, children: AgnosticRouteObject[]): void;
919
+ patchRoutes(routeId: string | null, children: AgnosticRouteObject[], unstable_allowElementMutations?: boolean): void;
917
920
  /**
918
921
  * @private
919
922
  * PRIVATE - DO NOT USE
@@ -922,6 +925,13 @@ interface Router {
922
925
  * TODO: Replace this with granular route update APIs (addRoute, updateRoute, deleteRoute)
923
926
  */
924
927
  _internalSetRoutes(routes: AgnosticRouteObject[]): void;
928
+ /**
929
+ * @private
930
+ * PRIVATE - DO NOT USE
931
+ *
932
+ * Cause subscribers to re-render. This is used to force a re-render.
933
+ */
934
+ _internalSetStateDoNotUseOrYouWillBreakYourApp(state: Partial<RouterState>): void;
925
935
  /**
926
936
  * @private
927
937
  * PRIVATE - DO NOT USE
@@ -1045,6 +1055,7 @@ interface StaticHandler {
1045
1055
  skipRevalidation?: boolean;
1046
1056
  dataStrategy?: DataStrategyFunction<unknown>;
1047
1057
  unstable_respond?: (staticContext: StaticHandlerContext) => MaybePromise<Response>;
1058
+ unstable_stream?: (context: unstable_RouterContextProvider, query: (r: Request) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>;
1048
1059
  }): Promise<StaticHandlerContext | Response>;
1049
1060
  queryRoute(request: Request, opts?: {
1050
1061
  routeId?: string;
@@ -1767,7 +1778,73 @@ type ClientData<T> = T extends Response ? never : T extends DataWithResponseInit
1767
1778
  type ServerData<T> = T extends Response ? never : T extends DataWithResponseInit<infer U> ? Serialize<U> : Serialize<T>;
1768
1779
  type ServerDataFrom<T> = ServerData<DataFrom<T>>;
1769
1780
  type ClientDataFrom<T> = ClientData<DataFrom<T>>;
1770
- type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [ClientLoaderFunctionArgs | ClientActionFunctionArgs] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
1781
+ type ClientDataFunctionArgs<Params> = {
1782
+ /**
1783
+ * A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the URL, the method, the "content-type" header, and the request body from the request.
1784
+ *
1785
+ * @note Because client data functions are called before a network request is made, the Request object does not include the headers which the browser automatically adds. React Router infers the "content-type" header from the enc-type of the form that performed the submission.
1786
+ **/
1787
+ request: Request;
1788
+ /**
1789
+ * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
1790
+ * @example
1791
+ * // app/routes.ts
1792
+ * route("teams/:teamId", "./team.tsx"),
1793
+ *
1794
+ * // app/team.tsx
1795
+ * export function clientLoader({
1796
+ * params,
1797
+ * }: Route.ClientLoaderArgs) {
1798
+ * params.teamId;
1799
+ * // ^ string
1800
+ * }
1801
+ **/
1802
+ params: Params;
1803
+ /**
1804
+ * When `future.unstable_middleware` is not enabled, this is undefined.
1805
+ *
1806
+ * When `future.unstable_middleware` is enabled, this is an instance of
1807
+ * `unstable_RouterContextProvider` and can be used to access context values
1808
+ * from your route middlewares. You may pass in initial context values in your
1809
+ * `<HydratedRouter unstable_getContext>` prop
1810
+ */
1811
+ context: unstable_RouterContextProvider;
1812
+ };
1813
+ type ServerDataFunctionArgs<Params> = {
1814
+ /** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the url, method, headers (such as cookies), and request body from the request. */
1815
+ request: Request;
1816
+ /**
1817
+ * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
1818
+ * @example
1819
+ * // app/routes.ts
1820
+ * route("teams/:teamId", "./team.tsx"),
1821
+ *
1822
+ * // app/team.tsx
1823
+ * export function loader({
1824
+ * params,
1825
+ * }: Route.LoaderArgs) {
1826
+ * params.teamId;
1827
+ * // ^ string
1828
+ * }
1829
+ **/
1830
+ params: Params;
1831
+ /**
1832
+ * Without `future.unstable_middleware` enabled, this is the context passed in
1833
+ * to your server adapter's `getLoadContext` function. It's a way to bridge the
1834
+ * gap between the adapter's request/response API with your React Router app.
1835
+ * It is only applicable if you are using a custom server adapter.
1836
+ *
1837
+ * With `future.unstable_middleware` enabled, this is an instance of
1838
+ * `unstable_RouterContextProvider` and can be used for type-safe access to
1839
+ * context value set in your route middlewares. If you are using a custom
1840
+ * server adapter, you may provide an initial set of context values from your
1841
+ * `getLoadContext` function.
1842
+ */
1843
+ context: MiddlewareEnabled extends true ? unstable_RouterContextProvider : AppLoadContext;
1844
+ };
1845
+ type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [
1846
+ ClientLoaderFunctionArgs | ClientActionFunctionArgs | ClientDataFunctionArgs<unknown>
1847
+ ] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
1771
1848
  type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
1772
1849
  type IsHydrate<ClientLoader> = ClientLoader extends {
1773
1850
  hydrate: true;
@@ -1790,4 +1867,4 @@ type _DataActionData<ServerActionData, ClientActionData> = Awaited<[
1790
1867
  IsDefined<ClientActionData>
1791
1868
  ] extends [true, true] ? ServerActionData | ClientActionData : IsDefined<ClientActionData> extends true ? ClientActionData : IsDefined<ServerActionData> extends true ? ServerActionData : undefined>;
1792
1869
 
1793
- export { type Params as $, type ActionFunction as A, type Blocker as B, type CreateStaticHandlerOptions as C, type DataStrategyFunction as D, type Equal as E, type FutureConfig as F, type GetScrollPositionFunction as G, type HydrationState as H, type InitialEntry as I, type DataStrategyMatch as J, type DataStrategyResult as K, type Location as L, type MetaFunction as M, type NonIndexRouteObject as N, DataWithResponseInit as O, type PatchRoutesOnNavigationFunction as P, type ErrorResponse as Q, type RouterInit as R, type StaticHandlerContext as S, type To as T, type FormEncType as U, type FormMethod as V, type HTMLFormMethod as W, type LazyRouteFunction as X, type LoaderFunctionArgs as Y, type unstable_MiddlewareFunction as Z, type ParamParseKey as _, type Router as a, type GetActionData as a$, type PathMatch as a0, type PathParam as a1, type PathPattern as a2, type RedirectFunction as a3, type unstable_RouterContext as a4, type ShouldRevalidateFunction as a5, type ShouldRevalidateFunctionArgs as a6, type UIMatch as a7, unstable_createContext as a8, unstable_RouterContextProvider as a9, type MetaDescriptor as aA, type PageLinkDescriptor as aB, type HtmlLinkDescriptor as aC, type LinkDescriptor as aD, type Future as aE, type unstable_SerializesTo as aF, createBrowserHistory as aG, invariant as aH, createRouter as aI, ErrorResponseImpl as aJ, DataRouterContext as aK, DataRouterStateContext as aL, FetchersContext as aM, LocationContext as aN, NavigationContext as aO, RouteContext as aP, ViewTransitionContext as aQ, type RouteManifest as aR, type ServerRouteModule as aS, type SerializeFrom as aT, type History as aU, type RouteModule as aV, type unstable_MiddlewareNextFunction as aW, type ServerDataFrom as aX, type Pretty as aY, type GetLoaderData as aZ, type Normalize as a_, Action as aa, createPath as ab, parsePath as ac, IDLE_NAVIGATION as ad, IDLE_FETCHER as ae, IDLE_BLOCKER as af, data as ag, generatePath as ah, isRouteErrorResponse as ai, matchPath as aj, matchRoutes as ak, redirect as al, redirectDocument as am, replace as an, resolvePath as ao, type DataRouteMatch as ap, type NavigateOptions as aq, type Navigator as ar, type PatchRoutesOnNavigationFunctionArgs as as, type RouteMatch as at, type ClientActionFunction as au, type ClientActionFunctionArgs as av, type ClientLoaderFunctionArgs as aw, type HeadersArgs as ax, type HeadersFunction as ay, type MetaArgs as az, type RouteModules as b, type RouteObject as c, type StaticHandler as d, type IndexRouteObject as e, type LoaderFunction as f, type LinksFunction as g, type MiddlewareEnabled as h, type AppLoadContext as i, type RouterState as j, type DataRouteObject as k, type ClientLoaderFunction as l, type Path as m, type GetScrollRestorationKeyFunction as n, type Fetcher as o, type Navigation as p, type NavigationStates as q, type RelativeRoutingType as r, type BlockerFunction as s, type RouterSubscriber as t, type unstable_InitialContext as u, type RouterNavigateOptions as v, type RouterFetchOptions as w, type RevalidationState as x, type ActionFunctionArgs as y, type DataStrategyFunctionArgs as z };
1870
+ export { type DataRouteObject as $, Action as A, type BlockerFunction as B, type ClientActionFunction as C, type DataStrategyFunction as D, type unstable_MiddlewareNextFunction as E, type FutureConfig as F, type GetLoaderData as G, type HydrationState as H, type InitialEntry as I, type ClientDataFunctionArgs as J, type ServerDataFrom as K, type Location as L, type MetaFunction as M, type NavigateOptions as N, type Normalize as O, type ParamParseKey as P, type GetActionData as Q, type RouterInit as R, type SerializeFrom as S, type To as T, type UIMatch as U, type RouteModules as V, type unstable_InitialContext as W, type MiddlewareEnabled as X, type AppLoadContext as Y, type Equal as Z, type RouterState as _, type Blocker as a, type ServerRouteModule as a$, type StaticHandler as a0, type GetScrollPositionFunction as a1, type GetScrollRestorationKeyFunction as a2, type StaticHandlerContext as a3, type Fetcher as a4, type NavigationStates as a5, type RouterSubscriber as a6, type RouterNavigateOptions as a7, type RouterFetchOptions as a8, type RevalidationState as a9, matchRoutes as aA, redirect as aB, redirectDocument as aC, replace as aD, resolvePath as aE, type DataRouteMatch as aF, type PatchRoutesOnNavigationFunctionArgs as aG, type ClientActionFunctionArgs as aH, type ClientLoaderFunctionArgs as aI, type HeadersArgs as aJ, type MetaArgs as aK, type PageLinkDescriptor as aL, type HtmlLinkDescriptor as aM, type Future as aN, type unstable_SerializesTo as aO, createBrowserHistory as aP, invariant as aQ, createRouter as aR, ErrorResponseImpl as aS, DataRouterContext as aT, DataRouterStateContext as aU, FetchersContext as aV, LocationContext as aW, NavigationContext as aX, RouteContext as aY, ViewTransitionContext as aZ, type RouteManifest as a_, type ActionFunctionArgs as aa, type DataStrategyFunctionArgs as ab, type DataStrategyMatch as ac, type DataStrategyResult as ad, DataWithResponseInit as ae, type ErrorResponse as af, type FormEncType as ag, type FormMethod as ah, type HTMLFormMethod as ai, type LoaderFunctionArgs as aj, type unstable_MiddlewareFunction as ak, type PathParam as al, type RedirectFunction as am, type unstable_RouterContext as an, type ShouldRevalidateFunctionArgs as ao, unstable_createContext as ap, unstable_RouterContextProvider as aq, createPath as ar, parsePath as as, IDLE_NAVIGATION as at, IDLE_FETCHER as au, IDLE_BLOCKER as av, data as aw, generatePath as ax, isRouteErrorResponse as ay, matchPath as az, type RelativeRoutingType as b, type History as b0, type CreateStaticHandlerOptions as b1, type Path as c, type PathPattern as d, type PathMatch as e, type Navigation as f, type Params as g, type Router as h, type RouteObject as i, type NonIndexRouteObject as j, type LazyRouteFunction as k, type IndexRouteObject as l, type Navigator as m, type PatchRoutesOnNavigationFunction as n, type RouteMatch as o, type ActionFunction as p, type ClientLoaderFunction as q, type HeadersFunction as r, type LinksFunction as s, type LoaderFunction as t, type ShouldRevalidateFunction as u, type RouteModule as v, type LinkDescriptor as w, type Pretty as x, type MetaDescriptor as y, type ServerDataFunctionArgs as z };