react-router 7.9.0-pre.0 → 7.9.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 (30) hide show
  1. package/CHANGELOG.md +11 -2
  2. package/dist/development/{chunk-3TJX7VNY.mjs → chunk-AKKEMMKB.mjs} +3 -15
  3. package/dist/development/{chunk-EAIS2CTK.mjs → chunk-S5YDGZLY.mjs} +6 -8
  4. package/dist/development/{chunk-4J2JOVAI.js → chunk-UGCJQSTX.js} +131 -131
  5. package/dist/development/{chunk-ECJT65VE.js → chunk-VHEBI3C5.js} +6 -8
  6. package/dist/development/dom-export.js +3 -3
  7. package/dist/development/dom-export.mjs +3 -3
  8. package/dist/development/index-react-server-client.js +4 -4
  9. package/dist/development/index-react-server-client.mjs +2 -2
  10. package/dist/development/index-react-server.js +1 -1
  11. package/dist/development/index-react-server.mjs +1 -1
  12. package/dist/development/index.js +97 -109
  13. package/dist/development/index.mjs +3 -3
  14. package/dist/development/lib/types/internal.js +1 -1
  15. package/dist/development/lib/types/internal.mjs +1 -1
  16. package/dist/production/{chunk-CSESPFUI.js → chunk-HDA5IKPB.js} +131 -131
  17. package/dist/production/{chunk-47NS5WEV.mjs → chunk-MOZTWV63.mjs} +6 -8
  18. package/dist/production/{chunk-LQAK2UKE.js → chunk-VNPMQDPD.js} +6 -8
  19. package/dist/production/{chunk-SCSBSW2J.mjs → chunk-WOZJCBVO.mjs} +3 -15
  20. package/dist/production/dom-export.js +3 -3
  21. package/dist/production/dom-export.mjs +3 -3
  22. package/dist/production/index-react-server-client.js +4 -4
  23. package/dist/production/index-react-server-client.mjs +2 -2
  24. package/dist/production/index-react-server.js +1 -1
  25. package/dist/production/index-react-server.mjs +1 -1
  26. package/dist/production/index.js +97 -109
  27. package/dist/production/index.mjs +3 -3
  28. package/dist/production/lib/types/internal.js +1 -1
  29. package/dist/production/lib/types/internal.mjs +1 -1
  30. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,12 +1,13 @@
1
1
  # `react-router`
2
2
 
3
- ## 7.9.0-pre.0
3
+ ## 7.9.0
4
4
 
5
5
  ### Minor Changes
6
6
 
7
7
  - Stabilize middleware and context APIs. ([#14215](https://github.com/remix-run/react-router/pull/14215))
8
8
 
9
9
  We have removed the `unstable_` prefix from the following APIs and they are now considered stable and ready for production use:
10
+
10
11
  - [`RouterContextProvider`](https://reactrouter.com/api/utils/RouterContextProvider)
11
12
  - [`createContext`](https://reactrouter.com/api/utils/createContext)
12
13
  - `createBrowserRouter` [`getContext`](https://reactrouter.com/api/data-routers/createBrowserRouter#optsgetcontext) option
@@ -16,6 +17,7 @@
16
17
 
17
18
  ### Patch Changes
18
19
 
20
+ - Escape HTML in `meta()` JSON-LD content ([#14316](https://github.com/remix-run/react-router/pull/14316))
19
21
  - Add react-server Await component implementation ([#14261](https://github.com/remix-run/react-router/pull/14261))
20
22
  - In RSC Data Mode when using a custom basename, fix hydration errors for routes that only have client loaders ([#14264](https://github.com/remix-run/react-router/pull/14264))
21
23
  - Make `href` function available in a react-server context ([#14262](https://github.com/remix-run/react-router/pull/14262))
@@ -32,7 +34,7 @@
32
34
 
33
35
  - \[UNSTABLE] Add `<RouterProvider unstable_onError>`/`<HydratedRouter unstable_onError>` prop for client side error reporting ([#14162](https://github.com/remix-run/react-router/pull/14162))
34
36
 
35
- - server action revalidation opt out via $SKIP_REVALIDATION field ([#14154](https://github.com/remix-run/react-router/pull/14154))
37
+ - server action revalidation opt out via $SKIP\_REVALIDATION field ([#14154](https://github.com/remix-run/react-router/pull/14154))
36
38
 
37
39
  - Properly escape interpolated param values in `generatePath()` ([#13530](https://github.com/remix-run/react-router/pull/13530))
38
40
 
@@ -81,6 +83,7 @@
81
83
  - Remove dependency on `@types/node` in TypeScript declaration files ([#14059](https://github.com/remix-run/react-router/pull/14059))
82
84
 
83
85
  - Fix types for `UIMatch` to reflect that the `loaderData`/`data` properties may be `undefined` ([#12206](https://github.com/remix-run/react-router/pull/12206))
86
+
84
87
  - When an `ErrorBoundary` is being rendered, not all active matches will have loader data available, since it may have been their `loader` that threw to trigger the boundary
85
88
  - The `UIMatch.data` type was not correctly handing this and would always reflect the presence of data, leading to the unexpected runtime errors when an `ErrorBoundary` was rendered
86
89
  - ⚠️ This may cause some type errors to show up in your code for unguarded `match.data` accesses - you should properly guard for `undefined` values in those scenarios.
@@ -114,6 +117,7 @@
114
117
  - \[UNSTABLE] When middleware is enabled, make the `context` parameter read-only (via `Readonly<unstable_RouterContextProvider>`) so that TypeScript will not allow you to write arbitrary fields to it in loaders, actions, or middleware. ([#14097](https://github.com/remix-run/react-router/pull/14097))
115
118
 
116
119
  - \[UNSTABLE] Rename and alter the signature/functionality of the `unstable_respond` API in `staticHandler.query`/`staticHandler.queryRoute` ([#14103](https://github.com/remix-run/react-router/pull/14103))
120
+
117
121
  - The API has been renamed to `unstable_generateMiddlewareResponse` for clarity
118
122
  - The main functional change is that instead of running the loaders/actions before calling `unstable_respond` and handing you the result, we now pass a `query`/`queryRoute` function as a parameter and you execute the loaders/actions inside your callback, giving you full access to pre-processing and error handling
119
123
  - The `query` version of the API now has a signature of `(query: (r: Request) => Promise<StaticHandlerContext | Response>) => Promise<Response>`
@@ -759,6 +763,7 @@
759
763
  ```
760
764
 
761
765
  Similar to server-side requests, a fresh `context` will be created per navigation (or `fetcher` call). If you have initial data you'd like to populate in the context for every request, you can provide an `unstable_getContext` function at the root of your app:
766
+
762
767
  - Library mode - `createBrowserRouter(routes, { unstable_getContext })`
763
768
  - Framework mode - `<HydratedRouter unstable_getContext>`
764
769
 
@@ -946,6 +951,7 @@ _No changes_
946
951
  - Remove `future.v7_normalizeFormMethod` future flag ([#11697](https://github.com/remix-run/react-router/pull/11697))
947
952
 
948
953
  - For Remix consumers migrating to React Router, the `crypto` global from the [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) is now required when using cookie and session APIs. This means that the following APIs are provided from `react-router` rather than platform-specific packages: ([#11837](https://github.com/remix-run/react-router/pull/11837))
954
+
949
955
  - `createCookie`
950
956
  - `createCookieSessionStorage`
951
957
  - `createMemorySessionStorage`
@@ -954,6 +960,7 @@ _No changes_
954
960
  For consumers running older versions of Node, the `installGlobals` function from `@remix-run/node` has been updated to define `globalThis.crypto`, using [Node's `require('node:crypto').webcrypto` implementation.](https://nodejs.org/api/webcrypto.html)
955
961
 
956
962
  Since platform-specific packages no longer need to implement this API, the following low-level APIs have been removed:
963
+
957
964
  - `createCookieFactory`
958
965
  - `createSessionStorageFactory`
959
966
  - `createCookieSessionStorageFactory`
@@ -1109,6 +1116,7 @@ _No changes_
1109
1116
  ```
1110
1117
 
1111
1118
  This initial implementation targets type inference for:
1119
+
1112
1120
  - `Params` : Path parameters from your routing config in `routes.ts` including file-based routing
1113
1121
  - `LoaderData` : Loader data from `loader` and/or `clientLoader` within your route module
1114
1122
  - `ActionData` : Action data from `action` and/or `clientAction` within your route module
@@ -1123,6 +1131,7 @@ _No changes_
1123
1131
  ```
1124
1132
 
1125
1133
  Check out our docs for more:
1134
+
1126
1135
  - [_Explanations > Type Safety_](https://reactrouter.com/dev/guides/explanation/type-safety)
1127
1136
  - [_How-To > Setting up type safety_](https://reactrouter.com/dev/guides/how-to/setting-up-type-safety)
1128
1137
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.9.0-pre.0
2
+ * react-router v7.9.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -33,6 +33,7 @@ import {
33
33
  createStaticRouter,
34
34
  decodeViaTurboStream,
35
35
  encode,
36
+ escapeHtml,
36
37
  getManifestPath,
37
38
  getSingleFetchDataStrategyImpl,
38
39
  getStaticContextFromError,
@@ -58,7 +59,7 @@ import {
58
59
  withComponentProps,
59
60
  withErrorBoundaryProps,
60
61
  withHydrateFallbackProps
61
- } from "./chunk-EAIS2CTK.mjs";
62
+ } from "./chunk-S5YDGZLY.mjs";
62
63
 
63
64
  // lib/dom/ssr/server.tsx
64
65
  import * as React from "react";
@@ -677,19 +678,6 @@ function createStaticHandlerDataRoutes(manifest, future, parentId = "", routesBy
677
678
  });
678
679
  }
679
680
 
680
- // lib/server-runtime/markup.ts
681
- var ESCAPE_LOOKUP = {
682
- "&": "\\u0026",
683
- ">": "\\u003e",
684
- "<": "\\u003c",
685
- "\u2028": "\\u2028",
686
- "\u2029": "\\u2029"
687
- };
688
- var ESCAPE_REGEX = /[&><\u2028\u2029]/g;
689
- function escapeHtml(html) {
690
- return html.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);
691
- }
692
-
693
681
  // lib/server-runtime/serverHandoff.ts
694
682
  function createServerHandoffString(serverHandoff) {
695
683
  return escapeHtml(JSON.stringify(serverHandoff));
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.9.0-pre.0
2
+ * react-router v7.9.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -6998,9 +6998,6 @@ var ESCAPE_REGEX = /[&><\u2028\u2029]/g;
6998
6998
  function escapeHtml(html) {
6999
6999
  return html.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);
7000
7000
  }
7001
- function createHtml(html) {
7002
- return { __html: html };
7003
- }
7004
7001
 
7005
7002
  // lib/dom/ssr/invariant.ts
7006
7003
  function invariant2(value, message) {
@@ -8676,7 +8673,7 @@ function Meta() {
8676
8673
  {
8677
8674
  key: `script:ld+json:${json}`,
8678
8675
  type: "application/ld+json",
8679
- dangerouslySetInnerHTML: { __html: json }
8676
+ dangerouslySetInnerHTML: { __html: escapeHtml(json) }
8680
8677
  }
8681
8678
  );
8682
8679
  } catch (err) {
@@ -8781,7 +8778,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
8781
8778
  {
8782
8779
  ...scriptProps,
8783
8780
  suppressHydrationWarning: true,
8784
- dangerouslySetInnerHTML: createHtml(contextScript),
8781
+ dangerouslySetInnerHTML: { __html: contextScript },
8785
8782
  type: void 0
8786
8783
  }
8787
8784
  ), /* @__PURE__ */ React8.createElement(
@@ -8789,7 +8786,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
8789
8786
  {
8790
8787
  ...scriptProps,
8791
8788
  suppressHydrationWarning: true,
8792
- dangerouslySetInnerHTML: createHtml(routeModulesScript),
8789
+ dangerouslySetInnerHTML: { __html: routeModulesScript },
8793
8790
  type: "module",
8794
8791
  async: true
8795
8792
  }
@@ -8967,7 +8964,7 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
8967
8964
  try {
8968
8965
  if (isBrowser) {
8969
8966
  window.__reactRouterVersion = // @ts-expect-error
8970
- "7.9.0-pre.0";
8967
+ "7.9.0";
8971
8968
  }
8972
8969
  } catch (e) {
8973
8970
  }
@@ -10142,6 +10139,7 @@ export {
10142
10139
  WithErrorBoundaryProps,
10143
10140
  withErrorBoundaryProps,
10144
10141
  createSearchParams,
10142
+ escapeHtml,
10145
10143
  encode,
10146
10144
  createRequestInit,
10147
10145
  SingleFetchRedirectSymbol,