react-router 7.17.0 → 7.18.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 (77) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/dist/development/{browser-D3uq9sI1.d.ts → browser-B2PdsXXH.d.ts} +2 -2
  3. package/dist/development/{browser-CGcs-0pD.d.mts → browser-DBmQ1yAR.d.mts} +2 -2
  4. package/dist/development/{chunk-6CSD65Y2.mjs → chunk-4ZMWKKQ3.mjs} +115 -38
  5. package/dist/{production/chunk-5TQZEVD5.mjs → development/chunk-E4MTK73K.mjs} +45 -113
  6. package/dist/development/{chunk-KFNXW4AL.js → chunk-U7ORXROY.js} +113 -35
  7. package/dist/development/{chunk-PBLBZ3QU.js → chunk-WW7PN6QI.js} +7 -7
  8. package/dist/development/{chunk-PULC7NLK.js → chunk-YL5M26XI.js} +111 -108
  9. package/dist/{production/context-CmHpk1Ws.d.mts → development/context-CeD5LmaF.d.mts} +12 -4
  10. package/dist/{production/data-D4xhSy90.d.ts → development/data-CjO11-hU.d.ts} +9 -1
  11. package/dist/development/{data-U8FS-wNn.d.mts → data-DEjBmEfD.d.mts} +9 -1
  12. package/dist/development/dom-export.d.mts +3 -3
  13. package/dist/development/dom-export.d.ts +3 -3
  14. package/dist/development/dom-export.js +46 -44
  15. package/dist/development/dom-export.mjs +23 -21
  16. package/dist/development/{index-react-server-client-CwU9bE5R.d.ts → index-react-server-client-3ykjivgQ.d.ts} +29 -7
  17. package/dist/development/{index-react-server-client-DPrDrCew.d.mts → index-react-server-client-CACgcj2J.d.mts} +19 -5
  18. package/dist/development/index-react-server-client.d.mts +3 -3
  19. package/dist/development/index-react-server-client.d.ts +3 -3
  20. package/dist/development/index-react-server-client.js +4 -4
  21. package/dist/development/index-react-server-client.mjs +2 -2
  22. package/dist/development/index-react-server.d.mts +9 -1
  23. package/dist/development/index-react-server.d.ts +9 -1
  24. package/dist/development/index-react-server.js +144 -121
  25. package/dist/development/index-react-server.mjs +143 -120
  26. package/dist/development/index.d.mts +15 -14
  27. package/dist/development/index.d.ts +15 -14
  28. package/dist/development/index.js +137 -205
  29. package/dist/development/index.mjs +3 -5
  30. package/dist/{production/instrumentation-1q4YhLGP.d.ts → development/instrumentation-Dkmpzd13.d.ts} +2 -2
  31. package/dist/development/lib/types/internal.d.mts +2 -2
  32. package/dist/development/lib/types/internal.d.ts +2 -2
  33. package/dist/development/lib/types/internal.js +1 -1
  34. package/dist/development/lib/types/internal.mjs +1 -1
  35. package/dist/development/{register-CqK96Zfk.d.mts → register-CmkRspdl.d.mts} +1 -1
  36. package/dist/development/{register-CNAx3TXj.d.ts → register-roq_0qYo.d.ts} +1 -1
  37. package/dist/production/{browser-D3uq9sI1.d.ts → browser-B2PdsXXH.d.ts} +2 -2
  38. package/dist/production/{browser-CGcs-0pD.d.mts → browser-DBmQ1yAR.d.mts} +2 -2
  39. package/dist/production/{chunk-CTIXC7EV.js → chunk-3Z6WS2WZ.js} +7 -7
  40. package/dist/production/{chunk-EN242BO4.js → chunk-BIP66BKV.js} +111 -108
  41. package/dist/{development/chunk-ASILSGTR.mjs → production/chunk-EGOTSXNH.mjs} +45 -113
  42. package/dist/production/{chunk-RTRY3JFT.js → chunk-IUPBOWYO.js} +113 -35
  43. package/dist/production/{chunk-OSYEOCBT.mjs → chunk-M7NGGUU6.mjs} +115 -38
  44. package/dist/{development/context-CmHpk1Ws.d.mts → production/context-CeD5LmaF.d.mts} +12 -4
  45. package/dist/{development/data-D4xhSy90.d.ts → production/data-CjO11-hU.d.ts} +9 -1
  46. package/dist/production/{data-U8FS-wNn.d.mts → data-DEjBmEfD.d.mts} +9 -1
  47. package/dist/production/dom-export.d.mts +3 -3
  48. package/dist/production/dom-export.d.ts +3 -3
  49. package/dist/production/dom-export.js +46 -44
  50. package/dist/production/dom-export.mjs +23 -21
  51. package/dist/production/{index-react-server-client-CwU9bE5R.d.ts → index-react-server-client-3ykjivgQ.d.ts} +29 -7
  52. package/dist/production/{index-react-server-client-DPrDrCew.d.mts → index-react-server-client-CACgcj2J.d.mts} +19 -5
  53. package/dist/production/index-react-server-client.d.mts +3 -3
  54. package/dist/production/index-react-server-client.d.ts +3 -3
  55. package/dist/production/index-react-server-client.js +4 -4
  56. package/dist/production/index-react-server-client.mjs +2 -2
  57. package/dist/production/index-react-server.d.mts +9 -1
  58. package/dist/production/index-react-server.d.ts +9 -1
  59. package/dist/production/index-react-server.js +144 -121
  60. package/dist/production/index-react-server.mjs +143 -120
  61. package/dist/production/index.d.mts +15 -14
  62. package/dist/production/index.d.ts +15 -14
  63. package/dist/production/index.js +137 -205
  64. package/dist/production/index.mjs +3 -5
  65. package/dist/{development/instrumentation-1q4YhLGP.d.ts → production/instrumentation-Dkmpzd13.d.ts} +2 -2
  66. package/dist/production/lib/types/internal.d.mts +2 -2
  67. package/dist/production/lib/types/internal.d.ts +2 -2
  68. package/dist/production/lib/types/internal.js +1 -1
  69. package/dist/production/lib/types/internal.mjs +1 -1
  70. package/dist/production/{register-CqK96Zfk.d.mts → register-CmkRspdl.d.mts} +1 -1
  71. package/dist/production/{register-CNAx3TXj.d.ts → register-roq_0qYo.d.ts} +1 -1
  72. package/docs/explanation/type-safety.md +1 -1
  73. package/docs/how-to/headers.md +2 -1
  74. package/docs/how-to/security.md +8 -6
  75. package/docs/start/data/installation.md +4 -0
  76. package/docs/start/framework/deploying.md +4 -0
  77. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.17.0
2
+ * react-router v7.18.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -21,14 +21,13 @@ import {
21
21
  createRoutesStub,
22
22
  createSession,
23
23
  createSessionStorage,
24
- deserializeErrors,
25
24
  getHydrationData,
26
25
  href,
27
26
  isCookie,
28
27
  isSession,
29
28
  routeRSCServerRequest,
30
29
  setDevServerHooks
31
- } from "./chunk-5TQZEVD5.mjs";
30
+ } from "./chunk-EGOTSXNH.mjs";
32
31
  import {
33
32
  Action,
34
33
  Await,
@@ -142,7 +141,7 @@ import {
142
141
  withComponentProps,
143
142
  withErrorBoundaryProps,
144
143
  withHydrateFallbackProps
145
- } from "./chunk-OSYEOCBT.mjs";
144
+ } from "./chunk-M7NGGUU6.mjs";
146
145
  export {
147
146
  Await,
148
147
  BrowserRouter,
@@ -194,7 +193,6 @@ export {
194
193
  createMemoryHistory as UNSAFE_createMemoryHistory,
195
194
  createRouter as UNSAFE_createRouter,
196
195
  decodeViaTurboStream as UNSAFE_decodeViaTurboStream,
197
- deserializeErrors as UNSAFE_deserializeErrors,
198
196
  getHydrationData as UNSAFE_getHydrationData,
199
197
  getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction,
200
198
  getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy,
@@ -1,4 +1,4 @@
1
- import { e as RouteObject, f as History, g as MaybePromise, c as RouterContextProvider, h as MapRoutePropertiesFunction, i as Action, L as Location, D as DataRouteMatch, j as Submission, k as RouteData, l as DataStrategyFunction, m as PatchRoutesOnNavigationFunction, n as DataRouteObject, o as RouteBranch, p as RouteManifest, U as UIMatch, T as To, q as HTMLFormMethod, F as FormEncType, r as Path, s as LoaderFunctionArgs, t as MiddlewareEnabled, u as AppLoadContext } from './data-D4xhSy90.js';
1
+ import { e as RouteObject, f as History, g as MaybePromise, c as RouterContextProvider, h as MapRoutePropertiesFunction, i as Action, L as Location, D as DataRouteMatch, j as Submission, k as RouteData, l as DataStrategyFunction, m as PatchRoutesOnNavigationFunction, n as DataRouteObject, o as RouteBranch, p as RouteManifest, U as UIMatch, T as To, q as HTMLFormMethod, F as FormEncType, r as Path, s as LoaderFunctionArgs, t as MiddlewareEnabled, u as AppLoadContext } from './data-CjO11-hU.js';
2
2
 
3
3
  /**
4
4
  * A Router instance manages all navigation and data loading/mutations
@@ -712,4 +712,4 @@ type RequestHandlerInstrumentationInfo = Readonly<{
712
712
  context: ReadonlyContext | undefined;
713
713
  }>;
714
714
 
715
- export { type BlockerFunction as B, type ClientInstrumentation as C, type Fetcher as F, type GetScrollPositionFunction as G, type HydrationState as H, type InstrumentRequestHandlerFunction as I, type NavigationStates as N, type RouterInit as R, type StaticHandler as S, type Router as a, type Blocker as b, type RelativeRoutingType as c, type RouterState as d, type GetScrollRestorationKeyFunction as e, type StaticHandlerContext as f, type Navigation as g, type RouterSubscriber as h, type RouterNavigateOptions as i, type RouterFetchOptions as j, type RevalidationState as k, type ServerInstrumentation as l, type InstrumentRouterFunction as m, type InstrumentRouteFunction as n, type InstrumentationHandlerResult as o, IDLE_NAVIGATION as p, IDLE_FETCHER as q, IDLE_BLOCKER as r, createRouter as s, type FutureConfig as t, type CreateStaticHandlerOptions as u };
715
+ export { type BlockerFunction as B, type ClientInstrumentation as C, type Fetcher as F, type GetScrollPositionFunction as G, type HydrationState as H, type InstrumentRequestHandlerFunction as I, type NavigationStates as N, type RouterInit as R, type StaticHandler as S, type Router as a, type Blocker as b, type RelativeRoutingType as c, type GetScrollRestorationKeyFunction as d, type StaticHandlerContext as e, type Navigation as f, type RouterState as g, type RouterSubscriber as h, type RouterNavigateOptions as i, type RouterFetchOptions as j, type RevalidationState as k, type ServerInstrumentation as l, type InstrumentRouterFunction as m, type InstrumentRouteFunction as n, type InstrumentationHandlerResult as o, IDLE_NAVIGATION as p, IDLE_FETCHER as q, IDLE_BLOCKER as r, createRouter as s, type FutureConfig as t, type CreateStaticHandlerOptions as u };
@@ -1,5 +1,5 @@
1
- import { R as RouteModule, e as LinkDescriptor, L as Location, F as Func, f as Pretty, g as MetaDescriptor, G as GetLoaderData, h as ServerDataFunctionArgs, i as MiddlewareNextFunction, j as ClientDataFunctionArgs, D as DataStrategyResult, k as ServerDataFrom, N as Normalize, l as GetActionData } from '../../data-U8FS-wNn.mjs';
2
- import { R as RouteFiles, P as Pages } from '../../register-CqK96Zfk.mjs';
1
+ import { R as RouteModule, e as LinkDescriptor, L as Location, F as Func, f as Pretty, g as MetaDescriptor, G as GetLoaderData, h as ServerDataFunctionArgs, i as MiddlewareNextFunction, j as ClientDataFunctionArgs, D as DataStrategyResult, k as ServerDataFrom, N as Normalize, l as GetActionData } from '../../data-DEjBmEfD.mjs';
2
+ import { R as RouteFiles, P as Pages } from '../../register-CmkRspdl.mjs';
3
3
  import 'react';
4
4
 
5
5
  type MaybePromise<T> = T | Promise<T>;
@@ -1,5 +1,5 @@
1
- import { R as RouteModule, v as LinkDescriptor, L as Location, w as Func, x as Pretty, y as MetaDescriptor, G as GetLoaderData, z as ServerDataFunctionArgs, B as MiddlewareNextFunction, E as ClientDataFunctionArgs, I as DataStrategyResult, J as ServerDataFrom, N as Normalize, K as GetActionData } from '../../data-D4xhSy90.js';
2
- import { R as RouteFiles, P as Pages } from '../../register-CNAx3TXj.js';
1
+ import { R as RouteModule, v as LinkDescriptor, L as Location, w as Func, x as Pretty, y as MetaDescriptor, G as GetLoaderData, z as ServerDataFunctionArgs, B as MiddlewareNextFunction, E as ClientDataFunctionArgs, I as DataStrategyResult, J as ServerDataFrom, N as Normalize, K as GetActionData } from '../../data-CjO11-hU.js';
2
+ import { R as RouteFiles, P as Pages } from '../../register-roq_0qYo.js';
3
3
  import 'react';
4
4
 
5
5
  type MaybePromise<T> = T | Promise<T>;
@@ -1,5 +1,5 @@
1
1
  "use strict";/**
2
- * react-router v7.17.0
2
+ * react-router v7.18.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.17.0
2
+ * react-router v7.18.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,4 +1,4 @@
1
- import { R as RouteModule } from './data-U8FS-wNn.mjs';
1
+ import { R as RouteModule } from './data-DEjBmEfD.mjs';
2
2
 
3
3
  /**
4
4
  * Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
@@ -1,4 +1,4 @@
1
- import { R as RouteModule } from './data-D4xhSy90.js';
1
+ import { R as RouteModule } from './data-CjO11-hU.js';
2
2
 
3
3
  /**
4
4
  * Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
@@ -50,7 +50,7 @@ React Router's type generation executes your route config (`app/routes.ts` by de
50
50
  It then generates a `+types/<route file>.d.ts` for each route within a special `.react-router/types/` directory.
51
51
  With [`rootDirs` configured][route-module-type-safety], TypeScript can import these generated files as if they were right next to their corresponding route modules.
52
52
 
53
- For a deeper dive into some of the design decisions, check out our [type inference decision doc](https://github.com/remix-run/react-router/blob/dev/decisions/0012-type-inference.md).
53
+ For a deeper dive into some of the design decisions, check out our [type inference decision doc](https://github.com/remix-run/react-router/blob/main/decisions/0012-type-inference.md).
54
54
 
55
55
  [route-module-type-safety]: ../how-to/route-module-type-safety
56
56
 
@@ -110,7 +110,8 @@ The easiest way is to simply append to the parent headers. This avoids overwriti
110
110
  ```tsx
111
111
  export function headers({ parentHeaders }: HeadersArgs) {
112
112
  parentHeaders.append(
113
- "Permissions-Policy: geolocation=()",
113
+ "Permissions-Policy",
114
+ "geolocation=()",
114
115
  );
115
116
  return parentHeaders;
116
117
  }
@@ -13,15 +13,17 @@ This is by no means a comprehensive guide, but React Router provides features to
13
13
 
14
14
  ## `Content-Security-Policy`
15
15
 
16
- If you are implementing a [Content-Security-Policy (CSP)][csp] in your application, specifically one using the `unsafe-inline` directive, you will need to specify a [`nonce`][nonce] attribute on the inline `<script>` elements rendered in your HTML. This must be specified on any API that generates inline scripts, including:
16
+ If you are implementing a [Content-Security-Policy (CSP)][csp] in your application, specifically one using the `unsafe-inline` directive, you will need to specify a [`nonce`][nonce] attribute on the inline `<script>` elements rendered in your HTML.
17
17
 
18
- - [`<Scripts nonce>`][scripts] (`root.tsx`)
19
- - [`<ScrollRestoration nonce>`][scrollrestoration] (`root.tsx`)
20
- - [`<ServerRouter nonce>`][serverrouter] (`entry.server.tsx`)
21
- - [`renderToPipeableStream(..., { nonce })`][renderToPipeableStream] (`entry.server.tsx`)
22
- - [`renderToReadableStream(..., { nonce })`][renderToReadableStream] (`entry.server.tsx`)
18
+ Add a nonce to these two spots in [`entry.server.tsx`][entryserver]:
19
+
20
+ - The [`<ServerRouter nonce>`][serverrouter] prop
21
+ - This will be proxied along through React Context and used for other Framework Mode components that output `nonce`-aware elements, including [`<Scripts>`][scripts], [`<ScrollRestoration>`][scrollrestoration]
22
+ - If those components specify their own `nonce` prop, it will override the `ServerRouter` value
23
+ - The `nonce` options of [`renderToPipeableStream`][renderToPipeableStream]/[`renderToReadableStream`][renderToReadableStream]
23
24
 
24
25
  [csp]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CSP
26
+ [entryserver]: ../api/framework-conventions/entry.server.tsx
25
27
  [nonce]: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce
26
28
  [renderToPipeableStream]: https://react.dev/reference/react-dom/server/renderToPipeableStream
27
29
  [renderToReadableStream]: https://react.dev/reference/react-dom/server/renderToReadableStream
@@ -47,6 +47,10 @@ ReactDOM.createRoot(root).render(
47
47
  );
48
48
  ```
49
49
 
50
+ <docs-info>Data Routers should not be held in React state. You should create your router
51
+ once outside of the React tree and pass it to `<RouterProvider>`. You can use
52
+ `patchRoutesOnNavigation` to add additional routes programmatically.</docs-info>
53
+
50
54
  ---
51
55
 
52
56
  Next: [Routing](./routing)
@@ -94,3 +94,7 @@ Netlify maintains their own template for React Router. Checkout the [Netlify Gui
94
94
  ### EdgeOne Pages
95
95
 
96
96
  EdgeOne Pages maintains their own template for React Router. Checkout the [EdgeOne Pages Guide](https://pages.edgeone.ai/document/framework-react-router) for more information.
97
+
98
+ ### DeployHQ
99
+
100
+ DeployHQ maintains their own guide for deploying React Router v7 to your own server. Checkout the [DeployHQ Guide](https://www.deployhq.com/guides/deploy-react-router-from-github) for more information.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-router",
3
- "version": "7.17.0",
3
+ "version": "7.18.0",
4
4
  "description": "Declarative routing for React",
5
5
  "keywords": [
6
6
  "react",