@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
@@ -1,6 +1,7 @@
1
- import { a as isDynamicMetadataExtension, n as classifyMetadataRoute } from "./metadata-routes-Cjmvi3rQ.js";
2
- import { existsSync, readdirSync, statSync } from "node:fs";
1
+ import { t as classifyUrlSegment } from "./segment-classify-BDNn6EzD.js";
2
+ import { a as isDynamicMetadataExtension, n as classifyMetadataRoute } from "./metadata-routes-DS3eKNmf.js";
3
3
  import { basename, extname, join, posix, relative } from "node:path";
4
+ import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
4
5
  //#region src/routing/types.ts
5
6
  /** All recognized interception markers, ordered longest-first for parsing. */
6
7
  var INTERCEPTION_MARKERS = [
@@ -65,8 +66,7 @@ var FIXED_CONVENTIONS = new Set([
65
66
  "middleware",
66
67
  "access",
67
68
  "route",
68
- "prerender",
69
- "search-params"
69
+ "params"
70
70
  ]);
71
71
  /**
72
72
  * Status-code file patterns:
@@ -87,9 +87,12 @@ function scanRoutes(appDir, config = {}) {
87
87
  const tree = { root: createSegmentNode("", "static", "/") };
88
88
  const proxyFile = findFixedFile(appDir, "proxy");
89
89
  if (proxyFile) tree.proxy = proxyFile;
90
+ const globalErrorFile = findPageExtFile(appDir, "global-error", extSet);
91
+ if (globalErrorFile) tree.globalError = globalErrorFile;
90
92
  scanSegmentFiles(appDir, tree.root, extSet);
91
93
  scanChildren(appDir, tree.root, extSet);
92
94
  validateRouteGroupCollisions(tree.root);
95
+ validateDuplicateParamNames(tree.root);
93
96
  return tree;
94
97
  }
95
98
  /**
@@ -120,17 +123,10 @@ function classifySegment(dirName) {
120
123
  interceptedSegmentName: interception.segmentName
121
124
  };
122
125
  if (dirName.startsWith("(") && dirName.endsWith(")")) return { type: "group" };
123
- if (dirName.startsWith("[[...") && dirName.endsWith("]]")) return {
124
- type: "optional-catch-all",
125
- paramName: dirName.slice(5, -2)
126
- };
127
- if (dirName.startsWith("[...") && dirName.endsWith("]")) return {
128
- type: "catch-all",
129
- paramName: dirName.slice(4, -1)
130
- };
131
- if (dirName.startsWith("[") && dirName.endsWith("]")) return {
132
- type: "dynamic",
133
- paramName: dirName.slice(1, -1)
126
+ const urlSeg = classifyUrlSegment(dirName);
127
+ if (urlSeg.kind !== "static") return {
128
+ type: urlSeg.kind,
129
+ paramName: urlSeg.name
134
130
  };
135
131
  return { type: "static" };
136
132
  }
@@ -224,11 +220,8 @@ function scanSegmentFiles(dirPath, node, extSet) {
224
220
  case "route":
225
221
  node.route = file;
226
222
  break;
227
- case "prerender":
228
- node.prerender = file;
229
- break;
230
- case "search-params":
231
- node.searchParams = file;
223
+ case "params":
224
+ node.params = file;
232
225
  break;
233
226
  }
234
227
  continue;
@@ -338,6 +331,34 @@ function collectRoutableLeaves(node, seen, segmentPath, insideSlot) {
338
331
  for (const [, slotNode] of node.slots) collectRoutableLeaves(slotNode, seen, currentPath, true);
339
332
  }
340
333
  /**
334
+ * Validate that no route chain contains duplicate dynamic param names.
335
+ *
336
+ * Example violation:
337
+ * app/[id]/items/[id]/page.tsx — 'id' appears twice in the ancestor chain.
338
+ *
339
+ * Route groups are transparent — params accumulate through them.
340
+ * Slots are independent — duplicate detection does NOT cross slot boundaries.
341
+ *
342
+ * See design/07-routing.md §"Duplicate Param Name Detection"
343
+ */
344
+ function validateDuplicateParamNames(root) {
345
+ walkForDuplicateParams(root, /* @__PURE__ */ new Map());
346
+ }
347
+ /**
348
+ * Recursively walk the segment tree, tracking seen param names → segment paths.
349
+ * Throws on the first duplicate found.
350
+ */
351
+ function walkForDuplicateParams(node, seen) {
352
+ if (node.paramName) {
353
+ const existing = seen.get(node.paramName);
354
+ if (existing) throw new Error(`[timber] Duplicate param name '${node.paramName}' in route chain.\n First defined at: ${existing}\n Duplicate at: ${node.urlPath || "/"}\n Rename one of the segments to avoid ambiguity.`);
355
+ seen = new Map(seen);
356
+ seen.set(node.paramName, node.urlPath || "/");
357
+ }
358
+ for (const child of node.children) walkForDuplicateParams(child, seen);
359
+ for (const [, slotNode] of node.slots) walkForDuplicateParams(slotNode, new Map(seen));
360
+ }
361
+ /**
341
362
  * Find a fixed-extension file (proxy.ts) in a directory.
342
363
  */
343
364
  function findFixedFile(dirPath, name) {
@@ -351,6 +372,204 @@ function findFixedFile(dirPath, name) {
351
372
  } catch {}
352
373
  }
353
374
  }
375
+ /**
376
+ * Find a file using the configured page extensions (tsx, ts, jsx, js, mdx, etc.).
377
+ * Used for app-root conventions like global-error that aren't per-segment.
378
+ */
379
+ function findPageExtFile(dirPath, name, extSet) {
380
+ for (const ext of extSet) {
381
+ const fullPath = join(dirPath, `${name}.${ext}`);
382
+ try {
383
+ if (statSync(fullPath).isFile()) return {
384
+ filePath: fullPath,
385
+ extension: ext
386
+ };
387
+ } catch {}
388
+ }
389
+ }
390
+ //#endregion
391
+ //#region src/routing/codegen-shared.ts
392
+ /**
393
+ * Shared codegen helpers — import-path computation, codec chain type
394
+ * builder, and searchParams type formatter.
395
+ *
396
+ * Extracted from `codegen.ts` so `link-codegen.ts` can use the same
397
+ * helpers without a cyclic import.
398
+ */
399
+ /**
400
+ * Compute a relative import specifier for a codec/page file, stripping
401
+ * the .ts/.tsx extension and resolving against the codegen output dir.
402
+ */
403
+ function codecImportPath(codecFilePath, importBase) {
404
+ const absPath = codecFilePath.replace(/\.(ts|tsx)$/, "");
405
+ if (importBase) return "./" + relative(importBase, absPath).replace(/\\/g, "/");
406
+ return "./" + posix.basename(absPath);
407
+ }
408
+ /**
409
+ * Build a TypeScript type expression that resolves a single param's
410
+ * codec by walking a chain of params.ts files in priority order.
411
+ *
412
+ * Each entry in the chain emits a conditional:
413
+ * `(typeof import(file))['segmentParams'] extends ParamsDefinition<infer T>
414
+ * ? K extends keyof T ? T[K] : <next>
415
+ * : <next>`
416
+ *
417
+ * The closest match (position 0 in the chain) is checked first; if its
418
+ * `segmentParams` definition declares the key, its inferred type wins.
419
+ * Otherwise we fall through to the next ancestor, and finally to the
420
+ * provided fallback. See TIM-834.
421
+ */
422
+ function buildCodecChainType(p, importBase, fallback) {
423
+ const files = p.codecFilePaths;
424
+ if (!files || files.length === 0) return fallback;
425
+ const key = JSON.stringify(p.name);
426
+ let inner = fallback;
427
+ for (let i = files.length - 1; i >= 0; i--) inner = `((typeof import('${codecImportPath(files[i], importBase)}'))['segmentParams'] extends import('@timber-js/app/segment-params').ParamsDefinition<infer T> ? (${key} extends keyof T ? T[${key}] : ${inner}) : ${inner})`;
428
+ return inner;
429
+ }
430
+ /**
431
+ * Format the searchParams type for a route entry.
432
+ *
433
+ * When a page.tsx (or params.ts) exports searchParams, we reference its
434
+ * inferred type via an import type. The import path is relative to
435
+ * `importBase` (the directory where the .d.ts will be written). When
436
+ * importBase is undefined, falls back to a bare relative path.
437
+ */
438
+ function formatSearchParamsType(route, importBase) {
439
+ if (route.hasSearchParams && route.searchParamsPagePath) return `(typeof import('${codecImportPath(route.searchParamsPagePath, importBase)}'))['searchParams'] extends import('@timber-js/app/search-params').SearchParamsDefinition<infer T> ? T : never`;
440
+ return "{}";
441
+ }
442
+ //#endregion
443
+ //#region src/routing/link-codegen.ts
444
+ /** Shared Link base-props type literal used in every emitted call signature. */
445
+ var LINK_BASE_PROPS_TYPE = "Omit<import('react').AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> & { prefetch?: boolean; scroll?: boolean; preserveSearchParams?: true | string[]; onNavigate?: import('./client/link.js').OnNavigateHandler; children?: import('react').ReactNode }";
446
+ /**
447
+ * Build a TypeScript template literal pattern for a dynamic route.
448
+ * e.g. '/products/[id]' → '/products/${string}'
449
+ * '/blog/[...slug]' → '/blog/${string}'
450
+ * '/docs/[[...path]]' → '/docs/${string}' (also matches /docs)
451
+ * '/[org]/[repo]' → '/${string}/${string}'
452
+ */
453
+ function buildResolvedPattern(route) {
454
+ return route.urlPath.split("/").map((part) => {
455
+ if (part.startsWith("[[...") && part.endsWith("]]")) return "${string}";
456
+ if (part.startsWith("[...") && part.endsWith("]")) return "${string}";
457
+ if (part.startsWith("[") && part.endsWith("]")) return "${string}";
458
+ return part;
459
+ }).join("/");
460
+ }
461
+ /**
462
+ * Format the segmentParams type for Link overloads.
463
+ *
464
+ * Link params accept `string | number` for single dynamic segments
465
+ * (convenience — values are stringified at runtime). Catch-all and
466
+ * optional catch-all remain `string[]` / `string[] | undefined`.
467
+ *
468
+ * When the segment's params chain (TIM-834) declares a typed codec, the
469
+ * inferred type from the codec wins via a nested conditional.
470
+ */
471
+ function formatLinkParamsType(params, importBase) {
472
+ if (params.length === 0) return "{}";
473
+ return `{ ${params.map((p) => {
474
+ const codecType = buildCodecChainType(p, importBase, p.type === "string" ? "string | number" : p.type);
475
+ return `${p.name}: ${codecType}`;
476
+ }).join("; ")} }`;
477
+ }
478
+ /**
479
+ * Catch-all call signatures for `<Link>` — external hrefs and computed
480
+ * `string` variables. Emitted from codegen in a SEPARATE
481
+ * `declare module` block (declared AFTER the per-route block) so the TS
482
+ * "later overload set ordered first" rule places these catch-all
483
+ * signatures ahead of per-route in resolution order, leaving per-route
484
+ * as the final overload whose error message is reported on failure.
485
+ *
486
+ * The conditional `string extends H ? ... : never` protection preserves
487
+ * TIM-624's guarantee that unknown internal path literals don't match
488
+ * the catch-all — typos like `<Link href="/typo" />` still error.
489
+ */
490
+ function formatLinkCatchAllOverloads() {
491
+ const lines = [];
492
+ const baseProps = LINK_BASE_PROPS_TYPE;
493
+ const catchAllSearchParams = "{ definition: SearchParamsDefinition<Record<string, unknown>>; values: Record<string, unknown> } | Record<string, unknown>";
494
+ const externalHref = "`http://${string}` | `https://${string}` | `mailto:${string}` | `tel:${string}` | `ftp://${string}` | `//${string}` | `#${string}` | `?${string}`";
495
+ lines.push(" // Typed Link overloads — catch-all (block 2 / emitted second)");
496
+ lines.push(" interface LinkFunction {");
497
+ lines.push(` (props: ${baseProps} & {`);
498
+ lines.push(` href: ${externalHref}`);
499
+ lines.push(` segmentParams?: never`);
500
+ lines.push(` searchParams?: ${catchAllSearchParams}`);
501
+ lines.push(` }): import('react').JSX.Element`);
502
+ lines.push(` <H extends string>(`);
503
+ lines.push(` props: string extends H`);
504
+ lines.push(` ? ${baseProps} & {`);
505
+ lines.push(` href: H`);
506
+ lines.push(` segmentParams?: Record<string, string | number | string[]>`);
507
+ lines.push(` searchParams?: ${catchAllSearchParams}`);
508
+ lines.push(` }`);
509
+ lines.push(` : never`);
510
+ lines.push(` ): import('react').JSX.Element`);
511
+ lines.push(" }");
512
+ return lines;
513
+ }
514
+ /**
515
+ * Generate typed per-route Link call signatures via LinkFunction
516
+ * interface merging.
517
+ *
518
+ * TIM-835: This emits a SINGLE call signature whose props is a
519
+ * discriminated union keyed on `href`. TypeScript narrows the union by
520
+ * the literal `href` at the call site, then checks the rest of the
521
+ * props against the matched variant. When `segmentParams` or
522
+ * `searchParams` is wrong, TS reports the error against the matched
523
+ * variant — naming the user's actual `href` and the offending field.
524
+ *
525
+ * Before TIM-835, this function emitted N separate per-route overloads
526
+ * (one per route, sometimes two for dynamic routes). When ALL overloads
527
+ * failed, TS would pick an arbitrary failed overload (heuristically the
528
+ * "last tried") to render the diagnostic, often pointing at a route
529
+ * completely unrelated to the one the user wrote. The discriminated
530
+ * union sidesteps overload-resolution heuristics entirely.
531
+ *
532
+ * Open property shapes (`Record<string, unknown>` instead of `never`)
533
+ * for `segmentParams` on routes that don't declare them keep generic
534
+ * `LinkProps`-spreading wrappers compiling. (Aligned with TIM-833.)
535
+ *
536
+ * TIM-832: this function still emits the per-route block FIRST and the
537
+ * catch-all block follows, so per-route remains the LAST overload set in
538
+ * resolution order — the one TS reports against on failure. With a
539
+ * discriminated union there is only one call signature in this block,
540
+ * so the resolved-template-vs-pattern ordering reduces to placing the
541
+ * pattern variant before the resolved-template variant inside the union.
542
+ */
543
+ function formatTypedLinkOverloads(routes, importBase) {
544
+ const lines = [];
545
+ const baseProps = LINK_BASE_PROPS_TYPE;
546
+ const variants = [];
547
+ for (const route of routes) {
548
+ const hasDynamicParams = route.params.length > 0;
549
+ const paramsProp = hasDynamicParams ? `segmentParams: ${formatLinkParamsType(route.params, importBase)}` : "segmentParams?: Record<string, unknown>";
550
+ const searchParamsType = route.hasSearchParams ? formatSearchParamsType(route, importBase) : null;
551
+ const patternSearchParamsProp = searchParamsType ? `searchParams?: Partial<${searchParamsType}>` : "searchParams?: Record<string, never>";
552
+ variants.push(`${baseProps} & { href: '${route.urlPath}'; ${paramsProp}; ${patternSearchParamsProp} }`);
553
+ if (hasDynamicParams) {
554
+ const templatePattern = buildResolvedPattern(route);
555
+ if (templatePattern) {
556
+ const resolvedSearchParamsProp = searchParamsType ? `searchParams?: { definition: SearchParamsDefinition<${searchParamsType}>; values: Partial<${searchParamsType}> }` : "searchParams?: Record<string, never>";
557
+ variants.push(`${baseProps} & { href: \`${templatePattern}\`; segmentParams?: Record<string, never>; ${resolvedSearchParamsProp} }`);
558
+ }
559
+ }
560
+ }
561
+ lines.push(" interface LinkFunction {");
562
+ if (variants.length === 0) {
563
+ lines.push(" }");
564
+ return lines;
565
+ }
566
+ lines.push(" (");
567
+ lines.push(" props:");
568
+ for (const variant of variants) lines.push(` | (${variant})`);
569
+ lines.push(` ): import('react').JSX.Element`);
570
+ lines.push(" }");
571
+ return lines;
572
+ }
354
573
  //#endregion
355
574
  //#region src/routing/codegen.ts
356
575
  /**
@@ -370,7 +589,7 @@ function findFixedFile(dirPath, name) {
370
589
  */
371
590
  function generateRouteMap(tree, options = {}) {
372
591
  const routes = [];
373
- collectRoutes(tree.root, [], options.appDir, routes);
592
+ collectRoutes(tree.root, [], [], routes);
374
593
  routes.sort((a, b) => a.urlPath.localeCompare(b.urlPath));
375
594
  return formatDeclarationFile(routes, options.outputDir ?? options.appDir);
376
595
  }
@@ -380,12 +599,24 @@ function generateRouteMap(tree, options = {}) {
380
599
  * A route entry is created for any segment that has a `page` or `route` file.
381
600
  * Params accumulate from ancestor dynamic segments.
382
601
  */
383
- function collectRoutes(node, ancestorParams, appDir, routes) {
602
+ function collectRoutes(node, ancestorParams, ancestorParamsFiles, routes) {
603
+ const ownParamsFile = node.params && fileHasExport(node.params.filePath, "segmentParams") ? node.params.filePath : void 0;
384
604
  const params = [...ancestorParams];
385
- if (node.paramName) params.push({
386
- name: node.paramName,
387
- type: paramTypeForSegment(node.segmentType)
388
- });
605
+ if (node.paramName) {
606
+ const codecFilePaths = [];
607
+ if (ownParamsFile) codecFilePaths.push(ownParamsFile);
608
+ for (let i = ancestorParamsFiles.length - 1; i >= 0; i--) codecFilePaths.push(ancestorParamsFiles[i]);
609
+ if (codecFilePaths.length === 0) {
610
+ const legacy = findLegacyParamsExport(node);
611
+ if (legacy) codecFilePaths.push(legacy);
612
+ }
613
+ params.push({
614
+ name: node.paramName,
615
+ type: paramTypeForSegment(node.segmentType),
616
+ codecFilePaths: codecFilePaths.length > 0 ? codecFilePaths : void 0
617
+ });
618
+ }
619
+ const nextAncestorFiles = ownParamsFile ? [...ancestorParamsFiles, ownParamsFile] : ancestorParamsFiles;
389
620
  const isPage = !!node.page;
390
621
  const isApiRoute = !!node.route;
391
622
  if (isPage || isApiRoute) {
@@ -395,17 +626,19 @@ function collectRoutes(node, ancestorParams, appDir, routes) {
395
626
  hasSearchParams: false,
396
627
  isApiRoute
397
628
  };
398
- if (appDir && isPage) {
399
- const searchParamsFile = findSearchParamsFile(resolveSegmentDir(appDir, node));
400
- if (searchParamsFile) {
629
+ if (isPage) {
630
+ if (node.params && fileHasExport(node.params.filePath, "searchParams")) {
401
631
  entry.hasSearchParams = true;
402
- entry.searchParamsAbsPath = searchParamsFile;
632
+ entry.searchParamsPagePath = node.params.filePath;
633
+ } else if (node.page && fileHasExport(node.page.filePath, "searchParams")) {
634
+ entry.hasSearchParams = true;
635
+ entry.searchParamsPagePath = node.page.filePath;
403
636
  }
404
637
  }
405
638
  routes.push(entry);
406
639
  }
407
- for (const child of node.children) collectRoutes(child, params, appDir, routes);
408
- for (const [, slot] of node.slots) collectRoutes(slot, params, appDir, routes);
640
+ for (const child of node.children) collectRoutes(child, params, nextAncestorFiles, routes);
641
+ for (const [, slot] of node.slots) collectRoutes(slot, params, nextAncestorFiles, routes);
409
642
  }
410
643
  /**
411
644
  * Determine the TypeScript type for a segment's param.
@@ -418,28 +651,31 @@ function paramTypeForSegment(segmentType) {
418
651
  }
419
652
  }
420
653
  /**
421
- * Resolve the absolute directory path for a segment node.
654
+ * Check if a file exports a specific named export.
422
655
  *
423
- * Reconstructs the filesystem path by walking from appDir through
424
- * the segment names encoded in the urlPath, accounting for groups and slots.
656
+ * Uses a lightweight regex check not full AST parsing. The actual type
657
+ * extraction happens via the TypeScript compiler in the generated .d.ts.
425
658
  */
426
- function resolveSegmentDir(appDir, node) {
427
- const file = node.page ?? node.route;
428
- if (file) {
429
- const parts = file.filePath.split("/");
430
- parts.pop();
431
- return parts.join("/");
659
+ function fileHasExport(filePath, exportName) {
660
+ if (!existsSync(filePath)) return false;
661
+ try {
662
+ const content = readFileSync(filePath, "utf-8");
663
+ const e = exportName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
664
+ return new RegExp(`export\\s+(const|let|var)\\s+${e}\\b`).test(content) || new RegExp(`export\\s*\\{[^}]*\\b${e}\\b[^}]*\\}`).test(content);
665
+ } catch {
666
+ return false;
432
667
  }
433
- return appDir;
434
668
  }
435
669
  /**
436
- * Find a search-params.ts file in a directory.
670
+ * Find a legacy `segmentParams` export on layout.tsx or page.tsx.
671
+ *
672
+ * Backward-compat shim: TIM-508 made params.ts the canonical location
673
+ * for `segmentParams`. Layout/page exports are still accepted for the
674
+ * OWN segment only (not inherited by descendants — see TIM-834).
437
675
  */
438
- function findSearchParamsFile(dirPath) {
439
- for (const ext of ["ts", "tsx"]) {
440
- const candidate = join(dirPath, `search-params.${ext}`);
441
- if (existsSync(candidate)) return candidate;
442
- }
676
+ function findLegacyParamsExport(node) {
677
+ if (node.layout && fileHasExport(node.layout.filePath, "segmentParams")) return node.layout.filePath;
678
+ if (node.page && fileHasExport(node.page.filePath, "segmentParams")) return node.page.filePath;
443
679
  }
444
680
  /**
445
681
  * Format the collected routes into a TypeScript declaration file.
@@ -454,10 +690,10 @@ function formatDeclarationFile(routes, importBase) {
454
690
  lines.push("declare module '@timber-js/app' {");
455
691
  lines.push(" interface Routes {");
456
692
  for (const route of routes) {
457
- const paramsType = formatParamsType(route.params);
693
+ const paramsType = formatParamsType(route.params, importBase);
458
694
  const searchParamsType = formatSearchParamsType(route, importBase);
459
695
  lines.push(` '${route.urlPath}': {`);
460
- lines.push(` params: ${paramsType}`);
696
+ lines.push(` segmentParams: ${paramsType}`);
461
697
  lines.push(` searchParams: ${searchParamsType}`);
462
698
  lines.push(` }`);
463
699
  }
@@ -465,13 +701,6 @@ function formatDeclarationFile(routes, importBase) {
465
701
  lines.push("}");
466
702
  lines.push("");
467
703
  const pageRoutes = routes.filter((r) => !r.isApiRoute);
468
- if (pageRoutes.length > 0) {
469
- lines.push("declare module '@timber-js/app/server' {");
470
- lines.push(" import type { Routes } from '@timber-js/app'");
471
- lines.push(" export function searchParams<R extends keyof Routes>(): Promise<Routes[R]['searchParams']>");
472
- lines.push("}");
473
- lines.push("");
474
- }
475
704
  const dynamicRoutes = routes.filter((r) => r.params.length > 0);
476
705
  if (dynamicRoutes.length > 0 || pageRoutes.length > 0) {
477
706
  lines.push("declare module '@timber-js/app/client' {");
@@ -479,10 +708,10 @@ function formatDeclarationFile(routes, importBase) {
479
708
  lines.push("");
480
709
  if (dynamicRoutes.length > 0) {
481
710
  for (const route of dynamicRoutes) {
482
- const paramsType = formatParamsType(route.params);
483
- lines.push(` export function useParams(route: '${route.urlPath}'): ${paramsType}`);
711
+ const paramsType = formatParamsType(route.params, importBase);
712
+ lines.push(` export function useSegmentParams(route: '${route.urlPath}'): ${paramsType}`);
484
713
  }
485
- lines.push(" export function useParams(): Record<string, string | string[]>");
714
+ lines.push(" export function useSegmentParams(): Record<string, string | string[]>");
486
715
  lines.push("");
487
716
  }
488
717
  if (pageRoutes.length > 0) {
@@ -490,55 +719,32 @@ function formatDeclarationFile(routes, importBase) {
490
719
  lines.push("");
491
720
  }
492
721
  if (pageRoutes.length > 0) {
493
- lines.push(" // Typed Link props per route");
722
+ lines.push(" // Typed Link overloads per-route (block 1 / emitted first)");
494
723
  lines.push(...formatTypedLinkOverloads(pageRoutes, importBase));
724
+ lines.push("");
495
725
  }
496
726
  lines.push("}");
497
727
  lines.push("");
498
728
  }
729
+ lines.push("declare module '@timber-js/app/client' {");
730
+ lines.push(" import type { SearchParamsDefinition } from '@timber-js/app/search-params'");
731
+ lines.push("");
732
+ lines.push(...formatLinkCatchAllOverloads());
733
+ lines.push("}");
734
+ lines.push("");
499
735
  return lines.join("\n");
500
736
  }
501
737
  /**
502
738
  * Format the params type for a route entry.
503
739
  */
504
- function formatParamsType(params) {
505
- if (params.length === 0) return "{}";
506
- return `{ ${params.map((p) => `${p.name}: ${p.type}`).join("; ")} }`;
507
- }
508
- /**
509
- * Format the params type for Link props.
510
- *
511
- * Link params accept `string | number` for single dynamic segments
512
- * (convenience — values are stringified at runtime). Catch-all and
513
- * optional catch-all remain `string[]` / `string[] | undefined`.
514
- *
515
- * See design/07-routing.md §"Typed params and searchParams on <Link>"
516
- */
517
- function formatLinkParamsType(params) {
740
+ function formatParamsType(params, importBase) {
518
741
  if (params.length === 0) return "{}";
519
742
  return `{ ${params.map((p) => {
520
- const type = p.type === "string" ? "string | number" : p.type;
521
- return `${p.name}: ${type}`;
743
+ const codecType = buildCodecChainType(p, importBase, p.type);
744
+ return `${p.name}: ${codecType}`;
522
745
  }).join("; ")} }`;
523
746
  }
524
747
  /**
525
- * Format the searchParams type for a route entry.
526
- *
527
- * When a search-params.ts exists, we reference its inferred type via an import type.
528
- * The import path is relative to `importBase` (the directory where the .d.ts will be
529
- * written). When importBase is undefined, falls back to a bare relative path.
530
- */
531
- function formatSearchParamsType(route, importBase) {
532
- if (route.hasSearchParams && route.searchParamsAbsPath) {
533
- const absPath = route.searchParamsAbsPath.replace(/\.(ts|tsx)$/, "");
534
- let importPath;
535
- if (importBase) importPath = "./" + relative(importBase, absPath).replace(/\\/g, "/");
536
- else importPath = "./" + posix.basename(absPath);
537
- return `(typeof import('${importPath}'))['default'] extends import('@timber-js/app/search-params').SearchParamsDefinition<infer T> ? T : never`;
538
- }
539
- return "{}";
540
- }
541
- /**
542
748
  * Generate useQueryStates overloads.
543
749
  *
544
750
  * For each page route:
@@ -556,44 +762,6 @@ function formatUseQueryStatesOverloads(routes, importBase) {
556
762
  lines.push(" export function useQueryStates<T extends Record<string, unknown>>(codecs: { [K in keyof T]: SearchParamCodec<T[K]> }, options?: QueryStatesOptions): [T, SetParams<T>]");
557
763
  return lines;
558
764
  }
559
- /**
560
- * Generate typed Link overloads.
561
- *
562
- * For each page route, we generate a Link function overload that:
563
- * - Constrains href to the route pattern
564
- * - Types the params prop based on dynamic segments
565
- * - Types the searchParams prop based on search-params.ts (if present)
566
- *
567
- * Routes without dynamic segments accept href as a literal string with no params.
568
- * Routes with dynamic segments require a params prop.
569
- */
570
- function formatTypedLinkOverloads(routes, importBase) {
571
- const lines = [];
572
- for (const route of routes) {
573
- const hasDynamicParams = route.params.length > 0;
574
- const paramsType = formatLinkParamsType(route.params);
575
- const searchParamsType = route.hasSearchParams ? formatSearchParamsType(route, importBase) : null;
576
- if (hasDynamicParams) {
577
- const spProp = searchParamsType ? `searchParams?: { definition: SearchParamsDefinition<${searchParamsType}>; values: Partial<${searchParamsType}> }` : `searchParams?: never`;
578
- lines.push(` export function Link(props: Omit<import('react').AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> & {`);
579
- lines.push(` href: '${route.urlPath}'`);
580
- lines.push(` params: ${paramsType}`);
581
- lines.push(` ${spProp}`);
582
- lines.push(` prefetch?: boolean; scroll?: boolean; children?: import('react').ReactNode`);
583
- lines.push(` }): import('react').JSX.Element`);
584
- } else {
585
- const spProp = searchParamsType ? `searchParams?: { definition: SearchParamsDefinition<${searchParamsType}>; values: Partial<${searchParamsType}> }` : `searchParams?: never`;
586
- lines.push(` export function Link(props: Omit<import('react').AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> & {`);
587
- lines.push(` href: '${route.urlPath}'`);
588
- lines.push(` params?: never`);
589
- lines.push(` ${spProp}`);
590
- lines.push(` prefetch?: boolean; scroll?: boolean; children?: import('react').ReactNode`);
591
- lines.push(` }): import('react').JSX.Element`);
592
- }
593
- }
594
- lines.push(` export function Link(props: import('./client/link.js').LinkProps): import('react').JSX.Element`);
595
- return lines;
596
- }
597
765
  //#endregion
598
766
  //#region src/routing/interception.ts
599
767
  /**
@@ -673,4 +841,4 @@ function computeInterceptedBase(parentUrlPath, marker) {
673
841
  //#endregion
674
842
  export { DEFAULT_PAGE_EXTENSIONS as a, scanRoutes as i, generateRouteMap as n, INTERCEPTION_MARKERS as o, classifySegment as r, collectInterceptionRewrites as t };
675
843
 
676
- //# sourceMappingURL=interception-BOoWmLUA.js.map
844
+ //# sourceMappingURL=interception-ErnB33JX.js.map