@timber-js/app 0.2.0-alpha.240 → 0.2.0-alpha.241

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 (333) hide show
  1. package/dist/_chunks/{actions-DIgnvDrG.js → actions-BCYVyoFl.js} +117 -11
  2. package/dist/_chunks/actions-BCYVyoFl.js.map +1 -0
  3. package/dist/_chunks/{als-registry-PPYstxK0.js → als-registry-fabsRnPY.js} +4 -2
  4. package/dist/_chunks/{als-registry-PPYstxK0.js.map → als-registry-fabsRnPY.js.map} +1 -1
  5. package/dist/_chunks/{als-slots-kbQrHTzm.js → als-slots-CVTF-AMz.js} +3 -3
  6. package/dist/_chunks/als-slots-CVTF-AMz.js.map +1 -0
  7. package/dist/_chunks/{cache-api-uWQwuxWb.js → cache-api-n5FL4wFs.js} +5 -5
  8. package/dist/_chunks/{cache-api-uWQwuxWb.js.map → cache-api-n5FL4wFs.js.map} +1 -1
  9. package/dist/_chunks/chains-DPZAMMav.js +1 -0
  10. package/dist/_chunks/{chains-C7CExrUI.js → chains-IswOWMnq.js} +2 -2
  11. package/dist/_chunks/{chains-C7CExrUI.js.map → chains-IswOWMnq.js.map} +1 -1
  12. package/dist/_chunks/{classify-Cj9EeZoL.js → classify-B08RCF6s.js} +2 -2
  13. package/dist/_chunks/{classify-Cj9EeZoL.js.map → classify-B08RCF6s.js.map} +1 -1
  14. package/dist/_chunks/{cli-check-C3QOAru7.js → cli-check-tpFb6pBU.js} +7 -6
  15. package/dist/_chunks/cli-check-tpFb6pBU.js.map +1 -0
  16. package/dist/_chunks/{cli-schema-sync-BRxZz66D.js → cli-schema-sync-C0pXBtzG.js} +1 -1
  17. package/dist/_chunks/{cli-schema-sync-DQUS_o3V.js → cli-schema-sync-DRNJutey.js} +2 -2
  18. package/dist/_chunks/{cli-schema-sync-DQUS_o3V.js.map → cli-schema-sync-DRNJutey.js.map} +1 -1
  19. package/dist/_chunks/{client-dep-entries-ZETBdLgv.js → client-dep-entries-Dw5Dvatr.js} +2 -2
  20. package/dist/_chunks/{client-dep-entries-ZETBdLgv.js.map → client-dep-entries-Dw5Dvatr.js.map} +1 -1
  21. package/dist/_chunks/{cloudflare-Dk5Hqo-O.js → cloudflare-9dbhVOxS.js} +2 -2
  22. package/dist/_chunks/{cloudflare-Dk5Hqo-O.js.map → cloudflare-9dbhVOxS.js.map} +1 -1
  23. package/dist/_chunks/{convention-lint-BoVISNS6.js → convention-lint-BfC_dAhZ.js} +364 -10
  24. package/dist/_chunks/convention-lint-BfC_dAhZ.js.map +1 -0
  25. package/dist/_chunks/dev-server-3DNTXQV-.js +1 -0
  26. package/dist/_chunks/{dev-server-C5R6jx8Q.js → dev-server-3R6Bl9_R.js} +9 -2
  27. package/dist/_chunks/dev-server-3R6Bl9_R.js.map +1 -0
  28. package/dist/_chunks/{dist-C1Rjlo6s.js → dist-GyaJm4GA.js} +18 -2
  29. package/dist/_chunks/dist-GyaJm4GA.js.map +1 -0
  30. package/dist/_chunks/{error-boundary-DB51f9ih.js → error-boundary-Dfhxigko.js} +8 -4
  31. package/dist/_chunks/error-boundary-Dfhxigko.js.map +1 -0
  32. package/dist/_chunks/{flight-source-node-D9cHBhjP.js → flight-source-node-QOpWZATb.js} +2 -2
  33. package/dist/_chunks/{flight-source-node-D9cHBhjP.js.map → flight-source-node-QOpWZATb.js.map} +1 -1
  34. package/dist/_chunks/{json-lossy-check-Y1GxqVX_.js → json-lossy-check-5KFcC1yt.js} +2 -2
  35. package/dist/_chunks/{json-lossy-check-Y1GxqVX_.js.map → json-lossy-check-5KFcC1yt.js.map} +1 -1
  36. package/dist/_chunks/{live-graph-BDQWvnMm.js → live-graph-D1dfVqoT.js} +4 -4
  37. package/dist/_chunks/{live-graph-BDQWvnMm.js.map → live-graph-D1dfVqoT.js.map} +1 -1
  38. package/dist/_chunks/{logger-DmRR9tmZ.js → logger-BvGxPd1e.js} +2 -2
  39. package/dist/_chunks/{logger-DmRR9tmZ.js.map → logger-BvGxPd1e.js.map} +1 -1
  40. package/dist/_chunks/metadata-routes-MXNjWOt5.js.map +1 -1
  41. package/dist/_chunks/{node-response-yp8zdyRp.js → node-response-D5cfiyWP.js} +2 -2
  42. package/dist/_chunks/{node-response-yp8zdyRp.js.map → node-response-D5cfiyWP.js.map} +1 -1
  43. package/dist/_chunks/{poison-scan-WQgUydF_.js → poison-scan-CX02ilxN.js} +2 -2
  44. package/dist/_chunks/{poison-scan-WQgUydF_.js.map → poison-scan-CX02ilxN.js.map} +1 -1
  45. package/dist/_chunks/{rsc-cache-key-D0cb0Gmc.js → rsc-cache-key-BGvUtMtN.js} +40 -4
  46. package/dist/_chunks/{rsc-cache-key-D0cb0Gmc.js.map → rsc-cache-key-BGvUtMtN.js.map} +1 -1
  47. package/dist/_chunks/{scanner-C9Lrf77z.js → scanner-DneYxQoY.js} +14 -81
  48. package/dist/_chunks/scanner-DneYxQoY.js.map +1 -0
  49. package/dist/_chunks/{sizeof-BISkSaU0.js → sizeof-BtQ3ErLf.js} +2 -2
  50. package/dist/_chunks/{sizeof-BISkSaU0.js.map → sizeof-BtQ3ErLf.js.map} +1 -1
  51. package/dist/_chunks/{walkers-Bxv4v7tX.js → walkers-C9R2A4jN.js} +3 -3
  52. package/dist/_chunks/{walkers-Bxv4v7tX.js.map → walkers-C9R2A4jN.js.map} +1 -1
  53. package/dist/adapters/cloudflare-dev.js +1 -1
  54. package/dist/adapters/cloudflare-kv-cache.js +2 -2
  55. package/dist/adapters/cloudflare.js +1 -1
  56. package/dist/analyze/crawl-entry.js +3 -3
  57. package/dist/analyze/graph-command.js +2 -2
  58. package/dist/cache/index.js +2 -2
  59. package/dist/cache/stores/memory.js +1 -1
  60. package/dist/cdn/workers-cache-purge.js +1 -1
  61. package/dist/cli-check.d.ts +3 -0
  62. package/dist/cli-check.d.ts.map +1 -1
  63. package/dist/cli.js +3 -3
  64. package/dist/client/error-boundary.js +1 -1
  65. package/dist/client/index.js +1 -1
  66. package/dist/client/internal.js +3 -2
  67. package/dist/client/internal.js.map +1 -1
  68. package/dist/client/navigation-commit.d.ts +5 -0
  69. package/dist/client/navigation-commit.d.ts.map +1 -1
  70. package/dist/client/outlet-content-cache.d.ts +28 -7
  71. package/dist/client/outlet-content-cache.d.ts.map +1 -1
  72. package/dist/client/router.d.ts.map +1 -1
  73. package/dist/client/segment-outlet.d.ts +3 -1
  74. package/dist/client/segment-outlet.d.ts.map +1 -1
  75. package/dist/config-types.d.ts +24 -0
  76. package/dist/config-types.d.ts.map +1 -1
  77. package/dist/config-validation.d.ts.map +1 -1
  78. package/dist/cookies/define-cookie.d.ts.map +1 -1
  79. package/dist/cookies/index.js +5 -2
  80. package/dist/cookies/index.js.map +1 -1
  81. package/dist/index.d.ts +1 -0
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +109 -25
  84. package/dist/index.js.map +1 -1
  85. package/dist/native/rsc/cookies/define-cookie.js +6 -2
  86. package/dist/native/rsc/cookies/define-cookie.js.map +1 -1
  87. package/dist/native/rsc/manifest.json +10 -0
  88. package/dist/native/rsc/routing/segment-keys.js +11 -1
  89. package/dist/native/rsc/routing/segment-keys.js.map +1 -1
  90. package/dist/native/rsc/search-params/define.js +4 -1
  91. package/dist/native/rsc/search-params/define.js.map +1 -1
  92. package/dist/native/rsc/server/als-registry.js +2 -1
  93. package/dist/native/rsc/server/als-registry.js.map +1 -1
  94. package/dist/native/rsc/server/client-state-tree.js +14 -9
  95. package/dist/native/rsc/server/client-state-tree.js.map +1 -1
  96. package/dist/native/rsc/server/cookie-context.js +12 -0
  97. package/dist/native/rsc/server/cookie-context.js.map +1 -1
  98. package/dist/native/rsc/server/flight-source.js +5 -2
  99. package/dist/native/rsc/server/flight-source.js.map +1 -1
  100. package/dist/native/rsc/server/framework-stack-frames.js +18 -0
  101. package/dist/native/rsc/server/framework-stack-frames.js.map +1 -0
  102. package/dist/native/rsc/server/prebuilt-builder.js +15 -1
  103. package/dist/native/rsc/server/prebuilt-builder.js.map +1 -1
  104. package/dist/native/rsc/server/request-context.js +10 -4
  105. package/dist/native/rsc/server/request-context.js.map +1 -1
  106. package/dist/native/rsc/server/route-element-builder.js +25 -7
  107. package/dist/native/rsc/server/route-element-builder.js.map +1 -1
  108. package/dist/native/rsc/server/route-module-loader.js +14 -6
  109. package/dist/native/rsc/server/route-module-loader.js.map +1 -1
  110. package/dist/native/rsc/server/rsc-cache-key-guard.js +5 -1
  111. package/dist/native/rsc/server/rsc-cache-key-guard.js.map +1 -1
  112. package/dist/native/rsc/server/rsc-entry/render-route.js +8 -1
  113. package/dist/native/rsc/server/rsc-entry/render-route.js.map +1 -1
  114. package/dist/native/rsc/server/rsc-entry/revalidate-renderer.js +8 -1
  115. package/dist/native/rsc/server/rsc-entry/revalidate-renderer.js.map +1 -1
  116. package/dist/native/rsc/server/segment-hash/outlet.js +28 -8
  117. package/dist/native/rsc/server/segment-hash/outlet.js.map +1 -1
  118. package/dist/native/rsc/server/segment-lifetime/document-outlet.js +24 -0
  119. package/dist/native/rsc/server/segment-lifetime/document-outlet.js.map +1 -0
  120. package/dist/native/rsc/server/segment-lifetime/key-digest.js +74 -0
  121. package/dist/native/rsc/server/segment-lifetime/key-digest.js.map +1 -0
  122. package/dist/native/rsc/server/segment-lifetime/read-rule.js +56 -0
  123. package/dist/native/rsc/server/segment-lifetime/read-rule.js.map +1 -0
  124. package/dist/native/rsc/server/segment-lifetime/read-scope.js +40 -0
  125. package/dist/native/rsc/server/segment-lifetime/read-scope.js.map +1 -0
  126. package/dist/native/rsc/server/segment-lifetime/segment-key.js +50 -0
  127. package/dist/native/rsc/server/segment-lifetime/segment-key.js.map +1 -0
  128. package/dist/native/rsc/server/segment-lifetime/slot-outlets.js +72 -0
  129. package/dist/native/rsc/server/segment-lifetime/slot-outlets.js.map +1 -0
  130. package/dist/native/rsc/server/slot-resolver.js +50 -26
  131. package/dist/native/rsc/server/slot-resolver.js.map +1 -1
  132. package/dist/native/rsc/server/slot-subtree-contain.js +17 -89
  133. package/dist/native/rsc/server/slot-subtree-contain.js.map +1 -1
  134. package/dist/native/rsc/server/subtree-walk.js +140 -0
  135. package/dist/native/rsc/server/subtree-walk.js.map +1 -0
  136. package/dist/native/rsc/shared/als-slots.js +2 -2
  137. package/dist/native/rsc/shared/als-slots.js.map +1 -1
  138. package/dist/native/rsc/shared/cookie-read-through.js +5 -0
  139. package/dist/native/rsc/shared/cookie-read-through.js.map +1 -0
  140. package/dist/native/rsc/shared/outlet-decision.js.map +1 -1
  141. package/dist/native/rsc/shared/route-options-export.js +8 -0
  142. package/dist/native/rsc/shared/route-options-export.js.map +1 -0
  143. package/dist/native/rsc/shared/rsc-cache-key.js +19 -3
  144. package/dist/native/rsc/shared/rsc-cache-key.js.map +1 -1
  145. package/dist/native/rsc/shims/headers.js +3 -4
  146. package/dist/native/rsc/shims/headers.js.map +1 -1
  147. package/dist/native/ssr/client/outlet-content-cache.js +17 -3
  148. package/dist/native/ssr/client/outlet-content-cache.js.map +1 -1
  149. package/dist/native/ssr/client/segment-outlet.js +3 -3
  150. package/dist/native/ssr/client/segment-outlet.js.map +1 -1
  151. package/dist/native/ssr/cookies/define-cookie.js +6 -2
  152. package/dist/native/ssr/cookies/define-cookie.js.map +1 -1
  153. package/dist/native/ssr/manifest.json +4 -0
  154. package/dist/native/ssr/search-params/define.js +4 -1
  155. package/dist/native/ssr/search-params/define.js.map +1 -1
  156. package/dist/native/ssr/server/als-registry.js +2 -1
  157. package/dist/native/ssr/server/als-registry.js.map +1 -1
  158. package/dist/native/ssr/server/client-state-tree.js +14 -9
  159. package/dist/native/ssr/server/client-state-tree.js.map +1 -1
  160. package/dist/native/ssr/server/cookie-context.js +12 -0
  161. package/dist/native/ssr/server/cookie-context.js.map +1 -1
  162. package/dist/native/ssr/server/flight-source.js +1 -0
  163. package/dist/native/ssr/server/flight-source.js.map +1 -1
  164. package/dist/native/ssr/server/framework-stack-frames.js +18 -0
  165. package/dist/native/ssr/server/framework-stack-frames.js.map +1 -0
  166. package/dist/native/ssr/server/request-context.js +10 -4
  167. package/dist/native/ssr/server/request-context.js.map +1 -1
  168. package/dist/native/ssr/server/rsc-cache-key-guard.js +5 -1
  169. package/dist/native/ssr/server/rsc-cache-key-guard.js.map +1 -1
  170. package/dist/native/ssr/server/segment-lifetime/key-digest.js +6 -0
  171. package/dist/native/ssr/server/segment-lifetime/key-digest.js.map +1 -0
  172. package/dist/native/ssr/server/segment-lifetime/read-rule.js +56 -0
  173. package/dist/native/ssr/server/segment-lifetime/read-rule.js.map +1 -0
  174. package/dist/native/ssr/shared/als-slots.js +2 -2
  175. package/dist/native/ssr/shared/als-slots.js.map +1 -1
  176. package/dist/native/ssr/shared/cookie-read-through.js +5 -0
  177. package/dist/native/ssr/shared/cookie-read-through.js.map +1 -0
  178. package/dist/native/ssr/shared/rsc-cache-key.js +19 -3
  179. package/dist/native/ssr/shared/rsc-cache-key.js.map +1 -1
  180. package/dist/native/ssr/shims/headers.js +3 -4
  181. package/dist/native/ssr/shims/headers.js.map +1 -1
  182. package/dist/plugins/callsite-jsx.d.ts +8 -1
  183. package/dist/plugins/callsite-jsx.d.ts.map +1 -1
  184. package/dist/plugins/entries.d.ts.map +1 -1
  185. package/dist/plugins/prerender-sugar.d.ts +9 -8
  186. package/dist/plugins/prerender-sugar.d.ts.map +1 -1
  187. package/dist/plugins/routing.d.ts.map +1 -1
  188. package/dist/routing/convention-lint.d.ts +11 -3
  189. package/dist/routing/convention-lint.d.ts.map +1 -1
  190. package/dist/routing/export-detect.d.ts +50 -23
  191. package/dist/routing/export-detect.d.ts.map +1 -1
  192. package/dist/routing/index.js +2 -2
  193. package/dist/routing/route-options-lint.d.ts +36 -0
  194. package/dist/routing/route-options-lint.d.ts.map +1 -0
  195. package/dist/routing/route-options.d.ts +55 -0
  196. package/dist/routing/route-options.d.ts.map +1 -0
  197. package/dist/routing/segment-keys.d.ts +35 -0
  198. package/dist/routing/segment-keys.d.ts.map +1 -1
  199. package/dist/search-params/index.js +5 -2
  200. package/dist/search-params/index.js.map +1 -1
  201. package/dist/server/als-registry.d.ts +23 -0
  202. package/dist/server/als-registry.d.ts.map +1 -1
  203. package/dist/server/client-state-tree.d.ts +10 -3
  204. package/dist/server/client-state-tree.d.ts.map +1 -1
  205. package/dist/server/cookie-context.d.ts +3 -0
  206. package/dist/server/cookie-context.d.ts.map +1 -1
  207. package/dist/server/flight-source.d.ts +4 -1
  208. package/dist/server/flight-source.d.ts.map +1 -1
  209. package/dist/server/framework-stack-frames.d.ts +23 -0
  210. package/dist/server/framework-stack-frames.d.ts.map +1 -0
  211. package/dist/server/index.d.ts +1 -0
  212. package/dist/server/index.d.ts.map +1 -1
  213. package/dist/server/index.js +2 -2
  214. package/dist/server/internal.js +105 -21
  215. package/dist/server/internal.js.map +1 -1
  216. package/dist/server/prebuilt/capture-routes.d.ts +1 -1
  217. package/dist/server/prebuilt-builder.d.ts.map +1 -1
  218. package/dist/server/request-context.d.ts +6 -1
  219. package/dist/server/request-context.d.ts.map +1 -1
  220. package/dist/server/route-element-builder.d.ts.map +1 -1
  221. package/dist/server/route-module-loader.d.ts +10 -2
  222. package/dist/server/route-module-loader.d.ts.map +1 -1
  223. package/dist/server/rsc-cache-key-guard.d.ts +3 -1
  224. package/dist/server/rsc-cache-key-guard.d.ts.map +1 -1
  225. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  226. package/dist/server/rsc-entry/render-route.d.ts +10 -0
  227. package/dist/server/rsc-entry/render-route.d.ts.map +1 -1
  228. package/dist/server/rsc-entry/revalidate-renderer.d.ts +12 -0
  229. package/dist/server/rsc-entry/revalidate-renderer.d.ts.map +1 -1
  230. package/dist/server/segment-hash/outlet.d.ts +28 -0
  231. package/dist/server/segment-hash/outlet.d.ts.map +1 -1
  232. package/dist/server/segment-lifetime/document-outlet.d.ts +66 -0
  233. package/dist/server/segment-lifetime/document-outlet.d.ts.map +1 -0
  234. package/dist/server/segment-lifetime/key-digest.d.ts +46 -0
  235. package/dist/server/segment-lifetime/key-digest.d.ts.map +1 -0
  236. package/dist/server/segment-lifetime/read-rule.d.ts +43 -0
  237. package/dist/server/segment-lifetime/read-rule.d.ts.map +1 -0
  238. package/dist/server/segment-lifetime/read-scope.d.ts +39 -0
  239. package/dist/server/segment-lifetime/read-scope.d.ts.map +1 -0
  240. package/dist/server/segment-lifetime/segment-key.d.ts +60 -0
  241. package/dist/server/segment-lifetime/segment-key.d.ts.map +1 -0
  242. package/dist/server/segment-lifetime/slot-outlets.d.ts +81 -0
  243. package/dist/server/segment-lifetime/slot-outlets.d.ts.map +1 -0
  244. package/dist/server/slot-resolver.d.ts +6 -1
  245. package/dist/server/slot-resolver.d.ts.map +1 -1
  246. package/dist/server/slot-subtree-contain.d.ts +2 -6
  247. package/dist/server/slot-subtree-contain.d.ts.map +1 -1
  248. package/dist/server/subtree-walk.d.ts +56 -0
  249. package/dist/server/subtree-walk.d.ts.map +1 -0
  250. package/dist/server/types.d.ts +69 -0
  251. package/dist/server/types.d.ts.map +1 -1
  252. package/dist/shared/als-slots.d.ts +12 -2
  253. package/dist/shared/als-slots.d.ts.map +1 -1
  254. package/dist/shared/cookie-read-through.d.ts +18 -0
  255. package/dist/shared/cookie-read-through.d.ts.map +1 -0
  256. package/dist/shared/outlet-decision.d.ts +23 -4
  257. package/dist/shared/outlet-decision.d.ts.map +1 -1
  258. package/dist/shared/route-options-export.d.ts +13 -0
  259. package/dist/shared/route-options-export.d.ts.map +1 -0
  260. package/dist/shared/rsc-cache-key.d.ts +22 -0
  261. package/dist/shared/rsc-cache-key.d.ts.map +1 -1
  262. package/dist/shared/segment-info.d.ts +6 -0
  263. package/dist/shared/segment-info.d.ts.map +1 -1
  264. package/dist/shims/headers.d.ts.map +1 -1
  265. package/docs/api/30-api-server.mdx +29 -0
  266. package/docs/api/32-api-cache.mdx +10 -4
  267. package/docs/api/34-api-config.mdx +5 -0
  268. package/docs/learn/09-streaming.mdx +6 -2
  269. package/docs/learn/10-caching.mdx +10 -4
  270. package/package.json +1 -1
  271. package/src/cli-check.ts +11 -3
  272. package/src/client/navigation-commit.ts +11 -2
  273. package/src/client/outlet-content-cache.ts +40 -8
  274. package/src/client/router.ts +1 -0
  275. package/src/client/segment-outlet.tsx +10 -4
  276. package/src/config-types.ts +25 -0
  277. package/src/config-validation.ts +17 -0
  278. package/src/cookies/define-cookie.ts +5 -1
  279. package/src/index.ts +2 -1
  280. package/src/plugins/callsite-jsx.ts +104 -6
  281. package/src/plugins/entries.ts +3 -0
  282. package/src/plugins/prerender-sugar.ts +34 -18
  283. package/src/plugins/routing.ts +3 -1
  284. package/src/routing/convention-lint.ts +18 -7
  285. package/src/routing/export-detect.ts +14 -117
  286. package/src/routing/route-options-lint.ts +153 -0
  287. package/src/routing/route-options.ts +423 -0
  288. package/src/routing/segment-keys.ts +50 -0
  289. package/src/rsc-runtime/vendor-types.d.ts +4 -0
  290. package/src/search-params/define.ts +1 -1
  291. package/src/server/als-registry.ts +29 -0
  292. package/src/server/client-state-tree.ts +30 -16
  293. package/src/server/cookie-context.ts +17 -0
  294. package/src/server/flight-source.ts +7 -1
  295. package/src/server/framework-stack-frames.ts +44 -0
  296. package/src/server/index.ts +7 -0
  297. package/src/server/prebuilt/capture-routes.ts +1 -1
  298. package/src/server/prebuilt-builder.ts +30 -2
  299. package/src/server/request-context.ts +28 -4
  300. package/src/server/route-element-builder.ts +80 -5
  301. package/src/server/route-module-loader.ts +43 -10
  302. package/src/server/rsc-cache-key-guard.ts +17 -2
  303. package/src/server/rsc-entry/index.ts +16 -0
  304. package/src/server/rsc-entry/render-route.ts +19 -1
  305. package/src/server/rsc-entry/revalidate-renderer.ts +17 -1
  306. package/src/server/segment-hash/outlet.ts +62 -18
  307. package/src/server/segment-lifetime/document-outlet.ts +98 -0
  308. package/src/server/segment-lifetime/key-digest.ts +139 -0
  309. package/src/server/segment-lifetime/read-rule.ts +136 -0
  310. package/src/server/segment-lifetime/read-scope.ts +99 -0
  311. package/src/server/segment-lifetime/segment-key.ts +140 -0
  312. package/src/server/segment-lifetime/slot-outlets.ts +180 -0
  313. package/src/server/slot-resolver.ts +99 -56
  314. package/src/server/slot-subtree-contain.ts +35 -182
  315. package/src/server/subtree-walk.ts +316 -0
  316. package/src/server/types.ts +85 -0
  317. package/src/shared/als-slots.ts +19 -8
  318. package/src/shared/cookie-read-through.ts +18 -0
  319. package/src/shared/outlet-decision.ts +25 -4
  320. package/src/shared/route-options-export.ts +14 -0
  321. package/src/shared/rsc-cache-key.ts +41 -2
  322. package/src/shared/segment-info.ts +6 -0
  323. package/src/shims/headers.ts +5 -4
  324. package/dist/_chunks/actions-DIgnvDrG.js.map +0 -1
  325. package/dist/_chunks/als-slots-kbQrHTzm.js.map +0 -1
  326. package/dist/_chunks/chains-CSslTUdI.js +0 -1
  327. package/dist/_chunks/cli-check-C3QOAru7.js.map +0 -1
  328. package/dist/_chunks/convention-lint-BoVISNS6.js.map +0 -1
  329. package/dist/_chunks/dev-server-B8roKA3Q.js +0 -1
  330. package/dist/_chunks/dev-server-C5R6jx8Q.js.map +0 -1
  331. package/dist/_chunks/dist-C1Rjlo6s.js.map +0 -1
  332. package/dist/_chunks/error-boundary-DB51f9ih.js.map +0 -1
  333. package/dist/_chunks/scanner-C9Lrf77z.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"scanner-C9Lrf77z.js","names":[],"sources":["../../src/routing/collision-spaces.ts","../../src/routing/slot-placement.ts","../../src/routing/file-cache.ts","../../src/routing/export-detect.ts","../../src/routing/scanner.ts"],"sourcesContent":["/**\n * Route collision spaces.\n *\n * A collision space is a set of routes that compete for URLs with each other,\n * and there are three: the main tree, each parallel slot, and each intercepting\n * subtree. This module owns the first two; `interception.ts` owns the third.\n * All of them decide order-dependence with the one oracle in\n * `collision-probe.ts`, so they cannot drift on what counts as two routes\n * answering a single URL.\n *\n * See design/07-routing.md §\"Route Collisions\".\n */\n\nimport type { SegmentNode } from './types.ts';\nimport { computeInterceptedUrlBase } from './interception.ts';\nimport { findOrderDependentCollision, type ProbeLeaf } from './collision-probe.ts';\n\n/**\n * Validate that no two pages/routes in one collision space answer the same URL.\n *\n * Two route groups like (auth)/login/page.tsx and (marketing)/login/page.tsx both claim\n * /login — the scanner must detect and reject this at build time.\n *\n * Each parallel slot is validated as its OWN collision space: a slot's pages\n * intentionally share URL paths with the parent tree (that's the point of\n * parallel routes), but two route groups INSIDE one slot claiming the same\n * URL — e.g. @side/(a)/x/page.tsx + @side/(b)/x/page.tsx — still collide.\n */\nexport function validateRouteGroupCollisions(root: SegmentNode): void {\n validateCollisionSpace(root, '', root.urlPath);\n}\n\n/**\n * Validate one collision space — the main tree, or one parallel slot.\n *\n * **Two checks, and the difference between them matters.** Two leaves at the\n * same `urlPath` are decided by string equality, which is exact and needs no\n * probing: `(auth)/login` and `(marketing)/login` claim one set of URLs\n * whatever the precedence rules are, and naming the shared path is the clearest\n * thing to tell the author.\n *\n * Everything else is decided by asking the matcher, through the shared oracle\n * in `collision-probe.ts` (TIM-1308). Comparing `urlPath` spellings misses\n * every pair that matches the same URLs while being *spelled* differently:\n * `x/(a)/[id]` beside `x/(b)/[slug]` are two bare dynamics in one priority\n * tier, and `x/(a)/page.tsx` beside `x/(b)/[[...rest]]` both answer `/x`\n * because an optional catch-all also matches zero parts. Both built before\n * TIM-1308 with filesystem enumeration order deciding which page renders,\n * which is precisely what this validator and `validateAffixedSiblingConflicts`\n * exist to reject.\n *\n * Segment *kinds* stay distinct without any special-casing here, because the\n * oracle inherits `matchNode`'s priority ordering: `x/(a)/[id]` beside\n * `x/(b)/[...rest]` resolves the same way in either `children` order, so it is\n * not reported. So does an affixed sibling against a bare one; the\n * equal-specificity affix tie is `validateAffixedSiblingConflicts`' job, and\n * duplicating it here would double-report.\n */\nfunction validateCollisionSpace(spaceRoot: SegmentNode, segmentPath: string, base: string): void {\n const leaves: ProbeLeaf[] = [];\n collectRoutableLeaves(spaceRoot, new Map(), segmentPath, [], leaves, base);\n\n const collision = findOrderDependentCollision(spaceRoot, leaves, base);\n if (!collision) return;\n\n throw new Error(\n `Build error: route collision — two pages/routes answer the same URL.\\n` +\n ` URL: ${collision.url}\\n` +\n ` File 1: ${collision.first}\\n` +\n ` File 2: ${collision.second}\\n` +\n `Both match it, so which one renders would be decided by filesystem enumeration ` +\n `order — renaming a route group can flip it. Rename or move one of them.\\n` +\n `Routes are compared by the URLs they match, not by how they are spelled: [id] and ` +\n `[slug] match the same URLs, and an optional catch-all also matches with zero ` +\n `segments.`\n );\n}\n\n/**\n * Walk one collision space and collect its routable leaves (page or route\n * files), throwing on an exact `urlPath` collision. Each slot recurses as its\n * OWN space — slots are parallel routes that intentionally share URL paths with\n * their parent tree, but collisions within a single slot are real errors.\n *\n * The early return at an intercepting node drops that subtree's own pages from\n * this space, but not its slots: a slot is its own collision space wherever it\n * sits, so `validateSlotsInsideInterceptingSubtree` picks those up before\n * returning.\n *\n * `chain` accumulates the URL-contributing nodes from the space root down, for\n * the probe oracle. Route groups are excluded because they are transparent for\n * matching, and the space root itself is excluded because `matchUrlParts`\n * matches parts against its *children* — the root consumes nothing.\n */\nfunction collectRoutableLeaves(\n node: SegmentNode,\n seen: Map<string, { filePath: string; segmentPath: string }>,\n segmentPath: string,\n chain: SegmentNode[],\n leaves: ProbeLeaf[],\n base: string\n): void {\n // Intercepting routes are resolved by the interception resolvers, not URL\n // matching, and their computed urlPaths are not addresses — an interception\n // mirrors the canonical route it replaces, so comparing those paths here\n // would reject every correct interception. Skipping is not \"unvalidated\":\n // `assertNoInterceptedPatternCollisions` gives each intercepting subtree its\n // own collision space, keyed by the intercepted pattern rather than by these\n // paths (TIM-1305). See design/07-routing.md §\"Collisions Inside an\n // Intercepting Subtree\" and §\"Why urlPath Stays Parent-Relative Inside an\n // Intercepting Subtree\".\n const currentPath = segmentPath\n ? `${segmentPath}/${node.segmentName}`\n : node.segmentName || '(root)';\n\n // The intercepting subtree's own pages leave this space — but its SLOTS do\n // not leave every space, so they are picked up before returning. See\n // `validateSlotsInsideInterceptingSubtree`.\n if (node.segmentType === 'intercepting') {\n // `node.urlPath` on an intercepting node is its OWNER's path — the input\n // `computeInterceptedUrlBase` wants — because an intercepting segment adds\n // no URL depth.\n validateSlotsInsideInterceptingSubtree(\n node,\n currentPath,\n interceptedBaseOf(node, node.urlPath)\n );\n return;\n }\n\n const routableFile = node.page ?? node.route;\n if (routableFile) {\n const existing = seen.get(node.urlPath);\n if (existing) {\n throw new Error(\n `Build error: route collision — multiple route groups produce a page/route at the same URL path.\\n` +\n ` URL path: ${urlFromChain(base, chain)}\\n` +\n ` File 1: ${existing.filePath} (via ${existing.segmentPath})\\n` +\n ` File 2: ${routableFile.filePath} (via ${currentPath})\\n` +\n `Each URL path must map to exactly one page or route handler. ` +\n `Rename or move one of the conflicting files.`\n );\n }\n seen.set(node.urlPath, { filePath: routableFile.filePath, segmentPath: currentPath });\n leaves.push({ filePath: routableFile.filePath, chain });\n }\n\n // Recurse into children. A route group contributes no URL part, so it is\n // absent from the chain — exactly as `collectEffectiveChildren` flattens it\n // away in the matcher.\n for (const child of node.children) {\n const isGroup = child.segmentType === 'group';\n collectRoutableLeaves(\n child,\n seen,\n currentPath,\n isGroup ? chain : [...chain, child],\n leaves,\n base\n );\n }\n\n // Recurse into slots — each slot is its own collision space, with its own\n // seen map, its own leaf set and its own probe run.\n //\n // The base is accumulated from this space's own base rather than read off\n // `slotNode.urlPath`, because this walk also runs on slot spaces nested inside\n // an intercepting subtree, where `urlPath` is parent-relative and not an\n // address. Outside one the two are identical by construction.\n for (const slotNode of Object.values(node.slots)) {\n validateCollisionSpace(slotNode, currentPath, urlFromChain(base, chain));\n }\n}\n\n/**\n * Validate every parallel slot nested anywhere inside an intercepting subtree.\n *\n * Two walks each skip these slots for their own good reason, and together they\n * left them checked by nothing: `collectRoutableLeaves` returns at the\n * intercepting node before it reaches them, and `walkInterceptedLeaves`\n * deliberately does not descend slots — correct for rewrite generation, since a\n * slot inside an intercepting subtree produces no rewrite. But \"produces no\n * rewrite\" answers the rewrite question and not the resolution one, so\n * `@side/(a)/x/page.tsx` beside `@side/(b)/x/page.tsx` under an interceptor\n * built with filesystem order picking the page — the ordinary per-slot\n * collision that fails the build anywhere else in the tree (codex, on PR #1002).\n *\n * A slot is its own collision space wherever it sits, so each one is validated\n * as one.\n *\n * **Which interception shape this still applies to.** TIM-1311 answered the\n * question this was written under — whether such a slot renders at all — and\n * the answer is per-shape:\n *\n * - **Children path** (`(browse)/(...)photo/@side`): the intercepting node\n * joins the main route chain, so `route-element-builder.ts` resolves slots on\n * it and below it like any other chain segment. They render, and this is the\n * space where the check is load-bearing.\n * - **Modal** (`feed/@modal/(.)photo/@side`): the slot sits inside another\n * slot's subtree, which no renderer descends for slots — so it never renders,\n * and `validateSlotPlacement` now rejects the placement before this runs.\n * That rule subsumes this one for the modal shape rather than conflicting\n * with it, exactly as anticipated.\n *\n * So this walk is reached only for children-path interceptors in a valid tree.\n * It is not narrowed to them: the rule it states — a slot is its own collision\n * space wherever it sits — is shape-independent, and making it conditional on a\n * property the placement validator already guarantees would just be a second\n * place for the two to disagree.\n *\n * The walk covers the whole subtree, not just the interceptor's direct slot\n * children: `(...)photo/[id]/@side` is reached by neither walk for exactly the\n * same reason as `(...)photo/@side`.\n */\nfunction validateSlotsInsideInterceptingSubtree(\n node: SegmentNode,\n segmentPath: string,\n base: string\n): void {\n for (const slotNode of Object.values(node.slots)) {\n // A slot adds no URL depth, so it answers its owner's base.\n validateCollisionSpace(slotNode, segmentPath, base);\n }\n for (const child of node.children) {\n validateSlotsInsideInterceptingSubtree(\n child,\n `${segmentPath}/${child.segmentName}`,\n childInterceptedBase(child, base)\n );\n }\n}\n\n/**\n * The URL a leaf answers, built from its space's base and its own chain.\n *\n * Read instead of `node.urlPath` because `urlPath` inside an intercepting\n * subtree is parent-relative and is not an address — the collision URL has to\n * be one the author can actually find. Outside an intercepting subtree the two\n * are identical by construction: the base is the space root's `urlPath` and the\n * chain is every URL-contributing segment below it.\n */\nfunction urlFromChain(base: string, chain: SegmentNode[]): string {\n if (chain.length === 0) return base || '/';\n const tail = chain.map((n) => n.segmentName).join('/');\n return `${base === '/' ? '' : base}/${tail}`;\n}\n\n/**\n * The intercepted URL an intercepting directory's own page sits at.\n *\n * `urlPath` inside an intercepting subtree is deliberately parent-relative and\n * is **not** an address (see design/07-routing.md §\"Why urlPath Stays\n * Parent-Relative Inside an Intercepting Subtree\"), so a collision reported\n * from one names a URL the author cannot find. The intercepted base is the real\n * address, and it is what rewrite generation and the interception collision\n * validator both already use.\n */\nfunction interceptedBaseOf(node: SegmentNode, ownerUrlPath: string): string {\n return computeInterceptedUrlBase(\n ownerUrlPath,\n node.interceptionMarker ?? '(.)',\n node.interceptedSegmentName ?? node.segmentName\n );\n}\n\n/**\n * Extend an intercepted base by one child segment.\n *\n * Route groups are transparent and contribute nothing. A nested intercepting\n * node re-bases from its own marker rather than appending — that tree is\n * rejected by `validateInterceptionPlacement`, but collision validation runs\n * first, so it still has to produce a sensible URL rather than one containing a\n * literal \"(.)b\".\n */\nfunction childInterceptedBase(child: SegmentNode, base: string): string {\n // Slots are not in `children` — `scanChildren` files them under `slots` — so\n // only groups are transparent here.\n if (child.segmentType === 'group') return base;\n if (child.segmentType === 'intercepting') return interceptedBaseOf(child, base);\n return base === '/' ? `/${child.segmentName}` : `${base}/${child.segmentName}`;\n}\n","/**\n * Parallel slot placement.\n *\n * One rule: a slot is resolved only for a segment on the **matched route\n * chain**, and a slot's own subtree is never on that chain. So a slot declared\n * anywhere inside another slot's subtree can never render, and is rejected at\n * build time rather than left as a directory the author will keep editing.\n *\n * See design/07-routing.md §\"Parallel Routes\".\n */\n\nimport type { SegmentNode } from './types.ts';\n\n/**\n * Reject every parallel slot that no renderer reaches.\n *\n * **Where slots are resolved.** Two places read `segment.slots`, and both walk\n * the main route chain: `route-element-builder.ts` (the RSC render).\n * It is not reachable from inside a slot. The slot's own\n * subtree is rendered by `slot-resolver.ts`, which walks the slot's matched\n * chain to apply that chain's layouts, error boundaries and access gates\n * (`wrapWithIntermediateSegments`, `wrapWithLayout`) and never reads `.slots`\n * on any of those nodes. So `app/feed/@modal/photo/@side/page.tsx` and\n * everything below it is dead: the file is scanned, typed, code-split and\n * shipped, and no request can render it.\n *\n * That is the TIM-1278 failure — a directory that silently never renders —\n * and the reason it is a build error rather than a documented limit is that\n * nothing at request time can report it. A slot that does not match renders\n * `default.tsx` or `null`, which is exactly what a slot the resolver never\n * looked at also produces, so the author sees the *designed* behaviour of a\n * non-matching slot and has no signal to distinguish it from a slot that\n * cannot match at all.\n *\n * **Interception is incidental.** TIM-1311 arrived as\n * `feed/@modal/(.)photo/@side`, and the interception contributes nothing: the\n * identical `feed/@modal/photo/@side` never renders either, for the same\n * reason and with no marker anywhere. Rejecting only the intercepting spelling\n * would have drawn a line the author cannot see from the directory names.\n *\n * The children-path interception shape is **not** affected and must not be:\n * its intercepting node joins the main chain (`server/children-interception.ts`\n * splices `[…owner ancestors, interceptingNode, …descendants]` into an ordinary\n * `RouteMatch`), so `route-element-builder.ts` resolves slots on it and below\n * it exactly as it does for any other chain segment. `(browse)/(...)photo/[id]/@side`\n * renders; `feed/@modal/(.)photo/@side` does not. The discriminator is the slot\n * boundary, which is what this walk tracks — not the marker.\n */\nexport function validateSlotPlacement(root: SegmentNode): void {\n walkForSlotPlacement(root, '', null);\n}\n\n/**\n * `enclosingSlotPath` is the `app/`-relative path of the nearest slot at or\n * above `node`, or null on the main chain. It is carried rather than recomputed\n * so the error can name the slot that swallows the offender — \"this is inside\n * @modal\" is the part of the diagnosis the author cannot see from the offending\n * path alone.\n */\nfunction walkForSlotPlacement(\n node: SegmentNode,\n path: string,\n enclosingSlotPath: string | null\n): void {\n for (const [slotName, slotNode] of Object.entries(node.slots)) {\n const slotPath = path ? `${path}/@${slotName}` : `@${slotName}`;\n if (enclosingSlotPath !== null) {\n throwNestedSlot(slotPath, enclosingSlotPath);\n }\n walkForSlotPlacement(slotNode, slotPath, slotPath);\n }\n\n for (const child of node.children) {\n walkForSlotPlacement(\n child,\n path ? `${path}/${child.segmentName}` : child.segmentName,\n enclosingSlotPath\n );\n }\n}\n\nfunction throwNestedSlot(slotPath: string, enclosingSlotPath: string): never {\n throw new Error(\n `Build error: parallel slot nested inside another parallel slot.\\n` +\n ` Directory: app/${slotPath}\\n` +\n ` Inside: app/${enclosingSlotPath}\\n` +\n `A parallel slot is resolved only for a segment on the matched route chain, and a ` +\n `slot's own subtree is never on that chain — the slot resolver walks the slot's ` +\n `matched chain to apply its layouts, error boundaries and access gates, and never ` +\n `looks at slots declared inside it. So app/${slotPath} and everything below it can ` +\n `never render, and no request-time signal can tell you: an unreachable slot ` +\n `produces exactly what a slot that simply did not match produces.\\n` +\n `Declare the slot on a segment of the main route chain instead, or move its pages ` +\n `into app/${enclosingSlotPath}'s own subtree.\\n` +\n `See design/07-routing.md §\"Parallel Routes\".`\n );\n}\n","import { readFileSync, statSync } from 'node:fs';\n\nconst cache = new Map<string, { mtimeMs: number; size: number; content: string }>();\n\n/**\n * Read a file's text content, returning a cached copy when the file\n * hasn't been modified since the last read (checked via mtime + size).\n *\n * Falls back to a fresh read on any stat/read error.\n */\nexport function readFileCached(filePath: string): string {\n try {\n const stat = statSync(filePath);\n const entry = cache.get(filePath);\n if (entry && entry.mtimeMs === stat.mtimeMs && entry.size === stat.size) return entry.content;\n const content = readFileSync(filePath, 'utf-8');\n cache.set(filePath, { mtimeMs: stat.mtimeMs, size: stat.size, content });\n return content;\n } catch {\n cache.delete(filePath);\n return readFileSync(filePath, 'utf-8');\n }\n}\n","/**\n * AST-based export detection for route files.\n *\n * Uses Vite's `parseAst` (backed by oxc) to precisely detect named and\n * default exports, replacing the regex-based approach that was fragile\n * with TypeScript syntax (type exports, `as` aliases, comments, etc.).\n */\n\nimport { existsSync } from 'node:fs';\nimport { parseAst } from 'vite';\nimport { readFileCached } from './file-cache.ts';\n\ninterface AstNode {\n type: string;\n exportKind?: string;\n declaration?: AstNode;\n specifiers?: Array<{\n exported?: { name: string };\n local?: { name: string };\n exportKind?: string;\n }>;\n id?: { name: string };\n declarations?: Array<{ id?: { name: string }; init?: AstNode }>;\n /** Set on re-exports: `export { X } from './y'`. Absent on local exports. */\n source?: { value?: string } | null;\n /** Set on runtime-transparent wrappers: `X as T`, `X satisfies T`, `(X)`, `X!`. */\n expression?: AstNode;\n /** Set on `Identifier` nodes. */\n name?: string;\n}\n\ninterface ProgramNode {\n body: AstNode[];\n}\n\nfunction tryParse(source: string): ProgramNode | null {\n try {\n return parseAst(source, { lang: 'tsx' }) as unknown as ProgramNode;\n } catch {\n return null;\n }\n}\n\n/**\n * Collect all named export identifiers from a parsed program.\n * Handles: `export function X`, `export const X`, `export { X }`,\n * `export { X } from '...'`, `export { Y as X }`.\n */\nfunction collectNamedExports(program: ProgramNode): Set<string> {\n const names = new Set<string>();\n for (const stmt of program.body) {\n if (stmt.type !== 'ExportNamedDeclaration') continue;\n // Skip `export type ...` declarations — they're erased at runtime\n if (stmt.exportKind === 'type') continue;\n\n if (stmt.declaration) {\n if (stmt.declaration.id?.name) {\n names.add(stmt.declaration.id.name);\n }\n if (stmt.declaration.declarations) {\n for (const decl of stmt.declaration.declarations) {\n if (decl.id?.name) names.add(decl.id.name);\n }\n }\n }\n\n if (stmt.specifiers) {\n for (const spec of stmt.specifiers) {\n // Skip `export { type X }` — per-specifier type exports\n if (spec.exportKind === 'type') continue;\n if (spec.exported?.name && spec.exported.name !== 'default') {\n names.add(spec.exported.name);\n }\n }\n }\n }\n return names;\n}\n\n/**\n * The specifier exporting a *runtime* default from this statement, if any.\n *\n * Type-only exports erase, so they are not default exports at runtime — and\n * TypeScript spells that two ways, on two different nodes: `export type { X as\n * default }` marks the **statement**, `export { type X as default }` marks the\n * **specifier**. Both have to be checked, or a type alias reads as a component:\n * a status file whose only default is a type has nothing for the error boundary\n * to receive (the renderer's `mod?.default` skips it), so treating it as one\n * would fail a build over a file that cannot break anything.\n *\n * One implementation because two callers must agree on what \"has a default\n * export\" means: `hasDefaultExport` decides whether to warn that a page has\n * none, and `fileDefaultExportIsLocalValue` decides whether to fail the build.\n */\nfunction defaultSpecifier(stmt: AstNode): NonNullable<AstNode['specifiers']>[number] | null {\n if (stmt.type !== 'ExportNamedDeclaration' || !stmt.specifiers) return null;\n if (stmt.exportKind === 'type') return null;\n for (const spec of stmt.specifiers) {\n if (spec.exportKind === 'type') continue;\n if (spec.exported?.name === 'default') return spec;\n }\n return null;\n}\n\n/**\n * Check whether a program has a default export.\n * Handles: `export default ...`, `export { X as default }`,\n * `export { default } from '...'`. Type-only defaults do not count —\n * see `defaultSpecifier`.\n */\nfunction hasDefaultExport(program: ProgramNode): boolean {\n for (const stmt of program.body) {\n if (stmt.type === 'ExportDefaultDeclaration') return true;\n if (defaultSpecifier(stmt)) return true;\n }\n return false;\n}\n\n/**\n * Check whether a program has any bare `export * from '...'` declarations.\n * Excludes `export * as X from '...'` (namespace re-exports) since those\n * create a namespace object, not individual top-level exports.\n */\nfunction hasStarExport(program: ProgramNode): boolean {\n return program.body.some(\n (stmt) =>\n stmt.type === 'ExportAllDeclaration' && !(stmt as any).exported && stmt.exportKind !== 'type'\n );\n}\n\n/**\n * Check if a file exports a specific named export.\n * Returns false if the file doesn't exist or can't be parsed.\n */\nexport function fileHasExport(filePath: string, exportName: string): boolean {\n if (!existsSync(filePath)) return false;\n try {\n const source = readFileCached(filePath);\n const program = tryParse(source);\n if (!program) return false;\n return collectNamedExports(program).has(exportName);\n } catch {\n return false;\n }\n}\n\n/**\n * Check if a file has any of the given named exports.\n * Returns the set of matching export names.\n */\nexport function fileHasAnyExport(filePath: string, exportNames: readonly string[]): Set<string> {\n const matches = new Set<string>();\n try {\n const source = readFileCached(filePath);\n const program = tryParse(source);\n if (!program) return matches;\n const exports = collectNamedExports(program);\n for (const name of exportNames) {\n if (exports.has(name)) matches.add(name);\n }\n } catch {\n // Graceful fallback: return empty set\n }\n return matches;\n}\n\n/**\n * Check if a file has a default export.\n * Returns false if the file doesn't exist or can't be parsed.\n */\nexport function fileHasDefaultExport(filePath: string): boolean {\n if (!existsSync(filePath)) return false;\n try {\n const source = readFileCached(filePath);\n const program = tryParse(source);\n if (!program) return false;\n return hasDefaultExport(program);\n } catch {\n return false;\n }\n}\n\n/** Node types whose value is unambiguously constructed by this module. */\nconst FUNCTION_LIKE = new Set([\n 'FunctionDeclaration',\n 'FunctionExpression',\n 'ArrowFunctionExpression',\n 'ClassDeclaration',\n 'ClassExpression',\n]);\n\n/**\n * Expression wrappers that erase at runtime and so cannot change where a value\n * was constructed: `X as T`, `X satisfies T`, `<T>X`, `X!`, `X<T>`, `(X)`.\n */\nconst TRANSPARENT_WRAPPERS = new Set([\n 'TSAsExpression',\n 'TSSatisfiesExpression',\n 'TSTypeAssertion',\n 'TSNonNullExpression',\n 'TSInstantiationExpression',\n 'ParenthesizedExpression',\n]);\n\n/**\n * Strip runtime-transparent wrappers so the node underneath can be classified.\n *\n * Without this, `(() => <h1 />) satisfies React.FC` reads as a\n * `TSSatisfiesExpression` rather than the arrow function it compiles to, and a\n * provably-local component is misread as one whose origin cannot be\n * determined — turning a build error into a warning.\n */\nfunction unwrapTransparent(node: AstNode): AstNode {\n let current = node;\n while (TRANSPARENT_WRAPPERS.has(current.type) && current.expression) {\n current = current.expression;\n }\n return current;\n}\n\n/**\n * Whether `name` is bound at module top level to a function or class written\n * in this file. An imported binding can never match: imports are\n * `ImportDeclaration` specifiers, not function/class/variable declarations,\n * and a module-level name cannot be both.\n */\nfunction bindsLocalFunction(program: ProgramNode, name: string): boolean {\n for (const stmt of program.body) {\n // `export function X() {}` binds X locally too — unwrap the export.\n const decl = stmt.type === 'ExportNamedDeclaration' ? stmt.declaration : stmt;\n if (!decl) continue;\n if (\n (decl.type === 'FunctionDeclaration' || decl.type === 'ClassDeclaration') &&\n decl.id?.name === name\n ) {\n return true;\n }\n if (decl.type === 'VariableDeclaration') {\n for (const d of decl.declarations ?? []) {\n if (d.id?.name === name && d.init && FUNCTION_LIKE.has(unwrapTransparent(d.init).type)) {\n return true;\n }\n }\n }\n }\n return false;\n}\n\n/**\n * Whether the default export is *provably* a value constructed by this module:\n * `export default function/class/() => {}`, or a name bound to a function or\n * class declared here — whether it leaves via `export default Name` or\n * `export { Name as default }`. Both spellings are the same fact about where\n * the value was built, so both must answer the same way.\n *\n * This is the sound half of \"is this a server component?\". A file with no\n * `'use client'` directive whose default export is built here is a server\n * component, full stop. Everything else — `export { default } from\n * './client-thing'`, `export default Imported`, `export default memo(X)`,\n * an unparseable file — returns false, because the exported value may have\n * been minted in a module that *does* carry the directive. Callers must not\n * infer \"server component\" from a missing directive alone.\n */\nexport function fileDefaultExportIsLocalValue(filePath: string): boolean {\n if (!existsSync(filePath)) return false;\n try {\n const source = readFileCached(filePath);\n const program = tryParse(source);\n if (!program) return false;\n for (const stmt of program.body) {\n if (stmt.type === 'ExportDefaultDeclaration') {\n const decl = stmt.declaration && unwrapTransparent(stmt.declaration);\n if (!decl) return false;\n if (FUNCTION_LIKE.has(decl.type)) return true;\n if (decl.type === 'Identifier' && decl.name) {\n return bindsLocalFunction(program, decl.name);\n }\n return false;\n }\n\n // `export { Name as default }` — the same default export by another\n // spelling. `hasDefaultExport` already counts it, so an analysis that\n // skipped it here would let the exact defect this powers slip through\n // as a warning.\n const spec = defaultSpecifier(stmt);\n if (spec) {\n // `export { X as default } from './client-thing'` re-exports another\n // module's value — the directive governing it lives over there.\n if (stmt.source) return false;\n return spec.local?.name ? bindsLocalFunction(program, spec.local.name) : false;\n }\n }\n return false;\n } catch {\n return false;\n }\n}\n\n/**\n * Check if a file has any `export * from '...'` declarations.\n * Returns false if the file doesn't exist or can't be parsed.\n */\nexport function fileHasStarExport(filePath: string): boolean {\n if (!existsSync(filePath)) return false;\n try {\n const source = readFileCached(filePath);\n const program = tryParse(source);\n if (!program) return false;\n return hasStarExport(program);\n } catch {\n return false;\n }\n}\n\n/**\n * Parsed value of `export const prerender` from a route file.\n *\n * - `true` / `false` — literal boolean\n * - `{ ttl?, tags? }` — ISR options object (prerender: true is implied)\n * - `undefined` — no `export const prerender` found\n *\n * See design/45-cache-lifetimes.md §\"Route-Level Static\".\n */\nexport type PrerenderExportValue = boolean | { ttl?: number; tags?: string[] };\n\nfunction extractLiteralValue(node: AstNode): unknown {\n if (!node) return undefined;\n const n = node as any;\n if (n.type === 'Literal') return n.value;\n if (n.type === 'UnaryExpression' && n.operator === '-' && n.argument?.type === 'Literal') {\n return -(n.argument.value as number);\n }\n if (n.type === 'ArrayExpression') {\n const elements = n.elements as AstNode[] | undefined;\n if (!elements) return undefined;\n const result: unknown[] = [];\n for (const el of elements) {\n const v = extractLiteralValue(el);\n if (v === undefined) return undefined;\n result.push(v);\n }\n return result;\n }\n return undefined;\n}\n\nfunction extractObjectLiteral(node: AstNode): Record<string, unknown> | undefined {\n if ((node as any).type !== 'ObjectExpression') return undefined;\n const props = (node as any).properties as AstNode[] | undefined;\n if (!props) return undefined;\n const result: Record<string, unknown> = {};\n for (const prop of props) {\n const p = prop as any;\n if (p.type === 'SpreadElement') return undefined;\n if (p.type !== 'Property' || p.computed) return undefined;\n const key =\n p.key?.type === 'Identifier'\n ? p.key.name\n : p.key?.type === 'Literal'\n ? String(p.key.value)\n : undefined;\n if (!key) return undefined;\n const value = extractLiteralValue(p.value);\n if (value === undefined) return undefined;\n result[key] = value;\n }\n return result;\n}\n\n/**\n * Extract the value of `export const prerender` from a file.\n * Returns undefined if the file doesn't export `prerender` or can't be parsed.\n *\n * Supports:\n * export const prerender = true;\n * export const prerender = false;\n * export const prerender = { ttl: 3600, tags: ['docs'] };\n */\nexport function getPrerenderExport(filePath: string): PrerenderExportValue | undefined {\n if (!existsSync(filePath)) return undefined;\n try {\n const source = readFileCached(filePath);\n const program = tryParse(source);\n if (!program) return undefined;\n\n for (const stmt of program.body) {\n if (stmt.type !== 'ExportNamedDeclaration') continue;\n if (stmt.exportKind === 'type') continue;\n if (!stmt.declaration) continue;\n const decl = stmt.declaration;\n if (decl.type !== 'VariableDeclaration') continue;\n const declarations = decl.declarations as\n | Array<{\n id?: { name?: string };\n init?: AstNode;\n }>\n | undefined;\n if (!declarations) continue;\n for (const d of declarations) {\n if (d.id?.name !== 'prerender' || !d.init) continue;\n const init = d.init as any;\n if (init.type === 'Literal' && typeof init.value === 'boolean') {\n return init.value;\n }\n if (init.type === 'ObjectExpression') {\n const obj = extractObjectLiteral(init);\n if (!obj) return undefined;\n const result: { ttl?: number; tags?: string[] } = {};\n if ('ttl' in obj && typeof obj.ttl === 'number') result.ttl = obj.ttl;\n if (\n 'tags' in obj &&\n Array.isArray(obj.tags) &&\n obj.tags.every((t: unknown) => typeof t === 'string')\n ) {\n result.tags = obj.tags as string[];\n }\n return result;\n }\n return undefined;\n }\n }\n return undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * How a file declares the per-route CSRF exemption.\n *\n * - `'absent'` — no runtime export named `csrf`.\n * - `'exempt'` — exactly `export const csrf = false` (wrappers like\n * `false as const` allowed), declared in this file.\n * - `'invalid'` — some other `csrf` export: another value, `let`, a\n * destructured binding, a specifier or named re-export (`export { csrf }`,\n * `export { x as \"csrf\" }`), a function or class. `export * from` is not\n * followed: a `csrf` it carries is neither exempt nor an error.\n *\n * The exemption is read from source at build time, never from the loaded\n * module, because the CSRF gate runs before any user code (see\n * design/08-forms-and-actions.md §\"Per-route exemption\"). Only the literal\n * form can be read that way; any other spelling is a build error rather\n * than a silent \"not exempt\", so what the developer wrote is what runs.\n */\nexport type CsrfExport = 'absent' | 'exempt' | 'invalid';\n\nexport function getCsrfExport(filePath: string): CsrfExport {\n if (!existsSync(filePath)) return 'absent';\n // Unparseable: not exempt (fail closed). The compiler reports the syntax\n // error; guessing at a half-written file would misreport it.\n const program = tryParse(readFileCached(filePath));\n if (!program) return 'absent';\n\n // Walk the statements directly rather than through `collectNamedExports`:\n // every spelling that exports a runtime `csrf` must be seen here, and\n // that helper does not see destructured declarations or string-literal\n // specifier names. What cannot be seen at all — `export * from` — is\n // not read, and is documented as such.\n let found: CsrfExport = 'absent';\n for (const stmt of program.body) {\n if (stmt.type !== 'ExportNamedDeclaration' || stmt.exportKind === 'type') continue;\n for (const spec of stmt.specifiers ?? []) {\n if (spec.exportKind !== 'type' && specifierName(spec.exported) === 'csrf') {\n return 'invalid';\n }\n }\n const decl = stmt.declaration as (AstNode & { kind?: string }) | undefined;\n if (!decl) continue;\n if (decl.id?.name === 'csrf') return 'invalid'; // function or class\n if (decl.type !== 'VariableDeclaration') continue;\n for (const d of decl.declarations ?? []) {\n const id = d.id as AstNode | undefined;\n if (id?.type === 'Identifier') {\n if (id.name !== 'csrf') continue;\n const init = d.init && (unwrapTransparent(d.init) as AstNode & { value?: unknown });\n const literalFalse = init?.type === 'Literal' && init.value === false;\n if (decl.kind !== 'const' || !literalFalse) return 'invalid';\n found = 'exempt';\n } else if (id && patternBinds(id, 'csrf')) {\n return 'invalid'; // `export const { csrf } = …`\n }\n }\n }\n return found;\n}\n\n/** An export specifier's name: `csrf` or the string literal `\"csrf\"`. */\nfunction specifierName(node: { name?: string; value?: unknown } | undefined): string | undefined {\n if (!node) return undefined;\n return typeof node.value === 'string' ? node.value : node.name;\n}\n\n/** Whether a destructuring pattern binds `name` anywhere inside it. */\nfunction patternBinds(node: unknown, name: string): boolean {\n if (!node || typeof node !== 'object') return false;\n const n = node as Record<string, unknown>;\n switch (n.type) {\n case 'Identifier':\n return n.name === name;\n case 'ObjectPattern':\n return ((n.properties as unknown[]) ?? []).some((prop) => {\n const p = prop as Record<string, unknown>;\n return patternBinds(p.type === 'RestElement' ? p.argument : p.value, name);\n });\n case 'ArrayPattern':\n return ((n.elements as unknown[]) ?? []).some((el) => patternBinds(el, name));\n case 'RestElement':\n return patternBinds(n.argument, name);\n case 'AssignmentPattern':\n return patternBinds(n.left, name);\n default:\n return false;\n }\n}\n\n/**\n * Check if a file starts with a specific directive (e.g. \"use client\").\n * Directives are string literal expression statements at the top of the file.\n */\nexport function fileHasDirective(filePath: string, directive: string): boolean {\n if (!existsSync(filePath)) return false;\n try {\n const source = readFileCached(filePath);\n const program = tryParse(source);\n if (!program) return false;\n for (const stmt of program.body) {\n if (stmt.type !== 'ExpressionStatement') break;\n const expr = (stmt as any).expression;\n if (expr?.type !== 'Literal' || typeof expr.value !== 'string') break;\n if (expr.value === directive) return true;\n }\n return false;\n } catch {\n return false;\n }\n}\n","/**\n * Route discovery scanner.\n *\n * Pure function: (appDir, config) → RouteTree\n *\n * Scans the app/ directory and builds a segment tree recognizing all\n * timber.js file conventions. Does NOT handle request matching — this\n * is discovery only.\n */\n\nimport { readdirSync, statSync } from 'node:fs';\nimport { join, extname, basename } from 'node:path';\nimport type {\n RouteTree,\n SegmentNode,\n SegmentType,\n RouteFile,\n ScannerConfig,\n InterceptionMarker,\n} from './types.ts';\nimport { classifySegment, effectiveUrlSegment } from './segment-classify.ts';\nimport { validateInterceptionPlacement, computeInterceptedBase } from './interception.ts';\nimport { validateRouteGroupCollisions } from './collision-spaces.ts';\nimport { validateSlotPlacement } from './slot-placement.ts';\nimport { DEFAULT_PAGE_EXTENSIONS } from './types.ts';\nimport { classifyMetadataRoute, isDynamicMetadataExtension } from '../server/metadata-routes.ts';\nimport { swallow } from '../server/logger.ts';\nimport { getCsrfExport } from './export-detect.ts';\nimport { ENCODED_SEPARATOR_RE, NULL_BYTE_RE } from '../server/canonicalize.ts';\n\n/**\n * File convention names that use pageExtensions (can be .tsx, .ts, .jsx, .js, .mdx, etc.)\n * `error` is excluded — it only accepts script extensions (TIM-1505).\n */\nconst PAGE_EXT_CONVENTIONS = new Set(['page', 'layout', 'default', 'denied']);\n\n/**\n * File convention names that are always .ts/.tsx (never .mdx etc.)\n */\nconst FIXED_CONVENTIONS = new Set(['middleware', 'access', 'route']);\n\n/**\n * Status-code file patterns:\n * - Exact 3-digit codes: 401.tsx, 429.tsx, 503.tsx\n * - Category catch-alls: 4xx.tsx, 5xx.tsx\n */\nconst STATUS_CODE_PATTERN = /^(\\d{3}|[45]xx)$/;\n\n/**\n * Whether a basename + extension pair is a route-convention file the\n * framework itself imports: page/layout/default/denied on pageExtensions,\n * error/global-error and status-code files on script extensions only,\n * middleware/access/route/proxy on .ts/.tsx/.js/.jsx only, and\n * status-code .json files — mirroring this scanner's own recognition\n * rules per family.\n *\n * Exported for the analyze classifier so its provisional classification\n * (design/47 §2) derives from the scanner's real conventions instead of\n * a duplicate list that can drift.\n */\nexport function isRouteConventionFile(\n base: string,\n ext: string,\n pageExtensions: readonly string[] = DEFAULT_PAGE_EXTENSIONS\n): boolean {\n const isPageExt = pageExtensions.includes(ext);\n const isScriptExt = /^[jt]sx?$/.test(ext);\n if (PAGE_EXT_CONVENTIONS.has(base) && isPageExt) return true;\n if ((base === 'error' || base === 'global-error') && isScriptExt) return true;\n if ((FIXED_CONVENTIONS.has(base) || base === 'proxy') && isScriptExt) return true;\n if (STATUS_CODE_PATTERN.test(base) && (isScriptExt || ext === 'json')) return true;\n return false;\n}\n\n/**\n * Scan the app/ directory and build the route tree.\n *\n * @param appDir - Absolute path to the app/ directory\n * @param config - Scanner configuration\n * @returns The complete route tree\n */\nexport function scanRoutes(appDir: string, config: ScannerConfig = {}): RouteTree {\n const pageExtensions = config.pageExtensions ?? DEFAULT_PAGE_EXTENSIONS;\n const extSet = new Set(pageExtensions);\n\n const tree: RouteTree = {\n root: createSegmentNode('', 'static', '/'),\n };\n\n // Check for proxy.ts at app root\n const proxyFile = findFixedFile(appDir, 'proxy');\n if (proxyFile) {\n tree.proxy = proxyFile;\n }\n\n // Check for global-error.{tsx,ts,jsx,js} at app root.\n // Tier 2 error page — renders standalone (no layouts) when no segment-level\n // error file is found. Script extensions only — MDX not supported (TIM-1505).\n // See design/10-error-handling.md §\"Tier 2\".\n const globalErrorFile = findScriptExtFile(appDir, 'global-error');\n if (globalErrorFile) {\n tree.globalError = globalErrorFile;\n }\n\n // Scan the root directory's files\n scanSegmentFiles(appDir, tree.root, extSet);\n\n // Scan children recursively\n scanChildren(appDir, tree.root, extSet);\n\n // Validate: every parallel slot sits where a renderer reaches it. First,\n // because a slot nested inside another slot never renders, and a collision\n // reported from inside one would send the author to fix an ambiguity between\n // two pages that were both already dead.\n validateSlotPlacement(tree.root);\n\n // Validate: detect route group collisions (different groups producing pages at the same URL)\n validateRouteGroupCollisions(tree.root);\n\n // Validate: detect duplicate param names in nested dynamic segments\n // e.g., /[id]/items/[id] — same param name in ancestor and descendant\n validateDuplicateParamNames(tree.root);\n\n // Validate: detect same param name used with different bracket forms\n // e.g., [id] in one route and [...id] in another\n validateUniqueBracketForms(tree.root);\n\n // Validate: detect affixed dynamic siblings with equal specificity\n // e.g., a-[id] and [slug]-b both have prefix+suffix length = 2\n validateAffixedSiblingConflicts(tree.root);\n\n // Validate: intercepting routes must be direct children of a parallel slot —\n // the slot resolver is the only thing that can render one.\n validateInterceptionPlacement(tree.root);\n\n return tree;\n}\n\n/**\n * Create an empty segment node.\n */\nfunction createSegmentNode(\n segmentName: string,\n segmentType: SegmentType,\n urlPath: string,\n paramName?: string,\n interceptionMarker?: InterceptionMarker,\n interceptedSegmentName?: string,\n paramPrefix?: string,\n paramSuffix?: string\n): SegmentNode {\n return {\n segmentName,\n segmentType,\n urlPath,\n paramName,\n paramPrefix,\n paramSuffix,\n interceptionMarker,\n interceptedSegmentName,\n children: [],\n slots: {},\n };\n}\n\n/**\n * Compute the URL path for a child segment given its parent's URL path.\n * Route groups, slots, and intercepting routes do NOT add URL depth.\n */\nfunction computeUrlPath(parentUrlPath: string, dirName: string, segmentType: SegmentType): string {\n // Groups, slots, and intercepting routes don't add to URL path\n if (segmentType === 'group' || segmentType === 'slot' || segmentType === 'intercepting') {\n return parentUrlPath;\n }\n\n const parentPath = parentUrlPath === '/' ? '' : parentUrlPath;\n return `${parentPath}/${dirName}`;\n}\n\n/**\n * Scan a directory for file conventions and populate the segment node.\n */\nfunction scanSegmentFiles(dirPath: string, node: SegmentNode, extSet: Set<string>): void {\n let entries: string[];\n try {\n entries = readdirSync(dirPath);\n } catch (err) {\n swallow(err, `scanSegmentFiles: unreadable directory ${dirPath}`, { level: 'warn' });\n return;\n }\n\n for (const entry of entries) {\n const fullPath = join(dirPath, entry);\n\n // Skip directories — handled by scanChildren\n try {\n if (statSync(fullPath).isDirectory()) continue;\n } catch {\n continue;\n }\n\n const ext = extname(entry).slice(1); // remove leading dot\n const name = basename(entry, `.${ext}`);\n\n // Page-extension conventions (page, layout, default, denied)\n if (PAGE_EXT_CONVENTIONS.has(name) && extSet.has(ext)) {\n const key = name as 'page' | 'layout' | 'default' | 'denied';\n const existing = node[key];\n if (existing) {\n throwDuplicateConvention(name, existing.filePath, fullPath);\n }\n node[key] = { filePath: fullPath, extension: ext };\n continue;\n }\n\n // error.tsx — script extensions only, not MDX/MD (TIM-1505).\n if (name === 'error' && /^[jt]sx?$/.test(ext)) {\n const existing = node.error;\n if (existing) {\n throwDuplicateConvention('error', existing.filePath, fullPath);\n }\n node.error = { filePath: fullPath, extension: ext };\n continue;\n }\n\n // Fixed conventions (middleware, access, route) — only\n // .ts/.tsx/.js/.jsx, never pageExtensions like .mdx. The regex is\n // anchored: mts/cts/mjs/cjs (and stray tail matches like `.foots`)\n // are NOT recognized. See design/07-routing.md §\"Page Extensions\".\n if (FIXED_CONVENTIONS.has(name) && /^[jt]sx?$/.test(ext)) {\n const key = name as 'middleware' | 'access' | 'route';\n const existing = node[key];\n if (existing) {\n throwDuplicateConvention(name, existing.filePath, fullPath);\n }\n node[key] = { filePath: fullPath, extension: ext };\n continue;\n }\n\n // JSON status-code files (401.json, 4xx.json, 503.json, 5xx.json)\n // Recognized regardless of pageExtensions — .json is a data format, not a page extension.\n if (STATUS_CODE_PATTERN.test(name) && ext === 'json') {\n if (!node.jsonStatusFiles) {\n node.jsonStatusFiles = {};\n }\n node.jsonStatusFiles[name] = { filePath: fullPath, extension: ext };\n continue;\n }\n\n // Status-code files (401.tsx, 4xx.tsx, 503.tsx, 5xx.tsx) — script extensions only (TIM-1505)\n if (STATUS_CODE_PATTERN.test(name) && /^[jt]sx?$/.test(ext)) {\n if (!node.statusFiles) {\n node.statusFiles = {};\n }\n const existing = node.statusFiles[name];\n if (existing) {\n throwDuplicateConvention(name, existing.filePath, fullPath);\n }\n node.statusFiles[name] = { filePath: fullPath, extension: ext };\n continue;\n }\n\n // Metadata route files (sitemap.ts, robots.ts, icon.tsx, opengraph-image.tsx, etc.)\n // Both static (.xml, .txt, .png, .ico, etc.) and dynamic (.ts, .tsx) files are recognized.\n // When both exist for the same base name, dynamic takes precedence.\n // Two files of the SAME kind (static+static or dynamic+dynamic) are a\n // build error — picking one by readdir order is platform-dependent.\n // See design/16-metadata.md §\"Metadata Routes\"\n const metaInfo = classifyMetadataRoute(entry);\n if (metaInfo) {\n if (!metaInfo.nestable && node.segmentName !== '') {\n throw new Error(\n `Build error: '${name}' is a root-only metadata convention and must be in the app root directory.\\n` +\n ` File: ${fullPath}\\n` +\n ` Move this file to the app root (not a route group or nested segment).`\n );\n }\n if (!node.metadataRoutes) {\n node.metadataRoutes = {};\n }\n const existing = node.metadataRoutes[name];\n if (existing) {\n const existingIsDynamic = isDynamicMetadataExtension(name, existing.extension);\n const newIsDynamic = isDynamicMetadataExtension(name, ext);\n if (existingIsDynamic === newIsDynamic) {\n throwDuplicateConvention(name, existing.filePath, fullPath);\n }\n // Dynamic > static precedence: overwrite only when the new file is dynamic.\n if (newIsDynamic) {\n node.metadataRoutes[name] = { filePath: fullPath, extension: ext };\n }\n } else {\n node.metadataRoutes[name] = { filePath: fullPath, extension: ext };\n }\n }\n }\n\n // Validate: route.ts + page.* is a hard build error\n if (node.route && node.page) {\n throw new Error(\n `Build error: route.ts and page.* cannot coexist in the same segment.\\n` +\n ` route.ts: ${node.route.filePath}\\n` +\n ` page: ${node.page.filePath}\\n` +\n `A URL is either an API endpoint or a rendered page, not both.`\n );\n }\n\n // The per-route CSRF exemption is read from source here, at scan time, so\n // the manifest carries it and the request gate never loads user code to\n // decide it. Any other spelling of the export is a lint error\n // (convention-lint.ts `checkCsrfExports`).\n if (node.route && getCsrfExport(node.route.filePath) === 'exempt') {\n node.csrfExempt = true;\n }\n}\n\n/**\n * Throw a build error for two files claiming the same convention slot in\n * one segment (e.g. page.tsx + page.jsx). Which file readdir returns first\n * is platform-dependent (APFS sorts entries, ext4 does not) — silently\n * picking one would let macOS dev and Linux CI serve different\n * implementations of the same route.\n */\nfunction throwDuplicateConvention(\n convention: string,\n firstPath: string,\n secondPath: string\n): never {\n throw new Error(\n `Build error: duplicate '${convention}' files in the same route segment.\\n` +\n ` File 1: ${firstPath}\\n` +\n ` File 2: ${secondPath}\\n` +\n `Each segment may define '${convention}' at most once. Remove one of the files.`\n );\n}\n\n/**\n * Recursively scan child directories and build the segment tree.\n */\nfunction scanChildren(dirPath: string, parentNode: SegmentNode, extSet: Set<string>): void {\n let entries: string[];\n try {\n entries = readdirSync(dirPath);\n } catch (err) {\n swallow(err, `scanChildren: unreadable directory ${dirPath}`, { level: 'warn' });\n return;\n }\n\n for (const entry of entries) {\n const fullPath = join(dirPath, entry);\n\n try {\n if (!statSync(fullPath).isDirectory()) continue;\n } catch {\n continue;\n }\n\n // Reject directories with encoded path delimiters or null bytes.\n // These can cause route collisions when decoded at the URL boundary.\n // See design/13-security.md §\"Encoded separators rejected\" and §\"Null bytes rejected\".\n if (ENCODED_SEPARATOR_RE.test(entry)) {\n throw new Error(\n `Build error: directory name contains an encoded path delimiter (%2F or %5C).\\n` +\n ` Directory: ${fullPath}\\n` +\n `Encoded separators in directory names cause route collisions when decoded. ` +\n `Rename the directory to remove the encoded delimiter.`\n );\n }\n // `@children` is the implicit slot a layout's `children` prop fills, and\n // the key of the outlet that carries it (`childrenOutletKey`). A slot\n // directory by that name would claim the same outlet and be rendered in\n // place of the children (design/52-segment-hash-dedupe.md).\n if (entry === '@children') {\n throw new Error(\n `Build error: \"@children\" is reserved and cannot be a slot directory.\\n` +\n ` Directory: ${fullPath}\\n` +\n `A layout's children fill the implicit children slot. Put this content in the ` +\n `parent segment's page, or give the slot another name.`\n );\n }\n if (NULL_BYTE_RE.test(entry)) {\n throw new Error(\n `Build error: directory name contains an encoded null byte (%00).\\n` +\n ` Directory: ${fullPath}\\n` +\n `Encoded null bytes in directory names are not allowed. ` +\n `Rename the directory to remove the null byte encoding.`\n );\n }\n\n const {\n type,\n paramName,\n paramPrefix,\n paramSuffix,\n interceptionMarker,\n interceptedSegmentName,\n } = classifySegment(entry);\n\n // Skip private folders — underscore-prefixed dirs are excluded from routing\n if (type === 'private') continue;\n\n const urlPath = computeUrlPath(parentNode.urlPath, entry, type);\n const childNode = createSegmentNode(\n entry,\n type,\n urlPath,\n paramName,\n interceptionMarker,\n interceptedSegmentName,\n paramPrefix,\n paramSuffix\n );\n\n // Scan this segment's files\n scanSegmentFiles(fullPath, childNode, extSet);\n\n // Recurse into subdirectories\n scanChildren(fullPath, childNode, extSet);\n\n // Attach to parent: slots go into slots record, everything else is a child\n if (type === 'slot') {\n const slotName = entry.slice(1); // remove @\n parentNode.slots[slotName] = childNode;\n } else {\n parentNode.children.push(childNode);\n }\n }\n}\n\n/**\n * Validate that no route chain contains duplicate dynamic param names.\n *\n * Example violation:\n * app/[id]/items/[id]/page.tsx — 'id' appears twice in the ancestor chain.\n *\n * Route groups are transparent — params accumulate through them.\n * Slots are independent — duplicate detection does NOT cross slot boundaries.\n *\n * See design/07-routing.md §\"Duplicate Param Name Detection\"\n */\nfunction validateDuplicateParamNames(root: SegmentNode): void {\n walkForDuplicateParams(root, new Map());\n}\n\n/**\n * Recursively walk the segment tree, tracking seen param names → segment paths.\n * Throws on the first duplicate found.\n */\nfunction walkForDuplicateParams(node: SegmentNode, seen: Map<string, string>): void {\n // Read through the effective identity so an intercepting directory is seen\n // as the segment it intercepts: the scanner leaves `paramName` unset on\n // `(.)[id]`, so a validator reading the node directly is blind to a param\n // the resolver goes on to bind — `@modal/(.)[id]/[id]` would pass here and\n // then silently overwrite the outer `id` at match time, where the ordinary\n // `/[id]/[id]` is rejected. See TIM-1288.\n const { paramName } = effectiveUrlSegment(node);\n\n // If this node introduces a param name, check for duplicates\n if (paramName) {\n const existing = seen.get(paramName);\n if (existing) {\n throw new Error(\n `[timber] Duplicate param name '${paramName}' in route chain.\\n` +\n ` First defined at: ${existing}\\n` +\n ` Duplicate at: ${node.urlPath || '/'}\\n` +\n ` Rename one of the segments to avoid ambiguity.`\n );\n }\n // Add to seen for descendants (use a new Map to avoid polluting siblings)\n seen = new Map(seen);\n seen.set(paramName, node.urlPath || '/');\n }\n\n // Recurse into children (they inherit the accumulated params)\n for (const child of node.children) {\n walkForDuplicateParams(child, seen);\n }\n\n // A slot INHERITS the ancestor params rather than starting fresh: a slot\n // child may not reuse a name its owner already bound\n // (`app/gallery/[id]/@modal/[id]` is rejected). The copy is so sibling\n // slots don't see each other's names, not so the chain is reset.\n //\n // Whether that rule is right is a separate question — slot params are\n // merged over the main route's at read time, so a collision is defined\n // rather than ambiguous — but changing it would change every slot.\n // Tracked as TIM-1287; do not \"fix\" this by making the map fresh without\n // deciding that.\n for (const slotNode of Object.values(node.slots)) {\n walkForDuplicateParams(slotNode, new Map(seen));\n }\n}\n\n/**\n * Validate that each param name uses a single bracket form across the entire route tree.\n *\n * Different bracket forms produce different types:\n * [id] → string\n * [...id] → string[]\n * [[...id]] → string[] | undefined\n *\n * If the same param name appears with multiple forms, the no-argument\n * getSegmentParams() / useSegmentParams() return type becomes ambiguous.\n *\n * Same name + same form across different routes is fine and expected.\n */\nfunction validateUniqueBracketForms(root: SegmentNode): void {\n const forms = new Map<string, { segmentType: SegmentType; urlPath: string }>();\n collectBracketForms(root, forms);\n}\n\nfunction collectBracketForms(\n node: SegmentNode,\n forms: Map<string, { segmentType: SegmentType; urlPath: string }>\n): void {\n // Effective identity, so `(.)[...rest]` is compared as the catch-all it\n // intercepts rather than skipped as an 'intercepting' node (TIM-1288).\n const { paramName, segmentType } = effectiveUrlSegment(node);\n\n if (paramName && segmentType !== 'static' && segmentType !== 'group') {\n const existing = forms.get(paramName);\n if (existing && existing.segmentType !== segmentType) {\n const bracketExamples: Record<string, string> = {\n 'dynamic': `[${paramName}]`,\n 'catch-all': `[...${paramName}]`,\n 'optional-catch-all': `[[...${paramName}]]`,\n };\n throw new Error(\n `[timber] Param name '${paramName}' uses multiple bracket forms.\\n` +\n ` ${bracketExamples[existing.segmentType] ?? existing.segmentType} at: ${existing.urlPath}\\n` +\n ` ${bracketExamples[segmentType] ?? segmentType} at: ${node.urlPath || '/'}\\n` +\n ` Each param name must use a single bracket form across all routes.\\n` +\n ` Rename one of the segments to fix this (e.g., [${paramName}] → [${paramName}Id]).`\n );\n }\n if (!existing) {\n forms.set(paramName, {\n segmentType,\n urlPath: node.urlPath || '/',\n });\n }\n }\n\n for (const child of node.children) {\n collectBracketForms(child, forms);\n }\n for (const slotNode of Object.values(node.slots)) {\n collectBracketForms(slotNode, forms);\n }\n}\n\n/**\n * Validate that no sibling affixed dynamic segments have equal specificity.\n *\n * Among affixed siblings, longer combined prefix+suffix length wins. When two\n * siblings tie (same total affix length), the router would fall back to\n * filesystem scan order — which is platform-dependent. This is a build error.\n *\n * Route groups are URL-transparent, so affixed segments inside different groups\n * at the same level still conflict with each other.\n *\n * Ambiguity requires the two segments to be candidates for the *same* URL\n * part, which is narrower than \"same parent\" once interception is involved:\n *\n * - Plain children and intercepting children never compete. They are resolved\n * by different walks — `findSlotMatch` matches the slot subtree (where\n * `tree-match.ts` ignores intercepting nodes outright) and\n * `findInterceptingMatch` builds a synthetic parent holding only\n * interceptors.\n * - Two interceptors compete only at the same anchor. `(.)a-[id]` and\n * `(..)[slug]-b` in one slot are based at different URL depths, so no\n * pathname reaches both, and `anchorIndex` rejects the one whose base does\n * not match the target. Grouping them together would fail the build for a\n * pair that can never be ambiguous.\n *\n * So candidates are keyed by the position they contend for, then by affix\n * length. See design/07-routing.md §\"Priority\" and §\"Intercepting Routes\".\n */\nfunction validateAffixedSiblingConflicts(node: SegmentNode): void {\n const affixed = collectEffectiveAffixed(node);\n\n if (affixed.length >= 2) {\n const byLength = new Map<string, SegmentNode[]>();\n for (const child of affixed) {\n // `\\0` as the separator, written as the escape rather than a literal\n // byte: a raw NUL in the source makes git and grep treat this file as\n // binary. A contention key is a URL path, which cannot contain one, so\n // the two halves of the key can never run together.\n const key = `${contentionKey(node, child)}\\0${affixLengthOf(child)}`;\n const group = byLength.get(key);\n if (group) {\n group.push(child);\n } else {\n byLength.set(key, [child]);\n }\n }\n\n for (const [, group] of byLength) {\n if (group.length >= 2) {\n throw new Error(\n `Build error: ambiguous affixed dynamic siblings with equal specificity.\\n` +\n ` Parent: ${node.urlPath || '/'}\\n` +\n ` Segments: ${group.map((s) => s.segmentName).join(', ')}\\n` +\n ` Combined prefix+suffix length: ${affixLengthOf(group[0]!)}\\n` +\n `The router cannot deterministically choose between these — filesystem scan order is platform-dependent.\\n` +\n `Rename one segment to give it a longer or shorter combined affix.`\n );\n }\n }\n }\n\n for (const child of node.children) {\n validateAffixedSiblingConflicts(child);\n }\n for (const slotNode of Object.values(node.slots)) {\n validateAffixedSiblingConflicts(slotNode);\n }\n}\n\n/**\n * The URL position a child contends for, as a comparable key.\n *\n * Plain children contend for the parent's next part. An intercepting child\n * contends for a part determined by its marker's intercepted base, so two\n * markers of different depth are simply different positions — and two markers\n * that compute the *same* base do contend, which is why the key is the base\n * rather than the marker (`(..)` and `(...)` under `/feed` both base at `/`).\n *\n * `groupByInterceptedAnchor` (`routing/interception.ts`) is the canonical\n * statement of that grouping — it is what the resolver walks and what the\n * collision validator checks. This computes the same key from the same\n * `computeInterceptedBase` rather than calling it, because affix ambiguity is\n * decided per *child* and `collectEffectiveAffixed` looks through route groups,\n * so the two do not partition the same set of nodes.\n */\nfunction contentionKey(parent: SegmentNode, child: SegmentNode): string {\n if (child.segmentType !== 'intercepting') return 'child';\n return `intercept:${computeInterceptedBase(parent.urlPath, child.interceptionMarker ?? '(.)')}`;\n}\n\n/** Combined affix length of a node, read through its effective identity. */\nfunction affixLengthOf(node: SegmentNode): number {\n const { paramPrefix, paramSuffix } = effectiveUrlSegment(node);\n return (paramPrefix?.length ?? 0) + (paramSuffix?.length ?? 0);\n}\n\n/**\n * Collect affixed dynamic segments that are effective children of a node.\n * Route groups are URL-transparent, so we look through them recursively.\n *\n * Segments are read through `effectiveUrlSegment`, so an intercepting\n * directory counts as the affixed segment it intercepts: `(.)a-[id]` is\n * `a-[id]`. The proxy the slot resolver builds hands those affixes to\n * `matchUrlParts`, whose equal-length sort is not stable across equal\n * specificity — so two intercepting siblings with the same combined affix\n * length would resolve by filesystem enumeration order, which is precisely\n * what this validator exists to prevent for ordinary siblings (TIM-1288).\n */\nfunction collectEffectiveAffixed(node: SegmentNode): SegmentNode[] {\n const result: SegmentNode[] = [];\n for (const child of node.children) {\n const { segmentType, paramPrefix, paramSuffix } = effectiveUrlSegment(child);\n if (segmentType === 'dynamic' && (paramPrefix || paramSuffix)) {\n result.push(child);\n } else if (segmentType === 'group') {\n result.push(...collectEffectiveAffixed(child));\n }\n }\n return result;\n}\n\n/**\n * Find a fixed-extension file (proxy.ts) in a directory.\n */\nfunction findFixedFile(dirPath: string, name: string): RouteFile | undefined {\n for (const ext of ['ts', 'tsx']) {\n const fullPath = join(dirPath, `${name}.${ext}`);\n try {\n if (statSync(fullPath).isFile()) {\n return { filePath: fullPath, extension: ext };\n }\n } catch {\n // File doesn't exist\n }\n }\n return undefined;\n}\n\n/**\n * Find a file with script extensions (tsx, ts, jsx, js) in a directory.\n * Used for app-root conventions like global-error that only accept script\n * extensions (TIM-1505).\n */\nfunction findScriptExtFile(dirPath: string, name: string): RouteFile | undefined {\n for (const ext of ['tsx', 'ts', 'jsx', 'js']) {\n const fullPath = join(dirPath, `${name}.${ext}`);\n try {\n if (statSync(fullPath).isFile()) {\n return { filePath: fullPath, extension: ext };\n }\n } catch {\n // File doesn't exist\n }\n }\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA4BA,SAAgB,6BAA6B,MAAyB;CACpE,uBAAuB,MAAM,IAAI,KAAK,OAAO;AAC/C;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAS,uBAAuB,WAAwB,aAAqB,MAAoB;CAC/F,MAAM,SAAsB,CAAC;CAC7B,sBAAsB,2BAAW,IAAI,I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