vinext 1.2.1 → 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/README.md +12 -9
- 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 +77 -6
- package/dist/build/client-build-config.js +176 -12
- 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 +171 -0
- package/dist/build/client-reference-groups.js +572 -0
- 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 +33 -1
- package/dist/build/module-dependency-cache.js +51 -1
- package/dist/build/next-client-runtime-manifests.d.ts +12 -2
- package/dist/build/next-client-runtime-manifests.js +19 -4
- package/dist/build/nitro-public-files.d.ts +24 -0
- package/dist/build/nitro-public-files.js +60 -0
- package/dist/build/pages-client-assets-module.js +1 -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-paths.js +5 -2
- 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 +24 -0
- package/dist/build/server-actions-encryption-key.js +101 -0
- package/dist/build/ssr-manifest.d.ts +3 -0
- package/dist/build/ssr-manifest.js +34 -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-rewrite-params.d.ts +9 -0
- package/dist/client/client-rewrite-params.js +20 -0
- 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 +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 +28 -3
- package/dist/client/navigation-runtime.js +42 -11
- package/dist/client/pages-router-link-navigation.d.ts +2 -1
- package/dist/client/vinext-next-data.d.ts +25 -2
- package/dist/client/window-next.d.ts +2 -1
- package/dist/config/config-matchers.d.ts +27 -41
- package/dist/config/config-matchers.js +293 -270
- package/dist/config/config-source.d.ts +34 -0
- package/dist/config/config-source.js +141 -0
- package/dist/config/dotenv.d.ts +2 -1
- package/dist/config/header-params.d.ts +29 -0
- package/dist/config/header-params.js +106 -0
- package/dist/config/next-config.d.ts +20 -6
- package/dist/config/next-config.js +149 -11
- 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 +34 -6
- package/dist/entries/app-browser-entry.js +103 -40
- package/dist/entries/app-rsc-entry.d.ts +4 -1
- package/dist/entries/app-rsc-entry.js +131 -66
- package/dist/entries/app-rsc-manifest.d.ts +12 -1
- package/dist/entries/app-rsc-manifest.js +73 -1
- package/dist/entries/app-ssr-entry.d.ts +4 -1
- package/dist/entries/app-ssr-entry.js +9 -2
- package/dist/entries/pages-client-entry.d.ts +1 -0
- package/dist/entries/pages-client-entry.js +6 -6
- 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 +18 -15
- 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.d.ts +11 -0
- package/dist/index.js +340 -116
- package/dist/init.js +17 -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/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 +27 -3
- package/dist/plugins/optimize-imports.js +106 -20
- 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 +53 -1
- package/dist/plugins/rsc-client-reference-loaders.js +447 -27
- 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 +5 -0
- package/dist/plugins/use-cache-callable.js +30 -8
- package/dist/plugins/worker-image-imports.d.ts +1 -0
- package/dist/plugins/worker-image-imports.js +2 -2
- package/dist/plugins/worker-use-server.d.ts +2 -1
- package/dist/routing/app-route-graph.d.ts +41 -1
- package/dist/routing/app-route-graph.js +122 -50
- package/dist/routing/browser-route-manifest.d.ts +44 -0
- package/dist/routing/browser-route-manifest.js +195 -0
- package/dist/routing/hashed-route-patterns.d.ts +4 -0
- package/dist/routing/hashed-route-patterns.js +22 -0
- package/dist/routing/optimistic-route-trie.d.ts +28 -0
- package/dist/routing/optimistic-route-trie.js +102 -0
- package/dist/routing/route-matching.d.ts +2 -1
- package/dist/routing/route-pattern.d.ts +2 -1
- package/dist/routing/route-validation.d.ts +6 -1
- package/dist/routing/route-validation.js +26 -10
- package/dist/server/accept-encoding.d.ts +2 -1
- package/dist/server/app-action-forwarding.d.ts +10 -1
- package/dist/server/app-action-forwarding.js +15 -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 +175 -64
- package/dist/server/app-browser-error.d.ts +5 -2
- package/dist/server/app-browser-error.js +7 -2
- 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 +4 -3
- package/dist/server/app-browser-mpa-navigation.d.ts +1 -0
- package/dist/server/app-browser-mpa-navigation.js +6 -5
- package/dist/server/app-browser-navigation-controller.d.ts +17 -6
- package/dist/server/app-browser-navigation-controller.js +103 -36
- 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.d.ts +2 -2
- 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 +6 -5
- 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 +45 -2
- package/dist/server/app-client-reference-preloader.js +48 -10
- 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 +6 -2
- 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-middleware.d.ts +6 -0
- package/dist/server/app-middleware.js +8 -10
- package/dist/server/app-optimistic-routing.d.ts +26 -11
- package/dist/server/app-optimistic-routing.js +38 -96
- package/dist/server/app-page-boundary-render.d.ts +20 -2
- package/dist/server/app-page-boundary-render.js +229 -39
- 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 +15 -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 +165 -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 +38 -11
- 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 +3 -1
- package/dist/server/app-page-rsc-render-status.js +1 -0
- package/dist/server/app-page-search-params-observation.d.ts +8 -6
- package/dist/server/app-page-search-params-observation.js +16 -11
- package/dist/server/app-page-segment-plan.d.ts +2 -1
- package/dist/server/app-page-stream.d.ts +38 -1
- package/dist/server/app-page-stream.js +24 -4
- package/dist/server/app-pages-bridge.d.ts +4 -2
- package/dist/server/app-pages-bridge.js +11 -7
- 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-prerender-static-params.js +3 -2
- package/dist/server/app-render-dependency.d.ts +11 -1
- package/dist/server/app-render-dependency.js +65 -6
- package/dist/server/app-request-stage-independent-entry.d.ts +2 -1
- package/dist/server/app-request-stage-independent-entry.js +2 -2
- package/dist/server/app-response-stage-entry.d.ts +2 -1
- package/dist/server/app-response-stage-entry.js +3 -3
- 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 +4 -2
- package/dist/server/app-route-handler-execution.d.ts +4 -1
- package/dist/server/app-route-handler-execution.js +9 -2
- package/dist/server/app-route-handler-middleware-context.d.ts +2 -1
- package/dist/server/app-route-handler-middleware-context.js +3 -3
- package/dist/server/app-route-handler-response.d.ts +4 -2
- package/dist/server/app-route-handler-response.js +2 -2
- package/dist/server/app-route-handler-runtime.d.ts +4 -1
- package/dist/server/app-route-handler-runtime.js +20 -3
- package/dist/server/app-route-module-loader.d.ts +18 -1
- package/dist/server/app-route-module-loader.js +15 -6
- package/dist/server/app-route-tree-prefetch.d.ts +2 -1
- package/dist/server/app-route-tree.d.ts +20 -0
- package/dist/server/app-route-tree.js +18 -0
- package/dist/server/app-router-entry.js +2 -2
- package/dist/server/app-rsc-combined-handler.js +8 -1
- package/dist/server/app-rsc-error-handler.d.ts +2 -1
- package/dist/server/app-rsc-errors.d.ts +9 -1
- package/dist/server/app-rsc-errors.js +9 -2
- package/dist/server/app-rsc-handler.d.ts +6 -2
- package/dist/server/app-rsc-handler.js +152 -140
- package/dist/server/app-rsc-response-finalizer.d.ts +7 -1
- package/dist/server/app-rsc-response-finalizer.js +4 -1
- package/dist/server/app-rsc-response-stage.js +3 -1
- package/dist/server/app-rsc-route-matching.d.ts +39 -1
- package/dist/server/app-rsc-route-matching.js +25 -1
- 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 +25 -7
- package/dist/server/app-server-action-execution.js +53 -59
- package/dist/server/app-ssr-entry.d.ts +12 -0
- package/dist/server/app-ssr-entry.js +104 -48
- 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 +29 -10
- package/dist/server/app-ssr-stream.js +311 -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/config-headers.js +12 -3
- 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/isolate-shared-promise.d.ts +10 -0
- package/dist/server/isolate-shared-promise.js +33 -0
- package/dist/server/isr-cache.js +3 -2
- 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-matcher-pattern.d.ts +0 -1
- package/dist/server/middleware-matcher-pattern.js +11 -140
- package/dist/server/middleware-matcher.js +5 -6
- package/dist/server/middleware-response-headers.d.ts +31 -0
- package/dist/server/middleware-response-headers.js +57 -1
- package/dist/server/middleware-runtime.d.ts +2 -1
- package/dist/server/middleware-runtime.js +26 -13
- package/dist/server/navigation-planner.d.ts +2 -2
- 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 +39 -0
- package/dist/server/nitro-public-files-plugin.js +106 -0
- package/dist/server/nitro-public-files.d.ts +22 -0
- package/dist/server/nitro-public-files.js +39 -0
- 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 +7 -1
- package/dist/server/pages-asset-tags.js +9 -2
- package/dist/server/pages-body-parser-config.d.ts +2 -1
- package/dist/server/pages-client-assets.d.ts +8 -1
- 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-i18n.d.ts +18 -0
- package/dist/server/pages-i18n.js +18 -2
- package/dist/server/pages-node-compat.d.ts +5 -3
- package/dist/server/pages-node-compat.js +35 -16
- 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 +8 -2
- package/dist/server/pages-request-pipeline.js +35 -40
- package/dist/server/pages-request-stage-entry.d.ts +2 -1
- package/dist/server/pages-request-stage-entry.js +16 -6
- package/dist/server/pages-response-stage-entry.d.ts +2 -1
- package/dist/server/pages-response-stage-entry.js +1 -1
- package/dist/server/pages-revalidate.js +1 -0
- package/dist/server/pages-route-data-kind.d.ts +2 -1
- package/dist/server/pages-router-entry.js +1 -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.d.ts +2 -2
- package/dist/server/prod-server.js +80 -36
- package/dist/server/proxy-trust.d.ts +6 -0
- package/dist/server/proxy-trust.js +12 -6
- package/dist/server/request-log.d.ts +2 -1
- package/dist/server/request-pipeline.d.ts +5 -0
- package/dist/server/request-pipeline.js +12 -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/server-reference-loader.js +10 -1
- package/dist/server/static-file-cache.d.ts +2 -1
- package/dist/server/static-file-cache.js +16 -3
- 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/server/worker-utils.js +1 -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 +32 -11
- package/dist/shims/cache-request-state.d.ts +40 -3
- package/dist/shims/cache-request-state.js +70 -5
- package/dist/shims/cache-runtime.js +47 -19
- package/dist/shims/cache.d.ts +2 -2
- package/dist/shims/cache.js +17 -8
- 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 +25 -0
- package/dist/shims/cdn-purge-routes.js +77 -0
- 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/dynamic.js +17 -4
- 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 +9 -4
- 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-props.d.ts +93 -0
- package/dist/shims/image-props.js +323 -0
- package/dist/shims/image.d.ts +4 -39
- package/dist/shims/image.js +4 -319
- 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 +9 -0
- package/dist/shims/internal/headers-state.js +19 -2
- package/dist/shims/internal/hybrid-client-route-owner-direct.d.ts +6 -2
- package/dist/shims/internal/hybrid-client-route-owner-direct.js +31 -14
- package/dist/shims/internal/hybrid-client-route-owner.js +8 -8
- 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 +198 -53
- 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 +23 -3
- package/dist/shims/navigation.js +91 -25
- package/dist/shims/og.js +35 -10
- package/dist/shims/pages-router-runtime.d.ts +2 -1
- package/dist/shims/ppr-fallback-shell.d.ts +2 -1
- package/dist/shims/request-context.d.ts +13 -0
- package/dist/shims/router.js +33 -43
- package/dist/shims/server.d.ts +31 -4
- package/dist/shims/server.js +58 -10
- package/dist/shims/thenable-params.d.ts +6 -1
- package/dist/shims/thenable-params.js +11 -2
- package/dist/shims/unified-request-context.d.ts +5 -0
- package/dist/shims/unified-request-context.js +5 -3
- package/dist/typegen.d.ts +2 -1
- package/dist/utils/asset-prefix.d.ts +7 -0
- package/dist/utils/asset-prefix.js +10 -1
- package/dist/utils/client-build-manifest.d.ts +4 -1
- package/dist/utils/client-build-manifest.js +20 -6
- 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 +10 -1
- package/dist/utils/client-runtime-metadata.js +53 -9
- package/dist/utils/compare.d.ts +9 -0
- package/dist/utils/compare.js +15 -1
- package/dist/utils/lazy-chunks.d.ts +18 -0
- package/dist/utils/lazy-chunks.js +27 -1
- package/dist/utils/manifest-paths.d.ts +14 -0
- package/dist/utils/manifest-paths.js +22 -1
- package/dist/utils/middleware-request-headers.d.ts +2 -1
- package/dist/utils/path-to-regexp.d.ts +21 -0
- package/dist/{server/middleware-path-to-regexp.js → utils/path-to-regexp.js} +14 -11
- package/dist/utils/plugin-react-version.d.ts +15 -0
- package/dist/utils/plugin-react-version.js +64 -0
- package/dist/utils/project.d.ts +2 -1
- package/dist/utils/project.js +9 -1
- package/dist/utils/public-routes.d.ts +2 -0
- package/dist/utils/public-routes.js +18 -7
- 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/middleware-path-to-regexp.d.ts +0 -13
- package/dist/server/rsc-stream-hints.d.ts +0 -21
- package/dist/server/rsc-stream-hints.js +0 -227
- package/dist/utils/regex-safety.d.ts +0 -17
- package/dist/utils/regex-safety.js +0 -789
package/README.md
CHANGED
|
@@ -232,6 +232,8 @@ The migration is non-destructive -- your existing Next.js setup continues to wor
|
|
|
232
232
|
|
|
233
233
|
vinext targets Vite 8, which defaults to Rolldown, Oxc, Lightning CSS, and a newer browser baseline. If you bring custom Vite config or plugins from an older setup, prefer `oxc`, `optimizeDeps.rolldownOptions`, and `build.rolldownOptions` over older `esbuild` and `build.rollupOptions` knobs, and override `build.target` if you still need older browsers. If a dependency breaks because of stricter CommonJS default import handling, fix the import or use `legacy.inconsistentCjsInterop: true` as a temporary escape hatch. See the [Vite 8 migration guide](https://vite.dev/guide/migration).
|
|
234
234
|
|
|
235
|
+
Production client JS, Web Worker and CSS files use hash-only file names (by default `_next/static/chunks/[hash].js`, `_next/static/workers/<module-id>-[hash].js` and `_next/static/css/[hash].css`) so component and source file names don't appear in public asset URLs. Web Worker file names are fixed. To use different client JS and CSS names, set `entryFileNames`, `chunkFileNames` or `assetFileNames` in `build.rolldownOptions.output` (or `environments.client.build.rolldownOptions.output`), keeping them under the client assets directory: `_next/static/` by default, or `<prefix>/_next/static/` with a path-based `assetPrefix` such as `/cdn` (e.g. `chunkFileNames: "cdn/_next/static/chunks/[name]-[hash].js"`).
|
|
236
|
+
|
|
235
237
|
```bash
|
|
236
238
|
npm run dev:vinext # Start the vinext dev server (port 3001)
|
|
237
239
|
npm run build:vinext # Build production output with vinext
|
|
@@ -677,15 +679,16 @@ Every `next/*` import is shimmed to a Vite-compatible implementation.
|
|
|
677
679
|
|
|
678
680
|
### Configuration
|
|
679
681
|
|
|
680
|
-
| Feature | | Notes
|
|
681
|
-
| ------------------------------------------------ | --- |
|
|
682
|
-
| `next.config.js` / `.ts` / `.mjs` | ✅ | Function configs, phase argument
|
|
683
|
-
| `rewrites` / `redirects` / `headers` | ✅ | All phases, param interpolation
|
|
684
|
-
| Environment variables (`.env*`, `NEXT_PUBLIC_*`) | ✅ | Auto-loads Next.js-style dotenv files; only public vars are inlined
|
|
685
|
-
| `images` config | 🟡 | Parsed but not used for optimization
|
|
686
|
-
| `experimental.optimizePackageImports` | ✅ | Rewrites barrel imports to direct sub-module imports in RSC/SSR environments. A default set (lucide-react, date-fns, radix-ui, antd, MUI, and others) are always optimized. Add package names here to extend the list.
|
|
687
|
-
| `vinext({ nextConfig })` | ✅ | Inline Next-style config from `vite.config.*`. Supports object-form and function-form config. When provided, this overrides root `next.config.*`.
|
|
688
|
-
| `vinext({ react: { compiler: true } })` | ✅ | React Compiler auto memoization. Needs `@vitejs/plugin-react` 6.1+ and the optional `oxc-transform-react` package.
|
|
682
|
+
| Feature | | Notes |
|
|
683
|
+
| ------------------------------------------------ | --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
684
|
+
| `next.config.js` / `.ts` / `.mjs` | ✅ | Function configs, phase argument |
|
|
685
|
+
| `rewrites` / `redirects` / `headers` | ✅ | All phases, param interpolation. A source Next.js rejects fails config loading, as it fails the Next.js build: missing, not starting with `/`, over the 4,096-character built-regex limit, or rejected by path-to-regexp, such as a header glob `/api/*` |
|
|
686
|
+
| Environment variables (`.env*`, `NEXT_PUBLIC_*`) | ✅ | Auto-loads Next.js-style dotenv files; only public vars are inlined |
|
|
687
|
+
| `images` config | 🟡 | Parsed but not used for optimization |
|
|
688
|
+
| `experimental.optimizePackageImports` | ✅ | Rewrites barrel imports to direct sub-module imports in RSC/SSR environments. A default set (lucide-react, date-fns, radix-ui, antd, MUI, and others) are always optimized. Add package names here to extend the list. |
|
|
689
|
+
| `vinext({ nextConfig })` | ✅ | Inline Next-style config from `vite.config.*`. Supports object-form and function-form config. When provided, this overrides root `next.config.*`. |
|
|
690
|
+
| `vinext({ react: { compiler: true } })` | ✅ | React Compiler auto memoization. Needs `@vitejs/plugin-react` 6.1+ and the optional `oxc-transform-react` package. |
|
|
691
|
+
| `vinext({ disableNextLikeChunking: true })` | ✅ | Loads each client component from its own chunk, instead of one chunk per route group (Next.js-like; App Router production builds). Grouping also turns off on its own when the client build has other chunk groups. |
|
|
689
692
|
|
|
690
693
|
### React Compiler
|
|
691
694
|
|
|
@@ -6,7 +6,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
10
10
|
var __copyProps = (to, from, except, desc) => {
|
|
11
11
|
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
12
|
key = keys[i];
|
|
@@ -2,7 +2,7 @@ import { AppRoute } from "../routing/app-route-graph.js";
|
|
|
2
2
|
import { Rollup } from "vite";
|
|
3
3
|
import { RscPluginManager } from "@vitejs/plugin-rsc";
|
|
4
4
|
//#region src/build/action-owner-manifest.d.ts
|
|
5
|
-
type ActionOwnerRoute = Pick<AppRoute, "errorPath" | "errorPaths" | "forbiddenPath" | "forbiddenPaths" | "layoutErrorPaths" | "layouts" | "loadingPath" | "loadingPaths" | "notFoundPath" | "notFoundPaths" | "pagePath" | "parallelSlots" | "pattern" | "siblingIntercepts" | "templates" | "unauthorizedPath" | "unauthorizedPaths">;
|
|
5
|
+
type ActionOwnerRoute = Pick<AppRoute, "errorPath" | "errorPaths" | "forbiddenPath" | "forbiddenPaths" | "layoutErrorPaths" | "layouts" | "loadingPath" | "loadingPaths" | "notFoundPath" | "notFoundPaths" | "pagePath" | "parallelSlots" | "pattern" | "segmentForbiddenPaths" | "segmentNotFoundPaths" | "segmentUnauthorizedPaths" | "siblingIntercepts" | "templates" | "unauthorizedPath" | "unauthorizedPaths">;
|
|
6
6
|
export type ActionOwnerRouteReachability = Map<string, {
|
|
7
7
|
clientReferenceImportIds: Set<string>;
|
|
8
8
|
serverReferenceIds: Set<string>;
|
|
@@ -38,4 +38,5 @@ export declare function addClientActionReachability(options: {
|
|
|
38
38
|
routeReachability: ActionOwnerRouteReachability;
|
|
39
39
|
} & ActionOwnerReferenceMaps): void;
|
|
40
40
|
export declare function buildActionOwnerManifest(routeReachability: ActionOwnerRouteReachability): Record<string, string[]>;
|
|
41
|
-
//#endregion
|
|
41
|
+
//#endregion
|
|
42
|
+
export {};
|
|
@@ -15,6 +15,9 @@ function actionOwnerRouteEntryIds(route) {
|
|
|
15
15
|
...route.forbiddenPaths ?? [],
|
|
16
16
|
route.unauthorizedPath,
|
|
17
17
|
...route.unauthorizedPaths ?? [],
|
|
18
|
+
...route.segmentNotFoundPaths ?? [],
|
|
19
|
+
...route.segmentForbiddenPaths ?? [],
|
|
20
|
+
...route.segmentUnauthorizedPaths ?? [],
|
|
18
21
|
...route.parallelSlots.flatMap((slot) => [
|
|
19
22
|
slot.pagePath,
|
|
20
23
|
slot.defaultPath,
|
|
@@ -24,18 +27,31 @@ function actionOwnerRouteEntryIds(route) {
|
|
|
24
27
|
...slot.loadingPaths ?? [],
|
|
25
28
|
slot.errorPath,
|
|
26
29
|
slot.notFoundPath,
|
|
30
|
+
...slot.notFoundPaths ?? [],
|
|
27
31
|
...slot.interceptingRoutes.flatMap((intercept) => [
|
|
28
32
|
intercept.pagePath,
|
|
29
33
|
...intercept.layoutPaths,
|
|
30
34
|
...intercept.loadingPaths ?? [],
|
|
31
|
-
intercept.notFoundPath
|
|
35
|
+
intercept.notFoundPath,
|
|
36
|
+
intercept.forbiddenPath,
|
|
37
|
+
intercept.unauthorizedPath,
|
|
38
|
+
...intercept.notFoundPaths ?? [],
|
|
39
|
+
...intercept.forbiddenPaths ?? [],
|
|
40
|
+
...intercept.unauthorizedPaths ?? [],
|
|
41
|
+
...intercept.errorPaths ?? []
|
|
32
42
|
])
|
|
33
43
|
]),
|
|
34
44
|
...route.siblingIntercepts.flatMap((intercept) => [
|
|
35
45
|
intercept.pagePath,
|
|
36
46
|
...intercept.layoutPaths,
|
|
37
47
|
...intercept.loadingPaths ?? [],
|
|
38
|
-
intercept.notFoundPath
|
|
48
|
+
intercept.notFoundPath,
|
|
49
|
+
intercept.forbiddenPath,
|
|
50
|
+
intercept.unauthorizedPath,
|
|
51
|
+
...intercept.notFoundPaths ?? [],
|
|
52
|
+
...intercept.forbiddenPaths ?? [],
|
|
53
|
+
...intercept.unauthorizedPaths ?? [],
|
|
54
|
+
...intercept.errorPaths ?? []
|
|
39
55
|
])
|
|
40
56
|
].filter((value) => typeof value === "string");
|
|
41
57
|
}
|
|
@@ -12,4 +12,20 @@ import { AppRoute } from "../routing/app-route-graph.js";
|
|
|
12
12
|
* unreadable route's fallback, so it never certifies one.
|
|
13
13
|
*/
|
|
14
14
|
export declare function classifyAppPageRouteStaticEligibility(route: AppRoute, readMdxEsm: ((source: string) => string) | null): "eligible" | "ineligible" | "unreadable";
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Whether the route's segment config rules out static generation, so Next.js
|
|
17
|
+
* renders it on every request. An "unreadable" route or a source that can't be
|
|
18
|
+
* read counts as not dynamic.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isAppPageRouteRenderedDynamically(route: AppRoute, readMdxEsm: ((source: string) => string) | null): boolean;
|
|
21
|
+
type AppRouteIntercept = AppRoute["siblingIntercepts"][number];
|
|
22
|
+
/**
|
|
23
|
+
* Whether Next.js renders an intercepted page on every request. Next.js builds
|
|
24
|
+
* the intercepting page as its own route (`/feed/(.)photos/[id]`): the
|
|
25
|
+
* layouts of every folder from `app/` down to the intercepting page, then the
|
|
26
|
+
* page. `layoutPaths` are the candidate layouts; those outside the page's
|
|
27
|
+
* folder chain are ignored. An unreadable source counts as not dynamic.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isAppInterceptRenderedDynamically(intercept: AppRouteIntercept, layoutPaths: readonly string[], readMdxEsm: ((source: string) => string) | null): boolean;
|
|
30
|
+
//#endregion
|
|
31
|
+
export {};
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
+
import path from "../deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
|
|
1
2
|
import { extractExportConstNumber, extractExportConstString, hasRuntimeExportedName } from "./report.js";
|
|
2
3
|
import { collectAppPageStaticGenerationRuntimes, hasAppPageGenerateStaticParamsAtLastDynamicSegment, isAppPageStaticEligible, isEdgeRuntime, resolveAppPageSegmentConfig, resolveAppPageStaticGenerationRuntime } from "../server/app-segment-config.js";
|
|
3
4
|
import fs from "node:fs";
|
|
4
5
|
//#region src/build/app-page-static-eligibility.ts
|
|
5
6
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* the loaded modules. Only such a route has listed paths.
|
|
9
|
-
*
|
|
10
|
-
* An MDX source read without the MDX parser has unknown exports, so its route
|
|
11
|
-
* is "unreadable". Its paths are still listed: the built runtime reads the real
|
|
12
|
-
* exports and never stores a route that isn't static, while an unlisted path's
|
|
13
|
-
* render failure would be dropped instead of failing. But no probe renders an
|
|
14
|
-
* unreadable route's fallback, so it never certifies one.
|
|
7
|
+
* Read the segment config exports of App layout and page sources. A source MDX
|
|
8
|
+
* without the MDX parser leaves the reader "unreadable".
|
|
15
9
|
*/
|
|
16
|
-
function
|
|
10
|
+
function createSegmentConfigReader(readMdxEsm) {
|
|
17
11
|
let unreadable = false;
|
|
18
|
-
const
|
|
12
|
+
const read = (filePath) => {
|
|
19
13
|
if (!filePath) return null;
|
|
20
14
|
let code = fs.readFileSync(filePath, "utf8");
|
|
21
15
|
if (filePath.toLowerCase().endsWith(".mdx")) {
|
|
@@ -36,6 +30,24 @@ function classifyAppPageRouteStaticEligibility(route, readMdxEsm) {
|
|
|
36
30
|
...runtime === null ? {} : { runtime }
|
|
37
31
|
};
|
|
38
32
|
};
|
|
33
|
+
return {
|
|
34
|
+
isUnreadable: () => unreadable,
|
|
35
|
+
read
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Whether Next.js classifies an App page route as static or SSG, read from its
|
|
40
|
+
* layout, page and parallel-slot sources with the helpers dispatch applies to
|
|
41
|
+
* the loaded modules. Only such a route has listed paths.
|
|
42
|
+
*
|
|
43
|
+
* An MDX source read without the MDX parser has unknown exports, so its route
|
|
44
|
+
* is "unreadable". Its paths are still listed: the built runtime reads the real
|
|
45
|
+
* exports and never stores a route that isn't static, while an unlisted path's
|
|
46
|
+
* render failure would be dropped instead of failing. But no probe renders an
|
|
47
|
+
* unreadable route's fallback, so it never certifies one.
|
|
48
|
+
*/
|
|
49
|
+
function classifyAppPageRouteStaticEligibility(route, readMdxEsm) {
|
|
50
|
+
const { isUnreadable, read: readSegmentConfig } = createSegmentConfigReader(readMdxEsm);
|
|
39
51
|
const layouts = route.layouts.map(readSegmentConfig);
|
|
40
52
|
const page = readSegmentConfig(route.pagePath);
|
|
41
53
|
const parallelBranches = route.parallelSlots.map((slot) => ({
|
|
@@ -48,7 +60,7 @@ function classifyAppPageRouteStaticEligibility(route, readMdxEsm) {
|
|
|
48
60
|
page: readSegmentConfig(slot.pagePath ?? slot.defaultPath),
|
|
49
61
|
routeSegments: slot.routeSegments
|
|
50
62
|
}));
|
|
51
|
-
if (
|
|
63
|
+
if (isUnreadable()) return "unreadable";
|
|
52
64
|
const segmentConfig = resolveAppPageSegmentConfig({
|
|
53
65
|
layouts,
|
|
54
66
|
layoutTreePositions: route.layoutTreePositions,
|
|
@@ -78,5 +90,60 @@ function classifyAppPageRouteStaticEligibility(route, readMdxEsm) {
|
|
|
78
90
|
revalidateSeconds: segmentConfig.revalidateSeconds
|
|
79
91
|
}) ? "eligible" : "ineligible";
|
|
80
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Whether the route's segment config rules out static generation, so Next.js
|
|
95
|
+
* renders it on every request. An "unreadable" route or a source that can't be
|
|
96
|
+
* read counts as not dynamic.
|
|
97
|
+
*/
|
|
98
|
+
function isAppPageRouteRenderedDynamically(route, readMdxEsm) {
|
|
99
|
+
try {
|
|
100
|
+
return classifyAppPageRouteStaticEligibility(route, readMdxEsm) === "ineligible";
|
|
101
|
+
} catch {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const INTERCEPTION_MARKER_RE = /^(?:\(\.\.\.\)|\(\.\.\)\(\.\.\)|\(\.\.\)|\(\.\))/;
|
|
106
|
+
/**
|
|
107
|
+
* Whether Next.js renders an intercepted page on every request. Next.js builds
|
|
108
|
+
* the intercepting page as its own route (`/feed/(.)photos/[id]`): the
|
|
109
|
+
* layouts of every folder from `app/` down to the intercepting page, then the
|
|
110
|
+
* page. `layoutPaths` are the candidate layouts; those outside the page's
|
|
111
|
+
* folder chain are ignored. An unreadable source counts as not dynamic.
|
|
112
|
+
*/
|
|
113
|
+
function isAppInterceptRenderedDynamically(intercept, layoutPaths, readMdxEsm) {
|
|
114
|
+
if (!intercept.sourcePageSegments) return false;
|
|
115
|
+
const routeSegments = intercept.sourcePageSegments.map((segment) => segment.replace(INTERCEPTION_MARKER_RE, ""));
|
|
116
|
+
try {
|
|
117
|
+
const pageDir = path.dirname(intercept.pagePath);
|
|
118
|
+
const layoutsByPosition = /* @__PURE__ */ new Map();
|
|
119
|
+
for (const layoutPath of layoutPaths) {
|
|
120
|
+
const relative = path.relative(path.dirname(layoutPath), pageDir);
|
|
121
|
+
if (relative.startsWith("..") || path.isAbsolute(relative)) continue;
|
|
122
|
+
const depthBelowLayout = relative.split("/").filter(Boolean).length;
|
|
123
|
+
layoutsByPosition.set(routeSegments.length - depthBelowLayout, layoutPath);
|
|
124
|
+
}
|
|
125
|
+
const layoutTreePositions = [...layoutsByPosition.keys()].sort((a, b) => a - b);
|
|
126
|
+
const { isUnreadable, read } = createSegmentConfigReader(readMdxEsm);
|
|
127
|
+
const layouts = layoutTreePositions.map((position) => read(layoutsByPosition.get(position)));
|
|
128
|
+
const page = read(intercept.pagePath);
|
|
129
|
+
if (isUnreadable()) return false;
|
|
130
|
+
const tree = {
|
|
131
|
+
layouts,
|
|
132
|
+
layoutTreePositions,
|
|
133
|
+
page,
|
|
134
|
+
routeSegments
|
|
135
|
+
};
|
|
136
|
+
const segmentConfig = resolveAppPageSegmentConfig(tree);
|
|
137
|
+
return !isAppPageStaticEligible({
|
|
138
|
+
dynamicConfig: segmentConfig.dynamicConfig,
|
|
139
|
+
hasGenerateStaticParams: hasAppPageGenerateStaticParamsAtLastDynamicSegment(tree),
|
|
140
|
+
isDynamicRoute: routeSegments.some((segment) => segment.startsWith("[") && segment.endsWith("]")),
|
|
141
|
+
isStaticGenerationEdgeRuntime: isEdgeRuntime(resolveAppPageStaticGenerationRuntime(collectAppPageStaticGenerationRuntimes(tree))),
|
|
142
|
+
revalidateSeconds: segmentConfig.revalidateSeconds
|
|
143
|
+
});
|
|
144
|
+
} catch {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
81
148
|
//#endregion
|
|
82
|
-
export { classifyAppPageRouteStaticEligibility };
|
|
149
|
+
export { classifyAppPageRouteStaticEligibility, isAppInterceptRenderedDynamically, isAppPageRouteRenderedDynamically };
|
|
@@ -13,15 +13,24 @@ type ClientAssetFileNameInfo = {
|
|
|
13
13
|
* an asset (a single output asset can carry several `originalFileNames`).
|
|
14
14
|
*/
|
|
15
15
|
export declare function createClientAssetFileNames(assetsDir: string): (assetInfo: ClientAssetFileNameInfo) => string;
|
|
16
|
+
/**
|
|
17
|
+
* The App Router client build module that registers the client references
|
|
18
|
+
* whose modules are in the "vinext" chunk (see
|
|
19
|
+
* plugins/rsc-client-reference-loaders.ts). It joins that chunk, so it loads
|
|
20
|
+
* with the browser entry without adding to the entry's own chunk.
|
|
21
|
+
*/
|
|
22
|
+
export declare const RESOLVED_EAGER_CLIENT_REFERENCES_ID = "\0virtual:vinext-client-reference-eager";
|
|
16
23
|
/**
|
|
17
24
|
* Create a manualChunks function for client builds.
|
|
18
25
|
*
|
|
19
26
|
* Splits the client bundle into:
|
|
20
27
|
* - "framework" — React, ReactDOM, and scheduler (loaded on every page)
|
|
21
28
|
* - "vinext" — shared vinext runtime shims
|
|
29
|
+
* - "vinext-app-router" — the App Router runtime, in Pages Router builds
|
|
22
30
|
*
|
|
23
|
-
* Route-owned
|
|
24
|
-
* graph-based chunking so they
|
|
31
|
+
* Route-owned (App Router) or page-owned (Pages Router) client shims and all
|
|
32
|
+
* other vendor code are left to the bundler's graph-based chunking so they
|
|
33
|
+
* load only where they're used.
|
|
25
34
|
*
|
|
26
35
|
* Why not split every npm package into its own chunk?
|
|
27
36
|
* - Per-package splitting (`vendor-X`) creates 50-200+ chunks for a
|
|
@@ -39,10 +48,62 @@ export declare function createClientAssetFileNames(assetsDir: string): (assetInf
|
|
|
39
48
|
* and route-specific code stays in route chunks.
|
|
40
49
|
*/
|
|
41
50
|
export declare function createClientManualChunks(shimsDir: string, preserveRouteBoundaries?: boolean): (id: string) => string | undefined;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Web Worker output names. Workers are hash-only like client chunks, so their
|
|
53
|
+
* URLs don't publish source file names. Vite bundles each worker separately
|
|
54
|
+
* and stores the outputs by file name, so two workers' entries or chunks with
|
|
55
|
+
* identical code would share `[hash].js` and one's source map would overwrite
|
|
56
|
+
* the other's. Each name therefore also carries an opaque id derived from the
|
|
57
|
+
* chunk's module ids (root-relative for files).
|
|
58
|
+
*/
|
|
59
|
+
export declare function createWorkerFileNames(assetsDir: string, root: string): {
|
|
60
|
+
entryFileNames: (chunk: {
|
|
61
|
+
facadeModuleId: string | null;
|
|
62
|
+
moduleIds?: readonly string[];
|
|
63
|
+
}) => string;
|
|
64
|
+
chunkFileNames: (chunk: {
|
|
65
|
+
facadeModuleId: string | null;
|
|
66
|
+
moduleIds?: readonly string[];
|
|
67
|
+
}) => string;
|
|
45
68
|
};
|
|
69
|
+
/**
|
|
70
|
+
* vinext's client output file names, limited to the ones the incoming client
|
|
71
|
+
* environment config leaves unset. Vite merges `config` hook results over the
|
|
72
|
+
* user's config, so vinext applies these from `configEnvironment` instead: by
|
|
73
|
+
* then the user's top-level `build` and `environments.client.build` are merged
|
|
74
|
+
* into the client environment, and a user-provided pattern wins.
|
|
75
|
+
*
|
|
76
|
+
* Returns null for array-shaped output, which cannot be augmented without Vite
|
|
77
|
+
* concatenating a second output entry. Array-shaped client output is advanced
|
|
78
|
+
* config vinext doesn't support: Vite also appends vinext's own client output
|
|
79
|
+
* object (code splitting) to the user's array, producing an extra bundle.
|
|
80
|
+
*/
|
|
81
|
+
export declare function createClientOutputFileNameDefaults(output: VinextBuildBundlerOptions["output"], assetsDir: string): {
|
|
82
|
+
entryFileNames?: string | undefined;
|
|
83
|
+
chunkFileNames?: string | undefined;
|
|
84
|
+
assetFileNames?: ((assetInfo: ClientAssetFileNameInfo) => string) | undefined;
|
|
85
|
+
} | null;
|
|
86
|
+
/** Entry, chunk and asset file names from a (non-array) bundler output config. */
|
|
87
|
+
export declare function getOutputFileNames(output: VinextBuildBundlerOptions["output"]): Pick<VinextBuildOutput, "entryFileNames" | "chunkFileNames" | "assetFileNames">;
|
|
88
|
+
/**
|
|
89
|
+
* User-provided client file name patterns vinext cannot serve correctly:
|
|
90
|
+
* - outside `assetsDir`: built-asset URLs, immutable caching and
|
|
91
|
+
* precompression all assume client output lives there;
|
|
92
|
+
* - without `[hash]`: everything under `assetsDir` is served
|
|
93
|
+
* `immutable`, so an unhashed URL would pin stale code for a year;
|
|
94
|
+
* - JS not ending in `.js`: client metadata and Pages Router script
|
|
95
|
+
* tags only recognize `.js` chunks;
|
|
96
|
+
* - assets not ending in `[extname]` (or `.[ext]`): CSS without its real
|
|
97
|
+
* extension is served as `application/octet-stream` and rejected by browsers.
|
|
98
|
+
* - asset basenames not starting with `[name].` or `[name]-`: restoring CSS
|
|
99
|
+
* `url()` assets deduplicated across builds swaps the source stem at the
|
|
100
|
+
* start of the emitted basename (see css-url-assets.ts), so any other
|
|
101
|
+
* placement or delimiter drops the hash from the restored sibling.
|
|
102
|
+
* This is a guard against common mistakes, not full validation: function
|
|
103
|
+
* patterns and array-shaped output are advanced config left to the user to
|
|
104
|
+
* keep within these rules.
|
|
105
|
+
*/
|
|
106
|
+
export declare function findUnsupportedClientOutputFileNames(output: VinextBuildBundlerOptions["output"], assetsDir: string): string[];
|
|
46
107
|
export declare function createClientCodeSplittingConfig(clientManualChunks: (id: string) => string | undefined): {
|
|
47
108
|
minSize: number;
|
|
48
109
|
groups: {
|
|
@@ -126,4 +187,14 @@ export declare function assertClientOutDirIsSeparate(root: string, dirs: {
|
|
|
126
187
|
rscOutDir?: string;
|
|
127
188
|
ssrOutDir?: string;
|
|
128
189
|
}): void;
|
|
129
|
-
|
|
190
|
+
/**
|
|
191
|
+
* Whether client output options have chunk groups (`codeSplitting.groups`,
|
|
192
|
+
* `advancedChunks.groups` or `manualChunks`) other than vinext's own
|
|
193
|
+
* `ownGroups`, whether they came from the user or another plugin. vinext's
|
|
194
|
+
* client-reference route grouping is disabled in that case: a manual group can
|
|
195
|
+
* move modules out of a route group's chunk, and that combination has been
|
|
196
|
+
* seen to evaluate modules out of order and break hydration.
|
|
197
|
+
*/
|
|
198
|
+
export declare function hasUserClientChunkGroups(output: unknown, ownGroups: ReadonlySet<unknown>): boolean;
|
|
199
|
+
//#endregion
|
|
200
|
+
export {};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import path, { toSlash } from "../deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
|
|
2
|
+
import { stripViteModuleQuery } from "../utils/path.js";
|
|
3
|
+
import { WORKER_IMAGE_METADATA_PREFIX } from "../plugins/worker-image-imports.js";
|
|
4
|
+
import { createHash } from "node:crypto";
|
|
2
5
|
//#region src/build/client-build-config.ts
|
|
3
6
|
const ROUTE_OWNED_CLIENT_SHIMS = /* @__PURE__ */ new Set([
|
|
4
7
|
"app-router-tree-context",
|
|
@@ -7,6 +10,8 @@ const ROUTE_OWNED_CLIENT_SHIMS = /* @__PURE__ */ new Set([
|
|
|
7
10
|
"dynamic-preload-chunks",
|
|
8
11
|
"form",
|
|
9
12
|
"image",
|
|
13
|
+
"image-config",
|
|
14
|
+
"image-props",
|
|
10
15
|
"internal/hybrid-client-route-owner",
|
|
11
16
|
"layout-segment-context",
|
|
12
17
|
"legacy-image",
|
|
@@ -16,7 +21,32 @@ const ROUTE_OWNED_CLIENT_SHIMS = /* @__PURE__ */ new Set([
|
|
|
16
21
|
"script",
|
|
17
22
|
"web-vitals"
|
|
18
23
|
]);
|
|
19
|
-
const
|
|
24
|
+
const PAGE_OWNED_CLIENT_SHIMS = /* @__PURE__ */ new Set([
|
|
25
|
+
"dynamic",
|
|
26
|
+
"dynamic-preload-chunks",
|
|
27
|
+
"form",
|
|
28
|
+
"image",
|
|
29
|
+
"image-config",
|
|
30
|
+
"image-props",
|
|
31
|
+
"legacy-image",
|
|
32
|
+
"offline",
|
|
33
|
+
"script",
|
|
34
|
+
"web-vitals",
|
|
35
|
+
"error"
|
|
36
|
+
]);
|
|
37
|
+
const PAGES_APP_ROUTER_RUNTIME_SHIMS = /* @__PURE__ */ new Set([
|
|
38
|
+
"app-router-scroll-state",
|
|
39
|
+
"internal/app-prefetch-rsc-request",
|
|
40
|
+
"internal/navigation-untracked",
|
|
41
|
+
"internal/pages-router-accessor",
|
|
42
|
+
"navigation",
|
|
43
|
+
"navigation-context-state",
|
|
44
|
+
"navigation-errors",
|
|
45
|
+
"ppr-fallback-shell",
|
|
46
|
+
"readonly-url-search-params",
|
|
47
|
+
"unrecognized-action-error"
|
|
48
|
+
]);
|
|
49
|
+
const NEXT_CLIENT_CSS_ASSET_FILE_NAMES = "css/[hash][extname]";
|
|
20
50
|
const NEXT_CLIENT_STATIC_MEDIA_FILE_NAMES = "media/[name].[hash:8][extname]";
|
|
21
51
|
function joinAssetFileNamePattern(assetsDir, pattern) {
|
|
22
52
|
let end = assetsDir.length;
|
|
@@ -61,14 +91,23 @@ function getPackageName(id) {
|
|
|
61
91
|
return rest.split("/")[0] || null;
|
|
62
92
|
}
|
|
63
93
|
/**
|
|
94
|
+
* The App Router client build module that registers the client references
|
|
95
|
+
* whose modules are in the "vinext" chunk (see
|
|
96
|
+
* plugins/rsc-client-reference-loaders.ts). It joins that chunk, so it loads
|
|
97
|
+
* with the browser entry without adding to the entry's own chunk.
|
|
98
|
+
*/
|
|
99
|
+
const RESOLVED_EAGER_CLIENT_REFERENCES_ID = "\0virtual:vinext-client-reference-eager";
|
|
100
|
+
/**
|
|
64
101
|
* Create a manualChunks function for client builds.
|
|
65
102
|
*
|
|
66
103
|
* Splits the client bundle into:
|
|
67
104
|
* - "framework" — React, ReactDOM, and scheduler (loaded on every page)
|
|
68
105
|
* - "vinext" — shared vinext runtime shims
|
|
106
|
+
* - "vinext-app-router" — the App Router runtime, in Pages Router builds
|
|
69
107
|
*
|
|
70
|
-
* Route-owned
|
|
71
|
-
* graph-based chunking so they
|
|
108
|
+
* Route-owned (App Router) or page-owned (Pages Router) client shims and all
|
|
109
|
+
* other vendor code are left to the bundler's graph-based chunking so they
|
|
110
|
+
* load only where they're used.
|
|
72
111
|
*
|
|
73
112
|
* Why not split every npm package into its own chunk?
|
|
74
113
|
* - Per-package splitting (`vendor-X`) creates 50-200+ chunks for a
|
|
@@ -86,17 +125,19 @@ function getPackageName(id) {
|
|
|
86
125
|
* and route-specific code stays in route chunks.
|
|
87
126
|
*/
|
|
88
127
|
function createClientManualChunks(shimsDir, preserveRouteBoundaries = false) {
|
|
128
|
+
const instrumentationStatePrefix = path.join(shimsDir, "../client/instrumentation-client-state.");
|
|
89
129
|
return function clientManualChunks(id) {
|
|
130
|
+
if (id === "\0virtual:vinext-client-reference-eager") return "vinext";
|
|
90
131
|
const slashedId = toSlash(id);
|
|
91
132
|
if (slashedId.startsWith(shimsDir)) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
133
|
+
const relativeId = slashedId.slice(shimsDir.length).split("?", 1)[0] ?? "";
|
|
134
|
+
const extensionIndex = relativeId.lastIndexOf(".");
|
|
135
|
+
const shimName = extensionIndex === -1 ? relativeId : relativeId.slice(0, extensionIndex);
|
|
136
|
+
if ((preserveRouteBoundaries ? ROUTE_OWNED_CLIENT_SHIMS : PAGE_OWNED_CLIENT_SHIMS).has(shimName)) return void 0;
|
|
137
|
+
if (!preserveRouteBoundaries && PAGES_APP_ROUTER_RUNTIME_SHIMS.has(shimName)) return "vinext-app-router";
|
|
98
138
|
return "vinext";
|
|
99
139
|
}
|
|
140
|
+
if (slashedId.startsWith(instrumentationStatePrefix)) return "vinext";
|
|
100
141
|
if (id.includes("node_modules")) {
|
|
101
142
|
const pkg = getPackageName(id);
|
|
102
143
|
if (!pkg) return void 0;
|
|
@@ -110,13 +151,119 @@ function createClientManualChunks(shimsDir, preserveRouteBoundaries = false) {
|
|
|
110
151
|
}
|
|
111
152
|
};
|
|
112
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* Client JS is emitted as hash-only `<assetsDir>/chunks/[hash].js`. Rolldown
|
|
156
|
+
* names a chunk after its first module, so `[name]` would publish component
|
|
157
|
+
* and source file names in public asset URLs. Next.js doesn't put component
|
|
158
|
+
* names in production chunk URLs either: webpack names split chunks by
|
|
159
|
+
* deterministic numeric id. Users can opt back into `[name]` through their own
|
|
160
|
+
* Vite config; see createClientOutputFileNameDefaults.
|
|
161
|
+
*/
|
|
113
162
|
function createClientFileNameConfig(assetsDir) {
|
|
114
163
|
const chunksDir = `${assetsDir}/chunks`;
|
|
115
164
|
return {
|
|
116
|
-
entryFileNames: `${chunksDir}/[
|
|
117
|
-
chunkFileNames: `${chunksDir}/[
|
|
165
|
+
entryFileNames: `${chunksDir}/[hash].js`,
|
|
166
|
+
chunkFileNames: `${chunksDir}/[hash].js`
|
|
118
167
|
};
|
|
119
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Web Worker output names. Workers are hash-only like client chunks, so their
|
|
171
|
+
* URLs don't publish source file names. Vite bundles each worker separately
|
|
172
|
+
* and stores the outputs by file name, so two workers' entries or chunks with
|
|
173
|
+
* identical code would share `[hash].js` and one's source map would overwrite
|
|
174
|
+
* the other's. Each name therefore also carries an opaque id derived from the
|
|
175
|
+
* chunk's module ids (root-relative for files).
|
|
176
|
+
*/
|
|
177
|
+
function createWorkerFileNames(assetsDir, root) {
|
|
178
|
+
const workersDir = `${assetsDir}/workers`;
|
|
179
|
+
const fileName = (chunk) => {
|
|
180
|
+
const ids = chunk.facadeModuleId ? [chunk.facadeModuleId] : chunk.moduleIds ?? [];
|
|
181
|
+
const chunkId = JSON.stringify(ids.map((id) => {
|
|
182
|
+
const file = stripViteModuleQuery(id);
|
|
183
|
+
if (path.isAbsolute(file)) return ["file", toSlash(path.relative(root, file)) + id.slice(file.length)];
|
|
184
|
+
const imagePath = id.startsWith("\0vinext-worker-image-meta:") ? id.slice(WORKER_IMAGE_METADATA_PREFIX.length) : void 0;
|
|
185
|
+
if (imagePath !== void 0 && path.isAbsolute(imagePath)) return ["image-meta", toSlash(path.relative(root, imagePath))];
|
|
186
|
+
return ["id", id];
|
|
187
|
+
}));
|
|
188
|
+
const idHash = createHash("sha256").update(chunkId).digest("hex").slice(0, 8);
|
|
189
|
+
return `${workersDir}/${idHash}-[hash].js`;
|
|
190
|
+
};
|
|
191
|
+
return {
|
|
192
|
+
entryFileNames: fileName,
|
|
193
|
+
chunkFileNames: fileName
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* vinext's client output file names, limited to the ones the incoming client
|
|
198
|
+
* environment config leaves unset. Vite merges `config` hook results over the
|
|
199
|
+
* user's config, so vinext applies these from `configEnvironment` instead: by
|
|
200
|
+
* then the user's top-level `build` and `environments.client.build` are merged
|
|
201
|
+
* into the client environment, and a user-provided pattern wins.
|
|
202
|
+
*
|
|
203
|
+
* Returns null for array-shaped output, which cannot be augmented without Vite
|
|
204
|
+
* concatenating a second output entry. Array-shaped client output is advanced
|
|
205
|
+
* config vinext doesn't support: Vite also appends vinext's own client output
|
|
206
|
+
* object (code splitting) to the user's array, producing an extra bundle.
|
|
207
|
+
*/
|
|
208
|
+
function createClientOutputFileNameDefaults(output, assetsDir) {
|
|
209
|
+
if (Array.isArray(output)) return null;
|
|
210
|
+
const configured = output ?? {};
|
|
211
|
+
const { entryFileNames, chunkFileNames } = createClientFileNameConfig(assetsDir);
|
|
212
|
+
return {
|
|
213
|
+
...configured.entryFileNames === void 0 ? { entryFileNames } : {},
|
|
214
|
+
...configured.chunkFileNames === void 0 ? { chunkFileNames } : {},
|
|
215
|
+
...configured.assetFileNames === void 0 ? { assetFileNames: createClientAssetFileNames(assetsDir) } : {}
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
/** Entry, chunk and asset file names from a (non-array) bundler output config. */
|
|
219
|
+
function getOutputFileNames(output) {
|
|
220
|
+
if (!output || Array.isArray(output)) return {};
|
|
221
|
+
const { entryFileNames, chunkFileNames, assetFileNames } = output;
|
|
222
|
+
return {
|
|
223
|
+
entryFileNames,
|
|
224
|
+
chunkFileNames,
|
|
225
|
+
assetFileNames
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* User-provided client file name patterns vinext cannot serve correctly:
|
|
230
|
+
* - outside `assetsDir`: built-asset URLs, immutable caching and
|
|
231
|
+
* precompression all assume client output lives there;
|
|
232
|
+
* - without `[hash]`: everything under `assetsDir` is served
|
|
233
|
+
* `immutable`, so an unhashed URL would pin stale code for a year;
|
|
234
|
+
* - JS not ending in `.js`: client metadata and Pages Router script
|
|
235
|
+
* tags only recognize `.js` chunks;
|
|
236
|
+
* - assets not ending in `[extname]` (or `.[ext]`): CSS without its real
|
|
237
|
+
* extension is served as `application/octet-stream` and rejected by browsers.
|
|
238
|
+
* - asset basenames not starting with `[name].` or `[name]-`: restoring CSS
|
|
239
|
+
* `url()` assets deduplicated across builds swaps the source stem at the
|
|
240
|
+
* start of the emitted basename (see css-url-assets.ts), so any other
|
|
241
|
+
* placement or delimiter drops the hash from the restored sibling.
|
|
242
|
+
* This is a guard against common mistakes, not full validation: function
|
|
243
|
+
* patterns and array-shaped output are advanced config left to the user to
|
|
244
|
+
* keep within these rules.
|
|
245
|
+
*/
|
|
246
|
+
function findUnsupportedClientOutputFileNames(output, assetsDir) {
|
|
247
|
+
if (!output || Array.isArray(output)) return [];
|
|
248
|
+
const unsupported = [];
|
|
249
|
+
for (const key of [
|
|
250
|
+
"entryFileNames",
|
|
251
|
+
"chunkFileNames",
|
|
252
|
+
"assetFileNames"
|
|
253
|
+
]) {
|
|
254
|
+
const value = output[key];
|
|
255
|
+
if (typeof value !== "string") continue;
|
|
256
|
+
const problems = [
|
|
257
|
+
!value.startsWith(`${assetsDir}/`) && `outside "${assetsDir}/"`,
|
|
258
|
+
!value.includes("[hash") && "no [hash]",
|
|
259
|
+
key !== "assetFileNames" && !value.endsWith(".js") && "not \".js\"",
|
|
260
|
+
key === "assetFileNames" && !value.endsWith("[extname]") && !value.endsWith(".[ext]") && "not ending in [extname]",
|
|
261
|
+
key === "assetFileNames" && !/^\[name\][.-]/.test(value.slice(value.lastIndexOf("/") + 1)) && "basename not starting with \"[name].\" or \"[name]-\""
|
|
262
|
+
].filter(Boolean);
|
|
263
|
+
if (problems.length > 0) unsupported.push(`${key}: ${JSON.stringify(value)} (${problems.join(", ")})`);
|
|
264
|
+
}
|
|
265
|
+
return unsupported;
|
|
266
|
+
}
|
|
120
267
|
function createClientCodeSplittingConfig(clientManualChunks) {
|
|
121
268
|
return {
|
|
122
269
|
minSize: 1e4,
|
|
@@ -282,5 +429,22 @@ function assertClientOutDirIsSeparate(root, dirs) {
|
|
|
282
429
|
throw new Error(`[vinext] clientOutDir "${dirs.clientOutDir}" contains ${name} "${dir}". The client build runs last and empties its output directory, which would delete the server build. Use separate output directories.`);
|
|
283
430
|
}
|
|
284
431
|
}
|
|
432
|
+
function hasChunkGroups(output, ownGroups) {
|
|
433
|
+
if (!output || typeof output !== "object") return false;
|
|
434
|
+
const { advancedChunks, codeSplitting, manualChunks } = output;
|
|
435
|
+
if (manualChunks !== void 0) return true;
|
|
436
|
+
return [...advancedChunks?.groups ?? [], ...(codeSplitting && typeof codeSplitting === "object" ? codeSplitting.groups : void 0) ?? []].some((group) => !ownGroups.has(group));
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Whether client output options have chunk groups (`codeSplitting.groups`,
|
|
440
|
+
* `advancedChunks.groups` or `manualChunks`) other than vinext's own
|
|
441
|
+
* `ownGroups`, whether they came from the user or another plugin. vinext's
|
|
442
|
+
* client-reference route grouping is disabled in that case: a manual group can
|
|
443
|
+
* move modules out of a route group's chunk, and that combination has been
|
|
444
|
+
* seen to evaluate modules out of order and break hydration.
|
|
445
|
+
*/
|
|
446
|
+
function hasUserClientChunkGroups(output, ownGroups) {
|
|
447
|
+
return Array.isArray(output) ? output.some((entry) => hasChunkGroups(entry, ownGroups)) : hasChunkGroups(output, ownGroups);
|
|
448
|
+
}
|
|
285
449
|
//#endregion
|
|
286
|
-
export { RSC_FRAMEWORK_CHUNK_TEST, assertClientOutDirIsSeparate, createClientAssetFileNames, createClientCodeSplittingConfig,
|
|
450
|
+
export { RESOLVED_EAGER_CLIENT_REFERENCES_ID, RSC_FRAMEWORK_CHUNK_TEST, assertClientOutDirIsSeparate, createClientAssetFileNames, createClientCodeSplittingConfig, createClientManualChunks, createClientOutputFileNameDefaults, createMultiStageChunkFileNames, createMultiStageCodeSplittingConfig, createRscFrameworkChunkOutputConfig, createWorkerFileNames, findUnsupportedClientOutputFileNames, getBuildBundlerOptions, getClientTreeshakeConfig, getOutputFileNames, hasUserClientChunkGroups, isRscFrameworkModule, sanitizeRscChunkFileName, withBuildBundlerOptions };
|