react-router 8.3.1 → 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 +83 -0
- 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 +601 -189
- package/dist/development/index-react-server.js +100 -48
- package/dist/development/index.d.ts +10 -9
- package/dist/development/index.js +6 -5
- package/dist/development/lib/actions.js +1 -1
- package/dist/development/lib/components.js +66 -10
- package/dist/development/lib/context.d.ts +19 -6
- package/dist/development/lib/context.js +11 -3
- 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 +30 -37
- package/dist/development/lib/dom/server.d.ts +6 -1
- package/dist/development/lib/dom/server.js +41 -15
- package/dist/development/lib/dom/ssr/components.js +26 -31
- package/dist/development/lib/dom/ssr/data.js +1 -1
- package/dist/development/lib/dom/ssr/entry.d.ts +13 -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 +46 -22
- package/dist/development/lib/dom/ssr/hydration.d.ts +3 -1
- package/dist/development/lib/dom/ssr/hydration.js +6 -4
- 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 +5 -2
- 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 +4 -2
- package/dist/development/lib/dom/ssr/single-fetch.d.ts +28 -2
- package/dist/development/lib/dom/ssr/single-fetch.js +80 -71
- 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 +33 -12
- package/dist/development/lib/errors.js +1 -1
- package/dist/development/lib/hooks.d.ts +3 -3
- package/dist/development/lib/hooks.js +52 -47
- 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.d.ts +2 -0
- package/dist/development/lib/router/matcher-route-pattern.js +216 -0
- package/dist/development/lib/router/matcher-route-pattern.preload.d.ts +20 -0
- package/dist/development/lib/router/matcher-route-pattern.preload.js +36 -0
- package/dist/development/lib/router/matcher.d.ts +2 -0
- package/dist/development/lib/router/matcher.js +29 -0
- package/dist/development/lib/router/navigation.js +1 -1
- package/dist/development/lib/router/router.d.ts +19 -7
- package/dist/development/lib/router/router.js +235 -128
- package/dist/development/lib/router/url.js +1 -1
- package/dist/development/lib/router/utils.d.ts +30 -5
- package/dist/development/lib/router/utils.js +8 -5
- package/dist/development/lib/rsc/browser.js +3 -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 +25 -15
- package/dist/development/lib/rsc/route-modules.js +1 -1
- package/dist/development/lib/rsc/server.rsc.d.ts +10 -2
- package/dist/development/lib/rsc/server.ssr.js +25 -21
- 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 +3 -4
- 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 +18 -9
- 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.d.ts +3 -0
- package/dist/development/route-pattern.js +12 -0
- 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 +601 -189
- package/dist/production/index-react-server.js +100 -48
- package/dist/production/index.d.ts +10 -9
- package/dist/production/index.js +6 -5
- package/dist/production/lib/actions.js +1 -1
- package/dist/production/lib/components.js +66 -10
- package/dist/production/lib/context.d.ts +19 -6
- package/dist/production/lib/context.js +11 -3
- 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 +30 -37
- package/dist/production/lib/dom/server.d.ts +6 -1
- package/dist/production/lib/dom/server.js +41 -15
- package/dist/production/lib/dom/ssr/components.js +26 -31
- package/dist/production/lib/dom/ssr/data.js +1 -1
- package/dist/production/lib/dom/ssr/entry.d.ts +13 -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 +46 -22
- package/dist/production/lib/dom/ssr/hydration.d.ts +3 -1
- package/dist/production/lib/dom/ssr/hydration.js +6 -4
- 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 +5 -2
- 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 +4 -2
- package/dist/production/lib/dom/ssr/single-fetch.d.ts +28 -2
- package/dist/production/lib/dom/ssr/single-fetch.js +80 -71
- 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 +33 -12
- package/dist/production/lib/errors.js +1 -1
- package/dist/production/lib/hooks.d.ts +3 -3
- package/dist/production/lib/hooks.js +51 -46
- 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.d.ts +2 -0
- package/dist/production/lib/router/matcher-route-pattern.js +216 -0
- package/dist/production/lib/router/matcher-route-pattern.preload.d.ts +20 -0
- package/dist/production/lib/router/matcher-route-pattern.preload.js +36 -0
- package/dist/production/lib/router/matcher.d.ts +2 -0
- package/dist/production/lib/router/matcher.js +29 -0
- package/dist/production/lib/router/navigation.js +1 -1
- package/dist/production/lib/router/router.d.ts +19 -7
- package/dist/production/lib/router/router.js +235 -128
- package/dist/production/lib/router/url.js +1 -1
- package/dist/production/lib/router/utils.d.ts +30 -5
- package/dist/production/lib/router/utils.js +8 -5
- package/dist/production/lib/rsc/browser.js +3 -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 +25 -15
- package/dist/production/lib/rsc/route-modules.js +1 -1
- package/dist/production/lib/rsc/server.rsc.d.ts +10 -2
- package/dist/production/lib/rsc/server.ssr.js +25 -21
- 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 +3 -4
- 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 +18 -9
- 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.d.ts +3 -0
- package/dist/production/route-pattern.js +12 -0
- 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/fetchers.md +6 -1
- package/docs/how-to/middleware.md +4 -1
- package/docs/how-to/optimize-revalidation.md +178 -5
- package/docs/how-to/pre-rendering.md +23 -1
- package/docs/how-to/react-server-components.md +26 -3
- package/docs/how-to/resource-routes.md +3 -0
- 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/data/actions.md +2 -1
- package/docs/start/data/route-object.md +21 -6
- package/docs/start/framework/actions.md +4 -2
- package/docs/start/framework/navigating.md +5 -9
- package/docs/start/framework/rendering.md +37 -0
- package/docs/start/framework/route-module.md +32 -5
- package/docs/upgrading/future.md +68 -0
- package/package.json +19 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { Location, Path, To } from "./history.js";
|
|
2
|
+
import { Action, Location, Path, To } from "./history.js";
|
|
3
3
|
import * as React$1 from "react";
|
|
4
4
|
|
|
5
5
|
//#region lib/router/utils.d.ts
|
|
@@ -389,6 +389,11 @@ interface DataStrategyMatch extends RouteMatch<string, DataRouteObject> {
|
|
|
389
389
|
*/
|
|
390
390
|
resolve: (handlerOverride?: (handler: (ctx?: unknown) => DataFunctionReturnValue) => DataFunctionReturnValue) => Promise<DataStrategyResult>;
|
|
391
391
|
}
|
|
392
|
+
/**
|
|
393
|
+
* The operation that initiated a data strategy execution. Static handler
|
|
394
|
+
* executions use `"static"`.
|
|
395
|
+
*/
|
|
396
|
+
type DataStrategyInitiator = "initialization" | "navigation" | "fetcher" | "revalidation" | "static";
|
|
392
397
|
interface DataStrategyFunctionArgs<Context = DefaultContext> extends DataFunctionArgs<Context> {
|
|
393
398
|
/**
|
|
394
399
|
* Matches for this route extended with Data strategy APIs
|
|
@@ -396,8 +401,23 @@ interface DataStrategyFunctionArgs<Context = DefaultContext> extends DataFunctio
|
|
|
396
401
|
matches: DataStrategyMatch[];
|
|
397
402
|
runClientMiddleware: (cb: DataStrategyFunction<Context>) => Promise<Record<string, DataStrategyResult>>;
|
|
398
403
|
/**
|
|
399
|
-
* The
|
|
400
|
-
*
|
|
404
|
+
* The operation that initiated this data strategy execution
|
|
405
|
+
*
|
|
406
|
+
* This field is experimental and subject to breaking changes.
|
|
407
|
+
*/
|
|
408
|
+
unstable_initiator: DataStrategyInitiator;
|
|
409
|
+
/**
|
|
410
|
+
* The history action (`"PUSH"`, `"REPLACE"`, or `"POP"`) for a navigation-
|
|
411
|
+
* initiated execution, including fetchers reloaded by that navigation.
|
|
412
|
+
* `null` for initialization, fetcher, revalidation, and static executions.
|
|
413
|
+
*
|
|
414
|
+
* This field is experimental and subject to breaking changes.
|
|
415
|
+
*/
|
|
416
|
+
unstable_navigationType: Action | null;
|
|
417
|
+
/**
|
|
418
|
+
* The key of the fetcher targeted by this data strategy execution, otherwise
|
|
419
|
+
* `null`. Fetchers reloaded during a navigation or revalidation retain that
|
|
420
|
+
* `unstable_initiator` while providing their key here.
|
|
401
421
|
*/
|
|
402
422
|
fetcherKey: string | null;
|
|
403
423
|
}
|
|
@@ -430,7 +450,7 @@ interface MapRoutePropertiesFunction {
|
|
|
430
450
|
* onto the route. Either they're meaningful to the router, or they'll get
|
|
431
451
|
* ignored.
|
|
432
452
|
*/
|
|
433
|
-
type UnsupportedLazyRouteObjectKey = "lazy" | "caseSensitive" | "path" | "id" | "index" | "children";
|
|
453
|
+
type UnsupportedLazyRouteObjectKey = "lazy" | "caseSensitive" | "path" | "id" | "index" | "children" | "unstable_validateParams";
|
|
434
454
|
/**
|
|
435
455
|
* Keys we cannot change from within a lazy() function. We spread all other keys
|
|
436
456
|
* onto the route. Either they're meaningful to the router, or they'll get
|
|
@@ -488,6 +508,11 @@ type BaseRouteObject = {
|
|
|
488
508
|
* See [`shouldRevalidate`](../../start/data/route-object#shouldRevalidate).
|
|
489
509
|
*/
|
|
490
510
|
shouldRevalidate?: ShouldRevalidateFunction;
|
|
511
|
+
/**
|
|
512
|
+
* A map of route param names to regular expressions used to validate params
|
|
513
|
+
* after a route-pattern match.
|
|
514
|
+
*/
|
|
515
|
+
unstable_validateParams?: Record<string, RegExp>;
|
|
491
516
|
/**
|
|
492
517
|
* The route handle.
|
|
493
518
|
*/
|
|
@@ -957,4 +982,4 @@ declare class ErrorResponseImpl implements ErrorResponse {
|
|
|
957
982
|
*/
|
|
958
983
|
declare function isRouteErrorResponse(error: any): error is ErrorResponse;
|
|
959
984
|
//#endregion
|
|
960
|
-
export { ActionFunction, ActionFunctionArgs, BaseRouteObject, DataRouteMatch, DataRouteObject, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, DataStrategyResult, DataWithResponseInit, ErrorResponse, ErrorResponseImpl, FormEncType, FormMethod, HTMLFormMethod, IndexRouteObject, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, MapRoutePropertiesFunction, MaybePromise, MiddlewareFunction, MiddlewareNextFunction, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, PatchRoutesOnNavigationFunctionArgs, PathMatch, PathParam, PathPattern, RedirectFunction, RouteBranch, RouteData, RouteManifest, RouteMatch, RouteObject, RouterContext, RouterContextProvider, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, Submission, TrackedPromise, UIMatch, createContext, data, defaultMapRouteProperties, generatePath, isRouteErrorResponse, matchPath, matchRoutes, redirect, redirectDocument, replace, resolvePath };
|
|
985
|
+
export { ActionFunction, ActionFunctionArgs, BaseRouteObject, DataRouteMatch, DataRouteObject, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyInitiator, DataStrategyMatch, DataStrategyResult, DataWithResponseInit, ErrorResponse, ErrorResponseImpl, FormEncType, FormMethod, HTMLFormMethod, IndexRouteObject, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, MapRoutePropertiesFunction, MaybePromise, MiddlewareFunction, MiddlewareNextFunction, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, PatchRoutesOnNavigationFunctionArgs, PathMatch, PathParam, PathPattern, RedirectFunction, RouteBranch, RouteData, RouteManifest, RouteMatch, RouteObject, RouterContext, RouterContextProvider, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, Submission, TrackedPromise, UIMatch, createContext, data, defaultMapRouteProperties, generatePath, isRouteErrorResponse, matchPath, matchRoutes, redirect, redirectDocument, replace, resolvePath };
|
|
@@ -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
|
*
|
|
@@ -129,13 +129,15 @@ var RouterContextProvider = class {
|
|
|
129
129
|
this.#map.set(context, value);
|
|
130
130
|
}
|
|
131
131
|
};
|
|
132
|
+
var DiscoveryCancelledError = class extends Error {};
|
|
132
133
|
const unsupportedLazyRouteObjectKeys = new Set([
|
|
133
134
|
"lazy",
|
|
134
135
|
"caseSensitive",
|
|
135
136
|
"path",
|
|
136
137
|
"id",
|
|
137
138
|
"index",
|
|
138
|
-
"children"
|
|
139
|
+
"children",
|
|
140
|
+
"unstable_validateParams"
|
|
139
141
|
]);
|
|
140
142
|
function isUnsupportedLazyRouteObjectKey(key) {
|
|
141
143
|
return unsupportedLazyRouteObjectKeys.has(key);
|
|
@@ -147,7 +149,8 @@ const unsupportedLazyRouteFunctionKeys = new Set([
|
|
|
147
149
|
"id",
|
|
148
150
|
"index",
|
|
149
151
|
"middleware",
|
|
150
|
-
"children"
|
|
152
|
+
"children",
|
|
153
|
+
"unstable_validateParams"
|
|
151
154
|
]);
|
|
152
155
|
function isUnsupportedLazyRouteFunctionKey(key) {
|
|
153
156
|
return unsupportedLazyRouteFunctionKeys.has(key);
|
|
@@ -521,7 +524,7 @@ function compilePath(path, caseSensitive = false, end = true) {
|
|
|
521
524
|
return "(?:/([^\\/]*))?";
|
|
522
525
|
}
|
|
523
526
|
return "/([^\\/]+)";
|
|
524
|
-
}).replace(/\/([\
|
|
527
|
+
}).replace(/\/((?:[^/?()[\]*^\\]|\\.)+)\?(?=\/|$|\()/g, "(?:/$1)?");
|
|
525
528
|
if (path.endsWith("*")) {
|
|
526
529
|
params.push({ paramName: "*" });
|
|
527
530
|
regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
|
|
@@ -882,4 +885,4 @@ function parseToInfo(_to, basename) {
|
|
|
882
885
|
};
|
|
883
886
|
}
|
|
884
887
|
//#endregion
|
|
885
|
-
export { ErrorResponseImpl, RouterContextProvider, SUPPORTED_ERROR_TYPES, compilePath, convertRouteMatchToUiMatch, convertRoutesToDataRoutes, createContext, createDataFunctionUrl, data, decodePath, defaultMapRouteProperties, encodePathParam, flattenAndRankRoutes, generatePath, getPathContributingMatches, getResolveToMatches, getRoutePattern, isAbsoluteUrl, isBrowser, isRouteErrorResponse, isUnsupportedLazyRouteFunctionKey, isUnsupportedLazyRouteObjectKey, joinPaths, matchPath, matchRoutes, matchRoutesImpl, parseToInfo, prependBasename, redirect, redirectDocument, removeDoubleSlashes, removeTrailingSlash, replace, resolvePath, resolveTo, stripBasename };
|
|
888
|
+
export { DiscoveryCancelledError, ErrorResponseImpl, RouterContextProvider, SUPPORTED_ERROR_TYPES, compilePath, convertRouteMatchToUiMatch, convertRoutesToDataRoutes, createContext, createDataFunctionUrl, data, decodePath, defaultMapRouteProperties, encodePathParam, explodeOptionalSegments, flattenAndRankRoutes, generatePath, getPathContributingMatches, getResolveToMatches, getRoutePattern, isAbsoluteUrl, isBrowser, isRouteErrorResponse, isUnsupportedLazyRouteFunctionKey, isUnsupportedLazyRouteObjectKey, joinPaths, matchPath, matchRoutes, matchRoutesImpl, normalizePathname, parseToInfo, prependBasename, redirect, redirectDocument, removeDoubleSlashes, removeTrailingSlash, replace, resolvePath, resolveTo, stripBasename };
|
|
@@ -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";
|
|
@@ -169,6 +169,7 @@ function createRouterFromPayload({ fetchImplementation, createFromReadableStream
|
|
|
169
169
|
},
|
|
170
170
|
location: payload.location,
|
|
171
171
|
basename: payload.basename,
|
|
172
|
+
future: {},
|
|
172
173
|
isSpaMode: false
|
|
173
174
|
}),
|
|
174
175
|
async patchRoutesOnNavigation({ path, signal, fetcherKey }) {
|
|
@@ -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
|
*
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
+
import { escapeAttribute } from "../../dom/ssr/markup.js";
|
|
11
12
|
//#region lib/rsc/html-stream/server.ts
|
|
12
13
|
const encoder = new TextEncoder();
|
|
13
14
|
const trailer = "</body></html>";
|
|
@@ -20,11 +21,31 @@ function injectRSCPayload(rscStream, { nonce } = {}) {
|
|
|
20
21
|
let rscReader = null;
|
|
21
22
|
let buffered = [];
|
|
22
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
|
+
}
|
|
23
44
|
function flushBufferedChunks(controller) {
|
|
24
45
|
for (let chunk of buffered) {
|
|
25
46
|
let buf = decoder.decode(chunk, { stream: true });
|
|
26
47
|
if (buf.endsWith(trailer)) buf = buf.slice(0, -14);
|
|
27
|
-
controller
|
|
48
|
+
if (!tryEnqueue(controller, encoder.encode(buf))) return;
|
|
28
49
|
}
|
|
29
50
|
buffered.length = 0;
|
|
30
51
|
timeout = null;
|
|
@@ -49,18 +70,10 @@ function injectRSCPayload(rscStream, { nonce } = {}) {
|
|
|
49
70
|
clearTimeout(timeout);
|
|
50
71
|
flushBufferedChunks(controller);
|
|
51
72
|
}
|
|
52
|
-
controller
|
|
73
|
+
tryEnqueue(controller, encoder.encode("</body></html>"));
|
|
53
74
|
},
|
|
54
75
|
async cancel(reason) {
|
|
55
|
-
|
|
56
|
-
if (timeout) {
|
|
57
|
-
clearTimeout(timeout);
|
|
58
|
-
timeout = null;
|
|
59
|
-
}
|
|
60
|
-
buffered.length = 0;
|
|
61
|
-
if (rscReader) await rscReader.cancel(reason).catch(() => {});
|
|
62
|
-
else await rscStream.cancel(reason).catch(() => {});
|
|
63
|
-
resolveFlightDataPromise();
|
|
76
|
+
await stop(reason);
|
|
64
77
|
}
|
|
65
78
|
});
|
|
66
79
|
}
|
|
@@ -87,9 +100,6 @@ function writeChunk(chunk, controller, nonce) {
|
|
|
87
100
|
let nonceAttr = nonce == null ? "" : ` nonce="${escapeAttribute(nonce)}"`;
|
|
88
101
|
controller.enqueue(encoder.encode(`<script${nonceAttr}>${escapeScript(`(self.__FLIGHT_DATA||=[]).push(${chunk})`)}<\/script>`));
|
|
89
102
|
}
|
|
90
|
-
function escapeAttribute(value) {
|
|
91
|
-
return value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
92
|
-
}
|
|
93
103
|
function escapeScript(script) {
|
|
94
104
|
return script.replace(/<!--/g, "<\\!--").replace(/<\/(script)/gi, "</\\$1");
|
|
95
105
|
}
|
|
@@ -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 & {
|
|
@@ -116,6 +117,13 @@ type RouteDiscovery = {
|
|
|
116
117
|
* encoding an {@link unstable_RSCPayload} for consumption by an [RSC](https://react.dev/reference/rsc/server-components)
|
|
117
118
|
* enabled client router.
|
|
118
119
|
*
|
|
120
|
+
* Treat every React Server Function as a public endpoint. Server Functions are
|
|
121
|
+
* not inherently associated with a route. Any route middleware that runs is
|
|
122
|
+
* selected from the URL used to call a Server Function, but the client controls
|
|
123
|
+
* both the Server Function identifier and the URL. Perform all access control
|
|
124
|
+
* checks within each Server Function, or use a route action for
|
|
125
|
+
* middleware-driven access control.
|
|
126
|
+
*
|
|
119
127
|
* @example
|
|
120
128
|
* import {
|
|
121
129
|
* createTemporaryReferenceSet,
|
|
@@ -197,7 +205,7 @@ declare function matchRSCServerRequest({
|
|
|
197
205
|
onError,
|
|
198
206
|
request,
|
|
199
207
|
routes,
|
|
200
|
-
generateResponse
|
|
208
|
+
generateResponse: encodeResponse
|
|
201
209
|
}: {
|
|
202
210
|
allowedActionOrigins?: string[];
|
|
203
211
|
createTemporaryReferenceSet: () => unknown;
|
|
@@ -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
|
*
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
11
|
import { isRouteErrorResponse } from "../router/utils.js";
|
|
12
|
-
import { hasInvalidProtocol } from "../router/router.js";
|
|
12
|
+
import { createDataRouteMatcher, hasInvalidProtocol } from "../router/router.js";
|
|
13
13
|
import { RSCRouterContext } from "../context.js";
|
|
14
14
|
import { decodeRedirectErrorDigest, decodeRouteErrorResponseDigest } from "../errors.js";
|
|
15
|
-
import {
|
|
15
|
+
import { escapeAttribute } from "../dom/ssr/markup.js";
|
|
16
16
|
import { shouldHydrateRouteLoader } from "../dom/ssr/routes.js";
|
|
17
17
|
import { FrameworkContext } from "../dom/ssr/components.js";
|
|
18
18
|
import { StaticRouterProvider, createStaticRouter } from "../dom/server.js";
|
|
@@ -179,7 +179,7 @@ async function routeRSCServerRequest({ request, serverResponse, createFromReadab
|
|
|
179
179
|
const redirectTransform = new TransformStream({ flush(controller) {
|
|
180
180
|
if (renderRedirect) {
|
|
181
181
|
if (hasInvalidProtocol(renderRedirect.location)) return;
|
|
182
|
-
controller.enqueue(new TextEncoder().encode(`<meta http-equiv="refresh" content="0;url=${
|
|
182
|
+
controller.enqueue(new TextEncoder().encode(`<meta http-equiv="refresh" content="0;url=${escapeAttribute(renderRedirect.location)}"/>`));
|
|
183
183
|
}
|
|
184
184
|
} });
|
|
185
185
|
if (!hydrate) return new Response(html.pipeThrough(redirectTransform), {
|
|
@@ -258,7 +258,7 @@ async function routeRSCServerRequest({ request, serverResponse, createFromReadab
|
|
|
258
258
|
const retryRedirectTransform = new TransformStream({ flush(controller) {
|
|
259
259
|
if (retryRedirect) {
|
|
260
260
|
if (hasInvalidProtocol(retryRedirect.location)) return;
|
|
261
|
-
controller.enqueue(new TextEncoder().encode(`<meta http-equiv="refresh" content="0;url=${
|
|
261
|
+
controller.enqueue(new TextEncoder().encode(`<meta http-equiv="refresh" content="0;url=${escapeAttribute(retryRedirect.location)}"/>`));
|
|
262
262
|
}
|
|
263
263
|
} });
|
|
264
264
|
if (!hydrate) return new Response(html.pipeThrough(retryRedirectTransform), {
|
|
@@ -333,6 +333,24 @@ function RSCStaticRouter({ getPayload, nonce }) {
|
|
|
333
333
|
if (payload.type !== "render") return null;
|
|
334
334
|
let patchedLoaderData = { ...payload.loaderData };
|
|
335
335
|
for (const match of payload.matches) if (shouldHydrateRouteLoader(match.id, match.clientLoader, match.hasLoader, false) && (match.hydrateFallbackElement || !match.hasLoader)) delete patchedLoaderData[match.id];
|
|
336
|
+
const routes = payload.matches.reduceRight((previous, match) => {
|
|
337
|
+
const route = {
|
|
338
|
+
id: match.id,
|
|
339
|
+
action: match.hasAction || !!match.clientAction,
|
|
340
|
+
element: match.element,
|
|
341
|
+
errorElement: match.errorElement,
|
|
342
|
+
handle: match.handle,
|
|
343
|
+
hydrateFallbackElement: match.hydrateFallbackElement,
|
|
344
|
+
index: match.index,
|
|
345
|
+
loader: match.hasLoader || !!match.clientLoader,
|
|
346
|
+
path: match.path,
|
|
347
|
+
shouldRevalidate: match.shouldRevalidate
|
|
348
|
+
};
|
|
349
|
+
if (previous.length > 0) route.children = previous;
|
|
350
|
+
return [route];
|
|
351
|
+
}, []);
|
|
352
|
+
const dataRouteMatcher = createDataRouteMatcher({}, payload.basename || "/");
|
|
353
|
+
dataRouteMatcher.update(routes);
|
|
336
354
|
const context = {
|
|
337
355
|
get _deepestRenderedBoundaryId() {
|
|
338
356
|
return decoded._deepestRenderedBoundaryId ?? null;
|
|
@@ -348,6 +366,7 @@ function RSCStaticRouter({ getPayload, nonce }) {
|
|
|
348
366
|
loaderHeaders: {},
|
|
349
367
|
location: payload.location,
|
|
350
368
|
statusCode: 200,
|
|
369
|
+
_match: (locationArg) => dataRouteMatcher.match(locationArg),
|
|
351
370
|
matches: payload.matches.map((match) => ({
|
|
352
371
|
params: match.params,
|
|
353
372
|
pathname: match.pathname,
|
|
@@ -363,22 +382,7 @@ function RSCStaticRouter({ getPayload, nonce }) {
|
|
|
363
382
|
}
|
|
364
383
|
}))
|
|
365
384
|
};
|
|
366
|
-
const router = createStaticRouter(
|
|
367
|
-
const route = {
|
|
368
|
-
id: match.id,
|
|
369
|
-
action: match.hasAction || !!match.clientAction,
|
|
370
|
-
element: match.element,
|
|
371
|
-
errorElement: match.errorElement,
|
|
372
|
-
handle: match.handle,
|
|
373
|
-
hydrateFallbackElement: match.hydrateFallbackElement,
|
|
374
|
-
index: match.index,
|
|
375
|
-
loader: match.hasLoader || !!match.clientLoader,
|
|
376
|
-
path: match.path,
|
|
377
|
-
shouldRevalidate: match.shouldRevalidate
|
|
378
|
-
};
|
|
379
|
-
if (previous.length > 0) route.children = previous;
|
|
380
|
-
return [route];
|
|
381
|
-
}, []), context);
|
|
385
|
+
const router = createStaticRouter(routes, context);
|
|
382
386
|
const frameworkContext = {
|
|
383
387
|
future: {},
|
|
384
388
|
isSpaMode: false,
|
|
@@ -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,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
|
*
|
|
@@ -8,11 +8,10 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import { matchRoutesImpl } from "../router/utils.js";
|
|
12
11
|
import invariant from "./invariant.js";
|
|
13
12
|
//#region lib/server-runtime/routeMatching.ts
|
|
14
|
-
function matchServerRoutes(manifest,
|
|
15
|
-
let matches =
|
|
13
|
+
function matchServerRoutes(manifest, staticHandler, pathname) {
|
|
14
|
+
let matches = staticHandler.match(pathname);
|
|
16
15
|
if (!matches) return null;
|
|
17
16
|
return matches.map((match) => {
|
|
18
17
|
let route = manifest[match.route.id];
|
|
@@ -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,
|
|
@@ -90,12 +90,16 @@ function derive(build, mode) {
|
|
|
90
90
|
}
|
|
91
91
|
let manifestUrl = getManifestPath(build.routeDiscovery.manifestPath, build.basename);
|
|
92
92
|
if (build.routeDiscovery.mode === "lazy" && requestUrl.pathname === manifestUrl) try {
|
|
93
|
-
return await handleManifestRequest(build, staticHandler
|
|
93
|
+
return await handleManifestRequest(build, staticHandler, requestUrl);
|
|
94
94
|
} catch (e) {
|
|
95
95
|
handleError(e);
|
|
96
96
|
return new Response("Unknown Server Error", { status: 500 });
|
|
97
97
|
}
|
|
98
|
-
|
|
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
|
+
});
|
|
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, {
|
|
101
105
|
url: createDataFunctionUrl(request, normalizedPath),
|
|
@@ -173,7 +177,7 @@ const createRequestHandler = (build, mode) => {
|
|
|
173
177
|
return _requestHandler(request, initialContext);
|
|
174
178
|
};
|
|
175
179
|
};
|
|
176
|
-
async function handleManifestRequest(build,
|
|
180
|
+
async function handleManifestRequest(build, staticHandler, url) {
|
|
177
181
|
if (url.toString().length > 7680) return new Response(null, {
|
|
178
182
|
statusText: "Bad Request",
|
|
179
183
|
status: 400
|
|
@@ -188,7 +192,7 @@ async function handleManifestRequest(build, dataRoutes, branches, url) {
|
|
|
188
192
|
let paths = new Set(pathParam.split(",").filter(Boolean));
|
|
189
193
|
for (let path of paths) {
|
|
190
194
|
if (!path.startsWith("/")) path = `/${path}`;
|
|
191
|
-
let matches = matchServerRoutes(build.routes,
|
|
195
|
+
let matches = matchServerRoutes(build.routes, staticHandler, path);
|
|
192
196
|
if (matches) for (let match of matches) {
|
|
193
197
|
let routeId = match.route.id;
|
|
194
198
|
let route = build.assets.routes[routeId];
|
|
@@ -252,11 +256,13 @@ 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,
|
|
259
|
-
branches:
|
|
265
|
+
branches: [],
|
|
260
266
|
routeModules: createEntryRouteModules(build.routes),
|
|
261
267
|
staticHandlerContext: context,
|
|
262
268
|
criticalCss,
|
|
@@ -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;
|
|
@@ -291,6 +299,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
|
|
|
291
299
|
};
|
|
292
300
|
entryContext = {
|
|
293
301
|
...entryContext,
|
|
302
|
+
branches: [],
|
|
294
303
|
staticHandlerContext: context,
|
|
295
304
|
serverHandoffString: createServerHandoffString(baseServerHandoff),
|
|
296
305
|
serverHandoffStream: encodeViaTurboStream(state, request.signal, build.entry.module.streamTimeout, serverMode),
|
|
@@ -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 };
|