@timber-js/app 0.2.0-alpha.23 → 0.2.0-alpha.231

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