vinext 1.3.0 → 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/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 +13 -3
- package/dist/build/client-build-config.js +46 -9
- 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 +9 -1
- package/dist/build/client-reference-groups.js +40 -2
- 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 +2 -1
- package/dist/build/next-client-runtime-manifests.d.ts +2 -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-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 +2 -1
- package/dist/build/ssr-manifest.js +25 -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-rewrites.d.ts +2 -1
- package/dist/client/dev-error-overlay-store.d.ts +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 +3 -1
- package/dist/client/navigation-runtime.js +1 -1
- package/dist/client/pages-router-link-navigation.d.ts +2 -1
- package/dist/client/vinext-next-data.d.ts +25 -1
- package/dist/client/window-next.d.ts +2 -1
- package/dist/config/config-matchers.d.ts +12 -1
- package/dist/config/config-matchers.js +111 -16
- package/dist/config/dotenv.d.ts +2 -1
- package/dist/config/next-config.d.ts +13 -1
- package/dist/config/next-config.js +29 -4
- 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 +20 -5
- package/dist/entries/app-browser-entry.js +79 -6
- package/dist/entries/app-rsc-entry.d.ts +2 -1
- package/dist/entries/app-rsc-entry.js +42 -12
- package/dist/entries/app-rsc-manifest.d.ts +2 -1
- package/dist/entries/app-rsc-manifest.js +53 -0
- 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 +1 -1
- 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.js +102 -34
- 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 +2 -1
- 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 +8 -0
- package/dist/plugins/rsc-client-reference-loaders.js +170 -68
- 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/worker-image-imports.js +1 -1
- package/dist/plugins/worker-use-server.d.ts +2 -1
- package/dist/routing/app-route-graph.d.ts +40 -0
- package/dist/routing/app-route-graph.js +122 -50
- package/dist/routing/browser-route-manifest.d.ts +2 -1
- package/dist/routing/optimistic-route-trie.d.ts +2 -1
- package/dist/routing/route-matching.d.ts +2 -1
- package/dist/routing/route-pattern.d.ts +2 -1
- package/dist/server/accept-encoding.d.ts +2 -1
- package/dist/server/app-action-forwarding.d.ts +2 -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 +30 -6
- package/dist/server/app-browser-error.d.ts +2 -1
- 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 +2 -1
- package/dist/server/app-browser-navigation-controller.js +15 -10
- 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.js +1 -1
- package/dist/server/app-browser-stream.d.ts +2 -1
- package/dist/server/app-browser-visible-commit.d.ts +2 -1
- 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 +25 -5
- package/dist/server/app-client-reference-preloader.js +22 -7
- 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 +4 -1
- 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-optimistic-routing.d.ts +18 -1
- package/dist/server/app-optimistic-routing.js +34 -1
- package/dist/server/app-page-boundary-render.d.ts +20 -2
- package/dist/server/app-page-boundary-render.js +221 -38
- 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 +14 -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 +163 -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 +35 -10
- 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 +2 -1
- package/dist/server/app-page-search-params-observation.d.ts +7 -2
- package/dist/server/app-page-search-params-observation.js +8 -1
- package/dist/server/app-page-segment-plan.d.ts +2 -1
- package/dist/server/app-page-stream.d.ts +31 -1
- package/dist/server/app-page-stream.js +23 -4
- package/dist/server/app-pages-bridge.d.ts +2 -1
- 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-render-dependency.d.ts +11 -1
- package/dist/server/app-render-dependency.js +26 -7
- package/dist/server/app-request-stage-independent-entry.d.ts +2 -1
- package/dist/server/app-response-stage-entry.d.ts +2 -1
- 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 +1 -1
- package/dist/server/app-route-handler-execution.d.ts +2 -1
- package/dist/server/app-route-handler-response.d.ts +2 -1
- package/dist/server/app-route-handler-runtime.d.ts +2 -1
- package/dist/server/app-route-module-loader.d.ts +18 -1
- package/dist/server/app-route-module-loader.js +8 -0
- package/dist/server/app-route-tree-prefetch.d.ts +2 -1
- package/dist/server/app-rsc-error-handler.d.ts +2 -1
- package/dist/server/app-rsc-errors.d.ts +2 -1
- package/dist/server/app-rsc-handler.d.ts +2 -1
- package/dist/server/app-rsc-handler.js +6 -10
- package/dist/server/app-rsc-response-finalizer.d.ts +2 -1
- package/dist/server/app-rsc-route-matching.d.ts +38 -1
- package/dist/server/app-rsc-route-matching.js +24 -0
- 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 +2 -1
- package/dist/server/app-server-action-execution.js +3 -3
- package/dist/server/app-ssr-entry.d.ts +6 -0
- package/dist/server/app-ssr-entry.js +91 -44
- 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 +22 -10
- package/dist/server/app-ssr-stream.js +299 -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/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/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-runtime.d.ts +2 -1
- 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 +2 -1
- package/dist/server/nitro-public-files.d.ts +2 -1
- 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 +2 -1
- package/dist/server/pages-body-parser-config.d.ts +2 -1
- package/dist/server/pages-client-assets.d.ts +4 -0
- 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-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 +2 -1
- package/dist/server/pages-request-pipeline.js +4 -5
- package/dist/server/pages-request-stage-entry.d.ts +2 -1
- package/dist/server/pages-response-stage-entry.d.ts +2 -1
- package/dist/server/pages-route-data-kind.d.ts +2 -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.js +9 -3
- package/dist/server/request-log.d.ts +2 -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/static-file-cache.d.ts +2 -1
- package/dist/server/static-file-cache.js +1 -0
- 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/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 +29 -9
- 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 +2 -1
- 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/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 +1 -1
- 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.d.ts +1 -22
- 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 +2 -0
- package/dist/shims/internal/headers-state.js +6 -1
- package/dist/shims/internal/hybrid-client-route-owner-direct.d.ts +2 -1
- 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 +195 -52
- 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 +22 -2
- package/dist/shims/navigation.js +74 -20
- package/dist/shims/pages-router-runtime.d.ts +2 -1
- package/dist/shims/ppr-fallback-shell.d.ts +2 -1
- package/dist/shims/router.js +14 -3
- package/dist/shims/unified-request-context.js +3 -3
- package/dist/typegen.d.ts +2 -1
- package/dist/utils/client-build-manifest.d.ts +4 -1
- package/dist/utils/client-build-manifest.js +9 -2
- 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 +9 -1
- package/dist/utils/client-runtime-metadata.js +40 -9
- package/dist/utils/compare.d.ts +9 -0
- package/dist/utils/compare.js +15 -1
- package/dist/utils/lazy-chunks.d.ts +14 -0
- package/dist/utils/lazy-chunks.js +27 -1
- package/dist/utils/middleware-request-headers.d.ts +2 -1
- package/dist/utils/project.d.ts +2 -1
- package/dist/utils/project.js +9 -1
- 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/rsc-stream-hints.d.ts +0 -21
- package/dist/server/rsc-stream-hints.js +0 -227
package/dist/shims/metadata.js
CHANGED
|
@@ -23,12 +23,23 @@ async function resolveModuleViewport(mod, params = {}, searchParams, parent = Pr
|
|
|
23
23
|
params: asyncParams,
|
|
24
24
|
searchParams: makeThenableParams(searchParams, searchParamsObserver)
|
|
25
25
|
});
|
|
26
|
-
return await mod.generateViewport
|
|
26
|
+
return await callSegmentResolver(mod.generateViewport, props, parent);
|
|
27
27
|
}
|
|
28
28
|
if (mod.viewport && typeof mod.viewport === "object") return mod.viewport;
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
+
* Call a segment's generateMetadata() or generateViewport() with `parent`, as
|
|
33
|
+
* Next.js's getResult does for both.
|
|
34
|
+
* https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/metadata/resolve-metadata.ts (getResult)
|
|
35
|
+
*/
|
|
36
|
+
function callSegmentResolver(resolver, props, parent) {
|
|
37
|
+
if (!(Reflect.get(resolver, USE_CACHE_FUNCTION_SYMBOL) === true)) return resolver(props, parent);
|
|
38
|
+
const acceptsSecondArgument = Reflect.get(resolver, USE_CACHE_ACCEPTS_SECOND_ARGUMENT_SYMBOL);
|
|
39
|
+
if (!(typeof acceptsSecondArgument === "boolean" ? acceptsSecondArgument : resolver.length >= 2)) return resolver(props);
|
|
40
|
+
return parent.then(() => resolver(props, parent));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
32
43
|
* Merge viewport configs from multiple sources (layouts + page).
|
|
33
44
|
* Later entries override earlier ones.
|
|
34
45
|
*/
|
|
@@ -232,13 +243,26 @@ function postProcessMetadata(merged) {
|
|
|
232
243
|
* tags are the exception: Next.js merges those across segments.
|
|
233
244
|
*/
|
|
234
245
|
function mergeMetadataEntries(entries) {
|
|
246
|
+
return mergeEntries(entries, false);
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Merge metadata into the `parent` a later segment's resolver receives. Like
|
|
250
|
+
* {@link mergeMetadataEntries}, except the title stays resolved as Next.js's
|
|
251
|
+
* `{ absolute, template }`, so `(await parent).title?.absolute` reads the
|
|
252
|
+
* title so far. `template` is the one the next title gets, so merging this
|
|
253
|
+
* parent with later entries resolves their titles as the full merge does.
|
|
254
|
+
* https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/metadata/resolvers/resolve-title.ts
|
|
255
|
+
*/
|
|
256
|
+
function mergeParentMetadataEntries(entries) {
|
|
257
|
+
return mergeEntries(entries, true);
|
|
258
|
+
}
|
|
259
|
+
function mergeEntries(entries, resolvedTitle) {
|
|
235
260
|
if (entries.length === 0) return {};
|
|
236
261
|
const merged = {};
|
|
237
262
|
let parentTemplate;
|
|
238
263
|
for (const entry of entries) {
|
|
239
264
|
const meta = entry.metadata;
|
|
240
265
|
const isPage = Boolean(entry.isPage);
|
|
241
|
-
const contributesTitle = entry.contributesTitle !== false;
|
|
242
266
|
for (const key of Object.keys(meta)) {
|
|
243
267
|
if (key === "title") continue;
|
|
244
268
|
const incoming = meta[key];
|
|
@@ -249,9 +273,13 @@ function mergeMetadataEntries(entries) {
|
|
|
249
273
|
};
|
|
250
274
|
else merged[key] = incoming;
|
|
251
275
|
}
|
|
252
|
-
if (
|
|
253
|
-
if (
|
|
276
|
+
if (meta.title !== void 0) merged.title = resolveTitle(meta.title, parentTemplate);
|
|
277
|
+
if (!isPage && meta.title && typeof meta.title === "object" && meta.title.template) parentTemplate = meta.title.template;
|
|
254
278
|
}
|
|
279
|
+
if (resolvedTitle && Object.hasOwn(merged, "title")) merged.title = {
|
|
280
|
+
absolute: resolveStringTitle(merged.title) ?? "",
|
|
281
|
+
template: parentTemplate ?? null
|
|
282
|
+
};
|
|
255
283
|
return merged;
|
|
256
284
|
}
|
|
257
285
|
/**
|
|
@@ -268,13 +296,10 @@ async function resolveModuleMetadata(mod, params = {}, searchParams, parent = Pr
|
|
|
268
296
|
if (typeof mod.generateMetadata === "function") {
|
|
269
297
|
const generateMetadata = mod.generateMetadata;
|
|
270
298
|
const asyncParams = makeThenableParams(params);
|
|
271
|
-
|
|
299
|
+
return await callSegmentResolver(generateMetadata, searchParams === void 0 ? withUseCacheLayoutMarker(generateMetadata, { params: asyncParams }) : withUseCachePageMarker(generateMetadata, {
|
|
272
300
|
params: asyncParams,
|
|
273
301
|
searchParams: makeThenableParams(searchParams, searchParamsObserver)
|
|
274
|
-
});
|
|
275
|
-
const isUseCacheFunction = Reflect.get(generateMetadata, USE_CACHE_FUNCTION_SYMBOL) === true;
|
|
276
|
-
const acceptsSecondArgument = Reflect.get(generateMetadata, USE_CACHE_ACCEPTS_SECOND_ARGUMENT_SYMBOL);
|
|
277
|
-
return await (!isUseCacheFunction || (typeof acceptsSecondArgument === "boolean" ? acceptsSecondArgument : generateMetadata.length >= 2) ? generateMetadata(props, parent) : generateMetadata(props));
|
|
302
|
+
}), parent);
|
|
278
303
|
}
|
|
279
304
|
if (mod.metadata && typeof mod.metadata === "object") return mod.metadata;
|
|
280
305
|
return null;
|
|
@@ -607,24 +632,61 @@ function MetadataHead({ metadata, pathname = "/", trailingSlash, streamedIconKey
|
|
|
607
632
|
}
|
|
608
633
|
}
|
|
609
634
|
}
|
|
610
|
-
if (og.videos)
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
635
|
+
if (og.videos) {
|
|
636
|
+
const videos = normalizeUrlDescriptorEntries(og.videos, (url) => ({ url }));
|
|
637
|
+
for (const video of videos) {
|
|
638
|
+
if (video.url) elements.push(/* @__PURE__ */ jsx("meta", {
|
|
639
|
+
property: "og:video",
|
|
640
|
+
content: stringifyUrl(video.url)
|
|
641
|
+
}, key++));
|
|
642
|
+
if (video.secureUrl) elements.push(/* @__PURE__ */ jsx("meta", {
|
|
643
|
+
property: "og:video:secure_url",
|
|
644
|
+
content: stringifyUrl(video.secureUrl)
|
|
645
|
+
}, key++));
|
|
646
|
+
if (video.type) elements.push(/* @__PURE__ */ jsx("meta", {
|
|
647
|
+
property: "og:video:type",
|
|
648
|
+
content: video.type
|
|
649
|
+
}, key++));
|
|
650
|
+
if (video.width) elements.push(/* @__PURE__ */ jsx("meta", {
|
|
651
|
+
property: "og:video:width",
|
|
652
|
+
content: String(video.width)
|
|
653
|
+
}, key++));
|
|
654
|
+
if (video.height) elements.push(/* @__PURE__ */ jsx("meta", {
|
|
655
|
+
property: "og:video:height",
|
|
656
|
+
content: String(video.height)
|
|
657
|
+
}, key++));
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
if (og.audio) {
|
|
661
|
+
const audios = normalizeUrlDescriptorEntries(og.audio, (url) => ({ url }));
|
|
662
|
+
for (const audio of audios) {
|
|
663
|
+
if (audio.url) elements.push(/* @__PURE__ */ jsx("meta", {
|
|
664
|
+
property: "og:audio",
|
|
665
|
+
content: stringifyUrl(audio.url)
|
|
666
|
+
}, key++));
|
|
667
|
+
if (audio.secureUrl) elements.push(/* @__PURE__ */ jsx("meta", {
|
|
668
|
+
property: "og:audio:secure_url",
|
|
669
|
+
content: stringifyUrl(audio.secureUrl)
|
|
670
|
+
}, key++));
|
|
671
|
+
if (audio.type) elements.push(/* @__PURE__ */ jsx("meta", {
|
|
672
|
+
property: "og:audio:type",
|
|
673
|
+
content: audio.type
|
|
674
|
+
}, key++));
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
const ogListTags = [
|
|
678
|
+
["og:email", og.emails],
|
|
679
|
+
["og:phone_number", og.phoneNumbers],
|
|
680
|
+
["og:fax_number", og.faxNumbers],
|
|
681
|
+
["og:locale:alternate", og.alternateLocale]
|
|
682
|
+
];
|
|
683
|
+
for (const [property, value] of ogListTags) {
|
|
684
|
+
if (!value) continue;
|
|
685
|
+
for (const content of Array.isArray(value) ? value : [value]) elements.push(/* @__PURE__ */ jsx("meta", {
|
|
686
|
+
property,
|
|
687
|
+
content
|
|
622
688
|
}, key++));
|
|
623
689
|
}
|
|
624
|
-
if (og.audio) for (const audio of og.audio) elements.push(/* @__PURE__ */ jsx("meta", {
|
|
625
|
-
property: "og:audio",
|
|
626
|
-
content: resolveUrl(audio.url)
|
|
627
|
-
}, key++));
|
|
628
690
|
}
|
|
629
691
|
if (metadata.twitter) {
|
|
630
692
|
const tw = metadata.twitter;
|
|
@@ -867,4 +929,4 @@ function MetadataHead({ metadata, pathname = "/", trailingSlash, streamedIconKey
|
|
|
867
929
|
return /* @__PURE__ */ jsx(Fragment$1, { children: elements });
|
|
868
930
|
}
|
|
869
931
|
//#endregion
|
|
870
|
-
export { DEFAULT_VIEWPORT, MetadataHead, ViewportHead, mergeMetadata, mergeMetadataEntries, mergeViewport, postProcessMetadata, renderMetadataToHtml, resolveModuleMetadata, resolveModuleViewport };
|
|
932
|
+
export { DEFAULT_VIEWPORT, MetadataHead, ViewportHead, mergeMetadata, mergeMetadataEntries, mergeParentMetadataEntries, mergeViewport, postProcessMetadata, renderMetadataToHtml, resolveModuleMetadata, resolveModuleViewport };
|
|
@@ -58,4 +58,5 @@ export declare function isDynamicServerError(error: unknown): error is DynamicSe
|
|
|
58
58
|
* them. This covers the categories vinext can currently produce.
|
|
59
59
|
*/
|
|
60
60
|
export declare function unstable_rethrow(error: unknown): void;
|
|
61
|
-
//#endregion
|
|
61
|
+
//#endregion
|
|
62
|
+
export {};
|
|
@@ -3,6 +3,7 @@ import { NavigationRuntimeVisibleCommitMode } from "../client/navigation-runtime
|
|
|
3
3
|
import { AppElements } from "../server/app-elements-wire.js";
|
|
4
4
|
import "../server/app-elements.js";
|
|
5
5
|
import { AppRouterInstance, NavigateOptions, PrefetchOptions as PrefetchOptions$1 } from "./internal/app-router-context.js";
|
|
6
|
+
import { AppRoutePrefetchPolicy } from "./internal/app-route-prefetch-policy.js";
|
|
6
7
|
import { ReadonlyURLSearchParams } from "./readonly-url-search-params.js";
|
|
7
8
|
import { AppRscRenderMode } from "../server/app-rsc-render-mode.js";
|
|
8
9
|
import { GLOBAL_ACCESSORS_KEY, NavigationContext, NavigationStateAccessors, SegmentMap, ServerInsertedHTMLContext, _registerStateAccessors, clearServerInsertedHTML, flushServerInsertedHTML, getBfcacheIdMapContext, getBfcacheSegmentIdContext, getLayoutSegmentContext, getNavigationContext, renderServerInsertedHTML, setNavigationContext } from "./navigation-context-state.js";
|
|
@@ -67,7 +68,13 @@ export type PrefetchOptions = {
|
|
|
67
68
|
export type PrefetchCacheKind = "loading-shell" | "navigation" | "route-tree";
|
|
68
69
|
export type PrefetchCacheEntry = {
|
|
69
70
|
cacheForNavigation?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Set while a full prefetch would be kept as learning-only if its page
|
|
73
|
+
* renders dynamically. A hover upgrade turns it into a full prefetch.
|
|
74
|
+
*/
|
|
75
|
+
dynamicStaleTime?: "learning-only" | "full-prefetch";
|
|
70
76
|
expiresAt?: number;
|
|
77
|
+
fallbackTtlMs?: number;
|
|
71
78
|
invalidationTimer?: ReturnType<typeof setTimeout>;
|
|
72
79
|
mountedSlotsHeader?: string | null;
|
|
73
80
|
onInvalidateCallbacks?: Set<() => void>;
|
|
@@ -116,6 +123,10 @@ export declare function hasPrefetchCacheEntryForNavigation(rscUrl: string, inter
|
|
|
116
123
|
additionalRscUrls?: readonly string[];
|
|
117
124
|
notifyInvalidation?: boolean;
|
|
118
125
|
onInvalidate?: () => void;
|
|
126
|
+
/** Called with the matched entry, and the key it was found under, when it is reused. */
|
|
127
|
+
onReuse?: (entry: PrefetchCacheEntry, cacheKey: string) => void;
|
|
128
|
+
/** Whether an in-flight entry counts as reusable. Defaults to true. */
|
|
129
|
+
reusePending?: boolean;
|
|
119
130
|
}): boolean;
|
|
120
131
|
/**
|
|
121
132
|
* Return whether the exact learning-only Link prefetch is still usable.
|
|
@@ -124,7 +135,16 @@ export declare function hasPrefetchCacheEntryForNavigation(rscUrl: string, inter
|
|
|
124
135
|
*/
|
|
125
136
|
export declare function hasFreshLearningOnlyPrefetchCacheEntry(rscUrl: string, interceptionContext?: string | null): boolean;
|
|
126
137
|
export declare function hasSearchAgnosticPrefetchShellForRoute(rscUrl: string, interceptionContext?: string | null, mountedSlotsHeader?: string | null): boolean;
|
|
127
|
-
export declare function discardLearningOnlyPrefetchCacheEntry(rscUrl: string, interceptionContext?: string | null): boolean;
|
|
138
|
+
export declare function discardLearningOnlyPrefetchCacheEntry(rscUrl: string, interceptionContext?: string | null, mountedSlotsHeader?: string | null): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Make a prefetch reusable by a navigation, as an `unstable_dynamicOnHover`
|
|
141
|
+
* hover does. A pending one that would be kept as learning-only becomes a full
|
|
142
|
+
* prefetch and takes the full-prefetch lifetime. One already kept as
|
|
143
|
+
* learning-only because its page rendered dynamically is left for the full
|
|
144
|
+
* prefetch to replace: Next.js refetches it with `FetchStrategy.Full`, so the
|
|
145
|
+
* page reflects the cookies and headers at hover time.
|
|
146
|
+
*/
|
|
147
|
+
export declare function promotePrefetchCacheEntryForNavigation(cacheKey: string, entry: PrefetchCacheEntry): void;
|
|
128
148
|
export declare function invalidatePrefetchCache(): void;
|
|
129
149
|
/**
|
|
130
150
|
* Prevent completed navigation responses from becoming authoritative again
|
|
@@ -206,7 +226,7 @@ export declare function fetchRouteTreeGatedPrefetch(options: {
|
|
|
206
226
|
*/
|
|
207
227
|
export declare function prefetchRscResponse(rscUrl: string, fetchPromise: Promise<Response>, interceptionContext?: string | null, mountedSlotsHeader?: string | null, options?: PrefetchOptions, behavior?: {
|
|
208
228
|
cacheForNavigation?: boolean;
|
|
209
|
-
dynamicStaleTime?: "
|
|
229
|
+
dynamicStaleTime?: AppRoutePrefetchPolicy["dynamicStaleTime"];
|
|
210
230
|
fallbackTtlMs?: number;
|
|
211
231
|
optimisticRouteShell?: boolean;
|
|
212
232
|
prefetchKind?: PrefetchCacheKind;
|
package/dist/shims/navigation.js
CHANGED
|
@@ -70,9 +70,9 @@ function useChildSegments(parallelRoutesKey = "children") {
|
|
|
70
70
|
return [];
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
const _READONLY_SEARCH_PARAMS = Symbol("vinext.navigation.readonlySearchParams");
|
|
74
|
-
const _READONLY_SEARCH_PARAMS_SOURCE = Symbol("vinext.navigation.readonlySearchParamsSource");
|
|
75
|
-
const _READONLY_SEARCH_PARAMS_SOURCE_KEY = Symbol("vinext.navigation.readonlySearchParamsSourceKey");
|
|
73
|
+
const _READONLY_SEARCH_PARAMS = Symbol.for("vinext.navigation.readonlySearchParams");
|
|
74
|
+
const _READONLY_SEARCH_PARAMS_SOURCE = Symbol.for("vinext.navigation.readonlySearchParamsSource");
|
|
75
|
+
const _READONLY_SEARCH_PARAMS_SOURCE_KEY = Symbol.for("vinext.navigation.readonlySearchParamsSourceKey");
|
|
76
76
|
const PAGES_NAVIGATION_NOTIFY_KEY = Symbol.for("vinext.navigation.pagesNavigationNotify");
|
|
77
77
|
const isServer = typeof window === "undefined";
|
|
78
78
|
/** basePath from next.config.js, injected by the plugin at build time */
|
|
@@ -296,9 +296,11 @@ function findPrefetchCacheEntryForNavigation(rscUrl, interceptionContext, mounte
|
|
|
296
296
|
function hasPrefetchCacheEntryForNavigation(rscUrl, interceptionContext = null, mountedSlotsHeader = null, options = {}) {
|
|
297
297
|
const match = findPrefetchCacheEntryForNavigation(rscUrl, interceptionContext, mountedSlotsHeader, options.additionalRscUrls);
|
|
298
298
|
if (match === null) return false;
|
|
299
|
+
if (match.entry.pending !== void 0 && options.reusePending === false) return false;
|
|
299
300
|
if (match.entry.pending !== void 0 || resolvePrefetchCacheEntryExpiresAt(match.entry) > Date.now()) {
|
|
300
301
|
touchPrefetchCacheEntry(getPrefetchCache(), match.cacheKey, match.entry);
|
|
301
302
|
attachPrefetchInvalidationToEntry(match.cacheKey, match.entry, options.onInvalidate);
|
|
303
|
+
options.onReuse?.(match.entry, match.cacheKey);
|
|
302
304
|
return true;
|
|
303
305
|
}
|
|
304
306
|
deletePrefetchCacheEntry(getPrefetchCache(), getPrefetchedUrls(), match.cacheKey, match.entry, options.notifyInvalidation ?? true);
|
|
@@ -494,7 +496,7 @@ function deletePrefetchCacheEntry(cache, prefetched, cacheKey, entry, notify) {
|
|
|
494
496
|
entry.onInvalidateCallbacks = void 0;
|
|
495
497
|
}
|
|
496
498
|
}
|
|
497
|
-
function discardLearningOnlyPrefetchCacheEntry(rscUrl, interceptionContext = null) {
|
|
499
|
+
function discardLearningOnlyPrefetchCacheEntry(rscUrl, interceptionContext = null, mountedSlotsHeader = null) {
|
|
498
500
|
const cache = getPrefetchCache();
|
|
499
501
|
const prefetched = getPrefetchedUrls();
|
|
500
502
|
const normalizedTarget = normalizeRscCacheLookupUrl(rscUrl);
|
|
@@ -505,6 +507,7 @@ function discardLearningOnlyPrefetchCacheEntry(rscUrl, interceptionContext = nul
|
|
|
505
507
|
const source = parsePrefetchCacheKey(cacheKey);
|
|
506
508
|
if (source.interceptionContext !== interceptionContext) continue;
|
|
507
509
|
if (normalizeRscCacheLookupUrl(source.rscUrl) !== normalizedTarget) continue;
|
|
510
|
+
if (!isPrefetchCacheEntryCompatibleWithMountedSlots(entry, mountedSlotsHeader)) continue;
|
|
508
511
|
superseded.push([cacheKey, entry]);
|
|
509
512
|
}
|
|
510
513
|
for (const [cacheKey, entry] of superseded) {
|
|
@@ -513,6 +516,25 @@ function discardLearningOnlyPrefetchCacheEntry(rscUrl, interceptionContext = nul
|
|
|
513
516
|
}
|
|
514
517
|
return superseded.length > 0;
|
|
515
518
|
}
|
|
519
|
+
/**
|
|
520
|
+
* Make a prefetch reusable by a navigation, as an `unstable_dynamicOnHover`
|
|
521
|
+
* hover does. A pending one that would be kept as learning-only becomes a full
|
|
522
|
+
* prefetch and takes the full-prefetch lifetime. One already kept as
|
|
523
|
+
* learning-only because its page rendered dynamically is left for the full
|
|
524
|
+
* prefetch to replace: Next.js refetches it with `FetchStrategy.Full`, so the
|
|
525
|
+
* page reflects the cookies and headers at hover time.
|
|
526
|
+
*/
|
|
527
|
+
function promotePrefetchCacheEntryForNavigation(cacheKey, entry) {
|
|
528
|
+
if (entry.dynamicStaleTime !== "learning-only") {
|
|
529
|
+
entry.cacheForNavigation = true;
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
if (entry.cacheForNavigation === false) return;
|
|
533
|
+
entry.dynamicStaleTime = "full-prefetch";
|
|
534
|
+
if (entry.snapshot === void 0) return;
|
|
535
|
+
entry.expiresAt = resolvePrefetchedRscResponseExpiresAt(entry.timestamp, entry.snapshot, entry.fallbackTtlMs ?? PREFETCH_CACHE_TTL, "full-prefetch");
|
|
536
|
+
schedulePrefetchInvalidation(cacheKey, entry);
|
|
537
|
+
}
|
|
516
538
|
function invalidatePrefetchCacheEntry(cacheKey) {
|
|
517
539
|
const cache = getPrefetchCache();
|
|
518
540
|
const entry = cache.get(cacheKey);
|
|
@@ -837,6 +859,10 @@ function prefetchRscResponse(rscUrl, fetchPromise, interceptionContext = null, m
|
|
|
837
859
|
searchAgnosticShell: behavior.searchAgnosticShell === true,
|
|
838
860
|
timestamp: now
|
|
839
861
|
};
|
|
862
|
+
if (behavior.dynamicStaleTime === "learning-only" && behavior.searchAgnosticShell !== true) {
|
|
863
|
+
entry.dynamicStaleTime = "learning-only";
|
|
864
|
+
entry.fallbackTtlMs = behavior.fallbackTtlMs ?? PREFETCH_CACHE_TTL;
|
|
865
|
+
}
|
|
840
866
|
addPrefetchInvalidationCallback(entry, options?.onInvalidate);
|
|
841
867
|
entry.fetchPromise = fetchPromise;
|
|
842
868
|
entry.pending = fetchPromise.then(async (response) => {
|
|
@@ -847,8 +873,13 @@ function prefetchRscResponse(rscUrl, fetchPromise, interceptionContext = null, m
|
|
|
847
873
|
entry.snapshot = snapshot;
|
|
848
874
|
entry.size = snapshot.buffer.byteLength;
|
|
849
875
|
adjustPrefetchCacheByteSize(cache, entry.size - previousSize);
|
|
850
|
-
|
|
851
|
-
|
|
876
|
+
const fallbackTtlMs = behavior.fallbackTtlMs ?? PREFETCH_CACHE_TTL;
|
|
877
|
+
const dynamicStaleTime = behavior.searchAgnosticShell === true ? "ignore" : entry.dynamicStaleTime ?? behavior.dynamicStaleTime ?? (behavior.optimisticRouteShell === true ? "ignore" : "verbatim");
|
|
878
|
+
if (dynamicStaleTime === "learning-only" && isStaleTimeSeconds(snapshot.dynamicStaleTimeSeconds)) {
|
|
879
|
+
entry.cacheForNavigation = false;
|
|
880
|
+
entry.expiresAt = entry.timestamp + Math.max(fallbackTtlMs, MIN_PREFETCH_STALE_TIME_MS);
|
|
881
|
+
} else entry.expiresAt = resolvePrefetchedRscResponseExpiresAt(entry.timestamp, entry.snapshot, fallbackTtlMs, dynamicStaleTime === "learning-only" ? "verbatim" : dynamicStaleTime);
|
|
882
|
+
if (behavior.prepareSnapshot && entry.cacheForNavigation && snapshot.redirectHeader === void 0) try {
|
|
852
883
|
const preparedElements = await behavior.prepareSnapshot(snapshot);
|
|
853
884
|
if (cache.get(cacheKey) !== entry) return;
|
|
854
885
|
entry.preparedElements = preparedElements;
|
|
@@ -952,8 +983,12 @@ async function consumePrefetchResponseForNavigation(rscUrl, interceptionContext
|
|
|
952
983
|
if (options?.shouldConsume?.() === false) return null;
|
|
953
984
|
const allowExpiredInFlightHandoff = entry.pending !== void 0;
|
|
954
985
|
if (entry.pending !== void 0) {
|
|
955
|
-
promoteAppPrefetchFetch(entry.fetchPromise);
|
|
956
|
-
|
|
986
|
+
const releaseClaim = promoteAppPrefetchFetch(entry.fetchPromise, options?.shouldConsume);
|
|
987
|
+
try {
|
|
988
|
+
await entry.pending.catch(() => {});
|
|
989
|
+
} finally {
|
|
990
|
+
releaseClaim();
|
|
991
|
+
}
|
|
957
992
|
if (cache.get(cacheKey) !== entry) return null;
|
|
958
993
|
if (options?.shouldConsume?.() === false) return null;
|
|
959
994
|
}
|
|
@@ -1040,14 +1075,31 @@ let _cachedEmptyClientSearchParams = null;
|
|
|
1040
1075
|
* be visible until the next commit.
|
|
1041
1076
|
*/
|
|
1042
1077
|
function getSearchParamsSnapshot() {
|
|
1043
|
-
|
|
1078
|
+
const hasAppContext = getNavigationContext() !== null;
|
|
1044
1079
|
const pagesCtx = getPagesNavigationContext();
|
|
1045
|
-
if (pagesCtx) return getReadonlyPagesSearchParams(pagesCtx.searchParams);
|
|
1046
|
-
const
|
|
1047
|
-
if (
|
|
1080
|
+
if (!hasAppContext && pagesCtx) return getReadonlyPagesSearchParams(pagesCtx.searchParams);
|
|
1081
|
+
const state = getClientNavigationState();
|
|
1082
|
+
if (state) {
|
|
1083
|
+
if (hasAppContext) adoptHydrationSearchParams(state);
|
|
1084
|
+
return state.cachedReadonlySearchParams;
|
|
1085
|
+
}
|
|
1048
1086
|
if (_cachedEmptyClientSearchParams === null) _cachedEmptyClientSearchParams = new ReadonlyURLSearchParams();
|
|
1049
1087
|
return _cachedEmptyClientSearchParams;
|
|
1050
1088
|
}
|
|
1089
|
+
let _comparedHydrationSearchParams = null;
|
|
1090
|
+
/**
|
|
1091
|
+
* Keep the hydrated search params object when the browser URL has the same
|
|
1092
|
+
* query. React compares the two snapshots by identity once hydrated, so a new
|
|
1093
|
+
* object would re-render every useSearchParams() caller and re-run effects
|
|
1094
|
+
* keyed on it, where Next.js keeps one object from the first render.
|
|
1095
|
+
*/
|
|
1096
|
+
function adoptHydrationSearchParams(state) {
|
|
1097
|
+
const hydrated = getServerSearchParamsSnapshot();
|
|
1098
|
+
if (hydrated === state.cachedReadonlySearchParams) return;
|
|
1099
|
+
if (hydrated === _comparedHydrationSearchParams) return;
|
|
1100
|
+
_comparedHydrationSearchParams = hydrated;
|
|
1101
|
+
if (hydrated.toString() === state.cachedReadonlySearchParams.toString()) state.cachedReadonlySearchParams = hydrated;
|
|
1102
|
+
}
|
|
1051
1103
|
function syncCommittedUrlStateFromLocation() {
|
|
1052
1104
|
const state = getClientNavigationState();
|
|
1053
1105
|
if (!state) return false;
|
|
@@ -1635,7 +1687,7 @@ const _appRouter = {
|
|
|
1635
1687
|
const kind = options?.kind === "full" ? "full" : "auto";
|
|
1636
1688
|
const [{ resolveAutoAppRoutePrefetch, resolveFullAppRoutePrefetch }, { resolveAppPrefetchRscRequest }] = await Promise.all([import("./internal/app-route-prefetch-policy.js"), import("./internal/app-prefetch-rsc-request.js")]);
|
|
1637
1689
|
if (setup.cancelled) return;
|
|
1638
|
-
const policy = kind === "full" ? resolveFullAppRoutePrefetch() : resolveAutoAppRoutePrefetch(rewrittenPrefetchHref ?? fullHref);
|
|
1690
|
+
const policy = kind === "full" ? resolveFullAppRoutePrefetch() : resolveAutoAppRoutePrefetch(rewrittenPrefetchHref ?? fullHref, interceptionContext);
|
|
1639
1691
|
const reusable = policy.shouldPrefetch && policy.cacheForNavigation;
|
|
1640
1692
|
const requiresRouteTreePrefetch = policy.requiresRouteTreePrefetch === true;
|
|
1641
1693
|
if (reusable && kind === "full") headers.delete(NEXT_ROUTER_PREFETCH_HEADER);
|
|
@@ -1647,7 +1699,7 @@ const _appRouter = {
|
|
|
1647
1699
|
if (!reusable && kind === "auto") {
|
|
1648
1700
|
headers.set(NEXT_ROUTER_PREFETCH_HEADER, "1");
|
|
1649
1701
|
headers.set(NEXT_ROUTER_SEGMENT_PREFETCH_HEADER, "1");
|
|
1650
|
-
headers.set(VINEXT_RSC_RENDER_MODE_HEADER, hasSearchParams ? APP_RSC_RENDER_MODE_PREFETCH_DYNAMIC_SHELL : APP_RSC_RENDER_MODE_PREFETCH_LOADING_SHELL);
|
|
1702
|
+
headers.set(VINEXT_RSC_RENDER_MODE_HEADER, hasSearchParams && policy.rendersDynamically !== true ? APP_RSC_RENDER_MODE_PREFETCH_DYNAMIC_SHELL : APP_RSC_RENDER_MODE_PREFETCH_LOADING_SHELL);
|
|
1651
1703
|
}
|
|
1652
1704
|
const { additionalRscUrls, rscUrl } = await resolveAppPrefetchRscRequest({
|
|
1653
1705
|
fullHref,
|
|
@@ -1657,15 +1709,17 @@ const _appRouter = {
|
|
|
1657
1709
|
if (setup.cancelled) return;
|
|
1658
1710
|
const cacheKey = AppElementsWire.encodeCacheKey(rscUrl, interceptionContext);
|
|
1659
1711
|
const prefetched = getPrefetchedUrls();
|
|
1712
|
+
if (policy.dynamicStaleTime !== "full-prefetch" && hasFreshLearningOnlyPrefetchCacheEntry(rscUrl, interceptionContext)) {
|
|
1713
|
+
attachPrefetchInvalidationCallback(cacheKey, options?.onInvalidate);
|
|
1714
|
+
return;
|
|
1715
|
+
}
|
|
1660
1716
|
if (reusable) {
|
|
1661
|
-
discardLearningOnlyPrefetchCacheEntry(rscUrl, interceptionContext);
|
|
1717
|
+
discardLearningOnlyPrefetchCacheEntry(rscUrl, interceptionContext, mountedSlotsHeader);
|
|
1662
1718
|
if (hasPrefetchCacheEntryForNavigation(rscUrl, interceptionContext, mountedSlotsHeader, {
|
|
1663
1719
|
additionalRscUrls,
|
|
1664
|
-
onInvalidate: options?.onInvalidate
|
|
1720
|
+
onInvalidate: options?.onInvalidate,
|
|
1721
|
+
onReuse: policy.dynamicStaleTime === "full-prefetch" ? (entry, matchedCacheKey) => promotePrefetchCacheEntryForNavigation(matchedCacheKey, entry) : void 0
|
|
1665
1722
|
})) return;
|
|
1666
|
-
} else if (hasFreshLearningOnlyPrefetchCacheEntry(rscUrl, interceptionContext)) {
|
|
1667
|
-
attachPrefetchInvalidationCallback(cacheKey, options?.onInvalidate);
|
|
1668
|
-
return;
|
|
1669
1723
|
}
|
|
1670
1724
|
prefetched.add(cacheKey);
|
|
1671
1725
|
const fetchFullRscPayload = () => scheduleAppPrefetchFetch((signal) => fetch(rscUrl, {
|
|
@@ -1860,4 +1914,4 @@ if (!isServer) {
|
|
|
1860
1914
|
}
|
|
1861
1915
|
}
|
|
1862
1916
|
//#endregion
|
|
1863
|
-
export { BailoutToCSRError, DYNAMIC_NAVIGATION_CACHE_TTL, DynamicServerError, GLOBAL_ACCESSORS_KEY, HTTP_ERROR_FALLBACK_ERROR_CODE, MAX_PREFETCH_CACHE_SIZE, PREFETCH_CACHE_TTL, ReadonlyURLSearchParams, RedirectType, ServerInsertedHTMLContext, UnrecognizedActionError, __basePath, _registerStateAccessors, activateNavigationSnapshot, appRouterInstance, applyAppRouterScrollFallback, clearPendingPathname, clearServerInsertedHTML, commitClientNavigationState, consumePrefetchResponse, consumePrefetchResponseForNavigation, createAppPrefetchRequestHeaders, createCachedRscResponseSnapshot, createClientNavigationRenderSnapshot, createSnapshotPathAndSearch, decodeRedirectError, deletePrefetchResponseSnapshot, disableNavigationResponsePrefetchCacheReuse, discardLearningOnlyPrefetchCacheEntry, fetchRouteTreeGatedPrefetch, flushServerInsertedHTML, forbidden, getAccessFallbackHTTPStatus, getBfcacheIdMapContext, getBfcacheSegmentIdContext, getClientNavigationRenderContext, getClientNavigationState, getClientParams, getCurrentInterceptionContext, getCurrentNextUrl, getFreshPrefetchCacheEntry, getLayoutSegmentContext, getMountedSlotsHeader, getNavigationContext, getPrefetchCache, getPrefetchInterceptionContext, getPrefetchedUrls, hasFreshLearningOnlyPrefetchCacheEntry, hasPrefetchCacheEntryForNavigation, hasSearchAgnosticPrefetchShellForRoute, invalidatePrefetchCache, isBailoutToCSRError, isDynamicServerError, isHTTPAccessFallbackError, isNextRouterError, isRedirectError, navigateClientSide, notFound, parseRenderedPathAndSearchHeader, peekPrefetchResponseForNavigation, permanentRedirect, prefetchRscResponse, preloadHybridClientRouteOwner, prepareNavigationPrefetchSnapshot, pushHistoryStateWithoutNotify, redirect, renderServerInsertedHTML, replaceClientParamsWithoutNotify, replaceHistoryStateWithoutNotify, resolveCachedRscResponseExpiresAt, resolveCachedRscResponseTtlMs, resolveLoadedHybridClientRewriteHref, resolvePrefetchCacheEntryMountedSlotsHeader, restoreRscResponse, saveScrollPosition, seedPrefetchResponseSnapshot, setClientParams, setMountedSlotsHeader, setNavigationContext, setPendingPathname, snapshotRscResponse, storePrefetchResponse, unauthorized, unstable_isUnrecognizedActionError, unstable_rethrow, useClientNavigationRenderSnapshot, useParams, usePathname, useRouter, useSearchParams, useSelectedLayoutSegment, useSelectedLayoutSegments, useServerInsertedHTML };
|
|
1917
|
+
export { BailoutToCSRError, DYNAMIC_NAVIGATION_CACHE_TTL, DynamicServerError, GLOBAL_ACCESSORS_KEY, HTTP_ERROR_FALLBACK_ERROR_CODE, MAX_PREFETCH_CACHE_SIZE, PREFETCH_CACHE_TTL, ReadonlyURLSearchParams, RedirectType, ServerInsertedHTMLContext, UnrecognizedActionError, __basePath, _registerStateAccessors, activateNavigationSnapshot, appRouterInstance, applyAppRouterScrollFallback, clearPendingPathname, clearServerInsertedHTML, commitClientNavigationState, consumePrefetchResponse, consumePrefetchResponseForNavigation, createAppPrefetchRequestHeaders, createCachedRscResponseSnapshot, createClientNavigationRenderSnapshot, createSnapshotPathAndSearch, decodeRedirectError, deletePrefetchResponseSnapshot, disableNavigationResponsePrefetchCacheReuse, discardLearningOnlyPrefetchCacheEntry, fetchRouteTreeGatedPrefetch, flushServerInsertedHTML, forbidden, getAccessFallbackHTTPStatus, getBfcacheIdMapContext, getBfcacheSegmentIdContext, getClientNavigationRenderContext, getClientNavigationState, getClientParams, getCurrentInterceptionContext, getCurrentNextUrl, getFreshPrefetchCacheEntry, getLayoutSegmentContext, getMountedSlotsHeader, getNavigationContext, getPrefetchCache, getPrefetchInterceptionContext, getPrefetchedUrls, hasFreshLearningOnlyPrefetchCacheEntry, hasPrefetchCacheEntryForNavigation, hasSearchAgnosticPrefetchShellForRoute, invalidatePrefetchCache, isBailoutToCSRError, isDynamicServerError, isHTTPAccessFallbackError, isNextRouterError, isRedirectError, navigateClientSide, notFound, parseRenderedPathAndSearchHeader, peekPrefetchResponseForNavigation, permanentRedirect, prefetchRscResponse, preloadHybridClientRouteOwner, prepareNavigationPrefetchSnapshot, promotePrefetchCacheEntryForNavigation, pushHistoryStateWithoutNotify, redirect, renderServerInsertedHTML, replaceClientParamsWithoutNotify, replaceHistoryStateWithoutNotify, resolveCachedRscResponseExpiresAt, resolveCachedRscResponseTtlMs, resolveLoadedHybridClientRewriteHref, resolvePrefetchCacheEntryMountedSlotsHeader, restoreRscResponse, saveScrollPosition, seedPrefetchResponseSnapshot, setClientParams, setMountedSlotsHeader, setNavigationContext, setPendingPathname, snapshotRscResponse, storePrefetchResponse, unauthorized, unstable_isUnrecognizedActionError, unstable_rethrow, useClientNavigationRenderSnapshot, useParams, usePathname, useRouter, useSearchParams, useSelectedLayoutSegment, useSelectedLayoutSegments, useServerInsertedHTML };
|
|
@@ -29,4 +29,5 @@ export declare function waitForPprFallbackShellCacheReady(state: PprFallbackShel
|
|
|
29
29
|
export declare function preparePprFallbackShellFinalRender(state: PprFallbackShellState): void;
|
|
30
30
|
export declare function beginPprFallbackShellFinalRender(state: PprFallbackShellState): void;
|
|
31
31
|
export declare function isPprFallbackShellAbortError(error: unknown): boolean;
|
|
32
|
-
//#endregion
|
|
32
|
+
//#endregion
|
|
33
|
+
export {};
|
package/dist/shims/router.js
CHANGED
|
@@ -1006,15 +1006,26 @@ function getClientConfigRouteContext(href) {
|
|
|
1006
1006
|
search: parsed.search
|
|
1007
1007
|
};
|
|
1008
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
|
+
}
|
|
1009
1020
|
async function resolveClientConfigRedirect(href) {
|
|
1010
1021
|
const redirects = window.__VINEXT_CLIENT_REDIRECTS__;
|
|
1011
1022
|
if (!redirects || redirects.length === 0) return null;
|
|
1012
1023
|
const routeContext = getClientConfigRouteContext(href);
|
|
1013
1024
|
if (!routeContext) return null;
|
|
1014
|
-
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")]);
|
|
1015
1026
|
const redirect = matchClientRedirect(routeContext.pathname, redirects, routeContext.context, routeContext.basePathState);
|
|
1016
1027
|
if (!redirect) return null;
|
|
1017
|
-
return preserveRedirectDestinationQuery(
|
|
1028
|
+
return encodeRedirectLocation(preserveRedirectDestinationQuery(redirect.destination, routeContext.search, redirect.destinationQuery));
|
|
1018
1029
|
}
|
|
1019
1030
|
async function applyClientConfigRewrite(href, rewrite) {
|
|
1020
1031
|
const routeContext = getClientConfigRouteContext(href);
|
|
@@ -1569,7 +1580,7 @@ async function navigateClient(url, fetchUrl = url, options = {}, routeUrl = url)
|
|
|
1569
1580
|
const routeMasked = options.routeMasked ?? routeUrl !== url;
|
|
1570
1581
|
const configRedirect = hasClientRedirectRules() && clientConfigRedirectCouldMatch(browserUrl) ? await resolveClientConfigRedirect(browserUrl) : null;
|
|
1571
1582
|
if (configRedirect) {
|
|
1572
|
-
const redirectedUrl = resolveLocalRedirectUrl(configRedirect);
|
|
1583
|
+
const redirectedUrl = configRedirectLeavesBasePath(configRedirect) ? null : resolveLocalRedirectUrl(configRedirect);
|
|
1573
1584
|
if (!redirectedUrl) scheduleHardNavigationAndThrow(configRedirect, "Navigation redirected externally");
|
|
1574
1585
|
throw new InternalNavigationRedirect(redirectedUrl);
|
|
1575
1586
|
}
|
|
@@ -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;
|
|
@@ -161,9 +162,8 @@ function closeAfterResponseWithBody(response, ctx) {
|
|
|
161
162
|
return response;
|
|
162
163
|
}
|
|
163
164
|
if (isFullyBufferedBody(response) && !requiresResponseCloseTracking(ctx)) return response;
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
const wrapped = new Response(passthrough.readable, {
|
|
165
|
+
const body = deferUntilStreamConsumed(response.body, () => void closeAfterResponse(ctx));
|
|
166
|
+
const wrapped = new Response(body, {
|
|
167
167
|
status: response.status,
|
|
168
168
|
statusText: response.statusText,
|
|
169
169
|
headers: response.headers
|
package/dist/typegen.d.ts
CHANGED
|
@@ -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 {};
|
|
@@ -42,7 +42,7 @@ function findPagesClientEntryFileFromManifest(buildManifest, assetBase) {
|
|
|
42
42
|
}
|
|
43
43
|
function findEntryFileFromManifest(buildManifest, assetBase, markers, fallbackToFirstEntry) {
|
|
44
44
|
const entries = Object.entries(buildManifest).filter(([, entry]) => entry.isEntry && entry.file);
|
|
45
|
-
const matchers = [
|
|
45
|
+
const matchers = [matchesEntryIdentity, (marker, _key, entry) => entry.file.includes(marker)];
|
|
46
46
|
for (const matches of matchers) for (const marker of markers) {
|
|
47
47
|
const markedEntry = entries.find(([key, entry]) => matches(marker, key, entry));
|
|
48
48
|
if (markedEntry) return manifestFileWithBase(markedEntry[1].file, assetBase);
|
|
@@ -50,6 +50,13 @@ function findEntryFileFromManifest(buildManifest, assetBase, markers, fallbackTo
|
|
|
50
50
|
const chosen = fallbackToFirstEntry ? entries[0]?.[1] : void 0;
|
|
51
51
|
return chosen ? manifestFileWithBase(chosen.file, assetBase) : void 0;
|
|
52
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
|
+
}
|
|
53
60
|
function isVirtualEntryId(id, marker) {
|
|
54
61
|
const virtualId = `virtual:${marker}`;
|
|
55
62
|
return id === virtualId || id.endsWith(`/${virtualId}`);
|
|
@@ -92,4 +99,4 @@ function readStringArray(value) {
|
|
|
92
99
|
return Array.isArray(value) && value.every((item) => typeof item === "string") ? value : void 0;
|
|
93
100
|
}
|
|
94
101
|
//#endregion
|
|
95
|
-
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 };
|