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 _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
|
|
2
|
-
* react-router v7.8.1
|
|
2
|
+
* react-router v7.8.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -2823,9 +2823,23 @@ function createStaticHandler(routes, opts) {
|
|
|
2823
2823
|
return res;
|
|
2824
2824
|
},
|
|
2825
2825
|
async (error, routeId) => {
|
|
2826
|
-
if (
|
|
2826
|
+
if (isRedirectResponse(error)) {
|
|
2827
2827
|
return error;
|
|
2828
2828
|
}
|
|
2829
|
+
if (isResponse(error)) {
|
|
2830
|
+
try {
|
|
2831
|
+
error = new ErrorResponseImpl(
|
|
2832
|
+
error.status,
|
|
2833
|
+
error.statusText,
|
|
2834
|
+
await parseResponseBody(error)
|
|
2835
|
+
);
|
|
2836
|
+
} catch (e) {
|
|
2837
|
+
error = e;
|
|
2838
|
+
}
|
|
2839
|
+
}
|
|
2840
|
+
if (isDataWithResponseInit(error)) {
|
|
2841
|
+
error = dataWithResponseInitToErrorResponse(error);
|
|
2842
|
+
}
|
|
2829
2843
|
if (renderedStaticContext) {
|
|
2830
2844
|
if (routeId in renderedStaticContext.loaderData) {
|
|
2831
2845
|
renderedStaticContext.loaderData[routeId] = void 0;
|
|
@@ -2951,8 +2965,8 @@ function createStaticHandler(routes, opts) {
|
|
|
2951
2965
|
return res;
|
|
2952
2966
|
},
|
|
2953
2967
|
(error) => {
|
|
2954
|
-
if (
|
|
2955
|
-
return Promise.resolve(
|
|
2968
|
+
if (isDataWithResponseInit(error)) {
|
|
2969
|
+
return Promise.resolve(dataWithResponseInitToResponse(error));
|
|
2956
2970
|
}
|
|
2957
2971
|
if (isResponse(error)) {
|
|
2958
2972
|
return Promise.resolve(error);
|
|
@@ -4022,11 +4036,7 @@ async function callServerRouteMiddleware(args, middlewares, handler, errorHandle
|
|
|
4022
4036
|
nextResult = result;
|
|
4023
4037
|
return nextResult;
|
|
4024
4038
|
} catch (e) {
|
|
4025
|
-
nextResult = await errorHandler(
|
|
4026
|
-
// Convert thrown data() values to ErrorResponses
|
|
4027
|
-
isDataWithResponseInit(e) ? dataWithResponseInitToErrorResponse(e) : e,
|
|
4028
|
-
routeId
|
|
4029
|
-
);
|
|
4039
|
+
nextResult = await errorHandler(e, routeId);
|
|
4030
4040
|
return nextResult;
|
|
4031
4041
|
}
|
|
4032
4042
|
};
|
|
@@ -4051,11 +4061,7 @@ async function callServerRouteMiddleware(args, middlewares, handler, errorHandle
|
|
|
4051
4061
|
return nextResult;
|
|
4052
4062
|
}
|
|
4053
4063
|
} catch (e) {
|
|
4054
|
-
let response = await errorHandler(
|
|
4055
|
-
// Convert thrown data() values to ErrorResponses
|
|
4056
|
-
isDataWithResponseInit(e) ? dataWithResponseInitToErrorResponse(e) : e,
|
|
4057
|
-
routeId
|
|
4058
|
-
);
|
|
4064
|
+
let response = await errorHandler(e, routeId);
|
|
4059
4065
|
return response;
|
|
4060
4066
|
}
|
|
4061
4067
|
}
|
|
@@ -4381,21 +4387,19 @@ async function callLoaderOrAction({
|
|
|
4381
4387
|
}
|
|
4382
4388
|
return result;
|
|
4383
4389
|
}
|
|
4390
|
+
async function parseResponseBody(response) {
|
|
4391
|
+
let contentType = response.headers.get("Content-Type");
|
|
4392
|
+
if (contentType && /\bapplication\/json\b/.test(contentType)) {
|
|
4393
|
+
return response.body == null ? null : response.json();
|
|
4394
|
+
}
|
|
4395
|
+
return response.text();
|
|
4396
|
+
}
|
|
4384
4397
|
async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
4385
4398
|
let { result, type } = dataStrategyResult;
|
|
4386
4399
|
if (isResponse(result)) {
|
|
4387
4400
|
let data2;
|
|
4388
4401
|
try {
|
|
4389
|
-
|
|
4390
|
-
if (contentType && /\bapplication\/json\b/.test(contentType)) {
|
|
4391
|
-
if (result.body == null) {
|
|
4392
|
-
data2 = null;
|
|
4393
|
-
} else {
|
|
4394
|
-
data2 = await result.json();
|
|
4395
|
-
}
|
|
4396
|
-
} else {
|
|
4397
|
-
data2 = await result.text();
|
|
4398
|
-
}
|
|
4402
|
+
data2 = await parseResponseBody(result);
|
|
4399
4403
|
} catch (e) {
|
|
4400
4404
|
return { type: "error" /* error */, error: e };
|
|
4401
4405
|
}
|
|
@@ -4725,10 +4729,7 @@ function isHashChangeOnly(a, b) {
|
|
|
4725
4729
|
return false;
|
|
4726
4730
|
}
|
|
4727
4731
|
function dataWithResponseInitToResponse(data2) {
|
|
4728
|
-
return
|
|
4729
|
-
typeof data2.data === "string" ? data2.data : JSON.stringify(data2.data),
|
|
4730
|
-
data2.init || void 0
|
|
4731
|
-
);
|
|
4732
|
+
return Response.json(data2.data, _nullishCoalesce(data2.init, () => ( void 0)));
|
|
4732
4733
|
}
|
|
4733
4734
|
function dataWithResponseInitToErrorResponse(data2) {
|
|
4734
4735
|
return new ErrorResponseImpl(
|
|
@@ -4737,15 +4738,6 @@ function dataWithResponseInitToErrorResponse(data2) {
|
|
|
4737
4738
|
data2.data
|
|
4738
4739
|
);
|
|
4739
4740
|
}
|
|
4740
|
-
function errorResponseToResponse(error) {
|
|
4741
|
-
return new Response(
|
|
4742
|
-
typeof error.data === "string" ? error.data : JSON.stringify(error.data),
|
|
4743
|
-
{
|
|
4744
|
-
status: error.status,
|
|
4745
|
-
statusText: error.statusText
|
|
4746
|
-
}
|
|
4747
|
-
);
|
|
4748
|
-
}
|
|
4749
4741
|
function isDataStrategyResult(result) {
|
|
4750
4742
|
return result != null && typeof result === "object" && "type" in result && "result" in result && (result.type === "data" /* data */ || result.type === "error" /* error */);
|
|
4751
4743
|
}
|
|
@@ -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
|
*
|
|
@@ -2823,9 +2823,23 @@ function createStaticHandler(routes, opts) {
|
|
|
2823
2823
|
return res;
|
|
2824
2824
|
},
|
|
2825
2825
|
async (error, routeId) => {
|
|
2826
|
-
if (
|
|
2826
|
+
if (isRedirectResponse(error)) {
|
|
2827
2827
|
return error;
|
|
2828
2828
|
}
|
|
2829
|
+
if (isResponse(error)) {
|
|
2830
|
+
try {
|
|
2831
|
+
error = new ErrorResponseImpl(
|
|
2832
|
+
error.status,
|
|
2833
|
+
error.statusText,
|
|
2834
|
+
await parseResponseBody(error)
|
|
2835
|
+
);
|
|
2836
|
+
} catch (e) {
|
|
2837
|
+
error = e;
|
|
2838
|
+
}
|
|
2839
|
+
}
|
|
2840
|
+
if (isDataWithResponseInit(error)) {
|
|
2841
|
+
error = dataWithResponseInitToErrorResponse(error);
|
|
2842
|
+
}
|
|
2829
2843
|
if (renderedStaticContext) {
|
|
2830
2844
|
if (routeId in renderedStaticContext.loaderData) {
|
|
2831
2845
|
renderedStaticContext.loaderData[routeId] = void 0;
|
|
@@ -2951,8 +2965,8 @@ function createStaticHandler(routes, opts) {
|
|
|
2951
2965
|
return res;
|
|
2952
2966
|
},
|
|
2953
2967
|
(error) => {
|
|
2954
|
-
if (
|
|
2955
|
-
return Promise.resolve(
|
|
2968
|
+
if (isDataWithResponseInit(error)) {
|
|
2969
|
+
return Promise.resolve(dataWithResponseInitToResponse(error));
|
|
2956
2970
|
}
|
|
2957
2971
|
if (isResponse(error)) {
|
|
2958
2972
|
return Promise.resolve(error);
|
|
@@ -4022,11 +4036,7 @@ async function callServerRouteMiddleware(args, middlewares, handler, errorHandle
|
|
|
4022
4036
|
nextResult = result;
|
|
4023
4037
|
return nextResult;
|
|
4024
4038
|
} catch (e) {
|
|
4025
|
-
nextResult = await errorHandler(
|
|
4026
|
-
// Convert thrown data() values to ErrorResponses
|
|
4027
|
-
isDataWithResponseInit(e) ? dataWithResponseInitToErrorResponse(e) : e,
|
|
4028
|
-
routeId
|
|
4029
|
-
);
|
|
4039
|
+
nextResult = await errorHandler(e, routeId);
|
|
4030
4040
|
return nextResult;
|
|
4031
4041
|
}
|
|
4032
4042
|
};
|
|
@@ -4051,11 +4061,7 @@ async function callServerRouteMiddleware(args, middlewares, handler, errorHandle
|
|
|
4051
4061
|
return nextResult;
|
|
4052
4062
|
}
|
|
4053
4063
|
} catch (e) {
|
|
4054
|
-
let response = await errorHandler(
|
|
4055
|
-
// Convert thrown data() values to ErrorResponses
|
|
4056
|
-
isDataWithResponseInit(e) ? dataWithResponseInitToErrorResponse(e) : e,
|
|
4057
|
-
routeId
|
|
4058
|
-
);
|
|
4064
|
+
let response = await errorHandler(e, routeId);
|
|
4059
4065
|
return response;
|
|
4060
4066
|
}
|
|
4061
4067
|
}
|
|
@@ -4381,21 +4387,19 @@ async function callLoaderOrAction({
|
|
|
4381
4387
|
}
|
|
4382
4388
|
return result;
|
|
4383
4389
|
}
|
|
4390
|
+
async function parseResponseBody(response) {
|
|
4391
|
+
let contentType = response.headers.get("Content-Type");
|
|
4392
|
+
if (contentType && /\bapplication\/json\b/.test(contentType)) {
|
|
4393
|
+
return response.body == null ? null : response.json();
|
|
4394
|
+
}
|
|
4395
|
+
return response.text();
|
|
4396
|
+
}
|
|
4384
4397
|
async function convertDataStrategyResultToDataResult(dataStrategyResult) {
|
|
4385
4398
|
let { result, type } = dataStrategyResult;
|
|
4386
4399
|
if (isResponse(result)) {
|
|
4387
4400
|
let data2;
|
|
4388
4401
|
try {
|
|
4389
|
-
|
|
4390
|
-
if (contentType && /\bapplication\/json\b/.test(contentType)) {
|
|
4391
|
-
if (result.body == null) {
|
|
4392
|
-
data2 = null;
|
|
4393
|
-
} else {
|
|
4394
|
-
data2 = await result.json();
|
|
4395
|
-
}
|
|
4396
|
-
} else {
|
|
4397
|
-
data2 = await result.text();
|
|
4398
|
-
}
|
|
4402
|
+
data2 = await parseResponseBody(result);
|
|
4399
4403
|
} catch (e) {
|
|
4400
4404
|
return { type: "error" /* error */, error: e };
|
|
4401
4405
|
}
|
|
@@ -4725,10 +4729,7 @@ function isHashChangeOnly(a, b) {
|
|
|
4725
4729
|
return false;
|
|
4726
4730
|
}
|
|
4727
4731
|
function dataWithResponseInitToResponse(data2) {
|
|
4728
|
-
return
|
|
4729
|
-
typeof data2.data === "string" ? data2.data : JSON.stringify(data2.data),
|
|
4730
|
-
data2.init || void 0
|
|
4731
|
-
);
|
|
4732
|
+
return Response.json(data2.data, data2.init ?? void 0);
|
|
4732
4733
|
}
|
|
4733
4734
|
function dataWithResponseInitToErrorResponse(data2) {
|
|
4734
4735
|
return new ErrorResponseImpl(
|
|
@@ -4737,15 +4738,6 @@ function dataWithResponseInitToErrorResponse(data2) {
|
|
|
4737
4738
|
data2.data
|
|
4738
4739
|
);
|
|
4739
4740
|
}
|
|
4740
|
-
function errorResponseToResponse(error) {
|
|
4741
|
-
return new Response(
|
|
4742
|
-
typeof error.data === "string" ? error.data : JSON.stringify(error.data),
|
|
4743
|
-
{
|
|
4744
|
-
status: error.status,
|
|
4745
|
-
statusText: error.statusText
|
|
4746
|
-
}
|
|
4747
|
-
);
|
|
4748
|
-
}
|
|
4749
4741
|
function isDataStrategyResult(result) {
|
|
4750
4742
|
return result != null && typeof result === "object" && "type" in result && "result" in result && (result.type === "data" /* data */ || result.type === "error" /* error */);
|
|
4751
4743
|
}
|
|
@@ -8994,7 +8986,7 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
|
|
|
8994
8986
|
try {
|
|
8995
8987
|
if (isBrowser) {
|
|
8996
8988
|
window.__reactRouterVersion = // @ts-expect-error
|
|
8997
|
-
"7.8.1
|
|
8989
|
+
"7.8.1";
|
|
8998
8990
|
}
|
|
8999
8991
|
} catch (e) {
|
|
9000
8992
|
}
|
|
@@ -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 _chunkTGXCWGPTjs = require('./chunk-TGXCWGPT.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(`[${_chunkTGXCWGPTjs.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-IFMMFE4R.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-UH6JLGW7.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 _chunkIIA3TUI2js = require('./chunk-IIA3TUI2.js');
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
var
|
|
37
|
+
var _chunkTGXCWGPTjs = require('./chunk-TGXCWGPT.js');
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
@@ -58,4 +58,4 @@ var _chunkCXAO7FY7js = require('./chunk-CXAO7FY7.js');
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
|
|
61
|
-
exports.Await =
|
|
61
|
+
exports.Await = _chunkIIA3TUI2js.Await; exports.BrowserRouter = _chunkIIA3TUI2js.BrowserRouter; exports.Form = _chunkIIA3TUI2js.Form; exports.HashRouter = _chunkIIA3TUI2js.HashRouter; exports.Link = _chunkIIA3TUI2js.Link; exports.Links = _chunkTGXCWGPTjs.Links; exports.MemoryRouter = _chunkIIA3TUI2js.MemoryRouter; exports.Meta = _chunkTGXCWGPTjs.Meta; exports.NavLink = _chunkIIA3TUI2js.NavLink; exports.Navigate = _chunkIIA3TUI2js.Navigate; exports.Outlet = _chunkIIA3TUI2js.Outlet; exports.Route = _chunkIIA3TUI2js.Route; exports.Router = _chunkIIA3TUI2js.Router; exports.RouterProvider = _chunkIIA3TUI2js.RouterProvider; exports.Routes = _chunkIIA3TUI2js.Routes; exports.ScrollRestoration = _chunkIIA3TUI2js.ScrollRestoration; exports.StaticRouter = _chunkIIA3TUI2js.StaticRouter; exports.StaticRouterProvider = _chunkIIA3TUI2js.StaticRouterProvider; exports.UNSAFE_WithComponentProps = _chunkIIA3TUI2js.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkIIA3TUI2js.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkIIA3TUI2js.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkIIA3TUI2js.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-UH6JLGW7.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
|
}
|