@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
package/dist/index.js CHANGED
@@ -1,29 +1,30 @@
1
- import { a as formatMissingPeers, i as checkPeerDependencies, n as timberDevServer, o as reportConfigErrors, s as validateConfig } from "./_chunks/dev-server-Rq659RR1.js";
1
+ import { a as checkPeerDependencies, c as validateConfig, i as VIRTUAL_IDS, n as timberDevServer, o as formatMissingPeers, s as reportConfigErrors } from "./_chunks/dev-server-lrdpD7Ws.js";
2
2
  import { i as resolveRenderTimeoutMs } from "./_chunks/render-timeout-MrrqD1wd.js";
3
+ import { d as collectInterceptionRewrites, l as getPrerenderExport, n as scanRoutes } from "./_chunks/scanner-CrB_h6FA.js";
4
+ import { c as buildDirToRouteMap, n as formatConventionWarnings, o as flushCodegenWrites, r as lintConventions, s as writeRouteCodegen, t as checkAppDirExists } from "./_chunks/convention-lint-CLpuzY5h.js";
5
+ import { r as validateSchemaAgainstRoutes, t as collectLeafRoutes } from "./_chunks/walkers-BUvpsb2Q.js";
6
+ import { i as poisonPillSource, r as markerFor, t as EXPLICIT_MARKERS } from "./_chunks/poison-rules-Bmz-lCPi.js";
3
7
  import { t as writeFileAtomic } from "./_chunks/write-file-atomic-DW8m_Atv.js";
4
- import { d as collectInterceptionRewrites, l as getPrerenderExport, n as scanRoutes } from "./_chunks/scanner-BNQ4qnLX.js";
5
- import { b as swallow } from "./_chunks/logger-YtMSKfft.js";
6
- import { c as buildDirToRouteMap, n as formatConventionWarnings, o as flushCodegenWrites, r as lintConventions, s as writeRouteCodegen, t as checkAppDirExists } from "./_chunks/convention-lint-D54k6uUM.js";
7
- import { a as contextAdapter, c as loadTimberConfigFile, d as resolveBuildDir, f as resolveClientJavascript, l as mergeFileConfig, m as createNoopTimer, o as createPluginContext, r as adapterConfig, u as resolveAppDir } from "./_chunks/plugin-context-FCkaNLUB.js";
8
8
  import { i as withBasePath, n as normalizeBasePath, t as isRelativeBase } from "./_chunks/base-path-DDIx0FXe.js";
9
- import { r as validateSchemaAgainstRoutes, t as collectLeafRoutes } from "./_chunks/walkers-D_QHR_nf.js";
10
- import { i as poisonPillSource, r as markerFor, t as EXPLICIT_MARKERS } from "./_chunks/poison-rules-Bmz-lCPi.js";
11
9
  import { n as rscPayloadPath, t as RSC_PAYLOAD_DIR } from "./_chunks/rsc-payload-path-EphpDB-J.js";
12
10
  import { a as REDIRECTS_FILE, n as detectFsIdentity, o as RESERVED_OUTPUT_PATHS, r as fsKey, t as EXACT_FS_IDENTITY } from "./_chunks/fs-identity-BmQ_Agg-.js";
13
- import { a as EMPTY_BUILD_MANIFEST, n as DEV_SPAN_REPLAY_EVENT, r as DEV_SPAN_SINK_KEY, t as DEV_SPAN_EVENT } from "./_chunks/dev-span-_NzMX-au.js";
11
+ import { a as EMPTY_BUILD_MANIFEST, n as DEV_SPAN_REPLAY_EVENT, r as DEV_SPAN_SINK_KEY, t as DEV_SPAN_EVENT } from "./_chunks/dev-span-RsVeYYc_.js";
14
12
  import { t as fnv1aHash } from "./_chunks/fast-hash-DddxkU5Y.js";
15
- import { i as detectDirective } from "./_chunks/classify-_W0RWa5w.js";
13
+ import { i as detectDirective } from "./_chunks/classify-cmE0Gins.js";
14
+ import { a as contextAdapter, c as loadTimberConfigFile, d as resolveBuildDir, f as resolveClientJavascript, l as mergeFileConfig, m as createNoopTimer, o as createPluginContext, r as adapterConfig, u as resolveAppDir } from "./_chunks/plugin-context-BtaQcMuh.js";
15
+ import { b as swallow } from "./_chunks/logger-DDLtp5e-.js";
16
16
  import { t as formatSize } from "./_chunks/format-DuPOoXUP.js";
17
17
  import { createLogger, esmExternalRequirePlugin, isRunnableDevEnvironment, parseAst } from "vite";
18
18
  import { basename, dirname, extname, isAbsolute, join, normalize, relative, resolve, sep, win32 } from "node:path";
19
- import { SourceMap, builtinModules, createRequire } from "node:module";
20
19
  import react from "@vitejs/plugin-react";
21
20
  import { existsSync, readFileSync } from "node:fs";
22
21
  import nodeHTTP from "node:http";
23
22
  import { fileURLToPath, pathToFileURL } from "node:url";
23
+ import { SourceMap, builtinModules, createRequire } from "node:module";
24
24
  import { createHash, randomUUID } from "node:crypto";
25
25
  import { copyFile, mkdir, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
26
26
  import { gzipSync } from "node:zlib";
27
+ import { AsyncLocalStorage } from "node:async_hooks";
27
28
  // src/plugins/content.ts
28
29
  var CONFIG_FILE_NAMES = [
29
30
  "content-collections.ts",
@@ -130,14 +131,6 @@ function timberContent(ctx) {
130
131
  // src/plugins/entries.ts
131
132
  var __dirname$1 = dirname(fileURLToPath(import.meta.url));
132
133
  var SRC_DIR = existsSync(resolve(__dirname$1, "..", "server", "rsc-entry", "index.ts")) ? resolve(__dirname$1, "..") : resolve(__dirname$1, "..", "src");
133
- var VIRTUAL_IDS = {
134
- rscEntry: "virtual:timber-rsc-entry",
135
- ssrEntry: "virtual:timber-ssr-entry",
136
- browserEntry: "virtual:timber-browser-entry",
137
- config: "virtual:timber-config",
138
- instrumentation: "virtual:timber-instrumentation",
139
- cacheHandler: "virtual:timber-cache-handler"
140
- };
141
134
  /**
142
135
  * Map from virtual module IDs to their resolved file paths.
143
136
  *
@@ -5615,11 +5608,31 @@ function timberBuildManifest(ctx) {
5615
5608
  };
5616
5609
  }
5617
5610
  // src/dev-tools/span-sink.ts
5611
+ /**
5612
+ * Span sink — streams finished dev spans to the browser over HMR, for the
5613
+ * dev request pill. See design/50-dev-request-pill.md §"Transport".
5614
+ *
5615
+ * Two halves that run in different module graphs of one process:
5616
+ * - `installSpanSink()` runs in the dev server plugin, which owns the HMR
5617
+ * channel.
5618
+ * - `forwardSpan()` runs in `DevSpanProcessor` (RSC graph) on every span end.
5619
+ * They meet at `globalThis[DEV_SPAN_SINK_KEY]`. With nothing installed (a
5620
+ * production build under TIMBER_DEBUG, unit tests), forwarding is a no-op —
5621
+ * this is what keeps the browser channel gated to `vite dev`.
5622
+ */
5618
5623
  /** Traces the server keeps for replay. Oldest-inserted is evicted. */
5619
5624
  var MAX_REPLAY_TRACES = 64;
5620
5625
  /**
5621
5626
  * Install the sink that broadcasts spans on the dev server's HMR channel,
5622
- * and answers replay requests from it.
5627
+ * and answers replay requests from it. Every message is an array of spans
5628
+ * of one trace, in the order they ended.
5629
+ *
5630
+ * Spans are batched: one send per trace per event-loop turn, not one per
5631
+ * span. The sink is called inside the request, and each `hot.send` makes
5632
+ * promises there, for each of which React's dev async debug hook captures a
5633
+ * stack (~6µs a span; ~6ms on a 213-span trace). So the flush is scheduled
5634
+ * from an `AsyncLocalStorage.snapshot()` taken here, at install, where no
5635
+ * request is in scope: the send runs outside every request (TIM-1627).
5623
5636
  *
5624
5637
  * Broadcasting alone loses most of a document load: the root span ends when
5625
5638
  * the pipeline returns its Response, tens of milliseconds in, and the page's
@@ -5634,6 +5647,15 @@ var MAX_REPLAY_TRACES = 64;
5634
5647
  function installSpanSink(hot) {
5635
5648
  const globals = globalThis;
5636
5649
  const recent = /* @__PURE__ */ new Map();
5650
+ const outsideRequests = AsyncLocalStorage.snapshot();
5651
+ let pending = /* @__PURE__ */ new Map();
5652
+ let scheduled;
5653
+ const flush = () => {
5654
+ const batches = pending;
5655
+ pending = /* @__PURE__ */ new Map();
5656
+ scheduled = void 0;
5657
+ for (const spans of batches.values()) hot.send(DEV_SPAN_EVENT, spans);
5658
+ };
5637
5659
  const sink = (span) => {
5638
5660
  let spans = recent.get(span.traceId);
5639
5661
  if (!spans) {
@@ -5645,18 +5667,29 @@ function installSpanSink(hot) {
5645
5667
  recent.set(span.traceId, spans);
5646
5668
  }
5647
5669
  spans.push(span);
5648
- hot.send(DEV_SPAN_EVENT, span);
5670
+ let batch = pending.get(span.traceId);
5671
+ if (!batch) {
5672
+ batch = [];
5673
+ pending.set(span.traceId, batch);
5674
+ }
5675
+ batch.push(span);
5676
+ scheduled ??= outsideRequests(() => setImmediate(flush));
5649
5677
  };
5650
5678
  const onReplay = (data, client) => {
5651
5679
  if (typeof data !== "object" || data === null || !("traceId" in data)) return;
5652
5680
  const { traceId } = data;
5653
5681
  if (typeof traceId !== "string") return;
5654
- for (const span of recent.get(traceId) ?? []) client.send(DEV_SPAN_EVENT, span);
5682
+ const spans = recent.get(traceId);
5683
+ if (spans) client.send(DEV_SPAN_EVENT, spans.slice());
5655
5684
  };
5656
5685
  globals[DEV_SPAN_SINK_KEY] = sink;
5657
5686
  hot.on(DEV_SPAN_REPLAY_EVENT, onReplay);
5658
5687
  return () => {
5659
5688
  hot.off(DEV_SPAN_REPLAY_EVENT, onReplay);
5689
+ if (scheduled) {
5690
+ clearImmediate(scheduled);
5691
+ flush();
5692
+ }
5660
5693
  if (globals[DEV_SPAN_SINK_KEY] === sink) delete globals[DEV_SPAN_SINK_KEY];
5661
5694
  };
5662
5695
  }
@@ -8196,6 +8229,67 @@ function timberNodeFlightBuilds() {
8196
8229
  }
8197
8230
  };
8198
8231
  }
8232
+ // src/plugins/plugin-rsc-package.ts
8233
+ /**
8234
+ * Which copy of `@vitejs/plugin-rsc` timber runs, and the one Vite setting
8235
+ * that follows from it.
8236
+ *
8237
+ * plugin-rsc is a dependency of `@timber-js/app`, pinned exactly: apps never
8238
+ * import it, and the RSC mirror bundles that version's Flight runtime
8239
+ * (design/51-native-dev-runtime.md). So:
8240
+ *
8241
+ * - **An installed timber loads its own copy.** The plugin, the runtime that
8242
+ * timber's modules import and the bundled Flight runtime are then one
8243
+ * version, whatever else the app installed. Package managers give that copy
8244
+ * the app's Vite through timber's `vite` peer.
8245
+ * - **A linked or from-source timber loads the app's copy.** It has its own
8246
+ * `node_modules` with its own Vite, and plugin-rsc checks environments
8247
+ * against the Vite it imports (`vite.isRunnableDevEnvironment`), so a copy
8248
+ * resolved from timber would see a second Vite. This repo's examples and
8249
+ * `pnpm link` setups take this path, with plugin-rsc installed in the
8250
+ * workspace or the app.
8251
+ */
8252
+ var PLUGIN_RSC = "@vitejs/plugin-rsc";
8253
+ /** Whether timber's `src/` is inside an installed package, not a checkout or link. */
8254
+ function isInstalledPackage(srcDir) {
8255
+ return srcDir.includes(`${sep}node_modules${sep}`);
8256
+ }
8257
+ /** Whether this timber runs the plugin-rsc it depends on, rather than the app's. */
8258
+ var usesOwnPluginRsc = isInstalledPackage(SRC_DIR);
8259
+ /** plugin-rsc's plugin factory: timber's own copy when installed, the app's otherwise. */
8260
+ function loadPluginRsc(appRoot) {
8261
+ const load = createRequire(join(usesOwnPluginRsc ? SRC_DIR : appRoot, "package.json"));
8262
+ try {
8263
+ load.resolve(PLUGIN_RSC);
8264
+ } catch {
8265
+ throw new Error(`timber runs from source or a link here, and loads ${PLUGIN_RSC} from the app: install ${PLUGIN_RSC} in ${appRoot}.`);
8266
+ }
8267
+ return load(PLUGIN_RSC).default;
8268
+ }
8269
+ /**
8270
+ * plugin-rsc lists its vendored Flight runtime in each environment's
8271
+ * `optimizeDeps.include` by bare specifier, which Vite resolves from the app's
8272
+ * root. An app that does not install plugin-rsc itself cannot resolve it
8273
+ * there, so the browser's Flight client would be found only mid-load, and
8274
+ * pre-bundled with a full page reload. When timber runs its own copy, each
8275
+ * entry names the package it comes through (`@timber-js/app > …`), which Vite
8276
+ * resolves from timber.
8277
+ */
8278
+ function timberPluginRscDeps() {
8279
+ return {
8280
+ name: "timber-plugin-rsc-deps",
8281
+ apply: "serve",
8282
+ enforce: "post",
8283
+ configEnvironment: {
8284
+ order: "post",
8285
+ handler(_name, config) {
8286
+ const deps = config.optimizeDeps;
8287
+ if (!usesOwnPluginRsc || !deps?.include) return;
8288
+ deps.include = deps.include.map((entry) => entry.startsWith(`${PLUGIN_RSC}/`) ? `@timber-js/app > ${entry}` : entry);
8289
+ }
8290
+ }
8291
+ };
8292
+ }
8199
8293
  // src/plugins/native-runtime-boundary.ts
8200
8294
  /**
8201
8295
  * Packages the RSC mirror loads with Node that themselves import React, with
@@ -8248,8 +8342,8 @@ var NATIVE_MANIFEST_FILE = "manifest.json";
8248
8342
  * `__vite_rsc_require__`, so a global alias stands in for it.
8249
8343
  *
8250
8344
  * Used only when timber runs from an installed package with its mirrors, and
8251
- * `TIMBER_DEV_NATIVE_RUNTIME` is not `0`; RSC also needs the app's React,
8252
- * react-dom and plugin-rsc to be the versions the mirror bundled, and falls
8345
+ * `TIMBER_DEV_NATIVE_RUNTIME` is not `0`; RSC also needs the app's React and
8346
+ * react-dom to be the versions the mirror bundled, and falls
8253
8347
  * back to Vite with a warning otherwise (design/51 §"Two dev paths").
8254
8348
  * timber's own repo and examples alias `@timber-js/app` to `src/` and keep the
8255
8349
  * Vite path.
@@ -8272,7 +8366,7 @@ function decideNativeRuntime(srcDir, { env = process.env, installedVersion }) {
8272
8366
  warn: false
8273
8367
  });
8274
8368
  if (env.TIMBER_DEV_NATIVE_RUNTIME === "0") return everywhere("TIMBER_DEV_NATIVE_RUNTIME=0");
8275
- if (!srcDir.includes(`${sep}node_modules${sep}`)) return everywhere("timber is not an installed package");
8369
+ if (!isInstalledPackage(srcDir)) return everywhere("timber is not an installed package");
8276
8370
  const decision = {
8277
8371
  manifests: {},
8278
8372
  vitePath: {},
@@ -9489,6 +9583,9 @@ function timberPrerenderSugar(ctx) {
9489
9583
  * const rows = await __timber_await$(() => (db.select().from(users)),
9490
9584
  * "db.select().from(users)", "app/users/page.tsx:12");
9491
9585
  *
9586
+ * An operand that starts no work (`await call`, `await Promise.all([a, b])`)
9587
+ * gets a fourth argument, `true`, so the wrapper can mark the await a wait.
9588
+ *
9492
9589
  * `__timber_await$` is declared once per module and looks the wrapper up on
9493
9590
  * `globalThis[DEV_AWAIT_KEY]` at call time (installed with dev tracing,
9494
9591
  * `dev-tools/await-span.ts`); with none installed it calls the thunk. A
@@ -9539,6 +9636,43 @@ function containsAwait(node) {
9539
9636
  if (FUNCTION_TYPES.has(node.type)) return false;
9540
9637
  return children(node).some(containsAwait);
9541
9638
  }
9639
+ /** Wrappers that change nothing about what the operand is. */
9640
+ var TRANSPARENT_TYPES = /* @__PURE__ */ new Set([
9641
+ "ParenthesizedExpression",
9642
+ "TSAsExpression",
9643
+ "TSSatisfiesExpression",
9644
+ "TSNonNullExpression"
9645
+ ]);
9646
+ var PROMISE_COMBINATORS = /* @__PURE__ */ new Set([
9647
+ "all",
9648
+ "allSettled",
9649
+ "any",
9650
+ "race"
9651
+ ]);
9652
+ /** `p`, `this.p`, `state.pending?.p`: a value that already exists. */
9653
+ function isReference(node) {
9654
+ if (TRANSPARENT_TYPES.has(node.type) && isNode(node.expression)) return isReference(node.expression);
9655
+ if (node.type === "ChainExpression" && isNode(node.expression)) return isReference(node.expression);
9656
+ return node.type === "Identifier" || node.type === "MemberExpression";
9657
+ }
9658
+ /**
9659
+ * The operand starts no work of its own: it reads a promise that already
9660
+ * exists (`await call`, `await this.pending`), or combines such promises
9661
+ * (`await Promise.all([a, b])`). The work began when the promise was made,
9662
+ * so its spans nest wherever that happened, not under this await. The
9663
+ * wrapper marks the await a wait if the value is a native promise; a getter
9664
+ * that starts work shows up as a wait with children, which the pill treats
9665
+ * as work.
9666
+ */
9667
+ function startsNoWork(node) {
9668
+ if (TRANSPARENT_TYPES.has(node.type) && isNode(node.expression)) return startsNoWork(node.expression);
9669
+ if (isReference(node)) return true;
9670
+ if (node.type !== "CallExpression") return false;
9671
+ const callee = node.callee;
9672
+ const args = node.arguments ?? [];
9673
+ const array = args[0];
9674
+ return isNode(callee) && callee.type === "MemberExpression" && isNode(callee.object) && callee.object.type === "Identifier" && callee.object.name === "Promise" && isNode(callee.property) && PROMISE_COMBINATORS.has(String(callee.property.name)) && args.length === 1 && isNode(array) && array.type === "ArrayExpression" && (array.elements ?? []).every((e) => isNode(e) && isReference(e));
9675
+ }
9542
9676
  /** Parser dialect for a module path: the transform sees original source. */
9543
9677
  function langFor(file) {
9544
9678
  if (/\.tsx$/.test(file)) return "tsx";
@@ -9720,12 +9854,13 @@ function instrumentAwaits(code, relPath, options = {}) {
9720
9854
  const location = JSON.stringify(`${relPath}:${lineOf(node.start)}`);
9721
9855
  const thunk = containsAwait(arg) ? "async () => (" : "() => (";
9722
9856
  s.prependRight(arg.start, `${HELPER}(${thunk}`);
9723
- s.appendLeft(arg.end, `), ${text}, ${location})`);
9857
+ const wait = startsNoWork(arg) ? ", true" : "";
9858
+ s.appendLeft(arg.end, `), ${text}, ${location}${wait})`);
9724
9859
  count++;
9725
9860
  };
9726
9861
  visit(program, false);
9727
9862
  if (count === 0) return null;
9728
- const helper = `\nconst ${HELPER} = (f, l, c) => (globalThis[Symbol.for("timber.dev.await")] ?? ((g) => g()))(f, l, c);\n`;
9863
+ const helper = `\nconst ${HELPER} = (f, l, c, w) => (globalThis[Symbol.for("timber.dev.await")] ?? ((g) => g()))(f, l, c, w);\n`;
9729
9864
  s.appendLeft(prologue.end, helper);
9730
9865
  return {
9731
9866
  code: s.toString(),
@@ -10913,29 +11048,36 @@ function createRscOptions(ctx, encryptionKeyExpr) {
10913
11048
  * output mode to be silently ignored. See TIM-451.
10914
11049
  */
10915
11050
  /**
10916
- * Wrap plugin-react's `vite:react-compiler` configResolved so it always
10917
- * sees `isProduction: true` during builds. The compiler plugin uses
10918
- * `!config.isProduction` to decide whether to emit jsxDEV calls, but
10919
- * Vite derives isProduction from process.env.NODE_ENV — which may be
10920
- * "development" in the shell. Rather than mutating the env, we pass a
10921
- * prototype-based view with the single property overridden.
11051
+ * Adjust plugin-react's `vite:react-compiler` plugin:
11052
+ *
11053
+ * - Its configResolved always sees `isProduction: true` during builds. The
11054
+ * compiler plugin uses `!config.isProduction` to decide whether to emit
11055
+ * jsxDEV calls, but Vite derives isProduction from process.env.NODE_ENV —
11056
+ * which may be "development" in the shell. Rather than mutating the env,
11057
+ * we pass a prototype-based view with the single property overridden.
11058
+ * - In dev it runs on the client environment only. Its `shouldCompile`
11059
+ * requires a client environment, so on rsc/ssr it only repeats the
11060
+ * JSX/TS transform `vite:oxc` does next, plus a sourcemap: ~200ms of a
11061
+ * ~2.4s cold kitchen-sink request. Output is the same except for a
11062
+ * trailing semicolon in plugin-rsc's CSS stubs (TIM-1627).
11063
+ * Builds keep it on every environment, unchanged.
10922
11064
  */
10923
- function patchReactCompilerForProdJsx(plugins) {
11065
+ function patchReactCompiler(plugins) {
10924
11066
  for (const p of plugins) if (p && typeof p === "object" && "name" in p && p.name === "vite:react-compiler") {
10925
- const orig = p.configResolved;
10926
- if (typeof orig === "function") p.configResolved = function(config) {
11067
+ const plugin = p;
11068
+ const orig = plugin.configResolved;
11069
+ if (typeof orig === "function") plugin.configResolved = function(config) {
10927
11070
  const view = config.command === "build" && !config.isProduction ? Object.create(config, { isProduction: { value: true } }) : config;
10928
11071
  return orig.call(this, view);
10929
11072
  };
11073
+ plugin.applyToEnvironment = (env) => env.config.command === "build" || env.config.consumer === "client";
10930
11074
  }
10931
11075
  return plugins;
10932
11076
  }
10933
11077
  function timber(config) {
10934
11078
  const ctx = createPluginContext(config);
10935
- const consumerRequire = createRequire(join(process.cwd(), "package.json"));
10936
11079
  ctx.timer.start("rsc-plugin-import");
10937
- const rscMod = consumerRequire("@vitejs/plugin-rsc");
10938
- const vitePluginRsc = rscMod.default ?? rscMod;
11080
+ const vitePluginRsc = loadPluginRsc(process.cwd());
10939
11081
  ctx.timer.end("rsc-plugin-import");
10940
11082
  const encryptionKeyExpr = resolveEncryptionKeyExpression();
10941
11083
  const earlyFileConfig = loadTimberConfigFile(process.cwd());
@@ -11010,7 +11152,7 @@ function timber(config) {
11010
11152
  console: originalConsole
11011
11153
  });
11012
11154
  ctx.timer.start("client-deps-scan");
11013
- const { clientOptimizeDepsEntries, skipUseServerScanPlugin } = await import("./_chunks/client-dep-entries-C9hv-3k9.js");
11155
+ const { clientOptimizeDepsEntries, skipUseServerScanPlugin } = await import("./_chunks/client-dep-entries-C1nMlLKV.js");
11014
11156
  const entries = await clientOptimizeDepsEntries(resolvedRoot, BROWSER_ENTRY_FILE, buildDir);
11015
11157
  ctx.timer.end("client-deps-scan");
11016
11158
  return {
@@ -11054,8 +11196,9 @@ function timber(config) {
11054
11196
  timberReactResolve(),
11055
11197
  timberNodeFlightBuilds(),
11056
11198
  timberNativeRuntime(),
11199
+ timberPluginRscDeps(),
11057
11200
  timberReactProd(),
11058
- ...patchReactCompilerForProdJsx(react({ compiler: effectiveReactCompiler || false })),
11201
+ ...patchReactCompiler(react({ compiler: effectiveReactCompiler || false })),
11059
11202
  vitePluginRsc(createRscOptions(ctx, encryptionKeyExpr)),
11060
11203
  timberEncryptionRuntime(),
11061
11204
  timberShims(ctx),