react-router 7.8.1-pre.0 → 7.8.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 +5 -4
- package/dist/development/{chunk-V2P3SFSY.mjs → chunk-IFMMFE4R.mjs} +2 -2
- package/dist/development/{chunk-3JLHOGU7.js → chunk-IIA3TUI2.js} +130 -130
- package/dist/development/{chunk-CXAO7FY7.js → chunk-TGXCWGPT.js} +29 -37
- package/dist/development/{chunk-WKLBIS42.mjs → chunk-UH6JLGW7.mjs} +30 -38
- package/dist/development/dom-export.js +3 -3
- package/dist/development/dom-export.mjs +3 -3
- 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.js +29 -37
- package/dist/development/index-react-server.mjs +29 -37
- package/dist/development/index.js +102 -102
- package/dist/development/index.mjs +3 -3
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/production/{chunk-ZKLGVTLT.mjs → chunk-5Y7ELDIJ.mjs} +2 -2
- package/dist/production/{chunk-ZFXTWIWH.js → chunk-KHPQXKYM.js} +29 -37
- package/dist/production/{chunk-GIJZ6O2U.mjs → chunk-PFDCNQUK.mjs} +30 -38
- package/dist/production/{chunk-6K5ETUFZ.js → chunk-YMYXECPK.js} +130 -130
- package/dist/production/dom-export.js +3 -3
- package/dist/production/dom-export.mjs +3 -3
- 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.js +29 -37
- package/dist/production/index-react-server.mjs +29 -37
- package/dist/production/index.js +102 -102
- package/dist/production/index.mjs +3 -3
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +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.1
|
|
2
|
+
* react-router v7.8.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 _chunkKHPQXKYMjs = require('./chunk-KHPQXKYM.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(`[${_chunkKHPQXKYMjs.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.1
|
|
2
|
+
* react-router v7.8.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-5Y7ELDIJ.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-PFDCNQUK.mjs";
|
|
33
33
|
|
|
34
34
|
// lib/dom-export/dom-router-provider.tsx
|
|
35
35
|
import * as React from "react";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
|
|
2
|
-
* react-router v7.8.1
|
|
2
|
+
* react-router v7.8.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 _chunkYMYXECPKjs = require('./chunk-YMYXECPK.js');
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
var
|
|
37
|
+
var _chunkKHPQXKYMjs = require('./chunk-KHPQXKYM.js');
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
@@ -58,4 +58,4 @@ var _chunkZFXTWIWHjs = require('./chunk-ZFXTWIWH.js');
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
|
|
61
|
-
exports.Await =
|
|
61
|
+
exports.Await = _chunkYMYXECPKjs.Await; exports.BrowserRouter = _chunkYMYXECPKjs.BrowserRouter; exports.Form = _chunkYMYXECPKjs.Form; exports.HashRouter = _chunkYMYXECPKjs.HashRouter; exports.Link = _chunkYMYXECPKjs.Link; exports.Links = _chunkKHPQXKYMjs.Links; exports.MemoryRouter = _chunkYMYXECPKjs.MemoryRouter; exports.Meta = _chunkKHPQXKYMjs.Meta; exports.NavLink = _chunkYMYXECPKjs.NavLink; exports.Navigate = _chunkYMYXECPKjs.Navigate; exports.Outlet = _chunkYMYXECPKjs.Outlet; exports.Route = _chunkYMYXECPKjs.Route; exports.Router = _chunkYMYXECPKjs.Router; exports.RouterProvider = _chunkYMYXECPKjs.RouterProvider; exports.Routes = _chunkYMYXECPKjs.Routes; exports.ScrollRestoration = _chunkYMYXECPKjs.ScrollRestoration; exports.StaticRouter = _chunkYMYXECPKjs.StaticRouter; exports.StaticRouterProvider = _chunkYMYXECPKjs.StaticRouterProvider; exports.UNSAFE_WithComponentProps = _chunkYMYXECPKjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkYMYXECPKjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkYMYXECPKjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkYMYXECPKjs.HistoryRouter;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.8.1
|
|
2
|
+
* react-router v7.8.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-PFDCNQUK.mjs";
|
|
36
36
|
export {
|
|
37
37
|
Await,
|
|
38
38
|
BrowserRouter,
|
|
@@ -27,7 +27,7 @@ function _interopNamespace(e) {
|
|
|
27
27
|
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* react-router v7.8.1
|
|
30
|
+
* react-router v7.8.1
|
|
31
31
|
*
|
|
32
32
|
* Copyright (c) Remix Software Inc.
|
|
33
33
|
*
|
|
@@ -782,9 +782,23 @@ function createStaticHandler(routes, opts) {
|
|
|
782
782
|
return res;
|
|
783
783
|
},
|
|
784
784
|
async (error, routeId) => {
|
|
785
|
-
if (
|
|
785
|
+
if (isRedirectResponse(error)) {
|
|
786
786
|
return error;
|
|
787
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
|
+
}
|
|
788
802
|
if (renderedStaticContext) {
|
|
789
803
|
if (routeId in renderedStaticContext.loaderData) {
|
|
790
804
|
renderedStaticContext.loaderData[routeId] = void 0;
|
|
@@ -910,8 +924,8 @@ function createStaticHandler(routes, opts) {
|
|
|
910
924
|
return res;
|
|
911
925
|
},
|
|
912
926
|
(error) => {
|
|
913
|
-
if (
|
|
914
|
-
return Promise.resolve(
|
|
927
|
+
if (isDataWithResponseInit(error)) {
|
|
928
|
+
return Promise.resolve(dataWithResponseInitToResponse(error));
|
|
915
929
|
}
|
|
916
930
|
if (isResponse(error)) {
|
|
917
931
|
return Promise.resolve(error);
|
|
@@ -1552,11 +1566,7 @@ async function callServerRouteMiddleware(args, middlewares, handler, errorHandle
|
|
|
1552
1566
|
nextResult = result;
|
|
1553
1567
|
return nextResult;
|
|
1554
1568
|
} catch (e) {
|
|
1555
|
-
nextResult = await errorHandler(
|
|
1556
|
-
// Convert thrown data() values to ErrorResponses
|
|
1557
|
-
isDataWithResponseInit(e) ? dataWithResponseInitToErrorResponse(e) : e,
|
|
1558
|
-
routeId
|
|
1559
|
-
);
|
|
1569
|
+
nextResult = await errorHandler(e, routeId);
|
|
1560
1570
|
return nextResult;
|
|
1561
1571
|
}
|
|
1562
1572
|
};
|
|
@@ -1581,11 +1591,7 @@ async function callServerRouteMiddleware(args, middlewares, handler, errorHandle
|
|
|
1581
1591
|
return nextResult;
|
|
1582
1592
|
}
|
|
1583
1593
|
} catch (e) {
|
|
1584
|
-
let response = await errorHandler(
|
|
1585
|
-
// Convert thrown data() values to ErrorResponses
|
|
1586
|
-
isDataWithResponseInit(e) ? dataWithResponseInitToErrorResponse(e) : e,
|
|
1587
|
-
routeId
|
|
1588
|
-
);
|
|
1594
|
+
let response = await errorHandler(e, routeId);
|
|
1589
1595
|
return response;
|
|
1590
1596
|
}
|
|
1591
1597
|
}
|
|
@@ -1811,21 +1817,19 @@ async function callLoaderOrAction({
|
|
|
1811
1817
|
}
|
|
1812
1818
|
return result;
|
|
1813
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
|
+
}
|
|
1814
1827
|
async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
1815
1828
|
let { result, type } = dataStrategyResult;
|
|
1816
1829
|
if (isResponse(result)) {
|
|
1817
1830
|
let data2;
|
|
1818
1831
|
try {
|
|
1819
|
-
|
|
1820
|
-
if (contentType && /\bapplication\/json\b/.test(contentType)) {
|
|
1821
|
-
if (result.body == null) {
|
|
1822
|
-
data2 = null;
|
|
1823
|
-
} else {
|
|
1824
|
-
data2 = await result.json();
|
|
1825
|
-
}
|
|
1826
|
-
} else {
|
|
1827
|
-
data2 = await result.text();
|
|
1828
|
-
}
|
|
1832
|
+
data2 = await parseResponseBody(result);
|
|
1829
1833
|
} catch (e) {
|
|
1830
1834
|
return { type: "error" /* error */, error: e };
|
|
1831
1835
|
}
|
|
@@ -2025,10 +2029,7 @@ function getInternalRouterError(status, {
|
|
|
2025
2029
|
);
|
|
2026
2030
|
}
|
|
2027
2031
|
function dataWithResponseInitToResponse(data2) {
|
|
2028
|
-
return
|
|
2029
|
-
typeof data2.data === "string" ? data2.data : JSON.stringify(data2.data),
|
|
2030
|
-
data2.init || void 0
|
|
2031
|
-
);
|
|
2032
|
+
return Response.json(data2.data, data2.init ?? void 0);
|
|
2032
2033
|
}
|
|
2033
2034
|
function dataWithResponseInitToErrorResponse(data2) {
|
|
2034
2035
|
return new ErrorResponseImpl(
|
|
@@ -2037,15 +2038,6 @@ function dataWithResponseInitToErrorResponse(data2) {
|
|
|
2037
2038
|
data2.data
|
|
2038
2039
|
);
|
|
2039
2040
|
}
|
|
2040
|
-
function errorResponseToResponse(error) {
|
|
2041
|
-
return new Response(
|
|
2042
|
-
typeof error.data === "string" ? error.data : JSON.stringify(error.data),
|
|
2043
|
-
{
|
|
2044
|
-
status: error.status,
|
|
2045
|
-
statusText: error.statusText
|
|
2046
|
-
}
|
|
2047
|
-
);
|
|
2048
|
-
}
|
|
2049
2041
|
function isDataStrategyResult(result) {
|
|
2050
2042
|
return result != null && typeof result === "object" && "type" in result && "result" in result && (result.type === "data" /* data */ || result.type === "error" /* error */);
|
|
2051
2043
|
}
|
|
@@ -6,7 +6,7 @@ export { Await, BrowserRouter, Form, HashRouter, Link, Links, MemoryRouter, Meta
|
|
|
6
6
|
import { serialize, parse } from 'cookie';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* react-router v7.8.1
|
|
9
|
+
* react-router v7.8.1
|
|
10
10
|
*
|
|
11
11
|
* Copyright (c) Remix Software Inc.
|
|
12
12
|
*
|
|
@@ -761,9 +761,23 @@ function createStaticHandler(routes, opts) {
|
|
|
761
761
|
return res;
|
|
762
762
|
},
|
|
763
763
|
async (error, routeId) => {
|
|
764
|
-
if (
|
|
764
|
+
if (isRedirectResponse(error)) {
|
|
765
765
|
return error;
|
|
766
766
|
}
|
|
767
|
+
if (isResponse(error)) {
|
|
768
|
+
try {
|
|
769
|
+
error = new ErrorResponseImpl(
|
|
770
|
+
error.status,
|
|
771
|
+
error.statusText,
|
|
772
|
+
await parseResponseBody(error)
|
|
773
|
+
);
|
|
774
|
+
} catch (e) {
|
|
775
|
+
error = e;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
if (isDataWithResponseInit(error)) {
|
|
779
|
+
error = dataWithResponseInitToErrorResponse(error);
|
|
780
|
+
}
|
|
767
781
|
if (renderedStaticContext) {
|
|
768
782
|
if (routeId in renderedStaticContext.loaderData) {
|
|
769
783
|
renderedStaticContext.loaderData[routeId] = void 0;
|
|
@@ -889,8 +903,8 @@ function createStaticHandler(routes, opts) {
|
|
|
889
903
|
return res;
|
|
890
904
|
},
|
|
891
905
|
(error) => {
|
|
892
|
-
if (
|
|
893
|
-
return Promise.resolve(
|
|
906
|
+
if (isDataWithResponseInit(error)) {
|
|
907
|
+
return Promise.resolve(dataWithResponseInitToResponse(error));
|
|
894
908
|
}
|
|
895
909
|
if (isResponse(error)) {
|
|
896
910
|
return Promise.resolve(error);
|
|
@@ -1531,11 +1545,7 @@ async function callServerRouteMiddleware(args, middlewares, handler, errorHandle
|
|
|
1531
1545
|
nextResult = result;
|
|
1532
1546
|
return nextResult;
|
|
1533
1547
|
} catch (e) {
|
|
1534
|
-
nextResult = await errorHandler(
|
|
1535
|
-
// Convert thrown data() values to ErrorResponses
|
|
1536
|
-
isDataWithResponseInit(e) ? dataWithResponseInitToErrorResponse(e) : e,
|
|
1537
|
-
routeId
|
|
1538
|
-
);
|
|
1548
|
+
nextResult = await errorHandler(e, routeId);
|
|
1539
1549
|
return nextResult;
|
|
1540
1550
|
}
|
|
1541
1551
|
};
|
|
@@ -1560,11 +1570,7 @@ async function callServerRouteMiddleware(args, middlewares, handler, errorHandle
|
|
|
1560
1570
|
return nextResult;
|
|
1561
1571
|
}
|
|
1562
1572
|
} catch (e) {
|
|
1563
|
-
let response = await errorHandler(
|
|
1564
|
-
// Convert thrown data() values to ErrorResponses
|
|
1565
|
-
isDataWithResponseInit(e) ? dataWithResponseInitToErrorResponse(e) : e,
|
|
1566
|
-
routeId
|
|
1567
|
-
);
|
|
1573
|
+
let response = await errorHandler(e, routeId);
|
|
1568
1574
|
return response;
|
|
1569
1575
|
}
|
|
1570
1576
|
}
|
|
@@ -1790,21 +1796,19 @@ async function callLoaderOrAction({
|
|
|
1790
1796
|
}
|
|
1791
1797
|
return result;
|
|
1792
1798
|
}
|
|
1799
|
+
async function parseResponseBody(response) {
|
|
1800
|
+
let contentType = response.headers.get("Content-Type");
|
|
1801
|
+
if (contentType && /\bapplication\/json\b/.test(contentType)) {
|
|
1802
|
+
return response.body == null ? null : response.json();
|
|
1803
|
+
}
|
|
1804
|
+
return response.text();
|
|
1805
|
+
}
|
|
1793
1806
|
async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
1794
1807
|
let { result, type } = dataStrategyResult;
|
|
1795
1808
|
if (isResponse(result)) {
|
|
1796
1809
|
let data2;
|
|
1797
1810
|
try {
|
|
1798
|
-
|
|
1799
|
-
if (contentType && /\bapplication\/json\b/.test(contentType)) {
|
|
1800
|
-
if (result.body == null) {
|
|
1801
|
-
data2 = null;
|
|
1802
|
-
} else {
|
|
1803
|
-
data2 = await result.json();
|
|
1804
|
-
}
|
|
1805
|
-
} else {
|
|
1806
|
-
data2 = await result.text();
|
|
1807
|
-
}
|
|
1811
|
+
data2 = await parseResponseBody(result);
|
|
1808
1812
|
} catch (e) {
|
|
1809
1813
|
return { type: "error" /* error */, error: e };
|
|
1810
1814
|
}
|
|
@@ -2004,10 +2008,7 @@ function getInternalRouterError(status, {
|
|
|
2004
2008
|
);
|
|
2005
2009
|
}
|
|
2006
2010
|
function dataWithResponseInitToResponse(data2) {
|
|
2007
|
-
return
|
|
2008
|
-
typeof data2.data === "string" ? data2.data : JSON.stringify(data2.data),
|
|
2009
|
-
data2.init || void 0
|
|
2010
|
-
);
|
|
2011
|
+
return Response.json(data2.data, data2.init ?? void 0);
|
|
2011
2012
|
}
|
|
2012
2013
|
function dataWithResponseInitToErrorResponse(data2) {
|
|
2013
2014
|
return new ErrorResponseImpl(
|
|
@@ -2016,15 +2017,6 @@ function dataWithResponseInitToErrorResponse(data2) {
|
|
|
2016
2017
|
data2.data
|
|
2017
2018
|
);
|
|
2018
2019
|
}
|
|
2019
|
-
function errorResponseToResponse(error) {
|
|
2020
|
-
return new Response(
|
|
2021
|
-
typeof error.data === "string" ? error.data : JSON.stringify(error.data),
|
|
2022
|
-
{
|
|
2023
|
-
status: error.status,
|
|
2024
|
-
statusText: error.statusText
|
|
2025
|
-
}
|
|
2026
|
-
);
|
|
2027
|
-
}
|
|
2028
2020
|
function isDataStrategyResult(result) {
|
|
2029
2021
|
return result != null && typeof result === "object" && "type" in result && "result" in result && (result.type === "data" /* data */ || result.type === "error" /* error */);
|
|
2030
2022
|
}
|