@rangojs/router 0.5.0 → 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.
Files changed (405) hide show
  1. package/dist/types/browser/prefetch/cache.d.ts +31 -2
  2. package/dist/types/route-definition/helpers-types.d.ts +5 -4
  3. package/dist/types/static-handler.d.ts +15 -1
  4. package/dist/types/urls/path-helper-types.d.ts +6 -7
  5. package/dist/types.backup/__internal.d.ts +127 -0
  6. package/dist/types.backup/bin/rango.d.ts +1 -0
  7. package/dist/types.backup/browser/action-coordinator.d.ts +57 -0
  8. package/dist/types.backup/browser/action-fence.d.ts +33 -0
  9. package/dist/types.backup/browser/app-shell.d.ts +34 -0
  10. package/dist/types.backup/browser/app-version.d.ts +6 -0
  11. package/dist/types.backup/browser/connection-warmup.d.ts +31 -0
  12. package/dist/types.backup/browser/cookie-name.d.ts +66 -0
  13. package/dist/types.backup/browser/event-controller.d.ts +221 -0
  14. package/dist/types.backup/browser/history-state.d.ts +26 -0
  15. package/dist/types.backup/browser/index.d.ts +1 -0
  16. package/dist/types.backup/browser/intercept-utils.d.ts +30 -0
  17. package/dist/types.backup/browser/invalidate-client-cache.d.ts +17 -0
  18. package/dist/types.backup/browser/link-interceptor.d.ts +43 -0
  19. package/dist/types.backup/browser/logging.d.ts +33 -0
  20. package/dist/types.backup/browser/merge-segment-loaders.d.ts +38 -0
  21. package/dist/types.backup/browser/navigation-bridge.d.ts +27 -0
  22. package/dist/types.backup/browser/navigation-client.d.ts +17 -0
  23. package/dist/types.backup/browser/navigation-store-handle.d.ts +25 -0
  24. package/dist/types.backup/browser/navigation-store.d.ts +95 -0
  25. package/dist/types.backup/browser/navigation-transaction.d.ts +75 -0
  26. package/dist/types.backup/browser/network-error-handler.d.ts +35 -0
  27. package/dist/types.backup/browser/partial-update.d.ts +61 -0
  28. package/dist/types.backup/browser/prefetch/cache.d.ts +183 -0
  29. package/dist/types.backup/browser/prefetch/fetch.d.ts +52 -0
  30. package/dist/types.backup/browser/prefetch/observer.d.ts +27 -0
  31. package/dist/types.backup/browser/prefetch/policy.d.ts +13 -0
  32. package/dist/types.backup/browser/prefetch/queue.d.ts +48 -0
  33. package/dist/types.backup/browser/prefetch/resource-ready.d.ts +28 -0
  34. package/dist/types.backup/browser/rango-state.d.ts +52 -0
  35. package/dist/types.backup/browser/react/Link.d.ts +140 -0
  36. package/dist/types.backup/browser/react/NavigationProvider.d.ts +88 -0
  37. package/dist/types.backup/browser/react/ScrollRestoration.d.ts +78 -0
  38. package/dist/types.backup/browser/react/context.d.ts +54 -0
  39. package/dist/types.backup/browser/react/filter-segment-order.d.ts +35 -0
  40. package/dist/types.backup/browser/react/index.d.ts +1 -0
  41. package/dist/types.backup/browser/react/location-state-shared.d.ts +162 -0
  42. package/dist/types.backup/browser/react/location-state.d.ts +29 -0
  43. package/dist/types.backup/browser/react/mount-context.d.ts +23 -0
  44. package/dist/types.backup/browser/react/nonce-context.d.ts +14 -0
  45. package/dist/types.backup/browser/react/shallow-equal.d.ts +5 -0
  46. package/dist/types.backup/browser/react/use-action.d.ts +61 -0
  47. package/dist/types.backup/browser/react/use-handle.d.ts +21 -0
  48. package/dist/types.backup/browser/react/use-href.d.ts +32 -0
  49. package/dist/types.backup/browser/react/use-link-status.d.ts +36 -0
  50. package/dist/types.backup/browser/react/use-mount.d.ts +24 -0
  51. package/dist/types.backup/browser/react/use-navigation.d.ts +15 -0
  52. package/dist/types.backup/browser/react/use-params.d.ts +21 -0
  53. package/dist/types.backup/browser/react/use-pathname.d.ts +13 -0
  54. package/dist/types.backup/browser/react/use-reverse.d.ts +40 -0
  55. package/dist/types.backup/browser/react/use-router.d.ts +23 -0
  56. package/dist/types.backup/browser/react/use-search-params.d.ts +19 -0
  57. package/dist/types.backup/browser/react/use-segments.d.ts +29 -0
  58. package/dist/types.backup/browser/response-adapter.d.ts +58 -0
  59. package/dist/types.backup/browser/rsc-router.d.ts +141 -0
  60. package/dist/types.backup/browser/scroll-restoration.d.ts +103 -0
  61. package/dist/types.backup/browser/segment-reconciler.d.ts +74 -0
  62. package/dist/types.backup/browser/segment-structure-assert.d.ts +16 -0
  63. package/dist/types.backup/browser/server-action-bridge.d.ts +29 -0
  64. package/dist/types.backup/browser/types.d.ts +530 -0
  65. package/dist/types.backup/browser/validate-redirect-origin.d.ts +28 -0
  66. package/dist/types.backup/build/collect-fallback-refs.d.ts +5 -0
  67. package/dist/types.backup/build/generate-manifest.d.ts +100 -0
  68. package/dist/types.backup/build/generate-route-types.d.ts +8 -0
  69. package/dist/types.backup/build/index.d.ts +21 -0
  70. package/dist/types.backup/build/prefix-tree-utils.d.ts +56 -0
  71. package/dist/types.backup/build/route-trie.d.ts +89 -0
  72. package/dist/types.backup/build/route-types/ast-helpers.d.ts +3 -0
  73. package/dist/types.backup/build/route-types/ast-route-extraction.d.ts +13 -0
  74. package/dist/types.backup/build/route-types/codegen.d.ts +16 -0
  75. package/dist/types.backup/build/route-types/include-resolution.d.ts +74 -0
  76. package/dist/types.backup/build/route-types/param-extraction.d.ts +13 -0
  77. package/dist/types.backup/build/route-types/per-module-writer.d.ts +18 -0
  78. package/dist/types.backup/build/route-types/router-processing.d.ts +82 -0
  79. package/dist/types.backup/build/route-types/scan-filter.d.ts +17 -0
  80. package/dist/types.backup/build/route-types/source-scan.d.ts +13 -0
  81. package/dist/types.backup/build/runtime-discovery.d.ts +24 -0
  82. package/dist/types.backup/cache/background-task.d.ts +21 -0
  83. package/dist/types.backup/cache/cache-error.d.ts +71 -0
  84. package/dist/types.backup/cache/cache-key-utils.d.ts +35 -0
  85. package/dist/types.backup/cache/cache-policy.d.ts +59 -0
  86. package/dist/types.backup/cache/cache-runtime.d.ts +51 -0
  87. package/dist/types.backup/cache/cache-scope.d.ts +134 -0
  88. package/dist/types.backup/cache/cache-tag.d.ts +79 -0
  89. package/dist/types.backup/cache/cf/cf-base64.d.ts +4 -0
  90. package/dist/types.backup/cache/cf/cf-cache-constants.d.ts +105 -0
  91. package/dist/types.backup/cache/cf/cf-cache-store.d.ts +481 -0
  92. package/dist/types.backup/cache/cf/cf-cache-types.d.ts +300 -0
  93. package/dist/types.backup/cache/cf/cf-kv-utils.d.ts +22 -0
  94. package/dist/types.backup/cache/cf/cf-tag-marker-memo.d.ts +15 -0
  95. package/dist/types.backup/cache/cf/index.d.ts +3 -0
  96. package/dist/types.backup/cache/document-cache.d.ts +69 -0
  97. package/dist/types.backup/cache/handle-capture.d.ts +23 -0
  98. package/dist/types.backup/cache/handle-snapshot.d.ts +39 -0
  99. package/dist/types.backup/cache/index.d.ts +7 -0
  100. package/dist/types.backup/cache/memory-segment-store.d.ts +163 -0
  101. package/dist/types.backup/cache/profile-registry.d.ts +40 -0
  102. package/dist/types.backup/cache/read-through-swr.d.ts +60 -0
  103. package/dist/types.backup/cache/segment-codec.d.ts +78 -0
  104. package/dist/types.backup/cache/shell-snapshot.d.ts +162 -0
  105. package/dist/types.backup/cache/tag-invalidation.d.ts +74 -0
  106. package/dist/types.backup/cache/taint.d.ts +71 -0
  107. package/dist/types.backup/cache/types.d.ts +407 -0
  108. package/dist/types.backup/cache/vercel/index.d.ts +1 -0
  109. package/dist/types.backup/cache/vercel/vercel-cache-store.d.ts +267 -0
  110. package/dist/types.backup/client.d.ts +184 -0
  111. package/dist/types.backup/client.rsc.d.ts +39 -0
  112. package/dist/types.backup/cloudflare/index.d.ts +7 -0
  113. package/dist/types.backup/cloudflare/tracing.d.ts +53 -0
  114. package/dist/types.backup/component-utils.d.ts +46 -0
  115. package/dist/types.backup/components/DefaultDocument.d.ts +13 -0
  116. package/dist/types.backup/context-var.d.ts +84 -0
  117. package/dist/types.backup/debug.d.ts +57 -0
  118. package/dist/types.backup/decode-loader-results.d.ts +5 -0
  119. package/dist/types.backup/default-error-boundary.d.ts +10 -0
  120. package/dist/types.backup/defer.d.ts +89 -0
  121. package/dist/types.backup/deps/browser.d.ts +1 -0
  122. package/dist/types.backup/deps/html-stream-client.d.ts +1 -0
  123. package/dist/types.backup/deps/html-stream-server.d.ts +1 -0
  124. package/dist/types.backup/deps/rsc.d.ts +1 -0
  125. package/dist/types.backup/deps/ssr.d.ts +1 -0
  126. package/dist/types.backup/encode-kv.d.ts +35 -0
  127. package/dist/types.backup/errors.d.ts +226 -0
  128. package/dist/types.backup/escape-script.d.ts +44 -0
  129. package/dist/types.backup/handle.d.ts +93 -0
  130. package/dist/types.backup/handles/MetaTags.d.ts +17 -0
  131. package/dist/types.backup/handles/Scripts.d.ts +38 -0
  132. package/dist/types.backup/handles/breadcrumbs.d.ts +43 -0
  133. package/dist/types.backup/handles/deferred-resolution.d.ts +53 -0
  134. package/dist/types.backup/handles/is-thenable.d.ts +12 -0
  135. package/dist/types.backup/handles/meta.d.ts +43 -0
  136. package/dist/types.backup/handles/script.d.ts +139 -0
  137. package/dist/types.backup/host/cookie-handler.d.ts +8 -0
  138. package/dist/types.backup/host/errors.d.ts +40 -0
  139. package/dist/types.backup/host/index.d.ts +33 -0
  140. package/dist/types.backup/host/pattern-matcher.d.ts +30 -0
  141. package/dist/types.backup/host/router.d.ts +12 -0
  142. package/dist/types.backup/host/testing.d.ts +41 -0
  143. package/dist/types.backup/host/types.d.ts +148 -0
  144. package/dist/types.backup/host/utils.d.ts +20 -0
  145. package/dist/types.backup/href-client.d.ts +214 -0
  146. package/dist/types.backup/index.d.ts +112 -0
  147. package/dist/types.backup/index.rsc.d.ts +51 -0
  148. package/dist/types.backup/internal-debug.d.ts +1 -0
  149. package/dist/types.backup/loader-store.d.ts +193 -0
  150. package/dist/types.backup/loader.d.ts +18 -0
  151. package/dist/types.backup/loader.rsc.d.ts +18 -0
  152. package/dist/types.backup/missing-id-error.d.ts +1 -0
  153. package/dist/types.backup/outlet-context.d.ts +12 -0
  154. package/dist/types.backup/outlet-provider.d.ts +12 -0
  155. package/dist/types.backup/prerender/build-shell-capture.d.ts +104 -0
  156. package/dist/types.backup/prerender/param-hash.d.ts +6 -0
  157. package/dist/types.backup/prerender/shell-manifest-key.d.ts +18 -0
  158. package/dist/types.backup/prerender/store.d.ts +62 -0
  159. package/dist/types.backup/prerender.d.ts +292 -0
  160. package/dist/types.backup/redirect-origin.d.ts +55 -0
  161. package/dist/types.backup/regex-escape.d.ts +6 -0
  162. package/dist/types.backup/render-error-thrower.d.ts +13 -0
  163. package/dist/types.backup/response-utils.d.ts +35 -0
  164. package/dist/types.backup/reverse.d.ts +206 -0
  165. package/dist/types.backup/root-error-boundary.d.ts +32 -0
  166. package/dist/types.backup/route-content-wrapper.d.ts +40 -0
  167. package/dist/types.backup/route-definition/dsl-helpers.d.ts +130 -0
  168. package/dist/types.backup/route-definition/helper-factories.d.ts +22 -0
  169. package/dist/types.backup/route-definition/helpers-types.d.ts +392 -0
  170. package/dist/types.backup/route-definition/index.d.ts +7 -0
  171. package/dist/types.backup/route-definition/redirect.d.ts +48 -0
  172. package/dist/types.backup/route-definition/resolve-handler-use.d.ts +19 -0
  173. package/dist/types.backup/route-definition/use-item-types.d.ts +1 -0
  174. package/dist/types.backup/route-definition.d.ts +1 -0
  175. package/dist/types.backup/route-map-builder.d.ts +127 -0
  176. package/dist/types.backup/route-name.d.ts +27 -0
  177. package/dist/types.backup/route-types.d.ts +172 -0
  178. package/dist/types.backup/router/basename.d.ts +10 -0
  179. package/dist/types.backup/router/content-negotiation.d.ts +91 -0
  180. package/dist/types.backup/router/debug-manifest.d.ts +7 -0
  181. package/dist/types.backup/router/error-handling.d.ts +76 -0
  182. package/dist/types.backup/router/find-match.d.ts +19 -0
  183. package/dist/types.backup/router/handler-context.d.ts +41 -0
  184. package/dist/types.backup/router/instrument.d.ts +161 -0
  185. package/dist/types.backup/router/intercept-resolution.d.ts +79 -0
  186. package/dist/types.backup/router/lazy-includes.d.ts +26 -0
  187. package/dist/types.backup/router/loader-resolution.d.ts +63 -0
  188. package/dist/types.backup/router/logging.d.ts +41 -0
  189. package/dist/types.backup/router/manifest.d.ts +8 -0
  190. package/dist/types.backup/router/match-api.d.ts +19 -0
  191. package/dist/types.backup/router/match-context.d.ts +184 -0
  192. package/dist/types.backup/router/match-handlers.d.ts +49 -0
  193. package/dist/types.backup/router/match-middleware/background-revalidation.d.ts +113 -0
  194. package/dist/types.backup/router/match-middleware/cache-lookup.d.ts +113 -0
  195. package/dist/types.backup/router/match-middleware/cache-store.d.ts +112 -0
  196. package/dist/types.backup/router/match-middleware/index.d.ts +80 -0
  197. package/dist/types.backup/router/match-middleware/intercept-resolution.d.ts +116 -0
  198. package/dist/types.backup/router/match-middleware/segment-resolution.d.ts +94 -0
  199. package/dist/types.backup/router/match-pipelines.d.ts +103 -0
  200. package/dist/types.backup/router/match-result.d.ts +114 -0
  201. package/dist/types.backup/router/metrics.d.ts +6 -0
  202. package/dist/types.backup/router/middleware-types.d.ts +74 -0
  203. package/dist/types.backup/router/middleware.d.ts +116 -0
  204. package/dist/types.backup/router/navigation-snapshot.d.ts +22 -0
  205. package/dist/types.backup/router/params-util.d.ts +8 -0
  206. package/dist/types.backup/router/parse-pattern.d.ts +38 -0
  207. package/dist/types.backup/router/pattern-matching.d.ts +169 -0
  208. package/dist/types.backup/router/prefetch-cache-ttl.d.ts +27 -0
  209. package/dist/types.backup/router/prefetch-limits.d.ts +20 -0
  210. package/dist/types.backup/router/prerender-match.d.ts +50 -0
  211. package/dist/types.backup/router/preview-match.d.ts +22 -0
  212. package/dist/types.backup/router/request-classification.d.ts +104 -0
  213. package/dist/types.backup/router/revalidation.d.ts +57 -0
  214. package/dist/types.backup/router/route-snapshot.d.ts +112 -0
  215. package/dist/types.backup/router/router-context.d.ts +137 -0
  216. package/dist/types.backup/router/router-interfaces.d.ts +432 -0
  217. package/dist/types.backup/router/router-options.d.ts +738 -0
  218. package/dist/types.backup/router/router-registry.d.ts +15 -0
  219. package/dist/types.backup/router/segment-resolution/fresh.d.ts +55 -0
  220. package/dist/types.backup/router/segment-resolution/helpers.d.ts +93 -0
  221. package/dist/types.backup/router/segment-resolution/loader-cache.d.ts +33 -0
  222. package/dist/types.backup/router/segment-resolution/loader-mask.d.ts +44 -0
  223. package/dist/types.backup/router/segment-resolution/loader-snapshot.d.ts +90 -0
  224. package/dist/types.backup/router/segment-resolution/mask-nested.d.ts +53 -0
  225. package/dist/types.backup/router/segment-resolution/revalidation.d.ts +85 -0
  226. package/dist/types.backup/router/segment-resolution/static-store.d.ts +17 -0
  227. package/dist/types.backup/router/segment-resolution/streamed-handler-telemetry.d.ts +16 -0
  228. package/dist/types.backup/router/segment-resolution/view-transition-default.d.ts +28 -0
  229. package/dist/types.backup/router/segment-resolution.d.ts +3 -0
  230. package/dist/types.backup/router/segment-wrappers.d.ts +53 -0
  231. package/dist/types.backup/router/state-cookie-name.d.ts +1 -0
  232. package/dist/types.backup/router/substitute-pattern-params.d.ts +23 -0
  233. package/dist/types.backup/router/telemetry-otel.d.ts +113 -0
  234. package/dist/types.backup/router/telemetry.d.ts +215 -0
  235. package/dist/types.backup/router/timeout.d.ts +68 -0
  236. package/dist/types.backup/router/tracing.d.ts +125 -0
  237. package/dist/types.backup/router/trie-matching.d.ts +32 -0
  238. package/dist/types.backup/router/types.d.ts +98 -0
  239. package/dist/types.backup/router/url-params.d.ts +26 -0
  240. package/dist/types.backup/router.d.ts +7 -0
  241. package/dist/types.backup/rsc/capture-queue.d.ts +6 -0
  242. package/dist/types.backup/rsc/full-payload.d.ts +22 -0
  243. package/dist/types.backup/rsc/handler-context.d.ts +31 -0
  244. package/dist/types.backup/rsc/handler.d.ts +9 -0
  245. package/dist/types.backup/rsc/helpers.d.ts +213 -0
  246. package/dist/types.backup/rsc/index.d.ts +17 -0
  247. package/dist/types.backup/rsc/json-route-result.d.ts +20 -0
  248. package/dist/types.backup/rsc/loader-fetch.d.ts +14 -0
  249. package/dist/types.backup/rsc/manifest-init.d.ts +18 -0
  250. package/dist/types.backup/rsc/nonce.d.ts +28 -0
  251. package/dist/types.backup/rsc/origin-guard.d.ts +50 -0
  252. package/dist/types.backup/rsc/progressive-enhancement.d.ts +19 -0
  253. package/dist/types.backup/rsc/redirect-guard.d.ts +35 -0
  254. package/dist/types.backup/rsc/response-cache-serve.d.ts +46 -0
  255. package/dist/types.backup/rsc/response-error.d.ts +19 -0
  256. package/dist/types.backup/rsc/response-route-handler.d.ts +29 -0
  257. package/dist/types.backup/rsc/rsc-rendering.d.ts +23 -0
  258. package/dist/types.backup/rsc/runtime-warnings.d.ts +22 -0
  259. package/dist/types.backup/rsc/server-action.d.ts +68 -0
  260. package/dist/types.backup/rsc/shell-build-manifest.d.ts +84 -0
  261. package/dist/types.backup/rsc/shell-capture-constants.d.ts +27 -0
  262. package/dist/types.backup/rsc/shell-capture.d.ts +374 -0
  263. package/dist/types.backup/rsc/shell-serve.d.ts +136 -0
  264. package/dist/types.backup/rsc/ssr-setup.d.ts +48 -0
  265. package/dist/types.backup/rsc/transition-gate.d.ts +27 -0
  266. package/dist/types.backup/rsc/types.d.ts +290 -0
  267. package/dist/types.backup/runtime-env.d.ts +1 -0
  268. package/dist/types.backup/search-params.d.ts +125 -0
  269. package/dist/types.backup/segment-content-promise.d.ts +13 -0
  270. package/dist/types.backup/segment-fragments.d.ts +56 -0
  271. package/dist/types.backup/segment-loader-promise.d.ts +22 -0
  272. package/dist/types.backup/segment-system.d.ts +84 -0
  273. package/dist/types.backup/serialize.d.ts +164 -0
  274. package/dist/types.backup/server/context.d.ts +494 -0
  275. package/dist/types.backup/server/cookie-parse.d.ts +10 -0
  276. package/dist/types.backup/server/cookie-store.d.ts +107 -0
  277. package/dist/types.backup/server/fetchable-loader-store.d.ts +20 -0
  278. package/dist/types.backup/server/handle-store.d.ts +100 -0
  279. package/dist/types.backup/server/loader-registry.d.ts +32 -0
  280. package/dist/types.backup/server/request-context.d.ts +596 -0
  281. package/dist/types.backup/server/root-layout.d.ts +3 -0
  282. package/dist/types.backup/server.d.ts +15 -0
  283. package/dist/types.backup/ssr/index.d.ts +233 -0
  284. package/dist/types.backup/ssr/inject-rsc-eager.d.ts +3 -0
  285. package/dist/types.backup/ssr/preinit-client-references.d.ts +71 -0
  286. package/dist/types.backup/ssr/ssr-root.d.ts +69 -0
  287. package/dist/types.backup/static-handler.d.ts +57 -0
  288. package/dist/types.backup/testing/cache-status.d.ts +63 -0
  289. package/dist/types.backup/testing/collect-handle.d.ts +20 -0
  290. package/dist/types.backup/testing/dispatch.d.ts +123 -0
  291. package/dist/types.backup/testing/dom.entry.d.ts +15 -0
  292. package/dist/types.backup/testing/e2e/fixture.d.ts +37 -0
  293. package/dist/types.backup/testing/e2e/index.d.ts +30 -0
  294. package/dist/types.backup/testing/e2e/matchers.d.ts +17 -0
  295. package/dist/types.backup/testing/e2e/page-helpers.d.ts +62 -0
  296. package/dist/types.backup/testing/e2e/parity.d.ts +111 -0
  297. package/dist/types.backup/testing/e2e/server.d.ts +35 -0
  298. package/dist/types.backup/testing/flight-matchers.d.ts +55 -0
  299. package/dist/types.backup/testing/flight-normalize.d.ts +1 -0
  300. package/dist/types.backup/testing/flight-tree.d.ts +192 -0
  301. package/dist/types.backup/testing/flight.d.ts +115 -0
  302. package/dist/types.backup/testing/flight.entry.d.ts +27 -0
  303. package/dist/types.backup/testing/generated-routes.d.ts +66 -0
  304. package/dist/types.backup/testing/index.d.ts +52 -0
  305. package/dist/types.backup/testing/internal/context.d.ts +225 -0
  306. package/dist/types.backup/testing/internal/flight-client-globals.d.ts +1 -0
  307. package/dist/types.backup/testing/internal/seed-vars.d.ts +30 -0
  308. package/dist/types.backup/testing/render-handler.d.ts +160 -0
  309. package/dist/types.backup/testing/render-route.d.ts +246 -0
  310. package/dist/types.backup/testing/run-loader.d.ts +186 -0
  311. package/dist/types.backup/testing/run-middleware.d.ts +132 -0
  312. package/dist/types.backup/testing/run-transition-when.d.ts +77 -0
  313. package/dist/types.backup/testing/vitest-stubs/cloudflare-email.d.ts +6 -0
  314. package/dist/types.backup/testing/vitest-stubs/cloudflare-workers.d.ts +13 -0
  315. package/dist/types.backup/testing/vitest-stubs/plugin-rsc.d.ts +7 -0
  316. package/dist/types.backup/testing/vitest-stubs/version.d.ts +1 -0
  317. package/dist/types.backup/testing/vitest.d.ts +205 -0
  318. package/dist/types.backup/theme/ThemeProvider.d.ts +13 -0
  319. package/dist/types.backup/theme/ThemeScript.d.ts +45 -0
  320. package/dist/types.backup/theme/constants.d.ts +39 -0
  321. package/dist/types.backup/theme/index.d.ts +29 -0
  322. package/dist/types.backup/theme/theme-context.d.ts +21 -0
  323. package/dist/types.backup/theme/theme-script.d.ts +26 -0
  324. package/dist/types.backup/theme/types.d.ts +162 -0
  325. package/dist/types.backup/theme/use-theme.d.ts +8 -0
  326. package/dist/types.backup/types/boundaries.d.ts +93 -0
  327. package/dist/types.backup/types/cache-types.d.ts +191 -0
  328. package/dist/types.backup/types/error-types.d.ts +114 -0
  329. package/dist/types.backup/types/global-namespace.d.ts +90 -0
  330. package/dist/types.backup/types/handler-context.d.ts +658 -0
  331. package/dist/types.backup/types/index.d.ts +11 -0
  332. package/dist/types.backup/types/loader-types.d.ts +182 -0
  333. package/dist/types.backup/types/request-scope.d.ts +93 -0
  334. package/dist/types.backup/types/route-config.d.ts +105 -0
  335. package/dist/types.backup/types/route-entry.d.ts +95 -0
  336. package/dist/types.backup/types/segments.d.ts +234 -0
  337. package/dist/types.backup/types.d.ts +1 -0
  338. package/dist/types.backup/urls/include-helper.d.ts +17 -0
  339. package/dist/types.backup/urls/include-provider.d.ts +27 -0
  340. package/dist/types.backup/urls/index.d.ts +6 -0
  341. package/dist/types.backup/urls/path-helper-types.d.ts +197 -0
  342. package/dist/types.backup/urls/path-helper.d.ts +12 -0
  343. package/dist/types.backup/urls/pattern-types.d.ts +166 -0
  344. package/dist/types.backup/urls/response-types.d.ts +67 -0
  345. package/dist/types.backup/urls/type-extraction.d.ts +157 -0
  346. package/dist/types.backup/urls/urls-function.d.ts +24 -0
  347. package/dist/types.backup/urls.d.ts +1 -0
  348. package/dist/types.backup/use-loader.d.ts +150 -0
  349. package/dist/types.backup/vercel/index.d.ts +10 -0
  350. package/dist/types.backup/vercel/tracing.d.ts +70 -0
  351. package/dist/types.backup/vite/debug.d.ts +80 -0
  352. package/dist/types.backup/vite/discovery/bundle-postprocess.d.ts +12 -0
  353. package/dist/types.backup/vite/discovery/dev-prerender-cache.d.ts +65 -0
  354. package/dist/types.backup/vite/discovery/discover-routers.d.ts +17 -0
  355. package/dist/types.backup/vite/discovery/discovery-errors.d.ts +113 -0
  356. package/dist/types.backup/vite/discovery/gate-state.d.ts +79 -0
  357. package/dist/types.backup/vite/discovery/prerender-collection.d.ts +24 -0
  358. package/dist/types.backup/vite/discovery/route-types-writer.d.ts +32 -0
  359. package/dist/types.backup/vite/discovery/self-gen-tracking.d.ts +22 -0
  360. package/dist/types.backup/vite/discovery/shell-prerender-phase.d.ts +40 -0
  361. package/dist/types.backup/vite/discovery/state.d.ts +162 -0
  362. package/dist/types.backup/vite/discovery/virtual-module-codegen.d.ts +15 -0
  363. package/dist/types.backup/vite/index.d.ts +11 -0
  364. package/dist/types.backup/vite/inject-client-debug.d.ts +56 -0
  365. package/dist/types.backup/vite/plugin-types.d.ts +298 -0
  366. package/dist/types.backup/vite/plugins/cjs-to-esm.d.ts +6 -0
  367. package/dist/types.backup/vite/plugins/client-ref-dedup.d.ts +40 -0
  368. package/dist/types.backup/vite/plugins/client-ref-hashing.d.ts +35 -0
  369. package/dist/types.backup/vite/plugins/cloudflare-protocol-stub.d.ts +64 -0
  370. package/dist/types.backup/vite/plugins/expose-action-id.d.ts +18 -0
  371. package/dist/types.backup/vite/plugins/expose-id-utils.d.ts +37 -0
  372. package/dist/types.backup/vite/plugins/expose-ids/export-analysis.d.ts +19 -0
  373. package/dist/types.backup/vite/plugins/expose-ids/handler-transform.d.ts +10 -0
  374. package/dist/types.backup/vite/plugins/expose-ids/loader-transform.d.ts +8 -0
  375. package/dist/types.backup/vite/plugins/expose-ids/router-transform.d.ts +13 -0
  376. package/dist/types.backup/vite/plugins/expose-ids/types.d.ts +29 -0
  377. package/dist/types.backup/vite/plugins/expose-internal-ids.d.ts +6 -0
  378. package/dist/types.backup/vite/plugins/performance-tracks.d.ts +25 -0
  379. package/dist/types.backup/vite/plugins/refresh-cmd.d.ts +20 -0
  380. package/dist/types.backup/vite/plugins/use-cache-transform.d.ts +20 -0
  381. package/dist/types.backup/vite/plugins/vercel-output.d.ts +85 -0
  382. package/dist/types.backup/vite/plugins/version-injector.d.ts +21 -0
  383. package/dist/types.backup/vite/plugins/version-plugin.d.ts +19 -0
  384. package/dist/types.backup/vite/plugins/virtual-entries.d.ts +36 -0
  385. package/dist/types.backup/vite/plugins/virtual-stub-plugin.d.ts +7 -0
  386. package/dist/types.backup/vite/rango.d.ts +29 -0
  387. package/dist/types.backup/vite/router-discovery.d.ts +23 -0
  388. package/dist/types.backup/vite/utils/ast-handler-extract.d.ts +64 -0
  389. package/dist/types.backup/vite/utils/banner.d.ts +2 -0
  390. package/dist/types.backup/vite/utils/bundle-analysis.d.ts +28 -0
  391. package/dist/types.backup/vite/utils/client-chunks.d.ts +55 -0
  392. package/dist/types.backup/vite/utils/directive-prologue.d.ts +16 -0
  393. package/dist/types.backup/vite/utils/forward-user-plugins.d.ts +37 -0
  394. package/dist/types.backup/vite/utils/manifest-utils.d.ts +7 -0
  395. package/dist/types.backup/vite/utils/package-resolution.d.ts +6 -0
  396. package/dist/types.backup/vite/utils/prerender-utils.d.ts +32 -0
  397. package/dist/types.backup/vite/utils/shared-utils.d.ts +55 -0
  398. package/dist/vite/index.js +1 -1
  399. package/package.json +1 -1
  400. package/skills/parallel/SKILL.md +1 -1
  401. package/src/browser/prefetch/cache.ts +53 -9
  402. package/src/browser/prefetch/fetch.ts +83 -2
  403. package/src/route-definition/helpers-types.ts +5 -3
  404. package/src/static-handler.ts +18 -2
  405. package/src/urls/path-helper-types.ts +9 -10
@@ -0,0 +1,40 @@
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>;
@@ -0,0 +1,60 @@
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 {};
@@ -0,0 +1,78 @@
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[]>;
@@ -0,0 +1,162 @@
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
+ }
@@ -0,0 +1,74 @@
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;
@@ -0,0 +1,71 @@
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;