Area restrita - Questionario
This commit is contained in:
+187
-24
@@ -1,5 +1,182 @@
|
||||
# `react-router`
|
||||
|
||||
## v7.17.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- Ship a subset of the official documentation inside the `react-router` package ([#15121](https://github.com/remix-run/react-router/pull/15121))
|
||||
|
||||
- Markdown docs are now available in `node_modules/react-router/docs`, letting AI coding agents and the React Router agent skills read official docs locally
|
||||
- Excludes auto-generated API docs (`api/`), `community/` content, and tutorials (`tutorials/`)
|
||||
|
||||
## v7.16.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- Stabilize `future.unstable_trailingSlashAwareDataRequests` as `future.v8_trailingSlashAwareDataRequests` ([#15098](https://github.com/remix-run/react-router/pull/15098))
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Disable manifest path when lazy route dicovery is disabled ([#15068](https://github.com/remix-run/react-router/pull/15068))
|
||||
|
||||
- Fix browser URL creation to use the configured history window instead of the global window. ([#15066](https://github.com/remix-run/react-router/pull/15066))
|
||||
- Pass the history/router window through to `createBrowserURLImpl` so custom window contexts keep the correct URL origin.
|
||||
|
||||
- Fix `useNavigation()` return type to preserve discriminated union across navigation states ([#15095](https://github.com/remix-run/react-router/pull/15095))
|
||||
|
||||
- Widen `MetaDescriptor` `script:ld+json` type from `LdJsonObject` to `LdJsonObject | LdJsonObject[]` to permit multiple JSON-LD schemas in a single `<script type="application/ld+json">` tag emitted by `<Meta />` ([#15082](https://github.com/remix-run/react-router/pull/15082))
|
||||
|
||||
## v7.15.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Update router to operate on fetcher Maps in an immutable manner to avoid delayed React renders from potentially reading an updated but not yet committed Map. This could result in brief flickers in some fetcher-driven optimistic UI scenarios. ([#15028](https://github.com/remix-run/react-router/pull/15028))
|
||||
- Fix `serverLoader()` returning stale SSR data when a client navigation aborts pending hydration before the hydration `clientLoader` resolves ([#15022](https://github.com/remix-run/react-router/pull/15022))
|
||||
- Fix `RouterProvider` `onError` callback not being called for synchronous initial loader errors in SPA mode ([#15039](https://github.com/remix-run/react-router/pull/15039)) ([#14942](https://github.com/remix-run/react-router/pull/14942))
|
||||
- Memoize `useFetchers` to return a stable identity and only change if fetchers changed ([#15028](https://github.com/remix-run/react-router/pull/15028))
|
||||
- Internal refactor to consolidate mutation request detection through shared utility ([#15033](https://github.com/remix-run/react-router/pull/15033))
|
||||
|
||||
### Unstable Changes
|
||||
|
||||
⚠️ _[Unstable features](https://reactrouter.com/community/api-development-strategy#unstable-flags) are not recommended for production use_
|
||||
|
||||
- Add a new `unstable_useRouterState()` hook that consolidates access to active and pending router states (RFC: #12358) ([#15017](https://github.com/remix-run/react-router/pull/15017))
|
||||
- Data/Framework/RSC only — throws when used without a data router
|
||||
- This should allow you to consolidate usages of the following hooks which will likely be deprecated and removed in a future major version
|
||||
- `useLocation`
|
||||
- `useSearchParams`
|
||||
- `useParams`
|
||||
- `useMatches`
|
||||
- `useNavigationType`
|
||||
- `useNavigation`
|
||||
|
||||
```ts
|
||||
let { active, pending } = unstable_useRouterState();
|
||||
|
||||
// Active is always populated with the current location
|
||||
active.location; // replaces `useLocation()`
|
||||
active.searchParams; // replaces `useSearchParams()[0]`
|
||||
active.params; // replaces `useParams()`
|
||||
active.matches; // replaces `useMatches()`
|
||||
active.type; // replaces `useNavigationType()`
|
||||
|
||||
// Pending is only populated during a navigation
|
||||
pending.location; // replaces `useNavigation().location`
|
||||
pending.searchParams; // equivalent to `new URLSearchParams(useNavigation().search)`
|
||||
pending.params; // Not directly accessible today
|
||||
pending.matches; // Not directly accessible today
|
||||
pending.type; // Not directly accessible today
|
||||
pending.state; // replaces `useNavigation().state`
|
||||
pending.formMethod; // replaces useNavigation().formMethod
|
||||
pending.formAction; // replaces useNavigation().formAction
|
||||
pending.formEncType; // replaces useNavigation().formEncType
|
||||
pending.formData; // replaces useNavigation().formData
|
||||
pending.json; // replaces useNavigation().json
|
||||
pending.text; // replaces useNavigation().text
|
||||
```
|
||||
|
||||
## v7.15.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- Stabilize `unstable_defaultShouldRevalidate` as `defaultShouldRevalidate` on `<Link>`, `<Form>`, `useLinkClickHandler`, `useSubmit`, `fetcher.submit`, and `setSearchParams` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
|
||||
- ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
|
||||
|
||||
- Stabilize the instrumentation APIs. `unstable_instrumentations` is now `instrumentations` and `unstable_pattern` is now `pattern` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
|
||||
- The `unstable_ServerInstrumentation`, `unstable_ClientInstrumentation`, `unstable_InstrumentRequestHandlerFunction`, `unstable_InstrumentRouterFunction`, `unstable_InstrumentRouteFunction`, and `unstable_InstrumentationHandlerResult` types have had their `unstable_` prefixes removed
|
||||
- ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
|
||||
|
||||
- Stabilize `unstable_mask` as `mask` on `<Link>`, `useLinkClickHandler`, and `useNavigate`, and rename the corresponding `Location.unstable_mask` field to `Location.mask` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
|
||||
- ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
|
||||
|
||||
- Stabilize the `unstable_normalizePath` option on `staticHandler.query` and `staticHandler.queryRoute` as `normalizePath` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
|
||||
- ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
|
||||
|
||||
- Stabilize `future.unstable_passThroughRequests` as `future.v8_passThroughRequests` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
|
||||
- ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
|
||||
|
||||
- Remove `unstable_subResourceIntegrity` from the runtime `FutureConfig` type; the flag is now controlled by the top-level `subResourceIntegrity` option in `react-router.config.ts` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
|
||||
- ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
|
||||
|
||||
- Stabilize `unstable_url` as `url` on `loader`, `action`, and `middleware` function args ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
|
||||
- ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
|
||||
|
||||
- Stabilize `unstable_useTransitions` as `useTransitions` on `<BrowserRouter>`, `<HashRouter>`, `<HistoryRouter>`, `<MemoryRouter>`, `<Router>`, `<RouterProvider>`, `<HydratedRouter>`, and `useLinkClickHandler` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
|
||||
- ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Add `nonce` to `<Scripts>` `<link rel="modulepreload">` elements (if provided) ([af5d49b](https://github.com/remix-run/react-router/commit/af5d49b))
|
||||
|
||||
- Fix a bug with `unstable_defaultShouldRevalidate={false}` where parent routes that did not export a `shouldRevalidate` function could be incorrectly included in the single fetch call for new child route data ([#15012](https://github.com/remix-run/react-router/pull/15012))
|
||||
|
||||
- Improve server-side route matching performance by pre-computing flattened/cached route branches ([#14967](https://github.com/remix-run/react-router/pull/14967)) ([af5d49b](https://github.com/remix-run/react-router/commit/af5d49b))
|
||||
- Performance benchmarks showed roughly a 10-15% improvement in server-side request handling performance
|
||||
|
||||
- Mark `mask` as an optional field in `Location` for easier mocking in unit tests ([#14999](https://github.com/remix-run/react-router/pull/14999))
|
||||
|
||||
- Cache flattened/ranked route branches to optimize server-side route matching ([#14967](https://github.com/remix-run/react-router/pull/14967))
|
||||
|
||||
- Improve route matching performance in Framework/Data Mode ([#14971](https://github.com/remix-run/react-router/pull/14971)) ([af5d49b](https://github.com/remix-run/react-router/commit/af5d49b))
|
||||
- Avoiding unnecessary calls to `matchRoutes` in data router scenarios
|
||||
- This includes adding back the optimization that was removed in `7.6.0` ([#13562](https://github.com/remix-run/react-router/pull/13562))
|
||||
- The issues that prompted the revert have been addressed by using the available router `matches` but always updating `match.route` to the latest route in the `manifest`
|
||||
- Leverage pre-computed pre-computing flattened/cached route branches during client side route matching
|
||||
- Performance benchmarks showed roughly a 15-30% improvement in server-side request handling performance
|
||||
|
||||
## v7.14.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Remove the un-documented custom error serialization logic from the internal turbo-stream implementation. React Router only automatically handles serialization of `Error` and it's standard subtypes (`SyntaxError`, `TypeError`, etc.). ([[aabf4a1](https://github.com/remix-run/react-router/commit/aabf4a1))
|
||||
|
||||
- Properly handle parent middleware redirects during `fetcher.load` ([[aabf4a1](https://github.com/remix-run/react-router/commit/aabf4a1))
|
||||
|
||||
- Remove redundant `Omit<RouterProviderProps, "flushSync">` from `react-router/dom` `RouterProvider` ([[aabf4a1](https://github.com/remix-run/react-router/commit/aabf4a1))
|
||||
|
||||
- Improved types for `generatePath`'s `param` arg ([[aabf4a1](https://github.com/remix-run/react-router/commit/aabf4a1))
|
||||
|
||||
Type errors when required params are omitted:
|
||||
|
||||
```ts
|
||||
// Before
|
||||
// Passes type checks, but throws at runtime 💥
|
||||
generatePath(":required", { required: null });
|
||||
|
||||
// After
|
||||
generatePath(":required", { required: null });
|
||||
// ^^^^^^^^ Type 'null' is not assignable to type 'string'.ts(2322)
|
||||
```
|
||||
|
||||
Allow omission of optional params:
|
||||
|
||||
```ts
|
||||
// Before
|
||||
generatePath(":optional?", {});
|
||||
// ^^ Property 'optional' is missing in type '{}' but required in type '{ optional: string | null | undefined; }'.ts(2741)
|
||||
|
||||
// After
|
||||
generatePath(":optional?", {});
|
||||
```
|
||||
|
||||
Allows extra keys:
|
||||
|
||||
```ts
|
||||
// Before
|
||||
generatePath(":a", { a: "1", b: "2" });
|
||||
// ^ Object literal may only specify known properties, and 'b' does not exist in type '{ a: string; }'.ts(2353)
|
||||
|
||||
// After
|
||||
generatePath(":a", { a: "1", b: "2" });
|
||||
```
|
||||
|
||||
## v7.14.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Fix a potential race condition that can occur when rendering a `HydrateFallback` and initial loaders land before the `router.subscribe` call happens in the `RouterProvider` layout effect
|
||||
- Normalize double-slashes in redirect paths
|
||||
|
||||
## 7.14.0
|
||||
|
||||
### Patch Changes
|
||||
@@ -82,7 +259,6 @@
|
||||
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).
|
||||
|
||||
Enabling this flag removes that normalization and passes the raw HTTP `request` instance to your handlers. This provides a few benefits:
|
||||
|
||||
- Reduces server-side overhead by eliminating multiple `new Request()` calls on the critical path
|
||||
- Allows you to distinguish document from data requests in your handlers base don the presence of a `.data` suffix (useful for observability purposes)
|
||||
|
||||
@@ -132,9 +308,9 @@
|
||||
|
||||
- Fix matchPath optional params matching without a "/" separator. ([#14689](https://github.com/remix-run/react-router/pull/14689))
|
||||
- matchPath("/users/:id?", "/usersblah") now returns null.
|
||||
- matchPath("/test\_route/:part?", "/test\_route\_more") now returns null.
|
||||
- matchPath("/test_route/:part?", "/test_route_more") now returns null.
|
||||
|
||||
- add RSC unstable\_getRequest ([#14758](https://github.com/remix-run/react-router/pull/14758))
|
||||
- add RSC unstable_getRequest ([#14758](https://github.com/remix-run/react-router/pull/14758))
|
||||
|
||||
- Fix `HydrateFallback` rendering during initial lazy route discovery with matching splat route ([#14740](https://github.com/remix-run/react-router/pull/14740))
|
||||
|
||||
@@ -180,7 +356,6 @@
|
||||
```
|
||||
|
||||
Notes:
|
||||
|
||||
- The masked location, if present, will be available on `useLocation().unstable_mask` so you can detect whether you are currently masked or not.
|
||||
- Masked URLs only work for SPA use cases, and will be removed from `history.state` during SSR.
|
||||
- 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).
|
||||
@@ -226,25 +401,25 @@
|
||||
|
||||
| URL `/a/b/c` | **HTTP pathname** | **`request` pathname\`** |
|
||||
| ------------ | ----------------- | ------------------------ |
|
||||
| **Document** | `/a/b/c` | `/a/b/c` ✅ |
|
||||
| **Data** | `/a/b/c.data` | `/a/b/c` ✅ |
|
||||
| **Document** | `/a/b/c` | `/a/b/c` ✅ |
|
||||
| **Data** | `/a/b/c.data` | `/a/b/c` ✅ |
|
||||
|
||||
| URL `/a/b/c/` | **HTTP pathname** | **`request` pathname\`** |
|
||||
| ------------- | ----------------- | ------------------------ |
|
||||
| **Document** | `/a/b/c/` | `/a/b/c/` ✅ |
|
||||
| **Document** | `/a/b/c/` | `/a/b/c/` ✅ |
|
||||
| **Data** | `/a/b/c.data` | `/a/b/c` ⚠️ |
|
||||
|
||||
With this flag enabled, these pathnames will be made consistent though a new `_.data` format for client-side `.data` requests:
|
||||
|
||||
| URL `/a/b/c` | **HTTP pathname** | **`request` pathname\`** |
|
||||
| ------------ | ----------------- | ------------------------ |
|
||||
| **Document** | `/a/b/c` | `/a/b/c` ✅ |
|
||||
| **Data** | `/a/b/c.data` | `/a/b/c` ✅ |
|
||||
| **Document** | `/a/b/c` | `/a/b/c` ✅ |
|
||||
| **Data** | `/a/b/c.data` | `/a/b/c` ✅ |
|
||||
|
||||
| URL `/a/b/c/` | **HTTP pathname** | **`request` pathname\`** |
|
||||
| ------------- | ------------------ | ------------------------ |
|
||||
| **Document** | `/a/b/c/` | `/a/b/c/` ✅ |
|
||||
| **Data** | `/a/b/c/_.data` ⬅️ | `/a/b/c/` ✅ |
|
||||
| **Document** | `/a/b/c/` | `/a/b/c/` ✅ |
|
||||
| **Data** | `/a/b/c/_.data` ⬅️ | `/a/b/c/` ✅ |
|
||||
|
||||
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.
|
||||
|
||||
@@ -271,14 +446,12 @@
|
||||
- \[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))
|
||||
|
||||
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.
|
||||
|
||||
- `<Form method="post" unstable_defaultShouldRevalidate={false}>`
|
||||
- `submit(data, { method: "post", unstable_defaultShouldRevalidate: false })`
|
||||
- `<fetcher.Form method="post" unstable_defaultShouldRevalidate={false}>`
|
||||
- `fetcher.submit(data, { method: "post", unstable_defaultShouldRevalidate: false })`
|
||||
|
||||
This is also available on non-submission APIs that may trigger revalidations due to changing search params:
|
||||
|
||||
- `<Link to="/" unstable_defaultShouldRevalidate={false}>`
|
||||
- `navigate("/?foo=bar", { unstable_defaultShouldRevalidate: false })`
|
||||
- `setSearchParams(params, { unstable_defaultShouldRevalidate: false })`
|
||||
@@ -301,7 +474,6 @@
|
||||
- ⚠️ This is a breaking change if you have begun using `fetcher.unstable_reset()`
|
||||
|
||||
- Stabilize the `dataStrategy` `match.shouldRevalidateArgs`/`match.shouldCallHandler()` APIs. ([#14592](https://github.com/remix-run/react-router/pull/14592))
|
||||
|
||||
- The `match.shouldLoad` API is now marked deprecated in favor of these more powerful alternatives
|
||||
|
||||
- If you're using this API in a custom `dataStrategy` today, you can swap to the new API at your convenience:
|
||||
@@ -430,7 +602,6 @@
|
||||
- Ensure action handlers run for routes with middleware even if no loader is present ([#14443](https://github.com/remix-run/react-router/pull/14443))
|
||||
|
||||
- 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))
|
||||
|
||||
- Framework Mode:
|
||||
- `entry.server.tsx`: `export const unstable_instrumentations = [...]`
|
||||
- `entry.client.tsx`: `<HydratedRouter unstable_instrumentations={[...]} />`
|
||||
@@ -592,7 +763,6 @@
|
||||
- Stabilize middleware and context APIs. ([#14215](https://github.com/remix-run/react-router/pull/14215))
|
||||
|
||||
We have removed the `unstable_` prefix from the following APIs and they are now considered stable and ready for production use:
|
||||
|
||||
- [`RouterContextProvider`](https://reactrouter.com/api/utils/RouterContextProvider)
|
||||
- [`createContext`](https://reactrouter.com/api/utils/createContext)
|
||||
- `createBrowserRouter` [`getContext`](https://reactrouter.com/api/data-routers/createBrowserRouter#optsgetcontext) option
|
||||
@@ -619,7 +789,7 @@
|
||||
|
||||
- \[UNSTABLE] Add `<RouterProvider unstable_onError>`/`<HydratedRouter unstable_onError>` prop for client side error reporting ([#14162](https://github.com/remix-run/react-router/pull/14162))
|
||||
|
||||
- server action revalidation opt out via $SKIP\_REVALIDATION field ([#14154](https://github.com/remix-run/react-router/pull/14154))
|
||||
- server action revalidation opt out via $SKIP_REVALIDATION field ([#14154](https://github.com/remix-run/react-router/pull/14154))
|
||||
|
||||
- Properly escape interpolated param values in `generatePath()` ([#13530](https://github.com/remix-run/react-router/pull/13530))
|
||||
|
||||
@@ -668,7 +838,6 @@
|
||||
- Remove dependency on `@types/node` in TypeScript declaration files ([#14059](https://github.com/remix-run/react-router/pull/14059))
|
||||
|
||||
- Fix types for `UIMatch` to reflect that the `loaderData`/`data` properties may be `undefined` ([#12206](https://github.com/remix-run/react-router/pull/12206))
|
||||
|
||||
- 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
|
||||
- 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
|
||||
- ⚠️ 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.
|
||||
@@ -702,7 +871,6 @@
|
||||
- \[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))
|
||||
|
||||
- \[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))
|
||||
|
||||
- The API has been renamed to `unstable_generateMiddlewareResponse` for clarity
|
||||
- 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
|
||||
- The `query` version of the API now has a signature of `(query: (r: Request) => Promise<StaticHandlerContext | Response>) => Promise<Response>`
|
||||
@@ -1348,7 +1516,6 @@
|
||||
```
|
||||
|
||||
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:
|
||||
|
||||
- Library mode - `createBrowserRouter(routes, { unstable_getContext })`
|
||||
- Framework mode - `<HydratedRouter unstable_getContext>`
|
||||
|
||||
@@ -1536,7 +1703,6 @@ _No changes_
|
||||
- Remove `future.v7_normalizeFormMethod` future flag ([#11697](https://github.com/remix-run/react-router/pull/11697))
|
||||
|
||||
- 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))
|
||||
|
||||
- `createCookie`
|
||||
- `createCookieSessionStorage`
|
||||
- `createMemorySessionStorage`
|
||||
@@ -1545,7 +1711,6 @@ _No changes_
|
||||
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)
|
||||
|
||||
Since platform-specific packages no longer need to implement this API, the following low-level APIs have been removed:
|
||||
|
||||
- `createCookieFactory`
|
||||
- `createSessionStorageFactory`
|
||||
- `createCookieSessionStorageFactory`
|
||||
@@ -1701,7 +1866,6 @@ _No changes_
|
||||
```
|
||||
|
||||
This initial implementation targets type inference for:
|
||||
|
||||
- `Params` : Path parameters from your routing config in `routes.ts` including file-based routing
|
||||
- `LoaderData` : Loader data from `loader` and/or `clientLoader` within your route module
|
||||
- `ActionData` : Action data from `action` and/or `clientAction` within your route module
|
||||
@@ -1716,7 +1880,6 @@ _No changes_
|
||||
```
|
||||
|
||||
Check out our docs for more:
|
||||
|
||||
- [_Explanations > Type Safety_](https://reactrouter.com/dev/guides/explanation/type-safety)
|
||||
- [_How-To > Setting up type safety_](https://reactrouter.com/dev/guides/how-to/setting-up-type-safety)
|
||||
|
||||
|
||||
-318
@@ -1,318 +0,0 @@
|
||||
import * as React from 'react';
|
||||
import { R as RouterInit } from './instrumentation-BYr6ff5D.js';
|
||||
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';
|
||||
|
||||
declare function getRequest(): Request;
|
||||
type RSCRouteConfigEntryBase = {
|
||||
action?: ActionFunction;
|
||||
clientAction?: ClientActionFunction;
|
||||
clientLoader?: ClientLoaderFunction;
|
||||
ErrorBoundary?: React.ComponentType<any>;
|
||||
handle?: any;
|
||||
headers?: HeadersFunction;
|
||||
HydrateFallback?: React.ComponentType<any>;
|
||||
Layout?: React.ComponentType<any>;
|
||||
links?: LinksFunction;
|
||||
loader?: LoaderFunction;
|
||||
meta?: MetaFunction;
|
||||
shouldRevalidate?: ShouldRevalidateFunction;
|
||||
};
|
||||
type RSCRouteConfigEntry = RSCRouteConfigEntryBase & {
|
||||
id: string;
|
||||
path?: string;
|
||||
Component?: React.ComponentType<any>;
|
||||
lazy?: () => Promise<RSCRouteConfigEntryBase & ({
|
||||
default?: React.ComponentType<any>;
|
||||
Component?: never;
|
||||
} | {
|
||||
default?: never;
|
||||
Component?: React.ComponentType<any>;
|
||||
})>;
|
||||
} & ({
|
||||
index: true;
|
||||
} | {
|
||||
children?: RSCRouteConfigEntry[];
|
||||
});
|
||||
type RSCRouteConfig = Array<RSCRouteConfigEntry>;
|
||||
type RSCRouteManifest = {
|
||||
clientAction?: ClientActionFunction;
|
||||
clientLoader?: ClientLoaderFunction;
|
||||
element?: React.ReactElement | false;
|
||||
errorElement?: React.ReactElement;
|
||||
handle?: any;
|
||||
hasAction: boolean;
|
||||
hasComponent: boolean;
|
||||
hasErrorBoundary: boolean;
|
||||
hasLoader: boolean;
|
||||
hydrateFallbackElement?: React.ReactElement;
|
||||
id: string;
|
||||
index?: boolean;
|
||||
links?: LinksFunction;
|
||||
meta?: MetaFunction;
|
||||
parentId?: string;
|
||||
path?: string;
|
||||
shouldRevalidate?: ShouldRevalidateFunction;
|
||||
};
|
||||
type RSCRouteMatch = RSCRouteManifest & {
|
||||
params: Params;
|
||||
pathname: string;
|
||||
pathnameBase: string;
|
||||
};
|
||||
type RSCRenderPayload = {
|
||||
type: "render";
|
||||
actionData: Record<string, any> | null;
|
||||
basename: string | undefined;
|
||||
errors: Record<string, any> | null;
|
||||
loaderData: Record<string, any>;
|
||||
location: Location;
|
||||
routeDiscovery: RouteDiscovery;
|
||||
matches: RSCRouteMatch[];
|
||||
patches?: Promise<RSCRouteManifest[]>;
|
||||
nonce?: string;
|
||||
formState?: unknown;
|
||||
};
|
||||
type RSCManifestPayload = {
|
||||
type: "manifest";
|
||||
patches: Promise<RSCRouteManifest[]>;
|
||||
};
|
||||
type RSCActionPayload = {
|
||||
type: "action";
|
||||
actionResult: Promise<unknown>;
|
||||
rerender?: Promise<RSCRenderPayload | RSCRedirectPayload>;
|
||||
};
|
||||
type RSCRedirectPayload = {
|
||||
type: "redirect";
|
||||
status: number;
|
||||
location: string;
|
||||
replace: boolean;
|
||||
reload: boolean;
|
||||
actionResult?: Promise<unknown>;
|
||||
};
|
||||
type RSCPayload = RSCRenderPayload | RSCManifestPayload | RSCActionPayload | RSCRedirectPayload;
|
||||
type RSCMatch = {
|
||||
statusCode: number;
|
||||
headers: Headers;
|
||||
payload: RSCPayload;
|
||||
};
|
||||
type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>;
|
||||
type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
|
||||
type DecodeReplyFunction = (reply: FormData | string, options: {
|
||||
temporaryReferences: unknown;
|
||||
}) => Promise<unknown[]>;
|
||||
type LoadServerActionFunction = (id: string) => Promise<Function>;
|
||||
type RouteDiscovery = {
|
||||
mode: "lazy";
|
||||
manifestPath?: string | undefined;
|
||||
} | {
|
||||
mode: "initial";
|
||||
};
|
||||
/**
|
||||
* Matches the given routes to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
||||
* and returns an [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
||||
* encoding an {@link unstable_RSCPayload} for consumption by an [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* enabled client router.
|
||||
*
|
||||
* @example
|
||||
* import {
|
||||
* createTemporaryReferenceSet,
|
||||
* decodeAction,
|
||||
* decodeReply,
|
||||
* loadServerAction,
|
||||
* renderToReadableStream,
|
||||
* } from "@vitejs/plugin-rsc/rsc";
|
||||
* import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router";
|
||||
*
|
||||
* matchRSCServerRequest({
|
||||
* createTemporaryReferenceSet,
|
||||
* decodeAction,
|
||||
* decodeFormState,
|
||||
* decodeReply,
|
||||
* loadServerAction,
|
||||
* request,
|
||||
* routes: routes(),
|
||||
* generateResponse(match) {
|
||||
* return new Response(
|
||||
* renderToReadableStream(match.payload),
|
||||
* {
|
||||
* status: match.statusCode,
|
||||
* headers: match.headers,
|
||||
* }
|
||||
* );
|
||||
* },
|
||||
* });
|
||||
*
|
||||
* @name unstable_matchRSCServerRequest
|
||||
* @public
|
||||
* @category RSC
|
||||
* @mode data
|
||||
* @param opts Options
|
||||
* @param opts.allowedActionOrigins Origin patterns that are allowed to execute actions.
|
||||
* @param opts.basename The basename to use when matching the request.
|
||||
* @param opts.createTemporaryReferenceSet A function that returns a temporary
|
||||
* reference set for the request, used to track temporary references in the [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* stream.
|
||||
* @param opts.decodeAction Your `react-server-dom-xyz/server`'s `decodeAction`
|
||||
* function, responsible for loading a server action.
|
||||
* @param opts.decodeFormState A function responsible for decoding form state for
|
||||
* progressively enhanceable forms with React's [`useActionState`](https://react.dev/reference/react/useActionState)
|
||||
* using your `react-server-dom-xyz/server`'s `decodeFormState`.
|
||||
* @param opts.decodeReply Your `react-server-dom-xyz/server`'s `decodeReply`
|
||||
* function, used to decode the server function's arguments and bind them to the
|
||||
* implementation for invocation by the router.
|
||||
* @param opts.generateResponse A function responsible for using your
|
||||
* `renderToReadableStream` to generate a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
||||
* encoding the {@link unstable_RSCPayload}.
|
||||
* @param opts.loadServerAction Your `react-server-dom-xyz/server`'s
|
||||
* `loadServerAction` function, used to load a server action by ID.
|
||||
* @param opts.onError An optional error handler that will be called with any
|
||||
* errors that occur during the request processing.
|
||||
* @param opts.request The [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
||||
* to match against.
|
||||
* @param opts.requestContext An instance of {@link RouterContextProvider}
|
||||
* that should be created per request, to be passed to [`action`](../../start/data/route-object#action)s,
|
||||
* [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
|
||||
* @param opts.routeDiscovery The route discovery configuration, used to determine how the router should discover new routes during navigations.
|
||||
* @param opts.routes Your {@link unstable_RSCRouteConfigEntry | route definitions}.
|
||||
* @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
||||
* that contains the [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* data for hydration.
|
||||
*/
|
||||
declare function matchRSCServerRequest({ allowedActionOrigins, createTemporaryReferenceSet, basename, decodeReply, requestContext, routeDiscovery, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
|
||||
allowedActionOrigins?: string[];
|
||||
createTemporaryReferenceSet: () => unknown;
|
||||
basename?: string;
|
||||
decodeReply?: DecodeReplyFunction;
|
||||
decodeAction?: DecodeActionFunction;
|
||||
decodeFormState?: DecodeFormStateFunction;
|
||||
requestContext?: RouterContextProvider;
|
||||
loadServerAction?: LoadServerActionFunction;
|
||||
onError?: (error: unknown) => void;
|
||||
request: Request;
|
||||
routes: RSCRouteConfigEntry[];
|
||||
routeDiscovery?: RouteDiscovery;
|
||||
generateResponse: (match: RSCMatch, { onError, temporaryReferences, }: {
|
||||
onError(error: unknown): string | undefined;
|
||||
temporaryReferences: unknown;
|
||||
}) => Response;
|
||||
}): Promise<Response>;
|
||||
|
||||
type BrowserCreateFromReadableStreamFunction = (body: ReadableStream<Uint8Array>, { temporaryReferences, }: {
|
||||
temporaryReferences: unknown;
|
||||
}) => Promise<unknown>;
|
||||
type EncodeReplyFunction = (args: unknown[], options: {
|
||||
temporaryReferences: unknown;
|
||||
}) => Promise<BodyInit>;
|
||||
/**
|
||||
* Create a React `callServer` implementation for React Router.
|
||||
*
|
||||
* @example
|
||||
* import {
|
||||
* createFromReadableStream,
|
||||
* createTemporaryReferenceSet,
|
||||
* encodeReply,
|
||||
* setServerCallback,
|
||||
* } from "@vitejs/plugin-rsc/browser";
|
||||
* import { unstable_createCallServer as createCallServer } from "react-router";
|
||||
*
|
||||
* setServerCallback(
|
||||
* createCallServer({
|
||||
* createFromReadableStream,
|
||||
* createTemporaryReferenceSet,
|
||||
* encodeReply,
|
||||
* })
|
||||
* );
|
||||
*
|
||||
* @name unstable_createCallServer
|
||||
* @public
|
||||
* @category RSC
|
||||
* @mode data
|
||||
* @param opts Options
|
||||
* @param opts.createFromReadableStream Your `react-server-dom-xyz/client`'s
|
||||
* `createFromReadableStream`. Used to decode payloads from the server.
|
||||
* @param opts.createTemporaryReferenceSet A function that creates a temporary
|
||||
* reference set for the [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* payload.
|
||||
* @param opts.encodeReply Your `react-server-dom-xyz/client`'s `encodeReply`.
|
||||
* Used when sending payloads to the server.
|
||||
* @param opts.fetch Optional [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
|
||||
* implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch).
|
||||
* @returns A function that can be used to call server actions.
|
||||
*/
|
||||
declare function createCallServer({ createFromReadableStream, createTemporaryReferenceSet, encodeReply, fetch: fetchImplementation, }: {
|
||||
createFromReadableStream: BrowserCreateFromReadableStreamFunction;
|
||||
createTemporaryReferenceSet: () => unknown;
|
||||
encodeReply: EncodeReplyFunction;
|
||||
fetch?: (request: Request) => Promise<Response>;
|
||||
}): (id: string, args: unknown[]) => Promise<unknown>;
|
||||
/**
|
||||
* Props for the {@link unstable_RSCHydratedRouter} component.
|
||||
*
|
||||
* @name unstable_RSCHydratedRouterProps
|
||||
* @category Types
|
||||
*/
|
||||
interface RSCHydratedRouterProps {
|
||||
/**
|
||||
* Your `react-server-dom-xyz/client`'s `createFromReadableStream` function,
|
||||
* used to decode payloads from the server.
|
||||
*/
|
||||
createFromReadableStream: BrowserCreateFromReadableStreamFunction;
|
||||
/**
|
||||
* Optional fetch implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch).
|
||||
*/
|
||||
fetch?: (request: Request) => Promise<Response>;
|
||||
/**
|
||||
* The decoded {@link unstable_RSCPayload} to hydrate.
|
||||
*/
|
||||
payload: RSCPayload;
|
||||
/**
|
||||
* A function that returns an {@link RouterContextProvider} instance
|
||||
* which is provided as the `context` argument to client [`action`](../../start/data/route-object#action)s,
|
||||
* [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
|
||||
* This function is called to generate a fresh `context` instance on each
|
||||
* navigation or fetcher call.
|
||||
*/
|
||||
getContext?: RouterInit["getContext"];
|
||||
}
|
||||
/**
|
||||
* Hydrates a server rendered {@link unstable_RSCPayload} in the browser.
|
||||
*
|
||||
* @example
|
||||
* import { startTransition, StrictMode } from "react";
|
||||
* import { hydrateRoot } from "react-dom/client";
|
||||
* import {
|
||||
* unstable_getRSCStream as getRSCStream,
|
||||
* unstable_RSCHydratedRouter as RSCHydratedRouter,
|
||||
* } from "react-router";
|
||||
* import type { unstable_RSCPayload as RSCPayload } from "react-router";
|
||||
*
|
||||
* createFromReadableStream(getRSCStream()).then((payload) =>
|
||||
* startTransition(async () => {
|
||||
* hydrateRoot(
|
||||
* document,
|
||||
* <StrictMode>
|
||||
* <RSCHydratedRouter
|
||||
* createFromReadableStream={createFromReadableStream}
|
||||
* payload={payload}
|
||||
* />
|
||||
* </StrictMode>,
|
||||
* { formState: await getFormState(payload) },
|
||||
* );
|
||||
* }),
|
||||
* );
|
||||
*
|
||||
* @name unstable_RSCHydratedRouter
|
||||
* @public
|
||||
* @category RSC
|
||||
* @mode data
|
||||
* @param props Props
|
||||
* @param {unstable_RSCHydratedRouterProps.createFromReadableStream} props.createFromReadableStream n/a
|
||||
* @param {unstable_RSCHydratedRouterProps.fetch} props.fetch n/a
|
||||
* @param {unstable_RSCHydratedRouterProps.getContext} props.getContext n/a
|
||||
* @param {unstable_RSCHydratedRouterProps.payload} props.payload n/a
|
||||
* @returns A hydrated {@link DataRouter} that can be used to navigate and
|
||||
* render routes.
|
||||
*/
|
||||
declare function RSCHydratedRouter({ createFromReadableStream, fetch: fetchImplementation, payload, getContext, }: RSCHydratedRouterProps): React.JSX.Element;
|
||||
|
||||
export { type BrowserCreateFromReadableStreamFunction as B, type DecodeActionFunction as D, type EncodeReplyFunction as E, type LoadServerActionFunction as L, RSCHydratedRouter as R, type DecodeFormStateFunction as a, type DecodeReplyFunction as b, createCallServer as c, type RSCManifestPayload as d, type RSCPayload as e, type RSCRenderPayload as f, getRequest as g, type RSCHydratedRouterProps as h, type RSCMatch as i, type RSCRouteManifest as j, type RSCRouteMatch as k, type RSCRouteConfigEntry as l, matchRSCServerRequest as m, type RSCRouteConfig as n };
|
||||
-318
@@ -1,318 +0,0 @@
|
||||
import * as React from 'react';
|
||||
import { R as RouterInit } from './context-phCt_zmH.mjs';
|
||||
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';
|
||||
|
||||
declare function getRequest(): Request;
|
||||
type RSCRouteConfigEntryBase = {
|
||||
action?: ActionFunction;
|
||||
clientAction?: ClientActionFunction;
|
||||
clientLoader?: ClientLoaderFunction;
|
||||
ErrorBoundary?: React.ComponentType<any>;
|
||||
handle?: any;
|
||||
headers?: HeadersFunction;
|
||||
HydrateFallback?: React.ComponentType<any>;
|
||||
Layout?: React.ComponentType<any>;
|
||||
links?: LinksFunction;
|
||||
loader?: LoaderFunction;
|
||||
meta?: MetaFunction;
|
||||
shouldRevalidate?: ShouldRevalidateFunction;
|
||||
};
|
||||
type RSCRouteConfigEntry = RSCRouteConfigEntryBase & {
|
||||
id: string;
|
||||
path?: string;
|
||||
Component?: React.ComponentType<any>;
|
||||
lazy?: () => Promise<RSCRouteConfigEntryBase & ({
|
||||
default?: React.ComponentType<any>;
|
||||
Component?: never;
|
||||
} | {
|
||||
default?: never;
|
||||
Component?: React.ComponentType<any>;
|
||||
})>;
|
||||
} & ({
|
||||
index: true;
|
||||
} | {
|
||||
children?: RSCRouteConfigEntry[];
|
||||
});
|
||||
type RSCRouteConfig = Array<RSCRouteConfigEntry>;
|
||||
type RSCRouteManifest = {
|
||||
clientAction?: ClientActionFunction;
|
||||
clientLoader?: ClientLoaderFunction;
|
||||
element?: React.ReactElement | false;
|
||||
errorElement?: React.ReactElement;
|
||||
handle?: any;
|
||||
hasAction: boolean;
|
||||
hasComponent: boolean;
|
||||
hasErrorBoundary: boolean;
|
||||
hasLoader: boolean;
|
||||
hydrateFallbackElement?: React.ReactElement;
|
||||
id: string;
|
||||
index?: boolean;
|
||||
links?: LinksFunction;
|
||||
meta?: MetaFunction;
|
||||
parentId?: string;
|
||||
path?: string;
|
||||
shouldRevalidate?: ShouldRevalidateFunction;
|
||||
};
|
||||
type RSCRouteMatch = RSCRouteManifest & {
|
||||
params: Params;
|
||||
pathname: string;
|
||||
pathnameBase: string;
|
||||
};
|
||||
type RSCRenderPayload = {
|
||||
type: "render";
|
||||
actionData: Record<string, any> | null;
|
||||
basename: string | undefined;
|
||||
errors: Record<string, any> | null;
|
||||
loaderData: Record<string, any>;
|
||||
location: Location;
|
||||
routeDiscovery: RouteDiscovery;
|
||||
matches: RSCRouteMatch[];
|
||||
patches?: Promise<RSCRouteManifest[]>;
|
||||
nonce?: string;
|
||||
formState?: unknown;
|
||||
};
|
||||
type RSCManifestPayload = {
|
||||
type: "manifest";
|
||||
patches: Promise<RSCRouteManifest[]>;
|
||||
};
|
||||
type RSCActionPayload = {
|
||||
type: "action";
|
||||
actionResult: Promise<unknown>;
|
||||
rerender?: Promise<RSCRenderPayload | RSCRedirectPayload>;
|
||||
};
|
||||
type RSCRedirectPayload = {
|
||||
type: "redirect";
|
||||
status: number;
|
||||
location: string;
|
||||
replace: boolean;
|
||||
reload: boolean;
|
||||
actionResult?: Promise<unknown>;
|
||||
};
|
||||
type RSCPayload = RSCRenderPayload | RSCManifestPayload | RSCActionPayload | RSCRedirectPayload;
|
||||
type RSCMatch = {
|
||||
statusCode: number;
|
||||
headers: Headers;
|
||||
payload: RSCPayload;
|
||||
};
|
||||
type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>;
|
||||
type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
|
||||
type DecodeReplyFunction = (reply: FormData | string, options: {
|
||||
temporaryReferences: unknown;
|
||||
}) => Promise<unknown[]>;
|
||||
type LoadServerActionFunction = (id: string) => Promise<Function>;
|
||||
type RouteDiscovery = {
|
||||
mode: "lazy";
|
||||
manifestPath?: string | undefined;
|
||||
} | {
|
||||
mode: "initial";
|
||||
};
|
||||
/**
|
||||
* Matches the given routes to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
||||
* and returns an [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
||||
* encoding an {@link unstable_RSCPayload} for consumption by an [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* enabled client router.
|
||||
*
|
||||
* @example
|
||||
* import {
|
||||
* createTemporaryReferenceSet,
|
||||
* decodeAction,
|
||||
* decodeReply,
|
||||
* loadServerAction,
|
||||
* renderToReadableStream,
|
||||
* } from "@vitejs/plugin-rsc/rsc";
|
||||
* import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router";
|
||||
*
|
||||
* matchRSCServerRequest({
|
||||
* createTemporaryReferenceSet,
|
||||
* decodeAction,
|
||||
* decodeFormState,
|
||||
* decodeReply,
|
||||
* loadServerAction,
|
||||
* request,
|
||||
* routes: routes(),
|
||||
* generateResponse(match) {
|
||||
* return new Response(
|
||||
* renderToReadableStream(match.payload),
|
||||
* {
|
||||
* status: match.statusCode,
|
||||
* headers: match.headers,
|
||||
* }
|
||||
* );
|
||||
* },
|
||||
* });
|
||||
*
|
||||
* @name unstable_matchRSCServerRequest
|
||||
* @public
|
||||
* @category RSC
|
||||
* @mode data
|
||||
* @param opts Options
|
||||
* @param opts.allowedActionOrigins Origin patterns that are allowed to execute actions.
|
||||
* @param opts.basename The basename to use when matching the request.
|
||||
* @param opts.createTemporaryReferenceSet A function that returns a temporary
|
||||
* reference set for the request, used to track temporary references in the [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* stream.
|
||||
* @param opts.decodeAction Your `react-server-dom-xyz/server`'s `decodeAction`
|
||||
* function, responsible for loading a server action.
|
||||
* @param opts.decodeFormState A function responsible for decoding form state for
|
||||
* progressively enhanceable forms with React's [`useActionState`](https://react.dev/reference/react/useActionState)
|
||||
* using your `react-server-dom-xyz/server`'s `decodeFormState`.
|
||||
* @param opts.decodeReply Your `react-server-dom-xyz/server`'s `decodeReply`
|
||||
* function, used to decode the server function's arguments and bind them to the
|
||||
* implementation for invocation by the router.
|
||||
* @param opts.generateResponse A function responsible for using your
|
||||
* `renderToReadableStream` to generate a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
||||
* encoding the {@link unstable_RSCPayload}.
|
||||
* @param opts.loadServerAction Your `react-server-dom-xyz/server`'s
|
||||
* `loadServerAction` function, used to load a server action by ID.
|
||||
* @param opts.onError An optional error handler that will be called with any
|
||||
* errors that occur during the request processing.
|
||||
* @param opts.request The [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
||||
* to match against.
|
||||
* @param opts.requestContext An instance of {@link RouterContextProvider}
|
||||
* that should be created per request, to be passed to [`action`](../../start/data/route-object#action)s,
|
||||
* [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
|
||||
* @param opts.routeDiscovery The route discovery configuration, used to determine how the router should discover new routes during navigations.
|
||||
* @param opts.routes Your {@link unstable_RSCRouteConfigEntry | route definitions}.
|
||||
* @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
||||
* that contains the [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* data for hydration.
|
||||
*/
|
||||
declare function matchRSCServerRequest({ allowedActionOrigins, createTemporaryReferenceSet, basename, decodeReply, requestContext, routeDiscovery, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
|
||||
allowedActionOrigins?: string[];
|
||||
createTemporaryReferenceSet: () => unknown;
|
||||
basename?: string;
|
||||
decodeReply?: DecodeReplyFunction;
|
||||
decodeAction?: DecodeActionFunction;
|
||||
decodeFormState?: DecodeFormStateFunction;
|
||||
requestContext?: RouterContextProvider;
|
||||
loadServerAction?: LoadServerActionFunction;
|
||||
onError?: (error: unknown) => void;
|
||||
request: Request;
|
||||
routes: RSCRouteConfigEntry[];
|
||||
routeDiscovery?: RouteDiscovery;
|
||||
generateResponse: (match: RSCMatch, { onError, temporaryReferences, }: {
|
||||
onError(error: unknown): string | undefined;
|
||||
temporaryReferences: unknown;
|
||||
}) => Response;
|
||||
}): Promise<Response>;
|
||||
|
||||
type BrowserCreateFromReadableStreamFunction = (body: ReadableStream<Uint8Array>, { temporaryReferences, }: {
|
||||
temporaryReferences: unknown;
|
||||
}) => Promise<unknown>;
|
||||
type EncodeReplyFunction = (args: unknown[], options: {
|
||||
temporaryReferences: unknown;
|
||||
}) => Promise<BodyInit>;
|
||||
/**
|
||||
* Create a React `callServer` implementation for React Router.
|
||||
*
|
||||
* @example
|
||||
* import {
|
||||
* createFromReadableStream,
|
||||
* createTemporaryReferenceSet,
|
||||
* encodeReply,
|
||||
* setServerCallback,
|
||||
* } from "@vitejs/plugin-rsc/browser";
|
||||
* import { unstable_createCallServer as createCallServer } from "react-router";
|
||||
*
|
||||
* setServerCallback(
|
||||
* createCallServer({
|
||||
* createFromReadableStream,
|
||||
* createTemporaryReferenceSet,
|
||||
* encodeReply,
|
||||
* })
|
||||
* );
|
||||
*
|
||||
* @name unstable_createCallServer
|
||||
* @public
|
||||
* @category RSC
|
||||
* @mode data
|
||||
* @param opts Options
|
||||
* @param opts.createFromReadableStream Your `react-server-dom-xyz/client`'s
|
||||
* `createFromReadableStream`. Used to decode payloads from the server.
|
||||
* @param opts.createTemporaryReferenceSet A function that creates a temporary
|
||||
* reference set for the [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* payload.
|
||||
* @param opts.encodeReply Your `react-server-dom-xyz/client`'s `encodeReply`.
|
||||
* Used when sending payloads to the server.
|
||||
* @param opts.fetch Optional [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
|
||||
* implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch).
|
||||
* @returns A function that can be used to call server actions.
|
||||
*/
|
||||
declare function createCallServer({ createFromReadableStream, createTemporaryReferenceSet, encodeReply, fetch: fetchImplementation, }: {
|
||||
createFromReadableStream: BrowserCreateFromReadableStreamFunction;
|
||||
createTemporaryReferenceSet: () => unknown;
|
||||
encodeReply: EncodeReplyFunction;
|
||||
fetch?: (request: Request) => Promise<Response>;
|
||||
}): (id: string, args: unknown[]) => Promise<unknown>;
|
||||
/**
|
||||
* Props for the {@link unstable_RSCHydratedRouter} component.
|
||||
*
|
||||
* @name unstable_RSCHydratedRouterProps
|
||||
* @category Types
|
||||
*/
|
||||
interface RSCHydratedRouterProps {
|
||||
/**
|
||||
* Your `react-server-dom-xyz/client`'s `createFromReadableStream` function,
|
||||
* used to decode payloads from the server.
|
||||
*/
|
||||
createFromReadableStream: BrowserCreateFromReadableStreamFunction;
|
||||
/**
|
||||
* Optional fetch implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch).
|
||||
*/
|
||||
fetch?: (request: Request) => Promise<Response>;
|
||||
/**
|
||||
* The decoded {@link unstable_RSCPayload} to hydrate.
|
||||
*/
|
||||
payload: RSCPayload;
|
||||
/**
|
||||
* A function that returns an {@link RouterContextProvider} instance
|
||||
* which is provided as the `context` argument to client [`action`](../../start/data/route-object#action)s,
|
||||
* [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
|
||||
* This function is called to generate a fresh `context` instance on each
|
||||
* navigation or fetcher call.
|
||||
*/
|
||||
getContext?: RouterInit["getContext"];
|
||||
}
|
||||
/**
|
||||
* Hydrates a server rendered {@link unstable_RSCPayload} in the browser.
|
||||
*
|
||||
* @example
|
||||
* import { startTransition, StrictMode } from "react";
|
||||
* import { hydrateRoot } from "react-dom/client";
|
||||
* import {
|
||||
* unstable_getRSCStream as getRSCStream,
|
||||
* unstable_RSCHydratedRouter as RSCHydratedRouter,
|
||||
* } from "react-router";
|
||||
* import type { unstable_RSCPayload as RSCPayload } from "react-router";
|
||||
*
|
||||
* createFromReadableStream(getRSCStream()).then((payload) =>
|
||||
* startTransition(async () => {
|
||||
* hydrateRoot(
|
||||
* document,
|
||||
* <StrictMode>
|
||||
* <RSCHydratedRouter
|
||||
* createFromReadableStream={createFromReadableStream}
|
||||
* payload={payload}
|
||||
* />
|
||||
* </StrictMode>,
|
||||
* { formState: await getFormState(payload) },
|
||||
* );
|
||||
* }),
|
||||
* );
|
||||
*
|
||||
* @name unstable_RSCHydratedRouter
|
||||
* @public
|
||||
* @category RSC
|
||||
* @mode data
|
||||
* @param props Props
|
||||
* @param {unstable_RSCHydratedRouterProps.createFromReadableStream} props.createFromReadableStream n/a
|
||||
* @param {unstable_RSCHydratedRouterProps.fetch} props.fetch n/a
|
||||
* @param {unstable_RSCHydratedRouterProps.getContext} props.getContext n/a
|
||||
* @param {unstable_RSCHydratedRouterProps.payload} props.payload n/a
|
||||
* @returns A hydrated {@link DataRouter} that can be used to navigate and
|
||||
* render routes.
|
||||
*/
|
||||
declare function RSCHydratedRouter({ createFromReadableStream, fetch: fetchImplementation, payload, getContext, }: RSCHydratedRouterProps): React.JSX.Element;
|
||||
|
||||
export { type BrowserCreateFromReadableStreamFunction as B, type DecodeActionFunction as D, type EncodeReplyFunction as E, type LoadServerActionFunction as L, RSCHydratedRouter as R, type DecodeFormStateFunction as a, type DecodeReplyFunction as b, createCallServer as c, type RSCManifestPayload as d, type RSCPayload as e, type RSCRenderPayload as f, getRequest as g, type RSCHydratedRouterProps as h, type RSCMatch as i, type RSCRouteManifest as j, type RSCRouteMatch as k, type RSCRouteConfigEntry as l, matchRSCServerRequest as m, type RSCRouteConfig as n };
|
||||
-2565
File diff suppressed because it is too large
Load Diff
-9963
File diff suppressed because one or more lines are too long
-1352
File diff suppressed because it is too large
Load Diff
-11252
File diff suppressed because it is too large
Load Diff
-188
@@ -1,188 +0,0 @@
|
||||
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }/**
|
||||
* react-router v7.14.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE.md file in the root directory of this source tree.
|
||||
*
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var _chunkIK6APEEGjs = require('./chunk-IK6APEEG.js');
|
||||
|
||||
// lib/dom/ssr/hydration.tsx
|
||||
function getHydrationData({
|
||||
state,
|
||||
routes,
|
||||
getRouteInfo,
|
||||
location,
|
||||
basename,
|
||||
isSpaMode
|
||||
}) {
|
||||
let hydrationData = {
|
||||
...state,
|
||||
loaderData: { ...state.loaderData }
|
||||
};
|
||||
let initialMatches = _chunkIK6APEEGjs.matchRoutes.call(void 0, routes, location, basename);
|
||||
if (initialMatches) {
|
||||
for (let match of initialMatches) {
|
||||
let routeId = match.route.id;
|
||||
let routeInfo = getRouteInfo(routeId);
|
||||
if (_chunkIK6APEEGjs.shouldHydrateRouteLoader.call(void 0,
|
||||
routeId,
|
||||
routeInfo.clientLoader,
|
||||
routeInfo.hasLoader,
|
||||
isSpaMode
|
||||
) && (routeInfo.hasHydrateFallback || !routeInfo.hasLoader)) {
|
||||
delete hydrationData.loaderData[routeId];
|
||||
} else if (!routeInfo.hasLoader) {
|
||||
hydrationData.loaderData[routeId] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return hydrationData;
|
||||
}
|
||||
|
||||
// lib/rsc/errorBoundaries.tsx
|
||||
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
||||
var RSCRouterGlobalErrorBoundary = class extends _react2.default.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = { error: null, location: props.location };
|
||||
}
|
||||
static getDerivedStateFromError(error) {
|
||||
return { error };
|
||||
}
|
||||
static getDerivedStateFromProps(props, state) {
|
||||
if (state.location !== props.location) {
|
||||
return { error: null, location: props.location };
|
||||
}
|
||||
return { error: state.error, location: state.location };
|
||||
}
|
||||
render() {
|
||||
if (this.state.error) {
|
||||
return /* @__PURE__ */ _react2.default.createElement(
|
||||
RSCDefaultRootErrorBoundaryImpl,
|
||||
{
|
||||
error: this.state.error,
|
||||
renderAppShell: true
|
||||
}
|
||||
);
|
||||
} else {
|
||||
return this.props.children;
|
||||
}
|
||||
}
|
||||
};
|
||||
function ErrorWrapper({
|
||||
renderAppShell,
|
||||
title,
|
||||
children
|
||||
}) {
|
||||
if (!renderAppShell) {
|
||||
return children;
|
||||
}
|
||||
return /* @__PURE__ */ _react2.default.createElement("html", { lang: "en" }, /* @__PURE__ */ _react2.default.createElement("head", null, /* @__PURE__ */ _react2.default.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ _react2.default.createElement(
|
||||
"meta",
|
||||
{
|
||||
name: "viewport",
|
||||
content: "width=device-width,initial-scale=1,viewport-fit=cover"
|
||||
}
|
||||
), /* @__PURE__ */ _react2.default.createElement("title", null, title)), /* @__PURE__ */ _react2.default.createElement("body", null, /* @__PURE__ */ _react2.default.createElement("main", { style: { fontFamily: "system-ui, sans-serif", padding: "2rem" } }, children)));
|
||||
}
|
||||
function RSCDefaultRootErrorBoundaryImpl({
|
||||
error,
|
||||
renderAppShell
|
||||
}) {
|
||||
console.error(error);
|
||||
let heyDeveloper = /* @__PURE__ */ _react2.default.createElement(
|
||||
"script",
|
||||
{
|
||||
dangerouslySetInnerHTML: {
|
||||
__html: `
|
||||
console.log(
|
||||
"\u{1F4BF} Hey developer \u{1F44B}. You can provide a way better UX than this when your app throws errors. Check out https://reactrouter.com/how-to/error-boundary for more information."
|
||||
);
|
||||
`
|
||||
}
|
||||
}
|
||||
);
|
||||
if (_chunkIK6APEEGjs.isRouteErrorResponse.call(void 0, error)) {
|
||||
return /* @__PURE__ */ _react2.default.createElement(
|
||||
ErrorWrapper,
|
||||
{
|
||||
renderAppShell,
|
||||
title: "Unhandled Thrown Response!"
|
||||
},
|
||||
/* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText),
|
||||
_chunkIK6APEEGjs.ENABLE_DEV_WARNINGS ? heyDeveloper : null
|
||||
);
|
||||
}
|
||||
let errorInstance;
|
||||
if (error instanceof Error) {
|
||||
errorInstance = error;
|
||||
} else {
|
||||
let errorString = error == null ? "Unknown Error" : typeof error === "object" && "toString" in error ? error.toString() : JSON.stringify(error);
|
||||
errorInstance = new Error(errorString);
|
||||
}
|
||||
return /* @__PURE__ */ _react2.default.createElement(ErrorWrapper, { renderAppShell, title: "Application Error!" }, /* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, "Application Error"), /* @__PURE__ */ _react2.default.createElement(
|
||||
"pre",
|
||||
{
|
||||
style: {
|
||||
padding: "2rem",
|
||||
background: "hsla(10, 50%, 50%, 0.1)",
|
||||
color: "red",
|
||||
overflow: "auto"
|
||||
}
|
||||
},
|
||||
errorInstance.stack
|
||||
), heyDeveloper);
|
||||
}
|
||||
function RSCDefaultRootErrorBoundary({
|
||||
hasRootLayout
|
||||
}) {
|
||||
let error = _chunkIK6APEEGjs.useRouteError.call(void 0, );
|
||||
if (hasRootLayout === void 0) {
|
||||
throw new Error("Missing 'hasRootLayout' prop");
|
||||
}
|
||||
return /* @__PURE__ */ _react2.default.createElement(
|
||||
RSCDefaultRootErrorBoundaryImpl,
|
||||
{
|
||||
renderAppShell: !hasRootLayout,
|
||||
error
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// lib/rsc/route-modules.ts
|
||||
function createRSCRouteModules(payload) {
|
||||
const routeModules = {};
|
||||
for (const match of payload.matches) {
|
||||
populateRSCRouteModules(routeModules, match);
|
||||
}
|
||||
return routeModules;
|
||||
}
|
||||
function populateRSCRouteModules(routeModules, matches) {
|
||||
matches = Array.isArray(matches) ? matches : [matches];
|
||||
for (const match of matches) {
|
||||
routeModules[match.id] = {
|
||||
links: match.links,
|
||||
meta: match.meta,
|
||||
default: noopComponent
|
||||
};
|
||||
}
|
||||
}
|
||||
var noopComponent = () => null;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
exports.getHydrationData = getHydrationData; exports.RSCRouterGlobalErrorBoundary = RSCRouterGlobalErrorBoundary; exports.RSCDefaultRootErrorBoundary = RSCDefaultRootErrorBoundary; exports.createRSCRouteModules = createRSCRouteModules; exports.populateRSCRouteModules = populateRSCRouteModules;
|
||||
-1713
File diff suppressed because it is too large
Load Diff
+10
-10
@@ -1,10 +1,10 @@
|
||||
import * as React from 'react';
|
||||
import { a as RouterProviderProps$1, R as RouterInit, u as unstable_ClientInstrumentation, C as ClientOnErrorFunction } from './context-phCt_zmH.mjs';
|
||||
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-vtIR1Kpe.mjs';
|
||||
import './routeModules-BRrCYrSL.mjs';
|
||||
import { a as RouterProviderProps$1, R as RouterInit, C as ClientInstrumentation, b as ClientOnErrorFunction } from './context-CmHpk1Ws.mjs';
|
||||
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-CGcs-0pD.mjs';
|
||||
import './data-U8FS-wNn.mjs';
|
||||
|
||||
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
||||
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
||||
declare function RouterProvider(props: RouterProviderProps): React.JSX.Element;
|
||||
|
||||
/**
|
||||
* Props for the {@link dom.HydratedRouter} component.
|
||||
@@ -65,12 +65,12 @@ interface HydratedRouterProps {
|
||||
* startTransition(() => {
|
||||
* hydrateRoot(
|
||||
* document,
|
||||
* <HydratedRouter unstable_instrumentations={[logging]} />
|
||||
* <HydratedRouter instrumentations={[logging]} />
|
||||
* );
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
||||
instrumentations?: ClientInstrumentation[];
|
||||
/**
|
||||
* An error handler function that will be called for any middleware, loader, action,
|
||||
* or render errors that are encountered in your application. This is useful for
|
||||
@@ -82,8 +82,8 @@ interface HydratedRouterProps {
|
||||
* and is only present for render errors.
|
||||
*
|
||||
* ```tsx
|
||||
* <HydratedRouter onError=(error, info) => {
|
||||
* let { location, params, unstable_pattern, errorInfo } = info;
|
||||
* <HydratedRouter onError={(error, info) => {
|
||||
* let { location, params, pattern, errorInfo } = info;
|
||||
* console.error(error, location, errorInfo);
|
||||
* reportToErrorService(error, location, errorInfo);
|
||||
* }} />
|
||||
@@ -106,9 +106,9 @@ interface HydratedRouterProps {
|
||||
* - When set to `false`, the router will not leverage `React.startTransition` or
|
||||
* `React.useOptimistic` on any navigations or state changes.
|
||||
*
|
||||
* For more information, please see the [docs](https://reactrouter.com/explanation/react-transitions).
|
||||
* For more information, please see the [docs](../../explanation/react-transitions).
|
||||
*/
|
||||
unstable_useTransitions?: boolean;
|
||||
useTransitions?: boolean;
|
||||
}
|
||||
/**
|
||||
* Framework-mode router component to be used to hydrate a router from a
|
||||
|
||||
+10
-10
@@ -1,11 +1,11 @@
|
||||
import * as React from 'react';
|
||||
import { RouterProviderProps as RouterProviderProps$1, RouterInit, ClientOnErrorFunction } from 'react-router';
|
||||
import { u as unstable_ClientInstrumentation } from './instrumentation-BYr6ff5D.js';
|
||||
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-C9Ar1yxG.js';
|
||||
import './routeModules-CA7kSxJJ.js';
|
||||
import { C as ClientInstrumentation } from './instrumentation-1q4YhLGP.js';
|
||||
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-D3uq9sI1.js';
|
||||
import './data-D4xhSy90.js';
|
||||
|
||||
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
||||
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
||||
declare function RouterProvider(props: RouterProviderProps): React.JSX.Element;
|
||||
|
||||
/**
|
||||
* Props for the {@link dom.HydratedRouter} component.
|
||||
@@ -66,12 +66,12 @@ interface HydratedRouterProps {
|
||||
* startTransition(() => {
|
||||
* hydrateRoot(
|
||||
* document,
|
||||
* <HydratedRouter unstable_instrumentations={[logging]} />
|
||||
* <HydratedRouter instrumentations={[logging]} />
|
||||
* );
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
||||
instrumentations?: ClientInstrumentation[];
|
||||
/**
|
||||
* An error handler function that will be called for any middleware, loader, action,
|
||||
* or render errors that are encountered in your application. This is useful for
|
||||
@@ -83,8 +83,8 @@ interface HydratedRouterProps {
|
||||
* and is only present for render errors.
|
||||
*
|
||||
* ```tsx
|
||||
* <HydratedRouter onError=(error, info) => {
|
||||
* let { location, params, unstable_pattern, errorInfo } = info;
|
||||
* <HydratedRouter onError={(error, info) => {
|
||||
* let { location, params, pattern, errorInfo } = info;
|
||||
* console.error(error, location, errorInfo);
|
||||
* reportToErrorService(error, location, errorInfo);
|
||||
* }} />
|
||||
@@ -107,9 +107,9 @@ interface HydratedRouterProps {
|
||||
* - When set to `false`, the router will not leverage `React.startTransition` or
|
||||
* `React.useOptimistic` on any navigations or state changes.
|
||||
*
|
||||
* For more information, please see the [docs](https://reactrouter.com/explanation/react-transitions).
|
||||
* For more information, please see the [docs](../../explanation/react-transitions).
|
||||
*/
|
||||
unstable_useTransitions?: boolean;
|
||||
useTransitions?: boolean;
|
||||
}
|
||||
/**
|
||||
* Framework-mode router component to be used to hydrate a router from a
|
||||
|
||||
+59
-64
@@ -1,5 +1,5 @@
|
||||
"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; }/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
|
||||
|
||||
var _chunkWAVMRYR2js = require('./chunk-WAVMRYR2.js');
|
||||
var _chunkPBLBZ3QUjs = require('./chunk-PBLBZ3QU.js');
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,8 @@ var _chunkWAVMRYR2js = require('./chunk-WAVMRYR2.js');
|
||||
|
||||
|
||||
|
||||
var _chunkIK6APEEGjs = require('./chunk-IK6APEEG.js');
|
||||
|
||||
var _chunkKFNXW4ALjs = require('./chunk-KFNXW4AL.js');
|
||||
|
||||
// lib/dom-export/dom-router-provider.tsx
|
||||
var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react);
|
||||
@@ -90,7 +91,7 @@ function initSsrInfo() {
|
||||
}
|
||||
function createHydratedRouter({
|
||||
getContext,
|
||||
unstable_instrumentations
|
||||
instrumentations
|
||||
}) {
|
||||
initSsrInfo();
|
||||
if (!ssrInfo) {
|
||||
@@ -163,10 +164,10 @@ function createHydratedRouter({
|
||||
getContext,
|
||||
hydrationData,
|
||||
hydrationRouteProperties: _reactrouter.UNSAFE_hydrationRouteProperties,
|
||||
unstable_instrumentations,
|
||||
instrumentations,
|
||||
mapRouteProperties: _reactrouter.UNSAFE_mapRouteProperties,
|
||||
future: {
|
||||
unstable_passThroughRequests: ssrInfo.context.future.unstable_passThroughRequests
|
||||
v8_passThroughRequests: ssrInfo.context.future.v8_passThroughRequests
|
||||
},
|
||||
dataStrategy: _reactrouter.UNSAFE_getTurboStreamSingleFetchDataStrategy.call(void 0,
|
||||
() => router2,
|
||||
@@ -174,7 +175,7 @@ function createHydratedRouter({
|
||||
ssrInfo.routeModules,
|
||||
ssrInfo.context.ssr,
|
||||
ssrInfo.context.basename,
|
||||
ssrInfo.context.future.unstable_trailingSlashAwareDataRequests
|
||||
ssrInfo.context.future.v8_trailingSlashAwareDataRequests
|
||||
),
|
||||
patchRoutesOnNavigation: _reactrouter.UNSAFE_getPatchRoutesOnNavigationFunction.call(void 0,
|
||||
() => router2,
|
||||
@@ -200,7 +201,7 @@ function HydratedRouter(props) {
|
||||
if (!router) {
|
||||
router = createHydratedRouter({
|
||||
getContext: props.getContext,
|
||||
unstable_instrumentations: props.unstable_instrumentations
|
||||
instrumentations: props.instrumentations
|
||||
});
|
||||
}
|
||||
let [criticalCss, setCriticalCss] = React2.useState(
|
||||
@@ -213,7 +214,7 @@ function HydratedRouter(props) {
|
||||
}, []);
|
||||
React2.useEffect(() => {
|
||||
if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
|
||||
document.querySelectorAll(`[${_chunkIK6APEEGjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
|
||||
document.querySelectorAll(`[${_chunkKFNXW4ALjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
|
||||
}
|
||||
}, [criticalCss]);
|
||||
let [location2, setLocation] = React2.useState(router.state.location);
|
||||
@@ -261,7 +262,7 @@ function HydratedRouter(props) {
|
||||
RouterProvider2,
|
||||
{
|
||||
router,
|
||||
unstable_useTransitions: props.unstable_useTransitions,
|
||||
useTransitions: props.useTransitions,
|
||||
onError: props.onError
|
||||
}
|
||||
))
|
||||
@@ -392,7 +393,7 @@ function createRouterFromPayload({
|
||||
};
|
||||
if (payload.type !== "render") throw new Error("Invalid payload type");
|
||||
globalVar.__reactRouterRouteModules = _nullishCoalesce(globalVar.__reactRouterRouteModules, () => ( {}));
|
||||
_chunkWAVMRYR2js.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
|
||||
_chunkPBLBZ3QUjs.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
|
||||
let routes = payload.matches.reduceRight((previous, match) => {
|
||||
const route = createRouteFromServerManifest(
|
||||
match,
|
||||
@@ -406,12 +407,12 @@ function createRouterFromPayload({
|
||||
return [route];
|
||||
}, []);
|
||||
let applyPatchesPromise;
|
||||
globalVar.__reactRouterDataRouter = _chunkIK6APEEGjs.createRouter.call(void 0, {
|
||||
globalVar.__reactRouterDataRouter = _chunkKFNXW4ALjs.createRouter.call(void 0, {
|
||||
routes,
|
||||
getContext,
|
||||
basename: payload.basename,
|
||||
history: _chunkIK6APEEGjs.createBrowserHistory.call(void 0, ),
|
||||
hydrationData: _chunkWAVMRYR2js.getHydrationData.call(void 0, {
|
||||
history: _chunkKFNXW4ALjs.createBrowserHistory.call(void 0, ),
|
||||
hydrationData: _chunkPBLBZ3QUjs.getHydrationData.call(void 0, {
|
||||
state: {
|
||||
loaderData: payload.loaderData,
|
||||
actionData: payload.actionData,
|
||||
@@ -420,7 +421,7 @@ function createRouterFromPayload({
|
||||
routes,
|
||||
getRouteInfo: (routeId) => {
|
||||
let match = payload.matches.find((m) => m.id === routeId);
|
||||
_chunkIK6APEEGjs.invariant.call(void 0, match, "Route not found in payload");
|
||||
_chunkKFNXW4ALjs.invariant.call(void 0, match, "Route not found in payload");
|
||||
return {
|
||||
clientLoader: match.clientLoader,
|
||||
hasLoader: match.hasLoader,
|
||||
@@ -535,9 +536,9 @@ function createRouterFromPayload({
|
||||
routeModules: globalVar.__reactRouterRouteModules
|
||||
};
|
||||
}
|
||||
var renderedRoutesContext = _chunkIK6APEEGjs.createContext.call(void 0, );
|
||||
var renderedRoutesContext = _chunkKFNXW4ALjs.createContext.call(void 0, );
|
||||
function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReadableStream, fetchImplementation) {
|
||||
let dataStrategy = _chunkIK6APEEGjs.getSingleFetchDataStrategyImpl.call(void 0,
|
||||
let dataStrategy = _chunkKFNXW4ALjs.getSingleFetchDataStrategyImpl.call(void 0,
|
||||
getRouter,
|
||||
(match) => {
|
||||
let M = match;
|
||||
@@ -546,8 +547,7 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
|
||||
hasClientLoader: M.route.hasClientLoader,
|
||||
hasComponent: M.route.hasComponent,
|
||||
hasAction: M.route.hasAction,
|
||||
hasClientAction: M.route.hasClientAction,
|
||||
hasShouldRevalidate: M.route.hasShouldRevalidate
|
||||
hasClientAction: M.route.hasClientAction
|
||||
};
|
||||
},
|
||||
// pass map into fetchAndDecode so it can add payloads
|
||||
@@ -595,20 +595,20 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
|
||||
function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation) {
|
||||
return async (args, basename, trailingSlashAware, targetRoutes) => {
|
||||
let { request, context } = args;
|
||||
let url = _chunkIK6APEEGjs.singleFetchUrl.call(void 0, request.url, basename, trailingSlashAware, "rsc");
|
||||
let url = _chunkKFNXW4ALjs.singleFetchUrl.call(void 0, request.url, basename, trailingSlashAware, "rsc");
|
||||
if (request.method === "GET") {
|
||||
url = _chunkIK6APEEGjs.stripIndexParam.call(void 0, url);
|
||||
url = _chunkKFNXW4ALjs.stripIndexParam.call(void 0, url);
|
||||
if (targetRoutes) {
|
||||
url.searchParams.set("_routes", targetRoutes.join(","));
|
||||
}
|
||||
}
|
||||
let res = await fetchImplementation(
|
||||
new Request(url, await _chunkIK6APEEGjs.createRequestInit.call(void 0, request))
|
||||
new Request(url, await _chunkKFNXW4ALjs.createRequestInit.call(void 0, request))
|
||||
);
|
||||
if (res.status >= 400 && !res.headers.has("X-Remix-Response")) {
|
||||
throw new (0, _chunkIK6APEEGjs.ErrorResponseImpl)(res.status, res.statusText, await res.text());
|
||||
throw new (0, _chunkKFNXW4ALjs.ErrorResponseImpl)(res.status, res.statusText, await res.text());
|
||||
}
|
||||
_chunkIK6APEEGjs.invariant.call(void 0, res.body, "No response body to decode");
|
||||
_chunkKFNXW4ALjs.invariant.call(void 0, res.body, "No response body to decode");
|
||||
try {
|
||||
const payload = await createFromReadableStream(res.body, {
|
||||
temporaryReferences: void 0
|
||||
@@ -632,7 +632,7 @@ function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation)
|
||||
}
|
||||
context.get(renderedRoutesContext).push(...payload.matches);
|
||||
let results = { routes: {} };
|
||||
const dataKey = _chunkIK6APEEGjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
|
||||
const dataKey = _chunkKFNXW4ALjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
|
||||
for (let [routeId, data] of Object.entries(payload[dataKey] || {})) {
|
||||
results.routes[routeId] = { data };
|
||||
}
|
||||
@@ -665,7 +665,7 @@ function RSCHydratedRouter({
|
||||
[createFromReadableStream, payload, fetchImplementation, getContext]
|
||||
);
|
||||
React3.useEffect(() => {
|
||||
_chunkIK6APEEGjs.setIsHydrated.call(void 0, );
|
||||
_chunkKFNXW4ALjs.setIsHydrated.call(void 0, );
|
||||
}, []);
|
||||
React3.useLayoutEffect(() => {
|
||||
const globalVar = window;
|
||||
@@ -750,10 +750,9 @@ function RSCHydratedRouter({
|
||||
// These flags have no runtime impact so can always be false. If we add
|
||||
// flags that drive runtime behavior they'll need to be proxied through.
|
||||
v8_middleware: false,
|
||||
unstable_subResourceIntegrity: false,
|
||||
unstable_trailingSlashAwareDataRequests: true,
|
||||
v8_trailingSlashAwareDataRequests: true,
|
||||
// always on for RSC
|
||||
unstable_passThroughRequests: true
|
||||
v8_passThroughRequests: true
|
||||
// always on for RSC
|
||||
},
|
||||
isSpaMode: false,
|
||||
@@ -774,8 +773,8 @@ function RSCHydratedRouter({
|
||||
},
|
||||
routeModules
|
||||
};
|
||||
return /* @__PURE__ */ React3.createElement(_chunkIK6APEEGjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkWAVMRYR2js.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkIK6APEEGjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
|
||||
_chunkIK6APEEGjs.RouterProvider,
|
||||
return /* @__PURE__ */ React3.createElement(_chunkKFNXW4ALjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkPBLBZ3QUjs.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkKFNXW4ALjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
|
||||
_chunkKFNXW4ALjs.RouterProvider,
|
||||
{
|
||||
router: transitionEnabledRouter,
|
||||
flushSync: ReactDOM2.flushSync
|
||||
@@ -791,8 +790,8 @@ function createRouteFromServerManifest(match, payload) {
|
||||
// the server loader flow regardless of whether the client loader calls
|
||||
// `serverLoader` or not, otherwise we'll have nothing to render.
|
||||
match.hasComponent && !match.element;
|
||||
_chunkIK6APEEGjs.invariant.call(void 0, window.__reactRouterRouteModules);
|
||||
_chunkWAVMRYR2js.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
|
||||
_chunkKFNXW4ALjs.invariant.call(void 0, window.__reactRouterRouteModules);
|
||||
_chunkPBLBZ3QUjs.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
|
||||
let dataRoute = {
|
||||
id: match.id,
|
||||
element: match.element,
|
||||
@@ -802,30 +801,28 @@ function createRouteFromServerManifest(match, payload) {
|
||||
hydrateFallbackElement: match.hydrateFallbackElement,
|
||||
index: match.index,
|
||||
loader: match.clientLoader ? async (args, singleFetch) => {
|
||||
try {
|
||||
let result = await match.clientLoader({
|
||||
...args,
|
||||
serverLoader: () => {
|
||||
preventInvalidServerHandlerCall(
|
||||
"loader",
|
||||
match.id,
|
||||
match.hasLoader
|
||||
);
|
||||
if (isHydrationRequest) {
|
||||
if (hasInitialData) {
|
||||
return initialData;
|
||||
}
|
||||
if (hasInitialError) {
|
||||
throw initialError;
|
||||
}
|
||||
let _isHydrationRequest = isHydrationRequest;
|
||||
isHydrationRequest = false;
|
||||
let result = await match.clientLoader({
|
||||
...args,
|
||||
serverLoader: () => {
|
||||
preventInvalidServerHandlerCall(
|
||||
"loader",
|
||||
match.id,
|
||||
match.hasLoader
|
||||
);
|
||||
if (_isHydrationRequest) {
|
||||
if (hasInitialData) {
|
||||
return initialData;
|
||||
}
|
||||
if (hasInitialError) {
|
||||
throw initialError;
|
||||
}
|
||||
return callSingleFetch(singleFetch);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
} finally {
|
||||
isHydrationRequest = false;
|
||||
}
|
||||
return callSingleFetch(singleFetch);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
} : (
|
||||
// We always make the call in this RSC world since even if we don't
|
||||
// have a `loader` we may need to get the `element` implementation
|
||||
@@ -842,7 +839,7 @@ function createRouteFromServerManifest(match, payload) {
|
||||
return await callSingleFetch(singleFetch);
|
||||
}
|
||||
}) : match.hasAction ? (_, singleFetch) => callSingleFetch(singleFetch) : () => {
|
||||
throw _chunkIK6APEEGjs.noActionDefinedError.call(void 0, "action", match.id);
|
||||
throw _chunkKFNXW4ALjs.noActionDefinedError.call(void 0, "action", match.id);
|
||||
},
|
||||
path: match.path,
|
||||
shouldRevalidate: match.shouldRevalidate,
|
||||
@@ -851,11 +848,10 @@ function createRouteFromServerManifest(match, payload) {
|
||||
hasLoader: true,
|
||||
hasClientLoader: match.clientLoader != null,
|
||||
hasAction: match.hasAction,
|
||||
hasClientAction: match.clientAction != null,
|
||||
hasShouldRevalidate: match.shouldRevalidate != null
|
||||
hasClientAction: match.clientAction != null
|
||||
};
|
||||
if (typeof dataRoute.loader === "function") {
|
||||
dataRoute.loader.hydrate = _chunkIK6APEEGjs.shouldHydrateRouteLoader.call(void 0,
|
||||
dataRoute.loader.hydrate = _chunkKFNXW4ALjs.shouldHydrateRouteLoader.call(void 0,
|
||||
match.id,
|
||||
match.clientLoader,
|
||||
match.hasLoader,
|
||||
@@ -865,7 +861,7 @@ function createRouteFromServerManifest(match, payload) {
|
||||
return dataRoute;
|
||||
}
|
||||
function callSingleFetch(singleFetch) {
|
||||
_chunkIK6APEEGjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
|
||||
_chunkKFNXW4ALjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
|
||||
return singleFetch();
|
||||
}
|
||||
function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
|
||||
@@ -873,13 +869,12 @@ function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
|
||||
let fn = type === "action" ? "serverAction()" : "serverLoader()";
|
||||
let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${routeId}")`;
|
||||
console.error(msg);
|
||||
throw new (0, _chunkIK6APEEGjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
|
||||
throw new (0, _chunkKFNXW4ALjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
|
||||
}
|
||||
}
|
||||
var nextPaths = /* @__PURE__ */ new Set();
|
||||
var discoveredPathsMaxSize = 1e3;
|
||||
var discoveredPaths = /* @__PURE__ */ new Set();
|
||||
var URL_LIMIT = 7680;
|
||||
function getManifestUrl(paths) {
|
||||
if (paths.length === 0) {
|
||||
return null;
|
||||
@@ -901,7 +896,7 @@ async function fetchAndApplyManifestPatches(paths, createFromReadableStream, fet
|
||||
if (url == null) {
|
||||
return;
|
||||
}
|
||||
if (url.toString().length > URL_LIMIT) {
|
||||
if (url.toString().length > _chunkKFNXW4ALjs.URL_LIMIT) {
|
||||
nextPaths.clear();
|
||||
return;
|
||||
}
|
||||
@@ -946,7 +941,7 @@ function isExternalLocation(location2) {
|
||||
}
|
||||
function hasInvalidProtocol(location2) {
|
||||
try {
|
||||
return _chunkIK6APEEGjs.invalidProtocols.includes(new URL(location2).protocol);
|
||||
return _chunkKFNXW4ALjs.invalidProtocols.includes(new URL(location2).protocol);
|
||||
} catch (e2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+34
-39
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
deserializeErrors,
|
||||
getHydrationData,
|
||||
populateRSCRouteModules
|
||||
} from "./chunk-2UH5WJXA.mjs";
|
||||
} from "./chunk-ASILSGTR.mjs";
|
||||
import {
|
||||
CRITICAL_CSS_DATA_ATTRIBUTE,
|
||||
ErrorResponseImpl,
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
RSCRouterContext,
|
||||
RemixErrorBoundary,
|
||||
RouterProvider,
|
||||
URL_LIMIT,
|
||||
createBrowserHistory,
|
||||
createClientRoutes,
|
||||
createClientRoutesWithHMRRevalidationOptOut,
|
||||
@@ -43,7 +44,7 @@ import {
|
||||
singleFetchUrl,
|
||||
stripIndexParam,
|
||||
useFogOFWarDiscovery
|
||||
} from "./chunk-QFMPRPBF.mjs";
|
||||
} from "./chunk-6CSD65Y2.mjs";
|
||||
|
||||
// lib/dom-export/dom-router-provider.tsx
|
||||
import * as React from "react";
|
||||
@@ -82,7 +83,7 @@ function initSsrInfo() {
|
||||
}
|
||||
function createHydratedRouter({
|
||||
getContext,
|
||||
unstable_instrumentations
|
||||
instrumentations
|
||||
}) {
|
||||
initSsrInfo();
|
||||
if (!ssrInfo) {
|
||||
@@ -155,10 +156,10 @@ function createHydratedRouter({
|
||||
getContext,
|
||||
hydrationData,
|
||||
hydrationRouteProperties,
|
||||
unstable_instrumentations,
|
||||
instrumentations,
|
||||
mapRouteProperties,
|
||||
future: {
|
||||
unstable_passThroughRequests: ssrInfo.context.future.unstable_passThroughRequests
|
||||
v8_passThroughRequests: ssrInfo.context.future.v8_passThroughRequests
|
||||
},
|
||||
dataStrategy: getTurboStreamSingleFetchDataStrategy(
|
||||
() => router2,
|
||||
@@ -166,7 +167,7 @@ function createHydratedRouter({
|
||||
ssrInfo.routeModules,
|
||||
ssrInfo.context.ssr,
|
||||
ssrInfo.context.basename,
|
||||
ssrInfo.context.future.unstable_trailingSlashAwareDataRequests
|
||||
ssrInfo.context.future.v8_trailingSlashAwareDataRequests
|
||||
),
|
||||
patchRoutesOnNavigation: getPatchRoutesOnNavigationFunction(
|
||||
() => router2,
|
||||
@@ -192,7 +193,7 @@ function HydratedRouter(props) {
|
||||
if (!router) {
|
||||
router = createHydratedRouter({
|
||||
getContext: props.getContext,
|
||||
unstable_instrumentations: props.unstable_instrumentations
|
||||
instrumentations: props.instrumentations
|
||||
});
|
||||
}
|
||||
let [criticalCss, setCriticalCss] = React2.useState(
|
||||
@@ -253,7 +254,7 @@ function HydratedRouter(props) {
|
||||
RouterProvider2,
|
||||
{
|
||||
router,
|
||||
unstable_useTransitions: props.unstable_useTransitions,
|
||||
useTransitions: props.useTransitions,
|
||||
onError: props.onError
|
||||
}
|
||||
))
|
||||
@@ -538,8 +539,7 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
|
||||
hasClientLoader: M.route.hasClientLoader,
|
||||
hasComponent: M.route.hasComponent,
|
||||
hasAction: M.route.hasAction,
|
||||
hasClientAction: M.route.hasClientAction,
|
||||
hasShouldRevalidate: M.route.hasShouldRevalidate
|
||||
hasClientAction: M.route.hasClientAction
|
||||
};
|
||||
},
|
||||
// pass map into fetchAndDecode so it can add payloads
|
||||
@@ -742,10 +742,9 @@ function RSCHydratedRouter({
|
||||
// These flags have no runtime impact so can always be false. If we add
|
||||
// flags that drive runtime behavior they'll need to be proxied through.
|
||||
v8_middleware: false,
|
||||
unstable_subResourceIntegrity: false,
|
||||
unstable_trailingSlashAwareDataRequests: true,
|
||||
v8_trailingSlashAwareDataRequests: true,
|
||||
// always on for RSC
|
||||
unstable_passThroughRequests: true
|
||||
v8_passThroughRequests: true
|
||||
// always on for RSC
|
||||
},
|
||||
isSpaMode: false,
|
||||
@@ -794,30 +793,28 @@ function createRouteFromServerManifest(match, payload) {
|
||||
hydrateFallbackElement: match.hydrateFallbackElement,
|
||||
index: match.index,
|
||||
loader: match.clientLoader ? async (args, singleFetch) => {
|
||||
try {
|
||||
let result = await match.clientLoader({
|
||||
...args,
|
||||
serverLoader: () => {
|
||||
preventInvalidServerHandlerCall(
|
||||
"loader",
|
||||
match.id,
|
||||
match.hasLoader
|
||||
);
|
||||
if (isHydrationRequest) {
|
||||
if (hasInitialData) {
|
||||
return initialData;
|
||||
}
|
||||
if (hasInitialError) {
|
||||
throw initialError;
|
||||
}
|
||||
let _isHydrationRequest = isHydrationRequest;
|
||||
isHydrationRequest = false;
|
||||
let result = await match.clientLoader({
|
||||
...args,
|
||||
serverLoader: () => {
|
||||
preventInvalidServerHandlerCall(
|
||||
"loader",
|
||||
match.id,
|
||||
match.hasLoader
|
||||
);
|
||||
if (_isHydrationRequest) {
|
||||
if (hasInitialData) {
|
||||
return initialData;
|
||||
}
|
||||
if (hasInitialError) {
|
||||
throw initialError;
|
||||
}
|
||||
return callSingleFetch(singleFetch);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
} finally {
|
||||
isHydrationRequest = false;
|
||||
}
|
||||
return callSingleFetch(singleFetch);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
} : (
|
||||
// We always make the call in this RSC world since even if we don't
|
||||
// have a `loader` we may need to get the `element` implementation
|
||||
@@ -843,8 +840,7 @@ function createRouteFromServerManifest(match, payload) {
|
||||
hasLoader: true,
|
||||
hasClientLoader: match.clientLoader != null,
|
||||
hasAction: match.hasAction,
|
||||
hasClientAction: match.clientAction != null,
|
||||
hasShouldRevalidate: match.shouldRevalidate != null
|
||||
hasClientAction: match.clientAction != null
|
||||
};
|
||||
if (typeof dataRoute.loader === "function") {
|
||||
dataRoute.loader.hydrate = shouldHydrateRouteLoader(
|
||||
@@ -871,7 +867,6 @@ function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
|
||||
var nextPaths = /* @__PURE__ */ new Set();
|
||||
var discoveredPathsMaxSize = 1e3;
|
||||
var discoveredPaths = /* @__PURE__ */ new Set();
|
||||
var URL_LIMIT = 7680;
|
||||
function getManifestUrl(paths) {
|
||||
if (paths.length === 0) {
|
||||
return null;
|
||||
|
||||
Generated
Vendored
-2590
File diff suppressed because it is too large
Load Diff
Generated
Vendored
-3645
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -1,4 +1,4 @@
|
||||
export { Q as MemoryRouter, T as Navigate, U as Outlet, V as Route, W as Router, X as RouterProvider, Y as Routes, A as UNSAFE_AwaitContextProvider, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps } from './context-phCt_zmH.mjs';
|
||||
export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-BwWaHAr3.mjs';
|
||||
import './routeModules-BRrCYrSL.mjs';
|
||||
export { Q as MemoryRouter, T as Navigate, U as Outlet, V as Route, W as Router, X as RouterProvider, Y as Routes, A as UNSAFE_AwaitContextProvider, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps } from './context-CmHpk1Ws.mjs';
|
||||
export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-DPrDrCew.mjs';
|
||||
import './data-U8FS-wNn.mjs';
|
||||
import 'react';
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
export { W as BrowserRouter, $ as Form, X as HashRouter, Y as Link, an as Links, j as MemoryRouter, am as Meta, _ as NavLink, k as Navigate, l as Outlet, m as Route, n as Router, o as RouterProvider, p as Routes, a0 as ScrollRestoration, ak as StaticRouter, al as StaticRouterProvider, b as UNSAFE_AwaitContextProvider, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, Z as unstable_HistoryRouter } from './index-react-server-client-luDbagNU.js';
|
||||
import './instrumentation-BYr6ff5D.js';
|
||||
import './routeModules-CA7kSxJJ.js';
|
||||
export { W as BrowserRouter, $ as Form, X as HashRouter, Y as Link, an as Links, j as MemoryRouter, am as Meta, _ as NavLink, k as Navigate, l as Outlet, m as Route, n as Router, o as RouterProvider, p as Routes, a0 as ScrollRestoration, ak as StaticRouter, al as StaticRouterProvider, b as UNSAFE_AwaitContextProvider, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, Z as unstable_HistoryRouter } from './index-react-server-client-CwU9bE5R.js';
|
||||
import './instrumentation-1q4YhLGP.js';
|
||||
import './data-D4xhSy90.js';
|
||||
import 'react';
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
"use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
|
||||
|
||||
var _chunkNXTEWSJOjs = require('./chunk-NXTEWSJO.js');
|
||||
var _chunkPULC7NLKjs = require('./chunk-PULC7NLK.js');
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ var _chunkNXTEWSJOjs = require('./chunk-NXTEWSJO.js');
|
||||
|
||||
|
||||
|
||||
var _chunkIK6APEEGjs = require('./chunk-IK6APEEG.js');
|
||||
var _chunkKFNXW4ALjs = require('./chunk-KFNXW4AL.js');
|
||||
|
||||
|
||||
|
||||
@@ -58,4 +58,4 @@ var _chunkIK6APEEGjs = require('./chunk-IK6APEEG.js');
|
||||
|
||||
|
||||
|
||||
exports.BrowserRouter = _chunkNXTEWSJOjs.BrowserRouter; exports.Form = _chunkNXTEWSJOjs.Form; exports.HashRouter = _chunkNXTEWSJOjs.HashRouter; exports.Link = _chunkNXTEWSJOjs.Link; exports.Links = _chunkIK6APEEGjs.Links; exports.MemoryRouter = _chunkIK6APEEGjs.MemoryRouter; exports.Meta = _chunkIK6APEEGjs.Meta; exports.NavLink = _chunkNXTEWSJOjs.NavLink; exports.Navigate = _chunkIK6APEEGjs.Navigate; exports.Outlet = _chunkIK6APEEGjs.Outlet; exports.Route = _chunkIK6APEEGjs.Route; exports.Router = _chunkIK6APEEGjs.Router; exports.RouterProvider = _chunkIK6APEEGjs.RouterProvider; exports.Routes = _chunkIK6APEEGjs.Routes; exports.ScrollRestoration = _chunkNXTEWSJOjs.ScrollRestoration; exports.StaticRouter = _chunkNXTEWSJOjs.StaticRouter; exports.StaticRouterProvider = _chunkNXTEWSJOjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkIK6APEEGjs.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunkIK6APEEGjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkIK6APEEGjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkIK6APEEGjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkNXTEWSJOjs.HistoryRouter;
|
||||
exports.BrowserRouter = _chunkPULC7NLKjs.BrowserRouter; exports.Form = _chunkPULC7NLKjs.Form; exports.HashRouter = _chunkPULC7NLKjs.HashRouter; exports.Link = _chunkPULC7NLKjs.Link; exports.Links = _chunkKFNXW4ALjs.Links; exports.MemoryRouter = _chunkKFNXW4ALjs.MemoryRouter; exports.Meta = _chunkKFNXW4ALjs.Meta; exports.NavLink = _chunkPULC7NLKjs.NavLink; exports.Navigate = _chunkKFNXW4ALjs.Navigate; exports.Outlet = _chunkKFNXW4ALjs.Outlet; exports.Route = _chunkKFNXW4ALjs.Route; exports.Router = _chunkKFNXW4ALjs.Router; exports.RouterProvider = _chunkKFNXW4ALjs.RouterProvider; exports.Routes = _chunkKFNXW4ALjs.Routes; exports.ScrollRestoration = _chunkPULC7NLKjs.ScrollRestoration; exports.StaticRouter = _chunkPULC7NLKjs.StaticRouter; exports.StaticRouterProvider = _chunkPULC7NLKjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkKFNXW4ALjs.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunkKFNXW4ALjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkKFNXW4ALjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkKFNXW4ALjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkPULC7NLKjs.HistoryRouter;
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
@@ -32,7 +32,7 @@ import {
|
||||
WithComponentProps,
|
||||
WithErrorBoundaryProps,
|
||||
WithHydrateFallbackProps
|
||||
} from "./chunk-QFMPRPBF.mjs";
|
||||
} from "./chunk-6CSD65Y2.mjs";
|
||||
export {
|
||||
BrowserRouter,
|
||||
Form,
|
||||
|
||||
+120
-37
@@ -64,7 +64,7 @@ interface Location<State = any> extends Path {
|
||||
* The masked location displayed in the URL bar, which differs from the URL the
|
||||
* router is operating on
|
||||
*/
|
||||
unstable_mask: Path | undefined;
|
||||
mask?: Path;
|
||||
}
|
||||
/**
|
||||
* A change to the current location.
|
||||
@@ -357,19 +357,19 @@ interface DataFunctionArgs<Context> {
|
||||
/** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read headers (like cookies, and {@link https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams URLSearchParams} from the request. */
|
||||
request: Request;
|
||||
/**
|
||||
* A URL instance representing the application location being navigated to or fetched.
|
||||
* Without `future.unstable_passThroughRequests` enabled, this matches `request.url`.
|
||||
* With `future.unstable_passThroughRequests` enabled, this is a normalized
|
||||
* URL with React-Router-specific implementation details removed (`.data`
|
||||
* suffixes, `index`/`_routes` search params).
|
||||
* The URL includes the origin from the request for convenience.
|
||||
* A URL instance representing the application location being navigated to or
|
||||
* fetched. By default, this matches `request.url`.
|
||||
*
|
||||
* In Framework mode with `future.v8_passThroughRequests` enabled, this is a
|
||||
* normalized URL with React-Router-specific implementation details removed
|
||||
* (`.data` suffixes, `index`/`_routes` search params).
|
||||
*/
|
||||
unstable_url: URL;
|
||||
url: URL;
|
||||
/**
|
||||
* Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
|
||||
* Mostly useful as a identifier to aggregate on for logging/tracing/etc.
|
||||
*/
|
||||
unstable_pattern: string;
|
||||
pattern: string;
|
||||
/**
|
||||
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
||||
* @example
|
||||
@@ -756,6 +756,7 @@ type DataNonIndexRouteObject = NonIndexRouteObject & {
|
||||
* A data route object, which is just a RouteObject with a required unique ID
|
||||
*/
|
||||
type DataRouteObject = DataIndexRouteObject | DataNonIndexRouteObject;
|
||||
type RouteManifest<R = DataRouteObject> = Record<string, R | undefined>;
|
||||
/**
|
||||
* The parameters that were parsed from the URL path.
|
||||
*/
|
||||
@@ -839,6 +840,24 @@ interface UIMatch<Data = unknown, Handle = unknown> {
|
||||
*/
|
||||
handle: Handle;
|
||||
}
|
||||
interface RouteMeta<RouteObjectType extends RouteObject = RouteObject> {
|
||||
relativePath: string;
|
||||
caseSensitive: boolean;
|
||||
childrenIndex: number;
|
||||
route: RouteObjectType;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* A "branch" of routes that match a given route pattern.
|
||||
* This is an internal interface not intended for direct external usage.
|
||||
*/
|
||||
interface RouteBranch<RouteObjectType extends RouteObject = RouteObject> {
|
||||
path: string;
|
||||
score: number;
|
||||
routesMeta: RouteMeta<RouteObjectType>[];
|
||||
}
|
||||
declare class DataWithResponseInit<D> {
|
||||
type: string;
|
||||
data: D;
|
||||
@@ -878,6 +897,9 @@ type RedirectFunction = (url: string, init?: number | ResponseInit) => Response;
|
||||
* Sets the status code and the [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
|
||||
* header. Defaults to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302).
|
||||
*
|
||||
* This utility accepts absolute URLs and can navigate to external domains, so
|
||||
* the application should validate any user-supplied inputs to redirects.
|
||||
*
|
||||
* @example
|
||||
* import { redirect } from "react-router";
|
||||
*
|
||||
@@ -907,6 +929,9 @@ declare const redirect$1: RedirectFunction;
|
||||
* and the [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
|
||||
* header. Defaults to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302).
|
||||
*
|
||||
* This utility accepts absolute URLs and can navigate to external domains, so
|
||||
* the application should validate any user-supplied inputs to redirects.
|
||||
*
|
||||
* ```tsx filename=routes/logout.tsx
|
||||
* import { redirectDocument } from "react-router";
|
||||
*
|
||||
@@ -1006,25 +1031,25 @@ interface AppLoadContext {
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
type unstable_ServerInstrumentation = {
|
||||
handler?: unstable_InstrumentRequestHandlerFunction;
|
||||
route?: unstable_InstrumentRouteFunction;
|
||||
type ServerInstrumentation = {
|
||||
handler?: InstrumentRequestHandlerFunction;
|
||||
route?: InstrumentRouteFunction;
|
||||
};
|
||||
type unstable_ClientInstrumentation = {
|
||||
router?: unstable_InstrumentRouterFunction;
|
||||
route?: unstable_InstrumentRouteFunction;
|
||||
type ClientInstrumentation = {
|
||||
router?: InstrumentRouterFunction;
|
||||
route?: InstrumentRouteFunction;
|
||||
};
|
||||
type unstable_InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
|
||||
type unstable_InstrumentRouterFunction = (router: InstrumentableRouter) => void;
|
||||
type unstable_InstrumentRouteFunction = (route: InstrumentableRoute) => void;
|
||||
type unstable_InstrumentationHandlerResult = {
|
||||
type InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
|
||||
type InstrumentRouterFunction = (router: InstrumentableRouter) => void;
|
||||
type InstrumentRouteFunction = (route: InstrumentableRoute) => void;
|
||||
type InstrumentationHandlerResult = {
|
||||
status: "success";
|
||||
error: undefined;
|
||||
} | {
|
||||
status: "error";
|
||||
error: Error;
|
||||
};
|
||||
type InstrumentFunction<T> = (handler: () => Promise<unstable_InstrumentationHandlerResult>, info: T) => Promise<void>;
|
||||
type InstrumentFunction<T> = (handler: () => Promise<InstrumentationHandlerResult>, info: T) => Promise<void>;
|
||||
type ReadonlyRequest = {
|
||||
method: string;
|
||||
url: string;
|
||||
@@ -1050,7 +1075,7 @@ type RouteLazyInstrumentationInfo = undefined;
|
||||
type RouteHandlerInstrumentationInfo = Readonly<{
|
||||
request: ReadonlyRequest;
|
||||
params: LoaderFunctionArgs["params"];
|
||||
unstable_pattern: string;
|
||||
pattern: string;
|
||||
context: ReadonlyContext;
|
||||
}>;
|
||||
type InstrumentableRouter = {
|
||||
@@ -1120,6 +1145,20 @@ interface Router {
|
||||
* Return the routes for this router instance
|
||||
*/
|
||||
get routes(): DataRouteObject[];
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the route branches for this router instance
|
||||
*/
|
||||
get branches(): RouteBranch<DataRouteObject>[] | undefined;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the manifest for this router instance
|
||||
*/
|
||||
get manifest(): RouteManifest;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
@@ -1367,7 +1406,6 @@ type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "e
|
||||
* Future flags to toggle new feature behavior
|
||||
*/
|
||||
interface FutureConfig {
|
||||
unstable_passThroughRequests: boolean;
|
||||
}
|
||||
/**
|
||||
* Initialization options for createRouter
|
||||
@@ -1377,7 +1415,7 @@ interface RouterInit {
|
||||
history: History;
|
||||
basename?: string;
|
||||
getContext?: () => MaybePromise<RouterContextProvider>;
|
||||
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
||||
instrumentations?: ClientInstrumentation[];
|
||||
mapRouteProperties?: MapRoutePropertiesFunction;
|
||||
future?: Partial<FutureConfig>;
|
||||
hydrationRouteProperties?: string[];
|
||||
@@ -1405,7 +1443,33 @@ interface StaticHandlerContext {
|
||||
* A StaticHandler instance manages a singular SSR navigation/fetch event
|
||||
*/
|
||||
interface StaticHandler {
|
||||
/**
|
||||
* The set of data routes managed by this handler
|
||||
*/
|
||||
dataRoutes: DataRouteObject[];
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* The route branches derived from the data routes, used for internal route
|
||||
* matching in Framework Mode
|
||||
*/
|
||||
_internalRouteBranches: RouteBranch<DataRouteObject>[];
|
||||
/**
|
||||
* Perform a query for a given request - executing all matched route
|
||||
* loaders/actions. Used for document requests.
|
||||
*
|
||||
* @param request The request to query
|
||||
* @param opts Optional query options
|
||||
* @param opts.dataStrategy Alternate dataStrategy implementation
|
||||
* @param opts.filterMatchesToLoad Predicate function to filter which matches should be loaded
|
||||
* @param opts.generateMiddlewareResponse To enable middleware, provide a function
|
||||
* to generate a response to bubble back up the middleware chain
|
||||
* @param opts.requestContext Context object to pass to loaders/actions
|
||||
* @param opts.skipLoaderErrorBubbling Skip loader error bubbling
|
||||
* @param opts.skipRevalidation Skip revalidation after action submission
|
||||
* @param opts.normalizePath Normalize the request path
|
||||
*/
|
||||
query(request: Request, opts?: {
|
||||
requestContext?: unknown;
|
||||
filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
|
||||
@@ -1415,14 +1479,27 @@ interface StaticHandler {
|
||||
generateMiddlewareResponse?: (query: (r: Request, args?: {
|
||||
filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
|
||||
}) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>;
|
||||
unstable_normalizePath?: (request: Request) => Path;
|
||||
normalizePath?: (request: Request) => Path;
|
||||
}): Promise<StaticHandlerContext | Response>;
|
||||
/**
|
||||
* Perform a query for a specific route. Used for resource requests.
|
||||
*
|
||||
* @param request The request to query
|
||||
* @param opts Optional queryRoute options
|
||||
* @param opts.dataStrategy Alternate dataStrategy implementation
|
||||
* @param opts.generateMiddlewareResponse To enable middleware, provide a function
|
||||
* to generate a response to bubble back up the middleware chain
|
||||
* @param opts.requestContext Context object to pass to loaders/actions
|
||||
* @param opts.routeId The ID of the route to query
|
||||
* @param opts.normalizePath Normalize the request path
|
||||
|
||||
*/
|
||||
queryRoute(request: Request, opts?: {
|
||||
routeId?: string;
|
||||
requestContext?: unknown;
|
||||
dataStrategy?: DataStrategyFunction<unknown>;
|
||||
generateMiddlewareResponse?: (queryRoute: (r: Request) => Promise<Response>) => MaybePromise<Response>;
|
||||
unstable_normalizePath?: (request: Request) => Path;
|
||||
normalizePath?: (request: Request) => Path;
|
||||
}): Promise<any>;
|
||||
}
|
||||
type ViewTransitionOpts = {
|
||||
@@ -1466,14 +1543,14 @@ type BaseNavigateOrFetchOptions = {
|
||||
preventScrollReset?: boolean;
|
||||
relative?: RelativeRoutingType;
|
||||
flushSync?: boolean;
|
||||
unstable_defaultShouldRevalidate?: boolean;
|
||||
defaultShouldRevalidate?: boolean;
|
||||
};
|
||||
type BaseNavigateOptions = BaseNavigateOrFetchOptions & {
|
||||
replace?: boolean;
|
||||
state?: any;
|
||||
fromRouteId?: string;
|
||||
viewTransition?: boolean;
|
||||
unstable_mask?: To;
|
||||
mask?: To;
|
||||
};
|
||||
type BaseSubmissionOptions = {
|
||||
formMethod?: HTMLFormMethod;
|
||||
@@ -1516,6 +1593,8 @@ type NavigationStates = {
|
||||
Idle: {
|
||||
state: "idle";
|
||||
location: undefined;
|
||||
matches: undefined;
|
||||
historyAction: undefined;
|
||||
formMethod: undefined;
|
||||
formAction: undefined;
|
||||
formEncType: undefined;
|
||||
@@ -1526,6 +1605,8 @@ type NavigationStates = {
|
||||
Loading: {
|
||||
state: "loading";
|
||||
location: Location;
|
||||
matches: DataRouteMatch[];
|
||||
historyAction: Action;
|
||||
formMethod: Submission["formMethod"] | undefined;
|
||||
formAction: Submission["formAction"] | undefined;
|
||||
formEncType: Submission["formEncType"] | undefined;
|
||||
@@ -1536,6 +1617,8 @@ type NavigationStates = {
|
||||
Submitting: {
|
||||
state: "submitting";
|
||||
location: Location;
|
||||
matches: DataRouteMatch[];
|
||||
historyAction: Action;
|
||||
formMethod: Submission["formMethod"];
|
||||
formAction: Submission["formAction"];
|
||||
formEncType: Submission["formEncType"];
|
||||
@@ -1649,7 +1732,7 @@ type BlockerFunction = (args: {
|
||||
interface CreateStaticHandlerOptions {
|
||||
basename?: string;
|
||||
mapRouteProperties?: MapRoutePropertiesFunction;
|
||||
unstable_instrumentations?: Pick<unstable_ServerInstrumentation, "route">[];
|
||||
instrumentations?: Pick<ServerInstrumentation, "route">[];
|
||||
future?: Partial<FutureConfig>;
|
||||
}
|
||||
declare function createStaticHandler(routes: RouteObject[], opts?: CreateStaticHandlerOptions): StaticHandler;
|
||||
@@ -1799,14 +1882,14 @@ type ClientDataFunctionArgs<Params> = {
|
||||
**/
|
||||
request: Request;
|
||||
/**
|
||||
* A URL instance representing the application location being navigated to or fetched.
|
||||
* Without `future.unstable_passThroughRequests` enabled, this matches `request.url`.
|
||||
* With `future.unstable_passThroughRequests` enabled, this is a normalized
|
||||
* URL with React-Router-specific implementation details removed (`.data`
|
||||
* pathnames, `index`/`_routes` search params).
|
||||
* The URL includes the origin from the request for convenience.
|
||||
* A URL instance representing the application location being navigated to or
|
||||
* fetched. By default, this matches `request.url`.
|
||||
*
|
||||
* In Framework mode with `future.v8_passThroughRequests` enabled, this is a
|
||||
* normalized URL with React-Router-specific implementation details removed
|
||||
* (`.data` suffixes, `index`/`_routes` search params).
|
||||
*/
|
||||
unstable_url: URL;
|
||||
url: URL;
|
||||
/**
|
||||
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
||||
* @example
|
||||
@@ -1826,7 +1909,7 @@ type ClientDataFunctionArgs<Params> = {
|
||||
* Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
|
||||
* Mostly useful as a identifier to aggregate on for logging/tracing/etc.
|
||||
*/
|
||||
unstable_pattern: string;
|
||||
pattern: string;
|
||||
/**
|
||||
* When `future.v8_middleware` is not enabled, this is undefined.
|
||||
*
|
||||
@@ -1975,7 +2058,7 @@ type MetaDescriptor = {
|
||||
httpEquiv: string;
|
||||
content: string;
|
||||
} | {
|
||||
"script:ld+json": LdJsonObject;
|
||||
"script:ld+json": LdJsonObject | LdJsonObject[];
|
||||
} | {
|
||||
tagName: "meta" | "link";
|
||||
[name: string]: string;
|
||||
|
||||
+120
-37
@@ -64,7 +64,7 @@ interface Location<State = any> extends Path {
|
||||
* The masked location displayed in the URL bar, which differs from the URL the
|
||||
* router is operating on
|
||||
*/
|
||||
unstable_mask: Path | undefined;
|
||||
mask?: Path;
|
||||
}
|
||||
/**
|
||||
* A change to the current location.
|
||||
@@ -357,19 +357,19 @@ interface DataFunctionArgs<Context> {
|
||||
/** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read headers (like cookies, and {@link https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams URLSearchParams} from the request. */
|
||||
request: Request;
|
||||
/**
|
||||
* A URL instance representing the application location being navigated to or fetched.
|
||||
* Without `future.unstable_passThroughRequests` enabled, this matches `request.url`.
|
||||
* With `future.unstable_passThroughRequests` enabled, this is a normalized
|
||||
* URL with React-Router-specific implementation details removed (`.data`
|
||||
* suffixes, `index`/`_routes` search params).
|
||||
* The URL includes the origin from the request for convenience.
|
||||
* A URL instance representing the application location being navigated to or
|
||||
* fetched. By default, this matches `request.url`.
|
||||
*
|
||||
* In Framework mode with `future.v8_passThroughRequests` enabled, this is a
|
||||
* normalized URL with React-Router-specific implementation details removed
|
||||
* (`.data` suffixes, `index`/`_routes` search params).
|
||||
*/
|
||||
unstable_url: URL;
|
||||
url: URL;
|
||||
/**
|
||||
* Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
|
||||
* Mostly useful as a identifier to aggregate on for logging/tracing/etc.
|
||||
*/
|
||||
unstable_pattern: string;
|
||||
pattern: string;
|
||||
/**
|
||||
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
||||
* @example
|
||||
@@ -756,6 +756,7 @@ type DataNonIndexRouteObject = NonIndexRouteObject & {
|
||||
* A data route object, which is just a RouteObject with a required unique ID
|
||||
*/
|
||||
type DataRouteObject = DataIndexRouteObject | DataNonIndexRouteObject;
|
||||
type RouteManifest<R = DataRouteObject> = Record<string, R | undefined>;
|
||||
/**
|
||||
* The parameters that were parsed from the URL path.
|
||||
*/
|
||||
@@ -839,6 +840,24 @@ interface UIMatch<Data = unknown, Handle = unknown> {
|
||||
*/
|
||||
handle: Handle;
|
||||
}
|
||||
interface RouteMeta<RouteObjectType extends RouteObject = RouteObject> {
|
||||
relativePath: string;
|
||||
caseSensitive: boolean;
|
||||
childrenIndex: number;
|
||||
route: RouteObjectType;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* A "branch" of routes that match a given route pattern.
|
||||
* This is an internal interface not intended for direct external usage.
|
||||
*/
|
||||
interface RouteBranch<RouteObjectType extends RouteObject = RouteObject> {
|
||||
path: string;
|
||||
score: number;
|
||||
routesMeta: RouteMeta<RouteObjectType>[];
|
||||
}
|
||||
declare class DataWithResponseInit<D> {
|
||||
type: string;
|
||||
data: D;
|
||||
@@ -878,6 +897,9 @@ type RedirectFunction = (url: string, init?: number | ResponseInit) => Response;
|
||||
* Sets the status code and the [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
|
||||
* header. Defaults to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302).
|
||||
*
|
||||
* This utility accepts absolute URLs and can navigate to external domains, so
|
||||
* the application should validate any user-supplied inputs to redirects.
|
||||
*
|
||||
* @example
|
||||
* import { redirect } from "react-router";
|
||||
*
|
||||
@@ -907,6 +929,9 @@ declare const redirect$1: RedirectFunction;
|
||||
* and the [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
|
||||
* header. Defaults to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302).
|
||||
*
|
||||
* This utility accepts absolute URLs and can navigate to external domains, so
|
||||
* the application should validate any user-supplied inputs to redirects.
|
||||
*
|
||||
* ```tsx filename=routes/logout.tsx
|
||||
* import { redirectDocument } from "react-router";
|
||||
*
|
||||
@@ -1006,25 +1031,25 @@ interface AppLoadContext {
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
type unstable_ServerInstrumentation = {
|
||||
handler?: unstable_InstrumentRequestHandlerFunction;
|
||||
route?: unstable_InstrumentRouteFunction;
|
||||
type ServerInstrumentation = {
|
||||
handler?: InstrumentRequestHandlerFunction;
|
||||
route?: InstrumentRouteFunction;
|
||||
};
|
||||
type unstable_ClientInstrumentation = {
|
||||
router?: unstable_InstrumentRouterFunction;
|
||||
route?: unstable_InstrumentRouteFunction;
|
||||
type ClientInstrumentation = {
|
||||
router?: InstrumentRouterFunction;
|
||||
route?: InstrumentRouteFunction;
|
||||
};
|
||||
type unstable_InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
|
||||
type unstable_InstrumentRouterFunction = (router: InstrumentableRouter) => void;
|
||||
type unstable_InstrumentRouteFunction = (route: InstrumentableRoute) => void;
|
||||
type unstable_InstrumentationHandlerResult = {
|
||||
type InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
|
||||
type InstrumentRouterFunction = (router: InstrumentableRouter) => void;
|
||||
type InstrumentRouteFunction = (route: InstrumentableRoute) => void;
|
||||
type InstrumentationHandlerResult = {
|
||||
status: "success";
|
||||
error: undefined;
|
||||
} | {
|
||||
status: "error";
|
||||
error: Error;
|
||||
};
|
||||
type InstrumentFunction<T> = (handler: () => Promise<unstable_InstrumentationHandlerResult>, info: T) => Promise<void>;
|
||||
type InstrumentFunction<T> = (handler: () => Promise<InstrumentationHandlerResult>, info: T) => Promise<void>;
|
||||
type ReadonlyRequest = {
|
||||
method: string;
|
||||
url: string;
|
||||
@@ -1050,7 +1075,7 @@ type RouteLazyInstrumentationInfo = undefined;
|
||||
type RouteHandlerInstrumentationInfo = Readonly<{
|
||||
request: ReadonlyRequest;
|
||||
params: LoaderFunctionArgs["params"];
|
||||
unstable_pattern: string;
|
||||
pattern: string;
|
||||
context: ReadonlyContext;
|
||||
}>;
|
||||
type InstrumentableRouter = {
|
||||
@@ -1120,6 +1145,20 @@ interface Router {
|
||||
* Return the routes for this router instance
|
||||
*/
|
||||
get routes(): DataRouteObject[];
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the route branches for this router instance
|
||||
*/
|
||||
get branches(): RouteBranch<DataRouteObject>[] | undefined;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the manifest for this router instance
|
||||
*/
|
||||
get manifest(): RouteManifest;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
@@ -1367,7 +1406,6 @@ type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "e
|
||||
* Future flags to toggle new feature behavior
|
||||
*/
|
||||
interface FutureConfig {
|
||||
unstable_passThroughRequests: boolean;
|
||||
}
|
||||
/**
|
||||
* Initialization options for createRouter
|
||||
@@ -1377,7 +1415,7 @@ interface RouterInit {
|
||||
history: History;
|
||||
basename?: string;
|
||||
getContext?: () => MaybePromise<RouterContextProvider>;
|
||||
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
||||
instrumentations?: ClientInstrumentation[];
|
||||
mapRouteProperties?: MapRoutePropertiesFunction;
|
||||
future?: Partial<FutureConfig>;
|
||||
hydrationRouteProperties?: string[];
|
||||
@@ -1405,7 +1443,33 @@ interface StaticHandlerContext {
|
||||
* A StaticHandler instance manages a singular SSR navigation/fetch event
|
||||
*/
|
||||
interface StaticHandler {
|
||||
/**
|
||||
* The set of data routes managed by this handler
|
||||
*/
|
||||
dataRoutes: DataRouteObject[];
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* The route branches derived from the data routes, used for internal route
|
||||
* matching in Framework Mode
|
||||
*/
|
||||
_internalRouteBranches: RouteBranch<DataRouteObject>[];
|
||||
/**
|
||||
* Perform a query for a given request - executing all matched route
|
||||
* loaders/actions. Used for document requests.
|
||||
*
|
||||
* @param request The request to query
|
||||
* @param opts Optional query options
|
||||
* @param opts.dataStrategy Alternate dataStrategy implementation
|
||||
* @param opts.filterMatchesToLoad Predicate function to filter which matches should be loaded
|
||||
* @param opts.generateMiddlewareResponse To enable middleware, provide a function
|
||||
* to generate a response to bubble back up the middleware chain
|
||||
* @param opts.requestContext Context object to pass to loaders/actions
|
||||
* @param opts.skipLoaderErrorBubbling Skip loader error bubbling
|
||||
* @param opts.skipRevalidation Skip revalidation after action submission
|
||||
* @param opts.normalizePath Normalize the request path
|
||||
*/
|
||||
query(request: Request, opts?: {
|
||||
requestContext?: unknown;
|
||||
filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
|
||||
@@ -1415,14 +1479,27 @@ interface StaticHandler {
|
||||
generateMiddlewareResponse?: (query: (r: Request, args?: {
|
||||
filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
|
||||
}) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>;
|
||||
unstable_normalizePath?: (request: Request) => Path;
|
||||
normalizePath?: (request: Request) => Path;
|
||||
}): Promise<StaticHandlerContext | Response>;
|
||||
/**
|
||||
* Perform a query for a specific route. Used for resource requests.
|
||||
*
|
||||
* @param request The request to query
|
||||
* @param opts Optional queryRoute options
|
||||
* @param opts.dataStrategy Alternate dataStrategy implementation
|
||||
* @param opts.generateMiddlewareResponse To enable middleware, provide a function
|
||||
* to generate a response to bubble back up the middleware chain
|
||||
* @param opts.requestContext Context object to pass to loaders/actions
|
||||
* @param opts.routeId The ID of the route to query
|
||||
* @param opts.normalizePath Normalize the request path
|
||||
|
||||
*/
|
||||
queryRoute(request: Request, opts?: {
|
||||
routeId?: string;
|
||||
requestContext?: unknown;
|
||||
dataStrategy?: DataStrategyFunction<unknown>;
|
||||
generateMiddlewareResponse?: (queryRoute: (r: Request) => Promise<Response>) => MaybePromise<Response>;
|
||||
unstable_normalizePath?: (request: Request) => Path;
|
||||
normalizePath?: (request: Request) => Path;
|
||||
}): Promise<any>;
|
||||
}
|
||||
type ViewTransitionOpts = {
|
||||
@@ -1466,14 +1543,14 @@ type BaseNavigateOrFetchOptions = {
|
||||
preventScrollReset?: boolean;
|
||||
relative?: RelativeRoutingType;
|
||||
flushSync?: boolean;
|
||||
unstable_defaultShouldRevalidate?: boolean;
|
||||
defaultShouldRevalidate?: boolean;
|
||||
};
|
||||
type BaseNavigateOptions = BaseNavigateOrFetchOptions & {
|
||||
replace?: boolean;
|
||||
state?: any;
|
||||
fromRouteId?: string;
|
||||
viewTransition?: boolean;
|
||||
unstable_mask?: To;
|
||||
mask?: To;
|
||||
};
|
||||
type BaseSubmissionOptions = {
|
||||
formMethod?: HTMLFormMethod;
|
||||
@@ -1516,6 +1593,8 @@ type NavigationStates = {
|
||||
Idle: {
|
||||
state: "idle";
|
||||
location: undefined;
|
||||
matches: undefined;
|
||||
historyAction: undefined;
|
||||
formMethod: undefined;
|
||||
formAction: undefined;
|
||||
formEncType: undefined;
|
||||
@@ -1526,6 +1605,8 @@ type NavigationStates = {
|
||||
Loading: {
|
||||
state: "loading";
|
||||
location: Location;
|
||||
matches: DataRouteMatch[];
|
||||
historyAction: Action;
|
||||
formMethod: Submission["formMethod"] | undefined;
|
||||
formAction: Submission["formAction"] | undefined;
|
||||
formEncType: Submission["formEncType"] | undefined;
|
||||
@@ -1536,6 +1617,8 @@ type NavigationStates = {
|
||||
Submitting: {
|
||||
state: "submitting";
|
||||
location: Location;
|
||||
matches: DataRouteMatch[];
|
||||
historyAction: Action;
|
||||
formMethod: Submission["formMethod"];
|
||||
formAction: Submission["formAction"];
|
||||
formEncType: Submission["formEncType"];
|
||||
@@ -1649,7 +1732,7 @@ type BlockerFunction = (args: {
|
||||
interface CreateStaticHandlerOptions {
|
||||
basename?: string;
|
||||
mapRouteProperties?: MapRoutePropertiesFunction;
|
||||
unstable_instrumentations?: Pick<unstable_ServerInstrumentation, "route">[];
|
||||
instrumentations?: Pick<ServerInstrumentation, "route">[];
|
||||
future?: Partial<FutureConfig>;
|
||||
}
|
||||
declare function createStaticHandler(routes: RouteObject[], opts?: CreateStaticHandlerOptions): StaticHandler;
|
||||
@@ -1799,14 +1882,14 @@ type ClientDataFunctionArgs<Params> = {
|
||||
**/
|
||||
request: Request;
|
||||
/**
|
||||
* A URL instance representing the application location being navigated to or fetched.
|
||||
* Without `future.unstable_passThroughRequests` enabled, this matches `request.url`.
|
||||
* With `future.unstable_passThroughRequests` enabled, this is a normalized
|
||||
* URL with React-Router-specific implementation details removed (`.data`
|
||||
* pathnames, `index`/`_routes` search params).
|
||||
* The URL includes the origin from the request for convenience.
|
||||
* A URL instance representing the application location being navigated to or
|
||||
* fetched. By default, this matches `request.url`.
|
||||
*
|
||||
* In Framework mode with `future.v8_passThroughRequests` enabled, this is a
|
||||
* normalized URL with React-Router-specific implementation details removed
|
||||
* (`.data` suffixes, `index`/`_routes` search params).
|
||||
*/
|
||||
unstable_url: URL;
|
||||
url: URL;
|
||||
/**
|
||||
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
||||
* @example
|
||||
@@ -1826,7 +1909,7 @@ type ClientDataFunctionArgs<Params> = {
|
||||
* Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
|
||||
* Mostly useful as a identifier to aggregate on for logging/tracing/etc.
|
||||
*/
|
||||
unstable_pattern: string;
|
||||
pattern: string;
|
||||
/**
|
||||
* When `future.v8_middleware` is not enabled, this is undefined.
|
||||
*
|
||||
@@ -1975,7 +2058,7 @@ type MetaDescriptor = {
|
||||
httpEquiv: string;
|
||||
content: string;
|
||||
} | {
|
||||
"script:ld+json": LdJsonObject;
|
||||
"script:ld+json": LdJsonObject | LdJsonObject[];
|
||||
} | {
|
||||
tagName: "meta" | "link";
|
||||
[name: string]: string;
|
||||
|
||||
+71
-41
@@ -27,7 +27,7 @@ function _interopNamespace(e) {
|
||||
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
||||
|
||||
/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
@@ -61,7 +61,7 @@ function warning(cond, message) {
|
||||
function createKey() {
|
||||
return Math.random().toString(36).substring(2, 10);
|
||||
}
|
||||
function createLocation(current, to, state = null, key, unstable_mask) {
|
||||
function createLocation(current, to, state = null, key, mask) {
|
||||
let location = {
|
||||
pathname: typeof current === "string" ? current : current.pathname,
|
||||
search: "",
|
||||
@@ -73,7 +73,7 @@ function createLocation(current, to, state = null, key, unstable_mask) {
|
||||
// But that's a pretty big refactor to the current test suite so going to
|
||||
// keep as is for the time being and just let any incoming keys take precedence
|
||||
key: to && to.key || key || createKey(),
|
||||
unstable_mask
|
||||
mask
|
||||
};
|
||||
return location;
|
||||
}
|
||||
@@ -253,11 +253,11 @@ async function recurseRight(impls, info, handler, index) {
|
||||
};
|
||||
}
|
||||
function getHandlerInfo(args) {
|
||||
let { request, context, params, unstable_pattern } = args;
|
||||
let { request, context, params, pattern } = args;
|
||||
return {
|
||||
request: getReadonlyRequest(request),
|
||||
params: { ...params },
|
||||
unstable_pattern,
|
||||
pattern,
|
||||
context: getReadonlyContext(context)
|
||||
};
|
||||
}
|
||||
@@ -427,17 +427,16 @@ function mergeRouteUpdates(route, updates) {
|
||||
function matchRoutes(routes, locationArg, basename = "/") {
|
||||
return matchRoutesImpl(routes, locationArg, basename, false);
|
||||
}
|
||||
function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
|
||||
function matchRoutesImpl(routes, locationArg, basename, allowPartial, precomputedBranches) {
|
||||
let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
||||
let pathname = stripBasename(location.pathname || "/", basename);
|
||||
if (pathname == null) {
|
||||
return null;
|
||||
}
|
||||
let branches = flattenRoutes(routes);
|
||||
rankRouteBranches(branches);
|
||||
let branches = precomputedBranches ?? flattenAndRankRoutes(routes);
|
||||
let matches = null;
|
||||
let decoded = decodePath(pathname);
|
||||
for (let i = 0; matches == null && i < branches.length; ++i) {
|
||||
let decoded = decodePath(pathname);
|
||||
matches = matchRouteBranch(
|
||||
branches[i],
|
||||
decoded,
|
||||
@@ -457,6 +456,11 @@ function convertRouteMatchToUiMatch(match, loaderData) {
|
||||
handle: route.handle
|
||||
};
|
||||
}
|
||||
function flattenAndRankRoutes(routes) {
|
||||
let branches = flattenRoutes(routes);
|
||||
rankRouteBranches(branches);
|
||||
return branches;
|
||||
}
|
||||
function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) {
|
||||
let flattenRoute = (route, index, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {
|
||||
let meta = {
|
||||
@@ -728,7 +732,7 @@ function resolvePath(to, fromPathname = "/") {
|
||||
} = typeof to === "string" ? parsePath(to) : to;
|
||||
let pathname;
|
||||
if (toPathname) {
|
||||
toPathname = toPathname.replace(/\/\/+/g, "/");
|
||||
toPathname = removeDoubleSlashes(toPathname);
|
||||
if (toPathname.startsWith("/")) {
|
||||
pathname = resolvePathname(toPathname.substring(1), "/");
|
||||
} else {
|
||||
@@ -744,7 +748,7 @@ function resolvePath(to, fromPathname = "/") {
|
||||
};
|
||||
}
|
||||
function resolvePathname(relativePath, fromPathname) {
|
||||
let segments = fromPathname.replace(/\/+$/, "").split("/");
|
||||
let segments = removeTrailingSlash(fromPathname).split("/");
|
||||
let relativeSegments = relativePath.split("/");
|
||||
relativeSegments.forEach((segment) => {
|
||||
if (segment === "..") {
|
||||
@@ -815,8 +819,10 @@ function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = fal
|
||||
}
|
||||
return path;
|
||||
}
|
||||
var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
|
||||
var normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
|
||||
var removeDoubleSlashes = (path) => path.replace(/\/\/+/g, "/");
|
||||
var joinPaths = (paths) => removeDoubleSlashes(paths.join("/"));
|
||||
var removeTrailingSlash = (path) => path.replace(/\/+$/, "");
|
||||
var normalizePathname = (pathname) => removeTrailingSlash(pathname).replace(/^\/*/, "/");
|
||||
var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
|
||||
var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
|
||||
var DataWithResponseInit = class {
|
||||
@@ -870,7 +876,8 @@ function isRouteErrorResponse(error) {
|
||||
return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
|
||||
}
|
||||
function getRoutePattern(matches) {
|
||||
return matches.map((m) => m.route.path).filter(Boolean).join("/").replace(/\/\/*/g, "/") || "/";
|
||||
let parts = matches.map((m) => m.route.path).filter(Boolean);
|
||||
return joinPaths(parts) || "/";
|
||||
}
|
||||
|
||||
// lib/router/router.ts
|
||||
@@ -903,11 +910,10 @@ function createStaticHandler(routes, opts) {
|
||||
let _mapRouteProperties = opts?.mapRouteProperties || defaultMapRouteProperties;
|
||||
let mapRouteProperties = _mapRouteProperties;
|
||||
({
|
||||
// unused in static handler
|
||||
...opts?.future
|
||||
});
|
||||
if (opts?.unstable_instrumentations) {
|
||||
let instrumentations = opts.unstable_instrumentations;
|
||||
if (opts?.instrumentations) {
|
||||
let instrumentations = opts.instrumentations;
|
||||
mapRouteProperties = (route) => {
|
||||
return {
|
||||
..._mapRouteProperties(route),
|
||||
@@ -924,6 +930,7 @@ function createStaticHandler(routes, opts) {
|
||||
void 0,
|
||||
manifest
|
||||
);
|
||||
let routeBranches = flattenAndRankRoutes(dataRoutes);
|
||||
async function query(request, {
|
||||
requestContext,
|
||||
filterMatchesToLoad,
|
||||
@@ -931,12 +938,23 @@ function createStaticHandler(routes, opts) {
|
||||
skipRevalidation,
|
||||
dataStrategy,
|
||||
generateMiddlewareResponse,
|
||||
unstable_normalizePath
|
||||
normalizePath
|
||||
} = {}) {
|
||||
let normalizePath = unstable_normalizePath || defaultNormalizePath;
|
||||
let normalizePathImpl = normalizePath || defaultNormalizePath;
|
||||
let method = request.method;
|
||||
let location = createLocation("", normalizePath(request), null, "default");
|
||||
let matches = matchRoutes(dataRoutes, location, basename);
|
||||
let location = createLocation(
|
||||
"",
|
||||
normalizePathImpl(request),
|
||||
null,
|
||||
"default"
|
||||
);
|
||||
let matches = matchRoutesImpl(
|
||||
dataRoutes,
|
||||
location,
|
||||
basename,
|
||||
false,
|
||||
routeBranches
|
||||
);
|
||||
requestContext = requestContext != null ? requestContext : new RouterContextProvider();
|
||||
if (!isValidMethod(method) && method !== "HEAD") {
|
||||
let error = getInternalRouterError(405, { method });
|
||||
@@ -988,8 +1006,8 @@ function createStaticHandler(routes, opts) {
|
||||
let response = await runServerMiddlewarePipeline(
|
||||
{
|
||||
request,
|
||||
unstable_url: createDataFunctionUrl(request, location),
|
||||
unstable_pattern: getRoutePattern(matches),
|
||||
url: createDataFunctionUrl(request, location),
|
||||
pattern: getRoutePattern(matches),
|
||||
matches,
|
||||
params: matches[0].params,
|
||||
// If we're calling middleware then it must be enabled so we can cast
|
||||
@@ -1106,12 +1124,23 @@ function createStaticHandler(routes, opts) {
|
||||
requestContext,
|
||||
dataStrategy,
|
||||
generateMiddlewareResponse,
|
||||
unstable_normalizePath
|
||||
normalizePath
|
||||
} = {}) {
|
||||
let normalizePath = unstable_normalizePath || defaultNormalizePath;
|
||||
let normalizePathImpl = normalizePath || defaultNormalizePath;
|
||||
let method = request.method;
|
||||
let location = createLocation("", normalizePath(request), null, "default");
|
||||
let matches = matchRoutes(dataRoutes, location, basename);
|
||||
let location = createLocation(
|
||||
"",
|
||||
normalizePathImpl(request),
|
||||
null,
|
||||
"default"
|
||||
);
|
||||
let matches = matchRoutesImpl(
|
||||
dataRoutes,
|
||||
location,
|
||||
basename,
|
||||
false,
|
||||
routeBranches
|
||||
);
|
||||
requestContext = requestContext != null ? requestContext : new RouterContextProvider();
|
||||
if (!isValidMethod(method) && method !== "HEAD" && method !== "OPTIONS") {
|
||||
throw getInternalRouterError(405, { method });
|
||||
@@ -1136,8 +1165,8 @@ function createStaticHandler(routes, opts) {
|
||||
let response = await runServerMiddlewarePipeline(
|
||||
{
|
||||
request,
|
||||
unstable_url: createDataFunctionUrl(request, location),
|
||||
unstable_pattern: getRoutePattern(matches),
|
||||
url: createDataFunctionUrl(request, location),
|
||||
pattern: getRoutePattern(matches),
|
||||
matches,
|
||||
params: matches[0].params,
|
||||
// If we're calling middleware then it must be enabled so we can cast
|
||||
@@ -1521,6 +1550,7 @@ function createStaticHandler(routes, opts) {
|
||||
}
|
||||
return {
|
||||
dataRoutes,
|
||||
_internalRouteBranches: routeBranches,
|
||||
query,
|
||||
queryRoute
|
||||
};
|
||||
@@ -1872,7 +1902,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request,
|
||||
handler: lazyRoutePromises.lazyHandlerPromise
|
||||
};
|
||||
}
|
||||
function getDataStrategyMatch(mapRouteProperties, manifest, request, path, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {
|
||||
function getDataStrategyMatch(mapRouteProperties, manifest, request, path, pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {
|
||||
let isUsingNewApi = false;
|
||||
let _lazyPromises = getDataStrategyMatchLazyPromises(
|
||||
mapRouteProperties,
|
||||
@@ -1907,7 +1937,7 @@ function getDataStrategyMatch(mapRouteProperties, manifest, request, path, unsta
|
||||
return callLoaderOrAction({
|
||||
request,
|
||||
path,
|
||||
unstable_pattern,
|
||||
pattern,
|
||||
match,
|
||||
lazyHandlerPromise: _lazyPromises?.handler,
|
||||
lazyRoutePromise: _lazyPromises?.route,
|
||||
@@ -1957,8 +1987,8 @@ async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fe
|
||||
}
|
||||
let dataStrategyArgs = {
|
||||
request,
|
||||
unstable_url: createDataFunctionUrl(request, path),
|
||||
unstable_pattern: getRoutePattern(matches),
|
||||
url: createDataFunctionUrl(request, path),
|
||||
pattern: getRoutePattern(matches),
|
||||
params: matches[0].params,
|
||||
context: scopedContext,
|
||||
matches
|
||||
@@ -1987,7 +2017,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fe
|
||||
async function callLoaderOrAction({
|
||||
request,
|
||||
path,
|
||||
unstable_pattern,
|
||||
pattern,
|
||||
match,
|
||||
lazyHandlerPromise,
|
||||
lazyRoutePromise,
|
||||
@@ -2014,8 +2044,8 @@ async function callLoaderOrAction({
|
||||
return handler(
|
||||
{
|
||||
request,
|
||||
unstable_url: createDataFunctionUrl(request, path),
|
||||
unstable_pattern,
|
||||
url: createDataFunctionUrl(request, path),
|
||||
pattern,
|
||||
params: match.params,
|
||||
context: scopedContext
|
||||
},
|
||||
@@ -2894,7 +2924,7 @@ async function generateResourceResponse(request, routes, basename, routeId, requ
|
||||
return generateErrorResponse(error);
|
||||
}
|
||||
},
|
||||
unstable_normalizePath: (r) => getNormalizedPath(r, basename, null)
|
||||
normalizePath: (r) => getNormalizedPath(r, basename, null)
|
||||
});
|
||||
return response;
|
||||
} catch (error) {
|
||||
@@ -2950,12 +2980,12 @@ async function generateRenderResponse(request, routes, basename, isDataRequest,
|
||||
skipLoaderErrorBubbling: isDataRequest,
|
||||
skipRevalidation: isSubmission,
|
||||
...routeIdsToLoad ? { filterMatchesToLoad: (m) => routeIdsToLoad.includes(m.route.id) } : {},
|
||||
unstable_normalizePath: (r) => getNormalizedPath(r, basename),
|
||||
normalizePath: (r) => getNormalizedPath(r, basename),
|
||||
async generateMiddlewareResponse(query) {
|
||||
let formState;
|
||||
let skipRevalidation = false;
|
||||
let potentialCSRFAttackError;
|
||||
if (request.method === "POST") {
|
||||
if (isMutationMethod(request.method)) {
|
||||
try {
|
||||
throwIfPotentialCSRFAttack(request.headers, allowedActionOrigins);
|
||||
ctx.runningAction = true;
|
||||
@@ -3463,7 +3493,7 @@ var unsign = async (cookie, secret) => {
|
||||
let signature = byteStringToUint8Array(atob(hash));
|
||||
let valid = await crypto.subtle.verify("HMAC", key, signature, data2);
|
||||
return valid ? value : false;
|
||||
} catch (error) {
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -3564,7 +3594,7 @@ function encodeData(value) {
|
||||
function decodeData(value) {
|
||||
try {
|
||||
return JSON.parse(decodeURIComponent(myEscape(atob(value))));
|
||||
} catch (error) {
|
||||
} catch (e) {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
+71
-41
@@ -6,7 +6,7 @@ export { BrowserRouter, Form, HashRouter, Link, Links, MemoryRouter, Meta, NavLi
|
||||
import { serialize, parse } from 'cookie';
|
||||
|
||||
/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
@@ -40,7 +40,7 @@ function warning(cond, message) {
|
||||
function createKey() {
|
||||
return Math.random().toString(36).substring(2, 10);
|
||||
}
|
||||
function createLocation(current, to, state = null, key, unstable_mask) {
|
||||
function createLocation(current, to, state = null, key, mask) {
|
||||
let location = {
|
||||
pathname: typeof current === "string" ? current : current.pathname,
|
||||
search: "",
|
||||
@@ -52,7 +52,7 @@ function createLocation(current, to, state = null, key, unstable_mask) {
|
||||
// But that's a pretty big refactor to the current test suite so going to
|
||||
// keep as is for the time being and just let any incoming keys take precedence
|
||||
key: to && to.key || key || createKey(),
|
||||
unstable_mask
|
||||
mask
|
||||
};
|
||||
return location;
|
||||
}
|
||||
@@ -232,11 +232,11 @@ async function recurseRight(impls, info, handler, index) {
|
||||
};
|
||||
}
|
||||
function getHandlerInfo(args) {
|
||||
let { request, context, params, unstable_pattern } = args;
|
||||
let { request, context, params, pattern } = args;
|
||||
return {
|
||||
request: getReadonlyRequest(request),
|
||||
params: { ...params },
|
||||
unstable_pattern,
|
||||
pattern,
|
||||
context: getReadonlyContext(context)
|
||||
};
|
||||
}
|
||||
@@ -406,17 +406,16 @@ function mergeRouteUpdates(route, updates) {
|
||||
function matchRoutes(routes, locationArg, basename = "/") {
|
||||
return matchRoutesImpl(routes, locationArg, basename, false);
|
||||
}
|
||||
function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
|
||||
function matchRoutesImpl(routes, locationArg, basename, allowPartial, precomputedBranches) {
|
||||
let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
||||
let pathname = stripBasename(location.pathname || "/", basename);
|
||||
if (pathname == null) {
|
||||
return null;
|
||||
}
|
||||
let branches = flattenRoutes(routes);
|
||||
rankRouteBranches(branches);
|
||||
let branches = precomputedBranches ?? flattenAndRankRoutes(routes);
|
||||
let matches = null;
|
||||
let decoded = decodePath(pathname);
|
||||
for (let i = 0; matches == null && i < branches.length; ++i) {
|
||||
let decoded = decodePath(pathname);
|
||||
matches = matchRouteBranch(
|
||||
branches[i],
|
||||
decoded,
|
||||
@@ -436,6 +435,11 @@ function convertRouteMatchToUiMatch(match, loaderData) {
|
||||
handle: route.handle
|
||||
};
|
||||
}
|
||||
function flattenAndRankRoutes(routes) {
|
||||
let branches = flattenRoutes(routes);
|
||||
rankRouteBranches(branches);
|
||||
return branches;
|
||||
}
|
||||
function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) {
|
||||
let flattenRoute = (route, index, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {
|
||||
let meta = {
|
||||
@@ -707,7 +711,7 @@ function resolvePath(to, fromPathname = "/") {
|
||||
} = typeof to === "string" ? parsePath(to) : to;
|
||||
let pathname;
|
||||
if (toPathname) {
|
||||
toPathname = toPathname.replace(/\/\/+/g, "/");
|
||||
toPathname = removeDoubleSlashes(toPathname);
|
||||
if (toPathname.startsWith("/")) {
|
||||
pathname = resolvePathname(toPathname.substring(1), "/");
|
||||
} else {
|
||||
@@ -723,7 +727,7 @@ function resolvePath(to, fromPathname = "/") {
|
||||
};
|
||||
}
|
||||
function resolvePathname(relativePath, fromPathname) {
|
||||
let segments = fromPathname.replace(/\/+$/, "").split("/");
|
||||
let segments = removeTrailingSlash(fromPathname).split("/");
|
||||
let relativeSegments = relativePath.split("/");
|
||||
relativeSegments.forEach((segment) => {
|
||||
if (segment === "..") {
|
||||
@@ -794,8 +798,10 @@ function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = fal
|
||||
}
|
||||
return path;
|
||||
}
|
||||
var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
|
||||
var normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
|
||||
var removeDoubleSlashes = (path) => path.replace(/\/\/+/g, "/");
|
||||
var joinPaths = (paths) => removeDoubleSlashes(paths.join("/"));
|
||||
var removeTrailingSlash = (path) => path.replace(/\/+$/, "");
|
||||
var normalizePathname = (pathname) => removeTrailingSlash(pathname).replace(/^\/*/, "/");
|
||||
var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
|
||||
var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
|
||||
var DataWithResponseInit = class {
|
||||
@@ -849,7 +855,8 @@ function isRouteErrorResponse(error) {
|
||||
return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
|
||||
}
|
||||
function getRoutePattern(matches) {
|
||||
return matches.map((m) => m.route.path).filter(Boolean).join("/").replace(/\/\/*/g, "/") || "/";
|
||||
let parts = matches.map((m) => m.route.path).filter(Boolean);
|
||||
return joinPaths(parts) || "/";
|
||||
}
|
||||
|
||||
// lib/router/router.ts
|
||||
@@ -882,11 +889,10 @@ function createStaticHandler(routes, opts) {
|
||||
let _mapRouteProperties = opts?.mapRouteProperties || defaultMapRouteProperties;
|
||||
let mapRouteProperties = _mapRouteProperties;
|
||||
({
|
||||
// unused in static handler
|
||||
...opts?.future
|
||||
});
|
||||
if (opts?.unstable_instrumentations) {
|
||||
let instrumentations = opts.unstable_instrumentations;
|
||||
if (opts?.instrumentations) {
|
||||
let instrumentations = opts.instrumentations;
|
||||
mapRouteProperties = (route) => {
|
||||
return {
|
||||
..._mapRouteProperties(route),
|
||||
@@ -903,6 +909,7 @@ function createStaticHandler(routes, opts) {
|
||||
void 0,
|
||||
manifest
|
||||
);
|
||||
let routeBranches = flattenAndRankRoutes(dataRoutes);
|
||||
async function query(request, {
|
||||
requestContext,
|
||||
filterMatchesToLoad,
|
||||
@@ -910,12 +917,23 @@ function createStaticHandler(routes, opts) {
|
||||
skipRevalidation,
|
||||
dataStrategy,
|
||||
generateMiddlewareResponse,
|
||||
unstable_normalizePath
|
||||
normalizePath
|
||||
} = {}) {
|
||||
let normalizePath = unstable_normalizePath || defaultNormalizePath;
|
||||
let normalizePathImpl = normalizePath || defaultNormalizePath;
|
||||
let method = request.method;
|
||||
let location = createLocation("", normalizePath(request), null, "default");
|
||||
let matches = matchRoutes(dataRoutes, location, basename);
|
||||
let location = createLocation(
|
||||
"",
|
||||
normalizePathImpl(request),
|
||||
null,
|
||||
"default"
|
||||
);
|
||||
let matches = matchRoutesImpl(
|
||||
dataRoutes,
|
||||
location,
|
||||
basename,
|
||||
false,
|
||||
routeBranches
|
||||
);
|
||||
requestContext = requestContext != null ? requestContext : new RouterContextProvider();
|
||||
if (!isValidMethod(method) && method !== "HEAD") {
|
||||
let error = getInternalRouterError(405, { method });
|
||||
@@ -967,8 +985,8 @@ function createStaticHandler(routes, opts) {
|
||||
let response = await runServerMiddlewarePipeline(
|
||||
{
|
||||
request,
|
||||
unstable_url: createDataFunctionUrl(request, location),
|
||||
unstable_pattern: getRoutePattern(matches),
|
||||
url: createDataFunctionUrl(request, location),
|
||||
pattern: getRoutePattern(matches),
|
||||
matches,
|
||||
params: matches[0].params,
|
||||
// If we're calling middleware then it must be enabled so we can cast
|
||||
@@ -1085,12 +1103,23 @@ function createStaticHandler(routes, opts) {
|
||||
requestContext,
|
||||
dataStrategy,
|
||||
generateMiddlewareResponse,
|
||||
unstable_normalizePath
|
||||
normalizePath
|
||||
} = {}) {
|
||||
let normalizePath = unstable_normalizePath || defaultNormalizePath;
|
||||
let normalizePathImpl = normalizePath || defaultNormalizePath;
|
||||
let method = request.method;
|
||||
let location = createLocation("", normalizePath(request), null, "default");
|
||||
let matches = matchRoutes(dataRoutes, location, basename);
|
||||
let location = createLocation(
|
||||
"",
|
||||
normalizePathImpl(request),
|
||||
null,
|
||||
"default"
|
||||
);
|
||||
let matches = matchRoutesImpl(
|
||||
dataRoutes,
|
||||
location,
|
||||
basename,
|
||||
false,
|
||||
routeBranches
|
||||
);
|
||||
requestContext = requestContext != null ? requestContext : new RouterContextProvider();
|
||||
if (!isValidMethod(method) && method !== "HEAD" && method !== "OPTIONS") {
|
||||
throw getInternalRouterError(405, { method });
|
||||
@@ -1115,8 +1144,8 @@ function createStaticHandler(routes, opts) {
|
||||
let response = await runServerMiddlewarePipeline(
|
||||
{
|
||||
request,
|
||||
unstable_url: createDataFunctionUrl(request, location),
|
||||
unstable_pattern: getRoutePattern(matches),
|
||||
url: createDataFunctionUrl(request, location),
|
||||
pattern: getRoutePattern(matches),
|
||||
matches,
|
||||
params: matches[0].params,
|
||||
// If we're calling middleware then it must be enabled so we can cast
|
||||
@@ -1500,6 +1529,7 @@ function createStaticHandler(routes, opts) {
|
||||
}
|
||||
return {
|
||||
dataRoutes,
|
||||
_internalRouteBranches: routeBranches,
|
||||
query,
|
||||
queryRoute
|
||||
};
|
||||
@@ -1851,7 +1881,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request,
|
||||
handler: lazyRoutePromises.lazyHandlerPromise
|
||||
};
|
||||
}
|
||||
function getDataStrategyMatch(mapRouteProperties, manifest, request, path, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {
|
||||
function getDataStrategyMatch(mapRouteProperties, manifest, request, path, pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {
|
||||
let isUsingNewApi = false;
|
||||
let _lazyPromises = getDataStrategyMatchLazyPromises(
|
||||
mapRouteProperties,
|
||||
@@ -1886,7 +1916,7 @@ function getDataStrategyMatch(mapRouteProperties, manifest, request, path, unsta
|
||||
return callLoaderOrAction({
|
||||
request,
|
||||
path,
|
||||
unstable_pattern,
|
||||
pattern,
|
||||
match,
|
||||
lazyHandlerPromise: _lazyPromises?.handler,
|
||||
lazyRoutePromise: _lazyPromises?.route,
|
||||
@@ -1936,8 +1966,8 @@ async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fe
|
||||
}
|
||||
let dataStrategyArgs = {
|
||||
request,
|
||||
unstable_url: createDataFunctionUrl(request, path),
|
||||
unstable_pattern: getRoutePattern(matches),
|
||||
url: createDataFunctionUrl(request, path),
|
||||
pattern: getRoutePattern(matches),
|
||||
params: matches[0].params,
|
||||
context: scopedContext,
|
||||
matches
|
||||
@@ -1966,7 +1996,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fe
|
||||
async function callLoaderOrAction({
|
||||
request,
|
||||
path,
|
||||
unstable_pattern,
|
||||
pattern,
|
||||
match,
|
||||
lazyHandlerPromise,
|
||||
lazyRoutePromise,
|
||||
@@ -1993,8 +2023,8 @@ async function callLoaderOrAction({
|
||||
return handler(
|
||||
{
|
||||
request,
|
||||
unstable_url: createDataFunctionUrl(request, path),
|
||||
unstable_pattern,
|
||||
url: createDataFunctionUrl(request, path),
|
||||
pattern,
|
||||
params: match.params,
|
||||
context: scopedContext
|
||||
},
|
||||
@@ -2873,7 +2903,7 @@ async function generateResourceResponse(request, routes, basename, routeId, requ
|
||||
return generateErrorResponse(error);
|
||||
}
|
||||
},
|
||||
unstable_normalizePath: (r) => getNormalizedPath(r, basename, null)
|
||||
normalizePath: (r) => getNormalizedPath(r, basename, null)
|
||||
});
|
||||
return response;
|
||||
} catch (error) {
|
||||
@@ -2929,12 +2959,12 @@ async function generateRenderResponse(request, routes, basename, isDataRequest,
|
||||
skipLoaderErrorBubbling: isDataRequest,
|
||||
skipRevalidation: isSubmission,
|
||||
...routeIdsToLoad ? { filterMatchesToLoad: (m) => routeIdsToLoad.includes(m.route.id) } : {},
|
||||
unstable_normalizePath: (r) => getNormalizedPath(r, basename),
|
||||
normalizePath: (r) => getNormalizedPath(r, basename),
|
||||
async generateMiddlewareResponse(query) {
|
||||
let formState;
|
||||
let skipRevalidation = false;
|
||||
let potentialCSRFAttackError;
|
||||
if (request.method === "POST") {
|
||||
if (isMutationMethod(request.method)) {
|
||||
try {
|
||||
throwIfPotentialCSRFAttack(request.headers, allowedActionOrigins);
|
||||
ctx.runningAction = true;
|
||||
@@ -3442,7 +3472,7 @@ var unsign = async (cookie, secret) => {
|
||||
let signature = byteStringToUint8Array(atob(hash));
|
||||
let valid = await crypto.subtle.verify("HMAC", key, signature, data2);
|
||||
return valid ? value : false;
|
||||
} catch (error) {
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -3543,7 +3573,7 @@ function encodeData(value) {
|
||||
function decodeData(value) {
|
||||
try {
|
||||
return JSON.parse(decodeURIComponent(myEscape(atob(value))));
|
||||
} catch (error) {
|
||||
} catch (e) {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
+101
-13
@@ -1,17 +1,17 @@
|
||||
import { X as RouteModules, z as DataStrategyFunction, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, T as To, Y as SerializeFrom, L as Location, Z as ParamParseKey, I as Path, _ as PathPattern, $ as PathMatch, U as UIMatch, v as Action, P as Params, r as RouteObject, G as GetLoaderData, l as GetActionData, J as InitialEntry, Q as IndexRouteObject, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, K as NonIndexRouteObject, a0 as Equal, B as PatchRoutesOnNavigationFunction, E as DataRouteObject, a as ClientLoaderFunction } from './routeModules-BRrCYrSL.mjs';
|
||||
export { a1 as ActionFunctionArgs, a2 as BaseRouteObject, C as ClientActionFunction, aq as ClientActionFunctionArgs, ar as ClientLoaderFunctionArgs, w as DataRouteMatch, a3 as DataStrategyFunctionArgs, a4 as DataStrategyMatch, D as DataStrategyResult, a6 as ErrorResponse, n as FormEncType, a7 as FormMethod, aw as Future, m as HTMLFormMethod, as as HeadersArgs, H as HeadersFunction, av as HtmlLinkDescriptor, O as LazyRouteFunction, e as LinkDescriptor, o as LoaderFunctionArgs, at as MetaArgs, g as MetaDescriptor, a8 as MiddlewareFunction, au as PageLinkDescriptor, a9 as PatchRoutesOnNavigationFunctionArgs, aa as PathParam, ab as RedirectFunction, V as RouteMatch, ac as RouterContext, S as ShouldRevalidateFunction, ad as ShouldRevalidateFunctionArgs, a5 as UNSAFE_DataWithResponseInit, aC as UNSAFE_ErrorResponseImpl, az as UNSAFE_createBrowserHistory, aA as UNSAFE_createHashHistory, ay as UNSAFE_createMemoryHistory, aB as UNSAFE_invariant, ae as createContext, af as createPath, ah as data, ai as generatePath, aj as isRouteErrorResponse, ak as matchPath, al as matchRoutes, ag as parsePath, am as redirect, an as redirectDocument, ao as replace, ap as resolvePath, ax as unstable_SerializesTo } from './routeModules-BRrCYrSL.mjs';
|
||||
import { b as Router, N as NavigateOptions, B as BlockerFunction, c as Blocker, d as RelativeRoutingType, e as Navigation, H as HydrationState, f as RouterState } from './context-phCt_zmH.mjs';
|
||||
export { K as Await, w as AwaitProps, C as ClientOnErrorFunction, F as Fetcher, G as GetScrollPositionFunction, g as GetScrollRestorationKeyFunction, t as IDLE_BLOCKER, s as IDLE_FETCHER, I as IDLE_NAVIGATION, x as IndexRouteProps, L as LayoutRouteProps, Q as MemoryRouter, M as MemoryRouterOpts, y as MemoryRouterProps, T as Navigate, z as NavigateProps, i as NavigationStates, v as Navigator, U as Outlet, O as OutletProps, P as PathRouteProps, m as RevalidationState, V as Route, D as RouteProps, W as Router, l as RouterFetchOptions, R as RouterInit, k as RouterNavigateOptions, E as RouterProps, X as RouterProvider, a as RouterProviderProps, j as RouterSubscriber, Y as Routes, J as RoutesProps, S as StaticHandler, h as StaticHandlerContext, A as UNSAFE_AwaitContextProvider, a2 as UNSAFE_DataRouterContext, a3 as UNSAFE_DataRouterStateContext, a4 as UNSAFE_FetchersContext, a5 as UNSAFE_LocationContext, a6 as UNSAFE_NavigationContext, a7 as UNSAFE_RouteContext, a8 as UNSAFE_ViewTransitionContext, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps, a1 as UNSAFE_createRouter, a9 as UNSAFE_hydrationRouteProperties, aa as UNSAFE_mapRouteProperties, ac as UNSAFE_withComponentProps, ag as UNSAFE_withErrorBoundaryProps, ae as UNSAFE_withHydrateFallbackProps, Z as createMemoryRouter, _ as createRoutesFromChildren, $ as createRoutesFromElements, a0 as renderMatches, u as unstable_ClientInstrumentation, o as unstable_InstrumentRequestHandlerFunction, q as unstable_InstrumentRouteFunction, p as unstable_InstrumentRouterFunction, r as unstable_InstrumentationHandlerResult, n as unstable_ServerInstrumentation } from './context-phCt_zmH.mjs';
|
||||
import { Z as RouteModules, z as DataStrategyFunction, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, T as To, L as Location, P as Params, U as UIMatch, v as Action, _ as SerializeFrom, $ as PathPattern, a0 as PathMatch, a1 as ParamParseKey, K as Path, r as RouteObject, G as GetLoaderData, l as GetActionData, O as InitialEntry, W as IndexRouteObject, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, Q as NonIndexRouteObject, a2 as Equal, B as PatchRoutesOnNavigationFunction, E as DataRouteObject, a as ClientLoaderFunction } from './data-U8FS-wNn.mjs';
|
||||
export { a3 as ActionFunctionArgs, a4 as BaseRouteObject, C as ClientActionFunction, as as ClientActionFunctionArgs, at as ClientLoaderFunctionArgs, w as DataRouteMatch, a5 as DataStrategyFunctionArgs, a6 as DataStrategyMatch, D as DataStrategyResult, a8 as ErrorResponse, n as FormEncType, a9 as FormMethod, ay as Future, m as HTMLFormMethod, au as HeadersArgs, H as HeadersFunction, ax as HtmlLinkDescriptor, V as LazyRouteFunction, e as LinkDescriptor, o as LoaderFunctionArgs, av as MetaArgs, g as MetaDescriptor, aa as MiddlewareFunction, aw as PageLinkDescriptor, ab as PatchRoutesOnNavigationFunctionArgs, ac as PathParam, ad as RedirectFunction, X as RouteMatch, ae as RouterContext, S as ShouldRevalidateFunction, af as ShouldRevalidateFunctionArgs, a7 as UNSAFE_DataWithResponseInit, aE as UNSAFE_ErrorResponseImpl, aB as UNSAFE_createBrowserHistory, aC as UNSAFE_createHashHistory, aA as UNSAFE_createMemoryHistory, aD as UNSAFE_invariant, ag as createContext, ah as createPath, aj as data, ak as generatePath, al as isRouteErrorResponse, am as matchPath, an as matchRoutes, ai as parsePath, ao as redirect, ap as redirectDocument, aq as replace, ar as resolvePath, az as unstable_SerializesTo } from './data-U8FS-wNn.mjs';
|
||||
import { c as Router, N as NavigateOptions, d as NavigationStates, B as BlockerFunction, e as Blocker, f as RelativeRoutingType, H as HydrationState, g as RouterState } from './context-CmHpk1Ws.mjs';
|
||||
export { K as Await, w as AwaitProps, C as ClientInstrumentation, b as ClientOnErrorFunction, F as Fetcher, G as GetScrollPositionFunction, h as GetScrollRestorationKeyFunction, u as IDLE_BLOCKER, t as IDLE_FETCHER, s as IDLE_NAVIGATION, x as IndexRouteProps, I as InstrumentRequestHandlerFunction, q as InstrumentRouteFunction, p as InstrumentRouterFunction, r as InstrumentationHandlerResult, L as LayoutRouteProps, Q as MemoryRouter, M as MemoryRouterOpts, y as MemoryRouterProps, T as Navigate, z as NavigateProps, j as Navigation, v as Navigator, U as Outlet, O as OutletProps, P as PathRouteProps, n as RevalidationState, V as Route, D as RouteProps, W as Router, m as RouterFetchOptions, R as RouterInit, l as RouterNavigateOptions, E as RouterProps, X as RouterProvider, a as RouterProviderProps, k as RouterSubscriber, Y as Routes, J as RoutesProps, o as ServerInstrumentation, S as StaticHandler, i as StaticHandlerContext, A as UNSAFE_AwaitContextProvider, a2 as UNSAFE_DataRouterContext, a3 as UNSAFE_DataRouterStateContext, a4 as UNSAFE_FetchersContext, a5 as UNSAFE_LocationContext, a6 as UNSAFE_NavigationContext, a7 as UNSAFE_RouteContext, a8 as UNSAFE_ViewTransitionContext, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps, a1 as UNSAFE_createRouter, a9 as UNSAFE_hydrationRouteProperties, aa as UNSAFE_mapRouteProperties, ac as UNSAFE_withComponentProps, ag as UNSAFE_withErrorBoundaryProps, ae as UNSAFE_withHydrateFallbackProps, Z as createMemoryRouter, _ as createRoutesFromChildren, $ as createRoutesFromElements, a0 as renderMatches } from './context-CmHpk1Ws.mjs';
|
||||
import * as React from 'react';
|
||||
import React__default, { ReactElement } from 'react';
|
||||
import { a as RouteModules$1, P as Pages } from './register-CTxsJBKQ.mjs';
|
||||
export { b as Register } from './register-CTxsJBKQ.mjs';
|
||||
import { A as AssetsManifest, S as ServerBuild, E as EntryContext, F as FutureConfig } from './index-react-server-client-BwWaHAr3.mjs';
|
||||
export { l as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, a1 as DiscoverBehavior, c as FetcherFormProps, h as FetcherSubmitFunction, G as FetcherSubmitOptions, i as FetcherWithComponents, q as Form, d as FormProps, a2 as HandleDataRequestFunction, a3 as HandleDocumentRequestFunction, a4 as HandleErrorFunction, m as HashRouter, H as HashRouterProps, a as HistoryRouterProps, n as Link, L as LinkProps, X as Links, _ as LinksProps, W as Meta, p as NavLink, N as NavLinkProps, b as NavLinkRenderProps, P as ParamKeyValuePair, a0 as PrefetchBehavior, Z as PrefetchPageLinks, Y as Scripts, $ as ScriptsProps, r as ScrollRestoration, e as ScrollRestorationProps, a5 as ServerEntryModule, f as SetURLSearchParams, T as StaticRouter, M as StaticRouterProps, V as StaticRouterProvider, O as StaticRouterProviderProps, g as SubmitFunction, I as SubmitOptions, J as SubmitTarget, a6 as UNSAFE_FrameworkContext, a7 as UNSAFE_createClientRoutes, a8 as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, a9 as UNSAFE_shouldHydrateRouteLoader, aa as UNSAFE_useScrollRestoration, U as URLSearchParamsInit, j as createBrowserRouter, k as createHashRouter, K as createSearchParams, Q as createStaticHandler, R as createStaticRouter, o as unstable_HistoryRouter, z as unstable_usePrompt, y as useBeforeUnload, w as useFetcher, x as useFetchers, v as useFormAction, u as useLinkClickHandler, s as useSearchParams, t as useSubmit, C as useViewTransitionState } from './index-react-server-client-BwWaHAr3.mjs';
|
||||
import { a as RouteModules$1, P as Pages } from './register-CqK96Zfk.mjs';
|
||||
export { b as Register } from './register-CqK96Zfk.mjs';
|
||||
import { A as AssetsManifest, S as ServerBuild, E as EntryContext, F as FutureConfig } from './index-react-server-client-DPrDrCew.mjs';
|
||||
export { l as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, a1 as DiscoverBehavior, c as FetcherFormProps, h as FetcherSubmitFunction, G as FetcherSubmitOptions, i as FetcherWithComponents, q as Form, d as FormProps, a2 as HandleDataRequestFunction, a3 as HandleDocumentRequestFunction, a4 as HandleErrorFunction, m as HashRouter, H as HashRouterProps, a as HistoryRouterProps, n as Link, L as LinkProps, X as Links, _ as LinksProps, W as Meta, p as NavLink, N as NavLinkProps, b as NavLinkRenderProps, P as ParamKeyValuePair, a0 as PrefetchBehavior, Z as PrefetchPageLinks, Y as Scripts, $ as ScriptsProps, r as ScrollRestoration, e as ScrollRestorationProps, a5 as ServerEntryModule, f as SetURLSearchParams, T as StaticRouter, M as StaticRouterProps, V as StaticRouterProvider, O as StaticRouterProviderProps, g as SubmitFunction, I as SubmitOptions, J as SubmitTarget, a6 as UNSAFE_FrameworkContext, a7 as UNSAFE_createClientRoutes, a8 as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, a9 as UNSAFE_shouldHydrateRouteLoader, aa as UNSAFE_useScrollRestoration, U as URLSearchParamsInit, j as createBrowserRouter, k as createHashRouter, K as createSearchParams, Q as createStaticHandler, R as createStaticRouter, o as unstable_HistoryRouter, z as unstable_usePrompt, y as useBeforeUnload, w as useFetcher, x as useFetchers, v as useFormAction, u as useLinkClickHandler, s as useSearchParams, t as useSubmit, C as useViewTransitionState } from './index-react-server-client-DPrDrCew.mjs';
|
||||
import { ParseOptions, SerializeOptions } from 'cookie';
|
||||
export { ParseOptions as CookieParseOptions, SerializeOptions as CookieSerializeOptions } from 'cookie';
|
||||
import { e as RSCPayload, g as getRequest, m as matchRSCServerRequest } from './browser-vtIR1Kpe.mjs';
|
||||
export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, h as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, i as unstable_RSCMatch, f as unstable_RSCRenderPayload, n as unstable_RSCRouteConfig, l as unstable_RSCRouteConfigEntry, j as unstable_RSCRouteManifest, k as unstable_RSCRouteMatch } from './browser-vtIR1Kpe.mjs';
|
||||
import { e as RSCPayload, g as getRequest, m as matchRSCServerRequest } from './browser-CGcs-0pD.mjs';
|
||||
export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, h as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, i as unstable_RSCMatch, f as unstable_RSCRenderPayload, n as unstable_RSCRouteConfig, l as unstable_RSCRouteConfigEntry, j as unstable_RSCRouteManifest, k as unstable_RSCRouteMatch } from './browser-CGcs-0pD.mjs';
|
||||
|
||||
declare const SingleFetchRedirectSymbol: unique symbol;
|
||||
declare function getTurboStreamSingleFetchDataStrategy(getRouter: () => Router, manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, basename: string | undefined, trailingSlashAware: boolean): DataStrategyFunction;
|
||||
@@ -113,7 +113,7 @@ declare function useNavigationType(): Action;
|
||||
* @param pattern The pattern to match against the current {@link Location}
|
||||
* @returns The path match object if the pattern matches, `null` otherwise
|
||||
*/
|
||||
declare function useMatch<ParamKey extends ParamParseKey<Path>, Path extends string>(pattern: PathPattern<Path> | Path): PathMatch<ParamKey> | null;
|
||||
declare function useMatch<Path extends string>(pattern: PathPattern<Path> | Path): PathMatch<ParamParseKey<Path>> | null;
|
||||
/**
|
||||
* The interface for the `navigate` function returned from {@link useNavigate}.
|
||||
*/
|
||||
@@ -526,6 +526,12 @@ declare function useResolvedPath(to: To, { relative }?: {
|
||||
* @returns A React element to render the matched route, or `null` if no routes matched
|
||||
*/
|
||||
declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location> | string): React.ReactElement | null;
|
||||
type UseNavigationResult = UseNavigationResultStates[keyof UseNavigationResultStates];
|
||||
type UseNavigationResultStates = {
|
||||
Idle: Omit<NavigationStates["Idle"], "matches" | "historyAction">;
|
||||
Loading: Omit<NavigationStates["Loading"], "matches" | "historyAction">;
|
||||
Submitting: Omit<NavigationStates["Submitting"], "matches" | "historyAction">;
|
||||
};
|
||||
/**
|
||||
* Returns the current {@link Navigation}, defaulting to an "idle" navigation
|
||||
* when no navigation is in progress. You can use this to render pending UI
|
||||
@@ -548,7 +554,7 @@ declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location
|
||||
* @mode data
|
||||
* @returns The current {@link Navigation} object
|
||||
*/
|
||||
declare function useNavigation(): Navigation;
|
||||
declare function useNavigation(): UseNavigationResult;
|
||||
/**
|
||||
* Revalidate the data on the page for reasons outside of normal data mutations
|
||||
* like [`Window` focus](https://developer.mozilla.org/en-US/docs/Web/API/Window/focus_event)
|
||||
@@ -878,6 +884,88 @@ type UseRoute<RouteId extends keyof RouteModules$1 | unknown> = {
|
||||
actionData: RouteId extends keyof RouteModules$1 ? GetActionData<RouteModules$1[RouteId]> | undefined : unknown;
|
||||
};
|
||||
declare function useRoute<Args extends UseRouteArgs>(...args: Args): UseRouteResult<Args>;
|
||||
/**
|
||||
* A single route match returned from {@link unstable_useRouterState}. Mirrors
|
||||
* {@link UIMatch} minus the data-related fields (`data`, `loaderData`).
|
||||
*/
|
||||
type unstable_RouterStateMatch<Handle = unknown> = Omit<UIMatch<unknown, Handle>, "data" | "loaderData">;
|
||||
/**
|
||||
* The shape of the `active` variant returned from
|
||||
* {@link unstable_useRouterState}.
|
||||
*/
|
||||
type unstable_RouterStateActiveVariant = {
|
||||
location: Location;
|
||||
searchParams: URLSearchParams;
|
||||
params: Params;
|
||||
matches: unstable_RouterStateMatch[];
|
||||
type: Action;
|
||||
};
|
||||
/**
|
||||
* The shape of the `pending` variant returned from
|
||||
* {@link unstable_useRouterState}. Extends
|
||||
* {@link unstable_RouterStateActiveVariant} with the navigation `state` and
|
||||
* submission fields mirroring {@link useNavigation} — submission fields are
|
||||
* populated when the in-flight navigation was triggered by a form submission,
|
||||
* otherwise `undefined`.
|
||||
*/
|
||||
type unstable_RouterStatePendingVariant = unstable_RouterStatePendingVariants[keyof unstable_RouterStatePendingVariants];
|
||||
type unstable_RouterStatePendingVariants = {
|
||||
Loading: unstable_RouterStateActiveVariant & Omit<NavigationStates["Loading"], "matches" | "historyAction">;
|
||||
Submitting: unstable_RouterStateActiveVariant & Omit<NavigationStates["Submitting"], "matches" | "historyAction">;
|
||||
};
|
||||
/**
|
||||
* The return shape of {@link unstable_useRouterState}.
|
||||
*
|
||||
* `active` reflects the currently-committed location. `pending` reflects the
|
||||
* in-flight navigation (if any).
|
||||
*/
|
||||
type unstable_RouterState = {
|
||||
active: unstable_RouterStateActiveVariant;
|
||||
pending: unstable_RouterStatePendingVariant | null;
|
||||
};
|
||||
/**
|
||||
* A unified hook for reading router state: current (`active`) and in-flight
|
||||
* (`pending`) locations, search params, params, matches, and navigation type.
|
||||
*
|
||||
* This hook consolidates the information you used to get from {@link useLocation},
|
||||
* {@link useSearchParams}, {@link useParams}, {@link useMatches}, {@link useNavigation},
|
||||
* and {@link useNavigationType} into a single hook.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* import { unstable_useRouterState as useRouterState } from "react-router";
|
||||
*
|
||||
* let { active, pending } = unstable_useRouterState();
|
||||
*
|
||||
* // Active is always populated with the current location
|
||||
* active.location; // replaces `useLocation()`
|
||||
* active.searchParams; // replaces `useSearchParams()[0]`
|
||||
* active.params; // replaces `useParams()`
|
||||
* active.matches; // replaces `useMatches()`
|
||||
* active.type; // replaces `useNavigationType()`
|
||||
*
|
||||
* // Pending is only populated during a navigation
|
||||
* pending.location; // replaces `useNavigation().location`
|
||||
* pending.searchParams; // equivalent to `new URLSearchParams(useNavigation().search)`
|
||||
* pending.params; // Not directly accessible today
|
||||
* pending.matches; // Not directly accessible today
|
||||
* pending.type; // Not directly accessible today
|
||||
* pending.state; // replaces `useNavigation().state`
|
||||
* pending.formMethod; // replaces useNavigation().formMethod
|
||||
* pending.formAction; // replaces useNavigation().formAction
|
||||
* pending.formEncType; // replaces useNavigation().formEncType
|
||||
* pending.formData; // replaces useNavigation().formData
|
||||
* pending.json; // replaces useNavigation().json
|
||||
* pending.text; // replaces useNavigation().text
|
||||
*
|
||||
* @name unstable_useRouterState
|
||||
* @public
|
||||
* @category Hooks
|
||||
* @mode framework
|
||||
* @mode data
|
||||
* @returns The current router state with `active` and `pending` variants
|
||||
*/
|
||||
declare function useRouterState(): unstable_RouterState;
|
||||
|
||||
/**
|
||||
* @category Types
|
||||
@@ -1387,4 +1475,4 @@ declare function getHydrationData({ state, routes, getRouteInfo, location, basen
|
||||
declare const unstable_getRequest: typeof getRequest;
|
||||
declare const unstable_matchRSCServerRequest: typeof matchRSCServerRequest;
|
||||
|
||||
export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, Navigation, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|
||||
export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, NavigationStates, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type unstable_RouterState, type unstable_RouterStateActiveVariant, type unstable_RouterStatePendingVariant, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|
||||
|
||||
+101
-13
@@ -1,17 +1,17 @@
|
||||
import { J as RouteModules, l as DataStrategyFunction, r as MiddlewareEnabled, c as RouterContextProvider, s as AppLoadContext, T as To, K as SerializeFrom, L as Location, O as ParamParseKey, p as Path, Q as PathPattern, V as PathMatch, U as UIMatch, i as Action, P as Params, e as RouteObject, G as GetLoaderData, I as GetActionData, W as InitialEntry, X as IndexRouteObject, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, Y as NonIndexRouteObject, Z as Equal, m as PatchRoutesOnNavigationFunction, n as DataRouteObject, a as ClientLoaderFunction } from './routeModules-CA7kSxJJ.js';
|
||||
export { _ as ActionFunctionArgs, $ as BaseRouteObject, C as ClientActionFunction, ap as ClientActionFunctionArgs, aq as ClientLoaderFunctionArgs, D as DataRouteMatch, a0 as DataStrategyFunctionArgs, a1 as DataStrategyMatch, B as DataStrategyResult, a3 as ErrorResponse, F as FormEncType, a4 as FormMethod, av as Future, o as HTMLFormMethod, ar as HeadersArgs, H as HeadersFunction, au as HtmlLinkDescriptor, a5 as LazyRouteFunction, t as LinkDescriptor, q as LoaderFunctionArgs, as as MetaArgs, w as MetaDescriptor, a6 as MiddlewareFunction, at as PageLinkDescriptor, a7 as PatchRoutesOnNavigationFunctionArgs, a8 as PathParam, a9 as RedirectFunction, aa as RouteMatch, ab as RouterContext, S as ShouldRevalidateFunction, ac as ShouldRevalidateFunctionArgs, a2 as UNSAFE_DataWithResponseInit, aB as UNSAFE_ErrorResponseImpl, ay as UNSAFE_createBrowserHistory, az as UNSAFE_createHashHistory, ax as UNSAFE_createMemoryHistory, aA as UNSAFE_invariant, ad as createContext, ae as createPath, ag as data, ah as generatePath, ai as isRouteErrorResponse, aj as matchPath, ak as matchRoutes, af as parsePath, al as redirect, am as redirectDocument, an as replace, ao as resolvePath, aw as unstable_SerializesTo } from './routeModules-CA7kSxJJ.js';
|
||||
import { a as Router, B as BlockerFunction, b as Blocker, c as RelativeRoutingType, N as Navigation, H as HydrationState, d as RouterState } from './instrumentation-BYr6ff5D.js';
|
||||
export { F as Fetcher, G as GetScrollPositionFunction, e as GetScrollRestorationKeyFunction, r as IDLE_BLOCKER, q as IDLE_FETCHER, I as IDLE_NAVIGATION, g as NavigationStates, k as RevalidationState, j as RouterFetchOptions, R as RouterInit, i as RouterNavigateOptions, h as RouterSubscriber, S as StaticHandler, f as StaticHandlerContext, s as UNSAFE_createRouter, u as unstable_ClientInstrumentation, m as unstable_InstrumentRequestHandlerFunction, o as unstable_InstrumentRouteFunction, n as unstable_InstrumentRouterFunction, p as unstable_InstrumentationHandlerResult, l as unstable_ServerInstrumentation } from './instrumentation-BYr6ff5D.js';
|
||||
import { A as AssetsManifest, S as ServerBuild, N as NavigateOptions, E as EntryContext, F as FutureConfig } from './index-react-server-client-luDbagNU.js';
|
||||
export { i as Await, c as AwaitProps, W as BrowserRouter, B as BrowserRouterProps, C as ClientOnErrorFunction, D as DOMRouterOpts, at as DiscoverBehavior, y as FetcherFormProps, Q as FetcherSubmitFunction, aa as FetcherSubmitOptions, T as FetcherWithComponents, $ as Form, z as FormProps, au as HandleDataRequestFunction, av as HandleDocumentRequestFunction, aw as HandleErrorFunction, X as HashRouter, H as HashRouterProps, u as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, Y as Link, v as LinkProps, an as Links, aq as LinksProps, j as MemoryRouter, M as MemoryRouterOpts, d as MemoryRouterProps, am as Meta, _ as NavLink, w as NavLinkProps, x as NavLinkRenderProps, k as Navigate, e as NavigateProps, a as Navigator, l as Outlet, O as OutletProps, ab as ParamKeyValuePair, P as PathRouteProps, as as PrefetchBehavior, ap as PrefetchPageLinks, m as Route, R as RouteProps, n as Router, f as RouterProps, o as RouterProvider, g as RouterProviderProps, p as Routes, h as RoutesProps, ao as Scripts, ar as ScriptsProps, a0 as ScrollRestoration, G as ScrollRestorationProps, ax as ServerEntryModule, J as SetURLSearchParams, ak as StaticRouter, ag as StaticRouterProps, al as StaticRouterProvider, ah as StaticRouterProviderProps, K as SubmitFunction, ac as SubmitOptions, ae as SubmitTarget, b as UNSAFE_AwaitContextProvider, ay as UNSAFE_DataRouterContext, az as UNSAFE_DataRouterStateContext, aA as UNSAFE_FetchersContext, aN as UNSAFE_FrameworkContext, aB as UNSAFE_LocationContext, aC as UNSAFE_NavigationContext, aD as UNSAFE_RouteContext, aE as UNSAFE_ViewTransitionContext, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, aO as UNSAFE_createClientRoutes, aP as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, aF as UNSAFE_hydrationRouteProperties, aG as UNSAFE_mapRouteProperties, aQ as UNSAFE_shouldHydrateRouteLoader, aR as UNSAFE_useScrollRestoration, aI as UNSAFE_withComponentProps, aM as UNSAFE_withErrorBoundaryProps, aK as UNSAFE_withHydrateFallbackProps, ad as URLSearchParamsInit, U as createBrowserRouter, V as createHashRouter, q as createMemoryRouter, r as createRoutesFromChildren, s as createRoutesFromElements, af as createSearchParams, ai as createStaticHandler, aj as createStaticRouter, t as renderMatches, Z as unstable_HistoryRouter, a8 as unstable_usePrompt, a7 as useBeforeUnload, a5 as useFetcher, a6 as useFetchers, a4 as useFormAction, a1 as useLinkClickHandler, a2 as useSearchParams, a3 as useSubmit, a9 as useViewTransitionState } from './index-react-server-client-luDbagNU.js';
|
||||
import { O as RouteModules, l as DataStrategyFunction, t as MiddlewareEnabled, c as RouterContextProvider, u as AppLoadContext, T as To, L as Location, P as Params, U as UIMatch, i as Action, Q as SerializeFrom, V as PathPattern, W as PathMatch, X as ParamParseKey, r as Path, e as RouteObject, G as GetLoaderData, K as GetActionData, Y as InitialEntry, Z as IndexRouteObject, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, _ as NonIndexRouteObject, $ as Equal, m as PatchRoutesOnNavigationFunction, n as DataRouteObject, a as ClientLoaderFunction } from './data-D4xhSy90.js';
|
||||
export { a0 as ActionFunctionArgs, a1 as BaseRouteObject, C as ClientActionFunction, ar as ClientActionFunctionArgs, as as ClientLoaderFunctionArgs, D as DataRouteMatch, a2 as DataStrategyFunctionArgs, a3 as DataStrategyMatch, I as DataStrategyResult, a5 as ErrorResponse, F as FormEncType, a6 as FormMethod, ax as Future, q as HTMLFormMethod, at as HeadersArgs, H as HeadersFunction, aw as HtmlLinkDescriptor, a7 as LazyRouteFunction, v as LinkDescriptor, s as LoaderFunctionArgs, au as MetaArgs, y as MetaDescriptor, a8 as MiddlewareFunction, av as PageLinkDescriptor, a9 as PatchRoutesOnNavigationFunctionArgs, aa as PathParam, ab as RedirectFunction, ac as RouteMatch, ad as RouterContext, S as ShouldRevalidateFunction, ae as ShouldRevalidateFunctionArgs, a4 as UNSAFE_DataWithResponseInit, aD as UNSAFE_ErrorResponseImpl, aA as UNSAFE_createBrowserHistory, aB as UNSAFE_createHashHistory, az as UNSAFE_createMemoryHistory, aC as UNSAFE_invariant, af as createContext, ag as createPath, ai as data, aj as generatePath, ak as isRouteErrorResponse, al as matchPath, am as matchRoutes, ah as parsePath, an as redirect, ao as redirectDocument, ap as replace, aq as resolvePath, ay as unstable_SerializesTo } from './data-D4xhSy90.js';
|
||||
import { a as Router, N as NavigationStates, B as BlockerFunction, b as Blocker, c as RelativeRoutingType, H as HydrationState, d as RouterState } from './instrumentation-1q4YhLGP.js';
|
||||
export { C as ClientInstrumentation, F as Fetcher, G as GetScrollPositionFunction, e as GetScrollRestorationKeyFunction, r as IDLE_BLOCKER, q as IDLE_FETCHER, p as IDLE_NAVIGATION, I as InstrumentRequestHandlerFunction, n as InstrumentRouteFunction, m as InstrumentRouterFunction, o as InstrumentationHandlerResult, g as Navigation, k as RevalidationState, j as RouterFetchOptions, R as RouterInit, i as RouterNavigateOptions, h as RouterSubscriber, l as ServerInstrumentation, S as StaticHandler, f as StaticHandlerContext, s as UNSAFE_createRouter } from './instrumentation-1q4YhLGP.js';
|
||||
import { A as AssetsManifest, S as ServerBuild, N as NavigateOptions, E as EntryContext, F as FutureConfig } from './index-react-server-client-CwU9bE5R.js';
|
||||
export { i as Await, c as AwaitProps, W as BrowserRouter, B as BrowserRouterProps, C as ClientOnErrorFunction, D as DOMRouterOpts, at as DiscoverBehavior, y as FetcherFormProps, Q as FetcherSubmitFunction, aa as FetcherSubmitOptions, T as FetcherWithComponents, $ as Form, z as FormProps, au as HandleDataRequestFunction, av as HandleDocumentRequestFunction, aw as HandleErrorFunction, X as HashRouter, H as HashRouterProps, u as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, Y as Link, v as LinkProps, an as Links, aq as LinksProps, j as MemoryRouter, M as MemoryRouterOpts, d as MemoryRouterProps, am as Meta, _ as NavLink, w as NavLinkProps, x as NavLinkRenderProps, k as Navigate, e as NavigateProps, a as Navigator, l as Outlet, O as OutletProps, ab as ParamKeyValuePair, P as PathRouteProps, as as PrefetchBehavior, ap as PrefetchPageLinks, m as Route, R as RouteProps, n as Router, f as RouterProps, o as RouterProvider, g as RouterProviderProps, p as Routes, h as RoutesProps, ao as Scripts, ar as ScriptsProps, a0 as ScrollRestoration, G as ScrollRestorationProps, ax as ServerEntryModule, J as SetURLSearchParams, ak as StaticRouter, ag as StaticRouterProps, al as StaticRouterProvider, ah as StaticRouterProviderProps, K as SubmitFunction, ac as SubmitOptions, ae as SubmitTarget, b as UNSAFE_AwaitContextProvider, ay as UNSAFE_DataRouterContext, az as UNSAFE_DataRouterStateContext, aA as UNSAFE_FetchersContext, aN as UNSAFE_FrameworkContext, aB as UNSAFE_LocationContext, aC as UNSAFE_NavigationContext, aD as UNSAFE_RouteContext, aE as UNSAFE_ViewTransitionContext, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, aO as UNSAFE_createClientRoutes, aP as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, aF as UNSAFE_hydrationRouteProperties, aG as UNSAFE_mapRouteProperties, aQ as UNSAFE_shouldHydrateRouteLoader, aR as UNSAFE_useScrollRestoration, aI as UNSAFE_withComponentProps, aM as UNSAFE_withErrorBoundaryProps, aK as UNSAFE_withHydrateFallbackProps, ad as URLSearchParamsInit, U as createBrowserRouter, V as createHashRouter, q as createMemoryRouter, r as createRoutesFromChildren, s as createRoutesFromElements, af as createSearchParams, ai as createStaticHandler, aj as createStaticRouter, t as renderMatches, Z as unstable_HistoryRouter, a8 as unstable_usePrompt, a7 as useBeforeUnload, a5 as useFetcher, a6 as useFetchers, a4 as useFormAction, a1 as useLinkClickHandler, a2 as useSearchParams, a3 as useSubmit, a9 as useViewTransitionState } from './index-react-server-client-CwU9bE5R.js';
|
||||
import * as React from 'react';
|
||||
import React__default, { ReactElement } from 'react';
|
||||
import { a as RouteModules$1, P as Pages } from './register-CkcGwv27.js';
|
||||
export { b as Register } from './register-CkcGwv27.js';
|
||||
import { a as RouteModules$1, P as Pages } from './register-CNAx3TXj.js';
|
||||
export { b as Register } from './register-CNAx3TXj.js';
|
||||
import { ParseOptions, SerializeOptions } from 'cookie';
|
||||
export { ParseOptions as CookieParseOptions, SerializeOptions as CookieSerializeOptions } from 'cookie';
|
||||
import { e as RSCPayload, g as getRequest, m as matchRSCServerRequest } from './browser-C9Ar1yxG.js';
|
||||
export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, h as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, i as unstable_RSCMatch, f as unstable_RSCRenderPayload, n as unstable_RSCRouteConfig, l as unstable_RSCRouteConfigEntry, j as unstable_RSCRouteManifest, k as unstable_RSCRouteMatch } from './browser-C9Ar1yxG.js';
|
||||
import { e as RSCPayload, g as getRequest, m as matchRSCServerRequest } from './browser-D3uq9sI1.js';
|
||||
export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, h as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, i as unstable_RSCMatch, f as unstable_RSCRenderPayload, n as unstable_RSCRouteConfig, l as unstable_RSCRouteConfigEntry, j as unstable_RSCRouteManifest, k as unstable_RSCRouteMatch } from './browser-D3uq9sI1.js';
|
||||
|
||||
declare const SingleFetchRedirectSymbol: unique symbol;
|
||||
declare function getTurboStreamSingleFetchDataStrategy(getRouter: () => Router, manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, basename: string | undefined, trailingSlashAware: boolean): DataStrategyFunction;
|
||||
@@ -113,7 +113,7 @@ declare function useNavigationType(): Action;
|
||||
* @param pattern The pattern to match against the current {@link Location}
|
||||
* @returns The path match object if the pattern matches, `null` otherwise
|
||||
*/
|
||||
declare function useMatch<ParamKey extends ParamParseKey<Path>, Path extends string>(pattern: PathPattern<Path> | Path): PathMatch<ParamKey> | null;
|
||||
declare function useMatch<Path extends string>(pattern: PathPattern<Path> | Path): PathMatch<ParamParseKey<Path>> | null;
|
||||
/**
|
||||
* The interface for the `navigate` function returned from {@link useNavigate}.
|
||||
*/
|
||||
@@ -526,6 +526,12 @@ declare function useResolvedPath(to: To, { relative }?: {
|
||||
* @returns A React element to render the matched route, or `null` if no routes matched
|
||||
*/
|
||||
declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location> | string): React.ReactElement | null;
|
||||
type UseNavigationResult = UseNavigationResultStates[keyof UseNavigationResultStates];
|
||||
type UseNavigationResultStates = {
|
||||
Idle: Omit<NavigationStates["Idle"], "matches" | "historyAction">;
|
||||
Loading: Omit<NavigationStates["Loading"], "matches" | "historyAction">;
|
||||
Submitting: Omit<NavigationStates["Submitting"], "matches" | "historyAction">;
|
||||
};
|
||||
/**
|
||||
* Returns the current {@link Navigation}, defaulting to an "idle" navigation
|
||||
* when no navigation is in progress. You can use this to render pending UI
|
||||
@@ -548,7 +554,7 @@ declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location
|
||||
* @mode data
|
||||
* @returns The current {@link Navigation} object
|
||||
*/
|
||||
declare function useNavigation(): Navigation;
|
||||
declare function useNavigation(): UseNavigationResult;
|
||||
/**
|
||||
* Revalidate the data on the page for reasons outside of normal data mutations
|
||||
* like [`Window` focus](https://developer.mozilla.org/en-US/docs/Web/API/Window/focus_event)
|
||||
@@ -878,6 +884,88 @@ type UseRoute<RouteId extends keyof RouteModules$1 | unknown> = {
|
||||
actionData: RouteId extends keyof RouteModules$1 ? GetActionData<RouteModules$1[RouteId]> | undefined : unknown;
|
||||
};
|
||||
declare function useRoute<Args extends UseRouteArgs>(...args: Args): UseRouteResult<Args>;
|
||||
/**
|
||||
* A single route match returned from {@link unstable_useRouterState}. Mirrors
|
||||
* {@link UIMatch} minus the data-related fields (`data`, `loaderData`).
|
||||
*/
|
||||
type unstable_RouterStateMatch<Handle = unknown> = Omit<UIMatch<unknown, Handle>, "data" | "loaderData">;
|
||||
/**
|
||||
* The shape of the `active` variant returned from
|
||||
* {@link unstable_useRouterState}.
|
||||
*/
|
||||
type unstable_RouterStateActiveVariant = {
|
||||
location: Location;
|
||||
searchParams: URLSearchParams;
|
||||
params: Params;
|
||||
matches: unstable_RouterStateMatch[];
|
||||
type: Action;
|
||||
};
|
||||
/**
|
||||
* The shape of the `pending` variant returned from
|
||||
* {@link unstable_useRouterState}. Extends
|
||||
* {@link unstable_RouterStateActiveVariant} with the navigation `state` and
|
||||
* submission fields mirroring {@link useNavigation} — submission fields are
|
||||
* populated when the in-flight navigation was triggered by a form submission,
|
||||
* otherwise `undefined`.
|
||||
*/
|
||||
type unstable_RouterStatePendingVariant = unstable_RouterStatePendingVariants[keyof unstable_RouterStatePendingVariants];
|
||||
type unstable_RouterStatePendingVariants = {
|
||||
Loading: unstable_RouterStateActiveVariant & Omit<NavigationStates["Loading"], "matches" | "historyAction">;
|
||||
Submitting: unstable_RouterStateActiveVariant & Omit<NavigationStates["Submitting"], "matches" | "historyAction">;
|
||||
};
|
||||
/**
|
||||
* The return shape of {@link unstable_useRouterState}.
|
||||
*
|
||||
* `active` reflects the currently-committed location. `pending` reflects the
|
||||
* in-flight navigation (if any).
|
||||
*/
|
||||
type unstable_RouterState = {
|
||||
active: unstable_RouterStateActiveVariant;
|
||||
pending: unstable_RouterStatePendingVariant | null;
|
||||
};
|
||||
/**
|
||||
* A unified hook for reading router state: current (`active`) and in-flight
|
||||
* (`pending`) locations, search params, params, matches, and navigation type.
|
||||
*
|
||||
* This hook consolidates the information you used to get from {@link useLocation},
|
||||
* {@link useSearchParams}, {@link useParams}, {@link useMatches}, {@link useNavigation},
|
||||
* and {@link useNavigationType} into a single hook.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* import { unstable_useRouterState as useRouterState } from "react-router";
|
||||
*
|
||||
* let { active, pending } = unstable_useRouterState();
|
||||
*
|
||||
* // Active is always populated with the current location
|
||||
* active.location; // replaces `useLocation()`
|
||||
* active.searchParams; // replaces `useSearchParams()[0]`
|
||||
* active.params; // replaces `useParams()`
|
||||
* active.matches; // replaces `useMatches()`
|
||||
* active.type; // replaces `useNavigationType()`
|
||||
*
|
||||
* // Pending is only populated during a navigation
|
||||
* pending.location; // replaces `useNavigation().location`
|
||||
* pending.searchParams; // equivalent to `new URLSearchParams(useNavigation().search)`
|
||||
* pending.params; // Not directly accessible today
|
||||
* pending.matches; // Not directly accessible today
|
||||
* pending.type; // Not directly accessible today
|
||||
* pending.state; // replaces `useNavigation().state`
|
||||
* pending.formMethod; // replaces useNavigation().formMethod
|
||||
* pending.formAction; // replaces useNavigation().formAction
|
||||
* pending.formEncType; // replaces useNavigation().formEncType
|
||||
* pending.formData; // replaces useNavigation().formData
|
||||
* pending.json; // replaces useNavigation().json
|
||||
* pending.text; // replaces useNavigation().text
|
||||
*
|
||||
* @name unstable_useRouterState
|
||||
* @public
|
||||
* @category Hooks
|
||||
* @mode framework
|
||||
* @mode data
|
||||
* @returns The current router state with `active` and `pending` variants
|
||||
*/
|
||||
declare function useRouterState(): unstable_RouterState;
|
||||
|
||||
/**
|
||||
* @category Types
|
||||
@@ -1387,4 +1475,4 @@ declare function getHydrationData({ state, routes, getRouteInfo, location, basen
|
||||
declare const unstable_getRequest: typeof getRequest;
|
||||
declare const unstable_matchRSCServerRequest: typeof matchRSCServerRequest;
|
||||
|
||||
export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, Navigation, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|
||||
export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, NavigationStates, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type unstable_RouterState, type unstable_RouterStateActiveVariant, type unstable_RouterStatePendingVariant, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|
||||
|
||||
+196
-174
File diff suppressed because one or more lines are too long
+5
-3
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
isSession,
|
||||
routeRSCServerRequest,
|
||||
setDevServerHooks
|
||||
} from "./chunk-2UH5WJXA.mjs";
|
||||
} from "./chunk-ASILSGTR.mjs";
|
||||
import {
|
||||
Action,
|
||||
Await,
|
||||
@@ -133,6 +133,7 @@ import {
|
||||
useRoute,
|
||||
useRouteError,
|
||||
useRouteLoaderData,
|
||||
useRouterState,
|
||||
useRoutes,
|
||||
useScrollRestoration,
|
||||
useSearchParams,
|
||||
@@ -141,7 +142,7 @@ import {
|
||||
withComponentProps,
|
||||
withErrorBoundaryProps,
|
||||
withHydrateFallbackProps
|
||||
} from "./chunk-QFMPRPBF.mjs";
|
||||
} from "./chunk-6CSD65Y2.mjs";
|
||||
export {
|
||||
Await,
|
||||
BrowserRouter,
|
||||
@@ -243,6 +244,7 @@ export {
|
||||
setDevServerHooks as unstable_setDevServerHooks,
|
||||
usePrompt as unstable_usePrompt,
|
||||
useRoute as unstable_useRoute,
|
||||
useRouterState as unstable_useRouterState,
|
||||
useActionData,
|
||||
useAsyncError,
|
||||
useAsyncValue,
|
||||
|
||||
-657
@@ -1,657 +0,0 @@
|
||||
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, U as UIMatch, T as To, o as HTMLFormMethod, F as FormEncType, p as Path, q as LoaderFunctionArgs, r as MiddlewareEnabled, s as AppLoadContext } from './routeModules-CA7kSxJJ.js';
|
||||
|
||||
/**
|
||||
* A Router instance manages all navigation and data loading/mutations
|
||||
*/
|
||||
interface Router {
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the basename for the router
|
||||
*/
|
||||
get basename(): RouterInit["basename"];
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the future config for the router
|
||||
*/
|
||||
get future(): FutureConfig;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the current state of the router
|
||||
*/
|
||||
get state(): RouterState;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the routes for this router instance
|
||||
*/
|
||||
get routes(): DataRouteObject[];
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the window associated with the router
|
||||
*/
|
||||
get window(): RouterInit["window"];
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Initialize the router, including adding history listeners and kicking off
|
||||
* initial data fetches. Returns a function to cleanup listeners and abort
|
||||
* any in-progress loads
|
||||
*/
|
||||
initialize(): Router;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Subscribe to router.state updates
|
||||
*
|
||||
* @param fn function to call with the new state
|
||||
*/
|
||||
subscribe(fn: RouterSubscriber): () => void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Enable scroll restoration behavior in the router
|
||||
*
|
||||
* @param savedScrollPositions Object that will manage positions, in case
|
||||
* it's being restored from sessionStorage
|
||||
* @param getScrollPosition Function to get the active Y scroll position
|
||||
* @param getKey Function to get the key to use for restoration
|
||||
*/
|
||||
enableScrollRestoration(savedScrollPositions: Record<string, number>, getScrollPosition: GetScrollPositionFunction, getKey?: GetScrollRestorationKeyFunction): () => void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Navigate forward/backward in the history stack
|
||||
* @param to Delta to move in the history stack
|
||||
*/
|
||||
navigate(to: number): Promise<void>;
|
||||
/**
|
||||
* Navigate to the given path
|
||||
* @param to Path to navigate to
|
||||
* @param opts Navigation options (method, submission, etc.)
|
||||
*/
|
||||
navigate(to: To | null, opts?: RouterNavigateOptions): Promise<void>;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Trigger a fetcher load/submission
|
||||
*
|
||||
* @param key Fetcher key
|
||||
* @param routeId Route that owns the fetcher
|
||||
* @param href href to fetch
|
||||
* @param opts Fetcher options, (method, submission, etc.)
|
||||
*/
|
||||
fetch(key: string, routeId: string, href: string | null, opts?: RouterFetchOptions): Promise<void>;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Trigger a revalidation of all current route loaders and fetcher loads
|
||||
*/
|
||||
revalidate(): Promise<void>;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Utility function to create an href for the given location
|
||||
* @param location
|
||||
*/
|
||||
createHref(location: Location | URL): string;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Utility function to URL encode a destination path according to the internal
|
||||
* history implementation
|
||||
* @param to
|
||||
*/
|
||||
encodeLocation(to: To): Path;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Get/create a fetcher for the given key
|
||||
* @param key
|
||||
*/
|
||||
getFetcher<TData = any>(key: string): Fetcher<TData>;
|
||||
/**
|
||||
* @internal
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Reset the fetcher for a given key
|
||||
* @param key
|
||||
*/
|
||||
resetFetcher(key: string, opts?: {
|
||||
reason?: unknown;
|
||||
}): void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Delete the fetcher for a given key
|
||||
* @param key
|
||||
*/
|
||||
deleteFetcher(key: string): void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Cleanup listeners and abort any in-progress loads
|
||||
*/
|
||||
dispose(): void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Get a navigation blocker
|
||||
* @param key The identifier for the blocker
|
||||
* @param fn The blocker function implementation
|
||||
*/
|
||||
getBlocker(key: string, fn: BlockerFunction): Blocker;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Delete a navigation blocker
|
||||
* @param key The identifier for the blocker
|
||||
*/
|
||||
deleteBlocker(key: string): void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE DO NOT USE
|
||||
*
|
||||
* Patch additional children routes into an existing parent route
|
||||
* @param routeId The parent route id or a callback function accepting `patch`
|
||||
* to perform batch patching
|
||||
* @param children The additional children routes
|
||||
* @param unstable_allowElementMutations Allow mutation or route elements on
|
||||
* existing routes. Intended for RSC-usage
|
||||
* only.
|
||||
*/
|
||||
patchRoutes(routeId: string | null, children: RouteObject[], unstable_allowElementMutations?: boolean): void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* HMR needs to pass in-flight route updates to React Router
|
||||
* TODO: Replace this with granular route update APIs (addRoute, updateRoute, deleteRoute)
|
||||
*/
|
||||
_internalSetRoutes(routes: RouteObject[]): void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Cause subscribers to re-render. This is used to force a re-render.
|
||||
*/
|
||||
_internalSetStateDoNotUseOrYouWillBreakYourApp(state: Partial<RouterState>): void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Internal fetch AbortControllers accessed by unit tests
|
||||
*/
|
||||
_internalFetchControllers: Map<string, AbortController>;
|
||||
}
|
||||
/**
|
||||
* State maintained internally by the router. During a navigation, all states
|
||||
* reflect the "old" location unless otherwise noted.
|
||||
*/
|
||||
interface RouterState {
|
||||
/**
|
||||
* The action of the most recent navigation
|
||||
*/
|
||||
historyAction: Action;
|
||||
/**
|
||||
* The current location reflected by the router
|
||||
*/
|
||||
location: Location;
|
||||
/**
|
||||
* The current set of route matches
|
||||
*/
|
||||
matches: DataRouteMatch[];
|
||||
/**
|
||||
* Tracks whether we've completed our initial data load
|
||||
*/
|
||||
initialized: boolean;
|
||||
/**
|
||||
* Tracks whether we should be rendering a HydrateFallback during hydration
|
||||
*/
|
||||
renderFallback: boolean;
|
||||
/**
|
||||
* Current scroll position we should start at for a new view
|
||||
* - number -> scroll position to restore to
|
||||
* - false -> do not restore scroll at all (used during submissions/revalidations)
|
||||
* - null -> don't have a saved position, scroll to hash or top of page
|
||||
*/
|
||||
restoreScrollPosition: number | false | null;
|
||||
/**
|
||||
* Indicate whether this navigation should skip resetting the scroll position
|
||||
* if we are unable to restore the scroll position
|
||||
*/
|
||||
preventScrollReset: boolean;
|
||||
/**
|
||||
* Tracks the state of the current navigation
|
||||
*/
|
||||
navigation: Navigation;
|
||||
/**
|
||||
* Tracks any in-progress revalidations
|
||||
*/
|
||||
revalidation: RevalidationState;
|
||||
/**
|
||||
* Data from the loaders for the current matches
|
||||
*/
|
||||
loaderData: RouteData;
|
||||
/**
|
||||
* Data from the action for the current matches
|
||||
*/
|
||||
actionData: RouteData | null;
|
||||
/**
|
||||
* Errors caught from loaders for the current matches
|
||||
*/
|
||||
errors: RouteData | null;
|
||||
/**
|
||||
* Map of current fetchers
|
||||
*/
|
||||
fetchers: Map<string, Fetcher>;
|
||||
/**
|
||||
* Map of current blockers
|
||||
*/
|
||||
blockers: Map<string, Blocker>;
|
||||
}
|
||||
/**
|
||||
* Data that can be passed into hydrate a Router from SSR
|
||||
*/
|
||||
type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "errors">>;
|
||||
/**
|
||||
* Future flags to toggle new feature behavior
|
||||
*/
|
||||
interface FutureConfig {
|
||||
unstable_passThroughRequests: boolean;
|
||||
}
|
||||
/**
|
||||
* Initialization options for createRouter
|
||||
*/
|
||||
interface RouterInit {
|
||||
routes: RouteObject[];
|
||||
history: History;
|
||||
basename?: string;
|
||||
getContext?: () => MaybePromise<RouterContextProvider>;
|
||||
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
||||
mapRouteProperties?: MapRoutePropertiesFunction;
|
||||
future?: Partial<FutureConfig>;
|
||||
hydrationRouteProperties?: string[];
|
||||
hydrationData?: HydrationState;
|
||||
window?: Window;
|
||||
dataStrategy?: DataStrategyFunction;
|
||||
patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction;
|
||||
}
|
||||
/**
|
||||
* State returned from a server-side query() call
|
||||
*/
|
||||
interface StaticHandlerContext {
|
||||
basename: Router["basename"];
|
||||
location: RouterState["location"];
|
||||
matches: RouterState["matches"];
|
||||
loaderData: RouterState["loaderData"];
|
||||
actionData: RouterState["actionData"];
|
||||
errors: RouterState["errors"];
|
||||
statusCode: number;
|
||||
loaderHeaders: Record<string, Headers>;
|
||||
actionHeaders: Record<string, Headers>;
|
||||
_deepestRenderedBoundaryId?: string | null;
|
||||
}
|
||||
/**
|
||||
* A StaticHandler instance manages a singular SSR navigation/fetch event
|
||||
*/
|
||||
interface StaticHandler {
|
||||
dataRoutes: DataRouteObject[];
|
||||
query(request: Request, opts?: {
|
||||
requestContext?: unknown;
|
||||
filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
|
||||
skipLoaderErrorBubbling?: boolean;
|
||||
skipRevalidation?: boolean;
|
||||
dataStrategy?: DataStrategyFunction<unknown>;
|
||||
generateMiddlewareResponse?: (query: (r: Request, args?: {
|
||||
filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
|
||||
}) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>;
|
||||
unstable_normalizePath?: (request: Request) => Path;
|
||||
}): Promise<StaticHandlerContext | Response>;
|
||||
queryRoute(request: Request, opts?: {
|
||||
routeId?: string;
|
||||
requestContext?: unknown;
|
||||
dataStrategy?: DataStrategyFunction<unknown>;
|
||||
generateMiddlewareResponse?: (queryRoute: (r: Request) => Promise<Response>) => MaybePromise<Response>;
|
||||
unstable_normalizePath?: (request: Request) => Path;
|
||||
}): Promise<any>;
|
||||
}
|
||||
type ViewTransitionOpts = {
|
||||
currentLocation: Location;
|
||||
nextLocation: Location;
|
||||
};
|
||||
/**
|
||||
* Subscriber function signature for changes to router state
|
||||
*/
|
||||
interface RouterSubscriber {
|
||||
(state: RouterState, opts: {
|
||||
deletedFetchers: string[];
|
||||
newErrors: RouteData | null;
|
||||
viewTransitionOpts?: ViewTransitionOpts;
|
||||
flushSync: boolean;
|
||||
}): void;
|
||||
}
|
||||
/**
|
||||
* Function signature for determining the key to be used in scroll restoration
|
||||
* for a given location
|
||||
*/
|
||||
interface GetScrollRestorationKeyFunction {
|
||||
(location: Location, matches: UIMatch[]): string | null;
|
||||
}
|
||||
/**
|
||||
* Function signature for determining the current scroll position
|
||||
*/
|
||||
interface GetScrollPositionFunction {
|
||||
(): number;
|
||||
}
|
||||
/**
|
||||
* - "route": relative to the route hierarchy so `..` means remove all segments
|
||||
* of the current route even if it has many. For example, a `route("posts/:id")`
|
||||
* would have both `:id` and `posts` removed from the url.
|
||||
* - "path": relative to the pathname so `..` means remove one segment of the
|
||||
* pathname. For example, a `route("posts/:id")` would have only `:id` removed
|
||||
* from the url.
|
||||
*/
|
||||
type RelativeRoutingType = "route" | "path";
|
||||
type BaseNavigateOrFetchOptions = {
|
||||
preventScrollReset?: boolean;
|
||||
relative?: RelativeRoutingType;
|
||||
flushSync?: boolean;
|
||||
unstable_defaultShouldRevalidate?: boolean;
|
||||
};
|
||||
type BaseNavigateOptions = BaseNavigateOrFetchOptions & {
|
||||
replace?: boolean;
|
||||
state?: any;
|
||||
fromRouteId?: string;
|
||||
viewTransition?: boolean;
|
||||
unstable_mask?: To;
|
||||
};
|
||||
type BaseSubmissionOptions = {
|
||||
formMethod?: HTMLFormMethod;
|
||||
formEncType?: FormEncType;
|
||||
} & ({
|
||||
formData: FormData;
|
||||
body?: undefined;
|
||||
} | {
|
||||
formData?: undefined;
|
||||
body: any;
|
||||
});
|
||||
/**
|
||||
* Options for a navigate() call for a normal (non-submission) navigation
|
||||
*/
|
||||
type LinkNavigateOptions = BaseNavigateOptions;
|
||||
/**
|
||||
* Options for a navigate() call for a submission navigation
|
||||
*/
|
||||
type SubmissionNavigateOptions = BaseNavigateOptions & BaseSubmissionOptions;
|
||||
/**
|
||||
* Options to pass to navigate() for a navigation
|
||||
*/
|
||||
type RouterNavigateOptions = LinkNavigateOptions | SubmissionNavigateOptions;
|
||||
/**
|
||||
* Options for a fetch() load
|
||||
*/
|
||||
type LoadFetchOptions = BaseNavigateOrFetchOptions;
|
||||
/**
|
||||
* Options for a fetch() submission
|
||||
*/
|
||||
type SubmitFetchOptions = BaseNavigateOrFetchOptions & BaseSubmissionOptions;
|
||||
/**
|
||||
* Options to pass to fetch()
|
||||
*/
|
||||
type RouterFetchOptions = LoadFetchOptions | SubmitFetchOptions;
|
||||
/**
|
||||
* Potential states for state.navigation
|
||||
*/
|
||||
type NavigationStates = {
|
||||
Idle: {
|
||||
state: "idle";
|
||||
location: undefined;
|
||||
formMethod: undefined;
|
||||
formAction: undefined;
|
||||
formEncType: undefined;
|
||||
formData: undefined;
|
||||
json: undefined;
|
||||
text: undefined;
|
||||
};
|
||||
Loading: {
|
||||
state: "loading";
|
||||
location: Location;
|
||||
formMethod: Submission["formMethod"] | undefined;
|
||||
formAction: Submission["formAction"] | undefined;
|
||||
formEncType: Submission["formEncType"] | undefined;
|
||||
formData: Submission["formData"] | undefined;
|
||||
json: Submission["json"] | undefined;
|
||||
text: Submission["text"] | undefined;
|
||||
};
|
||||
Submitting: {
|
||||
state: "submitting";
|
||||
location: Location;
|
||||
formMethod: Submission["formMethod"];
|
||||
formAction: Submission["formAction"];
|
||||
formEncType: Submission["formEncType"];
|
||||
formData: Submission["formData"];
|
||||
json: Submission["json"];
|
||||
text: Submission["text"];
|
||||
};
|
||||
};
|
||||
type Navigation = NavigationStates[keyof NavigationStates];
|
||||
type RevalidationState = "idle" | "loading";
|
||||
/**
|
||||
* Potential states for fetchers
|
||||
*/
|
||||
type FetcherStates<TData = any> = {
|
||||
/**
|
||||
* The fetcher is not calling a loader or action
|
||||
*
|
||||
* ```tsx
|
||||
* fetcher.state === "idle"
|
||||
* ```
|
||||
*/
|
||||
Idle: {
|
||||
state: "idle";
|
||||
formMethod: undefined;
|
||||
formAction: undefined;
|
||||
formEncType: undefined;
|
||||
text: undefined;
|
||||
formData: undefined;
|
||||
json: undefined;
|
||||
/**
|
||||
* If the fetcher has never been called, this will be undefined.
|
||||
*/
|
||||
data: TData | undefined;
|
||||
};
|
||||
/**
|
||||
* The fetcher is loading data from a {@link LoaderFunction | loader} from a
|
||||
* call to {@link FetcherWithComponents.load | `fetcher.load`}.
|
||||
*
|
||||
* ```tsx
|
||||
* // somewhere
|
||||
* <button onClick={() => fetcher.load("/some/route") }>Load</button>
|
||||
*
|
||||
* // the state will update
|
||||
* fetcher.state === "loading"
|
||||
* ```
|
||||
*/
|
||||
Loading: {
|
||||
state: "loading";
|
||||
formMethod: Submission["formMethod"] | undefined;
|
||||
formAction: Submission["formAction"] | undefined;
|
||||
formEncType: Submission["formEncType"] | undefined;
|
||||
text: Submission["text"] | undefined;
|
||||
formData: Submission["formData"] | undefined;
|
||||
json: Submission["json"] | undefined;
|
||||
data: TData | undefined;
|
||||
};
|
||||
/**
|
||||
The fetcher is submitting to a {@link LoaderFunction} (GET) or {@link ActionFunction} (POST) from a {@link FetcherWithComponents.Form | `fetcher.Form`} or {@link FetcherWithComponents.submit | `fetcher.submit`}.
|
||||
|
||||
```tsx
|
||||
// somewhere
|
||||
<input
|
||||
onChange={e => {
|
||||
fetcher.submit(event.currentTarget.form, { method: "post" });
|
||||
}}
|
||||
/>
|
||||
|
||||
// the state will update
|
||||
fetcher.state === "submitting"
|
||||
|
||||
// and formData will be available
|
||||
fetcher.formData
|
||||
```
|
||||
*/
|
||||
Submitting: {
|
||||
state: "submitting";
|
||||
formMethod: Submission["formMethod"];
|
||||
formAction: Submission["formAction"];
|
||||
formEncType: Submission["formEncType"];
|
||||
text: Submission["text"];
|
||||
formData: Submission["formData"];
|
||||
json: Submission["json"];
|
||||
data: TData | undefined;
|
||||
};
|
||||
};
|
||||
type Fetcher<TData = any> = FetcherStates<TData>[keyof FetcherStates<TData>];
|
||||
interface BlockerBlocked {
|
||||
state: "blocked";
|
||||
reset: () => void;
|
||||
proceed: () => void;
|
||||
location: Location;
|
||||
}
|
||||
interface BlockerUnblocked {
|
||||
state: "unblocked";
|
||||
reset: undefined;
|
||||
proceed: undefined;
|
||||
location: undefined;
|
||||
}
|
||||
interface BlockerProceeding {
|
||||
state: "proceeding";
|
||||
reset: undefined;
|
||||
proceed: undefined;
|
||||
location: Location;
|
||||
}
|
||||
type Blocker = BlockerUnblocked | BlockerBlocked | BlockerProceeding;
|
||||
type BlockerFunction = (args: {
|
||||
currentLocation: Location;
|
||||
nextLocation: Location;
|
||||
historyAction: Action;
|
||||
}) => boolean;
|
||||
declare const IDLE_NAVIGATION: NavigationStates["Idle"];
|
||||
declare const IDLE_FETCHER: FetcherStates["Idle"];
|
||||
declare const IDLE_BLOCKER: BlockerUnblocked;
|
||||
/**
|
||||
* Create a router and listen to history POP navigations
|
||||
*/
|
||||
declare function createRouter(init: RouterInit): Router;
|
||||
interface CreateStaticHandlerOptions {
|
||||
basename?: string;
|
||||
mapRouteProperties?: MapRoutePropertiesFunction;
|
||||
unstable_instrumentations?: Pick<unstable_ServerInstrumentation, "route">[];
|
||||
future?: Partial<FutureConfig>;
|
||||
}
|
||||
|
||||
type unstable_ServerInstrumentation = {
|
||||
handler?: unstable_InstrumentRequestHandlerFunction;
|
||||
route?: unstable_InstrumentRouteFunction;
|
||||
};
|
||||
type unstable_ClientInstrumentation = {
|
||||
router?: unstable_InstrumentRouterFunction;
|
||||
route?: unstable_InstrumentRouteFunction;
|
||||
};
|
||||
type unstable_InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
|
||||
type unstable_InstrumentRouterFunction = (router: InstrumentableRouter) => void;
|
||||
type unstable_InstrumentRouteFunction = (route: InstrumentableRoute) => void;
|
||||
type unstable_InstrumentationHandlerResult = {
|
||||
status: "success";
|
||||
error: undefined;
|
||||
} | {
|
||||
status: "error";
|
||||
error: Error;
|
||||
};
|
||||
type InstrumentFunction<T> = (handler: () => Promise<unstable_InstrumentationHandlerResult>, info: T) => Promise<void>;
|
||||
type ReadonlyRequest = {
|
||||
method: string;
|
||||
url: string;
|
||||
headers: Pick<Headers, "get">;
|
||||
};
|
||||
type ReadonlyContext = MiddlewareEnabled extends true ? Pick<RouterContextProvider, "get"> : Readonly<AppLoadContext>;
|
||||
type InstrumentableRoute = {
|
||||
id: string;
|
||||
index: boolean | undefined;
|
||||
path: string | undefined;
|
||||
instrument(instrumentations: RouteInstrumentations): void;
|
||||
};
|
||||
type RouteInstrumentations = {
|
||||
lazy?: InstrumentFunction<RouteLazyInstrumentationInfo>;
|
||||
"lazy.loader"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
|
||||
"lazy.action"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
|
||||
"lazy.middleware"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
|
||||
middleware?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
|
||||
loader?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
|
||||
action?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
|
||||
};
|
||||
type RouteLazyInstrumentationInfo = undefined;
|
||||
type RouteHandlerInstrumentationInfo = Readonly<{
|
||||
request: ReadonlyRequest;
|
||||
params: LoaderFunctionArgs["params"];
|
||||
unstable_pattern: string;
|
||||
context: ReadonlyContext;
|
||||
}>;
|
||||
type InstrumentableRouter = {
|
||||
instrument(instrumentations: RouterInstrumentations): void;
|
||||
};
|
||||
type RouterInstrumentations = {
|
||||
navigate?: InstrumentFunction<RouterNavigationInstrumentationInfo>;
|
||||
fetch?: InstrumentFunction<RouterFetchInstrumentationInfo>;
|
||||
};
|
||||
type RouterNavigationInstrumentationInfo = Readonly<{
|
||||
to: string | number;
|
||||
currentUrl: string;
|
||||
formMethod?: HTMLFormMethod;
|
||||
formEncType?: FormEncType;
|
||||
formData?: FormData;
|
||||
body?: any;
|
||||
}>;
|
||||
type RouterFetchInstrumentationInfo = Readonly<{
|
||||
href: string;
|
||||
currentUrl: string;
|
||||
fetcherKey: string;
|
||||
formMethod?: HTMLFormMethod;
|
||||
formEncType?: FormEncType;
|
||||
formData?: FormData;
|
||||
body?: any;
|
||||
}>;
|
||||
type InstrumentableRequestHandler = {
|
||||
instrument(instrumentations: RequestHandlerInstrumentations): void;
|
||||
};
|
||||
type RequestHandlerInstrumentations = {
|
||||
request?: InstrumentFunction<RequestHandlerInstrumentationInfo>;
|
||||
};
|
||||
type RequestHandlerInstrumentationInfo = Readonly<{
|
||||
request: ReadonlyRequest;
|
||||
context: ReadonlyContext | undefined;
|
||||
}>;
|
||||
|
||||
export { type BlockerFunction as B, type CreateStaticHandlerOptions as C, type Fetcher as F, type GetScrollPositionFunction as G, type HydrationState as H, IDLE_NAVIGATION as I, type Navigation 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 NavigationStates as g, type RouterSubscriber as h, type RouterNavigateOptions as i, type RouterFetchOptions as j, type RevalidationState as k, type unstable_ServerInstrumentation as l, type unstable_InstrumentRequestHandlerFunction as m, type unstable_InstrumentRouterFunction as n, type unstable_InstrumentRouteFunction as o, type unstable_InstrumentationHandlerResult as p, IDLE_FETCHER as q, IDLE_BLOCKER as r, createRouter as s, type FutureConfig as t, type unstable_ClientInstrumentation as u };
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
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 '../../routeModules-BRrCYrSL.mjs';
|
||||
import { R as RouteFiles, P as Pages } from '../../register-CTxsJBKQ.mjs';
|
||||
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';
|
||||
import { R as RouteFiles, P as Pages } from '../../register-CqK96Zfk.mjs';
|
||||
import 'react';
|
||||
|
||||
type MaybePromise<T> = T | Promise<T>;
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { R as RouteModule, t as LinkDescriptor, L as Location, u as Func, v as Pretty, w as MetaDescriptor, G as GetLoaderData, x as ServerDataFunctionArgs, y as MiddlewareNextFunction, z as ClientDataFunctionArgs, B as DataStrategyResult, E as ServerDataFrom, N as Normalize, I as GetActionData } from '../../routeModules-CA7kSxJJ.js';
|
||||
import { R as RouteFiles, P as Pages } from '../../register-CkcGwv27.js';
|
||||
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';
|
||||
import { R as RouteFiles, P as Pages } from '../../register-CNAx3TXj.js';
|
||||
import 'react';
|
||||
|
||||
type MaybePromise<T> = T | Promise<T>;
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
"use strict";/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
import { R as RouteModule } from './routeModules-BRrCYrSL.mjs';
|
||||
|
||||
/**
|
||||
* Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
|
||||
* React Router should handle this for you via type generation.
|
||||
*
|
||||
* For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation .
|
||||
*/
|
||||
interface Register {
|
||||
}
|
||||
type AnyParams = Record<string, string | undefined>;
|
||||
type AnyPages = Record<string, {
|
||||
params: AnyParams;
|
||||
}>;
|
||||
type Pages = Register extends {
|
||||
pages: infer Registered extends AnyPages;
|
||||
} ? Registered : AnyPages;
|
||||
type AnyRouteFiles = Record<string, {
|
||||
id: string;
|
||||
page: string;
|
||||
}>;
|
||||
type RouteFiles = Register extends {
|
||||
routeFiles: infer Registered extends AnyRouteFiles;
|
||||
} ? Registered : AnyRouteFiles;
|
||||
type AnyRouteModules = Record<string, RouteModule>;
|
||||
type RouteModules = Register extends {
|
||||
routeModules: infer Registered extends AnyRouteModules;
|
||||
} ? Registered : AnyRouteModules;
|
||||
|
||||
export type { Pages as P, RouteFiles as R, RouteModules as a, Register as b };
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
import { R as RouteModule } from './routeModules-CA7kSxJJ.js';
|
||||
|
||||
/**
|
||||
* Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
|
||||
* React Router should handle this for you via type generation.
|
||||
*
|
||||
* For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation .
|
||||
*/
|
||||
interface Register {
|
||||
}
|
||||
type AnyParams = Record<string, string | undefined>;
|
||||
type AnyPages = Record<string, {
|
||||
params: AnyParams;
|
||||
}>;
|
||||
type Pages = Register extends {
|
||||
pages: infer Registered extends AnyPages;
|
||||
} ? Registered : AnyPages;
|
||||
type AnyRouteFiles = Record<string, {
|
||||
id: string;
|
||||
page: string;
|
||||
}>;
|
||||
type RouteFiles = Register extends {
|
||||
routeFiles: infer Registered extends AnyRouteFiles;
|
||||
} ? Registered : AnyRouteFiles;
|
||||
type AnyRouteModules = Record<string, RouteModule>;
|
||||
type RouteModules = Register extends {
|
||||
routeModules: infer Registered extends AnyRouteModules;
|
||||
} ? Registered : AnyRouteModules;
|
||||
|
||||
export type { Pages as P, RouteFiles as R, RouteModules as a, Register as b };
|
||||
-1693
File diff suppressed because it is too large
Load Diff
-1693
File diff suppressed because it is too large
Load Diff
-318
@@ -1,318 +0,0 @@
|
||||
import * as React from 'react';
|
||||
import { R as RouterInit } from './instrumentation-BYr6ff5D.js';
|
||||
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';
|
||||
|
||||
declare function getRequest(): Request;
|
||||
type RSCRouteConfigEntryBase = {
|
||||
action?: ActionFunction;
|
||||
clientAction?: ClientActionFunction;
|
||||
clientLoader?: ClientLoaderFunction;
|
||||
ErrorBoundary?: React.ComponentType<any>;
|
||||
handle?: any;
|
||||
headers?: HeadersFunction;
|
||||
HydrateFallback?: React.ComponentType<any>;
|
||||
Layout?: React.ComponentType<any>;
|
||||
links?: LinksFunction;
|
||||
loader?: LoaderFunction;
|
||||
meta?: MetaFunction;
|
||||
shouldRevalidate?: ShouldRevalidateFunction;
|
||||
};
|
||||
type RSCRouteConfigEntry = RSCRouteConfigEntryBase & {
|
||||
id: string;
|
||||
path?: string;
|
||||
Component?: React.ComponentType<any>;
|
||||
lazy?: () => Promise<RSCRouteConfigEntryBase & ({
|
||||
default?: React.ComponentType<any>;
|
||||
Component?: never;
|
||||
} | {
|
||||
default?: never;
|
||||
Component?: React.ComponentType<any>;
|
||||
})>;
|
||||
} & ({
|
||||
index: true;
|
||||
} | {
|
||||
children?: RSCRouteConfigEntry[];
|
||||
});
|
||||
type RSCRouteConfig = Array<RSCRouteConfigEntry>;
|
||||
type RSCRouteManifest = {
|
||||
clientAction?: ClientActionFunction;
|
||||
clientLoader?: ClientLoaderFunction;
|
||||
element?: React.ReactElement | false;
|
||||
errorElement?: React.ReactElement;
|
||||
handle?: any;
|
||||
hasAction: boolean;
|
||||
hasComponent: boolean;
|
||||
hasErrorBoundary: boolean;
|
||||
hasLoader: boolean;
|
||||
hydrateFallbackElement?: React.ReactElement;
|
||||
id: string;
|
||||
index?: boolean;
|
||||
links?: LinksFunction;
|
||||
meta?: MetaFunction;
|
||||
parentId?: string;
|
||||
path?: string;
|
||||
shouldRevalidate?: ShouldRevalidateFunction;
|
||||
};
|
||||
type RSCRouteMatch = RSCRouteManifest & {
|
||||
params: Params;
|
||||
pathname: string;
|
||||
pathnameBase: string;
|
||||
};
|
||||
type RSCRenderPayload = {
|
||||
type: "render";
|
||||
actionData: Record<string, any> | null;
|
||||
basename: string | undefined;
|
||||
errors: Record<string, any> | null;
|
||||
loaderData: Record<string, any>;
|
||||
location: Location;
|
||||
routeDiscovery: RouteDiscovery;
|
||||
matches: RSCRouteMatch[];
|
||||
patches?: Promise<RSCRouteManifest[]>;
|
||||
nonce?: string;
|
||||
formState?: unknown;
|
||||
};
|
||||
type RSCManifestPayload = {
|
||||
type: "manifest";
|
||||
patches: Promise<RSCRouteManifest[]>;
|
||||
};
|
||||
type RSCActionPayload = {
|
||||
type: "action";
|
||||
actionResult: Promise<unknown>;
|
||||
rerender?: Promise<RSCRenderPayload | RSCRedirectPayload>;
|
||||
};
|
||||
type RSCRedirectPayload = {
|
||||
type: "redirect";
|
||||
status: number;
|
||||
location: string;
|
||||
replace: boolean;
|
||||
reload: boolean;
|
||||
actionResult?: Promise<unknown>;
|
||||
};
|
||||
type RSCPayload = RSCRenderPayload | RSCManifestPayload | RSCActionPayload | RSCRedirectPayload;
|
||||
type RSCMatch = {
|
||||
statusCode: number;
|
||||
headers: Headers;
|
||||
payload: RSCPayload;
|
||||
};
|
||||
type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>;
|
||||
type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
|
||||
type DecodeReplyFunction = (reply: FormData | string, options: {
|
||||
temporaryReferences: unknown;
|
||||
}) => Promise<unknown[]>;
|
||||
type LoadServerActionFunction = (id: string) => Promise<Function>;
|
||||
type RouteDiscovery = {
|
||||
mode: "lazy";
|
||||
manifestPath?: string | undefined;
|
||||
} | {
|
||||
mode: "initial";
|
||||
};
|
||||
/**
|
||||
* Matches the given routes to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
||||
* and returns an [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
||||
* encoding an {@link unstable_RSCPayload} for consumption by an [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* enabled client router.
|
||||
*
|
||||
* @example
|
||||
* import {
|
||||
* createTemporaryReferenceSet,
|
||||
* decodeAction,
|
||||
* decodeReply,
|
||||
* loadServerAction,
|
||||
* renderToReadableStream,
|
||||
* } from "@vitejs/plugin-rsc/rsc";
|
||||
* import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router";
|
||||
*
|
||||
* matchRSCServerRequest({
|
||||
* createTemporaryReferenceSet,
|
||||
* decodeAction,
|
||||
* decodeFormState,
|
||||
* decodeReply,
|
||||
* loadServerAction,
|
||||
* request,
|
||||
* routes: routes(),
|
||||
* generateResponse(match) {
|
||||
* return new Response(
|
||||
* renderToReadableStream(match.payload),
|
||||
* {
|
||||
* status: match.statusCode,
|
||||
* headers: match.headers,
|
||||
* }
|
||||
* );
|
||||
* },
|
||||
* });
|
||||
*
|
||||
* @name unstable_matchRSCServerRequest
|
||||
* @public
|
||||
* @category RSC
|
||||
* @mode data
|
||||
* @param opts Options
|
||||
* @param opts.allowedActionOrigins Origin patterns that are allowed to execute actions.
|
||||
* @param opts.basename The basename to use when matching the request.
|
||||
* @param opts.createTemporaryReferenceSet A function that returns a temporary
|
||||
* reference set for the request, used to track temporary references in the [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* stream.
|
||||
* @param opts.decodeAction Your `react-server-dom-xyz/server`'s `decodeAction`
|
||||
* function, responsible for loading a server action.
|
||||
* @param opts.decodeFormState A function responsible for decoding form state for
|
||||
* progressively enhanceable forms with React's [`useActionState`](https://react.dev/reference/react/useActionState)
|
||||
* using your `react-server-dom-xyz/server`'s `decodeFormState`.
|
||||
* @param opts.decodeReply Your `react-server-dom-xyz/server`'s `decodeReply`
|
||||
* function, used to decode the server function's arguments and bind them to the
|
||||
* implementation for invocation by the router.
|
||||
* @param opts.generateResponse A function responsible for using your
|
||||
* `renderToReadableStream` to generate a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
||||
* encoding the {@link unstable_RSCPayload}.
|
||||
* @param opts.loadServerAction Your `react-server-dom-xyz/server`'s
|
||||
* `loadServerAction` function, used to load a server action by ID.
|
||||
* @param opts.onError An optional error handler that will be called with any
|
||||
* errors that occur during the request processing.
|
||||
* @param opts.request The [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
||||
* to match against.
|
||||
* @param opts.requestContext An instance of {@link RouterContextProvider}
|
||||
* that should be created per request, to be passed to [`action`](../../start/data/route-object#action)s,
|
||||
* [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
|
||||
* @param opts.routeDiscovery The route discovery configuration, used to determine how the router should discover new routes during navigations.
|
||||
* @param opts.routes Your {@link unstable_RSCRouteConfigEntry | route definitions}.
|
||||
* @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
||||
* that contains the [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* data for hydration.
|
||||
*/
|
||||
declare function matchRSCServerRequest({ allowedActionOrigins, createTemporaryReferenceSet, basename, decodeReply, requestContext, routeDiscovery, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
|
||||
allowedActionOrigins?: string[];
|
||||
createTemporaryReferenceSet: () => unknown;
|
||||
basename?: string;
|
||||
decodeReply?: DecodeReplyFunction;
|
||||
decodeAction?: DecodeActionFunction;
|
||||
decodeFormState?: DecodeFormStateFunction;
|
||||
requestContext?: RouterContextProvider;
|
||||
loadServerAction?: LoadServerActionFunction;
|
||||
onError?: (error: unknown) => void;
|
||||
request: Request;
|
||||
routes: RSCRouteConfigEntry[];
|
||||
routeDiscovery?: RouteDiscovery;
|
||||
generateResponse: (match: RSCMatch, { onError, temporaryReferences, }: {
|
||||
onError(error: unknown): string | undefined;
|
||||
temporaryReferences: unknown;
|
||||
}) => Response;
|
||||
}): Promise<Response>;
|
||||
|
||||
type BrowserCreateFromReadableStreamFunction = (body: ReadableStream<Uint8Array>, { temporaryReferences, }: {
|
||||
temporaryReferences: unknown;
|
||||
}) => Promise<unknown>;
|
||||
type EncodeReplyFunction = (args: unknown[], options: {
|
||||
temporaryReferences: unknown;
|
||||
}) => Promise<BodyInit>;
|
||||
/**
|
||||
* Create a React `callServer` implementation for React Router.
|
||||
*
|
||||
* @example
|
||||
* import {
|
||||
* createFromReadableStream,
|
||||
* createTemporaryReferenceSet,
|
||||
* encodeReply,
|
||||
* setServerCallback,
|
||||
* } from "@vitejs/plugin-rsc/browser";
|
||||
* import { unstable_createCallServer as createCallServer } from "react-router";
|
||||
*
|
||||
* setServerCallback(
|
||||
* createCallServer({
|
||||
* createFromReadableStream,
|
||||
* createTemporaryReferenceSet,
|
||||
* encodeReply,
|
||||
* })
|
||||
* );
|
||||
*
|
||||
* @name unstable_createCallServer
|
||||
* @public
|
||||
* @category RSC
|
||||
* @mode data
|
||||
* @param opts Options
|
||||
* @param opts.createFromReadableStream Your `react-server-dom-xyz/client`'s
|
||||
* `createFromReadableStream`. Used to decode payloads from the server.
|
||||
* @param opts.createTemporaryReferenceSet A function that creates a temporary
|
||||
* reference set for the [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* payload.
|
||||
* @param opts.encodeReply Your `react-server-dom-xyz/client`'s `encodeReply`.
|
||||
* Used when sending payloads to the server.
|
||||
* @param opts.fetch Optional [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
|
||||
* implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch).
|
||||
* @returns A function that can be used to call server actions.
|
||||
*/
|
||||
declare function createCallServer({ createFromReadableStream, createTemporaryReferenceSet, encodeReply, fetch: fetchImplementation, }: {
|
||||
createFromReadableStream: BrowserCreateFromReadableStreamFunction;
|
||||
createTemporaryReferenceSet: () => unknown;
|
||||
encodeReply: EncodeReplyFunction;
|
||||
fetch?: (request: Request) => Promise<Response>;
|
||||
}): (id: string, args: unknown[]) => Promise<unknown>;
|
||||
/**
|
||||
* Props for the {@link unstable_RSCHydratedRouter} component.
|
||||
*
|
||||
* @name unstable_RSCHydratedRouterProps
|
||||
* @category Types
|
||||
*/
|
||||
interface RSCHydratedRouterProps {
|
||||
/**
|
||||
* Your `react-server-dom-xyz/client`'s `createFromReadableStream` function,
|
||||
* used to decode payloads from the server.
|
||||
*/
|
||||
createFromReadableStream: BrowserCreateFromReadableStreamFunction;
|
||||
/**
|
||||
* Optional fetch implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch).
|
||||
*/
|
||||
fetch?: (request: Request) => Promise<Response>;
|
||||
/**
|
||||
* The decoded {@link unstable_RSCPayload} to hydrate.
|
||||
*/
|
||||
payload: RSCPayload;
|
||||
/**
|
||||
* A function that returns an {@link RouterContextProvider} instance
|
||||
* which is provided as the `context` argument to client [`action`](../../start/data/route-object#action)s,
|
||||
* [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
|
||||
* This function is called to generate a fresh `context` instance on each
|
||||
* navigation or fetcher call.
|
||||
*/
|
||||
getContext?: RouterInit["getContext"];
|
||||
}
|
||||
/**
|
||||
* Hydrates a server rendered {@link unstable_RSCPayload} in the browser.
|
||||
*
|
||||
* @example
|
||||
* import { startTransition, StrictMode } from "react";
|
||||
* import { hydrateRoot } from "react-dom/client";
|
||||
* import {
|
||||
* unstable_getRSCStream as getRSCStream,
|
||||
* unstable_RSCHydratedRouter as RSCHydratedRouter,
|
||||
* } from "react-router";
|
||||
* import type { unstable_RSCPayload as RSCPayload } from "react-router";
|
||||
*
|
||||
* createFromReadableStream(getRSCStream()).then((payload) =>
|
||||
* startTransition(async () => {
|
||||
* hydrateRoot(
|
||||
* document,
|
||||
* <StrictMode>
|
||||
* <RSCHydratedRouter
|
||||
* createFromReadableStream={createFromReadableStream}
|
||||
* payload={payload}
|
||||
* />
|
||||
* </StrictMode>,
|
||||
* { formState: await getFormState(payload) },
|
||||
* );
|
||||
* }),
|
||||
* );
|
||||
*
|
||||
* @name unstable_RSCHydratedRouter
|
||||
* @public
|
||||
* @category RSC
|
||||
* @mode data
|
||||
* @param props Props
|
||||
* @param {unstable_RSCHydratedRouterProps.createFromReadableStream} props.createFromReadableStream n/a
|
||||
* @param {unstable_RSCHydratedRouterProps.fetch} props.fetch n/a
|
||||
* @param {unstable_RSCHydratedRouterProps.getContext} props.getContext n/a
|
||||
* @param {unstable_RSCHydratedRouterProps.payload} props.payload n/a
|
||||
* @returns A hydrated {@link DataRouter} that can be used to navigate and
|
||||
* render routes.
|
||||
*/
|
||||
declare function RSCHydratedRouter({ createFromReadableStream, fetch: fetchImplementation, payload, getContext, }: RSCHydratedRouterProps): React.JSX.Element;
|
||||
|
||||
export { type BrowserCreateFromReadableStreamFunction as B, type DecodeActionFunction as D, type EncodeReplyFunction as E, type LoadServerActionFunction as L, RSCHydratedRouter as R, type DecodeFormStateFunction as a, type DecodeReplyFunction as b, createCallServer as c, type RSCManifestPayload as d, type RSCPayload as e, type RSCRenderPayload as f, getRequest as g, type RSCHydratedRouterProps as h, type RSCMatch as i, type RSCRouteManifest as j, type RSCRouteMatch as k, type RSCRouteConfigEntry as l, matchRSCServerRequest as m, type RSCRouteConfig as n };
|
||||
-318
@@ -1,318 +0,0 @@
|
||||
import * as React from 'react';
|
||||
import { R as RouterInit } from './context-phCt_zmH.mjs';
|
||||
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';
|
||||
|
||||
declare function getRequest(): Request;
|
||||
type RSCRouteConfigEntryBase = {
|
||||
action?: ActionFunction;
|
||||
clientAction?: ClientActionFunction;
|
||||
clientLoader?: ClientLoaderFunction;
|
||||
ErrorBoundary?: React.ComponentType<any>;
|
||||
handle?: any;
|
||||
headers?: HeadersFunction;
|
||||
HydrateFallback?: React.ComponentType<any>;
|
||||
Layout?: React.ComponentType<any>;
|
||||
links?: LinksFunction;
|
||||
loader?: LoaderFunction;
|
||||
meta?: MetaFunction;
|
||||
shouldRevalidate?: ShouldRevalidateFunction;
|
||||
};
|
||||
type RSCRouteConfigEntry = RSCRouteConfigEntryBase & {
|
||||
id: string;
|
||||
path?: string;
|
||||
Component?: React.ComponentType<any>;
|
||||
lazy?: () => Promise<RSCRouteConfigEntryBase & ({
|
||||
default?: React.ComponentType<any>;
|
||||
Component?: never;
|
||||
} | {
|
||||
default?: never;
|
||||
Component?: React.ComponentType<any>;
|
||||
})>;
|
||||
} & ({
|
||||
index: true;
|
||||
} | {
|
||||
children?: RSCRouteConfigEntry[];
|
||||
});
|
||||
type RSCRouteConfig = Array<RSCRouteConfigEntry>;
|
||||
type RSCRouteManifest = {
|
||||
clientAction?: ClientActionFunction;
|
||||
clientLoader?: ClientLoaderFunction;
|
||||
element?: React.ReactElement | false;
|
||||
errorElement?: React.ReactElement;
|
||||
handle?: any;
|
||||
hasAction: boolean;
|
||||
hasComponent: boolean;
|
||||
hasErrorBoundary: boolean;
|
||||
hasLoader: boolean;
|
||||
hydrateFallbackElement?: React.ReactElement;
|
||||
id: string;
|
||||
index?: boolean;
|
||||
links?: LinksFunction;
|
||||
meta?: MetaFunction;
|
||||
parentId?: string;
|
||||
path?: string;
|
||||
shouldRevalidate?: ShouldRevalidateFunction;
|
||||
};
|
||||
type RSCRouteMatch = RSCRouteManifest & {
|
||||
params: Params;
|
||||
pathname: string;
|
||||
pathnameBase: string;
|
||||
};
|
||||
type RSCRenderPayload = {
|
||||
type: "render";
|
||||
actionData: Record<string, any> | null;
|
||||
basename: string | undefined;
|
||||
errors: Record<string, any> | null;
|
||||
loaderData: Record<string, any>;
|
||||
location: Location;
|
||||
routeDiscovery: RouteDiscovery;
|
||||
matches: RSCRouteMatch[];
|
||||
patches?: Promise<RSCRouteManifest[]>;
|
||||
nonce?: string;
|
||||
formState?: unknown;
|
||||
};
|
||||
type RSCManifestPayload = {
|
||||
type: "manifest";
|
||||
patches: Promise<RSCRouteManifest[]>;
|
||||
};
|
||||
type RSCActionPayload = {
|
||||
type: "action";
|
||||
actionResult: Promise<unknown>;
|
||||
rerender?: Promise<RSCRenderPayload | RSCRedirectPayload>;
|
||||
};
|
||||
type RSCRedirectPayload = {
|
||||
type: "redirect";
|
||||
status: number;
|
||||
location: string;
|
||||
replace: boolean;
|
||||
reload: boolean;
|
||||
actionResult?: Promise<unknown>;
|
||||
};
|
||||
type RSCPayload = RSCRenderPayload | RSCManifestPayload | RSCActionPayload | RSCRedirectPayload;
|
||||
type RSCMatch = {
|
||||
statusCode: number;
|
||||
headers: Headers;
|
||||
payload: RSCPayload;
|
||||
};
|
||||
type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>;
|
||||
type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
|
||||
type DecodeReplyFunction = (reply: FormData | string, options: {
|
||||
temporaryReferences: unknown;
|
||||
}) => Promise<unknown[]>;
|
||||
type LoadServerActionFunction = (id: string) => Promise<Function>;
|
||||
type RouteDiscovery = {
|
||||
mode: "lazy";
|
||||
manifestPath?: string | undefined;
|
||||
} | {
|
||||
mode: "initial";
|
||||
};
|
||||
/**
|
||||
* Matches the given routes to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
||||
* and returns an [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
||||
* encoding an {@link unstable_RSCPayload} for consumption by an [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* enabled client router.
|
||||
*
|
||||
* @example
|
||||
* import {
|
||||
* createTemporaryReferenceSet,
|
||||
* decodeAction,
|
||||
* decodeReply,
|
||||
* loadServerAction,
|
||||
* renderToReadableStream,
|
||||
* } from "@vitejs/plugin-rsc/rsc";
|
||||
* import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router";
|
||||
*
|
||||
* matchRSCServerRequest({
|
||||
* createTemporaryReferenceSet,
|
||||
* decodeAction,
|
||||
* decodeFormState,
|
||||
* decodeReply,
|
||||
* loadServerAction,
|
||||
* request,
|
||||
* routes: routes(),
|
||||
* generateResponse(match) {
|
||||
* return new Response(
|
||||
* renderToReadableStream(match.payload),
|
||||
* {
|
||||
* status: match.statusCode,
|
||||
* headers: match.headers,
|
||||
* }
|
||||
* );
|
||||
* },
|
||||
* });
|
||||
*
|
||||
* @name unstable_matchRSCServerRequest
|
||||
* @public
|
||||
* @category RSC
|
||||
* @mode data
|
||||
* @param opts Options
|
||||
* @param opts.allowedActionOrigins Origin patterns that are allowed to execute actions.
|
||||
* @param opts.basename The basename to use when matching the request.
|
||||
* @param opts.createTemporaryReferenceSet A function that returns a temporary
|
||||
* reference set for the request, used to track temporary references in the [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* stream.
|
||||
* @param opts.decodeAction Your `react-server-dom-xyz/server`'s `decodeAction`
|
||||
* function, responsible for loading a server action.
|
||||
* @param opts.decodeFormState A function responsible for decoding form state for
|
||||
* progressively enhanceable forms with React's [`useActionState`](https://react.dev/reference/react/useActionState)
|
||||
* using your `react-server-dom-xyz/server`'s `decodeFormState`.
|
||||
* @param opts.decodeReply Your `react-server-dom-xyz/server`'s `decodeReply`
|
||||
* function, used to decode the server function's arguments and bind them to the
|
||||
* implementation for invocation by the router.
|
||||
* @param opts.generateResponse A function responsible for using your
|
||||
* `renderToReadableStream` to generate a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
||||
* encoding the {@link unstable_RSCPayload}.
|
||||
* @param opts.loadServerAction Your `react-server-dom-xyz/server`'s
|
||||
* `loadServerAction` function, used to load a server action by ID.
|
||||
* @param opts.onError An optional error handler that will be called with any
|
||||
* errors that occur during the request processing.
|
||||
* @param opts.request The [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
||||
* to match against.
|
||||
* @param opts.requestContext An instance of {@link RouterContextProvider}
|
||||
* that should be created per request, to be passed to [`action`](../../start/data/route-object#action)s,
|
||||
* [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
|
||||
* @param opts.routeDiscovery The route discovery configuration, used to determine how the router should discover new routes during navigations.
|
||||
* @param opts.routes Your {@link unstable_RSCRouteConfigEntry | route definitions}.
|
||||
* @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
||||
* that contains the [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* data for hydration.
|
||||
*/
|
||||
declare function matchRSCServerRequest({ allowedActionOrigins, createTemporaryReferenceSet, basename, decodeReply, requestContext, routeDiscovery, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
|
||||
allowedActionOrigins?: string[];
|
||||
createTemporaryReferenceSet: () => unknown;
|
||||
basename?: string;
|
||||
decodeReply?: DecodeReplyFunction;
|
||||
decodeAction?: DecodeActionFunction;
|
||||
decodeFormState?: DecodeFormStateFunction;
|
||||
requestContext?: RouterContextProvider;
|
||||
loadServerAction?: LoadServerActionFunction;
|
||||
onError?: (error: unknown) => void;
|
||||
request: Request;
|
||||
routes: RSCRouteConfigEntry[];
|
||||
routeDiscovery?: RouteDiscovery;
|
||||
generateResponse: (match: RSCMatch, { onError, temporaryReferences, }: {
|
||||
onError(error: unknown): string | undefined;
|
||||
temporaryReferences: unknown;
|
||||
}) => Response;
|
||||
}): Promise<Response>;
|
||||
|
||||
type BrowserCreateFromReadableStreamFunction = (body: ReadableStream<Uint8Array>, { temporaryReferences, }: {
|
||||
temporaryReferences: unknown;
|
||||
}) => Promise<unknown>;
|
||||
type EncodeReplyFunction = (args: unknown[], options: {
|
||||
temporaryReferences: unknown;
|
||||
}) => Promise<BodyInit>;
|
||||
/**
|
||||
* Create a React `callServer` implementation for React Router.
|
||||
*
|
||||
* @example
|
||||
* import {
|
||||
* createFromReadableStream,
|
||||
* createTemporaryReferenceSet,
|
||||
* encodeReply,
|
||||
* setServerCallback,
|
||||
* } from "@vitejs/plugin-rsc/browser";
|
||||
* import { unstable_createCallServer as createCallServer } from "react-router";
|
||||
*
|
||||
* setServerCallback(
|
||||
* createCallServer({
|
||||
* createFromReadableStream,
|
||||
* createTemporaryReferenceSet,
|
||||
* encodeReply,
|
||||
* })
|
||||
* );
|
||||
*
|
||||
* @name unstable_createCallServer
|
||||
* @public
|
||||
* @category RSC
|
||||
* @mode data
|
||||
* @param opts Options
|
||||
* @param opts.createFromReadableStream Your `react-server-dom-xyz/client`'s
|
||||
* `createFromReadableStream`. Used to decode payloads from the server.
|
||||
* @param opts.createTemporaryReferenceSet A function that creates a temporary
|
||||
* reference set for the [RSC](https://react.dev/reference/rsc/server-components)
|
||||
* payload.
|
||||
* @param opts.encodeReply Your `react-server-dom-xyz/client`'s `encodeReply`.
|
||||
* Used when sending payloads to the server.
|
||||
* @param opts.fetch Optional [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
|
||||
* implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch).
|
||||
* @returns A function that can be used to call server actions.
|
||||
*/
|
||||
declare function createCallServer({ createFromReadableStream, createTemporaryReferenceSet, encodeReply, fetch: fetchImplementation, }: {
|
||||
createFromReadableStream: BrowserCreateFromReadableStreamFunction;
|
||||
createTemporaryReferenceSet: () => unknown;
|
||||
encodeReply: EncodeReplyFunction;
|
||||
fetch?: (request: Request) => Promise<Response>;
|
||||
}): (id: string, args: unknown[]) => Promise<unknown>;
|
||||
/**
|
||||
* Props for the {@link unstable_RSCHydratedRouter} component.
|
||||
*
|
||||
* @name unstable_RSCHydratedRouterProps
|
||||
* @category Types
|
||||
*/
|
||||
interface RSCHydratedRouterProps {
|
||||
/**
|
||||
* Your `react-server-dom-xyz/client`'s `createFromReadableStream` function,
|
||||
* used to decode payloads from the server.
|
||||
*/
|
||||
createFromReadableStream: BrowserCreateFromReadableStreamFunction;
|
||||
/**
|
||||
* Optional fetch implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch).
|
||||
*/
|
||||
fetch?: (request: Request) => Promise<Response>;
|
||||
/**
|
||||
* The decoded {@link unstable_RSCPayload} to hydrate.
|
||||
*/
|
||||
payload: RSCPayload;
|
||||
/**
|
||||
* A function that returns an {@link RouterContextProvider} instance
|
||||
* which is provided as the `context` argument to client [`action`](../../start/data/route-object#action)s,
|
||||
* [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
|
||||
* This function is called to generate a fresh `context` instance on each
|
||||
* navigation or fetcher call.
|
||||
*/
|
||||
getContext?: RouterInit["getContext"];
|
||||
}
|
||||
/**
|
||||
* Hydrates a server rendered {@link unstable_RSCPayload} in the browser.
|
||||
*
|
||||
* @example
|
||||
* import { startTransition, StrictMode } from "react";
|
||||
* import { hydrateRoot } from "react-dom/client";
|
||||
* import {
|
||||
* unstable_getRSCStream as getRSCStream,
|
||||
* unstable_RSCHydratedRouter as RSCHydratedRouter,
|
||||
* } from "react-router";
|
||||
* import type { unstable_RSCPayload as RSCPayload } from "react-router";
|
||||
*
|
||||
* createFromReadableStream(getRSCStream()).then((payload) =>
|
||||
* startTransition(async () => {
|
||||
* hydrateRoot(
|
||||
* document,
|
||||
* <StrictMode>
|
||||
* <RSCHydratedRouter
|
||||
* createFromReadableStream={createFromReadableStream}
|
||||
* payload={payload}
|
||||
* />
|
||||
* </StrictMode>,
|
||||
* { formState: await getFormState(payload) },
|
||||
* );
|
||||
* }),
|
||||
* );
|
||||
*
|
||||
* @name unstable_RSCHydratedRouter
|
||||
* @public
|
||||
* @category RSC
|
||||
* @mode data
|
||||
* @param props Props
|
||||
* @param {unstable_RSCHydratedRouterProps.createFromReadableStream} props.createFromReadableStream n/a
|
||||
* @param {unstable_RSCHydratedRouterProps.fetch} props.fetch n/a
|
||||
* @param {unstable_RSCHydratedRouterProps.getContext} props.getContext n/a
|
||||
* @param {unstable_RSCHydratedRouterProps.payload} props.payload n/a
|
||||
* @returns A hydrated {@link DataRouter} that can be used to navigate and
|
||||
* render routes.
|
||||
*/
|
||||
declare function RSCHydratedRouter({ createFromReadableStream, fetch: fetchImplementation, payload, getContext, }: RSCHydratedRouterProps): React.JSX.Element;
|
||||
|
||||
export { type BrowserCreateFromReadableStreamFunction as B, type DecodeActionFunction as D, type EncodeReplyFunction as E, type LoadServerActionFunction as L, RSCHydratedRouter as R, type DecodeFormStateFunction as a, type DecodeReplyFunction as b, createCallServer as c, type RSCManifestPayload as d, type RSCPayload as e, type RSCRenderPayload as f, getRequest as g, type RSCHydratedRouterProps as h, type RSCMatch as i, type RSCRouteManifest as j, type RSCRouteMatch as k, type RSCRouteConfigEntry as l, matchRSCServerRequest as m, type RSCRouteConfig as n };
|
||||
-188
@@ -1,188 +0,0 @@
|
||||
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }/**
|
||||
* react-router v7.14.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE.md file in the root directory of this source tree.
|
||||
*
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var _chunk4TJ7T2OQjs = require('./chunk-4TJ7T2OQ.js');
|
||||
|
||||
// lib/dom/ssr/hydration.tsx
|
||||
function getHydrationData({
|
||||
state,
|
||||
routes,
|
||||
getRouteInfo,
|
||||
location,
|
||||
basename,
|
||||
isSpaMode
|
||||
}) {
|
||||
let hydrationData = {
|
||||
...state,
|
||||
loaderData: { ...state.loaderData }
|
||||
};
|
||||
let initialMatches = _chunk4TJ7T2OQjs.matchRoutes.call(void 0, routes, location, basename);
|
||||
if (initialMatches) {
|
||||
for (let match of initialMatches) {
|
||||
let routeId = match.route.id;
|
||||
let routeInfo = getRouteInfo(routeId);
|
||||
if (_chunk4TJ7T2OQjs.shouldHydrateRouteLoader.call(void 0,
|
||||
routeId,
|
||||
routeInfo.clientLoader,
|
||||
routeInfo.hasLoader,
|
||||
isSpaMode
|
||||
) && (routeInfo.hasHydrateFallback || !routeInfo.hasLoader)) {
|
||||
delete hydrationData.loaderData[routeId];
|
||||
} else if (!routeInfo.hasLoader) {
|
||||
hydrationData.loaderData[routeId] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return hydrationData;
|
||||
}
|
||||
|
||||
// lib/rsc/errorBoundaries.tsx
|
||||
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
||||
var RSCRouterGlobalErrorBoundary = class extends _react2.default.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = { error: null, location: props.location };
|
||||
}
|
||||
static getDerivedStateFromError(error) {
|
||||
return { error };
|
||||
}
|
||||
static getDerivedStateFromProps(props, state) {
|
||||
if (state.location !== props.location) {
|
||||
return { error: null, location: props.location };
|
||||
}
|
||||
return { error: state.error, location: state.location };
|
||||
}
|
||||
render() {
|
||||
if (this.state.error) {
|
||||
return /* @__PURE__ */ _react2.default.createElement(
|
||||
RSCDefaultRootErrorBoundaryImpl,
|
||||
{
|
||||
error: this.state.error,
|
||||
renderAppShell: true
|
||||
}
|
||||
);
|
||||
} else {
|
||||
return this.props.children;
|
||||
}
|
||||
}
|
||||
};
|
||||
function ErrorWrapper({
|
||||
renderAppShell,
|
||||
title,
|
||||
children
|
||||
}) {
|
||||
if (!renderAppShell) {
|
||||
return children;
|
||||
}
|
||||
return /* @__PURE__ */ _react2.default.createElement("html", { lang: "en" }, /* @__PURE__ */ _react2.default.createElement("head", null, /* @__PURE__ */ _react2.default.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ _react2.default.createElement(
|
||||
"meta",
|
||||
{
|
||||
name: "viewport",
|
||||
content: "width=device-width,initial-scale=1,viewport-fit=cover"
|
||||
}
|
||||
), /* @__PURE__ */ _react2.default.createElement("title", null, title)), /* @__PURE__ */ _react2.default.createElement("body", null, /* @__PURE__ */ _react2.default.createElement("main", { style: { fontFamily: "system-ui, sans-serif", padding: "2rem" } }, children)));
|
||||
}
|
||||
function RSCDefaultRootErrorBoundaryImpl({
|
||||
error,
|
||||
renderAppShell
|
||||
}) {
|
||||
console.error(error);
|
||||
let heyDeveloper = /* @__PURE__ */ _react2.default.createElement(
|
||||
"script",
|
||||
{
|
||||
dangerouslySetInnerHTML: {
|
||||
__html: `
|
||||
console.log(
|
||||
"\u{1F4BF} Hey developer \u{1F44B}. You can provide a way better UX than this when your app throws errors. Check out https://reactrouter.com/how-to/error-boundary for more information."
|
||||
);
|
||||
`
|
||||
}
|
||||
}
|
||||
);
|
||||
if (_chunk4TJ7T2OQjs.isRouteErrorResponse.call(void 0, error)) {
|
||||
return /* @__PURE__ */ _react2.default.createElement(
|
||||
ErrorWrapper,
|
||||
{
|
||||
renderAppShell,
|
||||
title: "Unhandled Thrown Response!"
|
||||
},
|
||||
/* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText),
|
||||
_chunk4TJ7T2OQjs.ENABLE_DEV_WARNINGS ? heyDeveloper : null
|
||||
);
|
||||
}
|
||||
let errorInstance;
|
||||
if (error instanceof Error) {
|
||||
errorInstance = error;
|
||||
} else {
|
||||
let errorString = error == null ? "Unknown Error" : typeof error === "object" && "toString" in error ? error.toString() : JSON.stringify(error);
|
||||
errorInstance = new Error(errorString);
|
||||
}
|
||||
return /* @__PURE__ */ _react2.default.createElement(ErrorWrapper, { renderAppShell, title: "Application Error!" }, /* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, "Application Error"), /* @__PURE__ */ _react2.default.createElement(
|
||||
"pre",
|
||||
{
|
||||
style: {
|
||||
padding: "2rem",
|
||||
background: "hsla(10, 50%, 50%, 0.1)",
|
||||
color: "red",
|
||||
overflow: "auto"
|
||||
}
|
||||
},
|
||||
errorInstance.stack
|
||||
), heyDeveloper);
|
||||
}
|
||||
function RSCDefaultRootErrorBoundary({
|
||||
hasRootLayout
|
||||
}) {
|
||||
let error = _chunk4TJ7T2OQjs.useRouteError.call(void 0, );
|
||||
if (hasRootLayout === void 0) {
|
||||
throw new Error("Missing 'hasRootLayout' prop");
|
||||
}
|
||||
return /* @__PURE__ */ _react2.default.createElement(
|
||||
RSCDefaultRootErrorBoundaryImpl,
|
||||
{
|
||||
renderAppShell: !hasRootLayout,
|
||||
error
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// lib/rsc/route-modules.ts
|
||||
function createRSCRouteModules(payload) {
|
||||
const routeModules = {};
|
||||
for (const match of payload.matches) {
|
||||
populateRSCRouteModules(routeModules, match);
|
||||
}
|
||||
return routeModules;
|
||||
}
|
||||
function populateRSCRouteModules(routeModules, matches) {
|
||||
matches = Array.isArray(matches) ? matches : [matches];
|
||||
for (const match of matches) {
|
||||
routeModules[match.id] = {
|
||||
links: match.links,
|
||||
meta: match.meta,
|
||||
default: noopComponent
|
||||
};
|
||||
}
|
||||
}
|
||||
var noopComponent = () => null;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
exports.getHydrationData = getHydrationData; exports.RSCRouterGlobalErrorBoundary = RSCRouterGlobalErrorBoundary; exports.RSCDefaultRootErrorBoundary = RSCDefaultRootErrorBoundary; exports.createRSCRouteModules = createRSCRouteModules; exports.populateRSCRouteModules = populateRSCRouteModules;
|
||||
-9963
File diff suppressed because one or more lines are too long
-1352
File diff suppressed because it is too large
Load Diff
-11252
File diff suppressed because it is too large
Load Diff
-2565
File diff suppressed because it is too large
Load Diff
-1713
File diff suppressed because it is too large
Load Diff
+10
-10
@@ -1,10 +1,10 @@
|
||||
import * as React from 'react';
|
||||
import { a as RouterProviderProps$1, R as RouterInit, u as unstable_ClientInstrumentation, C as ClientOnErrorFunction } from './context-phCt_zmH.mjs';
|
||||
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-vtIR1Kpe.mjs';
|
||||
import './routeModules-BRrCYrSL.mjs';
|
||||
import { a as RouterProviderProps$1, R as RouterInit, C as ClientInstrumentation, b as ClientOnErrorFunction } from './context-CmHpk1Ws.mjs';
|
||||
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-CGcs-0pD.mjs';
|
||||
import './data-U8FS-wNn.mjs';
|
||||
|
||||
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
||||
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
||||
declare function RouterProvider(props: RouterProviderProps): React.JSX.Element;
|
||||
|
||||
/**
|
||||
* Props for the {@link dom.HydratedRouter} component.
|
||||
@@ -65,12 +65,12 @@ interface HydratedRouterProps {
|
||||
* startTransition(() => {
|
||||
* hydrateRoot(
|
||||
* document,
|
||||
* <HydratedRouter unstable_instrumentations={[logging]} />
|
||||
* <HydratedRouter instrumentations={[logging]} />
|
||||
* );
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
||||
instrumentations?: ClientInstrumentation[];
|
||||
/**
|
||||
* An error handler function that will be called for any middleware, loader, action,
|
||||
* or render errors that are encountered in your application. This is useful for
|
||||
@@ -82,8 +82,8 @@ interface HydratedRouterProps {
|
||||
* and is only present for render errors.
|
||||
*
|
||||
* ```tsx
|
||||
* <HydratedRouter onError=(error, info) => {
|
||||
* let { location, params, unstable_pattern, errorInfo } = info;
|
||||
* <HydratedRouter onError={(error, info) => {
|
||||
* let { location, params, pattern, errorInfo } = info;
|
||||
* console.error(error, location, errorInfo);
|
||||
* reportToErrorService(error, location, errorInfo);
|
||||
* }} />
|
||||
@@ -106,9 +106,9 @@ interface HydratedRouterProps {
|
||||
* - When set to `false`, the router will not leverage `React.startTransition` or
|
||||
* `React.useOptimistic` on any navigations or state changes.
|
||||
*
|
||||
* For more information, please see the [docs](https://reactrouter.com/explanation/react-transitions).
|
||||
* For more information, please see the [docs](../../explanation/react-transitions).
|
||||
*/
|
||||
unstable_useTransitions?: boolean;
|
||||
useTransitions?: boolean;
|
||||
}
|
||||
/**
|
||||
* Framework-mode router component to be used to hydrate a router from a
|
||||
|
||||
+10
-10
@@ -1,11 +1,11 @@
|
||||
import * as React from 'react';
|
||||
import { RouterProviderProps as RouterProviderProps$1, RouterInit, ClientOnErrorFunction } from 'react-router';
|
||||
import { u as unstable_ClientInstrumentation } from './instrumentation-BYr6ff5D.js';
|
||||
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-C9Ar1yxG.js';
|
||||
import './routeModules-CA7kSxJJ.js';
|
||||
import { C as ClientInstrumentation } from './instrumentation-1q4YhLGP.js';
|
||||
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-D3uq9sI1.js';
|
||||
import './data-D4xhSy90.js';
|
||||
|
||||
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
||||
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
||||
declare function RouterProvider(props: RouterProviderProps): React.JSX.Element;
|
||||
|
||||
/**
|
||||
* Props for the {@link dom.HydratedRouter} component.
|
||||
@@ -66,12 +66,12 @@ interface HydratedRouterProps {
|
||||
* startTransition(() => {
|
||||
* hydrateRoot(
|
||||
* document,
|
||||
* <HydratedRouter unstable_instrumentations={[logging]} />
|
||||
* <HydratedRouter instrumentations={[logging]} />
|
||||
* );
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
||||
instrumentations?: ClientInstrumentation[];
|
||||
/**
|
||||
* An error handler function that will be called for any middleware, loader, action,
|
||||
* or render errors that are encountered in your application. This is useful for
|
||||
@@ -83,8 +83,8 @@ interface HydratedRouterProps {
|
||||
* and is only present for render errors.
|
||||
*
|
||||
* ```tsx
|
||||
* <HydratedRouter onError=(error, info) => {
|
||||
* let { location, params, unstable_pattern, errorInfo } = info;
|
||||
* <HydratedRouter onError={(error, info) => {
|
||||
* let { location, params, pattern, errorInfo } = info;
|
||||
* console.error(error, location, errorInfo);
|
||||
* reportToErrorService(error, location, errorInfo);
|
||||
* }} />
|
||||
@@ -107,9 +107,9 @@ interface HydratedRouterProps {
|
||||
* - When set to `false`, the router will not leverage `React.startTransition` or
|
||||
* `React.useOptimistic` on any navigations or state changes.
|
||||
*
|
||||
* For more information, please see the [docs](https://reactrouter.com/explanation/react-transitions).
|
||||
* For more information, please see the [docs](../../explanation/react-transitions).
|
||||
*/
|
||||
unstable_useTransitions?: boolean;
|
||||
useTransitions?: boolean;
|
||||
}
|
||||
/**
|
||||
* Framework-mode router component to be used to hydrate a router from a
|
||||
|
||||
+59
-64
@@ -1,5 +1,5 @@
|
||||
"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; }/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
|
||||
|
||||
var _chunk355DUZMCjs = require('./chunk-355DUZMC.js');
|
||||
var _chunkCTIXC7EVjs = require('./chunk-CTIXC7EV.js');
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,8 @@ var _chunk355DUZMCjs = require('./chunk-355DUZMC.js');
|
||||
|
||||
|
||||
|
||||
var _chunk4TJ7T2OQjs = require('./chunk-4TJ7T2OQ.js');
|
||||
|
||||
var _chunkRTRY3JFTjs = require('./chunk-RTRY3JFT.js');
|
||||
|
||||
// lib/dom-export/dom-router-provider.tsx
|
||||
var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react);
|
||||
@@ -90,7 +91,7 @@ function initSsrInfo() {
|
||||
}
|
||||
function createHydratedRouter({
|
||||
getContext,
|
||||
unstable_instrumentations
|
||||
instrumentations
|
||||
}) {
|
||||
initSsrInfo();
|
||||
if (!ssrInfo) {
|
||||
@@ -163,10 +164,10 @@ function createHydratedRouter({
|
||||
getContext,
|
||||
hydrationData,
|
||||
hydrationRouteProperties: _reactrouter.UNSAFE_hydrationRouteProperties,
|
||||
unstable_instrumentations,
|
||||
instrumentations,
|
||||
mapRouteProperties: _reactrouter.UNSAFE_mapRouteProperties,
|
||||
future: {
|
||||
unstable_passThroughRequests: ssrInfo.context.future.unstable_passThroughRequests
|
||||
v8_passThroughRequests: ssrInfo.context.future.v8_passThroughRequests
|
||||
},
|
||||
dataStrategy: _reactrouter.UNSAFE_getTurboStreamSingleFetchDataStrategy.call(void 0,
|
||||
() => router2,
|
||||
@@ -174,7 +175,7 @@ function createHydratedRouter({
|
||||
ssrInfo.routeModules,
|
||||
ssrInfo.context.ssr,
|
||||
ssrInfo.context.basename,
|
||||
ssrInfo.context.future.unstable_trailingSlashAwareDataRequests
|
||||
ssrInfo.context.future.v8_trailingSlashAwareDataRequests
|
||||
),
|
||||
patchRoutesOnNavigation: _reactrouter.UNSAFE_getPatchRoutesOnNavigationFunction.call(void 0,
|
||||
() => router2,
|
||||
@@ -200,7 +201,7 @@ function HydratedRouter(props) {
|
||||
if (!router) {
|
||||
router = createHydratedRouter({
|
||||
getContext: props.getContext,
|
||||
unstable_instrumentations: props.unstable_instrumentations
|
||||
instrumentations: props.instrumentations
|
||||
});
|
||||
}
|
||||
let [criticalCss, setCriticalCss] = React2.useState(
|
||||
@@ -213,7 +214,7 @@ function HydratedRouter(props) {
|
||||
}, []);
|
||||
React2.useEffect(() => {
|
||||
if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
|
||||
document.querySelectorAll(`[${_chunk4TJ7T2OQjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
|
||||
document.querySelectorAll(`[${_chunkRTRY3JFTjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
|
||||
}
|
||||
}, [criticalCss]);
|
||||
let [location2, setLocation] = React2.useState(router.state.location);
|
||||
@@ -261,7 +262,7 @@ function HydratedRouter(props) {
|
||||
RouterProvider2,
|
||||
{
|
||||
router,
|
||||
unstable_useTransitions: props.unstable_useTransitions,
|
||||
useTransitions: props.useTransitions,
|
||||
onError: props.onError
|
||||
}
|
||||
))
|
||||
@@ -392,7 +393,7 @@ function createRouterFromPayload({
|
||||
};
|
||||
if (payload.type !== "render") throw new Error("Invalid payload type");
|
||||
globalVar.__reactRouterRouteModules = _nullishCoalesce(globalVar.__reactRouterRouteModules, () => ( {}));
|
||||
_chunk355DUZMCjs.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
|
||||
_chunkCTIXC7EVjs.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
|
||||
let routes = payload.matches.reduceRight((previous, match) => {
|
||||
const route = createRouteFromServerManifest(
|
||||
match,
|
||||
@@ -406,12 +407,12 @@ function createRouterFromPayload({
|
||||
return [route];
|
||||
}, []);
|
||||
let applyPatchesPromise;
|
||||
globalVar.__reactRouterDataRouter = _chunk4TJ7T2OQjs.createRouter.call(void 0, {
|
||||
globalVar.__reactRouterDataRouter = _chunkRTRY3JFTjs.createRouter.call(void 0, {
|
||||
routes,
|
||||
getContext,
|
||||
basename: payload.basename,
|
||||
history: _chunk4TJ7T2OQjs.createBrowserHistory.call(void 0, ),
|
||||
hydrationData: _chunk355DUZMCjs.getHydrationData.call(void 0, {
|
||||
history: _chunkRTRY3JFTjs.createBrowserHistory.call(void 0, ),
|
||||
hydrationData: _chunkCTIXC7EVjs.getHydrationData.call(void 0, {
|
||||
state: {
|
||||
loaderData: payload.loaderData,
|
||||
actionData: payload.actionData,
|
||||
@@ -420,7 +421,7 @@ function createRouterFromPayload({
|
||||
routes,
|
||||
getRouteInfo: (routeId) => {
|
||||
let match = payload.matches.find((m) => m.id === routeId);
|
||||
_chunk4TJ7T2OQjs.invariant.call(void 0, match, "Route not found in payload");
|
||||
_chunkRTRY3JFTjs.invariant.call(void 0, match, "Route not found in payload");
|
||||
return {
|
||||
clientLoader: match.clientLoader,
|
||||
hasLoader: match.hasLoader,
|
||||
@@ -535,9 +536,9 @@ function createRouterFromPayload({
|
||||
routeModules: globalVar.__reactRouterRouteModules
|
||||
};
|
||||
}
|
||||
var renderedRoutesContext = _chunk4TJ7T2OQjs.createContext.call(void 0, );
|
||||
var renderedRoutesContext = _chunkRTRY3JFTjs.createContext.call(void 0, );
|
||||
function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReadableStream, fetchImplementation) {
|
||||
let dataStrategy = _chunk4TJ7T2OQjs.getSingleFetchDataStrategyImpl.call(void 0,
|
||||
let dataStrategy = _chunkRTRY3JFTjs.getSingleFetchDataStrategyImpl.call(void 0,
|
||||
getRouter,
|
||||
(match) => {
|
||||
let M = match;
|
||||
@@ -546,8 +547,7 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
|
||||
hasClientLoader: M.route.hasClientLoader,
|
||||
hasComponent: M.route.hasComponent,
|
||||
hasAction: M.route.hasAction,
|
||||
hasClientAction: M.route.hasClientAction,
|
||||
hasShouldRevalidate: M.route.hasShouldRevalidate
|
||||
hasClientAction: M.route.hasClientAction
|
||||
};
|
||||
},
|
||||
// pass map into fetchAndDecode so it can add payloads
|
||||
@@ -595,20 +595,20 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
|
||||
function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation) {
|
||||
return async (args, basename, trailingSlashAware, targetRoutes) => {
|
||||
let { request, context } = args;
|
||||
let url = _chunk4TJ7T2OQjs.singleFetchUrl.call(void 0, request.url, basename, trailingSlashAware, "rsc");
|
||||
let url = _chunkRTRY3JFTjs.singleFetchUrl.call(void 0, request.url, basename, trailingSlashAware, "rsc");
|
||||
if (request.method === "GET") {
|
||||
url = _chunk4TJ7T2OQjs.stripIndexParam.call(void 0, url);
|
||||
url = _chunkRTRY3JFTjs.stripIndexParam.call(void 0, url);
|
||||
if (targetRoutes) {
|
||||
url.searchParams.set("_routes", targetRoutes.join(","));
|
||||
}
|
||||
}
|
||||
let res = await fetchImplementation(
|
||||
new Request(url, await _chunk4TJ7T2OQjs.createRequestInit.call(void 0, request))
|
||||
new Request(url, await _chunkRTRY3JFTjs.createRequestInit.call(void 0, request))
|
||||
);
|
||||
if (res.status >= 400 && !res.headers.has("X-Remix-Response")) {
|
||||
throw new (0, _chunk4TJ7T2OQjs.ErrorResponseImpl)(res.status, res.statusText, await res.text());
|
||||
throw new (0, _chunkRTRY3JFTjs.ErrorResponseImpl)(res.status, res.statusText, await res.text());
|
||||
}
|
||||
_chunk4TJ7T2OQjs.invariant.call(void 0, res.body, "No response body to decode");
|
||||
_chunkRTRY3JFTjs.invariant.call(void 0, res.body, "No response body to decode");
|
||||
try {
|
||||
const payload = await createFromReadableStream(res.body, {
|
||||
temporaryReferences: void 0
|
||||
@@ -632,7 +632,7 @@ function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation)
|
||||
}
|
||||
context.get(renderedRoutesContext).push(...payload.matches);
|
||||
let results = { routes: {} };
|
||||
const dataKey = _chunk4TJ7T2OQjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
|
||||
const dataKey = _chunkRTRY3JFTjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
|
||||
for (let [routeId, data] of Object.entries(payload[dataKey] || {})) {
|
||||
results.routes[routeId] = { data };
|
||||
}
|
||||
@@ -665,7 +665,7 @@ function RSCHydratedRouter({
|
||||
[createFromReadableStream, payload, fetchImplementation, getContext]
|
||||
);
|
||||
React3.useEffect(() => {
|
||||
_chunk4TJ7T2OQjs.setIsHydrated.call(void 0, );
|
||||
_chunkRTRY3JFTjs.setIsHydrated.call(void 0, );
|
||||
}, []);
|
||||
React3.useLayoutEffect(() => {
|
||||
const globalVar = window;
|
||||
@@ -750,10 +750,9 @@ function RSCHydratedRouter({
|
||||
// These flags have no runtime impact so can always be false. If we add
|
||||
// flags that drive runtime behavior they'll need to be proxied through.
|
||||
v8_middleware: false,
|
||||
unstable_subResourceIntegrity: false,
|
||||
unstable_trailingSlashAwareDataRequests: true,
|
||||
v8_trailingSlashAwareDataRequests: true,
|
||||
// always on for RSC
|
||||
unstable_passThroughRequests: true
|
||||
v8_passThroughRequests: true
|
||||
// always on for RSC
|
||||
},
|
||||
isSpaMode: false,
|
||||
@@ -774,8 +773,8 @@ function RSCHydratedRouter({
|
||||
},
|
||||
routeModules
|
||||
};
|
||||
return /* @__PURE__ */ React3.createElement(_chunk4TJ7T2OQjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunk355DUZMCjs.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunk4TJ7T2OQjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
|
||||
_chunk4TJ7T2OQjs.RouterProvider,
|
||||
return /* @__PURE__ */ React3.createElement(_chunkRTRY3JFTjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkCTIXC7EVjs.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkRTRY3JFTjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
|
||||
_chunkRTRY3JFTjs.RouterProvider,
|
||||
{
|
||||
router: transitionEnabledRouter,
|
||||
flushSync: ReactDOM2.flushSync
|
||||
@@ -791,8 +790,8 @@ function createRouteFromServerManifest(match, payload) {
|
||||
// the server loader flow regardless of whether the client loader calls
|
||||
// `serverLoader` or not, otherwise we'll have nothing to render.
|
||||
match.hasComponent && !match.element;
|
||||
_chunk4TJ7T2OQjs.invariant.call(void 0, window.__reactRouterRouteModules);
|
||||
_chunk355DUZMCjs.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
|
||||
_chunkRTRY3JFTjs.invariant.call(void 0, window.__reactRouterRouteModules);
|
||||
_chunkCTIXC7EVjs.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
|
||||
let dataRoute = {
|
||||
id: match.id,
|
||||
element: match.element,
|
||||
@@ -802,30 +801,28 @@ function createRouteFromServerManifest(match, payload) {
|
||||
hydrateFallbackElement: match.hydrateFallbackElement,
|
||||
index: match.index,
|
||||
loader: match.clientLoader ? async (args, singleFetch) => {
|
||||
try {
|
||||
let result = await match.clientLoader({
|
||||
...args,
|
||||
serverLoader: () => {
|
||||
preventInvalidServerHandlerCall(
|
||||
"loader",
|
||||
match.id,
|
||||
match.hasLoader
|
||||
);
|
||||
if (isHydrationRequest) {
|
||||
if (hasInitialData) {
|
||||
return initialData;
|
||||
}
|
||||
if (hasInitialError) {
|
||||
throw initialError;
|
||||
}
|
||||
let _isHydrationRequest = isHydrationRequest;
|
||||
isHydrationRequest = false;
|
||||
let result = await match.clientLoader({
|
||||
...args,
|
||||
serverLoader: () => {
|
||||
preventInvalidServerHandlerCall(
|
||||
"loader",
|
||||
match.id,
|
||||
match.hasLoader
|
||||
);
|
||||
if (_isHydrationRequest) {
|
||||
if (hasInitialData) {
|
||||
return initialData;
|
||||
}
|
||||
if (hasInitialError) {
|
||||
throw initialError;
|
||||
}
|
||||
return callSingleFetch(singleFetch);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
} finally {
|
||||
isHydrationRequest = false;
|
||||
}
|
||||
return callSingleFetch(singleFetch);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
} : (
|
||||
// We always make the call in this RSC world since even if we don't
|
||||
// have a `loader` we may need to get the `element` implementation
|
||||
@@ -842,7 +839,7 @@ function createRouteFromServerManifest(match, payload) {
|
||||
return await callSingleFetch(singleFetch);
|
||||
}
|
||||
}) : match.hasAction ? (_, singleFetch) => callSingleFetch(singleFetch) : () => {
|
||||
throw _chunk4TJ7T2OQjs.noActionDefinedError.call(void 0, "action", match.id);
|
||||
throw _chunkRTRY3JFTjs.noActionDefinedError.call(void 0, "action", match.id);
|
||||
},
|
||||
path: match.path,
|
||||
shouldRevalidate: match.shouldRevalidate,
|
||||
@@ -851,11 +848,10 @@ function createRouteFromServerManifest(match, payload) {
|
||||
hasLoader: true,
|
||||
hasClientLoader: match.clientLoader != null,
|
||||
hasAction: match.hasAction,
|
||||
hasClientAction: match.clientAction != null,
|
||||
hasShouldRevalidate: match.shouldRevalidate != null
|
||||
hasClientAction: match.clientAction != null
|
||||
};
|
||||
if (typeof dataRoute.loader === "function") {
|
||||
dataRoute.loader.hydrate = _chunk4TJ7T2OQjs.shouldHydrateRouteLoader.call(void 0,
|
||||
dataRoute.loader.hydrate = _chunkRTRY3JFTjs.shouldHydrateRouteLoader.call(void 0,
|
||||
match.id,
|
||||
match.clientLoader,
|
||||
match.hasLoader,
|
||||
@@ -865,7 +861,7 @@ function createRouteFromServerManifest(match, payload) {
|
||||
return dataRoute;
|
||||
}
|
||||
function callSingleFetch(singleFetch) {
|
||||
_chunk4TJ7T2OQjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
|
||||
_chunkRTRY3JFTjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
|
||||
return singleFetch();
|
||||
}
|
||||
function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
|
||||
@@ -873,13 +869,12 @@ function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
|
||||
let fn = type === "action" ? "serverAction()" : "serverLoader()";
|
||||
let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${routeId}")`;
|
||||
console.error(msg);
|
||||
throw new (0, _chunk4TJ7T2OQjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
|
||||
throw new (0, _chunkRTRY3JFTjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
|
||||
}
|
||||
}
|
||||
var nextPaths = /* @__PURE__ */ new Set();
|
||||
var discoveredPathsMaxSize = 1e3;
|
||||
var discoveredPaths = /* @__PURE__ */ new Set();
|
||||
var URL_LIMIT = 7680;
|
||||
function getManifestUrl(paths) {
|
||||
if (paths.length === 0) {
|
||||
return null;
|
||||
@@ -901,7 +896,7 @@ async function fetchAndApplyManifestPatches(paths, createFromReadableStream, fet
|
||||
if (url == null) {
|
||||
return;
|
||||
}
|
||||
if (url.toString().length > URL_LIMIT) {
|
||||
if (url.toString().length > _chunkRTRY3JFTjs.URL_LIMIT) {
|
||||
nextPaths.clear();
|
||||
return;
|
||||
}
|
||||
@@ -946,7 +941,7 @@ function isExternalLocation(location2) {
|
||||
}
|
||||
function hasInvalidProtocol(location2) {
|
||||
try {
|
||||
return _chunk4TJ7T2OQjs.invalidProtocols.includes(new URL(location2).protocol);
|
||||
return _chunkRTRY3JFTjs.invalidProtocols.includes(new URL(location2).protocol);
|
||||
} catch (e2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+34
-39
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
deserializeErrors,
|
||||
getHydrationData,
|
||||
populateRSCRouteModules
|
||||
} from "./chunk-X5LK27NZ.mjs";
|
||||
} from "./chunk-5TQZEVD5.mjs";
|
||||
import {
|
||||
CRITICAL_CSS_DATA_ATTRIBUTE,
|
||||
ErrorResponseImpl,
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
RSCRouterContext,
|
||||
RemixErrorBoundary,
|
||||
RouterProvider,
|
||||
URL_LIMIT,
|
||||
createBrowserHistory,
|
||||
createClientRoutes,
|
||||
createClientRoutesWithHMRRevalidationOptOut,
|
||||
@@ -43,7 +44,7 @@ import {
|
||||
singleFetchUrl,
|
||||
stripIndexParam,
|
||||
useFogOFWarDiscovery
|
||||
} from "./chunk-HZQGQD2X.mjs";
|
||||
} from "./chunk-OSYEOCBT.mjs";
|
||||
|
||||
// lib/dom-export/dom-router-provider.tsx
|
||||
import * as React from "react";
|
||||
@@ -82,7 +83,7 @@ function initSsrInfo() {
|
||||
}
|
||||
function createHydratedRouter({
|
||||
getContext,
|
||||
unstable_instrumentations
|
||||
instrumentations
|
||||
}) {
|
||||
initSsrInfo();
|
||||
if (!ssrInfo) {
|
||||
@@ -155,10 +156,10 @@ function createHydratedRouter({
|
||||
getContext,
|
||||
hydrationData,
|
||||
hydrationRouteProperties,
|
||||
unstable_instrumentations,
|
||||
instrumentations,
|
||||
mapRouteProperties,
|
||||
future: {
|
||||
unstable_passThroughRequests: ssrInfo.context.future.unstable_passThroughRequests
|
||||
v8_passThroughRequests: ssrInfo.context.future.v8_passThroughRequests
|
||||
},
|
||||
dataStrategy: getTurboStreamSingleFetchDataStrategy(
|
||||
() => router2,
|
||||
@@ -166,7 +167,7 @@ function createHydratedRouter({
|
||||
ssrInfo.routeModules,
|
||||
ssrInfo.context.ssr,
|
||||
ssrInfo.context.basename,
|
||||
ssrInfo.context.future.unstable_trailingSlashAwareDataRequests
|
||||
ssrInfo.context.future.v8_trailingSlashAwareDataRequests
|
||||
),
|
||||
patchRoutesOnNavigation: getPatchRoutesOnNavigationFunction(
|
||||
() => router2,
|
||||
@@ -192,7 +193,7 @@ function HydratedRouter(props) {
|
||||
if (!router) {
|
||||
router = createHydratedRouter({
|
||||
getContext: props.getContext,
|
||||
unstable_instrumentations: props.unstable_instrumentations
|
||||
instrumentations: props.instrumentations
|
||||
});
|
||||
}
|
||||
let [criticalCss, setCriticalCss] = React2.useState(
|
||||
@@ -253,7 +254,7 @@ function HydratedRouter(props) {
|
||||
RouterProvider2,
|
||||
{
|
||||
router,
|
||||
unstable_useTransitions: props.unstable_useTransitions,
|
||||
useTransitions: props.useTransitions,
|
||||
onError: props.onError
|
||||
}
|
||||
))
|
||||
@@ -538,8 +539,7 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
|
||||
hasClientLoader: M.route.hasClientLoader,
|
||||
hasComponent: M.route.hasComponent,
|
||||
hasAction: M.route.hasAction,
|
||||
hasClientAction: M.route.hasClientAction,
|
||||
hasShouldRevalidate: M.route.hasShouldRevalidate
|
||||
hasClientAction: M.route.hasClientAction
|
||||
};
|
||||
},
|
||||
// pass map into fetchAndDecode so it can add payloads
|
||||
@@ -742,10 +742,9 @@ function RSCHydratedRouter({
|
||||
// These flags have no runtime impact so can always be false. If we add
|
||||
// flags that drive runtime behavior they'll need to be proxied through.
|
||||
v8_middleware: false,
|
||||
unstable_subResourceIntegrity: false,
|
||||
unstable_trailingSlashAwareDataRequests: true,
|
||||
v8_trailingSlashAwareDataRequests: true,
|
||||
// always on for RSC
|
||||
unstable_passThroughRequests: true
|
||||
v8_passThroughRequests: true
|
||||
// always on for RSC
|
||||
},
|
||||
isSpaMode: false,
|
||||
@@ -794,30 +793,28 @@ function createRouteFromServerManifest(match, payload) {
|
||||
hydrateFallbackElement: match.hydrateFallbackElement,
|
||||
index: match.index,
|
||||
loader: match.clientLoader ? async (args, singleFetch) => {
|
||||
try {
|
||||
let result = await match.clientLoader({
|
||||
...args,
|
||||
serverLoader: () => {
|
||||
preventInvalidServerHandlerCall(
|
||||
"loader",
|
||||
match.id,
|
||||
match.hasLoader
|
||||
);
|
||||
if (isHydrationRequest) {
|
||||
if (hasInitialData) {
|
||||
return initialData;
|
||||
}
|
||||
if (hasInitialError) {
|
||||
throw initialError;
|
||||
}
|
||||
let _isHydrationRequest = isHydrationRequest;
|
||||
isHydrationRequest = false;
|
||||
let result = await match.clientLoader({
|
||||
...args,
|
||||
serverLoader: () => {
|
||||
preventInvalidServerHandlerCall(
|
||||
"loader",
|
||||
match.id,
|
||||
match.hasLoader
|
||||
);
|
||||
if (_isHydrationRequest) {
|
||||
if (hasInitialData) {
|
||||
return initialData;
|
||||
}
|
||||
if (hasInitialError) {
|
||||
throw initialError;
|
||||
}
|
||||
return callSingleFetch(singleFetch);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
} finally {
|
||||
isHydrationRequest = false;
|
||||
}
|
||||
return callSingleFetch(singleFetch);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
} : (
|
||||
// We always make the call in this RSC world since even if we don't
|
||||
// have a `loader` we may need to get the `element` implementation
|
||||
@@ -843,8 +840,7 @@ function createRouteFromServerManifest(match, payload) {
|
||||
hasLoader: true,
|
||||
hasClientLoader: match.clientLoader != null,
|
||||
hasAction: match.hasAction,
|
||||
hasClientAction: match.clientAction != null,
|
||||
hasShouldRevalidate: match.shouldRevalidate != null
|
||||
hasClientAction: match.clientAction != null
|
||||
};
|
||||
if (typeof dataRoute.loader === "function") {
|
||||
dataRoute.loader.hydrate = shouldHydrateRouteLoader(
|
||||
@@ -871,7 +867,6 @@ function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
|
||||
var nextPaths = /* @__PURE__ */ new Set();
|
||||
var discoveredPathsMaxSize = 1e3;
|
||||
var discoveredPaths = /* @__PURE__ */ new Set();
|
||||
var URL_LIMIT = 7680;
|
||||
function getManifestUrl(paths) {
|
||||
if (paths.length === 0) {
|
||||
return null;
|
||||
|
||||
Generated
Vendored
-2590
File diff suppressed because it is too large
Load Diff
Generated
Vendored
-3645
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -1,4 +1,4 @@
|
||||
export { Q as MemoryRouter, T as Navigate, U as Outlet, V as Route, W as Router, X as RouterProvider, Y as Routes, A as UNSAFE_AwaitContextProvider, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps } from './context-phCt_zmH.mjs';
|
||||
export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-BwWaHAr3.mjs';
|
||||
import './routeModules-BRrCYrSL.mjs';
|
||||
export { Q as MemoryRouter, T as Navigate, U as Outlet, V as Route, W as Router, X as RouterProvider, Y as Routes, A as UNSAFE_AwaitContextProvider, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps } from './context-CmHpk1Ws.mjs';
|
||||
export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-DPrDrCew.mjs';
|
||||
import './data-U8FS-wNn.mjs';
|
||||
import 'react';
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
export { W as BrowserRouter, $ as Form, X as HashRouter, Y as Link, an as Links, j as MemoryRouter, am as Meta, _ as NavLink, k as Navigate, l as Outlet, m as Route, n as Router, o as RouterProvider, p as Routes, a0 as ScrollRestoration, ak as StaticRouter, al as StaticRouterProvider, b as UNSAFE_AwaitContextProvider, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, Z as unstable_HistoryRouter } from './index-react-server-client-luDbagNU.js';
|
||||
import './instrumentation-BYr6ff5D.js';
|
||||
import './routeModules-CA7kSxJJ.js';
|
||||
export { W as BrowserRouter, $ as Form, X as HashRouter, Y as Link, an as Links, j as MemoryRouter, am as Meta, _ as NavLink, k as Navigate, l as Outlet, m as Route, n as Router, o as RouterProvider, p as Routes, a0 as ScrollRestoration, ak as StaticRouter, al as StaticRouterProvider, b as UNSAFE_AwaitContextProvider, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, Z as unstable_HistoryRouter } from './index-react-server-client-CwU9bE5R.js';
|
||||
import './instrumentation-1q4YhLGP.js';
|
||||
import './data-D4xhSy90.js';
|
||||
import 'react';
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
"use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
|
||||
|
||||
var _chunkFPT5DLVJjs = require('./chunk-FPT5DLVJ.js');
|
||||
var _chunkEN242BO4js = require('./chunk-EN242BO4.js');
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ var _chunkFPT5DLVJjs = require('./chunk-FPT5DLVJ.js');
|
||||
|
||||
|
||||
|
||||
var _chunk4TJ7T2OQjs = require('./chunk-4TJ7T2OQ.js');
|
||||
var _chunkRTRY3JFTjs = require('./chunk-RTRY3JFT.js');
|
||||
|
||||
|
||||
|
||||
@@ -58,4 +58,4 @@ var _chunk4TJ7T2OQjs = require('./chunk-4TJ7T2OQ.js');
|
||||
|
||||
|
||||
|
||||
exports.BrowserRouter = _chunkFPT5DLVJjs.BrowserRouter; exports.Form = _chunkFPT5DLVJjs.Form; exports.HashRouter = _chunkFPT5DLVJjs.HashRouter; exports.Link = _chunkFPT5DLVJjs.Link; exports.Links = _chunk4TJ7T2OQjs.Links; exports.MemoryRouter = _chunk4TJ7T2OQjs.MemoryRouter; exports.Meta = _chunk4TJ7T2OQjs.Meta; exports.NavLink = _chunkFPT5DLVJjs.NavLink; exports.Navigate = _chunk4TJ7T2OQjs.Navigate; exports.Outlet = _chunk4TJ7T2OQjs.Outlet; exports.Route = _chunk4TJ7T2OQjs.Route; exports.Router = _chunk4TJ7T2OQjs.Router; exports.RouterProvider = _chunk4TJ7T2OQjs.RouterProvider; exports.Routes = _chunk4TJ7T2OQjs.Routes; exports.ScrollRestoration = _chunkFPT5DLVJjs.ScrollRestoration; exports.StaticRouter = _chunkFPT5DLVJjs.StaticRouter; exports.StaticRouterProvider = _chunkFPT5DLVJjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunk4TJ7T2OQjs.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunk4TJ7T2OQjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunk4TJ7T2OQjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunk4TJ7T2OQjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkFPT5DLVJjs.HistoryRouter;
|
||||
exports.BrowserRouter = _chunkEN242BO4js.BrowserRouter; exports.Form = _chunkEN242BO4js.Form; exports.HashRouter = _chunkEN242BO4js.HashRouter; exports.Link = _chunkEN242BO4js.Link; exports.Links = _chunkRTRY3JFTjs.Links; exports.MemoryRouter = _chunkRTRY3JFTjs.MemoryRouter; exports.Meta = _chunkRTRY3JFTjs.Meta; exports.NavLink = _chunkEN242BO4js.NavLink; exports.Navigate = _chunkRTRY3JFTjs.Navigate; exports.Outlet = _chunkRTRY3JFTjs.Outlet; exports.Route = _chunkRTRY3JFTjs.Route; exports.Router = _chunkRTRY3JFTjs.Router; exports.RouterProvider = _chunkRTRY3JFTjs.RouterProvider; exports.Routes = _chunkRTRY3JFTjs.Routes; exports.ScrollRestoration = _chunkEN242BO4js.ScrollRestoration; exports.StaticRouter = _chunkEN242BO4js.StaticRouter; exports.StaticRouterProvider = _chunkEN242BO4js.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkRTRY3JFTjs.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunkRTRY3JFTjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkRTRY3JFTjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkRTRY3JFTjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkEN242BO4js.HistoryRouter;
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
@@ -32,7 +32,7 @@ import {
|
||||
WithComponentProps,
|
||||
WithErrorBoundaryProps,
|
||||
WithHydrateFallbackProps
|
||||
} from "./chunk-HZQGQD2X.mjs";
|
||||
} from "./chunk-OSYEOCBT.mjs";
|
||||
export {
|
||||
BrowserRouter,
|
||||
Form,
|
||||
|
||||
+120
-37
@@ -64,7 +64,7 @@ interface Location<State = any> extends Path {
|
||||
* The masked location displayed in the URL bar, which differs from the URL the
|
||||
* router is operating on
|
||||
*/
|
||||
unstable_mask: Path | undefined;
|
||||
mask?: Path;
|
||||
}
|
||||
/**
|
||||
* A change to the current location.
|
||||
@@ -357,19 +357,19 @@ interface DataFunctionArgs<Context> {
|
||||
/** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read headers (like cookies, and {@link https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams URLSearchParams} from the request. */
|
||||
request: Request;
|
||||
/**
|
||||
* A URL instance representing the application location being navigated to or fetched.
|
||||
* Without `future.unstable_passThroughRequests` enabled, this matches `request.url`.
|
||||
* With `future.unstable_passThroughRequests` enabled, this is a normalized
|
||||
* URL with React-Router-specific implementation details removed (`.data`
|
||||
* suffixes, `index`/`_routes` search params).
|
||||
* The URL includes the origin from the request for convenience.
|
||||
* A URL instance representing the application location being navigated to or
|
||||
* fetched. By default, this matches `request.url`.
|
||||
*
|
||||
* In Framework mode with `future.v8_passThroughRequests` enabled, this is a
|
||||
* normalized URL with React-Router-specific implementation details removed
|
||||
* (`.data` suffixes, `index`/`_routes` search params).
|
||||
*/
|
||||
unstable_url: URL;
|
||||
url: URL;
|
||||
/**
|
||||
* Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
|
||||
* Mostly useful as a identifier to aggregate on for logging/tracing/etc.
|
||||
*/
|
||||
unstable_pattern: string;
|
||||
pattern: string;
|
||||
/**
|
||||
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
||||
* @example
|
||||
@@ -756,6 +756,7 @@ type DataNonIndexRouteObject = NonIndexRouteObject & {
|
||||
* A data route object, which is just a RouteObject with a required unique ID
|
||||
*/
|
||||
type DataRouteObject = DataIndexRouteObject | DataNonIndexRouteObject;
|
||||
type RouteManifest<R = DataRouteObject> = Record<string, R | undefined>;
|
||||
/**
|
||||
* The parameters that were parsed from the URL path.
|
||||
*/
|
||||
@@ -839,6 +840,24 @@ interface UIMatch<Data = unknown, Handle = unknown> {
|
||||
*/
|
||||
handle: Handle;
|
||||
}
|
||||
interface RouteMeta<RouteObjectType extends RouteObject = RouteObject> {
|
||||
relativePath: string;
|
||||
caseSensitive: boolean;
|
||||
childrenIndex: number;
|
||||
route: RouteObjectType;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* A "branch" of routes that match a given route pattern.
|
||||
* This is an internal interface not intended for direct external usage.
|
||||
*/
|
||||
interface RouteBranch<RouteObjectType extends RouteObject = RouteObject> {
|
||||
path: string;
|
||||
score: number;
|
||||
routesMeta: RouteMeta<RouteObjectType>[];
|
||||
}
|
||||
declare class DataWithResponseInit<D> {
|
||||
type: string;
|
||||
data: D;
|
||||
@@ -878,6 +897,9 @@ type RedirectFunction = (url: string, init?: number | ResponseInit) => Response;
|
||||
* Sets the status code and the [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
|
||||
* header. Defaults to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302).
|
||||
*
|
||||
* This utility accepts absolute URLs and can navigate to external domains, so
|
||||
* the application should validate any user-supplied inputs to redirects.
|
||||
*
|
||||
* @example
|
||||
* import { redirect } from "react-router";
|
||||
*
|
||||
@@ -907,6 +929,9 @@ declare const redirect$1: RedirectFunction;
|
||||
* and the [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
|
||||
* header. Defaults to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302).
|
||||
*
|
||||
* This utility accepts absolute URLs and can navigate to external domains, so
|
||||
* the application should validate any user-supplied inputs to redirects.
|
||||
*
|
||||
* ```tsx filename=routes/logout.tsx
|
||||
* import { redirectDocument } from "react-router";
|
||||
*
|
||||
@@ -1006,25 +1031,25 @@ interface AppLoadContext {
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
type unstable_ServerInstrumentation = {
|
||||
handler?: unstable_InstrumentRequestHandlerFunction;
|
||||
route?: unstable_InstrumentRouteFunction;
|
||||
type ServerInstrumentation = {
|
||||
handler?: InstrumentRequestHandlerFunction;
|
||||
route?: InstrumentRouteFunction;
|
||||
};
|
||||
type unstable_ClientInstrumentation = {
|
||||
router?: unstable_InstrumentRouterFunction;
|
||||
route?: unstable_InstrumentRouteFunction;
|
||||
type ClientInstrumentation = {
|
||||
router?: InstrumentRouterFunction;
|
||||
route?: InstrumentRouteFunction;
|
||||
};
|
||||
type unstable_InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
|
||||
type unstable_InstrumentRouterFunction = (router: InstrumentableRouter) => void;
|
||||
type unstable_InstrumentRouteFunction = (route: InstrumentableRoute) => void;
|
||||
type unstable_InstrumentationHandlerResult = {
|
||||
type InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
|
||||
type InstrumentRouterFunction = (router: InstrumentableRouter) => void;
|
||||
type InstrumentRouteFunction = (route: InstrumentableRoute) => void;
|
||||
type InstrumentationHandlerResult = {
|
||||
status: "success";
|
||||
error: undefined;
|
||||
} | {
|
||||
status: "error";
|
||||
error: Error;
|
||||
};
|
||||
type InstrumentFunction<T> = (handler: () => Promise<unstable_InstrumentationHandlerResult>, info: T) => Promise<void>;
|
||||
type InstrumentFunction<T> = (handler: () => Promise<InstrumentationHandlerResult>, info: T) => Promise<void>;
|
||||
type ReadonlyRequest = {
|
||||
method: string;
|
||||
url: string;
|
||||
@@ -1050,7 +1075,7 @@ type RouteLazyInstrumentationInfo = undefined;
|
||||
type RouteHandlerInstrumentationInfo = Readonly<{
|
||||
request: ReadonlyRequest;
|
||||
params: LoaderFunctionArgs["params"];
|
||||
unstable_pattern: string;
|
||||
pattern: string;
|
||||
context: ReadonlyContext;
|
||||
}>;
|
||||
type InstrumentableRouter = {
|
||||
@@ -1120,6 +1145,20 @@ interface Router {
|
||||
* Return the routes for this router instance
|
||||
*/
|
||||
get routes(): DataRouteObject[];
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the route branches for this router instance
|
||||
*/
|
||||
get branches(): RouteBranch<DataRouteObject>[] | undefined;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the manifest for this router instance
|
||||
*/
|
||||
get manifest(): RouteManifest;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
@@ -1367,7 +1406,6 @@ type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "e
|
||||
* Future flags to toggle new feature behavior
|
||||
*/
|
||||
interface FutureConfig {
|
||||
unstable_passThroughRequests: boolean;
|
||||
}
|
||||
/**
|
||||
* Initialization options for createRouter
|
||||
@@ -1377,7 +1415,7 @@ interface RouterInit {
|
||||
history: History;
|
||||
basename?: string;
|
||||
getContext?: () => MaybePromise<RouterContextProvider>;
|
||||
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
||||
instrumentations?: ClientInstrumentation[];
|
||||
mapRouteProperties?: MapRoutePropertiesFunction;
|
||||
future?: Partial<FutureConfig>;
|
||||
hydrationRouteProperties?: string[];
|
||||
@@ -1405,7 +1443,33 @@ interface StaticHandlerContext {
|
||||
* A StaticHandler instance manages a singular SSR navigation/fetch event
|
||||
*/
|
||||
interface StaticHandler {
|
||||
/**
|
||||
* The set of data routes managed by this handler
|
||||
*/
|
||||
dataRoutes: DataRouteObject[];
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* The route branches derived from the data routes, used for internal route
|
||||
* matching in Framework Mode
|
||||
*/
|
||||
_internalRouteBranches: RouteBranch<DataRouteObject>[];
|
||||
/**
|
||||
* Perform a query for a given request - executing all matched route
|
||||
* loaders/actions. Used for document requests.
|
||||
*
|
||||
* @param request The request to query
|
||||
* @param opts Optional query options
|
||||
* @param opts.dataStrategy Alternate dataStrategy implementation
|
||||
* @param opts.filterMatchesToLoad Predicate function to filter which matches should be loaded
|
||||
* @param opts.generateMiddlewareResponse To enable middleware, provide a function
|
||||
* to generate a response to bubble back up the middleware chain
|
||||
* @param opts.requestContext Context object to pass to loaders/actions
|
||||
* @param opts.skipLoaderErrorBubbling Skip loader error bubbling
|
||||
* @param opts.skipRevalidation Skip revalidation after action submission
|
||||
* @param opts.normalizePath Normalize the request path
|
||||
*/
|
||||
query(request: Request, opts?: {
|
||||
requestContext?: unknown;
|
||||
filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
|
||||
@@ -1415,14 +1479,27 @@ interface StaticHandler {
|
||||
generateMiddlewareResponse?: (query: (r: Request, args?: {
|
||||
filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
|
||||
}) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>;
|
||||
unstable_normalizePath?: (request: Request) => Path;
|
||||
normalizePath?: (request: Request) => Path;
|
||||
}): Promise<StaticHandlerContext | Response>;
|
||||
/**
|
||||
* Perform a query for a specific route. Used for resource requests.
|
||||
*
|
||||
* @param request The request to query
|
||||
* @param opts Optional queryRoute options
|
||||
* @param opts.dataStrategy Alternate dataStrategy implementation
|
||||
* @param opts.generateMiddlewareResponse To enable middleware, provide a function
|
||||
* to generate a response to bubble back up the middleware chain
|
||||
* @param opts.requestContext Context object to pass to loaders/actions
|
||||
* @param opts.routeId The ID of the route to query
|
||||
* @param opts.normalizePath Normalize the request path
|
||||
|
||||
*/
|
||||
queryRoute(request: Request, opts?: {
|
||||
routeId?: string;
|
||||
requestContext?: unknown;
|
||||
dataStrategy?: DataStrategyFunction<unknown>;
|
||||
generateMiddlewareResponse?: (queryRoute: (r: Request) => Promise<Response>) => MaybePromise<Response>;
|
||||
unstable_normalizePath?: (request: Request) => Path;
|
||||
normalizePath?: (request: Request) => Path;
|
||||
}): Promise<any>;
|
||||
}
|
||||
type ViewTransitionOpts = {
|
||||
@@ -1466,14 +1543,14 @@ type BaseNavigateOrFetchOptions = {
|
||||
preventScrollReset?: boolean;
|
||||
relative?: RelativeRoutingType;
|
||||
flushSync?: boolean;
|
||||
unstable_defaultShouldRevalidate?: boolean;
|
||||
defaultShouldRevalidate?: boolean;
|
||||
};
|
||||
type BaseNavigateOptions = BaseNavigateOrFetchOptions & {
|
||||
replace?: boolean;
|
||||
state?: any;
|
||||
fromRouteId?: string;
|
||||
viewTransition?: boolean;
|
||||
unstable_mask?: To;
|
||||
mask?: To;
|
||||
};
|
||||
type BaseSubmissionOptions = {
|
||||
formMethod?: HTMLFormMethod;
|
||||
@@ -1516,6 +1593,8 @@ type NavigationStates = {
|
||||
Idle: {
|
||||
state: "idle";
|
||||
location: undefined;
|
||||
matches: undefined;
|
||||
historyAction: undefined;
|
||||
formMethod: undefined;
|
||||
formAction: undefined;
|
||||
formEncType: undefined;
|
||||
@@ -1526,6 +1605,8 @@ type NavigationStates = {
|
||||
Loading: {
|
||||
state: "loading";
|
||||
location: Location;
|
||||
matches: DataRouteMatch[];
|
||||
historyAction: Action;
|
||||
formMethod: Submission["formMethod"] | undefined;
|
||||
formAction: Submission["formAction"] | undefined;
|
||||
formEncType: Submission["formEncType"] | undefined;
|
||||
@@ -1536,6 +1617,8 @@ type NavigationStates = {
|
||||
Submitting: {
|
||||
state: "submitting";
|
||||
location: Location;
|
||||
matches: DataRouteMatch[];
|
||||
historyAction: Action;
|
||||
formMethod: Submission["formMethod"];
|
||||
formAction: Submission["formAction"];
|
||||
formEncType: Submission["formEncType"];
|
||||
@@ -1649,7 +1732,7 @@ type BlockerFunction = (args: {
|
||||
interface CreateStaticHandlerOptions {
|
||||
basename?: string;
|
||||
mapRouteProperties?: MapRoutePropertiesFunction;
|
||||
unstable_instrumentations?: Pick<unstable_ServerInstrumentation, "route">[];
|
||||
instrumentations?: Pick<ServerInstrumentation, "route">[];
|
||||
future?: Partial<FutureConfig>;
|
||||
}
|
||||
declare function createStaticHandler(routes: RouteObject[], opts?: CreateStaticHandlerOptions): StaticHandler;
|
||||
@@ -1799,14 +1882,14 @@ type ClientDataFunctionArgs<Params> = {
|
||||
**/
|
||||
request: Request;
|
||||
/**
|
||||
* A URL instance representing the application location being navigated to or fetched.
|
||||
* Without `future.unstable_passThroughRequests` enabled, this matches `request.url`.
|
||||
* With `future.unstable_passThroughRequests` enabled, this is a normalized
|
||||
* URL with React-Router-specific implementation details removed (`.data`
|
||||
* pathnames, `index`/`_routes` search params).
|
||||
* The URL includes the origin from the request for convenience.
|
||||
* A URL instance representing the application location being navigated to or
|
||||
* fetched. By default, this matches `request.url`.
|
||||
*
|
||||
* In Framework mode with `future.v8_passThroughRequests` enabled, this is a
|
||||
* normalized URL with React-Router-specific implementation details removed
|
||||
* (`.data` suffixes, `index`/`_routes` search params).
|
||||
*/
|
||||
unstable_url: URL;
|
||||
url: URL;
|
||||
/**
|
||||
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
||||
* @example
|
||||
@@ -1826,7 +1909,7 @@ type ClientDataFunctionArgs<Params> = {
|
||||
* Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
|
||||
* Mostly useful as a identifier to aggregate on for logging/tracing/etc.
|
||||
*/
|
||||
unstable_pattern: string;
|
||||
pattern: string;
|
||||
/**
|
||||
* When `future.v8_middleware` is not enabled, this is undefined.
|
||||
*
|
||||
@@ -1975,7 +2058,7 @@ type MetaDescriptor = {
|
||||
httpEquiv: string;
|
||||
content: string;
|
||||
} | {
|
||||
"script:ld+json": LdJsonObject;
|
||||
"script:ld+json": LdJsonObject | LdJsonObject[];
|
||||
} | {
|
||||
tagName: "meta" | "link";
|
||||
[name: string]: string;
|
||||
|
||||
+120
-37
@@ -64,7 +64,7 @@ interface Location<State = any> extends Path {
|
||||
* The masked location displayed in the URL bar, which differs from the URL the
|
||||
* router is operating on
|
||||
*/
|
||||
unstable_mask: Path | undefined;
|
||||
mask?: Path;
|
||||
}
|
||||
/**
|
||||
* A change to the current location.
|
||||
@@ -357,19 +357,19 @@ interface DataFunctionArgs<Context> {
|
||||
/** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read headers (like cookies, and {@link https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams URLSearchParams} from the request. */
|
||||
request: Request;
|
||||
/**
|
||||
* A URL instance representing the application location being navigated to or fetched.
|
||||
* Without `future.unstable_passThroughRequests` enabled, this matches `request.url`.
|
||||
* With `future.unstable_passThroughRequests` enabled, this is a normalized
|
||||
* URL with React-Router-specific implementation details removed (`.data`
|
||||
* suffixes, `index`/`_routes` search params).
|
||||
* The URL includes the origin from the request for convenience.
|
||||
* A URL instance representing the application location being navigated to or
|
||||
* fetched. By default, this matches `request.url`.
|
||||
*
|
||||
* In Framework mode with `future.v8_passThroughRequests` enabled, this is a
|
||||
* normalized URL with React-Router-specific implementation details removed
|
||||
* (`.data` suffixes, `index`/`_routes` search params).
|
||||
*/
|
||||
unstable_url: URL;
|
||||
url: URL;
|
||||
/**
|
||||
* Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
|
||||
* Mostly useful as a identifier to aggregate on for logging/tracing/etc.
|
||||
*/
|
||||
unstable_pattern: string;
|
||||
pattern: string;
|
||||
/**
|
||||
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
||||
* @example
|
||||
@@ -756,6 +756,7 @@ type DataNonIndexRouteObject = NonIndexRouteObject & {
|
||||
* A data route object, which is just a RouteObject with a required unique ID
|
||||
*/
|
||||
type DataRouteObject = DataIndexRouteObject | DataNonIndexRouteObject;
|
||||
type RouteManifest<R = DataRouteObject> = Record<string, R | undefined>;
|
||||
/**
|
||||
* The parameters that were parsed from the URL path.
|
||||
*/
|
||||
@@ -839,6 +840,24 @@ interface UIMatch<Data = unknown, Handle = unknown> {
|
||||
*/
|
||||
handle: Handle;
|
||||
}
|
||||
interface RouteMeta<RouteObjectType extends RouteObject = RouteObject> {
|
||||
relativePath: string;
|
||||
caseSensitive: boolean;
|
||||
childrenIndex: number;
|
||||
route: RouteObjectType;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* A "branch" of routes that match a given route pattern.
|
||||
* This is an internal interface not intended for direct external usage.
|
||||
*/
|
||||
interface RouteBranch<RouteObjectType extends RouteObject = RouteObject> {
|
||||
path: string;
|
||||
score: number;
|
||||
routesMeta: RouteMeta<RouteObjectType>[];
|
||||
}
|
||||
declare class DataWithResponseInit<D> {
|
||||
type: string;
|
||||
data: D;
|
||||
@@ -878,6 +897,9 @@ type RedirectFunction = (url: string, init?: number | ResponseInit) => Response;
|
||||
* Sets the status code and the [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
|
||||
* header. Defaults to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302).
|
||||
*
|
||||
* This utility accepts absolute URLs and can navigate to external domains, so
|
||||
* the application should validate any user-supplied inputs to redirects.
|
||||
*
|
||||
* @example
|
||||
* import { redirect } from "react-router";
|
||||
*
|
||||
@@ -907,6 +929,9 @@ declare const redirect$1: RedirectFunction;
|
||||
* and the [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
|
||||
* header. Defaults to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302).
|
||||
*
|
||||
* This utility accepts absolute URLs and can navigate to external domains, so
|
||||
* the application should validate any user-supplied inputs to redirects.
|
||||
*
|
||||
* ```tsx filename=routes/logout.tsx
|
||||
* import { redirectDocument } from "react-router";
|
||||
*
|
||||
@@ -1006,25 +1031,25 @@ interface AppLoadContext {
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
type unstable_ServerInstrumentation = {
|
||||
handler?: unstable_InstrumentRequestHandlerFunction;
|
||||
route?: unstable_InstrumentRouteFunction;
|
||||
type ServerInstrumentation = {
|
||||
handler?: InstrumentRequestHandlerFunction;
|
||||
route?: InstrumentRouteFunction;
|
||||
};
|
||||
type unstable_ClientInstrumentation = {
|
||||
router?: unstable_InstrumentRouterFunction;
|
||||
route?: unstable_InstrumentRouteFunction;
|
||||
type ClientInstrumentation = {
|
||||
router?: InstrumentRouterFunction;
|
||||
route?: InstrumentRouteFunction;
|
||||
};
|
||||
type unstable_InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
|
||||
type unstable_InstrumentRouterFunction = (router: InstrumentableRouter) => void;
|
||||
type unstable_InstrumentRouteFunction = (route: InstrumentableRoute) => void;
|
||||
type unstable_InstrumentationHandlerResult = {
|
||||
type InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
|
||||
type InstrumentRouterFunction = (router: InstrumentableRouter) => void;
|
||||
type InstrumentRouteFunction = (route: InstrumentableRoute) => void;
|
||||
type InstrumentationHandlerResult = {
|
||||
status: "success";
|
||||
error: undefined;
|
||||
} | {
|
||||
status: "error";
|
||||
error: Error;
|
||||
};
|
||||
type InstrumentFunction<T> = (handler: () => Promise<unstable_InstrumentationHandlerResult>, info: T) => Promise<void>;
|
||||
type InstrumentFunction<T> = (handler: () => Promise<InstrumentationHandlerResult>, info: T) => Promise<void>;
|
||||
type ReadonlyRequest = {
|
||||
method: string;
|
||||
url: string;
|
||||
@@ -1050,7 +1075,7 @@ type RouteLazyInstrumentationInfo = undefined;
|
||||
type RouteHandlerInstrumentationInfo = Readonly<{
|
||||
request: ReadonlyRequest;
|
||||
params: LoaderFunctionArgs["params"];
|
||||
unstable_pattern: string;
|
||||
pattern: string;
|
||||
context: ReadonlyContext;
|
||||
}>;
|
||||
type InstrumentableRouter = {
|
||||
@@ -1120,6 +1145,20 @@ interface Router {
|
||||
* Return the routes for this router instance
|
||||
*/
|
||||
get routes(): DataRouteObject[];
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the route branches for this router instance
|
||||
*/
|
||||
get branches(): RouteBranch<DataRouteObject>[] | undefined;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the manifest for this router instance
|
||||
*/
|
||||
get manifest(): RouteManifest;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
@@ -1367,7 +1406,6 @@ type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "e
|
||||
* Future flags to toggle new feature behavior
|
||||
*/
|
||||
interface FutureConfig {
|
||||
unstable_passThroughRequests: boolean;
|
||||
}
|
||||
/**
|
||||
* Initialization options for createRouter
|
||||
@@ -1377,7 +1415,7 @@ interface RouterInit {
|
||||
history: History;
|
||||
basename?: string;
|
||||
getContext?: () => MaybePromise<RouterContextProvider>;
|
||||
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
||||
instrumentations?: ClientInstrumentation[];
|
||||
mapRouteProperties?: MapRoutePropertiesFunction;
|
||||
future?: Partial<FutureConfig>;
|
||||
hydrationRouteProperties?: string[];
|
||||
@@ -1405,7 +1443,33 @@ interface StaticHandlerContext {
|
||||
* A StaticHandler instance manages a singular SSR navigation/fetch event
|
||||
*/
|
||||
interface StaticHandler {
|
||||
/**
|
||||
* The set of data routes managed by this handler
|
||||
*/
|
||||
dataRoutes: DataRouteObject[];
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* The route branches derived from the data routes, used for internal route
|
||||
* matching in Framework Mode
|
||||
*/
|
||||
_internalRouteBranches: RouteBranch<DataRouteObject>[];
|
||||
/**
|
||||
* Perform a query for a given request - executing all matched route
|
||||
* loaders/actions. Used for document requests.
|
||||
*
|
||||
* @param request The request to query
|
||||
* @param opts Optional query options
|
||||
* @param opts.dataStrategy Alternate dataStrategy implementation
|
||||
* @param opts.filterMatchesToLoad Predicate function to filter which matches should be loaded
|
||||
* @param opts.generateMiddlewareResponse To enable middleware, provide a function
|
||||
* to generate a response to bubble back up the middleware chain
|
||||
* @param opts.requestContext Context object to pass to loaders/actions
|
||||
* @param opts.skipLoaderErrorBubbling Skip loader error bubbling
|
||||
* @param opts.skipRevalidation Skip revalidation after action submission
|
||||
* @param opts.normalizePath Normalize the request path
|
||||
*/
|
||||
query(request: Request, opts?: {
|
||||
requestContext?: unknown;
|
||||
filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
|
||||
@@ -1415,14 +1479,27 @@ interface StaticHandler {
|
||||
generateMiddlewareResponse?: (query: (r: Request, args?: {
|
||||
filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
|
||||
}) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>;
|
||||
unstable_normalizePath?: (request: Request) => Path;
|
||||
normalizePath?: (request: Request) => Path;
|
||||
}): Promise<StaticHandlerContext | Response>;
|
||||
/**
|
||||
* Perform a query for a specific route. Used for resource requests.
|
||||
*
|
||||
* @param request The request to query
|
||||
* @param opts Optional queryRoute options
|
||||
* @param opts.dataStrategy Alternate dataStrategy implementation
|
||||
* @param opts.generateMiddlewareResponse To enable middleware, provide a function
|
||||
* to generate a response to bubble back up the middleware chain
|
||||
* @param opts.requestContext Context object to pass to loaders/actions
|
||||
* @param opts.routeId The ID of the route to query
|
||||
* @param opts.normalizePath Normalize the request path
|
||||
|
||||
*/
|
||||
queryRoute(request: Request, opts?: {
|
||||
routeId?: string;
|
||||
requestContext?: unknown;
|
||||
dataStrategy?: DataStrategyFunction<unknown>;
|
||||
generateMiddlewareResponse?: (queryRoute: (r: Request) => Promise<Response>) => MaybePromise<Response>;
|
||||
unstable_normalizePath?: (request: Request) => Path;
|
||||
normalizePath?: (request: Request) => Path;
|
||||
}): Promise<any>;
|
||||
}
|
||||
type ViewTransitionOpts = {
|
||||
@@ -1466,14 +1543,14 @@ type BaseNavigateOrFetchOptions = {
|
||||
preventScrollReset?: boolean;
|
||||
relative?: RelativeRoutingType;
|
||||
flushSync?: boolean;
|
||||
unstable_defaultShouldRevalidate?: boolean;
|
||||
defaultShouldRevalidate?: boolean;
|
||||
};
|
||||
type BaseNavigateOptions = BaseNavigateOrFetchOptions & {
|
||||
replace?: boolean;
|
||||
state?: any;
|
||||
fromRouteId?: string;
|
||||
viewTransition?: boolean;
|
||||
unstable_mask?: To;
|
||||
mask?: To;
|
||||
};
|
||||
type BaseSubmissionOptions = {
|
||||
formMethod?: HTMLFormMethod;
|
||||
@@ -1516,6 +1593,8 @@ type NavigationStates = {
|
||||
Idle: {
|
||||
state: "idle";
|
||||
location: undefined;
|
||||
matches: undefined;
|
||||
historyAction: undefined;
|
||||
formMethod: undefined;
|
||||
formAction: undefined;
|
||||
formEncType: undefined;
|
||||
@@ -1526,6 +1605,8 @@ type NavigationStates = {
|
||||
Loading: {
|
||||
state: "loading";
|
||||
location: Location;
|
||||
matches: DataRouteMatch[];
|
||||
historyAction: Action;
|
||||
formMethod: Submission["formMethod"] | undefined;
|
||||
formAction: Submission["formAction"] | undefined;
|
||||
formEncType: Submission["formEncType"] | undefined;
|
||||
@@ -1536,6 +1617,8 @@ type NavigationStates = {
|
||||
Submitting: {
|
||||
state: "submitting";
|
||||
location: Location;
|
||||
matches: DataRouteMatch[];
|
||||
historyAction: Action;
|
||||
formMethod: Submission["formMethod"];
|
||||
formAction: Submission["formAction"];
|
||||
formEncType: Submission["formEncType"];
|
||||
@@ -1649,7 +1732,7 @@ type BlockerFunction = (args: {
|
||||
interface CreateStaticHandlerOptions {
|
||||
basename?: string;
|
||||
mapRouteProperties?: MapRoutePropertiesFunction;
|
||||
unstable_instrumentations?: Pick<unstable_ServerInstrumentation, "route">[];
|
||||
instrumentations?: Pick<ServerInstrumentation, "route">[];
|
||||
future?: Partial<FutureConfig>;
|
||||
}
|
||||
declare function createStaticHandler(routes: RouteObject[], opts?: CreateStaticHandlerOptions): StaticHandler;
|
||||
@@ -1799,14 +1882,14 @@ type ClientDataFunctionArgs<Params> = {
|
||||
**/
|
||||
request: Request;
|
||||
/**
|
||||
* A URL instance representing the application location being navigated to or fetched.
|
||||
* Without `future.unstable_passThroughRequests` enabled, this matches `request.url`.
|
||||
* With `future.unstable_passThroughRequests` enabled, this is a normalized
|
||||
* URL with React-Router-specific implementation details removed (`.data`
|
||||
* pathnames, `index`/`_routes` search params).
|
||||
* The URL includes the origin from the request for convenience.
|
||||
* A URL instance representing the application location being navigated to or
|
||||
* fetched. By default, this matches `request.url`.
|
||||
*
|
||||
* In Framework mode with `future.v8_passThroughRequests` enabled, this is a
|
||||
* normalized URL with React-Router-specific implementation details removed
|
||||
* (`.data` suffixes, `index`/`_routes` search params).
|
||||
*/
|
||||
unstable_url: URL;
|
||||
url: URL;
|
||||
/**
|
||||
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
||||
* @example
|
||||
@@ -1826,7 +1909,7 @@ type ClientDataFunctionArgs<Params> = {
|
||||
* Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
|
||||
* Mostly useful as a identifier to aggregate on for logging/tracing/etc.
|
||||
*/
|
||||
unstable_pattern: string;
|
||||
pattern: string;
|
||||
/**
|
||||
* When `future.v8_middleware` is not enabled, this is undefined.
|
||||
*
|
||||
@@ -1975,7 +2058,7 @@ type MetaDescriptor = {
|
||||
httpEquiv: string;
|
||||
content: string;
|
||||
} | {
|
||||
"script:ld+json": LdJsonObject;
|
||||
"script:ld+json": LdJsonObject | LdJsonObject[];
|
||||
} | {
|
||||
tagName: "meta" | "link";
|
||||
[name: string]: string;
|
||||
|
||||
+71
-41
@@ -27,7 +27,7 @@ function _interopNamespace(e) {
|
||||
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
||||
|
||||
/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
@@ -61,7 +61,7 @@ function warning(cond, message) {
|
||||
function createKey() {
|
||||
return Math.random().toString(36).substring(2, 10);
|
||||
}
|
||||
function createLocation(current, to, state = null, key, unstable_mask) {
|
||||
function createLocation(current, to, state = null, key, mask) {
|
||||
let location = {
|
||||
pathname: typeof current === "string" ? current : current.pathname,
|
||||
search: "",
|
||||
@@ -73,7 +73,7 @@ function createLocation(current, to, state = null, key, unstable_mask) {
|
||||
// But that's a pretty big refactor to the current test suite so going to
|
||||
// keep as is for the time being and just let any incoming keys take precedence
|
||||
key: to && to.key || key || createKey(),
|
||||
unstable_mask
|
||||
mask
|
||||
};
|
||||
return location;
|
||||
}
|
||||
@@ -253,11 +253,11 @@ async function recurseRight(impls, info, handler, index) {
|
||||
};
|
||||
}
|
||||
function getHandlerInfo(args) {
|
||||
let { request, context, params, unstable_pattern } = args;
|
||||
let { request, context, params, pattern } = args;
|
||||
return {
|
||||
request: getReadonlyRequest(request),
|
||||
params: { ...params },
|
||||
unstable_pattern,
|
||||
pattern,
|
||||
context: getReadonlyContext(context)
|
||||
};
|
||||
}
|
||||
@@ -427,17 +427,16 @@ function mergeRouteUpdates(route, updates) {
|
||||
function matchRoutes(routes, locationArg, basename = "/") {
|
||||
return matchRoutesImpl(routes, locationArg, basename, false);
|
||||
}
|
||||
function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
|
||||
function matchRoutesImpl(routes, locationArg, basename, allowPartial, precomputedBranches) {
|
||||
let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
||||
let pathname = stripBasename(location.pathname || "/", basename);
|
||||
if (pathname == null) {
|
||||
return null;
|
||||
}
|
||||
let branches = flattenRoutes(routes);
|
||||
rankRouteBranches(branches);
|
||||
let branches = precomputedBranches ?? flattenAndRankRoutes(routes);
|
||||
let matches = null;
|
||||
let decoded = decodePath(pathname);
|
||||
for (let i = 0; matches == null && i < branches.length; ++i) {
|
||||
let decoded = decodePath(pathname);
|
||||
matches = matchRouteBranch(
|
||||
branches[i],
|
||||
decoded,
|
||||
@@ -457,6 +456,11 @@ function convertRouteMatchToUiMatch(match, loaderData) {
|
||||
handle: route.handle
|
||||
};
|
||||
}
|
||||
function flattenAndRankRoutes(routes) {
|
||||
let branches = flattenRoutes(routes);
|
||||
rankRouteBranches(branches);
|
||||
return branches;
|
||||
}
|
||||
function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) {
|
||||
let flattenRoute = (route, index, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {
|
||||
let meta = {
|
||||
@@ -728,7 +732,7 @@ function resolvePath(to, fromPathname = "/") {
|
||||
} = typeof to === "string" ? parsePath(to) : to;
|
||||
let pathname;
|
||||
if (toPathname) {
|
||||
toPathname = toPathname.replace(/\/\/+/g, "/");
|
||||
toPathname = removeDoubleSlashes(toPathname);
|
||||
if (toPathname.startsWith("/")) {
|
||||
pathname = resolvePathname(toPathname.substring(1), "/");
|
||||
} else {
|
||||
@@ -744,7 +748,7 @@ function resolvePath(to, fromPathname = "/") {
|
||||
};
|
||||
}
|
||||
function resolvePathname(relativePath, fromPathname) {
|
||||
let segments = fromPathname.replace(/\/+$/, "").split("/");
|
||||
let segments = removeTrailingSlash(fromPathname).split("/");
|
||||
let relativeSegments = relativePath.split("/");
|
||||
relativeSegments.forEach((segment) => {
|
||||
if (segment === "..") {
|
||||
@@ -815,8 +819,10 @@ function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = fal
|
||||
}
|
||||
return path;
|
||||
}
|
||||
var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
|
||||
var normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
|
||||
var removeDoubleSlashes = (path) => path.replace(/\/\/+/g, "/");
|
||||
var joinPaths = (paths) => removeDoubleSlashes(paths.join("/"));
|
||||
var removeTrailingSlash = (path) => path.replace(/\/+$/, "");
|
||||
var normalizePathname = (pathname) => removeTrailingSlash(pathname).replace(/^\/*/, "/");
|
||||
var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
|
||||
var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
|
||||
var DataWithResponseInit = class {
|
||||
@@ -870,7 +876,8 @@ function isRouteErrorResponse(error) {
|
||||
return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
|
||||
}
|
||||
function getRoutePattern(matches) {
|
||||
return matches.map((m) => m.route.path).filter(Boolean).join("/").replace(/\/\/*/g, "/") || "/";
|
||||
let parts = matches.map((m) => m.route.path).filter(Boolean);
|
||||
return joinPaths(parts) || "/";
|
||||
}
|
||||
|
||||
// lib/router/router.ts
|
||||
@@ -903,11 +910,10 @@ function createStaticHandler(routes, opts) {
|
||||
let _mapRouteProperties = opts?.mapRouteProperties || defaultMapRouteProperties;
|
||||
let mapRouteProperties = _mapRouteProperties;
|
||||
({
|
||||
// unused in static handler
|
||||
...opts?.future
|
||||
});
|
||||
if (opts?.unstable_instrumentations) {
|
||||
let instrumentations = opts.unstable_instrumentations;
|
||||
if (opts?.instrumentations) {
|
||||
let instrumentations = opts.instrumentations;
|
||||
mapRouteProperties = (route) => {
|
||||
return {
|
||||
..._mapRouteProperties(route),
|
||||
@@ -924,6 +930,7 @@ function createStaticHandler(routes, opts) {
|
||||
void 0,
|
||||
manifest
|
||||
);
|
||||
let routeBranches = flattenAndRankRoutes(dataRoutes);
|
||||
async function query(request, {
|
||||
requestContext,
|
||||
filterMatchesToLoad,
|
||||
@@ -931,12 +938,23 @@ function createStaticHandler(routes, opts) {
|
||||
skipRevalidation,
|
||||
dataStrategy,
|
||||
generateMiddlewareResponse,
|
||||
unstable_normalizePath
|
||||
normalizePath
|
||||
} = {}) {
|
||||
let normalizePath = unstable_normalizePath || defaultNormalizePath;
|
||||
let normalizePathImpl = normalizePath || defaultNormalizePath;
|
||||
let method = request.method;
|
||||
let location = createLocation("", normalizePath(request), null, "default");
|
||||
let matches = matchRoutes(dataRoutes, location, basename);
|
||||
let location = createLocation(
|
||||
"",
|
||||
normalizePathImpl(request),
|
||||
null,
|
||||
"default"
|
||||
);
|
||||
let matches = matchRoutesImpl(
|
||||
dataRoutes,
|
||||
location,
|
||||
basename,
|
||||
false,
|
||||
routeBranches
|
||||
);
|
||||
requestContext = requestContext != null ? requestContext : new RouterContextProvider();
|
||||
if (!isValidMethod(method) && method !== "HEAD") {
|
||||
let error = getInternalRouterError(405, { method });
|
||||
@@ -988,8 +1006,8 @@ function createStaticHandler(routes, opts) {
|
||||
let response = await runServerMiddlewarePipeline(
|
||||
{
|
||||
request,
|
||||
unstable_url: createDataFunctionUrl(request, location),
|
||||
unstable_pattern: getRoutePattern(matches),
|
||||
url: createDataFunctionUrl(request, location),
|
||||
pattern: getRoutePattern(matches),
|
||||
matches,
|
||||
params: matches[0].params,
|
||||
// If we're calling middleware then it must be enabled so we can cast
|
||||
@@ -1106,12 +1124,23 @@ function createStaticHandler(routes, opts) {
|
||||
requestContext,
|
||||
dataStrategy,
|
||||
generateMiddlewareResponse,
|
||||
unstable_normalizePath
|
||||
normalizePath
|
||||
} = {}) {
|
||||
let normalizePath = unstable_normalizePath || defaultNormalizePath;
|
||||
let normalizePathImpl = normalizePath || defaultNormalizePath;
|
||||
let method = request.method;
|
||||
let location = createLocation("", normalizePath(request), null, "default");
|
||||
let matches = matchRoutes(dataRoutes, location, basename);
|
||||
let location = createLocation(
|
||||
"",
|
||||
normalizePathImpl(request),
|
||||
null,
|
||||
"default"
|
||||
);
|
||||
let matches = matchRoutesImpl(
|
||||
dataRoutes,
|
||||
location,
|
||||
basename,
|
||||
false,
|
||||
routeBranches
|
||||
);
|
||||
requestContext = requestContext != null ? requestContext : new RouterContextProvider();
|
||||
if (!isValidMethod(method) && method !== "HEAD" && method !== "OPTIONS") {
|
||||
throw getInternalRouterError(405, { method });
|
||||
@@ -1136,8 +1165,8 @@ function createStaticHandler(routes, opts) {
|
||||
let response = await runServerMiddlewarePipeline(
|
||||
{
|
||||
request,
|
||||
unstable_url: createDataFunctionUrl(request, location),
|
||||
unstable_pattern: getRoutePattern(matches),
|
||||
url: createDataFunctionUrl(request, location),
|
||||
pattern: getRoutePattern(matches),
|
||||
matches,
|
||||
params: matches[0].params,
|
||||
// If we're calling middleware then it must be enabled so we can cast
|
||||
@@ -1521,6 +1550,7 @@ function createStaticHandler(routes, opts) {
|
||||
}
|
||||
return {
|
||||
dataRoutes,
|
||||
_internalRouteBranches: routeBranches,
|
||||
query,
|
||||
queryRoute
|
||||
};
|
||||
@@ -1872,7 +1902,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request,
|
||||
handler: lazyRoutePromises.lazyHandlerPromise
|
||||
};
|
||||
}
|
||||
function getDataStrategyMatch(mapRouteProperties, manifest, request, path, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {
|
||||
function getDataStrategyMatch(mapRouteProperties, manifest, request, path, pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {
|
||||
let isUsingNewApi = false;
|
||||
let _lazyPromises = getDataStrategyMatchLazyPromises(
|
||||
mapRouteProperties,
|
||||
@@ -1907,7 +1937,7 @@ function getDataStrategyMatch(mapRouteProperties, manifest, request, path, unsta
|
||||
return callLoaderOrAction({
|
||||
request,
|
||||
path,
|
||||
unstable_pattern,
|
||||
pattern,
|
||||
match,
|
||||
lazyHandlerPromise: _lazyPromises?.handler,
|
||||
lazyRoutePromise: _lazyPromises?.route,
|
||||
@@ -1957,8 +1987,8 @@ async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fe
|
||||
}
|
||||
let dataStrategyArgs = {
|
||||
request,
|
||||
unstable_url: createDataFunctionUrl(request, path),
|
||||
unstable_pattern: getRoutePattern(matches),
|
||||
url: createDataFunctionUrl(request, path),
|
||||
pattern: getRoutePattern(matches),
|
||||
params: matches[0].params,
|
||||
context: scopedContext,
|
||||
matches
|
||||
@@ -1987,7 +2017,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fe
|
||||
async function callLoaderOrAction({
|
||||
request,
|
||||
path,
|
||||
unstable_pattern,
|
||||
pattern,
|
||||
match,
|
||||
lazyHandlerPromise,
|
||||
lazyRoutePromise,
|
||||
@@ -2014,8 +2044,8 @@ async function callLoaderOrAction({
|
||||
return handler(
|
||||
{
|
||||
request,
|
||||
unstable_url: createDataFunctionUrl(request, path),
|
||||
unstable_pattern,
|
||||
url: createDataFunctionUrl(request, path),
|
||||
pattern,
|
||||
params: match.params,
|
||||
context: scopedContext
|
||||
},
|
||||
@@ -2894,7 +2924,7 @@ async function generateResourceResponse(request, routes, basename, routeId, requ
|
||||
return generateErrorResponse(error);
|
||||
}
|
||||
},
|
||||
unstable_normalizePath: (r) => getNormalizedPath(r, basename, null)
|
||||
normalizePath: (r) => getNormalizedPath(r, basename, null)
|
||||
});
|
||||
return response;
|
||||
} catch (error) {
|
||||
@@ -2950,12 +2980,12 @@ async function generateRenderResponse(request, routes, basename, isDataRequest,
|
||||
skipLoaderErrorBubbling: isDataRequest,
|
||||
skipRevalidation: isSubmission,
|
||||
...routeIdsToLoad ? { filterMatchesToLoad: (m) => routeIdsToLoad.includes(m.route.id) } : {},
|
||||
unstable_normalizePath: (r) => getNormalizedPath(r, basename),
|
||||
normalizePath: (r) => getNormalizedPath(r, basename),
|
||||
async generateMiddlewareResponse(query) {
|
||||
let formState;
|
||||
let skipRevalidation = false;
|
||||
let potentialCSRFAttackError;
|
||||
if (request.method === "POST") {
|
||||
if (isMutationMethod(request.method)) {
|
||||
try {
|
||||
throwIfPotentialCSRFAttack(request.headers, allowedActionOrigins);
|
||||
ctx.runningAction = true;
|
||||
@@ -3463,7 +3493,7 @@ var unsign = async (cookie, secret) => {
|
||||
let signature = byteStringToUint8Array(atob(hash));
|
||||
let valid = await crypto.subtle.verify("HMAC", key, signature, data2);
|
||||
return valid ? value : false;
|
||||
} catch (error) {
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -3564,7 +3594,7 @@ function encodeData(value) {
|
||||
function decodeData(value) {
|
||||
try {
|
||||
return JSON.parse(decodeURIComponent(myEscape(atob(value))));
|
||||
} catch (error) {
|
||||
} catch (e) {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
+71
-41
@@ -6,7 +6,7 @@ export { BrowserRouter, Form, HashRouter, Link, Links, MemoryRouter, Meta, NavLi
|
||||
import { serialize, parse } from 'cookie';
|
||||
|
||||
/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
@@ -40,7 +40,7 @@ function warning(cond, message) {
|
||||
function createKey() {
|
||||
return Math.random().toString(36).substring(2, 10);
|
||||
}
|
||||
function createLocation(current, to, state = null, key, unstable_mask) {
|
||||
function createLocation(current, to, state = null, key, mask) {
|
||||
let location = {
|
||||
pathname: typeof current === "string" ? current : current.pathname,
|
||||
search: "",
|
||||
@@ -52,7 +52,7 @@ function createLocation(current, to, state = null, key, unstable_mask) {
|
||||
// But that's a pretty big refactor to the current test suite so going to
|
||||
// keep as is for the time being and just let any incoming keys take precedence
|
||||
key: to && to.key || key || createKey(),
|
||||
unstable_mask
|
||||
mask
|
||||
};
|
||||
return location;
|
||||
}
|
||||
@@ -232,11 +232,11 @@ async function recurseRight(impls, info, handler, index) {
|
||||
};
|
||||
}
|
||||
function getHandlerInfo(args) {
|
||||
let { request, context, params, unstable_pattern } = args;
|
||||
let { request, context, params, pattern } = args;
|
||||
return {
|
||||
request: getReadonlyRequest(request),
|
||||
params: { ...params },
|
||||
unstable_pattern,
|
||||
pattern,
|
||||
context: getReadonlyContext(context)
|
||||
};
|
||||
}
|
||||
@@ -406,17 +406,16 @@ function mergeRouteUpdates(route, updates) {
|
||||
function matchRoutes(routes, locationArg, basename = "/") {
|
||||
return matchRoutesImpl(routes, locationArg, basename, false);
|
||||
}
|
||||
function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
|
||||
function matchRoutesImpl(routes, locationArg, basename, allowPartial, precomputedBranches) {
|
||||
let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
||||
let pathname = stripBasename(location.pathname || "/", basename);
|
||||
if (pathname == null) {
|
||||
return null;
|
||||
}
|
||||
let branches = flattenRoutes(routes);
|
||||
rankRouteBranches(branches);
|
||||
let branches = precomputedBranches ?? flattenAndRankRoutes(routes);
|
||||
let matches = null;
|
||||
let decoded = decodePath(pathname);
|
||||
for (let i = 0; matches == null && i < branches.length; ++i) {
|
||||
let decoded = decodePath(pathname);
|
||||
matches = matchRouteBranch(
|
||||
branches[i],
|
||||
decoded,
|
||||
@@ -436,6 +435,11 @@ function convertRouteMatchToUiMatch(match, loaderData) {
|
||||
handle: route.handle
|
||||
};
|
||||
}
|
||||
function flattenAndRankRoutes(routes) {
|
||||
let branches = flattenRoutes(routes);
|
||||
rankRouteBranches(branches);
|
||||
return branches;
|
||||
}
|
||||
function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) {
|
||||
let flattenRoute = (route, index, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {
|
||||
let meta = {
|
||||
@@ -707,7 +711,7 @@ function resolvePath(to, fromPathname = "/") {
|
||||
} = typeof to === "string" ? parsePath(to) : to;
|
||||
let pathname;
|
||||
if (toPathname) {
|
||||
toPathname = toPathname.replace(/\/\/+/g, "/");
|
||||
toPathname = removeDoubleSlashes(toPathname);
|
||||
if (toPathname.startsWith("/")) {
|
||||
pathname = resolvePathname(toPathname.substring(1), "/");
|
||||
} else {
|
||||
@@ -723,7 +727,7 @@ function resolvePath(to, fromPathname = "/") {
|
||||
};
|
||||
}
|
||||
function resolvePathname(relativePath, fromPathname) {
|
||||
let segments = fromPathname.replace(/\/+$/, "").split("/");
|
||||
let segments = removeTrailingSlash(fromPathname).split("/");
|
||||
let relativeSegments = relativePath.split("/");
|
||||
relativeSegments.forEach((segment) => {
|
||||
if (segment === "..") {
|
||||
@@ -794,8 +798,10 @@ function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = fal
|
||||
}
|
||||
return path;
|
||||
}
|
||||
var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
|
||||
var normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
|
||||
var removeDoubleSlashes = (path) => path.replace(/\/\/+/g, "/");
|
||||
var joinPaths = (paths) => removeDoubleSlashes(paths.join("/"));
|
||||
var removeTrailingSlash = (path) => path.replace(/\/+$/, "");
|
||||
var normalizePathname = (pathname) => removeTrailingSlash(pathname).replace(/^\/*/, "/");
|
||||
var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
|
||||
var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
|
||||
var DataWithResponseInit = class {
|
||||
@@ -849,7 +855,8 @@ function isRouteErrorResponse(error) {
|
||||
return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
|
||||
}
|
||||
function getRoutePattern(matches) {
|
||||
return matches.map((m) => m.route.path).filter(Boolean).join("/").replace(/\/\/*/g, "/") || "/";
|
||||
let parts = matches.map((m) => m.route.path).filter(Boolean);
|
||||
return joinPaths(parts) || "/";
|
||||
}
|
||||
|
||||
// lib/router/router.ts
|
||||
@@ -882,11 +889,10 @@ function createStaticHandler(routes, opts) {
|
||||
let _mapRouteProperties = opts?.mapRouteProperties || defaultMapRouteProperties;
|
||||
let mapRouteProperties = _mapRouteProperties;
|
||||
({
|
||||
// unused in static handler
|
||||
...opts?.future
|
||||
});
|
||||
if (opts?.unstable_instrumentations) {
|
||||
let instrumentations = opts.unstable_instrumentations;
|
||||
if (opts?.instrumentations) {
|
||||
let instrumentations = opts.instrumentations;
|
||||
mapRouteProperties = (route) => {
|
||||
return {
|
||||
..._mapRouteProperties(route),
|
||||
@@ -903,6 +909,7 @@ function createStaticHandler(routes, opts) {
|
||||
void 0,
|
||||
manifest
|
||||
);
|
||||
let routeBranches = flattenAndRankRoutes(dataRoutes);
|
||||
async function query(request, {
|
||||
requestContext,
|
||||
filterMatchesToLoad,
|
||||
@@ -910,12 +917,23 @@ function createStaticHandler(routes, opts) {
|
||||
skipRevalidation,
|
||||
dataStrategy,
|
||||
generateMiddlewareResponse,
|
||||
unstable_normalizePath
|
||||
normalizePath
|
||||
} = {}) {
|
||||
let normalizePath = unstable_normalizePath || defaultNormalizePath;
|
||||
let normalizePathImpl = normalizePath || defaultNormalizePath;
|
||||
let method = request.method;
|
||||
let location = createLocation("", normalizePath(request), null, "default");
|
||||
let matches = matchRoutes(dataRoutes, location, basename);
|
||||
let location = createLocation(
|
||||
"",
|
||||
normalizePathImpl(request),
|
||||
null,
|
||||
"default"
|
||||
);
|
||||
let matches = matchRoutesImpl(
|
||||
dataRoutes,
|
||||
location,
|
||||
basename,
|
||||
false,
|
||||
routeBranches
|
||||
);
|
||||
requestContext = requestContext != null ? requestContext : new RouterContextProvider();
|
||||
if (!isValidMethod(method) && method !== "HEAD") {
|
||||
let error = getInternalRouterError(405, { method });
|
||||
@@ -967,8 +985,8 @@ function createStaticHandler(routes, opts) {
|
||||
let response = await runServerMiddlewarePipeline(
|
||||
{
|
||||
request,
|
||||
unstable_url: createDataFunctionUrl(request, location),
|
||||
unstable_pattern: getRoutePattern(matches),
|
||||
url: createDataFunctionUrl(request, location),
|
||||
pattern: getRoutePattern(matches),
|
||||
matches,
|
||||
params: matches[0].params,
|
||||
// If we're calling middleware then it must be enabled so we can cast
|
||||
@@ -1085,12 +1103,23 @@ function createStaticHandler(routes, opts) {
|
||||
requestContext,
|
||||
dataStrategy,
|
||||
generateMiddlewareResponse,
|
||||
unstable_normalizePath
|
||||
normalizePath
|
||||
} = {}) {
|
||||
let normalizePath = unstable_normalizePath || defaultNormalizePath;
|
||||
let normalizePathImpl = normalizePath || defaultNormalizePath;
|
||||
let method = request.method;
|
||||
let location = createLocation("", normalizePath(request), null, "default");
|
||||
let matches = matchRoutes(dataRoutes, location, basename);
|
||||
let location = createLocation(
|
||||
"",
|
||||
normalizePathImpl(request),
|
||||
null,
|
||||
"default"
|
||||
);
|
||||
let matches = matchRoutesImpl(
|
||||
dataRoutes,
|
||||
location,
|
||||
basename,
|
||||
false,
|
||||
routeBranches
|
||||
);
|
||||
requestContext = requestContext != null ? requestContext : new RouterContextProvider();
|
||||
if (!isValidMethod(method) && method !== "HEAD" && method !== "OPTIONS") {
|
||||
throw getInternalRouterError(405, { method });
|
||||
@@ -1115,8 +1144,8 @@ function createStaticHandler(routes, opts) {
|
||||
let response = await runServerMiddlewarePipeline(
|
||||
{
|
||||
request,
|
||||
unstable_url: createDataFunctionUrl(request, location),
|
||||
unstable_pattern: getRoutePattern(matches),
|
||||
url: createDataFunctionUrl(request, location),
|
||||
pattern: getRoutePattern(matches),
|
||||
matches,
|
||||
params: matches[0].params,
|
||||
// If we're calling middleware then it must be enabled so we can cast
|
||||
@@ -1500,6 +1529,7 @@ function createStaticHandler(routes, opts) {
|
||||
}
|
||||
return {
|
||||
dataRoutes,
|
||||
_internalRouteBranches: routeBranches,
|
||||
query,
|
||||
queryRoute
|
||||
};
|
||||
@@ -1851,7 +1881,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request,
|
||||
handler: lazyRoutePromises.lazyHandlerPromise
|
||||
};
|
||||
}
|
||||
function getDataStrategyMatch(mapRouteProperties, manifest, request, path, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {
|
||||
function getDataStrategyMatch(mapRouteProperties, manifest, request, path, pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {
|
||||
let isUsingNewApi = false;
|
||||
let _lazyPromises = getDataStrategyMatchLazyPromises(
|
||||
mapRouteProperties,
|
||||
@@ -1886,7 +1916,7 @@ function getDataStrategyMatch(mapRouteProperties, manifest, request, path, unsta
|
||||
return callLoaderOrAction({
|
||||
request,
|
||||
path,
|
||||
unstable_pattern,
|
||||
pattern,
|
||||
match,
|
||||
lazyHandlerPromise: _lazyPromises?.handler,
|
||||
lazyRoutePromise: _lazyPromises?.route,
|
||||
@@ -1936,8 +1966,8 @@ async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fe
|
||||
}
|
||||
let dataStrategyArgs = {
|
||||
request,
|
||||
unstable_url: createDataFunctionUrl(request, path),
|
||||
unstable_pattern: getRoutePattern(matches),
|
||||
url: createDataFunctionUrl(request, path),
|
||||
pattern: getRoutePattern(matches),
|
||||
params: matches[0].params,
|
||||
context: scopedContext,
|
||||
matches
|
||||
@@ -1966,7 +1996,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fe
|
||||
async function callLoaderOrAction({
|
||||
request,
|
||||
path,
|
||||
unstable_pattern,
|
||||
pattern,
|
||||
match,
|
||||
lazyHandlerPromise,
|
||||
lazyRoutePromise,
|
||||
@@ -1993,8 +2023,8 @@ async function callLoaderOrAction({
|
||||
return handler(
|
||||
{
|
||||
request,
|
||||
unstable_url: createDataFunctionUrl(request, path),
|
||||
unstable_pattern,
|
||||
url: createDataFunctionUrl(request, path),
|
||||
pattern,
|
||||
params: match.params,
|
||||
context: scopedContext
|
||||
},
|
||||
@@ -2873,7 +2903,7 @@ async function generateResourceResponse(request, routes, basename, routeId, requ
|
||||
return generateErrorResponse(error);
|
||||
}
|
||||
},
|
||||
unstable_normalizePath: (r) => getNormalizedPath(r, basename, null)
|
||||
normalizePath: (r) => getNormalizedPath(r, basename, null)
|
||||
});
|
||||
return response;
|
||||
} catch (error) {
|
||||
@@ -2929,12 +2959,12 @@ async function generateRenderResponse(request, routes, basename, isDataRequest,
|
||||
skipLoaderErrorBubbling: isDataRequest,
|
||||
skipRevalidation: isSubmission,
|
||||
...routeIdsToLoad ? { filterMatchesToLoad: (m) => routeIdsToLoad.includes(m.route.id) } : {},
|
||||
unstable_normalizePath: (r) => getNormalizedPath(r, basename),
|
||||
normalizePath: (r) => getNormalizedPath(r, basename),
|
||||
async generateMiddlewareResponse(query) {
|
||||
let formState;
|
||||
let skipRevalidation = false;
|
||||
let potentialCSRFAttackError;
|
||||
if (request.method === "POST") {
|
||||
if (isMutationMethod(request.method)) {
|
||||
try {
|
||||
throwIfPotentialCSRFAttack(request.headers, allowedActionOrigins);
|
||||
ctx.runningAction = true;
|
||||
@@ -3442,7 +3472,7 @@ var unsign = async (cookie, secret) => {
|
||||
let signature = byteStringToUint8Array(atob(hash));
|
||||
let valid = await crypto.subtle.verify("HMAC", key, signature, data2);
|
||||
return valid ? value : false;
|
||||
} catch (error) {
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -3543,7 +3573,7 @@ function encodeData(value) {
|
||||
function decodeData(value) {
|
||||
try {
|
||||
return JSON.parse(decodeURIComponent(myEscape(atob(value))));
|
||||
} catch (error) {
|
||||
} catch (e) {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
+101
-13
@@ -1,17 +1,17 @@
|
||||
import { X as RouteModules, z as DataStrategyFunction, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, T as To, Y as SerializeFrom, L as Location, Z as ParamParseKey, I as Path, _ as PathPattern, $ as PathMatch, U as UIMatch, v as Action, P as Params, r as RouteObject, G as GetLoaderData, l as GetActionData, J as InitialEntry, Q as IndexRouteObject, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, K as NonIndexRouteObject, a0 as Equal, B as PatchRoutesOnNavigationFunction, E as DataRouteObject, a as ClientLoaderFunction } from './routeModules-BRrCYrSL.mjs';
|
||||
export { a1 as ActionFunctionArgs, a2 as BaseRouteObject, C as ClientActionFunction, aq as ClientActionFunctionArgs, ar as ClientLoaderFunctionArgs, w as DataRouteMatch, a3 as DataStrategyFunctionArgs, a4 as DataStrategyMatch, D as DataStrategyResult, a6 as ErrorResponse, n as FormEncType, a7 as FormMethod, aw as Future, m as HTMLFormMethod, as as HeadersArgs, H as HeadersFunction, av as HtmlLinkDescriptor, O as LazyRouteFunction, e as LinkDescriptor, o as LoaderFunctionArgs, at as MetaArgs, g as MetaDescriptor, a8 as MiddlewareFunction, au as PageLinkDescriptor, a9 as PatchRoutesOnNavigationFunctionArgs, aa as PathParam, ab as RedirectFunction, V as RouteMatch, ac as RouterContext, S as ShouldRevalidateFunction, ad as ShouldRevalidateFunctionArgs, a5 as UNSAFE_DataWithResponseInit, aC as UNSAFE_ErrorResponseImpl, az as UNSAFE_createBrowserHistory, aA as UNSAFE_createHashHistory, ay as UNSAFE_createMemoryHistory, aB as UNSAFE_invariant, ae as createContext, af as createPath, ah as data, ai as generatePath, aj as isRouteErrorResponse, ak as matchPath, al as matchRoutes, ag as parsePath, am as redirect, an as redirectDocument, ao as replace, ap as resolvePath, ax as unstable_SerializesTo } from './routeModules-BRrCYrSL.mjs';
|
||||
import { b as Router, N as NavigateOptions, B as BlockerFunction, c as Blocker, d as RelativeRoutingType, e as Navigation, H as HydrationState, f as RouterState } from './context-phCt_zmH.mjs';
|
||||
export { K as Await, w as AwaitProps, C as ClientOnErrorFunction, F as Fetcher, G as GetScrollPositionFunction, g as GetScrollRestorationKeyFunction, t as IDLE_BLOCKER, s as IDLE_FETCHER, I as IDLE_NAVIGATION, x as IndexRouteProps, L as LayoutRouteProps, Q as MemoryRouter, M as MemoryRouterOpts, y as MemoryRouterProps, T as Navigate, z as NavigateProps, i as NavigationStates, v as Navigator, U as Outlet, O as OutletProps, P as PathRouteProps, m as RevalidationState, V as Route, D as RouteProps, W as Router, l as RouterFetchOptions, R as RouterInit, k as RouterNavigateOptions, E as RouterProps, X as RouterProvider, a as RouterProviderProps, j as RouterSubscriber, Y as Routes, J as RoutesProps, S as StaticHandler, h as StaticHandlerContext, A as UNSAFE_AwaitContextProvider, a2 as UNSAFE_DataRouterContext, a3 as UNSAFE_DataRouterStateContext, a4 as UNSAFE_FetchersContext, a5 as UNSAFE_LocationContext, a6 as UNSAFE_NavigationContext, a7 as UNSAFE_RouteContext, a8 as UNSAFE_ViewTransitionContext, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps, a1 as UNSAFE_createRouter, a9 as UNSAFE_hydrationRouteProperties, aa as UNSAFE_mapRouteProperties, ac as UNSAFE_withComponentProps, ag as UNSAFE_withErrorBoundaryProps, ae as UNSAFE_withHydrateFallbackProps, Z as createMemoryRouter, _ as createRoutesFromChildren, $ as createRoutesFromElements, a0 as renderMatches, u as unstable_ClientInstrumentation, o as unstable_InstrumentRequestHandlerFunction, q as unstable_InstrumentRouteFunction, p as unstable_InstrumentRouterFunction, r as unstable_InstrumentationHandlerResult, n as unstable_ServerInstrumentation } from './context-phCt_zmH.mjs';
|
||||
import { Z as RouteModules, z as DataStrategyFunction, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, T as To, L as Location, P as Params, U as UIMatch, v as Action, _ as SerializeFrom, $ as PathPattern, a0 as PathMatch, a1 as ParamParseKey, K as Path, r as RouteObject, G as GetLoaderData, l as GetActionData, O as InitialEntry, W as IndexRouteObject, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, Q as NonIndexRouteObject, a2 as Equal, B as PatchRoutesOnNavigationFunction, E as DataRouteObject, a as ClientLoaderFunction } from './data-U8FS-wNn.mjs';
|
||||
export { a3 as ActionFunctionArgs, a4 as BaseRouteObject, C as ClientActionFunction, as as ClientActionFunctionArgs, at as ClientLoaderFunctionArgs, w as DataRouteMatch, a5 as DataStrategyFunctionArgs, a6 as DataStrategyMatch, D as DataStrategyResult, a8 as ErrorResponse, n as FormEncType, a9 as FormMethod, ay as Future, m as HTMLFormMethod, au as HeadersArgs, H as HeadersFunction, ax as HtmlLinkDescriptor, V as LazyRouteFunction, e as LinkDescriptor, o as LoaderFunctionArgs, av as MetaArgs, g as MetaDescriptor, aa as MiddlewareFunction, aw as PageLinkDescriptor, ab as PatchRoutesOnNavigationFunctionArgs, ac as PathParam, ad as RedirectFunction, X as RouteMatch, ae as RouterContext, S as ShouldRevalidateFunction, af as ShouldRevalidateFunctionArgs, a7 as UNSAFE_DataWithResponseInit, aE as UNSAFE_ErrorResponseImpl, aB as UNSAFE_createBrowserHistory, aC as UNSAFE_createHashHistory, aA as UNSAFE_createMemoryHistory, aD as UNSAFE_invariant, ag as createContext, ah as createPath, aj as data, ak as generatePath, al as isRouteErrorResponse, am as matchPath, an as matchRoutes, ai as parsePath, ao as redirect, ap as redirectDocument, aq as replace, ar as resolvePath, az as unstable_SerializesTo } from './data-U8FS-wNn.mjs';
|
||||
import { c as Router, N as NavigateOptions, d as NavigationStates, B as BlockerFunction, e as Blocker, f as RelativeRoutingType, H as HydrationState, g as RouterState } from './context-CmHpk1Ws.mjs';
|
||||
export { K as Await, w as AwaitProps, C as ClientInstrumentation, b as ClientOnErrorFunction, F as Fetcher, G as GetScrollPositionFunction, h as GetScrollRestorationKeyFunction, u as IDLE_BLOCKER, t as IDLE_FETCHER, s as IDLE_NAVIGATION, x as IndexRouteProps, I as InstrumentRequestHandlerFunction, q as InstrumentRouteFunction, p as InstrumentRouterFunction, r as InstrumentationHandlerResult, L as LayoutRouteProps, Q as MemoryRouter, M as MemoryRouterOpts, y as MemoryRouterProps, T as Navigate, z as NavigateProps, j as Navigation, v as Navigator, U as Outlet, O as OutletProps, P as PathRouteProps, n as RevalidationState, V as Route, D as RouteProps, W as Router, m as RouterFetchOptions, R as RouterInit, l as RouterNavigateOptions, E as RouterProps, X as RouterProvider, a as RouterProviderProps, k as RouterSubscriber, Y as Routes, J as RoutesProps, o as ServerInstrumentation, S as StaticHandler, i as StaticHandlerContext, A as UNSAFE_AwaitContextProvider, a2 as UNSAFE_DataRouterContext, a3 as UNSAFE_DataRouterStateContext, a4 as UNSAFE_FetchersContext, a5 as UNSAFE_LocationContext, a6 as UNSAFE_NavigationContext, a7 as UNSAFE_RouteContext, a8 as UNSAFE_ViewTransitionContext, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps, a1 as UNSAFE_createRouter, a9 as UNSAFE_hydrationRouteProperties, aa as UNSAFE_mapRouteProperties, ac as UNSAFE_withComponentProps, ag as UNSAFE_withErrorBoundaryProps, ae as UNSAFE_withHydrateFallbackProps, Z as createMemoryRouter, _ as createRoutesFromChildren, $ as createRoutesFromElements, a0 as renderMatches } from './context-CmHpk1Ws.mjs';
|
||||
import * as React from 'react';
|
||||
import React__default, { ReactElement } from 'react';
|
||||
import { a as RouteModules$1, P as Pages } from './register-CTxsJBKQ.mjs';
|
||||
export { b as Register } from './register-CTxsJBKQ.mjs';
|
||||
import { A as AssetsManifest, S as ServerBuild, E as EntryContext, F as FutureConfig } from './index-react-server-client-BwWaHAr3.mjs';
|
||||
export { l as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, a1 as DiscoverBehavior, c as FetcherFormProps, h as FetcherSubmitFunction, G as FetcherSubmitOptions, i as FetcherWithComponents, q as Form, d as FormProps, a2 as HandleDataRequestFunction, a3 as HandleDocumentRequestFunction, a4 as HandleErrorFunction, m as HashRouter, H as HashRouterProps, a as HistoryRouterProps, n as Link, L as LinkProps, X as Links, _ as LinksProps, W as Meta, p as NavLink, N as NavLinkProps, b as NavLinkRenderProps, P as ParamKeyValuePair, a0 as PrefetchBehavior, Z as PrefetchPageLinks, Y as Scripts, $ as ScriptsProps, r as ScrollRestoration, e as ScrollRestorationProps, a5 as ServerEntryModule, f as SetURLSearchParams, T as StaticRouter, M as StaticRouterProps, V as StaticRouterProvider, O as StaticRouterProviderProps, g as SubmitFunction, I as SubmitOptions, J as SubmitTarget, a6 as UNSAFE_FrameworkContext, a7 as UNSAFE_createClientRoutes, a8 as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, a9 as UNSAFE_shouldHydrateRouteLoader, aa as UNSAFE_useScrollRestoration, U as URLSearchParamsInit, j as createBrowserRouter, k as createHashRouter, K as createSearchParams, Q as createStaticHandler, R as createStaticRouter, o as unstable_HistoryRouter, z as unstable_usePrompt, y as useBeforeUnload, w as useFetcher, x as useFetchers, v as useFormAction, u as useLinkClickHandler, s as useSearchParams, t as useSubmit, C as useViewTransitionState } from './index-react-server-client-BwWaHAr3.mjs';
|
||||
import { a as RouteModules$1, P as Pages } from './register-CqK96Zfk.mjs';
|
||||
export { b as Register } from './register-CqK96Zfk.mjs';
|
||||
import { A as AssetsManifest, S as ServerBuild, E as EntryContext, F as FutureConfig } from './index-react-server-client-DPrDrCew.mjs';
|
||||
export { l as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, a1 as DiscoverBehavior, c as FetcherFormProps, h as FetcherSubmitFunction, G as FetcherSubmitOptions, i as FetcherWithComponents, q as Form, d as FormProps, a2 as HandleDataRequestFunction, a3 as HandleDocumentRequestFunction, a4 as HandleErrorFunction, m as HashRouter, H as HashRouterProps, a as HistoryRouterProps, n as Link, L as LinkProps, X as Links, _ as LinksProps, W as Meta, p as NavLink, N as NavLinkProps, b as NavLinkRenderProps, P as ParamKeyValuePair, a0 as PrefetchBehavior, Z as PrefetchPageLinks, Y as Scripts, $ as ScriptsProps, r as ScrollRestoration, e as ScrollRestorationProps, a5 as ServerEntryModule, f as SetURLSearchParams, T as StaticRouter, M as StaticRouterProps, V as StaticRouterProvider, O as StaticRouterProviderProps, g as SubmitFunction, I as SubmitOptions, J as SubmitTarget, a6 as UNSAFE_FrameworkContext, a7 as UNSAFE_createClientRoutes, a8 as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, a9 as UNSAFE_shouldHydrateRouteLoader, aa as UNSAFE_useScrollRestoration, U as URLSearchParamsInit, j as createBrowserRouter, k as createHashRouter, K as createSearchParams, Q as createStaticHandler, R as createStaticRouter, o as unstable_HistoryRouter, z as unstable_usePrompt, y as useBeforeUnload, w as useFetcher, x as useFetchers, v as useFormAction, u as useLinkClickHandler, s as useSearchParams, t as useSubmit, C as useViewTransitionState } from './index-react-server-client-DPrDrCew.mjs';
|
||||
import { ParseOptions, SerializeOptions } from 'cookie';
|
||||
export { ParseOptions as CookieParseOptions, SerializeOptions as CookieSerializeOptions } from 'cookie';
|
||||
import { e as RSCPayload, g as getRequest, m as matchRSCServerRequest } from './browser-vtIR1Kpe.mjs';
|
||||
export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, h as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, i as unstable_RSCMatch, f as unstable_RSCRenderPayload, n as unstable_RSCRouteConfig, l as unstable_RSCRouteConfigEntry, j as unstable_RSCRouteManifest, k as unstable_RSCRouteMatch } from './browser-vtIR1Kpe.mjs';
|
||||
import { e as RSCPayload, g as getRequest, m as matchRSCServerRequest } from './browser-CGcs-0pD.mjs';
|
||||
export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, h as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, i as unstable_RSCMatch, f as unstable_RSCRenderPayload, n as unstable_RSCRouteConfig, l as unstable_RSCRouteConfigEntry, j as unstable_RSCRouteManifest, k as unstable_RSCRouteMatch } from './browser-CGcs-0pD.mjs';
|
||||
|
||||
declare const SingleFetchRedirectSymbol: unique symbol;
|
||||
declare function getTurboStreamSingleFetchDataStrategy(getRouter: () => Router, manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, basename: string | undefined, trailingSlashAware: boolean): DataStrategyFunction;
|
||||
@@ -113,7 +113,7 @@ declare function useNavigationType(): Action;
|
||||
* @param pattern The pattern to match against the current {@link Location}
|
||||
* @returns The path match object if the pattern matches, `null` otherwise
|
||||
*/
|
||||
declare function useMatch<ParamKey extends ParamParseKey<Path>, Path extends string>(pattern: PathPattern<Path> | Path): PathMatch<ParamKey> | null;
|
||||
declare function useMatch<Path extends string>(pattern: PathPattern<Path> | Path): PathMatch<ParamParseKey<Path>> | null;
|
||||
/**
|
||||
* The interface for the `navigate` function returned from {@link useNavigate}.
|
||||
*/
|
||||
@@ -526,6 +526,12 @@ declare function useResolvedPath(to: To, { relative }?: {
|
||||
* @returns A React element to render the matched route, or `null` if no routes matched
|
||||
*/
|
||||
declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location> | string): React.ReactElement | null;
|
||||
type UseNavigationResult = UseNavigationResultStates[keyof UseNavigationResultStates];
|
||||
type UseNavigationResultStates = {
|
||||
Idle: Omit<NavigationStates["Idle"], "matches" | "historyAction">;
|
||||
Loading: Omit<NavigationStates["Loading"], "matches" | "historyAction">;
|
||||
Submitting: Omit<NavigationStates["Submitting"], "matches" | "historyAction">;
|
||||
};
|
||||
/**
|
||||
* Returns the current {@link Navigation}, defaulting to an "idle" navigation
|
||||
* when no navigation is in progress. You can use this to render pending UI
|
||||
@@ -548,7 +554,7 @@ declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location
|
||||
* @mode data
|
||||
* @returns The current {@link Navigation} object
|
||||
*/
|
||||
declare function useNavigation(): Navigation;
|
||||
declare function useNavigation(): UseNavigationResult;
|
||||
/**
|
||||
* Revalidate the data on the page for reasons outside of normal data mutations
|
||||
* like [`Window` focus](https://developer.mozilla.org/en-US/docs/Web/API/Window/focus_event)
|
||||
@@ -878,6 +884,88 @@ type UseRoute<RouteId extends keyof RouteModules$1 | unknown> = {
|
||||
actionData: RouteId extends keyof RouteModules$1 ? GetActionData<RouteModules$1[RouteId]> | undefined : unknown;
|
||||
};
|
||||
declare function useRoute<Args extends UseRouteArgs>(...args: Args): UseRouteResult<Args>;
|
||||
/**
|
||||
* A single route match returned from {@link unstable_useRouterState}. Mirrors
|
||||
* {@link UIMatch} minus the data-related fields (`data`, `loaderData`).
|
||||
*/
|
||||
type unstable_RouterStateMatch<Handle = unknown> = Omit<UIMatch<unknown, Handle>, "data" | "loaderData">;
|
||||
/**
|
||||
* The shape of the `active` variant returned from
|
||||
* {@link unstable_useRouterState}.
|
||||
*/
|
||||
type unstable_RouterStateActiveVariant = {
|
||||
location: Location;
|
||||
searchParams: URLSearchParams;
|
||||
params: Params;
|
||||
matches: unstable_RouterStateMatch[];
|
||||
type: Action;
|
||||
};
|
||||
/**
|
||||
* The shape of the `pending` variant returned from
|
||||
* {@link unstable_useRouterState}. Extends
|
||||
* {@link unstable_RouterStateActiveVariant} with the navigation `state` and
|
||||
* submission fields mirroring {@link useNavigation} — submission fields are
|
||||
* populated when the in-flight navigation was triggered by a form submission,
|
||||
* otherwise `undefined`.
|
||||
*/
|
||||
type unstable_RouterStatePendingVariant = unstable_RouterStatePendingVariants[keyof unstable_RouterStatePendingVariants];
|
||||
type unstable_RouterStatePendingVariants = {
|
||||
Loading: unstable_RouterStateActiveVariant & Omit<NavigationStates["Loading"], "matches" | "historyAction">;
|
||||
Submitting: unstable_RouterStateActiveVariant & Omit<NavigationStates["Submitting"], "matches" | "historyAction">;
|
||||
};
|
||||
/**
|
||||
* The return shape of {@link unstable_useRouterState}.
|
||||
*
|
||||
* `active` reflects the currently-committed location. `pending` reflects the
|
||||
* in-flight navigation (if any).
|
||||
*/
|
||||
type unstable_RouterState = {
|
||||
active: unstable_RouterStateActiveVariant;
|
||||
pending: unstable_RouterStatePendingVariant | null;
|
||||
};
|
||||
/**
|
||||
* A unified hook for reading router state: current (`active`) and in-flight
|
||||
* (`pending`) locations, search params, params, matches, and navigation type.
|
||||
*
|
||||
* This hook consolidates the information you used to get from {@link useLocation},
|
||||
* {@link useSearchParams}, {@link useParams}, {@link useMatches}, {@link useNavigation},
|
||||
* and {@link useNavigationType} into a single hook.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* import { unstable_useRouterState as useRouterState } from "react-router";
|
||||
*
|
||||
* let { active, pending } = unstable_useRouterState();
|
||||
*
|
||||
* // Active is always populated with the current location
|
||||
* active.location; // replaces `useLocation()`
|
||||
* active.searchParams; // replaces `useSearchParams()[0]`
|
||||
* active.params; // replaces `useParams()`
|
||||
* active.matches; // replaces `useMatches()`
|
||||
* active.type; // replaces `useNavigationType()`
|
||||
*
|
||||
* // Pending is only populated during a navigation
|
||||
* pending.location; // replaces `useNavigation().location`
|
||||
* pending.searchParams; // equivalent to `new URLSearchParams(useNavigation().search)`
|
||||
* pending.params; // Not directly accessible today
|
||||
* pending.matches; // Not directly accessible today
|
||||
* pending.type; // Not directly accessible today
|
||||
* pending.state; // replaces `useNavigation().state`
|
||||
* pending.formMethod; // replaces useNavigation().formMethod
|
||||
* pending.formAction; // replaces useNavigation().formAction
|
||||
* pending.formEncType; // replaces useNavigation().formEncType
|
||||
* pending.formData; // replaces useNavigation().formData
|
||||
* pending.json; // replaces useNavigation().json
|
||||
* pending.text; // replaces useNavigation().text
|
||||
*
|
||||
* @name unstable_useRouterState
|
||||
* @public
|
||||
* @category Hooks
|
||||
* @mode framework
|
||||
* @mode data
|
||||
* @returns The current router state with `active` and `pending` variants
|
||||
*/
|
||||
declare function useRouterState(): unstable_RouterState;
|
||||
|
||||
/**
|
||||
* @category Types
|
||||
@@ -1387,4 +1475,4 @@ declare function getHydrationData({ state, routes, getRouteInfo, location, basen
|
||||
declare const unstable_getRequest: typeof getRequest;
|
||||
declare const unstable_matchRSCServerRequest: typeof matchRSCServerRequest;
|
||||
|
||||
export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, Navigation, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|
||||
export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, NavigationStates, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type unstable_RouterState, type unstable_RouterStateActiveVariant, type unstable_RouterStatePendingVariant, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|
||||
|
||||
+101
-13
@@ -1,17 +1,17 @@
|
||||
import { J as RouteModules, l as DataStrategyFunction, r as MiddlewareEnabled, c as RouterContextProvider, s as AppLoadContext, T as To, K as SerializeFrom, L as Location, O as ParamParseKey, p as Path, Q as PathPattern, V as PathMatch, U as UIMatch, i as Action, P as Params, e as RouteObject, G as GetLoaderData, I as GetActionData, W as InitialEntry, X as IndexRouteObject, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, Y as NonIndexRouteObject, Z as Equal, m as PatchRoutesOnNavigationFunction, n as DataRouteObject, a as ClientLoaderFunction } from './routeModules-CA7kSxJJ.js';
|
||||
export { _ as ActionFunctionArgs, $ as BaseRouteObject, C as ClientActionFunction, ap as ClientActionFunctionArgs, aq as ClientLoaderFunctionArgs, D as DataRouteMatch, a0 as DataStrategyFunctionArgs, a1 as DataStrategyMatch, B as DataStrategyResult, a3 as ErrorResponse, F as FormEncType, a4 as FormMethod, av as Future, o as HTMLFormMethod, ar as HeadersArgs, H as HeadersFunction, au as HtmlLinkDescriptor, a5 as LazyRouteFunction, t as LinkDescriptor, q as LoaderFunctionArgs, as as MetaArgs, w as MetaDescriptor, a6 as MiddlewareFunction, at as PageLinkDescriptor, a7 as PatchRoutesOnNavigationFunctionArgs, a8 as PathParam, a9 as RedirectFunction, aa as RouteMatch, ab as RouterContext, S as ShouldRevalidateFunction, ac as ShouldRevalidateFunctionArgs, a2 as UNSAFE_DataWithResponseInit, aB as UNSAFE_ErrorResponseImpl, ay as UNSAFE_createBrowserHistory, az as UNSAFE_createHashHistory, ax as UNSAFE_createMemoryHistory, aA as UNSAFE_invariant, ad as createContext, ae as createPath, ag as data, ah as generatePath, ai as isRouteErrorResponse, aj as matchPath, ak as matchRoutes, af as parsePath, al as redirect, am as redirectDocument, an as replace, ao as resolvePath, aw as unstable_SerializesTo } from './routeModules-CA7kSxJJ.js';
|
||||
import { a as Router, B as BlockerFunction, b as Blocker, c as RelativeRoutingType, N as Navigation, H as HydrationState, d as RouterState } from './instrumentation-BYr6ff5D.js';
|
||||
export { F as Fetcher, G as GetScrollPositionFunction, e as GetScrollRestorationKeyFunction, r as IDLE_BLOCKER, q as IDLE_FETCHER, I as IDLE_NAVIGATION, g as NavigationStates, k as RevalidationState, j as RouterFetchOptions, R as RouterInit, i as RouterNavigateOptions, h as RouterSubscriber, S as StaticHandler, f as StaticHandlerContext, s as UNSAFE_createRouter, u as unstable_ClientInstrumentation, m as unstable_InstrumentRequestHandlerFunction, o as unstable_InstrumentRouteFunction, n as unstable_InstrumentRouterFunction, p as unstable_InstrumentationHandlerResult, l as unstable_ServerInstrumentation } from './instrumentation-BYr6ff5D.js';
|
||||
import { A as AssetsManifest, S as ServerBuild, N as NavigateOptions, E as EntryContext, F as FutureConfig } from './index-react-server-client-luDbagNU.js';
|
||||
export { i as Await, c as AwaitProps, W as BrowserRouter, B as BrowserRouterProps, C as ClientOnErrorFunction, D as DOMRouterOpts, at as DiscoverBehavior, y as FetcherFormProps, Q as FetcherSubmitFunction, aa as FetcherSubmitOptions, T as FetcherWithComponents, $ as Form, z as FormProps, au as HandleDataRequestFunction, av as HandleDocumentRequestFunction, aw as HandleErrorFunction, X as HashRouter, H as HashRouterProps, u as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, Y as Link, v as LinkProps, an as Links, aq as LinksProps, j as MemoryRouter, M as MemoryRouterOpts, d as MemoryRouterProps, am as Meta, _ as NavLink, w as NavLinkProps, x as NavLinkRenderProps, k as Navigate, e as NavigateProps, a as Navigator, l as Outlet, O as OutletProps, ab as ParamKeyValuePair, P as PathRouteProps, as as PrefetchBehavior, ap as PrefetchPageLinks, m as Route, R as RouteProps, n as Router, f as RouterProps, o as RouterProvider, g as RouterProviderProps, p as Routes, h as RoutesProps, ao as Scripts, ar as ScriptsProps, a0 as ScrollRestoration, G as ScrollRestorationProps, ax as ServerEntryModule, J as SetURLSearchParams, ak as StaticRouter, ag as StaticRouterProps, al as StaticRouterProvider, ah as StaticRouterProviderProps, K as SubmitFunction, ac as SubmitOptions, ae as SubmitTarget, b as UNSAFE_AwaitContextProvider, ay as UNSAFE_DataRouterContext, az as UNSAFE_DataRouterStateContext, aA as UNSAFE_FetchersContext, aN as UNSAFE_FrameworkContext, aB as UNSAFE_LocationContext, aC as UNSAFE_NavigationContext, aD as UNSAFE_RouteContext, aE as UNSAFE_ViewTransitionContext, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, aO as UNSAFE_createClientRoutes, aP as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, aF as UNSAFE_hydrationRouteProperties, aG as UNSAFE_mapRouteProperties, aQ as UNSAFE_shouldHydrateRouteLoader, aR as UNSAFE_useScrollRestoration, aI as UNSAFE_withComponentProps, aM as UNSAFE_withErrorBoundaryProps, aK as UNSAFE_withHydrateFallbackProps, ad as URLSearchParamsInit, U as createBrowserRouter, V as createHashRouter, q as createMemoryRouter, r as createRoutesFromChildren, s as createRoutesFromElements, af as createSearchParams, ai as createStaticHandler, aj as createStaticRouter, t as renderMatches, Z as unstable_HistoryRouter, a8 as unstable_usePrompt, a7 as useBeforeUnload, a5 as useFetcher, a6 as useFetchers, a4 as useFormAction, a1 as useLinkClickHandler, a2 as useSearchParams, a3 as useSubmit, a9 as useViewTransitionState } from './index-react-server-client-luDbagNU.js';
|
||||
import { O as RouteModules, l as DataStrategyFunction, t as MiddlewareEnabled, c as RouterContextProvider, u as AppLoadContext, T as To, L as Location, P as Params, U as UIMatch, i as Action, Q as SerializeFrom, V as PathPattern, W as PathMatch, X as ParamParseKey, r as Path, e as RouteObject, G as GetLoaderData, K as GetActionData, Y as InitialEntry, Z as IndexRouteObject, d as LoaderFunction, A as ActionFunction, M as MetaFunction, b as LinksFunction, _ as NonIndexRouteObject, $ as Equal, m as PatchRoutesOnNavigationFunction, n as DataRouteObject, a as ClientLoaderFunction } from './data-D4xhSy90.js';
|
||||
export { a0 as ActionFunctionArgs, a1 as BaseRouteObject, C as ClientActionFunction, ar as ClientActionFunctionArgs, as as ClientLoaderFunctionArgs, D as DataRouteMatch, a2 as DataStrategyFunctionArgs, a3 as DataStrategyMatch, I as DataStrategyResult, a5 as ErrorResponse, F as FormEncType, a6 as FormMethod, ax as Future, q as HTMLFormMethod, at as HeadersArgs, H as HeadersFunction, aw as HtmlLinkDescriptor, a7 as LazyRouteFunction, v as LinkDescriptor, s as LoaderFunctionArgs, au as MetaArgs, y as MetaDescriptor, a8 as MiddlewareFunction, av as PageLinkDescriptor, a9 as PatchRoutesOnNavigationFunctionArgs, aa as PathParam, ab as RedirectFunction, ac as RouteMatch, ad as RouterContext, S as ShouldRevalidateFunction, ae as ShouldRevalidateFunctionArgs, a4 as UNSAFE_DataWithResponseInit, aD as UNSAFE_ErrorResponseImpl, aA as UNSAFE_createBrowserHistory, aB as UNSAFE_createHashHistory, az as UNSAFE_createMemoryHistory, aC as UNSAFE_invariant, af as createContext, ag as createPath, ai as data, aj as generatePath, ak as isRouteErrorResponse, al as matchPath, am as matchRoutes, ah as parsePath, an as redirect, ao as redirectDocument, ap as replace, aq as resolvePath, ay as unstable_SerializesTo } from './data-D4xhSy90.js';
|
||||
import { a as Router, N as NavigationStates, B as BlockerFunction, b as Blocker, c as RelativeRoutingType, H as HydrationState, d as RouterState } from './instrumentation-1q4YhLGP.js';
|
||||
export { C as ClientInstrumentation, F as Fetcher, G as GetScrollPositionFunction, e as GetScrollRestorationKeyFunction, r as IDLE_BLOCKER, q as IDLE_FETCHER, p as IDLE_NAVIGATION, I as InstrumentRequestHandlerFunction, n as InstrumentRouteFunction, m as InstrumentRouterFunction, o as InstrumentationHandlerResult, g as Navigation, k as RevalidationState, j as RouterFetchOptions, R as RouterInit, i as RouterNavigateOptions, h as RouterSubscriber, l as ServerInstrumentation, S as StaticHandler, f as StaticHandlerContext, s as UNSAFE_createRouter } from './instrumentation-1q4YhLGP.js';
|
||||
import { A as AssetsManifest, S as ServerBuild, N as NavigateOptions, E as EntryContext, F as FutureConfig } from './index-react-server-client-CwU9bE5R.js';
|
||||
export { i as Await, c as AwaitProps, W as BrowserRouter, B as BrowserRouterProps, C as ClientOnErrorFunction, D as DOMRouterOpts, at as DiscoverBehavior, y as FetcherFormProps, Q as FetcherSubmitFunction, aa as FetcherSubmitOptions, T as FetcherWithComponents, $ as Form, z as FormProps, au as HandleDataRequestFunction, av as HandleDocumentRequestFunction, aw as HandleErrorFunction, X as HashRouter, H as HashRouterProps, u as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, Y as Link, v as LinkProps, an as Links, aq as LinksProps, j as MemoryRouter, M as MemoryRouterOpts, d as MemoryRouterProps, am as Meta, _ as NavLink, w as NavLinkProps, x as NavLinkRenderProps, k as Navigate, e as NavigateProps, a as Navigator, l as Outlet, O as OutletProps, ab as ParamKeyValuePair, P as PathRouteProps, as as PrefetchBehavior, ap as PrefetchPageLinks, m as Route, R as RouteProps, n as Router, f as RouterProps, o as RouterProvider, g as RouterProviderProps, p as Routes, h as RoutesProps, ao as Scripts, ar as ScriptsProps, a0 as ScrollRestoration, G as ScrollRestorationProps, ax as ServerEntryModule, J as SetURLSearchParams, ak as StaticRouter, ag as StaticRouterProps, al as StaticRouterProvider, ah as StaticRouterProviderProps, K as SubmitFunction, ac as SubmitOptions, ae as SubmitTarget, b as UNSAFE_AwaitContextProvider, ay as UNSAFE_DataRouterContext, az as UNSAFE_DataRouterStateContext, aA as UNSAFE_FetchersContext, aN as UNSAFE_FrameworkContext, aB as UNSAFE_LocationContext, aC as UNSAFE_NavigationContext, aD as UNSAFE_RouteContext, aE as UNSAFE_ViewTransitionContext, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, aO as UNSAFE_createClientRoutes, aP as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, aF as UNSAFE_hydrationRouteProperties, aG as UNSAFE_mapRouteProperties, aQ as UNSAFE_shouldHydrateRouteLoader, aR as UNSAFE_useScrollRestoration, aI as UNSAFE_withComponentProps, aM as UNSAFE_withErrorBoundaryProps, aK as UNSAFE_withHydrateFallbackProps, ad as URLSearchParamsInit, U as createBrowserRouter, V as createHashRouter, q as createMemoryRouter, r as createRoutesFromChildren, s as createRoutesFromElements, af as createSearchParams, ai as createStaticHandler, aj as createStaticRouter, t as renderMatches, Z as unstable_HistoryRouter, a8 as unstable_usePrompt, a7 as useBeforeUnload, a5 as useFetcher, a6 as useFetchers, a4 as useFormAction, a1 as useLinkClickHandler, a2 as useSearchParams, a3 as useSubmit, a9 as useViewTransitionState } from './index-react-server-client-CwU9bE5R.js';
|
||||
import * as React from 'react';
|
||||
import React__default, { ReactElement } from 'react';
|
||||
import { a as RouteModules$1, P as Pages } from './register-CkcGwv27.js';
|
||||
export { b as Register } from './register-CkcGwv27.js';
|
||||
import { a as RouteModules$1, P as Pages } from './register-CNAx3TXj.js';
|
||||
export { b as Register } from './register-CNAx3TXj.js';
|
||||
import { ParseOptions, SerializeOptions } from 'cookie';
|
||||
export { ParseOptions as CookieParseOptions, SerializeOptions as CookieSerializeOptions } from 'cookie';
|
||||
import { e as RSCPayload, g as getRequest, m as matchRSCServerRequest } from './browser-C9Ar1yxG.js';
|
||||
export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, h as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, i as unstable_RSCMatch, f as unstable_RSCRenderPayload, n as unstable_RSCRouteConfig, l as unstable_RSCRouteConfigEntry, j as unstable_RSCRouteManifest, k as unstable_RSCRouteMatch } from './browser-C9Ar1yxG.js';
|
||||
import { e as RSCPayload, g as getRequest, m as matchRSCServerRequest } from './browser-D3uq9sI1.js';
|
||||
export { B as unstable_BrowserCreateFromReadableStreamFunction, D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, E as unstable_EncodeReplyFunction, L as unstable_LoadServerActionFunction, h as unstable_RSCHydratedRouterProps, d as unstable_RSCManifestPayload, i as unstable_RSCMatch, f as unstable_RSCRenderPayload, n as unstable_RSCRouteConfig, l as unstable_RSCRouteConfigEntry, j as unstable_RSCRouteManifest, k as unstable_RSCRouteMatch } from './browser-D3uq9sI1.js';
|
||||
|
||||
declare const SingleFetchRedirectSymbol: unique symbol;
|
||||
declare function getTurboStreamSingleFetchDataStrategy(getRouter: () => Router, manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, basename: string | undefined, trailingSlashAware: boolean): DataStrategyFunction;
|
||||
@@ -113,7 +113,7 @@ declare function useNavigationType(): Action;
|
||||
* @param pattern The pattern to match against the current {@link Location}
|
||||
* @returns The path match object if the pattern matches, `null` otherwise
|
||||
*/
|
||||
declare function useMatch<ParamKey extends ParamParseKey<Path>, Path extends string>(pattern: PathPattern<Path> | Path): PathMatch<ParamKey> | null;
|
||||
declare function useMatch<Path extends string>(pattern: PathPattern<Path> | Path): PathMatch<ParamParseKey<Path>> | null;
|
||||
/**
|
||||
* The interface for the `navigate` function returned from {@link useNavigate}.
|
||||
*/
|
||||
@@ -526,6 +526,12 @@ declare function useResolvedPath(to: To, { relative }?: {
|
||||
* @returns A React element to render the matched route, or `null` if no routes matched
|
||||
*/
|
||||
declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location> | string): React.ReactElement | null;
|
||||
type UseNavigationResult = UseNavigationResultStates[keyof UseNavigationResultStates];
|
||||
type UseNavigationResultStates = {
|
||||
Idle: Omit<NavigationStates["Idle"], "matches" | "historyAction">;
|
||||
Loading: Omit<NavigationStates["Loading"], "matches" | "historyAction">;
|
||||
Submitting: Omit<NavigationStates["Submitting"], "matches" | "historyAction">;
|
||||
};
|
||||
/**
|
||||
* Returns the current {@link Navigation}, defaulting to an "idle" navigation
|
||||
* when no navigation is in progress. You can use this to render pending UI
|
||||
@@ -548,7 +554,7 @@ declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location
|
||||
* @mode data
|
||||
* @returns The current {@link Navigation} object
|
||||
*/
|
||||
declare function useNavigation(): Navigation;
|
||||
declare function useNavigation(): UseNavigationResult;
|
||||
/**
|
||||
* Revalidate the data on the page for reasons outside of normal data mutations
|
||||
* like [`Window` focus](https://developer.mozilla.org/en-US/docs/Web/API/Window/focus_event)
|
||||
@@ -878,6 +884,88 @@ type UseRoute<RouteId extends keyof RouteModules$1 | unknown> = {
|
||||
actionData: RouteId extends keyof RouteModules$1 ? GetActionData<RouteModules$1[RouteId]> | undefined : unknown;
|
||||
};
|
||||
declare function useRoute<Args extends UseRouteArgs>(...args: Args): UseRouteResult<Args>;
|
||||
/**
|
||||
* A single route match returned from {@link unstable_useRouterState}. Mirrors
|
||||
* {@link UIMatch} minus the data-related fields (`data`, `loaderData`).
|
||||
*/
|
||||
type unstable_RouterStateMatch<Handle = unknown> = Omit<UIMatch<unknown, Handle>, "data" | "loaderData">;
|
||||
/**
|
||||
* The shape of the `active` variant returned from
|
||||
* {@link unstable_useRouterState}.
|
||||
*/
|
||||
type unstable_RouterStateActiveVariant = {
|
||||
location: Location;
|
||||
searchParams: URLSearchParams;
|
||||
params: Params;
|
||||
matches: unstable_RouterStateMatch[];
|
||||
type: Action;
|
||||
};
|
||||
/**
|
||||
* The shape of the `pending` variant returned from
|
||||
* {@link unstable_useRouterState}. Extends
|
||||
* {@link unstable_RouterStateActiveVariant} with the navigation `state` and
|
||||
* submission fields mirroring {@link useNavigation} — submission fields are
|
||||
* populated when the in-flight navigation was triggered by a form submission,
|
||||
* otherwise `undefined`.
|
||||
*/
|
||||
type unstable_RouterStatePendingVariant = unstable_RouterStatePendingVariants[keyof unstable_RouterStatePendingVariants];
|
||||
type unstable_RouterStatePendingVariants = {
|
||||
Loading: unstable_RouterStateActiveVariant & Omit<NavigationStates["Loading"], "matches" | "historyAction">;
|
||||
Submitting: unstable_RouterStateActiveVariant & Omit<NavigationStates["Submitting"], "matches" | "historyAction">;
|
||||
};
|
||||
/**
|
||||
* The return shape of {@link unstable_useRouterState}.
|
||||
*
|
||||
* `active` reflects the currently-committed location. `pending` reflects the
|
||||
* in-flight navigation (if any).
|
||||
*/
|
||||
type unstable_RouterState = {
|
||||
active: unstable_RouterStateActiveVariant;
|
||||
pending: unstable_RouterStatePendingVariant | null;
|
||||
};
|
||||
/**
|
||||
* A unified hook for reading router state: current (`active`) and in-flight
|
||||
* (`pending`) locations, search params, params, matches, and navigation type.
|
||||
*
|
||||
* This hook consolidates the information you used to get from {@link useLocation},
|
||||
* {@link useSearchParams}, {@link useParams}, {@link useMatches}, {@link useNavigation},
|
||||
* and {@link useNavigationType} into a single hook.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* import { unstable_useRouterState as useRouterState } from "react-router";
|
||||
*
|
||||
* let { active, pending } = unstable_useRouterState();
|
||||
*
|
||||
* // Active is always populated with the current location
|
||||
* active.location; // replaces `useLocation()`
|
||||
* active.searchParams; // replaces `useSearchParams()[0]`
|
||||
* active.params; // replaces `useParams()`
|
||||
* active.matches; // replaces `useMatches()`
|
||||
* active.type; // replaces `useNavigationType()`
|
||||
*
|
||||
* // Pending is only populated during a navigation
|
||||
* pending.location; // replaces `useNavigation().location`
|
||||
* pending.searchParams; // equivalent to `new URLSearchParams(useNavigation().search)`
|
||||
* pending.params; // Not directly accessible today
|
||||
* pending.matches; // Not directly accessible today
|
||||
* pending.type; // Not directly accessible today
|
||||
* pending.state; // replaces `useNavigation().state`
|
||||
* pending.formMethod; // replaces useNavigation().formMethod
|
||||
* pending.formAction; // replaces useNavigation().formAction
|
||||
* pending.formEncType; // replaces useNavigation().formEncType
|
||||
* pending.formData; // replaces useNavigation().formData
|
||||
* pending.json; // replaces useNavigation().json
|
||||
* pending.text; // replaces useNavigation().text
|
||||
*
|
||||
* @name unstable_useRouterState
|
||||
* @public
|
||||
* @category Hooks
|
||||
* @mode framework
|
||||
* @mode data
|
||||
* @returns The current router state with `active` and `pending` variants
|
||||
*/
|
||||
declare function useRouterState(): unstable_RouterState;
|
||||
|
||||
/**
|
||||
* @category Types
|
||||
@@ -1387,4 +1475,4 @@ declare function getHydrationData({ state, routes, getRouteInfo, location, basen
|
||||
declare const unstable_getRequest: typeof getRequest;
|
||||
declare const unstable_matchRSCServerRequest: typeof matchRSCServerRequest;
|
||||
|
||||
export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, Navigation, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|
||||
export { ActionFunction, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, Location, MetaFunction, type NavigateFunction, NavigateOptions, NavigationStates, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, RelativeRoutingType, type RequestHandler, RouteObject, RouterContextProvider, RouterState, type RoutesTestStubProps, ServerBuild, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, href, isCookie, isSession, RSCPayload as unstable_RSCPayload, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type unstable_RouterState, type unstable_RouterStateActiveVariant, type unstable_RouterStatePendingVariant, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
|
||||
|
||||
+196
-174
File diff suppressed because one or more lines are too long
+5
-3
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
isSession,
|
||||
routeRSCServerRequest,
|
||||
setDevServerHooks
|
||||
} from "./chunk-X5LK27NZ.mjs";
|
||||
} from "./chunk-5TQZEVD5.mjs";
|
||||
import {
|
||||
Action,
|
||||
Await,
|
||||
@@ -133,6 +133,7 @@ import {
|
||||
useRoute,
|
||||
useRouteError,
|
||||
useRouteLoaderData,
|
||||
useRouterState,
|
||||
useRoutes,
|
||||
useScrollRestoration,
|
||||
useSearchParams,
|
||||
@@ -141,7 +142,7 @@ import {
|
||||
withComponentProps,
|
||||
withErrorBoundaryProps,
|
||||
withHydrateFallbackProps
|
||||
} from "./chunk-HZQGQD2X.mjs";
|
||||
} from "./chunk-OSYEOCBT.mjs";
|
||||
export {
|
||||
Await,
|
||||
BrowserRouter,
|
||||
@@ -243,6 +244,7 @@ export {
|
||||
setDevServerHooks as unstable_setDevServerHooks,
|
||||
usePrompt as unstable_usePrompt,
|
||||
useRoute as unstable_useRoute,
|
||||
useRouterState as unstable_useRouterState,
|
||||
useActionData,
|
||||
useAsyncError,
|
||||
useAsyncValue,
|
||||
|
||||
-657
@@ -1,657 +0,0 @@
|
||||
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, U as UIMatch, T as To, o as HTMLFormMethod, F as FormEncType, p as Path, q as LoaderFunctionArgs, r as MiddlewareEnabled, s as AppLoadContext } from './routeModules-CA7kSxJJ.js';
|
||||
|
||||
/**
|
||||
* A Router instance manages all navigation and data loading/mutations
|
||||
*/
|
||||
interface Router {
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the basename for the router
|
||||
*/
|
||||
get basename(): RouterInit["basename"];
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the future config for the router
|
||||
*/
|
||||
get future(): FutureConfig;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the current state of the router
|
||||
*/
|
||||
get state(): RouterState;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the routes for this router instance
|
||||
*/
|
||||
get routes(): DataRouteObject[];
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Return the window associated with the router
|
||||
*/
|
||||
get window(): RouterInit["window"];
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Initialize the router, including adding history listeners and kicking off
|
||||
* initial data fetches. Returns a function to cleanup listeners and abort
|
||||
* any in-progress loads
|
||||
*/
|
||||
initialize(): Router;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Subscribe to router.state updates
|
||||
*
|
||||
* @param fn function to call with the new state
|
||||
*/
|
||||
subscribe(fn: RouterSubscriber): () => void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Enable scroll restoration behavior in the router
|
||||
*
|
||||
* @param savedScrollPositions Object that will manage positions, in case
|
||||
* it's being restored from sessionStorage
|
||||
* @param getScrollPosition Function to get the active Y scroll position
|
||||
* @param getKey Function to get the key to use for restoration
|
||||
*/
|
||||
enableScrollRestoration(savedScrollPositions: Record<string, number>, getScrollPosition: GetScrollPositionFunction, getKey?: GetScrollRestorationKeyFunction): () => void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Navigate forward/backward in the history stack
|
||||
* @param to Delta to move in the history stack
|
||||
*/
|
||||
navigate(to: number): Promise<void>;
|
||||
/**
|
||||
* Navigate to the given path
|
||||
* @param to Path to navigate to
|
||||
* @param opts Navigation options (method, submission, etc.)
|
||||
*/
|
||||
navigate(to: To | null, opts?: RouterNavigateOptions): Promise<void>;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Trigger a fetcher load/submission
|
||||
*
|
||||
* @param key Fetcher key
|
||||
* @param routeId Route that owns the fetcher
|
||||
* @param href href to fetch
|
||||
* @param opts Fetcher options, (method, submission, etc.)
|
||||
*/
|
||||
fetch(key: string, routeId: string, href: string | null, opts?: RouterFetchOptions): Promise<void>;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Trigger a revalidation of all current route loaders and fetcher loads
|
||||
*/
|
||||
revalidate(): Promise<void>;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Utility function to create an href for the given location
|
||||
* @param location
|
||||
*/
|
||||
createHref(location: Location | URL): string;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Utility function to URL encode a destination path according to the internal
|
||||
* history implementation
|
||||
* @param to
|
||||
*/
|
||||
encodeLocation(to: To): Path;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Get/create a fetcher for the given key
|
||||
* @param key
|
||||
*/
|
||||
getFetcher<TData = any>(key: string): Fetcher<TData>;
|
||||
/**
|
||||
* @internal
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Reset the fetcher for a given key
|
||||
* @param key
|
||||
*/
|
||||
resetFetcher(key: string, opts?: {
|
||||
reason?: unknown;
|
||||
}): void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Delete the fetcher for a given key
|
||||
* @param key
|
||||
*/
|
||||
deleteFetcher(key: string): void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Cleanup listeners and abort any in-progress loads
|
||||
*/
|
||||
dispose(): void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Get a navigation blocker
|
||||
* @param key The identifier for the blocker
|
||||
* @param fn The blocker function implementation
|
||||
*/
|
||||
getBlocker(key: string, fn: BlockerFunction): Blocker;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Delete a navigation blocker
|
||||
* @param key The identifier for the blocker
|
||||
*/
|
||||
deleteBlocker(key: string): void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE DO NOT USE
|
||||
*
|
||||
* Patch additional children routes into an existing parent route
|
||||
* @param routeId The parent route id or a callback function accepting `patch`
|
||||
* to perform batch patching
|
||||
* @param children The additional children routes
|
||||
* @param unstable_allowElementMutations Allow mutation or route elements on
|
||||
* existing routes. Intended for RSC-usage
|
||||
* only.
|
||||
*/
|
||||
patchRoutes(routeId: string | null, children: RouteObject[], unstable_allowElementMutations?: boolean): void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* HMR needs to pass in-flight route updates to React Router
|
||||
* TODO: Replace this with granular route update APIs (addRoute, updateRoute, deleteRoute)
|
||||
*/
|
||||
_internalSetRoutes(routes: RouteObject[]): void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Cause subscribers to re-render. This is used to force a re-render.
|
||||
*/
|
||||
_internalSetStateDoNotUseOrYouWillBreakYourApp(state: Partial<RouterState>): void;
|
||||
/**
|
||||
* @private
|
||||
* PRIVATE - DO NOT USE
|
||||
*
|
||||
* Internal fetch AbortControllers accessed by unit tests
|
||||
*/
|
||||
_internalFetchControllers: Map<string, AbortController>;
|
||||
}
|
||||
/**
|
||||
* State maintained internally by the router. During a navigation, all states
|
||||
* reflect the "old" location unless otherwise noted.
|
||||
*/
|
||||
interface RouterState {
|
||||
/**
|
||||
* The action of the most recent navigation
|
||||
*/
|
||||
historyAction: Action;
|
||||
/**
|
||||
* The current location reflected by the router
|
||||
*/
|
||||
location: Location;
|
||||
/**
|
||||
* The current set of route matches
|
||||
*/
|
||||
matches: DataRouteMatch[];
|
||||
/**
|
||||
* Tracks whether we've completed our initial data load
|
||||
*/
|
||||
initialized: boolean;
|
||||
/**
|
||||
* Tracks whether we should be rendering a HydrateFallback during hydration
|
||||
*/
|
||||
renderFallback: boolean;
|
||||
/**
|
||||
* Current scroll position we should start at for a new view
|
||||
* - number -> scroll position to restore to
|
||||
* - false -> do not restore scroll at all (used during submissions/revalidations)
|
||||
* - null -> don't have a saved position, scroll to hash or top of page
|
||||
*/
|
||||
restoreScrollPosition: number | false | null;
|
||||
/**
|
||||
* Indicate whether this navigation should skip resetting the scroll position
|
||||
* if we are unable to restore the scroll position
|
||||
*/
|
||||
preventScrollReset: boolean;
|
||||
/**
|
||||
* Tracks the state of the current navigation
|
||||
*/
|
||||
navigation: Navigation;
|
||||
/**
|
||||
* Tracks any in-progress revalidations
|
||||
*/
|
||||
revalidation: RevalidationState;
|
||||
/**
|
||||
* Data from the loaders for the current matches
|
||||
*/
|
||||
loaderData: RouteData;
|
||||
/**
|
||||
* Data from the action for the current matches
|
||||
*/
|
||||
actionData: RouteData | null;
|
||||
/**
|
||||
* Errors caught from loaders for the current matches
|
||||
*/
|
||||
errors: RouteData | null;
|
||||
/**
|
||||
* Map of current fetchers
|
||||
*/
|
||||
fetchers: Map<string, Fetcher>;
|
||||
/**
|
||||
* Map of current blockers
|
||||
*/
|
||||
blockers: Map<string, Blocker>;
|
||||
}
|
||||
/**
|
||||
* Data that can be passed into hydrate a Router from SSR
|
||||
*/
|
||||
type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "errors">>;
|
||||
/**
|
||||
* Future flags to toggle new feature behavior
|
||||
*/
|
||||
interface FutureConfig {
|
||||
unstable_passThroughRequests: boolean;
|
||||
}
|
||||
/**
|
||||
* Initialization options for createRouter
|
||||
*/
|
||||
interface RouterInit {
|
||||
routes: RouteObject[];
|
||||
history: History;
|
||||
basename?: string;
|
||||
getContext?: () => MaybePromise<RouterContextProvider>;
|
||||
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
||||
mapRouteProperties?: MapRoutePropertiesFunction;
|
||||
future?: Partial<FutureConfig>;
|
||||
hydrationRouteProperties?: string[];
|
||||
hydrationData?: HydrationState;
|
||||
window?: Window;
|
||||
dataStrategy?: DataStrategyFunction;
|
||||
patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction;
|
||||
}
|
||||
/**
|
||||
* State returned from a server-side query() call
|
||||
*/
|
||||
interface StaticHandlerContext {
|
||||
basename: Router["basename"];
|
||||
location: RouterState["location"];
|
||||
matches: RouterState["matches"];
|
||||
loaderData: RouterState["loaderData"];
|
||||
actionData: RouterState["actionData"];
|
||||
errors: RouterState["errors"];
|
||||
statusCode: number;
|
||||
loaderHeaders: Record<string, Headers>;
|
||||
actionHeaders: Record<string, Headers>;
|
||||
_deepestRenderedBoundaryId?: string | null;
|
||||
}
|
||||
/**
|
||||
* A StaticHandler instance manages a singular SSR navigation/fetch event
|
||||
*/
|
||||
interface StaticHandler {
|
||||
dataRoutes: DataRouteObject[];
|
||||
query(request: Request, opts?: {
|
||||
requestContext?: unknown;
|
||||
filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
|
||||
skipLoaderErrorBubbling?: boolean;
|
||||
skipRevalidation?: boolean;
|
||||
dataStrategy?: DataStrategyFunction<unknown>;
|
||||
generateMiddlewareResponse?: (query: (r: Request, args?: {
|
||||
filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
|
||||
}) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>;
|
||||
unstable_normalizePath?: (request: Request) => Path;
|
||||
}): Promise<StaticHandlerContext | Response>;
|
||||
queryRoute(request: Request, opts?: {
|
||||
routeId?: string;
|
||||
requestContext?: unknown;
|
||||
dataStrategy?: DataStrategyFunction<unknown>;
|
||||
generateMiddlewareResponse?: (queryRoute: (r: Request) => Promise<Response>) => MaybePromise<Response>;
|
||||
unstable_normalizePath?: (request: Request) => Path;
|
||||
}): Promise<any>;
|
||||
}
|
||||
type ViewTransitionOpts = {
|
||||
currentLocation: Location;
|
||||
nextLocation: Location;
|
||||
};
|
||||
/**
|
||||
* Subscriber function signature for changes to router state
|
||||
*/
|
||||
interface RouterSubscriber {
|
||||
(state: RouterState, opts: {
|
||||
deletedFetchers: string[];
|
||||
newErrors: RouteData | null;
|
||||
viewTransitionOpts?: ViewTransitionOpts;
|
||||
flushSync: boolean;
|
||||
}): void;
|
||||
}
|
||||
/**
|
||||
* Function signature for determining the key to be used in scroll restoration
|
||||
* for a given location
|
||||
*/
|
||||
interface GetScrollRestorationKeyFunction {
|
||||
(location: Location, matches: UIMatch[]): string | null;
|
||||
}
|
||||
/**
|
||||
* Function signature for determining the current scroll position
|
||||
*/
|
||||
interface GetScrollPositionFunction {
|
||||
(): number;
|
||||
}
|
||||
/**
|
||||
* - "route": relative to the route hierarchy so `..` means remove all segments
|
||||
* of the current route even if it has many. For example, a `route("posts/:id")`
|
||||
* would have both `:id` and `posts` removed from the url.
|
||||
* - "path": relative to the pathname so `..` means remove one segment of the
|
||||
* pathname. For example, a `route("posts/:id")` would have only `:id` removed
|
||||
* from the url.
|
||||
*/
|
||||
type RelativeRoutingType = "route" | "path";
|
||||
type BaseNavigateOrFetchOptions = {
|
||||
preventScrollReset?: boolean;
|
||||
relative?: RelativeRoutingType;
|
||||
flushSync?: boolean;
|
||||
unstable_defaultShouldRevalidate?: boolean;
|
||||
};
|
||||
type BaseNavigateOptions = BaseNavigateOrFetchOptions & {
|
||||
replace?: boolean;
|
||||
state?: any;
|
||||
fromRouteId?: string;
|
||||
viewTransition?: boolean;
|
||||
unstable_mask?: To;
|
||||
};
|
||||
type BaseSubmissionOptions = {
|
||||
formMethod?: HTMLFormMethod;
|
||||
formEncType?: FormEncType;
|
||||
} & ({
|
||||
formData: FormData;
|
||||
body?: undefined;
|
||||
} | {
|
||||
formData?: undefined;
|
||||
body: any;
|
||||
});
|
||||
/**
|
||||
* Options for a navigate() call for a normal (non-submission) navigation
|
||||
*/
|
||||
type LinkNavigateOptions = BaseNavigateOptions;
|
||||
/**
|
||||
* Options for a navigate() call for a submission navigation
|
||||
*/
|
||||
type SubmissionNavigateOptions = BaseNavigateOptions & BaseSubmissionOptions;
|
||||
/**
|
||||
* Options to pass to navigate() for a navigation
|
||||
*/
|
||||
type RouterNavigateOptions = LinkNavigateOptions | SubmissionNavigateOptions;
|
||||
/**
|
||||
* Options for a fetch() load
|
||||
*/
|
||||
type LoadFetchOptions = BaseNavigateOrFetchOptions;
|
||||
/**
|
||||
* Options for a fetch() submission
|
||||
*/
|
||||
type SubmitFetchOptions = BaseNavigateOrFetchOptions & BaseSubmissionOptions;
|
||||
/**
|
||||
* Options to pass to fetch()
|
||||
*/
|
||||
type RouterFetchOptions = LoadFetchOptions | SubmitFetchOptions;
|
||||
/**
|
||||
* Potential states for state.navigation
|
||||
*/
|
||||
type NavigationStates = {
|
||||
Idle: {
|
||||
state: "idle";
|
||||
location: undefined;
|
||||
formMethod: undefined;
|
||||
formAction: undefined;
|
||||
formEncType: undefined;
|
||||
formData: undefined;
|
||||
json: undefined;
|
||||
text: undefined;
|
||||
};
|
||||
Loading: {
|
||||
state: "loading";
|
||||
location: Location;
|
||||
formMethod: Submission["formMethod"] | undefined;
|
||||
formAction: Submission["formAction"] | undefined;
|
||||
formEncType: Submission["formEncType"] | undefined;
|
||||
formData: Submission["formData"] | undefined;
|
||||
json: Submission["json"] | undefined;
|
||||
text: Submission["text"] | undefined;
|
||||
};
|
||||
Submitting: {
|
||||
state: "submitting";
|
||||
location: Location;
|
||||
formMethod: Submission["formMethod"];
|
||||
formAction: Submission["formAction"];
|
||||
formEncType: Submission["formEncType"];
|
||||
formData: Submission["formData"];
|
||||
json: Submission["json"];
|
||||
text: Submission["text"];
|
||||
};
|
||||
};
|
||||
type Navigation = NavigationStates[keyof NavigationStates];
|
||||
type RevalidationState = "idle" | "loading";
|
||||
/**
|
||||
* Potential states for fetchers
|
||||
*/
|
||||
type FetcherStates<TData = any> = {
|
||||
/**
|
||||
* The fetcher is not calling a loader or action
|
||||
*
|
||||
* ```tsx
|
||||
* fetcher.state === "idle"
|
||||
* ```
|
||||
*/
|
||||
Idle: {
|
||||
state: "idle";
|
||||
formMethod: undefined;
|
||||
formAction: undefined;
|
||||
formEncType: undefined;
|
||||
text: undefined;
|
||||
formData: undefined;
|
||||
json: undefined;
|
||||
/**
|
||||
* If the fetcher has never been called, this will be undefined.
|
||||
*/
|
||||
data: TData | undefined;
|
||||
};
|
||||
/**
|
||||
* The fetcher is loading data from a {@link LoaderFunction | loader} from a
|
||||
* call to {@link FetcherWithComponents.load | `fetcher.load`}.
|
||||
*
|
||||
* ```tsx
|
||||
* // somewhere
|
||||
* <button onClick={() => fetcher.load("/some/route") }>Load</button>
|
||||
*
|
||||
* // the state will update
|
||||
* fetcher.state === "loading"
|
||||
* ```
|
||||
*/
|
||||
Loading: {
|
||||
state: "loading";
|
||||
formMethod: Submission["formMethod"] | undefined;
|
||||
formAction: Submission["formAction"] | undefined;
|
||||
formEncType: Submission["formEncType"] | undefined;
|
||||
text: Submission["text"] | undefined;
|
||||
formData: Submission["formData"] | undefined;
|
||||
json: Submission["json"] | undefined;
|
||||
data: TData | undefined;
|
||||
};
|
||||
/**
|
||||
The fetcher is submitting to a {@link LoaderFunction} (GET) or {@link ActionFunction} (POST) from a {@link FetcherWithComponents.Form | `fetcher.Form`} or {@link FetcherWithComponents.submit | `fetcher.submit`}.
|
||||
|
||||
```tsx
|
||||
// somewhere
|
||||
<input
|
||||
onChange={e => {
|
||||
fetcher.submit(event.currentTarget.form, { method: "post" });
|
||||
}}
|
||||
/>
|
||||
|
||||
// the state will update
|
||||
fetcher.state === "submitting"
|
||||
|
||||
// and formData will be available
|
||||
fetcher.formData
|
||||
```
|
||||
*/
|
||||
Submitting: {
|
||||
state: "submitting";
|
||||
formMethod: Submission["formMethod"];
|
||||
formAction: Submission["formAction"];
|
||||
formEncType: Submission["formEncType"];
|
||||
text: Submission["text"];
|
||||
formData: Submission["formData"];
|
||||
json: Submission["json"];
|
||||
data: TData | undefined;
|
||||
};
|
||||
};
|
||||
type Fetcher<TData = any> = FetcherStates<TData>[keyof FetcherStates<TData>];
|
||||
interface BlockerBlocked {
|
||||
state: "blocked";
|
||||
reset: () => void;
|
||||
proceed: () => void;
|
||||
location: Location;
|
||||
}
|
||||
interface BlockerUnblocked {
|
||||
state: "unblocked";
|
||||
reset: undefined;
|
||||
proceed: undefined;
|
||||
location: undefined;
|
||||
}
|
||||
interface BlockerProceeding {
|
||||
state: "proceeding";
|
||||
reset: undefined;
|
||||
proceed: undefined;
|
||||
location: Location;
|
||||
}
|
||||
type Blocker = BlockerUnblocked | BlockerBlocked | BlockerProceeding;
|
||||
type BlockerFunction = (args: {
|
||||
currentLocation: Location;
|
||||
nextLocation: Location;
|
||||
historyAction: Action;
|
||||
}) => boolean;
|
||||
declare const IDLE_NAVIGATION: NavigationStates["Idle"];
|
||||
declare const IDLE_FETCHER: FetcherStates["Idle"];
|
||||
declare const IDLE_BLOCKER: BlockerUnblocked;
|
||||
/**
|
||||
* Create a router and listen to history POP navigations
|
||||
*/
|
||||
declare function createRouter(init: RouterInit): Router;
|
||||
interface CreateStaticHandlerOptions {
|
||||
basename?: string;
|
||||
mapRouteProperties?: MapRoutePropertiesFunction;
|
||||
unstable_instrumentations?: Pick<unstable_ServerInstrumentation, "route">[];
|
||||
future?: Partial<FutureConfig>;
|
||||
}
|
||||
|
||||
type unstable_ServerInstrumentation = {
|
||||
handler?: unstable_InstrumentRequestHandlerFunction;
|
||||
route?: unstable_InstrumentRouteFunction;
|
||||
};
|
||||
type unstable_ClientInstrumentation = {
|
||||
router?: unstable_InstrumentRouterFunction;
|
||||
route?: unstable_InstrumentRouteFunction;
|
||||
};
|
||||
type unstable_InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
|
||||
type unstable_InstrumentRouterFunction = (router: InstrumentableRouter) => void;
|
||||
type unstable_InstrumentRouteFunction = (route: InstrumentableRoute) => void;
|
||||
type unstable_InstrumentationHandlerResult = {
|
||||
status: "success";
|
||||
error: undefined;
|
||||
} | {
|
||||
status: "error";
|
||||
error: Error;
|
||||
};
|
||||
type InstrumentFunction<T> = (handler: () => Promise<unstable_InstrumentationHandlerResult>, info: T) => Promise<void>;
|
||||
type ReadonlyRequest = {
|
||||
method: string;
|
||||
url: string;
|
||||
headers: Pick<Headers, "get">;
|
||||
};
|
||||
type ReadonlyContext = MiddlewareEnabled extends true ? Pick<RouterContextProvider, "get"> : Readonly<AppLoadContext>;
|
||||
type InstrumentableRoute = {
|
||||
id: string;
|
||||
index: boolean | undefined;
|
||||
path: string | undefined;
|
||||
instrument(instrumentations: RouteInstrumentations): void;
|
||||
};
|
||||
type RouteInstrumentations = {
|
||||
lazy?: InstrumentFunction<RouteLazyInstrumentationInfo>;
|
||||
"lazy.loader"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
|
||||
"lazy.action"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
|
||||
"lazy.middleware"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
|
||||
middleware?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
|
||||
loader?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
|
||||
action?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
|
||||
};
|
||||
type RouteLazyInstrumentationInfo = undefined;
|
||||
type RouteHandlerInstrumentationInfo = Readonly<{
|
||||
request: ReadonlyRequest;
|
||||
params: LoaderFunctionArgs["params"];
|
||||
unstable_pattern: string;
|
||||
context: ReadonlyContext;
|
||||
}>;
|
||||
type InstrumentableRouter = {
|
||||
instrument(instrumentations: RouterInstrumentations): void;
|
||||
};
|
||||
type RouterInstrumentations = {
|
||||
navigate?: InstrumentFunction<RouterNavigationInstrumentationInfo>;
|
||||
fetch?: InstrumentFunction<RouterFetchInstrumentationInfo>;
|
||||
};
|
||||
type RouterNavigationInstrumentationInfo = Readonly<{
|
||||
to: string | number;
|
||||
currentUrl: string;
|
||||
formMethod?: HTMLFormMethod;
|
||||
formEncType?: FormEncType;
|
||||
formData?: FormData;
|
||||
body?: any;
|
||||
}>;
|
||||
type RouterFetchInstrumentationInfo = Readonly<{
|
||||
href: string;
|
||||
currentUrl: string;
|
||||
fetcherKey: string;
|
||||
formMethod?: HTMLFormMethod;
|
||||
formEncType?: FormEncType;
|
||||
formData?: FormData;
|
||||
body?: any;
|
||||
}>;
|
||||
type InstrumentableRequestHandler = {
|
||||
instrument(instrumentations: RequestHandlerInstrumentations): void;
|
||||
};
|
||||
type RequestHandlerInstrumentations = {
|
||||
request?: InstrumentFunction<RequestHandlerInstrumentationInfo>;
|
||||
};
|
||||
type RequestHandlerInstrumentationInfo = Readonly<{
|
||||
request: ReadonlyRequest;
|
||||
context: ReadonlyContext | undefined;
|
||||
}>;
|
||||
|
||||
export { type BlockerFunction as B, type CreateStaticHandlerOptions as C, type Fetcher as F, type GetScrollPositionFunction as G, type HydrationState as H, IDLE_NAVIGATION as I, type Navigation 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 NavigationStates as g, type RouterSubscriber as h, type RouterNavigateOptions as i, type RouterFetchOptions as j, type RevalidationState as k, type unstable_ServerInstrumentation as l, type unstable_InstrumentRequestHandlerFunction as m, type unstable_InstrumentRouterFunction as n, type unstable_InstrumentRouteFunction as o, type unstable_InstrumentationHandlerResult as p, IDLE_FETCHER as q, IDLE_BLOCKER as r, createRouter as s, type FutureConfig as t, type unstable_ClientInstrumentation as u };
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
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 '../../routeModules-BRrCYrSL.mjs';
|
||||
import { R as RouteFiles, P as Pages } from '../../register-CTxsJBKQ.mjs';
|
||||
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';
|
||||
import { R as RouteFiles, P as Pages } from '../../register-CqK96Zfk.mjs';
|
||||
import 'react';
|
||||
|
||||
type MaybePromise<T> = T | Promise<T>;
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { R as RouteModule, t as LinkDescriptor, L as Location, u as Func, v as Pretty, w as MetaDescriptor, G as GetLoaderData, x as ServerDataFunctionArgs, y as MiddlewareNextFunction, z as ClientDataFunctionArgs, B as DataStrategyResult, E as ServerDataFrom, N as Normalize, I as GetActionData } from '../../routeModules-CA7kSxJJ.js';
|
||||
import { R as RouteFiles, P as Pages } from '../../register-CkcGwv27.js';
|
||||
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';
|
||||
import { R as RouteFiles, P as Pages } from '../../register-CNAx3TXj.js';
|
||||
import 'react';
|
||||
|
||||
type MaybePromise<T> = T | Promise<T>;
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
"use strict";/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* react-router v7.14.0
|
||||
* react-router v7.17.0
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
import { R as RouteModule } from './routeModules-BRrCYrSL.mjs';
|
||||
|
||||
/**
|
||||
* Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
|
||||
* React Router should handle this for you via type generation.
|
||||
*
|
||||
* For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation .
|
||||
*/
|
||||
interface Register {
|
||||
}
|
||||
type AnyParams = Record<string, string | undefined>;
|
||||
type AnyPages = Record<string, {
|
||||
params: AnyParams;
|
||||
}>;
|
||||
type Pages = Register extends {
|
||||
pages: infer Registered extends AnyPages;
|
||||
} ? Registered : AnyPages;
|
||||
type AnyRouteFiles = Record<string, {
|
||||
id: string;
|
||||
page: string;
|
||||
}>;
|
||||
type RouteFiles = Register extends {
|
||||
routeFiles: infer Registered extends AnyRouteFiles;
|
||||
} ? Registered : AnyRouteFiles;
|
||||
type AnyRouteModules = Record<string, RouteModule>;
|
||||
type RouteModules = Register extends {
|
||||
routeModules: infer Registered extends AnyRouteModules;
|
||||
} ? Registered : AnyRouteModules;
|
||||
|
||||
export type { Pages as P, RouteFiles as R, RouteModules as a, Register as b };
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
import { R as RouteModule } from './routeModules-CA7kSxJJ.js';
|
||||
|
||||
/**
|
||||
* Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
|
||||
* React Router should handle this for you via type generation.
|
||||
*
|
||||
* For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation .
|
||||
*/
|
||||
interface Register {
|
||||
}
|
||||
type AnyParams = Record<string, string | undefined>;
|
||||
type AnyPages = Record<string, {
|
||||
params: AnyParams;
|
||||
}>;
|
||||
type Pages = Register extends {
|
||||
pages: infer Registered extends AnyPages;
|
||||
} ? Registered : AnyPages;
|
||||
type AnyRouteFiles = Record<string, {
|
||||
id: string;
|
||||
page: string;
|
||||
}>;
|
||||
type RouteFiles = Register extends {
|
||||
routeFiles: infer Registered extends AnyRouteFiles;
|
||||
} ? Registered : AnyRouteFiles;
|
||||
type AnyRouteModules = Record<string, RouteModule>;
|
||||
type RouteModules = Register extends {
|
||||
routeModules: infer Registered extends AnyRouteModules;
|
||||
} ? Registered : AnyRouteModules;
|
||||
|
||||
export type { Pages as P, RouteFiles as R, RouteModules as a, Register as b };
|
||||
-1693
File diff suppressed because it is too large
Load Diff
-1693
File diff suppressed because it is too large
Load Diff
+2
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-router",
|
||||
"version": "7.14.0",
|
||||
"version": "7.17.0",
|
||||
"description": "Declarative routing for React",
|
||||
"keywords": [
|
||||
"react",
|
||||
@@ -148,6 +148,7 @@
|
||||
},
|
||||
"files": [
|
||||
"dist/",
|
||||
"docs/",
|
||||
"CHANGELOG.md",
|
||||
"LICENSE.md",
|
||||
"README.md"
|
||||
|
||||
Reference in New Issue
Block a user