react-router 7.6.3 → 7.7.0-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 (64) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/development/browser-BSrXyLft.d.mts +157 -0
  3. package/dist/development/chunk-P37AORTA.js +21 -0
  4. package/dist/development/{chunk-QMGIS6GS.mjs → chunk-PUMRC5B5.mjs} +1473 -3024
  5. package/dist/development/chunk-PY5DBM7W.mjs +2695 -0
  6. package/dist/development/chunk-X5ZUQHCD.js +10021 -0
  7. package/dist/development/components-IaVqGBuO.d.mts +816 -0
  8. package/dist/development/dom-export.d.mts +4 -2
  9. package/dist/development/dom-export.js +57 -76
  10. package/dist/development/dom-export.mjs +11 -8
  11. package/dist/development/index-react-server-client-DOK8MfYF.d.mts +1360 -0
  12. package/dist/development/{lib-B33EY9A0.d.mts → index-react-server-client-LrDNRnlX.d.ts} +39 -5
  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 +1863 -0
  18. package/dist/development/index-react-server.d.ts +1863 -0
  19. package/dist/development/index-react-server.js +3196 -0
  20. package/dist/development/index-react-server.mjs +3083 -0
  21. package/dist/development/index.d.mts +33 -47
  22. package/dist/development/index.d.ts +195 -2190
  23. package/dist/development/index.js +2596 -11444
  24. package/dist/development/index.mjs +33 -18
  25. package/dist/development/lib/types/internal.d.mts +2 -2
  26. package/dist/development/lib/types/internal.d.ts +2 -1
  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-D7Xbr_Ww.d.mts → route-data-7aXBQ4I3.d.ts} +26 -15
  32. package/dist/{production/route-data-D7Xbr_Ww.d.mts → development/route-data-DAw7Esur.d.mts} +16 -5
  33. package/dist/production/browser-BSrXyLft.d.mts +157 -0
  34. package/dist/production/{chunk-S4Z2UWCU.mjs → chunk-5AMJKWMN.mjs} +1473 -3024
  35. package/dist/production/chunk-KWWBKJDT.mjs +2695 -0
  36. package/dist/production/chunk-LKVDO7TU.js +10021 -0
  37. package/dist/production/chunk-P37AORTA.js +21 -0
  38. package/dist/production/components-IaVqGBuO.d.mts +816 -0
  39. package/dist/production/dom-export.d.mts +4 -2
  40. package/dist/production/dom-export.js +57 -76
  41. package/dist/production/dom-export.mjs +11 -8
  42. package/dist/production/index-react-server-client-DOK8MfYF.d.mts +1360 -0
  43. package/dist/production/{lib-B33EY9A0.d.mts → index-react-server-client-LrDNRnlX.d.ts} +39 -5
  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 +1863 -0
  49. package/dist/production/index-react-server.d.ts +1863 -0
  50. package/dist/production/index-react-server.js +3196 -0
  51. package/dist/production/index-react-server.mjs +3083 -0
  52. package/dist/production/index.d.mts +33 -47
  53. package/dist/production/index.d.ts +195 -2190
  54. package/dist/production/index.js +2596 -11444
  55. package/dist/production/index.mjs +33 -18
  56. package/dist/production/lib/types/internal.d.mts +2 -2
  57. package/dist/production/lib/types/internal.d.ts +2 -1
  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/production/{register-COAKzST_.d.ts → route-data-7aXBQ4I3.d.ts} +26 -38
  63. package/dist/{development/register-COAKzST_.d.ts → production/route-data-DAw7Esur.d.mts} +16 -28
  64. package/package.json +56 -11
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.6.3
2
+ * react-router v7.7.0-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -8,6 +8,30 @@
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-KWWBKJDT.mjs";
11
35
  import {
12
36
  Action,
13
37
  Await,
@@ -41,8 +65,6 @@ import {
41
65
  Routes,
42
66
  Scripts,
43
67
  ScrollRestoration,
44
- ServerMode,
45
- ServerRouter,
46
68
  SingleFetchRedirectSymbol,
47
69
  StaticRouter,
48
70
  StaticRouterProvider,
@@ -51,35 +73,23 @@ import {
51
73
  createBrowserRouter,
52
74
  createClientRoutes,
53
75
  createClientRoutesWithHMRRevalidationOptOut,
54
- createCookie,
55
- createCookieSessionStorage,
56
76
  createHashRouter,
57
77
  createMemoryRouter,
58
- createMemorySessionStorage,
59
78
  createPath,
60
- createRequestHandler,
61
79
  createRouter,
62
80
  createRoutesFromChildren,
63
81
  createRoutesFromElements,
64
- createRoutesStub,
65
82
  createSearchParams,
66
- createSession,
67
- createSessionStorage,
68
- createStaticHandler,
83
+ createStaticHandler2 as createStaticHandler,
69
84
  createStaticRouter,
70
85
  data,
71
86
  decodeViaTurboStream,
72
- deserializeErrors,
73
87
  generatePath,
74
- getHydrationData,
75
88
  getPatchRoutesOnNavigationFunction,
76
89
  getTurboStreamSingleFetchDataStrategy,
77
- href,
78
90
  hydrationRouteProperties,
79
91
  invariant,
80
- isCookie,
81
92
  isRouteErrorResponse,
82
- isSession,
83
93
  mapRouteProperties,
84
94
  matchPath,
85
95
  matchRoutes,
@@ -89,7 +99,6 @@ import {
89
99
  renderMatches,
90
100
  replace,
91
101
  resolvePath,
92
- setDevServerHooks,
93
102
  shouldHydrateRouteLoader,
94
103
  unstable_RouterContextProvider,
95
104
  unstable_createContext,
@@ -128,7 +137,7 @@ import {
128
137
  withComponentProps,
129
138
  withErrorBoundaryProps,
130
139
  withHydrateFallbackProps
131
- } from "./chunk-S4Z2UWCU.mjs";
140
+ } from "./chunk-5AMJKWMN.mjs";
132
141
  export {
133
142
  Await,
134
143
  BrowserRouter,
@@ -162,6 +171,7 @@ export {
162
171
  FrameworkContext as UNSAFE_FrameworkContext,
163
172
  LocationContext as UNSAFE_LocationContext,
164
173
  NavigationContext as UNSAFE_NavigationContext,
174
+ RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary,
165
175
  RemixErrorBoundary as UNSAFE_RemixErrorBoundary,
166
176
  RouteContext as UNSAFE_RouteContext,
167
177
  ServerMode as UNSAFE_ServerMode,
@@ -216,8 +226,13 @@ export {
216
226
  replace,
217
227
  resolvePath,
218
228
  HistoryRouter as unstable_HistoryRouter,
229
+ RSCHydratedRouter as unstable_RSCHydratedRouter,
230
+ RSCStaticRouter as unstable_RSCStaticRouter,
219
231
  unstable_RouterContextProvider,
232
+ createCallServer as unstable_createCallServer,
220
233
  unstable_createContext,
234
+ getRSCStream as unstable_getRSCStream,
235
+ routeRSCServerRequest as unstable_routeRSCServerRequest,
221
236
  setDevServerHooks as unstable_setDevServerHooks,
222
237
  usePrompt as unstable_usePrompt,
223
238
  useActionData,
@@ -1,5 +1,5 @@
1
- import { aV as RouteModule, aD as LinkDescriptor, L as Location, aW as Pretty, aA as MetaDescriptor, aX as GetLoaderData, aY as ServerDataFunctionArgs, aZ as unstable_MiddlewareNextFunction, a_ as ClientDataFunctionArgs, a$ as ServerDataFrom, b0 as Normalize, b1 as GetActionData } from '../../route-data-D7Xbr_Ww.mjs';
2
- import { a as RouteFiles, P as Pages } from '../../register-DeIo2iHO.mjs';
1
+ import { w as RouteModule, x as LinkDescriptor, L as Location, y as Pretty, z as MetaDescriptor, G as GetLoaderData, E as ServerDataFunctionArgs, J as unstable_MiddlewareNextFunction, K as ClientDataFunctionArgs, O as ServerDataFrom, Q as Normalize, V as GetActionData } from '../../route-data-DAw7Esur.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>;
@@ -1,4 +1,5 @@
1
- import { aX as RouteModule, aI as LinkDescriptor, i as Location, aY as Pretty, aG as MetaDescriptor, aZ as GetLoaderData, a_ as ServerDataFunctionArgs, a$ as unstable_MiddlewareNextFunction, b0 as ClientDataFunctionArgs, b1 as ServerDataFrom, b2 as RouteFiles, b3 as Normalize, _ as Pages, b4 as GetActionData } from '../../register-COAKzST_.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-7aXBQ4I3.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>;
@@ -1,5 +1,5 @@
1
- /**
2
- * react-router v7.6.3
1
+ "use strict";/**
2
+ * react-router v7.7.0-pre.0
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 v7.6.3
2
+ * react-router v7.7.0-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
3
+ * React Router should handle this for you via type generation.
4
+ *
5
+ * For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation .
6
+ */
7
+ interface Register {
8
+ }
9
+ type AnyParams = Record<string, string | undefined>;
10
+ type AnyPages = Record<string, {
11
+ params: AnyParams;
12
+ }>;
13
+ type Pages = Register extends {
14
+ pages: infer Registered extends AnyPages;
15
+ } ? Registered : AnyPages;
16
+ type AnyRouteFiles = Record<string, {
17
+ id: string;
18
+ page: string;
19
+ }>;
20
+ type RouteFiles = Register extends {
21
+ routeFiles: infer Registered extends AnyRouteFiles;
22
+ } ? Registered : AnyRouteFiles;
23
+
24
+ export type { Pages as P, RouteFiles as R, Register as a };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
3
+ * React Router should handle this for you via type generation.
4
+ *
5
+ * For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation .
6
+ */
7
+ interface Register {
8
+ }
9
+ type AnyParams = Record<string, string | undefined>;
10
+ type AnyPages = Record<string, {
11
+ params: AnyParams;
12
+ }>;
13
+ type Pages = Register extends {
14
+ pages: infer Registered extends AnyPages;
15
+ } ? Registered : AnyPages;
16
+ type AnyRouteFiles = Record<string, {
17
+ id: string;
18
+ page: string;
19
+ }>;
20
+ type RouteFiles = Register extends {
21
+ routeFiles: infer Registered extends AnyRouteFiles;
22
+ } ? Registered : AnyRouteFiles;
23
+
24
+ export type { Pages as P, RouteFiles as R, Register as a };
@@ -1,6 +1,16 @@
1
1
  import * as React from 'react';
2
2
  import { ComponentType, ReactElement } from 'react';
3
3
 
4
+ /**
5
+ * An augmentable interface users can modify in their app-code to opt into
6
+ * future-flag-specific types
7
+ */
8
+ interface Future {
9
+ }
10
+ type MiddlewareEnabled = Future extends {
11
+ unstable_middleware: infer T extends boolean;
12
+ } ? T : false;
13
+
4
14
  /**
5
15
  * Actions represent the type of change to a location value.
6
16
  */
@@ -206,16 +216,6 @@ type UrlHistoryOptions = {
206
216
  v5Compat?: boolean;
207
217
  };
208
218
 
209
- /**
210
- * An augmentable interface users can modify in their app-code to opt into
211
- * future-flag-specific types
212
- */
213
- interface Future {
214
- }
215
- type MiddlewareEnabled = Future extends {
216
- unstable_middleware: infer T extends boolean;
217
- } ? T : false;
218
-
219
219
  type MaybePromise<T> = T | Promise<T>;
220
220
  /**
221
221
  * Map of routeId -> data returned from a loader/action/error
@@ -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
@@ -954,7 +964,7 @@ interface RouterState {
954
964
  /**
955
965
  * Current scroll position we should start at for a new view
956
966
  * - number -> scroll position to restore to
957
- * - false -> do not restore scroll at all (used during submissions)
967
+ * - false -> do not restore scroll at all (used during submissions/revalidations)
958
968
  * - null -> don't have a saved position, scroll to hash or top of page
959
969
  */
960
970
  restoreScrollPosition: number | false | null;
@@ -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;
@@ -1245,8 +1256,8 @@ type FetcherStates<TData = any> = {
1245
1256
  type Fetcher<TData = any> = FetcherStates<TData>[keyof FetcherStates<TData>];
1246
1257
  interface BlockerBlocked {
1247
1258
  state: "blocked";
1248
- reset(): void;
1249
- proceed(): void;
1259
+ reset: () => void;
1260
+ proceed: () => void;
1250
1261
  location: Location;
1251
1262
  }
1252
1263
  interface BlockerUnblocked {
@@ -1856,27 +1867,4 @@ type _DataActionData<ServerActionData, ClientActionData> = Awaited<[
1856
1867
  IsDefined<ClientActionData>
1857
1868
  ] extends [true, true] ? ServerActionData | ClientActionData : IsDefined<ClientActionData> extends true ? ClientActionData : IsDefined<ServerActionData> extends true ? ServerActionData : undefined>;
1858
1869
 
1859
- /**
1860
- * Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
1861
- * React Router should handle this for you via type generation.
1862
- *
1863
- * For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation .
1864
- */
1865
- interface Register {
1866
- }
1867
- type AnyParams = Record<string, string | undefined>;
1868
- type AnyPages = Record<string, {
1869
- params: AnyParams;
1870
- }>;
1871
- type Pages = Register extends {
1872
- pages: infer Registered extends AnyPages;
1873
- } ? Registered : AnyPages;
1874
- type AnyRouteFiles = Record<string, {
1875
- id: string;
1876
- page: string;
1877
- }>;
1878
- type RouteFiles = Register extends {
1879
- routeFiles: infer Registered extends AnyRouteFiles;
1880
- } ? Registered : AnyRouteFiles;
1881
-
1882
- export { type Equal as $, type AppLoadContext as A, type BlockerFunction as B, type ClientLoaderFunction as C, type DataRouteObject as D, type PageLinkDescriptor as E, type FutureConfig as F, type History as G, type HydrationState as H, type IndexRouteObject as I, type GetScrollRestorationKeyFunction as J, type Fetcher as K, type LoaderFunctionArgs as L, type MiddlewareEnabled as M, type NavigateOptions as N, type CreateStaticHandlerOptions as O, type ParamParseKey as P, type StaticHandler as Q, type RouteManifest as R, type ServerRouteModule as S, type To as T, type UIMatch as U, type LoaderFunction as V, type ActionFunction as W, type MetaFunction as X, type LinksFunction as Y, type unstable_InitialContext as Z, type Pages as _, type ActionFunctionArgs as a, type unstable_MiddlewareNextFunction as a$, type RouterState as a0, type GetScrollPositionFunction as a1, type NavigationStates as a2, type RouterSubscriber as a3, type RouterNavigateOptions as a4, type RouterFetchOptions as a5, type RevalidationState as a6, type DataStrategyFunctionArgs as a7, type DataStrategyMatch as a8, type DataStrategyResult as a9, type ClientActionFunction as aA, type ClientActionFunctionArgs as aB, type ClientLoaderFunctionArgs as aC, type HeadersArgs as aD, type HeadersFunction as aE, type MetaArgs as aF, type MetaDescriptor as aG, type HtmlLinkDescriptor as aH, type LinkDescriptor as aI, type Future as aJ, type unstable_SerializesTo as aK, type Register as aL, createBrowserHistory as aM, invariant as aN, createRouter as aO, ErrorResponseImpl as aP, DataRouterContext as aQ, DataRouterStateContext as aR, FetchersContext as aS, LocationContext as aT, NavigationContext as aU, RouteContext as aV, ViewTransitionContext as aW, type RouteModule as aX, type Pretty as aY, type GetLoaderData as aZ, type ServerDataFunctionArgs as a_, DataWithResponseInit as aa, type ErrorResponse as ab, type FormMethod as ac, type unstable_MiddlewareFunction as ad, type PathParam as ae, type RedirectFunction as af, type unstable_RouterContext as ag, type ShouldRevalidateFunction as ah, type ShouldRevalidateFunctionArgs as ai, unstable_createContext as aj, createPath as ak, parsePath as al, IDLE_NAVIGATION as am, IDLE_FETCHER as an, IDLE_BLOCKER as ao, data as ap, generatePath as aq, isRouteErrorResponse as ar, matchPath as as, matchRoutes as at, redirect as au, redirectDocument as av, replace as aw, resolvePath as ax, type DataRouteMatch as ay, type PatchRoutesOnNavigationFunctionArgs as az, type RouteModules as b, type ClientDataFunctionArgs as b0, type ServerDataFrom as b1, type RouteFiles as b2, type Normalize as b3, type GetActionData as b4, type StaticHandlerContext as c, type Router as d, type DataStrategyFunction as e, type Blocker as f, type SerializeFrom as g, type RelativeRoutingType as h, type Location as i, type Path as j, type PathPattern as k, type PathMatch as l, type Navigation as m, Action as n, type Params as o, type RouteObject as p, type LazyRouteFunction as q, type NonIndexRouteObject as r, type RouterInit as s, type InitialEntry as t, unstable_RouterContextProvider as u, type PatchRoutesOnNavigationFunction as v, type Navigator as w, type RouteMatch as x, type HTMLFormMethod as y, type FormEncType as z };
1870
+ export { type ActionFunctionArgs as $, type ActionFunction as A, type GetScrollPositionFunction as B, type ClientDataFunctionArgs as C, type DataStrategyFunction as D, type Equal as E, type GetScrollRestorationKeyFunction as F, type GetLoaderData as G, type HydrationState as H, type InitialEntry as I, type StaticHandlerContext as J, type Fetcher as K, type LinkDescriptor as L, type MetaDescriptor as M, type Normalize as N, type Navigation as O, type Pretty as P, type NavigationStates as Q, type RouteModule as R, type ServerDataFunctionArgs as S, type To as T, type RelativeRoutingType as U, type Blocker as V, type BlockerFunction as W, type RouterSubscriber as X, type RouterNavigateOptions as Y, type RouterFetchOptions as Z, type RevalidationState as _, type Location as a, type FutureConfig as a$, type DataStrategyFunctionArgs as a0, type DataStrategyMatch as a1, type DataStrategyResult as a2, DataWithResponseInit as a3, type ErrorResponse as a4, type FormEncType as a5, type FormMethod as a6, type HTMLFormMethod as a7, type LazyRouteFunction as a8, type LoaderFunctionArgs as a9, type NavigateOptions as aA, type Navigator as aB, type PatchRoutesOnNavigationFunctionArgs as aC, type RouteMatch as aD, type RouteObject as aE, type ClientActionFunctionArgs as aF, type ClientLoaderFunctionArgs as aG, type HeadersArgs as aH, type MetaArgs as aI, type PageLinkDescriptor as aJ, type HtmlLinkDescriptor as aK, type Future as aL, type unstable_SerializesTo as aM, createBrowserHistory as aN, invariant as aO, createRouter as aP, ErrorResponseImpl as aQ, DataRouterContext as aR, DataRouterStateContext as aS, FetchersContext as aT, LocationContext as aU, NavigationContext as aV, RouteContext as aW, ViewTransitionContext as aX, type RouteManifest as aY, type ServerRouteModule as aZ, type SerializeFrom as a_, type unstable_MiddlewareFunction as aa, type ParamParseKey as ab, type PathMatch as ac, type PathParam as ad, type PathPattern as ae, type RedirectFunction as af, type unstable_RouterContext as ag, type ShouldRevalidateFunctionArgs as ah, type UIMatch as ai, unstable_createContext as aj, Action as ak, createPath as al, parsePath as am, IDLE_NAVIGATION as an, IDLE_FETCHER as ao, IDLE_BLOCKER as ap, data as aq, generatePath as ar, isRouteErrorResponse as as, matchPath as at, matchRoutes as au, redirect as av, redirectDocument as aw, replace as ax, resolvePath as ay, type DataRouteMatch as az, type ServerDataFrom as b, type History as b0, type CreateStaticHandlerOptions as b1, type GetActionData as c, type Router as d, type RouteModules as e, type IndexRouteObject as f, type LoaderFunction as g, type MetaFunction as h, type LinksFunction as i, type NonIndexRouteObject as j, type AppLoadContext as k, unstable_RouterContextProvider as l, type MiddlewareEnabled as m, type unstable_InitialContext as n, type ClientActionFunction as o, type ClientLoaderFunction as p, type HeadersFunction as q, type ShouldRevalidateFunction as r, type Params as s, type RouterInit as t, type unstable_MiddlewareNextFunction as u, type RouterState as v, type PatchRoutesOnNavigationFunction as w, type DataRouteObject as x, type Path as y, type StaticHandler as z };
@@ -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
@@ -954,7 +964,7 @@ interface RouterState {
954
964
  /**
955
965
  * Current scroll position we should start at for a new view
956
966
  * - number -> scroll position to restore to
957
- * - false -> do not restore scroll at all (used during submissions)
967
+ * - false -> do not restore scroll at all (used during submissions/revalidations)
958
968
  * - null -> don't have a saved position, scroll to hash or top of page
959
969
  */
960
970
  restoreScrollPosition: number | false | null;
@@ -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;
@@ -1245,8 +1256,8 @@ type FetcherStates<TData = any> = {
1245
1256
  type Fetcher<TData = any> = FetcherStates<TData>[keyof FetcherStates<TData>];
1246
1257
  interface BlockerBlocked {
1247
1258
  state: "blocked";
1248
- reset(): void;
1249
- proceed(): void;
1259
+ reset: () => void;
1260
+ proceed: () => void;
1250
1261
  location: Location;
1251
1262
  }
1252
1263
  interface BlockerUnblocked {
@@ -1856,27 +1867,4 @@ type _DataActionData<ServerActionData, ClientActionData> = Awaited<[
1856
1867
  IsDefined<ClientActionData>
1857
1868
  ] extends [true, true] ? ServerActionData | ClientActionData : IsDefined<ClientActionData> extends true ? ClientActionData : IsDefined<ServerActionData> extends true ? ServerActionData : undefined>;
1858
1869
 
1859
- /**
1860
- * Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
1861
- * React Router should handle this for you via type generation.
1862
- *
1863
- * For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation .
1864
- */
1865
- interface Register {
1866
- }
1867
- type AnyParams = Record<string, string | undefined>;
1868
- type AnyPages = Record<string, {
1869
- params: AnyParams;
1870
- }>;
1871
- type Pages = Register extends {
1872
- pages: infer Registered extends AnyPages;
1873
- } ? Registered : AnyPages;
1874
- type AnyRouteFiles = Record<string, {
1875
- id: string;
1876
- page: string;
1877
- }>;
1878
- type RouteFiles = Register extends {
1879
- routeFiles: infer Registered extends AnyRouteFiles;
1880
- } ? Registered : AnyRouteFiles;
1881
-
1882
- export { type Equal as $, type AppLoadContext as A, type BlockerFunction as B, type ClientLoaderFunction as C, type DataRouteObject as D, type PageLinkDescriptor as E, type FutureConfig as F, type History as G, type HydrationState as H, type IndexRouteObject as I, type GetScrollRestorationKeyFunction as J, type Fetcher as K, type LoaderFunctionArgs as L, type MiddlewareEnabled as M, type NavigateOptions as N, type CreateStaticHandlerOptions as O, type ParamParseKey as P, type StaticHandler as Q, type RouteManifest as R, type ServerRouteModule as S, type To as T, type UIMatch as U, type LoaderFunction as V, type ActionFunction as W, type MetaFunction as X, type LinksFunction as Y, type unstable_InitialContext as Z, type Pages as _, type ActionFunctionArgs as a, type unstable_MiddlewareNextFunction as a$, type RouterState as a0, type GetScrollPositionFunction as a1, type NavigationStates as a2, type RouterSubscriber as a3, type RouterNavigateOptions as a4, type RouterFetchOptions as a5, type RevalidationState as a6, type DataStrategyFunctionArgs as a7, type DataStrategyMatch as a8, type DataStrategyResult as a9, type ClientActionFunction as aA, type ClientActionFunctionArgs as aB, type ClientLoaderFunctionArgs as aC, type HeadersArgs as aD, type HeadersFunction as aE, type MetaArgs as aF, type MetaDescriptor as aG, type HtmlLinkDescriptor as aH, type LinkDescriptor as aI, type Future as aJ, type unstable_SerializesTo as aK, type Register as aL, createBrowserHistory as aM, invariant as aN, createRouter as aO, ErrorResponseImpl as aP, DataRouterContext as aQ, DataRouterStateContext as aR, FetchersContext as aS, LocationContext as aT, NavigationContext as aU, RouteContext as aV, ViewTransitionContext as aW, type RouteModule as aX, type Pretty as aY, type GetLoaderData as aZ, type ServerDataFunctionArgs as a_, DataWithResponseInit as aa, type ErrorResponse as ab, type FormMethod as ac, type unstable_MiddlewareFunction as ad, type PathParam as ae, type RedirectFunction as af, type unstable_RouterContext as ag, type ShouldRevalidateFunction as ah, type ShouldRevalidateFunctionArgs as ai, unstable_createContext as aj, createPath as ak, parsePath as al, IDLE_NAVIGATION as am, IDLE_FETCHER as an, IDLE_BLOCKER as ao, data as ap, generatePath as aq, isRouteErrorResponse as ar, matchPath as as, matchRoutes as at, redirect as au, redirectDocument as av, replace as aw, resolvePath as ax, type DataRouteMatch as ay, type PatchRoutesOnNavigationFunctionArgs as az, type RouteModules as b, type ClientDataFunctionArgs as b0, type ServerDataFrom as b1, type RouteFiles as b2, type Normalize as b3, type GetActionData as b4, type StaticHandlerContext as c, type Router as d, type DataStrategyFunction as e, type Blocker as f, type SerializeFrom as g, type RelativeRoutingType as h, type Location as i, type Path as j, type PathPattern as k, type PathMatch as l, type Navigation as m, Action as n, type Params as o, type RouteObject as p, type LazyRouteFunction as q, type NonIndexRouteObject as r, type RouterInit as s, type InitialEntry as t, unstable_RouterContextProvider as u, type PatchRoutesOnNavigationFunction as v, type Navigator as w, type RouteMatch as x, type HTMLFormMethod as y, type FormEncType as z };
1870
+ export { type RouterState as $, Action as A, type BlockerFunction as B, type ClientActionFunction as C, type DataStrategyFunction as D, type ServerDataFunctionArgs as E, type FutureConfig as F, type GetLoaderData as G, type HydrationState as H, type InitialEntry as I, type unstable_MiddlewareNextFunction as J, type ClientDataFunctionArgs as K, type Location as L, type MetaFunction as M, type NavigateOptions as N, type ServerDataFrom as O, type ParamParseKey as P, type Normalize as Q, type RouterInit as R, type SerializeFrom as S, type To as T, type UIMatch as U, type GetActionData as V, type RouteModules as W, type AppLoadContext as X, type MiddlewareEnabled as Y, type unstable_InitialContext as Z, type Equal as _, type Blocker as a, type ServerRouteModule as a$, type DataRouteObject as a0, type StaticHandler as a1, type GetScrollPositionFunction as a2, type GetScrollRestorationKeyFunction as a3, type StaticHandlerContext as a4, type Fetcher as a5, type NavigationStates as a6, type RouterSubscriber as a7, type RouterNavigateOptions as a8, type RouterFetchOptions 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 RevalidationState as aa, type ActionFunctionArgs as ab, type DataStrategyFunctionArgs as ac, type DataStrategyMatch as ad, type DataStrategyResult as ae, DataWithResponseInit as af, type ErrorResponse as ag, type FormEncType as ah, type FormMethod as ai, type HTMLFormMethod as aj, type LoaderFunctionArgs as ak, type unstable_MiddlewareFunction as al, type PathParam as am, type RedirectFunction as an, type unstable_RouterContext as ao, type ShouldRevalidateFunctionArgs as ap, unstable_createContext 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, unstable_RouterContextProvider as u, type ShouldRevalidateFunction as v, type RouteModule as w, type LinkDescriptor as x, type Pretty as y, type MetaDescriptor as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-router",
3
- "version": "7.6.3",
3
+ "version": "7.7.0-pre.0",
4
4
  "description": "Declarative routing for React",
5
5
  "keywords": [
6
6
  "react",
@@ -23,11 +23,20 @@
23
23
  "module": "./dist/development/index.mjs",
24
24
  "exports": {
25
25
  ".": {
26
+ "react-server": {
27
+ "module": "./dist/development/index-react-server.mjs",
28
+ "default": "./dist/development/index-react-server.js"
29
+ },
26
30
  "node": {
27
31
  "types": "./dist/development/index.d.ts",
32
+ "module": "./dist/development/index.mjs",
28
33
  "module-sync": "./dist/development/index.mjs",
29
34
  "default": "./dist/development/index.js"
30
35
  },
36
+ "module": {
37
+ "types": "./dist/development/index.d.mts",
38
+ "default": "./dist/development/index.mjs"
39
+ },
31
40
  "import": {
32
41
  "types": "./dist/development/index.d.mts",
33
42
  "default": "./dist/development/index.mjs"
@@ -37,6 +46,26 @@
37
46
  "default": "./dist/development/index.js"
38
47
  }
39
48
  },
49
+ "./dom": {
50
+ "node": {
51
+ "types": "./dist/development/dom-export.d.ts",
52
+ "module": "./dist/development/dom-export.mjs",
53
+ "module-sync": "./dist/development/dom-export.mjs",
54
+ "default": "./dist/development/dom-export.js"
55
+ },
56
+ "module": {
57
+ "types": "./dist/development/dom-export.d.mts",
58
+ "default": "./dist/development/dom-export.mjs"
59
+ },
60
+ "import": {
61
+ "types": "./dist/development/dom-export.d.mts",
62
+ "default": "./dist/development/dom-export.mjs"
63
+ },
64
+ "default": {
65
+ "types": "./dist/development/dom-export.d.ts",
66
+ "default": "./dist/development/dom-export.js"
67
+ }
68
+ },
40
69
  "./internal": {
41
70
  "node": {
42
71
  "types": "./dist/development/lib/types/internal.d.ts"
@@ -48,26 +77,35 @@
48
77
  "types": "./dist/development/lib/types/index.d.ts"
49
78
  }
50
79
  },
51
- "./dom": {
80
+ "./internal/react-server-client": {
81
+ "react-server": {
82
+ "module": "./dist/development/index-react-server-client.mjs",
83
+ "default": "./dist/development/index-react-server-client.js"
84
+ },
52
85
  "node": {
53
- "types": "./dist/development/dom-export.d.ts",
54
- "module-sync": "./dist/development/dom-export.mjs",
55
- "default": "./dist/development/dom-export.js"
86
+ "types": "./dist/development/index.d.ts",
87
+ "module": "./dist/development/index.mjs",
88
+ "module-sync": "./dist/development/index.mjs",
89
+ "default": "./dist/development/index.js"
90
+ },
91
+ "module": {
92
+ "types": "./dist/development/index.d.mts",
93
+ "default": "./dist/development/index.mjs"
56
94
  },
57
95
  "import": {
58
- "types": "./dist/development/dom-export.d.mts",
59
- "default": "./dist/development/dom-export.mjs"
96
+ "types": "./dist/development/index.d.mts",
97
+ "default": "./dist/development/index.mjs"
60
98
  },
61
99
  "default": {
62
- "types": "./dist/development/dom-export.d.ts",
63
- "default": "./dist/development/dom-export.js"
100
+ "types": "./dist/development/index.d.ts",
101
+ "default": "./dist/development/index.js"
64
102
  }
65
103
  },
66
104
  "./package.json": "./package.json"
67
105
  },
68
106
  "wireit": {
69
107
  "build": {
70
- "command": "rimraf dist && tsup",
108
+ "command": "premove dist && tsup && tsup --config tsup.config.rsc.ts",
71
109
  "files": [
72
110
  "lib/**",
73
111
  "*.ts",
@@ -84,12 +122,18 @@
84
122
  "set-cookie-parser": "^2.6.0"
85
123
  },
86
124
  "devDependencies": {
125
+ "@testing-library/jest-dom": "^6.6.3",
126
+ "@testing-library/react": "^16.3.0",
127
+ "@testing-library/user-event": "^14.6.1",
87
128
  "@types/set-cookie-parser": "^2.4.1",
129
+ "jest-environment-jsdom": "^29.6.2",
130
+ "premove": "^4.0.0",
88
131
  "react": "^19.1.0",
89
132
  "react-dom": "^19.1.0",
90
- "rimraf": "^6.0.1",
133
+ "react-test-renderer": "^19.1.0",
91
134
  "tsup": "^8.3.0",
92
135
  "typescript": "^5.1.6",
136
+ "undici": "^6.19.2",
93
137
  "wireit": "0.14.9"
94
138
  },
95
139
  "peerDependencies": {
@@ -112,6 +156,7 @@
112
156
  },
113
157
  "scripts": {
114
158
  "build": "wireit",
159
+ "watch": "tsup --watch & tsup --config tsup.config.rsc.ts --watch",
115
160
  "typecheck": "tsc"
116
161
  }
117
162
  }