@timber-js/app 0.2.0-alpha.6 → 0.2.0-alpha.60

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 (406) hide show
  1. package/LICENSE +8 -0
  2. package/dist/_chunks/{als-registry-B7DbZ2hS.js → als-registry-Ba7URUIn.js} +1 -1
  3. package/dist/_chunks/als-registry-Ba7URUIn.js.map +1 -0
  4. package/dist/_chunks/chunk-DYhsFzuS.js +33 -0
  5. package/dist/_chunks/{debug-gwlJkDuf.js → debug-ECi_61pb.js} +2 -2
  6. package/dist/_chunks/debug-ECi_61pb.js.map +1 -0
  7. package/dist/_chunks/define-D5STJpIr.js +121 -0
  8. package/dist/_chunks/define-D5STJpIr.js.map +1 -0
  9. package/dist/_chunks/define-TK8C1M3x.js +279 -0
  10. package/dist/_chunks/define-TK8C1M3x.js.map +1 -0
  11. package/dist/_chunks/define-cookie-DtAavax4.js +93 -0
  12. package/dist/_chunks/define-cookie-DtAavax4.js.map +1 -0
  13. package/dist/_chunks/error-boundary-DpZJBCqh.js +211 -0
  14. package/dist/_chunks/error-boundary-DpZJBCqh.js.map +1 -0
  15. package/dist/_chunks/{format-DviM89f0.js → format-cX7wzEp2.js} +2 -2
  16. package/dist/_chunks/{format-DviM89f0.js.map → format-cX7wzEp2.js.map} +1 -1
  17. package/dist/_chunks/{interception-BOoWmLUA.js → interception-Cey5DCGr.js} +129 -77
  18. package/dist/_chunks/interception-Cey5DCGr.js.map +1 -0
  19. package/dist/_chunks/{metadata-routes-Cjmvi3rQ.js → metadata-routes-BU684ls2.js} +1 -1
  20. package/dist/_chunks/{metadata-routes-Cjmvi3rQ.js.map → metadata-routes-BU684ls2.js.map} +1 -1
  21. package/dist/_chunks/{request-context-DIkVh_jG.js → request-context-0wfZsnhh.js} +97 -69
  22. package/dist/_chunks/request-context-0wfZsnhh.js.map +1 -0
  23. package/dist/_chunks/segment-context-CyaM1mrD.js +72 -0
  24. package/dist/_chunks/segment-context-CyaM1mrD.js.map +1 -0
  25. package/dist/_chunks/stale-reload-DKN3aXxR.js +61 -0
  26. package/dist/_chunks/stale-reload-DKN3aXxR.js.map +1 -0
  27. package/dist/_chunks/{tracing-Cwn7697K.js → tracing-VYETCQsg.js} +17 -3
  28. package/dist/_chunks/{tracing-Cwn7697K.js.map → tracing-VYETCQsg.js.map} +1 -1
  29. package/dist/_chunks/{use-query-states-D5KaffOK.js → use-query-states-wEXY2JQB.js} +1 -1
  30. package/dist/_chunks/use-query-states-wEXY2JQB.js.map +1 -0
  31. package/dist/_chunks/wrappers-BaG1bnM3.js +63 -0
  32. package/dist/_chunks/wrappers-BaG1bnM3.js.map +1 -0
  33. package/dist/adapters/compress-module.d.ts.map +1 -1
  34. package/dist/adapters/nitro.d.ts +17 -1
  35. package/dist/adapters/nitro.d.ts.map +1 -1
  36. package/dist/adapters/nitro.js +56 -13
  37. package/dist/adapters/nitro.js.map +1 -1
  38. package/dist/cache/fast-hash.d.ts +22 -0
  39. package/dist/cache/fast-hash.d.ts.map +1 -0
  40. package/dist/cache/index.d.ts +5 -2
  41. package/dist/cache/index.d.ts.map +1 -1
  42. package/dist/cache/index.js +90 -20
  43. package/dist/cache/index.js.map +1 -1
  44. package/dist/cache/register-cached-function.d.ts.map +1 -1
  45. package/dist/cache/singleflight.d.ts +18 -1
  46. package/dist/cache/singleflight.d.ts.map +1 -1
  47. package/dist/cache/timber-cache.d.ts +1 -1
  48. package/dist/cache/timber-cache.d.ts.map +1 -1
  49. package/dist/client/error-boundary.d.ts +10 -1
  50. package/dist/client/error-boundary.d.ts.map +1 -1
  51. package/dist/client/error-boundary.js +1 -125
  52. package/dist/client/error-reconstituter.d.ts +54 -0
  53. package/dist/client/error-reconstituter.d.ts.map +1 -0
  54. package/dist/client/form.d.ts +2 -2
  55. package/dist/client/form.d.ts.map +1 -1
  56. package/dist/client/index.d.ts +3 -2
  57. package/dist/client/index.d.ts.map +1 -1
  58. package/dist/client/index.js +433 -252
  59. package/dist/client/index.js.map +1 -1
  60. package/dist/client/link-pending-store.d.ts +78 -0
  61. package/dist/client/link-pending-store.d.ts.map +1 -0
  62. package/dist/client/link.d.ts +23 -9
  63. package/dist/client/link.d.ts.map +1 -1
  64. package/dist/client/navigation-context.d.ts +2 -2
  65. package/dist/client/navigation-context.d.ts.map +1 -1
  66. package/dist/client/router.d.ts +25 -3
  67. package/dist/client/router.d.ts.map +1 -1
  68. package/dist/client/rsc-fetch.d.ts +36 -2
  69. package/dist/client/rsc-fetch.d.ts.map +1 -1
  70. package/dist/client/segment-cache.d.ts +1 -1
  71. package/dist/client/segment-cache.d.ts.map +1 -1
  72. package/dist/client/segment-context.d.ts +1 -1
  73. package/dist/client/segment-context.d.ts.map +1 -1
  74. package/dist/client/segment-merger.d.ts.map +1 -1
  75. package/dist/client/segment-outlet.d.ts +63 -0
  76. package/dist/client/segment-outlet.d.ts.map +1 -0
  77. package/dist/client/stale-reload.d.ts +15 -0
  78. package/dist/client/stale-reload.d.ts.map +1 -1
  79. package/dist/client/top-loader.d.ts +1 -1
  80. package/dist/client/top-loader.d.ts.map +1 -1
  81. package/dist/client/transition-root.d.ts +1 -1
  82. package/dist/client/transition-root.d.ts.map +1 -1
  83. package/dist/client/use-params.d.ts +3 -3
  84. package/dist/client/use-params.d.ts.map +1 -1
  85. package/dist/client/use-query-states.d.ts +1 -1
  86. package/dist/client/use-query-states.d.ts.map +1 -1
  87. package/dist/codec.d.ts +21 -0
  88. package/dist/codec.d.ts.map +1 -0
  89. package/dist/cookies/define-cookie.d.ts +34 -13
  90. package/dist/cookies/define-cookie.d.ts.map +1 -1
  91. package/dist/cookies/index.js +1 -83
  92. package/dist/fonts/css.d.ts +1 -0
  93. package/dist/fonts/css.d.ts.map +1 -1
  94. package/dist/index.d.ts +127 -35
  95. package/dist/index.d.ts.map +1 -1
  96. package/dist/index.js +663 -242
  97. package/dist/index.js.map +1 -1
  98. package/dist/params/define.d.ts +100 -0
  99. package/dist/params/define.d.ts.map +1 -0
  100. package/dist/params/index.d.ts +8 -0
  101. package/dist/params/index.d.ts.map +1 -0
  102. package/dist/params/index.js +4 -0
  103. package/dist/plugins/adapter-build.d.ts +1 -1
  104. package/dist/plugins/adapter-build.d.ts.map +1 -1
  105. package/dist/plugins/build-manifest.d.ts +2 -2
  106. package/dist/plugins/build-manifest.d.ts.map +1 -1
  107. package/dist/plugins/build-report.d.ts +3 -3
  108. package/dist/plugins/build-report.d.ts.map +1 -1
  109. package/dist/plugins/client-chunks.d.ts +32 -0
  110. package/dist/plugins/client-chunks.d.ts.map +1 -0
  111. package/dist/plugins/content.d.ts +1 -1
  112. package/dist/plugins/content.d.ts.map +1 -1
  113. package/dist/plugins/dev-browser-logs.d.ts +84 -0
  114. package/dist/plugins/dev-browser-logs.d.ts.map +1 -0
  115. package/dist/plugins/dev-error-overlay.d.ts +26 -1
  116. package/dist/plugins/dev-error-overlay.d.ts.map +1 -1
  117. package/dist/plugins/dev-logs.d.ts +1 -1
  118. package/dist/plugins/dev-logs.d.ts.map +1 -1
  119. package/dist/plugins/dev-server.d.ts +1 -1
  120. package/dist/plugins/dev-server.d.ts.map +1 -1
  121. package/dist/plugins/entries.d.ts +1 -1
  122. package/dist/plugins/entries.d.ts.map +1 -1
  123. package/dist/plugins/fonts.d.ts +9 -2
  124. package/dist/plugins/fonts.d.ts.map +1 -1
  125. package/dist/plugins/mdx.d.ts +1 -1
  126. package/dist/plugins/mdx.d.ts.map +1 -1
  127. package/dist/plugins/routing.d.ts +1 -1
  128. package/dist/plugins/routing.d.ts.map +1 -1
  129. package/dist/plugins/server-bundle.d.ts.map +1 -1
  130. package/dist/plugins/shims.d.ts +6 -5
  131. package/dist/plugins/shims.d.ts.map +1 -1
  132. package/dist/plugins/static-build.d.ts +1 -1
  133. package/dist/plugins/static-build.d.ts.map +1 -1
  134. package/dist/routing/codegen.d.ts +2 -2
  135. package/dist/routing/codegen.d.ts.map +1 -1
  136. package/dist/routing/index.js +1 -1
  137. package/dist/routing/scanner.d.ts.map +1 -1
  138. package/dist/routing/status-file-lint.d.ts +2 -1
  139. package/dist/routing/status-file-lint.d.ts.map +1 -1
  140. package/dist/routing/types.d.ts +16 -4
  141. package/dist/routing/types.d.ts.map +1 -1
  142. package/dist/rsc-runtime/rsc.d.ts +1 -1
  143. package/dist/rsc-runtime/rsc.d.ts.map +1 -1
  144. package/dist/rsc-runtime/ssr.d.ts +12 -0
  145. package/dist/rsc-runtime/ssr.d.ts.map +1 -1
  146. package/dist/search-params/codecs.d.ts +1 -1
  147. package/dist/search-params/define.d.ts +159 -0
  148. package/dist/search-params/define.d.ts.map +1 -0
  149. package/dist/search-params/index.d.ts +4 -5
  150. package/dist/search-params/index.d.ts.map +1 -1
  151. package/dist/search-params/index.js +4 -474
  152. package/dist/search-params/registry.d.ts +1 -1
  153. package/dist/search-params/wrappers.d.ts +53 -0
  154. package/dist/search-params/wrappers.d.ts.map +1 -0
  155. package/dist/server/access-gate.d.ts +4 -0
  156. package/dist/server/access-gate.d.ts.map +1 -1
  157. package/dist/server/action-client.d.ts.map +1 -1
  158. package/dist/server/action-encryption.d.ts +76 -0
  159. package/dist/server/action-encryption.d.ts.map +1 -0
  160. package/dist/server/action-handler.d.ts.map +1 -1
  161. package/dist/server/actions.d.ts +1 -1
  162. package/dist/server/actions.d.ts.map +1 -1
  163. package/dist/server/als-registry.d.ts +25 -4
  164. package/dist/server/als-registry.d.ts.map +1 -1
  165. package/dist/server/build-manifest.d.ts +2 -2
  166. package/dist/server/build-manifest.d.ts.map +1 -1
  167. package/dist/server/debug.d.ts +1 -1
  168. package/dist/server/default-logger.d.ts +22 -0
  169. package/dist/server/default-logger.d.ts.map +1 -0
  170. package/dist/server/deny-renderer.d.ts.map +1 -1
  171. package/dist/server/early-hints.d.ts +13 -5
  172. package/dist/server/early-hints.d.ts.map +1 -1
  173. package/dist/server/error-boundary-wrapper.d.ts +4 -0
  174. package/dist/server/error-boundary-wrapper.d.ts.map +1 -1
  175. package/dist/server/fallback-error.d.ts +4 -3
  176. package/dist/server/fallback-error.d.ts.map +1 -1
  177. package/dist/server/flight-injection-state.d.ts +66 -0
  178. package/dist/server/flight-injection-state.d.ts.map +1 -0
  179. package/dist/server/flight-scripts.d.ts +42 -0
  180. package/dist/server/flight-scripts.d.ts.map +1 -0
  181. package/dist/server/flush.d.ts.map +1 -1
  182. package/dist/server/form-data.d.ts +29 -0
  183. package/dist/server/form-data.d.ts.map +1 -1
  184. package/dist/server/html-injectors.d.ts +51 -11
  185. package/dist/server/html-injectors.d.ts.map +1 -1
  186. package/dist/server/index.d.ts +4 -2
  187. package/dist/server/index.d.ts.map +1 -1
  188. package/dist/server/index.js +1975 -1648
  189. package/dist/server/index.js.map +1 -1
  190. package/dist/server/logger.d.ts +25 -7
  191. package/dist/server/logger.d.ts.map +1 -1
  192. package/dist/server/node-stream-transforms.d.ts +113 -0
  193. package/dist/server/node-stream-transforms.d.ts.map +1 -0
  194. package/dist/server/pipeline-interception.d.ts +1 -1
  195. package/dist/server/pipeline-interception.d.ts.map +1 -1
  196. package/dist/server/pipeline.d.ts +20 -6
  197. package/dist/server/pipeline.d.ts.map +1 -1
  198. package/dist/server/primitives.d.ts +30 -3
  199. package/dist/server/primitives.d.ts.map +1 -1
  200. package/dist/server/render-timeout.d.ts +51 -0
  201. package/dist/server/render-timeout.d.ts.map +1 -0
  202. package/dist/server/request-context.d.ts +65 -38
  203. package/dist/server/request-context.d.ts.map +1 -1
  204. package/dist/server/route-element-builder.d.ts +7 -0
  205. package/dist/server/route-element-builder.d.ts.map +1 -1
  206. package/dist/server/route-handler.d.ts.map +1 -1
  207. package/dist/server/route-matcher.d.ts +9 -2
  208. package/dist/server/route-matcher.d.ts.map +1 -1
  209. package/dist/server/rsc-entry/api-handler.d.ts +2 -2
  210. package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
  211. package/dist/server/rsc-entry/error-renderer.d.ts +26 -13
  212. package/dist/server/rsc-entry/error-renderer.d.ts.map +1 -1
  213. package/dist/server/rsc-entry/helpers.d.ts +48 -5
  214. package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
  215. package/dist/server/rsc-entry/index.d.ts +8 -3
  216. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  217. package/dist/server/rsc-entry/rsc-payload.d.ts +3 -3
  218. package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
  219. package/dist/server/rsc-entry/rsc-stream.d.ts +10 -1
  220. package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
  221. package/dist/server/rsc-entry/ssr-bridge.d.ts +1 -1
  222. package/dist/server/rsc-entry/ssr-bridge.d.ts.map +1 -1
  223. package/dist/server/rsc-entry/ssr-renderer.d.ts +19 -4
  224. package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
  225. package/dist/server/slot-resolver.d.ts +1 -1
  226. package/dist/server/slot-resolver.d.ts.map +1 -1
  227. package/dist/server/ssr-entry.d.ts +22 -0
  228. package/dist/server/ssr-entry.d.ts.map +1 -1
  229. package/dist/server/ssr-render.d.ts +39 -21
  230. package/dist/server/ssr-render.d.ts.map +1 -1
  231. package/dist/server/ssr-wrappers.d.ts +50 -0
  232. package/dist/server/ssr-wrappers.d.ts.map +1 -0
  233. package/dist/server/status-code-resolver.d.ts +1 -1
  234. package/dist/server/status-code-resolver.d.ts.map +1 -1
  235. package/dist/server/stream-utils.d.ts +36 -0
  236. package/dist/server/stream-utils.d.ts.map +1 -0
  237. package/dist/server/tracing.d.ts +10 -0
  238. package/dist/server/tracing.d.ts.map +1 -1
  239. package/dist/server/tree-builder.d.ts +20 -13
  240. package/dist/server/tree-builder.d.ts.map +1 -1
  241. package/dist/server/types.d.ts +1 -3
  242. package/dist/server/types.d.ts.map +1 -1
  243. package/dist/server/version-skew.d.ts +61 -0
  244. package/dist/server/version-skew.d.ts.map +1 -0
  245. package/dist/server/waituntil-bridge.d.ts.map +1 -1
  246. package/dist/shared/merge-search-params.d.ts +22 -0
  247. package/dist/shared/merge-search-params.d.ts.map +1 -0
  248. package/dist/shims/font-google.d.ts +1 -1
  249. package/dist/shims/font-google.d.ts.map +1 -1
  250. package/dist/shims/navigation-client.d.ts +1 -1
  251. package/dist/shims/navigation-client.d.ts.map +1 -1
  252. package/dist/shims/navigation.d.ts +1 -1
  253. package/dist/shims/navigation.d.ts.map +1 -1
  254. package/dist/utils/state-machine.d.ts +80 -0
  255. package/dist/utils/state-machine.d.ts.map +1 -0
  256. package/package.json +17 -17
  257. package/src/adapters/compress-module.ts +24 -4
  258. package/src/adapters/nitro.ts +58 -9
  259. package/src/cache/fast-hash.ts +34 -0
  260. package/src/cache/index.ts +5 -2
  261. package/src/cache/register-cached-function.ts +7 -3
  262. package/src/cache/singleflight.ts +62 -4
  263. package/src/cache/timber-cache.ts +40 -29
  264. package/src/cli.ts +0 -0
  265. package/src/client/browser-entry.ts +139 -99
  266. package/src/client/error-boundary.tsx +18 -1
  267. package/src/client/error-reconstituter.tsx +65 -0
  268. package/src/client/form.tsx +2 -2
  269. package/src/client/index.ts +10 -1
  270. package/src/client/link-pending-store.ts +136 -0
  271. package/src/client/link.tsx +137 -22
  272. package/src/client/navigation-context.ts +6 -5
  273. package/src/client/router.ts +117 -60
  274. package/src/client/rsc-fetch.ts +88 -2
  275. package/src/client/segment-cache.ts +1 -1
  276. package/src/client/segment-context.ts +6 -1
  277. package/src/client/segment-merger.ts +2 -8
  278. package/src/client/segment-outlet.tsx +86 -0
  279. package/src/client/stale-reload.ts +56 -6
  280. package/src/client/top-loader.tsx +10 -9
  281. package/src/client/transition-root.tsx +20 -2
  282. package/src/client/use-params.ts +4 -4
  283. package/src/client/use-query-states.ts +2 -2
  284. package/src/codec.ts +21 -0
  285. package/src/cookies/define-cookie.ts +71 -20
  286. package/src/fonts/css.ts +2 -1
  287. package/src/index.ts +297 -85
  288. package/src/params/define.ts +320 -0
  289. package/src/params/index.ts +28 -0
  290. package/src/plugins/adapter-build.ts +8 -2
  291. package/src/plugins/build-manifest.ts +13 -2
  292. package/src/plugins/build-report.ts +3 -3
  293. package/src/plugins/cache-transform.ts +1 -1
  294. package/src/plugins/client-chunks.ts +65 -0
  295. package/src/plugins/content.ts +1 -1
  296. package/src/plugins/dev-browser-logs.ts +274 -0
  297. package/src/plugins/dev-error-overlay.ts +70 -1
  298. package/src/plugins/dev-logs.ts +1 -1
  299. package/src/plugins/dev-server.ts +41 -7
  300. package/src/plugins/entries.ts +6 -8
  301. package/src/plugins/fonts.ts +102 -55
  302. package/src/plugins/mdx.ts +1 -1
  303. package/src/plugins/routing.ts +57 -17
  304. package/src/plugins/server-action-exports.ts +1 -1
  305. package/src/plugins/server-bundle.ts +32 -1
  306. package/src/plugins/shims.ts +69 -31
  307. package/src/plugins/static-build.ts +10 -6
  308. package/src/routing/codegen.ts +109 -88
  309. package/src/routing/scanner.ts +86 -7
  310. package/src/routing/status-file-lint.ts +3 -2
  311. package/src/routing/types.ts +17 -4
  312. package/src/rsc-runtime/rsc.ts +2 -0
  313. package/src/rsc-runtime/ssr.ts +50 -0
  314. package/src/rsc-runtime/vendor-types.d.ts +7 -0
  315. package/src/search-params/codecs.ts +1 -1
  316. package/src/search-params/define.ts +518 -0
  317. package/src/search-params/index.ts +12 -18
  318. package/src/search-params/registry.ts +1 -1
  319. package/src/search-params/wrappers.ts +85 -0
  320. package/src/server/access-gate.tsx +40 -9
  321. package/src/server/action-client.ts +8 -2
  322. package/src/server/action-encryption.ts +144 -0
  323. package/src/server/action-handler.ts +20 -3
  324. package/src/server/actions.ts +1 -1
  325. package/src/server/als-registry.ts +25 -4
  326. package/src/server/build-manifest.ts +10 -4
  327. package/src/server/compress.ts +25 -7
  328. package/src/server/debug.ts +1 -1
  329. package/src/server/default-logger.ts +99 -0
  330. package/src/server/deny-renderer.ts +5 -3
  331. package/src/server/early-hints.ts +36 -15
  332. package/src/server/error-boundary-wrapper.ts +58 -15
  333. package/src/server/fallback-error.ts +10 -7
  334. package/src/server/flight-injection-state.ts +113 -0
  335. package/src/server/flight-scripts.ts +62 -0
  336. package/src/server/flush.ts +2 -1
  337. package/src/server/form-data.ts +76 -0
  338. package/src/server/html-injectors.ts +277 -117
  339. package/src/server/index.ts +9 -4
  340. package/src/server/logger.ts +44 -36
  341. package/src/server/node-stream-transforms.ts +509 -0
  342. package/src/server/pipeline-interception.ts +1 -1
  343. package/src/server/pipeline.ts +139 -41
  344. package/src/server/primitives.ts +47 -5
  345. package/src/server/render-timeout.ts +108 -0
  346. package/src/server/request-context.ts +125 -119
  347. package/src/server/route-element-builder.ts +107 -115
  348. package/src/server/route-handler.ts +2 -1
  349. package/src/server/route-matcher.ts +9 -2
  350. package/src/server/rsc-entry/api-handler.ts +8 -8
  351. package/src/server/rsc-entry/error-renderer.ts +277 -81
  352. package/src/server/rsc-entry/helpers.ts +134 -5
  353. package/src/server/rsc-entry/index.ts +165 -76
  354. package/src/server/rsc-entry/rsc-payload.ts +91 -18
  355. package/src/server/rsc-entry/rsc-stream.ts +74 -18
  356. package/src/server/rsc-entry/ssr-bridge.ts +2 -2
  357. package/src/server/rsc-entry/ssr-renderer.ts +141 -34
  358. package/src/server/slot-resolver.ts +231 -220
  359. package/src/server/ssr-entry.ts +211 -32
  360. package/src/server/ssr-render.ts +289 -67
  361. package/src/server/ssr-wrappers.tsx +139 -0
  362. package/src/server/status-code-resolver.ts +1 -1
  363. package/src/server/stream-utils.ts +209 -0
  364. package/src/server/tracing.ts +23 -0
  365. package/src/server/tree-builder.ts +92 -58
  366. package/src/server/types.ts +1 -3
  367. package/src/server/version-skew.ts +104 -0
  368. package/src/server/waituntil-bridge.ts +4 -1
  369. package/src/shared/merge-search-params.ts +55 -0
  370. package/src/shims/font-google.ts +1 -1
  371. package/src/shims/navigation-client.ts +1 -1
  372. package/src/shims/navigation.ts +2 -1
  373. package/src/utils/state-machine.ts +111 -0
  374. package/dist/_chunks/als-registry-B7DbZ2hS.js.map +0 -1
  375. package/dist/_chunks/debug-gwlJkDuf.js.map +0 -1
  376. package/dist/_chunks/interception-BOoWmLUA.js.map +0 -1
  377. package/dist/_chunks/request-context-DIkVh_jG.js.map +0 -1
  378. package/dist/_chunks/ssr-data-MjmprTmO.js +0 -88
  379. package/dist/_chunks/ssr-data-MjmprTmO.js.map +0 -1
  380. package/dist/_chunks/use-cookie-DX-l1_5E.js +0 -91
  381. package/dist/_chunks/use-cookie-DX-l1_5E.js.map +0 -1
  382. package/dist/_chunks/use-query-states-D5KaffOK.js.map +0 -1
  383. package/dist/client/error-boundary.js.map +0 -1
  384. package/dist/client/link-status-provider.d.ts +0 -11
  385. package/dist/client/link-status-provider.d.ts.map +0 -1
  386. package/dist/cookies/index.js.map +0 -1
  387. package/dist/plugins/dynamic-transform.d.ts +0 -72
  388. package/dist/plugins/dynamic-transform.d.ts.map +0 -1
  389. package/dist/search-params/analyze.d.ts +0 -54
  390. package/dist/search-params/analyze.d.ts.map +0 -1
  391. package/dist/search-params/builtin-codecs.d.ts +0 -105
  392. package/dist/search-params/builtin-codecs.d.ts.map +0 -1
  393. package/dist/search-params/create.d.ts +0 -106
  394. package/dist/search-params/create.d.ts.map +0 -1
  395. package/dist/search-params/index.js.map +0 -1
  396. package/dist/server/prerender.d.ts +0 -77
  397. package/dist/server/prerender.d.ts.map +0 -1
  398. package/dist/server/response-cache.d.ts +0 -53
  399. package/dist/server/response-cache.d.ts.map +0 -1
  400. package/src/client/link-status-provider.tsx +0 -30
  401. package/src/plugins/dynamic-transform.ts +0 -161
  402. package/src/search-params/analyze.ts +0 -192
  403. package/src/search-params/builtin-codecs.ts +0 -228
  404. package/src/search-params/create.ts +0 -321
  405. package/src/server/prerender.ts +0 -139
  406. package/src/server/response-cache.ts +0 -277
@@ -16,6 +16,16 @@
16
16
 
17
17
  const RELOAD_FLAG_KEY = '__timber_stale_reload';
18
18
 
19
+ /**
20
+ * In-memory fallback counter for environments where sessionStorage is
21
+ * unavailable (private browsing, storage full, extension interference).
22
+ * Incremented each time triggerStaleReload() falls into the catch path.
23
+ * If the counter exceeds 0 on a subsequent call, the reload is suppressed
24
+ * to prevent an infinite loop. Resets naturally on page load (module
25
+ * re-evaluates) and can be manually reset via clearStaleReloadFlag().
26
+ */
27
+ let memoryReloadCount = 0;
28
+
19
29
  /**
20
30
  * Check if an error is a stale client reference error from React's
21
31
  * Flight client. These errors have the message pattern:
@@ -32,6 +42,34 @@ export function isStaleClientReference(error: unknown): boolean {
32
42
  return msg.includes('Could not find the module') || msg.includes('client reference not found');
33
43
  }
34
44
 
45
+ /**
46
+ * Check if an error is a chunk load failure from a dynamic import.
47
+ *
48
+ * After a deployment, old chunk filenames no longer exist. When the client
49
+ * tries to dynamically import a chunk that's been replaced, the browser
50
+ * throws one of these errors:
51
+ *
52
+ * - Chromium: "Failed to fetch dynamically imported module: <url>"
53
+ * - Firefox: "error loading dynamically imported module: <url>"
54
+ * - Safari: "Importing a module script failed."
55
+ * - Vite/Rollup: "Unable to preload CSS for <url>"
56
+ *
57
+ * See TIM-446
58
+ */
59
+ export function isChunkLoadError(error: unknown): boolean {
60
+ if (!(error instanceof Error)) return false;
61
+ const msg = error.message.toLowerCase();
62
+ return (
63
+ msg.includes('failed to fetch dynamically imported module') ||
64
+ msg.includes('error loading dynamically imported module') ||
65
+ msg.includes('importing a module script failed') ||
66
+ msg.includes('unable to preload css') ||
67
+ // Webpack-style chunk load errors (unlikely in Vite but defensive)
68
+ msg.includes('loading chunk') ||
69
+ msg.includes('loading css chunk')
70
+ );
71
+ }
72
+
35
73
  /**
36
74
  * Trigger a full page reload to pick up new bundles.
37
75
  *
@@ -48,8 +86,8 @@ export function triggerStaleReload(): boolean {
48
86
  if (sessionStorage.getItem(RELOAD_FLAG_KEY)) {
49
87
  console.warn(
50
88
  '[timber] Stale client reference detected again after reload. ' +
51
- 'Not reloading to prevent infinite loop. ' +
52
- 'This may indicate a deployment issue — try a hard refresh.'
89
+ 'Not reloading to prevent infinite loop. ' +
90
+ 'This may indicate a deployment issue — try a hard refresh.'
53
91
  );
54
92
  return false;
55
93
  }
@@ -59,16 +97,27 @@ export function triggerStaleReload(): boolean {
59
97
 
60
98
  console.warn(
61
99
  '[timber] Stale client reference detected — the server has been ' +
62
- 'redeployed with new bundles. Reloading to pick up the new version.'
100
+ 'redeployed with new bundles. Reloading to pick up the new version.'
63
101
  );
64
102
 
65
103
  window.location.reload();
66
104
  return true;
67
105
  } catch {
68
- // sessionStorage may be unavailable (private browsing, storage full, etc.)
69
- // Fall back to reloading without loop protection
106
+ // sessionStorage unavailable (private browsing, storage full, etc.)
107
+ // Use in-memory counter as fallback loop guard
108
+ if (memoryReloadCount > 0) {
109
+ console.warn(
110
+ '[timber] Stale client reference detected again after reload. ' +
111
+ 'Not reloading to prevent infinite loop. ' +
112
+ 'This may indicate a deployment issue — try a hard refresh.'
113
+ );
114
+ return false;
115
+ }
116
+
117
+ memoryReloadCount++;
70
118
  console.warn(
71
- '[timber] Stale client reference detected. Reloading page.'
119
+ '[timber] Stale client reference detected the server has been ' +
120
+ 'redeployed with new bundles. Reloading to pick up the new version.'
72
121
  );
73
122
  window.location.reload();
74
123
  return true;
@@ -81,6 +130,7 @@ export function triggerStaleReload(): boolean {
81
130
  * reference error should trigger a fresh reload attempt.
82
131
  */
83
132
  export function clearStaleReloadFlag(): void {
133
+ memoryReloadCount = 0;
84
134
  try {
85
135
  sessionStorage.removeItem(RELOAD_FLAG_KEY);
86
136
  } catch {
@@ -39,7 +39,7 @@ export interface TopLoaderConfig {
39
39
  color?: string;
40
40
  /** Bar height in pixels. Default: 3. */
41
41
  height?: number;
42
- /** Show subtle glow/shadow effect. Default: true. */
42
+ /** Show subtle glow/shadow effect. Default: false. */
43
43
  shadow?: boolean;
44
44
  /** Delay in ms before showing the bar. Default: 0. */
45
45
  delay?: number;
@@ -51,7 +51,7 @@ export interface TopLoaderConfig {
51
51
 
52
52
  const DEFAULT_COLOR = '#2299DD';
53
53
  const DEFAULT_HEIGHT = 3;
54
- const DEFAULT_SHADOW = true;
54
+ const DEFAULT_SHADOW = false;
55
55
  const DEFAULT_DELAY = 0;
56
56
  const DEFAULT_Z_INDEX = 1600;
57
57
 
@@ -183,18 +183,19 @@ export function TopLoader({ config }: { config?: TopLoaderConfig }): React.React
183
183
  };
184
184
 
185
185
  // Clean up the finishing phase when the finish animation completes.
186
- const handleAnimationEnd = phase === 'finishing'
187
- ? (e: React.AnimationEvent) => {
188
- if (e.animationName === FINISH_KEYFRAMES) {
189
- setPhase('hidden');
186
+ const handleAnimationEnd =
187
+ phase === 'finishing'
188
+ ? (e: React.AnimationEvent) => {
189
+ if (e.animationName === FINISH_KEYFRAMES) {
190
+ setPhase('hidden');
191
+ }
190
192
  }
191
- }
192
- : undefined;
193
+ : undefined;
193
194
 
194
195
  return createElement(
195
196
  'div',
196
197
  {
197
- style: containerStyle,
198
+ 'style': containerStyle,
198
199
  'aria-hidden': 'true',
199
200
  'data-timber-top-loader': '',
200
201
  },
@@ -25,6 +25,7 @@
25
25
  import { useState, useTransition, createElement, Fragment, type ReactNode } from 'react';
26
26
  import { PendingNavigationProvider } from './navigation-context.js';
27
27
  import { TopLoader, type TopLoaderConfig } from './top-loader.js';
28
+ import { getCurrentNavId, resetLinkPending } from './link-pending-store.js';
28
29
 
29
30
  // ─── Module-level functions ──────────────────────────────────────
30
31
 
@@ -62,7 +63,13 @@ let _navigateTransition:
62
63
  * Non-navigation renders:
63
64
  * transitionRender(newWrappedElement);
64
65
  */
65
- export function TransitionRoot({ initial, topLoaderConfig }: { initial: ReactNode; topLoaderConfig?: TopLoaderConfig }): ReactNode {
66
+ export function TransitionRoot({
67
+ initial,
68
+ topLoaderConfig,
69
+ }: {
70
+ initial: ReactNode;
71
+ topLoaderConfig?: TopLoaderConfig;
72
+ }): ReactNode {
66
73
  const [element, setElement] = useState<ReactNode>(initial);
67
74
  const [pendingUrl, setPendingUrl] = useState<string | null>(null);
68
75
  const [, startTransition] = useTransition();
@@ -82,20 +89,31 @@ export function TransitionRoot({ initial, topLoaderConfig }: { initial: ReactNod
82
89
  // both apply in the same React commit — making the pending→active transition
83
90
  // atomic (no frame where pending is false but the old tree is still visible).
84
91
  _navigateTransition = (url: string, perform: () => Promise<ReactNode>) => {
85
- // Urgent: show pending state immediately
92
+ // Urgent: show pending state immediately (for TopLoader / useNavigationPending)
86
93
  setPendingUrl(url);
87
94
 
88
95
  return new Promise<void>((resolve, reject) => {
89
96
  startTransition(async () => {
97
+ // Capture the current nav ID before async work begins.
98
+ // Used to guard against stale clears when a newer navigation
99
+ // supersedes this one.
100
+ const navId = getCurrentNavId();
90
101
  try {
91
102
  const newElement = await perform();
92
103
  setElement(newElement);
93
104
  // Clear pending inside the transition — commits atomically with new tree
94
105
  setPendingUrl(null);
106
+ // Reset per-link pending state. The navId guard ensures a stale
107
+ // transition (T1) doesn't clear a newer navigation's (T2) link.
108
+ // The setter call is a transition update — batched with setElement
109
+ // and setPendingUrl, so pending clears atomically with new tree.
110
+ // See design/19-client-navigation.md §"Per-Link Pending State"
111
+ resetLinkPending(navId);
95
112
  resolve();
96
113
  } catch (err) {
97
114
  // Clear pending on error too
98
115
  setPendingUrl(null);
116
+ resetLinkPending(navId);
99
117
  reject(err);
100
118
  }
101
119
  });
@@ -30,7 +30,7 @@
30
30
  * Design doc: design/09-typescript.md §"Typed Routes"
31
31
  */
32
32
 
33
- import type { Routes } from '#/index.js';
33
+ import type { Routes } from '../index.js';
34
34
  import { getSsrData } from './ssr-data.js';
35
35
  import { currentParams, _setCurrentParams, paramsListeners } from './state.js';
36
36
  import { useNavigationContext } from './navigation-context.js';
@@ -119,9 +119,9 @@ export function notifyParamsListeners(): void {
119
119
  * exact params shape from the generated Routes interface.
120
120
  * @overload Fallback — returns the generic params record.
121
121
  */
122
- export function useParams<R extends keyof Routes>(route: R): Routes[R]['params'];
123
- export function useParams(route?: string): Record<string, string | string[]>;
124
- export function useParams(_route?: string): Record<string, string | string[]> {
122
+ export function useSegmentParams<R extends keyof Routes>(route: R): Routes[R]['params'];
123
+ export function useSegmentParams(route?: string): Record<string, string | string[]>;
124
+ export function useSegmentParams(_route?: string): Record<string, string | string[]> {
125
125
  // Try reading from NavigationContext (client-side, inside React tree).
126
126
  // During SSR, no NavigationProvider is mounted, so this returns null.
127
127
  // When called outside a React component, useContext throws — caught below.
@@ -17,8 +17,8 @@ import type {
17
17
  SearchParamsDefinition,
18
18
  SetParams,
19
19
  QueryStatesOptions,
20
- } from '#/search-params/create.js';
21
- import { getSearchParams } from '#/search-params/registry.js';
20
+ } from '../search-params/define.js';
21
+ import { getSearchParams } from '../search-params/registry.js';
22
22
 
23
23
  // ─── Codec Bridge ─────────────────────────────────────────────────
24
24
 
package/src/codec.ts ADDED
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Shared codec protocol for parsing and serializing string values.
3
+ *
4
+ * Used by both search params and cookies. Any object with parse + serialize
5
+ * methods satisfies this interface. nuqs parsers are valid codecs natively.
6
+ *
7
+ * Design doc: design/23a-search-params-triage.md §"Unify Codec<T> type"
8
+ */
9
+
10
+ /**
11
+ * A codec that converts between string values and typed values.
12
+ *
13
+ * The canonical protocol shared across search params, cookies, and
14
+ * any future timber feature that needs string ↔ typed conversion.
15
+ */
16
+ export interface Codec<T> {
17
+ /** String → typed value. Receives undefined when the value is absent. */
18
+ parse(value: string | string[] | undefined): T;
19
+ /** Typed value → string. Return null to omit/clear. */
20
+ serialize(value: T): string | null;
21
+ }
@@ -2,36 +2,42 @@
2
2
  * defineCookie — typed cookie definitions.
3
3
  *
4
4
  * Bundles name + codec + options into a reusable CookieDefinition<T>
5
- * with .get(), .set(), .delete() server methods and a .useCookie() client hook.
5
+ * with async .getCookie(), .setCookie(), .deleteCookie() server methods
6
+ * and a sync .useCookie() client hook.
7
+ *
8
+ * Server methods are async to future-proof the API for v2 features
9
+ * (signed cookies via crypto.subtle, encrypted cookies, external stores).
6
10
  *
7
11
  * Reuses the SearchParamCodec protocol via fromSchema() bridge.
8
12
  * Validation on read returns the codec default (never throws).
9
13
  *
14
+ * IMPORTANT: This module must NOT have top-level value imports from either
15
+ * server or client modules. Server methods lazy-import request-context;
16
+ * useCookie() lazy-imports use-cookie. This ensures:
17
+ * - Client bundles don't pull in ALS/server code
18
+ * - RSC bundles don't pull in useSyncExternalStore/client code
19
+ * - Tree-shaking is not required for correctness
20
+ *
10
21
  * See design/29-cookies.md §"Typed Cookies with Schema Validation"
11
22
  */
12
23
 
13
- import { cookies } from '#/server/request-context.js';
14
- import type { CookieOptions } from '#/server/request-context.js';
15
- import { useCookie as useRawCookie } from '#/client/use-cookie.js';
16
- import type { ClientCookieOptions } from '#/client/use-cookie.js';
24
+ import type { CookieOptions } from '../server/request-context.js';
25
+ import type { ClientCookieOptions } from '../client/use-cookie.js';
17
26
 
18
27
  // ─── Types ────────────────────────────────────────────────────────────────
19
28
 
29
+ import type { Codec } from '../codec.js';
30
+
20
31
  /**
21
32
  * A codec that converts between string cookie values and typed values.
22
- * Intentionally identical to SearchParamCodec<T>.
33
+ * Type alias for the shared Codec<T> protocol.
23
34
  */
24
- export interface CookieCodec<T> {
25
- parse(value: string | string[] | undefined): T;
26
- serialize(value: T): string | null;
27
- }
35
+ export type CookieCodec<T> = Codec<T>;
28
36
 
29
37
  /** Options for defineCookie: codec + CookieOptions merged. */
30
- export interface DefineCookieOptions<T> extends Omit<CookieOptions, 'signed'> {
38
+ export interface DefineCookieOptions<T> extends CookieOptions {
31
39
  /** Codec for parsing/serializing the cookie value. */
32
40
  codec: CookieCodec<T>;
33
- /** Sign the cookie with HMAC-SHA256. */
34
- signed?: boolean;
35
41
  }
36
42
 
37
43
  /** A fully typed cookie definition with server and client methods. */
@@ -44,16 +50,49 @@ export interface CookieDefinition<T> {
44
50
  readonly codec: CookieCodec<T>;
45
51
 
46
52
  /** Server: read the typed value from the current request. */
47
- get(): T;
53
+ getCookie(): Promise<T>;
48
54
  /** Server: set the typed value on the response. */
49
- set(value: T): void;
55
+ setCookie(value: T): Promise<void>;
50
56
  /** Server: delete the cookie. */
51
- delete(): void;
57
+ deleteCookie(): Promise<void>;
52
58
 
53
59
  /** Client: React hook for reading/writing this cookie. Returns [value, setter, deleter]. */
54
60
  useCookie(): [T, (value: T) => void, () => void];
55
61
  }
56
62
 
63
+ // ─── Lazy Module References ───────────────────────────────────────────────
64
+ //
65
+ // These are resolved on first use, not at module load time. This prevents
66
+ // the server module graph from pulling in client code and vice versa.
67
+ // The dynamic import() in server methods is natural (they're async).
68
+ // For useCookie() (sync), we cache the module reference after first load.
69
+
70
+ let _useCookieModule: typeof import('../client/use-cookie.js') | undefined;
71
+
72
+ function getUseCookieModule(): typeof import('../client/use-cookie.js') {
73
+ if (!_useCookieModule) {
74
+ // In the client/SSR environment, this module is already in the module
75
+ // graph (imported by the client entry). The throw is a safeguard —
76
+ // if useCookie() is somehow called before the module is available,
77
+ // the developer gets a clear error instead of a silent failure.
78
+ throw new Error(
79
+ '[timber] defineCookie().useCookie() requires @timber-js/app/client to be loaded. ' +
80
+ 'This hook can only be used in client components.'
81
+ );
82
+ }
83
+ return _useCookieModule;
84
+ }
85
+
86
+ /**
87
+ * Register the client cookie module. Called by the client entry to wire
88
+ * up the lazy reference without a top-level import.
89
+ *
90
+ * @internal — framework use only
91
+ */
92
+ export function _registerUseCookieModule(mod: typeof import('../client/use-cookie.js')): void {
93
+ _useCookieModule = mod;
94
+ }
95
+
57
96
  // ─── Factory ──────────────────────────────────────────────────────────────
58
97
 
59
98
  /**
@@ -69,6 +108,13 @@ export interface CookieDefinition<T> {
69
108
  * httpOnly: false,
70
109
  * maxAge: 60 * 60 * 24 * 365,
71
110
  * });
111
+ *
112
+ * // Server
113
+ * const theme = await themeCookie.getCookie();
114
+ * await themeCookie.setCookie('dark');
115
+ *
116
+ * // Client
117
+ * const [theme, setTheme] = themeCookie.useCookie();
72
118
  * ```
73
119
  */
74
120
  export function defineCookie<T>(
@@ -83,13 +129,15 @@ export function defineCookie<T>(
83
129
  options: resolvedOptions,
84
130
  codec,
85
131
 
86
- get(): T {
132
+ async getCookie(): Promise<T> {
133
+ const { cookies } = await import('../server/request-context.js');
87
134
  const jar = cookies();
88
- const raw = resolvedOptions.signed ? jar.getSigned(name) : jar.get(name);
135
+ const raw = jar.get(name);
89
136
  return codec.parse(raw);
90
137
  },
91
138
 
92
- set(value: T): void {
139
+ async setCookie(value: T): Promise<void> {
140
+ const { cookies } = await import('../server/request-context.js');
93
141
  const serialized = codec.serialize(value);
94
142
  if (serialized === null) {
95
143
  cookies().delete(name, {
@@ -101,7 +149,8 @@ export function defineCookie<T>(
101
149
  }
102
150
  },
103
151
 
104
- delete(): void {
152
+ async deleteCookie(): Promise<void> {
153
+ const { cookies } = await import('../server/request-context.js');
105
154
  cookies().delete(name, {
106
155
  path: resolvedOptions.path,
107
156
  domain: resolvedOptions.domain,
@@ -109,6 +158,8 @@ export function defineCookie<T>(
109
158
  },
110
159
 
111
160
  useCookie(): [T, (value: T) => void, () => void] {
161
+ const { useCookie: useRawCookie } = getUseCookieModule();
162
+
112
163
  // Extract client-safe options (no httpOnly — client cookies can't be httpOnly)
113
164
  const clientOpts: ClientCookieOptions = {
114
165
  path: resolvedOptions.path,
package/src/fonts/css.ts CHANGED
@@ -39,6 +39,7 @@ export function generateFontFaces(descriptors: FontFaceDescriptor[]): string {
39
39
  * ```css
40
40
  * .timber-font-inter {
41
41
  * --font-sans: 'Inter', 'Inter Fallback', system-ui, sans-serif;
42
+ * font-family: 'Inter', 'Inter Fallback', system-ui, sans-serif;
42
43
  * }
43
44
  * ```
44
45
  */
@@ -47,7 +48,7 @@ export function generateVariableClass(
47
48
  variable: string,
48
49
  fontFamily: string
49
50
  ): string {
50
- return `.${className} {\n ${variable}: ${fontFamily};\n}`;
51
+ return `.${className} {\n ${variable}: ${fontFamily};\n font-family: ${fontFamily};\n}`;
51
52
  }
52
53
 
53
54
  /**