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,6 +1,5 @@
|
|
|
1
1
|
import { ArtifactCompatibilityEnvelope } from "./artifact-compatibility.js";
|
|
2
2
|
import { CacheEntryReuseProof } from "./cache-proof.js";
|
|
3
|
-
import { ClientReuseManifestSkipDisposition } from "./client-reuse-manifest.js";
|
|
4
3
|
import { BfcacheSegmentIdentity } from "./bfcache-identity.js";
|
|
5
4
|
import { compareStrings } from "../utils/compare.js";
|
|
6
5
|
import { AppElementsWireElementKey } from "./app-elements-wire-key.js";
|
|
@@ -12,7 +11,6 @@ export declare const APP_DYNAMIC_STALE_TIME_KEY = "__dynamicStaleTime";
|
|
|
12
11
|
export declare const APP_INTERCEPTION_KEY = "__interception";
|
|
13
12
|
export declare const APP_INTERCEPTION_CONTEXT_KEY = "__interceptionContext";
|
|
14
13
|
export declare const APP_LAYOUT_IDS_KEY = "__layoutIds";
|
|
15
|
-
export declare const APP_LAYOUT_FLAGS_KEY = "__layoutFlags";
|
|
16
14
|
export declare const APP_ROUTE_KEY = "__route";
|
|
17
15
|
export declare const APP_ROOT_LAYOUT_KEY = "__rootLayout";
|
|
18
16
|
export declare const APP_SKIPPED_LAYOUT_IDS_KEY = "__skippedLayoutIds";
|
|
@@ -51,28 +49,10 @@ export declare const compareAppElementsSlotIds: typeof compareStrings;
|
|
|
51
49
|
export declare function normalizeAppElementsSlotBindings(slotBindings: readonly AppElementsSlotBinding[], options?: {
|
|
52
50
|
layoutIds?: readonly string[];
|
|
53
51
|
}): readonly AppElementsSlotBinding[];
|
|
54
|
-
export type AppElementValue = ReactNode | typeof UNMATCHED_SLOT | string | null |
|
|
55
|
-
type AppWireElementValue = ReactNode | string | null |
|
|
52
|
+
export type AppElementValue = ReactNode | typeof UNMATCHED_SLOT | string | null | AppElementsBfcacheSegmentIdentities | ArtifactCompatibilityEnvelope | CacheEntryReuseProof | AppElementsInterception | readonly string[] | readonly AppElementsSlotBinding[];
|
|
53
|
+
type AppWireElementValue = ReactNode | string | null | AppElementsBfcacheSegmentIdentities | ArtifactCompatibilityEnvelope | CacheEntryReuseProof | AppElementsInterception | readonly string[] | readonly AppElementsSlotBinding[];
|
|
56
54
|
export type AppElements = Readonly<Record<string, AppElementValue>>;
|
|
57
55
|
export type AppWireElements = Readonly<Record<string, AppWireElementValue>>;
|
|
58
|
-
/**
|
|
59
|
-
* Per-layout static/dynamic flags. `"s"` = static (skippable on next nav);
|
|
60
|
-
* `"d"` = dynamic (must always render).
|
|
61
|
-
*
|
|
62
|
-
* Lifecycle (partial — later PRs extend this):
|
|
63
|
-
*
|
|
64
|
-
* 1. PROBE — probeAppPageLayouts (server/app-page-execution.ts) returns
|
|
65
|
-
* LayoutFlags for every layout in the route at render time.
|
|
66
|
-
*
|
|
67
|
-
* 2. ATTACH — AppElementsWire.encodeOutgoingPayload writes `__layoutFlags`
|
|
68
|
-
* into the outgoing App Router payload record.
|
|
69
|
-
*
|
|
70
|
-
* 3. WIRE — renderToReadableStream serializes the record as RSC row 0.
|
|
71
|
-
*
|
|
72
|
-
* 4. PARSE — AppElementsWire.readMetadata extracts layoutFlags from the
|
|
73
|
-
* wire payload on the client side.
|
|
74
|
-
*/
|
|
75
|
-
export type LayoutFlags = Readonly<Record<string, "s" | "d">>;
|
|
76
56
|
export type AppElementsBfcacheSegmentIdentities = Readonly<Record<string, BfcacheSegmentIdentity>>;
|
|
77
57
|
type AppElementsMetadata = {
|
|
78
58
|
artifactCompatibility: ArtifactCompatibilityEnvelope;
|
|
@@ -81,7 +61,6 @@ type AppElementsMetadata = {
|
|
|
81
61
|
interception: AppElementsInterception | null;
|
|
82
62
|
interceptionContext: string | null;
|
|
83
63
|
layoutIds: readonly string[];
|
|
84
|
-
layoutFlags: LayoutFlags;
|
|
85
64
|
routeId: string;
|
|
86
65
|
rootLayoutTreePath: string | null;
|
|
87
66
|
bfcacheSegmentIdentities: AppElementsBfcacheSegmentIdentities;
|
|
@@ -113,11 +92,11 @@ type AppElementsWireMetadataEntries = Readonly<{
|
|
|
113
92
|
}>;
|
|
114
93
|
/**
|
|
115
94
|
* The outgoing wire payload shape. Includes ReactNode values for the
|
|
116
|
-
* rendered tree plus metadata values
|
|
117
|
-
*
|
|
95
|
+
* rendered tree plus metadata values attached under known keys (e.g.
|
|
96
|
+
* __artifactCompatibility). Distinct from AppElements / AppWireElements
|
|
118
97
|
* which only carry render-time values.
|
|
119
98
|
*/
|
|
120
|
-
export type AppOutgoingElements = Readonly<Record<string, ReactNode |
|
|
99
|
+
export type AppOutgoingElements = Readonly<Record<string, ReactNode | AppElementsBfcacheSegmentIdentities | ArtifactCompatibilityEnvelope | CacheEntryReuseProof | AppElementsInterception | number | readonly string[] | readonly AppElementsSlotBinding[]>>;
|
|
121
100
|
type AppElementsWireKeys = {
|
|
122
101
|
readonly artifactCompatibility: typeof APP_ARTIFACT_COMPATIBILITY_KEY;
|
|
123
102
|
readonly cacheEntryReuseProof: typeof APP_CACHE_ENTRY_REUSE_PROOF_KEY;
|
|
@@ -125,7 +104,6 @@ type AppElementsWireKeys = {
|
|
|
125
104
|
readonly interception: typeof APP_INTERCEPTION_KEY;
|
|
126
105
|
readonly interceptionContext: typeof APP_INTERCEPTION_CONTEXT_KEY;
|
|
127
106
|
readonly layoutIds: typeof APP_LAYOUT_IDS_KEY;
|
|
128
|
-
readonly layoutFlags: typeof APP_LAYOUT_FLAGS_KEY;
|
|
129
107
|
readonly rootLayout: typeof APP_ROOT_LAYOUT_KEY;
|
|
130
108
|
readonly route: typeof APP_ROUTE_KEY;
|
|
131
109
|
readonly bfcacheSegmentIdentities: typeof APP_BFCACHE_SEGMENT_IDENTITIES_KEY;
|
|
@@ -145,8 +123,6 @@ type AppElementsWireCodec = {
|
|
|
145
123
|
artifactCompatibility?: ArtifactCompatibilityEnvelope;
|
|
146
124
|
cacheEntryReuseProof?: CacheEntryReuseProof;
|
|
147
125
|
dynamicStaleTimeSeconds?: number;
|
|
148
|
-
layoutFlags: LayoutFlags;
|
|
149
|
-
skipDisposition?: ClientReuseManifestSkipDisposition;
|
|
150
126
|
}): ReactNode | AppOutgoingElements;
|
|
151
127
|
encodePageId(routePath: string, interceptionContext: string | null): string;
|
|
152
128
|
encodeRouteId(routePath: string, interceptionContext: string | null): string;
|
|
@@ -155,9 +131,6 @@ type AppElementsWireCodec = {
|
|
|
155
131
|
isSlotId(key: string): boolean;
|
|
156
132
|
parseElementKey(key: string): AppElementsWireElementKey | null;
|
|
157
133
|
readMetadata(elements: Readonly<Record<string, unknown>>): AppElementsMetadata;
|
|
158
|
-
withLayoutFlags<T extends Record<string, unknown>>(elements: T, layoutFlags: LayoutFlags): T & {
|
|
159
|
-
[APP_LAYOUT_FLAGS_KEY]: LayoutFlags;
|
|
160
|
-
};
|
|
161
134
|
};
|
|
162
135
|
export declare function normalizeAppElements(elements: AppWireElements): AppElements;
|
|
163
136
|
/**
|
|
@@ -165,22 +138,18 @@ export declare function normalizeAppElements(elements: AppWireElements): AppElem
|
|
|
165
138
|
* Used to distinguish the App Router payload object from bare React elements at
|
|
166
139
|
* the render boundary. Narrows to `Readonly<Record<string, unknown>>` because
|
|
167
140
|
* the outgoing payload carries heterogeneous values (ReactNodes for the rendered
|
|
168
|
-
* tree, plus metadata like `
|
|
141
|
+
* tree, plus metadata like `__artifactCompatibility`, a plain object). Delegates
|
|
169
142
|
* to React's canonical `isValidElement` so we don't depend on React's internal
|
|
170
143
|
* `$$typeof` marker scheme.
|
|
171
144
|
*/
|
|
172
145
|
export declare function isAppElementsRecord(value: unknown): value is Readonly<Record<string, unknown>>;
|
|
173
|
-
export declare function withLayoutFlags<T extends Record<string, unknown>>(elements: T, layoutFlags: LayoutFlags): T & {
|
|
174
|
-
[APP_LAYOUT_FLAGS_KEY]: LayoutFlags;
|
|
175
|
-
};
|
|
176
146
|
export declare function buildOutgoingAppPayload(input: {
|
|
177
147
|
element: ReactNode | AppElements;
|
|
178
148
|
artifactCompatibility?: ArtifactCompatibilityEnvelope;
|
|
179
149
|
cacheEntryReuseProof?: CacheEntryReuseProof;
|
|
180
150
|
dynamicStaleTimeSeconds?: number;
|
|
181
|
-
layoutFlags: LayoutFlags;
|
|
182
|
-
skipDisposition?: ClientReuseManifestSkipDisposition;
|
|
183
151
|
}): ReactNode | AppOutgoingElements;
|
|
184
152
|
export declare function readAppElementsMetadata(elements: Readonly<Record<string, unknown>>): AppElementsMetadata;
|
|
185
153
|
export declare const AppElementsWire: AppElementsWireCodec;
|
|
186
|
-
//#endregion
|
|
154
|
+
//#endregion
|
|
155
|
+
export {};
|
|
@@ -3,7 +3,6 @@ import { compareStrings } from "../utils/compare.js";
|
|
|
3
3
|
import { isInterceptionMatchedUrlPath } from "./normalize-path.js";
|
|
4
4
|
import { createAppElementsWireSlotId, isAppElementsWireSlotId, parseAppElementsWireElementKey } from "./app-elements-wire-key.js";
|
|
5
5
|
import { createArtifactCompatibilityEnvelope, parseArtifactCompatibilityEnvelope } from "./artifact-compatibility.js";
|
|
6
|
-
import { releaseAppElementRenderDependency } from "./app-render-dependency.js";
|
|
7
6
|
import { isValidElement } from "react";
|
|
8
7
|
//#region src/server/app-elements-wire.ts
|
|
9
8
|
const APP_INTERCEPTION_SEPARATOR = "\0";
|
|
@@ -14,7 +13,6 @@ const APP_DYNAMIC_STALE_TIME_KEY = "__dynamicStaleTime";
|
|
|
14
13
|
const APP_INTERCEPTION_KEY = "__interception";
|
|
15
14
|
const APP_INTERCEPTION_CONTEXT_KEY = "__interceptionContext";
|
|
16
15
|
const APP_LAYOUT_IDS_KEY = "__layoutIds";
|
|
17
|
-
const APP_LAYOUT_FLAGS_KEY = "__layoutFlags";
|
|
18
16
|
const APP_ROUTE_KEY = "__route";
|
|
19
17
|
const APP_ROOT_LAYOUT_KEY = "__rootLayout";
|
|
20
18
|
const APP_SKIPPED_LAYOUT_IDS_KEY = "__skippedLayoutIds";
|
|
@@ -33,7 +31,6 @@ const APP_BFCACHE_SEGMENT_IDENTITIES_KEY = "__bfcacheSegmentIdentities";
|
|
|
33
31
|
const APP_STATIC_SIBLINGS_KEY = "__staticSiblings";
|
|
34
32
|
const APP_UNMATCHED_SLOT_WIRE_VALUE = "__VINEXT_UNMATCHED_SLOT__";
|
|
35
33
|
const UNMATCHED_SLOT = Symbol.for("vinext.unmatchedSlot");
|
|
36
|
-
const EMPTY_SKIPPED_LAYOUT_IDS = /* @__PURE__ */ new Set();
|
|
37
34
|
function createCacheProofRejectionCodeSet(codes) {
|
|
38
35
|
return new Set(codes);
|
|
39
36
|
}
|
|
@@ -147,15 +144,6 @@ function normalizeAppElements(elements) {
|
|
|
147
144
|
for (const [key, value] of Object.entries(elements)) normalized[key] = isAppElementsWireSlotId(key) && value === "__VINEXT_UNMATCHED_SLOT__" ? UNMATCHED_SLOT : value;
|
|
148
145
|
return normalized;
|
|
149
146
|
}
|
|
150
|
-
function isLayoutFlagsRecord(value) {
|
|
151
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
152
|
-
for (const v of Object.values(value)) if (v !== "s" && v !== "d") return false;
|
|
153
|
-
return true;
|
|
154
|
-
}
|
|
155
|
-
function parseLayoutFlags(value) {
|
|
156
|
-
if (isLayoutFlagsRecord(value)) return value;
|
|
157
|
-
return {};
|
|
158
|
-
}
|
|
159
147
|
function parseLayoutIdList(value, fieldName) {
|
|
160
148
|
if (value === void 0) return [];
|
|
161
149
|
if (!Array.isArray(value)) throw new Error(`[vinext] Invalid ${fieldName} in App Router payload: expected layout id string[]`);
|
|
@@ -242,7 +230,7 @@ function parseInterceptionMetadata(value) {
|
|
|
242
230
|
* Used to distinguish the App Router payload object from bare React elements at
|
|
243
231
|
* the render boundary. Narrows to `Readonly<Record<string, unknown>>` because
|
|
244
232
|
* the outgoing payload carries heterogeneous values (ReactNodes for the rendered
|
|
245
|
-
* tree, plus metadata like `
|
|
233
|
+
* tree, plus metadata like `__artifactCompatibility`, a plain object). Delegates
|
|
246
234
|
* to React's canonical `isValidElement` so we don't depend on React's internal
|
|
247
235
|
* `$$typeof` marker scheme.
|
|
248
236
|
*/
|
|
@@ -252,36 +240,15 @@ function isAppElementsRecord(value) {
|
|
|
252
240
|
if (isValidElement(value)) return false;
|
|
253
241
|
return true;
|
|
254
242
|
}
|
|
255
|
-
function withLayoutFlags(elements, layoutFlags) {
|
|
256
|
-
return {
|
|
257
|
-
...elements,
|
|
258
|
-
[APP_LAYOUT_FLAGS_KEY]: layoutFlags
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
243
|
function buildOutgoingAppPayload(input) {
|
|
262
244
|
if (!isAppElementsRecord(input.element)) return input.element;
|
|
263
|
-
const skippedLayoutIds = createSkippedLayoutIds(input.skipDisposition);
|
|
264
245
|
const payload = {};
|
|
265
|
-
for (const [key, value] of Object.entries(input.element))
|
|
266
|
-
if (skippedLayoutIds.has(key)) {
|
|
267
|
-
releaseAppElementRenderDependency(input.element, key);
|
|
268
|
-
continue;
|
|
269
|
-
}
|
|
270
|
-
payload[key] = value === UNMATCHED_SLOT ? APP_UNMATCHED_SLOT_WIRE_VALUE : value;
|
|
271
|
-
}
|
|
272
|
-
payload[APP_LAYOUT_FLAGS_KEY] = input.layoutFlags;
|
|
273
|
-
if (skippedLayoutIds.size > 0) payload[APP_SKIPPED_LAYOUT_IDS_KEY] = [...skippedLayoutIds];
|
|
246
|
+
for (const [key, value] of Object.entries(input.element)) payload[key] = value === UNMATCHED_SLOT ? APP_UNMATCHED_SLOT_WIRE_VALUE : value;
|
|
274
247
|
payload[APP_ARTIFACT_COMPATIBILITY_KEY] = input.artifactCompatibility ?? createArtifactCompatibilityEnvelope();
|
|
275
248
|
if (input.cacheEntryReuseProof) payload[APP_CACHE_ENTRY_REUSE_PROOF_KEY] = input.cacheEntryReuseProof;
|
|
276
249
|
if (input.dynamicStaleTimeSeconds !== void 0) payload[APP_DYNAMIC_STALE_TIME_KEY] = input.dynamicStaleTimeSeconds;
|
|
277
250
|
return payload;
|
|
278
251
|
}
|
|
279
|
-
function createSkippedLayoutIds(skipDisposition) {
|
|
280
|
-
if (skipDisposition?.enabled !== true) return EMPTY_SKIPPED_LAYOUT_IDS;
|
|
281
|
-
const skippedLayoutIds = /* @__PURE__ */ new Set();
|
|
282
|
-
for (const id of skipDisposition.skippedEntryIds) if (parseAppElementsWireElementKey(id)?.kind === "layout") skippedLayoutIds.add(id);
|
|
283
|
-
return skippedLayoutIds;
|
|
284
|
-
}
|
|
285
252
|
function readArtifactCompatibilityMetadata(value) {
|
|
286
253
|
if (value === void 0) return createArtifactCompatibilityEnvelope();
|
|
287
254
|
return parseArtifactCompatibilityEnvelope(value) ?? createArtifactCompatibilityEnvelope();
|
|
@@ -351,7 +318,6 @@ function readAppElementsMetadata(elements) {
|
|
|
351
318
|
const rootLayoutTreePath = elements[APP_ROOT_LAYOUT_KEY];
|
|
352
319
|
if (rootLayoutTreePath === void 0) throw new Error("[vinext] Missing __rootLayout key in App Router payload");
|
|
353
320
|
if (rootLayoutTreePath !== null && typeof rootLayoutTreePath !== "string") throw new Error("[vinext] Invalid __rootLayout in App Router payload: expected string or null");
|
|
354
|
-
const layoutFlags = parseLayoutFlags(elements[APP_LAYOUT_FLAGS_KEY]);
|
|
355
321
|
const layoutIds = parseLayoutIds(elements[APP_LAYOUT_IDS_KEY]);
|
|
356
322
|
const skippedLayoutIds = parseSkippedLayoutIds(elements[APP_SKIPPED_LAYOUT_IDS_KEY]);
|
|
357
323
|
const slotBindings = parseSlotBindings(elements[APP_SLOT_BINDINGS_KEY], { layoutIds });
|
|
@@ -369,7 +335,6 @@ function readAppElementsMetadata(elements) {
|
|
|
369
335
|
interception,
|
|
370
336
|
interceptionContext: interceptionContext ?? null,
|
|
371
337
|
layoutIds,
|
|
372
|
-
layoutFlags,
|
|
373
338
|
routeId,
|
|
374
339
|
rootLayoutTreePath,
|
|
375
340
|
bfcacheSegmentIdentities,
|
|
@@ -386,7 +351,6 @@ const AppElementsWire = {
|
|
|
386
351
|
interception: APP_INTERCEPTION_KEY,
|
|
387
352
|
interceptionContext: APP_INTERCEPTION_CONTEXT_KEY,
|
|
388
353
|
layoutIds: APP_LAYOUT_IDS_KEY,
|
|
389
|
-
layoutFlags: APP_LAYOUT_FLAGS_KEY,
|
|
390
354
|
rootLayout: APP_ROOT_LAYOUT_KEY,
|
|
391
355
|
route: APP_ROUTE_KEY,
|
|
392
356
|
bfcacheSegmentIdentities: APP_BFCACHE_SEGMENT_IDENTITIES_KEY,
|
|
@@ -406,8 +370,7 @@ const AppElementsWire = {
|
|
|
406
370
|
encodeTemplateId: createAppPayloadTemplateId,
|
|
407
371
|
isSlotId: isAppElementsWireSlotId,
|
|
408
372
|
parseElementKey: parseAppElementsWireElementKey,
|
|
409
|
-
readMetadata: readAppElementsMetadata
|
|
410
|
-
withLayoutFlags
|
|
373
|
+
readMetadata: readAppElementsMetadata
|
|
411
374
|
};
|
|
412
375
|
//#endregion
|
|
413
|
-
export { APP_ARTIFACT_COMPATIBILITY_KEY, APP_BFCACHE_SEGMENT_IDENTITIES_KEY, APP_CACHE_ENTRY_REUSE_PROOF_KEY, APP_DYNAMIC_STALE_TIME_KEY, APP_INTERCEPTION_CONTEXT_KEY, APP_INTERCEPTION_KEY,
|
|
376
|
+
export { APP_ARTIFACT_COMPATIBILITY_KEY, APP_BFCACHE_SEGMENT_IDENTITIES_KEY, APP_CACHE_ENTRY_REUSE_PROOF_KEY, APP_DYNAMIC_STALE_TIME_KEY, APP_INTERCEPTION_CONTEXT_KEY, APP_INTERCEPTION_KEY, APP_LAYOUT_IDS_KEY, APP_ROOT_LAYOUT_KEY, APP_ROUTE_KEY, APP_SKIPPED_LAYOUT_IDS_KEY, APP_SLOT_BINDINGS_KEY, APP_SOURCE_PAGE_SEGMENTS_KEY, APP_STATIC_SIBLINGS_KEY, APP_UNMATCHED_SLOT_WIRE_VALUE, AppElementsWire, UNMATCHED_SLOT, buildOutgoingAppPayload, compareAppElementsSlotIds, isAppElementsRecord, normalizeAppElements, normalizeAppElementsSlotBindings, readAppElementsMetadata };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { APP_ARTIFACT_COMPATIBILITY_KEY, APP_BFCACHE_SEGMENT_IDENTITIES_KEY, APP_CACHE_ENTRY_REUSE_PROOF_KEY, APP_DYNAMIC_STALE_TIME_KEY, APP_INTERCEPTION_CONTEXT_KEY, APP_INTERCEPTION_KEY,
|
|
1
|
+
import { APP_ARTIFACT_COMPATIBILITY_KEY, APP_BFCACHE_SEGMENT_IDENTITIES_KEY, APP_CACHE_ENTRY_REUSE_PROOF_KEY, APP_DYNAMIC_STALE_TIME_KEY, APP_INTERCEPTION_CONTEXT_KEY, APP_INTERCEPTION_KEY, APP_LAYOUT_IDS_KEY, APP_ROOT_LAYOUT_KEY, APP_ROUTE_KEY, APP_SKIPPED_LAYOUT_IDS_KEY, APP_SLOT_BINDINGS_KEY, APP_SOURCE_PAGE_SEGMENTS_KEY, APP_STATIC_SIBLINGS_KEY, APP_UNMATCHED_SLOT_WIRE_VALUE, AppElementValue, AppElements, AppElementsBfcacheSegmentIdentities, AppElementsInterception, AppElementsSlotBinding, AppElementsWire, AppOutgoingElements, AppWireElements, UNMATCHED_SLOT, buildOutgoingAppPayload, compareAppElementsSlotIds, isAppElementsRecord, normalizeAppElements, normalizeAppElementsSlotBindings, readAppElementsMetadata } from "./app-elements-wire.js";
|
|
2
2
|
//#region src/server/app-elements.d.ts
|
|
3
3
|
export declare const APP_PREFETCH_LOADING_SHELL_MARKER_KEY = "__prefetchLoadingShell";
|
|
4
|
+
/** Prefix of the element that streams a route's generateMetadata() tags in the body. */
|
|
5
|
+
export declare const APP_STREAMING_METADATA_BODY_ID_PREFIX = "__vinext_streaming_metadata_body:";
|
|
4
6
|
export declare function getMountedSlotIds(elements: AppElements): string[];
|
|
5
7
|
export declare function getMountedSlotIdsHeader(elements: AppElements): string | null;
|
|
6
8
|
export declare function resolveVisitedResponseInterceptionContext(requestInterceptionContext: string | null, payloadInterceptionContext: string | null): string | null;
|
|
7
9
|
//#endregion
|
|
8
|
-
export { APP_ARTIFACT_COMPATIBILITY_KEY, APP_BFCACHE_SEGMENT_IDENTITIES_KEY, APP_CACHE_ENTRY_REUSE_PROOF_KEY, APP_DYNAMIC_STALE_TIME_KEY, APP_INTERCEPTION_CONTEXT_KEY, APP_INTERCEPTION_KEY,
|
|
10
|
+
export { APP_ARTIFACT_COMPATIBILITY_KEY, APP_BFCACHE_SEGMENT_IDENTITIES_KEY, APP_CACHE_ENTRY_REUSE_PROOF_KEY, APP_DYNAMIC_STALE_TIME_KEY, APP_INTERCEPTION_CONTEXT_KEY, APP_INTERCEPTION_KEY, APP_LAYOUT_IDS_KEY, APP_ROOT_LAYOUT_KEY, APP_ROUTE_KEY, APP_SKIPPED_LAYOUT_IDS_KEY, APP_SLOT_BINDINGS_KEY, APP_SOURCE_PAGE_SEGMENTS_KEY, APP_STATIC_SIBLINGS_KEY, APP_UNMATCHED_SLOT_WIRE_VALUE, type AppElementValue, type AppElements, type AppElementsBfcacheSegmentIdentities, type AppElementsInterception, type AppElementsSlotBinding, AppElementsWire, type AppOutgoingElements, type AppWireElements, UNMATCHED_SLOT, buildOutgoingAppPayload, compareAppElementsSlotIds, isAppElementsRecord, normalizeAppElements, normalizeAppElementsSlotBindings, readAppElementsMetadata };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { normalizeMountedSlotsHeader } from "./app-mounted-slots-header.js";
|
|
2
|
-
import { APP_ARTIFACT_COMPATIBILITY_KEY, APP_BFCACHE_SEGMENT_IDENTITIES_KEY, APP_CACHE_ENTRY_REUSE_PROOF_KEY, APP_DYNAMIC_STALE_TIME_KEY, APP_INTERCEPTION_CONTEXT_KEY, APP_INTERCEPTION_KEY,
|
|
2
|
+
import { APP_ARTIFACT_COMPATIBILITY_KEY, APP_BFCACHE_SEGMENT_IDENTITIES_KEY, APP_CACHE_ENTRY_REUSE_PROOF_KEY, APP_DYNAMIC_STALE_TIME_KEY, APP_INTERCEPTION_CONTEXT_KEY, APP_INTERCEPTION_KEY, APP_LAYOUT_IDS_KEY, APP_ROOT_LAYOUT_KEY, APP_ROUTE_KEY, APP_SKIPPED_LAYOUT_IDS_KEY, APP_SLOT_BINDINGS_KEY, APP_SOURCE_PAGE_SEGMENTS_KEY, APP_STATIC_SIBLINGS_KEY, APP_UNMATCHED_SLOT_WIRE_VALUE, AppElementsWire, UNMATCHED_SLOT, buildOutgoingAppPayload, compareAppElementsSlotIds, isAppElementsRecord, normalizeAppElements, normalizeAppElementsSlotBindings, readAppElementsMetadata } from "./app-elements-wire.js";
|
|
3
3
|
//#region src/server/app-elements.ts
|
|
4
4
|
const APP_PREFETCH_LOADING_SHELL_MARKER_KEY = "__prefetchLoadingShell";
|
|
5
|
+
/** Prefix of the element that streams a route's generateMetadata() tags in the body. */
|
|
6
|
+
const APP_STREAMING_METADATA_BODY_ID_PREFIX = "__vinext_streaming_metadata_body:";
|
|
5
7
|
function getMountedSlotIds(elements) {
|
|
6
8
|
return Object.keys(elements).filter((key) => {
|
|
7
9
|
const value = elements[key];
|
|
@@ -16,4 +18,4 @@ function resolveVisitedResponseInterceptionContext(requestInterceptionContext, p
|
|
|
16
18
|
return payloadInterceptionContext ?? requestInterceptionContext;
|
|
17
19
|
}
|
|
18
20
|
//#endregion
|
|
19
|
-
export { APP_ARTIFACT_COMPATIBILITY_KEY, APP_BFCACHE_SEGMENT_IDENTITIES_KEY, APP_CACHE_ENTRY_REUSE_PROOF_KEY, APP_DYNAMIC_STALE_TIME_KEY, APP_INTERCEPTION_CONTEXT_KEY, APP_INTERCEPTION_KEY,
|
|
21
|
+
export { APP_ARTIFACT_COMPATIBILITY_KEY, APP_BFCACHE_SEGMENT_IDENTITIES_KEY, APP_CACHE_ENTRY_REUSE_PROOF_KEY, APP_DYNAMIC_STALE_TIME_KEY, APP_INTERCEPTION_CONTEXT_KEY, APP_INTERCEPTION_KEY, APP_LAYOUT_IDS_KEY, APP_PREFETCH_LOADING_SHELL_MARKER_KEY, APP_ROOT_LAYOUT_KEY, APP_ROUTE_KEY, APP_SKIPPED_LAYOUT_IDS_KEY, APP_SLOT_BINDINGS_KEY, APP_SOURCE_PAGE_SEGMENTS_KEY, APP_STATIC_SIBLINGS_KEY, APP_STREAMING_METADATA_BODY_ID_PREFIX, APP_UNMATCHED_SLOT_WIRE_VALUE, AppElementsWire, UNMATCHED_SLOT, buildOutgoingAppPayload, compareAppElementsSlotIds, getMountedSlotIds, getMountedSlotIdsHeader, isAppElementsRecord, normalizeAppElements, normalizeAppElementsSlotBindings, readAppElementsMetadata, resolveVisitedResponseInterceptionContext };
|
|
@@ -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 { AppPageInterceptOptions } from "./app-page-element-builder.js";
|
|
11
11
|
import { AppPageSsrHandler } from "./app-page-stream.js";
|
|
12
12
|
import { AppRenderErrorContextOverrides } from "./app-rsc-error-handler.js";
|
|
@@ -95,13 +95,20 @@ type AppFallbackRenderer<TModule extends AppPageModule = AppPageModule> = {
|
|
|
95
95
|
renderHttpAccessFallback: (route: AppPageBoundaryRoute<TModule> | null, statusCode: number, isRscRequest: boolean, request: Request, opts: {
|
|
96
96
|
boundaryComponent?: AppPageComponent | null;
|
|
97
97
|
boundaryModule?: TModule | null;
|
|
98
|
+
/** Boundary whose metadata the head uses, when not `boundaryModule`. */
|
|
99
|
+
headBoundaryModule?: TModule | null;
|
|
100
|
+
/** Layouts whose metadata the head uses, when more than `layouts`. */
|
|
101
|
+
headLayouts?: readonly (TModule | null | undefined)[] | null;
|
|
98
102
|
intercept?: AppPageInterceptOptions<TModule> | null;
|
|
99
103
|
/** The document may be stored, so it must not carry the request's query. */
|
|
100
104
|
isCacheCandidate?: boolean;
|
|
101
105
|
layouts?: readonly (TModule | null | undefined)[] | null;
|
|
102
106
|
matchedParams?: AppPageParams;
|
|
107
|
+
/** The route's render threw the signal, so the document keeps the route's head. */
|
|
108
|
+
routeHead?: AppPageFallbackRouteHead | null;
|
|
103
109
|
}, scriptNonce: string | undefined, middlewareContext: AppPageMiddlewareContext, callContext?: AppFallbackRendererCallContext) => Promise<Response | null>;
|
|
104
110
|
renderNotFound: (route: AppPageBoundaryRoute<TModule> | null, isRscRequest: boolean, request: Request, matchedParams: AppPageParams | undefined, scriptNonce: string | undefined, middlewareContext: AppPageMiddlewareContext, callContext?: AppFallbackRendererCallContext) => Promise<Response | null>;
|
|
105
111
|
};
|
|
106
112
|
export declare function createAppFallbackRenderer<TModule extends AppPageModule>(options: AppFallbackRendererOptions<TModule>): AppFallbackRenderer<TModule>;
|
|
107
|
-
//#endregion
|
|
113
|
+
//#endregion
|
|
114
|
+
export {};
|
|
@@ -4,7 +4,7 @@ import { DEFAULT_GLOBAL_ERROR_MODULE } from "./default-global-error-module.js";
|
|
|
4
4
|
import { shouldServeStreamingMetadata } from "./streaming-metadata.js";
|
|
5
5
|
import { renderAppPageErrorBoundary, renderAppPageHttpAccessFallback } from "./app-page-boundary-render.js";
|
|
6
6
|
import { DEFAULT_GLOBAL_NOT_FOUND_MODULE } from "./default-global-not-found-module.js";
|
|
7
|
-
import { DEFAULT_NOT_FOUND_MODULE } from "./default-
|
|
7
|
+
import { DEFAULT_NOT_FOUND_MODULE } from "./default-http-access-fallback-modules.js";
|
|
8
8
|
//#region src/server/app-fallback-renderer.ts
|
|
9
9
|
const EMPTY_MW_CTX = {
|
|
10
10
|
headers: null,
|
|
@@ -86,6 +86,8 @@ function createAppFallbackRenderer(options) {
|
|
|
86
86
|
getAndClearPendingCookies,
|
|
87
87
|
getNavigationContext,
|
|
88
88
|
globalErrorModule: effectiveGlobalErrorModule,
|
|
89
|
+
headBoundaryModule: opts?.headBoundaryModule ?? null,
|
|
90
|
+
headLayoutModules: useGlobalNotFound ? [] : opts?.headLayouts ?? null,
|
|
89
91
|
intercept: opts?.intercept ?? null,
|
|
90
92
|
isCacheCandidate: opts?.isCacheCandidate,
|
|
91
93
|
isEdgeRuntime: callContext?.isEdgeRuntime,
|
|
@@ -104,6 +106,7 @@ function createAppFallbackRenderer(options) {
|
|
|
104
106
|
rootNotFoundModule: routeMissRootNotFoundModule,
|
|
105
107
|
rootUnauthorizedModule,
|
|
106
108
|
route: useGlobalNotFound ? null : route,
|
|
109
|
+
routeHead: opts?.routeHead ?? null,
|
|
107
110
|
routePathname: callContext?.routePathname,
|
|
108
111
|
renderToReadableStream: rscRenderer,
|
|
109
112
|
scriptNonce,
|
|
@@ -75,11 +75,11 @@ export declare function isExternalHistoryState(state: unknown): boolean;
|
|
|
75
75
|
*/
|
|
76
76
|
export declare function isAppOwnedHistoryState(state: unknown): boolean;
|
|
77
77
|
export declare function createAppOwnedHistoryState(state: unknown): unknown;
|
|
78
|
-
export declare function createHistoryStateWithTreeSnapshotId(state: unknown, treeSnapshotId:
|
|
78
|
+
export declare function createHistoryStateWithTreeSnapshotId(state: unknown, treeSnapshotId: string | null): unknown;
|
|
79
79
|
export declare function createHistoryStateWithTreeSnapshotClaim(state: unknown, claimed: boolean): unknown;
|
|
80
80
|
export declare function isHistoryStateTreeSnapshotClaimed(state: unknown): boolean;
|
|
81
81
|
export declare function clearHistoryStateTreeSnapshotId(state: unknown): unknown;
|
|
82
|
-
export declare function readHistoryStateTreeSnapshotId(state: unknown):
|
|
82
|
+
export declare function readHistoryStateTreeSnapshotId(state: unknown): string | null;
|
|
83
83
|
export declare function readHistoryStateActiveRoutePaths(state: unknown): readonly string[] | null;
|
|
84
84
|
export declare function resolveActiveRoutePaths(slotBindings: readonly {
|
|
85
85
|
activeRouteId?: string | null;
|
|
@@ -104,4 +104,5 @@ export declare function resolveHistoryTraversalIntent(options: {
|
|
|
104
104
|
currentHistoryIndex: number | null;
|
|
105
105
|
historyState: unknown;
|
|
106
106
|
}): HistoryTraversalIntent;
|
|
107
|
-
//#endregion
|
|
107
|
+
//#endregion
|
|
108
|
+
export {};
|
|
@@ -210,7 +210,7 @@ function createAppOwnedHistoryState(state) {
|
|
|
210
210
|
function createHistoryStateWithTreeSnapshotId(state, treeSnapshotId) {
|
|
211
211
|
const nextState = cloneHistoryState(state);
|
|
212
212
|
const previousTreeSnapshotId = readHistoryStateTreeSnapshotId(nextState);
|
|
213
|
-
if (
|
|
213
|
+
if (isTreeSnapshotId(treeSnapshotId)) {
|
|
214
214
|
nextState[VINEXT_TREE_SNAPSHOT_ID_HISTORY_STATE_KEY] = treeSnapshotId;
|
|
215
215
|
if (previousTreeSnapshotId !== treeSnapshotId) delete nextState[VINEXT_TREE_SNAPSHOT_CLAIMED_HISTORY_STATE_KEY];
|
|
216
216
|
} else {
|
|
@@ -233,7 +233,10 @@ function clearHistoryStateTreeSnapshotId(state) {
|
|
|
233
233
|
}
|
|
234
234
|
function readHistoryStateTreeSnapshotId(state) {
|
|
235
235
|
const value = readHistoryStateRecord(state)?.[VINEXT_TREE_SNAPSHOT_ID_HISTORY_STATE_KEY];
|
|
236
|
-
return
|
|
236
|
+
return isTreeSnapshotId(value) ? value : null;
|
|
237
|
+
}
|
|
238
|
+
function isTreeSnapshotId(value) {
|
|
239
|
+
return typeof value === "string" && value.length > 0;
|
|
237
240
|
}
|
|
238
241
|
function readHistoryStateActiveRoutePaths(state) {
|
|
239
242
|
const value = readHistoryStateRecord(state)?.[VINEXT_ACTIVE_ROUTE_PATHS_HISTORY_STATE_KEY];
|
|
@@ -2,4 +2,5 @@
|
|
|
2
2
|
type InlineCssStylesheetLinkElement = Pick<HTMLLinkElement, "getAttribute" | "hasAttribute">;
|
|
3
3
|
export declare function isInlineCssStylesheetLinkElement(link: InlineCssStylesheetLinkElement): boolean;
|
|
4
4
|
export declare function removeStylesheetLinksCoveredByInlineCss(): void;
|
|
5
|
-
//#endregion
|
|
5
|
+
//#endregion
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AppElements } from "./app-elements-wire.js";
|
|
2
|
+
import "./app-elements.js";
|
|
3
|
+
//#region src/server/app-mounted-layouts.d.ts
|
|
4
|
+
export declare function hashMountedLayoutIdentity(identity: string): string;
|
|
5
|
+
export declare function parseMountedLayoutsHeader(value: string | null): ReadonlySet<string> | null;
|
|
6
|
+
/**
|
|
7
|
+
* The header for the outermost layouts a client state holds. Only that prefix
|
|
8
|
+
* can be left out of a render, as a layout below one that re-renders renders
|
|
9
|
+
* inside it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createMountedLayoutsHeader(elements: AppElements, layoutIds: readonly string[]): string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Whether a client state still holds, unchanged, every layout a payload left
|
|
14
|
+
* out. A navigation that started from another state, or a payload stored for
|
|
15
|
+
* another client, can name layouts this one doesn't hold.
|
|
16
|
+
*/
|
|
17
|
+
export declare function holdsSkippedLayouts(current: {
|
|
18
|
+
elements: AppElements;
|
|
19
|
+
layoutIds: readonly string[];
|
|
20
|
+
}, next: AppElements): boolean;
|
|
21
|
+
//#endregion
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { fnv1a64 } from "../utils/hash.js";
|
|
2
|
+
import { AppElementsWire } from "./app-elements-wire.js";
|
|
3
|
+
import "./app-elements.js";
|
|
4
|
+
//#region src/server/app-mounted-layouts.ts
|
|
5
|
+
/**
|
|
6
|
+
* A client navigation names the layouts it already holds, so a render that's
|
|
7
|
+
* never stored can leave them out, as Next.js leaves out the segments above
|
|
8
|
+
* where a navigation diverges from its router state tree.
|
|
9
|
+
*
|
|
10
|
+
* Each entry hashes a layout's segment identity, which binds the layout to its
|
|
11
|
+
* route prefix and that prefix's params, so a layout whose params changed never
|
|
12
|
+
* matches.
|
|
13
|
+
*/
|
|
14
|
+
const MAX_MOUNTED_LAYOUTS = 64;
|
|
15
|
+
const MOUNTED_LAYOUT_HASH = /^[0-9a-f]{16}$/;
|
|
16
|
+
function hashMountedLayoutIdentity(identity) {
|
|
17
|
+
return fnv1a64(identity);
|
|
18
|
+
}
|
|
19
|
+
function serializeMountedLayouts(identities) {
|
|
20
|
+
if (identities.length === 0) return null;
|
|
21
|
+
return identities.slice(0, MAX_MOUNTED_LAYOUTS).map(hashMountedLayoutIdentity).join(",");
|
|
22
|
+
}
|
|
23
|
+
function parseMountedLayoutsHeader(value) {
|
|
24
|
+
if (!value) return null;
|
|
25
|
+
const hashes = /* @__PURE__ */ new Set();
|
|
26
|
+
for (const entry of value.split(",", 65)) {
|
|
27
|
+
const hash = entry.trim();
|
|
28
|
+
if (!MOUNTED_LAYOUT_HASH.test(hash)) return null;
|
|
29
|
+
hashes.add(hash);
|
|
30
|
+
}
|
|
31
|
+
if (hashes.size === 0 || hashes.size > MAX_MOUNTED_LAYOUTS) return null;
|
|
32
|
+
return hashes;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The header for the outermost layouts a client state holds. Only that prefix
|
|
36
|
+
* can be left out of a render, as a layout below one that re-renders renders
|
|
37
|
+
* inside it.
|
|
38
|
+
*/
|
|
39
|
+
function createMountedLayoutsHeader(elements, layoutIds) {
|
|
40
|
+
const identities = AppElementsWire.readMetadata(elements).bfcacheSegmentIdentities;
|
|
41
|
+
const held = [];
|
|
42
|
+
for (const layoutId of layoutIds) {
|
|
43
|
+
const identity = identities[layoutId];
|
|
44
|
+
if (identity === void 0 || !Object.hasOwn(elements, layoutId)) break;
|
|
45
|
+
held.push(identity);
|
|
46
|
+
}
|
|
47
|
+
return serializeMountedLayouts(held);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Whether a client state still holds, unchanged, every layout a payload left
|
|
51
|
+
* out. A navigation that started from another state, or a payload stored for
|
|
52
|
+
* another client, can name layouts this one doesn't hold.
|
|
53
|
+
*/
|
|
54
|
+
function holdsSkippedLayouts(current, next) {
|
|
55
|
+
const nextMetadata = AppElementsWire.readMetadata(next);
|
|
56
|
+
if (nextMetadata.skippedLayoutIds.length === 0) return true;
|
|
57
|
+
const currentIdentities = AppElementsWire.readMetadata(current.elements).bfcacheSegmentIdentities;
|
|
58
|
+
const currentLayoutIds = new Set(current.layoutIds);
|
|
59
|
+
for (const layoutId of nextMetadata.skippedLayoutIds) {
|
|
60
|
+
if (!currentLayoutIds.has(layoutId) || !Object.hasOwn(current.elements, layoutId)) return false;
|
|
61
|
+
const identity = nextMetadata.bfcacheSegmentIdentities[layoutId];
|
|
62
|
+
if (identity === void 0 || identity !== currentIdentities[layoutId]) return false;
|
|
63
|
+
}
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { createMountedLayoutsHeader, hashMountedLayoutIdentity, holdsSkippedLayouts, parseMountedLayoutsHeader };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BrowserRouteManifest, BrowserRouteManifestRoute } from "../routing/browser-route-manifest.js";
|
|
2
|
-
import { OptimisticRouteTrieMatch } from "../routing/optimistic-route-trie.js";
|
|
3
2
|
import { AppElements } from "./app-elements-wire.js";
|
|
4
3
|
import "./app-elements.js";
|
|
4
|
+
import { OptimisticRouteTrieMatch } from "../routing/optimistic-route-trie.js";
|
|
5
5
|
//#region src/server/app-optimistic-routing.d.ts
|
|
6
6
|
type OptimisticRouteMatch = OptimisticRouteTrieMatch<BrowserRouteManifestRoute>;
|
|
7
7
|
export type OptimisticRouteTemplate = {
|
|
@@ -49,6 +49,22 @@ export declare function createOptimisticRouteTemplate(options: {
|
|
|
49
49
|
routeManifest: BrowserRouteManifest;
|
|
50
50
|
}): OptimisticRouteTemplate | null;
|
|
51
51
|
export declare function createOptimisticRouteElements(template: OptimisticRouteTemplate): AppElements;
|
|
52
|
+
/**
|
|
53
|
+
* The optimistic shell reveals the prefetch's streamed metadata, such as its
|
|
54
|
+
* title. React won't hide revealed content again in a transition, so while the
|
|
55
|
+
* authoritative payload's own metadata streams, its whole commit, page
|
|
56
|
+
* included, would wait for it. Render that metadata in a new boundary whose
|
|
57
|
+
* fallback is the shell's instead, so the page commits as it streams and the
|
|
58
|
+
* prefetched title stays until the payload's arrives. Next.js likewise renders
|
|
59
|
+
* the prefetched head until the dynamic one resolves (`Head` in app-router.tsx).
|
|
60
|
+
*
|
|
61
|
+
* A payload streams at most one route's metadata. The shell's may carry
|
|
62
|
+
* another concrete route id, since a template learned for one set of params
|
|
63
|
+
* is reused for others. `navigationKey` remounts the boundary on every
|
|
64
|
+
* navigation, so one that already revealed an earlier navigation's metadata
|
|
65
|
+
* can't hold back the next, as Next.js keys `Head` by its vary path.
|
|
66
|
+
*/
|
|
67
|
+
export declare function keepOptimisticStreamingMetadata(elements: AppElements, optimisticElements: AppElements, navigationKey: string): AppElements;
|
|
52
68
|
/**
|
|
53
69
|
* A loading-shell prefetch stops at the first loading boundary, so layouts
|
|
54
70
|
* below that boundary are present in the route metadata but absent from the
|
|
@@ -74,4 +90,23 @@ export declare function resolveOptimisticNavigationPayload(options: {
|
|
|
74
90
|
routeManifest: BrowserRouteManifest;
|
|
75
91
|
templates: ReadonlyMap<string, OptimisticRouteTemplate>;
|
|
76
92
|
}): OptimisticNavigationPayload | null;
|
|
77
|
-
|
|
93
|
+
export type LearnedOptimisticRouteTemplate = {
|
|
94
|
+
key: string;
|
|
95
|
+
template: OptimisticRouteTemplate;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Optimistic route templates and the prefetch sources they were learned from.
|
|
99
|
+
* `clear()` retires every template, so none can outlive the prefetch payload
|
|
100
|
+
* it was derived from, and drops any result a learning started before the
|
|
101
|
+
* clear resolves to. Sources that are still cached are learned again on the
|
|
102
|
+
* next optimistic navigation.
|
|
103
|
+
*/
|
|
104
|
+
export declare function createOptimisticRouteTemplateStore(): {
|
|
105
|
+
templates: ReadonlyMap<string, OptimisticRouteTemplate>;
|
|
106
|
+
clear(): void;
|
|
107
|
+
hasSource(sourceKey: string): boolean;
|
|
108
|
+
learn(sourceKey: string, learnTemplate: () => Promise<LearnedOptimisticRouteTemplate | null>): Promise<void>;
|
|
109
|
+
pendingLearning(): Promise<void>[];
|
|
110
|
+
};
|
|
111
|
+
//#endregion
|
|
112
|
+
export {};
|
|
@@ -3,10 +3,10 @@ import { stripBasePath } from "../utils/base-path.js";
|
|
|
3
3
|
import { decodeMatchedParams, splitPathnameForRouteMatch } from "../routing/utils.js";
|
|
4
4
|
import { extractRawRoutePatternParams, matchRoutePattern } from "../routing/route-pattern.js";
|
|
5
5
|
import { buildOptimisticRouteTrie, matchOptimisticRouteTrie } from "../routing/optimistic-route-trie.js";
|
|
6
|
+
import { stripRscCacheBustingSearchParam, stripRscSuffix } from "./app-rsc-cache-busting.js";
|
|
6
7
|
import { AppElementsWire } from "./app-elements-wire.js";
|
|
7
8
|
import "./app-elements.js";
|
|
8
9
|
import { createNestedBfcacheSlotSegmentId, deriveBfcacheSegmentIdentity, isNestedBfcacheSlotSegmentId } from "./bfcache-identity.js";
|
|
9
|
-
import { stripRscCacheBustingSearchParam, stripRscSuffix } from "./app-rsc-cache-busting.js";
|
|
10
10
|
import { canonicalizeAppPageParams, resolveAppPagePatternStateKey, resolveAppPageSemanticSegmentStateKey } from "./app-page-segment-state.js";
|
|
11
11
|
import { Suspense, createElement, isValidElement } from "react";
|
|
12
12
|
//#region src/server/app-optimistic-routing.ts
|
|
@@ -203,6 +203,39 @@ function createOptimisticRouteElements(template) {
|
|
|
203
203
|
for (const pageElementId of template.pageElementIds) elements[pageElementId] = createElement(OptimisticRouteSegment);
|
|
204
204
|
return elements;
|
|
205
205
|
}
|
|
206
|
+
function findStreamingMetadataBody(elements) {
|
|
207
|
+
for (const id of Object.keys(elements)) if (id.startsWith("__vinext_streaming_metadata_body:")) return id;
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* The optimistic shell reveals the prefetch's streamed metadata, such as its
|
|
212
|
+
* title. React won't hide revealed content again in a transition, so while the
|
|
213
|
+
* authoritative payload's own metadata streams, its whole commit, page
|
|
214
|
+
* included, would wait for it. Render that metadata in a new boundary whose
|
|
215
|
+
* fallback is the shell's instead, so the page commits as it streams and the
|
|
216
|
+
* prefetched title stays until the payload's arrives. Next.js likewise renders
|
|
217
|
+
* the prefetched head until the dynamic one resolves (`Head` in app-router.tsx).
|
|
218
|
+
*
|
|
219
|
+
* A payload streams at most one route's metadata. The shell's may carry
|
|
220
|
+
* another concrete route id, since a template learned for one set of params
|
|
221
|
+
* is reused for others. `navigationKey` remounts the boundary on every
|
|
222
|
+
* navigation, so one that already revealed an earlier navigation's metadata
|
|
223
|
+
* can't hold back the next, as Next.js keys `Head` by its vary path.
|
|
224
|
+
*/
|
|
225
|
+
function keepOptimisticStreamingMetadata(elements, optimisticElements, navigationKey) {
|
|
226
|
+
const id = findStreamingMetadataBody(elements);
|
|
227
|
+
const optimisticId = findStreamingMetadataBody(optimisticElements);
|
|
228
|
+
if (id === null || optimisticId === null) return elements;
|
|
229
|
+
const optimisticMetadata = optimisticElements[optimisticId];
|
|
230
|
+
if (optimisticMetadata == null) return elements;
|
|
231
|
+
return {
|
|
232
|
+
...elements,
|
|
233
|
+
[id]: createElement(Suspense, {
|
|
234
|
+
fallback: optimisticMetadata,
|
|
235
|
+
key: navigationKey
|
|
236
|
+
}, elements[id])
|
|
237
|
+
};
|
|
238
|
+
}
|
|
206
239
|
/**
|
|
207
240
|
* A loading-shell prefetch stops at the first loading boundary, so layouts
|
|
208
241
|
* below that boundary are present in the route metadata but absent from the
|
|
@@ -277,5 +310,45 @@ function resolveOptimisticNavigationPayload(options) {
|
|
|
277
310
|
urlParts: urlParts.normalized
|
|
278
311
|
};
|
|
279
312
|
}
|
|
313
|
+
/**
|
|
314
|
+
* Optimistic route templates and the prefetch sources they were learned from.
|
|
315
|
+
* `clear()` retires every template, so none can outlive the prefetch payload
|
|
316
|
+
* it was derived from, and drops any result a learning started before the
|
|
317
|
+
* clear resolves to. Sources that are still cached are learned again on the
|
|
318
|
+
* next optimistic navigation.
|
|
319
|
+
*/
|
|
320
|
+
function createOptimisticRouteTemplateStore() {
|
|
321
|
+
const templates = /* @__PURE__ */ new Map();
|
|
322
|
+
const learnedSources = /* @__PURE__ */ new Set();
|
|
323
|
+
const learning = /* @__PURE__ */ new Map();
|
|
324
|
+
let generation = 0;
|
|
325
|
+
return {
|
|
326
|
+
templates,
|
|
327
|
+
clear() {
|
|
328
|
+
generation += 1;
|
|
329
|
+
templates.clear();
|
|
330
|
+
learnedSources.clear();
|
|
331
|
+
learning.clear();
|
|
332
|
+
},
|
|
333
|
+
hasSource(sourceKey) {
|
|
334
|
+
return learnedSources.has(sourceKey) || learning.has(sourceKey);
|
|
335
|
+
},
|
|
336
|
+
learn(sourceKey, learnTemplate) {
|
|
337
|
+
const learnedGeneration = generation;
|
|
338
|
+
const promise = learnTemplate().then((learned) => {
|
|
339
|
+
if (learned === null || learnedGeneration !== generation) return;
|
|
340
|
+
templates.set(learned.key, learned.template);
|
|
341
|
+
learnedSources.add(sourceKey);
|
|
342
|
+
}).finally(() => {
|
|
343
|
+
if (learning.get(sourceKey) === promise) learning.delete(sourceKey);
|
|
344
|
+
});
|
|
345
|
+
learning.set(sourceKey, promise);
|
|
346
|
+
return promise;
|
|
347
|
+
},
|
|
348
|
+
pendingLearning() {
|
|
349
|
+
return [...learning.values()];
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
}
|
|
280
353
|
//#endregion
|
|
281
|
-
export { canCommitOptimisticRouteTemplate, createOptimisticRouteElements, createOptimisticRouteTemplate, getOptimisticPrefetchSourceKey, getOptimisticRouteTemplateKey, matchOptimisticRouteManifestRoute, resolveOptimisticNavigationParamsForHref, resolveOptimisticNavigationPayload };
|
|
354
|
+
export { canCommitOptimisticRouteTemplate, createOptimisticRouteElements, createOptimisticRouteTemplate, createOptimisticRouteTemplateStore, getOptimisticPrefetchSourceKey, getOptimisticRouteTemplateKey, keepOptimisticStreamingMetadata, matchOptimisticRouteManifestRoute, resolveOptimisticNavigationParamsForHref, resolveOptimisticNavigationPayload };
|