vinext 0.0.55 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -15
- package/dist/build/assets-ignore.d.ts +32 -0
- package/dist/build/assets-ignore.js +48 -0
- package/dist/build/clean-output.d.ts +1 -2
- package/dist/build/clean-output.js +0 -2
- package/dist/build/client-build-config.d.ts +42 -3
- package/dist/build/client-build-config.js +86 -4
- package/dist/build/css-url-assets.d.ts +29 -0
- package/dist/build/css-url-assets.js +211 -0
- package/dist/build/google-fonts/build-url.d.ts +1 -2
- package/dist/build/google-fonts/build-url.js +0 -2
- package/dist/build/google-fonts/fallback-metrics-data.js +0 -2
- package/dist/build/google-fonts/fallback-metrics.d.ts +1 -2
- package/dist/build/google-fonts/fallback-metrics.js +0 -2
- package/dist/build/google-fonts/font-data.js +0 -2
- package/dist/build/google-fonts/font-metadata.d.ts +1 -2
- package/dist/build/google-fonts/font-metadata.js +0 -2
- package/dist/build/google-fonts/get-axes.d.ts +1 -2
- package/dist/build/google-fonts/get-axes.js +0 -2
- package/dist/build/google-fonts/sort-variants.d.ts +1 -2
- package/dist/build/google-fonts/sort-variants.js +0 -2
- package/dist/build/google-fonts/validate.d.ts +1 -2
- package/dist/build/google-fonts/validate.js +0 -2
- package/dist/build/inline-css.d.ts +1 -2
- package/dist/build/inline-css.js +0 -2
- package/dist/build/layout-classification-types.d.ts +1 -2
- package/dist/build/layout-classification.d.ts +2 -3
- package/dist/build/layout-classification.js +1 -3
- package/dist/build/next-client-runtime-manifests.d.ts +14 -0
- package/dist/build/next-client-runtime-manifests.js +39 -0
- package/dist/build/nitro-route-rules.d.ts +1 -2
- package/dist/build/nitro-route-rules.js +0 -2
- package/dist/build/precompress.d.ts +1 -2
- package/dist/build/precompress.js +0 -2
- package/dist/build/prerender.d.ts +2 -3
- package/dist/build/prerender.js +14 -2
- package/dist/build/report.d.ts +1 -2
- package/dist/build/report.js +0 -2
- package/dist/build/route-classification-injector.d.ts +1 -2
- package/dist/build/route-classification-injector.js +4 -6
- package/dist/build/route-classification-manifest.d.ts +5 -6
- package/dist/build/route-classification-manifest.js +5 -7
- package/dist/build/run-prerender.d.ts +1 -2
- package/dist/build/run-prerender.js +15 -7
- package/dist/build/server-manifest.d.ts +1 -2
- package/dist/build/server-manifest.js +0 -2
- package/dist/build/ssr-manifest.d.ts +1 -2
- package/dist/build/ssr-manifest.js +2 -4
- package/dist/build/standalone.d.ts +1 -2
- package/dist/build/standalone.js +0 -2
- package/dist/build/static-export.d.ts +2 -3
- package/dist/build/static-export.js +0 -2
- package/dist/cache/cache-adapters-virtual.d.ts +50 -0
- package/dist/cache/cache-adapters-virtual.js +45 -0
- package/dist/check.d.ts +33 -2
- package/dist/check.js +306 -24
- package/dist/cli-args.d.ts +1 -2
- package/dist/cli-args.js +0 -2
- package/dist/cli.js +9 -13
- package/dist/client/instrumentation-client-inject.d.ts +1 -2
- package/dist/client/instrumentation-client-inject.js +0 -2
- package/dist/client/instrumentation-client-state.d.ts +1 -2
- package/dist/client/instrumentation-client-state.js +0 -2
- package/dist/client/instrumentation-client.d.ts +1 -2
- package/dist/client/instrumentation-client.js +0 -2
- package/dist/client/navigation-runtime.d.ts +9 -2
- package/dist/client/navigation-runtime.js +1 -3
- package/dist/client/pages-router-link-navigation.d.ts +1 -2
- package/dist/client/pages-router-link-navigation.js +0 -2
- package/dist/client/validate-module-path.d.ts +1 -2
- package/dist/client/validate-module-path.js +0 -2
- package/dist/client/vinext-next-data.d.ts +3 -3
- package/dist/client/vinext-next-data.js +0 -2
- package/dist/client/window-next.d.ts +1 -2
- package/dist/client/window-next.js +0 -2
- package/dist/cloudflare/index.d.ts +1 -1
- package/dist/cloudflare/index.js +1 -1
- package/dist/cloudflare/src/cache/cdn-adapter.runtime.js +97 -0
- package/dist/cloudflare/{kv-cache-handler.d.ts → src/cache/kv-data-adapter.runtime.d.ts} +25 -6
- package/dist/cloudflare/{kv-cache-handler.js → src/cache/kv-data-adapter.runtime.js} +36 -28
- package/dist/cloudflare/src/utils/cache-control-metadata.js +20 -0
- package/dist/cloudflare/tpr.d.ts +2 -3
- package/dist/cloudflare/tpr.js +8 -8
- package/dist/config/config-matchers.d.ts +20 -2
- package/dist/config/config-matchers.js +35 -3
- package/dist/config/dotenv.d.ts +1 -2
- package/dist/config/dotenv.js +0 -2
- package/dist/config/next-config.d.ts +32 -5
- package/dist/config/next-config.js +53 -6
- package/dist/config/tsconfig-paths.d.ts +1 -2
- package/dist/config/tsconfig-paths.js +3 -7
- package/dist/deploy.d.ts +48 -3
- package/dist/deploy.js +180 -415
- package/dist/entries/app-browser-entry.d.ts +1 -2
- package/dist/entries/app-browser-entry.js +0 -2
- package/dist/entries/app-rsc-entry.d.ts +12 -6
- package/dist/entries/app-rsc-entry.js +101 -62
- package/dist/entries/app-rsc-manifest.d.ts +1 -2
- package/dist/entries/app-rsc-manifest.js +40 -9
- package/dist/entries/app-ssr-entry.d.ts +1 -2
- package/dist/entries/app-ssr-entry.js +0 -2
- package/dist/entries/pages-client-entry.d.ts +3 -3
- package/dist/entries/pages-client-entry.js +16 -5
- package/dist/entries/pages-entry-helpers.d.ts +2 -11
- package/dist/entries/pages-entry-helpers.js +1 -20
- package/dist/entries/pages-server-entry.d.ts +2 -3
- package/dist/entries/pages-server-entry.js +98 -703
- package/dist/entries/runtime-entry-module.d.ts +1 -2
- package/dist/entries/runtime-entry-module.js +0 -2
- package/dist/index.d.ts +22 -2
- package/dist/index.js +376 -316
- package/dist/init.d.ts +1 -2
- package/dist/init.js +1 -3
- package/dist/plugins/ast-utils.d.ts +20 -0
- package/dist/plugins/ast-utils.js +78 -0
- package/dist/plugins/async-hooks-stub.d.ts +1 -2
- package/dist/plugins/async-hooks-stub.js +0 -2
- package/dist/plugins/client-reference-dedup.d.ts +1 -2
- package/dist/plugins/client-reference-dedup.js +4 -8
- package/dist/plugins/css-data-url.d.ts +1 -2
- package/dist/plugins/css-data-url.js +0 -2
- package/dist/plugins/fonts.d.ts +13 -3
- package/dist/plugins/fonts.js +19 -13
- package/dist/plugins/import-meta-url.d.ts +2 -2
- package/dist/plugins/import-meta-url.js +187 -33
- package/dist/plugins/instrumentation-client.d.ts +1 -2
- package/dist/plugins/instrumentation-client.js +0 -2
- package/dist/plugins/middleware-server-only.d.ts +1 -2
- package/dist/plugins/middleware-server-only.js +0 -2
- package/dist/plugins/og-assets.d.ts +32 -8
- package/dist/plugins/og-assets.js +126 -34
- package/dist/plugins/optimize-imports.d.ts +1 -2
- package/dist/plugins/optimize-imports.js +9 -17
- package/dist/plugins/postcss.d.ts +1 -2
- package/dist/plugins/postcss.js +18 -16
- package/dist/plugins/remove-console.d.ts +1 -2
- package/dist/plugins/remove-console.js +0 -2
- package/dist/plugins/require-context.d.ts +6 -0
- package/dist/plugins/require-context.js +184 -0
- package/dist/plugins/rsc-client-reference-loaders.d.ts +1 -2
- package/dist/plugins/rsc-client-reference-loaders.js +0 -2
- package/dist/plugins/rsc-client-shim-excludes.d.ts +1 -2
- package/dist/plugins/rsc-client-shim-excludes.js +0 -2
- package/dist/plugins/sass.d.ts +1 -2
- package/dist/plugins/sass.js +0 -2
- package/dist/plugins/server-externals-manifest.d.ts +1 -2
- package/dist/plugins/server-externals-manifest.js +0 -2
- package/dist/plugins/strip-server-exports.d.ts +1 -2
- package/dist/plugins/strip-server-exports.js +0 -2
- package/dist/routing/app-route-graph.d.ts +14 -10
- package/dist/routing/app-route-graph.js +146 -35
- package/dist/routing/app-router.d.ts +1 -2
- package/dist/routing/app-router.js +0 -2
- package/dist/routing/file-matcher.d.ts +6 -2
- package/dist/routing/file-matcher.js +15 -7
- package/dist/routing/pages-router.d.ts +1 -2
- package/dist/routing/pages-router.js +0 -2
- package/dist/routing/route-matching.d.ts +1 -2
- package/dist/routing/route-matching.js +0 -2
- package/dist/routing/route-pattern.d.ts +2 -2
- package/dist/routing/route-pattern.js +16 -3
- package/dist/routing/route-trie.d.ts +1 -2
- package/dist/routing/route-trie.js +0 -2
- package/dist/routing/route-validation.d.ts +1 -2
- package/dist/routing/route-validation.js +0 -2
- package/dist/routing/utils.d.ts +44 -2
- package/dist/routing/utils.js +62 -3
- package/dist/server/api-handler.d.ts +1 -2
- package/dist/server/api-handler.js +4 -2
- package/dist/server/app-bfcache-id.d.ts +5 -0
- package/dist/server/app-bfcache-id.js +5 -0
- package/dist/server/app-browser-action-result.d.ts +1 -2
- package/dist/server/app-browser-action-result.js +0 -2
- package/dist/server/app-browser-client-reuse-manifest.d.ts +12 -0
- package/dist/server/app-browser-client-reuse-manifest.js +101 -0
- package/dist/server/app-browser-entry.js +244 -88
- package/dist/server/app-browser-error.d.ts +1 -2
- package/dist/server/app-browser-error.js +0 -2
- package/dist/server/app-browser-hydration.d.ts +1 -2
- package/dist/server/app-browser-hydration.js +0 -2
- package/dist/server/app-browser-interception-context.d.ts +2 -2
- package/dist/server/app-browser-interception-context.js +15 -4
- package/dist/server/app-browser-mpa-navigation.d.ts +2 -2
- package/dist/server/app-browser-mpa-navigation.js +9 -3
- package/dist/server/app-browser-navigation-controller.d.ts +15 -4
- package/dist/server/app-browser-navigation-controller.js +80 -4
- package/dist/server/app-browser-popstate.d.ts +12 -4
- package/dist/server/app-browser-popstate.js +19 -6
- package/dist/server/app-browser-rsc-redirect.d.ts +1 -2
- package/dist/server/app-browser-rsc-redirect.js +0 -2
- package/dist/server/app-browser-state.d.ts +31 -4
- package/dist/server/app-browser-state.js +196 -10
- package/dist/server/app-browser-stream.d.ts +1 -2
- package/dist/server/app-browser-stream.js +0 -2
- package/dist/server/app-browser-visible-commit.d.ts +2 -3
- package/dist/server/app-browser-visible-commit.js +30 -21
- package/dist/server/app-client-reference-preloader.d.ts +1 -2
- package/dist/server/app-client-reference-preloader.js +0 -2
- package/dist/server/app-elements-wire.d.ts +14 -8
- package/dist/server/app-elements-wire.js +45 -24
- package/dist/server/app-elements.d.ts +2 -3
- package/dist/server/app-elements.js +2 -4
- package/dist/server/app-fallback-renderer.d.ts +5 -5
- package/dist/server/app-fallback-renderer.js +4 -3
- package/dist/server/app-history-state.d.ts +62 -2
- package/dist/server/app-history-state.js +176 -10
- package/dist/server/app-hook-warning-suppression.d.ts +1 -2
- package/dist/server/app-hook-warning-suppression.js +0 -2
- package/dist/server/app-inline-css-client.d.ts +1 -2
- package/dist/server/app-inline-css-client.js +0 -2
- package/dist/server/app-interception-context-header.d.ts +1 -2
- package/dist/server/app-interception-context-header.js +0 -2
- package/dist/server/app-layout-param-observation.d.ts +15 -2
- package/dist/server/app-layout-param-observation.js +46 -8
- package/dist/server/app-middleware.d.ts +1 -2
- package/dist/server/app-middleware.js +0 -2
- package/dist/server/app-mounted-slots-header.d.ts +1 -2
- package/dist/server/app-mounted-slots-header.js +0 -2
- package/dist/server/app-optimistic-routing.d.ts +1 -2
- package/dist/server/app-optimistic-routing.js +0 -2
- package/dist/server/app-page-boundary-render.d.ts +4 -3
- package/dist/server/app-page-boundary-render.js +59 -28
- package/dist/server/app-page-boundary.d.ts +11 -2
- package/dist/server/app-page-boundary.js +13 -4
- package/dist/server/app-page-cache.d.ts +3 -3
- package/dist/server/app-page-cache.js +36 -11
- package/dist/server/app-page-dispatch.d.ts +25 -5
- package/dist/server/app-page-dispatch.js +122 -25
- package/dist/server/app-page-element-builder.d.ts +4 -2
- package/dist/server/app-page-element-builder.js +31 -21
- package/dist/server/app-page-execution.d.ts +8 -3
- package/dist/server/app-page-execution.js +55 -24
- package/dist/server/app-page-head.d.ts +1 -2
- package/dist/server/app-page-head.js +6 -6
- package/dist/server/app-page-method.d.ts +1 -2
- package/dist/server/app-page-method.js +0 -2
- package/dist/server/app-page-params.d.ts +1 -2
- package/dist/server/app-page-params.js +0 -2
- package/dist/server/app-page-probe.d.ts +79 -2
- package/dist/server/app-page-probe.js +89 -9
- package/dist/server/app-page-render-identity.d.ts +1 -2
- package/dist/server/app-page-render-identity.js +0 -2
- package/dist/server/app-page-render-observation.d.ts +1 -2
- package/dist/server/app-page-render-observation.js +0 -2
- package/dist/server/app-page-render.d.ts +15 -3
- package/dist/server/app-page-render.js +171 -12
- package/dist/server/app-page-request.d.ts +12 -9
- package/dist/server/app-page-request.js +12 -11
- package/dist/server/app-page-response.d.ts +4 -4
- package/dist/server/app-page-response.js +6 -4
- package/dist/server/app-page-route-wiring.d.ts +14 -3
- package/dist/server/app-page-route-wiring.js +65 -12
- package/dist/server/app-page-search-params-observation.d.ts +10 -0
- package/dist/server/app-page-search-params-observation.js +20 -0
- package/dist/server/app-page-segment-state.d.ts +1 -2
- package/dist/server/app-page-segment-state.js +1 -8
- package/dist/server/app-page-stream.d.ts +54 -9
- package/dist/server/app-page-stream.js +61 -10
- package/dist/server/app-pages-bridge.d.ts +41 -0
- package/dist/server/app-pages-bridge.js +54 -0
- package/dist/server/app-post-middleware-context.d.ts +1 -2
- package/dist/server/app-post-middleware-context.js +0 -2
- package/dist/server/app-ppr-fallback-shell.d.ts +21 -0
- package/dist/server/app-ppr-fallback-shell.js +82 -0
- package/dist/server/app-prerender-endpoints.d.ts +1 -2
- package/dist/server/app-prerender-endpoints.js +0 -2
- package/dist/server/app-prerender-static-params.d.ts +15 -2
- package/dist/server/app-prerender-static-params.js +44 -13
- package/dist/server/app-render-dependency.d.ts +3 -2
- package/dist/server/app-render-dependency.js +9 -3
- package/dist/server/app-request-context.d.ts +1 -2
- package/dist/server/app-request-context.js +0 -2
- package/dist/server/app-route-handler-cache.d.ts +2 -2
- package/dist/server/app-route-handler-cache.js +1 -2
- package/dist/server/app-route-handler-dispatch.d.ts +2 -2
- package/dist/server/app-route-handler-dispatch.js +2 -2
- package/dist/server/app-route-handler-execution.d.ts +2 -2
- package/dist/server/app-route-handler-execution.js +3 -4
- package/dist/server/app-route-handler-policy.d.ts +1 -2
- package/dist/server/app-route-handler-policy.js +0 -2
- package/dist/server/app-route-handler-response.d.ts +2 -3
- package/dist/server/app-route-handler-response.js +7 -6
- package/dist/server/app-route-handler-runtime.d.ts +2 -2
- package/dist/server/app-route-handler-runtime.js +3 -4
- package/dist/server/app-route-module-loader.d.ts +43 -0
- package/dist/server/app-route-module-loader.js +32 -0
- package/dist/server/app-router-entry.d.ts +1 -2
- package/dist/server/app-router-entry.js +2 -2
- package/dist/server/app-rsc-cache-busting.d.ts +10 -2
- package/dist/server/app-rsc-cache-busting.js +13 -4
- package/dist/server/app-rsc-embedded-chunks.d.ts +1 -2
- package/dist/server/app-rsc-embedded-chunks.js +0 -2
- package/dist/server/app-rsc-error-handler.d.ts +1 -2
- package/dist/server/app-rsc-error-handler.js +0 -2
- package/dist/server/app-rsc-errors.d.ts +1 -2
- package/dist/server/app-rsc-errors.js +0 -2
- package/dist/server/app-rsc-handler.d.ts +17 -2
- package/dist/server/app-rsc-handler.js +24 -15
- package/dist/server/app-rsc-render-mode.d.ts +1 -2
- package/dist/server/app-rsc-render-mode.js +0 -2
- package/dist/server/app-rsc-request-normalization.d.ts +4 -5
- package/dist/server/app-rsc-request-normalization.js +2 -4
- package/dist/server/app-rsc-response-finalizer.d.ts +1 -2
- package/dist/server/app-rsc-response-finalizer.js +2 -2
- package/dist/server/app-rsc-route-matching.d.ts +20 -2
- package/dist/server/app-rsc-route-matching.js +29 -6
- package/dist/server/app-segment-config.d.ts +4 -2
- package/dist/server/app-segment-config.js +8 -2
- package/dist/server/app-server-action-execution.d.ts +18 -3
- package/dist/server/app-server-action-execution.js +75 -18
- package/dist/server/app-ssr-entry.d.ts +11 -4
- package/dist/server/app-ssr-entry.js +47 -15
- package/dist/server/app-ssr-error-meta.d.ts +1 -2
- package/dist/server/app-ssr-error-meta.js +0 -2
- package/dist/server/app-ssr-stream.d.ts +1 -2
- package/dist/server/app-ssr-stream.js +31 -3
- package/dist/server/app-static-generation.d.ts +1 -2
- package/dist/server/app-static-generation.js +0 -2
- package/dist/server/app-visited-response-cache.d.ts +23 -0
- package/dist/server/app-visited-response-cache.js +19 -0
- package/dist/server/artifact-compatibility.d.ts +1 -2
- package/dist/server/artifact-compatibility.js +2 -6
- package/dist/server/cache-control.d.ts +15 -2
- package/dist/server/cache-control.js +21 -3
- package/dist/server/cache-headers.d.ts +1 -2
- package/dist/server/cache-headers.js +0 -2
- package/dist/server/cache-proof.d.ts +1 -2
- package/dist/server/cache-proof.js +0 -2
- package/dist/server/client-reuse-manifest.d.ts +3 -3
- package/dist/server/client-reuse-manifest.js +6 -10
- package/dist/server/client-trace-metadata.d.ts +1 -2
- package/dist/server/client-trace-metadata.js +0 -2
- package/dist/server/cookie-utils.d.ts +1 -2
- package/dist/server/cookie-utils.js +0 -2
- package/dist/server/csp.d.ts +1 -2
- package/dist/server/csp.js +0 -2
- package/dist/server/default-global-error-module.d.ts +1 -2
- package/dist/server/default-global-error-module.js +0 -2
- package/dist/server/default-not-found-module.d.ts +1 -2
- package/dist/server/default-not-found-module.js +0 -2
- package/dist/server/dev-error-overlay-store.d.ts +20 -4
- package/dist/server/dev-error-overlay-store.js +23 -4
- package/dist/server/dev-error-overlay.d.ts +39 -3
- package/dist/server/dev-error-overlay.js +952 -164
- package/dist/server/dev-initial-server-error.d.ts +9 -0
- package/dist/server/dev-initial-server-error.js +26 -0
- package/dist/server/dev-lockfile.d.ts +1 -2
- package/dist/server/dev-lockfile.js +0 -2
- package/dist/server/dev-module-runner.d.ts +1 -2
- package/dist/server/dev-module-runner.js +0 -2
- package/dist/server/dev-origin-check.d.ts +1 -2
- package/dist/server/dev-origin-check.js +0 -2
- package/dist/server/dev-route-files.d.ts +1 -2
- package/dist/server/dev-route-files.js +0 -2
- package/dist/server/dev-server.d.ts +3 -4
- package/dist/server/dev-server.js +129 -49
- package/dist/server/dev-stack-sourcemap-endpoint.d.ts +4 -0
- package/dist/server/dev-stack-sourcemap-endpoint.js +4 -0
- package/dist/server/dev-stack-sourcemap.d.ts +43 -0
- package/dist/server/dev-stack-sourcemap.js +443 -0
- package/dist/server/document-initial-head.d.ts +1 -2
- package/dist/server/document-initial-head.js +0 -2
- package/dist/server/edge-api-runtime.d.ts +1 -2
- package/dist/server/edge-api-runtime.js +0 -2
- package/dist/server/file-based-metadata.d.ts +1 -2
- package/dist/server/file-based-metadata.js +0 -2
- package/dist/server/headers.d.ts +3 -2
- package/dist/server/headers.js +3 -3
- package/dist/server/html.d.ts +1 -2
- package/dist/server/html.js +0 -2
- package/dist/server/http-error-responses.d.ts +1 -2
- package/dist/server/http-error-responses.js +0 -2
- package/dist/server/image-optimization.d.ts +1 -2
- package/dist/server/image-optimization.js +0 -2
- package/dist/server/implicit-tags.d.ts +1 -2
- package/dist/server/implicit-tags.js +0 -2
- package/dist/server/instrumentation-runtime.d.ts +1 -2
- package/dist/server/instrumentation-runtime.js +0 -2
- package/dist/server/instrumentation.d.ts +1 -2
- package/dist/server/instrumentation.js +0 -2
- package/dist/server/isr-cache.d.ts +46 -3
- package/dist/server/isr-cache.js +93 -24
- package/dist/server/metadata-route-build-data.d.ts +1 -2
- package/dist/server/metadata-route-build-data.js +0 -2
- package/dist/server/metadata-route-response.d.ts +1 -2
- package/dist/server/metadata-route-response.js +0 -2
- package/dist/server/metadata-routes.d.ts +1 -2
- package/dist/server/metadata-routes.js +0 -2
- package/dist/server/middleware-matcher.d.ts +1 -2
- package/dist/server/middleware-matcher.js +0 -2
- package/dist/server/middleware-request-headers.d.ts +1 -2
- package/dist/server/middleware-request-headers.js +0 -2
- package/dist/server/middleware-response-headers.d.ts +1 -2
- package/dist/server/middleware-response-headers.js +0 -2
- package/dist/server/middleware-runtime.d.ts +1 -2
- package/dist/server/middleware-runtime.js +14 -5
- package/dist/server/middleware.d.ts +2 -3
- package/dist/server/middleware.js +0 -2
- package/dist/server/navigation-planner.d.ts +16 -2
- package/dist/server/navigation-planner.js +6 -6
- package/dist/server/navigation-trace.d.ts +1 -2
- package/dist/server/navigation-trace.js +0 -2
- package/dist/server/next-error-digest.d.ts +1 -2
- package/dist/server/next-error-digest.js +0 -2
- package/dist/server/normalize-path.d.ts +1 -2
- package/dist/server/normalize-path.js +0 -2
- package/dist/server/pages-api-route.d.ts +1 -2
- package/dist/server/pages-api-route.js +1 -3
- package/dist/server/pages-asset-tags.d.ts +66 -0
- package/dist/server/pages-asset-tags.js +116 -0
- package/dist/server/pages-body-parser-config.d.ts +1 -2
- package/dist/server/pages-body-parser-config.js +0 -2
- package/dist/server/pages-data-route.d.ts +39 -2
- package/dist/server/pages-data-route.js +46 -3
- package/dist/server/pages-default-404.d.ts +1 -2
- package/dist/server/pages-default-404.js +0 -2
- package/dist/server/pages-document-initial-props.d.ts +1 -2
- package/dist/server/pages-document-initial-props.js +0 -2
- package/dist/server/pages-get-initial-props.d.ts +17 -0
- package/dist/server/pages-get-initial-props.js +50 -0
- package/dist/server/pages-i18n.d.ts +1 -2
- package/dist/server/pages-i18n.js +0 -2
- package/dist/server/pages-media-type.d.ts +1 -2
- package/dist/server/pages-media-type.js +1 -2
- package/dist/server/pages-node-compat.d.ts +11 -2
- package/dist/server/pages-node-compat.js +38 -3
- package/dist/server/pages-page-data.d.ts +17 -10
- package/dist/server/pages-page-data.js +79 -35
- package/dist/server/pages-page-handler.d.ts +97 -0
- package/dist/server/pages-page-handler.js +348 -0
- package/dist/server/pages-page-method.d.ts +1 -2
- package/dist/server/pages-page-method.js +0 -2
- package/dist/server/pages-page-response.d.ts +11 -3
- package/dist/server/pages-page-response.js +16 -5
- package/dist/server/pages-readiness.d.ts +36 -0
- package/dist/server/pages-readiness.js +21 -0
- package/dist/server/pages-request-pipeline.d.ts +99 -0
- package/dist/server/pages-request-pipeline.js +209 -0
- package/dist/server/pages-revalidate.d.ts +15 -0
- package/dist/server/pages-revalidate.js +19 -0
- package/dist/server/pages-serializable-props.d.ts +1 -2
- package/dist/server/pages-serializable-props.js +0 -2
- package/dist/server/pregenerated-concrete-paths.d.ts +32 -0
- package/dist/server/pregenerated-concrete-paths.js +78 -0
- package/dist/server/prerender-route-params.d.ts +13 -3
- package/dist/server/prerender-route-params.js +30 -11
- package/dist/server/prerender-work-unit-setup.d.ts +1 -2
- package/dist/server/prerender-work-unit-setup.js +0 -2
- package/dist/server/prod-server.d.ts +8 -6
- package/dist/server/prod-server.js +101 -219
- package/dist/server/proxy-trust.d.ts +1 -2
- package/dist/server/proxy-trust.js +0 -2
- package/dist/server/request-log.d.ts +1 -2
- package/dist/server/request-log.js +0 -2
- package/dist/server/request-pipeline.d.ts +14 -2
- package/dist/server/request-pipeline.js +42 -3
- package/dist/server/rsc-stream-hints.d.ts +1 -2
- package/dist/server/rsc-stream-hints.js +0 -2
- package/dist/server/seed-cache.d.ts +6 -2
- package/dist/server/seed-cache.js +10 -8
- package/dist/server/server-action-not-found.d.ts +1 -2
- package/dist/server/server-action-not-found.js +0 -2
- package/dist/server/server-globals.d.ts +1 -2
- package/dist/server/server-globals.js +0 -2
- package/dist/server/skip-cache-proof.d.ts +1 -2
- package/dist/server/skip-cache-proof.js +0 -2
- package/dist/server/socket-error-backstop.d.ts +19 -2
- package/dist/server/socket-error-backstop.js +77 -6
- package/dist/server/static-file-cache.d.ts +1 -2
- package/dist/server/static-file-cache.js +0 -2
- package/dist/server/static-layout-client-reuse-proof.d.ts +1 -2
- package/dist/server/static-layout-client-reuse-proof.js +0 -2
- package/dist/server/streaming-metadata.d.ts +1 -2
- package/dist/server/streaming-metadata.js +0 -2
- package/dist/server/worker-utils.d.ts +1 -2
- package/dist/server/worker-utils.js +3 -6
- package/dist/shims/amp.d.ts +1 -2
- package/dist/shims/amp.js +0 -2
- package/dist/shims/app-router-scroll-state.d.ts +1 -2
- package/dist/shims/app-router-scroll-state.js +0 -2
- package/dist/shims/app-router-scroll.d.ts +3 -5
- package/dist/shims/app-router-scroll.js +22 -6
- package/dist/shims/app.d.ts +1 -2
- package/dist/shims/app.js +0 -2
- package/dist/shims/before-interactive-context.d.ts +1 -2
- package/dist/shims/before-interactive-context.js +0 -2
- package/dist/shims/cache-for-request.d.ts +1 -2
- package/dist/shims/cache-for-request.js +0 -2
- package/dist/shims/cache-runtime.d.ts +20 -5
- package/dist/shims/cache-runtime.js +66 -31
- package/dist/shims/cache.d.ts +48 -7
- package/dist/shims/cache.js +79 -20
- package/dist/shims/cdn-cache.d.ts +125 -0
- package/dist/shims/cdn-cache.js +100 -0
- package/dist/shims/client-hook-error.d.ts +1 -2
- package/dist/shims/client-hook-error.js +0 -2
- package/dist/shims/client-locale.d.ts +1 -2
- package/dist/shims/client-locale.js +1 -3
- package/dist/shims/compat-router.d.ts +1 -2
- package/dist/shims/compat-router.js +0 -2
- package/dist/shims/config.d.ts +1 -2
- package/dist/shims/config.js +0 -2
- package/dist/shims/constants.d.ts +1 -2
- package/dist/shims/constants.js +0 -2
- package/dist/shims/default-global-error.d.ts +3 -4
- package/dist/shims/default-global-error.js +0 -2
- package/dist/shims/default-not-found.d.ts +1 -2
- package/dist/shims/default-not-found.js +0 -2
- package/dist/shims/document.d.ts +5 -7
- package/dist/shims/document.js +0 -2
- package/dist/shims/dynamic.d.ts +1 -2
- package/dist/shims/dynamic.js +0 -2
- package/dist/shims/error-boundary.d.ts +32 -18
- package/dist/shims/error-boundary.js +43 -3
- package/dist/shims/error.d.ts +1 -2
- package/dist/shims/error.js +0 -2
- package/dist/shims/fetch-cache.d.ts +14 -2
- package/dist/shims/fetch-cache.js +20 -5
- package/dist/shims/font-google-base.d.ts +1 -2
- package/dist/shims/font-google-base.js +1 -13
- package/dist/shims/font-local.d.ts +1 -2
- package/dist/shims/font-local.js +1 -15
- package/dist/shims/font-utils.d.ts +7 -2
- package/dist/shims/font-utils.js +13 -3
- package/dist/shims/form.d.ts +12 -5
- package/dist/shims/form.js +98 -21
- package/dist/shims/hash-scroll.d.ts +2 -2
- package/dist/shims/hash-scroll.js +3 -3
- package/dist/shims/head-state.d.ts +1 -2
- package/dist/shims/head-state.js +0 -2
- package/dist/shims/head.d.ts +1 -2
- package/dist/shims/head.js +0 -2
- package/dist/shims/headers.d.ts +9 -2
- package/dist/shims/headers.js +13 -3
- package/dist/shims/i18n-context.d.ts +1 -2
- package/dist/shims/i18n-context.js +0 -2
- package/dist/shims/i18n-state.d.ts +1 -2
- package/dist/shims/i18n-state.js +0 -2
- package/dist/shims/image-config.d.ts +1 -2
- package/dist/shims/image-config.js +0 -2
- package/dist/shims/image.d.ts +1 -2
- package/dist/shims/image.js +1 -3
- package/dist/shims/internal/als-registry.d.ts +1 -2
- package/dist/shims/internal/als-registry.js +0 -2
- package/dist/shims/internal/api-utils.d.ts +1 -2
- package/dist/shims/internal/app-route-detection.d.ts +1 -2
- package/dist/shims/internal/app-route-detection.js +0 -2
- package/dist/shims/internal/app-router-context.d.ts +1 -2
- package/dist/shims/internal/app-router-context.js +0 -2
- package/dist/shims/internal/cookie-serialize.d.ts +1 -2
- package/dist/shims/internal/cookie-serialize.js +0 -2
- package/dist/shims/internal/link-status-registry.d.ts +43 -0
- package/dist/shims/internal/link-status-registry.js +42 -0
- package/dist/shims/internal/make-hanging-promise.d.ts +1 -2
- package/dist/shims/internal/make-hanging-promise.js +0 -2
- package/dist/shims/internal/pages-data-fetch-dedup.d.ts +1 -2
- package/dist/shims/internal/pages-data-fetch-dedup.js +0 -2
- package/dist/shims/internal/pages-data-target.d.ts +1 -2
- package/dist/shims/internal/pages-data-target.js +0 -2
- package/dist/shims/internal/pages-data-url.d.ts +1 -2
- package/dist/shims/internal/pages-data-url.js +0 -2
- package/dist/shims/internal/parse-cookie-header.d.ts +1 -2
- package/dist/shims/internal/parse-cookie-header.js +0 -2
- package/dist/shims/internal/route-pattern-for-warning.d.ts +27 -0
- package/dist/shims/internal/route-pattern-for-warning.js +40 -0
- package/dist/shims/internal/router-context.d.ts +2 -4
- package/dist/shims/internal/router-context.js +0 -2
- package/dist/shims/internal/utils.d.ts +2 -2
- package/dist/shims/internal/utils.js +0 -2
- package/dist/shims/internal/work-unit-async-storage.d.ts +1 -2
- package/dist/shims/internal/work-unit-async-storage.js +0 -2
- package/dist/shims/layout-segment-context.d.ts +2 -4
- package/dist/shims/layout-segment-context.js +0 -2
- package/dist/shims/legacy-image.d.ts +1 -2
- package/dist/shims/legacy-image.js +0 -2
- package/dist/shims/link-prefetch.d.ts +1 -2
- package/dist/shims/link-prefetch.js +0 -2
- package/dist/shims/link.d.ts +2 -2
- package/dist/shims/link.js +40 -20
- package/dist/shims/metadata.d.ts +4 -5
- package/dist/shims/metadata.js +1 -3
- package/dist/shims/navigation-state.d.ts +1 -2
- package/dist/shims/navigation-state.js +0 -2
- package/dist/shims/navigation.d.ts +25 -9
- package/dist/shims/navigation.js +251 -46
- package/dist/shims/navigation.react-server.d.ts +1 -2
- package/dist/shims/navigation.react-server.js +0 -2
- package/dist/shims/offline.d.ts +1 -2
- package/dist/shims/offline.js +0 -2
- package/dist/shims/og.d.ts +1 -2
- package/dist/shims/og.js +2 -4
- package/dist/shims/pages-router-runtime.d.ts +7 -2
- package/dist/shims/pages-router-runtime.js +11 -3
- package/dist/shims/ppr-fallback-shell.d.ts +29 -0
- package/dist/shims/ppr-fallback-shell.js +149 -0
- package/dist/shims/readonly-url-search-params.d.ts +1 -2
- package/dist/shims/readonly-url-search-params.js +0 -2
- package/dist/shims/request-context.d.ts +9 -5
- package/dist/shims/request-context.js +0 -2
- package/dist/shims/request-state-types.d.ts +1 -1
- package/dist/shims/root-params.d.ts +1 -2
- package/dist/shims/root-params.js +0 -2
- package/dist/shims/router-state.d.ts +2 -2
- package/dist/shims/router-state.js +2 -2
- package/dist/shims/router.d.ts +6 -4
- package/dist/shims/router.js +262 -40
- package/dist/shims/script-nonce-context.d.ts +1 -2
- package/dist/shims/script-nonce-context.js +0 -2
- package/dist/shims/script.d.ts +1 -2
- package/dist/shims/script.js +0 -2
- package/dist/shims/server.d.ts +1 -2
- package/dist/shims/server.js +0 -2
- package/dist/shims/slot.d.ts +11 -4
- package/dist/shims/slot.js +121 -9
- package/dist/shims/thenable-params.d.ts +2 -2
- package/dist/shims/thenable-params.js +107 -12
- package/dist/shims/unified-request-context.d.ts +1 -2
- package/dist/shims/unified-request-context.js +0 -2
- package/dist/shims/unrecognized-action-error.d.ts +1 -2
- package/dist/shims/unrecognized-action-error.js +0 -2
- package/dist/shims/url-safety.d.ts +1 -2
- package/dist/shims/url-safety.js +0 -2
- package/dist/shims/url-utils.d.ts +1 -2
- package/dist/shims/url-utils.js +0 -2
- package/dist/shims/use-merged-ref.d.ts +1 -2
- package/dist/shims/use-merged-ref.js +0 -2
- package/dist/shims/web-vitals.d.ts +1 -2
- package/dist/shims/web-vitals.js +0 -2
- package/dist/typegen.d.ts +1 -2
- package/dist/typegen.js +2 -9
- package/dist/utils/asset-prefix.d.ts +1 -2
- package/dist/utils/asset-prefix.js +0 -2
- package/dist/utils/base-path.d.ts +1 -2
- package/dist/utils/base-path.js +0 -2
- package/dist/utils/cache-control-metadata.d.ts +1 -4
- package/dist/utils/cache-control-metadata.js +1 -3
- package/dist/utils/client-build-manifest.d.ts +8 -2
- package/dist/utils/client-build-manifest.js +30 -7
- package/dist/utils/client-entry-manifest.d.ts +11 -0
- package/dist/utils/client-entry-manifest.js +29 -0
- package/dist/utils/compare.d.ts +4 -0
- package/dist/utils/compare.js +8 -0
- package/dist/utils/dev-error-recovery-event.d.ts +4 -0
- package/dist/utils/dev-error-recovery-event.js +4 -0
- package/dist/utils/domain-locale.d.ts +1 -2
- package/dist/utils/domain-locale.js +2 -4
- package/dist/utils/encode-cache-tag.d.ts +1 -2
- package/dist/utils/encode-cache-tag.js +0 -2
- package/dist/utils/error-cause.d.ts +1 -2
- package/dist/utils/error-cause.js +0 -2
- package/dist/utils/hash.d.ts +1 -2
- package/dist/utils/hash.js +0 -2
- package/dist/utils/html-limited-bots.d.ts +1 -2
- package/dist/utils/html-limited-bots.js +0 -2
- package/dist/utils/lazy-chunks.d.ts +1 -2
- package/dist/utils/lazy-chunks.js +0 -2
- package/dist/utils/manifest-paths.d.ts +8 -3
- package/dist/utils/manifest-paths.js +15 -3
- package/dist/utils/mdx-scan.d.ts +1 -2
- package/dist/utils/mdx-scan.js +0 -2
- package/dist/utils/navigation-signal.d.ts +1 -2
- package/dist/utils/navigation-signal.js +0 -2
- package/dist/utils/number.d.ts +4 -0
- package/dist/utils/number.js +6 -0
- package/dist/utils/path.d.ts +4 -2
- package/dist/utils/path.js +5 -3
- package/dist/utils/prerender-output-paths.d.ts +1 -2
- package/dist/utils/prerender-output-paths.js +0 -2
- package/dist/utils/project.d.ts +1 -2
- package/dist/utils/project.js +0 -2
- package/dist/utils/promise.d.ts +4 -0
- package/dist/utils/promise.js +6 -0
- package/dist/utils/public-routes.d.ts +1 -2
- package/dist/utils/public-routes.js +0 -2
- package/dist/utils/query.d.ts +1 -2
- package/dist/utils/query.js +0 -2
- package/dist/utils/record.d.ts +1 -2
- package/dist/utils/record.js +0 -2
- package/dist/utils/regex.d.ts +4 -0
- package/dist/utils/regex.js +6 -0
- package/dist/utils/safe-json-file.d.ts +1 -2
- package/dist/utils/safe-json-file.js +0 -2
- package/dist/utils/sorted-array.d.ts +1 -2
- package/dist/utils/sorted-array.js +0 -2
- package/dist/utils/text-stream.d.ts +1 -2
- package/dist/utils/text-stream.js +0 -2
- package/dist/utils/vinext-root.d.ts +1 -2
- package/dist/utils/vinext-root.js +0 -2
- package/dist/utils/vite-version.d.ts +1 -2
- package/dist/utils/vite-version.js +0 -2
- package/package.json +23 -6
- package/dist/build/clean-output.js.map +0 -1
- package/dist/build/client-build-config.js.map +0 -1
- package/dist/build/google-fonts/build-url.js.map +0 -1
- package/dist/build/google-fonts/fallback-metrics-data.js.map +0 -1
- package/dist/build/google-fonts/fallback-metrics.js.map +0 -1
- package/dist/build/google-fonts/font-data.js.map +0 -1
- package/dist/build/google-fonts/font-metadata.js.map +0 -1
- package/dist/build/google-fonts/get-axes.js.map +0 -1
- package/dist/build/google-fonts/sort-variants.js.map +0 -1
- package/dist/build/google-fonts/validate.js.map +0 -1
- package/dist/build/inline-css.js.map +0 -1
- package/dist/build/layout-classification.js.map +0 -1
- package/dist/build/nitro-route-rules.js.map +0 -1
- package/dist/build/precompress.js.map +0 -1
- package/dist/build/prerender.js.map +0 -1
- package/dist/build/report.js.map +0 -1
- package/dist/build/route-classification-injector.js.map +0 -1
- package/dist/build/route-classification-manifest.js.map +0 -1
- package/dist/build/run-prerender.js.map +0 -1
- package/dist/build/server-manifest.js.map +0 -1
- package/dist/build/ssr-manifest.js.map +0 -1
- package/dist/build/standalone.js.map +0 -1
- package/dist/build/static-export.js.map +0 -1
- package/dist/check.js.map +0 -1
- package/dist/cli-args.js.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/client/instrumentation-client-inject.js.map +0 -1
- package/dist/client/instrumentation-client-state.js.map +0 -1
- package/dist/client/instrumentation-client.js.map +0 -1
- package/dist/client/navigation-runtime.js.map +0 -1
- package/dist/client/pages-router-link-navigation.js.map +0 -1
- package/dist/client/validate-module-path.js.map +0 -1
- package/dist/client/vinext-next-data.js.map +0 -1
- package/dist/client/window-next.js.map +0 -1
- package/dist/cloudflare/kv-cache-handler.js.map +0 -1
- package/dist/cloudflare/tpr.js.map +0 -1
- package/dist/config/config-matchers.js.map +0 -1
- package/dist/config/dotenv.js.map +0 -1
- package/dist/config/next-config.js.map +0 -1
- package/dist/config/tsconfig-paths.js.map +0 -1
- package/dist/deploy.js.map +0 -1
- package/dist/entries/app-browser-entry.js.map +0 -1
- package/dist/entries/app-rsc-entry.js.map +0 -1
- package/dist/entries/app-rsc-manifest.js.map +0 -1
- package/dist/entries/app-ssr-entry.js.map +0 -1
- package/dist/entries/pages-client-entry.js.map +0 -1
- package/dist/entries/pages-entry-helpers.js.map +0 -1
- package/dist/entries/pages-server-entry.js.map +0 -1
- package/dist/entries/runtime-entry-module.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/init.js.map +0 -1
- package/dist/plugins/async-hooks-stub.js.map +0 -1
- package/dist/plugins/client-reference-dedup.js.map +0 -1
- package/dist/plugins/css-data-url.js.map +0 -1
- package/dist/plugins/fonts.js.map +0 -1
- package/dist/plugins/import-meta-url.js.map +0 -1
- package/dist/plugins/instrumentation-client.js.map +0 -1
- package/dist/plugins/middleware-server-only.js.map +0 -1
- package/dist/plugins/og-assets.js.map +0 -1
- package/dist/plugins/optimize-imports.js.map +0 -1
- package/dist/plugins/postcss.js.map +0 -1
- package/dist/plugins/remove-console.js.map +0 -1
- package/dist/plugins/rsc-client-reference-loaders.js.map +0 -1
- package/dist/plugins/rsc-client-shim-excludes.js.map +0 -1
- package/dist/plugins/sass.js.map +0 -1
- package/dist/plugins/server-externals-manifest.js.map +0 -1
- package/dist/plugins/strip-server-exports.js.map +0 -1
- package/dist/routing/app-route-graph.js.map +0 -1
- package/dist/routing/app-router.js.map +0 -1
- package/dist/routing/file-matcher.js.map +0 -1
- package/dist/routing/pages-router.js.map +0 -1
- package/dist/routing/route-matching.js.map +0 -1
- package/dist/routing/route-pattern.js.map +0 -1
- package/dist/routing/route-trie.js.map +0 -1
- package/dist/routing/route-validation.js.map +0 -1
- package/dist/routing/utils.js.map +0 -1
- package/dist/server/api-handler.js.map +0 -1
- package/dist/server/app-browser-action-result.js.map +0 -1
- package/dist/server/app-browser-entry.js.map +0 -1
- package/dist/server/app-browser-error.js.map +0 -1
- package/dist/server/app-browser-hydration.js.map +0 -1
- package/dist/server/app-browser-interception-context.js.map +0 -1
- package/dist/server/app-browser-mpa-navigation.js.map +0 -1
- package/dist/server/app-browser-navigation-controller.js.map +0 -1
- package/dist/server/app-browser-popstate.js.map +0 -1
- package/dist/server/app-browser-rsc-redirect.js.map +0 -1
- package/dist/server/app-browser-state.js.map +0 -1
- package/dist/server/app-browser-stream.js.map +0 -1
- package/dist/server/app-browser-visible-commit.js.map +0 -1
- package/dist/server/app-client-reference-preloader.js.map +0 -1
- package/dist/server/app-elements-wire.js.map +0 -1
- package/dist/server/app-elements.js.map +0 -1
- package/dist/server/app-fallback-renderer.js.map +0 -1
- package/dist/server/app-history-state.js.map +0 -1
- package/dist/server/app-hook-warning-suppression.js.map +0 -1
- package/dist/server/app-inline-css-client.js.map +0 -1
- package/dist/server/app-interception-context-header.js.map +0 -1
- package/dist/server/app-layout-param-observation.js.map +0 -1
- package/dist/server/app-middleware.js.map +0 -1
- package/dist/server/app-mounted-slots-header.js.map +0 -1
- package/dist/server/app-optimistic-routing.js.map +0 -1
- package/dist/server/app-page-boundary-render.js.map +0 -1
- package/dist/server/app-page-boundary.js.map +0 -1
- package/dist/server/app-page-cache.js.map +0 -1
- package/dist/server/app-page-dispatch.js.map +0 -1
- package/dist/server/app-page-element-builder.js.map +0 -1
- package/dist/server/app-page-execution.js.map +0 -1
- package/dist/server/app-page-head.js.map +0 -1
- package/dist/server/app-page-method.js.map +0 -1
- package/dist/server/app-page-params.js.map +0 -1
- package/dist/server/app-page-probe.js.map +0 -1
- package/dist/server/app-page-render-identity.js.map +0 -1
- package/dist/server/app-page-render-observation.js.map +0 -1
- package/dist/server/app-page-render.js.map +0 -1
- package/dist/server/app-page-request.js.map +0 -1
- package/dist/server/app-page-response.js.map +0 -1
- package/dist/server/app-page-route-wiring.js.map +0 -1
- package/dist/server/app-page-segment-state.js.map +0 -1
- package/dist/server/app-page-stream.js.map +0 -1
- package/dist/server/app-post-middleware-context.js.map +0 -1
- package/dist/server/app-prerender-endpoints.js.map +0 -1
- package/dist/server/app-prerender-static-params.js.map +0 -1
- package/dist/server/app-render-dependency.js.map +0 -1
- package/dist/server/app-request-context.js.map +0 -1
- package/dist/server/app-route-handler-cache.js.map +0 -1
- package/dist/server/app-route-handler-dispatch.js.map +0 -1
- package/dist/server/app-route-handler-execution.js.map +0 -1
- package/dist/server/app-route-handler-policy.js.map +0 -1
- package/dist/server/app-route-handler-response.js.map +0 -1
- package/dist/server/app-route-handler-runtime.js.map +0 -1
- package/dist/server/app-router-entry.js.map +0 -1
- package/dist/server/app-rsc-cache-busting.js.map +0 -1
- package/dist/server/app-rsc-embedded-chunks.js.map +0 -1
- package/dist/server/app-rsc-error-handler.js.map +0 -1
- package/dist/server/app-rsc-errors.js.map +0 -1
- package/dist/server/app-rsc-handler.js.map +0 -1
- package/dist/server/app-rsc-render-mode.js.map +0 -1
- package/dist/server/app-rsc-request-normalization.js.map +0 -1
- package/dist/server/app-rsc-response-finalizer.js.map +0 -1
- package/dist/server/app-rsc-route-matching.js.map +0 -1
- package/dist/server/app-segment-config.js.map +0 -1
- package/dist/server/app-server-action-execution.js.map +0 -1
- package/dist/server/app-ssr-entry.js.map +0 -1
- package/dist/server/app-ssr-error-meta.js.map +0 -1
- package/dist/server/app-ssr-stream.js.map +0 -1
- package/dist/server/app-static-generation.js.map +0 -1
- package/dist/server/artifact-compatibility.js.map +0 -1
- package/dist/server/cache-control.js.map +0 -1
- package/dist/server/cache-headers.js.map +0 -1
- package/dist/server/cache-proof.js.map +0 -1
- package/dist/server/client-reuse-manifest.js.map +0 -1
- package/dist/server/client-trace-metadata.js.map +0 -1
- package/dist/server/cookie-utils.js.map +0 -1
- package/dist/server/csp.js.map +0 -1
- package/dist/server/default-global-error-module.js.map +0 -1
- package/dist/server/default-not-found-module.js.map +0 -1
- package/dist/server/dev-error-overlay-store.js.map +0 -1
- package/dist/server/dev-error-overlay.js.map +0 -1
- package/dist/server/dev-lockfile.js.map +0 -1
- package/dist/server/dev-module-runner.js.map +0 -1
- package/dist/server/dev-origin-check.js.map +0 -1
- package/dist/server/dev-route-files.js.map +0 -1
- package/dist/server/dev-server.js.map +0 -1
- package/dist/server/document-initial-head.js.map +0 -1
- package/dist/server/edge-api-runtime.js.map +0 -1
- package/dist/server/file-based-metadata.js.map +0 -1
- package/dist/server/headers.js.map +0 -1
- package/dist/server/html.js.map +0 -1
- package/dist/server/http-error-responses.js.map +0 -1
- package/dist/server/image-optimization.js.map +0 -1
- package/dist/server/implicit-tags.js.map +0 -1
- package/dist/server/instrumentation-runtime.js.map +0 -1
- package/dist/server/instrumentation.js.map +0 -1
- package/dist/server/isr-cache.js.map +0 -1
- package/dist/server/metadata-route-build-data.js.map +0 -1
- package/dist/server/metadata-route-response.js.map +0 -1
- package/dist/server/metadata-routes.js.map +0 -1
- package/dist/server/middleware-matcher.js.map +0 -1
- package/dist/server/middleware-request-headers.js.map +0 -1
- package/dist/server/middleware-response-headers.js.map +0 -1
- package/dist/server/middleware-runtime.js.map +0 -1
- package/dist/server/middleware.js.map +0 -1
- package/dist/server/navigation-planner.js.map +0 -1
- package/dist/server/navigation-trace.js.map +0 -1
- package/dist/server/next-error-digest.js.map +0 -1
- package/dist/server/normalize-path.js.map +0 -1
- package/dist/server/pages-api-route.js.map +0 -1
- package/dist/server/pages-body-parser-config.js.map +0 -1
- package/dist/server/pages-data-route.js.map +0 -1
- package/dist/server/pages-default-404.js.map +0 -1
- package/dist/server/pages-document-initial-props.js.map +0 -1
- package/dist/server/pages-i18n.js.map +0 -1
- package/dist/server/pages-media-type.js.map +0 -1
- package/dist/server/pages-node-compat.js.map +0 -1
- package/dist/server/pages-page-data.js.map +0 -1
- package/dist/server/pages-page-method.js.map +0 -1
- package/dist/server/pages-page-response.js.map +0 -1
- package/dist/server/pages-serializable-props.js.map +0 -1
- package/dist/server/prerender-route-params.js.map +0 -1
- package/dist/server/prerender-work-unit-setup.js.map +0 -1
- package/dist/server/prod-server.js.map +0 -1
- package/dist/server/proxy-trust.js.map +0 -1
- package/dist/server/request-log.js.map +0 -1
- package/dist/server/request-pipeline.js.map +0 -1
- package/dist/server/rsc-stream-hints.js.map +0 -1
- package/dist/server/seed-cache.js.map +0 -1
- package/dist/server/server-action-not-found.js.map +0 -1
- package/dist/server/server-globals.js.map +0 -1
- package/dist/server/skip-cache-proof.js.map +0 -1
- package/dist/server/socket-error-backstop.js.map +0 -1
- package/dist/server/static-file-cache.js.map +0 -1
- package/dist/server/static-layout-client-reuse-proof.js.map +0 -1
- package/dist/server/streaming-metadata.js.map +0 -1
- package/dist/server/worker-utils.js.map +0 -1
- package/dist/shims/amp.js.map +0 -1
- package/dist/shims/app-router-scroll-state.js.map +0 -1
- package/dist/shims/app-router-scroll.js.map +0 -1
- package/dist/shims/app.js.map +0 -1
- package/dist/shims/before-interactive-context.js.map +0 -1
- package/dist/shims/cache-for-request.js.map +0 -1
- package/dist/shims/cache-runtime.js.map +0 -1
- package/dist/shims/cache.js.map +0 -1
- package/dist/shims/client-hook-error.js.map +0 -1
- package/dist/shims/client-locale.js.map +0 -1
- package/dist/shims/compat-router.js.map +0 -1
- package/dist/shims/config.js.map +0 -1
- package/dist/shims/constants.js.map +0 -1
- package/dist/shims/default-global-error.js.map +0 -1
- package/dist/shims/default-not-found.js.map +0 -1
- package/dist/shims/document.js.map +0 -1
- package/dist/shims/dynamic.js.map +0 -1
- package/dist/shims/error-boundary.js.map +0 -1
- package/dist/shims/error.js.map +0 -1
- package/dist/shims/fetch-cache.js.map +0 -1
- package/dist/shims/font-google-base.js.map +0 -1
- package/dist/shims/font-local.js.map +0 -1
- package/dist/shims/font-utils.js.map +0 -1
- package/dist/shims/form.js.map +0 -1
- package/dist/shims/hash-scroll.js.map +0 -1
- package/dist/shims/head-state.js.map +0 -1
- package/dist/shims/head.js.map +0 -1
- package/dist/shims/headers.js.map +0 -1
- package/dist/shims/i18n-context.js.map +0 -1
- package/dist/shims/i18n-state.js.map +0 -1
- package/dist/shims/image-config.js.map +0 -1
- package/dist/shims/image.js.map +0 -1
- package/dist/shims/internal/als-registry.js.map +0 -1
- package/dist/shims/internal/app-route-detection.js.map +0 -1
- package/dist/shims/internal/app-router-context.js.map +0 -1
- package/dist/shims/internal/cookie-serialize.js.map +0 -1
- package/dist/shims/internal/make-hanging-promise.js.map +0 -1
- package/dist/shims/internal/pages-data-fetch-dedup.js.map +0 -1
- package/dist/shims/internal/pages-data-target.js.map +0 -1
- package/dist/shims/internal/pages-data-url.js.map +0 -1
- package/dist/shims/internal/parse-cookie-header.js.map +0 -1
- package/dist/shims/internal/router-context.js.map +0 -1
- package/dist/shims/internal/utils.js.map +0 -1
- package/dist/shims/internal/work-unit-async-storage.js.map +0 -1
- package/dist/shims/layout-segment-context.js.map +0 -1
- package/dist/shims/legacy-image.js.map +0 -1
- package/dist/shims/link-prefetch.js.map +0 -1
- package/dist/shims/link.js.map +0 -1
- package/dist/shims/metadata.js.map +0 -1
- package/dist/shims/navigation-state.js.map +0 -1
- package/dist/shims/navigation.js.map +0 -1
- package/dist/shims/navigation.react-server.js.map +0 -1
- package/dist/shims/offline.js.map +0 -1
- package/dist/shims/og.js.map +0 -1
- package/dist/shims/pages-router-runtime.js.map +0 -1
- package/dist/shims/readonly-url-search-params.js.map +0 -1
- package/dist/shims/request-context.js.map +0 -1
- package/dist/shims/root-params.js.map +0 -1
- package/dist/shims/router-state.js.map +0 -1
- package/dist/shims/router.js.map +0 -1
- package/dist/shims/script-nonce-context.js.map +0 -1
- package/dist/shims/script.js.map +0 -1
- package/dist/shims/server.js.map +0 -1
- package/dist/shims/slot.js.map +0 -1
- package/dist/shims/thenable-params.js.map +0 -1
- package/dist/shims/unified-request-context.js.map +0 -1
- package/dist/shims/unrecognized-action-error.js.map +0 -1
- package/dist/shims/url-safety.js.map +0 -1
- package/dist/shims/url-utils.js.map +0 -1
- package/dist/shims/use-merged-ref.js.map +0 -1
- package/dist/shims/web-vitals.js.map +0 -1
- package/dist/typegen.js.map +0 -1
- package/dist/utils/asset-prefix.js.map +0 -1
- package/dist/utils/base-path.js.map +0 -1
- package/dist/utils/cache-control-metadata.js.map +0 -1
- package/dist/utils/client-build-manifest.js.map +0 -1
- package/dist/utils/domain-locale.js.map +0 -1
- package/dist/utils/encode-cache-tag.js.map +0 -1
- package/dist/utils/error-cause.js.map +0 -1
- package/dist/utils/hash.js.map +0 -1
- package/dist/utils/html-limited-bots.js.map +0 -1
- package/dist/utils/lazy-chunks.js.map +0 -1
- package/dist/utils/manifest-paths.js.map +0 -1
- package/dist/utils/mdx-scan.js.map +0 -1
- package/dist/utils/navigation-signal.js.map +0 -1
- package/dist/utils/path.js.map +0 -1
- package/dist/utils/prerender-output-paths.js.map +0 -1
- package/dist/utils/project.js.map +0 -1
- package/dist/utils/public-routes.js.map +0 -1
- package/dist/utils/query.js.map +0 -1
- package/dist/utils/record.js.map +0 -1
- package/dist/utils/safe-json-file.js.map +0 -1
- package/dist/utils/sorted-array.js.map +0 -1
- package/dist/utils/text-stream.js.map +0 -1
- package/dist/utils/vinext-root.js.map +0 -1
- package/dist/utils/vite-version.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import { detectPackageManager } from "./utils/project.js";
|
|
2
2
|
import { normalizePathnameForRouteMatchStrict } from "./routing/utils.js";
|
|
3
|
-
import { buildViteResolveExtensions, createValidFileMatcher } from "./routing/file-matcher.js";
|
|
4
|
-
import { hasBasePath } from "./utils/base-path.js";
|
|
3
|
+
import { buildViteResolveExtensions, createValidFileMatcher, findFileWithExts } from "./routing/file-matcher.js";
|
|
5
4
|
import { apiRouter, invalidateRouteCache, matchRoute, pagesRouter } from "./routing/pages-router.js";
|
|
5
|
+
import { normalizePathSeparators } from "./utils/path.js";
|
|
6
6
|
import { INTERNAL_HEADERS, VINEXT_INTERNAL_HEADERS, VINEXT_MW_CTX_HEADER, VINEXT_TIMING_HEADER } from "./server/headers.js";
|
|
7
|
-
import { buildRequestHeadersFromMiddlewareResponse } from "./server/middleware-request-headers.js";
|
|
8
7
|
import { normalizePath as normalizePath$1 } from "./server/normalize-path.js";
|
|
9
|
-
import {
|
|
8
|
+
import { proxyExternalRequest } from "./config/config-matchers.js";
|
|
10
9
|
import { filterInternalHeaders, isOpenRedirectShaped, normalizeTrailingSlash } from "./server/request-pipeline.js";
|
|
11
10
|
import { findMiddlewareFile, runMiddleware } from "./server/middleware.js";
|
|
12
11
|
import { generateServerEntry } from "./entries/pages-server-entry.js";
|
|
13
12
|
import { generateClientEntry } from "./entries/pages-client-entry.js";
|
|
14
13
|
import { appRouteGraph, appRouter, invalidateAppRouteCache } from "./routing/app-router.js";
|
|
15
14
|
import { findInstrumentationClientFile, findInstrumentationFile, runInstrumentation } from "./server/instrumentation.js";
|
|
16
|
-
import {
|
|
15
|
+
import { isUnknownRecord } from "./utils/record.js";
|
|
17
16
|
import { logRequest, now } from "./server/request-log.js";
|
|
18
|
-
import { normalizeDefaultLocalePathname, stripI18nLocaleForApiRoute } from "./server/pages-i18n.js";
|
|
19
17
|
import { createSSRHandler } from "./server/dev-server.js";
|
|
20
18
|
import { handleApiRoute } from "./server/api-handler.js";
|
|
21
19
|
import { isImageOptimizationPath } from "./server/image-optimization.js";
|
|
@@ -26,6 +24,7 @@ import { createDirectRunner } from "./server/dev-module-runner.js";
|
|
|
26
24
|
import { validateDevRequest } from "./server/dev-origin-check.js";
|
|
27
25
|
import { generateRscEntry } from "./entries/app-rsc-entry.js";
|
|
28
26
|
import { generateSsrEntry } from "./entries/app-ssr-entry.js";
|
|
27
|
+
import { VIRTUAL_CACHE_ADAPTERS, generateCacheAdaptersModule } from "./cache/cache-adapters-virtual.js";
|
|
29
28
|
import { generateBrowserEntry, isLinkPrefetchRoute, toLinkPrefetchRoute } from "./entries/app-browser-entry.js";
|
|
30
29
|
import { collectRouteClassificationManifest } from "./build/route-classification-manifest.js";
|
|
31
30
|
import { planRouteClassificationInjection } from "./build/route-classification-injector.js";
|
|
@@ -33,10 +32,14 @@ import { PHASE_DEVELOPMENT_SERVER, PHASE_PRODUCTION_BUILD } from "./shims/consta
|
|
|
33
32
|
import { ASSET_PREFIX_URL_DIR, resolveAssetUrlPrefix, resolveAssetsDir } from "./utils/asset-prefix.js";
|
|
34
33
|
import { RESOLVED_VIRTUAL_GOOGLE_FONTS, VIRTUAL_GOOGLE_FONTS, createGoogleFontsPlugin, createLocalFontsPlugin, generateGoogleFontsVirtualModule, parseStaticObjectLiteral } from "./plugins/fonts.js";
|
|
35
34
|
import { getViteMajorVersion } from "./utils/vite-version.js";
|
|
36
|
-
import { findNextConfigPath, loadNextConfig, resolveNextConfig, resolveNextConfigInput } from "./config/next-config.js";
|
|
35
|
+
import { createRscCompatibilityId, findNextConfigPath, loadNextConfig, resolveNextConfig, resolveNextConfigInput } from "./config/next-config.js";
|
|
37
36
|
import { isNextDataPathname, parseNextDataPathname } from "./server/pages-data-route.js";
|
|
38
37
|
import { precompressAssets } from "./build/precompress.js";
|
|
38
|
+
import { ensureAssetsIgnore } from "./build/assets-ignore.js";
|
|
39
|
+
import { emitNextClientRuntimeManifests } from "./build/next-client-runtime-manifests.js";
|
|
39
40
|
import { collectInlineCssManifest, injectInlineCssManifestGlobal } from "./build/inline-css.js";
|
|
41
|
+
import { installDevStackSourcemapMiddleware } from "./server/dev-stack-sourcemap.js";
|
|
42
|
+
import { runPagesRequest } from "./server/pages-request-pipeline.js";
|
|
40
43
|
import { manifestFilesWithBase } from "./utils/manifest-paths.js";
|
|
41
44
|
import { asyncHooksStubPlugin } from "./plugins/async-hooks-stub.js";
|
|
42
45
|
import { clientReferenceDedupPlugin } from "./plugins/client-reference-dedup.js";
|
|
@@ -46,20 +49,23 @@ import { createInstrumentationClientTransformPlugin } from "./plugins/instrument
|
|
|
46
49
|
import { INSTRUMENTATION_CLIENT_EMPTY_MODULE, generateInstrumentationClientInjectModule } from "./client/instrumentation-client-inject.js";
|
|
47
50
|
import { createMiddlewareServerOnlyPlugin } from "./plugins/middleware-server-only.js";
|
|
48
51
|
import { createOptimizeImportsPlugin } from "./plugins/optimize-imports.js";
|
|
49
|
-
import {
|
|
52
|
+
import { createOgAssetsPlugin, createOgInlineFetchAssetsPlugin } from "./plugins/og-assets.js";
|
|
50
53
|
import { generateRouteTypes } from "./typegen.js";
|
|
51
54
|
import { SSR_EXTERNAL_REACT_ENTRIES, VINEXT_OPTIMIZE_DEPS_EXCLUDE, mergeOptimizeDepsExclude } from "./plugins/rsc-client-shim-excludes.js";
|
|
52
55
|
import { createServerExternalsManifestPlugin } from "./plugins/server-externals-manifest.js";
|
|
53
56
|
import { computeLazyChunks } from "./utils/lazy-chunks.js";
|
|
54
|
-
import { findClientEntryFile, readClientBuildManifest } from "./utils/client-build-manifest.js";
|
|
57
|
+
import { findClientEntryFile, findPagesClientEntryFile, readClientBuildManifest } from "./utils/client-build-manifest.js";
|
|
58
|
+
import { VINEXT_CLIENT_ENTRY_MANIFEST, findClientEntryFileFromVinextManifest, findPagesClientEntryFileFromVinextManifest, readClientEntryManifest } from "./utils/client-entry-manifest.js";
|
|
55
59
|
import { formatMissingCloudflarePluginError, hasWranglerConfig } from "./deploy.js";
|
|
56
60
|
import { resolvePostcssStringPlugins } from "./plugins/postcss.js";
|
|
57
61
|
import { buildSassPreprocessorOptions } from "./plugins/sass.js";
|
|
58
|
-
import { createClientCodeSplittingConfig, createClientManualChunks, createClientOutputConfig, getBuildBundlerOptions, getClientTreeshakeConfigForVite, withBuildBundlerOptions } from "./build/client-build-config.js";
|
|
62
|
+
import { createClientAssetFileNames, createClientCodeSplittingConfig, createClientManualChunks, createClientOutputConfig, createRscFrameworkChunkOutputConfig, getBuildBundlerOptions, getClientTreeshakeConfigForVite, withBuildBundlerOptions } from "./build/client-build-config.js";
|
|
63
|
+
import { markCssUrlAssetReferences, restoreDedupedCssAssetReferences } from "./build/css-url-assets.js";
|
|
59
64
|
import { augmentSsrManifestFromBundle, relativeWithinRoot, tryRealpathSync } from "./build/ssr-manifest.js";
|
|
60
65
|
import { stripServerExports } from "./plugins/strip-server-exports.js";
|
|
61
66
|
import { removeConsoleCalls } from "./plugins/remove-console.js";
|
|
62
67
|
import { createImportMetaUrlPlugin } from "./plugins/import-meta-url.js";
|
|
68
|
+
import { createRequireContextPlugin } from "./plugins/require-context.js";
|
|
63
69
|
import { hasMdxFiles } from "./utils/mdx-scan.js";
|
|
64
70
|
import { scanPublicFileRoutes } from "./utils/public-routes.js";
|
|
65
71
|
import { staticExportApp, staticExportPages } from "./build/static-export.js";
|
|
@@ -74,9 +80,13 @@ import MagicString from "magic-string";
|
|
|
74
80
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
75
81
|
//#region src/index.ts
|
|
76
82
|
installSocketErrorBackstop();
|
|
77
|
-
function
|
|
78
|
-
|
|
79
|
-
return
|
|
83
|
+
function stripViteModuleQuery(id) {
|
|
84
|
+
const queryIndex = id.search(/[?#]/);
|
|
85
|
+
return queryIndex === -1 ? id : id.slice(0, queryIndex);
|
|
86
|
+
}
|
|
87
|
+
function isInsideDirectory(dir, filePath) {
|
|
88
|
+
const relativePath = path.relative(dir, filePath);
|
|
89
|
+
return relativePath !== "" && !relativePath.startsWith("..") && !path.isAbsolute(relativePath);
|
|
80
90
|
}
|
|
81
91
|
function hasModuleLevelUseServerDirective(body) {
|
|
82
92
|
for (const node of body) {
|
|
@@ -154,9 +164,6 @@ function isVinextOgShimImporter(importer) {
|
|
|
154
164
|
function toRelativeFileEntry(root, absPath) {
|
|
155
165
|
return path.relative(root, absPath).split(path.sep).join("/");
|
|
156
166
|
}
|
|
157
|
-
function isRecord(value) {
|
|
158
|
-
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
159
|
-
}
|
|
160
167
|
const TSCONFIG_FILES = ["tsconfig.json", "jsconfig.json"];
|
|
161
168
|
function resolveTsconfigPathCandidate(candidate) {
|
|
162
169
|
const candidates = candidate.endsWith(".json") ? [candidate] : [
|
|
@@ -230,8 +237,8 @@ function loadTsconfigPathAliases(configPath, projectRoot, seen = /* @__PURE__ */
|
|
|
230
237
|
const extendedPath = resolveTsconfigExtends(normalizedPath, parsed.extends);
|
|
231
238
|
if (extendedPath) aliases = loadTsconfigPathAliases(extendedPath, projectRoot, seen);
|
|
232
239
|
}
|
|
233
|
-
const compilerOptions =
|
|
234
|
-
const pathsConfig = compilerOptions &&
|
|
240
|
+
const compilerOptions = isUnknownRecord(parsed.compilerOptions) ? parsed.compilerOptions : null;
|
|
241
|
+
const pathsConfig = compilerOptions && isUnknownRecord(compilerOptions.paths) ? compilerOptions.paths : null;
|
|
235
242
|
if (!pathsConfig) return aliases;
|
|
236
243
|
const baseUrl = compilerOptions && typeof compilerOptions.baseUrl === "string" ? compilerOptions.baseUrl : ".";
|
|
237
244
|
const resolvedBaseUrl = path.resolve(path.dirname(normalizedPath), baseUrl);
|
|
@@ -275,16 +282,18 @@ function resolveTsconfigAliases(projectRoot) {
|
|
|
275
282
|
return aliases;
|
|
276
283
|
}
|
|
277
284
|
const VIRTUAL_SERVER_ENTRY = "virtual:vinext-server-entry";
|
|
278
|
-
const RESOLVED_SERVER_ENTRY = "\
|
|
285
|
+
const RESOLVED_SERVER_ENTRY = "\0virtual:vinext-server-entry";
|
|
279
286
|
const VIRTUAL_CLIENT_ENTRY = "virtual:vinext-client-entry";
|
|
280
|
-
const RESOLVED_CLIENT_ENTRY = "\
|
|
287
|
+
const RESOLVED_CLIENT_ENTRY = "\0virtual:vinext-client-entry";
|
|
281
288
|
const VIRTUAL_RSC_ENTRY = "virtual:vinext-rsc-entry";
|
|
282
|
-
const RESOLVED_RSC_ENTRY = "\
|
|
289
|
+
const RESOLVED_RSC_ENTRY = "\0virtual:vinext-rsc-entry";
|
|
283
290
|
const VIRTUAL_APP_SSR_ENTRY = "virtual:vinext-app-ssr-entry";
|
|
284
|
-
const RESOLVED_APP_SSR_ENTRY = "\
|
|
291
|
+
const RESOLVED_APP_SSR_ENTRY = "\0virtual:vinext-app-ssr-entry";
|
|
285
292
|
const VIRTUAL_APP_BROWSER_ENTRY = "virtual:vinext-app-browser-entry";
|
|
286
|
-
const RESOLVED_APP_BROWSER_ENTRY = "\
|
|
293
|
+
const RESOLVED_APP_BROWSER_ENTRY = "\0virtual:vinext-app-browser-entry";
|
|
287
294
|
const RESOLVED_ROOT_PARAMS = "\0virtual:vinext-root-params";
|
|
295
|
+
/** Virtual module that registers config-driven cache adapters (see VinextOptions.cache). */
|
|
296
|
+
const RESOLVED_CACHE_ADAPTERS = "\0" + VIRTUAL_CACHE_ADAPTERS;
|
|
288
297
|
/** Virtual module for composed instrumentation-client bootstrap. */
|
|
289
298
|
const VIRTUAL_INSTRUMENTATION_CLIENT = "private-next-instrumentation-client";
|
|
290
299
|
const RESOLVED_INSTRUMENTATION_CLIENT = `\0${VIRTUAL_INSTRUMENTATION_CLIENT}.mjs`;
|
|
@@ -297,6 +306,11 @@ const _fontGoogleShimPath = resolveShimModulePath(_shimsDir, "font-google");
|
|
|
297
306
|
function isValidExportIdentifier(name) {
|
|
298
307
|
return /^[$A-Z_a-z][$\w]*$/.test(name);
|
|
299
308
|
}
|
|
309
|
+
function isVirtualEntryFacade(id, virtualId) {
|
|
310
|
+
if (!id) return false;
|
|
311
|
+
const cleanId = id.startsWith("\0") ? id.slice(1) : id;
|
|
312
|
+
return cleanId === virtualId || cleanId.endsWith("/" + virtualId) || cleanId.endsWith("\\" + virtualId);
|
|
313
|
+
}
|
|
300
314
|
/**
|
|
301
315
|
* Returns true when `code` starts with a React `"use client"` or `"use server"`
|
|
302
316
|
* directive (after stripping leading comments, hashbang, and whitespace).
|
|
@@ -369,10 +383,12 @@ const _reactServerShims = new Map([
|
|
|
369
383
|
["next/dist/client/components/navigation", "navigation"]
|
|
370
384
|
]);
|
|
371
385
|
const clientManualChunks = createClientManualChunks(_shimsDir);
|
|
372
|
-
const clientOutputConfig = createClientOutputConfig(clientManualChunks);
|
|
373
386
|
const clientCodeSplittingConfig = createClientCodeSplittingConfig(clientManualChunks);
|
|
374
|
-
function getClientOutputConfigForVite(viteMajorVersion) {
|
|
375
|
-
return viteMajorVersion >= 8 ? {
|
|
387
|
+
function getClientOutputConfigForVite(viteMajorVersion, assetsDir) {
|
|
388
|
+
return viteMajorVersion >= 8 ? {
|
|
389
|
+
assetFileNames: createClientAssetFileNames(assetsDir),
|
|
390
|
+
codeSplitting: clientCodeSplittingConfig
|
|
391
|
+
} : createClientOutputConfig(clientManualChunks, assetsDir);
|
|
376
392
|
}
|
|
377
393
|
function vinext(options = {}) {
|
|
378
394
|
const viteMajorVersion = getViteMajorVersion();
|
|
@@ -387,6 +403,7 @@ function vinext(options = {}) {
|
|
|
387
403
|
let instrumentationPath = null;
|
|
388
404
|
let instrumentationClientPath = null;
|
|
389
405
|
let clientInjectModule = null;
|
|
406
|
+
let clientAssetsInlineLimit = 0;
|
|
390
407
|
let hasCloudflarePlugin = false;
|
|
391
408
|
let warnedInlineNextConfigOverride = false;
|
|
392
409
|
let hasNitroPlugin = false;
|
|
@@ -418,7 +435,10 @@ function vinext(options = {}) {
|
|
|
418
435
|
*/
|
|
419
436
|
async function generateClientEntry$1() {
|
|
420
437
|
const appPrefetchRoutes = hasAppDir ? (await appRouter(appDir, nextConfig?.pageExtensions, fileMatcher)).filter(isLinkPrefetchRoute).map(toLinkPrefetchRoute) : [];
|
|
421
|
-
return generateClientEntry(pagesDir, nextConfig, fileMatcher, {
|
|
438
|
+
return generateClientEntry(pagesDir, nextConfig, fileMatcher, {
|
|
439
|
+
appPrefetchRoutes,
|
|
440
|
+
instrumentationClientPath
|
|
441
|
+
});
|
|
422
442
|
}
|
|
423
443
|
async function writeRouteTypes() {
|
|
424
444
|
if (!hasAppDir) return;
|
|
@@ -566,8 +586,16 @@ function vinext(options = {}) {
|
|
|
566
586
|
rawConfig = await resolveNextConfigInput(options.nextConfig, phase);
|
|
567
587
|
} else rawConfig = await loadNextConfig(root, phase);
|
|
568
588
|
nextConfig = await resolveNextConfig(rawConfig, root);
|
|
589
|
+
const sharedBuildId = process.env.__VINEXT_SHARED_BUILD_ID;
|
|
590
|
+
if (sharedBuildId && sharedBuildId.length > 0) nextConfig = {
|
|
591
|
+
...nextConfig,
|
|
592
|
+
buildId: sharedBuildId
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
if (rscCompatibilityId === void 0) {
|
|
596
|
+
const sharedRscCompatibilityId = process.env.__VINEXT_SHARED_RSC_COMPATIBILITY_ID;
|
|
597
|
+
rscCompatibilityId = sharedRscCompatibilityId && sharedRscCompatibilityId.length > 0 ? sharedRscCompatibilityId : createRscCompatibilityId(nextConfig);
|
|
569
598
|
}
|
|
570
|
-
rscCompatibilityId ??= createRscCompatibilityId(nextConfig);
|
|
571
599
|
fileMatcher = createValidFileMatcher(nextConfig.pageExtensions);
|
|
572
600
|
instrumentationPath = findInstrumentationFile(root, fileMatcher);
|
|
573
601
|
instrumentationClientPath = findInstrumentationClientFile(root, fileMatcher);
|
|
@@ -619,6 +647,7 @@ function vinext(options = {}) {
|
|
|
619
647
|
defines["process.env.NEXT_DEPLOYMENT_ID"] = nextConfig.deploymentId ? JSON.stringify(nextConfig.deploymentId) : "false";
|
|
620
648
|
defines["process.env.__NEXT_VERSION"] = JSON.stringify(getVinextVersion());
|
|
621
649
|
defines["process.env.__NEXT_APP_SHELLS"] = JSON.stringify(nextConfig.appShells);
|
|
650
|
+
defines["process.env.__NEXT_CACHE_COMPONENTS"] = JSON.stringify(String(nextConfig.cacheComponents ?? false));
|
|
622
651
|
for (const [key, value] of Object.entries(nextConfig.compilerDefine)) {
|
|
623
652
|
if (key in defines) 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.`);
|
|
624
653
|
defines[key] = value;
|
|
@@ -678,6 +707,7 @@ function vinext(options = {}) {
|
|
|
678
707
|
"vinext/cache": path.resolve(__dirname, "cache"),
|
|
679
708
|
"vinext/instrumentation": path.resolve(__dirname, "server", "instrumentation"),
|
|
680
709
|
"vinext/instrumentation-client": path.resolve(__dirname, "client", "instrumentation-client"),
|
|
710
|
+
"vinext/dev-error-overlay": path.resolve(__dirname, "server", "dev-error-overlay"),
|
|
681
711
|
"vinext/html": path.resolve(__dirname, "server", "html"),
|
|
682
712
|
...clientInjectModule === null ? { "private-next-instrumentation-client": instrumentationClientPath ?? INSTRUMENTATION_CLIENT_EMPTY_MODULE } : {}
|
|
683
713
|
}).flatMap(([k, v]) => k.startsWith("next/") ? [[k, v], [`${k}.js`, v]] : [[k, v]]));
|
|
@@ -696,6 +726,15 @@ function vinext(options = {}) {
|
|
|
696
726
|
if (!hasUserMdxPlugin && hasMdxFiles(root, hasAppDir ? appDir : null, hasPagesDir ? pagesDir : null)) await ensureMdxDelegate("detected");
|
|
697
727
|
const isSSR = !!config.build?.ssr;
|
|
698
728
|
const isMultiEnv = hasAppDir || hasCloudflarePlugin || hasNitroPlugin;
|
|
729
|
+
const hasBuildInput = getBuildBundlerOptions(config.build)?.input !== void 0;
|
|
730
|
+
const shouldInjectPlainPagesEnvironments = !hasAppDir && !hasCloudflarePlugin && !isSSR && !hasBuildInput;
|
|
731
|
+
const hasClientBuildEnvironment = hasAppDir || hasCloudflarePlugin || hasNitroPlugin || shouldInjectPlainPagesEnvironments;
|
|
732
|
+
const clientAssetsDir = resolveAssetsDir(nextConfig.assetPrefix ?? "");
|
|
733
|
+
clientAssetsInlineLimit = config.build?.assetsInlineLimit ?? 0;
|
|
734
|
+
const devHmrConfig = config.server?.hmr === false ? false : {
|
|
735
|
+
...typeof config.server?.hmr === "object" ? config.server.hmr : {},
|
|
736
|
+
overlay: false
|
|
737
|
+
};
|
|
699
738
|
const viteConfig = {
|
|
700
739
|
appType: "custom",
|
|
701
740
|
build: {
|
|
@@ -706,7 +745,8 @@ function vinext(options = {}) {
|
|
|
706
745
|
"firefox114",
|
|
707
746
|
"safari15"
|
|
708
747
|
],
|
|
709
|
-
assetsDir:
|
|
748
|
+
assetsDir: clientAssetsDir,
|
|
749
|
+
...!isSSR && !hasClientBuildEnvironment ? { assetsInlineLimit: clientAssetsInlineLimit } : {},
|
|
710
750
|
...withBuildBundlerOptions(viteMajorVersion, {
|
|
711
751
|
onwarn: (() => {
|
|
712
752
|
const userOnwarn = getBuildBundlerOptions(config.build)?.onwarn;
|
|
@@ -719,13 +759,16 @@ function vinext(options = {}) {
|
|
|
719
759
|
};
|
|
720
760
|
})(),
|
|
721
761
|
...!isSSR && !isMultiEnv ? { treeshake: getClientTreeshakeConfigForVite(viteMajorVersion) } : {},
|
|
722
|
-
...!isSSR && !isMultiEnv ? { output: getClientOutputConfigForVite(viteMajorVersion) } : {}
|
|
762
|
+
...!isSSR && !isMultiEnv ? { output: getClientOutputConfigForVite(viteMajorVersion, clientAssetsDir) } : {}
|
|
723
763
|
})
|
|
724
764
|
},
|
|
725
|
-
server: {
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
765
|
+
server: {
|
|
766
|
+
cors: {
|
|
767
|
+
preflightContinue: true,
|
|
768
|
+
origin: /^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/
|
|
769
|
+
},
|
|
770
|
+
hmr: devHmrConfig
|
|
771
|
+
},
|
|
729
772
|
...hasCloudflarePlugin || hasNitroPlugin ? {} : config.ssr?.external === true ? { ssr: { external: true } } : { ssr: {
|
|
730
773
|
external: [
|
|
731
774
|
"react",
|
|
@@ -787,6 +830,8 @@ function vinext(options = {}) {
|
|
|
787
830
|
const appEntries = [`${path.relative(root, appDir)}/**/*.{tsx,ts,jsx,js}`];
|
|
788
831
|
const explicitInstrumentationEntries = [instrumentationPath, instrumentationClientPath].flatMap((entry) => entry ? [toRelativeFileEntry(root, entry)] : []);
|
|
789
832
|
const optimizeEntries = [...new Set([...appEntries, ...explicitInstrumentationEntries])];
|
|
833
|
+
const appClientInput = { index: VIRTUAL_APP_BROWSER_ENTRY };
|
|
834
|
+
if (hasPagesDir) appClientInput["vinext-client-entry"] = VIRTUAL_CLIENT_ENTRY;
|
|
790
835
|
viteConfig.environments = {
|
|
791
836
|
rsc: {
|
|
792
837
|
...hasCloudflarePlugin || hasNitroPlugin ? {} : { resolve: {
|
|
@@ -804,7 +849,10 @@ function vinext(options = {}) {
|
|
|
804
849
|
},
|
|
805
850
|
build: {
|
|
806
851
|
outDir: options.rscOutDir ?? "dist/server",
|
|
807
|
-
...withBuildBundlerOptions(viteMajorVersion, {
|
|
852
|
+
...withBuildBundlerOptions(viteMajorVersion, {
|
|
853
|
+
input: { index: VIRTUAL_RSC_ENTRY },
|
|
854
|
+
output: createRscFrameworkChunkOutputConfig(viteMajorVersion)
|
|
855
|
+
})
|
|
808
856
|
}
|
|
809
857
|
},
|
|
810
858
|
ssr: {
|
|
@@ -836,10 +884,12 @@ function vinext(options = {}) {
|
|
|
836
884
|
])]
|
|
837
885
|
},
|
|
838
886
|
build: {
|
|
839
|
-
...hasCloudflarePlugin ? { manifest: true } : {},
|
|
887
|
+
...hasCloudflarePlugin || hasPagesDir ? { manifest: true } : {},
|
|
888
|
+
...hasPagesDir ? { ssrManifest: true } : {},
|
|
889
|
+
assetsInlineLimit: clientAssetsInlineLimit,
|
|
840
890
|
...withBuildBundlerOptions(viteMajorVersion, {
|
|
841
|
-
input:
|
|
842
|
-
output: getClientOutputConfigForVite(viteMajorVersion),
|
|
891
|
+
input: appClientInput,
|
|
892
|
+
output: getClientOutputConfigForVite(viteMajorVersion, clientAssetsDir),
|
|
843
893
|
treeshake: getClientTreeshakeConfigForVite(viteMajorVersion)
|
|
844
894
|
})
|
|
845
895
|
}
|
|
@@ -851,14 +901,15 @@ function vinext(options = {}) {
|
|
|
851
901
|
build: {
|
|
852
902
|
manifest: true,
|
|
853
903
|
ssrManifest: true,
|
|
904
|
+
assetsInlineLimit: clientAssetsInlineLimit,
|
|
854
905
|
...withBuildBundlerOptions(viteMajorVersion, {
|
|
855
906
|
input: { index: VIRTUAL_CLIENT_ENTRY },
|
|
856
|
-
output: getClientOutputConfigForVite(viteMajorVersion),
|
|
907
|
+
output: getClientOutputConfigForVite(viteMajorVersion, clientAssetsDir),
|
|
857
908
|
treeshake: getClientTreeshakeConfigForVite(viteMajorVersion)
|
|
858
909
|
})
|
|
859
910
|
}
|
|
860
911
|
} };
|
|
861
|
-
else if (
|
|
912
|
+
else if (shouldInjectPlainPagesEnvironments) viteConfig.environments = {
|
|
862
913
|
client: {
|
|
863
914
|
consumer: "client",
|
|
864
915
|
optimizeDeps: pagesOptimizeEntries.length > 0 ? { entries: pagesOptimizeEntries } : void 0,
|
|
@@ -866,9 +917,10 @@ function vinext(options = {}) {
|
|
|
866
917
|
outDir: "dist/client",
|
|
867
918
|
manifest: true,
|
|
868
919
|
ssrManifest: true,
|
|
920
|
+
assetsInlineLimit: clientAssetsInlineLimit,
|
|
869
921
|
...withBuildBundlerOptions(viteMajorVersion, {
|
|
870
922
|
input: { index: VIRTUAL_CLIENT_ENTRY },
|
|
871
|
-
output: getClientOutputConfigForVite(viteMajorVersion),
|
|
923
|
+
output: getClientOutputConfigForVite(viteMajorVersion, clientAssetsDir),
|
|
872
924
|
treeshake: getClientTreeshakeConfigForVite(viteMajorVersion)
|
|
873
925
|
})
|
|
874
926
|
}
|
|
@@ -927,16 +979,17 @@ function vinext(options = {}) {
|
|
|
927
979
|
if (isVercelOgImport(cleanId) && !isVinextOgShimImporter(importer)) return resolveShimModulePath(_shimsDir, "og");
|
|
928
980
|
if (cleanId === VIRTUAL_SERVER_ENTRY) return RESOLVED_SERVER_ENTRY;
|
|
929
981
|
if (cleanId === VIRTUAL_CLIENT_ENTRY) return RESOLVED_CLIENT_ENTRY;
|
|
930
|
-
if (cleanId.endsWith("/"
|
|
931
|
-
if (cleanId.endsWith("/"
|
|
982
|
+
if (cleanId.endsWith("/virtual:vinext-server-entry") || cleanId.endsWith("\\virtual:vinext-server-entry")) return RESOLVED_SERVER_ENTRY;
|
|
983
|
+
if (cleanId.endsWith("/virtual:vinext-client-entry") || cleanId.endsWith("\\virtual:vinext-client-entry")) return RESOLVED_CLIENT_ENTRY;
|
|
932
984
|
if (cleanId === VIRTUAL_RSC_ENTRY) return RESOLVED_RSC_ENTRY;
|
|
933
985
|
if (cleanId === VIRTUAL_APP_SSR_ENTRY) return RESOLVED_APP_SSR_ENTRY;
|
|
934
986
|
if (cleanId === VIRTUAL_APP_BROWSER_ENTRY) return RESOLVED_APP_BROWSER_ENTRY;
|
|
935
987
|
if (cleanId === "next/root-params" || cleanId === "next/root-params.js") return RESOLVED_ROOT_PARAMS;
|
|
988
|
+
if (cleanId === "virtual:vinext-cache-adapters" || cleanId.endsWith("/virtual:vinext-cache-adapters") || cleanId.endsWith("\\virtual:vinext-cache-adapters")) return RESOLVED_CACHE_ADAPTERS;
|
|
936
989
|
if (cleanId.startsWith("virtual:vinext-google-fonts?")) return RESOLVED_VIRTUAL_GOOGLE_FONTS + cleanId.slice(VIRTUAL_GOOGLE_FONTS.length);
|
|
937
|
-
if (cleanId.endsWith("/"
|
|
938
|
-
if (cleanId.endsWith("/"
|
|
939
|
-
if (cleanId.endsWith("/"
|
|
990
|
+
if (cleanId.endsWith("/virtual:vinext-rsc-entry") || cleanId.endsWith("\\virtual:vinext-rsc-entry")) return RESOLVED_RSC_ENTRY;
|
|
991
|
+
if (cleanId.endsWith("/virtual:vinext-app-ssr-entry") || cleanId.endsWith("\\virtual:vinext-app-ssr-entry")) return RESOLVED_APP_SSR_ENTRY;
|
|
992
|
+
if (cleanId.endsWith("/virtual:vinext-app-browser-entry") || cleanId.endsWith("\\virtual:vinext-app-browser-entry")) return RESOLVED_APP_BROWSER_ENTRY;
|
|
940
993
|
if (cleanId.includes("/virtual:vinext-google-fonts?") || cleanId.includes("\\virtual:vinext-google-fonts?")) {
|
|
941
994
|
const queryIndex = cleanId.indexOf(VIRTUAL_GOOGLE_FONTS + "?");
|
|
942
995
|
return RESOLVED_VIRTUAL_GOOGLE_FONTS + cleanId.slice(queryIndex + VIRTUAL_GOOGLE_FONTS.length);
|
|
@@ -961,10 +1014,12 @@ function vinext(options = {}) {
|
|
|
961
1014
|
allowedOrigins: nextConfig?.serverActionsAllowedOrigins,
|
|
962
1015
|
allowedDevOrigins: nextConfig?.allowedDevOrigins,
|
|
963
1016
|
bodySizeLimit: nextConfig?.serverActionsBodySizeLimit,
|
|
1017
|
+
bodySizeLimitLabel: nextConfig?.serverActionsBodySizeLimitLabel,
|
|
964
1018
|
htmlLimitedBots: nextConfig?.htmlLimitedBots,
|
|
965
1019
|
clientTraceMetadata: nextConfig?.clientTraceMetadata,
|
|
966
1020
|
assetPrefix: nextConfig?.assetPrefix,
|
|
967
1021
|
expireTime: nextConfig?.expireTime,
|
|
1022
|
+
reactMaxHeadersLength: nextConfig?.reactMaxHeadersLength,
|
|
968
1023
|
cacheMaxMemorySize: nextConfig?.cacheMaxMemorySize,
|
|
969
1024
|
inlineCss: nextConfig?.inlineCss,
|
|
970
1025
|
i18n: nextConfig?.i18n,
|
|
@@ -975,6 +1030,7 @@ function vinext(options = {}) {
|
|
|
975
1030
|
}, instrumentationPath);
|
|
976
1031
|
}
|
|
977
1032
|
if (id === RESOLVED_ROOT_PARAMS) return generateRootParamsModule((hasAppDir ? await appRouter(appDir, nextConfig?.pageExtensions, fileMatcher) : []).flatMap((route) => route.rootParamNames ?? []));
|
|
1033
|
+
if (id === RESOLVED_CACHE_ADAPTERS) return generateCacheAdaptersModule(options.cache);
|
|
978
1034
|
if (id === RESOLVED_APP_SSR_ENTRY && hasAppDir) return generateSsrEntry(hasPagesDir);
|
|
979
1035
|
if (id === RESOLVED_APP_BROWSER_ENTRY && hasAppDir) {
|
|
980
1036
|
const graph = await appRouteGraph(appDir, nextConfig?.pageExtensions, fileMatcher);
|
|
@@ -983,41 +1039,103 @@ function vinext(options = {}) {
|
|
|
983
1039
|
if (id.startsWith("\0virtual:vinext-google-fonts?")) return generateGoogleFontsVirtualModule(id, _fontGoogleShimPath);
|
|
984
1040
|
},
|
|
985
1041
|
// @vitejs/plugin-rsc runs the RSC environment build in two phases:
|
|
1042
|
+
renderChunk: {
|
|
1043
|
+
order: "pre",
|
|
1044
|
+
handler(code, chunk) {
|
|
1045
|
+
if (this.environment?.name !== "rsc") return null;
|
|
1046
|
+
if (!rscClassificationManifest) return null;
|
|
1047
|
+
if (!code.includes("__VINEXT_CLASS")) return null;
|
|
1048
|
+
const enableClassificationDebug = Boolean(process.env.VINEXT_DEBUG_CLASSIFICATION);
|
|
1049
|
+
const patchPlan = planRouteClassificationInjection({
|
|
1050
|
+
canonicalizeLayoutPath: canonicalize,
|
|
1051
|
+
chunks: [{
|
|
1052
|
+
code,
|
|
1053
|
+
fileName: chunk.fileName
|
|
1054
|
+
}],
|
|
1055
|
+
dynamicShimPaths,
|
|
1056
|
+
enableDebugReasons: enableClassificationDebug,
|
|
1057
|
+
manifest: rscClassificationManifest,
|
|
1058
|
+
moduleInfo: { getModuleInfo: (moduleId) => {
|
|
1059
|
+
const info = this.getModuleInfo(moduleId);
|
|
1060
|
+
if (!info) return null;
|
|
1061
|
+
return {
|
|
1062
|
+
importedIds: info.importedIds ?? [],
|
|
1063
|
+
dynamicImportedIds: info.dynamicallyImportedIds ?? []
|
|
1064
|
+
};
|
|
1065
|
+
} }
|
|
1066
|
+
});
|
|
1067
|
+
if (patchPlan.kind === "skip") return null;
|
|
1068
|
+
rscClassificationManifest = null;
|
|
1069
|
+
return {
|
|
1070
|
+
code: patchPlan.code,
|
|
1071
|
+
map: patchPlan.map
|
|
1072
|
+
};
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
},
|
|
1076
|
+
{
|
|
1077
|
+
name: "vinext:css-url-assets-mark",
|
|
1078
|
+
enforce: "pre",
|
|
1079
|
+
apply: "build",
|
|
1080
|
+
transform(code, id) {
|
|
1081
|
+
if (this.environment?.name !== "client") return null;
|
|
1082
|
+
const marked = markCssUrlAssetReferences(code, id);
|
|
1083
|
+
if (marked === null) return null;
|
|
1084
|
+
return {
|
|
1085
|
+
code: marked,
|
|
1086
|
+
map: null
|
|
1087
|
+
};
|
|
1088
|
+
}
|
|
1089
|
+
},
|
|
1090
|
+
{
|
|
1091
|
+
name: "vinext:client-css-url-assets-defaults",
|
|
1092
|
+
apply: "build",
|
|
1093
|
+
configEnvironment(name) {
|
|
1094
|
+
if (name !== "client") return null;
|
|
1095
|
+
return { build: { assetsInlineLimit: clientAssetsInlineLimit } };
|
|
1096
|
+
}
|
|
1097
|
+
},
|
|
1098
|
+
{
|
|
1099
|
+
name: "vinext:server-minify-defaults",
|
|
1100
|
+
apply: "build",
|
|
1101
|
+
configEnvironment(name, config) {
|
|
1102
|
+
if (name === "client") return null;
|
|
1103
|
+
if (config.build?.minify !== void 0) return null;
|
|
1104
|
+
return { build: { minify: true } };
|
|
1105
|
+
}
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
name: "vinext:css-url-assets-restore",
|
|
1109
|
+
enforce: "post",
|
|
1110
|
+
apply: "build",
|
|
986
1111
|
generateBundle(_options, bundle) {
|
|
987
|
-
if (this.environment?.name !== "
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
if (chunk.type !== "chunk") continue;
|
|
994
|
-
chunks.push({
|
|
995
|
-
code: chunk.code,
|
|
996
|
-
fileName: chunk.fileName
|
|
1112
|
+
if (this.environment?.name !== "client") return;
|
|
1113
|
+
restoreDedupedCssAssetReferences(bundle, (asset) => {
|
|
1114
|
+
this.emitFile({
|
|
1115
|
+
type: "asset",
|
|
1116
|
+
fileName: asset.fileName,
|
|
1117
|
+
source: asset.source
|
|
997
1118
|
});
|
|
998
|
-
|
|
1119
|
+
});
|
|
1120
|
+
}
|
|
1121
|
+
},
|
|
1122
|
+
{
|
|
1123
|
+
name: "vinext:client-entry-manifest",
|
|
1124
|
+
apply: "build",
|
|
1125
|
+
generateBundle(_options, bundle) {
|
|
1126
|
+
if (this.environment?.name !== "client") return;
|
|
1127
|
+
const manifest = {};
|
|
1128
|
+
for (const chunk of Object.values(bundle)) {
|
|
1129
|
+
if (chunk.type !== "chunk" || !chunk.isEntry) continue;
|
|
1130
|
+
if (isVirtualEntryFacade(chunk.facadeModuleId, VIRTUAL_CLIENT_ENTRY)) manifest.pagesClientEntry = chunk.fileName;
|
|
1131
|
+
else if (isVirtualEntryFacade(chunk.facadeModuleId, VIRTUAL_APP_BROWSER_ENTRY)) manifest.appBrowserEntry = chunk.fileName;
|
|
999
1132
|
}
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
manifest: rscClassificationManifest,
|
|
1006
|
-
moduleInfo: { getModuleInfo: (moduleId) => {
|
|
1007
|
-
const info = this.getModuleInfo(moduleId);
|
|
1008
|
-
if (!info) return null;
|
|
1009
|
-
return {
|
|
1010
|
-
importedIds: info.importedIds ?? [],
|
|
1011
|
-
dynamicImportedIds: info.dynamicallyImportedIds ?? []
|
|
1012
|
-
};
|
|
1013
|
-
} }
|
|
1133
|
+
if (!manifest.pagesClientEntry && !manifest.appBrowserEntry) return;
|
|
1134
|
+
this.emitFile({
|
|
1135
|
+
type: "asset",
|
|
1136
|
+
fileName: VINEXT_CLIENT_ENTRY_MANIFEST,
|
|
1137
|
+
source: JSON.stringify(manifest, null, 2) + "\n"
|
|
1014
1138
|
});
|
|
1015
|
-
if (patchPlan.kind === "skip") return;
|
|
1016
|
-
const target = chunksByFileName.get(patchPlan.fileName);
|
|
1017
|
-
if (!target) throw new Error(`vinext: build-time classification — patch target ${patchPlan.fileName} disappeared from the RSC bundle`);
|
|
1018
|
-
target.code = patchPlan.code;
|
|
1019
|
-
target.map = patchPlan.map;
|
|
1020
|
-
rscClassificationManifest = null;
|
|
1021
1139
|
}
|
|
1022
1140
|
},
|
|
1023
1141
|
asyncHooksStubPlugin,
|
|
@@ -1185,6 +1303,7 @@ function vinext(options = {}) {
|
|
|
1185
1303
|
}
|
|
1186
1304
|
next();
|
|
1187
1305
|
});
|
|
1306
|
+
installDevStackSourcemapMiddleware(server);
|
|
1188
1307
|
return () => {
|
|
1189
1308
|
if (instrumentationPath && !hasAppDir) runInstrumentation(getPagesRunner(), instrumentationPath).catch((err) => {
|
|
1190
1309
|
console.error("[vinext] Instrumentation error:", err);
|
|
@@ -1294,6 +1413,10 @@ function vinext(options = {}) {
|
|
|
1294
1413
|
res.end("Bad Request");
|
|
1295
1414
|
return;
|
|
1296
1415
|
}
|
|
1416
|
+
{
|
|
1417
|
+
const qs = url.includes("?") ? url.slice(url.indexOf("?")) : "";
|
|
1418
|
+
url = pathname + qs;
|
|
1419
|
+
}
|
|
1297
1420
|
const bp = nextConfig?.basePath ?? "";
|
|
1298
1421
|
if (bp && pathname.startsWith(bp)) {
|
|
1299
1422
|
const stripped = pathname.slice(bp.length) || "/";
|
|
@@ -1334,154 +1457,110 @@ function vinext(options = {}) {
|
|
|
1334
1457
|
for (const header of INTERNAL_HEADERS) delete req.headers[header];
|
|
1335
1458
|
for (const header of VINEXT_INTERNAL_HEADERS) delete req.headers[header];
|
|
1336
1459
|
const requestOrigin = `http://${req.headers.host || "localhost"}`;
|
|
1337
|
-
const
|
|
1338
|
-
const
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
if (applyRedirects(matchPathname, res, nextConfig.redirects, preMiddlewareReqCtx, nextConfig.basePath ?? "")) return;
|
|
1343
|
-
}
|
|
1460
|
+
const method = req.method ?? "GET";
|
|
1461
|
+
const webRequest = new Request(new URL(url, requestOrigin), {
|
|
1462
|
+
method,
|
|
1463
|
+
headers: nodeRequestHeaders
|
|
1464
|
+
});
|
|
1344
1465
|
const applyRequestHeadersToNodeRequest = (nextRequestHeaders) => {
|
|
1345
1466
|
for (const key of Object.keys(req.headers)) delete req.headers[key];
|
|
1346
1467
|
for (const [key, value] of nextRequestHeaders) req.headers[key] = value;
|
|
1347
1468
|
};
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
const applyDeferredMwHeaders = () => {
|
|
1351
|
-
if (deferredMwResponseHeaders) for (const [key, value] of deferredMwResponseHeaders) res.appendHeader(key, value);
|
|
1352
|
-
};
|
|
1353
|
-
const applyMwRequestHeadersForExternalProxy = () => {
|
|
1354
|
-
if (middlewareRequestHeaders) applyRequestHeadersToNodeRequest(middlewareRequestHeaders);
|
|
1355
|
-
else delete req.headers[VINEXT_MW_CTX_HEADER];
|
|
1356
|
-
};
|
|
1357
|
-
if (middlewarePath) {
|
|
1469
|
+
const capturedMiddlewarePath = middlewarePath;
|
|
1470
|
+
const devRunMiddlewareAdapter = capturedMiddlewarePath ? async (_request, _ctx, opts) => {
|
|
1358
1471
|
const rawProto = process.env.VINEXT_TRUST_PROXY === "1" || (process.env.VINEXT_TRUSTED_HOSTS ?? "").split(",").some((h) => h.trim()) ? String(req.headers["x-forwarded-proto"] || "").split(",")[0].trim() : "";
|
|
1359
|
-
const
|
|
1360
|
-
const middlewareRequest = new Request(new URL(url,
|
|
1472
|
+
const mwOrigin = `${rawProto === "https" || rawProto === "http" ? rawProto : "http"}://${req.headers.host || "localhost"}`;
|
|
1473
|
+
const middlewareRequest = new Request(new URL(url, mwOrigin), {
|
|
1361
1474
|
method: req.method,
|
|
1362
1475
|
headers: nodeRequestHeaders
|
|
1363
1476
|
});
|
|
1364
|
-
const result = await runMiddleware(getPagesRunner(),
|
|
1365
|
-
if (result.
|
|
1366
|
-
if (!result.continue) {
|
|
1367
|
-
if (result.redirectUrl) {
|
|
1368
|
-
const redirectHeaders = { Location: result.redirectUrl };
|
|
1369
|
-
if (result.responseHeaders) for (const [key, value] of result.responseHeaders) {
|
|
1370
|
-
const existing = redirectHeaders[key];
|
|
1371
|
-
if (existing === void 0) redirectHeaders[key] = value;
|
|
1372
|
-
else if (Array.isArray(existing)) existing.push(value);
|
|
1373
|
-
else redirectHeaders[key] = [existing, value];
|
|
1374
|
-
}
|
|
1375
|
-
res.writeHead(result.redirectStatus ?? 307, redirectHeaders);
|
|
1376
|
-
res.end();
|
|
1377
|
-
return;
|
|
1378
|
-
}
|
|
1379
|
-
if (result.response) {
|
|
1380
|
-
res.statusCode = result.response.status;
|
|
1381
|
-
for (const [key, value] of result.response.headers) res.appendHeader(key, value);
|
|
1382
|
-
const body = Buffer.from(await result.response.arrayBuffer());
|
|
1383
|
-
res.end(body);
|
|
1384
|
-
return;
|
|
1385
|
-
}
|
|
1386
|
-
}
|
|
1387
|
-
if (result.responseHeaders) {
|
|
1388
|
-
const currentRequestHeaders = new Headers();
|
|
1389
|
-
for (const [key, value] of Object.entries(req.headers)) if (Array.isArray(value)) currentRequestHeaders.set(key, value.join(", "));
|
|
1390
|
-
else if (value !== void 0) currentRequestHeaders.set(key, value);
|
|
1391
|
-
middlewareRequestHeaders = buildRequestHeadersFromMiddlewareResponse(currentRequestHeaders, result.responseHeaders, { preserveCredentialHeaders: Boolean(result.rewriteUrl && isExternalUrl(result.rewriteUrl)) });
|
|
1392
|
-
if (middlewareRequestHeaders && !hasAppDir) applyRequestHeadersToNodeRequest(middlewareRequestHeaders);
|
|
1393
|
-
if (hasAppDir) {
|
|
1394
|
-
deferredMwResponseHeaders = [];
|
|
1395
|
-
for (const [key, value] of result.responseHeaders) if (!key.startsWith("x-middleware-")) deferredMwResponseHeaders.push([key, value]);
|
|
1396
|
-
} else for (const [key, value] of result.responseHeaders) if (!key.startsWith("x-middleware-")) res.appendHeader(key, value);
|
|
1397
|
-
}
|
|
1398
|
-
if (result.rewriteUrl) {
|
|
1399
|
-
url = result.rewriteUrl;
|
|
1400
|
-
req.url = url;
|
|
1401
|
-
}
|
|
1402
|
-
const middlewareStatus = result.status ?? result.rewriteStatus;
|
|
1403
|
-
if (middlewareStatus !== void 0) req.__vinextMiddlewareStatus = middlewareStatus;
|
|
1404
|
-
if (hasAppDir) {
|
|
1477
|
+
const result = await runMiddleware(getPagesRunner(), capturedMiddlewarePath, middlewareRequest, nextConfig?.i18n, nextConfig?.basePath, nextConfig?.trailingSlash, opts.isDataRequest);
|
|
1478
|
+
if (hasAppDir && result.continue) {
|
|
1405
1479
|
const mwCtxEntries = [];
|
|
1406
1480
|
if (result.responseHeaders) {
|
|
1407
1481
|
for (const [key, value] of result.responseHeaders) if (key !== "x-middleware-next" && key !== "x-middleware-rewrite") mwCtxEntries.push([key, value]);
|
|
1408
1482
|
}
|
|
1483
|
+
const mwStatus = result.status ?? result.rewriteStatus;
|
|
1409
1484
|
req.headers[VINEXT_MW_CTX_HEADER] = JSON.stringify({
|
|
1410
1485
|
h: mwCtxEntries,
|
|
1411
|
-
s:
|
|
1486
|
+
s: mwStatus ?? null,
|
|
1412
1487
|
r: result.rewriteUrl ?? null
|
|
1413
1488
|
});
|
|
1414
1489
|
}
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
const
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1490
|
+
return result;
|
|
1491
|
+
} : null;
|
|
1492
|
+
const devPageRoutes = await pagesRouter(pagesDir, nextConfig?.pageExtensions, fileMatcher);
|
|
1493
|
+
const pipelineResult = await runPagesRequest(webRequest, {
|
|
1494
|
+
basePath: bp,
|
|
1495
|
+
trailingSlash: nextConfig?.trailingSlash ?? false,
|
|
1496
|
+
i18nConfig: nextConfig?.i18n ?? null,
|
|
1497
|
+
configRedirects: nextConfig?.redirects ?? [],
|
|
1498
|
+
configRewrites: nextConfig?.rewrites ?? {
|
|
1499
|
+
beforeFiles: [],
|
|
1500
|
+
afterFiles: [],
|
|
1501
|
+
fallback: []
|
|
1502
|
+
},
|
|
1503
|
+
configHeaders: nextConfig?.headers ?? [],
|
|
1504
|
+
hadBasePath: true,
|
|
1505
|
+
isDataReq,
|
|
1506
|
+
isDataRequest,
|
|
1507
|
+
rawSearch: url.includes("?") ? url.slice(url.indexOf("?")) : "",
|
|
1508
|
+
runMiddleware: devRunMiddlewareAdapter,
|
|
1509
|
+
matchPageRoute: (resolvedPathname) => {
|
|
1510
|
+
const m = matchRoute(resolvedPathname, devPageRoutes);
|
|
1511
|
+
return m ? { route: { isDynamic: m.route.isDynamic } } : null;
|
|
1512
|
+
},
|
|
1513
|
+
proxyExternal: async (currentRequest, externalUrl) => {
|
|
1514
|
+
const externalMethod = req.method ?? "GET";
|
|
1515
|
+
const hasBody = externalMethod !== "GET" && externalMethod !== "HEAD";
|
|
1516
|
+
const externalInit = {
|
|
1517
|
+
method: externalMethod,
|
|
1518
|
+
headers: currentRequest.headers
|
|
1519
|
+
};
|
|
1520
|
+
if (hasBody) {
|
|
1521
|
+
const { Readable } = await import("node:stream");
|
|
1522
|
+
externalInit.body = Readable.toWeb(req);
|
|
1523
|
+
externalInit.duplex = "half";
|
|
1524
|
+
}
|
|
1525
|
+
return proxyExternalRequest(new Request(new URL(url, requestOrigin), externalInit), externalUrl);
|
|
1526
|
+
}
|
|
1527
|
+
});
|
|
1528
|
+
if (pipelineResult.type === "response") {
|
|
1529
|
+
await writeWebResponseToNodeRes(res, pipelineResult.response);
|
|
1428
1530
|
return;
|
|
1429
1531
|
}
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1532
|
+
if (pipelineResult.type === "next") return next();
|
|
1533
|
+
if (pipelineResult.type === "handled") return;
|
|
1534
|
+
const flushStagedHeaders = () => {
|
|
1535
|
+
for (const [key, value] of Object.entries(pipelineResult.stagedHeaders)) if (Array.isArray(value)) for (const v of value) res.appendHeader(key, v);
|
|
1536
|
+
else res.appendHeader(key, value);
|
|
1537
|
+
};
|
|
1538
|
+
const flushRequestHeaders = () => {
|
|
1539
|
+
applyRequestHeadersToNodeRequest(pipelineResult.requestHeaders);
|
|
1540
|
+
};
|
|
1541
|
+
if (pipelineResult.type === "api") {
|
|
1433
1542
|
const apiRoutes = await apiRouter(pagesDir, nextConfig?.pageExtensions, fileMatcher);
|
|
1434
|
-
if (matchRoute(
|
|
1435
|
-
|
|
1436
|
-
|
|
1543
|
+
if (matchRoute(pipelineResult.apiUrl, apiRoutes)) {
|
|
1544
|
+
flushStagedHeaders();
|
|
1545
|
+
flushRequestHeaders();
|
|
1546
|
+
if (pipelineResult.middlewareStatus !== void 0) req.__vinextMiddlewareStatus = pipelineResult.middlewareStatus;
|
|
1437
1547
|
}
|
|
1438
|
-
if (await handleApiRoute(getPagesRunner(), req, res,
|
|
1548
|
+
if (await handleApiRoute(getPagesRunner(), req, res, pipelineResult.apiUrl, apiRoutes)) return;
|
|
1439
1549
|
if (hasAppDir) return next();
|
|
1440
1550
|
res.statusCode = 404;
|
|
1441
1551
|
res.end("404 - API route not found");
|
|
1442
1552
|
return;
|
|
1443
1553
|
}
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
const
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
if (isExternalUrl(resolvedUrl)) {
|
|
1454
|
-
applyDeferredMwHeaders();
|
|
1455
|
-
applyMwRequestHeadersForExternalProxy();
|
|
1456
|
-
await proxyExternalRewriteNode(req, res, resolvedUrl);
|
|
1457
|
-
return;
|
|
1554
|
+
{
|
|
1555
|
+
const routes = await pagesRouter(pagesDir, nextConfig?.pageExtensions, fileMatcher);
|
|
1556
|
+
if (!matchRoute(pipelineResult.resolvedUrl.split("?")[0], routes) && hasAppDir) return next();
|
|
1557
|
+
const handler = createSSRHandler(server, getPagesRunner(), routes, pagesDir, nextConfig?.i18n, fileMatcher, nextConfig?.basePath ?? "", nextConfig?.trailingSlash ?? false, middlewarePath !== null, (nextConfig?.rewrites.beforeFiles.length ?? 0) > 0 || (nextConfig?.rewrites.afterFiles.length ?? 0) > 0 || (nextConfig?.rewrites.fallback.length ?? 0) > 0, nextConfig?.clientTraceMetadata);
|
|
1558
|
+
flushStagedHeaders();
|
|
1559
|
+
flushRequestHeaders();
|
|
1560
|
+
if (pipelineResult.middlewareStatus !== void 0) req.__vinextMiddlewareStatus = pipelineResult.middlewareStatus;
|
|
1561
|
+
req.url = pipelineResult.resolvedUrl;
|
|
1562
|
+
await handler(req, res, pipelineResult.resolvedUrl, req.__vinextMiddlewareStatus, pipelineResult.isDataReq);
|
|
1458
1563
|
}
|
|
1459
|
-
const handler = createSSRHandler(server, getPagesRunner(), routes, pagesDir, nextConfig?.i18n, fileMatcher, nextConfig?.basePath ?? "", nextConfig?.trailingSlash ?? false, middlewarePath !== null, nextConfig?.clientTraceMetadata);
|
|
1460
|
-
const mwStatus = req.__vinextMiddlewareStatus;
|
|
1461
|
-
if (match) {
|
|
1462
|
-
applyDeferredMwHeaders();
|
|
1463
|
-
if (middlewareRequestHeaders) applyRequestHeadersToNodeRequest(middlewareRequestHeaders);
|
|
1464
|
-
await handler(req, res, resolvedUrl, mwStatus, isDataReq);
|
|
1465
|
-
return;
|
|
1466
|
-
}
|
|
1467
|
-
if (nextConfig?.rewrites.fallback.length) {
|
|
1468
|
-
const fallbackRewrite = applyRewrites(matchResolvedPathname(resolvedUrl.split("?")[0]), nextConfig.rewrites.fallback, reqCtx, bp);
|
|
1469
|
-
if (fallbackRewrite) {
|
|
1470
|
-
if (isExternalUrl(fallbackRewrite)) {
|
|
1471
|
-
applyDeferredMwHeaders();
|
|
1472
|
-
applyMwRequestHeadersForExternalProxy();
|
|
1473
|
-
await proxyExternalRewriteNode(req, res, fallbackRewrite);
|
|
1474
|
-
return;
|
|
1475
|
-
}
|
|
1476
|
-
if (!matchRoute(fallbackRewrite.split("?")[0], routes) && hasAppDir) return next();
|
|
1477
|
-
applyDeferredMwHeaders();
|
|
1478
|
-
if (middlewareRequestHeaders) applyRequestHeadersToNodeRequest(middlewareRequestHeaders);
|
|
1479
|
-
await handler(req, res, fallbackRewrite, mwStatus, isDataReq);
|
|
1480
|
-
return;
|
|
1481
|
-
}
|
|
1482
|
-
}
|
|
1483
|
-
if (hasAppDir) return next();
|
|
1484
|
-
await handler(req, res, resolvedUrl, mwStatus, isDataReq);
|
|
1485
1564
|
} catch (e) {
|
|
1486
1565
|
next(e);
|
|
1487
1566
|
}
|
|
@@ -1548,9 +1627,12 @@ function vinext(options = {}) {
|
|
|
1548
1627
|
{
|
|
1549
1628
|
name: "vinext:compiler-define-server",
|
|
1550
1629
|
configEnvironment(name) {
|
|
1551
|
-
if (Object.keys(nextConfig.compilerDefineServer).length === 0) return null;
|
|
1552
1630
|
if (name === "client") return null;
|
|
1553
|
-
|
|
1631
|
+
const serverDefines = { ...nextConfig.compilerDefineServer };
|
|
1632
|
+
const sharedRevalidateSecret = process.env.__VINEXT_SHARED_REVALIDATE_SECRET;
|
|
1633
|
+
if (sharedRevalidateSecret) serverDefines["process.env.__VINEXT_REVALIDATE_SECRET"] = JSON.stringify(sharedRevalidateSecret);
|
|
1634
|
+
if (Object.keys(serverDefines).length === 0) return null;
|
|
1635
|
+
return { define: serverDefines };
|
|
1554
1636
|
}
|
|
1555
1637
|
},
|
|
1556
1638
|
{
|
|
@@ -1597,23 +1679,35 @@ function vinext(options = {}) {
|
|
|
1597
1679
|
if (id.includes("node_modules")) return null;
|
|
1598
1680
|
if (id.startsWith("\0")) return null;
|
|
1599
1681
|
if (!id.match(/\.(tsx?|jsx?|mjs)$/)) return null;
|
|
1600
|
-
const
|
|
1601
|
-
|
|
1602
|
-
|
|
1682
|
+
const imageExtRe = new RegExp(`\\.(${IMAGE_EXTS})$`);
|
|
1683
|
+
const lang = id.endsWith(".ts") ? "ts" : "tsx";
|
|
1684
|
+
let ast;
|
|
1685
|
+
try {
|
|
1686
|
+
ast = parseAst(code, { lang });
|
|
1687
|
+
} catch {
|
|
1688
|
+
return null;
|
|
1689
|
+
}
|
|
1603
1690
|
const s = new MagicString(code);
|
|
1604
1691
|
let hasChanges = false;
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
const
|
|
1608
|
-
const
|
|
1609
|
-
|
|
1692
|
+
for (const node of ast.body) {
|
|
1693
|
+
if (node.type !== "ImportDeclaration") continue;
|
|
1694
|
+
const importNode = node;
|
|
1695
|
+
const importPath = importNode.source?.value;
|
|
1696
|
+
if (typeof importPath !== "string") continue;
|
|
1697
|
+
if (!imageExtRe.test(importPath)) continue;
|
|
1698
|
+
const specifiers = importNode.specifiers ?? [];
|
|
1699
|
+
if (specifiers.length !== 1) continue;
|
|
1700
|
+
const specifier = specifiers[0];
|
|
1701
|
+
if (specifier.type !== "ImportDefaultSpecifier") continue;
|
|
1702
|
+
const varName = specifier.local?.name;
|
|
1703
|
+
if (!varName) continue;
|
|
1610
1704
|
const dir = path.dirname(id);
|
|
1611
|
-
const absImagePath = path.resolve(dir, importPath);
|
|
1705
|
+
const absImagePath = normalizePathSeparators(path.resolve(dir, importPath));
|
|
1612
1706
|
if (!fs.existsSync(absImagePath)) continue;
|
|
1613
1707
|
const urlVar = `__vinext_img_url_${varName}`;
|
|
1614
1708
|
const metaVar = `__vinext_img_meta_${varName}`;
|
|
1615
1709
|
const replacement = `import ${urlVar} from ${JSON.stringify(importPath)};\nimport ${metaVar} from ${JSON.stringify(absImagePath + "?vinext-meta")};\nconst ${varName} = { src: ${urlVar}, width: ${metaVar}.width, height: ${metaVar}.height };`;
|
|
1616
|
-
s.overwrite(
|
|
1710
|
+
s.overwrite(importNode.start, importNode.end, replacement);
|
|
1617
1711
|
hasChanges = true;
|
|
1618
1712
|
}
|
|
1619
1713
|
if (!hasChanges) return null;
|
|
@@ -1625,7 +1719,7 @@ function vinext(options = {}) {
|
|
|
1625
1719
|
}
|
|
1626
1720
|
},
|
|
1627
1721
|
createGoogleFontsPlugin(_fontGoogleShimPath, _shimsDir),
|
|
1628
|
-
createLocalFontsPlugin(),
|
|
1722
|
+
createLocalFontsPlugin(_shimsDir),
|
|
1629
1723
|
createOptimizeImportsPlugin(() => nextConfig, () => root),
|
|
1630
1724
|
{
|
|
1631
1725
|
name: "vinext:use-cache",
|
|
@@ -1677,9 +1771,15 @@ function vinext(options = {}) {
|
|
|
1677
1771
|
const directiveValue = cacheDirective.expression.value;
|
|
1678
1772
|
const variant = directiveValue === "use cache" ? "" : directiveValue.replace("use cache:", "").replace("use cache: ", "").trim();
|
|
1679
1773
|
const isLayoutOrTemplate = /\/(layout|template)\.(tsx?|jsx?|mjs)$/.test(id);
|
|
1774
|
+
const modulePath = stripViteModuleQuery(id);
|
|
1775
|
+
const moduleFileName = path.basename(modulePath);
|
|
1776
|
+
const isAppPageModule = hasAppDir && isInsideDirectory(appDir, modulePath) && path.parse(moduleFileName).name === "page" && fileMatcher.extensionRegex.test(moduleFileName);
|
|
1680
1777
|
const runtimeModuleUrl = pathToFileURL(resolveShimModulePath(shimsDir, "cache-runtime")).href;
|
|
1681
1778
|
const result = transformWrapExport(code, ast, {
|
|
1682
|
-
runtime: (value, name) =>
|
|
1779
|
+
runtime: (value, name) => {
|
|
1780
|
+
const pageOptions = name === "default" && isAppPageModule ? `, { appPageDefaultExport: true }` : "";
|
|
1781
|
+
return `(await import(${JSON.stringify(runtimeModuleUrl)})).registerCachedFunction(${value}, ${JSON.stringify(id + ":" + name)}, ${JSON.stringify(variant)}${pageOptions})`;
|
|
1782
|
+
},
|
|
1683
1783
|
rejectNonAsyncFunction: false,
|
|
1684
1784
|
filter: (name, meta) => {
|
|
1685
1785
|
if (meta.isFunction === false) return false;
|
|
@@ -1725,8 +1825,9 @@ function vinext(options = {}) {
|
|
|
1725
1825
|
}
|
|
1726
1826
|
},
|
|
1727
1827
|
createImportMetaUrlPlugin({ getRoot: () => root }),
|
|
1828
|
+
createRequireContextPlugin(),
|
|
1728
1829
|
createOgInlineFetchAssetsPlugin(),
|
|
1729
|
-
|
|
1830
|
+
createOgAssetsPlugin(),
|
|
1730
1831
|
createServerExternalsManifestPlugin(),
|
|
1731
1832
|
{
|
|
1732
1833
|
name: "vinext:image-config",
|
|
@@ -1754,7 +1855,7 @@ function vinext(options = {}) {
|
|
|
1754
1855
|
name: "vinext:build-id",
|
|
1755
1856
|
apply: "build",
|
|
1756
1857
|
enforce: "post",
|
|
1757
|
-
|
|
1858
|
+
writeBundle: {
|
|
1758
1859
|
sequential: true,
|
|
1759
1860
|
order: "post",
|
|
1760
1861
|
handler() {
|
|
@@ -1836,6 +1937,26 @@ function vinext(options = {}) {
|
|
|
1836
1937
|
}
|
|
1837
1938
|
}
|
|
1838
1939
|
},
|
|
1940
|
+
{
|
|
1941
|
+
name: "vinext:next-client-runtime-manifests",
|
|
1942
|
+
apply: "build",
|
|
1943
|
+
enforce: "post",
|
|
1944
|
+
writeBundle: {
|
|
1945
|
+
sequential: true,
|
|
1946
|
+
order: "post",
|
|
1947
|
+
handler(outputOptions) {
|
|
1948
|
+
const clientDir = outputOptions.dir;
|
|
1949
|
+
if (!clientDir) return;
|
|
1950
|
+
if (!(this.environment?.name === "client")) return;
|
|
1951
|
+
emitNextClientRuntimeManifests({
|
|
1952
|
+
clientDir,
|
|
1953
|
+
assetsSubdir: resolveAssetsDir(nextConfig.assetPrefix),
|
|
1954
|
+
buildId: nextConfig.buildId,
|
|
1955
|
+
rewrites: nextConfig.rewrites
|
|
1956
|
+
});
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
},
|
|
1839
1960
|
(() => {
|
|
1840
1961
|
let pendingPrecompress = null;
|
|
1841
1962
|
let pendingPrecompressError = null;
|
|
@@ -1864,8 +1985,7 @@ function vinext(options = {}) {
|
|
|
1864
1985
|
if (!isTTY) return;
|
|
1865
1986
|
const pct = total > 0 ? Math.floor(completed / total * 100) : 0;
|
|
1866
1987
|
const bar = `[${"█".repeat(Math.floor(pct / 5))}${" ".repeat(20 - Math.floor(pct / 5))}]`;
|
|
1867
|
-
const
|
|
1868
|
-
const fileLabel = file.length > maxFile ? "…" + file.slice(-(maxFile - 1)) : file;
|
|
1988
|
+
const fileLabel = file.length > 30 ? "…" + file.slice(-29) : file;
|
|
1869
1989
|
const line = `Compressing assets... ${bar} ${String(completed).padStart(String(total).length)}/${total} ${fileLabel}`;
|
|
1870
1990
|
const padded = line.padEnd(lastLineLen);
|
|
1871
1991
|
lastLineLen = line.length;
|
|
@@ -1940,9 +2060,11 @@ function vinext(options = {}) {
|
|
|
1940
2060
|
const clientBase = envConfig.base ?? "/";
|
|
1941
2061
|
let lazyChunksData = null;
|
|
1942
2062
|
let clientEntryFile = null;
|
|
2063
|
+
const clientEntryManifest = readClientEntryManifest(clientDir);
|
|
2064
|
+
clientEntryFile = (hasAppDir && hasPagesDir ? findPagesClientEntryFileFromVinextManifest : findClientEntryFileFromVinextManifest)(clientEntryManifest, clientBase) ?? null;
|
|
1943
2065
|
const buildManifest = readClientBuildManifest(path.join(clientDir, ".vite", "manifest.json"));
|
|
1944
2066
|
if (buildManifest) {
|
|
1945
|
-
clientEntryFile = findClientEntryFile({
|
|
2067
|
+
if (!clientEntryFile) clientEntryFile = (hasAppDir && hasPagesDir ? findPagesClientEntryFile : findClientEntryFile)({
|
|
1946
2068
|
buildManifest,
|
|
1947
2069
|
clientDir,
|
|
1948
2070
|
assetsSubdir: resolveAssetsDir(nextConfig?.assetPrefix),
|
|
@@ -1958,9 +2080,15 @@ function vinext(options = {}) {
|
|
|
1958
2080
|
} catch {}
|
|
1959
2081
|
if (hasAppDir) {
|
|
1960
2082
|
const workerEntry = path.resolve(distDir, "server", "index.js");
|
|
1961
|
-
if (
|
|
2083
|
+
if (!clientEntryFile && hasPagesDir) clientEntryFile = findPagesClientEntryFile({
|
|
2084
|
+
clientDir,
|
|
2085
|
+
assetsSubdir: resolveAssetsDir(nextConfig?.assetPrefix),
|
|
2086
|
+
assetBase: clientBase
|
|
2087
|
+
}) ?? null;
|
|
2088
|
+
if (fs.existsSync(workerEntry) && (lazyChunksData || ssrManifestData || hasPagesDir && clientEntryFile)) {
|
|
1962
2089
|
let code = fs.readFileSync(workerEntry, "utf-8");
|
|
1963
2090
|
const globals = [];
|
|
2091
|
+
if (hasPagesDir && clientEntryFile) globals.push(`globalThis.__VINEXT_CLIENT_ENTRY__ = ${JSON.stringify(clientEntryFile)};`);
|
|
1964
2092
|
if (ssrManifestData) globals.push(`globalThis.__VINEXT_SSR_MANIFEST__ = ${JSON.stringify(ssrManifestData)};`);
|
|
1965
2093
|
if (lazyChunksData) globals.push(`globalThis.__VINEXT_LAZY_CHUNKS__ = ${JSON.stringify(lazyChunksData)};`);
|
|
1966
2094
|
code = globals.join("\n") + "\n" + code;
|
|
@@ -2005,6 +2133,7 @@ function vinext(options = {}) {
|
|
|
2005
2133
|
fs.mkdirSync(clientDir, { recursive: true });
|
|
2006
2134
|
fs.writeFileSync(headersPath, headersContent);
|
|
2007
2135
|
}
|
|
2136
|
+
ensureAssetsIgnore(clientDir);
|
|
2008
2137
|
}
|
|
2009
2138
|
}
|
|
2010
2139
|
},
|
|
@@ -2028,15 +2157,19 @@ function vinext(options = {}) {
|
|
|
2028
2157
|
` if (mod) {`,
|
|
2029
2158
|
` WebAssembly.instantiate(mod, imports).then(function(inst) { callback(inst); });`,
|
|
2030
2159
|
` } else {`,
|
|
2031
|
-
`
|
|
2032
|
-
`
|
|
2160
|
+
` Promise.all([import("node:fs"), import("node:url")]).then(function(mods) {`,
|
|
2161
|
+
` var p = mods[1].fileURLToPath(new URL("./yoga.wasm", import.meta.url));`,
|
|
2162
|
+
` return mods[0].promises.readFile(p).then(function(bytes) {`,
|
|
2163
|
+
` return WebAssembly.instantiate(bytes, imports).then(function(r) { callback(r.instance); });`,
|
|
2164
|
+
` });`,
|
|
2165
|
+
` });`,
|
|
2033
2166
|
` }`,
|
|
2034
2167
|
` });`,
|
|
2035
2168
|
` return {};`,
|
|
2036
2169
|
`} })`
|
|
2037
2170
|
].join("\n");
|
|
2038
2171
|
result = result.replace(YOGA_CALL, YOGA_CALL_PATCHED);
|
|
2039
|
-
result = [`var
|
|
2172
|
+
result = [`var __vi_yoga_mod = import("./yoga.wasm?module").then(function(m) { return m.default; }).catch(function() { return null; });`].join("\n") + "\n" + result;
|
|
2040
2173
|
}
|
|
2041
2174
|
const resvgMatch = /import\s+resvg_wasm\s+from\s+["']\.\/resvg\.wasm\?module["']\s*;?/.exec(result);
|
|
2042
2175
|
if (resvgMatch) {
|
|
@@ -2074,104 +2207,31 @@ function getNextPublicEnvDefines() {
|
|
|
2074
2207
|
return defines;
|
|
2075
2208
|
}
|
|
2076
2209
|
/**
|
|
2077
|
-
*
|
|
2078
|
-
*
|
|
2210
|
+
* Write a Web API Response to a Node.js ServerResponse.
|
|
2211
|
+
* Handles multi-value headers (Set-Cookie) correctly.
|
|
2079
2212
|
*/
|
|
2080
|
-
function
|
|
2081
|
-
const
|
|
2082
|
-
|
|
2083
|
-
|
|
2213
|
+
async function writeWebResponseToNodeRes(res, response) {
|
|
2214
|
+
const nodeHeaders = {};
|
|
2215
|
+
response.headers.forEach((value, key) => {
|
|
2216
|
+
if (key === "set-cookie") return;
|
|
2217
|
+
const existing = nodeHeaders[key];
|
|
2218
|
+
if (existing !== void 0) nodeHeaders[key] = Array.isArray(existing) ? [...existing, value] : [existing, value];
|
|
2219
|
+
else nodeHeaders[key] = value;
|
|
2084
2220
|
});
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
const hasBody = method !== "GET" && method !== "HEAD";
|
|
2098
|
-
const init = {
|
|
2099
|
-
method,
|
|
2100
|
-
headers: Object.fromEntries(Object.entries(req.headers).filter(([, v]) => v !== void 0).map(([k, v]) => [k, Array.isArray(v) ? v.join(", ") : String(v)]))
|
|
2101
|
-
};
|
|
2102
|
-
if (hasBody) {
|
|
2103
|
-
const { Readable } = await import("node:stream");
|
|
2104
|
-
init.body = Readable.toWeb(req);
|
|
2105
|
-
init.duplex = "half";
|
|
2106
|
-
}
|
|
2107
|
-
const proxyResponse = await proxyExternalRequest(new Request(new URL(req.url ?? "/", origin), init), externalUrl);
|
|
2108
|
-
const nodeHeaders = {};
|
|
2109
|
-
proxyResponse.headers.forEach((value, key) => {
|
|
2110
|
-
const existing = nodeHeaders[key];
|
|
2111
|
-
if (existing !== void 0) nodeHeaders[key] = Array.isArray(existing) ? [...existing, value] : [existing, value];
|
|
2112
|
-
else nodeHeaders[key] = value;
|
|
2221
|
+
const cookies = response.headers.getSetCookie?.() ?? [];
|
|
2222
|
+
if (cookies.length > 0) nodeHeaders["set-cookie"] = cookies;
|
|
2223
|
+
if (response.statusText) res.writeHead(response.status, response.statusText, nodeHeaders);
|
|
2224
|
+
else res.writeHead(response.status, nodeHeaders);
|
|
2225
|
+
if (response.body) {
|
|
2226
|
+
const { Readable } = await import("node:stream");
|
|
2227
|
+
const nodeStream = Readable.fromWeb(response.body);
|
|
2228
|
+
await new Promise((resolve, reject) => {
|
|
2229
|
+
nodeStream.on("error", reject);
|
|
2230
|
+
res.on("error", reject);
|
|
2231
|
+
nodeStream.pipe(res);
|
|
2232
|
+
nodeStream.on("end", resolve);
|
|
2113
2233
|
});
|
|
2114
|
-
|
|
2115
|
-
if (proxyResponse.body) {
|
|
2116
|
-
const { Readable: ReadableImport } = await import("node:stream");
|
|
2117
|
-
ReadableImport.fromWeb(proxyResponse.body).pipe(res);
|
|
2118
|
-
} else res.end();
|
|
2119
|
-
} catch (e) {
|
|
2120
|
-
console.error("[vinext] External rewrite proxy error:", e);
|
|
2121
|
-
if (!res.headersSent) {
|
|
2122
|
-
res.writeHead(502);
|
|
2123
|
-
res.end("Bad Gateway");
|
|
2124
|
-
}
|
|
2125
|
-
}
|
|
2126
|
-
}
|
|
2127
|
-
/**
|
|
2128
|
-
* Apply rewrite rules from next.config.js.
|
|
2129
|
-
* Returns the rewritten URL or null if no rewrite matched.
|
|
2130
|
-
*/
|
|
2131
|
-
function applyRewrites(pathname, rewrites, ctx, basePath = "") {
|
|
2132
|
-
const dest = matchRewrite(pathname, rewrites, ctx, {
|
|
2133
|
-
basePath,
|
|
2134
|
-
hadBasePath: true
|
|
2135
|
-
});
|
|
2136
|
-
if (dest) return sanitizeDestination(dest);
|
|
2137
|
-
return null;
|
|
2138
|
-
}
|
|
2139
|
-
/**
|
|
2140
|
-
* Apply custom header rules from next.config.js.
|
|
2141
|
-
* Middleware headers take precedence: if a header key was already set on the
|
|
2142
|
-
* response (by middleware), the config value is skipped for that key.
|
|
2143
|
-
*/
|
|
2144
|
-
function applyHeaders(pathname, res, headers, ctx, basePath = "") {
|
|
2145
|
-
const matched = matchHeaders(pathname, headers, ctx, {
|
|
2146
|
-
basePath,
|
|
2147
|
-
hadBasePath: true
|
|
2148
|
-
});
|
|
2149
|
-
for (const header of matched) {
|
|
2150
|
-
const lk = header.key.toLowerCase();
|
|
2151
|
-
if (lk === "set-cookie") {
|
|
2152
|
-
const existing = res.getHeader(lk);
|
|
2153
|
-
if (Array.isArray(existing)) res.setHeader(header.key, [...existing, header.value]);
|
|
2154
|
-
else if (existing) res.setHeader(header.key, [String(existing), header.value]);
|
|
2155
|
-
else res.setHeader(header.key, header.value);
|
|
2156
|
-
} else if (lk === "vary") {
|
|
2157
|
-
const existing = res.getHeader(lk);
|
|
2158
|
-
if (existing) res.setHeader(header.key, existing + ", " + header.value);
|
|
2159
|
-
else res.setHeader(header.key, header.value);
|
|
2160
|
-
} else if (!res.getHeader(lk)) res.setHeader(header.key, header.value);
|
|
2161
|
-
}
|
|
2162
|
-
}
|
|
2163
|
-
/**
|
|
2164
|
-
* Find a file by name (without extension) in a directory.
|
|
2165
|
-
* Checks the configured page extensions.
|
|
2166
|
-
*/
|
|
2167
|
-
function findFileWithExts(dir, name, matcher) {
|
|
2168
|
-
for (const ext of matcher.dottedExtensions) {
|
|
2169
|
-
const filePath = path.join(dir, name + ext);
|
|
2170
|
-
if (fs.existsSync(filePath)) return filePath;
|
|
2171
|
-
}
|
|
2172
|
-
return null;
|
|
2234
|
+
} else res.end();
|
|
2173
2235
|
}
|
|
2174
2236
|
//#endregion
|
|
2175
2237
|
export { vinext as default, staticExportApp, staticExportPages };
|
|
2176
|
-
|
|
2177
|
-
//# sourceMappingURL=index.js.map
|