react-router 7.13.1 → 7.13.2-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.
- package/CHANGELOG.md +57 -23
- package/dist/{production/browser-DzsJABDQ.d.mts → development/browser-Bfn3xw9E.d.ts} +2 -1
- package/dist/development/{browser-DzsJABDQ.d.mts → browser-Di6-vSl-.d.mts} +2 -1
- package/dist/development/{chunk-KSEWV2VO.js → chunk-FXJW44AE.js} +7 -7
- package/dist/{production/chunk-TXB4YXR2.mjs → development/chunk-JEVMZMTG.mjs} +83 -49
- package/dist/development/{chunk-LFPYN7LY.mjs → chunk-WM3TIFYP.mjs} +124 -44
- package/dist/development/{chunk-XOLAXE2Z.js → chunk-WO3PXTPV.js} +190 -111
- package/dist/{production/chunk-B5UMK6O7.js → development/chunk-ZHBHDHL3.js} +100 -99
- package/dist/development/context-phCt_zmH.d.mts +1713 -0
- package/dist/development/dom-export.d.mts +3 -2
- package/dist/development/dom-export.d.ts +3 -2
- package/dist/development/dom-export.js +45 -29
- package/dist/development/dom-export.mjs +21 -5
- package/dist/development/{index-react-server-client-C4tCIird.d.ts → index-react-server-client-BcrVT7Dd.d.mts} +4 -2
- package/dist/{production/index-react-server-client-EzWJGpN_.d.mts → development/index-react-server-client-CCwMoQIT.d.ts} +1067 -10
- package/dist/development/index-react-server-client.d.mts +3 -2
- package/dist/development/index-react-server-client.d.ts +3 -2
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.d.mts +293 -246
- package/dist/development/index-react-server.d.ts +293 -246
- package/dist/development/index-react-server.js +121 -43
- package/dist/development/index-react-server.mjs +121 -43
- package/dist/development/index.d.mts +15 -13
- package/dist/development/index.d.ts +15 -13
- package/dist/development/index.js +176 -142
- package/dist/development/index.mjs +3 -3
- package/dist/development/instrumentation-BYr6ff5D.d.ts +657 -0
- package/dist/development/lib/types/internal.d.mts +2 -2
- package/dist/development/lib/types/internal.d.ts +2 -2
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{register-CBoanF80.d.ts → register-CTxsJBKQ.d.mts} +1 -1
- package/dist/development/{register-cRYJ3CjG.d.mts → register-CkcGwv27.d.ts} +1 -1
- package/dist/development/routeModules-BRrCYrSL.d.mts +1693 -0
- package/dist/development/routeModules-CA7kSxJJ.d.ts +1693 -0
- package/dist/production/{browser-sPQ7eaK4.d.ts → browser-Bfn3xw9E.d.ts} +2 -1
- package/dist/{development/browser-sPQ7eaK4.d.ts → production/browser-Di6-vSl-.d.mts} +2 -1
- package/dist/production/{chunk-772H4TVR.js → chunk-6A7E6W56.js} +190 -111
- package/dist/{development/chunk-2YMDXNOJ.js → production/chunk-C3CA6GXO.js} +100 -99
- package/dist/production/{chunk-RJCJ3EYF.mjs → chunk-GCYIH3UC.mjs} +124 -44
- package/dist/production/{chunk-ZJMCM6KT.js → chunk-R7LC5VXK.js} +7 -7
- package/dist/{development/chunk-JPUPSTYD.mjs → production/chunk-ZLBCNRMB.mjs} +83 -49
- package/dist/production/context-phCt_zmH.d.mts +1713 -0
- package/dist/production/dom-export.d.mts +3 -2
- package/dist/production/dom-export.d.ts +3 -2
- package/dist/production/dom-export.js +45 -29
- package/dist/production/dom-export.mjs +21 -5
- package/dist/{development/index-react-server-client-EzWJGpN_.d.mts → production/index-react-server-client-BcrVT7Dd.d.mts} +4 -2
- package/dist/production/{index-react-server-client-C4tCIird.d.ts → index-react-server-client-CCwMoQIT.d.ts} +1067 -10
- package/dist/production/index-react-server-client.d.mts +3 -2
- package/dist/production/index-react-server-client.d.ts +3 -2
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.d.mts +293 -246
- package/dist/production/index-react-server.d.ts +293 -246
- package/dist/production/index-react-server.js +121 -43
- package/dist/production/index-react-server.mjs +121 -43
- package/dist/production/index.d.mts +15 -13
- package/dist/production/index.d.ts +15 -13
- package/dist/production/index.js +176 -142
- package/dist/production/index.mjs +3 -3
- package/dist/production/instrumentation-BYr6ff5D.d.ts +657 -0
- package/dist/production/lib/types/internal.d.mts +2 -2
- package/dist/production/lib/types/internal.d.ts +2 -2
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/{register-CBoanF80.d.ts → register-CTxsJBKQ.d.mts} +1 -1
- package/dist/production/{register-cRYJ3CjG.d.mts → register-CkcGwv27.d.ts} +1 -1
- package/dist/production/routeModules-BRrCYrSL.d.mts +1693 -0
- package/dist/production/routeModules-CA7kSxJJ.d.ts +1693 -0
- package/package.json +1 -1
- package/dist/development/instrumentation--6Pioq_G.d.ts +0 -3344
- package/dist/development/router-cLsU7kHk.d.mts +0 -3344
- package/dist/production/instrumentation--6Pioq_G.d.ts +0 -3344
- package/dist/production/router-cLsU7kHk.d.mts +0 -3344
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# `react-router`
|
|
2
2
|
|
|
3
|
+
## 7.13.2-pre.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix clientLoader.hydrate when an ancestor route is also hydrating a clientLoader ([#14835](https://github.com/remix-run/react-router/pull/14835))
|
|
8
|
+
- Fix type error when passing Framework Mode route components using `Route.ComponentProps` to `createRoutesStub` ([#14892](https://github.com/remix-run/react-router/pull/14892))
|
|
9
|
+
- Fix percent encoding in relative path navigation ([#14786](https://github.com/remix-run/react-router/pull/14786))
|
|
10
|
+
- Add `future.unstable_passThroughRequests` flag ([#14775](https://github.com/remix-run/react-router/pull/14775))
|
|
11
|
+
|
|
12
|
+
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
|
+
|
|
14
|
+
Enabling this flag removes that normalization and passes the raw HTTP `request` instance to your handlers. This provides a few benefits:
|
|
15
|
+
- Reduces server-side overhead by eliminating multiple `new Request()` calls on the critical path
|
|
16
|
+
- Allows you to distinguish document from data requests in your handlers base don the presence of a `.data` suffix (useful for observability purposes)
|
|
17
|
+
|
|
18
|
+
If you were previously relying on the normalization of `request.url`, you can switch to use the new sibling `unstable_url` parameter which contains a `URL` instance representing the normalized location:
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
// ❌ Before: you could assume there was no `.data` suffix in `request.url`
|
|
22
|
+
export async function loader({ request }: Route.LoaderArgs) {
|
|
23
|
+
let url = new URL(request.url);
|
|
24
|
+
if (url.pathname === "/path") {
|
|
25
|
+
// This check will fail with the flag enabled because the `.data` suffix will
|
|
26
|
+
// exist on data requests
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// ✅ After: use `unstable_url` for normalized routing logic and `request.url`
|
|
31
|
+
// for raw routing logic
|
|
32
|
+
export async function loader({ request, unstable_url }: Route.LoaderArgs) {
|
|
33
|
+
if (unstable_url.pathname === "/path") {
|
|
34
|
+
// This will always have the `.data` suffix stripped
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// And now you can distinguish between document versus data requests
|
|
38
|
+
let isDataRequest = new URL(request.url).pathname.endsWith(".data");
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- 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))
|
|
43
|
+
- Sync protocol validation to rsc flows ([#14882](https://github.com/remix-run/react-router/pull/14882))
|
|
44
|
+
- 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
|
+
|
|
46
|
+
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.
|
|
47
|
+
|
|
48
|
+
If you don't have the flag enabled, then `unstable_url` will match `request.url`.
|
|
49
|
+
|
|
3
50
|
## 7.13.1
|
|
4
51
|
|
|
5
52
|
### Patch Changes
|
|
@@ -12,9 +59,9 @@
|
|
|
12
59
|
|
|
13
60
|
- Fix matchPath optional params matching without a "/" separator. ([#14689](https://github.com/remix-run/react-router/pull/14689))
|
|
14
61
|
- matchPath("/users/:id?", "/usersblah") now returns null.
|
|
15
|
-
- matchPath("/
|
|
62
|
+
- matchPath("/test_route/:part?", "/test_route_more") now returns null.
|
|
16
63
|
|
|
17
|
-
- add RSC
|
|
64
|
+
- add RSC unstable_getRequest ([#14758](https://github.com/remix-run/react-router/pull/14758))
|
|
18
65
|
|
|
19
66
|
- Fix `HydrateFallback` rendering during initial lazy route discovery with matching splat route ([#14740](https://github.com/remix-run/react-router/pull/14740))
|
|
20
67
|
|
|
@@ -60,7 +107,6 @@
|
|
|
60
107
|
```
|
|
61
108
|
|
|
62
109
|
Notes:
|
|
63
|
-
|
|
64
110
|
- The masked location, if present, will be available on `useLocation().unstable_mask` so you can detect whether you are currently masked or not.
|
|
65
111
|
- Masked URLs only work for SPA use cases, and will be removed from `history.state` during SSR.
|
|
66
112
|
- 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).
|
|
@@ -106,25 +152,25 @@
|
|
|
106
152
|
|
|
107
153
|
| URL `/a/b/c` | **HTTP pathname** | **`request` pathname\`** |
|
|
108
154
|
| ------------ | ----------------- | ------------------------ |
|
|
109
|
-
| **Document** | `/a/b/c` | `/a/b/c` ✅
|
|
110
|
-
| **Data** | `/a/b/c.data` | `/a/b/c` ✅
|
|
155
|
+
| **Document** | `/a/b/c` | `/a/b/c` ✅ |
|
|
156
|
+
| **Data** | `/a/b/c.data` | `/a/b/c` ✅ |
|
|
111
157
|
|
|
112
158
|
| URL `/a/b/c/` | **HTTP pathname** | **`request` pathname\`** |
|
|
113
159
|
| ------------- | ----------------- | ------------------------ |
|
|
114
|
-
| **Document** | `/a/b/c/` | `/a/b/c/` ✅
|
|
160
|
+
| **Document** | `/a/b/c/` | `/a/b/c/` ✅ |
|
|
115
161
|
| **Data** | `/a/b/c.data` | `/a/b/c` ⚠️ |
|
|
116
162
|
|
|
117
163
|
With this flag enabled, these pathnames will be made consistent though a new `_.data` format for client-side `.data` requests:
|
|
118
164
|
|
|
119
165
|
| URL `/a/b/c` | **HTTP pathname** | **`request` pathname\`** |
|
|
120
166
|
| ------------ | ----------------- | ------------------------ |
|
|
121
|
-
| **Document** | `/a/b/c` | `/a/b/c` ✅
|
|
122
|
-
| **Data** | `/a/b/c.data` | `/a/b/c` ✅
|
|
167
|
+
| **Document** | `/a/b/c` | `/a/b/c` ✅ |
|
|
168
|
+
| **Data** | `/a/b/c.data` | `/a/b/c` ✅ |
|
|
123
169
|
|
|
124
170
|
| URL `/a/b/c/` | **HTTP pathname** | **`request` pathname\`** |
|
|
125
171
|
| ------------- | ------------------ | ------------------------ |
|
|
126
|
-
| **Document** | `/a/b/c/` | `/a/b/c/` ✅
|
|
127
|
-
| **Data** | `/a/b/c/_.data` ⬅️ | `/a/b/c/` ✅
|
|
172
|
+
| **Document** | `/a/b/c/` | `/a/b/c/` ✅ |
|
|
173
|
+
| **Data** | `/a/b/c/_.data` ⬅️ | `/a/b/c/` ✅ |
|
|
128
174
|
|
|
129
175
|
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.
|
|
130
176
|
|
|
@@ -151,14 +197,12 @@
|
|
|
151
197
|
- \[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))
|
|
152
198
|
|
|
153
199
|
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.
|
|
154
|
-
|
|
155
200
|
- `<Form method="post" unstable_defaultShouldRevalidate={false}>`
|
|
156
201
|
- `submit(data, { method: "post", unstable_defaultShouldRevalidate: false })`
|
|
157
202
|
- `<fetcher.Form method="post" unstable_defaultShouldRevalidate={false}>`
|
|
158
203
|
- `fetcher.submit(data, { method: "post", unstable_defaultShouldRevalidate: false })`
|
|
159
204
|
|
|
160
205
|
This is also available on non-submission APIs that may trigger revalidations due to changing search params:
|
|
161
|
-
|
|
162
206
|
- `<Link to="/" unstable_defaultShouldRevalidate={false}>`
|
|
163
207
|
- `navigate("/?foo=bar", { unstable_defaultShouldRevalidate: false })`
|
|
164
208
|
- `setSearchParams(params, { unstable_defaultShouldRevalidate: false })`
|
|
@@ -181,7 +225,6 @@
|
|
|
181
225
|
- ⚠️ This is a breaking change if you have begun using `fetcher.unstable_reset()`
|
|
182
226
|
|
|
183
227
|
- Stabilize the `dataStrategy` `match.shouldRevalidateArgs`/`match.shouldCallHandler()` APIs. ([#14592](https://github.com/remix-run/react-router/pull/14592))
|
|
184
|
-
|
|
185
228
|
- The `match.shouldLoad` API is now marked deprecated in favor of these more powerful alternatives
|
|
186
229
|
|
|
187
230
|
- If you're using this API in a custom `dataStrategy` today, you can swap to the new API at your convenience:
|
|
@@ -310,7 +353,6 @@
|
|
|
310
353
|
- Ensure action handlers run for routes with middleware even if no loader is present ([#14443](https://github.com/remix-run/react-router/pull/14443))
|
|
311
354
|
|
|
312
355
|
- 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))
|
|
313
|
-
|
|
314
356
|
- Framework Mode:
|
|
315
357
|
- `entry.server.tsx`: `export const unstable_instrumentations = [...]`
|
|
316
358
|
- `entry.client.tsx`: `<HydratedRouter unstable_instrumentations={[...]} />`
|
|
@@ -472,7 +514,6 @@
|
|
|
472
514
|
- Stabilize middleware and context APIs. ([#14215](https://github.com/remix-run/react-router/pull/14215))
|
|
473
515
|
|
|
474
516
|
We have removed the `unstable_` prefix from the following APIs and they are now considered stable and ready for production use:
|
|
475
|
-
|
|
476
517
|
- [`RouterContextProvider`](https://reactrouter.com/api/utils/RouterContextProvider)
|
|
477
518
|
- [`createContext`](https://reactrouter.com/api/utils/createContext)
|
|
478
519
|
- `createBrowserRouter` [`getContext`](https://reactrouter.com/api/data-routers/createBrowserRouter#optsgetcontext) option
|
|
@@ -499,7 +540,7 @@
|
|
|
499
540
|
|
|
500
541
|
- \[UNSTABLE] Add `<RouterProvider unstable_onError>`/`<HydratedRouter unstable_onError>` prop for client side error reporting ([#14162](https://github.com/remix-run/react-router/pull/14162))
|
|
501
542
|
|
|
502
|
-
- server action revalidation opt out via $
|
|
543
|
+
- server action revalidation opt out via $SKIP_REVALIDATION field ([#14154](https://github.com/remix-run/react-router/pull/14154))
|
|
503
544
|
|
|
504
545
|
- Properly escape interpolated param values in `generatePath()` ([#13530](https://github.com/remix-run/react-router/pull/13530))
|
|
505
546
|
|
|
@@ -548,7 +589,6 @@
|
|
|
548
589
|
- Remove dependency on `@types/node` in TypeScript declaration files ([#14059](https://github.com/remix-run/react-router/pull/14059))
|
|
549
590
|
|
|
550
591
|
- Fix types for `UIMatch` to reflect that the `loaderData`/`data` properties may be `undefined` ([#12206](https://github.com/remix-run/react-router/pull/12206))
|
|
551
|
-
|
|
552
592
|
- 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
|
|
553
593
|
- 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
|
|
554
594
|
- ⚠️ 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.
|
|
@@ -582,7 +622,6 @@
|
|
|
582
622
|
- \[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))
|
|
583
623
|
|
|
584
624
|
- \[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))
|
|
585
|
-
|
|
586
625
|
- The API has been renamed to `unstable_generateMiddlewareResponse` for clarity
|
|
587
626
|
- 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
|
|
588
627
|
- The `query` version of the API now has a signature of `(query: (r: Request) => Promise<StaticHandlerContext | Response>) => Promise<Response>`
|
|
@@ -1228,7 +1267,6 @@
|
|
|
1228
1267
|
```
|
|
1229
1268
|
|
|
1230
1269
|
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:
|
|
1231
|
-
|
|
1232
1270
|
- Library mode - `createBrowserRouter(routes, { unstable_getContext })`
|
|
1233
1271
|
- Framework mode - `<HydratedRouter unstable_getContext>`
|
|
1234
1272
|
|
|
@@ -1416,7 +1454,6 @@ _No changes_
|
|
|
1416
1454
|
- Remove `future.v7_normalizeFormMethod` future flag ([#11697](https://github.com/remix-run/react-router/pull/11697))
|
|
1417
1455
|
|
|
1418
1456
|
- 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))
|
|
1419
|
-
|
|
1420
1457
|
- `createCookie`
|
|
1421
1458
|
- `createCookieSessionStorage`
|
|
1422
1459
|
- `createMemorySessionStorage`
|
|
@@ -1425,7 +1462,6 @@ _No changes_
|
|
|
1425
1462
|
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)
|
|
1426
1463
|
|
|
1427
1464
|
Since platform-specific packages no longer need to implement this API, the following low-level APIs have been removed:
|
|
1428
|
-
|
|
1429
1465
|
- `createCookieFactory`
|
|
1430
1466
|
- `createSessionStorageFactory`
|
|
1431
1467
|
- `createCookieSessionStorageFactory`
|
|
@@ -1581,7 +1617,6 @@ _No changes_
|
|
|
1581
1617
|
```
|
|
1582
1618
|
|
|
1583
1619
|
This initial implementation targets type inference for:
|
|
1584
|
-
|
|
1585
1620
|
- `Params` : Path parameters from your routing config in `routes.ts` including file-based routing
|
|
1586
1621
|
- `LoaderData` : Loader data from `loader` and/or `clientLoader` within your route module
|
|
1587
1622
|
- `ActionData` : Action data from `action` and/or `clientAction` within your route module
|
|
@@ -1596,7 +1631,6 @@ _No changes_
|
|
|
1596
1631
|
```
|
|
1597
1632
|
|
|
1598
1633
|
Check out our docs for more:
|
|
1599
|
-
|
|
1600
1634
|
- [_Explanations > Type Safety_](https://reactrouter.com/dev/guides/explanation/type-safety)
|
|
1601
1635
|
- [_How-To > Setting up type safety_](https://reactrouter.com/dev/guides/how-to/setting-up-type-safety)
|
|
1602
1636
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { R as RouterInit } from './instrumentation-BYr6ff5D.js';
|
|
3
|
+
import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './routeModules-CA7kSxJJ.js';
|
|
3
4
|
|
|
4
5
|
declare function getRequest(): Request;
|
|
5
6
|
type RSCRouteConfigEntryBase = {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { R as RouterInit } from './context-phCt_zmH.mjs';
|
|
3
|
+
import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './routeModules-BRrCYrSL.mjs';
|
|
3
4
|
|
|
4
5
|
declare function getRequest(): Request;
|
|
5
6
|
type RSCRouteConfigEntryBase = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }/**
|
|
2
|
-
* react-router v7.13.
|
|
2
|
+
* react-router v7.13.2-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkWO3PXTPVjs = require('./chunk-WO3PXTPV.js');
|
|
18
18
|
|
|
19
19
|
// lib/dom/ssr/hydration.tsx
|
|
20
20
|
function getHydrationData({
|
|
@@ -29,12 +29,12 @@ function getHydrationData({
|
|
|
29
29
|
...state,
|
|
30
30
|
loaderData: { ...state.loaderData }
|
|
31
31
|
};
|
|
32
|
-
let initialMatches =
|
|
32
|
+
let initialMatches = _chunkWO3PXTPVjs.matchRoutes.call(void 0, routes, location, basename);
|
|
33
33
|
if (initialMatches) {
|
|
34
34
|
for (let match of initialMatches) {
|
|
35
35
|
let routeId = match.route.id;
|
|
36
36
|
let routeInfo = getRouteInfo(routeId);
|
|
37
|
-
if (
|
|
37
|
+
if (_chunkWO3PXTPVjs.shouldHydrateRouteLoader.call(void 0,
|
|
38
38
|
routeId,
|
|
39
39
|
routeInfo.clientLoader,
|
|
40
40
|
routeInfo.hasLoader,
|
|
@@ -112,7 +112,7 @@ function RSCDefaultRootErrorBoundaryImpl({
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
);
|
|
115
|
-
if (
|
|
115
|
+
if (_chunkWO3PXTPVjs.isRouteErrorResponse.call(void 0, error)) {
|
|
116
116
|
return /* @__PURE__ */ _react2.default.createElement(
|
|
117
117
|
ErrorWrapper,
|
|
118
118
|
{
|
|
@@ -120,7 +120,7 @@ function RSCDefaultRootErrorBoundaryImpl({
|
|
|
120
120
|
title: "Unhandled Thrown Response!"
|
|
121
121
|
},
|
|
122
122
|
/* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText),
|
|
123
|
-
|
|
123
|
+
_chunkWO3PXTPVjs.ENABLE_DEV_WARNINGS ? heyDeveloper : null
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
126
|
let errorInstance;
|
|
@@ -146,7 +146,7 @@ function RSCDefaultRootErrorBoundaryImpl({
|
|
|
146
146
|
function RSCDefaultRootErrorBoundary({
|
|
147
147
|
hasRootLayout
|
|
148
148
|
}) {
|
|
149
|
-
let error =
|
|
149
|
+
let error = _chunkWO3PXTPVjs.useRouteError.call(void 0, );
|
|
150
150
|
if (hasRootLayout === void 0) {
|
|
151
151
|
throw new Error("Missing 'hasRootLayout' prop");
|
|
152
152
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.13.
|
|
2
|
+
* react-router v7.13.2-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
withComponentProps,
|
|
52
52
|
withErrorBoundaryProps,
|
|
53
53
|
withHydrateFallbackProps
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-WM3TIFYP.mjs";
|
|
55
55
|
|
|
56
56
|
// lib/dom/ssr/server.tsx
|
|
57
57
|
import * as React from "react";
|
|
@@ -137,6 +137,7 @@ function createRoutesStub(routes, _context) {
|
|
|
137
137
|
if (routerRef.current == null) {
|
|
138
138
|
frameworkContextRef.current = {
|
|
139
139
|
future: {
|
|
140
|
+
unstable_passThroughRequests: future?.unstable_passThroughRequests === true,
|
|
140
141
|
unstable_subResourceIntegrity: future?.unstable_subResourceIntegrity === true,
|
|
141
142
|
v8_middleware: future?.v8_middleware === true,
|
|
142
143
|
unstable_trailingSlashAwareDataRequests: future?.unstable_trailingSlashAwareDataRequests === true
|
|
@@ -154,7 +155,7 @@ function createRoutesStub(routes, _context) {
|
|
|
154
155
|
};
|
|
155
156
|
let patched = processRoutes(
|
|
156
157
|
// @ts-expect-error `StubRouteObject` is stricter about `loader`/`action`
|
|
157
|
-
// types compared to `
|
|
158
|
+
// types compared to `RouteObject`
|
|
158
159
|
convertRoutesToDataRoutes(routes, (r) => r),
|
|
159
160
|
_context !== void 0 ? _context : future?.v8_middleware ? new RouterContextProvider() : {},
|
|
160
161
|
frameworkContextRef.current.manifest,
|
|
@@ -505,9 +506,10 @@ function matchServerRoutes(routes, pathname, basename) {
|
|
|
505
506
|
}
|
|
506
507
|
|
|
507
508
|
// lib/server-runtime/data.ts
|
|
508
|
-
async function callRouteHandler(handler, args) {
|
|
509
|
+
async function callRouteHandler(handler, args, future) {
|
|
509
510
|
let result = await handler({
|
|
510
|
-
request: stripRoutesParam(stripIndexParam(args.request)),
|
|
511
|
+
request: future.unstable_passThroughRequests ? args.request : stripRoutesParam(stripIndexParam(args.request)),
|
|
512
|
+
unstable_url: args.unstable_url,
|
|
511
513
|
params: args.params,
|
|
512
514
|
context: args.context,
|
|
513
515
|
unstable_pattern: args.unstable_pattern
|
|
@@ -656,10 +658,14 @@ function createStaticHandlerDataRoutes(manifest, future, parentId = "", routesBy
|
|
|
656
658
|
return result.data;
|
|
657
659
|
}
|
|
658
660
|
}
|
|
659
|
-
let val = await callRouteHandler(
|
|
661
|
+
let val = await callRouteHandler(
|
|
662
|
+
route.module.loader,
|
|
663
|
+
args,
|
|
664
|
+
future
|
|
665
|
+
);
|
|
660
666
|
return val;
|
|
661
667
|
} : void 0,
|
|
662
|
-
action: route.module.action ? (args) => callRouteHandler(route.module.action, args) : void 0,
|
|
668
|
+
action: route.module.action ? (args) => callRouteHandler(route.module.action, args, future) : void 0,
|
|
663
669
|
handle: route.module.handle
|
|
664
670
|
};
|
|
665
671
|
return route.index ? {
|
|
@@ -838,6 +844,41 @@ function parseHostHeader(headers) {
|
|
|
838
844
|
} : void 0;
|
|
839
845
|
}
|
|
840
846
|
|
|
847
|
+
// lib/server-runtime/urls.ts
|
|
848
|
+
function getNormalizedPath(request, basename, future) {
|
|
849
|
+
basename = basename || "/";
|
|
850
|
+
let url = new URL(request.url);
|
|
851
|
+
let pathname = url.pathname;
|
|
852
|
+
if (future?.unstable_trailingSlashAwareDataRequests) {
|
|
853
|
+
if (pathname.endsWith("/_.data")) {
|
|
854
|
+
pathname = pathname.replace(/_\.data$/, "");
|
|
855
|
+
} else {
|
|
856
|
+
pathname = pathname.replace(/\.data$/, "");
|
|
857
|
+
}
|
|
858
|
+
} else {
|
|
859
|
+
if (stripBasename(pathname, basename) === "/_root.data") {
|
|
860
|
+
pathname = basename;
|
|
861
|
+
} else if (pathname.endsWith(".data")) {
|
|
862
|
+
pathname = pathname.replace(/\.data$/, "");
|
|
863
|
+
}
|
|
864
|
+
if (stripBasename(pathname, basename) !== "/" && pathname.endsWith("/")) {
|
|
865
|
+
pathname = pathname.slice(0, -1);
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
let searchParams = new URLSearchParams(url.search);
|
|
869
|
+
searchParams.delete("_routes");
|
|
870
|
+
let search = searchParams.toString();
|
|
871
|
+
if (search) {
|
|
872
|
+
search = `?${search}`;
|
|
873
|
+
}
|
|
874
|
+
return {
|
|
875
|
+
pathname,
|
|
876
|
+
search,
|
|
877
|
+
// No hashes on the server
|
|
878
|
+
hash: ""
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
|
|
841
882
|
// lib/server-runtime/single-fetch.ts
|
|
842
883
|
var SERVER_NO_BODY_STATUS_CODES = /* @__PURE__ */ new Set([
|
|
843
884
|
...NO_BODY_STATUS_CODES,
|
|
@@ -853,7 +894,7 @@ async function singleFetchAction(build, serverMode, staticHandler, request, hand
|
|
|
853
894
|
} catch (e) {
|
|
854
895
|
return handleQueryError(new Error("Bad Request"), 400);
|
|
855
896
|
}
|
|
856
|
-
let handlerRequest = new Request(handlerUrl, {
|
|
897
|
+
let handlerRequest = build.future.unstable_passThroughRequests ? request : new Request(handlerUrl, {
|
|
857
898
|
method: request.method,
|
|
858
899
|
body: request.body,
|
|
859
900
|
headers: request.headers,
|
|
@@ -871,7 +912,8 @@ async function singleFetchAction(build, serverMode, staticHandler, request, hand
|
|
|
871
912
|
} catch (error) {
|
|
872
913
|
return handleQueryError(error);
|
|
873
914
|
}
|
|
874
|
-
} : void 0
|
|
915
|
+
} : void 0,
|
|
916
|
+
unstable_normalizePath: (r) => getNormalizedPath(r, build.basename, build.future)
|
|
875
917
|
});
|
|
876
918
|
return handleQueryResult(result);
|
|
877
919
|
} catch (error) {
|
|
@@ -920,7 +962,7 @@ async function singleFetchLoaders(build, serverMode, staticHandler, request, han
|
|
|
920
962
|
let routesParam = new URL(request.url).searchParams.get("_routes");
|
|
921
963
|
let loadRouteIds = routesParam ? new Set(routesParam.split(",")) : null;
|
|
922
964
|
try {
|
|
923
|
-
let handlerRequest = new Request(handlerUrl, {
|
|
965
|
+
let handlerRequest = build.future.unstable_passThroughRequests ? request : new Request(handlerUrl, {
|
|
924
966
|
headers: request.headers,
|
|
925
967
|
signal: request.signal
|
|
926
968
|
});
|
|
@@ -935,7 +977,8 @@ async function singleFetchLoaders(build, serverMode, staticHandler, request, han
|
|
|
935
977
|
} catch (error) {
|
|
936
978
|
return handleQueryError(error);
|
|
937
979
|
}
|
|
938
|
-
} : void 0
|
|
980
|
+
} : void 0,
|
|
981
|
+
unstable_normalizePath: (r) => getNormalizedPath(r, build.basename, build.future)
|
|
939
982
|
});
|
|
940
983
|
return handleQueryResult(result);
|
|
941
984
|
} catch (error) {
|
|
@@ -1132,36 +1175,23 @@ function derive(build, mode) {
|
|
|
1132
1175
|
} else {
|
|
1133
1176
|
loadContext = initialContext || {};
|
|
1134
1177
|
}
|
|
1135
|
-
let
|
|
1136
|
-
let
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
} else {
|
|
1142
|
-
normalizedPath = normalizedPath.replace(/\.data$/, "");
|
|
1143
|
-
}
|
|
1144
|
-
} else {
|
|
1145
|
-
if (stripBasename(normalizedPath, normalizedBasename) === "/_root.data") {
|
|
1146
|
-
normalizedPath = normalizedBasename;
|
|
1147
|
-
} else if (normalizedPath.endsWith(".data")) {
|
|
1148
|
-
normalizedPath = normalizedPath.replace(/\.data$/, "");
|
|
1149
|
-
}
|
|
1150
|
-
if (stripBasename(normalizedPath, normalizedBasename) !== "/" && normalizedPath.endsWith("/")) {
|
|
1151
|
-
normalizedPath = normalizedPath.slice(0, -1);
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1178
|
+
let requestUrl = new URL(request.url);
|
|
1179
|
+
let normalizedPathname = getNormalizedPath(
|
|
1180
|
+
request,
|
|
1181
|
+
build.basename,
|
|
1182
|
+
build.future
|
|
1183
|
+
).pathname;
|
|
1154
1184
|
let isSpaMode = getBuildTimeHeader(request, "X-React-Router-SPA-Mode") === "yes";
|
|
1155
1185
|
if (!build.ssr) {
|
|
1156
|
-
let decodedPath = decodeURI(
|
|
1157
|
-
if (
|
|
1158
|
-
let strippedPath = stripBasename(decodedPath,
|
|
1186
|
+
let decodedPath = decodeURI(normalizedPathname);
|
|
1187
|
+
if (build.basename && build.basename !== "/") {
|
|
1188
|
+
let strippedPath = stripBasename(decodedPath, build.basename);
|
|
1159
1189
|
if (strippedPath == null) {
|
|
1160
1190
|
errorHandler(
|
|
1161
1191
|
new ErrorResponseImpl(
|
|
1162
1192
|
404,
|
|
1163
1193
|
"Not Found",
|
|
1164
|
-
`Refusing to prerender the \`${decodedPath}\` path because it does not start with the basename \`${
|
|
1194
|
+
`Refusing to prerender the \`${decodedPath}\` path because it does not start with the basename \`${build.basename}\``
|
|
1165
1195
|
),
|
|
1166
1196
|
{
|
|
1167
1197
|
context: loadContext,
|
|
@@ -1179,7 +1209,7 @@ function derive(build, mode) {
|
|
|
1179
1209
|
if (build.prerender.length === 0) {
|
|
1180
1210
|
isSpaMode = true;
|
|
1181
1211
|
} else if (!build.prerender.includes(decodedPath) && !build.prerender.includes(decodedPath + "/")) {
|
|
1182
|
-
if (
|
|
1212
|
+
if (requestUrl.pathname.endsWith(".data")) {
|
|
1183
1213
|
errorHandler(
|
|
1184
1214
|
new ErrorResponseImpl(
|
|
1185
1215
|
404,
|
|
@@ -1203,28 +1233,26 @@ function derive(build, mode) {
|
|
|
1203
1233
|
}
|
|
1204
1234
|
let manifestUrl = getManifestPath(
|
|
1205
1235
|
build.routeDiscovery.manifestPath,
|
|
1206
|
-
|
|
1236
|
+
build.basename
|
|
1207
1237
|
);
|
|
1208
|
-
if (
|
|
1238
|
+
if (requestUrl.pathname === manifestUrl) {
|
|
1209
1239
|
try {
|
|
1210
|
-
let res = await handleManifestRequest(build, routes,
|
|
1240
|
+
let res = await handleManifestRequest(build, routes, requestUrl);
|
|
1211
1241
|
return res;
|
|
1212
1242
|
} catch (e) {
|
|
1213
1243
|
handleError(e);
|
|
1214
1244
|
return new Response("Unknown Server Error", { status: 500 });
|
|
1215
1245
|
}
|
|
1216
1246
|
}
|
|
1217
|
-
let matches = matchServerRoutes(routes,
|
|
1247
|
+
let matches = matchServerRoutes(routes, normalizedPathname, build.basename);
|
|
1218
1248
|
if (matches && matches.length > 0) {
|
|
1219
1249
|
Object.assign(params, matches[0].params);
|
|
1220
1250
|
}
|
|
1221
1251
|
let response;
|
|
1222
|
-
if (
|
|
1223
|
-
let handlerUrl = new URL(request.url);
|
|
1224
|
-
handlerUrl.pathname = normalizedPath;
|
|
1252
|
+
if (requestUrl.pathname.endsWith(".data")) {
|
|
1225
1253
|
let singleFetchMatches = matchServerRoutes(
|
|
1226
1254
|
routes,
|
|
1227
|
-
|
|
1255
|
+
normalizedPathname,
|
|
1228
1256
|
build.basename
|
|
1229
1257
|
);
|
|
1230
1258
|
response = await handleSingleFetchRequest(
|
|
@@ -1232,7 +1260,7 @@ function derive(build, mode) {
|
|
|
1232
1260
|
build,
|
|
1233
1261
|
staticHandler,
|
|
1234
1262
|
request,
|
|
1235
|
-
|
|
1263
|
+
normalizedPathname,
|
|
1236
1264
|
loadContext,
|
|
1237
1265
|
handleError
|
|
1238
1266
|
);
|
|
@@ -1270,7 +1298,7 @@ function derive(build, mode) {
|
|
|
1270
1298
|
handleError
|
|
1271
1299
|
);
|
|
1272
1300
|
} else {
|
|
1273
|
-
let { pathname } =
|
|
1301
|
+
let { pathname } = requestUrl;
|
|
1274
1302
|
let criticalCss = void 0;
|
|
1275
1303
|
if (build.unstable_getCriticalCss) {
|
|
1276
1304
|
criticalCss = await build.unstable_getCriticalCss({ pathname });
|
|
@@ -1383,7 +1411,9 @@ async function handleManifestRequest(build, routes, url) {
|
|
|
1383
1411
|
}
|
|
1384
1412
|
return new Response("Invalid Request", { status: 400 });
|
|
1385
1413
|
}
|
|
1386
|
-
async function handleSingleFetchRequest(serverMode, build, staticHandler, request,
|
|
1414
|
+
async function handleSingleFetchRequest(serverMode, build, staticHandler, request, normalizedPath, loadContext, handleError) {
|
|
1415
|
+
let handlerUrl = new URL(request.url);
|
|
1416
|
+
handlerUrl.pathname = normalizedPath;
|
|
1387
1417
|
let response = request.method !== "GET" ? await singleFetchAction(
|
|
1388
1418
|
build,
|
|
1389
1419
|
serverMode,
|
|
@@ -1429,7 +1459,8 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
|
|
|
1429
1459
|
handleError(error);
|
|
1430
1460
|
return new Response(null, { status: 500 });
|
|
1431
1461
|
}
|
|
1432
|
-
} : void 0
|
|
1462
|
+
} : void 0,
|
|
1463
|
+
unstable_normalizePath: (r) => getNormalizedPath(r, build.basename, build.future)
|
|
1433
1464
|
});
|
|
1434
1465
|
if (!isResponse(result)) {
|
|
1435
1466
|
result = await renderHtml(result, isSpaMode);
|
|
@@ -1561,7 +1592,8 @@ async function handleResourceRequest(serverMode, build, staticHandler, routeId,
|
|
|
1561
1592
|
} catch (error) {
|
|
1562
1593
|
return handleQueryRouteError(error);
|
|
1563
1594
|
}
|
|
1564
|
-
} : void 0
|
|
1595
|
+
} : void 0,
|
|
1596
|
+
unstable_normalizePath: (r) => getNormalizedPath(r, build.basename, build.future)
|
|
1565
1597
|
});
|
|
1566
1598
|
return handleQueryRouteResult(result);
|
|
1567
1599
|
} catch (error) {
|
|
@@ -2388,7 +2420,9 @@ function RSCStaticRouter({ getPayload }) {
|
|
|
2388
2420
|
// flags that drive runtime behavior they'll need to be proxied through.
|
|
2389
2421
|
v8_middleware: false,
|
|
2390
2422
|
unstable_subResourceIntegrity: false,
|
|
2391
|
-
unstable_trailingSlashAwareDataRequests: true
|
|
2423
|
+
unstable_trailingSlashAwareDataRequests: true,
|
|
2424
|
+
// always on for RSC
|
|
2425
|
+
unstable_passThroughRequests: true
|
|
2392
2426
|
// always on for RSC
|
|
2393
2427
|
},
|
|
2394
2428
|
isSpaMode: false,
|