vinext 1.2.1 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -9
- package/dist/_virtual/_rolldown/runtime.js +1 -1
- package/dist/build/action-owner-manifest.d.ts +3 -2
- package/dist/build/action-owner-manifest.js +18 -2
- package/dist/build/app-page-static-eligibility.d.ts +17 -1
- package/dist/build/app-page-static-eligibility.js +80 -13
- package/dist/build/clean-output.d.ts +2 -1
- package/dist/build/client-build-config.d.ts +77 -6
- package/dist/build/client-build-config.js +176 -12
- package/dist/build/client-reference-async.d.ts +48 -0
- package/dist/build/client-reference-async.js +123 -0
- package/dist/build/client-reference-chunks.d.ts +32 -0
- package/dist/build/client-reference-chunks.js +111 -0
- package/dist/build/client-reference-groups.d.ts +171 -0
- package/dist/build/client-reference-groups.js +572 -0
- package/dist/build/css-url-assets.d.ts +2 -1
- package/dist/build/google-fonts/fallback-metrics.d.ts +2 -1
- package/dist/build/google-fonts/find-font-files-in-css.d.ts +1 -0
- package/dist/build/google-fonts/find-font-files-in-css.js +17 -4
- package/dist/build/google-fonts/font-metadata.d.ts +2 -1
- package/dist/build/google-fonts/validate.d.ts +2 -1
- package/dist/build/inline-css.d.ts +2 -1
- package/dist/build/layout-classification.d.ts +2 -1
- package/dist/build/module-dependency-cache.d.ts +33 -1
- package/dist/build/module-dependency-cache.js +51 -1
- package/dist/build/next-client-runtime-manifests.d.ts +12 -2
- package/dist/build/next-client-runtime-manifests.js +19 -4
- package/dist/build/nitro-public-files.d.ts +24 -0
- package/dist/build/nitro-public-files.js +60 -0
- package/dist/build/pages-client-assets-module.js +1 -1
- package/dist/build/precompress.d.ts +2 -1
- package/dist/build/precompress.js +1 -1
- package/dist/build/prerender-paths.d.ts +2 -1
- package/dist/build/prerender-paths.js +5 -2
- package/dist/build/prerender-phase.d.ts +2 -1
- package/dist/build/prerender-server-pool.js +1 -1
- package/dist/build/prerender.d.ts +3 -2
- package/dist/build/prerender.js +5 -4
- package/dist/build/report.d.ts +2 -1
- package/dist/build/route-classification-injector.d.ts +2 -1
- package/dist/build/route-classification-manifest.d.ts +2 -1
- package/dist/build/run-prerender.d.ts +2 -1
- package/dist/build/server-actions-encryption-key.d.ts +24 -0
- package/dist/build/server-actions-encryption-key.js +101 -0
- package/dist/build/ssr-manifest.d.ts +3 -0
- package/dist/build/ssr-manifest.js +34 -2
- package/dist/build/standalone.d.ts +2 -1
- package/dist/cache/cache-adapters-virtual.d.ts +2 -1
- package/dist/cache.js +1 -2
- package/dist/check.d.ts +2 -1
- package/dist/check.js +4 -0
- package/dist/cli-args.d.ts +2 -1
- package/dist/cli.js +2 -0
- package/dist/client/client-redirect-matcher.js +2 -1
- package/dist/client/client-redirects.d.ts +4 -3
- package/dist/client/client-redirects.js +2 -1
- package/dist/client/client-rewrite-params.d.ts +9 -0
- package/dist/client/client-rewrite-params.js +20 -0
- package/dist/client/client-rewrites.d.ts +2 -1
- package/dist/client/dev-error-overlay-store.d.ts +2 -1
- package/dist/client/dev-error-overlay.js +2 -1
- package/dist/client/index.js +1 -2
- package/dist/client/instrumentation-client-state.js +5 -5
- package/dist/client/navigation-runtime.d.ts +28 -3
- package/dist/client/navigation-runtime.js +42 -11
- package/dist/client/pages-router-link-navigation.d.ts +2 -1
- package/dist/client/vinext-next-data.d.ts +25 -2
- package/dist/client/window-next.d.ts +2 -1
- package/dist/config/config-matchers.d.ts +27 -41
- package/dist/config/config-matchers.js +293 -270
- package/dist/config/config-source.d.ts +34 -0
- package/dist/config/config-source.js +141 -0
- package/dist/config/dotenv.d.ts +2 -1
- package/dist/config/header-params.d.ts +29 -0
- package/dist/config/header-params.js +106 -0
- package/dist/config/next-config.d.ts +20 -6
- package/dist/config/next-config.js +149 -11
- package/dist/config/tsconfig-paths.d.ts +2 -1
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/detector.js +23 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/index.js +2 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/lookup.js +25 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/bmp.js +11 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/cur.js +15 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/dds.js +11 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/gif.js +12 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/heif.js +55 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/icns.js +76 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/ico.js +39 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/index.js +46 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/j2c.js +11 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jp2.js +21 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jpg.js +71 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jxl-stream.js +42 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jxl.js +46 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/ktx.js +19 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/png.js +28 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/pnm.js +54 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/psd.js +11 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/svg.js +79 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/tga.js +15 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/tiff.js +96 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/utils.js +53 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/webp.js +45 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/utils/bit-reader.js +38 -0
- package/dist/deps/.pnpm/ua-parser-js@1.0.35/deps/ua-parser-js/src/ua-parser.js +2 -2
- package/dist/entries/app-browser-entry.d.ts +34 -6
- package/dist/entries/app-browser-entry.js +103 -40
- package/dist/entries/app-rsc-entry.d.ts +4 -1
- package/dist/entries/app-rsc-entry.js +131 -66
- package/dist/entries/app-rsc-manifest.d.ts +12 -1
- package/dist/entries/app-rsc-manifest.js +73 -1
- package/dist/entries/app-ssr-entry.d.ts +4 -1
- package/dist/entries/app-ssr-entry.js +9 -2
- package/dist/entries/pages-client-entry.d.ts +1 -0
- package/dist/entries/pages-client-entry.js +6 -6
- package/dist/entries/pages-entry-helpers.js +1 -2
- package/dist/entries/pages-server-entry.d.ts +2 -1
- package/dist/entries/pages-server-entry.js +18 -15
- package/dist/entries/runtime-entry-module.d.ts +1 -0
- package/dist/entries/runtime-entry-module.js +4 -1
- package/dist/image/image-adapters-virtual.d.ts +2 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.js +340 -116
- package/dist/init.js +17 -0
- package/dist/plugins/client-compile-hints.d.ts +30 -0
- package/dist/plugins/client-compile-hints.js +88 -0
- package/dist/plugins/client-reference-dedup.d.ts +2 -1
- package/dist/plugins/cloudflare-dev-module-urls.d.ts +2 -1
- package/dist/plugins/dynamic-preload-metadata.d.ts +3 -1
- package/dist/plugins/dynamic-preload-metadata.js +1 -1
- package/dist/plugins/environment.d.ts +2 -1
- package/dist/plugins/fonts.js +9 -12
- package/dist/plugins/ignore-dynamic-requests.d.ts +2 -1
- package/dist/plugins/import-meta-url.d.ts +2 -1
- package/dist/plugins/og-assets.d.ts +2 -1
- package/dist/plugins/og-assets.js +2 -3
- package/dist/plugins/optimize-imports.d.ts +27 -3
- package/dist/plugins/optimize-imports.js +106 -20
- package/dist/plugins/pages-node-externals.d.ts +2 -1
- package/dist/plugins/remove-console.d.ts +2 -1
- package/dist/plugins/require-condition-resolution.d.ts +2 -1
- package/dist/plugins/rsc-client-reference-loaders.d.ts +53 -1
- package/dist/plugins/rsc-client-reference-loaders.js +447 -27
- package/dist/plugins/rsc-client-shim-excludes.js +2 -0
- package/dist/plugins/sass.d.ts +2 -1
- package/dist/plugins/strip-server-exports.d.ts +2 -1
- package/dist/plugins/styled-jsx.d.ts +2 -1
- package/dist/plugins/transform-result.d.ts +2 -1
- package/dist/plugins/typeof-window.d.ts +2 -1
- package/dist/plugins/use-cache-callable.d.ts +5 -0
- package/dist/plugins/use-cache-callable.js +30 -8
- package/dist/plugins/worker-image-imports.d.ts +1 -0
- package/dist/plugins/worker-image-imports.js +2 -2
- package/dist/plugins/worker-use-server.d.ts +2 -1
- package/dist/routing/app-route-graph.d.ts +41 -1
- package/dist/routing/app-route-graph.js +122 -50
- package/dist/routing/browser-route-manifest.d.ts +44 -0
- package/dist/routing/browser-route-manifest.js +195 -0
- package/dist/routing/hashed-route-patterns.d.ts +4 -0
- package/dist/routing/hashed-route-patterns.js +22 -0
- package/dist/routing/optimistic-route-trie.d.ts +28 -0
- package/dist/routing/optimistic-route-trie.js +102 -0
- package/dist/routing/route-matching.d.ts +2 -1
- package/dist/routing/route-pattern.d.ts +2 -1
- package/dist/routing/route-validation.d.ts +6 -1
- package/dist/routing/route-validation.js +26 -10
- package/dist/server/accept-encoding.d.ts +2 -1
- package/dist/server/app-action-forwarding.d.ts +10 -1
- package/dist/server/app-action-forwarding.js +15 -1
- package/dist/server/app-bfcache-identity.d.ts +2 -1
- package/dist/server/app-browser-action-result.d.ts +2 -1
- package/dist/server/app-browser-client-reuse-manifest.d.ts +2 -1
- package/dist/server/app-browser-entry.js +175 -64
- package/dist/server/app-browser-error.d.ts +5 -2
- package/dist/server/app-browser-error.js +7 -2
- package/dist/server/app-browser-history-controller.d.ts +2 -1
- package/dist/server/app-browser-hydration.d.ts +2 -1
- package/dist/server/app-browser-interception-context.d.ts +4 -3
- package/dist/server/app-browser-mpa-navigation.d.ts +1 -0
- package/dist/server/app-browser-mpa-navigation.js +6 -5
- package/dist/server/app-browser-navigation-controller.d.ts +17 -6
- package/dist/server/app-browser-navigation-controller.js +103 -36
- package/dist/server/app-browser-popstate.d.ts +2 -1
- package/dist/server/app-browser-rsc-redirect.d.ts +2 -1
- package/dist/server/app-browser-server-action-client.d.ts +2 -1
- package/dist/server/app-browser-state.d.ts +2 -2
- package/dist/server/app-browser-state.js +1 -1
- package/dist/server/app-browser-stream.d.ts +2 -1
- package/dist/server/app-browser-visible-commit.d.ts +6 -5
- package/dist/server/app-client-reference-manifest.d.ts +31 -0
- package/dist/server/app-client-reference-manifest.js +46 -0
- package/dist/server/app-client-reference-preloader.d.ts +45 -2
- package/dist/server/app-client-reference-preloader.js +48 -10
- package/dist/server/app-elements-wire.d.ts +2 -1
- package/dist/server/app-elements.d.ts +2 -0
- package/dist/server/app-elements.js +3 -1
- package/dist/server/app-fallback-renderer.d.ts +9 -2
- package/dist/server/app-fallback-renderer.js +6 -2
- package/dist/server/app-history-state.d.ts +2 -1
- package/dist/server/app-inline-css-client.d.ts +2 -1
- package/dist/server/app-layout-param-observation.d.ts +2 -1
- package/dist/server/app-metadata-tracing.d.ts +2 -1
- package/dist/server/app-middleware.d.ts +6 -0
- package/dist/server/app-middleware.js +8 -10
- package/dist/server/app-optimistic-routing.d.ts +26 -11
- package/dist/server/app-optimistic-routing.js +38 -96
- package/dist/server/app-page-boundary-render.d.ts +20 -2
- package/dist/server/app-page-boundary-render.js +229 -39
- package/dist/server/app-page-boundary.d.ts +34 -5
- package/dist/server/app-page-boundary.js +40 -7
- package/dist/server/app-page-cache-finalizer.d.ts +2 -1
- package/dist/server/app-page-cache-finalizer.js +1 -1
- package/dist/server/app-page-cache-render.d.ts +10 -2
- package/dist/server/app-page-cache-render.js +15 -2
- package/dist/server/app-page-cache.js +2 -2
- package/dist/server/app-page-dispatch.d.ts +34 -1
- package/dist/server/app-page-dispatch.js +165 -34
- package/dist/server/app-page-element-builder.d.ts +17 -1
- package/dist/server/app-page-element-builder.js +187 -66
- package/dist/server/app-page-execution.d.ts +28 -1
- package/dist/server/app-page-execution.js +114 -5
- package/dist/server/app-page-head.d.ts +95 -3
- package/dist/server/app-page-head.js +307 -152
- package/dist/server/app-page-http-access-fallback-metadata.d.ts +48 -2
- package/dist/server/app-page-http-access-fallback-metadata.js +76 -1
- package/dist/server/app-page-method.d.ts +2 -1
- package/dist/server/app-page-probe.d.ts +2 -1
- package/dist/server/app-page-render-identity.d.ts +2 -1
- package/dist/server/app-page-render.d.ts +7 -1
- package/dist/server/app-page-render.js +38 -11
- package/dist/server/app-page-request.d.ts +14 -1
- package/dist/server/app-page-request.js +1 -1
- package/dist/server/app-page-route-wiring.d.ts +52 -2
- package/dist/server/app-page-route-wiring.js +197 -47
- package/dist/server/app-page-rsc-render-status.d.ts +3 -1
- package/dist/server/app-page-rsc-render-status.js +1 -0
- package/dist/server/app-page-search-params-observation.d.ts +8 -6
- package/dist/server/app-page-search-params-observation.js +16 -11
- package/dist/server/app-page-segment-plan.d.ts +2 -1
- package/dist/server/app-page-stream.d.ts +38 -1
- package/dist/server/app-page-stream.js +24 -4
- package/dist/server/app-pages-bridge.d.ts +4 -2
- package/dist/server/app-pages-bridge.js +11 -7
- package/dist/server/app-ppr-fallback-shell-render.d.ts +2 -1
- package/dist/server/app-ppr-fallback-shell.d.ts +2 -1
- package/dist/server/app-prerender-endpoints.d.ts +2 -1
- package/dist/server/app-prerender-static-params.d.ts +2 -1
- package/dist/server/app-prerender-static-params.js +3 -2
- package/dist/server/app-render-dependency.d.ts +11 -1
- package/dist/server/app-render-dependency.js +65 -6
- package/dist/server/app-request-stage-independent-entry.d.ts +2 -1
- package/dist/server/app-request-stage-independent-entry.js +2 -2
- package/dist/server/app-response-stage-entry.d.ts +2 -1
- package/dist/server/app-response-stage-entry.js +3 -3
- package/dist/server/app-route-handler-cache.d.ts +2 -1
- package/dist/server/app-route-handler-dispatch.d.ts +2 -1
- package/dist/server/app-route-handler-dispatch.js +4 -2
- package/dist/server/app-route-handler-execution.d.ts +4 -1
- package/dist/server/app-route-handler-execution.js +9 -2
- package/dist/server/app-route-handler-middleware-context.d.ts +2 -1
- package/dist/server/app-route-handler-middleware-context.js +3 -3
- package/dist/server/app-route-handler-response.d.ts +4 -2
- package/dist/server/app-route-handler-response.js +2 -2
- package/dist/server/app-route-handler-runtime.d.ts +4 -1
- package/dist/server/app-route-handler-runtime.js +20 -3
- package/dist/server/app-route-module-loader.d.ts +18 -1
- package/dist/server/app-route-module-loader.js +15 -6
- package/dist/server/app-route-tree-prefetch.d.ts +2 -1
- package/dist/server/app-route-tree.d.ts +20 -0
- package/dist/server/app-route-tree.js +18 -0
- package/dist/server/app-router-entry.js +2 -2
- package/dist/server/app-rsc-combined-handler.js +8 -1
- package/dist/server/app-rsc-error-handler.d.ts +2 -1
- package/dist/server/app-rsc-errors.d.ts +9 -1
- package/dist/server/app-rsc-errors.js +9 -2
- package/dist/server/app-rsc-handler.d.ts +6 -2
- package/dist/server/app-rsc-handler.js +152 -140
- package/dist/server/app-rsc-response-finalizer.d.ts +7 -1
- package/dist/server/app-rsc-response-finalizer.js +4 -1
- package/dist/server/app-rsc-response-stage.js +3 -1
- package/dist/server/app-rsc-route-matching.d.ts +39 -1
- package/dist/server/app-rsc-route-matching.js +25 -1
- package/dist/server/app-segment-config.d.ts +2 -1
- package/dist/server/app-segment-config.js +1 -14
- package/dist/server/app-server-action-execution.d.ts +25 -7
- package/dist/server/app-server-action-execution.js +53 -59
- package/dist/server/app-ssr-entry.d.ts +12 -0
- package/dist/server/app-ssr-entry.js +104 -48
- package/dist/server/app-ssr-error-meta.d.ts +2 -1
- package/dist/server/app-ssr-search-params-gate.d.ts +2 -1
- package/dist/server/app-ssr-stream.d.ts +29 -10
- package/dist/server/app-ssr-stream.js +311 -67
- package/dist/server/app-static-generation.d.ts +2 -1
- package/dist/server/app-streamed-client-references.d.ts +39 -0
- package/dist/server/app-streamed-client-references.js +156 -0
- package/dist/server/app-visited-response-cache.d.ts +2 -1
- package/dist/server/app-worker-stages.d.ts +2 -1
- package/dist/server/artifact-compatibility.d.ts +2 -1
- package/dist/server/bfcache-identity.d.ts +2 -1
- package/dist/server/cache-headers.d.ts +2 -1
- package/dist/server/cacheability-request.d.ts +2 -1
- package/dist/server/client-reuse-manifest.d.ts +2 -1
- package/dist/server/config-headers.d.ts +2 -1
- package/dist/server/config-headers.js +12 -3
- package/dist/server/csp.d.ts +2 -1
- package/dist/server/default-global-not-found-module.d.ts +2 -1
- package/dist/server/default-http-access-fallback-modules.d.ts +33 -0
- package/dist/server/default-http-access-fallback-modules.js +31 -0
- package/dist/server/defer-until-stream-consumed.d.ts +34 -0
- package/dist/server/defer-until-stream-consumed.js +154 -21
- package/dist/server/dev-lockfile.d.ts +32 -2
- package/dist/server/dev-lockfile.js +46 -2
- package/dist/server/dev-module-runner.d.ts +2 -1
- package/dist/server/dev-server.js +10 -3
- package/dist/server/fetch-handler.js +1 -2
- package/dist/server/file-based-metadata.d.ts +2 -1
- package/dist/server/framework-tracer.d.ts +2 -1
- package/dist/server/html.d.ts +1 -0
- package/dist/server/html.js +19 -1
- package/dist/server/http-conditional.d.ts +2 -1
- package/dist/server/http-error-responses.d.ts +2 -1
- package/dist/server/implicit-tags.d.ts +2 -1
- package/dist/server/isolate-shared-promise.d.ts +10 -0
- package/dist/server/isolate-shared-promise.js +33 -0
- package/dist/server/isr-cache.js +3 -2
- package/dist/server/metadata-route-build-data.d.ts +2 -1
- package/dist/server/metadata-route-build-data.js +1 -1
- package/dist/server/metadata-route-response.d.ts +2 -1
- package/dist/server/metadata-route-response.js +1 -1
- package/dist/server/metadata-routes.d.ts +2 -1
- package/dist/server/middleware-matcher-pattern.d.ts +0 -1
- package/dist/server/middleware-matcher-pattern.js +11 -140
- package/dist/server/middleware-matcher.js +5 -6
- package/dist/server/middleware-response-headers.d.ts +31 -0
- package/dist/server/middleware-response-headers.js +57 -1
- package/dist/server/middleware-runtime.d.ts +2 -1
- package/dist/server/middleware-runtime.js +26 -13
- package/dist/server/navigation-planner.d.ts +2 -2
- package/dist/server/navigation-trace.d.ts +2 -1
- package/dist/server/next-error-digest.d.ts +2 -1
- package/dist/server/nitro-public-files-plugin.d.ts +39 -0
- package/dist/server/nitro-public-files-plugin.js +106 -0
- package/dist/server/nitro-public-files.d.ts +22 -0
- package/dist/server/nitro-public-files.js +39 -0
- package/dist/server/opentelemetry-api.d.ts +2 -1
- package/dist/server/operation-token.d.ts +2 -1
- package/dist/server/pages-api-route.d.ts +2 -1
- package/dist/server/pages-asset-tags.d.ts +7 -1
- package/dist/server/pages-asset-tags.js +9 -2
- package/dist/server/pages-body-parser-config.d.ts +2 -1
- package/dist/server/pages-client-assets.d.ts +8 -1
- package/dist/server/pages-data-route.d.ts +2 -1
- package/dist/server/pages-document-asset-props.d.ts +2 -1
- package/dist/server/pages-document-initial-props.d.ts +2 -1
- package/dist/server/pages-execution-tracing.d.ts +2 -1
- package/dist/server/pages-execution-tracing.js +1 -1
- package/dist/server/pages-get-initial-props.d.ts +2 -1
- package/dist/server/pages-i18n.d.ts +18 -0
- package/dist/server/pages-i18n.js +18 -2
- package/dist/server/pages-node-compat.d.ts +5 -3
- package/dist/server/pages-node-compat.js +35 -16
- package/dist/server/pages-page-data.d.ts +7 -1
- package/dist/server/pages-page-data.js +35 -12
- package/dist/server/pages-page-handler.d.ts +3 -2
- package/dist/server/pages-page-handler.js +16 -7
- package/dist/server/pages-page-method.d.ts +2 -1
- package/dist/server/pages-page-response.d.ts +2 -1
- package/dist/server/pages-preview.d.ts +2 -1
- package/dist/server/pages-readiness.d.ts +2 -1
- package/dist/server/pages-request-pipeline.d.ts +8 -2
- package/dist/server/pages-request-pipeline.js +35 -40
- package/dist/server/pages-request-stage-entry.d.ts +2 -1
- package/dist/server/pages-request-stage-entry.js +16 -6
- package/dist/server/pages-response-stage-entry.d.ts +2 -1
- package/dist/server/pages-response-stage-entry.js +1 -1
- package/dist/server/pages-revalidate.js +1 -0
- package/dist/server/pages-route-data-kind.d.ts +2 -1
- package/dist/server/pages-router-entry.js +1 -1
- package/dist/server/prerender-cache-life-header.d.ts +2 -1
- package/dist/server/prerender-route-params.d.ts +2 -1
- package/dist/server/prod-server.d.ts +2 -2
- package/dist/server/prod-server.js +80 -36
- package/dist/server/proxy-trust.d.ts +6 -0
- package/dist/server/proxy-trust.js +12 -6
- package/dist/server/request-log.d.ts +2 -1
- package/dist/server/request-pipeline.d.ts +5 -0
- package/dist/server/request-pipeline.js +12 -1
- package/dist/server/request-tracing.d.ts +2 -1
- package/dist/server/request-tracing.js +1 -1
- package/dist/server/response-start-tracing.js +7 -29
- package/dist/server/rsc-render-stream.d.ts +4 -0
- package/dist/server/rsc-render-stream.js +25 -0
- package/dist/server/seed-cache.d.ts +2 -1
- package/dist/server/seed-cache.js +1 -1
- package/dist/server/server-reference-loader.js +10 -1
- package/dist/server/static-file-cache.d.ts +2 -1
- package/dist/server/static-file-cache.js +16 -3
- package/dist/server/static-layout-client-reuse-proof.d.ts +2 -1
- package/dist/server/worker-revalidation-context.d.ts +2 -1
- package/dist/server/worker-stages.d.ts +2 -1
- package/dist/server/worker-utils.js +1 -1
- package/dist/shims/app.d.ts +2 -1
- package/dist/shims/cache-callable-runtime.d.ts +2 -1
- package/dist/shims/cache-handler.d.ts +8 -3
- package/dist/shims/cache-handler.js +32 -11
- package/dist/shims/cache-request-state.d.ts +40 -3
- package/dist/shims/cache-request-state.js +70 -5
- package/dist/shims/cache-runtime.js +47 -19
- package/dist/shims/cache.d.ts +2 -2
- package/dist/shims/cache.js +17 -8
- package/dist/shims/caught-not-found-boundaries.d.ts +15 -0
- package/dist/shims/caught-not-found-boundaries.js +48 -0
- package/dist/shims/cdn-purge-routes.d.ts +25 -0
- package/dist/shims/cdn-purge-routes.js +77 -0
- package/dist/shims/client-locale.js +2 -1
- package/dist/shims/client-page-root.d.ts +2 -1
- package/dist/shims/config.d.ts +2 -1
- package/dist/shims/default-forbidden.d.ts +4 -0
- package/dist/shims/default-forbidden.js +18 -0
- package/dist/shims/default-not-found.d.ts +0 -5
- package/dist/shims/default-not-found.js +5 -41
- package/dist/shims/default-unauthorized.d.ts +4 -0
- package/dist/shims/default-unauthorized.js +18 -0
- package/dist/shims/dynamic.js +17 -4
- package/dist/shims/error-boundary.d.ts +39 -3
- package/dist/shims/error-boundary.js +31 -16
- package/dist/shims/font-google.js +1 -2
- package/dist/shims/font-utils.d.ts +3 -2
- package/dist/shims/font-utils.js +5 -3
- package/dist/shims/form.js +9 -4
- package/dist/shims/http-access-error-fallback.d.ts +7 -0
- package/dist/shims/http-access-error-fallback.js +47 -0
- package/dist/shims/image-props.d.ts +93 -0
- package/dist/shims/image-props.js +323 -0
- package/dist/shims/image.d.ts +4 -39
- package/dist/shims/image.js +4 -319
- package/dist/shims/internal/app-prefetch-fetch-queue.d.ts +22 -2
- package/dist/shims/internal/app-prefetch-fetch-queue.js +71 -18
- package/dist/shims/internal/app-route-prefetch-policy.d.ts +14 -3
- package/dist/shims/internal/app-route-prefetch-policy.js +29 -4
- package/dist/shims/internal/cache-context-accessor.d.ts +2 -1
- package/dist/shims/internal/client-reference-loader.d.ts +7 -0
- package/dist/shims/internal/client-reference-loader.js +91 -0
- package/dist/shims/internal/cookie-serialize.d.ts +2 -1
- package/dist/shims/internal/cookies.js +1 -2
- package/dist/shims/internal/headers-state.d.ts +9 -0
- package/dist/shims/internal/headers-state.js +19 -2
- package/dist/shims/internal/hybrid-client-route-owner-direct.d.ts +6 -2
- package/dist/shims/internal/hybrid-client-route-owner-direct.js +31 -14
- package/dist/shims/internal/hybrid-client-route-owner.js +8 -8
- package/dist/shims/internal/interpolate-as.d.ts +2 -1
- package/dist/shims/internal/pages-data-target.d.ts +2 -1
- package/dist/shims/internal/pages-data-url.d.ts +2 -1
- package/dist/shims/internal/thenable-well-known-properties.d.ts +2 -1
- package/dist/shims/link.js +198 -53
- package/dist/shims/metadata.d.ts +32 -11
- package/dist/shims/metadata.js +88 -26
- package/dist/shims/navigation-errors.d.ts +2 -1
- package/dist/shims/navigation.d.ts +23 -3
- package/dist/shims/navigation.js +91 -25
- package/dist/shims/og.js +35 -10
- package/dist/shims/pages-router-runtime.d.ts +2 -1
- package/dist/shims/ppr-fallback-shell.d.ts +2 -1
- package/dist/shims/request-context.d.ts +13 -0
- package/dist/shims/router.js +33 -43
- package/dist/shims/server.d.ts +31 -4
- package/dist/shims/server.js +58 -10
- package/dist/shims/thenable-params.d.ts +6 -1
- package/dist/shims/thenable-params.js +11 -2
- package/dist/shims/unified-request-context.d.ts +5 -0
- package/dist/shims/unified-request-context.js +5 -3
- package/dist/typegen.d.ts +2 -1
- package/dist/utils/asset-prefix.d.ts +7 -0
- package/dist/utils/asset-prefix.js +10 -1
- package/dist/utils/client-build-manifest.d.ts +4 -1
- package/dist/utils/client-build-manifest.js +20 -6
- package/dist/utils/client-entry-manifest.d.ts +13 -0
- package/dist/utils/client-entry-manifest.js +20 -1
- package/dist/utils/client-reference-chunks.d.ts +45 -0
- package/dist/utils/client-reference-chunks.js +30 -0
- package/dist/utils/client-runtime-metadata.d.ts +10 -1
- package/dist/utils/client-runtime-metadata.js +53 -9
- package/dist/utils/compare.d.ts +9 -0
- package/dist/utils/compare.js +15 -1
- package/dist/utils/lazy-chunks.d.ts +18 -0
- package/dist/utils/lazy-chunks.js +27 -1
- package/dist/utils/manifest-paths.d.ts +14 -0
- package/dist/utils/manifest-paths.js +22 -1
- package/dist/utils/middleware-request-headers.d.ts +2 -1
- package/dist/utils/path-to-regexp.d.ts +21 -0
- package/dist/{server/middleware-path-to-regexp.js → utils/path-to-regexp.js} +14 -11
- package/dist/utils/plugin-react-version.d.ts +15 -0
- package/dist/utils/plugin-react-version.js +64 -0
- package/dist/utils/project.d.ts +2 -1
- package/dist/utils/project.js +9 -1
- package/dist/utils/public-routes.d.ts +2 -0
- package/dist/utils/public-routes.js +18 -7
- package/dist/utils/query.d.ts +2 -1
- package/dist/utils/sorted-array.d.ts +2 -1
- package/dist/utils/vite-cli-invocation.d.ts +2 -1
- package/package.json +5 -5
- package/dist/deps/.pnpm/image-size@2.0.2/deps/image-size/dist/index.js +0 -808
- package/dist/server/default-not-found-module.d.ts +0 -19
- package/dist/server/default-not-found-module.js +0 -18
- package/dist/server/middleware-path-to-regexp.d.ts +0 -13
- package/dist/server/rsc-stream-hints.d.ts +0 -21
- package/dist/server/rsc-stream-hints.js +0 -227
- package/dist/utils/regex-safety.d.ts +0 -17
- package/dist/utils/regex-safety.js +0 -789
package/dist/shims/router.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isUnknownRecord } from "../utils/record.js";
|
|
2
|
+
import { execConfigSource } from "../config/config-source.js";
|
|
2
3
|
import { parseCookieHeader } from "../utils/parse-cookie.js";
|
|
3
4
|
import { isExternalUrl } from "../utils/external-url.js";
|
|
4
5
|
import { hasBasePath, removeTrailingSlash, stripBasePath } from "../utils/base-path.js";
|
|
@@ -28,6 +29,7 @@ import { formatUrlObject, formatUrlObjectWithValidation } from "./internal/forma
|
|
|
28
29
|
import { normalizeRouterHref, resolvePagesRouterHref } from "./internal/normalize-router-href.js";
|
|
29
30
|
import { getCurrentRoutePathnameForWarning } from "./internal/route-pattern-for-warning.js";
|
|
30
31
|
import { getCurrentBrowserLocale } from "./client-locale.js";
|
|
32
|
+
import { clientRewriteAppendsParams } from "../client/client-rewrite-params.js";
|
|
31
33
|
import { Component, Fragment, StrictMode, createElement, useContext, useEffect, useLayoutEffect, useMemo, useState } from "react";
|
|
32
34
|
//#region src/shims/router.ts
|
|
33
35
|
/**
|
|
@@ -975,7 +977,8 @@ function hasClientRedirectRules() {
|
|
|
975
977
|
}
|
|
976
978
|
function hasClientAppRouteManifest() {
|
|
977
979
|
const routes = window.__VINEXT_LINK_PREFETCH_ROUTES__;
|
|
978
|
-
|
|
980
|
+
const routeHandlers = window.__VINEXT_APP_ROUTE_HANDLERS__;
|
|
981
|
+
return Array.isArray(routes) && routes.length > 0 || Array.isArray(routeHandlers) && routeHandlers.length > 0;
|
|
979
982
|
}
|
|
980
983
|
function getClientConfigRouteContext(href) {
|
|
981
984
|
let parsed;
|
|
@@ -1003,15 +1006,26 @@ function getClientConfigRouteContext(href) {
|
|
|
1003
1006
|
search: parsed.search
|
|
1004
1007
|
};
|
|
1005
1008
|
}
|
|
1009
|
+
/**
|
|
1010
|
+
* matchRedirect has already applied basePath to a config destination, so a
|
|
1011
|
+
* local one that resolves outside it (`/../outside`, or a `basePath: false`
|
|
1012
|
+
* rule) is another app's URL. resolveLocalRedirectUrl would treat it as an app
|
|
1013
|
+
* path and re-add basePath, so it is followed as a document navigation instead,
|
|
1014
|
+
* landing where the server's redirect does.
|
|
1015
|
+
*/
|
|
1016
|
+
function configRedirectLeavesBasePath(location) {
|
|
1017
|
+
if (!__basePath || !location.startsWith("/") || location.startsWith("//")) return false;
|
|
1018
|
+
return !hasBasePath(new URL(location, "http://vinext.local").pathname, __basePath);
|
|
1019
|
+
}
|
|
1006
1020
|
async function resolveClientConfigRedirect(href) {
|
|
1007
1021
|
const redirects = window.__VINEXT_CLIENT_REDIRECTS__;
|
|
1008
1022
|
if (!redirects || redirects.length === 0) return null;
|
|
1009
1023
|
const routeContext = getClientConfigRouteContext(href);
|
|
1010
1024
|
if (!routeContext) return null;
|
|
1011
|
-
const [{ matchClientRedirect }, { preserveRedirectDestinationQuery }] = await Promise.all([import("../client/client-redirect-matcher.js"), import("../config/config-matchers.js")]);
|
|
1025
|
+
const [{ matchClientRedirect }, { encodeRedirectLocation, preserveRedirectDestinationQuery }] = await Promise.all([import("../client/client-redirect-matcher.js"), import("../config/config-matchers.js")]);
|
|
1012
1026
|
const redirect = matchClientRedirect(routeContext.pathname, redirects, routeContext.context, routeContext.basePathState);
|
|
1013
1027
|
if (!redirect) return null;
|
|
1014
|
-
return preserveRedirectDestinationQuery(
|
|
1028
|
+
return encodeRedirectLocation(preserveRedirectDestinationQuery(redirect.destination, routeContext.search, redirect.destinationQuery));
|
|
1015
1029
|
}
|
|
1016
1030
|
async function applyClientConfigRewrite(href, rewrite) {
|
|
1017
1031
|
const routeContext = getClientConfigRouteContext(href);
|
|
@@ -1029,40 +1043,14 @@ function shouldEvaluateClientConfigRule(ruleBasePath, state) {
|
|
|
1029
1043
|
if (!state.basePath) return true;
|
|
1030
1044
|
return ruleBasePath === false ? !state.hadBasePath : state.hadBasePath;
|
|
1031
1045
|
}
|
|
1032
|
-
function
|
|
1033
|
-
if (
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
const sourcePart = sourceParts[sourceIndex];
|
|
1040
|
-
const pathPart = pathParts[pathIndex];
|
|
1041
|
-
if (sourcePart.startsWith(":")) {
|
|
1042
|
-
const catchAll = sourcePart.match(/^:([\w-]+)([*+])$/);
|
|
1043
|
-
if (catchAll) {
|
|
1044
|
-
const rest = pathParts.slice(pathIndex).join("/");
|
|
1045
|
-
if (catchAll[2] === "+" && rest === "") return null;
|
|
1046
|
-
params[catchAll[1]] = rest;
|
|
1047
|
-
return sourceIndex === sourceParts.length - 1 ? params : void 0;
|
|
1048
|
-
}
|
|
1049
|
-
if (pathPart === void 0) return null;
|
|
1050
|
-
params[sourcePart.slice(1)] = pathPart;
|
|
1051
|
-
pathIndex++;
|
|
1052
|
-
continue;
|
|
1053
|
-
}
|
|
1054
|
-
if (pathPart !== sourcePart) return null;
|
|
1055
|
-
pathIndex++;
|
|
1046
|
+
function isSerializedRewriteDestination(destination) {
|
|
1047
|
+
if (!destination.startsWith("/") || destination.startsWith("//")) return true;
|
|
1048
|
+
try {
|
|
1049
|
+
const parsed = new URL(destination, "http://n");
|
|
1050
|
+
return parsed.pathname + parsed.search + parsed.hash === destination;
|
|
1051
|
+
} catch {
|
|
1052
|
+
return false;
|
|
1056
1053
|
}
|
|
1057
|
-
return pathIndex === pathParts.length ? params : null;
|
|
1058
|
-
}
|
|
1059
|
-
function simpleClientConfigSourceCouldMatch(pathname, source) {
|
|
1060
|
-
const wildcardIndex = source.search(/[:(\\*+?]/);
|
|
1061
|
-
const literalPrefix = wildcardIndex === -1 ? source : source.slice(0, wildcardIndex);
|
|
1062
|
-
const normalizedPrefix = removeTrailingSlash(literalPrefix);
|
|
1063
|
-
if (!normalizedPrefix || normalizedPrefix === "/") return true;
|
|
1064
|
-
const normalizedPathname = removeTrailingSlash(pathname);
|
|
1065
|
-
return normalizedPathname === normalizedPrefix || normalizedPathname.startsWith(`${normalizedPrefix}/`);
|
|
1066
1054
|
}
|
|
1067
1055
|
function isExternalClientConfigUrl(url) {
|
|
1068
1056
|
return /^[a-z][a-z0-9+.-]*:/i.test(url) || url.startsWith("//");
|
|
@@ -1074,8 +1062,7 @@ function clientConfigRedirectCouldMatch(href) {
|
|
|
1074
1062
|
if (!routeContext) return false;
|
|
1075
1063
|
for (const redirect of redirects) {
|
|
1076
1064
|
if (!shouldEvaluateClientConfigRule(redirect.basePath, routeContext.basePathState)) continue;
|
|
1077
|
-
if (
|
|
1078
|
-
if (matchSimpleClientConfigPattern(routeContext.pathname, redirect.source) !== null) return true;
|
|
1065
|
+
if (execConfigSource(routeContext.pathname, redirect.source) !== null) return true;
|
|
1079
1066
|
}
|
|
1080
1067
|
return false;
|
|
1081
1068
|
}
|
|
@@ -1088,12 +1075,15 @@ function resolveClientConfigRewriteSync(href) {
|
|
|
1088
1075
|
const routeContext = getClientConfigRouteContext(currentHref);
|
|
1089
1076
|
if (!routeContext) return null;
|
|
1090
1077
|
if (!shouldEvaluateClientConfigRule(rewrite.basePath, routeContext.basePathState)) continue;
|
|
1091
|
-
|
|
1078
|
+
const match = execConfigSource(routeContext.pathname, rewrite.source);
|
|
1079
|
+
if (match === null) continue;
|
|
1092
1080
|
if (rewrite.has || rewrite.requiresServerEvaluation) return void 0;
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
if (
|
|
1081
|
+
if (match.unmatched.length > 0) return void 0;
|
|
1082
|
+
const { params } = match;
|
|
1083
|
+
if (!isSerializedRewriteDestination(rewrite.destination)) return void 0;
|
|
1084
|
+
if (clientRewriteAppendsParams(rewrite.destination, params)) return void 0;
|
|
1096
1085
|
const rewritten = substituteDestinationParams(rewrite.destination, params, "rewrite");
|
|
1086
|
+
if (!/^(?:https?:\/\/|\/(?![\\/\t\n\r]))/.test(rewritten)) return void 0;
|
|
1097
1087
|
if (isExternalClientConfigUrl(rewritten)) return { kind: "document" };
|
|
1098
1088
|
currentHref = mergeRewriteQuery(currentHref, rewritten);
|
|
1099
1089
|
matched = true;
|
|
@@ -1590,7 +1580,7 @@ async function navigateClient(url, fetchUrl = url, options = {}, routeUrl = url)
|
|
|
1590
1580
|
const routeMasked = options.routeMasked ?? routeUrl !== url;
|
|
1591
1581
|
const configRedirect = hasClientRedirectRules() && clientConfigRedirectCouldMatch(browserUrl) ? await resolveClientConfigRedirect(browserUrl) : null;
|
|
1592
1582
|
if (configRedirect) {
|
|
1593
|
-
const redirectedUrl = resolveLocalRedirectUrl(configRedirect);
|
|
1583
|
+
const redirectedUrl = configRedirectLeavesBasePath(configRedirect) ? null : resolveLocalRedirectUrl(configRedirect);
|
|
1594
1584
|
if (!redirectedUrl) scheduleHardNavigationAndThrow(configRedirect, "Navigation redirected externally");
|
|
1595
1585
|
throw new InternalNavigationRedirect(redirectedUrl);
|
|
1596
1586
|
}
|
package/dist/shims/server.d.ts
CHANGED
|
@@ -28,6 +28,11 @@ export type RequestInit = globalThis.RequestInit & {
|
|
|
28
28
|
trailingSlash?: boolean;
|
|
29
29
|
skipTrailingSlashRedirect?: boolean;
|
|
30
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* vinext-internal: the host the request was made to, when the URL carries
|
|
33
|
+
* the server's own origin instead. It picks the i18n domain locale.
|
|
34
|
+
*/
|
|
35
|
+
requestHost?: string;
|
|
31
36
|
signal?: AbortSignal;
|
|
32
37
|
duplex?: "half";
|
|
33
38
|
};
|
|
@@ -100,6 +105,11 @@ export declare class NextResponse<_Body = unknown> extends Response {
|
|
|
100
105
|
}
|
|
101
106
|
export type NextURLConfig = {
|
|
102
107
|
basePath?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Request headers. As in Next.js's `getHostname`, a Host header decides the
|
|
110
|
+
* domain locale before the URL's own hostname.
|
|
111
|
+
*/
|
|
112
|
+
headers?: Record<string, string | string[] | undefined>;
|
|
103
113
|
nextConfig?: {
|
|
104
114
|
i18n?: {
|
|
105
115
|
locales: string[];
|
|
@@ -146,6 +156,12 @@ export declare class NextURL {
|
|
|
146
156
|
private _locales;
|
|
147
157
|
private _domains;
|
|
148
158
|
private _domainLocale;
|
|
159
|
+
private _headers;
|
|
160
|
+
private _buildId;
|
|
161
|
+
/** First page segment of a raw data pathname, where its locale sits. */
|
|
162
|
+
private _dataPathSegment;
|
|
163
|
+
/** The locale parsed from that segment, if it is one. */
|
|
164
|
+
private _dataPathLocale;
|
|
149
165
|
constructor(input: string | URL, base?: string | URL, config?: NextURLConfig);
|
|
150
166
|
/**
|
|
151
167
|
* With `skipTrailingSlashRedirect`, take the slash from the parsed pathname
|
|
@@ -164,9 +180,20 @@ export declare class NextURL {
|
|
|
164
180
|
* middleware-base-path's "should execute from absolute paths" case.
|
|
165
181
|
*/
|
|
166
182
|
private _stripBasePath;
|
|
183
|
+
/**
|
|
184
|
+
* Take the build ID from a raw `/_next/data/<buildId>/….json` pathname, as
|
|
185
|
+
* getNextPathnameInfo does. Middleware only sees one when proxy URL
|
|
186
|
+
* normalization is skipped; the pathname is left as is.
|
|
187
|
+
*/
|
|
188
|
+
private _parseBuildId;
|
|
167
189
|
/** Extract locale from pathname, stripping it from the internal URL. */
|
|
168
190
|
private _detectPathnameLocale;
|
|
169
191
|
private _analyzeI18n;
|
|
192
|
+
/**
|
|
193
|
+
* A raw data pathname keeps its locale segment, replaced by the current
|
|
194
|
+
* locale once it has been changed.
|
|
195
|
+
*/
|
|
196
|
+
private _formatDataPathLocale;
|
|
170
197
|
/**
|
|
171
198
|
* Reconstruct the full pathname with basePath + locale prefix and apply
|
|
172
199
|
* the configured trailingSlash policy.
|
|
@@ -214,10 +241,10 @@ export declare class NextURL {
|
|
|
214
241
|
toString(): string;
|
|
215
242
|
toJSON(): string;
|
|
216
243
|
/**
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
244
|
+
* Matches the Next.js API: `request.nextUrl.buildId`. Next.js derives it
|
|
245
|
+
* from the URL (only `/_next/data/<buildId>/…` paths carry one) and never
|
|
246
|
+
* from the deployment, so a Client Component reads the same value on the
|
|
247
|
+
* server and in the browser.
|
|
221
248
|
*/
|
|
222
249
|
get buildId(): string | undefined;
|
|
223
250
|
}
|
package/dist/shims/server.js
CHANGED
|
@@ -117,7 +117,7 @@ var NextRequest = class extends Request {
|
|
|
117
117
|
_cookies;
|
|
118
118
|
constructor(input, init) {
|
|
119
119
|
validateURL(typeof input !== "string" && "url" in input ? input.url : String(input));
|
|
120
|
-
const { nextConfig: _nextConfig, ...plainInit } = init ?? {};
|
|
120
|
+
const { nextConfig: _nextConfig, requestHost, ...plainInit } = init ?? {};
|
|
121
121
|
const requestInit = init instanceof Request ? requestInitFromRequest(init) : plainInit;
|
|
122
122
|
if (input instanceof Request) {
|
|
123
123
|
super(input, initWithoutInputBody(input, requestInit));
|
|
@@ -143,6 +143,7 @@ var NextRequest = class extends Request {
|
|
|
143
143
|
} : void 0;
|
|
144
144
|
const urlConfig = _nextConfig ? {
|
|
145
145
|
basePath: _nextConfig.basePath,
|
|
146
|
+
headers: requestHost === void 0 ? void 0 : { host: requestHost },
|
|
146
147
|
nextConfig: {
|
|
147
148
|
i18n,
|
|
148
149
|
trailingSlash: _nextConfig.trailingSlash,
|
|
@@ -293,6 +294,9 @@ var NextResponse = class NextResponse extends Response {
|
|
|
293
294
|
});
|
|
294
295
|
}
|
|
295
296
|
};
|
|
297
|
+
function isRawDataPathname(pathname) {
|
|
298
|
+
return pathname.startsWith("/_next/data/") && pathname.endsWith(".json");
|
|
299
|
+
}
|
|
296
300
|
var NextURL = class NextURL {
|
|
297
301
|
/** Internal URL stores the pathname WITHOUT basePath or locale prefix. */
|
|
298
302
|
_url;
|
|
@@ -312,8 +316,15 @@ var NextURL = class NextURL {
|
|
|
312
316
|
_locales;
|
|
313
317
|
_domains;
|
|
314
318
|
_domainLocale;
|
|
319
|
+
_headers;
|
|
320
|
+
_buildId;
|
|
321
|
+
/** First page segment of a raw data pathname, where its locale sits. */
|
|
322
|
+
_dataPathSegment;
|
|
323
|
+
/** The locale parsed from that segment, if it is one. */
|
|
324
|
+
_dataPathLocale;
|
|
315
325
|
constructor(input, base, config) {
|
|
316
326
|
this._url = new URL(input.toString(), base);
|
|
327
|
+
this._headers = config?.headers;
|
|
317
328
|
this._configBasePath = config?.basePath ?? "";
|
|
318
329
|
this._basePath = this._configBasePath;
|
|
319
330
|
this._configTrailingSlash = config?.nextConfig?.trailingSlash ?? false;
|
|
@@ -321,6 +332,7 @@ var NextURL = class NextURL {
|
|
|
321
332
|
this._trailingSlash = this._configTrailingSlash;
|
|
322
333
|
this._analyzeTrailingSlash();
|
|
323
334
|
this._stripBasePath();
|
|
335
|
+
this._parseBuildId();
|
|
324
336
|
const i18n = config?.nextConfig?.i18n;
|
|
325
337
|
if (i18n) {
|
|
326
338
|
this._locales = [...i18n.locales];
|
|
@@ -361,6 +373,22 @@ var NextURL = class NextURL {
|
|
|
361
373
|
this._basePath = this._configBasePath;
|
|
362
374
|
this._url.pathname = stripBasePath(this._url.pathname, this._configBasePath);
|
|
363
375
|
}
|
|
376
|
+
/**
|
|
377
|
+
* Take the build ID from a raw `/_next/data/<buildId>/….json` pathname, as
|
|
378
|
+
* getNextPathnameInfo does. Middleware only sees one when proxy URL
|
|
379
|
+
* normalization is skipped; the pathname is left as is.
|
|
380
|
+
*/
|
|
381
|
+
_parseBuildId() {
|
|
382
|
+
const { pathname } = this._url;
|
|
383
|
+
if (!isRawDataPathname(pathname)) {
|
|
384
|
+
this._buildId = void 0;
|
|
385
|
+
this._dataPathSegment = void 0;
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
const [buildId, pageSegment] = pathname.slice(12, -5).split("/");
|
|
389
|
+
this._buildId = buildId;
|
|
390
|
+
this._dataPathSegment = pageSegment === "index" ? void 0 : pageSegment;
|
|
391
|
+
}
|
|
364
392
|
/** Extract locale from pathname, stripping it from the internal URL. */
|
|
365
393
|
_detectPathnameLocale(locales) {
|
|
366
394
|
const segments = this._url.pathname.split("/");
|
|
@@ -372,11 +400,29 @@ var NextURL = class NextURL {
|
|
|
372
400
|
_analyzeI18n() {
|
|
373
401
|
if (!this._locales || !this._configDefaultLocale) return;
|
|
374
402
|
const detectedLocale = this._detectPathnameLocale(this._locales);
|
|
403
|
+
this._dataPathLocale = void 0;
|
|
404
|
+
if (!detectedLocale && this._buildId && this._dataPathSegment) {
|
|
405
|
+
const candidate = this._dataPathSegment.toLowerCase();
|
|
406
|
+
this._dataPathLocale = this._locales.find((l) => l.toLowerCase() === candidate);
|
|
407
|
+
}
|
|
375
408
|
const detectedLocaleLower = detectedLocale?.toLowerCase();
|
|
376
|
-
const
|
|
409
|
+
const hostHeader = this._headers?.host;
|
|
410
|
+
const hostname = (typeof hostHeader === "string" && hostHeader ? hostHeader.split(":", 1)[0] : this._url.hostname).toLowerCase();
|
|
377
411
|
this._domainLocale = this._domains?.find((domain) => domain.domain.split(":", 1)[0].toLowerCase() === hostname || detectedLocaleLower === domain.defaultLocale.toLowerCase() || domain.locales?.some((locale) => locale.toLowerCase() === detectedLocaleLower));
|
|
378
412
|
this._defaultLocale = this._domainLocale?.defaultLocale ?? this._configDefaultLocale;
|
|
379
|
-
this._locale = detectedLocale ?? this._defaultLocale;
|
|
413
|
+
this._locale = detectedLocale ?? this._dataPathLocale ?? this._defaultLocale;
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* A raw data pathname keeps its locale segment, replaced by the current
|
|
417
|
+
* locale once it has been changed.
|
|
418
|
+
*/
|
|
419
|
+
_formatDataPathLocale(pathname) {
|
|
420
|
+
if (!this._dataPathLocale || this._locale === this._dataPathLocale) return pathname;
|
|
421
|
+
if (!this._locale || !isRawDataPathname(pathname)) return pathname;
|
|
422
|
+
const segments = pathname.slice(12, -5).split("/");
|
|
423
|
+
if (segments[1]?.toLowerCase() !== this._dataPathLocale.toLowerCase()) return pathname;
|
|
424
|
+
segments[1] = this._locale;
|
|
425
|
+
return "/_next/data/" + segments.join("/") + ".json";
|
|
380
426
|
}
|
|
381
427
|
/**
|
|
382
428
|
* Reconstruct the full pathname with basePath + locale prefix and apply
|
|
@@ -385,9 +431,9 @@ var NextURL = class NextURL {
|
|
|
385
431
|
*/
|
|
386
432
|
_formatPathname() {
|
|
387
433
|
let prefix = this._basePath;
|
|
388
|
-
const inner = this._url.pathname;
|
|
434
|
+
const inner = this._formatDataPathLocale(this._url.pathname);
|
|
389
435
|
const innerLower = inner.toLowerCase();
|
|
390
|
-
if (!(innerLower === "/api" || innerLower.startsWith("/api/")) && this._locale && this._locale !== this._defaultLocale) prefix += "/" + this._locale;
|
|
436
|
+
if (!(innerLower === "/api" || innerLower.startsWith("/api/")) && !isRawDataPathname(inner) && this._locale && this._locale !== this._defaultLocale) prefix += "/" + this._locale;
|
|
391
437
|
const composed = !prefix ? inner : inner === "/" ? prefix : prefix + inner;
|
|
392
438
|
return this._applyTrailingSlash(composed);
|
|
393
439
|
}
|
|
@@ -415,6 +461,7 @@ var NextURL = class NextURL {
|
|
|
415
461
|
this._url.href = value;
|
|
416
462
|
this._analyzeTrailingSlash();
|
|
417
463
|
this._stripBasePath();
|
|
464
|
+
this._parseBuildId();
|
|
418
465
|
this._analyzeI18n();
|
|
419
466
|
}
|
|
420
467
|
get origin() {
|
|
@@ -526,6 +573,7 @@ var NextURL = class NextURL {
|
|
|
526
573
|
} else if (this._trailingSlash) nextConfig.trailingSlash = true;
|
|
527
574
|
const config = {
|
|
528
575
|
basePath: this._configBasePath,
|
|
576
|
+
headers: this._headers,
|
|
529
577
|
nextConfig: Object.keys(nextConfig).length > 0 ? nextConfig : void 0
|
|
530
578
|
};
|
|
531
579
|
return new NextURL(this.href, void 0, config);
|
|
@@ -537,13 +585,13 @@ var NextURL = class NextURL {
|
|
|
537
585
|
return this.href;
|
|
538
586
|
}
|
|
539
587
|
/**
|
|
540
|
-
*
|
|
541
|
-
*
|
|
542
|
-
*
|
|
543
|
-
*
|
|
588
|
+
* Matches the Next.js API: `request.nextUrl.buildId`. Next.js derives it
|
|
589
|
+
* from the URL (only `/_next/data/<buildId>/…` paths carry one) and never
|
|
590
|
+
* from the deployment, so a Client Component reads the same value on the
|
|
591
|
+
* server and in the browser.
|
|
544
592
|
*/
|
|
545
593
|
get buildId() {
|
|
546
|
-
return
|
|
594
|
+
return this._buildId;
|
|
547
595
|
}
|
|
548
596
|
};
|
|
549
597
|
var RequestCookies = class {
|
|
@@ -3,7 +3,12 @@ import { WellKnownProperty } from "./internal/thenable-well-known-properties.js"
|
|
|
3
3
|
export type ThenableParams<T extends Record<string, unknown>> = Promise<T> & Omit<T, WellKnownProperty>;
|
|
4
4
|
export type ThenableParamsObserver = Readonly<{
|
|
5
5
|
observeParamAccess: (keys: readonly string[]) => void;
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Runs when `then` is read, and when `catch` or `finally` is called (they
|
|
8
|
+
* read `then` on a native promise). Throwing here fails the read itself
|
|
9
|
+
* before React counts any pending work, as Next.js does.
|
|
10
|
+
*/
|
|
11
|
+
observeThenRead?: () => void;
|
|
7
12
|
}>;
|
|
8
13
|
/** Serialize backing values without reading a framework fallback-key proxy. */
|
|
9
14
|
export declare function getFallbackParamsSnapshot(value: unknown): Promise<Record<string, unknown>> | undefined;
|
|
@@ -117,14 +117,20 @@ function createThenableParams(obj, observer, fallbackShellState) {
|
|
|
117
117
|
const params = createThenableParamsProxy(promise, {
|
|
118
118
|
get(target, prop, receiver) {
|
|
119
119
|
if (isPromiseContinuation(prop)) {
|
|
120
|
+
if (prop === "then") observer?.observeThenRead?.();
|
|
120
121
|
const value = Reflect.get(target, prop, receiver);
|
|
121
122
|
if (typeof value !== "function") return value;
|
|
122
123
|
return (...args) => {
|
|
123
|
-
if (
|
|
124
|
+
if (prop !== "then") observer?.observeThenRead?.();
|
|
125
|
+
if (!fallbackParamNames) try {
|
|
126
|
+
observeAllParamKeys(observer, plain);
|
|
127
|
+
} catch (error) {
|
|
128
|
+
return Reflect.apply(value, Promise.reject(error), args);
|
|
129
|
+
}
|
|
124
130
|
return Reflect.apply(value, target, args);
|
|
125
131
|
};
|
|
126
132
|
}
|
|
127
|
-
if (prop === "
|
|
133
|
+
if (prop === "reason" && Object.hasOwn(target, prop)) return Reflect.get(target, prop);
|
|
128
134
|
if (typeof prop === "string" && !isWellKnownProperty(prop)) observeParamKeys(observer, [prop]);
|
|
129
135
|
if (!isWellKnownProperty(prop) && hasParamProperty(plain, prop)) {
|
|
130
136
|
if (isFallbackParam(prop)) {
|
|
@@ -164,6 +170,9 @@ function createThenableParams(obj, observer, fallbackShellState) {
|
|
|
164
170
|
ownKeys() {
|
|
165
171
|
observeReadableParamKeys(observer, plain);
|
|
166
172
|
return Reflect.ownKeys(plain).filter((prop) => !isWellKnownProperty(prop));
|
|
173
|
+
},
|
|
174
|
+
set(target, prop, value) {
|
|
175
|
+
return Reflect.set(target, prop, value);
|
|
167
176
|
}
|
|
168
177
|
});
|
|
169
178
|
paramsState.set(params, {
|
|
@@ -21,6 +21,11 @@ import "./request-state-types.js";
|
|
|
21
21
|
export type UnifiedRequestContext = {
|
|
22
22
|
/** Cloudflare Workers ExecutionContext, or null on Node.js dev. */
|
|
23
23
|
executionContext: ExecutionContextLike | null;
|
|
24
|
+
/**
|
|
25
|
+
* The host's client-connection signal for the incoming request, before any
|
|
26
|
+
* clone follows it. Null for requests vinext creates itself (regeneration).
|
|
27
|
+
*/
|
|
28
|
+
requestSignal: AbortSignal | null;
|
|
24
29
|
/** Per-request cache for cacheForRequest(). Keyed by factory function reference. */
|
|
25
30
|
requestCache: WeakMap<(...args: any[]) => any, unknown>;
|
|
26
31
|
/** Shared lifecycle state for work deferred until the response closes. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getOrCreateAls } from "./internal/als-registry.js";
|
|
2
2
|
import { isFullyBufferedBody, markFullyBufferedBody, preserveFullyBufferedBodyMetadata } from "../server/fully-buffered-response.js";
|
|
3
|
+
import { deferUntilStreamConsumed } from "../server/defer-until-stream-consumed.js";
|
|
3
4
|
//#region src/shims/unified-request-context.ts
|
|
4
5
|
const _REQUEST_CONTEXT_ALS_KEY = Symbol.for("vinext.requestContext.als");
|
|
5
6
|
const _g = globalThis;
|
|
@@ -18,6 +19,7 @@ function createRequestContext(opts) {
|
|
|
18
19
|
headersContext: null,
|
|
19
20
|
actionRevalidationKind: 0,
|
|
20
21
|
cacheLifeSink: null,
|
|
22
|
+
pendingCdnTagInvalidations: [],
|
|
21
23
|
pendingRevalidatedTags: /* @__PURE__ */ new Set(),
|
|
22
24
|
pendingRevalidations: /* @__PURE__ */ new Set(),
|
|
23
25
|
dynamicUsageDetected: false,
|
|
@@ -50,6 +52,7 @@ function createRequestContext(opts) {
|
|
|
50
52
|
currentFetchDedupeEntries: /* @__PURE__ */ new Map(),
|
|
51
53
|
nextFetchId: 1,
|
|
52
54
|
executionContext: _getInheritedExecutionContext(),
|
|
55
|
+
requestSignal: null,
|
|
53
56
|
requestCache: /* @__PURE__ */ new WeakMap(),
|
|
54
57
|
afterContext: {
|
|
55
58
|
callbacks: [],
|
|
@@ -159,9 +162,8 @@ function closeAfterResponseWithBody(response, ctx) {
|
|
|
159
162
|
return response;
|
|
160
163
|
}
|
|
161
164
|
if (isFullyBufferedBody(response) && !requiresResponseCloseTracking(ctx)) return response;
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
const wrapped = new Response(passthrough.readable, {
|
|
165
|
+
const body = deferUntilStreamConsumed(response.body, () => void closeAfterResponse(ctx));
|
|
166
|
+
const wrapped = new Response(body, {
|
|
165
167
|
status: response.status,
|
|
166
168
|
statusText: response.statusText,
|
|
167
169
|
headers: response.headers
|
package/dist/typegen.d.ts
CHANGED
|
@@ -92,4 +92,11 @@ export declare function assetPrefixPathname(assetPrefix: string): string;
|
|
|
92
92
|
* @see https://github.com/vercel/next.js/blob/canary/packages/next/src/server/lib/router-server.ts
|
|
93
93
|
*/
|
|
94
94
|
export declare function isNextStaticPath(pathname: string, basePath: string, assetPathPrefix: string): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Whether `pathname` is a build asset under a path `assetPrefix`. Next.js adds
|
|
97
|
+
* a built-in beforeFiles rewrite from `${assetPrefix}/_next/:path+` into the
|
|
98
|
+
* basePath (`loadRewrites` in `packages/next/src/lib/load-custom-routes.ts`),
|
|
99
|
+
* so such a path resolves even when it lies outside the basePath.
|
|
100
|
+
*/
|
|
101
|
+
export declare function isAssetPrefixBuildAsset(pathname: string, assetPathPrefix: string): boolean;
|
|
95
102
|
//#endregion
|
|
@@ -118,5 +118,14 @@ function isNextStaticPath(pathname, basePath, assetPathPrefix) {
|
|
|
118
118
|
if (assetPathPrefix && (p === assetPathPrefix || p.startsWith(assetPathPrefix + "/"))) p = p.slice(assetPathPrefix.length) || "/";
|
|
119
119
|
return p.startsWith(`/${ASSET_PREFIX_URL_DIR}/`);
|
|
120
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Whether `pathname` is a build asset under a path `assetPrefix`. Next.js adds
|
|
123
|
+
* a built-in beforeFiles rewrite from `${assetPrefix}/_next/:path+` into the
|
|
124
|
+
* basePath (`loadRewrites` in `packages/next/src/lib/load-custom-routes.ts`),
|
|
125
|
+
* so such a path resolves even when it lies outside the basePath.
|
|
126
|
+
*/
|
|
127
|
+
function isAssetPrefixBuildAsset(pathname, assetPathPrefix) {
|
|
128
|
+
return !!assetPathPrefix && (pathname === assetPathPrefix || pathname.startsWith(assetPathPrefix + "/")) && isNextStaticPath(pathname, "", assetPathPrefix);
|
|
129
|
+
}
|
|
121
130
|
//#endregion
|
|
122
|
-
export { ASSET_PREFIX_URL_DIR, assetPrefixPathname, isAbsoluteAssetPrefix, isNextStaticPath, resolveAssetUrlPrefix, resolveAssetsDir };
|
|
131
|
+
export { ASSET_PREFIX_URL_DIR, assetPrefixPathname, isAbsoluteAssetPrefix, isAssetPrefixBuildAsset, isNextStaticPath, resolveAssetUrlPrefix, resolveAssetsDir };
|
|
@@ -4,6 +4,8 @@ type ClientBuildManifest = Record<string, BuildManifestChunk>;
|
|
|
4
4
|
export declare function readClientBuildManifest(manifestPath: string): ClientBuildManifest | undefined;
|
|
5
5
|
export declare function findClientEntryFileFromManifest(buildManifest: ClientBuildManifest, assetBase: string): string | undefined;
|
|
6
6
|
export declare function findPagesClientEntryFileFromManifest(buildManifest: ClientBuildManifest, assetBase: string): string | undefined;
|
|
7
|
+
/** Whether a build-manifest entry is the Pages Router client entry. */
|
|
8
|
+
export declare function isPagesClientEntryChunk(key: string, entry: BuildManifestChunk): boolean;
|
|
7
9
|
export declare function findClientEntryFile(options: {
|
|
8
10
|
buildManifest?: ClientBuildManifest;
|
|
9
11
|
clientDir: string;
|
|
@@ -16,4 +18,5 @@ export declare function findPagesClientEntryFile(options: {
|
|
|
16
18
|
assetsSubdir: string;
|
|
17
19
|
assetBase: string;
|
|
18
20
|
}): string | undefined;
|
|
19
|
-
//#endregion
|
|
21
|
+
//#endregion
|
|
22
|
+
export {};
|
|
@@ -19,6 +19,8 @@ function readClientBuildManifest(manifestPath) {
|
|
|
19
19
|
const assets = readStringArray(entry.assets);
|
|
20
20
|
manifest[key] = {
|
|
21
21
|
file: entry.file,
|
|
22
|
+
...typeof entry.src === "string" ? { src: entry.src } : {},
|
|
23
|
+
...typeof entry.name === "string" ? { name: entry.name } : {},
|
|
22
24
|
...entry.isEntry === true ? { isEntry: true } : {},
|
|
23
25
|
...entry.isDynamicEntry === true ? { isDynamicEntry: true } : {},
|
|
24
26
|
...imports ? { imports } : {},
|
|
@@ -39,14 +41,26 @@ function findPagesClientEntryFileFromManifest(buildManifest, assetBase) {
|
|
|
39
41
|
return findEntryFileFromManifest(buildManifest, assetBase, PAGES_CLIENT_ENTRY_MARKERS, false);
|
|
40
42
|
}
|
|
41
43
|
function findEntryFileFromManifest(buildManifest, assetBase, markers, fallbackToFirstEntry) {
|
|
42
|
-
const entries = Object.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
const entries = Object.entries(buildManifest).filter(([, entry]) => entry.isEntry && entry.file);
|
|
45
|
+
const matchers = [matchesEntryIdentity, (marker, _key, entry) => entry.file.includes(marker)];
|
|
46
|
+
for (const matches of matchers) for (const marker of markers) {
|
|
47
|
+
const markedEntry = entries.find(([key, entry]) => matches(marker, key, entry));
|
|
48
|
+
if (markedEntry) return manifestFileWithBase(markedEntry[1].file, assetBase);
|
|
46
49
|
}
|
|
47
|
-
const chosen = fallbackToFirstEntry ? entries[0] : void 0;
|
|
50
|
+
const chosen = fallbackToFirstEntry ? entries[0]?.[1] : void 0;
|
|
48
51
|
return chosen ? manifestFileWithBase(chosen.file, assetBase) : void 0;
|
|
49
52
|
}
|
|
53
|
+
function matchesEntryIdentity(marker, key, entry) {
|
|
54
|
+
return entry.name === marker || isVirtualEntryId(key, marker) || entry.src !== void 0 && isVirtualEntryId(entry.src, marker);
|
|
55
|
+
}
|
|
56
|
+
/** Whether a build-manifest entry is the Pages Router client entry. */
|
|
57
|
+
function isPagesClientEntryChunk(key, entry) {
|
|
58
|
+
return entry.isEntry === true && PAGES_CLIENT_ENTRY_MARKERS.some((marker) => matchesEntryIdentity(marker, key, entry));
|
|
59
|
+
}
|
|
60
|
+
function isVirtualEntryId(id, marker) {
|
|
61
|
+
const virtualId = `virtual:${marker}`;
|
|
62
|
+
return id === virtualId || id.endsWith(`/${virtualId}`);
|
|
63
|
+
}
|
|
50
64
|
function listFilesRecursive(dir) {
|
|
51
65
|
const out = [];
|
|
52
66
|
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
@@ -85,4 +99,4 @@ function readStringArray(value) {
|
|
|
85
99
|
return Array.isArray(value) && value.every((item) => typeof item === "string") ? value : void 0;
|
|
86
100
|
}
|
|
87
101
|
//#endregion
|
|
88
|
-
export { findClientEntryFile, findClientEntryFileFromManifest, findPagesClientEntryFile, findPagesClientEntryFileFromManifest, readClientBuildManifest };
|
|
102
|
+
export { findClientEntryFile, findClientEntryFileFromManifest, findPagesClientEntryFile, findPagesClientEntryFileFromManifest, isPagesClientEntryChunk, readClientBuildManifest };
|
|
@@ -1,10 +1,23 @@
|
|
|
1
|
+
import { ClientReferenceChunks } from "./client-reference-chunks.js";
|
|
1
2
|
//#region src/utils/client-entry-manifest.d.ts
|
|
2
3
|
export declare const VINEXT_CLIENT_ENTRY_MANIFEST = "vinext-client-entry-manifest.json";
|
|
4
|
+
/**
|
|
5
|
+
* Build manifest keys of App Router client reference modules -> the chunk of
|
|
6
|
+
* the module that registers the reference (see build/client-reference-chunks.ts).
|
|
7
|
+
* It names source files, so it sits under `.vite/` with Vite's build manifest,
|
|
8
|
+
* which deploys leave out of the public assets.
|
|
9
|
+
*/
|
|
10
|
+
export declare const VINEXT_CLIENT_REFERENCE_SOURCES = ".vite/vinext-client-reference-sources.json";
|
|
3
11
|
export type ClientEntryManifest = {
|
|
4
12
|
pagesClientEntry?: string;
|
|
5
13
|
appBrowserEntry?: string;
|
|
14
|
+
/** The App Router RouteManifest chunk, which the browser entry imports as it boots. */
|
|
15
|
+
appRouteManifest?: string;
|
|
16
|
+
/** What each App Router client reference loads in the browser. */
|
|
17
|
+
appClientReferenceChunks?: ClientReferenceChunks;
|
|
6
18
|
};
|
|
7
19
|
export declare function readClientEntryManifest(clientDir: string): ClientEntryManifest | undefined;
|
|
20
|
+
export declare function readClientReferenceSources(clientDir: string): Record<string, string> | undefined;
|
|
8
21
|
export declare function findClientEntryFileFromVinextManifest(manifest: ClientEntryManifest | undefined, assetBase: string): string | undefined;
|
|
9
22
|
export declare function findPagesClientEntryFileFromVinextManifest(manifest: ClientEntryManifest | undefined, assetBase: string): string | undefined;
|
|
10
23
|
//#endregion
|
|
@@ -4,6 +4,13 @@ import { manifestFileWithBase } from "./manifest-paths.js";
|
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
//#region src/utils/client-entry-manifest.ts
|
|
6
6
|
const VINEXT_CLIENT_ENTRY_MANIFEST = "vinext-client-entry-manifest.json";
|
|
7
|
+
/**
|
|
8
|
+
* Build manifest keys of App Router client reference modules -> the chunk of
|
|
9
|
+
* the module that registers the reference (see build/client-reference-chunks.ts).
|
|
10
|
+
* It names source files, so it sits under `.vite/` with Vite's build manifest,
|
|
11
|
+
* which deploys leave out of the public assets.
|
|
12
|
+
*/
|
|
13
|
+
const VINEXT_CLIENT_REFERENCE_SOURCES = ".vite/vinext-client-reference-sources.json";
|
|
7
14
|
function readClientEntryManifest(clientDir) {
|
|
8
15
|
const manifestPath = path.join(clientDir, VINEXT_CLIENT_ENTRY_MANIFEST);
|
|
9
16
|
if (!fs.existsSync(manifestPath)) return void 0;
|
|
@@ -13,11 +20,23 @@ function readClientEntryManifest(clientDir) {
|
|
|
13
20
|
const manifest = {};
|
|
14
21
|
if (typeof value.pagesClientEntry === "string") manifest.pagesClientEntry = value.pagesClientEntry;
|
|
15
22
|
if (typeof value.appBrowserEntry === "string") manifest.appBrowserEntry = value.appBrowserEntry;
|
|
23
|
+
if (typeof value.appRouteManifest === "string") manifest.appRouteManifest = value.appRouteManifest;
|
|
24
|
+
if (isUnknownRecord(value.appClientReferenceChunks)) manifest.appClientReferenceChunks = value.appClientReferenceChunks;
|
|
16
25
|
return manifest.pagesClientEntry || manifest.appBrowserEntry ? manifest : void 0;
|
|
17
26
|
} catch {
|
|
18
27
|
return;
|
|
19
28
|
}
|
|
20
29
|
}
|
|
30
|
+
function readClientReferenceSources(clientDir) {
|
|
31
|
+
const sourcesPath = path.join(clientDir, VINEXT_CLIENT_REFERENCE_SOURCES);
|
|
32
|
+
if (!fs.existsSync(sourcesPath)) return void 0;
|
|
33
|
+
try {
|
|
34
|
+
const value = JSON.parse(fs.readFileSync(sourcesPath, "utf-8"));
|
|
35
|
+
return isUnknownRecord(value) ? value : void 0;
|
|
36
|
+
} catch {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
21
40
|
function findClientEntryFileFromVinextManifest(manifest, assetBase) {
|
|
22
41
|
const entry = manifest?.pagesClientEntry ?? manifest?.appBrowserEntry;
|
|
23
42
|
return entry ? manifestFileWithBase(entry, assetBase) : void 0;
|
|
@@ -26,4 +45,4 @@ function findPagesClientEntryFileFromVinextManifest(manifest, assetBase) {
|
|
|
26
45
|
return manifest?.pagesClientEntry ? manifestFileWithBase(manifest.pagesClientEntry, assetBase) : void 0;
|
|
27
46
|
}
|
|
28
47
|
//#endregion
|
|
29
|
-
export { VINEXT_CLIENT_ENTRY_MANIFEST, findClientEntryFileFromVinextManifest, findPagesClientEntryFileFromVinextManifest, readClientEntryManifest };
|
|
48
|
+
export { VINEXT_CLIENT_ENTRY_MANIFEST, VINEXT_CLIENT_REFERENCE_SOURCES, findClientEntryFileFromVinextManifest, findPagesClientEntryFileFromVinextManifest, readClientEntryManifest, readClientReferenceSources };
|