vinext 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/THIRD_PARTY_LICENSES.md +47 -0
- package/dist/_virtual/_rolldown/runtime.js +4 -3
- package/dist/build/action-owner-manifest.d.ts +3 -2
- package/dist/build/action-owner-manifest.js +18 -2
- package/dist/build/app-page-static-eligibility.d.ts +17 -1
- package/dist/build/app-page-static-eligibility.js +80 -13
- package/dist/build/clean-output.d.ts +2 -1
- package/dist/build/client-build-config.d.ts +13 -3
- package/dist/build/client-build-config.js +46 -9
- package/dist/build/client-reference-async.d.ts +48 -0
- package/dist/build/client-reference-async.js +123 -0
- package/dist/build/client-reference-chunks.d.ts +32 -0
- package/dist/build/client-reference-chunks.js +111 -0
- package/dist/build/client-reference-groups.d.ts +9 -1
- package/dist/build/client-reference-groups.js +40 -2
- package/dist/build/css-url-assets.d.ts +2 -1
- package/dist/build/google-fonts/fallback-metrics.d.ts +2 -1
- package/dist/build/google-fonts/find-font-files-in-css.d.ts +1 -0
- package/dist/build/google-fonts/find-font-files-in-css.js +17 -4
- package/dist/build/google-fonts/font-metadata.d.ts +2 -1
- package/dist/build/google-fonts/validate.d.ts +2 -1
- package/dist/build/inline-css.d.ts +2 -1
- package/dist/build/module-dependency-cache.d.ts +2 -1
- package/dist/build/next-client-runtime-manifests.d.ts +2 -1
- package/dist/build/precompress.d.ts +2 -1
- package/dist/build/precompress.js +1 -1
- package/dist/build/prerender-paths.d.ts +2 -1
- package/dist/build/prerender-phase.d.ts +2 -1
- package/dist/build/prerender-server-pool.js +1 -1
- package/dist/build/prerender.d.ts +3 -2
- package/dist/build/prerender.js +6 -5
- package/dist/build/report.d.ts +2 -15
- package/dist/build/report.js +1 -51
- package/dist/build/run-prerender.d.ts +2 -1
- package/dist/build/server-actions-encryption-key.d.ts +2 -1
- package/dist/build/ssr-manifest.js +25 -2
- package/dist/build/standalone.d.ts +2 -1
- package/dist/cache/cache-adapters-virtual.d.ts +2 -1
- package/dist/cache.js +1 -2
- package/dist/check.d.ts +2 -1
- package/dist/check.js +5 -1
- package/dist/cli-args.d.ts +2 -1
- package/dist/cli.js +5 -0
- package/dist/client/client-redirect-matcher.js +2 -1
- package/dist/client/client-redirects.d.ts +4 -3
- package/dist/client/client-redirects.js +2 -1
- package/dist/client/client-rewrites.d.ts +2 -1
- package/dist/client/dev-error-overlay-store.d.ts +2 -1
- package/dist/client/dev-error-overlay.js +1 -1
- package/dist/client/index.js +1 -2
- package/dist/client/instrumentation-client-state.js +5 -5
- package/dist/client/navigation-runtime.d.ts +16 -2
- package/dist/client/navigation-runtime.js +2 -2
- package/dist/client/pages-router-link-navigation.d.ts +2 -1
- package/dist/client/vinext-next-data.d.ts +25 -1
- package/dist/client/window-next.d.ts +2 -1
- package/dist/config/config-matchers.d.ts +12 -1
- package/dist/config/config-matchers.js +111 -16
- package/dist/config/dotenv.d.ts +2 -1
- package/dist/config/next-config.d.ts +32 -1
- package/dist/config/next-config.js +93 -5
- package/dist/config/tsconfig-paths.d.ts +2 -1
- 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/image-size@2.0.4/deps/image-size/dist/esm/detector.js +23 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/index.js +2 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/lookup.js +25 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/bmp.js +11 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/cur.js +15 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/dds.js +11 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/gif.js +12 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/heif.js +55 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/icns.js +76 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/ico.js +39 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/index.js +46 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/j2c.js +11 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jp2.js +21 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jpg.js +71 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jxl-stream.js +42 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jxl.js +46 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/ktx.js +19 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/png.js +28 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/pnm.js +54 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/psd.js +11 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/svg.js +79 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/tga.js +15 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/tiff.js +96 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/utils.js +53 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/webp.js +45 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/utils/bit-reader.js +38 -0
- package/dist/deps/.pnpm/safer-buffer@2.1.2/deps/safer-buffer/safer.js +45 -0
- package/dist/deps/.pnpm/ua-parser-js@1.0.35/deps/ua-parser-js/src/ua-parser.js +2 -2
- package/dist/entries/app-browser-entry.d.ts +20 -5
- package/dist/entries/app-browser-entry.js +79 -6
- package/dist/entries/app-rsc-entry.d.ts +2 -1
- package/dist/entries/app-rsc-entry.js +59 -60
- package/dist/entries/app-rsc-manifest.d.ts +2 -1
- package/dist/entries/app-rsc-manifest.js +56 -4
- package/dist/entries/app-ssr-entry.js +1 -0
- package/dist/entries/pages-entry-helpers.js +1 -2
- package/dist/entries/pages-server-entry.d.ts +2 -1
- package/dist/entries/pages-server-entry.js +34 -9
- package/dist/entries/runtime-entry-module.d.ts +1 -0
- package/dist/entries/runtime-entry-module.js +4 -1
- package/dist/image/image-adapters-virtual.d.ts +2 -1
- package/dist/index.js +184 -103
- 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/client-compile-hints.d.ts +30 -0
- package/dist/plugins/client-compile-hints.js +88 -0
- package/dist/plugins/client-reference-dedup.d.ts +2 -1
- package/dist/plugins/cloudflare-dev-module-urls.d.ts +2 -1
- package/dist/plugins/dynamic-preload-metadata.d.ts +3 -1
- package/dist/plugins/dynamic-preload-metadata.js +1 -1
- package/dist/plugins/environment.d.ts +2 -1
- package/dist/plugins/extensionless-dynamic-import.js +6 -2
- package/dist/plugins/fonts.js +9 -12
- package/dist/plugins/ignore-dynamic-requests.d.ts +2 -1
- package/dist/plugins/import-meta-url.d.ts +2 -1
- package/dist/plugins/next-intl-catalog.d.ts +12 -0
- package/dist/plugins/next-intl-catalog.js +85 -0
- package/dist/plugins/og-assets.d.ts +2 -1
- package/dist/plugins/og-assets.js +2 -3
- package/dist/plugins/optimize-imports.d.ts +2 -1
- package/dist/plugins/pages-node-externals.d.ts +3 -1
- package/dist/plugins/pages-node-externals.js +1 -1
- package/dist/plugins/remove-console.d.ts +2 -1
- package/dist/plugins/require-condition-resolution.d.ts +2 -1
- package/dist/plugins/rsc-client-reference-loaders.d.ts +8 -0
- package/dist/plugins/rsc-client-reference-loaders.js +170 -68
- package/dist/plugins/rsc-client-shim-excludes.js +2 -0
- package/dist/plugins/sass.d.ts +2 -1
- package/dist/plugins/strip-server-exports.d.ts +2 -1
- package/dist/plugins/styled-jsx.d.ts +2 -1
- package/dist/plugins/transform-result.d.ts +2 -1
- package/dist/plugins/typeof-window.d.ts +2 -1
- package/dist/plugins/use-cache-callable.d.ts +1 -1
- package/dist/plugins/use-cache-callable.js +136 -94
- package/dist/plugins/worker-image-imports.js +1 -1
- package/dist/plugins/worker-use-server.d.ts +2 -1
- package/dist/routing/app-route-graph.d.ts +46 -0
- package/dist/routing/app-route-graph.js +131 -51
- package/dist/routing/browser-route-manifest.d.ts +2 -1
- package/dist/routing/optimistic-route-trie.d.ts +2 -1
- package/dist/routing/route-matching.d.ts +2 -1
- package/dist/routing/route-pattern.d.ts +2 -1
- package/dist/server/accept-encoding.d.ts +2 -1
- package/dist/server/api-handler.js +19 -4
- package/dist/server/app-action-forwarding.d.ts +2 -1
- package/dist/server/app-bfcache-identity.d.ts +2 -1
- package/dist/server/app-bfcache-identity.js +1 -1
- package/dist/server/app-browser-action-result.d.ts +2 -1
- package/dist/server/app-browser-entry.js +106 -66
- package/dist/server/app-browser-error.d.ts +2 -1
- package/dist/server/app-browser-history-controller.d.ts +7 -5
- package/dist/server/app-browser-history-controller.js +93 -15
- package/dist/server/app-browser-hydration.d.ts +2 -1
- package/dist/server/app-browser-interception-context.d.ts +2 -1
- package/dist/server/app-browser-navigation-controller.d.ts +2 -2
- package/dist/server/app-browser-navigation-controller.js +16 -12
- package/dist/server/app-browser-popstate.d.ts +2 -1
- package/dist/server/app-browser-rsc-redirect.d.ts +2 -1
- package/dist/server/app-browser-rsc-redirect.js +4 -4
- package/dist/server/app-browser-server-action-client.d.ts +4 -1
- package/dist/server/app-browser-server-action-client.js +4 -3
- package/dist/server/app-browser-state.d.ts +2 -4
- package/dist/server/app-browser-state.js +9 -4
- package/dist/server/app-browser-stream.d.ts +2 -1
- package/dist/server/app-browser-supplemental-refresh.js +16 -1
- package/dist/server/app-browser-visible-commit.d.ts +3 -2
- package/dist/server/app-browser-visible-commit.js +2 -12
- package/dist/server/app-client-reference-manifest.d.ts +31 -0
- package/dist/server/app-client-reference-manifest.js +46 -0
- package/dist/server/app-client-reference-preloader.d.ts +25 -5
- package/dist/server/app-client-reference-preloader.js +22 -7
- package/dist/server/app-elements-wire.d.ts +8 -39
- package/dist/server/app-elements-wire.js +4 -41
- package/dist/server/app-elements.d.ts +4 -2
- package/dist/server/app-elements.js +4 -2
- package/dist/server/app-fallback-renderer.d.ts +9 -2
- package/dist/server/app-fallback-renderer.js +4 -1
- package/dist/server/app-history-state.d.ts +4 -3
- package/dist/server/app-history-state.js +5 -2
- package/dist/server/app-inline-css-client.d.ts +2 -1
- package/dist/server/app-metadata-tracing.d.ts +2 -1
- 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 +37 -2
- package/dist/server/app-optimistic-routing.js +75 -2
- package/dist/server/app-page-boundary-render.d.ts +20 -2
- package/dist/server/app-page-boundary-render.js +224 -40
- package/dist/server/app-page-boundary.d.ts +34 -5
- package/dist/server/app-page-boundary.js +41 -8
- package/dist/server/app-page-cache-finalizer.d.ts +14 -2
- package/dist/server/app-page-cache-finalizer.js +71 -30
- package/dist/server/app-page-cache-render.d.ts +10 -2
- package/dist/server/app-page-cache-render.js +14 -2
- package/dist/server/app-page-cache.d.ts +13 -1
- package/dist/server/app-page-cache.js +33 -11
- package/dist/server/app-page-dispatch.d.ts +39 -11
- package/dist/server/app-page-dispatch.js +236 -177
- package/dist/server/app-page-element-builder.d.ts +19 -3
- package/dist/server/app-page-element-builder.js +193 -71
- package/dist/server/app-page-execution.d.ts +43 -51
- package/dist/server/app-page-execution.js +205 -92
- package/dist/server/app-page-head.d.ts +108 -3
- package/dist/server/app-page-head.js +337 -154
- package/dist/server/app-page-http-access-fallback-metadata.d.ts +49 -2
- package/dist/server/app-page-http-access-fallback-metadata.js +77 -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-method.d.ts +2 -1
- 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 +5 -22
- package/dist/server/app-page-probe.js +4 -37
- package/dist/server/app-page-render-identity.d.ts +2 -1
- package/dist/server/app-page-render.d.ts +9 -13
- package/dist/server/app-page-render.js +108 -214
- package/dist/server/app-page-request.d.ts +15 -4
- package/dist/server/app-page-request.js +2 -2
- package/dist/server/app-page-response.js +3 -3
- package/dist/server/app-page-route-wiring.d.ts +65 -8
- package/dist/server/app-page-route-wiring.js +259 -103
- package/dist/server/app-page-rsc-render-status.d.ts +29 -2
- package/dist/server/app-page-rsc-render-status.js +121 -13
- package/dist/server/app-page-search-params-observation.d.ts +7 -2
- package/dist/server/app-page-search-params-observation.js +8 -1
- package/dist/server/app-page-segment-plan.d.ts +2 -1
- package/dist/server/app-page-stream.d.ts +33 -1
- package/dist/server/app-page-stream.js +25 -6
- package/dist/server/app-pages-bridge.d.ts +6 -1
- package/dist/server/app-pages-bridge.js +7 -3
- package/dist/server/app-ppr-fallback-shell-render.d.ts +2 -1
- package/dist/server/app-ppr-fallback-shell.d.ts +2 -1
- package/dist/server/app-prerender-endpoints.d.ts +2 -1
- package/dist/server/app-prerender-static-params.d.ts +2 -1
- package/dist/server/app-render-dependency.d.ts +21 -4
- package/dist/server/app-render-dependency.js +100 -33
- package/dist/server/app-request-stage-dispatch.js +1 -1
- package/dist/server/app-request-stage-independent-entry.d.ts +2 -1
- package/dist/server/app-response-stage-entry.d.ts +2 -1
- package/dist/server/app-route-handler-cache.d.ts +2 -1
- package/dist/server/app-route-handler-cache.js +2 -2
- package/dist/server/app-route-handler-dispatch.d.ts +2 -1
- package/dist/server/app-route-handler-dispatch.js +15 -10
- package/dist/server/app-route-handler-execution.d.ts +2 -1
- package/dist/server/app-route-handler-execution.js +8 -3
- 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.d.ts +2 -1
- package/dist/server/app-route-handler-response.js +1 -1
- package/dist/server/app-route-handler-runtime.d.ts +2 -1
- package/dist/server/app-route-handler-runtime.js +17 -4
- package/dist/server/app-route-module-loader.d.ts +18 -1
- package/dist/server/app-route-module-loader.js +8 -0
- package/dist/server/app-route-tree-prefetch.d.ts +2 -1
- package/dist/server/app-rsc-cache-busting.d.ts +2 -2
- package/dist/server/app-rsc-cache-busting.js +4 -4
- package/dist/server/app-rsc-error-handler.d.ts +4 -2
- package/dist/server/app-rsc-error-handler.js +9 -1
- package/dist/server/app-rsc-errors.d.ts +10 -1
- package/dist/server/app-rsc-errors.js +8 -1
- package/dist/server/app-rsc-handler.d.ts +7 -6
- package/dist/server/app-rsc-handler.js +36 -34
- package/dist/server/app-rsc-request-normalization.d.ts +0 -4
- package/dist/server/app-rsc-request-normalization.js +1 -4
- package/dist/server/app-rsc-response-finalizer.d.ts +2 -1
- package/dist/server/app-rsc-response-finalizer.js +2 -2
- package/dist/server/app-rsc-response-stage.js +5 -3
- package/dist/server/app-rsc-route-matching.d.ts +38 -1
- package/dist/server/app-rsc-route-matching.js +24 -0
- package/dist/server/app-segment-config.d.ts +2 -1
- package/dist/server/app-segment-config.js +1 -14
- package/dist/server/app-server-action-execution.d.ts +5 -2
- package/dist/server/app-server-action-execution.js +10 -7
- package/dist/server/app-ssr-entry.d.ts +8 -0
- package/dist/server/app-ssr-entry.js +98 -50
- package/dist/server/app-ssr-error-meta.d.ts +2 -1
- package/dist/server/app-ssr-search-params-gate.d.ts +2 -1
- package/dist/server/app-ssr-stream.d.ts +22 -10
- package/dist/server/app-ssr-stream.js +300 -68
- package/dist/server/app-static-generation.d.ts +2 -1
- package/dist/server/app-streamed-client-references.d.ts +39 -0
- package/dist/server/app-streamed-client-references.js +156 -0
- package/dist/server/app-visited-response-cache.d.ts +38 -2
- package/dist/server/app-visited-response-cache.js +46 -5
- package/dist/server/app-worker-stages.d.ts +27 -4
- package/dist/server/app-worker-stages.js +45 -6
- package/dist/server/artifact-compatibility.d.ts +2 -2
- package/dist/server/artifact-compatibility.js +1 -10
- package/dist/server/bfcache-identity.d.ts +2 -1
- package/dist/server/cache-headers.d.ts +2 -1
- package/dist/server/cache-proof.d.ts +1 -115
- package/dist/server/cache-proof.js +1 -544
- package/dist/server/cacheability-request.d.ts +2 -1
- package/dist/server/cacheability-request.js +13 -8
- package/dist/server/config-headers.d.ts +2 -1
- package/dist/server/csp.d.ts +2 -1
- package/dist/server/default-global-not-found-module.d.ts +2 -1
- package/dist/server/default-http-access-fallback-modules.d.ts +33 -0
- package/dist/server/default-http-access-fallback-modules.js +31 -0
- package/dist/server/defer-until-stream-consumed.d.ts +34 -0
- package/dist/server/defer-until-stream-consumed.js +154 -21
- package/dist/server/dev-lockfile.d.ts +32 -2
- package/dist/server/dev-lockfile.js +46 -2
- package/dist/server/dev-module-runner.d.ts +2 -1
- package/dist/server/dev-server.js +14 -6
- package/dist/server/fetch-handler.js +1 -2
- package/dist/server/file-based-metadata.d.ts +2 -1
- package/dist/server/framework-tracer.d.ts +2 -1
- package/dist/server/headers.d.ts +6 -3
- package/dist/server/headers.js +9 -5
- package/dist/server/html.d.ts +1 -0
- package/dist/server/html.js +19 -1
- package/dist/server/http-conditional.d.ts +2 -1
- package/dist/server/http-error-responses.d.ts +2 -1
- package/dist/server/implicit-tags.d.ts +2 -1
- package/dist/server/isr-cache.d.ts +8 -2
- package/dist/server/isr-cache.js +26 -1
- package/dist/server/metadata-route-build-data.d.ts +2 -1
- package/dist/server/metadata-route-build-data.js +1 -1
- package/dist/server/metadata-route-response.d.ts +2 -1
- package/dist/server/metadata-route-response.js +32 -15
- package/dist/server/metadata-routes.d.ts +2 -1
- package/dist/server/middleware-runtime.d.ts +2 -1
- package/dist/server/multi-stage.d.ts +52 -11
- package/dist/server/multi-stage.js +13 -1
- package/dist/server/navigation-planner.js +1 -1
- package/dist/server/navigation-trace.d.ts +2 -1
- package/dist/server/next-error-digest.d.ts +2 -1
- package/dist/server/nitro-public-files-plugin.d.ts +2 -1
- package/dist/server/nitro-public-files.d.ts +2 -1
- package/dist/server/opentelemetry-api.d.ts +2 -1
- package/dist/server/operation-token.d.ts +2 -1
- package/dist/server/pages-api-route.d.ts +2 -1
- package/dist/server/pages-api-route.js +28 -19
- package/dist/server/pages-asset-tags.d.ts +2 -1
- package/dist/server/pages-body-parser-config.d.ts +2 -1
- package/dist/server/pages-client-assets.d.ts +4 -0
- package/dist/server/pages-data-route.d.ts +2 -1
- package/dist/server/pages-document-asset-props.d.ts +2 -1
- package/dist/server/pages-document-initial-props.d.ts +2 -1
- package/dist/server/pages-execution-tracing.d.ts +2 -1
- package/dist/server/pages-execution-tracing.js +1 -1
- package/dist/server/pages-get-initial-props.d.ts +2 -1
- 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.js +52 -27
- package/dist/server/pages-page-data.d.ts +7 -1
- package/dist/server/pages-page-data.js +35 -12
- package/dist/server/pages-page-handler.d.ts +3 -2
- package/dist/server/pages-page-handler.js +27 -27
- package/dist/server/pages-page-method.d.ts +2 -1
- package/dist/server/pages-page-response.d.ts +2 -1
- package/dist/server/pages-preview.d.ts +2 -1
- package/dist/server/pages-readiness.d.ts +2 -1
- package/dist/server/pages-request-pipeline.d.ts +10 -1
- package/dist/server/pages-request-pipeline.js +6 -7
- package/dist/server/pages-request-stage-entry.d.ts +2 -1
- package/dist/server/pages-request-stage-entry.js +14 -12
- package/dist/server/pages-response-stage-entry.d.ts +2 -1
- package/dist/server/pages-response-stage-entry.js +9 -3
- package/dist/server/pages-route-data-kind.d.ts +2 -1
- package/dist/server/prerender-cache-life-header.d.ts +2 -1
- package/dist/server/prerender-route-params.d.ts +2 -1
- package/dist/server/prod-server.js +14 -4
- package/dist/server/request-log.d.ts +2 -1
- package/dist/server/request-pipeline.d.ts +6 -0
- package/dist/server/request-pipeline.js +21 -1
- package/dist/server/request-tracing.d.ts +2 -1
- package/dist/server/request-tracing.js +1 -1
- package/dist/server/response-start-tracing.js +7 -29
- package/dist/server/rsc-render-stream.d.ts +4 -0
- package/dist/server/rsc-render-stream.js +25 -0
- package/dist/server/seed-cache.d.ts +2 -1
- package/dist/server/seed-cache.js +1 -1
- 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 +2 -1
- package/dist/server/static-file-cache.js +1 -0
- package/dist/server/worker-revalidation-context.d.ts +2 -1
- package/dist/server/worker-stages.d.ts +18 -4
- package/dist/server/worker-stages.js +23 -4
- package/dist/shims/app.d.ts +2 -1
- package/dist/shims/cache-callable-runtime.d.ts +2 -1
- package/dist/shims/cache-handler.d.ts +8 -3
- package/dist/shims/cache-handler.js +31 -11
- package/dist/shims/cache-request-state.d.ts +17 -20
- package/dist/shims/cache-request-state.js +16 -21
- package/dist/shims/cache-runtime.js +27 -11
- package/dist/shims/cache.d.ts +8 -7
- package/dist/shims/cache.js +17 -19
- package/dist/shims/cacheability-classification.d.ts +2 -0
- package/dist/shims/caught-not-found-boundaries.d.ts +15 -0
- package/dist/shims/caught-not-found-boundaries.js +48 -0
- package/dist/shims/cdn-cache.d.ts +22 -5
- package/dist/shims/cdn-purge-routes.d.ts +2 -1
- package/dist/shims/client-locale.js +2 -1
- package/dist/shims/client-page-root.d.ts +2 -1
- package/dist/shims/client-page-root.js +2 -2
- package/dist/shims/config.d.ts +2 -1
- package/dist/shims/default-forbidden.d.ts +4 -0
- package/dist/shims/default-forbidden.js +18 -0
- package/dist/shims/default-not-found.d.ts +0 -5
- package/dist/shims/default-not-found.js +5 -41
- package/dist/shims/default-unauthorized.d.ts +4 -0
- package/dist/shims/default-unauthorized.js +18 -0
- package/dist/shims/dynamic.js +9 -6
- package/dist/shims/error-boundary.d.ts +39 -3
- package/dist/shims/error-boundary.js +33 -18
- 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 +34 -24
- package/dist/shims/font-google.js +1 -2
- package/dist/shims/font-utils.d.ts +3 -2
- package/dist/shims/font-utils.js +5 -3
- package/dist/shims/form.js +3 -3
- package/dist/shims/headers.d.ts +8 -23
- package/dist/shims/headers.js +17 -67
- package/dist/shims/http-access-error-fallback.d.ts +7 -0
- package/dist/shims/http-access-error-fallback.js +47 -0
- package/dist/shims/image.d.ts +1 -22
- package/dist/shims/internal/app-prefetch-fetch-queue.d.ts +22 -2
- package/dist/shims/internal/app-prefetch-fetch-queue.js +71 -18
- package/dist/shims/internal/app-route-prefetch-policy.d.ts +14 -3
- package/dist/shims/internal/app-route-prefetch-policy.js +29 -4
- package/dist/shims/internal/cache-context-accessor.d.ts +2 -1
- package/dist/shims/internal/client-reference-loader.d.ts +7 -0
- package/dist/shims/internal/client-reference-loader.js +91 -0
- package/dist/shims/internal/cookie-serialize.d.ts +2 -1
- package/dist/shims/internal/cookies.js +1 -2
- package/dist/shims/internal/headers-state.d.ts +2 -0
- package/dist/shims/internal/headers-state.js +6 -1
- package/dist/shims/internal/hybrid-client-route-owner-direct.d.ts +2 -1
- package/dist/shims/internal/interpolate-as.d.ts +2 -1
- package/dist/shims/internal/navigation-untracked.js +1 -1
- package/dist/shims/internal/pages-data-target.d.ts +2 -1
- package/dist/shims/internal/pages-data-url.d.ts +2 -1
- package/dist/shims/internal/thenable-well-known-properties.d.ts +2 -1
- package/dist/shims/link.js +197 -52
- package/dist/shims/metadata.d.ts +52 -29
- package/dist/shims/metadata.js +142 -42
- package/dist/shims/navigation-errors.d.ts +2 -1
- package/dist/shims/navigation-server.js +1 -1
- package/dist/shims/navigation.d.ts +95 -8
- package/dist/shims/navigation.js +255 -47
- package/dist/shims/navigation.react-server.js +2 -2
- package/dist/shims/pages-router-runtime.d.ts +2 -1
- package/dist/shims/ppr-fallback-shell.d.ts +2 -1
- package/dist/shims/request-state-types.d.ts +2 -2
- package/dist/shims/router.js +14 -3
- package/dist/shims/slot.d.ts +12 -0
- package/dist/shims/slot.js +37 -9
- package/dist/shims/unified-request-context.d.ts +1 -1
- package/dist/shims/unified-request-context.js +5 -6
- package/dist/typegen.d.ts +2 -1
- package/dist/utils/cache-control-metadata.d.ts +5 -0
- package/dist/utils/cache-control-metadata.js +9 -1
- package/dist/utils/client-build-manifest.d.ts +4 -1
- package/dist/utils/client-build-manifest.js +9 -2
- package/dist/utils/client-entry-manifest.d.ts +13 -0
- package/dist/utils/client-entry-manifest.js +20 -1
- package/dist/utils/client-reference-chunks.d.ts +45 -0
- package/dist/utils/client-reference-chunks.js +30 -0
- package/dist/utils/client-runtime-metadata.d.ts +9 -1
- package/dist/utils/client-runtime-metadata.js +40 -9
- package/dist/utils/compare.d.ts +9 -0
- package/dist/utils/compare.js +15 -1
- package/dist/utils/lazy-chunks.d.ts +14 -0
- package/dist/utils/lazy-chunks.js +27 -1
- package/dist/utils/middleware-request-headers.d.ts +2 -1
- package/dist/utils/project.d.ts +4 -3
- package/dist/utils/project.js +12 -17
- package/dist/utils/query.d.ts +2 -1
- 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/dist/utils/vite-cli-invocation.d.ts +2 -1
- package/package.json +6 -5
- 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 -61
- package/dist/build/layout-classification.js +0 -98
- package/dist/build/route-classification-injector.d.ts +0 -32
- package/dist/build/route-classification-injector.js +0 -59
- package/dist/build/route-classification-manifest.d.ts +0 -53
- package/dist/build/route-classification-manifest.js +0 -143
- package/dist/deps/.pnpm/image-size@2.0.2/deps/image-size/dist/index.js +0 -808
- package/dist/server/app-browser-client-reuse-manifest.d.ts +0 -10
- package/dist/server/app-browser-client-reuse-manifest.js +0 -101
- package/dist/server/app-layout-param-observation.d.ts +0 -41
- package/dist/server/app-layout-param-observation.js +0 -168
- package/dist/server/client-reuse-manifest.d.ts +0 -102
- package/dist/server/client-reuse-manifest.js +0 -209
- package/dist/server/default-not-found-module.d.ts +0 -19
- package/dist/server/default-not-found-module.js +0 -18
- package/dist/server/rsc-stream-hints.d.ts +0 -21
- package/dist/server/rsc-stream-hints.js +0 -227
- 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 -13
- package/dist/server/static-layout-client-reuse-proof.js +0 -33
- package/dist/utils/sorted-array.d.ts +0 -7
- package/dist/utils/sorted-array.js +0 -20
|
@@ -1,34 +1,34 @@
|
|
|
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 { AppElementsWire } from "./app-elements-wire.js";
|
|
15
|
-
import "./app-elements.js";
|
|
16
|
-
import { VINEXT_RSC_CONTENT_TYPE, applyRscCompatibilityIdHeader, applyRscDeploymentIdHeader } from "./app-rsc-cache-busting.js";
|
|
17
|
-
import { mergeMiddlewareResponseHeaders } from "./middleware-response-headers.js";
|
|
18
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";
|
|
19
20
|
import { resolveUncacheableCacheControl } from "./app-page-response.js";
|
|
20
21
|
import { buildRscRedirectFlightStream } from "./app-rsc-redirect-flight.js";
|
|
21
|
-
import { buildAppPageSpecialErrorResponse, resolveAppPageShellSpecialError, resolveAppPageSpecialError, resolveAppPageSpecialErrorStoredHeaders } from "./app-page-execution.js";
|
|
22
|
+
import { buildAppPageSpecialErrorResponse, resolveAppPageCaughtNotFoundBoundaries, resolveAppPageShellSpecialError, resolveAppPageSpecialError, resolveAppPageSpecialErrorStoredHeaders } from "./app-page-execution.js";
|
|
23
|
+
import { resolveAppPageLayoutHttpAccessBoundary, resolveAppPageParentHttpAccessBoundary, resolveAppPageRootHttpAccessBoundaryTreePosition } from "./app-page-boundary.js";
|
|
24
|
+
import { isAppClientReference } from "./app-render-dependency.js";
|
|
22
25
|
import { resolveAppPageTraceOperation } from "./app-page-tracing.js";
|
|
23
|
-
import { createAppPageTreePath } from "./app-page-route-wiring.js";
|
|
24
|
-
import { traceResponseStart } from "./response-start-tracing.js";
|
|
25
|
-
import { buildAppPageTags } from "./implicit-tags.js";
|
|
26
|
-
import { consumeAppPageRenderObservationState, discardAppPageRenderState } from "./app-page-render-observation.js";
|
|
27
|
-
import { createAppPageRscErrorTracker } from "./app-page-stream.js";
|
|
28
|
-
import { resolveAppPageParentHttpAccessBoundary, resolveAppPageParentHttpAccessBoundaryModule } from "./app-page-boundary.js";
|
|
29
26
|
import { shouldServeStreamingMetadata } from "./streaming-metadata.js";
|
|
30
27
|
import { resolveAppPageNavigationParams } from "./app-page-element-builder.js";
|
|
31
|
-
import {
|
|
28
|
+
import { createAppPageRscErrorTracker } from "./app-page-stream.js";
|
|
29
|
+
import { getDefaultHttpAccessFallbackModule } from "./default-http-access-fallback-modules.js";
|
|
30
|
+
import { consumeAppPageRenderObservationState, discardAppPageRenderState } from "./app-page-render-observation.js";
|
|
31
|
+
import { buildAppPageTags } from "./implicit-tags.js";
|
|
32
32
|
import { resolveAppPageMethodResponse } from "./app-page-method.js";
|
|
33
33
|
import { buildAppPageElement, resolveAppPageIntercept, resolveAppPageInterceptionRerenderTarget, validateAppPageDynamicParams } from "./app-page-request.js";
|
|
34
34
|
import { applyIneligibleRouteCachePolicy, renderAppPageLifecycle } from "./app-page-render.js";
|
|
@@ -55,75 +55,6 @@ function resolveAppPageRouteBoundaryModule(route, statusCode) {
|
|
|
55
55
|
if (statusCode === 404) return route.notFound ?? null;
|
|
56
56
|
return null;
|
|
57
57
|
}
|
|
58
|
-
/**
|
|
59
|
-
* Request-time counterpart to the build-time `classifyLayoutSegmentConfig`
|
|
60
|
-
* (`build/report.ts`). Both classify a layout by its `dynamic`/`revalidate`
|
|
61
|
-
* segment config and agree on the shared cases (the build-time version
|
|
62
|
-
* normalizes `revalidate = false` to `Infinity` upstream, so both treat it as
|
|
63
|
-
* static); keep them aligned when either changes.
|
|
64
|
-
*
|
|
65
|
-
* The meaningful difference is scope, not logic: this request-time pass reads
|
|
66
|
-
* the resolved module value, so it classifies layouts that were never captured
|
|
67
|
-
* at build time (e.g. dev mode). Its result is merged on top of the build-time
|
|
68
|
-
* classification map in `createEffectiveLayoutClassifications`, so such layouts
|
|
69
|
-
* are classified here where they previously were not.
|
|
70
|
-
*/
|
|
71
|
-
function classifyLayoutSegmentConfigFromModule(layout) {
|
|
72
|
-
if (!layout) return null;
|
|
73
|
-
switch (layout.dynamic) {
|
|
74
|
-
case "force-dynamic": return {
|
|
75
|
-
kind: "dynamic",
|
|
76
|
-
reason: {
|
|
77
|
-
layer: "segment-config",
|
|
78
|
-
key: "dynamic",
|
|
79
|
-
value: "force-dynamic"
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
case "force-static":
|
|
83
|
-
case "error": return {
|
|
84
|
-
kind: "static",
|
|
85
|
-
reason: {
|
|
86
|
-
layer: "segment-config",
|
|
87
|
-
key: "dynamic",
|
|
88
|
-
value: layout.dynamic
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
if (layout.revalidate === false || layout.revalidate === Infinity) return {
|
|
93
|
-
kind: "static",
|
|
94
|
-
reason: {
|
|
95
|
-
layer: "segment-config",
|
|
96
|
-
key: "revalidate",
|
|
97
|
-
value: Infinity
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
if (layout.revalidate === 0) return {
|
|
101
|
-
kind: "dynamic",
|
|
102
|
-
reason: {
|
|
103
|
-
layer: "segment-config",
|
|
104
|
-
key: "revalidate",
|
|
105
|
-
value: 0
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
return null;
|
|
109
|
-
}
|
|
110
|
-
function createEffectiveLayoutClassifications(route, includeReasons) {
|
|
111
|
-
const classifications = new Map(route.__buildTimeClassifications ?? []);
|
|
112
|
-
const reasons = includeReasons ? new Map(route.__buildTimeReasons ?? []) : null;
|
|
113
|
-
for (let index = 0; index < route.layouts.length; index++) {
|
|
114
|
-
const classification = classifyLayoutSegmentConfigFromModule(route.layouts[index]);
|
|
115
|
-
if (classification === null) continue;
|
|
116
|
-
classifications.set(index, classification.kind);
|
|
117
|
-
reasons?.set(index, classification.reason);
|
|
118
|
-
}
|
|
119
|
-
return {
|
|
120
|
-
buildTimeClassifications: classifications.size > 0 ? classifications : null,
|
|
121
|
-
buildTimeReasons: reasons && reasons.size > 0 ? reasons : null
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
function getEffectiveLayoutClassifications(route, debugClassification) {
|
|
125
|
-
return createEffectiveLayoutClassifications(route, debugClassification !== void 0);
|
|
126
|
-
}
|
|
127
58
|
function shouldReadAppPageCache(options) {
|
|
128
59
|
return options.isProduction && !options.isProgressiveActionRender && !options.isDraftMode && !options.isForceDynamic && (options.isRscRequest || !options.scriptNonce) && (options.revalidateSeconds === null || options.revalidateSeconds > 0);
|
|
129
60
|
}
|
|
@@ -182,6 +113,14 @@ function toInterceptOptions(interceptionContext, intercept) {
|
|
|
182
113
|
interceptNotFoundBranchSegments: intercept.interceptNotFoundBranchSegments,
|
|
183
114
|
interceptNotFound: intercept.notFound,
|
|
184
115
|
interceptNotFoundTreePosition: intercept.notFoundTreePosition,
|
|
116
|
+
interceptForbiddens: intercept.interceptForbiddens,
|
|
117
|
+
interceptForbiddenTreePositions: intercept.interceptForbiddenTreePositions,
|
|
118
|
+
interceptUnauthorizeds: intercept.interceptUnauthorizeds,
|
|
119
|
+
interceptUnauthorizedTreePositions: intercept.interceptUnauthorizedTreePositions,
|
|
120
|
+
interceptErrors: intercept.interceptErrors,
|
|
121
|
+
interceptErrorTreePositions: intercept.interceptErrorTreePositions,
|
|
122
|
+
interceptNotFounds: intercept.interceptNotFounds,
|
|
123
|
+
interceptNotFoundTreePositions: intercept.interceptNotFoundTreePositions,
|
|
185
124
|
interceptPage: intercept.page,
|
|
186
125
|
interceptParams: intercept.matchedParams,
|
|
187
126
|
interceptSlotId: intercept.slotId ?? null,
|
|
@@ -256,8 +195,6 @@ async function dispatchAppPageInner(options) {
|
|
|
256
195
|
const shouldUseEmptySearchParams = isForceStatic || isPrefetchDynamicShell;
|
|
257
196
|
const hasRequestSearchParams = !shouldUseEmptySearchParams && hasSearchParams(options.searchParams);
|
|
258
197
|
const pageSearchParams = shouldUseEmptySearchParams ? new URLSearchParams() : options.searchParams;
|
|
259
|
-
const layoutParamAccess = createAppLayoutParamAccessTracker();
|
|
260
|
-
const activeLoadingTreePositions = getActiveLoadingTreePositions(route);
|
|
261
198
|
setCurrentFetchSoftTags(buildAppPageTags(options.cleanPathname, [], route.routeSegments));
|
|
262
199
|
setCurrentFetchCacheMode(options.fetchCache ?? null);
|
|
263
200
|
setCurrentFetchRevalidate(currentRevalidateSeconds);
|
|
@@ -314,8 +251,12 @@ async function dispatchAppPageInner(options) {
|
|
|
314
251
|
scriptNonce: options.scriptNonce
|
|
315
252
|
});
|
|
316
253
|
const isNeverStoredPath = options.pprRuntime === void 0 && hasNoManifestAdmissionState(route.pattern);
|
|
317
|
-
const
|
|
254
|
+
const isStoredRender = !isRouteCacheabilityProbe() && isCacheEligibleRender && !isNeverStoredPath;
|
|
255
|
+
const isOnDemandRevalidate = _isOnDemandRevalidate();
|
|
256
|
+
const shouldReadCache = isStoredRender && !isOnDemandRevalidate;
|
|
318
257
|
const isCacheCandidate = isCacheEligibleRender && isStaticEligible && options.pprFallbackShell === void 0 && !isNeverStoredPath;
|
|
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;
|
|
319
260
|
if (shouldReadCache && isStaticEligible) {
|
|
320
261
|
traceOperation = resolveAppPageTraceOperation({
|
|
321
262
|
hasRequestSearchParams,
|
|
@@ -376,11 +317,18 @@ async function dispatchAppPageInner(options) {
|
|
|
376
317
|
isForceStatic,
|
|
377
318
|
revalidateSeconds: currentRevalidateSeconds
|
|
378
319
|
}),
|
|
379
|
-
|
|
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 }) => {
|
|
380
322
|
const revalidationTarget = await resolveCacheRenderTarget();
|
|
381
323
|
const revalidationDynamicConfig = options.resolveRouteDynamicConfig?.(revalidationTarget.route) ?? (revalidationTarget.route === route ? dynamicConfig : void 0);
|
|
382
324
|
const revalidationConfigRevalidateSeconds = options.resolveRouteRevalidateSeconds?.(revalidationTarget.route) ?? (revalidationTarget.route === route ? currentRevalidateSeconds : null);
|
|
383
325
|
const revalidationRouteRevalidateSeconds = revalidationTarget.route === route ? void 0 : revalidationConfigRevalidateSeconds ?? (revalidationDynamicConfig === "force-static" || revalidationDynamicConfig === "error" || options.isProduction && options.pprRuntime === void 0 && options.resolveRouteStaticEligible(revalidationTarget.route) ? Infinity : null);
|
|
326
|
+
const revalidationRouteHead = {
|
|
327
|
+
observeSearchParams: revalidationDynamicConfig !== "force-static",
|
|
328
|
+
searchParams: new URLSearchParams(),
|
|
329
|
+
streamMetadata: false,
|
|
330
|
+
value: null
|
|
331
|
+
};
|
|
384
332
|
return runAppPageRevalidationContext({
|
|
385
333
|
cleanPathname: options.cleanPathname,
|
|
386
334
|
displayPathname: options.displayPathname,
|
|
@@ -395,12 +343,15 @@ async function dispatchAppPageInner(options) {
|
|
|
395
343
|
setNavigationContext: options.setNavigationContext
|
|
396
344
|
}, async () => {
|
|
397
345
|
const { renderAppPageCacheArtifacts } = await import("./app-page-cache-render.js");
|
|
398
|
-
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(), {
|
|
399
347
|
isForceStatic: revalidationDynamicConfig === "force-static",
|
|
400
348
|
observeMetadataSearchParamsAccess: revalidationDynamicConfig !== "force-static",
|
|
401
349
|
observePageSearchParamsAccess: revalidationDynamicConfig !== "force-static",
|
|
402
350
|
serveStreamingMetadata: placeGeneratedMetadataInBody,
|
|
403
|
-
placeStreamedMetadataInHead: true
|
|
351
|
+
placeStreamedMetadataInHead: true,
|
|
352
|
+
onHeadPrepared(head) {
|
|
353
|
+
revalidationRouteHead.value = head;
|
|
354
|
+
}
|
|
404
355
|
});
|
|
405
356
|
const baseRevalidatedOnError = options.createRscOnErrorHandler(options.cleanPathname, revalidationTarget.route.pattern, { revalidateReason: "stale" });
|
|
406
357
|
const baseRevalidatedOnSsrError = options.createRscOnErrorHandler(options.cleanPathname, revalidationTarget.route.pattern, {
|
|
@@ -430,19 +381,24 @@ async function dispatchAppPageInner(options) {
|
|
|
430
381
|
return baseRevalidatedOnSsrError(error, void 0, void 0);
|
|
431
382
|
},
|
|
432
383
|
reactMaxHeadersLength: options.reactMaxHeadersLength,
|
|
433
|
-
|
|
384
|
+
resolveCaughtNotFoundBoundaries: renderDocument ? (error) => resolveAppPageCaughtNotFoundBoundaries(error, rscErrorTracker.getCapturedSpecialErrors(error)) : void 0,
|
|
385
|
+
async renderShellSpecialError(error, caughtDocument) {
|
|
434
386
|
const specialError = resolveAppPageShellSpecialError(error, rscErrorTracker.getCapturedSpecialErrors(error));
|
|
435
387
|
if (!specialError) return null;
|
|
436
|
-
if (options.isRscRequest)
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
388
|
+
if (options.isRscRequest && specialError.fromMetadata === true) return null;
|
|
389
|
+
if (renderDocument && caughtDocument) return {
|
|
390
|
+
headers: resolveAppPageSpecialErrorStoredHeaders(specialError, options.basePath),
|
|
391
|
+
html: caughtDocument.html,
|
|
392
|
+
linkHeader: caughtDocument.linkHeader,
|
|
393
|
+
status: specialError.statusCode
|
|
394
|
+
};
|
|
395
|
+
if (!renderDocument || options.isRscRequest) return {
|
|
396
|
+
headers: resolveAppPageSpecialErrorStoredHeaders(specialError, options.basePath),
|
|
397
|
+
html: "",
|
|
398
|
+
status: specialError.statusCode
|
|
399
|
+
};
|
|
444
400
|
if (revalidationTarget.route !== route) return null;
|
|
445
|
-
const document = await renderPageSpecialError(options, specialError, false, revalidationTarget.interceptOpts, true);
|
|
401
|
+
const document = await renderPageSpecialError(options, specialError, false, revalidationTarget.interceptOpts, true, void 0, revalidationRouteHead);
|
|
446
402
|
if (document.status !== specialError.statusCode) return null;
|
|
447
403
|
return {
|
|
448
404
|
headers: resolveAppPageSpecialErrorStoredHeaders(specialError, options.basePath),
|
|
@@ -492,7 +448,11 @@ async function dispatchAppPageInner(options) {
|
|
|
492
448
|
params: options.staticParamsValidationParams ?? options.params
|
|
493
449
|
});
|
|
494
450
|
if (dynamicParamsResponse) {
|
|
495
|
-
const
|
|
451
|
+
const boundaryModule = route.notFound ?? getDefaultHttpAccessFallbackModule(404);
|
|
452
|
+
const renderedNotFound = await options.renderHttpAccessFallbackPage(404, {
|
|
453
|
+
boundaryModule,
|
|
454
|
+
matchedParams: options.params
|
|
455
|
+
}, options.middlewareContext);
|
|
496
456
|
const cachePolicy = {
|
|
497
457
|
dynamicStaleTimeSeconds: options.dynamicStaleTimeSeconds,
|
|
498
458
|
isDraftMode,
|
|
@@ -518,8 +478,17 @@ async function dispatchAppPageInner(options) {
|
|
|
518
478
|
let interceptDynamicConfig;
|
|
519
479
|
let interceptDynamicConfigResolved = false;
|
|
520
480
|
let isInterceptSourceKnownDynamic = false;
|
|
481
|
+
const renderedRouteHead = {
|
|
482
|
+
observeSearchParams: !isForceStatic,
|
|
483
|
+
searchParams: pageSearchParams,
|
|
484
|
+
streamMetadata: placeGeneratedMetadataInBody && options.renderWholeDocument !== true,
|
|
485
|
+
value: null
|
|
486
|
+
};
|
|
487
|
+
const onHeadPrepared = (head) => {
|
|
488
|
+
renderedRouteHead.value = head;
|
|
489
|
+
};
|
|
521
490
|
const interceptResult = await resolveAppPageIntercept({
|
|
522
|
-
async buildPageElement(interceptRoute, interceptParams, interceptOpts, interceptSearchParams
|
|
491
|
+
async buildPageElement(interceptRoute, interceptParams, interceptOpts, interceptSearchParams) {
|
|
523
492
|
const sourceDynamicConfig = interceptDynamicConfigResolved ? interceptDynamicConfig : options.resolveRouteDynamicConfig?.(interceptRoute);
|
|
524
493
|
if (sourceDynamicConfig === "force-static" || sourceDynamicConfig === "error") {
|
|
525
494
|
const { createStaticGenerationHeadersContext } = await import("./app-static-generation.js");
|
|
@@ -536,12 +505,14 @@ async function dispatchAppPageInner(options) {
|
|
|
536
505
|
setCurrentFetchCacheMode(options.resolveRouteFetchCacheMode?.(interceptRoute) ?? null);
|
|
537
506
|
setCurrentFetchRevalidate(sourceRevalidateSeconds);
|
|
538
507
|
setCurrentForceDynamicFetchDefault(sourceDynamicConfig === "force-dynamic");
|
|
539
|
-
return options.buildPageElement(interceptRoute, interceptParams, interceptOpts, interceptSearchParams,
|
|
508
|
+
return options.buildPageElement(interceptRoute, interceptParams, interceptOpts, interceptSearchParams, {
|
|
540
509
|
isForceStatic: sourceDynamicConfig === "force-static",
|
|
541
510
|
observeMetadataSearchParamsAccess: sourceDynamicConfig !== "force-static",
|
|
542
511
|
observePageSearchParamsAccess: sourceDynamicConfig !== "force-static",
|
|
512
|
+
isUncacheableRender,
|
|
543
513
|
serveStreamingMetadata: placeGeneratedMetadataInBody,
|
|
544
|
-
placeStreamedMetadataInHead: options.renderWholeDocument === true
|
|
514
|
+
placeStreamedMetadataInHead: options.renderWholeDocument === true,
|
|
515
|
+
onHeadPrepared
|
|
545
516
|
});
|
|
546
517
|
},
|
|
547
518
|
cleanPathname: options.cleanPathname,
|
|
@@ -556,7 +527,6 @@ async function dispatchAppPageInner(options) {
|
|
|
556
527
|
return options.getSourceRoute(sourceRouteIndex);
|
|
557
528
|
},
|
|
558
529
|
isRscRequest: options.isRscRequest,
|
|
559
|
-
layoutParamAccess,
|
|
560
530
|
resolveNavigationParams(sourceRoute, navigationParams, pathname, interceptOpts) {
|
|
561
531
|
return resolveAppPageNavigationParams(sourceRoute, navigationParams, pathname, interceptOpts);
|
|
562
532
|
},
|
|
@@ -591,20 +561,24 @@ async function dispatchAppPageInner(options) {
|
|
|
591
561
|
if (interceptResult.response) return interceptResult.response;
|
|
592
562
|
const buildCurrentPageElement = () => buildAppPageElement({
|
|
593
563
|
buildPageElement() {
|
|
564
|
+
renderedRouteHead.value = null;
|
|
594
565
|
if (options.actionFailed) throw options.actionError;
|
|
595
|
-
return options.buildPageElement(route, options.params, interceptResult.interceptOpts, pageSearchParams,
|
|
566
|
+
return options.buildPageElement(route, options.params, interceptResult.interceptOpts, pageSearchParams, {
|
|
596
567
|
isForceStatic,
|
|
597
568
|
observeMetadataSearchParamsAccess: !isForceStatic,
|
|
598
569
|
observePageSearchParamsAccess: !isForceStatic,
|
|
570
|
+
isUncacheableRender,
|
|
571
|
+
mountedLayouts: interceptResult.interceptOpts ? null : mountedLayouts,
|
|
599
572
|
serveStreamingMetadata: placeGeneratedMetadataInBody,
|
|
600
|
-
placeStreamedMetadataInHead: options.renderWholeDocument === true
|
|
573
|
+
placeStreamedMetadataInHead: options.renderWholeDocument === true,
|
|
574
|
+
onHeadPrepared
|
|
601
575
|
});
|
|
602
576
|
},
|
|
603
577
|
renderErrorBoundaryPage(buildError) {
|
|
604
578
|
return options.renderErrorBoundaryPage(buildError);
|
|
605
579
|
},
|
|
606
580
|
renderSpecialError(specialError) {
|
|
607
|
-
return renderPageSpecialError(options, specialError, serveStreamingMetadata, interceptResult.interceptOpts);
|
|
581
|
+
return renderPageSpecialError(options, specialError, serveStreamingMetadata, interceptResult.interceptOpts, false, void 0, renderedRouteHead);
|
|
608
582
|
},
|
|
609
583
|
resolveSpecialError: resolveAppPageSpecialError
|
|
610
584
|
});
|
|
@@ -621,13 +595,13 @@ async function dispatchAppPageInner(options) {
|
|
|
621
595
|
discardAppPageRenderState();
|
|
622
596
|
}
|
|
623
597
|
const navigationParams = resolveAppPageNavigationParams(route, options.params, options.cleanPathname, interceptResult.interceptOpts);
|
|
624
|
-
const layoutClassifications = getEffectiveLayoutClassifications(route, options.debugClassification);
|
|
625
598
|
const activeFallbackShellState = options.pprRuntime?.getState() ?? null;
|
|
626
599
|
const pprFallbackShellSignal = activeFallbackShellState?.abortController.signal;
|
|
627
600
|
const pprFallbackShellReactSignal = activeFallbackShellState?.reactAbortController.signal;
|
|
628
601
|
const isSpeculativePrerender = isPrerender && options.request.headers.get("x-vinext-prerender-speculative") === "1";
|
|
629
602
|
const requestCacheLife = _captureRequestScopedCacheLifeAccessors();
|
|
630
|
-
|
|
603
|
+
const onDemandCacheWrites = isOnDemandRevalidate ? [] : null;
|
|
604
|
+
const lifecycleOptions = {
|
|
631
605
|
basePath: options.basePath,
|
|
632
606
|
bypassInterceptionContextCache: options.bypassInterceptionContextCache,
|
|
633
607
|
clientTraceMetadata: options.clientTraceMetadata,
|
|
@@ -651,7 +625,6 @@ async function dispatchAppPageInner(options) {
|
|
|
651
625
|
});
|
|
652
626
|
return { element: pageBuildResult.element };
|
|
653
627
|
},
|
|
654
|
-
clientReuseManifest: options.clientReuseManifest,
|
|
655
628
|
getDraftModeCookieHeader,
|
|
656
629
|
getFontLinks: options.getFontLinks,
|
|
657
630
|
getFontPreloads: options.getFontPreloads,
|
|
@@ -691,7 +664,6 @@ async function dispatchAppPageInner(options) {
|
|
|
691
664
|
interceptionContext: options.interceptionContext,
|
|
692
665
|
interceptionId,
|
|
693
666
|
expireSeconds: options.expireSeconds,
|
|
694
|
-
layoutCount: getAppPageLayoutProbeCount(route, activeLoadingTreePositions),
|
|
695
667
|
loadSsrHandler: options.loadSsrHandler,
|
|
696
668
|
middlewareContext: options.middlewareContext,
|
|
697
669
|
navigationParams,
|
|
@@ -702,7 +674,6 @@ async function dispatchAppPageInner(options) {
|
|
|
702
674
|
abortPprFallbackShell: activeFallbackShellState ? () => {
|
|
703
675
|
options.pprRuntime.beginFinalRender(activeFallbackShellState);
|
|
704
676
|
} : void 0,
|
|
705
|
-
layoutParamAccess,
|
|
706
677
|
rootParams: options.rootParams,
|
|
707
678
|
peekRenderObservationState() {
|
|
708
679
|
return {
|
|
@@ -710,24 +681,6 @@ async function dispatchAppPageInner(options) {
|
|
|
710
681
|
requestApis: peekRenderRequestApiUsage()
|
|
711
682
|
};
|
|
712
683
|
},
|
|
713
|
-
probeLayoutAt(layoutIndex) {
|
|
714
|
-
return options.probeLayoutAt(layoutIndex, layoutParamAccess);
|
|
715
|
-
},
|
|
716
|
-
classification: {
|
|
717
|
-
getLayoutId(index) {
|
|
718
|
-
const treePosition = route.layoutTreePositions?.[index] ?? 0;
|
|
719
|
-
return AppElementsWire.encodeLayoutId(createAppPageTreePath([...route.routeSegments], treePosition));
|
|
720
|
-
},
|
|
721
|
-
buildTimeClassifications: layoutClassifications.buildTimeClassifications,
|
|
722
|
-
buildTimeReasons: layoutClassifications.buildTimeReasons,
|
|
723
|
-
debugClassification: options.debugClassification,
|
|
724
|
-
isLayoutObservationDynamic(layoutId) {
|
|
725
|
-
return isAppLayoutObservationUnsafeForStaticReuse(layoutParamAccess.getLayoutObservation(layoutId));
|
|
726
|
-
},
|
|
727
|
-
async runWithIsolatedDynamicScope(fn) {
|
|
728
|
-
return runWithIsolatedDynamicUsage(fn);
|
|
729
|
-
}
|
|
730
|
-
},
|
|
731
684
|
dynamicStaleTimeSeconds: options.dynamicStaleTimeSeconds,
|
|
732
685
|
revalidateSeconds: currentRevalidateSeconds,
|
|
733
686
|
mountedSlotsHeader: options.mountedSlotsHeader,
|
|
@@ -735,64 +688,149 @@ async function dispatchAppPageInner(options) {
|
|
|
735
688
|
renderErrorBoundaryResponse(renderError, errorOrigin) {
|
|
736
689
|
return options.renderErrorBoundaryPage(renderError, errorOrigin);
|
|
737
690
|
},
|
|
738
|
-
renderLayoutSpecialError(specialError, layoutIndex) {
|
|
739
|
-
return renderLayoutSpecialError(options, specialError, layoutIndex, serveStreamingMetadata);
|
|
740
|
-
},
|
|
741
691
|
renderPageSpecialError(specialError, renderOptions) {
|
|
742
|
-
return renderPageSpecialError(options, specialError, serveStreamingMetadata, interceptResult.interceptOpts, renderOptions?.isCacheCandidate === true);
|
|
692
|
+
return renderPageSpecialError(options, specialError, serveStreamingMetadata, interceptResult.interceptOpts, renderOptions?.isCacheCandidate === true, renderOptions?.caughtDocument, renderedRouteHead);
|
|
743
693
|
},
|
|
744
694
|
renderToReadableStream: options.renderToReadableStream,
|
|
745
695
|
hasCustomGlobalError: options.hasCustomGlobalError,
|
|
746
696
|
prerenderToReadableStream: options.prerenderToReadableStream,
|
|
747
697
|
routePattern: route.pattern,
|
|
748
|
-
runWithSuppressedHookWarning(probe) {
|
|
749
|
-
return options.runWithSuppressedHookWarning(probe);
|
|
750
|
-
},
|
|
751
698
|
scriptNonce: options.scriptNonce,
|
|
752
699
|
waitUntil(cachePromise) {
|
|
700
|
+
onDemandCacheWrites?.push(cachePromise);
|
|
753
701
|
getRequestExecutionContext()?.waitUntil(cachePromise);
|
|
754
702
|
}
|
|
755
|
-
}
|
|
703
|
+
};
|
|
704
|
+
const renderResponse = async () => {
|
|
705
|
+
const response = await renderAppPageLifecycle(lifecycleOptions);
|
|
706
|
+
if (onDemandCacheWrites) await Promise.all(onDemandCacheWrites);
|
|
707
|
+
return response;
|
|
708
|
+
};
|
|
709
|
+
if (isOnDemandRevalidate && isStoredRender && isStaticEligible && !(options.isRscRequest && options.mountedSlotsHeader)) {
|
|
710
|
+
const cacheKey = options.isRscRequest ? options.isrRscKey(options.cleanPathname, null, options.renderMode, options.interceptionContext, interceptionId) : options.isrHtmlKey(options.cleanPathname);
|
|
711
|
+
return coalesceOnDemandResponse(`${options.request.method}:${cacheKey}`, options.request.method, renderResponse);
|
|
712
|
+
}
|
|
713
|
+
return renderResponse();
|
|
756
714
|
}
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
715
|
+
/**
|
|
716
|
+
* A signal the route's own render threw keeps the route's head, reusing the
|
|
717
|
+
* one that render prepared. A progressive server action's signal doesn't:
|
|
718
|
+
* Next.js answers it with a not-found tree in place of the page
|
|
719
|
+
* (`createNotFoundLoaderTree`), so the page's metadata never applies.
|
|
720
|
+
* https://github.com/vercel/next.js/blob/canary/packages/next/src/server/app-render/app-render.tsx
|
|
721
|
+
*/
|
|
722
|
+
function resolveFallbackRouteHead(options, renderedRouteHead) {
|
|
723
|
+
if (options.actionFailed || !renderedRouteHead) return null;
|
|
724
|
+
const { value, ...render } = renderedRouteHead;
|
|
725
|
+
return {
|
|
726
|
+
...render,
|
|
727
|
+
prepared: value
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* The outermost layout above every loading boundary whose subtree throws the
|
|
732
|
+
* HTTP access fallback with `statusCode`. The document's shell rejected with
|
|
733
|
+
* one that a component nothing tags threw: one a layout renders, the page
|
|
734
|
+
* renders or a template. This runs only on that error path, as a layout's own
|
|
735
|
+
* component tags what it throws.
|
|
736
|
+
*/
|
|
737
|
+
async function findAppPageLayoutSubtreeSpecialErrorIndex(options, statusCode, limit) {
|
|
738
|
+
const layoutCount = Math.min(limit, getAppPageLayoutProbeCount(options.route, getActiveLoadingTreePositions(options.route)));
|
|
739
|
+
if (layoutCount === 0) return null;
|
|
740
|
+
return await runWithDetachedDynamicUsage(() => options.runWithSuppressedHookWarning(async () => {
|
|
741
|
+
for (let layoutIndex = 0; layoutIndex < layoutCount; layoutIndex++) {
|
|
742
|
+
const outcome = await runWithConnectionProbe(async () => {
|
|
743
|
+
try {
|
|
744
|
+
await options.probeLayoutAt(layoutIndex);
|
|
745
|
+
return false;
|
|
746
|
+
} catch (error) {
|
|
747
|
+
const specialError = resolveAppPageSpecialError(error);
|
|
748
|
+
return specialError?.kind === "http-access-fallback" && specialError.statusCode === statusCode;
|
|
749
|
+
}
|
|
780
750
|
});
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
751
|
+
if (outcome.completed && outcome.result) return layoutIndex;
|
|
752
|
+
}
|
|
753
|
+
return null;
|
|
754
|
+
}));
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* The fallback for a special error a layout threw, or a parallel slot that
|
|
758
|
+
* layout renders: the boundary above the layout catches it. With
|
|
759
|
+
* `insideLayout`, the layout re-renders around its own segment's boundary
|
|
760
|
+
* instead. Without a segment boundary, Next.js' built-in not-found,
|
|
761
|
+
* forbidden or unauthorized page renders inside the root layout, or without
|
|
762
|
+
* it when the root layout, or a slot beside it outside `insideLayout`, threw.
|
|
763
|
+
*/
|
|
764
|
+
function renderLayoutBoundaryFallback(options, statusCode, layoutIndex, fallbackOptions) {
|
|
765
|
+
const { route } = options;
|
|
766
|
+
const layoutTreePositions = route.layoutTreePositions ?? [];
|
|
767
|
+
const boundaryModules = statusCode === 403 ? route.segmentForbiddens : statusCode === 401 ? route.segmentUnauthorizeds : route.segmentNotFounds;
|
|
768
|
+
const boundaryTreePositions = statusCode === 403 ? route.segmentForbiddenTreePositions : statusCode === 401 ? route.segmentUnauthorizedTreePositions : route.segmentNotFoundTreePositions;
|
|
769
|
+
const insideLayout = fallbackOptions.insideLayout === true;
|
|
770
|
+
const ownLayoutTreePosition = layoutTreePositions[layoutIndex];
|
|
771
|
+
const layoutTreePosition = ownLayoutTreePosition === void 0 || !insideLayout ? ownLayoutTreePosition : ownLayoutTreePosition + 1;
|
|
772
|
+
const renderedLayoutCount = insideLayout ? layoutIndex + 1 : layoutIndex;
|
|
773
|
+
const boundary = layoutTreePosition === void 0 ? null : resolveAppPageLayoutHttpAccessBoundary({
|
|
774
|
+
boundaryModules: boundaryModules ?? [],
|
|
775
|
+
boundaryTreePositions: boundaryTreePositions ?? [],
|
|
776
|
+
layoutTreePosition
|
|
777
|
+
});
|
|
778
|
+
const boundaryModule = boundary?.module ?? getDefaultHttpAccessFallbackModule(statusCode);
|
|
779
|
+
if (!boundaryModule) return Promise.resolve(null);
|
|
780
|
+
const boundaryTreePosition = Math.max(boundary?.treePosition ?? 0, resolveAppPageRootHttpAccessBoundaryTreePosition(route.routeSegments, layoutTreePositions, layoutTreePosition));
|
|
781
|
+
const headBoundary = resolveAppPageLayoutHttpAccessBoundary({
|
|
782
|
+
boundaryModules: boundaryModules ?? [],
|
|
783
|
+
boundaryTreePositions: boundaryTreePositions ?? [],
|
|
784
|
+
layoutTreePosition: Number.POSITIVE_INFINITY
|
|
785
|
+
});
|
|
786
|
+
return options.renderHttpAccessFallbackPage(statusCode, {
|
|
787
|
+
boundaryComponent: boundaryModule.default,
|
|
788
|
+
boundaryModule,
|
|
789
|
+
headBoundaryModule: headBoundary?.module ?? boundaryModule,
|
|
790
|
+
headLayouts: fallbackOptions.headLayouts,
|
|
791
|
+
...fallbackOptions.intercept ? { intercept: fallbackOptions.intercept } : {},
|
|
792
|
+
...fallbackOptions.isCacheCandidate ? { isCacheCandidate: true } : {},
|
|
793
|
+
layouts: route.layouts.filter((_, index) => index < renderedLayoutCount && (layoutTreePositions[index] ?? 0) <= boundaryTreePosition),
|
|
794
|
+
matchedParams: options.params,
|
|
795
|
+
...fallbackOptions.routeHead ? { routeHead: fallbackOptions.routeHead } : {}
|
|
796
|
+
}, null);
|
|
797
|
+
}
|
|
798
|
+
/**
|
|
799
|
+
* The fallback for a page's `notFound()` / `forbidden()` / `unauthorized()`.
|
|
800
|
+
* Next.js wraps each segment's children in its boundaries, with or without a
|
|
801
|
+
* layout, so the route's deepest boundary catches the signal and replaces
|
|
802
|
+
* every layout below its segment. Without one, the built-in not-found,
|
|
803
|
+
* forbidden or unauthorized page renders inside the root layout. Returns
|
|
804
|
+
* `null` for routes without segment data.
|
|
805
|
+
* https://github.com/vercel/next.js/blob/canary/packages/next/src/server/app-render/create-component-tree.tsx
|
|
806
|
+
*/
|
|
807
|
+
function renderPageSegmentBoundaryFallback(options, statusCode, intercept, isCacheCandidate, routeHead) {
|
|
808
|
+
const { route } = options;
|
|
809
|
+
const boundaryModules = statusCode === 403 ? route.segmentForbiddens : statusCode === 401 ? route.segmentUnauthorizeds : route.segmentNotFounds;
|
|
810
|
+
const boundaryTreePositions = statusCode === 403 ? route.segmentForbiddenTreePositions : statusCode === 401 ? route.segmentUnauthorizedTreePositions : route.segmentNotFoundTreePositions;
|
|
811
|
+
if (!boundaryTreePositions) return null;
|
|
812
|
+
const boundary = resolveAppPageLayoutHttpAccessBoundary({
|
|
813
|
+
boundaryModules: boundaryModules ?? [],
|
|
814
|
+
boundaryTreePositions,
|
|
815
|
+
layoutTreePosition: Number.POSITIVE_INFINITY
|
|
793
816
|
});
|
|
817
|
+
const boundaryModule = boundary?.module ?? getDefaultHttpAccessFallbackModule(statusCode);
|
|
818
|
+
if (!boundaryModule) return Promise.resolve(null);
|
|
819
|
+
const layoutTreePositions = route.layoutTreePositions ?? [];
|
|
820
|
+
const boundaryTreePosition = Math.max(boundary?.treePosition ?? 0, resolveAppPageRootHttpAccessBoundaryTreePosition(route.routeSegments, layoutTreePositions, Number.POSITIVE_INFINITY));
|
|
821
|
+
return options.renderHttpAccessFallbackPage(statusCode, {
|
|
822
|
+
boundaryComponent: boundaryModule.default,
|
|
823
|
+
boundaryModule,
|
|
824
|
+
headLayouts: route.layouts,
|
|
825
|
+
intercept,
|
|
826
|
+
...isCacheCandidate ? { isCacheCandidate } : {},
|
|
827
|
+
layouts: route.layouts.filter((_, index) => (layoutTreePositions[index] ?? 0) <= boundaryTreePosition),
|
|
828
|
+
matchedParams: options.params,
|
|
829
|
+
...routeHead ? { routeHead } : {}
|
|
830
|
+
}, null);
|
|
794
831
|
}
|
|
795
|
-
async function renderPageSpecialError(options, specialError, serveStreamingMetadata, intercept, isCacheCandidate = false) {
|
|
832
|
+
async function renderPageSpecialError(options, specialError, serveStreamingMetadata, intercept, isCacheCandidate = false, caughtDocument, renderedRouteHead = null) {
|
|
833
|
+
const routeHead = resolveFallbackRouteHead(options, renderedRouteHead);
|
|
796
834
|
return buildAppPageSpecialErrorResponse({
|
|
797
835
|
basePath: options.basePath,
|
|
798
836
|
buildRscRedirectFlightStream: (rscOptions) => buildRscRedirectFlightStream({
|
|
@@ -805,7 +843,27 @@ async function renderPageSpecialError(options, specialError, serveStreamingMetad
|
|
|
805
843
|
isEdgeRuntime: options.isEdgeRuntime,
|
|
806
844
|
isRscRequest: options.isRscRequest,
|
|
807
845
|
middlewareContext: options.middlewareContext,
|
|
808
|
-
renderFallbackPage(statusCode) {
|
|
846
|
+
async renderFallbackPage(statusCode) {
|
|
847
|
+
if (caughtDocument) return caughtDocument;
|
|
848
|
+
if (specialError.kind === "http-access-fallback") {
|
|
849
|
+
let layoutIndex = specialError.layoutIndex ?? null;
|
|
850
|
+
if (specialError.unattributed === true) layoutIndex = await findAppPageLayoutSubtreeSpecialErrorIndex(options, statusCode, layoutIndex ?? (specialError.slotLayoutIndex === void 0 ? options.route.layouts.length : specialError.slotLayoutIndex + 1)) ?? layoutIndex;
|
|
851
|
+
if (layoutIndex !== null) return renderLayoutBoundaryFallback(options, statusCode, layoutIndex, {
|
|
852
|
+
headLayouts: options.route.layouts.slice(0, layoutIndex),
|
|
853
|
+
intercept,
|
|
854
|
+
isCacheCandidate,
|
|
855
|
+
routeHead
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
if (specialError.kind === "http-access-fallback" && specialError.slotLayoutIndex !== void 0) return renderLayoutBoundaryFallback(options, statusCode, specialError.slotLayoutIndex, {
|
|
859
|
+
headLayouts: options.route.layouts,
|
|
860
|
+
insideLayout: specialError.slotLayoutIndex === 0 && (statusCode === 404 || isAppClientReference(options.route.layouts[0]?.default)),
|
|
861
|
+
intercept,
|
|
862
|
+
isCacheCandidate,
|
|
863
|
+
routeHead
|
|
864
|
+
});
|
|
865
|
+
const pageBoundaryFallback = renderPageSegmentBoundaryFallback(options, statusCode, intercept, isCacheCandidate, routeHead);
|
|
866
|
+
if (pageBoundaryFallback) return pageBoundaryFallback;
|
|
809
867
|
const routeBoundaryModule = resolveAppPageRouteBoundaryModule(options.route, statusCode);
|
|
810
868
|
const layoutCount = options.route.layouts.length;
|
|
811
869
|
const { module: parentBoundaryModule, layoutIndex: boundaryLayoutIndex } = resolveAppPageParentHttpAccessBoundary({
|
|
@@ -822,7 +880,8 @@ async function renderPageSpecialError(options, specialError, serveStreamingMetad
|
|
|
822
880
|
const fallbackOptions = {
|
|
823
881
|
intercept,
|
|
824
882
|
...isCacheCandidate ? { isCacheCandidate } : {},
|
|
825
|
-
matchedParams: options.params
|
|
883
|
+
matchedParams: options.params,
|
|
884
|
+
...routeHead ? { routeHead } : {}
|
|
826
885
|
};
|
|
827
886
|
if (useLayoutAlignedBoundary && boundaryLayoutIndex !== null) {
|
|
828
887
|
fallbackOptions.layouts = options.route.layouts.slice(0, boundaryLayoutIndex + 1);
|