@timber-js/app 0.2.0-alpha.15 → 0.2.0-alpha.151

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 (854) hide show
  1. package/LICENSE +8 -0
  2. package/dist/_chunks/actions-a0RczDnB.js +1106 -0
  3. package/dist/_chunks/actions-a0RczDnB.js.map +1 -0
  4. package/dist/_chunks/build-output-helper-B20ZuTSA.js +102 -0
  5. package/dist/_chunks/build-output-helper-B20ZuTSA.js.map +1 -0
  6. package/dist/_chunks/cache-api-Co-yI-gP.js +424 -0
  7. package/dist/_chunks/cache-api-Co-yI-gP.js.map +1 -0
  8. package/dist/_chunks/{metadata-routes-Cjmvi3rQ.js → canonicalize-P41GR6tY.js} +94 -18
  9. package/dist/_chunks/canonicalize-P41GR6tY.js.map +1 -0
  10. package/dist/_chunks/cli-schema-sync-DJDdyEae.js +629 -0
  11. package/dist/_chunks/cli-schema-sync-DJDdyEae.js.map +1 -0
  12. package/dist/_chunks/cli-schema-sync-D_IhHEUW.js +2 -0
  13. package/dist/_chunks/codec-registry-oOUxugz3.js +21 -0
  14. package/dist/_chunks/codec-registry-oOUxugz3.js.map +1 -0
  15. package/dist/_chunks/define-Bssfp6ot.js +82 -0
  16. package/dist/_chunks/define-Bssfp6ot.js.map +1 -0
  17. package/dist/_chunks/define-CFmvb4Bt.js +203 -0
  18. package/dist/_chunks/define-CFmvb4Bt.js.map +1 -0
  19. package/dist/_chunks/fast-hash-D6hIVt1Y.js +36 -0
  20. package/dist/_chunks/fast-hash-D6hIVt1Y.js.map +1 -0
  21. package/dist/_chunks/format-CfwjgPz9.js +14 -0
  22. package/dist/_chunks/format-CfwjgPz9.js.map +1 -0
  23. package/dist/_chunks/href-validation-FiA_rToW.js +141 -0
  24. package/dist/_chunks/href-validation-FiA_rToW.js.map +1 -0
  25. package/dist/_chunks/logger-CM0clugc.js +645 -0
  26. package/dist/_chunks/logger-CM0clugc.js.map +1 -0
  27. package/dist/_chunks/navigation-root-bUDZLw74.js +124 -0
  28. package/dist/_chunks/navigation-root-bUDZLw74.js.map +1 -0
  29. package/dist/_chunks/plugin-context-DurqFBuY.js +2 -0
  30. package/dist/_chunks/plugin-context-GfDWsdd2.js +268 -0
  31. package/dist/_chunks/plugin-context-GfDWsdd2.js.map +1 -0
  32. package/dist/_chunks/registry-DbJPKoBp.js +20 -0
  33. package/dist/_chunks/registry-DbJPKoBp.js.map +1 -0
  34. package/dist/_chunks/resolve-schema-3iUvBV5T.js +50 -0
  35. package/dist/_chunks/resolve-schema-3iUvBV5T.js.map +1 -0
  36. package/dist/_chunks/router-ref-CtmF-aPv.js +28 -0
  37. package/dist/_chunks/router-ref-CtmF-aPv.js.map +1 -0
  38. package/dist/_chunks/schema-bridge-BY3QLBL7.js +119 -0
  39. package/dist/_chunks/schema-bridge-BY3QLBL7.js.map +1 -0
  40. package/dist/_chunks/segment-classify-CDDRVKs7.js +137 -0
  41. package/dist/_chunks/segment-classify-CDDRVKs7.js.map +1 -0
  42. package/dist/_chunks/segment-context-ZDnXDkbz.js +34 -0
  43. package/dist/_chunks/segment-context-ZDnXDkbz.js.map +1 -0
  44. package/dist/_chunks/{ssr-data-MjmprTmO.js → ssr-data-BOWsq18U.js} +1 -1
  45. package/dist/_chunks/ssr-data-BOWsq18U.js.map +1 -0
  46. package/dist/_chunks/tree-match-D2l830j2.js +102 -0
  47. package/dist/_chunks/tree-match-D2l830j2.js.map +1 -0
  48. package/dist/_chunks/{use-query-states-D5KaffOK.js → use-query-states-CbeQmext.js} +7 -20
  49. package/dist/_chunks/use-query-states-CbeQmext.js.map +1 -0
  50. package/dist/_chunks/use-segment-params-D1CzlgBo.js +151 -0
  51. package/dist/_chunks/use-segment-params-D1CzlgBo.js.map +1 -0
  52. package/dist/_chunks/validation-taUkvA4Q.js +113 -0
  53. package/dist/_chunks/validation-taUkvA4Q.js.map +1 -0
  54. package/dist/_chunks/walkers-DvWDj453.js +790 -0
  55. package/dist/_chunks/walkers-DvWDj453.js.map +1 -0
  56. package/dist/adapters/build-output-helper.d.ts +28 -0
  57. package/dist/adapters/build-output-helper.d.ts.map +1 -0
  58. package/dist/adapters/cloudflare-dev.d.ts +109 -0
  59. package/dist/adapters/cloudflare-dev.d.ts.map +1 -0
  60. package/dist/adapters/cloudflare-dev.js +73 -0
  61. package/dist/adapters/cloudflare-dev.js.map +1 -0
  62. package/dist/adapters/cloudflare-kv-cache.d.ts +64 -0
  63. package/dist/adapters/cloudflare-kv-cache.d.ts.map +1 -0
  64. package/dist/adapters/cloudflare-kv-cache.js +117 -0
  65. package/dist/adapters/cloudflare-kv-cache.js.map +1 -0
  66. package/dist/adapters/cloudflare.d.ts +142 -20
  67. package/dist/adapters/cloudflare.d.ts.map +1 -1
  68. package/dist/adapters/cloudflare.js +150 -64
  69. package/dist/adapters/cloudflare.js.map +1 -1
  70. package/dist/adapters/compress-module.d.ts +5 -4
  71. package/dist/adapters/compress-module.d.ts.map +1 -1
  72. package/dist/adapters/nitro.d.ts +17 -3
  73. package/dist/adapters/nitro.d.ts.map +1 -1
  74. package/dist/adapters/nitro.js +146 -147
  75. package/dist/adapters/nitro.js.map +1 -1
  76. package/dist/adapters/shared.d.ts +16 -0
  77. package/dist/adapters/shared.d.ts.map +1 -0
  78. package/dist/cache/cache-api.d.ts +24 -0
  79. package/dist/cache/cache-api.d.ts.map +1 -0
  80. package/dist/cache/handler-store.d.ts +31 -0
  81. package/dist/cache/handler-store.d.ts.map +1 -0
  82. package/dist/cache/index.d.ts +25 -7
  83. package/dist/cache/index.d.ts.map +1 -1
  84. package/dist/cache/index.js +100 -240
  85. package/dist/cache/index.js.map +1 -1
  86. package/dist/cache/invalidation-epoch.d.ts +43 -0
  87. package/dist/cache/invalidation-epoch.d.ts.map +1 -0
  88. package/dist/cache/redis-handler.d.ts +85 -8
  89. package/dist/cache/redis-handler.d.ts.map +1 -1
  90. package/dist/cache/singleflight.d.ts +18 -1
  91. package/dist/cache/singleflight.d.ts.map +1 -1
  92. package/dist/cache/sizeof.d.ts +22 -0
  93. package/dist/cache/sizeof.d.ts.map +1 -0
  94. package/dist/cache/stable-stringify.d.ts +9 -0
  95. package/dist/cache/stable-stringify.d.ts.map +1 -1
  96. package/dist/cache/timber-cache.d.ts +20 -10
  97. package/dist/cache/timber-cache.d.ts.map +1 -1
  98. package/dist/cli-schema-sync.d.ts +59 -0
  99. package/dist/cli-schema-sync.d.ts.map +1 -0
  100. package/dist/cli.d.ts +26 -2
  101. package/dist/cli.d.ts.map +1 -1
  102. package/dist/cli.js +70 -33
  103. package/dist/cli.js.map +1 -1
  104. package/dist/client/browser-dev.d.ts +34 -1
  105. package/dist/client/browser-dev.d.ts.map +1 -1
  106. package/dist/client/browser-entry/action-dispatch.d.ts +17 -0
  107. package/dist/client/browser-entry/action-dispatch.d.ts.map +1 -0
  108. package/dist/client/browser-entry/hmr.d.ts +21 -0
  109. package/dist/client/browser-entry/hmr.d.ts.map +1 -0
  110. package/dist/client/browser-entry/hydrate.d.ts +46 -0
  111. package/dist/client/browser-entry/hydrate.d.ts.map +1 -0
  112. package/dist/client/browser-entry/index.d.ts +29 -0
  113. package/dist/client/browser-entry/index.d.ts.map +1 -0
  114. package/dist/client/browser-entry/post-hydration.d.ts +26 -0
  115. package/dist/client/browser-entry/post-hydration.d.ts.map +1 -0
  116. package/dist/client/browser-entry/router-init.d.ts +26 -0
  117. package/dist/client/browser-entry/router-init.d.ts.map +1 -0
  118. package/dist/client/browser-entry/rsc-stream.d.ts +24 -0
  119. package/dist/client/browser-entry/rsc-stream.d.ts.map +1 -0
  120. package/dist/client/browser-entry/scroll.d.ts +28 -0
  121. package/dist/client/browser-entry/scroll.d.ts.map +1 -0
  122. package/dist/client/error-boundary.d.ts +12 -5
  123. package/dist/client/error-boundary.d.ts.map +1 -1
  124. package/dist/client/error-boundary.js +47 -10
  125. package/dist/client/error-boundary.js.map +1 -1
  126. package/dist/client/error-reconstituter.d.ts +61 -0
  127. package/dist/client/error-reconstituter.d.ts.map +1 -0
  128. package/dist/client/form.d.ts +16 -27
  129. package/dist/client/form.d.ts.map +1 -1
  130. package/dist/client/history.d.ts +11 -3
  131. package/dist/client/history.d.ts.map +1 -1
  132. package/dist/client/index.d.ts +10 -24
  133. package/dist/client/index.d.ts.map +1 -1
  134. package/dist/client/index.js +183 -1134
  135. package/dist/client/index.js.map +1 -1
  136. package/dist/client/internal.d.ts +19 -0
  137. package/dist/client/internal.d.ts.map +1 -0
  138. package/dist/client/internal.js +900 -0
  139. package/dist/client/internal.js.map +1 -0
  140. package/dist/client/link.d.ts +69 -60
  141. package/dist/client/link.d.ts.map +1 -1
  142. package/dist/client/navigation-api-types.d.ts +90 -0
  143. package/dist/client/navigation-api-types.d.ts.map +1 -0
  144. package/dist/client/navigation-api.d.ts +122 -0
  145. package/dist/client/navigation-api.d.ts.map +1 -0
  146. package/dist/client/navigation-context.d.ts +3 -2
  147. package/dist/client/navigation-context.d.ts.map +1 -1
  148. package/dist/client/navigation-root.d.ts +119 -0
  149. package/dist/client/navigation-root.d.ts.map +1 -0
  150. package/dist/client/nuqs-adapter.d.ts +1 -1
  151. package/dist/client/nuqs-adapter.d.ts.map +1 -1
  152. package/dist/client/router-ref.d.ts +1 -1
  153. package/dist/client/router.d.ts +86 -10
  154. package/dist/client/router.d.ts.map +1 -1
  155. package/dist/client/rsc-fetch.d.ts +46 -3
  156. package/dist/client/rsc-fetch.d.ts.map +1 -1
  157. package/dist/client/segment-cache.d.ts +3 -1
  158. package/dist/client/segment-cache.d.ts.map +1 -1
  159. package/dist/client/segment-outlet.d.ts +49 -0
  160. package/dist/client/segment-outlet.d.ts.map +1 -0
  161. package/dist/client/segment-update-context.d.ts +21 -0
  162. package/dist/client/segment-update-context.d.ts.map +1 -0
  163. package/dist/client/shallow-url.d.ts +10 -0
  164. package/dist/client/shallow-url.d.ts.map +1 -0
  165. package/dist/client/ssr-data.d.ts +13 -4
  166. package/dist/client/ssr-data.d.ts.map +1 -1
  167. package/dist/client/state.d.ts +1 -1
  168. package/dist/client/top-loader.d.ts +5 -5
  169. package/dist/client/top-loader.d.ts.map +1 -1
  170. package/dist/client/use-cookie.d.ts +12 -0
  171. package/dist/client/use-cookie.d.ts.map +1 -1
  172. package/dist/client/use-link-status.d.ts +5 -5
  173. package/dist/client/use-link-status.d.ts.map +1 -1
  174. package/dist/client/use-pathname.d.ts.map +1 -1
  175. package/dist/client/use-pending-navigation.d.ts +23 -0
  176. package/dist/client/use-pending-navigation.d.ts.map +1 -0
  177. package/dist/client/use-query-states.d.ts +1 -1
  178. package/dist/client/use-query-states.d.ts.map +1 -1
  179. package/dist/client/use-router.d.ts +1 -1
  180. package/dist/client/use-router.d.ts.map +1 -1
  181. package/dist/client/use-search-params.d.ts +12 -5
  182. package/dist/client/use-search-params.d.ts.map +1 -1
  183. package/dist/client/{use-params.d.ts → use-segment-params.d.ts} +8 -6
  184. package/dist/client/use-segment-params.d.ts.map +1 -0
  185. package/dist/codec.d.ts +69 -0
  186. package/dist/codec.d.ts.map +1 -0
  187. package/dist/codec.js +75 -0
  188. package/dist/codec.js.map +1 -0
  189. package/dist/config-types.d.ts +294 -0
  190. package/dist/config-types.d.ts.map +1 -0
  191. package/dist/config-validation.d.ts +51 -0
  192. package/dist/config-validation.d.ts.map +1 -0
  193. package/dist/content/index.d.ts +1 -10
  194. package/dist/content/index.d.ts.map +1 -1
  195. package/dist/content/index.js +0 -2
  196. package/dist/cookies/define-cookie.d.ts +58 -25
  197. package/dist/cookies/define-cookie.d.ts.map +1 -1
  198. package/dist/cookies/index.d.ts +2 -1
  199. package/dist/cookies/index.d.ts.map +1 -1
  200. package/dist/cookies/index.js +249 -36
  201. package/dist/cookies/index.js.map +1 -1
  202. package/dist/cookies/json-cookie.d.ts +64 -0
  203. package/dist/cookies/json-cookie.d.ts.map +1 -0
  204. package/dist/cookies/validation.d.ts +34 -0
  205. package/dist/cookies/validation.d.ts.map +1 -0
  206. package/dist/dev-tools/404-page.d.ts +50 -0
  207. package/dist/dev-tools/404-page.d.ts.map +1 -0
  208. package/dist/dev-tools/browser-logs.d.ts +84 -0
  209. package/dist/dev-tools/browser-logs.d.ts.map +1 -0
  210. package/dist/dev-tools/dev-page-shell.d.ts +78 -0
  211. package/dist/dev-tools/dev-page-shell.d.ts.map +1 -0
  212. package/dist/dev-tools/error-page.d.ts +32 -0
  213. package/dist/dev-tools/error-page.d.ts.map +1 -0
  214. package/dist/dev-tools/holding-server.d.ts +54 -0
  215. package/dist/dev-tools/holding-server.d.ts.map +1 -0
  216. package/dist/dev-tools/hydration-overlay.d.ts +11 -0
  217. package/dist/dev-tools/hydration-overlay.d.ts.map +1 -0
  218. package/dist/dev-tools/index.d.ts +31 -0
  219. package/dist/dev-tools/index.d.ts.map +1 -0
  220. package/dist/dev-tools/instrumentation.d.ts +59 -0
  221. package/dist/dev-tools/instrumentation.d.ts.map +1 -0
  222. package/dist/{server/dev-logger.d.ts → dev-tools/logger.d.ts} +1 -1
  223. package/dist/dev-tools/logger.d.ts.map +1 -0
  224. package/dist/{plugins/dev-logs.d.ts → dev-tools/logs.d.ts} +2 -2
  225. package/dist/dev-tools/logs.d.ts.map +1 -0
  226. package/dist/dev-tools/overlay.d.ts +91 -0
  227. package/dist/dev-tools/overlay.d.ts.map +1 -0
  228. package/dist/dev-tools/stack-classifier.d.ts +34 -0
  229. package/dist/dev-tools/stack-classifier.d.ts.map +1 -0
  230. package/dist/dev-tools/terminal.d.ts +28 -0
  231. package/dist/dev-tools/terminal.d.ts.map +1 -0
  232. package/dist/fonts/ast-walk.d.ts +68 -0
  233. package/dist/fonts/ast-walk.d.ts.map +1 -0
  234. package/dist/fonts/ast.d.ts +110 -6
  235. package/dist/fonts/ast.d.ts.map +1 -1
  236. package/dist/fonts/bundle.d.ts +50 -0
  237. package/dist/fonts/bundle.d.ts.map +1 -0
  238. package/dist/fonts/dev-middleware.d.ts +22 -0
  239. package/dist/fonts/dev-middleware.d.ts.map +1 -0
  240. package/dist/fonts/fallbacks.d.ts +0 -7
  241. package/dist/fonts/fallbacks.d.ts.map +1 -1
  242. package/dist/fonts/google.d.ts +4 -2
  243. package/dist/fonts/google.d.ts.map +1 -1
  244. package/dist/fonts/local.d.ts +4 -4
  245. package/dist/fonts/local.d.ts.map +1 -1
  246. package/dist/fonts/paths.d.ts +43 -0
  247. package/dist/fonts/paths.d.ts.map +1 -0
  248. package/dist/fonts/pipeline.d.ts +158 -0
  249. package/dist/fonts/pipeline.d.ts.map +1 -0
  250. package/dist/fonts/transform.d.ts +78 -0
  251. package/dist/fonts/transform.d.ts.map +1 -0
  252. package/dist/fonts/types.d.ts +47 -1
  253. package/dist/fonts/types.d.ts.map +1 -1
  254. package/dist/fonts/virtual-modules.d.ts +77 -0
  255. package/dist/fonts/virtual-modules.d.ts.map +1 -0
  256. package/dist/index.d.ts +46 -180
  257. package/dist/index.d.ts.map +1 -1
  258. package/dist/index.js +6452 -13421
  259. package/dist/index.js.map +1 -1
  260. package/dist/params/codec-registry.d.ts +26 -0
  261. package/dist/params/codec-registry.d.ts.map +1 -0
  262. package/dist/params/define-schema.d.ts +81 -0
  263. package/dist/params/define-schema.d.ts.map +1 -0
  264. package/dist/params/index.d.ts +5 -0
  265. package/dist/params/index.d.ts.map +1 -0
  266. package/dist/params/index.js +34 -0
  267. package/dist/params/index.js.map +1 -0
  268. package/dist/params/resolve-schema.d.ts +34 -0
  269. package/dist/params/resolve-schema.d.ts.map +1 -0
  270. package/dist/plugin-context.d.ts +137 -0
  271. package/dist/plugin-context.d.ts.map +1 -0
  272. package/dist/plugins/adapter-build.d.ts +20 -1
  273. package/dist/plugins/adapter-build.d.ts.map +1 -1
  274. package/dist/plugins/build-manifest.d.ts +7 -3
  275. package/dist/plugins/build-manifest.d.ts.map +1 -1
  276. package/dist/plugins/build-report.d.ts +9 -7
  277. package/dist/plugins/build-report.d.ts.map +1 -1
  278. package/dist/plugins/cache.d.ts +73 -0
  279. package/dist/plugins/cache.d.ts.map +1 -0
  280. package/dist/plugins/client-chunks.d.ts +39 -0
  281. package/dist/plugins/client-chunks.d.ts.map +1 -0
  282. package/dist/plugins/cloudflare-wasm.d.ts +21 -0
  283. package/dist/plugins/cloudflare-wasm.d.ts.map +1 -0
  284. package/dist/plugins/content.d.ts +1 -1
  285. package/dist/plugins/content.d.ts.map +1 -1
  286. package/dist/plugins/dev-server.d.ts +17 -1
  287. package/dist/plugins/dev-server.d.ts.map +1 -1
  288. package/dist/plugins/entries.d.ts +1 -1
  289. package/dist/plugins/entries.d.ts.map +1 -1
  290. package/dist/plugins/fonts.d.ts +16 -73
  291. package/dist/plugins/fonts.d.ts.map +1 -1
  292. package/dist/plugins/mdx.d.ts +1 -1
  293. package/dist/plugins/mdx.d.ts.map +1 -1
  294. package/dist/plugins/routing.d.ts +1 -1
  295. package/dist/plugins/routing.d.ts.map +1 -1
  296. package/dist/plugins/server-bundle.d.ts.map +1 -1
  297. package/dist/plugins/shims.d.ts +29 -5
  298. package/dist/plugins/shims.d.ts.map +1 -1
  299. package/dist/plugins/static-build.d.ts +5 -26
  300. package/dist/plugins/static-build.d.ts.map +1 -1
  301. package/dist/routing/codegen-shared.d.ts +67 -0
  302. package/dist/routing/codegen-shared.d.ts.map +1 -0
  303. package/dist/routing/codegen-types.d.ts +64 -0
  304. package/dist/routing/codegen-types.d.ts.map +1 -0
  305. package/dist/routing/codegen.d.ts +7 -2
  306. package/dist/routing/codegen.d.ts.map +1 -1
  307. package/dist/routing/convention-lint.d.ts +41 -0
  308. package/dist/routing/convention-lint.d.ts.map +1 -0
  309. package/dist/routing/file-cache.d.ts +8 -0
  310. package/dist/routing/file-cache.d.ts.map +1 -0
  311. package/dist/routing/index.d.ts +7 -1
  312. package/dist/routing/index.d.ts.map +1 -1
  313. package/dist/routing/index.js +4 -2
  314. package/dist/routing/interception.d.ts +0 -5
  315. package/dist/routing/interception.d.ts.map +1 -1
  316. package/dist/routing/link-codegen.d.ts +90 -0
  317. package/dist/routing/link-codegen.d.ts.map +1 -0
  318. package/dist/routing/manifest-codegen.d.ts +32 -0
  319. package/dist/routing/manifest-codegen.d.ts.map +1 -0
  320. package/dist/routing/scanner.d.ts +1 -10
  321. package/dist/routing/scanner.d.ts.map +1 -1
  322. package/dist/routing/schema-validation.d.ts +35 -0
  323. package/dist/routing/schema-validation.d.ts.map +1 -0
  324. package/dist/routing/segment-classify.d.ts +75 -0
  325. package/dist/routing/segment-classify.d.ts.map +1 -0
  326. package/dist/routing/segment-codegen.d.ts +38 -0
  327. package/dist/routing/segment-codegen.d.ts.map +1 -0
  328. package/dist/routing/types.d.ts +77 -25
  329. package/dist/routing/types.d.ts.map +1 -1
  330. package/dist/routing/walkers.d.ts +51 -0
  331. package/dist/routing/walkers.d.ts.map +1 -0
  332. package/dist/rsc-runtime/rsc.d.ts +1 -1
  333. package/dist/rsc-runtime/rsc.d.ts.map +1 -1
  334. package/dist/rsc-runtime/ssr.d.ts +12 -0
  335. package/dist/rsc-runtime/ssr.d.ts.map +1 -1
  336. package/dist/schema-bridge.d.ts +91 -0
  337. package/dist/schema-bridge.d.ts.map +1 -0
  338. package/dist/search-params/define.d.ts +157 -0
  339. package/dist/search-params/define.d.ts.map +1 -0
  340. package/dist/search-params/index.d.ts +4 -7
  341. package/dist/search-params/index.d.ts.map +1 -1
  342. package/dist/search-params/index.js +37 -440
  343. package/dist/search-params/index.js.map +1 -1
  344. package/dist/search-params/registry.d.ts +2 -2
  345. package/dist/search-params/registry.d.ts.map +1 -1
  346. package/dist/search-params/wrappers.d.ts +53 -0
  347. package/dist/search-params/wrappers.d.ts.map +1 -0
  348. package/dist/segment-params/define.d.ts +89 -0
  349. package/dist/segment-params/define.d.ts.map +1 -0
  350. package/dist/segment-params/index.d.ts +3 -0
  351. package/dist/segment-params/index.d.ts.map +1 -0
  352. package/dist/segment-params/index.js +2 -0
  353. package/dist/server/access-gate.d.ts +8 -3
  354. package/dist/server/access-gate.d.ts.map +1 -1
  355. package/dist/server/action-client.d.ts +41 -6
  356. package/dist/server/action-client.d.ts.map +1 -1
  357. package/dist/server/action-encryption.d.ts +76 -0
  358. package/dist/server/action-encryption.d.ts.map +1 -0
  359. package/dist/server/action-handler.d.ts +35 -1
  360. package/dist/server/action-handler.d.ts.map +1 -1
  361. package/dist/server/actions.d.ts +9 -30
  362. package/dist/server/actions.d.ts.map +1 -1
  363. package/dist/server/als-registry.d.ts +70 -11
  364. package/dist/server/als-registry.d.ts.map +1 -1
  365. package/dist/server/asset-headers.d.ts +1 -15
  366. package/dist/server/asset-headers.d.ts.map +1 -1
  367. package/dist/server/body-limits.d.ts.map +1 -1
  368. package/dist/server/build-manifest.d.ts +6 -29
  369. package/dist/server/build-manifest.d.ts.map +1 -1
  370. package/dist/server/canonicalize.d.ts +10 -0
  371. package/dist/server/canonicalize.d.ts.map +1 -1
  372. package/dist/server/coalesce-tick.d.ts +40 -0
  373. package/dist/server/coalesce-tick.d.ts.map +1 -0
  374. package/dist/server/cookie-context.d.ts +170 -0
  375. package/dist/server/cookie-context.d.ts.map +1 -0
  376. package/dist/server/cookie-parsing.d.ts +51 -0
  377. package/dist/server/cookie-parsing.d.ts.map +1 -0
  378. package/dist/server/csrf.d.ts +3 -2
  379. package/dist/server/csrf.d.ts.map +1 -1
  380. package/dist/server/default-logger.d.ts +22 -0
  381. package/dist/server/default-logger.d.ts.map +1 -0
  382. package/dist/server/deny-boundary.d.ts +115 -0
  383. package/dist/server/deny-boundary.d.ts.map +1 -0
  384. package/dist/server/deny-renderer.d.ts +2 -2
  385. package/dist/server/deny-renderer.d.ts.map +1 -1
  386. package/dist/server/dev-source-map.d.ts +22 -0
  387. package/dist/server/dev-source-map.d.ts.map +1 -0
  388. package/dist/server/early-hints-sender.d.ts.map +1 -1
  389. package/dist/server/early-hints.d.ts +13 -11
  390. package/dist/server/early-hints.d.ts.map +1 -1
  391. package/dist/server/error-boundary-wrapper.d.ts +7 -1
  392. package/dist/server/error-boundary-wrapper.d.ts.map +1 -1
  393. package/dist/server/fallback-error.d.ts +12 -7
  394. package/dist/server/fallback-error.d.ts.map +1 -1
  395. package/dist/server/flight-injection-state.d.ts +66 -0
  396. package/dist/server/flight-injection-state.d.ts.map +1 -0
  397. package/dist/server/flight-scripts.d.ts +42 -0
  398. package/dist/server/flight-scripts.d.ts.map +1 -0
  399. package/dist/server/form-data.d.ts +29 -0
  400. package/dist/server/form-data.d.ts.map +1 -1
  401. package/dist/server/html-injector-core.d.ts +221 -0
  402. package/dist/server/html-injector-core.d.ts.map +1 -0
  403. package/dist/server/html-injectors.d.ts +81 -41
  404. package/dist/server/html-injectors.d.ts.map +1 -1
  405. package/dist/server/index.d.ts +10 -46
  406. package/dist/server/index.d.ts.map +1 -1
  407. package/dist/server/index.js +170 -2911
  408. package/dist/server/index.js.map +1 -1
  409. package/dist/server/internal.d.ts +44 -0
  410. package/dist/server/internal.d.ts.map +1 -0
  411. package/dist/server/internal.js +3015 -0
  412. package/dist/server/internal.js.map +1 -0
  413. package/dist/server/logger.d.ts +39 -7
  414. package/dist/server/logger.d.ts.map +1 -1
  415. package/dist/server/metadata-routes.d.ts +23 -7
  416. package/dist/server/metadata-routes.d.ts.map +1 -1
  417. package/dist/server/middleware-runner.d.ts +36 -4
  418. package/dist/server/middleware-runner.d.ts.map +1 -1
  419. package/dist/server/node-stream-transforms.d.ts +119 -0
  420. package/dist/server/node-stream-transforms.d.ts.map +1 -0
  421. package/dist/server/param-coercion.d.ts +54 -0
  422. package/dist/server/param-coercion.d.ts.map +1 -0
  423. package/dist/server/pipeline-helpers.d.ts +95 -0
  424. package/dist/server/pipeline-helpers.d.ts.map +1 -0
  425. package/dist/server/pipeline-interception.d.ts +1 -1
  426. package/dist/server/pipeline-interception.d.ts.map +1 -1
  427. package/dist/server/pipeline-metadata.d.ts +6 -0
  428. package/dist/server/pipeline-metadata.d.ts.map +1 -1
  429. package/dist/server/pipeline-outcome.d.ts +49 -0
  430. package/dist/server/pipeline-outcome.d.ts.map +1 -0
  431. package/dist/server/pipeline-phases.d.ts +56 -0
  432. package/dist/server/pipeline-phases.d.ts.map +1 -0
  433. package/dist/server/pipeline.d.ts +122 -19
  434. package/dist/server/pipeline.d.ts.map +1 -1
  435. package/dist/server/port-resolution.d.ts +117 -0
  436. package/dist/server/port-resolution.d.ts.map +1 -0
  437. package/dist/server/primitives.d.ts +75 -31
  438. package/dist/server/primitives.d.ts.map +1 -1
  439. package/dist/server/render-timeout.d.ts +51 -0
  440. package/dist/server/render-timeout.d.ts.map +1 -0
  441. package/dist/server/render-utils.d.ts +25 -0
  442. package/dist/server/render-utils.d.ts.map +1 -0
  443. package/dist/server/request-context.d.ts +62 -107
  444. package/dist/server/request-context.d.ts.map +1 -1
  445. package/dist/server/route-element-builder.d.ts +30 -18
  446. package/dist/server/route-element-builder.d.ts.map +1 -1
  447. package/dist/server/route-handler.d.ts.map +1 -1
  448. package/dist/server/route-matcher.d.ts +25 -36
  449. package/dist/server/route-matcher.d.ts.map +1 -1
  450. package/dist/server/rsc-entry/action-middleware-runner.d.ts +66 -0
  451. package/dist/server/rsc-entry/action-middleware-runner.d.ts.map +1 -0
  452. package/dist/server/rsc-entry/api-handler.d.ts +12 -3
  453. package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
  454. package/dist/server/rsc-entry/error-renderer.d.ts +26 -13
  455. package/dist/server/rsc-entry/error-renderer.d.ts.map +1 -1
  456. package/dist/server/rsc-entry/helpers.d.ts +51 -23
  457. package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
  458. package/dist/server/rsc-entry/index.d.ts +19 -8
  459. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  460. package/dist/server/rsc-entry/render-route.d.ts +50 -0
  461. package/dist/server/rsc-entry/render-route.d.ts.map +1 -0
  462. package/dist/server/rsc-entry/revalidate-renderer.d.ts +108 -0
  463. package/dist/server/rsc-entry/revalidate-renderer.d.ts.map +1 -0
  464. package/dist/server/rsc-entry/rsc-payload.d.ts +3 -3
  465. package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
  466. package/dist/server/rsc-entry/rsc-stream.d.ts +17 -1
  467. package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
  468. package/dist/server/rsc-entry/ssr-bridge.d.ts +5 -1
  469. package/dist/server/rsc-entry/ssr-bridge.d.ts.map +1 -1
  470. package/dist/server/rsc-entry/ssr-renderer.d.ts +34 -4
  471. package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
  472. package/dist/server/rsc-entry/wrap-action-dispatch.d.ts +119 -0
  473. package/dist/server/rsc-entry/wrap-action-dispatch.d.ts.map +1 -0
  474. package/dist/server/safe-load.d.ts +46 -0
  475. package/dist/server/safe-load.d.ts.map +1 -0
  476. package/dist/server/sensitive-fields.d.ts +74 -0
  477. package/dist/server/sensitive-fields.d.ts.map +1 -0
  478. package/dist/server/sitemap-generator.d.ts +129 -0
  479. package/dist/server/sitemap-generator.d.ts.map +1 -0
  480. package/dist/server/sitemap-handler.d.ts +22 -0
  481. package/dist/server/sitemap-handler.d.ts.map +1 -0
  482. package/dist/server/slot-resolver.d.ts +7 -5
  483. package/dist/server/slot-resolver.d.ts.map +1 -1
  484. package/dist/server/ssr-bridge-types.d.ts +121 -0
  485. package/dist/server/ssr-bridge-types.d.ts.map +1 -0
  486. package/dist/server/ssr-entry.d.ts +2 -43
  487. package/dist/server/ssr-entry.d.ts.map +1 -1
  488. package/dist/server/ssr-render.d.ts +64 -21
  489. package/dist/server/ssr-render.d.ts.map +1 -1
  490. package/dist/server/ssr-wrappers.d.ts +50 -0
  491. package/dist/server/ssr-wrappers.d.ts.map +1 -0
  492. package/dist/server/state-tree-diff.d.ts +12 -5
  493. package/dist/server/state-tree-diff.d.ts.map +1 -1
  494. package/dist/server/status-code-resolver.d.ts +22 -11
  495. package/dist/server/status-code-resolver.d.ts.map +1 -1
  496. package/dist/server/stream-utils.d.ts +36 -0
  497. package/dist/server/stream-utils.d.ts.map +1 -0
  498. package/dist/server/tracing.d.ts +7 -6
  499. package/dist/server/tracing.d.ts.map +1 -1
  500. package/dist/server/tree-builder.d.ts +62 -30
  501. package/dist/server/tree-builder.d.ts.map +1 -1
  502. package/dist/server/tree-match.d.ts +49 -0
  503. package/dist/server/tree-match.d.ts.map +1 -0
  504. package/dist/server/types.d.ts +71 -6
  505. package/dist/server/types.d.ts.map +1 -1
  506. package/dist/server/utils/escape-html.d.ts +14 -0
  507. package/dist/server/utils/escape-html.d.ts.map +1 -0
  508. package/dist/server/utils/mdx-file.d.ts +15 -0
  509. package/dist/server/utils/mdx-file.d.ts.map +1 -0
  510. package/dist/server/version-skew.d.ts +61 -0
  511. package/dist/server/version-skew.d.ts.map +1 -0
  512. package/dist/shared/head-header.d.ts +54 -0
  513. package/dist/shared/head-header.d.ts.map +1 -0
  514. package/dist/shared/href-validation.d.ts +49 -0
  515. package/dist/shared/href-validation.d.ts.map +1 -0
  516. package/dist/shared/merge-search-params.d.ts +22 -0
  517. package/dist/shared/merge-search-params.d.ts.map +1 -0
  518. package/dist/shared/redirect-type.d.ts +17 -0
  519. package/dist/shared/redirect-type.d.ts.map +1 -0
  520. package/dist/shims/font-google.d.ts +1 -1
  521. package/dist/shims/font-google.d.ts.map +1 -1
  522. package/dist/shims/font-google.js +42 -0
  523. package/dist/shims/font-google.js.map +1 -0
  524. package/dist/shims/font-local.d.ts +26 -0
  525. package/dist/shims/font-local.d.ts.map +1 -0
  526. package/dist/shims/font-local.js +20 -0
  527. package/dist/shims/font-local.js.map +1 -0
  528. package/dist/shims/headers.d.ts +53 -1
  529. package/dist/shims/headers.d.ts.map +1 -1
  530. package/dist/shims/image.d.ts +16 -16
  531. package/dist/shims/navigation-client.d.ts +35 -11
  532. package/dist/shims/navigation-client.d.ts.map +1 -1
  533. package/dist/shims/navigation.d.ts +11 -5
  534. package/dist/shims/navigation.d.ts.map +1 -1
  535. package/dist/utils/state-machine.d.ts +80 -0
  536. package/dist/utils/state-machine.d.ts.map +1 -0
  537. package/package.json +63 -24
  538. package/src/adapters/build-output-helper.ts +139 -0
  539. package/src/adapters/cloudflare-dev.ts +177 -0
  540. package/src/adapters/cloudflare-kv-cache.ts +179 -0
  541. package/src/adapters/cloudflare.ts +356 -116
  542. package/src/adapters/compress-module.ts +27 -92
  543. package/src/adapters/nitro.ts +155 -99
  544. package/src/adapters/raw-imports.d.ts +5 -0
  545. package/src/adapters/shared.ts +40 -0
  546. package/src/adapters/wrangler.d.ts +7 -0
  547. package/src/cache/cache-api.ts +47 -0
  548. package/src/cache/handler-store.ts +68 -0
  549. package/src/cache/index.ts +84 -18
  550. package/src/cache/invalidation-epoch.ts +93 -0
  551. package/src/cache/redis-handler.ts +110 -15
  552. package/src/cache/singleflight.ts +62 -4
  553. package/src/cache/sizeof.ts +33 -0
  554. package/src/cache/stable-stringify.ts +65 -2
  555. package/src/cache/timber-cache.ts +132 -36
  556. package/src/cli-schema-sync.ts +388 -0
  557. package/src/cli.ts +98 -34
  558. package/src/client/browser-dev.ts +153 -1
  559. package/src/client/browser-entry/action-dispatch.ts +119 -0
  560. package/src/client/browser-entry/hmr.ts +70 -0
  561. package/src/client/browser-entry/hydrate.ts +187 -0
  562. package/src/client/browser-entry/index.ts +111 -0
  563. package/src/client/browser-entry/post-hydration.ts +104 -0
  564. package/src/client/browser-entry/router-init.ts +292 -0
  565. package/src/client/browser-entry/rsc-stream.ts +157 -0
  566. package/src/client/browser-entry/scroll.ts +50 -0
  567. package/src/client/error-boundary.tsx +127 -22
  568. package/src/client/error-reconstituter.tsx +79 -0
  569. package/src/client/form.tsx +31 -32
  570. package/src/client/history.ts +11 -3
  571. package/src/client/index.ts +67 -45
  572. package/src/client/internal.ts +58 -0
  573. package/src/client/link.tsx +346 -150
  574. package/src/client/navigation-api-types.ts +112 -0
  575. package/src/client/navigation-api.ts +347 -0
  576. package/src/client/navigation-context.ts +15 -7
  577. package/src/client/navigation-root.tsx +355 -0
  578. package/src/client/nuqs-adapter.tsx +16 -3
  579. package/src/client/router-ref.ts +1 -1
  580. package/src/client/router.ts +490 -140
  581. package/src/client/rsc-fetch.ts +220 -17
  582. package/src/client/segment-cache.ts +6 -3
  583. package/src/client/segment-outlet.tsx +77 -0
  584. package/src/client/segment-update-context.ts +42 -0
  585. package/src/client/shallow-url.ts +22 -0
  586. package/src/client/ssr-data.ts +13 -5
  587. package/src/client/state.ts +2 -2
  588. package/src/client/top-loader.tsx +11 -9
  589. package/src/client/use-cookie.ts +31 -2
  590. package/src/client/use-link-status.ts +7 -7
  591. package/src/client/use-pathname.ts +1 -0
  592. package/src/client/use-pending-navigation.ts +40 -0
  593. package/src/client/use-query-states.ts +9 -3
  594. package/src/client/use-router.ts +4 -1
  595. package/src/client/use-search-params.ts +31 -44
  596. package/src/client/{use-params.ts → use-segment-params.ts} +9 -6
  597. package/src/codec.ts +147 -0
  598. package/src/config-types.ts +292 -0
  599. package/src/config-validation.ts +311 -0
  600. package/src/content/index.ts +5 -13
  601. package/src/cookies/define-cookie.ts +217 -53
  602. package/src/cookies/index.ts +12 -1
  603. package/src/cookies/json-cookie.ts +105 -0
  604. package/src/cookies/validation.ts +192 -0
  605. package/src/dev-tools/404-page.ts +286 -0
  606. package/src/dev-tools/browser-logs.ts +291 -0
  607. package/src/dev-tools/dev-page-shell.ts +260 -0
  608. package/src/dev-tools/error-page.ts +331 -0
  609. package/src/dev-tools/holding-server.ts +187 -0
  610. package/src/dev-tools/hydration-overlay.ts +158 -0
  611. package/src/dev-tools/index.ts +83 -0
  612. package/src/dev-tools/instrumentation.ts +213 -0
  613. package/src/{plugins/dev-logs.ts → dev-tools/logs.ts} +9 -5
  614. package/src/dev-tools/overlay.ts +469 -0
  615. package/src/dev-tools/stack-classifier.ts +75 -0
  616. package/src/dev-tools/terminal.ts +183 -0
  617. package/src/fonts/ast-walk.ts +235 -0
  618. package/src/fonts/ast.ts +477 -126
  619. package/src/fonts/bundle.ts +138 -0
  620. package/src/fonts/dev-middleware.ts +85 -0
  621. package/src/fonts/fallbacks.ts +0 -23
  622. package/src/fonts/google.ts +7 -3
  623. package/src/fonts/local.ts +9 -8
  624. package/src/fonts/paths.ts +58 -0
  625. package/src/fonts/pipeline.ts +316 -0
  626. package/src/fonts/transform.ts +344 -0
  627. package/src/fonts/types.ts +52 -1
  628. package/src/fonts/virtual-modules.ts +179 -0
  629. package/src/index.ts +417 -346
  630. package/src/params/codec-registry.ts +34 -0
  631. package/src/params/define-schema.ts +115 -0
  632. package/src/params/index.ts +17 -0
  633. package/src/params/resolve-schema.ts +84 -0
  634. package/src/plugin-context.ts +325 -0
  635. package/src/plugins/adapter-build.ts +98 -4
  636. package/src/plugins/build-manifest.ts +168 -23
  637. package/src/plugins/build-report.ts +16 -25
  638. package/src/plugins/cache.ts +285 -0
  639. package/src/plugins/client-chunks.ts +113 -0
  640. package/src/plugins/cloudflare-wasm.ts +141 -0
  641. package/src/plugins/content.ts +1 -1
  642. package/src/plugins/dev-server.ts +293 -46
  643. package/src/plugins/entries.ts +110 -8
  644. package/src/plugins/fonts.ts +170 -663
  645. package/src/plugins/mdx.ts +47 -10
  646. package/src/plugins/routing.ts +237 -241
  647. package/src/plugins/server-bundle.ts +85 -12
  648. package/src/plugins/shims.ts +207 -64
  649. package/src/plugins/static-build.ts +15 -89
  650. package/src/routing/codegen-shared.ts +115 -0
  651. package/src/routing/codegen-types.ts +65 -0
  652. package/src/routing/codegen.ts +380 -178
  653. package/src/routing/convention-lint.ts +358 -0
  654. package/src/routing/file-cache.ts +23 -0
  655. package/src/routing/index.ts +10 -1
  656. package/src/routing/interception.ts +3 -22
  657. package/src/routing/link-codegen.ts +310 -0
  658. package/src/routing/manifest-codegen.ts +290 -0
  659. package/src/routing/scanner.ts +248 -188
  660. package/src/routing/schema-validation.ts +149 -0
  661. package/src/routing/segment-classify.ts +188 -0
  662. package/src/routing/segment-codegen.ts +98 -0
  663. package/src/routing/types.ts +78 -25
  664. package/src/routing/walkers.ts +90 -0
  665. package/src/rsc-runtime/rsc.ts +2 -0
  666. package/src/rsc-runtime/ssr.ts +50 -0
  667. package/src/rsc-runtime/vendor-types.d.ts +7 -0
  668. package/src/schema-bridge.ts +252 -0
  669. package/src/search-params/define.ts +570 -0
  670. package/src/search-params/index.ts +14 -20
  671. package/src/search-params/registry.ts +2 -2
  672. package/src/search-params/wrappers.ts +110 -0
  673. package/src/segment-params/define.ts +249 -0
  674. package/src/segment-params/index.ts +9 -0
  675. package/src/server/access-gate.tsx +84 -34
  676. package/src/server/action-client.ts +119 -28
  677. package/src/server/action-encryption.ts +144 -0
  678. package/src/server/action-handler.ts +122 -16
  679. package/src/server/actions.ts +39 -53
  680. package/src/server/als-registry.ts +108 -20
  681. package/src/server/asset-headers.ts +8 -34
  682. package/src/server/body-limits.ts +10 -2
  683. package/src/server/build-manifest.ts +13 -56
  684. package/src/server/canonicalize.ts +6 -3
  685. package/src/server/coalesce-tick.ts +75 -0
  686. package/src/server/compress.ts +34 -7
  687. package/src/server/cookie-context.ts +484 -0
  688. package/src/server/cookie-parsing.ts +147 -0
  689. package/src/server/csrf.ts +39 -6
  690. package/src/server/default-logger.ts +99 -0
  691. package/src/server/deny-boundary.ts +311 -0
  692. package/src/server/deny-renderer.ts +80 -64
  693. package/src/server/dev-source-map.ts +31 -0
  694. package/src/server/early-hints-sender.ts +3 -2
  695. package/src/server/early-hints.ts +37 -27
  696. package/src/server/error-boundary-wrapper.ts +61 -22
  697. package/src/server/fallback-error.ts +79 -102
  698. package/src/server/flight-injection-state.ts +113 -0
  699. package/src/server/flight-scripts.ts +62 -0
  700. package/src/server/form-data.ts +101 -5
  701. package/src/server/html-injector-core.ts +437 -0
  702. package/src/server/html-injectors.ts +256 -251
  703. package/src/server/index.ts +29 -183
  704. package/src/server/internal.ts +165 -0
  705. package/src/server/logger.ts +67 -36
  706. package/src/server/metadata-routes.ts +44 -19
  707. package/src/server/middleware-runner.ts +75 -4
  708. package/src/server/node-stream-transforms.ts +331 -0
  709. package/src/server/param-coercion.ts +206 -0
  710. package/src/server/pipeline-helpers.ts +204 -0
  711. package/src/server/pipeline-interception.ts +32 -18
  712. package/src/server/pipeline-metadata.ts +13 -0
  713. package/src/server/pipeline-outcome.ts +197 -0
  714. package/src/server/pipeline-phases.ts +527 -0
  715. package/src/server/pipeline.ts +213 -382
  716. package/src/server/port-resolution.ts +215 -0
  717. package/src/server/primitives.ts +126 -63
  718. package/src/server/render-timeout.ts +108 -0
  719. package/src/server/render-utils.ts +31 -0
  720. package/src/server/request-context.ts +168 -337
  721. package/src/server/route-element-builder.ts +481 -222
  722. package/src/server/route-handler.ts +31 -4
  723. package/src/server/route-matcher.ts +144 -277
  724. package/src/server/rsc-entry/action-middleware-runner.ts +167 -0
  725. package/src/server/rsc-entry/api-handler.ts +69 -32
  726. package/src/server/rsc-entry/error-renderer.ts +306 -89
  727. package/src/server/rsc-entry/helpers.ts +160 -59
  728. package/src/server/rsc-entry/index.ts +299 -329
  729. package/src/server/rsc-entry/render-route.ts +311 -0
  730. package/src/server/rsc-entry/revalidate-renderer.ts +344 -0
  731. package/src/server/rsc-entry/rsc-payload.ts +71 -26
  732. package/src/server/rsc-entry/rsc-stream.ts +85 -13
  733. package/src/server/rsc-entry/ssr-bridge.ts +18 -5
  734. package/src/server/rsc-entry/ssr-renderer.ts +273 -43
  735. package/src/server/rsc-entry/wrap-action-dispatch.ts +449 -0
  736. package/src/server/safe-load.ts +60 -0
  737. package/src/server/sensitive-fields.ts +230 -0
  738. package/src/server/sitemap-generator.ts +338 -0
  739. package/src/server/sitemap-handler.ts +148 -0
  740. package/src/server/slot-resolver.ts +258 -257
  741. package/src/server/ssr-bridge-types.ts +124 -0
  742. package/src/server/ssr-entry.ts +206 -78
  743. package/src/server/ssr-render.ts +345 -82
  744. package/src/server/ssr-wrappers.tsx +141 -0
  745. package/src/server/state-tree-diff.ts +30 -23
  746. package/src/server/status-code-resolver.ts +115 -130
  747. package/src/server/stream-utils.ts +213 -0
  748. package/src/server/tracing.ts +38 -11
  749. package/src/server/tree-builder.ts +204 -90
  750. package/src/server/tree-match.ts +220 -0
  751. package/src/server/types.ts +78 -9
  752. package/src/server/utils/escape-html.ts +20 -0
  753. package/src/server/utils/mdx-file.ts +22 -0
  754. package/src/server/version-skew.ts +104 -0
  755. package/src/shared/head-header.ts +69 -0
  756. package/src/shared/href-validation.ts +159 -0
  757. package/src/shared/merge-search-params.ts +55 -0
  758. package/src/shared/redirect-type.ts +17 -0
  759. package/src/shims/font-google.ts +1 -1
  760. package/src/shims/font-local.ts +34 -0
  761. package/src/shims/headers.ts +122 -1
  762. package/src/shims/navigation-client.ts +51 -29
  763. package/src/shims/navigation.ts +14 -7
  764. package/src/utils/state-machine.ts +111 -0
  765. package/dist/_chunks/als-registry-B7DbZ2hS.js +0 -41
  766. package/dist/_chunks/als-registry-B7DbZ2hS.js.map +0 -1
  767. package/dist/_chunks/debug-B3Gypr3D.js +0 -108
  768. package/dist/_chunks/debug-B3Gypr3D.js.map +0 -1
  769. package/dist/_chunks/format-RyoGQL74.js +0 -164
  770. package/dist/_chunks/format-RyoGQL74.js.map +0 -1
  771. package/dist/_chunks/interception-BOoWmLUA.js +0 -676
  772. package/dist/_chunks/interception-BOoWmLUA.js.map +0 -1
  773. package/dist/_chunks/metadata-routes-Cjmvi3rQ.js.map +0 -1
  774. package/dist/_chunks/request-context-BQUC8PHn.js +0 -330
  775. package/dist/_chunks/request-context-BQUC8PHn.js.map +0 -1
  776. package/dist/_chunks/ssr-data-MjmprTmO.js.map +0 -1
  777. package/dist/_chunks/tracing-CemImE6h.js +0 -187
  778. package/dist/_chunks/tracing-CemImE6h.js.map +0 -1
  779. package/dist/_chunks/use-cookie-DX-l1_5E.js +0 -91
  780. package/dist/_chunks/use-cookie-DX-l1_5E.js.map +0 -1
  781. package/dist/_chunks/use-query-states-D5KaffOK.js.map +0 -1
  782. package/dist/cache/register-cached-function.d.ts +0 -17
  783. package/dist/cache/register-cached-function.d.ts.map +0 -1
  784. package/dist/client/browser-entry.d.ts +0 -21
  785. package/dist/client/browser-entry.d.ts.map +0 -1
  786. package/dist/client/link-status-provider.d.ts +0 -11
  787. package/dist/client/link-status-provider.d.ts.map +0 -1
  788. package/dist/client/segment-merger.d.ts +0 -119
  789. package/dist/client/segment-merger.d.ts.map +0 -1
  790. package/dist/client/stale-reload.d.ts +0 -44
  791. package/dist/client/stale-reload.d.ts.map +0 -1
  792. package/dist/client/transition-root.d.ts +0 -74
  793. package/dist/client/transition-root.d.ts.map +0 -1
  794. package/dist/client/use-navigation-pending.d.ts +0 -26
  795. package/dist/client/use-navigation-pending.d.ts.map +0 -1
  796. package/dist/client/use-params.d.ts.map +0 -1
  797. package/dist/plugins/cache-transform.d.ts +0 -36
  798. package/dist/plugins/cache-transform.d.ts.map +0 -1
  799. package/dist/plugins/dev-error-overlay.d.ts +0 -60
  800. package/dist/plugins/dev-error-overlay.d.ts.map +0 -1
  801. package/dist/plugins/dev-logs.d.ts.map +0 -1
  802. package/dist/plugins/dynamic-transform.d.ts +0 -72
  803. package/dist/plugins/dynamic-transform.d.ts.map +0 -1
  804. package/dist/plugins/server-action-exports.d.ts +0 -26
  805. package/dist/plugins/server-action-exports.d.ts.map +0 -1
  806. package/dist/routing/status-file-lint.d.ts +0 -33
  807. package/dist/routing/status-file-lint.d.ts.map +0 -1
  808. package/dist/search-params/analyze.d.ts +0 -54
  809. package/dist/search-params/analyze.d.ts.map +0 -1
  810. package/dist/search-params/builtin-codecs.d.ts +0 -105
  811. package/dist/search-params/builtin-codecs.d.ts.map +0 -1
  812. package/dist/search-params/codecs.d.ts +0 -53
  813. package/dist/search-params/codecs.d.ts.map +0 -1
  814. package/dist/search-params/create.d.ts +0 -106
  815. package/dist/search-params/create.d.ts.map +0 -1
  816. package/dist/server/dev-fetch-instrumentation.d.ts +0 -22
  817. package/dist/server/dev-fetch-instrumentation.d.ts.map +0 -1
  818. package/dist/server/dev-logger.d.ts.map +0 -1
  819. package/dist/server/dev-span-processor.d.ts +0 -29
  820. package/dist/server/dev-span-processor.d.ts.map +0 -1
  821. package/dist/server/dev-warnings.d.ts +0 -129
  822. package/dist/server/dev-warnings.d.ts.map +0 -1
  823. package/dist/server/flush.d.ts +0 -74
  824. package/dist/server/flush.d.ts.map +0 -1
  825. package/dist/server/manifest-status-resolver.d.ts +0 -58
  826. package/dist/server/manifest-status-resolver.d.ts.map +0 -1
  827. package/dist/server/prerender.d.ts +0 -77
  828. package/dist/server/prerender.d.ts.map +0 -1
  829. package/dist/utils/directive-parser.d.ts +0 -70
  830. package/dist/utils/directive-parser.d.ts.map +0 -1
  831. package/src/cache/register-cached-function.ts +0 -103
  832. package/src/client/browser-entry.ts +0 -678
  833. package/src/client/link-status-provider.tsx +0 -30
  834. package/src/client/segment-merger.ts +0 -339
  835. package/src/client/stale-reload.ts +0 -87
  836. package/src/client/transition-root.tsx +0 -166
  837. package/src/client/use-navigation-pending.ts +0 -38
  838. package/src/plugins/cache-transform.ts +0 -199
  839. package/src/plugins/dev-error-overlay.ts +0 -230
  840. package/src/plugins/dynamic-transform.ts +0 -161
  841. package/src/plugins/server-action-exports.ts +0 -220
  842. package/src/routing/status-file-lint.ts +0 -112
  843. package/src/search-params/analyze.ts +0 -192
  844. package/src/search-params/builtin-codecs.ts +0 -228
  845. package/src/search-params/codecs.ts +0 -153
  846. package/src/search-params/create.ts +0 -321
  847. package/src/server/dev-fetch-instrumentation.ts +0 -96
  848. package/src/server/dev-span-processor.ts +0 -78
  849. package/src/server/dev-warnings.ts +0 -283
  850. package/src/server/flush.ts +0 -182
  851. package/src/server/manifest-status-resolver.ts +0 -215
  852. package/src/server/prerender.ts +0 -139
  853. package/src/utils/directive-parser.ts +0 -529
  854. /package/src/{server/dev-logger.ts → dev-tools/logger.ts} +0 -0
@@ -0,0 +1,790 @@
1
+ import { n as classifyUrlSegment } from "./segment-classify-CDDRVKs7.js";
2
+ import { a as parseExistingSchemaKeys, r as findSchemaFile } from "./cli-schema-sync-DJDdyEae.js";
3
+ import { join, posix, relative } from "node:path";
4
+ import { existsSync, readFileSync, statSync } from "node:fs";
5
+ //#region src/routing/codegen-shared.ts
6
+ /**
7
+ * Shared codegen helpers — import-path computation, codec chain type
8
+ * builder, and searchParams type formatter.
9
+ *
10
+ * Extracted from `codegen.ts` so `link-codegen.ts` can use the same
11
+ * helpers without a cyclic import.
12
+ */
13
+ /**
14
+ * Compute a relative import specifier for a codec/page file, stripping
15
+ * the .ts/.tsx extension and resolving against the codegen output dir.
16
+ */
17
+ function codecImportPath(codecFilePath, importBase) {
18
+ const absPath = codecFilePath.replace(/\.(ts|tsx)$/, "");
19
+ if (importBase) return "./" + relative(importBase, absPath).replace(/\\/g, "/");
20
+ return "./" + posix.basename(absPath);
21
+ }
22
+ /** Name of the shared helper type emitted at the top of the .d.ts. */
23
+ var RESOLVE_SEGMENT_FIELD_TYPE_NAME = "_TimberResolveSegmentField";
24
+ /**
25
+ * Helper type emitted once at the top of the generated `.d.ts` and
26
+ * referenced by every codec-chain conditional. Without this shared
27
+ * helper, the inline expansion would duplicate the fallback branch on
28
+ * every step and grow O(2^N) in chain depth (a single deep nested route
29
+ * could blow up the file size and TS performance). With the helper,
30
+ * each step reuses the named type and growth is O(N).
31
+ *
32
+ * The helper is a 2-arg conditional: given a typeof import expression
33
+ * (`Def`), a key (`K`), and a fallback (`F`), it returns `T[K]` if
34
+ * `Def extends ParamsDefinition<T>` and `K extends keyof T`, otherwise
35
+ * `F`. The codec chain composes calls to this helper.
36
+ */
37
+ function emitResolveSegmentFieldHelper() {
38
+ return [
39
+ `type ${RESOLVE_SEGMENT_FIELD_TYPE_NAME}<Def, K extends string, F> =`,
40
+ ` Def extends import('@timber-js/app/segment-params').ParamsDefinition<infer T>`,
41
+ ` ? K extends keyof T ? T[K] : F`,
42
+ ` : F;`
43
+ ].join("\n");
44
+ }
45
+ /**
46
+ * Build a TypeScript type expression that resolves a single param's
47
+ * codec by walking a chain of params.ts files in priority order.
48
+ *
49
+ * Each entry in the chain emits one application of the shared
50
+ * `_TimberResolveSegmentField` helper type. Composing N applications
51
+ * grows linearly with chain depth (O(N) characters), unlike an inline
52
+ * conditional that would duplicate the fallback in each branch and
53
+ * grow O(2^N).
54
+ *
55
+ * The closest match (position 0 in the chain) is checked first; if its
56
+ * `segmentParams` definition declares the key, its inferred type wins.
57
+ * Otherwise we fall through to the next entry, and finally to the
58
+ * provided fallback. See TIM-834.
59
+ */
60
+ function buildCodecChainType(p, importBase, fallback) {
61
+ const files = p.codecFilePaths;
62
+ if (!files || files.length === 0) return fallback;
63
+ const key = JSON.stringify(p.name);
64
+ let inner = fallback;
65
+ for (let i = files.length - 1; i >= 0; i--) inner = `${RESOLVE_SEGMENT_FIELD_TYPE_NAME}<(typeof import('${codecImportPath(files[i], importBase)}'))['segmentParams'], ${key}, ${inner}>`;
66
+ return inner;
67
+ }
68
+ /**
69
+ * Build a TypeScript type expression for a single param using the global
70
+ * schema's InferCodecType. Falls back to the param's base type when
71
+ * schema doesn't declare this param (schemas are opt-in per key).
72
+ *
73
+ * Uses `infer` to extract the codec value rather than direct indexing
74
+ * because TypeScript doesn't narrow index validity inside a conditional
75
+ * type's true branch — `typeof schema.segmentParams[K]` produces TS2538
76
+ * even when the condition proves K is a valid key. In .d.ts files that
77
+ * error is suppressed and the type silently becomes `any`.
78
+ */
79
+ function buildSchemaParamType(p, fallback) {
80
+ return `typeof schema['segmentParams'] extends Record<${JSON.stringify(p.bracketName)}, infer V> ? InferCodecType<V> : ${fallback ?? p.type}`;
81
+ }
82
+ /**
83
+ * Format the searchParams type for a route entry.
84
+ *
85
+ * When a page.tsx (or params.ts) exports searchParams, we reference its
86
+ * inferred type via an import type. The import path is relative to
87
+ * `importBase` (the directory where the .d.ts will be written). When
88
+ * importBase is undefined, falls back to a bare relative path.
89
+ */
90
+ function formatSearchParamsType(route, importBase) {
91
+ 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`;
92
+ return "{}";
93
+ }
94
+ //#endregion
95
+ //#region src/routing/file-cache.ts
96
+ var cache = /* @__PURE__ */ new Map();
97
+ /**
98
+ * Read a file's text content, returning a cached copy when the file
99
+ * hasn't been modified since the last read (checked via mtime + size).
100
+ *
101
+ * Falls back to a fresh read on any stat/read error.
102
+ */
103
+ function readFileCached(filePath) {
104
+ try {
105
+ const stat = statSync(filePath);
106
+ const entry = cache.get(filePath);
107
+ if (entry && entry.mtimeMs === stat.mtimeMs && entry.size === stat.size) return entry.content;
108
+ const content = readFileSync(filePath, "utf-8");
109
+ cache.set(filePath, {
110
+ mtimeMs: stat.mtimeMs,
111
+ size: stat.size,
112
+ content
113
+ });
114
+ return content;
115
+ } catch {
116
+ cache.delete(filePath);
117
+ return readFileSync(filePath, "utf-8");
118
+ }
119
+ }
120
+ //#endregion
121
+ //#region src/routing/link-codegen.ts
122
+ /** Shared Link base-props type literal used in every emitted call signature. */
123
+ 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 }";
124
+ /**
125
+ * Build a TypeScript template literal pattern for a dynamic route.
126
+ * e.g. '/products/[id]' → '/products/${string}'
127
+ * '/blog/[...slug]' → '/blog/${string}'
128
+ * '/docs/[[...path]]' → '/docs/${string}' (also matches /docs)
129
+ * '/[org]/[repo]' → '/${string}/${string}'
130
+ */
131
+ function buildResolvedPattern(route) {
132
+ return route.urlPath.split("/").map((part) => {
133
+ if (part.startsWith("[[...") && part.endsWith("]]")) return "${string}";
134
+ if (part.startsWith("[...") && part.endsWith("]")) return "${string}";
135
+ if (part.startsWith("[") && part.endsWith("]")) return "${string}";
136
+ return part;
137
+ }).join("/");
138
+ }
139
+ /**
140
+ * Format the segmentParams type for Link overloads.
141
+ *
142
+ * Link params accept `string | number` for single dynamic segments
143
+ * (convenience — values are stringified at runtime). Catch-all and
144
+ * optional catch-all remain `string[]` / `string[] | undefined`.
145
+ *
146
+ * When the segment's params chain (TIM-834) declares a typed codec, the
147
+ * inferred type from the codec wins via a nested conditional.
148
+ */
149
+ function formatLinkParamsType(params, importBase, hasSchema) {
150
+ if (params.length === 0) return "{}";
151
+ return `{ ${params.map((p) => {
152
+ const fallback = p.type === "string" ? "string | number" : p.type;
153
+ const codecType = hasSchema ? buildSchemaParamType(p, fallback) : buildCodecChainType(p, importBase, fallback);
154
+ return `${p.name}: ${codecType}`;
155
+ }).join("; ")} }`;
156
+ }
157
+ /**
158
+ * Catch-all call signatures for `<Link>` — external hrefs and computed
159
+ * `string` variables. Emitted from codegen in a SEPARATE
160
+ * `declare module` block (declared AFTER the per-route block) so the TS
161
+ * "later overload set ordered first" rule places these catch-all
162
+ * signatures ahead of per-route in resolution order, leaving per-route
163
+ * as the final overload whose error message is reported on failure.
164
+ *
165
+ * The conditional `string extends H ? ... : never` protection preserves
166
+ * TIM-624's guarantee that unknown internal path literals don't match
167
+ * the catch-all — typos like `<Link href="/typo" />` still error.
168
+ */
169
+ function formatLinkCatchAllOverloads() {
170
+ const lines = [];
171
+ const baseProps = LINK_BASE_PROPS_TYPE;
172
+ const catchAllSearchParams = "{ definition: SearchParamsDefinition<Record<string, unknown>>; values: Record<string, unknown> } | Record<string, unknown>";
173
+ const externalHref = "`http://${string}` | `https://${string}` | `mailto:${string}` | `tel:${string}` | `ftp://${string}` | `//${string}` | `#${string}` | `?${string}`";
174
+ lines.push(" // Typed Link overloads — catch-all (block 2 / emitted second)");
175
+ lines.push(" interface LinkFunction {");
176
+ lines.push(` (props: ${baseProps} & {`);
177
+ lines.push(` href: ${externalHref}`);
178
+ lines.push(` segmentParams?: Record<string, unknown>`);
179
+ lines.push(` searchParams?: ${catchAllSearchParams}`);
180
+ lines.push(` }): import('react').JSX.Element`);
181
+ lines.push(` <H extends string>(`);
182
+ lines.push(` props: ${baseProps} & {`);
183
+ lines.push(` href: string extends H ? H : never`);
184
+ lines.push(` segmentParams?: Record<string, string | number | string[]>`);
185
+ lines.push(` searchParams?: ${catchAllSearchParams}`);
186
+ lines.push(` }`);
187
+ lines.push(` ): import('react').JSX.Element`);
188
+ lines.push(" }");
189
+ return lines;
190
+ }
191
+ /**
192
+ * Generate typed per-route Link call signatures via LinkFunction
193
+ * interface merging.
194
+ *
195
+ * TIM-835: This emits a SINGLE call signature whose props is a
196
+ * discriminated union keyed on `href`. TypeScript narrows the union by
197
+ * the literal `href` at the call site, then checks the rest of the
198
+ * props against the matched variant. When `segmentParams` or
199
+ * `searchParams` is wrong, TS reports the error against the matched
200
+ * variant — naming the user's actual `href` and the offending field.
201
+ *
202
+ * Before TIM-835, this function emitted N separate per-route overloads
203
+ * (one per route, sometimes two for dynamic routes). When ALL overloads
204
+ * failed, TS would pick an arbitrary failed overload (heuristically the
205
+ * "last tried") to render the diagnostic, often pointing at a route
206
+ * completely unrelated to the one the user wrote. The discriminated
207
+ * union sidesteps overload-resolution heuristics entirely.
208
+ *
209
+ * Open property shapes (`Record<string, unknown>` instead of `never`)
210
+ * for `segmentParams` on routes that don't declare them keep generic
211
+ * `LinkProps`-spreading wrappers compiling. (Aligned with TIM-833.)
212
+ *
213
+ * TIM-832: this function still emits the per-route block FIRST and the
214
+ * catch-all block follows, so per-route remains the LAST overload set in
215
+ * resolution order — the one TS reports against on failure. With a
216
+ * discriminated union there is only one call signature in this block,
217
+ * so the resolved-template-vs-pattern ordering reduces to placing the
218
+ * pattern variant before the resolved-template variant inside the union.
219
+ */
220
+ function formatTypedLinkOverloads(routes, importBase, hasSchema) {
221
+ const lines = [];
222
+ const baseProps = LINK_BASE_PROPS_TYPE;
223
+ const variants = [];
224
+ for (const route of routes) {
225
+ const hasDynamicParams = route.params.length > 0;
226
+ const paramsProp = hasDynamicParams ? `segmentParams: ${formatLinkParamsType(route.params, importBase, hasSchema)}` : "segmentParams?: Record<string, unknown>";
227
+ const searchParamsType = route.hasSearchParams ? formatSearchParamsType(route, importBase) : null;
228
+ const patternSearchParamsProp = searchParamsType ? `searchParams?: Partial<${searchParamsType}>` : "searchParams?: Record<string, unknown>";
229
+ variants.push(`${baseProps} & { href: '${route.urlPath}'; ${paramsProp}; ${patternSearchParamsProp} }`);
230
+ if (hasDynamicParams) {
231
+ const templatePattern = buildResolvedPattern(route);
232
+ if (templatePattern) {
233
+ const resolvedSearchParamsProp = searchParamsType ? `searchParams?: { definition: SearchParamsDefinition<${searchParamsType}>; values: Partial<${searchParamsType}> }` : "searchParams?: Record<string, unknown>";
234
+ variants.push(`${baseProps} & { href: \`${templatePattern}\`; segmentParams?: Record<string, never>; ${resolvedSearchParamsProp} }`);
235
+ }
236
+ }
237
+ }
238
+ lines.push(" interface LinkFunction {");
239
+ if (variants.length === 0) {
240
+ lines.push(" }");
241
+ return lines;
242
+ }
243
+ lines.push(" (");
244
+ lines.push(" props:");
245
+ for (const variant of variants) lines.push(` | (${variant})`);
246
+ lines.push(` ): import('react').JSX.Element`);
247
+ lines.push(" }");
248
+ return lines;
249
+ }
250
+ //#endregion
251
+ //#region src/routing/codegen.ts
252
+ /**
253
+ * Route map codegen.
254
+ *
255
+ * Walks the scanned RouteTree and generates a TypeScript declaration file
256
+ * mapping every route to its params and searchParams shapes.
257
+ *
258
+ * This runs at build time and in dev (regenerated on file changes).
259
+ * No runtime overhead — purely static type generation.
260
+ */
261
+ /**
262
+ * Generate a TypeScript declaration file string from a scanned route tree.
263
+ *
264
+ * The output is a `declare module '@timber-js/app'` block containing the Routes
265
+ * interface that maps every route path to its params and searchParams shape.
266
+ */
267
+ function generateRouteMap(tree, options = {}) {
268
+ const hasSchema = options.hasSchema ?? detectSchema(options.appDir);
269
+ const routes = [];
270
+ collectRoutes(tree.root, [], [], "", routes, hasSchema, false);
271
+ routes.sort((a, b) => a.urlPath.localeCompare(b.urlPath));
272
+ return formatDeclarationFile(routes, options.outputDir ?? options.appDir, hasSchema, options.appDir);
273
+ }
274
+ /** Schema file extensions to check, in priority order. */
275
+ var SCHEMA_EXTENSIONS = [
276
+ ".ts",
277
+ ".tsx",
278
+ ".js",
279
+ ".jsx"
280
+ ];
281
+ /**
282
+ * Detect whether app/schema.{ts,tsx,js,jsx} exists.
283
+ */
284
+ function detectSchema(appDir) {
285
+ if (!appDir) return false;
286
+ return SCHEMA_EXTENSIONS.some((ext) => existsSync(join(appDir, `schema${ext}`)));
287
+ }
288
+ /**
289
+ * Recursively walk the segment tree and collect route entries.
290
+ *
291
+ * A route entry is created for any segment that has a `page` or `route` file.
292
+ * Params accumulate from ancestor dynamic segments.
293
+ */
294
+ function collectRoutes(node, ancestorParams, ancestorParamsFiles, parentTreePath, routes, hasSchema, insideSlot) {
295
+ const treePath = node.segmentName ? `${parentTreePath}/${node.segmentName}` : parentTreePath;
296
+ const ownParamsFile = node.params && fileHasExport(node.params.filePath, "segmentParams") ? node.params.filePath : void 0;
297
+ const params = [...ancestorParams];
298
+ if (node.paramName) {
299
+ const legacyFallback = ownParamsFile ? void 0 : findLegacyParamsExport(node);
300
+ params.push({
301
+ name: node.paramName,
302
+ bracketName: node.segmentName,
303
+ type: paramTypeForSegment(node.segmentType),
304
+ legacyCodecFilePath: legacyFallback
305
+ });
306
+ }
307
+ const nextAncestorFiles = ownParamsFile ? [...ancestorParamsFiles, ownParamsFile] : ancestorParamsFiles;
308
+ const isPage = !!node.page;
309
+ const isApiRoute = !!node.route;
310
+ if (isPage || isApiRoute) {
311
+ const leafFirstChain = nextAncestorFiles.length > 0 ? [...nextAncestorFiles].reverse() : [];
312
+ const resolvedParams = params.map((p) => {
313
+ const codecFilePaths = leafFirstChain.length > 0 ? leafFirstChain : p.legacyCodecFilePath ? [p.legacyCodecFilePath] : void 0;
314
+ return {
315
+ name: p.name,
316
+ bracketName: p.bracketName,
317
+ type: p.type,
318
+ codecFilePaths
319
+ };
320
+ });
321
+ const entry = {
322
+ urlPath: node.urlPath,
323
+ segmentPath: treePath || "/",
324
+ params: resolvedParams,
325
+ hasSearchParams: false,
326
+ isApiRoute,
327
+ isSlotRoute: insideSlot,
328
+ hasSchema
329
+ };
330
+ if (isPage) {
331
+ if (node.params && fileHasExport(node.params.filePath, "searchParams")) {
332
+ entry.hasSearchParams = true;
333
+ entry.searchParamsPagePath = node.params.filePath;
334
+ } else if (node.page && fileHasExport(node.page.filePath, "searchParams")) {
335
+ entry.hasSearchParams = true;
336
+ entry.searchParamsPagePath = node.page.filePath;
337
+ }
338
+ }
339
+ routes.push(entry);
340
+ }
341
+ for (const child of node.children) collectRoutes(child, params, nextAncestorFiles, treePath, routes, hasSchema, insideSlot);
342
+ for (const slot of Object.values(node.slots)) collectRoutes(slot, params, nextAncestorFiles, treePath, routes, hasSchema, true);
343
+ }
344
+ /**
345
+ * Dedupe route entries by urlPath for urlPath-keyed emissions (the Routes
346
+ * interface, useQueryStates overloads, and typed Link variants).
347
+ *
348
+ * Parallel-slot pages share their parent's urlPath; emitting one entry per
349
+ * slot page produced duplicate interface keys (TS2300/TS2717 under
350
+ * skipLibCheck:false) and duplicate overloads. The non-slot entry is the
351
+ * canonical one; when only slot entries exist (parent has no page), the
352
+ * lexicographically smallest segmentPath wins so output is independent of
353
+ * slot scan order. A slot's searchParams definition is carried onto the
354
+ * merged entry when the canonical entry has none — never silently dropped.
355
+ *
356
+ * segmentPath-keyed emissions (getSegmentParams, useSegmentParams,
357
+ * TimberSegmentParams) must NOT use this — segmentPaths are already unique
358
+ * and slot entries feed those APIs directly.
359
+ */
360
+ function dedupeRoutesByUrlPath(routes) {
361
+ const byPath = /* @__PURE__ */ new Map();
362
+ for (const route of routes) {
363
+ const existing = byPath.get(route.urlPath);
364
+ if (!existing) {
365
+ byPath.set(route.urlPath, route);
366
+ continue;
367
+ }
368
+ let winner = existing;
369
+ let loser = route;
370
+ if (existing.isSlotRoute && !route.isSlotRoute || !!existing.isSlotRoute === !!route.isSlotRoute && route.segmentPath.localeCompare(existing.segmentPath) < 0) {
371
+ winner = route;
372
+ loser = existing;
373
+ }
374
+ if (!winner.hasSearchParams && loser.hasSearchParams) winner = {
375
+ ...winner,
376
+ hasSearchParams: true,
377
+ searchParamsPagePath: loser.searchParamsPagePath
378
+ };
379
+ byPath.set(route.urlPath, winner);
380
+ }
381
+ return [...byPath.values()];
382
+ }
383
+ /**
384
+ * Determine the TypeScript type for a segment's param.
385
+ */
386
+ function paramTypeForSegment(segmentType) {
387
+ switch (segmentType) {
388
+ case "catch-all": return "string[]";
389
+ case "optional-catch-all": return "string[] | undefined";
390
+ default: return "string";
391
+ }
392
+ }
393
+ /**
394
+ * Check if a file exports a specific named export.
395
+ *
396
+ * Uses a lightweight regex check — not full AST parsing. The actual type
397
+ * extraction happens via the TypeScript compiler in the generated .d.ts.
398
+ */
399
+ function fileHasExport(filePath, exportName) {
400
+ if (!existsSync(filePath)) return false;
401
+ try {
402
+ const content = readFileCached(filePath);
403
+ const e = exportName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
404
+ return new RegExp(`export\\s+(const|let|var)\\s+${e}\\b`).test(content) || new RegExp(`export\\s*\\{[^}]*\\b${e}\\b[^}]*\\}`).test(content);
405
+ } catch {
406
+ return false;
407
+ }
408
+ }
409
+ /**
410
+ * Find a legacy `segmentParams` export on layout.tsx or page.tsx.
411
+ *
412
+ * Backward-compat shim: TIM-508 made params.ts the canonical location
413
+ * for `segmentParams`. Layout/page exports are still accepted for the
414
+ * OWN segment only (not inherited by descendants — see TIM-834).
415
+ */
416
+ function findLegacyParamsExport(node) {
417
+ if (node.layout && fileHasExport(node.layout.filePath, "segmentParams")) return node.layout.filePath;
418
+ if (node.page && fileHasExport(node.page.filePath, "segmentParams")) return node.page.filePath;
419
+ }
420
+ /**
421
+ * Emit the schema-based type exports: TimberSegmentParams, TimberRoute,
422
+ * AllSegmentParams, RoutesWithParams.
423
+ *
424
+ * These types use InferCodecType references so they stay in sync with
425
+ * the schema without hardcoding resolved types.
426
+ *
427
+ * Design doc: design/41-global-params.md §Codegen Output
428
+ */
429
+ function formatSchemaTypes(routes) {
430
+ const lines = [];
431
+ lines.push("/** Union of all valid route patterns. */");
432
+ lines.push("export type TimberRoute = keyof TimberSegmentParams;");
433
+ lines.push("");
434
+ lines.push("/** Maps each segment path to its accumulated segment params. */");
435
+ lines.push("export interface TimberSegmentParams {");
436
+ for (const route of routes) if (route.params.length === 0) lines.push(` '${route.segmentPath}': {};`);
437
+ else {
438
+ lines.push(` '${route.segmentPath}': {`);
439
+ for (const p of route.params) lines.push(` ${p.name}: ${buildSchemaParamType(p)};`);
440
+ lines.push(" };");
441
+ }
442
+ lines.push("}");
443
+ lines.push("");
444
+ lines.push("/** All segment params (union of all route params). */");
445
+ lines.push("export type AllSegmentParams = {");
446
+ lines.push(" [K in keyof TimberSegmentParams as TimberSegmentParams[K] extends Record<string, never>");
447
+ lines.push(" ? never");
448
+ lines.push(" : K]: TimberSegmentParams[K];");
449
+ lines.push("} extends infer U");
450
+ lines.push(" ? { [K in keyof U[keyof U]]: U[keyof U][K] }");
451
+ lines.push(" : never;");
452
+ lines.push("");
453
+ lines.push("/** Filters TimberRoute to routes whose accumulated params include all listed keys. */");
454
+ lines.push("export type RoutesWithParams<K extends keyof AllSegmentParams> = {");
455
+ lines.push(" [R in TimberRoute]: K extends keyof TimberSegmentParams[R] ? R : never;");
456
+ lines.push("}[TimberRoute];");
457
+ return lines;
458
+ }
459
+ /**
460
+ * Format the collected routes into a TypeScript declaration file.
461
+ */
462
+ function formatDeclarationFile(routes, importBase, hasSchema, appDir) {
463
+ const lines = [];
464
+ lines.push("// This file is auto-generated by timber.js route map codegen.");
465
+ lines.push("// Do not edit manually. Regenerated on build and in dev mode.");
466
+ lines.push("");
467
+ lines.push("export {};");
468
+ lines.push("");
469
+ if (hasSchema) {
470
+ const schemaImport = appDir && importBase ? "./" + relative(importBase, join(appDir, "schema")).replace(/\\/g, "/") : "../app/schema";
471
+ lines.push(`import type schema from '${schemaImport}';`);
472
+ lines.push("import type { InferCodecType, SegmentParamCodec } from '@timber-js/app/params';");
473
+ lines.push("");
474
+ const allBracketKeys = /* @__PURE__ */ new Set();
475
+ for (const route of routes) for (const p of route.params) allBracketKeys.add(p.bracketName);
476
+ if (allBracketKeys.size > 0) {
477
+ lines.push("declare module '@timber-js/app/params' {");
478
+ lines.push(" interface ValidDynamicSegmentKeysRegistry {");
479
+ for (const key of [...allBracketKeys].sort()) lines.push(` ${JSON.stringify(key)}: true;`);
480
+ lines.push(" }");
481
+ lines.push("}");
482
+ lines.push("");
483
+ }
484
+ lines.push("type _AssertSchemaValues = {");
485
+ lines.push(" [K in keyof typeof schema['segmentParams']]: typeof schema['segmentParams'][K] extends SegmentParamCodec ? true : ['Error: value for', K, 'is not a valid Codec or Standard Schema'];");
486
+ lines.push("};");
487
+ lines.push("type _EnforceSchemaValues<_T extends Record<string, true> = _AssertSchemaValues> = true;");
488
+ lines.push("");
489
+ }
490
+ if (!hasSchema) {
491
+ lines.push(emitResolveSegmentFieldHelper());
492
+ lines.push("");
493
+ }
494
+ const uniqueByUrlPath = dedupeRoutesByUrlPath(routes);
495
+ lines.push("declare module '@timber-js/app' {");
496
+ lines.push(" interface Routes {");
497
+ for (const route of uniqueByUrlPath) {
498
+ const paramsType = formatParamsType(route.params, importBase, hasSchema);
499
+ const searchParamsType = formatSearchParamsType(route, importBase);
500
+ lines.push(` '${route.urlPath}': {`);
501
+ lines.push(` segmentParams: ${paramsType}`);
502
+ lines.push(` searchParams: ${searchParamsType}`);
503
+ lines.push(` }`);
504
+ }
505
+ lines.push(" }");
506
+ if (hasSchema) {
507
+ lines.push("");
508
+ lines.push(...formatSchemaTypes(routes).map((l) => ` ${l}`));
509
+ }
510
+ lines.push("}");
511
+ lines.push("");
512
+ const pageRoutes = uniqueByUrlPath.filter((r) => !r.isApiRoute);
513
+ const dynamicRoutes = routes.filter((r) => r.params.length > 0);
514
+ if (dynamicRoutes.length > 0) {
515
+ lines.push("declare module '@timber-js/app/server' {");
516
+ if (hasSchema) lines.push(" import type { AllSegmentParams } from '@timber-js/app'");
517
+ for (const route of dynamicRoutes) {
518
+ const paramsType = formatParamsType(route.params, importBase, hasSchema);
519
+ lines.push(` export function getSegmentParams(segmentPath: '${route.segmentPath}'): ${paramsType}`);
520
+ }
521
+ lines.push(hasSchema ? " export function getSegmentParams(): Partial<AllSegmentParams>" : " export function getSegmentParams(): Record<string, string | string[]>");
522
+ lines.push("}");
523
+ lines.push("");
524
+ }
525
+ if (dynamicRoutes.length > 0 || pageRoutes.length > 0) {
526
+ lines.push("declare module '@timber-js/app/client' {");
527
+ lines.push(" import type { SearchParamsDefinition, SetParams, QueryStatesOptions, SearchParamCodec } from '@timber-js/app/search-params'");
528
+ if (hasSchema) lines.push(" import type { AllSegmentParams } from '@timber-js/app'");
529
+ lines.push("");
530
+ if (dynamicRoutes.length > 0) {
531
+ for (const route of dynamicRoutes) {
532
+ const paramsType = formatParamsType(route.params, importBase, hasSchema);
533
+ lines.push(` export function useSegmentParams(segmentPath: '${route.segmentPath}'): ${paramsType}`);
534
+ }
535
+ lines.push(hasSchema ? " export function useSegmentParams(): Partial<AllSegmentParams>" : " export function useSegmentParams(): Record<string, string | string[]>");
536
+ lines.push("");
537
+ }
538
+ if (pageRoutes.length > 0) {
539
+ lines.push(...formatUseQueryStatesOverloads(pageRoutes, importBase));
540
+ lines.push("");
541
+ }
542
+ if (pageRoutes.length > 0) {
543
+ lines.push(" // Typed Link overloads — per-route (block 1 / emitted first)");
544
+ lines.push(...formatTypedLinkOverloads(pageRoutes, importBase, hasSchema));
545
+ lines.push("");
546
+ }
547
+ lines.push("}");
548
+ lines.push("");
549
+ }
550
+ lines.push("declare module '@timber-js/app/client' {");
551
+ lines.push(" import type { SearchParamsDefinition } from '@timber-js/app/search-params'");
552
+ lines.push("");
553
+ lines.push(...formatLinkCatchAllOverloads());
554
+ lines.push("}");
555
+ lines.push("");
556
+ return lines.join("\n");
557
+ }
558
+ /**
559
+ * Format the params type for a route entry.
560
+ */
561
+ function formatParamsType(params, importBase, hasSchema) {
562
+ if (params.length === 0) return "{}";
563
+ return `{ ${params.map((p) => {
564
+ const codecType = hasSchema ? buildSchemaParamType(p) : buildCodecChainType(p, importBase, p.type);
565
+ return `${p.name}: ${codecType}`;
566
+ }).join("; ")} }`;
567
+ }
568
+ /**
569
+ * Generate useQueryStates overloads.
570
+ *
571
+ * For each page route:
572
+ * - Routes with search-params.ts get a typed overload returning the inferred T
573
+ * - Routes without search-params.ts get an overload returning [{}, SetParams<{}>]
574
+ *
575
+ * A fallback overload for standalone codecs (existing API) is emitted last.
576
+ */
577
+ function formatUseQueryStatesOverloads(routes, importBase) {
578
+ const lines = [];
579
+ for (const route of routes) {
580
+ const searchParamsType = route.hasSearchParams ? formatSearchParamsType(route, importBase) : "{}";
581
+ lines.push(` export function useQueryStates<R extends '${route.urlPath}'>(route: R, options?: QueryStatesOptions): [${searchParamsType}, SetParams<${searchParamsType}>]`);
582
+ }
583
+ lines.push(" export function useQueryStates<T extends Record<string, unknown>>(codecs: { [K in keyof T]: SearchParamCodec<T[K]> }, options?: QueryStatesOptions): [T, SetParams<T>]");
584
+ return lines;
585
+ }
586
+ //#endregion
587
+ //#region src/routing/schema-validation.ts
588
+ /**
589
+ * Schema key/value validation against the filesystem route tree.
590
+ *
591
+ * Runs at codegen time (build + dev) to catch mismatches between
592
+ * app/schema.ts keys and the actual dynamic segments on disk.
593
+ *
594
+ * Design doc: design/41-global-params.md
595
+ */
596
+ /**
597
+ * Collect all unique bracket-keyed dynamic segment names from a route tree.
598
+ * Returns entries like '[artistSlug]', '[...slug]', '[[...topic]]'.
599
+ */
600
+ function collectDynamicSegmentsFromTree(tree) {
601
+ const segments = /* @__PURE__ */ new Set();
602
+ walkTree(tree.root, segments);
603
+ return segments;
604
+ }
605
+ function walkTree(node, segments) {
606
+ if (node.paramName && node.segmentName) {
607
+ if (classifyUrlSegment(node.segmentName).kind !== "static") segments.add(node.segmentName);
608
+ }
609
+ for (const child of node.children) walkTree(child, segments);
610
+ for (const slot of Object.values(node.slots)) walkTree(slot, segments);
611
+ }
612
+ /**
613
+ * Extract the param name from a bracket key.
614
+ * '[id]' → 'id', '[...slug]' → 'slug', '[[...topic]]' → 'topic'
615
+ */
616
+ function extractParamName(bracketKey) {
617
+ const seg = classifyUrlSegment(bracketKey);
618
+ if (seg.kind === "static") return null;
619
+ return seg.name;
620
+ }
621
+ /**
622
+ * Validate schema keys against the filesystem route tree.
623
+ *
624
+ * Returns warnings for:
625
+ * - Stale keys: schema keys that don't match any filesystem segment
626
+ * - Bracket form mismatches: same param name, different bracket form
627
+ * - Missing keys: filesystem segments not registered in schema (informational)
628
+ */
629
+ function validateSchemaAgainstRoutes(tree, appDir) {
630
+ const schemaPath = findSchemaFile(appDir);
631
+ if (!schemaPath) return [];
632
+ const schemaKeys = parseExistingSchemaKeys(readFileCached(schemaPath));
633
+ if (schemaKeys.length === 0) return [];
634
+ return validateKeys(schemaKeys, collectDynamicSegmentsFromTree(tree));
635
+ }
636
+ /**
637
+ * Core validation: compare schema keys against filesystem segments.
638
+ * Exported separately for testing without filesystem dependencies.
639
+ */
640
+ function validateKeys(schemaKeys, filesystemSegments) {
641
+ const warnings = [];
642
+ const fsParamToKey = /* @__PURE__ */ new Map();
643
+ for (const fsKey of filesystemSegments) {
644
+ const name = extractParamName(fsKey);
645
+ if (name) fsParamToKey.set(name, fsKey);
646
+ }
647
+ const schemaParamNames = /* @__PURE__ */ new Set();
648
+ for (const schemaKey of schemaKeys) {
649
+ const schemaParamName = extractParamName(schemaKey);
650
+ if (!schemaParamName) continue;
651
+ schemaParamNames.add(schemaParamName);
652
+ if (filesystemSegments.has(schemaKey)) continue;
653
+ const fsKey = fsParamToKey.get(schemaParamName);
654
+ if (fsKey) warnings.push({
655
+ type: "bracket-mismatch",
656
+ key: schemaKey,
657
+ filesystemKey: fsKey,
658
+ message: `Schema key '${schemaKey}' does not match filesystem bracket form '${fsKey}'. Update the schema key to '${fsKey}'.`
659
+ });
660
+ else warnings.push({
661
+ type: "stale-key",
662
+ key: schemaKey,
663
+ message: `Schema key '${schemaKey}' does not match any dynamic segment in the filesystem. Remove it from app/schema.ts or create the corresponding route segment.`
664
+ });
665
+ }
666
+ for (const fsKey of filesystemSegments) {
667
+ const name = extractParamName(fsKey);
668
+ if (name && !schemaParamNames.has(name)) warnings.push({
669
+ type: "missing-key",
670
+ key: fsKey,
671
+ message: `Dynamic segment '${fsKey}' has no codec in app/schema.ts (defaults to string). Run: timber schema sync`
672
+ });
673
+ }
674
+ return warnings;
675
+ }
676
+ //#endregion
677
+ //#region src/routing/interception.ts
678
+ /**
679
+ * Collect all interception rewrite rules from the route tree.
680
+ *
681
+ * Walks the tree recursively. For each intercepting segment, computes the
682
+ * intercepted URL based on the marker and the segment's position.
683
+ */
684
+ function collectInterceptionRewrites(root) {
685
+ const rewrites = [];
686
+ walkForInterceptions(root, [root], rewrites);
687
+ return rewrites;
688
+ }
689
+ /**
690
+ * Recursively walk the segment tree to find intercepting routes.
691
+ */
692
+ function walkForInterceptions(node, ancestors, rewrites) {
693
+ for (const child of node.children) if (child.segmentType === "intercepting" && child.interceptionMarker) collectFromInterceptingNode(child, ancestors, rewrites);
694
+ else walkForInterceptions(child, [...ancestors, child], rewrites);
695
+ for (const slot of Object.values(node.slots)) walkForInterceptions(slot, ancestors, rewrites);
696
+ }
697
+ /**
698
+ * For an intercepting segment, find all leaf pages in its sub-tree and
699
+ * generate rewrite rules for each.
700
+ */
701
+ function collectFromInterceptingNode(interceptingNode, ancestors, rewrites) {
702
+ const marker = interceptingNode.interceptionMarker;
703
+ const segmentName = interceptingNode.interceptedSegmentName;
704
+ const parentUrlPath = ancestors[ancestors.length - 1].urlPath;
705
+ const interceptedBase = computeInterceptedBase(parentUrlPath, marker);
706
+ collectLeavesWithRewrites(interceptingNode, interceptedBase === "/" ? `/${segmentName}` : `${interceptedBase}/${segmentName}`, parentUrlPath, rewrites);
707
+ }
708
+ /**
709
+ * Recursively find leaf pages in an intercepting sub-tree and generate
710
+ * rewrite rules for each.
711
+ */
712
+ function collectLeavesWithRewrites(node, interceptedUrlPath, interceptingPrefix, rewrites) {
713
+ if (node.page) rewrites.push({
714
+ interceptedPattern: interceptedUrlPath,
715
+ interceptingPrefix
716
+ });
717
+ for (const child of node.children) collectLeavesWithRewrites(child, child.segmentType === "group" ? interceptedUrlPath : `${interceptedUrlPath}/${child.segmentName}`, interceptingPrefix, rewrites);
718
+ }
719
+ /**
720
+ * Compute the base URL that an intercepting route intercepts, given the
721
+ * parent's URL path and the interception marker.
722
+ *
723
+ * - (.) — same level: parent's URL path
724
+ * - (..) — one level up: parent's parent URL path
725
+ * - (...) — root level: /
726
+ * - (..)(..) — two levels up: parent's grandparent URL path
727
+ *
728
+ * Level counting operates on URL path segments, NOT filesystem directories.
729
+ * Route groups and parallel slots are already excluded from urlPath (they
730
+ * don't add URL depth), so (..) correctly climbs visible segments. This
731
+ * avoids the Vinext bug where path.dirname() on filesystem paths would
732
+ * waste climbs on invisible route groups.
733
+ */
734
+ function computeInterceptedBase(parentUrlPath, marker) {
735
+ switch (marker) {
736
+ case "(.)": return parentUrlPath;
737
+ case "(..)": {
738
+ const parts = parentUrlPath.split("/").filter(Boolean);
739
+ parts.pop();
740
+ return parts.length === 0 ? "/" : `/${parts.join("/")}`;
741
+ }
742
+ case "(...)": return "/";
743
+ case "(..)(..)": {
744
+ const parts = parentUrlPath.split("/").filter(Boolean);
745
+ parts.pop();
746
+ parts.pop();
747
+ return parts.length === 0 ? "/" : `/${parts.join("/")}`;
748
+ }
749
+ }
750
+ }
751
+ //#endregion
752
+ //#region src/routing/walkers.ts
753
+ /**
754
+ * Walk a segment tree and collect every leaf with a `page` or `route`
755
+ * handler. Generic over `TFile` so it works on both the build-time
756
+ * scanner output and the runtime manifest tree.
757
+ *
758
+ * - Pages and route handlers at the same URL produce two distinct
759
+ * entries (the build report deduplicates by URL afterward).
760
+ * - Parallel slots are skipped unless `includeSlots: true` (slots
761
+ * share their parent's URL and are not addressable on their own).
762
+ * - Result is sorted by `urlPath` for deterministic output.
763
+ */
764
+ function collectLeafRoutes(root, options = {}) {
765
+ const { includeSlots = false } = options;
766
+ const result = [];
767
+ walk(root, [], result, includeSlots);
768
+ result.sort((a, b) => a.urlPath.localeCompare(b.urlPath));
769
+ return result;
770
+ }
771
+ function walk(node, chain, result, includeSlots) {
772
+ const currentChain = [...chain, node];
773
+ const path = node.urlPath || "/";
774
+ if (node.page) result.push({
775
+ urlPath: path,
776
+ segments: currentChain,
777
+ page: node.page
778
+ });
779
+ if (node.route) result.push({
780
+ urlPath: path,
781
+ segments: currentChain,
782
+ route: node.route
783
+ });
784
+ for (const child of node.children) walk(child, currentChain, result, includeSlots);
785
+ if (includeSlots) for (const slotNode of Object.values(node.slots)) walk(slotNode, currentChain, result, includeSlots);
786
+ }
787
+ //#endregion
788
+ export { generateRouteMap as a, validateSchemaAgainstRoutes as i, collectInterceptionRewrites as n, readFileCached as o, collectDynamicSegmentsFromTree as r, collectLeafRoutes as t };
789
+
790
+ //# sourceMappingURL=walkers-DvWDj453.js.map