react-router 7.9.6-pre.0 → 7.9.6

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 (32) hide show
  1. package/CHANGELOG.md +15 -3
  2. package/dist/development/{chunk-7TW6LJC6.mjs → chunk-4WY6JWTD.mjs} +26 -5
  3. package/dist/development/{chunk-TUTX3ERH.js → chunk-AMVS5XVJ.js} +25 -4
  4. package/dist/{production/chunk-4MBU4DF6.mjs → development/chunk-G3INQAYP.mjs} +2 -2
  5. package/dist/{production/chunk-ZHTTD7UY.js → development/chunk-O4JVZSOY.js} +93 -93
  6. package/dist/{production/chunk-MKF3AQDO.js → development/chunk-PZWDWJAY.js} +7 -7
  7. package/dist/development/dom-export.js +26 -26
  8. package/dist/development/dom-export.mjs +3 -3
  9. package/dist/development/index-react-server-client.js +4 -4
  10. package/dist/development/index-react-server-client.mjs +2 -2
  11. package/dist/development/index-react-server.js +25 -4
  12. package/dist/development/index-react-server.mjs +25 -4
  13. package/dist/development/index.js +76 -76
  14. package/dist/development/index.mjs +3 -3
  15. package/dist/development/lib/types/internal.js +1 -1
  16. package/dist/development/lib/types/internal.mjs +1 -1
  17. package/dist/production/{chunk-RBZEEJIK.js → chunk-EAIF67OW.js} +25 -4
  18. package/dist/{development/chunk-P6ZEAD4C.mjs → production/chunk-FDUMZGKM.mjs} +2 -2
  19. package/dist/production/{chunk-GG2LAVOQ.mjs → chunk-FUSXQSWG.mjs} +26 -5
  20. package/dist/{development/chunk-DB25NZIA.js → production/chunk-G5A35OQU.js} +7 -7
  21. package/dist/{development/chunk-IR7LYQCC.js → production/chunk-QN64DHI4.js} +93 -93
  22. package/dist/production/dom-export.js +26 -26
  23. package/dist/production/dom-export.mjs +3 -3
  24. package/dist/production/index-react-server-client.js +4 -4
  25. package/dist/production/index-react-server-client.mjs +2 -2
  26. package/dist/production/index-react-server.js +25 -4
  27. package/dist/production/index-react-server.mjs +25 -4
  28. package/dist/production/index.js +76 -76
  29. package/dist/production/index.mjs +3 -3
  30. package/dist/production/lib/types/internal.js +1 -1
  31. package/dist/production/lib/types/internal.mjs +1 -1
  32. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # `react-router`
2
2
 
3
- ## 7.9.6-pre.0
3
+ ## 7.9.6
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - [UNSTABLE] Add `location`/`params` as arguments to client-side `unstable_onError` to permit enhanced error reporting. ([#14509](https://github.com/remix-run/react-router/pull/14509))
7
+ - \[UNSTABLE] Add `location`/`params` as arguments to client-side `unstable_onError` to permit enhanced error reporting. ([#14509](https://github.com/remix-run/react-router/pull/14509))
8
8
 
9
9
  ⚠️ This is a breaking change if you've already adopted `unstable_onError`. The second `errorInfo` parameter is now an object with `location` and `params`:
10
10
 
@@ -28,8 +28,11 @@
28
28
  ```
29
29
 
30
30
  - Properly handle ancestor thrown middleware errors before `next()` on fetcher submissions ([#14517](https://github.com/remix-run/react-router/pull/14517))
31
+
31
32
  - Fix issue with splat routes interfering with multiple calls to patchRoutesOnNavigation ([#14487](https://github.com/remix-run/react-router/pull/14487))
32
33
 
34
+ - Normalize double-slashes in `resolvePath` ([#14529](https://github.com/remix-run/react-router/pull/14529))
35
+
33
36
  ## 7.9.5
34
37
 
35
38
  ### Patch Changes
@@ -58,6 +61,7 @@
58
61
  - Ensure action handlers run for routes with middleware even if no loader is present ([#14443](https://github.com/remix-run/react-router/pull/14443))
59
62
 
60
63
  - Add `unstable_instrumentations` API to allow users to add observablity to their apps by instrumenting route loaders, actions, middlewares, lazy, as well as server-side request handlers and client side navigations/fetches ([#14412](https://github.com/remix-run/react-router/pull/14412))
64
+
61
65
  - Framework Mode:
62
66
  - `entry.server.tsx`: `export const unstable_instrumentations = [...]`
63
67
  - `entry.client.tsx`: `<HydratedRouter unstable_instrumentations={[...]} />`
@@ -219,6 +223,7 @@
219
223
  - Stabilize middleware and context APIs. ([#14215](https://github.com/remix-run/react-router/pull/14215))
220
224
 
221
225
  We have removed the `unstable_` prefix from the following APIs and they are now considered stable and ready for production use:
226
+
222
227
  - [`RouterContextProvider`](https://reactrouter.com/api/utils/RouterContextProvider)
223
228
  - [`createContext`](https://reactrouter.com/api/utils/createContext)
224
229
  - `createBrowserRouter` [`getContext`](https://reactrouter.com/api/data-routers/createBrowserRouter#optsgetcontext) option
@@ -245,7 +250,7 @@
245
250
 
246
251
  - \[UNSTABLE] Add `<RouterProvider unstable_onError>`/`<HydratedRouter unstable_onError>` prop for client side error reporting ([#14162](https://github.com/remix-run/react-router/pull/14162))
247
252
 
248
- - server action revalidation opt out via $SKIP_REVALIDATION field ([#14154](https://github.com/remix-run/react-router/pull/14154))
253
+ - server action revalidation opt out via $SKIP\_REVALIDATION field ([#14154](https://github.com/remix-run/react-router/pull/14154))
249
254
 
250
255
  - Properly escape interpolated param values in `generatePath()` ([#13530](https://github.com/remix-run/react-router/pull/13530))
251
256
 
@@ -294,6 +299,7 @@
294
299
  - Remove dependency on `@types/node` in TypeScript declaration files ([#14059](https://github.com/remix-run/react-router/pull/14059))
295
300
 
296
301
  - Fix types for `UIMatch` to reflect that the `loaderData`/`data` properties may be `undefined` ([#12206](https://github.com/remix-run/react-router/pull/12206))
302
+
297
303
  - 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
298
304
  - 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
299
305
  - ⚠️ 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.
@@ -327,6 +333,7 @@
327
333
  - \[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))
328
334
 
329
335
  - \[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))
336
+
330
337
  - The API has been renamed to `unstable_generateMiddlewareResponse` for clarity
331
338
  - 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
332
339
  - The `query` version of the API now has a signature of `(query: (r: Request) => Promise<StaticHandlerContext | Response>) => Promise<Response>`
@@ -972,6 +979,7 @@
972
979
  ```
973
980
 
974
981
  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:
982
+
975
983
  - Library mode - `createBrowserRouter(routes, { unstable_getContext })`
976
984
  - Framework mode - `<HydratedRouter unstable_getContext>`
977
985
 
@@ -1159,6 +1167,7 @@ _No changes_
1159
1167
  - Remove `future.v7_normalizeFormMethod` future flag ([#11697](https://github.com/remix-run/react-router/pull/11697))
1160
1168
 
1161
1169
  - 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))
1170
+
1162
1171
  - `createCookie`
1163
1172
  - `createCookieSessionStorage`
1164
1173
  - `createMemorySessionStorage`
@@ -1167,6 +1176,7 @@ _No changes_
1167
1176
  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)
1168
1177
 
1169
1178
  Since platform-specific packages no longer need to implement this API, the following low-level APIs have been removed:
1179
+
1170
1180
  - `createCookieFactory`
1171
1181
  - `createSessionStorageFactory`
1172
1182
  - `createCookieSessionStorageFactory`
@@ -1322,6 +1332,7 @@ _No changes_
1322
1332
  ```
1323
1333
 
1324
1334
  This initial implementation targets type inference for:
1335
+
1325
1336
  - `Params` : Path parameters from your routing config in `routes.ts` including file-based routing
1326
1337
  - `LoaderData` : Loader data from `loader` and/or `clientLoader` within your route module
1327
1338
  - `ActionData` : Action data from `action` and/or `clientAction` within your route module
@@ -1336,6 +1347,7 @@ _No changes_
1336
1347
  ```
1337
1348
 
1338
1349
  Check out our docs for more:
1350
+
1339
1351
  - [_Explanations > Type Safety_](https://reactrouter.com/dev/guides/explanation/type-safety)
1340
1352
  - [_How-To > Setting up type safety_](https://reactrouter.com/dev/guides/how-to/setting-up-type-safety)
1341
1353
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.9.6-pre.0
2
+ * react-router v7.9.6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -811,13 +811,36 @@ function prependBasename({
811
811
  }) {
812
812
  return pathname === "/" ? basename : joinPaths([basename, pathname]);
813
813
  }
814
+ var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
815
+ var isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX.test(url);
814
816
  function resolvePath(to, fromPathname = "/") {
815
817
  let {
816
818
  pathname: toPathname,
817
819
  search = "",
818
820
  hash = ""
819
821
  } = typeof to === "string" ? parsePath(to) : to;
820
- let pathname = toPathname ? toPathname.startsWith("/") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname;
822
+ let pathname;
823
+ if (toPathname) {
824
+ if (isAbsoluteUrl(toPathname)) {
825
+ pathname = toPathname;
826
+ } else {
827
+ if (toPathname.includes("//")) {
828
+ let oldPathname = toPathname;
829
+ toPathname = toPathname.replace(/\/\/+/g, "/");
830
+ warning(
831
+ false,
832
+ `Pathnames cannot have embedded double slashes - normalizing ${oldPathname} -> ${toPathname}`
833
+ );
834
+ }
835
+ if (toPathname.startsWith("/")) {
836
+ pathname = resolvePathname(toPathname.substring(1), "/");
837
+ } else {
838
+ pathname = resolvePathname(toPathname, fromPathname);
839
+ }
840
+ }
841
+ } else {
842
+ pathname = fromPathname;
843
+ }
821
844
  return {
822
845
  pathname,
823
846
  search: normalizeSearch(search),
@@ -1265,8 +1288,6 @@ var IDLE_BLOCKER = {
1265
1288
  reset: void 0,
1266
1289
  location: void 0
1267
1290
  };
1268
- var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
1269
- var isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX.test(url);
1270
1291
  var defaultMapRouteProperties = (route) => ({
1271
1292
  hasErrorBoundary: Boolean(route.hasErrorBoundary)
1272
1293
  });
@@ -9517,7 +9538,7 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
9517
9538
  try {
9518
9539
  if (isBrowser) {
9519
9540
  window.__reactRouterVersion = // @ts-expect-error
9520
- "7.9.6-pre.0";
9541
+ "7.9.6";
9521
9542
  }
9522
9543
  } catch (e) {
9523
9544
  }
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
2
- * react-router v7.9.6-pre.0
2
+ * react-router v7.9.6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -811,13 +811,36 @@ function prependBasename({
811
811
  }) {
812
812
  return pathname === "/" ? basename : joinPaths([basename, pathname]);
813
813
  }
814
+ var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
815
+ var isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX.test(url);
814
816
  function resolvePath(to, fromPathname = "/") {
815
817
  let {
816
818
  pathname: toPathname,
817
819
  search = "",
818
820
  hash = ""
819
821
  } = typeof to === "string" ? parsePath(to) : to;
820
- let pathname = toPathname ? toPathname.startsWith("/") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname;
822
+ let pathname;
823
+ if (toPathname) {
824
+ if (isAbsoluteUrl(toPathname)) {
825
+ pathname = toPathname;
826
+ } else {
827
+ if (toPathname.includes("//")) {
828
+ let oldPathname = toPathname;
829
+ toPathname = toPathname.replace(/\/\/+/g, "/");
830
+ warning(
831
+ false,
832
+ `Pathnames cannot have embedded double slashes - normalizing ${oldPathname} -> ${toPathname}`
833
+ );
834
+ }
835
+ if (toPathname.startsWith("/")) {
836
+ pathname = resolvePathname(toPathname.substring(1), "/");
837
+ } else {
838
+ pathname = resolvePathname(toPathname, fromPathname);
839
+ }
840
+ }
841
+ } else {
842
+ pathname = fromPathname;
843
+ }
821
844
  return {
822
845
  pathname,
823
846
  search: normalizeSearch(search),
@@ -1265,8 +1288,6 @@ var IDLE_BLOCKER = {
1265
1288
  reset: void 0,
1266
1289
  location: void 0
1267
1290
  };
1268
- var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
1269
- var isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX.test(url);
1270
1291
  var defaultMapRouteProperties = (route) => ({
1271
1292
  hasErrorBoundary: Boolean(route.hasErrorBoundary)
1272
1293
  });
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.9.6-pre.0
2
+ * react-router v7.9.6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -49,7 +49,7 @@ import {
49
49
  withComponentProps,
50
50
  withErrorBoundaryProps,
51
51
  withHydrateFallbackProps
52
- } from "./chunk-GG2LAVOQ.mjs";
52
+ } from "./chunk-4WY6JWTD.mjs";
53
53
 
54
54
  // lib/dom/ssr/server.tsx
55
55
  import * as React from "react";