react-router 7.10.1 → 7.11.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 +35 -0
- 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-2JY4UAJA.js} +111 -121
- package/dist/{production/chunk-YO5R3LGQ.js → development/chunk-GNDLROV6.js} +7 -7
- package/dist/development/{chunk-WWGJGFF6.mjs → chunk-JMJ3UQ3L.mjs} +231 -74
- package/dist/development/{chunk-RBZI3ZHD.js → chunk-SZQUWNVJ.js} +279 -110
- package/dist/development/{chunk-PMGK554W.mjs → chunk-YNUBSHFH.mjs} +147 -38
- 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-2HFJAX7U.js} +279 -110
- package/dist/{development/chunk-FKYGG5Z2.js → production/chunk-BEXOWXJO.js} +7 -7
- package/dist/production/{chunk-TDCOAFPJ.mjs → chunk-E6GYEQUT.mjs} +147 -38
- package/dist/production/{chunk-ANIOYBQK.mjs → chunk-TINMVEA2.mjs} +231 -74
- package/dist/{development/chunk-HMTWJNYB.js → production/chunk-ZMYPVUNZ.js} +111 -121
- 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
|
/**
|
|
2
|
-
* react-router v7.
|
|
2
|
+
* react-router v7.11.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-JMJ3UQ3L.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 {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { f as RouterProviderProps$1, e as RouterInit, u as unstable_ClientInstrumentation, g as
|
|
3
|
-
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-
|
|
2
|
+
import { f as RouterProviderProps$1, e as RouterInit, u as unstable_ClientInstrumentation, g as ClientOnErrorFunction } from './router-5fbeEIMQ.mjs';
|
|
3
|
+
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-Cv4JZyZ5.mjs';
|
|
4
4
|
|
|
5
5
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
6
6
|
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
|
@@ -71,9 +71,9 @@ interface HydratedRouterProps {
|
|
|
71
71
|
*/
|
|
72
72
|
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
|
73
73
|
/**
|
|
74
|
-
* An error handler function that will be called for any loader
|
|
75
|
-
* errors that are encountered in your application. This is useful for
|
|
76
|
-
* logging or reporting errors instead of the
|
|
74
|
+
* An error handler function that will be called for any middleware, loader, action,
|
|
75
|
+
* or render errors that are encountered in your application. This is useful for
|
|
76
|
+
* logging or reporting errors instead of in the {@link ErrorBoundary} because it's not
|
|
77
77
|
* subject to re-rendering and will only run one time per error.
|
|
78
78
|
*
|
|
79
79
|
* The `errorInfo` parameter is passed along from
|
|
@@ -81,13 +81,14 @@ interface HydratedRouterProps {
|
|
|
81
81
|
* and is only present for render errors.
|
|
82
82
|
*
|
|
83
83
|
* ```tsx
|
|
84
|
-
* <HydratedRouter
|
|
85
|
-
*
|
|
86
|
-
*
|
|
84
|
+
* <HydratedRouter onError=(error, info) => {
|
|
85
|
+
* let { location, params, unstable_pattern, errorInfo } = info;
|
|
86
|
+
* console.error(error, location, errorInfo);
|
|
87
|
+
* reportToErrorService(error, location, errorInfo);
|
|
87
88
|
* }} />
|
|
88
89
|
* ```
|
|
89
90
|
*/
|
|
90
|
-
|
|
91
|
+
onError?: ClientOnErrorFunction;
|
|
91
92
|
/**
|
|
92
93
|
* Control whether router state updates are internally wrapped in
|
|
93
94
|
* [`React.startTransition`](https://react.dev/reference/react/startTransition).
|
|
@@ -117,7 +118,7 @@ interface HydratedRouterProps {
|
|
|
117
118
|
* @mode framework
|
|
118
119
|
* @param props Props
|
|
119
120
|
* @param {dom.HydratedRouterProps.getContext} props.getContext n/a
|
|
120
|
-
* @param {dom.HydratedRouterProps.
|
|
121
|
+
* @param {dom.HydratedRouterProps.onError} props.onError n/a
|
|
121
122
|
* @returns A React element that represents the hydrated application.
|
|
122
123
|
*/
|
|
123
124
|
declare function HydratedRouter(props: HydratedRouterProps): React.JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { RouterProviderProps as RouterProviderProps$1, RouterInit,
|
|
3
|
-
import { u as unstable_ClientInstrumentation } from './instrumentation-
|
|
4
|
-
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-
|
|
2
|
+
import { RouterProviderProps as RouterProviderProps$1, RouterInit, ClientOnErrorFunction } from 'react-router';
|
|
3
|
+
import { u as unstable_ClientInstrumentation } from './instrumentation-BlrVzjbg.js';
|
|
4
|
+
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-o-qhcuhA.js';
|
|
5
5
|
|
|
6
6
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
7
7
|
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
|
@@ -72,9 +72,9 @@ interface HydratedRouterProps {
|
|
|
72
72
|
*/
|
|
73
73
|
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
|
74
74
|
/**
|
|
75
|
-
* An error handler function that will be called for any loader
|
|
76
|
-
* errors that are encountered in your application. This is useful for
|
|
77
|
-
* logging or reporting errors instead of the
|
|
75
|
+
* An error handler function that will be called for any middleware, loader, action,
|
|
76
|
+
* or render errors that are encountered in your application. This is useful for
|
|
77
|
+
* logging or reporting errors instead of in the {@link ErrorBoundary} because it's not
|
|
78
78
|
* subject to re-rendering and will only run one time per error.
|
|
79
79
|
*
|
|
80
80
|
* The `errorInfo` parameter is passed along from
|
|
@@ -82,13 +82,14 @@ interface HydratedRouterProps {
|
|
|
82
82
|
* and is only present for render errors.
|
|
83
83
|
*
|
|
84
84
|
* ```tsx
|
|
85
|
-
* <HydratedRouter
|
|
86
|
-
*
|
|
87
|
-
*
|
|
85
|
+
* <HydratedRouter onError=(error, info) => {
|
|
86
|
+
* let { location, params, unstable_pattern, errorInfo } = info;
|
|
87
|
+
* console.error(error, location, errorInfo);
|
|
88
|
+
* reportToErrorService(error, location, errorInfo);
|
|
88
89
|
* }} />
|
|
89
90
|
* ```
|
|
90
91
|
*/
|
|
91
|
-
|
|
92
|
+
onError?: ClientOnErrorFunction;
|
|
92
93
|
/**
|
|
93
94
|
* Control whether router state updates are internally wrapped in
|
|
94
95
|
* [`React.startTransition`](https://react.dev/reference/react/startTransition).
|
|
@@ -118,7 +119,7 @@ interface HydratedRouterProps {
|
|
|
118
119
|
* @mode framework
|
|
119
120
|
* @param props Props
|
|
120
121
|
* @param {dom.HydratedRouterProps.getContext} props.getContext n/a
|
|
121
|
-
* @param {dom.HydratedRouterProps.
|
|
122
|
+
* @param {dom.HydratedRouterProps.onError} props.onError n/a
|
|
122
123
|
* @returns A React element that represents the hydrated application.
|
|
123
124
|
*/
|
|
124
125
|
declare function HydratedRouter(props: HydratedRouterProps): React.JSX.Element;
|
|
@@ -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.
|
|
2
|
+
* react-router v7.11.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkGNDLROV6js = require('./chunk-GNDLROV6.js');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
@@ -32,7 +32,7 @@ var _chunkFKYGG5Z2js = require('./chunk-FKYGG5Z2.js');
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
var
|
|
35
|
+
var _chunkSZQUWNVJjs = require('./chunk-SZQUWNVJ.js');
|
|
36
36
|
|
|
37
37
|
// lib/dom-export/dom-router-provider.tsx
|
|
38
38
|
var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react);
|
|
@@ -204,7 +204,7 @@ function HydratedRouter(props) {
|
|
|
204
204
|
}, []);
|
|
205
205
|
React2.useEffect(() => {
|
|
206
206
|
if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
|
|
207
|
-
document.querySelectorAll(`[${
|
|
207
|
+
document.querySelectorAll(`[${_chunkSZQUWNVJjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
|
|
208
208
|
}
|
|
209
209
|
}, [criticalCss]);
|
|
210
210
|
let [location2, setLocation] = React2.useState(router.state.location);
|
|
@@ -253,7 +253,7 @@ function HydratedRouter(props) {
|
|
|
253
253
|
{
|
|
254
254
|
router,
|
|
255
255
|
unstable_useTransitions: props.unstable_useTransitions,
|
|
256
|
-
|
|
256
|
+
onError: props.onError
|
|
257
257
|
}
|
|
258
258
|
))
|
|
259
259
|
), /* @__PURE__ */ React2.createElement(React2.Fragment, null))
|
|
@@ -376,10 +376,10 @@ function createRouterFromPayload({
|
|
|
376
376
|
};
|
|
377
377
|
if (payload.type !== "render") throw new Error("Invalid payload type");
|
|
378
378
|
globalVar.__reactRouterRouteModules = _nullishCoalesce(globalVar.__reactRouterRouteModules, () => ( {}));
|
|
379
|
-
|
|
379
|
+
_chunkGNDLROV6js.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
|
|
380
380
|
let patches = /* @__PURE__ */ new Map();
|
|
381
381
|
_optionalChain([payload, 'access', _22 => _22.patches, 'optionalAccess', _23 => _23.forEach, 'call', _24 => _24((patch) => {
|
|
382
|
-
|
|
382
|
+
_chunkSZQUWNVJjs.invariant.call(void 0, patch.parentId, "Invalid patch parentId");
|
|
383
383
|
if (!patches.has(patch.parentId)) {
|
|
384
384
|
patches.set(patch.parentId, []);
|
|
385
385
|
}
|
|
@@ -401,12 +401,12 @@ function createRouterFromPayload({
|
|
|
401
401
|
}
|
|
402
402
|
return [route];
|
|
403
403
|
}, []);
|
|
404
|
-
globalVar.__reactRouterDataRouter =
|
|
404
|
+
globalVar.__reactRouterDataRouter = _chunkSZQUWNVJjs.createRouter.call(void 0, {
|
|
405
405
|
routes,
|
|
406
406
|
getContext,
|
|
407
407
|
basename: payload.basename,
|
|
408
|
-
history:
|
|
409
|
-
hydrationData:
|
|
408
|
+
history: _chunkSZQUWNVJjs.createBrowserHistory.call(void 0, ),
|
|
409
|
+
hydrationData: _chunkGNDLROV6js.getHydrationData.call(void 0, {
|
|
410
410
|
state: {
|
|
411
411
|
loaderData: payload.loaderData,
|
|
412
412
|
actionData: payload.actionData,
|
|
@@ -415,7 +415,7 @@ function createRouterFromPayload({
|
|
|
415
415
|
routes,
|
|
416
416
|
getRouteInfo: (routeId) => {
|
|
417
417
|
let match = payload.matches.find((m) => m.id === routeId);
|
|
418
|
-
|
|
418
|
+
_chunkSZQUWNVJjs.invariant.call(void 0, match, "Route not found in payload");
|
|
419
419
|
return {
|
|
420
420
|
clientLoader: match.clientLoader,
|
|
421
421
|
hasLoader: match.hasLoader,
|
|
@@ -513,9 +513,9 @@ function createRouterFromPayload({
|
|
|
513
513
|
routeModules: globalVar.__reactRouterRouteModules
|
|
514
514
|
};
|
|
515
515
|
}
|
|
516
|
-
var renderedRoutesContext =
|
|
516
|
+
var renderedRoutesContext = _chunkSZQUWNVJjs.createContext.call(void 0, );
|
|
517
517
|
function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReadableStream, fetchImplementation) {
|
|
518
|
-
let dataStrategy =
|
|
518
|
+
let dataStrategy = _chunkSZQUWNVJjs.getSingleFetchDataStrategyImpl.call(void 0,
|
|
519
519
|
getRouter,
|
|
520
520
|
(match) => {
|
|
521
521
|
let M = match;
|
|
@@ -571,20 +571,20 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
|
|
|
571
571
|
function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation) {
|
|
572
572
|
return async (args, basename, targetRoutes) => {
|
|
573
573
|
let { request, context } = args;
|
|
574
|
-
let url =
|
|
574
|
+
let url = _chunkSZQUWNVJjs.singleFetchUrl.call(void 0, request.url, basename, "rsc");
|
|
575
575
|
if (request.method === "GET") {
|
|
576
|
-
url =
|
|
576
|
+
url = _chunkSZQUWNVJjs.stripIndexParam.call(void 0, url);
|
|
577
577
|
if (targetRoutes) {
|
|
578
578
|
url.searchParams.set("_routes", targetRoutes.join(","));
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
581
|
let res = await fetchImplementation(
|
|
582
|
-
new Request(url, await
|
|
582
|
+
new Request(url, await _chunkSZQUWNVJjs.createRequestInit.call(void 0, request))
|
|
583
583
|
);
|
|
584
584
|
if (res.status >= 400 && !res.headers.has("X-Remix-Response")) {
|
|
585
|
-
throw new (0,
|
|
585
|
+
throw new (0, _chunkSZQUWNVJjs.ErrorResponseImpl)(res.status, res.statusText, await res.text());
|
|
586
586
|
}
|
|
587
|
-
|
|
587
|
+
_chunkSZQUWNVJjs.invariant.call(void 0, res.body, "No response body to decode");
|
|
588
588
|
try {
|
|
589
589
|
const payload = await createFromReadableStream(res.body, {
|
|
590
590
|
temporaryReferences: void 0
|
|
@@ -608,7 +608,7 @@ function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation)
|
|
|
608
608
|
}
|
|
609
609
|
context.get(renderedRoutesContext).push(...payload.matches);
|
|
610
610
|
let results = { routes: {} };
|
|
611
|
-
const dataKey =
|
|
611
|
+
const dataKey = _chunkSZQUWNVJjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
|
|
612
612
|
for (let [routeId, data] of Object.entries(payload[dataKey] || {})) {
|
|
613
613
|
results.routes[routeId] = { data };
|
|
614
614
|
}
|
|
@@ -641,7 +641,7 @@ function RSCHydratedRouter({
|
|
|
641
641
|
[createFromReadableStream, payload, fetchImplementation, getContext]
|
|
642
642
|
);
|
|
643
643
|
React3.useEffect(() => {
|
|
644
|
-
|
|
644
|
+
_chunkSZQUWNVJjs.setIsHydrated.call(void 0, );
|
|
645
645
|
}, []);
|
|
646
646
|
React3.useLayoutEffect(() => {
|
|
647
647
|
const globalVar = window;
|
|
@@ -743,12 +743,11 @@ function RSCHydratedRouter({
|
|
|
743
743
|
routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" },
|
|
744
744
|
routeModules
|
|
745
745
|
};
|
|
746
|
-
return /* @__PURE__ */ React3.createElement(
|
|
747
|
-
|
|
746
|
+
return /* @__PURE__ */ React3.createElement(_chunkSZQUWNVJjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkGNDLROV6js.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkSZQUWNVJjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
|
|
747
|
+
_chunkSZQUWNVJjs.RouterProvider,
|
|
748
748
|
{
|
|
749
749
|
router: transitionEnabledRouter,
|
|
750
|
-
flushSync: ReactDOM2.flushSync
|
|
751
|
-
unstable_useTransitions: true
|
|
750
|
+
flushSync: ReactDOM2.flushSync
|
|
752
751
|
}
|
|
753
752
|
))));
|
|
754
753
|
}
|
|
@@ -761,8 +760,8 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
761
760
|
// the server loader flow regardless of whether the client loader calls
|
|
762
761
|
// `serverLoader` or not, otherwise we'll have nothing to render.
|
|
763
762
|
match.hasComponent && !match.element;
|
|
764
|
-
|
|
765
|
-
|
|
763
|
+
_chunkSZQUWNVJjs.invariant.call(void 0, window.__reactRouterRouteModules);
|
|
764
|
+
_chunkGNDLROV6js.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
|
|
766
765
|
let dataRoute = {
|
|
767
766
|
id: match.id,
|
|
768
767
|
element: match.element,
|
|
@@ -812,7 +811,7 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
812
811
|
return await callSingleFetch(singleFetch);
|
|
813
812
|
}
|
|
814
813
|
}) : match.hasAction ? (_, singleFetch) => callSingleFetch(singleFetch) : () => {
|
|
815
|
-
throw
|
|
814
|
+
throw _chunkSZQUWNVJjs.noActionDefinedError.call(void 0, "action", match.id);
|
|
816
815
|
},
|
|
817
816
|
path: match.path,
|
|
818
817
|
shouldRevalidate: match.shouldRevalidate,
|
|
@@ -825,7 +824,7 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
825
824
|
hasShouldRevalidate: match.shouldRevalidate != null
|
|
826
825
|
};
|
|
827
826
|
if (typeof dataRoute.loader === "function") {
|
|
828
|
-
dataRoute.loader.hydrate =
|
|
827
|
+
dataRoute.loader.hydrate = _chunkSZQUWNVJjs.shouldHydrateRouteLoader.call(void 0,
|
|
829
828
|
match.id,
|
|
830
829
|
match.clientLoader,
|
|
831
830
|
match.hasLoader,
|
|
@@ -835,7 +834,7 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
835
834
|
return dataRoute;
|
|
836
835
|
}
|
|
837
836
|
function callSingleFetch(singleFetch) {
|
|
838
|
-
|
|
837
|
+
_chunkSZQUWNVJjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
|
|
839
838
|
return singleFetch();
|
|
840
839
|
}
|
|
841
840
|
function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
|
|
@@ -843,7 +842,7 @@ function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
|
|
|
843
842
|
let fn = type === "action" ? "serverAction()" : "serverLoader()";
|
|
844
843
|
let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${routeId}")`;
|
|
845
844
|
console.error(msg);
|
|
846
|
-
throw new (0,
|
|
845
|
+
throw new (0, _chunkSZQUWNVJjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
|
|
847
846
|
}
|
|
848
847
|
}
|
|
849
848
|
var nextPaths = /* @__PURE__ */ new Set();
|
|
@@ -898,7 +897,7 @@ async function fetchAndApplyManifestPatches(paths, createFromReadableStream, fet
|
|
|
898
897
|
function addToFifoQueue(path, queue) {
|
|
899
898
|
if (queue.size >= discoveredPathsMaxSize) {
|
|
900
899
|
let first = queue.values().next().value;
|
|
901
|
-
queue.delete(first);
|
|
900
|
+
if (typeof first === "string") queue.delete(first);
|
|
902
901
|
}
|
|
903
902
|
queue.add(path);
|
|
904
903
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.
|
|
2
|
+
* react-router v7.11.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
deserializeErrors,
|
|
15
15
|
getHydrationData,
|
|
16
16
|
populateRSCRouteModules
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-YNUBSHFH.mjs";
|
|
18
18
|
import {
|
|
19
19
|
CRITICAL_CSS_DATA_ATTRIBUTE,
|
|
20
20
|
ErrorResponseImpl,
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
singleFetchUrl,
|
|
43
43
|
stripIndexParam,
|
|
44
44
|
useFogOFWarDiscovery
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-JMJ3UQ3L.mjs";
|
|
46
46
|
|
|
47
47
|
// lib/dom-export/dom-router-provider.tsx
|
|
48
48
|
import * as React from "react";
|
|
@@ -245,7 +245,7 @@ function HydratedRouter(props) {
|
|
|
245
245
|
{
|
|
246
246
|
router,
|
|
247
247
|
unstable_useTransitions: props.unstable_useTransitions,
|
|
248
|
-
|
|
248
|
+
onError: props.onError
|
|
249
249
|
}
|
|
250
250
|
))
|
|
251
251
|
), /* @__PURE__ */ React2.createElement(React2.Fragment, null))
|
|
@@ -739,8 +739,7 @@ function RSCHydratedRouter({
|
|
|
739
739
|
RouterProvider,
|
|
740
740
|
{
|
|
741
741
|
router: transitionEnabledRouter,
|
|
742
|
-
flushSync: ReactDOM2.flushSync
|
|
743
|
-
unstable_useTransitions: true
|
|
742
|
+
flushSync: ReactDOM2.flushSync
|
|
744
743
|
}
|
|
745
744
|
))));
|
|
746
745
|
}
|
|
@@ -890,7 +889,7 @@ async function fetchAndApplyManifestPatches(paths, createFromReadableStream, fet
|
|
|
890
889
|
function addToFifoQueue(path, queue) {
|
|
891
890
|
if (queue.size >= discoveredPathsMaxSize) {
|
|
892
891
|
let first = queue.values().next().value;
|
|
893
|
-
queue.delete(first);
|
|
892
|
+
if (typeof first === "string") queue.delete(first);
|
|
894
893
|
}
|
|
895
894
|
queue.add(path);
|
|
896
895
|
}
|