react-router 7.13.2-pre.0 → 7.13.2

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 +30 -11
  2. package/dist/development/{chunk-WO3PXTPV.js → chunk-GO74ODU3.js} +1 -1
  3. package/dist/development/{chunk-ZHBHDHL3.js → chunk-HPFFRPKK.js} +99 -99
  4. package/dist/development/{chunk-FXJW44AE.js → chunk-LLP6DRWX.js} +7 -7
  5. package/dist/development/{chunk-JEVMZMTG.mjs → chunk-UALY5CBT.mjs} +2 -2
  6. package/dist/development/{chunk-WM3TIFYP.mjs → chunk-UVKPFVEO.mjs} +2 -2
  7. package/dist/development/dom-export.js +28 -28
  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 +1 -1
  12. package/dist/development/index-react-server.mjs +1 -1
  13. package/dist/development/index.js +82 -82
  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-GCYIH3UC.mjs → chunk-2BDJPJTA.mjs} +2 -2
  18. package/dist/production/{chunk-R7LC5VXK.js → chunk-CAFVLUDY.js} +7 -7
  19. package/dist/production/{chunk-6A7E6W56.js → chunk-LKUVSIBA.js} +1 -1
  20. package/dist/production/{chunk-ZLBCNRMB.mjs → chunk-PY35PE22.mjs} +2 -2
  21. package/dist/production/{chunk-C3CA6GXO.js → chunk-XAAX7KIK.js} +99 -99
  22. package/dist/production/dom-export.js +28 -28
  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 +1 -1
  27. package/dist/production/index-react-server.mjs +1 -1
  28. package/dist/production/index.js +82 -82
  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,17 +1,21 @@
1
1
  # `react-router`
2
2
 
3
- ## 7.13.2-pre.0
3
+ ## 7.13.2
4
4
 
5
5
  ### Patch Changes
6
6
 
7
7
  - Fix clientLoader.hydrate when an ancestor route is also hydrating a clientLoader ([#14835](https://github.com/remix-run/react-router/pull/14835))
8
+
8
9
  - Fix type error when passing Framework Mode route components using `Route.ComponentProps` to `createRoutesStub` ([#14892](https://github.com/remix-run/react-router/pull/14892))
10
+
9
11
  - Fix percent encoding in relative path navigation ([#14786](https://github.com/remix-run/react-router/pull/14786))
12
+
10
13
  - Add `future.unstable_passThroughRequests` flag ([#14775](https://github.com/remix-run/react-router/pull/14775))
11
14
 
12
15
  By default, React Router normalizes the `request.url` passed to your `loader`, `action`, and `middleware` functions by removing React Router's internal implementation details (`.data` suffixes, `index` + `_routes` query params).
13
16
 
14
17
  Enabling this flag removes that normalization and passes the raw HTTP `request` instance to your handlers. This provides a few benefits:
18
+
15
19
  - Reduces server-side overhead by eliminating multiple `new Request()` calls on the critical path
16
20
  - Allows you to distinguish document from data requests in your handlers base don the presence of a `.data` suffix (useful for observability purposes)
17
21
 
@@ -40,7 +44,9 @@
40
44
  ```
41
45
 
42
46
  - Internal refactor to consolidate framework-agnostic/React-specific route type layers - no public API changes ([#14765](https://github.com/remix-run/react-router/pull/14765))
47
+
43
48
  - Sync protocol validation to rsc flows ([#14882](https://github.com/remix-run/react-router/pull/14882))
49
+
44
50
  - Add a new `unstable_url: URL` parameter to route handler methods (`loader`, `action`, `middleware`, etc.) representing the normalized URL the application is navigating to or fetching, with React Router implementation details removed (`.data`suffix, `index`/`_routes` query params) ([#14775](https://github.com/remix-run/react-router/pull/14775))
45
51
 
46
52
  This is being added alongside the new `future.unstable_passthroughRequests` future flag so that users still have a way to access the normalized URL when that flag is enabled and non-normalized `request`'s are being passed to your handlers. When adopting this flag, you will only need to start leveraging this new parameter if you are relying on the normalization of `request.url` in your application code.
@@ -59,9 +65,9 @@
59
65
 
60
66
  - Fix matchPath optional params matching without a "/" separator. ([#14689](https://github.com/remix-run/react-router/pull/14689))
61
67
  - matchPath("/users/:id?", "/usersblah") now returns null.
62
- - matchPath("/test_route/:part?", "/test_route_more") now returns null.
68
+ - matchPath("/test\_route/:part?", "/test\_route\_more") now returns null.
63
69
 
64
- - add RSC unstable_getRequest ([#14758](https://github.com/remix-run/react-router/pull/14758))
70
+ - add RSC unstable\_getRequest ([#14758](https://github.com/remix-run/react-router/pull/14758))
65
71
 
66
72
  - Fix `HydrateFallback` rendering during initial lazy route discovery with matching splat route ([#14740](https://github.com/remix-run/react-router/pull/14740))
67
73
 
@@ -107,6 +113,7 @@
107
113
  ```
108
114
 
109
115
  Notes:
116
+
110
117
  - The masked location, if present, will be available on `useLocation().unstable_mask` so you can detect whether you are currently masked or not.
111
118
  - Masked URLs only work for SPA use cases, and will be removed from `history.state` during SSR.
112
119
  - This provides a first-class API to mask URLs in Data Mode to achieve the same behavior you could do in Declarative Mode via [manual `backgroundLocation` management](https://github.com/remix-run/react-router/tree/main/examples/modal).
@@ -152,25 +159,25 @@
152
159
 
153
160
  | URL `/a/b/c` | **HTTP pathname** | **`request` pathname\`** |
154
161
  | ------------ | ----------------- | ------------------------ |
155
- | **Document** | `/a/b/c` | `/a/b/c` ✅ |
156
- | **Data** | `/a/b/c.data` | `/a/b/c` ✅ |
162
+ | **Document** | `/a/b/c` | `/a/b/c` ✅ |
163
+ | **Data** | `/a/b/c.data` | `/a/b/c` ✅ |
157
164
 
158
165
  | URL `/a/b/c/` | **HTTP pathname** | **`request` pathname\`** |
159
166
  | ------------- | ----------------- | ------------------------ |
160
- | **Document** | `/a/b/c/` | `/a/b/c/` ✅ |
167
+ | **Document** | `/a/b/c/` | `/a/b/c/` ✅ |
161
168
  | **Data** | `/a/b/c.data` | `/a/b/c` ⚠️ |
162
169
 
163
170
  With this flag enabled, these pathnames will be made consistent though a new `_.data` format for client-side `.data` requests:
164
171
 
165
172
  | URL `/a/b/c` | **HTTP pathname** | **`request` pathname\`** |
166
173
  | ------------ | ----------------- | ------------------------ |
167
- | **Document** | `/a/b/c` | `/a/b/c` ✅ |
168
- | **Data** | `/a/b/c.data` | `/a/b/c` ✅ |
174
+ | **Document** | `/a/b/c` | `/a/b/c` ✅ |
175
+ | **Data** | `/a/b/c.data` | `/a/b/c` ✅ |
169
176
 
170
177
  | URL `/a/b/c/` | **HTTP pathname** | **`request` pathname\`** |
171
178
  | ------------- | ------------------ | ------------------------ |
172
- | **Document** | `/a/b/c/` | `/a/b/c/` ✅ |
173
- | **Data** | `/a/b/c/_.data` ⬅️ | `/a/b/c/` ✅ |
179
+ | **Document** | `/a/b/c/` | `/a/b/c/` ✅ |
180
+ | **Data** | `/a/b/c/_.data` ⬅️ | `/a/b/c/` ✅ |
174
181
 
175
182
  This a bug fix but we are putting it behind an opt-in flag because it has the potential to be a "breaking bug fix" if you are relying on the URL format for any other application or caching logic.
176
183
 
@@ -197,12 +204,14 @@
197
204
  - \[UNSTABLE] Add a new `unstable_defaultShouldRevalidate` flag to various APIs to allow opt-ing out of standard revalidation behaviors. ([#14542](https://github.com/remix-run/react-router/pull/14542))
198
205
 
199
206
  If active routes include a `shouldRevalidate` function, then your value will be passed as `defaultShouldRevalidate` in those function so that the route always has the final revalidation determination.
207
+
200
208
  - `<Form method="post" unstable_defaultShouldRevalidate={false}>`
201
209
  - `submit(data, { method: "post", unstable_defaultShouldRevalidate: false })`
202
210
  - `<fetcher.Form method="post" unstable_defaultShouldRevalidate={false}>`
203
211
  - `fetcher.submit(data, { method: "post", unstable_defaultShouldRevalidate: false })`
204
212
 
205
213
  This is also available on non-submission APIs that may trigger revalidations due to changing search params:
214
+
206
215
  - `<Link to="/" unstable_defaultShouldRevalidate={false}>`
207
216
  - `navigate("/?foo=bar", { unstable_defaultShouldRevalidate: false })`
208
217
  - `setSearchParams(params, { unstable_defaultShouldRevalidate: false })`
@@ -225,6 +234,7 @@
225
234
  - ⚠️ This is a breaking change if you have begun using `fetcher.unstable_reset()`
226
235
 
227
236
  - Stabilize the `dataStrategy` `match.shouldRevalidateArgs`/`match.shouldCallHandler()` APIs. ([#14592](https://github.com/remix-run/react-router/pull/14592))
237
+
228
238
  - The `match.shouldLoad` API is now marked deprecated in favor of these more powerful alternatives
229
239
 
230
240
  - If you're using this API in a custom `dataStrategy` today, you can swap to the new API at your convenience:
@@ -353,6 +363,7 @@
353
363
  - Ensure action handlers run for routes with middleware even if no loader is present ([#14443](https://github.com/remix-run/react-router/pull/14443))
354
364
 
355
365
  - 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))
366
+
356
367
  - Framework Mode:
357
368
  - `entry.server.tsx`: `export const unstable_instrumentations = [...]`
358
369
  - `entry.client.tsx`: `<HydratedRouter unstable_instrumentations={[...]} />`
@@ -514,6 +525,7 @@
514
525
  - Stabilize middleware and context APIs. ([#14215](https://github.com/remix-run/react-router/pull/14215))
515
526
 
516
527
  We have removed the `unstable_` prefix from the following APIs and they are now considered stable and ready for production use:
528
+
517
529
  - [`RouterContextProvider`](https://reactrouter.com/api/utils/RouterContextProvider)
518
530
  - [`createContext`](https://reactrouter.com/api/utils/createContext)
519
531
  - `createBrowserRouter` [`getContext`](https://reactrouter.com/api/data-routers/createBrowserRouter#optsgetcontext) option
@@ -540,7 +552,7 @@
540
552
 
541
553
  - \[UNSTABLE] Add `<RouterProvider unstable_onError>`/`<HydratedRouter unstable_onError>` prop for client side error reporting ([#14162](https://github.com/remix-run/react-router/pull/14162))
542
554
 
543
- - server action revalidation opt out via $SKIP_REVALIDATION field ([#14154](https://github.com/remix-run/react-router/pull/14154))
555
+ - server action revalidation opt out via $SKIP\_REVALIDATION field ([#14154](https://github.com/remix-run/react-router/pull/14154))
544
556
 
545
557
  - Properly escape interpolated param values in `generatePath()` ([#13530](https://github.com/remix-run/react-router/pull/13530))
546
558
 
@@ -589,6 +601,7 @@
589
601
  - Remove dependency on `@types/node` in TypeScript declaration files ([#14059](https://github.com/remix-run/react-router/pull/14059))
590
602
 
591
603
  - Fix types for `UIMatch` to reflect that the `loaderData`/`data` properties may be `undefined` ([#12206](https://github.com/remix-run/react-router/pull/12206))
604
+
592
605
  - 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
593
606
  - 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
594
607
  - ⚠️ 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.
@@ -622,6 +635,7 @@
622
635
  - \[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))
623
636
 
624
637
  - \[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))
638
+
625
639
  - The API has been renamed to `unstable_generateMiddlewareResponse` for clarity
626
640
  - 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
627
641
  - The `query` version of the API now has a signature of `(query: (r: Request) => Promise<StaticHandlerContext | Response>) => Promise<Response>`
@@ -1267,6 +1281,7 @@
1267
1281
  ```
1268
1282
 
1269
1283
  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:
1284
+
1270
1285
  - Library mode - `createBrowserRouter(routes, { unstable_getContext })`
1271
1286
  - Framework mode - `<HydratedRouter unstable_getContext>`
1272
1287
 
@@ -1454,6 +1469,7 @@ _No changes_
1454
1469
  - Remove `future.v7_normalizeFormMethod` future flag ([#11697](https://github.com/remix-run/react-router/pull/11697))
1455
1470
 
1456
1471
  - 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))
1472
+
1457
1473
  - `createCookie`
1458
1474
  - `createCookieSessionStorage`
1459
1475
  - `createMemorySessionStorage`
@@ -1462,6 +1478,7 @@ _No changes_
1462
1478
  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)
1463
1479
 
1464
1480
  Since platform-specific packages no longer need to implement this API, the following low-level APIs have been removed:
1481
+
1465
1482
  - `createCookieFactory`
1466
1483
  - `createSessionStorageFactory`
1467
1484
  - `createCookieSessionStorageFactory`
@@ -1617,6 +1634,7 @@ _No changes_
1617
1634
  ```
1618
1635
 
1619
1636
  This initial implementation targets type inference for:
1637
+
1620
1638
  - `Params` : Path parameters from your routing config in `routes.ts` including file-based routing
1621
1639
  - `LoaderData` : Loader data from `loader` and/or `clientLoader` within your route module
1622
1640
  - `ActionData` : Action data from `action` and/or `clientAction` within your route module
@@ -1631,6 +1649,7 @@ _No changes_
1631
1649
  ```
1632
1650
 
1633
1651
  Check out our docs for more:
1652
+
1634
1653
  - [_Explanations > Type Safety_](https://reactrouter.com/dev/guides/explanation/type-safety)
1635
1654
  - [_How-To > Setting up type safety_](https://reactrouter.com/dev/guides/how-to/setting-up-type-safety)
1636
1655
 
@@ -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.13.2-pre.0
2
+ * react-router v7.13.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *