@timber-js/app 0.2.0-alpha.2 → 0.2.0-alpha.200

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 (1329) hide show
  1. package/LICENSE +8 -0
  2. package/agent-skill.md +346 -0
  3. package/dist/_chunks/actions-d1hCqnU3.js +345 -0
  4. package/dist/_chunks/actions-d1hCqnU3.js.map +1 -0
  5. package/dist/_chunks/als-registry-C6kcfprT.js +41 -0
  6. package/dist/_chunks/als-registry-C6kcfprT.js.map +1 -0
  7. package/dist/_chunks/als-slots-BEEIPKYm.js +26 -0
  8. package/dist/_chunks/als-slots-BEEIPKYm.js.map +1 -0
  9. package/dist/_chunks/base-path-DaQrzbez.js +80 -0
  10. package/dist/_chunks/base-path-DaQrzbez.js.map +1 -0
  11. package/dist/_chunks/build-manifest-DTmSGLRz.js +135 -0
  12. package/dist/_chunks/build-manifest-DTmSGLRz.js.map +1 -0
  13. package/dist/_chunks/build-output-helper-9dqCv1pZ.js +370 -0
  14. package/dist/_chunks/build-output-helper-9dqCv1pZ.js.map +1 -0
  15. package/dist/_chunks/cache-api-ByagcC-J.js +1149 -0
  16. package/dist/_chunks/cache-api-ByagcC-J.js.map +1 -0
  17. package/dist/_chunks/canonicalize-CgHoscYO.js +66 -0
  18. package/dist/_chunks/canonicalize-CgHoscYO.js.map +1 -0
  19. package/dist/_chunks/chains-Bpb0W4ax.js +412 -0
  20. package/dist/_chunks/chains-Bpb0W4ax.js.map +1 -0
  21. package/dist/_chunks/cli-check-D6VolrDV.js +293 -0
  22. package/dist/_chunks/cli-check-D6VolrDV.js.map +1 -0
  23. package/dist/_chunks/cli-schema-sync-D6rO-VcS.js +299 -0
  24. package/dist/_chunks/cli-schema-sync-D6rO-VcS.js.map +1 -0
  25. package/dist/_chunks/cloudflare-BFb__LYG.js +1290 -0
  26. package/dist/_chunks/cloudflare-BFb__LYG.js.map +1 -0
  27. package/dist/_chunks/codec-registry-oOUxugz3.js +21 -0
  28. package/dist/_chunks/codec-registry-oOUxugz3.js.map +1 -0
  29. package/dist/_chunks/convention-lint-fRkwVwEH.js +893 -0
  30. package/dist/_chunks/convention-lint-fRkwVwEH.js.map +1 -0
  31. package/dist/_chunks/dist-DtrJyBbw.js +386 -0
  32. package/dist/_chunks/dist-DtrJyBbw.js.map +1 -0
  33. package/dist/_chunks/error-boundary-BfPHZjm0.js +1050 -0
  34. package/dist/_chunks/error-boundary-BfPHZjm0.js.map +1 -0
  35. package/dist/_chunks/fast-hash-C-tVYrLb.js +41 -0
  36. package/dist/_chunks/fast-hash-C-tVYrLb.js.map +1 -0
  37. package/dist/_chunks/file-cache-Dw6BJPG7.js +458 -0
  38. package/dist/_chunks/file-cache-Dw6BJPG7.js.map +1 -0
  39. package/dist/_chunks/format-BKclgVbk.js +14 -0
  40. package/dist/_chunks/format-BKclgVbk.js.map +1 -0
  41. package/dist/_chunks/fs-identity-D7vb6GdI.js +208 -0
  42. package/dist/_chunks/fs-identity-D7vb6GdI.js.map +1 -0
  43. package/dist/_chunks/graph-cache-CP4GEmf9.js +304 -0
  44. package/dist/_chunks/graph-cache-CP4GEmf9.js.map +1 -0
  45. package/dist/_chunks/href-validation-BIrxavIy.js +213 -0
  46. package/dist/_chunks/href-validation-BIrxavIy.js.map +1 -0
  47. package/dist/_chunks/json-lossy-check-ClNvBM_3.js +63 -0
  48. package/dist/_chunks/json-lossy-check-ClNvBM_3.js.map +1 -0
  49. package/dist/_chunks/live-graph-D_2D32Ad.js +150 -0
  50. package/dist/_chunks/live-graph-D_2D32Ad.js.map +1 -0
  51. package/dist/_chunks/logger-uLBuGKDI.js +1484 -0
  52. package/dist/_chunks/logger-uLBuGKDI.js.map +1 -0
  53. package/dist/_chunks/navigation-context-D0TU0Jog.js +135 -0
  54. package/dist/_chunks/navigation-context-D0TU0Jog.js.map +1 -0
  55. package/dist/_chunks/navigation-root-mHSK9psY.js +126 -0
  56. package/dist/_chunks/navigation-root-mHSK9psY.js.map +1 -0
  57. package/dist/_chunks/param-value-C8TNYchQ.js +66 -0
  58. package/dist/_chunks/param-value-C8TNYchQ.js.map +1 -0
  59. package/dist/_chunks/plugin-context-8idfR3UZ.js +321 -0
  60. package/dist/_chunks/plugin-context-8idfR3UZ.js.map +1 -0
  61. package/dist/_chunks/poison-rules-DoEhbqaY.js +110 -0
  62. package/dist/_chunks/poison-rules-DoEhbqaY.js.map +1 -0
  63. package/dist/_chunks/poison-scan-Bm9Yyqk9.js +101 -0
  64. package/dist/_chunks/poison-scan-Bm9Yyqk9.js.map +1 -0
  65. package/dist/_chunks/purge-store-Byr8XOjU.js +14 -0
  66. package/dist/_chunks/purge-store-Byr8XOjU.js.map +1 -0
  67. package/dist/_chunks/resolve-schema-CBR6Lm4i.js +50 -0
  68. package/dist/_chunks/resolve-schema-CBR6Lm4i.js.map +1 -0
  69. package/dist/_chunks/rolldown-runtime-D7D4PA-g.js +13 -0
  70. package/dist/_chunks/rsc-cache-key-ClUiXQnK.js +243 -0
  71. package/dist/_chunks/rsc-cache-key-ClUiXQnK.js.map +1 -0
  72. package/dist/_chunks/rsc-media-type-DDc7duTD.js +61 -0
  73. package/dist/_chunks/rsc-media-type-DDc7duTD.js.map +1 -0
  74. package/dist/_chunks/rsc-payload-path-B_LBodc2.js +48 -0
  75. package/dist/_chunks/rsc-payload-path-B_LBodc2.js.map +1 -0
  76. package/dist/_chunks/scan-BoP17W3w.js +140 -0
  77. package/dist/_chunks/scan-BoP17W3w.js.map +1 -0
  78. package/dist/_chunks/scanner-AiazgH_f.js +1771 -0
  79. package/dist/_chunks/scanner-AiazgH_f.js.map +1 -0
  80. package/dist/_chunks/schema-bridge-C83xa9lT.js +199 -0
  81. package/dist/_chunks/schema-bridge-C83xa9lT.js.map +1 -0
  82. package/dist/_chunks/segment-classify-C539Pa2O.js +197 -0
  83. package/dist/_chunks/segment-classify-C539Pa2O.js.map +1 -0
  84. package/dist/_chunks/segment-context-D9_89u34.js +34 -0
  85. package/dist/_chunks/segment-context-D9_89u34.js.map +1 -0
  86. package/dist/_chunks/segment-keys-lqtdookO.js +256 -0
  87. package/dist/_chunks/segment-keys-lqtdookO.js.map +1 -0
  88. package/dist/_chunks/singleflight-2lUWfcAk.js +54 -0
  89. package/dist/_chunks/singleflight-2lUWfcAk.js.map +1 -0
  90. package/dist/_chunks/sizeof-lXffQ1Vr.js +35 -0
  91. package/dist/_chunks/sizeof-lXffQ1Vr.js.map +1 -0
  92. package/dist/_chunks/{ssr-data-DLnbYpj1.js → ssr-data-D6T6Y3ef.js} +3 -31
  93. package/dist/_chunks/ssr-data-D6T6Y3ef.js.map +1 -0
  94. package/dist/_chunks/state-FippDgxN.js +52 -0
  95. package/dist/_chunks/state-FippDgxN.js.map +1 -0
  96. package/dist/_chunks/status-page-marker-DwQBrLBz.js +496 -0
  97. package/dist/_chunks/status-page-marker-DwQBrLBz.js.map +1 -0
  98. package/dist/_chunks/use-query-states-I3JMng6J.js +226 -0
  99. package/dist/_chunks/use-query-states-I3JMng6J.js.map +1 -0
  100. package/dist/_chunks/walkers-B6XUtmqK.js +144 -0
  101. package/dist/_chunks/walkers-B6XUtmqK.js.map +1 -0
  102. package/dist/adapters/build-output-helper.d.ts +72 -0
  103. package/dist/adapters/build-output-helper.d.ts.map +1 -0
  104. package/dist/adapters/cloudflare-dev.d.ts +109 -0
  105. package/dist/adapters/cloudflare-dev.d.ts.map +1 -0
  106. package/dist/adapters/cloudflare-dev.js +74 -0
  107. package/dist/adapters/cloudflare-dev.js.map +1 -0
  108. package/dist/adapters/cloudflare-kv-cache.d.ts +65 -0
  109. package/dist/adapters/cloudflare-kv-cache.d.ts.map +1 -0
  110. package/dist/adapters/cloudflare-kv-cache.js +123 -0
  111. package/dist/adapters/cloudflare-kv-cache.js.map +1 -0
  112. package/dist/adapters/cloudflare.d.ts +200 -22
  113. package/dist/adapters/cloudflare.d.ts.map +1 -1
  114. package/dist/adapters/cloudflare.js +2 -188
  115. package/dist/adapters/compress-module.d.ts +17 -4
  116. package/dist/adapters/compress-module.d.ts.map +1 -1
  117. package/dist/adapters/fs-identity.d.ts +64 -0
  118. package/dist/adapters/fs-identity.d.ts.map +1 -0
  119. package/dist/adapters/nitro-presets.d.ts +37 -0
  120. package/dist/adapters/nitro-presets.d.ts.map +1 -0
  121. package/dist/adapters/nitro-preview.d.ts +32 -0
  122. package/dist/adapters/nitro-preview.d.ts.map +1 -0
  123. package/dist/adapters/nitro.d.ts +82 -37
  124. package/dist/adapters/nitro.d.ts.map +1 -1
  125. package/dist/adapters/nitro.js +457 -288
  126. package/dist/adapters/nitro.js.map +1 -1
  127. package/dist/adapters/shared.d.ts +62 -0
  128. package/dist/adapters/shared.d.ts.map +1 -0
  129. package/dist/adapters/types.d.ts +28 -6
  130. package/dist/adapters/types.d.ts.map +1 -1
  131. package/dist/analyze/chains.d.ts +124 -0
  132. package/dist/analyze/chains.d.ts.map +1 -0
  133. package/dist/analyze/classify.d.ts +150 -0
  134. package/dist/analyze/classify.d.ts.map +1 -0
  135. package/dist/analyze/crawl-entry.d.ts +17 -0
  136. package/dist/analyze/crawl-entry.d.ts.map +1 -0
  137. package/dist/analyze/crawl-entry.js +313 -0
  138. package/dist/analyze/crawl-entry.js.map +1 -0
  139. package/dist/analyze/crawl.d.ts +134 -0
  140. package/dist/analyze/crawl.d.ts.map +1 -0
  141. package/dist/analyze/graph-cache.d.ts +104 -0
  142. package/dist/analyze/graph-cache.d.ts.map +1 -0
  143. package/dist/analyze/graph-command.d.ts +43 -0
  144. package/dist/analyze/graph-command.d.ts.map +1 -0
  145. package/dist/analyze/graph-command.js +472 -0
  146. package/dist/analyze/graph-command.js.map +1 -0
  147. package/dist/analyze/live-graph.d.ts +81 -0
  148. package/dist/analyze/live-graph.d.ts.map +1 -0
  149. package/dist/analyze/poison-rules.d.ts +72 -0
  150. package/dist/analyze/poison-rules.d.ts.map +1 -0
  151. package/dist/analyze/poison-scan.d.ts +48 -0
  152. package/dist/analyze/poison-scan.d.ts.map +1 -0
  153. package/dist/analyze/scan.d.ts +73 -0
  154. package/dist/analyze/scan.d.ts.map +1 -0
  155. package/dist/cache/cache-api.d.ts +48 -0
  156. package/dist/cache/cache-api.d.ts.map +1 -0
  157. package/dist/cache/fast-hash.d.ts +27 -0
  158. package/dist/cache/fast-hash.d.ts.map +1 -0
  159. package/dist/cache/handler-store.d.ts +33 -0
  160. package/dist/cache/handler-store.d.ts.map +1 -0
  161. package/dist/cache/index.d.ts +32 -9
  162. package/dist/cache/index.d.ts.map +1 -1
  163. package/dist/cache/index.js +3 -284
  164. package/dist/cache/invalidation-epoch.d.ts +43 -0
  165. package/dist/cache/invalidation-epoch.d.ts.map +1 -0
  166. package/dist/cache/json-lossy-check.d.ts +11 -0
  167. package/dist/cache/json-lossy-check.d.ts.map +1 -0
  168. package/dist/cache/redis-handler.d.ts +141 -9
  169. package/dist/cache/redis-handler.d.ts.map +1 -1
  170. package/dist/cache/singleflight.d.ts +21 -2
  171. package/dist/cache/singleflight.d.ts.map +1 -1
  172. package/dist/cache/sizeof.d.ts +22 -0
  173. package/dist/cache/sizeof.d.ts.map +1 -0
  174. package/dist/cache/stable-stringify.d.ts +9 -0
  175. package/dist/cache/stable-stringify.d.ts.map +1 -1
  176. package/dist/cache/store.d.ts +53 -0
  177. package/dist/cache/store.d.ts.map +1 -0
  178. package/dist/cache/stores/cloudflare-kv.d.ts +38 -0
  179. package/dist/cache/stores/cloudflare-kv.d.ts.map +1 -0
  180. package/dist/cache/stores/cloudflare-kv.js +29 -0
  181. package/dist/cache/stores/cloudflare-kv.js.map +1 -0
  182. package/dist/cache/stores/memory.d.ts +42 -0
  183. package/dist/cache/stores/memory.d.ts.map +1 -0
  184. package/dist/cache/stores/memory.js +90 -0
  185. package/dist/cache/stores/memory.js.map +1 -0
  186. package/dist/cache/stores/redis.d.ts +69 -0
  187. package/dist/cache/stores/redis.d.ts.map +1 -0
  188. package/dist/cache/stores/redis.js +35 -0
  189. package/dist/cache/stores/redis.js.map +1 -0
  190. package/dist/cache/stores/vercel.d.ts +36 -0
  191. package/dist/cache/stores/vercel.d.ts.map +1 -0
  192. package/dist/cache/stores/vercel.js +33 -0
  193. package/dist/cache/stores/vercel.js.map +1 -0
  194. package/dist/cache/tag-aware-handler.d.ts +52 -0
  195. package/dist/cache/tag-aware-handler.d.ts.map +1 -0
  196. package/dist/cache/timber-cache.d.ts +21 -11
  197. package/dist/cache/timber-cache.d.ts.map +1 -1
  198. package/dist/cdn/cloudflare-purge.d.ts +23 -0
  199. package/dist/cdn/cloudflare-purge.d.ts.map +1 -0
  200. package/dist/cdn/cloudflare-purge.js +30 -0
  201. package/dist/cdn/cloudflare-purge.js.map +1 -0
  202. package/dist/cdn/fastly-purge.d.ts +25 -0
  203. package/dist/cdn/fastly-purge.d.ts.map +1 -0
  204. package/dist/cdn/fastly-purge.js +33 -0
  205. package/dist/cdn/fastly-purge.js.map +1 -0
  206. package/dist/cdn/headers.d.ts +97 -0
  207. package/dist/cdn/headers.d.ts.map +1 -0
  208. package/dist/cdn/index.d.ts +5 -0
  209. package/dist/cdn/index.d.ts.map +1 -0
  210. package/dist/cdn/index.js +94 -0
  211. package/dist/cdn/index.js.map +1 -0
  212. package/dist/cdn/purge-store.d.ts +23 -0
  213. package/dist/cdn/purge-store.d.ts.map +1 -0
  214. package/dist/cdn/workers-cache-purge.d.ts +20 -0
  215. package/dist/cdn/workers-cache-purge.d.ts.map +1 -0
  216. package/dist/cdn/workers-cache-purge.js +35 -0
  217. package/dist/cdn/workers-cache-purge.js.map +1 -0
  218. package/dist/cli-check.d.ts +163 -0
  219. package/dist/cli-check.d.ts.map +1 -0
  220. package/dist/cli-schema-sync.d.ts +59 -0
  221. package/dist/cli-schema-sync.d.ts.map +1 -0
  222. package/dist/cli.d.ts +75 -8
  223. package/dist/cli.d.ts.map +1 -1
  224. package/dist/cli.js +175 -47
  225. package/dist/cli.js.map +1 -1
  226. package/dist/client/browser-dev.d.ts +37 -1
  227. package/dist/client/browser-dev.d.ts.map +1 -1
  228. package/dist/client/browser-entry/action-dispatch.d.ts +19 -0
  229. package/dist/client/browser-entry/action-dispatch.d.ts.map +1 -0
  230. package/dist/client/browser-entry/action-queue.d.ts +44 -0
  231. package/dist/client/browser-entry/action-queue.d.ts.map +1 -0
  232. package/dist/client/browser-entry/hmr.d.ts +21 -0
  233. package/dist/client/browser-entry/hmr.d.ts.map +1 -0
  234. package/dist/client/browser-entry/hydrate.d.ts +63 -0
  235. package/dist/client/browser-entry/hydrate.d.ts.map +1 -0
  236. package/dist/client/browser-entry/index.d.ts +30 -0
  237. package/dist/client/browser-entry/index.d.ts.map +1 -0
  238. package/dist/client/browser-entry/post-hydration.d.ts +29 -0
  239. package/dist/client/browser-entry/post-hydration.d.ts.map +1 -0
  240. package/dist/client/browser-entry/router-init.d.ts +46 -0
  241. package/dist/client/browser-entry/router-init.d.ts.map +1 -0
  242. package/dist/client/browser-entry/rsc-stream.d.ts +32 -0
  243. package/dist/client/browser-entry/rsc-stream.d.ts.map +1 -0
  244. package/dist/client/browser-entry/scroll.d.ts +28 -0
  245. package/dist/client/browser-entry/scroll.d.ts.map +1 -0
  246. package/dist/client/deny-last-resort.d.ts +29 -0
  247. package/dist/client/deny-last-resort.d.ts.map +1 -0
  248. package/dist/client/error-boundary.d.ts +66 -6
  249. package/dist/client/error-boundary.d.ts.map +1 -1
  250. package/dist/client/error-boundary.js +2 -126
  251. package/dist/client/error-reconstituter.d.ts +61 -0
  252. package/dist/client/error-reconstituter.d.ts.map +1 -0
  253. package/dist/client/form.d.ts +16 -27
  254. package/dist/client/form.d.ts.map +1 -1
  255. package/dist/client/global-context.d.ts +15 -0
  256. package/dist/client/global-context.d.ts.map +1 -0
  257. package/dist/client/history.d.ts +50 -9
  258. package/dist/client/history.d.ts.map +1 -1
  259. package/dist/client/index.d.ts +20 -33
  260. package/dist/client/index.d.ts.map +1 -1
  261. package/dist/client/index.js +323 -1148
  262. package/dist/client/index.js.map +1 -1
  263. package/dist/client/internal.d.ts +20 -0
  264. package/dist/client/internal.d.ts.map +1 -0
  265. package/dist/client/internal.js +818 -0
  266. package/dist/client/internal.js.map +1 -0
  267. package/dist/client/link.d.ts +63 -60
  268. package/dist/client/link.d.ts.map +1 -1
  269. package/dist/client/location-search.d.ts +12 -0
  270. package/dist/client/location-search.d.ts.map +1 -0
  271. package/dist/client/navigation-api.d.ts +121 -0
  272. package/dist/client/navigation-api.d.ts.map +1 -0
  273. package/dist/client/navigation-commit.d.ts +98 -0
  274. package/dist/client/navigation-commit.d.ts.map +1 -0
  275. package/dist/client/navigation-context.d.ts +51 -31
  276. package/dist/client/navigation-context.d.ts.map +1 -1
  277. package/dist/client/navigation-root.d.ts +98 -0
  278. package/dist/client/navigation-root.d.ts.map +1 -0
  279. package/dist/client/navigation-transition.d.ts +187 -0
  280. package/dist/client/navigation-transition.d.ts.map +1 -0
  281. package/dist/client/nuqs-adapter.d.ts +1 -1
  282. package/dist/client/nuqs-adapter.d.ts.map +1 -1
  283. package/dist/client/params-context.d.ts +81 -0
  284. package/dist/client/params-context.d.ts.map +1 -0
  285. package/dist/client/react-root.d.ts +44 -0
  286. package/dist/client/react-root.d.ts.map +1 -0
  287. package/dist/client/router-effects.d.ts +130 -0
  288. package/dist/client/router-effects.d.ts.map +1 -0
  289. package/dist/client/router-lifecycle.d.ts +98 -0
  290. package/dist/client/router-lifecycle.d.ts.map +1 -0
  291. package/dist/client/router-pipeline.d.ts +87 -0
  292. package/dist/client/router-pipeline.d.ts.map +1 -0
  293. package/dist/client/router-ref.d.ts +2 -2
  294. package/dist/client/router-ref.d.ts.map +1 -1
  295. package/dist/client/router-skew.d.ts +21 -0
  296. package/dist/client/router-skew.d.ts.map +1 -0
  297. package/dist/client/router-types.d.ts +272 -0
  298. package/dist/client/router-types.d.ts.map +1 -0
  299. package/dist/client/router.d.ts +1 -97
  300. package/dist/client/router.d.ts.map +1 -1
  301. package/dist/client/rsc-fetch.d.ts +104 -26
  302. package/dist/client/rsc-fetch.d.ts.map +1 -1
  303. package/dist/client/segment-cache.d.ts +161 -25
  304. package/dist/client/segment-cache.d.ts.map +1 -1
  305. package/dist/client/segment-context.d.ts +1 -1
  306. package/dist/client/segment-context.d.ts.map +1 -1
  307. package/dist/client/segment-outlet.d.ts +68 -0
  308. package/dist/client/segment-outlet.d.ts.map +1 -0
  309. package/dist/client/segment-update-context.d.ts +15 -0
  310. package/dist/client/segment-update-context.d.ts.map +1 -0
  311. package/dist/client/shallow-url.d.ts +10 -0
  312. package/dist/client/shallow-url.d.ts.map +1 -0
  313. package/dist/client/slot-content-cache-context.d.ts +35 -0
  314. package/dist/client/slot-content-cache-context.d.ts.map +1 -0
  315. package/dist/client/slot-context.d.ts +31 -0
  316. package/dist/client/slot-context.d.ts.map +1 -0
  317. package/dist/client/slot-outlet.d.ts +16 -0
  318. package/dist/client/slot-outlet.d.ts.map +1 -0
  319. package/dist/client/slot-provider.d.ts +25 -0
  320. package/dist/client/slot-provider.d.ts.map +1 -0
  321. package/dist/client/ssr-data.d.ts +29 -7
  322. package/dist/client/ssr-data.d.ts.map +1 -1
  323. package/dist/client/stale-client.d.ts +69 -0
  324. package/dist/client/stale-client.d.ts.map +1 -0
  325. package/dist/client/state.d.ts +19 -8
  326. package/dist/client/state.d.ts.map +1 -1
  327. package/dist/client/status-page-marker.d.ts +25 -0
  328. package/dist/client/status-page-marker.d.ts.map +1 -0
  329. package/dist/client/top-loader.d.ts +7 -6
  330. package/dist/client/top-loader.d.ts.map +1 -1
  331. package/dist/client/unload-guard.d.ts +5 -0
  332. package/dist/client/unload-guard.d.ts.map +1 -1
  333. package/dist/client/use-cookie.d.ts +12 -0
  334. package/dist/client/use-cookie.d.ts.map +1 -1
  335. package/dist/client/use-link-status.d.ts +5 -5
  336. package/dist/client/use-link-status.d.ts.map +1 -1
  337. package/dist/client/use-pathname.d.ts +13 -11
  338. package/dist/client/use-pathname.d.ts.map +1 -1
  339. package/dist/client/use-pending-navigation.d.ts +23 -0
  340. package/dist/client/use-pending-navigation.d.ts.map +1 -0
  341. package/dist/client/use-query-states.d.ts +10 -4
  342. package/dist/client/use-query-states.d.ts.map +1 -1
  343. package/dist/client/use-router.d.ts +2 -2
  344. package/dist/client/use-router.d.ts.map +1 -1
  345. package/dist/client/use-search-params.d.ts +15 -8
  346. package/dist/client/use-search-params.d.ts.map +1 -1
  347. package/dist/client/use-segment-params.d.ts +55 -0
  348. package/dist/client/use-segment-params.d.ts.map +1 -0
  349. package/dist/codec.d.ts +69 -0
  350. package/dist/codec.d.ts.map +1 -0
  351. package/dist/codec.js +76 -0
  352. package/dist/codec.js.map +1 -0
  353. package/dist/config-types.d.ts +322 -0
  354. package/dist/config-types.d.ts.map +1 -0
  355. package/dist/config-validation.d.ts +51 -0
  356. package/dist/config-validation.d.ts.map +1 -0
  357. package/dist/cookies/define-cookie.d.ts +58 -25
  358. package/dist/cookies/define-cookie.d.ts.map +1 -1
  359. package/dist/cookies/index.d.ts +3 -2
  360. package/dist/cookies/index.d.ts.map +1 -1
  361. package/dist/cookies/index.js +256 -36
  362. package/dist/cookies/index.js.map +1 -1
  363. package/dist/cookies/json-cookie.d.ts +64 -0
  364. package/dist/cookies/json-cookie.d.ts.map +1 -0
  365. package/dist/cookies/validation.d.ts +34 -0
  366. package/dist/cookies/validation.d.ts.map +1 -0
  367. package/dist/dev-tools/404-page.d.ts +50 -0
  368. package/dist/dev-tools/404-page.d.ts.map +1 -0
  369. package/dist/dev-tools/browser-logs.d.ts +40 -0
  370. package/dist/dev-tools/browser-logs.d.ts.map +1 -0
  371. package/dist/dev-tools/dev-page-shell.d.ts +78 -0
  372. package/dist/dev-tools/dev-page-shell.d.ts.map +1 -0
  373. package/dist/dev-tools/error-page.d.ts +32 -0
  374. package/dist/dev-tools/error-page.d.ts.map +1 -0
  375. package/dist/dev-tools/holding-server.d.ts +46 -0
  376. package/dist/dev-tools/holding-server.d.ts.map +1 -0
  377. package/dist/dev-tools/hydration-overlay.d.ts +11 -0
  378. package/dist/dev-tools/hydration-overlay.d.ts.map +1 -0
  379. package/dist/dev-tools/index.d.ts +31 -0
  380. package/dist/dev-tools/index.d.ts.map +1 -0
  381. package/dist/dev-tools/instrumentation.d.ts +59 -0
  382. package/dist/dev-tools/instrumentation.d.ts.map +1 -0
  383. package/dist/{server/dev-logger.d.ts → dev-tools/logger.d.ts} +1 -1
  384. package/dist/dev-tools/logger.d.ts.map +1 -0
  385. package/dist/{plugins/dev-logs.d.ts → dev-tools/logs.d.ts} +17 -3
  386. package/dist/dev-tools/logs.d.ts.map +1 -0
  387. package/dist/dev-tools/overlay.d.ts +91 -0
  388. package/dist/dev-tools/overlay.d.ts.map +1 -0
  389. package/dist/dev-tools/stack-classifier.d.ts +34 -0
  390. package/dist/dev-tools/stack-classifier.d.ts.map +1 -0
  391. package/dist/dev-tools/terminal.d.ts +28 -0
  392. package/dist/dev-tools/terminal.d.ts.map +1 -0
  393. package/dist/fonts/ast-walk.d.ts +68 -0
  394. package/dist/fonts/ast-walk.d.ts.map +1 -0
  395. package/dist/fonts/ast.d.ts +112 -8
  396. package/dist/fonts/ast.d.ts.map +1 -1
  397. package/dist/fonts/bundle.d.ts +50 -0
  398. package/dist/fonts/bundle.d.ts.map +1 -0
  399. package/dist/fonts/css.d.ts +2 -1
  400. package/dist/fonts/css.d.ts.map +1 -1
  401. package/dist/fonts/dev-middleware.d.ts +22 -0
  402. package/dist/fonts/dev-middleware.d.ts.map +1 -0
  403. package/dist/fonts/fallbacks.d.ts +0 -7
  404. package/dist/fonts/fallbacks.d.ts.map +1 -1
  405. package/dist/fonts/google.d.ts +5 -3
  406. package/dist/fonts/google.d.ts.map +1 -1
  407. package/dist/fonts/local.d.ts +6 -4
  408. package/dist/fonts/local.d.ts.map +1 -1
  409. package/dist/fonts/paths.d.ts +43 -0
  410. package/dist/fonts/paths.d.ts.map +1 -0
  411. package/dist/fonts/pipeline.d.ts +177 -0
  412. package/dist/fonts/pipeline.d.ts.map +1 -0
  413. package/dist/fonts/transform.d.ts +82 -0
  414. package/dist/fonts/transform.d.ts.map +1 -0
  415. package/dist/fonts/types.d.ts +47 -1
  416. package/dist/fonts/types.d.ts.map +1 -1
  417. package/dist/fonts/virtual-modules.d.ts +77 -0
  418. package/dist/fonts/virtual-modules.d.ts.map +1 -0
  419. package/dist/index.d.ts +35 -153
  420. package/dist/index.d.ts.map +1 -1
  421. package/dist/index.js +10488 -13975
  422. package/dist/index.js.map +1 -1
  423. package/dist/params/codec-registry.d.ts +26 -0
  424. package/dist/params/codec-registry.d.ts.map +1 -0
  425. package/dist/params/define-schema.d.ts +81 -0
  426. package/dist/params/define-schema.d.ts.map +1 -0
  427. package/dist/params/index.d.ts +5 -0
  428. package/dist/params/index.d.ts.map +1 -0
  429. package/dist/params/index.js +34 -0
  430. package/dist/params/index.js.map +1 -0
  431. package/dist/params/resolve-schema.d.ts +34 -0
  432. package/dist/params/resolve-schema.d.ts.map +1 -0
  433. package/dist/plugin-context.d.ts +276 -0
  434. package/dist/plugin-context.d.ts.map +1 -0
  435. package/dist/plugins/adapter-build.d.ts +21 -1
  436. package/dist/plugins/adapter-build.d.ts.map +1 -1
  437. package/dist/plugins/build-manifest.d.ts +7 -3
  438. package/dist/plugins/build-manifest.d.ts.map +1 -1
  439. package/dist/plugins/build-report.d.ts +54 -7
  440. package/dist/plugins/build-report.d.ts.map +1 -1
  441. package/dist/plugins/cache.d.ts +64 -0
  442. package/dist/plugins/cache.d.ts.map +1 -0
  443. package/dist/plugins/callsite-ast.d.ts +117 -0
  444. package/dist/plugins/callsite-ast.d.ts.map +1 -0
  445. package/dist/plugins/callsite-jsx.d.ts +35 -0
  446. package/dist/plugins/callsite-jsx.d.ts.map +1 -0
  447. package/dist/plugins/chunks.d.ts +11 -4
  448. package/dist/plugins/chunks.d.ts.map +1 -1
  449. package/dist/plugins/client-chunks.d.ts +40 -0
  450. package/dist/plugins/client-chunks.d.ts.map +1 -0
  451. package/dist/plugins/cloudflare-wasm.d.ts +21 -0
  452. package/dist/plugins/cloudflare-wasm.d.ts.map +1 -0
  453. package/dist/plugins/content.d.ts +1 -1
  454. package/dist/plugins/content.d.ts.map +1 -1
  455. package/dist/plugins/dev-discovery.d.ts +123 -0
  456. package/dist/plugins/dev-discovery.d.ts.map +1 -0
  457. package/dist/plugins/dev-server.d.ts +17 -1
  458. package/dist/plugins/dev-server.d.ts.map +1 -1
  459. package/dist/plugins/entries.d.ts +32 -1
  460. package/dist/plugins/entries.d.ts.map +1 -1
  461. package/dist/plugins/fonts.d.ts +16 -65
  462. package/dist/plugins/fonts.d.ts.map +1 -1
  463. package/dist/plugins/graph-endpoint.d.ts +112 -0
  464. package/dist/plugins/graph-endpoint.d.ts.map +1 -0
  465. package/dist/plugins/mdx.d.ts +24 -5
  466. package/dist/plugins/mdx.d.ts.map +1 -1
  467. package/dist/plugins/prebuilt-capture.d.ts +60 -0
  468. package/dist/plugins/prebuilt-capture.d.ts.map +1 -0
  469. package/dist/plugins/prebuilt-options-analysis.d.ts +40 -0
  470. package/dist/plugins/prebuilt-options-analysis.d.ts.map +1 -0
  471. package/dist/plugins/prebuilt.d.ts +82 -0
  472. package/dist/plugins/prebuilt.d.ts.map +1 -0
  473. package/dist/plugins/prerender-sugar.d.ts +39 -0
  474. package/dist/plugins/prerender-sugar.d.ts.map +1 -0
  475. package/dist/plugins/request-dep/analysis.d.ts +106 -0
  476. package/dist/plugins/request-dep/analysis.d.ts.map +1 -0
  477. package/dist/plugins/request-dep/index.d.ts +75 -0
  478. package/dist/plugins/request-dep/index.d.ts.map +1 -0
  479. package/dist/plugins/request-dep/origin.d.ts +61 -0
  480. package/dist/plugins/request-dep/origin.d.ts.map +1 -0
  481. package/dist/plugins/routing.d.ts +1 -1
  482. package/dist/plugins/routing.d.ts.map +1 -1
  483. package/dist/plugins/server-bundle.d.ts.map +1 -1
  484. package/dist/plugins/shims.d.ts +29 -5
  485. package/dist/plugins/shims.d.ts.map +1 -1
  486. package/dist/plugins/static-build.d.ts +218 -21
  487. package/dist/plugins/static-build.d.ts.map +1 -1
  488. package/dist/routing/codegen-shared.d.ts +26 -0
  489. package/dist/routing/codegen-shared.d.ts.map +1 -0
  490. package/dist/routing/codegen-types.d.ts +61 -0
  491. package/dist/routing/codegen-types.d.ts.map +1 -0
  492. package/dist/routing/codegen-write.d.ts +51 -0
  493. package/dist/routing/codegen-write.d.ts.map +1 -0
  494. package/dist/routing/codegen.d.ts +8 -3
  495. package/dist/routing/codegen.d.ts.map +1 -1
  496. package/dist/routing/collision-probe.d.ts +104 -0
  497. package/dist/routing/collision-probe.d.ts.map +1 -0
  498. package/dist/routing/collision-spaces.d.ts +26 -0
  499. package/dist/routing/collision-spaces.d.ts.map +1 -0
  500. package/dist/routing/convention-lint.d.ts +55 -0
  501. package/dist/routing/convention-lint.d.ts.map +1 -0
  502. package/dist/routing/export-detect.d.ts +72 -0
  503. package/dist/routing/export-detect.d.ts.map +1 -0
  504. package/dist/routing/file-cache.d.ts +8 -0
  505. package/dist/routing/file-cache.d.ts.map +1 -0
  506. package/dist/routing/index.d.ts +13 -7
  507. package/dist/routing/index.d.ts.map +1 -1
  508. package/dist/routing/index.js +5 -2
  509. package/dist/routing/interception-overlap.d.ts +35 -0
  510. package/dist/routing/interception-overlap.d.ts.map +1 -0
  511. package/dist/routing/interception.d.ts +234 -10
  512. package/dist/routing/interception.d.ts.map +1 -1
  513. package/dist/routing/link-codegen.d.ts +105 -0
  514. package/dist/routing/link-codegen.d.ts.map +1 -0
  515. package/dist/routing/manifest-codegen.d.ts +26 -0
  516. package/dist/routing/manifest-codegen.d.ts.map +1 -0
  517. package/dist/routing/scanner.d.ts +14 -10
  518. package/dist/routing/scanner.d.ts.map +1 -1
  519. package/dist/routing/schema-validation.d.ts +35 -0
  520. package/dist/routing/schema-validation.d.ts.map +1 -0
  521. package/dist/routing/segment-classify.d.ts +114 -0
  522. package/dist/routing/segment-classify.d.ts.map +1 -0
  523. package/dist/routing/segment-codegen.d.ts +38 -0
  524. package/dist/routing/segment-codegen.d.ts.map +1 -0
  525. package/dist/routing/segment-keys.d.ts +118 -0
  526. package/dist/routing/segment-keys.d.ts.map +1 -0
  527. package/dist/routing/slot-placement.d.ts +48 -0
  528. package/dist/routing/slot-placement.d.ts.map +1 -0
  529. package/dist/routing/types.d.ts +74 -26
  530. package/dist/routing/types.d.ts.map +1 -1
  531. package/dist/routing/walkers.d.ts +57 -0
  532. package/dist/routing/walkers.d.ts.map +1 -0
  533. package/dist/rsc-runtime/rsc.d.ts +1 -1
  534. package/dist/rsc-runtime/rsc.d.ts.map +1 -1
  535. package/dist/rsc-runtime/ssr.d.ts +14 -0
  536. package/dist/rsc-runtime/ssr.d.ts.map +1 -1
  537. package/dist/rsc-runtime/transforms.d.ts +13 -0
  538. package/dist/rsc-runtime/transforms.d.ts.map +1 -0
  539. package/dist/schema-bridge.d.ts +145 -0
  540. package/dist/schema-bridge.d.ts.map +1 -0
  541. package/dist/search-params/define.d.ts +262 -0
  542. package/dist/search-params/define.d.ts.map +1 -0
  543. package/dist/search-params/index.d.ts +3 -7
  544. package/dist/search-params/index.d.ts.map +1 -1
  545. package/dist/search-params/index.js +179 -360
  546. package/dist/search-params/index.js.map +1 -1
  547. package/dist/search-params/parse-total.d.ts +81 -0
  548. package/dist/search-params/parse-total.d.ts.map +1 -0
  549. package/dist/search-params/serialize-equal.d.ts +9 -0
  550. package/dist/search-params/serialize-equal.d.ts.map +1 -0
  551. package/dist/search-params/wrappers.d.ts +76 -0
  552. package/dist/search-params/wrappers.d.ts.map +1 -0
  553. package/dist/server/access-gate.d.ts +98 -10
  554. package/dist/server/access-gate.d.ts.map +1 -1
  555. package/dist/server/action-client.d.ts +42 -7
  556. package/dist/server/action-client.d.ts.map +1 -1
  557. package/dist/server/action-encryption.d.ts +76 -0
  558. package/dist/server/action-encryption.d.ts.map +1 -0
  559. package/dist/server/action-handler.d.ts +39 -5
  560. package/dist/server/action-handler.d.ts.map +1 -1
  561. package/dist/server/actions.d.ts +29 -35
  562. package/dist/server/actions.d.ts.map +1 -1
  563. package/dist/server/als-registry.d.ts +117 -13
  564. package/dist/server/als-registry.d.ts.map +1 -1
  565. package/dist/server/asset-headers.d.ts +8 -18
  566. package/dist/server/asset-headers.d.ts.map +1 -1
  567. package/dist/server/body-limits.d.ts.map +1 -1
  568. package/dist/server/build-manifest.d.ts +25 -30
  569. package/dist/server/build-manifest.d.ts.map +1 -1
  570. package/dist/server/canonicalize.d.ts +10 -0
  571. package/dist/server/canonicalize.d.ts.map +1 -1
  572. package/dist/server/chain-url-parts.d.ts +82 -0
  573. package/dist/server/chain-url-parts.d.ts.map +1 -0
  574. package/dist/server/children-interception.d.ts +49 -0
  575. package/dist/server/children-interception.d.ts.map +1 -0
  576. package/dist/server/coalesce-tick.d.ts +40 -0
  577. package/dist/server/coalesce-tick.d.ts.map +1 -0
  578. package/dist/server/compress.d.ts.map +1 -1
  579. package/dist/server/cookie-context.d.ts +170 -0
  580. package/dist/server/cookie-context.d.ts.map +1 -0
  581. package/dist/server/cookie-parsing.d.ts +65 -0
  582. package/dist/server/cookie-parsing.d.ts.map +1 -0
  583. package/dist/server/csp-nonce.d.ts +45 -0
  584. package/dist/server/csp-nonce.d.ts.map +1 -0
  585. package/dist/server/csrf.d.ts +3 -2
  586. package/dist/server/csrf.d.ts.map +1 -1
  587. package/dist/server/debug.d.ts +82 -0
  588. package/dist/server/debug.d.ts.map +1 -0
  589. package/dist/server/default-logger.d.ts +22 -0
  590. package/dist/server/default-logger.d.ts.map +1 -0
  591. package/dist/server/default-status-page.d.ts +45 -0
  592. package/dist/server/default-status-page.d.ts.map +1 -0
  593. package/dist/server/deny-boundary.d.ts +253 -0
  594. package/dist/server/deny-boundary.d.ts.map +1 -0
  595. package/dist/server/deny-renderer.d.ts +20 -9
  596. package/dist/server/deny-renderer.d.ts.map +1 -1
  597. package/dist/server/dev-source-map.d.ts +22 -0
  598. package/dist/server/dev-source-map.d.ts.map +1 -0
  599. package/dist/server/early-hints-sender.d.ts.map +1 -1
  600. package/dist/server/early-hints.d.ts +14 -12
  601. package/dist/server/early-hints.d.ts.map +1 -1
  602. package/dist/server/error-boundary-wrapper.d.ts +101 -10
  603. package/dist/server/error-boundary-wrapper.d.ts.map +1 -1
  604. package/dist/server/error-response-headers.d.ts +3 -0
  605. package/dist/server/error-response-headers.d.ts.map +1 -0
  606. package/dist/server/fallback-error.d.ts +12 -7
  607. package/dist/server/fallback-error.d.ts.map +1 -1
  608. package/dist/server/flight-injection-state.d.ts +66 -0
  609. package/dist/server/flight-injection-state.d.ts.map +1 -0
  610. package/dist/server/flight-scripts.d.ts +45 -0
  611. package/dist/server/flight-scripts.d.ts.map +1 -0
  612. package/dist/server/form-data.d.ts +41 -0
  613. package/dist/server/form-data.d.ts.map +1 -1
  614. package/dist/server/form-flash.d.ts +1 -1
  615. package/dist/server/head-response.d.ts +35 -0
  616. package/dist/server/head-response.d.ts.map +1 -0
  617. package/dist/server/html-injector-core.d.ts +257 -0
  618. package/dist/server/html-injector-core.d.ts.map +1 -0
  619. package/dist/server/html-injectors.d.ts +84 -42
  620. package/dist/server/html-injectors.d.ts.map +1 -1
  621. package/dist/server/index.d.ts +18 -54
  622. package/dist/server/index.d.ts.map +1 -1
  623. package/dist/server/index.js +212 -2930
  624. package/dist/server/index.js.map +1 -1
  625. package/dist/server/instrumentation.d.ts +1 -1
  626. package/dist/server/internal.d.ts +50 -0
  627. package/dist/server/internal.d.ts.map +1 -0
  628. package/dist/server/internal.js +4034 -0
  629. package/dist/server/internal.js.map +1 -0
  630. package/dist/server/logger.d.ts +39 -7
  631. package/dist/server/logger.d.ts.map +1 -1
  632. package/dist/server/metadata-collector.d.ts +71 -0
  633. package/dist/server/metadata-collector.d.ts.map +1 -0
  634. package/dist/server/metadata-platform.d.ts +2 -2
  635. package/dist/server/metadata-render.d.ts +2 -2
  636. package/dist/server/metadata-render.d.ts.map +1 -1
  637. package/dist/server/metadata-routes.d.ts +60 -11
  638. package/dist/server/metadata-routes.d.ts.map +1 -1
  639. package/dist/server/metadata-social.d.ts +2 -2
  640. package/dist/server/metadata.d.ts +10 -2
  641. package/dist/server/metadata.d.ts.map +1 -1
  642. package/dist/server/middleware-runner.d.ts +20 -5
  643. package/dist/server/middleware-runner.d.ts.map +1 -1
  644. package/dist/server/node-stream-transforms.d.ts +105 -0
  645. package/dist/server/node-stream-transforms.d.ts.map +1 -0
  646. package/dist/server/nuqs-ssr-provider.d.ts +7 -3
  647. package/dist/server/nuqs-ssr-provider.d.ts.map +1 -1
  648. package/dist/server/param-coercion.d.ts +78 -0
  649. package/dist/server/param-coercion.d.ts.map +1 -0
  650. package/dist/server/pipeline-helpers.d.ts +77 -0
  651. package/dist/server/pipeline-helpers.d.ts.map +1 -0
  652. package/dist/server/pipeline-interception.d.ts +59 -9
  653. package/dist/server/pipeline-interception.d.ts.map +1 -1
  654. package/dist/server/pipeline-metadata.d.ts +7 -1
  655. package/dist/server/pipeline-metadata.d.ts.map +1 -1
  656. package/dist/server/pipeline-outcome.d.ts +49 -0
  657. package/dist/server/pipeline-outcome.d.ts.map +1 -0
  658. package/dist/server/pipeline-phases.d.ts +70 -0
  659. package/dist/server/pipeline-phases.d.ts.map +1 -0
  660. package/dist/server/pipeline.d.ts +160 -24
  661. package/dist/server/pipeline.d.ts.map +1 -1
  662. package/dist/server/port-resolution.d.ts +31 -0
  663. package/dist/server/port-resolution.d.ts.map +1 -0
  664. package/dist/server/prebuilt/cache-key.d.ts +63 -0
  665. package/dist/server/prebuilt/cache-key.d.ts.map +1 -0
  666. package/dist/server/prebuilt/capture-state.d.ts +57 -0
  667. package/dist/server/prebuilt/capture-state.d.ts.map +1 -0
  668. package/dist/server/prebuilt/key-discipline.d.ts +52 -0
  669. package/dist/server/prebuilt/key-discipline.d.ts.map +1 -0
  670. package/dist/server/prebuilt/manifest-tag-index.d.ts +27 -0
  671. package/dist/server/prebuilt/manifest-tag-index.d.ts.map +1 -0
  672. package/dist/server/prebuilt/overlay.d.ts +100 -0
  673. package/dist/server/prebuilt/overlay.d.ts.map +1 -0
  674. package/dist/server/prebuilt/payload-source.d.ts +79 -0
  675. package/dist/server/prebuilt/payload-source.d.ts.map +1 -0
  676. package/dist/server/prebuilt/slots.d.ts +99 -0
  677. package/dist/server/prebuilt/slots.d.ts.map +1 -0
  678. package/dist/server/prebuilt/synthetic-store.d.ts +67 -0
  679. package/dist/server/prebuilt/synthetic-store.d.ts.map +1 -0
  680. package/dist/server/prebuilt-builder.d.ts +121 -0
  681. package/dist/server/prebuilt-builder.d.ts.map +1 -0
  682. package/dist/server/prebuilt-runtime.d.ts +111 -0
  683. package/dist/server/prebuilt-runtime.d.ts.map +1 -0
  684. package/dist/server/primitives.d.ts +129 -45
  685. package/dist/server/primitives.d.ts.map +1 -1
  686. package/dist/server/publish-params.d.ts +33 -0
  687. package/dist/server/publish-params.d.ts.map +1 -0
  688. package/dist/server/render-timeout.d.ts +51 -0
  689. package/dist/server/render-timeout.d.ts.map +1 -0
  690. package/dist/server/render-utils.d.ts +26 -0
  691. package/dist/server/render-utils.d.ts.map +1 -0
  692. package/dist/server/request-context.d.ts +111 -107
  693. package/dist/server/request-context.d.ts.map +1 -1
  694. package/dist/server/request-dep.d.ts +15 -0
  695. package/dist/server/request-dep.d.ts.map +1 -0
  696. package/dist/server/response-cache-policy.d.ts +3 -0
  697. package/dist/server/response-cache-policy.d.ts.map +1 -0
  698. package/dist/server/route-element-builder.d.ts +57 -30
  699. package/dist/server/route-element-builder.d.ts.map +1 -1
  700. package/dist/server/route-element-helpers.d.ts +12 -0
  701. package/dist/server/route-element-helpers.d.ts.map +1 -0
  702. package/dist/server/route-handler.d.ts +1 -1
  703. package/dist/server/route-handler.d.ts.map +1 -1
  704. package/dist/server/route-matcher.d.ts +40 -38
  705. package/dist/server/route-matcher.d.ts.map +1 -1
  706. package/dist/server/route-module-loader.d.ts +37 -0
  707. package/dist/server/route-module-loader.d.ts.map +1 -0
  708. package/dist/server/rsc-cache-key-guard.d.ts +78 -0
  709. package/dist/server/rsc-cache-key-guard.d.ts.map +1 -0
  710. package/dist/server/rsc-entry/action-middleware-runner.d.ts +66 -0
  711. package/dist/server/rsc-entry/action-middleware-runner.d.ts.map +1 -0
  712. package/dist/server/rsc-entry/api-handler.d.ts +12 -3
  713. package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
  714. package/dist/server/rsc-entry/deny-fallback.d.ts +29 -0
  715. package/dist/server/rsc-entry/deny-fallback.d.ts.map +1 -0
  716. package/dist/server/rsc-entry/error-renderer.d.ts +38 -13
  717. package/dist/server/rsc-entry/error-renderer.d.ts.map +1 -1
  718. package/dist/server/rsc-entry/helpers.d.ts +59 -42
  719. package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
  720. package/dist/server/rsc-entry/index.d.ts +40 -6
  721. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  722. package/dist/server/rsc-entry/render-route.d.ts +51 -0
  723. package/dist/server/rsc-entry/render-route.d.ts.map +1 -0
  724. package/dist/server/rsc-entry/revalidate-renderer.d.ts +108 -0
  725. package/dist/server/rsc-entry/revalidate-renderer.d.ts.map +1 -0
  726. package/dist/server/rsc-entry/rsc-payload.d.ts +26 -6
  727. package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
  728. package/dist/server/rsc-entry/rsc-stream.d.ts +39 -3
  729. package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
  730. package/dist/server/rsc-entry/ssr-bridge.d.ts +5 -1
  731. package/dist/server/rsc-entry/ssr-bridge.d.ts.map +1 -1
  732. package/dist/server/rsc-entry/ssr-renderer.d.ts +37 -5
  733. package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
  734. package/dist/server/rsc-entry/wrap-action-dispatch.d.ts +89 -0
  735. package/dist/server/rsc-entry/wrap-action-dispatch.d.ts.map +1 -0
  736. package/dist/server/rsc-error-envelope.d.ts +11 -0
  737. package/dist/server/rsc-error-envelope.d.ts.map +1 -0
  738. package/dist/server/rsc-prop-warnings.d.ts.map +1 -1
  739. package/dist/server/safe-load.d.ts +46 -0
  740. package/dist/server/safe-load.d.ts.map +1 -0
  741. package/dist/server/sensitive-fields.d.ts +74 -0
  742. package/dist/server/sensitive-fields.d.ts.map +1 -0
  743. package/dist/server/sitemap-generator.d.ts +130 -0
  744. package/dist/server/sitemap-generator.d.ts.map +1 -0
  745. package/dist/server/sitemap-handler.d.ts +22 -0
  746. package/dist/server/sitemap-handler.d.ts.map +1 -0
  747. package/dist/server/skippable-prefix.d.ts +29 -0
  748. package/dist/server/skippable-prefix.d.ts.map +1 -0
  749. package/dist/server/slot-interception.d.ts +80 -0
  750. package/dist/server/slot-interception.d.ts.map +1 -0
  751. package/dist/server/slot-resolver.d.ts +137 -7
  752. package/dist/server/slot-resolver.d.ts.map +1 -1
  753. package/dist/server/slot-subtree-contain.d.ts +54 -0
  754. package/dist/server/slot-subtree-contain.d.ts.map +1 -0
  755. package/dist/server/ssr-bridge-types.d.ts +160 -0
  756. package/dist/server/ssr-bridge-types.d.ts.map +1 -0
  757. package/dist/server/ssr-entry.d.ts +1 -43
  758. package/dist/server/ssr-entry.d.ts.map +1 -1
  759. package/dist/server/ssr-render.d.ts +69 -22
  760. package/dist/server/ssr-render.d.ts.map +1 -1
  761. package/dist/server/ssr-wrappers.d.ts +93 -0
  762. package/dist/server/ssr-wrappers.d.ts.map +1 -0
  763. package/dist/server/state-tree-diff.d.ts +44 -9
  764. package/dist/server/state-tree-diff.d.ts.map +1 -1
  765. package/dist/server/static-generator.d.ts +112 -0
  766. package/dist/server/static-generator.d.ts.map +1 -0
  767. package/dist/server/static-not-found.d.ts +52 -0
  768. package/dist/server/static-not-found.d.ts.map +1 -0
  769. package/dist/server/status-code-resolver.d.ts +26 -15
  770. package/dist/server/status-code-resolver.d.ts.map +1 -1
  771. package/dist/server/stream-utils.d.ts +47 -0
  772. package/dist/server/stream-utils.d.ts.map +1 -0
  773. package/dist/server/tracing.d.ts +56 -11
  774. package/dist/server/tracing.d.ts.map +1 -1
  775. package/dist/server/tree-match.d.ts +49 -0
  776. package/dist/server/tree-match.d.ts.map +1 -0
  777. package/dist/server/types.d.ts +88 -7
  778. package/dist/server/types.d.ts.map +1 -1
  779. package/dist/server/utils/element-type.d.ts +50 -0
  780. package/dist/server/utils/element-type.d.ts.map +1 -0
  781. package/dist/server/utils/escape-html.d.ts +14 -0
  782. package/dist/server/utils/escape-html.d.ts.map +1 -0
  783. package/dist/server/utils/mdx-file.d.ts +17 -0
  784. package/dist/server/utils/mdx-file.d.ts.map +1 -0
  785. package/dist/server/version-skew.d.ts +61 -0
  786. package/dist/server/version-skew.d.ts.map +1 -0
  787. package/dist/server/waituntil-bridge.d.ts.map +1 -1
  788. package/dist/server/workers-cache-bridge.d.ts +26 -0
  789. package/dist/server/workers-cache-bridge.d.ts.map +1 -0
  790. package/dist/shared/als-slots.d.ts +42 -0
  791. package/dist/shared/als-slots.d.ts.map +1 -0
  792. package/dist/shared/base-path.d.ts +56 -0
  793. package/dist/shared/base-path.d.ts.map +1 -0
  794. package/dist/shared/href-validation.d.ts +49 -0
  795. package/dist/shared/href-validation.d.ts.map +1 -0
  796. package/dist/shared/merge-search-params.d.ts +22 -0
  797. package/dist/shared/merge-search-params.d.ts.map +1 -0
  798. package/dist/shared/param-value.d.ts +104 -0
  799. package/dist/shared/param-value.d.ts.map +1 -0
  800. package/dist/shared/payload-root.d.ts +109 -0
  801. package/dist/shared/payload-root.d.ts.map +1 -0
  802. package/dist/shared/redirect-type.d.ts +17 -0
  803. package/dist/shared/redirect-type.d.ts.map +1 -0
  804. package/dist/shared/rsc-cache-key.d.ts +163 -0
  805. package/dist/shared/rsc-cache-key.d.ts.map +1 -0
  806. package/dist/shared/rsc-error-envelope.d.ts +16 -0
  807. package/dist/shared/rsc-error-envelope.d.ts.map +1 -0
  808. package/dist/shared/rsc-manifest.d.ts +28 -0
  809. package/dist/shared/rsc-manifest.d.ts.map +1 -0
  810. package/dist/shared/rsc-media-type.d.ts +52 -0
  811. package/dist/shared/rsc-media-type.d.ts.map +1 -0
  812. package/dist/shared/rsc-payload-path.d.ts +42 -0
  813. package/dist/shared/rsc-payload-path.d.ts.map +1 -0
  814. package/dist/shared/segment-info.d.ts +66 -0
  815. package/dist/shared/segment-info.d.ts.map +1 -0
  816. package/dist/shared/slot-params.d.ts +52 -0
  817. package/dist/shared/slot-params.d.ts.map +1 -0
  818. package/dist/shared/static-platform-files.d.ts +71 -0
  819. package/dist/shared/static-platform-files.d.ts.map +1 -0
  820. package/dist/shared/status-reason-phrase.d.ts +26 -0
  821. package/dist/shared/status-reason-phrase.d.ts.map +1 -0
  822. package/dist/shims/font-google.d.ts +1 -1
  823. package/dist/shims/font-google.d.ts.map +1 -1
  824. package/dist/shims/font-google.js +42 -0
  825. package/dist/shims/font-google.js.map +1 -0
  826. package/dist/shims/font-local.d.ts +26 -0
  827. package/dist/shims/font-local.d.ts.map +1 -0
  828. package/dist/shims/font-local.js +20 -0
  829. package/dist/shims/font-local.js.map +1 -0
  830. package/dist/shims/headers.d.ts +53 -1
  831. package/dist/shims/headers.d.ts.map +1 -1
  832. package/dist/shims/image.d.ts +120 -120
  833. package/dist/shims/image.d.ts.map +1 -1
  834. package/dist/shims/navigation-client.d.ts +25 -12
  835. package/dist/shims/navigation-client.d.ts.map +1 -1
  836. package/dist/shims/navigation-rsc.d.ts +21 -0
  837. package/dist/shims/navigation-rsc.d.ts.map +1 -0
  838. package/dist/shims/navigation.d.ts +10 -5
  839. package/dist/shims/navigation.d.ts.map +1 -1
  840. package/dist/utils/state-machine.d.ts +80 -0
  841. package/dist/utils/state-machine.d.ts.map +1 -0
  842. package/docs/api/30-api-server.mdx +236 -0
  843. package/docs/api/31-api-client.mdx +167 -0
  844. package/docs/api/32-api-cache.mdx +311 -0
  845. package/docs/api/33-api-search-params.mdx +176 -0
  846. package/docs/api/34-api-config.mdx +329 -0
  847. package/docs/api/35-api-typescript.mdx +91 -0
  848. package/docs/api/36-cli.mdx +192 -0
  849. package/docs/learn/00-introduction.mdx +109 -0
  850. package/docs/learn/01-quick-start.mdx +94 -0
  851. package/docs/learn/02-pages-and-layouts.mdx +147 -0
  852. package/docs/learn/03-fetching-data.mdx +211 -0
  853. package/docs/learn/04-access-control.mdx +115 -0
  854. package/docs/learn/05-the-flush-point.mdx +175 -0
  855. package/docs/learn/06-typed-params.mdx +275 -0
  856. package/docs/learn/07-typed-routes.mdx +108 -0
  857. package/docs/learn/08-forms-and-actions.mdx +146 -0
  858. package/docs/learn/09-streaming.mdx +140 -0
  859. package/docs/learn/10-caching.mdx +252 -0
  860. package/docs/learn/11-middleware.mdx +158 -0
  861. package/docs/learn/12-error-handling.mdx +188 -0
  862. package/docs/learn/13-deploying.mdx +287 -0
  863. package/llms.txt +55 -0
  864. package/package.json +117 -29
  865. package/src/adapters/build-output-helper.ts +351 -0
  866. package/src/adapters/cloudflare-dev.ts +183 -0
  867. package/src/adapters/cloudflare-kv-cache.ts +207 -0
  868. package/src/adapters/cloudflare.ts +747 -130
  869. package/src/adapters/compress-module.ts +101 -88
  870. package/src/adapters/fs-identity.ts +156 -0
  871. package/src/adapters/nitro-presets.ts +139 -0
  872. package/src/adapters/nitro-preview.ts +340 -0
  873. package/src/adapters/nitro.ts +279 -418
  874. package/src/adapters/raw-imports.d.ts +5 -0
  875. package/src/adapters/shared.ts +274 -0
  876. package/src/adapters/types.ts +28 -7
  877. package/src/adapters/wrangler.d.ts +7 -0
  878. package/src/analyze/chains.ts +411 -0
  879. package/src/analyze/classify.ts +258 -0
  880. package/src/analyze/crawl-entry.ts +68 -0
  881. package/src/analyze/crawl.ts +500 -0
  882. package/src/analyze/graph-cache.ts +332 -0
  883. package/src/analyze/graph-command.ts +762 -0
  884. package/src/analyze/live-graph.ts +232 -0
  885. package/src/analyze/poison-rules.ts +165 -0
  886. package/src/analyze/poison-scan.ts +162 -0
  887. package/src/analyze/scan.ts +149 -0
  888. package/src/cache/cache-api.ts +107 -0
  889. package/src/cache/fast-hash.ts +39 -0
  890. package/src/cache/handler-store.ts +76 -0
  891. package/src/cache/index.ts +115 -22
  892. package/src/cache/invalidation-epoch.ts +93 -0
  893. package/src/cache/json-lossy-check.ts +75 -0
  894. package/src/cache/redis-handler.ts +198 -20
  895. package/src/cache/singleflight.ts +69 -6
  896. package/src/cache/sizeof.ts +33 -0
  897. package/src/cache/stable-stringify.ts +65 -2
  898. package/src/cache/store.ts +71 -0
  899. package/src/cache/stores/cloudflare-kv.ts +52 -0
  900. package/src/cache/stores/memory.ts +125 -0
  901. package/src/cache/stores/redis.ts +97 -0
  902. package/src/cache/stores/vercel.ts +59 -0
  903. package/src/cache/tag-aware-handler.ts +237 -0
  904. package/src/cache/timber-cache.ts +180 -48
  905. package/src/cdn/cloudflare-purge.ts +50 -0
  906. package/src/cdn/fastly-purge.ts +63 -0
  907. package/src/cdn/headers.ts +153 -0
  908. package/src/cdn/index.ts +23 -0
  909. package/src/cdn/purge-store.ts +34 -0
  910. package/src/cdn/workers-cache-purge.ts +34 -0
  911. package/src/cli-check.ts +507 -0
  912. package/src/cli-schema-sync.ts +401 -0
  913. package/src/cli.ts +262 -55
  914. package/src/client/browser-dev.ts +157 -2
  915. package/src/client/browser-entry/action-dispatch.ts +197 -0
  916. package/src/client/browser-entry/action-queue.ts +90 -0
  917. package/src/client/browser-entry/hmr.ts +70 -0
  918. package/src/client/browser-entry/hydrate.ts +148 -0
  919. package/src/client/browser-entry/index.ts +131 -0
  920. package/src/client/browser-entry/post-hydration.ts +123 -0
  921. package/src/client/browser-entry/router-init.ts +418 -0
  922. package/src/client/browser-entry/rsc-stream.ts +166 -0
  923. package/src/client/browser-entry/scroll.ts +50 -0
  924. package/src/client/deny-last-resort.tsx +54 -0
  925. package/src/client/error-boundary.tsx +316 -40
  926. package/src/client/error-reconstituter.tsx +79 -0
  927. package/src/client/form.tsx +36 -32
  928. package/src/client/global-context.ts +31 -0
  929. package/src/client/history.ts +81 -10
  930. package/src/client/index.ts +89 -53
  931. package/src/client/internal.ts +59 -0
  932. package/src/client/link.tsx +452 -159
  933. package/src/client/location-search.ts +15 -0
  934. package/src/client/navigation-api.ts +347 -0
  935. package/src/client/navigation-commit.ts +295 -0
  936. package/src/client/navigation-context.ts +67 -98
  937. package/src/client/navigation-root.tsx +224 -0
  938. package/src/client/navigation-transition.ts +327 -0
  939. package/src/client/nuqs-adapter.tsx +21 -9
  940. package/src/client/params-context.ts +187 -0
  941. package/src/client/react-root.ts +72 -0
  942. package/src/client/router-effects.ts +228 -0
  943. package/src/client/router-lifecycle.ts +354 -0
  944. package/src/client/router-pipeline.ts +490 -0
  945. package/src/client/router-ref.ts +3 -3
  946. package/src/client/router-skew.ts +30 -0
  947. package/src/client/router-types.ts +294 -0
  948. package/src/client/router.ts +436 -424
  949. package/src/client/rsc-fetch.ts +512 -73
  950. package/src/client/segment-cache.ts +327 -40
  951. package/src/client/segment-context.ts +13 -5
  952. package/src/client/segment-outlet.tsx +96 -0
  953. package/src/client/segment-update-context.ts +23 -0
  954. package/src/client/shallow-url.ts +22 -0
  955. package/src/client/slot-content-cache-context.ts +43 -0
  956. package/src/client/slot-context.ts +50 -0
  957. package/src/client/slot-outlet.tsx +22 -0
  958. package/src/client/slot-provider.tsx +32 -0
  959. package/src/client/ssr-data.ts +30 -9
  960. package/src/client/stale-client.ts +191 -0
  961. package/src/client/state.ts +29 -15
  962. package/src/client/status-page-marker.tsx +32 -0
  963. package/src/client/top-loader.tsx +36 -29
  964. package/src/client/unload-guard.ts +35 -3
  965. package/src/client/use-cookie.ts +70 -18
  966. package/src/client/use-link-status.ts +7 -7
  967. package/src/client/use-pathname.ts +22 -31
  968. package/src/client/use-pending-navigation.ts +40 -0
  969. package/src/client/use-query-states.ts +206 -36
  970. package/src/client/use-router.ts +6 -3
  971. package/src/client/use-search-params.ts +38 -49
  972. package/src/client/use-segment-params.ts +69 -0
  973. package/src/client/use-selected-layout-segment.ts +2 -2
  974. package/src/codec.ts +149 -0
  975. package/src/config-types.ts +322 -0
  976. package/src/config-validation.ts +347 -0
  977. package/src/cookies/define-cookie.ts +222 -53
  978. package/src/cookies/index.ts +13 -2
  979. package/src/cookies/json-cookie.ts +105 -0
  980. package/src/cookies/validation.ts +192 -0
  981. package/src/dev-tools/404-page.ts +286 -0
  982. package/src/dev-tools/browser-logs.ts +55 -0
  983. package/src/dev-tools/dev-page-shell.ts +260 -0
  984. package/src/dev-tools/error-page.ts +331 -0
  985. package/src/dev-tools/holding-server.ts +185 -0
  986. package/src/dev-tools/hydration-overlay.ts +158 -0
  987. package/src/dev-tools/index.ts +83 -0
  988. package/src/dev-tools/instrumentation.ts +213 -0
  989. package/src/{server/dev-logger.ts → dev-tools/logger.ts} +33 -51
  990. package/src/{plugins/dev-logs.ts → dev-tools/logs.ts} +122 -26
  991. package/src/dev-tools/overlay.ts +469 -0
  992. package/src/dev-tools/stack-classifier.ts +75 -0
  993. package/src/dev-tools/terminal.ts +182 -0
  994. package/src/fonts/ast-walk.ts +235 -0
  995. package/src/fonts/ast.ts +479 -128
  996. package/src/fonts/bundle.ts +138 -0
  997. package/src/fonts/css.ts +3 -2
  998. package/src/fonts/dev-middleware.ts +85 -0
  999. package/src/fonts/fallbacks.ts +0 -23
  1000. package/src/fonts/google.ts +101 -19
  1001. package/src/fonts/local.ts +13 -8
  1002. package/src/fonts/paths.ts +58 -0
  1003. package/src/fonts/pipeline.ts +348 -0
  1004. package/src/fonts/transform.ts +311 -0
  1005. package/src/fonts/types.ts +52 -1
  1006. package/src/fonts/virtual-modules.ts +179 -0
  1007. package/src/index.ts +486 -344
  1008. package/src/params/codec-registry.ts +34 -0
  1009. package/src/params/define-schema.ts +115 -0
  1010. package/src/params/index.ts +17 -0
  1011. package/src/params/resolve-schema.ts +84 -0
  1012. package/src/plugin-context.ts +503 -0
  1013. package/src/plugins/adapter-build.ts +229 -7
  1014. package/src/plugins/build-manifest.ts +201 -26
  1015. package/src/plugins/build-report.ts +275 -43
  1016. package/src/plugins/cache.ts +243 -0
  1017. package/src/plugins/callsite-ast.ts +472 -0
  1018. package/src/plugins/callsite-jsx.ts +243 -0
  1019. package/src/plugins/chunks.ts +74 -5
  1020. package/src/plugins/client-chunks.ts +185 -0
  1021. package/src/plugins/cloudflare-wasm.ts +141 -0
  1022. package/src/plugins/content.ts +5 -1
  1023. package/src/plugins/dev-discovery.ts +218 -0
  1024. package/src/plugins/dev-server.ts +369 -96
  1025. package/src/plugins/entries.ts +148 -18
  1026. package/src/plugins/fonts.ts +251 -524
  1027. package/src/plugins/graph-endpoint.ts +532 -0
  1028. package/src/plugins/mdx.ts +116 -40
  1029. package/src/plugins/prebuilt-capture.ts +217 -0
  1030. package/src/plugins/prebuilt-options-analysis.ts +175 -0
  1031. package/src/plugins/prebuilt.ts +655 -0
  1032. package/src/plugins/prerender-sugar.ts +320 -0
  1033. package/src/plugins/request-dep/analysis.ts +447 -0
  1034. package/src/plugins/request-dep/index.ts +376 -0
  1035. package/src/plugins/request-dep/origin.ts +310 -0
  1036. package/src/plugins/routing.ts +273 -277
  1037. package/src/plugins/server-bundle.ts +103 -14
  1038. package/src/plugins/shims.ts +259 -97
  1039. package/src/plugins/static-build.ts +708 -66
  1040. package/src/react-canary.d.ts +2 -0
  1041. package/src/routing/codegen-shared.ts +39 -0
  1042. package/src/routing/codegen-types.ts +62 -0
  1043. package/src/routing/codegen-write.ts +141 -0
  1044. package/src/routing/codegen.ts +349 -232
  1045. package/src/routing/collision-probe.ts +438 -0
  1046. package/src/routing/collision-spaces.ts +281 -0
  1047. package/src/routing/convention-lint.ts +623 -0
  1048. package/src/routing/export-detect.ts +448 -0
  1049. package/src/routing/file-cache.ts +23 -0
  1050. package/src/routing/index.ts +16 -7
  1051. package/src/routing/interception-overlap.ts +141 -0
  1052. package/src/routing/interception.ts +1044 -67
  1053. package/src/routing/link-codegen.ts +280 -0
  1054. package/src/routing/manifest-codegen.ts +226 -0
  1055. package/src/routing/scanner.ts +393 -219
  1056. package/src/routing/schema-validation.ts +155 -0
  1057. package/src/routing/segment-classify.ts +280 -0
  1058. package/src/routing/segment-codegen.ts +98 -0
  1059. package/src/routing/segment-keys.ts +186 -0
  1060. package/src/routing/slot-placement.ts +97 -0
  1061. package/src/routing/types.ts +75 -26
  1062. package/src/routing/walkers.ts +98 -0
  1063. package/src/rsc-runtime/rsc.ts +9 -0
  1064. package/src/rsc-runtime/ssr.ts +51 -0
  1065. package/src/rsc-runtime/transforms.ts +13 -0
  1066. package/src/rsc-runtime/vendor-types.d.ts +19 -0
  1067. package/src/schema-bridge.ts +380 -0
  1068. package/src/search-params/define.ts +677 -0
  1069. package/src/search-params/index.ts +14 -20
  1070. package/src/search-params/parse-total.ts +91 -0
  1071. package/src/search-params/serialize-equal.ts +14 -0
  1072. package/src/search-params/wrappers.ts +150 -0
  1073. package/src/server/access-gate.tsx +196 -57
  1074. package/src/server/action-client.ts +136 -35
  1075. package/src/server/action-encryption.ts +144 -0
  1076. package/src/server/action-handler.ts +256 -56
  1077. package/src/server/actions.ts +112 -68
  1078. package/src/server/als-registry.ts +160 -21
  1079. package/src/server/asset-headers.ts +15 -37
  1080. package/src/server/body-limits.ts +10 -2
  1081. package/src/server/build-manifest.ts +33 -57
  1082. package/src/server/canonicalize.ts +6 -3
  1083. package/src/server/chain-url-parts.ts +163 -0
  1084. package/src/server/children-interception.ts +115 -0
  1085. package/src/server/coalesce-tick.ts +75 -0
  1086. package/src/server/compress.ts +43 -8
  1087. package/src/server/cookie-context.ts +484 -0
  1088. package/src/server/cookie-parsing.ts +163 -0
  1089. package/src/server/csp-nonce.ts +70 -0
  1090. package/src/server/csrf.ts +39 -6
  1091. package/src/server/debug.ts +137 -0
  1092. package/src/server/default-logger.ts +99 -0
  1093. package/src/server/default-status-page.ts +88 -0
  1094. package/src/server/deny-boundary.ts +533 -0
  1095. package/src/server/deny-renderer.ts +214 -112
  1096. package/src/server/dev-source-map.ts +31 -0
  1097. package/src/server/early-hints-sender.ts +4 -3
  1098. package/src/server/early-hints.ts +39 -29
  1099. package/src/server/error-boundary-wrapper.ts +181 -44
  1100. package/src/server/error-response-headers.ts +18 -0
  1101. package/src/server/fallback-error.ts +79 -102
  1102. package/src/server/flight-injection-state.ts +113 -0
  1103. package/src/server/flight-scripts.ts +67 -0
  1104. package/src/server/form-data.ts +124 -12
  1105. package/src/server/form-flash.ts +2 -2
  1106. package/src/server/head-response.ts +54 -0
  1107. package/src/server/html-injector-core.ts +512 -0
  1108. package/src/server/html-injectors.ts +272 -235
  1109. package/src/server/index.ts +40 -192
  1110. package/src/server/instrumentation.ts +1 -1
  1111. package/src/server/internal.ts +173 -0
  1112. package/src/server/logger.ts +73 -36
  1113. package/src/server/metadata-collector.ts +174 -0
  1114. package/src/server/metadata-platform.ts +2 -2
  1115. package/src/server/metadata-render.ts +30 -8
  1116. package/src/server/metadata-routes.ts +205 -24
  1117. package/src/server/metadata-social.ts +2 -2
  1118. package/src/server/metadata.ts +23 -2
  1119. package/src/server/middleware-runner.ts +32 -5
  1120. package/src/server/node-stream-transforms.ts +323 -0
  1121. package/src/server/nuqs-ssr-provider.tsx +8 -7
  1122. package/src/server/param-coercion.ts +198 -0
  1123. package/src/server/pipeline-helpers.ts +159 -0
  1124. package/src/server/pipeline-interception.ts +109 -33
  1125. package/src/server/pipeline-metadata.ts +15 -1
  1126. package/src/server/pipeline-outcome.ts +218 -0
  1127. package/src/server/pipeline-phases.ts +606 -0
  1128. package/src/server/pipeline.ts +343 -389
  1129. package/src/server/port-resolution.ts +53 -0
  1130. package/src/server/prebuilt/cache-key.ts +299 -0
  1131. package/src/server/prebuilt/capture-state.ts +89 -0
  1132. package/src/server/prebuilt/key-discipline.ts +122 -0
  1133. package/src/server/prebuilt/manifest-tag-index.ts +46 -0
  1134. package/src/server/prebuilt/overlay.ts +256 -0
  1135. package/src/server/prebuilt/payload-source.ts +202 -0
  1136. package/src/server/prebuilt/slots.ts +190 -0
  1137. package/src/server/prebuilt/synthetic-store.ts +122 -0
  1138. package/src/server/prebuilt-builder.ts +804 -0
  1139. package/src/server/prebuilt-runtime.ts +817 -0
  1140. package/src/server/primitives.ts +246 -97
  1141. package/src/server/publish-params.ts +42 -0
  1142. package/src/server/render-timeout.ts +108 -0
  1143. package/src/server/render-utils.ts +35 -0
  1144. package/src/server/request-context.ts +244 -333
  1145. package/src/server/request-dep.ts +37 -0
  1146. package/src/server/response-cache-policy.ts +45 -0
  1147. package/src/server/route-element-builder.ts +508 -360
  1148. package/src/server/route-element-helpers.ts +37 -0
  1149. package/src/server/route-handler.ts +40 -13
  1150. package/src/server/route-matcher.ts +165 -272
  1151. package/src/server/route-module-loader.ts +161 -0
  1152. package/src/server/rsc-cache-key-guard.ts +122 -0
  1153. package/src/server/rsc-entry/action-middleware-runner.ts +174 -0
  1154. package/src/server/rsc-entry/api-handler.ts +78 -34
  1155. package/src/server/rsc-entry/deny-fallback.ts +93 -0
  1156. package/src/server/rsc-entry/error-renderer.ts +373 -95
  1157. package/src/server/rsc-entry/helpers.ts +226 -95
  1158. package/src/server/rsc-entry/index.ts +405 -323
  1159. package/src/server/rsc-entry/render-route.ts +304 -0
  1160. package/src/server/rsc-entry/revalidate-renderer.ts +350 -0
  1161. package/src/server/rsc-entry/rsc-payload.ts +239 -50
  1162. package/src/server/rsc-entry/rsc-stream.ts +160 -30
  1163. package/src/server/rsc-entry/ssr-bridge.ts +18 -5
  1164. package/src/server/rsc-entry/ssr-renderer.ts +315 -57
  1165. package/src/server/rsc-entry/wrap-action-dispatch.ts +186 -0
  1166. package/src/server/rsc-error-envelope.ts +18 -0
  1167. package/src/server/rsc-prop-warnings.ts +3 -1
  1168. package/src/server/safe-load.ts +60 -0
  1169. package/src/server/sensitive-fields.ts +230 -0
  1170. package/src/server/server-only-guard-noop.js +3 -0
  1171. package/src/server/server-timing.ts +1 -1
  1172. package/src/server/sitemap-generator.ts +337 -0
  1173. package/src/server/sitemap-handler.ts +157 -0
  1174. package/src/server/skippable-prefix.ts +172 -0
  1175. package/src/server/slot-interception.ts +168 -0
  1176. package/src/server/slot-resolver.ts +707 -300
  1177. package/src/server/slot-subtree-contain.ts +255 -0
  1178. package/src/server/ssr-bridge-types.ts +165 -0
  1179. package/src/server/ssr-entry.ts +230 -85
  1180. package/src/server/ssr-render.ts +357 -85
  1181. package/src/server/ssr-wrappers.tsx +162 -0
  1182. package/src/server/state-tree-diff.ts +85 -30
  1183. package/src/server/static-generator.ts +715 -0
  1184. package/src/server/static-not-found.ts +134 -0
  1185. package/src/server/status-code-resolver.ts +107 -148
  1186. package/src/server/stream-utils.ts +292 -0
  1187. package/src/server/tracing.ts +151 -16
  1188. package/src/server/tree-match.ts +262 -0
  1189. package/src/server/types.ts +95 -10
  1190. package/src/server/utils/element-type.ts +88 -0
  1191. package/src/server/utils/escape-html.ts +20 -0
  1192. package/src/server/utils/mdx-file.ts +22 -0
  1193. package/src/server/version-skew.ts +104 -0
  1194. package/src/server/waituntil-bridge.ts +5 -2
  1195. package/src/server/workers-cache-bridge.ts +33 -0
  1196. package/src/shared/als-slots.ts +74 -0
  1197. package/src/shared/base-path.ts +80 -0
  1198. package/src/shared/href-validation.ts +159 -0
  1199. package/src/shared/merge-search-params.ts +55 -0
  1200. package/src/shared/param-value.ts +281 -0
  1201. package/src/shared/payload-root.ts +152 -0
  1202. package/src/shared/redirect-type.ts +17 -0
  1203. package/src/shared/rsc-cache-key.ts +269 -0
  1204. package/src/shared/rsc-error-envelope.ts +16 -0
  1205. package/src/shared/rsc-manifest.ts +29 -0
  1206. package/src/shared/rsc-media-type.ts +59 -0
  1207. package/src/shared/rsc-payload-path.ts +45 -0
  1208. package/src/shared/segment-info.ts +67 -0
  1209. package/src/shared/slot-params.ts +109 -0
  1210. package/src/shared/static-platform-files.ts +75 -0
  1211. package/src/shared/status-reason-phrase.ts +61 -0
  1212. package/src/shims/font-google.ts +1 -1
  1213. package/src/shims/font-local.ts +34 -0
  1214. package/src/shims/headers.ts +122 -1
  1215. package/src/shims/navigation-client.ts +36 -32
  1216. package/src/shims/navigation-rsc.ts +47 -0
  1217. package/src/shims/navigation.ts +10 -7
  1218. package/src/utils/state-machine.ts +111 -0
  1219. package/dist/_chunks/als-registry-k-AtAQ9R.js +0 -41
  1220. package/dist/_chunks/als-registry-k-AtAQ9R.js.map +0 -1
  1221. package/dist/_chunks/format-DNt20Kt8.js +0 -163
  1222. package/dist/_chunks/format-DNt20Kt8.js.map +0 -1
  1223. package/dist/_chunks/interception-DGDIjDbR.js +0 -676
  1224. package/dist/_chunks/interception-DGDIjDbR.js.map +0 -1
  1225. package/dist/_chunks/metadata-routes-CQCnF4VK.js +0 -153
  1226. package/dist/_chunks/metadata-routes-CQCnF4VK.js.map +0 -1
  1227. package/dist/_chunks/request-context-CRj2Zh1E.js +0 -329
  1228. package/dist/_chunks/request-context-CRj2Zh1E.js.map +0 -1
  1229. package/dist/_chunks/ssr-data-DLnbYpj1.js.map +0 -1
  1230. package/dist/_chunks/tracing-DF0G3FB7.js +0 -173
  1231. package/dist/_chunks/tracing-DF0G3FB7.js.map +0 -1
  1232. package/dist/_chunks/use-cookie-dDbpCTx-.js +0 -91
  1233. package/dist/_chunks/use-cookie-dDbpCTx-.js.map +0 -1
  1234. package/dist/_chunks/use-query-states-DAhgj8Gx.js +0 -109
  1235. package/dist/_chunks/use-query-states-DAhgj8Gx.js.map +0 -1
  1236. package/dist/adapters/cloudflare.js.map +0 -1
  1237. package/dist/cache/index.js.map +0 -1
  1238. package/dist/cache/register-cached-function.d.ts +0 -17
  1239. package/dist/cache/register-cached-function.d.ts.map +0 -1
  1240. package/dist/client/browser-entry.d.ts +0 -21
  1241. package/dist/client/browser-entry.d.ts.map +0 -1
  1242. package/dist/client/error-boundary.js.map +0 -1
  1243. package/dist/client/head.d.ts +0 -16
  1244. package/dist/client/head.d.ts.map +0 -1
  1245. package/dist/client/link-status-provider.d.ts +0 -11
  1246. package/dist/client/link-status-provider.d.ts.map +0 -1
  1247. package/dist/client/segment-merger.d.ts +0 -119
  1248. package/dist/client/segment-merger.d.ts.map +0 -1
  1249. package/dist/client/stale-reload.d.ts +0 -44
  1250. package/dist/client/stale-reload.d.ts.map +0 -1
  1251. package/dist/client/transition-root.d.ts +0 -74
  1252. package/dist/client/transition-root.d.ts.map +0 -1
  1253. package/dist/client/use-navigation-pending.d.ts +0 -26
  1254. package/dist/client/use-navigation-pending.d.ts.map +0 -1
  1255. package/dist/client/use-params.d.ts +0 -92
  1256. package/dist/client/use-params.d.ts.map +0 -1
  1257. package/dist/content/index.d.ts +0 -11
  1258. package/dist/content/index.d.ts.map +0 -1
  1259. package/dist/content/index.js +0 -2
  1260. package/dist/plugins/cache-transform.d.ts +0 -36
  1261. package/dist/plugins/cache-transform.d.ts.map +0 -1
  1262. package/dist/plugins/dev-error-overlay.d.ts +0 -60
  1263. package/dist/plugins/dev-error-overlay.d.ts.map +0 -1
  1264. package/dist/plugins/dev-logs.d.ts.map +0 -1
  1265. package/dist/plugins/dynamic-transform.d.ts +0 -72
  1266. package/dist/plugins/dynamic-transform.d.ts.map +0 -1
  1267. package/dist/plugins/server-action-exports.d.ts +0 -26
  1268. package/dist/plugins/server-action-exports.d.ts.map +0 -1
  1269. package/dist/routing/status-file-lint.d.ts +0 -33
  1270. package/dist/routing/status-file-lint.d.ts.map +0 -1
  1271. package/dist/search-params/analyze.d.ts +0 -54
  1272. package/dist/search-params/analyze.d.ts.map +0 -1
  1273. package/dist/search-params/builtin-codecs.d.ts +0 -105
  1274. package/dist/search-params/builtin-codecs.d.ts.map +0 -1
  1275. package/dist/search-params/codecs.d.ts +0 -53
  1276. package/dist/search-params/codecs.d.ts.map +0 -1
  1277. package/dist/search-params/create.d.ts +0 -106
  1278. package/dist/search-params/create.d.ts.map +0 -1
  1279. package/dist/search-params/registry.d.ts +0 -20
  1280. package/dist/search-params/registry.d.ts.map +0 -1
  1281. package/dist/server/client-module-map.d.ts +0 -47
  1282. package/dist/server/client-module-map.d.ts.map +0 -1
  1283. package/dist/server/dev-fetch-instrumentation.d.ts +0 -22
  1284. package/dist/server/dev-fetch-instrumentation.d.ts.map +0 -1
  1285. package/dist/server/dev-logger.d.ts.map +0 -1
  1286. package/dist/server/dev-span-processor.d.ts +0 -29
  1287. package/dist/server/dev-span-processor.d.ts.map +0 -1
  1288. package/dist/server/dev-warnings.d.ts +0 -129
  1289. package/dist/server/dev-warnings.d.ts.map +0 -1
  1290. package/dist/server/flush.d.ts +0 -74
  1291. package/dist/server/flush.d.ts.map +0 -1
  1292. package/dist/server/manifest-status-resolver.d.ts +0 -58
  1293. package/dist/server/manifest-status-resolver.d.ts.map +0 -1
  1294. package/dist/server/prerender.d.ts +0 -77
  1295. package/dist/server/prerender.d.ts.map +0 -1
  1296. package/dist/server/tree-builder.d.ts +0 -126
  1297. package/dist/server/tree-builder.d.ts.map +0 -1
  1298. package/dist/utils/directive-parser.d.ts +0 -70
  1299. package/dist/utils/directive-parser.d.ts.map +0 -1
  1300. package/src/cache/register-cached-function.ts +0 -99
  1301. package/src/client/browser-entry.ts +0 -674
  1302. package/src/client/head.ts +0 -61
  1303. package/src/client/link-status-provider.tsx +0 -30
  1304. package/src/client/segment-merger.ts +0 -345
  1305. package/src/client/stale-reload.ts +0 -89
  1306. package/src/client/transition-root.tsx +0 -160
  1307. package/src/client/use-navigation-pending.ts +0 -38
  1308. package/src/client/use-params.ts +0 -141
  1309. package/src/content/index.ts +0 -13
  1310. package/src/plugins/cache-transform.ts +0 -199
  1311. package/src/plugins/dev-error-overlay.ts +0 -230
  1312. package/src/plugins/dynamic-transform.ts +0 -161
  1313. package/src/plugins/server-action-exports.ts +0 -220
  1314. package/src/routing/status-file-lint.ts +0 -112
  1315. package/src/search-params/analyze.ts +0 -192
  1316. package/src/search-params/builtin-codecs.ts +0 -228
  1317. package/src/search-params/codecs.ts +0 -153
  1318. package/src/search-params/create.ts +0 -321
  1319. package/src/search-params/registry.ts +0 -31
  1320. package/src/server/client-module-map.ts +0 -58
  1321. package/src/server/dev-fetch-instrumentation.ts +0 -96
  1322. package/src/server/dev-span-processor.ts +0 -78
  1323. package/src/server/dev-warnings.ts +0 -282
  1324. package/src/server/flush.ts +0 -182
  1325. package/src/server/manifest-status-resolver.ts +0 -215
  1326. package/src/server/prerender.ts +0 -139
  1327. package/src/server/tree-builder.ts +0 -382
  1328. package/src/shims/server-only-noop.js +0 -6
  1329. package/src/utils/directive-parser.ts +0 -529
@@ -0,0 +1,1771 @@
1
+ import { h as swallow } from "./logger-uLBuGKDI.js";
2
+ import { i as classifyMetadataRoute, n as treePathDepth, s as isDynamicMetadataExtension, t as computeSegmentTreePaths } from "./segment-keys-lqtdookO.js";
3
+ import { n as NULL_BYTE_RE, t as ENCODED_SEPARATOR_RE } from "./canonicalize-CgHoscYO.js";
4
+ import { i as DEFAULT_PAGE_EXTENSIONS, n as classifyUrlSegment, r as effectiveUrlSegment, t as classifySegment } from "./segment-classify-C539Pa2O.js";
5
+ import { basename, extname, join } from "node:path";
6
+ import { readdirSync, statSync } from "node:fs";
7
+ //#region src/server/tree-match.ts
8
+ /**
9
+ * Match URL path parts against a segment tree.
10
+ *
11
+ * Walks the tree depth-first with backtracking, applying priority
12
+ * ordering globally across group boundaries. Returns the matched
13
+ * segment chain and collected params, or null if no route matches.
14
+ *
15
+ * By default, a match requires a terminal node (one with `page` or
16
+ * `route`) at the leaf. Pass `{ requireTerminal: false }` to match
17
+ * any segment (used by metadata route matching).
18
+ *
19
+ * @param root The root segment node to start matching from.
20
+ * @param parts URL path parts (e.g. ['blog', 'hello-world']).
21
+ * Empty array matches the root itself (if terminal).
22
+ */
23
+ function matchUrlParts(root, parts, options) {
24
+ const chain = [];
25
+ const params = {};
26
+ if (matchNode(root, parts, 0, chain, params, options?.requireTerminal ?? true)) return {
27
+ chain,
28
+ params
29
+ };
30
+ return null;
31
+ }
32
+ /**
33
+ * Flatten children through group segments.
34
+ *
35
+ * Groups are transparent for URL matching — their non-group descendants
36
+ * are returned with the chain of group nodes leading to them. This lets
37
+ * the caller apply priority ordering (static > dynamic > catch-all >
38
+ * optional-catch-all) across all groups uniformly instead of per-group.
39
+ */
40
+ function collectEffectiveChildren(node, groupChain = []) {
41
+ const result = [];
42
+ for (const child of node.children) if (child.segmentType === "group") {
43
+ const nested = collectEffectiveChildren(child, [...groupChain, child]);
44
+ result.push(...nested);
45
+ } else result.push({
46
+ child,
47
+ groupChain
48
+ });
49
+ return result;
50
+ }
51
+ /** A node is terminal if it can serve a response (has a page or route handler). */
52
+ function isTerminal(node) {
53
+ return !!(node.page || node.route);
54
+ }
55
+ /** Combined affix length for specificity ordering. */
56
+ function affixLength(node) {
57
+ return (node.paramPrefix?.length ?? 0) + (node.paramSuffix?.length ?? 0);
58
+ }
59
+ /**
60
+ * Recursive depth-first matcher with backtracking.
61
+ *
62
+ * Mutates `chain` and `params` in place for performance; backtracks
63
+ * (restores previous state) when a candidate doesn't lead to a match.
64
+ */
65
+ function matchNode(node, parts, index, chain, params, requireTerminal) {
66
+ chain.push(node);
67
+ if (index >= parts.length) {
68
+ if (!requireTerminal || isTerminal(node)) return true;
69
+ for (const child of node.children) if (child.segmentType === "group") {
70
+ if (matchNode(child, parts, index, chain, params, requireTerminal)) return true;
71
+ }
72
+ const effective = collectEffectiveChildren(node);
73
+ for (const { child, groupChain } of effective) if (child.segmentType === "optional-catch-all" && (!requireTerminal || isTerminal(child))) {
74
+ chain.push(...groupChain, child);
75
+ return true;
76
+ }
77
+ chain.pop();
78
+ return false;
79
+ }
80
+ const part = parts[index];
81
+ const effective = collectEffectiveChildren(node);
82
+ for (const { child, groupChain } of effective) if (child.segmentType === "static" && child.segmentName === part) {
83
+ chain.push(...groupChain);
84
+ if (matchNode(child, parts, index + 1, chain, params, requireTerminal)) return true;
85
+ chain.length -= groupChain.length;
86
+ }
87
+ const affixed = effective.filter(({ child }) => child.segmentType === "dynamic" && child.paramName && (child.paramPrefix || child.paramSuffix));
88
+ affixed.sort((a, b) => affixLength(b.child) - affixLength(a.child));
89
+ for (const { child, groupChain } of affixed) {
90
+ const prefix = child.paramPrefix ?? "";
91
+ const suffix = child.paramSuffix ?? "";
92
+ if (part.length > prefix.length + suffix.length && (!prefix || part.startsWith(prefix)) && (!suffix || part.endsWith(suffix))) {
93
+ const value = part.slice(prefix.length, part.length - (suffix.length || 0));
94
+ chain.push(...groupChain);
95
+ const prev = params[child.paramName];
96
+ params[child.paramName] = value;
97
+ if (matchNode(child, parts, index + 1, chain, params, requireTerminal)) return true;
98
+ chain.length -= groupChain.length;
99
+ if (prev !== void 0) params[child.paramName] = prev;
100
+ else delete params[child.paramName];
101
+ }
102
+ }
103
+ for (const { child, groupChain } of effective) if (child.segmentType === "dynamic" && child.paramName && !child.paramPrefix && !child.paramSuffix) {
104
+ chain.push(...groupChain);
105
+ const prev = params[child.paramName];
106
+ params[child.paramName] = part;
107
+ if (matchNode(child, parts, index + 1, chain, params, requireTerminal)) return true;
108
+ chain.length -= groupChain.length;
109
+ if (prev !== void 0) params[child.paramName] = prev;
110
+ else delete params[child.paramName];
111
+ }
112
+ for (const { child, groupChain } of effective) if (child.segmentType === "catch-all" && child.paramName && (!requireTerminal || isTerminal(child))) {
113
+ chain.push(...groupChain, child);
114
+ params[child.paramName] = parts.slice(index);
115
+ return true;
116
+ }
117
+ for (const { child, groupChain } of effective) if (child.segmentType === "optional-catch-all" && child.paramName && (!requireTerminal || isTerminal(child))) {
118
+ chain.push(...groupChain, child);
119
+ params[child.paramName] = parts.slice(index);
120
+ return true;
121
+ }
122
+ chain.pop();
123
+ return false;
124
+ }
125
+ //#endregion
126
+ //#region src/routing/collision-probe.ts
127
+ /**
128
+ * Find a URL in this collision space whose winner depends on `children` order,
129
+ * or null if every probed URL resolves the same way in both orderings.
130
+ *
131
+ * `spaceRoot` is the node `matchUrlParts` starts from — the app root, a slot
132
+ * node, or an intercepting directory. `base` is the URL that root sits at, used
133
+ * only to render the reported URL.
134
+ */
135
+ function findOrderDependentCollision(spaceRoot, leaves, base) {
136
+ const reversed = withReversedChildren(spaceRoot);
137
+ const longTail = longTailLength(spaceRoot) + 1;
138
+ const minLength = longestStaticName(spaceRoot);
139
+ const seen = /* @__PURE__ */ new Set();
140
+ for (const leaf of leaves) for (const { parts, display } of probeUrlsForLeaf(spaceRoot, reversed, leaf, longTail, minLength)) {
141
+ const key = parts.join("/");
142
+ if (seen.has(key)) continue;
143
+ seen.add(key);
144
+ const first = matchedLeafFile(spaceRoot, parts);
145
+ const second = matchedLeafFile(reversed, parts);
146
+ if (!first || !second || first === second) continue;
147
+ return {
148
+ url: describeProbeUrl(base, display),
149
+ first,
150
+ second
151
+ };
152
+ }
153
+ return null;
154
+ }
155
+ /** Join a probe's display parts onto its space's base. */
156
+ function describeProbeUrl(base, display) {
157
+ if (display.length === 0) return base || "/";
158
+ return `${base === "/" ? "" : base}/${display.join("/")}`;
159
+ }
160
+ /**
161
+ * The file `matchUrlParts` resolves for a URL, or null if nothing does.
162
+ *
163
+ * A `route.ts` counts: `isTerminal` accepts either, so a route handler is a
164
+ * legitimate winner of the walk and an ambiguity between a page and a route
165
+ * handler is as real as one between two pages.
166
+ */
167
+ function matchedLeafFile(node, parts) {
168
+ const match = matchUrlParts(node, parts);
169
+ if (!match) return null;
170
+ const leaf = match.chain[match.chain.length - 1];
171
+ return leaf.page?.filePath ?? leaf.route?.filePath ?? null;
172
+ }
173
+ /**
174
+ * The values a probe's dynamic parts are tried with, in order.
175
+ *
176
+ * A probe stands in for "any value" at a dynamic position, so it is only useful
177
+ * if it reaches the leaf it was built for. A *static* sibling's literal name or
178
+ * a more specific *affixed* sibling's pattern can claim it instead, and that
179
+ * higher-priority segment then wins in both orderings — a genuine tie
180
+ * underneath goes unreported, which is safe but is the whole thing these
181
+ * validators are for.
182
+ *
183
+ * Which values are claimable is a question about `matchNode`'s precedence, so
184
+ * `probeUrlsForLeaf` asks `matchUrlParts` rather than deciding it here. This
185
+ * only has to offer enough shapes for the search to find one that works: an
186
+ * affixed sibling constrains the head of the value, its tail, or both, so head
187
+ * and tail are varied over an alphanumeric alphabet. The head varies fastest
188
+ * because a prefix is the more common affix. Exhausting the list is a missed
189
+ * collision like any other inadequate probe, so this is a search and not a
190
+ * proof — nothing downstream may treat it as one.
191
+ *
192
+ * Exported so a test that has to *name* a capturing static sibling can derive
193
+ * the name from this list rather than restate it — a fixture spelling the value
194
+ * out by hand stops being a capture the moment the list changes, and passes.
195
+ *
196
+ * Three revisions of a hand-built value each dodged one more capture and were
197
+ * each followed by another (avoid static names; avoid affix boundary
198
+ * characters; avoid re-affixed forms of static names — then a strictly more
199
+ * specific affixed sibling, TIM-1313). Each rule was modelling affix precedence
200
+ * by hand, which is what the match-shape model was deleted for.
201
+ */
202
+ function* probeCandidates(minLength = 0) {
203
+ const alphabet = "abcdefghijklmnopqrstuvwxyz0123456789";
204
+ const base = "timber-probe";
205
+ function* wave(core) {
206
+ for (const tail of alphabet) for (const head of alphabet) yield `${head}${core}${tail}`;
207
+ }
208
+ yield* wave(base);
209
+ const padded = base.padEnd(Math.max(12, minLength), "x");
210
+ if (padded !== base) yield* wave(padded);
211
+ }
212
+ /**
213
+ * The longest static segment name anywhere in the space.
214
+ *
215
+ * Read through `effectiveUrlSegment` so an intercepting directory counts as the
216
+ * segment it intercepts, and only static kinds count: a dynamic sibling claims
217
+ * a probe by pattern rather than by equality, which no length can escape.
218
+ */
219
+ function longestStaticName(node) {
220
+ let longest = 0;
221
+ for (const child of node.children) {
222
+ const seg = effectiveUrlSegment(child);
223
+ if (seg.segmentType === "static") longest = Math.max(longest, seg.segmentName.length);
224
+ longest = Math.max(longest, longestStaticName(child));
225
+ }
226
+ return longest;
227
+ }
228
+ /**
229
+ * The probe URLs for one leaf, built from the first candidate value that
230
+ * actually reaches it.
231
+ *
232
+ * "Reaches it" is `matchUrlParts` resolving one of the leaf's own URLs to the
233
+ * leaf's file, in either ordering — either is enough, because a leaf that wins
234
+ * only in the reversed ordering is precisely the contention being looked for.
235
+ * A catch-all leaf may be reached by its long probe and not its short one (at
236
+ * one part it loses to a bare dynamic sibling deterministically), so any one of
237
+ * the generated URLs landing is enough to accept the value.
238
+ *
239
+ * A leaf that no candidate reaches is shadowed at its position for every value
240
+ * tried — most often because it sits below a catch-all, which `matchNode`
241
+ * accepts only as a terminal and never descends past. Its probes are still
242
+ * emitted, from the first candidate: a probe that misses its own leaf is never
243
+ * *wrong* — it is a real URL, and a winner that differs between the two
244
+ * orderings is a real ambiguity whichever leaf it belongs to. Nothing here may
245
+ * report the leaf as unreachable; that is the universal claim these validators
246
+ * do not make.
247
+ */
248
+ function probeUrlsForLeaf(root, reversed, leaf, longTail, minLength) {
249
+ let fallback = null;
250
+ for (const value of probeCandidates(minLength)) {
251
+ const urls = probeUrlsFor(leaf.chain, value, longTail);
252
+ if (urls.some(({ parts }) => matchedLeafFile(root, parts) === leaf.filePath || matchedLeafFile(reversed, parts) === leaf.filePath)) return urls;
253
+ fallback ??= urls;
254
+ if (!urls.some(({ dynamic }) => dynamic)) break;
255
+ }
256
+ return fallback ?? [];
257
+ }
258
+ /**
259
+ * The URL part one segment contributes to a probe.
260
+ *
261
+ * A dynamic segment stands for any single value, so it contributes the
262
+ * candidate value — re-affixed, since an affixed segment only matches parts
263
+ * that carry its prefix and suffix, so a probe without them could not reach it.
264
+ * A catch-all stands for one or more parts, and one is enough to reach the leaf.
265
+ *
266
+ * The re-affixed part is the reason a value cannot be checked once for the
267
+ * whole space: it exposes the value to every affixed sibling that *extends*
268
+ * this segment's affixes, which differs per position. `probeUrlsForLeaf` asks
269
+ * the matcher whether the assembled URL reaches its leaf, and moves to the next
270
+ * candidate when it does not.
271
+ *
272
+ * Segments are read through `effectiveUrlSegment` so an intercepting directory
273
+ * contributes the part the segment it intercepts would.
274
+ */
275
+ function probePartFor(node, value) {
276
+ const seg = effectiveUrlSegment(node);
277
+ switch (seg.segmentType) {
278
+ case "dynamic": {
279
+ const prefix = seg.paramPrefix ?? "";
280
+ const suffix = seg.paramSuffix ?? "";
281
+ return {
282
+ part: `${prefix}${value}${suffix}`,
283
+ shown: `${prefix}<any>${suffix}`,
284
+ dynamic: true
285
+ };
286
+ }
287
+ case "catch-all":
288
+ case "optional-catch-all": return {
289
+ part: value,
290
+ shown: "<any>",
291
+ dynamic: true
292
+ };
293
+ default: return {
294
+ part: seg.segmentName,
295
+ shown: seg.segmentName,
296
+ dynamic: false
297
+ };
298
+ }
299
+ }
300
+ /**
301
+ * The URLs that reach a leaf.
302
+ *
303
+ * An **optional catch-all also matches zero parts**, so it answers the URL its
304
+ * parent sits at as well as longer ones. Both are probed: whether the shorter
305
+ * one is actually *its* to answer is `matchUrlParts`' business, not something
306
+ * to decide here — a page above it, or in a route group beside it, may take
307
+ * that URL deterministically, and the probe will simply report the same winner
308
+ * in both orderings.
309
+ */
310
+ function probeUrlsFor(chain, value, longTail) {
311
+ const probeParts = chain.map((node) => probePartFor(node, value));
312
+ const url = (ps) => ({
313
+ parts: ps.map((p) => p.part),
314
+ display: ps.map((p) => p.shown),
315
+ dynamic: ps.some((p) => p.dynamic)
316
+ });
317
+ const leaf = chain[chain.length - 1];
318
+ const kind = leaf && effectiveUrlSegment(leaf).segmentType;
319
+ if (!(kind === "catch-all" || kind === "optional-catch-all")) return [url(probeParts)];
320
+ const head = probeParts.slice(0, -1);
321
+ const urls = [url(probeParts)];
322
+ if (longTail > 1) {
323
+ const tail = Array.from({ length: longTail }, () => ({
324
+ part: value,
325
+ shown: "<any>",
326
+ dynamic: true
327
+ }));
328
+ urls.push(url([...head, ...tail]));
329
+ }
330
+ if (kind === "optional-catch-all") urls.push(url(head));
331
+ return urls;
332
+ }
333
+ /**
334
+ * One more than the longest fixed-length path in the space.
335
+ *
336
+ * A probe of this length cannot be claimed by any branch that consumes a fixed
337
+ * number of URL parts, so whatever matches it is a catch-all — which is
338
+ * exactly the competition a short probe hides.
339
+ */
340
+ function longTailLength(node) {
341
+ let deepest = 0;
342
+ for (const child of node.children) {
343
+ const own = child.segmentType === "group" ? 0 : 1;
344
+ deepest = Math.max(deepest, own + longTailLength(child));
345
+ }
346
+ return deepest;
347
+ }
348
+ /**
349
+ * The subtree with every `children` array reversed, top to bottom.
350
+ *
351
+ * Nodes are shallow-copied, so files and slots are shared with the original —
352
+ * only the ordering `matchNode` reads is different. Slots are not reversed
353
+ * because `matchNode` never walks them; each slot is validated as its own
354
+ * collision space, with its own reversed clone.
355
+ */
356
+ function withReversedChildren(node) {
357
+ return {
358
+ ...node,
359
+ children: [...node.children].reverse().map(withReversedChildren)
360
+ };
361
+ }
362
+ //#endregion
363
+ //#region src/routing/interception-overlap.ts
364
+ /**
365
+ * Pattern intersection for intercepted URL patterns.
366
+ *
367
+ * Checks whether two intercepted URL patterns can both match the same concrete
368
+ * URL. Used by the cross-mode claim check (TIM-1319) to detect when a
369
+ * children-path interceptor and a slot interceptor from the same owner overlap.
370
+ *
371
+ * This is not the order-dependence oracle (`findOrderDependentCollision`) the
372
+ * within-mode collision checks use. `findInterceptionMatch` picks the mode by
373
+ * first-match on `pathnameMatchesPattern`, which has no priority tiers, so a
374
+ * static `/feed/foo` and a dynamic `/feed/[id]` both match `/feed/foo` even
375
+ * though `matchUrlParts` would resolve the static deterministically. The
376
+ * intersection test catches that: it walks both patterns segment by segment and
377
+ * asks whether any value satisfies both.
378
+ *
379
+ * This is not a model of `matchNode` precedence — that decides *which*
380
+ * candidate wins when several match one URL. This decides the prior question:
381
+ * *do* they both match one URL at all? The two questions are independent, and
382
+ * conflating them is what caused TIM-1308's five-round drift.
383
+ */
384
+ /**
385
+ * Check whether two intercepted URL patterns can both match the same concrete
386
+ * URL. Returns a display string for the overlapping URL, or null.
387
+ *
388
+ * Walks both patterns segment by segment:
389
+ * - Two statics: must be identical.
390
+ * - Static + dynamic: static must satisfy the dynamic's affix constraints.
391
+ * - Two dynamics: affix constraints must be compatible.
392
+ * - A catch-all at either side: compatible with everything remaining.
393
+ *
394
+ * If the patterns differ in length, they can only overlap if the longer one's
395
+ * extra part is an optional catch-all (which also matches zero segments).
396
+ */
397
+ function interceptedPatternsOverlap(p1, p2) {
398
+ if (p1 === p2) return p1;
399
+ const parts1 = p1 === "/" ? [] : p1.slice(1).split("/");
400
+ const parts2 = p2 === "/" ? [] : p2.slice(1).split("/");
401
+ const display = [];
402
+ let i = 0;
403
+ while (i < parts1.length && i < parts2.length) {
404
+ const seg1 = classifyUrlSegment(parts1[i]);
405
+ const seg2 = classifyUrlSegment(parts2[i]);
406
+ if (seg1.kind === "catch-all" || seg1.kind === "optional-catch-all" || seg2.kind === "catch-all" || seg2.kind === "optional-catch-all") {
407
+ display.push("<any>");
408
+ return "/" + display.join("/");
409
+ }
410
+ const part = segmentsOverlap(seg1, seg2);
411
+ if (part === null) return null;
412
+ display.push(part);
413
+ i++;
414
+ }
415
+ const remaining = i < parts1.length ? parts1 : i < parts2.length ? parts2 : null;
416
+ if (remaining) {
417
+ if (classifyUrlSegment(remaining[i]).kind !== "optional-catch-all") return null;
418
+ }
419
+ return display.length === 0 ? "/" : "/" + display.join("/");
420
+ }
421
+ /**
422
+ * Can some concrete value satisfy both classified URL segments?
423
+ *
424
+ * An affixed dynamic (`a-[id].png`) constrains both the prefix and suffix of
425
+ * the value, so a static segment must satisfy those constraints and two
426
+ * dynamics must have compatible affixes — prefixes where one extends the other,
427
+ * and likewise for suffixes. Without this check, `/feed/photo.jpg` beside
428
+ * `/feed/asset-[id].png` would be falsely rejected.
429
+ */
430
+ function segmentsOverlap(seg1, seg2) {
431
+ if (seg1.kind === "static" && seg2.kind === "static") return seg1.value === seg2.value ? seg1.value : null;
432
+ if (seg1.kind === "static" && seg2.kind === "dynamic") return staticMatchesAffix(seg1.value, seg2) ? seg1.value : null;
433
+ if (seg2.kind === "static" && seg1.kind === "dynamic") return staticMatchesAffix(seg2.value, seg1) ? seg2.value : null;
434
+ if (seg1.kind === "dynamic" && seg2.kind === "dynamic") return dynamicAffixesCompatible(seg1, seg2) ? "<any>" : null;
435
+ return "<any>";
436
+ }
437
+ /**
438
+ * Does a static value satisfy an affixed dynamic's prefix, suffix, and
439
+ * non-empty capture constraints?
440
+ *
441
+ * Mirrors the check `pathnameMatchesPattern` applies: the value must start with
442
+ * the prefix, end with the suffix, and be strictly longer than their combined
443
+ * length (a capture of zero characters is not a match).
444
+ */
445
+ function staticMatchesAffix(value, dynamic) {
446
+ const prefix = dynamic.prefix ?? "";
447
+ const suffix = dynamic.suffix ?? "";
448
+ if (!prefix && !suffix) return true;
449
+ if (prefix && !value.startsWith(prefix)) return false;
450
+ if (suffix && !value.endsWith(suffix)) return false;
451
+ return value.length > prefix.length + suffix.length;
452
+ }
453
+ /**
454
+ * Can some value simultaneously satisfy two affixed dynamics?
455
+ *
456
+ * Two prefix constraints are compatible when one extends the other (a value
457
+ * starting with the longer one also starts with the shorter). Suffixes are
458
+ * analogous. Without affixes on either side, every value works.
459
+ */
460
+ function dynamicAffixesCompatible(d1, d2) {
461
+ const p1 = d1.prefix ?? "", s1 = d1.suffix ?? "";
462
+ const p2 = d2.prefix ?? "", s2 = d2.suffix ?? "";
463
+ if (p1 && p2 && !p1.startsWith(p2) && !p2.startsWith(p1)) return false;
464
+ if (s1 && s2 && !s1.endsWith(s2) && !s2.endsWith(s1)) return false;
465
+ return true;
466
+ }
467
+ //#endregion
468
+ //#region src/routing/interception.ts
469
+ /**
470
+ * Group an owner's intercepting children by the URL position they contend for.
471
+ *
472
+ * This is the definition of *which interceptors compete*, and it has exactly
473
+ * one caller shape on each side of the build: `findInterceptingMatch` resolves
474
+ * a group with one `matchUrlParts` walk, and
475
+ * `assertNoInterceptedPatternCollisions` validates the same group as one
476
+ * collision space. Written twice, the two would be free to disagree about what
477
+ * competes — and a resolver that walks a wider set than the validator checked
478
+ * is precisely the order-dependence the validator exists to reject (TIM-1310).
479
+ *
480
+ * Contention is keyed by the computed intercepted **base**, not by the marker:
481
+ * under an owner at `/feed`, `(..)` and `(...)` both base at `/` and are both
482
+ * matched at index 0, so they are one group. Different bases are different
483
+ * positions — a `(.)` interceptor can never claim a target that belongs to a
484
+ * `(..)` one beside it, because the base must also match the target's leading
485
+ * parts.
486
+ *
487
+ * The base is a URL *pattern*, so its length is its part count only because
488
+ * every pattern part stands for exactly one URL part. A catch-all in the base
489
+ * breaks that, and `assertInterceptedBaseIsCountable` rejects the shape at
490
+ * build time.
491
+ *
492
+ * A node missing either marker field is skipped, which `classifySegment` never
493
+ * produces — it sets both whenever it reports `'intercepting'`. Stating the
494
+ * filter here rather than defaulting the marker is what makes the validator and
495
+ * the resolver see the same set: such a node renders nothing either way, and a
496
+ * validator more permissive than the resolver would be checking a candidate
497
+ * that never competes while the resolver walks one nobody checked.
498
+ *
499
+ * `children` is read directly rather than flattened through route groups,
500
+ * matching both resolvers: the slot resolver reads `slotNode.children`, and an
501
+ * interceptor deeper inside a slot subtree is rejected by
502
+ * `validateInterceptionPlacement`. On the children path an interceptor under a
503
+ * route group is legal and the *group* is its owner, so it is grouped with that
504
+ * group's other interceptors — which is again exactly what the resolver walks,
505
+ * since it resolves the owner by tree path.
506
+ */
507
+ function groupByInterceptedAnchor(ownerUrlPath, children) {
508
+ const byBase = /* @__PURE__ */ new Map();
509
+ for (const child of children) {
510
+ if (child.segmentType !== "intercepting") continue;
511
+ if (!child.interceptionMarker || !child.interceptedSegmentName) continue;
512
+ const base = computeInterceptedBase(ownerUrlPath, child.interceptionMarker);
513
+ const group = byBase.get(base);
514
+ if (group) group.interceptors.push(child);
515
+ else byBase.set(base, {
516
+ base,
517
+ anchorIndex: base === "/" ? 0 : base.slice(1).split("/").length,
518
+ interceptors: [child]
519
+ });
520
+ }
521
+ return [...byBase.values()].sort((a, b) => b.anchorIndex - a.anchorIndex);
522
+ }
523
+ /**
524
+ * Collect all interception rewrite rules from the route tree.
525
+ *
526
+ * Walks the tree recursively. For each intercepting segment, computes the
527
+ * intercepted URL based on the marker and the segment's position.
528
+ *
529
+ * The list is returned **deepest scope first**, which is what makes
530
+ * `findInterceptionMatch`'s first-match rule deterministic; see
531
+ * `sortByScopeDepth`.
532
+ */
533
+ function collectInterceptionRewrites(root) {
534
+ const rewrites = [];
535
+ walkForInterceptions(root, [root], false, rewrites);
536
+ return sortByScopeDepth(rewrites);
537
+ }
538
+ /**
539
+ * Order the rewrites deepest scope first, so the request-time first-match rule
540
+ * resolves two applicable rewrites by *nesting* rather than by tree-walk order.
541
+ *
542
+ * `findInterceptionMatch` returns the first rewrite whose pattern matches the
543
+ * target and whose scope the source route reports. More than one can satisfy
544
+ * both, and the case is not exotic — an owner and a directory *beneath* it may
545
+ * each hold an interceptor for one URL:
546
+ *
547
+ * ```
548
+ * app/feed/(.)photo/page.tsx scope /feed
549
+ * app/feed/(a)/(.)photo/page.tsx scope /feed/(a)
550
+ * ```
551
+ *
552
+ * A page inside `(a)` renders both owners' layouts, so the client reports both
553
+ * tree paths and both scopes pass. Unsorted, the winner is whichever the
554
+ * filesystem enumerated first — renaming the group flips which page a click
555
+ * opens, the defect class TIM-1305/TIM-1308/TIM-1310 each rejected in a
556
+ * different space. Here it is an ambiguity between *rewrites* rather than
557
+ * between pages inside one walk, so no collision space sees it.
558
+ *
559
+ * **Deepest wins, and it is specified rather than rejected** because the shape
560
+ * is one a correct app writes on purpose: a nested layout refining the
561
+ * interception its parent declares, exactly as `groupByInterceptedAnchor`
562
+ * already prefers the deepest *anchor* within one owner. The two rules are the
563
+ * same preference — the more local interception is the author's more specific
564
+ * statement — applied at the two levels the mechanism has.
565
+ *
566
+ * Depth is counted on the **tree path**, the identity that never collapses
567
+ * (TIM-1279/TIM-1280); a `urlPath` prefix test would relate `(browse)` and
568
+ * `(landing)`, which render different layouts and share no chain. Two scopes on
569
+ * one rendered chain are strictly nested, so depth orders them totally, and two
570
+ * scopes that are *not* on one chain — sibling groups, `feed/(a)` beside
571
+ * `feed/(b)` — never both pass the scope check, so their relative order is not
572
+ * observable. That is why this sorts on depth alone rather than testing
573
+ * ancestry: it is a total order over the pairs that can compete, and it costs
574
+ * nothing per request.
575
+ *
576
+ * Sorting is stable, so rewrites sharing one scope keep tree-walk order. Equal
577
+ * scopes mean one owner, and of the three pairings that produces only one was
578
+ * ambiguous — a children-path interceptor beside a slot one — and that is now
579
+ * rejected at build time by `assertNoCrossModeClaims` (TIM-1319). The
580
+ * enumeration is in design/07-routing.md §"Selection Between Owners" rather
581
+ * than repeated here, so there is one place to correct if a rewrite ever grows
582
+ * a field that makes two of them distinguishable.
583
+ */
584
+ function sortByScopeDepth(rewrites) {
585
+ return rewrites.sort((a, b) => treePathDepth(b.interceptingScope) - treePathDepth(a.interceptingScope));
586
+ }
587
+ /**
588
+ * Validate that every intercepting segment sits where it can actually render.
589
+ *
590
+ * There are exactly two positions a renderer exists for, and they are the two
591
+ * shapes interception has:
592
+ *
593
+ * 1. **Direct child of a parallel slot** — the modal overlay. The slot
594
+ * resolver scans a slot node's *direct children* for an intercepting
595
+ * segment (`server/slot-interception.ts`). Nothing between the slot and
596
+ * the intercepting directory is allowed, because nothing walks it.
597
+ * 2. **Direct child of an ordinary segment or route group** — the sibling
598
+ * layout swap (TIM-1280). The pipeline resolves the owner by tree path and
599
+ * builds the rendered chain through the intercepting node itself
600
+ * (`server/children-interception.ts`).
601
+ *
602
+ * Everywhere else, rewrite generation still emits a rewrite and nothing
603
+ * renders it: the rewrite matches the soft navigation, and the user is served
604
+ * the page they were already on under a changed URL (TIM-1278). The rejected
605
+ * positions are:
606
+ *
607
+ * - **Inside a slot subtree but not directly under the slot**
608
+ * (`@modal/(inner)/(.)photo`). Neither renderer applies: the slot resolver
609
+ * only reads direct children, and the children-path resolver builds a
610
+ * *chain*, which cannot express a descent through a slot.
611
+ * - **Inside another intercepting subtree** (`(.)a/(.)b`). Left unvalidated
612
+ * `collectLeavesWithRewrites` walks the inner one as an ordinary URL
613
+ * segment and emits a pattern containing a literal "(.)b".
614
+ *
615
+ * Two further shapes are rejected here (TIM-1288). Both are about a catch-all,
616
+ * and both are specific to interception: elsewhere in the tree the same
617
+ * shapes are inert or fail safely, and the general "nothing below a catch-all
618
+ * is reachable" rule is tracked as TIM-1286.
619
+ *
620
+ * And one is specific to the children path: an owner chain that binds params
621
+ * (see `assertOwnerChainBindsNoParams`).
622
+ */
623
+ function validateInterceptionPlacement(root) {
624
+ walkForPlacement(root, "", {
625
+ parentIsSlot: false,
626
+ inSlotSubtree: false,
627
+ inInterceptingSubtree: false,
628
+ ancestorsBindParams: false
629
+ });
630
+ }
631
+ /**
632
+ * Reject a children-path interception whose owner chain binds params.
633
+ *
634
+ * The rendered chain is `[…owner ancestors, interceptingNode, …descendants]`,
635
+ * and the only pathname available to bind params from is the **target** — the
636
+ * URL being navigated to. The intercepting subtree's own params come from it
637
+ * by construction. The owner chain's do not, in general:
638
+ *
639
+ * - With a climbing marker the owner's URL segments are not in the target at
640
+ * all. `app/[team]/(..)photo/[id]` bases at "/", so the target is
641
+ * `/photo/9` — there is no team value anywhere in it, and `[team]`'s layout
642
+ * would render with the param it declares missing.
643
+ * - With `(.)` the base *is* the owner's `urlPath`, so the target's leading
644
+ * parts would bind it. Supporting only that half means one marker behaves
645
+ * differently from its siblings for reasons the author cannot see from the
646
+ * directory names, so the rule is stated once, on the owner chain.
647
+ *
648
+ * A layout that silently renders without the param it declares is the failure
649
+ * this prevents; it is rejected where it can be explained rather than left to
650
+ * surface as `undefined` deep inside user code. Route groups and static
651
+ * segments bind nothing and are unrestricted, which is the whole motivating
652
+ * shape (`app/(browse)/(...)[artistSlug]/…`).
653
+ *
654
+ * The rule stops at a slot boundary: a slot-mode interception re-matches the
655
+ * *source* route, which supplies the owner's params, so a dynamic owner is
656
+ * fine there and always has been.
657
+ */
658
+ /**
659
+ * Require a children-path interception's owner to have a `layout.tsx`.
660
+ *
661
+ * The scope is the owner's tree path, and the client reports which tree paths
662
+ * it has mounted from `X-Timber-Segments` — which carries **one entry per
663
+ * layout-bearing segment**, because those are the segments the client needs an
664
+ * outlet and a cache node for. `buildSegmentInfo` skips the rest.
665
+ *
666
+ * For the modal shape that set is exactly the set of possible scope owners, by
667
+ * construction: a slot is only resolved inside a rendering layout
668
+ * (`route-element-builder.ts`), so a layoutless segment can never own one. A
669
+ * children-path interception broke that equivalence — its owner is an ordinary
670
+ * directory and needs no layout.
671
+ *
672
+ * Left unchecked the result is a swap that works exactly once: the first soft
673
+ * navigation renders, then the client reports no such tree path, and the next
674
+ * navigation fails the scope check and falls back to the canonical page. That
675
+ * is fail-safe but silent, and the address-bar channel cannot recover it —
676
+ * once the swap is on screen the address holds the *intercepted* URL, which
677
+ * re-matches the canonical chain (the TIM-1282 problem, in the one shape the
678
+ * rendered-scope fix does not reach).
679
+ *
680
+ * Requiring the layout restores the invariant the state tree is built on
681
+ * rather than widening the wire format to carry segments that own no outlet
682
+ * and no payload. It also costs the author nothing they were not already
683
+ * doing: the point of this shape is to render inside the owner's own layout,
684
+ * so an owner with no layout has no chrome to preserve.
685
+ */
686
+ function assertOwnerHasLayout(ownerPath, childPath) {
687
+ const owner = ownerPath || "(app root)";
688
+ throw new Error(`Build error: intercepting route whose owner has no layout.\n Directory: app/${childPath}\n Owner: app/${owner}\nAn intercepting directory outside a parallel slot renders inside its owner's layout chain, and the owner must have a layout.tsx: the client reports which directories it has mounted from its layout segments, and a scope it cannot report would let the interception fire once and then silently stop.\nAdd app/${owner}/layout.tsx (a pass-through returning {children} is enough), or move the interception under a directory that has one.\nSee design/07-routing.md §"Intercepting Routes".`);
689
+ }
690
+ function assertOwnerChainBindsNoParams(childPath, marker) {
691
+ throw new Error(`Build error: intercepting route under a dynamic segment.\n Directory: app/${childPath}\nAn intercepting directory outside a parallel slot renders inside its own layout chain, and the only pathname available to bind params from is the intercepted URL — which does not carry the values of the segments above "${marker}".\nMove the interception so every directory above it is a static segment or a route group, or place it inside a parallel slot (@modal/) to render it as an overlay over the source route instead.\nSee design/07-routing.md §"Intercepting Routes".`);
692
+ }
693
+ /**
694
+ * Reject an intercepting route whose intercepted level is not well-defined.
695
+ *
696
+ * "One level up" is counted in URL segments, which works because every
697
+ * pattern part stands for exactly one URL part — except a catch-all, which
698
+ * stands for a number that varies per request. `anchorIndex` fixes the anchor
699
+ * at the base's pattern length, so with an owner at `/docs/[...path]` the
700
+ * interception resolves when the catch-all consumed exactly one segment
701
+ * (`/docs/a/photo/5`) and is dropped when it consumed more
702
+ * (`/docs/a/b/photo/5`), because the base no longer matches the target's
703
+ * leading parts.
704
+ *
705
+ * Dropping is fail-safe — the canonical route renders, as on hard navigation
706
+ * — so this is never a wrong page. But it is a modal that opens at one depth
707
+ * and silently does not at another, with nothing to tell the author why, and
708
+ * no request-time input can fix it: the only available source depth is
709
+ * `X-Timber-URL`, which is the browser's address bar, and once a modal is
710
+ * open that holds the *intercepted* URL rather than the source.
711
+ *
712
+ * So the shape is rejected where it can be explained. A marker that climbs
713
+ * *past* the catch-all is fine — `(..)` from `/docs/[...path]` bases at
714
+ * `/docs` — and so is `(...)`, which always bases at the root. The rule is on
715
+ * the *computed* base, not on having a catch-all anywhere above.
716
+ */
717
+ function assertInterceptedBaseIsCountable(child, ownerUrlPath, childPath) {
718
+ const marker = child.interceptionMarker ?? "(.)";
719
+ const base = computeInterceptedBase(ownerUrlPath, marker);
720
+ const ambiguous = (base === "/" ? [] : base.slice(1).split("/")).find((part) => {
721
+ const kind = classifyUrlSegment(part).kind;
722
+ return kind === "catch-all" || kind === "optional-catch-all";
723
+ });
724
+ if (!ambiguous) return;
725
+ throw new Error(`Build error: intercepting route below a catch-all segment.\n Directory: app/${childPath}\n Intercepted base: ${base}\nA catch-all (${ambiguous}) matches a number of URL segments that varies per request, so "${marker}" cannot identify which segment of a target pathname the interception starts at — the modal would open at one depth and silently not at another.\nMove the interception above the catch-all, or use a marker that climbs past it ((..) or (...)).\nSee design/07-routing.md §"Intercepting Routes".`);
726
+ }
727
+ /**
728
+ * Reject a catch-all inside an intercepting subtree that has directories
729
+ * below it.
730
+ *
731
+ * A catch-all consumes the whole remaining path, so nothing under it is
732
+ * reachable — `matchUrlParts` only accepts a catch-all as a terminal leaf and
733
+ * never descends past one. Rewrite generation is not so strict: it walks the
734
+ * subtree and emits `/feed/[...rest]/child`, and `pathnameMatchesPattern`
735
+ * returns as soon as it reaches the catch-all without ever looking at
736
+ * `child`. So the rewrite matches the navigation and then no renderer exists
737
+ * — the TIM-1278 failure mode reached by a different route, with the user
738
+ * served the page they were already on under a changed URL.
739
+ *
740
+ * The check covers the whole intercepting subtree, not just the intercepted
741
+ * segment: `(.)photo/[...rest]/child` emits `/feed/photo/[...rest]/child` and
742
+ * hijacks `/feed/photo/a/b` by exactly the same mechanism. And it does not
743
+ * exempt a catch-all that carries its own page — that one does render, but
744
+ * the rewrite generated for the unreachable descendant is broader than any
745
+ * route in the tree, so the tail modal fires on navigations no directory
746
+ * describes.
747
+ *
748
+ * Outside a slot the same shape merely 404s, which is why the general rule is
749
+ * tracked separately (TIM-1286); here it is unsafe, and it only became
750
+ * reachable when catch-all intercepted segments started matching at all
751
+ * (TIM-1281).
752
+ *
753
+ * The walk descends `children` and not `slots`, mirroring
754
+ * `collectLeavesWithRewrites` exactly: what this rejects is precisely the set
755
+ * of paths rewrite generation emits, so the two cannot disagree about which
756
+ * shapes exist. A slot nested inside an intercepting subtree produces no
757
+ * rewrite and so cannot hijack anything.
758
+ */
759
+ function assertInterceptedCatchAllsAreTerminal(node, nodePath) {
760
+ const { segmentType, segmentName } = effectiveUrlSegment(node);
761
+ if ((segmentType === "catch-all" || segmentType === "optional-catch-all") && node.children.length > 0) throw new Error(`Build error: catch-all with nested segments inside an intercepting route.\n Directory: app/${nodePath}\n Nested: ${node.children.map((c) => c.segmentName).join(", ")}\nA catch-all (${segmentName}) consumes every remaining URL segment, so nothing below it can ever match — but the interception rewrite would still be generated and would hijack the navigation with no page to render.\nMove the nested routes above the catch-all, or intercept a named segment instead.\nSee design/07-routing.md §"Intercepting Routes".`);
762
+ for (const child of node.children) assertInterceptedCatchAllsAreTerminal(child, `${nodePath}/${child.segmentName}`);
763
+ }
764
+ /**
765
+ * Reject a `route.ts` anywhere inside an intercepting subtree.
766
+ *
767
+ * An interception is a soft-navigation variant of a page — it swaps which
768
+ * page component renders. A route handler returns a `Response` and cannot
769
+ * be an interception target: `walkInterceptedLeaves` visits `node.page`
770
+ * only, so no rewrite is emitted for it, but `isTerminal` in
771
+ * `tree-match.ts` counts both `page` and `route`, so `matchUrlParts` can
772
+ * resolve to the route handler. `slot-interception.ts` then drops the
773
+ * match (`if (!leaf.page) continue`), silently disabling the page's
774
+ * interception. Fail-safe (the canonical route renders) but silent.
775
+ *
776
+ * The walk mirrors `assertInterceptedCatchAllsAreTerminal`: it descends
777
+ * `children` (not `slots`), matching `collectLeavesWithRewrites` exactly.
778
+ */
779
+ function assertNoRouteHandlersInSubtree(node, nodePath) {
780
+ if (node.route) throw new Error(`Build error: route handler inside an intercepting route.\n File: ${node.route.filePath}\n Directory: app/${nodePath}\nAn intercepting subtree renders a page component on soft navigation — a route handler returns a Response and cannot be an interception target. The route handler would silently shadow the interception: the resolver would match it and then discard it because it has no page, so the modal would stop opening with no diagnostic.\nRemove the route.ts, or move it outside the intercepting subtree.\nSee design/07-routing.md §"Intercepting Routes".`);
781
+ for (const child of node.children) assertNoRouteHandlersInSubtree(child, `${nodePath}/${child.segmentName}`);
782
+ }
783
+ /**
784
+ * Reject two pages that answer one URL among the interceptors an owner
785
+ * resolves in a single walk.
786
+ *
787
+ * `validateRouteGroupCollisions` in the scanner returns early on an
788
+ * intercepting node, so nothing else validates in here. That exemption exists
789
+ * for a real reason — an interception's computed URL legitimately mirrors the
790
+ * canonical route it replaces, and interceptors at *different* anchors
791
+ * deliberately target one URL, which the resolver then orders (deepest anchor
792
+ * first). But the exemption was broader than its reason. Two shapes slip
793
+ * through it, and they are the same shape seen from two levels:
794
+ *
795
+ * feed/(.)photo/(a)/page.tsx feed/@modal/(.)[a]/page.tsx
796
+ * feed/(.)photo/(b)/page.tsx feed/@modal/(.)[b]/page.tsx
797
+ *
798
+ * Both pairs answer one URL, and in both `matchUrlParts` resolves the tie by
799
+ * whichever `children` array lists first — so the winner is whichever the
800
+ * filesystem enumerated first, and renaming a directory flips it. That is
801
+ * exactly what `validateRouteGroupCollisions` and
802
+ * `validateAffixedSiblingConflicts` exist to reject for ordinary siblings.
803
+ *
804
+ * **The collision space is the anchor group, not the directory.** An earlier
805
+ * revision ran once per intercepting directory, which sees the left-hand pair
806
+ * and not the right-hand one: those leaves live in two different directories.
807
+ * The space is `groupByInterceptedAnchor`'s output — the same grouping
808
+ * `findInterceptingMatch` hands to one `matchUrlParts` call — so what is
809
+ * validated together is exactly what is resolved together. Interceptors at
810
+ * different anchors stay independent, which is the documented case, and two
811
+ * slots on one owner are two owners and so two spaces.
812
+ *
813
+ * **Two checks, and the difference between them matters.** A duplicate
814
+ * intercepted *pattern* is decided by string equality, which is exact: two
815
+ * leaves with one pattern claim one set of URLs, whatever the precedence rules
816
+ * are. Everything else is decided by asking the matcher — `collision-probe.ts`,
817
+ * the same oracle the main tree and every slot use, so the spaces cannot
818
+ * disagree about whether a pair of pages collides.
819
+ *
820
+ * Not covered: two affixed dynamics that tie on specificity (`(x)/a-[id]` vs
821
+ * `(y)/[slug]-b`, ambiguous only for a part shaped `a-…-b`). No single probe
822
+ * URL exercises both, and `validateAffixedSiblingConflicts` already rejects
823
+ * that pair by affix length — including through groups, inside intercepting
824
+ * subtrees, and between two interceptors sharing an anchor.
825
+ *
826
+ * The shape applies to both interception mechanisms — a slot interceptor and a
827
+ * children-path one produce their leaves through the same walk, and both are
828
+ * resolved by `findInterceptingMatch` — so this is called from the one place in
829
+ * `walkForPlacement` that sees every owner regardless of position.
830
+ */
831
+ function assertNoInterceptedPatternCollisions(owner, ownerPath) {
832
+ for (const group of groupByInterceptedAnchor(owner.urlPath, owner.children)) assertAnchorGroupHasNoCollisions(group, ownerPath);
833
+ }
834
+ /**
835
+ * Reject a children-path interceptor and a slot interceptor from the same owner
836
+ * that claim URLs in common.
837
+ *
838
+ * Within one mode the ambiguity is either non-existent (two children-path
839
+ * rewrites are interchangeable, §"Selection Between Owners") or harmless (two
840
+ * slots on one owner both render). Across modes one is a layout swap and the
841
+ * other is a modal overlay, and the walk order picks the children-path shape —
842
+ * making the modal dead, silently and deterministically (TIM-1319).
843
+ *
844
+ * Overlap is a **pattern intersection** test: do two intercepted URL patterns
845
+ * share any concrete URL? This is not the same question the within-mode
846
+ * collision oracle answers. `findOrderDependentCollision` checks whether two
847
+ * candidates in one `matchUrlParts` walk produce different winners when
848
+ * `children` order is reversed — that is, order-dependence. A static segment
849
+ * always beats a dynamic one deterministically (no order-dependence), so
850
+ * `/feed/foo` and `/feed/[id]` pass the oracle even though
851
+ * `pathnameMatchesPattern` — the actual rewrite matcher — accepts both. The
852
+ * pattern intersection test catches that: it walks both patterns segment by
853
+ * segment and asks whether any value satisfies both.
854
+ *
855
+ * The check collects intercepted patterns from children-path interceptors and
856
+ * from each slot's interceptors independently. Slots are checked one at a time
857
+ * so two slot interceptors from *different* slots claiming one URL — the legal
858
+ * "two slots on one owner" case — are never compared.
859
+ */
860
+ function assertNoCrossModeClaims(node, ownerPath) {
861
+ const childrenLeaves = [];
862
+ for (const child of node.children) {
863
+ if (child.segmentType !== "intercepting" || !child.interceptionMarker || !child.interceptedSegmentName) continue;
864
+ walkInterceptedLeaves(child, computeInterceptedUrlBase(node.urlPath, child.interceptionMarker, child.interceptedSegmentName), [child], (page, leaf) => {
865
+ childrenLeaves.push({
866
+ pattern: leaf.interceptedPattern,
867
+ filePath: page.filePath
868
+ });
869
+ });
870
+ }
871
+ if (childrenLeaves.length === 0) return;
872
+ const owner = ownerPath || "(app root)";
873
+ for (const slot of Object.values(node.slots)) {
874
+ const slotLeaves = [];
875
+ for (const child of slot.children) {
876
+ if (child.segmentType !== "intercepting" || !child.interceptionMarker || !child.interceptedSegmentName) continue;
877
+ walkInterceptedLeaves(child, computeInterceptedUrlBase(node.urlPath, child.interceptionMarker, child.interceptedSegmentName), [child], (page, leaf) => {
878
+ slotLeaves.push({
879
+ pattern: leaf.interceptedPattern,
880
+ filePath: page.filePath
881
+ });
882
+ });
883
+ }
884
+ for (const cl of childrenLeaves) for (const sl of slotLeaves) {
885
+ const overlap = interceptedPatternsOverlap(cl.pattern, sl.pattern);
886
+ if (overlap !== null) throwCrossModeClaim(owner, overlap, cl.filePath, sl.filePath);
887
+ }
888
+ }
889
+ }
890
+ function throwCrossModeClaim(owner, url, childFile, slotFile) {
891
+ throw new Error(`Build error: a children-path interception and a slot interception both claim the same URL.
892
+ Owner: app/${owner}\n URL: ${url}\n Children: ${childFile}\n Slot: ${slotFile}\nThe children-path interceptor replaces the owner's children (layout swap) while the slot interceptor renders inside a parallel slot (modal overlay). Both apply from the same scope at the same URL, and which one wins would depend on internal walk order rather than an explicit rule.\nRemove one of the two, or move them to different scopes.\nSee design/07-routing.md §"Selection Between Owners".`);
893
+ }
894
+ /**
895
+ * The URL-matching identity of an intercepting node, as a node.
896
+ *
897
+ * `matchUrlParts` reads `segmentType` directly and knows nothing about
898
+ * interception, so a marker'd directory has to be handed to it under the
899
+ * identity of the segment it intercepts — `(.)[id]` as `[id]`. Priority
900
+ * ordering, affix stripping and catch-all handling then come from the shared
901
+ * walker rather than from a second classifier here.
902
+ *
903
+ * Shared with `findInterceptingMatch` for the same reason the grouping is: the
904
+ * collision space is the resolver's synthetic anchor parent, so its children
905
+ * have to carry the identity the resolver gives them or the validator would be
906
+ * probing a tree that does not match the one served. The caller keeps its own
907
+ * map back to the real node — the proxy is a matching identity, not a
908
+ * replacement (tree paths still need the directory name).
909
+ */
910
+ function interceptorProxy(node) {
911
+ return {
912
+ ...node,
913
+ ...effectiveUrlSegment(node)
914
+ };
915
+ }
916
+ function assertAnchorGroupHasNoCollisions(group, ownerPath) {
917
+ const { base } = group;
918
+ const owner = ownerPath || "(app root)";
919
+ const proxies = group.interceptors.map(interceptorProxy);
920
+ const anchorNode = {
921
+ segmentName: "",
922
+ segmentType: "static",
923
+ urlPath: base,
924
+ children: proxies,
925
+ slots: {}
926
+ };
927
+ const patterns = /* @__PURE__ */ new Map();
928
+ const probeLeaves = [];
929
+ for (const proxy of proxies) walkInterceptedLeaves(proxy, joinInterceptedBase(base, proxy.segmentName), [proxy], (page, leaf) => {
930
+ const duplicate = patterns.get(leaf.interceptedPattern);
931
+ if (duplicate) throw new Error(`Build error: route collision between intercepting routes — two pages intercept the same URL.\n Owner: app/${owner}\n Intercepted base: ${base}\n URL: ${leaf.interceptedPattern}\n File 1: ${duplicate}\n File 2: ${page.filePath}\nA route group is transparent for matching, so moving a page into one does not give it a URL of its own — these two claim the same one. Rename or move one of them.\nSee design/07-routing.md §"Collisions Among Intercepting Routes".`);
932
+ patterns.set(leaf.interceptedPattern, page.filePath);
933
+ probeLeaves.push({
934
+ filePath: page.filePath,
935
+ chain: leaf.chain
936
+ });
937
+ });
938
+ const collision = findOrderDependentCollision(anchorNode, probeLeaves, base);
939
+ if (collision) throw new Error(`Build error: route collision between intercepting routes — two pages answer the same URL.\n Owner: app/${owner}\n Intercepted base: ${base}\n URL: ${collision.url}\n File 1: ${collision.first}\n File 2: ${collision.second}\nBoth match it, so which one renders would be decided by filesystem enumeration order — renaming a route group can flip it. Rename or move one of them.\nPages are compared by the URLs they match, not by how they are spelled: [id] and [slug] match the same URLs, and an optional catch-all also matches with zero segments.\nIntercepting directories based at *different* URLs may target one page — the resolver tries the deepest first — so this rejects only an ambiguity among the ones based at ${base}.\nSee design/07-routing.md §"Collisions Among Intercepting Routes".`);
940
+ }
941
+ function walkForPlacement(node, path, ctx) {
942
+ for (const child of node.children) {
943
+ const childPath = path ? `${path}/${child.segmentName}` : child.segmentName;
944
+ if (child.segmentType === "intercepting") {
945
+ const marker = child.interceptionMarker ?? "(.)";
946
+ if (ctx.inInterceptingSubtree) throw new Error(`Build error: intercepting route nested inside another intercepting route.\n Directory: app/${childPath}\nAn intercepting directory (${marker}) resolves against the URL its own parent renders at, and an intercepting subtree has no such URL — nothing walks it, so the rewrite would match the navigation and then have nothing to render.\nSee design/07-routing.md §"Intercepting Routes".`);
947
+ if (ctx.inSlotSubtree && !ctx.parentIsSlot) throw new Error(`Build error: intercepting route inside a parallel slot but not directly under it.\n Directory: app/${childPath}\nAn intercepting directory (${marker}) inside an @slot must be a *direct* child of that slot, e.g. app/feed/@modal/${child.segmentName}/page.tsx. The slot resolver scans the slot's direct children only; elsewhere the rewrite would match the navigation and then have nothing to render.\nSee design/07-routing.md §"Intercepting Routes".`);
948
+ if (!ctx.parentIsSlot && ctx.ancestorsBindParams) assertOwnerChainBindsNoParams(childPath, marker);
949
+ if (!ctx.parentIsSlot && !node.layout) assertOwnerHasLayout(path, childPath);
950
+ assertInterceptedBaseIsCountable(child, node.urlPath, childPath);
951
+ assertInterceptedCatchAllsAreTerminal(child, childPath);
952
+ assertNoRouteHandlersInSubtree(child, childPath);
953
+ }
954
+ walkForPlacement(child, childPath, {
955
+ parentIsSlot: false,
956
+ inSlotSubtree: ctx.inSlotSubtree,
957
+ inInterceptingSubtree: ctx.inInterceptingSubtree || child.segmentType === "intercepting",
958
+ ancestorsBindParams: ctx.ancestorsBindParams || !!child.paramName
959
+ });
960
+ }
961
+ assertNoInterceptedPatternCollisions(node, path);
962
+ for (const [slotName, slotNode] of Object.entries(node.slots)) walkForPlacement(slotNode, path ? `${path}/@${slotName}` : `@${slotName}`, {
963
+ parentIsSlot: true,
964
+ inSlotSubtree: true,
965
+ inInterceptingSubtree: ctx.inInterceptingSubtree,
966
+ ancestorsBindParams: false
967
+ });
968
+ assertNoCrossModeClaims(node, path);
969
+ }
970
+ /**
971
+ * Recursively walk the segment tree to find intercepting routes.
972
+ *
973
+ * `ancestors` deliberately excludes slot nodes: a slot doesn't appear in a
974
+ * matched route chain, so the last entry is always the nearest chain-visible
975
+ * ancestor — the segment that owns the slot, and therefore the segment whose
976
+ * presence in the source route gates the interception.
977
+ *
978
+ * Intercepting nodes only ever appear as a direct child of a slot or of an
979
+ * ordinary chain segment in a valid tree; `validateInterceptionPlacement`
980
+ * rejects every other placement at scan time, so this walk never has to
981
+ * decide what an unrenderable intercepting node should generate.
982
+ *
983
+ * `parentIsSlot` is what distinguishes the two shapes, and it is the only
984
+ * input that does: the owner, the scope and the intercepted pattern are all
985
+ * computed identically either way.
986
+ */
987
+ function walkForInterceptions(node, ancestors, parentIsSlot, rewrites) {
988
+ for (const child of node.children) if (child.segmentType === "intercepting" && child.interceptionMarker) collectFromInterceptingNode(child, ancestors, parentIsSlot, rewrites);
989
+ else walkForInterceptions(child, [...ancestors, child], false, rewrites);
990
+ for (const slot of Object.values(node.slots)) walkForInterceptions(slot, ancestors, true, rewrites);
991
+ }
992
+ /**
993
+ * For an intercepting segment, find all leaf pages in its sub-tree and
994
+ * generate rewrite rules for each.
995
+ */
996
+ function collectFromInterceptingNode(interceptingNode, ancestors, parentIsSlot, rewrites) {
997
+ const marker = interceptingNode.interceptionMarker;
998
+ const segmentName = interceptingNode.interceptedSegmentName;
999
+ const parentUrlPath = ancestors[ancestors.length - 1].urlPath;
1000
+ const interceptedUrlBase = computeInterceptedUrlBase(parentUrlPath, marker, segmentName);
1001
+ const ancestorPaths = computeSegmentTreePaths(ancestors);
1002
+ const interceptingScope = ancestorPaths[ancestorPaths.length - 1];
1003
+ collectLeavesWithRewrites(interceptingNode, interceptedUrlBase, parentIsSlot ? {
1004
+ mode: "slot",
1005
+ interceptingPrefix: parentUrlPath,
1006
+ interceptingScope
1007
+ } : {
1008
+ mode: "children",
1009
+ interceptingScope
1010
+ }, rewrites);
1011
+ }
1012
+ /**
1013
+ * Walk an intercepting sub-tree and visit every page-bearing node with the URL
1014
+ * pattern it is intercepted at, and URLs that reach it.
1015
+ *
1016
+ * Route groups are transparent, exactly as they are in the main tree — which
1017
+ * is what makes two groups under one interceptor able to claim one URL, and is
1018
+ * why the collision validator has to walk the same shape this does.
1019
+ *
1020
+ * Rewrite generation and that validator are the two callers. They share this
1021
+ * walk rather than each having their own so they cannot disagree about which
1022
+ * URLs an interceptor claims: a leaf the validator did not see is a rewrite
1023
+ * nobody checked, and a leaf only the validator sees is a build error for a
1024
+ * route that does not exist. Slots are not descended, here or in either caller
1025
+ * — a slot nested inside an intercepting subtree produces no rewrite.
1026
+ *
1027
+ * That answers the rewrite question only, and the resolution question is
1028
+ * answered elsewhere: `validateSlotsInsideInterceptingSubtree`
1029
+ * (`collision-spaces.ts`) gives each such slot its own collision space, and
1030
+ * `validateSlotPlacement` (`slot-placement.ts`) rejects the ones no renderer
1031
+ * reaches. Between them the slots this walk skips are covered; do not conclude
1032
+ * from the skip here that they are unvalidated (TIM-1308, TIM-1311).
1033
+ *
1034
+ * The walk reports the chain of URL-contributing nodes rather than building
1035
+ * probe URLs itself: choosing a probe value means running the matcher over the
1036
+ * whole subtree, which is the validator's business and not something rewrite
1037
+ * generation should be paying for or passing dummy arguments around.
1038
+ */
1039
+ function walkInterceptedLeaves(node, interceptedUrlPath, chain, visit) {
1040
+ if (node.page) visit(node.page, {
1041
+ interceptedPattern: interceptedUrlPath,
1042
+ chain
1043
+ });
1044
+ for (const child of node.children) {
1045
+ const isGroup = child.segmentType === "group";
1046
+ walkInterceptedLeaves(child, isGroup ? interceptedUrlPath : `${interceptedUrlPath}/${child.segmentName}`, isGroup ? chain : [...chain, child], visit);
1047
+ }
1048
+ }
1049
+ /**
1050
+ * Recursively find leaf pages in an intercepting sub-tree and generate
1051
+ * rewrite rules for each.
1052
+ */
1053
+ function collectLeavesWithRewrites(node, interceptedUrlPath, shape, rewrites) {
1054
+ walkInterceptedLeaves(node, interceptedUrlPath, [], (_page, leaf) => {
1055
+ rewrites.push({
1056
+ ...shape,
1057
+ interceptedPattern: leaf.interceptedPattern
1058
+ });
1059
+ });
1060
+ }
1061
+ /**
1062
+ * How many URL levels a marker climbs from the slot owner to reach the
1063
+ * intercepted segment, or `'root'` for a marker that climbs all the way.
1064
+ *
1065
+ * Level counting operates on URL path segments, NOT filesystem directories.
1066
+ * Route groups and parallel slots are already excluded from urlPath (they
1067
+ * don't add URL depth), so (..) correctly climbs visible segments. This
1068
+ * avoids the Vinext bug where path.dirname() on filesystem paths would
1069
+ * waste climbs on invisible route groups.
1070
+ *
1071
+ * Used only by `computeInterceptedBase` below — both rewrite generation and
1072
+ * the slot resolver go through that, so the arithmetic exists once.
1073
+ */
1074
+ function interceptionClimb(marker) {
1075
+ switch (marker) {
1076
+ case "(.)": return 0;
1077
+ case "(..)": return 1;
1078
+ case "(..)(..)": return 2;
1079
+ case "(...)": return "root";
1080
+ }
1081
+ }
1082
+ /**
1083
+ * Compute the base URL that an intercepting route intercepts, given the
1084
+ * parent's URL path and the interception marker.
1085
+ *
1086
+ * - (.) — same level: parent's URL path
1087
+ * - (..) — one level up: parent's parent URL path
1088
+ * - (...) — root level: /
1089
+ * - (..)(..) — two levels up: parent's grandparent URL path
1090
+ *
1091
+ * The result is a URL **pattern**, not a URL — `parentUrlPath` carries the
1092
+ * directory names, so a dynamic ancestor appears as `/docs/[...path]`.
1093
+ * Rewrite generation wants exactly that. The slot resolver imports this to
1094
+ * locate the intercepted segment in a concrete target pathname, and must
1095
+ * therefore account for a bracket part standing for a different number of
1096
+ * URL parts than itself (TIM-1281).
1097
+ *
1098
+ * Climbing past the root clamps to `/` rather than erroring, so generation
1099
+ * and resolution never disagree about what an over-reaching marker
1100
+ * intercepts.
1101
+ */
1102
+ /**
1103
+ * The URL pattern an intercepting directory's own page sits at — its
1104
+ * `computeInterceptedBase` joined with the segment it intercepts.
1105
+ *
1106
+ * The root case is why this is a function rather than a template literal at
1107
+ * each caller: a base of `/` must not produce `//photo`. Rewrite generation
1108
+ * and the collision validator both start their walk from this value, so the
1109
+ * two describe the same URLs by construction.
1110
+ */
1111
+ function computeInterceptedUrlBase(parentUrlPath, marker, interceptedSegmentName) {
1112
+ return joinInterceptedBase(computeInterceptedBase(parentUrlPath, marker), interceptedSegmentName);
1113
+ }
1114
+ /**
1115
+ * An intercepted base joined with one segment beneath it.
1116
+ *
1117
+ * The whole content of the "function rather than a template literal" rule
1118
+ * above: a base of `/` must not produce `//photo`. The collision validator has
1119
+ * the base in hand already (it groups by it) and joins through this rather than
1120
+ * re-deriving it from an owner path, so both callers spell the root case once.
1121
+ */
1122
+ function joinInterceptedBase(base, segmentName) {
1123
+ return base === "/" ? `/${segmentName}` : `${base}/${segmentName}`;
1124
+ }
1125
+ function computeInterceptedBase(parentUrlPath, marker) {
1126
+ const climb = interceptionClimb(marker);
1127
+ if (climb === "root") return "/";
1128
+ const parts = parentUrlPath.split("/").filter(Boolean);
1129
+ for (let i = 0; i < climb; i++) parts.pop();
1130
+ return parts.length === 0 ? "/" : `/${parts.join("/")}`;
1131
+ }
1132
+ //#endregion
1133
+ //#region src/routing/collision-spaces.ts
1134
+ /**
1135
+ * Validate that no two pages/routes in one collision space answer the same URL.
1136
+ *
1137
+ * Two route groups like (auth)/login/page.tsx and (marketing)/login/page.tsx both claim
1138
+ * /login — the scanner must detect and reject this at build time.
1139
+ *
1140
+ * Each parallel slot is validated as its OWN collision space: a slot's pages
1141
+ * intentionally share URL paths with the parent tree (that's the point of
1142
+ * parallel routes), but two route groups INSIDE one slot claiming the same
1143
+ * URL — e.g. @side/(a)/x/page.tsx + @side/(b)/x/page.tsx — still collide.
1144
+ */
1145
+ function validateRouteGroupCollisions(root) {
1146
+ validateCollisionSpace(root, "", root.urlPath);
1147
+ }
1148
+ /**
1149
+ * Validate one collision space — the main tree, or one parallel slot.
1150
+ *
1151
+ * **Two checks, and the difference between them matters.** Two leaves at the
1152
+ * same `urlPath` are decided by string equality, which is exact and needs no
1153
+ * probing: `(auth)/login` and `(marketing)/login` claim one set of URLs
1154
+ * whatever the precedence rules are, and naming the shared path is the clearest
1155
+ * thing to tell the author.
1156
+ *
1157
+ * Everything else is decided by asking the matcher, through the shared oracle
1158
+ * in `collision-probe.ts` (TIM-1308). Comparing `urlPath` spellings misses
1159
+ * every pair that matches the same URLs while being *spelled* differently:
1160
+ * `x/(a)/[id]` beside `x/(b)/[slug]` are two bare dynamics in one priority
1161
+ * tier, and `x/(a)/page.tsx` beside `x/(b)/[[...rest]]` both answer `/x`
1162
+ * because an optional catch-all also matches zero parts. Both built before
1163
+ * TIM-1308 with filesystem enumeration order deciding which page renders,
1164
+ * which is precisely what this validator and `validateAffixedSiblingConflicts`
1165
+ * exist to reject.
1166
+ *
1167
+ * Segment *kinds* stay distinct without any special-casing here, because the
1168
+ * oracle inherits `matchNode`'s priority ordering: `x/(a)/[id]` beside
1169
+ * `x/(b)/[...rest]` resolves the same way in either `children` order, so it is
1170
+ * not reported. So does an affixed sibling against a bare one; the
1171
+ * equal-specificity affix tie is `validateAffixedSiblingConflicts`' job, and
1172
+ * duplicating it here would double-report.
1173
+ */
1174
+ function validateCollisionSpace(spaceRoot, segmentPath, base) {
1175
+ const leaves = [];
1176
+ collectRoutableLeaves(spaceRoot, /* @__PURE__ */ new Map(), segmentPath, [], leaves, base);
1177
+ const collision = findOrderDependentCollision(spaceRoot, leaves, base);
1178
+ if (!collision) return;
1179
+ throw new Error(`Build error: route collision — two pages/routes answer the same URL.\n URL: ${collision.url}\n File 1: ${collision.first}\n File 2: ${collision.second}\nBoth match it, so which one renders would be decided by filesystem enumeration order — renaming a route group can flip it. Rename or move one of them.\nRoutes are compared by the URLs they match, not by how they are spelled: [id] and [slug] match the same URLs, and an optional catch-all also matches with zero segments.`);
1180
+ }
1181
+ /**
1182
+ * Walk one collision space and collect its routable leaves (page or route
1183
+ * files), throwing on an exact `urlPath` collision. Each slot recurses as its
1184
+ * OWN space — slots are parallel routes that intentionally share URL paths with
1185
+ * their parent tree, but collisions within a single slot are real errors.
1186
+ *
1187
+ * The early return at an intercepting node drops that subtree's own pages from
1188
+ * this space, but not its slots: a slot is its own collision space wherever it
1189
+ * sits, so `validateSlotsInsideInterceptingSubtree` picks those up before
1190
+ * returning.
1191
+ *
1192
+ * `chain` accumulates the URL-contributing nodes from the space root down, for
1193
+ * the probe oracle. Route groups are excluded because they are transparent for
1194
+ * matching, and the space root itself is excluded because `matchUrlParts`
1195
+ * matches parts against its *children* — the root consumes nothing.
1196
+ */
1197
+ function collectRoutableLeaves(node, seen, segmentPath, chain, leaves, base) {
1198
+ const currentPath = segmentPath ? `${segmentPath}/${node.segmentName}` : node.segmentName || "(root)";
1199
+ if (node.segmentType === "intercepting") {
1200
+ validateSlotsInsideInterceptingSubtree(node, currentPath, interceptedBaseOf(node, node.urlPath));
1201
+ return;
1202
+ }
1203
+ const routableFile = node.page ?? node.route;
1204
+ if (routableFile) {
1205
+ const existing = seen.get(node.urlPath);
1206
+ if (existing) throw new Error(`Build error: route collision — multiple route groups produce a page/route at the same URL path.\n URL path: ${urlFromChain(base, chain)}\n File 1: ${existing.filePath} (via ${existing.segmentPath})\n File 2: ${routableFile.filePath} (via ${currentPath})\nEach URL path must map to exactly one page or route handler. Rename or move one of the conflicting files.`);
1207
+ seen.set(node.urlPath, {
1208
+ filePath: routableFile.filePath,
1209
+ segmentPath: currentPath
1210
+ });
1211
+ leaves.push({
1212
+ filePath: routableFile.filePath,
1213
+ chain
1214
+ });
1215
+ }
1216
+ for (const child of node.children) collectRoutableLeaves(child, seen, currentPath, child.segmentType === "group" ? chain : [...chain, child], leaves, base);
1217
+ for (const slotNode of Object.values(node.slots)) validateCollisionSpace(slotNode, currentPath, urlFromChain(base, chain));
1218
+ }
1219
+ /**
1220
+ * Validate every parallel slot nested anywhere inside an intercepting subtree.
1221
+ *
1222
+ * Two walks each skip these slots for their own good reason, and together they
1223
+ * left them checked by nothing: `collectRoutableLeaves` returns at the
1224
+ * intercepting node before it reaches them, and `walkInterceptedLeaves`
1225
+ * deliberately does not descend slots — correct for rewrite generation, since a
1226
+ * slot inside an intercepting subtree produces no rewrite. But "produces no
1227
+ * rewrite" answers the rewrite question and not the resolution one, so
1228
+ * `@side/(a)/x/page.tsx` beside `@side/(b)/x/page.tsx` under an interceptor
1229
+ * built with filesystem order picking the page — the ordinary per-slot
1230
+ * collision that fails the build anywhere else in the tree (codex, on PR #1002).
1231
+ *
1232
+ * A slot is its own collision space wherever it sits, so each one is validated
1233
+ * as one.
1234
+ *
1235
+ * **Which interception shape this still applies to.** TIM-1311 answered the
1236
+ * question this was written under — whether such a slot renders at all — and
1237
+ * the answer is per-shape:
1238
+ *
1239
+ * - **Children path** (`(browse)/(...)photo/@side`): the intercepting node
1240
+ * joins the main route chain, so `route-element-builder.ts` resolves slots on
1241
+ * it and below it like any other chain segment. They render, and this is the
1242
+ * space where the check is load-bearing.
1243
+ * - **Modal** (`feed/@modal/(.)photo/@side`): the slot sits inside another
1244
+ * slot's subtree, which no renderer descends for slots — so it never renders,
1245
+ * and `validateSlotPlacement` now rejects the placement before this runs.
1246
+ * That rule subsumes this one for the modal shape rather than conflicting
1247
+ * with it, exactly as anticipated.
1248
+ *
1249
+ * So this walk is reached only for children-path interceptors in a valid tree.
1250
+ * It is not narrowed to them: the rule it states — a slot is its own collision
1251
+ * space wherever it sits — is shape-independent, and making it conditional on a
1252
+ * property the placement validator already guarantees would just be a second
1253
+ * place for the two to disagree.
1254
+ *
1255
+ * The walk covers the whole subtree, not just the interceptor's direct slot
1256
+ * children: `(...)photo/[id]/@side` is reached by neither walk for exactly the
1257
+ * same reason as `(...)photo/@side`.
1258
+ */
1259
+ function validateSlotsInsideInterceptingSubtree(node, segmentPath, base) {
1260
+ for (const slotNode of Object.values(node.slots)) validateCollisionSpace(slotNode, segmentPath, base);
1261
+ for (const child of node.children) validateSlotsInsideInterceptingSubtree(child, `${segmentPath}/${child.segmentName}`, childInterceptedBase(child, base));
1262
+ }
1263
+ /**
1264
+ * The URL a leaf answers, built from its space's base and its own chain.
1265
+ *
1266
+ * Read instead of `node.urlPath` because `urlPath` inside an intercepting
1267
+ * subtree is parent-relative and is not an address — the collision URL has to
1268
+ * be one the author can actually find. Outside an intercepting subtree the two
1269
+ * are identical by construction: the base is the space root's `urlPath` and the
1270
+ * chain is every URL-contributing segment below it.
1271
+ */
1272
+ function urlFromChain(base, chain) {
1273
+ if (chain.length === 0) return base || "/";
1274
+ const tail = chain.map((n) => n.segmentName).join("/");
1275
+ return `${base === "/" ? "" : base}/${tail}`;
1276
+ }
1277
+ /**
1278
+ * The intercepted URL an intercepting directory's own page sits at.
1279
+ *
1280
+ * `urlPath` inside an intercepting subtree is deliberately parent-relative and
1281
+ * is **not** an address (see design/07-routing.md §"Why urlPath Stays
1282
+ * Parent-Relative Inside an Intercepting Subtree"), so a collision reported
1283
+ * from one names a URL the author cannot find. The intercepted base is the real
1284
+ * address, and it is what rewrite generation and the interception collision
1285
+ * validator both already use.
1286
+ */
1287
+ function interceptedBaseOf(node, ownerUrlPath) {
1288
+ return computeInterceptedUrlBase(ownerUrlPath, node.interceptionMarker ?? "(.)", node.interceptedSegmentName ?? node.segmentName);
1289
+ }
1290
+ /**
1291
+ * Extend an intercepted base by one child segment.
1292
+ *
1293
+ * Route groups are transparent and contribute nothing. A nested intercepting
1294
+ * node re-bases from its own marker rather than appending — that tree is
1295
+ * rejected by `validateInterceptionPlacement`, but collision validation runs
1296
+ * first, so it still has to produce a sensible URL rather than one containing a
1297
+ * literal "(.)b".
1298
+ */
1299
+ function childInterceptedBase(child, base) {
1300
+ if (child.segmentType === "group") return base;
1301
+ if (child.segmentType === "intercepting") return interceptedBaseOf(child, base);
1302
+ return base === "/" ? `/${child.segmentName}` : `${base}/${child.segmentName}`;
1303
+ }
1304
+ //#endregion
1305
+ //#region src/routing/slot-placement.ts
1306
+ /**
1307
+ * Reject every parallel slot that no renderer reaches.
1308
+ *
1309
+ * **Where slots are resolved.** Two places read `segment.slots`, and both walk
1310
+ * the main route chain: `route-element-builder.ts` (the RSC render).
1311
+ * It is not reachable from inside a slot. The slot's own
1312
+ * subtree is rendered by `slot-resolver.ts`, which walks the slot's matched
1313
+ * chain to apply that chain's layouts, error boundaries and access gates
1314
+ * (`wrapWithIntermediateSegments`, `wrapWithLayout`) and never reads `.slots`
1315
+ * on any of those nodes. So `app/feed/@modal/photo/@side/page.tsx` and
1316
+ * everything below it is dead: the file is scanned, typed, code-split and
1317
+ * shipped, and no request can render it.
1318
+ *
1319
+ * That is the TIM-1278 failure — a directory that silently never renders —
1320
+ * and the reason it is a build error rather than a documented limit is that
1321
+ * nothing at request time can report it. A slot that does not match renders
1322
+ * `default.tsx` or `null`, which is exactly what a slot the resolver never
1323
+ * looked at also produces, so the author sees the *designed* behaviour of a
1324
+ * non-matching slot and has no signal to distinguish it from a slot that
1325
+ * cannot match at all.
1326
+ *
1327
+ * **Interception is incidental.** TIM-1311 arrived as
1328
+ * `feed/@modal/(.)photo/@side`, and the interception contributes nothing: the
1329
+ * identical `feed/@modal/photo/@side` never renders either, for the same
1330
+ * reason and with no marker anywhere. Rejecting only the intercepting spelling
1331
+ * would have drawn a line the author cannot see from the directory names.
1332
+ *
1333
+ * The children-path interception shape is **not** affected and must not be:
1334
+ * its intercepting node joins the main chain (`server/children-interception.ts`
1335
+ * splices `[…owner ancestors, interceptingNode, …descendants]` into an ordinary
1336
+ * `RouteMatch`), so `route-element-builder.ts` resolves slots on it and below
1337
+ * it exactly as it does for any other chain segment. `(browse)/(...)photo/[id]/@side`
1338
+ * renders; `feed/@modal/(.)photo/@side` does not. The discriminator is the slot
1339
+ * boundary, which is what this walk tracks — not the marker.
1340
+ */
1341
+ function validateSlotPlacement(root) {
1342
+ walkForSlotPlacement(root, "", null);
1343
+ }
1344
+ /**
1345
+ * `enclosingSlotPath` is the `app/`-relative path of the nearest slot at or
1346
+ * above `node`, or null on the main chain. It is carried rather than recomputed
1347
+ * so the error can name the slot that swallows the offender — "this is inside
1348
+ * @modal" is the part of the diagnosis the author cannot see from the offending
1349
+ * path alone.
1350
+ */
1351
+ function walkForSlotPlacement(node, path, enclosingSlotPath) {
1352
+ for (const [slotName, slotNode] of Object.entries(node.slots)) {
1353
+ const slotPath = path ? `${path}/@${slotName}` : `@${slotName}`;
1354
+ if (enclosingSlotPath !== null) throwNestedSlot(slotPath, enclosingSlotPath);
1355
+ walkForSlotPlacement(slotNode, slotPath, slotPath);
1356
+ }
1357
+ for (const child of node.children) walkForSlotPlacement(child, path ? `${path}/${child.segmentName}` : child.segmentName, enclosingSlotPath);
1358
+ }
1359
+ function throwNestedSlot(slotPath, enclosingSlotPath) {
1360
+ throw new Error(`Build error: parallel slot nested inside another parallel slot.\n Directory: app/${slotPath}\n Inside: app/${enclosingSlotPath}\nA parallel slot is resolved only for a segment on the matched route chain, and a slot's own subtree is never on that chain — the slot resolver walks the slot's matched chain to apply its layouts, error boundaries and access gates, and never looks at slots declared inside it. So app/${slotPath} and everything below it can never render, and no request-time signal can tell you: an unreachable slot produces exactly what a slot that simply did not match produces.\nDeclare the slot on a segment of the main route chain instead, or move its pages into app/${enclosingSlotPath}'s own subtree.\nSee design/07-routing.md §"Parallel Routes".`);
1361
+ }
1362
+ //#endregion
1363
+ //#region src/routing/scanner.ts
1364
+ /**
1365
+ * Route discovery scanner.
1366
+ *
1367
+ * Pure function: (appDir, config) → RouteTree
1368
+ *
1369
+ * Scans the app/ directory and builds a segment tree recognizing all
1370
+ * timber.js file conventions. Does NOT handle request matching — this
1371
+ * is discovery only.
1372
+ */
1373
+ /**
1374
+ * File convention names that use pageExtensions (can be .tsx, .ts, .jsx, .js, .mdx, etc.)
1375
+ */
1376
+ var PAGE_EXT_CONVENTIONS = /* @__PURE__ */ new Set([
1377
+ "page",
1378
+ "layout",
1379
+ "error",
1380
+ "default",
1381
+ "denied"
1382
+ ]);
1383
+ /**
1384
+ * File convention names that are always .ts/.tsx (never .mdx etc.)
1385
+ */
1386
+ var FIXED_CONVENTIONS = /* @__PURE__ */ new Set([
1387
+ "middleware",
1388
+ "access",
1389
+ "route"
1390
+ ]);
1391
+ /**
1392
+ * Status-code file patterns:
1393
+ * - Exact 3-digit codes: 401.tsx, 429.tsx, 503.tsx
1394
+ * - Category catch-alls: 4xx.tsx, 5xx.tsx
1395
+ */
1396
+ var STATUS_CODE_PATTERN = /^(\d{3}|[45]xx)$/;
1397
+ /**
1398
+ * Whether a basename + extension pair is a route-convention file the
1399
+ * framework itself imports: page/layout/error/default/denied and
1400
+ * global-error on pageExtensions, middleware/access/route/proxy on
1401
+ * .ts/.tsx/.js/.jsx only, and status-code files (404, 4xx, …) on
1402
+ * pageExtensions or .json — mirroring this scanner's own recognition
1403
+ * rules per family.
1404
+ *
1405
+ * Exported for the analyze classifier so its provisional classification
1406
+ * (design/47 §2) derives from the scanner's real conventions instead of
1407
+ * a duplicate list that can drift.
1408
+ */
1409
+ function isRouteConventionFile(base, ext, pageExtensions = DEFAULT_PAGE_EXTENSIONS) {
1410
+ const isPageExt = pageExtensions.includes(ext);
1411
+ if ((PAGE_EXT_CONVENTIONS.has(base) || base === "global-error") && isPageExt) return true;
1412
+ if ((FIXED_CONVENTIONS.has(base) || base === "proxy") && /^[jt]sx?$/.test(ext)) return true;
1413
+ if (STATUS_CODE_PATTERN.test(base) && (isPageExt || ext === "json")) return true;
1414
+ return false;
1415
+ }
1416
+ /**
1417
+ * Scan the app/ directory and build the route tree.
1418
+ *
1419
+ * @param appDir - Absolute path to the app/ directory
1420
+ * @param config - Scanner configuration
1421
+ * @returns The complete route tree
1422
+ */
1423
+ function scanRoutes(appDir, config = {}) {
1424
+ const pageExtensions = config.pageExtensions ?? DEFAULT_PAGE_EXTENSIONS;
1425
+ const extSet = new Set(pageExtensions);
1426
+ const tree = { root: createSegmentNode("", "static", "/") };
1427
+ const proxyFile = findFixedFile(appDir, "proxy");
1428
+ if (proxyFile) tree.proxy = proxyFile;
1429
+ const globalErrorFile = findPageExtFile(appDir, "global-error", extSet);
1430
+ if (globalErrorFile) tree.globalError = globalErrorFile;
1431
+ scanSegmentFiles(appDir, tree.root, extSet);
1432
+ scanChildren(appDir, tree.root, extSet);
1433
+ validateSlotPlacement(tree.root);
1434
+ validateRouteGroupCollisions(tree.root);
1435
+ validateDuplicateParamNames(tree.root);
1436
+ validateUniqueBracketForms(tree.root);
1437
+ validateAffixedSiblingConflicts(tree.root);
1438
+ validateInterceptionPlacement(tree.root);
1439
+ return tree;
1440
+ }
1441
+ /**
1442
+ * Create an empty segment node.
1443
+ */
1444
+ function createSegmentNode(segmentName, segmentType, urlPath, paramName, interceptionMarker, interceptedSegmentName, paramPrefix, paramSuffix) {
1445
+ return {
1446
+ segmentName,
1447
+ segmentType,
1448
+ urlPath,
1449
+ paramName,
1450
+ paramPrefix,
1451
+ paramSuffix,
1452
+ interceptionMarker,
1453
+ interceptedSegmentName,
1454
+ children: [],
1455
+ slots: {}
1456
+ };
1457
+ }
1458
+ /**
1459
+ * Compute the URL path for a child segment given its parent's URL path.
1460
+ * Route groups, slots, and intercepting routes do NOT add URL depth.
1461
+ */
1462
+ function computeUrlPath(parentUrlPath, dirName, segmentType) {
1463
+ if (segmentType === "group" || segmentType === "slot" || segmentType === "intercepting") return parentUrlPath;
1464
+ return `${parentUrlPath === "/" ? "" : parentUrlPath}/${dirName}`;
1465
+ }
1466
+ /**
1467
+ * Scan a directory for file conventions and populate the segment node.
1468
+ */
1469
+ function scanSegmentFiles(dirPath, node, extSet) {
1470
+ let entries;
1471
+ try {
1472
+ entries = readdirSync(dirPath);
1473
+ } catch (err) {
1474
+ swallow(err, `scanSegmentFiles: unreadable directory ${dirPath}`, { level: "warn" });
1475
+ return;
1476
+ }
1477
+ for (const entry of entries) {
1478
+ const fullPath = join(dirPath, entry);
1479
+ try {
1480
+ if (statSync(fullPath).isDirectory()) continue;
1481
+ } catch {
1482
+ continue;
1483
+ }
1484
+ const ext = extname(entry).slice(1);
1485
+ const name = basename(entry, `.${ext}`);
1486
+ if (PAGE_EXT_CONVENTIONS.has(name) && extSet.has(ext)) {
1487
+ const key = name;
1488
+ const existing = node[key];
1489
+ if (existing) throwDuplicateConvention(name, existing.filePath, fullPath);
1490
+ node[key] = {
1491
+ filePath: fullPath,
1492
+ extension: ext
1493
+ };
1494
+ continue;
1495
+ }
1496
+ if (FIXED_CONVENTIONS.has(name) && /^[jt]sx?$/.test(ext)) {
1497
+ const key = name;
1498
+ const existing = node[key];
1499
+ if (existing) throwDuplicateConvention(name, existing.filePath, fullPath);
1500
+ node[key] = {
1501
+ filePath: fullPath,
1502
+ extension: ext
1503
+ };
1504
+ continue;
1505
+ }
1506
+ if (STATUS_CODE_PATTERN.test(name) && ext === "json") {
1507
+ if (!node.jsonStatusFiles) node.jsonStatusFiles = {};
1508
+ node.jsonStatusFiles[name] = {
1509
+ filePath: fullPath,
1510
+ extension: ext
1511
+ };
1512
+ continue;
1513
+ }
1514
+ if (STATUS_CODE_PATTERN.test(name) && extSet.has(ext)) {
1515
+ if (!node.statusFiles) node.statusFiles = {};
1516
+ const existing = node.statusFiles[name];
1517
+ if (existing) throwDuplicateConvention(name, existing.filePath, fullPath);
1518
+ node.statusFiles[name] = {
1519
+ filePath: fullPath,
1520
+ extension: ext
1521
+ };
1522
+ continue;
1523
+ }
1524
+ const metaInfo = classifyMetadataRoute(entry);
1525
+ if (metaInfo) {
1526
+ if (!metaInfo.nestable && node.segmentName !== "") throw new Error(`Build error: '${name}' is a root-only metadata convention and must be in the app root directory.\n File: ${fullPath}\n Move this file to the app root (not a route group or nested segment).`);
1527
+ if (!node.metadataRoutes) node.metadataRoutes = {};
1528
+ const existing = node.metadataRoutes[name];
1529
+ if (existing) {
1530
+ const existingIsDynamic = isDynamicMetadataExtension(name, existing.extension);
1531
+ const newIsDynamic = isDynamicMetadataExtension(name, ext);
1532
+ if (existingIsDynamic === newIsDynamic) throwDuplicateConvention(name, existing.filePath, fullPath);
1533
+ if (newIsDynamic) node.metadataRoutes[name] = {
1534
+ filePath: fullPath,
1535
+ extension: ext
1536
+ };
1537
+ } else node.metadataRoutes[name] = {
1538
+ filePath: fullPath,
1539
+ extension: ext
1540
+ };
1541
+ }
1542
+ }
1543
+ if (node.route && node.page) throw new Error(`Build error: route.ts and page.* cannot coexist in the same segment.\n route.ts: ${node.route.filePath}\n page: ${node.page.filePath}\nA URL is either an API endpoint or a rendered page, not both.`);
1544
+ }
1545
+ /**
1546
+ * Throw a build error for two files claiming the same convention slot in
1547
+ * one segment (e.g. page.tsx + page.jsx). Which file readdir returns first
1548
+ * is platform-dependent (APFS sorts entries, ext4 does not) — silently
1549
+ * picking one would let macOS dev and Linux CI serve different
1550
+ * implementations of the same route.
1551
+ */
1552
+ function throwDuplicateConvention(convention, firstPath, secondPath) {
1553
+ throw new Error(`Build error: duplicate '${convention}' files in the same route segment.\n File 1: ${firstPath}\n File 2: ${secondPath}\nEach segment may define '${convention}' at most once. Remove one of the files.`);
1554
+ }
1555
+ /**
1556
+ * Recursively scan child directories and build the segment tree.
1557
+ */
1558
+ function scanChildren(dirPath, parentNode, extSet) {
1559
+ let entries;
1560
+ try {
1561
+ entries = readdirSync(dirPath);
1562
+ } catch (err) {
1563
+ swallow(err, `scanChildren: unreadable directory ${dirPath}`, { level: "warn" });
1564
+ return;
1565
+ }
1566
+ for (const entry of entries) {
1567
+ const fullPath = join(dirPath, entry);
1568
+ try {
1569
+ if (!statSync(fullPath).isDirectory()) continue;
1570
+ } catch {
1571
+ continue;
1572
+ }
1573
+ if (ENCODED_SEPARATOR_RE.test(entry)) throw new Error(`Build error: directory name contains an encoded path delimiter (%2F or %5C).\n Directory: ${fullPath}\nEncoded separators in directory names cause route collisions when decoded. Rename the directory to remove the encoded delimiter.`);
1574
+ if (NULL_BYTE_RE.test(entry)) throw new Error(`Build error: directory name contains an encoded null byte (%00).\n Directory: ${fullPath}\nEncoded null bytes in directory names are not allowed. Rename the directory to remove the null byte encoding.`);
1575
+ const { type, paramName, paramPrefix, paramSuffix, interceptionMarker, interceptedSegmentName } = classifySegment(entry);
1576
+ if (type === "private") continue;
1577
+ const childNode = createSegmentNode(entry, type, computeUrlPath(parentNode.urlPath, entry, type), paramName, interceptionMarker, interceptedSegmentName, paramPrefix, paramSuffix);
1578
+ scanSegmentFiles(fullPath, childNode, extSet);
1579
+ scanChildren(fullPath, childNode, extSet);
1580
+ if (type === "slot") {
1581
+ const slotName = entry.slice(1);
1582
+ parentNode.slots[slotName] = childNode;
1583
+ } else parentNode.children.push(childNode);
1584
+ }
1585
+ }
1586
+ /**
1587
+ * Validate that no route chain contains duplicate dynamic param names.
1588
+ *
1589
+ * Example violation:
1590
+ * app/[id]/items/[id]/page.tsx — 'id' appears twice in the ancestor chain.
1591
+ *
1592
+ * Route groups are transparent — params accumulate through them.
1593
+ * Slots are independent — duplicate detection does NOT cross slot boundaries.
1594
+ *
1595
+ * See design/07-routing.md §"Duplicate Param Name Detection"
1596
+ */
1597
+ function validateDuplicateParamNames(root) {
1598
+ walkForDuplicateParams(root, /* @__PURE__ */ new Map());
1599
+ }
1600
+ /**
1601
+ * Recursively walk the segment tree, tracking seen param names → segment paths.
1602
+ * Throws on the first duplicate found.
1603
+ */
1604
+ function walkForDuplicateParams(node, seen) {
1605
+ const { paramName } = effectiveUrlSegment(node);
1606
+ if (paramName) {
1607
+ const existing = seen.get(paramName);
1608
+ if (existing) throw new Error(`[timber] Duplicate param name '${paramName}' in route chain.\n First defined at: ${existing}\n Duplicate at: ${node.urlPath || "/"}\n Rename one of the segments to avoid ambiguity.`);
1609
+ seen = new Map(seen);
1610
+ seen.set(paramName, node.urlPath || "/");
1611
+ }
1612
+ for (const child of node.children) walkForDuplicateParams(child, seen);
1613
+ for (const slotNode of Object.values(node.slots)) walkForDuplicateParams(slotNode, new Map(seen));
1614
+ }
1615
+ /**
1616
+ * Validate that each param name uses a single bracket form across the entire route tree.
1617
+ *
1618
+ * Different bracket forms produce different types:
1619
+ * [id] → string
1620
+ * [...id] → string[]
1621
+ * [[...id]] → string[] | undefined
1622
+ *
1623
+ * If the same param name appears with multiple forms, the no-argument
1624
+ * getSegmentParams() / useSegmentParams() return type becomes ambiguous.
1625
+ *
1626
+ * Same name + same form across different routes is fine and expected.
1627
+ */
1628
+ function validateUniqueBracketForms(root) {
1629
+ collectBracketForms(root, /* @__PURE__ */ new Map());
1630
+ }
1631
+ function collectBracketForms(node, forms) {
1632
+ const { paramName, segmentType } = effectiveUrlSegment(node);
1633
+ if (paramName && segmentType !== "static" && segmentType !== "group") {
1634
+ const existing = forms.get(paramName);
1635
+ if (existing && existing.segmentType !== segmentType) {
1636
+ const bracketExamples = {
1637
+ "dynamic": `[${paramName}]`,
1638
+ "catch-all": `[...${paramName}]`,
1639
+ "optional-catch-all": `[[...${paramName}]]`
1640
+ };
1641
+ throw new Error(`[timber] Param name '${paramName}' uses multiple bracket forms.\n ${bracketExamples[existing.segmentType] ?? existing.segmentType} at: ${existing.urlPath}\n ${bracketExamples[segmentType] ?? segmentType} at: ${node.urlPath || "/"}\n Each param name must use a single bracket form across all routes.\n Rename one of the segments to fix this (e.g., [${paramName}] → [${paramName}Id]).`);
1642
+ }
1643
+ if (!existing) forms.set(paramName, {
1644
+ segmentType,
1645
+ urlPath: node.urlPath || "/"
1646
+ });
1647
+ }
1648
+ for (const child of node.children) collectBracketForms(child, forms);
1649
+ for (const slotNode of Object.values(node.slots)) collectBracketForms(slotNode, forms);
1650
+ }
1651
+ /**
1652
+ * Validate that no sibling affixed dynamic segments have equal specificity.
1653
+ *
1654
+ * Among affixed siblings, longer combined prefix+suffix length wins. When two
1655
+ * siblings tie (same total affix length), the router would fall back to
1656
+ * filesystem scan order — which is platform-dependent. This is a build error.
1657
+ *
1658
+ * Route groups are URL-transparent, so affixed segments inside different groups
1659
+ * at the same level still conflict with each other.
1660
+ *
1661
+ * Ambiguity requires the two segments to be candidates for the *same* URL
1662
+ * part, which is narrower than "same parent" once interception is involved:
1663
+ *
1664
+ * - Plain children and intercepting children never compete. They are resolved
1665
+ * by different walks — `findSlotMatch` matches the slot subtree (where
1666
+ * `tree-match.ts` ignores intercepting nodes outright) and
1667
+ * `findInterceptingMatch` builds a synthetic parent holding only
1668
+ * interceptors.
1669
+ * - Two interceptors compete only at the same anchor. `(.)a-[id]` and
1670
+ * `(..)[slug]-b` in one slot are based at different URL depths, so no
1671
+ * pathname reaches both, and `anchorIndex` rejects the one whose base does
1672
+ * not match the target. Grouping them together would fail the build for a
1673
+ * pair that can never be ambiguous.
1674
+ *
1675
+ * So candidates are keyed by the position they contend for, then by affix
1676
+ * length. See design/07-routing.md §"Priority" and §"Intercepting Routes".
1677
+ */
1678
+ function validateAffixedSiblingConflicts(node) {
1679
+ const affixed = collectEffectiveAffixed(node);
1680
+ if (affixed.length >= 2) {
1681
+ const byLength = /* @__PURE__ */ new Map();
1682
+ for (const child of affixed) {
1683
+ const key = `${contentionKey(node, child)}\0${affixLengthOf(child)}`;
1684
+ const group = byLength.get(key);
1685
+ if (group) group.push(child);
1686
+ else byLength.set(key, [child]);
1687
+ }
1688
+ for (const [, group] of byLength) if (group.length >= 2) throw new Error(`Build error: ambiguous affixed dynamic siblings with equal specificity.\n Parent: ${node.urlPath || "/"}\n Segments: ${group.map((s) => s.segmentName).join(", ")}\n Combined prefix+suffix length: ${affixLengthOf(group[0])}\nThe router cannot deterministically choose between these — filesystem scan order is platform-dependent.\nRename one segment to give it a longer or shorter combined affix.`);
1689
+ }
1690
+ for (const child of node.children) validateAffixedSiblingConflicts(child);
1691
+ for (const slotNode of Object.values(node.slots)) validateAffixedSiblingConflicts(slotNode);
1692
+ }
1693
+ /**
1694
+ * The URL position a child contends for, as a comparable key.
1695
+ *
1696
+ * Plain children contend for the parent's next part. An intercepting child
1697
+ * contends for a part determined by its marker's intercepted base, so two
1698
+ * markers of different depth are simply different positions — and two markers
1699
+ * that compute the *same* base do contend, which is why the key is the base
1700
+ * rather than the marker (`(..)` and `(...)` under `/feed` both base at `/`).
1701
+ *
1702
+ * `groupByInterceptedAnchor` (`routing/interception.ts`) is the canonical
1703
+ * statement of that grouping — it is what the resolver walks and what the
1704
+ * collision validator checks. This computes the same key from the same
1705
+ * `computeInterceptedBase` rather than calling it, because affix ambiguity is
1706
+ * decided per *child* and `collectEffectiveAffixed` looks through route groups,
1707
+ * so the two do not partition the same set of nodes.
1708
+ */
1709
+ function contentionKey(parent, child) {
1710
+ if (child.segmentType !== "intercepting") return "child";
1711
+ return `intercept:${computeInterceptedBase(parent.urlPath, child.interceptionMarker ?? "(.)")}`;
1712
+ }
1713
+ /** Combined affix length of a node, read through its effective identity. */
1714
+ function affixLengthOf(node) {
1715
+ const { paramPrefix, paramSuffix } = effectiveUrlSegment(node);
1716
+ return (paramPrefix?.length ?? 0) + (paramSuffix?.length ?? 0);
1717
+ }
1718
+ /**
1719
+ * Collect affixed dynamic segments that are effective children of a node.
1720
+ * Route groups are URL-transparent, so we look through them recursively.
1721
+ *
1722
+ * Segments are read through `effectiveUrlSegment`, so an intercepting
1723
+ * directory counts as the affixed segment it intercepts: `(.)a-[id]` is
1724
+ * `a-[id]`. The proxy the slot resolver builds hands those affixes to
1725
+ * `matchUrlParts`, whose equal-length sort is not stable across equal
1726
+ * specificity — so two intercepting siblings with the same combined affix
1727
+ * length would resolve by filesystem enumeration order, which is precisely
1728
+ * what this validator exists to prevent for ordinary siblings (TIM-1288).
1729
+ */
1730
+ function collectEffectiveAffixed(node) {
1731
+ const result = [];
1732
+ for (const child of node.children) {
1733
+ const { segmentType, paramPrefix, paramSuffix } = effectiveUrlSegment(child);
1734
+ if (segmentType === "dynamic" && (paramPrefix || paramSuffix)) result.push(child);
1735
+ else if (segmentType === "group") result.push(...collectEffectiveAffixed(child));
1736
+ }
1737
+ return result;
1738
+ }
1739
+ /**
1740
+ * Find a fixed-extension file (proxy.ts) in a directory.
1741
+ */
1742
+ function findFixedFile(dirPath, name) {
1743
+ for (const ext of ["ts", "tsx"]) {
1744
+ const fullPath = join(dirPath, `${name}.${ext}`);
1745
+ try {
1746
+ if (statSync(fullPath).isFile()) return {
1747
+ filePath: fullPath,
1748
+ extension: ext
1749
+ };
1750
+ } catch {}
1751
+ }
1752
+ }
1753
+ /**
1754
+ * Find a file using the configured page extensions (tsx, ts, jsx, js, mdx, etc.).
1755
+ * Used for app-root conventions like global-error that aren't per-segment.
1756
+ */
1757
+ function findPageExtFile(dirPath, name, extSet) {
1758
+ for (const ext of extSet) {
1759
+ const fullPath = join(dirPath, `${name}.${ext}`);
1760
+ try {
1761
+ if (statSync(fullPath).isFile()) return {
1762
+ filePath: fullPath,
1763
+ extension: ext
1764
+ };
1765
+ } catch {}
1766
+ }
1767
+ }
1768
+ //#endregion
1769
+ export { matchUrlParts as i, scanRoutes as n, collectInterceptionRewrites as r, isRouteConventionFile as t };
1770
+
1771
+ //# sourceMappingURL=scanner-AiazgH_f.js.map