@rangojs/router 0.4.3 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/browser/prefetch/cache.d.ts +31 -2
- package/dist/types/cache/cf/cf-cache-store.d.ts +2 -0
- package/dist/types/cache/types.d.ts +39 -6
- package/dist/types/route-definition/helpers-types.d.ts +5 -4
- package/dist/types/rsc/capture-queue.d.ts +19 -3
- package/dist/types/rsc/shell-build-manifest.d.ts +2 -2
- package/dist/types/rsc/shell-capture.d.ts +22 -2
- package/dist/types/rsc/shell-serve.d.ts +18 -12
- package/dist/types/static-handler.d.ts +15 -1
- package/dist/types/urls/path-helper-types.d.ts +6 -7
- 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 +1 -1
- package/package.json +1 -1
- package/skills/parallel/SKILL.md +1 -1
- package/skills/ppr/SKILL.md +44 -3
- package/src/browser/prefetch/cache.ts +53 -9
- package/src/browser/prefetch/fetch.ts +83 -2
- package/src/cache/cf/cf-cache-store.ts +27 -8
- package/src/cache/types.ts +41 -6
- package/src/cache/vercel/vercel-cache-store.ts +24 -10
- package/src/route-definition/helpers-types.ts +5 -3
- package/src/rsc/capture-queue.ts +120 -47
- package/src/rsc/rsc-rendering.ts +11 -3
- package/src/rsc/shell-build-manifest.ts +20 -7
- package/src/rsc/shell-capture.ts +164 -12
- package/src/rsc/shell-serve.ts +27 -12
- package/src/static-handler.ts +18 -2
- package/src/urls/path-helper-types.ts +9 -10
package/skills/parallel/SKILL.md
CHANGED
|
@@ -273,7 +273,7 @@ parallel(
|
|
|
273
273
|
|
|
274
274
|
Per-slot merge order is **handler.use → shared use → slot-local use**. Slot-local is the narrowest scope, so it wins for last-write-wins items. See [skills/handler-use § `loading()` is a single-assignment item — scope it correctly](../handler-use/SKILL.md#loading-is-a-single-assignment-item--scope-it-correctly) for the full reasoning.
|
|
275
275
|
|
|
276
|
-
|
|
276
|
+
Both a bare arrow slot handler (`"@cart": (ctx) => ...`) and an arrow inside a descriptor (`handler: (ctx) => ...`) infer their `ctx`; no explicit annotation is needed.
|
|
277
277
|
|
|
278
278
|
## Slot Override Semantics
|
|
279
279
|
|
package/skills/ppr/SKILL.md
CHANGED
|
@@ -358,14 +358,27 @@ curl -s -D - -o /dev/null https://app.example.com/products/1 | grep -i x-rango-s
|
|
|
358
358
|
falls through to KV on a miss, and promotes the KV hit back into that colo.
|
|
359
359
|
WITHOUT a KV namespace its shell family remains inert: every ppr route stays
|
|
360
360
|
`MISS` forever. The store warns once per isolate — bind KV
|
|
361
|
-
(`new CFCacheStore({ ctx, kv: env.CACHE_KV })`) or use another store.
|
|
361
|
+
(`new CFCacheStore({ ctx, kv: env.CACHE_KV })`) or use another store. An
|
|
362
|
+
inert store also stops captures at the gate: the store declares
|
|
363
|
+
`shellFamilyInert` and the scheduler skips the background render entirely
|
|
364
|
+
(`skip-inert-store` on the debug event) instead of burning a full capture per
|
|
365
|
+
MISS whose write could only no-op.
|
|
362
366
|
- Structured capture diagnostics: `createRouter({ debugShellCapture: true })`
|
|
363
367
|
logs one line per capture attempt/skip (outcome, durations, prelude and
|
|
364
368
|
snapshot bytes, backoff state); pass a function to receive each
|
|
365
369
|
`ShellCaptureDebugEvent` instead. `skip-capacity` means the isolate already
|
|
366
370
|
has 32 queued/running captures; the dropped best-effort capture can retry on a
|
|
367
|
-
later request.
|
|
368
|
-
|
|
371
|
+
later request. `skip-queue-timeout` means this capture waited 15s behind the
|
|
372
|
+
active or same-priority work and was dropped before rendering; document-shell
|
|
373
|
+
captures outrank queued navigation-only snapshots, but never interrupt the
|
|
374
|
+
active capture — the skip event and the `rango.background` span carry
|
|
375
|
+
`queuePriority`/`queueAhead` (class and backlog at enqueue) so a parked
|
|
376
|
+
capture diagnoses itself. A stored attempt reports `bakeWaitMs`: how long the
|
|
377
|
+
slowest bake source (a top-level pushed handle promise or a bake-lane loader
|
|
378
|
+
container) held the capture gate — in dev, past 2s, the source is also named
|
|
379
|
+
once per key in a console warning with the remedies (nest the promise /
|
|
380
|
+
`cache()` the work / add `loading()`). In dev, with `debugPerformance` on,
|
|
381
|
+
the last capture outcome for a key also rides the next document GET's
|
|
369
382
|
`Server-Timing` as `ppr-capture;desc="…"`.
|
|
370
383
|
- For deployed Cloudflare tier diagnostics, build with
|
|
371
384
|
`INTERNAL_RANGO_DEBUG=1` and run `wrangler tail`. `[CFCacheStore][shell]`
|
|
@@ -621,6 +634,34 @@ capture with identity reads permitted, and the value bakes as a shared
|
|
|
621
634
|
capture-time copy — mirroring `cache()` semantics (the consumption-lane
|
|
622
635
|
rule; semantic-matrix row PPR3).
|
|
623
636
|
|
|
637
|
+
### Designing routes for cheap captures (the cost model)
|
|
638
|
+
|
|
639
|
+
The hole doctrine has a cost corollary that bites silently: **everything that
|
|
640
|
+
bakes is awaited at capture, and that wait recurs on EVERY capture of the
|
|
641
|
+
route**. A top-level pushed handle promise that takes 5s and a Meta promise
|
|
642
|
+
chained 2s further make every capture occupy the per-isolate serialized queue
|
|
643
|
+
for ~7s — while the served response still reads 13ms TTFB, because captures are
|
|
644
|
+
detached. You will not see this cost in any request timing; you see it as slow
|
|
645
|
+
MISS→HIT flips, `skip-queue-timeout` under prefetch pressure, and (in dev, past
|
|
646
|
+
2s) the bake-cost warning naming the source.
|
|
647
|
+
|
|
648
|
+
Three levers, in preference order:
|
|
649
|
+
|
|
650
|
+
1. **Nest it** (`{ data: promise }` instead of the promise): the value becomes
|
|
651
|
+
a hole — per-request, streamed under the consumer's `<Suspense>`, zero
|
|
652
|
+
capture cost. Choose this whenever the value may be dynamic anyway.
|
|
653
|
+
2. **`cache()` the work inside it**: the value stays baked (shell material,
|
|
654
|
+
tag-invalidatable), but the capture replays the cached value instead of
|
|
655
|
+
re-executing the expensive body (mixed-chain). Choose this for shared,
|
|
656
|
+
expensive-to-compute shell content.
|
|
657
|
+
3. **`loading()` on the entry** (loaders only): moves the loader to the live
|
|
658
|
+
lane — masked at capture, fresh per serve — at the cost of a fallback in
|
|
659
|
+
the shell.
|
|
660
|
+
|
|
661
|
+
Head material (Meta) generally cannot be a hole — the head is shell — so its
|
|
662
|
+
promises bake by design; make them cheap with lever 2. `bakeWaitMs` on the
|
|
663
|
+
capture debug event tells you what each capture actually paid.
|
|
664
|
+
|
|
624
665
|
## Execution matrix
|
|
625
666
|
|
|
626
667
|
| Phase | MISS (foreground) | Background capture | HIT (foreground) |
|
|
@@ -72,8 +72,31 @@ export interface DecodedPrefetch {
|
|
|
72
72
|
* tell a FULLY warmed prefetch (payload commits without suspending → safe to
|
|
73
73
|
* commit in a startTransition, no fallback flash) from a partially-warmed one
|
|
74
74
|
* (still streaming → stream its fallbacks like a cold load). Starts false.
|
|
75
|
+
*
|
|
76
|
+
* On a respawned entry (see `respawn`) this starts true: the buffered bytes
|
|
77
|
+
* are a complete stream by construction.
|
|
75
78
|
*/
|
|
76
79
|
complete: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Re-create this entry from its buffered raw Flight bytes. Attached (by
|
|
82
|
+
* `executePrefetchFetch`) only after the stream ended cleanly AND the eager
|
|
83
|
+
* decode succeeded — a truncated or failed prefetch must stay one-shot.
|
|
84
|
+
*
|
|
85
|
+
* Why bytes and not the decoded payload: the revived payload is a live graph
|
|
86
|
+
* with one-shot stream edges (the handle stream is an async generator drained
|
|
87
|
+
* during commit; userland payloads may embed serialized ReadableStreams).
|
|
88
|
+
* Re-decoding from the wire bytes manufactures fresh instances of every
|
|
89
|
+
* stream, which no amount of cloning the revived graph can do. Each call tees
|
|
90
|
+
* the reserve branch, so the replacement entry carries its own `respawn` —
|
|
91
|
+
* one prefetch serves unlimited adoptions within TTL/state validity.
|
|
92
|
+
*/
|
|
93
|
+
respawn?: () => DecodedPrefetch;
|
|
94
|
+
/**
|
|
95
|
+
* Release the buffered reserve bytes. Called when the entry is evicted
|
|
96
|
+
* without being consumed (expiry, FIFO, sweep, cache clear) so the tee
|
|
97
|
+
* buffer is dropped promptly instead of waiting for GC.
|
|
98
|
+
*/
|
|
99
|
+
dispose?: () => void;
|
|
77
100
|
}
|
|
78
101
|
|
|
79
102
|
let cacheTTL = 300_000;
|
|
@@ -208,6 +231,7 @@ export function hasPrefetch(key: string): boolean {
|
|
|
208
231
|
const entry = cache.get(key);
|
|
209
232
|
if (!entry) return false;
|
|
210
233
|
if (Date.now() - entry.timestamp > cacheTTL) {
|
|
234
|
+
entry.entry.dispose?.();
|
|
211
235
|
cache.delete(key);
|
|
212
236
|
return false;
|
|
213
237
|
}
|
|
@@ -216,22 +240,34 @@ export function hasPrefetch(key: string): boolean {
|
|
|
216
240
|
|
|
217
241
|
/**
|
|
218
242
|
* Consume a cached, eagerly-decoded prefetch. Returns null if not found or
|
|
219
|
-
* expired.
|
|
220
|
-
*
|
|
243
|
+
* expired. Returns null when caching is disabled (TTL <= 0).
|
|
244
|
+
*
|
|
245
|
+
* A decoded payload is single-render (its handle stream is drained during the
|
|
246
|
+
* commit), so the returned entry is never served twice. When the entry carries
|
|
247
|
+
* `respawn` (clean-EOF prefetch with buffered bytes), the slot is re-armed in
|
|
248
|
+
* place with a fresh decode of those bytes — the ORIGINAL timestamp is kept so
|
|
249
|
+
* TTL bounds the age of the data, not of the latest adoption. Without
|
|
250
|
+
* `respawn` the entry is deleted (legacy one-shot behavior).
|
|
221
251
|
*
|
|
222
252
|
* Does NOT check in-flight prefetches — use consumeInflightPrefetch()
|
|
223
253
|
* for that (returns a Promise instead of a resolved entry).
|
|
224
254
|
*/
|
|
225
255
|
export function consumePrefetch(key: string): DecodedPrefetch | null {
|
|
226
256
|
if (cacheTTL <= 0) return null;
|
|
227
|
-
const
|
|
228
|
-
if (!
|
|
229
|
-
if (Date.now() -
|
|
257
|
+
const cached = cache.get(key);
|
|
258
|
+
if (!cached) return null;
|
|
259
|
+
if (Date.now() - cached.timestamp > cacheTTL) {
|
|
260
|
+
cached.entry.dispose?.();
|
|
230
261
|
cache.delete(key);
|
|
231
262
|
return null;
|
|
232
263
|
}
|
|
233
|
-
|
|
234
|
-
|
|
264
|
+
const entry = cached.entry;
|
|
265
|
+
if (entry.respawn) {
|
|
266
|
+
cached.entry = entry.respawn();
|
|
267
|
+
} else {
|
|
268
|
+
cache.delete(key);
|
|
269
|
+
}
|
|
270
|
+
return entry;
|
|
235
271
|
}
|
|
236
272
|
|
|
237
273
|
/**
|
|
@@ -301,6 +337,7 @@ export function storePrefetch(
|
|
|
301
337
|
let min = Infinity;
|
|
302
338
|
for (const [k, cached] of cache) {
|
|
303
339
|
if (now - cached.timestamp > cacheTTL) {
|
|
340
|
+
cached.entry.dispose?.();
|
|
304
341
|
cache.delete(k);
|
|
305
342
|
} else if (cached.timestamp < min) {
|
|
306
343
|
min = cached.timestamp;
|
|
@@ -312,7 +349,10 @@ export function storePrefetch(
|
|
|
312
349
|
// FIFO eviction if at capacity
|
|
313
350
|
if (cache.size >= maxPrefetchCacheSize) {
|
|
314
351
|
const oldest = cache.keys().next().value;
|
|
315
|
-
if (oldest)
|
|
352
|
+
if (oldest) {
|
|
353
|
+
cache.get(oldest)?.entry.dispose?.();
|
|
354
|
+
cache.delete(oldest);
|
|
355
|
+
}
|
|
316
356
|
}
|
|
317
357
|
|
|
318
358
|
cache.set(key, { entry, timestamp: now });
|
|
@@ -335,7 +375,10 @@ export function storePrefetch(
|
|
|
335
375
|
* entry.
|
|
336
376
|
*/
|
|
337
377
|
export function removePrefetch(key: string, entry: DecodedPrefetch): void {
|
|
338
|
-
if (cache.get(key)?.entry === entry)
|
|
378
|
+
if (cache.get(key)?.entry === entry) {
|
|
379
|
+
entry.dispose?.();
|
|
380
|
+
cache.delete(key);
|
|
381
|
+
}
|
|
339
382
|
}
|
|
340
383
|
|
|
341
384
|
/**
|
|
@@ -405,6 +448,7 @@ export function clearPrefetchCache(rotateRangoState = true): void {
|
|
|
405
448
|
inflightPromises.clear();
|
|
406
449
|
inflightAliases.clear();
|
|
407
450
|
adoptedKeys.clear();
|
|
451
|
+
for (const cached of cache.values()) cached.entry.dispose?.();
|
|
408
452
|
cache.clear();
|
|
409
453
|
earliestTimestamp = Infinity;
|
|
410
454
|
abortAllPrefetches();
|
|
@@ -70,6 +70,49 @@ export function setPrefetchDecoder(fn: PrefetchDecoder): void {
|
|
|
70
70
|
decoder = fn;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Build the respawn closure for a cleanly-completed prefetch entry. Each call
|
|
75
|
+
* tees the reserve byte branch: one side feeds a fresh decode — a fresh handle
|
|
76
|
+
* stream and fresh serialized-stream instances, which no cloning of the
|
|
77
|
+
* revived payload graph could produce — and the other becomes the next
|
|
78
|
+
* reserve, so the replacement entry can respawn again. `streamComplete`
|
|
79
|
+
* resolves immediately and `complete` starts true: the buffered bytes are a
|
|
80
|
+
* finished stream by construction. The chunk imports the decode triggers are
|
|
81
|
+
* already in the module cache from the original eager decode, so a respawn
|
|
82
|
+
* costs ~ms with no network.
|
|
83
|
+
*/
|
|
84
|
+
function makeRespawn(
|
|
85
|
+
storageKey: string,
|
|
86
|
+
reserve: ReadableStream<Uint8Array>,
|
|
87
|
+
scope: "source" | "wildcard",
|
|
88
|
+
): () => DecodedPrefetch {
|
|
89
|
+
return () => {
|
|
90
|
+
const [body, nextReserve] = reserve.tee();
|
|
91
|
+
// decoder is non-null here: respawn is only armed after a successful
|
|
92
|
+
// eager decode, which requires the decoder to have been set.
|
|
93
|
+
const payload = decoder!(Promise.resolve(new Response(body)));
|
|
94
|
+
payload.catch(() => {});
|
|
95
|
+
const entry: DecodedPrefetch = {
|
|
96
|
+
payload,
|
|
97
|
+
streamComplete: Promise.resolve(),
|
|
98
|
+
scope,
|
|
99
|
+
complete: true,
|
|
100
|
+
dispose: () => {
|
|
101
|
+
// Rejects (caught) instead of throwing if the branch is already
|
|
102
|
+
// locked by a later respawn — cache eviction never races adoption on
|
|
103
|
+
// the same entry object, so this is belt-and-braces.
|
|
104
|
+
nextReserve.cancel().catch(() => {});
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
entry.respawn = makeRespawn(storageKey, nextReserve, scope);
|
|
108
|
+
// Parity with the original path: a rejected decode must not stay
|
|
109
|
+
// consumable. Clean bytes should never fail to decode, but if they do,
|
|
110
|
+
// evict (identity-guarded) so navigation refetches instead.
|
|
111
|
+
payload.catch(() => removePrefetch(storageKey, entry));
|
|
112
|
+
return entry;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
73
116
|
/**
|
|
74
117
|
* Check if a URL resolves to the current page (same pathname + search).
|
|
75
118
|
* Used to prevent same-page prefetching, which produces a trivial diff
|
|
@@ -271,9 +314,23 @@ function executePrefetchFetch(
|
|
|
271
314
|
true,
|
|
272
315
|
);
|
|
273
316
|
|
|
317
|
+
// Split the decode branch: one side feeds the eager decoder (unchanged —
|
|
318
|
+
// client chunks still import at prefetch time), the other stays unread as
|
|
319
|
+
// a reserve of the raw Flight bytes. A decoded payload is single-render
|
|
320
|
+
// (its handle stream drains during commit), so adoption would otherwise
|
|
321
|
+
// spend the entry; the reserve lets a cleanly-completed entry respawn a
|
|
322
|
+
// fresh decode per adoption instead (see makeRespawn).
|
|
323
|
+
let decodeSource: Response = tracked;
|
|
324
|
+
let reserve: ReadableStream<Uint8Array> | undefined;
|
|
325
|
+
if (tracked.body) {
|
|
326
|
+
const [decodeBody, reserveBody] = tracked.body.tee();
|
|
327
|
+
decodeSource = new Response(decodeBody, { headers: tracked.headers });
|
|
328
|
+
reserve = reserveBody;
|
|
329
|
+
}
|
|
330
|
+
|
|
274
331
|
// Eager decode: parsing the Flight stream imports the route's client
|
|
275
332
|
// chunks now, not on click.
|
|
276
|
-
const payload = decoder(Promise.resolve(
|
|
333
|
+
const payload = decoder(Promise.resolve(decodeSource));
|
|
277
334
|
// Mark handled so an unconsumed prefetch decode error stays quiet; the
|
|
278
335
|
// error is still surfaced to navigation if it consumes the entry.
|
|
279
336
|
payload.catch(() => {});
|
|
@@ -283,6 +340,11 @@ function executePrefetchFetch(
|
|
|
283
340
|
streamComplete,
|
|
284
341
|
scope,
|
|
285
342
|
complete: false,
|
|
343
|
+
...(reserve && {
|
|
344
|
+
dispose: () => {
|
|
345
|
+
reserve.cancel().catch(() => {});
|
|
346
|
+
},
|
|
347
|
+
}),
|
|
286
348
|
};
|
|
287
349
|
storePrefetch(storageKey, entry, gen);
|
|
288
350
|
// The stall timeout now owns the body stream: arm eviction (publishedKey)
|
|
@@ -301,10 +363,29 @@ function executePrefetchFetch(
|
|
|
301
363
|
streamComplete.then(() => {
|
|
302
364
|
if (!endedCleanly) removePrefetch(storageKey, entry);
|
|
303
365
|
});
|
|
304
|
-
// Mark complete ONLY on a fully-healthy prefetch (decode resolved AND
|
|
366
|
+
// Mark complete ONLY on a fully-healthy prefetch (decode resolved AND
|
|
367
|
+
// clean EOF) — and only then arm respawn: a truncated or failed stream's
|
|
368
|
+
// reserve would replay broken bytes, so it stays one-shot (and its
|
|
369
|
+
// buffered reserve is released via the removePrefetch dispose above).
|
|
305
370
|
Promise.allSettled([payload, streamComplete]).then(([decode]) => {
|
|
306
371
|
if (decode.status === "fulfilled" && endedCleanly) {
|
|
307
372
|
entry.complete = true;
|
|
373
|
+
if (reserve) {
|
|
374
|
+
entry.respawn = makeRespawn(storageKey, reserve, scope);
|
|
375
|
+
// Refill after an early adoption. A click that lands before this
|
|
376
|
+
// point adopts the entry with respawn unarmed and leaves the slot
|
|
377
|
+
// empty — via either path: pre-headers inflight adoption makes
|
|
378
|
+
// storePrefetch skip publication (adoptedKeys), and a mid-stream
|
|
379
|
+
// cache adoption deletes the incomplete entry. Now that the bytes
|
|
380
|
+
// proved themselves complete, publish a respawned sibling so the
|
|
381
|
+
// revisit is warm. Guards: hasPrefetch skips when the slot is
|
|
382
|
+
// live again (our own un-adopted entry, a fresh entry, or a new
|
|
383
|
+
// in-flight prefetch), and storePrefetch's generation check drops
|
|
384
|
+
// the sibling if the cache was invalidated since the fetch began.
|
|
385
|
+
if (!hasPrefetch(storageKey)) {
|
|
386
|
+
storePrefetch(storageKey, entry.respawn(), gen);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
308
389
|
}
|
|
309
390
|
clearTimeout(timeoutId);
|
|
310
391
|
});
|
|
@@ -267,10 +267,13 @@ interface KVItemEnvelope {
|
|
|
267
267
|
* @internal
|
|
268
268
|
*/
|
|
269
269
|
interface CFShellEnvelope {
|
|
270
|
-
/**
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
270
|
+
/**
|
|
271
|
+
* base64-encoded prelude bytes. Absent iff `no` (navigationOnly entries
|
|
272
|
+
* store no document half — ShellCacheEntry.prelude).
|
|
273
|
+
*/
|
|
274
|
+
p?: string;
|
|
275
|
+
/** postponed state JSON, or null (DATA variant — no holes). Absent iff `no`. */
|
|
276
|
+
po?: string | null;
|
|
274
277
|
/** React.version captured at prerender time */
|
|
275
278
|
rv: string;
|
|
276
279
|
/** Build version captured at prerender time (ShellCacheEntry.buildVersion) */
|
|
@@ -347,8 +350,14 @@ function isShellEnvelope(value: unknown): value is CFShellEnvelope {
|
|
|
347
350
|
if (value == null || typeof value !== "object") return false;
|
|
348
351
|
const envelope = value as Partial<CFShellEnvelope>;
|
|
349
352
|
return (
|
|
350
|
-
|
|
351
|
-
|
|
353
|
+
// Document half: required unless the envelope is navigationOnly (`no`),
|
|
354
|
+
// which stores neither field. Tolerate a legacy navigationOnly envelope
|
|
355
|
+
// that still carries them.
|
|
356
|
+
(typeof envelope.p === "string" ||
|
|
357
|
+
(envelope.p === undefined && envelope.no === true)) &&
|
|
358
|
+
(envelope.po === null ||
|
|
359
|
+
typeof envelope.po === "string" ||
|
|
360
|
+
(envelope.po === undefined && envelope.no === true)) &&
|
|
352
361
|
typeof envelope.rv === "string" &&
|
|
353
362
|
(envelope.bv === undefined || typeof envelope.bv === "string") &&
|
|
354
363
|
typeof envelope.c === "number" &&
|
|
@@ -400,6 +409,8 @@ interface KVResponseEnvelope {
|
|
|
400
409
|
|
|
401
410
|
export class CFCacheStore<TEnv = unknown> implements SegmentCacheStore<TEnv> {
|
|
402
411
|
readonly supportsPassiveShellReads: true = true;
|
|
412
|
+
/** True when constructed without KV: the shell family no-ops (see ctor). */
|
|
413
|
+
readonly shellFamilyInert?: boolean;
|
|
403
414
|
readonly defaults?: CacheDefaults;
|
|
404
415
|
readonly keyGenerator?: (
|
|
405
416
|
ctx: RequestContext<TEnv>,
|
|
@@ -471,6 +482,11 @@ export class CFCacheStore<TEnv = unknown> implements SegmentCacheStore<TEnv> {
|
|
|
471
482
|
this.keyGenerator = options.keyGenerator;
|
|
472
483
|
this.waitUntil = (fn) => options.ctx.waitUntil(fn());
|
|
473
484
|
this.kv = options.kv;
|
|
485
|
+
// The shell family requires KV (getShell/putShell no-op without it — see
|
|
486
|
+
// warnShellFamilyInertOnce). Declaring it lets scheduleShellCapture skip
|
|
487
|
+
// captures whose write could only no-op instead of burning a background
|
|
488
|
+
// render per MISS that still occupies the serialized capture queue.
|
|
489
|
+
this.shellFamilyInert = options.kv ? undefined : true;
|
|
474
490
|
this.onRevalidateTag = options.onRevalidateTag;
|
|
475
491
|
// tagPurge accepts a ready purge function or a credentials object; the
|
|
476
492
|
// object form is normalized through the built-in zone purge client, which
|
|
@@ -2083,8 +2099,11 @@ export class CFCacheStore<TEnv = unknown> implements SegmentCacheStore<TEnv> {
|
|
|
2083
2099
|
}
|
|
2084
2100
|
|
|
2085
2101
|
const envelope: CFShellEnvelope = {
|
|
2086
|
-
|
|
2087
|
-
|
|
2102
|
+
// Presence-keyed: a navigationOnly entry has no document half, and an
|
|
2103
|
+
// omitted key (vs an explicit undefined) also keeps it out of the
|
|
2104
|
+
// serialized JSON.
|
|
2105
|
+
...(entry.prelude !== undefined ? { p: entry.prelude } : {}),
|
|
2106
|
+
...(entry.postponed !== undefined ? { po: entry.postponed } : {}),
|
|
2088
2107
|
rv: entry.reactVersion,
|
|
2089
2108
|
bv: entry.buildVersion,
|
|
2090
2109
|
c: entry.createdAt,
|
package/src/cache/types.ts
CHANGED
|
@@ -198,6 +198,16 @@ export interface SegmentCacheStore<TEnv = unknown> {
|
|
|
198
198
|
tags?: string[],
|
|
199
199
|
): Promise<"stored" | "invalidated" | void>;
|
|
200
200
|
|
|
201
|
+
/**
|
|
202
|
+
* Declares the shell family present-but-inert: getShell/putShell exist but
|
|
203
|
+
* no-op (CFCacheStore without a KV namespace). scheduleShellCapture skips
|
|
204
|
+
* captures whose only write target is inert — the background render would be
|
|
205
|
+
* dead work that still occupies the per-isolate serialized capture queue
|
|
206
|
+
* (a promise-heavy route bakes for seconds per MISS with nothing stored).
|
|
207
|
+
* Absent/false means the family, when present, actually stores.
|
|
208
|
+
*/
|
|
209
|
+
shellFamilyInert?: boolean;
|
|
210
|
+
|
|
201
211
|
/**
|
|
202
212
|
* Get a cached function result by key.
|
|
203
213
|
* Returns the serialized value, optional handle data, and staleness flag.
|
|
@@ -264,8 +274,8 @@ export interface CacheItemResult {
|
|
|
264
274
|
/**
|
|
265
275
|
* A cached PPR (Partial Pre-rendering) shell entry.
|
|
266
276
|
*
|
|
267
|
-
*
|
|
268
|
-
* and React's postponed state — because the pair is version- and
|
|
277
|
+
* A DOCUMENT entry carries BOTH artifacts a resume needs — the rendered HTML
|
|
278
|
+
* prelude and React's postponed state — because the pair is version- and
|
|
269
279
|
* generation-coupled and must never be mixed across a React upgrade or a build
|
|
270
280
|
* change. The reactVersion and buildVersion fields are the read-time gates that
|
|
271
281
|
* enforce both halves: isValidShellHit (rsc/shell-serve.ts) treats an entry
|
|
@@ -274,15 +284,28 @@ export interface CacheItemResult {
|
|
|
274
284
|
* positions against one exact tree; resuming it against a different React or a
|
|
275
285
|
* different app build tree-mismatches inside resume(), AFTER the 200 + prelude
|
|
276
286
|
* are committed — an unrecoverable broken serve).
|
|
287
|
+
*
|
|
288
|
+
* A `navigationOnly` entry stores NEITHER half: nothing ever serves its HTML
|
|
289
|
+
* (document serving skips navigationOnly entries at the read gate, and partial
|
|
290
|
+
* replay consumes only `snapshot`/`docKey`), so the prelude would ride every
|
|
291
|
+
* store write and read as dead weight at KV-value scale. The capture still runs
|
|
292
|
+
* the full fizz prerender — it is the completeness arbiter and sanity gate —
|
|
293
|
+
* but its output is dropped before putShell. hasIntactShellPayload is the
|
|
294
|
+
* document-half gate; navigationOnly entries never satisfy it.
|
|
277
295
|
*/
|
|
278
296
|
export interface ShellCacheEntry {
|
|
279
|
-
/**
|
|
280
|
-
|
|
297
|
+
/**
|
|
298
|
+
* Rendered HTML prelude bytes, base64-encoded (stores are JSON-serializing).
|
|
299
|
+
* Absent on `navigationOnly` entries (no document half is stored — see the
|
|
300
|
+
* interface doc); present on every document-servable entry.
|
|
301
|
+
*/
|
|
302
|
+
prelude?: string;
|
|
281
303
|
/**
|
|
282
304
|
* JSON.stringify of React's postponed state, or null when the shell settled
|
|
283
|
-
* with no holes (the DATA variant — served without a fizz resume).
|
|
305
|
+
* with no holes (the DATA variant — served without a fizz resume). Absent
|
|
306
|
+
* exactly when `prelude` is (navigationOnly entries).
|
|
284
307
|
*/
|
|
285
|
-
postponed
|
|
308
|
+
postponed?: string | null;
|
|
286
309
|
/** React.version captured at prerender time; the read-time invalidation gate. */
|
|
287
310
|
reactVersion: string;
|
|
288
311
|
/**
|
|
@@ -366,6 +389,18 @@ export interface ShellCacheEntry {
|
|
|
366
389
|
createdAt: number;
|
|
367
390
|
}
|
|
368
391
|
|
|
392
|
+
/**
|
|
393
|
+
* A shell entry whose document half is present — what the document HIT path
|
|
394
|
+
* (serveShellHit / lookupBuildShell) consumes. hasIntactShellPayload
|
|
395
|
+
* (rsc/shell-serve.ts) is the runtime gate AND the type narrowing to this
|
|
396
|
+
* shape; navigationOnly entries never pass it (their document half is not
|
|
397
|
+
* stored).
|
|
398
|
+
*/
|
|
399
|
+
export type DocumentShellCacheEntry = ShellCacheEntry & {
|
|
400
|
+
prelude: string;
|
|
401
|
+
postponed: string | null;
|
|
402
|
+
};
|
|
403
|
+
|
|
369
404
|
/**
|
|
370
405
|
* The families a shell snapshot pins. The item/segment/response families are
|
|
371
406
|
* cache-store reads/writes (recorded by RecordingShellStore); the loader family
|
|
@@ -184,10 +184,13 @@ interface VercelResponseEnvelope {
|
|
|
184
184
|
|
|
185
185
|
/** Stored envelope for a PPR shell entry (getShell/putShell). */
|
|
186
186
|
interface VercelShellEnvelope {
|
|
187
|
-
/**
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
187
|
+
/**
|
|
188
|
+
* base64-encoded prelude bytes. Absent iff `no` (navigationOnly entries
|
|
189
|
+
* store no document half — ShellCacheEntry.prelude).
|
|
190
|
+
*/
|
|
191
|
+
p?: string;
|
|
192
|
+
/** postponed state JSON, or null (DATA variant). Absent iff `no`. */
|
|
193
|
+
po?: string | null;
|
|
191
194
|
/** React.version at capture. */
|
|
192
195
|
rv: string;
|
|
193
196
|
/** Build version at capture (ShellCacheEntry.buildVersion). */
|
|
@@ -868,8 +871,11 @@ export class VercelCacheStore<
|
|
|
868
871
|
? Math.min(totalTtl, TAG_MARKER_TTL_SECONDS)
|
|
869
872
|
: totalTtl;
|
|
870
873
|
const env: VercelShellEnvelope = {
|
|
871
|
-
|
|
872
|
-
|
|
874
|
+
// Presence-keyed: a navigationOnly entry has no document half, and an
|
|
875
|
+
// omitted key (vs an explicit undefined) also keeps it out of the
|
|
876
|
+
// serialized JSON.
|
|
877
|
+
...(entry.prelude !== undefined ? { p: entry.prelude } : {}),
|
|
878
|
+
...(entry.postponed !== undefined ? { po: entry.postponed } : {}),
|
|
873
879
|
rv: entry.reactVersion,
|
|
874
880
|
bv: entry.buildVersion,
|
|
875
881
|
c: entry.createdAt,
|
|
@@ -1210,13 +1216,21 @@ export class VercelCacheStore<
|
|
|
1210
1216
|
private asShellEnvelope(raw: unknown): VercelShellEnvelope | null {
|
|
1211
1217
|
if (!isRecord(raw)) return null;
|
|
1212
1218
|
const { p, po, rv, bv, c, s, e, t, i, sn, dk, lh, tw, no } = raw;
|
|
1213
|
-
if (typeof
|
|
1214
|
-
|
|
1219
|
+
if (typeof rv !== "string") return null;
|
|
1220
|
+
// Document half: required unless navigationOnly (`no`), which stores
|
|
1221
|
+
// neither field. Tolerate a legacy navigationOnly envelope that still
|
|
1222
|
+
// carries them.
|
|
1223
|
+
if (p === undefined ? no !== true : typeof p !== "string") return null;
|
|
1224
|
+
if (
|
|
1225
|
+
po === undefined ? no !== true : po !== null && typeof po !== "string"
|
|
1226
|
+
) {
|
|
1227
|
+
return null;
|
|
1228
|
+
}
|
|
1215
1229
|
if (typeof c !== "number") return null;
|
|
1216
1230
|
if (typeof s !== "number" || typeof e !== "number") return null;
|
|
1217
1231
|
return {
|
|
1218
|
-
p,
|
|
1219
|
-
po: po as string | null,
|
|
1232
|
+
...(typeof p === "string" ? { p } : {}),
|
|
1233
|
+
...(po !== undefined ? { po: po as string | null } : {}),
|
|
1220
1234
|
rv,
|
|
1221
1235
|
bv: typeof bv === "string" ? bv : undefined,
|
|
1222
1236
|
c,
|
|
@@ -33,6 +33,7 @@ import type {
|
|
|
33
33
|
TransitionItem,
|
|
34
34
|
UseItems,
|
|
35
35
|
} from "../route-types.js";
|
|
36
|
+
import type { StaticHandlerRef } from "../static-handler.js";
|
|
36
37
|
|
|
37
38
|
// Re-export route item types for backward compatibility
|
|
38
39
|
export type {
|
|
@@ -140,8 +141,8 @@ export type RouteHelpers<T extends RouteDefinition, TEnv> = {
|
|
|
140
141
|
* },
|
|
141
142
|
* })
|
|
142
143
|
* ```
|
|
143
|
-
* @param slots - Object with slot names (prefixed with @) mapped to handlers
|
|
144
|
-
* or `{ handler, use? }`
|
|
144
|
+
* @param slots - Object with slot names (prefixed with @) mapped to handlers,
|
|
145
|
+
* Static() definitions, or `{ handler, use? }` descriptors.
|
|
145
146
|
* @param use - Optional callback for loaders, loading, revalidate, etc.
|
|
146
147
|
* Items here apply to every slot in the call (broadcast).
|
|
147
148
|
* For per-slot single-assignment items, use the slot descriptor's
|
|
@@ -157,8 +158,9 @@ export type RouteHelpers<T extends RouteDefinition, TEnv> = {
|
|
|
157
158
|
`@${string}`,
|
|
158
159
|
| Handler<any, any, TEnv>
|
|
159
160
|
| ReactNode
|
|
161
|
+
| StaticHandlerRef
|
|
160
162
|
| {
|
|
161
|
-
handler: Handler<any, any, TEnv> | ReactNode;
|
|
163
|
+
handler: Handler<any, any, TEnv> | ReactNode | StaticHandlerRef;
|
|
162
164
|
use?: () => UseItems<ParallelUseItem>;
|
|
163
165
|
}
|
|
164
166
|
>,
|