vinext 0.0.55 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -15
- package/dist/build/assets-ignore.d.ts +32 -0
- package/dist/build/assets-ignore.js +48 -0
- package/dist/build/clean-output.d.ts +1 -2
- package/dist/build/clean-output.js +0 -2
- package/dist/build/client-build-config.d.ts +42 -3
- package/dist/build/client-build-config.js +86 -4
- package/dist/build/css-url-assets.d.ts +29 -0
- package/dist/build/css-url-assets.js +211 -0
- package/dist/build/google-fonts/build-url.d.ts +1 -2
- package/dist/build/google-fonts/build-url.js +0 -2
- package/dist/build/google-fonts/fallback-metrics-data.js +0 -2
- package/dist/build/google-fonts/fallback-metrics.d.ts +1 -2
- package/dist/build/google-fonts/fallback-metrics.js +0 -2
- package/dist/build/google-fonts/font-data.js +0 -2
- package/dist/build/google-fonts/font-metadata.d.ts +1 -2
- package/dist/build/google-fonts/font-metadata.js +0 -2
- package/dist/build/google-fonts/get-axes.d.ts +1 -2
- package/dist/build/google-fonts/get-axes.js +0 -2
- package/dist/build/google-fonts/sort-variants.d.ts +1 -2
- package/dist/build/google-fonts/sort-variants.js +0 -2
- package/dist/build/google-fonts/validate.d.ts +1 -2
- package/dist/build/google-fonts/validate.js +0 -2
- package/dist/build/inline-css.d.ts +1 -2
- package/dist/build/inline-css.js +0 -2
- package/dist/build/layout-classification-types.d.ts +1 -2
- package/dist/build/layout-classification.d.ts +2 -3
- package/dist/build/layout-classification.js +1 -3
- package/dist/build/next-client-runtime-manifests.d.ts +14 -0
- package/dist/build/next-client-runtime-manifests.js +39 -0
- package/dist/build/nitro-route-rules.d.ts +1 -2
- package/dist/build/nitro-route-rules.js +0 -2
- package/dist/build/precompress.d.ts +1 -2
- package/dist/build/precompress.js +0 -2
- package/dist/build/prerender.d.ts +2 -3
- package/dist/build/prerender.js +14 -2
- package/dist/build/report.d.ts +1 -2
- package/dist/build/report.js +0 -2
- package/dist/build/route-classification-injector.d.ts +1 -2
- package/dist/build/route-classification-injector.js +4 -6
- package/dist/build/route-classification-manifest.d.ts +5 -6
- package/dist/build/route-classification-manifest.js +5 -7
- package/dist/build/run-prerender.d.ts +1 -2
- package/dist/build/run-prerender.js +15 -7
- package/dist/build/server-manifest.d.ts +1 -2
- package/dist/build/server-manifest.js +0 -2
- package/dist/build/ssr-manifest.d.ts +1 -2
- package/dist/build/ssr-manifest.js +2 -4
- package/dist/build/standalone.d.ts +1 -2
- package/dist/build/standalone.js +0 -2
- package/dist/build/static-export.d.ts +2 -3
- package/dist/build/static-export.js +0 -2
- package/dist/cache/cache-adapters-virtual.d.ts +50 -0
- package/dist/cache/cache-adapters-virtual.js +45 -0
- package/dist/check.d.ts +33 -2
- package/dist/check.js +306 -24
- package/dist/cli-args.d.ts +1 -2
- package/dist/cli-args.js +0 -2
- package/dist/cli.js +9 -13
- package/dist/client/instrumentation-client-inject.d.ts +1 -2
- package/dist/client/instrumentation-client-inject.js +0 -2
- package/dist/client/instrumentation-client-state.d.ts +1 -2
- package/dist/client/instrumentation-client-state.js +0 -2
- package/dist/client/instrumentation-client.d.ts +1 -2
- package/dist/client/instrumentation-client.js +0 -2
- package/dist/client/navigation-runtime.d.ts +9 -2
- package/dist/client/navigation-runtime.js +1 -3
- package/dist/client/pages-router-link-navigation.d.ts +1 -2
- package/dist/client/pages-router-link-navigation.js +0 -2
- package/dist/client/validate-module-path.d.ts +1 -2
- package/dist/client/validate-module-path.js +0 -2
- package/dist/client/vinext-next-data.d.ts +3 -3
- package/dist/client/vinext-next-data.js +0 -2
- package/dist/client/window-next.d.ts +1 -2
- package/dist/client/window-next.js +0 -2
- package/dist/cloudflare/index.d.ts +1 -1
- package/dist/cloudflare/index.js +1 -1
- package/dist/cloudflare/src/cache/cdn-adapter.runtime.js +97 -0
- package/dist/cloudflare/{kv-cache-handler.d.ts → src/cache/kv-data-adapter.runtime.d.ts} +25 -6
- package/dist/cloudflare/{kv-cache-handler.js → src/cache/kv-data-adapter.runtime.js} +36 -28
- package/dist/cloudflare/src/utils/cache-control-metadata.js +20 -0
- package/dist/cloudflare/tpr.d.ts +2 -3
- package/dist/cloudflare/tpr.js +8 -8
- package/dist/config/config-matchers.d.ts +20 -2
- package/dist/config/config-matchers.js +35 -3
- package/dist/config/dotenv.d.ts +1 -2
- package/dist/config/dotenv.js +0 -2
- package/dist/config/next-config.d.ts +32 -5
- package/dist/config/next-config.js +53 -6
- package/dist/config/tsconfig-paths.d.ts +1 -2
- package/dist/config/tsconfig-paths.js +3 -7
- package/dist/deploy.d.ts +48 -3
- package/dist/deploy.js +180 -415
- package/dist/entries/app-browser-entry.d.ts +1 -2
- package/dist/entries/app-browser-entry.js +0 -2
- package/dist/entries/app-rsc-entry.d.ts +12 -6
- package/dist/entries/app-rsc-entry.js +101 -62
- package/dist/entries/app-rsc-manifest.d.ts +1 -2
- package/dist/entries/app-rsc-manifest.js +40 -9
- package/dist/entries/app-ssr-entry.d.ts +1 -2
- package/dist/entries/app-ssr-entry.js +0 -2
- package/dist/entries/pages-client-entry.d.ts +3 -3
- package/dist/entries/pages-client-entry.js +16 -5
- package/dist/entries/pages-entry-helpers.d.ts +2 -11
- package/dist/entries/pages-entry-helpers.js +1 -20
- package/dist/entries/pages-server-entry.d.ts +2 -3
- package/dist/entries/pages-server-entry.js +98 -703
- package/dist/entries/runtime-entry-module.d.ts +1 -2
- package/dist/entries/runtime-entry-module.js +0 -2
- package/dist/index.d.ts +22 -2
- package/dist/index.js +376 -316
- package/dist/init.d.ts +1 -2
- package/dist/init.js +1 -3
- package/dist/plugins/ast-utils.d.ts +20 -0
- package/dist/plugins/ast-utils.js +78 -0
- package/dist/plugins/async-hooks-stub.d.ts +1 -2
- package/dist/plugins/async-hooks-stub.js +0 -2
- package/dist/plugins/client-reference-dedup.d.ts +1 -2
- package/dist/plugins/client-reference-dedup.js +4 -8
- package/dist/plugins/css-data-url.d.ts +1 -2
- package/dist/plugins/css-data-url.js +0 -2
- package/dist/plugins/fonts.d.ts +13 -3
- package/dist/plugins/fonts.js +19 -13
- package/dist/plugins/import-meta-url.d.ts +2 -2
- package/dist/plugins/import-meta-url.js +187 -33
- package/dist/plugins/instrumentation-client.d.ts +1 -2
- package/dist/plugins/instrumentation-client.js +0 -2
- package/dist/plugins/middleware-server-only.d.ts +1 -2
- package/dist/plugins/middleware-server-only.js +0 -2
- package/dist/plugins/og-assets.d.ts +32 -8
- package/dist/plugins/og-assets.js +126 -34
- package/dist/plugins/optimize-imports.d.ts +1 -2
- package/dist/plugins/optimize-imports.js +9 -17
- package/dist/plugins/postcss.d.ts +1 -2
- package/dist/plugins/postcss.js +18 -16
- package/dist/plugins/remove-console.d.ts +1 -2
- package/dist/plugins/remove-console.js +0 -2
- package/dist/plugins/require-context.d.ts +6 -0
- package/dist/plugins/require-context.js +184 -0
- package/dist/plugins/rsc-client-reference-loaders.d.ts +1 -2
- package/dist/plugins/rsc-client-reference-loaders.js +0 -2
- package/dist/plugins/rsc-client-shim-excludes.d.ts +1 -2
- package/dist/plugins/rsc-client-shim-excludes.js +0 -2
- package/dist/plugins/sass.d.ts +1 -2
- package/dist/plugins/sass.js +0 -2
- package/dist/plugins/server-externals-manifest.d.ts +1 -2
- package/dist/plugins/server-externals-manifest.js +0 -2
- package/dist/plugins/strip-server-exports.d.ts +1 -2
- package/dist/plugins/strip-server-exports.js +0 -2
- package/dist/routing/app-route-graph.d.ts +14 -10
- package/dist/routing/app-route-graph.js +146 -35
- package/dist/routing/app-router.d.ts +1 -2
- package/dist/routing/app-router.js +0 -2
- package/dist/routing/file-matcher.d.ts +6 -2
- package/dist/routing/file-matcher.js +15 -7
- package/dist/routing/pages-router.d.ts +1 -2
- package/dist/routing/pages-router.js +0 -2
- package/dist/routing/route-matching.d.ts +1 -2
- package/dist/routing/route-matching.js +0 -2
- package/dist/routing/route-pattern.d.ts +2 -2
- package/dist/routing/route-pattern.js +16 -3
- package/dist/routing/route-trie.d.ts +1 -2
- package/dist/routing/route-trie.js +0 -2
- package/dist/routing/route-validation.d.ts +1 -2
- package/dist/routing/route-validation.js +0 -2
- package/dist/routing/utils.d.ts +44 -2
- package/dist/routing/utils.js +62 -3
- package/dist/server/api-handler.d.ts +1 -2
- package/dist/server/api-handler.js +4 -2
- package/dist/server/app-bfcache-id.d.ts +5 -0
- package/dist/server/app-bfcache-id.js +5 -0
- package/dist/server/app-browser-action-result.d.ts +1 -2
- package/dist/server/app-browser-action-result.js +0 -2
- package/dist/server/app-browser-client-reuse-manifest.d.ts +12 -0
- package/dist/server/app-browser-client-reuse-manifest.js +101 -0
- package/dist/server/app-browser-entry.js +244 -88
- package/dist/server/app-browser-error.d.ts +1 -2
- package/dist/server/app-browser-error.js +0 -2
- package/dist/server/app-browser-hydration.d.ts +1 -2
- package/dist/server/app-browser-hydration.js +0 -2
- package/dist/server/app-browser-interception-context.d.ts +2 -2
- package/dist/server/app-browser-interception-context.js +15 -4
- package/dist/server/app-browser-mpa-navigation.d.ts +2 -2
- package/dist/server/app-browser-mpa-navigation.js +9 -3
- package/dist/server/app-browser-navigation-controller.d.ts +15 -4
- package/dist/server/app-browser-navigation-controller.js +80 -4
- package/dist/server/app-browser-popstate.d.ts +12 -4
- package/dist/server/app-browser-popstate.js +19 -6
- package/dist/server/app-browser-rsc-redirect.d.ts +1 -2
- package/dist/server/app-browser-rsc-redirect.js +0 -2
- package/dist/server/app-browser-state.d.ts +31 -4
- package/dist/server/app-browser-state.js +196 -10
- package/dist/server/app-browser-stream.d.ts +1 -2
- package/dist/server/app-browser-stream.js +0 -2
- package/dist/server/app-browser-visible-commit.d.ts +2 -3
- package/dist/server/app-browser-visible-commit.js +30 -21
- package/dist/server/app-client-reference-preloader.d.ts +1 -2
- package/dist/server/app-client-reference-preloader.js +0 -2
- package/dist/server/app-elements-wire.d.ts +14 -8
- package/dist/server/app-elements-wire.js +45 -24
- package/dist/server/app-elements.d.ts +2 -3
- package/dist/server/app-elements.js +2 -4
- package/dist/server/app-fallback-renderer.d.ts +5 -5
- package/dist/server/app-fallback-renderer.js +4 -3
- package/dist/server/app-history-state.d.ts +62 -2
- package/dist/server/app-history-state.js +176 -10
- package/dist/server/app-hook-warning-suppression.d.ts +1 -2
- package/dist/server/app-hook-warning-suppression.js +0 -2
- package/dist/server/app-inline-css-client.d.ts +1 -2
- package/dist/server/app-inline-css-client.js +0 -2
- package/dist/server/app-interception-context-header.d.ts +1 -2
- package/dist/server/app-interception-context-header.js +0 -2
- package/dist/server/app-layout-param-observation.d.ts +15 -2
- package/dist/server/app-layout-param-observation.js +46 -8
- package/dist/server/app-middleware.d.ts +1 -2
- package/dist/server/app-middleware.js +0 -2
- package/dist/server/app-mounted-slots-header.d.ts +1 -2
- package/dist/server/app-mounted-slots-header.js +0 -2
- package/dist/server/app-optimistic-routing.d.ts +1 -2
- package/dist/server/app-optimistic-routing.js +0 -2
- package/dist/server/app-page-boundary-render.d.ts +4 -3
- package/dist/server/app-page-boundary-render.js +59 -28
- package/dist/server/app-page-boundary.d.ts +11 -2
- package/dist/server/app-page-boundary.js +13 -4
- package/dist/server/app-page-cache.d.ts +3 -3
- package/dist/server/app-page-cache.js +36 -11
- package/dist/server/app-page-dispatch.d.ts +25 -5
- package/dist/server/app-page-dispatch.js +122 -25
- package/dist/server/app-page-element-builder.d.ts +4 -2
- package/dist/server/app-page-element-builder.js +31 -21
- package/dist/server/app-page-execution.d.ts +8 -3
- package/dist/server/app-page-execution.js +55 -24
- package/dist/server/app-page-head.d.ts +1 -2
- package/dist/server/app-page-head.js +6 -6
- package/dist/server/app-page-method.d.ts +1 -2
- package/dist/server/app-page-method.js +0 -2
- package/dist/server/app-page-params.d.ts +1 -2
- package/dist/server/app-page-params.js +0 -2
- package/dist/server/app-page-probe.d.ts +79 -2
- package/dist/server/app-page-probe.js +89 -9
- package/dist/server/app-page-render-identity.d.ts +1 -2
- package/dist/server/app-page-render-identity.js +0 -2
- package/dist/server/app-page-render-observation.d.ts +1 -2
- package/dist/server/app-page-render-observation.js +0 -2
- package/dist/server/app-page-render.d.ts +15 -3
- package/dist/server/app-page-render.js +171 -12
- package/dist/server/app-page-request.d.ts +12 -9
- package/dist/server/app-page-request.js +12 -11
- package/dist/server/app-page-response.d.ts +4 -4
- package/dist/server/app-page-response.js +6 -4
- package/dist/server/app-page-route-wiring.d.ts +14 -3
- package/dist/server/app-page-route-wiring.js +65 -12
- package/dist/server/app-page-search-params-observation.d.ts +10 -0
- package/dist/server/app-page-search-params-observation.js +20 -0
- package/dist/server/app-page-segment-state.d.ts +1 -2
- package/dist/server/app-page-segment-state.js +1 -8
- package/dist/server/app-page-stream.d.ts +54 -9
- package/dist/server/app-page-stream.js +61 -10
- package/dist/server/app-pages-bridge.d.ts +41 -0
- package/dist/server/app-pages-bridge.js +54 -0
- package/dist/server/app-post-middleware-context.d.ts +1 -2
- package/dist/server/app-post-middleware-context.js +0 -2
- package/dist/server/app-ppr-fallback-shell.d.ts +21 -0
- package/dist/server/app-ppr-fallback-shell.js +82 -0
- package/dist/server/app-prerender-endpoints.d.ts +1 -2
- package/dist/server/app-prerender-endpoints.js +0 -2
- package/dist/server/app-prerender-static-params.d.ts +15 -2
- package/dist/server/app-prerender-static-params.js +44 -13
- package/dist/server/app-render-dependency.d.ts +3 -2
- package/dist/server/app-render-dependency.js +9 -3
- package/dist/server/app-request-context.d.ts +1 -2
- package/dist/server/app-request-context.js +0 -2
- package/dist/server/app-route-handler-cache.d.ts +2 -2
- package/dist/server/app-route-handler-cache.js +1 -2
- package/dist/server/app-route-handler-dispatch.d.ts +2 -2
- package/dist/server/app-route-handler-dispatch.js +2 -2
- package/dist/server/app-route-handler-execution.d.ts +2 -2
- package/dist/server/app-route-handler-execution.js +3 -4
- package/dist/server/app-route-handler-policy.d.ts +1 -2
- package/dist/server/app-route-handler-policy.js +0 -2
- package/dist/server/app-route-handler-response.d.ts +2 -3
- package/dist/server/app-route-handler-response.js +7 -6
- package/dist/server/app-route-handler-runtime.d.ts +2 -2
- package/dist/server/app-route-handler-runtime.js +3 -4
- package/dist/server/app-route-module-loader.d.ts +43 -0
- package/dist/server/app-route-module-loader.js +32 -0
- package/dist/server/app-router-entry.d.ts +1 -2
- package/dist/server/app-router-entry.js +2 -2
- package/dist/server/app-rsc-cache-busting.d.ts +10 -2
- package/dist/server/app-rsc-cache-busting.js +13 -4
- package/dist/server/app-rsc-embedded-chunks.d.ts +1 -2
- package/dist/server/app-rsc-embedded-chunks.js +0 -2
- package/dist/server/app-rsc-error-handler.d.ts +1 -2
- package/dist/server/app-rsc-error-handler.js +0 -2
- package/dist/server/app-rsc-errors.d.ts +1 -2
- package/dist/server/app-rsc-errors.js +0 -2
- package/dist/server/app-rsc-handler.d.ts +17 -2
- package/dist/server/app-rsc-handler.js +24 -15
- package/dist/server/app-rsc-render-mode.d.ts +1 -2
- package/dist/server/app-rsc-render-mode.js +0 -2
- package/dist/server/app-rsc-request-normalization.d.ts +4 -5
- package/dist/server/app-rsc-request-normalization.js +2 -4
- package/dist/server/app-rsc-response-finalizer.d.ts +1 -2
- package/dist/server/app-rsc-response-finalizer.js +2 -2
- package/dist/server/app-rsc-route-matching.d.ts +20 -2
- package/dist/server/app-rsc-route-matching.js +29 -6
- package/dist/server/app-segment-config.d.ts +4 -2
- package/dist/server/app-segment-config.js +8 -2
- package/dist/server/app-server-action-execution.d.ts +18 -3
- package/dist/server/app-server-action-execution.js +75 -18
- package/dist/server/app-ssr-entry.d.ts +11 -4
- package/dist/server/app-ssr-entry.js +47 -15
- package/dist/server/app-ssr-error-meta.d.ts +1 -2
- package/dist/server/app-ssr-error-meta.js +0 -2
- package/dist/server/app-ssr-stream.d.ts +1 -2
- package/dist/server/app-ssr-stream.js +31 -3
- package/dist/server/app-static-generation.d.ts +1 -2
- package/dist/server/app-static-generation.js +0 -2
- package/dist/server/app-visited-response-cache.d.ts +23 -0
- package/dist/server/app-visited-response-cache.js +19 -0
- package/dist/server/artifact-compatibility.d.ts +1 -2
- package/dist/server/artifact-compatibility.js +2 -6
- package/dist/server/cache-control.d.ts +15 -2
- package/dist/server/cache-control.js +21 -3
- package/dist/server/cache-headers.d.ts +1 -2
- package/dist/server/cache-headers.js +0 -2
- package/dist/server/cache-proof.d.ts +1 -2
- package/dist/server/cache-proof.js +0 -2
- package/dist/server/client-reuse-manifest.d.ts +3 -3
- package/dist/server/client-reuse-manifest.js +6 -10
- package/dist/server/client-trace-metadata.d.ts +1 -2
- package/dist/server/client-trace-metadata.js +0 -2
- package/dist/server/cookie-utils.d.ts +1 -2
- package/dist/server/cookie-utils.js +0 -2
- package/dist/server/csp.d.ts +1 -2
- package/dist/server/csp.js +0 -2
- package/dist/server/default-global-error-module.d.ts +1 -2
- package/dist/server/default-global-error-module.js +0 -2
- package/dist/server/default-not-found-module.d.ts +1 -2
- package/dist/server/default-not-found-module.js +0 -2
- package/dist/server/dev-error-overlay-store.d.ts +20 -4
- package/dist/server/dev-error-overlay-store.js +23 -4
- package/dist/server/dev-error-overlay.d.ts +39 -3
- package/dist/server/dev-error-overlay.js +952 -164
- package/dist/server/dev-initial-server-error.d.ts +9 -0
- package/dist/server/dev-initial-server-error.js +26 -0
- package/dist/server/dev-lockfile.d.ts +1 -2
- package/dist/server/dev-lockfile.js +0 -2
- package/dist/server/dev-module-runner.d.ts +1 -2
- package/dist/server/dev-module-runner.js +0 -2
- package/dist/server/dev-origin-check.d.ts +1 -2
- package/dist/server/dev-origin-check.js +0 -2
- package/dist/server/dev-route-files.d.ts +1 -2
- package/dist/server/dev-route-files.js +0 -2
- package/dist/server/dev-server.d.ts +3 -4
- package/dist/server/dev-server.js +129 -49
- package/dist/server/dev-stack-sourcemap-endpoint.d.ts +4 -0
- package/dist/server/dev-stack-sourcemap-endpoint.js +4 -0
- package/dist/server/dev-stack-sourcemap.d.ts +43 -0
- package/dist/server/dev-stack-sourcemap.js +443 -0
- package/dist/server/document-initial-head.d.ts +1 -2
- package/dist/server/document-initial-head.js +0 -2
- package/dist/server/edge-api-runtime.d.ts +1 -2
- package/dist/server/edge-api-runtime.js +0 -2
- package/dist/server/file-based-metadata.d.ts +1 -2
- package/dist/server/file-based-metadata.js +0 -2
- package/dist/server/headers.d.ts +3 -2
- package/dist/server/headers.js +3 -3
- package/dist/server/html.d.ts +1 -2
- package/dist/server/html.js +0 -2
- package/dist/server/http-error-responses.d.ts +1 -2
- package/dist/server/http-error-responses.js +0 -2
- package/dist/server/image-optimization.d.ts +1 -2
- package/dist/server/image-optimization.js +0 -2
- package/dist/server/implicit-tags.d.ts +1 -2
- package/dist/server/implicit-tags.js +0 -2
- package/dist/server/instrumentation-runtime.d.ts +1 -2
- package/dist/server/instrumentation-runtime.js +0 -2
- package/dist/server/instrumentation.d.ts +1 -2
- package/dist/server/instrumentation.js +0 -2
- package/dist/server/isr-cache.d.ts +46 -3
- package/dist/server/isr-cache.js +93 -24
- package/dist/server/metadata-route-build-data.d.ts +1 -2
- package/dist/server/metadata-route-build-data.js +0 -2
- package/dist/server/metadata-route-response.d.ts +1 -2
- package/dist/server/metadata-route-response.js +0 -2
- package/dist/server/metadata-routes.d.ts +1 -2
- package/dist/server/metadata-routes.js +0 -2
- package/dist/server/middleware-matcher.d.ts +1 -2
- package/dist/server/middleware-matcher.js +0 -2
- package/dist/server/middleware-request-headers.d.ts +1 -2
- package/dist/server/middleware-request-headers.js +0 -2
- package/dist/server/middleware-response-headers.d.ts +1 -2
- package/dist/server/middleware-response-headers.js +0 -2
- package/dist/server/middleware-runtime.d.ts +1 -2
- package/dist/server/middleware-runtime.js +14 -5
- package/dist/server/middleware.d.ts +2 -3
- package/dist/server/middleware.js +0 -2
- package/dist/server/navigation-planner.d.ts +16 -2
- package/dist/server/navigation-planner.js +6 -6
- package/dist/server/navigation-trace.d.ts +1 -2
- package/dist/server/navigation-trace.js +0 -2
- package/dist/server/next-error-digest.d.ts +1 -2
- package/dist/server/next-error-digest.js +0 -2
- package/dist/server/normalize-path.d.ts +1 -2
- package/dist/server/normalize-path.js +0 -2
- package/dist/server/pages-api-route.d.ts +1 -2
- package/dist/server/pages-api-route.js +1 -3
- package/dist/server/pages-asset-tags.d.ts +66 -0
- package/dist/server/pages-asset-tags.js +116 -0
- package/dist/server/pages-body-parser-config.d.ts +1 -2
- package/dist/server/pages-body-parser-config.js +0 -2
- package/dist/server/pages-data-route.d.ts +39 -2
- package/dist/server/pages-data-route.js +46 -3
- package/dist/server/pages-default-404.d.ts +1 -2
- package/dist/server/pages-default-404.js +0 -2
- package/dist/server/pages-document-initial-props.d.ts +1 -2
- package/dist/server/pages-document-initial-props.js +0 -2
- package/dist/server/pages-get-initial-props.d.ts +17 -0
- package/dist/server/pages-get-initial-props.js +50 -0
- package/dist/server/pages-i18n.d.ts +1 -2
- package/dist/server/pages-i18n.js +0 -2
- package/dist/server/pages-media-type.d.ts +1 -2
- package/dist/server/pages-media-type.js +1 -2
- package/dist/server/pages-node-compat.d.ts +11 -2
- package/dist/server/pages-node-compat.js +38 -3
- package/dist/server/pages-page-data.d.ts +17 -10
- package/dist/server/pages-page-data.js +79 -35
- package/dist/server/pages-page-handler.d.ts +97 -0
- package/dist/server/pages-page-handler.js +348 -0
- package/dist/server/pages-page-method.d.ts +1 -2
- package/dist/server/pages-page-method.js +0 -2
- package/dist/server/pages-page-response.d.ts +11 -3
- package/dist/server/pages-page-response.js +16 -5
- package/dist/server/pages-readiness.d.ts +36 -0
- package/dist/server/pages-readiness.js +21 -0
- package/dist/server/pages-request-pipeline.d.ts +99 -0
- package/dist/server/pages-request-pipeline.js +209 -0
- package/dist/server/pages-revalidate.d.ts +15 -0
- package/dist/server/pages-revalidate.js +19 -0
- package/dist/server/pages-serializable-props.d.ts +1 -2
- package/dist/server/pages-serializable-props.js +0 -2
- package/dist/server/pregenerated-concrete-paths.d.ts +32 -0
- package/dist/server/pregenerated-concrete-paths.js +78 -0
- package/dist/server/prerender-route-params.d.ts +13 -3
- package/dist/server/prerender-route-params.js +30 -11
- package/dist/server/prerender-work-unit-setup.d.ts +1 -2
- package/dist/server/prerender-work-unit-setup.js +0 -2
- package/dist/server/prod-server.d.ts +8 -6
- package/dist/server/prod-server.js +101 -219
- package/dist/server/proxy-trust.d.ts +1 -2
- package/dist/server/proxy-trust.js +0 -2
- package/dist/server/request-log.d.ts +1 -2
- package/dist/server/request-log.js +0 -2
- package/dist/server/request-pipeline.d.ts +14 -2
- package/dist/server/request-pipeline.js +42 -3
- package/dist/server/rsc-stream-hints.d.ts +1 -2
- package/dist/server/rsc-stream-hints.js +0 -2
- package/dist/server/seed-cache.d.ts +6 -2
- package/dist/server/seed-cache.js +10 -8
- package/dist/server/server-action-not-found.d.ts +1 -2
- package/dist/server/server-action-not-found.js +0 -2
- package/dist/server/server-globals.d.ts +1 -2
- package/dist/server/server-globals.js +0 -2
- package/dist/server/skip-cache-proof.d.ts +1 -2
- package/dist/server/skip-cache-proof.js +0 -2
- package/dist/server/socket-error-backstop.d.ts +19 -2
- package/dist/server/socket-error-backstop.js +77 -6
- package/dist/server/static-file-cache.d.ts +1 -2
- package/dist/server/static-file-cache.js +0 -2
- package/dist/server/static-layout-client-reuse-proof.d.ts +1 -2
- package/dist/server/static-layout-client-reuse-proof.js +0 -2
- package/dist/server/streaming-metadata.d.ts +1 -2
- package/dist/server/streaming-metadata.js +0 -2
- package/dist/server/worker-utils.d.ts +1 -2
- package/dist/server/worker-utils.js +3 -6
- package/dist/shims/amp.d.ts +1 -2
- package/dist/shims/amp.js +0 -2
- package/dist/shims/app-router-scroll-state.d.ts +1 -2
- package/dist/shims/app-router-scroll-state.js +0 -2
- package/dist/shims/app-router-scroll.d.ts +3 -5
- package/dist/shims/app-router-scroll.js +22 -6
- package/dist/shims/app.d.ts +1 -2
- package/dist/shims/app.js +0 -2
- package/dist/shims/before-interactive-context.d.ts +1 -2
- package/dist/shims/before-interactive-context.js +0 -2
- package/dist/shims/cache-for-request.d.ts +1 -2
- package/dist/shims/cache-for-request.js +0 -2
- package/dist/shims/cache-runtime.d.ts +20 -5
- package/dist/shims/cache-runtime.js +66 -31
- package/dist/shims/cache.d.ts +48 -7
- package/dist/shims/cache.js +79 -20
- package/dist/shims/cdn-cache.d.ts +125 -0
- package/dist/shims/cdn-cache.js +100 -0
- package/dist/shims/client-hook-error.d.ts +1 -2
- package/dist/shims/client-hook-error.js +0 -2
- package/dist/shims/client-locale.d.ts +1 -2
- package/dist/shims/client-locale.js +1 -3
- package/dist/shims/compat-router.d.ts +1 -2
- package/dist/shims/compat-router.js +0 -2
- package/dist/shims/config.d.ts +1 -2
- package/dist/shims/config.js +0 -2
- package/dist/shims/constants.d.ts +1 -2
- package/dist/shims/constants.js +0 -2
- package/dist/shims/default-global-error.d.ts +3 -4
- package/dist/shims/default-global-error.js +0 -2
- package/dist/shims/default-not-found.d.ts +1 -2
- package/dist/shims/default-not-found.js +0 -2
- package/dist/shims/document.d.ts +5 -7
- package/dist/shims/document.js +0 -2
- package/dist/shims/dynamic.d.ts +1 -2
- package/dist/shims/dynamic.js +0 -2
- package/dist/shims/error-boundary.d.ts +32 -18
- package/dist/shims/error-boundary.js +43 -3
- package/dist/shims/error.d.ts +1 -2
- package/dist/shims/error.js +0 -2
- package/dist/shims/fetch-cache.d.ts +14 -2
- package/dist/shims/fetch-cache.js +20 -5
- package/dist/shims/font-google-base.d.ts +1 -2
- package/dist/shims/font-google-base.js +1 -13
- package/dist/shims/font-local.d.ts +1 -2
- package/dist/shims/font-local.js +1 -15
- package/dist/shims/font-utils.d.ts +7 -2
- package/dist/shims/font-utils.js +13 -3
- package/dist/shims/form.d.ts +12 -5
- package/dist/shims/form.js +98 -21
- package/dist/shims/hash-scroll.d.ts +2 -2
- package/dist/shims/hash-scroll.js +3 -3
- package/dist/shims/head-state.d.ts +1 -2
- package/dist/shims/head-state.js +0 -2
- package/dist/shims/head.d.ts +1 -2
- package/dist/shims/head.js +0 -2
- package/dist/shims/headers.d.ts +9 -2
- package/dist/shims/headers.js +13 -3
- package/dist/shims/i18n-context.d.ts +1 -2
- package/dist/shims/i18n-context.js +0 -2
- package/dist/shims/i18n-state.d.ts +1 -2
- package/dist/shims/i18n-state.js +0 -2
- package/dist/shims/image-config.d.ts +1 -2
- package/dist/shims/image-config.js +0 -2
- package/dist/shims/image.d.ts +1 -2
- package/dist/shims/image.js +1 -3
- package/dist/shims/internal/als-registry.d.ts +1 -2
- package/dist/shims/internal/als-registry.js +0 -2
- package/dist/shims/internal/api-utils.d.ts +1 -2
- package/dist/shims/internal/app-route-detection.d.ts +1 -2
- package/dist/shims/internal/app-route-detection.js +0 -2
- package/dist/shims/internal/app-router-context.d.ts +1 -2
- package/dist/shims/internal/app-router-context.js +0 -2
- package/dist/shims/internal/cookie-serialize.d.ts +1 -2
- package/dist/shims/internal/cookie-serialize.js +0 -2
- package/dist/shims/internal/link-status-registry.d.ts +43 -0
- package/dist/shims/internal/link-status-registry.js +42 -0
- package/dist/shims/internal/make-hanging-promise.d.ts +1 -2
- package/dist/shims/internal/make-hanging-promise.js +0 -2
- package/dist/shims/internal/pages-data-fetch-dedup.d.ts +1 -2
- package/dist/shims/internal/pages-data-fetch-dedup.js +0 -2
- package/dist/shims/internal/pages-data-target.d.ts +1 -2
- package/dist/shims/internal/pages-data-target.js +0 -2
- package/dist/shims/internal/pages-data-url.d.ts +1 -2
- package/dist/shims/internal/pages-data-url.js +0 -2
- package/dist/shims/internal/parse-cookie-header.d.ts +1 -2
- package/dist/shims/internal/parse-cookie-header.js +0 -2
- package/dist/shims/internal/route-pattern-for-warning.d.ts +27 -0
- package/dist/shims/internal/route-pattern-for-warning.js +40 -0
- package/dist/shims/internal/router-context.d.ts +2 -4
- package/dist/shims/internal/router-context.js +0 -2
- package/dist/shims/internal/utils.d.ts +2 -2
- package/dist/shims/internal/utils.js +0 -2
- package/dist/shims/internal/work-unit-async-storage.d.ts +1 -2
- package/dist/shims/internal/work-unit-async-storage.js +0 -2
- package/dist/shims/layout-segment-context.d.ts +2 -4
- package/dist/shims/layout-segment-context.js +0 -2
- package/dist/shims/legacy-image.d.ts +1 -2
- package/dist/shims/legacy-image.js +0 -2
- package/dist/shims/link-prefetch.d.ts +1 -2
- package/dist/shims/link-prefetch.js +0 -2
- package/dist/shims/link.d.ts +2 -2
- package/dist/shims/link.js +40 -20
- package/dist/shims/metadata.d.ts +4 -5
- package/dist/shims/metadata.js +1 -3
- package/dist/shims/navigation-state.d.ts +1 -2
- package/dist/shims/navigation-state.js +0 -2
- package/dist/shims/navigation.d.ts +25 -9
- package/dist/shims/navigation.js +251 -46
- package/dist/shims/navigation.react-server.d.ts +1 -2
- package/dist/shims/navigation.react-server.js +0 -2
- package/dist/shims/offline.d.ts +1 -2
- package/dist/shims/offline.js +0 -2
- package/dist/shims/og.d.ts +1 -2
- package/dist/shims/og.js +2 -4
- package/dist/shims/pages-router-runtime.d.ts +7 -2
- package/dist/shims/pages-router-runtime.js +11 -3
- package/dist/shims/ppr-fallback-shell.d.ts +29 -0
- package/dist/shims/ppr-fallback-shell.js +149 -0
- package/dist/shims/readonly-url-search-params.d.ts +1 -2
- package/dist/shims/readonly-url-search-params.js +0 -2
- package/dist/shims/request-context.d.ts +9 -5
- package/dist/shims/request-context.js +0 -2
- package/dist/shims/request-state-types.d.ts +1 -1
- package/dist/shims/root-params.d.ts +1 -2
- package/dist/shims/root-params.js +0 -2
- package/dist/shims/router-state.d.ts +2 -2
- package/dist/shims/router-state.js +2 -2
- package/dist/shims/router.d.ts +6 -4
- package/dist/shims/router.js +262 -40
- package/dist/shims/script-nonce-context.d.ts +1 -2
- package/dist/shims/script-nonce-context.js +0 -2
- package/dist/shims/script.d.ts +1 -2
- package/dist/shims/script.js +0 -2
- package/dist/shims/server.d.ts +1 -2
- package/dist/shims/server.js +0 -2
- package/dist/shims/slot.d.ts +11 -4
- package/dist/shims/slot.js +121 -9
- package/dist/shims/thenable-params.d.ts +2 -2
- package/dist/shims/thenable-params.js +107 -12
- package/dist/shims/unified-request-context.d.ts +1 -2
- package/dist/shims/unified-request-context.js +0 -2
- package/dist/shims/unrecognized-action-error.d.ts +1 -2
- package/dist/shims/unrecognized-action-error.js +0 -2
- package/dist/shims/url-safety.d.ts +1 -2
- package/dist/shims/url-safety.js +0 -2
- package/dist/shims/url-utils.d.ts +1 -2
- package/dist/shims/url-utils.js +0 -2
- package/dist/shims/use-merged-ref.d.ts +1 -2
- package/dist/shims/use-merged-ref.js +0 -2
- package/dist/shims/web-vitals.d.ts +1 -2
- package/dist/shims/web-vitals.js +0 -2
- package/dist/typegen.d.ts +1 -2
- package/dist/typegen.js +2 -9
- package/dist/utils/asset-prefix.d.ts +1 -2
- package/dist/utils/asset-prefix.js +0 -2
- package/dist/utils/base-path.d.ts +1 -2
- package/dist/utils/base-path.js +0 -2
- package/dist/utils/cache-control-metadata.d.ts +1 -4
- package/dist/utils/cache-control-metadata.js +1 -3
- package/dist/utils/client-build-manifest.d.ts +8 -2
- package/dist/utils/client-build-manifest.js +30 -7
- package/dist/utils/client-entry-manifest.d.ts +11 -0
- package/dist/utils/client-entry-manifest.js +29 -0
- package/dist/utils/compare.d.ts +4 -0
- package/dist/utils/compare.js +8 -0
- package/dist/utils/dev-error-recovery-event.d.ts +4 -0
- package/dist/utils/dev-error-recovery-event.js +4 -0
- package/dist/utils/domain-locale.d.ts +1 -2
- package/dist/utils/domain-locale.js +2 -4
- package/dist/utils/encode-cache-tag.d.ts +1 -2
- package/dist/utils/encode-cache-tag.js +0 -2
- package/dist/utils/error-cause.d.ts +1 -2
- package/dist/utils/error-cause.js +0 -2
- package/dist/utils/hash.d.ts +1 -2
- package/dist/utils/hash.js +0 -2
- package/dist/utils/html-limited-bots.d.ts +1 -2
- package/dist/utils/html-limited-bots.js +0 -2
- package/dist/utils/lazy-chunks.d.ts +1 -2
- package/dist/utils/lazy-chunks.js +0 -2
- package/dist/utils/manifest-paths.d.ts +8 -3
- package/dist/utils/manifest-paths.js +15 -3
- package/dist/utils/mdx-scan.d.ts +1 -2
- package/dist/utils/mdx-scan.js +0 -2
- package/dist/utils/navigation-signal.d.ts +1 -2
- package/dist/utils/navigation-signal.js +0 -2
- package/dist/utils/number.d.ts +4 -0
- package/dist/utils/number.js +6 -0
- package/dist/utils/path.d.ts +4 -2
- package/dist/utils/path.js +5 -3
- package/dist/utils/prerender-output-paths.d.ts +1 -2
- package/dist/utils/prerender-output-paths.js +0 -2
- package/dist/utils/project.d.ts +1 -2
- package/dist/utils/project.js +0 -2
- package/dist/utils/promise.d.ts +4 -0
- package/dist/utils/promise.js +6 -0
- package/dist/utils/public-routes.d.ts +1 -2
- package/dist/utils/public-routes.js +0 -2
- package/dist/utils/query.d.ts +1 -2
- package/dist/utils/query.js +0 -2
- package/dist/utils/record.d.ts +1 -2
- package/dist/utils/record.js +0 -2
- package/dist/utils/regex.d.ts +4 -0
- package/dist/utils/regex.js +6 -0
- package/dist/utils/safe-json-file.d.ts +1 -2
- package/dist/utils/safe-json-file.js +0 -2
- package/dist/utils/sorted-array.d.ts +1 -2
- package/dist/utils/sorted-array.js +0 -2
- package/dist/utils/text-stream.d.ts +1 -2
- package/dist/utils/text-stream.js +0 -2
- package/dist/utils/vinext-root.d.ts +1 -2
- package/dist/utils/vinext-root.js +0 -2
- package/dist/utils/vite-version.d.ts +1 -2
- package/dist/utils/vite-version.js +0 -2
- package/package.json +23 -6
- package/dist/build/clean-output.js.map +0 -1
- package/dist/build/client-build-config.js.map +0 -1
- package/dist/build/google-fonts/build-url.js.map +0 -1
- package/dist/build/google-fonts/fallback-metrics-data.js.map +0 -1
- package/dist/build/google-fonts/fallback-metrics.js.map +0 -1
- package/dist/build/google-fonts/font-data.js.map +0 -1
- package/dist/build/google-fonts/font-metadata.js.map +0 -1
- package/dist/build/google-fonts/get-axes.js.map +0 -1
- package/dist/build/google-fonts/sort-variants.js.map +0 -1
- package/dist/build/google-fonts/validate.js.map +0 -1
- package/dist/build/inline-css.js.map +0 -1
- package/dist/build/layout-classification.js.map +0 -1
- package/dist/build/nitro-route-rules.js.map +0 -1
- package/dist/build/precompress.js.map +0 -1
- package/dist/build/prerender.js.map +0 -1
- package/dist/build/report.js.map +0 -1
- package/dist/build/route-classification-injector.js.map +0 -1
- package/dist/build/route-classification-manifest.js.map +0 -1
- package/dist/build/run-prerender.js.map +0 -1
- package/dist/build/server-manifest.js.map +0 -1
- package/dist/build/ssr-manifest.js.map +0 -1
- package/dist/build/standalone.js.map +0 -1
- package/dist/build/static-export.js.map +0 -1
- package/dist/check.js.map +0 -1
- package/dist/cli-args.js.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/client/instrumentation-client-inject.js.map +0 -1
- package/dist/client/instrumentation-client-state.js.map +0 -1
- package/dist/client/instrumentation-client.js.map +0 -1
- package/dist/client/navigation-runtime.js.map +0 -1
- package/dist/client/pages-router-link-navigation.js.map +0 -1
- package/dist/client/validate-module-path.js.map +0 -1
- package/dist/client/vinext-next-data.js.map +0 -1
- package/dist/client/window-next.js.map +0 -1
- package/dist/cloudflare/kv-cache-handler.js.map +0 -1
- package/dist/cloudflare/tpr.js.map +0 -1
- package/dist/config/config-matchers.js.map +0 -1
- package/dist/config/dotenv.js.map +0 -1
- package/dist/config/next-config.js.map +0 -1
- package/dist/config/tsconfig-paths.js.map +0 -1
- package/dist/deploy.js.map +0 -1
- package/dist/entries/app-browser-entry.js.map +0 -1
- package/dist/entries/app-rsc-entry.js.map +0 -1
- package/dist/entries/app-rsc-manifest.js.map +0 -1
- package/dist/entries/app-ssr-entry.js.map +0 -1
- package/dist/entries/pages-client-entry.js.map +0 -1
- package/dist/entries/pages-entry-helpers.js.map +0 -1
- package/dist/entries/pages-server-entry.js.map +0 -1
- package/dist/entries/runtime-entry-module.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/init.js.map +0 -1
- package/dist/plugins/async-hooks-stub.js.map +0 -1
- package/dist/plugins/client-reference-dedup.js.map +0 -1
- package/dist/plugins/css-data-url.js.map +0 -1
- package/dist/plugins/fonts.js.map +0 -1
- package/dist/plugins/import-meta-url.js.map +0 -1
- package/dist/plugins/instrumentation-client.js.map +0 -1
- package/dist/plugins/middleware-server-only.js.map +0 -1
- package/dist/plugins/og-assets.js.map +0 -1
- package/dist/plugins/optimize-imports.js.map +0 -1
- package/dist/plugins/postcss.js.map +0 -1
- package/dist/plugins/remove-console.js.map +0 -1
- package/dist/plugins/rsc-client-reference-loaders.js.map +0 -1
- package/dist/plugins/rsc-client-shim-excludes.js.map +0 -1
- package/dist/plugins/sass.js.map +0 -1
- package/dist/plugins/server-externals-manifest.js.map +0 -1
- package/dist/plugins/strip-server-exports.js.map +0 -1
- package/dist/routing/app-route-graph.js.map +0 -1
- package/dist/routing/app-router.js.map +0 -1
- package/dist/routing/file-matcher.js.map +0 -1
- package/dist/routing/pages-router.js.map +0 -1
- package/dist/routing/route-matching.js.map +0 -1
- package/dist/routing/route-pattern.js.map +0 -1
- package/dist/routing/route-trie.js.map +0 -1
- package/dist/routing/route-validation.js.map +0 -1
- package/dist/routing/utils.js.map +0 -1
- package/dist/server/api-handler.js.map +0 -1
- package/dist/server/app-browser-action-result.js.map +0 -1
- package/dist/server/app-browser-entry.js.map +0 -1
- package/dist/server/app-browser-error.js.map +0 -1
- package/dist/server/app-browser-hydration.js.map +0 -1
- package/dist/server/app-browser-interception-context.js.map +0 -1
- package/dist/server/app-browser-mpa-navigation.js.map +0 -1
- package/dist/server/app-browser-navigation-controller.js.map +0 -1
- package/dist/server/app-browser-popstate.js.map +0 -1
- package/dist/server/app-browser-rsc-redirect.js.map +0 -1
- package/dist/server/app-browser-state.js.map +0 -1
- package/dist/server/app-browser-stream.js.map +0 -1
- package/dist/server/app-browser-visible-commit.js.map +0 -1
- package/dist/server/app-client-reference-preloader.js.map +0 -1
- package/dist/server/app-elements-wire.js.map +0 -1
- package/dist/server/app-elements.js.map +0 -1
- package/dist/server/app-fallback-renderer.js.map +0 -1
- package/dist/server/app-history-state.js.map +0 -1
- package/dist/server/app-hook-warning-suppression.js.map +0 -1
- package/dist/server/app-inline-css-client.js.map +0 -1
- package/dist/server/app-interception-context-header.js.map +0 -1
- package/dist/server/app-layout-param-observation.js.map +0 -1
- package/dist/server/app-middleware.js.map +0 -1
- package/dist/server/app-mounted-slots-header.js.map +0 -1
- package/dist/server/app-optimistic-routing.js.map +0 -1
- package/dist/server/app-page-boundary-render.js.map +0 -1
- package/dist/server/app-page-boundary.js.map +0 -1
- package/dist/server/app-page-cache.js.map +0 -1
- package/dist/server/app-page-dispatch.js.map +0 -1
- package/dist/server/app-page-element-builder.js.map +0 -1
- package/dist/server/app-page-execution.js.map +0 -1
- package/dist/server/app-page-head.js.map +0 -1
- package/dist/server/app-page-method.js.map +0 -1
- package/dist/server/app-page-params.js.map +0 -1
- package/dist/server/app-page-probe.js.map +0 -1
- package/dist/server/app-page-render-identity.js.map +0 -1
- package/dist/server/app-page-render-observation.js.map +0 -1
- package/dist/server/app-page-render.js.map +0 -1
- package/dist/server/app-page-request.js.map +0 -1
- package/dist/server/app-page-response.js.map +0 -1
- package/dist/server/app-page-route-wiring.js.map +0 -1
- package/dist/server/app-page-segment-state.js.map +0 -1
- package/dist/server/app-page-stream.js.map +0 -1
- package/dist/server/app-post-middleware-context.js.map +0 -1
- package/dist/server/app-prerender-endpoints.js.map +0 -1
- package/dist/server/app-prerender-static-params.js.map +0 -1
- package/dist/server/app-render-dependency.js.map +0 -1
- package/dist/server/app-request-context.js.map +0 -1
- package/dist/server/app-route-handler-cache.js.map +0 -1
- package/dist/server/app-route-handler-dispatch.js.map +0 -1
- package/dist/server/app-route-handler-execution.js.map +0 -1
- package/dist/server/app-route-handler-policy.js.map +0 -1
- package/dist/server/app-route-handler-response.js.map +0 -1
- package/dist/server/app-route-handler-runtime.js.map +0 -1
- package/dist/server/app-router-entry.js.map +0 -1
- package/dist/server/app-rsc-cache-busting.js.map +0 -1
- package/dist/server/app-rsc-embedded-chunks.js.map +0 -1
- package/dist/server/app-rsc-error-handler.js.map +0 -1
- package/dist/server/app-rsc-errors.js.map +0 -1
- package/dist/server/app-rsc-handler.js.map +0 -1
- package/dist/server/app-rsc-render-mode.js.map +0 -1
- package/dist/server/app-rsc-request-normalization.js.map +0 -1
- package/dist/server/app-rsc-response-finalizer.js.map +0 -1
- package/dist/server/app-rsc-route-matching.js.map +0 -1
- package/dist/server/app-segment-config.js.map +0 -1
- package/dist/server/app-server-action-execution.js.map +0 -1
- package/dist/server/app-ssr-entry.js.map +0 -1
- package/dist/server/app-ssr-error-meta.js.map +0 -1
- package/dist/server/app-ssr-stream.js.map +0 -1
- package/dist/server/app-static-generation.js.map +0 -1
- package/dist/server/artifact-compatibility.js.map +0 -1
- package/dist/server/cache-control.js.map +0 -1
- package/dist/server/cache-headers.js.map +0 -1
- package/dist/server/cache-proof.js.map +0 -1
- package/dist/server/client-reuse-manifest.js.map +0 -1
- package/dist/server/client-trace-metadata.js.map +0 -1
- package/dist/server/cookie-utils.js.map +0 -1
- package/dist/server/csp.js.map +0 -1
- package/dist/server/default-global-error-module.js.map +0 -1
- package/dist/server/default-not-found-module.js.map +0 -1
- package/dist/server/dev-error-overlay-store.js.map +0 -1
- package/dist/server/dev-error-overlay.js.map +0 -1
- package/dist/server/dev-lockfile.js.map +0 -1
- package/dist/server/dev-module-runner.js.map +0 -1
- package/dist/server/dev-origin-check.js.map +0 -1
- package/dist/server/dev-route-files.js.map +0 -1
- package/dist/server/dev-server.js.map +0 -1
- package/dist/server/document-initial-head.js.map +0 -1
- package/dist/server/edge-api-runtime.js.map +0 -1
- package/dist/server/file-based-metadata.js.map +0 -1
- package/dist/server/headers.js.map +0 -1
- package/dist/server/html.js.map +0 -1
- package/dist/server/http-error-responses.js.map +0 -1
- package/dist/server/image-optimization.js.map +0 -1
- package/dist/server/implicit-tags.js.map +0 -1
- package/dist/server/instrumentation-runtime.js.map +0 -1
- package/dist/server/instrumentation.js.map +0 -1
- package/dist/server/isr-cache.js.map +0 -1
- package/dist/server/metadata-route-build-data.js.map +0 -1
- package/dist/server/metadata-route-response.js.map +0 -1
- package/dist/server/metadata-routes.js.map +0 -1
- package/dist/server/middleware-matcher.js.map +0 -1
- package/dist/server/middleware-request-headers.js.map +0 -1
- package/dist/server/middleware-response-headers.js.map +0 -1
- package/dist/server/middleware-runtime.js.map +0 -1
- package/dist/server/middleware.js.map +0 -1
- package/dist/server/navigation-planner.js.map +0 -1
- package/dist/server/navigation-trace.js.map +0 -1
- package/dist/server/next-error-digest.js.map +0 -1
- package/dist/server/normalize-path.js.map +0 -1
- package/dist/server/pages-api-route.js.map +0 -1
- package/dist/server/pages-body-parser-config.js.map +0 -1
- package/dist/server/pages-data-route.js.map +0 -1
- package/dist/server/pages-default-404.js.map +0 -1
- package/dist/server/pages-document-initial-props.js.map +0 -1
- package/dist/server/pages-i18n.js.map +0 -1
- package/dist/server/pages-media-type.js.map +0 -1
- package/dist/server/pages-node-compat.js.map +0 -1
- package/dist/server/pages-page-data.js.map +0 -1
- package/dist/server/pages-page-method.js.map +0 -1
- package/dist/server/pages-page-response.js.map +0 -1
- package/dist/server/pages-serializable-props.js.map +0 -1
- package/dist/server/prerender-route-params.js.map +0 -1
- package/dist/server/prerender-work-unit-setup.js.map +0 -1
- package/dist/server/prod-server.js.map +0 -1
- package/dist/server/proxy-trust.js.map +0 -1
- package/dist/server/request-log.js.map +0 -1
- package/dist/server/request-pipeline.js.map +0 -1
- package/dist/server/rsc-stream-hints.js.map +0 -1
- package/dist/server/seed-cache.js.map +0 -1
- package/dist/server/server-action-not-found.js.map +0 -1
- package/dist/server/server-globals.js.map +0 -1
- package/dist/server/skip-cache-proof.js.map +0 -1
- package/dist/server/socket-error-backstop.js.map +0 -1
- package/dist/server/static-file-cache.js.map +0 -1
- package/dist/server/static-layout-client-reuse-proof.js.map +0 -1
- package/dist/server/streaming-metadata.js.map +0 -1
- package/dist/server/worker-utils.js.map +0 -1
- package/dist/shims/amp.js.map +0 -1
- package/dist/shims/app-router-scroll-state.js.map +0 -1
- package/dist/shims/app-router-scroll.js.map +0 -1
- package/dist/shims/app.js.map +0 -1
- package/dist/shims/before-interactive-context.js.map +0 -1
- package/dist/shims/cache-for-request.js.map +0 -1
- package/dist/shims/cache-runtime.js.map +0 -1
- package/dist/shims/cache.js.map +0 -1
- package/dist/shims/client-hook-error.js.map +0 -1
- package/dist/shims/client-locale.js.map +0 -1
- package/dist/shims/compat-router.js.map +0 -1
- package/dist/shims/config.js.map +0 -1
- package/dist/shims/constants.js.map +0 -1
- package/dist/shims/default-global-error.js.map +0 -1
- package/dist/shims/default-not-found.js.map +0 -1
- package/dist/shims/document.js.map +0 -1
- package/dist/shims/dynamic.js.map +0 -1
- package/dist/shims/error-boundary.js.map +0 -1
- package/dist/shims/error.js.map +0 -1
- package/dist/shims/fetch-cache.js.map +0 -1
- package/dist/shims/font-google-base.js.map +0 -1
- package/dist/shims/font-local.js.map +0 -1
- package/dist/shims/font-utils.js.map +0 -1
- package/dist/shims/form.js.map +0 -1
- package/dist/shims/hash-scroll.js.map +0 -1
- package/dist/shims/head-state.js.map +0 -1
- package/dist/shims/head.js.map +0 -1
- package/dist/shims/headers.js.map +0 -1
- package/dist/shims/i18n-context.js.map +0 -1
- package/dist/shims/i18n-state.js.map +0 -1
- package/dist/shims/image-config.js.map +0 -1
- package/dist/shims/image.js.map +0 -1
- package/dist/shims/internal/als-registry.js.map +0 -1
- package/dist/shims/internal/app-route-detection.js.map +0 -1
- package/dist/shims/internal/app-router-context.js.map +0 -1
- package/dist/shims/internal/cookie-serialize.js.map +0 -1
- package/dist/shims/internal/make-hanging-promise.js.map +0 -1
- package/dist/shims/internal/pages-data-fetch-dedup.js.map +0 -1
- package/dist/shims/internal/pages-data-target.js.map +0 -1
- package/dist/shims/internal/pages-data-url.js.map +0 -1
- package/dist/shims/internal/parse-cookie-header.js.map +0 -1
- package/dist/shims/internal/router-context.js.map +0 -1
- package/dist/shims/internal/utils.js.map +0 -1
- package/dist/shims/internal/work-unit-async-storage.js.map +0 -1
- package/dist/shims/layout-segment-context.js.map +0 -1
- package/dist/shims/legacy-image.js.map +0 -1
- package/dist/shims/link-prefetch.js.map +0 -1
- package/dist/shims/link.js.map +0 -1
- package/dist/shims/metadata.js.map +0 -1
- package/dist/shims/navigation-state.js.map +0 -1
- package/dist/shims/navigation.js.map +0 -1
- package/dist/shims/navigation.react-server.js.map +0 -1
- package/dist/shims/offline.js.map +0 -1
- package/dist/shims/og.js.map +0 -1
- package/dist/shims/pages-router-runtime.js.map +0 -1
- package/dist/shims/readonly-url-search-params.js.map +0 -1
- package/dist/shims/request-context.js.map +0 -1
- package/dist/shims/root-params.js.map +0 -1
- package/dist/shims/router-state.js.map +0 -1
- package/dist/shims/router.js.map +0 -1
- package/dist/shims/script-nonce-context.js.map +0 -1
- package/dist/shims/script.js.map +0 -1
- package/dist/shims/server.js.map +0 -1
- package/dist/shims/slot.js.map +0 -1
- package/dist/shims/thenable-params.js.map +0 -1
- package/dist/shims/unified-request-context.js.map +0 -1
- package/dist/shims/unrecognized-action-error.js.map +0 -1
- package/dist/shims/url-safety.js.map +0 -1
- package/dist/shims/url-utils.js.map +0 -1
- package/dist/shims/use-merged-ref.js.map +0 -1
- package/dist/shims/web-vitals.js.map +0 -1
- package/dist/typegen.js.map +0 -1
- package/dist/utils/asset-prefix.js.map +0 -1
- package/dist/utils/base-path.js.map +0 -1
- package/dist/utils/cache-control-metadata.js.map +0 -1
- package/dist/utils/client-build-manifest.js.map +0 -1
- package/dist/utils/domain-locale.js.map +0 -1
- package/dist/utils/encode-cache-tag.js.map +0 -1
- package/dist/utils/error-cause.js.map +0 -1
- package/dist/utils/hash.js.map +0 -1
- package/dist/utils/html-limited-bots.js.map +0 -1
- package/dist/utils/lazy-chunks.js.map +0 -1
- package/dist/utils/manifest-paths.js.map +0 -1
- package/dist/utils/mdx-scan.js.map +0 -1
- package/dist/utils/navigation-signal.js.map +0 -1
- package/dist/utils/path.js.map +0 -1
- package/dist/utils/prerender-output-paths.js.map +0 -1
- package/dist/utils/project.js.map +0 -1
- package/dist/utils/public-routes.js.map +0 -1
- package/dist/utils/query.js.map +0 -1
- package/dist/utils/record.js.map +0 -1
- package/dist/utils/safe-json-file.js.map +0 -1
- package/dist/utils/sorted-array.js.map +0 -1
- package/dist/utils/text-stream.js.map +0 -1
- package/dist/utils/vinext-root.js.map +0 -1
- package/dist/utils/vite-version.js.map +0 -1
package/README.md
CHANGED
|
@@ -271,15 +271,6 @@ vinext deploy --experimental-tpr --tpr-window 48 # Use 48h of analytics
|
|
|
271
271
|
|
|
272
272
|
Requires a custom domain (zone analytics are unavailable on `*.workers.dev`) and `CLOUDFLARE_API_TOKEN` with Zone.Analytics read permission.
|
|
273
273
|
|
|
274
|
-
For production caching (ISR), use the built-in Cloudflare KV cache handler:
|
|
275
|
-
|
|
276
|
-
```ts
|
|
277
|
-
import { KVCacheHandler } from "vinext/cloudflare";
|
|
278
|
-
import { setCacheHandler } from "next/cache";
|
|
279
|
-
|
|
280
|
-
setCacheHandler(new KVCacheHandler(env.MY_KV_NAMESPACE));
|
|
281
|
-
```
|
|
282
|
-
|
|
283
274
|
#### Custom Vite configuration
|
|
284
275
|
|
|
285
276
|
If you need to customize the Vite config, create a `vite.config.ts`. vinext will merge its config with yours. This is required for Cloudflare Workers deployment with the App Router (RSC needs explicit plugin configuration):
|
|
@@ -533,14 +524,61 @@ Override behavior:
|
|
|
533
524
|
|
|
534
525
|
### Caching
|
|
535
526
|
|
|
536
|
-
The cache is pluggable. The default `MemoryCacheHandler` works out of the box. Swap in your own backend for production
|
|
527
|
+
The cache is pluggable. The default `MemoryCacheHandler` works out of the box. Swap in your own backend for production.
|
|
528
|
+
|
|
529
|
+
#### Configuring cache adapters from `vite.config`
|
|
530
|
+
|
|
531
|
+
Instead of wiring up cache handlers imperatively from a worker entry, you can declare them in the `vinext()` plugin config. The `@vinext/cloudflare` package ships two Cloudflare adapters for this:
|
|
532
|
+
|
|
533
|
+
- **`kvDataAdapter()`** (`@vinext/cloudflare/cache/kv-data-adapter`) — backs the `"use cache"` data cache with a Workers KV namespace.
|
|
534
|
+
- **`cdnAdapter()`** (`@vinext/cloudflare/cache/cdn-adapter`) — backs full-route CDN caching with the Workers Cache API.
|
|
537
535
|
|
|
538
536
|
```ts
|
|
539
|
-
import {
|
|
540
|
-
|
|
537
|
+
import { defineConfig } from "vite";
|
|
538
|
+
import vinext from "vinext";
|
|
539
|
+
import { cdnAdapter } from "@vinext/cloudflare/cache/cdn-adapter";
|
|
540
|
+
import { kvDataAdapter } from "@vinext/cloudflare/cache/kv-data-adapter";
|
|
541
|
+
|
|
542
|
+
export default defineConfig({
|
|
543
|
+
plugins: [
|
|
544
|
+
vinext({
|
|
545
|
+
cache: {
|
|
546
|
+
cdn: cdnAdapter(),
|
|
547
|
+
data: kvDataAdapter(),
|
|
548
|
+
},
|
|
549
|
+
}),
|
|
550
|
+
],
|
|
551
|
+
});
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
The KV data adapter reads `env[binding]` at runtime, so add the matching KV namespace to your `wrangler.jsonc`:
|
|
555
|
+
|
|
556
|
+
```jsonc
|
|
557
|
+
{
|
|
558
|
+
"kv_namespaces": [{ "binding": "VINEXT_KV_CACHE", "id": "<your-namespace-id>" }],
|
|
559
|
+
}
|
|
541
560
|
```
|
|
542
561
|
|
|
543
|
-
|
|
562
|
+
`binding` defaults to `VINEXT_KV_CACHE`, so `kvDataAdapter()` with no options works as long as that's your binding name. Other options: `appPrefix` (namespace cache keys to isolate multiple apps in one KV namespace), `ttlSeconds` (default KV `expirationTtl`, default 30 days), and `tagCacheTtlMs` (in-memory tag-invalidation cache TTL, default 5s). `cdnAdapter()` takes no options — it just needs the Workers Cache, which is always available on Workers.
|
|
563
|
+
|
|
564
|
+
Each builder returns a plain, serializable `{ adapter, options }` descriptor — **it never touches the Workers runtime**, so nothing throws at build or dev time when bindings aren't available. The actual adapter (and its `env` binding lookup) is instantiated lazily on the first request.
|
|
565
|
+
|
|
566
|
+
Registration is wired into **every router and runtime** — App Router and Pages Router, on Cloudflare Workers as well as the Node.js server (`vinext start`) and dev. It self-guards (instantiated once per isolate) and is resilient: if an adapter can't initialize on a given runtime (e.g. a KV binding doesn't exist on the Node server), vinext logs a warning and falls back to the default handler instead of failing requests.
|
|
567
|
+
|
|
568
|
+
To write your own adapter, point a slot at any module by path and default-export a factory that receives `{ env, options }` at runtime and returns a data-cache `CacheHandler` (or a CDN adapter):
|
|
569
|
+
|
|
570
|
+
```ts
|
|
571
|
+
vinext({
|
|
572
|
+
cache: {
|
|
573
|
+
data: {
|
|
574
|
+
adapter: require.resolve("./my-adapter.js"),
|
|
575
|
+
options: {
|
|
576
|
+
/* … */
|
|
577
|
+
},
|
|
578
|
+
},
|
|
579
|
+
},
|
|
580
|
+
});
|
|
581
|
+
```
|
|
544
582
|
|
|
545
583
|
## What's NOT supported (and won't be)
|
|
546
584
|
|
|
@@ -650,8 +688,6 @@ packages/vinext/
|
|
|
650
688
|
middleware.ts # middleware.ts / proxy.ts runner
|
|
651
689
|
metadata-routes.ts # File-based metadata route scanner
|
|
652
690
|
instrumentation.ts # instrumentation.ts support
|
|
653
|
-
cloudflare/
|
|
654
|
-
kv-cache-handler.ts # Cloudflare KV-backed CacheHandler for ISR
|
|
655
691
|
shims/ # One file per next/* module (33 shims + 6 internal)
|
|
656
692
|
build/
|
|
657
693
|
static-export.ts # output: 'export' support
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/build/assets-ignore.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Build metadata that must never be served by the Cloudflare ASSETS binding.
|
|
4
|
+
*
|
|
5
|
+
* On Cloudflare Workers the ASSETS binding serves any uploaded file whose path
|
|
6
|
+
* matches the request BEFORE the Worker runs, so anything written into the
|
|
7
|
+
* client output directory (`dist/client`) is publicly fetchable unless excluded.
|
|
8
|
+
* Vite writes its build/SSR manifests under `dist/client/.vite/` (enabled for
|
|
9
|
+
* Cloudflare builds so the worker entry can compute lazy chunks), which would
|
|
10
|
+
* otherwise expose the full source-file → chunk mapping — including the paths of
|
|
11
|
+
* routes that are never linked from the UI.
|
|
12
|
+
*
|
|
13
|
+
* The Node production server already blocks `/.vite/` explicitly
|
|
14
|
+
* (see `server/static-file-cache.ts`); `.assetsignore` is the equivalent guard
|
|
15
|
+
* for the Cloudflare deployment target. wrangler matches `.assetsignore`
|
|
16
|
+
* patterns with `.gitignore` semantics (via the `ignore` package), so the bare
|
|
17
|
+
* `.vite` entry excludes the directory and everything beneath it.
|
|
18
|
+
*/
|
|
19
|
+
declare const DEFAULT_VINEXT_ASSET_IGNORE_PATTERNS: readonly string[];
|
|
20
|
+
/**
|
|
21
|
+
* Ensure a `.assetsignore` in `clientDir` contains every pattern in `patterns`.
|
|
22
|
+
*
|
|
23
|
+
* Any pre-existing (user-authored) content is preserved verbatim and only the
|
|
24
|
+
* missing patterns are appended, so the result is idempotent across rebuilds
|
|
25
|
+
* and never clobbers a `.assetsignore` the developer wrote themselves.
|
|
26
|
+
*
|
|
27
|
+
* @returns `true` when the file was created or modified, `false` when it already
|
|
28
|
+
* covered every requested pattern.
|
|
29
|
+
*/
|
|
30
|
+
declare function ensureAssetsIgnore(clientDir: string, patterns?: readonly string[]): boolean;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { DEFAULT_VINEXT_ASSET_IGNORE_PATTERNS, ensureAssetsIgnore };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
//#region src/build/assets-ignore.ts
|
|
4
|
+
/**
|
|
5
|
+
* Build metadata that must never be served by the Cloudflare ASSETS binding.
|
|
6
|
+
*
|
|
7
|
+
* On Cloudflare Workers the ASSETS binding serves any uploaded file whose path
|
|
8
|
+
* matches the request BEFORE the Worker runs, so anything written into the
|
|
9
|
+
* client output directory (`dist/client`) is publicly fetchable unless excluded.
|
|
10
|
+
* Vite writes its build/SSR manifests under `dist/client/.vite/` (enabled for
|
|
11
|
+
* Cloudflare builds so the worker entry can compute lazy chunks), which would
|
|
12
|
+
* otherwise expose the full source-file → chunk mapping — including the paths of
|
|
13
|
+
* routes that are never linked from the UI.
|
|
14
|
+
*
|
|
15
|
+
* The Node production server already blocks `/.vite/` explicitly
|
|
16
|
+
* (see `server/static-file-cache.ts`); `.assetsignore` is the equivalent guard
|
|
17
|
+
* for the Cloudflare deployment target. wrangler matches `.assetsignore`
|
|
18
|
+
* patterns with `.gitignore` semantics (via the `ignore` package), so the bare
|
|
19
|
+
* `.vite` entry excludes the directory and everything beneath it.
|
|
20
|
+
*/
|
|
21
|
+
const DEFAULT_VINEXT_ASSET_IGNORE_PATTERNS = [".vite"];
|
|
22
|
+
/** wrangler reads asset-exclusion patterns from this file in the assets dir. */
|
|
23
|
+
const ASSETS_IGNORE_FILENAME = ".assetsignore";
|
|
24
|
+
const GENERATED_HEADER = "# Keep build metadata out of the deployed asset bundle (generated by vinext)";
|
|
25
|
+
/**
|
|
26
|
+
* Ensure a `.assetsignore` in `clientDir` contains every pattern in `patterns`.
|
|
27
|
+
*
|
|
28
|
+
* Any pre-existing (user-authored) content is preserved verbatim and only the
|
|
29
|
+
* missing patterns are appended, so the result is idempotent across rebuilds
|
|
30
|
+
* and never clobbers a `.assetsignore` the developer wrote themselves.
|
|
31
|
+
*
|
|
32
|
+
* @returns `true` when the file was created or modified, `false` when it already
|
|
33
|
+
* covered every requested pattern.
|
|
34
|
+
*/
|
|
35
|
+
function ensureAssetsIgnore(clientDir, patterns = DEFAULT_VINEXT_ASSET_IGNORE_PATTERNS) {
|
|
36
|
+
const assetsIgnorePath = path.join(clientDir, ASSETS_IGNORE_FILENAME);
|
|
37
|
+
const existing = fs.existsSync(assetsIgnorePath) ? fs.readFileSync(assetsIgnorePath, "utf-8") : null;
|
|
38
|
+
const present = new Set((existing ?? "").split(/\r?\n/).map((line) => line.trim()).filter(Boolean));
|
|
39
|
+
const missing = patterns.filter((pattern) => !present.has(pattern));
|
|
40
|
+
if (missing.length === 0) return false;
|
|
41
|
+
const lines = existing && existing.trim().length > 0 ? [existing.replace(/\s*$/, "")] : [GENERATED_HEADER];
|
|
42
|
+
lines.push(...missing, "");
|
|
43
|
+
fs.mkdirSync(clientDir, { recursive: true });
|
|
44
|
+
fs.writeFileSync(assetsIgnorePath, lines.join("\n"));
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { DEFAULT_VINEXT_ASSET_IGNORE_PATTERNS, ensureAssetsIgnore };
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { UserConfig } from "vite";
|
|
2
2
|
|
|
3
3
|
//#region src/build/client-build-config.d.ts
|
|
4
|
+
type ClientAssetFileNameInfo = {
|
|
5
|
+
readonly name?: string;
|
|
6
|
+
readonly names?: readonly string[];
|
|
7
|
+
readonly originalFileName?: string;
|
|
8
|
+
readonly originalFileNames?: readonly string[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Routes client assets into Next-compatible subtrees: `.css` sources go to
|
|
12
|
+
* `<assetsDir>/css/`, everything else to `<assetsDir>/media/`. Returned as a
|
|
13
|
+
* function so it can inspect every source-name candidate Rolldown records for
|
|
14
|
+
* an asset (a single output asset can carry several `originalFileNames`).
|
|
15
|
+
*/
|
|
16
|
+
declare function createClientAssetFileNames(assetsDir: string): (assetInfo: ClientAssetFileNameInfo) => string;
|
|
4
17
|
/**
|
|
5
18
|
* Create a manualChunks function for client builds.
|
|
6
19
|
*
|
|
@@ -38,7 +51,8 @@ declare function createClientManualChunks(shimsDir: string): (id: string) => str
|
|
|
38
51
|
* compression efficiency — small files restart the compression dictionary,
|
|
39
52
|
* adding ~5-15% wire overhead vs fewer larger chunks.
|
|
40
53
|
*/
|
|
41
|
-
declare function createClientOutputConfig(clientManualChunks: (id: string) => string | undefined): {
|
|
54
|
+
declare function createClientOutputConfig(clientManualChunks: (id: string) => string | undefined, assetsDir: string): {
|
|
55
|
+
assetFileNames: (assetInfo: ClientAssetFileNameInfo) => string;
|
|
42
56
|
manualChunks: (id: string) => string | undefined;
|
|
43
57
|
experimentalMinChunkSize: number;
|
|
44
58
|
};
|
|
@@ -48,6 +62,32 @@ declare function createClientCodeSplittingConfig(clientManualChunks: (id: string
|
|
|
48
62
|
name(moduleId: string): string | null;
|
|
49
63
|
}[];
|
|
50
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* Regex matching any {@link FRAMEWORK_PACKAGES} package inside `node_modules`.
|
|
67
|
+
* Derived from the package list so the regex and {@link isRscFrameworkModule}
|
|
68
|
+
* predicate can't drift.
|
|
69
|
+
*/
|
|
70
|
+
declare const RSC_FRAMEWORK_CHUNK_TEST: RegExp;
|
|
71
|
+
declare function isRscFrameworkModule(id: string): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Output config that isolates React (and the RSC flight runtime) into a
|
|
74
|
+
* dedicated "framework" chunk in the RSC server build. Returns the bundler-
|
|
75
|
+
* appropriate shape: rolldown's `codeSplitting` for Vite 8+, Rollup's
|
|
76
|
+
* `manualChunks` for Vite 7. See {@link RSC_FRAMEWORK_CHUNK_TEST} for the
|
|
77
|
+
* motivation (issue #1549).
|
|
78
|
+
*/
|
|
79
|
+
declare function createRscFrameworkChunkOutputConfig(viteMajorVersion: number): {
|
|
80
|
+
codeSplitting: {
|
|
81
|
+
groups: {
|
|
82
|
+
name: string;
|
|
83
|
+
test: RegExp;
|
|
84
|
+
}[];
|
|
85
|
+
};
|
|
86
|
+
manualChunks?: undefined;
|
|
87
|
+
} | {
|
|
88
|
+
manualChunks(id: string): string | undefined;
|
|
89
|
+
codeSplitting?: undefined;
|
|
90
|
+
};
|
|
51
91
|
/**
|
|
52
92
|
* Rollup treeshake configuration for production client builds.
|
|
53
93
|
*
|
|
@@ -115,5 +155,4 @@ type VinextBuildConfigWithLegacy = VinextBuildConfig & {
|
|
|
115
155
|
declare function getBuildBundlerOptions(build: UserConfig["build"] | undefined): VinextBuildBundlerOptions | undefined;
|
|
116
156
|
declare function withBuildBundlerOptions(viteMajorVersion: number, bundlerOptions: VinextBuildBundlerOptions): Partial<VinextBuildConfigWithLegacy>;
|
|
117
157
|
//#endregion
|
|
118
|
-
export { clientTreeshakeConfig, createClientCodeSplittingConfig, createClientManualChunks, createClientOutputConfig, getBuildBundlerOptions, getClientTreeshakeConfigForVite, withBuildBundlerOptions };
|
|
119
|
-
//# sourceMappingURL=client-build-config.d.ts.map
|
|
158
|
+
export { RSC_FRAMEWORK_CHUNK_TEST, clientTreeshakeConfig, createClientAssetFileNames, createClientCodeSplittingConfig, createClientManualChunks, createClientOutputConfig, createRscFrameworkChunkOutputConfig, getBuildBundlerOptions, getClientTreeshakeConfigForVite, isRscFrameworkModule, withBuildBundlerOptions };
|
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
//#region src/build/client-build-config.ts
|
|
2
|
+
const NEXT_CLIENT_CSS_ASSET_FILE_NAMES = "css/[name].[hash:8][extname]";
|
|
3
|
+
const NEXT_CLIENT_STATIC_MEDIA_FILE_NAMES = "media/[name].[hash:8][extname]";
|
|
4
|
+
function joinAssetFileNamePattern(assetsDir, pattern) {
|
|
5
|
+
let end = assetsDir.length;
|
|
6
|
+
while (end > 0 && assetsDir[end - 1] === "/") end -= 1;
|
|
7
|
+
const normalized = assetsDir.slice(0, end);
|
|
8
|
+
return normalized ? `${normalized}/${pattern}` : pattern;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Routes client assets into Next-compatible subtrees: `.css` sources go to
|
|
12
|
+
* `<assetsDir>/css/`, everything else to `<assetsDir>/media/`. Returned as a
|
|
13
|
+
* function so it can inspect every source-name candidate Rolldown records for
|
|
14
|
+
* an asset (a single output asset can carry several `originalFileNames`).
|
|
15
|
+
*/
|
|
16
|
+
function createClientAssetFileNames(assetsDir) {
|
|
17
|
+
const cssAssetFileNames = joinAssetFileNamePattern(assetsDir, NEXT_CLIENT_CSS_ASSET_FILE_NAMES);
|
|
18
|
+
const mediaAssetFileNames = joinAssetFileNamePattern(assetsDir, NEXT_CLIENT_STATIC_MEDIA_FILE_NAMES);
|
|
19
|
+
return function getClientAssetFileNames(assetInfo) {
|
|
20
|
+
return [
|
|
21
|
+
...assetInfo.names ?? [],
|
|
22
|
+
assetInfo.name,
|
|
23
|
+
...assetInfo.originalFileNames ?? [],
|
|
24
|
+
assetInfo.originalFileName
|
|
25
|
+
].some((name) => name?.toLowerCase().endsWith(".css")) ? cssAssetFileNames : mediaAssetFileNames;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
2
28
|
/**
|
|
3
29
|
* Extract the npm package name from a module ID (file path).
|
|
4
30
|
* Returns null if not in node_modules.
|
|
@@ -63,8 +89,9 @@ function createClientManualChunks(shimsDir) {
|
|
|
63
89
|
* compression efficiency — small files restart the compression dictionary,
|
|
64
90
|
* adding ~5-15% wire overhead vs fewer larger chunks.
|
|
65
91
|
*/
|
|
66
|
-
function createClientOutputConfig(clientManualChunks) {
|
|
92
|
+
function createClientOutputConfig(clientManualChunks, assetsDir) {
|
|
67
93
|
return {
|
|
94
|
+
assetFileNames: createClientAssetFileNames(assetsDir),
|
|
68
95
|
manualChunks: clientManualChunks,
|
|
69
96
|
experimentalMinChunkSize: 1e4
|
|
70
97
|
};
|
|
@@ -78,6 +105,63 @@ function createClientCodeSplittingConfig(clientManualChunks) {
|
|
|
78
105
|
};
|
|
79
106
|
}
|
|
80
107
|
/**
|
|
108
|
+
* Matches React framework packages (and the RSC flight runtime) inside
|
|
109
|
+
* `node_modules`. Used to split them into a dedicated "framework" chunk in the
|
|
110
|
+
* RSC server build.
|
|
111
|
+
*
|
|
112
|
+
* Why the RSC build needs this: without an explicit framework chunk, the
|
|
113
|
+
* bundler colocates React into whichever chunk first reaches it — typically the
|
|
114
|
+
* RSC entry chunk, which also carries the root layout's CSS. Modules that only
|
|
115
|
+
* import React for runtime helpers (notably `app/global-not-found.tsx`, which
|
|
116
|
+
* replaces the root layout for route-miss 404s) then import that entry chunk
|
|
117
|
+
* and inherit the root layout's CSS in their `serverResources` metadata. The
|
|
118
|
+
* 404 document ends up linking the layout's stylesheet last, so the layout's
|
|
119
|
+
* rules win the cascade over global-not-found's — the bug tracked in
|
|
120
|
+
* https://github.com/cloudflare/vinext/issues/1549.
|
|
121
|
+
*
|
|
122
|
+
* Splitting React into its own (CSS-free) chunk means global-not-found imports
|
|
123
|
+
* the framework chunk instead of the layout-bearing entry chunk, so it no
|
|
124
|
+
* longer inherits the root layout's CSS. The match list mirrors the client
|
|
125
|
+
* build's `framework` chunk, plus `react-server-dom-webpack` for the RSC flight
|
|
126
|
+
* runtime that the server environment bundles.
|
|
127
|
+
*
|
|
128
|
+
* Uses `[\\/]` rather than `/` for the path separator so it matches on Windows
|
|
129
|
+
* too, per the rolldown `codeSplitting` docs.
|
|
130
|
+
*/
|
|
131
|
+
const FRAMEWORK_PACKAGES = [
|
|
132
|
+
"react",
|
|
133
|
+
"react-dom",
|
|
134
|
+
"scheduler",
|
|
135
|
+
"react-server-dom-webpack"
|
|
136
|
+
];
|
|
137
|
+
/**
|
|
138
|
+
* Regex matching any {@link FRAMEWORK_PACKAGES} package inside `node_modules`.
|
|
139
|
+
* Derived from the package list so the regex and {@link isRscFrameworkModule}
|
|
140
|
+
* predicate can't drift.
|
|
141
|
+
*/
|
|
142
|
+
const RSC_FRAMEWORK_CHUNK_TEST = new RegExp(`[\\\\/]node_modules[\\\\/](${FRAMEWORK_PACKAGES.join("|")})[\\\\/]`);
|
|
143
|
+
function isRscFrameworkModule(id) {
|
|
144
|
+
if (!id.includes("node_modules")) return false;
|
|
145
|
+
const pkg = getPackageName(id);
|
|
146
|
+
return pkg !== null && FRAMEWORK_PACKAGES.includes(pkg);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Output config that isolates React (and the RSC flight runtime) into a
|
|
150
|
+
* dedicated "framework" chunk in the RSC server build. Returns the bundler-
|
|
151
|
+
* appropriate shape: rolldown's `codeSplitting` for Vite 8+, Rollup's
|
|
152
|
+
* `manualChunks` for Vite 7. See {@link RSC_FRAMEWORK_CHUNK_TEST} for the
|
|
153
|
+
* motivation (issue #1549).
|
|
154
|
+
*/
|
|
155
|
+
function createRscFrameworkChunkOutputConfig(viteMajorVersion) {
|
|
156
|
+
if (viteMajorVersion >= 8) return { codeSplitting: { groups: [{
|
|
157
|
+
name: "framework",
|
|
158
|
+
test: RSC_FRAMEWORK_CHUNK_TEST
|
|
159
|
+
}] } };
|
|
160
|
+
return { manualChunks(id) {
|
|
161
|
+
return isRscFrameworkModule(id) ? "framework" : void 0;
|
|
162
|
+
} };
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
81
165
|
* Rollup treeshake configuration for production client builds.
|
|
82
166
|
*
|
|
83
167
|
* Uses the 'recommended' preset as a safe base, then overrides
|
|
@@ -144,6 +228,4 @@ function withBuildBundlerOptions(viteMajorVersion, bundlerOptions) {
|
|
|
144
228
|
return viteMajorVersion >= 8 ? { rolldownOptions: bundlerOptions } : { rollupOptions: bundlerOptions };
|
|
145
229
|
}
|
|
146
230
|
//#endregion
|
|
147
|
-
export { clientTreeshakeConfig, createClientCodeSplittingConfig, createClientManualChunks, createClientOutputConfig, getBuildBundlerOptions, getClientTreeshakeConfigForVite, withBuildBundlerOptions };
|
|
148
|
-
|
|
149
|
-
//# sourceMappingURL=client-build-config.js.map
|
|
231
|
+
export { RSC_FRAMEWORK_CHUNK_TEST, clientTreeshakeConfig, createClientAssetFileNames, createClientCodeSplittingConfig, createClientManualChunks, createClientOutputConfig, createRscFrameworkChunkOutputConfig, getBuildBundlerOptions, getClientTreeshakeConfigForVite, isRscFrameworkModule, withBuildBundlerOptions };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Rolldown } from "vite";
|
|
2
|
+
|
|
3
|
+
//#region src/build/css-url-assets.d.ts
|
|
4
|
+
type BundleAsset = Rolldown.OutputAsset;
|
|
5
|
+
type CssUrlAssetBundle = Rolldown.OutputBundle;
|
|
6
|
+
type EmitRestoredCssUrlAsset = (asset: {
|
|
7
|
+
fileName: string;
|
|
8
|
+
source: BundleAsset["source"];
|
|
9
|
+
}) => void;
|
|
10
|
+
/**
|
|
11
|
+
* Append the private provenance marker to each relative asset `url()` in a CSS
|
|
12
|
+
* source. Idempotent and side-effect free (only adds a query param), so it is
|
|
13
|
+
* safe to run on every client-environment stylesheet, vendored CSS included.
|
|
14
|
+
*/
|
|
15
|
+
declare function markCssUrlAssetReferences(code: string, id: string): string | null;
|
|
16
|
+
/**
|
|
17
|
+
* Mutates emitted CSS assets in place so byte-identical `url()` dependencies
|
|
18
|
+
* keep their distinct Next-compatible filenames. Sibling files are produced via
|
|
19
|
+
* `emitRestoredAsset` (which must call `this.emitFile({ type: "asset", fileName,
|
|
20
|
+
* source })` — the explicit `fileName` opts out of Rolldown's content dedupe).
|
|
21
|
+
*
|
|
22
|
+
* Expects CSS to have been marked by `markCssUrlAssetReferences()` first. The
|
|
23
|
+
* marker is stripped from all final output here. CSS that Vite inlined into a JS
|
|
24
|
+
* chunk (`cssCodeSplit: false` / `?inline`) already has final URLs, so chunk
|
|
25
|
+
* code only has the leaked marker stripped — no sibling files are emitted.
|
|
26
|
+
*/
|
|
27
|
+
declare function restoreDedupedCssAssetReferences(bundle: CssUrlAssetBundle, emitRestoredAsset: EmitRestoredCssUrlAsset): void;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { markCssUrlAssetReferences, restoreDedupedCssAssetReferences };
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
//#region src/build/css-url-assets.ts
|
|
2
|
+
/**
|
|
3
|
+
* Next-parity for CSS `url()` asset dependencies.
|
|
4
|
+
*
|
|
5
|
+
* Next.js (webpack `asset/resource`) emits one output file per *source* file a
|
|
6
|
+
* stylesheet references, keyed by module identity. Vite/Rolldown instead dedupe
|
|
7
|
+
* emitted assets by *content*: two byte-identical files (`dark.svg`, `dark2.svg`)
|
|
8
|
+
* collapse to a single output, and every `url()` that referenced either source
|
|
9
|
+
* is rewritten to that one filename — so the second filename disappears.
|
|
10
|
+
*
|
|
11
|
+
* There is no config switch to disable that dedupe (it is intentional; see
|
|
12
|
+
* vitejs/vite#8632). The one native escape hatch is `this.emitFile({ fileName })`:
|
|
13
|
+
* assets emitted with an explicit `fileName` are *never* deduped. So we:
|
|
14
|
+
*
|
|
15
|
+
* 1. mark — during the client CSS transform, tag each relative asset `url()`
|
|
16
|
+
* with a private `?vinext_css_url_asset=<source-basename>` query. This is
|
|
17
|
+
* the only durable carrier of per-reference provenance: once Rolldown
|
|
18
|
+
* dedupes, the emitted bundle cannot tell which `url()` came from which
|
|
19
|
+
* source, and the bundle metadata (`originalFileNames`) records the set of
|
|
20
|
+
* sources but not the mapping per reference.
|
|
21
|
+
*
|
|
22
|
+
* 2. restore — at `generateBundle`, read each marked reference's source
|
|
23
|
+
* basename back out. When it differs from the deduped output's basename,
|
|
24
|
+
* emit a sibling file under that source's name (via the `fileName` escape
|
|
25
|
+
* hatch) and rewrite the reference to it. The marker is then stripped.
|
|
26
|
+
*
|
|
27
|
+
* Each reference resolves from its own marker, so split CSS chunks stay correct
|
|
28
|
+
* with no shared cursor or bundle-iteration-order dependence.
|
|
29
|
+
*/
|
|
30
|
+
const CSS_URL_ASSET_MARKER = "vinext_css_url_asset";
|
|
31
|
+
const CSS_URL_RE = /url\(\s*(?:"([^"]*)"|'([^']*)'|([^'")]*?))\s*\)/g;
|
|
32
|
+
const CSS_ASSET_EXT_RE = /\.(?:avif|bmp|gif|ico|jpe?g|png|svg|webp|woff2?|eot|ttf|otf|mp4|webm|ogg|mp3|wav|flac|aac|wasm)$/i;
|
|
33
|
+
const CSS_REQUEST_RE = /\.(?:css|scss|sass|less|styl|stylus)(?:\?|$)/i;
|
|
34
|
+
function basename(value) {
|
|
35
|
+
const normalized = value.replaceAll("\\", "/");
|
|
36
|
+
const slash = normalized.lastIndexOf("/");
|
|
37
|
+
return slash === -1 ? normalized : normalized.slice(slash + 1);
|
|
38
|
+
}
|
|
39
|
+
function stem(fileName) {
|
|
40
|
+
const base = basename(fileName);
|
|
41
|
+
const dot = base.lastIndexOf(".");
|
|
42
|
+
return dot <= 0 ? base : base.slice(0, dot);
|
|
43
|
+
}
|
|
44
|
+
function splitUrl(url) {
|
|
45
|
+
const hashAt = url.indexOf("#");
|
|
46
|
+
const beforeHash = hashAt === -1 ? url : url.slice(0, hashAt);
|
|
47
|
+
const hash = hashAt === -1 ? "" : url.slice(hashAt);
|
|
48
|
+
const queryAt = beforeHash.indexOf("?");
|
|
49
|
+
if (queryAt === -1) return {
|
|
50
|
+
path: beforeHash,
|
|
51
|
+
query: "",
|
|
52
|
+
hash
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
path: beforeHash.slice(0, queryAt),
|
|
56
|
+
query: beforeHash.slice(queryAt + 1),
|
|
57
|
+
hash
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function joinUrl({ path, query, hash }) {
|
|
61
|
+
return `${path}${query ? `?${query}` : ""}${hash}`;
|
|
62
|
+
}
|
|
63
|
+
function decodeURIComponentSafe(value) {
|
|
64
|
+
try {
|
|
65
|
+
return decodeURIComponent(value);
|
|
66
|
+
} catch {
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function getMarker(query) {
|
|
71
|
+
for (const part of query.split("&")) {
|
|
72
|
+
const eq = part.indexOf("=");
|
|
73
|
+
if ((eq === -1 ? part : part.slice(0, eq)) === CSS_URL_ASSET_MARKER) return eq === -1 ? "" : decodeURIComponentSafe(part.slice(eq + 1));
|
|
74
|
+
}
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
function dropMarker(query) {
|
|
78
|
+
return query.split("&").filter((part) => (part.indexOf("=") === -1 ? part : part.slice(0, part.indexOf("="))) !== CSS_URL_ASSET_MARKER).join("&");
|
|
79
|
+
}
|
|
80
|
+
function isRelativeAssetUrl(rawPath) {
|
|
81
|
+
return !(rawPath === "" || rawPath.startsWith("/") || rawPath.startsWith("#") || rawPath.includes("(") || /^[a-zA-Z][\w+.-]*:/.test(rawPath));
|
|
82
|
+
}
|
|
83
|
+
function rewriteUrlToken(match, nextUrl) {
|
|
84
|
+
if (match[1] !== void 0) return `url("${nextUrl}")`;
|
|
85
|
+
if (match[2] !== void 0) return `url('${nextUrl}')`;
|
|
86
|
+
return `url(${nextUrl})`;
|
|
87
|
+
}
|
|
88
|
+
function isCssRequest(id) {
|
|
89
|
+
return CSS_REQUEST_RE.test(id);
|
|
90
|
+
}
|
|
91
|
+
/** Replace every `url(...)` in `code` whose raw URL `replace()` rewrites. */
|
|
92
|
+
function rewriteCssUrls(code, replace) {
|
|
93
|
+
let out = "";
|
|
94
|
+
let last = 0;
|
|
95
|
+
let changed = false;
|
|
96
|
+
CSS_URL_RE.lastIndex = 0;
|
|
97
|
+
let match;
|
|
98
|
+
while ((match = CSS_URL_RE.exec(code)) !== null) {
|
|
99
|
+
const rawUrl = match[1] ?? match[2] ?? match[3]?.trim();
|
|
100
|
+
if (!rawUrl) continue;
|
|
101
|
+
const next = replace(rawUrl);
|
|
102
|
+
if (next === null) continue;
|
|
103
|
+
out += code.slice(last, match.index) + rewriteUrlToken(match, next);
|
|
104
|
+
last = match.index + match[0].length;
|
|
105
|
+
changed = true;
|
|
106
|
+
}
|
|
107
|
+
return changed ? out + code.slice(last) : null;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Append the private provenance marker to each relative asset `url()` in a CSS
|
|
111
|
+
* source. Idempotent and side-effect free (only adds a query param), so it is
|
|
112
|
+
* safe to run on every client-environment stylesheet, vendored CSS included.
|
|
113
|
+
*/
|
|
114
|
+
function markCssUrlAssetReferences(code, id) {
|
|
115
|
+
if (!isCssRequest(id) || !code.includes("url(")) return null;
|
|
116
|
+
return rewriteCssUrls(code, (rawUrl) => {
|
|
117
|
+
const parts = splitUrl(rawUrl.trim());
|
|
118
|
+
if (!isRelativeAssetUrl(parts.path)) return null;
|
|
119
|
+
if (getMarker(parts.query) !== null) return null;
|
|
120
|
+
const lower = parts.path.toLowerCase();
|
|
121
|
+
if (!CSS_ASSET_EXT_RE.test(lower) || lower.endsWith(".css")) return null;
|
|
122
|
+
const param = `${CSS_URL_ASSET_MARKER}=${encodeURIComponent(basename(parts.path))}`;
|
|
123
|
+
return joinUrl({
|
|
124
|
+
...parts,
|
|
125
|
+
query: parts.query ? `${parts.query}&${param}` : param
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function isCssFileName(fileName) {
|
|
130
|
+
return fileName.toLowerCase().endsWith(".css");
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Given a deduped output filename (`media/dark.1a2b3c4d.svg`) and the source
|
|
134
|
+
* basename a reference actually wants (`dark2.svg`), produce the sibling output
|
|
135
|
+
* filename (`media/dark2.1a2b3c4d.svg`) by swapping the leading name segment
|
|
136
|
+
* while preserving the hash + extension. `asset.originalFileNames` tells us
|
|
137
|
+
* which source stem the output was named after, so we strip exactly that.
|
|
138
|
+
*/
|
|
139
|
+
function deriveSiblingFileName(asset, desiredBasename) {
|
|
140
|
+
const fileName = asset.fileName;
|
|
141
|
+
const slash = fileName.lastIndexOf("/");
|
|
142
|
+
const dir = slash === -1 ? "" : fileName.slice(0, slash + 1);
|
|
143
|
+
const outBase = basename(fileName);
|
|
144
|
+
const desiredStem = stem(desiredBasename);
|
|
145
|
+
const sourceStems = [
|
|
146
|
+
...asset.names ?? [],
|
|
147
|
+
asset.name,
|
|
148
|
+
...asset.originalFileNames ?? [],
|
|
149
|
+
asset.originalFileName
|
|
150
|
+
].filter((n) => !!n).map((n) => stem(n)).sort((a, b) => b.length - a.length);
|
|
151
|
+
for (const wStem of sourceStems) if (wStem && (outBase === wStem || outBase.startsWith(`${wStem}.`) || outBase.startsWith(`${wStem}-`))) return `${dir}${desiredStem}${outBase.slice(wStem.length)}`;
|
|
152
|
+
const dot = outBase.indexOf(".");
|
|
153
|
+
return `${dir}${desiredStem}${dot === -1 ? "" : outBase.slice(dot)}`;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Mutates emitted CSS assets in place so byte-identical `url()` dependencies
|
|
157
|
+
* keep their distinct Next-compatible filenames. Sibling files are produced via
|
|
158
|
+
* `emitRestoredAsset` (which must call `this.emitFile({ type: "asset", fileName,
|
|
159
|
+
* source })` — the explicit `fileName` opts out of Rolldown's content dedupe).
|
|
160
|
+
*
|
|
161
|
+
* Expects CSS to have been marked by `markCssUrlAssetReferences()` first. The
|
|
162
|
+
* marker is stripped from all final output here. CSS that Vite inlined into a JS
|
|
163
|
+
* chunk (`cssCodeSplit: false` / `?inline`) already has final URLs, so chunk
|
|
164
|
+
* code only has the leaked marker stripped — no sibling files are emitted.
|
|
165
|
+
*/
|
|
166
|
+
function restoreDedupedCssAssetReferences(bundle, emitRestoredAsset) {
|
|
167
|
+
const assetsByBase = /* @__PURE__ */ new Map();
|
|
168
|
+
for (const entry of Object.values(bundle)) if (entry.type === "asset" && !isCssFileName(entry.fileName)) assetsByBase.set(basename(entry.fileName), entry);
|
|
169
|
+
const emitted = new Set(Object.keys(bundle));
|
|
170
|
+
for (const entry of Object.values(bundle)) {
|
|
171
|
+
if (entry.type === "chunk") {
|
|
172
|
+
if (typeof entry.code === "string" && entry.code.includes(CSS_URL_ASSET_MARKER)) entry.code = stripChunkMarkers(entry.code);
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
if (!isCssFileName(entry.fileName) || typeof entry.source !== "string") continue;
|
|
176
|
+
entry.source = rewriteCssUrls(entry.source, (rawUrl) => {
|
|
177
|
+
const parts = splitUrl(rawUrl);
|
|
178
|
+
const desiredBasename = getMarker(parts.query);
|
|
179
|
+
if (desiredBasename === null) return null;
|
|
180
|
+
const query = dropMarker(parts.query);
|
|
181
|
+
const asset = assetsByBase.get(basename(parts.path));
|
|
182
|
+
if (!asset) return joinUrl({
|
|
183
|
+
...parts,
|
|
184
|
+
query
|
|
185
|
+
});
|
|
186
|
+
const siblingFileName = deriveSiblingFileName(asset, desiredBasename);
|
|
187
|
+
if (siblingFileName === asset.fileName) return joinUrl({
|
|
188
|
+
...parts,
|
|
189
|
+
query
|
|
190
|
+
});
|
|
191
|
+
if (!emitted.has(siblingFileName)) {
|
|
192
|
+
emitted.add(siblingFileName);
|
|
193
|
+
emitRestoredAsset({
|
|
194
|
+
fileName: siblingFileName,
|
|
195
|
+
source: asset.source
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
return joinUrl({
|
|
199
|
+
path: parts.path.slice(0, parts.path.length - basename(parts.path).length) + basename(siblingFileName),
|
|
200
|
+
query,
|
|
201
|
+
hash: parts.hash
|
|
202
|
+
});
|
|
203
|
+
}) ?? entry.source;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
const CSS_URL_MARKER_PARAM_RE = new RegExp(`(\\?)${CSS_URL_ASSET_MARKER}=[^&#'")\\\\\\s]*&|[?&]${CSS_URL_ASSET_MARKER}=[^&#'")\\\\\\s]*`, "g");
|
|
207
|
+
function stripChunkMarkers(code) {
|
|
208
|
+
return code.replace(CSS_URL_MARKER_PARAM_RE, (_m, leadingQuestion) => leadingQuestion ? leadingQuestion : "");
|
|
209
|
+
}
|
|
210
|
+
//#endregion
|
|
211
|
+
export { markCssUrlAssetReferences, restoreDedupedCssAssetReferences };
|
|
@@ -14027,5 +14027,3 @@ var fallback_metrics_data_default = {
|
|
|
14027
14027
|
};
|
|
14028
14028
|
//#endregion
|
|
14029
14029
|
export { fallback_metrics_data_default as default };
|
|
14030
|
-
|
|
14031
|
-
//# sourceMappingURL=fallback-metrics-data.js.map
|
|
@@ -9,5 +9,4 @@ type AdjustFontFallback = {
|
|
|
9
9
|
declare function getFallbackFontOverrideMetrics(fontFamily: string): AdjustFontFallback | undefined;
|
|
10
10
|
declare function buildFallbackFontFace(family: string, metrics: AdjustFontFallback): string;
|
|
11
11
|
//#endregion
|
|
12
|
-
export { buildFallbackFontFace, getFallbackFontOverrideMetrics };
|
|
13
|
-
//# sourceMappingURL=fallback-metrics.d.ts.map
|
|
12
|
+
export { buildFallbackFontFace, getFallbackFontOverrideMetrics };
|
|
@@ -24981,5 +24981,3 @@ var font_data_default = {
|
|
|
24981
24981
|
};
|
|
24982
24982
|
//#endregion
|
|
24983
24983
|
export { font_data_default as default };
|
|
24984
|
-
|
|
24985
|
-
//# sourceMappingURL=font-data.js.map
|