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/image.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { getDeploymentId } from "../utils/deployment-id.js";
|
|
3
2
|
import { useMergedRef } from "./use-merged-ref.js";
|
|
4
|
-
import {
|
|
3
|
+
import { RESPONSIVE_WIDTHS, __dangerouslyAllowSVG, __globallyUnoptimized, __isDev, generateImageAttributes, getFillStyle, getImageProps, imageOptimizationUrl, isRemoteUrl, isSvgUrl, resolveImageSource, sanitizeBlurDataURL, validateRemoteUrl } from "./image-props.js";
|
|
5
4
|
import { forwardRef, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
6
5
|
import { jsx } from "react/jsx-runtime";
|
|
7
6
|
import * as ReactDOM from "react-dom";
|
|
@@ -18,108 +17,11 @@ import { Image as Image$1 } from "@unpic/react";
|
|
|
18
17
|
* Remote images are validated against `images.remotePatterns` and
|
|
19
18
|
* `images.domains` from next.config.js. Unmatched URLs are blocked
|
|
20
19
|
* in production and warn in development, matching Next.js behavior.
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* Image config injected at build time via Vite define.
|
|
24
|
-
* Serialized as JSON — parsed once at module level.
|
|
25
|
-
*/
|
|
26
|
-
const __imageRemotePatterns = (() => {
|
|
27
|
-
try {
|
|
28
|
-
return JSON.parse(process.env.__VINEXT_IMAGE_REMOTE_PATTERNS ?? "[]");
|
|
29
|
-
} catch {
|
|
30
|
-
return [];
|
|
31
|
-
}
|
|
32
|
-
})();
|
|
33
|
-
const __imageDomains = (() => {
|
|
34
|
-
try {
|
|
35
|
-
return JSON.parse(process.env.__VINEXT_IMAGE_DOMAINS ?? "[]");
|
|
36
|
-
} catch {
|
|
37
|
-
return [];
|
|
38
|
-
}
|
|
39
|
-
})();
|
|
40
|
-
const __hasImageConfig = __imageRemotePatterns.length > 0 || __imageDomains.length > 0;
|
|
41
|
-
const __isDev = process.env.NODE_ENV !== "production";
|
|
42
|
-
const __imageDeviceSizes = (() => {
|
|
43
|
-
try {
|
|
44
|
-
return JSON.parse(process.env.__VINEXT_IMAGE_DEVICE_SIZES ?? "[640,750,828,1080,1200,1920,2048,3840]");
|
|
45
|
-
} catch {
|
|
46
|
-
return [
|
|
47
|
-
640,
|
|
48
|
-
750,
|
|
49
|
-
828,
|
|
50
|
-
1080,
|
|
51
|
-
1200,
|
|
52
|
-
1920,
|
|
53
|
-
2048,
|
|
54
|
-
3840
|
|
55
|
-
];
|
|
56
|
-
}
|
|
57
|
-
})();
|
|
58
|
-
const __imageSizes = (() => {
|
|
59
|
-
try {
|
|
60
|
-
return JSON.parse(process.env.__VINEXT_IMAGE_SIZES ?? "[32,48,64,96,128,256,384]");
|
|
61
|
-
} catch {
|
|
62
|
-
return [
|
|
63
|
-
32,
|
|
64
|
-
48,
|
|
65
|
-
64,
|
|
66
|
-
96,
|
|
67
|
-
128,
|
|
68
|
-
256,
|
|
69
|
-
384
|
|
70
|
-
];
|
|
71
|
-
}
|
|
72
|
-
})();
|
|
73
|
-
/**
|
|
74
|
-
* Whether dangerouslyAllowSVG is enabled in next.config.js.
|
|
75
|
-
* When false (default), .svg sources auto-skip the optimization endpoint
|
|
76
|
-
* and are served directly, matching Next.js behavior.
|
|
77
|
-
* When true, .svg sources are routed through the optimizer (served as-is
|
|
78
|
-
* with security headers).
|
|
79
|
-
*/
|
|
80
|
-
const __dangerouslyAllowSVG = process.env.__VINEXT_IMAGE_DANGEROUSLY_ALLOW_SVG === "true";
|
|
81
|
-
/**
|
|
82
|
-
* Whether dangerouslyAllowLocalIP is enabled in next.config.js.
|
|
83
|
-
* When false (default), remote image URLs with literal private-IP hostnames
|
|
84
|
-
* are blocked to mitigate SSRF risk.
|
|
85
|
-
*/
|
|
86
|
-
const __dangerouslyAllowLocalIP = process.env.__VINEXT_IMAGE_DANGEROUSLY_ALLOW_LOCAL_IP === "true";
|
|
87
|
-
const __globallyUnoptimized = process.env.__VINEXT_IMAGE_UNOPTIMIZED === "true";
|
|
88
|
-
/**
|
|
89
|
-
* Validate that a remote URL is allowed by the configured remote patterns.
|
|
90
|
-
* Returns true if the URL is allowed, false otherwise.
|
|
91
|
-
*
|
|
92
|
-
* When no remotePatterns/domains are configured, all remote URLs are allowed
|
|
93
|
-
* (backwards-compatible — user hasn't opted into restriction).
|
|
94
|
-
*
|
|
95
|
-
* When patterns ARE configured, only matching URLs are allowed.
|
|
96
|
-
* In development, non-matching URLs produce a console warning.
|
|
97
|
-
* In production, non-matching URLs are blocked (src replaced with empty string).
|
|
98
20
|
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
21
|
+
* Prop building lives in the server-safe `image-props.ts`. In the RSC
|
|
22
|
+
* environment, next/image resolves to a server entry that exports
|
|
23
|
+
* `getImageProps` from there and this module's Image as a client reference.
|
|
101
24
|
*/
|
|
102
|
-
function validateRemoteUrl(src) {
|
|
103
|
-
let url;
|
|
104
|
-
try {
|
|
105
|
-
url = new URL(src, "http://n");
|
|
106
|
-
} catch {
|
|
107
|
-
return {
|
|
108
|
-
allowed: false,
|
|
109
|
-
reason: `Invalid URL: ${src}`
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
if (!__dangerouslyAllowLocalIP && isPrivateIp(url.hostname)) return {
|
|
113
|
-
allowed: false,
|
|
114
|
-
reason: `Image URL "${src}" resolved to private IP. If this is expected and you understand SSRF risk, use images.dangerouslyAllowLocalIP = true to continue.`
|
|
115
|
-
};
|
|
116
|
-
if (!__hasImageConfig) return { allowed: true };
|
|
117
|
-
if (hasRemoteMatch(__imageDomains, __imageRemotePatterns, url)) return { allowed: true };
|
|
118
|
-
return {
|
|
119
|
-
allowed: false,
|
|
120
|
-
reason: `Image URL "${src}" is not configured in images.remotePatterns or images.domains in next.config.js. See: https://nextjs.org/docs/messages/next-image-unconfigured-host`
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
25
|
/**
|
|
124
26
|
* A version of useLayoutEffect that doesn't warn during SSR.
|
|
125
27
|
* Do not rename this to "isomorphic layout effect". There is no such thing as
|
|
@@ -167,110 +69,6 @@ function createSyntheticLoadEvent(img) {
|
|
|
167
69
|
}
|
|
168
70
|
};
|
|
169
71
|
}
|
|
170
|
-
/**
|
|
171
|
-
* Sanitize a blurDataURL to prevent CSS injection.
|
|
172
|
-
*
|
|
173
|
-
* A crafted data URL containing `)` can break out of the `url()` CSS function,
|
|
174
|
-
* allowing injection of arbitrary CSS properties or rules. Characters like `{`,
|
|
175
|
-
* `}`, and `\` can also assist in crafting injection payloads.
|
|
176
|
-
*
|
|
177
|
-
* This validates the URL starts with `data:image/` and rejects characters that
|
|
178
|
-
* could escape the `url()` context. Semicolons are allowed since they're part
|
|
179
|
-
* of valid data URLs (`data:image/png;base64,...`) and harmless inside `url()`.
|
|
180
|
-
*
|
|
181
|
-
* Returns undefined for invalid URLs, which causes the blur placeholder to be
|
|
182
|
-
* skipped gracefully.
|
|
183
|
-
*/
|
|
184
|
-
function sanitizeBlurDataURL(url) {
|
|
185
|
-
if (!url.startsWith("data:image/")) return void 0;
|
|
186
|
-
if (/[)(}{\\'"\n\r]/.test(url)) return void 0;
|
|
187
|
-
return url;
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Determine if a src is a remote URL (CDN-optimizable) or local.
|
|
191
|
-
*/
|
|
192
|
-
function isRemoteUrl(src) {
|
|
193
|
-
return src.startsWith("http://") || src.startsWith("https://") || src.startsWith("//");
|
|
194
|
-
}
|
|
195
|
-
function isSvgUrl(src) {
|
|
196
|
-
try {
|
|
197
|
-
return new URL(src, "http://vinext.local").pathname.toLowerCase().endsWith(".svg");
|
|
198
|
-
} catch {
|
|
199
|
-
return false;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
function getFillStyle(style, backgroundStyle) {
|
|
203
|
-
return {
|
|
204
|
-
position: "absolute",
|
|
205
|
-
inset: 0,
|
|
206
|
-
width: "100%",
|
|
207
|
-
height: "100%",
|
|
208
|
-
objectFit: "cover",
|
|
209
|
-
...backgroundStyle,
|
|
210
|
-
...style
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Resolve src, width, height, blurDataURL from Image props (string or StaticImageData).
|
|
215
|
-
* Shared by the Image component and getImageProps to keep behavior in sync.
|
|
216
|
-
*/
|
|
217
|
-
function resolveImageSource(v) {
|
|
218
|
-
const staticData = typeof v.src === "object" && "default" in v.src ? v.src.default : v.src;
|
|
219
|
-
const src = typeof staticData === "string" ? staticData : staticData.src;
|
|
220
|
-
const sourceWidth = v.width ?? (typeof staticData === "object" ? staticData.width : void 0);
|
|
221
|
-
const sourceHeight = v.height ?? (typeof staticData === "object" ? staticData.height : void 0);
|
|
222
|
-
return {
|
|
223
|
-
src,
|
|
224
|
-
width: typeof sourceWidth === "string" ? Number(sourceWidth) : sourceWidth,
|
|
225
|
-
height: typeof sourceHeight === "string" ? Number(sourceHeight) : sourceHeight,
|
|
226
|
-
blurDataURL: v.blurDataURL ?? (typeof staticData === "object" ? staticData.blurDataURL : void 0)
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Responsive image widths matching Next.js's device sizes config.
|
|
231
|
-
* These are the breakpoints used for srcSet generation.
|
|
232
|
-
* Configurable via `images.deviceSizes` in next.config.js.
|
|
233
|
-
*/
|
|
234
|
-
const RESPONSIVE_WIDTHS = [...__imageDeviceSizes].sort((left, right) => left - right);
|
|
235
|
-
const ALL_IMAGE_WIDTHS = [...RESPONSIVE_WIDTHS, ...__imageSizes].sort((left, right) => left - right);
|
|
236
|
-
function extractLocalDeploymentId(src) {
|
|
237
|
-
let deploymentId = getDeploymentId();
|
|
238
|
-
if (!src.startsWith("/") || src.startsWith("//")) return {
|
|
239
|
-
src,
|
|
240
|
-
deploymentId
|
|
241
|
-
};
|
|
242
|
-
const queryIndex = src.indexOf("?");
|
|
243
|
-
if (queryIndex === -1) return {
|
|
244
|
-
src,
|
|
245
|
-
deploymentId
|
|
246
|
-
};
|
|
247
|
-
const params = new URLSearchParams(src.slice(queryIndex + 1));
|
|
248
|
-
const sourceDeploymentId = params.get("dpl");
|
|
249
|
-
if (!sourceDeploymentId) return {
|
|
250
|
-
src,
|
|
251
|
-
deploymentId
|
|
252
|
-
};
|
|
253
|
-
deploymentId = sourceDeploymentId;
|
|
254
|
-
params.delete("dpl");
|
|
255
|
-
const remainingQuery = params.toString();
|
|
256
|
-
return {
|
|
257
|
-
src: src.slice(0, queryIndex) + (remainingQuery ? `?${remainingQuery}` : ""),
|
|
258
|
-
deploymentId
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
const __imageEndpoint = `${process.env.__NEXT_ROUTER_BASEPATH ?? ""}/_next/image${process.env.__VINEXT_TRAILING_SLASH === "true" ? "/" : ""}`;
|
|
262
|
-
/**
|
|
263
|
-
* Build a `/_next/image` optimization URL.
|
|
264
|
-
*
|
|
265
|
-
* In production (Cloudflare Workers), the worker intercepts this path and uses
|
|
266
|
-
* the Images binding to resize/transcode on the fly. In dev, the Vite dev
|
|
267
|
-
* server handles it as a passthrough (serves the original file).
|
|
268
|
-
*/
|
|
269
|
-
function imageOptimizationUrl(src, width, quality = 75) {
|
|
270
|
-
const source = extractLocalDeploymentId(src);
|
|
271
|
-
const deploymentQuery = source.src.startsWith("/") && source.deploymentId ? `&dpl=${source.deploymentId}` : "";
|
|
272
|
-
return `${__imageEndpoint}?url=${encodeURIComponent(source.src)}&w=${width}&q=${quality}${deploymentQuery}`;
|
|
273
|
-
}
|
|
274
72
|
function preloadImageResource(input) {
|
|
275
73
|
if (!input.shouldPreload) return;
|
|
276
74
|
if (typeof ReactDOM.preload !== "function") return;
|
|
@@ -281,31 +79,6 @@ function preloadImageResource(input) {
|
|
|
281
79
|
fetchPriority: input.fetchPriority
|
|
282
80
|
});
|
|
283
81
|
}
|
|
284
|
-
/**
|
|
285
|
-
* Generate a srcSet string for responsive images.
|
|
286
|
-
*
|
|
287
|
-
* Each width points to the `/_next/image` optimization endpoint so the
|
|
288
|
-
* server can resize and transcode the image.
|
|
289
|
-
*/
|
|
290
|
-
function getImageWidths(width) {
|
|
291
|
-
return [...new Set([width, width * 2].map((targetWidth) => ALL_IMAGE_WIDTHS.find((configuredWidth) => configuredWidth >= targetWidth) ?? ALL_IMAGE_WIDTHS[ALL_IMAGE_WIDTHS.length - 1]))];
|
|
292
|
-
}
|
|
293
|
-
function generateImageAttributes(src, width, quality = 75, sizes) {
|
|
294
|
-
if (sizes) {
|
|
295
|
-
const viewportPercentages = Array.from(sizes.matchAll(/(^|\s)(1?\d?\d)vw/g), (match) => Number.parseInt(match[2], 10));
|
|
296
|
-
const minimumWidth = viewportPercentages.length > 0 ? RESPONSIVE_WIDTHS[0] * (Math.min(...viewportPercentages) * .01) : 0;
|
|
297
|
-
const candidates = ALL_IMAGE_WIDTHS.filter((candidateWidth) => candidateWidth >= minimumWidth);
|
|
298
|
-
return {
|
|
299
|
-
src: imageOptimizationUrl(src, candidates[candidates.length - 1], quality),
|
|
300
|
-
srcSet: candidates.map((candidateWidth) => `${imageOptimizationUrl(src, candidateWidth, quality)} ${candidateWidth}w`).join(", ")
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
const widths = getImageWidths(width);
|
|
304
|
-
return {
|
|
305
|
-
src: imageOptimizationUrl(src, widths[widths.length - 1], quality),
|
|
306
|
-
srcSet: widths.map((candidateWidth, index) => `${imageOptimizationUrl(src, candidateWidth, quality)} ${index + 1}x`).join(", ")
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
82
|
const Image = forwardRef(function Image({ src: srcProp, alt, width, height, fill, preload, priority, quality, placeholder, blurDataURL, loader, sizes, className, style, onLoad, onLoadingComplete, onError, unoptimized: _unoptimized, overrideSrc, loading, ...rest }, ref) {
|
|
310
83
|
const lastLoadedSrcRef = useRef(void 0);
|
|
311
84
|
const lastErrorSrcRef = useRef(void 0);
|
|
@@ -562,93 +335,5 @@ const Image = forwardRef(function Image({ src: srcProp, alt, width, height, fill
|
|
|
562
335
|
...rest
|
|
563
336
|
});
|
|
564
337
|
});
|
|
565
|
-
/**
|
|
566
|
-
* getImageProps — for advanced use cases (picture elements, background images).
|
|
567
|
-
* Returns the props that would be passed to the underlying <img> element.
|
|
568
|
-
*/
|
|
569
|
-
function getImageProps(props) {
|
|
570
|
-
const { src: srcProp, alt, width, height, fill, preload: _preload, priority, quality: _quality, placeholder, blurDataURL: blurDataURLProp, loader, sizes, className, style, onLoad: _onLoad, onLoadingComplete: _onLoadingComplete, unoptimized: _unoptimized, overrideSrc, loading, ...rest } = props;
|
|
571
|
-
const { src, width: imgWidth, height: imgHeight, blurDataURL: imgBlurDataURL } = resolveImageSource({
|
|
572
|
-
src: srcProp,
|
|
573
|
-
width,
|
|
574
|
-
height,
|
|
575
|
-
blurDataURL: blurDataURLProp
|
|
576
|
-
});
|
|
577
|
-
const shouldPreload = _preload === true || priority === true;
|
|
578
|
-
if (_unoptimized === true || __globallyUnoptimized) {
|
|
579
|
-
const renderedSrc = overrideSrc || src;
|
|
580
|
-
const sanitizedBlurURL = imgBlurDataURL ? sanitizeBlurDataURL(imgBlurDataURL) : void 0;
|
|
581
|
-
const blurStyle = placeholder === "blur" && sanitizedBlurURL ? {
|
|
582
|
-
backgroundImage: `url(${sanitizedBlurURL})`,
|
|
583
|
-
backgroundSize: "cover",
|
|
584
|
-
backgroundRepeat: "no-repeat",
|
|
585
|
-
backgroundPosition: "center"
|
|
586
|
-
} : void 0;
|
|
587
|
-
const imageProps = {
|
|
588
|
-
src: renderedSrc,
|
|
589
|
-
alt,
|
|
590
|
-
width: fill ? void 0 : imgWidth,
|
|
591
|
-
height: fill ? void 0 : imgHeight,
|
|
592
|
-
loading: priority ? "eager" : shouldPreload ? loading : loading ?? "lazy",
|
|
593
|
-
fetchPriority: priority ? "high" : void 0,
|
|
594
|
-
decoding: "async",
|
|
595
|
-
className,
|
|
596
|
-
style: fill ? getFillStyle(style, blurStyle) : {
|
|
597
|
-
...blurStyle,
|
|
598
|
-
...style
|
|
599
|
-
},
|
|
600
|
-
...rest,
|
|
601
|
-
sizes: sizes ?? (fill ? "100vw" : void 0),
|
|
602
|
-
srcSet: void 0
|
|
603
|
-
};
|
|
604
|
-
return { props: Object.assign(imageProps, { "data-nimg": fill ? "fill" : "1" }) };
|
|
605
|
-
}
|
|
606
|
-
let blockedInProd = false;
|
|
607
|
-
if (isRemoteUrl(src)) {
|
|
608
|
-
const validation = validateRemoteUrl(src);
|
|
609
|
-
if (!validation.allowed) {
|
|
610
|
-
if (__isDev) console.warn(`[next/image] ${validation.reason}`);
|
|
611
|
-
else {
|
|
612
|
-
console.error(`[next/image] ${validation.reason}`);
|
|
613
|
-
blockedInProd = true;
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
const imgQuality = typeof _quality === "string" ? Number(_quality) : _quality ?? 75;
|
|
618
|
-
const resolvedSrc = blockedInProd ? "" : loader ? loader({
|
|
619
|
-
src,
|
|
620
|
-
width: imgWidth ?? 0,
|
|
621
|
-
quality: imgQuality
|
|
622
|
-
}) : src;
|
|
623
|
-
const skipOpt = isSvgUrl(resolvedSrc) && !__dangerouslyAllowSVG || blockedInProd || !!loader || isRemoteUrl(resolvedSrc);
|
|
624
|
-
const optimizedAttributes = imgWidth && !fill && !skipOpt ? generateImageAttributes(resolvedSrc, imgWidth, imgQuality, sizes) : null;
|
|
625
|
-
const optimizedSrc = skipOpt ? resolvedSrc : optimizedAttributes ? optimizedAttributes.src : imageOptimizationUrl(resolvedSrc, RESPONSIVE_WIDTHS[0], imgQuality);
|
|
626
|
-
const srcSet = optimizedAttributes?.srcSet;
|
|
627
|
-
const sanitizedBlurURL = imgBlurDataURL ? sanitizeBlurDataURL(imgBlurDataURL) : void 0;
|
|
628
|
-
const blurStyle = placeholder === "blur" && sanitizedBlurURL ? {
|
|
629
|
-
backgroundImage: `url(${sanitizedBlurURL})`,
|
|
630
|
-
backgroundSize: "cover",
|
|
631
|
-
backgroundRepeat: "no-repeat",
|
|
632
|
-
backgroundPosition: "center"
|
|
633
|
-
} : void 0;
|
|
634
|
-
const imageProps = {
|
|
635
|
-
src: optimizedSrc,
|
|
636
|
-
alt,
|
|
637
|
-
width: fill ? void 0 : imgWidth,
|
|
638
|
-
height: fill ? void 0 : imgHeight,
|
|
639
|
-
loading: priority ? "eager" : shouldPreload ? loading : loading ?? "lazy",
|
|
640
|
-
fetchPriority: priority ? "high" : void 0,
|
|
641
|
-
decoding: "async",
|
|
642
|
-
srcSet,
|
|
643
|
-
sizes: sizes ?? (fill ? "100vw" : void 0),
|
|
644
|
-
className,
|
|
645
|
-
style: fill ? getFillStyle(style, blurStyle) : {
|
|
646
|
-
...blurStyle,
|
|
647
|
-
...style
|
|
648
|
-
},
|
|
649
|
-
...rest
|
|
650
|
-
};
|
|
651
|
-
return { props: Object.assign(imageProps, { "data-nimg": fill ? "fill" : "1" }) };
|
|
652
|
-
}
|
|
653
338
|
//#endregion
|
|
654
339
|
export { Image as default, getImageProps, imageOptimizationUrl };
|
|
@@ -4,8 +4,14 @@ export declare function releaseAppPrefetchFetchSlot(response: Response): void;
|
|
|
4
4
|
* Low-priority App Router prefetches share a small request queue. The consumer
|
|
5
5
|
* must either snapshot the returned Response with snapshotRscResponse() or call
|
|
6
6
|
* releaseAppPrefetchFetchSlot() when it drops the response without consuming it.
|
|
7
|
+
*
|
|
8
|
+
* `isWanted` is checked when a queued request reaches a free slot. Returning
|
|
9
|
+
* false drops it without fetching, like a cancelled Next.js prefetch task. A
|
|
10
|
+
* navigation that promotes the request skips the check.
|
|
7
11
|
*/
|
|
8
|
-
export declare function scheduleAppPrefetchFetch(fetcher: (signal: AbortSignal) => Promise<Response>, priority: "low" | "high"): Promise<Response>;
|
|
12
|
+
export declare function scheduleAppPrefetchFetch(fetcher: (signal: AbortSignal) => Promise<Response>, priority: "low" | "high", isWanted?: () => boolean): Promise<Response>;
|
|
13
|
+
/** Cancel a prefetch request that is still waiting for a slot; never aborts one in flight. */
|
|
14
|
+
export declare function cancelQueuedAppPrefetchFetch(promise: Promise<Response>): void;
|
|
9
15
|
/** Cancel a queued or in-flight prefetch request. No-op once it has settled. */
|
|
10
16
|
export declare function cancelAppPrefetchFetch(promise: Promise<Response> | undefined): void;
|
|
11
17
|
/**
|
|
@@ -19,6 +25,20 @@ export declare function cancelAppPrefetchFetch(promise: Promise<Response> | unde
|
|
|
19
25
|
* cap instead of waiting for a slot.
|
|
20
26
|
*
|
|
21
27
|
* No-op when the request has already started or was never queued.
|
|
28
|
+
*
|
|
29
|
+
* Also records a claim, live while `isCurrent` returns true, until the returned
|
|
30
|
+
* function releases it; see `isAppPrefetchFetchClaimed`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function promoteAppPrefetchFetch(promise: Promise<Response> | undefined, isCurrent?: () => boolean): () => void;
|
|
33
|
+
/**
|
|
34
|
+
* Whether a current navigation is waiting on this prefetch. A staged prefetch
|
|
35
|
+
* (route tree, then payload) hands navigation a promise that wraps its queued
|
|
36
|
+
* requests, so promotion cannot reach them; they check this instead before
|
|
37
|
+
* dropping themselves.
|
|
38
|
+
*
|
|
39
|
+
* `claimedBy` limits this to claims made up to that `getAppPrefetchFetchClaimSequence()`.
|
|
22
40
|
*/
|
|
23
|
-
export declare function
|
|
41
|
+
export declare function isAppPrefetchFetchClaimed(promise: Promise<Response> | undefined, claimedBy?: number): boolean;
|
|
42
|
+
/** The sequence number of the latest claim on any prefetch. */
|
|
43
|
+
export declare function getAppPrefetchFetchClaimSequence(): number;
|
|
24
44
|
//#endregion
|
|
@@ -5,6 +5,12 @@ const MAX_DEFAULT_APP_PREFETCH_REQUESTS = 4;
|
|
|
5
5
|
const defaultAppPrefetchQueue = [];
|
|
6
6
|
/** Lets a consumer promote or cancel the request behind a promise it already holds. */
|
|
7
7
|
const appPrefetchFetchControls = /* @__PURE__ */ new WeakMap();
|
|
8
|
+
/**
|
|
9
|
+
* Navigations waiting on a promise, each live while it is current, with the
|
|
10
|
+
* sequence number it was claimed at.
|
|
11
|
+
*/
|
|
12
|
+
const appPrefetchFetchClaims = /* @__PURE__ */ new WeakMap();
|
|
13
|
+
let appPrefetchFetchClaimSequence = 0;
|
|
8
14
|
let activeDefaultAppPrefetchRequests = 0;
|
|
9
15
|
let defaultAppPrefetchDrainScheduled = false;
|
|
10
16
|
function drainDefaultAppPrefetchQueue() {
|
|
@@ -31,8 +37,12 @@ function releaseAppPrefetchFetchSlot(response) {
|
|
|
31
37
|
* Low-priority App Router prefetches share a small request queue. The consumer
|
|
32
38
|
* must either snapshot the returned Response with snapshotRscResponse() or call
|
|
33
39
|
* releaseAppPrefetchFetchSlot() when it drops the response without consuming it.
|
|
40
|
+
*
|
|
41
|
+
* `isWanted` is checked when a queued request reaches a free slot. Returning
|
|
42
|
+
* false drops it without fetching, like a cancelled Next.js prefetch task. A
|
|
43
|
+
* navigation that promotes the request skips the check.
|
|
34
44
|
*/
|
|
35
|
-
function scheduleAppPrefetchFetch(fetcher, priority) {
|
|
45
|
+
function scheduleAppPrefetchFetch(fetcher, priority, isWanted) {
|
|
36
46
|
const controller = new AbortController();
|
|
37
47
|
if (priority === "high") {
|
|
38
48
|
const promise = fetcher(controller.signal);
|
|
@@ -47,7 +57,13 @@ function scheduleAppPrefetchFetch(fetcher, priority) {
|
|
|
47
57
|
let started = false;
|
|
48
58
|
const promise = new Promise((resolve, reject) => {
|
|
49
59
|
rejectPromise = reject;
|
|
50
|
-
runner = () => {
|
|
60
|
+
runner = (promoted = false) => {
|
|
61
|
+
if (!promoted && isWanted?.() === false) {
|
|
62
|
+
appPrefetchFetchControls.delete(promise);
|
|
63
|
+
activeDefaultAppPrefetchRequests -= 1;
|
|
64
|
+
reject(new DOMException("Prefetch is no longer wanted", "AbortError"));
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
51
67
|
started = true;
|
|
52
68
|
let didRelease = false;
|
|
53
69
|
const release = () => {
|
|
@@ -73,25 +89,31 @@ function scheduleAppPrefetchFetch(fetcher, priority) {
|
|
|
73
89
|
}
|
|
74
90
|
};
|
|
75
91
|
});
|
|
92
|
+
const cancelQueued = () => {
|
|
93
|
+
if (started) return;
|
|
94
|
+
const index = defaultAppPrefetchQueue.indexOf(runner);
|
|
95
|
+
if (index === -1) return;
|
|
96
|
+
defaultAppPrefetchQueue.splice(index, 1);
|
|
97
|
+
appPrefetchFetchControls.delete(promise);
|
|
98
|
+
controller.abort();
|
|
99
|
+
rejectPromise(controller.signal.reason);
|
|
100
|
+
};
|
|
76
101
|
defaultAppPrefetchQueue.push(runner);
|
|
77
102
|
appPrefetchFetchControls.set(promise, {
|
|
78
103
|
runner,
|
|
104
|
+
cancelQueued,
|
|
79
105
|
cancel: () => {
|
|
80
|
-
if (started)
|
|
81
|
-
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
const index = defaultAppPrefetchQueue.indexOf(runner);
|
|
85
|
-
if (index === -1) return;
|
|
86
|
-
defaultAppPrefetchQueue.splice(index, 1);
|
|
87
|
-
appPrefetchFetchControls.delete(promise);
|
|
88
|
-
controller.abort();
|
|
89
|
-
rejectPromise(controller.signal.reason);
|
|
106
|
+
if (started) controller.abort();
|
|
107
|
+
else cancelQueued();
|
|
90
108
|
}
|
|
91
109
|
});
|
|
92
110
|
scheduleDefaultAppPrefetchDrain();
|
|
93
111
|
return promise;
|
|
94
112
|
}
|
|
113
|
+
/** Cancel a prefetch request that is still waiting for a slot; never aborts one in flight. */
|
|
114
|
+
function cancelQueuedAppPrefetchFetch(promise) {
|
|
115
|
+
appPrefetchFetchControls.get(promise)?.cancelQueued?.();
|
|
116
|
+
}
|
|
95
117
|
/** Cancel a queued or in-flight prefetch request. No-op once it has settled. */
|
|
96
118
|
function cancelAppPrefetchFetch(promise) {
|
|
97
119
|
if (promise === void 0) return;
|
|
@@ -108,16 +130,47 @@ function cancelAppPrefetchFetch(promise) {
|
|
|
108
130
|
* cap instead of waiting for a slot.
|
|
109
131
|
*
|
|
110
132
|
* No-op when the request has already started or was never queued.
|
|
133
|
+
*
|
|
134
|
+
* Also records a claim, live while `isCurrent` returns true, until the returned
|
|
135
|
+
* function releases it; see `isAppPrefetchFetchClaimed`.
|
|
111
136
|
*/
|
|
112
|
-
function promoteAppPrefetchFetch(promise) {
|
|
113
|
-
if (promise === void 0) return;
|
|
137
|
+
function promoteAppPrefetchFetch(promise, isCurrent = () => true) {
|
|
138
|
+
if (promise === void 0) return () => {};
|
|
139
|
+
let claims = appPrefetchFetchClaims.get(promise);
|
|
140
|
+
if (claims === void 0) {
|
|
141
|
+
claims = /* @__PURE__ */ new Map();
|
|
142
|
+
appPrefetchFetchClaims.set(promise, claims);
|
|
143
|
+
}
|
|
144
|
+
claims.set(isCurrent, ++appPrefetchFetchClaimSequence);
|
|
145
|
+
const release = () => {
|
|
146
|
+
claims.delete(isCurrent);
|
|
147
|
+
};
|
|
114
148
|
const runner = appPrefetchFetchControls.get(promise)?.runner;
|
|
115
|
-
if (runner === void 0) return;
|
|
149
|
+
if (runner === void 0) return release;
|
|
116
150
|
const index = defaultAppPrefetchQueue.indexOf(runner);
|
|
117
|
-
if (index === -1) return;
|
|
151
|
+
if (index === -1) return release;
|
|
118
152
|
defaultAppPrefetchQueue.splice(index, 1);
|
|
119
153
|
activeDefaultAppPrefetchRequests += 1;
|
|
120
|
-
runner();
|
|
154
|
+
runner(true);
|
|
155
|
+
return release;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Whether a current navigation is waiting on this prefetch. A staged prefetch
|
|
159
|
+
* (route tree, then payload) hands navigation a promise that wraps its queued
|
|
160
|
+
* requests, so promotion cannot reach them; they check this instead before
|
|
161
|
+
* dropping themselves.
|
|
162
|
+
*
|
|
163
|
+
* `claimedBy` limits this to claims made up to that `getAppPrefetchFetchClaimSequence()`.
|
|
164
|
+
*/
|
|
165
|
+
function isAppPrefetchFetchClaimed(promise, claimedBy = Infinity) {
|
|
166
|
+
const claims = promise && appPrefetchFetchClaims.get(promise);
|
|
167
|
+
if (!claims) return false;
|
|
168
|
+
for (const [isCurrent, sequence] of claims) if (sequence <= claimedBy && isCurrent()) return true;
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
/** The sequence number of the latest claim on any prefetch. */
|
|
172
|
+
function getAppPrefetchFetchClaimSequence() {
|
|
173
|
+
return appPrefetchFetchClaimSequence;
|
|
121
174
|
}
|
|
122
175
|
//#endregion
|
|
123
|
-
export { cancelAppPrefetchFetch, promoteAppPrefetchFetch, releaseAppPrefetchFetchSlot, scheduleAppPrefetchFetch };
|
|
176
|
+
export { cancelAppPrefetchFetch, cancelQueuedAppPrefetchFetch, getAppPrefetchFetchClaimSequence, isAppPrefetchFetchClaimed, promoteAppPrefetchFetch, releaseAppPrefetchFetchSlot, scheduleAppPrefetchFetch };
|
|
@@ -16,16 +16,27 @@ export type AppRoutePrefetchPolicy = {
|
|
|
16
16
|
* How the dynamic stale-time signal affects this prefetch. Navigation data
|
|
17
17
|
* takes it verbatim, explicit full prefetches fall back to the static window
|
|
18
18
|
* only when it is zero, and loading shells ignore it because their contents
|
|
19
|
-
* are static.
|
|
19
|
+
* are static. "learning-only" keeps a dynamic render out of navigation reuse
|
|
20
|
+
* and holds it for the static window instead.
|
|
20
21
|
*/
|
|
21
|
-
dynamicStaleTime: "verbatim" | "full-prefetch" | "ignore";
|
|
22
|
+
dynamicStaleTime: "verbatim" | "full-prefetch" | "ignore" | "learning-only";
|
|
22
23
|
fallbackTtl: "dynamic" | "static";
|
|
23
24
|
prefetchShellFirst: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The route renders dynamically (`rendersDynamically`), so the prefetch
|
|
27
|
+
* never renders its page: an href with search params fetches the loading
|
|
28
|
+
* shell instead of the page with empty search params.
|
|
29
|
+
*/
|
|
30
|
+
rendersDynamically?: true;
|
|
24
31
|
/** Fetch the route tree before the concrete page segment. */
|
|
25
32
|
requiresRouteTreePrefetch?: true;
|
|
26
33
|
shouldPrefetch: boolean;
|
|
27
34
|
};
|
|
28
35
|
export declare function canAutoPrefetchFullAppRoute(href: string): boolean;
|
|
29
|
-
|
|
36
|
+
/**
|
|
37
|
+
* `interceptionContext` is the prefetch's interception context
|
|
38
|
+
* (`getPrefetchInterceptionContext`).
|
|
39
|
+
*/
|
|
40
|
+
export declare function resolveAutoAppRoutePrefetch(href: string, interceptionContext?: string | null): AppRoutePrefetchPolicy;
|
|
30
41
|
export declare function resolveFullAppRoutePrefetch(): AppRoutePrefetchPolicy;
|
|
31
42
|
//#endregion
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { stripBasePath } from "../../utils/base-path.js";
|
|
2
|
-
import {
|
|
2
|
+
import { splitPathSegments } from "../../routing/utils.js";
|
|
3
|
+
import { createRouteTrieCache, matchRouteWithTrie, matchRouteWithTrieRawPathname } from "../../routing/route-matching.js";
|
|
4
|
+
import { matchRoutePatternPrefix, matchRoutePatternRaw } from "../../routing/route-pattern.js";
|
|
3
5
|
//#region src/shims/internal/app-route-prefetch-policy.ts
|
|
4
6
|
/** basePath from next.config.js, injected by the plugin at build time */
|
|
5
7
|
const __basePath = process.env.__NEXT_ROUTER_BASEPATH ?? "";
|
|
@@ -27,7 +29,28 @@ const NO_APP_ROUTE_PREFETCH = {
|
|
|
27
29
|
function canAutoPrefetchFullAppRoute(href) {
|
|
28
30
|
return resolveAutoAppRoutePrefetch(href).cacheForNavigation;
|
|
29
31
|
}
|
|
30
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Whether the page the href renders is dynamic. Under an interception context
|
|
34
|
+
* that one of the route's intercepting pages matches, that page renders
|
|
35
|
+
* instead, and Next.js classifies it as its own route. When several match,
|
|
36
|
+
* any dynamic one counts. The intercepted response also renders the route the
|
|
37
|
+
* context resolves to, which can be a dynamic descendant of the intercept's
|
|
38
|
+
* source, so that route counts too.
|
|
39
|
+
*/
|
|
40
|
+
function resolveRendersDynamically(routes, route, interceptionContext, pathname) {
|
|
41
|
+
if (interceptionContext !== null && route.intercepts) {
|
|
42
|
+
const pathParts = splitPathSegments(pathname);
|
|
43
|
+
const contextParts = splitPathSegments(interceptionContext);
|
|
44
|
+
const matching = route.intercepts.filter((intercept) => matchRoutePatternRaw(pathParts, intercept.targetPatternParts) !== null && matchRoutePatternPrefix(contextParts, intercept.sourcePatternParts));
|
|
45
|
+
if (matching.length > 0) return matching.some((intercept) => intercept.rendersDynamically === true) || matchRouteWithTrieRawPathname(interceptionContext, routes, linkPrefetchRouteTrieCache)?.route.rendersDynamically === true;
|
|
46
|
+
}
|
|
47
|
+
return route.rendersDynamically === true;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* `interceptionContext` is the prefetch's interception context
|
|
51
|
+
* (`getPrefetchInterceptionContext`).
|
|
52
|
+
*/
|
|
53
|
+
function resolveAutoAppRoutePrefetch(href, interceptionContext = null) {
|
|
31
54
|
if (typeof window === "undefined") return NO_APP_ROUTE_PREFETCH;
|
|
32
55
|
const routes = window.__VINEXT_LINK_PREFETCH_ROUTES__;
|
|
33
56
|
if (!routes) return NO_APP_ROUTE_PREFETCH;
|
|
@@ -42,12 +65,14 @@ function resolveAutoAppRoutePrefetch(href) {
|
|
|
42
65
|
const hasSearchParams = routeUrl.search !== "";
|
|
43
66
|
const isFullyDynamicRootRoute = route.patternParts.length === 1 && route.patternParts[0]?.startsWith(":");
|
|
44
67
|
const hasCacheComponentsLearningOnlyDynamicPath = route.isDynamic && String(process.env.__NEXT_CACHE_COMPONENTS) === "true" && (ENCODED_PATH_DELIMITER_RE.test(routeUrl.pathname) || isFullyDynamicRootRoute && !requiresRouteTreePrefetch);
|
|
45
|
-
const
|
|
68
|
+
const rendersDynamically = resolveRendersDynamically(routes, route, interceptionContext, routeUrl.pathname);
|
|
69
|
+
const cacheForNavigation = !hasSearchParams && !hasCacheComponentsLearningOnlyDynamicPath && (requiresRouteTreePrefetch || !route.canPrefetchLoadingShell && route.requiresDynamicNavigationRequest !== true && !rendersDynamically);
|
|
46
70
|
return {
|
|
47
71
|
cacheForNavigation,
|
|
48
|
-
dynamicStaleTime: cacheForNavigation ? "verbatim" : "
|
|
72
|
+
dynamicStaleTime: !cacheForNavigation ? "ignore" : String(process.env.__NEXT_CACHE_COMPONENTS) === "true" ? "verbatim" : "learning-only",
|
|
49
73
|
fallbackTtl: "static",
|
|
50
74
|
prefetchShellFirst: requiresRouteTreePrefetch || hasSearchParams || !route.isDynamic,
|
|
75
|
+
...rendersDynamically ? { rendersDynamically: true } : {},
|
|
51
76
|
...requiresRouteTreePrefetch ? { requiresRouteTreePrefetch: true } : {},
|
|
52
77
|
shouldPrefetch: true
|
|
53
78
|
};
|
|
@@ -13,4 +13,5 @@ export declare function _registerCacheContextAccessor(fn: () => CacheContextLike
|
|
|
13
13
|
export declare function getRegisteredCacheContext(): CacheContextLike | null;
|
|
14
14
|
/** Record a root-param dependency on the active public `"use cache"` scope. */
|
|
15
15
|
export declare function _recordUseCacheRootParamRead(name: string): void;
|
|
16
|
-
//#endregion
|
|
16
|
+
//#endregion
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region src/shims/internal/client-reference-loader.d.ts
|
|
2
|
+
type ClientReferenceExports = Record<string, unknown>;
|
|
3
|
+
export declare function registerClientReference(key: string, exports: ClientReferenceExports): void;
|
|
4
|
+
/** What @vitejs/plugin-rsc/browser calls as `clientReferences.default[key]()`. */
|
|
5
|
+
export declare const clientReferences: Record<string, () => Promise<ClientReferenceExports>>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export {};
|