@timber-js/app 0.2.0-alpha.234 → 0.2.0-alpha.236

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 (280) hide show
  1. package/dist/_chunks/{actions-CYjRMpZI.js → actions-Top9GftB.js} +3 -3
  2. package/dist/_chunks/{actions-CYjRMpZI.js.map → actions-Top9GftB.js.map} +1 -1
  3. package/dist/_chunks/{cache-api-BZJNt01a.js → cache-api-Bo8c7XVF.js} +6 -6
  4. package/dist/_chunks/{cache-api-BZJNt01a.js.map → cache-api-Bo8c7XVF.js.map} +1 -1
  5. package/dist/_chunks/{chains-D-RRc7CM.js → chains-BsGKkMTK.js} +2 -2
  6. package/dist/_chunks/{chains-D-RRc7CM.js.map → chains-BsGKkMTK.js.map} +1 -1
  7. package/dist/_chunks/chains-DHmoKxkO.js +1 -0
  8. package/dist/_chunks/{classify-_W0RWa5w.js → classify-cmE0Gins.js} +2 -2
  9. package/dist/_chunks/{classify-_W0RWa5w.js.map → classify-cmE0Gins.js.map} +1 -1
  10. package/dist/_chunks/{cli-check-BAKOSTkg.js → cli-check-BwiahbTC.js} +5 -5
  11. package/dist/_chunks/{cli-check-BAKOSTkg.js.map → cli-check-BwiahbTC.js.map} +1 -1
  12. package/dist/_chunks/{cli-context-BPdyA7Fp.js → cli-context-BbwVqarO.js} +1 -1
  13. package/dist/_chunks/{cli-context-CwTKMjVe.js → cli-context-DZh5v0yd.js} +2 -2
  14. package/dist/_chunks/{cli-context-CwTKMjVe.js.map → cli-context-DZh5v0yd.js.map} +1 -1
  15. package/dist/_chunks/{cli-schema-sync-CAllbqRB.js → cli-schema-sync-B2ldclRO.js} +3 -3
  16. package/dist/_chunks/{cli-schema-sync-CAllbqRB.js.map → cli-schema-sync-B2ldclRO.js.map} +1 -1
  17. package/dist/_chunks/{cli-schema-sync-y_8ijmzO.js → cli-schema-sync-Brw7kTmm.js} +1 -1
  18. package/dist/_chunks/{client-dep-entries-C9hv-3k9.js → client-dep-entries-C1nMlLKV.js} +2 -2
  19. package/dist/_chunks/{client-dep-entries-C9hv-3k9.js.map → client-dep-entries-C1nMlLKV.js.map} +1 -1
  20. package/dist/_chunks/{cloudflare-_2fhxQE8.js → cloudflare-Dk5Hqo-O.js} +3 -3
  21. package/dist/_chunks/{cloudflare-_2fhxQE8.js.map → cloudflare-Dk5Hqo-O.js.map} +1 -1
  22. package/dist/_chunks/{convention-lint-D54k6uUM.js → convention-lint-CLpuzY5h.js} +3 -3
  23. package/dist/_chunks/{convention-lint-D54k6uUM.js.map → convention-lint-CLpuzY5h.js.map} +1 -1
  24. package/dist/_chunks/dev-server-BGGGhHXx.js +1 -0
  25. package/dist/_chunks/{dev-server-Rq659RR1.js → dev-server-lrdpD7Ws.js} +122 -6
  26. package/dist/_chunks/dev-server-lrdpD7Ws.js.map +1 -0
  27. package/dist/_chunks/{dev-span-_NzMX-au.js → dev-span-RsVeYYc_.js} +5 -2
  28. package/dist/_chunks/dev-span-RsVeYYc_.js.map +1 -0
  29. package/dist/_chunks/{error-boundary-Cf1m-Ywk.js → error-boundary-Bh-egWUI.js} +6 -6
  30. package/dist/_chunks/{error-boundary-Cf1m-Ywk.js.map → error-boundary-Bh-egWUI.js.map} +1 -1
  31. package/dist/_chunks/{flight-source-node-BGanuoSS.js → flight-source-node-BO_xD9jC.js} +2 -2
  32. package/dist/_chunks/{flight-source-node-BGanuoSS.js.map → flight-source-node-BO_xD9jC.js.map} +1 -1
  33. package/dist/_chunks/{href-BtspoNc9.js → href-8l5VD23D.js} +2 -2
  34. package/dist/_chunks/{href-BtspoNc9.js.map → href-8l5VD23D.js.map} +1 -1
  35. package/dist/_chunks/{json-lossy-check-BXM45k8p.js → json-lossy-check-D47R9Fp5.js} +2 -2
  36. package/dist/_chunks/{json-lossy-check-BXM45k8p.js.map → json-lossy-check-D47R9Fp5.js.map} +1 -1
  37. package/dist/_chunks/{live-graph-C7-yA8W9.js → live-graph-ChuFfmLi.js} +4 -4
  38. package/dist/_chunks/{live-graph-C7-yA8W9.js.map → live-graph-ChuFfmLi.js.map} +1 -1
  39. package/dist/_chunks/{logger-YtMSKfft.js → logger-DDLtp5e-.js} +16 -1
  40. package/dist/_chunks/logger-DDLtp5e-.js.map +1 -0
  41. package/dist/_chunks/navigation-root-Cvb7P1ud.js.map +1 -1
  42. package/dist/_chunks/{node-response-D3hXWb8y.js → node-response-DNNnKnoS.js} +2 -2
  43. package/dist/_chunks/{node-response-D3hXWb8y.js.map → node-response-DNNnKnoS.js.map} +1 -1
  44. package/dist/_chunks/{plugin-context-FCkaNLUB.js → plugin-context-BtaQcMuh.js} +2 -2
  45. package/dist/_chunks/{plugin-context-FCkaNLUB.js.map → plugin-context-BtaQcMuh.js.map} +1 -1
  46. package/dist/_chunks/{plugin-context-BfSRKJfz.js → plugin-context-I1dvGccO.js} +1 -1
  47. package/dist/_chunks/{poison-scan-CRSP06Es.js → poison-scan-CJ9QfJWb.js} +2 -2
  48. package/dist/_chunks/{poison-scan-CRSP06Es.js.map → poison-scan-CJ9QfJWb.js.map} +1 -1
  49. package/dist/_chunks/{scanner-BNQ4qnLX.js → scanner-CrB_h6FA.js} +5 -5
  50. package/dist/_chunks/{scanner-BNQ4qnLX.js.map → scanner-CrB_h6FA.js.map} +1 -1
  51. package/dist/_chunks/{sizeof-Cmx6Fs-Y.js → sizeof-DVhEVN_y.js} +2 -2
  52. package/dist/_chunks/{sizeof-Cmx6Fs-Y.js.map → sizeof-DVhEVN_y.js.map} +1 -1
  53. package/dist/_chunks/{walkers-D_QHR_nf.js → walkers-BUvpsb2Q.js} +3 -3
  54. package/dist/_chunks/{walkers-D_QHR_nf.js.map → walkers-BUvpsb2Q.js.map} +1 -1
  55. package/dist/adapters/cloudflare-dev.js +1 -1
  56. package/dist/adapters/cloudflare-kv-cache.js +2 -2
  57. package/dist/adapters/cloudflare.js +1 -1
  58. package/dist/adapters/nitro.js +1 -1
  59. package/dist/analyze/crawl-entry.js +4 -4
  60. package/dist/analyze/graph-command.js +5 -5
  61. package/dist/cache/index.js +2 -2
  62. package/dist/cache/stores/memory.js +1 -1
  63. package/dist/cli.js +6 -6
  64. package/dist/client/dev-pill/index.d.ts +2 -1
  65. package/dist/client/dev-pill/index.d.ts.map +1 -1
  66. package/dist/client/dev-pill/store.d.ts +0 -18
  67. package/dist/client/dev-pill/store.d.ts.map +1 -1
  68. package/dist/client/dev-pill/view.d.ts.map +1 -1
  69. package/dist/client/error-boundary.js +1 -1
  70. package/dist/client/index.js +4 -4
  71. package/dist/client/internal.js +3 -3
  72. package/dist/cookies/index.js +1 -1
  73. package/dist/dev-tools/await-span.d.ts +12 -1
  74. package/dist/dev-tools/await-span.d.ts.map +1 -1
  75. package/dist/dev-tools/instrumentation.d.ts.map +1 -1
  76. package/dist/dev-tools/logger.d.ts +8 -2
  77. package/dist/dev-tools/logger.d.ts.map +1 -1
  78. package/dist/dev-tools/span-sink.d.ts +9 -1
  79. package/dist/dev-tools/span-sink.d.ts.map +1 -1
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/index.js +183 -40
  82. package/dist/index.js.map +1 -1
  83. package/dist/native/rsc/_react/chunks/{react-server-dom-webpack-server.node.development-hQ_odxIB.js → react-server-dom-webpack-server.node.development-CAttMzVD.js} +2 -2
  84. package/dist/native/rsc/_react/flight-client.js +2 -2
  85. package/dist/native/rsc/_react/flight-server.js +1 -1
  86. package/dist/native/rsc/_react/flight-static.js +1 -1
  87. package/dist/native/rsc/adapters/cloudflare-kv-cache.js +1 -1
  88. package/dist/native/rsc/adapters/cloudflare.js +2 -2
  89. package/dist/native/rsc/cache/cache-api.js +3 -3
  90. package/dist/native/rsc/cache/index.js +3 -3
  91. package/dist/native/rsc/cache/timber-cache.js +2 -2
  92. package/dist/native/rsc/cdn/index.js +1 -1
  93. package/dist/native/rsc/client/use-cookie.js +1 -1
  94. package/dist/native/rsc/dev-tools/404-page.js +1 -1
  95. package/dist/native/rsc/dev-tools/await-span.js +10 -7
  96. package/dist/native/rsc/dev-tools/await-span.js.map +1 -1
  97. package/dist/native/rsc/dev-tools/error-page.js +2 -2
  98. package/dist/native/rsc/dev-tools/instrumentation.js +38 -3
  99. package/dist/native/rsc/dev-tools/instrumentation.js.map +1 -1
  100. package/dist/native/rsc/dev-tools/logger.js +123 -80
  101. package/dist/native/rsc/dev-tools/logger.js.map +1 -1
  102. package/dist/native/rsc/dev-tools/span-sink.js +1 -0
  103. package/dist/native/rsc/dev-tools/span-sink.js.map +1 -1
  104. package/dist/native/rsc/dev-tools/terminal.js +1 -1
  105. package/dist/native/rsc/manifest.json +2 -2
  106. package/dist/native/rsc/params/index.js +1 -1
  107. package/dist/native/rsc/routing/collision-probe.js +1 -1
  108. package/dist/native/rsc/routing/interception.js +1 -1
  109. package/dist/native/rsc/search-params/define.js +2 -2
  110. package/dist/native/rsc/server/access-gate.js +1 -1
  111. package/dist/native/rsc/server/action-client.js +2 -2
  112. package/dist/native/rsc/server/action-handler.js +8 -8
  113. package/dist/native/rsc/server/actions.js +3 -3
  114. package/dist/native/rsc/server/children-interception.js +1 -1
  115. package/dist/native/rsc/server/deny-boundary.js +1 -1
  116. package/dist/native/rsc/server/deny-renderer.js +10 -10
  117. package/dist/native/rsc/server/fallback-error.js +1 -1
  118. package/dist/native/rsc/server/flight-injector-core.js +2 -2
  119. package/dist/native/rsc/server/flight-source-node.js +2 -2
  120. package/dist/native/rsc/server/index.js +4 -4
  121. package/dist/native/rsc/server/interception-gates.js +2 -2
  122. package/dist/native/rsc/server/internal.js +15 -15
  123. package/dist/native/rsc/server/logger.js +2 -2
  124. package/dist/native/rsc/server/metadata-route-links.js +1 -1
  125. package/dist/native/rsc/server/node-body-response.js +1 -1
  126. package/dist/native/rsc/server/param-coercion.js +1 -1
  127. package/dist/native/rsc/server/pipeline-helpers.js +10 -10
  128. package/dist/native/rsc/server/pipeline-interception.js +4 -4
  129. package/dist/native/rsc/server/pipeline-metadata-route.js +10 -10
  130. package/dist/native/rsc/server/pipeline-outcome.js +4 -4
  131. package/dist/native/rsc/server/pipeline-phases.js +11 -11
  132. package/dist/native/rsc/server/pipeline.js +10 -10
  133. package/dist/native/rsc/server/prebuilt/capture-render.js +1 -1
  134. package/dist/native/rsc/server/prebuilt/dev-store.js +1 -1
  135. package/dist/native/rsc/server/prebuilt/overlay.js +3 -3
  136. package/dist/native/rsc/server/prebuilt-builder.js +8 -8
  137. package/dist/native/rsc/server/prebuilt-runtime.js +15 -15
  138. package/dist/native/rsc/server/primitives.js +2 -2
  139. package/dist/native/rsc/server/publish-params.js +1 -1
  140. package/dist/native/rsc/server/request-context.js +1 -1
  141. package/dist/native/rsc/server/route-element-builder.js +7 -7
  142. package/dist/native/rsc/server/route-element-helpers.js +1 -1
  143. package/dist/native/rsc/server/route-handler.js +1 -1
  144. package/dist/native/rsc/server/rsc-entry/action-dispatcher.js +1 -1
  145. package/dist/native/rsc/server/rsc-entry/action-middleware-runner.js +1 -1
  146. package/dist/native/rsc/server/rsc-entry/api-handler.js +1 -1
  147. package/dist/native/rsc/server/rsc-entry/deny-fallback.js +6 -6
  148. package/dist/native/rsc/server/rsc-entry/error-renderer.js +7 -7
  149. package/dist/native/rsc/server/rsc-entry/helpers.js +1 -1
  150. package/dist/native/rsc/server/rsc-entry/render-route.js +4 -4
  151. package/dist/native/rsc/server/rsc-entry/revalidate-renderer.js +7 -7
  152. package/dist/native/rsc/server/rsc-entry/rsc-payload.js +3 -3
  153. package/dist/native/rsc/server/rsc-entry/rsc-stream.js +6 -6
  154. package/dist/native/rsc/server/rsc-entry/ssr-renderer.js +10 -10
  155. package/dist/native/rsc/server/rsc-error-envelope.js +1 -1
  156. package/dist/native/rsc/server/sitemap-handler.js +1 -1
  157. package/dist/native/rsc/server/skippable-prefix.js +2 -2
  158. package/dist/native/rsc/server/slot-interception.js +1 -1
  159. package/dist/native/rsc/server/slot-resolver.js +11 -11
  160. package/dist/native/rsc/server/static-generator.js +2 -2
  161. package/dist/native/rsc/server/traced-access.js +1 -1
  162. package/dist/native/rsc/server/tracing.js +10 -0
  163. package/dist/native/rsc/server/tracing.js.map +1 -1
  164. package/dist/native/rsc/shared/dev-span.js +11 -4
  165. package/dist/native/rsc/shared/dev-span.js.map +1 -1
  166. package/dist/native/rsc/shared/href.js +1 -1
  167. package/dist/native/rsc/shared/span-waterfall.js +90 -0
  168. package/dist/native/rsc/shared/span-waterfall.js.map +1 -0
  169. package/dist/native/ssr/adapters/cloudflare-kv-cache.js +1 -1
  170. package/dist/native/ssr/adapters/cloudflare.js +2 -2
  171. package/dist/native/ssr/cache/cache-api.js +3 -3
  172. package/dist/native/ssr/cache/guarded-read.js +1 -1
  173. package/dist/native/ssr/cache/index.js +3 -3
  174. package/dist/native/ssr/cache/timber-cache.js +3 -3
  175. package/dist/native/ssr/cdn/index.js +1 -1
  176. package/dist/native/ssr/client/error-boundary.js +1 -1
  177. package/dist/native/ssr/client/index.js +5 -5
  178. package/dist/native/ssr/client/link.js +5 -5
  179. package/dist/native/ssr/client/navigation-commit.js +2 -2
  180. package/dist/native/ssr/client/nuqs-adapter.js +2 -2
  181. package/dist/native/ssr/client/params-context.js +1 -1
  182. package/dist/native/ssr/client/router-skew.js +1 -1
  183. package/dist/native/ssr/client/rsc-fetch.js +2 -2
  184. package/dist/native/ssr/client/use-pending-navigation.js +1 -1
  185. package/dist/native/ssr/client/use-search-params.js +2 -2
  186. package/dist/native/ssr/client/use-segment-params.js +1 -1
  187. package/dist/native/ssr/client/use-selected-layout-segment.js +1 -1
  188. package/dist/native/ssr/dev-tools/await-span.js +10 -7
  189. package/dist/native/ssr/dev-tools/await-span.js.map +1 -1
  190. package/dist/native/ssr/dev-tools/instrumentation.js +38 -3
  191. package/dist/native/ssr/dev-tools/instrumentation.js.map +1 -1
  192. package/dist/native/ssr/dev-tools/logger.js +123 -80
  193. package/dist/native/ssr/dev-tools/logger.js.map +1 -1
  194. package/dist/native/ssr/dev-tools/span-sink.js +1 -0
  195. package/dist/native/ssr/dev-tools/span-sink.js.map +1 -1
  196. package/dist/native/ssr/manifest.json +1 -0
  197. package/dist/native/ssr/params/index.js +1 -1
  198. package/dist/native/ssr/search-params/define.js +2 -2
  199. package/dist/native/ssr/server/access-gate.js +1 -1
  200. package/dist/native/ssr/server/action-client.js +2 -2
  201. package/dist/native/ssr/server/actions.js +3 -3
  202. package/dist/native/ssr/server/deny-boundary.js +2 -2
  203. package/dist/native/ssr/server/flight-injector-core.js +1 -1
  204. package/dist/native/ssr/server/flight-source-node.js +2 -2
  205. package/dist/native/ssr/server/index.js +4 -4
  206. package/dist/native/ssr/server/internal.js +12 -12
  207. package/dist/native/ssr/server/logger.js +2 -2
  208. package/dist/native/ssr/server/node-body-response.js +1 -1
  209. package/dist/native/ssr/server/node-stream-transforms.js +2 -2
  210. package/dist/native/ssr/server/param-coercion.js +3 -3
  211. package/dist/native/ssr/server/pipeline-helpers.js +7 -7
  212. package/dist/native/ssr/server/pipeline-interception.js +4 -4
  213. package/dist/native/ssr/server/pipeline-metadata-route.js +10 -10
  214. package/dist/native/ssr/server/pipeline-outcome.js +4 -4
  215. package/dist/native/ssr/server/pipeline-phases.js +10 -10
  216. package/dist/native/ssr/server/pipeline.js +10 -10
  217. package/dist/native/ssr/server/prebuilt/capture-render.js +2 -2
  218. package/dist/native/ssr/server/prebuilt/dev-store.js +1 -1
  219. package/dist/native/ssr/server/prebuilt/overlay.js +4 -4
  220. package/dist/native/ssr/server/prebuilt-runtime.js +14 -14
  221. package/dist/native/ssr/server/primitives.js +2 -2
  222. package/dist/native/ssr/server/request-context.js +2 -2
  223. package/dist/native/ssr/server/route-handler.js +1 -1
  224. package/dist/native/ssr/server/rsc-error-envelope.js +1 -1
  225. package/dist/native/ssr/server/ssr-form-state.js +2 -2
  226. package/dist/native/ssr/server/ssr-wrappers.js +1 -1
  227. package/dist/native/ssr/server/traced-access.js +1 -1
  228. package/dist/native/ssr/server/tracing.js +10 -0
  229. package/dist/native/ssr/server/tracing.js.map +1 -1
  230. package/dist/native/ssr/shared/dev-span.js +11 -4
  231. package/dist/native/ssr/shared/dev-span.js.map +1 -1
  232. package/dist/native/ssr/shared/href.js +1 -1
  233. package/dist/native/ssr/shared/span-waterfall.js +90 -0
  234. package/dist/native/ssr/shared/span-waterfall.js.map +1 -0
  235. package/dist/plugins/dev-await.d.ts +3 -0
  236. package/dist/plugins/dev-await.d.ts.map +1 -1
  237. package/dist/plugins/dev-precompile.d.ts +84 -0
  238. package/dist/plugins/dev-precompile.d.ts.map +1 -0
  239. package/dist/plugins/dev-server.d.ts.map +1 -1
  240. package/dist/plugins/entries.d.ts.map +1 -1
  241. package/dist/plugins/native-runtime.d.ts +2 -2
  242. package/dist/plugins/native-runtime.d.ts.map +1 -1
  243. package/dist/plugins/plugin-rsc-package.d.ts +35 -0
  244. package/dist/plugins/plugin-rsc-package.d.ts.map +1 -0
  245. package/dist/plugins/virtual-ids.d.ts +16 -0
  246. package/dist/plugins/virtual-ids.d.ts.map +1 -0
  247. package/dist/routes/index.js +1 -1
  248. package/dist/routing/index.js +3 -3
  249. package/dist/search-params/index.js +2 -2
  250. package/dist/server/index.js +2 -2
  251. package/dist/server/internal.js +14 -14
  252. package/dist/server/tracing.d.ts.map +1 -1
  253. package/dist/shared/dev-span.d.ts +21 -3
  254. package/dist/shared/dev-span.d.ts.map +1 -1
  255. package/dist/shared/span-waterfall.d.ts +88 -0
  256. package/dist/shared/span-waterfall.d.ts.map +1 -0
  257. package/package.json +3 -3
  258. package/src/client/dev-pill/index.ts +5 -2
  259. package/src/client/dev-pill/store.ts +5 -64
  260. package/src/client/dev-pill/view.ts +175 -53
  261. package/src/dev-tools/await-span.ts +32 -13
  262. package/src/dev-tools/instrumentation.ts +44 -6
  263. package/src/dev-tools/logger.ts +230 -155
  264. package/src/dev-tools/span-sink.ts +34 -3
  265. package/src/index.ts +24 -21
  266. package/src/plugins/dev-await.ts +61 -3
  267. package/src/plugins/dev-precompile.ts +168 -0
  268. package/src/plugins/dev-server.ts +16 -3
  269. package/src/plugins/entries.ts +1 -11
  270. package/src/plugins/native-runtime.ts +4 -3
  271. package/src/plugins/plugin-rsc-package.ts +81 -0
  272. package/src/plugins/virtual-ids.ts +15 -0
  273. package/src/server/tracing.ts +29 -0
  274. package/src/shared/dev-span.ts +29 -6
  275. package/src/shared/span-waterfall.ts +227 -0
  276. package/dist/_chunks/chains-KblEfYzm.js +0 -1
  277. package/dist/_chunks/dev-server-L8biS7Az.js +0 -1
  278. package/dist/_chunks/dev-server-Rq659RR1.js.map +0 -1
  279. package/dist/_chunks/dev-span-_NzMX-au.js.map +0 -1
  280. package/dist/_chunks/logger-YtMSKfft.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"dev-span-_NzMX-au.js","names":[],"sources":["../../src/server/build-manifest.ts","../../src/shared/dev-span.ts"],"sourcesContent":["/**\n * Build manifest types and utilities for CSS and JS asset tracking.\n *\n * The build manifest maps route segment file paths to their output\n * chunks from Vite's client build. This enables:\n * - <link rel=\"stylesheet\"> injection in HTML <head>\n * - <script type=\"module\"> with hashed URLs in production\n * - <link rel=\"modulepreload\"> for client chunk dependencies\n * - Link preload headers for Early Hints (103)\n *\n * In dev mode, Vite's HMR client handles CSS/JS injection, so the build\n * manifest is empty. In production, it's populated from Vite's\n * .vite/manifest.json after the client build.\n *\n * Design docs: 18-build-system.md §\"Build Manifest\", 02-rendering-pipeline.md §\"Early Hints\"\n */\n\n/** A font asset entry in the build manifest. */\nexport interface ManifestFontEntry {\n /** URL path to the font file (e.g. `/_timber/fonts/inter-latin-400-abc123.woff2`). */\n href: string;\n /** Font format (e.g. `woff2`). */\n format: string;\n /** Crossorigin attribute — always `anonymous` for fonts. */\n crossOrigin: string;\n}\n\n/** Build manifest mapping input file paths to output asset URLs. */\nexport interface BuildManifest {\n /** Map from input file path (relative to project root) to output CSS URLs. */\n css: Record<string, string[]>;\n /** Map from input file path to output JS chunk URL (hashed filename). */\n js: Record<string, string>;\n /** Map from input file path to transitive JS dependency URLs for modulepreload. */\n modulepreload: Record<string, string[]>;\n /** Map from input file path to font assets used by that module. */\n fonts: Record<string, ManifestFontEntry[]>;\n /**\n * Cache-busting hashes for metadata route files (opengraph-image, etc.).\n * Map from file path (relative to project root) to short content hash.\n * In dev mode this is empty — a startup nonce is used instead.\n */\n metadataRouteHashes?: Record<string, string>;\n /**\n * Static request-dependency map from the Vite plugin's module-graph analysis.\n * Map from segment entry file path to whether it's request-dependent.\n * Used by buildSegmentInfo() for X-Timber-Segments in production.\n */\n requestDep?: Record<string, boolean>;\n}\n\n/**\n * Empty build manifest used in dev mode, and the single source of truth for\n * what an empty manifest contains.\n *\n * `virtual:timber-build-manifest` serializes this constant into its generated\n * source rather than restating it — one literal for the dev module, one for the\n * production module's `globalThis.__TIMBER_BUILD_MANIFEST__ ?? …` fallback.\n * They were three hand-written objects that had already drifted: this one and\n * the dev literal were missing `requestDep` while the production fallback had\n * it, so a reader who grepped the built bundle for `requestDep` found the one\n * copy that mentioned it and read the fallback as the shipped map (TIM-1300).\n * A field added here now reaches every copy.\n */\nexport const EMPTY_BUILD_MANIFEST: BuildManifest = {\n css: {},\n js: {},\n modulepreload: {},\n fonts: {},\n metadataRouteHashes: {},\n requestDep: {},\n};\n\n/** Segment shape expected by collectRouteCss (matches ManifestSegmentNode). */\ninterface SegmentWithFiles {\n layout?: { filePath: string };\n page?: { filePath: string };\n}\n\n/**\n * Collect all CSS files needed for a matched route's segment chain.\n *\n * Walks segments root → leaf, collecting CSS for each layout and page.\n * Deduplicates while preserving order (root layout CSS first).\n */\nexport function collectRouteCss(segments: SegmentWithFiles[], manifest: BuildManifest): string[] {\n const seen = new Set<string>();\n const result: string[] = [];\n\n for (const segment of segments) {\n for (const file of [segment.layout, segment.page]) {\n if (!file) continue;\n const cssFiles = manifest.css[file.filePath];\n if (!cssFiles) continue;\n for (const url of cssFiles) {\n if (!seen.has(url)) {\n seen.add(url);\n result.push(url);\n }\n }\n }\n }\n\n return result;\n}\n\n/**\n * Generate <link rel=\"stylesheet\"> tags for CSS URLs.\n *\n * Returns an HTML string to prepend to headHtml for injection\n * via injectHead() before </head>.\n */\nexport function buildCssLinkTags(cssUrls: string[]): string {\n // Emit only <link rel=\"stylesheet\"> — no preload tags. CSS preloading\n // is handled by 103 Early Hints (Link header) which fires before the\n // HTML stream. Float also emits `<link rel=\"stylesheet\" data-precedence>`\n // at the top of <head> during Fizz rendering — the browser discovers\n // CSS from that tag. A <link rel=\"preload\"> here would arrive *after*\n // Float's stylesheet tag and trigger \"Preload was ignored\" warnings.\n return cssUrls.map((url) => `<link rel=\"stylesheet\" href=\"${url}\">`).join('');\n}\n\n// ─── Font utilities ──────────────────────────────────────────────────────\n\n/**\n * Collect all font entries needed for a matched route's segment chain.\n *\n * Walks segments root → leaf, collecting fonts for each layout and page.\n * Deduplicates by href while preserving order.\n */\nexport function collectRouteFonts(\n segments: SegmentWithFiles[],\n manifest: BuildManifest\n): ManifestFontEntry[] {\n const seen = new Set<string>();\n const result: ManifestFontEntry[] = [];\n\n for (const segment of segments) {\n for (const file of [segment.layout, segment.page]) {\n if (!file) continue;\n const fonts = manifest.fonts[file.filePath];\n if (!fonts) continue;\n for (const entry of fonts) {\n if (!seen.has(entry.href)) {\n seen.add(entry.href);\n result.push(entry);\n }\n }\n }\n }\n\n return result;\n}\n\n/**\n * Generate <link rel=\"preload\"> tags for font assets.\n *\n * Font preloads use `as=font` and always include `crossorigin` (required\n * for font preloads even for same-origin resources per the spec).\n */\nexport function buildFontPreloadTags(fonts: ManifestFontEntry[]): string {\n return fonts\n .map(\n (f) =>\n `<link rel=\"preload\" href=\"${f.href}\" as=\"font\" type=\"font/${f.format}\" crossorigin=\"${f.crossOrigin}\">`\n )\n .join('');\n}\n\n// ─── JS chunk utilities ──────────────────────────────────────────────────\n\n/**\n * Collect modulepreload URLs for a matched route's segment chain.\n *\n * Walks segments root → leaf, collecting transitive JS dependencies\n * for each layout and page. Deduplicates across segments.\n */\nexport function collectRouteModulepreloads(\n segments: SegmentWithFiles[],\n manifest: BuildManifest\n): string[] {\n const seen = new Set<string>();\n const result: string[] = [];\n\n for (const segment of segments) {\n for (const file of [segment.layout, segment.page]) {\n if (!file) continue;\n const preloads = manifest.modulepreload[file.filePath];\n if (!preloads) continue;\n for (const url of preloads) {\n if (!seen.has(url)) {\n seen.add(url);\n result.push(url);\n }\n }\n }\n }\n\n return result;\n}\n\n/**\n * Generate <link rel=\"modulepreload\"> tags for JS dependency URLs.\n *\n * Modulepreload hints tell the browser to fetch and parse JS modules\n * before they're needed, reducing waterfall latency for dynamic imports.\n */\nexport function buildModulepreloadTags(urls: string[]): string {\n return urls.map((url) => `<link rel=\"modulepreload\" href=\"${url}\">`).join('');\n}\n","/**\n * The wire contract between the dev server's span sink and the dev request\n * pill in the browser. Dev-only; see design/50-dev-request-pill.md.\n *\n * Isomorphic: no server, client, or build-time imports.\n */\n\n/** HMR event that carries one finished span to the browser. */\nexport const DEV_SPAN_EVENT = 'timber:span';\n\n/** HMR event a tab sends to ask for a trace's spans that ended before it connected. */\nexport const DEV_SPAN_REPLAY_EVENT = 'timber:span-replay';\n\n/**\n * `globalThis` key holding the span sink. The dev server plugin installs it\n * and `DevSpanProcessor` (RSC module graph, same process, separate module\n * instances) reads it, so the hand-off is a `Symbol.for` global.\n */\nexport const DEV_SPAN_SINK_KEY = Symbol.for('timber.dev.span-sink');\n\n/** The `Server-Timing` metric whose `desc` is the response's trace ID. */\nexport const TRACE_TIMING_NAME = 'timber-trace';\n\n/**\n * `globalThis` key holding the dev await wrapper. The dev await transform\n * (`plugins/dev-await.ts`) rewrites `await x` in app server code to call\n * it, looked up at call time; dev tracing installs it. With nothing\n * installed the call is a plain await. See design/50-dev-request-pill.md\n * §\"Phase 2\".\n */\nexport const DEV_AWAIT_KEY = Symbol.for('timber.dev.await');\n\n/** Span name for one awaited call in app server code. */\nexport const AWAIT_SPAN_NAME = 'timber.await';\n\n/**\n * Await spans shorter than this are dropped before they reach the terminal\n * tree or the pill: `await params` and other awaits of settled values would\n * otherwise drown the I/O the spans exist to show.\n */\nexport const AWAIT_SPAN_MIN_MS = 1;\n\n/** Root span of every pipeline request. */\nexport const ROOT_SPAN_NAME = 'http.server.request';\n\n/**\n * The span attributes that may reach the browser — the ones the pill reads,\n * and nothing else. An allowlist of keys, not of prefixes: a prefix let\n * through `timber.fetch_error` (an error message that can quote a full URL)\n * and user attributes such as `url.full` or\n * `http.request.header.authorization`. Typing the payload with this list\n * means the pill cannot read an attribute that isn't on it.\n */\nexport const DEV_SPAN_ATTRIBUTES = [\n 'http.request.method',\n 'http.response.status_code',\n /** Query and fragment stripped. */\n 'http.url',\n /** Query and fragment stripped. */\n 'url.path',\n 'timber.route',\n 'timber.segment',\n 'timber.slot',\n 'timber.action_name',\n 'timber.cache_status',\n /** The awaited expression's source text, whitespace collapsed, truncated. */\n 'timber.await_label',\n /** `path/relative/to/root.ts:line` of the await. */\n 'timber.await_location',\n /** The awaited promise was already awaited elsewhere: a wait on shared work, not new work. */\n 'timber.await_shared',\n] as const;\n\nexport type DevSpanAttribute = (typeof DEV_SPAN_ATTRIBUTES)[number];\n\n/** Attributes that hold a URL; sent without query or fragment. */\nexport const DEV_SPAN_URL_ATTRIBUTES: ReadonlySet<DevSpanAttribute> = new Set([\n 'http.url',\n 'url.path',\n]);\n\nexport type DevSpanSink = (span: DevSpanPayload) => void;\n\n/** One finished span, projected for the browser. */\nexport interface DevSpanPayload {\n traceId: string;\n spanId: string;\n /** Absent for the root span. */\n parentSpanId?: string;\n name: string;\n /** Epoch milliseconds. */\n startMs: number;\n /** Epoch milliseconds. */\n endMs: number;\n error: boolean;\n /** Only `DEV_SPAN_ATTRIBUTES`; URLs without query or fragment. */\n attributes: Partial<Record<DevSpanAttribute, string | number | boolean>>;\n /** Names of `timber.*` span events, e.g. `timber.cache.hit`. */\n events: string[];\n}\n\n/**\n * Read the trace ID from `Server-Timing` metrics, either a raw header value\n * or the `serverTiming` entries of a `PerformanceResourceTiming`.\n */\nexport function traceIdFromServerTiming(\n timing: string | null | readonly { name: string; description: string }[]\n): string | null {\n if (timing == null) return null;\n if (typeof timing !== 'string') {\n return timing.find((t) => t.name === TRACE_TIMING_NAME)?.description || null;\n }\n // `timber-trace;desc=\"<32 hex>\"` — the ID is hex, so no escaping to undo.\n const match = new RegExp(`(?:^|,)\\\\s*${TRACE_TIMING_NAME}\\\\s*;\\\\s*desc=\"?([0-9a-f]+)\"?`).exec(\n timing\n );\n return match?.[1] ?? null;\n}\n\n/** The `Server-Timing` entry that carries a trace ID. */\nexport function traceTimingEntry(traceId: string): string {\n return `${TRACE_TIMING_NAME};desc=\"${traceId}\"`;\n}\n\n// ─── Labels ─────────────────────────────────────────────────────────────────\n\n/** Span attributes as either side holds them (OTEL also allows arrays). */\ntype SpanAttributes = Readonly<Record<string, unknown>>;\n\n/** `@slot ` for a span from a parallel slot, so it reads apart from the main route. */\nfunction slotPrefix(attrs: SpanAttributes): string {\n const slot = attrs['timber.slot'];\n return slot ? `${String(slot)} ` : '';\n}\n\n/**\n * Map a span to its display label and environment tag. One mapping for the\n * terminal tree and the dev request pill, so the two never name a span\n * differently.\n */\nexport function devSpanLabel(name: string, attrs: SpanAttributes): { label: string; env: string } {\n switch (name) {\n case ROOT_SPAN_NAME: {\n const method = attrs['http.request.method'] ?? 'GET';\n const path = attrs['url.path'] ?? '/';\n return { label: `${String(method)} ${String(path)}`, env: 'rsc' };\n }\n case 'timber.proxy':\n return { label: 'proxy.ts', env: 'proxy' };\n case 'timber.middleware':\n return { label: 'middleware.ts', env: 'rsc' };\n case 'timber.render':\n return { label: 'render', env: 'rsc' };\n case 'timber.access': {\n const seg = attrs['timber.segment'] ?? 'segment';\n return { label: `AccessGate (${String(seg)})`, env: 'rsc' };\n }\n case 'timber.ssr':\n return { label: 'hydration render', env: 'ssr' };\n case 'timber.action': {\n const actionName = attrs['timber.action_name'] ?? 'action';\n return { label: String(actionName), env: 'rsc' };\n }\n case 'timber.metadata':\n return { label: 'metadata()', env: 'rsc' };\n case 'timber.layout': {\n const seg = attrs['timber.segment'] ?? '/';\n return { label: `layout ${slotPrefix(attrs)}${String(seg)}`, env: 'rsc' };\n }\n case 'timber.page': {\n const route = attrs['timber.route'] ?? '/';\n return { label: `page ${slotPrefix(attrs)}${String(route)}`, env: 'rsc' };\n }\n case AWAIT_SPAN_NAME:\n // Shared: waited on a promise another await already took — no new work.\n return {\n label: `await ${String(attrs['timber.await_label'] ?? '')}${attrs['timber.await_shared'] === true ? ' (shared)' : ''}`,\n env: 'await',\n };\n case 'timber.fetch': {\n const fetchMethod = attrs['http.request.method'] ?? 'GET';\n const fetchUrl = attrs['http.url'] ?? '';\n return { label: `fetch ${String(fetchMethod)} ${String(fetchUrl)}`, env: 'fetch' };\n }\n default:\n return { label: name, env: 'rsc' };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAgEA,IAAa,uBAAsC;CACjD,KAAK,CAAC;CACN,IAAI,CAAC;CACL,eAAe,CAAC;CAChB,OAAO,CAAC;CACR,qBAAqB,CAAC;CACtB,YAAY,CAAC;AACf;;;;;;;AAcA,SAAgB,gBAAgB,UAA8B,UAAmC;CAC/F,MAAM,uBAAO,IAAI,IAAY;CAC7B,MAAM,SAAmB,CAAC;CAE1B,KAAK,MAAM,WAAW,UACpB,KAAK,MAAM,QAAQ,CAAC,QAAQ,QAAQ,QAAQ,IAAI,GAAG;EACjD,IAAI,CAAC,MAAM;EACX,MAAM,WAAW,SAAS,IAAI,KAAK;EACnC,IAAI,CAAC,UAAU;EACf,KAAK,MAAM,OAAO,UAChB,IAAI,CAAC,KAAK,IAAI,GAAG,GAAG;GAClB,KAAK,IAAI,GAAG;GACZ,OAAO,KAAK,GAAG;EACjB;CAEJ;CAGF,OAAO;AACT;;;;;;;AA0BA,SAAgB,kBACd,UACA,UACqB;CACrB,MAAM,uBAAO,IAAI,IAAY;CAC7B,MAAM,SAA8B,CAAC;CAErC,KAAK,MAAM,WAAW,UACpB,KAAK,MAAM,QAAQ,CAAC,QAAQ,QAAQ,QAAQ,IAAI,GAAG;EACjD,IAAI,CAAC,MAAM;EACX,MAAM,QAAQ,SAAS,MAAM,KAAK;EAClC,IAAI,CAAC,OAAO;EACZ,KAAK,MAAM,SAAS,OAClB,IAAI,CAAC,KAAK,IAAI,MAAM,IAAI,GAAG;GACzB,KAAK,IAAI,MAAM,IAAI;GACnB,OAAO,KAAK,KAAK;EACnB;CAEJ;CAGF,OAAO;AACT;;;;;;;AAyBA,SAAgB,2BACd,UACA,UACU;CACV,MAAM,uBAAO,IAAI,IAAY;CAC7B,MAAM,SAAmB,CAAC;CAE1B,KAAK,MAAM,WAAW,UACpB,KAAK,MAAM,QAAQ,CAAC,QAAQ,QAAQ,QAAQ,IAAI,GAAG;EACjD,IAAI,CAAC,MAAM;EACX,MAAM,WAAW,SAAS,cAAc,KAAK;EAC7C,IAAI,CAAC,UAAU;EACf,KAAK,MAAM,OAAO,UAChB,IAAI,CAAC,KAAK,IAAI,GAAG,GAAG;GAClB,KAAK,IAAI,GAAG;GACZ,OAAO,KAAK,GAAG;EACjB;CAEJ;CAGF,OAAO;AACT;;;;;;;;;AC/LA,IAAa,iBAAiB;;AAG9B,IAAa,wBAAwB;;;;;;AAOrC,IAAa,oBAAoB,OAAO,IAAI,sBAAsB;;AAGlE,IAAa,oBAAoB;;AAmGjC,SAAgB,iBAAiB,SAAyB;CACxD,OAAO,GAAG,kBAAkB,SAAS,QAAQ;AAC/C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger-YtMSKfft.js","names":[],"sources":["../../src/server/signal-identity.ts","../../src/server/tracing.ts","../../src/server/debug.ts","../../src/server/error-formatter.ts","../../src/server/default-logger.ts","../../src/server/logger.ts"],"sourcesContent":["// Signal identity — the brands framework signals carry, the predicates that\n// recognise them, and SsrStreamError.\n//\n// No runtime imports (the one import is type-only), so any environment can\n// load it. The SSR entry's import graph\n// must not reach RSC request state (`request-context.ts` and friends, held\n// to that by `tests/ssr-import-boundary.test.ts`), and the signal classes\n// in primitives.ts sit beside `deny()` and `redirect()`, which read it. SSR\n// code that has to recognise a signal (the logger skips them) imports the\n// predicates from here; the classes stamp the brands exported here.\n\nimport type { DenySignal, RedirectSignal } from './primitives.ts';\n\n// ─── Signal branding ────────────────────────────────────────────────────────\n//\n// Catch sites must NOT use `instanceof` on these classes. In dev, an HMR\n// program reload clears the RSC module cache; a request that is mid-render\n// still holds the catch sites from the old evaluation of primitives.ts while\n// user code loaded after the reload throws from the new one. The two\n// evaluations are distinct classes, so `instanceof` fails and a correct\n// deny() falls through every catch site as an unhandled 500 (TIM-1499).\n//\n// Each class stamps a `Symbol.for` brand on its instances in the constructor.\n// `Symbol.for` keys live in the realm-wide symbol registry, so every\n// evaluation of these modules — and every module graph in the same process —\n// agrees on the key. The `is*` predicates below check the brand and are the\n// only supported way to detect a signal. The classes themselves are NOT\n// anchored on globalThis: a re-evaluated module must hand out its own\n// (possibly updated) class, not a stale one.\n//\n// See design/18-build-system.md §\"Dev Mode: Signal Identity Across Program Reloads\".\n\nexport const DENY_BRAND: unique symbol = Symbol.for('timber:signal.deny');\nexport const REDIRECT_BRAND: unique symbol = Symbol.for('timber:signal.redirect');\nconst SSR_STREAM_ERROR_BRAND: unique symbol = Symbol.for('timber:signal.ssr-stream-error');\n\nfunction hasBrand(value: unknown, brand: symbol): boolean {\n return typeof value === 'object' && value !== null && brand in value;\n}\n\n/** True for any `DenySignal`, regardless of which module evaluation created it. */\nexport function isDenySignal(error: unknown): error is DenySignal {\n return hasBrand(error, DENY_BRAND);\n}\n\n/** True for any `RedirectSignal`, regardless of which module evaluation created it. */\nexport function isRedirectSignal(error: unknown): error is RedirectSignal {\n return hasBrand(error, REDIRECT_BRAND);\n}\n\n/**\n * True for any `SsrStreamError`. This one also crosses Vite environments:\n * it is thrown in SSR and caught in RSC, which are separate module graphs in\n * the same process — the brand is the only identity the two share.\n */\nexport function isSsrStreamError(error: unknown): error is SsrStreamError {\n return hasBrand(error, SSR_STREAM_ERROR_BRAND);\n}\n\n/**\n * Returns true if the error is a framework control-flow signal (RedirectSignal\n * or DenySignal) rather than a genuine application error. Works both for direct\n * instances (RSC-side) and deserialized digest errors (SSR cross-boundary).\n *\n * See also: isFrameworkSignalError() in client/browser-dev.ts (client-only).\n */\nexport function isControlFlowSignal(error: unknown): boolean {\n if (isDenySignal(error) || isRedirectSignal(error)) {\n return true;\n }\n return signalDigest(error) !== null;\n}\n\n/**\n * The HTTP status a control-flow signal answers with: a signal's own, or the\n * one its digest carries once revived on the SSR side. `undefined` for\n * anything that is not a signal.\n */\nexport function controlFlowStatus(error: unknown): number | undefined {\n if (isDenySignal(error) || isRedirectSignal(error)) return error.status;\n const status = signalDigest(error)?.status;\n return typeof status === 'number' ? status : undefined;\n}\n\n/** A revived signal's parsed digest (`rsc-stream.ts` writes it), or null. */\nfunction signalDigest(error: unknown): { type: 'deny' | 'redirect'; status?: unknown } | null {\n if (!error || typeof error !== 'object') return null;\n const digest = (error as { digest?: unknown }).digest;\n if (typeof digest !== 'string') return null;\n try {\n const parsed = JSON.parse(digest) as { type?: unknown; status?: unknown } | null;\n if (\n parsed &&\n typeof parsed === 'object' &&\n (parsed.type === 'redirect' || parsed.type === 'deny')\n ) {\n return { type: parsed.type, status: parsed.status };\n }\n } catch {\n // Not valid digest JSON\n }\n return null;\n}\n\n// ─── SsrStreamError ─────────────────────────────────────────────────────────\n\n/**\n * Error thrown when SSR's renderToReadableStream fails due to an error\n * in the decoded RSC stream (e.g., uncontained slot errors).\n *\n * The RSC entry checks for this error type in its catch block. A captured\n * deny or redirect is rethrown to the pipeline first; with no captured\n * signal, it renders the error page for the uncontained error.\n *\n * Not defined in ssr-entry.ts because ssr-entry.ts imports react-dom/server,\n * which cannot be loaded in the RSC environment.\n *\n * Detect with `isSsrStreamError()` — it is thrown in the SSR environment and\n * caught in RSC, so `instanceof` never matches. See \"Signal branding\" above.\n */\nexport class SsrStreamError extends Error {\n readonly [SSR_STREAM_ERROR_BRAND] = true;\n override readonly cause: unknown;\n\n constructor(message: string, cause: unknown) {\n super(message);\n this.name = 'SsrStreamError';\n this.cause = cause;\n }\n}\n","/**\n * Tracing — per-request trace ID via AsyncLocalStorage, OTEL span helpers.\n *\n * getTraceId() is always available in server code (middleware, access, components, actions).\n * Returns a 32-char lowercase hex string — the OTEL trace ID when an SDK is active,\n * or a crypto.randomUUID()-derived fallback otherwise.\n *\n * See design/17-logging.md §\"trace_id is Always Set\"\n */\n\nimport { randomUUID } from 'node:crypto';\nimport { trace, SpanStatusCode, type Span, type Tracer } from '@opentelemetry/api';\nimport { traceAls, type TraceStore } from './als-registry.ts';\nimport { controlFlowStatus, isSsrStreamError } from './signal-identity.ts';\n\n// Re-export the TraceStore type for public API consumers.\nexport type { TraceStore } from './als-registry.ts';\n\n// ─── Public API ───────────────────────────────────────────────────────────\n\n/**\n * Returns the current request's trace ID — always a 32-char lowercase hex string.\n *\n * With OTEL: the real OTEL trace ID (matches Jaeger/Honeycomb/Datadog).\n * Without OTEL: crypto.randomUUID() with hyphens stripped.\n *\n * Throws if called outside a request context (no ALS store).\n */\nexport function getTraceId(): string {\n const store = traceAls.getStore();\n if (!store) {\n throw new Error(\n '[timber] getTraceId() called outside of a request context. ' +\n 'It can only be used in middleware, access checks, server components, and server actions.'\n );\n }\n return store.request.traceId;\n}\n\n/**\n * Returns the current OTEL span ID if available, undefined otherwise.\n */\nexport function getSpanId(): string | undefined {\n return traceAls.getStore()?.spanId;\n}\n\n// ─── Framework-Internal Helpers ───────────────────────────────────────────\n\n/**\n * Generate a 32-char lowercase hex ID from crypto.randomUUID().\n * Same format as OTEL trace IDs — zero-friction upgrade path.\n */\nexport function generateTraceId(): string {\n return randomUUID().replace(/-/g, '');\n}\n\n/**\n * Run a callback within a trace context. Used by the pipeline to establish\n * per-request ALS scope.\n */\nexport function runWithTraceId<T>(id: string, fn: () => T): T {\n return traceAls.run({ request: { traceId: id } }, fn);\n}\n\n/**\n * Replace the request's trace ID. Used when OTEL creates the root span and\n * we want to switch from the UUID fallback to the real OTEL trace ID. Writes\n * the request's shared trace, so every scope in the request sees it —\n * including the ones outside the span this runs in.\n */\nexport function replaceTraceId(newTraceId: string): void {\n const store = traceAls.getStore();\n if (store) {\n store.request.traceId = newTraceId;\n }\n}\n\n/**\n * Run `fn` in a new trace scope for one span: the enclosing scope's request\n * trace, with this span's pointers. A scope per span, not a save/restore on\n * a shared store — spans overlap (MetadataCollector does not await\n * `timber.metadata`), and a restore that runs after a sibling's would\n * leave the sibling's pointer behind (TIM-1538).\n */\nfunction runInSpanScope<T>(\n pointers: Pick<TraceStore, 'spanId'> | Pick<TraceStore, 'platformSpan'>,\n fn: () => T\n): T {\n const store = traceAls.getStore();\n return store ? traceAls.run({ ...store, ...pointers }, fn) : fn();\n}\n\n/**\n * Get the current trace store, or undefined if outside a request context.\n * Framework-internal — use getTraceId()/getSpanId() in user code.\n */\nexport function getTraceStore(): TraceStore | undefined {\n return traceAls.getStore();\n}\n\n// ─── Dev-Mode OTEL Auto-Init ─────────────────────────────────────────────\n\n/**\n * Well-known key marking dev tracing as initialized.\n *\n * The RSC entry module re-evaluates on every HMR invalidation and calls\n * initDevTracing() again — without this guard, each call would register a\n * fresh provider/processor and duplicate every span's output. Symbol.for()\n * survives module re-evaluation. See TIM-1067, B49.\n */\nconst DEV_TRACING_INIT_KEY = Symbol.for('timber.dev.tracing-initialized');\n\n/**\n * Initialize a minimal OTEL SDK in dev mode so spans are recorded and\n * fed to the DevSpanProcessor for dev log output.\n *\n * If the user already configured an OTEL SDK in register(), we add\n * our DevSpanProcessor alongside theirs. If no SDK is configured,\n * we create a BasicTracerProvider with our processor.\n *\n * Idempotent across module re-evaluations (HMR) — only the first call\n * registers. Called in dev, and in production only when TIMBER_DEBUG is\n * set — otherwise production never loads the OTEL SDK.\n */\nexport async function initDevTracing(\n config: import('../dev-tools/logger.ts').DevLoggerConfig\n): Promise<void> {\n const globals = globalThis as Record<symbol, unknown>;\n if (globals[DEV_TRACING_INIT_KEY]) return;\n\n // Tracing is a diagnostic: any failure to load or construct the SDK\n // disables it with a warning and never fails the server's boot (TIM-1554).\n try {\n const { registerDevTracing } = await import('../dev-tools/instrumentation.ts');\n registerDevTracing(config);\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n console.warn(`[timber] Dev tracing disabled — failed to set up OTEL:\\n ${msg}`);\n return;\n }\n\n globals[DEV_TRACING_INIT_KEY] = true;\n}\n\n// ─── Platform Tracer ─────────────────────────────────────────────────────\n\n/**\n * A native platform span. Mirrors the subset of the Cloudflare Workers\n * `Span` API that timber uses. See design/17-logging.md §\"Cloudflare Native\n * Spans\" and TIM-1135.\n */\nexport interface PlatformSpan {\n setAttribute(key: string, value: string | number | boolean): void;\n}\n\n/**\n * Adapter-provided native tracer. Callback-scoped like Cloudflare's\n * `tracing.enterSpan()` — the span starts when the callback is invoked and\n * ends when it returns or its promise settles. Nesting follows the\n * platform's async context.\n *\n * When registered, withSpan() wraps every framework span in a native span\n * *in addition to* the OTEL emission — dual emission, so external OTEL\n * collectors keep working alongside the platform's native trace view.\n *\n * Register via setPlatformTracer(), or by writing the\n * Symbol.for('timber:platform-tracer') key on globalThis from\n * adapter-generated entry code (what the Cloudflare _worker.js does).\n */\nexport interface PlatformTracer {\n enterSpan<T>(name: string, fn: (span: PlatformSpan) => T): T;\n}\n\n// globalThis + Symbol.for so a tracer registered by adapter-generated entry\n// code (a separate module instance) is visible in both the RSC and SSR\n// environments — same pattern as the cf-bindings ALS.\nconst PLATFORM_TRACER_KEY = Symbol.for('timber:platform-tracer');\n\n/** Register (or clear) the native platform tracer for this runtime. */\nexport function setPlatformTracer(tracer: PlatformTracer | undefined): void {\n (globalThis as Record<symbol, unknown>)[PLATFORM_TRACER_KEY] = tracer;\n}\n\n/** The registered native platform tracer, if any. */\nexport function getPlatformTracer(): PlatformTracer | undefined {\n return (globalThis as Record<symbol, unknown>)[PLATFORM_TRACER_KEY] as PlatformTracer | undefined;\n}\n\n// ─── OTEL Span Helpers ───────────────────────────────────────────────────\n\n/**\n * The timber.js OTEL tracer.\n *\n * `@opentelemetry/api` is a direct dependency and a no-op until an SDK\n * registers a provider (the user's `register()`, or dev tracing). Imported\n * statically, not lazily, so `withSpan()` can invoke its callback in the\n * same synchronous frame it was called in: a server component wrapped in a\n * span (`timber.page`, `timber.layout`) must run while React's render\n * dispatcher is still set, or a synchronous component that calls `use()`\n * fails with an invalid hook call. Looked up per span — the API's proxy\n * tracer follows a provider registered after boot.\n */\nfunction getTracer(): Tracer {\n return trace.getTracer('timber.js');\n}\n\n/**\n * Run a function within a framework span. Composes two emission channels:\n *\n * - **Native platform span** — when an adapter registered a PlatformTracer\n * (Cloudflare Workers), the fn is wrapped in platformTracer.enterSpan()\n * so it appears in the platform's native trace view.\n * - **OTEL span** — when an OTEL SDK is active, the fn also runs inside an\n * OTEL span (dual emission). With no SDK the OTEL span is the API's\n * non-recording no-op.\n *\n * Automatically:\n * - Invokes fn synchronously, in the caller's frame — a wrapped server\n * component still sees React's render dispatcher (see getTracer())\n * - Creates the span as a child of the current context\n * - Runs fn in its own trace scope carrying the span's IDs, for log–trace\n * correlation and setSpanAttribute()\n * - Ends the span when the function completes\n * - Records exceptions on error (OTEL channel)\n */\nexport async function withSpan<T>(\n name: string,\n attributes: Record<string, string | number | boolean>,\n fn: () => T | PromiseLike<T>\n): Promise<T> {\n return traceCall(name, attributes, fn);\n}\n\n/**\n * The span core of {@link withSpan}, keeping the shape of the call: `fn` runs\n * synchronously, a value it returns comes back as that value, a promise as a\n * promise, and a synchronous throw is rethrown synchronously.\n *\n * For a framework wrapper that invokes a server component inside a span.\n * React drives a synchronous component through throws: `use()` on a pending\n * promise throws, and Flight retries the component once it settles. That only\n * works if the throw leaves the wrapper synchronously — `withSpan()` would\n * turn it into a rejection, which Flight reports as a render error.\n */\nexport function traceCall<T>(\n name: string,\n attributes: Record<string, string | number | boolean>,\n fn: () => T | PromiseLike<T>\n): T | Promise<T> {\n const platformTracer = getPlatformTracer();\n if (!platformTracer) {\n return runOtelSpan(name, attributes, fn);\n }\n\n // Native platform span wraps the OTEL emission (dual emission). The\n // span is tracked on its own trace scope so setSpanAttribute() can reach\n // it after creation — the platform API has no getActiveSpan() equivalent.\n return platformTracer.enterSpan(name, (span) => {\n for (const key of Object.keys(attributes)) {\n span.setAttribute(key, attributes[key]);\n }\n return runInSpanScope({ platformSpan: span }, () => runOtelSpan(name, attributes, fn));\n });\n}\n\n/**\n * The OTEL half of withSpan() — a non-recording span when no SDK is active.\n * Calls `fn` synchronously; see {@link getTracer}.\n */\nfunction runOtelSpan<T>(\n name: string,\n attributes: Record<string, string | number | boolean>,\n fn: () => T | PromiseLike<T>\n): T | Promise<T> {\n return getTracer().startActiveSpan(name, { attributes }, (span) =>\n runInSpanScope({ spanId: span.spanContext().spanId }, () => settleOtelSpan(span, fn))\n );\n}\n\n/**\n * True when `error` is a `redirect()`, or a `deny()` below 500: an outcome the\n * span observed, not a failure. Such a span ends with its status unset and no\n * exception event, so an OTEL backend does not count every 404 from an access\n * check, a page, a layout or a metadata() as an error (TIM-1597). A\n * `deny(5xx)` is a server failure by HTTP's own account and stays an error.\n *\n * SSR wraps the revived signal its shell failed on in an `SsrStreamError`;\n * the cause is the outcome, so `timber.ssr` follows the same rule.\n */\nfunction isOutcomeSignal(error: unknown): boolean {\n const status = controlFlowStatus(isSsrStreamError(error) ? error.cause : error);\n return status !== undefined && status < 500;\n}\n\n/**\n * Run `fn` and end `span` with its outcome (see {@link isOutcomeSignal}),\n * keeping the call's shape (see {@link traceCall}).\n */\nfunction settleOtelSpan<T>(span: Span, fn: () => T | PromiseLike<T>): T | Promise<T> {\n let result: T | PromiseLike<T>;\n try {\n result = fn();\n } catch (error) {\n endSpanWithError(span, error);\n throw error;\n }\n if (isPromiseLike(result)) {\n // Any thenable, not only a native Promise — a custom or cross-realm one\n // must hold the span open too, as `await` would. Its `then` is called\n // here, synchronously, so a lazy thenable starts its work in this span.\n const thenable = result;\n return new Promise<T>((resolve, reject) => {\n const fail = (error: unknown) => {\n endSpanWithError(span, error);\n reject(error);\n };\n try {\n thenable.then((value) => {\n endSpanOk(span);\n resolve(value);\n }, fail);\n } catch (error) {\n // A `then` that throws is a rejection, as for `await`; end the span.\n fail(error);\n }\n });\n }\n endSpanOk(span);\n return result;\n}\n\nfunction isPromiseLike<T>(value: T | PromiseLike<T>): value is PromiseLike<T> {\n return (\n (typeof value === 'object' || typeof value === 'function') &&\n value !== null &&\n 'then' in value &&\n typeof value.then === 'function'\n );\n}\n\nfunction endSpanOk(span: Span): void {\n span.setStatus({ code: SpanStatusCode.OK });\n span.end();\n}\n\n/**\n * True when `error` is React suspending the component, not failing it: a\n * thrown thenable, or the `SuspenseException` that `use()` throws on a\n * pending promise. Flight retries the component once the promise settles, so\n * a span around a synchronous component (see {@link traceCall}) that suspends\n * is not an error span — the retry's span carries the real outcome.\n *\n * React does not export `SuspenseException`; Flight recognises it by\n * identity, and its message — which React keeps stable because it is the\n * user-facing explanation when one is caught by mistake — is the only handle\n * outside React.\n */\nfunction isReactSuspension(error: unknown): boolean {\n if (typeof error !== 'object' || error === null) return false;\n if ('then' in error && typeof error.then === 'function') return true;\n return error instanceof Error && error.message.startsWith('Suspense Exception:');\n}\n\nfunction endSpanWithError(span: Span, error: unknown): void {\n if (!isOutcomeSignal(error) && !isReactSuspension(error)) {\n span.setStatus({ code: SpanStatusCode.ERROR });\n if (error instanceof Error) {\n span.recordException(error);\n }\n }\n span.end();\n}\n\n/**\n * Set an attribute on the current active span (if any).\n * Used for setting span attributes after span creation (e.g. timber.result on access spans).\n */\nexport async function setSpanAttribute(\n key: string,\n value: string | number | boolean\n): Promise<void> {\n // Forward to the innermost active native platform span, if any.\n const platformSpan = traceAls.getStore()?.platformSpan;\n if (platformSpan) {\n platformSpan.setAttribute(key, value);\n }\n\n const activeSpan = trace.getActiveSpan();\n if (activeSpan?.isRecording()) {\n activeSpan.setAttribute(key, value);\n }\n}\n\n/**\n * Add a span event to the current active span (if any).\n * Used for timber.cache HIT/MISS events — recorded as span events, not child spans.\n */\nexport async function addSpanEvent(\n name: string,\n attributes?: Record<string, string | number | boolean>\n): Promise<void> {\n const activeSpan = trace.getActiveSpan();\n if (activeSpan?.isRecording()) {\n activeSpan.addEvent(name, attributes);\n }\n}\n\n/**\n * Fire-and-forget span event — no await, no microtask overhead.\n *\n * Used on the cache hot path where awaiting addSpanEvent creates an\n * unnecessary microtask per cache operation.\n *\n * See TIM-370 for perf motivation.\n */\nexport function addSpanEventSync(\n name: string,\n attributes?: Record<string, string | number | boolean>\n): void {\n const activeSpan = trace.getActiveSpan();\n if (activeSpan?.isRecording()) {\n activeSpan.addEvent(name, attributes);\n }\n}\n\n/**\n * Try to extract the OTEL trace ID from the current active span context.\n * Returns undefined if OTEL is not active or no span exists. (The span ID\n * reaches logs through the span's own trace scope, not from here.)\n */\nexport async function getOtelTraceId(): Promise<string | undefined> {\n const activeSpan = trace.getActiveSpan();\n if (!activeSpan) return undefined;\n\n const ctx = activeSpan.spanContext();\n // OTEL uses \"0000000000000000\" as invalid trace IDs\n if (!ctx.traceId || ctx.traceId === '00000000000000000000000000000000') {\n return undefined;\n }\n\n return ctx.traceId;\n}\n","/**\n * Runtime debug flag for timber.js.\n *\n * Two distinct functions for two distinct security levels:\n *\n * ## `isDebug()` — server-side logging only\n *\n * Returns true when timber's debug/warning messages should be written to\n * stderr / the server console. This NEVER affects what is sent to the\n * client (no error details, no timing headers, no stack traces).\n *\n * Active when any of:\n * - `NODE_ENV !== 'production'` (standard dev mode)\n * - `TIMBER_DEBUG` env var is set to a truthy value at runtime\n * - `timber.config.ts` has `debug: true`\n *\n * ## `isDevMode()` — client-visible dev behavior\n *\n * Returns true ONLY when `NODE_ENV !== 'production'`. This gates anything\n * that changes what clients can observe:\n * - Dev error pages with stack traces (fallback-error.ts)\n * - Detailed Server-Timing headers (pipeline.ts)\n * - Error messages in action INTERNAL_ERROR payloads (action-client.ts)\n * - Pipeline error handler wiring (Vite overlay)\n *\n * `isDevMode()` is statically replaced in production builds → the guarded\n * code is tree-shaken to zero bytes. TIMBER_DEBUG cannot enable it.\n *\n * Usage:\n * In Cloudflare Workers wrangler.toml:\n * [vars]\n * TIMBER_DEBUG = \"1\"\n *\n * In Node.js:\n * TIMBER_DEBUG=1 node server.js\n *\n * In timber.config.ts:\n * export default { debug: true }\n *\n * See design/13-security.md for the security taxonomy.\n * See design/18-build-system.md for build pipeline details.\n */\n\n// ─── Dev Mode (client-visible) ──────────────────────────────────────────────\n\n/**\n * Check if the application is running in development mode.\n *\n * This is the ONLY function that should gate client-visible dev behavior:\n * - Dev error pages with stack traces\n * - Error messages in action `INTERNAL_ERROR` payloads\n * - Pipeline error handler wiring (Vite overlay)\n *\n * Returns `process.env.NODE_ENV !== 'production'`, which is statically\n * replaced by the bundler in production builds. Code guarded by this\n * function is tree-shaken to zero bytes in production.\n *\n * TIMBER_DEBUG does NOT enable this — that would leak server internals\n * to clients. Use `isDebug()` for server-side-only logging.\n */\nexport function isDevMode(): boolean {\n return process.env.NODE_ENV !== 'production';\n}\n\n// ─── Debug Flag (server-side logging only) ──────────────────────────────────\n\n/**\n * Config-level debug override. Set via `setDebugFromConfig()` during\n * initialization when timber.config.ts has `debug: true`.\n */\nlet _configDebug = false;\n\n/**\n * Set the debug flag from timber.config.ts.\n * Called during handler initialization.\n */\nexport function setDebugFromConfig(debug: boolean): void {\n _configDebug = debug;\n}\n\n/**\n * Check if timber debug logging is active (server-side only).\n *\n * Returns true if ANY of these conditions hold:\n * - NODE_ENV is not 'production' (standard dev mode)\n * - TIMBER_DEBUG environment variable is set to a truthy value at runtime\n * - timber.config.ts has `debug: true`\n *\n * This function controls ONLY server-side logging — messages written to\n * stderr or the server console. It NEVER affects client-visible behavior\n * (error pages, response headers, action payloads). For client-visible\n * behavior, use `isDevMode()`.\n *\n * The TIMBER_DEBUG check is deliberately written as a dynamic property\n * access so bundlers cannot statically replace it.\n */\nexport function isDebug(): boolean {\n // Fast path: dev mode (statically replaced to `true` in dev, `false` in prod)\n if (process.env.NODE_ENV !== 'production') return true;\n\n // Config override\n if (_configDebug) return true;\n\n // Runtime env var check — uses dynamic access to prevent static replacement.\n // In production builds, process.env.NODE_ENV is statically replaced, but\n // TIMBER_DEBUG must survive as a runtime check. The dynamic key access\n // pattern ensures the bundler treats this as opaque.\n return _readTimberDebugEnv();\n}\n\n/**\n * Read TIMBER_DEBUG from the environment at runtime.\n *\n * Extracted to a separate function to:\n * 1. Prevent bundler inlining (cross-module function calls are not inlined)\n * 2. Handle platforms where `process` may not exist (Cloudflare Workers)\n * 3. Support globalThis.__TIMBER_DEBUG for programmatic control\n */\nfunction _readTimberDebugEnv(): boolean {\n // globalThis override — useful for programmatic control and testing\n if ((globalThis as Record<string, unknown>).__TIMBER_DEBUG) return true;\n\n // process.env — works in Node.js and platforms that polyfill process\n try {\n const key = 'TIMBER_DEBUG';\n const val =\n typeof process !== 'undefined' && process.env\n ? (process.env as Record<string, string | undefined>)[key]\n : undefined;\n if (val && val !== '0' && val !== 'false') return true;\n } catch {\n // process may not exist or env may throw — safe to ignore\n }\n\n return false;\n}\n","/**\n * Error Formatter — rewrites SSR/RSC error messages to surface user code.\n *\n * When React or Vite throw errors during SSR, stack traces reference\n * vendored dependency paths (e.g. `.vite/deps_ssr/@vitejs_plugin-rsc_vendor_...`)\n * and mangled export names (`__vite_ssr_export_default__`). This module\n * rewrites error messages and stack traces to point at user code instead.\n *\n * Dev-only — in production, errors go through the structured logger\n * without formatting.\n */\n\n// ─── Stack Trace Rewriting ──────────────────────────────────────────────────\n\n/**\n * Patterns that identify internal Vite/RSC vendor paths in stack traces.\n * These are replaced with human-readable labels.\n */\nconst VENDOR_PATH_PATTERNS: Array<{ pattern: RegExp; replacement: string }> = [\n {\n pattern: /node_modules\\/\\.vite\\/deps_ssr\\/@vitejs_plugin-rsc_vendor_react-server-dom[^\\s)]+/g,\n replacement: '<react-server-dom>',\n },\n {\n pattern: /node_modules\\/\\.vite\\/deps_ssr\\/@vitejs_plugin-rsc_vendor[^\\s)]+/g,\n replacement: '<rsc-vendor>',\n },\n {\n pattern: /node_modules\\/\\.vite\\/deps_ssr\\/[^\\s)]+/g,\n replacement: '<vite-dep>',\n },\n {\n pattern: /node_modules\\/\\.vite\\/deps\\/[^\\s)]+/g,\n replacement: '<vite-dep>',\n },\n];\n\n/**\n * Patterns that identify Vite-mangled export names in error messages.\n */\nconst MANGLED_NAME_PATTERNS: Array<{ pattern: RegExp; replacement: string }> = [\n {\n pattern: /__vite_ssr_export_default__/g,\n replacement: '<default export>',\n },\n {\n pattern: /__vite_ssr_export_(\\w+)__/g,\n replacement: '<export $1>',\n },\n];\n\n/**\n * Rewrite an error's message and stack to replace internal Vite paths\n * and mangled names with human-readable labels.\n */\nexport function formatSsrError(error: unknown): string {\n if (!(error instanceof Error)) {\n return String(error);\n }\n\n let message = error.message;\n let stack = error.stack ?? '';\n\n // Rewrite mangled names in the message\n for (const { pattern, replacement } of MANGLED_NAME_PATTERNS) {\n message = message.replace(pattern, replacement);\n }\n\n // Rewrite vendor paths in the stack\n for (const { pattern, replacement } of VENDOR_PATH_PATTERNS) {\n stack = stack.replace(pattern, replacement);\n }\n\n // Rewrite mangled names in the stack too\n for (const { pattern, replacement } of MANGLED_NAME_PATTERNS) {\n stack = stack.replace(pattern, replacement);\n }\n\n // Extract hints from React-specific error patterns\n const hint = extractErrorHint(error.message);\n\n // Build formatted output: cleaned message, hint (if any), then cleaned stack\n const parts: string[] = [];\n parts.push(message);\n if (hint) {\n parts.push(` → ${hint}`);\n }\n\n // Include only the user-code frames from the stack (skip the first line\n // which is the message itself, and filter out vendor-only frames)\n const userFrames = extractUserFrames(stack);\n if (userFrames.length > 0) {\n parts.push('');\n parts.push(' User code in stack:');\n for (const frame of userFrames) {\n parts.push(` ${frame}`);\n }\n }\n\n return parts.join('\\n');\n}\n\n// ─── Error Hint Extraction ──────────────────────────────────────────────────\n\n/**\n * Extract a human-readable hint from common React/RSC error messages.\n *\n * React error messages contain useful information but the surrounding\n * context (vendor paths, mangled names) obscures it. This extracts the\n * actionable part as a one-line hint.\n */\nfunction extractErrorHint(message: string): string | null {\n // \"Functions cannot be passed directly to Client Components\"\n // Extract the component and prop name from the JSX-like syntax in the message\n const fnPassedMatch = message.match(/Functions cannot be passed directly to Client Components/);\n if (fnPassedMatch) {\n // Try to extract the prop name from the message\n // React formats: <... propName={function ...} ...>\n const propMatch = message.match(/<[^>]*?\\s(\\w+)=\\{function/);\n if (propMatch) {\n return `Prop \"${propMatch[1]}\" is a function — mark it \"use server\" or call it before passing`;\n }\n return 'A function prop was passed to a Client Component — mark it \"use server\" or call it before passing';\n }\n\n // \"Objects are not valid as a React child\"\n if (message.includes('Objects are not valid as a React child')) {\n return 'An object was rendered as JSX children — convert to string or extract the value';\n }\n\n // \"Cannot read properties of undefined/null\"\n const nullRefMatch = message.match(\n /Cannot read propert(?:y|ies) of (undefined|null) \\(reading '(\\w+)'\\)/\n );\n if (nullRefMatch) {\n return `Accessed .${nullRefMatch[2]} on ${nullRefMatch[1]} — check that the value exists`;\n }\n\n // \"X is not a function\"\n const notFnMatch = message.match(/(\\w+) is not a function/);\n if (notFnMatch) {\n return `\"${notFnMatch[1]}\" is not a function — check imports and exports`;\n }\n\n // \"Element type is invalid\"\n if (message.includes('Element type is invalid')) {\n return 'A component resolved to undefined/null — check default exports and import paths';\n }\n\n // \"Invalid hook call\" — hooks called outside React's render context.\n // In RSC, this typically means a 'use client' component was executed as a\n // server component instead of being serialized as a client reference.\n if (message.includes('Invalid hook call')) {\n return (\n 'A hook was called outside of a React component render. ' +\n \"If this is a 'use client' component, ensure the directive is at the very top of the file \" +\n '(before any imports) and that @vitejs/plugin-rsc is loaded correctly. ' +\n \"Barrel re-exports from non-'use client' files do not propagate the directive.\"\n );\n }\n\n return null;\n}\n\n// ─── Stack Frame Filtering ──────────────────────────────────────────────────\n\n/**\n * Extract stack frames that reference user code (not node_modules,\n * not framework internals).\n *\n * Returns at most 5 frames to keep output concise.\n */\nfunction extractUserFrames(stack: string): string[] {\n const lines = stack.split('\\n');\n const userFrames: string[] = [];\n\n for (const line of lines) {\n const trimmed = line.trim();\n // Skip non-frame lines\n if (!trimmed.startsWith('at ')) continue;\n // Skip node_modules, vendor, and internal frames\n if (\n trimmed.includes('node_modules') ||\n trimmed.includes('<react-server-dom>') ||\n trimmed.includes('<rsc-vendor>') ||\n trimmed.includes('<vite-dep>') ||\n trimmed.includes('node:internal')\n ) {\n continue;\n }\n userFrames.push(trimmed);\n if (userFrames.length >= 5) break;\n }\n\n return userFrames;\n}\n","/**\n * DefaultLogger — human-readable stderr logging when no custom logger is configured.\n *\n * Ships as the fallback so production deployments always have error visibility,\n * even without an `instrumentation.ts` logger export. Output is one line per\n * event, designed for `fly logs`, `kubectl logs`, Cloudflare dashboard tails, etc.\n *\n * Format:\n * [timber] ERROR message key=value key=value trace_id=4bf92f35\n * [timber] WARN message key=value key=value trace_id=4bf92f35\n * [timber] INFO message method=GET path=/dashboard status=200 durationMs=43 trace_id=4bf92f35\n *\n * Behavior:\n * - `info` and `debug` suppressed in dev mode (dev logging handles them);\n * `warn` and `error` are always written (TIM-555)\n * - `debug` suppressed unless TIMBER_DEBUG is set\n * - Replaced entirely when a custom logger is set via `setLogger()`\n *\n * See design/17-logging.md §\"DefaultLogger\"\n */\n\nimport { isDevMode, isDebug } from './debug.ts';\nimport { formatSsrError } from './error-formatter.ts';\nimport type { TimberLogger } from './logger.ts';\n\n/**\n * Format data fields as `key=value` pairs for human-readable output.\n * - `error` key is serialized via formatSsrError for stack trace cleanup\n * - `trace_id` is truncated to 8 chars for readability (full ID in OTEL)\n * - Other values are stringified inline\n */\nfunction formatDataFields(data?: Record<string, unknown>): string {\n if (!data) return '';\n\n const parts: string[] = [];\n let traceId: string | undefined;\n\n for (const [key, value] of Object.entries(data)) {\n if (key === 'trace_id') {\n // Defer trace_id to the end\n traceId = typeof value === 'string' ? value : String(value);\n continue;\n }\n if (key === 'error') {\n // Serialize errors with formatSsrError for clean output\n parts.push(`error=${formatSsrError(value)}`);\n continue;\n }\n if (value === undefined || value === null) continue;\n parts.push(`${key}=${value}`);\n }\n\n // trace_id always last, truncated to 8 chars for readability\n if (traceId) {\n parts.push(`trace_id=${traceId.slice(0, 8)}`);\n }\n\n return parts.length > 0 ? ' ' + parts.join(' ') : '';\n}\n\n/** Pad level string to fixed width for alignment. */\nfunction padLevel(level: string): string {\n return level.padEnd(5);\n}\n\nexport function createDefaultLogger(): TimberLogger {\n return {\n error(msg: string, data?: Record<string, unknown>): void {\n // Errors are ALWAYS logged, including dev mode. Suppressing errors\n // in dev causes silent 500s with no stack trace, making route.ts\n // and render errors impossible to debug. See TIM-555.\n const fields = formatDataFields(data);\n process.stderr.write(`[timber] ${padLevel('ERROR')} ${msg}${fields}\\n`);\n },\n\n warn(msg: string, data?: Record<string, unknown>): void {\n // Warnings are always logged — same rationale as errors.\n const fields = formatDataFields(data);\n process.stderr.write(`[timber] ${padLevel('WARN')} ${msg}${fields}\\n`);\n },\n\n info(msg: string, data?: Record<string, unknown>): void {\n // info is suppressed by default — per-request lines are too noisy\n // without a custom logger. Enable with TIMBER_DEBUG.\n if (isDevMode()) return;\n if (!isDebug()) return;\n const fields = formatDataFields(data);\n process.stderr.write(`[timber] ${padLevel('INFO')} ${msg}${fields}\\n`);\n },\n\n debug(msg: string, data?: Record<string, unknown>): void {\n // debug is suppressed in dev (dev logger handles it) and in\n // production unless TIMBER_DEBUG is explicitly set.\n if (isDevMode()) return;\n if (!isDebug()) return;\n const fields = formatDataFields(data);\n process.stderr.write(`[timber] ${padLevel('DEBUG')} ${msg}${fields}\\n`);\n },\n };\n}\n","/**\n * Logger — structured logging with environment-aware formatting.\n *\n * timber.js ships a DefaultLogger that writes human-readable lines to stderr\n * in production. Users can export a custom logger from instrumentation.ts to\n * replace it with pino, winston, or any TimberLogger-compatible object.\n *\n * See design/17-logging.md §\"Production Logging\"\n */\n\nimport { generateTraceId, getTraceStore } from './tracing.ts';\nimport { createDefaultLogger } from './default-logger.ts';\nimport { isDevMode } from './debug.ts';\nimport { isControlFlowSignal } from './signal-identity.ts';\nimport type { CsrfRejectReason } from './csrf.ts';\n\n// ─── Logger Interface ─────────────────────────────────────────────────────\n\n/** Any object with standard log methods satisfies this — pino, winston, consola, console. */\nexport interface TimberLogger {\n info(msg: string, data?: Record<string, unknown>): void;\n warn(msg: string, data?: Record<string, unknown>): void;\n error(msg: string, data?: Record<string, unknown>): void;\n debug(msg: string, data?: Record<string, unknown>): void;\n}\n\n// ─── Logger Registry ──────────────────────────────────────────────────────\n\n// Initialize with DefaultLogger so production errors are never silent.\n// Replaced when setLogger() is called from instrumentation.ts.\nlet _logger: TimberLogger = createDefaultLogger();\n\n/**\n * Set the user-provided logger. Called by the instrumentation loader\n * when it finds a `logger` export in instrumentation.ts. Replaces\n * the DefaultLogger entirely.\n */\nexport function setLogger(logger: TimberLogger): void {\n _logger = logger;\n}\n\n/**\n * Get the current logger. Always non-null — returns DefaultLogger when\n * no custom logger is configured.\n */\nexport function getLogger(): TimberLogger {\n return _logger;\n}\n\n// ─── Framework Log Helpers ────────────────────────────────────────────────\n\n/**\n * Inject trace_id and span_id into log data for log–trace correlation.\n * Always injects trace_id (never undefined). Injects span_id only when OTEL is active.\n */\nfunction withTraceContext(data?: Record<string, unknown>): Record<string, unknown> {\n const store = getTraceStore();\n const enriched: Record<string, unknown> = { ...data };\n if (store) {\n enriched.trace_id = store.request.traceId;\n if (store.spanId) {\n enriched.span_id = store.spanId;\n }\n }\n return enriched;\n}\n\n// ─── Framework Event Emitters ─────────────────────────────────────────────\n\n/**\n * Log a CSRF rejection. Level: warn — the 403 body is deliberately terse,\n * so this line is the only place the rejected origin is visible (TIM-1459).\n * `detail` names the observed origin and, where one exists, the expected one.\n *\n * The gate runs inside the pipeline's trace scope, so the line carries the\n * request's `trace_id`. A caller outside any scope still gets one minted\n * here — the field is always present (design/17-logging.md §\"trace_id is\n * Always Set\").\n */\nexport function logCsrfRejected(\n detail: string,\n data: { method: string; path: string; reason: CsrfRejectReason }\n): void {\n const fields = withTraceContext(data);\n fields.trace_id ??= generateTraceId();\n _logger.warn(`CSRF origin check failed: ${detail}`, fields);\n}\n\n/** Log a completed request. Level: info. */\nexport function logRequestCompleted(data: {\n method: string;\n path: string;\n status: number;\n durationMs: number;\n /** Number of concurrent in-flight requests (including this one) at completion time. */\n concurrency?: number;\n}): void {\n _logger.info('request completed', withTraceContext(data));\n}\n\n/** Log request received. Level: debug. */\nexport function logRequestReceived(data: { method: string; path: string }): void {\n _logger.debug('request received', withTraceContext(data));\n}\n\n/** Log a slow request warning. Level: warn. */\nexport function logSlowRequest(data: {\n method: string;\n path: string;\n durationMs: number;\n threshold: number;\n /** Number of concurrent in-flight requests at the time the slow request completed. */\n concurrency?: number;\n}): void {\n _logger.warn('slow request exceeded threshold', withTraceContext(data));\n}\n\n/** Log middleware short-circuit. Level: debug. */\nexport function logMiddlewareShortCircuit(data: {\n method: string;\n path: string;\n status: number;\n}): void {\n _logger.debug('middleware short-circuited', withTraceContext(data));\n}\n\n/** Log unhandled error in middleware phase. Level: error. */\nexport function logMiddlewareError(data: { method: string; path: string; error: unknown }): void {\n if (isControlFlowSignal(data.error)) return;\n _logger.error('unhandled error in middleware phase', withTraceContext(data));\n}\n\n/** Log unhandled error in route setup (matching, param coercion). Level: error. */\nexport function logRouteSetupError(data: { method: string; path: string; error: unknown }): void {\n if (isControlFlowSignal(data.error)) return;\n _logger.error('unhandled error in route setup', withTraceContext(data));\n}\n\n/** Log unhandled render-phase error. Level: error. */\nexport function logRenderError(data: {\n method: string;\n path: string;\n error: unknown;\n errorId?: string;\n}): void {\n if (isControlFlowSignal(data.error)) return;\n _logger.error('unhandled render-phase error', withTraceContext(data));\n}\n\n/**\n * Log a status page, error page, `global-error.tsx` or fallback layout that\n * failed to load and was skipped: the next fallback tier answers in its place.\n * Level: error — a boundary that vanished is a bug in the app, even though the\n * request still gets a page. The caller writes it once per file and failure.\n */\nexport function logSkippedModule(data: {\n method: string;\n path: string;\n file: string;\n error: unknown;\n}): void {\n _logger.error('route file failed to load and was skipped', withTraceContext(data));\n}\n\n/** Log proxy.ts uncaught error. Level: error. */\nexport function logProxyError(data: { error: unknown }): void {\n _logger.error('proxy.ts threw uncaught error', withTraceContext(data));\n}\n\n/** Log unhandled error in server action. Level: error. */\nexport function logActionError(data: {\n method: string;\n path: string;\n error: unknown;\n errorId?: string;\n}): void {\n if (isControlFlowSignal(data.error)) return;\n _logger.error('unhandled server action error', withTraceContext(data));\n}\n\n/**\n * Log a server action request rejected as the client's mistake before the\n * action ran: a reference that does not exist, a body that will not decode.\n * Level: warn, with the reason but no stack — any client can send these, so\n * they must not read as server faults (TIM-1601).\n */\nexport function logActionRejected(data: {\n method: string;\n path: string;\n status: number;\n reason: string;\n}): void {\n _logger.warn('server action request rejected', withTraceContext(data));\n}\n\n/** Log unhandled error in route handler. Level: error. */\nexport function logRouteError(data: { method: string; path: string; error: unknown }): void {\n if (isControlFlowSignal(data.error)) return;\n _logger.error('unhandled route handler error', withTraceContext(data));\n}\n\n/** Log SSR streaming error (post-shell). Level: error. */\nexport function logStreamingError(data: { error: unknown }): void {\n _logger.error('SSR streaming error (post-shell)', withTraceContext(data));\n}\n\n/** Log waitUntil() adapter missing (once at startup). Level: warn. */\nexport function logWaitUntilUnsupported(): void {\n _logger.warn('adapter does not support waitUntil()');\n}\n\n/** Log waitUntil() promise rejection. Level: warn. */\nexport function logWaitUntilRejected(data: { error: unknown }): void {\n _logger.warn('waitUntil() promise rejected', withTraceContext(data));\n}\n\n/**\n * Log a cached value computed from request context its key leaves out\n * (design/45 §Enforcement). Level: error.\n */\nexport function logKeyDisciplineViolation(event: string, data: Record<string, unknown>): void {\n _logger.error(event, withTraceContext(data));\n}\n\n/** Log staleWhileRevalidate refetch failure. Level: warn. */\nexport function logSwrRefetchFailed(data: { cacheKey: string; error: unknown }): void {\n _logger.warn('staleWhileRevalidate refetch failed', withTraceContext(data));\n}\n\n/** Log a cache value that loses fidelity through JSON serialization. Level: warn. */\nexport function logLossyCacheValue(data: { cacheKey: string; types: string }): void {\n _logger.warn(\n 'cache value contains types that lose fidelity through JSON serialization in ' +\n 'Redis/KV cache handlers: Date becomes an ISO string, Map/Set become {}, BigInt throws. ' +\n 'The MemoryCacheHandler preserves them. Transform values to JSON-safe types before ' +\n 'caching, or use MemoryCacheHandler for values that require type preservation.',\n withTraceContext(data)\n );\n}\n\n/** Log cache miss. Level: debug. */\nexport function logCacheMiss(data: { cacheKey: string }): void {\n _logger.debug('timber.cache MISS', withTraceContext(data));\n}\n\n/**\n * Log a cache read that threw or timed out and was served as a miss.\n * Level: warn — the request still succeeds, but a failing store (Redis down,\n * KV erroring) means every read is paying for a live fetch.\n */\nexport function logCacheReadFailed(data: { cacheKey: string; error: unknown }): void {\n _logger.warn('cache read failed — treating as a miss', withTraceContext(data));\n}\n\n// ─── Swallow Helper ───────────────────────────────────────────────────────\n\n/**\n * Log an intentionally swallowed error. Provides observability into catch\n * blocks that are deliberately empty — the error is consumed, never rethrown.\n *\n * Default level: `warn` in dev (so the overlay surfaces patterns), `debug`\n * in production (low noise unless TIMBER_DEBUG is set). Pass `opts.level`\n * to override.\n *\n * **Infallible** — swallow() itself never throws, even if the logger is\n * broken. A thrown swallow would turn a benign catch into a crash.\n */\nexport function swallow(err: unknown, reason: string, opts?: { level?: 'debug' | 'warn' }): void {\n try {\n const level = opts?.level ?? (isDevMode() ? 'warn' : 'debug');\n _logger[level](`swallowed: ${reason}`, withTraceContext({ error: err }));\n } catch {\n // swallow() must never throw.\n }\n}\n"],"mappings":";;;;AAgCA,IAAa,aAA4B,OAAO,IAAI,oBAAoB;AACxE,IAAa,iBAAgC,OAAO,IAAI,wBAAwB;AAChF,IAAM,yBAAwC,OAAO,IAAI,gCAAgC;AAEzF,SAAS,SAAS,OAAgB,OAAwB;CACxD,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,SAAS;AACjE;;AAGA,SAAgB,aAAa,OAAqC;CAChE,OAAO,SAAS,OAAO,UAAU;AACnC;;AAGA,SAAgB,iBAAiB,OAAyC;CACxE,OAAO,SAAS,OAAO,cAAc;AACvC;;;;;;AAOA,SAAgB,iBAAiB,OAAyC;CACxE,OAAO,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