vinext 1.0.0-beta.11 → 1.0.0-beta.13
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/README.md +39 -12
- package/dist/build/action-owner-manifest.js +23 -5
- package/dist/build/lifecycle.d.ts +42 -0
- package/dist/build/lifecycle.js +246 -0
- package/dist/build/nitro-route-rules.js +1 -1
- package/dist/build/pages-client-assets-module.d.ts +0 -3
- package/dist/build/pages-client-assets-module.js +1 -13
- package/dist/build/precompress.js +1 -1
- package/dist/build/prerender-paths.d.ts +1 -1
- package/dist/build/prerender-paths.js +6 -6
- package/dist/build/prerender-server-pool.js +1 -1
- package/dist/build/prerender.d.ts +1 -1
- package/dist/build/prerender.js +5 -5
- package/dist/build/preview-credentials.d.ts +1 -1
- package/dist/build/preview-credentials.js +2 -2
- package/dist/build/report.js +1 -1
- package/dist/build/run-prerender.d.ts +2 -2
- package/dist/build/run-prerender.js +5 -5
- package/dist/build/standalone.js +2 -2
- package/dist/cli-args.d.ts +5 -13
- package/dist/cli-args.js +2 -45
- package/dist/cli-dev-config.d.ts +6 -2
- package/dist/cli-dev-config.js +160 -3
- package/dist/cli.js +104 -439
- package/dist/config/config-matchers.js +1 -1
- package/dist/config/next-config.d.ts +2 -2
- package/dist/config/next-config.js +5 -5
- package/dist/config/prerender.d.ts +3 -0
- package/dist/config/prerender.js +8 -2
- package/dist/entries/app-browser-entry.js +1 -1
- package/dist/entries/app-rsc-entry.d.ts +2 -0
- package/dist/entries/app-rsc-entry.js +25 -5
- package/dist/entries/pages-client-entry.d.ts +1 -0
- package/dist/entries/pages-client-entry.js +17 -2
- package/dist/index.d.ts +6 -8
- package/dist/index.js +282 -105
- package/dist/init-cloudflare.d.ts +3 -2
- package/dist/init-cloudflare.js +117 -5
- package/dist/init-platform.d.ts +2 -0
- package/dist/init-platform.js +9 -3
- package/dist/init.d.ts +7 -5
- package/dist/init.js +41 -22
- package/dist/plugins/dynamic-preload-metadata.js +1 -1
- package/dist/plugins/extensionless-dynamic-import.js +2 -2
- package/dist/plugins/fonts.js +1 -1
- package/dist/plugins/ignore-dynamic-requests.js +1 -1
- package/dist/plugins/import-meta-url.js +1 -1
- package/dist/plugins/instrumentation-client.js +1 -1
- package/dist/plugins/og-assets.js +32 -13
- package/dist/plugins/og-harfbuzz.d.ts +24 -0
- package/dist/plugins/og-harfbuzz.js +260 -0
- package/dist/plugins/optimize-imports.js +1 -1
- package/dist/plugins/require-condition-resolution.js +2 -2
- package/dist/plugins/require-context.js +2 -2
- package/dist/plugins/typeof-window.js +1 -1
- package/dist/plugins/use-cache-callable.d.ts +0 -2
- package/dist/plugins/use-cache-callable.js +40 -22
- package/dist/plugins/worker-image-imports.js +1 -1
- package/dist/routing/app-route-graph.js +1 -1
- package/dist/routing/app-router.js +1 -1
- package/dist/routing/pages-router.js +1 -1
- package/dist/server/app-action-forwarding.js +1 -1
- package/dist/server/app-browser-entry.js +1 -0
- package/dist/server/app-browser-error.js +1 -1
- package/dist/server/app-elements-wire.js +2 -2
- package/dist/server/app-middleware.js +1 -1
- package/dist/server/app-optimistic-routing.js +1 -1
- package/dist/server/app-page-cache-finalizer.d.ts +1 -0
- package/dist/server/app-page-cache-finalizer.js +14 -2
- package/dist/server/app-page-dispatch.js +1 -1
- package/dist/server/app-page-element-builder.js +3 -2
- package/dist/server/app-page-probe.js +3 -3
- package/dist/server/app-page-render.js +1 -0
- package/dist/server/app-page-request.d.ts +2 -0
- package/dist/server/app-page-request.js +16 -12
- package/dist/server/app-request-stage-dispatch.js +1 -1
- package/dist/server/app-request-stage-independent-entry.js +2 -2
- package/dist/server/app-route-handler-dispatch.d.ts +1 -0
- package/dist/server/app-route-handler-dispatch.js +3 -2
- package/dist/server/app-route-handler-execution.d.ts +1 -0
- package/dist/server/app-route-handler-execution.js +2 -2
- package/dist/server/app-route-handler-runtime.js +1 -1
- package/dist/server/app-router-entry.js +2 -2
- package/dist/server/app-rsc-handler.d.ts +9 -2
- package/dist/server/app-rsc-handler.js +30 -10
- package/dist/server/app-rsc-response-stage.js +6 -3
- package/dist/server/app-rsc-route-matching.js +1 -1
- package/dist/server/app-server-action-execution.js +35 -6
- package/dist/server/app-ssr-entry.js +7 -2
- package/dist/server/app-ssr-stream.js +25 -6
- package/dist/server/app-worker-stages.d.ts +4 -1
- package/dist/server/app-worker-stages.js +4 -4
- package/dist/server/artifact-compatibility.js +1 -1
- package/dist/server/client-reuse-manifest.js +1 -1
- package/dist/server/dev-lockfile.d.ts +1 -1
- package/dist/server/dev-lockfile.js +4 -1
- package/dist/server/dev-server.d.ts +1 -1
- package/dist/server/dev-server.js +28 -6
- package/dist/server/dev-stack-sourcemap.js +1 -1
- package/dist/server/html.d.ts +0 -20
- package/dist/server/html.js +16 -1
- package/dist/server/instrumentation.d.ts +4 -9
- package/dist/server/instrumentation.js +10 -15
- package/dist/server/isr-cache.js +3 -3
- package/dist/server/metadata-route-response.d.ts +1 -0
- package/dist/server/metadata-route-response.js +65 -0
- package/dist/server/middleware-runtime.js +3 -3
- package/dist/server/pages-asset-tags.d.ts +1 -0
- package/dist/server/pages-asset-tags.js +37 -2
- package/dist/server/pages-client-assets.d.ts +7 -0
- package/dist/server/pages-data-route.js +1 -1
- package/dist/server/pages-dev-hydration.d.ts +6 -0
- package/dist/server/pages-dev-hydration.js +19 -7
- package/dist/server/pages-document-initial-props.d.ts +1 -0
- package/dist/server/pages-document-initial-props.js +1 -1
- package/dist/server/pages-page-data.js +2 -2
- package/dist/server/pages-page-handler.js +5 -2
- package/dist/server/pages-page-response.d.ts +1 -0
- package/dist/server/pages-page-response.js +3 -2
- package/dist/server/pages-request-pipeline.js +3 -3
- package/dist/server/pages-request-stage-entry.js +3 -3
- package/dist/server/pages-revalidate.js +1 -1
- package/dist/server/prerender-route-params.js +1 -1
- package/dist/server/prod-server.js +19 -13
- package/dist/server/request-pipeline.js +2 -2
- package/dist/server/rsc-stream-hints.d.ts +12 -0
- package/dist/server/rsc-stream-hints.js +70 -35
- package/dist/server/seed-cache.js +3 -4
- package/dist/server/socket-error-backstop.js +1 -1
- package/dist/shims/cache-callable-runtime.d.ts +38 -0
- package/dist/shims/cache-callable-runtime.js +162 -11
- package/dist/shims/cache-runtime.d.ts +6 -8
- package/dist/shims/cache-runtime.js +89 -24
- package/dist/shims/constants.js +1 -1
- package/dist/shims/dynamic-preload-chunks.js +6 -2
- package/dist/shims/font-local.js +1 -1
- package/dist/shims/form.js +1 -1
- package/dist/shims/head.js +1 -1
- package/dist/shims/headers.js +2 -2
- package/dist/shims/image-config.js +2 -0
- package/dist/shims/internal/app-page-props-cache-key.d.ts +29 -0
- package/dist/shims/internal/app-page-props-cache-key.js +53 -1
- package/dist/shims/internal/format-url-object.d.ts +7 -0
- package/dist/shims/internal/format-url-object.js +53 -0
- package/dist/shims/internal/normalize-router-href.d.ts +15 -0
- package/dist/shims/internal/normalize-router-href.js +41 -0
- package/dist/shims/internal/pages-data-target.d.ts +4 -1
- package/dist/shims/internal/pages-data-target.js +28 -35
- package/dist/shims/internal/route-pattern-for-warning.d.ts +2 -2
- package/dist/shims/internal/route-pattern-for-warning.js +3 -3
- package/dist/shims/link.js +31 -92
- package/dist/shims/metadata.js +5 -4
- package/dist/shims/navigation.js +2 -2
- package/dist/shims/router-state.js +1 -1
- package/dist/shims/router.d.ts +8 -7
- package/dist/shims/router.js +312 -148
- package/dist/shims/script-nonce-context.d.ts +4 -1
- package/dist/shims/script-nonce-context.js +15 -6
- package/dist/shims/server.js +3 -3
- package/dist/utils/built-asset-url.js +1 -1
- package/dist/utils/client-runtime-metadata.d.ts +6 -0
- package/dist/utils/client-runtime-metadata.js +16 -0
- package/dist/utils/lazy-chunks.js +1 -1
- package/dist/utils/project.d.ts +1 -11
- package/dist/utils/project.js +20 -29
- package/dist/utils/react-version.d.ts +3 -1
- package/dist/utils/react-version.js +19 -1
- package/dist/utils/vite-cli-invocation.d.ts +21 -0
- package/dist/utils/vite-cli-invocation.js +144 -0
- package/package.json +10 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { buildRequestHeadersFromMiddlewareResponse } from "../utils/middleware-request-headers.js";
|
|
1
2
|
import { patternToNextFormat } from "../routing/route-validation.js";
|
|
2
3
|
import "./headers.js";
|
|
3
|
-
import { buildRequestHeadersFromMiddlewareResponse } from "../utils/middleware-request-headers.js";
|
|
4
4
|
import { RequestCookies, ResponseCookies } from "../shims/server.js";
|
|
5
5
|
import { attachRequestCfMetadata, processMiddlewareHeaders, validateCsrfOrigin } from "./request-pipeline.js";
|
|
6
6
|
import { mergeMiddlewareResponseHeaders } from "./middleware-response-headers.js";
|
|
@@ -848,6 +848,7 @@ function registerServerActionCallback() {
|
|
|
848
848
|
navigationPlanner,
|
|
849
849
|
performHardNavigation: (url, historyMode) => browserNavigationController.performHardNavigation(url, historyMode),
|
|
850
850
|
renderRedirectPayload(elements, target, actionInitiation, revalidation) {
|
|
851
|
+
if (browserNavigationController.isCurrentNavigation(actionInitiation.navigationId)) getNavigationRuntime()?.functions.notifyLinkNavigationStart?.();
|
|
851
852
|
const hashIdx = target.href.indexOf("#");
|
|
852
853
|
const hash = hashIdx !== -1 ? target.href.slice(hashIdx) : "";
|
|
853
854
|
const actionScrollIntent = beginAppRouterScrollIntent(hash || null);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isNavigationSignalError } from "../utils/navigation-signal.js";
|
|
2
1
|
import { isUnknownRecord } from "../utils/record.js";
|
|
2
|
+
import { isNavigationSignalError } from "../utils/navigation-signal.js";
|
|
3
3
|
//#region src/server/app-browser-error.ts
|
|
4
4
|
function isImplicitRootErrorBoundary(errorInfo) {
|
|
5
5
|
if (!isUnknownRecord(errorInfo.errorBoundary)) return false;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isUnknownRecord } from "../utils/record.js";
|
|
2
2
|
import { compareStrings } from "../utils/compare.js";
|
|
3
|
+
import { isInterceptionMatchedUrlPath } from "./normalize-path.js";
|
|
3
4
|
import { createAppElementsWireSlotId, isAppElementsWireSlotId, parseAppElementsWireElementKey } from "./app-elements-wire-key.js";
|
|
4
|
-
import { isUnknownRecord } from "../utils/record.js";
|
|
5
5
|
import { createArtifactCompatibilityEnvelope, parseArtifactCompatibilityEnvelope } from "./artifact-compatibility.js";
|
|
6
6
|
import { releaseAppElementRenderDependency } from "./app-render-dependency.js";
|
|
7
7
|
import { isValidElement } from "react";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VINEXT_MW_CTX_HEADER } from "../utils/protocol-headers.js";
|
|
2
|
-
import { FLIGHT_HEADERS } from "./headers.js";
|
|
3
2
|
import { buildRequestHeadersFromMiddlewareResponse } from "../utils/middleware-request-headers.js";
|
|
4
3
|
import { isExternalUrl } from "../utils/external-url.js";
|
|
4
|
+
import { FLIGHT_HEADERS } from "./headers.js";
|
|
5
5
|
import { internalServerErrorResponse } from "./http-error-responses.js";
|
|
6
6
|
import { cloneRequestWithHeaders, processMiddlewareHeaders } from "./request-pipeline.js";
|
|
7
7
|
import { executeMiddleware } from "./middleware-runtime.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { isUnknownRecord } from "../utils/record.js";
|
|
1
2
|
import { buildParams, decodeMatchedParams, splitPathnameForRouteMatch } from "../routing/utils.js";
|
|
2
3
|
import { stripBasePath } from "../utils/base-path.js";
|
|
3
|
-
import { isUnknownRecord } from "../utils/record.js";
|
|
4
4
|
import { AppElementsWire } from "./app-elements-wire.js";
|
|
5
5
|
import "./app-elements.js";
|
|
6
6
|
import { extractRawRoutePatternParams, matchRoutePattern } from "../routing/route-pattern.js";
|
|
@@ -24,6 +24,7 @@ type FinalizeAppPageCacheabilityEvaluationOptions = {
|
|
|
24
24
|
revalidateSeconds: number | null;
|
|
25
25
|
};
|
|
26
26
|
type FinalizeAppPageHtmlCacheResponseOptions = {
|
|
27
|
+
bypassInterceptionContextCache?: boolean;
|
|
27
28
|
capturedDynamicUsageBeforeContextCleanup?: () => boolean;
|
|
28
29
|
capturedRscDataPromise: Promise<ArrayBuffer> | null;
|
|
29
30
|
cleanPathname: string;
|
|
@@ -19,7 +19,7 @@ function applyPendingDynamicCdnHeaders(headers, tags, options = {}) {
|
|
|
19
19
|
});
|
|
20
20
|
finalizePendingCacheStateHeaders(headers, options);
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function applyUncacheableVariantNoStoreHeaders(headers, options = {}) {
|
|
23
23
|
applyCdnResponseHeaders(headers, { cacheControl: NO_STORE_CACHE_CONTROL });
|
|
24
24
|
finalizePendingCacheStateHeaders(headers, {
|
|
25
25
|
...options,
|
|
@@ -114,6 +114,18 @@ function finalizeAppPageHtmlCacheResponse(response, options) {
|
|
|
114
114
|
}
|
|
115
115
|
return probeResponse;
|
|
116
116
|
}
|
|
117
|
+
if (options.bypassInterceptionContextCache === true) {
|
|
118
|
+
options.capturedRscDataPromise?.catch(() => {});
|
|
119
|
+
const headers = new Headers(response.headers);
|
|
120
|
+
applyUncacheableVariantNoStoreHeaders(headers, { omitCacheState: options.omitPendingDynamicCacheState === true });
|
|
121
|
+
const clientResponse = new Response(response.body, {
|
|
122
|
+
status: response.status,
|
|
123
|
+
statusText: response.statusText,
|
|
124
|
+
headers
|
|
125
|
+
});
|
|
126
|
+
markFrameworkLinkHeaders(clientResponse.headers, options.linkHeader);
|
|
127
|
+
return clientResponse;
|
|
128
|
+
}
|
|
117
129
|
if (!response.body) return response;
|
|
118
130
|
const [streamForClient, streamForCache] = response.body.tee();
|
|
119
131
|
const htmlKey = options.isrHtmlKey(options.cleanPathname);
|
|
@@ -184,7 +196,7 @@ function finalizeAppPageRscCacheResponse(response, options) {
|
|
|
184
196
|
const isUncacheableVariant = Boolean(options.mountedSlotsHeader) || options.bypassInterceptionContextCache === true;
|
|
185
197
|
if (options.preserveClientResponseHeaders === true && !isUncacheableVariant) return response;
|
|
186
198
|
const clientHeaders = new Headers(response.headers);
|
|
187
|
-
if (isUncacheableVariant)
|
|
199
|
+
if (isUncacheableVariant) applyUncacheableVariantNoStoreHeaders(clientHeaders, { omitCacheState: options.omitPendingDynamicCacheState === true });
|
|
188
200
|
else applyPendingDynamicCdnHeaders(clientHeaders, options.getPageTags(), { omitCacheState: options.omitPendingDynamicCacheState === true });
|
|
189
201
|
return new Response(response.body, {
|
|
190
202
|
status: response.status,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { closeAfterResponse, createRequestContext, runWithRequestContext } from "../shims/unified-request-context.js";
|
|
2
|
-
import { getRequestExecutionContext } from "../shims/request-context.js";
|
|
3
2
|
import "../utils/protocol-headers.js";
|
|
3
|
+
import { getRequestExecutionContext } from "../shims/request-context.js";
|
|
4
4
|
import { VINEXT_INTERCEPTION_ID_HEADER, VINEXT_RSC_VARY_HEADER } from "./app-rsc-vary.js";
|
|
5
5
|
import "./headers.js";
|
|
6
6
|
import { beginRouteCacheability, isRouteCacheabilityIdentityProbe, isRouteCacheabilityProbe, markRouteCacheabilityPatternDynamic } from "../shims/cacheability-classification.js";
|
|
@@ -6,6 +6,7 @@ import "./app-elements.js";
|
|
|
6
6
|
import { createAppPageRenderIdentity } from "./app-page-render-identity.js";
|
|
7
7
|
import { matchRoutePattern } from "../routing/route-pattern.js";
|
|
8
8
|
import { makeThenableParams } from "../shims/thenable-params.js";
|
|
9
|
+
import { withUseCachePageMarker } from "../shims/internal/app-page-props-cache-key.js";
|
|
9
10
|
import { resolveAppPageBranchParams, resolveAppPageSegmentParams } from "./app-page-params.js";
|
|
10
11
|
import { resolveAppPageSpecialError } from "./app-page-execution.js";
|
|
11
12
|
import { prepareAppPageHead, resolveActiveParallelRouteHeadInputs } from "./app-page-head.js";
|
|
@@ -230,13 +231,13 @@ async function buildPageElements(options) {
|
|
|
230
231
|
if (isReactOwnedAppComponent(PageComponent)) {
|
|
231
232
|
const invocationProps = { ...props };
|
|
232
233
|
if (searchParams) invocationProps.searchParams = observePageSearchParamsAccess ? makeObservedAppPageSearchParamsThenable(pageSearchParams, { markDynamic: hasRequestSearchParams }) : makeThenableParams(pageSearchParams);
|
|
233
|
-
return createElement(PageComponent, invocationProps);
|
|
234
|
+
return createElement(PageComponent, withUseCachePageMarker(PageComponent, invocationProps));
|
|
234
235
|
}
|
|
235
236
|
const PageInvoker = () => {
|
|
236
237
|
const invocationProps = { ...props };
|
|
237
238
|
if (searchParams) invocationProps.searchParams = observePageSearchParamsAccess ? makeObservedAppPageSearchParamsThenable(pageSearchParams) : makeThenableParams(pageSearchParams);
|
|
238
239
|
try {
|
|
239
|
-
const result = invokeAppComponent(PageComponent, invocationProps);
|
|
240
|
+
const result = invokeAppComponent(PageComponent, withUseCachePageMarker(PageComponent, invocationProps));
|
|
240
241
|
if (isPromiseLike(result)) {
|
|
241
242
|
if (renderDependency) Promise.resolve().then(() => renderDependency.release());
|
|
242
243
|
return Promise.resolve(result).then((resolvedResult) => renderDependency ? renderAfterAppDependencies(resolvedResult, renderDependency.resultDependencies) : resolvedResult);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isPromiseLike } from "../utils/promise.js";
|
|
2
2
|
import { isNextRouterError } from "../shims/navigation-errors.js";
|
|
3
3
|
import "../shims/navigation-server.js";
|
|
4
|
-
import { markAppPagePropsForUseCache } from "../shims/internal/app-page-props-cache-key.js";
|
|
4
|
+
import { markAppPagePropsForUseCache, withUseCachePageMarker } from "../shims/internal/app-page-props-cache-key.js";
|
|
5
5
|
import { probeAppPageComponent, probeAppPageLayouts } from "./app-page-execution.js";
|
|
6
6
|
import { collectAppPageSearchParams } from "./app-page-head.js";
|
|
7
7
|
import { makeObservedAppPageSearchParamsThenable } from "./app-page-search-params-observation.js";
|
|
@@ -153,10 +153,10 @@ function probeAppPage(options) {
|
|
|
153
153
|
if (typeof pageComponent !== "function") return null;
|
|
154
154
|
const { pageSearchParams } = collectAppPageSearchParams(searchParams);
|
|
155
155
|
const asyncSearchParams = makeObservedAppPageSearchParamsThenable(pageSearchParams, { observeReactPromiseStatus: true });
|
|
156
|
-
const result = pageComponent(markAppPagePropsForUseCache({
|
|
156
|
+
const result = pageComponent(markAppPagePropsForUseCache(withUseCachePageMarker(pageComponent, {
|
|
157
157
|
params: asyncRouteParams,
|
|
158
158
|
searchParams: asyncSearchParams
|
|
159
|
-
}));
|
|
159
|
+
})));
|
|
160
160
|
if (isPromiseLike(result)) return result.then(async (resolved) => {
|
|
161
161
|
await probeReactServerSubtreeForDynamicUsage(resolved);
|
|
162
162
|
return resolved;
|
|
@@ -705,6 +705,7 @@ async function renderAppPageLifecycleImpl(options, renderSpan) {
|
|
|
705
705
|
});
|
|
706
706
|
if (options.isPrerender === true) return isrResponse;
|
|
707
707
|
return finalizeAppPageHtmlCacheResponse(isrResponse, {
|
|
708
|
+
bypassInterceptionContextCache: options.bypassInterceptionContextCache,
|
|
708
709
|
capturedDynamicUsageBeforeContextCleanup() {
|
|
709
710
|
return dynamicUsedBeforeContextCleanup;
|
|
710
711
|
},
|
|
@@ -35,7 +35,9 @@ export type ValidateAppPageDynamicParamsOptions = {
|
|
|
35
35
|
enforceStaticParamsOnly: boolean;
|
|
36
36
|
generateStaticParams?: GenerateStaticParams | GenerateStaticParamsSource | readonly (GenerateStaticParams | GenerateStaticParamsSource | null | undefined)[] | null;
|
|
37
37
|
isDynamicRoute: boolean;
|
|
38
|
+
optionalCatchAllParamNames?: readonly string[];
|
|
38
39
|
params: AppPageParams;
|
|
40
|
+
requiredParamNames?: readonly string[];
|
|
39
41
|
};
|
|
40
42
|
type ResolveAppPageGenerateStaticParamsSourcesOptions = {
|
|
41
43
|
layouts?: readonly (GenerateStaticParamsModule | null | undefined)[];
|
|
@@ -110,18 +110,21 @@ function resolveAppPageGenerateStaticParamsSources(options) {
|
|
|
110
110
|
}
|
|
111
111
|
return sources;
|
|
112
112
|
}
|
|
113
|
-
function areStaticParamsAllowed(params, staticParams, allowMissingValues = false) {
|
|
114
|
-
const paramKeys = Object.keys(params);
|
|
113
|
+
function areStaticParamsAllowed(params, staticParams, allowMissingValues = false, paramKeys = Object.keys(params), optionalCatchAllParamNames = []) {
|
|
115
114
|
const stringParamMatches = (value, staticValue) => value === encodeURIComponent(staticValue);
|
|
116
|
-
return staticParams.some((staticParamSet) =>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
115
|
+
return staticParams.some((staticParamSet) => {
|
|
116
|
+
if (!staticParamSet || typeof staticParamSet !== "object" || Array.isArray(staticParamSet)) return false;
|
|
117
|
+
return paramKeys.every((key) => {
|
|
118
|
+
const value = params[key];
|
|
119
|
+
const staticValue = staticParamSet[key];
|
|
120
|
+
if (!Object.hasOwn(staticParamSet, key)) return allowMissingValues;
|
|
121
|
+
if (value === void 0) return optionalCatchAllParamNames.includes(key) && (staticValue === void 0 || staticValue === null || staticValue === false || Array.isArray(staticValue) && staticValue.length === 0);
|
|
122
|
+
if (Array.isArray(value)) return Array.isArray(staticValue) && value.length === staticValue.length && value.every((part, index) => typeof staticValue[index] === "string" ? stringParamMatches(part, staticValue[index]) : part === staticValue[index]);
|
|
123
|
+
if (typeof staticValue === "string") return stringParamMatches(value, staticValue);
|
|
124
|
+
if (typeof staticValue === "number" || typeof staticValue === "boolean") return String(value) === String(staticValue);
|
|
125
|
+
return JSON.stringify(value) === JSON.stringify(staticValue);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
125
128
|
}
|
|
126
129
|
function remapStaticParamsToRouteParams(staticParams, source) {
|
|
127
130
|
if (!source.paramAliases) return [...staticParams];
|
|
@@ -227,9 +230,10 @@ async function validateAppPageDynamicParams(options) {
|
|
|
227
230
|
const result = await generateIndependentStaticParams(sources, chainedStaticParams, options.params);
|
|
228
231
|
if (result.validated) {
|
|
229
232
|
validatedIndependentResults = true;
|
|
230
|
-
if (!areStaticParamsAllowed(options.params, result.staticParams,
|
|
233
|
+
if (!areStaticParamsAllowed(options.params, result.staticParams, options.requiredParamNames === void 0, options.requiredParamNames, options.optionalCatchAllParamNames)) return notFoundResponse();
|
|
231
234
|
}
|
|
232
235
|
}
|
|
236
|
+
if (options.requiredParamNames && !validatedIndependentResults) return notFoundResponse();
|
|
233
237
|
if (chainedStaticParams && !validatedIndependentResults) {
|
|
234
238
|
if (!areStaticParamsAllowed(options.params, chainedStaticParams)) return notFoundResponse();
|
|
235
239
|
}
|
|
@@ -40,7 +40,7 @@ async function dispatchAppRequestStage(request, ctx, dispatchResponseStage, opti
|
|
|
40
40
|
draftModeCookie: null,
|
|
41
41
|
middlewareCookieOverlay: null,
|
|
42
42
|
prerenderDiscovery: options.prerenderDiscovery,
|
|
43
|
-
protocolVersion:
|
|
43
|
+
protocolVersion: 10,
|
|
44
44
|
requestOrigin: new URL(request.url).origin,
|
|
45
45
|
scriptNonce: null,
|
|
46
46
|
staticFileSignalToken,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { VINEXT_PRERENDER_SECRET_HEADER, VINEXT_REVALIDATE_HOST_HEADER } from "../utils/protocol-headers.js";
|
|
2
|
+
import { assetPrefixPathname, isNextStaticPath } from "../utils/asset-prefix.js";
|
|
1
3
|
import { runWithExecutionContext } from "../shims/request-context.js";
|
|
2
4
|
import "./server-globals.js";
|
|
3
|
-
import { VINEXT_PRERENDER_SECRET_HEADER, VINEXT_REVALIDATE_HOST_HEADER } from "../utils/protocol-headers.js";
|
|
4
5
|
import "./app-rsc-vary.js";
|
|
5
6
|
import { VINEXT_CACHEABILITY_PROBE_QUERY_PARAM, VINEXT_EXPECTED_WORKER_VERSION_HEADER } from "./headers.js";
|
|
6
7
|
import { badRequestResponse, notFoundResponse } from "./http-error-responses.js";
|
|
@@ -8,7 +9,6 @@ import { isOpenRedirectShaped } from "./open-redirect.js";
|
|
|
8
9
|
import { cloneRequestWithHeaders, filterInternalHeaders } from "./request-pipeline.js";
|
|
9
10
|
import { applyCdnResponseIdentityHeaders, validateCdnRequest } from "./cache-control.js";
|
|
10
11
|
import { registerLazyDataCacheHandler } from "../shims/cache-handler.js";
|
|
11
|
-
import { assetPrefixPathname, isNextStaticPath } from "../utils/asset-prefix.js";
|
|
12
12
|
import { getImageOptimizer, handleConfiguredImageOptimization, isImageOptimizationPath } from "./image-optimization.js";
|
|
13
13
|
import { consumeFrameworkRequestRoute, traceFrameworkRequest } from "./request-tracing.js";
|
|
14
14
|
import { createStaticAssetRequest, finalizeMissingStaticAssetResponse, resolveStaticAssetSignal } from "./worker-utils.js";
|
|
@@ -18,6 +18,7 @@ type RouteHandlerBackgroundRegenerationErrorContext = {
|
|
|
18
18
|
type RouteHandlerBackgroundRegenerator = (key: string, renderFn: () => Promise<void>, errorContext?: RouteHandlerBackgroundRegenerationErrorContext) => void;
|
|
19
19
|
type DispatchAppRouteHandlerOptions = {
|
|
20
20
|
basePath?: string;
|
|
21
|
+
bypassSharedCache?: boolean;
|
|
21
22
|
cleanPathname: string;
|
|
22
23
|
clearRequestContext: () => void;
|
|
23
24
|
draftModeSecret: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { closeAfterResponse, createRequestContext, runWithRequestContext } from "../shims/unified-request-context.js";
|
|
2
|
-
import { getRequestExecutionContext } from "../shims/request-context.js";
|
|
3
2
|
import "../utils/protocol-headers.js";
|
|
3
|
+
import { getRequestExecutionContext } from "../shims/request-context.js";
|
|
4
4
|
import { reportRequestError } from "./instrumentation.js";
|
|
5
5
|
import { beginRouteCacheability, getRouteCacheabilityDynamicReason } from "../shims/cacheability-classification.js";
|
|
6
6
|
import { applyCdnResponseBuildIdentityHeaders } from "./cache-control.js";
|
|
@@ -91,7 +91,7 @@ async function dispatchAppRouteHandlerImpl(options) {
|
|
|
91
91
|
headers: { Allow: allowHeaderForOptions }
|
|
92
92
|
}));
|
|
93
93
|
const resolvedHandlerFn = isAppRouteHandlerFunction(handlerFn) ? handlerFn : void 0;
|
|
94
|
-
const shouldReadRouteCache = revalidateSeconds !== null && !getRouteCacheabilityDynamicReason() && shouldReadAppRouteHandlerCache({
|
|
94
|
+
const shouldReadRouteCache = options.bypassSharedCache !== true && revalidateSeconds !== null && !getRouteCacheabilityDynamicReason() && shouldReadAppRouteHandlerCache({
|
|
95
95
|
dynamicConfig: handler.dynamic,
|
|
96
96
|
handlerFn: resolvedHandlerFn,
|
|
97
97
|
isAutoHead,
|
|
@@ -160,6 +160,7 @@ async function dispatchAppRouteHandlerImpl(options) {
|
|
|
160
160
|
if (resolvedHandlerFn) {
|
|
161
161
|
const response = await executeAppRouteHandler({
|
|
162
162
|
basePath: options.basePath,
|
|
163
|
+
bypassSharedCache: options.bypassSharedCache,
|
|
163
164
|
buildPageCacheTags(pathname, extraTags) {
|
|
164
165
|
return buildRouteHandlerPageCacheTags(pathname, extraTags, route.routeSegments);
|
|
165
166
|
},
|
|
@@ -65,6 +65,7 @@ type RunAppRouteHandlerResult = {
|
|
|
65
65
|
export declare function applyDraftModeCachePolicy(response: Response, isDraftMode: boolean): Response;
|
|
66
66
|
type ExecuteAppRouteHandlerOptions = {
|
|
67
67
|
buildPageCacheTags: (pathname: string, extraTags: string[]) => string[];
|
|
68
|
+
bypassSharedCache?: boolean;
|
|
68
69
|
clearRequestContext: () => void;
|
|
69
70
|
cleanPathname: string;
|
|
70
71
|
executionContext: ExecutionContextLike | null;
|
|
@@ -214,7 +214,7 @@ async function executeAppRouteHandlerImpl(options) {
|
|
|
214
214
|
dynamicUsedInHandler = handlerResult.didAccessDynamicRequest() || dynamicUsedDuringCompletion || dynamicUsedInHandler;
|
|
215
215
|
}
|
|
216
216
|
const requestCacheabilityVeto = getRouteCacheabilityDynamicReason();
|
|
217
|
-
const responseMustStayPrivate = Boolean(options.handler.dynamic === "force-dynamic" || dynamicUsedInHandler || requestCacheabilityVeto || cleanupDeferredToBody);
|
|
217
|
+
const responseMustStayPrivate = Boolean(options.bypassSharedCache === true || options.handler.dynamic === "force-dynamic" || dynamicUsedInHandler || requestCacheabilityVeto || cleanupDeferredToBody);
|
|
218
218
|
if (dynamicUsedInHandler) markKnownDynamicAppRoute(options.routePattern);
|
|
219
219
|
const pendingCookies = options.getAndClearPendingCookies();
|
|
220
220
|
const handlerDraftCookie = options.getDraftModeCookieHeader() ?? handlerDraftCookieBeforeCompletion;
|
|
@@ -269,7 +269,7 @@ async function executeAppRouteHandlerImpl(options) {
|
|
|
269
269
|
isHead: options.isAutoHead
|
|
270
270
|
}), options.middlewareContext, middlewareMergeOptions), shouldApplyDraftPolicy);
|
|
271
271
|
const preserveHandlerPolicy = isRouteCacheabilityEvaluation() ? hasExplicitCacheablePolicy : handlerSetCachePolicy;
|
|
272
|
-
if (responseMustStayPrivate && !preserveHandlerPolicy) {
|
|
272
|
+
if (options.bypassSharedCache === true || responseMustStayPrivate && !preserveHandlerPolicy) {
|
|
273
273
|
const headers = new Headers(finalized.headers);
|
|
274
274
|
applyCdnResponseHeaders(headers, { cacheControl: NEVER_CACHE_CONTROL });
|
|
275
275
|
finalized = new Response(finalized.body, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { addBasePathToPathname } from "../utils/base-path.js";
|
|
2
1
|
import { buildRequestHeadersFromMiddlewareResponse } from "../utils/middleware-request-headers.js";
|
|
2
|
+
import { addBasePathToPathname } from "../utils/base-path.js";
|
|
3
3
|
import { NextRequest, RequestCookies, sealRequestCookies, sealRequestHeaders } from "../shims/server.js";
|
|
4
4
|
import { cloneRequestWithHeaders, cloneRequestWithUrl } from "./request-pipeline.js";
|
|
5
5
|
import { BUILT_IN_REQUEST_PROPERTIES } from "./app-route-request-built-ins.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { VINEXT_PRERENDER_ROUTE_PARAMS_HEADER, VINEXT_PRERENDER_SECRET_HEADER, VINEXT_REVALIDATE_HOST_HEADER } from "../utils/protocol-headers.js";
|
|
2
|
+
import { assetPrefixPathname, isNextStaticPath } from "../utils/asset-prefix.js";
|
|
1
3
|
import { runWithExecutionContext } from "../shims/request-context.js";
|
|
2
4
|
import "./server-globals.js";
|
|
3
|
-
import { VINEXT_PRERENDER_ROUTE_PARAMS_HEADER, VINEXT_PRERENDER_SECRET_HEADER, VINEXT_REVALIDATE_HOST_HEADER } from "../utils/protocol-headers.js";
|
|
4
5
|
import "./app-rsc-vary.js";
|
|
5
6
|
import { VINEXT_CACHEABILITY_PROBE_QUERY_PARAM } from "./headers.js";
|
|
6
7
|
import { badRequestResponse, notFoundResponse, notFoundStaticAssetResponse } from "./http-error-responses.js";
|
|
@@ -8,7 +9,6 @@ import { isOpenRedirectShaped } from "./open-redirect.js";
|
|
|
8
9
|
import { cloneRequestWithHeaders, filterInternalHeaders } from "./request-pipeline.js";
|
|
9
10
|
import { getCdnCacheAdapter } from "../shims/cdn-cache.js";
|
|
10
11
|
import { applyCdnResponseIdentityHeaders, validateCdnRequest } from "./cache-control.js";
|
|
11
|
-
import { assetPrefixPathname, isNextStaticPath } from "../utils/asset-prefix.js";
|
|
12
12
|
import { getImageOptimizer, handleConfiguredImageOptimization, isImageOptimizationPath } from "./image-optimization.js";
|
|
13
13
|
import { traceFrameworkRequest } from "./request-tracing.js";
|
|
14
14
|
import { createStaticAssetRequest, finalizeMissingStaticAssetResponse, resolveStaticAssetSignal } from "./worker-utils.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NextHeader, NextI18nConfig, NextRedirect, NextRewrite } from "../config/next-config.js";
|
|
2
1
|
import { VinextCacheabilityProbeMode } from "./multi-stage.js";
|
|
2
|
+
import { NextHeader, NextI18nConfig, NextRedirect, NextRewrite } from "../config/next-config.js";
|
|
3
3
|
import { ImageConfig } from "./image-optimization.js";
|
|
4
4
|
import { AppMiddlewareContext, ApplyAppMiddlewareResult } from "./app-middleware.js";
|
|
5
5
|
import { ClientReuseManifestParseResult } from "./client-reuse-manifest.js";
|
|
@@ -50,6 +50,7 @@ type AppRscRouteMatch<TRoute> = {
|
|
|
50
50
|
};
|
|
51
51
|
type DispatchMatchedPageOptions<TRoute> = {
|
|
52
52
|
bypassInterceptionContextCache: boolean;
|
|
53
|
+
cachePathname: string;
|
|
53
54
|
clientReuseManifest: ClientReuseManifestParseResult;
|
|
54
55
|
cleanPathname: string;
|
|
55
56
|
displayPathname: string;
|
|
@@ -86,6 +87,12 @@ type DispatchMatchedPageOptions<TRoute> = {
|
|
|
86
87
|
renderMode: AppRscRenderMode;
|
|
87
88
|
};
|
|
88
89
|
type DispatchMatchedRouteHandlerOptions<TRoute> = {
|
|
90
|
+
/**
|
|
91
|
+
* Legacy transported cache-bypass bit. Also covers request/cache route-identity
|
|
92
|
+
* divergence so the response cannot be published under another route's key.
|
|
93
|
+
*/
|
|
94
|
+
bypassInterceptionContextCache: boolean;
|
|
95
|
+
cachePathname: string;
|
|
89
96
|
cleanPathname: string;
|
|
90
97
|
middlewareContext: AppRscMiddlewareContext;
|
|
91
98
|
/**
|
|
@@ -207,7 +214,7 @@ export type CreateAppRscHandlerOptions<TRoute extends AppRscHandlerRoute> = {
|
|
|
207
214
|
/** Request-only entries dynamically load the response graph for local bypasses. */
|
|
208
215
|
renderResponseStageLocally?: RenderAppWorkerResponseStageLocally;
|
|
209
216
|
handleProgressiveActionRequest?: (options: HandleProgressiveActionRequestOptions<TRoute>) => Promise<Response | ProgressiveActionFormStateResult | null>;
|
|
210
|
-
handleMetadataRouteRequest?: (cleanPathname: string) => Promise<Response | null>;
|
|
217
|
+
handleMetadataRouteRequest?: (cleanPathname: string, routePathname: string) => Promise<Response | null>;
|
|
211
218
|
isMetadataRoutePath?: (cleanPathname: string) => boolean | Promise<boolean>;
|
|
212
219
|
getPrerenderMetadataRoutePaths?: () => Promise<unknown>;
|
|
213
220
|
createPprFallbackShells?: (route: Pick<AppRscHandlerRoute, "params" | "pattern" | "rootParamNames">, params: AppPageParams) => AppPagePprFallbackCacheShell[];
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { preserveFullyBufferedBodyMetadata } from "./fully-buffered-response.js";
|
|
2
2
|
import { closeAfterResponse, closeAfterResponseWithBody, createRequestContext, runWithRequestContext } from "../shims/unified-request-context.js";
|
|
3
|
+
import { PRERENDER_REVALIDATE_HEADER, VINEXT_MW_CTX_HEADER, VINEXT_PRERENDER_ROUTE_PARAMS_HEADER, VINEXT_PRERENDER_SPECULATIVE_HEADER, VINEXT_REVALIDATE_HOST_HEADER } from "../utils/protocol-headers.js";
|
|
4
|
+
import { hasMiddlewareRequestHeaderOverrides } from "../utils/middleware-request-headers.js";
|
|
5
|
+
import { requestContextFromRequest } from "../config/request-context.js";
|
|
6
|
+
import { isExternalUrl } from "../utils/external-url.js";
|
|
3
7
|
import { normalizePathnameForRouteMatchStrict } from "../routing/utils.js";
|
|
4
8
|
import { addBasePathToPathname, hasBasePath, stripBasePath } from "../utils/base-path.js";
|
|
5
9
|
import { patternToNextFormat } from "../routing/route-validation.js";
|
|
6
10
|
import { getRequestExecutionContext } from "../shims/request-context.js";
|
|
7
|
-
import { requestContextFromRequest } from "../config/request-context.js";
|
|
8
|
-
import { PRERENDER_REVALIDATE_HEADER, VINEXT_MW_CTX_HEADER, VINEXT_PRERENDER_ROUTE_PARAMS_HEADER, VINEXT_PRERENDER_SPECULATIVE_HEADER, VINEXT_REVALIDATE_HOST_HEADER } from "../utils/protocol-headers.js";
|
|
9
11
|
import "./app-rsc-vary.js";
|
|
10
12
|
import { ACTION_REVALIDATED_HEADER, FLIGHT_HEADERS, VINEXT_PARAMS_HEADER, VINEXT_RENDERED_PATH_AND_SEARCH_HEADER } from "./headers.js";
|
|
11
|
-
import { hasMiddlewareRequestHeaderOverrides } from "../utils/middleware-request-headers.js";
|
|
12
13
|
import { isInterceptionMatchedUrlPath, normalizePath } from "./normalize-path.js";
|
|
13
|
-
import { isExternalUrl } from "../utils/external-url.js";
|
|
14
14
|
import { badRequestResponse, notFoundResponse } from "./http-error-responses.js";
|
|
15
15
|
import { cloneRequestWithHeaders, cloneRequestWithUrl, filterInternalHeaders, normalizeTrailingSlash, resolvePublicFileRoute } from "./request-pipeline.js";
|
|
16
16
|
import { normalizeDefaultLocalePathname } from "./pages-i18n.js";
|
|
@@ -75,6 +75,9 @@ function haveSamePageParams(first, second) {
|
|
|
75
75
|
}
|
|
76
76
|
return true;
|
|
77
77
|
}
|
|
78
|
+
function rewriteCachePathname(sourcePathname, resolvedPathname) {
|
|
79
|
+
return `${sourcePathname}?__vinext_rewrite=${encodeURIComponent(resolvedPathname)}`;
|
|
80
|
+
}
|
|
78
81
|
function requestOptsOutOfWorkerResponseStage(request, options, scriptNonce, allowInternalRscDocumentFallback) {
|
|
79
82
|
if (request.method !== "GET" && request.method !== "HEAD") return true;
|
|
80
83
|
if (allowInternalRscDocumentFallback || scriptNonce !== void 0) return true;
|
|
@@ -406,6 +409,7 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
|
|
|
406
409
|
};
|
|
407
410
|
const renderMetadataRouteIfMatched = async () => {
|
|
408
411
|
if (!filesystemRouteEligible || (options.isMetadataRoute ? !options.isMetadataRoute(cleanPathname) : !options.handleMetadataRouteRequest)) return null;
|
|
412
|
+
const metadataRoutePathname = cleanPathnameIsRequestPathname ? requestCleanPathname : cleanPathname;
|
|
409
413
|
const metadataResponseStage = transportedResponseStage ?? options.renderResponseStageLocally;
|
|
410
414
|
if (metadataResponseStage) {
|
|
411
415
|
const response = await metadataResponseStage(responseStageRequest(), {
|
|
@@ -418,10 +422,11 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
|
|
|
418
422
|
isRscRequest,
|
|
419
423
|
middlewareCookieOverlay,
|
|
420
424
|
mountedSlotsHeader,
|
|
421
|
-
protocolVersion:
|
|
425
|
+
protocolVersion: 10,
|
|
422
426
|
requestOrigin: url.origin,
|
|
423
427
|
renderMode,
|
|
424
428
|
resolvedUrl,
|
|
429
|
+
routePathname: metadataRoutePathname,
|
|
425
430
|
scriptNonce: scriptNonce ?? null
|
|
426
431
|
});
|
|
427
432
|
if (response.headers.get("x-vinext-app-metadata-stage-no-match") === "1") {
|
|
@@ -430,7 +435,7 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
|
|
|
430
435
|
}
|
|
431
436
|
return response;
|
|
432
437
|
}
|
|
433
|
-
return options.handleMetadataRouteRequest?.(cleanPathname) ?? null;
|
|
438
|
+
return options.handleMetadataRouteRequest?.(cleanPathname, metadataRoutePathname) ?? null;
|
|
434
439
|
};
|
|
435
440
|
const applyConfigHeadersToResponseStage = async (response, preserveExistingPolicy = false) => {
|
|
436
441
|
const headers = new Headers(response.headers);
|
|
@@ -759,7 +764,7 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
|
|
|
759
764
|
matchKind,
|
|
760
765
|
middlewareCookieOverlay,
|
|
761
766
|
preHandlerHeaders: cache === "shared" && resourceKind === "page" && dataKind === "static" ? null : [...await loadPreHandlerResponseHeaders()],
|
|
762
|
-
protocolVersion:
|
|
767
|
+
protocolVersion: 10,
|
|
763
768
|
requestOrigin: url.origin,
|
|
764
769
|
resourceKind,
|
|
765
770
|
requestUrl: request.url,
|
|
@@ -938,7 +943,7 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
|
|
|
938
943
|
isRscRequest,
|
|
939
944
|
middlewareCookieOverlay,
|
|
940
945
|
mountedSlotsHeader,
|
|
941
|
-
protocolVersion:
|
|
946
|
+
protocolVersion: 10,
|
|
942
947
|
requestOrigin: url.origin,
|
|
943
948
|
renderMode,
|
|
944
949
|
resolvedUrl,
|
|
@@ -958,6 +963,16 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
|
|
|
958
963
|
return notFoundResponse({ headers });
|
|
959
964
|
}
|
|
960
965
|
const { route, params } = match;
|
|
966
|
+
const requestPathnameDiffersFromCachePath = requestCleanPathname !== cleanPathname;
|
|
967
|
+
const rawRequestPathnameIsObservable = isInterceptionMatch || route.routeHandler != null || typeof route.__loadRouteHandler === "function";
|
|
968
|
+
if ((!isInterceptionMatch || requestPathnameDiffersFromCachePath) && options.matchRequestRoute) {
|
|
969
|
+
const cachePathMatch = options.matchRoute(cleanPathname);
|
|
970
|
+
if (requestPathnameDiffersFromCachePath && rawRequestPathnameIsObservable || !cachePathMatch || cachePathMatch.route.pattern !== route.pattern || !haveSamePageParams(cachePathMatch.params, params)) {
|
|
971
|
+
bypassInterceptionContextCache = true;
|
|
972
|
+
setInterceptionResponseUncacheable(true);
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
const cachePathname = cleanPathnameIsRequestPathname ? cleanPathname : rewriteCachePathname(canonicalPathname, cleanPathname);
|
|
961
976
|
setFrameworkRequestRoute(patternToNextFormat(route.pattern), isRscRequest);
|
|
962
977
|
if (options.ensureRouteLoaded) await traceFindPageComponents(route.pattern, () => options.ensureRouteLoaded(route));
|
|
963
978
|
const resolvedSearchParams = getResolvedSearchParams();
|
|
@@ -1001,6 +1016,7 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
|
|
|
1001
1016
|
buildId: options.buildId,
|
|
1002
1017
|
cacheability: responseStageCacheability(resolvedUrl),
|
|
1003
1018
|
bypassInterceptionContextCache,
|
|
1019
|
+
cachePathname,
|
|
1004
1020
|
canUseCanonicalLoadingShell: route.canUseCanonicalLoadingShell === true,
|
|
1005
1021
|
canonicalPathname,
|
|
1006
1022
|
cleanPathname,
|
|
@@ -1013,7 +1029,7 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
|
|
|
1013
1029
|
middlewareCookieOverlay,
|
|
1014
1030
|
mountedSlotsHeader,
|
|
1015
1031
|
params,
|
|
1016
|
-
protocolVersion:
|
|
1032
|
+
protocolVersion: 10,
|
|
1017
1033
|
requestOrigin: url.origin,
|
|
1018
1034
|
renderMode,
|
|
1019
1035
|
resolvedUrl,
|
|
@@ -1024,6 +1040,8 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
|
|
|
1024
1040
|
const { setCurrentFetchSoftTags } = await import("../shims/fetch-cache.js");
|
|
1025
1041
|
setCurrentFetchSoftTags(buildPageCacheTags(cleanPathname, [], [...route.routeSegments], "route"));
|
|
1026
1042
|
return options.dispatchMatchedRouteHandler({
|
|
1043
|
+
bypassInterceptionContextCache,
|
|
1044
|
+
cachePathname,
|
|
1027
1045
|
cleanPathname,
|
|
1028
1046
|
middlewareContext,
|
|
1029
1047
|
params: route.isDynamic ? renderParams : null,
|
|
@@ -1037,6 +1055,7 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
|
|
|
1037
1055
|
buildId: options.buildId,
|
|
1038
1056
|
cacheability: responseStageCacheability(resolvedUrl),
|
|
1039
1057
|
bypassInterceptionContextCache,
|
|
1058
|
+
cachePathname,
|
|
1040
1059
|
canUseCanonicalLoadingShell: route.canUseCanonicalLoadingShell === true,
|
|
1041
1060
|
canonicalPathname,
|
|
1042
1061
|
cleanPathname,
|
|
@@ -1049,7 +1068,7 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
|
|
|
1049
1068
|
middlewareCookieOverlay,
|
|
1050
1069
|
mountedSlotsHeader,
|
|
1051
1070
|
params,
|
|
1052
|
-
protocolVersion:
|
|
1071
|
+
protocolVersion: 10,
|
|
1053
1072
|
requestOrigin: url.origin,
|
|
1054
1073
|
renderMode,
|
|
1055
1074
|
resolvedUrl,
|
|
@@ -1058,6 +1077,7 @@ async function handleAppRscRequest(options, request, preMiddlewareRequestContext
|
|
|
1058
1077
|
scriptNonce: scriptNonce ?? null
|
|
1059
1078
|
}).then(composeResponseStageResponse) : await options.dispatchMatchedPage({
|
|
1060
1079
|
bypassInterceptionContextCache,
|
|
1080
|
+
cachePathname,
|
|
1061
1081
|
clientReuseManifest,
|
|
1062
1082
|
cleanPathname,
|
|
1063
1083
|
displayPathname: canonicalPathname,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { preserveFullyBufferedBodyMetadata } from "./fully-buffered-response.js";
|
|
2
2
|
import { closeAfterResponse, closeAfterResponseWithBody, createRequestContext, runWithRequestContext } from "../shims/unified-request-context.js";
|
|
3
|
-
import { getRequestExecutionContext } from "../shims/request-context.js";
|
|
4
3
|
import { VINEXT_REVALIDATE_HOST_HEADER } from "../utils/protocol-headers.js";
|
|
4
|
+
import { getRequestExecutionContext } from "../shims/request-context.js";
|
|
5
5
|
import "./headers.js";
|
|
6
6
|
import { cloneRequestWithHeaders, cloneRequestWithUrl, filterInternalHeaders } from "./request-pipeline.js";
|
|
7
7
|
import { applyEffectiveRequestCookieHeader, getDraftModeCookieHeader, headersContextFromRequest, restoreDraftModeTransition } from "../shims/headers.js";
|
|
@@ -67,7 +67,7 @@ function rematchAppWorkerResponseStageRoute(options, normalized, props) {
|
|
|
67
67
|
return match;
|
|
68
68
|
}
|
|
69
69
|
async function renderAppWorkerResponseStage(options, rawRequest, ctx, props, _stageOptions) {
|
|
70
|
-
if (props.protocolVersion !==
|
|
70
|
+
if (props.protocolVersion !== 10 || props.buildId !== options.buildId) return new Response("Incompatible vinext App response stage", { status: 409 });
|
|
71
71
|
if (props.kind === "app-full-request") return new Response("Invalid vinext App response stage", { status: 400 });
|
|
72
72
|
options.registerCacheAdapters();
|
|
73
73
|
await options.ensureInstrumentation?.();
|
|
@@ -114,7 +114,7 @@ async function renderAppWorkerResponseStage(options, rawRequest, ctx, props, _st
|
|
|
114
114
|
ensureFetchPatch();
|
|
115
115
|
if (props.kind === "app-metadata") {
|
|
116
116
|
if (!options.handleMetadataRouteRequest) return new Response("Invalid vinext App response stage", { status: 400 });
|
|
117
|
-
let response = await options.handleMetadataRouteRequest(props.cleanPathname) ?? new Response(null, {
|
|
117
|
+
let response = await options.handleMetadataRouteRequest(props.cleanPathname, props.routePathname) ?? new Response(null, {
|
|
118
118
|
status: 204,
|
|
119
119
|
headers: { ["x-vinext-app-metadata-stage-no-match"]: "1" }
|
|
120
120
|
});
|
|
@@ -192,6 +192,8 @@ async function renderAppWorkerResponseStage(options, rawRequest, ctx, props, _st
|
|
|
192
192
|
routeHandlerUrl.search = searchParams.toString();
|
|
193
193
|
for (const internalRscValue of internalRscValues) routeHandlerUrl.searchParams.append(VINEXT_RSC_CACHE_BUSTING_SEARCH_PARAM, internalRscValue);
|
|
194
194
|
return options.dispatchMatchedRouteHandler({
|
|
195
|
+
bypassInterceptionContextCache: props.bypassInterceptionContextCache,
|
|
196
|
+
cachePathname: props.cachePathname,
|
|
195
197
|
cleanPathname: props.cleanPathname,
|
|
196
198
|
middlewareContext,
|
|
197
199
|
params: route.isDynamic ? renderParams : null,
|
|
@@ -208,6 +210,7 @@ async function renderAppWorkerResponseStage(options, rawRequest, ctx, props, _st
|
|
|
208
210
|
}, renderParams);
|
|
209
211
|
return options.dispatchMatchedPage({
|
|
210
212
|
bypassInterceptionContextCache: props.bypassInterceptionContextCache,
|
|
213
|
+
cachePathname: props.cachePathname,
|
|
211
214
|
clientReuseManifest: normalized.clientReuseManifest,
|
|
212
215
|
cleanPathname: props.cleanPathname,
|
|
213
216
|
displayPathname: props.canonicalPathname,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { decodeMatchedParams, splitPathSegments, splitPathnameForRouteMatch } from "../routing/utils.js";
|
|
2
|
-
import { buildRouteTrie, trieMatchRaw } from "../routing/route-trie.js";
|
|
3
2
|
import { createAppRouteGraphInterceptionId } from "../routing/app-route-graph.js";
|
|
3
|
+
import { buildRouteTrie, trieMatchRaw } from "../routing/route-trie.js";
|
|
4
4
|
import { extractRawRoutePatternParams, matchRoutePatternPrefix, matchRoutePatternRaw } from "../routing/route-pattern.js";
|
|
5
5
|
import { canonicalizeAppPageParams } from "./app-page-segment-state.js";
|
|
6
6
|
//#region src/server/app-rsc-route-matching.ts
|