vinext 1.0.0-beta.3 → 1.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -3
- package/dist/build/client-build-config.d.ts +0 -1
- package/dist/build/css-url-assets.d.ts +0 -1
- package/dist/build/google-fonts/build-url.d.ts +5 -2
- package/dist/build/google-fonts/font-metadata.d.ts +7 -3
- package/dist/build/google-fonts/get-axes.d.ts +0 -1
- package/dist/build/layout-classification.d.ts +7 -4
- package/dist/build/next-client-runtime-manifests.d.ts +0 -1
- package/dist/build/next-client-runtime-manifests.js +2 -19
- package/dist/build/nitro-route-rules.d.ts +0 -1
- package/dist/build/pages-client-assets-module.d.ts +0 -1
- package/dist/build/precompress.d.ts +7 -2
- package/dist/build/precompress.js +42 -8
- package/dist/build/prerender-paths.d.ts +2 -2
- package/dist/build/prerender-server-entry.d.ts +1 -1
- package/dist/build/prerender-server-pool.d.ts +4 -2
- package/dist/build/prerender.d.ts +36 -32
- package/dist/build/prerender.js +18 -3
- package/dist/build/public-dir-conflict.d.ts +14 -0
- package/dist/build/public-dir-conflict.js +25 -0
- package/dist/build/report.d.ts +2 -2
- package/dist/build/route-classification-injector.d.ts +0 -1
- package/dist/build/route-classification-manifest.d.ts +5 -3
- package/dist/build/run-prerender.d.ts +3 -2
- package/dist/build/static-export.d.ts +23 -12
- package/dist/cache/cache-adapters-virtual.d.ts +5 -2
- package/dist/check.js +4 -4
- package/dist/cli-args.d.ts +2 -1
- package/dist/cli-args.js +10 -0
- package/dist/cli-dev-config.d.ts +0 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +14 -8
- package/dist/client/client-rewrite-matcher.d.ts +12 -0
- package/dist/client/client-rewrite-matcher.js +20 -0
- package/dist/client/client-rewrites.d.ts +31 -0
- package/dist/client/client-rewrites.js +41 -0
- package/dist/client/dev-error-overlay.d.ts +0 -1
- package/dist/client/empty-module.d.ts +1 -1
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +2 -0
- package/dist/client/instrumentation-client-state.d.ts +0 -1
- package/dist/client/navigation-runtime.d.ts +12 -1
- package/dist/client/navigation-runtime.js +6 -2
- package/dist/client/pages-router-link-navigation.d.ts +3 -21
- package/dist/client/react-instance-bootstrap.d.ts +1 -0
- package/dist/client/react-instance-bootstrap.js +7 -0
- package/dist/client/react-instance.d.ts +13 -0
- package/dist/client/react-instance.js +20 -0
- package/dist/client/vinext-next-data.d.ts +11 -6
- package/dist/client/window-next.d.ts +5 -2
- package/dist/config/config-matchers.d.ts +3 -5
- package/dist/config/config-matchers.js +7 -6
- package/dist/config/dotenv.d.ts +4 -9
- package/dist/config/dotenv.js +30 -22
- package/dist/config/next-config.d.ts +113 -52
- package/dist/config/next-config.js +6 -0
- package/dist/config/prerender.d.ts +0 -1
- package/dist/entries/app-browser-entry.d.ts +0 -1
- package/dist/entries/app-browser-entry.js +7 -3
- package/dist/entries/app-rsc-entry.d.ts +30 -16
- package/dist/entries/app-rsc-entry.js +40 -12
- package/dist/entries/app-rsc-manifest.d.ts +0 -1
- package/dist/entries/app-rsc-manifest.js +1 -0
- package/dist/entries/pages-client-entry.d.ts +0 -1
- package/dist/entries/pages-client-entry.js +7 -2
- package/dist/entries/pages-server-entry.d.ts +1 -2
- package/dist/entries/pages-server-entry.js +25 -6
- package/dist/image/image-adapters-virtual.d.ts +4 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +257 -75
- package/dist/init-cloudflare.d.ts +0 -1
- package/dist/init-platform.d.ts +0 -1
- package/dist/init.d.ts +40 -20
- package/dist/plugins/ast-scope.d.ts +0 -1
- package/dist/plugins/async-hooks-stub.d.ts +0 -1
- package/dist/plugins/client-reference-dedup.d.ts +0 -1
- package/dist/plugins/client-reference-dedup.js +7 -5
- package/dist/plugins/css-data-url.d.ts +0 -1
- package/dist/plugins/css-module-imports.d.ts +0 -1
- package/dist/plugins/dynamic-preload-metadata.d.ts +0 -1
- package/dist/plugins/extensionless-dynamic-import.d.ts +0 -1
- package/dist/plugins/extensionless-dynamic-import.js +352 -13
- package/dist/plugins/fonts.d.ts +0 -1
- package/dist/plugins/ignore-dynamic-requests.d.ts +0 -1
- package/dist/plugins/ignore-dynamic-requests.js +28 -4
- package/dist/plugins/import-meta-url.d.ts +0 -1
- package/dist/plugins/instrumentation-client.d.ts +0 -1
- package/dist/plugins/middleware-server-only.d.ts +0 -1
- package/dist/plugins/og-asset-ownership.d.ts +0 -1
- package/dist/plugins/og-assets.d.ts +0 -1
- package/dist/plugins/optimize-imports.d.ts +0 -1
- package/dist/plugins/remove-console.d.ts +0 -1
- package/dist/plugins/require-context.d.ts +0 -1
- package/dist/plugins/require-context.js +143 -26
- package/dist/plugins/rsc-client-reference-loaders.d.ts +0 -1
- package/dist/plugins/rsc-reference-validation-normalizer.d.ts +0 -1
- package/dist/plugins/sass.d.ts +30 -2
- package/dist/plugins/sass.js +67 -5
- package/dist/plugins/server-externals-manifest.d.ts +0 -1
- package/dist/plugins/strip-server-exports.d.ts +0 -1
- package/dist/plugins/styled-jsx.d.ts +0 -1
- package/dist/plugins/wasm-module-import.d.ts +0 -1
- package/dist/routing/app-route-graph.d.ts +115 -56
- package/dist/routing/app-route-graph.js +2 -1
- package/dist/routing/app-router.d.ts +0 -1
- package/dist/routing/pages-router.d.ts +9 -5
- package/dist/routing/route-matching.d.ts +0 -1
- package/dist/routing/utils.d.ts +1 -23
- package/dist/routing/utils.js +1 -30
- package/dist/server/accept-encoding.d.ts +0 -1
- package/dist/server/api-handler.d.ts +0 -1
- package/dist/server/api-handler.js +4 -3
- package/dist/server/app-bfcache-identity.d.ts +9 -10
- package/dist/server/app-bfcache-identity.js +27 -102
- package/dist/server/app-browser-action-result.d.ts +0 -1
- package/dist/server/app-browser-client-reuse-manifest.d.ts +0 -1
- package/dist/server/app-browser-entry.d.ts +1 -1
- package/dist/server/app-browser-entry.js +106 -66
- package/dist/server/app-browser-history-controller.d.ts +8 -5
- package/dist/server/app-browser-hydration.d.ts +0 -1
- package/dist/server/app-browser-interception-context.d.ts +0 -1
- package/dist/server/app-browser-mpa-navigation.d.ts +0 -1
- package/dist/server/app-browser-navigation-controller.d.ts +3 -6
- package/dist/server/app-browser-navigation-controller.js +29 -4
- package/dist/server/app-browser-popstate.d.ts +0 -1
- package/dist/server/app-browser-prefetch-response.d.ts +25 -0
- package/dist/server/app-browser-prefetch-response.js +54 -0
- package/dist/server/app-browser-server-action-client.d.ts +1 -1
- package/dist/server/app-browser-server-action-client.js +3 -2
- package/dist/server/app-browser-server-action-navigation.d.ts +0 -1
- package/dist/server/app-browser-state.d.ts +11 -5
- package/dist/server/app-browser-state.js +10 -6
- package/dist/server/app-browser-stream.d.ts +0 -1
- package/dist/server/app-browser-visible-commit.d.ts +1 -1
- package/dist/server/app-browser-visible-commit.js +6 -2
- package/dist/server/app-elements-wire.d.ts +16 -13
- package/dist/server/app-elements-wire.js +37 -10
- package/dist/server/app-elements.d.ts +2 -3
- package/dist/server/app-elements.js +2 -2
- package/dist/server/app-fallback-renderer.d.ts +8 -4
- package/dist/server/app-fallback-renderer.js +2 -1
- package/dist/server/app-history-state.d.ts +2 -2
- package/dist/server/app-history-state.js +1 -1
- package/dist/server/app-hook-warning-suppression.d.ts +0 -1
- package/dist/server/app-layout-param-observation.d.ts +0 -1
- package/dist/server/app-layout-param-observation.js +1 -1
- package/dist/server/app-middleware.d.ts +5 -1
- package/dist/server/app-middleware.js +96 -31
- package/dist/server/app-optimistic-routing.d.ts +1 -0
- package/dist/server/app-page-boundary-render.d.ts +8 -4
- package/dist/server/app-page-cache-finalizer.d.ts +2 -3
- package/dist/server/app-page-cache-finalizer.js +47 -17
- package/dist/server/app-page-cache-render.d.ts +2 -2
- package/dist/server/app-page-cache-render.js +2 -1
- package/dist/server/app-page-cache.d.ts +1 -3
- package/dist/server/app-page-cache.js +22 -11
- package/dist/server/app-page-dispatch.d.ts +12 -6
- package/dist/server/app-page-dispatch.js +14 -6
- package/dist/server/app-page-element-builder.d.ts +63 -20
- package/dist/server/app-page-element-builder.js +114 -43
- package/dist/server/app-page-execution.d.ts +12 -5
- package/dist/server/app-page-execution.js +1 -1
- package/dist/server/app-page-head.d.ts +2 -2
- package/dist/server/app-page-http-access-fallback-metadata.d.ts +2 -2
- package/dist/server/app-page-params.d.ts +0 -1
- package/dist/server/app-page-ppr-runtime.d.ts +0 -1
- package/dist/server/app-page-probe.d.ts +4 -3
- package/dist/server/app-page-probe.js +1 -1
- package/dist/server/app-page-render-identity.d.ts +1 -0
- package/dist/server/app-page-render-observation.d.ts +0 -1
- package/dist/server/app-page-render.d.ts +7 -5
- package/dist/server/app-page-render.js +59 -24
- package/dist/server/app-page-request.d.ts +3 -2
- package/dist/server/app-page-request.js +6 -46
- package/dist/server/app-page-response.d.ts +15 -3
- package/dist/server/app-page-response.js +21 -3
- package/dist/server/app-page-route-wiring.d.ts +30 -7
- package/dist/server/app-page-route-wiring.js +163 -63
- package/dist/server/app-page-search-params-observation.d.ts +0 -1
- package/dist/server/app-page-segment-plan.d.ts +56 -0
- package/dist/server/app-page-segment-plan.js +177 -0
- package/dist/server/app-page-segment-state.d.ts +18 -2
- package/dist/server/app-page-segment-state.js +23 -4
- package/dist/server/app-page-stream.d.ts +19 -10
- package/dist/server/app-pages-bridge.d.ts +2 -2
- package/dist/server/app-pages-bridge.js +14 -2
- package/dist/server/app-post-middleware-context.d.ts +0 -1
- package/dist/server/app-ppr-fallback-shell-render.d.ts +0 -1
- package/dist/server/app-prerender-endpoints.d.ts +0 -1
- package/dist/server/app-prerender-static-params.d.ts +0 -1
- package/dist/server/app-render-dependency.d.ts +11 -4
- package/dist/server/app-render-dependency.js +59 -9
- package/dist/server/app-request-context.d.ts +1 -0
- package/dist/server/app-route-handler-cache.d.ts +2 -2
- package/dist/server/app-route-handler-cache.js +5 -1
- package/dist/server/app-route-handler-dispatch.d.ts +0 -1
- package/dist/server/app-route-handler-execution.d.ts +2 -2
- package/dist/server/app-route-handler-execution.js +5 -1
- package/dist/server/app-route-handler-policy.d.ts +0 -1
- package/dist/server/app-route-handler-response.d.ts +0 -1
- package/dist/server/app-route-handler-runtime.d.ts +0 -1
- package/dist/server/app-route-handler-runtime.js +1 -2
- package/dist/server/app-route-module-loader.d.ts +32 -6
- package/dist/server/app-route-module-loader.js +73 -3
- package/dist/server/app-router-entry.d.ts +0 -1
- package/dist/server/app-router-entry.js +2 -2
- package/dist/server/app-rsc-cache-busting.d.ts +7 -1
- package/dist/server/app-rsc-cache-busting.js +6 -0
- package/dist/server/app-rsc-handler.d.ts +9 -2
- package/dist/server/app-rsc-handler.js +173 -41
- package/dist/server/app-rsc-redirect-flight.d.ts +0 -1
- package/dist/server/app-rsc-render-mode.d.ts +3 -2
- package/dist/server/app-rsc-render-mode.js +4 -1
- package/dist/server/app-rsc-request-normalization.d.ts +19 -10
- package/dist/server/app-rsc-request-normalization.js +65 -4
- package/dist/server/app-rsc-response-finalizer.d.ts +5 -2
- package/dist/server/app-rsc-response-finalizer.js +31 -18
- package/dist/server/app-rsc-route-matching.d.ts +6 -1
- package/dist/server/app-rsc-route-matching.js +47 -2
- package/dist/server/app-segment-config.d.ts +0 -1
- package/dist/server/app-server-action-execution.d.ts +42 -9
- package/dist/server/app-server-action-execution.js +189 -111
- package/dist/server/app-ssr-entry.d.ts +5 -3
- package/dist/server/app-ssr-entry.js +4 -5
- package/dist/server/app-ssr-router-instance.d.ts +0 -1
- package/dist/server/app-ssr-stream.d.ts +7 -1
- package/dist/server/app-ssr-stream.js +2 -1
- package/dist/server/app-static-generation.d.ts +0 -1
- package/dist/server/app-visited-response-cache.d.ts +7 -2
- package/dist/server/app-visited-response-cache.js +49 -1
- package/dist/server/before-interactive-head.d.ts +0 -1
- package/dist/server/before-interactive-head.js +2 -0
- package/dist/server/bfcache-identity.d.ts +45 -0
- package/dist/server/bfcache-identity.js +52 -0
- package/dist/server/cache-control.d.ts +3 -3
- package/dist/server/cache-control.js +3 -2
- package/dist/server/cache-proof.d.ts +0 -1
- package/dist/server/client-reuse-manifest.d.ts +0 -1
- package/dist/server/config-headers.d.ts +2 -2
- package/dist/server/csp.d.ts +0 -1
- package/dist/server/default-global-error-module.d.ts +0 -1
- package/dist/server/default-global-not-found-module.d.ts +0 -1
- package/dist/server/default-not-found-module.d.ts +0 -1
- package/dist/server/dev-lockfile.d.ts +21 -9
- package/dist/server/dev-module-runner.d.ts +0 -1
- package/dist/server/dev-route-files.d.ts +0 -1
- package/dist/server/dev-server.d.ts +4 -8
- package/dist/server/dev-server.js +86 -131
- package/dist/server/dev-stack-sourcemap.d.ts +0 -1
- package/dist/server/document-initial-head.d.ts +12 -2
- package/dist/server/document-initial-head.js +17 -2
- package/dist/server/edge-api-runtime.d.ts +10 -1
- package/dist/server/edge-api-runtime.js +29 -1
- package/dist/server/file-based-metadata.d.ts +0 -1
- package/dist/server/headers.d.ts +17 -2
- package/dist/server/headers.js +17 -1
- package/dist/server/http-conditional.d.ts +22 -0
- package/dist/server/http-conditional.js +117 -0
- package/dist/server/http-date.d.ts +5 -0
- package/dist/server/http-date.js +73 -0
- package/dist/server/http-error-responses.d.ts +2 -1
- package/dist/server/http-error-responses.js +14 -2
- package/dist/server/http-range.d.ts +25 -0
- package/dist/server/http-range.js +67 -0
- package/dist/server/image-optimization.d.ts +14 -6
- package/dist/server/image-optimization.js +0 -1
- package/dist/server/instrumentation.d.ts +7 -4
- package/dist/server/isr-cache.d.ts +28 -6
- package/dist/server/isr-cache.js +19 -13
- package/dist/server/isr-decision.d.ts +6 -4
- package/dist/server/metadata-route-build-data.d.ts +0 -1
- package/dist/server/metadata-route-response.d.ts +0 -1
- package/dist/server/metadata-route-response.js +7 -6
- package/dist/server/metadata-routes.d.ts +34 -16
- package/dist/server/middleware-matcher-pattern.d.ts +0 -1
- package/dist/server/middleware-matcher.d.ts +8 -3
- package/dist/server/middleware-matcher.js +23 -18
- package/dist/server/middleware-runtime.d.ts +6 -1
- package/dist/server/middleware-runtime.js +91 -28
- package/dist/server/middleware.d.ts +0 -1
- package/dist/server/navigation-planner.d.ts +1 -1
- package/dist/server/next-error-digest.d.ts +0 -1
- package/dist/server/pages-api-route.d.ts +2 -1
- package/dist/server/pages-api-route.js +32 -7
- package/dist/server/pages-asset-tags.d.ts +3 -1
- package/dist/server/pages-asset-tags.js +6 -4
- package/dist/server/pages-data-route.d.ts +14 -6
- package/dist/server/pages-data-route.js +19 -10
- package/dist/server/pages-dev-hydration.js +3 -0
- package/dist/server/pages-dev-stylesheets.d.ts +10 -0
- package/dist/server/pages-dev-stylesheets.js +150 -0
- package/dist/server/pages-document-asset-props.d.ts +26 -0
- package/dist/server/pages-document-asset-props.js +69 -0
- package/dist/server/pages-document-initial-props.d.ts +10 -6
- package/dist/server/pages-get-initial-props.d.ts +2 -2
- package/dist/server/pages-i18n.d.ts +1 -7
- package/dist/server/pages-node-compat.d.ts +11 -2
- package/dist/server/pages-node-compat.js +52 -5
- package/dist/server/pages-page-data.d.ts +21 -9
- package/dist/server/pages-page-data.js +109 -30
- package/dist/server/pages-page-handler.d.ts +70 -32
- package/dist/server/pages-page-handler.js +25 -6
- package/dist/server/pages-page-response.d.ts +9 -13
- package/dist/server/pages-page-response.js +25 -26
- package/dist/server/pages-readiness.d.ts +0 -1
- package/dist/server/pages-request-pipeline.d.ts +20 -6
- package/dist/server/pages-request-pipeline.js +40 -20
- package/dist/server/pages-revalidate.d.ts +0 -1
- package/dist/server/pages-revalidate.js +1 -1
- package/dist/server/pages-router-entry.js +14 -10
- package/dist/server/prerender-manifest.d.ts +7 -0
- package/dist/server/prod-server.d.ts +13 -7
- package/dist/server/prod-server.js +276 -83
- package/dist/server/proxy-trust.d.ts +0 -1
- package/dist/server/request-log.d.ts +7 -11
- package/dist/server/request-pipeline.d.ts +13 -4
- package/dist/server/request-pipeline.js +28 -20
- package/dist/server/revalidation-host.d.ts +0 -1
- package/dist/server/revalidation-host.js +1 -1
- package/dist/server/rsc-completion-metadata.d.ts +15 -0
- package/dist/server/rsc-completion-metadata.js +183 -0
- package/dist/server/seed-cache.d.ts +2 -1
- package/dist/server/seed-cache.js +8 -5
- package/dist/server/skip-cache-proof.d.ts +0 -1
- package/dist/server/static-file-cache.d.ts +23 -9
- package/dist/server/static-file-cache.js +47 -23
- package/dist/server/static-layout-client-reuse-proof.d.ts +0 -1
- package/dist/server/worker-revalidation-context.d.ts +0 -1
- package/dist/server/worker-revalidation-context.js +1 -0
- package/dist/server/worker-utils.d.ts +3 -1
- package/dist/server/worker-utils.js +11 -2
- package/dist/shims/app-router-scroll-state.d.ts +2 -1
- package/dist/shims/app-router-scroll-state.js +7 -2
- package/dist/shims/app-router-scroll.d.ts +2 -8
- package/dist/shims/app.d.ts +1 -5
- package/dist/shims/before-interactive-context.d.ts +5 -3
- package/dist/shims/cache-handler.d.ts +6 -1
- package/dist/shims/cache-handler.js +4 -2
- package/dist/shims/cache-request-state.d.ts +12 -1
- package/dist/shims/cache-request-state.js +22 -1
- package/dist/shims/cache-runtime.d.ts +9 -5
- package/dist/shims/cache-runtime.js +16 -6
- package/dist/shims/cache.d.ts +2 -3
- package/dist/shims/cache.js +2 -2
- package/dist/shims/cdn-cache.d.ts +0 -1
- package/dist/shims/client-locale.d.ts +1 -6
- package/dist/shims/client-only.d.ts +1 -1
- package/dist/shims/compat-router.d.ts +0 -1
- package/dist/shims/constants.d.ts +1 -1
- package/dist/shims/default-global-error.d.ts +1 -4
- package/dist/shims/default-not-found.d.ts +0 -1
- package/dist/shims/document.d.ts +0 -1
- package/dist/shims/document.js +17 -3
- package/dist/shims/dynamic-preload-chunks.d.ts +0 -1
- package/dist/shims/dynamic.d.ts +0 -1
- package/dist/shims/error-boundary-navigation.d.ts +0 -1
- package/dist/shims/error-boundary.d.ts +7 -32
- package/dist/shims/error.d.ts +1 -6
- package/dist/shims/fetch-cache.js +112 -63
- package/dist/shims/font-google-base.d.ts +0 -1
- package/dist/shims/font-local.d.ts +0 -1
- package/dist/shims/form.d.ts +5 -3
- package/dist/shims/hash-scroll.d.ts +1 -1
- package/dist/shims/hash-scroll.js +2 -1
- package/dist/shims/head-state.d.ts +0 -1
- package/dist/shims/head.d.ts +1 -4
- package/dist/shims/headers.d.ts +2 -2
- package/dist/shims/headers.js +1 -1
- package/dist/shims/i18n-context.d.ts +0 -1
- package/dist/shims/i18n-state.d.ts +0 -1
- package/dist/shims/image.d.ts +0 -1
- package/dist/shims/image.js +1 -2
- package/dist/shims/internal/als-registry.d.ts +31 -2
- package/dist/shims/internal/als-registry.js +50 -2
- package/dist/shims/internal/app-prefetch-fetch-queue.d.ts +17 -2
- package/dist/shims/internal/app-prefetch-fetch-queue.js +69 -7
- package/dist/shims/internal/app-route-detection.d.ts +0 -1
- package/dist/shims/internal/app-route-prefetch-policy.d.ts +31 -0
- package/dist/shims/internal/app-route-prefetch-policy.js +57 -0
- package/dist/shims/internal/app-router-context.d.ts +0 -1
- package/dist/shims/internal/hybrid-client-route-owner-direct.d.ts +1 -5
- package/dist/shims/internal/hybrid-client-route-owner.d.ts +0 -1
- package/dist/shims/internal/hybrid-client-route-owner.js +6 -8
- package/dist/shims/internal/interpolate-as.d.ts +3 -2
- package/dist/shims/internal/pages-data-target.d.ts +21 -10
- package/dist/shims/internal/pages-data-target.js +1 -1
- package/dist/shims/internal/pages-data-url.d.ts +3 -1
- package/dist/shims/internal/router-context.d.ts +0 -1
- package/dist/shims/internal/work-unit-async-storage.d.ts +4 -3
- package/dist/shims/internal/work-unit-async-storage.js +2 -0
- package/dist/shims/layout-segment-context.d.ts +2 -6
- package/dist/shims/legacy-image.d.ts +0 -1
- package/dist/shims/link.d.ts +29 -21
- package/dist/shims/link.js +52 -97
- package/dist/shims/metadata.d.ts +11 -25
- package/dist/shims/metadata.js +24 -32
- package/dist/shims/navigation-context-state.d.ts +0 -1
- package/dist/shims/navigation-state.d.ts +1 -0
- package/dist/shims/navigation.d.ts +54 -6
- package/dist/shims/navigation.js +325 -73
- package/dist/shims/navigation.react-server.d.ts +1 -0
- package/dist/shims/og.d.ts +0 -1
- package/dist/shims/request-context.d.ts +8 -3
- package/dist/shims/request-state-types.d.ts +1 -0
- package/dist/shims/router.d.ts +44 -23
- package/dist/shims/router.js +8 -7
- package/dist/shims/script-nonce-context.d.ts +0 -1
- package/dist/shims/script.d.ts +25 -13
- package/dist/shims/server-only.d.ts +1 -1
- package/dist/shims/server.d.ts +1 -3
- package/dist/shims/server.js +5 -6
- package/dist/shims/slot.d.ts +23 -11
- package/dist/shims/slot.js +103 -19
- package/dist/shims/streamed-icons.d.ts +7 -0
- package/dist/shims/streamed-icons.js +33 -0
- package/dist/shims/unified-request-context.d.ts +44 -4
- package/dist/shims/unified-request-context.js +56 -2
- package/dist/shims/use-merged-ref.d.ts +0 -1
- package/dist/shims/web-vitals.d.ts +0 -1
- package/dist/typegen.d.ts +1 -2
- package/dist/typegen.js +1 -1
- package/dist/utils/cache-control-metadata.d.ts +13 -1
- package/dist/utils/cache-control-metadata.js +17 -1
- package/dist/utils/client-build-manifest.d.ts +0 -1
- package/dist/utils/domain-locale.d.ts +1 -5
- package/dist/utils/html-limited-bots.js +1 -1
- package/dist/utils/middleware-request-headers.d.ts +17 -5
- package/dist/utils/middleware-request-headers.js +32 -23
- package/dist/utils/precompressed-variant.d.ts +9 -0
- package/dist/utils/precompressed-variant.js +15 -0
- package/dist/utils/project.d.ts +12 -7
- package/dist/utils/public-file-path.d.ts +5 -0
- package/dist/utils/public-file-path.js +12 -0
- package/dist/utils/public-routes.d.ts +1 -1
- package/dist/utils/public-routes.js +6 -5
- package/package.json +7 -3
package/dist/shims/link.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { stripBasePath } from "../utils/base-path.js";
|
|
3
|
-
import { createRouteTrieCache, matchRouteWithTrie } from "../routing/route-matching.js";
|
|
4
2
|
import { isDangerousScheme, reportBlockedDangerousNavigation } from "./url-safety.js";
|
|
5
|
-
import { RouterContext } from "./internal/router-context.js";
|
|
6
3
|
import { addLocalePrefix, getDomainLocaleUrl } from "../utils/domain-locale.js";
|
|
4
|
+
import { RouterContext } from "./internal/router-context.js";
|
|
7
5
|
import { getPagesMiddlewareDataHref, prefetchPagesData, resolvePagesDataNavigationTarget } from "./internal/pages-data-target.js";
|
|
8
6
|
import { markAppRouteDetectedOnPrefetch } from "./internal/app-route-detection.js";
|
|
9
7
|
import { isAbsoluteOrProtocolRelativeUrl, normalizePathTrailingSlash, toBrowserNavigationHref, toSameOriginAppPath, withBasePath } from "./url-utils.js";
|
|
@@ -17,6 +15,7 @@ import { navigatePagesRouterLinkWithFallback, resolvePagesRouterQueryOnlyHref }
|
|
|
17
15
|
import { scheduleAppPrefetchFetch } from "./internal/app-prefetch-fetch-queue.js";
|
|
18
16
|
import { getI18nContext } from "./i18n-context.js";
|
|
19
17
|
import { canLinkIntentPrefetch, canLinkPrefetch, getLinkPrefetchHref } from "./link-prefetch.js";
|
|
18
|
+
import { canAutoPrefetchFullAppRoute, resolveAutoAppRoutePrefetch, resolveFullAppRoutePrefetch } from "./internal/app-route-prefetch-policy.js";
|
|
20
19
|
import { clearLinkForCurrentNavigation, notifyLinkNavigationStart, setLinkForCurrentNavigation } from "./internal/link-status-registry.js";
|
|
21
20
|
import React, { createContext, forwardRef, useCallback, useContext, useEffect, useRef, useState } from "react";
|
|
22
21
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -30,6 +29,22 @@ import { jsx } from "react/jsx-runtime";
|
|
|
30
29
|
*/
|
|
31
30
|
const HAS_PAGES_ROUTER = process.env.__VINEXT_HAS_PAGES_ROUTER !== "false";
|
|
32
31
|
const HAS_CLIENT_REWRITES = process.env.__VINEXT_HAS_CLIENT_REWRITES !== "false";
|
|
32
|
+
let loadedNavigationModule = null;
|
|
33
|
+
let navigationModulePromise = null;
|
|
34
|
+
let loadedHybridClientRouteOwnerModule = null;
|
|
35
|
+
let hybridClientRouteOwnerModulePromise = null;
|
|
36
|
+
function loadNavigationModule() {
|
|
37
|
+
return navigationModulePromise ??= import("./navigation.js").then((module) => {
|
|
38
|
+
loadedNavigationModule = module;
|
|
39
|
+
return module;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function loadHybridClientRouteOwnerModule() {
|
|
43
|
+
return hybridClientRouteOwnerModulePromise ??= import("./internal/hybrid-client-route-owner.js").then((module) => {
|
|
44
|
+
loadedHybridClientRouteOwnerModule = module;
|
|
45
|
+
return module;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
33
48
|
const LinkStatusContext = createContext({ pending: false });
|
|
34
49
|
/**
|
|
35
50
|
* useLinkStatus returns the pending state of the enclosing <Link>.
|
|
@@ -50,7 +65,6 @@ const __basePath = process.env.__NEXT_ROUTER_BASEPATH ?? "";
|
|
|
50
65
|
/** trailingSlash from next.config.js, injected by the plugin at build time */
|
|
51
66
|
const __trailingSlash = process.env.__VINEXT_TRAILING_SLASH === "true";
|
|
52
67
|
const __prefetchInlining = process.env.__VINEXT_PREFETCH_INLINING === "true";
|
|
53
|
-
const linkPrefetchRouteTrieCache = createRouteTrieCache();
|
|
54
68
|
function resolveHref(href) {
|
|
55
69
|
if (typeof href === "string") return href;
|
|
56
70
|
let url = href.pathname ?? "";
|
|
@@ -131,75 +145,9 @@ function resolveLinkPrefetchMode(prefetchProp, isDangerous) {
|
|
|
131
145
|
if (prefetchProp === true) return "full";
|
|
132
146
|
return "auto";
|
|
133
147
|
}
|
|
134
|
-
function toSameOriginRouteHref(href) {
|
|
135
|
-
if (typeof window === "undefined") return null;
|
|
136
|
-
let url;
|
|
137
|
-
try {
|
|
138
|
-
url = new URL(href, window.location.href);
|
|
139
|
-
} catch {
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
if (url.origin !== window.location.origin) return null;
|
|
143
|
-
return `${stripBasePath(url.pathname, __basePath)}${url.search}`;
|
|
144
|
-
}
|
|
145
148
|
function getLinkPrefetchRouterMode() {
|
|
146
149
|
return hasAppNavigationRuntime() ? "app" : "pages";
|
|
147
150
|
}
|
|
148
|
-
function resolveMatchedAutoAppRoutePrefetch(route) {
|
|
149
|
-
return {
|
|
150
|
-
cacheForNavigation: !route.canPrefetchLoadingShell && route.requiresDynamicNavigationRequest !== true,
|
|
151
|
-
prefetchShellFirst: !route.isDynamic,
|
|
152
|
-
shouldPrefetch: true
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
function canAutoPrefetchFullAppRoute(href) {
|
|
156
|
-
if (typeof window === "undefined") return false;
|
|
157
|
-
const routes = window.__VINEXT_LINK_PREFETCH_ROUTES__;
|
|
158
|
-
if (!routes) return false;
|
|
159
|
-
const routeHref = toSameOriginRouteHref(href);
|
|
160
|
-
if (routeHref === null) return false;
|
|
161
|
-
if (!matchRouteWithTrie(routeHref, routes, linkPrefetchRouteTrieCache)) return false;
|
|
162
|
-
return resolveAutoAppRoutePrefetch(href).cacheForNavigation;
|
|
163
|
-
}
|
|
164
|
-
function resolveAutoAppRoutePrefetch(href) {
|
|
165
|
-
if (typeof window === "undefined") return {
|
|
166
|
-
cacheForNavigation: false,
|
|
167
|
-
prefetchShellFirst: false,
|
|
168
|
-
shouldPrefetch: false
|
|
169
|
-
};
|
|
170
|
-
const routes = window.__VINEXT_LINK_PREFETCH_ROUTES__;
|
|
171
|
-
if (!routes) return {
|
|
172
|
-
cacheForNavigation: false,
|
|
173
|
-
prefetchShellFirst: false,
|
|
174
|
-
shouldPrefetch: false
|
|
175
|
-
};
|
|
176
|
-
const routeHref = toSameOriginRouteHref(href);
|
|
177
|
-
if (routeHref === null) return {
|
|
178
|
-
cacheForNavigation: false,
|
|
179
|
-
prefetchShellFirst: false,
|
|
180
|
-
shouldPrefetch: false
|
|
181
|
-
};
|
|
182
|
-
const match = matchRouteWithTrie(routeHref, routes, linkPrefetchRouteTrieCache);
|
|
183
|
-
if (!match) return {
|
|
184
|
-
cacheForNavigation: false,
|
|
185
|
-
prefetchShellFirst: false,
|
|
186
|
-
shouldPrefetch: false
|
|
187
|
-
};
|
|
188
|
-
const prefetch = resolveMatchedAutoAppRoutePrefetch(match.route);
|
|
189
|
-
if (new URL(routeHref, "http://vinext.local").search !== "") return {
|
|
190
|
-
...prefetch,
|
|
191
|
-
cacheForNavigation: false,
|
|
192
|
-
prefetchShellFirst: true
|
|
193
|
-
};
|
|
194
|
-
return prefetch;
|
|
195
|
-
}
|
|
196
|
-
function resolveFullAppRoutePrefetch() {
|
|
197
|
-
return {
|
|
198
|
-
cacheForNavigation: true,
|
|
199
|
-
prefetchShellFirst: true,
|
|
200
|
-
shouldPrefetch: true
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
151
|
/**
|
|
204
152
|
* Prefetch a URL for faster navigation.
|
|
205
153
|
*
|
|
@@ -229,30 +177,27 @@ function prefetchUrl(href, mode, priority = "low", pagesRouteHref, locale) {
|
|
|
229
177
|
}) ?? prefetchHref, window.location.href, __basePath);
|
|
230
178
|
const target = new URL(fullHref, window.location.href);
|
|
231
179
|
if (target.origin === window.location.origin && target.pathname === window.location.pathname && target.search === window.location.search) return;
|
|
180
|
+
if (mode === "auto" && priority === "low" && target.origin === window.location.origin && target.pathname === window.location.pathname && target.search !== window.location.search && target.hash !== "") return;
|
|
232
181
|
const runPrefetch = () => {
|
|
233
182
|
(async () => {
|
|
234
183
|
if (hasAppNavigationRuntime()) {
|
|
235
184
|
if (isBotUserAgent(window.navigator?.userAgent ?? "")) return;
|
|
236
185
|
const [navigation, { AppElementsWire }, rscCacheBusting, { APP_RSC_RENDER_MODE_PREFETCH_DYNAMIC_SHELL, APP_RSC_RENDER_MODE_PREFETCH_LOADING_SHELL }, headersModule, hybridRouteOwner] = await Promise.all([
|
|
237
|
-
|
|
186
|
+
loadNavigationModule(),
|
|
238
187
|
import("../server/app-elements.js"),
|
|
239
188
|
import("../server/app-rsc-cache-busting.js"),
|
|
240
189
|
import("../server/app-rsc-render-mode.js"),
|
|
241
190
|
import("../server/headers.js"),
|
|
242
|
-
HAS_PAGES_ROUTER || HAS_CLIENT_REWRITES ?
|
|
191
|
+
HAS_PAGES_ROUTER || HAS_CLIENT_REWRITES ? loadHybridClientRouteOwnerModule() : null
|
|
243
192
|
]);
|
|
244
193
|
if (navigationEpoch !== linkPrefetchNavigationEpoch) return;
|
|
245
|
-
const { getPrefetchInterceptionContext, getPrefetchCache, getPrefetchedUrls, getMountedSlotsHeader, hasSearchAgnosticPrefetchShellForRoute, hasPrefetchCacheEntryForNavigation, peekPrefetchResponseForNavigation, prefetchRscResponse, restoreRscResponse, PREFETCH_CACHE_TTL } = navigation;
|
|
246
|
-
const {
|
|
194
|
+
const { getPrefetchInterceptionContext, getPrefetchCache, getPrefetchedUrls, getMountedSlotsHeader, createAppPrefetchRequestHeaders, discardLearningOnlyPrefetchCacheEntry, hasSearchAgnosticPrefetchShellForRoute, hasPrefetchCacheEntryForNavigation, peekPrefetchResponseForNavigation, prefetchRscResponse, prepareNavigationPrefetchSnapshot, DYNAMIC_NAVIGATION_CACHE_TTL, restoreRscResponse, PREFETCH_CACHE_TTL } = navigation;
|
|
195
|
+
const { createRscRequestUrl } = rscCacheBusting;
|
|
247
196
|
const { NEXT_ROUTER_PREFETCH_HEADER, NEXT_ROUTER_SEGMENT_PREFETCH_HEADER, VINEXT_MOUNTED_SLOTS_HEADER } = headersModule;
|
|
248
197
|
const hybridOwner = HAS_PAGES_ROUTER ? hybridRouteOwner.resolveHybridClientRouteOwner(prefetchHref, __basePath) : null;
|
|
249
198
|
if (hybridOwner === "pages" || hybridOwner === "document") return;
|
|
250
199
|
const rewrittenPrefetchHref = HAS_CLIENT_REWRITES ? hybridRouteOwner.resolveHybridClientRewriteHref(fullHref, __basePath) : null;
|
|
251
|
-
const autoPrefetch = mode === "auto" ? resolveAutoAppRoutePrefetch(rewrittenPrefetchHref ?? prefetchHref) :
|
|
252
|
-
cacheForNavigation: true,
|
|
253
|
-
prefetchShellFirst: true,
|
|
254
|
-
shouldPrefetch: true
|
|
255
|
-
} : resolveFullAppRoutePrefetch();
|
|
200
|
+
const autoPrefetch = mode === "auto" ? resolveAutoAppRoutePrefetch(rewrittenPrefetchHref ?? prefetchHref) : resolveFullAppRoutePrefetch();
|
|
256
201
|
if (!autoPrefetch.shouldPrefetch) return;
|
|
257
202
|
const interceptionContext = getPrefetchInterceptionContext(fullHref);
|
|
258
203
|
const mountedSlotsHeader = getMountedSlotsHeader();
|
|
@@ -260,13 +205,15 @@ function prefetchUrl(href, mode, priority = "low", pagesRouteHref, locale) {
|
|
|
260
205
|
const hasSearchParams = new URL(fullHref, window.location.href).search !== "";
|
|
261
206
|
const isAutomaticSearchParamShell = mode === "auto" && isOptimisticRouteShellPrefetch && hasSearchParams;
|
|
262
207
|
const hasSearchAgnosticShell = isAutomaticSearchParamShell && hasSearchAgnosticPrefetchShellForRoute(await createRscRequestUrl(fullHref, new Headers()), interceptionContext, mountedSlotsHeader);
|
|
263
|
-
const headers =
|
|
208
|
+
const headers = createAppPrefetchRequestHeaders({
|
|
264
209
|
interceptionContext,
|
|
210
|
+
fetchPriority: priority,
|
|
211
|
+
prefetchKind: mode === "full" ? "full" : "auto",
|
|
265
212
|
renderMode: isOptimisticRouteShellPrefetch ? hasSearchAgnosticShell ? APP_RSC_RENDER_MODE_PREFETCH_LOADING_SHELL : isAutomaticSearchParamShell ? APP_RSC_RENDER_MODE_PREFETCH_DYNAMIC_SHELL : APP_RSC_RENDER_MODE_PREFETCH_LOADING_SHELL : void 0
|
|
266
213
|
});
|
|
267
214
|
if (mountedSlotsHeader) headers.set(VINEXT_MOUNTED_SLOTS_HEADER, mountedSlotsHeader);
|
|
268
215
|
const shouldSendSegmentPrefetchHeaders = isOptimisticRouteShellPrefetch || mode === "auto";
|
|
269
|
-
if (__prefetchInlining && autoPrefetch.cacheForNavigation) {
|
|
216
|
+
if (__prefetchInlining && mode === "auto" && autoPrefetch.cacheForNavigation) {
|
|
270
217
|
headers.set(NEXT_ROUTER_PREFETCH_HEADER, "1");
|
|
271
218
|
headers.set(NEXT_ROUTER_SEGMENT_PREFETCH_HEADER, "/__PAGE__");
|
|
272
219
|
} else if (shouldSendSegmentPrefetchHeaders) {
|
|
@@ -277,20 +224,21 @@ function prefetchUrl(href, mode, priority = "low", pagesRouteHref, locale) {
|
|
|
277
224
|
const additionalRscUrls = rewrittenPrefetchHref && rewrittenPrefetchHref !== fullHref ? [await createRscRequestUrl(rewrittenPrefetchHref, headers)] : [];
|
|
278
225
|
const cacheKey = AppElementsWire.encodeCacheKey(rscUrl, interceptionContext);
|
|
279
226
|
const prefetched = getPrefetchedUrls();
|
|
227
|
+
if (autoPrefetch.cacheForNavigation) discardLearningOnlyPrefetchCacheEntry(rscUrl, interceptionContext);
|
|
280
228
|
if (prefetched.has(cacheKey)) {
|
|
281
229
|
if (!autoPrefetch.cacheForNavigation) return;
|
|
282
|
-
const existing = getPrefetchCache().get(cacheKey);
|
|
283
|
-
if (existing?.cacheForNavigation === false) existing.cacheForNavigation = true;
|
|
284
230
|
}
|
|
285
|
-
const fetchFullRscPayload = () => scheduleAppPrefetchFetch(() => fetch(rscUrl, {
|
|
231
|
+
const fetchFullRscPayload = () => scheduleAppPrefetchFetch((signal) => fetch(rscUrl, {
|
|
286
232
|
headers,
|
|
287
233
|
credentials: "include",
|
|
288
234
|
priority,
|
|
235
|
+
signal,
|
|
289
236
|
purpose: "prefetch"
|
|
290
237
|
}), priority);
|
|
291
238
|
const fetchLoadingShellForReuse = async () => {
|
|
292
|
-
const shellHeaders =
|
|
239
|
+
const shellHeaders = createAppPrefetchRequestHeaders({
|
|
293
240
|
interceptionContext,
|
|
241
|
+
fetchPriority: priority,
|
|
294
242
|
renderMode: APP_RSC_RENDER_MODE_PREFETCH_LOADING_SHELL
|
|
295
243
|
});
|
|
296
244
|
shellHeaders.set(NEXT_ROUTER_PREFETCH_HEADER, "1");
|
|
@@ -302,10 +250,11 @@ function prefetchUrl(href, mode, priority = "low", pagesRouteHref, locale) {
|
|
|
302
250
|
let shellEntry = shellCache.get(shellCacheKey);
|
|
303
251
|
if (shellEntry === void 0) {
|
|
304
252
|
getPrefetchedUrls().add(shellCacheKey);
|
|
305
|
-
prefetchRscResponse(shellRscUrl, scheduleAppPrefetchFetch(() => fetch(shellRscUrl, {
|
|
253
|
+
prefetchRscResponse(shellRscUrl, scheduleAppPrefetchFetch((signal) => fetch(shellRscUrl, {
|
|
306
254
|
headers: shellHeaders,
|
|
307
255
|
credentials: "include",
|
|
308
256
|
priority,
|
|
257
|
+
signal,
|
|
309
258
|
purpose: "prefetch"
|
|
310
259
|
}), priority), interceptionContext, mountedSlotsHeader, void 0, {
|
|
311
260
|
cacheForNavigation: false,
|
|
@@ -317,8 +266,9 @@ function prefetchUrl(href, mode, priority = "low", pagesRouteHref, locale) {
|
|
|
317
266
|
await shellEntry?.pending?.catch(() => {});
|
|
318
267
|
};
|
|
319
268
|
const fetchAliasCacheHitProbe = async () => {
|
|
320
|
-
const probeHeaders =
|
|
269
|
+
const probeHeaders = createAppPrefetchRequestHeaders({
|
|
321
270
|
interceptionContext,
|
|
271
|
+
fetchPriority: priority,
|
|
322
272
|
renderMode: APP_RSC_RENDER_MODE_PREFETCH_LOADING_SHELL
|
|
323
273
|
});
|
|
324
274
|
probeHeaders.set(NEXT_ROUTER_PREFETCH_HEADER, "1");
|
|
@@ -350,8 +300,9 @@ function prefetchUrl(href, mode, priority = "low", pagesRouteHref, locale) {
|
|
|
350
300
|
await fetchLoadingShellForReuse();
|
|
351
301
|
return fetchFullRscPayload();
|
|
352
302
|
}
|
|
353
|
-
const shellHeaders =
|
|
303
|
+
const shellHeaders = createAppPrefetchRequestHeaders({
|
|
354
304
|
interceptionContext,
|
|
305
|
+
fetchPriority: priority,
|
|
355
306
|
renderMode: void 0
|
|
356
307
|
});
|
|
357
308
|
shellHeaders.set(NEXT_ROUTER_PREFETCH_HEADER, "1");
|
|
@@ -363,10 +314,11 @@ function prefetchUrl(href, mode, priority = "low", pagesRouteHref, locale) {
|
|
|
363
314
|
let shellEntry = shellCache.get(shellCacheKey);
|
|
364
315
|
if (shellEntry === void 0) {
|
|
365
316
|
getPrefetchedUrls().add(shellCacheKey);
|
|
366
|
-
prefetchRscResponse(shellRscUrl, scheduleAppPrefetchFetch(() => fetch(shellRscUrl, {
|
|
317
|
+
prefetchRscResponse(shellRscUrl, scheduleAppPrefetchFetch((signal) => fetch(shellRscUrl, {
|
|
367
318
|
headers: shellHeaders,
|
|
368
319
|
credentials: "include",
|
|
369
320
|
priority,
|
|
321
|
+
signal,
|
|
370
322
|
purpose: "prefetch"
|
|
371
323
|
}), priority), interceptionContext, mountedSlotsHeader, void 0, {
|
|
372
324
|
cacheForNavigation: false,
|
|
@@ -382,19 +334,22 @@ function prefetchUrl(href, mode, priority = "low", pagesRouteHref, locale) {
|
|
|
382
334
|
const cachedRenderedResponse = peekPrefetchResponseForNavigation(renderedRscUrl, interceptionContext, mountedSlotsHeader);
|
|
383
335
|
if (cachedRenderedResponse) return restoreRscResponse(cachedRenderedResponse);
|
|
384
336
|
}
|
|
385
|
-
return scheduleAppPrefetchFetch(() => fetch(rscUrl, {
|
|
337
|
+
return scheduleAppPrefetchFetch((signal) => fetch(rscUrl, {
|
|
386
338
|
headers,
|
|
387
339
|
credentials: "include",
|
|
388
340
|
priority,
|
|
341
|
+
signal,
|
|
389
342
|
purpose: "prefetch"
|
|
390
343
|
}), priority);
|
|
391
344
|
})() : fetchFullRscPayload();
|
|
392
|
-
if (mode === "full" && autoPrefetch.cacheForNavigation && autoPrefetch.prefetchShellFirst && mountedSlotsHeader === null && !gateViaExplicitSearchShell) fetchLoadingShellForReuse();
|
|
345
|
+
if (!__prefetchInlining && mode === "full" && autoPrefetch.cacheForNavigation && autoPrefetch.prefetchShellFirst && mountedSlotsHeader === null && !gateViaExplicitSearchShell) fetchLoadingShellForReuse();
|
|
393
346
|
prefetchRscResponse(rscUrl, fetchPromise, interceptionContext, mountedSlotsHeader, void 0, {
|
|
394
347
|
cacheForNavigation: autoPrefetch.cacheForNavigation,
|
|
395
|
-
fallbackTtlMs: PREFETCH_CACHE_TTL,
|
|
348
|
+
fallbackTtlMs: autoPrefetch.fallbackTtl === "dynamic" ? DYNAMIC_NAVIGATION_CACHE_TTL : PREFETCH_CACHE_TTL,
|
|
349
|
+
honorDynamicStaleTime: autoPrefetch.honorDynamicStaleTime,
|
|
396
350
|
optimisticRouteShell: isOptimisticRouteShellPrefetch,
|
|
397
351
|
prefetchKind: isOptimisticRouteShellPrefetch ? "loading-shell" : "navigation",
|
|
352
|
+
prepareSnapshot: autoPrefetch.cacheForNavigation ? prepareNavigationPrefetchSnapshot : void 0,
|
|
398
353
|
searchAgnosticShell: isAutomaticSearchParamShell && !hasSearchAgnosticShell
|
|
399
354
|
});
|
|
400
355
|
} else if (HAS_PAGES_ROUTER && window.__NEXT_DATA__) {
|
|
@@ -427,7 +382,7 @@ function prefetchUrl(href, mode, priority = "low", pagesRouteHref, locale) {
|
|
|
427
382
|
async function promotePrefetchEntriesForNavigation(href) {
|
|
428
383
|
if (typeof window === "undefined") return;
|
|
429
384
|
if (!hasAppNavigationRuntime()) return;
|
|
430
|
-
const [{ getPrefetchCache }, { stripRscCacheBustingSearchParam, stripRscSuffix }] = await Promise.all([
|
|
385
|
+
const [{ getPrefetchCache }, { stripRscCacheBustingSearchParam, stripRscSuffix }] = await Promise.all([loadNavigationModule(), import("../server/app-rsc-cache-busting.js")]);
|
|
431
386
|
let target;
|
|
432
387
|
try {
|
|
433
388
|
target = new URL(toBrowserNavigationHref(href, window.location.href, __basePath), window.location.href);
|
|
@@ -595,7 +550,7 @@ const Link = forwardRef(function Link({ href, as, replace = false, prefetch: pre
|
|
|
595
550
|
} : null;
|
|
596
551
|
const pagesAsHref = asHref ?? dynamicRouteHref?.as;
|
|
597
552
|
const unresolvedHref = pagesAsHref ?? hrefStr;
|
|
598
|
-
const rawResolvedHref = typeof unresolvedHref === "string" && unresolvedHref.startsWith("#") ? resolvePagesQueryOnlyHref(unresolvedHref) : unresolvedHref;
|
|
553
|
+
const rawResolvedHref = typeof unresolvedHref === "string" && unresolvedHref.startsWith("#") && !getNavigationRuntime()?.functions.navigate ? resolvePagesQueryOnlyHref(unresolvedHref) : unresolvedHref;
|
|
599
554
|
const concreteRouteHref = HAS_PAGES_ROUTER ? resolveConcreteRouteHref(dynamicRouteHref ? hrefForImplicitInterpolation ?? href : href, pagesAsHref) : null;
|
|
600
555
|
const routeHrefRaw = dynamicRouteHref?.href ?? concreteRouteHref ?? hrefStr;
|
|
601
556
|
const prefetchRouteHrefRaw = concreteRouteHref ?? routeHrefRaw;
|
|
@@ -743,19 +698,19 @@ const Link = forwardRef(function Link({ href, as, replace = false, prefetch: pre
|
|
|
743
698
|
onNavigate(navEvent);
|
|
744
699
|
if (navEvent.defaultPrevented) return;
|
|
745
700
|
} catch {}
|
|
746
|
-
const hybridOwner = HAS_PAGES_ROUTER && hasAppNavigationRuntime ?
|
|
701
|
+
const hybridOwner = (HAS_PAGES_ROUTER && hasAppNavigationRuntime ? loadedHybridClientRouteOwnerModule ?? await loadHybridClientRouteOwnerModule() : null)?.resolveHybridClientRouteOwner(navigateHref, __basePath);
|
|
747
702
|
if (HAS_PAGES_ROUTER && hasAppNavigationRuntime && ["pages", "document"].includes(hybridOwner ?? "")) {
|
|
748
703
|
if (replace) window.location.replace(absoluteFullHref);
|
|
749
704
|
else window.location.assign(absoluteFullHref);
|
|
750
705
|
return;
|
|
751
706
|
}
|
|
752
707
|
if (hasAppNavigationRuntime) {
|
|
753
|
-
const { navigateClientSide } = await
|
|
708
|
+
const { navigateClientSide } = loadedNavigationModule ?? await loadNavigationModule();
|
|
754
709
|
const setter = setPendingRef.current;
|
|
755
710
|
if (setter) setLinkForCurrentNavigation(setter);
|
|
756
711
|
setPending(true);
|
|
757
712
|
React.startTransition(() => {
|
|
758
|
-
navigateClientSide(navigateHref, replace ? "replace" : "push", scroll,
|
|
713
|
+
navigateClientSide(navigateHref, replace ? "replace" : "push", scroll, false).finally(() => {
|
|
759
714
|
if (mountedRef.current) setPending(false);
|
|
760
715
|
if (setter) clearLinkForCurrentNavigation(setter);
|
|
761
716
|
});
|
package/dist/shims/metadata.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ThenableParamsObserver } from "./thenable-params.js";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { ResolvedViewport as ResolvedViewport$1, Viewport as Viewport$1 } from "@vinext/types/next/upstream/dist/lib/metadata/types/metadata-interface";
|
|
4
|
-
|
|
5
4
|
//#region src/shims/metadata.d.ts
|
|
6
5
|
type Viewport = Viewport$1;
|
|
7
6
|
type ResolvedViewport = ResolvedViewport$1;
|
|
@@ -19,9 +18,7 @@ declare function mergeViewport(viewportList: readonly Viewport[]): ResolvedViewp
|
|
|
19
18
|
/**
|
|
20
19
|
* React component that renders viewport meta tags into <head>.
|
|
21
20
|
*/
|
|
22
|
-
declare function ViewportHead({
|
|
23
|
-
viewport
|
|
24
|
-
}: {
|
|
21
|
+
declare function ViewportHead({ viewport }: {
|
|
25
22
|
viewport: Viewport;
|
|
26
23
|
}): React.JSX.Element;
|
|
27
24
|
type Metadata = {
|
|
@@ -181,28 +178,19 @@ type SocialImageDescriptor = {
|
|
|
181
178
|
};
|
|
182
179
|
type IconDescriptor = {
|
|
183
180
|
url: string | URL;
|
|
184
|
-
sizes?: string;
|
|
185
181
|
type?: string;
|
|
186
|
-
media?: string;
|
|
187
|
-
};
|
|
188
|
-
type AppleIconDescriptor = {
|
|
189
|
-
url: string | URL;
|
|
190
182
|
sizes?: string;
|
|
191
|
-
|
|
183
|
+
color?: string;
|
|
184
|
+
rel?: string;
|
|
185
|
+
media?: string;
|
|
186
|
+
fetchPriority?: "high" | "low" | "auto";
|
|
192
187
|
};
|
|
193
188
|
type IconInput = string | URL | IconDescriptor;
|
|
194
|
-
type AppleIconInput = string | URL | AppleIconDescriptor;
|
|
195
|
-
type OtherIconDescriptor = {
|
|
196
|
-
rel: string;
|
|
197
|
-
url: string | URL;
|
|
198
|
-
sizes?: string;
|
|
199
|
-
type?: string;
|
|
200
|
-
};
|
|
201
189
|
type IconsMap = {
|
|
202
190
|
icon?: IconInput | IconInput[];
|
|
203
|
-
shortcut?:
|
|
204
|
-
apple?:
|
|
205
|
-
other?:
|
|
191
|
+
shortcut?: IconInput | IconInput[];
|
|
192
|
+
apple?: IconInput | IconInput[];
|
|
193
|
+
other?: IconDescriptor | IconDescriptor[];
|
|
206
194
|
};
|
|
207
195
|
type IconsMetadata = IconInput | IconInput[] | IconsMap;
|
|
208
196
|
type MetadataMergeEntry = {
|
|
@@ -263,14 +251,12 @@ type MetadataHeadProps = {
|
|
|
263
251
|
metadata: Metadata;
|
|
264
252
|
pathname?: string;
|
|
265
253
|
trailingSlash?: boolean;
|
|
254
|
+
streamedIconKey?: string;
|
|
266
255
|
};
|
|
267
256
|
declare function renderMetadataToHtml(metadata: Metadata, pathname?: string, options?: {
|
|
268
257
|
trailingSlash?: boolean;
|
|
258
|
+
streamedIconKey?: string;
|
|
269
259
|
}): string;
|
|
270
|
-
declare function MetadataHead({
|
|
271
|
-
metadata,
|
|
272
|
-
pathname,
|
|
273
|
-
trailingSlash
|
|
274
|
-
}: MetadataHeadProps): React.JSX.Element;
|
|
260
|
+
declare function MetadataHead({ metadata, pathname, trailingSlash, streamedIconKey }: MetadataHeadProps): React.JSX.Element;
|
|
275
261
|
//#endregion
|
|
276
262
|
export { DEFAULT_VIEWPORT, Metadata, MetadataHead, MetadataMergeEntry, ResolvedViewport, Viewport, ViewportHead, mergeMetadata, mergeMetadataEntries, mergeViewport, postProcessMetadata, renderMetadataToHtml, resolveModuleMetadata, resolveModuleViewport };
|
package/dist/shims/metadata.js
CHANGED
|
@@ -420,12 +420,15 @@ function renderMetadataElementToHtml(node) {
|
|
|
420
420
|
"content"
|
|
421
421
|
])}>`;
|
|
422
422
|
case "link": return `<link${renderMetadataAttributes(props, [
|
|
423
|
+
"data-vinext-streamed-icon",
|
|
423
424
|
"rel",
|
|
424
425
|
"href",
|
|
425
426
|
"hrefLang",
|
|
426
|
-
"media",
|
|
427
427
|
"type",
|
|
428
|
-
"sizes"
|
|
428
|
+
"sizes",
|
|
429
|
+
"color",
|
|
430
|
+
"media",
|
|
431
|
+
"fetchPriority"
|
|
429
432
|
])}>`;
|
|
430
433
|
default: return "";
|
|
431
434
|
}
|
|
@@ -434,10 +437,11 @@ function renderMetadataToHtml(metadata, pathname = "/", options) {
|
|
|
434
437
|
return renderMetadataElementToHtml(MetadataHead({
|
|
435
438
|
metadata,
|
|
436
439
|
pathname,
|
|
437
|
-
trailingSlash: options?.trailingSlash
|
|
440
|
+
trailingSlash: options?.trailingSlash,
|
|
441
|
+
streamedIconKey: options?.streamedIconKey
|
|
438
442
|
}));
|
|
439
443
|
}
|
|
440
|
-
function MetadataHead({ metadata, pathname = "/", trailingSlash }) {
|
|
444
|
+
function MetadataHead({ metadata, pathname = "/", trailingSlash, streamedIconKey }) {
|
|
441
445
|
const elements = [];
|
|
442
446
|
let key = 0;
|
|
443
447
|
const base = metadata.metadataBase;
|
|
@@ -725,35 +729,23 @@ function MetadataHead({ metadata, pathname = "/", trailingSlash }) {
|
|
|
725
729
|
}
|
|
726
730
|
if (metadata.icons) {
|
|
727
731
|
const iconEntries = isIconsMap(metadata.icons) ? normalizeUrlDescriptorEntries(metadata.icons.icon, (url) => ({ url })) : normalizeUrlDescriptorEntries(metadata.icons, (url) => ({ url }));
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
for (const
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
...i.type ? { type: i.type } : {},
|
|
740
|
-
...i.media ? { media: i.media } : {}
|
|
741
|
-
}, key++));
|
|
742
|
-
if (isIconsMap(metadata.icons) && metadata.icons.apple) for (const a of normalizeUrlDescriptorEntries(metadata.icons.apple, (url) => ({ url }))) elements.push(/* @__PURE__ */ jsx("link", {
|
|
743
|
-
rel: "apple-touch-icon",
|
|
744
|
-
href: stringifyUrl(a.url),
|
|
745
|
-
...a.sizes ? { sizes: a.sizes } : {},
|
|
746
|
-
...a.type ? { type: a.type } : {}
|
|
747
|
-
}, key++));
|
|
748
|
-
if (isIconsMap(metadata.icons) && metadata.icons.other) {
|
|
749
|
-
const others = Array.isArray(metadata.icons.other) ? metadata.icons.other : [metadata.icons.other];
|
|
750
|
-
for (const o of others) elements.push(/* @__PURE__ */ jsx("link", {
|
|
751
|
-
rel: o.rel,
|
|
752
|
-
href: stringifyUrl(o.url),
|
|
753
|
-
...o.sizes ? { sizes: o.sizes } : {},
|
|
754
|
-
...o.type ? { type: o.type } : {}
|
|
732
|
+
let streamedIconOrder = 0;
|
|
733
|
+
const appendIcons = (entries, defaultRel) => {
|
|
734
|
+
for (const { url, rel, type, sizes, color, media, fetchPriority } of entries) elements.push(/* @__PURE__ */ jsx("link", {
|
|
735
|
+
"data-vinext-streamed-icon": streamedIconKey ? `${streamedIconKey}:${streamedIconOrder++}` : void 0,
|
|
736
|
+
rel: rel || defaultRel,
|
|
737
|
+
href: stringifyUrl(url),
|
|
738
|
+
type,
|
|
739
|
+
sizes,
|
|
740
|
+
color,
|
|
741
|
+
media,
|
|
742
|
+
fetchPriority
|
|
755
743
|
}, key++));
|
|
756
|
-
}
|
|
744
|
+
};
|
|
745
|
+
if (isIconsMap(metadata.icons) && metadata.icons.shortcut) appendIcons(normalizeUrlDescriptorEntries(metadata.icons.shortcut, (url) => ({ url })), "shortcut icon");
|
|
746
|
+
if (iconEntries.length > 0) appendIcons(iconEntries, "icon");
|
|
747
|
+
if (isIconsMap(metadata.icons) && metadata.icons.apple) appendIcons(normalizeUrlDescriptorEntries(metadata.icons.apple, (url) => ({ url })), "apple-touch-icon");
|
|
748
|
+
if (isIconsMap(metadata.icons) && metadata.icons.other) appendIcons(normalizeUrlDescriptorEntries(metadata.icons.other, (url) => ({ url })), "icon");
|
|
757
749
|
}
|
|
758
750
|
if (metadata.manifest) elements.push(/* @__PURE__ */ jsx("link", {
|
|
759
751
|
rel: "manifest",
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { AppRouterScrollIntent } from "./app-router-scroll-state.js";
|
|
2
2
|
import { NavigationRuntimeVisibleCommitMode } from "../client/navigation-runtime.js";
|
|
3
|
+
import { AppElements } from "../server/app-elements-wire.js";
|
|
4
|
+
import "../server/app-elements.js";
|
|
3
5
|
import { AppRouterInstance, NavigateOptions, PrefetchOptions as PrefetchOptions$1 } from "./internal/app-router-context.js";
|
|
4
6
|
import { ReadonlyURLSearchParams } from "./readonly-url-search-params.js";
|
|
7
|
+
import { AppRscRenderMode } from "../server/app-rsc-render-mode.js";
|
|
5
8
|
import { GLOBAL_ACCESSORS_KEY, NavigationContext, NavigationStateAccessors, SegmentMap, ServerInsertedHTMLContext, _registerStateAccessors, clearServerInsertedHTML, flushServerInsertedHTML, getBfcacheIdMapContext, getBfcacheSegmentIdContext, getLayoutSegmentContext, getNavigationContext, renderServerInsertedHTML, setNavigationContext } from "./navigation-context-state.js";
|
|
6
9
|
import { BailoutToCSRError, DynamicServerError, HTTP_ERROR_FALLBACK_ERROR_CODE, RedirectType, decodeRedirectError, forbidden, getAccessFallbackHTTPStatus, isBailoutToCSRError, isDynamicServerError, isHTTPAccessFallbackError, isNextRouterError, isRedirectError, notFound, permanentRedirect, redirect, unauthorized, unstable_rethrow } from "./navigation-errors.js";
|
|
7
10
|
import { UnrecognizedActionError, unstable_isUnrecognizedActionError } from "./unrecognized-action-error.js";
|
|
8
11
|
import * as React$1 from "react";
|
|
9
12
|
import { Params } from "@vinext/types/next/upstream/dist/server/request/params";
|
|
10
|
-
|
|
11
13
|
//#region src/shims/navigation.d.ts
|
|
12
14
|
/** Load rewrite-aware hybrid route ownership before navigation becomes interactive. */
|
|
13
15
|
declare function preloadHybridClientRouteOwner(): Promise<void>;
|
|
@@ -18,16 +20,37 @@ declare const __basePath: string;
|
|
|
18
20
|
declare const MAX_PREFETCH_CACHE_SIZE: number;
|
|
19
21
|
declare const DYNAMIC_NAVIGATION_CACHE_TTL: number;
|
|
20
22
|
declare const PREFETCH_CACHE_TTL: number;
|
|
23
|
+
/**
|
|
24
|
+
* The render's `cacheLife` claim about client reuse. The wire treats the two
|
|
25
|
+
* variants as mutually exclusive — a response carries either the resolved
|
|
26
|
+
* bound (`NEXT_ROUTER_STALE_TIME_HEADER`) or the pending marker
|
|
27
|
+
* (`VINEXT_STALE_TIME_PENDING_HEADER`), never both — so the cached form
|
|
28
|
+
* encodes that rather than trusting every producer to keep them apart.
|
|
29
|
+
*/
|
|
30
|
+
type ServerStaleTime =
|
|
31
|
+
/** Cacheable render streamed before its `cacheLife` resolved; reuse is bounded at the 30s floor. */
|
|
32
|
+
{
|
|
33
|
+
kind: "pending";
|
|
34
|
+
} |
|
|
35
|
+
/** Resolved reuse bound, min-combined with the config-derived `dynamicStaleTimeSeconds`. */
|
|
36
|
+
{
|
|
37
|
+
kind: "resolved";
|
|
38
|
+
seconds: number;
|
|
39
|
+
};
|
|
21
40
|
/** A buffered RSC response stored as an ArrayBuffer for replay. */
|
|
22
41
|
type CachedRscResponse = {
|
|
23
42
|
compatibilityIdHeader?: string | null;
|
|
24
43
|
buffer: ArrayBuffer;
|
|
44
|
+
/** Dynamic bound observed after the RSC stream completed. */
|
|
45
|
+
completedDynamicStaleTimeSeconds?: number;
|
|
25
46
|
contentType: string;
|
|
26
47
|
dynamicStaleTimeSeconds?: number;
|
|
27
48
|
expiresAt?: number;
|
|
28
49
|
mountedSlotsHeader?: string | null;
|
|
29
50
|
paramsHeader: string | null;
|
|
51
|
+
preparedElements?: AppElements;
|
|
30
52
|
renderedPathAndSearch: string | null;
|
|
53
|
+
serverStaleTime?: ServerStaleTime;
|
|
31
54
|
url: string;
|
|
32
55
|
};
|
|
33
56
|
type PrefetchOptions = {
|
|
@@ -45,7 +68,10 @@ type PrefetchCacheEntry = {
|
|
|
45
68
|
outcome: "pending" | "cache-seeded";
|
|
46
69
|
snapshot?: CachedRscResponse;
|
|
47
70
|
cacheKeys?: Set<string>;
|
|
71
|
+
/** The queue-scheduled request, so a consuming navigation can promote it. */
|
|
72
|
+
fetchPromise?: Promise<Response>;
|
|
48
73
|
pending?: Promise<void>;
|
|
74
|
+
preparedElements?: AppElements;
|
|
49
75
|
prefetchKind?: PrefetchCacheKind;
|
|
50
76
|
searchAgnosticShell?: boolean;
|
|
51
77
|
size?: number;
|
|
@@ -54,6 +80,13 @@ type PrefetchCacheEntry = {
|
|
|
54
80
|
declare function getCurrentInterceptionContext(): string | null;
|
|
55
81
|
declare function getPrefetchInterceptionContext(targetHref: string): string | null;
|
|
56
82
|
declare function getCurrentNextUrl(): string;
|
|
83
|
+
declare function createAppPrefetchRequestHeaders(options: {
|
|
84
|
+
fetchPriority: "auto" | "high" | "low";
|
|
85
|
+
interceptionContext?: string | null;
|
|
86
|
+
mountedSlotsHeader?: string | null;
|
|
87
|
+
prefetchKind?: "auto" | "full";
|
|
88
|
+
renderMode?: AppRscRenderMode;
|
|
89
|
+
}): Headers;
|
|
57
90
|
/** Get or create the shared in-memory RSC prefetch cache on window. */
|
|
58
91
|
declare function getPrefetchCache(): Map<string, PrefetchCacheEntry>;
|
|
59
92
|
/**
|
|
@@ -61,14 +94,16 @@ declare function getPrefetchCache(): Map<string, PrefetchCacheEntry>;
|
|
|
61
94
|
* Keyed by interception-aware cache key so distinct source routes do not alias.
|
|
62
95
|
*/
|
|
63
96
|
declare function getPrefetchedUrls(): Set<string>;
|
|
64
|
-
declare function resolveCachedRscResponseTtlMs(cached: Pick<CachedRscResponse, "dynamicStaleTimeSeconds">, fallbackTtlMs: number): number;
|
|
65
|
-
declare function resolveCachedRscResponseExpiresAt(timestamp: number, cached: Pick<CachedRscResponse, "dynamicStaleTimeSeconds" | "expiresAt">, fallbackTtlMs: number): number;
|
|
97
|
+
declare function resolveCachedRscResponseTtlMs(cached: Pick<CachedRscResponse, "dynamicStaleTimeSeconds" | "serverStaleTime">, fallbackTtlMs: number): number;
|
|
98
|
+
declare function resolveCachedRscResponseExpiresAt(timestamp: number, cached: Pick<CachedRscResponse, "dynamicStaleTimeSeconds" | "expiresAt" | "serverStaleTime">, fallbackTtlMs: number): number;
|
|
66
99
|
declare function resolvePrefetchCacheEntryMountedSlotsHeader(entry: PrefetchCacheEntry): string | null;
|
|
67
100
|
declare function hasPrefetchCacheEntryForNavigation(rscUrl: string, interceptionContext?: string | null, mountedSlotsHeader?: string | null, options?: {
|
|
68
101
|
additionalRscUrls?: readonly string[];
|
|
69
102
|
notifyInvalidation?: boolean;
|
|
103
|
+
onInvalidate?: () => void;
|
|
70
104
|
}): boolean;
|
|
71
105
|
declare function hasSearchAgnosticPrefetchShellForRoute(rscUrl: string, interceptionContext?: string | null, mountedSlotsHeader?: string | null): boolean;
|
|
106
|
+
declare function discardLearningOnlyPrefetchCacheEntry(rscUrl: string, interceptionContext?: string | null): boolean;
|
|
72
107
|
declare function invalidatePrefetchCache(): void;
|
|
73
108
|
declare function seedPrefetchResponseSnapshot(rscUrl: string, snapshot: CachedRscResponse, interceptionContext?: string | null, mountedSlotsHeader?: string | null, fallbackTtlMs?: number): void;
|
|
74
109
|
declare function deletePrefetchResponseSnapshot(rscUrl: string, snapshot: CachedRscResponse, interceptionContext?: string | null): void;
|
|
@@ -111,6 +146,13 @@ declare function snapshotRscResponse(response: Response): Promise<CachedRscRespo
|
|
|
111
146
|
* that are deleted after consumption) to avoid the extra allocation.
|
|
112
147
|
*/
|
|
113
148
|
declare function restoreRscResponse(cached: CachedRscResponse, copy?: boolean): Response;
|
|
149
|
+
/**
|
|
150
|
+
* `prefetchRscResponse`'s `prepareSnapshot` for navigation-reusable entries:
|
|
151
|
+
* decode the cached payload through the App Router runtime so a later
|
|
152
|
+
* navigation can commit it without re-parsing. Shared by `<Link>` and
|
|
153
|
+
* `router.prefetch()`.
|
|
154
|
+
*/
|
|
155
|
+
declare function prepareNavigationPrefetchSnapshot(snapshot: CachedRscResponse): Promise<AppElements>;
|
|
114
156
|
/**
|
|
115
157
|
* Prefetch an RSC response and snapshot it for later consumption.
|
|
116
158
|
* Stores the in-flight promise so immediate clicks can await it instead
|
|
@@ -121,17 +163,23 @@ declare function restoreRscResponse(cached: CachedRscResponse, copy?: boolean):
|
|
|
121
163
|
declare function prefetchRscResponse(rscUrl: string, fetchPromise: Promise<Response>, interceptionContext?: string | null, mountedSlotsHeader?: string | null, options?: PrefetchOptions, behavior?: {
|
|
122
164
|
cacheForNavigation?: boolean;
|
|
123
165
|
fallbackTtlMs?: number;
|
|
166
|
+
honorDynamicStaleTime?: boolean;
|
|
124
167
|
optimisticRouteShell?: boolean;
|
|
125
168
|
prefetchKind?: PrefetchCacheKind;
|
|
169
|
+
prepareSnapshot?: (snapshot: CachedRscResponse) => Promise<AppElements>;
|
|
126
170
|
searchAgnosticShell?: boolean;
|
|
127
171
|
}): void;
|
|
128
|
-
declare function peekPrefetchResponseForNavigation(rscUrl: string, interceptionContext?: string | null, mountedSlotsHeader?: string | null
|
|
172
|
+
declare function peekPrefetchResponseForNavigation(rscUrl: string, interceptionContext?: string | null, mountedSlotsHeader?: string | null, options?: {
|
|
173
|
+
additionalRscUrls?: readonly string[];
|
|
174
|
+
}): CachedRscResponse | null;
|
|
129
175
|
/**
|
|
130
176
|
* Consume a prefetched response for a given rscUrl.
|
|
131
177
|
* Only returns settled (non-pending) snapshots synchronously.
|
|
132
178
|
* Returns null if the entry is still in flight or doesn't exist.
|
|
133
179
|
*/
|
|
134
|
-
declare function consumePrefetchResponse(rscUrl: string, interceptionContext?: string | null, mountedSlotsHeader?: string | null
|
|
180
|
+
declare function consumePrefetchResponse(rscUrl: string, interceptionContext?: string | null, mountedSlotsHeader?: string | null, options?: {
|
|
181
|
+
additionalRscUrls?: readonly string[];
|
|
182
|
+
}): CachedRscResponse | null;
|
|
135
183
|
/**
|
|
136
184
|
* Consume a prefetched response for navigation. Unlike the synchronous cache
|
|
137
185
|
* read above, this waits for an already-started prefetch snapshot before
|
|
@@ -303,4 +351,4 @@ declare function useSelectedLayoutSegments(parallelRoutesKey?: string): string[]
|
|
|
303
351
|
*/
|
|
304
352
|
declare function useServerInsertedHTML(callback: () => unknown): void;
|
|
305
353
|
//#endregion
|
|
306
|
-
export { BailoutToCSRError, CachedRscResponse, ClientNavigationRenderSnapshot, DYNAMIC_NAVIGATION_CACHE_TTL, DynamicServerError, GLOBAL_ACCESSORS_KEY, HTTP_ERROR_FALLBACK_ERROR_CODE, MAX_PREFETCH_CACHE_SIZE, type NavigationContext, type NavigationStateAccessors, PREFETCH_CACHE_TTL, PrefetchCacheEntry, PrefetchCacheKind, PrefetchOptions, ReadonlyURLSearchParams, RedirectType, type SegmentMap, ServerInsertedHTMLContext, UnrecognizedActionError, __basePath, _registerStateAccessors, activateNavigationSnapshot, appRouterInstance, applyAppRouterScrollFallback, clearPendingPathname, clearServerInsertedHTML, commitClientNavigationState, consumePrefetchResponse, consumePrefetchResponseForNavigation, createCachedRscResponseSnapshot, createClientNavigationRenderSnapshot, createSnapshotPathAndSearch, decodeRedirectError, deletePrefetchResponseSnapshot, flushServerInsertedHTML, forbidden, getAccessFallbackHTTPStatus, getBfcacheIdMapContext, getBfcacheSegmentIdContext, getClientNavigationRenderContext, getClientNavigationState, getClientParams, getCurrentInterceptionContext, getCurrentNextUrl, getLayoutSegmentContext, getMountedSlotsHeader, getNavigationContext, getPrefetchCache, getPrefetchInterceptionContext, getPrefetchedUrls, hasPrefetchCacheEntryForNavigation, hasSearchAgnosticPrefetchShellForRoute, invalidatePrefetchCache, isBailoutToCSRError, isDynamicServerError, isHTTPAccessFallbackError, isNextRouterError, isRedirectError, navigateClientSide, notFound, peekPrefetchResponseForNavigation, permanentRedirect, prefetchRscResponse, preloadHybridClientRouteOwner, 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 };
|
|
354
|
+
export { BailoutToCSRError, CachedRscResponse, ClientNavigationRenderSnapshot, DYNAMIC_NAVIGATION_CACHE_TTL, DynamicServerError, GLOBAL_ACCESSORS_KEY, HTTP_ERROR_FALLBACK_ERROR_CODE, MAX_PREFETCH_CACHE_SIZE, type NavigationContext, type NavigationStateAccessors, PREFETCH_CACHE_TTL, PrefetchCacheEntry, PrefetchCacheKind, PrefetchOptions, ReadonlyURLSearchParams, RedirectType, type SegmentMap, ServerInsertedHTMLContext, ServerStaleTime, UnrecognizedActionError, __basePath, _registerStateAccessors, activateNavigationSnapshot, appRouterInstance, applyAppRouterScrollFallback, clearPendingPathname, clearServerInsertedHTML, commitClientNavigationState, consumePrefetchResponse, consumePrefetchResponseForNavigation, createAppPrefetchRequestHeaders, createCachedRscResponseSnapshot, createClientNavigationRenderSnapshot, createSnapshotPathAndSearch, decodeRedirectError, deletePrefetchResponseSnapshot, discardLearningOnlyPrefetchCacheEntry, flushServerInsertedHTML, forbidden, getAccessFallbackHTTPStatus, getBfcacheIdMapContext, getBfcacheSegmentIdContext, getClientNavigationRenderContext, getClientNavigationState, getClientParams, getCurrentInterceptionContext, getCurrentNextUrl, getLayoutSegmentContext, getMountedSlotsHeader, getNavigationContext, getPrefetchCache, getPrefetchInterceptionContext, getPrefetchedUrls, hasPrefetchCacheEntryForNavigation, hasSearchAgnosticPrefetchShellForRoute, invalidatePrefetchCache, isBailoutToCSRError, isDynamicServerError, isHTTPAccessFallbackError, isNextRouterError, isRedirectError, navigateClientSide, notFound, 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 };
|