@timber-js/app 0.2.0-alpha.19 → 0.2.0-alpha.191

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 (1192) hide show
  1. package/LICENSE +8 -0
  2. package/agent-skill.md +344 -0
  3. package/dist/_chunks/actions-BjbbNRFN.js +318 -0
  4. package/dist/_chunks/actions-BjbbNRFN.js.map +1 -0
  5. package/dist/_chunks/als-registry-C6kcfprT.js +41 -0
  6. package/dist/_chunks/als-registry-C6kcfprT.js.map +1 -0
  7. package/dist/_chunks/als-slots-BEEIPKYm.js +26 -0
  8. package/dist/_chunks/als-slots-BEEIPKYm.js.map +1 -0
  9. package/dist/_chunks/base-path-DaQrzbez.js +80 -0
  10. package/dist/_chunks/base-path-DaQrzbez.js.map +1 -0
  11. package/dist/_chunks/build-manifest-DWppEdLB.js +86 -0
  12. package/dist/_chunks/build-manifest-DWppEdLB.js.map +1 -0
  13. package/dist/_chunks/build-output-helper-C3DrfzZR.js +369 -0
  14. package/dist/_chunks/build-output-helper-C3DrfzZR.js.map +1 -0
  15. package/dist/_chunks/cache-api-DllJ-Lyw.js +1196 -0
  16. package/dist/_chunks/cache-api-DllJ-Lyw.js.map +1 -0
  17. package/dist/_chunks/cli-check-DJZDc22E.js +256 -0
  18. package/dist/_chunks/cli-check-DJZDc22E.js.map +1 -0
  19. package/dist/_chunks/cli-schema-sync-D4_AZVUb.js +298 -0
  20. package/dist/_chunks/cli-schema-sync-D4_AZVUb.js.map +1 -0
  21. package/dist/_chunks/cloudflare-CGP6BZKO.js +1284 -0
  22. package/dist/_chunks/cloudflare-CGP6BZKO.js.map +1 -0
  23. package/dist/_chunks/codec-registry-oOUxugz3.js +21 -0
  24. package/dist/_chunks/codec-registry-oOUxugz3.js.map +1 -0
  25. package/dist/_chunks/convention-lint-CpteIpTm.js +784 -0
  26. package/dist/_chunks/convention-lint-CpteIpTm.js.map +1 -0
  27. package/dist/_chunks/dist-BA3u1z3W.js +423 -0
  28. package/dist/_chunks/dist-BA3u1z3W.js.map +1 -0
  29. package/dist/_chunks/error-boundary-D-ODYX41.js +353 -0
  30. package/dist/_chunks/error-boundary-D-ODYX41.js.map +1 -0
  31. package/dist/_chunks/fast-hash-C-tVYrLb.js +41 -0
  32. package/dist/_chunks/fast-hash-C-tVYrLb.js.map +1 -0
  33. package/dist/_chunks/file-cache-DmX7OqZP.js +454 -0
  34. package/dist/_chunks/file-cache-DmX7OqZP.js.map +1 -0
  35. package/dist/_chunks/format-CfwjgPz9.js +14 -0
  36. package/dist/_chunks/format-CfwjgPz9.js.map +1 -0
  37. package/dist/_chunks/fs-identity-D7vb6GdI.js +208 -0
  38. package/dist/_chunks/fs-identity-D7vb6GdI.js.map +1 -0
  39. package/dist/_chunks/href-validation-CMc5JRls.js +141 -0
  40. package/dist/_chunks/href-validation-CMc5JRls.js.map +1 -0
  41. package/dist/_chunks/json-lossy-check-ClNvBM_3.js +63 -0
  42. package/dist/_chunks/json-lossy-check-ClNvBM_3.js.map +1 -0
  43. package/dist/_chunks/logger-CH7IcMmg.js +1436 -0
  44. package/dist/_chunks/logger-CH7IcMmg.js.map +1 -0
  45. package/dist/_chunks/mdx-file-C005ay-P.js +25 -0
  46. package/dist/_chunks/mdx-file-C005ay-P.js.map +1 -0
  47. package/dist/_chunks/plugin-context-rCinWLiE.js +321 -0
  48. package/dist/_chunks/plugin-context-rCinWLiE.js.map +1 -0
  49. package/dist/_chunks/purge-store-Byr8XOjU.js +14 -0
  50. package/dist/_chunks/purge-store-Byr8XOjU.js.map +1 -0
  51. package/dist/_chunks/resolve-schema-CBR6Lm4i.js +50 -0
  52. package/dist/_chunks/resolve-schema-CBR6Lm4i.js.map +1 -0
  53. package/dist/_chunks/router-ref-DuYuV_0Q.js +28 -0
  54. package/dist/_chunks/router-ref-DuYuV_0Q.js.map +1 -0
  55. package/dist/_chunks/rsc-cache-key-DD0fl_-s.js +243 -0
  56. package/dist/_chunks/rsc-cache-key-DD0fl_-s.js.map +1 -0
  57. package/dist/_chunks/rsc-error-envelope-tT5PJs4q.js +40 -0
  58. package/dist/_chunks/rsc-error-envelope-tT5PJs4q.js.map +1 -0
  59. package/dist/_chunks/rsc-media-type-DRqE_lD_.js +46 -0
  60. package/dist/_chunks/rsc-media-type-DRqE_lD_.js.map +1 -0
  61. package/dist/_chunks/rsc-payload-path-B_LBodc2.js +48 -0
  62. package/dist/_chunks/rsc-payload-path-B_LBodc2.js.map +1 -0
  63. package/dist/_chunks/scanner-CAietmj4.js +1564 -0
  64. package/dist/_chunks/scanner-CAietmj4.js.map +1 -0
  65. package/dist/_chunks/schema-bridge-C83xa9lT.js +199 -0
  66. package/dist/_chunks/schema-bridge-C83xa9lT.js.map +1 -0
  67. package/dist/_chunks/segment-classify-C539Pa2O.js +197 -0
  68. package/dist/_chunks/segment-classify-C539Pa2O.js.map +1 -0
  69. package/dist/_chunks/segment-context-CjOlyB8Y.js +97 -0
  70. package/dist/_chunks/segment-context-CjOlyB8Y.js.map +1 -0
  71. package/dist/_chunks/segment-keys-BawYuNFO.js +307 -0
  72. package/dist/_chunks/segment-keys-BawYuNFO.js.map +1 -0
  73. package/dist/_chunks/sizeof-lXffQ1Vr.js +35 -0
  74. package/dist/_chunks/sizeof-lXffQ1Vr.js.map +1 -0
  75. package/dist/_chunks/slot-params-BCTmZkQB.js +76 -0
  76. package/dist/_chunks/slot-params-BCTmZkQB.js.map +1 -0
  77. package/dist/_chunks/{ssr-data-MjmprTmO.js → ssr-data-14MXm7Pj.js} +17 -2
  78. package/dist/_chunks/ssr-data-14MXm7Pj.js.map +1 -0
  79. package/dist/_chunks/use-query-states-I3JMng6J.js +226 -0
  80. package/dist/_chunks/use-query-states-I3JMng6J.js.map +1 -0
  81. package/dist/_chunks/use-segment-params-C4r4BD9T.js +398 -0
  82. package/dist/_chunks/use-segment-params-C4r4BD9T.js.map +1 -0
  83. package/dist/_chunks/walkers-BsVLmD1S.js +141 -0
  84. package/dist/_chunks/walkers-BsVLmD1S.js.map +1 -0
  85. package/dist/adapters/build-output-helper.d.ts +72 -0
  86. package/dist/adapters/build-output-helper.d.ts.map +1 -0
  87. package/dist/adapters/cloudflare-dev.d.ts +109 -0
  88. package/dist/adapters/cloudflare-dev.d.ts.map +1 -0
  89. package/dist/adapters/cloudflare-dev.js +73 -0
  90. package/dist/adapters/cloudflare-dev.js.map +1 -0
  91. package/dist/adapters/cloudflare-kv-cache.d.ts +65 -0
  92. package/dist/adapters/cloudflare-kv-cache.d.ts.map +1 -0
  93. package/dist/adapters/cloudflare-kv-cache.js +124 -0
  94. package/dist/adapters/cloudflare-kv-cache.js.map +1 -0
  95. package/dist/adapters/cloudflare.d.ts +199 -21
  96. package/dist/adapters/cloudflare.d.ts.map +1 -1
  97. package/dist/adapters/cloudflare.js +2 -188
  98. package/dist/adapters/compress-module.d.ts +17 -4
  99. package/dist/adapters/compress-module.d.ts.map +1 -1
  100. package/dist/adapters/fs-identity.d.ts +64 -0
  101. package/dist/adapters/fs-identity.d.ts.map +1 -0
  102. package/dist/adapters/nitro.d.ts +55 -3
  103. package/dist/adapters/nitro.d.ts.map +1 -1
  104. package/dist/adapters/nitro.js +287 -171
  105. package/dist/adapters/nitro.js.map +1 -1
  106. package/dist/adapters/shared.d.ts +62 -0
  107. package/dist/adapters/shared.d.ts.map +1 -0
  108. package/dist/adapters/types.d.ts +28 -6
  109. package/dist/adapters/types.d.ts.map +1 -1
  110. package/dist/cache/cache-api.d.ts +48 -0
  111. package/dist/cache/cache-api.d.ts.map +1 -0
  112. package/dist/cache/fast-hash.d.ts +5 -0
  113. package/dist/cache/fast-hash.d.ts.map +1 -1
  114. package/dist/cache/handler-store.d.ts +33 -0
  115. package/dist/cache/handler-store.d.ts.map +1 -0
  116. package/dist/cache/index.d.ts +31 -8
  117. package/dist/cache/index.d.ts.map +1 -1
  118. package/dist/cache/index.js +3 -326
  119. package/dist/cache/invalidation-epoch.d.ts +43 -0
  120. package/dist/cache/invalidation-epoch.d.ts.map +1 -0
  121. package/dist/cache/json-lossy-check.d.ts +11 -0
  122. package/dist/cache/json-lossy-check.d.ts.map +1 -0
  123. package/dist/cache/redis-handler.d.ts +140 -8
  124. package/dist/cache/redis-handler.d.ts.map +1 -1
  125. package/dist/cache/singleflight.d.ts +19 -2
  126. package/dist/cache/singleflight.d.ts.map +1 -1
  127. package/dist/cache/sizeof.d.ts +22 -0
  128. package/dist/cache/sizeof.d.ts.map +1 -0
  129. package/dist/cache/stable-stringify.d.ts +9 -0
  130. package/dist/cache/stable-stringify.d.ts.map +1 -1
  131. package/dist/cache/store.d.ts +53 -0
  132. package/dist/cache/store.d.ts.map +1 -0
  133. package/dist/cache/stores/cloudflare-kv.d.ts +38 -0
  134. package/dist/cache/stores/cloudflare-kv.d.ts.map +1 -0
  135. package/dist/cache/stores/cloudflare-kv.js +29 -0
  136. package/dist/cache/stores/cloudflare-kv.js.map +1 -0
  137. package/dist/cache/stores/memory.d.ts +42 -0
  138. package/dist/cache/stores/memory.d.ts.map +1 -0
  139. package/dist/cache/stores/memory.js +90 -0
  140. package/dist/cache/stores/memory.js.map +1 -0
  141. package/dist/cache/stores/redis.d.ts +69 -0
  142. package/dist/cache/stores/redis.d.ts.map +1 -0
  143. package/dist/cache/stores/redis.js +35 -0
  144. package/dist/cache/stores/redis.js.map +1 -0
  145. package/dist/cache/stores/vercel.d.ts +36 -0
  146. package/dist/cache/stores/vercel.d.ts.map +1 -0
  147. package/dist/cache/stores/vercel.js +33 -0
  148. package/dist/cache/stores/vercel.js.map +1 -0
  149. package/dist/cache/tag-aware-handler.d.ts +52 -0
  150. package/dist/cache/tag-aware-handler.d.ts.map +1 -0
  151. package/dist/cache/timber-cache.d.ts +20 -10
  152. package/dist/cache/timber-cache.d.ts.map +1 -1
  153. package/dist/cdn/cloudflare-purge.d.ts +23 -0
  154. package/dist/cdn/cloudflare-purge.d.ts.map +1 -0
  155. package/dist/cdn/cloudflare-purge.js +30 -0
  156. package/dist/cdn/cloudflare-purge.js.map +1 -0
  157. package/dist/cdn/fastly-purge.d.ts +25 -0
  158. package/dist/cdn/fastly-purge.d.ts.map +1 -0
  159. package/dist/cdn/fastly-purge.js +33 -0
  160. package/dist/cdn/fastly-purge.js.map +1 -0
  161. package/dist/cdn/headers.d.ts +97 -0
  162. package/dist/cdn/headers.d.ts.map +1 -0
  163. package/dist/cdn/index.d.ts +5 -0
  164. package/dist/cdn/index.d.ts.map +1 -0
  165. package/dist/cdn/index.js +94 -0
  166. package/dist/cdn/index.js.map +1 -0
  167. package/dist/cdn/purge-store.d.ts +23 -0
  168. package/dist/cdn/purge-store.d.ts.map +1 -0
  169. package/dist/cdn/workers-cache-purge.d.ts +16 -0
  170. package/dist/cdn/workers-cache-purge.d.ts.map +1 -0
  171. package/dist/cdn/workers-cache-purge.js +35 -0
  172. package/dist/cdn/workers-cache-purge.js.map +1 -0
  173. package/dist/cli-check.d.ts +153 -0
  174. package/dist/cli-check.d.ts.map +1 -0
  175. package/dist/cli-schema-sync.d.ts +59 -0
  176. package/dist/cli-schema-sync.d.ts.map +1 -0
  177. package/dist/cli.d.ts +66 -7
  178. package/dist/cli.d.ts.map +1 -1
  179. package/dist/cli.js +151 -47
  180. package/dist/cli.js.map +1 -1
  181. package/dist/client/browser-dev.d.ts +37 -1
  182. package/dist/client/browser-dev.d.ts.map +1 -1
  183. package/dist/client/browser-entry/action-dispatch.d.ts +17 -0
  184. package/dist/client/browser-entry/action-dispatch.d.ts.map +1 -0
  185. package/dist/client/browser-entry/hmr.d.ts +21 -0
  186. package/dist/client/browser-entry/hmr.d.ts.map +1 -0
  187. package/dist/client/browser-entry/hydrate.d.ts +57 -0
  188. package/dist/client/browser-entry/hydrate.d.ts.map +1 -0
  189. package/dist/client/browser-entry/index.d.ts +29 -0
  190. package/dist/client/browser-entry/index.d.ts.map +1 -0
  191. package/dist/client/browser-entry/post-hydration.d.ts +29 -0
  192. package/dist/client/browser-entry/post-hydration.d.ts.map +1 -0
  193. package/dist/client/browser-entry/router-init.d.ts +30 -0
  194. package/dist/client/browser-entry/router-init.d.ts.map +1 -0
  195. package/dist/client/browser-entry/rsc-stream.d.ts +32 -0
  196. package/dist/client/browser-entry/rsc-stream.d.ts.map +1 -0
  197. package/dist/client/browser-entry/scroll.d.ts +28 -0
  198. package/dist/client/browser-entry/scroll.d.ts.map +1 -0
  199. package/dist/client/error-boundary.d.ts +19 -5
  200. package/dist/client/error-boundary.d.ts.map +1 -1
  201. package/dist/client/error-boundary.js +1 -125
  202. package/dist/client/error-reconstituter.d.ts +61 -0
  203. package/dist/client/error-reconstituter.d.ts.map +1 -0
  204. package/dist/client/form.d.ts +16 -27
  205. package/dist/client/form.d.ts.map +1 -1
  206. package/dist/client/history.d.ts +29 -7
  207. package/dist/client/history.d.ts.map +1 -1
  208. package/dist/client/index.d.ts +11 -24
  209. package/dist/client/index.d.ts.map +1 -1
  210. package/dist/client/index.js +186 -1134
  211. package/dist/client/index.js.map +1 -1
  212. package/dist/client/internal.d.ts +20 -0
  213. package/dist/client/internal.d.ts.map +1 -0
  214. package/dist/client/internal.js +1624 -0
  215. package/dist/client/internal.js.map +1 -0
  216. package/dist/client/link.d.ts +63 -60
  217. package/dist/client/link.d.ts.map +1 -1
  218. package/dist/client/navigation-api.d.ts +121 -0
  219. package/dist/client/navigation-api.d.ts.map +1 -0
  220. package/dist/client/navigation-commit.d.ts +87 -0
  221. package/dist/client/navigation-commit.d.ts.map +1 -0
  222. package/dist/client/navigation-context.d.ts +38 -20
  223. package/dist/client/navigation-context.d.ts.map +1 -1
  224. package/dist/client/navigation-root.d.ts +159 -0
  225. package/dist/client/navigation-root.d.ts.map +1 -0
  226. package/dist/client/nuqs-adapter.d.ts +1 -1
  227. package/dist/client/nuqs-adapter.d.ts.map +1 -1
  228. package/dist/client/params-context.d.ts +82 -0
  229. package/dist/client/params-context.d.ts.map +1 -0
  230. package/dist/client/router-effects.d.ts +129 -0
  231. package/dist/client/router-effects.d.ts.map +1 -0
  232. package/dist/client/router-lifecycle.d.ts +55 -0
  233. package/dist/client/router-lifecycle.d.ts.map +1 -0
  234. package/dist/client/router-pipeline.d.ts +84 -0
  235. package/dist/client/router-pipeline.d.ts.map +1 -0
  236. package/dist/client/router-ref.d.ts +2 -2
  237. package/dist/client/router-ref.d.ts.map +1 -1
  238. package/dist/client/router-skew.d.ts +21 -0
  239. package/dist/client/router-skew.d.ts.map +1 -0
  240. package/dist/client/router-types.d.ts +207 -0
  241. package/dist/client/router-types.d.ts.map +1 -0
  242. package/dist/client/router.d.ts +1 -97
  243. package/dist/client/router.d.ts.map +1 -1
  244. package/dist/client/rsc-fetch.d.ts +113 -26
  245. package/dist/client/rsc-fetch.d.ts.map +1 -1
  246. package/dist/client/segment-cache.d.ts +107 -25
  247. package/dist/client/segment-cache.d.ts.map +1 -1
  248. package/dist/client/segment-outlet.d.ts +57 -0
  249. package/dist/client/segment-outlet.d.ts.map +1 -0
  250. package/dist/client/segment-update-context.d.ts +21 -0
  251. package/dist/client/segment-update-context.d.ts.map +1 -0
  252. package/dist/client/shallow-url.d.ts +10 -0
  253. package/dist/client/shallow-url.d.ts.map +1 -0
  254. package/dist/client/slot-context.d.ts +31 -0
  255. package/dist/client/slot-context.d.ts.map +1 -0
  256. package/dist/client/slot-outlet.d.ts +16 -0
  257. package/dist/client/slot-outlet.d.ts.map +1 -0
  258. package/dist/client/slot-provider.d.ts +25 -0
  259. package/dist/client/slot-provider.d.ts.map +1 -0
  260. package/dist/client/ssr-data.d.ts +21 -5
  261. package/dist/client/ssr-data.d.ts.map +1 -1
  262. package/dist/client/stale-client.d.ts +69 -0
  263. package/dist/client/stale-client.d.ts.map +1 -0
  264. package/dist/client/state.d.ts +14 -4
  265. package/dist/client/state.d.ts.map +1 -1
  266. package/dist/client/top-loader.d.ts +7 -6
  267. package/dist/client/top-loader.d.ts.map +1 -1
  268. package/dist/client/unload-guard.d.ts +5 -0
  269. package/dist/client/unload-guard.d.ts.map +1 -1
  270. package/dist/client/use-cookie.d.ts +12 -0
  271. package/dist/client/use-cookie.d.ts.map +1 -1
  272. package/dist/client/use-link-status.d.ts +5 -5
  273. package/dist/client/use-link-status.d.ts.map +1 -1
  274. package/dist/client/use-pathname.d.ts.map +1 -1
  275. package/dist/client/use-pending-navigation.d.ts +23 -0
  276. package/dist/client/use-pending-navigation.d.ts.map +1 -0
  277. package/dist/client/use-query-states.d.ts +10 -4
  278. package/dist/client/use-query-states.d.ts.map +1 -1
  279. package/dist/client/use-router.d.ts +2 -2
  280. package/dist/client/use-router.d.ts.map +1 -1
  281. package/dist/client/use-search-params.d.ts +12 -5
  282. package/dist/client/use-search-params.d.ts.map +1 -1
  283. package/dist/client/{use-params.d.ts → use-segment-params.d.ts} +29 -16
  284. package/dist/client/use-segment-params.d.ts.map +1 -0
  285. package/dist/codec.d.ts +69 -0
  286. package/dist/codec.d.ts.map +1 -0
  287. package/dist/codec.js +76 -0
  288. package/dist/codec.js.map +1 -0
  289. package/dist/config-types.d.ts +284 -0
  290. package/dist/config-types.d.ts.map +1 -0
  291. package/dist/config-validation.d.ts +51 -0
  292. package/dist/config-validation.d.ts.map +1 -0
  293. package/dist/content/index.d.ts +1 -10
  294. package/dist/content/index.d.ts.map +1 -1
  295. package/dist/content/index.js +0 -2
  296. package/dist/cookies/define-cookie.d.ts +58 -25
  297. package/dist/cookies/define-cookie.d.ts.map +1 -1
  298. package/dist/cookies/index.d.ts +2 -1
  299. package/dist/cookies/index.d.ts.map +1 -1
  300. package/dist/cookies/index.js +257 -36
  301. package/dist/cookies/index.js.map +1 -1
  302. package/dist/cookies/json-cookie.d.ts +64 -0
  303. package/dist/cookies/json-cookie.d.ts.map +1 -0
  304. package/dist/cookies/validation.d.ts +34 -0
  305. package/dist/cookies/validation.d.ts.map +1 -0
  306. package/dist/dev-tools/404-page.d.ts +50 -0
  307. package/dist/dev-tools/404-page.d.ts.map +1 -0
  308. package/dist/dev-tools/browser-logs.d.ts +40 -0
  309. package/dist/dev-tools/browser-logs.d.ts.map +1 -0
  310. package/dist/dev-tools/dev-page-shell.d.ts +78 -0
  311. package/dist/dev-tools/dev-page-shell.d.ts.map +1 -0
  312. package/dist/dev-tools/error-page.d.ts +32 -0
  313. package/dist/dev-tools/error-page.d.ts.map +1 -0
  314. package/dist/dev-tools/holding-server.d.ts +54 -0
  315. package/dist/dev-tools/holding-server.d.ts.map +1 -0
  316. package/dist/dev-tools/hydration-overlay.d.ts +11 -0
  317. package/dist/dev-tools/hydration-overlay.d.ts.map +1 -0
  318. package/dist/dev-tools/index.d.ts +31 -0
  319. package/dist/dev-tools/index.d.ts.map +1 -0
  320. package/dist/dev-tools/instrumentation.d.ts +59 -0
  321. package/dist/dev-tools/instrumentation.d.ts.map +1 -0
  322. package/dist/{server/dev-logger.d.ts → dev-tools/logger.d.ts} +1 -1
  323. package/dist/dev-tools/logger.d.ts.map +1 -0
  324. package/dist/{plugins/dev-logs.d.ts → dev-tools/logs.d.ts} +17 -3
  325. package/dist/dev-tools/logs.d.ts.map +1 -0
  326. package/dist/dev-tools/overlay.d.ts +91 -0
  327. package/dist/dev-tools/overlay.d.ts.map +1 -0
  328. package/dist/dev-tools/stack-classifier.d.ts +34 -0
  329. package/dist/dev-tools/stack-classifier.d.ts.map +1 -0
  330. package/dist/dev-tools/terminal.d.ts +28 -0
  331. package/dist/dev-tools/terminal.d.ts.map +1 -0
  332. package/dist/fonts/ast-walk.d.ts +68 -0
  333. package/dist/fonts/ast-walk.d.ts.map +1 -0
  334. package/dist/fonts/ast.d.ts +110 -6
  335. package/dist/fonts/ast.d.ts.map +1 -1
  336. package/dist/fonts/bundle.d.ts +50 -0
  337. package/dist/fonts/bundle.d.ts.map +1 -0
  338. package/dist/fonts/dev-middleware.d.ts +22 -0
  339. package/dist/fonts/dev-middleware.d.ts.map +1 -0
  340. package/dist/fonts/fallbacks.d.ts +0 -7
  341. package/dist/fonts/fallbacks.d.ts.map +1 -1
  342. package/dist/fonts/google.d.ts +4 -2
  343. package/dist/fonts/google.d.ts.map +1 -1
  344. package/dist/fonts/local.d.ts +4 -4
  345. package/dist/fonts/local.d.ts.map +1 -1
  346. package/dist/fonts/paths.d.ts +43 -0
  347. package/dist/fonts/paths.d.ts.map +1 -0
  348. package/dist/fonts/pipeline.d.ts +177 -0
  349. package/dist/fonts/pipeline.d.ts.map +1 -0
  350. package/dist/fonts/transform.d.ts +82 -0
  351. package/dist/fonts/transform.d.ts.map +1 -0
  352. package/dist/fonts/types.d.ts +47 -1
  353. package/dist/fonts/types.d.ts.map +1 -1
  354. package/dist/fonts/virtual-modules.d.ts +77 -0
  355. package/dist/fonts/virtual-modules.d.ts.map +1 -0
  356. package/dist/index.d.ts +50 -181
  357. package/dist/index.d.ts.map +1 -1
  358. package/dist/index.js +9805 -14134
  359. package/dist/index.js.map +1 -1
  360. package/dist/params/codec-registry.d.ts +26 -0
  361. package/dist/params/codec-registry.d.ts.map +1 -0
  362. package/dist/params/define-schema.d.ts +81 -0
  363. package/dist/params/define-schema.d.ts.map +1 -0
  364. package/dist/params/index.d.ts +5 -0
  365. package/dist/params/index.d.ts.map +1 -0
  366. package/dist/params/index.js +34 -0
  367. package/dist/params/index.js.map +1 -0
  368. package/dist/params/resolve-schema.d.ts +34 -0
  369. package/dist/params/resolve-schema.d.ts.map +1 -0
  370. package/dist/plugin-context.d.ts +276 -0
  371. package/dist/plugin-context.d.ts.map +1 -0
  372. package/dist/plugins/adapter-build.d.ts +21 -1
  373. package/dist/plugins/adapter-build.d.ts.map +1 -1
  374. package/dist/plugins/build-manifest.d.ts +7 -3
  375. package/dist/plugins/build-manifest.d.ts.map +1 -1
  376. package/dist/plugins/build-report.d.ts +47 -10
  377. package/dist/plugins/build-report.d.ts.map +1 -1
  378. package/dist/plugins/cache.d.ts +64 -0
  379. package/dist/plugins/cache.d.ts.map +1 -0
  380. package/dist/plugins/callsite-ast.d.ts +117 -0
  381. package/dist/plugins/callsite-ast.d.ts.map +1 -0
  382. package/dist/plugins/callsite-jsx.d.ts +35 -0
  383. package/dist/plugins/callsite-jsx.d.ts.map +1 -0
  384. package/dist/plugins/chunks.d.ts +11 -4
  385. package/dist/plugins/chunks.d.ts.map +1 -1
  386. package/dist/plugins/client-chunks.d.ts +40 -0
  387. package/dist/plugins/client-chunks.d.ts.map +1 -0
  388. package/dist/plugins/cloudflare-wasm.d.ts +21 -0
  389. package/dist/plugins/cloudflare-wasm.d.ts.map +1 -0
  390. package/dist/plugins/content.d.ts +1 -1
  391. package/dist/plugins/content.d.ts.map +1 -1
  392. package/dist/plugins/dev-server.d.ts +17 -1
  393. package/dist/plugins/dev-server.d.ts.map +1 -1
  394. package/dist/plugins/entries.d.ts +28 -4
  395. package/dist/plugins/entries.d.ts.map +1 -1
  396. package/dist/plugins/fonts.d.ts +16 -73
  397. package/dist/plugins/fonts.d.ts.map +1 -1
  398. package/dist/plugins/mdx.d.ts +1 -1
  399. package/dist/plugins/mdx.d.ts.map +1 -1
  400. package/dist/plugins/prebuilt-capture.d.ts +60 -0
  401. package/dist/plugins/prebuilt-capture.d.ts.map +1 -0
  402. package/dist/plugins/prebuilt-options-analysis.d.ts +40 -0
  403. package/dist/plugins/prebuilt-options-analysis.d.ts.map +1 -0
  404. package/dist/plugins/prebuilt.d.ts +82 -0
  405. package/dist/plugins/prebuilt.d.ts.map +1 -0
  406. package/dist/plugins/prerender-sugar.d.ts +42 -0
  407. package/dist/plugins/prerender-sugar.d.ts.map +1 -0
  408. package/dist/plugins/request-dep/analysis.d.ts +106 -0
  409. package/dist/plugins/request-dep/analysis.d.ts.map +1 -0
  410. package/dist/plugins/request-dep/index.d.ts +75 -0
  411. package/dist/plugins/request-dep/index.d.ts.map +1 -0
  412. package/dist/plugins/request-dep/origin.d.ts +61 -0
  413. package/dist/plugins/request-dep/origin.d.ts.map +1 -0
  414. package/dist/plugins/routing.d.ts +1 -1
  415. package/dist/plugins/routing.d.ts.map +1 -1
  416. package/dist/plugins/server-bundle.d.ts.map +1 -1
  417. package/dist/plugins/shims.d.ts +29 -5
  418. package/dist/plugins/shims.d.ts.map +1 -1
  419. package/dist/plugins/static-build.d.ts +218 -21
  420. package/dist/plugins/static-build.d.ts.map +1 -1
  421. package/dist/routing/codegen-shared.d.ts +26 -0
  422. package/dist/routing/codegen-shared.d.ts.map +1 -0
  423. package/dist/routing/codegen-types.d.ts +61 -0
  424. package/dist/routing/codegen-types.d.ts.map +1 -0
  425. package/dist/routing/codegen-write.d.ts +51 -0
  426. package/dist/routing/codegen-write.d.ts.map +1 -0
  427. package/dist/routing/codegen.d.ts +7 -2
  428. package/dist/routing/codegen.d.ts.map +1 -1
  429. package/dist/routing/collision-probe.d.ts +104 -0
  430. package/dist/routing/collision-probe.d.ts.map +1 -0
  431. package/dist/routing/collision-spaces.d.ts +26 -0
  432. package/dist/routing/collision-spaces.d.ts.map +1 -0
  433. package/dist/routing/convention-lint.d.ts +55 -0
  434. package/dist/routing/convention-lint.d.ts.map +1 -0
  435. package/dist/routing/export-detect.d.ts +72 -0
  436. package/dist/routing/export-detect.d.ts.map +1 -0
  437. package/dist/routing/file-cache.d.ts +8 -0
  438. package/dist/routing/file-cache.d.ts.map +1 -0
  439. package/dist/routing/index.d.ts +7 -1
  440. package/dist/routing/index.d.ts.map +1 -1
  441. package/dist/routing/index.js +5 -2
  442. package/dist/routing/interception.d.ts +234 -10
  443. package/dist/routing/interception.d.ts.map +1 -1
  444. package/dist/routing/link-codegen.d.ts +105 -0
  445. package/dist/routing/link-codegen.d.ts.map +1 -0
  446. package/dist/routing/manifest-codegen.d.ts +26 -0
  447. package/dist/routing/manifest-codegen.d.ts.map +1 -0
  448. package/dist/routing/scanner.d.ts +1 -10
  449. package/dist/routing/scanner.d.ts.map +1 -1
  450. package/dist/routing/schema-validation.d.ts +35 -0
  451. package/dist/routing/schema-validation.d.ts.map +1 -0
  452. package/dist/routing/segment-classify.d.ts +114 -0
  453. package/dist/routing/segment-classify.d.ts.map +1 -0
  454. package/dist/routing/segment-codegen.d.ts +38 -0
  455. package/dist/routing/segment-codegen.d.ts.map +1 -0
  456. package/dist/routing/segment-keys.d.ts +118 -0
  457. package/dist/routing/segment-keys.d.ts.map +1 -0
  458. package/dist/routing/slot-placement.d.ts +48 -0
  459. package/dist/routing/slot-placement.d.ts.map +1 -0
  460. package/dist/routing/types.d.ts +74 -26
  461. package/dist/routing/types.d.ts.map +1 -1
  462. package/dist/routing/walkers.d.ts +57 -0
  463. package/dist/routing/walkers.d.ts.map +1 -0
  464. package/dist/rsc-runtime/rsc.d.ts +1 -1
  465. package/dist/rsc-runtime/rsc.d.ts.map +1 -1
  466. package/dist/rsc-runtime/ssr.d.ts +12 -0
  467. package/dist/rsc-runtime/ssr.d.ts.map +1 -1
  468. package/dist/schema-bridge.d.ts +145 -0
  469. package/dist/schema-bridge.d.ts.map +1 -0
  470. package/dist/search-params/define.d.ts +262 -0
  471. package/dist/search-params/define.d.ts.map +1 -0
  472. package/dist/search-params/index.d.ts +3 -7
  473. package/dist/search-params/index.d.ts.map +1 -1
  474. package/dist/search-params/index.js +179 -360
  475. package/dist/search-params/index.js.map +1 -1
  476. package/dist/search-params/parse-total.d.ts +81 -0
  477. package/dist/search-params/parse-total.d.ts.map +1 -0
  478. package/dist/search-params/serialize-equal.d.ts +9 -0
  479. package/dist/search-params/serialize-equal.d.ts.map +1 -0
  480. package/dist/search-params/wrappers.d.ts +76 -0
  481. package/dist/search-params/wrappers.d.ts.map +1 -0
  482. package/dist/server/access-gate.d.ts +26 -10
  483. package/dist/server/access-gate.d.ts.map +1 -1
  484. package/dist/server/action-client.d.ts +42 -7
  485. package/dist/server/action-client.d.ts.map +1 -1
  486. package/dist/server/action-encryption.d.ts +76 -0
  487. package/dist/server/action-encryption.d.ts.map +1 -0
  488. package/dist/server/action-handler.d.ts +35 -1
  489. package/dist/server/action-handler.d.ts.map +1 -1
  490. package/dist/server/actions.d.ts +12 -33
  491. package/dist/server/actions.d.ts.map +1 -1
  492. package/dist/server/als-registry.d.ts +115 -11
  493. package/dist/server/als-registry.d.ts.map +1 -1
  494. package/dist/server/asset-headers.d.ts +8 -18
  495. package/dist/server/asset-headers.d.ts.map +1 -1
  496. package/dist/server/body-limits.d.ts.map +1 -1
  497. package/dist/server/build-manifest.d.ts +25 -30
  498. package/dist/server/build-manifest.d.ts.map +1 -1
  499. package/dist/server/canonicalize.d.ts +10 -0
  500. package/dist/server/canonicalize.d.ts.map +1 -1
  501. package/dist/server/chain-url-parts.d.ts +82 -0
  502. package/dist/server/chain-url-parts.d.ts.map +1 -0
  503. package/dist/server/children-interception.d.ts +49 -0
  504. package/dist/server/children-interception.d.ts.map +1 -0
  505. package/dist/server/coalesce-tick.d.ts +40 -0
  506. package/dist/server/coalesce-tick.d.ts.map +1 -0
  507. package/dist/server/compress.d.ts.map +1 -1
  508. package/dist/server/cookie-context.d.ts +170 -0
  509. package/dist/server/cookie-context.d.ts.map +1 -0
  510. package/dist/server/cookie-parsing.d.ts +65 -0
  511. package/dist/server/cookie-parsing.d.ts.map +1 -0
  512. package/dist/server/csrf.d.ts +3 -2
  513. package/dist/server/csrf.d.ts.map +1 -1
  514. package/dist/server/default-logger.d.ts +22 -0
  515. package/dist/server/default-logger.d.ts.map +1 -0
  516. package/dist/server/default-status-page.d.ts +45 -0
  517. package/dist/server/default-status-page.d.ts.map +1 -0
  518. package/dist/server/deny-boundary.d.ts +247 -0
  519. package/dist/server/deny-boundary.d.ts.map +1 -0
  520. package/dist/server/deny-renderer.d.ts +16 -5
  521. package/dist/server/deny-renderer.d.ts.map +1 -1
  522. package/dist/server/dev-source-map.d.ts +22 -0
  523. package/dist/server/dev-source-map.d.ts.map +1 -0
  524. package/dist/server/early-hints-sender.d.ts.map +1 -1
  525. package/dist/server/early-hints.d.ts +13 -11
  526. package/dist/server/early-hints.d.ts.map +1 -1
  527. package/dist/server/error-boundary-wrapper.d.ts +86 -10
  528. package/dist/server/error-boundary-wrapper.d.ts.map +1 -1
  529. package/dist/server/fallback-error.d.ts +12 -7
  530. package/dist/server/fallback-error.d.ts.map +1 -1
  531. package/dist/server/flight-injection-state.d.ts +66 -0
  532. package/dist/server/flight-injection-state.d.ts.map +1 -0
  533. package/dist/server/flight-scripts.d.ts +42 -0
  534. package/dist/server/flight-scripts.d.ts.map +1 -0
  535. package/dist/server/form-data.d.ts +41 -0
  536. package/dist/server/form-data.d.ts.map +1 -1
  537. package/dist/server/head-response.d.ts +35 -0
  538. package/dist/server/head-response.d.ts.map +1 -0
  539. package/dist/server/html-injector-core.d.ts +242 -0
  540. package/dist/server/html-injector-core.d.ts.map +1 -0
  541. package/dist/server/html-injectors.d.ts +82 -41
  542. package/dist/server/html-injectors.d.ts.map +1 -1
  543. package/dist/server/index.d.ts +11 -47
  544. package/dist/server/index.d.ts.map +1 -1
  545. package/dist/server/index.js +183 -2906
  546. package/dist/server/index.js.map +1 -1
  547. package/dist/server/internal.d.ts +51 -0
  548. package/dist/server/internal.d.ts.map +1 -0
  549. package/dist/server/internal.js +4154 -0
  550. package/dist/server/internal.js.map +1 -0
  551. package/dist/server/logger.d.ts +39 -7
  552. package/dist/server/logger.d.ts.map +1 -1
  553. package/dist/server/metadata-collector.d.ts +74 -0
  554. package/dist/server/metadata-collector.d.ts.map +1 -0
  555. package/dist/server/metadata-routes.d.ts +60 -11
  556. package/dist/server/metadata-routes.d.ts.map +1 -1
  557. package/dist/server/metadata.d.ts +8 -0
  558. package/dist/server/metadata.d.ts.map +1 -1
  559. package/dist/server/middleware-runner.d.ts +19 -4
  560. package/dist/server/middleware-runner.d.ts.map +1 -1
  561. package/dist/server/node-stream-transforms.d.ts +119 -0
  562. package/dist/server/node-stream-transforms.d.ts.map +1 -0
  563. package/dist/server/param-coercion.d.ts +71 -0
  564. package/dist/server/param-coercion.d.ts.map +1 -0
  565. package/dist/server/pipeline-helpers.d.ts +77 -0
  566. package/dist/server/pipeline-helpers.d.ts.map +1 -0
  567. package/dist/server/pipeline-interception.d.ts +59 -9
  568. package/dist/server/pipeline-interception.d.ts.map +1 -1
  569. package/dist/server/pipeline-metadata.d.ts +6 -0
  570. package/dist/server/pipeline-metadata.d.ts.map +1 -1
  571. package/dist/server/pipeline-outcome.d.ts +49 -0
  572. package/dist/server/pipeline-outcome.d.ts.map +1 -0
  573. package/dist/server/pipeline-phases.d.ts +59 -0
  574. package/dist/server/pipeline-phases.d.ts.map +1 -0
  575. package/dist/server/pipeline.d.ts +152 -19
  576. package/dist/server/pipeline.d.ts.map +1 -1
  577. package/dist/server/port-resolution.d.ts +117 -0
  578. package/dist/server/port-resolution.d.ts.map +1 -0
  579. package/dist/server/prebuilt/cache-key.d.ts +63 -0
  580. package/dist/server/prebuilt/cache-key.d.ts.map +1 -0
  581. package/dist/server/prebuilt/capture-state.d.ts +57 -0
  582. package/dist/server/prebuilt/capture-state.d.ts.map +1 -0
  583. package/dist/server/prebuilt/key-discipline.d.ts +23 -0
  584. package/dist/server/prebuilt/key-discipline.d.ts.map +1 -0
  585. package/dist/server/prebuilt/manifest-tag-index.d.ts +27 -0
  586. package/dist/server/prebuilt/manifest-tag-index.d.ts.map +1 -0
  587. package/dist/server/prebuilt/overlay.d.ts +100 -0
  588. package/dist/server/prebuilt/overlay.d.ts.map +1 -0
  589. package/dist/server/prebuilt/payload-source.d.ts +79 -0
  590. package/dist/server/prebuilt/payload-source.d.ts.map +1 -0
  591. package/dist/server/prebuilt/slots.d.ts +99 -0
  592. package/dist/server/prebuilt/slots.d.ts.map +1 -0
  593. package/dist/server/prebuilt/synthetic-store.d.ts +67 -0
  594. package/dist/server/prebuilt/synthetic-store.d.ts.map +1 -0
  595. package/dist/server/prebuilt-builder.d.ts +121 -0
  596. package/dist/server/prebuilt-builder.d.ts.map +1 -0
  597. package/dist/server/prebuilt-runtime.d.ts +111 -0
  598. package/dist/server/prebuilt-runtime.d.ts.map +1 -0
  599. package/dist/server/primitives.d.ts +100 -44
  600. package/dist/server/primitives.d.ts.map +1 -1
  601. package/dist/server/publish-params.d.ts +33 -0
  602. package/dist/server/publish-params.d.ts.map +1 -0
  603. package/dist/server/render-timeout.d.ts +51 -0
  604. package/dist/server/render-timeout.d.ts.map +1 -0
  605. package/dist/server/render-utils.d.ts +25 -0
  606. package/dist/server/render-utils.d.ts.map +1 -0
  607. package/dist/server/request-context.d.ts +110 -106
  608. package/dist/server/request-context.d.ts.map +1 -1
  609. package/dist/server/request-dep.d.ts +15 -0
  610. package/dist/server/request-dep.d.ts.map +1 -0
  611. package/dist/server/route-element-builder.d.ts +74 -27
  612. package/dist/server/route-element-builder.d.ts.map +1 -1
  613. package/dist/server/route-handler.d.ts.map +1 -1
  614. package/dist/server/route-matcher.d.ts +38 -36
  615. package/dist/server/route-matcher.d.ts.map +1 -1
  616. package/dist/server/rsc-cache-key-guard.d.ts +78 -0
  617. package/dist/server/rsc-cache-key-guard.d.ts.map +1 -0
  618. package/dist/server/rsc-entry/action-middleware-runner.d.ts +66 -0
  619. package/dist/server/rsc-entry/action-middleware-runner.d.ts.map +1 -0
  620. package/dist/server/rsc-entry/api-handler.d.ts +12 -3
  621. package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
  622. package/dist/server/rsc-entry/deny-fallback.d.ts +29 -0
  623. package/dist/server/rsc-entry/deny-fallback.d.ts.map +1 -0
  624. package/dist/server/rsc-entry/error-renderer.d.ts +38 -13
  625. package/dist/server/rsc-entry/error-renderer.d.ts.map +1 -1
  626. package/dist/server/rsc-entry/helpers.d.ts +59 -42
  627. package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
  628. package/dist/server/rsc-entry/index.d.ts +39 -6
  629. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  630. package/dist/server/rsc-entry/render-route.d.ts +51 -0
  631. package/dist/server/rsc-entry/render-route.d.ts.map +1 -0
  632. package/dist/server/rsc-entry/revalidate-renderer.d.ts +108 -0
  633. package/dist/server/rsc-entry/revalidate-renderer.d.ts.map +1 -0
  634. package/dist/server/rsc-entry/rsc-payload.d.ts +5 -6
  635. package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
  636. package/dist/server/rsc-entry/rsc-stream.d.ts +40 -3
  637. package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
  638. package/dist/server/rsc-entry/ssr-bridge.d.ts +5 -1
  639. package/dist/server/rsc-entry/ssr-bridge.d.ts.map +1 -1
  640. package/dist/server/rsc-entry/ssr-renderer.d.ts +36 -4
  641. package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
  642. package/dist/server/rsc-entry/wrap-action-dispatch.d.ts +89 -0
  643. package/dist/server/rsc-entry/wrap-action-dispatch.d.ts.map +1 -0
  644. package/dist/server/safe-load.d.ts +46 -0
  645. package/dist/server/safe-load.d.ts.map +1 -0
  646. package/dist/server/sensitive-fields.d.ts +74 -0
  647. package/dist/server/sensitive-fields.d.ts.map +1 -0
  648. package/dist/server/sitemap-generator.d.ts +130 -0
  649. package/dist/server/sitemap-generator.d.ts.map +1 -0
  650. package/dist/server/sitemap-handler.d.ts +22 -0
  651. package/dist/server/sitemap-handler.d.ts.map +1 -0
  652. package/dist/server/skippable-prefix.d.ts +26 -0
  653. package/dist/server/skippable-prefix.d.ts.map +1 -0
  654. package/dist/server/slot-interception.d.ts +80 -0
  655. package/dist/server/slot-interception.d.ts.map +1 -0
  656. package/dist/server/slot-resolver.d.ts +139 -5
  657. package/dist/server/slot-resolver.d.ts.map +1 -1
  658. package/dist/server/ssr-bridge-types.d.ts +140 -0
  659. package/dist/server/ssr-bridge-types.d.ts.map +1 -0
  660. package/dist/server/ssr-entry.d.ts +1 -43
  661. package/dist/server/ssr-entry.d.ts.map +1 -1
  662. package/dist/server/ssr-render.d.ts +64 -21
  663. package/dist/server/ssr-render.d.ts.map +1 -1
  664. package/dist/server/ssr-wrappers.d.ts +61 -0
  665. package/dist/server/ssr-wrappers.d.ts.map +1 -0
  666. package/dist/server/state-tree-diff.d.ts +44 -9
  667. package/dist/server/state-tree-diff.d.ts.map +1 -1
  668. package/dist/server/static-generator.d.ts +112 -0
  669. package/dist/server/static-generator.d.ts.map +1 -0
  670. package/dist/server/static-not-found.d.ts +52 -0
  671. package/dist/server/static-not-found.d.ts.map +1 -0
  672. package/dist/server/status-code-resolver.d.ts +26 -15
  673. package/dist/server/status-code-resolver.d.ts.map +1 -1
  674. package/dist/server/stream-utils.d.ts +47 -0
  675. package/dist/server/stream-utils.d.ts.map +1 -0
  676. package/dist/server/tracing.d.ts +44 -9
  677. package/dist/server/tracing.d.ts.map +1 -1
  678. package/dist/server/tree-builder.d.ts +66 -42
  679. package/dist/server/tree-builder.d.ts.map +1 -1
  680. package/dist/server/tree-match.d.ts +49 -0
  681. package/dist/server/tree-match.d.ts.map +1 -0
  682. package/dist/server/types.d.ts +77 -6
  683. package/dist/server/types.d.ts.map +1 -1
  684. package/dist/server/utils/element-type.d.ts +40 -0
  685. package/dist/server/utils/element-type.d.ts.map +1 -0
  686. package/dist/server/utils/escape-html.d.ts +14 -0
  687. package/dist/server/utils/escape-html.d.ts.map +1 -0
  688. package/dist/server/utils/mdx-file.d.ts +15 -0
  689. package/dist/server/utils/mdx-file.d.ts.map +1 -0
  690. package/dist/server/version-skew.d.ts +61 -0
  691. package/dist/server/version-skew.d.ts.map +1 -0
  692. package/dist/server/workers-cache-bridge.d.ts +26 -0
  693. package/dist/server/workers-cache-bridge.d.ts.map +1 -0
  694. package/dist/shared/als-slots.d.ts +42 -0
  695. package/dist/shared/als-slots.d.ts.map +1 -0
  696. package/dist/shared/base-path.d.ts +56 -0
  697. package/dist/shared/base-path.d.ts.map +1 -0
  698. package/dist/shared/href-validation.d.ts +49 -0
  699. package/dist/shared/href-validation.d.ts.map +1 -0
  700. package/dist/shared/merge-search-params.d.ts +22 -0
  701. package/dist/shared/merge-search-params.d.ts.map +1 -0
  702. package/dist/shared/param-value.d.ts +104 -0
  703. package/dist/shared/param-value.d.ts.map +1 -0
  704. package/dist/shared/payload-root.d.ts +109 -0
  705. package/dist/shared/payload-root.d.ts.map +1 -0
  706. package/dist/shared/redirect-type.d.ts +17 -0
  707. package/dist/shared/redirect-type.d.ts.map +1 -0
  708. package/dist/shared/rsc-cache-key.d.ts +163 -0
  709. package/dist/shared/rsc-cache-key.d.ts.map +1 -0
  710. package/dist/shared/rsc-error-envelope.d.ts +25 -0
  711. package/dist/shared/rsc-error-envelope.d.ts.map +1 -0
  712. package/dist/shared/rsc-manifest.d.ts +28 -0
  713. package/dist/shared/rsc-manifest.d.ts.map +1 -0
  714. package/dist/shared/rsc-media-type.d.ts +40 -0
  715. package/dist/shared/rsc-media-type.d.ts.map +1 -0
  716. package/dist/shared/rsc-payload-path.d.ts +42 -0
  717. package/dist/shared/rsc-payload-path.d.ts.map +1 -0
  718. package/dist/shared/segment-info.d.ts +66 -0
  719. package/dist/shared/segment-info.d.ts.map +1 -0
  720. package/dist/shared/slot-params.d.ts +52 -0
  721. package/dist/shared/slot-params.d.ts.map +1 -0
  722. package/dist/shared/static-platform-files.d.ts +71 -0
  723. package/dist/shared/static-platform-files.d.ts.map +1 -0
  724. package/dist/shims/font-google.d.ts +1 -1
  725. package/dist/shims/font-google.d.ts.map +1 -1
  726. package/dist/shims/font-google.js +42 -0
  727. package/dist/shims/font-google.js.map +1 -0
  728. package/dist/shims/font-local.d.ts +26 -0
  729. package/dist/shims/font-local.d.ts.map +1 -0
  730. package/dist/shims/font-local.js +20 -0
  731. package/dist/shims/font-local.js.map +1 -0
  732. package/dist/shims/headers.d.ts +53 -1
  733. package/dist/shims/headers.d.ts.map +1 -1
  734. package/dist/shims/image.d.ts +120 -120
  735. package/dist/shims/image.d.ts.map +1 -1
  736. package/dist/shims/navigation-client.d.ts +25 -12
  737. package/dist/shims/navigation-client.d.ts.map +1 -1
  738. package/dist/shims/navigation.d.ts +10 -5
  739. package/dist/shims/navigation.d.ts.map +1 -1
  740. package/dist/utils/state-machine.d.ts +80 -0
  741. package/dist/utils/state-machine.d.ts.map +1 -0
  742. package/docs/api/30-api-server.mdx +233 -0
  743. package/docs/api/31-api-client.mdx +163 -0
  744. package/docs/api/32-api-cache.mdx +311 -0
  745. package/docs/api/33-api-search-params.mdx +176 -0
  746. package/docs/api/34-api-config.mdx +325 -0
  747. package/docs/api/35-api-typescript.mdx +170 -0
  748. package/docs/api/36-cli.mdx +170 -0
  749. package/docs/learn/00-introduction.mdx +109 -0
  750. package/docs/learn/01-quick-start.mdx +94 -0
  751. package/docs/learn/02-pages-and-layouts.mdx +147 -0
  752. package/docs/learn/03-fetching-data.mdx +211 -0
  753. package/docs/learn/03b-access-control.mdx +130 -0
  754. package/docs/learn/04-loading-states.mdx +67 -0
  755. package/docs/learn/04b-the-flush-point.mdx +115 -0
  756. package/docs/learn/05-typed-params.mdx +275 -0
  757. package/docs/learn/06-forms-and-actions.mdx +146 -0
  758. package/docs/learn/07-typed-routes.mdx +132 -0
  759. package/docs/learn/08-streaming.mdx +146 -0
  760. package/docs/learn/09-caching.mdx +252 -0
  761. package/docs/learn/10-middleware.mdx +157 -0
  762. package/docs/learn/11-error-handling.mdx +173 -0
  763. package/docs/learn/12-client-navigation.mdx +176 -0
  764. package/docs/learn/13-configuration.mdx +166 -0
  765. package/docs/learn/14-deploying.mdx +287 -0
  766. package/docs/more/01-advanced-routing.mdx +343 -0
  767. package/docs/more/02-advanced-forms.mdx +137 -0
  768. package/docs/more/03-coming-from-nextjs.mdx +186 -0
  769. package/docs/more/04-metadata-and-fonts.mdx +193 -0
  770. package/docs/more/04b-mdx.mdx +209 -0
  771. package/docs/more/05-content-collections.mdx +90 -0
  772. package/docs/more/06-instrumentation.mdx +214 -0
  773. package/docs/more/07-security.mdx +129 -0
  774. package/docs/more/08-developer-experience.mdx +134 -0
  775. package/docs/more/40-why-timber.mdx +50 -0
  776. package/docs/more/41-timber-vs-nextjs.mdx +81 -0
  777. package/docs/more/42-timber-vs-others.mdx +68 -0
  778. package/docs/more/50-ai-agent-instructions.mdx +171 -0
  779. package/llms.txt +55 -0
  780. package/package.json +108 -26
  781. package/src/adapters/build-output-helper.ts +351 -0
  782. package/src/adapters/cloudflare-dev.ts +177 -0
  783. package/src/adapters/cloudflare-kv-cache.ts +204 -0
  784. package/src/adapters/cloudflare.ts +740 -129
  785. package/src/adapters/compress-module.ts +101 -88
  786. package/src/adapters/fs-identity.ts +156 -0
  787. package/src/adapters/nitro.ts +320 -120
  788. package/src/adapters/raw-imports.d.ts +5 -0
  789. package/src/adapters/shared.ts +274 -0
  790. package/src/adapters/types.ts +28 -7
  791. package/src/adapters/wrangler.d.ts +7 -0
  792. package/src/cache/cache-api.ts +107 -0
  793. package/src/cache/fast-hash.ts +5 -0
  794. package/src/cache/handler-store.ts +76 -0
  795. package/src/cache/index.ts +114 -21
  796. package/src/cache/invalidation-epoch.ts +93 -0
  797. package/src/cache/json-lossy-check.ts +75 -0
  798. package/src/cache/redis-handler.ts +197 -19
  799. package/src/cache/singleflight.ts +64 -6
  800. package/src/cache/sizeof.ts +33 -0
  801. package/src/cache/stable-stringify.ts +65 -2
  802. package/src/cache/store.ts +71 -0
  803. package/src/cache/stores/cloudflare-kv.ts +52 -0
  804. package/src/cache/stores/memory.ts +125 -0
  805. package/src/cache/stores/redis.ts +97 -0
  806. package/src/cache/stores/vercel.ts +59 -0
  807. package/src/cache/tag-aware-handler.ts +237 -0
  808. package/src/cache/timber-cache.ts +161 -36
  809. package/src/cdn/cloudflare-purge.ts +50 -0
  810. package/src/cdn/fastly-purge.ts +63 -0
  811. package/src/cdn/headers.ts +153 -0
  812. package/src/cdn/index.ts +17 -0
  813. package/src/cdn/purge-store.ts +34 -0
  814. package/src/cdn/workers-cache-purge.ts +30 -0
  815. package/src/cli-check.ts +458 -0
  816. package/src/cli-schema-sync.ts +401 -0
  817. package/src/cli.ts +221 -53
  818. package/src/client/browser-dev.ts +156 -1
  819. package/src/client/browser-entry/action-dispatch.ts +130 -0
  820. package/src/client/browser-entry/hmr.ts +70 -0
  821. package/src/client/browser-entry/hydrate.ts +198 -0
  822. package/src/client/browser-entry/index.ts +121 -0
  823. package/src/client/browser-entry/post-hydration.ts +122 -0
  824. package/src/client/browser-entry/router-init.ts +342 -0
  825. package/src/client/browser-entry/rsc-stream.ts +166 -0
  826. package/src/client/browser-entry/scroll.ts +50 -0
  827. package/src/client/error-boundary.tsx +210 -36
  828. package/src/client/error-reconstituter.tsx +79 -0
  829. package/src/client/form.tsx +31 -32
  830. package/src/client/history.ts +29 -7
  831. package/src/client/index.ts +78 -45
  832. package/src/client/internal.ts +59 -0
  833. package/src/client/link.tsx +397 -150
  834. package/src/client/navigation-api.ts +345 -0
  835. package/src/client/navigation-commit.ts +197 -0
  836. package/src/client/navigation-context.ts +43 -62
  837. package/src/client/navigation-root.tsx +580 -0
  838. package/src/client/nuqs-adapter.tsx +16 -3
  839. package/src/client/params-context.ts +192 -0
  840. package/src/client/router-effects.ts +231 -0
  841. package/src/client/router-lifecycle.ts +288 -0
  842. package/src/client/router-pipeline.ts +393 -0
  843. package/src/client/router-ref.ts +2 -2
  844. package/src/client/router-skew.ts +30 -0
  845. package/src/client/router-types.ts +230 -0
  846. package/src/client/router.ts +339 -410
  847. package/src/client/rsc-fetch.ts +530 -73
  848. package/src/client/segment-cache.ts +224 -38
  849. package/src/client/segment-outlet.tsx +141 -0
  850. package/src/client/segment-update-context.ts +42 -0
  851. package/src/client/shallow-url.ts +22 -0
  852. package/src/client/slot-context.ts +50 -0
  853. package/src/client/slot-outlet.tsx +22 -0
  854. package/src/client/slot-provider.tsx +32 -0
  855. package/src/client/ssr-data.ts +21 -6
  856. package/src/client/stale-client.ts +191 -0
  857. package/src/client/state.ts +19 -5
  858. package/src/client/top-loader.tsx +13 -10
  859. package/src/client/unload-guard.ts +34 -2
  860. package/src/client/use-cookie.ts +69 -17
  861. package/src/client/use-link-status.ts +7 -7
  862. package/src/client/use-pathname.ts +1 -0
  863. package/src/client/use-pending-navigation.ts +40 -0
  864. package/src/client/use-query-states.ts +206 -36
  865. package/src/client/use-router.ts +5 -2
  866. package/src/client/use-search-params.ts +31 -44
  867. package/src/client/{use-params.ts → use-segment-params.ts} +52 -25
  868. package/src/codec.ts +149 -0
  869. package/src/config-types.ts +282 -0
  870. package/src/config-validation.ts +330 -0
  871. package/src/content/index.ts +5 -13
  872. package/src/cookies/define-cookie.ts +222 -53
  873. package/src/cookies/index.ts +12 -1
  874. package/src/cookies/json-cookie.ts +105 -0
  875. package/src/cookies/validation.ts +192 -0
  876. package/src/dev-tools/404-page.ts +286 -0
  877. package/src/dev-tools/browser-logs.ts +55 -0
  878. package/src/dev-tools/dev-page-shell.ts +260 -0
  879. package/src/dev-tools/error-page.ts +331 -0
  880. package/src/dev-tools/holding-server.ts +187 -0
  881. package/src/dev-tools/hydration-overlay.ts +158 -0
  882. package/src/dev-tools/index.ts +83 -0
  883. package/src/dev-tools/instrumentation.ts +213 -0
  884. package/src/{server/dev-logger.ts → dev-tools/logger.ts} +33 -51
  885. package/src/{plugins/dev-logs.ts → dev-tools/logs.ts} +122 -26
  886. package/src/dev-tools/overlay.ts +469 -0
  887. package/src/dev-tools/stack-classifier.ts +75 -0
  888. package/src/dev-tools/terminal.ts +182 -0
  889. package/src/fonts/ast-walk.ts +235 -0
  890. package/src/fonts/ast.ts +477 -126
  891. package/src/fonts/bundle.ts +138 -0
  892. package/src/fonts/dev-middleware.ts +85 -0
  893. package/src/fonts/fallbacks.ts +0 -23
  894. package/src/fonts/google.ts +100 -18
  895. package/src/fonts/local.ts +9 -8
  896. package/src/fonts/paths.ts +58 -0
  897. package/src/fonts/pipeline.ts +348 -0
  898. package/src/fonts/transform.ts +311 -0
  899. package/src/fonts/types.ts +52 -1
  900. package/src/fonts/virtual-modules.ts +179 -0
  901. package/src/index.ts +468 -353
  902. package/src/params/codec-registry.ts +34 -0
  903. package/src/params/define-schema.ts +115 -0
  904. package/src/params/index.ts +17 -0
  905. package/src/params/resolve-schema.ts +84 -0
  906. package/src/plugin-context.ts +503 -0
  907. package/src/plugins/adapter-build.ts +229 -7
  908. package/src/plugins/build-manifest.ts +201 -26
  909. package/src/plugins/build-report.ts +259 -47
  910. package/src/plugins/cache.ts +243 -0
  911. package/src/plugins/callsite-ast.ts +472 -0
  912. package/src/plugins/callsite-jsx.ts +243 -0
  913. package/src/plugins/chunks.ts +74 -5
  914. package/src/plugins/client-chunks.ts +185 -0
  915. package/src/plugins/cloudflare-wasm.ts +141 -0
  916. package/src/plugins/content.ts +1 -1
  917. package/src/plugins/dev-server.ts +284 -94
  918. package/src/plugins/entries.ts +138 -16
  919. package/src/plugins/fonts.ts +228 -660
  920. package/src/plugins/mdx.ts +47 -10
  921. package/src/plugins/prebuilt-capture.ts +217 -0
  922. package/src/plugins/prebuilt-options-analysis.ts +175 -0
  923. package/src/plugins/prebuilt.ts +655 -0
  924. package/src/plugins/prerender-sugar.ts +328 -0
  925. package/src/plugins/request-dep/analysis.ts +447 -0
  926. package/src/plugins/request-dep/index.ts +376 -0
  927. package/src/plugins/request-dep/origin.ts +310 -0
  928. package/src/plugins/routing.ts +268 -277
  929. package/src/plugins/server-bundle.ts +89 -12
  930. package/src/plugins/shims.ts +240 -64
  931. package/src/plugins/static-build.ts +704 -66
  932. package/src/routing/codegen-shared.ts +39 -0
  933. package/src/routing/codegen-types.ts +62 -0
  934. package/src/routing/codegen-write.ts +139 -0
  935. package/src/routing/codegen.ts +339 -231
  936. package/src/routing/collision-probe.ts +438 -0
  937. package/src/routing/collision-spaces.ts +281 -0
  938. package/src/routing/convention-lint.ts +493 -0
  939. package/src/routing/export-detect.ts +448 -0
  940. package/src/routing/file-cache.ts +23 -0
  941. package/src/routing/index.ts +10 -1
  942. package/src/routing/interception.ts +894 -67
  943. package/src/routing/link-codegen.ts +280 -0
  944. package/src/routing/manifest-codegen.ts +226 -0
  945. package/src/routing/scanner.ts +368 -218
  946. package/src/routing/schema-validation.ts +155 -0
  947. package/src/routing/segment-classify.ts +280 -0
  948. package/src/routing/segment-codegen.ts +98 -0
  949. package/src/routing/segment-keys.ts +186 -0
  950. package/src/routing/slot-placement.ts +97 -0
  951. package/src/routing/types.ts +75 -26
  952. package/src/routing/walkers.ts +98 -0
  953. package/src/rsc-runtime/rsc.ts +9 -0
  954. package/src/rsc-runtime/ssr.ts +50 -0
  955. package/src/rsc-runtime/vendor-types.d.ts +7 -0
  956. package/src/schema-bridge.ts +380 -0
  957. package/src/search-params/define.ts +677 -0
  958. package/src/search-params/index.ts +14 -20
  959. package/src/search-params/parse-total.ts +91 -0
  960. package/src/search-params/serialize-equal.ts +14 -0
  961. package/src/search-params/wrappers.ts +150 -0
  962. package/src/server/access-gate.tsx +121 -51
  963. package/src/server/action-client.ts +120 -29
  964. package/src/server/action-encryption.ts +144 -0
  965. package/src/server/action-handler.ts +230 -43
  966. package/src/server/actions.ts +54 -57
  967. package/src/server/als-registry.ts +159 -20
  968. package/src/server/asset-headers.ts +15 -37
  969. package/src/server/body-limits.ts +10 -2
  970. package/src/server/build-manifest.ts +33 -57
  971. package/src/server/canonicalize.ts +6 -3
  972. package/src/server/chain-url-parts.ts +163 -0
  973. package/src/server/children-interception.ts +115 -0
  974. package/src/server/coalesce-tick.ts +75 -0
  975. package/src/server/compress.ts +43 -8
  976. package/src/server/cookie-context.ts +484 -0
  977. package/src/server/cookie-parsing.ts +163 -0
  978. package/src/server/csrf.ts +39 -6
  979. package/src/server/default-logger.ts +99 -0
  980. package/src/server/default-status-page.ts +127 -0
  981. package/src/server/deny-boundary.ts +516 -0
  982. package/src/server/deny-renderer.ts +181 -101
  983. package/src/server/dev-source-map.ts +31 -0
  984. package/src/server/early-hints-sender.ts +3 -2
  985. package/src/server/early-hints.ts +37 -27
  986. package/src/server/error-boundary-wrapper.ts +170 -44
  987. package/src/server/fallback-error.ts +79 -102
  988. package/src/server/flight-injection-state.ts +113 -0
  989. package/src/server/flight-scripts.ts +62 -0
  990. package/src/server/form-data.ts +124 -12
  991. package/src/server/head-response.ts +54 -0
  992. package/src/server/html-injector-core.ts +495 -0
  993. package/src/server/html-injectors.ts +271 -254
  994. package/src/server/index.ts +32 -184
  995. package/src/server/internal.ts +181 -0
  996. package/src/server/logger.ts +72 -36
  997. package/src/server/metadata-collector.ts +189 -0
  998. package/src/server/metadata-routes.ts +205 -24
  999. package/src/server/metadata.ts +21 -0
  1000. package/src/server/middleware-runner.ts +31 -4
  1001. package/src/server/node-stream-transforms.ts +336 -0
  1002. package/src/server/param-coercion.ts +189 -0
  1003. package/src/server/pipeline-helpers.ts +159 -0
  1004. package/src/server/pipeline-interception.ts +109 -33
  1005. package/src/server/pipeline-metadata.ts +14 -0
  1006. package/src/server/pipeline-outcome.ts +196 -0
  1007. package/src/server/pipeline-phases.ts +599 -0
  1008. package/src/server/pipeline.ts +322 -382
  1009. package/src/server/port-resolution.ts +215 -0
  1010. package/src/server/prebuilt/cache-key.ts +299 -0
  1011. package/src/server/prebuilt/capture-state.ts +89 -0
  1012. package/src/server/prebuilt/key-discipline.ts +53 -0
  1013. package/src/server/prebuilt/manifest-tag-index.ts +46 -0
  1014. package/src/server/prebuilt/overlay.ts +256 -0
  1015. package/src/server/prebuilt/payload-source.ts +202 -0
  1016. package/src/server/prebuilt/slots.ts +190 -0
  1017. package/src/server/prebuilt/synthetic-store.ts +122 -0
  1018. package/src/server/prebuilt-builder.ts +804 -0
  1019. package/src/server/prebuilt-runtime.ts +817 -0
  1020. package/src/server/primitives.ts +174 -90
  1021. package/src/server/publish-params.ts +42 -0
  1022. package/src/server/render-timeout.ts +108 -0
  1023. package/src/server/render-utils.ts +31 -0
  1024. package/src/server/request-context.ts +243 -333
  1025. package/src/server/request-dep.ts +37 -0
  1026. package/src/server/route-element-builder.ts +666 -308
  1027. package/src/server/route-handler.ts +39 -12
  1028. package/src/server/route-matcher.ts +162 -269
  1029. package/src/server/rsc-cache-key-guard.ts +164 -0
  1030. package/src/server/rsc-entry/action-middleware-runner.ts +167 -0
  1031. package/src/server/rsc-entry/api-handler.ts +67 -32
  1032. package/src/server/rsc-entry/deny-fallback.ts +93 -0
  1033. package/src/server/rsc-entry/error-renderer.ts +370 -94
  1034. package/src/server/rsc-entry/helpers.ts +226 -95
  1035. package/src/server/rsc-entry/index.ts +357 -330
  1036. package/src/server/rsc-entry/render-route.ts +308 -0
  1037. package/src/server/rsc-entry/revalidate-renderer.ts +350 -0
  1038. package/src/server/rsc-entry/rsc-payload.ts +188 -55
  1039. package/src/server/rsc-entry/rsc-stream.ts +122 -18
  1040. package/src/server/rsc-entry/ssr-bridge.ts +18 -5
  1041. package/src/server/rsc-entry/ssr-renderer.ts +299 -80
  1042. package/src/server/rsc-entry/wrap-action-dispatch.ts +186 -0
  1043. package/src/server/safe-load.ts +60 -0
  1044. package/src/server/sensitive-fields.ts +230 -0
  1045. package/src/server/server-only-guard-noop.js +3 -0
  1046. package/src/server/sitemap-generator.ts +337 -0
  1047. package/src/server/sitemap-handler.ts +157 -0
  1048. package/src/server/skippable-prefix.ts +74 -0
  1049. package/src/server/slot-interception.ts +168 -0
  1050. package/src/server/slot-resolver.ts +678 -294
  1051. package/src/server/ssr-bridge-types.ts +145 -0
  1052. package/src/server/ssr-entry.ts +216 -78
  1053. package/src/server/ssr-render.ts +345 -82
  1054. package/src/server/ssr-wrappers.tsx +142 -0
  1055. package/src/server/state-tree-diff.ts +85 -30
  1056. package/src/server/static-generator.ts +715 -0
  1057. package/src/server/static-not-found.ts +134 -0
  1058. package/src/server/status-code-resolver.ts +107 -148
  1059. package/src/server/stream-utils.ts +288 -0
  1060. package/src/server/tracing.ts +126 -14
  1061. package/src/server/tree-builder.ts +99 -168
  1062. package/src/server/tree-match.ts +262 -0
  1063. package/src/server/types.ts +84 -9
  1064. package/src/server/utils/element-type.ts +72 -0
  1065. package/src/server/utils/escape-html.ts +20 -0
  1066. package/src/server/utils/mdx-file.ts +22 -0
  1067. package/src/server/version-skew.ts +104 -0
  1068. package/src/server/workers-cache-bridge.ts +33 -0
  1069. package/src/shared/als-slots.ts +74 -0
  1070. package/src/shared/base-path.ts +80 -0
  1071. package/src/shared/href-validation.ts +159 -0
  1072. package/src/shared/merge-search-params.ts +55 -0
  1073. package/src/shared/param-value.ts +281 -0
  1074. package/src/shared/payload-root.ts +152 -0
  1075. package/src/shared/redirect-type.ts +17 -0
  1076. package/src/shared/rsc-cache-key.ts +269 -0
  1077. package/src/shared/rsc-error-envelope.ts +31 -0
  1078. package/src/shared/rsc-manifest.ts +29 -0
  1079. package/src/shared/rsc-media-type.ts +43 -0
  1080. package/src/shared/rsc-payload-path.ts +45 -0
  1081. package/src/shared/segment-info.ts +67 -0
  1082. package/src/shared/slot-params.ts +110 -0
  1083. package/src/shared/static-platform-files.ts +75 -0
  1084. package/src/shims/font-google.ts +1 -1
  1085. package/src/shims/font-local.ts +34 -0
  1086. package/src/shims/headers.ts +122 -1
  1087. package/src/shims/navigation-client.ts +36 -32
  1088. package/src/shims/navigation.ts +10 -7
  1089. package/src/utils/state-machine.ts +111 -0
  1090. package/dist/_chunks/als-registry-B7DbZ2hS.js +0 -41
  1091. package/dist/_chunks/als-registry-B7DbZ2hS.js.map +0 -1
  1092. package/dist/_chunks/debug-B3Gypr3D.js +0 -108
  1093. package/dist/_chunks/debug-B3Gypr3D.js.map +0 -1
  1094. package/dist/_chunks/format-RyoGQL74.js +0 -164
  1095. package/dist/_chunks/format-RyoGQL74.js.map +0 -1
  1096. package/dist/_chunks/interception-BOoWmLUA.js +0 -676
  1097. package/dist/_chunks/interception-BOoWmLUA.js.map +0 -1
  1098. package/dist/_chunks/metadata-routes-Cjmvi3rQ.js +0 -153
  1099. package/dist/_chunks/metadata-routes-Cjmvi3rQ.js.map +0 -1
  1100. package/dist/_chunks/request-context-BQUC8PHn.js +0 -330
  1101. package/dist/_chunks/request-context-BQUC8PHn.js.map +0 -1
  1102. package/dist/_chunks/ssr-data-MjmprTmO.js.map +0 -1
  1103. package/dist/_chunks/tracing-CemImE6h.js +0 -187
  1104. package/dist/_chunks/tracing-CemImE6h.js.map +0 -1
  1105. package/dist/_chunks/use-cookie-DX-l1_5E.js +0 -91
  1106. package/dist/_chunks/use-cookie-DX-l1_5E.js.map +0 -1
  1107. package/dist/_chunks/use-query-states-D5KaffOK.js +0 -109
  1108. package/dist/_chunks/use-query-states-D5KaffOK.js.map +0 -1
  1109. package/dist/adapters/cloudflare.js.map +0 -1
  1110. package/dist/cache/index.js.map +0 -1
  1111. package/dist/cache/register-cached-function.d.ts +0 -17
  1112. package/dist/cache/register-cached-function.d.ts.map +0 -1
  1113. package/dist/client/browser-entry.d.ts +0 -21
  1114. package/dist/client/browser-entry.d.ts.map +0 -1
  1115. package/dist/client/error-boundary.js.map +0 -1
  1116. package/dist/client/head.d.ts +0 -16
  1117. package/dist/client/head.d.ts.map +0 -1
  1118. package/dist/client/link-status-provider.d.ts +0 -11
  1119. package/dist/client/link-status-provider.d.ts.map +0 -1
  1120. package/dist/client/segment-merger.d.ts +0 -119
  1121. package/dist/client/segment-merger.d.ts.map +0 -1
  1122. package/dist/client/stale-reload.d.ts +0 -44
  1123. package/dist/client/stale-reload.d.ts.map +0 -1
  1124. package/dist/client/transition-root.d.ts +0 -74
  1125. package/dist/client/transition-root.d.ts.map +0 -1
  1126. package/dist/client/use-navigation-pending.d.ts +0 -26
  1127. package/dist/client/use-navigation-pending.d.ts.map +0 -1
  1128. package/dist/client/use-params.d.ts.map +0 -1
  1129. package/dist/plugins/cache-transform.d.ts +0 -36
  1130. package/dist/plugins/cache-transform.d.ts.map +0 -1
  1131. package/dist/plugins/dev-error-overlay.d.ts +0 -60
  1132. package/dist/plugins/dev-error-overlay.d.ts.map +0 -1
  1133. package/dist/plugins/dev-logs.d.ts.map +0 -1
  1134. package/dist/plugins/dynamic-transform.d.ts +0 -72
  1135. package/dist/plugins/dynamic-transform.d.ts.map +0 -1
  1136. package/dist/plugins/server-action-exports.d.ts +0 -26
  1137. package/dist/plugins/server-action-exports.d.ts.map +0 -1
  1138. package/dist/routing/status-file-lint.d.ts +0 -33
  1139. package/dist/routing/status-file-lint.d.ts.map +0 -1
  1140. package/dist/search-params/analyze.d.ts +0 -54
  1141. package/dist/search-params/analyze.d.ts.map +0 -1
  1142. package/dist/search-params/builtin-codecs.d.ts +0 -105
  1143. package/dist/search-params/builtin-codecs.d.ts.map +0 -1
  1144. package/dist/search-params/codecs.d.ts +0 -53
  1145. package/dist/search-params/codecs.d.ts.map +0 -1
  1146. package/dist/search-params/create.d.ts +0 -106
  1147. package/dist/search-params/create.d.ts.map +0 -1
  1148. package/dist/search-params/registry.d.ts +0 -20
  1149. package/dist/search-params/registry.d.ts.map +0 -1
  1150. package/dist/server/client-module-map.d.ts +0 -47
  1151. package/dist/server/client-module-map.d.ts.map +0 -1
  1152. package/dist/server/dev-fetch-instrumentation.d.ts +0 -22
  1153. package/dist/server/dev-fetch-instrumentation.d.ts.map +0 -1
  1154. package/dist/server/dev-logger.d.ts.map +0 -1
  1155. package/dist/server/dev-span-processor.d.ts +0 -29
  1156. package/dist/server/dev-span-processor.d.ts.map +0 -1
  1157. package/dist/server/dev-warnings.d.ts +0 -129
  1158. package/dist/server/dev-warnings.d.ts.map +0 -1
  1159. package/dist/server/flush.d.ts +0 -74
  1160. package/dist/server/flush.d.ts.map +0 -1
  1161. package/dist/server/manifest-status-resolver.d.ts +0 -58
  1162. package/dist/server/manifest-status-resolver.d.ts.map +0 -1
  1163. package/dist/server/prerender.d.ts +0 -77
  1164. package/dist/server/prerender.d.ts.map +0 -1
  1165. package/dist/utils/directive-parser.d.ts +0 -70
  1166. package/dist/utils/directive-parser.d.ts.map +0 -1
  1167. package/src/cache/register-cached-function.ts +0 -103
  1168. package/src/client/browser-entry.ts +0 -678
  1169. package/src/client/head.ts +0 -61
  1170. package/src/client/link-status-provider.tsx +0 -30
  1171. package/src/client/segment-merger.ts +0 -339
  1172. package/src/client/stale-reload.ts +0 -87
  1173. package/src/client/transition-root.tsx +0 -166
  1174. package/src/client/use-navigation-pending.ts +0 -38
  1175. package/src/plugins/cache-transform.ts +0 -199
  1176. package/src/plugins/dev-error-overlay.ts +0 -230
  1177. package/src/plugins/dynamic-transform.ts +0 -161
  1178. package/src/plugins/server-action-exports.ts +0 -220
  1179. package/src/routing/status-file-lint.ts +0 -112
  1180. package/src/search-params/analyze.ts +0 -192
  1181. package/src/search-params/builtin-codecs.ts +0 -228
  1182. package/src/search-params/codecs.ts +0 -153
  1183. package/src/search-params/create.ts +0 -321
  1184. package/src/search-params/registry.ts +0 -31
  1185. package/src/server/client-module-map.ts +0 -58
  1186. package/src/server/dev-fetch-instrumentation.ts +0 -96
  1187. package/src/server/dev-span-processor.ts +0 -78
  1188. package/src/server/dev-warnings.ts +0 -283
  1189. package/src/server/flush.ts +0 -182
  1190. package/src/server/manifest-status-resolver.ts +0 -215
  1191. package/src/server/prerender.ts +0 -139
  1192. package/src/utils/directive-parser.ts +0 -529
@@ -0,0 +1,1436 @@
1
+ import { i as assertValidCookieValue, n as assertValidCookieName, r as assertValidCookieOptions, t as require_dist } from "./dist-BA3u1z3W.js";
2
+ import { o as traceAls, r as requestContextAls, s as waitUntilAls } from "./als-registry-C6kcfprT.js";
3
+ import { n as _setGetSegmentParamsFn, t as _setGetSearchParamsFn } from "./als-slots-BEEIPKYm.js";
4
+ import { r as appVisibleSearch } from "./rsc-cache-key-DD0fl_-s.js";
5
+ import { t as resolveSegmentParams } from "./slot-params-BCTmZkQB.js";
6
+ import { a as mergePreservedSearchParams, r as validateExternalRedirectUrl, t as assertRelativeRedirectPath } from "./href-validation-CMc5JRls.js";
7
+ import { randomUUID } from "node:crypto";
8
+ //#region src/server/tracing.ts
9
+ /**
10
+ * Tracing — per-request trace ID via AsyncLocalStorage, OTEL span helpers.
11
+ *
12
+ * getTraceId() is always available in server code (middleware, access, components, actions).
13
+ * Returns a 32-char lowercase hex string — the OTEL trace ID when an SDK is active,
14
+ * or a crypto.randomUUID()-derived fallback otherwise.
15
+ *
16
+ * See design/17-logging.md §"trace_id is Always Set"
17
+ */
18
+ /**
19
+ * Returns the current request's trace ID — always a 32-char lowercase hex string.
20
+ *
21
+ * With OTEL: the real OTEL trace ID (matches Jaeger/Honeycomb/Datadog).
22
+ * Without OTEL: crypto.randomUUID() with hyphens stripped.
23
+ *
24
+ * Throws if called outside a request context (no ALS store).
25
+ */
26
+ function getTraceId() {
27
+ const store = traceAls.getStore();
28
+ if (!store) throw new Error("[timber] getTraceId() called outside of a request context. It can only be used in middleware, access checks, server components, and server actions.");
29
+ return store.traceId;
30
+ }
31
+ /**
32
+ * Returns the current OTEL span ID if available, undefined otherwise.
33
+ */
34
+ function getSpanId() {
35
+ return traceAls.getStore()?.spanId;
36
+ }
37
+ /**
38
+ * Generate a 32-char lowercase hex ID from crypto.randomUUID().
39
+ * Same format as OTEL trace IDs — zero-friction upgrade path.
40
+ */
41
+ function generateTraceId() {
42
+ return randomUUID().replace(/-/g, "");
43
+ }
44
+ /**
45
+ * Run a callback within a trace context. Used by the pipeline to establish
46
+ * per-request ALS scope.
47
+ */
48
+ function runWithTraceId(id, fn) {
49
+ return traceAls.run({ traceId: id }, fn);
50
+ }
51
+ /**
52
+ * Replace the trace ID in the current ALS store. Used when OTEL creates
53
+ * a root span and we want to switch from the UUID fallback to the real
54
+ * OTEL trace ID.
55
+ */
56
+ function replaceTraceId(newTraceId, newSpanId) {
57
+ const store = traceAls.getStore();
58
+ if (store) {
59
+ store.traceId = newTraceId;
60
+ store.spanId = newSpanId;
61
+ }
62
+ }
63
+ /**
64
+ * Update the span ID in the current ALS store. Used when entering a new
65
+ * OTEL span to keep log–trace correlation accurate.
66
+ */
67
+ function updateSpanId(newSpanId) {
68
+ const store = traceAls.getStore();
69
+ if (store) store.spanId = newSpanId;
70
+ }
71
+ /**
72
+ * Get the current trace store, or undefined if outside a request context.
73
+ * Framework-internal — use getTraceId()/getSpanId() in user code.
74
+ */
75
+ function getTraceStore() {
76
+ return traceAls.getStore();
77
+ }
78
+ var PLATFORM_TRACER_KEY = Symbol.for("timber:platform-tracer");
79
+ /** The registered native platform tracer, if any. */
80
+ function getPlatformTracer() {
81
+ return globalThis[PLATFORM_TRACER_KEY];
82
+ }
83
+ /**
84
+ * Attempt to get the @opentelemetry/api tracer. Returns undefined if the
85
+ * package is not installed or no SDK is registered.
86
+ *
87
+ * timber.js depends on @opentelemetry/api as the vendor-neutral interface.
88
+ * The API is a no-op by default — spans are only emitted when the developer
89
+ * initializes an SDK in register().
90
+ */
91
+ var _otelApi;
92
+ async function getOtelApi() {
93
+ if (_otelApi === void 0) try {
94
+ _otelApi = await import("@opentelemetry/api");
95
+ } catch {
96
+ _otelApi = null;
97
+ }
98
+ return _otelApi;
99
+ }
100
+ /** OTEL tracer instance, lazily created. */
101
+ var _tracer;
102
+ /**
103
+ * Get the timber.js OTEL tracer. Returns null if @opentelemetry/api is not available.
104
+ */
105
+ async function getTracer() {
106
+ if (_tracer === void 0) {
107
+ const api = await getOtelApi();
108
+ if (api) _tracer = api.trace.getTracer("timber.js");
109
+ else _tracer = null;
110
+ }
111
+ return _tracer;
112
+ }
113
+ /**
114
+ * Run a function within a framework span. Composes two emission channels:
115
+ *
116
+ * - **Native platform span** — when an adapter registered a PlatformTracer
117
+ * (Cloudflare Workers), the fn is wrapped in platformTracer.enterSpan()
118
+ * so it appears in the platform's native trace view.
119
+ * - **OTEL span** — when an OTEL SDK is active, the fn also runs inside an
120
+ * OTEL span (dual emission). No SDK and no platform tracer = zero overhead.
121
+ *
122
+ * Automatically:
123
+ * - Creates the span as a child of the current context
124
+ * - Updates the ALS span ID for log–trace correlation
125
+ * - Ends the span when the function completes
126
+ * - Records exceptions on error (OTEL channel)
127
+ */
128
+ async function withSpan(name, attributes, fn) {
129
+ const platformTracer = getPlatformTracer();
130
+ if (!platformTracer) return runOtelSpan(name, attributes, fn);
131
+ return platformTracer.enterSpan(name, async (span) => {
132
+ for (const key of Object.keys(attributes)) span.setAttribute(key, attributes[key]);
133
+ const store = traceAls.getStore();
134
+ const prevPlatformSpan = store?.platformSpan;
135
+ if (store) store.platformSpan = span;
136
+ try {
137
+ return await runOtelSpan(name, attributes, fn);
138
+ } finally {
139
+ if (store) store.platformSpan = prevPlatformSpan;
140
+ }
141
+ });
142
+ }
143
+ /** The OTEL half of withSpan() — no-op passthrough when no SDK is active. */
144
+ async function runOtelSpan(name, attributes, fn) {
145
+ const tracer = await getTracer();
146
+ if (!tracer) return fn();
147
+ const api = await getOtelApi();
148
+ return tracer.startActiveSpan(name, { attributes }, async (span) => {
149
+ const prevSpanId = getSpanId();
150
+ updateSpanId(span.spanContext().spanId);
151
+ try {
152
+ const result = await fn();
153
+ span.setStatus({ code: api.SpanStatusCode.OK });
154
+ return result;
155
+ } catch (error) {
156
+ span.setStatus({ code: api.SpanStatusCode.ERROR });
157
+ if (error instanceof Error) span.recordException(error);
158
+ throw error;
159
+ } finally {
160
+ span.end();
161
+ updateSpanId(prevSpanId);
162
+ }
163
+ });
164
+ }
165
+ /**
166
+ * Set an attribute on the current active span (if any).
167
+ * Used for setting span attributes after span creation (e.g. timber.result on access spans).
168
+ */
169
+ async function setSpanAttribute(key, value) {
170
+ const platformSpan = traceAls.getStore()?.platformSpan;
171
+ if (platformSpan) platformSpan.setAttribute(key, value);
172
+ const api = await getOtelApi();
173
+ if (!api) return;
174
+ const activeSpan = api.trace.getActiveSpan();
175
+ if (activeSpan) activeSpan.setAttribute(key, value);
176
+ }
177
+ /**
178
+ * Add a span event to the current active span (if any).
179
+ * Used for timber.cache HIT/MISS events — recorded as span events, not child spans.
180
+ */
181
+ async function addSpanEvent(name, attributes) {
182
+ const api = await getOtelApi();
183
+ if (!api) return;
184
+ const activeSpan = api.trace.getActiveSpan();
185
+ if (activeSpan) activeSpan.addEvent(name, attributes);
186
+ }
187
+ /**
188
+ * Fire-and-forget span event — no await, no microtask overhead.
189
+ *
190
+ * Used on the cache hot path where awaiting addSpanEvent creates an
191
+ * unnecessary microtask per cache operation. If OTEL is not loaded yet,
192
+ * the event is silently dropped (acceptable for diagnostics).
193
+ *
194
+ * See TIM-370 for perf motivation.
195
+ */
196
+ function addSpanEventSync(name, attributes) {
197
+ if (!_otelApi) return;
198
+ const activeSpan = _otelApi.trace.getActiveSpan();
199
+ if (activeSpan) activeSpan.addEvent(name, attributes);
200
+ }
201
+ /**
202
+ * Try to extract the OTEL trace ID from the current active span context.
203
+ * Returns undefined if OTEL is not active or no span exists.
204
+ */
205
+ async function getOtelTraceId() {
206
+ const api = await getOtelApi();
207
+ if (!api) return void 0;
208
+ const activeSpan = api.trace.getActiveSpan();
209
+ if (!activeSpan) return void 0;
210
+ const ctx = activeSpan.spanContext();
211
+ if (!ctx.traceId || ctx.traceId === "00000000000000000000000000000000") return;
212
+ return {
213
+ traceId: ctx.traceId,
214
+ spanId: ctx.spanId
215
+ };
216
+ }
217
+ //#endregion
218
+ //#region src/server/debug.ts
219
+ /**
220
+ * Runtime debug flag for timber.js.
221
+ *
222
+ * Two distinct functions for two distinct security levels:
223
+ *
224
+ * ## `isDebug()` — server-side logging only
225
+ *
226
+ * Returns true when timber's debug/warning messages should be written to
227
+ * stderr / the server console. This NEVER affects what is sent to the
228
+ * client (no error details, no timing headers, no stack traces).
229
+ *
230
+ * Active when any of:
231
+ * - `NODE_ENV !== 'production'` (standard dev mode)
232
+ * - `TIMBER_DEBUG` env var is set to a truthy value at runtime
233
+ * - `timber.config.ts` has `debug: true`
234
+ *
235
+ * ## `isDevMode()` — client-visible dev behavior
236
+ *
237
+ * Returns true ONLY when `NODE_ENV !== 'production'`. This gates anything
238
+ * that changes what clients can observe:
239
+ * - Dev error pages with stack traces (fallback-error.ts)
240
+ * - Detailed Server-Timing headers (pipeline.ts)
241
+ * - Error messages in action INTERNAL_ERROR payloads (action-client.ts)
242
+ * - Pipeline error handler wiring (Vite overlay)
243
+ *
244
+ * `isDevMode()` is statically replaced in production builds → the guarded
245
+ * code is tree-shaken to zero bytes. TIMBER_DEBUG cannot enable it.
246
+ *
247
+ * Usage:
248
+ * In Cloudflare Workers wrangler.toml:
249
+ * [vars]
250
+ * TIMBER_DEBUG = "1"
251
+ *
252
+ * In Node.js:
253
+ * TIMBER_DEBUG=1 node server.js
254
+ *
255
+ * In timber.config.ts:
256
+ * export default { debug: true }
257
+ *
258
+ * See design/13-security.md for the security taxonomy.
259
+ * See design/18-build-system.md for build pipeline details.
260
+ */
261
+ /**
262
+ * Check if the application is running in development mode.
263
+ *
264
+ * This is the ONLY function that should gate client-visible dev behavior:
265
+ * - Dev error pages with stack traces
266
+ * - Server-Timing mode default (`'detailed'` in dev, `'total'` in prod)
267
+ * - Error messages in action `INTERNAL_ERROR` payloads
268
+ * - Pipeline error handler wiring (Vite overlay)
269
+ *
270
+ * Returns `process.env.NODE_ENV !== 'production'`, which is statically
271
+ * replaced by the bundler in production builds. Code guarded by this
272
+ * function is tree-shaken to zero bytes in production.
273
+ *
274
+ * TIMBER_DEBUG does NOT enable this — that would leak server internals
275
+ * to clients. Use `isDebug()` for server-side-only logging.
276
+ */
277
+ function isDevMode() {
278
+ return process.env.NODE_ENV !== "production";
279
+ }
280
+ /**
281
+ * Config-level debug override. Set via `setDebugFromConfig()` during
282
+ * initialization when timber.config.ts has `debug: true`.
283
+ */
284
+ var _configDebug = false;
285
+ /**
286
+ * Check if timber debug logging is active (server-side only).
287
+ *
288
+ * Returns true if ANY of these conditions hold:
289
+ * - NODE_ENV is not 'production' (standard dev mode)
290
+ * - TIMBER_DEBUG environment variable is set to a truthy value at runtime
291
+ * - timber.config.ts has `debug: true`
292
+ *
293
+ * This function controls ONLY server-side logging — messages written to
294
+ * stderr or the server console. It NEVER affects client-visible behavior
295
+ * (error pages, response headers, action payloads). For client-visible
296
+ * behavior, use `isDevMode()`.
297
+ *
298
+ * The TIMBER_DEBUG check is deliberately written as a dynamic property
299
+ * access so bundlers cannot statically replace it.
300
+ */
301
+ function isDebug() {
302
+ if (process.env.NODE_ENV !== "production") return true;
303
+ if (_configDebug) return true;
304
+ return _readTimberDebugEnv();
305
+ }
306
+ /**
307
+ * Read TIMBER_DEBUG from the environment at runtime.
308
+ *
309
+ * Extracted to a separate function to:
310
+ * 1. Prevent bundler inlining (cross-module function calls are not inlined)
311
+ * 2. Handle platforms where `process` may not exist (Cloudflare Workers)
312
+ * 3. Support globalThis.__TIMBER_DEBUG for programmatic control
313
+ */
314
+ function _readTimberDebugEnv() {
315
+ if (globalThis.__TIMBER_DEBUG) return true;
316
+ try {
317
+ const val = typeof process !== "undefined" && process.env ? process.env["TIMBER_DEBUG"] : void 0;
318
+ if (val && val !== "0" && val !== "false") return true;
319
+ } catch {}
320
+ return false;
321
+ }
322
+ //#endregion
323
+ //#region src/server/error-formatter.ts
324
+ /**
325
+ * Error Formatter — rewrites SSR/RSC error messages to surface user code.
326
+ *
327
+ * When React or Vite throw errors during SSR, stack traces reference
328
+ * vendored dependency paths (e.g. `.vite/deps_ssr/@vitejs_plugin-rsc_vendor_...`)
329
+ * and mangled export names (`__vite_ssr_export_default__`). This module
330
+ * rewrites error messages and stack traces to point at user code instead.
331
+ *
332
+ * Dev-only — in production, errors go through the structured logger
333
+ * without formatting.
334
+ */
335
+ /**
336
+ * Patterns that identify internal Vite/RSC vendor paths in stack traces.
337
+ * These are replaced with human-readable labels.
338
+ */
339
+ var VENDOR_PATH_PATTERNS = [
340
+ {
341
+ pattern: /node_modules\/\.vite\/deps_ssr\/@vitejs_plugin-rsc_vendor_react-server-dom[^\s)]+/g,
342
+ replacement: "<react-server-dom>"
343
+ },
344
+ {
345
+ pattern: /node_modules\/\.vite\/deps_ssr\/@vitejs_plugin-rsc_vendor[^\s)]+/g,
346
+ replacement: "<rsc-vendor>"
347
+ },
348
+ {
349
+ pattern: /node_modules\/\.vite\/deps_ssr\/[^\s)]+/g,
350
+ replacement: "<vite-dep>"
351
+ },
352
+ {
353
+ pattern: /node_modules\/\.vite\/deps\/[^\s)]+/g,
354
+ replacement: "<vite-dep>"
355
+ }
356
+ ];
357
+ /**
358
+ * Patterns that identify Vite-mangled export names in error messages.
359
+ */
360
+ var MANGLED_NAME_PATTERNS = [{
361
+ pattern: /__vite_ssr_export_default__/g,
362
+ replacement: "<default export>"
363
+ }, {
364
+ pattern: /__vite_ssr_export_(\w+)__/g,
365
+ replacement: "<export $1>"
366
+ }];
367
+ /**
368
+ * Rewrite an error's message and stack to replace internal Vite paths
369
+ * and mangled names with human-readable labels.
370
+ */
371
+ function formatSsrError(error) {
372
+ if (!(error instanceof Error)) return String(error);
373
+ let message = error.message;
374
+ let stack = error.stack ?? "";
375
+ for (const { pattern, replacement } of MANGLED_NAME_PATTERNS) message = message.replace(pattern, replacement);
376
+ for (const { pattern, replacement } of VENDOR_PATH_PATTERNS) stack = stack.replace(pattern, replacement);
377
+ for (const { pattern, replacement } of MANGLED_NAME_PATTERNS) stack = stack.replace(pattern, replacement);
378
+ const hint = extractErrorHint(error.message);
379
+ const parts = [];
380
+ parts.push(message);
381
+ if (hint) parts.push(` → ${hint}`);
382
+ const userFrames = extractUserFrames(stack);
383
+ if (userFrames.length > 0) {
384
+ parts.push("");
385
+ parts.push(" User code in stack:");
386
+ for (const frame of userFrames) parts.push(` ${frame}`);
387
+ }
388
+ return parts.join("\n");
389
+ }
390
+ /**
391
+ * Extract a human-readable hint from common React/RSC error messages.
392
+ *
393
+ * React error messages contain useful information but the surrounding
394
+ * context (vendor paths, mangled names) obscures it. This extracts the
395
+ * actionable part as a one-line hint.
396
+ */
397
+ function extractErrorHint(message) {
398
+ if (message.match(/Functions cannot be passed directly to Client Components/)) {
399
+ const propMatch = message.match(/<[^>]*?\s(\w+)=\{function/);
400
+ if (propMatch) return `Prop "${propMatch[1]}" is a function — mark it "use server" or call it before passing`;
401
+ return "A function prop was passed to a Client Component — mark it \"use server\" or call it before passing";
402
+ }
403
+ if (message.includes("Objects are not valid as a React child")) return "An object was rendered as JSX children — convert to string or extract the value";
404
+ const nullRefMatch = message.match(/Cannot read propert(?:y|ies) of (undefined|null) \(reading '(\w+)'\)/);
405
+ if (nullRefMatch) return `Accessed .${nullRefMatch[2]} on ${nullRefMatch[1]} — check that the value exists`;
406
+ const notFnMatch = message.match(/(\w+) is not a function/);
407
+ if (notFnMatch) return `"${notFnMatch[1]}" is not a function — check imports and exports`;
408
+ if (message.includes("Element type is invalid")) return "A component resolved to undefined/null — check default exports and import paths";
409
+ if (message.includes("Invalid hook call")) return "A hook was called outside of a React component render. If this is a 'use client' component, ensure the directive is at the very top of the file (before any imports) and that @vitejs/plugin-rsc is loaded correctly. Barrel re-exports from non-'use client' files do not propagate the directive.";
410
+ return null;
411
+ }
412
+ /**
413
+ * Extract stack frames that reference user code (not node_modules,
414
+ * not framework internals).
415
+ *
416
+ * Returns at most 5 frames to keep output concise.
417
+ */
418
+ function extractUserFrames(stack) {
419
+ const lines = stack.split("\n");
420
+ const userFrames = [];
421
+ for (const line of lines) {
422
+ const trimmed = line.trim();
423
+ if (!trimmed.startsWith("at ")) continue;
424
+ if (trimmed.includes("node_modules") || trimmed.includes("<react-server-dom>") || trimmed.includes("<rsc-vendor>") || trimmed.includes("<vite-dep>") || trimmed.includes("node:internal")) continue;
425
+ userFrames.push(trimmed);
426
+ if (userFrames.length >= 5) break;
427
+ }
428
+ return userFrames;
429
+ }
430
+ //#endregion
431
+ //#region src/server/default-logger.ts
432
+ /**
433
+ * DefaultLogger — human-readable stderr logging when no custom logger is configured.
434
+ *
435
+ * Ships as the fallback so production deployments always have error visibility,
436
+ * even without an `instrumentation.ts` logger export. Output is one line per
437
+ * event, designed for `fly logs`, `kubectl logs`, Cloudflare dashboard tails, etc.
438
+ *
439
+ * Format:
440
+ * [timber] ERROR message key=value key=value trace_id=4bf92f35
441
+ * [timber] WARN message key=value key=value trace_id=4bf92f35
442
+ * [timber] INFO message method=GET path=/dashboard status=200 durationMs=43 trace_id=4bf92f35
443
+ *
444
+ * Behavior:
445
+ * - Suppressed entirely in dev mode (dev logging handles all output)
446
+ * - `debug` suppressed unless TIMBER_DEBUG is set
447
+ * - Replaced entirely when a custom logger is set via `setLogger()`
448
+ *
449
+ * See design/17-logging.md §"DefaultLogger"
450
+ */
451
+ /**
452
+ * Format data fields as `key=value` pairs for human-readable output.
453
+ * - `error` key is serialized via formatSsrError for stack trace cleanup
454
+ * - `trace_id` is truncated to 8 chars for readability (full ID in OTEL)
455
+ * - Other values are stringified inline
456
+ */
457
+ function formatDataFields(data) {
458
+ if (!data) return "";
459
+ const parts = [];
460
+ let traceId;
461
+ for (const [key, value] of Object.entries(data)) {
462
+ if (key === "trace_id") {
463
+ traceId = typeof value === "string" ? value : String(value);
464
+ continue;
465
+ }
466
+ if (key === "error") {
467
+ parts.push(`error=${formatSsrError(value)}`);
468
+ continue;
469
+ }
470
+ if (value === void 0 || value === null) continue;
471
+ parts.push(`${key}=${value}`);
472
+ }
473
+ if (traceId) parts.push(`trace_id=${traceId.slice(0, 8)}`);
474
+ return parts.length > 0 ? " " + parts.join(" ") : "";
475
+ }
476
+ /** Pad level string to fixed width for alignment. */
477
+ function padLevel(level) {
478
+ return level.padEnd(5);
479
+ }
480
+ function createDefaultLogger() {
481
+ return {
482
+ error(msg, data) {
483
+ const fields = formatDataFields(data);
484
+ process.stderr.write(`[timber] ${padLevel("ERROR")} ${msg}${fields}\n`);
485
+ },
486
+ warn(msg, data) {
487
+ const fields = formatDataFields(data);
488
+ process.stderr.write(`[timber] ${padLevel("WARN")} ${msg}${fields}\n`);
489
+ },
490
+ info(msg, data) {
491
+ if (isDevMode()) return;
492
+ if (!isDebug()) return;
493
+ const fields = formatDataFields(data);
494
+ process.stderr.write(`[timber] ${padLevel("INFO")} ${msg}${fields}\n`);
495
+ },
496
+ debug(msg, data) {
497
+ if (isDevMode()) return;
498
+ if (!isDebug()) return;
499
+ const fields = formatDataFields(data);
500
+ process.stderr.write(`[timber] ${padLevel("DEBUG")} ${msg}${fields}\n`);
501
+ }
502
+ };
503
+ }
504
+ //#endregion
505
+ //#region src/server/waituntil-bridge.ts
506
+ /**
507
+ * Per-request waitUntil bridge — ALS bridge for platform adapters.
508
+ *
509
+ * The generated entry point (Nitro, Cloudflare) wraps the handler with
510
+ * `runWithWaitUntil`, binding the platform's lifecycle extension function
511
+ * (e.g., h3's `event.waitUntil()` or CF's `ctx.waitUntil()`) for the
512
+ * request duration. The `waitUntil()` primitive reads from this ALS to
513
+ * dispatch background work to the correct platform API.
514
+ *
515
+ * Design doc: design/11-platform.md §"waitUntil()"
516
+ */
517
+ /**
518
+ * Get the current request's waitUntil function, if available.
519
+ *
520
+ * Returns undefined when no platform adapter has installed a waitUntil
521
+ * handler for the current request (e.g., on platforms that don't support
522
+ * lifecycle extension, or outside a request context).
523
+ */
524
+ function getWaitUntil() {
525
+ return waitUntilAls.getStore();
526
+ }
527
+ //#endregion
528
+ //#region src/server/cookie-parsing.ts
529
+ var import_dist = require_dist();
530
+ /**
531
+ * Parse a Cookie header string into a Map of name → value pairs.
532
+ * Follows RFC 6265 §4.2.1: cookies are semicolon-separated key=value pairs.
533
+ *
534
+ * Values are auto-decoded with `decodeURIComponent` so they round-trip
535
+ * losslessly with `getCookies().set()` (which auto-encodes). Malformed
536
+ * `%`-escapes from third-party cookies fall back to the raw byte sequence
537
+ * — the parser must be total over arbitrary inbound headers, including
538
+ * non-conforming values from other servers, browser extensions, etc.
539
+ */
540
+ function parseCookieHeader(header) {
541
+ const map = /* @__PURE__ */ new Map();
542
+ if (!header) return map;
543
+ const parsed = (0, import_dist.parseCookie)(header);
544
+ for (const name in parsed) {
545
+ const value = parsed[name];
546
+ if (value !== void 0) map.set(name, value);
547
+ }
548
+ return map;
549
+ }
550
+ /**
551
+ * Decode a single cookie value with `decodeURIComponent`, falling back to
552
+ * the raw byte sequence if the input contains a malformed `%`-escape.
553
+ *
554
+ * Used by both `parseCookieHeader` (incoming Cookie: header) and the
555
+ * `setRaw` forwarding path (outgoing Set-Cookie from upstream services).
556
+ * Total — never throws.
557
+ *
558
+ * cookie's internal decode has identical semantics but is not exported,
559
+ * so we keep this standalone helper.
560
+ */
561
+ function safeDecodeCookieValue(raw) {
562
+ try {
563
+ return decodeURIComponent(raw);
564
+ } catch {
565
+ return raw;
566
+ }
567
+ }
568
+ /**
569
+ * Serialize a CookieEntry into a Set-Cookie header value.
570
+ *
571
+ * Total — never throws. If the cookie package's serializer rejects
572
+ * the input (e.g. non-integer maxAge, forbidden chars in name/value),
573
+ * falls back to a minimal hand-rolled serialization so the response
574
+ * path is never interrupted by a codec error.
575
+ */
576
+ function serializeCookieEntry(entry) {
577
+ try {
578
+ return (0, import_dist.stringifySetCookie)({
579
+ name: entry.name,
580
+ value: entry.value,
581
+ domain: entry.options.domain,
582
+ path: entry.options.path,
583
+ expires: entry.options.expires,
584
+ maxAge: entry.options.maxAge,
585
+ httpOnly: entry.options.httpOnly,
586
+ secure: entry.options.secure,
587
+ sameSite: entry.options.sameSite,
588
+ partitioned: entry.options.partitioned
589
+ }, { encode: (v) => v });
590
+ } catch {
591
+ return serializeCookieEntryFallback(entry);
592
+ }
593
+ }
594
+ function serializeCookieEntryFallback(entry) {
595
+ const parts = [`${entry.name}=${entry.value}`];
596
+ const opts = entry.options;
597
+ if (opts.domain) parts.push(`Domain=${opts.domain}`);
598
+ if (opts.path) parts.push(`Path=${opts.path}`);
599
+ if (opts.expires) parts.push(`Expires=${opts.expires.toUTCString()}`);
600
+ if (opts.maxAge !== void 0) parts.push(`Max-Age=${opts.maxAge}`);
601
+ if (opts.httpOnly) parts.push("HttpOnly");
602
+ if (opts.secure) parts.push("Secure");
603
+ if (opts.sameSite) parts.push(`SameSite=${opts.sameSite.charAt(0).toUpperCase()}${opts.sameSite.slice(1)}`);
604
+ if (opts.partitioned) parts.push("Partitioned");
605
+ return parts.join("; ");
606
+ }
607
+ /**
608
+ * Parse a raw `Set-Cookie` header string into name, value, and options.
609
+ * Handles all standard attributes: Path, Domain, Max-Age, Expires,
610
+ * SameSite, Secure, HttpOnly, Partitioned.
611
+ *
612
+ * Does NOT apply DEFAULT_COOKIE_OPTIONS — the caller decides whether
613
+ * to merge defaults (e.g. `set()` does, but `setRaw()` should preserve
614
+ * the original header's intent).
615
+ */
616
+ function parseSetCookie(header) {
617
+ const parsed = (0, import_dist.parseSetCookie)(header, { decode: (v) => v });
618
+ if (!parsed.name) return null;
619
+ const options = {};
620
+ if (parsed.path !== void 0) options.path = parsed.path || "/";
621
+ if (parsed.domain !== void 0) options.domain = parsed.domain;
622
+ if (parsed.maxAge !== void 0 && Number.isFinite(parsed.maxAge)) options.maxAge = parsed.maxAge;
623
+ if (parsed.expires !== void 0) options.expires = parsed.expires;
624
+ if (parsed.sameSite !== void 0 && parsed.sameSite !== true) {
625
+ const sameSite = parsed.sameSite.toLowerCase();
626
+ if (sameSite === "strict" || sameSite === "lax" || sameSite === "none") options.sameSite = sameSite;
627
+ }
628
+ if (parsed.secure) options.secure = true;
629
+ if (parsed.httpOnly) options.httpOnly = true;
630
+ if (parsed.partitioned) options.partitioned = true;
631
+ return {
632
+ name: parsed.name,
633
+ value: parsed.value ?? "",
634
+ options
635
+ };
636
+ }
637
+ //#endregion
638
+ //#region src/server/cookie-context.ts
639
+ /**
640
+ * Cookie Context — per-request cookie API and on-the-wire helpers.
641
+ *
642
+ * Split out of `request-context.ts` (TIM-853) so the cookie subsystem
643
+ * — encoding contract, options grammar, parser, serializer, RYW map,
644
+ * and rerender seed — lives in one file. The headers/scope/params APIs
645
+ * stay in `request-context.ts` and call into this module via the
646
+ * exported helpers.
647
+ *
648
+ * See design/29-cookies.md for the encoding contract and read-your-own-
649
+ * writes semantics. See ONGOING_SECURITY.md H-3 (TIM-868) for the
650
+ * smuggling primitive that the encoding contract closes.
651
+ */
652
+ /**
653
+ * Returns a cookie accessor for the current request.
654
+ *
655
+ * Available in middleware, access checks, server components, and server actions.
656
+ * Throws if called outside a request context (security principle #2: no global fallback).
657
+ *
658
+ * Read methods (.get, .has, .getAll) are always available and reflect
659
+ * read-your-own-writes from .set() calls in the same request.
660
+ *
661
+ * Mutation methods (.set, .delete, .clear) are only available in mutable
662
+ * contexts (middleware.ts, server actions, route.ts handlers). Calling them
663
+ * in read-only contexts (access.ts, server components) throws.
664
+ *
665
+ * This is the escape hatch for direct cookie jar operations. For typed
666
+ * cookie access, use `defineCookie()` instead.
667
+ *
668
+ * See design/29-cookies.md
669
+ */
670
+ function getCookieJar() {
671
+ const store = requestContextAls.getStore();
672
+ if (!store) throw new Error("[timber] getCookieJar() called outside of a request context. It can only be used in middleware, access checks, server components, and server actions.");
673
+ if (!store.parsedCookies) store.parsedCookies = parseCookieHeader(store.cookieHeader);
674
+ const map = store.parsedCookies;
675
+ return {
676
+ get(name) {
677
+ return map.get(name);
678
+ },
679
+ has(name) {
680
+ return map.has(name);
681
+ },
682
+ getAll() {
683
+ return Array.from(map.entries()).map(([name, value]) => ({
684
+ name,
685
+ value
686
+ }));
687
+ },
688
+ get size() {
689
+ return map.size;
690
+ },
691
+ set(name, value, options) {
692
+ assertMutable(store, "set");
693
+ assertValidCookieName(name);
694
+ if (typeof value !== "string") throw new Error(`[timber] getCookieJar().set(${JSON.stringify(name)}, …): value must be a string, got ${typeof value}.\n To store a JSON-serializable value, use defineCookie + jsonCookieCodec:\n\n import { defineCookie, jsonCookieCodec } from '@timber-js/app/cookies';\n\n export const ${name}Cookie = defineCookie(${JSON.stringify(name)}, {\n codec: jsonCookieCodec(),\n });\n\n ${name}Cookie.set(value);\n\n See design/29-cookies.md §"Typed Cookies with Schema Validation".`);
695
+ const raw = options?.raw === true;
696
+ const wireValue = raw ? value : encodeURIComponent(value);
697
+ if (raw) assertValidCookieValue(name, wireValue);
698
+ if (store.flushed) {
699
+ if (isDebug()) console.warn(`[timber] warn: getCookieJar().set('${name}') called after response headers were committed.\n The cookie will NOT be sent. Move cookie mutations to middleware.ts, a server action,\n or a route.ts handler.`);
700
+ return;
701
+ }
702
+ const { raw: _raw, ...attributeOptions } = options ?? {};
703
+ const opts = {
704
+ ...DEFAULT_COOKIE_OPTIONS,
705
+ ...attributeOptions
706
+ };
707
+ assertValidCookieOptions(opts);
708
+ store.cookieJar.set(name, {
709
+ name,
710
+ value: wireValue,
711
+ options: opts
712
+ });
713
+ map.set(name, raw ? wireValue : value);
714
+ },
715
+ setFromHeaders(headers) {
716
+ assertMutable(store, "setFromHeaders");
717
+ if (store.flushed) {
718
+ console.warn("[timber] warn: getCookieJar().setFromHeaders() called after response headers were committed.\n The cookies will NOT be sent. Move cookie mutations to middleware.ts, a server action,\n or a route.ts handler.");
719
+ return;
720
+ }
721
+ for (const raw of headers.getSetCookie()) {
722
+ const parsed = parseSetCookie(raw);
723
+ if (parsed) setRaw(store, map, parsed.name, parsed.value, parsed.options);
724
+ }
725
+ },
726
+ delete(name, options) {
727
+ assertMutable(store, "delete");
728
+ assertValidCookieName(name);
729
+ if (store.flushed) {
730
+ if (isDebug()) console.warn(`[timber] warn: getCookieJar().delete('${name}') called after response headers were committed.\n The cookie will NOT be deleted. Move cookie mutations to middleware.ts, a server action,\n or a route.ts handler.`);
731
+ return;
732
+ }
733
+ const opts = {
734
+ ...DEFAULT_COOKIE_OPTIONS,
735
+ ...options,
736
+ maxAge: 0,
737
+ expires: /* @__PURE__ */ new Date(0)
738
+ };
739
+ assertValidCookieOptions(opts);
740
+ store.cookieJar.set(name, {
741
+ name,
742
+ value: "",
743
+ options: opts
744
+ });
745
+ map.delete(name);
746
+ },
747
+ clear() {
748
+ assertMutable(store, "clear");
749
+ if (store.flushed) return;
750
+ for (const name of Array.from(map.keys())) store.cookieJar.set(name, {
751
+ name,
752
+ value: "",
753
+ options: {
754
+ ...DEFAULT_COOKIE_OPTIONS,
755
+ maxAge: 0,
756
+ expires: /* @__PURE__ */ new Date(0)
757
+ }
758
+ });
759
+ map.clear();
760
+ },
761
+ toString() {
762
+ return Array.from(map.entries()).map(([name, value]) => `${name}=${encodeURIComponent(value)}`).join("; ");
763
+ }
764
+ };
765
+ }
766
+ /**
767
+ * Returns the value of a single cookie, or undefined if absent.
768
+ *
769
+ * @internal — not part of the public API. Use `defineCookie().get()` or `getCookieJar().get()` instead.
770
+ */
771
+ function getCookie(name) {
772
+ return getCookieJar().get(name);
773
+ }
774
+ var DEFAULT_COOKIE_OPTIONS = {
775
+ path: "/",
776
+ httpOnly: true,
777
+ secure: true,
778
+ sameSite: "lax"
779
+ };
780
+ /**
781
+ * Per-request seed map of cookie name → value, registered out-of-band so the
782
+ * pipeline's `runWithRequestContext` call can pick it up without changing
783
+ * the function's calling convention. Stored in a WeakMap keyed by the
784
+ * synthetic Request object built for the rerender path, so the seed lives
785
+ * exactly as long as the request and is collected with it.
786
+ *
787
+ * The seed exists to eliminate the parse/serialize round-trip on the no-JS
788
+ * form-rerender path — see ONGOING_SECURITY.md H-3 (TIM-868). The action's
789
+ * post-mutation RYW snapshot is threaded directly into the rerender scope's
790
+ * `parsedCookies` map, bypassing `parseCookieHeader` entirely.
791
+ */
792
+ var seededRequestCookies = /* @__PURE__ */ new WeakMap();
793
+ /**
794
+ * Pop the seed (if any) for `req` and return it. Called from
795
+ * `runWithRequestContext` exactly once per request — the seed is consumed
796
+ * eagerly so it cannot leak into a hypothetical future re-use of the same
797
+ * Request reference.
798
+ *
799
+ * @internal — framework use only.
800
+ */
801
+ function consumeSeededCookies(req) {
802
+ const seed = seededRequestCookies.get(req);
803
+ if (seed) seededRequestCookies.delete(req);
804
+ return seed;
805
+ }
806
+ /**
807
+ * Collect all Set-Cookie headers from the cookie jar.
808
+ * Called by the framework at flush time to apply cookies to the response.
809
+ *
810
+ * Returns an array of serialized Set-Cookie header values.
811
+ */
812
+ function getSetCookieHeaders() {
813
+ const store = requestContextAls.getStore();
814
+ if (!store) return [];
815
+ return Array.from(store.cookieJar.values()).map(serializeCookieEntry);
816
+ }
817
+ /** Throw if cookie mutation is attempted in a read-only context. */
818
+ function assertMutable(store, method) {
819
+ if (!store.mutableContext) throw new Error(`[timber] getCookieJar().${method}() cannot be called in this context.\n Set cookies in middleware.ts, server actions, or route.ts handlers.`);
820
+ }
821
+ /**
822
+ * Write a cookie to the jar WITHOUT merging DEFAULT_COOKIE_OPTIONS.
823
+ * Used by setFromHeaders to preserve the original header's attributes exactly.
824
+ *
825
+ * For deletion cookies (maxAge=0), the jar entry is still created so the
826
+ * Set-Cookie header is emitted, but the cookie is NOT added to the read map
827
+ * (it would be misleading — the cookie is being deleted).
828
+ */
829
+ function setRaw(store, readMap, name, value, options) {
830
+ assertValidCookieName(name);
831
+ assertValidCookieValue(name, value);
832
+ assertValidCookieOptions(options);
833
+ store.cookieJar.set(name, {
834
+ name,
835
+ value,
836
+ options
837
+ });
838
+ if (options.maxAge === 0) readMap.delete(name);
839
+ else readMap.set(name, safeDecodeCookieValue(value));
840
+ }
841
+ //#endregion
842
+ //#region src/server/request-context.ts
843
+ /**
844
+ * Returns a read-only view of the current request's headers.
845
+ *
846
+ * Available in middleware, access checks, server components, and server actions.
847
+ * Throws if called outside a request context (security principle #2: no global fallback).
848
+ */
849
+ function getHeaders() {
850
+ const store = requestContextAls.getStore();
851
+ if (!store) throw new Error("[timber] getHeaders() called outside of a request context. It can only be used in middleware, access checks, server components, and server actions.");
852
+ return store.headers;
853
+ }
854
+ /**
855
+ * Returns the value of a single request header, or undefined if absent.
856
+ *
857
+ * Thin wrapper over `getHeaders().get(name)` for the common case where
858
+ * you need exactly one header.
859
+ *
860
+ * @internal — not part of the public API. Use `getHeaders().get(name)` instead.
861
+ */
862
+ function getHeader(name) {
863
+ return getHeaders().get(name) ?? void 0;
864
+ }
865
+ /**
866
+ * Returns the current request's raw URLSearchParams.
867
+ *
868
+ * @internal — not part of the public API. Use `defineSearchParams().get()` instead.
869
+ */
870
+ function getSearchParams() {
871
+ const store = requestContextAls.getStore();
872
+ if (!store) throw new Error("[timber] getSearchParams() called outside of a request context. It can only be used in middleware, access checks, server components, and server actions.");
873
+ return store.searchParams;
874
+ }
875
+ _setGetSearchParamsFn(getSearchParams);
876
+ _setGetSegmentParamsFn(getSegmentParams);
877
+ /**
878
+ * Returns the current request's coerced segment params.
879
+ *
880
+ * The optional `segmentPath` argument exists only for TypeScript narrowing —
881
+ * it does not affect the runtime return value. Pass a segment path
882
+ * (e.g. `'/(browse)/[artistSlug]/[year]'`) to narrow the return type to the
883
+ * exact params shape for that segment.
884
+ *
885
+ * Without an argument, returns all coerced params with optional types.
886
+ *
887
+ * See design/41-global-params.md §Function Signatures
888
+ */
889
+ function getSegmentParams(segmentPath) {
890
+ const store = requestContextAls.getStore();
891
+ if (!store) throw new Error("[timber] getSegmentParams() called outside of a request context. It can only be used in middleware, access checks, server components, and server actions.");
892
+ if (!store.segmentParams) throw new Error("[timber] getSegmentParams() called before route matching completed. Segment params are not available until after the route is matched.");
893
+ const slotResolved = resolveSegmentParams(store.segmentParams, store.slotParams, segmentPath);
894
+ if (slotResolved !== store.segmentParams) return slotResolved;
895
+ if (segmentPath && isDebug() && store.matchedSegmentPath) {
896
+ const expected = extractDynamicSegments(segmentPath);
897
+ const actual = extractDynamicSegments(store.matchedSegmentPath);
898
+ const missing = expected.filter((s) => !actual.includes(s));
899
+ if (missing.length > 0) console.warn(`[timber] getSegmentParams('${segmentPath}') called but current segment is '${store.matchedSegmentPath}'\n Missing params: ${missing.join(", ")}\n These will be undefined at runtime despite the type annotation.`);
900
+ }
901
+ return store.segmentParams;
902
+ }
903
+ /**
904
+ * Set the segment params on the current request context.
905
+ * Called by the pipeline after route matching and param coercion.
906
+ *
907
+ * @internal — framework use only
908
+ */
909
+ function setSegmentParams(params) {
910
+ const store = requestContextAls.getStore();
911
+ if (!store) throw new Error("[timber] setSegmentParams() called outside of a request context.");
912
+ store.segmentParams = params;
913
+ }
914
+ /**
915
+ * Store the matched segment path (e.g. '/(browse)/[artistSlug]/[year]') for
916
+ * dev-mode validation in getSegmentParams().
917
+ *
918
+ * @internal — framework use only
919
+ */
920
+ function setMatchedSegmentPath(segmentPath) {
921
+ const store = requestContextAls.getStore();
922
+ if (!store) return;
923
+ store.matchedSegmentPath = segmentPath;
924
+ }
925
+ /**
926
+ * Extract dynamic segment names from a route pattern.
927
+ * '/[artistSlug]/[year]' → ['artistSlug', 'year']
928
+ * '/docs/[...slug]' → ['slug']
929
+ */
930
+ function extractDynamicSegments(route) {
931
+ const segments = [];
932
+ const re = /\[{1,2}\.{0,3}(\w+)\]{1,2}/g;
933
+ let m;
934
+ while ((m = re.exec(route)) !== null) segments.push(m[1]);
935
+ return segments;
936
+ }
937
+ /**
938
+ * Returns the raw search string from the current request URL (e.g. "?foo=bar").
939
+ * Synchronous — safe for use in `redirect()` which throws synchronously.
940
+ *
941
+ * Returns empty string if called outside a request context (non-throwing for
942
+ * use in redirect's optional preserveSearchParams path).
943
+ *
944
+ * @internal — used by redirect() for preserveSearchParams support.
945
+ */
946
+ function getRequestSearchString() {
947
+ return requestContextAls.getStore()?.searchString ?? "";
948
+ }
949
+ /**
950
+ * Run a callback within a request context. Used by the pipeline to establish
951
+ * per-request ALS scope so that `getHeaders()` and `getCookies()` work.
952
+ *
953
+ * If the request was previously registered via `seedRequestCookies`, the
954
+ * resulting context's `parsedCookies` map is initialized from the seed and
955
+ * the raw `cookieHeader` is left empty — `parseCookieHeader` is never called
956
+ * for that request. This is the no-JS form-rerender path. See TIM-868.
957
+ *
958
+ * @param req - The incoming Request object.
959
+ * @param fn - The function to run within the request context.
960
+ */
961
+ function runWithRequestContext(req, fn) {
962
+ const originalCopy = new Headers(req.headers);
963
+ const appVisible = appVisibleSearch(new URL(req.url));
964
+ const seed = consumeSeededCookies(req);
965
+ const store = {
966
+ headers: freezeHeaders(req.headers),
967
+ originalHeaders: originalCopy,
968
+ cookieHeader: seed ? "" : req.headers.get("cookie") ?? "",
969
+ parsedCookies: seed,
970
+ searchParams: appVisible.params,
971
+ searchString: appVisible.search,
972
+ cookieJar: /* @__PURE__ */ new Map(),
973
+ flushed: false,
974
+ mutableContext: false
975
+ };
976
+ return requestContextAls.run(store, fn);
977
+ }
978
+ /**
979
+ * Enable cookie mutation for the current context. Called by the framework
980
+ * when entering middleware.ts, server actions, or route.ts handlers.
981
+ *
982
+ * See design/29-cookies.md §"Context Tracking"
983
+ */
984
+ function setMutableCookieContext(mutable) {
985
+ const store = requestContextAls.getStore();
986
+ if (store) store.mutableContext = mutable;
987
+ }
988
+ /**
989
+ * Mark the response as flushed (headers committed). After this point,
990
+ * cookie mutations log a warning instead of throwing.
991
+ *
992
+ * See design/29-cookies.md §"Streaming Constraint: Post-Flush Cookie Warning"
993
+ */
994
+ function markResponseFlushed() {
995
+ const store = requestContextAls.getStore();
996
+ if (store) store.flushed = true;
997
+ }
998
+ /**
999
+ * Apply middleware-injected request headers to the current request context.
1000
+ *
1001
+ * Called by the pipeline after middleware.ts runs. Merges overlay headers
1002
+ * on top of the original request headers so downstream code (access.ts,
1003
+ * server components, server actions) sees them via `getHeaders()`.
1004
+ *
1005
+ * The original request headers are never mutated — a new frozen Headers
1006
+ * object is created with the overlay applied on top.
1007
+ *
1008
+ * See design/07-routing.md §"Request Header Injection"
1009
+ */
1010
+ function applyRequestHeaderOverlay(overlay) {
1011
+ const store = requestContextAls.getStore();
1012
+ if (!store) throw new Error("[timber] applyRequestHeaderOverlay() called outside of a request context.");
1013
+ let hasOverlay = false;
1014
+ overlay.forEach(() => {
1015
+ hasOverlay = true;
1016
+ });
1017
+ if (!hasOverlay) return;
1018
+ const merged = new Headers(store.originalHeaders);
1019
+ overlay.forEach((value, key) => {
1020
+ merged.set(key, value);
1021
+ });
1022
+ store.headers = freezeHeaders(merged);
1023
+ }
1024
+ var MUTATING_METHODS = /* @__PURE__ */ new Set([
1025
+ "set",
1026
+ "append",
1027
+ "delete"
1028
+ ]);
1029
+ /**
1030
+ * Wrap a Headers object in a Proxy that throws on mutating methods.
1031
+ * Object.freeze doesn't work on Headers (native internal slots), so we
1032
+ * intercept property access and reject set/append/delete at runtime.
1033
+ *
1034
+ * Read methods (get, has, entries, etc.) must be bound to the underlying
1035
+ * Headers instance because they access private #headersList slots.
1036
+ */
1037
+ function freezeHeaders(source) {
1038
+ const copy = new Headers(source);
1039
+ return new Proxy(copy, { get(target, prop) {
1040
+ if (typeof prop === "string" && MUTATING_METHODS.has(prop)) return () => {
1041
+ throw new Error(`[timber] getHeaders() returns a read-only Headers object. Calling .${prop}() is not allowed. Use ctx.requestHeaders in middleware to inject headers for downstream components.`);
1042
+ };
1043
+ const value = Reflect.get(target, prop);
1044
+ if (typeof value === "function") return value.bind(target);
1045
+ return value;
1046
+ } });
1047
+ }
1048
+ //#endregion
1049
+ //#region src/server/primitives.ts
1050
+ /**
1051
+ * Check if a value is JSON-serializable without data loss.
1052
+ * Returns a description of the first non-serializable value found, or null if OK.
1053
+ *
1054
+ * @internal Exported for testing only.
1055
+ */
1056
+ function findNonSerializable(value, path = "data") {
1057
+ if (value === null || value === void 0) return null;
1058
+ switch (typeof value) {
1059
+ case "string":
1060
+ case "number":
1061
+ case "boolean": return null;
1062
+ case "bigint": return `${path} contains a BigInt — BigInt throws in JSON.stringify`;
1063
+ case "function": return `${path} is a function — functions are not JSON-serializable`;
1064
+ case "symbol": return `${path} is a symbol — symbols are not JSON-serializable`;
1065
+ case "object": break;
1066
+ default: return `${path} has unsupported type "${typeof value}"`;
1067
+ }
1068
+ if (value instanceof Date) return `${path} is a Date — Dates silently coerce to strings in JSON.stringify`;
1069
+ if (value instanceof Map) return `${path} is a Map — Maps serialize as {} in JSON.stringify (data loss)`;
1070
+ if (value instanceof Set) return `${path} is a Set — Sets serialize as {} in JSON.stringify (data loss)`;
1071
+ if (value instanceof RegExp) return `${path} is a RegExp — RegExps serialize as {} in JSON.stringify`;
1072
+ if (value instanceof Error) return `${path} is an Error — Errors serialize as {} in JSON.stringify`;
1073
+ if (Array.isArray(value)) {
1074
+ for (let i = 0; i < value.length; i++) {
1075
+ const result = findNonSerializable(value[i], `${path}[${i}]`);
1076
+ if (result) return result;
1077
+ }
1078
+ return null;
1079
+ }
1080
+ const proto = Object.getPrototypeOf(value);
1081
+ if (proto === null) return `${path} is a null-prototype object — React Flight rejects null prototypes`;
1082
+ if (proto !== Object.prototype) return `${path} is a ${value.constructor?.name ?? "unknown"} instance — class instances may lose data in JSON.stringify`;
1083
+ for (const key of Object.keys(value)) {
1084
+ const result = findNonSerializable(value[key], `${path}.${key}`);
1085
+ if (result) return result;
1086
+ }
1087
+ return null;
1088
+ }
1089
+ /**
1090
+ * Emit a dev-mode warning if data is not JSON-serializable.
1091
+ * No-op in production.
1092
+ */
1093
+ function warnIfNotSerializable(data, callerName) {
1094
+ if (!isDebug()) return;
1095
+ if (data === void 0) return;
1096
+ const issue = findNonSerializable(data);
1097
+ if (issue) console.warn(`[timber] ${callerName}: ${issue}. Data passed to deny() or RenderError must be JSON-serializable because the post-flush path uses JSON.stringify, not React Flight.`);
1098
+ }
1099
+ /**
1100
+ * Render-phase signal thrown by `deny()`. Caught by the framework to produce
1101
+ * the correct HTTP status code (segment context) or graceful degradation (slot context).
1102
+ */
1103
+ var DenySignal = class extends Error {
1104
+ status;
1105
+ data;
1106
+ /**
1107
+ * Segment key of the segment that owns the deny page matched for this
1108
+ * signal — set by a framework catch site that matched an entry it may not
1109
+ * render at its own position, and re-threw so the boundary at the owning
1110
+ * segment renders it instead.
1111
+ *
1112
+ * Written only by the three in-tree catch sites (`PageDenyBoundary`,
1113
+ * `TracedLayout`, `AccessGate`), never by user code. Two readers depend on
1114
+ * it: `TimberErrorBoundary`, which declines any deny whose `ownerKey` is
1115
+ * not its own `segmentKey`, and `buildRscPayloadResponse`, which keeps
1116
+ * streaming instead of re-rendering when it is set.
1117
+ *
1118
+ * See design/04-authorization.md §"Where a Deny Page Renders", TIM-1356.
1119
+ */
1120
+ ownerKey;
1121
+ /**
1122
+ * When true, the pipeline must respond with `rscErrorEnvelope` so the
1123
+ * client hard-navigates instead of attempting to render a deny page
1124
+ * from the RSC payload. Set by AccessGate when a skipped segment
1125
+ * denies — rendering the deny page in-tree would appear inside the
1126
+ * client's cached layout chrome (TIM-1074). See TIM-1363.
1127
+ */
1128
+ _hardNavigate;
1129
+ constructor(status, data) {
1130
+ super(`Access denied with status ${status}`);
1131
+ this.name = "DenySignal";
1132
+ this.status = status;
1133
+ this.data = data;
1134
+ }
1135
+ /**
1136
+ * Extract the file that called deny() from the stack trace.
1137
+ * Returns a short path (e.g. "app/auth/access.ts") or undefined if
1138
+ * the stack can't be parsed. Dev-only — used for dev log output.
1139
+ */
1140
+ get sourceFile() {
1141
+ if (!this.stack) return void 0;
1142
+ const frames = this.stack.split("\n");
1143
+ for (let i = 2; i < frames.length; i++) {
1144
+ const frame = frames[i];
1145
+ if (!frame) continue;
1146
+ if (frame.includes("primitives.ts") || frame.includes("node_modules")) continue;
1147
+ const match = frame.match(/\(([^)]+?)(?::\d+:\d+)\)/) ?? frame.match(/at\s+([^\s]+?)(?::\d+:\d+)/);
1148
+ if (match?.[1]) {
1149
+ const full = match[1];
1150
+ const appIdx = full.indexOf("/app/");
1151
+ return appIdx >= 0 ? full.slice(appIdx + 1) : full;
1152
+ }
1153
+ }
1154
+ }
1155
+ };
1156
+ /**
1157
+ * Universal denial/error primitive. Throws a `DenySignal` that the framework catches.
1158
+ *
1159
+ * - In segment context (outside Suspense): produces HTTP status code
1160
+ * - In slot context: graceful degradation → denied.tsx → default.tsx → null
1161
+ * - Inside Suspense (hold window): promoted to pre-flush behavior
1162
+ * - Inside Suspense (after flush): error boundary + noindex meta
1163
+ *
1164
+ * Supports both positional and object signatures:
1165
+ * ```ts
1166
+ * deny() // 403 (default)
1167
+ * deny(404) // 404
1168
+ * deny(503, { retry: true }) // 503 with data
1169
+ * deny({ status: 503, message: 'Maintenance' }) // object form
1170
+ * ```
1171
+ *
1172
+ * Accepts any 4xx or 5xx status code. This replaces the need for
1173
+ * `throw new RenderError(...)` in user code — RenderError is now an
1174
+ * internal pipeline detail.
1175
+ *
1176
+ * @param statusOrOptions - Status code (number) or options object. Default: 403.
1177
+ * @param data - Optional JSON-serializable data (positional form only).
1178
+ */
1179
+ function deny(statusOrOptions, data) {
1180
+ let status;
1181
+ let resolvedData;
1182
+ if (typeof statusOrOptions === "object" && statusOrOptions !== null) {
1183
+ status = statusOrOptions.status ?? 403;
1184
+ resolvedData = statusOrOptions.data;
1185
+ } else {
1186
+ status = statusOrOptions ?? 403;
1187
+ resolvedData = data;
1188
+ }
1189
+ if (status < 400 || status > 599) throw new Error(`deny() requires a 4xx or 5xx status code, got ${status}.`);
1190
+ warnIfNotSerializable(resolvedData, "deny()");
1191
+ throw new DenySignal(status, resolvedData);
1192
+ }
1193
+ /**
1194
+ * Render-phase signal thrown by `redirect()` and `redirectExternal()`.
1195
+ * Caught by the framework to produce a 3xx response or client-side navigation.
1196
+ */
1197
+ var RedirectSignal = class extends Error {
1198
+ location;
1199
+ status;
1200
+ constructor(location, status) {
1201
+ super(`Redirect to ${location}`);
1202
+ this.name = "RedirectSignal";
1203
+ this.location = location;
1204
+ this.status = status;
1205
+ }
1206
+ };
1207
+ /**
1208
+ * Returns true if the error is a framework control-flow signal (RedirectSignal
1209
+ * or DenySignal) rather than a genuine application error. Works both for direct
1210
+ * instances (RSC-side) and deserialized digest errors (SSR cross-boundary).
1211
+ *
1212
+ * See also: isFrameworkSignalError() in client/browser-dev.ts (client-only).
1213
+ */
1214
+ function isControlFlowSignal(error) {
1215
+ if (error instanceof DenySignal || error instanceof RedirectSignal) return true;
1216
+ if (error && typeof error === "object") {
1217
+ const digest = error.digest;
1218
+ if (typeof digest === "string") try {
1219
+ const parsed = JSON.parse(digest);
1220
+ if (parsed && typeof parsed === "object") return parsed.type === "redirect" || parsed.type === "deny";
1221
+ } catch {}
1222
+ }
1223
+ return false;
1224
+ }
1225
+ /**
1226
+ * Redirect to a relative path. Rejects absolute and protocol-relative URLs.
1227
+ * Use `redirectExternal()` for external redirects with an allow-list.
1228
+ *
1229
+ * @param path - Relative path (e.g. '/login', 'settings', '/login?returnTo=/dash')
1230
+ * @param statusOrOptions - HTTP status code (3xx, default 302) or options object.
1231
+ *
1232
+ * @example
1233
+ * // Simple redirect
1234
+ * redirect('/login');
1235
+ *
1236
+ * // With status code
1237
+ * redirect('/login', 301);
1238
+ *
1239
+ * // With preserved search params
1240
+ * redirect(`/docs/${version}/${slug}`, { preserveSearchParams: ['foo'] });
1241
+ */
1242
+ function redirect(path, statusOrOptions) {
1243
+ let status;
1244
+ let preserveSearchParams;
1245
+ if (typeof statusOrOptions === "number") status = statusOrOptions;
1246
+ else if (statusOrOptions) {
1247
+ status = statusOrOptions.status ?? (statusOrOptions.permanent ? 308 : 302);
1248
+ preserveSearchParams = statusOrOptions.preserveSearchParams;
1249
+ } else status = 302;
1250
+ if (status < 300 || status > 399) throw new Error(`redirect() requires a 3xx status code, got ${status}.`);
1251
+ assertRelativeRedirectPath(path);
1252
+ let resolvedPath = path;
1253
+ if (preserveSearchParams) resolvedPath = mergePreservedSearchParams(path, getRequestSearchString(), preserveSearchParams);
1254
+ throw new RedirectSignal(resolvedPath, status);
1255
+ }
1256
+ /**
1257
+ * Redirect to an external URL. The origin must be in the provided allow-list.
1258
+ *
1259
+ * Only http: and https: schemes are permitted. The allow-list is matched
1260
+ * against full origins (scheme + host + port), not bare hostnames.
1261
+ *
1262
+ * @param url - Absolute URL to redirect to.
1263
+ * @param allowList - Array of allowed origins (e.g. ['https://example.com', 'https://auth.example.com']).
1264
+ * @param status - HTTP redirect status code (3xx). Defaults to 302.
1265
+ */
1266
+ function redirectExternal(url, allowList, status = 302) {
1267
+ if (status < 300 || status > 399) throw new Error(`redirectExternal() requires a 3xx status code, got ${status}.`);
1268
+ throw new RedirectSignal(validateExternalRedirectUrl(url, allowList), status);
1269
+ }
1270
+ /**
1271
+ * Typed throw for render-phase errors that carry structured context to error boundaries.
1272
+ *
1273
+ * The `digest` (code + data) is serialized into the RSC stream separately from the
1274
+ * Error instance — only the digest crosses the RSC → client boundary.
1275
+ *
1276
+ * @example
1277
+ * ```ts
1278
+ * throw new RenderError('PRODUCT_NOT_FOUND', {
1279
+ * title: 'Product not found',
1280
+ * resourceId: params.id,
1281
+ * })
1282
+ * ```
1283
+ */
1284
+ var RenderError = class extends Error {
1285
+ code;
1286
+ digest;
1287
+ status;
1288
+ constructor(code, data, options) {
1289
+ super(`RenderError: ${code}`);
1290
+ this.name = "RenderError";
1291
+ this.code = code;
1292
+ this.digest = {
1293
+ code,
1294
+ data
1295
+ };
1296
+ warnIfNotSerializable(data, "RenderError");
1297
+ const status = options?.status ?? 500;
1298
+ if (status < 400 || status > 599) throw new Error(`RenderError status must be 4xx or 5xx, got ${status}.`);
1299
+ this.status = status;
1300
+ }
1301
+ };
1302
+ var _waitUntilWarned = false;
1303
+ /**
1304
+ * Register a promise to be kept alive after the response is sent.
1305
+ * Maps to `ctx.waitUntil()` on Cloudflare Workers and similar platforms.
1306
+ *
1307
+ * The platform adapter installs a per-request waitUntil function via ALS
1308
+ * (see waituntil-bridge.ts). If no ALS handler is available, a warning
1309
+ * is logged once and the promise is left to resolve (or reject) without
1310
+ * being tracked.
1311
+ *
1312
+ * @param promise - The background work to keep alive.
1313
+ */
1314
+ function waitUntil(promise) {
1315
+ const alsFn = getWaitUntil();
1316
+ if (alsFn) {
1317
+ alsFn(promise);
1318
+ return;
1319
+ }
1320
+ if (!_waitUntilWarned) {
1321
+ _waitUntilWarned = true;
1322
+ console.warn("[timber] waitUntil() is not supported by the current adapter. Background work will not be tracked. This warning is shown once.");
1323
+ }
1324
+ }
1325
+ //#endregion
1326
+ //#region src/server/logger.ts
1327
+ /**
1328
+ * Logger — structured logging with environment-aware formatting.
1329
+ *
1330
+ * timber.js ships a DefaultLogger that writes human-readable lines to stderr
1331
+ * in production. Users can export a custom logger from instrumentation.ts to
1332
+ * replace it with pino, winston, or any TimberLogger-compatible object.
1333
+ *
1334
+ * See design/17-logging.md §"Production Logging"
1335
+ */
1336
+ var _logger = createDefaultLogger();
1337
+ /**
1338
+ * Set the user-provided logger. Called by the instrumentation loader
1339
+ * when it finds a `logger` export in instrumentation.ts. Replaces
1340
+ * the DefaultLogger entirely.
1341
+ */
1342
+ function setLogger(logger) {
1343
+ _logger = logger;
1344
+ }
1345
+ /**
1346
+ * Get the current logger. Always non-null — returns DefaultLogger when
1347
+ * no custom logger is configured.
1348
+ */
1349
+ function getLogger() {
1350
+ return _logger;
1351
+ }
1352
+ /**
1353
+ * Inject trace_id and span_id into log data for log–trace correlation.
1354
+ * Always injects trace_id (never undefined). Injects span_id only when OTEL is active.
1355
+ */
1356
+ function withTraceContext(data) {
1357
+ const store = getTraceStore();
1358
+ const enriched = { ...data };
1359
+ if (store) {
1360
+ enriched.trace_id = store.traceId;
1361
+ if (store.spanId) enriched.span_id = store.spanId;
1362
+ }
1363
+ return enriched;
1364
+ }
1365
+ /** Log a completed request. Level: info. */
1366
+ function logRequestCompleted(data) {
1367
+ _logger.info("request completed", withTraceContext(data));
1368
+ }
1369
+ /** Log request received. Level: debug. */
1370
+ function logRequestReceived(data) {
1371
+ _logger.debug("request received", withTraceContext(data));
1372
+ }
1373
+ /** Log a slow request warning. Level: warn. */
1374
+ function logSlowRequest(data) {
1375
+ _logger.warn("slow request exceeded threshold", withTraceContext(data));
1376
+ }
1377
+ /** Log middleware short-circuit. Level: debug. */
1378
+ function logMiddlewareShortCircuit(data) {
1379
+ _logger.debug("middleware short-circuited", withTraceContext(data));
1380
+ }
1381
+ /** Log unhandled error in middleware phase. Level: error. */
1382
+ function logMiddlewareError(data) {
1383
+ if (isControlFlowSignal(data.error)) return;
1384
+ _logger.error("unhandled error in middleware phase", withTraceContext(data));
1385
+ }
1386
+ /** Log unhandled render-phase error. Level: error. */
1387
+ function logRenderError(data) {
1388
+ if (isControlFlowSignal(data.error)) return;
1389
+ _logger.error("unhandled render-phase error", withTraceContext(data));
1390
+ }
1391
+ /** Log proxy.ts uncaught error. Level: error. */
1392
+ function logProxyError(data) {
1393
+ _logger.error("proxy.ts threw uncaught error", withTraceContext(data));
1394
+ }
1395
+ /** Log unhandled error in route handler. Level: error. */
1396
+ function logRouteError(data) {
1397
+ if (isControlFlowSignal(data.error)) return;
1398
+ _logger.error("unhandled route handler error", withTraceContext(data));
1399
+ }
1400
+ /** Log waitUntil() adapter missing (once at startup). Level: warn. */
1401
+ function logWaitUntilUnsupported() {
1402
+ _logger.warn("adapter does not support waitUntil()");
1403
+ }
1404
+ /** Log waitUntil() promise rejection. Level: warn. */
1405
+ function logWaitUntilRejected(data) {
1406
+ _logger.warn("waitUntil() promise rejected", withTraceContext(data));
1407
+ }
1408
+ /** Log staleWhileRevalidate refetch failure. Level: warn. */
1409
+ function logSwrRefetchFailed(data) {
1410
+ _logger.warn("staleWhileRevalidate refetch failed", withTraceContext(data));
1411
+ }
1412
+ /** Log cache miss. Level: debug. */
1413
+ function logCacheMiss(data) {
1414
+ _logger.debug("timber.cache MISS", withTraceContext(data));
1415
+ }
1416
+ /**
1417
+ * Log an intentionally swallowed error. Provides observability into catch
1418
+ * blocks that are deliberately empty — the error is consumed, never rethrown.
1419
+ *
1420
+ * Default level: `warn` in dev (so the overlay surfaces patterns), `debug`
1421
+ * in production (low noise unless TIMBER_DEBUG is set). Pass `opts.level`
1422
+ * to override.
1423
+ *
1424
+ * **Infallible** — swallow() itself never throws, even if the logger is
1425
+ * broken. A thrown swallow would turn a benign catch into a crash.
1426
+ */
1427
+ function swallow(err, reason, opts) {
1428
+ try {
1429
+ const level = opts?.level ?? (isDevMode() ? "warn" : "debug");
1430
+ _logger[level](`swallowed: ${reason}`, withTraceContext({ error: err }));
1431
+ } catch {}
1432
+ }
1433
+ //#endregion
1434
+ export { setMatchedSegmentPath as A, addSpanEventSync as B, applyRequestHeaderOverlay as C, getSegmentParams as D, getSearchParams as E, getSetCookieHeaders as F, replaceTraceId as G, getOtelTraceId as H, getWaitUntil as I, withSpan as J, runWithTraceId as K, isDebug as L, setSegmentParams as M, getCookie as N, markResponseFlushed as O, getCookieJar as P, isDevMode as R, waitUntil as S, getHeaders as T, getSpanId as U, generateTraceId as V, getTraceId as W, RedirectSignal as _, logProxyError as a, redirect as b, logRequestReceived as c, logSwrRefetchFailed as d, logWaitUntilRejected as f, DenySignal as g, swallow as h, logMiddlewareShortCircuit as i, setMutableCookieContext as j, runWithRequestContext as k, logRouteError as l, setLogger as m, logCacheMiss as n, logRenderError as o, logWaitUntilUnsupported as p, setSpanAttribute as q, logMiddlewareError as r, logRequestCompleted as s, getLogger as t, logSlowRequest as u, RenderError as v, getHeader as w, redirectExternal as x, deny as y, addSpanEvent as z };
1435
+
1436
+ //# sourceMappingURL=logger-CH7IcMmg.js.map