vinext 1.0.0-beta.3 → 1.0.0-beta.5
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 +44 -3
- package/dist/build/client-build-config.d.ts +0 -1
- package/dist/build/css-url-assets.d.ts +0 -1
- package/dist/build/google-fonts/build-url.d.ts +5 -2
- package/dist/build/google-fonts/font-metadata.d.ts +7 -3
- package/dist/build/google-fonts/get-axes.d.ts +0 -1
- package/dist/build/layout-classification.d.ts +7 -4
- package/dist/build/next-client-runtime-manifests.d.ts +0 -1
- package/dist/build/next-client-runtime-manifests.js +2 -19
- package/dist/build/nitro-route-rules.d.ts +0 -1
- package/dist/build/pages-client-assets-module.d.ts +0 -1
- package/dist/build/precompress.d.ts +7 -2
- package/dist/build/precompress.js +42 -8
- package/dist/build/prerender-paths.d.ts +2 -2
- package/dist/build/prerender-server-entry.d.ts +1 -1
- package/dist/build/prerender-server-pool.d.ts +4 -2
- package/dist/build/prerender.d.ts +36 -32
- package/dist/build/prerender.js +18 -3
- package/dist/build/public-dir-conflict.d.ts +14 -0
- package/dist/build/public-dir-conflict.js +25 -0
- package/dist/build/report.d.ts +2 -2
- package/dist/build/route-classification-injector.d.ts +0 -1
- package/dist/build/route-classification-manifest.d.ts +5 -3
- package/dist/build/run-prerender.d.ts +3 -2
- package/dist/build/static-export.d.ts +23 -12
- package/dist/cache/cache-adapters-virtual.d.ts +5 -2
- package/dist/check.js +4 -4
- package/dist/cli-args.d.ts +2 -1
- package/dist/cli-args.js +10 -0
- package/dist/cli-dev-config.d.ts +0 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +14 -8
- package/dist/client/client-rewrite-matcher.d.ts +12 -0
- package/dist/client/client-rewrite-matcher.js +20 -0
- package/dist/client/client-rewrites.d.ts +31 -0
- package/dist/client/client-rewrites.js +41 -0
- package/dist/client/dev-error-overlay.d.ts +0 -1
- package/dist/client/empty-module.d.ts +1 -1
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +2 -0
- package/dist/client/instrumentation-client-state.d.ts +0 -1
- package/dist/client/navigation-runtime.d.ts +12 -1
- package/dist/client/navigation-runtime.js +6 -2
- package/dist/client/pages-router-link-navigation.d.ts +3 -21
- package/dist/client/react-instance-bootstrap.d.ts +1 -0
- package/dist/client/react-instance-bootstrap.js +7 -0
- package/dist/client/react-instance.d.ts +13 -0
- package/dist/client/react-instance.js +20 -0
- package/dist/client/vinext-next-data.d.ts +11 -6
- package/dist/client/window-next.d.ts +5 -2
- package/dist/config/config-matchers.d.ts +3 -5
- package/dist/config/config-matchers.js +7 -6
- package/dist/config/dotenv.d.ts +4 -9
- package/dist/config/dotenv.js +30 -22
- package/dist/config/next-config.d.ts +113 -52
- package/dist/config/next-config.js +6 -0
- package/dist/config/prerender.d.ts +0 -1
- package/dist/entries/app-browser-entry.d.ts +0 -1
- package/dist/entries/app-browser-entry.js +7 -3
- package/dist/entries/app-rsc-entry.d.ts +30 -16
- package/dist/entries/app-rsc-entry.js +40 -12
- package/dist/entries/app-rsc-manifest.d.ts +0 -1
- package/dist/entries/app-rsc-manifest.js +1 -0
- package/dist/entries/pages-client-entry.d.ts +0 -1
- package/dist/entries/pages-client-entry.js +7 -2
- package/dist/entries/pages-server-entry.d.ts +1 -2
- package/dist/entries/pages-server-entry.js +25 -6
- package/dist/image/image-adapters-virtual.d.ts +4 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +257 -75
- package/dist/init-cloudflare.d.ts +0 -1
- package/dist/init-platform.d.ts +0 -1
- package/dist/init.d.ts +40 -20
- package/dist/plugins/ast-scope.d.ts +0 -1
- package/dist/plugins/async-hooks-stub.d.ts +0 -1
- package/dist/plugins/client-reference-dedup.d.ts +0 -1
- package/dist/plugins/client-reference-dedup.js +7 -5
- package/dist/plugins/css-data-url.d.ts +0 -1
- package/dist/plugins/css-module-imports.d.ts +0 -1
- package/dist/plugins/dynamic-preload-metadata.d.ts +0 -1
- package/dist/plugins/extensionless-dynamic-import.d.ts +0 -1
- package/dist/plugins/extensionless-dynamic-import.js +352 -13
- package/dist/plugins/fonts.d.ts +0 -1
- package/dist/plugins/ignore-dynamic-requests.d.ts +0 -1
- package/dist/plugins/ignore-dynamic-requests.js +28 -4
- package/dist/plugins/import-meta-url.d.ts +0 -1
- package/dist/plugins/instrumentation-client.d.ts +0 -1
- package/dist/plugins/middleware-server-only.d.ts +0 -1
- package/dist/plugins/og-asset-ownership.d.ts +0 -1
- package/dist/plugins/og-assets.d.ts +0 -1
- package/dist/plugins/optimize-imports.d.ts +0 -1
- package/dist/plugins/remove-console.d.ts +0 -1
- package/dist/plugins/require-context.d.ts +0 -1
- package/dist/plugins/require-context.js +143 -26
- package/dist/plugins/rsc-client-reference-loaders.d.ts +0 -1
- package/dist/plugins/rsc-reference-validation-normalizer.d.ts +0 -1
- package/dist/plugins/sass.d.ts +30 -2
- package/dist/plugins/sass.js +67 -5
- package/dist/plugins/server-externals-manifest.d.ts +0 -1
- package/dist/plugins/strip-server-exports.d.ts +0 -1
- package/dist/plugins/styled-jsx.d.ts +0 -1
- package/dist/plugins/wasm-module-import.d.ts +0 -1
- package/dist/routing/app-route-graph.d.ts +115 -56
- package/dist/routing/app-route-graph.js +2 -1
- package/dist/routing/app-router.d.ts +0 -1
- package/dist/routing/pages-router.d.ts +9 -5
- package/dist/routing/route-matching.d.ts +0 -1
- package/dist/routing/utils.d.ts +1 -23
- package/dist/routing/utils.js +1 -30
- package/dist/server/accept-encoding.d.ts +0 -1
- package/dist/server/api-handler.d.ts +0 -1
- package/dist/server/api-handler.js +4 -3
- package/dist/server/app-bfcache-identity.d.ts +9 -10
- package/dist/server/app-bfcache-identity.js +27 -102
- package/dist/server/app-browser-action-result.d.ts +0 -1
- package/dist/server/app-browser-client-reuse-manifest.d.ts +0 -1
- package/dist/server/app-browser-entry.d.ts +1 -1
- package/dist/server/app-browser-entry.js +106 -66
- package/dist/server/app-browser-history-controller.d.ts +8 -5
- package/dist/server/app-browser-hydration.d.ts +0 -1
- package/dist/server/app-browser-interception-context.d.ts +0 -1
- package/dist/server/app-browser-mpa-navigation.d.ts +0 -1
- package/dist/server/app-browser-navigation-controller.d.ts +3 -6
- package/dist/server/app-browser-navigation-controller.js +29 -4
- package/dist/server/app-browser-popstate.d.ts +0 -1
- package/dist/server/app-browser-prefetch-response.d.ts +25 -0
- package/dist/server/app-browser-prefetch-response.js +54 -0
- package/dist/server/app-browser-server-action-client.d.ts +1 -1
- package/dist/server/app-browser-server-action-client.js +3 -2
- package/dist/server/app-browser-server-action-navigation.d.ts +0 -1
- package/dist/server/app-browser-state.d.ts +11 -5
- package/dist/server/app-browser-state.js +10 -6
- package/dist/server/app-browser-stream.d.ts +0 -1
- package/dist/server/app-browser-visible-commit.d.ts +1 -1
- package/dist/server/app-browser-visible-commit.js +6 -2
- package/dist/server/app-elements-wire.d.ts +16 -13
- package/dist/server/app-elements-wire.js +37 -10
- package/dist/server/app-elements.d.ts +2 -3
- package/dist/server/app-elements.js +2 -2
- package/dist/server/app-fallback-renderer.d.ts +8 -4
- package/dist/server/app-fallback-renderer.js +2 -1
- package/dist/server/app-history-state.d.ts +2 -2
- package/dist/server/app-history-state.js +1 -1
- package/dist/server/app-hook-warning-suppression.d.ts +0 -1
- package/dist/server/app-layout-param-observation.d.ts +0 -1
- package/dist/server/app-layout-param-observation.js +1 -1
- package/dist/server/app-middleware.d.ts +5 -1
- package/dist/server/app-middleware.js +96 -31
- package/dist/server/app-optimistic-routing.d.ts +1 -0
- package/dist/server/app-page-boundary-render.d.ts +8 -4
- package/dist/server/app-page-cache-finalizer.d.ts +2 -3
- package/dist/server/app-page-cache-finalizer.js +47 -17
- package/dist/server/app-page-cache-render.d.ts +2 -2
- package/dist/server/app-page-cache-render.js +2 -1
- package/dist/server/app-page-cache.d.ts +1 -3
- package/dist/server/app-page-cache.js +22 -11
- package/dist/server/app-page-dispatch.d.ts +12 -6
- package/dist/server/app-page-dispatch.js +14 -6
- package/dist/server/app-page-element-builder.d.ts +63 -20
- package/dist/server/app-page-element-builder.js +114 -43
- package/dist/server/app-page-execution.d.ts +12 -5
- package/dist/server/app-page-execution.js +1 -1
- package/dist/server/app-page-head.d.ts +2 -2
- package/dist/server/app-page-http-access-fallback-metadata.d.ts +2 -2
- package/dist/server/app-page-params.d.ts +0 -1
- package/dist/server/app-page-ppr-runtime.d.ts +0 -1
- package/dist/server/app-page-probe.d.ts +4 -3
- package/dist/server/app-page-probe.js +1 -1
- package/dist/server/app-page-render-identity.d.ts +1 -0
- package/dist/server/app-page-render-observation.d.ts +0 -1
- package/dist/server/app-page-render.d.ts +7 -5
- package/dist/server/app-page-render.js +59 -24
- package/dist/server/app-page-request.d.ts +3 -2
- package/dist/server/app-page-request.js +6 -46
- package/dist/server/app-page-response.d.ts +15 -3
- package/dist/server/app-page-response.js +21 -3
- package/dist/server/app-page-route-wiring.d.ts +30 -7
- package/dist/server/app-page-route-wiring.js +163 -63
- package/dist/server/app-page-search-params-observation.d.ts +0 -1
- package/dist/server/app-page-segment-plan.d.ts +56 -0
- package/dist/server/app-page-segment-plan.js +177 -0
- package/dist/server/app-page-segment-state.d.ts +18 -2
- package/dist/server/app-page-segment-state.js +23 -4
- package/dist/server/app-page-stream.d.ts +19 -10
- package/dist/server/app-pages-bridge.d.ts +2 -2
- package/dist/server/app-pages-bridge.js +14 -2
- package/dist/server/app-post-middleware-context.d.ts +0 -1
- package/dist/server/app-ppr-fallback-shell-render.d.ts +0 -1
- package/dist/server/app-prerender-endpoints.d.ts +0 -1
- package/dist/server/app-prerender-static-params.d.ts +0 -1
- package/dist/server/app-render-dependency.d.ts +11 -4
- package/dist/server/app-render-dependency.js +59 -9
- package/dist/server/app-request-context.d.ts +1 -0
- package/dist/server/app-route-handler-cache.d.ts +2 -2
- package/dist/server/app-route-handler-cache.js +5 -1
- package/dist/server/app-route-handler-dispatch.d.ts +0 -1
- package/dist/server/app-route-handler-execution.d.ts +2 -2
- package/dist/server/app-route-handler-execution.js +5 -1
- package/dist/server/app-route-handler-policy.d.ts +0 -1
- package/dist/server/app-route-handler-response.d.ts +0 -1
- package/dist/server/app-route-handler-runtime.d.ts +0 -1
- package/dist/server/app-route-handler-runtime.js +1 -2
- package/dist/server/app-route-module-loader.d.ts +32 -6
- package/dist/server/app-route-module-loader.js +73 -3
- package/dist/server/app-router-entry.d.ts +0 -1
- package/dist/server/app-router-entry.js +2 -2
- package/dist/server/app-rsc-cache-busting.d.ts +7 -1
- package/dist/server/app-rsc-cache-busting.js +6 -0
- package/dist/server/app-rsc-handler.d.ts +9 -2
- package/dist/server/app-rsc-handler.js +173 -41
- package/dist/server/app-rsc-redirect-flight.d.ts +0 -1
- package/dist/server/app-rsc-render-mode.d.ts +3 -2
- package/dist/server/app-rsc-render-mode.js +4 -1
- package/dist/server/app-rsc-request-normalization.d.ts +19 -10
- package/dist/server/app-rsc-request-normalization.js +65 -4
- package/dist/server/app-rsc-response-finalizer.d.ts +5 -2
- package/dist/server/app-rsc-response-finalizer.js +31 -18
- package/dist/server/app-rsc-route-matching.d.ts +6 -1
- package/dist/server/app-rsc-route-matching.js +47 -2
- package/dist/server/app-segment-config.d.ts +0 -1
- package/dist/server/app-server-action-execution.d.ts +42 -9
- package/dist/server/app-server-action-execution.js +189 -111
- package/dist/server/app-ssr-entry.d.ts +5 -3
- package/dist/server/app-ssr-entry.js +4 -5
- package/dist/server/app-ssr-router-instance.d.ts +0 -1
- package/dist/server/app-ssr-stream.d.ts +7 -1
- package/dist/server/app-ssr-stream.js +2 -1
- package/dist/server/app-static-generation.d.ts +0 -1
- package/dist/server/app-visited-response-cache.d.ts +7 -2
- package/dist/server/app-visited-response-cache.js +49 -1
- package/dist/server/before-interactive-head.d.ts +0 -1
- package/dist/server/before-interactive-head.js +2 -0
- package/dist/server/bfcache-identity.d.ts +45 -0
- package/dist/server/bfcache-identity.js +52 -0
- package/dist/server/cache-control.d.ts +3 -3
- package/dist/server/cache-control.js +3 -2
- package/dist/server/cache-proof.d.ts +0 -1
- package/dist/server/client-reuse-manifest.d.ts +0 -1
- package/dist/server/config-headers.d.ts +2 -2
- package/dist/server/csp.d.ts +0 -1
- package/dist/server/default-global-error-module.d.ts +0 -1
- package/dist/server/default-global-not-found-module.d.ts +0 -1
- package/dist/server/default-not-found-module.d.ts +0 -1
- package/dist/server/dev-lockfile.d.ts +21 -9
- package/dist/server/dev-module-runner.d.ts +0 -1
- package/dist/server/dev-route-files.d.ts +0 -1
- package/dist/server/dev-server.d.ts +4 -8
- package/dist/server/dev-server.js +86 -131
- package/dist/server/dev-stack-sourcemap.d.ts +0 -1
- package/dist/server/document-initial-head.d.ts +12 -2
- package/dist/server/document-initial-head.js +17 -2
- package/dist/server/edge-api-runtime.d.ts +10 -1
- package/dist/server/edge-api-runtime.js +29 -1
- package/dist/server/file-based-metadata.d.ts +0 -1
- package/dist/server/headers.d.ts +17 -2
- package/dist/server/headers.js +17 -1
- package/dist/server/http-conditional.d.ts +22 -0
- package/dist/server/http-conditional.js +117 -0
- package/dist/server/http-date.d.ts +5 -0
- package/dist/server/http-date.js +73 -0
- package/dist/server/http-error-responses.d.ts +2 -1
- package/dist/server/http-error-responses.js +14 -2
- package/dist/server/http-range.d.ts +25 -0
- package/dist/server/http-range.js +67 -0
- package/dist/server/image-optimization.d.ts +14 -6
- package/dist/server/image-optimization.js +0 -1
- package/dist/server/instrumentation.d.ts +7 -4
- package/dist/server/isr-cache.d.ts +28 -6
- package/dist/server/isr-cache.js +19 -13
- package/dist/server/isr-decision.d.ts +6 -4
- package/dist/server/metadata-route-build-data.d.ts +0 -1
- package/dist/server/metadata-route-response.d.ts +0 -1
- package/dist/server/metadata-route-response.js +7 -6
- package/dist/server/metadata-routes.d.ts +34 -16
- package/dist/server/middleware-matcher-pattern.d.ts +0 -1
- package/dist/server/middleware-matcher.d.ts +8 -3
- package/dist/server/middleware-matcher.js +23 -18
- package/dist/server/middleware-runtime.d.ts +6 -1
- package/dist/server/middleware-runtime.js +91 -28
- package/dist/server/middleware.d.ts +0 -1
- package/dist/server/navigation-planner.d.ts +1 -1
- package/dist/server/next-error-digest.d.ts +0 -1
- package/dist/server/pages-api-route.d.ts +2 -1
- package/dist/server/pages-api-route.js +32 -7
- package/dist/server/pages-asset-tags.d.ts +3 -1
- package/dist/server/pages-asset-tags.js +6 -4
- package/dist/server/pages-data-route.d.ts +14 -6
- package/dist/server/pages-data-route.js +19 -10
- package/dist/server/pages-dev-hydration.js +3 -0
- package/dist/server/pages-dev-stylesheets.d.ts +10 -0
- package/dist/server/pages-dev-stylesheets.js +150 -0
- package/dist/server/pages-document-asset-props.d.ts +26 -0
- package/dist/server/pages-document-asset-props.js +69 -0
- package/dist/server/pages-document-initial-props.d.ts +10 -6
- package/dist/server/pages-get-initial-props.d.ts +2 -2
- package/dist/server/pages-i18n.d.ts +1 -7
- package/dist/server/pages-node-compat.d.ts +11 -2
- package/dist/server/pages-node-compat.js +52 -5
- package/dist/server/pages-page-data.d.ts +21 -9
- package/dist/server/pages-page-data.js +109 -30
- package/dist/server/pages-page-handler.d.ts +70 -32
- package/dist/server/pages-page-handler.js +25 -6
- package/dist/server/pages-page-response.d.ts +9 -13
- package/dist/server/pages-page-response.js +25 -26
- package/dist/server/pages-readiness.d.ts +0 -1
- package/dist/server/pages-request-pipeline.d.ts +20 -6
- package/dist/server/pages-request-pipeline.js +40 -20
- package/dist/server/pages-revalidate.d.ts +0 -1
- package/dist/server/pages-revalidate.js +1 -1
- package/dist/server/pages-router-entry.js +14 -10
- package/dist/server/prerender-manifest.d.ts +7 -0
- package/dist/server/prod-server.d.ts +13 -7
- package/dist/server/prod-server.js +276 -83
- package/dist/server/proxy-trust.d.ts +0 -1
- package/dist/server/request-log.d.ts +7 -11
- package/dist/server/request-pipeline.d.ts +13 -4
- package/dist/server/request-pipeline.js +28 -20
- package/dist/server/revalidation-host.d.ts +0 -1
- package/dist/server/revalidation-host.js +1 -1
- package/dist/server/rsc-completion-metadata.d.ts +15 -0
- package/dist/server/rsc-completion-metadata.js +183 -0
- package/dist/server/seed-cache.d.ts +2 -1
- package/dist/server/seed-cache.js +8 -5
- package/dist/server/skip-cache-proof.d.ts +0 -1
- package/dist/server/static-file-cache.d.ts +23 -9
- package/dist/server/static-file-cache.js +47 -23
- package/dist/server/static-layout-client-reuse-proof.d.ts +0 -1
- package/dist/server/worker-revalidation-context.d.ts +0 -1
- package/dist/server/worker-revalidation-context.js +1 -0
- package/dist/server/worker-utils.d.ts +3 -1
- package/dist/server/worker-utils.js +11 -2
- package/dist/shims/app-router-scroll-state.d.ts +2 -1
- package/dist/shims/app-router-scroll-state.js +7 -2
- package/dist/shims/app-router-scroll.d.ts +2 -8
- package/dist/shims/app.d.ts +1 -5
- package/dist/shims/before-interactive-context.d.ts +5 -3
- package/dist/shims/cache-handler.d.ts +6 -1
- package/dist/shims/cache-handler.js +4 -2
- package/dist/shims/cache-request-state.d.ts +12 -1
- package/dist/shims/cache-request-state.js +22 -1
- package/dist/shims/cache-runtime.d.ts +9 -5
- package/dist/shims/cache-runtime.js +16 -6
- package/dist/shims/cache.d.ts +2 -3
- package/dist/shims/cache.js +2 -2
- package/dist/shims/cdn-cache.d.ts +0 -1
- package/dist/shims/client-locale.d.ts +1 -6
- package/dist/shims/client-only.d.ts +1 -1
- package/dist/shims/compat-router.d.ts +0 -1
- package/dist/shims/constants.d.ts +1 -1
- package/dist/shims/default-global-error.d.ts +1 -4
- package/dist/shims/default-not-found.d.ts +0 -1
- package/dist/shims/document.d.ts +0 -1
- package/dist/shims/document.js +17 -3
- package/dist/shims/dynamic-preload-chunks.d.ts +0 -1
- package/dist/shims/dynamic.d.ts +0 -1
- package/dist/shims/error-boundary-navigation.d.ts +0 -1
- package/dist/shims/error-boundary.d.ts +7 -32
- package/dist/shims/error.d.ts +1 -6
- package/dist/shims/fetch-cache.js +112 -63
- package/dist/shims/font-google-base.d.ts +0 -1
- package/dist/shims/font-local.d.ts +0 -1
- package/dist/shims/form.d.ts +5 -3
- package/dist/shims/hash-scroll.d.ts +1 -1
- package/dist/shims/hash-scroll.js +2 -1
- package/dist/shims/head-state.d.ts +0 -1
- package/dist/shims/head.d.ts +1 -4
- package/dist/shims/headers.d.ts +2 -2
- package/dist/shims/headers.js +1 -1
- package/dist/shims/i18n-context.d.ts +0 -1
- package/dist/shims/i18n-state.d.ts +0 -1
- package/dist/shims/image.d.ts +0 -1
- package/dist/shims/image.js +1 -2
- package/dist/shims/internal/als-registry.d.ts +31 -2
- package/dist/shims/internal/als-registry.js +50 -2
- package/dist/shims/internal/app-prefetch-fetch-queue.d.ts +17 -2
- package/dist/shims/internal/app-prefetch-fetch-queue.js +69 -7
- package/dist/shims/internal/app-route-detection.d.ts +0 -1
- package/dist/shims/internal/app-route-prefetch-policy.d.ts +31 -0
- package/dist/shims/internal/app-route-prefetch-policy.js +57 -0
- package/dist/shims/internal/app-router-context.d.ts +0 -1
- package/dist/shims/internal/hybrid-client-route-owner-direct.d.ts +1 -5
- package/dist/shims/internal/hybrid-client-route-owner.d.ts +0 -1
- package/dist/shims/internal/hybrid-client-route-owner.js +6 -8
- package/dist/shims/internal/interpolate-as.d.ts +3 -2
- package/dist/shims/internal/pages-data-target.d.ts +21 -10
- package/dist/shims/internal/pages-data-target.js +1 -1
- package/dist/shims/internal/pages-data-url.d.ts +3 -1
- package/dist/shims/internal/router-context.d.ts +0 -1
- package/dist/shims/internal/work-unit-async-storage.d.ts +4 -3
- package/dist/shims/internal/work-unit-async-storage.js +2 -0
- package/dist/shims/layout-segment-context.d.ts +2 -6
- package/dist/shims/legacy-image.d.ts +0 -1
- package/dist/shims/link.d.ts +29 -21
- package/dist/shims/link.js +52 -97
- package/dist/shims/metadata.d.ts +11 -25
- package/dist/shims/metadata.js +24 -32
- package/dist/shims/navigation-context-state.d.ts +0 -1
- package/dist/shims/navigation-state.d.ts +1 -0
- package/dist/shims/navigation.d.ts +54 -6
- package/dist/shims/navigation.js +325 -73
- package/dist/shims/navigation.react-server.d.ts +1 -0
- package/dist/shims/og.d.ts +0 -1
- package/dist/shims/request-context.d.ts +8 -3
- package/dist/shims/request-state-types.d.ts +1 -0
- package/dist/shims/router.d.ts +44 -23
- package/dist/shims/router.js +8 -7
- package/dist/shims/script-nonce-context.d.ts +0 -1
- package/dist/shims/script.d.ts +25 -13
- package/dist/shims/server-only.d.ts +1 -1
- package/dist/shims/server.d.ts +1 -3
- package/dist/shims/server.js +5 -6
- package/dist/shims/slot.d.ts +23 -11
- package/dist/shims/slot.js +103 -19
- package/dist/shims/streamed-icons.d.ts +7 -0
- package/dist/shims/streamed-icons.js +33 -0
- package/dist/shims/unified-request-context.d.ts +44 -4
- package/dist/shims/unified-request-context.js +56 -2
- package/dist/shims/use-merged-ref.d.ts +0 -1
- package/dist/shims/web-vitals.d.ts +0 -1
- package/dist/typegen.d.ts +1 -2
- package/dist/typegen.js +1 -1
- package/dist/utils/cache-control-metadata.d.ts +13 -1
- package/dist/utils/cache-control-metadata.js +17 -1
- package/dist/utils/client-build-manifest.d.ts +0 -1
- package/dist/utils/domain-locale.d.ts +1 -5
- package/dist/utils/html-limited-bots.js +1 -1
- package/dist/utils/middleware-request-headers.d.ts +17 -5
- package/dist/utils/middleware-request-headers.js +32 -23
- package/dist/utils/precompressed-variant.d.ts +9 -0
- package/dist/utils/precompressed-variant.js +15 -0
- package/dist/utils/project.d.ts +12 -7
- package/dist/utils/public-file-path.d.ts +5 -0
- package/dist/utils/public-file-path.js +12 -0
- package/dist/utils/public-routes.d.ts +1 -1
- package/dist/utils/public-routes.js +6 -5
- package/package.json +7 -3
|
@@ -1,24 +1,32 @@
|
|
|
1
1
|
import { ResolvedNextConfig } from "../config/next-config.js";
|
|
2
2
|
import { Route } from "../routing/pages-router.js";
|
|
3
3
|
import { AppRoute } from "../routing/app-route-graph.js";
|
|
4
|
-
|
|
5
4
|
//#region src/build/static-export.d.ts
|
|
6
5
|
type StaticExportOptions = {
|
|
7
6
|
/**
|
|
8
7
|
* Absolute path to the pre-built Pages Router server bundle
|
|
9
8
|
* (e.g. `dist/server/entry.js`).
|
|
10
9
|
*/
|
|
11
|
-
pagesBundlePath: string;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
pagesBundlePath: string;
|
|
11
|
+
/** Discovered page routes (excludes API routes) */
|
|
12
|
+
routes: Route[];
|
|
13
|
+
/** Discovered API routes */
|
|
14
|
+
apiRoutes: Route[];
|
|
15
|
+
/** Pages directory path */
|
|
16
|
+
pagesDir: string;
|
|
17
|
+
/** Output directory for static files */
|
|
18
|
+
outDir: string;
|
|
19
|
+
/** Resolved next.config.js */
|
|
16
20
|
config: ResolvedNextConfig;
|
|
17
21
|
};
|
|
18
22
|
type StaticExportResult = {
|
|
19
|
-
/** Number of HTML files generated */
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
/** Number of HTML files generated */
|
|
24
|
+
pageCount: number;
|
|
25
|
+
/** Generated file paths (relative to outDir) */
|
|
26
|
+
files: string[];
|
|
27
|
+
/** Warnings encountered */
|
|
28
|
+
warnings: string[];
|
|
29
|
+
/** Errors encountered (non-fatal, specific pages) */
|
|
22
30
|
errors: Array<{
|
|
23
31
|
route: string;
|
|
24
32
|
error: string;
|
|
@@ -31,7 +39,8 @@ type StaticExportResult = {
|
|
|
31
39
|
*/
|
|
32
40
|
declare function staticExportPages(options: StaticExportOptions): Promise<StaticExportResult>;
|
|
33
41
|
type AppStaticExportOptions = {
|
|
34
|
-
/** Discovered app routes */
|
|
42
|
+
/** Discovered app routes */
|
|
43
|
+
routes: AppRoute[];
|
|
35
44
|
/**
|
|
36
45
|
* App directory path. When provided, static export scans it for file-based
|
|
37
46
|
* metadata assets such as icon.png and sitemap.xml.
|
|
@@ -41,8 +50,10 @@ type AppStaticExportOptions = {
|
|
|
41
50
|
* Absolute path to the pre-built RSC handler bundle
|
|
42
51
|
* (e.g. `dist/server/index.js`).
|
|
43
52
|
*/
|
|
44
|
-
rscBundlePath: string;
|
|
45
|
-
|
|
53
|
+
rscBundlePath: string;
|
|
54
|
+
/** Output directory */
|
|
55
|
+
outDir: string;
|
|
56
|
+
/** Resolved next.config.js */
|
|
46
57
|
config: ResolvedNextConfig;
|
|
47
58
|
};
|
|
48
59
|
/**
|
|
@@ -11,7 +11,8 @@ type CacheAdapterDescriptor<O extends Record<string, unknown> = Record<string, u
|
|
|
11
11
|
* Module specifier (or absolute path, e.g. from `require.resolve(...)`) whose
|
|
12
12
|
* default export is a cache adapter factory.
|
|
13
13
|
*/
|
|
14
|
-
adapter: string;
|
|
14
|
+
adapter: string;
|
|
15
|
+
/** JSON-serializable options forwarded to the factory at runtime. */
|
|
15
16
|
options?: O;
|
|
16
17
|
};
|
|
17
18
|
/**
|
|
@@ -20,7 +21,9 @@ type CacheAdapterDescriptor<O extends Record<string, unknown> = Record<string, u
|
|
|
20
21
|
* from a worker entry.
|
|
21
22
|
*/
|
|
22
23
|
type VinextCacheConfig = {
|
|
23
|
-
/** Page-level ISR serving strategy (CDN cache adapter). */
|
|
24
|
+
/** Page-level ISR serving strategy (CDN cache adapter). */
|
|
25
|
+
cdn?: CacheAdapterDescriptor;
|
|
26
|
+
/** Data cache (fetch / `"use cache"` / `unstable_cache`) handler. */
|
|
24
27
|
data?: CacheAdapterDescriptor;
|
|
25
28
|
};
|
|
26
29
|
/** Public virtual module id imported by the server entries. */
|
package/dist/check.js
CHANGED
|
@@ -295,12 +295,12 @@ const CONFIG_SUPPORT = {
|
|
|
295
295
|
detail: "not recognized; instrumentation files are enabled automatically"
|
|
296
296
|
},
|
|
297
297
|
skipMiddlewareUrlNormalize: {
|
|
298
|
-
status: "
|
|
299
|
-
detail: "
|
|
298
|
+
status: "partial",
|
|
299
|
+
detail: "preserves raw Pages Router _next/data URLs passed to middleware"
|
|
300
300
|
},
|
|
301
301
|
skipProxyUrlNormalize: {
|
|
302
|
-
status: "
|
|
303
|
-
detail: "
|
|
302
|
+
status: "partial",
|
|
303
|
+
detail: "preserves raw Pages Router _next/data URLs passed to proxy"
|
|
304
304
|
},
|
|
305
305
|
"i18n.domains": {
|
|
306
306
|
status: "partial",
|
package/dist/cli-args.d.ts
CHANGED
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
* CLI argument parser for the vinext CLI.
|
|
4
4
|
*
|
|
5
5
|
* Parses flags for `vinext dev`, `vinext start`, `vinext build`, etc.
|
|
6
|
-
* Validates that value-taking flags (`--port`, `--hostname`) have actual values
|
|
6
|
+
* Validates that value-taking flags (`--port`, `--hostname`, `--mode`) have actual values
|
|
7
7
|
* rather than silently consuming the next flag or returning NaN/undefined.
|
|
8
8
|
*/
|
|
9
9
|
type ParsedArgs = {
|
|
10
10
|
port?: number;
|
|
11
11
|
hostname?: string;
|
|
12
|
+
mode?: string;
|
|
12
13
|
help?: boolean;
|
|
13
14
|
verbose?: boolean;
|
|
14
15
|
turbopack?: boolean;
|
package/dist/cli-args.js
CHANGED
|
@@ -96,6 +96,10 @@ function parseArgs(args) {
|
|
|
96
96
|
result.hostname = takeValue(arg, args, i);
|
|
97
97
|
i++;
|
|
98
98
|
break;
|
|
99
|
+
case "--mode":
|
|
100
|
+
result.mode = takeValue(arg, args, i);
|
|
101
|
+
i++;
|
|
102
|
+
break;
|
|
99
103
|
default: {
|
|
100
104
|
const eqRaw = tryEqualsForm(arg, "port");
|
|
101
105
|
if (eqRaw !== null) {
|
|
@@ -108,6 +112,12 @@ function parseArgs(args) {
|
|
|
108
112
|
result.hostname = hostRaw;
|
|
109
113
|
break;
|
|
110
114
|
}
|
|
115
|
+
const modeRaw = tryEqualsForm(arg, "mode");
|
|
116
|
+
if (modeRaw !== null) {
|
|
117
|
+
if (modeRaw === "") throw new Error(`--mode requires a value, but none was provided.`);
|
|
118
|
+
result.mode = modeRaw;
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
111
121
|
const prerenderConcurrencyRaw = tryEqualsForm(arg, "prerender-concurrency");
|
|
112
122
|
if (prerenderConcurrencyRaw !== null) {
|
|
113
123
|
result.prerenderConcurrency = parsePositiveIntegerArg(prerenderConcurrencyRaw, "--prerender-concurrency");
|
package/dist/cli-dev-config.d.ts
CHANGED
package/dist/cli.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {}
|
package/dist/cli.js
CHANGED
|
@@ -6,6 +6,7 @@ import { parseArgs } from "./cli-args.js";
|
|
|
6
6
|
import { createDevServerConfigPlugin, normalizeDevServerHostname } from "./cli-dev-config.js";
|
|
7
7
|
import { PHASE_PRODUCTION_BUILD } from "./shims/constants.js";
|
|
8
8
|
import { createRscCompatibilityId, findVinextNextConfigInPlugins, loadNextConfig, resolveNextConfig, resolveNextConfigInput } from "./config/next-config.js";
|
|
9
|
+
import { loadDotenv } from "./config/dotenv.js";
|
|
9
10
|
import { generateRouteTypes } from "./typegen.js";
|
|
10
11
|
import { clearPagesClientAssetsBuildMetadata } from "./build/pages-client-assets-module.js";
|
|
11
12
|
import { runWithPreviewBuildCredentials } from "./build/preview-credentials.js";
|
|
@@ -16,7 +17,6 @@ import { emitPrerenderPathManifest } from "./build/prerender-paths.js";
|
|
|
16
17
|
import { getReactUpgradeDeps } from "./utils/react-version.js";
|
|
17
18
|
import { init } from "./init.js";
|
|
18
19
|
import { resolveInitOptions } from "./init-platform.js";
|
|
19
|
-
import { loadDotenv } from "./config/dotenv.js";
|
|
20
20
|
import { resolveVinextPackageRoot } from "./utils/vinext-root.js";
|
|
21
21
|
import { emitStandaloneOutput } from "./build/standalone.js";
|
|
22
22
|
import { cleanBuildOutput } from "./build/clean-output.js";
|
|
@@ -125,7 +125,7 @@ function createBuildLogger(vite) {
|
|
|
125
125
|
function hasPagesDir() {
|
|
126
126
|
return fs.existsSync(path.join(process.cwd(), "pages")) || fs.existsSync(path.join(process.cwd(), "src", "pages"));
|
|
127
127
|
}
|
|
128
|
-
async function loadBuildViteConfigMetadata(vite, root) {
|
|
128
|
+
async function loadBuildViteConfigMetadata(vite, root, mode) {
|
|
129
129
|
if (!hasViteConfig(root)) return {
|
|
130
130
|
nextConfig: null,
|
|
131
131
|
prerenderConfig: null,
|
|
@@ -133,7 +133,7 @@ async function loadBuildViteConfigMetadata(vite, root) {
|
|
|
133
133
|
};
|
|
134
134
|
const loaded = await vite.loadConfigFromFile({
|
|
135
135
|
command: "build",
|
|
136
|
-
mode
|
|
136
|
+
mode
|
|
137
137
|
}, void 0, root);
|
|
138
138
|
const emptyOutDir = loaded?.config.build?.emptyOutDir;
|
|
139
139
|
return {
|
|
@@ -148,14 +148,16 @@ async function loadBuildViteConfigMetadata(vite, root) {
|
|
|
148
148
|
* project, Vite will merge our config with it (theirs takes precedence).
|
|
149
149
|
* If there's no vite.config, this provides everything needed.
|
|
150
150
|
*/
|
|
151
|
-
function buildViteConfig(overrides = {}, logger) {
|
|
151
|
+
function buildViteConfig(overrides = {}, logger, mode) {
|
|
152
152
|
if (hasViteConfig(process.cwd())) return {
|
|
153
153
|
root: process.cwd(),
|
|
154
|
+
...mode ? { mode } : {},
|
|
154
155
|
...logger ? { customLogger: logger } : {},
|
|
155
156
|
...overrides
|
|
156
157
|
};
|
|
157
158
|
return {
|
|
158
159
|
root: process.cwd(),
|
|
160
|
+
...mode ? { mode } : {},
|
|
159
161
|
configFile: false,
|
|
160
162
|
plugins: [vinext()],
|
|
161
163
|
resolve: { dedupe: [
|
|
@@ -274,10 +276,12 @@ async function dev() {
|
|
|
274
276
|
async function buildApp() {
|
|
275
277
|
const parsed = parseArgs(rawArgs);
|
|
276
278
|
if (parsed.help) return printHelp("build");
|
|
279
|
+
const buildMode = parsed.mode ?? "production";
|
|
280
|
+
if (!process.env.NODE_ENV) Reflect.set(process.env, "NODE_ENV", "production");
|
|
277
281
|
if (parsed.precompress) process.env.VINEXT_PRECOMPRESS = "1";
|
|
278
282
|
loadDotenv({
|
|
279
283
|
root: process.cwd(),
|
|
280
|
-
mode:
|
|
284
|
+
mode: buildMode
|
|
281
285
|
});
|
|
282
286
|
applyViteConfigCompatibility(process.cwd());
|
|
283
287
|
const vite = await loadVite();
|
|
@@ -285,7 +289,7 @@ async function buildApp() {
|
|
|
285
289
|
console.log(`\n vinext build (Vite ${getViteVersion()})\n`);
|
|
286
290
|
const root = toSlash(process.cwd());
|
|
287
291
|
const isApp = hasAppDir(root);
|
|
288
|
-
const buildConfigMetadata = await loadBuildViteConfigMetadata(vite, root);
|
|
292
|
+
const buildConfigMetadata = await loadBuildViteConfigMetadata(vite, root, buildMode);
|
|
289
293
|
const resolvedNextConfig = await resolveNextConfig(buildConfigMetadata.nextConfig ? await resolveNextConfigInput(buildConfigMetadata.nextConfig, PHASE_PRODUCTION_BUILD) : await loadNextConfig(root, PHASE_PRODUCTION_BUILD), root);
|
|
290
294
|
process.env.__VINEXT_SHARED_BUILD_ID = resolvedNextConfig.buildId;
|
|
291
295
|
process.env.__VINEXT_SHARED_RSC_COMPATIBILITY_ID = createRscCompatibilityId(resolvedNextConfig);
|
|
@@ -322,7 +326,7 @@ async function buildApp() {
|
|
|
322
326
|
if (pagesClientAssetsBuildSession) process.env.__VINEXT_PAGES_CLIENT_ASSETS_BUILD_SESSION = pagesClientAssetsBuildSession;
|
|
323
327
|
await runWithPreviewBuildCredentials(async () => {
|
|
324
328
|
try {
|
|
325
|
-
const config = buildViteConfig({}, logger);
|
|
329
|
+
const config = buildViteConfig({}, logger, buildMode);
|
|
326
330
|
await (await vite.createBuilder(config)).buildApp();
|
|
327
331
|
if (isHybrid) {
|
|
328
332
|
console.log(" Building Pages Router server (hybrid)...");
|
|
@@ -331,13 +335,14 @@ async function buildApp() {
|
|
|
331
335
|
if (hasViteConfig(process.cwd())) {
|
|
332
336
|
const loaded = await vite.loadConfigFromFile({
|
|
333
337
|
command: "build",
|
|
334
|
-
mode:
|
|
338
|
+
mode: buildMode,
|
|
335
339
|
isSsrBuild: true
|
|
336
340
|
}, void 0, root);
|
|
337
341
|
if (loaded?.config.plugins) userTransformPlugins = loaded.config.plugins.flat(Infinity).filter((p) => !!p && typeof p.name === "string" && !p.name.startsWith("vinext:") && !p.name.startsWith("vite:react") && !p.name.startsWith("rsc:") && p.name !== "vite-rsc-load-module-dev-proxy" && !p.name.startsWith("vite-plugin-cloudflare"));
|
|
338
342
|
}
|
|
339
343
|
await vite.build({
|
|
340
344
|
root,
|
|
345
|
+
mode: buildMode,
|
|
341
346
|
configFile: false,
|
|
342
347
|
plugins: [...userTransformPlugins, vinext({ disableAppRouter: true })],
|
|
343
348
|
resolve: { dedupe: [
|
|
@@ -536,6 +541,7 @@ function printHelp(cmd) {
|
|
|
536
541
|
to vinext({ prerender: true }) and takes priority.
|
|
537
542
|
--prerender-concurrency <count>
|
|
538
543
|
Maximum number of routes to pre-render in parallel
|
|
544
|
+
--mode <mode> Load .env.<mode>* files and pass mode to Vite
|
|
539
545
|
--precompress Precompress static assets at build time (.br, .gz, .zst)
|
|
540
546
|
-h, --help Show this help
|
|
541
547
|
`);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RequestContext } from "../config/request-context.js";
|
|
2
|
+
import { BasePathMatchState } from "../config/config-matchers.js";
|
|
3
|
+
import { ClientRewrite } from "./client-rewrites.js";
|
|
4
|
+
//#region src/client/client-rewrite-matcher.d.ts
|
|
5
|
+
declare function matchClientRewrite(pathname: string, rewrite: ClientRewrite, context: RequestContext, basePathState: BasePathMatchState): {
|
|
6
|
+
kind: "rewrite";
|
|
7
|
+
destination: string;
|
|
8
|
+
} | {
|
|
9
|
+
kind: "server";
|
|
10
|
+
} | null;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { matchClientRewrite };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { isExternalUrl } from "../utils/external-url.js";
|
|
2
|
+
import { matchRewrite } from "../config/config-matchers.js";
|
|
3
|
+
//#region src/client/client-rewrite-matcher.ts
|
|
4
|
+
function matchClientRewrite(pathname, rewrite, context, basePathState) {
|
|
5
|
+
const destination = matchRewrite(pathname, [{
|
|
6
|
+
source: rewrite.source,
|
|
7
|
+
destination: rewrite.destination ?? "/",
|
|
8
|
+
has: rewrite.has,
|
|
9
|
+
locale: rewrite.locale,
|
|
10
|
+
basePath: rewrite.basePath
|
|
11
|
+
}], context, basePathState);
|
|
12
|
+
if (destination === null) return null;
|
|
13
|
+
if (rewrite.requiresServerEvaluation || isExternalUrl(destination)) return { kind: "server" };
|
|
14
|
+
return {
|
|
15
|
+
kind: "rewrite",
|
|
16
|
+
destination
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { matchClientRewrite };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { HasCondition, NextRewrite, ResolvedNextConfig } from "../config/next-config.js";
|
|
2
|
+
//#region src/client/client-rewrites.d.ts
|
|
3
|
+
type ClientHasCondition = Omit<HasCondition, "type"> & {
|
|
4
|
+
type: "host" | "query";
|
|
5
|
+
};
|
|
6
|
+
type ClientRewriteFields = Pick<NextRewrite, "basePath" | "locale" | "source"> & {
|
|
7
|
+
has?: ClientHasCondition[];
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Rewrite data that is safe to publish in a browser bundle.
|
|
11
|
+
*
|
|
12
|
+
* Rules that require server-only data deliberately omit both the destination
|
|
13
|
+
* and the data that made server evaluation necessary. The client can still
|
|
14
|
+
* use browser-authoritative conditions as a prefilter before handing the
|
|
15
|
+
* navigation to the server.
|
|
16
|
+
*/
|
|
17
|
+
type ClientRewrite = (ClientRewriteFields & {
|
|
18
|
+
destination: string;
|
|
19
|
+
requiresServerEvaluation?: never;
|
|
20
|
+
}) | (ClientRewriteFields & {
|
|
21
|
+
destination?: never;
|
|
22
|
+
requiresServerEvaluation: true;
|
|
23
|
+
});
|
|
24
|
+
type ClientRewrites = {
|
|
25
|
+
afterFiles: ClientRewrite[];
|
|
26
|
+
beforeFiles: ClientRewrite[];
|
|
27
|
+
fallback: ClientRewrite[];
|
|
28
|
+
};
|
|
29
|
+
declare function toClientRewrites(rewrites: ResolvedNextConfig["rewrites"]): ClientRewrites;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { ClientRewrite, ClientRewrites, toClientRewrites };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { isExternalUrl } from "../utils/external-url.js";
|
|
2
|
+
//#region src/client/client-rewrites.ts
|
|
3
|
+
function isClientHasCondition(condition) {
|
|
4
|
+
switch (condition.type) {
|
|
5
|
+
case "host":
|
|
6
|
+
case "query": return true;
|
|
7
|
+
case "cookie":
|
|
8
|
+
case "header": return false;
|
|
9
|
+
default: return false;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function toClientRewrite(rewrite) {
|
|
13
|
+
const clientHas = rewrite.has?.filter(isClientHasCondition);
|
|
14
|
+
const hasServerOnlyCondition = rewrite.has?.some((condition) => !isClientHasCondition(condition)) ?? false;
|
|
15
|
+
const common = {
|
|
16
|
+
source: rewrite.source,
|
|
17
|
+
has: clientHas?.length ? clientHas : void 0,
|
|
18
|
+
locale: rewrite.locale,
|
|
19
|
+
basePath: rewrite.basePath
|
|
20
|
+
};
|
|
21
|
+
if (isExternalUrl(rewrite.destination) || (rewrite.missing?.length ?? 0) > 0 || hasServerOnlyCondition) return {
|
|
22
|
+
...common,
|
|
23
|
+
requiresServerEvaluation: true
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
source: rewrite.source,
|
|
27
|
+
destination: rewrite.destination,
|
|
28
|
+
has: common.has,
|
|
29
|
+
locale: rewrite.locale,
|
|
30
|
+
basePath: rewrite.basePath
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function toClientRewrites(rewrites) {
|
|
34
|
+
return {
|
|
35
|
+
beforeFiles: rewrites.beforeFiles.map(toClientRewrite),
|
|
36
|
+
afterFiles: rewrites.afterFiles.map(toClientRewrite),
|
|
37
|
+
fallback: rewrites.fallback.map(toClientRewrite)
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { toClientRewrites };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ReportedError, dismissOverlay } from "./dev-error-overlay-store.js";
|
|
2
|
-
|
|
3
2
|
//#region src/client/dev-error-overlay.d.ts
|
|
4
3
|
declare const DEV_ERROR_OVERLAY_HOST_ID = "__vinext_dev_error_overlay_root";
|
|
5
4
|
declare const DEV_ERROR_OVERLAY_MOUNT_ID = "__vinext_dev_error_overlay_mount";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ClientInstrumentationHooks } from "./instrumentation-client.js";
|
|
2
|
-
|
|
3
2
|
//#region src/client/instrumentation-client-state.d.ts
|
|
4
3
|
declare function normalizeClientInstrumentationHooks(hooks: ClientInstrumentationHooks): ClientInstrumentationHooks | null;
|
|
5
4
|
declare function setClientInstrumentationHooks(hooks: ClientInstrumentationHooks | null): ClientInstrumentationHooks | null;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { RouteManifest } from "../routing/app-route-graph.js";
|
|
2
2
|
import { AppRouterScrollIntent } from "../shims/app-router-scroll-state.js";
|
|
3
|
-
|
|
4
3
|
//#region src/client/navigation-runtime.d.ts
|
|
5
4
|
type NavigationRuntimeSnapshot = {
|
|
6
5
|
pathname: string;
|
|
@@ -14,10 +13,20 @@ type NavigationRuntimeRscBootstrap = {
|
|
|
14
13
|
nav?: NavigationRuntimeSnapshot;
|
|
15
14
|
params?: Record<string, string | string[]>;
|
|
16
15
|
rsc: NavigationRuntimeRscChunk[];
|
|
16
|
+
/**
|
|
17
|
+
* Client reuse bound in seconds resolved from the initial render's completed
|
|
18
|
+
* `cacheLife` — the done-script sibling of `dynamicStaleTimeSeconds`, which
|
|
19
|
+
* carries the `experimental.staleTimes` config value instead.
|
|
20
|
+
*/
|
|
21
|
+
staleTimeSeconds?: number;
|
|
17
22
|
};
|
|
18
23
|
type NavigationRuntimeKind = "navigate" | "traverse" | "refresh";
|
|
19
24
|
type NavigationRuntimeHistoryUpdateMode = "push" | "replace";
|
|
20
25
|
type NavigationRuntimeVisibleCommitMode = "transition" | "synchronous";
|
|
26
|
+
type NavigationRuntimePrefetchRouterState = {
|
|
27
|
+
pathAndSearch: string;
|
|
28
|
+
routeId: string;
|
|
29
|
+
};
|
|
21
30
|
type NavigationRuntimeTraversalIntent = {
|
|
22
31
|
direction: "back" | "forward" | "unknown";
|
|
23
32
|
historyState: unknown;
|
|
@@ -29,6 +38,7 @@ type NavigationRuntimeFunctions = {
|
|
|
29
38
|
commitHashNavigation?: (href: string, historyUpdateMode: NavigationRuntimeHistoryUpdateMode, scroll: boolean) => void;
|
|
30
39
|
navigateExternal?: (href: string, historyUpdateMode: NavigationRuntimeHistoryUpdateMode) => Promise<void>;
|
|
31
40
|
navigate?: NavigationRuntimeNavigate;
|
|
41
|
+
getPrefetchRouterState?: () => NavigationRuntimePrefetchRouterState | null;
|
|
32
42
|
/**
|
|
33
43
|
* Called at the start of every App Router navigation so the <Link> shim can
|
|
34
44
|
* reset any link that is still showing a `useLinkStatus()` pending state but
|
|
@@ -38,6 +48,7 @@ type NavigationRuntimeFunctions = {
|
|
|
38
48
|
*/
|
|
39
49
|
notifyLinkNavigationStart?: () => void;
|
|
40
50
|
pingVisibleLinks?: () => void;
|
|
51
|
+
preparePrefetchResponse?: (response: Response) => Promise<unknown>;
|
|
41
52
|
};
|
|
42
53
|
type NavigationRuntimeBootstrap = {
|
|
43
54
|
routeManifest: RouteManifest | null;
|
|
@@ -31,7 +31,7 @@ function readRuntimeWindow() {
|
|
|
31
31
|
}
|
|
32
32
|
function isNavigationRuntimeFunctions(value) {
|
|
33
33
|
if (!isUnknownRecord(value)) return false;
|
|
34
|
-
return isOptionalRuntimeFunction(Reflect.get(value, "clearNavigationCaches")) && isOptionalRuntimeFunction(Reflect.get(value, "commitHashNavigation")) && isOptionalRuntimeFunction(Reflect.get(value, "navigateExternal")) && isOptionalRuntimeFunction(Reflect.get(value, "navigate")) && isOptionalRuntimeFunction(Reflect.get(value, "notifyLinkNavigationStart")) && isOptionalRuntimeFunction(Reflect.get(value, "pingVisibleLinks"));
|
|
34
|
+
return isOptionalRuntimeFunction(Reflect.get(value, "clearNavigationCaches")) && isOptionalRuntimeFunction(Reflect.get(value, "commitHashNavigation")) && isOptionalRuntimeFunction(Reflect.get(value, "navigateExternal")) && isOptionalRuntimeFunction(Reflect.get(value, "navigate")) && isOptionalRuntimeFunction(Reflect.get(value, "getPrefetchRouterState")) && isOptionalRuntimeFunction(Reflect.get(value, "notifyLinkNavigationStart")) && isOptionalRuntimeFunction(Reflect.get(value, "pingVisibleLinks")) && isOptionalRuntimeFunction(Reflect.get(value, "preparePrefetchResponse"));
|
|
35
35
|
}
|
|
36
36
|
function isNavigationRuntimeRscChunk(value) {
|
|
37
37
|
if (typeof value === "string") return true;
|
|
@@ -55,7 +55,11 @@ function isNavigationRuntimeRscBootstrap(value) {
|
|
|
55
55
|
const nav = Reflect.get(value, "nav");
|
|
56
56
|
const params = Reflect.get(value, "params");
|
|
57
57
|
const rsc = Reflect.get(value, "rsc");
|
|
58
|
-
|
|
58
|
+
const staleTimeSeconds = Reflect.get(value, "staleTimeSeconds");
|
|
59
|
+
return (done === void 0 || typeof done === "boolean") && isOptionalStaleTimeSeconds(dynamicStaleTimeSeconds) && (initialCacheKind === void 0 || initialCacheKind === "dynamic" || initialCacheKind === "static") && (nav === void 0 || isNavigationRuntimeSnapshot(nav)) && (params === void 0 || isNavigationRuntimeParams(params)) && Array.isArray(rsc) && rsc.every(isNavigationRuntimeRscChunk) && isOptionalStaleTimeSeconds(staleTimeSeconds);
|
|
60
|
+
}
|
|
61
|
+
function isOptionalStaleTimeSeconds(value) {
|
|
62
|
+
return value === void 0 || typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
59
63
|
}
|
|
60
64
|
function isReadonlyStringArray(value) {
|
|
61
65
|
return Array.isArray(value) && value.every((entry) => typeof entry === "string");
|
|
@@ -26,32 +26,14 @@ type PagesRouterLinkNavigation = {
|
|
|
26
26
|
locale?: string | false;
|
|
27
27
|
interpolateDynamicRoute?: boolean;
|
|
28
28
|
};
|
|
29
|
-
declare function resolvePagesRouterQueryOnlyHref(href: string, {
|
|
30
|
-
asPath,
|
|
31
|
-
basePath,
|
|
32
|
-
fallbackHref,
|
|
33
|
-
locales
|
|
34
|
-
}: {
|
|
29
|
+
declare function resolvePagesRouterQueryOnlyHref(href: string, { asPath, basePath, fallbackHref, locales }: {
|
|
35
30
|
asPath?: string;
|
|
36
31
|
basePath: string;
|
|
37
32
|
fallbackHref: string;
|
|
38
33
|
locales?: readonly string[];
|
|
39
34
|
}): string;
|
|
40
|
-
declare function navigatePagesRouterLink(router: PagesRouterLinkRuntime, {
|
|
41
|
-
|
|
42
|
-
as,
|
|
43
|
-
replace,
|
|
44
|
-
scroll,
|
|
45
|
-
shallow,
|
|
46
|
-
locale,
|
|
47
|
-
interpolateDynamicRoute
|
|
48
|
-
}: PagesRouterLinkNavigation): Promise<void>;
|
|
49
|
-
declare function navigatePagesRouterLinkWithFallback({
|
|
50
|
-
router,
|
|
51
|
-
loadRouter,
|
|
52
|
-
navigation,
|
|
53
|
-
fallback
|
|
54
|
-
}: {
|
|
35
|
+
declare function navigatePagesRouterLink(router: PagesRouterLinkRuntime, { href, as, replace, scroll, shallow, locale, interpolateDynamicRoute }: PagesRouterLinkNavigation): Promise<void>;
|
|
36
|
+
declare function navigatePagesRouterLinkWithFallback({ router, loadRouter, navigation, fallback }: {
|
|
55
37
|
router?: PagesRouterLinkRuntime;
|
|
56
38
|
loadRouter: () => Promise<PagesRouterLinkRuntime | undefined>;
|
|
57
39
|
navigation: PagesRouterLinkNavigation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/client/react-instance.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Return the React instance registered by the vinext browser entry.
|
|
4
|
+
*
|
|
5
|
+
* Module Federation remotes can call this with their local React namespace to
|
|
6
|
+
* reuse the host instance. The first browser registration wins so evaluating
|
|
7
|
+
* another copy of this module (for example after HMR) cannot replace it.
|
|
8
|
+
* Server and RSC environments always keep their condition-specific React
|
|
9
|
+
* instance local.
|
|
10
|
+
*/
|
|
11
|
+
declare function getVinextReact(reactInstance: typeof import("react")): typeof import("react");
|
|
12
|
+
//#endregion
|
|
13
|
+
export { getVinextReact };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/client/react-instance.ts
|
|
2
|
+
const VINEXT_CLIENT_REACT = Symbol.for("vinext.client.react");
|
|
3
|
+
/**
|
|
4
|
+
* Return the React instance registered by the vinext browser entry.
|
|
5
|
+
*
|
|
6
|
+
* Module Federation remotes can call this with their local React namespace to
|
|
7
|
+
* reuse the host instance. The first browser registration wins so evaluating
|
|
8
|
+
* another copy of this module (for example after HMR) cannot replace it.
|
|
9
|
+
* Server and RSC environments always keep their condition-specific React
|
|
10
|
+
* instance local.
|
|
11
|
+
*/
|
|
12
|
+
function getVinextReact(reactInstance) {
|
|
13
|
+
if (typeof window === "undefined") return reactInstance;
|
|
14
|
+
const registeredReact = Reflect.get(globalThis, VINEXT_CLIENT_REACT);
|
|
15
|
+
if (registeredReact !== void 0) return registeredReact;
|
|
16
|
+
Reflect.set(globalThis, VINEXT_CLIENT_REACT, reactInstance);
|
|
17
|
+
return reactInstance;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { getVinextReact };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { NEXT_DATA } from "../shims/internal/utils.js";
|
|
2
|
-
|
|
3
2
|
//#region src/client/vinext-next-data.d.ts
|
|
4
3
|
type VinextLinkPrefetchRoute = {
|
|
5
4
|
canPrefetchLoadingShell: boolean;
|
|
@@ -26,11 +25,17 @@ type VinextPagesLinkPrefetchRoute = {
|
|
|
26
25
|
requiresDynamicNavigationRequest?: boolean;
|
|
27
26
|
};
|
|
28
27
|
type VinextNextData = {
|
|
29
|
-
/** vinext-specific additions (not part of Next.js upstream). */
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
/** vinext-specific additions (not part of Next.js upstream). */
|
|
29
|
+
__vinext?: {
|
|
30
|
+
/** Absolute URL of the page module for dynamic import. */
|
|
31
|
+
pageModuleUrl?: string;
|
|
32
|
+
/** Absolute URL of the `_app` module for dynamic import. */
|
|
33
|
+
appModuleUrl?: string;
|
|
34
|
+
/** True when the Pages Router server has middleware/proxy configured. */
|
|
35
|
+
hasMiddleware?: boolean;
|
|
36
|
+
/** True when build-time rewrites can affect the initial Pages Router ready state. */
|
|
37
|
+
hasRewrites?: boolean;
|
|
38
|
+
/** Server-resolved Pages route URL used to hydrate fallback shells behind rewrites. */
|
|
34
39
|
routeUrl?: string;
|
|
35
40
|
};
|
|
36
41
|
} & NEXT_DATA;
|
|
@@ -55,11 +55,13 @@ type AppRouterPublicInstance = {
|
|
|
55
55
|
forward: () => void;
|
|
56
56
|
refresh: () => void;
|
|
57
57
|
prefetch: (href: string, options?: {
|
|
58
|
+
kind?: "auto" | "full";
|
|
58
59
|
onInvalidate?: () => void;
|
|
59
60
|
}) => void;
|
|
60
61
|
experimental_gesturePush?: (href: string, options?: {
|
|
61
62
|
scroll?: boolean;
|
|
62
|
-
}) => void;
|
|
63
|
+
}) => void;
|
|
64
|
+
/** Default placeholder, matches Next.js. */
|
|
63
65
|
bfcacheId?: string;
|
|
64
66
|
};
|
|
65
67
|
/**
|
|
@@ -97,7 +99,8 @@ type PagesRouterPublicInstance = {
|
|
|
97
99
|
* prefetch — App Router targets land here as `{ __appRouter: true }`.
|
|
98
100
|
* See: `packages/next/src/shared/lib/router/router.ts:2525`.
|
|
99
101
|
*/
|
|
100
|
-
components: Record<string, unknown>;
|
|
102
|
+
components: Record<string, unknown>;
|
|
103
|
+
/** Persistent Pages Router static-data cache, matching Next.js `Router.sdc`. */
|
|
101
104
|
sdc: Record<string, Promise<Response>>;
|
|
102
105
|
};
|
|
103
106
|
declare global {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { HasCondition, NextHeader, NextI18nConfig, NextRedirect, NextRewrite } from "./next-config.js";
|
|
2
2
|
import { RequestContext, normalizeHost, parseCookies, requestContextFromRequest } from "./request-context.js";
|
|
3
3
|
import { isExternalUrl } from "../utils/external-url.js";
|
|
4
|
-
|
|
5
4
|
//#region src/config/config-matchers.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* Detect regex patterns vulnerable to catastrophic backtracking (ReDoS).
|
|
@@ -44,7 +43,8 @@ declare function escapeHeaderSource(source: string): string;
|
|
|
44
43
|
* @see .nextjs-ref/packages/next/src/lib/load-custom-routes.ts:198-220
|
|
45
44
|
*/
|
|
46
45
|
type BasePathMatchState = {
|
|
47
|
-
/** Configured `basePath` (without trailing slash) or "" when unset. */
|
|
46
|
+
/** Configured `basePath` (without trailing slash) or "" when unset. */
|
|
47
|
+
basePath: string;
|
|
48
48
|
/**
|
|
49
49
|
* True when the inbound request was originally under `basePath` (i.e.
|
|
50
50
|
* the prod-server/handler stripped the prefix before the matcher runs).
|
|
@@ -69,9 +69,7 @@ type BasePathMatchState = {
|
|
|
69
69
|
* individual header values), so the wider `string | string[]` type of
|
|
70
70
|
* `middlewareHeaders` is safe to cast here.
|
|
71
71
|
*/
|
|
72
|
-
declare function applyMiddlewareRequestHeaders(middlewareHeaders: Record<string, string | string[]>, request: Request
|
|
73
|
-
preserveCredentialHeaders?: boolean;
|
|
74
|
-
}): {
|
|
72
|
+
declare function applyMiddlewareRequestHeaders(middlewareHeaders: Record<string, string | string[]>, request: Request): {
|
|
75
73
|
request: Request;
|
|
76
74
|
postMwReqCtx: RequestContext;
|
|
77
75
|
};
|