react-router 8.4.0 → 8.5.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 +51 -1
- package/dist/development/dom-export.d.ts +2 -1
- package/dist/development/dom-export.js +1 -1
- package/dist/development/index-react-server-client.js +2 -2
- package/dist/development/index-react-server.d.ts +583 -165
- package/dist/development/index-react-server.js +27 -19
- package/dist/development/index.d.ts +9 -8
- package/dist/development/index.js +5 -4
- package/dist/development/lib/actions.js +1 -1
- package/dist/development/lib/components.js +22 -3
- package/dist/development/lib/context.d.ts +6 -1
- package/dist/development/lib/context.js +1 -1
- package/dist/development/lib/dom/dom.d.ts +3 -0
- package/dist/development/lib/dom/dom.js +1 -1
- package/dist/development/lib/dom/global.d.ts +35 -0
- package/dist/development/lib/dom/lib.d.ts +34 -9
- package/dist/development/lib/dom/lib.js +17 -6
- package/dist/development/lib/dom/server.js +2 -2
- package/dist/development/lib/dom/ssr/components.js +12 -9
- package/dist/development/lib/dom/ssr/data.js +1 -1
- package/dist/development/lib/dom/ssr/entry.d.ts +9 -2
- package/dist/development/lib/dom/ssr/errorBoundaries.js +1 -1
- package/dist/development/lib/dom/ssr/fallback.js +1 -1
- package/dist/development/lib/dom/ssr/fog-of-war.d.ts +3 -2
- package/dist/development/lib/dom/ssr/fog-of-war.js +14 -11
- package/dist/development/lib/dom/ssr/hydration.js +1 -1
- package/dist/development/lib/dom/ssr/invariant.js +1 -1
- package/dist/development/lib/dom/ssr/links.js +1 -1
- package/dist/development/lib/dom/ssr/markup.js +1 -1
- package/dist/development/lib/dom/ssr/route-discovery.d.ts +120 -0
- package/dist/development/lib/dom/ssr/route-discovery.js +415 -0
- package/dist/development/lib/dom/ssr/routeModules.js +1 -1
- package/dist/development/lib/dom/ssr/routes-test-stub.js +2 -2
- package/dist/development/lib/dom/ssr/routes.d.ts +2 -2
- package/dist/development/lib/dom/ssr/routes.js +8 -8
- package/dist/development/lib/dom/ssr/server.js +3 -1
- package/dist/development/lib/dom/ssr/single-fetch.d.ts +28 -2
- package/dist/development/lib/dom/ssr/single-fetch.js +73 -55
- package/dist/development/lib/dom-export/dom-router-provider.js +1 -1
- package/dist/development/lib/dom-export/hydrated-router.d.ts +28 -0
- package/dist/development/lib/dom-export/hydrated-router.js +32 -12
- package/dist/development/lib/errors.js +1 -1
- package/dist/development/lib/hooks.d.ts +3 -3
- package/dist/development/lib/hooks.js +4 -4
- package/dist/development/lib/href.js +1 -1
- package/dist/development/lib/router/history.js +1 -1
- package/dist/development/lib/router/instrumentation.js +1 -1
- package/dist/development/lib/router/matcher-route-pattern.js +1 -1
- package/dist/development/lib/router/matcher-route-pattern.preload.js +1 -1
- package/dist/development/lib/router/matcher.js +1 -1
- package/dist/development/lib/router/navigation.js +1 -1
- package/dist/development/lib/router/router.d.ts +6 -0
- package/dist/development/lib/router/router.js +157 -65
- package/dist/development/lib/router/url.js +1 -1
- package/dist/development/lib/router/utils.d.ts +24 -4
- package/dist/development/lib/router/utils.js +4 -3
- package/dist/development/lib/rsc/browser.js +2 -2
- package/dist/development/lib/rsc/errorBoundaries.js +1 -1
- package/dist/development/lib/rsc/html-stream/browser.js +1 -1
- package/dist/development/lib/rsc/html-stream/server.js +24 -12
- package/dist/development/lib/rsc/route-modules.js +1 -1
- package/dist/development/lib/rsc/server.rsc.d.ts +3 -2
- package/dist/development/lib/rsc/server.ssr.js +1 -1
- package/dist/development/lib/server-runtime/build.d.ts +14 -0
- package/dist/development/lib/server-runtime/cookies.js +1 -1
- package/dist/development/lib/server-runtime/crypto.js +1 -1
- package/dist/development/lib/server-runtime/data.js +1 -1
- package/dist/development/lib/server-runtime/dev.js +1 -1
- package/dist/development/lib/server-runtime/entry.js +1 -1
- package/dist/development/lib/server-runtime/errors.js +1 -1
- package/dist/development/lib/server-runtime/headers.js +1 -1
- package/dist/development/lib/server-runtime/invariant.js +1 -1
- package/dist/development/lib/server-runtime/mode.js +1 -1
- package/dist/development/lib/server-runtime/routeMatching.js +1 -1
- package/dist/development/lib/server-runtime/routes.d.ts +1 -1
- package/dist/development/lib/server-runtime/routes.js +1 -1
- package/dist/development/lib/server-runtime/server.js +12 -4
- package/dist/development/lib/server-runtime/serverHandoff.d.ts +17 -0
- package/dist/development/lib/server-runtime/serverHandoff.js +1 -1
- package/dist/development/lib/server-runtime/sessions/cookieStorage.js +1 -1
- package/dist/development/lib/server-runtime/sessions/memoryStorage.js +1 -1
- package/dist/development/lib/server-runtime/sessions.js +1 -1
- package/dist/development/lib/server-runtime/single-fetch.js +1 -1
- package/dist/development/lib/server-runtime/urls.js +1 -1
- package/dist/development/lib/server-runtime/warnings.js +1 -1
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/route-data.d.ts +2 -2
- package/dist/development/lib/types/route-module-annotations.d.ts +1 -1
- package/dist/development/route-pattern.js +1 -1
- package/dist/development/vendor/turbo-stream-v2/flatten.js +1 -1
- package/dist/development/vendor/turbo-stream-v2/turbo-stream.js +1 -1
- package/dist/development/vendor/turbo-stream-v2/unflatten.js +1 -1
- package/dist/development/vendor/turbo-stream-v2/utils.js +1 -1
- package/dist/production/dom-export.d.ts +2 -1
- package/dist/production/dom-export.js +1 -1
- package/dist/production/index-react-server-client.js +2 -2
- package/dist/production/index-react-server.d.ts +583 -165
- package/dist/production/index-react-server.js +27 -19
- package/dist/production/index.d.ts +9 -8
- package/dist/production/index.js +5 -4
- package/dist/production/lib/actions.js +1 -1
- package/dist/production/lib/components.js +22 -3
- package/dist/production/lib/context.d.ts +6 -1
- package/dist/production/lib/context.js +1 -1
- package/dist/production/lib/dom/dom.d.ts +3 -0
- package/dist/production/lib/dom/dom.js +1 -1
- package/dist/production/lib/dom/global.d.ts +35 -0
- package/dist/production/lib/dom/lib.d.ts +34 -9
- package/dist/production/lib/dom/lib.js +17 -6
- package/dist/production/lib/dom/server.js +2 -2
- package/dist/production/lib/dom/ssr/components.js +12 -9
- package/dist/production/lib/dom/ssr/data.js +1 -1
- package/dist/production/lib/dom/ssr/entry.d.ts +9 -2
- package/dist/production/lib/dom/ssr/errorBoundaries.js +1 -1
- package/dist/production/lib/dom/ssr/fallback.js +1 -1
- package/dist/production/lib/dom/ssr/fog-of-war.d.ts +3 -2
- package/dist/production/lib/dom/ssr/fog-of-war.js +14 -11
- package/dist/production/lib/dom/ssr/hydration.js +1 -1
- package/dist/production/lib/dom/ssr/invariant.js +1 -1
- package/dist/production/lib/dom/ssr/links.js +1 -1
- package/dist/production/lib/dom/ssr/markup.js +1 -1
- package/dist/production/lib/dom/ssr/route-discovery.d.ts +120 -0
- package/dist/production/lib/dom/ssr/route-discovery.js +415 -0
- package/dist/production/lib/dom/ssr/routeModules.js +1 -1
- package/dist/production/lib/dom/ssr/routes-test-stub.js +2 -2
- package/dist/production/lib/dom/ssr/routes.d.ts +2 -2
- package/dist/production/lib/dom/ssr/routes.js +8 -8
- package/dist/production/lib/dom/ssr/server.js +3 -1
- package/dist/production/lib/dom/ssr/single-fetch.d.ts +28 -2
- package/dist/production/lib/dom/ssr/single-fetch.js +73 -55
- package/dist/production/lib/dom-export/dom-router-provider.js +1 -1
- package/dist/production/lib/dom-export/hydrated-router.d.ts +28 -0
- package/dist/production/lib/dom-export/hydrated-router.js +32 -12
- package/dist/production/lib/errors.js +1 -1
- package/dist/production/lib/hooks.d.ts +3 -3
- package/dist/production/lib/hooks.js +3 -3
- package/dist/production/lib/href.js +1 -1
- package/dist/production/lib/router/history.js +1 -1
- package/dist/production/lib/router/instrumentation.js +1 -1
- package/dist/production/lib/router/matcher-route-pattern.js +1 -1
- package/dist/production/lib/router/matcher-route-pattern.preload.js +1 -1
- package/dist/production/lib/router/matcher.js +1 -1
- package/dist/production/lib/router/navigation.js +1 -1
- package/dist/production/lib/router/router.d.ts +6 -0
- package/dist/production/lib/router/router.js +157 -65
- package/dist/production/lib/router/url.js +1 -1
- package/dist/production/lib/router/utils.d.ts +24 -4
- package/dist/production/lib/router/utils.js +4 -3
- package/dist/production/lib/rsc/browser.js +2 -2
- package/dist/production/lib/rsc/errorBoundaries.js +1 -1
- package/dist/production/lib/rsc/html-stream/browser.js +1 -1
- package/dist/production/lib/rsc/html-stream/server.js +24 -12
- package/dist/production/lib/rsc/route-modules.js +1 -1
- package/dist/production/lib/rsc/server.rsc.d.ts +3 -2
- package/dist/production/lib/rsc/server.ssr.js +1 -1
- package/dist/production/lib/server-runtime/build.d.ts +14 -0
- package/dist/production/lib/server-runtime/cookies.js +1 -1
- package/dist/production/lib/server-runtime/crypto.js +1 -1
- package/dist/production/lib/server-runtime/data.js +1 -1
- package/dist/production/lib/server-runtime/dev.js +1 -1
- package/dist/production/lib/server-runtime/entry.js +1 -1
- package/dist/production/lib/server-runtime/errors.js +1 -1
- package/dist/production/lib/server-runtime/headers.js +1 -1
- package/dist/production/lib/server-runtime/invariant.js +1 -1
- package/dist/production/lib/server-runtime/mode.js +1 -1
- package/dist/production/lib/server-runtime/routeMatching.js +1 -1
- package/dist/production/lib/server-runtime/routes.d.ts +1 -1
- package/dist/production/lib/server-runtime/routes.js +1 -1
- package/dist/production/lib/server-runtime/server.js +12 -4
- package/dist/production/lib/server-runtime/serverHandoff.d.ts +17 -0
- package/dist/production/lib/server-runtime/serverHandoff.js +1 -1
- package/dist/production/lib/server-runtime/sessions/cookieStorage.js +1 -1
- package/dist/production/lib/server-runtime/sessions/memoryStorage.js +1 -1
- package/dist/production/lib/server-runtime/sessions.js +1 -1
- package/dist/production/lib/server-runtime/single-fetch.js +1 -1
- package/dist/production/lib/server-runtime/urls.js +1 -1
- package/dist/production/lib/server-runtime/warnings.js +1 -1
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/route-data.d.ts +2 -2
- package/dist/production/lib/types/route-module-annotations.d.ts +1 -1
- package/dist/production/route-pattern.js +1 -1
- package/dist/production/vendor/turbo-stream-v2/flatten.js +1 -1
- package/dist/production/vendor/turbo-stream-v2/turbo-stream.js +1 -1
- package/dist/production/vendor/turbo-stream-v2/unflatten.js +1 -1
- package/dist/production/vendor/turbo-stream-v2/utils.js +1 -1
- package/docs/explanation/lazy-route-discovery.md +4 -0
- package/docs/explanation/sessions-and-cookies.md +108 -4
- package/docs/how-to/custom-fetch.md +218 -0
- package/docs/how-to/data-strategy.md +23 -1
- package/docs/how-to/middleware.md +1 -0
- package/docs/how-to/optimize-revalidation.md +2 -2
- package/docs/how-to/pre-rendering.md +23 -1
- package/docs/how-to/route-discovery.md +145 -0
- package/docs/how-to/spa.md +2 -0
- package/docs/how-to/view-transitions.md +80 -13
- package/docs/start/framework/navigating.md +5 -9
- package/docs/start/framework/rendering.md +37 -0
- package/package.json +9 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v8.
|
|
2
|
+
* react-router v8.5.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -14,12 +14,12 @@ import { ErrorResponseImpl, createContext, resolvePath } from "../router/utils.j
|
|
|
14
14
|
import { validateNavigationTarget } from "../router/navigation.js";
|
|
15
15
|
import { createRouter, hasInvalidProtocol, isMutationMethod } from "../router/router.js";
|
|
16
16
|
import { RSCRouterContext } from "../context.js";
|
|
17
|
-
import { RouterProvider } from "../components.js";
|
|
18
17
|
import { createRequestInit } from "../dom/ssr/data.js";
|
|
19
18
|
import { getSingleFetchDataStrategyImpl, singleFetchUrl, stripIndexParam } from "../dom/ssr/single-fetch.js";
|
|
20
19
|
import { noActionDefinedError, shouldHydrateRouteLoader } from "../dom/ssr/routes.js";
|
|
21
20
|
import { getPathsWithAncestors, handleClientVersionMismatch } from "../dom/ssr/fog-of-war.js";
|
|
22
21
|
import { FrameworkContext, setIsHydrated } from "../dom/ssr/components.js";
|
|
22
|
+
import { RouterProvider } from "../components.js";
|
|
23
23
|
import { RSCRouterGlobalErrorBoundary } from "./errorBoundaries.js";
|
|
24
24
|
import { populateRSCRouteModules } from "./route-modules.js";
|
|
25
25
|
import { getHydrationData } from "../dom/ssr/hydration.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v8.
|
|
2
|
+
* react-router v8.5.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -21,11 +21,31 @@ function injectRSCPayload(rscStream, { nonce } = {}) {
|
|
|
21
21
|
let rscReader = null;
|
|
22
22
|
let buffered = [];
|
|
23
23
|
let timeout = null;
|
|
24
|
+
async function stop(reason) {
|
|
25
|
+
cancelled = true;
|
|
26
|
+
if (timeout) {
|
|
27
|
+
clearTimeout(timeout);
|
|
28
|
+
timeout = null;
|
|
29
|
+
}
|
|
30
|
+
buffered.length = 0;
|
|
31
|
+
resolveFlightDataPromise();
|
|
32
|
+
if (rscReader && rscStream.locked) await rscReader.cancel(reason).catch(() => {});
|
|
33
|
+
else await rscStream.cancel(reason).catch(() => {});
|
|
34
|
+
}
|
|
35
|
+
function tryEnqueue(controller, chunk) {
|
|
36
|
+
try {
|
|
37
|
+
controller.enqueue(chunk);
|
|
38
|
+
return true;
|
|
39
|
+
} catch (error) {
|
|
40
|
+
stop(error);
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
24
44
|
function flushBufferedChunks(controller) {
|
|
25
45
|
for (let chunk of buffered) {
|
|
26
46
|
let buf = decoder.decode(chunk, { stream: true });
|
|
27
47
|
if (buf.endsWith(trailer)) buf = buf.slice(0, -14);
|
|
28
|
-
controller
|
|
48
|
+
if (!tryEnqueue(controller, encoder.encode(buf))) return;
|
|
29
49
|
}
|
|
30
50
|
buffered.length = 0;
|
|
31
51
|
timeout = null;
|
|
@@ -50,18 +70,10 @@ function injectRSCPayload(rscStream, { nonce } = {}) {
|
|
|
50
70
|
clearTimeout(timeout);
|
|
51
71
|
flushBufferedChunks(controller);
|
|
52
72
|
}
|
|
53
|
-
controller
|
|
73
|
+
tryEnqueue(controller, encoder.encode("</body></html>"));
|
|
54
74
|
},
|
|
55
75
|
async cancel(reason) {
|
|
56
|
-
|
|
57
|
-
if (timeout) {
|
|
58
|
-
clearTimeout(timeout);
|
|
59
|
-
timeout = null;
|
|
60
|
-
}
|
|
61
|
-
buffered.length = 0;
|
|
62
|
-
if (rscReader) await rscReader.cancel(reason).catch(() => {});
|
|
63
|
-
else await rscStream.cancel(reason).catch(() => {});
|
|
64
|
-
resolveFlightDataPromise();
|
|
76
|
+
await stop(reason);
|
|
65
77
|
}
|
|
66
78
|
});
|
|
67
79
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { Location } from "../router/history.js";
|
|
3
|
-
import { ActionFunction, LoaderFunction, Params, RouterContextProvider, ShouldRevalidateFunction } from "../router/utils.js";
|
|
3
|
+
import { ActionFunction, LoaderFunction, MiddlewareFunction, Params, RouterContextProvider, ShouldRevalidateFunction } from "../router/utils.js";
|
|
4
4
|
import { ClientActionFunction, ClientLoaderFunction, HeadersFunction, LinksFunction, MetaFunction } from "../dom/ssr/routeModules.js";
|
|
5
5
|
import * as React$1 from "react";
|
|
6
6
|
import { ReactFormState } from "react-dom/client";
|
|
@@ -19,6 +19,7 @@ type RSCRouteConfigEntryBase = {
|
|
|
19
19
|
links?: LinksFunction;
|
|
20
20
|
loader?: LoaderFunction;
|
|
21
21
|
meta?: MetaFunction;
|
|
22
|
+
middleware?: MiddlewareFunction<any>[];
|
|
22
23
|
shouldRevalidate?: ShouldRevalidateFunction;
|
|
23
24
|
};
|
|
24
25
|
type RSCRouteConfigEntry = RSCRouteConfigEntryBase & {
|
|
@@ -204,7 +205,7 @@ declare function matchRSCServerRequest({
|
|
|
204
205
|
onError,
|
|
205
206
|
request,
|
|
206
207
|
routes,
|
|
207
|
-
generateResponse
|
|
208
|
+
generateResponse: encodeResponse
|
|
208
209
|
}: {
|
|
209
210
|
allowedActionOrigins?: string[];
|
|
210
211
|
createTemporaryReferenceSet: () => unknown;
|
|
@@ -19,7 +19,21 @@ interface ServerBuild {
|
|
|
19
19
|
publicPath: string;
|
|
20
20
|
assetsBuildDirectory: string;
|
|
21
21
|
future: FutureConfig;
|
|
22
|
+
/**
|
|
23
|
+
* Whether runtime server requests are supported, including API-only builds.
|
|
24
|
+
*/
|
|
22
25
|
ssr: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The origin to use for server requests in API-only mode.
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
unstable_apiServerOrigin?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Whether production document rendering is disabled while data and route
|
|
33
|
+
* discovery requests remain supported.
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
unstable_apiOnly?: boolean;
|
|
23
37
|
unstable_getCriticalCss?: (args: {
|
|
24
38
|
pathname: string;
|
|
25
39
|
}) => OptionalCriticalCss | Promise<OptionalCriticalCss>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { RouteManifest } from "../router/utils.js";
|
|
3
|
-
import { ServerRouteModule } from "../dom/ssr/routeModules.js";
|
|
4
3
|
import { Route } from "../dom/ssr/routes.js";
|
|
4
|
+
import { ServerRouteModule } from "../dom/ssr/routeModules.js";
|
|
5
5
|
|
|
6
6
|
//#region lib/server-runtime/routes.d.ts
|
|
7
7
|
type ServerRouteManifest = RouteManifest<Omit<ServerRoute, "children">>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v8.
|
|
2
|
+
* react-router v8.5.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -58,7 +58,7 @@ function derive(build, mode) {
|
|
|
58
58
|
let normalizedPath = getNormalizedPath(request);
|
|
59
59
|
let normalizedPathname = normalizedPath.pathname;
|
|
60
60
|
let isSpaMode = getBuildTimeHeader(request, "X-React-Router-SPA-Mode") === "yes";
|
|
61
|
-
if (!build.ssr) {
|
|
61
|
+
if (!build.ssr || build.unstable_apiOnly) {
|
|
62
62
|
let decodedPath = decodeURI(normalizedPathname);
|
|
63
63
|
if (build.basename && build.basename !== "/") {
|
|
64
64
|
let strippedPath = stripBasename(decodedPath, build.basename);
|
|
@@ -76,7 +76,7 @@ function derive(build, mode) {
|
|
|
76
76
|
decodedPath = strippedPath;
|
|
77
77
|
}
|
|
78
78
|
if (build.prerender.length === 0) isSpaMode = true;
|
|
79
|
-
else if (!build.prerender.some((p) => removeTrailingSlash(p) === removeTrailingSlash(decodedPath))) if (requestUrl.pathname.endsWith(".data")) {
|
|
79
|
+
else if (!build.prerender.some((p) => removeTrailingSlash(p) === removeTrailingSlash(decodedPath))) if (requestUrl.pathname.endsWith(".data") && !build.unstable_apiOnly) {
|
|
80
80
|
errorHandler(new ErrorResponseImpl(404, "Not Found", `Refusing to SSR the path \`${decodedPath}\` because \`ssr:false\` is set and the path is not included in the \`prerender\` config, so in production the path will be a 404.`), {
|
|
81
81
|
context: loadContext,
|
|
82
82
|
params,
|
|
@@ -95,6 +95,10 @@ function derive(build, mode) {
|
|
|
95
95
|
handleError(e);
|
|
96
96
|
return new Response("Unknown Server Error", { status: 500 });
|
|
97
97
|
}
|
|
98
|
+
if (build.unstable_apiOnly && serverMode !== "development" && !requestUrl.pathname.endsWith(".data") && getBuildTimeHeader(request, "X-React-Router-SPA-Mode") !== "yes" && getBuildTimeHeader(request, "X-React-Router-Prerender") !== "yes") return new Response(null, {
|
|
99
|
+
status: 404,
|
|
100
|
+
statusText: "Not Found"
|
|
101
|
+
});
|
|
98
102
|
let matches = matchServerRoutes(build.routes, staticHandler, normalizedPathname);
|
|
99
103
|
if (matches && matches.length > 0) Object.assign(params, matches[0].params);
|
|
100
104
|
if (requestHandlerInstrumentations?.length) loadContext.set(instrumentationResultMetaContext, {
|
|
@@ -252,7 +256,9 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
|
|
|
252
256
|
future: build.future,
|
|
253
257
|
routeDiscovery: build.routeDiscovery,
|
|
254
258
|
ssr: build.ssr,
|
|
255
|
-
isSpaMode
|
|
259
|
+
isSpaMode,
|
|
260
|
+
unstable_apiOnly: build.unstable_apiOnly,
|
|
261
|
+
unstable_apiServerOrigin: build.unstable_apiServerOrigin
|
|
256
262
|
};
|
|
257
263
|
let entryContext = {
|
|
258
264
|
manifest: build.assets,
|
|
@@ -270,6 +276,8 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
|
|
|
270
276
|
ssr: build.ssr,
|
|
271
277
|
routeDiscovery: build.routeDiscovery,
|
|
272
278
|
isSpaMode,
|
|
279
|
+
unstable_apiOnly: build.unstable_apiOnly,
|
|
280
|
+
unstable_apiServerOrigin: build.unstable_apiServerOrigin,
|
|
273
281
|
serializeError: (err) => serializeError(err, serverMode)
|
|
274
282
|
};
|
|
275
283
|
let handleDocumentRequestFunction = build.entry.module.default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
import { CriticalCss, FutureConfig } from "../dom/ssr/entry.js";
|
|
3
|
+
import { ServerBuild } from "./build.js";
|
|
4
|
+
|
|
5
|
+
//#region lib/server-runtime/serverHandoff.d.ts
|
|
6
|
+
type ServerHandoff = {
|
|
7
|
+
criticalCss?: CriticalCss;
|
|
8
|
+
basename: string | undefined;
|
|
9
|
+
future: FutureConfig;
|
|
10
|
+
ssr: boolean;
|
|
11
|
+
isSpaMode: boolean;
|
|
12
|
+
unstable_apiOnly?: boolean;
|
|
13
|
+
unstable_apiServerOrigin?: string;
|
|
14
|
+
routeDiscovery: ServerBuild["routeDiscovery"];
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { ServerHandoff };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
import { DataWithResponseInit, RouterContextProvider } from "../router/utils.js";
|
|
3
|
+
import { ClientActionFunctionArgs, ClientLoaderFunctionArgs } from "../dom/ssr/routeModules.js";
|
|
4
|
+
import { Serializable } from "../server-runtime/single-fetch.js";
|
|
3
5
|
import { Equal, Func, IsAny } from "./utils.js";
|
|
4
6
|
import { RouteModule } from "./route-module.js";
|
|
5
7
|
import { unstable_SerializesTo } from "./serializes-to.js";
|
|
6
|
-
import { Serializable } from "../server-runtime/single-fetch.js";
|
|
7
|
-
import { ClientActionFunctionArgs, ClientLoaderFunctionArgs } from "../dom/ssr/routeModules.js";
|
|
8
8
|
|
|
9
9
|
//#region lib/types/route-data.d.ts
|
|
10
10
|
type Serialize<T> = T extends unstable_SerializesTo<infer To> ? To : T extends Serializable ? T : T extends ((...args: any[]) => unknown) ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends ReadonlySet<infer U> ? ReadonlySet<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? { [K in keyof T]: Serialize<T[K]> } : undefined;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import { Location } from "../router/history.js";
|
|
3
3
|
import { DataStrategyResult, MiddlewareNextFunction } from "../router/utils.js";
|
|
4
4
|
import { LinkDescriptor } from "../router/links.js";
|
|
5
|
+
import { MetaDescriptor } from "../dom/ssr/routeModules.js";
|
|
5
6
|
import { Func, Pretty } from "./utils.js";
|
|
6
7
|
import { RouteModule } from "./route-module.js";
|
|
7
8
|
import { ClientDataFunctionArgs, GetLoaderData, ServerDataFrom, ServerDataFunctionArgs } from "./route-data.js";
|
|
8
|
-
import { MetaDescriptor } from "../dom/ssr/routeModules.js";
|
|
9
9
|
|
|
10
10
|
//#region lib/types/route-module-annotations.d.ts
|
|
11
11
|
type MaybePromise<T> = T | Promise<T>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
import { RouterProvider, RouterProviderProps } from "./lib/dom-export/dom-router-provider.js";
|
|
3
|
+
import { RouterFetch, RouterFetchContext } from "./lib/dom/ssr/single-fetch.js";
|
|
3
4
|
import { DecodeActionFunction, DecodeFormStateFunction, DecodeReplyFunction, RSCManifestPayload, RSCPayload, RSCRenderPayload } from "./lib/rsc/server.rsc.js";
|
|
4
5
|
import { RSCHydratedRouter, createCallServer } from "./lib/rsc/browser.js";
|
|
5
6
|
import { HydratedRouter, HydratedRouterProps } from "./lib/dom-export/hydrated-router.js";
|
|
6
7
|
import { getRSCStream } from "./lib/rsc/html-stream/browser.js";
|
|
7
|
-
export { HydratedRouter, type HydratedRouterProps, RouterProvider, type RouterProviderProps, type DecodeActionFunction as unstable_DecodeActionFunction, type DecodeFormStateFunction as unstable_DecodeFormStateFunction, type DecodeReplyFunction as unstable_DecodeReplyFunction, RSCHydratedRouter as unstable_RSCHydratedRouter, type RSCManifestPayload as unstable_RSCManifestPayload, type RSCPayload as unstable_RSCPayload, type RSCRenderPayload as unstable_RSCRenderPayload, createCallServer as unstable_createCallServer, getRSCStream as unstable_getRSCStream };
|
|
8
|
+
export { HydratedRouter, type HydratedRouterProps, RouterProvider, type RouterProviderProps, type DecodeActionFunction as unstable_DecodeActionFunction, type DecodeFormStateFunction as unstable_DecodeFormStateFunction, type DecodeReplyFunction as unstable_DecodeReplyFunction, RSCHydratedRouter as unstable_RSCHydratedRouter, type RSCManifestPayload as unstable_RSCManifestPayload, type RSCPayload as unstable_RSCPayload, type RSCRenderPayload as unstable_RSCRenderPayload, type RouterFetch as unstable_RouterFetch, type RouterFetchContext as unstable_RouterFetchContext, createCallServer as unstable_createCallServer, getRSCStream as unstable_getRSCStream };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v8.
|
|
2
|
+
* react-router v8.5.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
*/
|
|
11
11
|
"use client";
|
|
12
12
|
import { AwaitContextProvider } from "./lib/context.js";
|
|
13
|
-
import { MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, WithComponentProps, WithErrorBoundaryProps, WithHydrateFallbackProps } from "./lib/components.js";
|
|
14
13
|
import { Links, Meta } from "./lib/dom/ssr/components.js";
|
|
14
|
+
import { MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, WithComponentProps, WithErrorBoundaryProps, WithHydrateFallbackProps } from "./lib/components.js";
|
|
15
15
|
import { BrowserRouter, Form, HashRouter, HistoryRouter, Link, NavLink, ScrollRestoration } from "./lib/dom/lib.js";
|
|
16
16
|
import { StaticRouter, StaticRouterProvider } from "./lib/dom/server.js";
|
|
17
17
|
export { BrowserRouter, Form, HashRouter, Link, Links, MemoryRouter, Meta, NavLink, Navigate, Outlet, Route, Router, RouterProvider, Routes, ScrollRestoration, StaticRouter, StaticRouterProvider, AwaitContextProvider as UNSAFE_AwaitContextProvider, WithComponentProps as UNSAFE_WithComponentProps, WithErrorBoundaryProps as UNSAFE_WithErrorBoundaryProps, WithHydrateFallbackProps as UNSAFE_WithHydrateFallbackProps, HistoryRouter as unstable_HistoryRouter };
|