@rangojs/router 0.0.0-experimental.dfa55db4 → 0.0.0-experimental.e16b7c00

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 (1041) hide show
  1. package/README.md +120 -25
  2. package/dist/bin/rango.js +147 -57
  3. package/dist/vite/index.js +2108 -829
  4. package/dist/vite/plugins/cloudflare-protocol-loader-hook.mjs +76 -0
  5. package/package.json +13 -8
  6. package/skills/breadcrumbs/SKILL.md +3 -1
  7. package/skills/bundle-analysis/SKILL.md +159 -0
  8. package/skills/cache-guide/SKILL.md +222 -30
  9. package/skills/caching/SKILL.md +188 -8
  10. package/skills/composability/SKILL.md +27 -2
  11. package/skills/document-cache/SKILL.md +78 -55
  12. package/skills/handler-use/SKILL.md +364 -0
  13. package/skills/hooks/SKILL.md +229 -20
  14. package/skills/host-router/SKILL.md +45 -20
  15. package/skills/i18n/SKILL.md +276 -0
  16. package/skills/intercept/SKILL.md +46 -4
  17. package/skills/layout/SKILL.md +28 -7
  18. package/skills/links/SKILL.md +247 -17
  19. package/skills/loader/SKILL.md +219 -9
  20. package/skills/middleware/SKILL.md +47 -12
  21. package/skills/migrate-nextjs/SKILL.md +582 -0
  22. package/skills/migrate-react-router/SKILL.md +769 -0
  23. package/skills/mime-routes/SKILL.md +27 -0
  24. package/skills/observability/SKILL.md +137 -0
  25. package/skills/parallel/SKILL.md +71 -6
  26. package/skills/prerender/SKILL.md +14 -33
  27. package/skills/rango/SKILL.md +236 -22
  28. package/skills/react-compiler/SKILL.md +168 -0
  29. package/skills/response-routes/SKILL.md +66 -9
  30. package/skills/route/SKILL.md +57 -4
  31. package/skills/router-setup/SKILL.md +3 -3
  32. package/skills/server-actions/SKILL.md +751 -0
  33. package/skills/streams-and-websockets/SKILL.md +283 -0
  34. package/skills/typesafety/SKILL.md +319 -27
  35. package/skills/use-cache/SKILL.md +36 -5
  36. package/skills/view-transitions/SKILL.md +294 -0
  37. package/src/__augment-tests__/augment.ts +81 -0
  38. package/src/__augment-tests__/augmented.check.ts +117 -0
  39. package/src/browser/action-coordinator.ts +53 -36
  40. package/src/browser/app-shell.ts +52 -0
  41. package/src/browser/event-controller.ts +86 -70
  42. package/src/browser/history-state.ts +21 -0
  43. package/src/browser/index.ts +3 -3
  44. package/src/browser/navigation-bridge.ts +86 -11
  45. package/src/browser/navigation-client.ts +76 -28
  46. package/src/browser/navigation-store.ts +32 -9
  47. package/src/browser/navigation-transaction.ts +10 -28
  48. package/src/browser/partial-update.ts +64 -26
  49. package/src/browser/prefetch/cache.ts +129 -21
  50. package/src/browser/prefetch/fetch.ts +148 -16
  51. package/src/browser/prefetch/queue.ts +36 -5
  52. package/src/browser/rango-state.ts +53 -13
  53. package/src/browser/react/Link.tsx +30 -2
  54. package/src/browser/react/NavigationProvider.tsx +72 -31
  55. package/src/browser/react/filter-segment-order.ts +51 -7
  56. package/src/browser/react/index.ts +3 -0
  57. package/src/browser/react/location-state-shared.ts +175 -4
  58. package/src/browser/react/location-state.ts +39 -13
  59. package/src/browser/react/use-handle.ts +17 -9
  60. package/src/browser/react/use-navigation.ts +22 -2
  61. package/src/browser/react/use-params.ts +20 -8
  62. package/src/browser/react/use-reverse.ts +106 -0
  63. package/src/browser/react/use-router.ts +22 -2
  64. package/src/browser/react/use-segments.ts +11 -8
  65. package/src/browser/response-adapter.ts +25 -0
  66. package/src/browser/rsc-router.tsx +64 -22
  67. package/src/browser/scroll-restoration.ts +22 -14
  68. package/src/browser/segment-reconciler.ts +36 -14
  69. package/src/browser/segment-structure-assert.ts +2 -2
  70. package/src/browser/server-action-bridge.ts +23 -30
  71. package/src/browser/types.ts +21 -0
  72. package/src/build/collect-fallback-refs.ts +107 -0
  73. package/src/build/generate-manifest.ts +60 -35
  74. package/src/build/generate-route-types.ts +2 -0
  75. package/src/build/index.ts +2 -0
  76. package/src/build/route-trie.ts +52 -25
  77. package/src/build/route-types/codegen.ts +4 -4
  78. package/src/build/route-types/include-resolution.ts +1 -1
  79. package/src/build/route-types/per-module-writer.ts +7 -4
  80. package/src/build/route-types/router-processing.ts +55 -14
  81. package/src/build/route-types/scan-filter.ts +1 -1
  82. package/src/build/route-types/source-scan.ts +118 -0
  83. package/src/build/runtime-discovery.ts +9 -20
  84. package/src/cache/cache-error.ts +104 -0
  85. package/src/cache/cache-policy.ts +95 -1
  86. package/src/cache/cache-runtime.ts +79 -13
  87. package/src/cache/cache-scope.ts +77 -46
  88. package/src/cache/cache-tag.ts +135 -0
  89. package/src/cache/cf/cf-cache-store.ts +1067 -176
  90. package/src/cache/cf/index.ts +4 -1
  91. package/src/cache/document-cache.ts +59 -7
  92. package/src/cache/index.ts +6 -0
  93. package/src/cache/memory-segment-store.ts +158 -14
  94. package/src/cache/tag-invalidation.ts +206 -0
  95. package/src/cache/types.ts +27 -0
  96. package/src/client.rsc.tsx +3 -0
  97. package/src/client.tsx +92 -182
  98. package/src/context-var.ts +5 -5
  99. package/src/decode-loader-results.ts +36 -0
  100. package/src/errors.ts +30 -1
  101. package/src/handle.ts +4 -6
  102. package/src/host/index.ts +2 -2
  103. package/src/host/router.ts +129 -57
  104. package/src/host/types.ts +31 -2
  105. package/src/host/utils.ts +1 -1
  106. package/src/href-client.ts +140 -20
  107. package/src/index.rsc.ts +16 -4
  108. package/src/index.ts +65 -15
  109. package/src/loader-store.ts +500 -0
  110. package/src/loader.rsc.ts +2 -5
  111. package/src/loader.ts +3 -10
  112. package/src/missing-id-error.ts +68 -0
  113. package/src/outlet-context.ts +1 -1
  114. package/src/prerender.ts +4 -4
  115. package/src/response-utils.ts +37 -0
  116. package/src/reverse.ts +65 -36
  117. package/src/route-content-wrapper.tsx +6 -28
  118. package/src/route-definition/dsl-helpers.ts +384 -257
  119. package/src/route-definition/helper-factories.ts +29 -139
  120. package/src/route-definition/helpers-types.ts +100 -28
  121. package/src/route-definition/resolve-handler-use.ts +6 -0
  122. package/src/route-definition/use-item-types.ts +32 -0
  123. package/src/route-types.ts +26 -41
  124. package/src/router/content-negotiation.ts +15 -2
  125. package/src/router/error-handling.ts +1 -1
  126. package/src/router/handler-context.ts +21 -38
  127. package/src/router/intercept-resolution.ts +4 -18
  128. package/src/router/lazy-includes.ts +8 -8
  129. package/src/router/loader-resolution.ts +19 -2
  130. package/src/router/manifest.ts +22 -13
  131. package/src/router/match-api.ts +4 -3
  132. package/src/router/match-handlers.ts +1 -0
  133. package/src/router/match-middleware/cache-lookup.ts +46 -92
  134. package/src/router/match-middleware/cache-store.ts +3 -2
  135. package/src/router/match-result.ts +103 -4
  136. package/src/router/metrics.ts +1 -1
  137. package/src/router/middleware-types.ts +15 -26
  138. package/src/router/middleware.ts +99 -84
  139. package/src/router/pattern-matching.ts +101 -17
  140. package/src/router/prerender-match.ts +3 -1
  141. package/src/router/preview-match.ts +3 -1
  142. package/src/router/request-classification.ts +4 -28
  143. package/src/router/revalidation.ts +58 -2
  144. package/src/router/router-interfaces.ts +45 -28
  145. package/src/router/router-options.ts +25 -1
  146. package/src/router/router-registry.ts +2 -5
  147. package/src/router/segment-resolution/fresh.ts +32 -6
  148. package/src/router/segment-resolution/loader-cache.ts +8 -17
  149. package/src/router/segment-resolution/revalidation.ts +154 -107
  150. package/src/router/segment-resolution/view-transition-default.ts +36 -0
  151. package/src/router/substitute-pattern-params.ts +56 -0
  152. package/src/router/trie-matching.ts +18 -13
  153. package/src/router/types.ts +8 -0
  154. package/src/router/url-params.ts +49 -0
  155. package/src/router.ts +23 -18
  156. package/src/rsc/handler-context.ts +2 -2
  157. package/src/rsc/handler.ts +46 -74
  158. package/src/rsc/helpers.ts +72 -43
  159. package/src/rsc/index.ts +1 -1
  160. package/src/rsc/origin-guard.ts +28 -10
  161. package/src/rsc/progressive-enhancement.ts +4 -0
  162. package/src/rsc/response-route-handler.ts +54 -54
  163. package/src/rsc/rsc-rendering.ts +35 -51
  164. package/src/rsc/runtime-warnings.ts +9 -10
  165. package/src/rsc/server-action.ts +17 -37
  166. package/src/rsc/ssr-setup.ts +16 -0
  167. package/src/rsc/types.ts +8 -2
  168. package/src/search-params.ts +4 -4
  169. package/src/segment-content-promise.ts +67 -0
  170. package/src/segment-loader-promise.ts +122 -0
  171. package/src/segment-system.tsx +132 -116
  172. package/src/serialize.ts +243 -0
  173. package/src/server/context.ts +143 -53
  174. package/src/server/cookie-store.ts +28 -4
  175. package/src/server/request-context.ts +46 -44
  176. package/src/ssr/index.tsx +5 -1
  177. package/src/static-handler.ts +1 -1
  178. package/src/types/cache-types.ts +13 -4
  179. package/src/types/error-types.ts +5 -1
  180. package/src/types/global-namespace.ts +39 -26
  181. package/src/types/handler-context.ts +68 -50
  182. package/src/types/index.ts +1 -0
  183. package/src/types/loader-types.ts +5 -6
  184. package/src/types/request-scope.ts +126 -0
  185. package/src/types/route-entry.ts +11 -0
  186. package/src/types/segments.ts +36 -2
  187. package/src/urls/include-helper.ts +34 -67
  188. package/src/urls/index.ts +0 -3
  189. package/src/urls/path-helper-types.ts +41 -7
  190. package/src/urls/path-helper.ts +17 -52
  191. package/src/urls/pattern-types.ts +36 -19
  192. package/src/urls/response-types.ts +22 -29
  193. package/src/urls/type-extraction.ts +26 -116
  194. package/src/urls/urls-function.ts +1 -5
  195. package/src/use-loader.tsx +416 -42
  196. package/src/vite/debug.ts +185 -0
  197. package/src/vite/discovery/bundle-postprocess.ts +6 -6
  198. package/src/vite/discovery/discover-routers.ts +101 -51
  199. package/src/vite/discovery/discovery-errors.ts +194 -0
  200. package/src/vite/discovery/gate-state.ts +171 -0
  201. package/src/vite/discovery/prerender-collection.ts +67 -26
  202. package/src/vite/discovery/route-types-writer.ts +40 -84
  203. package/src/vite/discovery/self-gen-tracking.ts +27 -1
  204. package/src/vite/discovery/state.ts +33 -0
  205. package/src/vite/discovery/virtual-module-codegen.ts +13 -23
  206. package/src/vite/index.ts +2 -0
  207. package/src/vite/plugin-types.ts +67 -0
  208. package/src/vite/plugins/cjs-to-esm.ts +8 -7
  209. package/src/vite/plugins/client-ref-dedup.ts +16 -0
  210. package/src/vite/plugins/client-ref-hashing.ts +28 -5
  211. package/src/vite/plugins/cloudflare-protocol-loader-hook.d.mts +23 -0
  212. package/src/vite/plugins/cloudflare-protocol-loader-hook.mjs +76 -0
  213. package/src/vite/plugins/cloudflare-protocol-stub.ts +214 -0
  214. package/src/vite/plugins/expose-action-id.ts +54 -30
  215. package/src/vite/plugins/expose-id-utils.ts +24 -8
  216. package/src/vite/plugins/expose-ids/export-analysis.ts +100 -20
  217. package/src/vite/plugins/expose-ids/handler-transform.ts +8 -61
  218. package/src/vite/plugins/expose-ids/loader-transform.ts +3 -5
  219. package/src/vite/plugins/expose-ids/router-transform.ts +20 -3
  220. package/src/vite/plugins/expose-internal-ids.ts +503 -468
  221. package/src/vite/plugins/performance-tracks.ts +29 -25
  222. package/src/vite/plugins/use-cache-transform.ts +65 -50
  223. package/src/vite/plugins/version-injector.ts +39 -23
  224. package/src/vite/plugins/version-plugin.ts +59 -2
  225. package/src/vite/plugins/virtual-entries.ts +2 -2
  226. package/src/vite/rango.ts +116 -29
  227. package/src/vite/router-discovery.ts +750 -100
  228. package/src/vite/utils/ast-handler-extract.ts +15 -15
  229. package/src/vite/utils/banner.ts +1 -1
  230. package/src/vite/utils/bundle-analysis.ts +4 -2
  231. package/src/vite/utils/client-chunks.ts +190 -0
  232. package/src/vite/utils/forward-user-plugins.ts +193 -0
  233. package/src/vite/utils/manifest-utils.ts +21 -5
  234. package/src/vite/utils/package-resolution.ts +41 -1
  235. package/src/vite/utils/prerender-utils.ts +21 -6
  236. package/src/vite/utils/shared-utils.ts +107 -26
  237. package/dist/__internal.d.ts +0 -83
  238. package/dist/__internal.d.ts.map +0 -1
  239. package/dist/__internal.js +0 -19
  240. package/dist/__internal.js.map +0 -1
  241. package/dist/__mocks__/version.d.ts +0 -7
  242. package/dist/__mocks__/version.d.ts.map +0 -1
  243. package/dist/__mocks__/version.js +0 -7
  244. package/dist/__mocks__/version.js.map +0 -1
  245. package/dist/__tests__/client-href.test.d.ts +0 -2
  246. package/dist/__tests__/client-href.test.d.ts.map +0 -1
  247. package/dist/__tests__/client-href.test.js +0 -74
  248. package/dist/__tests__/client-href.test.js.map +0 -1
  249. package/dist/__tests__/component-utils.test.d.ts +0 -2
  250. package/dist/__tests__/component-utils.test.d.ts.map +0 -1
  251. package/dist/__tests__/component-utils.test.js +0 -51
  252. package/dist/__tests__/component-utils.test.js.map +0 -1
  253. package/dist/__tests__/event-controller.test.d.ts +0 -2
  254. package/dist/__tests__/event-controller.test.d.ts.map +0 -1
  255. package/dist/__tests__/event-controller.test.js +0 -538
  256. package/dist/__tests__/event-controller.test.js.map +0 -1
  257. package/dist/__tests__/helpers/route-tree.d.ts +0 -118
  258. package/dist/__tests__/helpers/route-tree.d.ts.map +0 -1
  259. package/dist/__tests__/helpers/route-tree.js +0 -374
  260. package/dist/__tests__/helpers/route-tree.js.map +0 -1
  261. package/dist/__tests__/match-result.test.d.ts +0 -2
  262. package/dist/__tests__/match-result.test.d.ts.map +0 -1
  263. package/dist/__tests__/match-result.test.js +0 -154
  264. package/dist/__tests__/match-result.test.js.map +0 -1
  265. package/dist/__tests__/navigation-store.test.d.ts +0 -2
  266. package/dist/__tests__/navigation-store.test.d.ts.map +0 -1
  267. package/dist/__tests__/navigation-store.test.js +0 -440
  268. package/dist/__tests__/navigation-store.test.js.map +0 -1
  269. package/dist/__tests__/partial-update.test.d.ts +0 -2
  270. package/dist/__tests__/partial-update.test.d.ts.map +0 -1
  271. package/dist/__tests__/partial-update.test.js +0 -1009
  272. package/dist/__tests__/partial-update.test.js.map +0 -1
  273. package/dist/__tests__/reverse-types.test.d.ts +0 -8
  274. package/dist/__tests__/reverse-types.test.d.ts.map +0 -1
  275. package/dist/__tests__/reverse-types.test.js +0 -656
  276. package/dist/__tests__/reverse-types.test.js.map +0 -1
  277. package/dist/__tests__/route-definition.test.d.ts +0 -2
  278. package/dist/__tests__/route-definition.test.d.ts.map +0 -1
  279. package/dist/__tests__/route-definition.test.js +0 -55
  280. package/dist/__tests__/route-definition.test.js.map +0 -1
  281. package/dist/__tests__/router-helpers.test.d.ts +0 -2
  282. package/dist/__tests__/router-helpers.test.d.ts.map +0 -1
  283. package/dist/__tests__/router-helpers.test.js +0 -377
  284. package/dist/__tests__/router-helpers.test.js.map +0 -1
  285. package/dist/__tests__/router-integration-2.test.d.ts +0 -2
  286. package/dist/__tests__/router-integration-2.test.d.ts.map +0 -1
  287. package/dist/__tests__/router-integration-2.test.js +0 -426
  288. package/dist/__tests__/router-integration-2.test.js.map +0 -1
  289. package/dist/__tests__/router-integration.test.d.ts +0 -2
  290. package/dist/__tests__/router-integration.test.d.ts.map +0 -1
  291. package/dist/__tests__/router-integration.test.js +0 -1051
  292. package/dist/__tests__/router-integration.test.js.map +0 -1
  293. package/dist/__tests__/search-params.test.d.ts +0 -5
  294. package/dist/__tests__/search-params.test.d.ts.map +0 -1
  295. package/dist/__tests__/search-params.test.js +0 -306
  296. package/dist/__tests__/search-params.test.js.map +0 -1
  297. package/dist/__tests__/segment-system.test.d.ts +0 -2
  298. package/dist/__tests__/segment-system.test.d.ts.map +0 -1
  299. package/dist/__tests__/segment-system.test.js +0 -627
  300. package/dist/__tests__/segment-system.test.js.map +0 -1
  301. package/dist/__tests__/static-handler-types.test.d.ts +0 -8
  302. package/dist/__tests__/static-handler-types.test.d.ts.map +0 -1
  303. package/dist/__tests__/static-handler-types.test.js +0 -63
  304. package/dist/__tests__/static-handler-types.test.js.map +0 -1
  305. package/dist/__tests__/urls.test.d.ts +0 -2
  306. package/dist/__tests__/urls.test.d.ts.map +0 -1
  307. package/dist/__tests__/urls.test.js +0 -421
  308. package/dist/__tests__/urls.test.js.map +0 -1
  309. package/dist/__tests__/use-mount.test.d.ts +0 -2
  310. package/dist/__tests__/use-mount.test.d.ts.map +0 -1
  311. package/dist/__tests__/use-mount.test.js +0 -35
  312. package/dist/__tests__/use-mount.test.js.map +0 -1
  313. package/dist/bin/rango.d.ts +0 -2
  314. package/dist/bin/rango.d.ts.map +0 -1
  315. package/dist/bin/rango.js.map +0 -1
  316. package/dist/browser/event-controller.d.ts +0 -191
  317. package/dist/browser/event-controller.d.ts.map +0 -1
  318. package/dist/browser/event-controller.js +0 -559
  319. package/dist/browser/event-controller.js.map +0 -1
  320. package/dist/browser/index.d.ts +0 -2
  321. package/dist/browser/index.d.ts.map +0 -1
  322. package/dist/browser/index.js +0 -14
  323. package/dist/browser/index.js.map +0 -1
  324. package/dist/browser/link-interceptor.d.ts +0 -38
  325. package/dist/browser/link-interceptor.d.ts.map +0 -1
  326. package/dist/browser/link-interceptor.js +0 -99
  327. package/dist/browser/link-interceptor.js.map +0 -1
  328. package/dist/browser/logging.d.ts +0 -10
  329. package/dist/browser/logging.d.ts.map +0 -1
  330. package/dist/browser/logging.js +0 -29
  331. package/dist/browser/logging.js.map +0 -1
  332. package/dist/browser/lru-cache.d.ts +0 -17
  333. package/dist/browser/lru-cache.d.ts.map +0 -1
  334. package/dist/browser/lru-cache.js +0 -50
  335. package/dist/browser/lru-cache.js.map +0 -1
  336. package/dist/browser/merge-segment-loaders.d.ts +0 -39
  337. package/dist/browser/merge-segment-loaders.d.ts.map +0 -1
  338. package/dist/browser/merge-segment-loaders.js +0 -102
  339. package/dist/browser/merge-segment-loaders.js.map +0 -1
  340. package/dist/browser/navigation-bridge.d.ts +0 -102
  341. package/dist/browser/navigation-bridge.d.ts.map +0 -1
  342. package/dist/browser/navigation-bridge.js +0 -708
  343. package/dist/browser/navigation-bridge.js.map +0 -1
  344. package/dist/browser/navigation-client.d.ts +0 -25
  345. package/dist/browser/navigation-client.d.ts.map +0 -1
  346. package/dist/browser/navigation-client.js +0 -157
  347. package/dist/browser/navigation-client.js.map +0 -1
  348. package/dist/browser/navigation-store.d.ts +0 -101
  349. package/dist/browser/navigation-store.d.ts.map +0 -1
  350. package/dist/browser/navigation-store.js +0 -625
  351. package/dist/browser/navigation-store.js.map +0 -1
  352. package/dist/browser/partial-update.d.ts +0 -75
  353. package/dist/browser/partial-update.d.ts.map +0 -1
  354. package/dist/browser/partial-update.js +0 -426
  355. package/dist/browser/partial-update.js.map +0 -1
  356. package/dist/browser/react/Link.d.ts +0 -86
  357. package/dist/browser/react/Link.d.ts.map +0 -1
  358. package/dist/browser/react/Link.js +0 -128
  359. package/dist/browser/react/Link.js.map +0 -1
  360. package/dist/browser/react/NavigationProvider.d.ts +0 -63
  361. package/dist/browser/react/NavigationProvider.d.ts.map +0 -1
  362. package/dist/browser/react/NavigationProvider.js +0 -216
  363. package/dist/browser/react/NavigationProvider.js.map +0 -1
  364. package/dist/browser/react/ScrollRestoration.d.ts +0 -75
  365. package/dist/browser/react/ScrollRestoration.d.ts.map +0 -1
  366. package/dist/browser/react/ScrollRestoration.js +0 -57
  367. package/dist/browser/react/ScrollRestoration.js.map +0 -1
  368. package/dist/browser/react/context.d.ts +0 -46
  369. package/dist/browser/react/context.d.ts.map +0 -1
  370. package/dist/browser/react/context.js +0 -10
  371. package/dist/browser/react/context.js.map +0 -1
  372. package/dist/browser/react/index.d.ts +0 -11
  373. package/dist/browser/react/index.d.ts.map +0 -1
  374. package/dist/browser/react/index.js +0 -22
  375. package/dist/browser/react/index.js.map +0 -1
  376. package/dist/browser/react/location-state-shared.d.ts +0 -63
  377. package/dist/browser/react/location-state-shared.d.ts.map +0 -1
  378. package/dist/browser/react/location-state-shared.js +0 -81
  379. package/dist/browser/react/location-state-shared.js.map +0 -1
  380. package/dist/browser/react/location-state.d.ts +0 -23
  381. package/dist/browser/react/location-state.d.ts.map +0 -1
  382. package/dist/browser/react/location-state.js +0 -29
  383. package/dist/browser/react/location-state.js.map +0 -1
  384. package/dist/browser/react/mount-context.d.ts +0 -24
  385. package/dist/browser/react/mount-context.d.ts.map +0 -1
  386. package/dist/browser/react/mount-context.js +0 -24
  387. package/dist/browser/react/mount-context.js.map +0 -1
  388. package/dist/browser/react/use-action.d.ts +0 -64
  389. package/dist/browser/react/use-action.d.ts.map +0 -1
  390. package/dist/browser/react/use-action.js +0 -134
  391. package/dist/browser/react/use-action.js.map +0 -1
  392. package/dist/browser/react/use-client-cache.d.ts +0 -41
  393. package/dist/browser/react/use-client-cache.d.ts.map +0 -1
  394. package/dist/browser/react/use-client-cache.js +0 -39
  395. package/dist/browser/react/use-client-cache.js.map +0 -1
  396. package/dist/browser/react/use-handle.d.ts +0 -31
  397. package/dist/browser/react/use-handle.d.ts.map +0 -1
  398. package/dist/browser/react/use-handle.js +0 -144
  399. package/dist/browser/react/use-handle.js.map +0 -1
  400. package/dist/browser/react/use-href.d.ts +0 -33
  401. package/dist/browser/react/use-href.d.ts.map +0 -1
  402. package/dist/browser/react/use-href.js +0 -39
  403. package/dist/browser/react/use-href.js.map +0 -1
  404. package/dist/browser/react/use-link-status.d.ts +0 -37
  405. package/dist/browser/react/use-link-status.d.ts.map +0 -1
  406. package/dist/browser/react/use-link-status.js +0 -99
  407. package/dist/browser/react/use-link-status.js.map +0 -1
  408. package/dist/browser/react/use-mount.d.ts +0 -25
  409. package/dist/browser/react/use-mount.d.ts.map +0 -1
  410. package/dist/browser/react/use-mount.js +0 -30
  411. package/dist/browser/react/use-mount.js.map +0 -1
  412. package/dist/browser/react/use-navigation.d.ts +0 -27
  413. package/dist/browser/react/use-navigation.d.ts.map +0 -1
  414. package/dist/browser/react/use-navigation.js +0 -87
  415. package/dist/browser/react/use-navigation.js.map +0 -1
  416. package/dist/browser/react/use-segments.d.ts +0 -38
  417. package/dist/browser/react/use-segments.d.ts.map +0 -1
  418. package/dist/browser/react/use-segments.js +0 -130
  419. package/dist/browser/react/use-segments.js.map +0 -1
  420. package/dist/browser/request-controller.d.ts +0 -26
  421. package/dist/browser/request-controller.d.ts.map +0 -1
  422. package/dist/browser/request-controller.js +0 -147
  423. package/dist/browser/request-controller.js.map +0 -1
  424. package/dist/browser/rsc-router.d.ts +0 -129
  425. package/dist/browser/rsc-router.d.ts.map +0 -1
  426. package/dist/browser/rsc-router.js +0 -195
  427. package/dist/browser/rsc-router.js.map +0 -1
  428. package/dist/browser/scroll-restoration.d.ts +0 -93
  429. package/dist/browser/scroll-restoration.d.ts.map +0 -1
  430. package/dist/browser/scroll-restoration.js +0 -321
  431. package/dist/browser/scroll-restoration.js.map +0 -1
  432. package/dist/browser/segment-structure-assert.d.ts +0 -17
  433. package/dist/browser/segment-structure-assert.d.ts.map +0 -1
  434. package/dist/browser/segment-structure-assert.js +0 -59
  435. package/dist/browser/segment-structure-assert.js.map +0 -1
  436. package/dist/browser/server-action-bridge.d.ts +0 -26
  437. package/dist/browser/server-action-bridge.d.ts.map +0 -1
  438. package/dist/browser/server-action-bridge.js +0 -668
  439. package/dist/browser/server-action-bridge.js.map +0 -1
  440. package/dist/browser/shallow.d.ts +0 -12
  441. package/dist/browser/shallow.d.ts.map +0 -1
  442. package/dist/browser/shallow.js +0 -34
  443. package/dist/browser/shallow.js.map +0 -1
  444. package/dist/browser/types.d.ts +0 -369
  445. package/dist/browser/types.d.ts.map +0 -1
  446. package/dist/browser/types.js +0 -2
  447. package/dist/browser/types.js.map +0 -1
  448. package/dist/build/__tests__/generate-cli.test.d.ts +0 -2
  449. package/dist/build/__tests__/generate-cli.test.d.ts.map +0 -1
  450. package/dist/build/__tests__/generate-cli.test.js +0 -237
  451. package/dist/build/__tests__/generate-cli.test.js.map +0 -1
  452. package/dist/build/__tests__/generate-manifest.test.d.ts +0 -2
  453. package/dist/build/__tests__/generate-manifest.test.d.ts.map +0 -1
  454. package/dist/build/__tests__/generate-manifest.test.js +0 -119
  455. package/dist/build/__tests__/generate-manifest.test.js.map +0 -1
  456. package/dist/build/__tests__/generate-route-types.test.d.ts +0 -2
  457. package/dist/build/__tests__/generate-route-types.test.d.ts.map +0 -1
  458. package/dist/build/__tests__/generate-route-types.test.js +0 -620
  459. package/dist/build/__tests__/generate-route-types.test.js.map +0 -1
  460. package/dist/build/__tests__/per-router-manifest.test.d.ts +0 -2
  461. package/dist/build/__tests__/per-router-manifest.test.d.ts.map +0 -1
  462. package/dist/build/__tests__/per-router-manifest.test.js +0 -308
  463. package/dist/build/__tests__/per-router-manifest.test.js.map +0 -1
  464. package/dist/build/generate-manifest.d.ts +0 -81
  465. package/dist/build/generate-manifest.d.ts.map +0 -1
  466. package/dist/build/generate-manifest.js +0 -276
  467. package/dist/build/generate-manifest.js.map +0 -1
  468. package/dist/build/generate-route-types.d.ts +0 -115
  469. package/dist/build/generate-route-types.d.ts.map +0 -1
  470. package/dist/build/generate-route-types.js +0 -740
  471. package/dist/build/generate-route-types.js.map +0 -1
  472. package/dist/build/index.d.ts +0 -21
  473. package/dist/build/index.d.ts.map +0 -1
  474. package/dist/build/index.js +0 -21
  475. package/dist/build/index.js.map +0 -1
  476. package/dist/build/route-trie.d.ts +0 -71
  477. package/dist/build/route-trie.d.ts.map +0 -1
  478. package/dist/build/route-trie.js +0 -175
  479. package/dist/build/route-trie.js.map +0 -1
  480. package/dist/cache/__tests__/cache-scope.test.d.ts +0 -2
  481. package/dist/cache/__tests__/cache-scope.test.d.ts.map +0 -1
  482. package/dist/cache/__tests__/cache-scope.test.js +0 -208
  483. package/dist/cache/__tests__/cache-scope.test.js.map +0 -1
  484. package/dist/cache/__tests__/document-cache.test.d.ts +0 -2
  485. package/dist/cache/__tests__/document-cache.test.d.ts.map +0 -1
  486. package/dist/cache/__tests__/document-cache.test.js +0 -345
  487. package/dist/cache/__tests__/document-cache.test.js.map +0 -1
  488. package/dist/cache/__tests__/memory-segment-store.test.d.ts +0 -2
  489. package/dist/cache/__tests__/memory-segment-store.test.d.ts.map +0 -1
  490. package/dist/cache/__tests__/memory-segment-store.test.js +0 -425
  491. package/dist/cache/__tests__/memory-segment-store.test.js.map +0 -1
  492. package/dist/cache/__tests__/memory-store.test.d.ts +0 -2
  493. package/dist/cache/__tests__/memory-store.test.d.ts.map +0 -1
  494. package/dist/cache/__tests__/memory-store.test.js +0 -367
  495. package/dist/cache/__tests__/memory-store.test.js.map +0 -1
  496. package/dist/cache/cache-scope.d.ts +0 -102
  497. package/dist/cache/cache-scope.d.ts.map +0 -1
  498. package/dist/cache/cache-scope.js +0 -440
  499. package/dist/cache/cache-scope.js.map +0 -1
  500. package/dist/cache/cf/__tests__/cf-cache-store.test.d.ts +0 -2
  501. package/dist/cache/cf/__tests__/cf-cache-store.test.d.ts.map +0 -1
  502. package/dist/cache/cf/__tests__/cf-cache-store.test.js +0 -330
  503. package/dist/cache/cf/__tests__/cf-cache-store.test.js.map +0 -1
  504. package/dist/cache/cf/cf-cache-store.d.ts +0 -165
  505. package/dist/cache/cf/cf-cache-store.d.ts.map +0 -1
  506. package/dist/cache/cf/cf-cache-store.js +0 -242
  507. package/dist/cache/cf/cf-cache-store.js.map +0 -1
  508. package/dist/cache/cf/index.d.ts +0 -14
  509. package/dist/cache/cf/index.d.ts.map +0 -1
  510. package/dist/cache/cf/index.js +0 -17
  511. package/dist/cache/cf/index.js.map +0 -1
  512. package/dist/cache/document-cache.d.ts +0 -64
  513. package/dist/cache/document-cache.d.ts.map +0 -1
  514. package/dist/cache/document-cache.js +0 -228
  515. package/dist/cache/document-cache.js.map +0 -1
  516. package/dist/cache/index.d.ts +0 -19
  517. package/dist/cache/index.d.ts.map +0 -1
  518. package/dist/cache/index.js +0 -21
  519. package/dist/cache/index.js.map +0 -1
  520. package/dist/cache/memory-segment-store.d.ts +0 -110
  521. package/dist/cache/memory-segment-store.d.ts.map +0 -1
  522. package/dist/cache/memory-segment-store.js +0 -117
  523. package/dist/cache/memory-segment-store.js.map +0 -1
  524. package/dist/cache/memory-store.d.ts +0 -41
  525. package/dist/cache/memory-store.d.ts.map +0 -1
  526. package/dist/cache/memory-store.js +0 -191
  527. package/dist/cache/memory-store.js.map +0 -1
  528. package/dist/cache/types.d.ts +0 -317
  529. package/dist/cache/types.d.ts.map +0 -1
  530. package/dist/cache/types.js +0 -12
  531. package/dist/cache/types.js.map +0 -1
  532. package/dist/client.d.ts +0 -248
  533. package/dist/client.d.ts.map +0 -1
  534. package/dist/client.js +0 -367
  535. package/dist/client.js.map +0 -1
  536. package/dist/client.rsc.d.ts +0 -26
  537. package/dist/client.rsc.d.ts.map +0 -1
  538. package/dist/client.rsc.js +0 -46
  539. package/dist/client.rsc.js.map +0 -1
  540. package/dist/component-utils.d.ts +0 -36
  541. package/dist/component-utils.d.ts.map +0 -1
  542. package/dist/component-utils.js +0 -61
  543. package/dist/component-utils.js.map +0 -1
  544. package/dist/components/DefaultDocument.d.ts +0 -13
  545. package/dist/components/DefaultDocument.d.ts.map +0 -1
  546. package/dist/components/DefaultDocument.js +0 -15
  547. package/dist/components/DefaultDocument.js.map +0 -1
  548. package/dist/debug.d.ts +0 -58
  549. package/dist/debug.d.ts.map +0 -1
  550. package/dist/debug.js +0 -157
  551. package/dist/debug.js.map +0 -1
  552. package/dist/default-error-boundary.d.ts +0 -11
  553. package/dist/default-error-boundary.d.ts.map +0 -1
  554. package/dist/default-error-boundary.js +0 -45
  555. package/dist/default-error-boundary.js.map +0 -1
  556. package/dist/deps/browser.d.ts +0 -2
  557. package/dist/deps/browser.d.ts.map +0 -1
  558. package/dist/deps/browser.js +0 -3
  559. package/dist/deps/browser.js.map +0 -1
  560. package/dist/deps/html-stream-client.d.ts +0 -2
  561. package/dist/deps/html-stream-client.d.ts.map +0 -1
  562. package/dist/deps/html-stream-client.js +0 -3
  563. package/dist/deps/html-stream-client.js.map +0 -1
  564. package/dist/deps/html-stream-server.d.ts +0 -2
  565. package/dist/deps/html-stream-server.d.ts.map +0 -1
  566. package/dist/deps/html-stream-server.js +0 -3
  567. package/dist/deps/html-stream-server.js.map +0 -1
  568. package/dist/deps/rsc.d.ts +0 -2
  569. package/dist/deps/rsc.d.ts.map +0 -1
  570. package/dist/deps/rsc.js +0 -4
  571. package/dist/deps/rsc.js.map +0 -1
  572. package/dist/deps/ssr.d.ts +0 -2
  573. package/dist/deps/ssr.d.ts.map +0 -1
  574. package/dist/deps/ssr.js +0 -3
  575. package/dist/deps/ssr.js.map +0 -1
  576. package/dist/errors.d.ts +0 -174
  577. package/dist/errors.d.ts.map +0 -1
  578. package/dist/errors.js +0 -241
  579. package/dist/errors.js.map +0 -1
  580. package/dist/handle.d.ts +0 -78
  581. package/dist/handle.d.ts.map +0 -1
  582. package/dist/handle.js +0 -82
  583. package/dist/handle.js.map +0 -1
  584. package/dist/handles/MetaTags.d.ts +0 -14
  585. package/dist/handles/MetaTags.d.ts.map +0 -1
  586. package/dist/handles/MetaTags.js +0 -136
  587. package/dist/handles/MetaTags.js.map +0 -1
  588. package/dist/handles/index.d.ts +0 -6
  589. package/dist/handles/index.d.ts.map +0 -1
  590. package/dist/handles/index.js +0 -6
  591. package/dist/handles/index.js.map +0 -1
  592. package/dist/handles/meta.d.ts +0 -39
  593. package/dist/handles/meta.d.ts.map +0 -1
  594. package/dist/handles/meta.js +0 -202
  595. package/dist/handles/meta.js.map +0 -1
  596. package/dist/host/__tests__/errors.test.d.ts +0 -2
  597. package/dist/host/__tests__/errors.test.d.ts.map +0 -1
  598. package/dist/host/__tests__/errors.test.js +0 -76
  599. package/dist/host/__tests__/errors.test.js.map +0 -1
  600. package/dist/host/__tests__/pattern-comprehensive.test.d.ts +0 -2
  601. package/dist/host/__tests__/pattern-comprehensive.test.d.ts.map +0 -1
  602. package/dist/host/__tests__/pattern-comprehensive.test.js +0 -732
  603. package/dist/host/__tests__/pattern-comprehensive.test.js.map +0 -1
  604. package/dist/host/__tests__/pattern-matcher.test.d.ts +0 -2
  605. package/dist/host/__tests__/pattern-matcher.test.d.ts.map +0 -1
  606. package/dist/host/__tests__/pattern-matcher.test.js +0 -251
  607. package/dist/host/__tests__/pattern-matcher.test.js.map +0 -1
  608. package/dist/host/__tests__/router.test.d.ts +0 -2
  609. package/dist/host/__tests__/router.test.d.ts.map +0 -1
  610. package/dist/host/__tests__/router.test.js +0 -241
  611. package/dist/host/__tests__/router.test.js.map +0 -1
  612. package/dist/host/__tests__/testing.test.d.ts +0 -2
  613. package/dist/host/__tests__/testing.test.d.ts.map +0 -1
  614. package/dist/host/__tests__/testing.test.js +0 -64
  615. package/dist/host/__tests__/testing.test.js.map +0 -1
  616. package/dist/host/__tests__/utils.test.d.ts +0 -2
  617. package/dist/host/__tests__/utils.test.d.ts.map +0 -1
  618. package/dist/host/__tests__/utils.test.js +0 -29
  619. package/dist/host/__tests__/utils.test.js.map +0 -1
  620. package/dist/host/cookie-handler.d.ts +0 -34
  621. package/dist/host/cookie-handler.d.ts.map +0 -1
  622. package/dist/host/cookie-handler.js +0 -124
  623. package/dist/host/cookie-handler.js.map +0 -1
  624. package/dist/host/errors.d.ts +0 -56
  625. package/dist/host/errors.d.ts.map +0 -1
  626. package/dist/host/errors.js +0 -79
  627. package/dist/host/errors.js.map +0 -1
  628. package/dist/host/index.d.ts +0 -29
  629. package/dist/host/index.d.ts.map +0 -1
  630. package/dist/host/index.js +0 -32
  631. package/dist/host/index.js.map +0 -1
  632. package/dist/host/pattern-matcher.d.ts +0 -36
  633. package/dist/host/pattern-matcher.d.ts.map +0 -1
  634. package/dist/host/pattern-matcher.js +0 -172
  635. package/dist/host/pattern-matcher.js.map +0 -1
  636. package/dist/host/router.d.ts +0 -26
  637. package/dist/host/router.d.ts.map +0 -1
  638. package/dist/host/router.js +0 -218
  639. package/dist/host/router.js.map +0 -1
  640. package/dist/host/testing.d.ts +0 -36
  641. package/dist/host/testing.d.ts.map +0 -1
  642. package/dist/host/testing.js +0 -55
  643. package/dist/host/testing.js.map +0 -1
  644. package/dist/host/types.d.ts +0 -115
  645. package/dist/host/types.d.ts.map +0 -1
  646. package/dist/host/types.js +0 -7
  647. package/dist/host/types.js.map +0 -1
  648. package/dist/host/utils.d.ts +0 -21
  649. package/dist/host/utils.d.ts.map +0 -1
  650. package/dist/host/utils.js +0 -23
  651. package/dist/host/utils.js.map +0 -1
  652. package/dist/href-client.d.ts +0 -131
  653. package/dist/href-client.d.ts.map +0 -1
  654. package/dist/href-client.js +0 -64
  655. package/dist/href-client.js.map +0 -1
  656. package/dist/href-context.d.ts +0 -29
  657. package/dist/href-context.d.ts.map +0 -1
  658. package/dist/href-context.js +0 -21
  659. package/dist/href-context.js.map +0 -1
  660. package/dist/index.d.ts +0 -73
  661. package/dist/index.d.ts.map +0 -1
  662. package/dist/index.js +0 -91
  663. package/dist/index.js.map +0 -1
  664. package/dist/index.rsc.d.ts +0 -32
  665. package/dist/index.rsc.d.ts.map +0 -1
  666. package/dist/index.rsc.js +0 -40
  667. package/dist/index.rsc.js.map +0 -1
  668. package/dist/internal-debug.d.ts +0 -2
  669. package/dist/internal-debug.d.ts.map +0 -1
  670. package/dist/internal-debug.js +0 -5
  671. package/dist/internal-debug.js.map +0 -1
  672. package/dist/loader.d.ts +0 -14
  673. package/dist/loader.d.ts.map +0 -1
  674. package/dist/loader.js +0 -20
  675. package/dist/loader.js.map +0 -1
  676. package/dist/loader.rsc.d.ts +0 -19
  677. package/dist/loader.rsc.d.ts.map +0 -1
  678. package/dist/loader.rsc.js +0 -99
  679. package/dist/loader.rsc.js.map +0 -1
  680. package/dist/network-error-thrower.d.ts +0 -17
  681. package/dist/network-error-thrower.d.ts.map +0 -1
  682. package/dist/network-error-thrower.js +0 -14
  683. package/dist/network-error-thrower.js.map +0 -1
  684. package/dist/outlet-context.d.ts +0 -13
  685. package/dist/outlet-context.d.ts.map +0 -1
  686. package/dist/outlet-context.js +0 -3
  687. package/dist/outlet-context.js.map +0 -1
  688. package/dist/prerender/__tests__/param-hash.test.d.ts +0 -2
  689. package/dist/prerender/__tests__/param-hash.test.d.ts.map +0 -1
  690. package/dist/prerender/__tests__/param-hash.test.js +0 -148
  691. package/dist/prerender/__tests__/param-hash.test.js.map +0 -1
  692. package/dist/prerender/param-hash.d.ts +0 -16
  693. package/dist/prerender/param-hash.d.ts.map +0 -1
  694. package/dist/prerender/param-hash.js +0 -36
  695. package/dist/prerender/param-hash.js.map +0 -1
  696. package/dist/prerender/store.d.ts +0 -38
  697. package/dist/prerender/store.d.ts.map +0 -1
  698. package/dist/prerender/store.js +0 -61
  699. package/dist/prerender/store.js.map +0 -1
  700. package/dist/prerender.d.ts +0 -66
  701. package/dist/prerender.d.ts.map +0 -1
  702. package/dist/prerender.js +0 -57
  703. package/dist/prerender.js.map +0 -1
  704. package/dist/reverse.d.ts +0 -196
  705. package/dist/reverse.d.ts.map +0 -1
  706. package/dist/reverse.js +0 -78
  707. package/dist/reverse.js.map +0 -1
  708. package/dist/root-error-boundary.d.ts +0 -33
  709. package/dist/root-error-boundary.d.ts.map +0 -1
  710. package/dist/root-error-boundary.js +0 -165
  711. package/dist/root-error-boundary.js.map +0 -1
  712. package/dist/route-content-wrapper.d.ts +0 -46
  713. package/dist/route-content-wrapper.d.ts.map +0 -1
  714. package/dist/route-content-wrapper.js +0 -77
  715. package/dist/route-content-wrapper.js.map +0 -1
  716. package/dist/route-definition.d.ts +0 -421
  717. package/dist/route-definition.d.ts.map +0 -1
  718. package/dist/route-definition.js +0 -868
  719. package/dist/route-definition.js.map +0 -1
  720. package/dist/route-map-builder.d.ts +0 -155
  721. package/dist/route-map-builder.d.ts.map +0 -1
  722. package/dist/route-map-builder.js +0 -237
  723. package/dist/route-map-builder.js.map +0 -1
  724. package/dist/route-types.d.ts +0 -165
  725. package/dist/route-types.d.ts.map +0 -1
  726. package/dist/route-types.js +0 -7
  727. package/dist/route-types.js.map +0 -1
  728. package/dist/router/__tests__/handler-context.test.d.ts +0 -2
  729. package/dist/router/__tests__/handler-context.test.d.ts.map +0 -1
  730. package/dist/router/__tests__/handler-context.test.js +0 -65
  731. package/dist/router/__tests__/handler-context.test.js.map +0 -1
  732. package/dist/router/__tests__/loader-cycle-detection.test.d.ts +0 -2
  733. package/dist/router/__tests__/loader-cycle-detection.test.d.ts.map +0 -1
  734. package/dist/router/__tests__/loader-cycle-detection.test.js +0 -221
  735. package/dist/router/__tests__/loader-cycle-detection.test.js.map +0 -1
  736. package/dist/router/__tests__/match-context.test.d.ts +0 -2
  737. package/dist/router/__tests__/match-context.test.d.ts.map +0 -1
  738. package/dist/router/__tests__/match-context.test.js +0 -92
  739. package/dist/router/__tests__/match-context.test.js.map +0 -1
  740. package/dist/router/__tests__/match-pipelines.test.d.ts +0 -2
  741. package/dist/router/__tests__/match-pipelines.test.d.ts.map +0 -1
  742. package/dist/router/__tests__/match-pipelines.test.js +0 -417
  743. package/dist/router/__tests__/match-pipelines.test.js.map +0 -1
  744. package/dist/router/__tests__/match-result.test.d.ts +0 -2
  745. package/dist/router/__tests__/match-result.test.d.ts.map +0 -1
  746. package/dist/router/__tests__/match-result.test.js +0 -457
  747. package/dist/router/__tests__/match-result.test.js.map +0 -1
  748. package/dist/router/__tests__/on-error.test.d.ts +0 -2
  749. package/dist/router/__tests__/on-error.test.d.ts.map +0 -1
  750. package/dist/router/__tests__/on-error.test.js +0 -678
  751. package/dist/router/__tests__/on-error.test.js.map +0 -1
  752. package/dist/router/__tests__/pattern-matching.test.d.ts +0 -2
  753. package/dist/router/__tests__/pattern-matching.test.d.ts.map +0 -1
  754. package/dist/router/__tests__/pattern-matching.test.js +0 -629
  755. package/dist/router/__tests__/pattern-matching.test.js.map +0 -1
  756. package/dist/router/__tests__/segment-resolution-parallel-loading.test.d.ts +0 -2
  757. package/dist/router/__tests__/segment-resolution-parallel-loading.test.d.ts.map +0 -1
  758. package/dist/router/__tests__/segment-resolution-parallel-loading.test.js +0 -155
  759. package/dist/router/__tests__/segment-resolution-parallel-loading.test.js.map +0 -1
  760. package/dist/router/error-handling.d.ts +0 -77
  761. package/dist/router/error-handling.d.ts.map +0 -1
  762. package/dist/router/error-handling.js +0 -202
  763. package/dist/router/error-handling.js.map +0 -1
  764. package/dist/router/handler-context.d.ts +0 -20
  765. package/dist/router/handler-context.d.ts.map +0 -1
  766. package/dist/router/handler-context.js +0 -198
  767. package/dist/router/handler-context.js.map +0 -1
  768. package/dist/router/intercept-resolution.d.ts +0 -66
  769. package/dist/router/intercept-resolution.d.ts.map +0 -1
  770. package/dist/router/intercept-resolution.js +0 -246
  771. package/dist/router/intercept-resolution.js.map +0 -1
  772. package/dist/router/loader-resolution.d.ts +0 -64
  773. package/dist/router/loader-resolution.d.ts.map +0 -1
  774. package/dist/router/loader-resolution.js +0 -284
  775. package/dist/router/loader-resolution.js.map +0 -1
  776. package/dist/router/logging.d.ts +0 -15
  777. package/dist/router/logging.d.ts.map +0 -1
  778. package/dist/router/logging.js +0 -99
  779. package/dist/router/logging.js.map +0 -1
  780. package/dist/router/manifest.d.ts +0 -22
  781. package/dist/router/manifest.d.ts.map +0 -1
  782. package/dist/router/manifest.js +0 -181
  783. package/dist/router/manifest.js.map +0 -1
  784. package/dist/router/match-api.d.ts +0 -35
  785. package/dist/router/match-api.d.ts.map +0 -1
  786. package/dist/router/match-api.js +0 -406
  787. package/dist/router/match-api.js.map +0 -1
  788. package/dist/router/match-context.d.ts +0 -206
  789. package/dist/router/match-context.d.ts.map +0 -1
  790. package/dist/router/match-context.js +0 -17
  791. package/dist/router/match-context.js.map +0 -1
  792. package/dist/router/match-middleware/background-revalidation.d.ts +0 -127
  793. package/dist/router/match-middleware/background-revalidation.d.ts.map +0 -1
  794. package/dist/router/match-middleware/background-revalidation.js +0 -75
  795. package/dist/router/match-middleware/background-revalidation.js.map +0 -1
  796. package/dist/router/match-middleware/cache-lookup.d.ts +0 -112
  797. package/dist/router/match-middleware/cache-lookup.d.ts.map +0 -1
  798. package/dist/router/match-middleware/cache-lookup.js +0 -257
  799. package/dist/router/match-middleware/cache-lookup.js.map +0 -1
  800. package/dist/router/match-middleware/cache-store.d.ts +0 -113
  801. package/dist/router/match-middleware/cache-store.d.ts.map +0 -1
  802. package/dist/router/match-middleware/cache-store.js +0 -108
  803. package/dist/router/match-middleware/cache-store.js.map +0 -1
  804. package/dist/router/match-middleware/index.d.ts +0 -81
  805. package/dist/router/match-middleware/index.d.ts.map +0 -1
  806. package/dist/router/match-middleware/index.js +0 -80
  807. package/dist/router/match-middleware/index.js.map +0 -1
  808. package/dist/router/match-middleware/intercept-resolution.d.ts +0 -117
  809. package/dist/router/match-middleware/intercept-resolution.d.ts.map +0 -1
  810. package/dist/router/match-middleware/intercept-resolution.js +0 -134
  811. package/dist/router/match-middleware/intercept-resolution.js.map +0 -1
  812. package/dist/router/match-middleware/segment-resolution.d.ts +0 -99
  813. package/dist/router/match-middleware/segment-resolution.d.ts.map +0 -1
  814. package/dist/router/match-middleware/segment-resolution.js +0 -53
  815. package/dist/router/match-middleware/segment-resolution.js.map +0 -1
  816. package/dist/router/match-pipelines.d.ts +0 -147
  817. package/dist/router/match-pipelines.d.ts.map +0 -1
  818. package/dist/router/match-pipelines.js +0 -82
  819. package/dist/router/match-pipelines.js.map +0 -1
  820. package/dist/router/match-result.d.ts +0 -126
  821. package/dist/router/match-result.d.ts.map +0 -1
  822. package/dist/router/match-result.js +0 -93
  823. package/dist/router/match-result.js.map +0 -1
  824. package/dist/router/metrics.d.ts +0 -20
  825. package/dist/router/metrics.d.ts.map +0 -1
  826. package/dist/router/metrics.js +0 -47
  827. package/dist/router/metrics.js.map +0 -1
  828. package/dist/router/middleware.d.ts +0 -249
  829. package/dist/router/middleware.d.ts.map +0 -1
  830. package/dist/router/middleware.js +0 -434
  831. package/dist/router/middleware.js.map +0 -1
  832. package/dist/router/middleware.test.d.ts +0 -2
  833. package/dist/router/middleware.test.d.ts.map +0 -1
  834. package/dist/router/middleware.test.js +0 -816
  835. package/dist/router/middleware.test.js.map +0 -1
  836. package/dist/router/pattern-matching.d.ts +0 -149
  837. package/dist/router/pattern-matching.d.ts.map +0 -1
  838. package/dist/router/pattern-matching.js +0 -349
  839. package/dist/router/pattern-matching.js.map +0 -1
  840. package/dist/router/revalidation.d.ts +0 -44
  841. package/dist/router/revalidation.d.ts.map +0 -1
  842. package/dist/router/revalidation.js +0 -147
  843. package/dist/router/revalidation.js.map +0 -1
  844. package/dist/router/router-context.d.ts +0 -135
  845. package/dist/router/router-context.d.ts.map +0 -1
  846. package/dist/router/router-context.js +0 -36
  847. package/dist/router/router-context.js.map +0 -1
  848. package/dist/router/segment-resolution.d.ts +0 -127
  849. package/dist/router/segment-resolution.d.ts.map +0 -1
  850. package/dist/router/segment-resolution.js +0 -919
  851. package/dist/router/segment-resolution.js.map +0 -1
  852. package/dist/router/trie-matching.d.ts +0 -40
  853. package/dist/router/trie-matching.d.ts.map +0 -1
  854. package/dist/router/trie-matching.js +0 -127
  855. package/dist/router/trie-matching.js.map +0 -1
  856. package/dist/router/types.d.ts +0 -136
  857. package/dist/router/types.d.ts.map +0 -1
  858. package/dist/router/types.js +0 -7
  859. package/dist/router/types.js.map +0 -1
  860. package/dist/router.d.ts +0 -753
  861. package/dist/router.d.ts.map +0 -1
  862. package/dist/router.gen.d.ts +0 -6
  863. package/dist/router.gen.d.ts.map +0 -1
  864. package/dist/router.gen.js +0 -6
  865. package/dist/router.gen.js.map +0 -1
  866. package/dist/router.js +0 -1304
  867. package/dist/router.js.map +0 -1
  868. package/dist/rsc/__tests__/helpers.test.d.ts +0 -2
  869. package/dist/rsc/__tests__/helpers.test.d.ts.map +0 -1
  870. package/dist/rsc/__tests__/helpers.test.js +0 -140
  871. package/dist/rsc/__tests__/helpers.test.js.map +0 -1
  872. package/dist/rsc/handler.d.ts +0 -45
  873. package/dist/rsc/handler.d.ts.map +0 -1
  874. package/dist/rsc/handler.js +0 -1172
  875. package/dist/rsc/handler.js.map +0 -1
  876. package/dist/rsc/helpers.d.ts +0 -16
  877. package/dist/rsc/helpers.d.ts.map +0 -1
  878. package/dist/rsc/helpers.js +0 -55
  879. package/dist/rsc/helpers.js.map +0 -1
  880. package/dist/rsc/index.d.ts +0 -22
  881. package/dist/rsc/index.d.ts.map +0 -1
  882. package/dist/rsc/index.js +0 -23
  883. package/dist/rsc/index.js.map +0 -1
  884. package/dist/rsc/nonce.d.ts +0 -9
  885. package/dist/rsc/nonce.d.ts.map +0 -1
  886. package/dist/rsc/nonce.js +0 -18
  887. package/dist/rsc/nonce.js.map +0 -1
  888. package/dist/rsc/types.d.ts +0 -206
  889. package/dist/rsc/types.d.ts.map +0 -1
  890. package/dist/rsc/types.js +0 -8
  891. package/dist/rsc/types.js.map +0 -1
  892. package/dist/search-params.d.ts +0 -103
  893. package/dist/search-params.d.ts.map +0 -1
  894. package/dist/search-params.js +0 -74
  895. package/dist/search-params.js.map +0 -1
  896. package/dist/segment-system.d.ts +0 -75
  897. package/dist/segment-system.d.ts.map +0 -1
  898. package/dist/segment-system.js +0 -336
  899. package/dist/segment-system.js.map +0 -1
  900. package/dist/server/context.d.ts +0 -245
  901. package/dist/server/context.d.ts.map +0 -1
  902. package/dist/server/context.js +0 -197
  903. package/dist/server/context.js.map +0 -1
  904. package/dist/server/fetchable-loader-store.d.ts +0 -18
  905. package/dist/server/fetchable-loader-store.d.ts.map +0 -1
  906. package/dist/server/fetchable-loader-store.js +0 -18
  907. package/dist/server/fetchable-loader-store.js.map +0 -1
  908. package/dist/server/handle-store.d.ts +0 -85
  909. package/dist/server/handle-store.d.ts.map +0 -1
  910. package/dist/server/handle-store.js +0 -142
  911. package/dist/server/handle-store.js.map +0 -1
  912. package/dist/server/loader-registry.d.ts +0 -55
  913. package/dist/server/loader-registry.d.ts.map +0 -1
  914. package/dist/server/loader-registry.js +0 -132
  915. package/dist/server/loader-registry.js.map +0 -1
  916. package/dist/server/request-context.d.ts +0 -226
  917. package/dist/server/request-context.d.ts.map +0 -1
  918. package/dist/server/request-context.js +0 -290
  919. package/dist/server/request-context.js.map +0 -1
  920. package/dist/server/root-layout.d.ts +0 -4
  921. package/dist/server/root-layout.d.ts.map +0 -1
  922. package/dist/server/root-layout.js +0 -5
  923. package/dist/server/root-layout.js.map +0 -1
  924. package/dist/server.d.ts +0 -15
  925. package/dist/server.d.ts.map +0 -1
  926. package/dist/server.js +0 -20
  927. package/dist/server.js.map +0 -1
  928. package/dist/ssr/__tests__/ssr-handler.test.d.ts +0 -2
  929. package/dist/ssr/__tests__/ssr-handler.test.d.ts.map +0 -1
  930. package/dist/ssr/__tests__/ssr-handler.test.js +0 -132
  931. package/dist/ssr/__tests__/ssr-handler.test.js.map +0 -1
  932. package/dist/ssr/index.d.ts +0 -98
  933. package/dist/ssr/index.d.ts.map +0 -1
  934. package/dist/ssr/index.js +0 -158
  935. package/dist/ssr/index.js.map +0 -1
  936. package/dist/static-handler.d.ts +0 -50
  937. package/dist/static-handler.d.ts.map +0 -1
  938. package/dist/static-handler.gen.d.ts +0 -5
  939. package/dist/static-handler.gen.d.ts.map +0 -1
  940. package/dist/static-handler.gen.js +0 -5
  941. package/dist/static-handler.gen.js.map +0 -1
  942. package/dist/static-handler.js +0 -29
  943. package/dist/static-handler.js.map +0 -1
  944. package/dist/theme/ThemeProvider.d.ts +0 -20
  945. package/dist/theme/ThemeProvider.d.ts.map +0 -1
  946. package/dist/theme/ThemeProvider.js +0 -240
  947. package/dist/theme/ThemeProvider.js.map +0 -1
  948. package/dist/theme/ThemeScript.d.ts +0 -48
  949. package/dist/theme/ThemeScript.d.ts.map +0 -1
  950. package/dist/theme/ThemeScript.js +0 -13
  951. package/dist/theme/ThemeScript.js.map +0 -1
  952. package/dist/theme/__tests__/theme.test.d.ts +0 -2
  953. package/dist/theme/__tests__/theme.test.d.ts.map +0 -1
  954. package/dist/theme/__tests__/theme.test.js +0 -103
  955. package/dist/theme/__tests__/theme.test.js.map +0 -1
  956. package/dist/theme/constants.d.ts +0 -29
  957. package/dist/theme/constants.d.ts.map +0 -1
  958. package/dist/theme/constants.js +0 -48
  959. package/dist/theme/constants.js.map +0 -1
  960. package/dist/theme/index.d.ts +0 -31
  961. package/dist/theme/index.d.ts.map +0 -1
  962. package/dist/theme/index.js +0 -36
  963. package/dist/theme/index.js.map +0 -1
  964. package/dist/theme/theme-context.d.ts +0 -40
  965. package/dist/theme/theme-context.d.ts.map +0 -1
  966. package/dist/theme/theme-context.js +0 -60
  967. package/dist/theme/theme-context.js.map +0 -1
  968. package/dist/theme/theme-script.d.ts +0 -27
  969. package/dist/theme/theme-script.d.ts.map +0 -1
  970. package/dist/theme/theme-script.js +0 -147
  971. package/dist/theme/theme-script.js.map +0 -1
  972. package/dist/theme/types.d.ts +0 -163
  973. package/dist/theme/types.d.ts.map +0 -1
  974. package/dist/theme/types.js +0 -11
  975. package/dist/theme/types.js.map +0 -1
  976. package/dist/theme/use-theme.d.ts +0 -12
  977. package/dist/theme/use-theme.d.ts.map +0 -1
  978. package/dist/theme/use-theme.js +0 -40
  979. package/dist/theme/use-theme.js.map +0 -1
  980. package/dist/types.d.ts +0 -1479
  981. package/dist/types.d.ts.map +0 -1
  982. package/dist/types.js +0 -10
  983. package/dist/types.js.map +0 -1
  984. package/dist/urls.d.ts +0 -441
  985. package/dist/urls.d.ts.map +0 -1
  986. package/dist/urls.gen.d.ts +0 -8
  987. package/dist/urls.gen.d.ts.map +0 -1
  988. package/dist/urls.gen.js +0 -8
  989. package/dist/urls.gen.js.map +0 -1
  990. package/dist/urls.js +0 -443
  991. package/dist/urls.js.map +0 -1
  992. package/dist/use-loader.d.ts +0 -127
  993. package/dist/use-loader.d.ts.map +0 -1
  994. package/dist/use-loader.js +0 -237
  995. package/dist/use-loader.js.map +0 -1
  996. package/dist/vite/__tests__/ast-handler-extract.test.d.ts +0 -2
  997. package/dist/vite/__tests__/ast-handler-extract.test.d.ts.map +0 -1
  998. package/dist/vite/__tests__/ast-handler-extract.test.js +0 -294
  999. package/dist/vite/__tests__/ast-handler-extract.test.js.map +0 -1
  1000. package/dist/vite/__tests__/expose-id-utils.test.d.ts +0 -2
  1001. package/dist/vite/__tests__/expose-id-utils.test.d.ts.map +0 -1
  1002. package/dist/vite/__tests__/expose-id-utils.test.js +0 -224
  1003. package/dist/vite/__tests__/expose-id-utils.test.js.map +0 -1
  1004. package/dist/vite/__tests__/expose-internal-ids.test.d.ts +0 -2
  1005. package/dist/vite/__tests__/expose-internal-ids.test.d.ts.map +0 -1
  1006. package/dist/vite/__tests__/expose-internal-ids.test.js +0 -647
  1007. package/dist/vite/__tests__/expose-internal-ids.test.js.map +0 -1
  1008. package/dist/vite/__tests__/expose-router-id.test.d.ts +0 -2
  1009. package/dist/vite/__tests__/expose-router-id.test.d.ts.map +0 -1
  1010. package/dist/vite/__tests__/expose-router-id.test.js +0 -39
  1011. package/dist/vite/__tests__/expose-router-id.test.js.map +0 -1
  1012. package/dist/vite/ast-handler-extract.d.ts +0 -49
  1013. package/dist/vite/ast-handler-extract.d.ts.map +0 -1
  1014. package/dist/vite/ast-handler-extract.js +0 -249
  1015. package/dist/vite/ast-handler-extract.js.map +0 -1
  1016. package/dist/vite/expose-action-id.d.ts +0 -19
  1017. package/dist/vite/expose-action-id.d.ts.map +0 -1
  1018. package/dist/vite/expose-action-id.js +0 -250
  1019. package/dist/vite/expose-action-id.js.map +0 -1
  1020. package/dist/vite/expose-id-utils.d.ts +0 -69
  1021. package/dist/vite/expose-id-utils.d.ts.map +0 -1
  1022. package/dist/vite/expose-id-utils.js +0 -289
  1023. package/dist/vite/expose-id-utils.js.map +0 -1
  1024. package/dist/vite/expose-internal-ids.d.ts +0 -22
  1025. package/dist/vite/expose-internal-ids.d.ts.map +0 -1
  1026. package/dist/vite/expose-internal-ids.js +0 -886
  1027. package/dist/vite/expose-internal-ids.js.map +0 -1
  1028. package/dist/vite/index.d.ts +0 -149
  1029. package/dist/vite/index.d.ts.map +0 -1
  1030. package/dist/vite/index.js.bak +0 -5448
  1031. package/dist/vite/index.js.map +0 -1
  1032. package/dist/vite/index.named-routes.gen.ts +0 -103
  1033. package/dist/vite/package-resolution.d.ts +0 -43
  1034. package/dist/vite/package-resolution.d.ts.map +0 -1
  1035. package/dist/vite/package-resolution.js +0 -112
  1036. package/dist/vite/package-resolution.js.map +0 -1
  1037. package/dist/vite/virtual-entries.d.ts +0 -25
  1038. package/dist/vite/virtual-entries.d.ts.map +0 -1
  1039. package/dist/vite/virtual-entries.js +0 -110
  1040. package/dist/vite/virtual-entries.js.map +0 -1
  1041. package/src/browser/action-response-classifier.ts +0 -99
@@ -9,6 +9,7 @@
9
9
  import type { CacheDefaults, SegmentCacheStore } from "./types.js";
10
10
  import { _getRequestContext } from "../server/request-context.js";
11
11
  import type { RequestContext } from "../server/request-context.js";
12
+ import { normalizeTags } from "./cache-tag.js";
12
13
 
13
14
  /**
14
15
  * Default TTL for route-level cache() DSL and loader cache.
@@ -108,6 +109,64 @@ export async function resolveCacheKey(
108
109
  return defaultKey;
109
110
  }
110
111
 
112
+ // ============================================================================
113
+ // Cache Tag Resolution
114
+ // ============================================================================
115
+
116
+ /**
117
+ * Resolve cache tags from a tags option (static array or function of ctx).
118
+ *
119
+ * Fails open: a thrown tag callback falls back to no tags rather than
120
+ * aborting the request. Tags are additive metadata (not identity), so a
121
+ * missing tag does not cause cache collisions, only a missed invalidation.
122
+ *
123
+ * Shared by the cache() DSL (cache-scope) and loader caching (loader-cache)
124
+ * so tag resolution behaves identically across every cache axis.
125
+ */
126
+ export function resolveTagsOption<TEnv>(
127
+ tags: string[] | ((ctx: RequestContext<TEnv>) => string[]) | undefined,
128
+ ctx: RequestContext<TEnv> | undefined,
129
+ label: string,
130
+ ): string[] | undefined {
131
+ if (!tags) return undefined;
132
+ if (typeof tags === "function") {
133
+ if (!ctx) {
134
+ // A dynamic tags function needs the request context to run. Without it
135
+ // (e.g. resolved outside a request, at build/prerender time) the entry is
136
+ // cached UNTAGGED and can never be invalidated - surface that rather than
137
+ // silently dropping the tags, matching the thrown-callback branch below.
138
+ console.warn(
139
+ `[${label}] Dynamic tags function present but no request context; ` +
140
+ `caching without tags (this entry will not be tag-invalidatable).`,
141
+ );
142
+ return undefined;
143
+ }
144
+ try {
145
+ return normalizeTagList(tags(ctx));
146
+ } catch (error) {
147
+ console.error(
148
+ `[${label}] Tags function failed, caching without tags:`,
149
+ error,
150
+ );
151
+ return undefined;
152
+ }
153
+ }
154
+ return normalizeTagList(tags);
155
+ }
156
+
157
+ /**
158
+ * Normalize a resolved tags array so the WRITE path matches the invalidate path:
159
+ * updateTag()/revalidateTag()/cacheTag() all drop empty/whitespace-only tags via
160
+ * normalizeTag(). Without this, an empty tag attached at write time would enter
161
+ * the store index but could never be invalidated (the verbs normalize it away),
162
+ * and on CFCacheStore would also cost a wasted KV marker read per request.
163
+ * Returns undefined when nothing usable remains, keeping the entry header-free.
164
+ */
165
+ function normalizeTagList(tags: string[]): string[] | undefined {
166
+ const out = normalizeTags(tags);
167
+ return out.length > 0 ? out : undefined;
168
+ }
169
+
111
170
  // ============================================================================
112
171
  // Cache Store Resolution
113
172
  // ============================================================================
@@ -120,6 +179,41 @@ export async function resolveCacheKey(
120
179
  export function resolveCacheStore(
121
180
  explicitStore: SegmentCacheStore | undefined,
122
181
  ): SegmentCacheStore | null {
123
- if (explicitStore) return explicitStore;
182
+ if (explicitStore) {
183
+ // Register explicit per-scope stores so updateTag()/revalidateTag() can
184
+ // reach them. This is the single chokepoint every cache axis (segment,
185
+ // response, loader) resolves through, so registering here covers them all
186
+ // eagerly - no dependence on whether a tagged write has happened yet. The
187
+ // app-level store is intentionally not registered (always reachable via
188
+ // ctx._cacheStore).
189
+ registerExplicitTaggedStore(explicitStore);
190
+ return explicitStore;
191
+ }
124
192
  return _getRequestContext()?._cacheStore ?? null;
125
193
  }
194
+
195
+ /**
196
+ * Upper bound on the per-handler explicit-store registry. A module-singleton
197
+ * store (the recommended pattern) dedupes to a single entry and never approaches
198
+ * this. The cap bounds the niche case of an explicit store constructed PER
199
+ * request/boundary (e.g. a ctx-bound CFCacheStore, which must take a per-request
200
+ * ctx): without it the registry - which intentionally persists across requests so
201
+ * a server action's updateTag() can reach stores a prior render registered -
202
+ * would accumulate one dead instance per request and fan invalidation out to
203
+ * finished execution contexts. LRU-touch on re-resolution keeps a live, re-used
204
+ * store from being evicted by that churn.
205
+ */
206
+ const EXPLICIT_STORE_REGISTRY_CAP = 64;
207
+
208
+ function registerExplicitTaggedStore(store: SegmentCacheStore): void {
209
+ const set = _getRequestContext()?._explicitTaggedStores;
210
+ if (!set) return;
211
+ // LRU touch: move an already-present store to the most-recent position (Set
212
+ // preserves insertion order) so a store re-resolved every request stays live.
213
+ set.delete(store);
214
+ set.add(store);
215
+ if (set.size > EXPLICIT_STORE_REGISTRY_CAP) {
216
+ const oldest = set.values().next().value;
217
+ if (oldest !== undefined) set.delete(oldest);
218
+ }
219
+ }
@@ -36,6 +36,12 @@ import { restoreHandles } from "./handle-snapshot.js";
36
36
  import { startHandleCapture, type HandleCapture } from "./handle-capture.js";
37
37
  import { sortedSearchString } from "./cache-key-utils.js";
38
38
  import { runBackground } from "./background-task.js";
39
+ import {
40
+ normalizeTags,
41
+ recordRequestTags,
42
+ runWithCacheTagScope,
43
+ } from "./cache-tag.js";
44
+ import { reportCacheError } from "./cache-error.js";
39
45
 
40
46
  /**
41
47
  * Convert encodeReply result to a stable string key.
@@ -70,9 +76,17 @@ export function registerCachedFunction<T extends (...args: any[]) => any>(
70
76
  const store = requestCtx?._cacheStore;
71
77
  const resolvedProfileName = profileName || "default";
72
78
 
73
- // Bypass: no store or no getItem support
79
+ // Bypass: no store or no getItem support. Still run inside a tag scope so a
80
+ // cacheTag() call inside the function degrades to a no-op rather than
81
+ // throwing "must be called inside a use cache function" - adopting cacheTag()
82
+ // must not hard-fail in apps/tests without an item-capable cache configured.
74
83
  if (!store?.getItem) {
75
- return fn.apply(this, args);
84
+ const scoped = runWithCacheTagScope(() => fn.apply(this, args));
85
+ const result = await scoped.result;
86
+ // Still record the runtime tags into the request set so a cacheTag() in an
87
+ // uncached function tags the document, even with no item-capable store.
88
+ recordRequestTags(scoped.tags, requestCtx);
89
+ return result;
76
90
  }
77
91
 
78
92
  // Resolve profile strictly from request-scoped config (set by the
@@ -155,8 +169,13 @@ export function registerCachedFunction<T extends (...args: any[]) => any>(
155
169
  cacheKey = `use-cache:${id}`;
156
170
  }
157
171
  } catch {
158
- // Non-serializable args: run uncached
159
- return fn.apply(this, args);
172
+ // Non-serializable args: run uncached (within a tag scope so cacheTag()
173
+ // still does not throw). Record runtime tags so the document union still
174
+ // sees them even though this call is not itself cached.
175
+ const scoped = runWithCacheTagScope(() => fn.apply(this, args));
176
+ const result = await scoped.result;
177
+ recordRequestTags(scoped.tags, requestCtx);
178
+ return result;
160
179
  }
161
180
 
162
181
  // Cache lookup
@@ -173,9 +192,20 @@ export function registerCachedFunction<T extends (...args: any[]) => any>(
173
192
  restoreHandles(cached.handles, handleStore);
174
193
  }
175
194
  }
195
+ // Surface the hit's tags to the request set so a document built from a
196
+ // cached item is still tagged (the function did not re-run, so its
197
+ // runtime cacheTag() tags are only available from the stored entry).
198
+ recordRequestTags(cached.tags, requestCtx);
176
199
  return result;
177
- } catch {
178
- // Deserialization failed, fall through to fresh execution
200
+ } catch (error) {
201
+ // The stored value is corrupt/partial (failed RSC deserialize). Report
202
+ // it, then fall through to fresh execution - the miss path below re-runs
203
+ // and setItem() overwrites the faulty entry under the same key (self-heal).
204
+ reportCacheError(
205
+ error,
206
+ "cache-corrupt",
207
+ `[use cache] "${id}" fresh-hit`,
208
+ );
179
209
  }
180
210
  }
181
211
 
@@ -189,6 +219,8 @@ export function registerCachedFunction<T extends (...args: any[]) => any>(
189
219
  restoreHandles(cached.handles, handleStore);
190
220
  }
191
221
  }
222
+ // Tag the request with the stale entry's tags (see fresh-hit note).
223
+ recordRequestTags(cached.tags, requestCtx);
192
224
  // Background revalidation — must capture handles if tainted args present.
193
225
  // Use an isolated handle store so background pushes don't pollute the
194
226
  // live response or throw LateHandlePushError on the completed store.
@@ -238,20 +270,38 @@ export function registerCachedFunction<T extends (...args: any[]) => any>(
238
270
  }
239
271
 
240
272
  try {
241
- const freshResult = await fn.apply(this, args);
273
+ const scoped = runWithCacheTagScope(() => fn.apply(this, args));
274
+ const freshResult = await scoped.result;
242
275
  bgStopCapture?.();
276
+ // Merge profile/DSL tags with runtime cacheTag() tags, read after
277
+ // awaiting so post-await cacheTag() calls are included. Normalize
278
+ // (drops empty profile tags, matching the invalidate path) + dedupe.
279
+ const freshTags = [
280
+ ...new Set(
281
+ normalizeTags([...(profile.tags ?? []), ...scoped.tags]),
282
+ ),
283
+ ];
284
+ recordRequestTags(freshTags, requestCtx);
243
285
  const serialized = await serializeResult(freshResult);
244
286
  if (serialized !== null) {
245
287
  await store.setItem!(cacheKey, serialized, {
246
288
  handles: bgCapture?.data,
247
289
  ttl: profile.ttl,
248
290
  swr: profile.swr,
249
- tags: profile.tags,
291
+ tags: freshTags.length > 0 ? freshTags : undefined,
250
292
  });
251
293
  }
252
294
  } catch (bgError) {
253
295
  bgStopCapture?.();
254
- requestCtx?._reportBackgroundError?.(bgError, "stale-revalidation");
296
+ // Pass requestCtx explicitly: this runs in a detached background
297
+ // task where the ALS context is gone, so onError can only fire if
298
+ // we hand it the context captured up front.
299
+ reportCacheError(
300
+ bgError,
301
+ "stale-revalidation",
302
+ "[use cache] background revalidation failed",
303
+ requestCtx,
304
+ );
255
305
  } finally {
256
306
  for (const arg of bgTaintedArgs) {
257
307
  unstampCacheExec(arg as object);
@@ -263,8 +313,14 @@ export function registerCachedFunction<T extends (...args: any[]) => any>(
263
313
  }
264
314
  });
265
315
  return result;
266
- } catch {
267
- // Deserialization of stale value failed, fall through
316
+ } catch (error) {
317
+ // Stale value is corrupt/partial; report and fall through to a fresh
318
+ // execution, which overwrites the faulty entry under the same key.
319
+ reportCacheError(
320
+ error,
321
+ "cache-corrupt",
322
+ `[use cache] "${id}" stale-hit`,
323
+ );
268
324
  }
269
325
  }
270
326
 
@@ -297,8 +353,10 @@ export function registerCachedFunction<T extends (...args: any[]) => any>(
297
353
  }
298
354
 
299
355
  let result: any;
356
+ let scoped: ReturnType<typeof runWithCacheTagScope>;
300
357
  try {
301
- result = await fn.apply(this, args);
358
+ scoped = runWithCacheTagScope(() => fn.apply(this, args));
359
+ result = await scoped.result;
302
360
  } finally {
303
361
  // Decrement ref count; symbol is deleted when it reaches zero
304
362
  for (const arg of taintedArgs) {
@@ -311,6 +369,14 @@ export function registerCachedFunction<T extends (...args: any[]) => any>(
311
369
  stopCapture?.();
312
370
  }
313
371
 
372
+ // Merge profile/DSL tags with runtime cacheTag() tags. Read scoped.tags
373
+ // after awaiting result so post-await cacheTag() calls are included.
374
+ // Normalize (drops empty profile tags, matching the invalidate path) + dedupe.
375
+ const allTags = [
376
+ ...new Set(normalizeTags([...(profile.tags ?? []), ...scoped!.tags])),
377
+ ];
378
+ recordRequestTags(allTags, requestCtx);
379
+
314
380
  // Serialize and store — fully non-blocking when waitUntil is available.
315
381
  // The response does not need to wait for serialization or the store write.
316
382
  const cacheWrite = async () => {
@@ -321,7 +387,7 @@ export function registerCachedFunction<T extends (...args: any[]) => any>(
321
387
  handles: capture?.data,
322
388
  ttl: profile.ttl,
323
389
  swr: profile.swr,
324
- tags: profile.tags,
390
+ tags: allTags.length > 0 ? allTags : undefined,
325
391
  });
326
392
  }
327
393
  } catch (writeError) {
@@ -16,6 +16,8 @@ import {
16
16
  getRequestContext,
17
17
  _getRequestContext,
18
18
  } from "../server/request-context.js";
19
+ import { recordRequestTags } from "./cache-tag.js";
20
+ import { reportCacheError } from "./cache-error.js";
19
21
  import { serializeSegments, deserializeSegments } from "./segment-codec.js";
20
22
  import { captureHandles, restoreHandles } from "./handle-snapshot.js";
21
23
  import { sortedSearchString, sortedRouteParams } from "./cache-key-utils.js";
@@ -23,7 +25,23 @@ import {
23
25
  DEFAULT_ROUTE_TTL,
24
26
  resolveCacheKey,
25
27
  resolveCacheStore,
28
+ resolveTagsOption,
26
29
  } from "./cache-policy.js";
30
+ import type { RequestContext } from "../server/request-context.js";
31
+
32
+ /**
33
+ * Resolve tags for a cache() boundary from its config (static array or
34
+ * function of ctx). Thin wrapper over the shared resolveTagsOption so the
35
+ * cache() DSL and loader caching resolve tags identically.
36
+ * @internal
37
+ */
38
+ export function resolveCacheTags(
39
+ config: PartialCacheOptions | false,
40
+ ctx: RequestContext | undefined,
41
+ ): string[] | undefined {
42
+ if (config === false) return undefined;
43
+ return resolveTagsOption(config.tags, ctx, "CacheScope");
44
+ }
27
45
 
28
46
  function debugCacheLog(message: string): void {
29
47
  if (INTERNAL_RANGO_DEBUG) {
@@ -187,6 +205,32 @@ export class CacheScope {
187
205
  return resolveCacheKey(keyFn, this.getStore(), defaultKey, "CacheScope");
188
206
  }
189
207
 
208
+ /**
209
+ * Evaluate the cache `condition` predicate. Returns false (skip the cache
210
+ * operation) when the predicate returns false or throws; returns true when
211
+ * there is no condition or no request context to evaluate it against.
212
+ */
213
+ private conditionAllows(op: "read" | "write"): boolean {
214
+ if (this.config === false || !this.config.condition) return true;
215
+ const requestCtx = getRequestContext();
216
+ if (!requestCtx) return true;
217
+ try {
218
+ if (!this.config.condition(requestCtx)) {
219
+ debugCacheLog(
220
+ `[CacheScope] condition returned false, skipping cache ${op}`,
221
+ );
222
+ return false;
223
+ }
224
+ return true;
225
+ } catch (error) {
226
+ console.error(
227
+ `[CacheScope] condition function threw, skipping cache ${op}:`,
228
+ error,
229
+ );
230
+ return false;
231
+ }
232
+ }
233
+
190
234
  /**
191
235
  * Lookup cached segments for a route (single cache entry per request).
192
236
  * Returns { segments, shouldRevalidate } or null if cache miss.
@@ -204,27 +248,7 @@ export class CacheScope {
204
248
  shouldRevalidate: boolean;
205
249
  } | null> {
206
250
  if (!this.enabled) return null;
207
-
208
- // Evaluate condition — skip cache read when condition returns false
209
- if (this.config !== false && this.config.condition) {
210
- const requestCtx = getRequestContext();
211
- if (requestCtx) {
212
- try {
213
- if (!this.config.condition(requestCtx)) {
214
- debugCacheLog(
215
- `[CacheScope] condition returned false, skipping cache read`,
216
- );
217
- return null;
218
- }
219
- } catch (error) {
220
- console.error(
221
- `[CacheScope] condition function threw, skipping cache read:`,
222
- error,
223
- );
224
- return null;
225
- }
226
- }
227
- }
251
+ if (!this.conditionAllows("read")) return null;
228
252
 
229
253
  const store = this.getStore();
230
254
  if (!store) return null;
@@ -242,8 +266,26 @@ export class CacheScope {
242
266
 
243
267
  const { data: cached, shouldRevalidate } = result;
244
268
 
245
- // Deserialize segments
246
- const segments = await deserializeSegments(cached.segments);
269
+ // Deserialize segments. A failure means the cached segments are corrupt/
270
+ // partial: evict the entry (self-heal - the re-render re-caches under the
271
+ // same key) and report it as corruption, distinct from a transient infra
272
+ // error (handled by the outer catch).
273
+ let segments: ResolvedSegment[];
274
+ try {
275
+ segments = await deserializeSegments(cached.segments);
276
+ } catch (error) {
277
+ reportCacheError(
278
+ error,
279
+ "cache-corrupt",
280
+ `[CacheScope] ${key}: corrupt cached segments, evicting`,
281
+ );
282
+ await store
283
+ .delete(key)
284
+ .catch((e) =>
285
+ reportCacheError(e, "cache-delete", `[CacheScope] ${key}: evict`),
286
+ );
287
+ return null;
288
+ }
247
289
 
248
290
  // Replay handle data
249
291
  const handleStore = _getRequestContext()?._handleStore;
@@ -262,7 +304,7 @@ export class CacheScope {
262
304
 
263
305
  return { segments, shouldRevalidate };
264
306
  } catch (error) {
265
- console.error(`[CacheScope] Failed to lookup ${key}:`, error);
307
+ reportCacheError(error, "cache-read", `[CacheScope] lookup ${key}`);
266
308
  return null;
267
309
  }
268
310
  }
@@ -284,27 +326,7 @@ export class CacheScope {
284
326
  isIntercept?: boolean,
285
327
  ): Promise<void> {
286
328
  if (!this.enabled || segments.length === 0) return;
287
-
288
- // Evaluate condition — skip cache write when condition returns false
289
- if (this.config !== false && this.config.condition) {
290
- const conditionCtx = getRequestContext();
291
- if (conditionCtx) {
292
- try {
293
- if (!this.config.condition(conditionCtx)) {
294
- debugCacheLog(
295
- `[CacheScope] condition returned false, skipping cache write`,
296
- );
297
- return;
298
- }
299
- } catch (error) {
300
- console.error(
301
- `[CacheScope] condition function threw, skipping cache write:`,
302
- error,
303
- );
304
- return;
305
- }
306
- }
307
- }
329
+ if (!this.conditionAllows("write")) return;
308
330
 
309
331
  const store = this.getStore();
310
332
  if (!store) return;
@@ -325,6 +347,10 @@ export class CacheScope {
325
347
  // Resolve cache key early (while request context is available)
326
348
  const key = await this.resolveKey(pathname, params, isIntercept);
327
349
 
350
+ // Resolve tags early (while request context is available, before waitUntil)
351
+ const tags = resolveCacheTags(this.config, requestCtx);
352
+ recordRequestTags(tags, requestCtx);
353
+
328
354
  // Check if this is a partial request (navigation) vs document request
329
355
  const isPartial = requestCtx.originalUrl.searchParams.has("_rsc_partial");
330
356
 
@@ -388,6 +414,7 @@ export class CacheScope {
388
414
  segments: serializedSegments,
389
415
  handles,
390
416
  expiresAt: Date.now() + ttl * 1000,
417
+ tags,
391
418
  };
392
419
 
393
420
  if (INTERNAL_RANGO_DEBUG) {
@@ -405,7 +432,11 @@ export class CacheScope {
405
432
  );
406
433
  }
407
434
  } catch (error) {
408
- console.error(`[CacheScope] Failed to cache ${key}:`, error);
435
+ reportCacheError(
436
+ error,
437
+ "cache-write",
438
+ `[CacheScope] Failed to cache ${key}`,
439
+ );
409
440
  }
410
441
  });
411
442
  }
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Cache Tag API
3
+ *
4
+ * Provides cacheTag() for tagging cached entries at runtime inside "use cache"
5
+ * functions. Tags are scoped via AsyncLocalStorage; calling cacheTag() outside
6
+ * a "use cache" execution throws.
7
+ *
8
+ * The runtime (cache-runtime.ts) wraps "use cache" execution in
9
+ * runWithCacheTagScope(), collects the runtime tags, and merges them with the
10
+ * profile/DSL tags before storing.
11
+ */
12
+
13
+ import { AsyncLocalStorage } from "node:async_hooks";
14
+ import {
15
+ _getRequestContext,
16
+ type RequestContext,
17
+ } from "../server/request-context.js";
18
+
19
+ const cacheTagStorage = new AsyncLocalStorage<Set<string>>();
20
+
21
+ /**
22
+ * Normalize a tag for storage.
23
+ *
24
+ * Returns the tag unchanged if usable, or null if it is empty/whitespace-only
25
+ * (dropped consistently in every environment - an empty tag matches nothing).
26
+ *
27
+ * Backend-specific constraints are intentionally NOT enforced here so the tag
28
+ * primitive stays backend-agnostic. In particular, the CFCacheStore
29
+ * encodeURIComponent's tags at serialization time so commas/spaces/non-Latin1
30
+ * characters cannot corrupt the comma-delimited Cloudflare Cache-Tag header or
31
+ * the HTTP marker header (it does not reject them). Keep tags short and
32
+ * low-cardinality: a tag's KV marker key must stay under Cloudflare's 512-byte
33
+ * limit, and a Cache-Tag value under 1024 bytes. The in-memory store has no
34
+ * such limitations.
35
+ *
36
+ * @internal
37
+ */
38
+ export function normalizeTag(tag: string): string | null {
39
+ if (!tag || !tag.trim()) return null;
40
+ return tag;
41
+ }
42
+
43
+ /**
44
+ * Normalize a tag collection: drop empty/whitespace-only tags so the WRITE path
45
+ * matches the invalidate path (updateTag/revalidateTag/cacheTag all normalize).
46
+ * Does not deduplicate - callers that need that wrap with a Set.
47
+ *
48
+ * @internal
49
+ */
50
+ export function normalizeTags(tags: Iterable<string>): string[] {
51
+ const out: string[] = [];
52
+ for (const tag of tags) {
53
+ const normalized = normalizeTag(tag);
54
+ if (normalized !== null) out.push(normalized);
55
+ }
56
+ return out;
57
+ }
58
+
59
+ /**
60
+ * Tag the current "use cache" entry for later invalidation via
61
+ * updateTag() / revalidateTag().
62
+ *
63
+ * Must be called inside a function marked with "use cache".
64
+ * Tags are additive - multiple calls accumulate.
65
+ *
66
+ * @example
67
+ * ```typescript
68
+ * async function getProduct(ctx) {
69
+ * "use cache";
70
+ * cacheTag(`product:${ctx.params.id}`, "products");
71
+ * return db.getProduct(ctx.params.id);
72
+ * }
73
+ * ```
74
+ */
75
+ export function cacheTag(...tags: string[]): void {
76
+ const store = cacheTagStorage.getStore();
77
+ if (!store) {
78
+ throw new Error('cacheTag() must be called inside a "use cache" function.');
79
+ }
80
+ for (const tag of tags) {
81
+ const normalized = normalizeTag(tag);
82
+ if (normalized === null) {
83
+ if (process.env.NODE_ENV !== "production") {
84
+ console.warn(`[cacheTag] Ignoring empty or whitespace-only tag.`);
85
+ }
86
+ continue;
87
+ }
88
+ store.add(normalized);
89
+ }
90
+ }
91
+
92
+ /**
93
+ * Record `tags` into the request-scoped tag set (ctx._requestTags), the union of
94
+ * every cache tag resolved while producing the response. The document cache reads
95
+ * this after the render settles so a full-page entry is tagged with everything its
96
+ * content used, making it invalidatable by updateTag()/revalidateTag().
97
+ *
98
+ * Called at the tag-resolution sites: "use cache" stores (cache-runtime, both the
99
+ * miss and read/hit paths), loader cache (cache-policy/loader-cache), and segment
100
+ * cache() (cache-scope). Writes the field directly (not via ctx.set()) so it does
101
+ * not trip the cache-scope side-effect guard, mirroring cacheTag() itself.
102
+ *
103
+ * @internal
104
+ */
105
+ export function recordRequestTags(
106
+ tags: Iterable<string> | undefined,
107
+ ctx: RequestContext | undefined = _getRequestContext(),
108
+ ): void {
109
+ if (!tags) return;
110
+ const set = ctx?._requestTags;
111
+ if (!set) return;
112
+ for (const tag of tags) {
113
+ const normalized = normalizeTag(tag);
114
+ if (normalized !== null) set.add(normalized);
115
+ }
116
+ }
117
+
118
+ /**
119
+ * Run a function within a cache tag scope. Any cacheTag() calls inside `fn`
120
+ * accumulate into the returned Set.
121
+ *
122
+ * The returned Set is the LIVE reference - the caller must await `result`
123
+ * before reading `tags`, because an async cached function may call cacheTag()
124
+ * after an await boundary.
125
+ *
126
+ * @internal Used by cache-runtime.ts to wrap "use cache" execution.
127
+ */
128
+ export function runWithCacheTagScope<T>(fn: () => T): {
129
+ result: T;
130
+ tags: Set<string>;
131
+ } {
132
+ const tagSet = new Set<string>();
133
+ const result = cacheTagStorage.run(tagSet, fn);
134
+ return { result, tags: tagSet };
135
+ }