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
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import DefaultForbidden from "../shims/default-forbidden.js";
|
|
2
|
+
import DefaultNotFound from "../shims/default-not-found.js";
|
|
3
|
+
import DefaultUnauthorized from "../shims/default-unauthorized.js";
|
|
4
|
+
//#region src/server/default-http-access-fallback-modules.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Module-shaped wrappers around vinext's built-in not-found, forbidden and
|
|
7
|
+
* unauthorized components. Used as the fallback when an app does not define
|
|
8
|
+
* its own `app/not-found.tsx` (and has not opted into
|
|
9
|
+
* `app/global-not-found.tsx`), `app/forbidden.tsx` or `app/unauthorized.tsx`.
|
|
10
|
+
* The runtime treats any `{ default: Component }` record as a boundary
|
|
11
|
+
* module, so wrapping the components this way lets us thread the defaults
|
|
12
|
+
* through the existing boundary plumbing without introducing a parallel code
|
|
13
|
+
* path.
|
|
14
|
+
*
|
|
15
|
+
* Mirrors Next.js's `builtin/not-found.js`, `builtin/forbidden.js` and
|
|
16
|
+
* `builtin/unauthorized.js`, which the app loader selects for the root
|
|
17
|
+
* segment when the user has not supplied the file:
|
|
18
|
+
* https://github.com/vercel/next.js/blob/canary/packages/next/src/build/webpack/loaders/next-app-loader/index.ts
|
|
19
|
+
* https://github.com/vercel/next.js/blob/canary/crates/next-core/src/app_structure.rs
|
|
20
|
+
*/
|
|
21
|
+
export declare const DEFAULT_NOT_FOUND_MODULE: {
|
|
22
|
+
readonly default: typeof DefaultNotFound;
|
|
23
|
+
};
|
|
24
|
+
export declare const DEFAULT_FORBIDDEN_MODULE: {
|
|
25
|
+
readonly default: typeof DefaultForbidden;
|
|
26
|
+
};
|
|
27
|
+
export declare const DEFAULT_UNAUTHORIZED_MODULE: {
|
|
28
|
+
readonly default: typeof DefaultUnauthorized;
|
|
29
|
+
};
|
|
30
|
+
export declare function getDefaultHttpAccessFallbackModule(statusCode: number): {
|
|
31
|
+
readonly default: typeof DefaultNotFound;
|
|
32
|
+
} | null;
|
|
33
|
+
//#endregion
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import DefaultForbidden from "../shims/default-forbidden.js";
|
|
2
|
+
import DefaultNotFound from "../shims/default-not-found.js";
|
|
3
|
+
import DefaultUnauthorized from "../shims/default-unauthorized.js";
|
|
4
|
+
//#region src/server/default-http-access-fallback-modules.ts
|
|
5
|
+
/**
|
|
6
|
+
* Module-shaped wrappers around vinext's built-in not-found, forbidden and
|
|
7
|
+
* unauthorized components. Used as the fallback when an app does not define
|
|
8
|
+
* its own `app/not-found.tsx` (and has not opted into
|
|
9
|
+
* `app/global-not-found.tsx`), `app/forbidden.tsx` or `app/unauthorized.tsx`.
|
|
10
|
+
* The runtime treats any `{ default: Component }` record as a boundary
|
|
11
|
+
* module, so wrapping the components this way lets us thread the defaults
|
|
12
|
+
* through the existing boundary plumbing without introducing a parallel code
|
|
13
|
+
* path.
|
|
14
|
+
*
|
|
15
|
+
* Mirrors Next.js's `builtin/not-found.js`, `builtin/forbidden.js` and
|
|
16
|
+
* `builtin/unauthorized.js`, which the app loader selects for the root
|
|
17
|
+
* segment when the user has not supplied the file:
|
|
18
|
+
* https://github.com/vercel/next.js/blob/canary/packages/next/src/build/webpack/loaders/next-app-loader/index.ts
|
|
19
|
+
* https://github.com/vercel/next.js/blob/canary/crates/next-core/src/app_structure.rs
|
|
20
|
+
*/
|
|
21
|
+
const DEFAULT_NOT_FOUND_MODULE = { default: DefaultNotFound };
|
|
22
|
+
const DEFAULT_FORBIDDEN_MODULE = { default: DefaultForbidden };
|
|
23
|
+
const DEFAULT_UNAUTHORIZED_MODULE = { default: DefaultUnauthorized };
|
|
24
|
+
function getDefaultHttpAccessFallbackModule(statusCode) {
|
|
25
|
+
if (statusCode === 404) return DEFAULT_NOT_FOUND_MODULE;
|
|
26
|
+
if (statusCode === 403) return DEFAULT_FORBIDDEN_MODULE;
|
|
27
|
+
if (statusCode === 401) return DEFAULT_UNAUTHORIZED_MODULE;
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { DEFAULT_FORBIDDEN_MODULE, DEFAULT_NOT_FOUND_MODULE, DEFAULT_UNAUTHORIZED_MODULE, getDefaultHttpAccessFallbackModule };
|
|
@@ -1,7 +1,41 @@
|
|
|
1
1
|
//#region src/server/defer-until-stream-consumed.d.ts
|
|
2
|
+
export type StreamConsumptionCallbacks = {
|
|
3
|
+
/** Runs once when the consumer reads the first chunk. */
|
|
4
|
+
onStart?: () => void;
|
|
5
|
+
/** Runs once when the stream ends, errors or is cancelled. */
|
|
6
|
+
onFlush?: () => void;
|
|
7
|
+
onError?: (error: unknown) => void;
|
|
8
|
+
onCancel?: (reason: unknown) => void;
|
|
9
|
+
};
|
|
2
10
|
/**
|
|
3
11
|
* Defers cleanup until the downstream consumer drains or cancels the stream.
|
|
4
12
|
* `onCancel` runs before the cancellation reaches the source stream.
|
|
5
13
|
*/
|
|
6
14
|
export declare function deferUntilStreamConsumed(stream: ReadableStream<Uint8Array>, onFlush: () => void, onError?: (error: unknown) => void, onCancel?: (reason: unknown) => void): ReadableStream<Uint8Array>;
|
|
15
|
+
/**
|
|
16
|
+
* Runs the callbacks as the downstream consumer reads the stream: `onStart`
|
|
17
|
+
* when it reads the first chunk, the others when the stream ends, errors or
|
|
18
|
+
* is cancelled.
|
|
19
|
+
*
|
|
20
|
+
* The wrapper reads the source directly instead of piping it through an
|
|
21
|
+
* identity `TransformStream`, and a wrapper that is wrapped again before
|
|
22
|
+
* anything reads it takes on the new callbacks instead of adding a layer.
|
|
23
|
+
* Every streamed response passes through several of these, and each layer
|
|
24
|
+
* cost a pipe, two more streams and their promise hops per chunk. Nothing is
|
|
25
|
+
* read ahead of the consumer, so an unread wrapper is still untouched.
|
|
26
|
+
*
|
|
27
|
+
* The callbacks run as separate layers would run them. Start, flush and error
|
|
28
|
+
* callbacks run innermost first, and a layer sees the error an inner layer's
|
|
29
|
+
* callback threw as its stream error, or the error its own flush callback
|
|
30
|
+
* threw. Cancel callbacks run outermost first. A layer whose error or cancel
|
|
31
|
+
* callback throws doesn't run its flush callback. When a start callback
|
|
32
|
+
* throws, that layer and the layers outside it see the error, and the layers
|
|
33
|
+
* inside it are cancelled with it. As with the pipe, each layer's callbacks
|
|
34
|
+
* run in the async context that added them, and the source is read and
|
|
35
|
+
* cancelled in the context of the first layer. Cleanup reads and clears
|
|
36
|
+
* request-scoped state, and spans the source starts while producing chunks
|
|
37
|
+
* need their request parent, but the consumer (the runtime sending the body)
|
|
38
|
+
* reads from outside that scope.
|
|
39
|
+
*/
|
|
40
|
+
export declare function observeStreamConsumption(stream: ReadableStream<Uint8Array>, callbacks: StreamConsumptionCallbacks): ReadableStream<Uint8Array>;
|
|
7
41
|
//#endregion
|
|
@@ -1,37 +1,170 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
1
2
|
//#region src/server/defer-until-stream-consumed.ts
|
|
3
|
+
const UNREAD_WRAPPERS_KEY = Symbol.for("vinext.deferUntilStreamConsumed.unreadWrappers");
|
|
4
|
+
const unreadWrappers = globalThis[UNREAD_WRAPPERS_KEY] ??= /* @__PURE__ */ new WeakMap();
|
|
2
5
|
/**
|
|
3
6
|
* Defers cleanup until the downstream consumer drains or cancels the stream.
|
|
4
7
|
* `onCancel` runs before the cancellation reaches the source stream.
|
|
5
8
|
*/
|
|
6
9
|
function deferUntilStreamConsumed(stream, onFlush, onError, onCancel) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
return observeStreamConsumption(stream, {
|
|
11
|
+
onFlush,
|
|
12
|
+
onError,
|
|
13
|
+
onCancel
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Runs the callbacks as the downstream consumer reads the stream: `onStart`
|
|
18
|
+
* when it reads the first chunk, the others when the stream ends, errors or
|
|
19
|
+
* is cancelled.
|
|
20
|
+
*
|
|
21
|
+
* The wrapper reads the source directly instead of piping it through an
|
|
22
|
+
* identity `TransformStream`, and a wrapper that is wrapped again before
|
|
23
|
+
* anything reads it takes on the new callbacks instead of adding a layer.
|
|
24
|
+
* Every streamed response passes through several of these, and each layer
|
|
25
|
+
* cost a pipe, two more streams and their promise hops per chunk. Nothing is
|
|
26
|
+
* read ahead of the consumer, so an unread wrapper is still untouched.
|
|
27
|
+
*
|
|
28
|
+
* The callbacks run as separate layers would run them. Start, flush and error
|
|
29
|
+
* callbacks run innermost first, and a layer sees the error an inner layer's
|
|
30
|
+
* callback threw as its stream error, or the error its own flush callback
|
|
31
|
+
* threw. Cancel callbacks run outermost first. A layer whose error or cancel
|
|
32
|
+
* callback throws doesn't run its flush callback. When a start callback
|
|
33
|
+
* throws, that layer and the layers outside it see the error, and the layers
|
|
34
|
+
* inside it are cancelled with it. As with the pipe, each layer's callbacks
|
|
35
|
+
* run in the async context that added them, and the source is read and
|
|
36
|
+
* cancelled in the context of the first layer. Cleanup reads and clears
|
|
37
|
+
* request-scoped state, and spans the source starts while producing chunks
|
|
38
|
+
* need their request parent, but the consumer (the runtime sending the body)
|
|
39
|
+
* reads from outside that scope.
|
|
40
|
+
*/
|
|
41
|
+
function observeStreamConsumption(stream, callbacks) {
|
|
42
|
+
const layer = {
|
|
43
|
+
...callbacks,
|
|
44
|
+
runInCreationContext: AsyncLocalStorage.snapshot()
|
|
45
|
+
};
|
|
46
|
+
const unread = unreadWrappers.get(stream);
|
|
47
|
+
if (unread && !stream.locked) {
|
|
48
|
+
unread.push(layer);
|
|
49
|
+
return stream;
|
|
50
|
+
}
|
|
51
|
+
const layers = [layer];
|
|
52
|
+
let started = false;
|
|
53
|
+
let settled = false;
|
|
54
|
+
const finish = (sourceFailure, first = 0, end = layers.length) => {
|
|
55
|
+
let failure = sourceFailure;
|
|
56
|
+
for (const current of layers.slice(first, end)) current.runInCreationContext(() => {
|
|
57
|
+
const reportedError = failure !== void 0;
|
|
58
|
+
try {
|
|
59
|
+
if (failure) current.onError?.(failure.error);
|
|
60
|
+
} catch (error) {
|
|
61
|
+
failure = { error };
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
current.onFlush?.();
|
|
66
|
+
} catch (error) {
|
|
67
|
+
failure = { error };
|
|
68
|
+
if (reportedError) return;
|
|
69
|
+
try {
|
|
70
|
+
current.onError?.(error);
|
|
71
|
+
} catch (callbackError) {
|
|
72
|
+
failure = { error: callbackError };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
return failure;
|
|
77
|
+
};
|
|
78
|
+
const cancelLayers = (reason, end) => {
|
|
79
|
+
let failure;
|
|
80
|
+
for (const current of layers.slice(0, end).reverse()) current.runInCreationContext(() => {
|
|
81
|
+
try {
|
|
82
|
+
current.onCancel?.(reason);
|
|
83
|
+
} catch (error) {
|
|
84
|
+
failure ??= { error };
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
try {
|
|
88
|
+
current.onFlush?.();
|
|
89
|
+
} catch (error) {
|
|
90
|
+
failure ??= { error };
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
return failure;
|
|
94
|
+
};
|
|
95
|
+
const start = () => {
|
|
96
|
+
for (const [index, current] of layers.entries()) {
|
|
97
|
+
try {
|
|
98
|
+
current.runInCreationContext(() => current.onStart?.());
|
|
99
|
+
} catch (error) {
|
|
100
|
+
return {
|
|
101
|
+
error,
|
|
102
|
+
index
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
if (settled) return void 0;
|
|
12
106
|
}
|
|
13
107
|
};
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
108
|
+
const reader = stream.getReader();
|
|
109
|
+
const release = () => {
|
|
110
|
+
try {
|
|
111
|
+
reader.releaseLock();
|
|
112
|
+
} catch {}
|
|
113
|
+
};
|
|
114
|
+
const wrapped = new ReadableStream({
|
|
19
115
|
pull(controller) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
116
|
+
unreadWrappers.delete(wrapped);
|
|
117
|
+
return layer.runInCreationContext(() => reader.read()).then(({ done, value }) => {
|
|
118
|
+
if (settled) return;
|
|
119
|
+
if (!done) {
|
|
120
|
+
if (!started) {
|
|
121
|
+
started = true;
|
|
122
|
+
const startFailure = start();
|
|
123
|
+
if (settled) return;
|
|
124
|
+
if (startFailure) {
|
|
125
|
+
settled = true;
|
|
126
|
+
const { error, index } = startFailure;
|
|
127
|
+
let failure = finish({ error }, index, index + 1);
|
|
128
|
+
cancelLayers(error, index);
|
|
129
|
+
layer.runInCreationContext(() => reader.cancel(error)).catch(() => {}).finally(release);
|
|
130
|
+
failure = finish(failure, index + 1);
|
|
131
|
+
controller.error(failure?.error);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
controller.enqueue(value);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
settled = true;
|
|
139
|
+
release();
|
|
140
|
+
const failure = finish(void 0);
|
|
141
|
+
if (failure) controller.error(failure.error);
|
|
142
|
+
else controller.close();
|
|
23
143
|
}, (error) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
144
|
+
if (settled) return;
|
|
145
|
+
settled = true;
|
|
146
|
+
release();
|
|
147
|
+
controller.error(finish({ error })?.error);
|
|
27
148
|
});
|
|
28
149
|
},
|
|
29
150
|
cancel(reason) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
151
|
+
unreadWrappers.delete(wrapped);
|
|
152
|
+
let failure;
|
|
153
|
+
if (!settled) {
|
|
154
|
+
settled = true;
|
|
155
|
+
failure = cancelLayers(reason, layers.length);
|
|
156
|
+
}
|
|
157
|
+
const cancelled = layer.runInCreationContext(() => reader.cancel(reason)).finally(release);
|
|
158
|
+
if (!failure) return cancelled;
|
|
159
|
+
const { error } = failure;
|
|
160
|
+
const fail = () => {
|
|
161
|
+
throw error;
|
|
162
|
+
};
|
|
163
|
+
return cancelled.then(fail, fail);
|
|
33
164
|
}
|
|
34
|
-
});
|
|
165
|
+
}, { highWaterMark: 0 });
|
|
166
|
+
unreadWrappers.set(wrapped, layers);
|
|
167
|
+
return wrapped;
|
|
35
168
|
}
|
|
36
169
|
//#endregion
|
|
37
|
-
export { deferUntilStreamConsumed };
|
|
170
|
+
export { deferUntilStreamConsumed, observeStreamConsumption };
|
|
@@ -19,6 +19,9 @@
|
|
|
19
19
|
* (`process.kill(pid, 0)`), which is good enough for the dev-server
|
|
20
20
|
* "another server is running" use case. Race conditions on lock acquisition
|
|
21
21
|
* are tolerated: at worst, two dev servers race and one fails to bind a port.
|
|
22
|
+
* Unlike a `flock()`, the lock file survives a hard restart, so a lock
|
|
23
|
+
* written before the current boot is treated as stale whatever its PID: the
|
|
24
|
+
* PID may now belong to an unrelated process. See `predatesCurrentBoot()`.
|
|
22
25
|
* - Lock file lives in `<root>/.vinext/dev/lock.json` (mirroring Next.js'
|
|
23
26
|
* `.next/dev/lock` layout). `.vinext/` is already used by the fonts plugin
|
|
24
27
|
* to cache self-hosted Google Fonts, so this re-uses the same project-local
|
|
@@ -62,6 +65,31 @@ export declare function readLockfile(lockfilePath: string): DevServerInfo | unde
|
|
|
62
65
|
* signal it (in which case it's still running, just owned by someone else).
|
|
63
66
|
*/
|
|
64
67
|
export declare function isPidAlive(pid: number): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Returns true if a lock with the given `startedAt` was written before the
|
|
70
|
+
* machine last booted.
|
|
71
|
+
*
|
|
72
|
+
* Such a lock was left behind by a session whose exit handler never ran (a
|
|
73
|
+
* crash, a forced restart, power loss). PIDs are handed out again after a
|
|
74
|
+
* boot, so the lock's PID may be held by an unrelated process, and
|
|
75
|
+
* `isPidAlive()` alone would report the dead server as running.
|
|
76
|
+
*
|
|
77
|
+
* The boot time is derived from `Date.now() - os.uptime()`. Stepping the wall
|
|
78
|
+
* clock forward moves it too (`os.uptime()` doesn't change), so a forward
|
|
79
|
+
* step larger than the uptime at which a server started makes its lock look
|
|
80
|
+
* stale, e.g. a VM resuming after the host slept. The second `vinext dev`
|
|
81
|
+
* then takes over, as in the acquisition race tolerated below: Vite moves it
|
|
82
|
+
* to another port, or it fails to bind with `strictPort`.
|
|
83
|
+
*
|
|
84
|
+
* Known limitations, where a lock is still checked by PID alone:
|
|
85
|
+
* - A wall clock that comes back from a reboot behind the previous session
|
|
86
|
+
* (an RTC running slow, or NTP stepping it back) can leave the lock's
|
|
87
|
+
* `startedAt` after the derived boot time.
|
|
88
|
+
* - Windows Fast Startup shuts down by hibernating the kernel, so
|
|
89
|
+
* `os.uptime()` keeps counting across that shutdown.
|
|
90
|
+
* - A container restart doesn't reset the host's uptime.
|
|
91
|
+
*/
|
|
92
|
+
export declare function predatesCurrentBoot(startedAt: number): boolean;
|
|
65
93
|
type FormatErrorOptions = {
|
|
66
94
|
/** Existing server info from the lock file, if readable. */
|
|
67
95
|
existing: DevServerInfo | undefined;
|
|
@@ -87,7 +115,8 @@ type AcquireOptions = {
|
|
|
87
115
|
/** Initial server info to write. Port/URL may be updated later via `update()`. */
|
|
88
116
|
info: DevServerInfo;
|
|
89
117
|
/**
|
|
90
|
-
* If a lock file exists but its PID is dead,
|
|
118
|
+
* If a lock file exists but is stale (its PID is dead, or it was written
|
|
119
|
+
* before the current boot), take over instead of failing.
|
|
91
120
|
* Defaults to `true`. Set to `false` for testing.
|
|
92
121
|
*/
|
|
93
122
|
takeOverStale?: boolean;
|
|
@@ -117,4 +146,5 @@ type AcquireResult = AcquireSuccess | AcquireFailure;
|
|
|
117
146
|
* already holds the lock.
|
|
118
147
|
*/
|
|
119
148
|
export declare function tryAcquireLockfile(opts: AcquireOptions): AcquireResult;
|
|
120
|
-
//#endregion
|
|
149
|
+
//#endregion
|
|
150
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import path from "../deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
|
|
2
2
|
import fs from "node:fs";
|
|
3
|
+
import os from "node:os";
|
|
3
4
|
//#region src/server/dev-lockfile.ts
|
|
4
5
|
/**
|
|
5
6
|
* Dev server lock file.
|
|
@@ -21,6 +22,9 @@ import fs from "node:fs";
|
|
|
21
22
|
* (`process.kill(pid, 0)`), which is good enough for the dev-server
|
|
22
23
|
* "another server is running" use case. Race conditions on lock acquisition
|
|
23
24
|
* are tolerated: at worst, two dev servers race and one fails to bind a port.
|
|
25
|
+
* Unlike a `flock()`, the lock file survives a hard restart, so a lock
|
|
26
|
+
* written before the current boot is treated as stale whatever its PID: the
|
|
27
|
+
* PID may now belong to an unrelated process. See `predatesCurrentBoot()`.
|
|
24
28
|
* - Lock file lives in `<root>/.vinext/dev/lock.json` (mirroring Next.js'
|
|
25
29
|
* `.next/dev/lock` layout). `.vinext/` is already used by the fonts plugin
|
|
26
30
|
* to cache self-hosted Google Fonts, so this re-uses the same project-local
|
|
@@ -71,6 +75,46 @@ function isPidAlive(pid) {
|
|
|
71
75
|
}
|
|
72
76
|
}
|
|
73
77
|
/**
|
|
78
|
+
* Slack for the boot-time comparison in `predatesCurrentBoot`. `os.uptime()`
|
|
79
|
+
* has whole-second resolution on some platforms (macOS derives it from
|
|
80
|
+
* `kern.boottime`), so the derived boot time is only accurate to about a
|
|
81
|
+
* second.
|
|
82
|
+
*/
|
|
83
|
+
const BOOT_TIME_TOLERANCE_MS = 5e3;
|
|
84
|
+
/**
|
|
85
|
+
* Returns true if a lock with the given `startedAt` was written before the
|
|
86
|
+
* machine last booted.
|
|
87
|
+
*
|
|
88
|
+
* Such a lock was left behind by a session whose exit handler never ran (a
|
|
89
|
+
* crash, a forced restart, power loss). PIDs are handed out again after a
|
|
90
|
+
* boot, so the lock's PID may be held by an unrelated process, and
|
|
91
|
+
* `isPidAlive()` alone would report the dead server as running.
|
|
92
|
+
*
|
|
93
|
+
* The boot time is derived from `Date.now() - os.uptime()`. Stepping the wall
|
|
94
|
+
* clock forward moves it too (`os.uptime()` doesn't change), so a forward
|
|
95
|
+
* step larger than the uptime at which a server started makes its lock look
|
|
96
|
+
* stale, e.g. a VM resuming after the host slept. The second `vinext dev`
|
|
97
|
+
* then takes over, as in the acquisition race tolerated below: Vite moves it
|
|
98
|
+
* to another port, or it fails to bind with `strictPort`.
|
|
99
|
+
*
|
|
100
|
+
* Known limitations, where a lock is still checked by PID alone:
|
|
101
|
+
* - A wall clock that comes back from a reboot behind the previous session
|
|
102
|
+
* (an RTC running slow, or NTP stepping it back) can leave the lock's
|
|
103
|
+
* `startedAt` after the derived boot time.
|
|
104
|
+
* - Windows Fast Startup shuts down by hibernating the kernel, so
|
|
105
|
+
* `os.uptime()` keeps counting across that shutdown.
|
|
106
|
+
* - A container restart doesn't reset the host's uptime.
|
|
107
|
+
*/
|
|
108
|
+
function predatesCurrentBoot(startedAt) {
|
|
109
|
+
let uptime;
|
|
110
|
+
try {
|
|
111
|
+
uptime = os.uptime();
|
|
112
|
+
} catch {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
return startedAt < Date.now() - uptime * 1e3 - BOOT_TIME_TOLERANCE_MS;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
74
118
|
* Writes the lock file with the given content. Creates the parent directory
|
|
75
119
|
* if it doesn't exist.
|
|
76
120
|
*
|
|
@@ -128,7 +172,7 @@ function tryAcquireLockfile(opts) {
|
|
|
128
172
|
const lockfilePath = getLockfilePath(root);
|
|
129
173
|
const existing = readLockfile(lockfilePath);
|
|
130
174
|
if (existing) {
|
|
131
|
-
if (isPidAlive(existing.pid)) return {
|
|
175
|
+
if (!predatesCurrentBoot(existing.startedAt) && isPidAlive(existing.pid)) return {
|
|
132
176
|
ok: false,
|
|
133
177
|
existing,
|
|
134
178
|
lockfilePath
|
|
@@ -178,4 +222,4 @@ function tryAcquireLockfile(opts) {
|
|
|
178
222
|
};
|
|
179
223
|
}
|
|
180
224
|
//#endregion
|
|
181
|
-
export { formatAlreadyRunningError, getLockfilePath, isPidAlive, readLockfile, tryAcquireLockfile };
|
|
225
|
+
export { formatAlreadyRunningError, getLockfilePath, isPidAlive, predatesCurrentBoot, readLockfile, tryAcquireLockfile };
|
|
@@ -13,7 +13,7 @@ import { NEVER_CACHE_CONTROL } from "./cache-control.js";
|
|
|
13
13
|
import { buildMissIsrCacheControl } from "./isr-decision.js";
|
|
14
14
|
import { isOnDemandRevalidateRequest } from "./revalidation-request.js";
|
|
15
15
|
import "./isr-cache.js";
|
|
16
|
-
import { ensureFetchPatch } from "../shims/fetch-cache.js";
|
|
16
|
+
import { ensureFetchPatch, setCurrentFetchDraftMode } from "../shims/fetch-cache.js";
|
|
17
17
|
import { mergeRouteParamsIntoQuery, parseQueryString } from "../utils/query.js";
|
|
18
18
|
import "../shims/router-state.js";
|
|
19
19
|
import { withScriptNonce } from "../shims/script-nonce-context.js";
|
|
@@ -41,7 +41,7 @@ import { PAGES_PREVIEW_CACHE_CONTROL, appendPagesPreviewClearCookies, getPagesPr
|
|
|
41
41
|
import { attachPagesRequestCookies } from "./pages-node-compat.js";
|
|
42
42
|
import { randomUUID } from "node:crypto";
|
|
43
43
|
import React from "react";
|
|
44
|
-
import { renderToReadableStream } from "react-dom/server
|
|
44
|
+
import { renderToReadableStream } from "react-dom/server";
|
|
45
45
|
//#region src/server/dev-server.ts
|
|
46
46
|
/**
|
|
47
47
|
* Render a React element to a string using renderToReadableStream.
|
|
@@ -112,6 +112,7 @@ function writeGsspRedirect(res, redirect, isDataReq, props, options) {
|
|
|
112
112
|
...props,
|
|
113
113
|
pageProps: props.pageProps
|
|
114
114
|
});
|
|
115
|
+
if (options.method === "getServerSideProps" && !res.getHeader("Cache-Control")) res.setHeader("Cache-Control", NEVER_CACHE_CONTROL);
|
|
115
116
|
const gsspHeaders = Object.fromEntries(Object.entries(res.getHeaders()).filter((entry) => entry[1] !== void 0));
|
|
116
117
|
if (isDangerousScheme(resolved.destination)) {
|
|
117
118
|
const deploymentId = process.env.__VINEXT_DEPLOYMENT_ID || process.env.NEXT_DEPLOYMENT_ID;
|
|
@@ -404,7 +405,7 @@ function createSSRHandler(server, runner, routes, pagesDir, i18nConfig, fileMatc
|
|
|
404
405
|
res.end("{}");
|
|
405
406
|
return;
|
|
406
407
|
}
|
|
407
|
-
const requestContext = createRequestContext();
|
|
408
|
+
const requestContext = createRequestContext({ isOnDemandRevalidate: isOnDemandRevalidateRequest(req.headers[PRERENDER_REVALIDATE_HEADER]) });
|
|
408
409
|
const closeRequest = () => void closeAfterResponse(requestContext);
|
|
409
410
|
res.on("finish", closeRequest);
|
|
410
411
|
res.on("close", closeRequest);
|
|
@@ -422,7 +423,7 @@ function createSSRHandler(server, runner, routes, pagesDir, i18nConfig, fileMatc
|
|
|
422
423
|
let requestAsPath = isDataReq ? gsspResolvedUrl : i18nConfig ? extractLocaleFromUrl$1(originalUrl, i18nConfig, locale).url : originalUrl;
|
|
423
424
|
const userFacingParams = route.isDynamic ? params : null;
|
|
424
425
|
let query = mergeRouteParamsIntoQuery(parseQueryString(url), params);
|
|
425
|
-
const requestContext = createRequestContext();
|
|
426
|
+
const requestContext = createRequestContext({ isOnDemandRevalidate: isOnDemandRevalidateRequest(req.headers[PRERENDER_REVALIDATE_HEADER]) });
|
|
426
427
|
let isStaticPropsRender = false;
|
|
427
428
|
const closeRequest = () => void closeAfterResponse(requestContext);
|
|
428
429
|
res.on("finish", closeRequest);
|
|
@@ -467,6 +468,7 @@ function createSSRHandler(server, runner, routes, pagesDir, i18nConfig, fileMatc
|
|
|
467
468
|
shouldClear: false
|
|
468
469
|
};
|
|
469
470
|
const requestPreviewData = requestPreview.data;
|
|
471
|
+
setCurrentFetchDraftMode(requestPreviewData !== false);
|
|
470
472
|
const pagesNextData = {
|
|
471
473
|
...buildPagesReadinessNextData({
|
|
472
474
|
pageModule,
|
|
@@ -643,14 +645,17 @@ function createSSRHandler(server, runner, routes, pagesDir, i18nConfig, fileMatc
|
|
|
643
645
|
const deploymentId = process.env.__VINEXT_DEPLOYMENT_ID || process.env.NEXT_DEPLOYMENT_ID;
|
|
644
646
|
stripDevPagesNotFoundFramingHeaders(res);
|
|
645
647
|
if (!res.hasHeader("Content-Type")) res.setHeader("Content-Type", "application/json");
|
|
648
|
+
if (!res.getHeader("Cache-Control")) res.setHeader("Cache-Control", NEVER_CACHE_CONTROL);
|
|
646
649
|
if (deploymentId && !res.hasHeader("x-nextjs-deployment-id")) res.setHeader(NEXTJS_DEPLOYMENT_ID_HEADER, deploymentId);
|
|
647
650
|
res.writeHead(404);
|
|
648
651
|
res.end("{\"notFound\":true}");
|
|
649
652
|
return;
|
|
650
653
|
}
|
|
654
|
+
if (!res.getHeader("Cache-Control")) res.setHeader("Cache-Control", NEVER_CACHE_CONTROL);
|
|
651
655
|
await renderErrorPage(server, runner, req, res, url, pagesDir, 404, routerShim.wrapWithRouterContext, void 0, void 0, reactStrictMode, {
|
|
652
656
|
...errorPageContext,
|
|
653
|
-
notFoundSrcPage: patternToNextFormat(route.pattern)
|
|
657
|
+
notFoundSrcPage: patternToNextFormat(route.pattern),
|
|
658
|
+
cacheControl: requestPreview.data === false && !requestPreview.shouldClear ? DEV_PAGES_CACHE_CONTROL : PAGES_PREVIEW_CACHE_CONTROL
|
|
654
659
|
});
|
|
655
660
|
return;
|
|
656
661
|
}
|
|
@@ -1130,7 +1135,8 @@ async function renderErrorPage(server, runner, req, res, url, pagesDir, statusCo
|
|
|
1130
1135
|
getTailHeadHTML: () => getClientTraceMetadataHTML(context.clientTraceMetadata),
|
|
1131
1136
|
setDocumentInitialHead: typeof headShim.setDocumentInitialHead === "function" ? headShim.setDocumentInitialHead : void 0,
|
|
1132
1137
|
crossOrigin: context.crossOrigin,
|
|
1133
|
-
preserveExistingContentType: statusCode === 404
|
|
1138
|
+
preserveExistingContentType: statusCode === 404,
|
|
1139
|
+
extraHeaders: context.cacheControl ? { "Cache-Control": context.cacheControl } : void 0
|
|
1134
1140
|
});
|
|
1135
1141
|
else {
|
|
1136
1142
|
const bodyHtml = await tracePagesDocument(errorPage, () => renderToStringAsync(element));
|
|
@@ -1155,6 +1161,7 @@ async function renderErrorPage(server, runner, req, res, url, pagesDir, statusCo
|
|
|
1155
1161
|
configuredCrossOrigin: context.crossOrigin,
|
|
1156
1162
|
protectedAssetMarker
|
|
1157
1163
|
}), protectedAssetMarker);
|
|
1164
|
+
if (context.cacheControl) res.setHeader("Cache-Control", context.cacheControl);
|
|
1158
1165
|
res.writeHead(statusCode, statusCode === 404 && res.hasHeader("Content-Type") ? void 0 : { "Content-Type": "text/html; charset=utf-8" });
|
|
1159
1166
|
res.end(transformedHtml);
|
|
1160
1167
|
}
|
|
@@ -1173,6 +1180,7 @@ async function renderErrorPage(server, runner, req, res, url, pagesDir, statusCo
|
|
|
1173
1180
|
defaultResponse.headers.forEach((value, key) => {
|
|
1174
1181
|
headers[key] = value;
|
|
1175
1182
|
});
|
|
1183
|
+
if (context.cacheControl) headers["cache-control"] = context.cacheControl;
|
|
1176
1184
|
res.writeHead(defaultResponse.status, headers);
|
|
1177
1185
|
res.end(await defaultResponse.text());
|
|
1178
1186
|
return;
|
|
@@ -24,4 +24,5 @@ type FileBasedMetadataOptions = {
|
|
|
24
24
|
basePath?: string;
|
|
25
25
|
};
|
|
26
26
|
export declare function applyFileBasedMetadata(metadata: Metadata | null, routePath: string, params: AppPageParams, metadataRoutes: readonly MetadataFileRoute[] | null | undefined, options?: FileBasedMetadataOptions): Promise<Metadata | null>;
|
|
27
|
-
//#endregion
|
|
27
|
+
//#endregion
|
|
28
|
+
export {};
|
|
@@ -43,4 +43,5 @@ export type FrameworkTracer = {
|
|
|
43
43
|
};
|
|
44
44
|
export declare function recordFrameworkSpanError(span: FrameworkSpan, error: unknown): void;
|
|
45
45
|
export declare function createFrameworkTracer(integrations: readonly FrameworkTracingIntegration[]): FrameworkTracer;
|
|
46
|
-
//#endregion
|
|
46
|
+
//#endregion
|
|
47
|
+
export {};
|
package/dist/server/headers.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare const VINEXT_CACHE_HEADER = "X-Vinext-Cache";
|
|
|
17
17
|
export declare const NEXTJS_CACHE_HEADER = "x-nextjs-cache";
|
|
18
18
|
/** Next.js cache-tag metadata carried by prerendered App Router responses. */
|
|
19
19
|
export declare const NEXT_CACHE_TAGS_HEADER = "x-next-cache-tags";
|
|
20
|
-
/** Timing metrics: `handlerStart,compileMs,renderMs
|
|
20
|
+
/** Timing metrics: `handlerStart,compileMs,renderMs` (handlerStart is wall-clock ms). */
|
|
21
21
|
export declare const VINEXT_TIMING_HEADER = "x-vinext-timing";
|
|
22
22
|
/** Matched route returned from an independently hosted response stage. */
|
|
23
23
|
export declare const VINEXT_TRACE_ROUTE_HEADER = "X-Vinext-Trace-Route";
|
|
@@ -85,8 +85,11 @@ export declare const VINEXT_PRERENDER_RENDER_ERROR_HEADER = "x-vinext-prerender-
|
|
|
85
85
|
export declare const VINEXT_PRERENDER_SPECIAL_ERROR_HEADER = "x-vinext-prerender-special-error";
|
|
86
86
|
/** Internal marker persisted only inside metadata-route APP_ROUTE cache values. */
|
|
87
87
|
export declare const VINEXT_METADATA_ROUTE_CACHE_HEADER = "x-vinext-metadata-route-cache";
|
|
88
|
-
/**
|
|
89
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Hashed identities of the layouts a client navigation already holds, so a
|
|
90
|
+
* render that's never stored can leave them out. Not part of the RSC cache key.
|
|
91
|
+
*/
|
|
92
|
+
export declare const VINEXT_MOUNTED_LAYOUTS_HEADER = "X-Vinext-Mounted-Layouts";
|
|
90
93
|
/**
|
|
91
94
|
* Side-channel signal that an RSC response (HTTP 200) encodes a `redirect()`
|
|
92
95
|
* thrown during render. The header value is the redirect target (path-only
|
package/dist/server/headers.js
CHANGED
|
@@ -17,7 +17,7 @@ const VINEXT_CACHE_HEADER = "X-Vinext-Cache";
|
|
|
17
17
|
const NEXTJS_CACHE_HEADER = "x-nextjs-cache";
|
|
18
18
|
/** Next.js cache-tag metadata carried by prerendered App Router responses. */
|
|
19
19
|
const NEXT_CACHE_TAGS_HEADER = "x-next-cache-tags";
|
|
20
|
-
/** Timing metrics: `handlerStart,compileMs,renderMs
|
|
20
|
+
/** Timing metrics: `handlerStart,compileMs,renderMs` (handlerStart is wall-clock ms). */
|
|
21
21
|
const VINEXT_TIMING_HEADER = "x-vinext-timing";
|
|
22
22
|
/** Matched route returned from an independently hosted response stage. */
|
|
23
23
|
const VINEXT_TRACE_ROUTE_HEADER = "X-Vinext-Trace-Route";
|
|
@@ -85,8 +85,11 @@ const VINEXT_PRERENDER_RENDER_ERROR_HEADER = "x-vinext-prerender-render-error";
|
|
|
85
85
|
const VINEXT_PRERENDER_SPECIAL_ERROR_HEADER = "x-vinext-prerender-special-error";
|
|
86
86
|
/** Internal marker persisted only inside metadata-route APP_ROUTE cache values. */
|
|
87
87
|
const VINEXT_METADATA_ROUTE_CACHE_HEADER = "x-vinext-metadata-route-cache";
|
|
88
|
-
/**
|
|
89
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Hashed identities of the layouts a client navigation already holds, so a
|
|
90
|
+
* render that's never stored can leave them out. Not part of the RSC cache key.
|
|
91
|
+
*/
|
|
92
|
+
const VINEXT_MOUNTED_LAYOUTS_HEADER = "X-Vinext-Mounted-Layouts";
|
|
90
93
|
/**
|
|
91
94
|
* Side-channel signal that an RSC response (HTTP 200) encodes a `redirect()`
|
|
92
95
|
* thrown during render. The header value is the redirect target (path-only
|
|
@@ -152,7 +155,8 @@ const FLIGHT_HEADERS = [
|
|
|
152
155
|
"next-router-prefetch",
|
|
153
156
|
"next-hmr-refresh",
|
|
154
157
|
"next-router-segment-prefetch",
|
|
155
|
-
"x-vinext-rsc-state-fingerprint"
|
|
158
|
+
"x-vinext-rsc-state-fingerprint",
|
|
159
|
+
"x-vinext-mounted-layouts"
|
|
156
160
|
];
|
|
157
161
|
/**
|
|
158
162
|
* Headers that must be stripped from external requests before any handler
|
|
@@ -192,4 +196,4 @@ const VINEXT_INTERNAL_HEADERS = [
|
|
|
192
196
|
VINEXT_TRACE_ROUTE_HEADER.toLowerCase()
|
|
193
197
|
];
|
|
194
198
|
//#endregion
|
|
195
|
-
export { ACTION_FORWARDED_HEADER, ACTION_REDIRECT_HEADER, ACTION_REDIRECT_STATUS_HEADER, ACTION_REDIRECT_TYPE_HEADER, ACTION_REVALIDATED_HEADER, FLIGHT_HEADERS, INTERNAL_HEADERS, MIDDLEWARE_HEADER_PREFIX, MIDDLEWARE_NEXT_HEADER, MIDDLEWARE_REWRITE_HEADER, MIDDLEWARE_SET_COOKIE_HEADER, MIDDLEWARE_SKIP_HEADER, NEXTJS_ACTION_NOT_FOUND_HEADER, NEXTJS_CACHE_HEADER, NEXTJS_DEPLOYMENT_ID_HEADER, NEXT_ACTION_HEADER, NEXT_CACHE_TAGS_HEADER, NEXT_HTML_REQUEST_ID_HEADER, NEXT_REQUEST_ID_HEADER, NEXT_ROUTER_PREFETCH_HEADER, NEXT_ROUTER_SEGMENT_PREFETCH_HEADER, NEXT_ROUTER_STALE_TIME_HEADER, NEXT_ROUTER_STATE_TREE_HEADER, NEXT_URL_HEADER, RSC_ACTION_HEADER, RSC_HEADER, VINEXT_CACHEABILITY_PROBE_HEADER, VINEXT_CACHEABILITY_PROBE_QUERY_PARAM, VINEXT_CACHEABILITY_PROBE_ROUTE_HEADER, VINEXT_CACHE_HEADER,
|
|
199
|
+
export { ACTION_FORWARDED_HEADER, ACTION_REDIRECT_HEADER, ACTION_REDIRECT_STATUS_HEADER, ACTION_REDIRECT_TYPE_HEADER, ACTION_REVALIDATED_HEADER, FLIGHT_HEADERS, INTERNAL_HEADERS, MIDDLEWARE_HEADER_PREFIX, MIDDLEWARE_NEXT_HEADER, MIDDLEWARE_REWRITE_HEADER, MIDDLEWARE_SET_COOKIE_HEADER, MIDDLEWARE_SKIP_HEADER, NEXTJS_ACTION_NOT_FOUND_HEADER, NEXTJS_CACHE_HEADER, NEXTJS_DEPLOYMENT_ID_HEADER, NEXT_ACTION_HEADER, NEXT_CACHE_TAGS_HEADER, NEXT_HTML_REQUEST_ID_HEADER, NEXT_REQUEST_ID_HEADER, NEXT_ROUTER_PREFETCH_HEADER, NEXT_ROUTER_SEGMENT_PREFETCH_HEADER, NEXT_ROUTER_STALE_TIME_HEADER, NEXT_ROUTER_STATE_TREE_HEADER, NEXT_URL_HEADER, RSC_ACTION_HEADER, RSC_HEADER, VINEXT_CACHEABILITY_PROBE_HEADER, VINEXT_CACHEABILITY_PROBE_QUERY_PARAM, VINEXT_CACHEABILITY_PROBE_ROUTE_HEADER, VINEXT_CACHE_HEADER, VINEXT_DYNAMIC_STALE_TIME_HEADER, VINEXT_EXPECTED_WORKER_VERSION_HEADER, VINEXT_INTERCEPTION_CONTEXT_HEADER, VINEXT_INTERCEPTION_ID_HEADER, VINEXT_INTERNAL_HEADERS, VINEXT_METADATA_ROUTE_CACHE_HEADER, VINEXT_MOUNTED_LAYOUTS_HEADER, VINEXT_MOUNTED_SLOTS_HEADER, VINEXT_MW_CTX_HEADER, VINEXT_PARAMS_HEADER, VINEXT_PRERENDER_CACHE_LIFE_HEADER, VINEXT_PRERENDER_METADATA_ROUTES_PATH, VINEXT_PRERENDER_PAGES_STATIC_PATHS_PATH, VINEXT_PRERENDER_READINESS_HEADER, VINEXT_PRERENDER_READINESS_PATH, VINEXT_PRERENDER_RENDER_ERROR_HEADER, VINEXT_PRERENDER_REWRITTEN_HEADER, VINEXT_PRERENDER_ROUTE_PARAMS_HEADER, VINEXT_PRERENDER_SECRET_HEADER, VINEXT_PRERENDER_SPECIAL_ERROR_HEADER, VINEXT_PRERENDER_SPECULATIVE_HEADER, VINEXT_PRERENDER_STATIC_PARAMS_PATH, VINEXT_RENDERED_PATH_AND_SEARCH_HEADER, VINEXT_REVALIDATED_CACHE_TAG_HEADER, VINEXT_REVALIDATE_HEADER, VINEXT_REVALIDATE_HOST_HEADER, VINEXT_RSC_COMPLETION_METADATA_HEADER, VINEXT_RSC_MARKER_HEADER, VINEXT_RSC_REDIRECT_HEADER, VINEXT_RSC_REDIRECT_TYPE_HEADER, VINEXT_RSC_RENDER_MODE_HEADER, VINEXT_RSC_STATE_FINGERPRINT_HEADER, VINEXT_RSC_VARY_HEADER, VINEXT_SPECIAL_ERROR_STATUS_HEADER, VINEXT_STALE_TIME_PENDING_HEADER, VINEXT_TIMING_HEADER, VINEXT_TRACE_BUFFERED_BODY_HEADER, VINEXT_TRACE_ERROR_HEADER, VINEXT_TRACE_ROUTE_HEADER, isVinextRscVaryField };
|
package/dist/server/html.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
//#region src/server/html.d.ts
|
|
2
2
|
export declare function safeJsonStringify(data: unknown): string;
|
|
3
|
+
export declare function scriptSafeJsonStringify(data: unknown): string;
|
|
3
4
|
export declare function escapeHtmlAttr(value: string): string;
|
|
4
5
|
export declare function htmlTokenListContains(value: string | null, token: string): boolean;
|
|
5
6
|
export declare function createNonceAttribute(nonce?: string): string;
|