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
|
@@ -6,7 +6,7 @@ import "../shims/navigation.js";
|
|
|
6
6
|
import { AppPageParams } from "./app-page-boundary.js";
|
|
7
7
|
import { AppPageFontPreload } from "./app-page-execution.js";
|
|
8
8
|
import { AppPageMiddlewareContext } from "./app-page-response.js";
|
|
9
|
-
import { ApplyAppPageFileBasedMetadata } from "./app-page-head.js";
|
|
9
|
+
import { AppPageFallbackRouteHead, ApplyAppPageFileBasedMetadata } from "./app-page-head.js";
|
|
10
10
|
import { AppPageRouteWiringRoute } from "./app-page-route-wiring.js";
|
|
11
11
|
import { AppPageInterceptOptions } from "./app-page-element-builder.js";
|
|
12
12
|
import { AppPageSsrHandler } from "./app-page-stream.js";
|
|
@@ -30,9 +30,17 @@ export type AppPageBoundaryRoute<TModule extends AppPageModule = AppPageModule>
|
|
|
30
30
|
notFound?: TModule | null;
|
|
31
31
|
notFounds?: readonly (TModule | null | undefined)[] | null;
|
|
32
32
|
notFoundTreePosition?: number | null;
|
|
33
|
+
page?: TModule | null;
|
|
33
34
|
params?: AppPageParams;
|
|
34
35
|
pattern?: string;
|
|
35
36
|
routeSegments?: readonly string[];
|
|
37
|
+
childrenSlot?: AppPageRouteWiringRoute<TModule>["childrenSlot"];
|
|
38
|
+
segmentForbiddens?: readonly (TModule | null | undefined)[] | null;
|
|
39
|
+
segmentForbiddenTreePositions?: readonly number[] | null;
|
|
40
|
+
segmentNotFounds?: readonly (TModule | null | undefined)[] | null;
|
|
41
|
+
segmentNotFoundTreePositions?: readonly number[] | null;
|
|
42
|
+
segmentUnauthorizeds?: readonly (TModule | null | undefined)[] | null;
|
|
43
|
+
segmentUnauthorizedTreePositions?: readonly number[] | null;
|
|
36
44
|
slots?: AppPageRouteWiringRoute<TModule>["slots"];
|
|
37
45
|
unauthorized?: TModule | null;
|
|
38
46
|
unauthorizedTreePosition?: number | null;
|
|
@@ -88,12 +96,21 @@ type AppPageBoundaryRenderCommonOptions<TModule extends AppPageModule = AppPageM
|
|
|
88
96
|
type RenderAppPageHttpAccessFallbackOptions<TModule extends AppPageModule = AppPageModule> = {
|
|
89
97
|
boundaryComponent?: AppPageComponent | null;
|
|
90
98
|
boundaryModule?: TModule | null;
|
|
99
|
+
/** Boundary whose metadata the head uses, when not the rendered boundary. */
|
|
100
|
+
headBoundaryModule?: TModule | null;
|
|
101
|
+
/** Layouts whose metadata the head uses, when more than render around the boundary. */
|
|
102
|
+
headLayoutModules?: readonly (TModule | null | undefined)[] | null;
|
|
91
103
|
intercept?: AppPageInterceptOptions<TModule> | null;
|
|
92
104
|
layoutModules?: readonly (TModule | null | undefined)[] | null;
|
|
93
105
|
matchedParams: AppPageParams;
|
|
94
106
|
rootForbiddenModule?: TModule | null;
|
|
95
107
|
rootNotFoundModule?: TModule | null;
|
|
96
108
|
rootUnauthorizedModule?: TModule | null;
|
|
109
|
+
/**
|
|
110
|
+
* The matched route's render threw the signal, so the document keeps the
|
|
111
|
+
* route's own head rather than the boundary convention's.
|
|
112
|
+
*/
|
|
113
|
+
routeHead?: AppPageFallbackRouteHead | null;
|
|
97
114
|
/** Normalized, basePath-free application pathname used for route matching. */
|
|
98
115
|
routePathname?: string;
|
|
99
116
|
route?: AppPageBoundaryRoute<TModule> | null;
|
|
@@ -116,4 +133,5 @@ type RenderAppPageErrorBoundaryOptions<TModule extends AppPageModule = AppPageMo
|
|
|
116
133
|
} & AppPageBoundaryRenderCommonOptions<TModule>;
|
|
117
134
|
export declare function renderAppPageHttpAccessFallback<TModule extends AppPageModule>(options: RenderAppPageHttpAccessFallbackOptions<TModule>): Promise<Response | null>;
|
|
118
135
|
export declare function renderAppPageErrorBoundary<TModule extends AppPageModule>(options: RenderAppPageErrorBoundaryOptions<TModule>): Promise<Response | null>;
|
|
119
|
-
//#endregion
|
|
136
|
+
//#endregion
|
|
137
|
+
export {};
|
|
@@ -1,28 +1,61 @@
|
|
|
1
1
|
import { stripBasePath } from "../utils/base-path.js";
|
|
2
2
|
import { isNavigationSignalError } from "../utils/navigation-signal.js";
|
|
3
3
|
import { NEVER_CACHE_CONTROL, applyCdnResponseHeaders } from "./cache-control.js";
|
|
4
|
+
import { isRenderDynamicLatched, isStaticGenerationAccessError } from "../shims/internal/headers-state.js";
|
|
5
|
+
import { copyLinkHeaderProvenance } from "./app-response-header-provenance.js";
|
|
6
|
+
import { stripRscSuffix } from "./app-rsc-cache-busting.js";
|
|
4
7
|
import { createArtifactCompatibilityEnvelope } from "./artifact-compatibility.js";
|
|
5
8
|
import { AppElementsWire } from "./app-elements-wire.js";
|
|
6
9
|
import "./app-elements.js";
|
|
7
10
|
import DefaultGlobalError from "../shims/default-global-error.js";
|
|
8
11
|
import { ErrorBoundary, GlobalErrorBoundary, SerializedErrorBoundary } from "../shims/error-boundary.js";
|
|
12
|
+
import { buildClientHookErrorMessage } from "../shims/client-hook-error.js";
|
|
9
13
|
import { LayoutSegmentProvider } from "../shims/layout-segment-context.js";
|
|
10
14
|
import { withUseCacheLayoutMarker } from "../shims/internal/app-page-props-cache-key.js";
|
|
11
15
|
import { MetadataHead, ViewportHead } from "../shims/metadata.js";
|
|
12
|
-
import { resolveAppPageBranchParams, resolveAppPageSegmentParams } from "./app-page-params.js";
|
|
13
|
-
import { stripRscSuffix } from "./app-rsc-cache-busting.js";
|
|
14
16
|
import { buildRscRedirectFlightStream } from "./app-rsc-redirect-flight.js";
|
|
15
17
|
import { bufferAppPageBinaryStream, buildAppPageSpecialErrorResponse, resolveAppPageSpecialError } from "./app-page-execution.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { resolveActiveParallelRouteHeadInputs, resolveAppPageHead } from "./app-page-head.js";
|
|
20
|
-
import { resolveHttpAccessFallbackMetadata, resolveHttpAccessFallbackViewport } from "./app-page-http-access-fallback-metadata.js";
|
|
21
|
-
import "./app-rsc-route-matching.js";
|
|
18
|
+
import { createAppPageMetadataSearchParamsObserver } from "./app-page-search-params-observation.js";
|
|
19
|
+
import { resolveAppPageBranchParams, resolveAppPageSegmentParams } from "./app-page-params.js";
|
|
20
|
+
import { hasAppPageDynamicMetadata, prepareAppPageHead, resolveActiveParallelRouteHeadInputs, resolveAppPageHead, resolveInterceptLayoutsBesidePage, slotInterceptKeepsSourceHead } from "./app-page-head.js";
|
|
22
21
|
import { renderAppPageBoundaryResponse, resolveAppPageErrorBoundary, resolveAppPageHttpAccessBoundaryModule, wrapAppPageBoundaryElement } from "./app-page-boundary.js";
|
|
22
|
+
import { createRouteNotFoundHeadPlanOptions, recoverAppPageRouteHead, resolveHttpAccessFallbackMetadata, resolveHttpAccessFallbackViewport } from "./app-page-http-access-fallback-metadata.js";
|
|
23
|
+
import "./app-rsc-route-matching.js";
|
|
24
|
+
import { createAppPageLayoutEntries, createAppPageRouteBodyMetadata, createAppPageSourcePage } from "./app-page-route-wiring.js";
|
|
23
25
|
import { resolveSlotParamOverrides } from "./app-page-element-builder.js";
|
|
24
|
-
import {
|
|
26
|
+
import { createAppPageFontData, createAppPageRscErrorTracker, createAppPageSsrErrorHandler, renderAppPageHtmlResponse } from "./app-page-stream.js";
|
|
27
|
+
import { Fragment, Suspense, createElement } from "react";
|
|
25
28
|
//#region src/server/app-page-boundary-render.ts
|
|
29
|
+
async function AppPageBoundaryStreamedMetadata(props) {
|
|
30
|
+
return createAppPageRouteBodyMetadata(await props.metadata, props.pathname, "body", props.trailingSlash, props.scriptNonce);
|
|
31
|
+
}
|
|
32
|
+
AppPageBoundaryStreamedMetadata.displayName = "Vinext.StreamingMetadata";
|
|
33
|
+
/** Holds the response open until a head it doesn't render settles, as Next.js streams it. */
|
|
34
|
+
async function AppPageBoundarySettledHead(props) {
|
|
35
|
+
await props.head;
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
AppPageBoundarySettledHead.displayName = "Vinext.ErrorShellMetadata";
|
|
39
|
+
/**
|
|
40
|
+
* Fail a fallback document once its body has streamed if a head it streamed
|
|
41
|
+
* behind Suspense hit a `dynamic = "error"` access error. Inside a Suspense
|
|
42
|
+
* boundary, React would only report it and finish the document, so the 404
|
|
43
|
+
* could be served, and stored, where Next.js fails the render. An errored body
|
|
44
|
+
* reaches the client truncated and is never written to the cache.
|
|
45
|
+
*/
|
|
46
|
+
function failOnLateAccessError(response, accessErrors) {
|
|
47
|
+
if (accessErrors.length === 0 || !response.body) return response;
|
|
48
|
+
const body = response.body.pipeThrough(new TransformStream({ async flush() {
|
|
49
|
+
for (const accessError of await Promise.all(accessErrors)) if (accessError) throw accessError;
|
|
50
|
+
} }));
|
|
51
|
+
const wrapped = new Response(body, {
|
|
52
|
+
headers: response.headers,
|
|
53
|
+
status: response.status,
|
|
54
|
+
statusText: response.statusText
|
|
55
|
+
});
|
|
56
|
+
copyLinkHeaderProvenance(response.headers, wrapped.headers);
|
|
57
|
+
return wrapped;
|
|
58
|
+
}
|
|
26
59
|
const DEFAULT_GLOBAL_ERROR_COMPONENT = DefaultGlobalError;
|
|
27
60
|
function getDefaultExport(module) {
|
|
28
61
|
return module?.default ?? null;
|
|
@@ -35,6 +68,8 @@ function resolveHttpAccessBoundaryTreePosition(route, boundaryModule, statusCode
|
|
|
35
68
|
if (boundaryModule === routeBoundary && statusCode === 403) return route.forbiddenTreePosition ?? null;
|
|
36
69
|
if (boundaryModule === routeBoundary && statusCode === 401) return route.unauthorizedTreePosition ?? null;
|
|
37
70
|
for (let index = (layoutBoundaries?.length ?? 0) - 1; index >= 0; index--) if (layoutBoundaries?.[index] === boundaryModule) return route.layoutTreePositions?.[index] ?? null;
|
|
71
|
+
const segmentIndex = (statusCode === 403 ? route.segmentForbiddens : statusCode === 401 ? route.segmentUnauthorizeds : route.segmentNotFounds)?.lastIndexOf(boundaryModule) ?? -1;
|
|
72
|
+
if (segmentIndex !== -1) return (statusCode === 403 ? route.segmentForbiddenTreePositions : statusCode === 401 ? route.segmentUnauthorizedTreePositions : route.segmentNotFoundTreePositions)?.[segmentIndex] ?? null;
|
|
38
73
|
return null;
|
|
39
74
|
}
|
|
40
75
|
function wrapRenderedBoundaryElement(options) {
|
|
@@ -224,17 +259,23 @@ async function renderAppPageHttpAccessFallback(options) {
|
|
|
224
259
|
const layoutModules = options.layoutModules ?? options.route?.layouts ?? options.rootLayouts;
|
|
225
260
|
const pathname = new URL(options.requestUrl).pathname;
|
|
226
261
|
const routePathname = options.routePathname ?? stripRscSuffix(stripBasePath(pathname, options.basePath ?? ""));
|
|
227
|
-
const
|
|
262
|
+
const headBoundaryModule = options.headBoundaryModule ?? boundaryModule;
|
|
263
|
+
const headLayoutModules = options.headLayoutModules ?? layoutModules;
|
|
264
|
+
const routeSegments = resolveHttpAccessFallbackHeadRouteSegments(options.route, headLayoutModules);
|
|
228
265
|
const fallbackRouteSegments = routeSegments ?? [];
|
|
229
266
|
let head;
|
|
267
|
+
let streamedRouteMetadata = null;
|
|
268
|
+
let streamedConventionHead = null;
|
|
269
|
+
const lateAccessErrors = [];
|
|
230
270
|
try {
|
|
231
271
|
if ([
|
|
232
272
|
401,
|
|
233
273
|
403,
|
|
234
274
|
404
|
|
235
275
|
].includes(options.statusCode)) {
|
|
236
|
-
const boundaryTreePosition = resolveHttpAccessBoundaryTreePosition(options.route,
|
|
237
|
-
const
|
|
276
|
+
const boundaryTreePosition = resolveHttpAccessBoundaryTreePosition(options.route, headBoundaryModule, options.statusCode);
|
|
277
|
+
const boundaryRouteSegments = (options.route?.routeSegments ?? fallbackRouteSegments).slice(0, boundaryTreePosition ?? 0);
|
|
278
|
+
const boundaryParams = boundaryTreePosition == null ? {} : resolveAppPageSegmentParams(boundaryRouteSegments, boundaryTreePosition, options.matchedParams);
|
|
238
279
|
const intercept = options.intercept;
|
|
239
280
|
const isSiblingIntercept = intercept?.interceptSlotKey === "__vinext_page_intercept" && intercept.interceptPage != null;
|
|
240
281
|
const effectiveParams = isSiblingIntercept ? intercept.interceptParams ?? options.matchedParams : options.matchedParams;
|
|
@@ -256,52 +297,181 @@ async function renderAppPageHttpAccessFallback(options) {
|
|
|
256
297
|
slotParams,
|
|
257
298
|
slots: options.route?.slots ?? null
|
|
258
299
|
});
|
|
259
|
-
const
|
|
300
|
+
const resolvePrimaryParallelBranch = (segments) => isSiblingIntercept ? {
|
|
260
301
|
head: {
|
|
261
302
|
layoutModules: intercept?.interceptLayouts ?? [],
|
|
262
|
-
layoutParams: (intercept?.interceptLayoutSegments ?? []).map((
|
|
303
|
+
layoutParams: (intercept?.interceptLayoutSegments ?? []).map((layoutSegments) => resolveAppPageBranchParams(intercept?.interceptBranchSegments ?? layoutSegments, layoutSegments.length, effectiveParams, layoutSegments)),
|
|
304
|
+
layoutsBesidePage: resolveInterceptLayoutsBesidePage(intercept?.interceptLayoutSegments, intercept?.interceptBranchSegments),
|
|
263
305
|
pageModule: intercept?.interceptPage ?? null,
|
|
264
306
|
params: effectiveParams,
|
|
265
|
-
routeSegments: intercept?.interceptSourcePageSegments ??
|
|
307
|
+
routeSegments: intercept?.interceptSourcePageSegments ?? segments
|
|
266
308
|
},
|
|
267
309
|
...intercept?.interceptNotFound ? {
|
|
268
310
|
notFoundModule: intercept.interceptNotFound,
|
|
269
|
-
notFoundModuleRouteSegments: (intercept.interceptNotFoundBranchSegments ?? intercept.interceptSourcePageSegments ??
|
|
270
|
-
notFoundParams: resolveAppPageBranchParams(intercept.interceptNotFoundBranchSegments ?? intercept.interceptBranchSegments ??
|
|
311
|
+
notFoundModuleRouteSegments: (intercept.interceptNotFoundBranchSegments ?? intercept.interceptSourcePageSegments ?? segments).slice(0, intercept.interceptNotFoundTreePosition ?? 0),
|
|
312
|
+
notFoundParams: resolveAppPageBranchParams(intercept.interceptNotFoundBranchSegments ?? intercept.interceptBranchSegments ?? segments, intercept.interceptNotFoundTreePosition ?? 0, effectiveParams)
|
|
271
313
|
} : {},
|
|
272
|
-
ownerTreePosition:
|
|
314
|
+
ownerTreePosition: segments.length
|
|
273
315
|
} : null;
|
|
316
|
+
const primaryParallelBranch = resolvePrimaryParallelBranch(fallbackRouteSegments);
|
|
274
317
|
const fallbackHeadOptions = {
|
|
275
|
-
boundaryModule,
|
|
318
|
+
boundaryModule: headBoundaryModule,
|
|
276
319
|
boundaryParams,
|
|
277
|
-
boundaryRouteSegments
|
|
320
|
+
boundaryRouteSegments,
|
|
278
321
|
branchNotFoundConventions: options.statusCode === 404,
|
|
279
322
|
errorConvention: options.statusCode === 403 ? "forbidden" : options.statusCode === 401 ? "unauthorized" : "not-found",
|
|
280
|
-
layoutModules,
|
|
281
|
-
layoutTreePositions: resolveHttpAccessFallbackHeadLayoutTreePositions(options.route,
|
|
323
|
+
layoutModules: headLayoutModules,
|
|
324
|
+
layoutTreePositions: resolveHttpAccessFallbackHeadLayoutTreePositions(options.route, headLayoutModules),
|
|
282
325
|
parallelBranches,
|
|
283
326
|
params: options.matchedParams,
|
|
284
327
|
primaryParallelBranch,
|
|
285
328
|
routeSegments
|
|
286
329
|
};
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
330
|
+
const startConventionHead = ({ errorShell = false } = {}) => {
|
|
331
|
+
const settle = (branch) => errorShell ? branch.catch((error) => {
|
|
332
|
+
if (isStaticGenerationAccessError(error)) throw error;
|
|
333
|
+
return null;
|
|
334
|
+
}) : branch;
|
|
335
|
+
const metadata = settle(resolveHttpAccessFallbackMetadata({
|
|
336
|
+
applyFileBasedMetadata: options.applyFileBasedMetadata,
|
|
337
|
+
basePath: options.basePath ?? "",
|
|
338
|
+
...fallbackHeadOptions,
|
|
339
|
+
metadataRoutes: options.metadataRoutes,
|
|
340
|
+
routePath: options.route?.pattern ?? pathname
|
|
341
|
+
}));
|
|
342
|
+
const viewport = settle(resolveHttpAccessFallbackViewport(fallbackHeadOptions));
|
|
343
|
+
metadata.catch(() => null);
|
|
344
|
+
viewport.catch(() => null);
|
|
345
|
+
return {
|
|
346
|
+
metadata,
|
|
347
|
+
viewport
|
|
348
|
+
};
|
|
297
349
|
};
|
|
350
|
+
const resolveConventionHead = async (settings) => {
|
|
351
|
+
const conventionHead = startConventionHead(settings);
|
|
352
|
+
const [metadata, viewport] = await Promise.all([conventionHead.metadata, conventionHead.viewport]);
|
|
353
|
+
return {
|
|
354
|
+
metadata,
|
|
355
|
+
viewport
|
|
356
|
+
};
|
|
357
|
+
};
|
|
358
|
+
const route = options.route;
|
|
359
|
+
const routeHead = options.routeHead;
|
|
360
|
+
if (routeHead && route) {
|
|
361
|
+
const prepareRouteHead = () => {
|
|
362
|
+
if (routeHead.prepared) return routeHead.prepared;
|
|
363
|
+
const fullRouteSegments = route.routeSegments ?? [];
|
|
364
|
+
const routePrimaryParallelBranch = resolvePrimaryParallelBranch(fullRouteSegments);
|
|
365
|
+
const sourceParallelBranches = resolveActiveParallelRouteHeadInputs({
|
|
366
|
+
layoutTreePositions: route.layoutTreePositions,
|
|
367
|
+
params: options.matchedParams,
|
|
368
|
+
routeSegments: fullRouteSegments,
|
|
369
|
+
slotParams,
|
|
370
|
+
slots: route.slots ?? null
|
|
371
|
+
});
|
|
372
|
+
const interceptSlotKey = intercept?.interceptPage != null && !isSiblingIntercept ? intercept.interceptSlotKey ?? null : null;
|
|
373
|
+
const routeParallelBranches = interceptSlotKey === null || slotInterceptKeepsSourceHead({
|
|
374
|
+
interceptSlotKey,
|
|
375
|
+
route,
|
|
376
|
+
sourceParallelRoutes: sourceParallelBranches
|
|
377
|
+
}) ? sourceParallelBranches : resolveActiveParallelRouteHeadInputs({
|
|
378
|
+
interceptBranchSegments: intercept?.interceptBranchSegments ?? null,
|
|
379
|
+
interceptLayouts: intercept?.interceptLayouts ?? null,
|
|
380
|
+
interceptLayoutSegments: intercept?.interceptLayoutSegments ?? null,
|
|
381
|
+
interceptNotFoundBranchSegments: intercept?.interceptNotFoundBranchSegments ?? null,
|
|
382
|
+
interceptNotFound: intercept?.interceptNotFound ?? null,
|
|
383
|
+
interceptNotFoundTreePosition: intercept?.interceptNotFoundTreePosition ?? null,
|
|
384
|
+
interceptPage: intercept?.interceptPage ?? null,
|
|
385
|
+
interceptParams: intercept?.interceptParams ?? null,
|
|
386
|
+
interceptSlotKey,
|
|
387
|
+
interceptSourcePageSegments: intercept?.interceptSourcePageSegments ?? null,
|
|
388
|
+
layoutTreePositions: route.layoutTreePositions,
|
|
389
|
+
params: options.matchedParams,
|
|
390
|
+
routeSegments: fullRouteSegments,
|
|
391
|
+
slotParams,
|
|
392
|
+
slots: route.slots ?? null
|
|
393
|
+
});
|
|
394
|
+
const routeLayoutModules = route.layouts ?? options.rootLayouts;
|
|
395
|
+
const headOptions = {
|
|
396
|
+
applyFileBasedMetadata: options.applyFileBasedMetadata,
|
|
397
|
+
basePath: options.basePath ?? "",
|
|
398
|
+
layoutModules: routeLayoutModules,
|
|
399
|
+
layoutTreePositions: route.layoutTreePositions,
|
|
400
|
+
metadataRoutes: options.metadataRoutes,
|
|
401
|
+
pageModule: isSiblingIntercept ? null : route.page ?? null,
|
|
402
|
+
parallelRoutes: [...routePrimaryParallelBranch ? [routePrimaryParallelBranch.head] : [], ...routeParallelBranches.map((branch) => branch.head)],
|
|
403
|
+
params: effectiveParams,
|
|
404
|
+
routePath: route.pattern ?? pathname,
|
|
405
|
+
routeSegments: route.routeSegments ?? null,
|
|
406
|
+
searchParams: routeHead.searchParams,
|
|
407
|
+
searchParamsObserver: createAppPageMetadataSearchParamsObserver(routeHead.observeSearchParams)
|
|
408
|
+
};
|
|
409
|
+
return {
|
|
410
|
+
...recoverAppPageRouteHead(prepareAppPageHead(headOptions), {
|
|
411
|
+
applyFileBasedMetadata: options.applyFileBasedMetadata,
|
|
412
|
+
basePath: options.basePath ?? "",
|
|
413
|
+
metadataRoutes: options.metadataRoutes,
|
|
414
|
+
resolvePlanOptions: () => createRouteNotFoundHeadPlanOptions({
|
|
415
|
+
parallelBranches: routeParallelBranches,
|
|
416
|
+
params: effectiveParams,
|
|
417
|
+
primaryParallelBranch: routePrimaryParallelBranch,
|
|
418
|
+
rootNotFoundModule: options.rootNotFoundModule,
|
|
419
|
+
route: {
|
|
420
|
+
...route,
|
|
421
|
+
layouts: routeLayoutModules
|
|
422
|
+
}
|
|
423
|
+
}),
|
|
424
|
+
routePath: route.pattern ?? pathname
|
|
425
|
+
}),
|
|
426
|
+
metadataPlacement: routeHead.streamMetadata && hasAppPageDynamicMetadata(headOptions) ? "body" : "head"
|
|
427
|
+
};
|
|
428
|
+
};
|
|
429
|
+
const routeHeadResult = prepareRouteHead();
|
|
430
|
+
const throwIfAccessError = async () => {
|
|
431
|
+
const accessError = await routeHeadResult.accessError;
|
|
432
|
+
if (accessError) throw accessError;
|
|
433
|
+
};
|
|
434
|
+
const conventionHeadBranches = options.isRscRequest ? null : startConventionHead({ errorShell: true });
|
|
435
|
+
const isHtmlLimitedBot = options.serveStreamingMetadata === false;
|
|
436
|
+
let conventionHead = null;
|
|
437
|
+
if (conventionHeadBranches && isHtmlLimitedBot) {
|
|
438
|
+
const [metadata, viewport] = await Promise.all([conventionHeadBranches.metadata, conventionHeadBranches.viewport]);
|
|
439
|
+
conventionHead = {
|
|
440
|
+
metadata,
|
|
441
|
+
viewport
|
|
442
|
+
};
|
|
443
|
+
} else if (conventionHeadBranches) {
|
|
444
|
+
await conventionHeadBranches.viewport;
|
|
445
|
+
streamedConventionHead = conventionHeadBranches.metadata.catch(() => null);
|
|
446
|
+
lateAccessErrors.push(conventionHeadBranches.metadata.then(() => null, (error) => isStaticGenerationAccessError(error) ? error : null));
|
|
447
|
+
}
|
|
448
|
+
if (!options.isRscRequest && routeHeadResult.metadataPlacement === "body") {
|
|
449
|
+
streamedRouteMetadata = routeHeadResult.metadata;
|
|
450
|
+
lateAccessErrors.push(routeHeadResult.accessError);
|
|
451
|
+
head = {
|
|
452
|
+
metadata: null,
|
|
453
|
+
viewport: await routeHeadResult.viewport
|
|
454
|
+
};
|
|
455
|
+
} else {
|
|
456
|
+
const [metadata, viewport] = await Promise.all([
|
|
457
|
+
routeHeadResult.metadata,
|
|
458
|
+
routeHeadResult.viewport,
|
|
459
|
+
throwIfAccessError()
|
|
460
|
+
]);
|
|
461
|
+
head = {
|
|
462
|
+
metadata,
|
|
463
|
+
viewport
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
if (conventionHead && !streamedRouteMetadata && isHtmlLimitedBot && (!options.isCacheCandidate || isRenderDynamicLatched())) head = conventionHead;
|
|
467
|
+
} else head = await resolveConventionHead();
|
|
298
468
|
} else head = await resolveAppPageHead({
|
|
299
469
|
applyFileBasedMetadata: options.applyFileBasedMetadata,
|
|
300
470
|
basePath: options.basePath ?? "",
|
|
301
|
-
layoutModules,
|
|
302
|
-
layoutTreePositions: resolveHttpAccessFallbackHeadLayoutTreePositions(options.route,
|
|
471
|
+
layoutModules: headLayoutModules,
|
|
472
|
+
layoutTreePositions: resolveHttpAccessFallbackHeadLayoutTreePositions(options.route, headLayoutModules),
|
|
303
473
|
metadataRoutes: options.metadataRoutes,
|
|
304
|
-
pageModule:
|
|
474
|
+
pageModule: headBoundaryModule,
|
|
305
475
|
params: options.matchedParams,
|
|
306
476
|
routePath: options.route?.pattern ?? pathname,
|
|
307
477
|
routeSegments
|
|
@@ -323,16 +493,30 @@ async function renderAppPageHttpAccessFallback(options) {
|
|
|
323
493
|
if (metadata) headElements.push(createElement(MetadataHead, {
|
|
324
494
|
key: "metadata",
|
|
325
495
|
metadata,
|
|
326
|
-
pathname,
|
|
496
|
+
pathname: routePathname,
|
|
327
497
|
trailingSlash: options.trailingSlash
|
|
328
498
|
}));
|
|
329
|
-
headElements.push(createElement(ViewportHead, {
|
|
499
|
+
if (viewport) headElements.push(createElement(ViewportHead, {
|
|
330
500
|
key: "viewport",
|
|
331
501
|
viewport
|
|
332
502
|
}));
|
|
503
|
+
const bodyElements = [];
|
|
504
|
+
if (streamedRouteMetadata) bodyElements.push(createElement("div", {
|
|
505
|
+
hidden: true,
|
|
506
|
+
key: "streamed-metadata"
|
|
507
|
+
}, createElement(Suspense, { fallback: null }, createElement(AppPageBoundaryStreamedMetadata, {
|
|
508
|
+
metadata: streamedRouteMetadata,
|
|
509
|
+
pathname: routePathname,
|
|
510
|
+
scriptNonce: options.scriptNonce,
|
|
511
|
+
trailingSlash: options.trailingSlash
|
|
512
|
+
}))));
|
|
513
|
+
if (streamedConventionHead) bodyElements.push(createElement("div", {
|
|
514
|
+
hidden: true,
|
|
515
|
+
key: "error-shell-metadata"
|
|
516
|
+
}, createElement(Suspense, { fallback: null }, createElement(AppPageBoundarySettledHead, { head: streamedConventionHead }))));
|
|
333
517
|
const skipLayoutWrapping = options.skipLayoutWrapping ?? false;
|
|
334
518
|
const element = wrapRenderedBoundaryElement({
|
|
335
|
-
element: createElement(Fragment, null, ...headElements, createElement(boundaryComponent)),
|
|
519
|
+
element: createElement(Fragment, null, ...headElements, createElement(boundaryComponent), ...bodyElements),
|
|
336
520
|
globalErrorModule: options.globalErrorModule,
|
|
337
521
|
includeGlobalErrorBoundary: true,
|
|
338
522
|
isRscRequest: options.isRscRequest,
|
|
@@ -344,7 +528,7 @@ async function renderAppPageHttpAccessFallback(options) {
|
|
|
344
528
|
routeSegments: options.route?.routeSegments,
|
|
345
529
|
skipLayoutWrapping
|
|
346
530
|
});
|
|
347
|
-
return renderAppPageBoundaryElementResponse({
|
|
531
|
+
return failOnLateAccessError(await renderAppPageBoundaryElementResponse({
|
|
348
532
|
...options,
|
|
349
533
|
element,
|
|
350
534
|
handleSpecialErrors: true,
|
|
@@ -354,7 +538,7 @@ async function renderAppPageHttpAccessFallback(options) {
|
|
|
354
538
|
route: skipLayoutWrapping ? null : options.route,
|
|
355
539
|
routePattern: options.route?.pattern,
|
|
356
540
|
status: options.statusCode
|
|
357
|
-
});
|
|
541
|
+
}), lateAccessErrors);
|
|
358
542
|
}
|
|
359
543
|
async function renderAppPageErrorBoundary(options) {
|
|
360
544
|
const errorBoundary = resolveAppPageErrorBoundary({
|
|
@@ -29,6 +29,13 @@ type ResolveAppPageParentHttpAccessBoundaryModuleOptions<TModule> = {
|
|
|
29
29
|
routeUnauthorizedModules?: readonly (TModule | null | undefined)[] | null;
|
|
30
30
|
statusCode: number;
|
|
31
31
|
};
|
|
32
|
+
type ResolveAppPageLayoutHttpAccessBoundaryOptions<TModule> = {
|
|
33
|
+
/** Segment boundaries for the status, root first, aligned with the positions. */
|
|
34
|
+
boundaryModules: readonly (TModule | null | undefined)[];
|
|
35
|
+
boundaryTreePositions: readonly number[];
|
|
36
|
+
/** Tree position of the layout that threw. */
|
|
37
|
+
layoutTreePosition: number;
|
|
38
|
+
};
|
|
32
39
|
type ResolveAppPageErrorBoundaryOptions<TModule, TComponent> = {
|
|
33
40
|
getDefaultExport: (module: TModule | null | undefined) => TComponent | null | undefined;
|
|
34
41
|
globalErrorModule?: TModule | null;
|
|
@@ -74,11 +81,32 @@ type RenderAppPageBoundaryResponseOptions<TElement> = {
|
|
|
74
81
|
};
|
|
75
82
|
export declare function resolveAppPageHttpAccessBoundaryComponent<TModule, TComponent>(options: ResolveAppPageHttpAccessBoundaryComponentOptions<TModule, TComponent>): TComponent | null;
|
|
76
83
|
export declare function resolveAppPageHttpAccessBoundaryModule<TModule>(options: ResolveAppPageHttpAccessBoundaryModuleOptions<TModule>): TModule | null;
|
|
77
|
-
export declare function resolveAppPageParentHttpAccessBoundaryModule<TModule>(options: ResolveAppPageParentHttpAccessBoundaryModuleOptions<TModule>): TModule | null;
|
|
78
84
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
85
|
+
* The boundary that catches `notFound()` / `forbidden()` / `unauthorized()`
|
|
86
|
+
* thrown by a layout: the deepest segment boundary above the layout's own
|
|
87
|
+
* segment. A segment's boundary wraps its children inside its layout, so the
|
|
88
|
+
* layout's own boundary, and any below it, cannot catch the layout's error.
|
|
89
|
+
* Returns `null` when no segment above the layout has one (issue #4045).
|
|
90
|
+
*/
|
|
91
|
+
export declare function resolveAppPageLayoutHttpAccessBoundary<TModule>(options: ResolveAppPageLayoutHttpAccessBoundaryOptions<TModule>): {
|
|
92
|
+
module: TModule;
|
|
93
|
+
treePosition: number;
|
|
94
|
+
} | null;
|
|
95
|
+
/**
|
|
96
|
+
* Tree position at which the root segment's boundary catches a layout's error.
|
|
97
|
+
* Next.js gives a first-layer route group the root segment's boundary (the
|
|
98
|
+
* custom file or the built-in page) when the group has none of its
|
|
99
|
+
* own, so the boundary renders inside the group's layout, which is often the
|
|
100
|
+
* root layout. Without `app/layout`, the root layout sits deeper (for example
|
|
101
|
+
* `app/[lang]/layout`), and the boundary renders inside it so the page keeps
|
|
102
|
+
* its `<html>` and `<body>`. A boundary file above that root layout renders
|
|
103
|
+
* there too.
|
|
104
|
+
*/
|
|
105
|
+
export declare function resolveAppPageRootHttpAccessBoundaryTreePosition(routeSegments: readonly string[], layoutTreePositions: readonly number[], layoutTreePosition: number | undefined): number;
|
|
106
|
+
/**
|
|
107
|
+
* Resolves the nearest layout-aligned boundary before `layoutIndex`, falling
|
|
108
|
+
* back to the root module, and returns the layout index that owns it so
|
|
109
|
+
* callers can slice the layouts array to skip layouts below the boundary owner.
|
|
82
110
|
*
|
|
83
111
|
* `layoutIndex` is the per-layout index where the boundary lives, or `null` if
|
|
84
112
|
* the resolved boundary is the root module (which conceptually sits above all
|
|
@@ -98,4 +126,5 @@ export declare function resolveAppPageParentHttpAccessBoundary<TModule>(options:
|
|
|
98
126
|
export declare function resolveAppPageErrorBoundary<TModule, TComponent>(options: ResolveAppPageErrorBoundaryOptions<TModule, TComponent>): ResolveAppPageErrorBoundaryResult<TComponent>;
|
|
99
127
|
export declare function wrapAppPageBoundaryElement<TElement, TLayoutModule, TLayoutComponent, TChildSegments, TGlobalErrorComponent>(options: WrapAppPageBoundaryElementOptions<TElement, TLayoutModule, TLayoutComponent, TChildSegments, TGlobalErrorComponent>): TElement;
|
|
100
128
|
export declare function renderAppPageBoundaryResponse<TElement>(options: RenderAppPageBoundaryResponseOptions<TElement>): Promise<Response>;
|
|
101
|
-
//#endregion
|
|
129
|
+
//#endregion
|
|
130
|
+
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { VINEXT_RSC_VARY_HEADER } from "./app-rsc-vary.js";
|
|
2
2
|
import { runWithFetchDedupe } from "../shims/fetch-cache.js";
|
|
3
|
-
import { resolveAppPageSegmentParams } from "./app-page-params.js";
|
|
4
|
-
import { VINEXT_RSC_CONTENT_TYPE, applyRscCompatibilityIdHeader, applyRscDeploymentIdHeader } from "./app-rsc-cache-busting.js";
|
|
5
3
|
import { mergeMiddlewareResponseHeaders } from "./middleware-response-headers.js";
|
|
4
|
+
import { VINEXT_RSC_CONTENT_TYPE, applyRscCompatibilityIdHeader, applyRscDeploymentIdHeader } from "./app-rsc-cache-busting.js";
|
|
5
|
+
import { isAppPageRouteGroupSegment } from "./app-page-segment-state.js";
|
|
6
6
|
import { applyEdgeRuntimeHeader } from "./app-page-response.js";
|
|
7
|
+
import { resolveAppPageSegmentParams } from "./app-page-params.js";
|
|
7
8
|
//#region src/server/app-page-boundary.ts
|
|
8
9
|
function resolveAppPageHttpAccessBoundaryComponent(options) {
|
|
9
10
|
return options.getDefaultExport(resolveAppPageHttpAccessBoundaryModule({
|
|
@@ -23,13 +24,45 @@ function resolveAppPageHttpAccessBoundaryModule(options) {
|
|
|
23
24
|
else boundaryModule = options.routeNotFoundModule ?? options.rootNotFoundModule;
|
|
24
25
|
return boundaryModule ?? null;
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* The boundary that catches `notFound()` / `forbidden()` / `unauthorized()`
|
|
29
|
+
* thrown by a layout: the deepest segment boundary above the layout's own
|
|
30
|
+
* segment. A segment's boundary wraps its children inside its layout, so the
|
|
31
|
+
* layout's own boundary, and any below it, cannot catch the layout's error.
|
|
32
|
+
* Returns `null` when no segment above the layout has one (issue #4045).
|
|
33
|
+
*/
|
|
34
|
+
function resolveAppPageLayoutHttpAccessBoundary(options) {
|
|
35
|
+
for (let index = options.boundaryTreePositions.length - 1; index >= 0; index--) {
|
|
36
|
+
const treePosition = options.boundaryTreePositions[index];
|
|
37
|
+
const module = options.boundaryModules[index];
|
|
38
|
+
if (module && treePosition < options.layoutTreePosition) return {
|
|
39
|
+
module,
|
|
40
|
+
treePosition
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Tree position at which the root segment's boundary catches a layout's error.
|
|
47
|
+
* Next.js gives a first-layer route group the root segment's boundary (the
|
|
48
|
+
* custom file or the built-in page) when the group has none of its
|
|
49
|
+
* own, so the boundary renders inside the group's layout, which is often the
|
|
50
|
+
* root layout. Without `app/layout`, the root layout sits deeper (for example
|
|
51
|
+
* `app/[lang]/layout`), and the boundary renders inside it so the page keeps
|
|
52
|
+
* its `<html>` and `<body>`. A boundary file above that root layout renders
|
|
53
|
+
* there too.
|
|
54
|
+
*/
|
|
55
|
+
function resolveAppPageRootHttpAccessBoundaryTreePosition(routeSegments, layoutTreePositions, layoutTreePosition) {
|
|
56
|
+
if (layoutTreePosition === void 0) return 0;
|
|
57
|
+
const firstSegment = routeSegments[0];
|
|
58
|
+
const groupTreePosition = layoutTreePosition > 1 && firstSegment !== void 0 && isAppPageRouteGroupSegment(firstSegment) ? 1 : 0;
|
|
59
|
+
const rootLayoutTreePosition = layoutTreePositions[0] ?? 0;
|
|
60
|
+
return rootLayoutTreePosition < layoutTreePosition ? Math.max(groupTreePosition, rootLayoutTreePosition) : groupTreePosition;
|
|
28
61
|
}
|
|
29
62
|
/**
|
|
30
|
-
*
|
|
31
|
-
* the
|
|
32
|
-
* layouts array to skip
|
|
63
|
+
* Resolves the nearest layout-aligned boundary before `layoutIndex`, falling
|
|
64
|
+
* back to the root module, and returns the layout index that owns it so
|
|
65
|
+
* callers can slice the layouts array to skip layouts below the boundary owner.
|
|
33
66
|
*
|
|
34
67
|
* `layoutIndex` is the per-layout index where the boundary lives, or `null` if
|
|
35
68
|
* the resolved boundary is the root module (which conceptually sits above all
|
|
@@ -119,4 +152,4 @@ async function renderAppPageBoundaryResponse(options) {
|
|
|
119
152
|
return options.createHtmlResponse(rscStream, options.status);
|
|
120
153
|
}
|
|
121
154
|
//#endregion
|
|
122
|
-
export { renderAppPageBoundaryResponse, resolveAppPageErrorBoundary, resolveAppPageHttpAccessBoundaryComponent, resolveAppPageHttpAccessBoundaryModule, resolveAppPageParentHttpAccessBoundary,
|
|
155
|
+
export { renderAppPageBoundaryResponse, resolveAppPageErrorBoundary, resolveAppPageHttpAccessBoundaryComponent, resolveAppPageHttpAccessBoundaryModule, resolveAppPageLayoutHttpAccessBoundary, resolveAppPageParentHttpAccessBoundary, resolveAppPageRootHttpAccessBoundaryTreePosition, wrapAppPageBoundaryElement };
|
|
@@ -2,6 +2,7 @@ import { RenderObservation } from "./cache-proof.js";
|
|
|
2
2
|
import { AppRscRenderMode } from "./app-rsc-render-mode.js";
|
|
3
3
|
import { AppPageRenderObservationState } from "./app-page-render-observation.js";
|
|
4
4
|
import { AppPageCacheSetter } from "./isr-cache.js";
|
|
5
|
+
import { CdnAppPageDocument } from "../shims/cdn-cache.js";
|
|
5
6
|
import { AppPageRscRenderStatus } from "./app-page-rsc-render-status.js";
|
|
6
7
|
//#region src/server/app-page-cache-finalizer.d.ts
|
|
7
8
|
type AppPageDebugLogger = (event: string, detail: string) => void;
|
|
@@ -30,6 +31,8 @@ type FinalizeAppPageCacheabilityEvaluationOptions = {
|
|
|
30
31
|
/** An RSC render's status, from its document's shell. */
|
|
31
32
|
resolveRscRenderStatus?: () => Promise<AppPageRscRenderStatus>;
|
|
32
33
|
revalidateSeconds: number | null;
|
|
34
|
+
/** Hands the CDN adapter the page's document to store beside the response. */
|
|
35
|
+
captureAdmittedDocument?: (document: CdnAppPageDocument | null) => void;
|
|
33
36
|
};
|
|
34
37
|
type FinalizeAppPageHtmlCacheResponseOptions = {
|
|
35
38
|
bypassInterceptionContextCache?: boolean;
|
|
@@ -66,15 +69,20 @@ type FinalizeAppPageHtmlCacheResponseOptions = {
|
|
|
66
69
|
};
|
|
67
70
|
type ScheduleAppPageRscCacheWriteOptions = {
|
|
68
71
|
bypassInterceptionContextCache?: boolean;
|
|
72
|
+
/** Hands the CDN adapter the page's document to store beside the response. */
|
|
73
|
+
captureAdmittedDocument?: (document: CdnAppPageDocument | null) => void;
|
|
69
74
|
capturedRscDataPromise: Promise<ArrayBuffer> | null;
|
|
70
75
|
cleanPathname: string;
|
|
71
76
|
consumeDynamicUsage: () => boolean;
|
|
72
77
|
consumeRenderObservationState?: () => AppPageRenderObservationState;
|
|
78
|
+
/** Observes the document the render's status resolution rendered, if any. */
|
|
79
|
+
createHtmlRenderObservation?: BuildAppPageCacheRenderObservation;
|
|
73
80
|
createRscRenderObservation: BuildAppPageCacheRenderObservation;
|
|
74
81
|
dynamicUsedDuringBuild: boolean;
|
|
75
82
|
getPageTags: () => string[];
|
|
76
83
|
getRequestCacheLife?: () => AppPageRequestCacheLife | null;
|
|
77
84
|
isrDebug?: AppPageDebugLogger;
|
|
85
|
+
isrHtmlKey?: (pathname: string) => string;
|
|
78
86
|
isrRscKey: AppPageRscCacheKeyBuilder;
|
|
79
87
|
isrSet: AppPageCacheSetter;
|
|
80
88
|
interceptionContext?: string | null;
|
|
@@ -82,7 +90,10 @@ type ScheduleAppPageRscCacheWriteOptions = {
|
|
|
82
90
|
mountedSlotsHeader?: string | null;
|
|
83
91
|
omitPendingDynamicCacheState?: boolean;
|
|
84
92
|
renderMode?: AppRscRenderMode;
|
|
85
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* The render's status, from its document's shell, and the page's document
|
|
95
|
+
* when it rendered one to store. Without it the render is a 200.
|
|
96
|
+
*/
|
|
86
97
|
resolveRscRenderStatus?: () => Promise<AppPageRscRenderStatus>;
|
|
87
98
|
preserveClientResponseHeaders?: boolean;
|
|
88
99
|
expireSeconds?: number;
|
|
@@ -98,4 +109,5 @@ export declare function finalizeAppPageCacheabilityEvaluationResponse(response:
|
|
|
98
109
|
export declare function finalizeAppPageHtmlCacheResponse(response: Response, options: FinalizeAppPageHtmlCacheResponseOptions): Response;
|
|
99
110
|
export declare function finalizeAppPageRscCacheResponse(response: Response, options: ScheduleAppPageRscCacheWriteOptions): Response;
|
|
100
111
|
export declare function scheduleAppPageRscCacheWrite(options: ScheduleAppPageRscCacheWriteOptions): boolean;
|
|
101
|
-
//#endregion
|
|
112
|
+
//#endregion
|
|
113
|
+
export {};
|