@timber-js/app 0.2.0-alpha.9 → 0.2.0-alpha.91

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 (619) hide show
  1. package/dist/_chunks/actions-DLnUaR65.js +421 -0
  2. package/dist/_chunks/actions-DLnUaR65.js.map +1 -0
  3. package/dist/_chunks/{als-registry-B7DbZ2hS.js → als-registry-HS0LGUl2.js} +1 -1
  4. package/dist/_chunks/als-registry-HS0LGUl2.js.map +1 -0
  5. package/dist/_chunks/chunk-BYIpzuS7.js +39 -0
  6. package/dist/_chunks/{debug-gwlJkDuf.js → debug-ECi_61pb.js} +2 -2
  7. package/dist/_chunks/debug-ECi_61pb.js.map +1 -0
  8. package/dist/_chunks/define-C77ScO0m.js +106 -0
  9. package/dist/_chunks/define-C77ScO0m.js.map +1 -0
  10. package/dist/_chunks/define-Itxvcd7F.js +199 -0
  11. package/dist/_chunks/define-Itxvcd7F.js.map +1 -0
  12. package/dist/_chunks/define-cookie-BowvzoP0.js +94 -0
  13. package/dist/_chunks/define-cookie-BowvzoP0.js.map +1 -0
  14. package/dist/_chunks/{format-DviM89f0.js → dev-warnings-DpGRGoDi.js} +5 -44
  15. package/dist/_chunks/dev-warnings-DpGRGoDi.js.map +1 -0
  16. package/dist/_chunks/format-CYBGxKtc.js +14 -0
  17. package/dist/_chunks/format-CYBGxKtc.js.map +1 -0
  18. package/dist/_chunks/{interception-BOoWmLUA.js → interception-ErnB33JX.js} +301 -133
  19. package/dist/_chunks/interception-ErnB33JX.js.map +1 -0
  20. package/dist/_chunks/merge-search-params-Cm_KIWDX.js +41 -0
  21. package/dist/_chunks/merge-search-params-Cm_KIWDX.js.map +1 -0
  22. package/dist/_chunks/{metadata-routes-Cjmvi3rQ.js → metadata-routes-DS3eKNmf.js} +1 -1
  23. package/dist/_chunks/{metadata-routes-Cjmvi3rQ.js.map → metadata-routes-DS3eKNmf.js.map} +1 -1
  24. package/dist/_chunks/request-context-CK5tZqIP.js +478 -0
  25. package/dist/_chunks/request-context-CK5tZqIP.js.map +1 -0
  26. package/dist/_chunks/schema-bridge-C3xl_vfb.js +86 -0
  27. package/dist/_chunks/schema-bridge-C3xl_vfb.js.map +1 -0
  28. package/dist/_chunks/segment-classify-BDNn6EzD.js +65 -0
  29. package/dist/_chunks/segment-classify-BDNn6EzD.js.map +1 -0
  30. package/dist/_chunks/segment-context-fHFLF1PE.js +34 -0
  31. package/dist/_chunks/segment-context-fHFLF1PE.js.map +1 -0
  32. package/dist/_chunks/{ssr-data-MjmprTmO.js → ssr-data-DzuI0bIV.js} +1 -1
  33. package/dist/_chunks/{ssr-data-MjmprTmO.js.map → ssr-data-DzuI0bIV.js.map} +1 -1
  34. package/dist/_chunks/stale-reload-BX5gL1r-.js +64 -0
  35. package/dist/_chunks/stale-reload-BX5gL1r-.js.map +1 -0
  36. package/dist/_chunks/{tracing-CemImE6h.js → tracing-CCYbKn5n.js} +60 -9
  37. package/dist/_chunks/tracing-CCYbKn5n.js.map +1 -0
  38. package/dist/_chunks/use-params-Br9YSUFV.js +295 -0
  39. package/dist/_chunks/use-params-Br9YSUFV.js.map +1 -0
  40. package/dist/_chunks/{use-query-states-D5KaffOK.js → use-query-states-BiV5GJgm.js} +7 -4
  41. package/dist/_chunks/use-query-states-BiV5GJgm.js.map +1 -0
  42. package/dist/adapters/cloudflare-dev.d.ts +109 -0
  43. package/dist/adapters/cloudflare-dev.d.ts.map +1 -0
  44. package/dist/adapters/cloudflare-dev.js +73 -0
  45. package/dist/adapters/cloudflare-dev.js.map +1 -0
  46. package/dist/adapters/cloudflare-kv-cache.d.ts +64 -0
  47. package/dist/adapters/cloudflare-kv-cache.d.ts.map +1 -0
  48. package/dist/adapters/cloudflare-kv-cache.js +95 -0
  49. package/dist/adapters/cloudflare-kv-cache.js.map +1 -0
  50. package/dist/adapters/cloudflare.d.ts +148 -12
  51. package/dist/adapters/cloudflare.d.ts.map +1 -1
  52. package/dist/adapters/cloudflare.js +135 -11
  53. package/dist/adapters/cloudflare.js.map +1 -1
  54. package/dist/adapters/compress-module.d.ts.map +1 -1
  55. package/dist/adapters/nitro.d.ts +17 -1
  56. package/dist/adapters/nitro.d.ts.map +1 -1
  57. package/dist/adapters/nitro.js +56 -13
  58. package/dist/adapters/nitro.js.map +1 -1
  59. package/dist/cache/cache-api.d.ts +24 -0
  60. package/dist/cache/cache-api.d.ts.map +1 -0
  61. package/dist/cache/handler-store.d.ts +31 -0
  62. package/dist/cache/handler-store.d.ts.map +1 -0
  63. package/dist/cache/index.d.ts +23 -7
  64. package/dist/cache/index.d.ts.map +1 -1
  65. package/dist/cache/index.js +142 -80
  66. package/dist/cache/index.js.map +1 -1
  67. package/dist/cache/singleflight.d.ts +18 -1
  68. package/dist/cache/singleflight.d.ts.map +1 -1
  69. package/dist/cache/sizeof.d.ts +22 -0
  70. package/dist/cache/sizeof.d.ts.map +1 -0
  71. package/dist/cache/timber-cache.d.ts +1 -1
  72. package/dist/cache/timber-cache.d.ts.map +1 -1
  73. package/dist/cli.d.ts +6 -1
  74. package/dist/cli.d.ts.map +1 -1
  75. package/dist/cli.js +8 -3
  76. package/dist/cli.js.map +1 -1
  77. package/dist/client/browser-dev.d.ts +27 -1
  78. package/dist/client/browser-dev.d.ts.map +1 -1
  79. package/dist/client/browser-entry/action-dispatch.d.ts +17 -0
  80. package/dist/client/browser-entry/action-dispatch.d.ts.map +1 -0
  81. package/dist/client/browser-entry/hmr.d.ts +21 -0
  82. package/dist/client/browser-entry/hmr.d.ts.map +1 -0
  83. package/dist/client/browser-entry/hydrate.d.ts +46 -0
  84. package/dist/client/browser-entry/hydrate.d.ts.map +1 -0
  85. package/dist/client/browser-entry/index.d.ts +30 -0
  86. package/dist/client/browser-entry/index.d.ts.map +1 -0
  87. package/dist/client/browser-entry/post-hydration.d.ts +26 -0
  88. package/dist/client/browser-entry/post-hydration.d.ts.map +1 -0
  89. package/dist/client/browser-entry/router-init.d.ts +23 -0
  90. package/dist/client/browser-entry/router-init.d.ts.map +1 -0
  91. package/dist/client/browser-entry/rsc-stream.d.ts +24 -0
  92. package/dist/client/browser-entry/rsc-stream.d.ts.map +1 -0
  93. package/dist/client/browser-entry/scroll.d.ts +19 -0
  94. package/dist/client/browser-entry/scroll.d.ts.map +1 -0
  95. package/dist/client/error-boundary.d.ts +12 -5
  96. package/dist/client/error-boundary.d.ts.map +1 -1
  97. package/dist/client/error-boundary.js +10 -4
  98. package/dist/client/error-boundary.js.map +1 -1
  99. package/dist/client/error-reconstituter.d.ts +54 -0
  100. package/dist/client/error-reconstituter.d.ts.map +1 -0
  101. package/dist/client/form.d.ts +6 -3
  102. package/dist/client/form.d.ts.map +1 -1
  103. package/dist/client/history.d.ts +19 -4
  104. package/dist/client/history.d.ts.map +1 -1
  105. package/dist/client/index.d.ts +9 -21
  106. package/dist/client/index.d.ts.map +1 -1
  107. package/dist/client/index.js +229 -1018
  108. package/dist/client/index.js.map +1 -1
  109. package/dist/client/internal.d.ts +18 -0
  110. package/dist/client/internal.d.ts.map +1 -0
  111. package/dist/client/internal.js +890 -0
  112. package/dist/client/internal.js.map +1 -0
  113. package/dist/client/link-pending-store.d.ts +63 -0
  114. package/dist/client/link-pending-store.d.ts.map +1 -0
  115. package/dist/client/link.d.ts +62 -55
  116. package/dist/client/link.d.ts.map +1 -1
  117. package/dist/client/nav-link-store.d.ts +36 -0
  118. package/dist/client/nav-link-store.d.ts.map +1 -0
  119. package/dist/client/navigation-api-types.d.ts +90 -0
  120. package/dist/client/navigation-api-types.d.ts.map +1 -0
  121. package/dist/client/navigation-api.d.ts +115 -0
  122. package/dist/client/navigation-api.d.ts.map +1 -0
  123. package/dist/client/navigation-context.d.ts +13 -2
  124. package/dist/client/navigation-context.d.ts.map +1 -1
  125. package/dist/client/{transition-root.d.ts → navigation-root.d.ts} +42 -8
  126. package/dist/client/navigation-root.d.ts.map +1 -0
  127. package/dist/client/nuqs-adapter.d.ts.map +1 -1
  128. package/dist/client/router-ref.d.ts +1 -1
  129. package/dist/client/router.d.ts +70 -4
  130. package/dist/client/router.d.ts.map +1 -1
  131. package/dist/client/rsc-fetch.d.ts +38 -3
  132. package/dist/client/rsc-fetch.d.ts.map +1 -1
  133. package/dist/client/segment-cache.d.ts +1 -1
  134. package/dist/client/segment-cache.d.ts.map +1 -1
  135. package/dist/client/segment-outlet.d.ts +63 -0
  136. package/dist/client/segment-outlet.d.ts.map +1 -0
  137. package/dist/client/ssr-data.d.ts +13 -4
  138. package/dist/client/ssr-data.d.ts.map +1 -1
  139. package/dist/client/stale-reload.d.ts +15 -0
  140. package/dist/client/stale-reload.d.ts.map +1 -1
  141. package/dist/client/top-loader.d.ts +5 -5
  142. package/dist/client/top-loader.d.ts.map +1 -1
  143. package/dist/client/use-link-status.d.ts +5 -5
  144. package/dist/client/use-link-status.d.ts.map +1 -1
  145. package/dist/client/use-params.d.ts +6 -4
  146. package/dist/client/use-params.d.ts.map +1 -1
  147. package/dist/client/{use-navigation-pending.d.ts → use-pending-navigation.d.ts} +4 -4
  148. package/dist/client/use-pending-navigation.d.ts.map +1 -0
  149. package/dist/client/use-query-states.d.ts +1 -1
  150. package/dist/client/use-query-states.d.ts.map +1 -1
  151. package/dist/client/use-router.d.ts +1 -1
  152. package/dist/codec.d.ts +33 -0
  153. package/dist/codec.d.ts.map +1 -0
  154. package/dist/codec.js +2 -0
  155. package/dist/config-types.d.ts +266 -0
  156. package/dist/config-types.d.ts.map +1 -0
  157. package/dist/config-validation.d.ts +51 -0
  158. package/dist/config-validation.d.ts.map +1 -0
  159. package/dist/content/index.d.ts +1 -10
  160. package/dist/content/index.d.ts.map +1 -1
  161. package/dist/content/index.js +0 -2
  162. package/dist/cookies/define-cookie.d.ts +35 -14
  163. package/dist/cookies/define-cookie.d.ts.map +1 -1
  164. package/dist/cookies/index.js +1 -83
  165. package/dist/fonts/bundle.d.ts +48 -0
  166. package/dist/fonts/bundle.d.ts.map +1 -0
  167. package/dist/fonts/css.d.ts +1 -0
  168. package/dist/fonts/css.d.ts.map +1 -1
  169. package/dist/fonts/dev-middleware.d.ts +22 -0
  170. package/dist/fonts/dev-middleware.d.ts.map +1 -0
  171. package/dist/fonts/pipeline.d.ts +138 -0
  172. package/dist/fonts/pipeline.d.ts.map +1 -0
  173. package/dist/fonts/transform.d.ts +72 -0
  174. package/dist/fonts/transform.d.ts.map +1 -0
  175. package/dist/fonts/types.d.ts +45 -1
  176. package/dist/fonts/types.d.ts.map +1 -1
  177. package/dist/fonts/virtual-modules.d.ts +59 -0
  178. package/dist/fonts/virtual-modules.d.ts.map +1 -0
  179. package/dist/index.d.ts +45 -190
  180. package/dist/index.d.ts.map +1 -1
  181. package/dist/index.js +4294 -2453
  182. package/dist/index.js.map +1 -1
  183. package/dist/plugin-context.d.ts +107 -0
  184. package/dist/plugin-context.d.ts.map +1 -0
  185. package/dist/plugins/adapter-build.d.ts +1 -1
  186. package/dist/plugins/adapter-build.d.ts.map +1 -1
  187. package/dist/plugins/build-manifest.d.ts +2 -2
  188. package/dist/plugins/build-manifest.d.ts.map +1 -1
  189. package/dist/plugins/build-report.d.ts +3 -3
  190. package/dist/plugins/build-report.d.ts.map +1 -1
  191. package/dist/plugins/client-chunks.d.ts +32 -0
  192. package/dist/plugins/client-chunks.d.ts.map +1 -0
  193. package/dist/plugins/content.d.ts +1 -1
  194. package/dist/plugins/content.d.ts.map +1 -1
  195. package/dist/plugins/dev-404-page.d.ts +56 -0
  196. package/dist/plugins/dev-404-page.d.ts.map +1 -0
  197. package/dist/plugins/dev-browser-logs.d.ts +84 -0
  198. package/dist/plugins/dev-browser-logs.d.ts.map +1 -0
  199. package/dist/plugins/dev-error-overlay.d.ts +49 -9
  200. package/dist/plugins/dev-error-overlay.d.ts.map +1 -1
  201. package/dist/plugins/dev-error-page.d.ts +58 -0
  202. package/dist/plugins/dev-error-page.d.ts.map +1 -0
  203. package/dist/plugins/dev-logs.d.ts +1 -1
  204. package/dist/plugins/dev-logs.d.ts.map +1 -1
  205. package/dist/plugins/dev-server.d.ts +1 -1
  206. package/dist/plugins/dev-server.d.ts.map +1 -1
  207. package/dist/plugins/dev-terminal-error.d.ts +28 -0
  208. package/dist/plugins/dev-terminal-error.d.ts.map +1 -0
  209. package/dist/plugins/entries.d.ts +1 -1
  210. package/dist/plugins/entries.d.ts.map +1 -1
  211. package/dist/plugins/fonts.d.ts +17 -73
  212. package/dist/plugins/fonts.d.ts.map +1 -1
  213. package/dist/plugins/mdx.d.ts +1 -1
  214. package/dist/plugins/mdx.d.ts.map +1 -1
  215. package/dist/plugins/routing.d.ts +1 -1
  216. package/dist/plugins/routing.d.ts.map +1 -1
  217. package/dist/plugins/server-bundle.d.ts.map +1 -1
  218. package/dist/plugins/shims.d.ts +6 -5
  219. package/dist/plugins/shims.d.ts.map +1 -1
  220. package/dist/plugins/static-build.d.ts +4 -4
  221. package/dist/plugins/static-build.d.ts.map +1 -1
  222. package/dist/routing/codegen-shared.d.ts +38 -0
  223. package/dist/routing/codegen-shared.d.ts.map +1 -0
  224. package/dist/routing/codegen-types.d.ts +36 -0
  225. package/dist/routing/codegen-types.d.ts.map +1 -0
  226. package/dist/routing/codegen.d.ts +2 -2
  227. package/dist/routing/codegen.d.ts.map +1 -1
  228. package/dist/routing/convention-lint.d.ts +41 -0
  229. package/dist/routing/convention-lint.d.ts.map +1 -0
  230. package/dist/routing/index.d.ts +2 -0
  231. package/dist/routing/index.d.ts.map +1 -1
  232. package/dist/routing/index.js +3 -2
  233. package/dist/routing/link-codegen.d.ts +90 -0
  234. package/dist/routing/link-codegen.d.ts.map +1 -0
  235. package/dist/routing/scanner.d.ts.map +1 -1
  236. package/dist/routing/segment-classify.d.ts +46 -0
  237. package/dist/routing/segment-classify.d.ts.map +1 -0
  238. package/dist/routing/status-file-lint.d.ts +2 -1
  239. package/dist/routing/status-file-lint.d.ts.map +1 -1
  240. package/dist/routing/types.d.ts +16 -4
  241. package/dist/routing/types.d.ts.map +1 -1
  242. package/dist/rsc-runtime/rsc.d.ts +1 -1
  243. package/dist/rsc-runtime/rsc.d.ts.map +1 -1
  244. package/dist/rsc-runtime/ssr.d.ts +12 -0
  245. package/dist/rsc-runtime/ssr.d.ts.map +1 -1
  246. package/dist/schema-bridge.d.ts +76 -0
  247. package/dist/schema-bridge.d.ts.map +1 -0
  248. package/dist/search-params/define.d.ts +139 -0
  249. package/dist/search-params/define.d.ts.map +1 -0
  250. package/dist/search-params/index.d.ts +4 -7
  251. package/dist/search-params/index.d.ts.map +1 -1
  252. package/dist/search-params/index.js +32 -441
  253. package/dist/search-params/index.js.map +1 -1
  254. package/dist/search-params/registry.d.ts +2 -2
  255. package/dist/search-params/registry.d.ts.map +1 -1
  256. package/dist/search-params/wrappers.d.ts +53 -0
  257. package/dist/search-params/wrappers.d.ts.map +1 -0
  258. package/dist/segment-params/define.d.ts +78 -0
  259. package/dist/segment-params/define.d.ts.map +1 -0
  260. package/dist/segment-params/index.d.ts +3 -0
  261. package/dist/segment-params/index.d.ts.map +1 -0
  262. package/dist/segment-params/index.js +2 -0
  263. package/dist/server/access-gate.d.ts +4 -0
  264. package/dist/server/access-gate.d.ts.map +1 -1
  265. package/dist/server/action-client.d.ts +41 -6
  266. package/dist/server/action-client.d.ts.map +1 -1
  267. package/dist/server/action-encryption.d.ts +76 -0
  268. package/dist/server/action-encryption.d.ts.map +1 -0
  269. package/dist/server/action-handler.d.ts +7 -0
  270. package/dist/server/action-handler.d.ts.map +1 -1
  271. package/dist/server/actions.d.ts +3 -6
  272. package/dist/server/actions.d.ts.map +1 -1
  273. package/dist/server/als-registry.d.ts +32 -4
  274. package/dist/server/als-registry.d.ts.map +1 -1
  275. package/dist/server/build-manifest.d.ts +2 -2
  276. package/dist/server/build-manifest.d.ts.map +1 -1
  277. package/dist/server/debug.d.ts +1 -1
  278. package/dist/server/default-logger.d.ts +22 -0
  279. package/dist/server/default-logger.d.ts.map +1 -0
  280. package/dist/server/deny-page-resolver.d.ts +52 -0
  281. package/dist/server/deny-page-resolver.d.ts.map +1 -0
  282. package/dist/server/deny-renderer.d.ts.map +1 -1
  283. package/dist/server/dev-holding-server.d.ts +52 -0
  284. package/dist/server/dev-holding-server.d.ts.map +1 -0
  285. package/dist/server/dev-source-map.d.ts +22 -0
  286. package/dist/server/dev-source-map.d.ts.map +1 -0
  287. package/dist/server/dev-warnings.d.ts +1 -21
  288. package/dist/server/dev-warnings.d.ts.map +1 -1
  289. package/dist/server/early-hints.d.ts +13 -5
  290. package/dist/server/early-hints.d.ts.map +1 -1
  291. package/dist/server/error-boundary-wrapper.d.ts +7 -1
  292. package/dist/server/error-boundary-wrapper.d.ts.map +1 -1
  293. package/dist/server/fallback-error.d.ts +12 -7
  294. package/dist/server/fallback-error.d.ts.map +1 -1
  295. package/dist/server/flight-injection-state.d.ts +66 -0
  296. package/dist/server/flight-injection-state.d.ts.map +1 -0
  297. package/dist/server/flight-scripts.d.ts +42 -0
  298. package/dist/server/flight-scripts.d.ts.map +1 -0
  299. package/dist/server/flush.d.ts.map +1 -1
  300. package/dist/server/form-data.d.ts +29 -0
  301. package/dist/server/form-data.d.ts.map +1 -1
  302. package/dist/server/html-injectors.d.ts +51 -11
  303. package/dist/server/html-injectors.d.ts.map +1 -1
  304. package/dist/server/index.d.ts +5 -43
  305. package/dist/server/index.d.ts.map +1 -1
  306. package/dist/server/index.js +195 -2800
  307. package/dist/server/index.js.map +1 -1
  308. package/dist/server/internal.d.ts +46 -0
  309. package/dist/server/internal.d.ts.map +1 -0
  310. package/dist/server/internal.js +2900 -0
  311. package/dist/server/internal.js.map +1 -0
  312. package/dist/server/logger.d.ts +25 -7
  313. package/dist/server/logger.d.ts.map +1 -1
  314. package/dist/server/middleware-runner.d.ts +19 -4
  315. package/dist/server/middleware-runner.d.ts.map +1 -1
  316. package/dist/server/node-stream-transforms.d.ts +113 -0
  317. package/dist/server/node-stream-transforms.d.ts.map +1 -0
  318. package/dist/server/page-deny-boundary.d.ts +31 -0
  319. package/dist/server/page-deny-boundary.d.ts.map +1 -0
  320. package/dist/server/pipeline-interception.d.ts +1 -1
  321. package/dist/server/pipeline-interception.d.ts.map +1 -1
  322. package/dist/server/pipeline-metadata.d.ts +6 -0
  323. package/dist/server/pipeline-metadata.d.ts.map +1 -1
  324. package/dist/server/pipeline.d.ts +52 -10
  325. package/dist/server/pipeline.d.ts.map +1 -1
  326. package/dist/server/primitives.d.ts +69 -18
  327. package/dist/server/primitives.d.ts.map +1 -1
  328. package/dist/server/render-timeout.d.ts +51 -0
  329. package/dist/server/render-timeout.d.ts.map +1 -0
  330. package/dist/server/request-context.d.ts +112 -43
  331. package/dist/server/request-context.d.ts.map +1 -1
  332. package/dist/server/route-element-builder.d.ts +27 -1
  333. package/dist/server/route-element-builder.d.ts.map +1 -1
  334. package/dist/server/route-handler.d.ts.map +1 -1
  335. package/dist/server/route-matcher.d.ts +16 -2
  336. package/dist/server/route-matcher.d.ts.map +1 -1
  337. package/dist/server/rsc-entry/api-handler.d.ts +2 -2
  338. package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
  339. package/dist/server/rsc-entry/error-renderer.d.ts +26 -13
  340. package/dist/server/rsc-entry/error-renderer.d.ts.map +1 -1
  341. package/dist/server/rsc-entry/helpers.d.ts +48 -5
  342. package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
  343. package/dist/server/rsc-entry/index.d.ts +20 -3
  344. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  345. package/dist/server/rsc-entry/rsc-payload.d.ts +3 -3
  346. package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
  347. package/dist/server/rsc-entry/rsc-stream.d.ts +14 -1
  348. package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
  349. package/dist/server/rsc-entry/ssr-bridge.d.ts +1 -1
  350. package/dist/server/rsc-entry/ssr-bridge.d.ts.map +1 -1
  351. package/dist/server/rsc-entry/ssr-renderer.d.ts +19 -4
  352. package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
  353. package/dist/server/safe-load.d.ts +46 -0
  354. package/dist/server/safe-load.d.ts.map +1 -0
  355. package/dist/server/sensitive-fields.d.ts +74 -0
  356. package/dist/server/sensitive-fields.d.ts.map +1 -0
  357. package/dist/server/sitemap-generator.d.ts +129 -0
  358. package/dist/server/sitemap-generator.d.ts.map +1 -0
  359. package/dist/server/sitemap-handler.d.ts +22 -0
  360. package/dist/server/sitemap-handler.d.ts.map +1 -0
  361. package/dist/server/slot-resolver.d.ts +1 -1
  362. package/dist/server/slot-resolver.d.ts.map +1 -1
  363. package/dist/server/ssr-entry.d.ts +23 -0
  364. package/dist/server/ssr-entry.d.ts.map +1 -1
  365. package/dist/server/ssr-render.d.ts +39 -21
  366. package/dist/server/ssr-render.d.ts.map +1 -1
  367. package/dist/server/ssr-wrappers.d.ts +50 -0
  368. package/dist/server/ssr-wrappers.d.ts.map +1 -0
  369. package/dist/server/status-code-resolver.d.ts +1 -1
  370. package/dist/server/status-code-resolver.d.ts.map +1 -1
  371. package/dist/server/stream-utils.d.ts +36 -0
  372. package/dist/server/stream-utils.d.ts.map +1 -0
  373. package/dist/server/tracing.d.ts +4 -4
  374. package/dist/server/tracing.d.ts.map +1 -1
  375. package/dist/server/tree-builder.d.ts +22 -19
  376. package/dist/server/tree-builder.d.ts.map +1 -1
  377. package/dist/server/types.d.ts +1 -4
  378. package/dist/server/types.d.ts.map +1 -1
  379. package/dist/server/version-skew.d.ts +61 -0
  380. package/dist/server/version-skew.d.ts.map +1 -0
  381. package/dist/shared/merge-search-params.d.ts +22 -0
  382. package/dist/shared/merge-search-params.d.ts.map +1 -0
  383. package/dist/shims/font-google.d.ts +1 -1
  384. package/dist/shims/font-google.d.ts.map +1 -1
  385. package/dist/shims/font-google.js +42 -0
  386. package/dist/shims/font-google.js.map +1 -0
  387. package/dist/shims/font-local.d.ts +26 -0
  388. package/dist/shims/font-local.d.ts.map +1 -0
  389. package/dist/shims/font-local.js +20 -0
  390. package/dist/shims/font-local.js.map +1 -0
  391. package/dist/shims/headers.d.ts +2 -1
  392. package/dist/shims/headers.d.ts.map +1 -1
  393. package/dist/shims/navigation-client.d.ts +1 -1
  394. package/dist/shims/navigation-client.d.ts.map +1 -1
  395. package/dist/shims/navigation.d.ts +3 -2
  396. package/dist/shims/navigation.d.ts.map +1 -1
  397. package/dist/utils/directive-parser.d.ts +5 -2
  398. package/dist/utils/directive-parser.d.ts.map +1 -1
  399. package/dist/utils/state-machine.d.ts +80 -0
  400. package/dist/utils/state-machine.d.ts.map +1 -0
  401. package/package.json +51 -16
  402. package/src/adapters/cloudflare-dev.ts +177 -0
  403. package/src/adapters/cloudflare-kv-cache.ts +142 -0
  404. package/src/adapters/cloudflare.ts +342 -28
  405. package/src/adapters/compress-module.ts +24 -4
  406. package/src/adapters/nitro.ts +52 -8
  407. package/src/adapters/wrangler.d.ts +7 -0
  408. package/src/cache/cache-api.ts +38 -0
  409. package/src/cache/handler-store.ts +68 -0
  410. package/src/cache/index.ts +81 -18
  411. package/src/cache/singleflight.ts +62 -4
  412. package/src/cache/sizeof.ts +31 -0
  413. package/src/cache/timber-cache.ts +24 -20
  414. package/src/cli.ts +16 -6
  415. package/src/client/browser-dev.ts +128 -1
  416. package/src/client/browser-entry/action-dispatch.ts +116 -0
  417. package/src/client/browser-entry/hmr.ts +81 -0
  418. package/src/client/browser-entry/hydrate.ts +145 -0
  419. package/src/client/browser-entry/index.ts +143 -0
  420. package/src/client/browser-entry/post-hydration.ts +119 -0
  421. package/src/client/browser-entry/router-init.ts +193 -0
  422. package/src/client/browser-entry/rsc-stream.ts +157 -0
  423. package/src/client/browser-entry/scroll.ts +27 -0
  424. package/src/client/error-boundary.tsx +48 -16
  425. package/src/client/error-reconstituter.tsx +65 -0
  426. package/src/client/form.tsx +14 -7
  427. package/src/client/history.ts +26 -4
  428. package/src/client/index.ts +65 -38
  429. package/src/client/internal.ts +57 -0
  430. package/src/client/link-pending-store.ts +111 -0
  431. package/src/client/link.tsx +342 -113
  432. package/src/client/nav-link-store.ts +47 -0
  433. package/src/client/navigation-api-types.ts +112 -0
  434. package/src/client/navigation-api.ts +332 -0
  435. package/src/client/navigation-context.ts +31 -6
  436. package/src/client/navigation-root.tsx +342 -0
  437. package/src/client/nuqs-adapter.tsx +16 -3
  438. package/src/client/router-ref.ts +1 -1
  439. package/src/client/router.ts +299 -72
  440. package/src/client/rsc-fetch.ts +97 -8
  441. package/src/client/segment-cache.ts +1 -1
  442. package/src/client/segment-outlet.tsx +86 -0
  443. package/src/client/ssr-data.ts +13 -5
  444. package/src/client/stale-reload.ts +72 -3
  445. package/src/client/top-loader.tsx +18 -6
  446. package/src/client/use-link-status.ts +7 -7
  447. package/src/client/use-params.ts +7 -5
  448. package/src/client/{use-navigation-pending.ts → use-pending-navigation.ts} +6 -6
  449. package/src/client/use-query-states.ts +9 -3
  450. package/src/client/use-router.ts +1 -1
  451. package/src/codec.ts +49 -0
  452. package/src/config-types.ts +264 -0
  453. package/src/config-validation.ts +303 -0
  454. package/src/content/index.ts +5 -13
  455. package/src/cookies/define-cookie.ts +78 -25
  456. package/src/cookies/index.ts +8 -0
  457. package/src/fonts/bundle.ts +142 -0
  458. package/src/fonts/css.ts +2 -1
  459. package/src/fonts/dev-middleware.ts +74 -0
  460. package/src/fonts/pipeline.ts +275 -0
  461. package/src/fonts/transform.ts +353 -0
  462. package/src/fonts/types.ts +50 -1
  463. package/src/fonts/virtual-modules.ts +159 -0
  464. package/src/index.ts +314 -355
  465. package/src/plugin-context.ts +240 -0
  466. package/src/plugins/adapter-build.ts +9 -3
  467. package/src/plugins/build-manifest.ts +13 -2
  468. package/src/plugins/build-report.ts +3 -3
  469. package/src/plugins/client-chunks.ts +65 -0
  470. package/src/plugins/content.ts +1 -1
  471. package/src/plugins/dev-404-page.ts +418 -0
  472. package/src/plugins/dev-browser-logs.ts +288 -0
  473. package/src/plugins/dev-error-overlay.ts +286 -42
  474. package/src/plugins/dev-error-page.ts +536 -0
  475. package/src/plugins/dev-logs.ts +1 -1
  476. package/src/plugins/dev-server.ts +146 -19
  477. package/src/plugins/dev-terminal-error.ts +217 -0
  478. package/src/plugins/entries.ts +111 -10
  479. package/src/plugins/fonts.ts +133 -638
  480. package/src/plugins/mdx.ts +1 -1
  481. package/src/plugins/routing.ts +213 -31
  482. package/src/plugins/server-action-exports.ts +1 -1
  483. package/src/plugins/server-bundle.ts +32 -1
  484. package/src/plugins/shims.ts +136 -35
  485. package/src/plugins/static-build.ts +17 -11
  486. package/src/routing/codegen-shared.ts +74 -0
  487. package/src/routing/codegen-types.ts +37 -0
  488. package/src/routing/codegen.ts +112 -173
  489. package/src/routing/convention-lint.ts +356 -0
  490. package/src/routing/index.ts +2 -0
  491. package/src/routing/link-codegen.ts +262 -0
  492. package/src/routing/scanner.ts +93 -23
  493. package/src/routing/segment-classify.ts +89 -0
  494. package/src/routing/status-file-lint.ts +3 -2
  495. package/src/routing/types.ts +17 -4
  496. package/src/rsc-runtime/rsc.ts +2 -0
  497. package/src/rsc-runtime/ssr.ts +50 -0
  498. package/src/rsc-runtime/vendor-types.d.ts +7 -0
  499. package/src/{search-params/codecs.ts → schema-bridge.ts} +57 -20
  500. package/src/search-params/define.ts +482 -0
  501. package/src/search-params/index.ts +14 -20
  502. package/src/search-params/registry.ts +2 -2
  503. package/src/search-params/wrappers.ts +85 -0
  504. package/src/segment-params/define.ts +279 -0
  505. package/src/segment-params/index.ts +9 -0
  506. package/src/server/access-gate.tsx +70 -29
  507. package/src/server/action-client.ts +88 -15
  508. package/src/server/action-encryption.ts +144 -0
  509. package/src/server/action-handler.ts +53 -6
  510. package/src/server/actions.ts +10 -9
  511. package/src/server/als-registry.ts +34 -6
  512. package/src/server/build-manifest.ts +10 -4
  513. package/src/server/compress.ts +25 -7
  514. package/src/server/debug.ts +1 -1
  515. package/src/server/default-logger.ts +99 -0
  516. package/src/server/deny-page-resolver.ts +154 -0
  517. package/src/server/deny-renderer.ts +24 -38
  518. package/src/server/dev-holding-server.ts +185 -0
  519. package/src/server/dev-source-map.ts +31 -0
  520. package/src/server/dev-warnings.ts +4 -49
  521. package/src/server/early-hints.ts +36 -15
  522. package/src/server/error-boundary-wrapper.ts +74 -22
  523. package/src/server/fallback-error.ts +74 -102
  524. package/src/server/flight-injection-state.ts +113 -0
  525. package/src/server/flight-scripts.ts +62 -0
  526. package/src/server/flush.ts +2 -1
  527. package/src/server/form-data.ts +76 -0
  528. package/src/server/html-injectors.ts +280 -120
  529. package/src/server/index.ts +25 -177
  530. package/src/server/internal.ts +169 -0
  531. package/src/server/logger.ts +44 -36
  532. package/src/server/middleware-runner.ts +31 -4
  533. package/src/server/node-stream-transforms.ts +509 -0
  534. package/src/server/page-deny-boundary.tsx +56 -0
  535. package/src/server/pipeline-interception.ts +17 -16
  536. package/src/server/pipeline-metadata.ts +13 -0
  537. package/src/server/pipeline.ts +261 -66
  538. package/src/server/primitives.ts +111 -28
  539. package/src/server/render-timeout.ts +108 -0
  540. package/src/server/request-context.ts +293 -132
  541. package/src/server/route-element-builder.ts +283 -191
  542. package/src/server/route-handler.ts +24 -4
  543. package/src/server/route-matcher.ts +31 -20
  544. package/src/server/rsc-entry/api-handler.ts +15 -16
  545. package/src/server/rsc-entry/error-renderer.ts +305 -89
  546. package/src/server/rsc-entry/helpers.ts +134 -5
  547. package/src/server/rsc-entry/index.ts +304 -111
  548. package/src/server/rsc-entry/rsc-payload.ts +65 -18
  549. package/src/server/rsc-entry/rsc-stream.ts +81 -13
  550. package/src/server/rsc-entry/ssr-bridge.ts +14 -5
  551. package/src/server/rsc-entry/ssr-renderer.ts +171 -38
  552. package/src/server/safe-load.ts +60 -0
  553. package/src/server/sensitive-fields.ts +230 -0
  554. package/src/server/sitemap-generator.ts +338 -0
  555. package/src/server/sitemap-handler.ts +126 -0
  556. package/src/server/slot-resolver.ts +244 -229
  557. package/src/server/ssr-entry.ts +215 -32
  558. package/src/server/ssr-render.ts +289 -67
  559. package/src/server/ssr-wrappers.tsx +139 -0
  560. package/src/server/status-code-resolver.ts +1 -1
  561. package/src/server/stream-utils.ts +213 -0
  562. package/src/server/tracing.ts +20 -9
  563. package/src/server/tree-builder.ts +92 -58
  564. package/src/server/types.ts +3 -6
  565. package/src/server/version-skew.ts +104 -0
  566. package/src/shared/merge-search-params.ts +55 -0
  567. package/src/shims/font-google.ts +1 -1
  568. package/src/shims/font-local.ts +34 -0
  569. package/src/shims/headers.ts +5 -1
  570. package/src/shims/navigation-client.ts +1 -1
  571. package/src/shims/navigation.ts +7 -2
  572. package/src/utils/directive-parser.ts +5 -2
  573. package/src/utils/state-machine.ts +111 -0
  574. package/dist/_chunks/als-registry-B7DbZ2hS.js.map +0 -1
  575. package/dist/_chunks/debug-gwlJkDuf.js.map +0 -1
  576. package/dist/_chunks/format-DviM89f0.js.map +0 -1
  577. package/dist/_chunks/interception-BOoWmLUA.js.map +0 -1
  578. package/dist/_chunks/request-context-DIkVh_jG.js +0 -330
  579. package/dist/_chunks/request-context-DIkVh_jG.js.map +0 -1
  580. package/dist/_chunks/tracing-CemImE6h.js.map +0 -1
  581. package/dist/_chunks/use-cookie-DX-l1_5E.js +0 -91
  582. package/dist/_chunks/use-cookie-DX-l1_5E.js.map +0 -1
  583. package/dist/_chunks/use-query-states-D5KaffOK.js.map +0 -1
  584. package/dist/cache/register-cached-function.d.ts +0 -17
  585. package/dist/cache/register-cached-function.d.ts.map +0 -1
  586. package/dist/client/browser-entry.d.ts +0 -21
  587. package/dist/client/browser-entry.d.ts.map +0 -1
  588. package/dist/client/link-status-provider.d.ts +0 -11
  589. package/dist/client/link-status-provider.d.ts.map +0 -1
  590. package/dist/client/transition-root.d.ts.map +0 -1
  591. package/dist/client/use-navigation-pending.d.ts.map +0 -1
  592. package/dist/cookies/index.js.map +0 -1
  593. package/dist/plugins/cache-transform.d.ts +0 -36
  594. package/dist/plugins/cache-transform.d.ts.map +0 -1
  595. package/dist/plugins/dynamic-transform.d.ts +0 -72
  596. package/dist/plugins/dynamic-transform.d.ts.map +0 -1
  597. package/dist/search-params/analyze.d.ts +0 -54
  598. package/dist/search-params/analyze.d.ts.map +0 -1
  599. package/dist/search-params/builtin-codecs.d.ts +0 -105
  600. package/dist/search-params/builtin-codecs.d.ts.map +0 -1
  601. package/dist/search-params/codecs.d.ts +0 -53
  602. package/dist/search-params/codecs.d.ts.map +0 -1
  603. package/dist/search-params/create.d.ts +0 -106
  604. package/dist/search-params/create.d.ts.map +0 -1
  605. package/dist/server/prerender.d.ts +0 -77
  606. package/dist/server/prerender.d.ts.map +0 -1
  607. package/dist/server/response-cache.d.ts +0 -54
  608. package/dist/server/response-cache.d.ts.map +0 -1
  609. package/src/cache/register-cached-function.ts +0 -103
  610. package/src/client/browser-entry.ts +0 -678
  611. package/src/client/link-status-provider.tsx +0 -30
  612. package/src/client/transition-root.tsx +0 -166
  613. package/src/plugins/cache-transform.ts +0 -199
  614. package/src/plugins/dynamic-transform.ts +0 -161
  615. package/src/search-params/analyze.ts +0 -192
  616. package/src/search-params/builtin-codecs.ts +0 -228
  617. package/src/search-params/create.ts +0 -321
  618. package/src/server/prerender.ts +0 -139
  619. package/src/server/response-cache.ts +0 -410
package/src/index.ts CHANGED
@@ -1,10 +1,19 @@
1
+ /**
2
+ * @timber-js/app — Root entry point (public API).
3
+ *
4
+ * User-facing exports: timber(), defineConfig(), TimberUserConfig, Routes.
5
+ *
6
+ * Internal helpers (PluginContext, resolveAppDir, loadTimberConfigFile,
7
+ * warnConfigConflicts, resolveClientJavascript) live in plugin-context.ts
8
+ * and are NOT re-exported here. Sub-plugins import them via relative paths.
9
+ *
10
+ * Design doc: 18-build-system.md §"Plugin Architecture"
11
+ */
12
+
1
13
  import type { Plugin, PluginOption } from 'vite';
2
- import { existsSync } from 'node:fs';
3
- import { join } from 'node:path';
4
- import { pathToFileURL } from 'node:url';
14
+ import { join, resolve } from 'node:path';
5
15
  import { createRequire } from 'node:module';
6
- import react from '@vitejs/plugin-react';
7
- import { cacheTransformPlugin } from './plugins/cache-transform';
16
+ import react, { reactCompilerPreset } from '@vitejs/plugin-react';
8
17
  import { timberContent } from './plugins/content';
9
18
  import { timberDevServer } from './plugins/dev-server';
10
19
  import { timberEntries } from './plugins/entries';
@@ -13,357 +22,258 @@ import { timberRouting } from './plugins/routing';
13
22
  import { timberShims } from './plugins/shims';
14
23
  import { timberFonts } from './plugins/fonts';
15
24
  import { timberStaticBuild } from './plugins/static-build';
16
- import { timberDynamicTransform } from './plugins/dynamic-transform';
17
25
  import { timberServerActionExports } from './plugins/server-action-exports';
18
26
  import { timberBuildManifest } from './plugins/build-manifest';
19
27
  import { timberDevLogs } from './plugins/dev-logs';
28
+ import { timberDevBrowserLogs } from './plugins/dev-browser-logs';
20
29
  import { timberReactProd } from './plugins/react-prod';
21
30
  import { timberChunks } from './plugins/chunks';
31
+ import { clientChunkGroup } from './plugins/client-chunks';
22
32
  import { timberServerBundle } from './plugins/server-bundle';
23
33
  import { timberAdapterBuild } from './plugins/adapter-build';
24
34
  import { timberBuildReport } from './plugins/build-report';
25
- import type { RouteTree } from './routing/types';
26
- import type { BuildManifest } from './server/build-manifest';
27
- import type { StartupTimer } from './utils/startup-timer';
28
- import { createStartupTimer, createNoopTimer } from './utils/startup-timer';
29
-
30
- /** Configuration for client-side JavaScript output. */
31
- export interface ClientJavascriptConfig {
32
- /** When true, no client JS bundles are emitted or referenced in HTML. */
33
- disabled: boolean;
34
- /**
35
- * When `disabled` is true, still inject the Vite HMR client in dev mode
36
- * so hot reloading works during development. Default: true.
37
- */
38
- enableHMRInDev?: boolean;
39
- }
35
+ import { createNoopTimer } from './utils/startup-timer';
36
+ import { resolveEncryptionKeyExpression, shouldEnableEncryption } from './server/action-encryption';
37
+ import { createHoldingServer } from './server/dev-holding-server.js';
38
+ import type { TimberUserConfig } from './config-types.js';
39
+ import type { PluginContext } from './plugin-context.js';
40
+ import {
41
+ createPluginContext,
42
+ loadTimberConfigFile,
43
+ mergeFileConfig,
44
+ resolveAppDir,
45
+ resolveClientJavascript,
46
+ resolveBuildDir,
47
+ DEFAULT_BUILD_DIR,
48
+ } from './plugin-context.js';
40
49
 
41
- /** Fully resolved client JavaScript configuration (no optionals). */
42
- export interface ResolvedClientJavascript {
43
- disabled: boolean;
44
- enableHMRInDev: boolean;
45
- }
50
+ // ── Public API ────────────────────────────────────────────────────────────
46
51
 
47
- export interface TimberUserConfig {
48
- output?: 'server' | 'static';
49
- /**
50
- * Enable timber debug logging in production builds.
51
- *
52
- * When `true`, timber's own diagnostics (dev warnings, verbose logging)
53
- * are active even in production mode. React stays in production mode —
54
- * only timber's logs are affected.
55
- *
56
- * Can also be enabled at runtime via the `TIMBER_DEBUG` environment variable.
57
- *
58
- * Default: `false`.
59
- */
60
- debug?: boolean;
61
- /**
62
- * Control client-side JavaScript output.
63
- *
64
- * Boolean shorthand:
65
- * `clientJavascript: false` disables all client JS (equivalent to `{ disabled: true }`).
66
- * `clientJavascript: true` enables client JS (the default).
67
- *
68
- * Object form:
69
- * `clientJavascript: { disabled: true, enableHMRInDev: true }` disables client JS
70
- * in production but preserves Vite HMR in dev mode.
71
- *
72
- * When `disabled` is true, `enableHMRInDev` defaults to `true`.
73
- * Server-side JS still runs — this only affects what is sent to the browser.
74
- */
75
- clientJavascript?: boolean | ClientJavascriptConfig;
76
- adapter?: unknown;
77
- cacheHandler?: unknown;
78
- allowedOrigins?: string[];
79
- csrf?: boolean;
80
- limits?: {
81
- actionBodySize?: string;
82
- uploadBodySize?: string;
83
- maxFields?: number;
84
- };
85
- pageExtensions?: string[];
86
- /**
87
- * Slow request threshold in milliseconds. Requests exceeding this emit
88
- * a warning via the logger. Set to 0 to disable. Default: 3000.
89
- *
90
- * See design/17-logging.md §"slowRequestMs".
91
- */
92
- slowRequestMs?: number;
93
- /** Dev-mode options. These have no effect in production builds. */
94
- dev?: {
95
- /** Threshold in ms to highlight slow phases in dev logging output. Default: 200. */
96
- slowPhaseMs?: number;
97
- };
98
- /**
99
- * Cookie signing configuration. See design/29-cookies.md §"Signed Cookies".
100
- *
101
- * Provide `secret` for a single key, or `secrets` (array) for key rotation.
102
- * When `secrets` is used, index 0 is the signing key; all are tried for verification.
103
- */
104
- cookies?: {
105
- /** Single signing secret. Shorthand for `secrets: [secret]`. */
106
- secret?: string;
107
- /** Array of signing secrets for key rotation. Index 0 signs; all verify. */
108
- secrets?: string[];
109
- };
110
- /**
111
- * Override the app directory location. By default, timber auto-detects
112
- * `app/` at the project root, falling back to `src/app/`.
113
- *
114
- * Set this to a relative path from the project root (e.g. `'src/app'`)
115
- * to use a custom location.
116
- */
117
- appDir?: string;
118
- /** MDX compilation options passed to @mdx-js/rollup. See design/20-content-collections.md. */
119
- mdx?: {
120
- remarkPlugins?: unknown[];
121
- rehypePlugins?: unknown[];
122
- recmaPlugins?: unknown[];
123
- remarkRehypeOptions?: Record<string, unknown>;
124
- };
125
- /**
126
- * Built-in top-loader progress bar for client navigations.
127
- * Shows an animated bar at the top of the viewport during RSC navigations.
128
- * Enabled by default — set `enabled: false` to opt out.
129
- *
130
- * Users who want a fully custom progress indicator should disable this
131
- * and use `useNavigationPending()` directly.
132
- *
133
- * See LOCAL-336 for design decisions.
134
- */
135
- topLoader?: {
136
- /** Whether the top-loader is enabled. Default: true. */
137
- enabled?: boolean;
138
- /** Bar color. Default: '#2299DD'. */
139
- color?: string;
140
- /** Bar height in pixels. Default: 3. */
141
- height?: number;
142
- /** Show subtle glow/shadow effect. Default: true. */
143
- shadow?: boolean;
144
- /** Delay in ms before showing the bar (avoids flash on fast navs). Default: 0. */
145
- delay?: number;
146
- /** CSS z-index. Default: 1600. */
147
- zIndex?: number;
148
- };
149
- /**
150
- * Response-level caching and deduplication.
151
- *
152
- * When enabled, concurrent requests to the same URL share a single render
153
- * (singleflight), and recently rendered responses are reused from a short-TTL
154
- * LRU cache without re-executing the RSC-to-SSR pipeline.
155
- *
156
- * Set to `false` to disable entirely. Default: enabled with sensible defaults.
157
- *
158
- * See design/31-benchmarking.md for performance context.
159
- */
160
- responseCache?:
161
- | false
162
- | {
163
- /** Maximum number of entries in the LRU cache. Default: 150. */
164
- maxSize?: number;
165
- /** TTL for cached entries in milliseconds. Default: 5000 (5s). */
166
- ttlMs?: number;
167
- /**
168
- * When true (default), requests with Cookie or Authorization headers
169
- * bypass the cache entirely. This prevents sharing user-specific
170
- * responses across requests.
171
- *
172
- * Set to false to cache all responses regardless of auth state.
173
- * Only do this if your pages are truly public and don't vary by user.
174
- */
175
- publicOnly?: boolean;
176
- };
177
- }
52
+ export type { TimberUserConfig } from './config-types.js';
178
53
 
179
54
  /**
180
- * Resolve `clientJavascript` into a fully resolved config.
55
+ * Route map interface augmented by the generated timber-routes.d.ts.
56
+ *
57
+ * Each key is a route path pattern. Values have:
58
+ * segmentParams: shape of URL segment params (e.g. { id: string })
59
+ * searchParams: parsed type from search-params.ts, or {} if none
60
+ *
61
+ * This interface is empty by default and populated via codegen.
62
+ * See design/09-typescript.md §"Typed Routes".
181
63
  */
182
- export function resolveClientJavascript(config: TimberUserConfig): ResolvedClientJavascript {
183
- if (config.clientJavascript !== undefined) {
184
- if (typeof config.clientJavascript === 'boolean') {
185
- // `clientJavascript: false` → disabled
186
- // `clientJavascript: true` → enabled (default)
187
- return {
188
- disabled: !config.clientJavascript,
189
- enableHMRInDev: !config.clientJavascript, // default true when disabled
190
- };
191
- }
192
- // Object form
193
- return {
194
- disabled: config.clientJavascript.disabled,
195
- enableHMRInDev: config.clientJavascript.enableHMRInDev ?? config.clientJavascript.disabled,
196
- };
197
- }
64
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
65
+ export interface Routes {}
198
66
 
199
- // Default: client JS enabled
200
- return { disabled: false, enableHMRInDev: false };
67
+ /**
68
+ * Type-safe helper for timber.config.ts files.
69
+ *
70
+ * A pass-through identity function that provides autocomplete and
71
+ * type checking for timber configuration. No runtime validation —
72
+ * purely a DX convenience (same pattern as Vite's defineConfig).
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * // timber.config.ts
77
+ * import { defineConfig } from '@timber-js/app';
78
+ *
79
+ * export default defineConfig({
80
+ * output: 'server',
81
+ * pageExtensions: ['tsx', 'ts', 'mdx'],
82
+ * });
83
+ * ```
84
+ */
85
+ export function defineConfig(config: TimberUserConfig): TimberUserConfig {
86
+ return config;
201
87
  }
202
88
 
89
+ // ── Private helpers ───────────────────────────────────────────────────────
90
+
203
91
  /**
204
- * Shared context object passed to all sub-plugins via closure.
92
+ * Resolve the React Compiler plugin via @rolldown/plugin-babel.
93
+ *
94
+ * Uses the `reactCompilerPreset` from @vitejs/plugin-react, which:
95
+ * - Uses Babel ONLY for the compiler pass (OXC handles JSX)
96
+ * - Automatically scopes to client environment via applyToEnvironmentHook
97
+ * - Uses react/compiler-runtime built into React 19
205
98
  *
206
- * Sub-plugins communicate through this context not through Vite's
207
- * plugin API or global state.
208
- * See design/18-build-system.md §"Shared Plugin Context".
99
+ * @rolldown/plugin-babel and babel-plugin-react-compiler are optional peer deps.
100
+ * If either is missing, require() fails with a clear error message.
209
101
  */
210
- export interface PluginContext {
211
- config: TimberUserConfig;
212
- /** Resolved client JavaScript configuration */
213
- clientJavascript: ResolvedClientJavascript;
214
- /** The scanned route tree (populated by timber-routing, consumed by timber-entries) */
215
- routeTree: RouteTree | null;
216
- /** Absolute path to the app/ directory */
217
- appDir: string;
218
- /** Absolute path to the project root */
219
- root: string;
220
- /** Whether the dev server is running (set by timber-root-sync in configResolved) */
221
- dev: boolean;
222
- /** CSS build manifest (populated by adapter after client build, null in dev) */
223
- buildManifest: BuildManifest | null;
224
- /** Startup timer for profiling cold start phases (active in dev, no-op in prod) */
225
- timer: StartupTimer;
226
-
102
+ function resolveReactCompilerPlugin(
103
+ config: true | { compilationMode?: string; target?: string },
104
+ req: NodeRequire
105
+ ): PluginOption {
106
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
107
+ let babel: any;
108
+ try {
109
+ babel = req('@rolldown/plugin-babel');
110
+ } catch {
111
+ throw new Error(
112
+ '[timber] reactCompiler requires @rolldown/plugin-babel. ' +
113
+ 'Install it: pnpm add -D @rolldown/plugin-babel babel-plugin-react-compiler'
114
+ );
115
+ }
116
+ const options = typeof config === 'object' ? config : {};
117
+ const babelPlugin = babel.default ?? babel;
118
+ return babelPlugin({
119
+ presets: [reactCompilerPreset(options as Parameters<typeof reactCompilerPreset>[0])],
120
+ }) as PluginOption;
227
121
  }
228
122
 
229
123
  /**
230
- * Resolve the app directory. Checks (in order):
231
- * 1. Explicit `configAppDir` from timber.config.ts
232
- * 2. `<root>/app`
233
- * 3. `<root>/src/app`
124
+ * Build the options object for @vitejs/plugin-rsc.
234
125
  *
235
- * Throws if none exist.
126
+ * Uses a getter for `enableActionEncryption` so the RSC plugin reads
127
+ * the value lazily — after ctx.dev is set in configResolved. This lets
128
+ * `actionEncryption.disableInDev` work correctly even though the RSC
129
+ * plugin is created before Vite resolves the command.
236
130
  */
237
- export function resolveAppDir(root: string, configAppDir?: string): string {
238
- if (configAppDir) {
239
- const explicit = join(root, configAppDir);
240
- if (!existsSync(explicit)) {
241
- throw new Error(`[timber] Configured appDir "${configAppDir}" does not exist at ${explicit}`);
242
- }
243
- return explicit;
244
- }
131
+ function createRscOptions(
132
+ ctx: PluginContext,
133
+ encryptionKeyExpr: string | undefined
134
+ ): Record<string, unknown> {
135
+ const options: Record<string, unknown> = {
136
+ serverHandler: false,
137
+ customClientEntry: true,
138
+ entries: {
139
+ rsc: 'virtual:timber-rsc-entry',
140
+ ssr: 'virtual:timber-ssr-entry',
141
+ client: 'virtual:timber-browser-entry',
142
+ },
143
+ // Group client references by layout boundary to balance route-scoped code
144
+ // splitting with HTTP request count. A constant group name ('client-refs')
145
+ // would collapse all routes into one chunk — any page downloads every
146
+ // client component. Per-serverChunk grouping creates many sub-500B files.
147
+ // Layout-boundary grouping is the middle ground: components under the same
148
+ // layout segment share a chunk. See design/27-chunking-strategy.md, TIM-440, TIM-499.
149
+ clientChunks: (meta: { id: string; normalizedId: string; serverChunk: string }) =>
150
+ clientChunkGroup(meta, ctx.appDir),
151
+ };
245
152
 
246
- const rootApp = join(root, 'app');
247
- if (existsSync(rootApp)) return rootApp;
153
+ // Bound args encryption — AES-256-GCM authenticated encryption for
154
+ // closure variables in 'use server' functions. Always on in production,
155
+ // configurable in dev. See design/08-forms-and-actions.md §"Bound Args Encryption".
156
+ //
157
+ // Uses a getter so the RSC plugin reads the value lazily in its transform
158
+ // hooks, after ctx.dev is set in configResolved. This lets disableInDev
159
+ // work correctly — ctx.dev is false at construction time but true during
160
+ // dev server transforms.
161
+ Object.defineProperty(options, 'enableActionEncryption', {
162
+ get() {
163
+ return shouldEnableEncryption(ctx.dev, ctx.config.actionEncryption);
164
+ },
165
+ enumerable: true,
166
+ });
248
167
 
249
- const srcApp = join(root, 'src', 'app');
250
- if (existsSync(srcApp)) return srcApp;
168
+ // When TIMBER_ACTIONS_ENCRYPTION_KEY is set, pass it as a runtime expression
169
+ // so the RSC plugin uses it instead of auto-generating a per-build key.
170
+ if (encryptionKeyExpr) {
171
+ options.defineEncryptionKey = encryptionKeyExpr;
172
+ }
251
173
 
252
- throw new Error(
253
- `[timber] Could not find app directory. Expected "app/" or "src/app/" in ${root}. ` +
254
- `You can set appDir in timber.config.ts to specify a custom location.`
255
- );
174
+ return options;
256
175
  }
257
176
 
258
- function createPluginContext(config?: TimberUserConfig, root?: string): PluginContext {
259
- const projectRoot = root ?? process.cwd();
260
- const resolvedConfig: TimberUserConfig = { output: 'server', ...config };
261
- // Timer starts as active — swapped to noop in configResolved for production builds
262
- return {
263
- config: resolvedConfig,
264
- clientJavascript: resolveClientJavascript(resolvedConfig),
265
- routeTree: null,
266
- appDir: join(projectRoot, 'app'),
267
- root: projectRoot,
268
- dev: false,
269
- buildManifest: null,
270
- timer: createStartupTimer(),
271
- };
272
- }
177
+ // NOTE: 'use cache' directive transform removed — future feature pending design doc.
178
+ // The timber.cache() API (createCache) remains available for explicit caching.
179
+ // See design/06-caching.md.
273
180
 
274
- /**
275
- * Load timber.config.ts (or .js, .mjs) from the project root.
276
- * Returns the config object or null if no config file is found.
277
- */
278
- async function loadTimberConfigFile(root: string): Promise<TimberUserConfig | null> {
279
- const configNames = ['timber.config.ts', 'timber.config.js', 'timber.config.mjs'];
280
-
281
- for (const name of configNames) {
282
- const configPath = join(root, name);
283
- if (existsSync(configPath)) {
284
- const mod = await import(pathToFileURL(configPath).href);
285
- return (mod.default ?? mod) as TimberUserConfig;
286
- }
287
- }
288
- return null;
289
- }
181
+ // ── Main plugin factory ──────────────────────────────────────────────────
290
182
 
291
183
  /**
292
- * Detect config keys set in both inline (vite.config.ts) and file (timber.config.ts)
293
- * and warn the user. The `output` key is excluded because it defaults to 'server'
294
- * in createPluginContext and would always appear as an inline key.
184
+ * Create the timber Vite plugin array.
185
+ *
186
+ * Loads timber.config.ts and all dependencies synchronously before
187
+ * constructing the plugin array. This ensures ALL plugins — including
188
+ * the RSC plugin and React Compiler — see the fully merged config
189
+ * (inline + file-based). No async, no deferred config, no stale reads.
190
+ *
191
+ * Requires Node >= 22.12 for synchronous require() of ESM modules
192
+ * (@vitejs/plugin-rsc is ESM-only).
295
193
  *
296
- * Returns the list of conflicting key names (for testing).
194
+ * Previous versions used async loading and deferred config merging,
195
+ * causing file-based config for reactCompiler, actionEncryption, and
196
+ * output mode to be silently ignored. See TIM-451.
297
197
  */
298
- export function warnConfigConflicts(
299
- inline: TimberUserConfig,
300
- fileConfig: TimberUserConfig
301
- ): string[] {
302
- const conflicts: string[] = [];
303
- for (const key of Object.keys(fileConfig) as (keyof TimberUserConfig)[]) {
304
- if (key === 'output') continue;
305
- if (key in inline && inline[key] !== undefined) {
306
- conflicts.push(key);
307
- }
308
- }
309
- if (conflicts.length > 0) {
310
- console.warn(
311
- `[timber] Config conflict: ${conflicts.map((k) => `"${k}"`).join(', ')} set in both ` +
312
- `vite.config.ts (inline) and timber.config.ts. ` +
313
- `Move all config to timber.config.ts to avoid confusion. ` +
314
- `The inline value from vite.config.ts will be used.`
315
- );
316
- }
317
- return conflicts;
318
- }
198
+ export function timber(config?: TimberUserConfig): PluginOption[] {
199
+ const ctx = createPluginContext(config);
319
200
 
320
- /**
321
- * Merge file-based config into ctx.config. Inline config (already in ctx.config)
322
- * takes precedence file config only fills in missing fields.
323
- */
324
- function mergeFileConfig(ctx: PluginContext, fileConfig: TimberUserConfig): void {
325
- const inline = ctx.config;
326
-
327
- // Warn if the same key is set in both places
328
- warnConfigConflicts(inline, fileConfig);
329
-
330
- // For each top-level key, use inline value if present, otherwise file value
331
- ctx.config = {
332
- ...fileConfig,
333
- ...inline,
334
- // Deep merge for nested objects where both exist
335
- ...(fileConfig.limits && inline.limits
336
- ? { limits: { ...fileConfig.limits, ...inline.limits } }
337
- : {}),
338
- ...(fileConfig.dev && inline.dev ? { dev: { ...fileConfig.dev, ...inline.dev } } : {}),
339
- ...(fileConfig.mdx && inline.mdx ? { mdx: { ...fileConfig.mdx, ...inline.mdx } } : {}),
340
- };
341
- }
201
+ // Resolve dependencies from the consumer's project (process.cwd()),
202
+ // not from timber's own node_modules. This is critical for pnpm link:
203
+ // when linked, timber's node_modules has a separate vite instance, and
204
+ // the RSC plugin must use the same vite instance as the dev server.
205
+ const consumerRequire = createRequire(join(process.cwd(), 'package.json'));
342
206
 
343
- function timberCache(_ctx: PluginContext): Plugin {
344
- return cacheTransformPlugin();
345
- }
207
+ // ── Step 1: Load @vitejs/plugin-rsc ─────────────────────────────────
208
+ // Synchronous require() works for ESM modules on Node 22.12+.
209
+ ctx.timer.start('rsc-plugin-import');
210
+ const rscMod = consumerRequire('@vitejs/plugin-rsc');
211
+ const vitePluginRsc = rscMod.default ?? rscMod;
212
+ ctx.timer.end('rsc-plugin-import');
346
213
 
347
- export function timber(config?: TimberUserConfig): PluginOption[] {
348
- const ctx = createPluginContext(config);
349
- // Sync ctx.root and ctx.appDir with Vite's resolved root, which may
350
- // differ from process.cwd() when --config points to a subdirectory.
351
- // Also loads timber.config.ts and merges it into ctx.config (inline config wins).
214
+ // ── Step 2: Compute config-dependent options ────────────────────────
215
+ // encryptionKeyExpr is env-based and doesn't depend on file config.
216
+ const encryptionKeyExpr = resolveEncryptionKeyExpression();
217
+
218
+ // ── Step 3: Pre-load file config for plugin resolution ──────────────
219
+ // Load timber.config.ts eagerly from process.cwd() so we can resolve
220
+ // plugins (like React Compiler) and add them to the top-level array.
221
+ // Vite's config() hook return type is Omit<UserConfig, 'plugins'> —
222
+ // plugins returned from config() are silently ignored. See TIM-632.
223
+ //
224
+ // The config() hook still loads from the correct Vite root (which may
225
+ // differ from cwd in monorepo setups — see TIM-498), but only for
226
+ // non-plugin config merging.
227
+ const earlyFileConfig = loadTimberConfigFile(process.cwd());
228
+
229
+ // ── Step 4: Build rootSync plugin ───────────────────────────────────
230
+ // rootSync loads timber.config.ts from Vite's resolved root and merges
231
+ // it into ctx.config. Plugin resolution is handled eagerly above — the
232
+ // config() hook must NOT return a `plugins` field (Vite ignores it).
352
233
  const rootSync: Plugin = {
353
234
  name: 'timber-root-sync',
354
- async config(userConfig, { command }) {
355
- // Load timber.config.ts early before configResolved/buildStart — so
356
- // all plugins (including timber-mdx) see the merged config in their
357
- // buildStart hooks. The config hook runs once and supports async.
358
- const root = userConfig.root ?? process.cwd();
235
+ config(userConfig, { command }) {
236
+ // ── Load timber.config.ts from the correct root ───────────────
237
+ // Vite's `config` hook fires before `configResolved`. The user's
238
+ // `root` option (if set) tells us where the project lives.
239
+ // `resolve()` mirrors Vite's own root resolution logic.
240
+ const viteRoot = resolve(userConfig.root ?? process.cwd());
359
241
  ctx.timer.start('config-load');
360
- const fileConfig = await loadTimberConfigFile(root);
242
+ const fileConfig = loadTimberConfigFile(viteRoot);
361
243
  if (fileConfig) {
362
244
  mergeFileConfig(ctx, fileConfig);
363
245
  ctx.clientJavascript = resolveClientJavascript(ctx.config);
364
246
  }
247
+ // Apply defaults AFTER merge so file-based config isn't overridden
248
+ // by defaults that were baked into the inline config object.
249
+ ctx.config.output ??= 'server';
365
250
  ctx.timer.end('config-load');
366
251
 
252
+ // ── Resolve build output directory ─────────────────────────
253
+ // Priority: timber.config.ts `buildDir` > Vite `build.outDir` > .timber/dist
254
+ // Set Vite's build.outDir so the RSC plugin and all environment
255
+ // builds write to the correct location.
256
+ const viteOutDir = userConfig.build?.outDir;
257
+ const timberBuildDir = ctx.config.buildDir;
258
+ const resolvedRoot = resolve(userConfig.root ?? process.cwd());
259
+ ctx.buildDir = resolveBuildDir(resolvedRoot, timberBuildDir, viteOutDir);
260
+
261
+ // Warn if the Vite root differs from cwd and the re-loaded config
262
+ // has reactCompiler but the early cwd-based load missed it. In this
263
+ // edge case the user must move reactCompiler to inline config.
264
+ if (viteRoot !== process.cwd()) {
265
+ const hasCompilerInReloaded = !config?.reactCompiler && ctx.config.reactCompiler;
266
+ const hadCompilerInEarly = !config?.reactCompiler && earlyFileConfig?.reactCompiler;
267
+ if (hasCompilerInReloaded && !hadCompilerInEarly) {
268
+ console.warn(
269
+ '[timber] reactCompiler is set in timber.config.ts but could not be ' +
270
+ 'registered because the config file is in a non-cwd root directory. ' +
271
+ 'Move reactCompiler to the inline timber() config in vite.config.ts, or ' +
272
+ 'run vite from the project root directory.'
273
+ );
274
+ }
275
+ }
276
+
367
277
  // Force production JSX transform for builds.
368
278
  //
369
279
  // Vite determines dev vs prod JSX via `isProduction`, which checks
@@ -377,8 +287,60 @@ export function timber(config?: TimberUserConfig): PluginOption[] {
377
287
  // We explicitly set `oxc.jsx.development: false` for builds so
378
288
  // the client bundle always uses jsx/jsxs from react/jsx-runtime,
379
289
  // regardless of the ambient NODE_ENV value.
290
+ // ── Start holding server for dev mode ───────────────────────
291
+ // Bind the port immediately so browsers see a loading page
292
+ // instead of ERR_CONNECTION_REFUSED during the ~6-8s startup.
293
+ // The holding server is closed in timber-dev-server's
294
+ // configureServer hook (the last plugin), right before Vite
295
+ // calls server.listen().
296
+ // See design/21-dev-server.md §"Startup Holding Server", TIM-665.
297
+ if (command === 'serve') {
298
+ const port = (userConfig.server?.port as number) ?? 5173;
299
+ try {
300
+ ctx.holdingServer = createHoldingServer();
301
+ // listen() is async but we fire-and-forget — the server
302
+ // starts binding immediately and will be ready well before
303
+ // any browser request arrives. We can't await here because
304
+ // config() must return synchronously.
305
+ ctx.holdingServer.listen(port).then(
306
+ (boundPort) => {
307
+ const url = `http://localhost:${boundPort}`;
308
+ console.log(
309
+ `\n \x1b[2m🪵 timber.js dev server starting at\x1b[0m \x1b[36m${url}\x1b[0m\n`
310
+ );
311
+ },
312
+ () => {
313
+ // Port already in use — skip gracefully.
314
+ ctx.holdingServer = null;
315
+ }
316
+ );
317
+ } catch {
318
+ ctx.holdingServer = null;
319
+ }
320
+ }
321
+
322
+ // Return the resolved buildDir as Vite's build.outDir so the RSC
323
+ // plugin and all environment builds write to the correct location.
324
+ // This is always set — either from timber config, Vite config, or default.
325
+ const buildOutDir = timberBuildDir
326
+ ? timberBuildDir
327
+ : viteOutDir && viteOutDir !== 'dist'
328
+ ? viteOutDir
329
+ : DEFAULT_BUILD_DIR;
330
+
331
+ // Set per-environment build.outDir so Vite's RSC plugin writes
332
+ // each environment to the correct subdirectory under our buildDir.
333
+ // Without this, the RSC plugin defaults to dist/<envName> instead
334
+ // of <buildOutDir>/<envName>.
335
+ const envOutDirs: Record<string, { build: { outDir: string } }> = {};
336
+ for (const envName of ['rsc', 'ssr', 'client']) {
337
+ envOutDirs[envName] = { build: { outDir: join(buildOutDir, envName) } };
338
+ }
339
+
380
340
  if (command === 'build') {
381
341
  return {
342
+ build: { outDir: buildOutDir },
343
+ environments: envOutDirs,
382
344
  oxc: {
383
345
  jsx: {
384
346
  development: false,
@@ -386,11 +348,17 @@ export function timber(config?: TimberUserConfig): PluginOption[] {
386
348
  },
387
349
  };
388
350
  }
351
+
352
+ // Dev mode: set outDir so dev-time references are consistent
353
+ return { build: { outDir: buildOutDir }, environments: envOutDirs };
389
354
  },
390
355
  configResolved(resolved) {
391
356
  ctx.root = resolved.root;
392
357
  ctx.appDir = resolveAppDir(resolved.root, ctx.config.appDir);
393
358
  ctx.dev = resolved.command === 'serve';
359
+ // Sync buildDir from Vite's resolved build.outDir. Vite keeps
360
+ // outDir as-is (may be relative), so resolve against root.
361
+ ctx.buildDir = resolve(resolved.root, resolved.build.outDir);
394
362
  // In production builds, swap to a no-op timer to avoid overhead
395
363
  if (!ctx.dev) {
396
364
  ctx.timer = createNoopTimer();
@@ -398,19 +366,47 @@ export function timber(config?: TimberUserConfig): PluginOption[] {
398
366
  // Start the overall dev server setup timer — ends in timber-dev-server
399
367
  ctx.timer.start('dev-server-setup');
400
368
  }
369
+
370
+ // Validate config and check peer dependencies at startup.
371
+ // Errors are logged to stderr but don't block startup — Vite may
372
+ // still work partially, and the errors guide the user to fix things.
373
+ const { validateConfig, formatConfigErrors, checkPeerDependencies, formatMissingPeers } =
374
+ require('./config-validation.js') as typeof import('./config-validation.js');
375
+
376
+ const configErrors = validateConfig(ctx.config);
377
+ if (configErrors.length > 0) {
378
+ process.stderr.write(`${formatConfigErrors(configErrors)}\n\n`);
379
+ }
380
+
381
+ const peerResults = checkPeerDependencies(ctx.root);
382
+ const peerWarning = formatMissingPeers(peerResults);
383
+ if (peerWarning) {
384
+ process.stderr.write(`${peerWarning}\n\n`);
385
+ }
401
386
  },
402
387
  };
388
+
389
+ // ── Step 5: Resolve optional plugins ────────────────────────────────
390
+ // React Compiler — resolved eagerly from either inline or file config.
391
+ // Vite's config() hook return type is Omit<UserConfig, 'plugins'>, so
392
+ // plugins MUST be in the top-level array — returning them from config()
393
+ // silently drops them. See TIM-632.
394
+ //
395
+ // Inline config takes precedence. File config (from the early cwd-based
396
+ // load) is used when inline config doesn't set reactCompiler.
397
+ const reactCompilerPlugins: PluginOption[] = [];
398
+ const effectiveReactCompiler = config?.reactCompiler ?? earlyFileConfig?.reactCompiler;
399
+ if (effectiveReactCompiler) {
400
+ reactCompilerPlugins.push(resolveReactCompilerPlugin(effectiveReactCompiler, consumerRequire));
401
+ }
402
+
403
+ // ── Step 6: Assemble plugin array ─────────────────────────────────────
403
404
  // @vitejs/plugin-rsc handles:
404
405
  // - RSC/SSR/client environment setup
405
406
  // - "use client" directive → client reference proxy transformation
406
407
  // - "use server" directive → server reference transformation
407
408
  // - Client reference tracking and module map generation
408
409
  //
409
- // Loaded via dynamic import() because @vitejs/plugin-rsc is ESM-only.
410
- // Vite's config loader uses esbuild to transpile to CJS, which breaks
411
- // static imports of ESM-only packages. The dynamic import() is preserved
412
- // by esbuild and runs natively in ESM at runtime.
413
- //
414
410
  // serverHandler: false — timber has its own dev server (timber-dev-server)
415
411
  // entries — tells the RSC plugin about timber's virtual entry modules so
416
412
  // it correctly wires up the browser entry (needed for React Fast Refresh
@@ -423,30 +419,6 @@ export function timber(config?: TimberUserConfig): PluginOption[] {
423
419
  // We do NOT set customBuildApp — the RSC plugin's orchestration is correct
424
420
  // and handles bundle ordering, asset manifest generation, and environment
425
421
  // imports manifest. See @vitejs/plugin-rsc's buildApp implementation.
426
- // Resolve @vitejs/plugin-rsc from the consumer's project (process.cwd()),
427
- // not from timber's own node_modules. This is critical for pnpm link:
428
- // when linked, timber's node_modules has a separate vite instance, and
429
- // the RSC plugin must use the same vite instance as the dev server.
430
- const consumerRequire = createRequire(join(process.cwd(), 'package.json'));
431
- const rscPluginPath = consumerRequire.resolve('@vitejs/plugin-rsc');
432
- ctx.timer.start('rsc-plugin-import');
433
- const rscPluginsPromise = import(pathToFileURL(rscPluginPath).href).then(
434
- ({ default: vitePluginRsc }) => {
435
- ctx.timer.end('rsc-plugin-import');
436
- return vitePluginRsc({
437
- serverHandler: false,
438
- customClientEntry: true,
439
- entries: {
440
- rsc: 'virtual:timber-rsc-entry',
441
- ssr: 'virtual:timber-ssr-entry',
442
- client: 'virtual:timber-browser-entry',
443
- },
444
- // No custom clientChunks — Rolldown handles natural code splitting.
445
- // See design/27-chunking-strategy.md and LOCAL-337.
446
- });
447
- }
448
- );
449
-
450
422
  return [
451
423
  rootSync,
452
424
  timberReactProd(),
@@ -455,15 +427,14 @@ export function timber(config?: TimberUserConfig): PluginOption[] {
455
427
  // following Vinext's convention — the RSC plugin's virtual browser entry
456
428
  // coordinates with plugin-react via __vite_plugin_react_preamble_installed__.
457
429
  react(),
430
+ ...reactCompilerPlugins,
458
431
  timberServerActionExports(),
459
- rscPluginsPromise,
432
+ vitePluginRsc(createRscOptions(ctx, encryptionKeyExpr)),
460
433
  timberShims(ctx),
461
434
  timberRouting(ctx),
462
435
  timberEntries(ctx),
463
436
  timberBuildManifest(ctx),
464
- timberCache(ctx),
465
437
  timberStaticBuild(ctx),
466
- timberDynamicTransform(ctx),
467
438
  timberFonts(ctx),
468
439
  timberMdx(ctx),
469
440
  timberContent(ctx),
@@ -472,21 +443,9 @@ export function timber(config?: TimberUserConfig): PluginOption[] {
472
443
  timberBuildReport(ctx), // Post-build: route table with bundle sizes
473
444
  timberAdapterBuild(ctx), // Post-build: invoke adapter.buildOutput()
474
445
  timberDevLogs(ctx), // Dev-only: forward server console.* to browser console
446
+ timberDevBrowserLogs(ctx), // Dev-only: forward browser console.* to server terminal
475
447
  timberDevServer(ctx), // Must be last — configureServer post-hook runs after all watchers
476
448
  ];
477
449
  }
478
450
 
479
- /**
480
- * Route map interface — augmented by the generated timber-routes.d.ts.
481
- *
482
- * Each key is a route path pattern. Values have:
483
- * params: shape of URL params (e.g. { id: string })
484
- * searchParams: parsed type from search-params.ts, or {} if none
485
- *
486
- * This interface is empty by default and populated via codegen.
487
- * See design/09-typescript.md §"Typed Routes".
488
- */
489
- // eslint-disable-next-line @typescript-eslint/no-empty-object-type
490
- export interface Routes {}
491
-
492
451
  export default timber;