@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
@@ -0,0 +1,144 @@
1
+ /**
2
+ * Server action bound args encryption utilities.
3
+ *
4
+ * Provides key management for the RSC plugin's built-in bound args encryption.
5
+ * The RSC plugin (@vitejs/plugin-rsc) handles the actual encrypt/decrypt via
6
+ * AES-256-GCM — this module handles:
7
+ *
8
+ * 1. Key sourcing: auto-generated at build time (embedded in bundle), overridable
9
+ * via env var for cross-build key sharing (rolling/blue-green deployments)
10
+ * 2. Build-time key expression generation for the RSC plugin's `defineEncryptionKey`
11
+ *
12
+ * Encryption is always on in production. In dev mode, it's on by default
13
+ * (matching the RSC plugin's behavior) but can be disabled for debugging.
14
+ *
15
+ * ## Known Security Considerations
16
+ *
17
+ * 1. **defineEncryptionKey is a raw JS expression.** The RSC plugin inlines it
18
+ * verbatim into generated code. We only emit the hardcoded string
19
+ * `process.env.TIMBER_ACTIONS_ENCRYPTION_KEY` — never user-controlled input.
20
+ * If this function is ever extended to accept configurable env var names,
21
+ * the expression MUST be validated against a safe pattern.
22
+ *
23
+ * 2. **Key material lives in GC-visible JS strings.** `atob()` decodes the key
24
+ * into a regular JavaScript string on the V8 heap. JavaScript has no
25
+ * `SecureString` or memory-zeroing primitive — this is an inherent platform
26
+ * limitation. Acceptable for web server use; would need review for FIPS.
27
+ *
28
+ * 3. **TIMBER_ACTIONS_ENCRYPTION_KEY must be set at both build time and runtime.**
29
+ * At build time, we validate the key format and emit a runtime expression.
30
+ * If the env var is present at build time but missing at runtime, the server
31
+ * will crash on first action invocation with an opaque `atob(undefined)` error.
32
+ * If the env var is present at runtime but was absent at build time, the RSC
33
+ * plugin will have generated its own key and the env var is silently ignored.
34
+ *
35
+ * See design/08-forms-and-actions.md §"Security"
36
+ * See design/13-security.md
37
+ */
38
+
39
+ // ─── Types ────────────────────────────────────────────────────────────────
40
+
41
+ /** User-facing configuration for action bound args encryption. */
42
+ export interface ActionEncryptionConfig {
43
+ /**
44
+ * Disable encryption in dev mode for easier debugging.
45
+ * Has no effect in production — encryption is always enabled.
46
+ * Default: false (encryption is on in dev too).
47
+ */
48
+ disableInDev?: boolean;
49
+ }
50
+
51
+ // ─── Key Resolution ───────────────────────────────────────────────────────
52
+
53
+ /**
54
+ * Regex for safe `defineEncryptionKey` expressions.
55
+ *
56
+ * The RSC plugin inlines this expression verbatim into generated JavaScript.
57
+ * We restrict it to `process.env.<UPPER_SNAKE_CASE>` to prevent code injection.
58
+ * See "Known Security Considerations" at the top of this file.
59
+ */
60
+ const SAFE_KEY_EXPR = /^process\.env\.[A-Z_][A-Z0-9_]*$/;
61
+
62
+ /**
63
+ * Build the `defineEncryptionKey` expression for the RSC plugin.
64
+ *
65
+ * The RSC plugin accepts a JavaScript expression string that will be
66
+ * inlined into the encryption runtime module. At runtime, this expression
67
+ * must evaluate to the base64-encoded encryption key.
68
+ *
69
+ * Priority:
70
+ * 1. `TIMBER_ACTIONS_ENCRYPTION_KEY` env var (for cross-build key sharing
71
+ * in rolling/blue-green deployments)
72
+ * 2. Auto-generated at build time (RSC plugin default — embedded in bundle,
73
+ * consistent across all instances of the same build)
74
+ *
75
+ * For env var keys, we generate a runtime expression that reads the env var.
76
+ * For auto-generated keys, we return undefined and let the RSC plugin handle it.
77
+ */
78
+ export function resolveEncryptionKeyExpression(): string | undefined {
79
+ // Check for env var override — used for cross-build key sharing where
80
+ // multiple builds must agree on the same encryption key.
81
+ const envKey = process.env.TIMBER_ACTIONS_ENCRYPTION_KEY;
82
+ if (envKey) {
83
+ // Validate the key format (must be base64-encoded 32-byte key)
84
+ validateKeyFormat(envKey);
85
+
86
+ // Return a runtime expression that reads the env var at startup.
87
+ // This ensures the key is read at runtime, not embedded in the build.
88
+ const expr = 'process.env.TIMBER_ACTIONS_ENCRYPTION_KEY';
89
+
90
+ // Defense-in-depth: validate the expression matches our safe pattern.
91
+ // This is redundant today (hardcoded string), but protects against
92
+ // future refactors that might make the expression configurable.
93
+ if (!SAFE_KEY_EXPR.test(expr)) {
94
+ throw new Error(`Unsafe encryption key expression: ${expr}`);
95
+ }
96
+
97
+ return expr;
98
+ }
99
+
100
+ // No override — let the RSC plugin auto-generate a per-build key
101
+ return undefined;
102
+ }
103
+
104
+ /**
105
+ * Determine whether action encryption should be enabled.
106
+ *
107
+ * Encryption is always enabled in production. In dev mode, it's enabled
108
+ * by default but can be disabled via config for debugging.
109
+ */
110
+ export function shouldEnableEncryption(isDev: boolean, config?: ActionEncryptionConfig): boolean {
111
+ if (!isDev) return true; // Always on in production
112
+ if (config?.disableInDev) return false; // Opt-out in dev
113
+ return true; // On by default in dev too
114
+ }
115
+
116
+ // ─── Key Validation ───────────────────────────────────────────────────────
117
+
118
+ /**
119
+ * Validate that a key string is a valid base64-encoded 256-bit key.
120
+ * Throws a descriptive error if the key is malformed.
121
+ */
122
+ export function validateKeyFormat(key: string): void {
123
+ // Decode base64 and check length (32 bytes = 256 bits)
124
+ try {
125
+ const decoded = atob(key);
126
+ const bytes = decoded.length;
127
+ if (bytes !== 32) {
128
+ throw new Error(
129
+ `TIMBER_ACTIONS_ENCRYPTION_KEY must be a base64-encoded 256-bit (32-byte) key. ` +
130
+ `Got ${bytes} bytes. Generate one with: ` +
131
+ `node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"`
132
+ );
133
+ }
134
+ } catch (error) {
135
+ if (error instanceof Error && error.message.includes('TIMBER_ACTIONS_ENCRYPTION_KEY')) {
136
+ throw error;
137
+ }
138
+ throw new Error(
139
+ `TIMBER_ACTIONS_ENCRYPTION_KEY is not valid base64. ` +
140
+ `Generate a key with: ` +
141
+ `node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"`
142
+ );
143
+ }
144
+ }
@@ -18,7 +18,7 @@ import {
18
18
  decodeReply,
19
19
  decodeAction,
20
20
  renderToReadableStream,
21
- } from '#/rsc-runtime/rsc.js';
21
+ } from '../rsc-runtime/rsc.js';
22
22
 
23
23
  import { validateCsrf, type CsrfConfig } from './csrf.js';
24
24
  import { executeAction, type RevalidateRenderer } from './actions.js';
@@ -30,7 +30,15 @@ import {
30
30
  import { handleActionError } from './action-client.js';
31
31
  import { enforceBodyLimits, enforceFieldLimit, type BodyLimitsConfig } from './body-limits.js';
32
32
  import { parseFormData } from './form-data.js';
33
+ import {
34
+ stripSensitiveFields,
35
+ resolveSensitivePredicate,
36
+ getGlobalSensitiveFieldsConfig,
37
+ type SensitiveFieldsOption,
38
+ } from './sensitive-fields.js';
33
39
  import type { FormFlashData } from './form-flash.js';
40
+ import { checkVersionSkew, applyReloadHeaders } from './version-skew.js';
41
+ import { logActionError } from './logger.js';
34
42
 
35
43
  // ─── Types ────────────────────────────────────────────────────────────────
36
44
 
@@ -42,6 +50,12 @@ export interface ActionDispatchConfig {
42
50
  revalidateRenderer?: RevalidateRenderer;
43
51
  /** Body size limits (from timber.config.ts). */
44
52
  bodyLimits?: BodyLimitsConfig;
53
+ /**
54
+ * Override the sensitive-field deny-list for the no-JS form POST path.
55
+ * Defaults to the global `forms.stripSensitiveFields` from `timber.config.ts`.
56
+ * See `SensitiveFieldsOption` in `./sensitive-fields.ts` and TIM-816.
57
+ */
58
+ sensitiveFields?: SensitiveFieldsOption;
45
59
  }
46
60
 
47
61
  // ─── Constants ────────────────────────────────────────────────────────────
@@ -90,6 +104,21 @@ export async function handleActionRequest(
90
104
  req: Request,
91
105
  config: ActionDispatchConfig
92
106
  ): Promise<Response | FormRerender | null> {
107
+ // Version skew detection — reject actions from stale clients (TIM-446).
108
+ // On mismatch, return a structured RSC error response that the client
109
+ // handles by showing a brief "App updated" message and reloading.
110
+ const skewCheck = checkVersionSkew(req);
111
+ if (!skewCheck.ok) {
112
+ const reloadHeaders = new Headers({
113
+ 'Content-Type': RSC_CONTENT_TYPE,
114
+ });
115
+ applyReloadHeaders(reloadHeaders);
116
+ // Return the reload signal as an RSC stream so createFromFetch can
117
+ // decode it. The client checks X-Timber-Reload before processing.
118
+ const rscStream = renderToReadableStream({ _versionSkew: true });
119
+ return new Response(rscStream, { status: 200, headers: reloadHeaders });
120
+ }
121
+
93
122
  // CSRF validation — reject cross-origin mutation requests.
94
123
  const csrfResult = validateCsrf(req, config.csrf);
95
124
  if (!csrfResult.ok) {
@@ -106,7 +135,7 @@ export async function handleActionRequest(
106
135
  return new Response(null, { status: limitsResult.status });
107
136
  }
108
137
 
109
- // Run inside request context so headers(), cookies() work in actions.
138
+ // Run inside request context so getHeaders(), getCookies() work in actions.
110
139
  // Actions are a mutable context — they can set cookies (design/29-cookies.md).
111
140
  return runWithRequestContext(req, async () => {
112
141
  setMutableCookieContext(true);
@@ -177,7 +206,7 @@ async function handleRscAction(
177
206
  });
178
207
  } catch (error) {
179
208
  // Log full error server-side for debugging
180
- console.error('[timber] server action error:', error);
209
+ logActionError({ method: req.method, path: new URL(req.url).pathname, error });
181
210
 
182
211
  // Return structured error response — ActionError gets its code/data,
183
212
  // unexpected errors get sanitized { code: 'INTERNAL_ERROR' }
@@ -278,8 +307,14 @@ async function handleFormAction(
278
307
  }
279
308
 
280
309
  // Capture submitted values for re-render on validation failure.
281
- // Parse before decodeAction consumes the FormData.
282
- const submittedValues = parseFormData(formData);
310
+ // Parse before decodeAction consumes the FormData, then strip sensitive
311
+ // fields (passwords, tokens, CVV, etc.) so they are never rendered back
312
+ // into the HTML as `defaultValue` attributes. See TIM-816.
313
+ const sensitivePredicate = resolveSensitivePredicate(
314
+ config.sensitiveFields,
315
+ getGlobalSensitiveFieldsConfig()
316
+ );
317
+ const submittedValues = stripSensitiveFields(parseFormData(formData), sensitivePredicate);
283
318
 
284
319
  // decodeAction resolves the action function from the form data's hidden fields.
285
320
  // It returns a bound function with the form data already applied.
@@ -293,7 +328,7 @@ async function handleFormAction(
293
328
  renderer: config.revalidateRenderer,
294
329
  });
295
330
  } catch (error) {
296
- console.error('[timber] server action error:', error);
331
+ logActionError({ method: req.method, path: new URL(req.url).pathname, error });
297
332
 
298
333
  // Return the error as flash data for re-render.
299
334
  // handleActionError produces { serverError } for ActionErrors
@@ -321,5 +356,17 @@ async function handleFormAction(
321
356
  // This handles both success ({ data }) and validation failure
322
357
  // ({ validationErrors, submittedValues }) — the form is the single source of truth.
323
358
  const actionResult = result.actionResult as FormFlashData;
359
+
360
+ // Defense-in-depth: strip sensitive fields from `actionResult.submittedValues`
361
+ // even if the action already built it. `createActionClient` strips internally,
362
+ // but raw `'use server'` functions that manually return `{ submittedValues }`
363
+ // are not covered by the inner strip. See TIM-816.
364
+ if (actionResult && actionResult.submittedValues) {
365
+ actionResult.submittedValues = stripSensitiveFields(
366
+ actionResult.submittedValues,
367
+ sensitivePredicate
368
+ );
369
+ }
370
+
324
371
  return { rerender: actionResult };
325
372
  }
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * - revalidatePath(path) re-renders the route at that path and returns the RSC
5
5
  * flight payload for inline reconciliation.
6
- * - revalidateTag(tag) invalidates cached shells and 'use cache' entries by tag.
6
+ * - revalidateTag(tag) invalidates timber.cache entries by tag.
7
7
  *
8
8
  * Both are callable from anywhere on the server — actions, API routes, handlers.
9
9
  *
@@ -14,7 +14,7 @@
14
14
  * See design/08-forms-and-actions.md
15
15
  */
16
16
 
17
- import type { CacheHandler } from '#/cache/index';
17
+ import { getCacheHandler } from '../cache/handler-store';
18
18
  import { RedirectSignal } from './primitives';
19
19
  import { withSpan } from './tracing';
20
20
  import { revalidationAls, type RevalidationState } from './als-registry.js';
@@ -37,8 +37,6 @@ export type { RevalidationState } from './als-registry.js';
37
37
 
38
38
  /** Options for creating the action handler. */
39
39
  export interface ActionHandlerConfig {
40
- /** Cache handler for tag invalidation. */
41
- cacheHandler?: CacheHandler;
42
40
  /** Renderer for producing RSC payloads during revalidation. */
43
41
  renderer?: RevalidateRenderer;
44
42
  }
@@ -112,8 +110,8 @@ export function revalidatePath(path: string): void {
112
110
  }
113
111
 
114
112
  /**
115
- * Invalidate all pre-rendered shells and 'use cache' entries tagged with `tag`.
116
- * Does not return a payload — the next request for an invalidated route re-renders fresh.
113
+ * Invalidate all timber.cache entries tagged with `tag`.
114
+ * Does not return a payload — the next request for an invalidated entry re-executes.
117
115
  *
118
116
  * @param tag - The cache tag to invalidate (e.g. 'products', 'user:123').
119
117
  */
@@ -172,9 +170,12 @@ export async function executeAction(
172
170
  }
173
171
  });
174
172
 
175
- // Process tag invalidation
176
- if (state.tags.length > 0 && config.cacheHandler) {
177
- await Promise.all(state.tags.map((tag) => config.cacheHandler!.invalidate({ tag })));
173
+ // Process tag invalidation via the module-level cache handler singleton.
174
+ // setCacheHandler() is called at boot from rsc-entry when timber.config.ts
175
+ // provides a cacheHandler; otherwise falls back to in-memory LRU (TIM-599).
176
+ if (state.tags.length > 0) {
177
+ const handler = getCacheHandler();
178
+ await Promise.all(state.tags.map((tag) => handler.invalidate({ tag })));
178
179
  }
179
180
 
180
181
  // Process path revalidation — build element tree (not yet serialized)
@@ -21,9 +21,10 @@
21
21
  */
22
22
 
23
23
  import { AsyncLocalStorage } from 'node:async_hooks';
24
+ import type { DebugComponentEntry } from './rsc-entry/helpers.js';
24
25
 
25
26
  // ─── Request Context ──────────────────────────────────────────────────────
26
- // Used by: request-context.ts (headers(), cookies(), searchParams())
27
+ // Used by: request-context.ts (getHeaders(), getCookies(), getSearchParams())
27
28
  // Design doc: design/04-authorization.md
28
29
 
29
30
  /** @internal — import via request-context.ts public API */
@@ -39,17 +40,44 @@ export interface RequestContextStore {
39
40
  /** Original (pre-overlay) frozen headers, kept for overlay merging. */
40
41
  originalHeaders: Headers;
41
42
  /**
42
- * Promise resolving to the route's typed search params (when search-params.ts
43
- * exists) or to the raw URLSearchParams. Stored as a Promise so the framework
44
- * can later support partial pre-rendering where param resolution is deferred.
43
+ * Promise resolving to the raw URLSearchParams for the current request.
44
+ * To get typed parsed params, import a search params definition and
45
+ * call `.parse(searchParams())`.
45
46
  */
46
- searchParamsPromise: Promise<URLSearchParams | Record<string, unknown>>;
47
+ searchParamsPromise: Promise<URLSearchParams>;
48
+ /**
49
+ * Raw search string from the request URL (e.g. "?foo=bar&baz=1").
50
+ * Available synchronously for use in `redirect()` with `preserveSearchParams`.
51
+ */
52
+ searchString: string;
53
+ /**
54
+ * Promise resolving to the coerced segment params for the current request.
55
+ * Set by the pipeline after route matching and param coercion, before
56
+ * middleware and rendering. Pages and layouts read params via
57
+ * `getSegmentParams()` instead of receiving them as a prop.
58
+ *
59
+ * See design/07-routing.md §"params.ts — Convention File for Typed Params"
60
+ */
61
+ segmentParamsPromise?: Promise<Record<string, string | string[]>>;
47
62
  /** Outgoing Set-Cookie entries (name → serialized value + options). Last write wins. */
48
63
  cookieJar: Map<string, CookieEntry>;
49
64
  /** Whether the response has flushed (headers committed). */
50
65
  flushed: boolean;
51
66
  /** Whether the current context allows cookie mutation. */
52
67
  mutableContext: boolean;
68
+ /**
69
+ * Set by AccessGate or PageDenyBoundary when a DenySignal is caught
70
+ * server-side (inside the React tree, before React Flight sees it).
71
+ * The pipeline reads this after render to set the HTTP status code.
72
+ * See TIM-666.
73
+ */
74
+ denyStatus?: number;
75
+ /**
76
+ * Dev-only: getter for the current request's RSC debug components.
77
+ * Set by renderRoute() so onPipelineError can include component tree
78
+ * context for render-phase errors without module-level shared state.
79
+ */
80
+ debugComponentsGetter?: () => DebugComponentEntry[];
53
81
  }
54
82
 
55
83
  /** A single outgoing cookie entry in the cookie jar. */
@@ -60,7 +88,7 @@ export interface CookieEntry {
60
88
  }
61
89
 
62
90
  // ─── Tracing ──────────────────────────────────────────────────────────────
63
- // Used by: tracing.ts (traceId(), spanId())
91
+ // Used by: tracing.ts (getTraceId(), getSpanId())
64
92
  // Design doc: design/17-logging.md
65
93
 
66
94
  export interface TraceStore {
@@ -85,6 +85,12 @@ export function collectRouteCss(segments: SegmentWithFiles[], manifest: BuildMan
85
85
  * via injectHead() before </head>.
86
86
  */
87
87
  export function buildCssLinkTags(cssUrls: string[]): string {
88
+ // Emit <link rel="stylesheet"> tags as a fallback for platforms where
89
+ // React's Float system (via @vitejs/plugin-rsc preinit with
90
+ // data-precedence) doesn't handle CSS injection. In practice, Float
91
+ // deduplicates and these may be dropped. No preload hints — Float
92
+ // already starts the fetch via preinit(), and redundant preloads
93
+ // cause "ignored due to unknown as/type" browser warnings.
88
94
  return cssUrls.map((url) => `<link rel="stylesheet" href="${url}">`).join('');
89
95
  }
90
96
 
@@ -95,10 +101,10 @@ export function buildCssLinkTags(cssUrls: string[]): string {
95
101
  * into 103 Early Hints responses. This avoids platform-specific 103
96
102
  * sending code.
97
103
  *
98
- * Example output: `</assets/root.css>; rel=preload; as=style, </assets/page.css>; rel=preload; as=style`
104
+ * Example output: `</assets/root.css>; as=style; rel=preload, </assets/page.css>; as=style; rel=preload`
99
105
  */
100
106
  export function buildLinkHeaders(cssUrls: string[]): string {
101
- return cssUrls.map((url) => `<${url}>; rel=preload; as=style`).join(', ');
107
+ return cssUrls.map((url) => `<${url}>; as=style; rel=preload`).join(', ');
102
108
  }
103
109
 
104
110
  // ─── Font utilities ──────────────────────────────────────────────────────
@@ -153,10 +159,10 @@ export function buildFontPreloadTags(fonts: ManifestFontEntry[]): string {
153
159
  *
154
160
  * Cloudflare CDN converts Link headers with rel=preload into 103 Early Hints.
155
161
  *
156
- * Example: `</fonts/inter.woff2>; rel=preload; as=font; crossorigin`
162
+ * Example: `</fonts/inter.woff2>; as=font; rel=preload; crossorigin`
157
163
  */
158
164
  export function buildFontLinkHeaders(fonts: ManifestFontEntry[]): string {
159
- return fonts.map((f) => `<${f.href}>; rel=preload; as=font; crossorigin`).join(', ');
165
+ return fonts.map((f) => `<${f.href}>; as=font; rel=preload; crossorigin`).join(', ');
160
166
  }
161
167
 
162
168
  // ─── JS chunk utilities ──────────────────────────────────────────────────
@@ -160,15 +160,33 @@ export function compressResponse(request: Request, response: Response): Response
160
160
  });
161
161
  }
162
162
 
163
- // ─── Gzip (CompressionStream API) ────────────────────────────────────────
163
+ // ─── Gzip (node:zlib with Z_SYNC_FLUSH) ──────────────────────────────────
164
+ //
165
+ // Uses node:zlib's createGzip with Z_SYNC_FLUSH so each chunk is flushed
166
+ // to the output immediately. The Web Platform CompressionStream API buffers
167
+ // internally and does NOT flush per-chunk — this kills streaming because
168
+ // the browser doesn't receive the HTML shell until the gzip stream closes
169
+ // (i.e. after all Suspense boundaries resolve).
170
+ //
171
+ // Z_SYNC_FLUSH adds ~2–5% size overhead vs Z_NO_FLUSH but preserves
172
+ // correct streaming behavior: the shell renders instantly, Suspense
173
+ // fallbacks are visible immediately, and streamed content appears
174
+ // progressively.
175
+
176
+ import { createGzip, constants } from 'node:zlib';
177
+ import { Readable } from 'node:stream';
164
178
 
165
179
  /**
166
- * Compress a ReadableStream with gzip using the Web Platform CompressionStream API.
167
- * Available in Node 18+, Bun, and Deno — no npm dependency needed.
180
+ * Compress a ReadableStream with gzip, flushing each chunk immediately.
181
+ *
182
+ * Uses node:zlib's createGzip with Z_SYNC_FLUSH to ensure each HTML chunk
183
+ * (shell, Suspense resolution, RSC payload) is delivered to the browser
184
+ * as soon as it's available — preserving streaming semantics.
168
185
  */
169
186
  function compressWithGzip(body: ReadableStream<Uint8Array>): ReadableStream<Uint8Array> {
170
- const compressionStream = new CompressionStream('gzip');
171
- // Cast needed: CompressionStream's WritableStream<BufferSource> type is wider
172
- // than ReadableStream's Uint8Array, but Uint8Array is a valid BufferSource.
173
- return body.pipeThrough(compressionStream as unknown as TransformStream<Uint8Array, Uint8Array>);
187
+ const gzip = createGzip({ flush: constants.Z_SYNC_FLUSH });
188
+ const nodeInput = Readable.fromWeb(body as import('stream/web').ReadableStream);
189
+ nodeInput.pipe(gzip);
190
+
191
+ return Readable.toWeb(gzip) as ReadableStream<Uint8Array>;
174
192
  }
@@ -48,7 +48,7 @@
48
48
  *
49
49
  * This is the ONLY function that should gate client-visible dev behavior:
50
50
  * - Dev error pages with stack traces
51
- * - Detailed Server-Timing response headers
51
+ * - Server-Timing mode default (`'detailed'` in dev, `'total'` in prod)
52
52
  * - Error messages in action `INTERNAL_ERROR` payloads
53
53
  * - Pipeline error handler wiring (Vite overlay)
54
54
  *
@@ -0,0 +1,99 @@
1
+ /**
2
+ * DefaultLogger — human-readable stderr logging when no custom logger is configured.
3
+ *
4
+ * Ships as the fallback so production deployments always have error visibility,
5
+ * even without an `instrumentation.ts` logger export. Output is one line per
6
+ * event, designed for `fly logs`, `kubectl logs`, Cloudflare dashboard tails, etc.
7
+ *
8
+ * Format:
9
+ * [timber] ERROR message key=value key=value trace_id=4bf92f35
10
+ * [timber] WARN message key=value key=value trace_id=4bf92f35
11
+ * [timber] INFO message method=GET path=/dashboard status=200 durationMs=43 trace_id=4bf92f35
12
+ *
13
+ * Behavior:
14
+ * - Suppressed entirely in dev mode (dev logging handles all output)
15
+ * - `debug` suppressed unless TIMBER_DEBUG is set
16
+ * - Replaced entirely when a custom logger is set via `setLogger()`
17
+ *
18
+ * See design/17-logging.md §"DefaultLogger"
19
+ */
20
+
21
+ import { isDevMode, isDebug } from './debug.js';
22
+ import { formatSsrError } from './error-formatter.js';
23
+ import type { TimberLogger } from './logger.js';
24
+
25
+ /**
26
+ * Format data fields as `key=value` pairs for human-readable output.
27
+ * - `error` key is serialized via formatSsrError for stack trace cleanup
28
+ * - `trace_id` is truncated to 8 chars for readability (full ID in OTEL)
29
+ * - Other values are stringified inline
30
+ */
31
+ function formatDataFields(data?: Record<string, unknown>): string {
32
+ if (!data) return '';
33
+
34
+ const parts: string[] = [];
35
+ let traceId: string | undefined;
36
+
37
+ for (const [key, value] of Object.entries(data)) {
38
+ if (key === 'trace_id') {
39
+ // Defer trace_id to the end
40
+ traceId = typeof value === 'string' ? value : String(value);
41
+ continue;
42
+ }
43
+ if (key === 'error') {
44
+ // Serialize errors with formatSsrError for clean output
45
+ parts.push(`error=${formatSsrError(value)}`);
46
+ continue;
47
+ }
48
+ if (value === undefined || value === null) continue;
49
+ parts.push(`${key}=${value}`);
50
+ }
51
+
52
+ // trace_id always last, truncated to 8 chars for readability
53
+ if (traceId) {
54
+ parts.push(`trace_id=${traceId.slice(0, 8)}`);
55
+ }
56
+
57
+ return parts.length > 0 ? ' ' + parts.join(' ') : '';
58
+ }
59
+
60
+ /** Pad level string to fixed width for alignment. */
61
+ function padLevel(level: string): string {
62
+ return level.padEnd(5);
63
+ }
64
+
65
+ export function createDefaultLogger(): TimberLogger {
66
+ return {
67
+ error(msg: string, data?: Record<string, unknown>): void {
68
+ // Errors are ALWAYS logged, including dev mode. Suppressing errors
69
+ // in dev causes silent 500s with no stack trace, making route.ts
70
+ // and render errors impossible to debug. See TIM-555.
71
+ const fields = formatDataFields(data);
72
+ process.stderr.write(`[timber] ${padLevel('ERROR')} ${msg}${fields}\n`);
73
+ },
74
+
75
+ warn(msg: string, data?: Record<string, unknown>): void {
76
+ // Warnings are always logged — same rationale as errors.
77
+ const fields = formatDataFields(data);
78
+ process.stderr.write(`[timber] ${padLevel('WARN')} ${msg}${fields}\n`);
79
+ },
80
+
81
+ info(msg: string, data?: Record<string, unknown>): void {
82
+ // info is suppressed by default — per-request lines are too noisy
83
+ // without a custom logger. Enable with TIMBER_DEBUG.
84
+ if (isDevMode()) return;
85
+ if (!isDebug()) return;
86
+ const fields = formatDataFields(data);
87
+ process.stderr.write(`[timber] ${padLevel('INFO')} ${msg}${fields}\n`);
88
+ },
89
+
90
+ debug(msg: string, data?: Record<string, unknown>): void {
91
+ // debug is suppressed in dev (dev logger handles it) and in
92
+ // production unless TIMBER_DEBUG is explicitly set.
93
+ if (isDevMode()) return;
94
+ if (!isDebug()) return;
95
+ const fields = formatDataFields(data);
96
+ process.stderr.write(`[timber] ${padLevel('DEBUG')} ${msg}${fields}\n`);
97
+ },
98
+ };
99
+ }