vinext 1.3.0 → 1.3.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/dist/_virtual/_rolldown/runtime.js +1 -1
- 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/layout-classification.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 +5 -4
- package/dist/build/report.d.ts +2 -1
- package/dist/build/route-classification-injector.d.ts +2 -1
- package/dist/build/route-classification-manifest.d.ts +2 -1
- 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 +4 -0
- package/dist/cli-args.d.ts +2 -1
- package/dist/cli.js +2 -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/index.js +1 -2
- package/dist/client/instrumentation-client-state.js +5 -5
- package/dist/client/navigation-runtime.d.ts +3 -1
- package/dist/client/navigation-runtime.js +1 -1
- 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 +13 -1
- package/dist/config/next-config.js +29 -4
- package/dist/config/tsconfig-paths.d.ts +2 -1
- 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/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 +42 -12
- package/dist/entries/app-rsc-manifest.d.ts +2 -1
- package/dist/entries/app-rsc-manifest.js +53 -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 +1 -1
- 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 +102 -34
- 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/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/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 +2 -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/worker-image-imports.js +1 -1
- package/dist/plugins/worker-use-server.d.ts +2 -1
- package/dist/routing/app-route-graph.d.ts +40 -0
- package/dist/routing/app-route-graph.js +122 -50
- 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/app-action-forwarding.d.ts +2 -1
- package/dist/server/app-bfcache-identity.d.ts +2 -1
- package/dist/server/app-browser-action-result.d.ts +2 -1
- package/dist/server/app-browser-client-reuse-manifest.d.ts +2 -1
- package/dist/server/app-browser-entry.js +30 -6
- package/dist/server/app-browser-error.d.ts +2 -1
- package/dist/server/app-browser-history-controller.d.ts +2 -1
- 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.js +15 -10
- 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-server-action-client.d.ts +2 -1
- package/dist/server/app-browser-state.js +1 -1
- package/dist/server/app-browser-stream.d.ts +2 -1
- package/dist/server/app-browser-visible-commit.d.ts +2 -1
- 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 +2 -1
- package/dist/server/app-elements.d.ts +2 -0
- package/dist/server/app-elements.js +3 -1
- 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 +2 -1
- package/dist/server/app-inline-css-client.d.ts +2 -1
- package/dist/server/app-layout-param-observation.d.ts +2 -1
- package/dist/server/app-metadata-tracing.d.ts +2 -1
- package/dist/server/app-optimistic-routing.d.ts +18 -1
- package/dist/server/app-optimistic-routing.js +34 -1
- package/dist/server/app-page-boundary-render.d.ts +20 -2
- package/dist/server/app-page-boundary-render.js +221 -38
- package/dist/server/app-page-boundary.d.ts +34 -5
- package/dist/server/app-page-boundary.js +40 -7
- package/dist/server/app-page-cache-finalizer.d.ts +2 -1
- package/dist/server/app-page-cache-finalizer.js +1 -1
- 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.js +2 -2
- package/dist/server/app-page-dispatch.d.ts +34 -1
- package/dist/server/app-page-dispatch.js +163 -34
- package/dist/server/app-page-element-builder.d.ts +17 -1
- package/dist/server/app-page-element-builder.js +187 -66
- package/dist/server/app-page-execution.d.ts +28 -1
- package/dist/server/app-page-execution.js +114 -5
- package/dist/server/app-page-head.d.ts +95 -3
- package/dist/server/app-page-head.js +307 -152
- package/dist/server/app-page-http-access-fallback-metadata.d.ts +48 -2
- package/dist/server/app-page-http-access-fallback-metadata.js +76 -1
- package/dist/server/app-page-method.d.ts +2 -1
- package/dist/server/app-page-probe.d.ts +2 -1
- package/dist/server/app-page-render-identity.d.ts +2 -1
- package/dist/server/app-page-render.d.ts +7 -1
- package/dist/server/app-page-render.js +35 -10
- package/dist/server/app-page-request.d.ts +14 -1
- package/dist/server/app-page-request.js +1 -1
- package/dist/server/app-page-route-wiring.d.ts +52 -2
- package/dist/server/app-page-route-wiring.js +197 -47
- package/dist/server/app-page-rsc-render-status.d.ts +2 -1
- 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 +31 -1
- package/dist/server/app-page-stream.js +23 -4
- package/dist/server/app-pages-bridge.d.ts +2 -1
- 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 +11 -1
- package/dist/server/app-render-dependency.js +26 -7
- 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-dispatch.d.ts +2 -1
- package/dist/server/app-route-handler-dispatch.js +1 -1
- package/dist/server/app-route-handler-execution.d.ts +2 -1
- package/dist/server/app-route-handler-response.d.ts +2 -1
- package/dist/server/app-route-handler-runtime.d.ts +2 -1
- 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-error-handler.d.ts +2 -1
- package/dist/server/app-rsc-errors.d.ts +2 -1
- package/dist/server/app-rsc-handler.d.ts +2 -1
- package/dist/server/app-rsc-handler.js +6 -10
- package/dist/server/app-rsc-response-finalizer.d.ts +2 -1
- 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 +2 -1
- package/dist/server/app-server-action-execution.js +3 -3
- package/dist/server/app-ssr-entry.d.ts +6 -0
- package/dist/server/app-ssr-entry.js +91 -44
- 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 +299 -67
- 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 +2 -1
- package/dist/server/app-worker-stages.d.ts +2 -1
- package/dist/server/artifact-compatibility.d.ts +2 -1
- package/dist/server/bfcache-identity.d.ts +2 -1
- package/dist/server/cache-headers.d.ts +2 -1
- package/dist/server/cacheability-request.d.ts +2 -1
- package/dist/server/client-reuse-manifest.d.ts +2 -1
- 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 +10 -3
- 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/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/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 +1 -1
- package/dist/server/metadata-routes.d.ts +2 -1
- package/dist/server/middleware-runtime.d.ts +2 -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-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-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 +16 -7
- 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 +2 -1
- package/dist/server/pages-request-pipeline.js +4 -5
- package/dist/server/pages-request-stage-entry.d.ts +2 -1
- package/dist/server/pages-response-stage-entry.d.ts +2 -1
- 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 +9 -3
- package/dist/server/request-log.d.ts +2 -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/static-file-cache.d.ts +2 -1
- package/dist/server/static-file-cache.js +1 -0
- package/dist/server/static-layout-client-reuse-proof.d.ts +2 -1
- package/dist/server/worker-revalidation-context.d.ts +2 -1
- package/dist/server/worker-stages.d.ts +2 -1
- 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 +29 -9
- 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-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/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/error-boundary.d.ts +39 -3
- package/dist/shims/error-boundary.js +31 -16
- 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 +1 -1
- 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/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 +195 -52
- package/dist/shims/metadata.d.ts +32 -11
- package/dist/shims/metadata.js +88 -26
- package/dist/shims/navigation-errors.d.ts +2 -1
- package/dist/shims/navigation.d.ts +22 -2
- package/dist/shims/navigation.js +74 -20
- package/dist/shims/pages-router-runtime.d.ts +2 -1
- package/dist/shims/ppr-fallback-shell.d.ts +2 -1
- package/dist/shims/router.js +14 -3
- package/dist/shims/unified-request-context.js +3 -3
- package/dist/typegen.d.ts +2 -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 +2 -1
- package/dist/utils/project.js +9 -1
- package/dist/utils/query.d.ts +2 -1
- package/dist/utils/sorted-array.d.ts +2 -1
- package/dist/utils/vite-cli-invocation.d.ts +2 -1
- package/package.json +5 -5
- package/dist/deps/.pnpm/image-size@2.0.2/deps/image-size/dist/index.js +0 -808
- 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/index.js
CHANGED
|
@@ -46,6 +46,7 @@ import { handleApiRoute } from "./server/api-handler.js";
|
|
|
46
46
|
import { DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, isImageOptimizationPath, resolveDevImageRedirect } from "./server/image-optimization.js";
|
|
47
47
|
import { CACHEABILITY_MANIFEST_MODULE, CACHEABILITY_REQUEST_PROJECTION_MODULE } from "./server/cacheability-manifest.js";
|
|
48
48
|
import { PREGENERATED_CONCRETE_PATHS_MODULE } from "./server/pregenerated-concrete-paths.js";
|
|
49
|
+
import { isAppInterceptRenderedDynamically, isAppPageRouteRenderedDynamically } from "./build/app-page-static-eligibility.js";
|
|
49
50
|
import { rewriteOutputRootExternals } from "./build/output-root-externals.js";
|
|
50
51
|
import { installSocketErrorBackstop } from "./server/socket-error-backstop.js";
|
|
51
52
|
import { invalidateMetadataFileCache, scanMetadataFiles } from "./server/metadata-routes.js";
|
|
@@ -66,7 +67,7 @@ import { loadOrGenerateServerActionsEncryptionKey } from "./build/server-actions
|
|
|
66
67
|
import { findOpenTelemetryPackages, mergeServerExternalPackages } from "./config/server-external-packages.js";
|
|
67
68
|
import { precompressAssets } from "./build/precompress.js";
|
|
68
69
|
import { VINEXT_PRERENDER_CONFIG_PLUGIN_PROPERTY, VINEXT_ROUTE_ROOT_CONFIG_PLUGIN_PROPERTY, normalizeVinextPrerenderConfig } from "./config/prerender.js";
|
|
69
|
-
import { VINEXT_CLIENT_ENTRY_MANIFEST } from "./utils/client-entry-manifest.js";
|
|
70
|
+
import { VINEXT_CLIENT_ENTRY_MANIFEST, VINEXT_CLIENT_REFERENCE_SOURCES } from "./utils/client-entry-manifest.js";
|
|
70
71
|
import { PAGES_CLIENT_ASSETS_MODULE, buildPagesClientAssetsModule, collectClientBuildFiles, writePagesClientAssetsModuleIfMissing } from "./build/pages-client-assets-module.js";
|
|
71
72
|
import { createPreviewBuildCredentials, getPreviewBuildCredentials } from "./build/preview-credentials.js";
|
|
72
73
|
import { VINEXT_BUILD_LIFECYCLE_CONFIG, createBuildLifecyclePlugins } from "./build/lifecycle.js";
|
|
@@ -85,6 +86,7 @@ import { VIRTUAL_MODULE_ID_RE } from "./utils/virtual-module.js";
|
|
|
85
86
|
import { assertNoPublicDirAssetConflict, assertNoPublicNextRequestConflict } from "./build/public-dir-conflict.js";
|
|
86
87
|
import { renderVinextBuiltUrl } from "./utils/built-asset-url.js";
|
|
87
88
|
import { asyncHooksStubPlugin } from "./plugins/async-hooks-stub.js";
|
|
89
|
+
import { createClientCompileHintsPlugin } from "./plugins/client-compile-hints.js";
|
|
88
90
|
import { clientReferenceDedupPlugin } from "./plugins/client-reference-dedup.js";
|
|
89
91
|
import { dataUrlCssPlugin } from "./plugins/css-data-url.js";
|
|
90
92
|
import { createCssModuleImportCompatibilityPlugin } from "./plugins/css-module-imports.js";
|
|
@@ -117,6 +119,7 @@ import { readPrerenderSecret, readServerRuntimeOutputDirs } from "./build/server
|
|
|
117
119
|
import { ModuleDependencyStore, createModuleDependencyCache } from "./build/module-dependency-cache.js";
|
|
118
120
|
import { markCssUrlAssetReferences, restoreDedupedCssAssetReferences } from "./build/css-url-assets.js";
|
|
119
121
|
import { buildSassPreprocessorOptions, createSassAwareFileSystemLoader, createSassCssUrlAssetImporter, createSassTildeImporter, createSassTsconfigPathImporters } from "./plugins/sass.js";
|
|
122
|
+
import { collectClientReferenceChunks, collectClientReferenceSources } from "./build/client-reference-chunks.js";
|
|
120
123
|
import { EXPORT_ALL_CANDIDATE_FILTER, hasExportAllCandidate, stripServerExports, validatePageExports } from "./plugins/strip-server-exports.js";
|
|
121
124
|
import { removeConsoleCalls } from "./plugins/remove-console.js";
|
|
122
125
|
import { createImportMetaUrlPlugin } from "./plugins/import-meta-url.js";
|
|
@@ -139,7 +142,7 @@ import { staticExportApp, staticExportPages } from "./build/static-export.js";
|
|
|
139
142
|
import { createRequire } from "node:module";
|
|
140
143
|
import fs from "node:fs";
|
|
141
144
|
import { pathToFileURL } from "node:url";
|
|
142
|
-
import { createIdResolver, createLogger, isRunnableDevEnvironment, transformWithOxc } from "vite";
|
|
145
|
+
import { createIdResolver, createLogger, esmExternalRequirePlugin, isRunnableDevEnvironment, transformWithOxc } from "vite";
|
|
143
146
|
import { createHash, randomBytes } from "node:crypto";
|
|
144
147
|
import MagicString from "magic-string";
|
|
145
148
|
import commonjs from "vite-plugin-commonjs";
|
|
@@ -161,6 +164,11 @@ const APP_CLIENT_OPTIONAL_OPTIMIZE_DEPS_INCLUDE = Object.freeze([
|
|
|
161
164
|
"use-sync-external-store/with-selector",
|
|
162
165
|
"use-sync-external-store/with-selector.js"
|
|
163
166
|
]);
|
|
167
|
+
const CLIENT_OPTIONAL_OPTIMIZE_DEPS_INCLUDE = Object.freeze([
|
|
168
|
+
"vinext > @unpic/react",
|
|
169
|
+
"vinext > ipaddr.js",
|
|
170
|
+
"vinext > web-vitals"
|
|
171
|
+
]);
|
|
164
172
|
const ANSI_ESCAPE_RE = new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*m`, "g");
|
|
165
173
|
const RSC_ENVIRONMENTS = /* @__PURE__ */ new Set([
|
|
166
174
|
"rsc",
|
|
@@ -1002,6 +1010,7 @@ function vinext(options = {}) {
|
|
|
1002
1010
|
let rscActionOwnerRoutes = null;
|
|
1003
1011
|
let rscActionOwnerSharedRoots = [];
|
|
1004
1012
|
let clientReferenceRoutes = null;
|
|
1013
|
+
let clientReferenceModules = null;
|
|
1005
1014
|
let clientReferenceAlwaysRenderedFiles = [];
|
|
1006
1015
|
let clientReferenceRoutelessFiles = [];
|
|
1007
1016
|
const serverEntryKindsByEnvironment = /* @__PURE__ */ new Map();
|
|
@@ -1038,6 +1047,8 @@ function vinext(options = {}) {
|
|
|
1038
1047
|
resolveShimModulePath(shimsDir, "cache")
|
|
1039
1048
|
].map(canonicalize));
|
|
1040
1049
|
let nextShimMap = {};
|
|
1050
|
+
let shimOptimizeDepsExclude = VINEXT_OPTIMIZE_DEPS_EXCLUDE;
|
|
1051
|
+
const createShimRequirePlugin = () => esmExternalRequirePlugin({ external: [...shimOptimizeDepsExclude] });
|
|
1041
1052
|
/**
|
|
1042
1053
|
* Generate the virtual SSR server entry module.
|
|
1043
1054
|
* This is the entry point for `vite build --ssr`.
|
|
@@ -1618,6 +1629,7 @@ function vinext(options = {}) {
|
|
|
1618
1629
|
"vinext/html": path.resolve(__dirname, "server", "html"),
|
|
1619
1630
|
...clientInjectModule === null ? { "private-next-instrumentation-client": instrumentationClientPath ?? INSTRUMENTATION_CLIENT_EMPTY_MODULE } : {}
|
|
1620
1631
|
}).flatMap(([k, v]) => k.startsWith("next/") ? [[k, v], [`${k}.js`, v]] : [[k, v]]));
|
|
1632
|
+
shimOptimizeDepsExclude = mergeOptimizeDepsExclude(VINEXT_OPTIMIZE_DEPS_EXCLUDE, Object.keys(nextShimMap), [..._reactServerShims.keys()]);
|
|
1621
1633
|
const pluginsFlat = [];
|
|
1622
1634
|
function flattenPlugins(arr) {
|
|
1623
1635
|
for (const p of arr) if (Array.isArray(p)) flattenPlugins(p);
|
|
@@ -1815,12 +1827,12 @@ function vinext(options = {}) {
|
|
|
1815
1827
|
};
|
|
1816
1828
|
const depOptimizeNodeEnvOptions = getDepOptimizeNodeEnvOptions(nodeEnvDefine);
|
|
1817
1829
|
viteConfig.optimizeDeps = {
|
|
1818
|
-
exclude: mergeOptimizeDepsExclude(incomingExclude, VINEXT_OPTIMIZE_DEPS_EXCLUDE, ["@tailwindcss/oxide"]),
|
|
1830
|
+
exclude: mergeOptimizeDepsExclude(incomingExclude, hasAppDir ? shimOptimizeDepsExclude : VINEXT_OPTIMIZE_DEPS_EXCLUDE, ["@tailwindcss/oxide"]),
|
|
1819
1831
|
...incomingInclude.length > 0 ? { include: incomingInclude } : {},
|
|
1820
1832
|
...depOptimizeNodeEnvOptions,
|
|
1821
1833
|
rolldownOptions: {
|
|
1822
1834
|
...depOptimizeNodeEnvOptions.rolldownOptions,
|
|
1823
|
-
plugins: [depOptimizeAliasPlugin, commonJsEsmFacadeOptimizeDepsPlugin]
|
|
1835
|
+
plugins: hasAppDir ? [commonJsEsmFacadeOptimizeDepsPlugin] : [depOptimizeAliasPlugin, commonJsEsmFacadeOptimizeDepsPlugin]
|
|
1824
1836
|
}
|
|
1825
1837
|
};
|
|
1826
1838
|
pagesOptimizeEntries = !hasAppDir ? [...hasPagesDir ? [toRelativeFileEntry(root, pagesDir) + "/**/*.{tsx,ts,jsx,js}"] : [], ...[instrumentationPath, instrumentationClientPath].flatMap((entry) => entry ? [toRelativeFileEntry(root, entry)] : [])] : [];
|
|
@@ -1875,7 +1887,6 @@ function vinext(options = {}) {
|
|
|
1875
1887
|
additionalClientOptimizeIncludes.push(include);
|
|
1876
1888
|
} catch {}
|
|
1877
1889
|
}
|
|
1878
|
-
if (!excluded.includes("next") && !excluded.includes("next/link")) additionalClientOptimizeIncludes.push("next/link");
|
|
1879
1890
|
} catch {}
|
|
1880
1891
|
}
|
|
1881
1892
|
const appClientInput = { index: VIRTUAL_APP_BROWSER_ENTRY };
|
|
@@ -1895,13 +1906,9 @@ function vinext(options = {}) {
|
|
|
1895
1906
|
noExternal: userSsrExternal === true ? [...PATCHED_SERVER_PACKAGES] : true
|
|
1896
1907
|
} },
|
|
1897
1908
|
optimizeDeps: {
|
|
1898
|
-
exclude: mergeOptimizeDepsExclude(incomingExclude,
|
|
1909
|
+
exclude: mergeOptimizeDepsExclude(incomingExclude, shimOptimizeDepsExclude),
|
|
1899
1910
|
entries: optimizeEntries,
|
|
1900
|
-
include: [.../* @__PURE__ */ new Set([
|
|
1901
|
-
...incomingInclude,
|
|
1902
|
-
...additionalRscOptimizeIncludes,
|
|
1903
|
-
"react-server-dom-webpack/static.edge"
|
|
1904
|
-
])],
|
|
1911
|
+
include: [.../* @__PURE__ */ new Set([...incomingInclude, ...additionalRscOptimizeIncludes])],
|
|
1905
1912
|
...depOptimizeNodeEnvOptions
|
|
1906
1913
|
},
|
|
1907
1914
|
build: {
|
|
@@ -1923,7 +1930,8 @@ function vinext(options = {}) {
|
|
|
1923
1930
|
noExternal: userSsrExternal === true ? [...PATCHED_SERVER_PACKAGES] : true
|
|
1924
1931
|
} },
|
|
1925
1932
|
optimizeDeps: {
|
|
1926
|
-
exclude: mergeOptimizeDepsExclude(incomingExclude,
|
|
1933
|
+
exclude: mergeOptimizeDepsExclude(incomingExclude, shimOptimizeDepsExclude, ["ipaddr.js"], userSsrExternal === true || externalizeSsrReactInDev ? SSR_EXTERNAL_REACT_ENTRIES : []),
|
|
1934
|
+
...userSsrExternal === true || externalizeSsrReactInDev || hasCloudflarePlugin ? {} : { include: ["react-dom/server", "react-dom/static"] },
|
|
1927
1935
|
entries: optimizeEntries,
|
|
1928
1936
|
...depOptimizeNodeEnvOptions
|
|
1929
1937
|
},
|
|
@@ -1935,7 +1943,7 @@ function vinext(options = {}) {
|
|
|
1935
1943
|
client: {
|
|
1936
1944
|
consumer: "client",
|
|
1937
1945
|
optimizeDeps: {
|
|
1938
|
-
exclude: mergeOptimizeDepsExclude(incomingExclude,
|
|
1946
|
+
exclude: mergeOptimizeDepsExclude(incomingExclude, shimOptimizeDepsExclude, nextServerExternal),
|
|
1939
1947
|
entries: optimizeEntries,
|
|
1940
1948
|
include: [.../* @__PURE__ */ new Set([
|
|
1941
1949
|
...incomingInclude,
|
|
@@ -2013,7 +2021,7 @@ function vinext(options = {}) {
|
|
|
2013
2021
|
noExternal: true
|
|
2014
2022
|
},
|
|
2015
2023
|
optimizeDeps: {
|
|
2016
|
-
exclude: mergeOptimizeDepsExclude(incomingExclude,
|
|
2024
|
+
exclude: mergeOptimizeDepsExclude(incomingExclude, shimOptimizeDepsExclude, ["ipaddr.js"]),
|
|
2017
2025
|
...depOptimizeNodeEnvOptions
|
|
2018
2026
|
},
|
|
2019
2027
|
build: {
|
|
@@ -2041,17 +2049,27 @@ function vinext(options = {}) {
|
|
|
2041
2049
|
copyPublicDirIntoStaticExportBasePath = config.build.copyPublicDir !== false;
|
|
2042
2050
|
config.build.copyPublicDir = false;
|
|
2043
2051
|
}
|
|
2044
|
-
|
|
2052
|
+
const isClientConsumer = name === "client" || config.consumer === "client";
|
|
2053
|
+
if (isClientConsumer && hasAppDir) {
|
|
2054
|
+
config.optimizeDeps ??= {};
|
|
2055
|
+
config.optimizeDeps.exclude = mergeOptimizeDepsExclude(config.optimizeDeps.exclude ?? [], shimOptimizeDepsExclude);
|
|
2056
|
+
}
|
|
2057
|
+
if (!isClientConsumer) {
|
|
2045
2058
|
config.optimizeDeps ??= {};
|
|
2046
2059
|
config.optimizeDeps.rolldownOptions ??= {};
|
|
2047
2060
|
const configuredPlugins = config.optimizeDeps.rolldownOptions.plugins;
|
|
2048
|
-
config.optimizeDeps.rolldownOptions.plugins = [
|
|
2061
|
+
config.optimizeDeps.rolldownOptions.plugins = [
|
|
2062
|
+
...Array.isArray(configuredPlugins) ? configuredPlugins : configuredPlugins ? [configuredPlugins] : [],
|
|
2063
|
+
importMetaUrlCapability.optimizeDepsPlugin,
|
|
2064
|
+
createShimRequirePlugin()
|
|
2065
|
+
];
|
|
2066
|
+
config.optimizeDeps.exclude = mergeOptimizeDepsExclude(config.optimizeDeps.exclude ?? [], shimOptimizeDepsExclude);
|
|
2049
2067
|
}
|
|
2050
2068
|
if (isServeCommand && hasCloudflarePlugin && hasPagesDir && !hasAppDir && name !== "client") {
|
|
2051
2069
|
config.optimizeDeps ??= {};
|
|
2052
2070
|
config.optimizeDeps.entries = mergeStringArrayValues(config.optimizeDeps.entries, pagesOptimizeEntries);
|
|
2053
2071
|
config.optimizeDeps.include = mergeStringArrayValues(config.optimizeDeps.include, PAGES_CLOUDFLARE_WORKER_OPTIMIZE_DEPS_INCLUDE);
|
|
2054
|
-
config.optimizeDeps.exclude = mergeOptimizeDepsExclude(config.optimizeDeps.exclude ?? [],
|
|
2072
|
+
config.optimizeDeps.exclude = mergeOptimizeDepsExclude(config.optimizeDeps.exclude ?? [], PAGES_CLOUDFLARE_WORKER_OPTIMIZE_DEPS_EXCLUDE);
|
|
2055
2073
|
}
|
|
2056
2074
|
const configuredExtensions = name === "client" ? nextConfig.resolveExtensions : nextConfig.serverResolveExtensions;
|
|
2057
2075
|
const extensions = configuredExtensions === null ? buildViteResolveExtensions(config.resolve?.extensions) : normalizeViteResolveExtensions(configuredExtensions);
|
|
@@ -2066,11 +2084,21 @@ function vinext(options = {}) {
|
|
|
2066
2084
|
if (!config.server.middlewareMode) applyDevServerDefaults(config.server, {});
|
|
2067
2085
|
}
|
|
2068
2086
|
}
|
|
2069
|
-
if (isServeCommand
|
|
2087
|
+
if (isServeCommand) {
|
|
2070
2088
|
const optionalWarnings = /* @__PURE__ */ new Set();
|
|
2089
|
+
const isExcludedShim = (depId) => shimOptimizeDepsExclude.some((excluded) => {
|
|
2090
|
+
if (depId === excluded || depId.startsWith(`${excluded}/`)) return true;
|
|
2091
|
+
if (!/[*?[\]{}()!]/.test(depId)) return false;
|
|
2092
|
+
const pkgName = depId.split("/").slice(0, depId.startsWith("@") ? 2 : 1).join("/");
|
|
2093
|
+
if (excluded !== pkgName && !excluded.startsWith(`${pkgName}/`)) return false;
|
|
2094
|
+
return typeof path.matchesGlob !== "function" || path.matchesGlob(excluded, depId);
|
|
2095
|
+
});
|
|
2071
2096
|
for (const [name, environment] of Object.entries(config.environments)) {
|
|
2072
2097
|
const optimizer = environment.optimizeDeps;
|
|
2073
|
-
const
|
|
2098
|
+
const isClient = (environment.consumer ?? name) === "client";
|
|
2099
|
+
const optimizerActive = !optimizer.noDiscovery || !!optimizer.include?.length;
|
|
2100
|
+
if (optimizer.include && (!isClient || hasAppDir)) optimizer.include = optimizer.include.filter((id) => !isExcludedShim(id.slice(id.lastIndexOf(">") + 1).trim()));
|
|
2101
|
+
const optionalIncludes = isClient ? hasAppDir && optimizerActive ? [...optimizer.noDiscovery ? [] : APP_CLIENT_OPTIONAL_OPTIMIZE_DEPS_INCLUDE, ...CLIENT_OPTIONAL_OPTIMIZE_DEPS_INCLUDE] : [] : !hasAppDir && hasCloudflarePlugin && hasPagesDir ? PAGES_CLOUDFLARE_WORKER_OPTIONAL_OPTIMIZE_DEPS_INCLUDE : [];
|
|
2074
2102
|
for (const id of optionalIncludes) {
|
|
2075
2103
|
const depId = id.slice(id.lastIndexOf(">") + 1).trim();
|
|
2076
2104
|
if (optimizer.include?.includes(id) || optimizer.include?.includes(depId) || optimizer.exclude?.some((excluded) => depId === excluded || depId.startsWith(`${excluded}/`))) continue;
|
|
@@ -2383,7 +2411,12 @@ function vinext(options = {}) {
|
|
|
2383
2411
|
isDynamic: route.isDynamic,
|
|
2384
2412
|
patternParts: [...route.patternParts]
|
|
2385
2413
|
})) : [];
|
|
2386
|
-
|
|
2414
|
+
const classifyDynamicRoutes = this.environment.config.command === "build" && !nextConfig?.cacheComponents;
|
|
2415
|
+
const readMdxEsm = classifyDynamicRoutes && pageExtensionsIncludeMdx(nextConfig?.pageExtensions ?? []) ? await loadMdxEsmReader(root) : null;
|
|
2416
|
+
return generateBrowserEntry(graph.routes, pagesPrefetchRoutes, nextConfig.rewrites, nextConfig.i18n?.locales, classifyDynamicRoutes ? {
|
|
2417
|
+
route: (route) => isAppPageRouteRenderedDynamically(route, readMdxEsm),
|
|
2418
|
+
intercept: (intercept, layoutPaths) => isAppInterceptRenderedDynamically(intercept, layoutPaths, readMdxEsm)
|
|
2419
|
+
} : void 0);
|
|
2387
2420
|
}
|
|
2388
2421
|
if (id === RESOLVED_APP_ROUTE_MANIFEST && hasAppDir) {
|
|
2389
2422
|
const graph = await appRouteGraph(appDir, nextConfig?.pageExtensions, fileMatcher);
|
|
@@ -2439,6 +2472,20 @@ export const loadServerActionClient = ${hasServerActions ? `() => import(${JSON.
|
|
|
2439
2472
|
}
|
|
2440
2473
|
}
|
|
2441
2474
|
},
|
|
2475
|
+
{
|
|
2476
|
+
name: "vinext:cloudflare-react-dom-edge",
|
|
2477
|
+
enforce: "pre",
|
|
2478
|
+
resolveId: {
|
|
2479
|
+
filter: { id: /^react-dom\/(?:server|static)$/ },
|
|
2480
|
+
handler(id, importer, options) {
|
|
2481
|
+
if (!hasCloudflarePlugin || this.environment?.config.consumer !== "server" || this.environment.name === "rsc") return;
|
|
2482
|
+
return this.resolve(`${id}.edge`, importer, {
|
|
2483
|
+
...options,
|
|
2484
|
+
skipSelf: true
|
|
2485
|
+
});
|
|
2486
|
+
}
|
|
2487
|
+
}
|
|
2488
|
+
},
|
|
2442
2489
|
{
|
|
2443
2490
|
name: "vinext:cloudflare-framework-tracing",
|
|
2444
2491
|
transform: {
|
|
@@ -2649,22 +2696,38 @@ export const loadServerActionClient = ${hasServerActions ? `() => import(${JSON.
|
|
|
2649
2696
|
{
|
|
2650
2697
|
name: "vinext:client-entry-manifest",
|
|
2651
2698
|
apply: "build",
|
|
2652
|
-
generateBundle
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2699
|
+
generateBundle: {
|
|
2700
|
+
order: "post",
|
|
2701
|
+
handler(_options, bundle) {
|
|
2702
|
+
if (this.environment?.name !== "client") return;
|
|
2703
|
+
const manifest = {};
|
|
2704
|
+
for (const chunk of Object.values(bundle)) {
|
|
2705
|
+
if (chunk.type !== "chunk") continue;
|
|
2706
|
+
if (chunk.isDynamicEntry && isVirtualEntryFacade(chunk.facadeModuleId, VIRTUAL_APP_ROUTE_MANIFEST)) manifest.appRouteManifest = chunk.fileName;
|
|
2707
|
+
if (!chunk.isEntry) continue;
|
|
2708
|
+
if (isVirtualEntryFacade(chunk.facadeModuleId, VIRTUAL_CLIENT_ENTRY)) manifest.pagesClientEntry = chunk.fileName;
|
|
2709
|
+
else if (isVirtualEntryFacade(chunk.facadeModuleId, VIRTUAL_APP_BROWSER_ENTRY)) manifest.appBrowserEntry = chunk.fileName;
|
|
2710
|
+
}
|
|
2711
|
+
if (clientReferenceModules) {
|
|
2712
|
+
const appBrowserEntry = manifest.appBrowserEntry ? bundle[manifest.appBrowserEntry] : void 0;
|
|
2713
|
+
manifest.appClientReferenceChunks = collectClientReferenceChunks(bundle, clientReferenceModules, appBrowserEntry?.type === "chunk" ? appBrowserEntry : void 0, this.environment.config.build.modulePreload);
|
|
2714
|
+
const sources = collectClientReferenceSources(bundle, (moduleId) => this.getModuleInfo(moduleId)?.importedIds, this.environment.config.root);
|
|
2715
|
+
if (sources) this.emitFile({
|
|
2716
|
+
type: "asset",
|
|
2717
|
+
fileName: VINEXT_CLIENT_REFERENCE_SOURCES,
|
|
2718
|
+
source: JSON.stringify(sources, null, 2) + "\n"
|
|
2719
|
+
});
|
|
2720
|
+
}
|
|
2721
|
+
if (!manifest.pagesClientEntry && !manifest.appBrowserEntry) return;
|
|
2722
|
+
this.emitFile({
|
|
2723
|
+
type: "asset",
|
|
2724
|
+
fileName: VINEXT_CLIENT_ENTRY_MANIFEST,
|
|
2725
|
+
source: JSON.stringify(manifest, null, 2) + "\n"
|
|
2726
|
+
});
|
|
2659
2727
|
}
|
|
2660
|
-
if (!manifest.pagesClientEntry && !manifest.appBrowserEntry) return;
|
|
2661
|
-
this.emitFile({
|
|
2662
|
-
type: "asset",
|
|
2663
|
-
fileName: VINEXT_CLIENT_ENTRY_MANIFEST,
|
|
2664
|
-
source: JSON.stringify(manifest, null, 2) + "\n"
|
|
2665
|
-
});
|
|
2666
2728
|
}
|
|
2667
2729
|
},
|
|
2730
|
+
createClientCompileHintsPlugin((id) => isVirtualEntryFacade(id, VIRTUAL_APP_BROWSER_ENTRY) || isVirtualEntryFacade(id, VIRTUAL_CLIENT_ENTRY)),
|
|
2668
2731
|
asyncHooksStubPlugin,
|
|
2669
2732
|
createInstrumentationClientTransformPlugin(() => instrumentationClientPath, () => nextConfig.instrumentationClientRouteManifest),
|
|
2670
2733
|
createInstrumentationServerTransformPlugin(() => instrumentationPath, () => nextConfig.instrumentationServerValueInjections),
|
|
@@ -3855,7 +3918,7 @@ export const loadServerActionClient = ${hasServerActions ? `() => import(${JSON.
|
|
|
3855
3918
|
const cache = imageImportDimCache;
|
|
3856
3919
|
let dims = cache.get(imagePath);
|
|
3857
3920
|
if (!dims) try {
|
|
3858
|
-
const { imageSize } = await import("./deps/.pnpm/image-size@2.0.
|
|
3921
|
+
const { imageSize } = await import("./deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/index.js");
|
|
3859
3922
|
const result = imageSize(fs.readFileSync(imagePath));
|
|
3860
3923
|
dims = {
|
|
3861
3924
|
width: result.width ?? 0,
|
|
@@ -4178,6 +4241,8 @@ export const loadServerActionClient = ${hasServerActions ? `() => import(${JSON.
|
|
|
4178
4241
|
pagesClientAssetsModule = buildPagesClientAssetsModule({
|
|
4179
4242
|
clientEntry: runtimeMetadata.clientEntryFile ?? void 0,
|
|
4180
4243
|
appBootstrapPreinitModules: runtimeMetadata.appBootstrapPreinitModules,
|
|
4244
|
+
appRouteManifestModule: runtimeMetadata.appRouteManifestModule,
|
|
4245
|
+
appClientReferenceChunks: runtimeMetadata.appClientReferenceChunks,
|
|
4181
4246
|
ssrManifest,
|
|
4182
4247
|
cssGraph: runtimeMetadata.cssGraph,
|
|
4183
4248
|
sharedChunks: runtimeMetadata.sharedChunks,
|
|
@@ -4392,6 +4457,9 @@ export const loadServerActionClient = ${hasServerActions ? `() => import(${JSON.
|
|
|
4392
4457
|
if (rscPluginPromise) {
|
|
4393
4458
|
plugins.push(createRscReferenceValidationNormalizerPlugin());
|
|
4394
4459
|
plugins.push(createRscClientReferenceLoadersPlugin({
|
|
4460
|
+
onClientReferenceModules(modules) {
|
|
4461
|
+
clientReferenceModules = modules;
|
|
4462
|
+
},
|
|
4395
4463
|
routes: {
|
|
4396
4464
|
canonicalizeModuleId: canonicalize,
|
|
4397
4465
|
getAlwaysRenderedFiles: () => clientReferenceAlwaysRenderedFiles,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Plugin } from "vite";
|
|
2
|
+
//#region src/plugins/client-compile-hints.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* V8's file-level explicit compile hint (Chrome 136+). V8 compiles every
|
|
5
|
+
* function in a file that starts with this comment eagerly, on the background
|
|
6
|
+
* thread that streams the script, instead of lazily on the main thread the
|
|
7
|
+
* first time each function runs. Other engines ignore it.
|
|
8
|
+
* https://v8.dev/blog/explicit-compile-hints
|
|
9
|
+
*/
|
|
10
|
+
export declare const CLIENT_COMPILE_HINT = "//# allFunctionsCalledOnLoad";
|
|
11
|
+
/**
|
|
12
|
+
* Marks the client chunks every page load runs with V8's compile hint.
|
|
13
|
+
*
|
|
14
|
+
* Those are the browser entry chunks and the chunks they import statically:
|
|
15
|
+
* React, React DOM, the Flight client and the vinext runtime. Hydration calls
|
|
16
|
+
* most of their functions on load, so lazy compilation only moves that work
|
|
17
|
+
* onto the main thread. Chunks reached through dynamic imports (route code,
|
|
18
|
+
* lazy client references, navigation-only modules) keep lazy compilation,
|
|
19
|
+
* since eagerly compiling code a page may never call costs time and memory.
|
|
20
|
+
*
|
|
21
|
+
* The hint has to be the first line of the file, so it is added in the last
|
|
22
|
+
* generateBundle pass, after minification and after Vite's import analysis
|
|
23
|
+
* prepends its `__vite__mapDeps` preload helper. That pass runs after Rolldown
|
|
24
|
+
* hashes file names, so `augmentChunkHash` salts the hash of every chunk that
|
|
25
|
+
* gets the hint: a hinted file never reuses the URL of an unhinted one, which
|
|
26
|
+
* browsers may hold as immutable. Its sourcemap keeps following the chunk's
|
|
27
|
+
* name, so builds that name sourcemaps themselves are left alone.
|
|
28
|
+
*/
|
|
29
|
+
export declare function createClientCompileHintsPlugin(isBrowserEntry: (id: string) => boolean): Plugin;
|
|
30
|
+
//#endregion
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
//#region src/plugins/client-compile-hints.ts
|
|
2
|
+
/**
|
|
3
|
+
* V8's file-level explicit compile hint (Chrome 136+). V8 compiles every
|
|
4
|
+
* function in a file that starts with this comment eagerly, on the background
|
|
5
|
+
* thread that streams the script, instead of lazily on the main thread the
|
|
6
|
+
* first time each function runs. Other engines ignore it.
|
|
7
|
+
* https://v8.dev/blog/explicit-compile-hints
|
|
8
|
+
*/
|
|
9
|
+
const CLIENT_COMPILE_HINT = "//# allFunctionsCalledOnLoad";
|
|
10
|
+
/** Shifts a sourcemap down one generated line, for a line added at the top. */
|
|
11
|
+
function shiftSourceMapSource(source) {
|
|
12
|
+
const text = typeof source === "string" ? source : new TextDecoder().decode(source);
|
|
13
|
+
const map = JSON.parse(text);
|
|
14
|
+
map.mappings = ";" + map.mappings;
|
|
15
|
+
return JSON.stringify(map);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Marks the client chunks every page load runs with V8's compile hint.
|
|
19
|
+
*
|
|
20
|
+
* Those are the browser entry chunks and the chunks they import statically:
|
|
21
|
+
* React, React DOM, the Flight client and the vinext runtime. Hydration calls
|
|
22
|
+
* most of their functions on load, so lazy compilation only moves that work
|
|
23
|
+
* onto the main thread. Chunks reached through dynamic imports (route code,
|
|
24
|
+
* lazy client references, navigation-only modules) keep lazy compilation,
|
|
25
|
+
* since eagerly compiling code a page may never call costs time and memory.
|
|
26
|
+
*
|
|
27
|
+
* The hint has to be the first line of the file, so it is added in the last
|
|
28
|
+
* generateBundle pass, after minification and after Vite's import analysis
|
|
29
|
+
* prepends its `__vite__mapDeps` preload helper. That pass runs after Rolldown
|
|
30
|
+
* hashes file names, so `augmentChunkHash` salts the hash of every chunk that
|
|
31
|
+
* gets the hint: a hinted file never reuses the URL of an unhinted one, which
|
|
32
|
+
* browsers may hold as immutable. Its sourcemap keeps following the chunk's
|
|
33
|
+
* name, so builds that name sourcemaps themselves are left alone.
|
|
34
|
+
*/
|
|
35
|
+
function createClientCompileHintsPlugin(isBrowserEntry) {
|
|
36
|
+
const startupByEnvironment = /* @__PURE__ */ new WeakMap();
|
|
37
|
+
const startupChunks = (environment) => (environment && startupByEnvironment.get(environment)?.chunks) ?? void 0;
|
|
38
|
+
return {
|
|
39
|
+
name: "vinext:client-compile-hints",
|
|
40
|
+
apply: "build",
|
|
41
|
+
enforce: "post",
|
|
42
|
+
renderStart(outputOptions) {
|
|
43
|
+
const environment = this.environment;
|
|
44
|
+
if (environment?.name !== "client") return;
|
|
45
|
+
const { codeSplitting, sourcemap, sourcemapFileNames } = outputOptions;
|
|
46
|
+
if (!codeSplitting || sourcemap === "inline" || sourcemap && sourcemapFileNames !== void 0) {
|
|
47
|
+
startupByEnvironment.delete(environment);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
startupByEnvironment.set(environment, { chunks: null });
|
|
51
|
+
},
|
|
52
|
+
renderChunk(_code, _chunk, _options, meta) {
|
|
53
|
+
const state = this.environment && startupByEnvironment.get(this.environment);
|
|
54
|
+
if (!state || state.chunks) return null;
|
|
55
|
+
const startup = /* @__PURE__ */ new Set();
|
|
56
|
+
const pending = [];
|
|
57
|
+
for (const chunk of Object.values(meta.chunks)) if (chunk.isEntry && chunk.facadeModuleId !== null && isBrowserEntry(chunk.facadeModuleId)) pending.push(chunk.fileName);
|
|
58
|
+
for (let fileName = pending.pop(); fileName !== void 0; fileName = pending.pop()) {
|
|
59
|
+
const chunk = meta.chunks[fileName];
|
|
60
|
+
if (startup.has(fileName) || !chunk) continue;
|
|
61
|
+
startup.add(fileName);
|
|
62
|
+
pending.push(...chunk.imports);
|
|
63
|
+
}
|
|
64
|
+
state.chunks = startup;
|
|
65
|
+
return null;
|
|
66
|
+
},
|
|
67
|
+
augmentChunkHash(chunk) {
|
|
68
|
+
if (startupChunks(this.environment)?.has(chunk.fileName)) return CLIENT_COMPILE_HINT;
|
|
69
|
+
},
|
|
70
|
+
generateBundle: {
|
|
71
|
+
order: "post",
|
|
72
|
+
handler(options, bundle) {
|
|
73
|
+
const startup = startupChunks(this.environment);
|
|
74
|
+
if (!startup) return;
|
|
75
|
+
for (const chunk of Object.values(bundle)) {
|
|
76
|
+
if (chunk.type !== "chunk" || !startup.has(chunk.preliminaryFileName)) continue;
|
|
77
|
+
chunk.code = `${CLIENT_COMPILE_HINT}\n${chunk.code}`;
|
|
78
|
+
if (!options.sourcemap) continue;
|
|
79
|
+
if (chunk.map) chunk.map.mappings = ";" + chunk.map.mappings;
|
|
80
|
+
const mapAsset = chunk.sourcemapFileName ? bundle[chunk.sourcemapFileName] : void 0;
|
|
81
|
+
if (mapAsset?.type === "asset") mapAsset.source = shiftSourceMapSource(mapAsset.source);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
export { CLIENT_COMPILE_HINT, createClientCompileHintsPlugin };
|
|
@@ -30,4 +30,5 @@ export declare function extractPackageImportSpecifier(absolutePath: string, read
|
|
|
30
30
|
* Dev-only — production builds use the SSR manifest which handles this correctly.
|
|
31
31
|
*/
|
|
32
32
|
export declare function clientReferenceDedupPlugin(options?: ClientReferenceDedupOptions): Plugin;
|
|
33
|
-
//#endregion
|
|
33
|
+
//#endregion
|
|
34
|
+
export {};
|
|
@@ -6,6 +6,8 @@ type TransformResult = {
|
|
|
6
6
|
map: ReturnType<MagicString["generateMap"]>;
|
|
7
7
|
};
|
|
8
8
|
type ResolveDynamicImport = (specifier: string, importer: string) => Promise<string | null>;
|
|
9
|
+
export declare function toManifestModuleId(root: string, resolvedId: string): string | null;
|
|
9
10
|
export declare function transformNextDynamicPreloadMetadata(code: string, id: string, root: string, resolveDynamicImport: ResolveDynamicImport): Promise<TransformResult | null>;
|
|
10
11
|
export declare function createDynamicPreloadMetadataPlugin(getTranspiledPackages: () => readonly string[]): Plugin;
|
|
11
|
-
//#endregion
|
|
12
|
+
//#endregion
|
|
13
|
+
export {};
|
|
@@ -290,4 +290,4 @@ function createDynamicPreloadMetadataPlugin(getTranspiledPackages) {
|
|
|
290
290
|
};
|
|
291
291
|
}
|
|
292
292
|
//#endregion
|
|
293
|
-
export { createDynamicPreloadMetadataPlugin, transformNextDynamicPreloadMetadata };
|
|
293
|
+
export { createDynamicPreloadMetadataPlugin, toManifestModuleId, transformNextDynamicPreloadMetadata };
|
package/dist/plugins/fonts.js
CHANGED
|
@@ -74,10 +74,12 @@ const CACHED_FONT_DIR_TOKEN = "__VINEXT_FONT_CACHE_DIR__";
|
|
|
74
74
|
* Cached stylesheet whose `url()` references use `CACHED_FONT_DIR_TOKEN`.
|
|
75
75
|
* The suffix ties the cache to that format: a `style.css` written by an
|
|
76
76
|
* earlier vinext holds the writing checkout's absolute paths, which would
|
|
77
|
-
* 404 once embedded,
|
|
78
|
-
*
|
|
77
|
+
* 404 once embedded, and a `style-q7f3kd.css` names extensionless Google
|
|
78
|
+
* font URLs `.ttf` whatever their format, so neither is read and the font
|
|
79
|
+
* is fetched again. Change the suffix whenever the cached CSS format
|
|
80
|
+
* changes.
|
|
79
81
|
*/
|
|
80
|
-
const CACHED_FONT_CSS_FILE = "style-
|
|
82
|
+
const CACHED_FONT_CSS_FILE = "style-h8r2vn.css";
|
|
81
83
|
function formatGoogleFontsErrorBody(body) {
|
|
82
84
|
const trimmed = body.trim();
|
|
83
85
|
if (!trimmed) return "(empty response body)";
|
|
@@ -330,16 +332,11 @@ async function downloadGoogleFont(cssUrl, family, fontDir, fontDirName) {
|
|
|
330
332
|
}
|
|
331
333
|
let css = await cssResponse.text();
|
|
332
334
|
if (!css.trim()) throw new Error(`Google Fonts returned an empty stylesheet: ${cssUrl}`);
|
|
333
|
-
const urlRe = /url\((https:\/\/fonts\.gstatic\.com\/[^)]+)\)/g;
|
|
334
335
|
const urls = /* @__PURE__ */ new Map();
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
const
|
|
338
|
-
|
|
339
|
-
const ext = fontUrl.includes(".woff2") ? ".woff2" : fontUrl.includes(".woff") ? ".woff" : ".ttf";
|
|
340
|
-
const fileHash = createHash("md5").update(fontUrl).digest("hex").slice(0, 8);
|
|
341
|
-
urls.set(fontUrl, `${family.toLowerCase().replace(/\s+/g, "-")}-${fileHash}${ext}`);
|
|
342
|
-
}
|
|
336
|
+
for (const { googleFontFileUrl: fontUrl, ext } of findFontFilesInCss(css)) {
|
|
337
|
+
if (!fontUrl.startsWith("https://fonts.gstatic.com/")) continue;
|
|
338
|
+
const fileHash = createHash("md5").update(fontUrl).digest("hex").slice(0, 8);
|
|
339
|
+
urls.set(fontUrl, `${family.toLowerCase().replace(/\s+/g, "-")}-${fileHash}.${ext}`);
|
|
343
340
|
}
|
|
344
341
|
fs.mkdirSync(fontDir, { recursive: true });
|
|
345
342
|
for (const [fontUrl, filename] of urls) {
|
|
@@ -15,4 +15,5 @@ declare function transformVeryDynamicRequests(code: string, id: string): MagicSt
|
|
|
15
15
|
export declare function createIgnoreDynamicRequestsPlugin(getTranspiledPackages?: () => readonly string[]): Plugin;
|
|
16
16
|
export declare const _transformVeryDynamicRequests: typeof transformVeryDynamicRequests;
|
|
17
17
|
export declare const _mayContainVeryDynamicRequest: typeof mayContainVeryDynamicRequest;
|
|
18
|
-
//#endregion
|
|
18
|
+
//#endregion
|
|
19
|
+
export {};
|
|
@@ -17,4 +17,5 @@ export declare function createImportMetaUrlPlugin(options: {
|
|
|
17
17
|
}): ImportMetaUrlCapability;
|
|
18
18
|
export declare function rewriteImportMetaUrl(code: string, id: string, root: string, environment: ImportMetaUrlEnvironment): MagicStringTransformResult | null;
|
|
19
19
|
export declare function rewriteServerCjsGlobals(code: string, id: string, root: string): MagicStringTransformResult | null;
|
|
20
|
-
//#endregion
|
|
20
|
+
//#endregion
|
|
21
|
+
export {};
|
|
@@ -37,9 +37,8 @@ function createOgInlineFetchAssetsPlugin() {
|
|
|
37
37
|
...options,
|
|
38
38
|
skipSelf: true
|
|
39
39
|
});
|
|
40
|
-
if (resolved
|
|
41
|
-
|
|
42
|
-
return null;
|
|
40
|
+
if (resolved !== null && !resolved.external) await ownership.recordResolvedImport(source, resolved.id);
|
|
41
|
+
return options.kind === "require-call" ? null : resolved;
|
|
43
42
|
},
|
|
44
43
|
transform: {
|
|
45
44
|
filter: { code: "import.meta.url" },
|
|
@@ -61,4 +61,5 @@ export declare function buildBarrelExportMap(entryPath: string | null, readFile:
|
|
|
61
61
|
* @param getRoot - Returns the current project root (set by the vinext:config hook).
|
|
62
62
|
*/
|
|
63
63
|
export declare function createOptimizeImportsPlugin(getNextConfig: () => ResolvedNextConfig | undefined, getRoot: () => string): Plugin;
|
|
64
|
-
//#endregion
|
|
64
|
+
//#endregion
|
|
65
|
+
export {};
|
|
@@ -12,4 +12,5 @@ export declare function isConditionalRequireScriptModuleId(id: string): boolean;
|
|
|
12
12
|
type IdResolverFactory = typeof createIdResolver;
|
|
13
13
|
type CommonJsTransformFilter = (id: string) => boolean | undefined;
|
|
14
14
|
export declare function createRequireConditionResolutionPlugin(createResolver?: IdResolverFactory, commonjsTransformFilter?: CommonJsTransformFilter): Plugin;
|
|
15
|
-
//#endregion
|
|
15
|
+
//#endregion
|
|
16
|
+
export {};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { AppRoute } from "../routing/app-route-graph.js";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
3
|
//#region src/plugins/rsc-client-reference-loaders.d.ts
|
|
4
|
+
/** Prefixes the module that registers one client reference outside every group. */
|
|
5
|
+
export declare const RESOLVED_CLIENT_REFERENCE_MODULE_PREFIX = "\0virtual:vinext-client-reference-module/";
|
|
6
|
+
export declare const RESOLVED_CLIENT_REFERENCE_CHUNKS_ID = "\0virtual:vinext-client-reference-chunks";
|
|
4
7
|
export type RscClientReferenceRouteOptions = {
|
|
5
8
|
/** Maps route file paths to the module ids used by the RSC module graph. */
|
|
6
9
|
canonicalizeModuleId: (id: string) => string;
|
|
@@ -37,6 +40,11 @@ export type RscClientReferenceGroupingOptions = {
|
|
|
37
40
|
export declare function createRscClientReferenceLoadersPlugin(options?: {
|
|
38
41
|
routes?: RscClientReferenceRouteOptions;
|
|
39
42
|
grouping?: RscClientReferenceGroupingOptions;
|
|
43
|
+
/**
|
|
44
|
+
* Receives the client build's client reference modules: each resolved
|
|
45
|
+
* module id with the keys of the references it registers.
|
|
46
|
+
*/
|
|
47
|
+
onClientReferenceModules?: (modules: ReadonlyMap<string, readonly string[]>) => void;
|
|
40
48
|
}): Plugin;
|
|
41
49
|
/**
|
|
42
50
|
* Exports a null preload plan from the client-references virtual module when
|