react-router 7.10.1 → 7.11.0-pre.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -11
- package/dist/development/{browser-BpxEZgZC.d.ts → browser-Cv4JZyZ5.d.mts} +4 -3
- package/dist/{production/browser-BpxEZgZC.d.ts → development/browser-o-qhcuhA.d.ts} +4 -3
- package/dist/{production/chunk-B3F6YMOF.js → development/chunk-JKMHOZYW.js} +111 -121
- package/dist/development/{chunk-WWGJGFF6.mjs → chunk-KRMLYMWA.mjs} +231 -74
- package/dist/{production/chunk-YO5R3LGQ.js → development/chunk-OVG6YSZ5.js} +7 -7
- package/dist/development/{chunk-PMGK554W.mjs → chunk-QMKP6CC3.mjs} +147 -38
- package/dist/development/{chunk-RBZI3ZHD.js → chunk-UO7KGW2U.js} +279 -110
- package/dist/development/dom-export.d.mts +11 -10
- package/dist/development/dom-export.d.ts +12 -11
- package/dist/development/dom-export.js +30 -31
- package/dist/development/dom-export.mjs +6 -7
- package/dist/{production/index-react-server-client-CCjKYJTH.d.ts → development/index-react-server-client-Cv5Q9lf0.d.ts} +60 -14
- package/dist/development/{index-react-server-client-CipGfVBI.d.mts → index-react-server-client-P7VgYu6T.d.mts} +60 -14
- 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 +4 -2
- package/dist/development/index-react-server.d.ts +4 -2
- package/dist/development/index-react-server.js +72 -19
- package/dist/development/index-react-server.mjs +72 -19
- package/dist/development/index.d.mts +17 -16
- package/dist/development/index.d.ts +17 -16
- package/dist/development/index.js +220 -111
- package/dist/development/index.mjs +3 -3
- package/dist/{production/instrumentation-BB0wRuqz.d.ts → development/instrumentation-BlrVzjbg.d.ts} +30 -15
- package/dist/development/lib/types/internal.d.mts +2 -2
- package/dist/development/lib/types/internal.d.ts +2 -2
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{register-ODDAAYlf.d.ts → register-BGQUMCK4.d.ts} +1 -1
- package/dist/development/{register-C1RwVJAt.d.mts → register-DTJJbt1o.d.mts} +1 -1
- package/dist/development/{router-CwNp5l9u.d.mts → router-5fbeEIMQ.d.mts} +30 -15
- package/dist/{development/browser-C5z6FZmz.d.mts → production/browser-Cv4JZyZ5.d.mts} +4 -3
- package/dist/production/{browser-C5z6FZmz.d.mts → browser-o-qhcuhA.d.ts} +4 -3
- package/dist/production/{chunk-UQPBOMFP.js → chunk-AO22ZXHI.js} +279 -110
- package/dist/production/{chunk-ANIOYBQK.mjs → chunk-IDHO4Q57.mjs} +231 -74
- package/dist/production/{chunk-TDCOAFPJ.mjs → chunk-J4JITZ76.mjs} +147 -38
- package/dist/{development/chunk-HMTWJNYB.js → production/chunk-M5W3Q3T5.js} +111 -121
- package/dist/{development/chunk-FKYGG5Z2.js → production/chunk-YGB3JEIP.js} +7 -7
- package/dist/production/dom-export.d.mts +11 -10
- package/dist/production/dom-export.d.ts +12 -11
- package/dist/production/dom-export.js +30 -31
- package/dist/production/dom-export.mjs +6 -7
- package/dist/{development/index-react-server-client-CCjKYJTH.d.ts → production/index-react-server-client-Cv5Q9lf0.d.ts} +60 -14
- package/dist/production/{index-react-server-client-CipGfVBI.d.mts → index-react-server-client-P7VgYu6T.d.mts} +60 -14
- 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 +4 -2
- package/dist/production/index-react-server.d.ts +4 -2
- package/dist/production/index-react-server.js +72 -19
- package/dist/production/index-react-server.mjs +72 -19
- package/dist/production/index.d.mts +17 -16
- package/dist/production/index.d.ts +17 -16
- package/dist/production/index.js +220 -111
- package/dist/production/index.mjs +3 -3
- package/dist/{development/instrumentation-BB0wRuqz.d.ts → production/instrumentation-BlrVzjbg.d.ts} +30 -15
- package/dist/production/lib/types/internal.d.mts +2 -2
- package/dist/production/lib/types/internal.d.ts +2 -2
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/{register-ODDAAYlf.d.ts → register-BGQUMCK4.d.ts} +1 -1
- package/dist/production/{register-C1RwVJAt.d.mts → register-DTJJbt1o.d.mts} +1 -1
- package/dist/production/{router-CwNp5l9u.d.mts → router-5fbeEIMQ.d.mts} +30 -15
- package/package.json +5 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }/**
|
|
2
|
-
* react-router v7.
|
|
2
|
+
* react-router v7.11.0-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkUO7KGW2Ujs = require('./chunk-UO7KGW2U.js');
|
|
18
18
|
|
|
19
19
|
// lib/dom/ssr/hydration.tsx
|
|
20
20
|
function getHydrationData({
|
|
@@ -29,12 +29,12 @@ function getHydrationData({
|
|
|
29
29
|
...state,
|
|
30
30
|
loaderData: { ...state.loaderData }
|
|
31
31
|
};
|
|
32
|
-
let initialMatches =
|
|
32
|
+
let initialMatches = _chunkUO7KGW2Ujs.matchRoutes.call(void 0, routes, location, basename);
|
|
33
33
|
if (initialMatches) {
|
|
34
34
|
for (let match of initialMatches) {
|
|
35
35
|
let routeId = match.route.id;
|
|
36
36
|
let routeInfo = getRouteInfo(routeId);
|
|
37
|
-
if (
|
|
37
|
+
if (_chunkUO7KGW2Ujs.shouldHydrateRouteLoader.call(void 0,
|
|
38
38
|
routeId,
|
|
39
39
|
routeInfo.clientLoader,
|
|
40
40
|
routeInfo.hasLoader,
|
|
@@ -112,7 +112,7 @@ function RSCDefaultRootErrorBoundaryImpl({
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
);
|
|
115
|
-
if (
|
|
115
|
+
if (_chunkUO7KGW2Ujs.isRouteErrorResponse.call(void 0, error)) {
|
|
116
116
|
return /* @__PURE__ */ _react2.default.createElement(
|
|
117
117
|
ErrorWrapper,
|
|
118
118
|
{
|
|
@@ -120,7 +120,7 @@ function RSCDefaultRootErrorBoundaryImpl({
|
|
|
120
120
|
title: "Unhandled Thrown Response!"
|
|
121
121
|
},
|
|
122
122
|
/* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText),
|
|
123
|
-
|
|
123
|
+
_chunkUO7KGW2Ujs.ENABLE_DEV_WARNINGS ? heyDeveloper : null
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
126
|
let errorInstance;
|
|
@@ -146,7 +146,7 @@ function RSCDefaultRootErrorBoundaryImpl({
|
|
|
146
146
|
function RSCDefaultRootErrorBoundary({
|
|
147
147
|
hasRootLayout
|
|
148
148
|
}) {
|
|
149
|
-
let error =
|
|
149
|
+
let error = _chunkUO7KGW2Ujs.useRouteError.call(void 0, );
|
|
150
150
|
if (hasRootLayout === void 0) {
|
|
151
151
|
throw new Error("Missing 'hasRootLayout' prop");
|
|
152
152
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.
|
|
2
|
+
* react-router v7.11.0-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -27,6 +27,8 @@ import {
|
|
|
27
27
|
createServerRoutes,
|
|
28
28
|
createStaticHandler,
|
|
29
29
|
createStaticRouter,
|
|
30
|
+
decodeRedirectErrorDigest,
|
|
31
|
+
decodeRouteErrorResponseDigest,
|
|
30
32
|
decodeViaTurboStream,
|
|
31
33
|
encode,
|
|
32
34
|
escapeHtml,
|
|
@@ -49,7 +51,7 @@ import {
|
|
|
49
51
|
withComponentProps,
|
|
50
52
|
withErrorBoundaryProps,
|
|
51
53
|
withHydrateFallbackProps
|
|
52
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-KRMLYMWA.mjs";
|
|
53
55
|
|
|
54
56
|
// lib/dom/ssr/server.tsx
|
|
55
57
|
import * as React from "react";
|
|
@@ -1920,7 +1922,7 @@ function useSafe(promise) {
|
|
|
1920
1922
|
}
|
|
1921
1923
|
async function routeRSCServerRequest({
|
|
1922
1924
|
request,
|
|
1923
|
-
|
|
1925
|
+
serverResponse,
|
|
1924
1926
|
createFromReadableStream,
|
|
1925
1927
|
renderHTML,
|
|
1926
1928
|
hydrate = true
|
|
@@ -1928,7 +1930,6 @@ async function routeRSCServerRequest({
|
|
|
1928
1930
|
const url = new URL(request.url);
|
|
1929
1931
|
const isDataRequest = isReactServerRequest(url);
|
|
1930
1932
|
const respondWithRSCPayload = isDataRequest || isManifestRequest(url) || request.headers.has("rsc-action-id");
|
|
1931
|
-
const serverResponse = await fetchServer(request);
|
|
1932
1933
|
if (respondWithRSCPayload || serverResponse.headers.get("React-Router-Resource") === "true") {
|
|
1933
1934
|
return serverResponse;
|
|
1934
1935
|
}
|
|
@@ -1990,6 +1991,8 @@ async function routeRSCServerRequest({
|
|
|
1990
1991
|
}
|
|
1991
1992
|
});
|
|
1992
1993
|
};
|
|
1994
|
+
let renderRedirect;
|
|
1995
|
+
let renderError;
|
|
1993
1996
|
try {
|
|
1994
1997
|
if (!detectRedirectResponse.body) {
|
|
1995
1998
|
throw new Error("Failed to clone server response");
|
|
@@ -2010,73 +2013,179 @@ async function routeRSCServerRequest({
|
|
|
2010
2013
|
statusText: serverResponse.statusText
|
|
2011
2014
|
});
|
|
2012
2015
|
}
|
|
2013
|
-
|
|
2014
|
-
|
|
2016
|
+
let reactHeaders = new Headers();
|
|
2017
|
+
let status = serverResponse.status;
|
|
2018
|
+
let statusText = serverResponse.statusText;
|
|
2019
|
+
let html = await renderHTML(getPayload, {
|
|
2020
|
+
onError(error) {
|
|
2021
|
+
if (typeof error === "object" && error && "digest" in error && typeof error.digest === "string") {
|
|
2022
|
+
renderRedirect = decodeRedirectErrorDigest(error.digest);
|
|
2023
|
+
if (renderRedirect) {
|
|
2024
|
+
return error.digest;
|
|
2025
|
+
}
|
|
2026
|
+
let routeErrorResponse = decodeRouteErrorResponseDigest(error.digest);
|
|
2027
|
+
if (routeErrorResponse) {
|
|
2028
|
+
renderError = routeErrorResponse;
|
|
2029
|
+
status = routeErrorResponse.status;
|
|
2030
|
+
statusText = routeErrorResponse.statusText;
|
|
2031
|
+
return error.digest;
|
|
2032
|
+
}
|
|
2033
|
+
}
|
|
2034
|
+
},
|
|
2035
|
+
onHeaders(headers2) {
|
|
2036
|
+
for (const [key, value] of headers2) {
|
|
2037
|
+
reactHeaders.append(key, value);
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
});
|
|
2041
|
+
const headers = new Headers(reactHeaders);
|
|
2042
|
+
for (const [key, value] of serverResponse.headers) {
|
|
2043
|
+
headers.append(key, value);
|
|
2044
|
+
}
|
|
2015
2045
|
headers.set("Content-Type", "text/html; charset=utf-8");
|
|
2016
|
-
if (
|
|
2046
|
+
if (renderRedirect) {
|
|
2047
|
+
headers.set("Location", renderRedirect.location);
|
|
2017
2048
|
return new Response(html, {
|
|
2018
|
-
status:
|
|
2049
|
+
status: renderRedirect.status,
|
|
2050
|
+
headers
|
|
2051
|
+
});
|
|
2052
|
+
}
|
|
2053
|
+
const redirectTransform = new TransformStream({
|
|
2054
|
+
flush(controller) {
|
|
2055
|
+
if (renderRedirect) {
|
|
2056
|
+
controller.enqueue(
|
|
2057
|
+
new TextEncoder().encode(
|
|
2058
|
+
`<meta http-equiv="refresh" content="0;url=${escapeHtml(renderRedirect.location)}"/>`
|
|
2059
|
+
)
|
|
2060
|
+
);
|
|
2061
|
+
}
|
|
2062
|
+
}
|
|
2063
|
+
});
|
|
2064
|
+
if (!hydrate) {
|
|
2065
|
+
return new Response(html.pipeThrough(redirectTransform), {
|
|
2066
|
+
status,
|
|
2067
|
+
statusText,
|
|
2019
2068
|
headers
|
|
2020
2069
|
});
|
|
2021
2070
|
}
|
|
2022
2071
|
if (!serverResponseB?.body) {
|
|
2023
2072
|
throw new Error("Failed to clone server response");
|
|
2024
2073
|
}
|
|
2025
|
-
const body2 = html.pipeThrough(injectRSCPayload(serverResponseB.body));
|
|
2074
|
+
const body2 = html.pipeThrough(injectRSCPayload(serverResponseB.body)).pipeThrough(redirectTransform);
|
|
2026
2075
|
return new Response(body2, {
|
|
2027
|
-
status
|
|
2076
|
+
status,
|
|
2077
|
+
statusText,
|
|
2028
2078
|
headers
|
|
2029
2079
|
});
|
|
2030
2080
|
} catch (reason) {
|
|
2031
2081
|
if (reason instanceof Response) {
|
|
2032
2082
|
return reason;
|
|
2033
2083
|
}
|
|
2084
|
+
if (renderRedirect) {
|
|
2085
|
+
return new Response(`Redirect: ${renderRedirect.location}`, {
|
|
2086
|
+
status: renderRedirect.status,
|
|
2087
|
+
headers: {
|
|
2088
|
+
Location: renderRedirect.location
|
|
2089
|
+
}
|
|
2090
|
+
});
|
|
2091
|
+
}
|
|
2034
2092
|
try {
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2093
|
+
reason = renderError ?? reason;
|
|
2094
|
+
let [status, statusText] = isRouteErrorResponse(reason) ? [reason.status, reason.statusText] : [500, ""];
|
|
2095
|
+
let retryRedirect;
|
|
2096
|
+
let reactHeaders = new Headers();
|
|
2097
|
+
const html = await renderHTML(
|
|
2098
|
+
() => {
|
|
2099
|
+
const decoded = Promise.resolve(
|
|
2100
|
+
createFromReadableStream(createStream())
|
|
2101
|
+
);
|
|
2102
|
+
const payloadPromise = decoded.then(
|
|
2103
|
+
(payload) => Object.assign(payload, {
|
|
2104
|
+
status,
|
|
2105
|
+
errors: deepestRenderedBoundaryId ? {
|
|
2106
|
+
[deepestRenderedBoundaryId]: reason
|
|
2107
|
+
} : {}
|
|
2108
|
+
})
|
|
2109
|
+
);
|
|
2110
|
+
return Object.defineProperties(payloadPromise, {
|
|
2111
|
+
_deepestRenderedBoundaryId: {
|
|
2112
|
+
get() {
|
|
2113
|
+
return deepestRenderedBoundaryId;
|
|
2114
|
+
},
|
|
2115
|
+
set(boundaryId) {
|
|
2116
|
+
deepestRenderedBoundaryId = boundaryId;
|
|
2117
|
+
}
|
|
2052
2118
|
},
|
|
2053
|
-
|
|
2054
|
-
|
|
2119
|
+
formState: {
|
|
2120
|
+
get() {
|
|
2121
|
+
return payloadPromise.then(
|
|
2122
|
+
(payload) => payload.type === "render" ? payload.formState : void 0
|
|
2123
|
+
);
|
|
2124
|
+
}
|
|
2055
2125
|
}
|
|
2056
|
-
}
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2126
|
+
});
|
|
2127
|
+
},
|
|
2128
|
+
{
|
|
2129
|
+
onError(error) {
|
|
2130
|
+
if (typeof error === "object" && error && "digest" in error && typeof error.digest === "string") {
|
|
2131
|
+
retryRedirect = decodeRedirectErrorDigest(error.digest);
|
|
2132
|
+
if (retryRedirect) {
|
|
2133
|
+
return error.digest;
|
|
2134
|
+
}
|
|
2135
|
+
let routeErrorResponse = decodeRouteErrorResponseDigest(
|
|
2136
|
+
error.digest
|
|
2061
2137
|
);
|
|
2138
|
+
if (routeErrorResponse) {
|
|
2139
|
+
status = routeErrorResponse.status;
|
|
2140
|
+
statusText = routeErrorResponse.statusText;
|
|
2141
|
+
return error.digest;
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
},
|
|
2145
|
+
onHeaders(headers2) {
|
|
2146
|
+
for (const [key, value] of headers2) {
|
|
2147
|
+
reactHeaders.append(key, value);
|
|
2062
2148
|
}
|
|
2063
2149
|
}
|
|
2150
|
+
}
|
|
2151
|
+
);
|
|
2152
|
+
const headers = new Headers(reactHeaders);
|
|
2153
|
+
for (const [key, value] of serverResponse.headers) {
|
|
2154
|
+
headers.append(key, value);
|
|
2155
|
+
}
|
|
2156
|
+
headers.set("Content-Type", "text/html; charset=utf-8");
|
|
2157
|
+
if (retryRedirect) {
|
|
2158
|
+
headers.set("Location", retryRedirect.location);
|
|
2159
|
+
return new Response(html, {
|
|
2160
|
+
status: retryRedirect.status,
|
|
2161
|
+
headers
|
|
2064
2162
|
});
|
|
2163
|
+
}
|
|
2164
|
+
const retryRedirectTransform = new TransformStream({
|
|
2165
|
+
flush(controller) {
|
|
2166
|
+
if (retryRedirect) {
|
|
2167
|
+
controller.enqueue(
|
|
2168
|
+
new TextEncoder().encode(
|
|
2169
|
+
`<meta http-equiv="refresh" content="0;url=${escapeHtml(retryRedirect.location)}"/>`
|
|
2170
|
+
)
|
|
2171
|
+
);
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2065
2174
|
});
|
|
2066
|
-
const headers = new Headers(serverResponse.headers);
|
|
2067
|
-
headers.set("Content-Type", "text/html");
|
|
2068
2175
|
if (!hydrate) {
|
|
2069
|
-
return new Response(html, {
|
|
2176
|
+
return new Response(html.pipeThrough(retryRedirectTransform), {
|
|
2070
2177
|
status,
|
|
2178
|
+
statusText,
|
|
2071
2179
|
headers
|
|
2072
2180
|
});
|
|
2073
2181
|
}
|
|
2074
2182
|
if (!serverResponseB?.body) {
|
|
2075
2183
|
throw new Error("Failed to clone server response");
|
|
2076
2184
|
}
|
|
2077
|
-
const body2 = html.pipeThrough(injectRSCPayload(serverResponseB.body));
|
|
2185
|
+
const body2 = html.pipeThrough(injectRSCPayload(serverResponseB.body)).pipeThrough(retryRedirectTransform);
|
|
2078
2186
|
return new Response(body2, {
|
|
2079
2187
|
status,
|
|
2188
|
+
statusText,
|
|
2080
2189
|
headers
|
|
2081
2190
|
});
|
|
2082
2191
|
} catch {
|