react-router 7.8.0 → 7.8.1-pre.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/development/{chunk-VC6RBZTR.js → chunk-3JDDYHAM.js} +130 -130
- package/dist/development/{chunk-EVX7OBGB.js → chunk-5556IWOV.js} +98 -83
- package/dist/development/{chunk-ZYFC6VSF.mjs → chunk-74543KUN.mjs} +62 -47
- package/dist/{production/chunk-XPGU3ZMH.mjs → development/chunk-NL6TORMN.mjs} +147 -33
- package/dist/development/dom-export.js +3 -3
- package/dist/development/dom-export.mjs +3 -3
- package/dist/{production/index-react-server-client-DXb0OgpJ.d.mts → development/index-react-server-client-11fLy3qB.d.mts} +1 -1
- package/dist/development/{index-react-server-client-CMphySRb.d.ts → index-react-server-client-BQ6FxdA_.d.ts} +1 -1
- package/dist/development/index-react-server-client.d.mts +2 -2
- package/dist/development/index-react-server-client.d.ts +2 -2
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.d.mts +38 -1
- package/dist/development/index-react-server.d.ts +38 -1
- package/dist/development/index-react-server.js +56 -45
- package/dist/development/index-react-server.mjs +56 -46
- package/dist/development/index.d.mts +42 -4
- package/dist/development/index.d.ts +42 -4
- package/dist/development/index.js +242 -128
- package/dist/development/index.mjs +3 -3
- package/dist/development/lib/types/internal.d.mts +6 -3
- package/dist/development/lib/types/internal.d.ts +6 -3
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{route-data-CpB5xtMm.d.mts → route-data-CNjObrhZ.d.mts} +1 -1
- package/dist/development/{routeModules-qBivMBjd.d.ts → routeModules-C3oqzPpI.d.ts} +1 -1
- package/dist/production/{chunk-BOD6JCOU.js → chunk-3OSMCWIR.js} +98 -83
- package/dist/production/{chunk-SIHON65V.mjs → chunk-HVGIEXH6.mjs} +62 -47
- package/dist/{development/chunk-HZX6U7MI.mjs → production/chunk-J44BHEXU.mjs} +147 -33
- package/dist/production/{chunk-O6DRQPUD.js → chunk-OE6UW5JS.js} +130 -130
- package/dist/production/dom-export.js +3 -3
- package/dist/production/dom-export.mjs +3 -3
- package/dist/{development/index-react-server-client-DXb0OgpJ.d.mts → production/index-react-server-client-11fLy3qB.d.mts} +1 -1
- package/dist/production/{index-react-server-client-CMphySRb.d.ts → index-react-server-client-BQ6FxdA_.d.ts} +1 -1
- package/dist/production/index-react-server-client.d.mts +2 -2
- package/dist/production/index-react-server-client.d.ts +2 -2
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.d.mts +38 -1
- package/dist/production/index-react-server.d.ts +38 -1
- package/dist/production/index-react-server.js +56 -45
- package/dist/production/index-react-server.mjs +56 -46
- package/dist/production/index.d.mts +42 -4
- package/dist/production/index.d.ts +42 -4
- package/dist/production/index.js +242 -128
- package/dist/production/index.mjs +3 -3
- package/dist/production/lib/types/internal.d.mts +6 -3
- package/dist/production/lib/types/internal.d.ts +6 -3
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/{route-data-CpB5xtMm.d.mts → route-data-CNjObrhZ.d.mts} +1 -1
- package/dist/production/{routeModules-qBivMBjd.d.ts → routeModules-C3oqzPpI.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
|
|
2
|
-
* react-router v7.8.
|
|
2
|
+
* react-router v7.8.1-pre.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"use client";
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunk3OSMCWIRjs = require('./chunk-3OSMCWIR.js');
|
|
15
15
|
|
|
16
16
|
// lib/dom-export/dom-router-provider.tsx
|
|
17
17
|
var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react);
|
|
@@ -180,7 +180,7 @@ function HydratedRouter(props) {
|
|
|
180
180
|
}, []);
|
|
181
181
|
React2.useEffect(() => {
|
|
182
182
|
if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
|
|
183
|
-
document.querySelectorAll(`[${
|
|
183
|
+
document.querySelectorAll(`[${_chunk3OSMCWIRjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
|
|
184
184
|
}
|
|
185
185
|
}, [criticalCss]);
|
|
186
186
|
let [location, setLocation] = React2.useState(router.state.location);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.8.
|
|
2
|
+
* react-router v7.8.1-pre.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import {
|
|
13
13
|
deserializeErrors,
|
|
14
14
|
getHydrationData
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-J44BHEXU.mjs";
|
|
16
16
|
import {
|
|
17
17
|
CRITICAL_CSS_DATA_ATTRIBUTE,
|
|
18
18
|
FrameworkContext,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
invariant,
|
|
30
30
|
mapRouteProperties,
|
|
31
31
|
useFogOFWarDiscovery
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-HVGIEXH6.mjs";
|
|
33
33
|
|
|
34
34
|
// lib/dom-export/dom-router-provider.tsx
|
|
35
35
|
import * as React from "react";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import './components-CuPfnyiZ.mjs';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { az as RouteManifest, M as MiddlewareEnabled, o as unstable_RouterContextProvider, j as LoaderFunctionArgs, i as ActionFunctionArgs, J as StaticHandlerContext, H as HydrationState, z as DataRouteObject, a2 as HTMLFormMethod, a0 as FormEncType, a as RelativeRoutingType, T as To, aA as History, E as GetScrollRestorationKeyFunction, e as RouterInit, F as FutureConfig$1, D as DataStrategyFunction, P as PatchRoutesOnNavigationFunction, q as NavigateOptions, K as Fetcher, f as RouteObject, R as Router, B as BlockerFunction, c as Location, aB as CreateStaticHandlerOptions$1, C as StaticHandler } from './context-DohQKLID.mjs';
|
|
4
|
-
import { o as ServerRouteModule, A as AppLoadContext, c as RouteModules, h as ClientLoaderFunction, m as PageLinkDescriptor, d as SerializeFrom } from './route-data-
|
|
4
|
+
import { o as ServerRouteModule, A as AppLoadContext, c as RouteModules, h as ClientLoaderFunction, m as PageLinkDescriptor, d as SerializeFrom } from './route-data-CNjObrhZ.mjs';
|
|
5
5
|
|
|
6
6
|
type ServerRouteManifest = RouteManifest<Omit<ServerRoute, "children">>;
|
|
7
7
|
interface ServerRoute extends Route {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as InitialEntry, T as To, i as RelativeRoutingType, w as NonIndexRouteObject,
|
|
1
|
+
import { I as InitialEntry, T as To, i as RelativeRoutingType, w as NonIndexRouteObject, ag as LazyRouteFunction, q as IndexRouteObject, a as Location, A as Action, aD as Navigator, d as Router$1, V as RouterInit, aZ as FutureConfig$1, H as HydrationState, D as DataStrategyFunction, X as PatchRoutesOnNavigationFunction, p as RouteObject, aF as RouteMatch, o as Params, U as UIMatch, af as HTMLFormMethod, ad as FormEncType, a_ as RouteManifest, a$ as ServerRouteModule, z as MiddlewareEnabled, y as unstable_RouterContextProvider, x as AppLoadContext, ah as LoaderFunctionArgs, a7 as ActionFunctionArgs, e as RouteModules, Y as DataRouteObject, K as ClientLoaderFunction, a0 as StaticHandlerContext, aK as PageLinkDescriptor, b0 as History, $ as GetScrollRestorationKeyFunction, f as NavigateOptions, a1 as Fetcher, h as SerializeFrom, B as BlockerFunction, b1 as CreateStaticHandlerOptions$1, Z as StaticHandler } from './routeModules-C3oqzPpI.js';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
4
|
declare function mapRouteProperties(route: RouteObject): Partial<RouteObject> & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { f as Await, g as MemoryRouter, h as Navigate, i as Outlet, j as Route, k as Router, l as RouterProvider, m as Routes, W as UNSAFE_WithComponentProps, v as UNSAFE_WithErrorBoundaryProps, t as UNSAFE_WithHydrateFallbackProps } from './components-CuPfnyiZ.mjs';
|
|
2
|
-
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-
|
|
2
|
+
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-11fLy3qB.mjs';
|
|
3
3
|
import './context-DohQKLID.mjs';
|
|
4
4
|
import 'react';
|
|
5
|
-
import './route-data-
|
|
5
|
+
import './route-data-CNjObrhZ.mjs';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { h as Await, V as BrowserRouter, _ as Form, W as HashRouter, X as Link, am as Links, i as MemoryRouter, al as Meta, Z as NavLink, j as Navigate, k as Outlet, l as Route, m as Router, n as RouterProvider, o as Routes, $ as ScrollRestoration, aj as StaticRouter, ak as StaticRouterProvider, az as UNSAFE_WithComponentProps, aD as UNSAFE_WithErrorBoundaryProps, aB as UNSAFE_WithHydrateFallbackProps, Y as unstable_HistoryRouter } from './index-react-server-client-
|
|
2
|
-
import './routeModules-
|
|
1
|
+
export { h as Await, V as BrowserRouter, _ as Form, W as HashRouter, X as Link, am as Links, i as MemoryRouter, al as Meta, Z as NavLink, j as Navigate, k as Outlet, l as Route, m as Router, n as RouterProvider, o as Routes, $ as ScrollRestoration, aj as StaticRouter, ak as StaticRouterProvider, az as UNSAFE_WithComponentProps, aD as UNSAFE_WithErrorBoundaryProps, aB as UNSAFE_WithHydrateFallbackProps, Y as unstable_HistoryRouter } from './index-react-server-client-BQ6FxdA_.js';
|
|
2
|
+
import './routeModules-C3oqzPpI.js';
|
|
3
3
|
import 'react';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
|
|
2
|
-
* react-router v7.8.
|
|
2
|
+
* react-router v7.8.1-pre.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
var
|
|
33
|
+
var _chunkOE6UW5JSjs = require('./chunk-OE6UW5JS.js');
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
var
|
|
37
|
+
var _chunk3OSMCWIRjs = require('./chunk-3OSMCWIR.js');
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
@@ -58,4 +58,4 @@ var _chunkBOD6JCOUjs = require('./chunk-BOD6JCOU.js');
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
|
|
61
|
-
exports.Await =
|
|
61
|
+
exports.Await = _chunkOE6UW5JSjs.Await; exports.BrowserRouter = _chunkOE6UW5JSjs.BrowserRouter; exports.Form = _chunkOE6UW5JSjs.Form; exports.HashRouter = _chunkOE6UW5JSjs.HashRouter; exports.Link = _chunkOE6UW5JSjs.Link; exports.Links = _chunk3OSMCWIRjs.Links; exports.MemoryRouter = _chunkOE6UW5JSjs.MemoryRouter; exports.Meta = _chunk3OSMCWIRjs.Meta; exports.NavLink = _chunkOE6UW5JSjs.NavLink; exports.Navigate = _chunkOE6UW5JSjs.Navigate; exports.Outlet = _chunkOE6UW5JSjs.Outlet; exports.Route = _chunkOE6UW5JSjs.Route; exports.Router = _chunkOE6UW5JSjs.Router; exports.RouterProvider = _chunkOE6UW5JSjs.RouterProvider; exports.Routes = _chunkOE6UW5JSjs.Routes; exports.ScrollRestoration = _chunkOE6UW5JSjs.ScrollRestoration; exports.StaticRouter = _chunkOE6UW5JSjs.StaticRouter; exports.StaticRouterProvider = _chunkOE6UW5JSjs.StaticRouterProvider; exports.UNSAFE_WithComponentProps = _chunkOE6UW5JSjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkOE6UW5JSjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkOE6UW5JSjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkOE6UW5JSjs.HistoryRouter;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.8.
|
|
2
|
+
* react-router v7.8.1-pre.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
WithComponentProps,
|
|
33
33
|
WithErrorBoundaryProps,
|
|
34
34
|
WithHydrateFallbackProps
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-HVGIEXH6.mjs";
|
|
36
36
|
export {
|
|
37
37
|
Await,
|
|
38
38
|
BrowserRouter,
|
|
@@ -849,6 +849,43 @@ declare const redirectDocument$1: RedirectFunction;
|
|
|
849
849
|
* header.
|
|
850
850
|
*/
|
|
851
851
|
declare const replace$1: RedirectFunction;
|
|
852
|
+
type ErrorResponse = {
|
|
853
|
+
status: number;
|
|
854
|
+
statusText: string;
|
|
855
|
+
data: any;
|
|
856
|
+
};
|
|
857
|
+
/**
|
|
858
|
+
* Check if the given error is an {@link ErrorResponse} generated from a 4xx/5xx
|
|
859
|
+
* [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
|
860
|
+
* thrown from an [`action`](../../start/framework/route-module#action)/[`loader`](../../start/framework/route-module#loader)
|
|
861
|
+
*
|
|
862
|
+
* @example
|
|
863
|
+
* import { isRouteErrorResponse } from "react-router";
|
|
864
|
+
*
|
|
865
|
+
* export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
|
|
866
|
+
* if (isRouteErrorResponse(error)) {
|
|
867
|
+
* return (
|
|
868
|
+
* <>
|
|
869
|
+
* <p>Error: `${error.status}: ${error.statusText}`</p>
|
|
870
|
+
* <p>{error.data}</p>
|
|
871
|
+
* </>
|
|
872
|
+
* );
|
|
873
|
+
* }
|
|
874
|
+
*
|
|
875
|
+
* return (
|
|
876
|
+
* <p>Error: {error instanceof Error ? error.message : "Unknown Error"}</p>
|
|
877
|
+
* );
|
|
878
|
+
* }
|
|
879
|
+
*
|
|
880
|
+
* @public
|
|
881
|
+
* @category Utils
|
|
882
|
+
* @mode framework
|
|
883
|
+
* @mode data
|
|
884
|
+
* @param error The error to check.
|
|
885
|
+
* @returns `true` if the error is an {@link ErrorResponse}, `false` otherwise.
|
|
886
|
+
*
|
|
887
|
+
*/
|
|
888
|
+
declare function isRouteErrorResponse(error: any): error is ErrorResponse;
|
|
852
889
|
|
|
853
890
|
/**
|
|
854
891
|
* A Router instance manages all navigation and data loading/mutations
|
|
@@ -2187,4 +2224,4 @@ interface MemorySessionStorageOptions {
|
|
|
2187
2224
|
*/
|
|
2188
2225
|
declare function createMemorySessionStorage<Data = SessionData, FlashData = Data>({ cookie }?: MemorySessionStorageOptions): SessionStorage<Data, FlashData>;
|
|
2189
2226
|
|
|
2190
|
-
export { type Cookie, type CookieOptions, type CookieSignatureOptions, type FlashSessionData, type IsCookieFunction, type IsSessionFunction, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, createCookie, createCookieSessionStorage, createMemorySessionStorage, createSession, createSessionStorage, createStaticHandler, data, isCookie, isSession, matchRoutes, redirect, redirectDocument, replace, type DecodeActionFunction as unstable_DecodeActionFunction, type DecodeFormStateFunction as unstable_DecodeFormStateFunction, type DecodeReplyFunction as unstable_DecodeReplyFunction, type LoadServerActionFunction as unstable_LoadServerActionFunction, type unstable_MiddlewareFunction, type unstable_MiddlewareNextFunction, type RSCManifestPayload as unstable_RSCManifestPayload, type RSCMatch as unstable_RSCMatch, type RSCPayload as unstable_RSCPayload, type RSCRenderPayload as unstable_RSCRenderPayload, type RSCRouteConfig as unstable_RSCRouteConfig, type RSCRouteConfigEntry as unstable_RSCRouteConfigEntry, type RSCRouteManifest as unstable_RSCRouteManifest, type RSCRouteMatch as unstable_RSCRouteMatch, type unstable_RouterContext, unstable_RouterContextProvider, unstable_createContext, matchRSCServerRequest as unstable_matchRSCServerRequest };
|
|
2227
|
+
export { type Cookie, type CookieOptions, type CookieSignatureOptions, type FlashSessionData, type IsCookieFunction, type IsSessionFunction, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, createCookie, createCookieSessionStorage, createMemorySessionStorage, createSession, createSessionStorage, createStaticHandler, data, isCookie, isRouteErrorResponse, isSession, matchRoutes, redirect, redirectDocument, replace, type DecodeActionFunction as unstable_DecodeActionFunction, type DecodeFormStateFunction as unstable_DecodeFormStateFunction, type DecodeReplyFunction as unstable_DecodeReplyFunction, type LoadServerActionFunction as unstable_LoadServerActionFunction, type unstable_MiddlewareFunction, type unstable_MiddlewareNextFunction, type RSCManifestPayload as unstable_RSCManifestPayload, type RSCMatch as unstable_RSCMatch, type RSCPayload as unstable_RSCPayload, type RSCRenderPayload as unstable_RSCRenderPayload, type RSCRouteConfig as unstable_RSCRouteConfig, type RSCRouteConfigEntry as unstable_RSCRouteConfigEntry, type RSCRouteManifest as unstable_RSCRouteManifest, type RSCRouteMatch as unstable_RSCRouteMatch, type unstable_RouterContext, unstable_RouterContextProvider, unstable_createContext, matchRSCServerRequest as unstable_matchRSCServerRequest };
|
|
@@ -849,6 +849,43 @@ declare const redirectDocument$1: RedirectFunction;
|
|
|
849
849
|
* header.
|
|
850
850
|
*/
|
|
851
851
|
declare const replace$1: RedirectFunction;
|
|
852
|
+
type ErrorResponse = {
|
|
853
|
+
status: number;
|
|
854
|
+
statusText: string;
|
|
855
|
+
data: any;
|
|
856
|
+
};
|
|
857
|
+
/**
|
|
858
|
+
* Check if the given error is an {@link ErrorResponse} generated from a 4xx/5xx
|
|
859
|
+
* [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
|
860
|
+
* thrown from an [`action`](../../start/framework/route-module#action)/[`loader`](../../start/framework/route-module#loader)
|
|
861
|
+
*
|
|
862
|
+
* @example
|
|
863
|
+
* import { isRouteErrorResponse } from "react-router";
|
|
864
|
+
*
|
|
865
|
+
* export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
|
|
866
|
+
* if (isRouteErrorResponse(error)) {
|
|
867
|
+
* return (
|
|
868
|
+
* <>
|
|
869
|
+
* <p>Error: `${error.status}: ${error.statusText}`</p>
|
|
870
|
+
* <p>{error.data}</p>
|
|
871
|
+
* </>
|
|
872
|
+
* );
|
|
873
|
+
* }
|
|
874
|
+
*
|
|
875
|
+
* return (
|
|
876
|
+
* <p>Error: {error instanceof Error ? error.message : "Unknown Error"}</p>
|
|
877
|
+
* );
|
|
878
|
+
* }
|
|
879
|
+
*
|
|
880
|
+
* @public
|
|
881
|
+
* @category Utils
|
|
882
|
+
* @mode framework
|
|
883
|
+
* @mode data
|
|
884
|
+
* @param error The error to check.
|
|
885
|
+
* @returns `true` if the error is an {@link ErrorResponse}, `false` otherwise.
|
|
886
|
+
*
|
|
887
|
+
*/
|
|
888
|
+
declare function isRouteErrorResponse(error: any): error is ErrorResponse;
|
|
852
889
|
|
|
853
890
|
/**
|
|
854
891
|
* A Router instance manages all navigation and data loading/mutations
|
|
@@ -2187,4 +2224,4 @@ interface MemorySessionStorageOptions {
|
|
|
2187
2224
|
*/
|
|
2188
2225
|
declare function createMemorySessionStorage<Data = SessionData, FlashData = Data>({ cookie }?: MemorySessionStorageOptions): SessionStorage<Data, FlashData>;
|
|
2189
2226
|
|
|
2190
|
-
export { type Cookie, type CookieOptions, type CookieSignatureOptions, type FlashSessionData, type IsCookieFunction, type IsSessionFunction, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, createCookie, createCookieSessionStorage, createMemorySessionStorage, createSession, createSessionStorage, createStaticHandler, data, isCookie, isSession, matchRoutes, redirect, redirectDocument, replace, type DecodeActionFunction as unstable_DecodeActionFunction, type DecodeFormStateFunction as unstable_DecodeFormStateFunction, type DecodeReplyFunction as unstable_DecodeReplyFunction, type LoadServerActionFunction as unstable_LoadServerActionFunction, type unstable_MiddlewareFunction, type unstable_MiddlewareNextFunction, type RSCManifestPayload as unstable_RSCManifestPayload, type RSCMatch as unstable_RSCMatch, type RSCPayload as unstable_RSCPayload, type RSCRenderPayload as unstable_RSCRenderPayload, type RSCRouteConfig as unstable_RSCRouteConfig, type RSCRouteConfigEntry as unstable_RSCRouteConfigEntry, type RSCRouteManifest as unstable_RSCRouteManifest, type RSCRouteMatch as unstable_RSCRouteMatch, type unstable_RouterContext, unstable_RouterContextProvider, unstable_createContext, matchRSCServerRequest as unstable_matchRSCServerRequest };
|
|
2227
|
+
export { type Cookie, type CookieOptions, type CookieSignatureOptions, type FlashSessionData, type IsCookieFunction, type IsSessionFunction, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, createCookie, createCookieSessionStorage, createMemorySessionStorage, createSession, createSessionStorage, createStaticHandler, data, isCookie, isRouteErrorResponse, isSession, matchRoutes, redirect, redirectDocument, replace, type DecodeActionFunction as unstable_DecodeActionFunction, type DecodeFormStateFunction as unstable_DecodeFormStateFunction, type DecodeReplyFunction as unstable_DecodeReplyFunction, type LoadServerActionFunction as unstable_LoadServerActionFunction, type unstable_MiddlewareFunction, type unstable_MiddlewareNextFunction, type RSCManifestPayload as unstable_RSCManifestPayload, type RSCMatch as unstable_RSCMatch, type RSCPayload as unstable_RSCPayload, type RSCRenderPayload as unstable_RSCRenderPayload, type RSCRouteConfig as unstable_RSCRouteConfig, type RSCRouteConfigEntry as unstable_RSCRouteConfigEntry, type RSCRouteManifest as unstable_RSCRouteManifest, type RSCRouteMatch as unstable_RSCRouteMatch, type unstable_RouterContext, unstable_RouterContextProvider, unstable_createContext, matchRSCServerRequest as unstable_matchRSCServerRequest };
|
|
@@ -27,7 +27,7 @@ function _interopNamespace(e) {
|
|
|
27
27
|
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* react-router v7.8.
|
|
30
|
+
* react-router v7.8.1-pre.1
|
|
31
31
|
*
|
|
32
32
|
* Copyright (c) Remix Software Inc.
|
|
33
33
|
*
|
|
@@ -259,8 +259,8 @@ function convertRouteMatchToUiMatch(match, loaderData) {
|
|
|
259
259
|
handle: route.handle
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
|
-
function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "") {
|
|
263
|
-
let flattenRoute = (route, index, relativePath) => {
|
|
262
|
+
function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) {
|
|
263
|
+
let flattenRoute = (route, index, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {
|
|
264
264
|
let meta = {
|
|
265
265
|
relativePath: relativePath === void 0 ? route.path || "" : relativePath,
|
|
266
266
|
caseSensitive: route.caseSensitive === true,
|
|
@@ -268,6 +268,9 @@ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "")
|
|
|
268
268
|
route
|
|
269
269
|
};
|
|
270
270
|
if (meta.relativePath.startsWith("/")) {
|
|
271
|
+
if (!meta.relativePath.startsWith(parentPath) && hasParentOptionalSegments) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
271
274
|
invariant(
|
|
272
275
|
meta.relativePath.startsWith(parentPath),
|
|
273
276
|
`Absolute route path "${meta.relativePath}" nested under path "${parentPath}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
|
|
@@ -283,7 +286,13 @@ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "")
|
|
|
283
286
|
route.index !== true,
|
|
284
287
|
`Index routes must not have child routes. Please remove all child routes from route path "${path}".`
|
|
285
288
|
);
|
|
286
|
-
flattenRoutes(
|
|
289
|
+
flattenRoutes(
|
|
290
|
+
route.children,
|
|
291
|
+
branches,
|
|
292
|
+
routesMeta,
|
|
293
|
+
path,
|
|
294
|
+
hasParentOptionalSegments
|
|
295
|
+
);
|
|
287
296
|
}
|
|
288
297
|
if (route.path == null && !route.index) {
|
|
289
298
|
return;
|
|
@@ -299,7 +308,7 @@ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "")
|
|
|
299
308
|
flattenRoute(route, index);
|
|
300
309
|
} else {
|
|
301
310
|
for (let exploded of explodeOptionalSegments(route.path)) {
|
|
302
|
-
flattenRoute(route, index, exploded);
|
|
311
|
+
flattenRoute(route, index, true, exploded);
|
|
303
312
|
}
|
|
304
313
|
}
|
|
305
314
|
});
|
|
@@ -463,7 +472,7 @@ function compilePath(path, caseSensitive = false, end = true) {
|
|
|
463
472
|
params.push({ paramName, isOptional: isOptional != null });
|
|
464
473
|
return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
|
|
465
474
|
}
|
|
466
|
-
);
|
|
475
|
+
).replace(/\/([\w-]+)\?(\/|$)/g, "(/$1)?$2");
|
|
467
476
|
if (path.endsWith("*")) {
|
|
468
477
|
params.push({ paramName: "*" });
|
|
469
478
|
regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
|
|
@@ -773,9 +782,23 @@ function createStaticHandler(routes, opts) {
|
|
|
773
782
|
return res;
|
|
774
783
|
},
|
|
775
784
|
async (error, routeId) => {
|
|
776
|
-
if (
|
|
785
|
+
if (isRedirectResponse(error)) {
|
|
777
786
|
return error;
|
|
778
787
|
}
|
|
788
|
+
if (isResponse(error)) {
|
|
789
|
+
try {
|
|
790
|
+
error = new ErrorResponseImpl(
|
|
791
|
+
error.status,
|
|
792
|
+
error.statusText,
|
|
793
|
+
await parseResponseBody(error)
|
|
794
|
+
);
|
|
795
|
+
} catch (e) {
|
|
796
|
+
error = e;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
if (isDataWithResponseInit(error)) {
|
|
800
|
+
error = dataWithResponseInitToErrorResponse(error);
|
|
801
|
+
}
|
|
779
802
|
if (renderedStaticContext) {
|
|
780
803
|
if (routeId in renderedStaticContext.loaderData) {
|
|
781
804
|
renderedStaticContext.loaderData[routeId] = void 0;
|
|
@@ -901,8 +924,8 @@ function createStaticHandler(routes, opts) {
|
|
|
901
924
|
return res;
|
|
902
925
|
},
|
|
903
926
|
(error) => {
|
|
904
|
-
if (
|
|
905
|
-
return Promise.resolve(
|
|
927
|
+
if (isDataWithResponseInit(error)) {
|
|
928
|
+
return Promise.resolve(dataWithResponseInitToResponse(error));
|
|
906
929
|
}
|
|
907
930
|
if (isResponse(error)) {
|
|
908
931
|
return Promise.resolve(error);
|
|
@@ -1229,8 +1252,12 @@ function createStaticHandler(routes, opts) {
|
|
|
1229
1252
|
basename
|
|
1230
1253
|
);
|
|
1231
1254
|
}
|
|
1232
|
-
if (
|
|
1233
|
-
|
|
1255
|
+
if (isRouteRequest) {
|
|
1256
|
+
if (isResponse(result.result)) {
|
|
1257
|
+
throw result;
|
|
1258
|
+
} else if (isDataWithResponseInit(result.result)) {
|
|
1259
|
+
throw dataWithResponseInitToResponse(result.result);
|
|
1260
|
+
}
|
|
1234
1261
|
}
|
|
1235
1262
|
dataResults[match.route.id] = await convertDataStrategyResultToDataResult(result);
|
|
1236
1263
|
})
|
|
@@ -1539,11 +1566,7 @@ async function callServerRouteMiddleware(args, middlewares, handler, errorHandle
|
|
|
1539
1566
|
nextResult = result;
|
|
1540
1567
|
return nextResult;
|
|
1541
1568
|
} catch (e) {
|
|
1542
|
-
nextResult = await errorHandler(
|
|
1543
|
-
// Convert thrown data() values to ErrorResponses
|
|
1544
|
-
isDataWithResponseInit(e) ? dataWithResponseInitToErrorResponse(e) : e,
|
|
1545
|
-
routeId
|
|
1546
|
-
);
|
|
1569
|
+
nextResult = await errorHandler(e, routeId);
|
|
1547
1570
|
return nextResult;
|
|
1548
1571
|
}
|
|
1549
1572
|
};
|
|
@@ -1568,11 +1591,7 @@ async function callServerRouteMiddleware(args, middlewares, handler, errorHandle
|
|
|
1568
1591
|
return nextResult;
|
|
1569
1592
|
}
|
|
1570
1593
|
} catch (e) {
|
|
1571
|
-
let response = await errorHandler(
|
|
1572
|
-
// Convert thrown data() values to ErrorResponses
|
|
1573
|
-
isDataWithResponseInit(e) ? dataWithResponseInitToErrorResponse(e) : e,
|
|
1574
|
-
routeId
|
|
1575
|
-
);
|
|
1594
|
+
let response = await errorHandler(e, routeId);
|
|
1576
1595
|
return response;
|
|
1577
1596
|
}
|
|
1578
1597
|
}
|
|
@@ -1798,21 +1817,19 @@ async function callLoaderOrAction({
|
|
|
1798
1817
|
}
|
|
1799
1818
|
return result;
|
|
1800
1819
|
}
|
|
1820
|
+
async function parseResponseBody(response) {
|
|
1821
|
+
let contentType = response.headers.get("Content-Type");
|
|
1822
|
+
if (contentType && /\bapplication\/json\b/.test(contentType)) {
|
|
1823
|
+
return response.body == null ? null : response.json();
|
|
1824
|
+
}
|
|
1825
|
+
return response.text();
|
|
1826
|
+
}
|
|
1801
1827
|
async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
1802
1828
|
let { result, type } = dataStrategyResult;
|
|
1803
1829
|
if (isResponse(result)) {
|
|
1804
1830
|
let data2;
|
|
1805
1831
|
try {
|
|
1806
|
-
|
|
1807
|
-
if (contentType && /\bapplication\/json\b/.test(contentType)) {
|
|
1808
|
-
if (result.body == null) {
|
|
1809
|
-
data2 = null;
|
|
1810
|
-
} else {
|
|
1811
|
-
data2 = await result.json();
|
|
1812
|
-
}
|
|
1813
|
-
} else {
|
|
1814
|
-
data2 = await result.text();
|
|
1815
|
-
}
|
|
1832
|
+
data2 = await parseResponseBody(result);
|
|
1816
1833
|
} catch (e) {
|
|
1817
1834
|
return { type: "error" /* error */, error: e };
|
|
1818
1835
|
}
|
|
@@ -2012,10 +2029,7 @@ function getInternalRouterError(status, {
|
|
|
2012
2029
|
);
|
|
2013
2030
|
}
|
|
2014
2031
|
function dataWithResponseInitToResponse(data2) {
|
|
2015
|
-
return
|
|
2016
|
-
typeof data2.data === "string" ? data2.data : JSON.stringify(data2.data),
|
|
2017
|
-
data2.init || void 0
|
|
2018
|
-
);
|
|
2032
|
+
return Response.json(data2.data, data2.init ?? void 0);
|
|
2019
2033
|
}
|
|
2020
2034
|
function dataWithResponseInitToErrorResponse(data2) {
|
|
2021
2035
|
return new ErrorResponseImpl(
|
|
@@ -2024,15 +2038,6 @@ function dataWithResponseInitToErrorResponse(data2) {
|
|
|
2024
2038
|
data2.data
|
|
2025
2039
|
);
|
|
2026
2040
|
}
|
|
2027
|
-
function errorResponseToResponse(error) {
|
|
2028
|
-
return new Response(
|
|
2029
|
-
typeof error.data === "string" ? error.data : JSON.stringify(error.data),
|
|
2030
|
-
{
|
|
2031
|
-
status: error.status,
|
|
2032
|
-
statusText: error.statusText
|
|
2033
|
-
}
|
|
2034
|
-
);
|
|
2035
|
-
}
|
|
2036
2041
|
function isDataStrategyResult(result) {
|
|
2037
2042
|
return result != null && typeof result === "object" && "type" in result && "result" in result && (result.type === "data" /* data */ || result.type === "error" /* error */);
|
|
2038
2043
|
}
|
|
@@ -2740,7 +2745,12 @@ async function getRSCRouteMatch({
|
|
|
2740
2745
|
path: match.route.path,
|
|
2741
2746
|
pathname: match.pathname,
|
|
2742
2747
|
pathnameBase: match.pathnameBase,
|
|
2743
|
-
shouldRevalidate: match.route.shouldRevalidate
|
|
2748
|
+
shouldRevalidate: match.route.shouldRevalidate,
|
|
2749
|
+
// Add an unused client-only export (if present) so HMR can support
|
|
2750
|
+
// switching between server-first and client-only routes during development
|
|
2751
|
+
...match.route.__ensureClientRouteModuleForHMR ? {
|
|
2752
|
+
__ensureClientRouteModuleForHMR: match.route.__ensureClientRouteModuleForHMR
|
|
2753
|
+
} : {}
|
|
2744
2754
|
};
|
|
2745
2755
|
}
|
|
2746
2756
|
async function getManifestRoute(route) {
|
|
@@ -3249,6 +3259,7 @@ exports.createSessionStorage = createSessionStorage;
|
|
|
3249
3259
|
exports.createStaticHandler = createStaticHandler;
|
|
3250
3260
|
exports.data = data;
|
|
3251
3261
|
exports.isCookie = isCookie;
|
|
3262
|
+
exports.isRouteErrorResponse = isRouteErrorResponse;
|
|
3252
3263
|
exports.isSession = isSession;
|
|
3253
3264
|
exports.matchRoutes = matchRoutes;
|
|
3254
3265
|
exports.redirect = redirect2;
|