@timber-js/app 0.2.0-alpha.97 → 0.2.0-alpha.99

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 (372) hide show
  1. package/dist/_chunks/actions-CQ8Z8VGL.js +1061 -0
  2. package/dist/_chunks/actions-CQ8Z8VGL.js.map +1 -0
  3. package/dist/_chunks/build-output-helper-DXnW0qjz.js +61 -0
  4. package/dist/_chunks/build-output-helper-DXnW0qjz.js.map +1 -0
  5. package/dist/_chunks/{define-Itxvcd7F.js → define-B-Q_UMOD.js} +19 -23
  6. package/dist/_chunks/define-B-Q_UMOD.js.map +1 -0
  7. package/dist/_chunks/{define-C77ScO0m.js → define-CfBPoJb0.js} +24 -7
  8. package/dist/_chunks/define-CfBPoJb0.js.map +1 -0
  9. package/dist/_chunks/define-cookie-BjpIt4UC.js +194 -0
  10. package/dist/_chunks/define-cookie-BjpIt4UC.js.map +1 -0
  11. package/dist/_chunks/{format-CYBGxKtc.js → format-Bcn-Iv1x.js} +1 -1
  12. package/dist/_chunks/{format-CYBGxKtc.js.map → format-Bcn-Iv1x.js.map} +1 -1
  13. package/dist/_chunks/handler-store-B-lqaGyh.js +54 -0
  14. package/dist/_chunks/handler-store-B-lqaGyh.js.map +1 -0
  15. package/dist/_chunks/logger-0m8MsKdc.js +291 -0
  16. package/dist/_chunks/logger-0m8MsKdc.js.map +1 -0
  17. package/dist/_chunks/merge-search-params-BphMdht_.js +122 -0
  18. package/dist/_chunks/merge-search-params-BphMdht_.js.map +1 -0
  19. package/dist/_chunks/{metadata-routes-DS3eKNmf.js → metadata-routes-BU684ls2.js} +1 -1
  20. package/dist/_chunks/{metadata-routes-DS3eKNmf.js.map → metadata-routes-BU684ls2.js.map} +1 -1
  21. package/dist/_chunks/navigation-root-BCYczjml.js +96 -0
  22. package/dist/_chunks/navigation-root-BCYczjml.js.map +1 -0
  23. package/dist/_chunks/registry-I2ss-lvy.js +20 -0
  24. package/dist/_chunks/registry-I2ss-lvy.js.map +1 -0
  25. package/dist/_chunks/router-ref-h3-UaCQv.js +28 -0
  26. package/dist/_chunks/router-ref-h3-UaCQv.js.map +1 -0
  27. package/dist/_chunks/{schema-bridge-C3xl_vfb.js → schema-bridge-Cxu4l-7p.js} +1 -1
  28. package/dist/_chunks/{schema-bridge-C3xl_vfb.js.map → schema-bridge-Cxu4l-7p.js.map} +1 -1
  29. package/dist/_chunks/segment-classify-BjfuctV2.js +137 -0
  30. package/dist/_chunks/segment-classify-BjfuctV2.js.map +1 -0
  31. package/dist/_chunks/{segment-context-fHFLF1PE.js → segment-context-Dx_OizxD.js} +1 -1
  32. package/dist/_chunks/{segment-context-fHFLF1PE.js.map → segment-context-Dx_OizxD.js.map} +1 -1
  33. package/dist/_chunks/{router-ref-C8OCm7g7.js → ssr-data-B4CdH7rE.js} +2 -26
  34. package/dist/_chunks/ssr-data-B4CdH7rE.js.map +1 -0
  35. package/dist/_chunks/{stale-reload-BX5gL1r-.js → stale-reload-Bab885FO.js} +1 -1
  36. package/dist/_chunks/{stale-reload-BX5gL1r-.js.map → stale-reload-Bab885FO.js.map} +1 -1
  37. package/dist/_chunks/tracing-C8V-YGsP.js +329 -0
  38. package/dist/_chunks/tracing-C8V-YGsP.js.map +1 -0
  39. package/dist/_chunks/{use-query-states-BiV5GJgm.js → use-query-states-B2XTqxDR.js} +3 -19
  40. package/dist/_chunks/use-query-states-B2XTqxDR.js.map +1 -0
  41. package/dist/_chunks/{use-params-IOPu7E8t.js → use-segment-params-BkpKAQ7D.js} +9 -95
  42. package/dist/_chunks/use-segment-params-BkpKAQ7D.js.map +1 -0
  43. package/dist/_chunks/{interception-BbqMCVXa.js → walkers-Tg0Alwcg.js} +66 -87
  44. package/dist/_chunks/walkers-Tg0Alwcg.js.map +1 -0
  45. package/dist/_chunks/{dev-warnings-DpGRGoDi.js → warnings-Cg47l5sk.js} +3 -3
  46. package/dist/_chunks/warnings-Cg47l5sk.js.map +1 -0
  47. package/dist/adapters/build-output-helper.d.ts +28 -0
  48. package/dist/adapters/build-output-helper.d.ts.map +1 -0
  49. package/dist/adapters/cloudflare.d.ts.map +1 -1
  50. package/dist/adapters/cloudflare.js +8 -28
  51. package/dist/adapters/cloudflare.js.map +1 -1
  52. package/dist/adapters/nitro.d.ts.map +1 -1
  53. package/dist/adapters/nitro.js +63 -31
  54. package/dist/adapters/nitro.js.map +1 -1
  55. package/dist/adapters/shared.d.ts +16 -0
  56. package/dist/adapters/shared.d.ts.map +1 -0
  57. package/dist/cache/index.js +9 -2
  58. package/dist/cache/index.js.map +1 -1
  59. package/dist/cache/timber-cache.d.ts.map +1 -1
  60. package/dist/client/error-boundary.js +2 -1
  61. package/dist/client/error-boundary.js.map +1 -1
  62. package/dist/client/form.d.ts +10 -24
  63. package/dist/client/form.d.ts.map +1 -1
  64. package/dist/client/index.d.ts +1 -5
  65. package/dist/client/index.d.ts.map +1 -1
  66. package/dist/client/index.js +41 -91
  67. package/dist/client/index.js.map +1 -1
  68. package/dist/client/internal.d.ts +2 -1
  69. package/dist/client/internal.d.ts.map +1 -1
  70. package/dist/client/internal.js +81 -7
  71. package/dist/client/internal.js.map +1 -1
  72. package/dist/client/rsc-fetch.d.ts.map +1 -1
  73. package/dist/client/state.d.ts +1 -1
  74. package/dist/client/use-cookie.d.ts +8 -0
  75. package/dist/client/use-cookie.d.ts.map +1 -1
  76. package/dist/client/{use-params.d.ts → use-segment-params.d.ts} +1 -1
  77. package/dist/client/use-segment-params.d.ts.map +1 -0
  78. package/dist/codec.d.ts +1 -1
  79. package/dist/codec.d.ts.map +1 -1
  80. package/dist/codec.js +2 -2
  81. package/dist/config-types.d.ts +28 -0
  82. package/dist/config-types.d.ts.map +1 -1
  83. package/dist/cookies/define-cookie.d.ts +87 -35
  84. package/dist/cookies/define-cookie.d.ts.map +1 -1
  85. package/dist/cookies/index.d.ts +2 -1
  86. package/dist/cookies/index.d.ts.map +1 -1
  87. package/dist/cookies/index.js +48 -2
  88. package/dist/cookies/index.js.map +1 -0
  89. package/dist/cookies/json-cookie.d.ts +64 -0
  90. package/dist/cookies/json-cookie.d.ts.map +1 -0
  91. package/dist/cookies/validation.d.ts +46 -0
  92. package/dist/cookies/validation.d.ts.map +1 -0
  93. package/dist/{plugins/dev-404-page.d.ts → dev-tools/404-page.d.ts} +9 -19
  94. package/dist/dev-tools/404-page.d.ts.map +1 -0
  95. package/dist/{plugins/dev-browser-logs.d.ts → dev-tools/browser-logs.d.ts} +1 -1
  96. package/dist/dev-tools/browser-logs.d.ts.map +1 -0
  97. package/dist/{plugins/dev-error-page.d.ts → dev-tools/error-page.d.ts} +2 -2
  98. package/dist/dev-tools/error-page.d.ts.map +1 -0
  99. package/dist/{server/dev-holding-server.d.ts → dev-tools/holding-server.d.ts} +5 -3
  100. package/dist/dev-tools/holding-server.d.ts.map +1 -0
  101. package/dist/dev-tools/index.d.ts +31 -0
  102. package/dist/dev-tools/index.d.ts.map +1 -0
  103. package/dist/{server/dev-span-processor.d.ts → dev-tools/instrumentation.d.ts} +26 -6
  104. package/dist/dev-tools/instrumentation.d.ts.map +1 -0
  105. package/dist/{server/dev-logger.d.ts → dev-tools/logger.d.ts} +1 -1
  106. package/dist/dev-tools/logger.d.ts.map +1 -0
  107. package/dist/{plugins/dev-logs.d.ts → dev-tools/logs.d.ts} +1 -1
  108. package/dist/dev-tools/logs.d.ts.map +1 -0
  109. package/dist/{plugins/dev-error-overlay.d.ts → dev-tools/overlay.d.ts} +3 -12
  110. package/dist/dev-tools/overlay.d.ts.map +1 -0
  111. package/dist/dev-tools/stack-classifier.d.ts +34 -0
  112. package/dist/dev-tools/stack-classifier.d.ts.map +1 -0
  113. package/dist/{plugins/dev-terminal-error.d.ts → dev-tools/terminal.d.ts} +2 -2
  114. package/dist/dev-tools/terminal.d.ts.map +1 -0
  115. package/dist/{server/dev-warnings.d.ts → dev-tools/warnings.d.ts} +1 -1
  116. package/dist/dev-tools/warnings.d.ts.map +1 -0
  117. package/dist/index.d.ts +1 -0
  118. package/dist/index.d.ts.map +1 -1
  119. package/dist/index.js +285 -133
  120. package/dist/index.js.map +1 -1
  121. package/dist/plugin-context.d.ts +1 -1
  122. package/dist/plugin-context.d.ts.map +1 -1
  123. package/dist/plugins/adapter-build.d.ts.map +1 -1
  124. package/dist/plugins/build-report.d.ts +6 -4
  125. package/dist/plugins/build-report.d.ts.map +1 -1
  126. package/dist/routing/convention-lint.d.ts.map +1 -1
  127. package/dist/routing/index.d.ts +5 -3
  128. package/dist/routing/index.d.ts.map +1 -1
  129. package/dist/routing/index.js +3 -3
  130. package/dist/routing/scanner.d.ts +1 -10
  131. package/dist/routing/scanner.d.ts.map +1 -1
  132. package/dist/routing/segment-classify.d.ts +37 -8
  133. package/dist/routing/segment-classify.d.ts.map +1 -1
  134. package/dist/routing/status-file-lint.d.ts.map +1 -1
  135. package/dist/routing/types.d.ts +63 -23
  136. package/dist/routing/types.d.ts.map +1 -1
  137. package/dist/routing/walkers.d.ts +51 -0
  138. package/dist/routing/walkers.d.ts.map +1 -0
  139. package/dist/search-params/define.d.ts +25 -7
  140. package/dist/search-params/define.d.ts.map +1 -1
  141. package/dist/search-params/index.js +5 -3
  142. package/dist/search-params/index.js.map +1 -1
  143. package/dist/search-params/wrappers.d.ts +2 -2
  144. package/dist/search-params/wrappers.d.ts.map +1 -1
  145. package/dist/segment-params/define.d.ts +23 -6
  146. package/dist/segment-params/define.d.ts.map +1 -1
  147. package/dist/segment-params/index.js +1 -1
  148. package/dist/server/access-gate.d.ts +4 -3
  149. package/dist/server/access-gate.d.ts.map +1 -1
  150. package/dist/server/action-handler.d.ts +15 -6
  151. package/dist/server/action-handler.d.ts.map +1 -1
  152. package/dist/server/als-registry.d.ts +5 -5
  153. package/dist/server/als-registry.d.ts.map +1 -1
  154. package/dist/server/asset-headers.d.ts +1 -15
  155. package/dist/server/asset-headers.d.ts.map +1 -1
  156. package/dist/server/cookie-context.d.ts +170 -0
  157. package/dist/server/cookie-context.d.ts.map +1 -0
  158. package/dist/server/cookie-parsing.d.ts +51 -0
  159. package/dist/server/cookie-parsing.d.ts.map +1 -0
  160. package/dist/server/deny-boundary.d.ts +90 -0
  161. package/dist/server/deny-boundary.d.ts.map +1 -0
  162. package/dist/server/deny-renderer.d.ts.map +1 -1
  163. package/dist/server/early-hints-sender.d.ts.map +1 -1
  164. package/dist/server/html-injector-core.d.ts +212 -0
  165. package/dist/server/html-injector-core.d.ts.map +1 -0
  166. package/dist/server/html-injectors.d.ts +59 -59
  167. package/dist/server/html-injectors.d.ts.map +1 -1
  168. package/dist/server/index.d.ts +5 -4
  169. package/dist/server/index.d.ts.map +1 -1
  170. package/dist/server/index.js +4 -149
  171. package/dist/server/index.js.map +1 -1
  172. package/dist/server/internal.d.ts +6 -4
  173. package/dist/server/internal.d.ts.map +1 -1
  174. package/dist/server/internal.js +852 -852
  175. package/dist/server/internal.js.map +1 -1
  176. package/dist/server/logger.d.ts +14 -0
  177. package/dist/server/logger.d.ts.map +1 -1
  178. package/dist/server/middleware-runner.d.ts +17 -0
  179. package/dist/server/middleware-runner.d.ts.map +1 -1
  180. package/dist/server/node-stream-transforms.d.ts +46 -49
  181. package/dist/server/node-stream-transforms.d.ts.map +1 -1
  182. package/dist/server/param-coercion.d.ts +26 -0
  183. package/dist/server/param-coercion.d.ts.map +1 -0
  184. package/dist/server/pipeline-helpers.d.ts +95 -0
  185. package/dist/server/pipeline-helpers.d.ts.map +1 -0
  186. package/dist/server/pipeline-outcome.d.ts +49 -0
  187. package/dist/server/pipeline-outcome.d.ts.map +1 -0
  188. package/dist/server/pipeline-phases.d.ts +52 -0
  189. package/dist/server/pipeline-phases.d.ts.map +1 -0
  190. package/dist/server/pipeline.d.ts +51 -32
  191. package/dist/server/pipeline.d.ts.map +1 -1
  192. package/dist/server/port-resolution.d.ts +117 -0
  193. package/dist/server/port-resolution.d.ts.map +1 -0
  194. package/dist/server/request-context.d.ts +22 -159
  195. package/dist/server/request-context.d.ts.map +1 -1
  196. package/dist/server/route-element-builder.d.ts.map +1 -1
  197. package/dist/server/route-matcher.d.ts +20 -47
  198. package/dist/server/route-matcher.d.ts.map +1 -1
  199. package/dist/server/rsc-entry/action-middleware-runner.d.ts +66 -0
  200. package/dist/server/rsc-entry/action-middleware-runner.d.ts.map +1 -0
  201. package/dist/server/rsc-entry/helpers.d.ts +1 -1
  202. package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
  203. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  204. package/dist/server/rsc-entry/render-route.d.ts +50 -0
  205. package/dist/server/rsc-entry/render-route.d.ts.map +1 -0
  206. package/dist/server/rsc-entry/wrap-action-dispatch.d.ts +119 -0
  207. package/dist/server/rsc-entry/wrap-action-dispatch.d.ts.map +1 -0
  208. package/dist/server/state-tree-diff.d.ts.map +1 -1
  209. package/dist/server/status-code-resolver.d.ts +16 -11
  210. package/dist/server/status-code-resolver.d.ts.map +1 -1
  211. package/dist/server/tracing.d.ts +1 -1
  212. package/dist/server/tracing.d.ts.map +1 -1
  213. package/dist/server/tree-builder.d.ts +45 -16
  214. package/dist/server/tree-builder.d.ts.map +1 -1
  215. package/dist/server/types.d.ts +48 -0
  216. package/dist/server/types.d.ts.map +1 -1
  217. package/dist/server/utils/escape-html.d.ts +14 -0
  218. package/dist/server/utils/escape-html.d.ts.map +1 -0
  219. package/dist/shims/headers.d.ts +2 -2
  220. package/dist/shims/headers.d.ts.map +1 -1
  221. package/dist/shims/navigation-client.d.ts +3 -1
  222. package/dist/shims/navigation-client.d.ts.map +1 -1
  223. package/dist/shims/navigation.d.ts +9 -4
  224. package/dist/shims/navigation.d.ts.map +1 -1
  225. package/dist/utils/directive-parser.d.ts +0 -45
  226. package/dist/utils/directive-parser.d.ts.map +1 -1
  227. package/package.json +1 -1
  228. package/src/adapters/build-output-helper.ts +77 -0
  229. package/src/adapters/cloudflare.ts +10 -50
  230. package/src/adapters/nitro.ts +66 -50
  231. package/src/adapters/shared.ts +40 -0
  232. package/src/cache/timber-cache.ts +3 -2
  233. package/src/client/form.tsx +17 -25
  234. package/src/client/index.ts +16 -9
  235. package/src/client/internal.ts +3 -2
  236. package/src/client/router.ts +1 -1
  237. package/src/client/rsc-fetch.ts +15 -0
  238. package/src/client/state.ts +2 -2
  239. package/src/client/use-cookie.ts +29 -0
  240. package/src/codec.ts +3 -7
  241. package/src/config-types.ts +28 -0
  242. package/src/cookies/define-cookie.ts +271 -78
  243. package/src/cookies/index.ts +11 -8
  244. package/src/cookies/json-cookie.ts +105 -0
  245. package/src/cookies/validation.ts +134 -0
  246. package/src/{plugins/dev-404-page.ts → dev-tools/404-page.ts} +17 -48
  247. package/src/{plugins/dev-error-page.ts → dev-tools/error-page.ts} +5 -32
  248. package/src/{server/dev-holding-server.ts → dev-tools/holding-server.ts} +4 -2
  249. package/src/dev-tools/index.ts +90 -0
  250. package/src/dev-tools/instrumentation.ts +176 -0
  251. package/src/{plugins/dev-logs.ts → dev-tools/logs.ts} +2 -2
  252. package/src/{plugins/dev-error-overlay.ts → dev-tools/overlay.ts} +5 -23
  253. package/src/dev-tools/stack-classifier.ts +75 -0
  254. package/src/{plugins/dev-terminal-error.ts → dev-tools/terminal.ts} +4 -38
  255. package/src/{server/dev-warnings.ts → dev-tools/warnings.ts} +1 -1
  256. package/src/index.ts +95 -34
  257. package/src/plugin-context.ts +1 -1
  258. package/src/plugins/adapter-build.ts +3 -1
  259. package/src/plugins/build-report.ts +13 -22
  260. package/src/plugins/dev-server.ts +3 -3
  261. package/src/plugins/routing.ts +14 -12
  262. package/src/plugins/shims.ts +1 -1
  263. package/src/plugins/static-build.ts +1 -1
  264. package/src/routing/codegen.ts +1 -1
  265. package/src/routing/convention-lint.ts +9 -8
  266. package/src/routing/index.ts +5 -3
  267. package/src/routing/interception.ts +1 -1
  268. package/src/routing/scanner.ts +22 -95
  269. package/src/routing/segment-classify.ts +107 -8
  270. package/src/routing/status-file-lint.ts +7 -5
  271. package/src/routing/types.ts +63 -23
  272. package/src/routing/walkers.ts +90 -0
  273. package/src/search-params/define.ts +71 -15
  274. package/src/search-params/wrappers.ts +9 -2
  275. package/src/segment-params/define.ts +66 -13
  276. package/src/server/access-gate.tsx +9 -8
  277. package/src/server/action-handler.ts +34 -38
  278. package/src/server/als-registry.ts +5 -5
  279. package/src/server/asset-headers.ts +8 -34
  280. package/src/server/cookie-context.ts +468 -0
  281. package/src/server/cookie-parsing.ts +135 -0
  282. package/src/server/{deny-page-resolver.ts → deny-boundary.ts} +78 -14
  283. package/src/server/deny-renderer.ts +7 -12
  284. package/src/server/early-hints-sender.ts +3 -2
  285. package/src/server/fallback-error.ts +2 -2
  286. package/src/server/html-injector-core.ts +403 -0
  287. package/src/server/html-injectors.ts +158 -297
  288. package/src/server/index.ts +13 -14
  289. package/src/server/internal.ts +10 -3
  290. package/src/server/logger.ts +23 -0
  291. package/src/server/middleware-runner.ts +44 -0
  292. package/src/server/node-stream-transforms.ts +108 -248
  293. package/src/server/param-coercion.ts +76 -0
  294. package/src/server/pipeline-helpers.ts +204 -0
  295. package/src/server/pipeline-outcome.ts +167 -0
  296. package/src/server/pipeline-phases.ts +409 -0
  297. package/src/server/pipeline.ts +70 -540
  298. package/src/server/port-resolution.ts +215 -0
  299. package/src/server/request-context.ts +46 -451
  300. package/src/server/route-element-builder.ts +8 -4
  301. package/src/server/route-matcher.ts +28 -60
  302. package/src/server/rsc-entry/action-middleware-runner.ts +167 -0
  303. package/src/server/rsc-entry/api-handler.ts +2 -2
  304. package/src/server/rsc-entry/error-renderer.ts +2 -2
  305. package/src/server/rsc-entry/helpers.ts +2 -7
  306. package/src/server/rsc-entry/index.ts +81 -366
  307. package/src/server/rsc-entry/render-route.ts +304 -0
  308. package/src/server/rsc-entry/rsc-payload.ts +1 -1
  309. package/src/server/rsc-entry/ssr-renderer.ts +2 -2
  310. package/src/server/rsc-entry/wrap-action-dispatch.ts +449 -0
  311. package/src/server/sitemap-generator.ts +1 -1
  312. package/src/server/slot-resolver.ts +1 -1
  313. package/src/server/ssr-entry.ts +1 -1
  314. package/src/server/state-tree-diff.ts +4 -1
  315. package/src/server/status-code-resolver.ts +112 -128
  316. package/src/server/tracing.ts +3 -3
  317. package/src/server/tree-builder.ts +134 -56
  318. package/src/server/types.ts +52 -0
  319. package/src/server/utils/escape-html.ts +20 -0
  320. package/src/shims/headers.ts +3 -3
  321. package/src/shims/navigation-client.ts +4 -3
  322. package/src/shims/navigation.ts +9 -7
  323. package/src/utils/directive-parser.ts +0 -392
  324. package/dist/_chunks/actions-DLnUaR65.js +0 -421
  325. package/dist/_chunks/actions-DLnUaR65.js.map +0 -1
  326. package/dist/_chunks/als-registry-HS0LGUl2.js +0 -41
  327. package/dist/_chunks/als-registry-HS0LGUl2.js.map +0 -1
  328. package/dist/_chunks/debug-ECi_61pb.js +0 -108
  329. package/dist/_chunks/debug-ECi_61pb.js.map +0 -1
  330. package/dist/_chunks/define-C77ScO0m.js.map +0 -1
  331. package/dist/_chunks/define-Itxvcd7F.js.map +0 -1
  332. package/dist/_chunks/define-cookie-BowvzoP0.js +0 -94
  333. package/dist/_chunks/define-cookie-BowvzoP0.js.map +0 -1
  334. package/dist/_chunks/dev-warnings-DpGRGoDi.js.map +0 -1
  335. package/dist/_chunks/interception-BbqMCVXa.js.map +0 -1
  336. package/dist/_chunks/merge-search-params-Cm_KIWDX.js +0 -41
  337. package/dist/_chunks/merge-search-params-Cm_KIWDX.js.map +0 -1
  338. package/dist/_chunks/request-context-CK5tZqIP.js +0 -478
  339. package/dist/_chunks/request-context-CK5tZqIP.js.map +0 -1
  340. package/dist/_chunks/router-ref-C8OCm7g7.js.map +0 -1
  341. package/dist/_chunks/segment-classify-BDNn6EzD.js +0 -65
  342. package/dist/_chunks/segment-classify-BDNn6EzD.js.map +0 -1
  343. package/dist/_chunks/tracing-CCYbKn5n.js +0 -238
  344. package/dist/_chunks/tracing-CCYbKn5n.js.map +0 -1
  345. package/dist/_chunks/use-params-IOPu7E8t.js.map +0 -1
  346. package/dist/_chunks/use-query-states-BiV5GJgm.js.map +0 -1
  347. package/dist/client/use-params.d.ts.map +0 -1
  348. package/dist/plugins/dev-404-page.d.ts.map +0 -1
  349. package/dist/plugins/dev-browser-logs.d.ts.map +0 -1
  350. package/dist/plugins/dev-error-overlay.d.ts.map +0 -1
  351. package/dist/plugins/dev-error-page.d.ts.map +0 -1
  352. package/dist/plugins/dev-logs.d.ts.map +0 -1
  353. package/dist/plugins/dev-terminal-error.d.ts.map +0 -1
  354. package/dist/server/deny-page-resolver.d.ts +0 -52
  355. package/dist/server/deny-page-resolver.d.ts.map +0 -1
  356. package/dist/server/dev-fetch-instrumentation.d.ts +0 -22
  357. package/dist/server/dev-fetch-instrumentation.d.ts.map +0 -1
  358. package/dist/server/dev-holding-server.d.ts.map +0 -1
  359. package/dist/server/dev-logger.d.ts.map +0 -1
  360. package/dist/server/dev-span-processor.d.ts.map +0 -1
  361. package/dist/server/dev-warnings.d.ts.map +0 -1
  362. package/dist/server/manifest-status-resolver.d.ts +0 -58
  363. package/dist/server/manifest-status-resolver.d.ts.map +0 -1
  364. package/dist/server/page-deny-boundary.d.ts +0 -31
  365. package/dist/server/page-deny-boundary.d.ts.map +0 -1
  366. package/src/server/dev-fetch-instrumentation.ts +0 -96
  367. package/src/server/dev-span-processor.ts +0 -78
  368. package/src/server/manifest-status-resolver.ts +0 -215
  369. package/src/server/page-deny-boundary.tsx +0 -56
  370. /package/src/client/{use-params.ts → use-segment-params.ts} +0 -0
  371. /package/src/{plugins/dev-browser-logs.ts → dev-tools/browser-logs.ts} +0 -0
  372. /package/src/{server/dev-logger.ts → dev-tools/logger.ts} +0 -0
package/dist/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __exportAll, t as __commonJSMin } from "./_chunks/chunk-BYIpzuS7.js";
2
- import { n as setViteServer } from "./_chunks/dev-warnings-DpGRGoDi.js";
3
- import { i as scanRoutes, n as generateRouteMap, t as collectInterceptionRewrites } from "./_chunks/interception-BbqMCVXa.js";
4
- import { t as formatSize } from "./_chunks/format-CYBGxKtc.js";
2
+ import { n as setViteServer } from "./_chunks/warnings-Cg47l5sk.js";
3
+ import { h as swallow } from "./_chunks/logger-0m8MsKdc.js";
4
+ import { i as scanRoutes, n as collectInterceptionRewrites, r as generateRouteMap, t as collectLeafRoutes } from "./_chunks/walkers-Tg0Alwcg.js";
5
+ import { t as formatSize } from "./_chunks/format-Bcn-Iv1x.js";
5
6
  import { dirname, extname, join, normalize, resolve } from "node:path";
6
7
  import { createRequire } from "node:module";
7
8
  import react, { reactCompilerPreset } from "@vitejs/plugin-react";
@@ -98,7 +99,60 @@ function timberContent(ctx) {
98
99
  };
99
100
  }
100
101
  //#endregion
101
- //#region src/plugins/dev-terminal-error.ts
102
+ //#region src/dev-tools/stack-classifier.ts
103
+ /** Parse file/line/col from a stack frame line. */
104
+ function parseFrame(frameLine) {
105
+ const parenMatch = /\(([^)]+):(\d+):(\d+)\)/.exec(frameLine);
106
+ if (parenMatch) return {
107
+ file: parenMatch[1],
108
+ line: Number(parenMatch[2]),
109
+ col: Number(parenMatch[3])
110
+ };
111
+ const bareMatch = /at (\/[^:]+):(\d+):(\d+)/.exec(frameLine);
112
+ if (bareMatch) return {
113
+ file: bareMatch[1],
114
+ line: Number(bareMatch[2]),
115
+ col: Number(bareMatch[3])
116
+ };
117
+ return {};
118
+ }
119
+ /**
120
+ * Classify a single stack frame line by origin.
121
+ *
122
+ * - 'app': user application code (in project root, not node_modules)
123
+ * - 'framework': timber-app internal code
124
+ * - 'internal': node_modules, Node.js internals
125
+ */
126
+ function classifyFrame(frameLine, projectRoot) {
127
+ const trimmed = frameLine.trim();
128
+ if (trimmed.includes("packages/timber-app/")) return "framework";
129
+ if (trimmed.includes("node_modules/")) return "internal";
130
+ if (trimmed.startsWith("at node:") || trimmed.includes("(node:")) return "internal";
131
+ if (trimmed.includes(projectRoot)) return "app";
132
+ return "internal";
133
+ }
134
+ /**
135
+ * Classify all frames in a full stack trace string.
136
+ *
137
+ * Parses the stack, skips the first line (error message), filters to
138
+ * lines starting with "at ", and returns classified frames with optional
139
+ * file/line/col metadata.
140
+ */
141
+ function classifyStack(stack, projectRoot) {
142
+ return stack.split("\n").slice(1).filter((line) => line.trim().startsWith("at ")).map((raw) => {
143
+ const type = classifyFrame(raw, projectRoot);
144
+ const { file, line, col } = parseFrame(raw);
145
+ return {
146
+ raw,
147
+ type,
148
+ file,
149
+ line,
150
+ col
151
+ };
152
+ });
153
+ }
154
+ //#endregion
155
+ //#region src/dev-tools/terminal.ts
102
156
  /**
103
157
  * Terminal error formatting — boxed, color-coded error output for dev mode.
104
158
  *
@@ -165,35 +219,6 @@ function box(lines, borderColor, width = 80) {
165
219
  output.push(`${borderColor}${BOX.bottomLeft}${bar}${BOX.bottomRight}${RESET$2}`);
166
220
  return output.join("\n");
167
221
  }
168
- /** Parse file/line/col from a stack frame line. */
169
- function parseFrame(frameLine) {
170
- const parenMatch = /\(([^)]+):(\d+):(\d+)\)/.exec(frameLine);
171
- if (parenMatch) return {
172
- file: parenMatch[1],
173
- line: Number(parenMatch[2]),
174
- col: Number(parenMatch[3])
175
- };
176
- const bareMatch = /at (\/[^:]+):(\d+):(\d+)/.exec(frameLine);
177
- if (bareMatch) return {
178
- file: bareMatch[1],
179
- line: Number(bareMatch[2]),
180
- col: Number(bareMatch[3])
181
- };
182
- return {};
183
- }
184
- function classifyFrames(stack, projectRoot) {
185
- return stack.split("\n").slice(1).filter((l) => l.trim().startsWith("at ")).map((raw) => {
186
- const type = classifyFrame(raw, projectRoot);
187
- const { file, line, col } = parseFrame(raw);
188
- return {
189
- raw,
190
- type,
191
- file,
192
- line,
193
- col
194
- };
195
- });
196
- }
197
222
  /**
198
223
  * Format an error for terminal output with a boxed layout.
199
224
  *
@@ -208,7 +233,7 @@ function formatTerminalError$1(error, phase, projectRoot) {
208
233
  const sections = [];
209
234
  const componentStack = extractComponentStack(error);
210
235
  const loc = parseFirstAppFrame(error.stack ?? "", projectRoot);
211
- const frames = error.stack ? classifyFrames(error.stack, projectRoot) : [];
236
+ const frames = error.stack ? classifyStack(error.stack, projectRoot) : [];
212
237
  const appFrames = frames.filter((f) => f.type === "app");
213
238
  const internalCount = frames.filter((f) => f.type !== "app").length;
214
239
  const boxLines = [];
@@ -247,7 +272,7 @@ function extractFnName(frameLine) {
247
272
  return match ? match[1] : "";
248
273
  }
249
274
  //#endregion
250
- //#region src/plugins/dev-error-overlay.ts
275
+ //#region src/dev-tools/overlay.ts
251
276
  var _traceMapping = null;
252
277
  /**
253
278
  * Lazy-load @jridgewell/trace-mapping from Vite's dependency tree.
@@ -269,21 +294,6 @@ var PHASE_LABELS$1 = {
269
294
  "handler": "Route Handler"
270
295
  };
271
296
  /**
272
- * Classify a stack frame line by origin.
273
- *
274
- * - 'app': user application code (in project root, not node_modules)
275
- * - 'framework': timber-app internal code
276
- * - 'internal': node_modules, Node.js internals
277
- */
278
- function classifyFrame(frameLine, projectRoot) {
279
- const trimmed = frameLine.trim();
280
- if (trimmed.includes("packages/timber-app/")) return "framework";
281
- if (trimmed.includes("node_modules/")) return "internal";
282
- if (trimmed.startsWith("at node:") || trimmed.includes("(node:")) return "internal";
283
- if (trimmed.includes(projectRoot)) return "app";
284
- return "internal";
285
- }
286
- /**
287
297
  * Extract the React component stack from an error, if present.
288
298
  * React attaches this as `componentStack` during renderToReadableStream errors.
289
299
  */
@@ -528,7 +538,24 @@ function sendErrorToOverlay(server, error, phase, projectRoot, rscDebugComponent
528
538
  } catch {}
529
539
  }
530
540
  //#endregion
531
- //#region src/plugins/dev-error-page.ts
541
+ //#region src/server/utils/escape-html.ts
542
+ /**
543
+ * Shared HTML escaping utility.
544
+ *
545
+ * Used by both dev-only paths (error pages, 404 page) and production
546
+ * paths (deny-renderer, RSC helpers). Lives in server/utils/ because
547
+ * it's not dev-only.
548
+ */
549
+ /**
550
+ * Escape a string for safe embedding in HTML content or attributes.
551
+ *
552
+ * Replaces `&`, `<`, `>`, and `"` with their HTML entity equivalents.
553
+ */
554
+ function escapeHtml(str) {
555
+ return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
556
+ }
557
+ //#endregion
558
+ //#region src/dev-tools/error-page.ts
532
559
  /**
533
560
  * Dev error page — self-contained HTML error page for dev server 500s.
534
561
  *
@@ -560,12 +587,6 @@ var PHASE_HINTS = {
560
587
  "render": "This error occurred while rendering a server component. Check the component for runtime errors.",
561
588
  "handler": "This error occurred in a route handler (route.ts). Check the handler function."
562
589
  };
563
- function classifyStack(stack, projectRoot) {
564
- return stack.split("\n").slice(1).filter((line) => line.trim().startsWith("at ")).map((line) => ({
565
- raw: line,
566
- type: classifyFrame(line, projectRoot)
567
- }));
568
- }
569
590
  /**
570
591
  * Try to read a few lines of source code around the error location.
571
592
  * Returns null if the file can't be read (e.g., virtual modules).
@@ -588,9 +609,7 @@ function readSourceContext(filePath, line, contextLines = 3) {
588
609
  return null;
589
610
  }
590
611
  }
591
- function esc(str) {
592
- return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
593
- }
612
+ var esc = escapeHtml;
594
613
  /**
595
614
  * Escape a JSON string for safe embedding in an HTML `<script>` block.
596
615
  *
@@ -12392,10 +12411,6 @@ var require_acorn = /* @__PURE__ */ __commonJSMin(((exports, module) => {
12392
12411
  * avoiding false positives from regex matching inside string literals,
12393
12412
  * comments, or template expressions.
12394
12413
  *
12395
- * The function-body directive detection (findFunctionsWithDirective) is a
12396
- * general-purpose utility kept for future use. Custom directives like
12397
- * 'use cache' are not currently implemented — see design/06-caching.md.
12398
- *
12399
12414
  * @module
12400
12415
  */
12401
12416
  var import_acorn_jsx = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -12850,17 +12865,18 @@ function lintStatusFileDirectives(tree) {
12850
12865
  }
12851
12866
  function walkNode(node, warnings) {
12852
12867
  if (node.error) checkFile(node.error.filePath, node.error.extension, "error", warnings);
12853
- if (node.statusFiles) for (const [code, file] of node.statusFiles) checkFile(file.filePath, file.extension, code, warnings);
12854
- if (node.legacyStatusFiles) for (const [name, file] of node.legacyStatusFiles) checkFile(file.filePath, file.extension, name, warnings);
12868
+ if (node.statusFiles) for (const [code, file] of Object.entries(node.statusFiles)) checkFile(file.filePath, file.extension, code, warnings);
12869
+ if (node.legacyStatusFiles) for (const [name, file] of Object.entries(node.legacyStatusFiles)) checkFile(file.filePath, file.extension, name, warnings);
12855
12870
  for (const child of node.children) walkNode(child, warnings);
12856
- for (const [, slotNode] of node.slots) walkNode(slotNode, warnings);
12871
+ for (const slotNode of Object.values(node.slots)) walkNode(slotNode, warnings);
12857
12872
  }
12858
12873
  function checkFile(filePath, extension, fileType, warnings) {
12859
12874
  if (!CLIENT_REQUIRED_EXTENSIONS.has(extension)) return;
12860
12875
  let code;
12861
12876
  try {
12862
12877
  code = readFileSync(filePath, "utf-8");
12863
- } catch {
12878
+ } catch (err) {
12879
+ swallow(err, `status-file-lint: unreadable file ${filePath}`);
12864
12880
  return;
12865
12881
  }
12866
12882
  if (!detectFileDirective(code, ["use client"])) warnings.push({
@@ -12935,7 +12951,7 @@ function checkEmptyApp(root, appDir, warnings) {
12935
12951
  function hasAnyRoutable(node) {
12936
12952
  if (node.page || node.route) return true;
12937
12953
  for (const child of node.children) if (hasAnyRoutable(child)) return true;
12938
- for (const [, slot] of node.slots) if (hasAnyRoutable(slot)) return true;
12954
+ for (const slot of Object.values(node.slots)) if (hasAnyRoutable(slot)) return true;
12939
12955
  return false;
12940
12956
  }
12941
12957
  /**
@@ -12946,7 +12962,7 @@ function hasAnyRoutable(node) {
12946
12962
  function hasAnyPage(node) {
12947
12963
  if (node.page) return true;
12948
12964
  for (const child of node.children) if (hasAnyPage(child)) return true;
12949
- for (const [, slot] of node.slots) if (hasAnyPage(slot)) return true;
12965
+ for (const slot of Object.values(node.slots)) if (hasAnyPage(slot)) return true;
12950
12966
  return false;
12951
12967
  }
12952
12968
  /** HTTP methods that route.ts can export. */
@@ -12992,10 +13008,12 @@ function checkRouteExports(node, warnings) {
12992
13008
  level: "warn"
12993
13009
  });
12994
13010
  }
12995
- } catch {}
13011
+ } catch (err) {
13012
+ swallow(err, `convention-lint: unreadable route.ts ${filePath}`);
13013
+ }
12996
13014
  }
12997
13015
  for (const child of node.children) checkRouteExports(child, warnings);
12998
- for (const [, slot] of node.slots) checkRouteExports(slot, warnings);
13016
+ for (const slot of Object.values(node.slots)) checkRouteExports(slot, warnings);
12999
13017
  }
13000
13018
  /**
13001
13019
  * Warn when the root segment has no layout.tsx.
@@ -13036,7 +13054,7 @@ function checkDefaultExports(node, warnings) {
13036
13054
  if (node.page && isScriptExtension(node.page.extension)) checkFileDefaultExport(node.page.filePath, "page", warnings);
13037
13055
  if (node.layout && isScriptExtension(node.layout.extension)) checkFileDefaultExport(node.layout.filePath, "layout", warnings);
13038
13056
  for (const child of node.children) checkDefaultExports(child, warnings);
13039
- for (const [, slot] of node.slots) checkDefaultExports(slot, warnings);
13057
+ for (const slot of Object.values(node.slots)) checkDefaultExports(slot, warnings);
13040
13058
  }
13041
13059
  function isScriptExtension(ext) {
13042
13060
  return ext === "tsx" || ext === "ts" || ext === "jsx" || ext === "js";
@@ -13050,7 +13068,9 @@ function checkFileDefaultExport(filePath, fileType, warnings) {
13050
13068
  details: ` File: ${filePath}\n\n ${fileType}.tsx files must export a default React component.\n Without a default export, the ${fileType === "page" ? "page renders nothing" : "layout has no component to wrap children"}.\n\n To fix: Add a default export:\n\n export default function My${fileType === "page" ? "Page" : "Layout"}(${fileType === "layout" ? "{ children }" : ""}) {\n return ${fileType === "layout" ? "<div>{children}</div>" : "<h1>Hello</h1>"};\n }\n`,
13051
13069
  level: "warn"
13052
13070
  });
13053
- } catch {}
13071
+ } catch (err) {
13072
+ swallow(err, `convention-lint: unreadable ${fileType} file ${filePath}`);
13073
+ }
13054
13074
  }
13055
13075
  /**
13056
13076
  * Check if the app/ directory exists. Called before scanning.
@@ -13169,7 +13189,7 @@ function timberRouting(ctx) {
13169
13189
  segmentType: "static",
13170
13190
  urlPath: "/",
13171
13191
  children: [],
13172
- slots: /* @__PURE__ */ new Map()
13192
+ slots: {}
13173
13193
  } };
13174
13194
  return;
13175
13195
  }
@@ -13293,7 +13313,7 @@ function generateSearchParamsRegistryModule(tree) {
13293
13313
  });
13294
13314
  }
13295
13315
  for (const child of node.children) walk(child);
13296
- for (const [, slot] of node.slots) walk(slot);
13316
+ for (const slot of Object.values(node.slots)) walk(slot);
13297
13317
  }
13298
13318
  walk(tree.root);
13299
13319
  entries.sort((a, b) => a.urlPath.localeCompare(b.urlPath));
@@ -13395,33 +13415,33 @@ function generateManifestModule(tree, viteRoot) {
13395
13415
  const v = addImport(node.params);
13396
13416
  parts.push(`${nextIndent}params: { load: ${v}, filePath: ${JSON.stringify(node.params.filePath)} },`);
13397
13417
  }
13398
- if (node.statusFiles && node.statusFiles.size > 0) {
13418
+ if (node.statusFiles && Object.keys(node.statusFiles).length > 0) {
13399
13419
  const statusEntries = [];
13400
- for (const [code, file] of node.statusFiles) {
13420
+ for (const [code, file] of Object.entries(node.statusFiles)) {
13401
13421
  const v = addImport(file);
13402
13422
  statusEntries.push(`${nextIndent} ${JSON.stringify(code)}: { load: ${v}, filePath: ${JSON.stringify(file.filePath)} }`);
13403
13423
  }
13404
13424
  parts.push(`${nextIndent}statusFiles: {\n${statusEntries.join(",\n")}\n${nextIndent}},`);
13405
13425
  }
13406
- if (node.jsonStatusFiles && node.jsonStatusFiles.size > 0) {
13426
+ if (node.jsonStatusFiles && Object.keys(node.jsonStatusFiles).length > 0) {
13407
13427
  const jsonEntries = [];
13408
- for (const [code, file] of node.jsonStatusFiles) {
13428
+ for (const [code, file] of Object.entries(node.jsonStatusFiles)) {
13409
13429
  const v = addImport(file);
13410
13430
  jsonEntries.push(`${nextIndent} ${JSON.stringify(code)}: { load: ${v}, filePath: ${JSON.stringify(file.filePath)} }`);
13411
13431
  }
13412
13432
  parts.push(`${nextIndent}jsonStatusFiles: {\n${jsonEntries.join(",\n")}\n${nextIndent}},`);
13413
13433
  }
13414
- if (node.legacyStatusFiles && node.legacyStatusFiles.size > 0) {
13434
+ if (node.legacyStatusFiles && Object.keys(node.legacyStatusFiles).length > 0) {
13415
13435
  const legacyEntries = [];
13416
- for (const [name, file] of node.legacyStatusFiles) {
13436
+ for (const [name, file] of Object.entries(node.legacyStatusFiles)) {
13417
13437
  const v = addImport(file);
13418
13438
  legacyEntries.push(`${nextIndent} ${JSON.stringify(name)}: { load: ${v}, filePath: ${JSON.stringify(file.filePath)} }`);
13419
13439
  }
13420
13440
  parts.push(`${nextIndent}legacyStatusFiles: {\n${legacyEntries.join(",\n")}\n${nextIndent}},`);
13421
13441
  }
13422
- if (node.metadataRoutes && node.metadataRoutes.size > 0) {
13442
+ if (node.metadataRoutes && Object.keys(node.metadataRoutes).length > 0) {
13423
13443
  const metaEntries = [];
13424
- for (const [name, file] of node.metadataRoutes) {
13444
+ for (const [name, file] of Object.entries(node.metadataRoutes)) {
13425
13445
  const v = addImport(file);
13426
13446
  metaEntries.push(`${nextIndent} ${JSON.stringify(name)}: { load: ${v}, filePath: ${JSON.stringify(file.filePath)} }`);
13427
13447
  }
@@ -13431,9 +13451,13 @@ function generateManifestModule(tree, viteRoot) {
13431
13451
  const childNodes = node.children.map((c) => serializeNode(c, nextIndent));
13432
13452
  parts.push(`${nextIndent}children: [\n${childNodes.join(",\n")}\n${nextIndent}],`);
13433
13453
  } else parts.push(`${nextIndent}children: [],`);
13434
- if (node.slots.size > 0) {
13454
+ const slotKeys = Object.keys(node.slots);
13455
+ if (slotKeys.length > 0) {
13435
13456
  const slotEntries = [];
13436
- for (const [slotName, slotNode] of node.slots) slotEntries.push(`${nextIndent} ${JSON.stringify(slotName)}: ${serializeNode(slotNode, nextIndent + " ")}`);
13457
+ for (const slotName of slotKeys) {
13458
+ const slotNode = node.slots[slotName];
13459
+ slotEntries.push(`${nextIndent} ${JSON.stringify(slotName)}: ${serializeNode(slotNode, nextIndent + " ")}`);
13460
+ }
13437
13461
  parts.push(`${nextIndent}slots: {\n${slotEntries.join(",\n")}\n${nextIndent}},`);
13438
13462
  } else parts.push(`${nextIndent}slots: {},`);
13439
13463
  return `${indent}{\n${parts.join("\n")}\n${indent}}`;
@@ -13590,7 +13614,7 @@ export const headers = stub;
13590
13614
  export const cookies = stub;
13591
13615
  export const getHeaders = stub;
13592
13616
  export const getHeader = stub;
13593
- export const getCookies = stub;
13617
+ export const getCookieJar = stub;
13594
13618
  export const getCookie = stub;
13595
13619
  export const getSearchParams = stub;
13596
13620
  export const getSegmentParams = stub;
@@ -15214,8 +15238,8 @@ function timberFonts(ctx) {
15214
15238
  */
15215
15239
  var DYNAMIC_API_PATTERNS = [
15216
15240
  {
15217
- pattern: /\bgetCookies\s*\(/,
15218
- name: "getCookies()"
15241
+ pattern: /\bgetCookieJar\s*\(/,
15242
+ name: "getCookieJar()"
15219
15243
  },
15220
15244
  {
15221
15245
  pattern: /\bgetHeaders\s*\(/,
@@ -15592,7 +15616,7 @@ function timberBuildManifest(ctx) {
15592
15616
  };
15593
15617
  }
15594
15618
  //#endregion
15595
- //#region src/plugins/dev-logs.ts
15619
+ //#region src/dev-tools/logs.ts
15596
15620
  var LOG_LEVELS = [
15597
15621
  "log",
15598
15622
  "warn",
@@ -15671,7 +15695,7 @@ function extractCallerLocation(projectRoot) {
15671
15695
  const lines = stack.split("\n");
15672
15696
  for (let i = 1; i < lines.length; i++) {
15673
15697
  const line = lines[i].trim();
15674
- if (line.includes("dev-logs")) continue;
15698
+ if (line.includes("dev-tools/logs")) continue;
15675
15699
  if (line.includes("node:") || line.includes("node_modules")) continue;
15676
15700
  const match = line.match(/\((.+?):(\d+):(\d+)\)/) ?? line.match(/at (.+?):(\d+):(\d+)/);
15677
15701
  if (match) {
@@ -15699,7 +15723,7 @@ function isFrameworkInternalCaller() {
15699
15723
  const lines = stack.split("\n");
15700
15724
  for (let i = 1; i < lines.length; i++) {
15701
15725
  const line = lines[i].trim();
15702
- if (line.includes("dev-logs")) continue;
15726
+ if (line.includes("dev-tools/logs")) continue;
15703
15727
  if (line.includes("node:")) continue;
15704
15728
  if (!(line.includes("timber-app/") || line.includes("@timber-js/app/"))) return false;
15705
15729
  return line.includes("/plugins/") || line.includes("/adapters/");
@@ -15757,7 +15781,7 @@ function timberDevLogs(_ctx) {
15757
15781
  };
15758
15782
  }
15759
15783
  //#endregion
15760
- //#region src/plugins/dev-browser-logs.ts
15784
+ //#region src/dev-tools/browser-logs.ts
15761
15785
  /** Max message size in bytes before truncation. */
15762
15786
  var MAX_MESSAGE_BYTES = 2048;
15763
15787
  /** HMR event name for browser→server log forwarding. */
@@ -16163,7 +16187,8 @@ async function stripJsFromRscAssetsManifests(buildDir) {
16163
16187
  let manifest;
16164
16188
  try {
16165
16189
  manifest = JSON.parse(jsonStr);
16166
- } catch {
16190
+ } catch (err) {
16191
+ swallow(err, `corrupted RSC assets manifest: ${path}`, { level: "warn" });
16167
16192
  continue;
16168
16193
  }
16169
16194
  const deps = manifest.clientReferenceDeps;
@@ -16211,32 +16236,22 @@ function green(text) {
16211
16236
  /**
16212
16237
  * Walk the route tree and collect all leaf routes (pages + API endpoints).
16213
16238
  *
16214
- * Parallel slots (`@artists`, `@shows`, etc.) are intentionally skipped —
16215
- * they render alongside the parent page at the same URL and are not
16216
- * separately URL-addressable. Their JS is captured in shared/layout chunks.
16239
+ * Wraps the shared `collectLeafRoutes` walker (TIM-848). Parallel slots
16240
+ * (`@artists`, `@shows`, etc.) are intentionally skipped they render
16241
+ * alongside the parent page at the same URL and are not separately
16242
+ * URL-addressable. Their JS is captured in shared/layout chunks.
16217
16243
  *
16218
16244
  * After collection, entries are deduplicated by URL path so that overlapping
16219
16245
  * route groups (e.g. `(browse)` and `(marketing)` both producing `/`) only
16220
- * appear once. The entry with the largest route-specific size wins.
16246
+ * appear once. The entry with the longest segment chain (most specific
16247
+ * match) wins.
16221
16248
  */
16222
16249
  function collectRoutes(tree) {
16223
- const routes = [];
16224
- function walk(node, chain) {
16225
- const currentChain = [...chain, node];
16226
- const path = node.urlPath || "/";
16227
- if (node.page) routes.push({
16228
- path,
16229
- segments: currentChain,
16230
- entryFilePath: node.page.filePath
16231
- });
16232
- if (node.route) routes.push({
16233
- path,
16234
- segments: currentChain,
16235
- entryFilePath: node.route.filePath
16236
- });
16237
- for (const child of node.children) walk(child, currentChain);
16238
- }
16239
- walk(tree.root, []);
16250
+ const routes = collectLeafRoutes(tree.root).map((leaf) => ({
16251
+ path: leaf.urlPath,
16252
+ segments: leaf.segments,
16253
+ entryFilePath: leaf.page?.filePath ?? leaf.route?.filePath ?? null
16254
+ }));
16240
16255
  const seen = /* @__PURE__ */ new Map();
16241
16256
  for (const route of routes) {
16242
16257
  const existing = seen.get(route.path);
@@ -16544,7 +16559,7 @@ function validateKeyFormat(key) {
16544
16559
  }
16545
16560
  }
16546
16561
  //#endregion
16547
- //#region src/server/dev-holding-server.ts
16562
+ //#region src/dev-tools/holding-server.ts
16548
16563
  /**
16549
16564
  * Dev holding server — serves a loading page while Vite initializes.
16550
16565
  *
@@ -16645,9 +16660,11 @@ var HOLDING_PAGE_HTML = [
16645
16660
  *
16646
16661
  * Usage (inside Vite plugin):
16647
16662
  * ```ts
16648
- * // In config() hook — earliest point where port is known
16663
+ * // In config() hook — earliest point where port is known.
16664
+ * // Use bindWithBump() to honor the default-3000 + auto-bump policy
16665
+ * // (see ../server/port-resolution.ts and TIM-842).
16649
16666
  * const holding = createHoldingServer();
16650
- * holding.listen(config.server?.port ?? 5173);
16667
+ * await bindWithBump((p) => holding.listen(p), { startPort: 3000, autoBump: true });
16651
16668
  *
16652
16669
  * // In last plugin's configureServer() — wrap listen for seamless handoff
16653
16670
  * const originalListen = server.listen.bind(server);
@@ -16701,6 +16718,122 @@ function createHoldingServer() {
16701
16718
  };
16702
16719
  }
16703
16720
  //#endregion
16721
+ //#region src/server/port-resolution.ts
16722
+ /**
16723
+ * Port resolution for the dev server, Vite preview, and the Node
16724
+ * production preview server.
16725
+ *
16726
+ * Behavior (see TIM-842):
16727
+ *
16728
+ * 1. Default port is **3000** for both dev and prod.
16729
+ * 2. If the user did NOT set an explicit port, auto-bump from 3000
16730
+ * until a free port is found (3000 → 3001 → 3002 → …).
16731
+ * 3. If the user DID set an explicit port (via `--port`, `PORT` env
16732
+ * var, or `vite.config.ts` `server.port`), use it as-is and let
16733
+ * the bind fail loudly on conflict (`strictPort: true`).
16734
+ *
16735
+ * The port-bump probe is performed by binding the **actual** server
16736
+ * (e.g. the dev holding server) — not a throwaway probe — so there is
16737
+ * no time-of-check / time-of-use race between probing and listening.
16738
+ *
16739
+ * Design doc: 21-dev-server.md §"Default Port and Auto-Bump".
16740
+ */
16741
+ /** Default port used by `timber dev` and `timber preview`. */
16742
+ var DEFAULT_PORT = 3e3;
16743
+ /**
16744
+ * Pure: compute the starting port from config / env / defaults.
16745
+ *
16746
+ * Performs no I/O — pair with {@link bindWithBump} to actually listen.
16747
+ */
16748
+ function resolveStartPort(input) {
16749
+ const defaultPort = input.defaultPort ?? 3e3;
16750
+ if (typeof input.configPort === "number" && Number.isFinite(input.configPort)) return {
16751
+ port: input.configPort,
16752
+ explicit: true
16753
+ };
16754
+ if (input.envPort != null && input.envPort !== "") {
16755
+ const parsed = Number(input.envPort);
16756
+ if (Number.isFinite(parsed) && parsed > 0) return {
16757
+ port: parsed,
16758
+ explicit: true
16759
+ };
16760
+ }
16761
+ return {
16762
+ port: defaultPort,
16763
+ explicit: false
16764
+ };
16765
+ }
16766
+ /**
16767
+ * Bind a server starting at `startPort`, optionally bumping the port
16768
+ * on `EADDRINUSE` until a free one is found.
16769
+ *
16770
+ * Use this with the actual server you intend to keep listening (e.g.
16771
+ * the dev holding server). Pairing the probe with the real listen
16772
+ * eliminates the TOCTOU race that a throwaway probe would introduce.
16773
+ */
16774
+ async function bindWithBump(listen, options) {
16775
+ const maxAttempts = options.autoBump ? options.maxAttempts ?? 100 : 1;
16776
+ let lastErr = null;
16777
+ for (let i = 0; i < maxAttempts; i++) {
16778
+ const port = options.startPort + i;
16779
+ try {
16780
+ return {
16781
+ port: await listen(port),
16782
+ bumped: i > 0
16783
+ };
16784
+ } catch (err) {
16785
+ lastErr = err;
16786
+ if (!isAddrInUse(err)) throw err;
16787
+ }
16788
+ }
16789
+ throw lastErr ?? /* @__PURE__ */ new Error(`Could not bind to a free port starting at ${options.startPort}`);
16790
+ }
16791
+ /** True if `err` is a Node `EADDRINUSE` error from `server.listen()`. */
16792
+ function isAddrInUse(err) {
16793
+ return typeof err === "object" && err !== null && err.code === "EADDRINUSE";
16794
+ }
16795
+ /**
16796
+ * Run the full dev-server port resolution + holding-server bind sequence.
16797
+ *
16798
+ * Resolves the port from config / env / default, attempts to bind the
16799
+ * holding server (auto-bumping when the port came from the default),
16800
+ * and logs the chosen URL. On a clean failure for an explicit port, it
16801
+ * warns and falls back to the requested port so Vite can surface the
16802
+ * conflict via `strictPort: true`.
16803
+ *
16804
+ * Extracted from `index.ts` so the rootSync `config()` hook stays
16805
+ * focused on plugin assembly.
16806
+ */
16807
+ async function startDevServerPort(input) {
16808
+ const log = input.log ?? ((msg) => console.log(msg));
16809
+ const warn = input.warn ?? ((msg) => console.warn(msg));
16810
+ const start = resolveStartPort({
16811
+ configPort: input.configPort,
16812
+ envPort: input.envPort,
16813
+ defaultPort: DEFAULT_PORT
16814
+ });
16815
+ try {
16816
+ const result = await bindWithBump(input.listen, {
16817
+ startPort: start.port,
16818
+ autoBump: !start.explicit
16819
+ });
16820
+ if (result.bumped) log(`\n \x1b[33m[timber]\x1b[0m Port ${start.port} in use, using ${result.port}\n`);
16821
+ log(`\n \x1b[2m\u{1FAB5} timber.js dev server starting at\x1b[0m \x1b[36mhttp://localhost:${result.port}\x1b[0m\n`);
16822
+ return {
16823
+ port: result.port,
16824
+ explicit: start.explicit,
16825
+ bound: true
16826
+ };
16827
+ } catch (err) {
16828
+ if (start.explicit && isAddrInUse(err)) warn(`\n \x1b[33m[timber]\x1b[0m Port ${start.port} is already in use. Set PORT (or remove the override) to pick another port.\n`);
16829
+ return {
16830
+ port: start.port,
16831
+ explicit: start.explicit,
16832
+ bound: false
16833
+ };
16834
+ }
16835
+ }
16836
+ //#endregion
16704
16837
  //#region src/plugin-context.ts
16705
16838
  /**
16706
16839
  * Plugin context — internal types and helpers for timber sub-plugins.
@@ -16942,7 +17075,7 @@ function timber(config) {
16942
17075
  const earlyFileConfig = loadTimberConfigFile(process.cwd());
16943
17076
  const rootSync = {
16944
17077
  name: "timber-root-sync",
16945
- config(userConfig, { command }) {
17078
+ async config(userConfig, { command, isPreview }) {
16946
17079
  const viteRoot = resolve(userConfig.root ?? process.cwd());
16947
17080
  ctx.timer.start("config-load");
16948
17081
  const fileConfig = loadTimberConfigFile(viteRoot);
@@ -16960,19 +17093,26 @@ function timber(config) {
16960
17093
  const hadCompilerInEarly = !config?.reactCompiler && earlyFileConfig?.reactCompiler;
16961
17094
  if (hasCompilerInReloaded && !hadCompilerInEarly) console.warn("[timber] reactCompiler is set in timber.config.ts but could not be registered because the config file is in a non-cwd root directory. Move reactCompiler to the inline timber() config in vite.config.ts, or run vite from the project root directory.");
16962
17095
  }
16963
- if (command === "serve") {
16964
- const port = userConfig.server?.port ?? 5173;
16965
- try {
16966
- ctx.holdingServer = createHoldingServer();
16967
- ctx.holdingServer.listen(port).then((boundPort) => {
16968
- const url = `http://localhost:${boundPort}`;
16969
- console.log(`\n \x1b[2m🪵 timber.js dev server starting at\x1b[0m \x1b[36m${url}\x1b[0m\n`);
16970
- }, () => {
16971
- ctx.holdingServer = null;
16972
- });
16973
- } catch {
16974
- ctx.holdingServer = null;
16975
- }
17096
+ let resolvedDevPort = null;
17097
+ let resolvedDevPortExplicit = false;
17098
+ if (command === "serve" && !isPreview) {
17099
+ ctx.holdingServer = createHoldingServer();
17100
+ const holdingRef = ctx.holdingServer;
17101
+ const result = await startDevServerPort({
17102
+ configPort: typeof userConfig.server?.port === "number" ? userConfig.server.port : void 0,
17103
+ envPort: process.env.PORT,
17104
+ listen: (p) => holdingRef.listen(p)
17105
+ });
17106
+ resolvedDevPort = result.port;
17107
+ resolvedDevPortExplicit = result.explicit;
17108
+ if (!result.bound) ctx.holdingServer = null;
17109
+ } else if (command === "serve" && isPreview) {
17110
+ const start = resolveStartPort({
17111
+ configPort: typeof userConfig.preview?.port === "number" ? userConfig.preview.port : typeof userConfig.server?.port === "number" ? userConfig.server.port : void 0,
17112
+ envPort: process.env.PORT
17113
+ });
17114
+ resolvedDevPort = start.port;
17115
+ resolvedDevPortExplicit = start.explicit;
16976
17116
  }
16977
17117
  const buildOutDir = timberBuildDir ? timberBuildDir : viteOutDir && viteOutDir !== "dist" ? viteOutDir : DEFAULT_BUILD_DIR;
16978
17118
  const envOutDirs = {};
@@ -16986,9 +17126,21 @@ function timber(config) {
16986
17126
  environments: envOutDirs,
16987
17127
  oxc: { jsx: { development: false } }
16988
17128
  };
17129
+ const serverConfig = {};
17130
+ const previewConfig = {};
17131
+ if (resolvedDevPort != null) {
17132
+ if (!isPreview) {
17133
+ serverConfig.port = resolvedDevPort;
17134
+ serverConfig.strictPort = true;
17135
+ }
17136
+ previewConfig.port = resolvedDevPort;
17137
+ previewConfig.strictPort = resolvedDevPortExplicit;
17138
+ }
16989
17139
  return {
16990
17140
  build: { outDir: buildOutDir },
16991
- environments: envOutDirs
17141
+ environments: envOutDirs,
17142
+ server: serverConfig,
17143
+ preview: previewConfig
16992
17144
  };
16993
17145
  },
16994
17146
  configResolved(resolved) {