vinext 1.3.1 → 1.4.1
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 +25 -22
- package/THIRD_PARTY_LICENSES.md +47 -0
- package/dist/_virtual/_rolldown/runtime.js +3 -2
- package/dist/build/prerender.js +4 -3
- package/dist/build/report.d.ts +0 -14
- package/dist/build/report.js +1 -51
- package/dist/check.js +4 -7
- package/dist/cli.js +3 -0
- package/dist/client/dev-error-overlay-store.d.ts +1 -0
- package/dist/client/dev-error-overlay.d.ts +2 -0
- package/dist/client/dev-error-overlay.js +20 -4
- package/dist/client/navigation-runtime.d.ts +13 -1
- package/dist/client/navigation-runtime.js +1 -1
- package/dist/config/config-matchers.js +2 -0
- package/dist/config/destination-params.d.ts +2 -1
- package/dist/config/destination-params.js +52 -2
- package/dist/config/next-config.d.ts +25 -0
- package/dist/config/next-config.js +82 -4
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/dbcs-codec.js +327 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/dbcs-data.js +123 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/index.js +29 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/internal.js +134 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-codec.js +50 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-data-generated.js +455 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-data.js +147 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/big5-added.json.js +169 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp936.json.js +2584 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp949.json.js +2220 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp950.json.js +227 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/eucjp.json.js +425 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/gb18030-ranges.json.js +427 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/gbk-added.json.js +229 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/shiftjis.json.js +292 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/utf16.js +106 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/utf7.js +182 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/bom-handling.js +42 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/extend-node.js +147 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/index.js +94 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/streams.js +95 -0
- package/dist/deps/.pnpm/safer-buffer@2.1.2/deps/safer-buffer/safer.js +45 -0
- package/dist/entries/app-rsc-entry.js +17 -49
- package/dist/entries/app-rsc-manifest.js +3 -4
- package/dist/entries/app-ssr-entry.js +1 -0
- package/dist/entries/pages-server-entry.js +36 -9
- package/dist/index.js +112 -90
- package/dist/init-cloudflare.d.ts +1 -3
- package/dist/init-cloudflare.js +10 -48
- package/dist/init-platform.d.ts +2 -0
- package/dist/init-platform.js +4 -0
- package/dist/plugins/extensionless-dynamic-import.js +6 -2
- package/dist/plugins/next-intl-catalog.d.ts +12 -0
- package/dist/plugins/next-intl-catalog.js +85 -0
- package/dist/plugins/pages-node-externals.d.ts +1 -0
- package/dist/plugins/pages-node-externals.js +1 -1
- package/dist/plugins/strip-server-exports.js +2 -1
- package/dist/plugins/use-cache-callable.d.ts +1 -1
- package/dist/plugins/use-cache-callable.js +136 -94
- package/dist/routing/app-route-graph.d.ts +6 -0
- package/dist/routing/app-route-graph.js +9 -1
- package/dist/server/api-handler.js +21 -5
- package/dist/server/app-bfcache-identity.js +1 -1
- package/dist/server/app-browser-entry.js +86 -66
- package/dist/server/app-browser-history-controller.d.ts +5 -4
- package/dist/server/app-browser-history-controller.js +93 -15
- package/dist/server/app-browser-navigation-controller.d.ts +2 -2
- package/dist/server/app-browser-navigation-controller.js +1 -2
- package/dist/server/app-browser-rsc-redirect.js +7 -7
- package/dist/server/app-browser-server-action-client.d.ts +2 -0
- package/dist/server/app-browser-server-action-client.js +5 -4
- package/dist/server/app-browser-state.d.ts +2 -4
- package/dist/server/app-browser-state.js +9 -4
- package/dist/server/app-browser-supplemental-refresh.js +16 -1
- package/dist/server/app-browser-visible-commit.d.ts +1 -1
- package/dist/server/app-browser-visible-commit.js +4 -14
- package/dist/server/app-elements-wire.d.ts +6 -38
- package/dist/server/app-elements-wire.js +4 -41
- package/dist/server/app-elements.d.ts +2 -2
- package/dist/server/app-elements.js +2 -2
- package/dist/server/app-history-state.d.ts +2 -2
- package/dist/server/app-history-state.js +5 -2
- package/dist/server/app-mounted-layouts.d.ts +21 -0
- package/dist/server/app-mounted-layouts.js +67 -0
- package/dist/server/app-optimistic-routing.d.ts +19 -1
- package/dist/server/app-optimistic-routing.js +43 -4
- package/dist/server/app-page-boundary-render.js +10 -14
- package/dist/server/app-page-boundary.js +2 -2
- package/dist/server/app-page-cache-finalizer.d.ts +12 -1
- package/dist/server/app-page-cache-finalizer.js +70 -29
- package/dist/server/app-page-cache.d.ts +13 -1
- package/dist/server/app-page-cache.js +31 -9
- package/dist/server/app-page-dispatch.d.ts +5 -11
- package/dist/server/app-page-dispatch.js +84 -155
- package/dist/server/app-page-element-builder.d.ts +2 -2
- package/dist/server/app-page-element-builder.js +13 -12
- package/dist/server/app-page-execution.d.ts +17 -52
- package/dist/server/app-page-execution.js +102 -95
- package/dist/server/app-page-head.d.ts +13 -0
- package/dist/server/app-page-head.js +44 -16
- package/dist/server/app-page-http-access-fallback-metadata.d.ts +1 -0
- package/dist/server/app-page-http-access-fallback-metadata.js +2 -2
- package/dist/server/app-page-layout-gate.d.ts +35 -0
- package/dist/server/app-page-layout-gate.js +50 -0
- package/dist/server/app-page-params.d.ts +0 -1
- package/dist/server/app-page-params.js +1 -14
- package/dist/server/app-page-probe.d.ts +3 -21
- package/dist/server/app-page-probe.js +4 -37
- package/dist/server/app-page-render.d.ts +2 -13
- package/dist/server/app-page-render.js +103 -234
- package/dist/server/app-page-request.d.ts +1 -3
- package/dist/server/app-page-request.js +1 -1
- package/dist/server/app-page-response.js +3 -3
- package/dist/server/app-page-route-wiring.d.ts +13 -6
- package/dist/server/app-page-route-wiring.js +86 -63
- package/dist/server/app-page-rsc-render-status.d.ts +27 -1
- package/dist/server/app-page-rsc-render-status.js +121 -13
- package/dist/server/app-page-stream.d.ts +12 -8
- package/dist/server/app-page-stream.js +4 -3
- package/dist/server/app-pages-bridge.d.ts +4 -0
- package/dist/server/app-pages-bridge.js +7 -3
- package/dist/server/app-render-dependency.d.ts +11 -4
- package/dist/server/app-render-dependency.js +86 -38
- package/dist/server/app-request-stage-dispatch.js +1 -1
- package/dist/server/app-request-stage-independent-entry.js +1 -1
- package/dist/server/app-route-handler-cache.js +2 -2
- package/dist/server/app-route-handler-dispatch.js +14 -9
- package/dist/server/app-route-handler-execution.js +11 -5
- package/dist/server/app-route-handler-policy.d.ts +1 -1
- package/dist/server/app-route-handler-policy.js +3 -3
- package/dist/server/app-route-handler-response.js +1 -1
- package/dist/server/app-route-handler-runtime.d.ts +1 -1
- package/dist/server/app-route-handler-runtime.js +28 -11
- package/dist/server/app-router-entry.js +1 -1
- package/dist/server/app-rsc-cache-busting.d.ts +12 -12
- package/dist/server/app-rsc-cache-busting.js +31 -72
- package/dist/server/app-rsc-error-handler.d.ts +2 -1
- package/dist/server/app-rsc-error-handler.js +10 -2
- package/dist/server/app-rsc-errors.d.ts +8 -0
- package/dist/server/app-rsc-errors.js +11 -1
- package/dist/server/app-rsc-handler.d.ts +5 -5
- package/dist/server/app-rsc-handler.js +80 -83
- package/dist/server/app-rsc-request-normalization.d.ts +10 -16
- package/dist/server/app-rsc-request-normalization.js +12 -18
- package/dist/server/app-rsc-response-finalizer.js +2 -2
- package/dist/server/app-rsc-response-stage.js +9 -15
- package/dist/server/app-server-action-execution.d.ts +3 -1
- package/dist/server/app-server-action-execution.js +15 -8
- package/dist/server/app-ssr-entry.d.ts +8 -0
- package/dist/server/app-ssr-entry.js +22 -16
- package/dist/server/app-ssr-stream.js +1 -1
- package/dist/server/app-visited-response-cache.d.ts +36 -1
- package/dist/server/app-visited-response-cache.js +46 -5
- package/dist/server/app-worker-stages.d.ts +37 -6
- package/dist/server/app-worker-stages.js +81 -9
- package/dist/server/artifact-compatibility.d.ts +0 -1
- package/dist/server/artifact-compatibility.js +1 -10
- package/dist/server/bfcache-identity.d.ts +7 -0
- package/dist/server/bfcache-identity.js +10 -1
- package/dist/server/cache-proof.d.ts +1 -115
- package/dist/server/cache-proof.js +1 -544
- package/dist/server/cacheability-manifest.js +1 -2
- package/dist/server/cacheability-request.js +13 -8
- package/dist/server/dev-origin-check.d.ts +2 -1
- package/dist/server/dev-origin-check.js +2 -1
- package/dist/server/dev-server.js +6 -4
- package/dist/server/headers.d.ts +6 -3
- package/dist/server/headers.js +9 -5
- package/dist/server/image-optimization.d.ts +5 -0
- package/dist/server/image-optimization.js +6 -1
- package/dist/server/isr-cache.d.ts +8 -2
- package/dist/server/isr-cache.js +30 -2
- package/dist/server/metadata-route-response.js +32 -15
- package/dist/server/middleware-matcher.js +19 -6
- package/dist/server/middleware-runtime.js +6 -2
- package/dist/server/multi-stage.d.ts +57 -12
- package/dist/server/multi-stage.js +13 -1
- package/dist/server/navigation-planner.js +1 -1
- package/dist/server/pages-api-route.js +28 -19
- package/dist/server/pages-media-type.d.ts +21 -1
- package/dist/server/pages-media-type.js +69 -5
- package/dist/server/pages-node-compat.d.ts +1 -1
- package/dist/server/pages-node-compat.js +54 -27
- package/dist/server/pages-page-data.js +2 -1
- package/dist/server/pages-page-handler.js +28 -26
- package/dist/server/pages-page-response.d.ts +9 -0
- package/dist/server/pages-page-response.js +18 -4
- package/dist/server/pages-request-pipeline.d.ts +8 -0
- package/dist/server/pages-request-pipeline.js +2 -2
- package/dist/server/pages-request-stage-entry.js +36 -14
- package/dist/server/pages-response-stage-entry.js +9 -3
- package/dist/server/pages-router-entry.js +3 -2
- package/dist/server/prod-server.d.ts +2 -2
- package/dist/server/prod-server.js +47 -9
- package/dist/server/request-error-log.d.ts +9 -0
- package/dist/server/request-error-log.js +13 -0
- package/dist/server/request-pipeline.d.ts +15 -4
- package/dist/server/request-pipeline.js +43 -15
- package/dist/server/rsc-completion-metadata.js +3 -0
- package/dist/server/shared-cache-identity.d.ts +23 -0
- package/dist/server/shared-cache-identity.js +36 -0
- package/dist/server/static-file-cache.d.ts +9 -0
- package/dist/server/static-file-cache.js +13 -2
- package/dist/server/worker-stages.d.ts +16 -3
- package/dist/server/worker-stages.js +23 -4
- package/dist/shims/cache-handler.js +2 -2
- package/dist/shims/cache-request-state.d.ts +23 -26
- package/dist/shims/cache-request-state.js +22 -57
- package/dist/shims/cache-runtime.d.ts +3 -1
- package/dist/shims/cache-runtime.js +94 -48
- package/dist/shims/cache.d.ts +16 -10
- package/dist/shims/cache.js +47 -36
- package/dist/shims/cacheability-classification.d.ts +2 -0
- package/dist/shims/cdn-cache.d.ts +22 -5
- package/dist/shims/client-hook-error.d.ts +2 -0
- package/dist/shims/client-hook-error.js +16 -1
- package/dist/shims/client-page-root.js +2 -2
- package/dist/shims/dynamic.js +9 -6
- package/dist/shims/error-boundary.js +2 -2
- package/dist/shims/fetch-cache-state.d.ts +5 -1
- package/dist/shims/fetch-cache-state.js +1 -3
- package/dist/shims/fetch-cache.d.ts +2 -1
- package/dist/shims/fetch-cache.js +39 -25
- package/dist/shims/form.js +2 -2
- package/dist/shims/headers.d.ts +10 -24
- package/dist/shims/headers.js +22 -70
- package/dist/shims/internal/cache-context-accessor.d.ts +1 -1
- package/dist/shims/internal/navigation-untracked.js +1 -1
- package/dist/shims/link.js +8 -11
- package/dist/shims/metadata.d.ts +23 -21
- package/dist/shims/metadata.js +62 -24
- package/dist/shims/navigation-server.js +1 -1
- package/dist/shims/navigation.d.ts +74 -7
- package/dist/shims/navigation.js +184 -31
- package/dist/shims/navigation.react-server.js +2 -2
- package/dist/shims/request-state-types.d.ts +3 -2
- package/dist/shims/slot.d.ts +16 -0
- package/dist/shims/slot.js +44 -9
- package/dist/shims/unified-request-context.d.ts +7 -1
- package/dist/shims/unified-request-context.js +3 -3
- package/dist/utils/cache-control-metadata.d.ts +5 -0
- package/dist/utils/cache-control-metadata.js +9 -1
- package/dist/utils/cache-life-profiles.d.ts +33 -0
- package/dist/utils/cache-life-profiles.js +111 -0
- package/dist/utils/middleware-request-headers.d.ts +14 -3
- package/dist/utils/middleware-request-headers.js +54 -7
- package/dist/utils/project.d.ts +2 -2
- package/dist/utils/project.js +3 -16
- package/dist/utils/regex.d.ts +5 -0
- package/dist/utils/regex.js +11 -1
- package/dist/utils/text-stream.d.ts +10 -5
- package/dist/utils/text-stream.js +6 -6
- package/package.json +2 -1
- package/dist/build/layout-classification-types.d.ts +0 -60
- package/dist/build/layout-classification-types.js +0 -1
- package/dist/build/layout-classification.d.ts +0 -62
- package/dist/build/layout-classification.js +0 -98
- package/dist/build/route-classification-injector.d.ts +0 -33
- package/dist/build/route-classification-injector.js +0 -59
- package/dist/build/route-classification-manifest.d.ts +0 -54
- package/dist/build/route-classification-manifest.js +0 -143
- package/dist/server/app-browser-client-reuse-manifest.d.ts +0 -11
- package/dist/server/app-browser-client-reuse-manifest.js +0 -101
- package/dist/server/app-layout-param-observation.d.ts +0 -42
- package/dist/server/app-layout-param-observation.js +0 -168
- package/dist/server/client-reuse-manifest.d.ts +0 -103
- package/dist/server/client-reuse-manifest.js +0 -209
- package/dist/server/skip-cache-proof.d.ts +0 -60
- package/dist/server/skip-cache-proof.js +0 -168
- package/dist/server/static-layout-client-reuse-proof.d.ts +0 -14
- package/dist/server/static-layout-client-reuse-proof.js +0 -33
- package/dist/utils/sorted-array.d.ts +0 -8
- package/dist/utils/sorted-array.js +0 -20
|
@@ -1,34 +1,32 @@
|
|
|
1
1
|
import { closeAfterResponse, createRequestContext, runWithRequestContext } from "../shims/unified-request-context.js";
|
|
2
2
|
import "../utils/protocol-headers.js";
|
|
3
3
|
import { VINEXT_INTERCEPTION_ID_HEADER, VINEXT_RSC_VARY_HEADER } from "./app-rsc-vary.js";
|
|
4
|
-
import "./headers.js";
|
|
4
|
+
import { VINEXT_MOUNTED_LAYOUTS_HEADER } from "./headers.js";
|
|
5
5
|
import { getRequestExecutionContext } from "../shims/request-context.js";
|
|
6
6
|
import { runInWorkStoreScope } from "../shims/internal/work-store-scope.js";
|
|
7
7
|
import { beginRouteCacheability, isRouteCacheabilityIdentityProbe, isRouteCacheabilityProbe, markRouteCacheabilityPatternDynamic, readRouteCacheabilityState } from "../shims/cacheability-classification.js";
|
|
8
8
|
import { APP_RSC_RENDER_MODE_PREFETCH_DYNAMIC_SHELL } from "./app-rsc-render-mode.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { coalesceOnDemandResponse } from "./isr-cache.js";
|
|
10
|
+
import { consumeDynamicUsage, consumeInvalidDynamicUsageError, getAndClearPendingCookies, getDraftModeCookieHeader, getHeadersContext, isDraftModeRequest, peekDynamicUsage, peekRenderRequestApiUsage, runWithConnectionProbe, runWithDetachedDynamicUsage, setHeadersContext } from "../shims/headers.js";
|
|
11
|
+
import { _captureRequestScopedCacheLifeAccessors, _isOnDemandRevalidate } from "../shims/cache-request-state.js";
|
|
11
12
|
import { ensureFetchPatch, getCollectedFetchTags, peekDynamicFetchObservations, runWithFetchDedupe, setCurrentFetchCacheMode, setCurrentFetchRevalidate, setCurrentFetchSoftTags, setCurrentForceDynamicFetchDefault, setRefreshStaleFetchesInForeground } from "../shims/fetch-cache.js";
|
|
12
13
|
import { cacheabilityManifestPageState } from "./cacheability-manifest.js";
|
|
13
14
|
import { isAppPageStaticEligible } from "./app-segment-config.js";
|
|
14
|
-
import { isAppClientReference } from "./app-render-dependency.js";
|
|
15
|
-
import { AppElementsWire } from "./app-elements-wire.js";
|
|
16
|
-
import "./app-elements.js";
|
|
17
|
-
import { VINEXT_RSC_CONTENT_TYPE, applyRscCompatibilityIdHeader, applyRscDeploymentIdHeader } from "./app-rsc-cache-busting.js";
|
|
18
|
-
import { mergeMiddlewareResponseHeaders } from "./middleware-response-headers.js";
|
|
19
15
|
import { getFrameworkLinkHeader } from "./app-response-header-provenance.js";
|
|
16
|
+
import { traceResponseStart } from "./response-start-tracing.js";
|
|
17
|
+
import { mergeMiddlewareResponseHeaders } from "./middleware-response-headers.js";
|
|
18
|
+
import { VINEXT_RSC_CONTENT_TYPE, applyRscCompatibilityIdHeader, applyRscDeploymentIdHeader } from "./app-rsc-cache-busting.js";
|
|
19
|
+
import { parseMountedLayoutsHeader } from "./app-mounted-layouts.js";
|
|
20
20
|
import { resolveUncacheableCacheControl } from "./app-page-response.js";
|
|
21
21
|
import { buildRscRedirectFlightStream } from "./app-rsc-redirect-flight.js";
|
|
22
22
|
import { buildAppPageSpecialErrorResponse, resolveAppPageCaughtNotFoundBoundaries, resolveAppPageShellSpecialError, resolveAppPageSpecialError, resolveAppPageSpecialErrorStoredHeaders } from "./app-page-execution.js";
|
|
23
|
-
import { resolveAppPageTraceOperation } from "./app-page-tracing.js";
|
|
24
|
-
import { createAppPageTreePath } from "./app-page-route-wiring.js";
|
|
25
|
-
import { traceResponseStart } from "./response-start-tracing.js";
|
|
26
23
|
import { resolveAppPageLayoutHttpAccessBoundary, resolveAppPageParentHttpAccessBoundary, resolveAppPageRootHttpAccessBoundaryTreePosition } from "./app-page-boundary.js";
|
|
24
|
+
import { isAppClientReference } from "./app-render-dependency.js";
|
|
25
|
+
import { resolveAppPageTraceOperation } from "./app-page-tracing.js";
|
|
27
26
|
import { shouldServeStreamingMetadata } from "./streaming-metadata.js";
|
|
28
27
|
import { resolveAppPageNavigationParams } from "./app-page-element-builder.js";
|
|
29
28
|
import { createAppPageRscErrorTracker } from "./app-page-stream.js";
|
|
30
29
|
import { getDefaultHttpAccessFallbackModule } from "./default-http-access-fallback-modules.js";
|
|
31
|
-
import { createAppLayoutParamAccessTracker, isAppLayoutObservationUnsafeForStaticReuse } from "./app-layout-param-observation.js";
|
|
32
30
|
import { consumeAppPageRenderObservationState, discardAppPageRenderState } from "./app-page-render-observation.js";
|
|
33
31
|
import { buildAppPageTags } from "./implicit-tags.js";
|
|
34
32
|
import { resolveAppPageMethodResponse } from "./app-page-method.js";
|
|
@@ -57,75 +55,6 @@ function resolveAppPageRouteBoundaryModule(route, statusCode) {
|
|
|
57
55
|
if (statusCode === 404) return route.notFound ?? null;
|
|
58
56
|
return null;
|
|
59
57
|
}
|
|
60
|
-
/**
|
|
61
|
-
* Request-time counterpart to the build-time `classifyLayoutSegmentConfig`
|
|
62
|
-
* (`build/report.ts`). Both classify a layout by its `dynamic`/`revalidate`
|
|
63
|
-
* segment config and agree on the shared cases (the build-time version
|
|
64
|
-
* normalizes `revalidate = false` to `Infinity` upstream, so both treat it as
|
|
65
|
-
* static); keep them aligned when either changes.
|
|
66
|
-
*
|
|
67
|
-
* The meaningful difference is scope, not logic: this request-time pass reads
|
|
68
|
-
* the resolved module value, so it classifies layouts that were never captured
|
|
69
|
-
* at build time (e.g. dev mode). Its result is merged on top of the build-time
|
|
70
|
-
* classification map in `createEffectiveLayoutClassifications`, so such layouts
|
|
71
|
-
* are classified here where they previously were not.
|
|
72
|
-
*/
|
|
73
|
-
function classifyLayoutSegmentConfigFromModule(layout) {
|
|
74
|
-
if (!layout) return null;
|
|
75
|
-
switch (layout.dynamic) {
|
|
76
|
-
case "force-dynamic": return {
|
|
77
|
-
kind: "dynamic",
|
|
78
|
-
reason: {
|
|
79
|
-
layer: "segment-config",
|
|
80
|
-
key: "dynamic",
|
|
81
|
-
value: "force-dynamic"
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
case "force-static":
|
|
85
|
-
case "error": return {
|
|
86
|
-
kind: "static",
|
|
87
|
-
reason: {
|
|
88
|
-
layer: "segment-config",
|
|
89
|
-
key: "dynamic",
|
|
90
|
-
value: layout.dynamic
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
if (layout.revalidate === false || layout.revalidate === Infinity) return {
|
|
95
|
-
kind: "static",
|
|
96
|
-
reason: {
|
|
97
|
-
layer: "segment-config",
|
|
98
|
-
key: "revalidate",
|
|
99
|
-
value: Infinity
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
if (layout.revalidate === 0) return {
|
|
103
|
-
kind: "dynamic",
|
|
104
|
-
reason: {
|
|
105
|
-
layer: "segment-config",
|
|
106
|
-
key: "revalidate",
|
|
107
|
-
value: 0
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
function createEffectiveLayoutClassifications(route, includeReasons) {
|
|
113
|
-
const classifications = new Map(route.__buildTimeClassifications ?? []);
|
|
114
|
-
const reasons = includeReasons ? new Map(route.__buildTimeReasons ?? []) : null;
|
|
115
|
-
for (let index = 0; index < route.layouts.length; index++) {
|
|
116
|
-
const classification = classifyLayoutSegmentConfigFromModule(route.layouts[index]);
|
|
117
|
-
if (classification === null) continue;
|
|
118
|
-
classifications.set(index, classification.kind);
|
|
119
|
-
reasons?.set(index, classification.reason);
|
|
120
|
-
}
|
|
121
|
-
return {
|
|
122
|
-
buildTimeClassifications: classifications.size > 0 ? classifications : null,
|
|
123
|
-
buildTimeReasons: reasons && reasons.size > 0 ? reasons : null
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
function getEffectiveLayoutClassifications(route, debugClassification) {
|
|
127
|
-
return createEffectiveLayoutClassifications(route, debugClassification !== void 0);
|
|
128
|
-
}
|
|
129
58
|
function shouldReadAppPageCache(options) {
|
|
130
59
|
return options.isProduction && !options.isProgressiveActionRender && !options.isDraftMode && !options.isForceDynamic && (options.isRscRequest || !options.scriptNonce) && (options.revalidateSeconds === null || options.revalidateSeconds > 0);
|
|
131
60
|
}
|
|
@@ -266,8 +195,6 @@ async function dispatchAppPageInner(options) {
|
|
|
266
195
|
const shouldUseEmptySearchParams = isForceStatic || isPrefetchDynamicShell;
|
|
267
196
|
const hasRequestSearchParams = !shouldUseEmptySearchParams && hasSearchParams(options.searchParams);
|
|
268
197
|
const pageSearchParams = shouldUseEmptySearchParams ? new URLSearchParams() : options.searchParams;
|
|
269
|
-
const layoutParamAccess = createAppLayoutParamAccessTracker();
|
|
270
|
-
const activeLoadingTreePositions = getActiveLoadingTreePositions(route);
|
|
271
198
|
setCurrentFetchSoftTags(buildAppPageTags(options.cleanPathname, [], route.routeSegments));
|
|
272
199
|
setCurrentFetchCacheMode(options.fetchCache ?? null);
|
|
273
200
|
setCurrentFetchRevalidate(currentRevalidateSeconds);
|
|
@@ -324,9 +251,12 @@ async function dispatchAppPageInner(options) {
|
|
|
324
251
|
scriptNonce: options.scriptNonce
|
|
325
252
|
});
|
|
326
253
|
const isNeverStoredPath = options.pprRuntime === void 0 && hasNoManifestAdmissionState(route.pattern);
|
|
327
|
-
const
|
|
254
|
+
const isStoredRender = !isRouteCacheabilityProbe() && isCacheEligibleRender && !isNeverStoredPath;
|
|
255
|
+
const isOnDemandRevalidate = _isOnDemandRevalidate();
|
|
256
|
+
const shouldReadCache = isStoredRender && !isOnDemandRevalidate;
|
|
328
257
|
const isCacheCandidate = isCacheEligibleRender && isStaticEligible && options.pprFallbackShell === void 0 && !isNeverStoredPath;
|
|
329
258
|
const isUncacheableRender = !(isCacheEligibleRender && isStaticEligible) && options.pprFallbackShell === void 0 && (options.pprRuntime === void 0 || !options.isProduction);
|
|
259
|
+
const mountedLayouts = isUncacheableRender && options.isRscRequest && (options.renderMode ?? "navigation") === "navigation" && options.interceptionContext === null && options.isProgressiveActionRender !== true ? parseMountedLayoutsHeader(options.request.headers.get(VINEXT_MOUNTED_LAYOUTS_HEADER)) : null;
|
|
330
260
|
if (shouldReadCache && isStaticEligible) {
|
|
331
261
|
traceOperation = resolveAppPageTraceOperation({
|
|
332
262
|
hasRequestSearchParams,
|
|
@@ -387,7 +317,8 @@ async function dispatchAppPageInner(options) {
|
|
|
387
317
|
isForceStatic,
|
|
388
318
|
revalidateSeconds: currentRevalidateSeconds
|
|
389
319
|
}),
|
|
390
|
-
|
|
320
|
+
isDynamicRscRequest: options.pprRuntime !== void 0 && options.isRscRequest && options.request.headers.get("Next-Router-Prefetch") !== "1" && options.renderedConcreteUrlPaths?.has(options.cleanPathname) !== true,
|
|
321
|
+
renderFreshPageForCache: async ({ renderDocument }) => {
|
|
391
322
|
const revalidationTarget = await resolveCacheRenderTarget();
|
|
392
323
|
const revalidationDynamicConfig = options.resolveRouteDynamicConfig?.(revalidationTarget.route) ?? (revalidationTarget.route === route ? dynamicConfig : void 0);
|
|
393
324
|
const revalidationConfigRevalidateSeconds = options.resolveRouteRevalidateSeconds?.(revalidationTarget.route) ?? (revalidationTarget.route === route ? currentRevalidateSeconds : null);
|
|
@@ -412,7 +343,7 @@ async function dispatchAppPageInner(options) {
|
|
|
412
343
|
setNavigationContext: options.setNavigationContext
|
|
413
344
|
}, async () => {
|
|
414
345
|
const { renderAppPageCacheArtifacts } = await import("./app-page-cache-render.js");
|
|
415
|
-
const revalidatedElement = await options.buildPageElement(revalidationTarget.route, revalidationTarget.params, revalidationTarget.interceptOpts, new URLSearchParams(),
|
|
346
|
+
const revalidatedElement = await options.buildPageElement(revalidationTarget.route, revalidationTarget.params, revalidationTarget.interceptOpts, new URLSearchParams(), {
|
|
416
347
|
isForceStatic: revalidationDynamicConfig === "force-static",
|
|
417
348
|
observeMetadataSearchParamsAccess: revalidationDynamicConfig !== "force-static",
|
|
418
349
|
observePageSearchParamsAccess: revalidationDynamicConfig !== "force-static",
|
|
@@ -450,24 +381,22 @@ async function dispatchAppPageInner(options) {
|
|
|
450
381
|
return baseRevalidatedOnSsrError(error, void 0, void 0);
|
|
451
382
|
},
|
|
452
383
|
reactMaxHeadersLength: options.reactMaxHeadersLength,
|
|
453
|
-
resolveCaughtNotFoundBoundaries:
|
|
384
|
+
resolveCaughtNotFoundBoundaries: renderDocument ? (error) => resolveAppPageCaughtNotFoundBoundaries(error, rscErrorTracker.getCapturedSpecialErrors(error)) : void 0,
|
|
454
385
|
async renderShellSpecialError(error, caughtDocument) {
|
|
455
386
|
const specialError = resolveAppPageShellSpecialError(error, rscErrorTracker.getCapturedSpecialErrors(error));
|
|
456
387
|
if (!specialError) return null;
|
|
457
|
-
if (options.isRscRequest)
|
|
458
|
-
|
|
459
|
-
return {
|
|
460
|
-
headers: resolveAppPageSpecialErrorStoredHeaders(specialError, options.basePath),
|
|
461
|
-
html: "",
|
|
462
|
-
status: specialError.statusCode
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
|
-
if (caughtDocument) return {
|
|
388
|
+
if (options.isRscRequest && specialError.fromMetadata === true) return null;
|
|
389
|
+
if (renderDocument && caughtDocument) return {
|
|
466
390
|
headers: resolveAppPageSpecialErrorStoredHeaders(specialError, options.basePath),
|
|
467
391
|
html: caughtDocument.html,
|
|
468
392
|
linkHeader: caughtDocument.linkHeader,
|
|
469
393
|
status: specialError.statusCode
|
|
470
394
|
};
|
|
395
|
+
if (!renderDocument || options.isRscRequest) return {
|
|
396
|
+
headers: resolveAppPageSpecialErrorStoredHeaders(specialError, options.basePath),
|
|
397
|
+
html: "",
|
|
398
|
+
status: specialError.statusCode
|
|
399
|
+
};
|
|
471
400
|
if (revalidationTarget.route !== route) return null;
|
|
472
401
|
const document = await renderPageSpecialError(options, specialError, false, revalidationTarget.interceptOpts, true, void 0, revalidationRouteHead);
|
|
473
402
|
if (document.status !== specialError.statusCode) return null;
|
|
@@ -519,7 +448,11 @@ async function dispatchAppPageInner(options) {
|
|
|
519
448
|
params: options.staticParamsValidationParams ?? options.params
|
|
520
449
|
});
|
|
521
450
|
if (dynamicParamsResponse) {
|
|
522
|
-
const
|
|
451
|
+
const boundaryModule = route.notFound ?? getDefaultHttpAccessFallbackModule(404);
|
|
452
|
+
const renderedNotFound = await options.renderHttpAccessFallbackPage(404, {
|
|
453
|
+
boundaryModule,
|
|
454
|
+
matchedParams: options.params
|
|
455
|
+
}, options.middlewareContext);
|
|
523
456
|
const cachePolicy = {
|
|
524
457
|
dynamicStaleTimeSeconds: options.dynamicStaleTimeSeconds,
|
|
525
458
|
isDraftMode,
|
|
@@ -555,7 +488,7 @@ async function dispatchAppPageInner(options) {
|
|
|
555
488
|
renderedRouteHead.value = head;
|
|
556
489
|
};
|
|
557
490
|
const interceptResult = await resolveAppPageIntercept({
|
|
558
|
-
async buildPageElement(interceptRoute, interceptParams, interceptOpts, interceptSearchParams
|
|
491
|
+
async buildPageElement(interceptRoute, interceptParams, interceptOpts, interceptSearchParams) {
|
|
559
492
|
const sourceDynamicConfig = interceptDynamicConfigResolved ? interceptDynamicConfig : options.resolveRouteDynamicConfig?.(interceptRoute);
|
|
560
493
|
if (sourceDynamicConfig === "force-static" || sourceDynamicConfig === "error") {
|
|
561
494
|
const { createStaticGenerationHeadersContext } = await import("./app-static-generation.js");
|
|
@@ -572,7 +505,7 @@ async function dispatchAppPageInner(options) {
|
|
|
572
505
|
setCurrentFetchCacheMode(options.resolveRouteFetchCacheMode?.(interceptRoute) ?? null);
|
|
573
506
|
setCurrentFetchRevalidate(sourceRevalidateSeconds);
|
|
574
507
|
setCurrentForceDynamicFetchDefault(sourceDynamicConfig === "force-dynamic");
|
|
575
|
-
return options.buildPageElement(interceptRoute, interceptParams, interceptOpts, interceptSearchParams,
|
|
508
|
+
return options.buildPageElement(interceptRoute, interceptParams, interceptOpts, interceptSearchParams, {
|
|
576
509
|
isForceStatic: sourceDynamicConfig === "force-static",
|
|
577
510
|
observeMetadataSearchParamsAccess: sourceDynamicConfig !== "force-static",
|
|
578
511
|
observePageSearchParamsAccess: sourceDynamicConfig !== "force-static",
|
|
@@ -594,7 +527,6 @@ async function dispatchAppPageInner(options) {
|
|
|
594
527
|
return options.getSourceRoute(sourceRouteIndex);
|
|
595
528
|
},
|
|
596
529
|
isRscRequest: options.isRscRequest,
|
|
597
|
-
layoutParamAccess,
|
|
598
530
|
resolveNavigationParams(sourceRoute, navigationParams, pathname, interceptOpts) {
|
|
599
531
|
return resolveAppPageNavigationParams(sourceRoute, navigationParams, pathname, interceptOpts);
|
|
600
532
|
},
|
|
@@ -631,11 +563,12 @@ async function dispatchAppPageInner(options) {
|
|
|
631
563
|
buildPageElement() {
|
|
632
564
|
renderedRouteHead.value = null;
|
|
633
565
|
if (options.actionFailed) throw options.actionError;
|
|
634
|
-
return options.buildPageElement(route, options.params, interceptResult.interceptOpts, pageSearchParams,
|
|
566
|
+
return options.buildPageElement(route, options.params, interceptResult.interceptOpts, pageSearchParams, {
|
|
635
567
|
isForceStatic,
|
|
636
568
|
observeMetadataSearchParamsAccess: !isForceStatic,
|
|
637
569
|
observePageSearchParamsAccess: !isForceStatic,
|
|
638
570
|
isUncacheableRender,
|
|
571
|
+
mountedLayouts: interceptResult.interceptOpts ? null : mountedLayouts,
|
|
639
572
|
serveStreamingMetadata: placeGeneratedMetadataInBody,
|
|
640
573
|
placeStreamedMetadataInHead: options.renderWholeDocument === true,
|
|
641
574
|
onHeadPrepared
|
|
@@ -662,13 +595,13 @@ async function dispatchAppPageInner(options) {
|
|
|
662
595
|
discardAppPageRenderState();
|
|
663
596
|
}
|
|
664
597
|
const navigationParams = resolveAppPageNavigationParams(route, options.params, options.cleanPathname, interceptResult.interceptOpts);
|
|
665
|
-
const layoutClassifications = getEffectiveLayoutClassifications(route, options.debugClassification);
|
|
666
598
|
const activeFallbackShellState = options.pprRuntime?.getState() ?? null;
|
|
667
599
|
const pprFallbackShellSignal = activeFallbackShellState?.abortController.signal;
|
|
668
600
|
const pprFallbackShellReactSignal = activeFallbackShellState?.reactAbortController.signal;
|
|
669
601
|
const isSpeculativePrerender = isPrerender && options.request.headers.get("x-vinext-prerender-speculative") === "1";
|
|
670
602
|
const requestCacheLife = _captureRequestScopedCacheLifeAccessors();
|
|
671
|
-
|
|
603
|
+
const onDemandCacheWrites = isOnDemandRevalidate ? [] : null;
|
|
604
|
+
const lifecycleOptions = {
|
|
672
605
|
basePath: options.basePath,
|
|
673
606
|
bypassInterceptionContextCache: options.bypassInterceptionContextCache,
|
|
674
607
|
clientTraceMetadata: options.clientTraceMetadata,
|
|
@@ -692,7 +625,6 @@ async function dispatchAppPageInner(options) {
|
|
|
692
625
|
});
|
|
693
626
|
return { element: pageBuildResult.element };
|
|
694
627
|
},
|
|
695
|
-
clientReuseManifest: options.clientReuseManifest,
|
|
696
628
|
getDraftModeCookieHeader,
|
|
697
629
|
getFontLinks: options.getFontLinks,
|
|
698
630
|
getFontPreloads: options.getFontPreloads,
|
|
@@ -732,7 +664,6 @@ async function dispatchAppPageInner(options) {
|
|
|
732
664
|
interceptionContext: options.interceptionContext,
|
|
733
665
|
interceptionId,
|
|
734
666
|
expireSeconds: options.expireSeconds,
|
|
735
|
-
layoutCount: getAppPageLayoutProbeCount(route, activeLoadingTreePositions),
|
|
736
667
|
loadSsrHandler: options.loadSsrHandler,
|
|
737
668
|
middlewareContext: options.middlewareContext,
|
|
738
669
|
navigationParams,
|
|
@@ -743,7 +674,6 @@ async function dispatchAppPageInner(options) {
|
|
|
743
674
|
abortPprFallbackShell: activeFallbackShellState ? () => {
|
|
744
675
|
options.pprRuntime.beginFinalRender(activeFallbackShellState);
|
|
745
676
|
} : void 0,
|
|
746
|
-
layoutParamAccess,
|
|
747
677
|
rootParams: options.rootParams,
|
|
748
678
|
peekRenderObservationState() {
|
|
749
679
|
return {
|
|
@@ -751,24 +681,6 @@ async function dispatchAppPageInner(options) {
|
|
|
751
681
|
requestApis: peekRenderRequestApiUsage()
|
|
752
682
|
};
|
|
753
683
|
},
|
|
754
|
-
probeLayoutAt(layoutIndex) {
|
|
755
|
-
return options.probeLayoutAt(layoutIndex, layoutParamAccess);
|
|
756
|
-
},
|
|
757
|
-
classification: {
|
|
758
|
-
getLayoutId(index) {
|
|
759
|
-
const treePosition = route.layoutTreePositions?.[index] ?? 0;
|
|
760
|
-
return AppElementsWire.encodeLayoutId(createAppPageTreePath([...route.routeSegments], treePosition));
|
|
761
|
-
},
|
|
762
|
-
buildTimeClassifications: layoutClassifications.buildTimeClassifications,
|
|
763
|
-
buildTimeReasons: layoutClassifications.buildTimeReasons,
|
|
764
|
-
debugClassification: options.debugClassification,
|
|
765
|
-
isLayoutObservationDynamic(layoutId) {
|
|
766
|
-
return isAppLayoutObservationUnsafeForStaticReuse(layoutParamAccess.getLayoutObservation(layoutId));
|
|
767
|
-
},
|
|
768
|
-
async runWithIsolatedDynamicScope(fn) {
|
|
769
|
-
return runWithIsolatedDynamicUsage(fn);
|
|
770
|
-
}
|
|
771
|
-
},
|
|
772
684
|
dynamicStaleTimeSeconds: options.dynamicStaleTimeSeconds,
|
|
773
685
|
revalidateSeconds: currentRevalidateSeconds,
|
|
774
686
|
mountedSlotsHeader: options.mountedSlotsHeader,
|
|
@@ -776,24 +688,28 @@ async function dispatchAppPageInner(options) {
|
|
|
776
688
|
renderErrorBoundaryResponse(renderError, errorOrigin) {
|
|
777
689
|
return options.renderErrorBoundaryPage(renderError, errorOrigin);
|
|
778
690
|
},
|
|
779
|
-
renderLayoutSpecialError(specialError, layoutIndex) {
|
|
780
|
-
return renderLayoutSpecialError(options, specialError, layoutIndex, serveStreamingMetadata, renderedRouteHead);
|
|
781
|
-
},
|
|
782
691
|
renderPageSpecialError(specialError, renderOptions) {
|
|
783
692
|
return renderPageSpecialError(options, specialError, serveStreamingMetadata, interceptResult.interceptOpts, renderOptions?.isCacheCandidate === true, renderOptions?.caughtDocument, renderedRouteHead);
|
|
784
693
|
},
|
|
785
694
|
renderToReadableStream: options.renderToReadableStream,
|
|
786
|
-
hasCustomGlobalError: options.hasCustomGlobalError,
|
|
787
695
|
prerenderToReadableStream: options.prerenderToReadableStream,
|
|
788
696
|
routePattern: route.pattern,
|
|
789
|
-
runWithSuppressedHookWarning(probe) {
|
|
790
|
-
return options.runWithSuppressedHookWarning(probe);
|
|
791
|
-
},
|
|
792
697
|
scriptNonce: options.scriptNonce,
|
|
793
698
|
waitUntil(cachePromise) {
|
|
699
|
+
onDemandCacheWrites?.push(cachePromise);
|
|
794
700
|
getRequestExecutionContext()?.waitUntil(cachePromise);
|
|
795
701
|
}
|
|
796
|
-
}
|
|
702
|
+
};
|
|
703
|
+
const renderResponse = async () => {
|
|
704
|
+
const response = await renderAppPageLifecycle(lifecycleOptions);
|
|
705
|
+
if (onDemandCacheWrites) await Promise.all(onDemandCacheWrites);
|
|
706
|
+
return response;
|
|
707
|
+
};
|
|
708
|
+
if (isOnDemandRevalidate && isStoredRender && isStaticEligible && !(options.isRscRequest && options.mountedSlotsHeader)) {
|
|
709
|
+
const cacheKey = options.isRscRequest ? options.isrRscKey(options.cleanPathname, null, options.renderMode, options.interceptionContext, interceptionId) : options.isrHtmlKey(options.cleanPathname);
|
|
710
|
+
return coalesceOnDemandResponse(`${options.request.method}:${cacheKey}`, options.request.method, renderResponse);
|
|
711
|
+
}
|
|
712
|
+
return renderResponse();
|
|
797
713
|
}
|
|
798
714
|
/**
|
|
799
715
|
* A signal the route's own render threw keeps the route's head, reusing the
|
|
@@ -810,28 +726,31 @@ function resolveFallbackRouteHead(options, renderedRouteHead) {
|
|
|
810
726
|
prepared: value
|
|
811
727
|
};
|
|
812
728
|
}
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
729
|
+
/**
|
|
730
|
+
* The outermost layout above every loading boundary whose subtree throws the
|
|
731
|
+
* HTTP access fallback with `statusCode`. The document's shell rejected with
|
|
732
|
+
* one that a component nothing tags threw: one a layout renders, the page
|
|
733
|
+
* renders or a template. This runs only on that error path, as a layout's own
|
|
734
|
+
* component tags what it throws.
|
|
735
|
+
*/
|
|
736
|
+
async function findAppPageLayoutSubtreeSpecialErrorIndex(options, statusCode, limit) {
|
|
737
|
+
const layoutCount = Math.min(limit, getAppPageLayoutProbeCount(options.route, getActiveLoadingTreePositions(options.route)));
|
|
738
|
+
if (layoutCount === 0) return null;
|
|
739
|
+
return await runWithDetachedDynamicUsage(() => options.runWithSuppressedHookWarning(async () => {
|
|
740
|
+
for (let layoutIndex = 0; layoutIndex < layoutCount; layoutIndex++) {
|
|
741
|
+
const outcome = await runWithConnectionProbe(async () => {
|
|
742
|
+
try {
|
|
743
|
+
await options.probeLayoutAt(layoutIndex);
|
|
744
|
+
return false;
|
|
745
|
+
} catch (error) {
|
|
746
|
+
const specialError = resolveAppPageSpecialError(error);
|
|
747
|
+
return specialError?.kind === "http-access-fallback" && specialError.statusCode === statusCode;
|
|
748
|
+
}
|
|
830
749
|
});
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
});
|
|
750
|
+
if (outcome.completed && outcome.result) return layoutIndex;
|
|
751
|
+
}
|
|
752
|
+
return null;
|
|
753
|
+
}));
|
|
835
754
|
}
|
|
836
755
|
/**
|
|
837
756
|
* The fallback for a special error a layout threw, or a parallel slot that
|
|
@@ -923,8 +842,18 @@ async function renderPageSpecialError(options, specialError, serveStreamingMetad
|
|
|
923
842
|
isEdgeRuntime: options.isEdgeRuntime,
|
|
924
843
|
isRscRequest: options.isRscRequest,
|
|
925
844
|
middlewareContext: options.middlewareContext,
|
|
926
|
-
renderFallbackPage(statusCode) {
|
|
927
|
-
if (caughtDocument) return
|
|
845
|
+
async renderFallbackPage(statusCode) {
|
|
846
|
+
if (caughtDocument) return caughtDocument;
|
|
847
|
+
if (specialError.kind === "http-access-fallback") {
|
|
848
|
+
let layoutIndex = specialError.layoutIndex ?? null;
|
|
849
|
+
if (specialError.unattributed === true) layoutIndex = await findAppPageLayoutSubtreeSpecialErrorIndex(options, statusCode, layoutIndex ?? (specialError.slotLayoutIndex === void 0 ? options.route.layouts.length : specialError.slotLayoutIndex + 1)) ?? layoutIndex;
|
|
850
|
+
if (layoutIndex !== null) return renderLayoutBoundaryFallback(options, statusCode, layoutIndex, {
|
|
851
|
+
headLayouts: options.route.layouts.slice(0, layoutIndex),
|
|
852
|
+
intercept,
|
|
853
|
+
isCacheCandidate,
|
|
854
|
+
routeHead
|
|
855
|
+
});
|
|
856
|
+
}
|
|
928
857
|
if (specialError.kind === "http-access-fallback" && specialError.slotLayoutIndex !== void 0) return renderLayoutBoundaryFallback(options, statusCode, specialError.slotLayoutIndex, {
|
|
929
858
|
headLayouts: options.route.layouts,
|
|
930
859
|
insideLayout: specialError.slotLayoutIndex === 0 && (statusCode === 404 || isAppClientReference(options.route.layouts[0]?.default)),
|
|
@@ -4,7 +4,6 @@ import "./app-elements.js";
|
|
|
4
4
|
import { AppRscRenderMode } from "./app-rsc-render-mode.js";
|
|
5
5
|
import { AppPageParams } from "./app-page-boundary.js";
|
|
6
6
|
import { AppPagePreparedRouteHead, ApplyAppPageFileBasedMetadata } from "./app-page-head.js";
|
|
7
|
-
import { AppLayoutParamAccessTracker } from "./app-layout-param-observation.js";
|
|
8
7
|
import { AppPageSemanticSegment } from "./app-page-segment-state.js";
|
|
9
8
|
import { AppPageErrorModule, AppPageModule, AppPageRouteWiringRoute } from "./app-page-route-wiring.js";
|
|
10
9
|
//#region src/server/app-page-element-builder.d.ts
|
|
@@ -67,6 +66,8 @@ export type AppPagePageRequest<TModule extends AppPageModule = AppPageModule> =
|
|
|
67
66
|
isForceStatic?: boolean;
|
|
68
67
|
/** The render can never be stored (see buildAppPageElements). */
|
|
69
68
|
isUncacheableRender?: boolean;
|
|
69
|
+
/** Layouts the navigating client holds (see buildAppPageElements). */
|
|
70
|
+
mountedLayouts?: ReadonlySet<string> | null;
|
|
70
71
|
/** Observe page metadata `searchParams` access for cache-safety classification. */
|
|
71
72
|
observeMetadataSearchParamsAccess?: boolean;
|
|
72
73
|
/** Whether generated metadata may stream into the response body. */
|
|
@@ -104,7 +105,6 @@ export type BuildPageElementsOptions<TModule extends AppPageModule = AppPageModu
|
|
|
104
105
|
rootUnauthorizedModule?: TModule | null;
|
|
105
106
|
/** File-based metadata routes (favicon, manifest, sitemap, etc.). */
|
|
106
107
|
metadataRoutes: readonly MetadataFileRoute[];
|
|
107
|
-
layoutParamAccess?: AppLayoutParamAccessTracker;
|
|
108
108
|
/**
|
|
109
109
|
* Configured next.config `basePath`. Threaded through `resolveAppPageHead`
|
|
110
110
|
* so file-based metadata route URLs emitted in <head> are prefixed.
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { isPromiseLike } from "../utils/promise.js";
|
|
2
2
|
import { APP_RSC_RENDER_MODE_NAVIGATION } from "./app-rsc-render-mode.js";
|
|
3
3
|
import { matchRoutePattern } from "../routing/route-pattern.js";
|
|
4
|
-
import { createAppPageRenderDependency, invokeAppComponent, isAppClientReference, isAppRenderSuspension, isReactOwnedAppComponent, renderAfterAppDependencies } from "./app-render-dependency.js";
|
|
5
4
|
import { AppElementsWire } from "./app-elements-wire.js";
|
|
6
5
|
import "./app-elements.js";
|
|
6
|
+
import { APP_PAGE_SEGMENT_KEY, isAppPageRouteGroupSegment, resolveAppPagePatternStateKey, resolveAppPageRouteStateKey } from "./app-page-segment-state.js";
|
|
7
7
|
import { ErrorBoundary, ForbiddenBoundary, NotFoundBoundary, UnauthorizedBoundary } from "../shims/error-boundary.js";
|
|
8
8
|
import { withUseCacheLayoutMarker, withUseCachePageMarker } from "../shims/internal/app-page-props-cache-key.js";
|
|
9
9
|
import { makeThenableParams } from "../shims/thenable-params.js";
|
|
10
10
|
import { tagAppPagePageError, tagAppPageSlotError } from "./app-page-execution.js";
|
|
11
|
-
import { resolveAppPageBranchParams } from "./app-page-params.js";
|
|
12
|
-
import { APP_PAGE_SEGMENT_KEY, isAppPageRouteGroupSegment, resolveAppPagePatternStateKey, resolveAppPageRouteStateKey } from "./app-page-segment-state.js";
|
|
13
|
-
import { sanitizeErrorForClient } from "./app-rsc-errors.js";
|
|
14
|
-
import { resolveAppPageModuleTraceSegment, traceCreateComponentTree, traceGetLayoutOrPageModule } from "./app-page-tracing.js";
|
|
15
|
-
import { buildAppPageElements, createAppPageSourcePage, createAppPageTreePath, resolveAppPageLoadingModuleAtOrAbove } from "./app-page-route-wiring.js";
|
|
16
11
|
import { createAppPageMetadataSearchParamsObserver, makeObservedAppPageSearchParamsThenable } from "./app-page-search-params-observation.js";
|
|
17
|
-
import {
|
|
12
|
+
import { resolveAppPageBranchParams } from "./app-page-params.js";
|
|
13
|
+
import { collectAppPageSearchParams, hasAppPageDynamicMetadata, prepareAppPageHead, resolveActiveParallelRouteHeadInputs, resolveInterceptLayoutsBesidePage, slotInterceptKeepsSourceHead } from "./app-page-head.js";
|
|
18
14
|
import { createRouteNotFoundHeadPlanOptions, recoverAppPageRouteHead } from "./app-page-http-access-fallback-metadata.js";
|
|
19
15
|
import { ClientPageRoot } from "../shims/client-page-root.js";
|
|
20
16
|
import "./app-rsc-route-matching.js";
|
|
17
|
+
import { createAppPageRenderDependency, invokeAppComponent, isAppClientReference, isAppRenderSuspension, isReactOwnedAppComponent, renderAfterAppDependencies } from "./app-render-dependency.js";
|
|
18
|
+
import { sanitizeErrorForClient } from "./app-rsc-errors.js";
|
|
19
|
+
import { resolveAppPageModuleTraceSegment, traceCreateComponentTree, traceGetLayoutOrPageModule } from "./app-page-tracing.js";
|
|
20
|
+
import { buildAppPageElements, createAppPageSourcePage, createAppPageTreePath, resolveAppPageLoadingModuleAtOrAbove } from "./app-page-route-wiring.js";
|
|
21
21
|
import { DEFAULT_GLOBAL_ERROR_MODULE } from "./default-global-error-module.js";
|
|
22
22
|
import { createAppPageRenderIdentity } from "./app-page-render-identity.js";
|
|
23
23
|
import { shouldServeStreamingMetadata } from "./streaming-metadata.js";
|
|
@@ -107,7 +107,7 @@ function traceAppPageInterceptLayoutModules(modules, branchSegments, layoutSegme
|
|
|
107
107
|
async function buildPageElements(options) {
|
|
108
108
|
const { route, params, routePath, displayPathname = routePath, pageRequest, globalErrorModule, rootNotFoundModule, rootForbiddenModule, rootUnauthorizedModule, metadataRoutes } = options;
|
|
109
109
|
const slotParamOverrides = resolveSlotParamOverrides(route, routePath);
|
|
110
|
-
const { opts, searchParams, isRscRequest, mountedSlotsHeader, renderMode = APP_RSC_RENDER_MODE_NAVIGATION, observeMetadataSearchParamsAccess = false, observePageSearchParamsAccess = false, isForceStatic = false, isUncacheableRender = false, serveStreamingMetadata, placeStreamedMetadataInHead = false, isProduction = process.env.NODE_ENV === "production", onHeadPrepared } = pageRequest;
|
|
110
|
+
const { opts, searchParams, isRscRequest, mountedSlotsHeader, renderMode = APP_RSC_RENDER_MODE_NAVIGATION, observeMetadataSearchParamsAccess = false, observePageSearchParamsAccess = false, isForceStatic = false, isUncacheableRender = false, mountedLayouts = null, serveStreamingMetadata, placeStreamedMetadataInHead = false, isProduction = process.env.NODE_ENV === "production", onHeadPrepared } = pageRequest;
|
|
111
111
|
const pageModule = route.page;
|
|
112
112
|
const isSiblingIntercept = opts?.interceptSlotKey === "__vinext_page_intercept" && !!opts?.interceptPage;
|
|
113
113
|
const effectivePageModule = isSiblingIntercept ? opts.interceptPage : pageModule;
|
|
@@ -174,6 +174,7 @@ async function buildPageElements(options) {
|
|
|
174
174
|
head: {
|
|
175
175
|
layoutModules: opts?.interceptLayouts ?? [],
|
|
176
176
|
layoutParams: (opts?.interceptLayoutSegments ?? []).map((segments) => resolveInterceptLayoutParams(opts?.interceptBranchSegments ?? segments, segments, effectiveParams)),
|
|
177
|
+
layoutsBesidePage: resolveInterceptLayoutsBesidePage(opts?.interceptLayoutSegments, opts?.interceptBranchSegments),
|
|
177
178
|
pageModule: effectivePageModule ?? null,
|
|
178
179
|
params: effectiveParams,
|
|
179
180
|
routeSegments: opts?.interceptSourcePageSegments ?? route.routeSegments ?? []
|
|
@@ -414,7 +415,7 @@ async function buildPageElements(options) {
|
|
|
414
415
|
isRscRequest,
|
|
415
416
|
isUncacheableRender,
|
|
416
417
|
interceptionId: opts?.interceptionId ?? null,
|
|
417
|
-
|
|
418
|
+
mountedLayouts,
|
|
418
419
|
mountedSlotIds,
|
|
419
420
|
makeThenableParams,
|
|
420
421
|
matchedParams: params,
|
|
@@ -450,9 +451,9 @@ async function buildPageElements(options) {
|
|
|
450
451
|
* slot-scoped params, which `app-page-route-wiring` then hands to the
|
|
451
452
|
* slot page instead of the route's matched params.
|
|
452
453
|
*
|
|
453
|
-
* `routePath` is the already-normalized request pathname (basePath stripped
|
|
454
|
-
*
|
|
455
|
-
*
|
|
454
|
+
* `routePath` is the already-normalized request pathname (basePath stripped).
|
|
455
|
+
* Re-parsing `request.url` here would re-introduce the basePath and silently
|
|
456
|
+
* break the match for any app that configures one.
|
|
456
457
|
*/
|
|
457
458
|
function buildSlotOverrides(route, routeParams, routePath, opts, interceptMetadataOutlet) {
|
|
458
459
|
const overrides = {};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { ClassificationReason } from "../build/layout-classification-types.js";
|
|
2
|
-
import { LayoutFlags } from "./app-elements-wire.js";
|
|
3
|
-
import "./app-elements.js";
|
|
4
1
|
//#region src/server/app-page-execution.d.ts
|
|
5
2
|
export declare function tagAppPageMetadataError<T>(error: T): T;
|
|
6
3
|
export declare function tagAppPageSlotError<T>(error: T, layoutIndex: number, notFoundBoundary?: string): T;
|
|
7
4
|
export declare function tagAppPagePageError<T>(error: T): T;
|
|
5
|
+
export declare function tagAppPageLayoutError<T>(error: T, layoutIndex: number): T;
|
|
8
6
|
/**
|
|
9
7
|
* The id of the not-found boundary that catches the route page's notFound():
|
|
10
8
|
* the page-level boundary, or the segment one it passes the signal up to.
|
|
@@ -22,6 +20,17 @@ export type AppPageSpecialError = {
|
|
|
22
20
|
fromMetadata?: boolean;
|
|
23
21
|
/** Set when a parallel slot threw it: the layout rendering the outermost such slot. */
|
|
24
22
|
slotLayoutIndex?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Set when a route layout's own component threw it, above any slot that
|
|
25
|
+
* did: the outermost such layout, whose boundary above catches it.
|
|
26
|
+
*/
|
|
27
|
+
layoutIndex?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Set when the render threw a copy nothing tagged: a server component
|
|
30
|
+
* that a layout, the page or a template renders. The document's
|
|
31
|
+
* fallback then finds out whether a layout's subtree threw it.
|
|
32
|
+
*/
|
|
33
|
+
unattributed?: boolean;
|
|
25
34
|
};
|
|
26
35
|
export type AppPageFontPreload = {
|
|
27
36
|
href: string;
|
|
@@ -88,50 +97,6 @@ type BuildAppPageSpecialErrorResponseOptions = {
|
|
|
88
97
|
serveStreamingMetadata?: boolean;
|
|
89
98
|
specialError: AppPageSpecialError;
|
|
90
99
|
};
|
|
91
|
-
type ProbeAppPageLayoutsResult = {
|
|
92
|
-
response: Response | null;
|
|
93
|
-
layoutFlags: LayoutFlags;
|
|
94
|
-
};
|
|
95
|
-
export type LayoutClassificationOptions = {
|
|
96
|
-
/** Build-time classifications from segment config or module graph, keyed by layout index. */
|
|
97
|
-
buildTimeClassifications?: ReadonlyMap<number, "static" | "dynamic"> | null;
|
|
98
|
-
/**
|
|
99
|
-
* Per-layout classification reasons keyed by layout index. Requires
|
|
100
|
-
* `VINEXT_DEBUG_CLASSIFICATION` at BOTH lifecycle points: at build time so
|
|
101
|
-
* the plugin patches the `__VINEXT_CLASS_REASONS` dispatch stub, and at
|
|
102
|
-
* runtime so the route object actually calls it. Setting the flag only at
|
|
103
|
-
* runtime leaves the stub returning `null`, and every build-time classified
|
|
104
|
-
* layout will fall through to `{ layer: "no-classifier" }` in the debug
|
|
105
|
-
* channel. The hot path never reads this and the wire payload is unchanged.
|
|
106
|
-
*/
|
|
107
|
-
buildTimeReasons?: ReadonlyMap<number, ClassificationReason> | null;
|
|
108
|
-
/**
|
|
109
|
-
* Emits one log line per layout with the classification reason, keyed by
|
|
110
|
-
* layout ID. Set by the generator when `VINEXT_DEBUG_CLASSIFICATION` is
|
|
111
|
-
* active. When undefined, the probe loop skips debug emission entirely.
|
|
112
|
-
*/
|
|
113
|
-
debugClassification?: (layoutId: string, reason: ClassificationReason) => void;
|
|
114
|
-
/** Maps layout index to its layout ID (e.g. "layout:/blog"). */
|
|
115
|
-
getLayoutId: (layoutIndex: number) => string;
|
|
116
|
-
/**
|
|
117
|
-
* Returns whether the completed per-layout observation makes static reuse
|
|
118
|
-
* unsafe even if the older dynamic scope did not report dynamic usage.
|
|
119
|
-
*/
|
|
120
|
-
isLayoutObservationDynamic?: (layoutId: string) => boolean;
|
|
121
|
-
/** Runs a function with isolated dynamic usage tracking per layout. */
|
|
122
|
-
runWithIsolatedDynamicScope: <T>(fn: () => T | Promise<T>) => Promise<{
|
|
123
|
-
result: T;
|
|
124
|
-
dynamicDetected: boolean;
|
|
125
|
-
}>;
|
|
126
|
-
};
|
|
127
|
-
type ProbeAppPageLayoutsOptions = {
|
|
128
|
-
layoutCount: number;
|
|
129
|
-
onLayoutError: (error: unknown, layoutIndex: number) => Promise<Response | null>;
|
|
130
|
-
probeLayoutAt: (layoutIndex: number) => unknown;
|
|
131
|
-
runWithSuppressedHookWarning<T>(probe: () => Promise<T>): Promise<T>;
|
|
132
|
-
/** When provided, enables per-layout static/dynamic classification. */
|
|
133
|
-
classification?: LayoutClassificationOptions | null;
|
|
134
|
-
};
|
|
135
100
|
export declare function resolveAppPageSpecialError(error: unknown): AppPageSpecialError | null;
|
|
136
101
|
/**
|
|
137
102
|
* Resolve the special error that rejected an SSR shell. An error from the RSC
|
|
@@ -142,8 +107,10 @@ export declare function resolveAppPageSpecialError(error: unknown): AppPageSpeci
|
|
|
142
107
|
* runs only in the RSC render. A notFound() / forbidden() / unauthorized()
|
|
143
108
|
* a parallel slot's page threw is caught above the layout rendering it,
|
|
144
109
|
* unless the slot's own not-found catches its notFound() and every other copy
|
|
145
|
-
* is the page's or another slot's.
|
|
146
|
-
*
|
|
110
|
+
* is the page's or another slot's. One a route layout threw is caught above
|
|
111
|
+
* that layout, and the outermost such layout wins. A copy nothing tagged,
|
|
112
|
+
* such as a template's or one from a component a layout or the page renders,
|
|
113
|
+
* marks the error unattributed.
|
|
147
114
|
*/
|
|
148
115
|
export declare function resolveAppPageShellSpecialError(error: unknown, renderedSpecialErrors: readonly unknown[]): AppPageSpecialError | null;
|
|
149
116
|
/**
|
|
@@ -167,11 +134,9 @@ export declare function resolveAppPageCaughtNotFoundBoundaries(error: unknown, r
|
|
|
167
134
|
*/
|
|
168
135
|
export declare function resolveAppPageSpecialErrorStoredHeaders(specialError: AppPageSpecialError, basePath: string | undefined): Record<string, string> | undefined;
|
|
169
136
|
export declare function buildAppPageSpecialErrorResponse(options: BuildAppPageSpecialErrorResponseOptions): Promise<Response>;
|
|
170
|
-
/** See `LayoutFlags` type docblock in app-elements.ts for lifecycle. */
|
|
171
|
-
export declare function probeAppPageLayouts(options: ProbeAppPageLayoutsOptions): Promise<ProbeAppPageLayoutsResult>;
|
|
172
137
|
export declare function readAppPageBinaryStream(stream: ReadableStream<Uint8Array>): Promise<ArrayBuffer>;
|
|
173
138
|
export declare function bufferAppPageBinaryStream(stream: ReadableStream<Uint8Array>): Promise<ReadableStream<Uint8Array>>;
|
|
174
139
|
export declare function teeAppPageRscStreamForCapture(stream: ReadableStream<Uint8Array>, shouldCapture: boolean): AppPageRscStreamCapture;
|
|
175
140
|
export declare function buildAppPageFontLinkHeader(preloads: readonly AppPageFontPreload[] | null | undefined): string;
|
|
176
141
|
//#endregion
|
|
177
|
-
export
|
|
142
|
+
export {};
|