@rangojs/router 0.1.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/types/browser/prefetch/default-strategy.d.ts +22 -0
- package/dist/types/browser/prefetch/runtime.d.ts +0 -1
- package/dist/types/browser/react/Link.d.ts +8 -11
- package/dist/types/browser/types.d.ts +5 -0
- package/dist/types/cache/document-cache.d.ts +3 -1
- package/dist/types/cache/types.d.ts +10 -3
- package/dist/types/route-definition/helpers-types.d.ts +6 -6
- package/dist/types/router/match-handlers.d.ts +2 -3
- package/dist/types/router/prefetch-default.d.ts +28 -0
- package/dist/types/router/router-interfaces.d.ts +7 -0
- package/dist/types/router/router-options.d.ts +30 -0
- package/dist/types/router/segment-resolution/view-transition-default.d.ts +3 -4
- package/dist/types/router/transition-when.d.ts +13 -0
- package/dist/types/rsc/capture-queue.d.ts +6 -0
- package/dist/types/rsc/shell-capture.d.ts +15 -7
- package/dist/types/rsc/shell-serve.d.ts +6 -3
- package/dist/types/rsc/transition-gate.d.ts +10 -14
- package/dist/types/rsc/types.d.ts +2 -0
- package/dist/types/server/request-context.d.ts +5 -1
- package/dist/types/testing/e2e/index.d.ts +3 -3
- package/dist/types/testing/e2e/page-helpers.d.ts +24 -0
- package/dist/types/testing/index.d.ts +2 -2
- package/dist/types/testing/run-transition-when.d.ts +6 -5
- package/dist/types/testing/shell-status.d.ts +23 -3
- package/dist/types/types/segments.d.ts +27 -22
- package/dist/types/urls/path-helper-types.d.ts +4 -3
- package/dist/types.backup/__internal.d.ts +127 -0
- package/dist/types.backup/bin/rango.d.ts +1 -0
- package/dist/types.backup/browser/action-coordinator.d.ts +57 -0
- package/dist/types.backup/browser/action-fence.d.ts +33 -0
- package/dist/types.backup/browser/app-shell.d.ts +34 -0
- package/dist/types.backup/browser/app-version.d.ts +6 -0
- package/dist/types.backup/browser/connection-warmup.d.ts +31 -0
- package/dist/types.backup/browser/cookie-name.d.ts +66 -0
- package/dist/types.backup/browser/event-controller.d.ts +221 -0
- package/dist/types.backup/browser/history-state.d.ts +26 -0
- package/dist/types.backup/browser/index.d.ts +1 -0
- package/dist/types.backup/browser/intercept-utils.d.ts +30 -0
- package/dist/types.backup/browser/invalidate-client-cache.d.ts +17 -0
- package/dist/types.backup/browser/link-interceptor.d.ts +43 -0
- package/dist/types.backup/browser/logging.d.ts +33 -0
- package/dist/types.backup/browser/merge-segment-loaders.d.ts +38 -0
- package/dist/types.backup/browser/navigation-bridge.d.ts +27 -0
- package/dist/types.backup/browser/navigation-client.d.ts +17 -0
- package/dist/types.backup/browser/navigation-store-handle.d.ts +25 -0
- package/dist/types.backup/browser/navigation-store.d.ts +95 -0
- package/dist/types.backup/browser/navigation-transaction.d.ts +75 -0
- package/dist/types.backup/browser/network-error-handler.d.ts +35 -0
- package/dist/types.backup/browser/partial-update.d.ts +61 -0
- package/dist/types.backup/browser/prefetch/cache.d.ts +183 -0
- package/dist/types.backup/browser/prefetch/fetch.d.ts +52 -0
- package/dist/types.backup/browser/prefetch/observer.d.ts +27 -0
- package/dist/types.backup/browser/prefetch/policy.d.ts +13 -0
- package/dist/types.backup/browser/prefetch/queue.d.ts +48 -0
- package/dist/types.backup/browser/prefetch/resource-ready.d.ts +28 -0
- package/dist/types.backup/browser/rango-state.d.ts +52 -0
- package/dist/types.backup/browser/react/Link.d.ts +140 -0
- package/dist/types.backup/browser/react/NavigationProvider.d.ts +88 -0
- package/dist/types.backup/browser/react/ScrollRestoration.d.ts +78 -0
- package/dist/types.backup/browser/react/context.d.ts +54 -0
- package/dist/types.backup/browser/react/filter-segment-order.d.ts +35 -0
- package/dist/types.backup/browser/react/index.d.ts +1 -0
- package/dist/types.backup/browser/react/location-state-shared.d.ts +162 -0
- package/dist/types.backup/browser/react/location-state.d.ts +29 -0
- package/dist/types.backup/browser/react/mount-context.d.ts +23 -0
- package/dist/types.backup/browser/react/nonce-context.d.ts +14 -0
- package/dist/types.backup/browser/react/shallow-equal.d.ts +5 -0
- package/dist/types.backup/browser/react/use-action.d.ts +61 -0
- package/dist/types.backup/browser/react/use-handle.d.ts +21 -0
- package/dist/types.backup/browser/react/use-href.d.ts +32 -0
- package/dist/types.backup/browser/react/use-link-status.d.ts +36 -0
- package/dist/types.backup/browser/react/use-mount.d.ts +24 -0
- package/dist/types.backup/browser/react/use-navigation.d.ts +15 -0
- package/dist/types.backup/browser/react/use-params.d.ts +21 -0
- package/dist/types.backup/browser/react/use-pathname.d.ts +13 -0
- package/dist/types.backup/browser/react/use-reverse.d.ts +40 -0
- package/dist/types.backup/browser/react/use-router.d.ts +23 -0
- package/dist/types.backup/browser/react/use-search-params.d.ts +19 -0
- package/dist/types.backup/browser/react/use-segments.d.ts +29 -0
- package/dist/types.backup/browser/response-adapter.d.ts +58 -0
- package/dist/types.backup/browser/rsc-router.d.ts +141 -0
- package/dist/types.backup/browser/scroll-restoration.d.ts +103 -0
- package/dist/types.backup/browser/segment-reconciler.d.ts +74 -0
- package/dist/types.backup/browser/segment-structure-assert.d.ts +16 -0
- package/dist/types.backup/browser/server-action-bridge.d.ts +29 -0
- package/dist/types.backup/browser/types.d.ts +530 -0
- package/dist/types.backup/browser/validate-redirect-origin.d.ts +28 -0
- package/dist/types.backup/build/collect-fallback-refs.d.ts +5 -0
- package/dist/types.backup/build/generate-manifest.d.ts +100 -0
- package/dist/types.backup/build/generate-route-types.d.ts +8 -0
- package/dist/types.backup/build/index.d.ts +21 -0
- package/dist/types.backup/build/prefix-tree-utils.d.ts +56 -0
- package/dist/types.backup/build/route-trie.d.ts +89 -0
- package/dist/types.backup/build/route-types/ast-helpers.d.ts +3 -0
- package/dist/types.backup/build/route-types/ast-route-extraction.d.ts +13 -0
- package/dist/types.backup/build/route-types/codegen.d.ts +16 -0
- package/dist/types.backup/build/route-types/include-resolution.d.ts +74 -0
- package/dist/types.backup/build/route-types/param-extraction.d.ts +13 -0
- package/dist/types.backup/build/route-types/per-module-writer.d.ts +18 -0
- package/dist/types.backup/build/route-types/router-processing.d.ts +82 -0
- package/dist/types.backup/build/route-types/scan-filter.d.ts +17 -0
- package/dist/types.backup/build/route-types/source-scan.d.ts +13 -0
- package/dist/types.backup/build/runtime-discovery.d.ts +24 -0
- package/dist/types.backup/cache/background-task.d.ts +21 -0
- package/dist/types.backup/cache/cache-error.d.ts +71 -0
- package/dist/types.backup/cache/cache-key-utils.d.ts +35 -0
- package/dist/types.backup/cache/cache-policy.d.ts +59 -0
- package/dist/types.backup/cache/cache-runtime.d.ts +51 -0
- package/dist/types.backup/cache/cache-scope.d.ts +134 -0
- package/dist/types.backup/cache/cache-tag.d.ts +79 -0
- package/dist/types.backup/cache/cf/cf-base64.d.ts +4 -0
- package/dist/types.backup/cache/cf/cf-cache-constants.d.ts +105 -0
- package/dist/types.backup/cache/cf/cf-cache-store.d.ts +481 -0
- package/dist/types.backup/cache/cf/cf-cache-types.d.ts +300 -0
- package/dist/types.backup/cache/cf/cf-kv-utils.d.ts +22 -0
- package/dist/types.backup/cache/cf/cf-tag-marker-memo.d.ts +15 -0
- package/dist/types.backup/cache/cf/index.d.ts +3 -0
- package/dist/types.backup/cache/document-cache.d.ts +69 -0
- package/dist/types.backup/cache/handle-capture.d.ts +23 -0
- package/dist/types.backup/cache/handle-snapshot.d.ts +39 -0
- package/dist/types.backup/cache/index.d.ts +7 -0
- package/dist/types.backup/cache/memory-segment-store.d.ts +163 -0
- package/dist/types.backup/cache/profile-registry.d.ts +40 -0
- package/dist/types.backup/cache/read-through-swr.d.ts +60 -0
- package/dist/types.backup/cache/segment-codec.d.ts +78 -0
- package/dist/types.backup/cache/shell-snapshot.d.ts +162 -0
- package/dist/types.backup/cache/tag-invalidation.d.ts +74 -0
- package/dist/types.backup/cache/taint.d.ts +71 -0
- package/dist/types.backup/cache/types.d.ts +407 -0
- package/dist/types.backup/cache/vercel/index.d.ts +1 -0
- package/dist/types.backup/cache/vercel/vercel-cache-store.d.ts +267 -0
- package/dist/types.backup/client.d.ts +184 -0
- package/dist/types.backup/client.rsc.d.ts +39 -0
- package/dist/types.backup/cloudflare/index.d.ts +7 -0
- package/dist/types.backup/cloudflare/tracing.d.ts +53 -0
- package/dist/types.backup/component-utils.d.ts +46 -0
- package/dist/types.backup/components/DefaultDocument.d.ts +13 -0
- package/dist/types.backup/context-var.d.ts +84 -0
- package/dist/types.backup/debug.d.ts +57 -0
- package/dist/types.backup/decode-loader-results.d.ts +5 -0
- package/dist/types.backup/default-error-boundary.d.ts +10 -0
- package/dist/types.backup/defer.d.ts +89 -0
- package/dist/types.backup/deps/browser.d.ts +1 -0
- package/dist/types.backup/deps/html-stream-client.d.ts +1 -0
- package/dist/types.backup/deps/html-stream-server.d.ts +1 -0
- package/dist/types.backup/deps/rsc.d.ts +1 -0
- package/dist/types.backup/deps/ssr.d.ts +1 -0
- package/dist/types.backup/encode-kv.d.ts +35 -0
- package/dist/types.backup/errors.d.ts +226 -0
- package/dist/types.backup/escape-script.d.ts +44 -0
- package/dist/types.backup/handle.d.ts +93 -0
- package/dist/types.backup/handles/MetaTags.d.ts +17 -0
- package/dist/types.backup/handles/Scripts.d.ts +38 -0
- package/dist/types.backup/handles/breadcrumbs.d.ts +43 -0
- package/dist/types.backup/handles/deferred-resolution.d.ts +53 -0
- package/dist/types.backup/handles/is-thenable.d.ts +12 -0
- package/dist/types.backup/handles/meta.d.ts +43 -0
- package/dist/types.backup/handles/script.d.ts +139 -0
- package/dist/types.backup/host/cookie-handler.d.ts +8 -0
- package/dist/types.backup/host/errors.d.ts +40 -0
- package/dist/types.backup/host/index.d.ts +33 -0
- package/dist/types.backup/host/pattern-matcher.d.ts +30 -0
- package/dist/types.backup/host/router.d.ts +12 -0
- package/dist/types.backup/host/testing.d.ts +41 -0
- package/dist/types.backup/host/types.d.ts +148 -0
- package/dist/types.backup/host/utils.d.ts +20 -0
- package/dist/types.backup/href-client.d.ts +214 -0
- package/dist/types.backup/index.d.ts +112 -0
- package/dist/types.backup/index.rsc.d.ts +51 -0
- package/dist/types.backup/internal-debug.d.ts +1 -0
- package/dist/types.backup/loader-store.d.ts +193 -0
- package/dist/types.backup/loader.d.ts +18 -0
- package/dist/types.backup/loader.rsc.d.ts +18 -0
- package/dist/types.backup/missing-id-error.d.ts +1 -0
- package/dist/types.backup/outlet-context.d.ts +12 -0
- package/dist/types.backup/outlet-provider.d.ts +12 -0
- package/dist/types.backup/prerender/build-shell-capture.d.ts +104 -0
- package/dist/types.backup/prerender/param-hash.d.ts +6 -0
- package/dist/types.backup/prerender/shell-manifest-key.d.ts +18 -0
- package/dist/types.backup/prerender/store.d.ts +62 -0
- package/dist/types.backup/prerender.d.ts +292 -0
- package/dist/types.backup/redirect-origin.d.ts +55 -0
- package/dist/types.backup/regex-escape.d.ts +6 -0
- package/dist/types.backup/render-error-thrower.d.ts +13 -0
- package/dist/types.backup/response-utils.d.ts +35 -0
- package/dist/types.backup/reverse.d.ts +206 -0
- package/dist/types.backup/root-error-boundary.d.ts +32 -0
- package/dist/types.backup/route-content-wrapper.d.ts +40 -0
- package/dist/types.backup/route-definition/dsl-helpers.d.ts +130 -0
- package/dist/types.backup/route-definition/helper-factories.d.ts +22 -0
- package/dist/types.backup/route-definition/helpers-types.d.ts +392 -0
- package/dist/types.backup/route-definition/index.d.ts +7 -0
- package/dist/types.backup/route-definition/redirect.d.ts +48 -0
- package/dist/types.backup/route-definition/resolve-handler-use.d.ts +19 -0
- package/dist/types.backup/route-definition/use-item-types.d.ts +1 -0
- package/dist/types.backup/route-definition.d.ts +1 -0
- package/dist/types.backup/route-map-builder.d.ts +127 -0
- package/dist/types.backup/route-name.d.ts +27 -0
- package/dist/types.backup/route-types.d.ts +172 -0
- package/dist/types.backup/router/basename.d.ts +10 -0
- package/dist/types.backup/router/content-negotiation.d.ts +91 -0
- package/dist/types.backup/router/debug-manifest.d.ts +7 -0
- package/dist/types.backup/router/error-handling.d.ts +76 -0
- package/dist/types.backup/router/find-match.d.ts +19 -0
- package/dist/types.backup/router/handler-context.d.ts +41 -0
- package/dist/types.backup/router/instrument.d.ts +161 -0
- package/dist/types.backup/router/intercept-resolution.d.ts +79 -0
- package/dist/types.backup/router/lazy-includes.d.ts +26 -0
- package/dist/types.backup/router/loader-resolution.d.ts +63 -0
- package/dist/types.backup/router/logging.d.ts +41 -0
- package/dist/types.backup/router/manifest.d.ts +8 -0
- package/dist/types.backup/router/match-api.d.ts +19 -0
- package/dist/types.backup/router/match-context.d.ts +184 -0
- package/dist/types.backup/router/match-handlers.d.ts +49 -0
- package/dist/types.backup/router/match-middleware/background-revalidation.d.ts +113 -0
- package/dist/types.backup/router/match-middleware/cache-lookup.d.ts +113 -0
- package/dist/types.backup/router/match-middleware/cache-store.d.ts +112 -0
- package/dist/types.backup/router/match-middleware/index.d.ts +80 -0
- package/dist/types.backup/router/match-middleware/intercept-resolution.d.ts +116 -0
- package/dist/types.backup/router/match-middleware/segment-resolution.d.ts +94 -0
- package/dist/types.backup/router/match-pipelines.d.ts +103 -0
- package/dist/types.backup/router/match-result.d.ts +114 -0
- package/dist/types.backup/router/metrics.d.ts +6 -0
- package/dist/types.backup/router/middleware-types.d.ts +74 -0
- package/dist/types.backup/router/middleware.d.ts +116 -0
- package/dist/types.backup/router/navigation-snapshot.d.ts +22 -0
- package/dist/types.backup/router/params-util.d.ts +8 -0
- package/dist/types.backup/router/parse-pattern.d.ts +38 -0
- package/dist/types.backup/router/pattern-matching.d.ts +169 -0
- package/dist/types.backup/router/prefetch-cache-ttl.d.ts +27 -0
- package/dist/types.backup/router/prefetch-limits.d.ts +20 -0
- package/dist/types.backup/router/prerender-match.d.ts +50 -0
- package/dist/types.backup/router/preview-match.d.ts +22 -0
- package/dist/types.backup/router/request-classification.d.ts +104 -0
- package/dist/types.backup/router/revalidation.d.ts +57 -0
- package/dist/types.backup/router/route-snapshot.d.ts +112 -0
- package/dist/types.backup/router/router-context.d.ts +137 -0
- package/dist/types.backup/router/router-interfaces.d.ts +432 -0
- package/dist/types.backup/router/router-options.d.ts +738 -0
- package/dist/types.backup/router/router-registry.d.ts +15 -0
- package/dist/types.backup/router/segment-resolution/fresh.d.ts +55 -0
- package/dist/types.backup/router/segment-resolution/helpers.d.ts +93 -0
- package/dist/types.backup/router/segment-resolution/loader-cache.d.ts +33 -0
- package/dist/types.backup/router/segment-resolution/loader-mask.d.ts +44 -0
- package/dist/types.backup/router/segment-resolution/loader-snapshot.d.ts +90 -0
- package/dist/types.backup/router/segment-resolution/mask-nested.d.ts +53 -0
- package/dist/types.backup/router/segment-resolution/revalidation.d.ts +85 -0
- package/dist/types.backup/router/segment-resolution/static-store.d.ts +17 -0
- package/dist/types.backup/router/segment-resolution/streamed-handler-telemetry.d.ts +16 -0
- package/dist/types.backup/router/segment-resolution/view-transition-default.d.ts +28 -0
- package/dist/types.backup/router/segment-resolution.d.ts +3 -0
- package/dist/types.backup/router/segment-wrappers.d.ts +53 -0
- package/dist/types.backup/router/state-cookie-name.d.ts +1 -0
- package/dist/types.backup/router/substitute-pattern-params.d.ts +23 -0
- package/dist/types.backup/router/telemetry-otel.d.ts +113 -0
- package/dist/types.backup/router/telemetry.d.ts +215 -0
- package/dist/types.backup/router/timeout.d.ts +68 -0
- package/dist/types.backup/router/tracing.d.ts +125 -0
- package/dist/types.backup/router/trie-matching.d.ts +32 -0
- package/dist/types.backup/router/types.d.ts +98 -0
- package/dist/types.backup/router/url-params.d.ts +26 -0
- package/dist/types.backup/router.d.ts +7 -0
- package/dist/types.backup/rsc/capture-queue.d.ts +6 -0
- package/dist/types.backup/rsc/full-payload.d.ts +22 -0
- package/dist/types.backup/rsc/handler-context.d.ts +31 -0
- package/dist/types.backup/rsc/handler.d.ts +9 -0
- package/dist/types.backup/rsc/helpers.d.ts +213 -0
- package/dist/types.backup/rsc/index.d.ts +17 -0
- package/dist/types.backup/rsc/json-route-result.d.ts +20 -0
- package/dist/types.backup/rsc/loader-fetch.d.ts +14 -0
- package/dist/types.backup/rsc/manifest-init.d.ts +18 -0
- package/dist/types.backup/rsc/nonce.d.ts +28 -0
- package/dist/types.backup/rsc/origin-guard.d.ts +50 -0
- package/dist/types.backup/rsc/progressive-enhancement.d.ts +19 -0
- package/dist/types.backup/rsc/redirect-guard.d.ts +35 -0
- package/dist/types.backup/rsc/response-cache-serve.d.ts +46 -0
- package/dist/types.backup/rsc/response-error.d.ts +19 -0
- package/dist/types.backup/rsc/response-route-handler.d.ts +29 -0
- package/dist/types.backup/rsc/rsc-rendering.d.ts +23 -0
- package/dist/types.backup/rsc/runtime-warnings.d.ts +22 -0
- package/dist/types.backup/rsc/server-action.d.ts +68 -0
- package/dist/types.backup/rsc/shell-build-manifest.d.ts +84 -0
- package/dist/types.backup/rsc/shell-capture-constants.d.ts +27 -0
- package/dist/types.backup/rsc/shell-capture.d.ts +374 -0
- package/dist/types.backup/rsc/shell-serve.d.ts +136 -0
- package/dist/types.backup/rsc/ssr-setup.d.ts +48 -0
- package/dist/types.backup/rsc/transition-gate.d.ts +27 -0
- package/dist/types.backup/rsc/types.d.ts +290 -0
- package/dist/types.backup/runtime-env.d.ts +1 -0
- package/dist/types.backup/search-params.d.ts +125 -0
- package/dist/types.backup/segment-content-promise.d.ts +13 -0
- package/dist/types.backup/segment-fragments.d.ts +56 -0
- package/dist/types.backup/segment-loader-promise.d.ts +22 -0
- package/dist/types.backup/segment-system.d.ts +84 -0
- package/dist/types.backup/serialize.d.ts +164 -0
- package/dist/types.backup/server/context.d.ts +494 -0
- package/dist/types.backup/server/cookie-parse.d.ts +10 -0
- package/dist/types.backup/server/cookie-store.d.ts +107 -0
- package/dist/types.backup/server/fetchable-loader-store.d.ts +20 -0
- package/dist/types.backup/server/handle-store.d.ts +100 -0
- package/dist/types.backup/server/loader-registry.d.ts +32 -0
- package/dist/types.backup/server/request-context.d.ts +596 -0
- package/dist/types.backup/server/root-layout.d.ts +3 -0
- package/dist/types.backup/server.d.ts +15 -0
- package/dist/types.backup/ssr/index.d.ts +233 -0
- package/dist/types.backup/ssr/inject-rsc-eager.d.ts +3 -0
- package/dist/types.backup/ssr/preinit-client-references.d.ts +71 -0
- package/dist/types.backup/ssr/ssr-root.d.ts +69 -0
- package/dist/types.backup/static-handler.d.ts +57 -0
- package/dist/types.backup/testing/cache-status.d.ts +63 -0
- package/dist/types.backup/testing/collect-handle.d.ts +20 -0
- package/dist/types.backup/testing/dispatch.d.ts +123 -0
- package/dist/types.backup/testing/dom.entry.d.ts +15 -0
- package/dist/types.backup/testing/e2e/fixture.d.ts +37 -0
- package/dist/types.backup/testing/e2e/index.d.ts +30 -0
- package/dist/types.backup/testing/e2e/matchers.d.ts +17 -0
- package/dist/types.backup/testing/e2e/page-helpers.d.ts +62 -0
- package/dist/types.backup/testing/e2e/parity.d.ts +111 -0
- package/dist/types.backup/testing/e2e/server.d.ts +35 -0
- package/dist/types.backup/testing/flight-matchers.d.ts +55 -0
- package/dist/types.backup/testing/flight-normalize.d.ts +1 -0
- package/dist/types.backup/testing/flight-tree.d.ts +192 -0
- package/dist/types.backup/testing/flight.d.ts +115 -0
- package/dist/types.backup/testing/flight.entry.d.ts +27 -0
- package/dist/types.backup/testing/generated-routes.d.ts +66 -0
- package/dist/types.backup/testing/index.d.ts +52 -0
- package/dist/types.backup/testing/internal/context.d.ts +225 -0
- package/dist/types.backup/testing/internal/flight-client-globals.d.ts +1 -0
- package/dist/types.backup/testing/internal/seed-vars.d.ts +30 -0
- package/dist/types.backup/testing/render-handler.d.ts +160 -0
- package/dist/types.backup/testing/render-route.d.ts +246 -0
- package/dist/types.backup/testing/run-loader.d.ts +186 -0
- package/dist/types.backup/testing/run-middleware.d.ts +132 -0
- package/dist/types.backup/testing/run-transition-when.d.ts +77 -0
- package/dist/types.backup/testing/vitest-stubs/cloudflare-email.d.ts +6 -0
- package/dist/types.backup/testing/vitest-stubs/cloudflare-workers.d.ts +13 -0
- package/dist/types.backup/testing/vitest-stubs/plugin-rsc.d.ts +7 -0
- package/dist/types.backup/testing/vitest-stubs/version.d.ts +1 -0
- package/dist/types.backup/testing/vitest.d.ts +205 -0
- package/dist/types.backup/theme/ThemeProvider.d.ts +13 -0
- package/dist/types.backup/theme/ThemeScript.d.ts +45 -0
- package/dist/types.backup/theme/constants.d.ts +39 -0
- package/dist/types.backup/theme/index.d.ts +29 -0
- package/dist/types.backup/theme/theme-context.d.ts +21 -0
- package/dist/types.backup/theme/theme-script.d.ts +26 -0
- package/dist/types.backup/theme/types.d.ts +162 -0
- package/dist/types.backup/theme/use-theme.d.ts +8 -0
- package/dist/types.backup/types/boundaries.d.ts +93 -0
- package/dist/types.backup/types/cache-types.d.ts +191 -0
- package/dist/types.backup/types/error-types.d.ts +114 -0
- package/dist/types.backup/types/global-namespace.d.ts +90 -0
- package/dist/types.backup/types/handler-context.d.ts +658 -0
- package/dist/types.backup/types/index.d.ts +11 -0
- package/dist/types.backup/types/loader-types.d.ts +182 -0
- package/dist/types.backup/types/request-scope.d.ts +93 -0
- package/dist/types.backup/types/route-config.d.ts +105 -0
- package/dist/types.backup/types/route-entry.d.ts +95 -0
- package/dist/types.backup/types/segments.d.ts +234 -0
- package/dist/types.backup/types.d.ts +1 -0
- package/dist/types.backup/urls/include-helper.d.ts +17 -0
- package/dist/types.backup/urls/include-provider.d.ts +27 -0
- package/dist/types.backup/urls/index.d.ts +6 -0
- package/dist/types.backup/urls/path-helper-types.d.ts +197 -0
- package/dist/types.backup/urls/path-helper.d.ts +12 -0
- package/dist/types.backup/urls/pattern-types.d.ts +166 -0
- package/dist/types.backup/urls/response-types.d.ts +67 -0
- package/dist/types.backup/urls/type-extraction.d.ts +157 -0
- package/dist/types.backup/urls/urls-function.d.ts +24 -0
- package/dist/types.backup/urls.d.ts +1 -0
- package/dist/types.backup/use-loader.d.ts +150 -0
- package/dist/types.backup/vercel/index.d.ts +10 -0
- package/dist/types.backup/vercel/tracing.d.ts +70 -0
- package/dist/types.backup/vite/debug.d.ts +80 -0
- package/dist/types.backup/vite/discovery/bundle-postprocess.d.ts +12 -0
- package/dist/types.backup/vite/discovery/dev-prerender-cache.d.ts +65 -0
- package/dist/types.backup/vite/discovery/discover-routers.d.ts +17 -0
- package/dist/types.backup/vite/discovery/discovery-errors.d.ts +113 -0
- package/dist/types.backup/vite/discovery/gate-state.d.ts +79 -0
- package/dist/types.backup/vite/discovery/prerender-collection.d.ts +24 -0
- package/dist/types.backup/vite/discovery/route-types-writer.d.ts +32 -0
- package/dist/types.backup/vite/discovery/self-gen-tracking.d.ts +22 -0
- package/dist/types.backup/vite/discovery/shell-prerender-phase.d.ts +40 -0
- package/dist/types.backup/vite/discovery/state.d.ts +162 -0
- package/dist/types.backup/vite/discovery/virtual-module-codegen.d.ts +15 -0
- package/dist/types.backup/vite/index.d.ts +11 -0
- package/dist/types.backup/vite/inject-client-debug.d.ts +56 -0
- package/dist/types.backup/vite/plugin-types.d.ts +298 -0
- package/dist/types.backup/vite/plugins/cjs-to-esm.d.ts +6 -0
- package/dist/types.backup/vite/plugins/client-ref-dedup.d.ts +40 -0
- package/dist/types.backup/vite/plugins/client-ref-hashing.d.ts +35 -0
- package/dist/types.backup/vite/plugins/cloudflare-protocol-stub.d.ts +64 -0
- package/dist/types.backup/vite/plugins/expose-action-id.d.ts +18 -0
- package/dist/types.backup/vite/plugins/expose-id-utils.d.ts +37 -0
- package/dist/types.backup/vite/plugins/expose-ids/export-analysis.d.ts +19 -0
- package/dist/types.backup/vite/plugins/expose-ids/handler-transform.d.ts +10 -0
- package/dist/types.backup/vite/plugins/expose-ids/loader-transform.d.ts +8 -0
- package/dist/types.backup/vite/plugins/expose-ids/router-transform.d.ts +13 -0
- package/dist/types.backup/vite/plugins/expose-ids/types.d.ts +29 -0
- package/dist/types.backup/vite/plugins/expose-internal-ids.d.ts +6 -0
- package/dist/types.backup/vite/plugins/performance-tracks.d.ts +25 -0
- package/dist/types.backup/vite/plugins/refresh-cmd.d.ts +20 -0
- package/dist/types.backup/vite/plugins/use-cache-transform.d.ts +20 -0
- package/dist/types.backup/vite/plugins/vercel-output.d.ts +85 -0
- package/dist/types.backup/vite/plugins/version-injector.d.ts +21 -0
- package/dist/types.backup/vite/plugins/version-plugin.d.ts +19 -0
- package/dist/types.backup/vite/plugins/virtual-entries.d.ts +36 -0
- package/dist/types.backup/vite/plugins/virtual-stub-plugin.d.ts +7 -0
- package/dist/types.backup/vite/rango.d.ts +29 -0
- package/dist/types.backup/vite/router-discovery.d.ts +23 -0
- package/dist/types.backup/vite/utils/ast-handler-extract.d.ts +64 -0
- package/dist/types.backup/vite/utils/banner.d.ts +2 -0
- package/dist/types.backup/vite/utils/bundle-analysis.d.ts +28 -0
- package/dist/types.backup/vite/utils/client-chunks.d.ts +55 -0
- package/dist/types.backup/vite/utils/directive-prologue.d.ts +16 -0
- package/dist/types.backup/vite/utils/forward-user-plugins.d.ts +37 -0
- package/dist/types.backup/vite/utils/manifest-utils.d.ts +7 -0
- package/dist/types.backup/vite/utils/package-resolution.d.ts +6 -0
- package/dist/types.backup/vite/utils/prerender-utils.d.ts +32 -0
- package/dist/types.backup/vite/utils/shared-utils.d.ts +55 -0
- package/dist/vite/index.js +5 -2
- package/package.json +20 -21
- package/skills/cache-guide/SKILL.md +6 -3
- package/skills/catalog.json +7 -1
- package/skills/comparison/references/framework-comparison.md +2 -1
- package/skills/deployment-caching/SKILL.md +176 -0
- package/skills/document-cache/SKILL.md +30 -3
- package/skills/ppr/SKILL.md +81 -34
- package/skills/prerender/SKILL.md +15 -8
- package/skills/rango/SKILL.md +20 -17
- package/skills/router-setup/SKILL.md +4 -0
- package/skills/testing/SKILL.md +1 -1
- package/skills/testing/cache-prerender.md +5 -1
- package/skills/vercel/SKILL.md +22 -1
- package/skills/view-transitions/SKILL.md +12 -8
- package/src/browser/prefetch/default-strategy.ts +34 -0
- package/src/browser/prefetch/loader.ts +6 -12
- package/src/browser/prefetch/runtime.ts +0 -1
- package/src/browser/react/Link.tsx +22 -21
- package/src/browser/rsc-router.tsx +8 -0
- package/src/browser/types.ts +5 -0
- package/src/cache/cache-scope.ts +6 -1
- package/src/cache/cf/cf-cache-store.ts +4 -0
- package/src/cache/document-cache.ts +4 -2
- package/src/cache/types.ts +10 -3
- package/src/cache/vercel/vercel-cache-store.ts +6 -1
- package/src/route-definition/helpers-types.ts +6 -6
- package/src/router/match-handlers.ts +44 -6
- package/src/router/match-middleware/cache-lookup.ts +10 -3
- package/src/router/prefetch-default.ts +59 -0
- package/src/router/router-interfaces.ts +8 -0
- package/src/router/router-options.ts +31 -0
- package/src/router/segment-resolution/view-transition-default.ts +9 -5
- package/src/router/transition-when.ts +76 -0
- package/src/router.ts +7 -0
- package/src/rsc/capture-queue.ts +24 -1
- package/src/rsc/full-payload.ts +1 -0
- package/src/rsc/handler.ts +1 -0
- package/src/rsc/progressive-enhancement.ts +9 -14
- package/src/rsc/rsc-rendering.ts +261 -48
- package/src/rsc/shell-capture.ts +94 -50
- package/src/rsc/shell-serve.ts +9 -4
- package/src/rsc/transition-gate.ts +37 -40
- package/src/rsc/types.ts +2 -0
- package/src/server/request-context.ts +6 -0
- package/src/testing/e2e/index.ts +11 -0
- package/src/testing/e2e/page-helpers.ts +47 -0
- package/src/testing/e2e/parity.ts +13 -0
- package/src/testing/index.ts +9 -1
- package/src/testing/run-transition-when.ts +42 -9
- package/src/testing/shell-status.ts +92 -3
- package/src/types/segments.ts +27 -22
- package/src/urls/path-helper-types.ts +4 -3
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ Node setup.
|
|
|
38
38
|
|
|
39
39
|
## Using the skills with your coding agent
|
|
40
40
|
|
|
41
|
-
This package ships
|
|
41
|
+
This package ships agent skills in `node_modules/@rangojs/router/skills/` —
|
|
42
42
|
task-focused guides written for LLM coding agents. Start at
|
|
43
43
|
`skills/rango/SKILL.md` (the mental model + catalog); a machine-readable index
|
|
44
44
|
is at `skills/catalog.json`.
|
|
@@ -375,6 +375,7 @@ when the requirement appears:
|
|
|
375
375
|
| test loaders, middleware, handlers, Flight | [`/testing`](./skills/testing/SKILL.md) |
|
|
376
376
|
| see where request time goes | [`/observability`](./skills/observability/SKILL.md) |
|
|
377
377
|
| deploy to Vercel (cache store, tracing, output) | [`/vercel`](./skills/vercel/SKILL.md) |
|
|
378
|
+
| choose in-function vs CDN caching | [`/deployment-caching`](./skills/deployment-caching/SKILL.md) |
|
|
378
379
|
| compare Rango with Next.js / TanStack / Waku | [`/comparison`](./skills/comparison/SKILL.md) |
|
|
379
380
|
|
|
380
381
|
The [`/rango` skill](./skills/rango/SKILL.md) is the full catalog and the
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Router-wide default Link prefetch strategy (client seat).
|
|
3
|
+
*
|
|
4
|
+
* The server resolves `createRouter({ defaultPrefetch })` once at router init
|
|
5
|
+
* (router/prefetch-default.ts) and ships it in initial payload metadata; the
|
|
6
|
+
* browser entry applies it here before hydration — same lifecycle as
|
|
7
|
+
* `initPrefetchCache` / `setPrefetchConcurrency`. Every `<Link>` without an
|
|
8
|
+
* explicit `prefetch` prop reads the value at render time.
|
|
9
|
+
*
|
|
10
|
+
* The module initial value must equal the server resolver's environment default:
|
|
11
|
+
* `"none"` in development and `"viewport"` in production. During SSR this
|
|
12
|
+
* module is never initialized from metadata, so keeping both seats aligned also
|
|
13
|
+
* gives metadata-less payloads the documented behavior.
|
|
14
|
+
*/
|
|
15
|
+
import type { PrefetchStrategy } from "../../router/prefetch-default.js";
|
|
16
|
+
/**
|
|
17
|
+
* Apply the server-resolved default strategy. Called once at browser app init
|
|
18
|
+
* from payload metadata; also used by tests to reset state.
|
|
19
|
+
*/
|
|
20
|
+
export declare function setDefaultPrefetchStrategy(strategy: PrefetchStrategy): void;
|
|
21
|
+
/** Current default strategy for Links without an explicit `prefetch` prop. */
|
|
22
|
+
export declare function getDefaultPrefetchStrategy(): PrefetchStrategy;
|
|
@@ -8,15 +8,8 @@ import { type LocationStateEntry } from "./location-state.js";
|
|
|
8
8
|
*/
|
|
9
9
|
export type StateOrGetter<T = unknown> = T | (() => T);
|
|
10
10
|
export type LinkState = LocationStateEntry[] | StateOrGetter<Record<string, unknown>>;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* - "hover": Prefetch on mouse enter (direct, no queue)
|
|
14
|
-
* - "viewport": Prefetch when link enters viewport (queued, waits for idle)
|
|
15
|
-
* - "render": Prefetch on component mount regardless of visibility (queued, waits for idle)
|
|
16
|
-
* - "adaptive": Hover on pointer devices, viewport on touch devices
|
|
17
|
-
* - "none": No prefetching (default)
|
|
18
|
-
*/
|
|
19
|
-
export type PrefetchStrategy = "hover" | "viewport" | "render" | "adaptive" | "none";
|
|
11
|
+
import type { PrefetchStrategy } from "../../router/prefetch-default.js";
|
|
12
|
+
export type { PrefetchStrategy } from "../../router/prefetch-default.js";
|
|
20
13
|
/**
|
|
21
14
|
* Resolve a prefetch strategy, expanding "adaptive" to the concrete strategy
|
|
22
15
|
* for the CURRENT input capability: "viewport" on touch (no-hover) devices,
|
|
@@ -56,8 +49,12 @@ export interface LinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorEle
|
|
|
56
49
|
*/
|
|
57
50
|
revalidate?: boolean;
|
|
58
51
|
/**
|
|
59
|
-
* Prefetch strategy for the link destination
|
|
60
|
-
*
|
|
52
|
+
* Prefetch strategy for the link destination. When omitted, falls back to
|
|
53
|
+
* the router-wide default (`createRouter({ defaultPrefetch })`: `"none"` in
|
|
54
|
+
* development, `"viewport"` in production). An explicit value always wins
|
|
55
|
+
* over the router default, including `"none"` to opt a single Link out.
|
|
56
|
+
*
|
|
57
|
+
* @default the router's environment-aware `defaultPrefetch`
|
|
61
58
|
*/
|
|
62
59
|
prefetch?: PrefetchStrategy;
|
|
63
60
|
/**
|
|
@@ -77,6 +77,11 @@ export interface RscMetadata {
|
|
|
77
77
|
* Sent on initial render so the browser can configure its prefetch queue.
|
|
78
78
|
*/
|
|
79
79
|
prefetchConcurrency?: number;
|
|
80
|
+
/**
|
|
81
|
+
* Router-wide default prefetch strategy for Links without a `prefetch` prop.
|
|
82
|
+
* Sent on initial render; applied once at init (default-strategy.ts).
|
|
83
|
+
*/
|
|
84
|
+
defaultPrefetch?: import("../router/prefetch-default.js").PrefetchStrategy;
|
|
80
85
|
/**
|
|
81
86
|
* Server-resolved rango state cookie name (`{prefix}_{routerId}`). The client
|
|
82
87
|
* reads it verbatim and binds the rango state cookie to it; composition
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Document-Level Cache Middleware
|
|
3
3
|
*
|
|
4
|
-
* Caches full HTTP responses
|
|
4
|
+
* Caches full HTTP responses in the configured app store based on Cache-Control
|
|
5
|
+
* headers. A deployment CDN may independently consume the same shared-cache
|
|
6
|
+
* directives; this middleware itself runs inside the worker/function.
|
|
5
7
|
* Routes opt-in to caching by setting s-maxage or stale-while-revalidate headers.
|
|
6
8
|
*
|
|
7
9
|
* Flow:
|
|
@@ -265,6 +265,12 @@ export interface ShellCacheEntry {
|
|
|
265
265
|
* heals it. See docs/design/ppr-shell-resume.md ("the capture data snapshot").
|
|
266
266
|
*/
|
|
267
267
|
snapshot?: ShellSnapshotRecord[];
|
|
268
|
+
/**
|
|
269
|
+
* The entry was captured from a partial request only to produce an eligible
|
|
270
|
+
* segment snapshot. Document serving must treat its HTML prelude as a miss;
|
|
271
|
+
* the partial request's headers and middleware state are not document state.
|
|
272
|
+
*/
|
|
273
|
+
navigationOnly?: true;
|
|
268
274
|
/**
|
|
269
275
|
* True when the capture's HANDLER layer declared per-request liveness: a
|
|
270
276
|
* handle pushed OUTSIDE a DSL loader scope carried a nested thenable (the
|
|
@@ -279,9 +285,10 @@ export interface ShellCacheEntry {
|
|
|
279
285
|
*/
|
|
280
286
|
handlerLiveHoles?: boolean;
|
|
281
287
|
/**
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
288
|
+
* Legacy/fallback marker for a transition({ when }) predicate that was not
|
|
289
|
+
* evaluated by the PPR pre-handler gate. Such an entry stays conservatively
|
|
290
|
+
* ineligible for handler-free replay. New PPR matches evaluate known segment
|
|
291
|
+
* predicates before the pipeline and do not set this marker.
|
|
285
292
|
*/
|
|
286
293
|
transitionWhen?: true;
|
|
287
294
|
/** Capture-generation start time; tag invalidations at or after it win. */
|
|
@@ -349,11 +349,11 @@ export type RouteHelpers<T extends RouteDefinition, TEnv> = {
|
|
|
349
349
|
* startTransition only when the router sets viewTransition: false.
|
|
350
350
|
*
|
|
351
351
|
* Conditional hold: pass `when: (ctx) => boolean` to gate the transition per
|
|
352
|
-
* request. It runs server-side
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
352
|
+
* request. It normally runs server-side after the route handler. On a `ppr`
|
|
353
|
+
* route it is automatically hoisted before route handlers and reevaluated on
|
|
354
|
+
* every replay, so it may read URL/params/action/env and middleware-set context
|
|
355
|
+
* but not handler-set context. Returning false drops this transition for the
|
|
356
|
+
* request. This is distinct from intercept()'s match-time `when` selector.
|
|
357
357
|
*
|
|
358
358
|
* ```typescript
|
|
359
359
|
* // Attach to a single route
|
|
@@ -380,7 +380,7 @@ export type RouteHelpers<T extends RouteDefinition, TEnv> = {
|
|
|
380
380
|
* @param config - ViewTransition configuration (enter, exit, update, share,
|
|
381
381
|
* default, name), `viewTransition: "auto" | false` to toggle the router
|
|
382
382
|
* boundary (createRouter({ viewTransition }) sets the app-wide default), and
|
|
383
|
-
* `when: (ctx) => boolean` to gate the transition per request
|
|
383
|
+
* `when: (ctx) => boolean` to gate the transition per request
|
|
384
384
|
* @param children - Optional callback returning child routes to wrap
|
|
385
385
|
*/
|
|
386
386
|
transition: {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import type { ErrorInfo, ErrorPhase, MatchResult } from "../types";
|
|
3
|
-
import type
|
|
2
|
+
import type { ErrorBoundaryHandler, ErrorInfo, ErrorPhase, MatchResult } from "../types";
|
|
3
|
+
import { type EntryData, type InterceptEntry, type InterceptSelectorContext } from "../server/context.js";
|
|
4
4
|
import type { MatchApiDeps } from "./types.js";
|
|
5
5
|
import type { RouterContext } from "./router-context.js";
|
|
6
6
|
import { type ActionContext } from "./match-context.js";
|
|
7
|
-
import type { ErrorBoundaryHandler } from "../types";
|
|
8
7
|
import type { MiddlewareFn } from "./middleware.js";
|
|
9
8
|
import { type TelemetrySink } from "./telemetry.js";
|
|
10
9
|
export interface MatchHandlerDeps<TEnv = any> {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the router-wide default Link prefetch strategy once, at router init.
|
|
3
|
+
* The resolved value ships to the client in payload metadata; the browser
|
|
4
|
+
* entry applies it via `setDefaultPrefetchStrategy` (browser/prefetch/
|
|
5
|
+
* default-strategy.ts) and every `<Link>` without an explicit `prefetch` prop
|
|
6
|
+
* falls back to it.
|
|
7
|
+
*
|
|
8
|
+
* The type lives HERE (not in browser/react/Link.tsx) because both seats need
|
|
9
|
+
* it: this server-side resolver and the client Link/default-strategy modules.
|
|
10
|
+
* Link.tsx re-exports it so the public `PrefetchStrategy` export path is
|
|
11
|
+
* unchanged.
|
|
12
|
+
*
|
|
13
|
+
* Policy note: automatic prefetch stays quiet in development, matching the
|
|
14
|
+
* production-only default used by Next.js. Explicit router and per-Link
|
|
15
|
+
* strategies still work in every mode. Invalid untyped inputs fall back to the
|
|
16
|
+
* current environment's default.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Prefetch strategy for the Link component
|
|
20
|
+
* - "hover": Prefetch on mouse enter (direct, no queue)
|
|
21
|
+
* - "viewport": Prefetch when link enters viewport (queued, waits for idle)
|
|
22
|
+
* - "render": Prefetch on component mount regardless of visibility (queued, waits for idle)
|
|
23
|
+
* - "adaptive": Hover on pointer devices, viewport on touch devices
|
|
24
|
+
* - "none": No prefetching
|
|
25
|
+
*/
|
|
26
|
+
export type PrefetchStrategy = "hover" | "viewport" | "render" | "adaptive" | "none";
|
|
27
|
+
export declare const DEFAULT_PREFETCH_STRATEGY: PrefetchStrategy;
|
|
28
|
+
export declare function resolveDefaultPrefetch(raw: PrefetchStrategy | undefined, nodeEnv?: string | undefined): PrefetchStrategy;
|
|
@@ -249,6 +249,13 @@ export interface RangoInternal<TEnv = any, TRoutes extends Record<string, unknow
|
|
|
249
249
|
* prefetchConcurrency.
|
|
250
250
|
*/
|
|
251
251
|
readonly prefetchConcurrency: number;
|
|
252
|
+
/**
|
|
253
|
+
* Router-wide default Link prefetch strategy for Links without an explicit
|
|
254
|
+
* `prefetch` prop. Shipped to the client in payload metadata. Derived from
|
|
255
|
+
* the `defaultPrefetch` option (default "none" in development and
|
|
256
|
+
* "viewport" in production).
|
|
257
|
+
*/
|
|
258
|
+
readonly defaultPrefetch: import("./prefetch-default.js").PrefetchStrategy;
|
|
252
259
|
/**
|
|
253
260
|
* Resolved rango state cookie name (`{prefix}_{routerId}`), composed once at
|
|
254
261
|
* router init and shipped to the client in payload metadata. The server-side
|
|
@@ -7,6 +7,7 @@ import type { ExecutionContext } from "../server/request-context.js";
|
|
|
7
7
|
import type { UrlPatterns } from "../urls.js";
|
|
8
8
|
import type { UrlBuilder } from "../urls/pattern-types.js";
|
|
9
9
|
import type { NamedRouteEntry } from "./content-negotiation.js";
|
|
10
|
+
import type { PrefetchStrategy } from "./prefetch-default.js";
|
|
10
11
|
import type { TelemetrySink } from "./telemetry.js";
|
|
11
12
|
import type { RouterTracingConfig } from "./tracing.js";
|
|
12
13
|
import type { RouterTimeouts, OnTimeoutCallback } from "./timeout.js";
|
|
@@ -495,6 +496,35 @@ export interface RangoOptions<TEnv = any> {
|
|
|
495
496
|
* @default 2
|
|
496
497
|
*/
|
|
497
498
|
prefetchConcurrency?: number;
|
|
499
|
+
/**
|
|
500
|
+
* Default prefetch strategy for every `<Link>` that does not set its own
|
|
501
|
+
* `prefetch` prop. A per-Link `prefetch` prop always wins, in both
|
|
502
|
+
* directions (a Link can opt out of an aggressive default with
|
|
503
|
+
* `prefetch="none"`, or opt in under `defaultPrefetch: "none"`).
|
|
504
|
+
*
|
|
505
|
+
* - `"viewport"` (production default): prefetch when the link enters the viewport —
|
|
506
|
+
* idle-gated and queued (see `prefetchConcurrency`), so prefetches never
|
|
507
|
+
* compete with hydration or an active navigation.
|
|
508
|
+
* - `"hover"`: prefetch on mouse enter only. Much lighter on the server —
|
|
509
|
+
* only links the pointer approaches are fetched — at the cost of the
|
|
510
|
+
* ~100-300ms head start viewport prefetch gives.
|
|
511
|
+
* - `"adaptive"`: `"hover"` on pointer devices, `"viewport"` on touch
|
|
512
|
+
* devices (no hover to wait for).
|
|
513
|
+
* - `"render"`: prefetch on mount regardless of visibility.
|
|
514
|
+
* - `"none"`: manual mode — nothing prefetches unless a Link opts in.
|
|
515
|
+
*
|
|
516
|
+
* Automatic prefetch defaults to `"none"` in development and `"viewport"`
|
|
517
|
+
* in production. With the production default, every visible Link triggers an
|
|
518
|
+
* RSC render (loaders included) on the server. Routes served from cache/PPR
|
|
519
|
+
* absorb this cheaply; per-user dynamic routes pay full price per viewport
|
|
520
|
+
* entry. Set `"hover"`, `"adaptive"`, or `"none"` when that cost matters.
|
|
521
|
+
*
|
|
522
|
+
* To disable the prefetch subsystem entirely (including per-Link opt-ins
|
|
523
|
+
* and `useRouter().prefetch()`), set `prefetchCacheTTL: false` instead.
|
|
524
|
+
*
|
|
525
|
+
* @default "none" in development; "viewport" in production
|
|
526
|
+
*/
|
|
527
|
+
defaultPrefetch?: PrefetchStrategy;
|
|
498
528
|
/**
|
|
499
529
|
* Prefix for the rango state cookie name. The resolved name is
|
|
500
530
|
* `{prefix}_{routerId}`; the prefix is sanitized to cookie-name-safe
|
|
@@ -20,9 +20,8 @@ import type { EntryData } from "../../server/context";
|
|
|
20
20
|
* gate, which also avoids needless object allocation and payload growth.
|
|
21
21
|
*
|
|
22
22
|
* `when`: a server-only predicate. It is STRIPPED from the returned config (a
|
|
23
|
-
* function cannot cross Flight or the segment cache)
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* false. Used by both the fresh and revalidation resolution paths.
|
|
23
|
+
* function cannot cross Flight or the segment cache). PPR routes evaluate it
|
|
24
|
+
* from the manifest before the pipeline; other routes record it here for the
|
|
25
|
+
* existing post-handler gate. Used by both fresh and revalidation resolution.
|
|
27
26
|
*/
|
|
28
27
|
export declare function applyViewTransitionDefault(transition: EntryData["transition"], viewTransitionDefault: "auto" | false | undefined, segmentId?: string): EntryData["transition"];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type EntryData } from "../server/context.js";
|
|
2
|
+
import type { RequestContext } from "../server/request-context.js";
|
|
3
|
+
import type { TransitionWhenContext } from "../types/segments.js";
|
|
4
|
+
export type TransitionWhenErrorReporter = (error: unknown, segmentId: string) => void;
|
|
5
|
+
export declare function createTransitionWhenContext<TEnv>(ctx: RequestContext<TEnv>, target?: {
|
|
6
|
+
params: Record<string, string>;
|
|
7
|
+
routeName?: string;
|
|
8
|
+
}): TransitionWhenContext<Record<string, string>, TEnv>;
|
|
9
|
+
/** Evaluate server-only transition gates before handlers on a PPR route. */
|
|
10
|
+
export declare function evaluatePprTransitionWhen<TEnv>(entries: EntryData[], ctx: RequestContext<TEnv>, target: {
|
|
11
|
+
params: Record<string, string>;
|
|
12
|
+
routeName?: string;
|
|
13
|
+
}, reportError: TransitionWhenErrorReporter): void;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/** Bound queued/running capture closures retained by one isolate. */
|
|
2
|
+
export declare const MAX_ADMITTED_CAPTURES: number;
|
|
3
|
+
/** The caller may drop this best-effort capture and retry on a later request. */
|
|
4
|
+
export declare class CaptureQueueFullError extends Error {
|
|
5
|
+
constructor();
|
|
6
|
+
}
|
|
1
7
|
/**
|
|
2
8
|
* Run `task` after every previously enqueued capture has settled. Returns a
|
|
3
9
|
* promise for THIS task's completion (rejections propagate to the caller —
|
|
@@ -124,10 +124,11 @@ export interface ShellCaptureDebugEvent {
|
|
|
124
124
|
* the key (stampede guard) and scheduled nothing
|
|
125
125
|
* - skip-backoff: the key is inside its refused-capture backoff window and
|
|
126
126
|
* the capture was not attempted
|
|
127
|
+
* - skip-capacity: the isolate capture queue is full; a later request may retry
|
|
127
128
|
* - backoff: the key entered (or escalated) backoff after a terminal
|
|
128
129
|
* no-shell — carries the new backoff state
|
|
129
130
|
*/
|
|
130
|
-
outcome: "stored" | "redirect" | "no-shell" | "refused" | "error" | "skip-in-flight" | "skip-backoff" | "backoff";
|
|
131
|
+
outcome: "stored" | "redirect" | "no-shell" | "refused" | "error" | "skip-in-flight" | "skip-backoff" | "skip-capacity" | "backoff";
|
|
131
132
|
/** Attempt number (1 = first, 2 = in-place retry). Absent on skips. */
|
|
132
133
|
attempt?: number;
|
|
133
134
|
/** Wall-clock ms of the whole attempt (barrier + render + drain + put). */
|
|
@@ -148,6 +149,8 @@ export interface ShellCaptureDebugEvent {
|
|
|
148
149
|
snapshotBytes?: number;
|
|
149
150
|
/** True when the snapshot exceeded maxSnapshotBytes and was dropped. */
|
|
150
151
|
snapshotSkipped?: boolean;
|
|
152
|
+
/** A bake-lane loader settled into a shell that uses TTL/SWR-only invalidation. */
|
|
153
|
+
untaggedBake?: true;
|
|
151
154
|
/** Outcome reported by a store that supports shell-write acknowledgements. */
|
|
152
155
|
storeWrite?: "stored" | "invalidated";
|
|
153
156
|
/** Consecutive failure count in the key's backoff entry, when one exists. */
|
|
@@ -280,6 +283,8 @@ export interface ShellCaptureDescriptor {
|
|
|
280
283
|
* {@link ShellCaptureDebugEvent} per attempt/skip.
|
|
281
284
|
*/
|
|
282
285
|
debugSink?: (event: ShellCaptureDebugEvent) => void;
|
|
286
|
+
/** Store the snapshot for navigation replay, never the captured HTML prelude. */
|
|
287
|
+
navigationOnly?: true;
|
|
283
288
|
}
|
|
284
289
|
/**
|
|
285
290
|
* Schedule the background shell capture for a served document. Stampede-guarded:
|
|
@@ -288,11 +293,11 @@ export interface ShellCaptureDescriptor {
|
|
|
288
293
|
* error is routed through reportCacheError — capture is best-effort; a failure just
|
|
289
294
|
* means the next request recaptures.
|
|
290
295
|
*
|
|
291
|
-
* Eligibility (nonce/
|
|
292
|
-
*
|
|
293
|
-
*
|
|
296
|
+
* Eligibility (nonce/partial/status/strategy) is decided by the caller. An SSR
|
|
297
|
+
* module loader may be passed for cold partial requests; it runs only after the
|
|
298
|
+
* capture enters the guarded background queue, never on response latency.
|
|
294
299
|
*/
|
|
295
|
-
export declare function scheduleShellCapture(ctx: HandlerContext<any>, request: Request, env: any, url: URL, reqCtx: RequestContext<any>, ssrModule: SSRModule, descriptor: ShellCaptureDescriptor): void;
|
|
300
|
+
export declare function scheduleShellCapture(ctx: HandlerContext<any>, request: Request, env: any, url: URL, reqCtx: RequestContext<any>, ssrModule: SSRModule | ((request: Request, url: URL) => Promise<SSRModule | null>), descriptor: ShellCaptureDescriptor): void;
|
|
296
301
|
/**
|
|
297
302
|
* The outcome of one capture attempt.
|
|
298
303
|
* - `stored`: a usable shell was captured (and a putShell was attempted; a store
|
|
@@ -310,7 +315,7 @@ type CaptureAttemptOutcome = "stored" | "redirect" | "no-shell" | "refused";
|
|
|
310
315
|
* bag, not a return value: captureAndStoreShell's outcome type stays a string
|
|
311
316
|
* union its existing callers (producer B, tests) consume unchanged.
|
|
312
317
|
*/
|
|
313
|
-
type CaptureAttemptStats = Pick<ShellCaptureDebugEvent, "barrierWaitMs" | "writeSettleMs" | "preludeBytes" | "snapshotBytes" | "snapshotSkipped" | "storeWrite">;
|
|
318
|
+
type CaptureAttemptStats = Pick<ShellCaptureDebugEvent, "barrierWaitMs" | "writeSettleMs" | "preludeBytes" | "snapshotBytes" | "snapshotSkipped" | "untaggedBake" | "storeWrite">;
|
|
314
319
|
/**
|
|
315
320
|
* Run the shell capture with a single in-place retry, then store the result.
|
|
316
321
|
*
|
|
@@ -351,7 +356,10 @@ export interface CaptureContextDerivation {
|
|
|
351
356
|
* createRequestContext over the build env, with a fresh MemorySegmentCacheStore
|
|
352
357
|
* as `_cacheStore` so the recording/snapshot machinery arms identically.
|
|
353
358
|
*/
|
|
354
|
-
export declare function deriveShellCaptureContext(reqCtx: RequestContext<any>, descriptor: Pick<ShellCaptureDescriptor, "ttl" | "swr"
|
|
359
|
+
export declare function deriveShellCaptureContext(reqCtx: RequestContext<any>, descriptor: Pick<ShellCaptureDescriptor, "ttl" | "swr">, identity?: {
|
|
360
|
+
request: Request;
|
|
361
|
+
url: URL;
|
|
362
|
+
}): CaptureContextDerivation;
|
|
355
363
|
/**
|
|
356
364
|
* Seal handles, derive the quiesce signal, prerender + abort via the SSR module's
|
|
357
365
|
* captureShellHTML, and store the result. Returns the attempt outcome (the caller
|
|
@@ -19,6 +19,8 @@ import { type EntryData } from "../server/context.js";
|
|
|
19
19
|
import type { ShellCacheEntry, SegmentCacheStore } from "../cache/types.js";
|
|
20
20
|
/** Debug/status header the browser (and e2e assertions) can read: HIT | MISS. */
|
|
21
21
|
export declare const SHELL_STATUS_HEADER = "x-rango-shell";
|
|
22
|
+
/** Partial-navigation status header set only after captured PPR segments are consumed. */
|
|
23
|
+
export declare const PPR_REPLAY_STATUS_HEADER = "x-rango-ppr-replay";
|
|
22
24
|
/**
|
|
23
25
|
* Default shell ttl (seconds) for `ppr: true` and for a PartialPrerenderProps
|
|
24
26
|
* that omits `ttl`.
|
|
@@ -51,9 +53,10 @@ export interface ResolvedPprConfig {
|
|
|
51
53
|
captureTimeout?: number;
|
|
52
54
|
}
|
|
53
55
|
/**
|
|
54
|
-
* Validate the raw `ppr.captureTimeout` option: a finite number >= 1ms
|
|
55
|
-
*
|
|
56
|
-
* resolves to undefined, which means "use
|
|
56
|
+
* Validate the raw `ppr.captureTimeout` option: a finite number >= 1ms is
|
|
57
|
+
* clamped to the default ceiling; anything else (including
|
|
58
|
+
* 0/negative/NaN/Infinity/non-number) resolves to undefined, which means "use
|
|
59
|
+
* the capture default" downstream.
|
|
57
60
|
* Mirrors the prefetch-limit option policy: invalid values silently fall back
|
|
58
61
|
* to the default rather than throwing at request time. Also the boundary
|
|
59
62
|
* re-normalizer for the dev /__rsc_shell endpoint (vite/router-discovery.ts),
|
|
@@ -4,24 +4,20 @@ import type { OnErrorCallback } from "../types/error-types.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* Apply transition({ when }) gates to a payload's segments.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* to the router's onError (phase "rendering") and then treated as "do not hold"
|
|
13
|
-
* (conservative), so a buggy predicate degrades to no transition rather than
|
|
14
|
-
* failing the response.
|
|
7
|
+
* PPR predicates were evaluated from the manifest before cache lookup and route
|
|
8
|
+
* handlers; their request-specific decisions are projected onto a copy so they
|
|
9
|
+
* never mutate reusable cache/prerender/shell records. Ordinary-route predicates
|
|
10
|
+
* were collected during fresh resolution and are evaluated here after handlers.
|
|
11
|
+
* Both paths drop the segment transition when the predicate does not hold.
|
|
15
12
|
*
|
|
16
13
|
* Mutating the segments here is safe: the segment cache stores a serialized copy
|
|
17
14
|
* (segment-codec), written during match() BEFORE this gate runs, so dropping a
|
|
18
|
-
* transition never corrupts a cache entry.
|
|
15
|
+
* transition never corrupts a cache entry. On an ordinary route, a cache hit
|
|
19
16
|
* skips resolution, collects no predicate, and replays the cached transition
|
|
20
|
-
* as-is (it was serialized before the gate)
|
|
21
|
-
*
|
|
22
|
-
* avoid caching a route whose transition decision is request-dependent.
|
|
17
|
+
* as-is (it was serialized before the gate). PPR routes are the exception: their
|
|
18
|
+
* manifest predicates were evaluated before lookup and apply to replayed data.
|
|
23
19
|
*
|
|
24
|
-
* Returns the same array
|
|
25
|
-
*
|
|
20
|
+
* Returns the same array for the ordinary post-handler path. A PPR drop returns a
|
|
21
|
+
* copy containing only the request-specific transition changes.
|
|
26
22
|
*/
|
|
27
23
|
export declare function gateTransitions(segments: MatchResult["segments"], ctx: ReturnType<typeof getRequestContext>, onError?: OnErrorCallback): MatchResult["segments"];
|
|
@@ -49,6 +49,8 @@ export interface RscPayload {
|
|
|
49
49
|
prefetchCacheSize?: number;
|
|
50
50
|
/** Max concurrent speculative prefetch requests on the client */
|
|
51
51
|
prefetchConcurrency?: number;
|
|
52
|
+
/** Router-wide default prefetch strategy for Links without a `prefetch` prop */
|
|
53
|
+
defaultPrefetch?: import("../router/prefetch-default.js").PrefetchStrategy;
|
|
52
54
|
/** Server-resolved rango state cookie name; the client reads it verbatim. */
|
|
53
55
|
stateCookieName?: string;
|
|
54
56
|
/** Theme configuration for FOUC prevention */
|
|
@@ -141,6 +141,8 @@ export interface RequestContext<TEnv = DefaultEnv, TParams = Record<string, stri
|
|
|
141
141
|
id: string;
|
|
142
142
|
when: TransitionWhenFn;
|
|
143
143
|
}>;
|
|
144
|
+
/** @internal PPR transition decisions evaluated before cache lookup/handlers. */
|
|
145
|
+
_pprTransitionDecisions?: Map<string, boolean>;
|
|
144
146
|
/** @internal Cache store for segment caching (optional, used by CacheScope) */
|
|
145
147
|
_cacheStore?: SegmentCacheStore;
|
|
146
148
|
/**
|
|
@@ -202,6 +204,8 @@ export interface RequestContext<TEnv = DefaultEnv, TParams = Record<string, stri
|
|
|
202
204
|
* segment record even when the triggering request is partial.
|
|
203
205
|
*/
|
|
204
206
|
keyPrefix?: "doc";
|
|
207
|
+
/** @internal Called only after the implicit cache hit decodes successfully. */
|
|
208
|
+
onHit?: () => void;
|
|
205
209
|
};
|
|
206
210
|
/**
|
|
207
211
|
* @internal Shell-HIT tail marker: cache/prerender-store hits during THIS
|
|
@@ -514,7 +518,7 @@ export interface RequestContext<TEnv = DefaultEnv, TParams = Record<string, stri
|
|
|
514
518
|
* This is the type exported to library consumers. Internal code should
|
|
515
519
|
* use the full RequestContext interface directly.
|
|
516
520
|
*/
|
|
517
|
-
export type PublicRequestContext<TEnv = DefaultEnv, TParams = Record<string, string>> = Omit<RequestContext<TEnv, TParams>, "cookie" | "cookies" | "setCookie" | "deleteCookie" | "_handleStore" | "_transitionWhen" | "_cacheStore" | "_shellCaptureRun" | "_shellImplicitCache" | "_shellLoaderSeed" | "_shellCaptureLoaderRecords" | "_shellCaptureHandleLiveness" | "_shellCaptureLoaderHandleValues" | "_shellFragmentPayload" | "_shellCaptureGuardTripped" | "_shellCaptureGuardTrippedLoaderId" | "_explicitTaggedStores" | "_requestTags" | "_cacheProfiles" | "_onResponseCallbacks" | "_pendingBackgroundTasks" | "_themeConfig" | "_locationState" | "_routeName" | "_prevRouteKey" | "_gateCurrentUrl" | "_gateCurrentParams" | "_gateActionId" | "_gateActionUrl" | "_gateActionResult" | "_gateFormData" | "_inActionRevalidation" | "_reportedErrors" | "_renderBarrier" | "_resolveRenderBarrier" | "_renderBarrierSegmentOrder" | "_treeHasStreaming" | "_renderBarrierWaiters" | "_handlerLoaderDeps" | "_renderBarrierHandleSnapshot" | "_renderBarrierGuardClosed" | "_reportBackgroundError" | "_debugPerformance" | "_metricsStore" | "_renderForeground" | "_renderDiagnosticsEnabled" | "_handlerStart" | "_tracing" | "_basename" | "_routerId" | "_setStatus" | "_rotateStateCookie" | "_setKeepCacheDirective" | "_variables" | "_classifiedRoute" | "_cacheSignal" | "_dynamic" | "res">;
|
|
521
|
+
export type PublicRequestContext<TEnv = DefaultEnv, TParams = Record<string, string>> = Omit<RequestContext<TEnv, TParams>, "cookie" | "cookies" | "setCookie" | "deleteCookie" | "_handleStore" | "_transitionWhen" | "_pprTransitionDecisions" | "_cacheStore" | "_shellCaptureRun" | "_shellImplicitCache" | "_shellLoaderSeed" | "_shellCaptureLoaderRecords" | "_shellCaptureHandleLiveness" | "_shellCaptureLoaderHandleValues" | "_shellFragmentPayload" | "_shellCaptureGuardTripped" | "_shellCaptureGuardTrippedLoaderId" | "_explicitTaggedStores" | "_requestTags" | "_cacheProfiles" | "_onResponseCallbacks" | "_pendingBackgroundTasks" | "_themeConfig" | "_locationState" | "_routeName" | "_prevRouteKey" | "_gateCurrentUrl" | "_gateCurrentParams" | "_gateActionId" | "_gateActionUrl" | "_gateActionResult" | "_gateFormData" | "_inActionRevalidation" | "_reportedErrors" | "_renderBarrier" | "_resolveRenderBarrier" | "_renderBarrierSegmentOrder" | "_treeHasStreaming" | "_renderBarrierWaiters" | "_handlerLoaderDeps" | "_renderBarrierHandleSnapshot" | "_renderBarrierGuardClosed" | "_reportBackgroundError" | "_debugPerformance" | "_metricsStore" | "_renderForeground" | "_renderDiagnosticsEnabled" | "_handlerStart" | "_tracing" | "_basename" | "_routerId" | "_setStatus" | "_rotateStateCookie" | "_setKeepCacheDirective" | "_variables" | "_classifiedRoute" | "_cacheSignal" | "_dynamic" | "res">;
|
|
518
522
|
/**
|
|
519
523
|
* Marker for a waitUntil-scheduled fn whose task promise must NOT enter
|
|
520
524
|
* _pendingBackgroundTasks. Used by the PPR shell capture for its own task:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Expect, TestType } from "@playwright/test";
|
|
2
2
|
import { createUseFixture, type Fixture, type FixtureOptions } from "./fixture.js";
|
|
3
|
-
import { createPageHelpers, createStopwatch, getHistoryState, getNumericContent, goBack, goForward, isVisibleInViewport, measureTime, type PageHelpers, parseNumber, type Stopwatch, testId, waitForElement, waitForHydration, waitForNavigation } from "./page-helpers.js";
|
|
3
|
+
import { blockPrefetch, unblockPrefetch, createPageHelpers, createStopwatch, getHistoryState, getNumericContent, goBack, goForward, isPrefetchRequest, isVisibleInViewport, measureTime, type PageHelpers, parseNumber, type Stopwatch, testId, waitForElement, waitForHydration, waitForNavigation } from "./page-helpers.js";
|
|
4
4
|
import { createParity, type ExpectParityOptions, type Parity, type ParityDescribeOptions, type ParityIntent } from "./parity.js";
|
|
5
5
|
import { createRangoMatchers, type RangoMatchers } from "./matchers.js";
|
|
6
6
|
export { assertCacheStatus, assertCacheDecision, parseCacheHeader, createCacheSink, filterCacheDecisions, type CacheSink, type ExpectedCacheStatus, type CacheStatusTarget, } from "../cache-status.js";
|
|
7
|
-
export { assertShellStatus, parseShellStatus, shellCacheKey, SHELL_STATUS_HEADER, type ShellStatus, type ShellStatusTarget, } from "../shell-status.js";
|
|
8
|
-
export { testId, waitForHydration, waitForNavigation, goBack, goForward, getHistoryState, waitForElement, isVisibleInViewport, parseNumber, getNumericContent, createStopwatch, measureTime, createPageHelpers, createUseFixture, createParity, createRangoMatchers, };
|
|
7
|
+
export { assertPprReplayStatus, assertShellStatus, parsePprReplayStatus, parseShellStatus, PPR_REPLAY_STATUS_HEADER, shellCacheKey, SHELL_STATUS_HEADER, type PprReplayBypassReason, type PprReplayStatus, type ShellStatus, type ShellStatusTarget, } from "../shell-status.js";
|
|
8
|
+
export { testId, waitForHydration, waitForNavigation, goBack, goForward, getHistoryState, waitForElement, isVisibleInViewport, isPrefetchRequest, blockPrefetch, unblockPrefetch, parseNumber, getNumericContent, createStopwatch, measureTime, createPageHelpers, createUseFixture, createParity, createRangoMatchers, };
|
|
9
9
|
export type { Fixture, FixtureOptions, PageHelpers, Stopwatch, Parity, ParityIntent, ParityDescribeOptions, ExpectParityOptions, RangoMatchers, };
|
|
10
10
|
export interface RangoE2E extends PageHelpers, Parity {
|
|
11
11
|
useFixture: (options: FixtureOptions) => Fixture;
|
|
@@ -43,6 +43,30 @@ export declare function measureTime<T>(fn: () => Promise<T>): Promise<{
|
|
|
43
43
|
elapsed: number;
|
|
44
44
|
result: T;
|
|
45
45
|
}>;
|
|
46
|
+
/**
|
|
47
|
+
* True when the request is a speculative prefetch (Link viewport/hover/render
|
|
48
|
+
* strategies or `useRouter().prefetch()`). Every prefetch fetch carries the
|
|
49
|
+
* `X-Rango-Prefetch` header. Links prefetch by default in production unless
|
|
50
|
+
* the router opts out, so tests that track `_rsc_partial` requests to pin
|
|
51
|
+
* NAVIGATION behavior must skip these — a request-count or first-request
|
|
52
|
+
* assertion otherwise races background prefetch traffic.
|
|
53
|
+
*/
|
|
54
|
+
export declare function isPrefetchRequest(req: {
|
|
55
|
+
headers: () => Record<string, string>;
|
|
56
|
+
}): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Abort every speculative prefetch request on this page. Install BEFORE
|
|
59
|
+
* `page.goto` so no prefetch can complete first. For tests whose semantics
|
|
60
|
+
* need a virgin prefetch cache: a click on a Link whose target was already
|
|
61
|
+
* prefetched ADOPTS the warmed entry and issues no navigation fetch at all —
|
|
62
|
+
* a `page.route` override, a request waiter, or a Set-Cookie assertion aimed
|
|
63
|
+
* at the navigation request then sees nothing (or sees the prefetch's side
|
|
64
|
+
* effects instead). Aborted prefetches are benign by design (evicted, never
|
|
65
|
+
* adopted, no page error), so the click's real fetch is guaranteed live.
|
|
66
|
+
*/
|
|
67
|
+
export declare function blockPrefetch(page: Page): Promise<void>;
|
|
68
|
+
/** Remove a `blockPrefetch` guard, restoring normal prefetch traffic. */
|
|
69
|
+
export declare function unblockPrefetch(page: Page): Promise<void>;
|
|
46
70
|
export interface PageHelpers {
|
|
47
71
|
/** Assert that no full page reload occurred between scope entry and exit. */
|
|
48
72
|
expectNoReload: (page: Page) => AsyncDisposable;
|
|
@@ -44,8 +44,8 @@ export type { DispatchOptions } from "./dispatch.js";
|
|
|
44
44
|
export { assertCacheStatus, assertCacheDecision, parseCacheHeader, createCacheSink, filterCacheDecisions, } from "./cache-status.js";
|
|
45
45
|
export type { ExpectedCacheStatus, CacheStatusTarget, CacheSink, } from "./cache-status.js";
|
|
46
46
|
export type { TelemetryEvent, TelemetrySink, CacheDecisionEvent, CacheSegmentSignal, CacheSegmentStatus, } from "../router/telemetry.js";
|
|
47
|
-
export { assertShellStatus, parseShellStatus, shellCacheKey, SHELL_STATUS_HEADER, } from "./shell-status.js";
|
|
48
|
-
export type { ShellStatus, ShellStatusTarget } from "./shell-status.js";
|
|
47
|
+
export { assertPprReplayStatus, assertShellStatus, parsePprReplayStatus, parseShellStatus, PPR_REPLAY_STATUS_HEADER, shellCacheKey, SHELL_STATUS_HEADER, } from "./shell-status.js";
|
|
48
|
+
export type { PprReplayBypassReason, PprReplayStatus, ShellStatus, ShellStatusTarget, } from "./shell-status.js";
|
|
49
49
|
export { collectHandle } from "./collect-handle.js";
|
|
50
50
|
export { diffGeneratedRoutes, assertGeneratedRoutesMatch, } from "./generated-routes.js";
|
|
51
51
|
export type { GeneratedRoutesDiff, GeneratedRouteMismatch, } from "./generated-routes.js";
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* runTransitionWhen — unit-test a transition({ when }) predicate in isolation.
|
|
3
3
|
*
|
|
4
|
-
* Runs the SAME
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* TransitionWhenContext and evaluates the predicate post-handler). So the
|
|
4
|
+
* Runs the SAME server functions the router uses — the PPR pre-handler evaluator
|
|
5
|
+
* when `ppr: true`, applyViewTransitionDefault (which strips the server-only
|
|
6
|
+
* function), and gateTransitions. So the
|
|
8
7
|
* predicate sees exactly the navigation/action metadata it would at runtime
|
|
9
8
|
* (currentUrl/currentParams/fromRouteName, nextUrl/nextParams/toRouteName,
|
|
10
9
|
* actionId/actionUrl/actionResult/formData/method, get/env), and `kept` reflects
|
|
@@ -39,7 +38,7 @@ export interface RunTransitionWhenOptions<TEnv = any> {
|
|
|
39
38
|
toRouteName?: string;
|
|
40
39
|
/** Environment bindings surfaced as `env` (and `ctx.env`). */
|
|
41
40
|
env?: TEnv;
|
|
42
|
-
/** Variables
|
|
41
|
+
/** Variables readable via the predicate's `get()`. With `ppr`, these model pre-handler middleware/input state. */
|
|
43
42
|
vars?: VarsInit;
|
|
44
43
|
/** Navigation SOURCE url (`currentUrl`): a URL or path string. */
|
|
45
44
|
currentUrl?: string | URL;
|
|
@@ -57,6 +56,8 @@ export interface RunTransitionWhenOptions<TEnv = any> {
|
|
|
57
56
|
formData?: FormData;
|
|
58
57
|
/** Receives an error thrown by the predicate (the gate reports to `router.onError`, phase `"rendering"`). */
|
|
59
58
|
onError?: OnErrorCallback;
|
|
59
|
+
/** Model a route with `ppr`, where the predicate runs before route handlers and cache lookup. */
|
|
60
|
+
ppr?: boolean;
|
|
60
61
|
}
|
|
61
62
|
/**
|
|
62
63
|
* Result of runTransitionWhen.
|