vinext 0.0.55 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -15
- 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 +16 -3
- package/dist/build/client-build-config.js +29 -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 +7 -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 +1 -2
- package/dist/client/navigation-runtime.js +0 -2
- 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 +1 -2
- 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 +1 -2
- package/dist/config/config-matchers.js +0 -2
- package/dist/config/dotenv.d.ts +1 -2
- package/dist/config/dotenv.js +0 -2
- package/dist/config/next-config.d.ts +16 -2
- package/dist/config/next-config.js +23 -4
- 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 +141 -112
- 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 +4 -4
- package/dist/entries/app-rsc-entry.js +50 -61
- package/dist/entries/app-rsc-manifest.d.ts +1 -2
- package/dist/entries/app-rsc-manifest.js +20 -7
- 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 +89 -702
- 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 +216 -101
- 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 +0 -2
- package/dist/plugins/remove-console.d.ts +1 -2
- package/dist/plugins/remove-console.js +0 -2
- 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 +2 -9
- package/dist/routing/app-route-graph.js +9 -30
- 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 +1 -2
- package/dist/routing/route-pattern.js +0 -2
- 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 +0 -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 +186 -75
- 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 +1 -2
- package/dist/server/app-browser-interception-context.js +0 -2
- 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 +5 -4
- package/dist/server/app-browser-navigation-controller.js +3 -3
- package/dist/server/app-browser-popstate.d.ts +1 -2
- package/dist/server/app-browser-popstate.js +0 -2
- 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 +28 -4
- package/dist/server/app-browser-state.js +193 -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 +24 -17
- 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 +18 -2
- package/dist/server/app-history-state.js +68 -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 +18 -9
- 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 +19 -5
- package/dist/server/app-page-dispatch.js +119 -24
- package/dist/server/app-page-element-builder.d.ts +3 -2
- package/dist/server/app-page-element-builder.js +9 -11
- 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 +9 -3
- package/dist/server/app-page-render.js +167 -10
- package/dist/server/app-page-request.d.ts +4 -3
- package/dist/server/app-page-request.js +1 -3
- package/dist/server/app-page-response.d.ts +2 -2
- package/dist/server/app-page-response.js +5 -3
- package/dist/server/app-page-route-wiring.d.ts +14 -3
- package/dist/server/app-page-route-wiring.js +63 -11
- 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 +19 -9
- package/dist/server/app-page-stream.js +28 -10
- package/dist/server/app-pages-bridge.d.ts +25 -0
- package/dist/server/app-pages-bridge.js +34 -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 +1 -2
- package/dist/server/app-route-handler-cache.js +0 -2
- package/dist/server/app-route-handler-dispatch.d.ts +1 -2
- package/dist/server/app-route-handler-dispatch.js +0 -2
- package/dist/server/app-route-handler-execution.d.ts +1 -2
- package/dist/server/app-route-handler-execution.js +2 -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 +1 -2
- package/dist/server/app-route-handler-runtime.js +0 -2
- 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 +16 -2
- package/dist/server/app-rsc-handler.js +21 -13
- 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 +1 -2
- package/dist/server/app-rsc-route-matching.js +0 -2
- 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 +7 -2
- package/dist/server/app-server-action-execution.js +7 -8
- package/dist/server/app-ssr-entry.d.ts +5 -4
- package/dist/server/app-ssr-entry.js +31 -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 +2 -3
- package/dist/server/dev-server.js +75 -18
- 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 +10 -3
- package/dist/server/isr-cache.js +13 -28
- 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 +1 -3
- 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 +9 -2
- package/dist/server/pages-node-compat.js +34 -3
- package/dist/server/pages-page-data.d.ts +7 -3
- package/dist/server/pages-page-data.js +75 -33
- package/dist/server/pages-page-handler.d.ts +90 -0
- package/dist/server/pages-page-handler.js +335 -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 +1 -2
- package/dist/server/pages-page-response.js +8 -4
- 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 +2 -4
- package/dist/server/prod-server.js +0 -2
- 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 +1 -2
- package/dist/server/socket-error-backstop.js +0 -2
- 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 +0 -2
- 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 +35 -30
- 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 +16 -12
- package/dist/shims/error-boundary.js +35 -2
- package/dist/shims/error.d.ts +1 -2
- package/dist/shims/error.js +0 -2
- package/dist/shims/fetch-cache.d.ts +1 -2
- package/dist/shims/fetch-cache.js +2 -4
- 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 +1 -2
- package/dist/shims/hash-scroll.js +0 -2
- 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/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/router-context.d.ts +2 -4
- package/dist/shims/internal/router-context.js +0 -2
- package/dist/shims/internal/utils.d.ts +1 -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 +20 -14
- 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 +23 -7
- package/dist/shims/navigation.js +188 -39
- 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 +1 -2
- package/dist/shims/router-state.js +0 -2
- package/dist/shims/router.d.ts +1 -2
- package/dist/shims/router.js +135 -20
- 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 +1 -2
- package/dist/utils/client-build-manifest.js +0 -2
- 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 +19 -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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.react-server.js","names":[],"sources":["../../src/shims/navigation.react-server.ts"],"sourcesContent":["import { throwClientHookError } from \"./client-hook-error.js\";\n\n// Re-export server-safe APIs from the canonical navigation module.\n// This import uses a relative path to the source file, which does NOT\n// go through the `next/navigation` resolveId hook — so it always\n// resolves to the full module, avoiding a circular redirect.\nexport {\n // Types\n type NavigationContext,\n type SegmentMap,\n\n // Server-side navigation state\n GLOBAL_ACCESSORS_KEY,\n _registerStateAccessors,\n getNavigationContext,\n setNavigationContext,\n\n // Layout segment context (returns null in RSC — createContext unavailable)\n getLayoutSegmentContext,\n ServerInsertedHTMLContext,\n\n // Server-inserted HTML\n flushServerInsertedHTML,\n renderServerInsertedHTML,\n clearServerInsertedHTML,\n\n // Control-flow errors\n HTTP_ERROR_FALLBACK_ERROR_CODE,\n isHTTPAccessFallbackError,\n getAccessFallbackHTTPStatus,\n RedirectType,\n redirect,\n permanentRedirect,\n notFound,\n forbidden,\n unauthorized,\n\n // Internal-error predicates and rethrow.\n //\n // These are environment-agnostic (no React hooks, no browser globals), so\n // we re-export the canonical implementation from `./navigation.js` to keep\n // a single source of truth across the react-server and client conditions.\n //\n // Ported from Next.js:\n // https://github.com/vercel/next.js/blob/canary/packages/next/src/client/components/navigation.react-server.ts\n // where `unstable_rethrow` is also re-exported in the react-server build.\n isRedirectError,\n isNextRouterError,\n isBailoutToCSRError,\n isDynamicServerError,\n BailoutToCSRError,\n DynamicServerError,\n unstable_rethrow,\n\n // Utilities\n ReadonlyURLSearchParams,\n} from \"./navigation.js\";\n\n// These hooks are client-only. Exporting error-throwing stubs (rather than\n// omitting them entirely) gives developers a clear, actionable error message\n// instead of the cryptic \"is not a function\" that Vite's runtime module\n// system produces for missing exports.\n\nexport function usePathname(): never {\n throwClientHookError(\"usePathname()\");\n}\n\nexport function useSearchParams(): never {\n throwClientHookError(\"useSearchParams()\");\n}\n\nexport function useParams(): never {\n throwClientHookError(\"useParams()\");\n}\n\nexport function useRouter(): never {\n throwClientHookError(\"useRouter()\");\n}\n\nexport function useSelectedLayoutSegment(): never {\n throwClientHookError(\"useSelectedLayoutSegment()\");\n}\n\nexport function useSelectedLayoutSegments(): never {\n throwClientHookError(\"useSelectedLayoutSegments()\");\n}\n\nexport function useServerInsertedHTML(): never {\n throwClientHookError(\"useServerInsertedHTML()\");\n}\n\n// `unstable_isUnrecognizedActionError` is client-only: server actions cannot\n// fail with \"unrecognized action\" inside the React-server render path because\n// they execute synchronously against the action manifest. Calling this from a\n// Server Component is always a programming error.\n//\n// Ported from Next.js:\n// https://github.com/vercel/next.js/blob/canary/packages/next/src/client/components/navigation.react-server.ts\n// which throws the same diagnostic message from the react-server condition.\nexport function unstable_isUnrecognizedActionError(): boolean {\n throw new Error(\"`unstable_isUnrecognizedActionError` can only be used on the client.\");\n}\n"],"mappings":";;;;AA+DA,SAAgB,cAAqB;CACnC,qBAAqB,gBAAgB;;AAGvC,SAAgB,kBAAyB;CACvC,qBAAqB,oBAAoB;;AAG3C,SAAgB,YAAmB;CACjC,qBAAqB,cAAc;;AAGrC,SAAgB,YAAmB;CACjC,qBAAqB,cAAc;;AAGrC,SAAgB,2BAAkC;CAChD,qBAAqB,6BAA6B;;AAGpD,SAAgB,4BAAmC;CACjD,qBAAqB,8BAA8B;;AAGrD,SAAgB,wBAA+B;CAC7C,qBAAqB,0BAA0B;;AAWjD,SAAgB,qCAA8C;CAC5D,MAAM,IAAI,MAAM,uEAAuE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"offline.js","names":[],"sources":["../../src/shims/offline.ts"],"sourcesContent":["/**\n * next/offline shim\n *\n * Stub for the experimental `useOffline()` hook added in Next.js\n * (vercel/next.js#92012). Returns `false` (online) unconditionally.\n * Full offline retry behavior (navigation retry, prefetch pause/resume,\n * OfflineProvider) will be implemented once the feature stabilizes upstream.\n */\n\"use client\";\n\nexport function useOffline(): boolean {\n return false;\n}\n"],"mappings":";;;;;;;;;;AAUA,SAAgB,aAAsB;CACpC,OAAO"}
|
package/dist/shims/og.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"og.js","names":["VercelImageResponse"],"sources":["../../src/shims/og.tsx"],"sourcesContent":["import { ImageResponse as VercelImageResponse } from \"@vercel/og\";\nimport type { ImageResponseOptions } from \"@vercel/og\";\nimport type { ReactElement } from \"react\";\n\nconst CACHE_HEADERS = {\n noCache: \"no-cache, no-store\",\n revalidate: \"public, max-age=0, must-revalidate\",\n} as const;\n\n/**\n * next/og shim.\n *\n * The vinext:og-inline-fetch-assets Vite plugin patches @vercel/og's runtime\n * asset fetches so this wrapper can delegate image generation while preserving\n * Next.js's public ImageResponse headers and option merging semantics.\n */\nexport class ImageResponse extends Response {\n static displayName = \"ImageResponse\";\n\n constructor(element: ReactElement, options?: ImageResponseOptions) {\n const readable = new ReadableStream<Uint8Array>({\n async start(controller) {\n const imageResponse = new VercelImageResponse(element, options);\n if (!imageResponse.body) {\n controller.close();\n return;\n }\n\n const reader = imageResponse.body.getReader();\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n controller.close();\n return;\n }\n controller.enqueue(value);\n }\n },\n });\n\n const headers = new Headers({\n \"content-type\": \"image/png\",\n \"cache-control\":\n process.env.NODE_ENV === \"development\" ? CACHE_HEADERS.noCache : CACHE_HEADERS.revalidate,\n });\n if (options?.headers) {\n new Headers(options.headers).forEach((value, key) => {\n headers.set(key, value);\n });\n }\n\n super(readable, {\n headers,\n status: options?.status,\n statusText: options?.statusText,\n });\n }\n}\n\nexport type { ImageResponseOptions } from \"@vercel/og\";\n"],"mappings":";;AAIA,MAAM,gBAAgB;CACpB,SAAS;CACT,YAAY;CACb;;;;;;;;AASD,IAAa,gBAAb,cAAmC,SAAS;CAC1C,OAAO,cAAc;CAErB,YAAY,SAAuB,SAAgC;EACjE,MAAM,WAAW,IAAI,eAA2B,EAC9C,MAAM,MAAM,YAAY;GACtB,MAAM,gBAAgB,IAAIA,gBAAoB,SAAS,QAAQ;GAC/D,IAAI,CAAC,cAAc,MAAM;IACvB,WAAW,OAAO;IAClB;;GAGF,MAAM,SAAS,cAAc,KAAK,WAAW;GAC7C,OAAO,MAAM;IACX,MAAM,EAAE,MAAM,UAAU,MAAM,OAAO,MAAM;IAC3C,IAAI,MAAM;KACR,WAAW,OAAO;KAClB;;IAEF,WAAW,QAAQ,MAAM;;KAG9B,CAAC;EAEF,MAAM,UAAU,IAAI,QAAQ;GAC1B,gBAAgB;GAChB,iBACE,QAAQ,IAAI,aAAa,gBAAgB,cAAc,UAAU,cAAc;GAClF,CAAC;EACF,IAAI,SAAS,SACX,IAAI,QAAQ,QAAQ,QAAQ,CAAC,SAAS,OAAO,QAAQ;GACnD,QAAQ,IAAI,KAAK,MAAM;IACvB;EAGJ,MAAM,UAAU;GACd;GACA,QAAQ,SAAS;GACjB,YAAY,SAAS;GACtB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pages-router-runtime.js","names":[],"sources":["../../src/shims/pages-router-runtime.ts"],"sourcesContent":["type PagesRouterPopStateHandler = (event: PopStateEvent) => void;\n\nlet pagesRouterPopStateHandler: PagesRouterPopStateHandler | undefined;\nlet pagesRouterRuntimeInstalled = false;\n\nexport function setPagesRouterPopStateHandler(handler: PagesRouterPopStateHandler): void {\n pagesRouterPopStateHandler = handler;\n}\n\nexport function installPagesRouterRuntime(): void {\n if (typeof window === \"undefined\" || pagesRouterRuntimeInstalled) {\n return;\n }\n\n if (!pagesRouterPopStateHandler) {\n throw new Error(\"[vinext] Pages Router runtime installed before next/router was initialized\");\n }\n\n pagesRouterRuntimeInstalled = true;\n window.addEventListener(\"popstate\", pagesRouterPopStateHandler);\n}\n"],"mappings":";AAEA,IAAI;AACJ,IAAI,8BAA8B;AAElC,SAAgB,8BAA8B,SAA2C;CACvF,6BAA6B;;AAG/B,SAAgB,4BAAkC;CAChD,IAAI,OAAO,WAAW,eAAe,6BACnC;CAGF,IAAI,CAAC,4BACH,MAAM,IAAI,MAAM,6EAA6E;CAG/F,8BAA8B;CAC9B,OAAO,iBAAiB,YAAY,2BAA2B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"readonly-url-search-params.js","names":[],"sources":["../../src/shims/readonly-url-search-params.ts"],"sourcesContent":["class ReadonlyURLSearchParamsError extends Error {\n constructor() {\n super(\n \"Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams\",\n );\n }\n}\n\n/**\n * Read-only URLSearchParams wrapper matching Next.js runtime behavior.\n * Mutation methods remain present for instanceof/API compatibility but throw.\n */\nexport class ReadonlyURLSearchParams extends URLSearchParams {\n append(_name: string, _value: string): never {\n throw new ReadonlyURLSearchParamsError();\n }\n\n delete(_name: string, _value?: string): never {\n throw new ReadonlyURLSearchParamsError();\n }\n\n set(_name: string, _value: string): never {\n throw new ReadonlyURLSearchParamsError();\n }\n\n sort(): never {\n throw new ReadonlyURLSearchParamsError();\n }\n}\n"],"mappings":";AAAA,IAAM,+BAAN,cAA2C,MAAM;CAC/C,cAAc;EACZ,MACE,0JACD;;;;;;;AAQL,IAAa,0BAAb,cAA6C,gBAAgB;CAC3D,OAAO,OAAe,QAAuB;EAC3C,MAAM,IAAI,8BAA8B;;CAG1C,OAAO,OAAe,QAAwB;EAC5C,MAAM,IAAI,8BAA8B;;CAG1C,IAAI,OAAe,QAAuB;EACxC,MAAM,IAAI,8BAA8B;;CAG1C,OAAc;EACZ,MAAM,IAAI,8BAA8B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request-context.js","names":[],"sources":["../../src/shims/request-context.ts"],"sourcesContent":["/**\n * Request ExecutionContext — AsyncLocalStorage-backed accessor.\n *\n * Makes the Cloudflare Workers `ExecutionContext` (which provides\n * `waitUntil`) available to any code on the call stack during a request\n * without requiring it to be threaded through every function signature.\n *\n * Usage:\n *\n * // In the worker entry, wrap the handler:\n * import { runWithExecutionContext } from \"vinext/shims/request-context\";\n * export default {\n * fetch(request, env, ctx) {\n * return runWithExecutionContext(ctx, () => handler.fetch(request, env, ctx));\n * }\n * };\n *\n * // Anywhere downstream:\n * import { getRequestExecutionContext } from \"vinext/shims/request-context\";\n * const ctx = getRequestExecutionContext(); // null on Node.js dev\n * ctx?.waitUntil(somePromise);\n */\n\nimport { getOrCreateAls } from \"./internal/als-registry.js\";\nimport {\n isInsideUnifiedScope,\n getRequestContext,\n runWithUnifiedStateMutation,\n} from \"./unified-request-context.js\";\n\n// ---------------------------------------------------------------------------\n// ExecutionContext interface\n// ---------------------------------------------------------------------------\n\n/**\n * Minimal ExecutionContext interface matching the Cloudflare Workers runtime.\n * Using a structural interface so this file has no runtime dependency on\n * Cloudflare types packages.\n */\nexport type ExecutionContextLike = {\n waitUntil(promise: Promise<unknown>): void;\n passThroughOnException?(): void;\n};\n\n// ---------------------------------------------------------------------------\n// ALS setup — stored on globalThis so all Vite environments (RSC/SSR/client)\n// share the same instance and see the same per-request context.\n// ---------------------------------------------------------------------------\n\nconst _als = getOrCreateAls<ExecutionContextLike | null>(\"vinext.requestContext.als\");\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/**\n * Run `fn` with the given `ExecutionContext` available via\n * `getRequestExecutionContext()` for the duration of the call (including\n * all async continuations, such as RSC streaming).\n *\n * Call this at the top of your Worker's `fetch` handler, wrapping the\n * delegation to vinext so the context propagates through the entire\n * request pipeline.\n */\nexport function runWithExecutionContext<T>(\n ctx: ExecutionContextLike,\n fn: () => Promise<T>,\n): Promise<T>;\nexport function runWithExecutionContext<T>(\n ctx: ExecutionContextLike,\n fn: () => T | Promise<T>,\n): T | Promise<T>;\nexport function runWithExecutionContext<T>(\n ctx: ExecutionContextLike,\n fn: () => T | Promise<T>,\n): T | Promise<T> {\n if (isInsideUnifiedScope()) {\n return runWithUnifiedStateMutation((uCtx) => {\n uCtx.executionContext = ctx;\n }, fn);\n }\n return _als.run(ctx, fn);\n}\n\n/**\n * Get the `ExecutionContext` for the current request, or `null` when called\n * outside a `runWithExecutionContext()` scope (e.g. on Node.js dev server).\n *\n * Use `ctx?.waitUntil(promise)` to schedule background work that must\n * complete before the Worker isolate is torn down.\n */\nexport function getRequestExecutionContext(): ExecutionContextLike | null {\n if (isInsideUnifiedScope()) {\n return getRequestContext().executionContext;\n }\n // getStore() returns undefined when called outside an ALS scope;\n // normalise to null for a consistent return type.\n return _als.getStore() ?? null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,MAAM,OAAO,eAA4C,4BAA4B;AAuBrF,SAAgB,wBACd,KACA,IACgB;CAChB,IAAI,sBAAsB,EACxB,OAAO,6BAA6B,SAAS;EAC3C,KAAK,mBAAmB;IACvB,GAAG;CAER,OAAO,KAAK,IAAI,KAAK,GAAG;;;;;;;;;AAU1B,SAAgB,6BAA0D;CACxE,IAAI,sBAAsB,EACxB,OAAO,mBAAmB,CAAC;CAI7B,OAAO,KAAK,UAAU,IAAI"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"root-params.js","names":[],"sources":["../../src/shims/root-params.ts"],"sourcesContent":["import { getOrCreateAls } from \"./internal/als-registry.js\";\nimport {\n getRequestContext,\n isInsideUnifiedScope,\n runWithUnifiedStateMutation,\n} from \"./unified-request-context.js\";\n\nexport type RootParams = Record<string, string | string[] | undefined>;\n\nexport type RootParamsState = {\n rootParams: RootParams | null;\n};\n\nconst _FALLBACK_KEY = Symbol.for(\"vinext.rootParams.fallback\");\nconst _g = globalThis as unknown as Record<PropertyKey, unknown>;\nconst _als = getOrCreateAls<RootParamsState>(\"vinext.rootParams.als\");\n\nconst _fallbackState = (_g[_FALLBACK_KEY] ??= {\n rootParams: null,\n} satisfies RootParamsState) as RootParamsState;\n\nfunction getState(): RootParamsState {\n if (isInsideUnifiedScope()) {\n return getRequestContext();\n }\n return _als.getStore() ?? _fallbackState;\n}\n\nexport function pickRootParams(\n params: RootParams,\n rootParamNames: readonly string[] | null | undefined,\n): RootParams {\n const picked: RootParams = {};\n for (const name of rootParamNames ?? []) {\n picked[name] = params[name];\n }\n return picked;\n}\n\nexport function setRootParams(params: RootParams | null): void {\n getState().rootParams = params;\n}\n\nexport function getRootParam(name: string): Promise<string | string[] | undefined> {\n return Promise.resolve(getState().rootParams?.[name]);\n}\n\nexport function runWithRootParamsScope<T>(params: RootParams, fn: () => Promise<T>): Promise<T>;\nexport function runWithRootParamsScope<T>(\n params: RootParams,\n fn: () => T | Promise<T>,\n): T | Promise<T>;\nexport function runWithRootParamsScope<T>(\n params: RootParams,\n fn: () => T | Promise<T>,\n): T | Promise<T> {\n if (isInsideUnifiedScope()) {\n return runWithUnifiedStateMutation((ctx) => {\n ctx.rootParams = params;\n }, fn);\n } else {\n return _als.run({ rootParams: params }, fn);\n }\n}\n"],"mappings":";;;AAaA,MAAM,gBAAgB,OAAO,IAAI,6BAA6B;AAC9D,MAAM,KAAK;AACX,MAAM,OAAO,eAAgC,wBAAwB;AAErE,MAAM,iBAAkB,GAAG,mBAAmB,EAC5C,YAAY,MACb;AAED,SAAS,WAA4B;CACnC,IAAI,sBAAsB,EACxB,OAAO,mBAAmB;CAE5B,OAAO,KAAK,UAAU,IAAI;;AAG5B,SAAgB,eACd,QACA,gBACY;CACZ,MAAM,SAAqB,EAAE;CAC7B,KAAK,MAAM,QAAQ,kBAAkB,EAAE,EACrC,OAAO,QAAQ,OAAO;CAExB,OAAO;;AAGT,SAAgB,cAAc,QAAiC;CAC7D,UAAU,CAAC,aAAa;;AAG1B,SAAgB,aAAa,MAAsD;CACjF,OAAO,QAAQ,QAAQ,UAAU,CAAC,aAAa,MAAM;;AAQvD,SAAgB,uBACd,QACA,IACgB;CAChB,IAAI,sBAAsB,EACxB,OAAO,6BAA6B,QAAQ;EAC1C,IAAI,aAAa;IAChB,GAAG;MAEN,OAAO,KAAK,IAAI,EAAE,YAAY,QAAQ,EAAE,GAAG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"router-state.js","names":[],"sources":["../../src/shims/router-state.ts"],"sourcesContent":["/**\n * Server-only Pages Router state backed by AsyncLocalStorage.\n *\n * Provides request-scoped isolation for SSR context (pathname, query,\n * locale) so concurrent requests on Workers don't share state.\n *\n * This module is server-only — it imports node:async_hooks and must NOT\n * be bundled for the browser.\n */\n\nimport { _registerRouterStateAccessors } from \"./router.js\";\nimport { getOrCreateAls } from \"./internal/als-registry.js\";\nimport {\n getRequestContext,\n isInsideUnifiedScope,\n runWithUnifiedStateMutation,\n} from \"./unified-request-context.js\";\n\n// ---------------------------------------------------------------------------\n// ALS setup\n// ---------------------------------------------------------------------------\n\nexport type SSRContext = {\n pathname: string;\n query: Record<string, string | string[]>;\n asPath: string;\n locale?: string;\n locales?: string[];\n defaultLocale?: string;\n isFallback?: boolean;\n};\n\nexport type RouterState = {\n ssrContext: SSRContext | null;\n};\n\nconst _FALLBACK_KEY = Symbol.for(\"vinext.router.fallback\");\nconst _g = globalThis as unknown as Record<PropertyKey, unknown>;\nconst _als = getOrCreateAls<RouterState>(\"vinext.router.als\");\n\nconst _fallbackState = (_g[_FALLBACK_KEY] ??= {\n ssrContext: null,\n} satisfies RouterState) as RouterState;\n\nfunction _getState(): RouterState {\n if (isInsideUnifiedScope()) {\n return getRequestContext();\n }\n return _als.getStore() ?? _fallbackState;\n}\n\n/**\n * Run a function within a router state ALS scope.\n * Ensures per-request isolation for Pages Router SSR context\n * on concurrent runtimes.\n */\nexport function runWithRouterState<T>(fn: () => Promise<T>): Promise<T>;\nexport function runWithRouterState<T>(fn: () => T | Promise<T>): T | Promise<T>;\nexport function runWithRouterState<T>(fn: () => T | Promise<T>): T | Promise<T> {\n if (isInsideUnifiedScope()) {\n return runWithUnifiedStateMutation((uCtx) => {\n uCtx.ssrContext = null;\n }, fn);\n }\n\n const state: RouterState = {\n ssrContext: null,\n };\n return _als.run(state, fn);\n}\n\n// ---------------------------------------------------------------------------\n// Register ALS-backed accessors into router.ts\n// ---------------------------------------------------------------------------\n\n_registerRouterStateAccessors({\n getSSRContext(): SSRContext | null {\n return _getState().ssrContext;\n },\n\n setSSRContext(ctx: SSRContext | null): void {\n _getState().ssrContext = ctx;\n },\n});\n"],"mappings":";;;;;;;;;;;;;AAoCA,MAAM,gBAAgB,OAAO,IAAI,yBAAyB;AAC1D,MAAM,KAAK;AACX,MAAM,OAAO,eAA4B,oBAAoB;AAE7D,MAAM,iBAAkB,GAAG,mBAAmB,EAC5C,YAAY,MACb;AAED,SAAS,YAAyB;CAChC,IAAI,sBAAsB,EACxB,OAAO,mBAAmB;CAE5B,OAAO,KAAK,UAAU,IAAI;;AAU5B,SAAgB,mBAAsB,IAA0C;CAC9E,IAAI,sBAAsB,EACxB,OAAO,6BAA6B,SAAS;EAC3C,KAAK,aAAa;IACjB,GAAG;CAMR,OAAO,KAAK,IAAI,EAFd,YAAY,MAEO,EAAE,GAAG;;AAO5B,8BAA8B;CAC5B,gBAAmC;EACjC,OAAO,WAAW,CAAC;;CAGrB,cAAc,KAA8B;EAC1C,WAAW,CAAC,aAAa;;CAE5B,CAAC"}
|
package/dist/shims/router.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"router.js","names":[],"sources":["../../src/shims/router.ts"],"sourcesContent":["/**\n * next/router shim\n *\n * Provides useRouter() hook and Router singleton for Pages Router.\n * Backed by the browser History API. Supports client-side navigation\n * by fetching new page data and re-rendering the React root.\n */\nimport {\n useState,\n useEffect,\n useMemo,\n useContext,\n createElement,\n type ReactElement,\n type ReactNode,\n type ComponentType,\n} from \"react\";\nimport { AppRouterContext, type AppRouterInstance } from \"./internal/app-router-context.js\";\nimport { RouterContext } from \"./internal/router-context.js\";\nimport {\n applyVinextLocaleGlobals,\n extractVinextNextDataJson,\n parseVinextNextDataJson,\n type VinextNextData,\n} from \"../client/vinext-next-data.js\";\nimport { isValidModulePath } from \"../client/validate-module-path.js\";\nimport {\n prefetchPagesData,\n resolvePagesDataNavigationTarget,\n type PagesDataTarget,\n} from \"./internal/pages-data-target.js\";\nimport { buildPagesDataHref } from \"./internal/pages-data-url.js\";\nimport {\n getPagesRouterComponentsMap,\n markAppRouteDetectedOnPrefetch,\n} from \"./internal/app-route-detection.js\";\nimport { dedupedPagesDataFetch } from \"./internal/pages-data-fetch-dedup.js\";\nimport { installWindowNext, type PagesRouterPublicInstance } from \"../client/window-next.js\";\nimport { isUnknownRecord } from \"../utils/record.js\";\nimport {\n isAbsoluteOrProtocolRelativeUrl,\n isHashOnlyBrowserUrlChange,\n normalizePathTrailingSlash,\n toBrowserNavigationHref,\n toSameOriginAppPath,\n getWindowOrigin,\n} from \"./url-utils.js\";\nimport { stripBasePath } from \"../utils/base-path.js\";\nimport {\n addLocalePrefix,\n getDomainLocaleUrl,\n getLocalePathPrefix,\n type DomainLocale,\n} from \"../utils/domain-locale.js\";\nimport {\n addQueryParam,\n appendSearchParamsToUrl,\n mergeRouteParamsIntoQuery,\n parseQueryString,\n type UrlQuery,\n urlQueryToSearchParams,\n} from \"../utils/query.js\";\nimport { matchRoutePattern, routePatternParts } from \"../routing/route-pattern.js\";\nimport { scrollToHashTarget } from \"./hash-scroll.js\";\nimport { setPagesRouterPopStateHandler } from \"./pages-router-runtime.js\";\nimport { assertSafeNavigationUrl } from \"./url-safety.js\";\nimport { getCurrentBrowserLocale } from \"./client-locale.js\";\n\n/** basePath from next.config.js, injected by the plugin at build time */\nconst __basePath: string = process.env.__NEXT_ROUTER_BASEPATH ?? \"\";\n/** trailingSlash from next.config.js, injected by the plugin at build time */\nconst __trailingSlash: boolean = process.env.__VINEXT_TRAILING_SLASH === \"true\";\n\ntype BeforePopStateCallback = (state: {\n url: string;\n as: string;\n options: { shallow: boolean };\n}) => boolean;\n\nexport type NextRouter = {\n /** Current pathname */\n pathname: string;\n /** Current route pattern (e.g., \"/posts/[id]\") */\n route: string;\n /** Query parameters */\n query: Record<string, string | string[]>;\n /** Full URL including query string */\n asPath: string;\n /** Base path */\n basePath: string;\n /** Current locale */\n locale?: string;\n /** Available locales */\n locales?: string[];\n /** Default locale */\n defaultLocale?: string;\n /** Configured domain locales */\n domainLocales?: VinextNextData[\"domainLocales\"];\n /** Whether the router is ready */\n isReady: boolean;\n /** Whether this is a preview */\n isPreview: boolean;\n /** Whether this is a fallback page */\n isFallback: boolean;\n\n /** Navigate to a new URL */\n push(url: string | UrlObject, as?: string, options?: TransitionOptions): Promise<boolean>;\n /** Replace current URL */\n replace(url: string | UrlObject, as?: string, options?: TransitionOptions): Promise<boolean>;\n /** Go back */\n back(): void;\n /** Reload the page */\n reload(): void;\n /** Prefetch a page (injects <link rel=\"prefetch\">) */\n prefetch(url: string): Promise<void>;\n /** Register a callback to run before popstate navigation */\n beforePopState(cb: BeforePopStateCallback): void;\n /** Listen for route changes */\n events: RouterEvents;\n};\n\ntype UrlObject = {\n pathname?: string;\n query?: UrlQuery;\n};\n\ntype TransitionOptions = {\n shallow?: boolean;\n scroll?: boolean;\n locale?: string | false;\n};\n\ntype RouterEvents = {\n on(event: string, handler: (...args: unknown[]) => void): void;\n off(event: string, handler: (...args: unknown[]) => void): void;\n emit(event: string, ...args: unknown[]): void;\n};\n\nfunction createRouterEvents(): RouterEvents {\n const listeners = new Map<string, Set<(...args: unknown[]) => void>>();\n\n return {\n on(event: string, handler: (...args: unknown[]) => void) {\n if (!listeners.has(event)) listeners.set(event, new Set());\n (listeners.get(event) as Set<(...args: unknown[]) => void>).add(handler);\n },\n off(event: string, handler: (...args: unknown[]) => void) {\n listeners.get(event)?.delete(handler);\n },\n emit(event: string, ...args: unknown[]) {\n listeners.get(event)?.forEach((handler) => handler(...args));\n },\n };\n}\n\n// Singleton events instance\nconst routerEvents = createRouterEvents();\n\nfunction resolveUrl(url: string | UrlObject): string {\n if (typeof url === \"string\") return url;\n let result = url.pathname ?? \"/\";\n if (url.query) {\n const params = urlQueryToSearchParams(url.query);\n result = appendSearchParamsToUrl(result, params);\n }\n return result;\n}\n\n/**\n * When `as` is provided, use it as the navigation target. This is a\n * simplification: Next.js keeps `url` and `as` as separate values (url for\n * data fetching, as for the browser URL). We collapse them because vinext's\n * navigateClient() fetches HTML from the target URL, so `as` must be a\n * server-resolvable path. Purely decorative `as` values are not supported.\n * Pages error routes are handled as a narrow exception below because Next.js\n * treats their href as the component route while preserving `as` in history.\n */\nfunction resolveNavigationTarget(\n url: string | UrlObject,\n as: string | undefined,\n locale: string | undefined,\n): string {\n return applyNavigationLocale(as ?? resolveUrl(url), locale);\n}\n\nfunction getCurrentUrlLocale(): string | undefined {\n return getCurrentBrowserLocale({\n basePath: __basePath,\n domainLocales: getDomainLocales(),\n hostname: getCurrentHostname(),\n });\n}\n\nfunction getLocalPathname(url: string): string | null {\n if (typeof window === \"undefined\") return null;\n if (isAbsoluteOrProtocolRelativeUrl(url)) {\n const localPath = toSameOriginAppPath(url, __basePath);\n if (localPath == null) return null;\n return stripBasePath(new URL(localPath, window.location.href).pathname, __basePath);\n }\n try {\n return stripBasePath(new URL(url, window.location.href).pathname, __basePath);\n } catch {\n return null;\n }\n}\n\nfunction resolvePagesErrorHtmlFetchUrl(\n url: string | UrlObject,\n locale: string | undefined,\n): string | null {\n const href = resolveUrl(url);\n const errorRoutePathname = getLocalPathname(href);\n if (errorRoutePathname !== \"/404\" && errorRoutePathname !== \"/_error\") return null;\n\n const fetchHref = errorRoutePathname === \"/_error\" ? replaceUrlPathname(href, \"/404\") : href;\n const resolvedUrl = applyNavigationLocale(fetchHref, locale);\n\n let parsed: URL;\n try {\n parsed = new URL(resolvedUrl, window.location.href);\n } catch {\n return null;\n }\n const appPathname = stripBasePath(parsed.pathname, __basePath);\n const fetchTarget = `${appPathname}${parsed.search}${parsed.hash}`;\n return normalizePathTrailingSlash(\n toBrowserNavigationHref(fetchTarget, window.location.href, __basePath),\n __trailingSlash,\n );\n}\n\nfunction replaceUrlPathname(url: string, pathname: string): string {\n try {\n const parsed = new URL(url, window.location.href);\n return `${pathname}${parsed.search}${parsed.hash}`;\n } catch {\n return pathname;\n }\n}\n\nfunction resolveTransitionLocale(locale: TransitionOptions[\"locale\"]): string | undefined {\n if (typeof window === \"undefined\") return undefined;\n if (locale === false) return window.__VINEXT_DEFAULT_LOCALE__;\n return locale ?? getCurrentUrlLocale();\n}\n\nfunction getDomainLocales(): readonly DomainLocale[] | undefined {\n return (window.__NEXT_DATA__ as VinextNextData | undefined)?.domainLocales;\n}\n\nfunction getCurrentHostname(): string | undefined {\n return window.location?.hostname;\n}\n\nfunction getDomainLocalePath(url: string, locale: string): string | undefined {\n return getDomainLocaleUrl(url, locale, {\n basePath: __basePath,\n currentHostname: getCurrentHostname(),\n domainItems: getDomainLocales(),\n });\n}\n\n/**\n * Apply locale prefix to a URL for client-side navigation.\n * Same logic as Link's applyLocaleToHref but reads from window globals.\n */\nexport function applyNavigationLocale(url: string, locale?: string): string {\n if (!locale || typeof window === \"undefined\") return url;\n // Absolute and protocol-relative URLs must not be prefixed — locale\n // only applies to local paths.\n if (isAbsoluteOrProtocolRelativeUrl(url)) {\n return url;\n }\n if (getLocalePathPrefix(url, window.__VINEXT_LOCALES__)) {\n return url;\n }\n\n const domainLocalePath = getDomainLocalePath(url, locale);\n if (domainLocalePath) return domainLocalePath;\n\n return addLocalePrefix(url, locale, window.__VINEXT_DEFAULT_LOCALE__ ?? \"\");\n}\n\nfunction isDefaultLocaleRootNavigation(url: string, locale: string | undefined): boolean {\n if (typeof window === \"undefined\") return false;\n if (!locale || locale !== window.__VINEXT_DEFAULT_LOCALE__) return false;\n\n let parsed: URL;\n try {\n parsed = new URL(url, window.location.href);\n } catch {\n return false;\n }\n\n return stripBasePath(parsed.pathname, __basePath) === \"/\";\n}\n\nfunction getPagesHtmlFetchUrl(browserUrl: string, locale: string | undefined): string {\n if (!isDefaultLocaleRootNavigation(browserUrl, locale)) return browserUrl;\n\n // Browser URL stays unprefixed for the default locale, but the internal\n // HTML fetch must bypass root Accept-Language detection.\n const parsed = new URL(browserUrl, window.location.href);\n const localeRoot = normalizePathTrailingSlash(`/${locale}`, __trailingSlash);\n // Base path joining can change slash shape, then the final URL must still\n // conform to the app's trailingSlash setting.\n return normalizePathTrailingSlash(\n toBrowserNavigationHref(\n `${localeRoot}${parsed.search}${parsed.hash}`,\n window.location.href,\n __basePath,\n ),\n __trailingSlash,\n );\n}\n\n/** Check if a URL is external (any URL scheme per RFC 3986, or protocol-relative) */\nexport function isExternalUrl(url: string): boolean {\n return isAbsoluteOrProtocolRelativeUrl(url);\n}\n\n/** Resolve a hash URL to a basePath-stripped app URL for event payloads */\nfunction resolveHashUrl(url: string): string {\n if (typeof window === \"undefined\") return url;\n if (url.startsWith(\"#\"))\n return stripBasePath(window.location.pathname, __basePath) + window.location.search + url;\n // Full-path hash URL — strip basePath for consistency with other events\n try {\n const parsed = new URL(url, window.location.href);\n return stripBasePath(parsed.pathname, __basePath) + parsed.search + parsed.hash;\n } catch {\n return url;\n }\n}\n\n/** Check if a href is only a hash change relative to the current URL */\nexport function isHashOnlyChange(href: string): boolean {\n if (href.startsWith(\"#\")) return true;\n if (typeof window === \"undefined\") return false;\n return isHashOnlyBrowserUrlChange(href, window.location.href, __basePath);\n}\n\n/** Save current scroll position into history state for back/forward restoration */\nfunction saveScrollPosition(): void {\n const state = window.history.state ?? {};\n window.history.replaceState(\n { ...state, __vinext_scrollX: window.scrollX, __vinext_scrollY: window.scrollY },\n \"\",\n );\n}\n\n/** Restore scroll position from history state */\nfunction restoreScrollPosition(state: unknown): void {\n if (state && typeof state === \"object\" && \"__vinext_scrollY\" in state) {\n const { __vinext_scrollX: x, __vinext_scrollY: y } = state as {\n __vinext_scrollX: number;\n __vinext_scrollY: number;\n };\n requestAnimationFrame(() => window.scrollTo(x, y));\n }\n}\n\n/**\n * SSR context - set by the dev server before rendering each page.\n */\ntype SSRContext = {\n pathname: string;\n query: Record<string, string | string[]>;\n asPath: string;\n locale?: string;\n locales?: string[];\n defaultLocale?: string;\n domainLocales?: VinextNextData[\"domainLocales\"];\n /**\n * True when rendering a `getStaticPaths` fallback shell for a path that\n * hasn't been pre-rendered yet (`fallback: true` + unlisted path). Mirrors\n * `renderContext.isFallback` in Next.js's `render.tsx`: `getStaticProps`\n * is skipped, the page renders with empty props, and `useRouter().isFallback`\n * returns `true` so user code can show a loading state.\n */\n isFallback?: boolean;\n};\n\n// ---------------------------------------------------------------------------\n// Server-side SSR state uses a registration pattern so this module can be\n// bundled for the browser. The ALS-backed implementation lives in\n// router-state.ts (server-only) and registers itself on import.\n// ---------------------------------------------------------------------------\n\nlet _ssrContext: SSRContext | null = null;\n\nlet _getSSRContext = (): SSRContext | null => _ssrContext;\nlet _setSSRContextImpl = (ctx: SSRContext | null): void => {\n _ssrContext = ctx;\n};\n\n/**\n * Register ALS-backed state accessors. Called by router-state.ts on import.\n * @internal\n */\nexport function _registerRouterStateAccessors(accessors: {\n getSSRContext: () => SSRContext | null;\n setSSRContext: (ctx: SSRContext | null) => void;\n}): void {\n _getSSRContext = accessors.getSSRContext;\n _setSSRContextImpl = accessors.setSSRContext;\n}\n\nexport function setSSRContext(ctx: SSRContext | null): void {\n _setSSRContextImpl(ctx);\n}\n\ntype PagesNavigationContextShape = {\n pathname: string;\n searchParams: URLSearchParams;\n params: Record<string, string | string[]>;\n};\n\n// Client-only cache for snapshot stability. useSyncExternalStore compares\n// snapshots with Object.is, so returning a fresh object on every render would\n// trigger re-render loops. We use a module-level cache keyed by URL inputs;\n// this is safe in the browser because there is exactly one request at a time\n// but it must NOT be used on the server (concurrent ALS-scoped requests).\nlet _cachedClientPagesNavCtx: PagesNavigationContextShape | null = null;\nlet _cachedClientPagesNavCtxKey: string | null = null;\n\nfunction _buildClientPagesNavigationContext(\n routePattern: string,\n resolvedPath: string,\n searchString: string,\n): PagesNavigationContextShape {\n const cacheKey = `${routePattern}|${resolvedPath}|${searchString}`;\n if (_cachedClientPagesNavCtxKey === cacheKey && _cachedClientPagesNavCtx) {\n return _cachedClientPagesNavCtx;\n }\n const searchParams = new URLSearchParams(searchString);\n const params = routePattern ? (extractRouteParamsFromPath(routePattern, resolvedPath) ?? {}) : {};\n const ctx: PagesNavigationContextShape = { pathname: resolvedPath, searchParams, params };\n _cachedClientPagesNavCtx = ctx;\n _cachedClientPagesNavCtxKey = cacheKey;\n return ctx;\n}\n\n// Server-side cache for snapshot stability. React's `useSyncExternalStore`\n// expects `getServerSnapshot` to return a stable reference within a single\n// render so it can use Object.is to decide whether to bail out. The SSR ctx is\n// per-request (ALS-isolated), so a WeakMap keyed on the ctx is concurrent-safe\n// and lets us reuse the same shape across every hook call in a single render.\n//\n// Without this, React logs:\n// \"The result of getServerSnapshot should be cached to avoid an infinite loop\"\n// and may re-render until the snapshots stabilize, which is wasteful at best\n// and a hydration-mismatch hazard at worst.\nconst _ssrPagesNavCtxCache = new WeakMap<SSRContext, PagesNavigationContextShape>();\n\n/**\n * Cross-router compat shim source for `next/navigation` hooks.\n *\n * Returns the current Pages Router state shaped as a navigation context so\n * the App Router hooks (useParams/useSearchParams/usePathname) can act as\n * compat shims when invoked inside a Pages Router render. Mirrors Next.js's\n * `adaptForPathParams` and `adaptForSearchParams` in\n * .nextjs-ref/packages/next/src/shared/lib/router/adapters.tsx, which Next.js\n * uses to populate SearchParamsContext / PathParamsContext for the Pages\n * Router (see packages/next/src/server/render.tsx and\n * packages/next/src/client/index.tsx).\n *\n * Returns `null` when there is no Pages Router state available — e.g. App\n * Router pages, RSC-only renders, or pre-router renders. Callers should\n * treat null as \"App Router context, use normal app-router state\".\n */\nexport function getPagesNavigationContext(): PagesNavigationContextShape | null {\n if (typeof window === \"undefined\") {\n const ssrCtx = _getSSRContext();\n if (!ssrCtx) return null;\n // Reuse the cached shape for this request so React's useSyncExternalStore\n // sees Object.is-equal snapshots across hook calls in the same render.\n // The WeakMap is keyed on the request-scoped ALS ctx, so this remains\n // safe under concurrent SSR (each request has its own ctx).\n const cached = _ssrPagesNavCtxCache.get(ssrCtx);\n if (cached) return cached;\n // ssrCtx.pathname is the route pattern (e.g. \"/blog/[slug]\").\n // ssrCtx.asPath is the resolved URL with query string. For useSearchParams\n // we want only the URL search string; for useParams we want only the\n // dynamic route params.\n let searchParams: URLSearchParams;\n let resolvedPath: string;\n try {\n const url = new URL(ssrCtx.asPath, \"http://_\");\n searchParams = url.searchParams;\n resolvedPath = url.pathname;\n } catch {\n searchParams = new URLSearchParams();\n resolvedPath = ssrCtx.pathname;\n }\n const params = extractRouteParamsFromPath(ssrCtx.pathname, resolvedPath) ?? {};\n const ctx: PagesNavigationContextShape = { pathname: resolvedPath, searchParams, params };\n _ssrPagesNavCtxCache.set(ssrCtx, ctx);\n return ctx;\n }\n\n // Client: derive from window.location + __NEXT_DATA__. __NEXT_DATA__.page\n // is the route pattern that was matched; navigateClient() keeps it in sync\n // with the visible URL on every client-side navigation. Cached so\n // useSyncExternalStore sees a stable snapshot between renders.\n const resolvedPath = stripBasePath(window.location.pathname, __basePath);\n const pattern = window.__NEXT_DATA__?.page ?? \"\";\n return _buildClientPagesNavigationContext(pattern, resolvedPath, window.location.search);\n}\n\n/**\n * Extract param names from a Next.js route pattern.\n * E.g., \"/posts/[id]\" → [\"id\"], \"/docs/[...slug]\" → [\"slug\"],\n * \"/shop/[[...path]]\" → [\"path\"], \"/blog/[year]/[month]\" → [\"year\", \"month\"]\n * Also handles internal format: \"/posts/:id\" → [\"id\"], \"/docs/:slug+\" → [\"slug\"]\n */\nfunction extractRouteParamNames(pattern: string): string[] {\n const names: string[] = [];\n // Match Next.js bracket format: [id], [...slug], [[...slug]]\n // Accepts any non-] characters inside brackets (Next.js PARAMETER_PATTERN parity).\n const bracketMatches = pattern.matchAll(/\\[{1,2}(?:\\.\\.\\.)?([^\\]]+)\\]{1,2}/g);\n for (const m of bracketMatches) {\n names.push(m[1]);\n }\n if (names.length > 0) return names;\n // Fallback: match internal :param format (any chars except /, +, *)\n const colonMatches = pattern.matchAll(/:([^/+*]+)[+*]?/g);\n for (const m of colonMatches) {\n names.push(m[1]);\n }\n return names;\n}\n\ntype RouteQueryNextData = {\n page?: string;\n query?: Record<string, string | string[] | undefined>;\n};\n\nfunction splitPathSegments(pathname: string): string[] {\n return pathname.split(\"/\").filter(Boolean);\n}\n\nfunction extractRouteParamsFromPath(\n pattern: string,\n pathname: string,\n): Record<string, string | string[]> | null {\n return matchRoutePattern(splitPathSegments(pathname), routePatternParts(pattern));\n}\n\nfunction getRouteQueryFromNextData(\n nextData: RouteQueryNextData | undefined,\n resolvedPath: string,\n): Record<string, string | string[]> {\n const routeQuery: Record<string, string | string[]> = {};\n if (!nextData?.query || !nextData.page) return routeQuery;\n\n const routeParamNames = extractRouteParamNames(nextData.page);\n if (routeParamNames.length === 0) return routeQuery;\n\n const currentRouteParams = extractRouteParamsFromPath(nextData.page, resolvedPath);\n if (currentRouteParams) return currentRouteParams;\n\n for (const key of routeParamNames) {\n const value = nextData.query[key];\n if (typeof value === \"string\") {\n routeQuery[key] = value;\n } else if (Array.isArray(value)) {\n routeQuery[key] = [...value];\n }\n }\n return routeQuery;\n}\n\nfunction getPathnameAndQuery(): {\n pathname: string;\n query: Record<string, string | string[]>;\n asPath: string;\n} {\n if (typeof window === \"undefined\") {\n const _ssrCtx = _getSSRContext();\n if (_ssrCtx) {\n const query: Record<string, string | string[]> = {};\n for (const [key, value] of Object.entries(_ssrCtx.query)) {\n query[key] = Array.isArray(value) ? [...value] : value;\n }\n return { pathname: _ssrCtx.pathname, query, asPath: _ssrCtx.asPath };\n }\n return { pathname: \"/\", query: {}, asPath: \"/\" };\n }\n const resolvedPath = stripBasePath(window.location.pathname, __basePath);\n // In Next.js, router.pathname is the route pattern (e.g., \"/posts/[id]\"),\n // not the resolved path (\"/posts/42\"). __NEXT_DATA__.page holds the route\n // pattern and is updated by navigateClient() on every client-side navigation.\n const pathname = window.__NEXT_DATA__?.page ?? resolvedPath;\n const nextData = window.__NEXT_DATA__;\n const routeQuery = getRouteQueryFromNextData(nextData, resolvedPath);\n // URL search params always reflect the current URL\n const searchQuery: Record<string, string | string[]> = {};\n const params = new URLSearchParams(window.location.search);\n for (const [key, value] of params) {\n addQueryParam(searchQuery, key, value);\n }\n const query = { ...searchQuery, ...routeQuery };\n // asPath uses the resolved browser path, not the route pattern\n const asPath = resolvedPath + window.location.search + window.location.hash;\n return { pathname, query, asPath };\n}\n\n/**\n * Error thrown when a navigation is superseded by a newer one.\n * Matches Next.js's convention of an Error with `.cancelled = true`.\n */\nclass NavigationCancelledError extends Error {\n cancelled = true;\n constructor(route: string) {\n super(`Abort fetching component for route: \"${route}\"`);\n this.name = \"NavigationCancelledError\";\n }\n}\n\n/**\n * Error thrown after queueing a hard navigation fallback for a known failure\n * mode. Callers can use this to avoid scheduling the same hard navigation twice.\n */\nclass HardNavigationScheduledError extends Error {\n hardNavigationScheduled = true;\n constructor(message: string) {\n super(message);\n this.name = \"HardNavigationScheduledError\";\n }\n}\n\n/**\n * Monotonically increasing ID for tracking the current navigation.\n * Each call to navigateClient() increments this and captures the value.\n * After each async boundary, the navigation checks whether it is still\n * the active one. If a newer navigation has started, the stale one\n * throws NavigationCancelledError so the caller can emit routeChangeError\n * and skip routeChangeComplete.\n *\n * Replaces the old boolean `_navInProgress` guard which silently dropped\n * the second navigation, causing URL/content mismatch.\n */\nlet _navigationId = 0;\n\n/** AbortController for the in-flight fetch, so superseded navigations abort network I/O. */\nlet _activeAbortController: AbortController | null = null;\n\nfunction scheduleHardNavigationAndThrow(url: string, message: string): never {\n if (typeof window === \"undefined\") {\n throw new HardNavigationScheduledError(message);\n }\n window.location.href = url;\n throw new HardNavigationScheduledError(message);\n}\n\ntype NavigateClientOptions = {\n allowNotFoundResponse?: boolean;\n};\n\n/** Wire format of `/_next/data/<id>/<page>.json` response bodies. */\ntype PagesDataResponse = {\n pageProps?: Record<string, unknown>;\n // Server may also emit `notFound`, `__N_SSP`, etc. — we only consume\n // `pageProps`; everything else triggers a hard reload per the\n // user-configured fallback policy.\n [key: string]: unknown;\n};\n\nfunction isPageComponent(value: unknown): value is ComponentType<Record<string, unknown>> {\n if (typeof value === \"function\") return true;\n if (!isUnknownRecord(value)) return false;\n return (\n value.$$typeof === Symbol.for(\"react.forward_ref\") ||\n value.$$typeof === Symbol.for(\"react.memo\")\n );\n}\n\nfunction isAppComponent(value: unknown): value is NonNullable<Window[\"__VINEXT_APP__\"]> {\n return isPageComponent(value);\n}\n\nfunction resolveSameOriginRedirectedUrl(responseUrl: string): string | null {\n const appPath = toSameOriginAppPath(responseUrl, __basePath);\n if (appPath === null) return null;\n return normalizePathTrailingSlash(\n toBrowserNavigationHref(appPath, window.location.href, __basePath),\n __trailingSlash,\n );\n}\n\nfunction stripLocalePrefixForApiRedirect(appPath: string): string {\n const locales = window.__VINEXT_LOCALES__;\n if (!locales || locales.length === 0) return appPath;\n\n try {\n const parsed = new URL(appPath, \"http://vinext.local\");\n const pathname = stripBasePath(parsed.pathname, __basePath);\n const firstSegment = pathname.split(\"/\")[1];\n if (!firstSegment || !locales.includes(firstSegment)) return appPath;\n\n const withoutLocale = pathname.slice(firstSegment.length + 1) || \"/\"; // +1 for leading `/`\n if (withoutLocale !== \"/api\" && !withoutLocale.startsWith(\"/api/\")) {\n return appPath;\n }\n\n return `${withoutLocale}${parsed.search}${parsed.hash}`;\n } catch {\n return appPath;\n }\n}\n\nfunction resolveLocalRedirectUrl(location: string): string | null {\n let appPath: string | null;\n if (location.startsWith(\"/\") && !location.startsWith(\"//\")) {\n try {\n // Data redirect headers can already be browser paths with basePath.\n // Convert back to app paths before toBrowserNavigationHref re-applies it.\n const parsed = new URL(location, \"http://vinext.local\");\n appPath = stripBasePath(parsed.pathname, __basePath) + parsed.search + parsed.hash;\n } catch {\n appPath = location;\n }\n } else {\n appPath = toSameOriginAppPath(location, __basePath);\n }\n\n if (appPath === null) return null;\n return normalizePathTrailingSlash(\n toBrowserNavigationHref(\n stripLocalePrefixForApiRedirect(appPath),\n window.location.href,\n __basePath,\n ),\n __trailingSlash,\n );\n}\n\nfunction hasVinextMiddleware(nextData: unknown): boolean {\n if (!isUnknownRecord(nextData)) return false;\n const vinext = nextData.__vinext;\n return isUnknownRecord(vinext) && vinext.hasMiddleware === true;\n}\n\nfunction getMiddlewarePagesDataFetchUrl(browserUrl: string): string | null {\n const nextData = window.__NEXT_DATA__;\n if (!nextData || !hasVinextMiddleware(nextData)) return null;\n const buildId = nextData.buildId;\n if (typeof buildId !== \"string\" || buildId.length === 0) return null;\n\n let parsed: URL;\n try {\n parsed = new URL(browserUrl, window.location.href);\n } catch {\n return null;\n }\n if (parsed.origin !== getWindowOrigin()) return null;\n\n const appPathname = stripBasePath(parsed.pathname, __basePath);\n return buildPagesDataHref(__basePath, buildId, appPathname, parsed.search);\n}\n\nasync function resolveMiddlewareDataRedirect(\n browserUrl: string,\n signal: AbortSignal,\n): Promise<string | null> {\n const dataUrl = getMiddlewarePagesDataFetchUrl(browserUrl);\n if (!dataUrl) return null;\n\n // We deliberately do NOT thread `signal` into the shared fetch — see the\n // dedup helper for why. Stale callers bail out via `assertStillCurrent()`\n // after the await; we still surface a pre-await abort via this check so\n // callers see the documented AbortError on supersession.\n if (signal.aborted) {\n throw new DOMException(\"Aborted\", \"AbortError\");\n }\n\n try {\n const res = await dedupedPagesDataFetch(dataUrl, {\n headers: {\n Accept: \"application/json\",\n \"x-nextjs-data\": \"1\",\n },\n });\n return res.headers.get(\"x-nextjs-redirect\");\n } catch {\n return null;\n }\n}\n\n/**\n * Perform client-side navigation via the `/_next/data/<id>/<page>.json`\n * endpoint. Used when `__VINEXT_PAGE_LOADERS__` has a matching code-split\n * loader for the target pattern (the prod hot path). Falls back to the\n * HTML extraction path (`navigateClientHtml`) when this returns `null`.\n *\n * Failure modes (404, 5xx, network, parse, missing loader, soft redirect)\n * all queue a hard navigation and throw `HardNavigationScheduledError`,\n * mirroring the existing HTML-path failure protocol. The hard reload is\n * the deploy-skew safety net: when the server's buildId has rotated, the\n * data endpoint returns 404 and the client lands on the new build via a\n * full document load.\n */\nasync function navigateClientData(\n url: string,\n target: PagesDataTarget,\n controller: AbortController,\n navId: number,\n assertStillCurrent: () => void,\n): Promise<void> {\n const root = window.__VINEXT_ROOT__;\n if (!root) {\n // No React root yet — fall back to hard navigation\n window.location.href = url;\n return;\n }\n\n // Fetch the page-data JSON.\n //\n // We dedupe by URL: concurrent `Router.push` calls (or back-to-back link\n // clicks) for the same destination share a single underlying request.\n // The shared fetch deliberately ignores `controller.signal` — each caller\n // still bails out of their navigation via `assertStillCurrent()` after the\n // await, but the shared network request itself runs to completion so other\n // racing callers still benefit. This matches Next.js's `inflightCache`\n // semantics in `fetchNextData()`.\n //\n // Pre-await abort still throws so callers see the documented cancellation\n // surface when supersession happened before the fetch was even attempted.\n if (controller.signal.aborted) {\n throw new NavigationCancelledError(url);\n }\n let res: Response;\n try {\n res = await dedupedPagesDataFetch(target.dataHref, {\n headers: { Accept: \"application/json\", \"x-nextjs-data\": \"1\" },\n });\n } catch (err: unknown) {\n if (err instanceof DOMException && err.name === \"AbortError\") {\n throw new NavigationCancelledError(url);\n }\n throw err;\n }\n assertStillCurrent();\n\n // Soft-redirect protocol: the data endpoint emits 200 + x-nextjs-redirect\n // when middleware (or gSSP/gSP) chose a redirect for this URL.\n const softRedirect = res.headers.get(\"x-nextjs-redirect\");\n if (softRedirect) {\n const redirectedUrl = resolveLocalRedirectUrl(softRedirect);\n if (!redirectedUrl) {\n scheduleHardNavigationAndThrow(softRedirect, \"Navigation redirected externally\");\n }\n\n window.history.replaceState(window.history.state ?? {}, \"\", redirectedUrl);\n _lastPathnameAndSearch = window.location.pathname + window.location.search;\n await navigateClientHtml(redirectedUrl, redirectedUrl, controller, navId, assertStillCurrent);\n return;\n }\n\n if (!res.ok) {\n // 404 here is the deploy-skew signal (server buildId rotated) — hard\n // reload to land on the new build's HTML. Any other non-OK status is\n // treated the same way per the user-configured \"always hard reload\"\n // fallback policy.\n scheduleHardNavigationAndThrow(url, `Data navigation failed: ${res.status} ${res.statusText}`);\n }\n\n let body: PagesDataResponse;\n try {\n body = (await res.json()) as PagesDataResponse;\n } catch {\n scheduleHardNavigationAndThrow(url, \"Data navigation failed: invalid JSON response\");\n }\n assertStillCurrent();\n\n const pageProps: Record<string, unknown> =\n body.pageProps && typeof body.pageProps === \"object\" ? body.pageProps : {};\n\n // Load the page module via the registered code-split loader. Vite has\n // already split each page into its own chunk; the loader is just the\n // `import()` thunk the build generated.\n let pageModule: { default?: unknown; [key: string]: unknown };\n try {\n pageModule = await target.loader();\n } catch (err) {\n console.error(\"[vinext] Page loader threw during navigation:\", err);\n scheduleHardNavigationAndThrow(url, \"Data navigation failed: page loader threw\");\n }\n assertStillCurrent();\n\n const PageComponent = pageModule.default;\n if (!isPageComponent(PageComponent)) {\n scheduleHardNavigationAndThrow(\n url,\n \"Data navigation failed: page module default export is not a component\",\n );\n }\n\n // Lazy-load `_app` if we have an app loader and haven't cached it yet.\n let AppComponent = window.__VINEXT_APP__;\n if (!AppComponent && typeof window.__VINEXT_APP_LOADER__ === \"function\") {\n try {\n const appModule = await window.__VINEXT_APP_LOADER__();\n AppComponent = isAppComponent(appModule.default) ? appModule.default : undefined;\n if (AppComponent) window.__VINEXT_APP__ = AppComponent;\n } catch {\n // _app load failed — fall through and render without it. This matches\n // the HTML path which also tolerates a missing _app gracefully.\n }\n }\n assertStillCurrent();\n\n // Import React (already evaluated; this is a cached re-import).\n const React = (await import(\"react\")).default;\n assertStillCurrent();\n\n let element: ReactElement;\n if (AppComponent) {\n element = React.createElement(AppComponent, {\n Component: PageComponent,\n pageProps,\n });\n } else {\n element = React.createElement(PageComponent, pageProps);\n }\n element = wrapWithRouterContext(element);\n\n // Build the updated __NEXT_DATA__. The JSON envelope is intentionally\n // minimal (just `pageProps`), so we synthesise the surrounding fields\n // from the data we already have: the matched pattern, the params, and\n // the previous nextData's buildId/locale state. This keeps\n // `useRouter()`, `getPagesNavigationContext()`, and any code reading\n // `window.__NEXT_DATA__` in sync after a JSON navigation — mirroring\n // what the HTML path produces.\n //\n // The cast through `unknown` is unavoidable: the upstream `NEXT_DATA`\n // type defines `query` as `ParsedUrlQuery` which is structurally\n // identical to our `Record<string, string | string[]>` but nominally\n // disjoint, so TypeScript rejects the direct assignment. We spread the\n // previous nextData first to inherit locale/locales/defaultLocale/\n // domainLocales unchanged, then override the per-navigation fields.\n // Mirror Next.js' `__NEXT_DATA__.query`: search params + dynamic route params\n // merged in one object, with route params winning on key collision (so\n // `/posts/123?id=456` still exposes `id: \"123\"`). Without this, code reading\n // `window.__NEXT_DATA__.query` directly would see only the dynamic params.\n const mergedQuery = mergeRouteParamsIntoQuery(parseQueryString(target.search), target.params);\n\n const prev = window.__NEXT_DATA__ as NonNullable<Window[\"__NEXT_DATA__\"]> | undefined;\n // Locale-prefixed URLs change the active locale; the JSON envelope itself\n // has no locale metadata, so derive it from the URL we navigated to.\n // `target.locale` is `undefined` when the URL is unprefixed — that means\n // either no i18n config (keep `prev.locale`) or the default locale\n // (override `prev.locale` so locale transitions back to default land\n // correctly). The locales list / defaultLocale / domainLocales are\n // build-time config and don't change between pages, so they spread through\n // from `prev` unchanged.\n const hasI18n = (window.__VINEXT_LOCALES__?.length ?? 0) > 0;\n const nextLocale = hasI18n\n ? (target.locale ?? window.__VINEXT_DEFAULT_LOCALE__)\n : (prev as VinextNextData | undefined)?.locale;\n const nextData = {\n ...prev,\n props: { pageProps },\n page: target.pattern,\n query: mergedQuery,\n buildId: target.buildId,\n isFallback: false,\n ...(nextLocale !== undefined ? { locale: nextLocale } : {}),\n } as unknown as NonNullable<Window[\"__NEXT_DATA__\"]> & VinextNextData;\n\n // INVARIANT: Everything between the final assertStillCurrent() above and\n // root.render() must be synchronous. If a future change introduces another\n // await, add an assertStillCurrent() before mutating window.__NEXT_DATA__.\n window.__NEXT_DATA__ = nextData;\n applyVinextLocaleGlobals(window, nextData);\n root.render(element);\n}\n\n/**\n * Perform client-side navigation by fetching the page's full HTML and\n * extracting `__NEXT_DATA__` plus the page module URL. Used in dev (where\n * the per-page inline hydration script does not populate the loader map) and\n * as a generic fallback when the data path is not available.\n *\n * Throws NavigationCancelledError if a newer navigation supersedes this one.\n * Throws on hard-navigation failures (non-OK response, missing data) so the\n * caller can distinguish success from failure for event emission.\n */\nasync function navigateClientHtml(\n url: string,\n fetchUrl: string,\n controller: AbortController,\n navId: number,\n assertStillCurrent: () => void,\n options: NavigateClientOptions = {},\n): Promise<void> {\n let browserUrl = url;\n let pendingRedirectHistoryUrl: string | null = fetchUrl === url ? null : url;\n const root = window.__VINEXT_ROOT__;\n if (!root) {\n // No React root yet — fall back to hard navigation\n window.location.href = browserUrl;\n return;\n }\n\n // Fetch the target page's SSR HTML\n let res: Response;\n try {\n res = await fetch(fetchUrl, {\n headers: { Accept: \"text/html\" },\n signal: controller.signal,\n });\n } catch (err: unknown) {\n // AbortError means a newer navigation cancelled this fetch\n if (err instanceof DOMException && err.name === \"AbortError\") {\n throw new NavigationCancelledError(url);\n }\n throw err;\n }\n assertStillCurrent();\n\n if (res.redirected && res.url) {\n const redirectedUrl = resolveSameOriginRedirectedUrl(res.url);\n if (redirectedUrl) {\n browserUrl = redirectedUrl;\n pendingRedirectHistoryUrl = redirectedUrl;\n }\n }\n\n if (!res.ok && !(options.allowNotFoundResponse === true && res.status === 404)) {\n // Set window.location.href first so the browser navigates to the correct\n // page even if the caller suppresses the error. The assignment schedules\n // the navigation asynchronously (as a task), so synchronous routeChangeError\n // listeners still run — and observe the error — before the page unloads.\n // Contract: routeChangeError listeners MUST be synchronous; async listeners\n // will not fire before the navigation completes. Callers (runNavigateClient)\n // must NOT schedule a second hard navigation — this assignment already queues\n // the browser fallback, and the helper-level HardNavigationScheduledError\n // makes that contract explicit to callers.\n scheduleHardNavigationAndThrow(\n browserUrl,\n `Navigation failed: ${res.status} ${res.statusText}`,\n );\n }\n\n const html = await res.text();\n assertStillCurrent();\n\n // Extract __NEXT_DATA__ from the HTML\n const nextDataJson = extractVinextNextDataJson(html);\n if (!nextDataJson) {\n scheduleHardNavigationAndThrow(url, \"Navigation failed: missing __NEXT_DATA__ in response\");\n }\n\n const nextData = parseVinextNextDataJson(nextDataJson);\n const { pageProps } = nextData.props;\n // Defer writing window.__NEXT_DATA__ until just before root.render() —\n // writing it here would let a stale navigation briefly pollute the global\n // between this assertStillCurrent() and the next one after await import().\n\n // Get the page module URL from __NEXT_DATA__.__vinext (preferred),\n // or fall back to parsing the hydration script\n let pageModuleUrl: string | undefined = nextData.__vinext?.pageModuleUrl;\n\n if (!pageModuleUrl) {\n // Legacy fallback: try to find the module URL in the inline script\n const moduleMatch = html.match(/import\\(\"([^\"]+)\"\\);\\s*\\n\\s*const PageComponent/);\n const altMatch = html.match(/await import\\(\"([^\"]+pages\\/[^\"]+)\"\\)/);\n pageModuleUrl = moduleMatch?.[1] ?? altMatch?.[1] ?? undefined;\n }\n\n let pageModule: { default?: unknown; [key: string]: unknown };\n if (!pageModuleUrl) {\n const loader = window.__VINEXT_PAGE_LOADERS__?.[nextData.page];\n if (!loader) {\n scheduleHardNavigationAndThrow(browserUrl, \"Navigation failed: no page module URL found\");\n }\n pageModule = await loader();\n } else {\n // Validate the module URL before importing — defense-in-depth against\n // unexpected __NEXT_DATA__ or malformed HTML responses\n if (!isValidModulePath(pageModuleUrl)) {\n console.error(\"[vinext] Blocked import of invalid page module path:\", pageModuleUrl);\n scheduleHardNavigationAndThrow(browserUrl, \"Navigation failed: invalid page module path\");\n }\n\n // Dynamically import the new page module\n pageModule = await import(/* @vite-ignore */ pageModuleUrl);\n }\n assertStillCurrent();\n\n const PageComponent = pageModule.default;\n if (!isPageComponent(PageComponent)) {\n scheduleHardNavigationAndThrow(\n browserUrl,\n \"Navigation failed: page module default export is not a component\",\n );\n }\n\n // Import React for createElement\n const React = (await import(\"react\")).default;\n assertStillCurrent();\n\n // Re-render with the new page, loading _app if needed\n let AppComponent = window.__VINEXT_APP__;\n const appModuleUrl: string | undefined = nextData.__vinext?.appModuleUrl;\n\n if (!AppComponent && appModuleUrl) {\n if (!isValidModulePath(appModuleUrl)) {\n console.error(\"[vinext] Blocked import of invalid app module path:\", appModuleUrl);\n } else {\n try {\n const appModule = await import(/* @vite-ignore */ appModuleUrl);\n AppComponent = isAppComponent(appModule.default) ? appModule.default : undefined;\n window.__VINEXT_APP__ = AppComponent;\n } catch {\n // _app not available — continue without it\n }\n }\n }\n assertStillCurrent();\n\n let element;\n if (AppComponent) {\n element = React.createElement(AppComponent, {\n Component: PageComponent,\n pageProps,\n });\n } else {\n element = React.createElement(PageComponent, pageProps);\n }\n\n // Wrap with RouterContext.Provider so next/router and next/compat/router work.\n element = wrapWithRouterContext(element);\n\n // Commit __NEXT_DATA__ only after all assertStillCurrent() checks have passed,\n // so a stale navigation can never pollute the global.\n // INVARIANT: Everything after the final assertStillCurrent() above (the\n // checkpoint immediately after the optional _app import) through\n // root.render() is synchronous. If any step here ever becomes async, add\n // another assertStillCurrent() before writing __NEXT_DATA__.\n if (pendingRedirectHistoryUrl) {\n window.history.replaceState(window.history.state ?? {}, \"\", pendingRedirectHistoryUrl);\n _lastPathnameAndSearch = window.location.pathname + window.location.search;\n }\n window.__NEXT_DATA__ = nextData;\n applyVinextLocaleGlobals(window, nextData);\n root.render(element);\n}\n\n/**\n * Perform client-side navigation. Prefers the JSON data endpoint when the\n * client has a registered code-split loader for the target route (the prod\n * hot path); otherwise falls back to fetching the page's full HTML (dev and\n * any unmapped route).\n *\n * Throws NavigationCancelledError if a newer navigation supersedes this one.\n * Throws on hard-navigation failures (non-OK response, missing data) so the\n * caller can distinguish success from failure for event emission.\n *\n * `fetchUrl` is the HTML-path fetch URL (already includes locale-root\n * fixups). The JSON path derives its own URL from the browser-facing `url`\n * because the data endpoint speaks the unprefixed path.\n */\nasync function navigateClient(\n url: string,\n fetchUrl = url,\n options: NavigateClientOptions = {},\n): Promise<void> {\n if (typeof window === \"undefined\") return;\n\n // Cancel any in-flight navigation (abort its fetch, mark it stale)\n _activeAbortController?.abort();\n const controller = new AbortController();\n _activeAbortController = controller;\n\n const navId = ++_navigationId;\n\n /** Check if this navigation is still the active one. If not, throw. */\n function assertStillCurrent(): void {\n if (navId !== _navigationId) {\n throw new NavigationCancelledError(url);\n }\n }\n\n try {\n // Error-route navigation (`router.push('/404'|'/_error', as)`): the masked\n // browser URL and the component route differ, and the error page has no\n // data endpoint. Skip data navigation and middleware-redirect probing\n // (both would target the fictional masked URL) and fetch the resolved\n // error HTML directly, allowing a 404 response to hydrate.\n if (options.allowNotFoundResponse === true) {\n await navigateClientHtml(url, fetchUrl, controller, navId, assertStillCurrent, options);\n } else {\n let browserUrl = url;\n let htmlFetchUrl = fetchUrl;\n const dataTarget = resolvePagesDataNavigationTarget(browserUrl, __basePath);\n if (!dataTarget) {\n let redirectLocation: string | null;\n try {\n redirectLocation = await resolveMiddlewareDataRedirect(browserUrl, controller.signal);\n } catch (err: unknown) {\n if (err instanceof DOMException && err.name === \"AbortError\") {\n throw new NavigationCancelledError(browserUrl);\n }\n throw err;\n }\n assertStillCurrent();\n if (redirectLocation) {\n const redirectedUrl = resolveLocalRedirectUrl(redirectLocation);\n if (!redirectedUrl) {\n scheduleHardNavigationAndThrow(redirectLocation, \"Navigation redirected externally\");\n }\n window.history.replaceState(window.history.state ?? {}, \"\", redirectedUrl);\n _lastPathnameAndSearch = window.location.pathname + window.location.search;\n browserUrl = redirectedUrl;\n htmlFetchUrl = redirectedUrl;\n }\n }\n\n if (dataTarget) {\n await navigateClientData(browserUrl, dataTarget, controller, navId, assertStillCurrent);\n } else {\n await navigateClientHtml(\n browserUrl,\n htmlFetchUrl,\n controller,\n navId,\n assertStillCurrent,\n options,\n );\n }\n }\n } finally {\n // Clean up the abort controller if this navigation is still the active one\n if (navId === _navigationId) {\n _activeAbortController = null;\n }\n }\n}\n\n/**\n * Run navigateClient and handle errors: emit routeChangeError on failure,\n * and fall back to a hard navigation for non-cancel errors so the browser\n * recovers to a consistent state.\n *\n * Returns:\n * - \"completed\" — navigation finished, caller should emit routeChangeComplete\n * - \"cancelled\" — superseded by a newer navigation, caller should return true\n * without emitting routeChangeComplete (matches Next.js behaviour)\n * - \"failed\" — genuine error, caller should return false (hard nav is already\n * scheduled as recovery)\n */\nasync function runNavigateClient(\n fullUrl: string,\n resolvedUrl: string,\n fetchUrl = fullUrl,\n options: NavigateClientOptions = {},\n): Promise<\"completed\" | \"cancelled\" | \"failed\"> {\n try {\n await navigateClient(fullUrl, fetchUrl, options);\n return \"completed\";\n } catch (err: unknown) {\n routerEvents.emit(\"routeChangeError\", err, resolvedUrl, { shallow: false });\n if (err instanceof NavigationCancelledError) {\n return \"cancelled\";\n }\n // Genuine error (network, parse, import failure): fall back to a hard\n // navigation so the browser lands on the correct page. Known failure modes\n // throw HardNavigationScheduledError, and this guard skips those; only\n // unexpected failures (parse, import, render) need recovery here.\n if (typeof window !== \"undefined\" && !(err instanceof HardNavigationScheduledError)) {\n window.location.href = fullUrl;\n }\n return \"failed\";\n }\n}\n\n/**\n * Build the full router value object from the current pathname, query, asPath,\n * and a set of navigation methods. Shared by the Pages Router context provider\n * and tests so the public router shape stays in sync.\n */\nfunction buildRouterValue(\n pathname: string,\n query: Record<string, string | string[]>,\n asPath: string,\n methods: {\n push: NextRouter[\"push\"];\n replace: NextRouter[\"replace\"];\n back: NextRouter[\"back\"];\n reload: NextRouter[\"reload\"];\n prefetch: NextRouter[\"prefetch\"];\n beforePopState: NextRouter[\"beforePopState\"];\n },\n): NextRouter {\n const _ssrState = _getSSRContext();\n const nextData =\n typeof window !== \"undefined\"\n ? (window.__NEXT_DATA__ as VinextNextData | undefined)\n : undefined;\n const locale = typeof window === \"undefined\" ? _ssrState?.locale : window.__VINEXT_LOCALE__;\n const locales = typeof window === \"undefined\" ? _ssrState?.locales : window.__VINEXT_LOCALES__;\n const defaultLocale =\n typeof window === \"undefined\" ? _ssrState?.defaultLocale : window.__VINEXT_DEFAULT_LOCALE__;\n const domainLocales =\n typeof window === \"undefined\" ? _ssrState?.domainLocales : nextData?.domainLocales;\n\n const route = typeof window !== \"undefined\" ? (nextData?.page ?? pathname) : pathname;\n\n return {\n pathname,\n route,\n query,\n asPath,\n basePath: __basePath,\n locale,\n locales,\n defaultLocale,\n domainLocales,\n isReady: true,\n isPreview: false,\n isFallback:\n typeof window !== \"undefined\"\n ? nextData?.isFallback === true\n : _ssrState?.isFallback === true,\n ...methods,\n events: routerEvents,\n };\n}\n\n/** Extract the hash fragment from a URL, including the leading `#`. */\nfunction extractHash(url: string): string {\n const i = url.indexOf(\"#\");\n return i === -1 ? \"\" : url.slice(i);\n}\n\n/** Notify in-page listeners (e.g. useRouter hooks) that navigation occurred. */\nfunction dispatchNavigateEvent(): void {\n window.dispatchEvent(new CustomEvent(\"vinext:navigate\"));\n}\n\n/**\n * Update history with the new URL and refresh the hash-only-detection tracker.\n * Centralises the `pushState`/`replaceState` branch so callers don't repeat it.\n */\nfunction updateHistory(mode: \"push\" | \"replace\", url: string): void {\n if (mode === \"push\") window.history.pushState({}, \"\", url);\n else window.history.replaceState({}, \"\", url);\n _lastPathnameAndSearch = window.location.pathname + window.location.search;\n}\n\n/**\n * Throw the canonical \"no router instance\" error used when a Pages Router\n * navigation method (push/replace/back/reload/prefetch/beforePopState) is\n * invoked during SSR or prerendering.\n *\n * Mirrors Next.js's `ServerRouter.push`/`replace`/etc. which all call\n * `noRouter()` in `packages/next/src/server/render.tsx`. The error message\n * matches Next.js verbatim so userland error handling and docs links work\n * unchanged.\n *\n * Ported from Next.js: packages/next/src/server/render.tsx\n * https://github.com/vercel/next.js/blob/canary/packages/next/src/server/render.tsx\n */\nfunction throwNoRouterInstance(): never {\n throw new Error(\n 'No router instance found. you should only use \"next/router\" inside the client side of your app. https://nextjs.org/docs/messages/no-router-instance',\n );\n}\n\n/**\n * Shared client-side navigation flow used by both `useRouter()` and the\n * `Router` singleton. The only differences between push/replace are the\n * history method (`pushState` vs `replaceState`), the external-URL fallback\n * (`assign` vs `replace`), and the fact that push saves scroll position for\n * back/forward restoration while replace does not.\n *\n * `onStateUpdate` lets the hook trigger a `setState` re-render at the same\n * point that hashChangeComplete/routeChangeComplete fires; the singleton\n * passes no callback.\n */\nasync function performNavigation(\n url: string | UrlObject,\n as: string | undefined,\n options: TransitionOptions | undefined,\n mode: \"push\" | \"replace\",\n onStateUpdate?: () => void,\n): Promise<boolean> {\n // SSR / prerender guard. Calling Router.push or Router.replace from a\n // Pages Router component during server rendering would otherwise crash\n // with `ReferenceError: window is not defined` (window.location is\n // accessed unconditionally below). Match Next.js's `ServerRouter.push`\n // behaviour and throw the documented \"no router instance\" error so the\n // failure surfaces as a normal render error instead of a ReferenceError\n // that takes down the request pipeline.\n if (typeof window === \"undefined\") {\n throwNoRouterInstance();\n }\n\n // Defence-in-depth dangerous-scheme guard. The synchronous guard inside\n // `Router.push` / `Router.replace` (see RouterMethods below) is the primary\n // line of defence and is what surfaces the matching console.error to React's\n // event-handler runtime. This inner guard catches any future call sites\n // that bypass the public Router methods and call `performNavigation`\n // directly. Mirrors Next.js's Pages Router check at\n // packages/next/src/shared/lib/router/router.ts:1025-1033,1057-1065.\n assertSafeNavigationUrl(resolveUrl(url));\n if (as !== undefined) {\n assertSafeNavigationUrl(String(as));\n }\n\n const navigationLocale = resolveTransitionLocale(options?.locale);\n let resolved = resolveNavigationTarget(url, as, navigationLocale);\n\n // External URLs — delegate to browser (unless same-origin)\n if (isExternalUrl(resolved)) {\n const localPath = toSameOriginAppPath(resolved, __basePath);\n if (localPath == null) {\n if (mode === \"push\") window.location.assign(resolved);\n else window.location.replace(resolved);\n return true;\n }\n resolved = localPath;\n }\n\n resolved = normalizePathTrailingSlash(resolved, __trailingSlash);\n const full = normalizePathTrailingSlash(\n toBrowserNavigationHref(resolved, window.location.href, __basePath),\n __trailingSlash,\n );\n const errorRouteHtmlFetchUrl = resolvePagesErrorHtmlFetchUrl(url, navigationLocale);\n const htmlFetchUrl = errorRouteHtmlFetchUrl ?? getPagesHtmlFetchUrl(full, navigationLocale);\n const navigateOptions: NavigateClientOptions = errorRouteHtmlFetchUrl\n ? { allowNotFoundResponse: true }\n : {};\n const shallow = options?.shallow ?? false;\n const doScroll = options?.scroll !== false;\n\n // Hash-only change — no page fetch needed\n if (isHashOnlyChange(full)) {\n const eventUrl = resolveHashUrl(full);\n routerEvents.emit(\"hashChangeStart\", eventUrl, { shallow });\n updateHistory(mode, resolved.startsWith(\"#\") ? resolved : full);\n if (doScroll) scrollToHashTarget(extractHash(resolved));\n onStateUpdate?.();\n routerEvents.emit(\"hashChangeComplete\", eventUrl, { shallow });\n dispatchNavigateEvent();\n return true;\n }\n\n if (mode === \"push\") saveScrollPosition();\n routerEvents.emit(\"routeChangeStart\", resolved, { shallow });\n routerEvents.emit(\"beforeHistoryChange\", resolved, { shallow });\n updateHistory(mode, full);\n if (!shallow) {\n const result = await runNavigateClient(full, resolved, htmlFetchUrl, navigateOptions);\n if (result === \"cancelled\") return true;\n if (result === \"failed\") return false;\n }\n onStateUpdate?.();\n routerEvents.emit(\"routeChangeComplete\", resolved, { shallow });\n\n const hash = extractHash(resolved);\n if (doScroll) {\n if (hash) scrollToHashTarget(hash);\n else window.scrollTo(0, 0);\n }\n dispatchNavigateEvent();\n return true;\n}\n\n/**\n * Prefetch the resources needed for a future Pages Router navigation.\n *\n * When the client has a registered code-split loader for the target route\n * (the prod hot path), we prefetch in parallel:\n * 1. The `/_next/data/<buildId>/<page>.json` payload — same URL the actual\n * navigation will request, so a cache hit is automatic.\n * 2. The page's JS chunk — by invoking the loader thunk now. Vite's\n * dynamic `import()` machinery is responsible for fetching + caching;\n * the returned Promise is intentionally discarded.\n *\n * When no loader is registered (dev server, or an unmapped route), we fall\n * back to the legacy `<link rel=\"prefetch\" as=\"document\">` hint, which lets\n * the browser preload the HTML document. This matches the pre-`_next/data`\n * behaviour so dev doesn't regress.\n *\n * Ported from Next.js: `packages/next/src/client/page-loader.ts` `prefetch`\n * (the data + chunk parallel prefetch shape).\n */\nasync function prefetchUrl(url: string): Promise<void> {\n if (typeof document === \"undefined\") return;\n\n const dataTarget = resolvePagesDataNavigationTarget(url, __basePath);\n if (dataTarget) {\n prefetchPagesData(dataTarget);\n return;\n }\n\n // The target is not a Pages Router route — mark it on `components` if the\n // App Router prefetch manifest recognises it. Mirrors Next.js's `_bfl`\n // marker write at `packages/next/src/shared/lib/router/router.ts:2525`;\n // the Next.js deploy test reads `window.next.router.components[<path>]` to\n // assert prefetch detection. See issue #1526.\n markAppRouteDetectedOnPrefetch(url, __basePath);\n\n // Legacy fallback for routes without a registered loader (e.g. dev).\n // Hints the browser to preload the HTML document so the next click feels\n // faster, even though we can't resolve the chunk ahead of time.\n const link = document.createElement(\"link\");\n link.rel = \"prefetch\";\n link.href = url;\n link.as = \"document\";\n document.head.appendChild(link);\n}\n\n/**\n * useRouter hook - Pages Router compatible.\n *\n * Ported from Next.js: packages/next/src/client/router.ts\n * https://github.com/vercel/next.js/blob/canary/packages/next/src/client/router.ts\n */\nexport function useRouter(): NextRouter {\n const router = useContext(RouterContext);\n if (!router) {\n throw new Error(\n \"NextRouter was not mounted. https://nextjs.org/docs/messages/next-router-not-mounted\",\n );\n }\n\n return router;\n}\n\nfunction PagesRouterProvider({ children }: { children: ReactNode }): ReactElement {\n const [{ pathname, query, asPath }, setState] = useState(getPathnameAndQuery);\n\n // Popstate is handled by the Pages Router client entry via\n // installPagesRouterRuntime() so beforePopState() is consistently enforced\n // regardless of hook consumers. Keep URL snapshot subscriptions at the\n // provider boundary so many useRouter() calls share one router state and one\n // vinext:navigate listener.\n useEffect(() => {\n const onNavigate = ((_e: CustomEvent) => {\n setState(getPathnameAndQuery());\n }) as EventListener;\n window.addEventListener(\"vinext:navigate\", onNavigate);\n return () => window.removeEventListener(\"vinext:navigate\", onNavigate);\n }, []);\n\n const router = useMemo(\n (): NextRouter =>\n buildRouterValue(pathname, query, asPath, {\n push: Router.push,\n replace: Router.replace,\n back: Router.back,\n reload: Router.reload,\n prefetch: Router.prefetch,\n beforePopState: Router.beforePopState,\n }),\n [pathname, query, asPath],\n );\n\n const appRouter = useMemo(\n (): AppRouterInstance => ({\n bfcacheId: \"0\",\n back() {\n Router.back();\n },\n forward() {\n if (typeof window === \"undefined\") throwNoRouterInstance();\n window.history.forward();\n },\n refresh() {\n Router.reload();\n },\n push(href, options) {\n void Router.push(href, undefined, { scroll: options?.scroll });\n },\n replace(href, options) {\n void Router.replace(href, undefined, { scroll: options?.scroll });\n },\n prefetch(href) {\n void Router.prefetch(href);\n },\n }),\n [],\n );\n\n const content = createElement(RouterContext.Provider, { value: router }, children);\n return AppRouterContext\n ? createElement(AppRouterContext.Provider, { value: appRouter }, content)\n : content;\n}\n\n// beforePopState callback: called before handling browser back/forward.\n// If it returns false, the navigation is cancelled.\nlet _beforePopStateCb: BeforePopStateCallback | undefined;\n\n// Track pathname+search for detecting hash-only back/forward in the popstate\n// handler. Updated after every pushState/replaceState so that popstate can\n// compare the previous value with the (already-changed) window.location.\nlet _lastPathnameAndSearch =\n typeof window !== \"undefined\" ? window.location.pathname + window.location.search : \"\";\n\nfunction handlePagesRouterPopState(e: PopStateEvent): void {\n const browserUrl = window.location.pathname + window.location.search;\n const appUrl = stripBasePath(window.location.pathname, __basePath) + window.location.search;\n\n // Detect hash-only back/forward: pathname+search unchanged, only hash differs.\n const isHashOnly = browserUrl === _lastPathnameAndSearch;\n\n // Check beforePopState callback\n if (_beforePopStateCb !== undefined) {\n const shouldContinue = _beforePopStateCb({\n url: appUrl,\n as: appUrl,\n options: { shallow: false },\n });\n if (!shouldContinue) return;\n }\n\n // Update tracker only after beforePopState confirms navigation proceeds.\n // If beforePopState cancels, the tracker must retain the previous value\n // so the next popstate compares against the correct baseline.\n _lastPathnameAndSearch = browserUrl;\n\n if (isHashOnly) {\n // Hash-only back/forward — no page fetch needed\n const hashUrl = appUrl + window.location.hash;\n routerEvents.emit(\"hashChangeStart\", hashUrl, { shallow: false });\n scrollToHashTarget(window.location.hash);\n routerEvents.emit(\"hashChangeComplete\", hashUrl, { shallow: false });\n dispatchNavigateEvent();\n return;\n }\n\n const fullAppUrl = appUrl + window.location.hash;\n routerEvents.emit(\"routeChangeStart\", fullAppUrl, { shallow: false });\n // Note: The browser has already updated window.location by the time popstate\n // fires, so this is not truly \"before\" the URL change. In Next.js the popstate\n // handler calls replaceState to store history metadata — beforeHistoryChange\n // precedes that call, not the URL change itself. We emit it here for API\n // compatibility.\n routerEvents.emit(\"beforeHistoryChange\", fullAppUrl, { shallow: false });\n void (async () => {\n const result = await runNavigateClient(\n browserUrl,\n fullAppUrl,\n getPagesHtmlFetchUrl(browserUrl, window.__VINEXT_LOCALE__),\n );\n if (result === \"completed\") {\n routerEvents.emit(\"routeChangeComplete\", fullAppUrl, { shallow: false });\n restoreScrollPosition(e.state);\n dispatchNavigateEvent();\n }\n // \"cancelled\": superseded by a newer navigation, so this popstate no longer wins.\n // \"failed\": runNavigateClient already scheduled the hard-navigation fallback.\n })();\n}\n\nsetPagesRouterPopStateHandler(handlePagesRouterPopState);\n\n/**\n * Wrap a React element in a RouterContext.Provider so that\n * next/compat/router's useRouter() returns the real Pages Router value.\n *\n * The provider owns the reactive Pages Router snapshot so next/router and\n * next/compat/router consumers share one context value instead of each hook\n * installing its own global URL-change listener.\n */\nexport function wrapWithRouterContext(element: ReactElement): ReactElement {\n return createElement(PagesRouterProvider, null, element);\n}\n\n/**\n * Props injected by `withRouter` into the wrapped component.\n *\n * Ported from Next.js: packages/next/src/client/with-router.tsx\n * https://github.com/vercel/next.js/blob/canary/packages/next/src/client/with-router.tsx\n */\nexport type WithRouterProps = {\n router: NextRouter;\n};\n\n/**\n * Pick<P, Exclude<keyof P, keyof WithRouterProps>> — the props of the\n * composed component minus the `router` prop that `withRouter` injects.\n *\n * Ported from Next.js: packages/next/src/client/with-router.tsx\n */\nexport type ExcludeRouterProps<P> = Pick<P, Exclude<keyof P, keyof WithRouterProps>>;\n\n/**\n * Higher-order component that injects the Pages Router `router` instance as\n * a `router` prop into a wrapped component. Primarily used by class\n * components (which cannot call hooks) to access the router. The wrapped\n * component receives the same props as the original, minus `router`, which\n * is filled in by the HOC.\n *\n * Ported from Next.js: packages/next/src/client/with-router.tsx\n * https://github.com/vercel/next.js/blob/canary/packages/next/src/client/with-router.tsx\n *\n * Differences from Next.js:\n * - We type the composed component as `ComponentType<P>` instead of\n * `NextComponentType<C, any, P>` because vinext does not expose\n * `NextComponentType` from this shim. The runtime shape (and the props\n * the wrapper forwards) is identical.\n * - We forward `getInitialProps` and `origGetInitialProps` from the\n * composed component so `_app` parity holds for class components that\n * define `getInitialProps`.\n */\nexport function withRouter<P extends WithRouterProps>(\n ComposedComponent: ComponentType<P>,\n): ComponentType<ExcludeRouterProps<P>> {\n function WithRouterWrapper(props: ExcludeRouterProps<P>): ReactElement {\n const router = useRouter();\n // Match Next.js spread order:\n // `<ComposedComponent router={useRouter()} {...props} />`\n // The injected `router` is placed first, and `{...props}` is spread\n // after, so a user-passed `router` prop overrides the HOC-injected\n // one (last-spread wins). Mirrors\n // packages/next/src/client/with-router.tsx. At the type level\n // `props: ExcludeRouterProps<P>` has no `router` key, but TS still\n // sees `P` as `WithRouterProps`-extending when checking the literal,\n // so we widen to a `Record` for the final prop bag.\n const merged: Record<string, unknown> = { router, ...(props as Record<string, unknown>) };\n return createElement(ComposedComponent, merged as unknown as P);\n }\n\n // Forward getInitialProps so class-component pages that define it keep\n // working when wrapped. Mirrors Next.js's with-router.tsx.\n const composed = ComposedComponent as ComponentType<P> & {\n getInitialProps?: unknown;\n origGetInitialProps?: unknown;\n };\n (WithRouterWrapper as unknown as { getInitialProps?: unknown }).getInitialProps =\n composed.getInitialProps;\n (WithRouterWrapper as unknown as { origGetInitialProps?: unknown }).origGetInitialProps =\n composed.origGetInitialProps;\n\n if (process.env.NODE_ENV !== \"production\") {\n const name = composed.displayName || composed.name || \"Unknown\";\n WithRouterWrapper.displayName = `withRouter(${name})`;\n }\n\n return WithRouterWrapper;\n}\n\n// Note: `withRouter` is exposed only as a named export from `next/router`.\n// The default export of that module is the Router singleton declared below.\n\n// Also export a default Router singleton for `import Router from 'next/router'`.\n//\n// State fields (`pathname`, `route`, `query`, `asPath`, etc.) are exposed as\n// live getters so `window.next.router.pathname` reflects the current URL\n// without callers needing to know about React render cycles. Mirrors\n// Next.js's `singletonRouter` shape from\n// .nextjs-ref/packages/next/src/client/router.ts (lines 32–47), which uses\n// `Object.defineProperty` to forward `urlPropertyFields` to the active\n// router instance. The Next.js deploy test suite drives navigations through\n// `browser.eval('next.router.push(...)')` and then reads\n// `browser.eval('next.router.pathname')` to assert success, so the fields\n// must be readable, not just the methods.\n//\n// Every navigation method is also guarded against SSR/prerender execution.\n// Matches Next.js's `ServerRouter` (packages/next/src/server/render.tsx) which\n// throws `noRouter()` from push/replace/back/reload/prefetch/beforePopState so\n// that invoking them during server rendering surfaces as a documented render\n// error rather than a `ReferenceError: window is not defined`. The throws are\n// synchronous (not via the returned Promise) so render-time callers see the\n// error inline — matching Next.js behaviour and avoiding unhandled rejections.\n/**\n * Pages Router `components` map exposed on the singleton.\n *\n * In Next.js, `Router.components` doubles as (a) the cached `PrivateRouteInfo`\n * keyed by route pattern after a real page render, and (b) a marker store\n * (`{ __appRouter: true }`) for App Router routes detected via prefetch (see\n * `packages/next/src/shared/lib/router/router.ts:2525`). The Next.js deploy\n * test suite asserts the latter through `window.next.router.components`.\n *\n * vinext only writes the marker variant — the cached-page-info side is handled\n * by Vite's module graph + our own loader manifest — but the property must be\n * present and mutable so the deploy assertion can find it. The map lives\n * behind a `Symbol.for` global so the Link shim's Pages-mode prefetch branch\n * writes to the same instance even when Vite resolves the router shim and\n * the link shim through different module IDs.\n *\n * Issue: https://github.com/cloudflare/vinext/issues/1526\n */\nconst _components = getPagesRouterComponentsMap();\n\nconst RouterMethods = {\n /** See `_components` comment above for the dual role this map plays. */\n components: _components,\n push: (url: string | UrlObject, as?: string, options?: TransitionOptions) => {\n if (typeof window === \"undefined\") throwNoRouterInstance();\n // Synchronously guard dangerous URI schemes (javascript:, data:, vbscript:)\n // before the async performNavigation kicks off. Mirrors Next.js's\n // Pages Router `push` at packages/next/src/shared/lib/router/router.ts:1025-1033,\n // where the check runs synchronously inside push() so the throw bubbles up\n // through React's event-handler error reporter (surfacing console.error).\n // Without this synchronous hoist, the throw inside `performNavigation`\n // (an async function) becomes a rejected Promise that React does not\n // observe from an event handler that does not await it (e.g.\n // `<button onClick={() => router.push(...)}>`).\n assertSafeNavigationUrl(resolveUrl(url));\n if (as !== undefined) {\n assertSafeNavigationUrl(String(as));\n }\n return performNavigation(url, as, options, \"push\");\n },\n replace: (url: string | UrlObject, as?: string, options?: TransitionOptions) => {\n if (typeof window === \"undefined\") throwNoRouterInstance();\n // See `push` above for the rationale on the synchronous guard.\n assertSafeNavigationUrl(resolveUrl(url));\n if (as !== undefined) {\n assertSafeNavigationUrl(String(as));\n }\n return performNavigation(url, as, options, \"replace\");\n },\n back: () => {\n if (typeof window === \"undefined\") throwNoRouterInstance();\n window.history.back();\n },\n reload: () => {\n if (typeof window === \"undefined\") throwNoRouterInstance();\n window.location.reload();\n },\n prefetch: (url: string) => {\n if (typeof window === \"undefined\") throwNoRouterInstance();\n return prefetchUrl(url);\n },\n beforePopState: (cb: BeforePopStateCallback) => {\n if (typeof window === \"undefined\") throwNoRouterInstance();\n _beforePopStateCb = cb;\n },\n events: routerEvents,\n};\n\nconst Router: typeof RouterMethods & Omit<NextRouter, keyof typeof RouterMethods> =\n Object.defineProperties(RouterMethods, {\n pathname: {\n enumerable: true,\n get(): string {\n return getPathnameAndQuery().pathname;\n },\n },\n route: {\n enumerable: true,\n get(): string {\n const { pathname } = getPathnameAndQuery();\n if (typeof window === \"undefined\") return pathname;\n const nextData = window.__NEXT_DATA__ as VinextNextData | undefined;\n return nextData?.page ?? pathname;\n },\n },\n query: {\n enumerable: true,\n get(): Record<string, string | string[]> {\n return getPathnameAndQuery().query;\n },\n },\n asPath: {\n enumerable: true,\n get(): string {\n return getPathnameAndQuery().asPath;\n },\n },\n basePath: { enumerable: true, value: __basePath, writable: false },\n locale: {\n enumerable: true,\n get(): string | undefined {\n if (typeof window === \"undefined\") return _getSSRContext()?.locale;\n return window.__VINEXT_LOCALE__;\n },\n },\n locales: {\n enumerable: true,\n get(): string[] | undefined {\n if (typeof window === \"undefined\") return _getSSRContext()?.locales;\n return window.__VINEXT_LOCALES__;\n },\n },\n defaultLocale: {\n enumerable: true,\n get(): string | undefined {\n if (typeof window === \"undefined\") return _getSSRContext()?.defaultLocale;\n return window.__VINEXT_DEFAULT_LOCALE__;\n },\n },\n domainLocales: {\n enumerable: true,\n get(): VinextNextData[\"domainLocales\"] | undefined {\n if (typeof window === \"undefined\") return _getSSRContext()?.domainLocales;\n return (window.__NEXT_DATA__ as VinextNextData | undefined)?.domainLocales;\n },\n },\n isReady: { enumerable: true, value: true, writable: false },\n isPreview: { enumerable: true, value: false, writable: false },\n isFallback: {\n enumerable: true,\n get(): boolean {\n if (typeof window === \"undefined\") return _getSSRContext()?.isFallback === true;\n return (window.__NEXT_DATA__ as VinextNextData | undefined)?.isFallback === true;\n },\n },\n }) as typeof RouterMethods & Omit<NextRouter, keyof typeof RouterMethods>;\n\n// Expose `window.next.router` for Next.js parity. Pages Router test suites,\n// userland scripts, and third-party libraries reach for this global directly\n// (e.g. `window.next.router.push(...)`, `window.next.router.events.on(...)`,\n// `window.next.router.pathname`).\n// Without this assignment, those callers crash with\n// `TypeError: Cannot read properties of undefined (reading 'router')`.\n//\n// Ported from Next.js: `packages/next/src/client/next.ts` (line 13). We do\n// NOT use a live-binding getter like Next.js does because vinext's Router\n// singleton is constructed synchronously here, so by the time this module\n// finishes loading the value is final.\nif (typeof window !== \"undefined\") {\n // Cast: `NextRouter.push`/`replace` are typed with narrow parameters\n // (UrlObject | string) while `PagesRouterPublicInstance` accepts unknown\n // args. The two are structurally compatible at runtime; TypeScript flags\n // the narrowing of contravariant function params, which is benign here\n // because callers reading off `window.next.router` are tests/userland\n // and treat the surface as opaque.\n installWindowNext({ router: Router as unknown as PagesRouterPublicInstance });\n}\n\n// Register the Pages Router compat shim source for `next/navigation` hooks\n// (useParams / useSearchParams / usePathname). The accessor is exposed\n// through a well-known Symbol.for so navigation.ts can read it without\n// importing this module — that avoids triggering navigation.ts's\n// `window.history.pushState` patch in tests that only need next/router.\n//\n// Mirrors Next.js's behavior where the pages-router server (render.tsx) and\n// client (client/index.tsx) wrap pages with SearchParamsContext /\n// PathParamsContext / PathnameContext providers populated from the router.\nconst _PAGES_NAVIGATION_ACCESSOR_KEY = Symbol.for(\n \"vinext.navigation.pagesNavigationContextAccessor\",\n);\n(globalThis as Record<PropertyKey, unknown>)[_PAGES_NAVIGATION_ACCESSOR_KEY] =\n getPagesNavigationContext;\n\nexport default Router;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqEA,MAAM,aAAqB,QAAQ,IAAI,0BAA0B;;AAEjE,MAAM,kBAA2B,QAAQ,IAAI,4BAA4B;AAmEzE,SAAS,qBAAmC;CAC1C,MAAM,4BAAY,IA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,eAA8C;;EAEhE;CACD,SAAS;EAAE,YAAY;EAAM,OAAO;EAAM,UAAU;EAAO;CAC3D,WAAW;EAAE,YAAY;EAAM,OAAO;EAAO,UAAU;EAAO;CAC9D,YAAY;EACV,YAAY;EACZ,MAAe;GACb,IAAI,OAAO,WAAW,aAAa,OAAO,gBAAgB,EAAE,eAAe;GAC3E,OAAQ,OAAO,eAA8C,eAAe;;EAE/E;CACF,CAAC;AAaJ,IAAI,OAAO,WAAW,aAOpB,kBAAkB,EAAE,QAAQ,QAAgD,CAAC;AAY/E,MAAM,iCAAiC,OAAO,IAC5C,mDACD;AACD,WAA6C,kCAC3C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"script-nonce-context.js","names":[],"sources":["../../src/shims/script-nonce-context.tsx"],"sourcesContent":["import React from \"react\";\n\nexport const ScriptNonceContext = React.createContext<string | undefined>(undefined);\n\nexport function ScriptNonceProvider(\n props: React.PropsWithChildren<{\n nonce?: string;\n }>,\n): React.ReactElement {\n return React.createElement(ScriptNonceContext.Provider, { value: props.nonce }, props.children);\n}\n\nexport function withScriptNonce(element: React.ReactElement, nonce?: string): React.ReactElement {\n if (!nonce) {\n return element;\n }\n\n return React.createElement(ScriptNonceProvider, { nonce }, element);\n}\n\nexport function useScriptNonce(): string | undefined {\n return React.useContext(ScriptNonceContext);\n}\n"],"mappings":";;AAEA,MAAa,qBAAqB,MAAM,cAAkC,KAAA,EAAU;AAEpF,SAAgB,oBACd,OAGoB;CACpB,OAAO,MAAM,cAAc,mBAAmB,UAAU,EAAE,OAAO,MAAM,OAAO,EAAE,MAAM,SAAS;;AAGjG,SAAgB,gBAAgB,SAA6B,OAAoC;CAC/F,IAAI,CAAC,OACH,OAAO;CAGT,OAAO,MAAM,cAAc,qBAAqB,EAAE,OAAO,EAAE,QAAQ;;AAGrE,SAAgB,iBAAqC;CACnD,OAAO,MAAM,WAAW,mBAAmB"}
|
package/dist/shims/script.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"script.js","names":[],"sources":["../../src/shims/script.tsx"],"sourcesContent":["\"use client\";\n\n/**\n * next/script shim\n *\n * Provides the <Script> component for loading third-party scripts with\n * configurable loading strategies.\n *\n * Strategies:\n * - \"beforeInteractive\": rendered as a <script> tag in SSR output\n * - \"afterInteractive\" (default): loaded client-side after hydration\n * - \"lazyOnload\": deferred until window.load + requestIdleCallback\n * - \"worker\": sets type=\"text/partytown\" (requires Partytown setup)\n */\nimport React, { useEffect, useRef } from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { hasAppNavigationRuntimeBootstrap } from \"../client/navigation-runtime.js\";\nimport { escapeInlineContent } from \"./head.js\";\nimport { useScriptNonce } from \"./script-nonce-context.js\";\nimport {\n useBeforeInteractiveRegister,\n type BeforeInteractiveInlineScript,\n} from \"./before-interactive-context.js\";\n\nexport type ScriptProps = {\n /** Script source URL */\n src?: string;\n /** Loading strategy. Default: \"afterInteractive\" */\n strategy?: \"beforeInteractive\" | \"afterInteractive\" | \"lazyOnload\" | \"worker\";\n /** Unique identifier for the script */\n id?: string;\n /** Called when the script has loaded */\n onLoad?: (e: Event) => void;\n /** Called when the script is ready (after load, and on every re-render if already loaded) */\n onReady?: () => void;\n /** Called on script load error */\n onError?: (e: Event) => void;\n /** Inline script content */\n children?: React.ReactNode;\n /** Dangerous inner HTML */\n dangerouslySetInnerHTML?: { __html: string };\n /** Script type attribute */\n type?: string;\n /** Async attribute */\n async?: boolean;\n /** Defer attribute */\n defer?: boolean;\n /** Crossorigin attribute */\n crossOrigin?: string;\n /** Nonce for CSP */\n nonce?: string;\n /** Integrity hash */\n integrity?: string;\n /**\n * Associated stylesheets to load alongside the script. Emitted as\n * `<link rel=\"stylesheet\" href=\"...\">` on SSR (via `ReactDOM.preinit`)\n * and inserted into `<head>` on the client load path.\n *\n * Mirrors Next.js App Router behaviour at\n * `.nextjs-ref/packages/next/src/client/script.tsx` (`insertStylesheets`\n * and the `appDir` block).\n */\n stylesheets?: string[];\n /** Additional attributes */\n [key: string]: unknown;\n};\n\n// Track scripts that have already been loaded, plus remote scripts currently\n// loading, to avoid duplicate DOM insertion when same-src components mount\n// before the first load event fires.\nconst loadedScripts = new Set<string>();\nconst loadingScripts = new Map<string, Promise<Event>>();\n\nfunction getClientAutoNonce(): string | undefined {\n if (typeof document === \"undefined\") return undefined;\n\n const existingNonceElement = document.querySelector(\"[nonce]\");\n if (!existingNonceElement) return undefined;\n\n // `HTMLElement` is not defined in some SSR/edge runtimes that polyfill\n // `document` but stop short of the full DOM surface. Guarding the\n // constructor before `instanceof` keeps SSR from crashing in those hosts;\n // when the constructor *is* present we still prefer the typed `.nonce`\n // property because browsers strip the `nonce` attribute from serialised\n // HTML for CSP reasons.\n if (typeof HTMLElement !== \"undefined\" && existingNonceElement instanceof HTMLElement) {\n return existingNonceElement.nonce || existingNonceElement.getAttribute(\"nonce\") || undefined;\n }\n\n return existingNonceElement.getAttribute(\"nonce\") || undefined;\n}\n\nfunction resolveScriptNonce(explicitNonce: unknown, contextualNonce?: string): string | undefined {\n if (typeof explicitNonce === \"string\" && explicitNonce.length > 0) {\n return explicitNonce;\n }\n\n if (typeof contextualNonce === \"string\" && contextualNonce.length > 0) {\n return contextualNonce;\n }\n\n if (typeof window === \"undefined\") {\n return undefined;\n }\n\n return getClientAutoNonce();\n}\n\n/**\n * Insert `<link rel=\"stylesheet\">` tags into `document.head` for each entry\n * in `stylesheets`. Used by the imperative client-side load path\n * (`handleClientScriptLoad`) when `ReactDOM.preinit` is not available\n * (e.g. pre-Float React or hosts that strip it). Mirrors Next.js's\n * `insertStylesheets` Pages-Router fallback at\n * `.nextjs-ref/packages/next/src/client/script.tsx:48-59`.\n *\n * The `ReactDOM.preinit` path is preferred where available — it dedupes\n * across mounts and respects React Float's hoisting order. This DOM\n * fallback is best-effort: no dedupe, no ordering guarantee.\n */\nfunction insertClientStylesheets(stylesheets: string[] | undefined): void {\n if (!stylesheets || stylesheets.length === 0) return;\n if (typeof document === \"undefined\") return;\n\n // Prefer ReactDOM.preinit when available — it dedupes via React Float\n // and matches Next.js's app-router behaviour.\n if (typeof ReactDOM.preinit === \"function\") {\n for (const href of stylesheets) {\n ReactDOM.preinit(href, { as: \"style\" });\n }\n return;\n }\n\n const head = document.head;\n if (!head) return;\n for (const href of stylesheets) {\n const link = document.createElement(\"link\");\n link.rel = \"stylesheet\";\n link.type = \"text/css\";\n link.href = href;\n head.appendChild(link);\n }\n}\n\n/**\n * Emit `<link rel=\"stylesheet\">` tags during SSR for each entry in\n * `stylesheets` via `ReactDOM.preinit`. React Float hoists these into\n * `<head>` in the streamed HTML. Mirrors the App-Router branch of\n * Next.js's Script component at `.nextjs-ref/packages/next/src/client/script.tsx:309-313`.\n */\nfunction preinitStylesheetsForSSR(stylesheets: string[] | undefined): void {\n if (!stylesheets || stylesheets.length === 0) return;\n if (typeof ReactDOM.preinit !== \"function\") return;\n for (const href of stylesheets) {\n ReactDOM.preinit(href, { as: \"style\" });\n }\n}\n\nfunction buildBeforeInteractiveScriptProps(options: {\n src?: string;\n id?: string;\n rest: Record<string, unknown>;\n resolvedNonce?: string;\n dangerouslySetInnerHTML?: { __html: string };\n}): Record<string, unknown> {\n const scriptProps: Record<string, unknown> = { ...options.rest };\n if (options.src) scriptProps.src = options.src;\n if (options.id) scriptProps.id = options.id;\n if (options.resolvedNonce) {\n scriptProps.nonce = options.resolvedNonce;\n }\n if (options.dangerouslySetInnerHTML) {\n scriptProps.dangerouslySetInnerHTML = {\n __html: escapeInlineContent(options.dangerouslySetInnerHTML.__html, \"script\"),\n };\n }\n return scriptProps;\n}\n\n/**\n * Extract the inline script content for a `beforeInteractive` Script element\n * with no `src`. Returns `null` when the element has neither a string-shaped\n * `children` value nor a valid `dangerouslySetInnerHTML.__html` payload — in\n * that case the caller should fall through to React's regular rendering path.\n *\n * The returned string is the raw author-supplied JavaScript content. Callers\n * are responsible for passing it through `escapeInlineContent(..., \"script\")`\n * before emitting it inside a `<script>` tag (we keep that escape adjacent\n * to the emit point so the rule is obvious at the boundary).\n */\nfunction extractBeforeInteractiveInlineContent(\n children: React.ReactNode,\n dangerouslySetInnerHTML?: { __html: string },\n): string | null {\n if (\n dangerouslySetInnerHTML &&\n typeof dangerouslySetInnerHTML.__html === \"string\" &&\n dangerouslySetInnerHTML.__html.length > 0\n ) {\n return dangerouslySetInnerHTML.__html;\n }\n if (typeof children === \"string\" && children.length > 0) {\n return children;\n }\n if (Array.isArray(children) && children.every((c) => typeof c === \"string\")) {\n const joined = (children as string[]).join(\"\");\n return joined.length > 0 ? joined : null;\n }\n return null;\n}\n\n/**\n * Map of React DOM prop names to their HTML attribute equivalents. Mirrors\n * Next.js's `set-attributes-from-props.ts`:\n * .nextjs-ref/packages/next/src/client/set-attributes-from-props.ts\n * HTML parses attribute names case-insensitively, so without this translation\n * `className=\"foo\"` round-trips as `classname=\"foo\"` and CSS selectors on\n * `.foo` never match. Same hazard for `htmlFor`/`for`, `httpEquiv`/`http-equiv`,\n * `acceptCharset`/`accept-charset`.\n */\nconst REACT_TO_HTML_ATTR: Record<string, string> = {\n acceptCharset: \"accept-charset\",\n className: \"class\",\n htmlFor: \"for\",\n httpEquiv: \"http-equiv\",\n};\n\n/**\n * Convert the residual `<Script>` props into a plain string-attributes record\n * for emission inside a hoisted `<script>` tag. Drops React-only props\n * (event handlers, children, etc.) and reserved keys already handled by the\n * pre-head-injection emitter (id, nonce). Skips `undefined`/`null` so they\n * round-trip as \"attribute absent\" rather than `attr=\"undefined\"`.\n *\n * React DOM prop names (className, htmlFor, etc.) are translated to their\n * HTML attribute names so the output parses correctly — see comment on\n * `REACT_TO_HTML_ATTR`.\n */\nfunction collectBeforeInteractiveAttributes(\n rest: Record<string, unknown>,\n): Record<string, string | boolean> {\n const RESERVED = new Set([\n \"id\",\n \"nonce\",\n \"src\",\n \"children\",\n \"strategy\",\n \"dangerouslySetInnerHTML\",\n \"onLoad\",\n \"onReady\",\n \"onError\",\n \"stylesheets\",\n ]);\n const out: Record<string, string | boolean> = {};\n for (const [key, value] of Object.entries(rest)) {\n if (RESERVED.has(key)) continue;\n if (value === undefined || value === null || value === false) continue;\n const attrName = REACT_TO_HTML_ATTR[key] ?? key;\n if (typeof value === \"boolean\") {\n out[attrName] = true;\n continue;\n }\n if (typeof value === \"string\" || typeof value === \"number\") {\n out[attrName] = String(value);\n continue;\n }\n // Skip anything else (functions, objects) — they cannot serialise into an\n // HTML attribute and only the developer-controlled string/boolean shape\n // is expected for native `<script>` attributes here.\n }\n return out;\n}\n\nfunction setBooleanScriptAttribute(el: HTMLScriptElement, attr: string, value: unknown): boolean {\n const enabled = value !== false && value !== \"false\" && Boolean(value);\n\n switch (attr) {\n case \"async\":\n el.async = enabled;\n break;\n case \"defer\":\n el.defer = enabled;\n break;\n case \"noModule\":\n case \"nomodule\":\n el.noModule = enabled;\n break;\n default:\n return false;\n }\n\n if (!enabled) {\n // Dynamic script elements start in the browser's force-async state.\n // Setting and removing the attribute mirrors Next.js and clears that state.\n el.setAttribute(attr, \"\");\n el.removeAttribute(attr);\n }\n\n return true;\n}\n\nfunction setScriptAttributes(el: HTMLScriptElement, rest: Record<string, unknown>): void {\n for (const [attr, value] of Object.entries(rest)) {\n if (attr === \"dangerouslySetInnerHTML\") continue;\n if (value === undefined) continue;\n if (setBooleanScriptAttribute(el, attr, value)) continue;\n if (attr === \"className\" && typeof value === \"string\") {\n el.setAttribute(\"class\", value);\n } else if (typeof value === \"string\") {\n el.setAttribute(attr, value);\n } else if (typeof value === \"boolean\" && value) {\n el.setAttribute(attr, \"\");\n }\n }\n}\n\nfunction loadClientScript(\n props: ScriptProps,\n options: {\n resolvedNonce?: string;\n fireReadyWhenAlreadyLoaded: boolean;\n },\n): void {\n const {\n src,\n id,\n onLoad,\n onReady,\n onError,\n strategy = \"afterInteractive\",\n children,\n dangerouslySetInnerHTML,\n stylesheets,\n ...rest\n } = props;\n if (typeof window === \"undefined\") return;\n\n // Insert associated stylesheets into <head> regardless of whether the\n // script was already loaded — the script's onReady handlers may already\n // assume the stylesheet is present. `insertClientStylesheets` dedupes\n // via ReactDOM.preinit where available.\n insertClientStylesheets(stylesheets);\n\n const key = id ?? src ?? \"\";\n if (key && loadedScripts.has(key)) {\n if (options.fireReadyWhenAlreadyLoaded) {\n onReady?.();\n }\n return;\n }\n\n if (src) {\n const existingLoad = loadingScripts.get(src);\n if (existingLoad) {\n void existingLoad.then(\n (event) => {\n if (key) loadedScripts.add(key);\n onLoad?.(event);\n onReady?.();\n },\n (event) => onError?.(event),\n );\n return;\n }\n }\n\n const el = document.createElement(\"script\");\n if (src) el.src = src;\n if (id) el.id = id;\n\n setScriptAttributes(el, rest);\n if (options.resolvedNonce && !el.getAttribute(\"nonce\")) {\n el.setAttribute(\"nonce\", options.resolvedNonce);\n }\n\n if (strategy === \"worker\") {\n el.setAttribute(\"type\", \"text/partytown\");\n }\n\n const markLoaded = () => {\n if (key) loadedScripts.add(key);\n onReady?.();\n };\n\n if (dangerouslySetInnerHTML?.__html) {\n // Intentional: mirrors the Next.js <Script> API where dangerouslySetInnerHTML\n // is developer-supplied inline script content (not user input). The prop name\n // itself signals developer awareness of the XSS risk, consistent with React's\n // design. User-supplied data must never flow into this prop.\n el.innerHTML = dangerouslySetInnerHTML.__html;\n markLoaded();\n } else if (children && typeof children === \"string\") {\n el.textContent = children;\n markLoaded();\n } else if (src) {\n const loadPromise = new Promise<Event>((resolve, reject) => {\n el.addEventListener(\"load\", (event) => {\n resolve(event);\n if (key) loadedScripts.add(key);\n onLoad?.(event);\n onReady?.();\n });\n el.addEventListener(\"error\", (event) => {\n reject(event);\n onError?.(event);\n });\n });\n loadPromise.catch(() => undefined).finally(() => loadingScripts.delete(src));\n loadingScripts.set(src, loadPromise);\n }\n\n document.body.appendChild(el);\n}\n\n/**\n * Load a script imperatively (outside of React).\n */\nexport function handleClientScriptLoad(props: ScriptProps): void {\n loadClientScript(props, {\n resolvedNonce: resolveScriptNonce(props.nonce),\n fireReadyWhenAlreadyLoaded: false,\n });\n}\n\n/**\n * Initialize multiple scripts at once (called during app bootstrap).\n */\nexport function initScriptLoader(scripts: ScriptProps[]): void {\n for (const script of scripts) {\n handleClientScriptLoad(script);\n }\n}\n\nfunction Script(props: ScriptProps): React.ReactElement | null {\n const {\n src,\n id,\n strategy = \"afterInteractive\",\n onLoad,\n onReady,\n onError,\n children,\n dangerouslySetInnerHTML,\n stylesheets,\n ...rest\n } = props;\n\n const hasMounted = useRef(false);\n const key = id ?? src ?? \"\";\n const contextualNonce = useScriptNonce();\n const resolvedNonce = resolveScriptNonce(rest.nonce, contextualNonce);\n // Available only during SSR — the provider lives in app-ssr-entry.ts. When\n // missing (Pages Router SSR, raw renderToString, client render) we keep the\n // inline `<script>` element in source order.\n const registerBeforeInteractive = useBeforeInteractiveRegister();\n\n // Client path: load scripts via useEffect based on strategy.\n // useEffect never runs during SSR, so it's safe to call unconditionally.\n useEffect(() => {\n if (hasMounted.current) return;\n hasMounted.current = true;\n\n if (strategy === \"beforeInteractive\") {\n // The script itself is loaded by Next.js's bootstrap before hydration,\n // but the associated stylesheets still need to land in <head> on the\n // client. ReactDOM.preinit (called inside insertClientStylesheets)\n // dedupes against any SSR-emitted <link rel=\"stylesheet\">, so this is\n // safe even when the server already hoisted them via React Float.\n insertClientStylesheets(stylesheets);\n return;\n }\n\n // Already loaded — just fire onReady\n if (key && loadedScripts.has(key)) {\n // Stylesheets must still be inserted on subsequent mounts of the same\n // script. loadClientScript handles this for the fresh-load path; the\n // already-loaded shortcut needs it explicitly.\n insertClientStylesheets(stylesheets);\n onReady?.();\n return;\n }\n\n const load = () => {\n if (key && loadedScripts.has(key)) {\n onReady?.();\n return;\n }\n\n loadClientScript(\n {\n src,\n id,\n strategy,\n onLoad,\n onReady,\n onError,\n children,\n dangerouslySetInnerHTML,\n stylesheets,\n ...rest,\n },\n { resolvedNonce, fireReadyWhenAlreadyLoaded: true },\n );\n };\n\n if (strategy === \"lazyOnload\") {\n // Wait for window load, then use idle callback\n if (document.readyState === \"complete\") {\n if (typeof requestIdleCallback === \"function\") {\n requestIdleCallback(load);\n } else {\n setTimeout(load, 1);\n }\n } else {\n window.addEventListener(\"load\", () => {\n if (typeof requestIdleCallback === \"function\") {\n requestIdleCallback(load);\n } else {\n setTimeout(load, 1);\n }\n });\n }\n } else {\n // \"afterInteractive\" (default), \"beforeInteractive\" (client re-mount), \"worker\"\n load();\n }\n }, [\n src,\n id,\n strategy,\n onLoad,\n onReady,\n onError,\n children,\n dangerouslySetInnerHTML,\n stylesheets,\n key,\n resolvedNonce,\n rest,\n ]);\n\n // SSR path: only \"beforeInteractive\" renders a <script> tag server-side\n if (typeof window === \"undefined\") {\n // Emit associated stylesheets as <link rel=\"stylesheet\"> via React Float.\n // ReactDOM.preinit dedupes across mounts and hoists the link into <head>\n // regardless of strategy — matches Next.js's app-router branch at\n // `.nextjs-ref/packages/next/src/client/script.tsx:309-313`.\n preinitStylesheetsForSSR(stylesheets);\n\n // React Float preload — emits <link rel=\"preload\" as=\"script\" /> in <head>\n // so the script is fetched while HTML streams. Mirrors Next.js's App Router\n // behavior at .nextjs-ref/packages/next/src/client/script.tsx:298-376:\n // - afterInteractive with src: preload only (no <script> tag in SSR)\n // - beforeInteractive with src: preload + <script> tag\n // - inline scripts (no src): no preload\n // Calling ReactDOM.preload during SSR is safe in both routers; React only\n // hoists the link when it has a real <head> to hoist into.\n if (\n src &&\n typeof ReactDOM.preload === \"function\" &&\n (strategy === \"afterInteractive\" || strategy === \"beforeInteractive\")\n ) {\n const integrity = typeof rest.integrity === \"string\" ? rest.integrity : undefined;\n const crossOrigin =\n rest.crossOrigin === \"anonymous\" || rest.crossOrigin === \"use-credentials\"\n ? rest.crossOrigin\n : undefined;\n const preloadOptions: ReactDOM.PreloadOptions = {\n as: \"script\",\n crossOrigin,\n };\n if (resolvedNonce !== undefined) {\n preloadOptions.nonce = resolvedNonce;\n }\n if (integrity !== undefined) {\n preloadOptions.integrity = integrity;\n }\n ReactDOM.preload(src, preloadOptions);\n }\n\n if (strategy === \"beforeInteractive\") {\n // Inline beforeInteractive scripts (no src) need to run BEFORE any\n // stylesheets, modulepreload links, or other resource hints React Float\n // hoists into <head>. React Fizz emits user-rendered head children\n // AFTER the hoisted resources, so leaving the script in source order\n // breaks the no-flash dark-mode pattern. We instead capture the inline\n // content through BeforeInteractiveContext and the SSR pipeline emits\n // it immediately after `<head>` opens — guaranteeing it precedes every\n // React-emitted hint in the streamed HTML.\n const inlineContent = src\n ? null\n : extractBeforeInteractiveInlineContent(children, dangerouslySetInnerHTML);\n if (inlineContent !== null && registerBeforeInteractive) {\n const inline: BeforeInteractiveInlineScript = {\n id,\n // Escape `</script>` sequences exactly as the inline render path does\n // (see buildBeforeInteractiveScriptProps); keep the escape colocated\n // with the emit boundary so it never gets accidentally skipped.\n innerHTML: escapeInlineContent(inlineContent, \"script\"),\n nonce: resolvedNonce,\n attributes: collectBeforeInteractiveAttributes(rest),\n };\n registerBeforeInteractive(inline);\n return null;\n }\n\n return React.createElement(\n \"script\",\n buildBeforeInteractiveScriptProps({\n src,\n id,\n rest,\n resolvedNonce,\n dangerouslySetInnerHTML,\n }),\n children,\n );\n }\n // Other strategies don't render during SSR\n return null;\n }\n\n if (strategy === \"beforeInteractive\") {\n // On the client, only suppress the `<script>` render for inline\n // beforeInteractive Scripts in App Router pages. The pre-head splice\n // in app-ssr-entry/app-ssr-stream already put the tag in the DOM, so\n // rendering it again would either duplicate the script (for Scripts\n // outside `<head>`) or cause a hydration mismatch (positions differ).\n //\n // For Pages Router and any other SSR path that didn't run through\n // app-ssr-entry, the server rendered the `<script>` inline in source\n // order, so the client must match. We detect \"App Router\" via the\n // navigation runtime that the App Router bootstrap installs before\n // calling hydrateRoot — it is the most reliable runtime signal we\n // can read from inside a `\"use client\"` shim.\n //\n // External-`src` beforeInteractive scripts always keep rendering\n // inline. They are not captured by the pre-head splice and must mount\n // through React so their `src` attribute is fetched on the client.\n const inlineContent = src\n ? null\n : extractBeforeInteractiveInlineContent(children, dangerouslySetInnerHTML);\n if (inlineContent !== null && hasAppNavigationRuntimeBootstrap()) {\n return null;\n }\n\n return React.createElement(\n \"script\",\n buildBeforeInteractiveScriptProps({\n src,\n id,\n rest,\n resolvedNonce,\n dangerouslySetInnerHTML,\n }),\n children,\n );\n }\n\n // The component itself renders nothing — scripts are injected imperatively\n return null;\n}\n\nexport default Script;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsEA,MAAM,gCAAgB,IAAI,KAAa;AACvC,MAAM,iCAAiB,IAAI,KAA6B;AAExD,SAAS,qBAAyC;CAChD,IAAI,OAAO,aAAa,aAAa,OAAO,KAAA;CAE5C,MAAM,uBAAuB,SAAS,cAAc,UAAU;CAC9D,IAAI,CAAC,sBAAsB,OAAO,KAAA;CAQlC,IAAI,OAAO,gBAAgB,eAAe,gCAAgC,aACxE,OAAO,qBAAqB,SAAS,qBAAqB,aAAa,QAAQ,IAAI,KAAA;CAGrF,OAAO,qBAAqB,aAAa,QAAQ,IAAI,KAAA;;AAGvD,SAAS,mBAAmB,eAAwB,iBAA8C;CAChG,IAAI,OAAO,kBAAkB,YAAY,cAAc,SAAS,GAC9D,OAAO;CAGT,IAAI,OAAO,oBAAoB,YAAY,gBAAgB,SAAS,GAClE,OAAO;CAGT,IAAI,OAAO,WAAW,aACpB;CAGF,OAAO,oBAAoB;;;;;;;;;;;;;;AAe7B,SAAS,wBAAwB,aAAyC;CACxE,IAAI,CAAC,eAAe,YAAY,WAAW,GAAG;CAC9C,IAAI,OAAO,aAAa,aAAa;CAIrC,IAAI,OAAO,SAAS,YAAY,YAAY;EAC1C,KAAK,MAAM,QAAQ,aACjB,SAAS,QAAQ,MAAM,EAAE,IAAI,SAAS,CAAC;EAEzC;;CAGF,MAAM,OAAO,SAAS;CACtB,IAAI,CAAC,MAAM;CACX,KAAK,MAAM,QAAQ,aAAa;EAC9B,MAAM,OAAO,SAAS,cAAc,OAAO;EAC3C,KAAK,MAAM;EACX,KAAK,OAAO;EACZ,KAAK,OAAO;EACZ,KAAK,YA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gB,eAAe,KAAK,gBAAgB,oBACrD,KAAK,cACL,KAAA;IAIL;GACD,IAAI,kBAAkB,KAAA,GACpB,eAAe,QAAQ;GAEzB,IAAI,cAAc,KAAA,GAChB,eAAe,YAAY;GAE7B,SAAS,QAAQ,KAAK,eAAe;;EAGvC,IAAI,aAAa,qBAAqB;GASpC,MAAM,gBAAgB,MAClB,OACA,sCAAsC,UAAU,wBAAwB;GAC5E,IAAI,kBAAkB,QAAQ,2BAA2B;IAUvD,0BAA0B;KARxB;KAIA,WAAW,oBAAoB,eAAe,SAAS;KACvD,OAAO;KACP,YAAY,mCAAmC,KAAK;KAEtB,CAAC;IACjC,OAAO;;GAGT,OAAO,MAAM,cACX,UACA,kCAAkC;IAChC;IACA;IACA;IACA;IACA;IACD,CAAC,EACF,SACD;;EAGH,OAAO;;CAGT,IAAI,aAAa,qBAAqB;EAoBpC,KAHsB,MAClB,OACA,sCAAsC,UAAU,wBAAwB,MACtD,QAAQ,kCAAkC,EAC9D,OAAO;EAGT,OAAO,MAAM,cACX,UACA,kCAAkC;GAChC;GACA;GACA;GACA;GACA;GACD,CAAC,EACF,SACD;;CAIH,OAAO"}
|
package/dist/shims/server.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","names":[],"sources":["../../src/shims/server.ts"],"sourcesContent":["/**\n * next/server shim\n *\n * Provides NextRequest, NextResponse, and related types that work with\n * standard Web APIs (Request/Response). This means they work on Node,\n * Cloudflare Workers, Deno, and any WinterCG-compatible runtime.\n *\n * This is a pragmatic subset — we implement the most commonly used APIs\n * rather than bug-for-bug parity with Next.js internals.\n */\n\nimport {\n MIDDLEWARE_NEXT_HEADER,\n MIDDLEWARE_REWRITE_HEADER,\n MIDDLEWARE_SET_COOKIE_HEADER,\n} from \"../server/headers.js\";\nimport { encodeMiddlewareRequestHeaders } from \"../server/middleware-request-headers.js\";\nimport { serializeSetCookie, validateCookieName } from \"./internal/cookie-serialize.js\";\nimport { parseCookieHeader } from \"./internal/parse-cookie-header.js\";\nimport { getRequestExecutionContext } from \"./request-context.js\";\nimport { assertSafeNavigationUrl } from \"./url-safety.js\";\nimport { stripBasePath } from \"../utils/base-path.js\";\n\n// ---------------------------------------------------------------------------\n// Inlined cache-scope guard for after()\n//\n// We cannot statically import throwIfInsideCacheScope from headers.ts here\n// because headers.ts contains the \"use cache\" directive string in its error\n// message, which causes Vite's use-cache transform to include it in the module\n// graph. If headers.ts is pulled in via static import from server.ts, the\n// transform fires on it in Pages Router fixtures that lack @vitejs/plugin-rsc.\n//\n// The connection() function in this file avoids the same problem by using\n// `await import(\"./headers.js\")` (dynamic import, async function). after()\n// must remain synchronous, so we inline the check using the same Symbol.for\n// keys that cache-runtime.ts and cache.ts register their ALS instances with.\n// ---------------------------------------------------------------------------\n\nconst _USE_CACHE_ALS_KEY = Symbol.for(\"vinext.cacheRuntime.contextAls\");\nconst _UNSTABLE_CACHE_ALS_KEY = Symbol.for(\"vinext.unstableCache.als\");\nconst _g = globalThis as unknown as Record<PropertyKey, unknown>;\n\n/**\n * Record an invalid dynamic usage error on the request context so it survives\n * user try/catch and can be forwarded to the dev overlay on client-side navigations.\n */\nfunction _recordInvalidDynamicUsageError(error: Error): void {\n try {\n const _unifiedAls = _g[Symbol.for(\"vinext.unifiedRequestContext.als\")] as\n | { getStore(): unknown }\n | undefined;\n const ctx = _unifiedAls?.getStore() as Record<string, unknown> | undefined;\n if (ctx) ctx.invalidDynamicUsageError = error;\n } catch {\n // Ignore — best-effort recording for dev diagnostics\n }\n}\n\nfunction _throwIfInsideCacheScope(apiName: string): void {\n const cacheAls = _g[_USE_CACHE_ALS_KEY] as { getStore(): unknown } | undefined;\n if (cacheAls?.getStore() != null) {\n const error = new Error(\n `\\`${apiName}\\` cannot be called inside \"use cache\". ` +\n `If you need this data inside a cached function, call \\`${apiName}\\` ` +\n \"outside and pass the required data as an argument.\",\n );\n _recordInvalidDynamicUsageError(error);\n throw error;\n }\n const unstableAls = _g[_UNSTABLE_CACHE_ALS_KEY] as { getStore(): unknown } | undefined;\n if (unstableAls?.getStore() === true) {\n const error = new Error(\n `\\`${apiName}\\` cannot be called inside a function cached with \\`unstable_cache()\\`. ` +\n `If you need this data inside a cached function, call \\`${apiName}\\` ` +\n \"outside and pass the required data as an argument.\",\n );\n _recordInvalidDynamicUsageError(error);\n throw error;\n }\n}\n\n// ---------------------------------------------------------------------------\n// NextRequest\n// ---------------------------------------------------------------------------\n\nexport class NextRequest extends Request {\n private _nextUrl: NextURL;\n private _url: string;\n private _cookies: RequestCookies;\n\n constructor(\n input: URL | RequestInfo,\n init?: RequestInit & {\n nextConfig?: {\n basePath?: string;\n i18n?: { locales: string[]; defaultLocale: string };\n trailingSlash?: boolean;\n };\n },\n ) {\n // Match Next.js: reject relative URLs with the canonical error before any\n // fallback URL parsing kicks in. Next.js calls `validateURL(url)` at the\n // top of its NextRequest constructor; we mirror that here so middleware\n // tests asserting on the error message text get the documented string.\n // Reuse the local `validateURL` helper so the message format stays in lockstep\n // with NextResponse, and so `javascript:` / `data:` URIs are blocked too.\n const rawUrl = typeof input !== \"string\" && \"url\" in input ? input.url : String(input);\n validateURL(rawUrl);\n // Strip nextConfig before passing to super() — it's vinext-internal,\n // not a valid RequestInit property.\n const { nextConfig: _nextConfig, ...requestInit } = init ?? {};\n if (input instanceof Request) {\n // Keep caller-owned request bodies readable after wrapping. Middleware and\n // route-handler plumbing may need the source Request after this wrapper runs.\n const requestInput =\n requestInit.body === undefined && input.body && !input.bodyUsed ? input.clone() : input;\n super(requestInput, requestInit);\n } else {\n super(input, requestInit);\n }\n const url =\n typeof input === \"string\"\n ? new URL(input, \"http://localhost\")\n : input instanceof URL\n ? input\n : new URL(input.url, \"http://localhost\");\n const urlConfig: NextURLConfig | undefined = _nextConfig\n ? {\n basePath: _nextConfig.basePath,\n nextConfig: { i18n: _nextConfig.i18n, trailingSlash: _nextConfig.trailingSlash },\n }\n : undefined;\n this._nextUrl = new NextURL(url, undefined, urlConfig);\n this._url = process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE\n ? url.toString()\n : this._nextUrl.toString();\n this._cookies = new RequestCookies(this.headers);\n }\n\n get nextUrl(): NextURL {\n return this._nextUrl;\n }\n\n get url(): string {\n return this._url;\n }\n\n get cookies(): RequestCookies {\n return this._cookies;\n }\n\n /**\n * Client IP address. Prefers Cloudflare's trusted CF-Connecting-IP header\n * over the spoofable X-Forwarded-For. Returns undefined if unavailable.\n */\n get ip(): string | undefined {\n return (\n this.headers.get(\"cf-connecting-ip\") ??\n this.headers.get(\"x-real-ip\") ??\n this.headers.get(\"x-forwarded-for\")?.split(\",\")[0]?.trim() ??\n undefined\n );\n }\n\n /**\n * Geolocation data. Platform-dependent (e.g., Cloudflare, Vercel).\n * Returns undefined if not available.\n */\n get geo():\n | { city?: string; country?: string; region?: string; latitude?: string; longitude?: string }\n | undefined {\n // Check Cloudflare-style headers, Vercel-style headers\n const country =\n this.headers.get(\"cf-ipcountry\") ?? this.headers.get(\"x-vercel-ip-country\") ?? undefined;\n if (!country) return undefined;\n return {\n country,\n city: this.headers.get(\"cf-ipcity\") ?? this.headers.get(\"x-vercel-ip-city\") ?? undefined,\n region:\n this.headers.get(\"cf-region\") ??\n this.headers.get(\"x-vercel-ip-country-region\") ??\n undefined,\n latitude:\n this.headers.get(\"cf-iplatitude\") ?? this.headers.get(\"x-vercel-ip-latitude\") ?? undefined,\n longitude:\n this.headers.get(\"cf-iplongitude\") ??\n this.headers.get(\"x-vercel-ip-longitude\") ??\n undefined,\n };\n }\n\n /**\n * The build ID of the Next.js application.\n * Delegates to `nextUrl.buildId` to match Next.js API surface.\n * Can be used in middleware to detect deployment skew between client and server.\n */\n get buildId(): string | undefined {\n return this._nextUrl.buildId;\n }\n}\n\n// ---------------------------------------------------------------------------\n// NextResponse\n// ---------------------------------------------------------------------------\n\n/** Valid HTTP redirect status codes, matching Next.js's REDIRECTS set. */\nconst REDIRECT_STATUSES = new Set([301, 302, 303, 307, 308]);\n\nfunction validateURL(url: string | URL | NextURL): string {\n assertSafeNavigationUrl(String(url));\n try {\n return String(new URL(String(url)));\n } catch (error) {\n throw new Error(\n `URL is malformed \"${String(\n url,\n )}\". Please use only absolute URLs - https://nextjs.org/docs/messages/middleware-relative-urls`,\n { cause: error },\n );\n }\n}\n\nexport class NextResponse<_Body = unknown> extends Response {\n private _cookies: ResponseCookies;\n\n constructor(body?: BodyInit | null, init?: ResponseInit) {\n super(body, init);\n this._cookies = new MiddlewareResponseCookies(this.headers);\n }\n\n get cookies(): ResponseCookies {\n return this._cookies;\n }\n\n /**\n * Create a JSON response.\n */\n static json<JsonBody>(body: JsonBody, init?: ResponseInit): NextResponse<JsonBody> {\n const headers = new Headers(init?.headers);\n if (!headers.has(\"content-type\")) {\n headers.set(\"content-type\", \"application/json\");\n }\n return new NextResponse(JSON.stringify(body), {\n ...init,\n headers,\n }) as NextResponse<JsonBody>;\n }\n\n /**\n * Create a redirect response.\n */\n static redirect(url: string | URL | NextURL, init?: number | ResponseInit): NextResponse {\n const status = typeof init === \"number\" ? init : (init?.status ?? 307);\n if (!REDIRECT_STATUSES.has(status)) {\n throw new RangeError(`Failed to execute \"redirect\" on \"response\": Invalid status code`);\n }\n const headers = new Headers(typeof init === \"object\" ? init?.headers : undefined);\n headers.set(\"Location\", validateURL(url));\n return new NextResponse(null, { status, headers });\n }\n\n /**\n * Create a rewrite response (middleware pattern).\n * Sets the x-middleware-rewrite header.\n */\n static rewrite(destination: string | URL | NextURL, init?: MiddlewareResponseInit): NextResponse {\n const headers = new Headers(init?.headers);\n headers.set(MIDDLEWARE_REWRITE_HEADER, validateURL(destination));\n if (init?.request?.headers) {\n encodeMiddlewareRequestHeaders(headers, init.request.headers);\n }\n return new NextResponse(null, { ...init, headers });\n }\n\n /**\n * Continue to the next handler (middleware pattern).\n * Sets the x-middleware-next header.\n */\n static next(init?: MiddlewareResponseInit): NextResponse {\n const headers = new Headers(init?.headers);\n headers.set(MIDDLEWARE_NEXT_HEADER, \"1\");\n if (init?.request?.headers) {\n encodeMiddlewareRequestHeaders(headers, init.request.headers);\n }\n return new NextResponse(null, { ...init, headers });\n }\n}\n\n// ---------------------------------------------------------------------------\n// NextURL — lightweight URL wrapper with pathname helpers\n// ---------------------------------------------------------------------------\n\nexport type NextURLConfig = {\n basePath?: string;\n nextConfig?: {\n i18n?: {\n locales: string[];\n defaultLocale: string;\n };\n /**\n * When true, `href`/`toString()` formats non-root, non-file-like pathnames\n * with a trailing slash. Matches Next.js's `formatNextPathnameInfo` so that\n * `NextResponse.redirect(request.nextUrl)` and `NextResponse.rewrite(url)`\n * honour the user's `trailingSlash` config.\n */\n trailingSlash?: boolean;\n };\n};\n\nexport class NextURL {\n /** Internal URL stores the pathname WITHOUT basePath or locale prefix. */\n private _url: URL;\n private _basePath: string;\n private _trailingSlash: boolean;\n private _locale: string | undefined;\n private _defaultLocale: string | undefined;\n private _locales: string[] | undefined;\n\n constructor(input: string | URL, base?: string | URL, config?: NextURLConfig) {\n this._url = new URL(input.toString(), base);\n this._basePath = config?.basePath ?? \"\";\n this._trailingSlash = config?.nextConfig?.trailingSlash ?? false;\n this._stripBasePath();\n const i18n = config?.nextConfig?.i18n;\n if (i18n) {\n this._locales = [...i18n.locales];\n this._defaultLocale = i18n.defaultLocale;\n this._analyzeLocale(this._locales);\n }\n }\n\n /** Strip basePath prefix from the internal pathname. */\n private _stripBasePath(): void {\n if (!this._basePath) return;\n this._url.pathname = stripBasePath(this._url.pathname, this._basePath);\n }\n\n /** Extract locale from pathname, stripping it from the internal URL. */\n private _analyzeLocale(locales: string[]): void {\n const segments = this._url.pathname.split(\"/\");\n const candidate = segments[1]?.toLowerCase();\n const match = locales.find((l) => l.toLowerCase() === candidate);\n if (match) {\n this._locale = match;\n this._url.pathname = \"/\" + segments.slice(2).join(\"/\");\n } else {\n this._locale = this._defaultLocale;\n }\n }\n\n /**\n * Reconstruct the full pathname with basePath + locale prefix and apply\n * the configured trailingSlash policy.\n * Mirrors Next.js's internal formatNextPathnameInfo().\n */\n private _formatPathname(): string {\n // Build prefix: basePath + locale (skip defaultLocale — Next.js omits it)\n let prefix = this._basePath;\n if (this._locale && this._locale !== this._defaultLocale) {\n prefix += \"/\" + this._locale;\n }\n const inner = this._url.pathname;\n const composed = !prefix ? inner : inner === \"/\" ? prefix : prefix + inner;\n return this._applyTrailingSlash(composed);\n }\n\n /**\n * Apply the configured trailingSlash policy to a composed pathname. Matches\n * Next.js's `formatNextPathnameInfo`: when `trailingSlash` is true, add a\n * trailing slash unless the path is empty/root; when false, strip a trailing\n * slash unless the path is empty/root.\n */\n private _applyTrailingSlash(pathname: string): string {\n // Never strip or add a slash to the root path.\n if (pathname === \"\" || pathname === \"/\") return pathname;\n if (this._trailingSlash) {\n return pathname.endsWith(\"/\") ? pathname : pathname + \"/\";\n }\n return pathname.endsWith(\"/\") ? pathname.slice(0, -1) : pathname;\n }\n\n get href(): string {\n const formatted = this._formatPathname();\n if (formatted === this._url.pathname) return this._url.href;\n // Replace pathname in href via string slicing — avoids URL allocation.\n // URL.href is always <origin+auth><pathname><search><hash>.\n const { href, pathname, search, hash } = this._url;\n const baseEnd = href.length - pathname.length - search.length - hash.length;\n return href.slice(0, baseEnd) + formatted + search + hash;\n }\n set href(value: string) {\n this._url.href = value;\n this._stripBasePath();\n if (this._locales) this._analyzeLocale(this._locales);\n }\n\n get origin(): string {\n return this._url.origin;\n }\n\n get protocol(): string {\n return this._url.protocol;\n }\n set protocol(value: string) {\n this._url.protocol = value;\n }\n\n get username(): string {\n return this._url.username;\n }\n set username(value: string) {\n this._url.username = value;\n }\n\n get password(): string {\n return this._url.password;\n }\n set password(value: string) {\n this._url.password = value;\n }\n\n get host(): string {\n return this._url.host;\n }\n set host(value: string) {\n this._url.host = value;\n }\n\n get hostname(): string {\n return this._url.hostname;\n }\n set hostname(value: string) {\n this._url.hostname = value;\n }\n\n get port(): string {\n return this._url.port;\n }\n set port(value: string) {\n this._url.port = value;\n }\n\n /** Returns the pathname WITHOUT basePath or locale prefix. */\n get pathname(): string {\n return this._url.pathname;\n }\n set pathname(value: string) {\n this._url.pathname = value;\n }\n\n get search(): string {\n return this._url.search;\n }\n set search(value: string) {\n this._url.search = value;\n }\n\n get searchParams(): URLSearchParams {\n return this._url.searchParams;\n }\n\n get hash(): string {\n return this._url.hash;\n }\n set hash(value: string) {\n this._url.hash = value;\n }\n\n get basePath(): string {\n return this._basePath;\n }\n set basePath(value: string) {\n this._basePath = value === \"\" ? \"\" : value.startsWith(\"/\") ? value : \"/\" + value;\n }\n\n get locale(): string {\n return this._locale ?? \"\";\n }\n set locale(value: string | undefined) {\n if (this._locales) {\n if (!value) {\n this._locale = this._defaultLocale;\n return;\n }\n if (!this._locales.includes(value)) {\n throw new TypeError(\n `The locale \"${value}\" is not in the configured locales: ${this._locales.join(\", \")}`,\n );\n }\n }\n this._locale = this._locales ? value : this._locale;\n }\n\n get defaultLocale(): string | undefined {\n return this._defaultLocale;\n }\n\n get locales(): string[] | undefined {\n return this._locales ? [...this._locales] : undefined;\n }\n\n clone(): NextURL {\n const nextConfig: NonNullable<NextURLConfig[\"nextConfig\"]> = {};\n if (this._locales) {\n nextConfig.i18n = { locales: [...this._locales], defaultLocale: this._defaultLocale! };\n }\n if (this._trailingSlash) {\n nextConfig.trailingSlash = true;\n }\n const config: NextURLConfig = {\n basePath: this._basePath,\n nextConfig: Object.keys(nextConfig).length > 0 ? nextConfig : undefined,\n };\n // Pass the full href (with locale/basePath re-added) so the constructor\n // can re-analyze and extract locale correctly.\n return new NextURL(this.href, undefined, config);\n }\n\n toString(): string {\n return this.href;\n }\n\n /**\n * The build ID of the Next.js application.\n * Set from `generateBuildId` in next.config.js, or a random UUID if not configured.\n * Can be used in middleware to detect deployment skew between client and server.\n * Matches the Next.js API: `request.nextUrl.buildId`.\n */\n get buildId(): string | undefined {\n return process.env.__VINEXT_BUILD_ID ?? undefined;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Cookie helpers (minimal implementations)\n// ---------------------------------------------------------------------------\n\ntype CookieEntry = {\n name: string;\n value: string;\n};\n\nexport class RequestCookies {\n private _headers: Headers;\n private _parsed: Map<string, string>;\n\n constructor(headers: Headers) {\n this._headers = headers;\n this._parsed = parseCookieHeader(headers.get(\"cookie\") ?? \"\");\n }\n\n get(name: string): CookieEntry | undefined {\n const value = this._parsed.get(name);\n return value !== undefined ? { name, value } : undefined;\n }\n\n getAll(nameOrOptions?: string | CookieEntry): CookieEntry[] {\n const name = typeof nameOrOptions === \"string\" ? nameOrOptions : nameOrOptions?.name;\n return [...this._parsed.entries()]\n .filter(([cookieName]) => name === undefined || cookieName === name)\n .map(([cookieName, value]) => ({ name: cookieName, value }));\n }\n\n has(name: string): boolean {\n return this._parsed.has(name);\n }\n\n set(nameOrOptions: string | CookieEntry, value?: string): this {\n let cookieName: string;\n let cookieValue: string;\n if (typeof nameOrOptions === \"string\") {\n cookieName = nameOrOptions;\n cookieValue = value ?? \"\";\n } else {\n cookieName = nameOrOptions.name;\n cookieValue = nameOrOptions.value;\n }\n validateCookieName(cookieName);\n this._parsed.set(cookieName, cookieValue);\n this._syncHeader();\n return this;\n }\n\n delete(names: string | string[]): boolean | boolean[] {\n if (Array.isArray(names)) {\n const results = names.map((name) => {\n validateCookieName(name);\n return this._parsed.delete(name);\n });\n this._syncHeader();\n return results;\n }\n validateCookieName(names);\n const result = this._parsed.delete(names);\n this._syncHeader();\n return result;\n }\n\n clear(): this {\n this._parsed.clear();\n this._syncHeader();\n return this;\n }\n\n get size(): number {\n return this._parsed.size;\n }\n\n toString(): string {\n return this._serialize();\n }\n\n private _serialize(): string {\n return [...this._parsed.entries()].map(([n, v]) => `${n}=${encodeURIComponent(v)}`).join(\"; \");\n }\n\n private _syncHeader(): void {\n if (this._parsed.size === 0) {\n this._headers.delete(\"cookie\");\n } else {\n this._headers.set(\"cookie\", this._serialize());\n }\n }\n\n [Symbol.iterator](): IterableIterator<[string, CookieEntry]> {\n const entries = this.getAll().map((c) => [c.name, c] as [string, CookieEntry]);\n return entries[Symbol.iterator]();\n }\n}\n\n// Keep this error message in sync with headers.ts. This adapter backs\n// NextRequest cookies, while headers.ts owns the next/headers cookies object.\nclass ReadonlyRequestCookiesError extends Error {\n constructor() {\n super(\n \"Cookies can only be modified in a Server Action or Route Handler. Read more: https://nextjs.org/docs/app/api-reference/functions/cookies#options\",\n );\n }\n\n static callable(this: void): never {\n throw new ReadonlyRequestCookiesError();\n }\n}\n\nconst REQUEST_HEADERS_MUTATING_METHODS = new Set([\"set\", \"delete\", \"append\"]);\n\n// Keep this error message in sync with headers.ts. This adapter backs\n// NextRequest headers in force-static route handlers, while headers.ts owns the\n// next/headers object.\nclass ReadonlyRequestHeadersError extends Error {\n constructor() {\n super(\n \"Headers cannot be modified. Read more: https://nextjs.org/docs/app/api-reference/functions/headers\",\n );\n }\n\n static callable(this: void): never {\n throw new ReadonlyRequestHeadersError();\n }\n}\n\nexport function sealRequestHeaders(headers: Headers): Headers {\n return new Proxy<Headers>(headers, {\n get(target, prop) {\n if (typeof prop === \"string\" && REQUEST_HEADERS_MUTATING_METHODS.has(prop)) {\n return ReadonlyRequestHeadersError.callable;\n }\n\n const value = Reflect.get(target, prop, target);\n return typeof value === \"function\" ? value.bind(target) : value;\n },\n });\n}\n\nexport function sealRequestCookies(cookies: RequestCookies): RequestCookies {\n return new Proxy<RequestCookies>(cookies, {\n get(target, prop) {\n if (prop === \"set\" || prop === \"delete\" || prop === \"clear\") {\n return ReadonlyRequestCookiesError.callable;\n }\n\n const value = Reflect.get(target, prop, target);\n return typeof value === \"function\" ? value.bind(target) : value;\n },\n });\n}\n\nexport class ResponseCookies {\n private _headers: Headers;\n /** Internal map keyed by cookie name — single source of truth. */\n private _parsed: Map<string, { serialized: string; entry: CookieEntry }> = new Map();\n\n constructor(headers: Headers) {\n this._headers = headers;\n\n // Hydrate internal map from any existing Set-Cookie headers\n for (const header of headers.getSetCookie()) {\n const eq = header.indexOf(\"=\");\n if (eq === -1) continue;\n const cookieName = header.slice(0, eq);\n const semi = header.indexOf(\";\", eq);\n const raw = header.slice(eq + 1, semi === -1 ? undefined : semi);\n let value: string;\n try {\n value = decodeURIComponent(raw);\n } catch {\n value = raw;\n }\n this._parsed.set(cookieName, { serialized: header, entry: { name: cookieName, value } });\n }\n }\n\n set(\n ...args:\n | [name: string, value: string, options?: CookieOptions]\n | [options: CookieOptions & { name: string; value: string }]\n ): this {\n const [name, value, opts] = parseCookieSetArgs(args);\n validateCookieName(name);\n\n const serialized = serializeSetCookie(name, value, opts);\n this._parsed.set(name, { serialized, entry: { name, value } });\n this._syncHeaders();\n return this;\n }\n\n get(...args: [name: string] | [options: { name: string }]): CookieEntry | undefined {\n const key = typeof args[0] === \"string\" ? args[0] : args[0].name;\n return this._parsed.get(key)?.entry;\n }\n\n has(name: string): boolean {\n return this._parsed.has(name);\n }\n\n getAll(...args: [name: string] | [options: { name: string }] | []): CookieEntry[] {\n const all = [...this._parsed.values()].map((v) => v.entry);\n if (args.length === 0) return all;\n const key = typeof args[0] === \"string\" ? args[0] : args[0].name;\n return all.filter((c) => c.name === key);\n }\n\n delete(\n ...args:\n | [name: string]\n | [options: Omit<CookieOptions & { name: string }, \"maxAge\" | \"expires\">]\n ): this {\n const [name, opts] =\n typeof args[0] === \"string\" ? [args[0], undefined] : [args[0].name, args[0]];\n return this.set({\n name,\n value: \"\",\n expires: new Date(0),\n path: opts?.path,\n domain: opts?.domain,\n httpOnly: opts?.httpOnly,\n secure: opts?.secure,\n sameSite: opts?.sameSite,\n });\n }\n\n [Symbol.iterator](): IterableIterator<[string, CookieEntry]> {\n const entries: [string, CookieEntry][] = [...this._parsed.values()].map((v) => [\n v.entry.name,\n v.entry,\n ]);\n return entries[Symbol.iterator]();\n }\n\n /** Delete all Set-Cookie headers and re-append from the internal map. */\n private _syncHeaders(): void {\n this._headers.delete(\"Set-Cookie\");\n for (const { serialized } of this._parsed.values()) {\n this._headers.append(\"Set-Cookie\", serialized);\n }\n }\n}\n\nclass MiddlewareResponseCookies extends ResponseCookies {\n private _responseHeaders: Headers;\n\n constructor(headers: Headers) {\n super(headers);\n this._responseHeaders = headers;\n }\n\n override set(\n ...args:\n | [name: string, value: string, options?: CookieOptions]\n | [options: CookieOptions & { name: string; value: string }]\n ): this {\n super.set(...args);\n this._syncMiddlewareCookieHeader();\n return this;\n }\n\n override delete(\n ...args:\n | [name: string]\n | [options: Omit<CookieOptions & { name: string }, \"maxAge\" | \"expires\">]\n ): this {\n super.delete(...args);\n this._syncMiddlewareCookieHeader();\n return this;\n }\n\n private _syncMiddlewareCookieHeader(): void {\n const cookies = this._responseHeaders.getSetCookie();\n if (cookies.length === 0) {\n this._responseHeaders.delete(MIDDLEWARE_SET_COOKIE_HEADER);\n return;\n }\n\n this._responseHeaders.set(MIDDLEWARE_SET_COOKIE_HEADER, cookies.join(\",\"));\n }\n}\n\ntype CookieOptions = {\n path?: string;\n domain?: string;\n maxAge?: number;\n expires?: Date;\n httpOnly?: boolean;\n secure?: boolean;\n sameSite?: \"Strict\" | \"Lax\" | \"None\";\n};\n\n/**\n * Parse the overloaded arguments for ResponseCookies.set():\n * - (name, value, options?) — positional form\n * - ({ name, value, ...options }) — object form\n */\nfunction parseCookieSetArgs(\n args:\n | [name: string, value: string, options?: CookieOptions]\n | [options: CookieOptions & { name: string; value: string }],\n): [string, string, CookieOptions | undefined] {\n if (typeof args[0] === \"string\") {\n return [args[0], args[1] as string, args[2] as CookieOptions | undefined];\n }\n const { name, value, ...opts } = args[0];\n return [name, value, opts as CookieOptions];\n}\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport type MiddlewareResponseInit = {\n request?: {\n headers?: Headers;\n };\n} & ResponseInit;\n\nexport type NextMiddlewareResult = NextResponse | Response | null | undefined | void;\n\nexport type NextMiddleware = (\n request: NextRequest,\n event: NextFetchEvent,\n) => NextMiddlewareResult | Promise<NextMiddlewareResult>;\n\n/**\n * Minimal NextFetchEvent — extends FetchEvent where available,\n * otherwise provides the waitUntil pattern standalone.\n */\nexport class NextFetchEvent {\n sourcePage: string;\n private _waitUntilPromises: Promise<unknown>[] = [];\n\n constructor(params: { page: string }) {\n this.sourcePage = params.page;\n }\n\n waitUntil(promise: Promise<unknown>): void {\n this._waitUntilPromises.push(promise);\n }\n\n get waitUntilPromises(): Promise<unknown>[] {\n return this._waitUntilPromises;\n }\n\n /** Drain all waitUntil promises. Returns a single promise that settles when all are done. */\n drainWaitUntil(): Promise<PromiseSettledResult<unknown>[]> {\n return Promise.allSettled(this._waitUntilPromises);\n }\n}\n\n// ---------------------------------------------------------------------------\n// Utility exports\n// ---------------------------------------------------------------------------\n\n/**\n * Parse user agent string. Minimal implementation — for full UA parsing,\n * apps should use a dedicated library like `ua-parser-js`.\n */\nexport function userAgentFromString(ua: string | undefined): UserAgent {\n const input = ua ?? \"\";\n return {\n isBot: /bot|crawler|spider|crawling/i.test(input),\n ua: input,\n browser: {},\n device: {},\n engine: {},\n os: {},\n cpu: {},\n };\n}\n\nexport function userAgent({ headers }: { headers: Headers }): UserAgent {\n return userAgentFromString(headers.get(\"user-agent\") ?? undefined);\n}\n\nexport type UserAgent = {\n isBot: boolean;\n ua: string;\n browser: { name?: string; version?: string; major?: string };\n device: { model?: string; type?: string; vendor?: string };\n engine: { name?: string; version?: string };\n os: { name?: string; version?: string };\n cpu: { architecture?: string };\n};\n\n/**\n * after() — schedule work after the response is sent.\n *\n * Uses the platform's `waitUntil` (via the per-request ExecutionContext) when\n * available so the task survives past the response on Cloudflare Workers.\n * Falls back to a fire-and-forget microtask on runtimes without an execution\n * context (e.g. Node.js dev server).\n *\n * Throws when called inside a cached scope — request-specific\n * side-effects must not leak into cached results.\n */\nexport function after<T>(task: Promise<T> | (() => T | Promise<T>)): void {\n _throwIfInsideCacheScope(\"after()\");\n\n const promise = typeof task === \"function\" ? Promise.resolve().then(task) : task;\n // NOTE: vinext runs function tasks concurrently with response streaming (next microtask),\n // whereas Next.js queues them to run strictly after the response is sent via onClose.\n // This is a known simplification — function tasks here are not guaranteed to run\n // after the response completes, only after the current synchronous execution.\n //\n // `.catch()` is attached synchronously in the same tick as `promise` is created, so\n // there is no window where a pre-rejected `task` promise could trigger an\n // `unhandledrejection` event before the handler is in place.\n const guarded = promise.catch((err) => {\n console.error(\"[vinext] after() task failed:\", err);\n });\n\n // TODO: Next.js throws when after() is called outside a request context or when\n // waitUntil is unavailable, preventing silent task loss. vinext falls back to\n // fire-and-forget here, which is correct for the Node.js dev server (where\n // getRequestExecutionContext() always returns null). On Workers, a misconfigured\n // entry that omits runWithExecutionContext would silently drop tasks — consider\n // a one-time console.warn on the fallback path, gated to production only (e.g.\n // `process.env.NODE_ENV === 'production'` or `typeof caches !== 'undefined'` for\n // a Workers runtime check) with a module-level `let _warned = false` guard so it\n // fires at most once and doesn't spam the dev-server console.\n getRequestExecutionContext()?.waitUntil(guarded);\n}\n\n/**\n * connection() — signals that the response requires a live connection\n * (not a static/cached response). Opts the page out of ISR caching\n * and sets Cache-Control: no-store on the response.\n */\nexport async function connection(): Promise<void> {\n const { markDynamicUsage, markRenderRequestApiUsage, throwIfInsideCacheScope } =\n await import(\"./headers.js\");\n markRenderRequestApiUsage(\"connection\");\n throwIfInsideCacheScope(\"connection()\");\n markDynamicUsage();\n}\n\n/**\n * URLPattern re-export — used in middleware for route matching.\n * Available natively in Node 20+, Cloudflare Workers, Deno.\n * Falls back to urlpattern-polyfill if the global is not available.\n */\nexport const URLPattern: typeof globalThis.URLPattern =\n globalThis.URLPattern ??\n (() => {\n throw new Error(\n \"URLPattern is not available in this runtime. \" +\n \"Install the `urlpattern-polyfill` package or upgrade to Node 20+.\",\n );\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsCA,MAAM,qBAAqB,OAAO,IAAI,iCAAiC;AACvE,MAAM,0BAA0B,OAAO,IAAI,2BAA2B;AACtE,MAAM,KAAK;;;;;AAMX,SAAS,gCAAgC,OAAoB;CAC3D,IAAI;EAIF,MAAM,MAHc,GAAG,OAAO,IAAI,mCAAmC,GAG5C,UAAU;EACnC,IAAI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SAAiC;EACzC,KAAK,mBAAmB,KAAK,QAAQ;;CAGvC,IAAI,oBAAwC;EAC1C,OAAO,KAAK;;;CAId,iBAA2D;EACzD,OAAO,QAAQ,WAAW,KAAK,mBAAmB;;;;;;;AAYtD,SAAgB,oBAAoB,IAAmC;CACrE,MAAM,QAAQ,MAAM;CACpB,OAAO;EACL,OAAO,+BAA+B,KAAK,MAAM;EACjD,IAAI;EACJ,SAAS,EAAE;EACX,QAAQ,EAAE;EACV,QAAQ,EAAE;EACV,IAAI,EAAE;EACN,KAAK,EAAE;EACR;;AAGH,SAAgB,UAAU,EAAE,WAA4C;CACtE,OAAO,oBAAoB,QAAQ,IAAI,aAAa,IAAI,KAAA,EAAU;;;;;;;;;;;;;AAwBpE,SAAgB,MAAS,MAAiD;CACxE,yBAAyB,UAAU;CAWnC,MAAM,WATU,OAAO,SAAS,aAAa,QAAQ,SAAS,CAAC,KAAK,KAAK,GAAG,MASpD,OAAO,QAAQ;EACrC,QAAQ,MAAM,iCAAiC,IAAI;GACnD;CAWF,4BAA4B,EAAE,UAAU,QAAQ;;;;;;;AAQlD,eAAsB,aAA4B;CAChD,MAAM,EAAE,kBAAkB,2BAA2B,4BACnD,MAAM,OAAO;CACf,0BAA0B,aAAa;CACvC,wBAAwB,eAAe;CACvC,kBAAkB;;;;;;;AAQpB,MAAa,aACX,WAAW,qBACJ;CACL,MAAM,IAAI,MACR,iHAED"}
|
package/dist/shims/slot.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slot.js","names":["React"],"sources":["../../src/shims/slot.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport {\n AppElementsWire,\n UNMATCHED_SLOT,\n type AppElementValue,\n type AppElements,\n type AppElementsInterception,\n type AppElementsSlotBinding,\n type LayoutFlags,\n} from \"../server/app-elements.js\";\nimport type { ArtifactCompatibilityEnvelope } from \"../server/artifact-compatibility.js\";\nimport type { CacheEntryReuseProof } from \"../server/cache-proof.js\";\nimport { notFound } from \"./navigation.js\";\n\nconst EMPTY_ELEMENTS: AppElements = Object.freeze({});\nconst warnedMissingEntryIds = new Set<string>();\nconst warnedTransportMetadataEntryIds = new Set<string>();\n\nexport { UNMATCHED_SLOT };\n\n/**\n * Holds resolved AppElements (not a Promise). React 19's use(Promise) during\n * hydration triggers \"async Client Component\" for native Promises that lack\n * React's internal .status property. Storing resolved values sidesteps this.\n */\nexport const ElementsContext = React.createContext<AppElements>(EMPTY_ELEMENTS);\n\nexport const ChildrenContext = React.createContext<React.ReactNode>(null);\n\nexport const ParallelSlotsContext = React.createContext<Readonly<\n Record<string, React.ReactNode>\n> | null>(null);\n\ntype MergeElementsOptions = {\n clearAbsentSlots?: boolean;\n preserveAbsentSlots?: boolean;\n preserveElementIds?: readonly string[];\n preservePreviousSlotIds?: readonly string[];\n};\n\nfunction isLayoutFlagsValue(value: unknown): value is LayoutFlags {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return false;\n const entries = Object.values(value);\n return entries.length > 0 && entries.every((entry) => entry === \"s\" || entry === \"d\");\n}\n\nfunction isArtifactCompatibilityEnvelopeValue(\n value: unknown,\n): value is ArtifactCompatibilityEnvelope {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return false;\n return (\n \"schemaVersion\" in value &&\n \"appElementsSchemaVersion\" in value &&\n \"rscPayloadSchemaVersion\" in value &&\n \"graphVersion\" in value &&\n \"deploymentVersion\" in value &&\n \"rootBoundaryId\" in value &&\n \"renderEpoch\" in value\n );\n}\n\nfunction isSlotBindingValue(value: unknown): value is AppElementsSlotBinding {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return false;\n return \"ownerLayoutId\" in value && \"slotId\" in value && \"state\" in value;\n}\n\nfunction isSlotBindingListValue(value: unknown): value is readonly AppElementsSlotBinding[] {\n // Empty [] is valid metadata when parsed from a missing __slotBindings key,\n // but it is not valid renderable slot content. Keep this guard non-empty so\n // accidental [] entries under render keys are not silently swallowed.\n return Array.isArray(value) && value.length > 0 && value.every(isSlotBindingValue);\n}\n\nfunction isInterceptionMetadataValue(value: unknown): value is AppElementsInterception {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return false;\n return (\n \"sourceMatchedUrl\" in value &&\n typeof value.sourceMatchedUrl === \"string\" &&\n \"sourceRouteId\" in value &&\n typeof value.sourceRouteId === \"string\" &&\n \"slotId\" in value &&\n typeof value.slotId === \"string\" &&\n \"targetMatchedUrl\" in value &&\n typeof value.targetMatchedUrl === \"string\" &&\n \"targetRouteId\" in value &&\n typeof value.targetRouteId === \"string\"\n );\n}\n\nfunction isCacheEntryReuseProofValue(value: unknown): value is CacheEntryReuseProof {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return false;\n return \"kind\" in value && value.kind === \"runtime-cache-entry\" && \"decision\" in value;\n}\n\nfunction isTransportMetadataValue(\n value: AppElementValue | undefined,\n): value is\n | LayoutFlags\n | ArtifactCompatibilityEnvelope\n | CacheEntryReuseProof\n | AppElementsInterception\n | readonly AppElementsSlotBinding[] {\n return (\n isLayoutFlagsValue(value) ||\n isArtifactCompatibilityEnvelopeValue(value) ||\n isCacheEntryReuseProofValue(value) ||\n isInterceptionMetadataValue(value) ||\n isSlotBindingListValue(value)\n );\n}\n\nfunction warnTransportMetadataEntry(id: string): void {\n if (process.env.NODE_ENV === \"production\") return;\n if (warnedTransportMetadataEntryIds.has(id)) return;\n\n warnedTransportMetadataEntryIds.add(id);\n console.warn(\"[vinext] Transport metadata value found under App Router render entry: \" + id);\n}\n\nexport function mergeElements(\n prev: AppElements,\n next: AppElements,\n options: MergeElementsOptions | boolean = {},\n): AppElements {\n const clearAbsentSlots =\n typeof options === \"boolean\" ? options : (options.clearAbsentSlots ?? false);\n const preserveAbsentSlots =\n typeof options === \"boolean\" ? !options : (options.preserveAbsentSlots ?? true);\n const preserveElementIds = typeof options === \"boolean\" ? [] : (options.preserveElementIds ?? []);\n const preservePreviousSlotIds =\n typeof options === \"boolean\" ? [] : (options.preservePreviousSlotIds ?? []);\n const merged: Record<string, AppElementValue> = { ...next };\n\n for (const id of preserveElementIds) {\n if (Object.hasOwn(merged, id)) continue;\n if (Object.hasOwn(prev, id)) {\n const value = prev[id];\n if (value !== undefined) merged[id] = value;\n }\n }\n\n const slotKeys = new Set(\n [...Object.keys(prev), ...Object.keys(next)].filter((key) => AppElementsWire.isSlotId(key)),\n );\n // On traversal (browser back/forward), the server renders the full destination\n // route tree. A slot absent from next means the destination route tree does not\n // include it, so clear it rather than keeping the stale prev value. The legacy\n // absent-slot path stays opt-in for unpromoted fallbacks; promoted navigation\n // commits preserve default/unmatched slots through planner-approved\n // preservePreviousSlotIds.\n if (clearAbsentSlots) {\n for (const key of slotKeys) {\n if (!Object.hasOwn(next, key)) {\n delete merged[key];\n }\n }\n } else if (preserveAbsentSlots) {\n for (const key of slotKeys) {\n if (!Object.hasOwn(merged, key) && Object.hasOwn(prev, key)) {\n const value = prev[key];\n if (value !== undefined) merged[key] = value;\n }\n }\n }\n\n // Default/unmatched slot preservation is a router-state decision, not a\n // consequence of a missing key or an unmatched marker on the transport. This\n // loop intentionally runs after clear/preserve element handling so planner-\n // approved slot content and binding proof win the final merged value.\n for (const id of preservePreviousSlotIds) {\n if (!AppElementsWire.isSlotId(id)) continue;\n if (!Object.hasOwn(prev, id)) continue;\n const value = prev[id];\n if (value !== undefined && value !== UNMATCHED_SLOT) {\n merged[id] = value;\n }\n }\n\n return merged;\n}\n\nexport function Slot({\n id,\n children,\n parallelSlots,\n}: {\n id: string;\n children?: React.ReactNode;\n parallelSlots?: Readonly<Record<string, React.ReactNode>>;\n}) {\n const elements = React.useContext(ElementsContext);\n\n if (!Object.hasOwn(elements, id)) {\n if (process.env.NODE_ENV !== \"production\" && !AppElementsWire.isSlotId(id)) {\n if (!warnedMissingEntryIds.has(id)) {\n warnedMissingEntryIds.add(id);\n console.warn(\"[vinext] Missing App Router element entry during render: \" + id);\n }\n }\n return null;\n }\n\n const element = elements[id];\n if (isTransportMetadataValue(element)) {\n warnTransportMetadataEntry(id);\n return null;\n }\n if (element === UNMATCHED_SLOT) {\n notFound();\n }\n\n return (\n <ParallelSlotsContext.Provider value={parallelSlots ?? null}>\n <ChildrenContext.Provider value={children ?? null}>{element}</ChildrenContext.Provider>\n </ParallelSlotsContext.Provider>\n );\n}\n\nexport function Children() {\n return React.useContext(ChildrenContext);\n}\n\nexport function ParallelSlot({ name }: { name: string }) {\n const slots = React.useContext(ParallelSlotsContext);\n return slots?.[name] ?? null;\n}\n"],"mappings":";;;;;;;AAgBA,MAAM,iBAA8B,OAAO,OAAO,EAAE,CAAC;AACrD,MAAM,wCAAwB,IAAI,KAAa;AAC/C,MAAM,kDAAkC,IAAI,KAAa;;;;;;AASzD,MAAa,kBAAkBA,QAAM,cAA2B,eAAe;AAE/E,MAAa,kBAAkBA,QAAM,cAA+B,KAAK;AAEzE,MAAa,uBAAuBA,QAAM,cAEhC,KAAK;AASf,SAAS,mBAAmB,OAAsC;CAChE,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,MAAM,EAAE,OAAO;CAChF,MAAM,UAAU,OAAO,OAAO,MAAM;CACpC,OAAO,QAAQ,SAAS,KAAK,QAAQ,OAAO,UAAU,UAAU,OAAO,UAAU,IAAI;;AAGvF,SAAS,qCACP,OACwC;CACxC,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,MAAM,EAAE,OAAO;CAChF,OACE,mBAAmB,SACnB,8BAA8B,SAC9B,6BAA6B,SAC7B,kBAAkB,SAClB,uBAAuB,SACvB,oBAAoB,SACpB,iBAAiB;;AAIrB,SAAS,mBAAmB,OAAiD;CAC3E,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,MAAM,EAAE,OAAO;CAChF,OAAO,mBAAmB,SAAS,YAAY,SAAS,WAAW;;AAGrE,SAAS,uBAAuB,OAA4D;CAI1F,OAAO,MAAM,QAAQ,MAAM,IAAI,MAAM,SAAS,KAAK,MAAM,MAAM,m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,oBAAC,gBAAgB,UAAjB;GAA0B,OAAO,YAAY;aAAO;GAAmC,CAAA;EACzD,CAAA;;AAIpC,SAAgB,WAAW;CACzB,OAAOA,QAAM,WAAW,gBAAgB;;AAG1C,SAAgB,aAAa,EAAE,QAA0B;CAEvD,OADcA,QAAM,WAAW,qBACnB,GAAG,SAAS"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"thenable-params.js","names":[],"sources":["../../src/shims/thenable-params.ts"],"sourcesContent":["function hasParamProperty<T extends Record<string, unknown>>(obj: T, prop: PropertyKey): boolean {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\n// Properties that cannot be shadowed by param names because they need to\n// remain the true underlying value for Promises / React to work correctly.\n//\n// Next.js comments out `value` and `error` in reflect-utils.ts because they\n// use `Promise.resolve(underlyingParams)` directly in production, so React\n// mutations on the promise object are never shadowed. vinext uses a Proxy\n// that intercepts sync reads through a separate `plain` object, which means\n// a param named `value` or `error` would shadow React's `.status`/`.value`\n// attachments that React adds to resolved promises for `use()` caching.\n// https://github.com/vercel/next.js/blob/canary/packages/next/src/shared/lib/utils/reflect-utils.ts\nconst WELL_KNOWN_PROPERTIES = [\n // Object prototype\n \"hasOwnProperty\",\n \"isPrototypeOf\",\n \"propertyIsEnumerable\",\n \"toString\",\n \"valueOf\",\n \"toLocaleString\",\n\n // Promise prototype\n \"then\",\n \"catch\",\n \"finally\",\n\n // React Promise extension (status is explicitly reserved by Next.js;\n // value/error are reserved here because our Proxy-based approach creates\n // a shadowing risk that native Promise does not have)\n \"status\",\n \"value\",\n \"error\",\n\n // React introspection\n \"displayName\",\n \"_debugInfo\",\n\n // Common tested properties\n \"toJSON\",\n \"$$typeof\",\n \"__esModule\",\n\n // Tested by flight when checking for iterables\n \"@@iterator\",\n] as const;\n\n// The type-level set of well-known properties is derived directly from the\n// runtime array above, so they can never drift out of sync. These properties\n// are omitted from the synchronous intersection because the Proxy returns\n// Promise/React internals for them, not the param value. After awaiting, the\n// resolved object contains the actual param values for all keys.\ntype WellKnownProperty = (typeof WELL_KNOWN_PROPERTIES)[number];\n\nconst wellKnownProperties = new Set<PropertyKey>(WELL_KNOWN_PROPERTIES);\n\nfunction isWellKnownProperty(prop: PropertyKey): boolean {\n return wellKnownProperties.has(prop);\n}\n\nexport type ThenableParams<T extends Record<string, unknown>> = Promise<T> &\n Omit<T, WellKnownProperty>;\n\nexport type ThenableParamsObserver = Readonly<{\n observeParamAccess: (keys: readonly string[]) => void;\n}>;\n\nfunction observeParamKeys(\n observer: ThenableParamsObserver | undefined,\n keys: readonly string[],\n): void {\n if (observer) {\n observer.observeParamAccess(keys);\n }\n}\n\nfunction observeAllParamKeys<T extends Record<string, unknown>>(\n observer: ThenableParamsObserver | undefined,\n plain: T,\n): void {\n observeParamKeys(observer, Object.keys(plain));\n}\n\nfunction observeReadableParamKeys<T extends Record<string, unknown>>(\n observer: ThenableParamsObserver | undefined,\n plain: T,\n): void {\n const keys = Object.keys(plain).filter((key) => !isWellKnownProperty(key));\n observeParamKeys(observer, keys);\n}\n\nfunction isPromiseContinuation(prop: PropertyKey): boolean {\n return prop === \"then\" || prop === \"catch\" || prop === \"finally\";\n}\n\nexport function makeThenableParams<T extends Record<string, unknown>>(\n obj: T,\n observer?: ThenableParamsObserver,\n): ThenableParams<T> {\n const plain = { ...obj };\n const promise = Promise.resolve(plain);\n\n // The Proxy implements both Promise and plain-object behaviour so that\n // `await params` and `params.id` both work. TypeScript's Proxy type\n // cannot express this intersection precisely — the cast is isolated to\n // the boundary so the handler above stays fully type-checked.\n return new Proxy(promise, {\n get(target, prop, receiver) {\n if (isPromiseContinuation(prop)) {\n const value = Reflect.get(target, prop, receiver);\n if (typeof value !== \"function\") return value;\n return (...args: unknown[]) => {\n observeAllParamKeys(observer, plain);\n return Reflect.apply(value, target, args);\n };\n }\n\n if (typeof prop === \"string\" && !isWellKnownProperty(prop)) {\n observeParamKeys(observer, [prop]);\n }\n\n if (!isWellKnownProperty(prop) && hasParamProperty(plain, prop)) {\n return Reflect.get(plain, prop);\n }\n\n const value = Reflect.get(target, prop, receiver);\n return typeof value === \"function\" ? value.bind(target) : value;\n },\n getOwnPropertyDescriptor(target, prop) {\n if (typeof prop === \"string\" && !isWellKnownProperty(prop)) {\n observeParamKeys(observer, [prop]);\n }\n\n if (!isWellKnownProperty(prop) && hasParamProperty(plain, prop)) {\n return {\n configurable: true,\n enumerable: true,\n value: Reflect.get(plain, prop),\n writable: true,\n };\n }\n\n return Reflect.getOwnPropertyDescriptor(target, prop);\n },\n has(target, prop) {\n if (typeof prop === \"string\" && !isWellKnownProperty(prop)) {\n observeParamKeys(observer, [prop]);\n }\n\n return (\n Reflect.has(target, prop) || (!isWellKnownProperty(prop) && hasParamProperty(plain, prop))\n );\n },\n ownKeys() {\n observeReadableParamKeys(observer, plain);\n return Reflect.ownKeys(plain).filter((prop) => !isWellKnownProperty(prop));\n },\n }) as unknown as ThenableParams<T>;\n}\n"],"mappings":";AAAA,SAAS,iBAAoD,KAAQ,MAA4B;CAC/F,OAAO,OAAO,UAAU,eAAe,KAAK,KAAK,KAAK;;AAsDxD,MAAM,sBAAsB,IAAI,IAAiB;CAvC/C;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CAKA;CACA;CACA;CAGA;CACA;CAGA;CACA;CACA;CAGA;CAUoE,CAAC;AAEvE,SAAS,oBAAoB,MAA4B;CACvD,OAAO,oBAAoB,IAAI,KAAK;;AAUtC,SAAS,iBACP,UACA,MACM;CACN,IAAI,UACF,SAAS,mBAAmB,KAAK;;AAIrC,SAAS,oBACP,UACA,OACM;CACN,iBAAiB,UAAU,OAAO,KAAK,MAAM,CAAC;;AAGhD,SAAS,yBACP,UACA,OACM;CAEN,iBAAiB,UADJ,OAAO,KAAK,MAAM,CAAC,QAAQ,QAAQ,CAAC,oBAAoB,IAAI,CAC1C,CAAC;;AAGlC,SAAS,sBAAsB,MAA4B;CACzD,OAAO,SAAS,UAAU,SAAS,WAAW,SAAS;;AAGzD,S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