@rangojs/router 0.4.3 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (420) hide show
  1. package/dist/types/browser/prefetch/cache.d.ts +31 -2
  2. package/dist/types/cache/cf/cf-cache-store.d.ts +2 -0
  3. package/dist/types/cache/types.d.ts +39 -6
  4. package/dist/types/route-definition/helpers-types.d.ts +5 -4
  5. package/dist/types/rsc/capture-queue.d.ts +19 -3
  6. package/dist/types/rsc/shell-build-manifest.d.ts +2 -2
  7. package/dist/types/rsc/shell-capture.d.ts +22 -2
  8. package/dist/types/rsc/shell-serve.d.ts +18 -12
  9. package/dist/types/static-handler.d.ts +15 -1
  10. package/dist/types/urls/path-helper-types.d.ts +6 -7
  11. package/dist/types.backup/__internal.d.ts +127 -0
  12. package/dist/types.backup/bin/rango.d.ts +1 -0
  13. package/dist/types.backup/browser/action-coordinator.d.ts +57 -0
  14. package/dist/types.backup/browser/action-fence.d.ts +33 -0
  15. package/dist/types.backup/browser/app-shell.d.ts +34 -0
  16. package/dist/types.backup/browser/app-version.d.ts +6 -0
  17. package/dist/types.backup/browser/connection-warmup.d.ts +31 -0
  18. package/dist/types.backup/browser/cookie-name.d.ts +66 -0
  19. package/dist/types.backup/browser/event-controller.d.ts +221 -0
  20. package/dist/types.backup/browser/history-state.d.ts +26 -0
  21. package/dist/types.backup/browser/index.d.ts +1 -0
  22. package/dist/types.backup/browser/intercept-utils.d.ts +30 -0
  23. package/dist/types.backup/browser/invalidate-client-cache.d.ts +17 -0
  24. package/dist/types.backup/browser/link-interceptor.d.ts +43 -0
  25. package/dist/types.backup/browser/logging.d.ts +33 -0
  26. package/dist/types.backup/browser/merge-segment-loaders.d.ts +38 -0
  27. package/dist/types.backup/browser/navigation-bridge.d.ts +27 -0
  28. package/dist/types.backup/browser/navigation-client.d.ts +17 -0
  29. package/dist/types.backup/browser/navigation-store-handle.d.ts +25 -0
  30. package/dist/types.backup/browser/navigation-store.d.ts +95 -0
  31. package/dist/types.backup/browser/navigation-transaction.d.ts +75 -0
  32. package/dist/types.backup/browser/network-error-handler.d.ts +35 -0
  33. package/dist/types.backup/browser/partial-update.d.ts +61 -0
  34. package/dist/types.backup/browser/prefetch/cache.d.ts +183 -0
  35. package/dist/types.backup/browser/prefetch/fetch.d.ts +52 -0
  36. package/dist/types.backup/browser/prefetch/observer.d.ts +27 -0
  37. package/dist/types.backup/browser/prefetch/policy.d.ts +13 -0
  38. package/dist/types.backup/browser/prefetch/queue.d.ts +48 -0
  39. package/dist/types.backup/browser/prefetch/resource-ready.d.ts +28 -0
  40. package/dist/types.backup/browser/rango-state.d.ts +52 -0
  41. package/dist/types.backup/browser/react/Link.d.ts +140 -0
  42. package/dist/types.backup/browser/react/NavigationProvider.d.ts +88 -0
  43. package/dist/types.backup/browser/react/ScrollRestoration.d.ts +78 -0
  44. package/dist/types.backup/browser/react/context.d.ts +54 -0
  45. package/dist/types.backup/browser/react/filter-segment-order.d.ts +35 -0
  46. package/dist/types.backup/browser/react/index.d.ts +1 -0
  47. package/dist/types.backup/browser/react/location-state-shared.d.ts +162 -0
  48. package/dist/types.backup/browser/react/location-state.d.ts +29 -0
  49. package/dist/types.backup/browser/react/mount-context.d.ts +23 -0
  50. package/dist/types.backup/browser/react/nonce-context.d.ts +14 -0
  51. package/dist/types.backup/browser/react/shallow-equal.d.ts +5 -0
  52. package/dist/types.backup/browser/react/use-action.d.ts +61 -0
  53. package/dist/types.backup/browser/react/use-handle.d.ts +21 -0
  54. package/dist/types.backup/browser/react/use-href.d.ts +32 -0
  55. package/dist/types.backup/browser/react/use-link-status.d.ts +36 -0
  56. package/dist/types.backup/browser/react/use-mount.d.ts +24 -0
  57. package/dist/types.backup/browser/react/use-navigation.d.ts +15 -0
  58. package/dist/types.backup/browser/react/use-params.d.ts +21 -0
  59. package/dist/types.backup/browser/react/use-pathname.d.ts +13 -0
  60. package/dist/types.backup/browser/react/use-reverse.d.ts +40 -0
  61. package/dist/types.backup/browser/react/use-router.d.ts +23 -0
  62. package/dist/types.backup/browser/react/use-search-params.d.ts +19 -0
  63. package/dist/types.backup/browser/react/use-segments.d.ts +29 -0
  64. package/dist/types.backup/browser/response-adapter.d.ts +58 -0
  65. package/dist/types.backup/browser/rsc-router.d.ts +141 -0
  66. package/dist/types.backup/browser/scroll-restoration.d.ts +103 -0
  67. package/dist/types.backup/browser/segment-reconciler.d.ts +74 -0
  68. package/dist/types.backup/browser/segment-structure-assert.d.ts +16 -0
  69. package/dist/types.backup/browser/server-action-bridge.d.ts +29 -0
  70. package/dist/types.backup/browser/types.d.ts +530 -0
  71. package/dist/types.backup/browser/validate-redirect-origin.d.ts +28 -0
  72. package/dist/types.backup/build/collect-fallback-refs.d.ts +5 -0
  73. package/dist/types.backup/build/generate-manifest.d.ts +100 -0
  74. package/dist/types.backup/build/generate-route-types.d.ts +8 -0
  75. package/dist/types.backup/build/index.d.ts +21 -0
  76. package/dist/types.backup/build/prefix-tree-utils.d.ts +56 -0
  77. package/dist/types.backup/build/route-trie.d.ts +89 -0
  78. package/dist/types.backup/build/route-types/ast-helpers.d.ts +3 -0
  79. package/dist/types.backup/build/route-types/ast-route-extraction.d.ts +13 -0
  80. package/dist/types.backup/build/route-types/codegen.d.ts +16 -0
  81. package/dist/types.backup/build/route-types/include-resolution.d.ts +74 -0
  82. package/dist/types.backup/build/route-types/param-extraction.d.ts +13 -0
  83. package/dist/types.backup/build/route-types/per-module-writer.d.ts +18 -0
  84. package/dist/types.backup/build/route-types/router-processing.d.ts +82 -0
  85. package/dist/types.backup/build/route-types/scan-filter.d.ts +17 -0
  86. package/dist/types.backup/build/route-types/source-scan.d.ts +13 -0
  87. package/dist/types.backup/build/runtime-discovery.d.ts +24 -0
  88. package/dist/types.backup/cache/background-task.d.ts +21 -0
  89. package/dist/types.backup/cache/cache-error.d.ts +71 -0
  90. package/dist/types.backup/cache/cache-key-utils.d.ts +35 -0
  91. package/dist/types.backup/cache/cache-policy.d.ts +59 -0
  92. package/dist/types.backup/cache/cache-runtime.d.ts +51 -0
  93. package/dist/types.backup/cache/cache-scope.d.ts +134 -0
  94. package/dist/types.backup/cache/cache-tag.d.ts +79 -0
  95. package/dist/types.backup/cache/cf/cf-base64.d.ts +4 -0
  96. package/dist/types.backup/cache/cf/cf-cache-constants.d.ts +105 -0
  97. package/dist/types.backup/cache/cf/cf-cache-store.d.ts +481 -0
  98. package/dist/types.backup/cache/cf/cf-cache-types.d.ts +300 -0
  99. package/dist/types.backup/cache/cf/cf-kv-utils.d.ts +22 -0
  100. package/dist/types.backup/cache/cf/cf-tag-marker-memo.d.ts +15 -0
  101. package/dist/types.backup/cache/cf/index.d.ts +3 -0
  102. package/dist/types.backup/cache/document-cache.d.ts +69 -0
  103. package/dist/types.backup/cache/handle-capture.d.ts +23 -0
  104. package/dist/types.backup/cache/handle-snapshot.d.ts +39 -0
  105. package/dist/types.backup/cache/index.d.ts +7 -0
  106. package/dist/types.backup/cache/memory-segment-store.d.ts +163 -0
  107. package/dist/types.backup/cache/profile-registry.d.ts +40 -0
  108. package/dist/types.backup/cache/read-through-swr.d.ts +60 -0
  109. package/dist/types.backup/cache/segment-codec.d.ts +78 -0
  110. package/dist/types.backup/cache/shell-snapshot.d.ts +162 -0
  111. package/dist/types.backup/cache/tag-invalidation.d.ts +74 -0
  112. package/dist/types.backup/cache/taint.d.ts +71 -0
  113. package/dist/types.backup/cache/types.d.ts +407 -0
  114. package/dist/types.backup/cache/vercel/index.d.ts +1 -0
  115. package/dist/types.backup/cache/vercel/vercel-cache-store.d.ts +267 -0
  116. package/dist/types.backup/client.d.ts +184 -0
  117. package/dist/types.backup/client.rsc.d.ts +39 -0
  118. package/dist/types.backup/cloudflare/index.d.ts +7 -0
  119. package/dist/types.backup/cloudflare/tracing.d.ts +53 -0
  120. package/dist/types.backup/component-utils.d.ts +46 -0
  121. package/dist/types.backup/components/DefaultDocument.d.ts +13 -0
  122. package/dist/types.backup/context-var.d.ts +84 -0
  123. package/dist/types.backup/debug.d.ts +57 -0
  124. package/dist/types.backup/decode-loader-results.d.ts +5 -0
  125. package/dist/types.backup/default-error-boundary.d.ts +10 -0
  126. package/dist/types.backup/defer.d.ts +89 -0
  127. package/dist/types.backup/deps/browser.d.ts +1 -0
  128. package/dist/types.backup/deps/html-stream-client.d.ts +1 -0
  129. package/dist/types.backup/deps/html-stream-server.d.ts +1 -0
  130. package/dist/types.backup/deps/rsc.d.ts +1 -0
  131. package/dist/types.backup/deps/ssr.d.ts +1 -0
  132. package/dist/types.backup/encode-kv.d.ts +35 -0
  133. package/dist/types.backup/errors.d.ts +226 -0
  134. package/dist/types.backup/escape-script.d.ts +44 -0
  135. package/dist/types.backup/handle.d.ts +93 -0
  136. package/dist/types.backup/handles/MetaTags.d.ts +17 -0
  137. package/dist/types.backup/handles/Scripts.d.ts +38 -0
  138. package/dist/types.backup/handles/breadcrumbs.d.ts +43 -0
  139. package/dist/types.backup/handles/deferred-resolution.d.ts +53 -0
  140. package/dist/types.backup/handles/is-thenable.d.ts +12 -0
  141. package/dist/types.backup/handles/meta.d.ts +43 -0
  142. package/dist/types.backup/handles/script.d.ts +139 -0
  143. package/dist/types.backup/host/cookie-handler.d.ts +8 -0
  144. package/dist/types.backup/host/errors.d.ts +40 -0
  145. package/dist/types.backup/host/index.d.ts +33 -0
  146. package/dist/types.backup/host/pattern-matcher.d.ts +30 -0
  147. package/dist/types.backup/host/router.d.ts +12 -0
  148. package/dist/types.backup/host/testing.d.ts +41 -0
  149. package/dist/types.backup/host/types.d.ts +148 -0
  150. package/dist/types.backup/host/utils.d.ts +20 -0
  151. package/dist/types.backup/href-client.d.ts +214 -0
  152. package/dist/types.backup/index.d.ts +112 -0
  153. package/dist/types.backup/index.rsc.d.ts +51 -0
  154. package/dist/types.backup/internal-debug.d.ts +1 -0
  155. package/dist/types.backup/loader-store.d.ts +193 -0
  156. package/dist/types.backup/loader.d.ts +18 -0
  157. package/dist/types.backup/loader.rsc.d.ts +18 -0
  158. package/dist/types.backup/missing-id-error.d.ts +1 -0
  159. package/dist/types.backup/outlet-context.d.ts +12 -0
  160. package/dist/types.backup/outlet-provider.d.ts +12 -0
  161. package/dist/types.backup/prerender/build-shell-capture.d.ts +104 -0
  162. package/dist/types.backup/prerender/param-hash.d.ts +6 -0
  163. package/dist/types.backup/prerender/shell-manifest-key.d.ts +18 -0
  164. package/dist/types.backup/prerender/store.d.ts +62 -0
  165. package/dist/types.backup/prerender.d.ts +292 -0
  166. package/dist/types.backup/redirect-origin.d.ts +55 -0
  167. package/dist/types.backup/regex-escape.d.ts +6 -0
  168. package/dist/types.backup/render-error-thrower.d.ts +13 -0
  169. package/dist/types.backup/response-utils.d.ts +35 -0
  170. package/dist/types.backup/reverse.d.ts +206 -0
  171. package/dist/types.backup/root-error-boundary.d.ts +32 -0
  172. package/dist/types.backup/route-content-wrapper.d.ts +40 -0
  173. package/dist/types.backup/route-definition/dsl-helpers.d.ts +130 -0
  174. package/dist/types.backup/route-definition/helper-factories.d.ts +22 -0
  175. package/dist/types.backup/route-definition/helpers-types.d.ts +392 -0
  176. package/dist/types.backup/route-definition/index.d.ts +7 -0
  177. package/dist/types.backup/route-definition/redirect.d.ts +48 -0
  178. package/dist/types.backup/route-definition/resolve-handler-use.d.ts +19 -0
  179. package/dist/types.backup/route-definition/use-item-types.d.ts +1 -0
  180. package/dist/types.backup/route-definition.d.ts +1 -0
  181. package/dist/types.backup/route-map-builder.d.ts +127 -0
  182. package/dist/types.backup/route-name.d.ts +27 -0
  183. package/dist/types.backup/route-types.d.ts +172 -0
  184. package/dist/types.backup/router/basename.d.ts +10 -0
  185. package/dist/types.backup/router/content-negotiation.d.ts +91 -0
  186. package/dist/types.backup/router/debug-manifest.d.ts +7 -0
  187. package/dist/types.backup/router/error-handling.d.ts +76 -0
  188. package/dist/types.backup/router/find-match.d.ts +19 -0
  189. package/dist/types.backup/router/handler-context.d.ts +41 -0
  190. package/dist/types.backup/router/instrument.d.ts +161 -0
  191. package/dist/types.backup/router/intercept-resolution.d.ts +79 -0
  192. package/dist/types.backup/router/lazy-includes.d.ts +26 -0
  193. package/dist/types.backup/router/loader-resolution.d.ts +63 -0
  194. package/dist/types.backup/router/logging.d.ts +41 -0
  195. package/dist/types.backup/router/manifest.d.ts +8 -0
  196. package/dist/types.backup/router/match-api.d.ts +19 -0
  197. package/dist/types.backup/router/match-context.d.ts +184 -0
  198. package/dist/types.backup/router/match-handlers.d.ts +49 -0
  199. package/dist/types.backup/router/match-middleware/background-revalidation.d.ts +113 -0
  200. package/dist/types.backup/router/match-middleware/cache-lookup.d.ts +113 -0
  201. package/dist/types.backup/router/match-middleware/cache-store.d.ts +112 -0
  202. package/dist/types.backup/router/match-middleware/index.d.ts +80 -0
  203. package/dist/types.backup/router/match-middleware/intercept-resolution.d.ts +116 -0
  204. package/dist/types.backup/router/match-middleware/segment-resolution.d.ts +94 -0
  205. package/dist/types.backup/router/match-pipelines.d.ts +103 -0
  206. package/dist/types.backup/router/match-result.d.ts +114 -0
  207. package/dist/types.backup/router/metrics.d.ts +6 -0
  208. package/dist/types.backup/router/middleware-types.d.ts +74 -0
  209. package/dist/types.backup/router/middleware.d.ts +116 -0
  210. package/dist/types.backup/router/navigation-snapshot.d.ts +22 -0
  211. package/dist/types.backup/router/params-util.d.ts +8 -0
  212. package/dist/types.backup/router/parse-pattern.d.ts +38 -0
  213. package/dist/types.backup/router/pattern-matching.d.ts +169 -0
  214. package/dist/types.backup/router/prefetch-cache-ttl.d.ts +27 -0
  215. package/dist/types.backup/router/prefetch-limits.d.ts +20 -0
  216. package/dist/types.backup/router/prerender-match.d.ts +50 -0
  217. package/dist/types.backup/router/preview-match.d.ts +22 -0
  218. package/dist/types.backup/router/request-classification.d.ts +104 -0
  219. package/dist/types.backup/router/revalidation.d.ts +57 -0
  220. package/dist/types.backup/router/route-snapshot.d.ts +112 -0
  221. package/dist/types.backup/router/router-context.d.ts +137 -0
  222. package/dist/types.backup/router/router-interfaces.d.ts +432 -0
  223. package/dist/types.backup/router/router-options.d.ts +738 -0
  224. package/dist/types.backup/router/router-registry.d.ts +15 -0
  225. package/dist/types.backup/router/segment-resolution/fresh.d.ts +55 -0
  226. package/dist/types.backup/router/segment-resolution/helpers.d.ts +93 -0
  227. package/dist/types.backup/router/segment-resolution/loader-cache.d.ts +33 -0
  228. package/dist/types.backup/router/segment-resolution/loader-mask.d.ts +44 -0
  229. package/dist/types.backup/router/segment-resolution/loader-snapshot.d.ts +90 -0
  230. package/dist/types.backup/router/segment-resolution/mask-nested.d.ts +53 -0
  231. package/dist/types.backup/router/segment-resolution/revalidation.d.ts +85 -0
  232. package/dist/types.backup/router/segment-resolution/static-store.d.ts +17 -0
  233. package/dist/types.backup/router/segment-resolution/streamed-handler-telemetry.d.ts +16 -0
  234. package/dist/types.backup/router/segment-resolution/view-transition-default.d.ts +28 -0
  235. package/dist/types.backup/router/segment-resolution.d.ts +3 -0
  236. package/dist/types.backup/router/segment-wrappers.d.ts +53 -0
  237. package/dist/types.backup/router/state-cookie-name.d.ts +1 -0
  238. package/dist/types.backup/router/substitute-pattern-params.d.ts +23 -0
  239. package/dist/types.backup/router/telemetry-otel.d.ts +113 -0
  240. package/dist/types.backup/router/telemetry.d.ts +215 -0
  241. package/dist/types.backup/router/timeout.d.ts +68 -0
  242. package/dist/types.backup/router/tracing.d.ts +125 -0
  243. package/dist/types.backup/router/trie-matching.d.ts +32 -0
  244. package/dist/types.backup/router/types.d.ts +98 -0
  245. package/dist/types.backup/router/url-params.d.ts +26 -0
  246. package/dist/types.backup/router.d.ts +7 -0
  247. package/dist/types.backup/rsc/capture-queue.d.ts +6 -0
  248. package/dist/types.backup/rsc/full-payload.d.ts +22 -0
  249. package/dist/types.backup/rsc/handler-context.d.ts +31 -0
  250. package/dist/types.backup/rsc/handler.d.ts +9 -0
  251. package/dist/types.backup/rsc/helpers.d.ts +213 -0
  252. package/dist/types.backup/rsc/index.d.ts +17 -0
  253. package/dist/types.backup/rsc/json-route-result.d.ts +20 -0
  254. package/dist/types.backup/rsc/loader-fetch.d.ts +14 -0
  255. package/dist/types.backup/rsc/manifest-init.d.ts +18 -0
  256. package/dist/types.backup/rsc/nonce.d.ts +28 -0
  257. package/dist/types.backup/rsc/origin-guard.d.ts +50 -0
  258. package/dist/types.backup/rsc/progressive-enhancement.d.ts +19 -0
  259. package/dist/types.backup/rsc/redirect-guard.d.ts +35 -0
  260. package/dist/types.backup/rsc/response-cache-serve.d.ts +46 -0
  261. package/dist/types.backup/rsc/response-error.d.ts +19 -0
  262. package/dist/types.backup/rsc/response-route-handler.d.ts +29 -0
  263. package/dist/types.backup/rsc/rsc-rendering.d.ts +23 -0
  264. package/dist/types.backup/rsc/runtime-warnings.d.ts +22 -0
  265. package/dist/types.backup/rsc/server-action.d.ts +68 -0
  266. package/dist/types.backup/rsc/shell-build-manifest.d.ts +84 -0
  267. package/dist/types.backup/rsc/shell-capture-constants.d.ts +27 -0
  268. package/dist/types.backup/rsc/shell-capture.d.ts +374 -0
  269. package/dist/types.backup/rsc/shell-serve.d.ts +136 -0
  270. package/dist/types.backup/rsc/ssr-setup.d.ts +48 -0
  271. package/dist/types.backup/rsc/transition-gate.d.ts +27 -0
  272. package/dist/types.backup/rsc/types.d.ts +290 -0
  273. package/dist/types.backup/runtime-env.d.ts +1 -0
  274. package/dist/types.backup/search-params.d.ts +125 -0
  275. package/dist/types.backup/segment-content-promise.d.ts +13 -0
  276. package/dist/types.backup/segment-fragments.d.ts +56 -0
  277. package/dist/types.backup/segment-loader-promise.d.ts +22 -0
  278. package/dist/types.backup/segment-system.d.ts +84 -0
  279. package/dist/types.backup/serialize.d.ts +164 -0
  280. package/dist/types.backup/server/context.d.ts +494 -0
  281. package/dist/types.backup/server/cookie-parse.d.ts +10 -0
  282. package/dist/types.backup/server/cookie-store.d.ts +107 -0
  283. package/dist/types.backup/server/fetchable-loader-store.d.ts +20 -0
  284. package/dist/types.backup/server/handle-store.d.ts +100 -0
  285. package/dist/types.backup/server/loader-registry.d.ts +32 -0
  286. package/dist/types.backup/server/request-context.d.ts +596 -0
  287. package/dist/types.backup/server/root-layout.d.ts +3 -0
  288. package/dist/types.backup/server.d.ts +15 -0
  289. package/dist/types.backup/ssr/index.d.ts +233 -0
  290. package/dist/types.backup/ssr/inject-rsc-eager.d.ts +3 -0
  291. package/dist/types.backup/ssr/preinit-client-references.d.ts +71 -0
  292. package/dist/types.backup/ssr/ssr-root.d.ts +69 -0
  293. package/dist/types.backup/static-handler.d.ts +57 -0
  294. package/dist/types.backup/testing/cache-status.d.ts +63 -0
  295. package/dist/types.backup/testing/collect-handle.d.ts +20 -0
  296. package/dist/types.backup/testing/dispatch.d.ts +123 -0
  297. package/dist/types.backup/testing/dom.entry.d.ts +15 -0
  298. package/dist/types.backup/testing/e2e/fixture.d.ts +37 -0
  299. package/dist/types.backup/testing/e2e/index.d.ts +30 -0
  300. package/dist/types.backup/testing/e2e/matchers.d.ts +17 -0
  301. package/dist/types.backup/testing/e2e/page-helpers.d.ts +62 -0
  302. package/dist/types.backup/testing/e2e/parity.d.ts +111 -0
  303. package/dist/types.backup/testing/e2e/server.d.ts +35 -0
  304. package/dist/types.backup/testing/flight-matchers.d.ts +55 -0
  305. package/dist/types.backup/testing/flight-normalize.d.ts +1 -0
  306. package/dist/types.backup/testing/flight-tree.d.ts +192 -0
  307. package/dist/types.backup/testing/flight.d.ts +115 -0
  308. package/dist/types.backup/testing/flight.entry.d.ts +27 -0
  309. package/dist/types.backup/testing/generated-routes.d.ts +66 -0
  310. package/dist/types.backup/testing/index.d.ts +52 -0
  311. package/dist/types.backup/testing/internal/context.d.ts +225 -0
  312. package/dist/types.backup/testing/internal/flight-client-globals.d.ts +1 -0
  313. package/dist/types.backup/testing/internal/seed-vars.d.ts +30 -0
  314. package/dist/types.backup/testing/render-handler.d.ts +160 -0
  315. package/dist/types.backup/testing/render-route.d.ts +246 -0
  316. package/dist/types.backup/testing/run-loader.d.ts +186 -0
  317. package/dist/types.backup/testing/run-middleware.d.ts +132 -0
  318. package/dist/types.backup/testing/run-transition-when.d.ts +77 -0
  319. package/dist/types.backup/testing/vitest-stubs/cloudflare-email.d.ts +6 -0
  320. package/dist/types.backup/testing/vitest-stubs/cloudflare-workers.d.ts +13 -0
  321. package/dist/types.backup/testing/vitest-stubs/plugin-rsc.d.ts +7 -0
  322. package/dist/types.backup/testing/vitest-stubs/version.d.ts +1 -0
  323. package/dist/types.backup/testing/vitest.d.ts +205 -0
  324. package/dist/types.backup/theme/ThemeProvider.d.ts +13 -0
  325. package/dist/types.backup/theme/ThemeScript.d.ts +45 -0
  326. package/dist/types.backup/theme/constants.d.ts +39 -0
  327. package/dist/types.backup/theme/index.d.ts +29 -0
  328. package/dist/types.backup/theme/theme-context.d.ts +21 -0
  329. package/dist/types.backup/theme/theme-script.d.ts +26 -0
  330. package/dist/types.backup/theme/types.d.ts +162 -0
  331. package/dist/types.backup/theme/use-theme.d.ts +8 -0
  332. package/dist/types.backup/types/boundaries.d.ts +93 -0
  333. package/dist/types.backup/types/cache-types.d.ts +191 -0
  334. package/dist/types.backup/types/error-types.d.ts +114 -0
  335. package/dist/types.backup/types/global-namespace.d.ts +90 -0
  336. package/dist/types.backup/types/handler-context.d.ts +658 -0
  337. package/dist/types.backup/types/index.d.ts +11 -0
  338. package/dist/types.backup/types/loader-types.d.ts +182 -0
  339. package/dist/types.backup/types/request-scope.d.ts +93 -0
  340. package/dist/types.backup/types/route-config.d.ts +105 -0
  341. package/dist/types.backup/types/route-entry.d.ts +95 -0
  342. package/dist/types.backup/types/segments.d.ts +234 -0
  343. package/dist/types.backup/types.d.ts +1 -0
  344. package/dist/types.backup/urls/include-helper.d.ts +17 -0
  345. package/dist/types.backup/urls/include-provider.d.ts +27 -0
  346. package/dist/types.backup/urls/index.d.ts +6 -0
  347. package/dist/types.backup/urls/path-helper-types.d.ts +197 -0
  348. package/dist/types.backup/urls/path-helper.d.ts +12 -0
  349. package/dist/types.backup/urls/pattern-types.d.ts +166 -0
  350. package/dist/types.backup/urls/response-types.d.ts +67 -0
  351. package/dist/types.backup/urls/type-extraction.d.ts +157 -0
  352. package/dist/types.backup/urls/urls-function.d.ts +24 -0
  353. package/dist/types.backup/urls.d.ts +1 -0
  354. package/dist/types.backup/use-loader.d.ts +150 -0
  355. package/dist/types.backup/vercel/index.d.ts +10 -0
  356. package/dist/types.backup/vercel/tracing.d.ts +70 -0
  357. package/dist/types.backup/vite/debug.d.ts +80 -0
  358. package/dist/types.backup/vite/discovery/bundle-postprocess.d.ts +12 -0
  359. package/dist/types.backup/vite/discovery/dev-prerender-cache.d.ts +65 -0
  360. package/dist/types.backup/vite/discovery/discover-routers.d.ts +17 -0
  361. package/dist/types.backup/vite/discovery/discovery-errors.d.ts +113 -0
  362. package/dist/types.backup/vite/discovery/gate-state.d.ts +79 -0
  363. package/dist/types.backup/vite/discovery/prerender-collection.d.ts +24 -0
  364. package/dist/types.backup/vite/discovery/route-types-writer.d.ts +32 -0
  365. package/dist/types.backup/vite/discovery/self-gen-tracking.d.ts +22 -0
  366. package/dist/types.backup/vite/discovery/shell-prerender-phase.d.ts +40 -0
  367. package/dist/types.backup/vite/discovery/state.d.ts +162 -0
  368. package/dist/types.backup/vite/discovery/virtual-module-codegen.d.ts +15 -0
  369. package/dist/types.backup/vite/index.d.ts +11 -0
  370. package/dist/types.backup/vite/inject-client-debug.d.ts +56 -0
  371. package/dist/types.backup/vite/plugin-types.d.ts +298 -0
  372. package/dist/types.backup/vite/plugins/cjs-to-esm.d.ts +6 -0
  373. package/dist/types.backup/vite/plugins/client-ref-dedup.d.ts +40 -0
  374. package/dist/types.backup/vite/plugins/client-ref-hashing.d.ts +35 -0
  375. package/dist/types.backup/vite/plugins/cloudflare-protocol-stub.d.ts +64 -0
  376. package/dist/types.backup/vite/plugins/expose-action-id.d.ts +18 -0
  377. package/dist/types.backup/vite/plugins/expose-id-utils.d.ts +37 -0
  378. package/dist/types.backup/vite/plugins/expose-ids/export-analysis.d.ts +19 -0
  379. package/dist/types.backup/vite/plugins/expose-ids/handler-transform.d.ts +10 -0
  380. package/dist/types.backup/vite/plugins/expose-ids/loader-transform.d.ts +8 -0
  381. package/dist/types.backup/vite/plugins/expose-ids/router-transform.d.ts +13 -0
  382. package/dist/types.backup/vite/plugins/expose-ids/types.d.ts +29 -0
  383. package/dist/types.backup/vite/plugins/expose-internal-ids.d.ts +6 -0
  384. package/dist/types.backup/vite/plugins/performance-tracks.d.ts +25 -0
  385. package/dist/types.backup/vite/plugins/refresh-cmd.d.ts +20 -0
  386. package/dist/types.backup/vite/plugins/use-cache-transform.d.ts +20 -0
  387. package/dist/types.backup/vite/plugins/vercel-output.d.ts +85 -0
  388. package/dist/types.backup/vite/plugins/version-injector.d.ts +21 -0
  389. package/dist/types.backup/vite/plugins/version-plugin.d.ts +19 -0
  390. package/dist/types.backup/vite/plugins/virtual-entries.d.ts +36 -0
  391. package/dist/types.backup/vite/plugins/virtual-stub-plugin.d.ts +7 -0
  392. package/dist/types.backup/vite/rango.d.ts +29 -0
  393. package/dist/types.backup/vite/router-discovery.d.ts +23 -0
  394. package/dist/types.backup/vite/utils/ast-handler-extract.d.ts +64 -0
  395. package/dist/types.backup/vite/utils/banner.d.ts +2 -0
  396. package/dist/types.backup/vite/utils/bundle-analysis.d.ts +28 -0
  397. package/dist/types.backup/vite/utils/client-chunks.d.ts +55 -0
  398. package/dist/types.backup/vite/utils/directive-prologue.d.ts +16 -0
  399. package/dist/types.backup/vite/utils/forward-user-plugins.d.ts +37 -0
  400. package/dist/types.backup/vite/utils/manifest-utils.d.ts +7 -0
  401. package/dist/types.backup/vite/utils/package-resolution.d.ts +6 -0
  402. package/dist/types.backup/vite/utils/prerender-utils.d.ts +32 -0
  403. package/dist/types.backup/vite/utils/shared-utils.d.ts +55 -0
  404. package/dist/vite/index.js +1 -1
  405. package/package.json +1 -1
  406. package/skills/parallel/SKILL.md +1 -1
  407. package/skills/ppr/SKILL.md +44 -3
  408. package/src/browser/prefetch/cache.ts +53 -9
  409. package/src/browser/prefetch/fetch.ts +83 -2
  410. package/src/cache/cf/cf-cache-store.ts +27 -8
  411. package/src/cache/types.ts +41 -6
  412. package/src/cache/vercel/vercel-cache-store.ts +24 -10
  413. package/src/route-definition/helpers-types.ts +5 -3
  414. package/src/rsc/capture-queue.ts +120 -47
  415. package/src/rsc/rsc-rendering.ts +11 -3
  416. package/src/rsc/shell-build-manifest.ts +20 -7
  417. package/src/rsc/shell-capture.ts +164 -12
  418. package/src/rsc/shell-serve.ts +27 -12
  419. package/src/static-handler.ts +18 -2
  420. package/src/urls/path-helper-types.ts +9 -10
@@ -0,0 +1,494 @@
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
+ import type { ReactNode } from "react";
3
+ import type { PartialCacheOptions, ErrorBoundaryHandler, Handler, LoaderDefinition, MiddlewareFn, NotFoundBoundaryHandler, ShouldRevalidateFn, TransitionConfig } from "../types";
4
+ import type { DefaultRouteName } from "../types/global-namespace.js";
5
+ /**
6
+ * Performance metric entry for a single measured operation
7
+ *
8
+ * @internal This type is an implementation detail and may change without notice.
9
+ */
10
+ export interface PerformanceMetric {
11
+ label: string;
12
+ duration: number;
13
+ startTime: number;
14
+ depth?: number;
15
+ desc?: string;
16
+ }
17
+ /**
18
+ * Request-scoped metrics store
19
+ *
20
+ * @internal This type is an implementation detail and may change without notice.
21
+ */
22
+ export interface MetricsStore {
23
+ enabled: boolean;
24
+ requestStart: number;
25
+ metrics: PerformanceMetric[];
26
+ }
27
+ /**
28
+ * Cache configuration for an entry
29
+ * When set, this entry and its children will use this cache config
30
+ * unless overridden by a nested cache() call.
31
+ *
32
+ * @internal This type is an implementation detail and may change without notice.
33
+ */
34
+ export type EntryCacheConfig = {
35
+ /** Cache options (false means caching disabled for this entry) - ttl is optional, uses defaults */
36
+ options: PartialCacheOptions | false;
37
+ };
38
+ /**
39
+ * Entry data structure for manifest
40
+ *
41
+ * @internal This type is an implementation detail and may change without notice.
42
+ */
43
+ export type EntryPropCommon = {
44
+ id: string;
45
+ shortCode: string;
46
+ parent: EntryData | null;
47
+ /** Cache configuration for this entry (set by cache() DSL) */
48
+ cache?: EntryCacheConfig;
49
+ /** URL prefix from include() scope, used for MountContext on client */
50
+ mountPath?: string;
51
+ };
52
+ /**
53
+ * Attachments resolved by walking the parent chain, not owned by the entry:
54
+ * middleware composes downward; revalidate and the error/notFound boundaries are
55
+ * resolved by nearest-ancestor lookup. Inherited, not a single execution chain.
56
+ *
57
+ * @internal This type is an implementation detail and may change without notice.
58
+ */
59
+ export type EntryPropDatas = {
60
+ middleware: MiddlewareFn<any, any>[];
61
+ revalidate: ShouldRevalidateFn<any, any>[];
62
+ errorBoundary: (ReactNode | ErrorBoundaryHandler)[];
63
+ notFoundBoundary: (ReactNode | NotFoundBoundaryHandler)[];
64
+ };
65
+ /**
66
+ * Render-time presentation fields shared by every entry variant.
67
+ *
68
+ * @internal This type is an implementation detail and may change without notice.
69
+ */
70
+ export type EntryPropRender = {
71
+ loading?: ReactNode | false;
72
+ transition?: TransitionConfig;
73
+ };
74
+ /**
75
+ * Loader entry stored in EntryData
76
+ * Contains the loader definition and its revalidation rules
77
+ *
78
+ * @internal This type is an implementation detail and may change without notice.
79
+ */
80
+ export type LoaderEntry = {
81
+ loader: LoaderDefinition<any>;
82
+ revalidate: ShouldRevalidateFn<any, any>[];
83
+ /** Cache config for this specific loader (loaders are NOT cached by default) */
84
+ cache?: EntryCacheConfig;
85
+ };
86
+ /**
87
+ * Segments state for intercept context
88
+ * Matches the structure from useSegments() for consistency
89
+ *
90
+ * @internal This type is an implementation detail and may change without notice.
91
+ */
92
+ export type InterceptSegmentsState = {
93
+ /** URL path segments (e.g., /shop/products/123 → ["shop", "products", "123"]) */
94
+ path: readonly string[];
95
+ /** Matched segment IDs in order (layouts and routes only, e.g., ["L0", "L0L1", "L0L1R0"]) */
96
+ ids: readonly string[];
97
+ };
98
+ /**
99
+ * Context passed to intercept selector functions (when())
100
+ * Contains navigation context to determine if interception should occur.
101
+ *
102
+ * Note: when() is evaluated during route matching, BEFORE middleware runs.
103
+ * So ctx.get()/ctx.use() are not available, but env (platform bindings) is.
104
+ *
105
+ * @internal This type is an implementation detail and may change without notice.
106
+ */
107
+ export type InterceptSelectorContext<TEnv = any> = {
108
+ from: URL;
109
+ to: URL;
110
+ params: Record<string, string>;
111
+ request: Request;
112
+ env: TEnv;
113
+ segments: InterceptSegmentsState;
114
+ fromRouteName?: DefaultRouteName;
115
+ toRouteName?: DefaultRouteName;
116
+ };
117
+ /**
118
+ * Selector function for conditional interception
119
+ * Returns true to intercept, false to skip and fall through to route handler
120
+ *
121
+ * @internal This type is an implementation detail and may change without notice.
122
+ */
123
+ export type InterceptWhenFn<TEnv = any> = (ctx: InterceptSelectorContext<TEnv>) => boolean;
124
+ /**
125
+ * Config object passed to intercept() (its 4th argument). `when` gates whether
126
+ * the intercept activates on a soft navigation — a single match-time selector or
127
+ * an array of them (ALL must return true; omit to always activate). This is the
128
+ * intercept counterpart to transition({ when }); both express conditional
129
+ * behavior as a config field rather than a separate DSL helper.
130
+ *
131
+ * @internal This type is an implementation detail and may change without notice.
132
+ */
133
+ export interface InterceptConfig<TEnv = any> {
134
+ when?: InterceptWhenFn<TEnv> | InterceptWhenFn<TEnv>[];
135
+ }
136
+ /**
137
+ * Intercept entry stored in EntryData
138
+ * Contains the slot name, route to intercept, and handler
139
+ *
140
+ * @internal This type is an implementation detail and may change without notice.
141
+ */
142
+ export type InterceptEntry = {
143
+ slotName: `@${string}`;
144
+ routeName: string;
145
+ handler: ReactNode | Handler<any, any, any>;
146
+ middleware: MiddlewareFn<any, any>[];
147
+ revalidate: ShouldRevalidateFn<any, any>[];
148
+ errorBoundary: (ReactNode | ErrorBoundaryHandler)[];
149
+ notFoundBoundary: (ReactNode | NotFoundBoundaryHandler)[];
150
+ loader: LoaderEntry[];
151
+ loading?: ReactNode | false;
152
+ transition?: TransitionConfig;
153
+ layout?: ReactNode | Handler<any, any, any>;
154
+ when: InterceptWhenFn[];
155
+ };
156
+ export interface ParallelEntryData extends EntryPropCommon, EntryPropDatas, EntryPropSegments, EntryPropRender {
157
+ type: "parallel";
158
+ handler: Record<`@${string}`, Handler<any, any, any> | ReactNode>;
159
+ /** Set when any parallel slot is a Static definition */
160
+ isStaticPrerender?: true;
161
+ /** Per-slot static handler $$ids for build-time store lookup */
162
+ staticHandlerIds?: Record<string, string>;
163
+ }
164
+ export type ParallelEntries = Partial<Record<`@${string}`, ParallelEntryData>>;
165
+ /**
166
+ * This entry's own structural children plus its owned loaders. `loader` lives
167
+ * here (not in EntryPropDatas) because loaders are owned by the entry, not
168
+ * inherited from ancestors.
169
+ *
170
+ * @internal This type is an implementation detail and may change without notice.
171
+ */
172
+ export type EntryPropSegments = {
173
+ loader: LoaderEntry[];
174
+ layout: EntryData[];
175
+ parallel: ParallelEntries;
176
+ intercept: InterceptEntry[];
177
+ };
178
+ export type EntryData = ({
179
+ type: "route";
180
+ handler: Handler<any, any, any>;
181
+ /** URL pattern for this route (used by path() in urls()) */
182
+ pattern?: string;
183
+ /** Set when handler is a Prerender definition */
184
+ isPrerender?: true;
185
+ /** Original PrerenderHandlerDefinition (for build-time getParams access) */
186
+ prerenderDef?: {
187
+ getParams?: (ctx: any) => Promise<any[]> | any[];
188
+ options?: {
189
+ concurrency?: number;
190
+ };
191
+ };
192
+ /** Set when route is wrapped with Passthrough() — has a separate live handler */
193
+ isPassthrough?: true;
194
+ /** Live handler for runtime fallback (only set on Passthrough routes) */
195
+ liveHandler?: Handler<any, any, any>;
196
+ /** Set when handler is a Static definition (build-time only) */
197
+ isStaticPrerender?: true;
198
+ /** Static handler $$id for build-time store lookup */
199
+ staticHandlerId?: string;
200
+ /** Response type for non-RSC routes (json, text, image, any) */
201
+ responseType?: string;
202
+ /**
203
+ * PPR (partial pre-rendering) opt-in from the path() `ppr` option. A
204
+ * document-level property of the page route: `true` uses the default
205
+ * shell policy, an object carries ttl/swr/tags. Read by the integrated
206
+ * PPR serve path (rsc/shell-serve.ts resolvePprConfig).
207
+ */
208
+ ppr?: boolean | import("../urls/pattern-types.js").PartialPrerenderProps;
209
+ } & EntryPropCommon & EntryPropDatas & EntryPropSegments & EntryPropRender) | ({
210
+ type: "layout";
211
+ handler: ReactNode | Handler<any, any, any>;
212
+ /** Set when handler is a Static definition (build-time only) */
213
+ isStaticPrerender?: true;
214
+ /** Static handler $$id for build-time store lookup */
215
+ staticHandlerId?: string;
216
+ } & EntryPropCommon & EntryPropDatas & EntryPropSegments & EntryPropRender) | ParallelEntryData | ({
217
+ type: "cache";
218
+ /** Cache entries create cache boundaries and render like layouts (with Outlet) */
219
+ handler: ReactNode | Handler<any, any, any>;
220
+ } & EntryPropCommon & EntryPropDatas & EntryPropSegments & EntryPropRender);
221
+ /**
222
+ * Tracked include info for build-time manifest generation
223
+ */
224
+ export interface TrackedInclude {
225
+ prefix: string;
226
+ fullPrefix: string;
227
+ namePrefix?: string;
228
+ patterns: unknown;
229
+ lazy: boolean;
230
+ }
231
+ /**
232
+ * Cached response-header write scope (issue #713). `kind` selects the error
233
+ * wording; `routeKey` names the route in the error.
234
+ *
235
+ * @internal This type is an implementation detail and may change without notice.
236
+ */
237
+ export type CachedHeaderScope = {
238
+ kind: "cache" | "ppr";
239
+ routeKey?: string;
240
+ };
241
+ /**
242
+ * Context stored in AsyncLocalStorage
243
+ */
244
+ interface HelperContext {
245
+ manifest: Map<string, EntryData>;
246
+ namespace: string;
247
+ parent: EntryData | null;
248
+ counters: Record<string, number>;
249
+ forRoute?: string;
250
+ mountIndex?: number;
251
+ metrics?: MetricsStore;
252
+ /** True when rendering for SSR (document requests) */
253
+ isSSR?: boolean;
254
+ /** URL patterns map for path() routes (route name -> pattern) */
255
+ patterns?: Map<string, string>;
256
+ /** URL patterns grouped by include prefix for separate entry creation */
257
+ patternsByPrefix?: Map<string, Map<string, string>>;
258
+ /** Trailing slash config per route name */
259
+ trailingSlash?: Map<string, "never" | "always" | "ignore">;
260
+ /** Search param schemas per route name */
261
+ searchSchemas?: Map<string, Record<string, string>>;
262
+ /** URL prefix from include() - applied to all path() patterns */
263
+ urlPrefix?: string;
264
+ /** Name prefix from include() - applied to all named routes */
265
+ namePrefix?: string;
266
+ /** True when this scope is at root level (no named include boundary above).
267
+ * Routes at root scope allow dot-local reverse to fall back to bare names. */
268
+ rootScoped?: boolean;
269
+ /** Run helper for cleaner middleware code */
270
+ run?: <T>(fn: () => T | Promise<T>) => T | Promise<T>;
271
+ /** Tracked includes for build-time manifest generation */
272
+ trackedIncludes?: TrackedInclude[];
273
+ /** Cache profiles for DSL-time cache("profileName") resolution */
274
+ cacheProfiles?: Record<string, import("../cache/profile-registry.js").CacheProfile>;
275
+ /** True when resolving handlers inside a cache() DSL boundary.
276
+ * Read by ctx.get() to guard non-cacheable variable reads. */
277
+ insideCacheScope?: boolean;
278
+ /**
279
+ * RULE (issue #713): in any cached scenario ONLY MIDDLEWARE writes response
280
+ * headers. Latched by the segment funnels, consulted by
281
+ * assertCachedHeaderWriteAllowed(); full doctrine in
282
+ * docs/design/ppr-shell-resume.md "The header doctrine".
283
+ */
284
+ cachedHeaderScope?: CachedHeaderScope;
285
+ /**
286
+ * Include scope string applied to direct-descendant shortCodes.
287
+ *
288
+ * Each `include(...)` call allocates a sibling-positional token like `I0`,
289
+ * `I1` from its parent's include counter and stores the composed scope
290
+ * (`${parentScope}I${idx}`) in its lazyContext. When the include's handler
291
+ * evaluates lazily, the store's `includeScope` is set from that context so
292
+ * every direct-descendant shortCode is generated as
293
+ * `${parent.shortCode}${includeScope}${prefix}${index}` — preventing
294
+ * collisions with siblings declared outside the include.
295
+ *
296
+ * The scope is NOT propagated through `store.run(...)`, so layouts /
297
+ * parallels / caches inside the include absorb the scope into their own
298
+ * shortCodes and their children start fresh.
299
+ */
300
+ includeScope?: string;
301
+ }
302
+ export declare const RangoContext: AsyncLocalStorage<HelperContext>;
303
+ export declare const getContext: () => {
304
+ context: AsyncLocalStorage<HelperContext>;
305
+ getStore: () => HelperContext;
306
+ getParent: () => EntryData | null;
307
+ getOrCreateStore: (forRoute?: string) => HelperContext;
308
+ getNextIndex: (type: (string & {}) | "layout" | "parallel" | "middleware" | "revalidate") => string;
309
+ getShortCode: (type: "layout" | "parallel" | "route" | "loader" | "cache") => string;
310
+ run: <T>(namespace: string, parent: EntryData | null, callback: (...args: any[]) => T) => T;
311
+ runWithStore: <T>(store: HelperContext, namespace: string, parent: EntryData | null, callback: (...args: any[]) => T) => T;
312
+ };
313
+ /**
314
+ * Acquire the active DSL build context, throwing `message` if a helper was
315
+ * called outside a urls()/map() builder. Returns the store API and the live
316
+ * HelperContext so callers avoid a second getContext() lookup.
317
+ */
318
+ export declare function requireDslContext(message: string): {
319
+ store: ReturnType<typeof getContext>;
320
+ ctx: HelperContext;
321
+ };
322
+ /**
323
+ * Run a callback with specific URL and name prefixes
324
+ * Used by include() to apply prefixes to nested patterns
325
+ */
326
+ export declare function runWithPrefixes<T>(urlPrefix: string, namePrefix: string | undefined, callback: () => T): T;
327
+ /**
328
+ * Get current URL prefix from context
329
+ */
330
+ export declare function getUrlPrefix(): string;
331
+ /**
332
+ * Get current name prefix from context
333
+ */
334
+ export declare function getNamePrefix(): string | undefined;
335
+ /**
336
+ * Get whether the current scope is at root level (no named include boundary above).
337
+ * Returns true at root or inside { name: "" } includes, false inside named includes.
338
+ */
339
+ export declare function getRootScoped(): boolean;
340
+ export type { HelperContext };
341
+ /**
342
+ * Return an isolated copy of a lazy include's captured parent entry.
343
+ *
344
+ * DSL helpers (loader(), middleware(), etc.) mutate ctx.parent in place.
345
+ * Multiple include() scopes capture the *same* syntheticMapRoot as their
346
+ * parent, so without isolation one include's loaders/middleware leak into
347
+ * every other route that shares that root.
348
+ *
349
+ * The clone is shallow: only the mutable arrays are copied so each
350
+ * include pushes to its own list. The rest of the entry (id, shortCode,
351
+ * parent pointer, handler) stays shared, which is correct and cheap.
352
+ */
353
+ export declare function getIsolatedLazyParent(captured: EntryData | null | undefined): EntryData | null;
354
+ export declare function getParallelEntries(parallels: ParallelEntries | EntryData[] | undefined): ParallelEntryData[];
355
+ export declare function getParallelSlotEntries(parallels: ParallelEntries | EntryData[] | undefined): Array<{
356
+ slot: `@${string}`;
357
+ entry: ParallelEntryData;
358
+ }>;
359
+ export declare function getParallelSlotCount(parallels: ParallelEntries | EntryData[] | undefined): number;
360
+ /**
361
+ * Track performance of a code block (no-op if metrics not enabled)
362
+ * Returns a done() callback to mark completion and record duration
363
+ *
364
+ * @example
365
+ * ```typescript
366
+ * const done = track("route-matching");
367
+ * // ... do work ...
368
+ * done(); // Records duration
369
+ * ```
370
+ */
371
+ export declare function track(label: string, depth?: number): () => void;
372
+ /**
373
+ * Check if the current execution is inside a cache() DSL boundary.
374
+ * Returns false inside loader execution — loaders are always fresh
375
+ * (never cached), so non-cacheable reads are safe.
376
+ */
377
+ export declare function isInsideCacheScope(): boolean;
378
+ /**
379
+ * Check if the current execution is inside a DSL loader scope
380
+ * (wrapped by runInsideLoaderScope). Used by rendered() barrier
381
+ * to distinguish DSL loaders from handler-invoked loaders.
382
+ */
383
+ export declare function isInsideLoaderScope(): boolean;
384
+ /**
385
+ * Latch the cached header-write scope for the current request. First latch
386
+ * wins: a ppr route latched at the funnel top is not downgraded by a nested
387
+ * cache() entry (the document-scoped wording is the more useful one).
388
+ * Takes scalars so the already-latched path allocates nothing.
389
+ */
390
+ export declare function latchCachedHeaderScope(kind: CachedHeaderScope["kind"], routeKey?: string): void;
391
+ /**
392
+ * The one ppr opt-in predicate: a page route entry that DECLARED `ppr`
393
+ * (`false` and undefined mean plain axis 1). Shared by the serve path
394
+ * (rsc/shell-serve.ts resolvePprConfig) and the header-write latch below so
395
+ * the two layers can never drift on what counts as a ppr route.
396
+ */
397
+ export declare function isPprEntry(entry: EntryData): entry is EntryData & {
398
+ type: "route";
399
+ ppr: true | import("../urls/pattern-types.js").PartialPrerenderProps;
400
+ };
401
+ /**
402
+ * Latch the ppr header-write scope when the entry chain about to resolve is a
403
+ * `ppr` page route's. Called at the TOP of every segment funnel — unlike
404
+ * cache() (positional: ancestors before the boundary stay writable), ppr is
405
+ * document-scoped: the root layout down to the page bakes into the shared
406
+ * shell, so the whole funnel is cached territory.
407
+ *
408
+ * Checks the LEAF entry only: `entries` is the traverseBack chain
409
+ * [root, ..., manifestEntry], and the serve path reads `ppr` off the same
410
+ * leaf (rsc-rendering.ts: resolvePprConfig(manifestEntry)) — guard and serve
411
+ * share the predicate (isPprEntry) AND the input, so they cannot drift.
412
+ */
413
+ export declare function latchPprHeaderScopeForEntries(entries: EntryData[], routeKey?: string): void;
414
+ /**
415
+ * Clear the ppr header-write latch for the remainder of this render (issue
416
+ * #735). Called by ctx.dynamic(): a dynamic() render opts off the SHELL axis
417
+ * (rsc-rendering.ts skips both the HIT commit and the MISS capture on
418
+ * `_dynamic`), so it is ALWAYS live — every request re-runs the handler and its
419
+ * header write lands identically each time. The guard's reason to forbid it
420
+ * (MISS/HIT divergence) evaporates, so the write is re-permitted.
421
+ *
422
+ * ONLY the ppr (shell) axis is dropped — dynamic() does NOT opt off the CACHE
423
+ * axis. Two cases:
424
+ * - Pure ppr funnel (no cache() boundary): clear the latch → writes re-permit.
425
+ * - ppr route nested under a cache() boundary: fresh.ts latches "ppr" at the
426
+ * funnel top (first-wins), which MASKS the positional cache() latch, but the
427
+ * handler still runs inside the cache scope (`insideCacheScope`). A cache()
428
+ * HIT skips that handler, so the write is still non-deterministic — UNMASK to
429
+ * "cache" instead of clearing, so the guard keeps throwing (accurate cache()
430
+ * wording). This is why the check keys off `insideCacheScope`, not just kind.
431
+ *
432
+ * A subsequent cache() entered AFTER dynamic() on a pure-ppr funnel re-latches
433
+ * "cache" via latchCachedHeaderScope's `!store.cachedHeaderScope` guard (the
434
+ * field is undefined again once cleared). No-op when there is no funnel store or
435
+ * no ppr latch (dynamic() from middleware runs outside the funnel Store.run
436
+ * scope, so nothing is latched — the middleware exemption is unchanged).
437
+ */
438
+ export declare function clearPprHeaderScope(): void;
439
+ /**
440
+ * RULE (issue #713): in any cached scenario ONLY MIDDLEWARE writes response
441
+ * headers — handler and loader writes throw while a scope is latched; the one
442
+ * exemption is DSL (registered) loaders under plain cache(). A handler-invoked
443
+ * loader body (ctx.use from a handler, never registered with loader()) is
444
+ * skipped with its handler on a HIT and throws like a handler write (#725).
445
+ * A ctx.dynamic() render clears the ppr latch (clearPprHeaderScope, #735) so
446
+ * its always-live handler header writes are re-permitted. Full layer rules and
447
+ * rationale: docs/design/ppr-shell-resume.md "The header doctrine".
448
+ */
449
+ export declare function assertCachedHeaderWriteAllowed(surface: string, surfaceProp?: string | symbol): void;
450
+ /**
451
+ * Run `fn` inside a loader scope. While active, cache-scope guards
452
+ * are bypassed because loaders are always fresh (never cached) and
453
+ * their side effects (setCookie, header, etc.) are safe.
454
+ */
455
+ export declare function runInsideLoaderScope<T>(fn: () => T): T;
456
+ /**
457
+ * Run `fn` inside a loader BODY scope. Marks loader-function execution for the
458
+ * cache-purity guard only (isInsideCacheScope), WITHOUT affecting
459
+ * isInsideLoaderScope()/rendered() gating. Applied to every loader body (DSL
460
+ * and handler-invoked via ctx.use) so request-scoped reads inside a loader
461
+ * never trip the cache-scope guards — loaders always run fresh.
462
+ */
463
+ export declare function runInsideLoaderBodyScope<T>(fn: () => T, loaderId?: string, handlerInvoked?: boolean): T;
464
+ /**
465
+ * The $$id of the loader whose body is currently executing, or undefined
466
+ * outside any loader body. Used by the shell-capture identity guard
467
+ * (cookie-store.ts) so its refusal warning can name the loader that read
468
+ * cookies()/headers() instead of blaming a lane it cannot see — the old
469
+ * hardcoded "bake-lane loader" text misled a live-lane debugging session
470
+ * (issue #672, secondary).
471
+ */
472
+ export declare function getCurrentLoaderBodyId(): string | undefined;
473
+ /**
474
+ * True while a HANDLER-invoked loader body (`await ctx.use(Loader)` from a
475
+ * handler, not the DSL segment funnel) is executing. The consumption-lane
476
+ * rule keys off this: handler consumption yields a BAKED copy in every shared
477
+ * artifact — cache(), "use cache", and the PPR shell — so the shell-capture
478
+ * identity guard (cookie-store.ts) permits cookies()/headers() here, exactly
479
+ * like the cache-purity guards do. DSL segment loaders (live lane masked at
480
+ * capture, bake lane guarded) never set the flag.
481
+ */
482
+ export declare function isInsideHandlerInvokedLoaderBody(): boolean;
483
+ /**
484
+ * Check if the current execution is inside a handle push callback (sync or an
485
+ * async callback's continuation). Used by the handler-to-loader deadlock guard
486
+ * to exempt push-callback continuations.
487
+ */
488
+ export declare function isInsidePushCallbackScope(): boolean;
489
+ /**
490
+ * Run `fn` inside a push-callback scope. Wraps the invocation of a handle push
491
+ * callback so that any ctx.use(loader) it makes — including after one of its own
492
+ * awaits — is exempt from the deadlock guard.
493
+ */
494
+ export declare function runInsidePushCallbackScope<T>(fn: () => T): T;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Canonical inbound-Cookie-header parser.
3
+ *
4
+ * Kept as a dependency-free leaf so any consumer (request-context, the host
5
+ * dispatcher, tests) can share one implementation without pulling a heavier
6
+ * module's graph. A duplicate copy in middleware-cookies.ts was removed; the
7
+ * host copy in cookie-handler.ts was collapsed onto this one. Not part of the
8
+ * public export surface.
9
+ */
10
+ export declare function parseCookiesFromHeader(cookieHeader: string | null): Record<string, string>;
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Cookie Store — Next.js-style cookie facade backed by the response-derived model.
3
+ *
4
+ * `cookies()` returns a CookieStore scoped to the current request.
5
+ * Reads merge the original Cookie header with Set-Cookie mutations
6
+ * already queued on the response stub (last-write-wins).
7
+ * Writes append Set-Cookie to the response stub.
8
+ */
9
+ import type { CookieOptions } from "../router/middleware-types.js";
10
+ /**
11
+ * A single cookie entry returned by get() and getAll().
12
+ */
13
+ export interface Cookie {
14
+ name: string;
15
+ value: string;
16
+ }
17
+ /**
18
+ * Request-scoped cookie store.
19
+ *
20
+ * Reads see the effective merged view (original request + same-request mutations).
21
+ * Writes append Set-Cookie headers to the shared response stub.
22
+ */
23
+ export interface CookieStore {
24
+ /** Get a single cookie by name. Returns undefined if not set or deleted. */
25
+ get(name: string): Cookie | undefined;
26
+ /** Get all effective cookies, or all cookies with a given name. */
27
+ getAll(name?: string): Cookie[];
28
+ /** Check whether a cookie exists in the effective view. */
29
+ has(name: string): boolean;
30
+ /** Set a cookie (appends Set-Cookie to the response stub). */
31
+ set(name: string, value: string, options?: CookieOptions): void;
32
+ /** Delete a cookie (appends Set-Cookie with maxAge=0 to the response stub). */
33
+ delete(name: string, options?: Pick<CookieOptions, "domain" | "path">): void;
34
+ }
35
+ /**
36
+ * Get the request-scoped cookie store.
37
+ *
38
+ * Must be called inside a request context (middleware, handler, loader, action).
39
+ * Throws if called outside request scope.
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * import { cookies } from "@rangojs/router";
44
+ *
45
+ * // In a handler, loader, or action:
46
+ * const session = cookies().get("session")?.value;
47
+ * cookies().set("session", "new-token", { httpOnly: true });
48
+ * cookies().delete("session");
49
+ * ```
50
+ */
51
+ export declare function cookies(): CookieStore;
52
+ /**
53
+ * Read-only view of HTTP headers.
54
+ * Exposes only the read methods of the Headers API.
55
+ */
56
+ export interface ReadonlyHeaders {
57
+ get(name: string): string | null;
58
+ has(name: string): boolean;
59
+ entries(): HeadersIterator<[string, string]>;
60
+ keys(): HeadersIterator<string>;
61
+ values(): HeadersIterator<string>;
62
+ forEach(callback: (value: string, name: string, parent: ReadonlyHeaders) => void): void;
63
+ [Symbol.iterator](): HeadersIterator<[string, string]>;
64
+ }
65
+ type HeadersIterator<T> = IterableIterator<T>;
66
+ /**
67
+ * Get the original request headers (read-only).
68
+ *
69
+ * Must be called inside a request context.
70
+ * Returns a read-only view of the incoming request's headers.
71
+ * Mutation methods (set, append, delete) throw at runtime.
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * import { headers } from "@rangojs/router";
76
+ *
77
+ * const auth = headers().get("authorization");
78
+ * const contentType = headers().get("content-type");
79
+ * ```
80
+ */
81
+ export declare function headers(): ReadonlyHeaders;
82
+ /**
83
+ * Force the calling client's caches to miss from now on, from the server seat:
84
+ * write a rotated `Set-Cookie` for the rango state. The responding client
85
+ * applies it on receipt, and its history cache is marked stale by the
86
+ * jar-divergence observer at its next read. Per-client and lazy — it rotates
87
+ * only the client that receives this response, not every client.
88
+ *
89
+ * Idempotent within a request (one `Set-Cookie`). Inert (a dev warning) when
90
+ * called outside a request context. Like `cookies()`, it throws inside a
91
+ * `"use cache"` / `cache()` boundary, but is allowed from a loader (loaders are
92
+ * the dynamic holes of a cached document).
93
+ */
94
+ export declare function invalidateClientCache(): void;
95
+ /**
96
+ * Suppress a server action's automatic client-cache invalidation: tell the
97
+ * action bridge this action changed nothing a route renders, so it should leave
98
+ * the client's state and caches alone (no rotation, no prefetch wipe, no
99
+ * broadcast, no revalidation refetch). Per-response, not per-action-definition —
100
+ * only the execution knows whether anything changed.
101
+ *
102
+ * Sets an internal response header the bridge reads. Idempotent within a
103
+ * request. Inert (a dev warning) outside a request context — there is no
104
+ * automatic invalidation to suppress.
105
+ */
106
+ export declare function keepClientCache(): void;
107
+ export {};
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Fetchable loader store - internal registry for fetchable loader functions.
3
+ *
4
+ * Extracted into its own module to avoid circular dependencies between
5
+ * loader.rsc.ts and request-context.ts. This module has no imports from
6
+ * either, so both can safely import from here.
7
+ *
8
+ * Populated by createLoader() in loader.rsc.ts.
9
+ * Read by request-context.ts (for ctx.use()) and loader-registry.ts (for GET-based fetching).
10
+ */
11
+ import type { LoaderFn } from "../types.js";
12
+ import type { MiddlewareFn } from "../router/middleware.js";
13
+ export interface LoaderRegistryEntry {
14
+ fn: LoaderFn<any, any, any>;
15
+ middleware: MiddlewareFn[];
16
+ /** Whether this loader is fetchable via the _rsc_loader endpoint. */
17
+ fetchable: boolean;
18
+ }
19
+ export declare function registerFetchableLoader(id: string, fn: LoaderFn<any, any, any>, middleware: MiddlewareFn[], fetchable: boolean): void;
20
+ export declare function getFetchableLoader(id: string): LoaderRegistryEntry | undefined;