vinext 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/THIRD_PARTY_LICENSES.md +47 -0
- package/dist/_virtual/_rolldown/runtime.js +4 -3
- package/dist/build/action-owner-manifest.d.ts +3 -2
- package/dist/build/action-owner-manifest.js +18 -2
- package/dist/build/app-page-static-eligibility.d.ts +17 -1
- package/dist/build/app-page-static-eligibility.js +80 -13
- package/dist/build/clean-output.d.ts +2 -1
- package/dist/build/client-build-config.d.ts +13 -3
- package/dist/build/client-build-config.js +46 -9
- package/dist/build/client-reference-async.d.ts +48 -0
- package/dist/build/client-reference-async.js +123 -0
- package/dist/build/client-reference-chunks.d.ts +32 -0
- package/dist/build/client-reference-chunks.js +111 -0
- package/dist/build/client-reference-groups.d.ts +9 -1
- package/dist/build/client-reference-groups.js +40 -2
- package/dist/build/css-url-assets.d.ts +2 -1
- package/dist/build/google-fonts/fallback-metrics.d.ts +2 -1
- package/dist/build/google-fonts/find-font-files-in-css.d.ts +1 -0
- package/dist/build/google-fonts/find-font-files-in-css.js +17 -4
- package/dist/build/google-fonts/font-metadata.d.ts +2 -1
- package/dist/build/google-fonts/validate.d.ts +2 -1
- package/dist/build/inline-css.d.ts +2 -1
- package/dist/build/module-dependency-cache.d.ts +2 -1
- package/dist/build/next-client-runtime-manifests.d.ts +2 -1
- package/dist/build/precompress.d.ts +2 -1
- package/dist/build/precompress.js +1 -1
- package/dist/build/prerender-paths.d.ts +2 -1
- package/dist/build/prerender-phase.d.ts +2 -1
- package/dist/build/prerender-server-pool.js +1 -1
- package/dist/build/prerender.d.ts +3 -2
- package/dist/build/prerender.js +6 -5
- package/dist/build/report.d.ts +2 -15
- package/dist/build/report.js +1 -51
- package/dist/build/run-prerender.d.ts +2 -1
- package/dist/build/server-actions-encryption-key.d.ts +2 -1
- package/dist/build/ssr-manifest.js +25 -2
- package/dist/build/standalone.d.ts +2 -1
- package/dist/cache/cache-adapters-virtual.d.ts +2 -1
- package/dist/cache.js +1 -2
- package/dist/check.d.ts +2 -1
- package/dist/check.js +5 -1
- package/dist/cli-args.d.ts +2 -1
- package/dist/cli.js +5 -0
- package/dist/client/client-redirect-matcher.js +2 -1
- package/dist/client/client-redirects.d.ts +4 -3
- package/dist/client/client-redirects.js +2 -1
- package/dist/client/client-rewrites.d.ts +2 -1
- package/dist/client/dev-error-overlay-store.d.ts +2 -1
- package/dist/client/dev-error-overlay.js +1 -1
- package/dist/client/index.js +1 -2
- package/dist/client/instrumentation-client-state.js +5 -5
- package/dist/client/navigation-runtime.d.ts +16 -2
- package/dist/client/navigation-runtime.js +2 -2
- package/dist/client/pages-router-link-navigation.d.ts +2 -1
- package/dist/client/vinext-next-data.d.ts +25 -1
- package/dist/client/window-next.d.ts +2 -1
- package/dist/config/config-matchers.d.ts +12 -1
- package/dist/config/config-matchers.js +111 -16
- package/dist/config/dotenv.d.ts +2 -1
- package/dist/config/next-config.d.ts +32 -1
- package/dist/config/next-config.js +93 -5
- package/dist/config/tsconfig-paths.d.ts +2 -1
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/dbcs-codec.js +327 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/dbcs-data.js +123 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/index.js +29 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/internal.js +134 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-codec.js +50 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-data-generated.js +455 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-data.js +147 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/big5-added.json.js +169 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp936.json.js +2584 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp949.json.js +2220 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp950.json.js +227 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/eucjp.json.js +425 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/gb18030-ranges.json.js +427 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/gbk-added.json.js +229 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/shiftjis.json.js +292 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/utf16.js +106 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/utf7.js +182 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/bom-handling.js +42 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/extend-node.js +147 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/index.js +94 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/streams.js +95 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/detector.js +23 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/index.js +2 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/lookup.js +25 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/bmp.js +11 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/cur.js +15 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/dds.js +11 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/gif.js +12 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/heif.js +55 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/icns.js +76 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/ico.js +39 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/index.js +46 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/j2c.js +11 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jp2.js +21 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jpg.js +71 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jxl-stream.js +42 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jxl.js +46 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/ktx.js +19 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/png.js +28 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/pnm.js +54 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/psd.js +11 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/svg.js +79 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/tga.js +15 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/tiff.js +96 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/utils.js +53 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/webp.js +45 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/utils/bit-reader.js +38 -0
- package/dist/deps/.pnpm/safer-buffer@2.1.2/deps/safer-buffer/safer.js +45 -0
- package/dist/deps/.pnpm/ua-parser-js@1.0.35/deps/ua-parser-js/src/ua-parser.js +2 -2
- package/dist/entries/app-browser-entry.d.ts +20 -5
- package/dist/entries/app-browser-entry.js +79 -6
- package/dist/entries/app-rsc-entry.d.ts +2 -1
- package/dist/entries/app-rsc-entry.js +59 -60
- package/dist/entries/app-rsc-manifest.d.ts +2 -1
- package/dist/entries/app-rsc-manifest.js +56 -4
- package/dist/entries/app-ssr-entry.js +1 -0
- package/dist/entries/pages-entry-helpers.js +1 -2
- package/dist/entries/pages-server-entry.d.ts +2 -1
- package/dist/entries/pages-server-entry.js +34 -9
- package/dist/entries/runtime-entry-module.d.ts +1 -0
- package/dist/entries/runtime-entry-module.js +4 -1
- package/dist/image/image-adapters-virtual.d.ts +2 -1
- package/dist/index.js +184 -103
- package/dist/init-cloudflare.d.ts +1 -3
- package/dist/init-cloudflare.js +10 -48
- package/dist/init-platform.d.ts +2 -0
- package/dist/init-platform.js +4 -0
- package/dist/plugins/client-compile-hints.d.ts +30 -0
- package/dist/plugins/client-compile-hints.js +88 -0
- package/dist/plugins/client-reference-dedup.d.ts +2 -1
- package/dist/plugins/cloudflare-dev-module-urls.d.ts +2 -1
- package/dist/plugins/dynamic-preload-metadata.d.ts +3 -1
- package/dist/plugins/dynamic-preload-metadata.js +1 -1
- package/dist/plugins/environment.d.ts +2 -1
- package/dist/plugins/extensionless-dynamic-import.js +6 -2
- package/dist/plugins/fonts.js +9 -12
- package/dist/plugins/ignore-dynamic-requests.d.ts +2 -1
- package/dist/plugins/import-meta-url.d.ts +2 -1
- package/dist/plugins/next-intl-catalog.d.ts +12 -0
- package/dist/plugins/next-intl-catalog.js +85 -0
- package/dist/plugins/og-assets.d.ts +2 -1
- package/dist/plugins/og-assets.js +2 -3
- package/dist/plugins/optimize-imports.d.ts +2 -1
- package/dist/plugins/pages-node-externals.d.ts +3 -1
- package/dist/plugins/pages-node-externals.js +1 -1
- package/dist/plugins/remove-console.d.ts +2 -1
- package/dist/plugins/require-condition-resolution.d.ts +2 -1
- package/dist/plugins/rsc-client-reference-loaders.d.ts +8 -0
- package/dist/plugins/rsc-client-reference-loaders.js +170 -68
- package/dist/plugins/rsc-client-shim-excludes.js +2 -0
- package/dist/plugins/sass.d.ts +2 -1
- package/dist/plugins/strip-server-exports.d.ts +2 -1
- package/dist/plugins/styled-jsx.d.ts +2 -1
- package/dist/plugins/transform-result.d.ts +2 -1
- package/dist/plugins/typeof-window.d.ts +2 -1
- package/dist/plugins/use-cache-callable.d.ts +1 -1
- package/dist/plugins/use-cache-callable.js +136 -94
- package/dist/plugins/worker-image-imports.js +1 -1
- package/dist/plugins/worker-use-server.d.ts +2 -1
- package/dist/routing/app-route-graph.d.ts +46 -0
- package/dist/routing/app-route-graph.js +131 -51
- package/dist/routing/browser-route-manifest.d.ts +2 -1
- package/dist/routing/optimistic-route-trie.d.ts +2 -1
- package/dist/routing/route-matching.d.ts +2 -1
- package/dist/routing/route-pattern.d.ts +2 -1
- package/dist/server/accept-encoding.d.ts +2 -1
- package/dist/server/api-handler.js +19 -4
- package/dist/server/app-action-forwarding.d.ts +2 -1
- package/dist/server/app-bfcache-identity.d.ts +2 -1
- package/dist/server/app-bfcache-identity.js +1 -1
- package/dist/server/app-browser-action-result.d.ts +2 -1
- package/dist/server/app-browser-entry.js +106 -66
- package/dist/server/app-browser-error.d.ts +2 -1
- package/dist/server/app-browser-history-controller.d.ts +7 -5
- package/dist/server/app-browser-history-controller.js +93 -15
- package/dist/server/app-browser-hydration.d.ts +2 -1
- package/dist/server/app-browser-interception-context.d.ts +2 -1
- package/dist/server/app-browser-navigation-controller.d.ts +2 -2
- package/dist/server/app-browser-navigation-controller.js +16 -12
- package/dist/server/app-browser-popstate.d.ts +2 -1
- package/dist/server/app-browser-rsc-redirect.d.ts +2 -1
- package/dist/server/app-browser-rsc-redirect.js +4 -4
- package/dist/server/app-browser-server-action-client.d.ts +4 -1
- package/dist/server/app-browser-server-action-client.js +4 -3
- package/dist/server/app-browser-state.d.ts +2 -4
- package/dist/server/app-browser-state.js +9 -4
- package/dist/server/app-browser-stream.d.ts +2 -1
- package/dist/server/app-browser-supplemental-refresh.js +16 -1
- package/dist/server/app-browser-visible-commit.d.ts +3 -2
- package/dist/server/app-browser-visible-commit.js +2 -12
- package/dist/server/app-client-reference-manifest.d.ts +31 -0
- package/dist/server/app-client-reference-manifest.js +46 -0
- package/dist/server/app-client-reference-preloader.d.ts +25 -5
- package/dist/server/app-client-reference-preloader.js +22 -7
- package/dist/server/app-elements-wire.d.ts +8 -39
- package/dist/server/app-elements-wire.js +4 -41
- package/dist/server/app-elements.d.ts +4 -2
- package/dist/server/app-elements.js +4 -2
- package/dist/server/app-fallback-renderer.d.ts +9 -2
- package/dist/server/app-fallback-renderer.js +4 -1
- package/dist/server/app-history-state.d.ts +4 -3
- package/dist/server/app-history-state.js +5 -2
- package/dist/server/app-inline-css-client.d.ts +2 -1
- package/dist/server/app-metadata-tracing.d.ts +2 -1
- package/dist/server/app-mounted-layouts.d.ts +21 -0
- package/dist/server/app-mounted-layouts.js +67 -0
- package/dist/server/app-optimistic-routing.d.ts +37 -2
- package/dist/server/app-optimistic-routing.js +75 -2
- package/dist/server/app-page-boundary-render.d.ts +20 -2
- package/dist/server/app-page-boundary-render.js +224 -40
- package/dist/server/app-page-boundary.d.ts +34 -5
- package/dist/server/app-page-boundary.js +41 -8
- package/dist/server/app-page-cache-finalizer.d.ts +14 -2
- package/dist/server/app-page-cache-finalizer.js +71 -30
- package/dist/server/app-page-cache-render.d.ts +10 -2
- package/dist/server/app-page-cache-render.js +14 -2
- package/dist/server/app-page-cache.d.ts +13 -1
- package/dist/server/app-page-cache.js +33 -11
- package/dist/server/app-page-dispatch.d.ts +39 -11
- package/dist/server/app-page-dispatch.js +236 -177
- package/dist/server/app-page-element-builder.d.ts +19 -3
- package/dist/server/app-page-element-builder.js +193 -71
- package/dist/server/app-page-execution.d.ts +43 -51
- package/dist/server/app-page-execution.js +205 -92
- package/dist/server/app-page-head.d.ts +108 -3
- package/dist/server/app-page-head.js +337 -154
- package/dist/server/app-page-http-access-fallback-metadata.d.ts +49 -2
- package/dist/server/app-page-http-access-fallback-metadata.js +77 -2
- package/dist/server/app-page-layout-gate.d.ts +35 -0
- package/dist/server/app-page-layout-gate.js +50 -0
- package/dist/server/app-page-method.d.ts +2 -1
- package/dist/server/app-page-params.d.ts +0 -1
- package/dist/server/app-page-params.js +1 -14
- package/dist/server/app-page-probe.d.ts +5 -22
- package/dist/server/app-page-probe.js +4 -37
- package/dist/server/app-page-render-identity.d.ts +2 -1
- package/dist/server/app-page-render.d.ts +9 -13
- package/dist/server/app-page-render.js +108 -214
- package/dist/server/app-page-request.d.ts +15 -4
- package/dist/server/app-page-request.js +2 -2
- package/dist/server/app-page-response.js +3 -3
- package/dist/server/app-page-route-wiring.d.ts +65 -8
- package/dist/server/app-page-route-wiring.js +259 -103
- package/dist/server/app-page-rsc-render-status.d.ts +29 -2
- package/dist/server/app-page-rsc-render-status.js +121 -13
- package/dist/server/app-page-search-params-observation.d.ts +7 -2
- package/dist/server/app-page-search-params-observation.js +8 -1
- package/dist/server/app-page-segment-plan.d.ts +2 -1
- package/dist/server/app-page-stream.d.ts +33 -1
- package/dist/server/app-page-stream.js +25 -6
- package/dist/server/app-pages-bridge.d.ts +6 -1
- package/dist/server/app-pages-bridge.js +7 -3
- package/dist/server/app-ppr-fallback-shell-render.d.ts +2 -1
- package/dist/server/app-ppr-fallback-shell.d.ts +2 -1
- package/dist/server/app-prerender-endpoints.d.ts +2 -1
- package/dist/server/app-prerender-static-params.d.ts +2 -1
- package/dist/server/app-render-dependency.d.ts +21 -4
- package/dist/server/app-render-dependency.js +100 -33
- package/dist/server/app-request-stage-dispatch.js +1 -1
- package/dist/server/app-request-stage-independent-entry.d.ts +2 -1
- package/dist/server/app-response-stage-entry.d.ts +2 -1
- package/dist/server/app-route-handler-cache.d.ts +2 -1
- package/dist/server/app-route-handler-cache.js +2 -2
- package/dist/server/app-route-handler-dispatch.d.ts +2 -1
- package/dist/server/app-route-handler-dispatch.js +15 -10
- package/dist/server/app-route-handler-execution.d.ts +2 -1
- package/dist/server/app-route-handler-execution.js +8 -3
- package/dist/server/app-route-handler-policy.d.ts +1 -1
- package/dist/server/app-route-handler-policy.js +3 -3
- package/dist/server/app-route-handler-response.d.ts +2 -1
- package/dist/server/app-route-handler-response.js +1 -1
- package/dist/server/app-route-handler-runtime.d.ts +2 -1
- package/dist/server/app-route-handler-runtime.js +17 -4
- package/dist/server/app-route-module-loader.d.ts +18 -1
- package/dist/server/app-route-module-loader.js +8 -0
- package/dist/server/app-route-tree-prefetch.d.ts +2 -1
- package/dist/server/app-rsc-cache-busting.d.ts +2 -2
- package/dist/server/app-rsc-cache-busting.js +4 -4
- package/dist/server/app-rsc-error-handler.d.ts +4 -2
- package/dist/server/app-rsc-error-handler.js +9 -1
- package/dist/server/app-rsc-errors.d.ts +10 -1
- package/dist/server/app-rsc-errors.js +8 -1
- package/dist/server/app-rsc-handler.d.ts +7 -6
- package/dist/server/app-rsc-handler.js +36 -34
- package/dist/server/app-rsc-request-normalization.d.ts +0 -4
- package/dist/server/app-rsc-request-normalization.js +1 -4
- package/dist/server/app-rsc-response-finalizer.d.ts +2 -1
- package/dist/server/app-rsc-response-finalizer.js +2 -2
- package/dist/server/app-rsc-response-stage.js +5 -3
- package/dist/server/app-rsc-route-matching.d.ts +38 -1
- package/dist/server/app-rsc-route-matching.js +24 -0
- package/dist/server/app-segment-config.d.ts +2 -1
- package/dist/server/app-segment-config.js +1 -14
- package/dist/server/app-server-action-execution.d.ts +5 -2
- package/dist/server/app-server-action-execution.js +10 -7
- package/dist/server/app-ssr-entry.d.ts +8 -0
- package/dist/server/app-ssr-entry.js +98 -50
- package/dist/server/app-ssr-error-meta.d.ts +2 -1
- package/dist/server/app-ssr-search-params-gate.d.ts +2 -1
- package/dist/server/app-ssr-stream.d.ts +22 -10
- package/dist/server/app-ssr-stream.js +300 -68
- package/dist/server/app-static-generation.d.ts +2 -1
- package/dist/server/app-streamed-client-references.d.ts +39 -0
- package/dist/server/app-streamed-client-references.js +156 -0
- package/dist/server/app-visited-response-cache.d.ts +38 -2
- package/dist/server/app-visited-response-cache.js +46 -5
- package/dist/server/app-worker-stages.d.ts +27 -4
- package/dist/server/app-worker-stages.js +45 -6
- package/dist/server/artifact-compatibility.d.ts +2 -2
- package/dist/server/artifact-compatibility.js +1 -10
- package/dist/server/bfcache-identity.d.ts +2 -1
- package/dist/server/cache-headers.d.ts +2 -1
- package/dist/server/cache-proof.d.ts +1 -115
- package/dist/server/cache-proof.js +1 -544
- package/dist/server/cacheability-request.d.ts +2 -1
- package/dist/server/cacheability-request.js +13 -8
- package/dist/server/config-headers.d.ts +2 -1
- package/dist/server/csp.d.ts +2 -1
- package/dist/server/default-global-not-found-module.d.ts +2 -1
- package/dist/server/default-http-access-fallback-modules.d.ts +33 -0
- package/dist/server/default-http-access-fallback-modules.js +31 -0
- package/dist/server/defer-until-stream-consumed.d.ts +34 -0
- package/dist/server/defer-until-stream-consumed.js +154 -21
- package/dist/server/dev-lockfile.d.ts +32 -2
- package/dist/server/dev-lockfile.js +46 -2
- package/dist/server/dev-module-runner.d.ts +2 -1
- package/dist/server/dev-server.js +14 -6
- package/dist/server/fetch-handler.js +1 -2
- package/dist/server/file-based-metadata.d.ts +2 -1
- package/dist/server/framework-tracer.d.ts +2 -1
- package/dist/server/headers.d.ts +6 -3
- package/dist/server/headers.js +9 -5
- package/dist/server/html.d.ts +1 -0
- package/dist/server/html.js +19 -1
- package/dist/server/http-conditional.d.ts +2 -1
- package/dist/server/http-error-responses.d.ts +2 -1
- package/dist/server/implicit-tags.d.ts +2 -1
- package/dist/server/isr-cache.d.ts +8 -2
- package/dist/server/isr-cache.js +26 -1
- package/dist/server/metadata-route-build-data.d.ts +2 -1
- package/dist/server/metadata-route-build-data.js +1 -1
- package/dist/server/metadata-route-response.d.ts +2 -1
- package/dist/server/metadata-route-response.js +32 -15
- package/dist/server/metadata-routes.d.ts +2 -1
- package/dist/server/middleware-runtime.d.ts +2 -1
- package/dist/server/multi-stage.d.ts +52 -11
- package/dist/server/multi-stage.js +13 -1
- package/dist/server/navigation-planner.js +1 -1
- package/dist/server/navigation-trace.d.ts +2 -1
- package/dist/server/next-error-digest.d.ts +2 -1
- package/dist/server/nitro-public-files-plugin.d.ts +2 -1
- package/dist/server/nitro-public-files.d.ts +2 -1
- package/dist/server/opentelemetry-api.d.ts +2 -1
- package/dist/server/operation-token.d.ts +2 -1
- package/dist/server/pages-api-route.d.ts +2 -1
- package/dist/server/pages-api-route.js +28 -19
- package/dist/server/pages-asset-tags.d.ts +2 -1
- package/dist/server/pages-body-parser-config.d.ts +2 -1
- package/dist/server/pages-client-assets.d.ts +4 -0
- package/dist/server/pages-data-route.d.ts +2 -1
- package/dist/server/pages-document-asset-props.d.ts +2 -1
- package/dist/server/pages-document-initial-props.d.ts +2 -1
- package/dist/server/pages-execution-tracing.d.ts +2 -1
- package/dist/server/pages-execution-tracing.js +1 -1
- package/dist/server/pages-get-initial-props.d.ts +2 -1
- package/dist/server/pages-media-type.d.ts +21 -1
- package/dist/server/pages-media-type.js +69 -5
- package/dist/server/pages-node-compat.js +52 -27
- package/dist/server/pages-page-data.d.ts +7 -1
- package/dist/server/pages-page-data.js +35 -12
- package/dist/server/pages-page-handler.d.ts +3 -2
- package/dist/server/pages-page-handler.js +27 -27
- package/dist/server/pages-page-method.d.ts +2 -1
- package/dist/server/pages-page-response.d.ts +2 -1
- package/dist/server/pages-preview.d.ts +2 -1
- package/dist/server/pages-readiness.d.ts +2 -1
- package/dist/server/pages-request-pipeline.d.ts +10 -1
- package/dist/server/pages-request-pipeline.js +6 -7
- package/dist/server/pages-request-stage-entry.d.ts +2 -1
- package/dist/server/pages-request-stage-entry.js +14 -12
- package/dist/server/pages-response-stage-entry.d.ts +2 -1
- package/dist/server/pages-response-stage-entry.js +9 -3
- package/dist/server/pages-route-data-kind.d.ts +2 -1
- package/dist/server/prerender-cache-life-header.d.ts +2 -1
- package/dist/server/prerender-route-params.d.ts +2 -1
- package/dist/server/prod-server.js +14 -4
- package/dist/server/request-log.d.ts +2 -1
- package/dist/server/request-pipeline.d.ts +6 -0
- package/dist/server/request-pipeline.js +21 -1
- package/dist/server/request-tracing.d.ts +2 -1
- package/dist/server/request-tracing.js +1 -1
- package/dist/server/response-start-tracing.js +7 -29
- package/dist/server/rsc-render-stream.d.ts +4 -0
- package/dist/server/rsc-render-stream.js +25 -0
- package/dist/server/seed-cache.d.ts +2 -1
- package/dist/server/seed-cache.js +1 -1
- package/dist/server/shared-cache-identity.d.ts +23 -0
- package/dist/server/shared-cache-identity.js +36 -0
- package/dist/server/static-file-cache.d.ts +2 -1
- package/dist/server/static-file-cache.js +1 -0
- package/dist/server/worker-revalidation-context.d.ts +2 -1
- package/dist/server/worker-stages.d.ts +18 -4
- package/dist/server/worker-stages.js +23 -4
- package/dist/shims/app.d.ts +2 -1
- package/dist/shims/cache-callable-runtime.d.ts +2 -1
- package/dist/shims/cache-handler.d.ts +8 -3
- package/dist/shims/cache-handler.js +31 -11
- package/dist/shims/cache-request-state.d.ts +17 -20
- package/dist/shims/cache-request-state.js +16 -21
- package/dist/shims/cache-runtime.js +27 -11
- package/dist/shims/cache.d.ts +8 -7
- package/dist/shims/cache.js +17 -19
- package/dist/shims/cacheability-classification.d.ts +2 -0
- package/dist/shims/caught-not-found-boundaries.d.ts +15 -0
- package/dist/shims/caught-not-found-boundaries.js +48 -0
- package/dist/shims/cdn-cache.d.ts +22 -5
- package/dist/shims/cdn-purge-routes.d.ts +2 -1
- package/dist/shims/client-locale.js +2 -1
- package/dist/shims/client-page-root.d.ts +2 -1
- package/dist/shims/client-page-root.js +2 -2
- package/dist/shims/config.d.ts +2 -1
- package/dist/shims/default-forbidden.d.ts +4 -0
- package/dist/shims/default-forbidden.js +18 -0
- package/dist/shims/default-not-found.d.ts +0 -5
- package/dist/shims/default-not-found.js +5 -41
- package/dist/shims/default-unauthorized.d.ts +4 -0
- package/dist/shims/default-unauthorized.js +18 -0
- package/dist/shims/dynamic.js +9 -6
- package/dist/shims/error-boundary.d.ts +39 -3
- package/dist/shims/error-boundary.js +33 -18
- package/dist/shims/fetch-cache-state.d.ts +5 -1
- package/dist/shims/fetch-cache-state.js +1 -3
- package/dist/shims/fetch-cache.d.ts +2 -1
- package/dist/shims/fetch-cache.js +34 -24
- package/dist/shims/font-google.js +1 -2
- package/dist/shims/font-utils.d.ts +3 -2
- package/dist/shims/font-utils.js +5 -3
- package/dist/shims/form.js +3 -3
- package/dist/shims/headers.d.ts +8 -23
- package/dist/shims/headers.js +17 -67
- package/dist/shims/http-access-error-fallback.d.ts +7 -0
- package/dist/shims/http-access-error-fallback.js +47 -0
- package/dist/shims/image.d.ts +1 -22
- package/dist/shims/internal/app-prefetch-fetch-queue.d.ts +22 -2
- package/dist/shims/internal/app-prefetch-fetch-queue.js +71 -18
- package/dist/shims/internal/app-route-prefetch-policy.d.ts +14 -3
- package/dist/shims/internal/app-route-prefetch-policy.js +29 -4
- package/dist/shims/internal/cache-context-accessor.d.ts +2 -1
- package/dist/shims/internal/client-reference-loader.d.ts +7 -0
- package/dist/shims/internal/client-reference-loader.js +91 -0
- package/dist/shims/internal/cookie-serialize.d.ts +2 -1
- package/dist/shims/internal/cookies.js +1 -2
- package/dist/shims/internal/headers-state.d.ts +2 -0
- package/dist/shims/internal/headers-state.js +6 -1
- package/dist/shims/internal/hybrid-client-route-owner-direct.d.ts +2 -1
- package/dist/shims/internal/interpolate-as.d.ts +2 -1
- package/dist/shims/internal/navigation-untracked.js +1 -1
- package/dist/shims/internal/pages-data-target.d.ts +2 -1
- package/dist/shims/internal/pages-data-url.d.ts +2 -1
- package/dist/shims/internal/thenable-well-known-properties.d.ts +2 -1
- package/dist/shims/link.js +197 -52
- package/dist/shims/metadata.d.ts +52 -29
- package/dist/shims/metadata.js +142 -42
- package/dist/shims/navigation-errors.d.ts +2 -1
- package/dist/shims/navigation-server.js +1 -1
- package/dist/shims/navigation.d.ts +95 -8
- package/dist/shims/navigation.js +255 -47
- package/dist/shims/navigation.react-server.js +2 -2
- package/dist/shims/pages-router-runtime.d.ts +2 -1
- package/dist/shims/ppr-fallback-shell.d.ts +2 -1
- package/dist/shims/request-state-types.d.ts +2 -2
- package/dist/shims/router.js +14 -3
- package/dist/shims/slot.d.ts +12 -0
- package/dist/shims/slot.js +37 -9
- package/dist/shims/unified-request-context.d.ts +1 -1
- package/dist/shims/unified-request-context.js +5 -6
- package/dist/typegen.d.ts +2 -1
- package/dist/utils/cache-control-metadata.d.ts +5 -0
- package/dist/utils/cache-control-metadata.js +9 -1
- package/dist/utils/client-build-manifest.d.ts +4 -1
- package/dist/utils/client-build-manifest.js +9 -2
- package/dist/utils/client-entry-manifest.d.ts +13 -0
- package/dist/utils/client-entry-manifest.js +20 -1
- package/dist/utils/client-reference-chunks.d.ts +45 -0
- package/dist/utils/client-reference-chunks.js +30 -0
- package/dist/utils/client-runtime-metadata.d.ts +9 -1
- package/dist/utils/client-runtime-metadata.js +40 -9
- package/dist/utils/compare.d.ts +9 -0
- package/dist/utils/compare.js +15 -1
- package/dist/utils/lazy-chunks.d.ts +14 -0
- package/dist/utils/lazy-chunks.js +27 -1
- package/dist/utils/middleware-request-headers.d.ts +2 -1
- package/dist/utils/project.d.ts +4 -3
- package/dist/utils/project.js +12 -17
- package/dist/utils/query.d.ts +2 -1
- package/dist/utils/regex.d.ts +5 -0
- package/dist/utils/regex.js +11 -1
- package/dist/utils/text-stream.d.ts +10 -5
- package/dist/utils/text-stream.js +6 -6
- package/dist/utils/vite-cli-invocation.d.ts +2 -1
- package/package.json +6 -5
- package/dist/build/layout-classification-types.d.ts +0 -60
- package/dist/build/layout-classification-types.js +0 -1
- package/dist/build/layout-classification.d.ts +0 -61
- package/dist/build/layout-classification.js +0 -98
- package/dist/build/route-classification-injector.d.ts +0 -32
- package/dist/build/route-classification-injector.js +0 -59
- package/dist/build/route-classification-manifest.d.ts +0 -53
- package/dist/build/route-classification-manifest.js +0 -143
- package/dist/deps/.pnpm/image-size@2.0.2/deps/image-size/dist/index.js +0 -808
- package/dist/server/app-browser-client-reuse-manifest.d.ts +0 -10
- package/dist/server/app-browser-client-reuse-manifest.js +0 -101
- package/dist/server/app-layout-param-observation.d.ts +0 -41
- package/dist/server/app-layout-param-observation.js +0 -168
- package/dist/server/client-reuse-manifest.d.ts +0 -102
- package/dist/server/client-reuse-manifest.js +0 -209
- package/dist/server/default-not-found-module.d.ts +0 -19
- package/dist/server/default-not-found-module.js +0 -18
- package/dist/server/rsc-stream-hints.d.ts +0 -21
- package/dist/server/rsc-stream-hints.js +0 -227
- package/dist/server/skip-cache-proof.d.ts +0 -60
- package/dist/server/skip-cache-proof.js +0 -168
- package/dist/server/static-layout-client-reuse-proof.d.ts +0 -13
- package/dist/server/static-layout-client-reuse-proof.js +0 -33
- package/dist/utils/sorted-array.d.ts +0 -7
- package/dist/utils/sorted-array.js +0 -20
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";
|
|
@@ -59,14 +60,12 @@ import { generateSsrEntry } from "./entries/app-ssr-entry.js";
|
|
|
59
60
|
import { VINEXT_CACHE_CONFIG_PLUGIN_PROPERTY, VIRTUAL_CACHE_ADAPTERS, VIRTUAL_CDN_CACHE_ADAPTER, generateCacheAdaptersModule, generateCdnCacheAdapterModule } from "./cache/cache-adapters-virtual.js";
|
|
60
61
|
import { VIRTUAL_IMAGE_ADAPTERS, generateImageAdaptersModule } from "./image/image-adapters-virtual.js";
|
|
61
62
|
import { generateBrowserEntry, generateBrowserRouteManifestModule, toHashedRouteHandlerRoutes, toLinkPrefetchRoutes } from "./entries/app-browser-entry.js";
|
|
62
|
-
import { collectRouteClassificationManifest } from "./build/route-classification-manifest.js";
|
|
63
|
-
import { planRouteClassificationInjection } from "./build/route-classification-injector.js";
|
|
64
63
|
import { createRscScanGlobImportsPlugin, isRscScanGlobImportsAffected } from "./plugins/rsc-scan-glob-imports.js";
|
|
65
64
|
import { loadOrGenerateServerActionsEncryptionKey } from "./build/server-actions-encryption-key.js";
|
|
66
65
|
import { findOpenTelemetryPackages, mergeServerExternalPackages } from "./config/server-external-packages.js";
|
|
67
66
|
import { precompressAssets } from "./build/precompress.js";
|
|
68
67
|
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";
|
|
68
|
+
import { VINEXT_CLIENT_ENTRY_MANIFEST, VINEXT_CLIENT_REFERENCE_SOURCES } from "./utils/client-entry-manifest.js";
|
|
70
69
|
import { PAGES_CLIENT_ASSETS_MODULE, buildPagesClientAssetsModule, collectClientBuildFiles, writePagesClientAssetsModuleIfMissing } from "./build/pages-client-assets-module.js";
|
|
71
70
|
import { createPreviewBuildCredentials, getPreviewBuildCredentials } from "./build/preview-credentials.js";
|
|
72
71
|
import { VINEXT_BUILD_LIFECYCLE_CONFIG, createBuildLifecyclePlugins } from "./build/lifecycle.js";
|
|
@@ -85,6 +84,7 @@ import { VIRTUAL_MODULE_ID_RE } from "./utils/virtual-module.js";
|
|
|
85
84
|
import { assertNoPublicDirAssetConflict, assertNoPublicNextRequestConflict } from "./build/public-dir-conflict.js";
|
|
86
85
|
import { renderVinextBuiltUrl } from "./utils/built-asset-url.js";
|
|
87
86
|
import { asyncHooksStubPlugin } from "./plugins/async-hooks-stub.js";
|
|
87
|
+
import { createClientCompileHintsPlugin } from "./plugins/client-compile-hints.js";
|
|
88
88
|
import { clientReferenceDedupPlugin } from "./plugins/client-reference-dedup.js";
|
|
89
89
|
import { dataUrlCssPlugin } from "./plugins/css-data-url.js";
|
|
90
90
|
import { createCssModuleImportCompatibilityPlugin } from "./plugins/css-module-imports.js";
|
|
@@ -94,6 +94,7 @@ import { createRouteClientReferencesFallbackPlugin, createRscClientReferenceLoad
|
|
|
94
94
|
import { createRscReferenceValidationNormalizerPlugin } from "./plugins/rsc-reference-validation-normalizer.js";
|
|
95
95
|
import { createScanBuildCssPlugin } from "./plugins/scan-build-css.js";
|
|
96
96
|
import { createInstrumentationClientTransformPlugin, createInstrumentationServerTransformPlugin } from "./plugins/instrumentation-client.js";
|
|
97
|
+
import { createNextIntlCatalogPlugin } from "./plugins/next-intl-catalog.js";
|
|
97
98
|
import { createStyledJsxPlugin } from "./plugins/styled-jsx.js";
|
|
98
99
|
import { INSTRUMENTATION_CLIENT_EMPTY_MODULE, generateInstrumentationClientInjectModule } from "./client/instrumentation-client-inject.js";
|
|
99
100
|
import { isServerEnvironment } from "./plugins/environment.js";
|
|
@@ -117,6 +118,7 @@ import { readPrerenderSecret, readServerRuntimeOutputDirs } from "./build/server
|
|
|
117
118
|
import { ModuleDependencyStore, createModuleDependencyCache } from "./build/module-dependency-cache.js";
|
|
118
119
|
import { markCssUrlAssetReferences, restoreDedupedCssAssetReferences } from "./build/css-url-assets.js";
|
|
119
120
|
import { buildSassPreprocessorOptions, createSassAwareFileSystemLoader, createSassCssUrlAssetImporter, createSassTildeImporter, createSassTsconfigPathImporters } from "./plugins/sass.js";
|
|
121
|
+
import { collectClientReferenceChunks, collectClientReferenceSources } from "./build/client-reference-chunks.js";
|
|
120
122
|
import { EXPORT_ALL_CANDIDATE_FILTER, hasExportAllCandidate, stripServerExports, validatePageExports } from "./plugins/strip-server-exports.js";
|
|
121
123
|
import { removeConsoleCalls } from "./plugins/remove-console.js";
|
|
122
124
|
import { createImportMetaUrlPlugin } from "./plugins/import-meta-url.js";
|
|
@@ -139,7 +141,7 @@ import { staticExportApp, staticExportPages } from "./build/static-export.js";
|
|
|
139
141
|
import { createRequire } from "node:module";
|
|
140
142
|
import fs from "node:fs";
|
|
141
143
|
import { pathToFileURL } from "node:url";
|
|
142
|
-
import { createIdResolver, createLogger, isRunnableDevEnvironment, transformWithOxc } from "vite";
|
|
144
|
+
import { createIdResolver, createLogger, esmExternalRequirePlugin, isRunnableDevEnvironment, transformWithOxc } from "vite";
|
|
143
145
|
import { createHash, randomBytes } from "node:crypto";
|
|
144
146
|
import MagicString from "magic-string";
|
|
145
147
|
import commonjs from "vite-plugin-commonjs";
|
|
@@ -152,7 +154,12 @@ const PAGES_CLOUDFLARE_WORKER_OPTIMIZE_DEPS_INCLUDE = Object.freeze([
|
|
|
152
154
|
"react/jsx-runtime",
|
|
153
155
|
"react/jsx-dev-runtime"
|
|
154
156
|
]);
|
|
155
|
-
const PAGES_CLOUDFLARE_WORKER_OPTIONAL_OPTIMIZE_DEPS_INCLUDE = Object.freeze([
|
|
157
|
+
const PAGES_CLOUDFLARE_WORKER_OPTIONAL_OPTIMIZE_DEPS_INCLUDE = Object.freeze([
|
|
158
|
+
"use-sync-external-store/with-selector",
|
|
159
|
+
"vinext > @vitejs/plugin-rsc/react/rsc",
|
|
160
|
+
"vinext > @unpic/react",
|
|
161
|
+
"vinext > ipaddr.js"
|
|
162
|
+
]);
|
|
156
163
|
const APP_CLIENT_OPTIONAL_OPTIMIZE_DEPS_INCLUDE = Object.freeze([
|
|
157
164
|
"use-sync-external-store/shim",
|
|
158
165
|
"use-sync-external-store/shim/index.js",
|
|
@@ -161,6 +168,11 @@ const APP_CLIENT_OPTIONAL_OPTIMIZE_DEPS_INCLUDE = Object.freeze([
|
|
|
161
168
|
"use-sync-external-store/with-selector",
|
|
162
169
|
"use-sync-external-store/with-selector.js"
|
|
163
170
|
]);
|
|
171
|
+
const CLIENT_OPTIONAL_OPTIMIZE_DEPS_INCLUDE = Object.freeze([
|
|
172
|
+
"vinext > @unpic/react",
|
|
173
|
+
"vinext > ipaddr.js",
|
|
174
|
+
"vinext > web-vitals"
|
|
175
|
+
]);
|
|
164
176
|
const ANSI_ESCAPE_RE = new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*m`, "g");
|
|
165
177
|
const RSC_ENVIRONMENTS = /* @__PURE__ */ new Set([
|
|
166
178
|
"rsc",
|
|
@@ -491,6 +503,7 @@ function hasZeroOrOneAsterisk(value) {
|
|
|
491
503
|
}
|
|
492
504
|
function materializeTsconfigPathAliases(pathsConfig, baseUrl, projectRoot) {
|
|
493
505
|
const vite = {};
|
|
506
|
+
const viteExact = {};
|
|
494
507
|
const sass = [];
|
|
495
508
|
for (const [find, rawTargets] of Object.entries(pathsConfig)) {
|
|
496
509
|
const targets = Array.isArray(rawTargets) ? rawTargets.filter((value) => typeof value === "string") : typeof rawTargets === "string" ? [rawTargets] : [];
|
|
@@ -513,10 +526,11 @@ function materializeTsconfigPathAliases(pathsConfig, baseUrl, projectRoot) {
|
|
|
513
526
|
vite[aliasKey] = toViteAliasReplacement(path.resolve(baseUrl, targetDir), projectRoot);
|
|
514
527
|
continue;
|
|
515
528
|
}
|
|
516
|
-
|
|
529
|
+
viteExact[find] = toViteAliasReplacement(path.resolve(baseUrl, target), projectRoot);
|
|
517
530
|
}
|
|
518
531
|
return {
|
|
519
532
|
vite,
|
|
533
|
+
viteExact,
|
|
520
534
|
sass
|
|
521
535
|
};
|
|
522
536
|
}
|
|
@@ -553,6 +567,7 @@ function loadTsconfigPathAliases(configPath, projectRoot, seen = /* @__PURE__ */
|
|
|
553
567
|
const normalizedPath = tryRealpathSync(configPath) ?? configPath;
|
|
554
568
|
if (seen.has(normalizedPath)) return {
|
|
555
569
|
vite: {},
|
|
570
|
+
viteExact: {},
|
|
556
571
|
sass: []
|
|
557
572
|
};
|
|
558
573
|
seen.add(normalizedPath);
|
|
@@ -562,15 +577,18 @@ function loadTsconfigPathAliases(configPath, projectRoot, seen = /* @__PURE__ */
|
|
|
562
577
|
} catch {
|
|
563
578
|
return {
|
|
564
579
|
vite: {},
|
|
580
|
+
viteExact: {},
|
|
565
581
|
sass: []
|
|
566
582
|
};
|
|
567
583
|
}
|
|
568
584
|
if (!parsed) return {
|
|
569
585
|
vite: {},
|
|
586
|
+
viteExact: {},
|
|
570
587
|
sass: []
|
|
571
588
|
};
|
|
572
589
|
let aliases = {
|
|
573
590
|
vite: {},
|
|
591
|
+
viteExact: {},
|
|
574
592
|
sass: []
|
|
575
593
|
};
|
|
576
594
|
for (const extendsSpecifier of normalizeTsconfigExtends(parsed.extends)) {
|
|
@@ -582,6 +600,10 @@ function loadTsconfigPathAliases(configPath, projectRoot, seen = /* @__PURE__ */
|
|
|
582
600
|
...aliases.vite,
|
|
583
601
|
...parent.vite
|
|
584
602
|
},
|
|
603
|
+
viteExact: {
|
|
604
|
+
...aliases.viteExact,
|
|
605
|
+
...parent.viteExact
|
|
606
|
+
},
|
|
585
607
|
sass: mergeSassTsconfigPathAliases(aliases.sass, parent.sass)
|
|
586
608
|
};
|
|
587
609
|
}
|
|
@@ -596,6 +618,10 @@ function loadTsconfigPathAliases(configPath, projectRoot, seen = /* @__PURE__ */
|
|
|
596
618
|
...aliases.vite,
|
|
597
619
|
...own.vite
|
|
598
620
|
},
|
|
621
|
+
viteExact: {
|
|
622
|
+
...aliases.viteExact,
|
|
623
|
+
...own.viteExact
|
|
624
|
+
},
|
|
599
625
|
sass: mergeSassTsconfigPathAliases(aliases.sass, own.sass)
|
|
600
626
|
};
|
|
601
627
|
}
|
|
@@ -664,17 +690,20 @@ function resolveTsconfigAliases(projectRoot, configuredPath) {
|
|
|
664
690
|
if (_tsconfigAliasCache.has(cacheKey)) return _tsconfigAliasCache.get(cacheKey);
|
|
665
691
|
let aliases = {
|
|
666
692
|
vite: {},
|
|
693
|
+
viteExact: {},
|
|
667
694
|
sass: []
|
|
668
695
|
};
|
|
669
696
|
for (const candidate of configPath ? [configPath] : TSCONFIG_FILES.map((name) => path.join(projectRoot, name))) {
|
|
670
697
|
if (!fs.existsSync(candidate)) continue;
|
|
671
698
|
const materialized = loadTsconfigPathAliases(candidate, projectRoot);
|
|
672
699
|
aliases = {
|
|
673
|
-
|
|
674
|
-
|
|
700
|
+
...materialized,
|
|
701
|
+
vite: sortTsconfigAliasesBySpecificity(materialized.vite)
|
|
675
702
|
};
|
|
676
703
|
break;
|
|
677
704
|
}
|
|
705
|
+
aliases.vite = Object.fromEntries(Object.entries(aliases.vite).filter(([find]) => !_reactServerShims.has(find)));
|
|
706
|
+
aliases.viteExact = Object.fromEntries(Object.entries(aliases.viteExact).filter(([find]) => !_reactServerShims.has(find)));
|
|
678
707
|
_tsconfigAliasCache.set(cacheKey, aliases);
|
|
679
708
|
return aliases;
|
|
680
709
|
}
|
|
@@ -718,20 +747,38 @@ const tsconfigAliasCustomResolver = async function(updatedId, importer, options)
|
|
|
718
747
|
skipSelf: true
|
|
719
748
|
}) ?? { id: updatedId };
|
|
720
749
|
};
|
|
750
|
+
function aliasFindMatches(find, id) {
|
|
751
|
+
if (typeof find === "string") return id === find || id.startsWith(`${find}/`);
|
|
752
|
+
const { lastIndex } = find;
|
|
753
|
+
find.lastIndex = 0;
|
|
754
|
+
const matches = find.test(id);
|
|
755
|
+
find.lastIndex = lastIndex;
|
|
756
|
+
return matches;
|
|
757
|
+
}
|
|
721
758
|
/**
|
|
722
759
|
* Convert the merged alias map into Vite alias entries, attaching the
|
|
723
760
|
* stylesheet-scoping resolver to entries that came from tsconfig `paths`.
|
|
724
761
|
* Array order preserves the map's first-match ordering.
|
|
762
|
+
*
|
|
763
|
+
* Exact tsconfig keys come first as anchored RegExps: a string `find` would
|
|
764
|
+
* also match paths below the key, so `"@acme/pkg": ["./src/index.ts"]` would
|
|
765
|
+
* rewrite `@acme/pkg/runtime` to `./src/index.ts/runtime`. TypeScript and
|
|
766
|
+
* Next.js match such keys only against the exact specifier and prefer them over
|
|
767
|
+
* `*` patterns.
|
|
725
768
|
*/
|
|
726
|
-
function buildResolveAliasEntries(aliasMap, tsconfigPathAliases, explicitAliases) {
|
|
727
|
-
return Object.entries(
|
|
769
|
+
function buildResolveAliasEntries(aliasMap, tsconfigPathAliases, tsconfigExactPathAliases, explicitAliases) {
|
|
770
|
+
return [...Object.entries(tsconfigExactPathAliases).filter(([find]) => !Object.hasOwn(explicitAliases, find)).map(([find, replacement]) => ({
|
|
771
|
+
find: new RegExp(`^${escapeRegExp(find)}$`),
|
|
772
|
+
replacement,
|
|
773
|
+
customResolver: tsconfigAliasCustomResolver
|
|
774
|
+
})), ...Object.entries(aliasMap).map(([find, replacement]) => Object.hasOwn(tsconfigPathAliases, find) && !Object.hasOwn(explicitAliases, find) ? {
|
|
728
775
|
find,
|
|
729
776
|
replacement,
|
|
730
777
|
customResolver: tsconfigAliasCustomResolver
|
|
731
778
|
} : {
|
|
732
779
|
find,
|
|
733
780
|
replacement
|
|
734
|
-
});
|
|
781
|
+
})];
|
|
735
782
|
}
|
|
736
783
|
const ALIAS_CUSTOM_RESOLVER_DEPRECATION_RE = /`resolve\.alias` contains an alias with `customResolver` option/;
|
|
737
784
|
const VINEXT_FILTERED_ALIAS_DEPRECATION_WARN = Symbol.for("vinext.filteredAliasDeprecationWarn");
|
|
@@ -965,6 +1012,7 @@ function vinext(options = {}) {
|
|
|
965
1012
|
let resolvedServerExternalPackages = [];
|
|
966
1013
|
let registerNodeOpenTelemetryLoader = false;
|
|
967
1014
|
let pagesTsconfigAliases = {};
|
|
1015
|
+
let pagesTsconfigExactAliases = {};
|
|
968
1016
|
let pagesBundledPackages = /* @__PURE__ */ new Set();
|
|
969
1017
|
let isServeCommand = false;
|
|
970
1018
|
let buildEmptyOutDir;
|
|
@@ -998,10 +1046,10 @@ function vinext(options = {}) {
|
|
|
998
1046
|
const devForwardedMiddlewareContextKey = randomBytes(32).toString("hex");
|
|
999
1047
|
let previewBuildCredentials;
|
|
1000
1048
|
const sassComposesLoader = createSassAwareFileSystemLoader();
|
|
1001
|
-
const rscClassificationManifests = /* @__PURE__ */ new Map();
|
|
1002
1049
|
let rscActionOwnerRoutes = null;
|
|
1003
1050
|
let rscActionOwnerSharedRoots = [];
|
|
1004
1051
|
let clientReferenceRoutes = null;
|
|
1052
|
+
let clientReferenceModules = null;
|
|
1005
1053
|
let clientReferenceAlwaysRenderedFiles = [];
|
|
1006
1054
|
let clientReferenceRoutelessFiles = [];
|
|
1007
1055
|
const serverEntryKindsByEnvironment = /* @__PURE__ */ new Map();
|
|
@@ -1018,6 +1066,7 @@ function vinext(options = {}) {
|
|
|
1018
1066
|
const shimsDir = path.resolve(__dirname, "shims");
|
|
1019
1067
|
const nextImageAliasTarget = toSlash(path.join(shimsDir, "image"));
|
|
1020
1068
|
const nextImageAliasTargetRE = new RegExp(`^${nextImageAliasTarget.split("/").map(escapeRegExp).join("[\\\\/]")}$`);
|
|
1069
|
+
let nextImageAliasedByUser = false;
|
|
1021
1070
|
const canonicalize = (p) => toSlash(tryRealpathSync(p) ?? p);
|
|
1022
1071
|
const pageTransformCanonicalPaths = /* @__PURE__ */ new Map();
|
|
1023
1072
|
const canonicalizePageTransformPath = (modulePath) => {
|
|
@@ -1032,12 +1081,9 @@ function vinext(options = {}) {
|
|
|
1032
1081
|
const relativePath = fileMatcher.stripExtension(canonicalId.slice(canonicalPagesDir.length));
|
|
1033
1082
|
return relativePath === "/api" || relativePath.startsWith("/api/");
|
|
1034
1083
|
};
|
|
1035
|
-
const dynamicShimPaths = new Set([
|
|
1036
|
-
resolveShimModulePath(shimsDir, "headers"),
|
|
1037
|
-
resolveShimModulePath(shimsDir, "server"),
|
|
1038
|
-
resolveShimModulePath(shimsDir, "cache")
|
|
1039
|
-
].map(canonicalize));
|
|
1040
1084
|
let nextShimMap = {};
|
|
1085
|
+
let shimOptimizeDepsExclude = VINEXT_OPTIMIZE_DEPS_EXCLUDE;
|
|
1086
|
+
const createShimRequirePlugin = () => esmExternalRequirePlugin({ external: [...shimOptimizeDepsExclude] });
|
|
1041
1087
|
/**
|
|
1042
1088
|
* Generate the virtual SSR server entry module.
|
|
1043
1089
|
* This is the entry point for `vite build --ssr`.
|
|
@@ -1104,14 +1150,14 @@ function vinext(options = {}) {
|
|
|
1104
1150
|
rscPluginPromise = rscImport.then(async (mod) => {
|
|
1105
1151
|
const rsc = mod.default;
|
|
1106
1152
|
const plugins = rsc(rscPluginOptions);
|
|
1107
|
-
const
|
|
1153
|
+
const useCachePlugins = await createUseCacheCallablePlugin({
|
|
1108
1154
|
projectRoot: earlyBaseDir,
|
|
1109
1155
|
cacheRuntime: pathToFileURL(resolveShimModulePath(shimsDir, "cache-callable-runtime")).href,
|
|
1110
1156
|
getEncryptionKey: () => serverActionsEncryptionKey
|
|
1111
1157
|
});
|
|
1112
1158
|
const useServerIndex = plugins.findIndex((plugin) => plugin.name === "rsc:use-server");
|
|
1113
1159
|
if (useServerIndex === -1) throw new Error("vinext: Failed to locate @vitejs/plugin-rsc use-server plugin.");
|
|
1114
|
-
plugins.splice(useServerIndex, 0,
|
|
1160
|
+
plugins.splice(useServerIndex, 0, ...useCachePlugins);
|
|
1115
1161
|
return plugins.map(scopeRscPlugin);
|
|
1116
1162
|
}).catch((cause) => {
|
|
1117
1163
|
throw new Error("vinext: Failed to load @vitejs/plugin-rsc.", { cause });
|
|
@@ -1390,6 +1436,7 @@ function vinext(options = {}) {
|
|
|
1390
1436
|
getPagesDir: () => hasPagesDir ? pagesDir : null,
|
|
1391
1437
|
getAliases: () => nextConfig?.aliases ?? {},
|
|
1392
1438
|
getTsconfigAliases: () => pagesTsconfigAliases,
|
|
1439
|
+
getTsconfigExactAliases: () => pagesTsconfigExactAliases,
|
|
1393
1440
|
getBundledPackages: () => pagesBundledPackages,
|
|
1394
1441
|
isEnabled: () => !hasCloudflarePlugin && !hasNitroPlugin
|
|
1395
1442
|
}),
|
|
@@ -1422,6 +1469,7 @@ function vinext(options = {}) {
|
|
|
1422
1469
|
buildLifecycleEnabled = env.command === "build" && !internalOptions.__skipBuildLifecycle && (buildLifecycleInvocation !== void 0 || claimViteCliBuildInvocation());
|
|
1423
1470
|
const userResolve = config.resolve;
|
|
1424
1471
|
let tsconfigPathAliases = {};
|
|
1472
|
+
let tsconfigExactPathAliases = {};
|
|
1425
1473
|
let sassTsconfigPathAliases = [];
|
|
1426
1474
|
const swcHelpersAlias = resolveSwcHelpersAlias(root);
|
|
1427
1475
|
const mode = env?.mode ?? "development";
|
|
@@ -1493,10 +1541,12 @@ function vinext(options = {}) {
|
|
|
1493
1541
|
const configuredTsconfigPath = isUnknownRecord(nextConfig.typescript) ? typeof nextConfig.typescript.tsconfigPath === "string" ? nextConfig.typescript.tsconfigPath : void 0 : void 0;
|
|
1494
1542
|
const resolvedTsconfigAliases = resolveTsconfigAliases(root, configuredTsconfigPath);
|
|
1495
1543
|
tsconfigPathAliases = resolvedTsconfigAliases.vite;
|
|
1544
|
+
tsconfigExactPathAliases = resolvedTsconfigAliases.viteExact;
|
|
1496
1545
|
pagesTsconfigAliases = tsconfigPathAliases;
|
|
1546
|
+
pagesTsconfigExactAliases = tsconfigExactPathAliases;
|
|
1497
1547
|
sassTsconfigPathAliases = resolvedTsconfigAliases.sass;
|
|
1498
1548
|
const shouldAutoEnableNativeTsconfigPaths = userResolve?.tsconfigPaths === void 0 && configuredTsconfigPath === void 0;
|
|
1499
|
-
if (Object.keys(tsconfigPathAliases).length > 0) config.customLogger = suppressAliasCustomResolverDeprecationWarning(config.customLogger ?? createLogger(config.logLevel, { allowClearScreen: config.clearScreen }));
|
|
1549
|
+
if (Object.keys(tsconfigPathAliases).length > 0 || Object.keys(tsconfigExactPathAliases).length > 0) config.customLogger = suppressAliasCustomResolverDeprecationWarning(config.customLogger ?? createLogger(config.logLevel, { allowClearScreen: config.clearScreen }));
|
|
1500
1550
|
if (rscCompatibilityId === void 0) {
|
|
1501
1551
|
const sharedRscCompatibilityId = process.env.__VINEXT_SHARED_RSC_COMPATIBILITY_ID;
|
|
1502
1552
|
rscCompatibilityId = sharedRscCompatibilityId && sharedRscCompatibilityId.length > 0 ? sharedRscCompatibilityId : createRscCompatibilityId(nextConfig);
|
|
@@ -1575,6 +1625,7 @@ function vinext(options = {}) {
|
|
|
1575
1625
|
defines["process.env.__NEXT_VERSION"] = JSON.stringify(getVinextVersion());
|
|
1576
1626
|
defines["process.env.__NEXT_APP_SHELLS"] = JSON.stringify(nextConfig.appShells);
|
|
1577
1627
|
defines["process.env.__NEXT_CACHE_COMPONENTS"] = JSON.stringify(nextConfig.cacheComponents ?? false);
|
|
1628
|
+
defines["process.env.__NEXT_EXPERIMENTAL_CACHED_NAVIGATIONS"] = JSON.stringify(nextConfig.cachedNavigations);
|
|
1578
1629
|
for (const [key, value] of Object.entries(nextConfig.compilerDefine)) {
|
|
1579
1630
|
if (key in defines || key === "process.browser") throw new Error(`The \`compiler.define\` option is configured to replace the \`${key}\` variable. This variable is either part of a built-in or is already configured.`);
|
|
1580
1631
|
defines[key] = value;
|
|
@@ -1618,6 +1669,7 @@ function vinext(options = {}) {
|
|
|
1618
1669
|
"vinext/html": path.resolve(__dirname, "server", "html"),
|
|
1619
1670
|
...clientInjectModule === null ? { "private-next-instrumentation-client": instrumentationClientPath ?? INSTRUMENTATION_CLIENT_EMPTY_MODULE } : {}
|
|
1620
1671
|
}).flatMap(([k, v]) => k.startsWith("next/") ? [[k, v], [`${k}.js`, v]] : [[k, v]]));
|
|
1672
|
+
shimOptimizeDepsExclude = mergeOptimizeDepsExclude(VINEXT_OPTIMIZE_DEPS_EXCLUDE, Object.keys(nextShimMap), [..._reactServerShims.keys()]);
|
|
1621
1673
|
const pluginsFlat = [];
|
|
1622
1674
|
function flattenPlugins(arr) {
|
|
1623
1675
|
for (const p of arr) if (Array.isArray(p)) flattenPlugins(p);
|
|
@@ -1668,6 +1720,11 @@ function vinext(options = {}) {
|
|
|
1668
1720
|
find,
|
|
1669
1721
|
replacement
|
|
1670
1722
|
}));
|
|
1723
|
+
const tsconfigOverridingAliases = {
|
|
1724
|
+
...nextConfig.aliases,
|
|
1725
|
+
...nextShimMap,
|
|
1726
|
+
"vinext/server/pages-client-assets": _pagesClientAssetsPath
|
|
1727
|
+
};
|
|
1671
1728
|
if (config.resolve) {
|
|
1672
1729
|
config.resolve = { ...config.resolve };
|
|
1673
1730
|
delete config.resolve.alias;
|
|
@@ -1742,13 +1799,8 @@ function vinext(options = {}) {
|
|
|
1742
1799
|
alias: [...userAliasEntries, ...buildResolveAliasEntries({
|
|
1743
1800
|
...swcHelpersAlias ? { "@swc/helpers/_": swcHelpersAlias } : {},
|
|
1744
1801
|
...tsconfigPathAliases,
|
|
1745
|
-
...
|
|
1746
|
-
|
|
1747
|
-
"vinext/server/pages-client-assets": _pagesClientAssetsPath
|
|
1748
|
-
}, tsconfigPathAliases, {
|
|
1749
|
-
...nextConfig.aliases,
|
|
1750
|
-
...nextShimMap
|
|
1751
|
-
})],
|
|
1802
|
+
...tsconfigOverridingAliases
|
|
1803
|
+
}, tsconfigPathAliases, tsconfigExactPathAliases, tsconfigOverridingAliases)],
|
|
1752
1804
|
dedupe: [
|
|
1753
1805
|
"react",
|
|
1754
1806
|
"react-dom",
|
|
@@ -1815,12 +1867,12 @@ function vinext(options = {}) {
|
|
|
1815
1867
|
};
|
|
1816
1868
|
const depOptimizeNodeEnvOptions = getDepOptimizeNodeEnvOptions(nodeEnvDefine);
|
|
1817
1869
|
viteConfig.optimizeDeps = {
|
|
1818
|
-
exclude: mergeOptimizeDepsExclude(incomingExclude, VINEXT_OPTIMIZE_DEPS_EXCLUDE, ["@tailwindcss/oxide"]),
|
|
1870
|
+
exclude: mergeOptimizeDepsExclude(incomingExclude, hasAppDir ? shimOptimizeDepsExclude : VINEXT_OPTIMIZE_DEPS_EXCLUDE, ["@tailwindcss/oxide"]),
|
|
1819
1871
|
...incomingInclude.length > 0 ? { include: incomingInclude } : {},
|
|
1820
1872
|
...depOptimizeNodeEnvOptions,
|
|
1821
1873
|
rolldownOptions: {
|
|
1822
1874
|
...depOptimizeNodeEnvOptions.rolldownOptions,
|
|
1823
|
-
plugins: [depOptimizeAliasPlugin, commonJsEsmFacadeOptimizeDepsPlugin]
|
|
1875
|
+
plugins: hasAppDir ? [commonJsEsmFacadeOptimizeDepsPlugin] : [depOptimizeAliasPlugin, commonJsEsmFacadeOptimizeDepsPlugin]
|
|
1824
1876
|
}
|
|
1825
1877
|
};
|
|
1826
1878
|
pagesOptimizeEntries = !hasAppDir ? [...hasPagesDir ? [toRelativeFileEntry(root, pagesDir) + "/**/*.{tsx,ts,jsx,js}"] : [], ...[instrumentationPath, instrumentationClientPath].flatMap((entry) => entry ? [toRelativeFileEntry(root, entry)] : [])] : [];
|
|
@@ -1875,7 +1927,6 @@ function vinext(options = {}) {
|
|
|
1875
1927
|
additionalClientOptimizeIncludes.push(include);
|
|
1876
1928
|
} catch {}
|
|
1877
1929
|
}
|
|
1878
|
-
if (!excluded.includes("next") && !excluded.includes("next/link")) additionalClientOptimizeIncludes.push("next/link");
|
|
1879
1930
|
} catch {}
|
|
1880
1931
|
}
|
|
1881
1932
|
const appClientInput = { index: VIRTUAL_APP_BROWSER_ENTRY };
|
|
@@ -1895,13 +1946,9 @@ function vinext(options = {}) {
|
|
|
1895
1946
|
noExternal: userSsrExternal === true ? [...PATCHED_SERVER_PACKAGES] : true
|
|
1896
1947
|
} },
|
|
1897
1948
|
optimizeDeps: {
|
|
1898
|
-
exclude: mergeOptimizeDepsExclude(incomingExclude,
|
|
1949
|
+
exclude: mergeOptimizeDepsExclude(incomingExclude, shimOptimizeDepsExclude),
|
|
1899
1950
|
entries: optimizeEntries,
|
|
1900
|
-
include: [.../* @__PURE__ */ new Set([
|
|
1901
|
-
...incomingInclude,
|
|
1902
|
-
...additionalRscOptimizeIncludes,
|
|
1903
|
-
"react-server-dom-webpack/static.edge"
|
|
1904
|
-
])],
|
|
1951
|
+
include: [.../* @__PURE__ */ new Set([...incomingInclude, ...additionalRscOptimizeIncludes])],
|
|
1905
1952
|
...depOptimizeNodeEnvOptions
|
|
1906
1953
|
},
|
|
1907
1954
|
build: {
|
|
@@ -1923,7 +1970,8 @@ function vinext(options = {}) {
|
|
|
1923
1970
|
noExternal: userSsrExternal === true ? [...PATCHED_SERVER_PACKAGES] : true
|
|
1924
1971
|
} },
|
|
1925
1972
|
optimizeDeps: {
|
|
1926
|
-
exclude: mergeOptimizeDepsExclude(incomingExclude,
|
|
1973
|
+
exclude: mergeOptimizeDepsExclude(incomingExclude, shimOptimizeDepsExclude, ["ipaddr.js"], userSsrExternal === true || externalizeSsrReactInDev ? SSR_EXTERNAL_REACT_ENTRIES : []),
|
|
1974
|
+
...userSsrExternal === true || externalizeSsrReactInDev || hasCloudflarePlugin ? {} : { include: ["react-dom/server", "react-dom/static"] },
|
|
1927
1975
|
entries: optimizeEntries,
|
|
1928
1976
|
...depOptimizeNodeEnvOptions
|
|
1929
1977
|
},
|
|
@@ -1935,7 +1983,7 @@ function vinext(options = {}) {
|
|
|
1935
1983
|
client: {
|
|
1936
1984
|
consumer: "client",
|
|
1937
1985
|
optimizeDeps: {
|
|
1938
|
-
exclude: mergeOptimizeDepsExclude(incomingExclude,
|
|
1986
|
+
exclude: mergeOptimizeDepsExclude(incomingExclude, shimOptimizeDepsExclude, nextServerExternal),
|
|
1939
1987
|
entries: optimizeEntries,
|
|
1940
1988
|
include: [.../* @__PURE__ */ new Set([
|
|
1941
1989
|
...incomingInclude,
|
|
@@ -2013,7 +2061,7 @@ function vinext(options = {}) {
|
|
|
2013
2061
|
noExternal: true
|
|
2014
2062
|
},
|
|
2015
2063
|
optimizeDeps: {
|
|
2016
|
-
exclude: mergeOptimizeDepsExclude(incomingExclude,
|
|
2064
|
+
exclude: mergeOptimizeDepsExclude(incomingExclude, shimOptimizeDepsExclude, ["ipaddr.js"]),
|
|
2017
2065
|
...depOptimizeNodeEnvOptions
|
|
2018
2066
|
},
|
|
2019
2067
|
build: {
|
|
@@ -2041,17 +2089,27 @@ function vinext(options = {}) {
|
|
|
2041
2089
|
copyPublicDirIntoStaticExportBasePath = config.build.copyPublicDir !== false;
|
|
2042
2090
|
config.build.copyPublicDir = false;
|
|
2043
2091
|
}
|
|
2044
|
-
|
|
2092
|
+
const isClientConsumer = name === "client" || config.consumer === "client";
|
|
2093
|
+
if (isClientConsumer && hasAppDir) {
|
|
2094
|
+
config.optimizeDeps ??= {};
|
|
2095
|
+
config.optimizeDeps.exclude = mergeOptimizeDepsExclude(config.optimizeDeps.exclude ?? [], shimOptimizeDepsExclude);
|
|
2096
|
+
}
|
|
2097
|
+
if (!isClientConsumer) {
|
|
2045
2098
|
config.optimizeDeps ??= {};
|
|
2046
2099
|
config.optimizeDeps.rolldownOptions ??= {};
|
|
2047
2100
|
const configuredPlugins = config.optimizeDeps.rolldownOptions.plugins;
|
|
2048
|
-
config.optimizeDeps.rolldownOptions.plugins = [
|
|
2101
|
+
config.optimizeDeps.rolldownOptions.plugins = [
|
|
2102
|
+
...Array.isArray(configuredPlugins) ? configuredPlugins : configuredPlugins ? [configuredPlugins] : [],
|
|
2103
|
+
importMetaUrlCapability.optimizeDepsPlugin,
|
|
2104
|
+
createShimRequirePlugin()
|
|
2105
|
+
];
|
|
2106
|
+
config.optimizeDeps.exclude = mergeOptimizeDepsExclude(config.optimizeDeps.exclude ?? [], shimOptimizeDepsExclude);
|
|
2049
2107
|
}
|
|
2050
2108
|
if (isServeCommand && hasCloudflarePlugin && hasPagesDir && !hasAppDir && name !== "client") {
|
|
2051
2109
|
config.optimizeDeps ??= {};
|
|
2052
2110
|
config.optimizeDeps.entries = mergeStringArrayValues(config.optimizeDeps.entries, pagesOptimizeEntries);
|
|
2053
2111
|
config.optimizeDeps.include = mergeStringArrayValues(config.optimizeDeps.include, PAGES_CLOUDFLARE_WORKER_OPTIMIZE_DEPS_INCLUDE);
|
|
2054
|
-
config.optimizeDeps.exclude = mergeOptimizeDepsExclude(config.optimizeDeps.exclude ?? [],
|
|
2112
|
+
config.optimizeDeps.exclude = mergeOptimizeDepsExclude(config.optimizeDeps.exclude ?? [], PAGES_CLOUDFLARE_WORKER_OPTIMIZE_DEPS_EXCLUDE);
|
|
2055
2113
|
}
|
|
2056
2114
|
const configuredExtensions = name === "client" ? nextConfig.resolveExtensions : nextConfig.serverResolveExtensions;
|
|
2057
2115
|
const extensions = configuredExtensions === null ? buildViteResolveExtensions(config.resolve?.extensions) : normalizeViteResolveExtensions(configuredExtensions);
|
|
@@ -2066,11 +2124,21 @@ function vinext(options = {}) {
|
|
|
2066
2124
|
if (!config.server.middlewareMode) applyDevServerDefaults(config.server, {});
|
|
2067
2125
|
}
|
|
2068
2126
|
}
|
|
2069
|
-
if (isServeCommand
|
|
2127
|
+
if (isServeCommand) {
|
|
2070
2128
|
const optionalWarnings = /* @__PURE__ */ new Set();
|
|
2129
|
+
const isExcludedShim = (depId) => shimOptimizeDepsExclude.some((excluded) => {
|
|
2130
|
+
if (depId === excluded || depId.startsWith(`${excluded}/`)) return true;
|
|
2131
|
+
if (!/[*?[\]{}()!]/.test(depId)) return false;
|
|
2132
|
+
const pkgName = depId.split("/").slice(0, depId.startsWith("@") ? 2 : 1).join("/");
|
|
2133
|
+
if (excluded !== pkgName && !excluded.startsWith(`${pkgName}/`)) return false;
|
|
2134
|
+
return typeof path.matchesGlob !== "function" || path.matchesGlob(excluded, depId);
|
|
2135
|
+
});
|
|
2071
2136
|
for (const [name, environment] of Object.entries(config.environments)) {
|
|
2072
2137
|
const optimizer = environment.optimizeDeps;
|
|
2073
|
-
const
|
|
2138
|
+
const isClient = (environment.consumer ?? name) === "client";
|
|
2139
|
+
const optimizerActive = !optimizer.noDiscovery || !!optimizer.include?.length;
|
|
2140
|
+
if (optimizer.include && (!isClient || hasAppDir)) optimizer.include = optimizer.include.filter((id) => !isExcludedShim(id.slice(id.lastIndexOf(">") + 1).trim()));
|
|
2141
|
+
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
2142
|
for (const id of optionalIncludes) {
|
|
2075
2143
|
const depId = id.slice(id.lastIndexOf(">") + 1).trim();
|
|
2076
2144
|
if (optimizer.include?.includes(id) || optimizer.include?.includes(depId) || optimizer.exclude?.some((excluded) => depId === excluded || depId.startsWith(`${excluded}/`))) continue;
|
|
@@ -2092,6 +2160,8 @@ function vinext(options = {}) {
|
|
|
2092
2160
|
};
|
|
2093
2161
|
}
|
|
2094
2162
|
sassComposesLoader.setResolvedConfig(config);
|
|
2163
|
+
const nextImageAlias = config.resolve?.alias?.find(({ find }) => aliasFindMatches(find, "next/image"));
|
|
2164
|
+
nextImageAliasedByUser = nextImageAlias !== void 0 && (nextImageAlias.customResolver !== void 0 || toSlash(nextImageAlias.replacement) !== nextImageAliasTarget);
|
|
2095
2165
|
if (config.command === "build" && hasAppDir && hasPagesDir) {
|
|
2096
2166
|
const [appRoutes, pageRoutes, apiRoutes] = await Promise.all([
|
|
2097
2167
|
appRouter(appDir, nextConfig?.pageExtensions, fileMatcher),
|
|
@@ -2163,7 +2233,7 @@ function vinext(options = {}) {
|
|
|
2163
2233
|
},
|
|
2164
2234
|
resolveId: {
|
|
2165
2235
|
filter: { id: new RegExp(`${/(?:next\/|vinext\/(?:shims\/|server\/(?:app-rsc-(?:combined-)?handler|app-router-entry|pages-router-entry))|virtual:vinext-|@vercel\/og(?:\.js)?$)/.source}|${nextImageAliasTargetRE.source}`) },
|
|
2166
|
-
handler(id, importer) {
|
|
2236
|
+
handler(id, importer, options) {
|
|
2167
2237
|
if (nextImageAliasTargetRE.test(id)) return this.environment?.name === "rsc" ? RESOLVED_NEXT_IMAGE_RSC : void 0;
|
|
2168
2238
|
const cleanId = toSlash(id.startsWith("\0") ? id.slice(1) : id);
|
|
2169
2239
|
if (cleanId === "vinext/server/app-rsc-combined-handler") {
|
|
@@ -2181,8 +2251,14 @@ function vinext(options = {}) {
|
|
|
2181
2251
|
return _appRscHandlerPath;
|
|
2182
2252
|
}
|
|
2183
2253
|
if (isVercelOgImport(cleanId) && !isVinextOgShimImporter(importer)) return resolveShimModulePath(_shimsDir, "og");
|
|
2184
|
-
if (cleanId === "vinext/shims/image" && this.environment?.name !== "rsc") return this.resolve("next/image", importer, { skipSelf: true });
|
|
2185
|
-
if (cleanId.startsWith("vinext/shims/"))
|
|
2254
|
+
if (cleanId === "vinext/shims/image" && this.environment?.name !== "rsc" && !nextImageAliasedByUser) return this.resolve("next/image", importer, { skipSelf: true });
|
|
2255
|
+
if (cleanId.startsWith("vinext/shims/")) {
|
|
2256
|
+
const shimPath = resolveShimModulePath(_shimsDir, stripJsExtension(stripViteModuleQuery(cleanId.slice(13))));
|
|
2257
|
+
return this.resolve(shimPath, importer, {
|
|
2258
|
+
...options,
|
|
2259
|
+
skipSelf: true
|
|
2260
|
+
});
|
|
2261
|
+
}
|
|
2186
2262
|
if (cleanId === VIRTUAL_WORKER_ENTRY) return RESOLVED_WORKER_ENTRY;
|
|
2187
2263
|
if (selectedMultiStageOutput && (cleanId === "vinext/server/app-router-entry" || cleanId === "vinext/server/pages-router-entry")) return RESOLVED_WORKER_ENTRY;
|
|
2188
2264
|
if (cleanId.endsWith("/" + VIRTUAL_WORKER_ENTRY)) return RESOLVED_WORKER_ENTRY;
|
|
@@ -2243,7 +2319,10 @@ function vinext(options = {}) {
|
|
|
2243
2319
|
const reactServerShim = _reactServerShims.get(cleanId);
|
|
2244
2320
|
if (reactServerShim !== void 0) {
|
|
2245
2321
|
const shimName = this.environment?.name === "rsc" ? `${reactServerShim}.react-server` : reactServerShim;
|
|
2246
|
-
return resolveShimModulePath(_shimsDir, shimName)
|
|
2322
|
+
return this.resolve(resolveShimModulePath(_shimsDir, shimName), importer, {
|
|
2323
|
+
...options,
|
|
2324
|
+
skipSelf: true
|
|
2325
|
+
});
|
|
2247
2326
|
}
|
|
2248
2327
|
}
|
|
2249
2328
|
},
|
|
@@ -2313,7 +2392,6 @@ function vinext(options = {}) {
|
|
|
2313
2392
|
const globalErrorPath = findFileWithExts(appDir, "global-error", fileMatcher);
|
|
2314
2393
|
const globalNotFoundPath = nextConfig?.globalNotFound ? findFileWithExts(appDir, "global-not-found", fileMatcher) : null;
|
|
2315
2394
|
if (id !== RESOLVED_APP_REQUEST_ENTRY) {
|
|
2316
|
-
rscClassificationManifests.set(id, collectRouteClassificationManifest(routes));
|
|
2317
2395
|
rscActionOwnerRoutes = this.environment.config.command === "build" && hasServerActions ? routes : null;
|
|
2318
2396
|
rscActionOwnerSharedRoots = [globalErrorPath, globalNotFoundPath].filter((path) => path !== null);
|
|
2319
2397
|
clientReferenceRoutes = this.environment.config.command === "build" ? routes : null;
|
|
@@ -2383,7 +2461,12 @@ function vinext(options = {}) {
|
|
|
2383
2461
|
isDynamic: route.isDynamic,
|
|
2384
2462
|
patternParts: [...route.patternParts]
|
|
2385
2463
|
})) : [];
|
|
2386
|
-
|
|
2464
|
+
const classifyDynamicRoutes = this.environment.config.command === "build" && !nextConfig?.cacheComponents;
|
|
2465
|
+
const readMdxEsm = classifyDynamicRoutes && pageExtensionsIncludeMdx(nextConfig?.pageExtensions ?? []) ? await loadMdxEsmReader(root) : null;
|
|
2466
|
+
return generateBrowserEntry(graph.routes, pagesPrefetchRoutes, nextConfig.rewrites, nextConfig.i18n?.locales, classifyDynamicRoutes ? {
|
|
2467
|
+
route: (route) => isAppPageRouteRenderedDynamically(route, readMdxEsm),
|
|
2468
|
+
intercept: (intercept, layoutPaths) => isAppInterceptRenderedDynamically(intercept, layoutPaths, readMdxEsm)
|
|
2469
|
+
} : void 0);
|
|
2387
2470
|
}
|
|
2388
2471
|
if (id === RESOLVED_APP_ROUTE_MANIFEST && hasAppDir) {
|
|
2389
2472
|
const graph = await appRouteGraph(appDir, nextConfig?.pageExtensions, fileMatcher);
|
|
@@ -2398,44 +2481,19 @@ export const loadServerActionClient = ${hasServerActions ? `() => import(${JSON.
|
|
|
2398
2481
|
}
|
|
2399
2482
|
if (id.startsWith("\0virtual:vinext-google-fonts?")) return generateGoogleFontsVirtualModule(id, _fontGoogleShimPath);
|
|
2400
2483
|
}
|
|
2401
|
-
}
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
const patchPlan = hasClassificationStub && rscClassificationManifest ? planRouteClassificationInjection({
|
|
2415
|
-
canonicalizeLayoutPath: canonicalize,
|
|
2416
|
-
chunks: [{
|
|
2417
|
-
code,
|
|
2418
|
-
fileName: chunk.fileName
|
|
2419
|
-
}],
|
|
2420
|
-
dynamicShimPaths,
|
|
2421
|
-
enableDebugReasons: enableClassificationDebug,
|
|
2422
|
-
manifest: rscClassificationManifest,
|
|
2423
|
-
moduleInfo: { getModuleInfo: (moduleId) => {
|
|
2424
|
-
const info = this.getModuleInfo(moduleId);
|
|
2425
|
-
if (!info) return null;
|
|
2426
|
-
return {
|
|
2427
|
-
importedIds: info.importedIds ?? [],
|
|
2428
|
-
dynamicImportedIds: info.dynamicallyImportedIds ?? []
|
|
2429
|
-
};
|
|
2430
|
-
} }
|
|
2431
|
-
}) : { kind: "skip" };
|
|
2432
|
-
const nextCode = patchPlan.kind === "skip" ? code : patchPlan.code;
|
|
2433
|
-
if (patchPlan.kind === "skip") return null;
|
|
2434
|
-
rscClassificationManifests.delete(rscEntryId);
|
|
2435
|
-
return {
|
|
2436
|
-
code: nextCode,
|
|
2437
|
-
map: null
|
|
2438
|
-
};
|
|
2484
|
+
}
|
|
2485
|
+
},
|
|
2486
|
+
{
|
|
2487
|
+
name: "vinext:cloudflare-react-dom-edge",
|
|
2488
|
+
enforce: "pre",
|
|
2489
|
+
resolveId: {
|
|
2490
|
+
filter: { id: /^react-dom\/(?:server|static)$/ },
|
|
2491
|
+
handler(id, importer, options) {
|
|
2492
|
+
if (!hasCloudflarePlugin || this.environment?.config.consumer !== "server" || this.environment.name === "rsc") return;
|
|
2493
|
+
return this.resolve(`${id}.edge`, importer, {
|
|
2494
|
+
...options,
|
|
2495
|
+
skipSelf: true
|
|
2496
|
+
});
|
|
2439
2497
|
}
|
|
2440
2498
|
}
|
|
2441
2499
|
},
|
|
@@ -2649,25 +2707,42 @@ export const loadServerActionClient = ${hasServerActions ? `() => import(${JSON.
|
|
|
2649
2707
|
{
|
|
2650
2708
|
name: "vinext:client-entry-manifest",
|
|
2651
2709
|
apply: "build",
|
|
2652
|
-
generateBundle
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2710
|
+
generateBundle: {
|
|
2711
|
+
order: "post",
|
|
2712
|
+
handler(_options, bundle) {
|
|
2713
|
+
if (this.environment?.name !== "client") return;
|
|
2714
|
+
const manifest = {};
|
|
2715
|
+
for (const chunk of Object.values(bundle)) {
|
|
2716
|
+
if (chunk.type !== "chunk") continue;
|
|
2717
|
+
if (chunk.isDynamicEntry && isVirtualEntryFacade(chunk.facadeModuleId, VIRTUAL_APP_ROUTE_MANIFEST)) manifest.appRouteManifest = chunk.fileName;
|
|
2718
|
+
if (!chunk.isEntry) continue;
|
|
2719
|
+
if (isVirtualEntryFacade(chunk.facadeModuleId, VIRTUAL_CLIENT_ENTRY)) manifest.pagesClientEntry = chunk.fileName;
|
|
2720
|
+
else if (isVirtualEntryFacade(chunk.facadeModuleId, VIRTUAL_APP_BROWSER_ENTRY)) manifest.appBrowserEntry = chunk.fileName;
|
|
2721
|
+
}
|
|
2722
|
+
if (clientReferenceModules) {
|
|
2723
|
+
const appBrowserEntry = manifest.appBrowserEntry ? bundle[manifest.appBrowserEntry] : void 0;
|
|
2724
|
+
manifest.appClientReferenceChunks = collectClientReferenceChunks(bundle, clientReferenceModules, appBrowserEntry?.type === "chunk" ? appBrowserEntry : void 0, this.environment.config.build.modulePreload);
|
|
2725
|
+
const sources = collectClientReferenceSources(bundle, (moduleId) => this.getModuleInfo(moduleId)?.importedIds, this.environment.config.root);
|
|
2726
|
+
if (sources) this.emitFile({
|
|
2727
|
+
type: "asset",
|
|
2728
|
+
fileName: VINEXT_CLIENT_REFERENCE_SOURCES,
|
|
2729
|
+
source: JSON.stringify(sources, null, 2) + "\n"
|
|
2730
|
+
});
|
|
2731
|
+
}
|
|
2732
|
+
if (!manifest.pagesClientEntry && !manifest.appBrowserEntry) return;
|
|
2733
|
+
this.emitFile({
|
|
2734
|
+
type: "asset",
|
|
2735
|
+
fileName: VINEXT_CLIENT_ENTRY_MANIFEST,
|
|
2736
|
+
source: JSON.stringify(manifest, null, 2) + "\n"
|
|
2737
|
+
});
|
|
2659
2738
|
}
|
|
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
2739
|
}
|
|
2667
2740
|
},
|
|
2741
|
+
createClientCompileHintsPlugin((id) => isVirtualEntryFacade(id, VIRTUAL_APP_BROWSER_ENTRY) || isVirtualEntryFacade(id, VIRTUAL_CLIENT_ENTRY)),
|
|
2668
2742
|
asyncHooksStubPlugin,
|
|
2669
2743
|
createInstrumentationClientTransformPlugin(() => instrumentationClientPath, () => nextConfig.instrumentationClientRouteManifest),
|
|
2670
2744
|
createInstrumentationServerTransformPlugin(() => instrumentationPath, () => nextConfig.instrumentationServerValueInjections),
|
|
2745
|
+
createNextIntlCatalogPlugin(() => root, () => nextConfig.nextIntlCatalogLoader),
|
|
2671
2746
|
{
|
|
2672
2747
|
name: "vinext:instrumentation-client-inject",
|
|
2673
2748
|
enforce: "pre",
|
|
@@ -3180,11 +3255,12 @@ export const loadServerActionClient = ${hasServerActions ? `() => import(${JSON.
|
|
|
3180
3255
|
const [pathname] = url.split("?");
|
|
3181
3256
|
if (url.startsWith("/@") || url.startsWith("/__vite") || url.startsWith("/node_modules") || url.includes(".") && !pathname.endsWith(".html") && !pathname.endsWith(".rsc")) return next();
|
|
3182
3257
|
const _reqStart = now();
|
|
3258
|
+
const _reqWallStart = Date.now();
|
|
3183
3259
|
let _compileMs;
|
|
3184
3260
|
let _renderMs;
|
|
3185
3261
|
function _parseTiming(raw) {
|
|
3186
3262
|
const [handlerStart, inHandlerCompileMs, renderMs] = String(raw).split(",").map((v) => Number(v));
|
|
3187
|
-
if (!Number.isNaN(handlerStart) && !Number.isNaN(inHandlerCompileMs) && inHandlerCompileMs !== -1) _compileMs = Math.max(0, Math.round(handlerStart -
|
|
3263
|
+
if (!Number.isNaN(handlerStart) && !Number.isNaN(inHandlerCompileMs) && inHandlerCompileMs !== -1) _compileMs = Math.max(0, Math.round(handlerStart - _reqWallStart)) + inHandlerCompileMs;
|
|
3188
3264
|
if (!Number.isNaN(renderMs) && renderMs !== -1) _renderMs = renderMs;
|
|
3189
3265
|
}
|
|
3190
3266
|
const _origSetHeader = res.setHeader.bind(res);
|
|
@@ -3855,7 +3931,7 @@ export const loadServerActionClient = ${hasServerActions ? `() => import(${JSON.
|
|
|
3855
3931
|
const cache = imageImportDimCache;
|
|
3856
3932
|
let dims = cache.get(imagePath);
|
|
3857
3933
|
if (!dims) try {
|
|
3858
|
-
const { imageSize } = await import("./deps/.pnpm/image-size@2.0.
|
|
3934
|
+
const { imageSize } = await import("./deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/index.js");
|
|
3859
3935
|
const result = imageSize(fs.readFileSync(imagePath));
|
|
3860
3936
|
dims = {
|
|
3861
3937
|
width: result.width ?? 0,
|
|
@@ -4178,6 +4254,8 @@ export const loadServerActionClient = ${hasServerActions ? `() => import(${JSON.
|
|
|
4178
4254
|
pagesClientAssetsModule = buildPagesClientAssetsModule({
|
|
4179
4255
|
clientEntry: runtimeMetadata.clientEntryFile ?? void 0,
|
|
4180
4256
|
appBootstrapPreinitModules: runtimeMetadata.appBootstrapPreinitModules,
|
|
4257
|
+
appRouteManifestModule: runtimeMetadata.appRouteManifestModule,
|
|
4258
|
+
appClientReferenceChunks: runtimeMetadata.appClientReferenceChunks,
|
|
4181
4259
|
ssrManifest,
|
|
4182
4260
|
cssGraph: runtimeMetadata.cssGraph,
|
|
4183
4261
|
sharedChunks: runtimeMetadata.sharedChunks,
|
|
@@ -4392,6 +4470,9 @@ export const loadServerActionClient = ${hasServerActions ? `() => import(${JSON.
|
|
|
4392
4470
|
if (rscPluginPromise) {
|
|
4393
4471
|
plugins.push(createRscReferenceValidationNormalizerPlugin());
|
|
4394
4472
|
plugins.push(createRscClientReferenceLoadersPlugin({
|
|
4473
|
+
onClientReferenceModules(modules) {
|
|
4474
|
+
clientReferenceModules = modules;
|
|
4475
|
+
},
|
|
4395
4476
|
routes: {
|
|
4396
4477
|
canonicalizeModuleId: canonicalize,
|
|
4397
4478
|
getAlwaysRenderedFiles: () => clientReferenceAlwaysRenderedFiles,
|