@rangojs/router 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -1
- package/dist/types/browser/event-controller.d.ts +4 -0
- package/dist/types/browser/link-interceptor.d.ts +17 -7
- package/dist/types/browser/navigation-bridge.d.ts +13 -1
- package/dist/types/browser/notify-listeners.d.ts +2 -0
- package/dist/types/browser/prefetch/cache.d.ts +1 -1
- package/dist/types/browser/prefetch/default-strategy.d.ts +12 -3
- package/dist/types/browser/prefetch/invalidation.d.ts +6 -0
- package/dist/types/browser/prefetch/loader.d.ts +3 -1
- package/dist/types/browser/prefetch/observer.d.ts +3 -6
- package/dist/types/browser/rango-state.d.ts +4 -0
- package/dist/types/browser/react/Link.d.ts +4 -9
- package/dist/types/browser/react/context.d.ts +3 -0
- package/dist/types/browser/rsc-router.d.ts +7 -2
- package/dist/types/browser/types.d.ts +1 -0
- package/dist/types/cache/cache-key-utils.d.ts +11 -3
- package/dist/types/cache/cache-scope.d.ts +82 -3
- package/dist/types/cache/cf/cf-cache-store.d.ts +2 -2
- package/dist/types/cache/index.d.ts +3 -1
- package/dist/types/cache/search-params-filter.d.ts +64 -0
- package/dist/types/cache/shell-snapshot.d.ts +4 -4
- package/dist/types/cache/types.d.ts +30 -2
- package/dist/types/cache/vercel/vercel-cache-store.d.ts +2 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.rsc.d.ts +1 -0
- package/dist/types/router/match-middleware/cache-lookup.d.ts +13 -0
- package/dist/types/router/navigation-snapshot.d.ts +29 -0
- package/dist/types/router/router-options.d.ts +27 -3
- package/dist/types/rsc/shell-build-manifest.d.ts +7 -1
- package/dist/types/rsc/shell-serve.d.ts +7 -1
- package/dist/types/rsc/types.d.ts +17 -0
- package/dist/types/server/request-context.d.ts +57 -4
- package/dist/types/testing/render-route.d.ts +10 -1
- package/dist/types/testing/shell-status.d.ts +6 -3
- package/dist/types/vite/plugin-types.d.ts +1 -1
- package/dist/vite/index.js +5 -5
- package/package.json +23 -22
- package/skills/caching/SKILL.md +39 -0
- package/skills/comparison/references/framework-comparison.md +7 -1
- package/skills/links/SKILL.md +24 -0
- package/skills/ppr/SKILL.md +53 -4
- package/skills/router-setup/SKILL.md +7 -2
- package/skills/testing/client-components.md +15 -14
- package/skills/vercel/SKILL.md +1 -1
- package/src/browser/event-controller.ts +110 -11
- package/src/browser/link-interceptor.ts +469 -20
- package/src/browser/navigation-bridge.ts +71 -2
- package/src/browser/navigation-store.ts +24 -1
- package/src/browser/notify-listeners.ts +22 -0
- package/src/browser/prefetch/cache.ts +4 -2
- package/src/browser/prefetch/default-strategy.ts +43 -3
- package/src/browser/prefetch/invalidation.ts +30 -0
- package/src/browser/prefetch/loader.ts +19 -12
- package/src/browser/prefetch/observer.ts +50 -22
- package/src/browser/rango-state.ts +21 -0
- package/src/browser/react/Link.tsx +97 -88
- package/src/browser/react/NavigationProvider.tsx +1 -0
- package/src/browser/react/context.ts +4 -0
- package/src/browser/rsc-router.tsx +22 -9
- package/src/browser/types.ts +1 -0
- package/src/cache/cache-key-utils.ts +18 -4
- package/src/cache/cache-runtime.ts +7 -2
- package/src/cache/cache-scope.ts +152 -23
- package/src/cache/cf/cf-cache-store.ts +51 -16
- package/src/cache/document-cache.ts +7 -1
- package/src/cache/index.ts +7 -0
- package/src/cache/search-params-filter.ts +118 -0
- package/src/cache/shell-snapshot.ts +8 -4
- package/src/cache/types.ts +33 -2
- package/src/cache/vercel/vercel-cache-store.ts +17 -3
- package/src/index.rsc.ts +4 -0
- package/src/index.ts +6 -0
- package/src/router/match-middleware/cache-lookup.ts +146 -33
- package/src/router/match-middleware/cache-store.ts +70 -0
- package/src/router/navigation-snapshot.ts +46 -6
- package/src/router/router-options.ts +31 -4
- package/src/rsc/handler.ts +9 -0
- package/src/rsc/response-cache-serve.ts +1 -1
- package/src/rsc/rsc-rendering.ts +252 -27
- package/src/rsc/shell-build-manifest.ts +8 -1
- package/src/rsc/shell-capture.ts +5 -0
- package/src/rsc/shell-serve.ts +8 -2
- package/src/rsc/types.ts +17 -0
- package/src/server/request-context.ts +62 -3
- package/src/testing/dispatch.ts +21 -3
- package/src/testing/render-route.tsx +86 -17
- package/src/testing/shell-status.ts +20 -3
- package/src/vite/plugin-types.ts +1 -1
- package/src/vite/plugins/vercel-output.ts +2 -2
- package/dist/types.backup/__internal.d.ts +0 -127
- package/dist/types.backup/bin/rango.d.ts +0 -1
- package/dist/types.backup/browser/action-coordinator.d.ts +0 -57
- package/dist/types.backup/browser/action-fence.d.ts +0 -33
- package/dist/types.backup/browser/app-shell.d.ts +0 -34
- package/dist/types.backup/browser/app-version.d.ts +0 -6
- package/dist/types.backup/browser/connection-warmup.d.ts +0 -31
- package/dist/types.backup/browser/cookie-name.d.ts +0 -66
- package/dist/types.backup/browser/event-controller.d.ts +0 -221
- package/dist/types.backup/browser/history-state.d.ts +0 -26
- package/dist/types.backup/browser/index.d.ts +0 -1
- package/dist/types.backup/browser/intercept-utils.d.ts +0 -30
- package/dist/types.backup/browser/invalidate-client-cache.d.ts +0 -17
- package/dist/types.backup/browser/link-interceptor.d.ts +0 -43
- package/dist/types.backup/browser/logging.d.ts +0 -33
- package/dist/types.backup/browser/merge-segment-loaders.d.ts +0 -38
- package/dist/types.backup/browser/navigation-bridge.d.ts +0 -27
- package/dist/types.backup/browser/navigation-client.d.ts +0 -17
- package/dist/types.backup/browser/navigation-store-handle.d.ts +0 -25
- package/dist/types.backup/browser/navigation-store.d.ts +0 -95
- package/dist/types.backup/browser/navigation-transaction.d.ts +0 -75
- package/dist/types.backup/browser/network-error-handler.d.ts +0 -35
- package/dist/types.backup/browser/partial-update.d.ts +0 -61
- package/dist/types.backup/browser/prefetch/cache.d.ts +0 -183
- package/dist/types.backup/browser/prefetch/fetch.d.ts +0 -52
- package/dist/types.backup/browser/prefetch/observer.d.ts +0 -27
- package/dist/types.backup/browser/prefetch/policy.d.ts +0 -13
- package/dist/types.backup/browser/prefetch/queue.d.ts +0 -48
- package/dist/types.backup/browser/prefetch/resource-ready.d.ts +0 -28
- package/dist/types.backup/browser/rango-state.d.ts +0 -52
- package/dist/types.backup/browser/react/Link.d.ts +0 -140
- package/dist/types.backup/browser/react/NavigationProvider.d.ts +0 -88
- package/dist/types.backup/browser/react/ScrollRestoration.d.ts +0 -78
- package/dist/types.backup/browser/react/context.d.ts +0 -54
- package/dist/types.backup/browser/react/filter-segment-order.d.ts +0 -35
- package/dist/types.backup/browser/react/index.d.ts +0 -1
- package/dist/types.backup/browser/react/location-state-shared.d.ts +0 -162
- package/dist/types.backup/browser/react/location-state.d.ts +0 -29
- package/dist/types.backup/browser/react/mount-context.d.ts +0 -23
- package/dist/types.backup/browser/react/nonce-context.d.ts +0 -14
- package/dist/types.backup/browser/react/shallow-equal.d.ts +0 -5
- package/dist/types.backup/browser/react/use-action.d.ts +0 -61
- package/dist/types.backup/browser/react/use-handle.d.ts +0 -21
- package/dist/types.backup/browser/react/use-href.d.ts +0 -32
- package/dist/types.backup/browser/react/use-link-status.d.ts +0 -36
- package/dist/types.backup/browser/react/use-mount.d.ts +0 -24
- package/dist/types.backup/browser/react/use-navigation.d.ts +0 -15
- package/dist/types.backup/browser/react/use-params.d.ts +0 -21
- package/dist/types.backup/browser/react/use-pathname.d.ts +0 -13
- package/dist/types.backup/browser/react/use-reverse.d.ts +0 -40
- package/dist/types.backup/browser/react/use-router.d.ts +0 -23
- package/dist/types.backup/browser/react/use-search-params.d.ts +0 -19
- package/dist/types.backup/browser/react/use-segments.d.ts +0 -29
- package/dist/types.backup/browser/response-adapter.d.ts +0 -58
- package/dist/types.backup/browser/rsc-router.d.ts +0 -141
- package/dist/types.backup/browser/scroll-restoration.d.ts +0 -103
- package/dist/types.backup/browser/segment-reconciler.d.ts +0 -74
- package/dist/types.backup/browser/segment-structure-assert.d.ts +0 -16
- package/dist/types.backup/browser/server-action-bridge.d.ts +0 -29
- package/dist/types.backup/browser/types.d.ts +0 -530
- package/dist/types.backup/browser/validate-redirect-origin.d.ts +0 -28
- package/dist/types.backup/build/collect-fallback-refs.d.ts +0 -5
- package/dist/types.backup/build/generate-manifest.d.ts +0 -100
- package/dist/types.backup/build/generate-route-types.d.ts +0 -8
- package/dist/types.backup/build/index.d.ts +0 -21
- package/dist/types.backup/build/prefix-tree-utils.d.ts +0 -56
- package/dist/types.backup/build/route-trie.d.ts +0 -89
- package/dist/types.backup/build/route-types/ast-helpers.d.ts +0 -3
- package/dist/types.backup/build/route-types/ast-route-extraction.d.ts +0 -13
- package/dist/types.backup/build/route-types/codegen.d.ts +0 -16
- package/dist/types.backup/build/route-types/include-resolution.d.ts +0 -74
- package/dist/types.backup/build/route-types/param-extraction.d.ts +0 -13
- package/dist/types.backup/build/route-types/per-module-writer.d.ts +0 -18
- package/dist/types.backup/build/route-types/router-processing.d.ts +0 -82
- package/dist/types.backup/build/route-types/scan-filter.d.ts +0 -17
- package/dist/types.backup/build/route-types/source-scan.d.ts +0 -13
- package/dist/types.backup/build/runtime-discovery.d.ts +0 -24
- package/dist/types.backup/cache/background-task.d.ts +0 -21
- package/dist/types.backup/cache/cache-error.d.ts +0 -71
- package/dist/types.backup/cache/cache-key-utils.d.ts +0 -35
- package/dist/types.backup/cache/cache-policy.d.ts +0 -59
- package/dist/types.backup/cache/cache-runtime.d.ts +0 -51
- package/dist/types.backup/cache/cache-scope.d.ts +0 -134
- package/dist/types.backup/cache/cache-tag.d.ts +0 -79
- package/dist/types.backup/cache/cf/cf-base64.d.ts +0 -4
- package/dist/types.backup/cache/cf/cf-cache-constants.d.ts +0 -105
- package/dist/types.backup/cache/cf/cf-cache-store.d.ts +0 -481
- package/dist/types.backup/cache/cf/cf-cache-types.d.ts +0 -300
- package/dist/types.backup/cache/cf/cf-kv-utils.d.ts +0 -22
- package/dist/types.backup/cache/cf/cf-tag-marker-memo.d.ts +0 -15
- package/dist/types.backup/cache/cf/index.d.ts +0 -3
- package/dist/types.backup/cache/document-cache.d.ts +0 -69
- package/dist/types.backup/cache/handle-capture.d.ts +0 -23
- package/dist/types.backup/cache/handle-snapshot.d.ts +0 -39
- package/dist/types.backup/cache/index.d.ts +0 -7
- package/dist/types.backup/cache/memory-segment-store.d.ts +0 -163
- package/dist/types.backup/cache/profile-registry.d.ts +0 -40
- package/dist/types.backup/cache/read-through-swr.d.ts +0 -60
- package/dist/types.backup/cache/segment-codec.d.ts +0 -78
- package/dist/types.backup/cache/shell-snapshot.d.ts +0 -162
- package/dist/types.backup/cache/tag-invalidation.d.ts +0 -74
- package/dist/types.backup/cache/taint.d.ts +0 -71
- package/dist/types.backup/cache/types.d.ts +0 -407
- package/dist/types.backup/cache/vercel/index.d.ts +0 -1
- package/dist/types.backup/cache/vercel/vercel-cache-store.d.ts +0 -267
- package/dist/types.backup/client.d.ts +0 -184
- package/dist/types.backup/client.rsc.d.ts +0 -39
- package/dist/types.backup/cloudflare/index.d.ts +0 -7
- package/dist/types.backup/cloudflare/tracing.d.ts +0 -53
- package/dist/types.backup/component-utils.d.ts +0 -46
- package/dist/types.backup/components/DefaultDocument.d.ts +0 -13
- package/dist/types.backup/context-var.d.ts +0 -84
- package/dist/types.backup/debug.d.ts +0 -57
- package/dist/types.backup/decode-loader-results.d.ts +0 -5
- package/dist/types.backup/default-error-boundary.d.ts +0 -10
- package/dist/types.backup/defer.d.ts +0 -89
- package/dist/types.backup/deps/browser.d.ts +0 -1
- package/dist/types.backup/deps/html-stream-client.d.ts +0 -1
- package/dist/types.backup/deps/html-stream-server.d.ts +0 -1
- package/dist/types.backup/deps/rsc.d.ts +0 -1
- package/dist/types.backup/deps/ssr.d.ts +0 -1
- package/dist/types.backup/encode-kv.d.ts +0 -35
- package/dist/types.backup/errors.d.ts +0 -226
- package/dist/types.backup/escape-script.d.ts +0 -44
- package/dist/types.backup/handle.d.ts +0 -93
- package/dist/types.backup/handles/MetaTags.d.ts +0 -17
- package/dist/types.backup/handles/Scripts.d.ts +0 -38
- package/dist/types.backup/handles/breadcrumbs.d.ts +0 -43
- package/dist/types.backup/handles/deferred-resolution.d.ts +0 -53
- package/dist/types.backup/handles/is-thenable.d.ts +0 -12
- package/dist/types.backup/handles/meta.d.ts +0 -43
- package/dist/types.backup/handles/script.d.ts +0 -139
- package/dist/types.backup/host/cookie-handler.d.ts +0 -8
- package/dist/types.backup/host/errors.d.ts +0 -40
- package/dist/types.backup/host/index.d.ts +0 -33
- package/dist/types.backup/host/pattern-matcher.d.ts +0 -30
- package/dist/types.backup/host/router.d.ts +0 -12
- package/dist/types.backup/host/testing.d.ts +0 -41
- package/dist/types.backup/host/types.d.ts +0 -148
- package/dist/types.backup/host/utils.d.ts +0 -20
- package/dist/types.backup/href-client.d.ts +0 -214
- package/dist/types.backup/index.d.ts +0 -112
- package/dist/types.backup/index.rsc.d.ts +0 -51
- package/dist/types.backup/internal-debug.d.ts +0 -1
- package/dist/types.backup/loader-store.d.ts +0 -193
- package/dist/types.backup/loader.d.ts +0 -18
- package/dist/types.backup/loader.rsc.d.ts +0 -18
- package/dist/types.backup/missing-id-error.d.ts +0 -1
- package/dist/types.backup/outlet-context.d.ts +0 -12
- package/dist/types.backup/outlet-provider.d.ts +0 -12
- package/dist/types.backup/prerender/build-shell-capture.d.ts +0 -104
- package/dist/types.backup/prerender/param-hash.d.ts +0 -6
- package/dist/types.backup/prerender/shell-manifest-key.d.ts +0 -18
- package/dist/types.backup/prerender/store.d.ts +0 -62
- package/dist/types.backup/prerender.d.ts +0 -292
- package/dist/types.backup/redirect-origin.d.ts +0 -55
- package/dist/types.backup/regex-escape.d.ts +0 -6
- package/dist/types.backup/render-error-thrower.d.ts +0 -13
- package/dist/types.backup/response-utils.d.ts +0 -35
- package/dist/types.backup/reverse.d.ts +0 -206
- package/dist/types.backup/root-error-boundary.d.ts +0 -32
- package/dist/types.backup/route-content-wrapper.d.ts +0 -40
- package/dist/types.backup/route-definition/dsl-helpers.d.ts +0 -130
- package/dist/types.backup/route-definition/helper-factories.d.ts +0 -22
- package/dist/types.backup/route-definition/helpers-types.d.ts +0 -392
- package/dist/types.backup/route-definition/index.d.ts +0 -7
- package/dist/types.backup/route-definition/redirect.d.ts +0 -48
- package/dist/types.backup/route-definition/resolve-handler-use.d.ts +0 -19
- package/dist/types.backup/route-definition/use-item-types.d.ts +0 -1
- package/dist/types.backup/route-definition.d.ts +0 -1
- package/dist/types.backup/route-map-builder.d.ts +0 -127
- package/dist/types.backup/route-name.d.ts +0 -27
- package/dist/types.backup/route-types.d.ts +0 -172
- package/dist/types.backup/router/basename.d.ts +0 -10
- package/dist/types.backup/router/content-negotiation.d.ts +0 -91
- package/dist/types.backup/router/debug-manifest.d.ts +0 -7
- package/dist/types.backup/router/error-handling.d.ts +0 -76
- package/dist/types.backup/router/find-match.d.ts +0 -19
- package/dist/types.backup/router/handler-context.d.ts +0 -41
- package/dist/types.backup/router/instrument.d.ts +0 -161
- package/dist/types.backup/router/intercept-resolution.d.ts +0 -79
- package/dist/types.backup/router/lazy-includes.d.ts +0 -26
- package/dist/types.backup/router/loader-resolution.d.ts +0 -63
- package/dist/types.backup/router/logging.d.ts +0 -41
- package/dist/types.backup/router/manifest.d.ts +0 -8
- package/dist/types.backup/router/match-api.d.ts +0 -19
- package/dist/types.backup/router/match-context.d.ts +0 -184
- package/dist/types.backup/router/match-handlers.d.ts +0 -49
- package/dist/types.backup/router/match-middleware/background-revalidation.d.ts +0 -113
- package/dist/types.backup/router/match-middleware/cache-lookup.d.ts +0 -113
- package/dist/types.backup/router/match-middleware/cache-store.d.ts +0 -112
- package/dist/types.backup/router/match-middleware/index.d.ts +0 -80
- package/dist/types.backup/router/match-middleware/intercept-resolution.d.ts +0 -116
- package/dist/types.backup/router/match-middleware/segment-resolution.d.ts +0 -94
- package/dist/types.backup/router/match-pipelines.d.ts +0 -103
- package/dist/types.backup/router/match-result.d.ts +0 -114
- package/dist/types.backup/router/metrics.d.ts +0 -6
- package/dist/types.backup/router/middleware-types.d.ts +0 -74
- package/dist/types.backup/router/middleware.d.ts +0 -116
- package/dist/types.backup/router/navigation-snapshot.d.ts +0 -22
- package/dist/types.backup/router/params-util.d.ts +0 -8
- package/dist/types.backup/router/parse-pattern.d.ts +0 -38
- package/dist/types.backup/router/pattern-matching.d.ts +0 -169
- package/dist/types.backup/router/prefetch-cache-ttl.d.ts +0 -27
- package/dist/types.backup/router/prefetch-limits.d.ts +0 -20
- package/dist/types.backup/router/prerender-match.d.ts +0 -50
- package/dist/types.backup/router/preview-match.d.ts +0 -22
- package/dist/types.backup/router/request-classification.d.ts +0 -104
- package/dist/types.backup/router/revalidation.d.ts +0 -57
- package/dist/types.backup/router/route-snapshot.d.ts +0 -112
- package/dist/types.backup/router/router-context.d.ts +0 -137
- package/dist/types.backup/router/router-interfaces.d.ts +0 -432
- package/dist/types.backup/router/router-options.d.ts +0 -738
- package/dist/types.backup/router/router-registry.d.ts +0 -15
- package/dist/types.backup/router/segment-resolution/fresh.d.ts +0 -55
- package/dist/types.backup/router/segment-resolution/helpers.d.ts +0 -93
- package/dist/types.backup/router/segment-resolution/loader-cache.d.ts +0 -33
- package/dist/types.backup/router/segment-resolution/loader-mask.d.ts +0 -44
- package/dist/types.backup/router/segment-resolution/loader-snapshot.d.ts +0 -90
- package/dist/types.backup/router/segment-resolution/mask-nested.d.ts +0 -53
- package/dist/types.backup/router/segment-resolution/revalidation.d.ts +0 -85
- package/dist/types.backup/router/segment-resolution/static-store.d.ts +0 -17
- package/dist/types.backup/router/segment-resolution/streamed-handler-telemetry.d.ts +0 -16
- package/dist/types.backup/router/segment-resolution/view-transition-default.d.ts +0 -28
- package/dist/types.backup/router/segment-resolution.d.ts +0 -3
- package/dist/types.backup/router/segment-wrappers.d.ts +0 -53
- package/dist/types.backup/router/state-cookie-name.d.ts +0 -1
- package/dist/types.backup/router/substitute-pattern-params.d.ts +0 -23
- package/dist/types.backup/router/telemetry-otel.d.ts +0 -113
- package/dist/types.backup/router/telemetry.d.ts +0 -215
- package/dist/types.backup/router/timeout.d.ts +0 -68
- package/dist/types.backup/router/tracing.d.ts +0 -125
- package/dist/types.backup/router/trie-matching.d.ts +0 -32
- package/dist/types.backup/router/types.d.ts +0 -98
- package/dist/types.backup/router/url-params.d.ts +0 -26
- package/dist/types.backup/router.d.ts +0 -7
- package/dist/types.backup/rsc/capture-queue.d.ts +0 -6
- package/dist/types.backup/rsc/full-payload.d.ts +0 -22
- package/dist/types.backup/rsc/handler-context.d.ts +0 -31
- package/dist/types.backup/rsc/handler.d.ts +0 -9
- package/dist/types.backup/rsc/helpers.d.ts +0 -213
- package/dist/types.backup/rsc/index.d.ts +0 -17
- package/dist/types.backup/rsc/json-route-result.d.ts +0 -20
- package/dist/types.backup/rsc/loader-fetch.d.ts +0 -14
- package/dist/types.backup/rsc/manifest-init.d.ts +0 -18
- package/dist/types.backup/rsc/nonce.d.ts +0 -28
- package/dist/types.backup/rsc/origin-guard.d.ts +0 -50
- package/dist/types.backup/rsc/progressive-enhancement.d.ts +0 -19
- package/dist/types.backup/rsc/redirect-guard.d.ts +0 -35
- package/dist/types.backup/rsc/response-cache-serve.d.ts +0 -46
- package/dist/types.backup/rsc/response-error.d.ts +0 -19
- package/dist/types.backup/rsc/response-route-handler.d.ts +0 -29
- package/dist/types.backup/rsc/rsc-rendering.d.ts +0 -23
- package/dist/types.backup/rsc/runtime-warnings.d.ts +0 -22
- package/dist/types.backup/rsc/server-action.d.ts +0 -68
- package/dist/types.backup/rsc/shell-build-manifest.d.ts +0 -84
- package/dist/types.backup/rsc/shell-capture-constants.d.ts +0 -27
- package/dist/types.backup/rsc/shell-capture.d.ts +0 -374
- package/dist/types.backup/rsc/shell-serve.d.ts +0 -136
- package/dist/types.backup/rsc/ssr-setup.d.ts +0 -48
- package/dist/types.backup/rsc/transition-gate.d.ts +0 -27
- package/dist/types.backup/rsc/types.d.ts +0 -290
- package/dist/types.backup/runtime-env.d.ts +0 -1
- package/dist/types.backup/search-params.d.ts +0 -125
- package/dist/types.backup/segment-content-promise.d.ts +0 -13
- package/dist/types.backup/segment-fragments.d.ts +0 -56
- package/dist/types.backup/segment-loader-promise.d.ts +0 -22
- package/dist/types.backup/segment-system.d.ts +0 -84
- package/dist/types.backup/serialize.d.ts +0 -164
- package/dist/types.backup/server/context.d.ts +0 -494
- package/dist/types.backup/server/cookie-parse.d.ts +0 -10
- package/dist/types.backup/server/cookie-store.d.ts +0 -107
- package/dist/types.backup/server/fetchable-loader-store.d.ts +0 -20
- package/dist/types.backup/server/handle-store.d.ts +0 -100
- package/dist/types.backup/server/loader-registry.d.ts +0 -32
- package/dist/types.backup/server/request-context.d.ts +0 -596
- package/dist/types.backup/server/root-layout.d.ts +0 -3
- package/dist/types.backup/server.d.ts +0 -15
- package/dist/types.backup/ssr/index.d.ts +0 -233
- package/dist/types.backup/ssr/inject-rsc-eager.d.ts +0 -3
- package/dist/types.backup/ssr/preinit-client-references.d.ts +0 -71
- package/dist/types.backup/ssr/ssr-root.d.ts +0 -69
- package/dist/types.backup/static-handler.d.ts +0 -57
- package/dist/types.backup/testing/cache-status.d.ts +0 -63
- package/dist/types.backup/testing/collect-handle.d.ts +0 -20
- package/dist/types.backup/testing/dispatch.d.ts +0 -123
- package/dist/types.backup/testing/dom.entry.d.ts +0 -15
- package/dist/types.backup/testing/e2e/fixture.d.ts +0 -37
- package/dist/types.backup/testing/e2e/index.d.ts +0 -30
- package/dist/types.backup/testing/e2e/matchers.d.ts +0 -17
- package/dist/types.backup/testing/e2e/page-helpers.d.ts +0 -62
- package/dist/types.backup/testing/e2e/parity.d.ts +0 -111
- package/dist/types.backup/testing/e2e/server.d.ts +0 -35
- package/dist/types.backup/testing/flight-matchers.d.ts +0 -55
- package/dist/types.backup/testing/flight-normalize.d.ts +0 -1
- package/dist/types.backup/testing/flight-tree.d.ts +0 -192
- package/dist/types.backup/testing/flight.d.ts +0 -115
- package/dist/types.backup/testing/flight.entry.d.ts +0 -27
- package/dist/types.backup/testing/generated-routes.d.ts +0 -66
- package/dist/types.backup/testing/index.d.ts +0 -52
- package/dist/types.backup/testing/internal/context.d.ts +0 -225
- package/dist/types.backup/testing/internal/flight-client-globals.d.ts +0 -1
- package/dist/types.backup/testing/internal/seed-vars.d.ts +0 -30
- package/dist/types.backup/testing/render-handler.d.ts +0 -160
- package/dist/types.backup/testing/render-route.d.ts +0 -246
- package/dist/types.backup/testing/run-loader.d.ts +0 -186
- package/dist/types.backup/testing/run-middleware.d.ts +0 -132
- package/dist/types.backup/testing/run-transition-when.d.ts +0 -77
- package/dist/types.backup/testing/vitest-stubs/cloudflare-email.d.ts +0 -6
- package/dist/types.backup/testing/vitest-stubs/cloudflare-workers.d.ts +0 -13
- package/dist/types.backup/testing/vitest-stubs/plugin-rsc.d.ts +0 -7
- package/dist/types.backup/testing/vitest-stubs/version.d.ts +0 -1
- package/dist/types.backup/testing/vitest.d.ts +0 -205
- package/dist/types.backup/theme/ThemeProvider.d.ts +0 -13
- package/dist/types.backup/theme/ThemeScript.d.ts +0 -45
- package/dist/types.backup/theme/constants.d.ts +0 -39
- package/dist/types.backup/theme/index.d.ts +0 -29
- package/dist/types.backup/theme/theme-context.d.ts +0 -21
- package/dist/types.backup/theme/theme-script.d.ts +0 -26
- package/dist/types.backup/theme/types.d.ts +0 -162
- package/dist/types.backup/theme/use-theme.d.ts +0 -8
- package/dist/types.backup/types/boundaries.d.ts +0 -93
- package/dist/types.backup/types/cache-types.d.ts +0 -191
- package/dist/types.backup/types/error-types.d.ts +0 -114
- package/dist/types.backup/types/global-namespace.d.ts +0 -90
- package/dist/types.backup/types/handler-context.d.ts +0 -658
- package/dist/types.backup/types/index.d.ts +0 -11
- package/dist/types.backup/types/loader-types.d.ts +0 -182
- package/dist/types.backup/types/request-scope.d.ts +0 -93
- package/dist/types.backup/types/route-config.d.ts +0 -105
- package/dist/types.backup/types/route-entry.d.ts +0 -95
- package/dist/types.backup/types/segments.d.ts +0 -234
- package/dist/types.backup/types.d.ts +0 -1
- package/dist/types.backup/urls/include-helper.d.ts +0 -17
- package/dist/types.backup/urls/include-provider.d.ts +0 -27
- package/dist/types.backup/urls/index.d.ts +0 -6
- package/dist/types.backup/urls/path-helper-types.d.ts +0 -197
- package/dist/types.backup/urls/path-helper.d.ts +0 -12
- package/dist/types.backup/urls/pattern-types.d.ts +0 -166
- package/dist/types.backup/urls/response-types.d.ts +0 -67
- package/dist/types.backup/urls/type-extraction.d.ts +0 -157
- package/dist/types.backup/urls/urls-function.d.ts +0 -24
- package/dist/types.backup/urls.d.ts +0 -1
- package/dist/types.backup/use-loader.d.ts +0 -150
- package/dist/types.backup/vercel/index.d.ts +0 -10
- package/dist/types.backup/vercel/tracing.d.ts +0 -70
- package/dist/types.backup/vite/debug.d.ts +0 -80
- package/dist/types.backup/vite/discovery/bundle-postprocess.d.ts +0 -12
- package/dist/types.backup/vite/discovery/dev-prerender-cache.d.ts +0 -65
- package/dist/types.backup/vite/discovery/discover-routers.d.ts +0 -17
- package/dist/types.backup/vite/discovery/discovery-errors.d.ts +0 -113
- package/dist/types.backup/vite/discovery/gate-state.d.ts +0 -79
- package/dist/types.backup/vite/discovery/prerender-collection.d.ts +0 -24
- package/dist/types.backup/vite/discovery/route-types-writer.d.ts +0 -32
- package/dist/types.backup/vite/discovery/self-gen-tracking.d.ts +0 -22
- package/dist/types.backup/vite/discovery/shell-prerender-phase.d.ts +0 -40
- package/dist/types.backup/vite/discovery/state.d.ts +0 -162
- package/dist/types.backup/vite/discovery/virtual-module-codegen.d.ts +0 -15
- package/dist/types.backup/vite/index.d.ts +0 -11
- package/dist/types.backup/vite/inject-client-debug.d.ts +0 -56
- package/dist/types.backup/vite/plugin-types.d.ts +0 -298
- package/dist/types.backup/vite/plugins/cjs-to-esm.d.ts +0 -6
- package/dist/types.backup/vite/plugins/client-ref-dedup.d.ts +0 -40
- package/dist/types.backup/vite/plugins/client-ref-hashing.d.ts +0 -35
- package/dist/types.backup/vite/plugins/cloudflare-protocol-stub.d.ts +0 -64
- package/dist/types.backup/vite/plugins/expose-action-id.d.ts +0 -18
- package/dist/types.backup/vite/plugins/expose-id-utils.d.ts +0 -37
- package/dist/types.backup/vite/plugins/expose-ids/export-analysis.d.ts +0 -19
- package/dist/types.backup/vite/plugins/expose-ids/handler-transform.d.ts +0 -10
- package/dist/types.backup/vite/plugins/expose-ids/loader-transform.d.ts +0 -8
- package/dist/types.backup/vite/plugins/expose-ids/router-transform.d.ts +0 -13
- package/dist/types.backup/vite/plugins/expose-ids/types.d.ts +0 -29
- package/dist/types.backup/vite/plugins/expose-internal-ids.d.ts +0 -6
- package/dist/types.backup/vite/plugins/performance-tracks.d.ts +0 -25
- package/dist/types.backup/vite/plugins/refresh-cmd.d.ts +0 -20
- package/dist/types.backup/vite/plugins/use-cache-transform.d.ts +0 -20
- package/dist/types.backup/vite/plugins/vercel-output.d.ts +0 -85
- package/dist/types.backup/vite/plugins/version-injector.d.ts +0 -21
- package/dist/types.backup/vite/plugins/version-plugin.d.ts +0 -19
- package/dist/types.backup/vite/plugins/virtual-entries.d.ts +0 -36
- package/dist/types.backup/vite/plugins/virtual-stub-plugin.d.ts +0 -7
- package/dist/types.backup/vite/rango.d.ts +0 -29
- package/dist/types.backup/vite/router-discovery.d.ts +0 -23
- package/dist/types.backup/vite/utils/ast-handler-extract.d.ts +0 -64
- package/dist/types.backup/vite/utils/banner.d.ts +0 -2
- package/dist/types.backup/vite/utils/bundle-analysis.d.ts +0 -28
- package/dist/types.backup/vite/utils/client-chunks.d.ts +0 -55
- package/dist/types.backup/vite/utils/directive-prologue.d.ts +0 -16
- package/dist/types.backup/vite/utils/forward-user-plugins.d.ts +0 -37
- package/dist/types.backup/vite/utils/manifest-utils.d.ts +0 -7
- package/dist/types.backup/vite/utils/package-resolution.d.ts +0 -6
- package/dist/types.backup/vite/utils/prerender-utils.d.ts +0 -32
- package/dist/types.backup/vite/utils/shared-utils.d.ts +0 -55
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cache profile resolution.
|
|
3
|
-
*
|
|
4
|
-
* Named cache profiles for the "use cache" directive define TTL, SWR, and
|
|
5
|
-
* optional default tags. createRouter() resolves the user's profiles once via
|
|
6
|
-
* resolveCacheProfiles() and threads the resulting map onto each request
|
|
7
|
-
* context; the "use cache: <profile>" runtime path reads it from there
|
|
8
|
-
* (request-scoped) — there is no global registry.
|
|
9
|
-
*/
|
|
10
|
-
export interface CacheProfile {
|
|
11
|
-
/** Time-to-live in seconds */
|
|
12
|
-
ttl: number;
|
|
13
|
-
/** Stale-while-revalidate window in seconds */
|
|
14
|
-
swr?: number;
|
|
15
|
-
/** Default cache tags for invalidation */
|
|
16
|
-
tags?: string[];
|
|
17
|
-
/**
|
|
18
|
-
* When true, a stale entry encountered during a server action's revalidation
|
|
19
|
-
* render is re-executed in the FOREGROUND (the action response reflects the
|
|
20
|
-
* refreshed value) instead of being served stale + revalidated in the
|
|
21
|
-
* background. Only the store write is deferred. Use this for mutation-related
|
|
22
|
-
* cached data that an action should refresh immediately; ordinary navigations
|
|
23
|
-
* always keep SWR. Default false: incidental TTL staleness must not turn an
|
|
24
|
-
* unrelated action into a synchronous cache-refresh barrier — for strong
|
|
25
|
-
* read-your-own-writes after a mutation, prefer updateTag() (a hard purge, so
|
|
26
|
-
* the action's own re-render is a fresh foreground miss).
|
|
27
|
-
*
|
|
28
|
-
* Honored only by `"use cache"` functions; route-level `cache()` and cached
|
|
29
|
-
* loaders ignore it (use updateTag() there).
|
|
30
|
-
*/
|
|
31
|
-
foregroundOnAction?: boolean;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Validate and merge user profiles with the default profile.
|
|
35
|
-
* Returns a new object suitable for both DSL-time and request-scoped use.
|
|
36
|
-
*
|
|
37
|
-
* Used by createRouter() to compute the resolved profile map once,
|
|
38
|
-
* stored on the router instance and passed to every request context.
|
|
39
|
-
*/
|
|
40
|
-
export declare function resolveCacheProfiles(profiles?: Record<string, CacheProfile>): Record<string, CacheProfile>;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SWR Read-Through Engine
|
|
3
|
-
*
|
|
4
|
-
* Generic read-through cache with stale-while-revalidate support
|
|
5
|
-
* for item-level caching (getItem/setItem).
|
|
6
|
-
*
|
|
7
|
-
* Flow:
|
|
8
|
-
* 1. Lookup cached item by key
|
|
9
|
-
* 2. Fresh hit → deserialize, return
|
|
10
|
-
* 3. Stale hit → deserialize, return, revalidate in background
|
|
11
|
-
* 4. Miss → execute, cache write (blocking when no waitUntil), return
|
|
12
|
-
*/
|
|
13
|
-
import type { CacheItemResult, CacheItemOptions } from "./types.js";
|
|
14
|
-
import type { CacheErrorReporter } from "./cache-error.js";
|
|
15
|
-
type WaitUntilHost = {
|
|
16
|
-
waitUntil?: (fn: () => Promise<void>) => void;
|
|
17
|
-
} & CacheErrorReporter;
|
|
18
|
-
export interface ReadThroughItemConfig<T> {
|
|
19
|
-
/** Retrieve a cached item by key */
|
|
20
|
-
getItem: (key: string) => Promise<CacheItemResult | null>;
|
|
21
|
-
/** Store a serialized item by key */
|
|
22
|
-
setItem: (key: string, value: string, options?: CacheItemOptions) => Promise<void>;
|
|
23
|
-
/** Cache key */
|
|
24
|
-
key: string;
|
|
25
|
-
/** Execute the underlying function/loader on miss or revalidation */
|
|
26
|
-
execute: () => Promise<T>;
|
|
27
|
-
/**
|
|
28
|
-
* Optional wrapper applied to execute() ONLY on the background
|
|
29
|
-
* stale-revalidation path (not the foreground miss, where the caller's context
|
|
30
|
-
* is already established). Used to re-establish the request-context ALS, which
|
|
31
|
-
* a detached waitUntil task loses on workerd. Defaults to calling execute()
|
|
32
|
-
* directly.
|
|
33
|
-
*/
|
|
34
|
-
wrapBackground?: (run: () => Promise<T>) => Promise<T>;
|
|
35
|
-
/** Serialize result for storage. Return null to skip caching. */
|
|
36
|
-
serialize: (data: T) => Promise<string | null>;
|
|
37
|
-
/** Deserialize cached value back to the original type */
|
|
38
|
-
deserialize: (value: string) => Promise<T>;
|
|
39
|
-
/** Options passed to setItem on cache write */
|
|
40
|
-
storeOptions: CacheItemOptions;
|
|
41
|
-
/** Called on fresh cache hit (before returning data) */
|
|
42
|
-
onHit?: (cached: CacheItemResult) => void;
|
|
43
|
-
/** Called on stale cache hit (before scheduling background revalidation) */
|
|
44
|
-
onStale?: (cached: CacheItemResult) => void;
|
|
45
|
-
/** Called on cache miss (before executing) */
|
|
46
|
-
onMiss?: () => void;
|
|
47
|
-
/** Called after successful cache write */
|
|
48
|
-
onCached?: () => void;
|
|
49
|
-
/** Host with optional waitUntil for background tasks */
|
|
50
|
-
host?: WaitUntilHost | null;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Read-through cache with SWR support for item-level caching.
|
|
54
|
-
*
|
|
55
|
-
* On fresh hit: returns deserialized cached data.
|
|
56
|
-
* On stale hit: returns stale data, schedules background revalidation.
|
|
57
|
-
* On miss: executes, writes to cache (blocking when no waitUntil), returns.
|
|
58
|
-
*/
|
|
59
|
-
export declare function readThroughItem<T>(config: ReadThroughItemConfig<T>): Promise<T>;
|
|
60
|
-
export {};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Segment Codec
|
|
3
|
-
*
|
|
4
|
-
* RSC serialization/deserialization for cached segments.
|
|
5
|
-
* Handles the Flight protocol stream <-> string conversion
|
|
6
|
-
* and the segment-level encode/decode lifecycle.
|
|
7
|
-
*/
|
|
8
|
-
import type { ResolvedSegment } from "../types.js";
|
|
9
|
-
import type { SerializedSegmentData } from "./types.js";
|
|
10
|
-
/**
|
|
11
|
-
* Convert a ReadableStream to a string.
|
|
12
|
-
*/
|
|
13
|
-
export declare function streamToString(stream: ReadableStream<Uint8Array>): Promise<string>;
|
|
14
|
-
/**
|
|
15
|
-
* Convert a string to a ReadableStream.
|
|
16
|
-
*/
|
|
17
|
-
export declare function stringToStream(str: string): ReadableStream<Uint8Array>;
|
|
18
|
-
/**
|
|
19
|
-
* RSC-serialize a value using React Server Components stream.
|
|
20
|
-
* Used for serializing loaderData, layout, loading components etc.
|
|
21
|
-
*
|
|
22
|
-
* Returns undefined for null/undefined inputs (component fields that are absent).
|
|
23
|
-
* For contexts where null is a valid result (loader caching, "use cache"),
|
|
24
|
-
* use serializeResult() instead which preserves null through RSC Flight.
|
|
25
|
-
*/
|
|
26
|
-
export declare function rscSerialize(value: unknown): Promise<string | undefined>;
|
|
27
|
-
/**
|
|
28
|
-
* RSC-deserialize a value from a stored string.
|
|
29
|
-
*/
|
|
30
|
-
export declare function rscDeserialize<T>(encoded: string | undefined): Promise<T | undefined>;
|
|
31
|
-
/**
|
|
32
|
-
* RSC-serialize any value including null.
|
|
33
|
-
* Unlike rscSerialize(), this does NOT skip null — it serializes it through
|
|
34
|
-
* RSC Flight so that a loader returning null produces a valid cached entry
|
|
35
|
-
* rather than a permanent cache miss.
|
|
36
|
-
*
|
|
37
|
-
* Returns null only on serialization failure.
|
|
38
|
-
*/
|
|
39
|
-
export declare function serializeResult(value: unknown): Promise<string | null>;
|
|
40
|
-
/**
|
|
41
|
-
* RSC-deserialize a cached result string.
|
|
42
|
-
* Counterpart to serializeResult() — always receives a non-empty string.
|
|
43
|
-
*/
|
|
44
|
-
export declare function deserializeResult<T>(encoded: string): Promise<T>;
|
|
45
|
-
/**
|
|
46
|
-
* RSC-deserialize a single encoded component string back to a React element.
|
|
47
|
-
* Used by the static handler runtime to revive pre-rendered components.
|
|
48
|
-
* Identical to deserializeResult<unknown>.
|
|
49
|
-
*/
|
|
50
|
-
export declare const deserializeComponent: (encoded: string) => Promise<unknown>;
|
|
51
|
-
/**
|
|
52
|
-
* Serialize segments for storage.
|
|
53
|
-
* Each segment's component, layout, loading, and loaderData are RSC-serialized.
|
|
54
|
-
* Metadata is preserved as-is.
|
|
55
|
-
*/
|
|
56
|
-
export declare function serializeSegments(segments: ResolvedSegment[]): Promise<SerializedSegmentData[]>;
|
|
57
|
-
/**
|
|
58
|
-
* Build ResolvedSegments that carry the STORED fragment strings verbatim
|
|
59
|
-
* instead of decoding them (PPR fast-path payload splice, issue #700; see
|
|
60
|
-
* segment-fragments.ts). The ReactNode fields (component/layout/loading)
|
|
61
|
-
* become {@link segmentFragment} envelopes the outer Flight render serializes
|
|
62
|
-
* as a string copy; the CONSUMER (SSR resume + browser hydration) expands them
|
|
63
|
-
* through its own deserializer. Loader data fields are NOT enveloped — they
|
|
64
|
-
* are consumer data of any shape (a marker there could collide) and decode
|
|
65
|
-
* server-side exactly as deserializeSegments does; on the doc/prerender
|
|
66
|
-
* records this path serves they are absent in practice (loaders are never
|
|
67
|
-
* cached with the route record).
|
|
68
|
-
*
|
|
69
|
-
* The loading "null" sentinel decodes here (not on the consumer): loading:null
|
|
70
|
-
* must survive as null, and shipping the raw sentinel would change the
|
|
71
|
-
* deduplicateLoaderSegments loading-presence check.
|
|
72
|
-
*/
|
|
73
|
-
export declare function fragmentSegments(data: SerializedSegmentData[]): Promise<ResolvedSegment[]>;
|
|
74
|
-
/**
|
|
75
|
-
* Deserialize segments from storage.
|
|
76
|
-
* Reconstructs ResolvedSegment objects from RSC-serialized data.
|
|
77
|
-
*/
|
|
78
|
-
export declare function deserializeSegments(data: SerializedSegmentData[]): Promise<ResolvedSegment[]>;
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Capture data snapshot: recording + seeding stores for PPR shell parity.
|
|
3
|
-
*
|
|
4
|
-
* The scar tissue this fixes: a PPR HIT serves frozen prelude bytes, then a
|
|
5
|
-
* FULL FRESH Flight render for hydration. Any shell-baked (non-hole) content
|
|
6
|
-
* that drifts between capture time and hit time — a cache() segment with a
|
|
7
|
-
* shorter ttl than the shell, a tag-invalidated item — makes the fresh payload
|
|
8
|
-
* disagree with the prelude, so React throws a hydration text mismatch and
|
|
9
|
-
* regenerates the tree client-side (wiping the FOUC theme class, flashing
|
|
10
|
-
* content). See docs/design/ppr-shell-resume.md.
|
|
11
|
-
*
|
|
12
|
-
* The fix (Next.js resume-data-cache analog, adapted to Rango's cache rings):
|
|
13
|
-
* the CAPTURE render records every cache-store read-hit and write it performed
|
|
14
|
-
* (the {@link RecordingShellStore}); the record rides inside the ShellCacheEntry
|
|
15
|
-
* as its `snapshot`; on a HIT the tail render reads through a
|
|
16
|
-
* {@link SeededShellStore} overlay that serves those recorded values AS FRESH,
|
|
17
|
-
* so the shell region reproduces byte-identically while everything NOT recorded
|
|
18
|
-
* (the holes — masked loaders were never executed at capture, so their reads
|
|
19
|
-
* were never recorded) stays live.
|
|
20
|
-
*
|
|
21
|
-
* The invariant, verbatim: the snapshot is exactly the set of cache-store reads
|
|
22
|
-
* the capture render performed; replaying them on a HIT reproduces the shell
|
|
23
|
-
* content byte-identically; everything not recorded stays live.
|
|
24
|
-
*/
|
|
25
|
-
import type { SegmentCacheStore, CacheGetResult, CacheItemResult, CacheItemOptions, CachedEntryData, ShellCacheEntry, ShellSnapshotRecord } from "./types.js";
|
|
26
|
-
/**
|
|
27
|
-
* A store wrapper the CAPTURE render reads through. Every call passes through to
|
|
28
|
-
* the underlying store unchanged; for the item/segment/response families it also
|
|
29
|
-
* RECORDS, last-write-wins per (family, key):
|
|
30
|
-
* - read-hits (get/getItem/getResponse returning non-null) — the value that
|
|
31
|
-
* fed the shell,
|
|
32
|
-
* - writes (set/setItem/putResponse) — the value a MISS computed and baked.
|
|
33
|
-
* The shell family (getShell/putShell) is never recorded (the snapshot rides
|
|
34
|
-
* inside a shell entry). Reads that MISS are not recorded (a miss produced no
|
|
35
|
-
* shell content; if the render then computed and wrote, that write is recorded).
|
|
36
|
-
*
|
|
37
|
-
* Deferred writes: cache writes run under waitUntil (fire-and-forget on Node,
|
|
38
|
-
* executionContext on workerd), so their setItem/set calls — hence their records
|
|
39
|
-
* — may land after the shell has quiesced. The capture collects those write
|
|
40
|
-
* promises via {@link trackWrite} and awaits them ({@link settleWrites}) before
|
|
41
|
-
* draining, so a MISS-at-capture value is still pinned.
|
|
42
|
-
*/
|
|
43
|
-
export declare class RecordingShellStore<TEnv = unknown> implements SegmentCacheStore<TEnv> {
|
|
44
|
-
private readonly inner;
|
|
45
|
-
private readonly records;
|
|
46
|
-
private readonly writes;
|
|
47
|
-
constructor(inner: SegmentCacheStore<TEnv>);
|
|
48
|
-
get defaults(): SegmentCacheStore<TEnv>["defaults"];
|
|
49
|
-
get keyGenerator(): SegmentCacheStore<TEnv>["keyGenerator"];
|
|
50
|
-
private record;
|
|
51
|
-
/** Track a deferred cache-write promise so the capture can await it pre-drain. */
|
|
52
|
-
trackWrite(p: Promise<unknown>): void;
|
|
53
|
-
/**
|
|
54
|
-
* Record a segment-family write into the snapshot WITHOUT touching the inner
|
|
55
|
-
* store. The shell fast path's implicit doc-cache scope writes through this
|
|
56
|
-
* (via {@link SnapshotOnlySegmentStore}): the recorded doc entry must ride
|
|
57
|
-
* ONLY inside the shell entry — a passthrough write would leave a doc-keyed
|
|
58
|
-
* entry in the real store that the NEXT capture's lookup would hit, replaying
|
|
59
|
-
* the previous generation's segments instead of re-running handlers (breaking
|
|
60
|
-
* SWR recapture freshness).
|
|
61
|
-
*/
|
|
62
|
-
recordSegmentWrite(key: string, data: CachedEntryData): void;
|
|
63
|
-
/**
|
|
64
|
-
* Await the tracked deferred writes so their records are present before drain.
|
|
65
|
-
* Drains ITERATIVELY: a write task can schedule a NESTED write (the ring-3
|
|
66
|
-
* cacheRoute path schedules its actual store.set in a second waitUntil while the
|
|
67
|
-
* first is running), so each awaited batch may enqueue more. Loop until the
|
|
68
|
-
* queue empties or the deadline passes. Bounded: a pathologically slow write
|
|
69
|
-
* must never stall the capture task, so a key that does not settle in time is
|
|
70
|
-
* left unpinned (it drifts, the pre-snapshot behavior) rather than hanging.
|
|
71
|
-
*/
|
|
72
|
-
settleWrites(timeoutMs: number): Promise<void>;
|
|
73
|
-
/** The recorded snapshot (last-write-wins per family+key), or undefined if empty. */
|
|
74
|
-
drainSnapshot(): ShellSnapshotRecord[] | undefined;
|
|
75
|
-
get(key: string): Promise<CacheGetResult | null>;
|
|
76
|
-
set(key: string, data: CachedEntryData, ttl: number, swr?: number): Promise<void>;
|
|
77
|
-
delete(key: string): Promise<boolean>;
|
|
78
|
-
clear(): Promise<void>;
|
|
79
|
-
getResponse(key: string): Promise<{
|
|
80
|
-
response: Response;
|
|
81
|
-
shouldRevalidate: boolean;
|
|
82
|
-
} | null>;
|
|
83
|
-
putResponse(key: string, response: Response, ttl: number, swr?: number, tags?: string[]): Promise<void>;
|
|
84
|
-
getItem(key: string): Promise<CacheItemResult | null>;
|
|
85
|
-
setItem(key: string, value: string, options?: CacheItemOptions): Promise<void>;
|
|
86
|
-
getShell(key: string): Promise<{
|
|
87
|
-
entry: ShellCacheEntry;
|
|
88
|
-
shouldRevalidate?: boolean;
|
|
89
|
-
} | null>;
|
|
90
|
-
putShell(key: string, entry: ShellCacheEntry, ttlSeconds?: number, swrSeconds?: number, tags?: string[]): Promise<void>;
|
|
91
|
-
invalidateTags(tags: string[]): Promise<void>;
|
|
92
|
-
}
|
|
93
|
-
/** True iff `store` is a RecordingShellStore (duck-typed across module copies). */
|
|
94
|
-
export declare function getRecordingStore<TEnv>(store: SegmentCacheStore<TEnv> | undefined): RecordingShellStore<TEnv> | undefined;
|
|
95
|
-
/**
|
|
96
|
-
* The store the shell fast path's IMPLICIT doc-cache scope resolves during a
|
|
97
|
-
* capture: reads pass through the recording store (a real-store hit is
|
|
98
|
-
* recorded, exactly like any capture read), but segment WRITES are recorded
|
|
99
|
-
* into the snapshot only — see {@link RecordingShellStore.recordSegmentWrite}
|
|
100
|
-
* for why passthrough would break SWR recapture. Routes with their OWN
|
|
101
|
-
* cache() config never see this store (their scope resolves the app-level
|
|
102
|
-
* recording store and keeps today's record-and-write behavior).
|
|
103
|
-
*/
|
|
104
|
-
export declare class SnapshotOnlySegmentStore<TEnv = unknown> implements SegmentCacheStore<TEnv> {
|
|
105
|
-
private readonly recording;
|
|
106
|
-
constructor(recording: RecordingShellStore<TEnv>);
|
|
107
|
-
get defaults(): SegmentCacheStore<TEnv>["defaults"];
|
|
108
|
-
get keyGenerator(): SegmentCacheStore<TEnv>["keyGenerator"];
|
|
109
|
-
get(key: string): Promise<CacheGetResult | null>;
|
|
110
|
-
set(key: string, data: CachedEntryData): Promise<void>;
|
|
111
|
-
delete(key: string): Promise<boolean>;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Materialize the loader-family seed from a shell snapshot for a HIT's tail
|
|
115
|
-
* render: Flight-deserialize each recorded (promise-elided) bake-lane
|
|
116
|
-
* container into a segment-key -> container Map, which serveShellHit assigns
|
|
117
|
-
* to the tail context's `_shellLoaderSeed` for the resolveLoaderData overlay.
|
|
118
|
-
* Lives here so every snapshot family is decoded in this module (the
|
|
119
|
-
* item/segment/response families via {@link SeededShellStore}); the loader
|
|
120
|
-
* family is not a store read, so it seeds the context instead of a store.
|
|
121
|
-
*
|
|
122
|
-
* Deserializations run in parallel; a record that fails to decode is skipped
|
|
123
|
-
* (that loader drifts — the pre-snapshot behavior — instead of failing the
|
|
124
|
-
* HIT). Returns undefined when the snapshot carries no loader records, without
|
|
125
|
-
* touching the Flight codec (kept lazy for cold paths and non-RSC configs).
|
|
126
|
-
*/
|
|
127
|
-
export declare function buildShellLoaderSeed(snapshot: ShellSnapshotRecord[]): Promise<Map<string, unknown> | undefined>;
|
|
128
|
-
/**
|
|
129
|
-
* A read-through overlay the HIT tail render reads through. For a key present in
|
|
130
|
-
* the snapshot it serves the recorded value AS FRESH (shouldRevalidate: false —
|
|
131
|
-
* a pinned key must NOT kick SWR background revalidation) so the tail's payload
|
|
132
|
-
* matches the frozen prelude. Every other read falls through to the real store
|
|
133
|
-
* (the holes — masked loaders were never recorded — stay live). ALL writes pass
|
|
134
|
-
* through unchanged: a live hole's loader may legitimately write. The shell
|
|
135
|
-
* family always passes through.
|
|
136
|
-
*/
|
|
137
|
-
export declare class SeededShellStore<TEnv = unknown> implements SegmentCacheStore<TEnv> {
|
|
138
|
-
private readonly inner;
|
|
139
|
-
private readonly items;
|
|
140
|
-
private readonly segments;
|
|
141
|
-
private readonly responses;
|
|
142
|
-
constructor(inner: SegmentCacheStore<TEnv>, snapshot: ShellSnapshotRecord[]);
|
|
143
|
-
get defaults(): SegmentCacheStore<TEnv>["defaults"];
|
|
144
|
-
get keyGenerator(): SegmentCacheStore<TEnv>["keyGenerator"];
|
|
145
|
-
get(key: string): Promise<CacheGetResult | null>;
|
|
146
|
-
set(key: string, data: CachedEntryData, ttl: number, swr?: number): Promise<void>;
|
|
147
|
-
delete(key: string): Promise<boolean>;
|
|
148
|
-
clear(): Promise<void>;
|
|
149
|
-
getResponse(key: string): Promise<{
|
|
150
|
-
response: Response;
|
|
151
|
-
shouldRevalidate: boolean;
|
|
152
|
-
} | null>;
|
|
153
|
-
putResponse(key: string, response: Response, ttl: number, swr?: number, tags?: string[]): Promise<void>;
|
|
154
|
-
getItem(key: string): Promise<CacheItemResult | null>;
|
|
155
|
-
setItem(key: string, value: string, options?: CacheItemOptions): Promise<void>;
|
|
156
|
-
getShell(key: string): Promise<{
|
|
157
|
-
entry: ShellCacheEntry;
|
|
158
|
-
shouldRevalidate?: boolean;
|
|
159
|
-
} | null>;
|
|
160
|
-
putShell(key: string, entry: ShellCacheEntry, ttlSeconds?: number, swrSeconds?: number, tags?: string[]): Promise<void>;
|
|
161
|
-
invalidateTags(tags: string[]): Promise<void>;
|
|
162
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cache Tag Invalidation API
|
|
3
|
-
*
|
|
4
|
-
* Two on-demand invalidation verbs, mirroring the distinction popularized by
|
|
5
|
-
* Next.js so consumers can pick the right consistency model:
|
|
6
|
-
*
|
|
7
|
-
* - updateTag(...tags): read-your-own-writes. Awaitable - resolves only after
|
|
8
|
-
* in-process invalidation across every configured store completes. Use in a
|
|
9
|
-
* Server Action and `await` it before the action re-renders, so the action's
|
|
10
|
-
* own response reflects the mutation.
|
|
11
|
-
*
|
|
12
|
-
* - revalidateTag(...tags): fire-and-forget via waitUntil - the response is not
|
|
13
|
-
* blocked. Use in Route Handlers / webhooks. NOTE: both verbs hard-purge; the
|
|
14
|
-
* only difference is awaitability. revalidateTag does NOT serve stale content -
|
|
15
|
-
* the next read after the invalidation lands is a hard miss that re-renders.
|
|
16
|
-
* (The name mirrors Next.js, where it is SWR; here it is background-purge.)
|
|
17
|
-
*
|
|
18
|
-
* Both fan out across the app-level store (ctx._cacheStore) and every explicit
|
|
19
|
-
* per-scope store from cache({ store }) registered for this handler
|
|
20
|
-
* (ctx._explicitTaggedStores), calling the store-level invalidateTags()
|
|
21
|
-
* primitive for each tag. A single configured store (the common case) owns its
|
|
22
|
-
* own tag index and distributed invalidation - there is no separate
|
|
23
|
-
* tag-invalidation store.
|
|
24
|
-
*/
|
|
25
|
-
/**
|
|
26
|
-
* Immediately expire every cache entry tagged with any of `tags`, resolving
|
|
27
|
-
* once in-process invalidation across all configured stores completes.
|
|
28
|
-
*
|
|
29
|
-
* Read-your-own-writes: because the returned promise resolves before you return
|
|
30
|
-
* from a Server Action, awaiting it guarantees the action's own re-render (and
|
|
31
|
-
* any subsequent read) sees fresh data.
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```typescript
|
|
35
|
-
* async function updateProduct(formData: FormData) {
|
|
36
|
-
* "use server";
|
|
37
|
-
* await db.updateProduct(formData);
|
|
38
|
-
* await updateTag("products"); // next render is fresh
|
|
39
|
-
* }
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
export declare function updateTag(...tags: string[]): Promise<void>;
|
|
43
|
-
/**
|
|
44
|
-
* Invalidate every cache entry tagged with any of `tags` in the background,
|
|
45
|
-
* without blocking the current response (fire-and-forget via waitUntil).
|
|
46
|
-
*
|
|
47
|
-
* This is NOT stale-while-revalidate: like updateTag() it hard-purges, so the
|
|
48
|
-
* next read after the invalidation lands is a miss that re-renders fresh. The
|
|
49
|
-
* only difference from updateTag() is awaitability - revalidateTag() defers the
|
|
50
|
-
* purge off the response path and is not awaited.
|
|
51
|
-
*
|
|
52
|
-
* Use in Route Handlers / webhooks. For read-your-own-writes inside a Server
|
|
53
|
-
* Action, use updateTag() instead so the action's own response is fresh.
|
|
54
|
-
*
|
|
55
|
-
* Fire-and-forget: because this returns void and runs in the background, a
|
|
56
|
-
* failed durable marker write (e.g. a transient KV outage) is NOT surfaced to
|
|
57
|
-
* the caller. It IS reported - logged loudly and routed through the router's
|
|
58
|
-
* `onError` callback (phase `cache`, `metadata.category === "cache-invalidate"`)
|
|
59
|
-
* via reportingAsync - so the failure is observable in telemetry even though it
|
|
60
|
-
* cannot be awaited. If you need the invalidation to be CONFIRMED (and to retry
|
|
61
|
-
* on failure), use `await updateTag()` instead, which rejects when a store's
|
|
62
|
-
* durable write fails.
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
* ```typescript
|
|
66
|
-
* // route handler invoked by an external webhook
|
|
67
|
-
* export async function POST() {
|
|
68
|
-
* "use server";
|
|
69
|
-
* revalidateTag("products");
|
|
70
|
-
* return new Response("ok");
|
|
71
|
-
* }
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
export declare function revalidateTag(...tags: string[]): void;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Taint symbol for request-scoped objects.
|
|
3
|
-
*
|
|
4
|
-
* Objects branded with NOCACHE_SYMBOL (ctx, env, req) are excluded from
|
|
5
|
-
* "use cache" cache keys and trigger handle capture mode so that side
|
|
6
|
-
* effects (breadcrumbs, metadata) are recorded and replayed on cache hit.
|
|
7
|
-
*/
|
|
8
|
-
export declare const NOCACHE_SYMBOL: unique symbol;
|
|
9
|
-
/**
|
|
10
|
-
* Check if a value is tainted (request-scoped, should not be in cache key).
|
|
11
|
-
*/
|
|
12
|
-
export declare function isTainted(value: unknown): boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Symbol stamped on tainted ctx during "use cache" function execution.
|
|
15
|
-
* cookies(), headers(), ctx.set(), ctx.header(), etc. check this flag and
|
|
16
|
-
* throw if present — reads would cache per-request data under a shared key,
|
|
17
|
-
* and side effects would be lost on cache hit.
|
|
18
|
-
*
|
|
19
|
-
* The value is a numeric reference count, not a boolean. Multiple concurrent
|
|
20
|
-
* cached functions sharing the same ctx/requestCtx each increment on entry
|
|
21
|
-
* and decrement on exit. Guards fire when count > 0.
|
|
22
|
-
*/
|
|
23
|
-
export declare const INSIDE_CACHE_EXEC: unique symbol;
|
|
24
|
-
/**
|
|
25
|
-
* Increment the INSIDE_CACHE_EXEC ref count on an object.
|
|
26
|
-
*/
|
|
27
|
-
export declare function stampCacheExec(obj: object): void;
|
|
28
|
-
/**
|
|
29
|
-
* Decrement the INSIDE_CACHE_EXEC ref count on an object.
|
|
30
|
-
* Deletes the symbol when the count reaches zero so the `in` check
|
|
31
|
-
* used by guards no longer fires.
|
|
32
|
-
*/
|
|
33
|
-
export declare function unstampCacheExec(obj: object): void;
|
|
34
|
-
/**
|
|
35
|
-
* Throw if ctx is inside a "use cache" execution.
|
|
36
|
-
* Call from side-effecting ctx methods (set, header, etc.) and cookie mutations.
|
|
37
|
-
*/
|
|
38
|
-
export declare function assertNotInsideCacheExec(ctx: unknown, methodName: string): void;
|
|
39
|
-
/**
|
|
40
|
-
* Symbol stamped on ctx when resolving handlers inside a cache() DSL boundary.
|
|
41
|
-
* Separate from INSIDE_CACHE_EXEC ("use cache") because cache() allows
|
|
42
|
-
* ctx.set() (children are also cached) but blocks response-level side effects
|
|
43
|
-
* (headers, cookies, status) which are lost on cache hit.
|
|
44
|
-
*/
|
|
45
|
-
export declare const INSIDE_CACHE_SCOPE: unique symbol;
|
|
46
|
-
/**
|
|
47
|
-
* Mark ctx as inside a cache() scope. Must be paired with unstampCacheScope.
|
|
48
|
-
*/
|
|
49
|
-
export declare function stampCacheScope(obj: object): void;
|
|
50
|
-
/**
|
|
51
|
-
* Remove cache() scope mark.
|
|
52
|
-
*/
|
|
53
|
-
export declare function unstampCacheScope(obj: object): void;
|
|
54
|
-
/**
|
|
55
|
-
* Throw if ctx is inside a cache() DSL boundary.
|
|
56
|
-
* Call from response-level side effects (header, setCookie, setStatus, etc.)
|
|
57
|
-
* which are lost on cache hit because the handler body is skipped.
|
|
58
|
-
* ctx.set() is allowed inside cache() — children are also cached and can
|
|
59
|
-
* read the value.
|
|
60
|
-
*/
|
|
61
|
-
export declare function assertNotInsideCacheScope(ctx: unknown, methodName: string): void;
|
|
62
|
-
/**
|
|
63
|
-
* Brand symbol for functions wrapped by registerCachedFunction().
|
|
64
|
-
* Used at runtime to detect when a "use cache" function is misused
|
|
65
|
-
* (e.g., passed as middleware).
|
|
66
|
-
*/
|
|
67
|
-
export declare const CACHED_FN_SYMBOL: unique symbol;
|
|
68
|
-
/**
|
|
69
|
-
* Check if a value is a "use cache" wrapped function.
|
|
70
|
-
*/
|
|
71
|
-
export declare function isCachedFunction(value: unknown): boolean;
|