vinext 1.0.0-beta.12 → 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.js +1 -1
- 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 +262 -101
- 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 +8 -16
- 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-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-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-request-stage-independent-entry.js +2 -2
- package/dist/server/app-route-handler-dispatch.js +1 -1
- 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 +1 -1
- package/dist/server/app-rsc-handler.js +4 -4
- package/dist/server/app-rsc-response-stage.js +1 -1
- package/dist/server/app-rsc-route-matching.js +1 -1
- package/dist/server/app-server-action-execution.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/isr-cache.js +1 -1
- package/dist/server/metadata-route-response.js +8 -0
- package/dist/server/middleware-runtime.js +3 -3
- 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-page-data.js +2 -2
- package/dist/server/pages-page-handler.js +1 -1
- package/dist/server/pages-page-response.js +1 -1
- 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 +7 -7
- package/dist/server/request-pipeline.js +2 -2
- 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 +82 -22
- package/dist/shims/font-local.js +1 -1
- package/dist/shims/form.js +1 -1
- package/dist/shims/headers.js +2 -2
- 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/server.js +3 -3
- package/dist/utils/built-asset-url.js +1 -1
- package/dist/utils/project.d.ts +1 -11
- package/dist/utils/project.js +19 -28
- 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,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;
|
|
@@ -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";
|
|
@@ -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";
|
|
@@ -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";
|
|
@@ -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";
|
|
@@ -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";
|
|
@@ -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
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { VINEXT_MW_CTX_HEADER } from "../utils/protocol-headers.js";
|
|
2
|
+
import { buildRequestHeadersFromMiddlewareResponse } from "../utils/middleware-request-headers.js";
|
|
3
|
+
import { parseEdgeRequestCookieHeader } from "../utils/parse-cookie.js";
|
|
4
|
+
import { isExternalUrl } from "../utils/external-url.js";
|
|
1
5
|
import { splitPathSegments } from "../routing/utils.js";
|
|
2
6
|
import { addBasePathToPathname, hasBasePath, stripBasePath } from "../utils/base-path.js";
|
|
3
|
-
import { parseEdgeRequestCookieHeader } from "../utils/parse-cookie.js";
|
|
4
|
-
import { VINEXT_MW_CTX_HEADER } from "../utils/protocol-headers.js";
|
|
5
7
|
import { NEXT_ROUTER_STATE_TREE_HEADER, VINEXT_RSC_VARY_HEADER } from "./app-rsc-vary.js";
|
|
6
8
|
import { ACTION_FORWARDED_HEADER, ACTION_REDIRECT_HEADER, ACTION_REDIRECT_STATUS_HEADER, ACTION_REDIRECT_TYPE_HEADER, ACTION_REVALIDATED_HEADER } from "./headers.js";
|
|
7
|
-
import { buildRequestHeadersFromMiddlewareResponse } from "../utils/middleware-request-headers.js";
|
|
8
|
-
import { isExternalUrl } from "../utils/external-url.js";
|
|
9
9
|
import { internalServerErrorResponse, payloadTooLargeResponse } from "./http-error-responses.js";
|
|
10
10
|
import { attachRequestCfMetadata, validateCsrfOrigin, validateServerActionPayload } from "./request-pipeline.js";
|
|
11
11
|
import { APP_RSC_RENDER_MODE_NAVIGATION } from "./app-rsc-render-mode.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { fnv1a64 } from "../utils/hash.js";
|
|
2
1
|
import { isUnknownRecord } from "../utils/record.js";
|
|
2
|
+
import { fnv1a64 } from "../utils/hash.js";
|
|
3
3
|
//#region src/server/artifact-compatibility.ts
|
|
4
4
|
const ARTIFACT_COMPATIBILITY_SCHEMA_VERSION = 1;
|
|
5
5
|
const APP_ELEMENTS_SCHEMA_VERSION = 1;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { isUnknownRecord } from "../utils/record.js";
|
|
1
2
|
import { fnv1a64 } from "../utils/hash.js";
|
|
2
3
|
import { parseAppElementsWireElementKey } from "./app-elements-wire-key.js";
|
|
3
|
-
import { isUnknownRecord } from "../utils/record.js";
|
|
4
4
|
import { parseArtifactCompatibilityEnvelope } from "./artifact-compatibility.js";
|
|
5
5
|
import { isNonNegativeSafeInteger } from "../utils/number.js";
|
|
6
6
|
//#region src/server/client-reuse-manifest.ts
|
|
@@ -36,7 +36,7 @@ export type DevServerInfo = {
|
|
|
36
36
|
/** Project directory the server is running in. Used to detect stale entries. */
|
|
37
37
|
cwd: string;
|
|
38
38
|
};
|
|
39
|
-
|
|
39
|
+
type DevLockfile = {
|
|
40
40
|
/** Update the lock file contents (e.g. once the port is known after listen). */
|
|
41
41
|
update(info: DevServerInfo): void;
|
|
42
42
|
/** Release the lock — deletes the file. Safe to call multiple times. */
|
|
@@ -99,7 +99,7 @@ function formatAlreadyRunningError(opts) {
|
|
|
99
99
|
"Another vinext dev server appears to be running in this directory.",
|
|
100
100
|
"",
|
|
101
101
|
`Stale lock file: ${path.relative(cwd, lockfilePath)}`,
|
|
102
|
-
"Remove it manually if no server is running, then re-run `
|
|
102
|
+
"Remove it manually if no server is running, then re-run `vite dev`."
|
|
103
103
|
].join("\n");
|
|
104
104
|
const killCommand = process.platform === "win32" ? `taskkill /PID ${existing.pid} /F` : `kill ${existing.pid}`;
|
|
105
105
|
return [
|
|
@@ -160,7 +160,10 @@ function tryAcquireLockfile(opts) {
|
|
|
160
160
|
lockfile: {
|
|
161
161
|
path: lockfilePath,
|
|
162
162
|
update(next) {
|
|
163
|
+
if (released) return;
|
|
163
164
|
try {
|
|
165
|
+
const current = readLockfile(lockfilePath);
|
|
166
|
+
if (!current || current.pid !== ownerPid) return;
|
|
164
167
|
writeLockfile(lockfilePath, next);
|
|
165
168
|
} catch {}
|
|
166
169
|
},
|
|
@@ -44,7 +44,7 @@ reactStrictMode?: boolean,
|
|
|
44
44
|
/** Next.js `expireTime`, used when formatting terminal GSP responses. */
|
|
45
45
|
expireTime?: number, crossOrigin?: string,
|
|
46
46
|
/** Resolved Pages Router build ID shared with the dev data-route parser. */
|
|
47
|
-
buildId?: string): (req: IncomingMessage, res: ServerResponse, url: string,
|
|
47
|
+
buildId?: string, clientMiddlewareMatcher?: unknown, classifyPageRoute?: (route: Route) => "static" | "server" | "none"): (req: IncomingMessage, res: ServerResponse, url: string,
|
|
48
48
|
/** Status code override — propagated from middleware rewrite status. */
|
|
49
49
|
statusCode?: number,
|
|
50
50
|
/**
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { closeAfterResponse, createRequestContext, runWithRequestContext } from "../shims/unified-request-context.js";
|
|
2
2
|
import { createValidFileMatcher, findFileWithExts } from "../routing/file-matcher.js";
|
|
3
|
+
import { isBotUserAgent } from "../utils/html-limited-bots.js";
|
|
4
|
+
import { PRERENDER_REVALIDATE_HEADER } from "../utils/protocol-headers.js";
|
|
5
|
+
import { sanitizeDestination } from "../config/config-matchers.js";
|
|
3
6
|
import { patternToNextFormat } from "../routing/route-validation.js";
|
|
4
7
|
import { matchRoute } from "../routing/pages-router.js";
|
|
5
|
-
import { PRERENDER_REVALIDATE_HEADER } from "../utils/protocol-headers.js";
|
|
6
8
|
import { NEXTJS_CACHE_HEADER, NEXTJS_DEPLOYMENT_ID_HEADER } from "./headers.js";
|
|
7
9
|
import { isDangerousScheme } from "../shims/url-safety.js";
|
|
8
|
-
import { sanitizeDestination } from "../config/config-matchers.js";
|
|
9
10
|
import { extractLocaleFromUrl as extractLocaleFromUrl$1, resolvePagesI18nRequest } from "./pages-i18n.js";
|
|
10
11
|
import { importModule, reportRequestError } from "./instrumentation.js";
|
|
11
12
|
import { NEVER_CACHE_CONTROL } from "./cache-control.js";
|
|
@@ -26,7 +27,6 @@ import { buildPagesReadinessNextData } from "./pages-readiness.js";
|
|
|
26
27
|
import { resolvePagesPageMethodResponse } from "./pages-page-method.js";
|
|
27
28
|
import { loadUserDocumentInitialProps, runDocumentRenderPage } from "./pages-document-initial-props.js";
|
|
28
29
|
import { callDocumentGetInitialProps } from "./document-initial-head.js";
|
|
29
|
-
import { isBotUserAgent } from "../utils/html-limited-bots.js";
|
|
30
30
|
import { hasPagesGetInitialProps, loadDevAppInitialProps, loadPagesGetInitialProps } from "./pages-get-initial-props.js";
|
|
31
31
|
import { isSerializableProps } from "./pages-serializable-props.js";
|
|
32
32
|
import { traceFindPageComponents, tracePagesData, tracePagesDocument, tracePagesDocumentStream } from "./pages-execution-tracing.js";
|
|
@@ -315,9 +315,20 @@ function extractLocaleFromUrl(url, i18nConfig) {
|
|
|
315
315
|
* 4. Render the component to HTML
|
|
316
316
|
* 5. Wrap in _document shell and send response
|
|
317
317
|
*/
|
|
318
|
-
function createSSRHandler(server, runner, routes, pagesDir, i18nConfig, fileMatcher, basePath = "", trailingSlash = false, hasMiddleware = false, hasRewrites = false, clientTraceMetadata, htmlLimitedBots, reactStrictMode = false, expireTime = PAGES_CACHE_ONE_YEAR_SECONDS, crossOrigin, buildId = process.env.__VINEXT_BUILD_ID ?? "development") {
|
|
318
|
+
function createSSRHandler(server, runner, routes, pagesDir, i18nConfig, fileMatcher, basePath = "", trailingSlash = false, hasMiddleware = false, hasRewrites = false, clientTraceMetadata, htmlLimitedBots, reactStrictMode = false, expireTime = PAGES_CACHE_ONE_YEAR_SECONDS, crossOrigin, buildId = process.env.__VINEXT_BUILD_ID ?? "development", clientMiddlewareMatcher, classifyPageRoute) {
|
|
319
319
|
const matcher = fileMatcher ?? createValidFileMatcher();
|
|
320
320
|
const pagePatterns = routes.map((r) => patternToNextFormat(r.pattern));
|
|
321
|
+
const pageLoaders = routes.map((route) => ({
|
|
322
|
+
pattern: patternToNextFormat(route.pattern),
|
|
323
|
+
moduleSource: createPagesDevModuleUrl(server.config.root, route.filePath, "/"),
|
|
324
|
+
dataKind: classifyPageRoute?.(route) ?? "none"
|
|
325
|
+
}));
|
|
326
|
+
const errorFile = findFileWithExts(pagesDir, "_error", matcher);
|
|
327
|
+
pageLoaders.push({
|
|
328
|
+
pattern: "/_error",
|
|
329
|
+
moduleSource: errorFile ? createPagesDevModuleUrl(server.config.root, errorFile, "/") : "next/error",
|
|
330
|
+
dataKind: "none"
|
|
331
|
+
});
|
|
321
332
|
const _alsRegistration = Promise.all([runner.import("vinext/head-state"), runner.import("vinext/router-state")]);
|
|
322
333
|
_alsRegistration.catch(() => {});
|
|
323
334
|
return async (req, res, url, statusCode, isDataReq = false, originalUrl = url) => {
|
|
@@ -357,6 +368,9 @@ function createSSRHandler(server, runner, routes, pagesDir, i18nConfig, fileMatc
|
|
|
357
368
|
basePath,
|
|
358
369
|
buildId,
|
|
359
370
|
clientTraceMetadata,
|
|
371
|
+
pageLoaders,
|
|
372
|
+
hasMiddleware,
|
|
373
|
+
clientMiddlewareMatcher,
|
|
360
374
|
locale: locale ?? currentDefaultLocale,
|
|
361
375
|
locales: i18nConfig?.locales,
|
|
362
376
|
defaultLocale: currentDefaultLocale,
|
|
@@ -798,12 +812,14 @@ function createSSRHandler(server, runner, routes, pagesDir, i18nConfig, fileMatc
|
|
|
798
812
|
pageModuleUrl,
|
|
799
813
|
appModuleUrl,
|
|
800
814
|
hasMiddleware,
|
|
801
|
-
routeUrl: requestAsPath
|
|
815
|
+
routeUrl: requestAsPath,
|
|
816
|
+
clientMiddlewareMatcher
|
|
802
817
|
}
|
|
803
818
|
};
|
|
804
819
|
const hydrationScript = createPagesDevHydrationScript({
|
|
805
820
|
appModuleSource,
|
|
806
821
|
pageModuleSource,
|
|
822
|
+
pageLoaders,
|
|
807
823
|
reactStrictMode: reactStrictMode === true,
|
|
808
824
|
replaceFallbackRoute: true,
|
|
809
825
|
scriptNonce
|
|
@@ -1037,16 +1053,22 @@ async function renderErrorPage(server, runner, req, res, url, pagesDir, statusCo
|
|
|
1037
1053
|
query: parseQueryString(url),
|
|
1038
1054
|
buildId: context.buildId ?? process.env.__VINEXT_BUILD_ID ?? "development",
|
|
1039
1055
|
isFallback: false,
|
|
1056
|
+
locale: context.locale,
|
|
1057
|
+
locales: context.locales,
|
|
1058
|
+
defaultLocale: context.defaultLocale,
|
|
1040
1059
|
notFoundSrcPage: context.notFoundSrcPage,
|
|
1041
1060
|
__vinext: {
|
|
1042
1061
|
pageModuleUrl: errorModuleUrl ?? void 0,
|
|
1043
|
-
appModuleUrl: appModuleUrl ?? void 0
|
|
1062
|
+
appModuleUrl: appModuleUrl ?? void 0,
|
|
1063
|
+
hasMiddleware: context.hasMiddleware,
|
|
1064
|
+
clientMiddlewareMatcher: context.clientMiddlewareMatcher
|
|
1044
1065
|
}
|
|
1045
1066
|
})}<\/script>`}\n${createPagesDevHydrationScript({
|
|
1046
1067
|
appModuleSource,
|
|
1047
1068
|
forceRouterReady: true,
|
|
1048
1069
|
normalizePageProps: false,
|
|
1049
1070
|
pageModuleSource: errorModuleSource,
|
|
1071
|
+
pageLoaders: context.pageLoaders,
|
|
1050
1072
|
reactStrictMode: reactStrictMode === true,
|
|
1051
1073
|
scriptNonce,
|
|
1052
1074
|
setPagePatternsFromNextData: true
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { toSlash } from "../deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
|
|
2
2
|
import { VINEXT_ORIGINAL_STACK_TRACE_ENDPOINT } from "../utils/dev-stack-sourcemap-endpoint.js";
|
|
3
|
-
import { readFile } from "node:fs/promises";
|
|
4
3
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
|
+
import { readFile } from "node:fs/promises";
|
|
5
5
|
//#region src/server/dev-stack-sourcemap.ts
|
|
6
6
|
const MAX_ORIGINAL_STACK_TRACE_BODY_BYTES = 1048576;
|
|
7
7
|
const V8_PAREN_STACK_LINE = /^(\s*at\s+.*?\()(.+):(\d+):(\d+)(\)\s*)$/;
|
package/dist/server/isr-cache.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getRequestExecutionContext } from "../shims/request-context.js";
|
|
2
1
|
import { PRERENDER_REVALIDATE_HEADER, PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER } from "../utils/protocol-headers.js";
|
|
2
|
+
import { getRequestExecutionContext } from "../shims/request-context.js";
|
|
3
3
|
import { reportRequestError } from "./instrumentation.js";
|
|
4
4
|
import { getCdnCacheAdapter } from "../shims/cdn-cache.js";
|
|
5
5
|
import { fnv1a64 } from "../utils/hash.js";
|
|
@@ -4,6 +4,8 @@ import { decodeMatchedParams } from "../routing/utils.js";
|
|
|
4
4
|
import { getRequestExecutionContext } from "../shims/request-context.js";
|
|
5
5
|
import { VINEXT_METADATA_ROUTE_CACHE_HEADER } from "./headers.js";
|
|
6
6
|
import { notFoundResponse } from "./http-error-responses.js";
|
|
7
|
+
import { beginRouteCacheability, markRouteCacheabilityExplicitResponsePolicy } from "../shims/cacheability-classification.js";
|
|
8
|
+
import { hasCdnResponsePolicy, hasExplicitNonCacheableResponsePolicy } from "./cache-control.js";
|
|
7
9
|
import { isrCacheControl } from "./isr-cache.js";
|
|
8
10
|
import { resolveClientStaleTimeSeconds } from "../utils/cache-control-metadata.js";
|
|
9
11
|
import { _consumeRequestScopedCacheLife, cacheLifeProfiles } from "../shims/cache-request-state.js";
|
|
@@ -52,6 +54,7 @@ function metadataRouteCacheHeader(route) {
|
|
|
52
54
|
return CACHE_HEADERS.revalidate;
|
|
53
55
|
}
|
|
54
56
|
function withMetadataRouteCacheHeader(response, route) {
|
|
57
|
+
if (hasCdnResponsePolicy(response.headers) && !hasExplicitNonCacheableResponsePolicy(response.headers)) markRouteCacheabilityExplicitResponsePolicy();
|
|
55
58
|
const headers = new Headers(response.headers);
|
|
56
59
|
if (!headers.has("Cache-Control")) headers.set("Cache-Control", metadataRouteCacheHeader(route));
|
|
57
60
|
return new Response(response.body, {
|
|
@@ -60,6 +63,9 @@ function withMetadataRouteCacheHeader(response, route) {
|
|
|
60
63
|
statusText: response.statusText
|
|
61
64
|
});
|
|
62
65
|
}
|
|
66
|
+
function beginMetadataRouteCacheability(route) {
|
|
67
|
+
beginRouteCacheability("app-route", route.patternParts ? `/${route.patternParts.join("/")}` : route.servedUrl);
|
|
68
|
+
}
|
|
63
69
|
function getMetadataRouteFunctions(route) {
|
|
64
70
|
const cached = routeFunctionCache.get(route);
|
|
65
71
|
if (cached) return cached;
|
|
@@ -423,6 +429,7 @@ async function handleMetadataRouteRequest(options) {
|
|
|
423
429
|
if (route.type === "sitemap" && route.isDynamic) {
|
|
424
430
|
if (functions.generateSitemaps) {
|
|
425
431
|
if (isGeneratedSitemapPath(route, options.cleanPathname)) {
|
|
432
|
+
beginMetadataRouteCacheability(route);
|
|
426
433
|
const render = async () => {
|
|
427
434
|
setCurrentFetchSoftTags(buildMetadataRouteTags(route, options.cleanPathname, []));
|
|
428
435
|
const response = await handleGeneratedSitemap(route, options.cleanPathname, functions);
|
|
@@ -441,6 +448,7 @@ async function handleMetadataRouteRequest(options) {
|
|
|
441
448
|
}
|
|
442
449
|
const match = matchMetadataRoute(route, options.cleanPathname, functions, getUrlParts);
|
|
443
450
|
if (!match) continue;
|
|
451
|
+
beginMetadataRouteCacheability(route);
|
|
444
452
|
const rawParams = route.patternParts ? metadataRouteRawParams(route, match, options.routePathname ?? options.cleanPathname) : Object.create(null);
|
|
445
453
|
if (route.patternParts) {
|
|
446
454
|
const runtimeParams = { ...rawParams };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import path from "../deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
|
|
2
|
+
import "../utils/protocol-headers.js";
|
|
3
|
+
import { shouldKeepMiddlewareHeader } from "../utils/middleware-request-headers.js";
|
|
4
|
+
import { normalizeHost } from "../config/request-context.js";
|
|
2
5
|
import { normalizePathnameForRouteMatchStrict } from "../routing/utils.js";
|
|
3
6
|
import { addBasePathToPathname, hasBasePath, removeTrailingSlash, stripBasePath } from "../utils/base-path.js";
|
|
4
7
|
import { getRequestExecutionContext, runWithExecutionContext } from "../shims/request-context.js";
|
|
5
8
|
import "./server-globals.js";
|
|
6
|
-
import { normalizeHost } from "../config/request-context.js";
|
|
7
|
-
import "../utils/protocol-headers.js";
|
|
8
9
|
import { MIDDLEWARE_REWRITE_HEADER } from "./headers.js";
|
|
9
|
-
import { shouldKeepMiddlewareHeader } from "../utils/middleware-request-headers.js";
|
|
10
10
|
import { NextFetchEvent, NextRequest } from "../shims/server.js";
|
|
11
11
|
import { normalizePath } from "./normalize-path.js";
|
|
12
12
|
import { matchesMiddleware, matchesMiddlewarePathname } from "./middleware-matcher.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { addBasePathToPathname, hasBasePath, stripBasePath } from "../utils/base-path.js";
|
|
2
1
|
import { MIDDLEWARE_SKIP_HEADER } from "../utils/protocol-headers.js";
|
|
2
|
+
import { addBasePathToPathname, hasBasePath, stripBasePath } from "../utils/base-path.js";
|
|
3
3
|
import { NEXTJS_DEPLOYMENT_ID_HEADER } from "./headers.js";
|
|
4
4
|
//#region src/server/pages-data-route.ts
|
|
5
5
|
/**
|
|
@@ -4,6 +4,12 @@ export type PagesDevHydrationOptions = {
|
|
|
4
4
|
forceRouterReady?: boolean;
|
|
5
5
|
normalizePageProps?: boolean;
|
|
6
6
|
pageModuleSource: string;
|
|
7
|
+
/** Lazily importable page routes, matching the production client manifest. */
|
|
8
|
+
pageLoaders?: readonly {
|
|
9
|
+
pattern: string;
|
|
10
|
+
moduleSource: string;
|
|
11
|
+
dataKind?: "static" | "server" | "none";
|
|
12
|
+
}[];
|
|
7
13
|
reactStrictMode: boolean;
|
|
8
14
|
replaceFallbackRoute?: boolean;
|
|
9
15
|
scriptNonce?: string;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { resolveClientRuntimeModule } from "../entries/runtime-entry-module.js";
|
|
2
|
-
import { createNonceAttribute } from "./html.js";
|
|
2
|
+
import { createNonceAttribute, safeJsonStringify } from "./html.js";
|
|
3
3
|
//#region src/server/pages-dev-hydration.ts
|
|
4
4
|
function createPagesDevHydrationScript(options) {
|
|
5
5
|
const nonceAttr = createNonceAttribute(options.scriptNonce);
|
|
6
6
|
const reactInstanceBootstrapPath = resolveClientRuntimeModule("react-instance-bootstrap");
|
|
7
7
|
const initializeRouter = options.forceRouterReady ? "_initializePagesRouterReadyFromNextData(nextData, true);" : "_initializePagesRouterReadyFromNextData(nextData);";
|
|
8
|
-
const pagePatterns = options.setPagePatternsFromNextData ? "window.__VINEXT_PAGE_PATTERNS__ = [nextData.page];" : "";
|
|
8
|
+
const pagePatterns = options.setPagePatternsFromNextData ? options.pageLoaders ? "window.__VINEXT_PAGE_PATTERNS__ = Object.keys(window.__VINEXT_PAGE_LOADERS__);" : "window.__VINEXT_PAGE_PATTERNS__ = [nextData.page];" : "";
|
|
9
|
+
const pageLoaders = `{ ${[...options.pageLoaders?.map(({ pattern, moduleSource }) => {
|
|
10
|
+
const importer = moduleSource === "next/error" ? "import(\"next/error\")" : `loadDevPage(import.meta.env.BASE_URL + ${safeJsonStringify(moduleSource.slice(1))})`;
|
|
11
|
+
return `${safeJsonStringify(pattern)}: () => ${importer}`;
|
|
12
|
+
}) ?? [], `[nextData.page]: () => import(${safeJsonStringify(options.pageModuleSource)})`].join(", ")} }`;
|
|
13
|
+
const ssgPatterns = options.pageLoaders?.filter((route) => route.dataKind === "static").map((route) => route.pattern);
|
|
14
|
+
const sspPatterns = options.pageLoaders?.filter((route) => route.dataKind === "server").map((route) => route.pattern);
|
|
9
15
|
const pageProps = options.normalizePageProps === false ? "const pageProps = rawPageProps ?? {};" : "const pageProps = rawPageProps && typeof rawPageProps === \"object\" ? rawPageProps : {};";
|
|
10
16
|
const hydrationQueryUpdate = options.replaceFallbackRoute ? `
|
|
11
17
|
const initialMatchesMiddleware =
|
|
@@ -19,7 +25,7 @@ function createPagesDevHydrationScript(options) {
|
|
|
19
25
|
await Router.replace(routeUrl || currentUrl, routeUrl ? currentUrl : undefined, { _h: 1, scroll: false, shallow: !nextData.isFallback && !initialMatchesMiddleware });
|
|
20
26
|
}` : "";
|
|
21
27
|
const createElement = options.appModuleSource ? `
|
|
22
|
-
const appModule = await import(${
|
|
28
|
+
const appModule = await import(${safeJsonStringify(options.appModuleSource)});
|
|
23
29
|
const AppComponent = appModule.default;
|
|
24
30
|
window.__VINEXT_APP__ = AppComponent;
|
|
25
31
|
const appRouter = ${options.forceRouterReady ? "{ ...Router, isReady: true }" : "Router"};
|
|
@@ -33,7 +39,7 @@ function createPagesDevHydrationScript(options) {
|
|
|
33
39
|
`;
|
|
34
40
|
return `
|
|
35
41
|
<script type="module"${nonceAttr}>
|
|
36
|
-
import ${
|
|
42
|
+
import ${safeJsonStringify(reactInstanceBootstrapPath)};
|
|
37
43
|
import "vinext/instrumentation-client";
|
|
38
44
|
import React from "react";
|
|
39
45
|
import { hydrateRoot } from "react-dom/client";
|
|
@@ -47,13 +53,19 @@ if (nextDataElement?.textContent) {
|
|
|
47
53
|
window.__VINEXT_DEFAULT_LOCALE__ = window.__NEXT_DATA__.defaultLocale;
|
|
48
54
|
}
|
|
49
55
|
const nextData = window.__NEXT_DATA__;
|
|
56
|
+
window.__VINEXT_MIDDLEWARE_MATCHER__ = nextData.__vinext?.clientMiddlewareMatcher;
|
|
50
57
|
${initializeRouter}
|
|
51
58
|
const props = nextData.props && typeof nextData.props === "object" ? nextData.props : {};
|
|
52
59
|
const rawPageProps = props.pageProps;
|
|
53
60
|
${pageProps}
|
|
54
|
-
|
|
61
|
+
// Other pages must not become static dependencies of this page's HMR proxy.
|
|
62
|
+
// Vite adds ?import to variable imports, so source URLs are bare and base-qualified here.
|
|
63
|
+
const loadDevPage = (source) => import(/* @vite-ignore */ source);
|
|
64
|
+
window.__VINEXT_PAGE_LOADERS__ = ${pageLoaders};
|
|
55
65
|
${pagePatterns}
|
|
56
|
-
|
|
66
|
+
${ssgPatterns ? `window.__VINEXT_PAGES_SSG_PATTERNS__ = ${safeJsonStringify(ssgPatterns)};` : ""}
|
|
67
|
+
${sspPatterns ? `window.__VINEXT_PAGES_SSP_PATTERNS__ = ${safeJsonStringify(sspPatterns)};` : ""}
|
|
68
|
+
window.__VINEXT_APP_LOADER__ = ${options.appModuleSource ? `() => import(${safeJsonStringify(options.appModuleSource)})` : "undefined"};
|
|
57
69
|
window.__VINEXT_REACT_STRICT_MODE__ = ${JSON.stringify(options.reactStrictMode)};
|
|
58
70
|
|
|
59
71
|
async function hydrate() {
|
|
@@ -69,7 +81,7 @@ async function hydrate() {
|
|
|
69
81
|
};
|
|
70
82
|
}
|
|
71
83
|
|
|
72
|
-
const pageModule = await import(${
|
|
84
|
+
const pageModule = await import(${safeJsonStringify(options.pageModuleSource)});
|
|
73
85
|
const PageComponent = pageModule.default;
|
|
74
86
|
let element;
|
|
75
87
|
${createElement}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { isUnknownRecord } from "../utils/record.js";
|
|
2
|
+
import { isBotUserAgent } from "../utils/html-limited-bots.js";
|
|
1
3
|
import { normalizePathnameForRouteMatch } from "../routing/utils.js";
|
|
2
4
|
import { NEXTJS_CACHE_HEADER, NEXTJS_DEPLOYMENT_ID_HEADER } from "./headers.js";
|
|
3
5
|
import { isDangerousScheme } from "../shims/url-safety.js";
|
|
4
6
|
import { applyCdnResponseHeaders } from "./cache-control.js";
|
|
5
7
|
import { buildMissIsrCacheControl, decideIsr } from "./isr-decision.js";
|
|
6
|
-
import { isUnknownRecord } from "../utils/record.js";
|
|
7
8
|
import { buildPagesCacheValue, isrCacheControl } from "./isr-cache.js";
|
|
8
9
|
import { encodeCacheTag } from "../utils/encode-cache-tag.js";
|
|
9
10
|
import { normalizeStaticPathname } from "../routing/route-pattern.js";
|
|
10
11
|
import { buildCacheStateHeaders } from "./cache-headers.js";
|
|
11
|
-
import { isBotUserAgent } from "../utils/html-limited-bots.js";
|
|
12
12
|
import { matchesIfNoneMatch } from "./http-conditional.js";
|
|
13
13
|
import { buildPagesNextDataScript, generatePagesETag, isPagesStreamingBot, requestsNoCache } from "./pages-page-response.js";
|
|
14
14
|
import { createPagesGetInitialPropsRouter, hasPagesGetInitialProps, isResponseSent, loadPagesGetInitialProps } from "./pages-get-initial-props.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
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 } from "../utils/protocol-headers.js";
|
|
3
4
|
import { patternToNextFormat } from "../routing/route-validation.js";
|
|
4
5
|
import { getRequestExecutionContext } from "../shims/request-context.js";
|
|
5
|
-
import { PRERENDER_REVALIDATE_HEADER } from "../utils/protocol-headers.js";
|
|
6
6
|
import { NEXTJS_CACHE_HEADER, NEXTJS_DEPLOYMENT_ID_HEADER, VINEXT_CACHE_HEADER, VINEXT_REVALIDATED_CACHE_TAG_HEADER } from "./headers.js";
|
|
7
7
|
import { extractLocaleFromUrl, resolvePagesI18nRequest } from "./pages-i18n.js";
|
|
8
8
|
import { reportRequestError } from "./instrumentation.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isBotUserAgent } from "../utils/html-limited-bots.js";
|
|
1
2
|
import { getRequestExecutionContext } from "../shims/request-context.js";
|
|
2
3
|
import { NEXTJS_CACHE_HEADER, VINEXT_REVALIDATED_CACHE_TAG_HEADER } from "./headers.js";
|
|
3
4
|
import { reportRequestError } from "./instrumentation.js";
|
|
@@ -15,7 +16,6 @@ import { setCacheStateHeaders } from "./cache-headers.js";
|
|
|
15
16
|
import { readStreamAsText } from "../utils/text-stream.js";
|
|
16
17
|
import { loadUserDocumentInitialProps, runDocumentRenderPage } from "./pages-document-initial-props.js";
|
|
17
18
|
import { callDocumentGetInitialProps } from "./document-initial-head.js";
|
|
18
|
-
import { isBotUserAgent } from "../utils/html-limited-bots.js";
|
|
19
19
|
import { matchesIfNoneMatch } from "./http-conditional.js";
|
|
20
20
|
import React from "react";
|
|
21
21
|
//#region src/server/pages-page-response.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { addBasePathToPathname, hasBasePath } from "../utils/base-path.js";
|
|
2
|
-
import { patternToNextFormat } from "../routing/route-validation.js";
|
|
3
|
-
import { requestContextFromRequest } from "../config/request-context.js";
|
|
4
1
|
import { PRERENDER_REVALIDATE_HEADER } from "../utils/protocol-headers.js";
|
|
2
|
+
import { requestContextFromRequest } from "../config/request-context.js";
|
|
5
3
|
import { isExternalUrl } from "../utils/external-url.js";
|
|
6
4
|
import { applyMiddlewareRequestHeaders, matchRedirect, matchRewrite, preserveRedirectDestinationQuery, proxyExternalRequest, sanitizeDestination } from "../config/config-matchers.js";
|
|
5
|
+
import { addBasePathToPathname, hasBasePath } from "../utils/base-path.js";
|
|
6
|
+
import { patternToNextFormat } from "../routing/route-validation.js";
|
|
7
7
|
import { methodNotAllowedResponse, sanitizeMethodNotAllowedHeaders } from "./http-error-responses.js";
|
|
8
8
|
import { cloneRequestWithUrl, normalizeTrailingSlash } from "./request-pipeline.js";
|
|
9
9
|
import { normalizeDefaultLocalePathname, stripI18nLocaleForApiRoute } from "./pages-i18n.js";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { VINEXT_PRERENDER_SECRET_HEADER, VINEXT_REVALIDATE_HOST_HEADER } from "../utils/protocol-headers.js";
|
|
2
|
+
import { requestContextFromRequest } from "../config/request-context.js";
|
|
3
|
+
import { assetPrefixPathname, isNextStaticPath } from "../utils/asset-prefix.js";
|
|
1
4
|
import { normalizePathnameForRouteMatchStrict } from "../routing/utils.js";
|
|
2
5
|
import { hasBasePath, stripBasePath } from "../utils/base-path.js";
|
|
3
6
|
import { runWithExecutionContext } from "../shims/request-context.js";
|
|
4
|
-
import { requestContextFromRequest } from "../config/request-context.js";
|
|
5
|
-
import { VINEXT_PRERENDER_SECRET_HEADER, VINEXT_REVALIDATE_HOST_HEADER } from "../utils/protocol-headers.js";
|
|
6
7
|
import { VINEXT_CACHEABILITY_PROBE_QUERY_PARAM, VINEXT_EXPECTED_WORKER_VERSION_HEADER } from "./headers.js";
|
|
7
8
|
import { notFoundStaticAssetResponse } from "./http-error-responses.js";
|
|
8
9
|
import { isOpenRedirectShaped } from "./open-redirect.js";
|
|
@@ -11,7 +12,6 @@ import { normalizeDefaultLocalePathname } from "./pages-i18n.js";
|
|
|
11
12
|
import { CACHEABILITY_REQUEST_STATE } from "../shims/cacheability-classification.js";
|
|
12
13
|
import { applyCdnResponseIdentityHeaders, captureCdnResponsePolicyOverrides, reconcileCdnResponseHeadersAfterOuterPolicy, validateCdnRequest } from "./cache-control.js";
|
|
13
14
|
import { registerLazyDataCacheHandler } from "../shims/cache-handler.js";
|
|
14
|
-
import { assetPrefixPathname, isNextStaticPath } from "../utils/asset-prefix.js";
|
|
15
15
|
import { DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, handleConfiguredImageOptimization, isImageOptimizationPath } from "./image-optimization.js";
|
|
16
16
|
import { traceFrameworkRequest } from "./request-tracing.js";
|
|
17
17
|
import { resolveResponseStageCachePolicy } from "./config-headers.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getRequestExecutionContext } from "../shims/request-context.js";
|
|
2
1
|
import { PRERENDER_REVALIDATE_HEADER, PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER, VINEXT_REVALIDATE_HOST_HEADER } from "../utils/protocol-headers.js";
|
|
2
|
+
import { getRequestExecutionContext } from "../shims/request-context.js";
|
|
3
3
|
import { VINEXT_REVALIDATED_CACHE_TAG_HEADER } from "./headers.js";
|
|
4
4
|
import { normalizeDomainHostname } from "../utils/domain-locale.js";
|
|
5
5
|
import { getCdnCacheAdapter } from "../shims/cdn-cache.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { isUnknownRecord } from "../utils/record.js";
|
|
1
2
|
import { VINEXT_PRERENDER_ROUTE_PARAMS_HEADER, VINEXT_PRERENDER_SECRET_HEADER, VINEXT_PRERENDER_SPECULATIVE_HEADER } from "../utils/protocol-headers.js";
|
|
2
3
|
import "./headers.js";
|
|
3
|
-
import { isUnknownRecord } from "../utils/record.js";
|
|
4
4
|
//#region src/server/prerender-route-params.ts
|
|
5
5
|
function isPrerenderRouteParams(value) {
|
|
6
6
|
if (!isUnknownRecord(value)) return false;
|