@colbymchenry/codegraph-win32-arm64 1.6.2 → 1.6.4

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 (1110) hide show
  1. package/bin/codegraph +1 -1
  2. package/bin/codegraph.cmd +1 -1
  3. package/lib/dist/.test-build-engine.json +1 -1
  4. package/lib/dist/.test-build-viewer.json +1 -1
  5. package/lib/dist/bin/codegraph.d.ts +3 -0
  6. package/lib/dist/bin/codegraph.d.ts.map +1 -1
  7. package/lib/dist/bin/codegraph.js +507 -702
  8. package/lib/dist/bin/codegraph.js.map +1 -1
  9. package/lib/dist/bin/command-supervision.js +1 -57
  10. package/lib/dist/bin/command-supervision.js.map +1 -1
  11. package/lib/dist/bin/fatal-handler.js +0 -46
  12. package/lib/dist/bin/fatal-handler.js.map +1 -1
  13. package/lib/dist/bin/node-version-check.js +0 -33
  14. package/lib/dist/bin/node-version-check.js.map +1 -1
  15. package/lib/dist/bin/uninstall.js +0 -19
  16. package/lib/dist/bin/uninstall.js.map +1 -1
  17. package/lib/dist/bin/viewer-gate.js +0 -14
  18. package/lib/dist/bin/viewer-gate.js.map +1 -1
  19. package/lib/dist/compile-cache.d.ts +2 -0
  20. package/lib/dist/compile-cache.d.ts.map +1 -0
  21. package/lib/dist/compile-cache.js +45 -0
  22. package/lib/dist/compile-cache.js.map +1 -0
  23. package/lib/dist/context/formatter.js +3 -66
  24. package/lib/dist/context/formatter.js.map +1 -1
  25. package/lib/dist/context/index.d.ts +44 -1
  26. package/lib/dist/context/index.d.ts.map +1 -1
  27. package/lib/dist/context/index.js +123 -430
  28. package/lib/dist/context/index.js.map +1 -1
  29. package/lib/dist/context/markers.js +0 -17
  30. package/lib/dist/context/markers.js.map +1 -1
  31. package/lib/dist/db/index.d.ts +44 -1
  32. package/lib/dist/db/index.d.ts.map +1 -1
  33. package/lib/dist/db/index.js +123 -395
  34. package/lib/dist/db/index.js.map +1 -1
  35. package/lib/dist/db/migrations.d.ts +11 -1
  36. package/lib/dist/db/migrations.d.ts.map +1 -1
  37. package/lib/dist/db/migrations.js +71 -79
  38. package/lib/dist/db/migrations.js.map +1 -1
  39. package/lib/dist/db/name-substring-index.d.ts +63 -0
  40. package/lib/dist/db/name-substring-index.d.ts.map +1 -0
  41. package/lib/dist/db/name-substring-index.js +151 -0
  42. package/lib/dist/db/name-substring-index.js.map +1 -0
  43. package/lib/dist/db/node-sqlite.d.ts +19 -0
  44. package/lib/dist/db/node-sqlite.d.ts.map +1 -0
  45. package/lib/dist/db/node-sqlite.js +23 -0
  46. package/lib/dist/db/node-sqlite.js.map +1 -0
  47. package/lib/dist/db/open-error.d.ts +36 -0
  48. package/lib/dist/db/open-error.d.ts.map +1 -0
  49. package/lib/dist/db/open-error.js +63 -0
  50. package/lib/dist/db/open-error.js.map +1 -0
  51. package/lib/dist/db/parameter-flow-queries.d.ts +120 -0
  52. package/lib/dist/db/parameter-flow-queries.d.ts.map +1 -0
  53. package/lib/dist/db/parameter-flow-queries.js +168 -0
  54. package/lib/dist/db/parameter-flow-queries.js.map +1 -0
  55. package/lib/dist/db/queries.d.ts +654 -34
  56. package/lib/dist/db/queries.d.ts.map +1 -1
  57. package/lib/dist/db/queries.js +1466 -1470
  58. package/lib/dist/db/queries.js.map +1 -1
  59. package/lib/dist/db/reference-tail.d.ts +83 -0
  60. package/lib/dist/db/reference-tail.d.ts.map +1 -0
  61. package/lib/dist/db/reference-tail.js +68 -0
  62. package/lib/dist/db/reference-tail.js.map +1 -0
  63. package/lib/dist/db/schema.sql +18 -2
  64. package/lib/dist/db/sqlite-adapter.d.ts +18 -1
  65. package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
  66. package/lib/dist/db/sqlite-adapter.js +12 -62
  67. package/lib/dist/db/sqlite-adapter.js.map +1 -1
  68. package/lib/dist/db/synthesis-stage.d.ts.map +1 -1
  69. package/lib/dist/db/synthesis-stage.js +2 -6
  70. package/lib/dist/db/synthesis-stage.js.map +1 -1
  71. package/lib/dist/db/wal-valve.js +1 -153
  72. package/lib/dist/db/wal-valve.js.map +1 -1
  73. package/lib/dist/db/wsl-shared-index.js +0 -37
  74. package/lib/dist/db/wsl-shared-index.js.map +1 -1
  75. package/lib/dist/directory.d.ts +51 -0
  76. package/lib/dist/directory.d.ts.map +1 -1
  77. package/lib/dist/directory.js +76 -530
  78. package/lib/dist/directory.js.map +1 -1
  79. package/lib/dist/engine.d.ts +15 -0
  80. package/lib/dist/engine.d.ts.map +1 -0
  81. package/lib/dist/engine.js +35 -0
  82. package/lib/dist/engine.js.map +1 -0
  83. package/lib/dist/errors.d.ts +10 -0
  84. package/lib/dist/errors.d.ts.map +1 -1
  85. package/lib/dist/errors.js +8 -101
  86. package/lib/dist/errors.js.map +1 -1
  87. package/lib/dist/extraction/astro-extractor.d.ts.map +1 -1
  88. package/lib/dist/extraction/astro-extractor.js +11 -101
  89. package/lib/dist/extraction/astro-extractor.js.map +1 -1
  90. package/lib/dist/extraction/cfml-extractor.d.ts +27 -1
  91. package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -1
  92. package/lib/dist/extraction/cfml-extractor.js +70 -206
  93. package/lib/dist/extraction/cfml-extractor.js.map +1 -1
  94. package/lib/dist/extraction/commonjs-requires.js +0 -31
  95. package/lib/dist/extraction/commonjs-requires.js.map +1 -1
  96. package/lib/dist/extraction/dfm-extractor.js +0 -21
  97. package/lib/dist/extraction/dfm-extractor.js.map +1 -1
  98. package/lib/dist/extraction/extraction-version.d.ts +1 -1
  99. package/lib/dist/extraction/extraction-version.js +1 -24
  100. package/lib/dist/extraction/extraction-version.js.map +1 -1
  101. package/lib/dist/extraction/function-ref.d.ts +40 -0
  102. package/lib/dist/extraction/function-ref.d.ts.map +1 -1
  103. package/lib/dist/extraction/function-ref.js +157 -207
  104. package/lib/dist/extraction/function-ref.js.map +1 -1
  105. package/lib/dist/extraction/generated-detection.js +0 -165
  106. package/lib/dist/extraction/generated-detection.js.map +1 -1
  107. package/lib/dist/extraction/grammars.d.ts +73 -4
  108. package/lib/dist/extraction/grammars.d.ts.map +1 -1
  109. package/lib/dist/extraction/grammars.js +160 -431
  110. package/lib/dist/extraction/grammars.js.map +1 -1
  111. package/lib/dist/extraction/index.d.ts +208 -7
  112. package/lib/dist/extraction/index.d.ts.map +1 -1
  113. package/lib/dist/extraction/index.js +594 -1383
  114. package/lib/dist/extraction/index.js.map +1 -1
  115. package/lib/dist/extraction/kernel/decode.js +0 -16
  116. package/lib/dist/extraction/kernel/decode.js.map +1 -1
  117. package/lib/dist/extraction/kernel/index.d.ts +3 -1
  118. package/lib/dist/extraction/kernel/index.d.ts.map +1 -1
  119. package/lib/dist/extraction/kernel/index.js +48 -135
  120. package/lib/dist/extraction/kernel/index.js.map +1 -1
  121. package/lib/dist/extraction/kernel/layout.js +42 -76
  122. package/lib/dist/extraction/kernel/layout.js.map +1 -1
  123. package/lib/dist/extraction/kernel/loader.d.ts +5 -1
  124. package/lib/dist/extraction/kernel/loader.d.ts.map +1 -1
  125. package/lib/dist/extraction/kernel/loader.js +0 -37
  126. package/lib/dist/extraction/kernel/loader.js.map +1 -1
  127. package/lib/dist/extraction/languages/arkts.js +0 -59
  128. package/lib/dist/extraction/languages/arkts.js.map +1 -1
  129. package/lib/dist/extraction/languages/c-cpp.d.ts +125 -28
  130. package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
  131. package/lib/dist/extraction/languages/c-cpp.js +789 -856
  132. package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
  133. package/lib/dist/extraction/languages/cfquery.js +0 -9
  134. package/lib/dist/extraction/languages/cfquery.js.map +1 -1
  135. package/lib/dist/extraction/languages/cfscript.d.ts +20 -0
  136. package/lib/dist/extraction/languages/cfscript.d.ts.map +1 -1
  137. package/lib/dist/extraction/languages/cfscript.js +80 -9
  138. package/lib/dist/extraction/languages/cfscript.js.map +1 -1
  139. package/lib/dist/extraction/languages/cobol.js +0 -114
  140. package/lib/dist/extraction/languages/cobol.js.map +1 -1
  141. package/lib/dist/extraction/languages/cpp-brace-scopes.d.ts +66 -0
  142. package/lib/dist/extraction/languages/cpp-brace-scopes.d.ts.map +1 -0
  143. package/lib/dist/extraction/languages/cpp-brace-scopes.js +343 -0
  144. package/lib/dist/extraction/languages/cpp-brace-scopes.js.map +1 -0
  145. package/lib/dist/extraction/languages/cpp-macro-methods.d.ts +41 -0
  146. package/lib/dist/extraction/languages/cpp-macro-methods.d.ts.map +1 -0
  147. package/lib/dist/extraction/languages/cpp-macro-methods.js +487 -0
  148. package/lib/dist/extraction/languages/cpp-macro-methods.js.map +1 -0
  149. package/lib/dist/extraction/languages/csharp.js +3 -55
  150. package/lib/dist/extraction/languages/csharp.js.map +1 -1
  151. package/lib/dist/extraction/languages/dart.d.ts +129 -0
  152. package/lib/dist/extraction/languages/dart.d.ts.map +1 -1
  153. package/lib/dist/extraction/languages/dart.js +517 -162
  154. package/lib/dist/extraction/languages/dart.js.map +1 -1
  155. package/lib/dist/extraction/languages/erlang.d.ts.map +1 -1
  156. package/lib/dist/extraction/languages/erlang.js +15 -102
  157. package/lib/dist/extraction/languages/erlang.js.map +1 -1
  158. package/lib/dist/extraction/languages/go.d.ts +48 -0
  159. package/lib/dist/extraction/languages/go.d.ts.map +1 -1
  160. package/lib/dist/extraction/languages/go.js +102 -31
  161. package/lib/dist/extraction/languages/go.js.map +1 -1
  162. package/lib/dist/extraction/languages/index.js +0 -6
  163. package/lib/dist/extraction/languages/index.js.map +1 -1
  164. package/lib/dist/extraction/languages/java.d.ts.map +1 -1
  165. package/lib/dist/extraction/languages/java.js +67 -78
  166. package/lib/dist/extraction/languages/java.js.map +1 -1
  167. package/lib/dist/extraction/languages/javascript.d.ts.map +1 -1
  168. package/lib/dist/extraction/languages/javascript.js +2 -12
  169. package/lib/dist/extraction/languages/javascript.js.map +1 -1
  170. package/lib/dist/extraction/languages/kotlin.d.ts +11 -0
  171. package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -1
  172. package/lib/dist/extraction/languages/kotlin.js +43 -197
  173. package/lib/dist/extraction/languages/kotlin.js.map +1 -1
  174. package/lib/dist/extraction/languages/lua.js +2 -39
  175. package/lib/dist/extraction/languages/lua.js.map +1 -1
  176. package/lib/dist/extraction/languages/luau.js +0 -14
  177. package/lib/dist/extraction/languages/luau.js.map +1 -1
  178. package/lib/dist/extraction/languages/nix.js +0 -16
  179. package/lib/dist/extraction/languages/nix.js.map +1 -1
  180. package/lib/dist/extraction/languages/objc.d.ts.map +1 -1
  181. package/lib/dist/extraction/languages/objc.js +5 -16
  182. package/lib/dist/extraction/languages/objc.js.map +1 -1
  183. package/lib/dist/extraction/languages/pascal-preparse.d.ts +66 -0
  184. package/lib/dist/extraction/languages/pascal-preparse.d.ts.map +1 -0
  185. package/lib/dist/extraction/languages/pascal-preparse.js +958 -0
  186. package/lib/dist/extraction/languages/pascal-preparse.js.map +1 -0
  187. package/lib/dist/extraction/languages/pascal-system.d.ts +11 -0
  188. package/lib/dist/extraction/languages/pascal-system.d.ts.map +1 -0
  189. package/lib/dist/extraction/languages/pascal-system.js +23 -0
  190. package/lib/dist/extraction/languages/pascal-system.js.map +1 -0
  191. package/lib/dist/extraction/languages/pascal.d.ts.map +1 -1
  192. package/lib/dist/extraction/languages/pascal.js +3 -4
  193. package/lib/dist/extraction/languages/pascal.js.map +1 -1
  194. package/lib/dist/extraction/languages/php.d.ts +9 -0
  195. package/lib/dist/extraction/languages/php.d.ts.map +1 -1
  196. package/lib/dist/extraction/languages/php.js +207 -44
  197. package/lib/dist/extraction/languages/php.js.map +1 -1
  198. package/lib/dist/extraction/languages/python.js +2 -20
  199. package/lib/dist/extraction/languages/python.js.map +1 -1
  200. package/lib/dist/extraction/languages/r.js +8 -78
  201. package/lib/dist/extraction/languages/r.js.map +1 -1
  202. package/lib/dist/extraction/languages/ruby.d.ts.map +1 -1
  203. package/lib/dist/extraction/languages/ruby.js +17 -25
  204. package/lib/dist/extraction/languages/ruby.js.map +1 -1
  205. package/lib/dist/extraction/languages/rust-macro-calls.d.ts +32 -0
  206. package/lib/dist/extraction/languages/rust-macro-calls.d.ts.map +1 -0
  207. package/lib/dist/extraction/languages/rust-macro-calls.js +306 -0
  208. package/lib/dist/extraction/languages/rust-macro-calls.js.map +1 -0
  209. package/lib/dist/extraction/languages/rust.d.ts +10 -0
  210. package/lib/dist/extraction/languages/rust.d.ts.map +1 -1
  211. package/lib/dist/extraction/languages/rust.js +15 -47
  212. package/lib/dist/extraction/languages/rust.js.map +1 -1
  213. package/lib/dist/extraction/languages/scala.js +5 -41
  214. package/lib/dist/extraction/languages/scala.js.map +1 -1
  215. package/lib/dist/extraction/languages/solidity.js +1 -82
  216. package/lib/dist/extraction/languages/solidity.js.map +1 -1
  217. package/lib/dist/extraction/languages/swift.js +3 -47
  218. package/lib/dist/extraction/languages/swift.js.map +1 -1
  219. package/lib/dist/extraction/languages/terraform.js +6 -152
  220. package/lib/dist/extraction/languages/terraform.js.map +1 -1
  221. package/lib/dist/extraction/languages/typescript.d.ts +64 -0
  222. package/lib/dist/extraction/languages/typescript.d.ts.map +1 -1
  223. package/lib/dist/extraction/languages/typescript.js +73 -49
  224. package/lib/dist/extraction/languages/typescript.js.map +1 -1
  225. package/lib/dist/extraction/languages/vbnet.d.ts.map +1 -1
  226. package/lib/dist/extraction/languages/vbnet.js +9 -42
  227. package/lib/dist/extraction/languages/vbnet.js.map +1 -1
  228. package/lib/dist/extraction/lazy-frameworks.d.ts +15 -0
  229. package/lib/dist/extraction/lazy-frameworks.d.ts.map +1 -0
  230. package/lib/dist/extraction/lazy-frameworks.js +8 -0
  231. package/lib/dist/extraction/lazy-frameworks.js.map +1 -0
  232. package/lib/dist/extraction/liquid-extractor.d.ts +29 -3
  233. package/lib/dist/extraction/liquid-extractor.d.ts.map +1 -1
  234. package/lib/dist/extraction/liquid-extractor.js +89 -148
  235. package/lib/dist/extraction/liquid-extractor.js.map +1 -1
  236. package/lib/dist/extraction/mybatis-extractor.js +0 -78
  237. package/lib/dist/extraction/mybatis-extractor.js.map +1 -1
  238. package/lib/dist/extraction/parse-budget.d.ts +42 -7
  239. package/lib/dist/extraction/parse-budget.d.ts.map +1 -1
  240. package/lib/dist/extraction/parse-budget.js +39 -15
  241. package/lib/dist/extraction/parse-budget.js.map +1 -1
  242. package/lib/dist/extraction/parse-pool.d.ts +29 -17
  243. package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
  244. package/lib/dist/extraction/parse-pool.js +49 -193
  245. package/lib/dist/extraction/parse-pool.js.map +1 -1
  246. package/lib/dist/extraction/parse-worker.d.ts +1 -1
  247. package/lib/dist/extraction/parse-worker.d.ts.map +1 -1
  248. package/lib/dist/extraction/parse-worker.js +5 -58
  249. package/lib/dist/extraction/parse-worker.js.map +1 -1
  250. package/lib/dist/extraction/razor-extractor.d.ts +9 -0
  251. package/lib/dist/extraction/razor-extractor.d.ts.map +1 -1
  252. package/lib/dist/extraction/razor-extractor.js +45 -69
  253. package/lib/dist/extraction/razor-extractor.js.map +1 -1
  254. package/lib/dist/extraction/razor-script.d.ts +23 -0
  255. package/lib/dist/extraction/razor-script.d.ts.map +1 -0
  256. package/lib/dist/extraction/razor-script.js +244 -0
  257. package/lib/dist/extraction/razor-script.js.map +1 -0
  258. package/lib/dist/extraction/sfc-script.d.ts +42 -0
  259. package/lib/dist/extraction/sfc-script.d.ts.map +1 -1
  260. package/lib/dist/extraction/sfc-script.js +32 -31
  261. package/lib/dist/extraction/sfc-script.js.map +1 -1
  262. package/lib/dist/extraction/store-worker.d.ts +1 -1
  263. package/lib/dist/extraction/store-worker.d.ts.map +1 -1
  264. package/lib/dist/extraction/store-worker.js +1 -38
  265. package/lib/dist/extraction/store-worker.js.map +1 -1
  266. package/lib/dist/extraction/store-writer.js +2 -34
  267. package/lib/dist/extraction/store-writer.js.map +1 -1
  268. package/lib/dist/extraction/svelte-extractor.d.ts.map +1 -1
  269. package/lib/dist/extraction/svelte-extractor.js +11 -87
  270. package/lib/dist/extraction/svelte-extractor.js.map +1 -1
  271. package/lib/dist/extraction/syntax-tokens.d.ts +6 -5
  272. package/lib/dist/extraction/syntax-tokens.d.ts.map +1 -1
  273. package/lib/dist/extraction/syntax-tokens.js +4 -152
  274. package/lib/dist/extraction/syntax-tokens.js.map +1 -1
  275. package/lib/dist/extraction/tree-sitter-helpers.d.ts +37 -1
  276. package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
  277. package/lib/dist/extraction/tree-sitter-helpers.js +76 -68
  278. package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -1
  279. package/lib/dist/extraction/tree-sitter-types.d.ts +102 -22
  280. package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
  281. package/lib/dist/extraction/tree-sitter-types.js +0 -7
  282. package/lib/dist/extraction/tree-sitter-types.js.map +1 -1
  283. package/lib/dist/extraction/tree-sitter.d.ts +518 -10
  284. package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
  285. package/lib/dist/extraction/tree-sitter.js +2118 -2554
  286. package/lib/dist/extraction/tree-sitter.js.map +1 -1
  287. package/lib/dist/extraction/vue-extractor.d.ts +13 -0
  288. package/lib/dist/extraction/vue-extractor.d.ts.map +1 -1
  289. package/lib/dist/extraction/vue-extractor.js +52 -92
  290. package/lib/dist/extraction/vue-extractor.js.map +1 -1
  291. package/lib/dist/extraction/vue-options-api.js +0 -32
  292. package/lib/dist/extraction/vue-options-api.js.map +1 -1
  293. package/lib/dist/extraction/vue-template-calls.d.ts +37 -0
  294. package/lib/dist/extraction/vue-template-calls.d.ts.map +1 -0
  295. package/lib/dist/extraction/vue-template-calls.js +497 -0
  296. package/lib/dist/extraction/vue-template-calls.js.map +1 -0
  297. package/lib/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
  298. package/lib/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
  299. package/lib/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
  300. package/lib/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
  301. package/lib/dist/extraction/wasm-runtime-flags.d.ts +15 -0
  302. package/lib/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
  303. package/lib/dist/extraction/wasm-runtime-flags.js +18 -89
  304. package/lib/dist/extraction/wasm-runtime-flags.js.map +1 -1
  305. package/lib/dist/file-limits.d.ts +8 -0
  306. package/lib/dist/file-limits.d.ts.map +1 -1
  307. package/lib/dist/file-limits.js +13 -28
  308. package/lib/dist/file-limits.js.map +1 -1
  309. package/lib/dist/graph/branch-guards.d.ts.map +1 -1
  310. package/lib/dist/graph/branch-guards.js +4 -251
  311. package/lib/dist/graph/branch-guards.js.map +1 -1
  312. package/lib/dist/graph/call-sites.d.ts +12 -0
  313. package/lib/dist/graph/call-sites.d.ts.map +1 -0
  314. package/lib/dist/graph/call-sites.js +17 -0
  315. package/lib/dist/graph/call-sites.js.map +1 -0
  316. package/lib/dist/graph/cobol-copybooks.d.ts +75 -0
  317. package/lib/dist/graph/cobol-copybooks.d.ts.map +1 -0
  318. package/lib/dist/graph/cobol-copybooks.js +45 -0
  319. package/lib/dist/graph/cobol-copybooks.js.map +1 -0
  320. package/lib/dist/graph/dead-code.d.ts +26 -4
  321. package/lib/dist/graph/dead-code.d.ts.map +1 -1
  322. package/lib/dist/graph/dead-code.js +157 -311
  323. package/lib/dist/graph/dead-code.js.map +1 -1
  324. package/lib/dist/graph/dynamic-boundary-report.js +1 -88
  325. package/lib/dist/graph/dynamic-boundary-report.js.map +1 -1
  326. package/lib/dist/graph/file-cycles.d.ts +20 -0
  327. package/lib/dist/graph/file-cycles.d.ts.map +1 -0
  328. package/lib/dist/graph/file-cycles.js +79 -0
  329. package/lib/dist/graph/file-cycles.js.map +1 -0
  330. package/lib/dist/graph/file-drift.d.ts +35 -0
  331. package/lib/dist/graph/file-drift.d.ts.map +1 -0
  332. package/lib/dist/graph/file-drift.js +46 -0
  333. package/lib/dist/graph/file-drift.js.map +1 -0
  334. package/lib/dist/graph/go-package.d.ts +27 -0
  335. package/lib/dist/graph/go-package.d.ts.map +1 -0
  336. package/lib/dist/graph/go-package.js +49 -0
  337. package/lib/dist/graph/go-package.js.map +1 -0
  338. package/lib/dist/graph/index.d.ts +2 -0
  339. package/lib/dist/graph/index.d.ts.map +1 -1
  340. package/lib/dist/graph/index.js +4 -6
  341. package/lib/dist/graph/index.js.map +1 -1
  342. package/lib/dist/graph/named-symbol-flow.d.ts +5 -1
  343. package/lib/dist/graph/named-symbol-flow.d.ts.map +1 -1
  344. package/lib/dist/graph/named-symbol-flow.js +82 -223
  345. package/lib/dist/graph/named-symbol-flow.js.map +1 -1
  346. package/lib/dist/graph/owning-package.d.ts +59 -0
  347. package/lib/dist/graph/owning-package.d.ts.map +1 -0
  348. package/lib/dist/graph/owning-package.js +120 -0
  349. package/lib/dist/graph/owning-package.js.map +1 -0
  350. package/lib/dist/graph/queries.d.ts +6 -3
  351. package/lib/dist/graph/queries.d.ts.map +1 -1
  352. package/lib/dist/graph/queries.js +4 -137
  353. package/lib/dist/graph/queries.js.map +1 -1
  354. package/lib/dist/graph/symbol-lookup.d.ts +15 -3
  355. package/lib/dist/graph/symbol-lookup.d.ts.map +1 -1
  356. package/lib/dist/graph/symbol-lookup.js +47 -89
  357. package/lib/dist/graph/symbol-lookup.js.map +1 -1
  358. package/lib/dist/graph/symbol-references.d.ts +86 -0
  359. package/lib/dist/graph/symbol-references.d.ts.map +1 -0
  360. package/lib/dist/graph/symbol-references.js +304 -0
  361. package/lib/dist/graph/symbol-references.js.map +1 -0
  362. package/lib/dist/graph/synthesized-hop.d.ts +37 -0
  363. package/lib/dist/graph/synthesized-hop.d.ts.map +1 -0
  364. package/lib/dist/graph/synthesized-hop.js +62 -0
  365. package/lib/dist/graph/synthesized-hop.js.map +1 -0
  366. package/lib/dist/graph/test-code.d.ts +33 -0
  367. package/lib/dist/graph/test-code.d.ts.map +1 -0
  368. package/lib/dist/graph/test-code.js +104 -0
  369. package/lib/dist/graph/test-code.js.map +1 -0
  370. package/lib/dist/graph/traversal.d.ts +31 -2
  371. package/lib/dist/graph/traversal.d.ts.map +1 -1
  372. package/lib/dist/graph/traversal.js +96 -226
  373. package/lib/dist/graph/traversal.js.map +1 -1
  374. package/lib/dist/graph/type-hierarchy.js +0 -138
  375. package/lib/dist/graph/type-hierarchy.js.map +1 -1
  376. package/lib/dist/index.d.ts +214 -26
  377. package/lib/dist/index.d.ts.map +1 -1
  378. package/lib/dist/index.js +736 -1112
  379. package/lib/dist/index.js.map +1 -1
  380. package/lib/dist/installer/beta-signup.js +0 -39
  381. package/lib/dist/installer/beta-signup.js.map +1 -1
  382. package/lib/dist/installer/config-writer.js +0 -24
  383. package/lib/dist/installer/config-writer.js.map +1 -1
  384. package/lib/dist/installer/index.d.ts +13 -6
  385. package/lib/dist/installer/index.d.ts.map +1 -1
  386. package/lib/dist/installer/index.js +27 -160
  387. package/lib/dist/installer/index.js.map +1 -1
  388. package/lib/dist/installer/instructions-template.d.ts +16 -1
  389. package/lib/dist/installer/instructions-template.d.ts.map +1 -1
  390. package/lib/dist/installer/instructions-template.js +10 -38
  391. package/lib/dist/installer/instructions-template.js.map +1 -1
  392. package/lib/dist/installer/targets/antigravity.js +0 -113
  393. package/lib/dist/installer/targets/antigravity.js.map +1 -1
  394. package/lib/dist/installer/targets/bob.d.ts +20 -0
  395. package/lib/dist/installer/targets/bob.d.ts.map +1 -0
  396. package/lib/dist/installer/targets/bob.js +83 -0
  397. package/lib/dist/installer/targets/bob.js.map +1 -0
  398. package/lib/dist/installer/targets/claude.d.ts.map +1 -1
  399. package/lib/dist/installer/targets/claude.js +1 -185
  400. package/lib/dist/installer/targets/claude.js.map +1 -1
  401. package/lib/dist/installer/targets/codex.d.ts.map +1 -1
  402. package/lib/dist/installer/targets/codex.js +17 -109
  403. package/lib/dist/installer/targets/codex.js.map +1 -1
  404. package/lib/dist/installer/targets/copilot-cli.d.ts.map +1 -1
  405. package/lib/dist/installer/targets/copilot-cli.js +2 -54
  406. package/lib/dist/installer/targets/copilot-cli.js.map +1 -1
  407. package/lib/dist/installer/targets/copilot-jetbrains.js +0 -57
  408. package/lib/dist/installer/targets/copilot-jetbrains.js.map +1 -1
  409. package/lib/dist/installer/targets/copilot-vscode.js +0 -58
  410. package/lib/dist/installer/targets/copilot-vscode.js.map +1 -1
  411. package/lib/dist/installer/targets/cursor.js +7 -88
  412. package/lib/dist/installer/targets/cursor.js.map +1 -1
  413. package/lib/dist/installer/targets/droid.d.ts +18 -0
  414. package/lib/dist/installer/targets/droid.d.ts.map +1 -0
  415. package/lib/dist/installer/targets/droid.js +92 -0
  416. package/lib/dist/installer/targets/droid.js.map +1 -0
  417. package/lib/dist/installer/targets/dsh.d.ts +35 -0
  418. package/lib/dist/installer/targets/dsh.d.ts.map +1 -0
  419. package/lib/dist/installer/targets/dsh.js +267 -0
  420. package/lib/dist/installer/targets/dsh.js.map +1 -0
  421. package/lib/dist/installer/targets/gemini.js +0 -37
  422. package/lib/dist/installer/targets/gemini.js.map +1 -1
  423. package/lib/dist/installer/targets/grok.d.ts +25 -0
  424. package/lib/dist/installer/targets/grok.d.ts.map +1 -0
  425. package/lib/dist/installer/targets/grok.js +96 -0
  426. package/lib/dist/installer/targets/grok.js.map +1 -0
  427. package/lib/dist/installer/targets/hermes.d.ts +19 -7
  428. package/lib/dist/installer/targets/hermes.d.ts.map +1 -1
  429. package/lib/dist/installer/targets/hermes.js +218 -214
  430. package/lib/dist/installer/targets/hermes.js.map +1 -1
  431. package/lib/dist/installer/targets/json-config.d.ts +45 -0
  432. package/lib/dist/installer/targets/json-config.d.ts.map +1 -0
  433. package/lib/dist/installer/targets/json-config.js +128 -0
  434. package/lib/dist/installer/targets/json-config.js.map +1 -0
  435. package/lib/dist/installer/targets/kimi.d.ts +21 -0
  436. package/lib/dist/installer/targets/kimi.d.ts.map +1 -0
  437. package/lib/dist/installer/targets/kimi.js +97 -0
  438. package/lib/dist/installer/targets/kimi.js.map +1 -0
  439. package/lib/dist/installer/targets/kiro.js +1 -41
  440. package/lib/dist/installer/targets/kiro.js.map +1 -1
  441. package/lib/dist/installer/targets/opencode.d.ts.map +1 -1
  442. package/lib/dist/installer/targets/opencode.js +1 -103
  443. package/lib/dist/installer/targets/opencode.js.map +1 -1
  444. package/lib/dist/installer/targets/pi.d.ts +24 -0
  445. package/lib/dist/installer/targets/pi.d.ts.map +1 -0
  446. package/lib/dist/installer/targets/pi.js +100 -0
  447. package/lib/dist/installer/targets/pi.js.map +1 -0
  448. package/lib/dist/installer/targets/qoder.d.ts +23 -0
  449. package/lib/dist/installer/targets/qoder.d.ts.map +1 -0
  450. package/lib/dist/installer/targets/qoder.js +83 -0
  451. package/lib/dist/installer/targets/qoder.js.map +1 -0
  452. package/lib/dist/installer/targets/qwen.d.ts +21 -0
  453. package/lib/dist/installer/targets/qwen.d.ts.map +1 -0
  454. package/lib/dist/installer/targets/qwen.js +115 -0
  455. package/lib/dist/installer/targets/qwen.js.map +1 -0
  456. package/lib/dist/installer/targets/registry.d.ts.map +1 -1
  457. package/lib/dist/installer/targets/registry.js +18 -25
  458. package/lib/dist/installer/targets/registry.js.map +1 -1
  459. package/lib/dist/installer/targets/shared.d.ts +83 -13
  460. package/lib/dist/installer/targets/shared.d.ts.map +1 -1
  461. package/lib/dist/installer/targets/shared.js +201 -131
  462. package/lib/dist/installer/targets/shared.js.map +1 -1
  463. package/lib/dist/installer/targets/toml.d.ts +82 -6
  464. package/lib/dist/installer/targets/toml.d.ts.map +1 -1
  465. package/lib/dist/installer/targets/toml.js +318 -112
  466. package/lib/dist/installer/targets/toml.js.map +1 -1
  467. package/lib/dist/installer/targets/types.d.ts +1 -1
  468. package/lib/dist/installer/targets/types.d.ts.map +1 -1
  469. package/lib/dist/installer/targets/types.js +0 -13
  470. package/lib/dist/installer/targets/types.js.map +1 -1
  471. package/lib/dist/installer/targets/windsurf.d.ts +22 -0
  472. package/lib/dist/installer/targets/windsurf.d.ts.map +1 -0
  473. package/lib/dist/installer/targets/windsurf.js +90 -0
  474. package/lib/dist/installer/targets/windsurf.js.map +1 -0
  475. package/lib/dist/lazy-engine.d.ts +22 -0
  476. package/lib/dist/lazy-engine.d.ts.map +1 -0
  477. package/lib/dist/lazy-engine.js +16 -0
  478. package/lib/dist/lazy-engine.js.map +1 -0
  479. package/lib/dist/mcp/answer-freshness.js +0 -6
  480. package/lib/dist/mcp/answer-freshness.js.map +1 -1
  481. package/lib/dist/mcp/daemon-manager.js +2 -23
  482. package/lib/dist/mcp/daemon-manager.js.map +1 -1
  483. package/lib/dist/mcp/daemon-paths.d.ts +2 -0
  484. package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
  485. package/lib/dist/mcp/daemon-paths.js +9 -85
  486. package/lib/dist/mcp/daemon-paths.js.map +1 -1
  487. package/lib/dist/mcp/daemon-proof.d.ts +19 -0
  488. package/lib/dist/mcp/daemon-proof.d.ts.map +1 -0
  489. package/lib/dist/mcp/daemon-proof.js +126 -0
  490. package/lib/dist/mcp/daemon-proof.js.map +1 -0
  491. package/lib/dist/mcp/daemon-registry.d.ts +47 -2
  492. package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
  493. package/lib/dist/mcp/daemon-registry.js +188 -139
  494. package/lib/dist/mcp/daemon-registry.js.map +1 -1
  495. package/lib/dist/mcp/daemon.d.ts +69 -0
  496. package/lib/dist/mcp/daemon.d.ts.map +1 -1
  497. package/lib/dist/mcp/daemon.js +186 -376
  498. package/lib/dist/mcp/daemon.js.map +1 -1
  499. package/lib/dist/mcp/dynamic-boundaries.js +4 -78
  500. package/lib/dist/mcp/dynamic-boundaries.js.map +1 -1
  501. package/lib/dist/mcp/early-ppid.js +0 -24
  502. package/lib/dist/mcp/early-ppid.js.map +1 -1
  503. package/lib/dist/mcp/engine.d.ts +24 -0
  504. package/lib/dist/mcp/engine.d.ts.map +1 -1
  505. package/lib/dist/mcp/engine.js +47 -152
  506. package/lib/dist/mcp/engine.js.map +1 -1
  507. package/lib/dist/mcp/explore-dedup.js +0 -108
  508. package/lib/dist/mcp/explore-dedup.js.map +1 -1
  509. package/lib/dist/mcp/explore-diagnostics.d.ts +6 -0
  510. package/lib/dist/mcp/explore-diagnostics.d.ts.map +1 -1
  511. package/lib/dist/mcp/explore-diagnostics.js +8 -116
  512. package/lib/dist/mcp/explore-diagnostics.js.map +1 -1
  513. package/lib/dist/mcp/explore-one-symbol.d.ts +77 -0
  514. package/lib/dist/mcp/explore-one-symbol.d.ts.map +1 -0
  515. package/lib/dist/mcp/explore-one-symbol.js +431 -0
  516. package/lib/dist/mcp/explore-one-symbol.js.map +1 -0
  517. package/lib/dist/mcp/explore-session-state.js +0 -129
  518. package/lib/dist/mcp/explore-session-state.js.map +1 -1
  519. package/lib/dist/mcp/hook-client.d.ts +44 -0
  520. package/lib/dist/mcp/hook-client.d.ts.map +1 -0
  521. package/lib/dist/mcp/hook-client.js +202 -0
  522. package/lib/dist/mcp/hook-client.js.map +1 -0
  523. package/lib/dist/mcp/index-freshness-worker.js +1 -6
  524. package/lib/dist/mcp/index-freshness-worker.js.map +1 -1
  525. package/lib/dist/mcp/index-freshness.js +0 -15
  526. package/lib/dist/mcp/index-freshness.js.map +1 -1
  527. package/lib/dist/mcp/index-version-warning.d.ts +21 -0
  528. package/lib/dist/mcp/index-version-warning.d.ts.map +1 -0
  529. package/lib/dist/mcp/index-version-warning.js +38 -0
  530. package/lib/dist/mcp/index-version-warning.js.map +1 -0
  531. package/lib/dist/mcp/index.d.ts +29 -1
  532. package/lib/dist/mcp/index.d.ts.map +1 -1
  533. package/lib/dist/mcp/index.js +131 -300
  534. package/lib/dist/mcp/index.js.map +1 -1
  535. package/lib/dist/mcp/liveness-watchdog.d.ts +13 -3
  536. package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
  537. package/lib/dist/mcp/liveness-watchdog.js +106 -121
  538. package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
  539. package/lib/dist/mcp/opencode-tool-names.d.ts +32 -0
  540. package/lib/dist/mcp/opencode-tool-names.d.ts.map +1 -0
  541. package/lib/dist/mcp/opencode-tool-names.js +24 -0
  542. package/lib/dist/mcp/opencode-tool-names.js.map +1 -0
  543. package/lib/dist/mcp/ppid-watchdog.js +0 -24
  544. package/lib/dist/mcp/ppid-watchdog.js.map +1 -1
  545. package/lib/dist/mcp/process-identity.d.ts +42 -0
  546. package/lib/dist/mcp/process-identity.d.ts.map +1 -0
  547. package/lib/dist/mcp/process-identity.js +130 -0
  548. package/lib/dist/mcp/process-identity.js.map +1 -0
  549. package/lib/dist/mcp/project-lifecycle.d.ts +6 -0
  550. package/lib/dist/mcp/project-lifecycle.d.ts.map +1 -1
  551. package/lib/dist/mcp/project-lifecycle.js +70 -19
  552. package/lib/dist/mcp/project-lifecycle.js.map +1 -1
  553. package/lib/dist/mcp/prompt-explore.d.ts +19 -0
  554. package/lib/dist/mcp/prompt-explore.d.ts.map +1 -0
  555. package/lib/dist/mcp/prompt-explore.js +6 -0
  556. package/lib/dist/mcp/prompt-explore.js.map +1 -0
  557. package/lib/dist/mcp/proxy.d.ts +25 -7
  558. package/lib/dist/mcp/proxy.d.ts.map +1 -1
  559. package/lib/dist/mcp/proxy.js +145 -274
  560. package/lib/dist/mcp/proxy.js.map +1 -1
  561. package/lib/dist/mcp/query-pool.d.ts +52 -3
  562. package/lib/dist/mcp/query-pool.d.ts.map +1 -1
  563. package/lib/dist/mcp/query-pool.js +114 -123
  564. package/lib/dist/mcp/query-pool.js.map +1 -1
  565. package/lib/dist/mcp/query-worker.js +24 -36
  566. package/lib/dist/mcp/query-worker.js.map +1 -1
  567. package/lib/dist/mcp/server-instructions.d.ts +18 -0
  568. package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
  569. package/lib/dist/mcp/server-instructions.js +12 -32
  570. package/lib/dist/mcp/server-instructions.js.map +1 -1
  571. package/lib/dist/mcp/session.d.ts +46 -0
  572. package/lib/dist/mcp/session.d.ts.map +1 -1
  573. package/lib/dist/mcp/session.js +70 -132
  574. package/lib/dist/mcp/session.js.map +1 -1
  575. package/lib/dist/mcp/startup-handshake.js +1 -48
  576. package/lib/dist/mcp/startup-handshake.js.map +1 -1
  577. package/lib/dist/mcp/stdin-teardown.js +0 -28
  578. package/lib/dist/mcp/stdin-teardown.js.map +1 -1
  579. package/lib/dist/mcp/stdout-teardown.d.ts +26 -0
  580. package/lib/dist/mcp/stdout-teardown.d.ts.map +1 -0
  581. package/lib/dist/mcp/stdout-teardown.js +20 -0
  582. package/lib/dist/mcp/stdout-teardown.js.map +1 -0
  583. package/lib/dist/mcp/tools.d.ts +157 -18
  584. package/lib/dist/mcp/tools.d.ts.map +1 -1
  585. package/lib/dist/mcp/tools.js +797 -3621
  586. package/lib/dist/mcp/tools.js.map +1 -1
  587. package/lib/dist/mcp/transport.d.ts.map +1 -1
  588. package/lib/dist/mcp/transport.js +4 -96
  589. package/lib/dist/mcp/transport.js.map +1 -1
  590. package/lib/dist/mcp/version.d.ts +13 -1
  591. package/lib/dist/mcp/version.d.ts.map +1 -1
  592. package/lib/dist/mcp/version.js +19 -21
  593. package/lib/dist/mcp/version.js.map +1 -1
  594. package/lib/dist/mcp/writer-lock.d.ts +11 -0
  595. package/lib/dist/mcp/writer-lock.d.ts.map +1 -1
  596. package/lib/dist/mcp/writer-lock.js +49 -46
  597. package/lib/dist/mcp/writer-lock.js.map +1 -1
  598. package/lib/dist/project-config.d.ts +20 -0
  599. package/lib/dist/project-config.d.ts.map +1 -1
  600. package/lib/dist/project-config.js +31 -140
  601. package/lib/dist/project-config.js.map +1 -1
  602. package/lib/dist/resolution/alias-binding.d.ts +7 -0
  603. package/lib/dist/resolution/alias-binding.d.ts.map +1 -1
  604. package/lib/dist/resolution/alias-binding.js +7 -56
  605. package/lib/dist/resolution/alias-binding.js.map +1 -1
  606. package/lib/dist/resolution/ambient-modules.d.ts +185 -0
  607. package/lib/dist/resolution/ambient-modules.d.ts.map +1 -0
  608. package/lib/dist/resolution/ambient-modules.js +732 -0
  609. package/lib/dist/resolution/ambient-modules.js.map +1 -0
  610. package/lib/dist/resolution/angular-template-synthesizer.d.ts +48 -1
  611. package/lib/dist/resolution/angular-template-synthesizer.d.ts.map +1 -1
  612. package/lib/dist/resolution/angular-template-synthesizer.js +401 -65
  613. package/lib/dist/resolution/angular-template-synthesizer.js.map +1 -1
  614. package/lib/dist/resolution/c-feature-variants.d.ts +40 -0
  615. package/lib/dist/resolution/c-feature-variants.d.ts.map +1 -0
  616. package/lib/dist/resolution/c-feature-variants.js +249 -0
  617. package/lib/dist/resolution/c-feature-variants.js.map +1 -0
  618. package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
  619. package/lib/dist/resolution/c-fnptr-synthesizer.js +23 -391
  620. package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
  621. package/lib/dist/resolution/c-macro-renames.d.ts +25 -0
  622. package/lib/dist/resolution/c-macro-renames.d.ts.map +1 -0
  623. package/lib/dist/resolution/c-macro-renames.js +95 -0
  624. package/lib/dist/resolution/c-macro-renames.js.map +1 -0
  625. package/lib/dist/resolution/callback-synthesizer.d.ts +19 -5
  626. package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
  627. package/lib/dist/resolution/callback-synthesizer.js +1395 -1343
  628. package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
  629. package/lib/dist/resolution/const-alias-synthesizer.d.ts +48 -0
  630. package/lib/dist/resolution/const-alias-synthesizer.d.ts.map +1 -0
  631. package/lib/dist/resolution/const-alias-synthesizer.js +234 -0
  632. package/lib/dist/resolution/const-alias-synthesizer.js.map +1 -0
  633. package/lib/dist/resolution/cooperative-yield.js +0 -27
  634. package/lib/dist/resolution/cooperative-yield.js.map +1 -1
  635. package/lib/dist/resolution/cpp-constructor.d.ts.map +1 -1
  636. package/lib/dist/resolution/cpp-constructor.js +15 -17
  637. package/lib/dist/resolution/cpp-constructor.js.map +1 -1
  638. package/lib/dist/resolution/cpp-includers.d.ts +46 -0
  639. package/lib/dist/resolution/cpp-includers.d.ts.map +1 -0
  640. package/lib/dist/resolution/cpp-includers.js +153 -0
  641. package/lib/dist/resolution/cpp-includers.js.map +1 -0
  642. package/lib/dist/resolution/cpp-macro-visibility.d.ts +16 -0
  643. package/lib/dist/resolution/cpp-macro-visibility.d.ts.map +1 -1
  644. package/lib/dist/resolution/cpp-macro-visibility.js +17 -68
  645. package/lib/dist/resolution/cpp-macro-visibility.js.map +1 -1
  646. package/lib/dist/resolution/cpp-namespaces.d.ts +54 -0
  647. package/lib/dist/resolution/cpp-namespaces.d.ts.map +1 -0
  648. package/lib/dist/resolution/cpp-namespaces.js +151 -0
  649. package/lib/dist/resolution/cpp-namespaces.js.map +1 -0
  650. package/lib/dist/resolution/cpp-raw-strings.d.ts +33 -0
  651. package/lib/dist/resolution/cpp-raw-strings.d.ts.map +1 -0
  652. package/lib/dist/resolution/cpp-raw-strings.js +167 -0
  653. package/lib/dist/resolution/cpp-raw-strings.js.map +1 -0
  654. package/lib/dist/resolution/cpp-supertypes.d.ts +118 -0
  655. package/lib/dist/resolution/cpp-supertypes.d.ts.map +1 -0
  656. package/lib/dist/resolution/cpp-supertypes.js +322 -0
  657. package/lib/dist/resolution/cpp-supertypes.js.map +1 -0
  658. package/lib/dist/resolution/cpp-template-instantiations.d.ts +83 -0
  659. package/lib/dist/resolution/cpp-template-instantiations.d.ts.map +1 -0
  660. package/lib/dist/resolution/cpp-template-instantiations.js +983 -0
  661. package/lib/dist/resolution/cpp-template-instantiations.js.map +1 -0
  662. package/lib/dist/resolution/cpp-type-aliases.d.ts +194 -0
  663. package/lib/dist/resolution/cpp-type-aliases.d.ts.map +1 -0
  664. package/lib/dist/resolution/cpp-type-aliases.js +648 -0
  665. package/lib/dist/resolution/cpp-type-aliases.js.map +1 -0
  666. package/lib/dist/resolution/dart-libraries.d.ts +75 -0
  667. package/lib/dist/resolution/dart-libraries.d.ts.map +1 -0
  668. package/lib/dist/resolution/dart-libraries.js +721 -0
  669. package/lib/dist/resolution/dart-libraries.js.map +1 -0
  670. package/lib/dist/resolution/dart-local-scope.d.ts +41 -0
  671. package/lib/dist/resolution/dart-local-scope.d.ts.map +1 -0
  672. package/lib/dist/resolution/dart-local-scope.js +565 -0
  673. package/lib/dist/resolution/dart-local-scope.js.map +1 -0
  674. package/lib/dist/resolution/event-emitter-synthesizer.d.ts +39 -0
  675. package/lib/dist/resolution/event-emitter-synthesizer.d.ts.map +1 -0
  676. package/lib/dist/resolution/event-emitter-synthesizer.js +656 -0
  677. package/lib/dist/resolution/event-emitter-synthesizer.js.map +1 -0
  678. package/lib/dist/resolution/expo-router-synthesizer.js +0 -52
  679. package/lib/dist/resolution/expo-router-synthesizer.js.map +1 -1
  680. package/lib/dist/resolution/frameworks/angular-router.d.ts.map +1 -1
  681. package/lib/dist/resolution/frameworks/angular-router.js +41 -208
  682. package/lib/dist/resolution/frameworks/angular-router.js.map +1 -1
  683. package/lib/dist/resolution/frameworks/aspnet-routes.d.ts +62 -0
  684. package/lib/dist/resolution/frameworks/aspnet-routes.d.ts.map +1 -0
  685. package/lib/dist/resolution/frameworks/aspnet-routes.js +382 -0
  686. package/lib/dist/resolution/frameworks/aspnet-routes.js.map +1 -0
  687. package/lib/dist/resolution/frameworks/astro.d.ts.map +1 -1
  688. package/lib/dist/resolution/frameworks/astro.js +4 -60
  689. package/lib/dist/resolution/frameworks/astro.js.map +1 -1
  690. package/lib/dist/resolution/frameworks/cargo-workspace.d.ts +18 -1
  691. package/lib/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -1
  692. package/lib/dist/resolution/frameworks/cargo-workspace.js +65 -15
  693. package/lib/dist/resolution/frameworks/cargo-workspace.js.map +1 -1
  694. package/lib/dist/resolution/frameworks/cics.d.ts.map +1 -1
  695. package/lib/dist/resolution/frameworks/cics.js +7 -33
  696. package/lib/dist/resolution/frameworks/cics.js.map +1 -1
  697. package/lib/dist/resolution/frameworks/codeigniter.d.ts +23 -0
  698. package/lib/dist/resolution/frameworks/codeigniter.d.ts.map +1 -0
  699. package/lib/dist/resolution/frameworks/codeigniter.js +271 -0
  700. package/lib/dist/resolution/frameworks/codeigniter.js.map +1 -0
  701. package/lib/dist/resolution/frameworks/component-folder.d.ts +17 -0
  702. package/lib/dist/resolution/frameworks/component-folder.d.ts.map +1 -0
  703. package/lib/dist/resolution/frameworks/component-folder.js +11 -0
  704. package/lib/dist/resolution/frameworks/component-folder.js.map +1 -0
  705. package/lib/dist/resolution/frameworks/csharp.d.ts.map +1 -1
  706. package/lib/dist/resolution/frameworks/csharp.js +85 -102
  707. package/lib/dist/resolution/frameworks/csharp.js.map +1 -1
  708. package/lib/dist/resolution/frameworks/drupal.d.ts +17 -8
  709. package/lib/dist/resolution/frameworks/drupal.d.ts.map +1 -1
  710. package/lib/dist/resolution/frameworks/drupal.js +377 -142
  711. package/lib/dist/resolution/frameworks/drupal.js.map +1 -1
  712. package/lib/dist/resolution/frameworks/elysia.d.ts +38 -0
  713. package/lib/dist/resolution/frameworks/elysia.d.ts.map +1 -0
  714. package/lib/dist/resolution/frameworks/elysia.js +683 -0
  715. package/lib/dist/resolution/frameworks/elysia.js.map +1 -0
  716. package/lib/dist/resolution/frameworks/expo-modules.d.ts.map +1 -1
  717. package/lib/dist/resolution/frameworks/expo-modules.js +8 -88
  718. package/lib/dist/resolution/frameworks/expo-modules.js.map +1 -1
  719. package/lib/dist/resolution/frameworks/expo-router.d.ts.map +1 -1
  720. package/lib/dist/resolution/frameworks/expo-router.js +9 -190
  721. package/lib/dist/resolution/frameworks/expo-router.js.map +1 -1
  722. package/lib/dist/resolution/frameworks/express.d.ts +48 -1
  723. package/lib/dist/resolution/frameworks/express.d.ts.map +1 -1
  724. package/lib/dist/resolution/frameworks/express.js +193 -199
  725. package/lib/dist/resolution/frameworks/express.js.map +1 -1
  726. package/lib/dist/resolution/frameworks/fabric.js +1 -104
  727. package/lib/dist/resolution/frameworks/fabric.js.map +1 -1
  728. package/lib/dist/resolution/frameworks/go.d.ts.map +1 -1
  729. package/lib/dist/resolution/frameworks/go.js +14 -43
  730. package/lib/dist/resolution/frameworks/go.js.map +1 -1
  731. package/lib/dist/resolution/frameworks/goframe.js +1 -55
  732. package/lib/dist/resolution/frameworks/goframe.js.map +1 -1
  733. package/lib/dist/resolution/frameworks/index.d.ts +14 -0
  734. package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
  735. package/lib/dist/resolution/frameworks/index.js +16 -50
  736. package/lib/dist/resolution/frameworks/index.js.map +1 -1
  737. package/lib/dist/resolution/frameworks/java.d.ts.map +1 -1
  738. package/lib/dist/resolution/frameworks/java.js +203 -129
  739. package/lib/dist/resolution/frameworks/java.js.map +1 -1
  740. package/lib/dist/resolution/frameworks/laravel.d.ts.map +1 -1
  741. package/lib/dist/resolution/frameworks/laravel.js +71 -136
  742. package/lib/dist/resolution/frameworks/laravel.js.map +1 -1
  743. package/lib/dist/resolution/frameworks/name-heuristic.js +0 -12
  744. package/lib/dist/resolution/frameworks/name-heuristic.js.map +1 -1
  745. package/lib/dist/resolution/frameworks/nestjs.js +2 -199
  746. package/lib/dist/resolution/frameworks/nestjs.js.map +1 -1
  747. package/lib/dist/resolution/frameworks/next-proxy.d.ts +67 -0
  748. package/lib/dist/resolution/frameworks/next-proxy.d.ts.map +1 -0
  749. package/lib/dist/resolution/frameworks/next-proxy.js +239 -0
  750. package/lib/dist/resolution/frameworks/next-proxy.js.map +1 -0
  751. package/lib/dist/resolution/frameworks/nextjs.d.ts.map +1 -1
  752. package/lib/dist/resolution/frameworks/nextjs.js +10 -66
  753. package/lib/dist/resolution/frameworks/nextjs.js.map +1 -1
  754. package/lib/dist/resolution/frameworks/object-literal.js +0 -21
  755. package/lib/dist/resolution/frameworks/object-literal.js.map +1 -1
  756. package/lib/dist/resolution/frameworks/package-deps.d.ts +11 -7
  757. package/lib/dist/resolution/frameworks/package-deps.d.ts.map +1 -1
  758. package/lib/dist/resolution/frameworks/package-deps.js +35 -26
  759. package/lib/dist/resolution/frameworks/package-deps.js.map +1 -1
  760. package/lib/dist/resolution/frameworks/page-component.js +0 -14
  761. package/lib/dist/resolution/frameworks/page-component.js.map +1 -1
  762. package/lib/dist/resolution/frameworks/play.d.ts.map +1 -1
  763. package/lib/dist/resolution/frameworks/play.js +26 -34
  764. package/lib/dist/resolution/frameworks/play.js.map +1 -1
  765. package/lib/dist/resolution/frameworks/python.js +5 -102
  766. package/lib/dist/resolution/frameworks/python.js.map +1 -1
  767. package/lib/dist/resolution/frameworks/react-native.d.ts.map +1 -1
  768. package/lib/dist/resolution/frameworks/react-native.js +1 -166
  769. package/lib/dist/resolution/frameworks/react-native.js.map +1 -1
  770. package/lib/dist/resolution/frameworks/react-router.d.ts +13 -4
  771. package/lib/dist/resolution/frameworks/react-router.d.ts.map +1 -1
  772. package/lib/dist/resolution/frameworks/react-router.js +10 -82
  773. package/lib/dist/resolution/frameworks/react-router.js.map +1 -1
  774. package/lib/dist/resolution/frameworks/react.d.ts +57 -0
  775. package/lib/dist/resolution/frameworks/react.d.ts.map +1 -1
  776. package/lib/dist/resolution/frameworks/react.js +1449 -191
  777. package/lib/dist/resolution/frameworks/react.js.map +1 -1
  778. package/lib/dist/resolution/frameworks/ruby.js +1 -61
  779. package/lib/dist/resolution/frameworks/ruby.js.map +1 -1
  780. package/lib/dist/resolution/frameworks/rust.d.ts.map +1 -1
  781. package/lib/dist/resolution/frameworks/rust.js +35 -56
  782. package/lib/dist/resolution/frameworks/rust.js.map +1 -1
  783. package/lib/dist/resolution/frameworks/svelte.d.ts.map +1 -1
  784. package/lib/dist/resolution/frameworks/svelte.js +7 -75
  785. package/lib/dist/resolution/frameworks/svelte.js.map +1 -1
  786. package/lib/dist/resolution/frameworks/sveltekit-router.d.ts.map +1 -1
  787. package/lib/dist/resolution/frameworks/sveltekit-router.js +8 -46
  788. package/lib/dist/resolution/frameworks/sveltekit-router.js.map +1 -1
  789. package/lib/dist/resolution/frameworks/swift-objc.js +0 -97
  790. package/lib/dist/resolution/frameworks/swift-objc.js.map +1 -1
  791. package/lib/dist/resolution/frameworks/swift.js +0 -97
  792. package/lib/dist/resolution/frameworks/swift.js.map +1 -1
  793. package/lib/dist/resolution/frameworks/tanstack-router.d.ts.map +1 -1
  794. package/lib/dist/resolution/frameworks/tanstack-router.js +9 -130
  795. package/lib/dist/resolution/frameworks/tanstack-router.js.map +1 -1
  796. package/lib/dist/resolution/frameworks/terraform.js +1 -85
  797. package/lib/dist/resolution/frameworks/terraform.js.map +1 -1
  798. package/lib/dist/resolution/frameworks/vue-router.d.ts.map +1 -1
  799. package/lib/dist/resolution/frameworks/vue-router.js +11 -134
  800. package/lib/dist/resolution/frameworks/vue-router.js.map +1 -1
  801. package/lib/dist/resolution/frameworks/vue.d.ts.map +1 -1
  802. package/lib/dist/resolution/frameworks/vue.js +42 -114
  803. package/lib/dist/resolution/frameworks/vue.js.map +1 -1
  804. package/lib/dist/resolution/go-func-field-synthesizer.d.ts +58 -0
  805. package/lib/dist/resolution/go-func-field-synthesizer.d.ts.map +1 -0
  806. package/lib/dist/resolution/go-func-field-synthesizer.js +696 -0
  807. package/lib/dist/resolution/go-func-field-synthesizer.js.map +1 -0
  808. package/lib/dist/resolution/go-module.d.ts +23 -7
  809. package/lib/dist/resolution/go-module.d.ts.map +1 -1
  810. package/lib/dist/resolution/go-module.js +21 -24
  811. package/lib/dist/resolution/go-module.js.map +1 -1
  812. package/lib/dist/resolution/go-stdlib-methods.d.ts +9 -0
  813. package/lib/dist/resolution/go-stdlib-methods.d.ts.map +1 -0
  814. package/lib/dist/resolution/go-stdlib-methods.js +224 -0
  815. package/lib/dist/resolution/go-stdlib-methods.js.map +1 -0
  816. package/lib/dist/resolution/goframe-synthesizer.js +2 -53
  817. package/lib/dist/resolution/goframe-synthesizer.js.map +1 -1
  818. package/lib/dist/resolution/import-resolver.d.ts +278 -29
  819. package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
  820. package/lib/dist/resolution/import-resolver.js +1825 -1396
  821. package/lib/dist/resolution/import-resolver.js.map +1 -1
  822. package/lib/dist/resolution/index.d.ts +517 -6
  823. package/lib/dist/resolution/index.d.ts.map +1 -1
  824. package/lib/dist/resolution/index.js +1604 -1042
  825. package/lib/dist/resolution/index.js.map +1 -1
  826. package/lib/dist/resolution/js-builtins.d.ts +23 -0
  827. package/lib/dist/resolution/js-builtins.d.ts.map +1 -1
  828. package/lib/dist/resolution/js-builtins.js +34 -14
  829. package/lib/dist/resolution/js-builtins.js.map +1 -1
  830. package/lib/dist/resolution/js-class-expressions.d.ts +48 -0
  831. package/lib/dist/resolution/js-class-expressions.d.ts.map +1 -0
  832. package/lib/dist/resolution/js-class-expressions.js +25 -0
  833. package/lib/dist/resolution/js-class-expressions.js.map +1 -0
  834. package/lib/dist/resolution/js-super-calls.d.ts +18 -0
  835. package/lib/dist/resolution/js-super-calls.d.ts.map +1 -0
  836. package/lib/dist/resolution/js-super-calls.js +94 -0
  837. package/lib/dist/resolution/js-super-calls.js.map +1 -0
  838. package/lib/dist/resolution/jsx-code.d.ts +28 -0
  839. package/lib/dist/resolution/jsx-code.d.ts.map +1 -0
  840. package/lib/dist/resolution/jsx-code.js +459 -0
  841. package/lib/dist/resolution/jsx-code.js.map +1 -0
  842. package/lib/dist/resolution/lru-cache.d.ts +5 -13
  843. package/lib/dist/resolution/lru-cache.d.ts.map +1 -1
  844. package/lib/dist/resolution/lru-cache.js +43 -32
  845. package/lib/dist/resolution/lru-cache.js.map +1 -1
  846. package/lib/dist/resolution/memory-budget.js +0 -52
  847. package/lib/dist/resolution/memory-budget.js.map +1 -1
  848. package/lib/dist/resolution/module-importers.d.ts +210 -0
  849. package/lib/dist/resolution/module-importers.d.ts.map +1 -0
  850. package/lib/dist/resolution/module-importers.js +673 -0
  851. package/lib/dist/resolution/module-importers.js.map +1 -0
  852. package/lib/dist/resolution/name-matcher.d.ts +986 -7
  853. package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
  854. package/lib/dist/resolution/name-matcher.js +24176 -6745
  855. package/lib/dist/resolution/name-matcher.js.map +1 -1
  856. package/lib/dist/resolution/next-router-synthesizer.d.ts +19 -0
  857. package/lib/dist/resolution/next-router-synthesizer.d.ts.map +1 -1
  858. package/lib/dist/resolution/next-router-synthesizer.js +46 -28
  859. package/lib/dist/resolution/next-router-synthesizer.js.map +1 -1
  860. package/lib/dist/resolution/override-parameters.d.ts +40 -0
  861. package/lib/dist/resolution/override-parameters.d.ts.map +1 -0
  862. package/lib/dist/resolution/override-parameters.js +339 -0
  863. package/lib/dist/resolution/override-parameters.js.map +1 -0
  864. package/lib/dist/resolution/parameter-flow.d.ts +218 -0
  865. package/lib/dist/resolution/parameter-flow.d.ts.map +1 -0
  866. package/lib/dist/resolution/parameter-flow.js +474 -0
  867. package/lib/dist/resolution/parameter-flow.js.map +1 -0
  868. package/lib/dist/resolution/pascal-scope.d.ts +91 -0
  869. package/lib/dist/resolution/pascal-scope.d.ts.map +1 -0
  870. package/lib/dist/resolution/pascal-scope.js +961 -0
  871. package/lib/dist/resolution/pascal-scope.js.map +1 -0
  872. package/lib/dist/resolution/path-aliases.d.ts +32 -4
  873. package/lib/dist/resolution/path-aliases.d.ts.map +1 -1
  874. package/lib/dist/resolution/path-aliases.js +43 -110
  875. package/lib/dist/resolution/path-aliases.js.map +1 -1
  876. package/lib/dist/resolution/php-web-root.d.ts +39 -0
  877. package/lib/dist/resolution/php-web-root.d.ts.map +1 -0
  878. package/lib/dist/resolution/php-web-root.js +141 -0
  879. package/lib/dist/resolution/php-web-root.js.map +1 -0
  880. package/lib/dist/resolution/project-scans.d.ts +38 -0
  881. package/lib/dist/resolution/project-scans.d.ts.map +1 -0
  882. package/lib/dist/resolution/project-scans.js +30 -0
  883. package/lib/dist/resolution/project-scans.js.map +1 -0
  884. package/lib/dist/resolution/python-overloads.d.ts +10 -0
  885. package/lib/dist/resolution/python-overloads.d.ts.map +1 -0
  886. package/lib/dist/resolution/python-overloads.js +75 -0
  887. package/lib/dist/resolution/python-overloads.js.map +1 -0
  888. package/lib/dist/resolution/react-router-synthesizer.d.ts.map +1 -1
  889. package/lib/dist/resolution/react-router-synthesizer.js +3 -55
  890. package/lib/dist/resolution/react-router-synthesizer.js.map +1 -1
  891. package/lib/dist/resolution/resolver-pool.d.ts +23 -2
  892. package/lib/dist/resolution/resolver-pool.d.ts.map +1 -1
  893. package/lib/dist/resolution/resolver-pool.js +43 -111
  894. package/lib/dist/resolution/resolver-pool.js.map +1 -1
  895. package/lib/dist/resolution/resolver-worker.d.ts +1 -1
  896. package/lib/dist/resolution/resolver-worker.d.ts.map +1 -1
  897. package/lib/dist/resolution/resolver-worker.js +8 -37
  898. package/lib/dist/resolution/resolver-worker.js.map +1 -1
  899. package/lib/dist/resolution/resurrect-ref.d.ts +25 -0
  900. package/lib/dist/resolution/resurrect-ref.d.ts.map +1 -0
  901. package/lib/dist/resolution/resurrect-ref.js +19 -0
  902. package/lib/dist/resolution/resurrect-ref.js.map +1 -0
  903. package/lib/dist/resolution/ruby-constant-paths.d.ts +56 -0
  904. package/lib/dist/resolution/ruby-constant-paths.d.ts.map +1 -0
  905. package/lib/dist/resolution/ruby-constant-paths.js +255 -0
  906. package/lib/dist/resolution/ruby-constant-paths.js.map +1 -0
  907. package/lib/dist/resolution/ruby-parameter-flow.d.ts +10 -0
  908. package/lib/dist/resolution/ruby-parameter-flow.d.ts.map +1 -0
  909. package/lib/dist/resolution/ruby-parameter-flow.js +801 -0
  910. package/lib/dist/resolution/ruby-parameter-flow.js.map +1 -0
  911. package/lib/dist/resolution/rust-scopes.d.ts +120 -0
  912. package/lib/dist/resolution/rust-scopes.d.ts.map +1 -0
  913. package/lib/dist/resolution/rust-scopes.js +730 -0
  914. package/lib/dist/resolution/rust-scopes.js.map +1 -0
  915. package/lib/dist/resolution/shopify-themes.d.ts +10 -0
  916. package/lib/dist/resolution/shopify-themes.d.ts.map +1 -0
  917. package/lib/dist/resolution/shopify-themes.js +19 -0
  918. package/lib/dist/resolution/shopify-themes.js.map +1 -0
  919. package/lib/dist/resolution/strip-comments.d.ts +20 -1
  920. package/lib/dist/resolution/strip-comments.d.ts.map +1 -1
  921. package/lib/dist/resolution/strip-comments.js +164 -119
  922. package/lib/dist/resolution/strip-comments.js.map +1 -1
  923. package/lib/dist/resolution/sveltekit-synthesizer.js +0 -64
  924. package/lib/dist/resolution/sveltekit-synthesizer.js.map +1 -1
  925. package/lib/dist/resolution/swift-objc-bridge.js +0 -160
  926. package/lib/dist/resolution/swift-objc-bridge.js.map +1 -1
  927. package/lib/dist/resolution/swift-type-visibility.d.ts.map +1 -1
  928. package/lib/dist/resolution/swift-type-visibility.js +62 -104
  929. package/lib/dist/resolution/swift-type-visibility.js.map +1 -1
  930. package/lib/dist/resolution/synth-utils.js +1 -22
  931. package/lib/dist/resolution/synth-utils.js.map +1 -1
  932. package/lib/dist/resolution/tanstack-router-synthesizer.js +0 -32
  933. package/lib/dist/resolution/tanstack-router-synthesizer.js.map +1 -1
  934. package/lib/dist/resolution/tauri-synthesizer.d.ts +37 -0
  935. package/lib/dist/resolution/tauri-synthesizer.d.ts.map +1 -0
  936. package/lib/dist/resolution/tauri-synthesizer.js +1038 -0
  937. package/lib/dist/resolution/tauri-synthesizer.js.map +1 -0
  938. package/lib/dist/resolution/tier-synthesizer.d.ts.map +1 -1
  939. package/lib/dist/resolution/tier-synthesizer.js +35 -177
  940. package/lib/dist/resolution/tier-synthesizer.js.map +1 -1
  941. package/lib/dist/resolution/type-parameters.d.ts +23 -0
  942. package/lib/dist/resolution/type-parameters.d.ts.map +1 -1
  943. package/lib/dist/resolution/type-parameters.js +52 -54
  944. package/lib/dist/resolution/type-parameters.js.map +1 -1
  945. package/lib/dist/resolution/types.d.ts +192 -11
  946. package/lib/dist/resolution/types.d.ts.map +1 -1
  947. package/lib/dist/resolution/types.js +0 -47
  948. package/lib/dist/resolution/types.js.map +1 -1
  949. package/lib/dist/resolution/vbnet-receivers.d.ts +92 -0
  950. package/lib/dist/resolution/vbnet-receivers.d.ts.map +1 -0
  951. package/lib/dist/resolution/vbnet-receivers.js +1482 -0
  952. package/lib/dist/resolution/vbnet-receivers.js.map +1 -0
  953. package/lib/dist/resolution/vue-router-synthesizer.js +0 -31
  954. package/lib/dist/resolution/vue-router-synthesizer.js.map +1 -1
  955. package/lib/dist/resolution/workspace-packages.d.ts +206 -15
  956. package/lib/dist/resolution/workspace-packages.d.ts.map +1 -1
  957. package/lib/dist/resolution/workspace-packages.js +573 -152
  958. package/lib/dist/resolution/workspace-packages.js.map +1 -1
  959. package/lib/dist/search/identifier-segments.js +2 -93
  960. package/lib/dist/search/identifier-segments.js.map +1 -1
  961. package/lib/dist/search/query-parser.js +0 -54
  962. package/lib/dist/search/query-parser.js.map +1 -1
  963. package/lib/dist/search/query-paths.js +0 -167
  964. package/lib/dist/search/query-paths.js.map +1 -1
  965. package/lib/dist/search/query-utils.d.ts +44 -0
  966. package/lib/dist/search/query-utils.d.ts.map +1 -1
  967. package/lib/dist/search/query-utils.js +120 -198
  968. package/lib/dist/search/query-utils.js.map +1 -1
  969. package/lib/dist/sync/git-hooks.d.ts +14 -5
  970. package/lib/dist/sync/git-hooks.d.ts.map +1 -1
  971. package/lib/dist/sync/git-hooks.js +118 -65
  972. package/lib/dist/sync/git-hooks.js.map +1 -1
  973. package/lib/dist/sync/index.js +0 -14
  974. package/lib/dist/sync/index.js.map +1 -1
  975. package/lib/dist/sync/watch-policy.js +0 -45
  976. package/lib/dist/sync/watch-policy.js.map +1 -1
  977. package/lib/dist/sync/watcher.d.ts +29 -11
  978. package/lib/dist/sync/watcher.d.ts.map +1 -1
  979. package/lib/dist/sync/watcher.js +83 -487
  980. package/lib/dist/sync/watcher.js.map +1 -1
  981. package/lib/dist/sync/worktree.d.ts +7 -2
  982. package/lib/dist/sync/worktree.d.ts.map +1 -1
  983. package/lib/dist/sync/worktree.js +24 -97
  984. package/lib/dist/sync/worktree.js.map +1 -1
  985. package/lib/dist/telemetry/index.d.ts.map +1 -1
  986. package/lib/dist/telemetry/index.js +15 -135
  987. package/lib/dist/telemetry/index.js.map +1 -1
  988. package/lib/dist/types.d.ts +46 -0
  989. package/lib/dist/types.d.ts.map +1 -1
  990. package/lib/dist/types.js +15 -44
  991. package/lib/dist/types.js.map +1 -1
  992. package/lib/dist/ui/color.js +0 -19
  993. package/lib/dist/ui/color.js.map +1 -1
  994. package/lib/dist/ui/glyphs.js +2 -45
  995. package/lib/dist/ui/glyphs.js.map +1 -1
  996. package/lib/dist/ui/shimmer-progress.js +0 -21
  997. package/lib/dist/ui/shimmer-progress.js.map +1 -1
  998. package/lib/dist/ui/shimmer-worker.js +0 -22
  999. package/lib/dist/ui/shimmer-worker.js.map +1 -1
  1000. package/lib/dist/ui-server/api/deadcode.d.ts.map +1 -1
  1001. package/lib/dist/ui-server/api/deadcode.js +2 -31
  1002. package/lib/dist/ui-server/api/deadcode.js.map +1 -1
  1003. package/lib/dist/ui-server/api/effects.js +0 -111
  1004. package/lib/dist/ui-server/api/effects.js.map +1 -1
  1005. package/lib/dist/ui-server/api/entrypoints.js +0 -142
  1006. package/lib/dist/ui-server/api/entrypoints.js.map +1 -1
  1007. package/lib/dist/ui-server/api/events.js +0 -145
  1008. package/lib/dist/ui-server/api/events.js.map +1 -1
  1009. package/lib/dist/ui-server/api/file.js +0 -80
  1010. package/lib/dist/ui-server/api/file.js.map +1 -1
  1011. package/lib/dist/ui-server/api/filecode.js +0 -95
  1012. package/lib/dist/ui-server/api/filecode.js.map +1 -1
  1013. package/lib/dist/ui-server/api/flow.js +0 -149
  1014. package/lib/dist/ui-server/api/flow.js.map +1 -1
  1015. package/lib/dist/ui-server/api/hierarchy.js +0 -28
  1016. package/lib/dist/ui-server/api/hierarchy.js.map +1 -1
  1017. package/lib/dist/ui-server/api/index.js +0 -88
  1018. package/lib/dist/ui-server/api/index.js.map +1 -1
  1019. package/lib/dist/ui-server/api/map.d.ts.map +1 -1
  1020. package/lib/dist/ui-server/api/map.js +4 -317
  1021. package/lib/dist/ui-server/api/map.js.map +1 -1
  1022. package/lib/dist/ui-server/api/node.js +0 -111
  1023. package/lib/dist/ui-server/api/node.js.map +1 -1
  1024. package/lib/dist/ui-server/api/nodes.js +0 -16
  1025. package/lib/dist/ui-server/api/nodes.js.map +1 -1
  1026. package/lib/dist/ui-server/api/program.js +0 -90
  1027. package/lib/dist/ui-server/api/program.js.map +1 -1
  1028. package/lib/dist/ui-server/api/respond.js +0 -60
  1029. package/lib/dist/ui-server/api/respond.js.map +1 -1
  1030. package/lib/dist/ui-server/api/route-roots.d.ts.map +1 -1
  1031. package/lib/dist/ui-server/api/route-roots.js +2 -44
  1032. package/lib/dist/ui-server/api/route-roots.js.map +1 -1
  1033. package/lib/dist/ui-server/api/routes.d.ts.map +1 -1
  1034. package/lib/dist/ui-server/api/routes.js +4 -60
  1035. package/lib/dist/ui-server/api/routes.js.map +1 -1
  1036. package/lib/dist/ui-server/api/screens.d.ts.map +1 -1
  1037. package/lib/dist/ui-server/api/screens.js +4 -174
  1038. package/lib/dist/ui-server/api/screens.js.map +1 -1
  1039. package/lib/dist/ui-server/api/search.js +0 -62
  1040. package/lib/dist/ui-server/api/search.js.map +1 -1
  1041. package/lib/dist/ui-server/api/session.js +0 -58
  1042. package/lib/dist/ui-server/api/session.js.map +1 -1
  1043. package/lib/dist/ui-server/api/source.d.ts.map +1 -1
  1044. package/lib/dist/ui-server/api/source.js +0 -161
  1045. package/lib/dist/ui-server/api/source.js.map +1 -1
  1046. package/lib/dist/ui-server/api/stats.js +0 -58
  1047. package/lib/dist/ui-server/api/stats.js.map +1 -1
  1048. package/lib/dist/ui-server/api/steps.d.ts.map +1 -1
  1049. package/lib/dist/ui-server/api/steps.js +5 -381
  1050. package/lib/dist/ui-server/api/steps.js.map +1 -1
  1051. package/lib/dist/ui-server/api/trail-store.d.ts +3 -3
  1052. package/lib/dist/ui-server/api/trail-store.d.ts.map +1 -1
  1053. package/lib/dist/ui-server/api/trail-store.js +24 -106
  1054. package/lib/dist/ui-server/api/trail-store.js.map +1 -1
  1055. package/lib/dist/ui-server/api/trails.d.ts.map +1 -1
  1056. package/lib/dist/ui-server/api/trails.js +19 -94
  1057. package/lib/dist/ui-server/api/trails.js.map +1 -1
  1058. package/lib/dist/ui-server/api/when.js +0 -36
  1059. package/lib/dist/ui-server/api/when.js.map +1 -1
  1060. package/lib/dist/ui-server/api/wire.js +0 -58
  1061. package/lib/dist/ui-server/api/wire.js.map +1 -1
  1062. package/lib/dist/ui-server/assets.js +0 -35
  1063. package/lib/dist/ui-server/assets.js.map +1 -1
  1064. package/lib/dist/ui-server/constants.js +0 -26
  1065. package/lib/dist/ui-server/constants.js.map +1 -1
  1066. package/lib/dist/ui-server/highlight/bounded-tokenize.js +0 -25
  1067. package/lib/dist/ui-server/highlight/bounded-tokenize.js.map +1 -1
  1068. package/lib/dist/ui-server/highlight/index.js +1 -132
  1069. package/lib/dist/ui-server/highlight/index.js.map +1 -1
  1070. package/lib/dist/ui-server/highlight/languages.d.ts +3 -3
  1071. package/lib/dist/ui-server/highlight/languages.js +0 -31
  1072. package/lib/dist/ui-server/highlight/languages.js.map +1 -1
  1073. package/lib/dist/ui-server/highlight/tokenize-worker.js +0 -5
  1074. package/lib/dist/ui-server/highlight/tokenize-worker.js.map +1 -1
  1075. package/lib/dist/ui-server/index.d.ts +25 -0
  1076. package/lib/dist/ui-server/index.d.ts.map +1 -1
  1077. package/lib/dist/ui-server/index.js +35 -103
  1078. package/lib/dist/ui-server/index.js.map +1 -1
  1079. package/lib/dist/ui-server/open-browser.js +0 -34
  1080. package/lib/dist/ui-server/open-browser.js.map +1 -1
  1081. package/lib/dist/ui-server/security.d.ts +5 -0
  1082. package/lib/dist/ui-server/security.d.ts.map +1 -1
  1083. package/lib/dist/ui-server/security.js +11 -147
  1084. package/lib/dist/ui-server/security.js.map +1 -1
  1085. package/lib/dist/ui-server/static.js +0 -41
  1086. package/lib/dist/ui-server/static.js.map +1 -1
  1087. package/lib/dist/upgrade/index.d.ts +18 -5
  1088. package/lib/dist/upgrade/index.d.ts.map +1 -1
  1089. package/lib/dist/upgrade/index.js +73 -229
  1090. package/lib/dist/upgrade/index.js.map +1 -1
  1091. package/lib/dist/upgrade/remove-binary.js +2 -67
  1092. package/lib/dist/upgrade/remove-binary.js.map +1 -1
  1093. package/lib/dist/upgrade/update-check.js +1 -81
  1094. package/lib/dist/upgrade/update-check.js.map +1 -1
  1095. package/lib/dist/utils.d.ts +69 -1
  1096. package/lib/dist/utils.d.ts.map +1 -1
  1097. package/lib/dist/utils.js +224 -266
  1098. package/lib/dist/utils.js.map +1 -1
  1099. package/lib/dist/worker-teardown.js +0 -47
  1100. package/lib/dist/worker-teardown.js.map +1 -1
  1101. package/lib/kernel/codegraph-kernel.node +2 -2
  1102. package/lib/node_modules/.package-lock.json +4 -4
  1103. package/lib/node_modules/ignore/README.md +138 -8
  1104. package/lib/node_modules/ignore/index.d.ts +56 -20
  1105. package/lib/node_modules/ignore/index.js +1033 -221
  1106. package/lib/node_modules/ignore/legacy.js +871 -178
  1107. package/lib/node_modules/ignore/package.json +10 -4
  1108. package/lib/package.json +14 -8
  1109. package/node.exe +2 -2
  1110. package/package.json +1 -1
@@ -1,65 +1,74 @@
1
1
  "use strict";
2
- /**
3
- * React Framework Resolver
4
- *
5
- * Handles React patterns: React Router routes, components, hooks, contexts.
6
- * Next.js pages, route handlers and navigation are `nextjs.ts`'s.
7
- */
8
2
  Object.defineProperty(exports, "__esModule", { value: true });
9
3
  exports.reactResolver = void 0;
10
4
  exports.configHrefExpression = configHrefExpression;
5
+ exports.exportedComponent = exportedComponent;
6
+ exports.declaredComponent = declaredComponent;
7
+ exports.lazyValueModules = lazyValueModules;
8
+ exports.declarationText = declarationText;
9
+ exports.wrappedComponentName = wrappedComponentName;
10
+ exports.initializerAt = initializerAt;
11
+ exports.isTableRoute = isTableRoute;
11
12
  const package_deps_1 = require("./package-deps");
12
13
  const import_resolver_1 = require("../import-resolver");
13
- /** The languages React components, hooks and contexts are written and used in. */
14
+ const alias_binding_1 = require("../alias-binding");
15
+ const strip_comments_1 = require("../strip-comments");
16
+ const utils_1 = require("../../utils");
17
+ const synth_utils_1 = require("../synth-utils");
18
+ const query_utils_1 = require("../../search/query-utils");
19
+ const object_literal_1 = require("./object-literal");
20
+ const component_folder_1 = require("./component-folder");
14
21
  const REACT_SCRIPT_LANGUAGES = new Set(['typescript', 'javascript', 'tsx', 'jsx']);
15
22
  exports.reactResolver = {
16
23
  name: 'react',
17
- // Includes 'tsx'/'jsx' so route extraction runs on JSX files (where
18
- // `<Route element={<X/>}>` routes live) — without them the .tsx/.jsx grammars
19
- // were filtered out of the extract pass and those routes were never indexed.
20
- // (resolve() is unaffected — it runs for every detected framework regardless
21
- // of language; only the extract pass filters on `languages`.)
22
24
  languages: ['javascript', 'typescript', 'tsx', 'jsx'],
23
25
  detect(context) {
24
- // React in a package.json — the root's, or a workspace's (`frontend/`, `apps/web/`).
25
26
  if ((0, package_deps_1.dependsOn)(context, 'react', 'next', 'react-native'))
26
27
  return true;
27
- // Check for .jsx/.tsx files
28
28
  const allFiles = context.getAllFiles();
29
29
  return allFiles.some((f) => f.endsWith('.jsx') || f.endsWith('.tsx'));
30
30
  },
31
- // A data-router `lazy: () => import('./routes/x')` route names a module, not a symbol.
32
31
  claimsReference(name) {
33
- return name.startsWith(LAZY_ROUTE_PREFIX);
32
+ return name.startsWith(LAZY_ROUTE_PREFIX) || name.startsWith(LAYOUT_PREFIX) || PICKED_EXPORT.test(name);
34
33
  },
35
34
  resolve(ref, context) {
36
- // Components, hooks and contexts are a script's: halo's Java
37
- // `import org.springframework…SecurityContext` is no React context.
38
35
  if (!REACT_SCRIPT_LANGUAGES.has(ref.language))
39
36
  return null;
40
37
  if (ref.referenceName.startsWith(LAZY_ROUTE_PREFIX)) {
41
38
  const target = lazyRouteComponent(ref.referenceName.slice(LAZY_ROUTE_PREFIX.length), ref.filePath, context);
42
39
  return target ? { original: ref, targetNodeId: target, confidence: 0.9, resolvedBy: 'framework' } : null;
43
40
  }
44
- // A component, hook or context the file IMPORTS is the import's: the
45
- // package's (`useQuery` from `@tanstack/react-query`, `<Button>` from a UI
46
- // kit), or the module the import names, which import resolution finds.
47
- // Framework resolution runs first, and a name lookup here bound trpc's
48
- // tests' `useQuery` to a hook nested in one of trpc's own factories.
41
+ const picked = PICKED_EXPORT.exec(ref.referenceName);
42
+ if (picked) {
43
+ const target = isReactRouteRef(ref) ? pickedExport(picked[1], picked[2], ref.filePath, context) : null;
44
+ return target ? { original: ref, targetNodeId: target, confidence: 0.9, resolvedBy: 'framework' } : null;
45
+ }
46
+ if (ref.referenceName.startsWith(LAYOUT_PREFIX)) {
47
+ const target = layoutComponent(ref.referenceName.slice(LAYOUT_PREFIX.length), ref, context);
48
+ return target ? { original: ref, targetNodeId: target, confidence: 0.9, resolvedBy: 'framework', metadata: { layout: true } } : null;
49
+ }
49
50
  if (context.getImportMappings?.(ref.filePath, ref.language)?.some((m) => m.localName === ref.referenceName)) {
50
51
  return null;
51
52
  }
52
- // Pattern 1: Component references (PascalCase). Only from JSX-capable
53
- // files — a component is USED in markup, which only parses in .tsx/.jsx.
54
- // Without this gate, every PascalCase TYPE reference in plain .ts files
55
- // went through component resolution: in a monorepo with same-named
56
- // classes per package (#764, amplication), a `.ts` GraphQL-types file's
57
- // own `Account` type alias lost to an arbitrary `Account` CLASS in
58
- // another package (the framework's 0.8 outranked the name-matcher's
59
- // proximity-correct 0.7).
60
53
  if ((ref.language === 'tsx' || ref.language === 'jsx') &&
61
54
  isPascalCase(ref.referenceName) &&
62
55
  !isBuiltInType(ref.referenceName)) {
56
+ const own = ownDeclarations(ref.referenceName, ref.filePath, context);
57
+ if (namesType(ref)) {
58
+ const type = own.find((n) => n.kind === 'type_alias' || n.kind === 'interface');
59
+ return type && own.some((n) => n.kind !== 'type_alias' && n.kind !== 'interface' && n.kind !== 'class')
60
+ ? { original: ref, targetNodeId: type.id, confidence: 0.8, resolvedBy: 'framework' } : null;
61
+ }
62
+ const value = declaredComponent(ref.referenceName, ref.filePath, context);
63
+ if (value) {
64
+ return value.component ? { original: ref, targetNodeId: value.component.id, confidence: 0.9, resolvedBy: 'framework' } : null;
65
+ }
66
+ const component = own.find((n) => COMPONENT_KINDS.has(n.kind));
67
+ if (component) {
68
+ return { original: ref, targetNodeId: component.id, confidence: 0.8, resolvedBy: 'framework' };
69
+ }
70
+ if (own.length > 0)
71
+ return null;
63
72
  const result = resolveComponent(ref.referenceName, ref.filePath, context);
64
73
  if (result) {
65
74
  return {
@@ -70,7 +79,6 @@ exports.reactResolver = {
70
79
  };
71
80
  }
72
81
  }
73
- // Pattern 2: Hook references (use*)
74
82
  if (ref.referenceName.startsWith('use') && ref.referenceName.length > 3) {
75
83
  const result = resolveHook(ref.referenceName, ref.filePath, context, ref.language);
76
84
  if (result) {
@@ -82,7 +90,6 @@ exports.reactResolver = {
82
90
  };
83
91
  }
84
92
  }
85
- // Pattern 3: Context references
86
93
  if (ref.referenceName.endsWith('Context') || ref.referenceName.endsWith('Provider')) {
87
94
  const result = resolveContext(ref.referenceName, ref, context);
88
95
  if (result) {
@@ -100,20 +107,9 @@ exports.reactResolver = {
100
107
  const nodes = [];
101
108
  const references = [];
102
109
  const now = Date.now();
103
- // Components and custom hooks are NOT extracted here. The tree-sitter
104
- // extractor already emits them natively across .ts/.tsx/.js/.jsx — function
105
- // and arrow components as `function` nodes, HOC-wrapped components
106
- // (`forwardRef`/`memo`/`styled`) as `component` nodes (#841), and `useX`
107
- // hooks as `function` nodes. Re-deriving them here with regex only ran on
108
- // .ts/.js anyway (this resolver's `languages` didn't include the 'tsx'/'jsx'
109
- // grammars), and it DUPLICATED those tree-sitter nodes (e.g. a `useAuth`
110
- // ended up as two `function` nodes). This `extract` now contributes only
111
- // what tree-sitter can't: route nodes (React Router + Next.js conventions),
112
- // which is why 'tsx'/'jsx' are now in `languages` — `<Route>`/`element={<X/>}`
113
- // routes live in JSX files and were previously skipped entirely.
114
- // Read only each opening tag's own attributes, including expression values.
115
- const declarations = scanRouteDeclarations(content, !/\.(?:ts|mts|cts)$/.test(filePath));
116
- for (const { path: routePath, parts, component, lazy, at } of declarations) {
110
+ const declarations = scanRouteDeclarations(content, allowsJsx(filePath));
111
+ for (const route of declarations) {
112
+ const { path: routePath, parts, at } = route;
117
113
  const line = content.slice(0, at).split('\n').length;
118
114
  const routeNode = {
119
115
  id: `route:${filePath}:${line}:${routePath}`,
@@ -127,32 +123,13 @@ exports.reactResolver = {
127
123
  endColumn: 0,
128
124
  language: filePath.endsWith('.tsx') ? 'tsx' : 'jsx',
129
125
  updatedAt: now,
130
- // A path built from a constant (`paths.app.root.path`) is named in postExtract.
131
126
  ...(parts.some((p) => p.expr) ? { signature: ROUTE_PARTS_PREFIX + JSON.stringify(parts) } : {}),
132
127
  };
133
128
  nodes.push(routeNode);
134
- const target = component ?? (lazy ? LAZY_ROUTE_PREFIX + lazy : undefined);
135
- if (target) {
136
- references.push({
137
- fromNodeId: routeNode.id,
138
- referenceName: target,
139
- referenceKind: 'references',
140
- line,
141
- column: 0,
142
- filePath,
143
- language: filePath.endsWith('.tsx') ? 'tsx' : 'jsx',
144
- });
145
- }
146
- }
147
- // Next.js pages and route handlers are `frameworks/nextjs.ts`'s.
129
+ references.push(...routeReferences(route, routeNode.id, filePath, line));
130
+ }
148
131
  return { nodes, references };
149
132
  },
150
- /**
151
- * Name the routes whose path is built from a constant — bulletproof-react's
152
- * `path: paths.app.discussions.path` under `path: paths.app.root.path` is
153
- * `/app/discussions` — by reading the constant's object literal where it is
154
- * declared. Idempotent: the parts ride on the node's signature.
155
- */
156
133
  postExtract(context) {
157
134
  const updates = [];
158
135
  for (const route of context.getNodesByKind('route')) {
@@ -174,10 +151,40 @@ exports.reactResolver = {
174
151
  }
175
152
  return updates;
176
153
  },
154
+ crossFileNodes(context) {
155
+ return { kind: 'route', owns: isTableRoute, ...tableRoutes(context) };
156
+ },
157
+ lazyModules(ref, context) {
158
+ const name = ref.referenceName;
159
+ const picked = isReactRouteRef(ref) ? PICKED_EXPORT.exec(name.startsWith(LAYOUT_PREFIX) ? name.slice(LAYOUT_PREFIX.length) : name) : null;
160
+ if (picked) {
161
+ const reads = new Set();
162
+ pickedExport(picked[1], picked[2], ref.filePath, context, reads);
163
+ return [...reads];
164
+ }
165
+ let spec;
166
+ if (name.startsWith(LAZY_ROUTE_PREFIX))
167
+ spec = name.slice(LAZY_ROUTE_PREFIX.length);
168
+ else if (name.startsWith(LAYOUT_PREFIX + LAZY_ROUTE_PREFIX))
169
+ spec = name.slice(LAYOUT_PREFIX.length + LAZY_ROUTE_PREFIX.length);
170
+ else if (isReactRouteRef(ref)) {
171
+ const own = name.startsWith(LAYOUT_PREFIX) ? name.slice(LAYOUT_PREFIX.length) : name;
172
+ const loaded = isPascalCase(own) && !isBuiltInType(own) ? declaredLoader(own, ref.filePath, context) : undefined;
173
+ if (loaded && loaded.member !== 'default') {
174
+ const reads = new Set();
175
+ pickedExport(loaded.spec, loaded.member, ref.filePath, context, reads);
176
+ return [...reads];
177
+ }
178
+ spec = loaded?.spec;
179
+ }
180
+ return spec ? lazyRouteFiles(spec, ref.filePath, context) : [];
181
+ },
177
182
  };
178
183
  const LAZY_ROUTE_PREFIX = 'lazy-import:';
179
184
  const ROUTE_PARTS_PREFIX = 'route-parts:';
180
- /** React Router's nesting: a child path is relative unless it starts with `/`. */
185
+ const LAYOUT_PREFIX = 'layout:';
186
+ const OUTLET = 'Outlet';
187
+ const PICKED_EXPORT = /^import:(.+)#([A-Za-z_$][\w$]*)$/;
181
188
  function composeRoutePath(parts) {
182
189
  let path = '';
183
190
  for (const part of parts) {
@@ -188,11 +195,6 @@ function composeRoutePath(parts) {
188
195
  }
189
196
  return ('/' + path.replace(/^\/+/, '')).replace(/\/{2,}/g, '/').replace(/(.)\/$/, '$1');
190
197
  }
191
- /**
192
- * The string a member expression like `paths.app.root.path` reads from a
193
- * constant object literal — the constant found through the route file's
194
- * import of its root name, or in the file itself.
195
- */
196
198
  function constantPathValue(expr, fromFile, context) {
197
199
  const [root, ...keys] = expr.split('.');
198
200
  if (!root || keys.length === 0)
@@ -214,18 +216,9 @@ function constantPathValue(expr, fromFile, context) {
214
216
  return null;
215
217
  const lines = context.readFile(file)?.split('\n') ?? [];
216
218
  const text = lines.slice(decl.startLine - 1, decl.endLine).join('\n');
217
- const open = text.indexOf('{', Math.max(0, text.search(new RegExp(`\\b${name}\\b`))));
219
+ const open = text.indexOf('{', Math.max(0, text.search(new RegExp(`\\b${(0, utils_1.escapeRegExp)(name)}\\b`))));
218
220
  return open < 0 ? null : readObjectPath(text, open, keys);
219
221
  }
220
- /**
221
- * The href a route-config object names — `paths.app.discussion.getHref(id)`
222
- * or `paths.app.discussion.path` against `export const paths = { app: {
223
- * discussion: { path: 'discussions/:discussionId', getHref: (id: string) =>
224
- * \`/app/discussions/${id}\` } } }` (bulletproof-react's `config/paths.ts`)
225
- * — as the string or template literal it returns, ready for the href reader.
226
- * A `${…}` glued to a segment (a `?redirectTo=` suffix) is dropped; one
227
- * that is a whole segment stays a hole. Null for anything else.
228
- */
229
222
  function configHrefExpression(expr, fromFile, context) {
230
223
  const m = /^\s*([A-Za-z_$][\w$]*)((?:\s*\??\.\s*[A-Za-z_$][\w$]*)+)\s*(\((?:[^()]|\([^()]*\))*\))?\s*$/.exec(expr);
231
224
  if (!m)
@@ -249,13 +242,12 @@ function configHrefExpression(expr, fromFile, context) {
249
242
  return null;
250
243
  const lines = context.readFile(file)?.split('\n') ?? [];
251
244
  const text = lines.slice(decl.startLine - 1, decl.endLine).join('\n');
252
- const open = text.indexOf('{', Math.max(0, text.search(new RegExp(`\\b${name}\\b`))));
245
+ const open = text.indexOf('{', Math.max(0, text.search(new RegExp(`\\b${(0, utils_1.escapeRegExp)(name)}\\b`))));
253
246
  if (open < 0)
254
247
  return null;
255
248
  let value = readObjectValue(text, open, keys);
256
249
  if (value === null)
257
250
  return null;
258
- // A function's value is what it returns: `(id: string) => \`/app/…\``, `() => { return '/'; }`.
259
251
  if (m[3] !== undefined) {
260
252
  const body = /^(?:async\s+)?(?:\([^()]*(?:\([^()]*\)[^()]*)*\)|[A-Za-z_$][\w$]*)\s*(?::\s*[^=]+?)?=>\s*/.exec(value);
261
253
  if (!body)
@@ -266,10 +258,8 @@ function configHrefExpression(expr, fromFile, context) {
266
258
  }
267
259
  if (!/^[`'"]/.test(value))
268
260
  return null;
269
- // `/auth/login${redirectTo ? … : ''}`: a hole glued to a segment is a suffix, not a segment.
270
261
  return value.startsWith('`') ? dropGluedTemplateHoles(value) : value;
271
262
  }
272
- /** Remove each `${…}` of a template literal that is not a whole path segment. */
273
263
  function dropGluedTemplateHoles(template) {
274
264
  let out = '';
275
265
  for (let i = 0; i < template.length; i++) {
@@ -293,7 +283,6 @@ function dropGluedTemplateHoles(template) {
293
283
  }
294
284
  return out;
295
285
  }
296
- /** Walk `keys` into the object literal opening at `at`; the final value's source text, or null. */
297
286
  function readObjectValue(text, at, keys) {
298
287
  const skipString = (j) => {
299
288
  const quote = text[j];
@@ -346,7 +335,6 @@ function readObjectValue(text, at, keys) {
346
335
  }
347
336
  return null;
348
337
  }
349
- /** Walk `keys` into the object literal opening at `at`; the string literal at the end, or null. */
350
338
  function readObjectPath(text, at, keys) {
351
339
  const skipString = (j) => {
352
340
  const quote = text[j];
@@ -401,47 +389,350 @@ function readObjectPath(text, at, keys) {
401
389
  }
402
390
  return null;
403
391
  }
404
- /** The component a lazy route module renders: its default export, else its `Component` export. */
405
- function lazyRouteComponent(spec, fromFile, context) {
406
- const file = (0, import_resolver_1.resolveImportPath)(spec, fromFile, 'typescript', context);
392
+ function lazyModuleFile(spec, fromFile, context) {
393
+ const language = scriptLanguage(fromFile);
394
+ return (0, import_resolver_1.resolveImportPath)(spec, fromFile, language, context) ??
395
+ (language === 'typescript' ? null : (0, import_resolver_1.resolveImportPath)(spec, fromFile, 'typescript', context));
396
+ }
397
+ function lazyRouteComponent(spec, fromFile, context, reads) {
398
+ const file = lazyModuleFile(spec, fromFile, context);
407
399
  if (!file)
408
400
  return null;
409
- const source = context.readFile(file) ?? '';
410
- const named = /\bexport\s+default\s+(?:async\s+)?(?:function\s*\*?\s*|class\s+)?([A-Za-z_$][\w$]*)/.exec(source)?.[1] ??
411
- (/\bexport\s+(?:const|function|class)\s+Component\b/.test(source) ? 'Component' : null);
412
- if (!named)
401
+ return exportedComponent(file, 'default', context, new Set(), reads) ??
402
+ exportedComponent(file, 'Component', context, new Set(), reads);
403
+ }
404
+ function lazyRouteFiles(spec, fromFile, context) {
405
+ const reads = new Set();
406
+ lazyRouteComponent(spec, fromFile, context, reads);
407
+ return [...reads];
408
+ }
409
+ function pickedExport(spec, name, fromFile, context, reads) {
410
+ const file = lazyModuleFile(spec, fromFile, context);
411
+ return file ? exportedComponent(file, name, context, new Set(), reads) : null;
412
+ }
413
+ function isReactRouteRef(ref) {
414
+ return (ref.language === 'tsx' || ref.language === 'jsx') && ref.fromNodeId.startsWith(`route:${ref.filePath}:`);
415
+ }
416
+ const EXPORTED_COMPONENT_KINDS = new Set(['function', 'component', 'class', 'constant', 'variable']);
417
+ const MAX_REEXPORT_HOPS = 4;
418
+ function exportedComponent(file, name, context, visited = new Set(), reads) {
419
+ if (visited.has(file) || visited.size > MAX_REEXPORT_HOPS)
420
+ return null;
421
+ reads?.add(file);
422
+ const language = scriptLanguage(file);
423
+ const through = new Set(visited).add(file);
424
+ const forwarded = (source, exported) => {
425
+ const target = (0, import_resolver_1.resolveImportPath)(source, file, language, context);
426
+ return target ? exportedComponent(target, exported, context, through, reads) : null;
427
+ };
428
+ const code = (0, strip_comments_1.stripCommentsForRegex)(context.readFile(file) ?? '', 'typescript');
429
+ const local = ownExport(code, name);
430
+ if (local) {
431
+ const nodes = context.getNodesInFile(file);
432
+ const declaredAs = (binding) => {
433
+ const named = nodes.filter((n) => n.name === binding && EXPORTED_COMPONENT_KINDS.has(n.kind));
434
+ return named.find((n) => n.qualifiedName === binding) ?? named[0];
435
+ };
436
+ const exported = declaredAs(local);
437
+ let binding = local;
438
+ let declared = exported;
439
+ for (let hop = 0; declared && hop < MAX_REEXPORT_HOPS; hop++) {
440
+ const held = declared.kind === 'constant' ? heldBinding(declared, context) : null;
441
+ if (!held)
442
+ break;
443
+ binding = held;
444
+ declared = declaredAs(held);
445
+ }
446
+ if (declared) {
447
+ const wrapped = declared.kind === 'constant' || declared.kind === 'variable' ? wrappedComponent(declared, context)
448
+ : declared.kind === 'component' ? handedComponent(declared, context) : null;
449
+ return (wrapped ?? declared).id;
450
+ }
451
+ if (binding === local && name === 'default' && !exportsBinding(code, local))
452
+ return null;
453
+ const imported = context.getImportMappings(file, language).find((m) => m.localName === binding);
454
+ const id = imported && !imported.isNamespace ? forwarded(imported.source, imported.isDefault ? 'default' : imported.exportedName) : null;
455
+ return id ?? exported?.id ?? null;
456
+ }
457
+ const reExports = context.getReExports?.(file, language) ?? [];
458
+ for (const re of reExports) {
459
+ if (re.kind === 'named' && re.exportedName === name)
460
+ return forwarded(re.source, re.originalName);
461
+ }
462
+ if (name === 'default')
463
+ return null;
464
+ let found = null;
465
+ for (const re of reExports) {
466
+ if (re.kind !== 'wildcard')
467
+ continue;
468
+ const id = forwarded(re.source, name);
469
+ if (id && found && id !== found)
470
+ return null;
471
+ found ??= id;
472
+ }
473
+ return found;
474
+ }
475
+ function ownExport(source, name) {
476
+ if (name === 'default') {
477
+ const declared = defaultExportedName(source);
478
+ if (declared)
479
+ return declared;
480
+ }
481
+ else if (new RegExp(String.raw `\bexport\s+(?:async\s+)?(?:const|let|var|function|class)\s+${(0, utils_1.escapeRegExp)(name)}(?![\w$])`).test(source)) {
482
+ return name;
483
+ }
484
+ return (0, alias_binding_1.extractLocalExportAliases)(source).find((a) => a.exportedName === name)?.localName ?? null;
485
+ }
486
+ function defaultExportedName(source) {
487
+ const at = /\bexport\s+default\s+/.exec(source);
488
+ if (!at)
489
+ return null;
490
+ const rest = source.slice(at.index + at[0].length);
491
+ const named = /^(?:async\s+)?(?:function\s*\*?\s*|class\s+)([A-Za-z_$][\w$]*)/.exec(rest) ??
492
+ /^([A-Za-z_$][\w$]*)(?:[ \t]*(?:;|\r?\n|$)|\s+(?:as|satisfies)\s)/.exec(rest);
493
+ return named ? named[1] : wrappedName(rest.slice(0, statementEnd(rest, 0)));
494
+ }
495
+ function wrappedName(expression) {
496
+ const s = expression.trim();
497
+ const callee = /^[A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$][\w$]*)*\s*(?:<[^()]*>)?\s*(?=\()/.exec(s);
498
+ if (!callee)
499
+ return null;
500
+ let end = callee[0].length;
501
+ let args = [];
502
+ for (let open = end; s[open] === '(';) {
503
+ const close = (0, object_literal_1.matchBracket)(s, open);
504
+ if (close < 0)
505
+ return null;
506
+ args = topLevelItems(s.slice(open + 1, close));
507
+ end = close + 1;
508
+ for (open = end; /\s/.test(s[open] ?? '');)
509
+ open++;
510
+ }
511
+ if (!/^(?:\s+(?:as|satisfies)\s[\s\S]*)?$/.test(s.slice(end)))
512
+ return null;
513
+ const first = args[0] ?? '';
514
+ if (args.length > 1 && !/^[A-Z]/.test(first))
515
+ return null;
516
+ return /^[A-Za-z_$][\w$]*$/.test(first) ? first : first ? wrappedName(first) : null;
517
+ }
518
+ function exportsBinding(source, local) {
519
+ return (0, alias_binding_1.defaultExportBinding)(source) === local;
520
+ }
521
+ function declaredComponent(name, filePath, context) {
522
+ const declaration = declaredValue(name, filePath, context);
523
+ if (!declaration)
524
+ return undefined;
525
+ const loaded = valueLoader(declaration, context);
526
+ if (!loaded)
527
+ return { declaration, component: wrappedComponent(declaration, context) };
528
+ const id = loaded.member === 'default'
529
+ ? lazyRouteComponent(loaded.spec, filePath, context)
530
+ : pickedExport(loaded.spec, loaded.member, filePath, context);
531
+ return { declaration, component: id ? context.getNodeById?.(id) ?? null : null };
532
+ }
533
+ function declaredLoader(name, filePath, context) {
534
+ const declaration = declaredValue(name, filePath, context);
535
+ return declaration ? valueLoader(declaration, context) : undefined;
536
+ }
537
+ function lazyValueModules(filePath, context) {
538
+ const reads = new Set();
539
+ for (const node of context.getNodesInFile(filePath)) {
540
+ if ((node.kind !== 'constant' && node.kind !== 'variable') || node.qualifiedName !== node.name || !isPascalCase(node.name))
541
+ continue;
542
+ const loaded = valueLoader(node, context);
543
+ if (!loaded)
544
+ continue;
545
+ if (loaded.member === 'default')
546
+ lazyRouteComponent(loaded.spec, filePath, context, reads);
547
+ else
548
+ pickedExport(loaded.spec, loaded.member, filePath, context, reads);
549
+ }
550
+ return [...reads];
551
+ }
552
+ function declaredValue(name, filePath, context) {
553
+ return (context.getNodesInFileNamed?.(filePath, name) ?? context.getNodesInFile(filePath).filter((n) => n.name === name))
554
+ .find((n) => (n.kind === 'constant' || n.kind === 'variable') && n.qualifiedName === name);
555
+ }
556
+ function valueLoader(declaration, context) {
557
+ const code = (0, strip_comments_1.stripCommentsForRegex)(declarationText(declaration, context), 'typescript');
558
+ const init = initializerAt(code, declaration.name.length);
559
+ const loader = init < 0 ? null : loaderOf(code.slice(init));
560
+ if (!loader)
561
+ return null;
562
+ const page = loadedPage(loaderValue(loader, new Map()));
563
+ if (page)
564
+ return page;
565
+ const fn = functionParts(loader);
566
+ const spec = fn && !fn.block ? FIRST_IMPORT.exec(fn.body)?.[1] : undefined;
567
+ return spec ? { spec, member: 'default' } : null;
568
+ }
569
+ function loaderOf(text) {
570
+ const s = text.trim();
571
+ const call = /^[A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$][\w$]*)*\s*(?:<[^()]*>)?\s*\(/.exec(s);
572
+ if (!call)
573
+ return conditionalLoader(s);
574
+ const open = call[0].length - 1;
575
+ const close = (0, object_literal_1.matchBracket)(s, open);
576
+ if (close < 0)
577
+ return null;
578
+ for (const arg of topLevelItems(s.slice(open + 1, close))) {
579
+ const item = arg.trim();
580
+ if (!item)
581
+ continue;
582
+ if (functionParts(item))
583
+ return item;
584
+ if (item.startsWith('{')) {
585
+ const loader = (0, object_literal_1.matchBracket)(item, 0) === item.length - 1 ? objectEntries(item.slice(1, -1)).props.get('loader') : undefined;
586
+ if (loader !== undefined && functionParts(loader))
587
+ return loader;
588
+ continue;
589
+ }
590
+ const inner = loaderOf(item);
591
+ if (inner)
592
+ return inner;
593
+ }
594
+ return conditionalLoader(s);
595
+ }
596
+ function conditionalLoader(text) {
597
+ const branches = conditionalBranches(text);
598
+ const loaders = branches ? branches.map(loaderOf).filter((l) => l !== null) : [];
599
+ return loaders.length === 1 ? loaders[0] : null;
600
+ }
601
+ function conditionalBranches(text) {
602
+ let question = -1;
603
+ let open = 0;
604
+ for (let i = 0; i < text.length; i++) {
605
+ const ch = text[i];
606
+ if (ch === '"' || ch === "'" || ch === '`' || ch === '{' || ch === '(' || ch === '[') {
607
+ i = ch === '{' || ch === '(' || ch === '[' ? (0, object_literal_1.matchBracket)(text, i) : (0, object_literal_1.skipString)(text, i);
608
+ if (i < 0)
609
+ return null;
610
+ }
611
+ else if (ch === '?') {
612
+ if (text[i + 1] === '?' || (text[i + 1] === '.' && !/\d/.test(text[i + 2] ?? '')))
613
+ i++;
614
+ else if (open++ === 0)
615
+ question = i;
616
+ }
617
+ else if (ch === ':' && open > 0 && --open === 0) {
618
+ return [text.slice(question + 1, i), text.slice(i + 1)];
619
+ }
620
+ }
621
+ return null;
622
+ }
623
+ function loadedPage(value) {
624
+ if (value?.kind === 'module')
625
+ return { spec: value.spec, member: 'default' };
626
+ if (value?.kind === 'export')
627
+ return { spec: value.spec, member: value.name };
628
+ if (value?.kind !== 'object')
629
+ return null;
630
+ const inner = objectEntries(value.text).props.get('default');
631
+ return inner === undefined ? null : loadedPage(valueOf(inner, value.scope));
632
+ }
633
+ function declarationText(node, context) {
634
+ const lines = (context.getFileLines?.(node.filePath) ?? context.readFile(node.filePath)?.split(/\r?\n/) ?? [])
635
+ .slice(node.startLine - 1, node.endLine);
636
+ if (lines.length === 0)
637
+ return '';
638
+ if (node.endColumn > 0)
639
+ lines[lines.length - 1] = lines[lines.length - 1].slice(0, node.endColumn);
640
+ lines[0] = lines[0].slice(node.startColumn);
641
+ return lines.join('\n');
642
+ }
643
+ function wrappedComponent(value, context) {
644
+ const nodes = context.getNodesInFile(value.filePath);
645
+ const inner = nodes.filter((n) => COMPONENT_KINDS.has(n.kind) &&
646
+ n.qualifiedName === `${value.qualifiedName}::${n.name}` && n.startLine >= value.startLine && n.endLine <= value.endLine);
647
+ const held = inner.find((n) => n.name === value.name) ??
648
+ (inner.length === 1 && inner[0].endLine === value.endLine ? inner[0] : null);
649
+ if (held || inner.length > 0)
650
+ return held;
651
+ return handedComponent(value, context, nodes);
652
+ }
653
+ function heldBinding(value, context) {
654
+ const code = (0, strip_comments_1.stripCommentsForRegex)(declarationText(value, context), 'typescript');
655
+ const init = initializerAt(code, value.name.length);
656
+ if (init < 0)
413
657
  return null;
414
- const node = context.getNodesInFile(file).find((n) => n.name === named &&
415
- (n.kind === 'function' || n.kind === 'component' || n.kind === 'class' || n.kind === 'constant' || n.kind === 'variable'));
416
- return node?.id ?? null;
658
+ const held = /^\s*([A-Za-z_$][\w$]*)\s*(?:$|(?:as|satisfies)\s)/.exec(code.slice(init, statementEnd(code, init)));
659
+ return held && held[1] !== value.name ? held[1] : null;
660
+ }
661
+ function handedComponent(value, context, nodes = context.getNodesInFile(value.filePath)) {
662
+ const code = (0, strip_comments_1.stripCommentsForRegex)(declarationText(value, context), 'typescript');
663
+ const init = initializerAt(code, value.name.length);
664
+ const handed = init < 0 ? null : wrappedName(code.slice(init, statementEnd(code, init)));
665
+ return handed && isPascalCase(handed) && handed !== value.name
666
+ ? nodes.find((n) => n.name === handed && n.qualifiedName === handed && COMPONENT_KINDS.has(n.kind)) ?? null
667
+ : null;
668
+ }
669
+ function wrappedComponentName(component, context) {
670
+ const code = (0, strip_comments_1.stripCommentsForRegex)(declarationText(component, context), 'typescript');
671
+ const init = initializerAt(code, component.name.length);
672
+ if (init < 0)
673
+ return null;
674
+ const expression = code.slice(init, statementEnd(code, init)).trim();
675
+ const styled = /^styled\s*\(\s*([A-Za-z_$][\w$]*)\s*[,)]/.exec(expression);
676
+ const name = styled ? styled[1]
677
+ : /^(?:React\s*\.\s*)?(?:memo|forwardRef)\b/.test(expression) ? wrappedName(expression) : null;
678
+ return name && isPascalCase(name) && name !== component.name ? name : null;
679
+ }
680
+ function layoutComponent(spec, ref, context) {
681
+ if (spec.startsWith(LAZY_ROUTE_PREFIX))
682
+ return lazyRouteComponent(spec.slice(LAZY_ROUTE_PREFIX.length), ref.filePath, context);
683
+ const picked = isReactRouteRef(ref) ? PICKED_EXPORT.exec(spec) : null;
684
+ if (picked)
685
+ return pickedExport(picked[1], picked[2], ref.filePath, context);
686
+ const mapping = context.getImportMappings(ref.filePath, ref.language).find((m) => m.localName === spec);
687
+ if (!mapping) {
688
+ const own = declaredComponent(spec, ref.filePath, context);
689
+ if (own)
690
+ return (own.component ?? own.declaration).id;
691
+ return resolveComponent(spec, ref.filePath, context);
692
+ }
693
+ const viaImport = context.resolveImport?.({ ...ref, referenceName: spec })?.targetNodeId;
694
+ if (viaImport)
695
+ return viaImport;
696
+ if (mapping.isDefault || mapping.exportedName === 'default')
697
+ return lazyRouteComponent(mapping.source, ref.filePath, context);
698
+ const file = (0, import_resolver_1.resolveImportPath)(mapping.source, ref.filePath, ref.language, context);
699
+ return file ? context.getNodesInFile(file).find((n) => n.name === mapping.exportedName && COMPONENT_KINDS.has(n.kind))?.id ?? null : null;
417
700
  }
418
- /** Structural scanner: strings, comments, JSX and balanced expressions are units. */
701
+ const ROUTER_CALL = /\b(?:createBrowserRouter|createHashRouter|createMemoryRouter|createRoutesFromElements|useRoutes)\b/;
702
+ const ROUTER_ELEMENT = /^(?:Browser|Hash|Memory|Native|Static|History|unstable_History)?Router$/;
703
+ const NAMED_ENTRY = /^(?:\.\.\.\s*)?([A-Za-z_$][\w$]*)\s*(\([\s\S]*\))?$/;
419
704
  function scanRouteDeclarations(source, allowJsx) {
420
- const routes = [];
705
+ const objects = ROUTER_CALL.test(source);
706
+ if (!objects && !/<Route\b/.test(source))
707
+ return [];
708
+ return scanRoutes(source, allowJsx, { objects }).routes;
709
+ }
710
+ function scanRoutes(source, allowJsx, options) {
421
711
  const scopes = [];
422
- const dataRouter = /\b(?:createBrowserRouter|createHashRouter|createMemoryRouter|createRoutesFromElements)\b/.test(source);
423
- if (!dataRouter && !/<Route\b/.test(source))
424
- return routes;
712
+ const names = [];
713
+ const sites = [];
714
+ const routeTags = [];
715
+ const routers = [];
716
+ const objects = Boolean(options.objects || options.table);
425
717
  const literal = (value) => {
426
718
  const match = /^(?:"((?:\\.|[^"\\])*)"|'((?:\\.|[^'\\])*)')$/.exec(value.trim());
427
719
  return match ? match[1] ?? match[2] : undefined;
428
720
  };
429
- // A guard or boundary wrapping the screen (`<ProtectedRoute><AppRoot/></ProtectedRoute>`,
430
- // `<Suspense>`) is not what the route renders; the first element inside it is.
431
- const WRAPPER = /^(?:Suspense|ErrorBoundary|\w*(?:Guard|Provider)|(?:Protected|Private|Auth|Require\w*)\w*)$/;
721
+ const WRAPPER = /^(?:Suspense|ErrorBoundary|\w*(?:Guard|Provider|Wrapper|Route)|(?:Protected|Private|Auth|Require\w*)\w*)$/;
432
722
  const componentName = (value, jsx) => {
433
723
  if (!value)
434
724
  return undefined;
435
725
  if (!jsx)
436
726
  return /^\s*([A-Z][\w]*)\s*$/.exec(value)?.[1];
437
- const inner = value.replace(/^\s*\(\s*/, '');
727
+ const inner = value.replace(/^\s*(?:\(\s*)?/, '');
438
728
  if (!/^<\s*[A-Z]/.test(inner))
439
729
  return undefined;
440
- const tags = [...inner.matchAll(/<\s*([A-Z][\w]*)\s*(?=[\s/>])/g)].map((m) => m[1]);
441
- return tags.find((t) => !WRAPPER.test(t)) ?? tags[0];
730
+ const { own, props } = elementTags(inner);
731
+ const content = (t) => !WRAPPER.test(t) && t !== 'Outlet';
732
+ return own.find(content) ?? props.find(content) ?? [...own].reverse().find((t) => t !== 'Outlet') ?? own[0];
442
733
  };
443
- // The few characters before `at`, trailing whitespace skipped: enough for the
444
- // end-anchored checks below without copying the whole prefix per `/` or `<`.
734
+ const elementTag = (value) => componentName(value, true);
735
+ const elementPage = (value) => elementTag(value)?.replace(/^Outlet$/, '') || undefined;
445
736
  const tokenBefore = (at) => {
446
737
  let j = at - 1;
447
738
  while (j >= 0 && /\s/.test(source[j]))
@@ -467,7 +758,54 @@ function scanRouteDeclarations(source, allowJsx) {
467
758
  }
468
759
  return at;
469
760
  };
470
- function unit(at) {
761
+ const routerCall = (at) => {
762
+ if (!options.uses)
763
+ return null;
764
+ let j = at - 1;
765
+ while (j >= 0 && /\s/.test(source[j]))
766
+ j--;
767
+ if (source[j] !== 's' && source[j] !== 'r' && source[j] !== 'p')
768
+ return null;
769
+ const before = source.slice(Math.max(0, at - 64), at);
770
+ if (/(?:^|[^\w$.])(?:useRoutes|create(?:Browser|Hash|Memory)Router)\s*$/.test(before))
771
+ return {};
772
+ const map = /(?:^|[^\w$.])([A-Za-z_$][\w$]*)\s*\??\.\s*map\s*$/.exec(before);
773
+ if (!map)
774
+ return null;
775
+ return { map: { name: map[1], call: false, at: at - before.length + map.index + map[0].indexOf(map[1]) } };
776
+ };
777
+ const routesFromElements = (at) => {
778
+ let j = at - 1;
779
+ while (j >= 0 && /\s/.test(source[j]))
780
+ j--;
781
+ if (source[j] !== 's' && source[j] !== 'n')
782
+ return false;
783
+ return /(?:^|[^\w$.])createRoutesFrom(?:Elements|Children)\s*$/.test(source.slice(Math.max(0, at - 40), at));
784
+ };
785
+ const settle = (call, open, close) => {
786
+ const argAt = trivia(open + 1);
787
+ if (argAt >= close)
788
+ return;
789
+ if (call.map) {
790
+ const tags = routeTags.filter((t) => t.at > argAt && t.at < close);
791
+ if (tags.length > 0 && mapsRouteFields(source.slice(argAt, close), tags))
792
+ sites.push({ name: call.map, at: open });
793
+ return;
794
+ }
795
+ if (source[argAt] === '[' || source[argAt] === '{') {
796
+ sites.push({ literal: argAt, at: open });
797
+ return;
798
+ }
799
+ const id = /^[A-Za-z_$][\w$]*/.exec(source.slice(argAt, close));
800
+ if (!id || /^createRoutesFrom(?:Elements|Children)$/.test(id[0]))
801
+ return;
802
+ const next = trivia(argAt + id[0].length);
803
+ if (next === close || source[next] === ',')
804
+ sites.push({ name: { name: id[0], call: false, at: argAt }, at: open });
805
+ else if (source[next] === '(')
806
+ sites.push({ name: { name: id[0], call: true, at: argAt }, at: open });
807
+ };
808
+ function unit(at, routeList = false) {
471
809
  const ch = source[at];
472
810
  if (ch === '"' || ch === "'" || ch === '`') {
473
811
  let i = at + 1;
@@ -486,7 +824,6 @@ function scanRouteDeclarations(source, allowJsx) {
486
824
  }
487
825
  return i;
488
826
  }
489
- // A regex can contain braces or JSX-looking text without ending an expression.
490
827
  if (ch === '/') {
491
828
  const before = tokenBefore(at);
492
829
  if (!before || /[=(:,[!&|?{};]$/.test(before) || /\b(?:return|throw|case|yield)\s*$/.test(before)) {
@@ -511,92 +848,161 @@ function scanRouteDeclarations(source, allowJsx) {
511
848
  }
512
849
  if (allowJsx && ch === '<' && /^<(?:[A-Za-z][\w.:-]*|>)/.test(source.slice(at))) {
513
850
  const before = tokenBefore(at);
514
- // `count<limit` and `factory<Type>()` are not JSX opening tags.
515
851
  if (!/[\w$)\]'"]$/.test(before) || /\breturn$/.test(before))
516
852
  return jsx(at);
517
853
  }
518
854
  const close = ch === '{' ? '}' : ch === '[' ? ']' : ch === '(' ? ')' : undefined;
519
855
  if (!close)
520
856
  return at + 1;
857
+ const call = ch === '(' ? routerCall(at) : null;
858
+ const router = ch === '(' && routesFromElements(at);
521
859
  let i = at + 1;
522
860
  const fields = new Map();
523
861
  while ((i = trivia(i)) < source.length && source[i] !== close) {
524
- // A property must start at an object entry, never inside its value.
525
862
  const key = ch === '{' ? /^(?:([A-Za-z_$][\w$]*)|["']([^"']+)["'])\s*:/.exec(source.slice(i)) : null;
526
863
  if (key) {
864
+ const name = key[1] ?? key[2];
527
865
  const start = i;
528
866
  const valueAt = trivia(i + key[0].length);
867
+ const children = objects && name === 'children';
529
868
  i = valueAt;
530
869
  let valueEnd = i;
531
870
  while ((i = trivia(i)) < source.length && source[i] !== ',' && source[i] !== close) {
532
- i = unit(i);
871
+ i = unit(i, children);
533
872
  valueEnd = i;
534
873
  }
535
- fields.set(key[1] ?? key[2], { value: source.slice(valueAt, valueEnd).trim(), at: start });
874
+ const value = source.slice(valueAt, valueEnd).trim();
875
+ fields.set(name, { value, at: start });
876
+ if (children && /^[A-Za-z_$][\w$]*$/.test(value))
877
+ names.push({ name: value, call: false, at: valueAt });
536
878
  }
537
879
  else {
538
- // Skip a whole entry (spread, method, shorthand), but still visit nested units.
880
+ const entry = i;
539
881
  while ((i = trivia(i)) < source.length && source[i] !== ',' && source[i] !== close)
540
882
  i = unit(i);
883
+ const method = objects && ch === '{' ? /^(async\s+)?lazy\s*\(/.exec(source.slice(entry, entry + 32)) : null;
884
+ if (method) {
885
+ fields.set('lazy', { value: `${method[1] ?? ''}function ${source.slice(entry + method[0].length - 1, i).trim()}`, at: entry });
886
+ }
887
+ if (routeList && ch === '[') {
888
+ const text = source.slice(entry, i).replace(/\/\*[\s\S]*?\*\/|\/\/[^\n]*/g, '').trim();
889
+ const named = NAMED_ENTRY.exec(text);
890
+ const args = named?.[2] ? text.length - named[2].length : -1;
891
+ if (named && (args < 0 || (0, object_literal_1.matchBracket)(text, args) === text.length - 1)) {
892
+ names.push({ name: named[1], call: args >= 0, at: entry });
893
+ }
894
+ }
541
895
  }
542
896
  if (source[i] === ',')
543
897
  i++;
544
898
  }
545
- if (dataRouter && ch === '{' && source[i] === close) {
899
+ if (objects && ch === '{' && source[i] === close) {
546
900
  const pathField = fields.get('path');
547
901
  const path = pathField && literal(pathField.value);
548
902
  const expr = pathField && path === undefined && /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/.test(pathField.value) ? pathField.value : undefined;
549
- const component = componentName(fields.get('element')?.value, true)
550
- ?? componentName(fields.get('Component')?.value, false);
551
- const lazy = /\bimport\s*\(\s*["']([^"']+)["']\s*\)/.exec(fields.get('lazy')?.value ?? '')?.[1];
903
+ const shown = elementTag(fields.get('element')?.value) ?? componentName(fields.get('Component')?.value, false);
904
+ const loaded = lazyRouteReference(fields.get('lazy')?.value, elementTag);
905
+ const outlet = (shown ?? loaded) === OUTLET && path !== '';
906
+ const component = shown === OUTLET ? undefined : shown;
907
+ const lazy = loaded === OUTLET ? undefined : loaded;
908
+ const index = fields.get('index');
552
909
  if (pathField && (path !== undefined || expr)) {
553
- scopes.push({ part: path !== undefined ? { lit: path } : { expr }, at: pathField.at, end: i, component, lazy });
910
+ scopes.push({ part: path !== undefined ? { lit: path } : { expr }, at: pathField.at, start: at, end: i, component, lazy, outlet });
911
+ }
912
+ else if (!pathField && index?.value === 'true') {
913
+ scopes.push({ part: { lit: '' }, at: index.at, start: at, end: i, component, lazy });
914
+ }
915
+ else if (!pathField && (component || lazy) && fields.has('children')) {
916
+ scopes.push({ part: { lit: '' }, at, start: at, end: i, component, lazy, pathless: true });
554
917
  }
555
918
  }
919
+ if (call && i < source.length)
920
+ settle(call, at, i);
921
+ if (router)
922
+ routers.push({ start: at, end: i });
556
923
  return i < source.length ? i + 1 : i;
557
924
  }
558
925
  function jsx(at) {
559
926
  const tag = /^<([\w.:-]*)/.exec(source.slice(at));
560
927
  let i = at + tag[0].length;
561
928
  const attrs = new Map();
929
+ const spreads = [];
562
930
  while ((i = trivia(i)) < source.length && source[i] !== '>' && !source.startsWith('/>', i)) {
563
931
  const attr = /^[\w:-]+/.exec(source.slice(i));
564
932
  if (!attr) {
933
+ const from = i;
565
934
  i = unit(i);
935
+ const spread = /^\{\s*\.\.\.\s*([A-Za-z_$][\w$]*)\s*\}$/.exec(source.slice(from, i));
936
+ if (spread)
937
+ spreads.push(spread[1]);
566
938
  continue;
567
939
  }
568
940
  i = trivia(i + attr[0].length);
569
- if (source[i] !== '=')
941
+ if (source[i] !== '=') {
942
+ attrs.set(attr[0], '{true}');
570
943
  continue;
944
+ }
571
945
  i = trivia(i + 1);
572
946
  const start = i;
573
947
  i = unit(i);
574
948
  attrs.set(attr[0], source.slice(start, i));
575
949
  }
576
950
  let scope;
951
+ let addressless;
952
+ const router = ROUTER_ELEMENT.test(tag[1]) ? { start: at, end: source.length } : undefined;
953
+ if (router)
954
+ routers.push(router);
577
955
  if (tag[1] === 'Route' && i < source.length) {
578
- const path = literal(attrs.get('path') ?? '');
956
+ const pathText = attrs.get('path');
579
957
  const expression = (name) => attrs.get(name)?.replace(/^\{([\s\S]*)\}$/, '$1');
580
- const component = componentName(expression('component'), false) ?? componentName(expression('element'), true);
581
- const lazy = /\bimport\s*\(\s*["']([^"']+)["']\s*\)/.exec(expression('lazy') ?? '')?.[1];
582
- if (path) {
583
- scope = { part: { lit: path }, at, end: source.length, component, lazy, jsx: true };
584
- scopes.push(scope);
958
+ const path = literal(pathText ?? '') ?? literal(expression('path') ?? '');
959
+ routeTags.push({ at, spreads, path: expression('path')?.trim() });
960
+ const element = elementPage(expression('element'));
961
+ const component = componentName(expression('component'), false) ?? element;
962
+ const loaded = lazyRouteReference(expression('lazy'), elementTag);
963
+ const lazy = loaded === OUTLET ? undefined : loaded;
964
+ const route = { part: { lit: path ?? '' }, at, start: at, end: source.length, component, lazy, jsx: true };
965
+ if (path)
966
+ scope = route;
967
+ else if (pathText === undefined || path === '') {
968
+ if (/^\{\s*true\s*\}$/.test(attrs.get('index') ?? '')) {
969
+ if (component || lazy)
970
+ scope = { ...route, index: true };
971
+ }
972
+ else {
973
+ addressless = { scope: route, tags: routeTags.length, page: path === '' && Boolean(element || lazy) };
974
+ }
975
+ }
976
+ else {
977
+ scope = { ...route, opaque: true };
585
978
  }
586
- }
587
- if (source.startsWith('/>', i)) {
588
979
  if (scope)
589
- scope.end = i + 2;
590
- return i + 2;
980
+ scopes.push(scope);
591
981
  }
982
+ const close = (end) => {
983
+ if (scope)
984
+ scope.end = end;
985
+ if (router)
986
+ router.end = end;
987
+ if (addressless) {
988
+ const { scope: route, tags, page } = addressless;
989
+ route.end = end;
990
+ if (routeTags.length > tags) {
991
+ if (route.component || route.lazy)
992
+ scopes.push({ ...route, pathless: true });
993
+ }
994
+ else if (page)
995
+ scopes.push({ ...route, index: true });
996
+ }
997
+ return end;
998
+ };
999
+ if (source.startsWith('/>', i))
1000
+ return close(i + 2);
592
1001
  i++;
593
1002
  while (i < source.length) {
594
1003
  if (source.startsWith('</', i)) {
595
1004
  const end = source.indexOf('>', i + 2);
596
- const after = end < 0 ? source.length : end + 1;
597
- if (scope)
598
- scope.end = after;
599
- return after;
1005
+ return close(end < 0 ? source.length : end + 1);
600
1006
  }
601
1007
  if (source[i] === '<' && /^<(?:[A-Za-z]|>)/.test(source.slice(i)))
602
1008
  i = jsx(i);
@@ -605,36 +1011,906 @@ function scanRouteDeclarations(source, allowJsx) {
605
1011
  else
606
1012
  i++;
607
1013
  }
608
- if (scope)
609
- scope.end = i;
610
- return i;
1014
+ return close(i);
1015
+ }
1016
+ if (options.table)
1017
+ unit(trivia(options.table.at), true);
1018
+ else {
1019
+ let at = 0;
1020
+ while ((at = trivia(at)) < source.length)
1021
+ at = unit(at);
611
1022
  }
612
- let at = 0;
613
- while ((at = trivia(at)) < source.length)
614
- at = unit(at);
615
- // A child route's path is relative to the routes around it: compose each
616
- // rendering route's path from the path-bearing scopes that contain it.
1023
+ const prefix = options.table?.prefix ?? [];
1024
+ const inherited = options.table?.layouts ?? [];
1025
+ const renders = (s) => Boolean(s.component || s.lazy);
1026
+ const holds = (outer, start, end) => outer.start < start && outer.end >= end;
1027
+ const around = (start, end) => scopes.filter((outer) => holds(outer, start, end)).sort((a, b) => a.start - b.start);
1028
+ const shown = (p) => p.lit ?? `{${p.expr}}`;
1029
+ const layoutOf = (s) => (s.component ?? s.lazy);
1030
+ const partsOf = new Map();
1031
+ const pathOf = new Map();
617
1032
  for (const scope of scopes) {
618
- if (!scope.component && !scope.lazy && !scope.jsx)
1033
+ const parts = [...prefix, ...around(scope.start, scope.end).map((c) => c.part), scope.part];
1034
+ partsOf.set(scope, parts);
1035
+ pathOf.set(scope, composeRoutePath(parts.map(shown)));
1036
+ }
1037
+ const inRouter = (s) => routers.some((r) => r.start < s.start && r.end >= s.end);
1038
+ const addressed = (s) => {
1039
+ if (!s.index)
1040
+ return true;
1041
+ const outer = around(s.start, s.end);
1042
+ return !outer.some((c) => c.opaque) && (outer.some((c) => Boolean(c.part.lit || c.part.expr)) || inRouter(s));
1043
+ };
1044
+ const pages = new Set(scopes.filter((s) => !s.pathless && !s.opaque && (s.jsx || s.outlet || renders(s)) && addressed(s)));
1045
+ const layout = (c) => renders(c) && !c.opaque;
1046
+ const routes = [];
1047
+ for (const scope of pages) {
1048
+ const path = pathOf.get(scope);
1049
+ if (scopes.some((inner) => pages.has(inner) && !inner.jsx === !scope.jsx && renders(inner) &&
1050
+ holds(scope, inner.start, inner.end) && pathOf.get(inner) === path))
619
1051
  continue;
620
- const chain = scopes
621
- .filter((outer) => outer !== scope && outer.at < scope.at && outer.end >= scope.end)
622
- .sort((a, b) => a.at - b.at);
623
- const parts = [...chain.map((c) => c.part), scope.part];
624
- const shown = parts.map((p) => p.lit ?? `{${p.expr}}`);
625
- routes.push({ path: composeRoutePath(shown), parts, component: scope.component, lazy: scope.lazy, at: scope.at });
626
- }
627
- return routes.sort((a, b) => a.at - b.at);
628
- }
629
- /**
630
- * Check if string is PascalCase
631
- */
1052
+ const layouts = [...inherited, ...around(scope.start, scope.end)
1053
+ .filter((c) => layout(c) && (scope.jsx || !c.jsx))
1054
+ .map(layoutOf)];
1055
+ routes.push({ path, parts: partsOf.get(scope), component: scope.component, lazy: scope.lazy, layouts, at: scope.at });
1056
+ }
1057
+ const mount = (at) => {
1058
+ const outer = around(at, at);
1059
+ return { parts: outer.map((c) => c.part), layouts: outer.filter(layout).map(layoutOf) };
1060
+ };
1061
+ return {
1062
+ routes: routes.sort((a, b) => a.at - b.at),
1063
+ names: names.map((n) => {
1064
+ const { parts, layouts } = mount(n.at);
1065
+ return { ...n, prefix: [...prefix, ...parts], layouts: [...inherited, ...layouts] };
1066
+ }),
1067
+ uses: sites.map((s) => {
1068
+ const { parts, layouts } = mount(s.at);
1069
+ return { name: s.name, literal: s.literal, prefix: parts, layouts };
1070
+ }),
1071
+ };
1072
+ }
1073
+ function mapsRouteFields(callback, tags) {
1074
+ const head = /^(?:async\s+)?(?:function\b[^(]*)?\(\s*/.exec(callback);
1075
+ let param;
1076
+ const rest = new Set();
1077
+ const paths = new Set();
1078
+ const bind = (pattern) => {
1079
+ for (const entry of topLevelEntries(pattern.slice(1, -1))) {
1080
+ const spread = /^\.\.\.\s*([A-Za-z_$][\w$]*)$/.exec(entry);
1081
+ if (spread)
1082
+ rest.add(spread[1]);
1083
+ const path = /^path\s*(?::\s*([A-Za-z_$][\w$]*))?\s*(?:=[\s\S]*)?$/.exec(entry);
1084
+ if (path)
1085
+ paths.add(path[1] ?? 'path');
1086
+ }
1087
+ };
1088
+ if (head) {
1089
+ const at = head[0].length;
1090
+ if (callback[at] === '{') {
1091
+ const close = (0, object_literal_1.matchBracket)(callback, at);
1092
+ if (close < 0)
1093
+ return false;
1094
+ bind(callback.slice(at, close + 1));
1095
+ }
1096
+ else
1097
+ param = /^[A-Za-z_$][\w$]*/.exec(callback.slice(at))?.[0];
1098
+ }
1099
+ else {
1100
+ param = /^(?:async\s+)?([A-Za-z_$][\w$]*)\s*=>/.exec(callback)?.[1];
1101
+ }
1102
+ if (param) {
1103
+ const destructured = new RegExp(`\\b(?:const|let|var)\\s*(\\{[^{}]*\\})\\s*=\\s*${param.replace(/\$/g, '\\$')}\\s*[;\\n]`, 'g');
1104
+ for (const m of callback.matchAll(destructured))
1105
+ bind(m[1]);
1106
+ }
1107
+ const ownPath = param ? new RegExp(`^${param.replace(/\$/g, '\\$')}\\s*\\??\\.\\s*path$`) : null;
1108
+ return tags.some((t) => t.spreads.some((s) => s === param || rest.has(s)) ||
1109
+ (t.path !== undefined && (ownPath?.test(t.path) || paths.has(t.path))));
1110
+ }
1111
+ function elementTags(text) {
1112
+ const own = [];
1113
+ const props = [];
1114
+ for (let i = 0; i < text.length; i++) {
1115
+ if (text[i] !== '<')
1116
+ continue;
1117
+ const open = /^<\s*([A-Za-z][\w.:-]*)(?=[\s/>])/.exec(text.slice(i));
1118
+ if (!open)
1119
+ continue;
1120
+ if (/^[A-Z]\w*$/.test(open[1]))
1121
+ own.push(open[1]);
1122
+ let j = i + open[0].length;
1123
+ let attr = '';
1124
+ while (j < text.length && text[j] !== '>') {
1125
+ const ch = text[j];
1126
+ const name = /^[A-Za-z_$][\w$:-]*/.exec(text.slice(j, j + 64));
1127
+ if (name) {
1128
+ attr = name[0];
1129
+ j += name[0].length;
1130
+ continue;
1131
+ }
1132
+ const end = ch === '{' ? (0, object_literal_1.matchBracket)(text, j) : ch === '"' || ch === "'" ? (0, object_literal_1.skipString)(text, j) : j;
1133
+ if (end < 0)
1134
+ break;
1135
+ if (ch === '{' && /^(?:component|element|page)$/i.test(attr)) {
1136
+ for (const m of text.slice(j, end).matchAll(/<\s*([A-Z]\w*)(?=[\s/>])/g))
1137
+ props.push(m[1]);
1138
+ }
1139
+ if (ch === '{' || ch === '"' || ch === "'")
1140
+ attr = '';
1141
+ j = end + 1;
1142
+ }
1143
+ i = j;
1144
+ }
1145
+ return { own, props };
1146
+ }
1147
+ function topLevelEntries(text) {
1148
+ return topLevelItems(text).filter(Boolean);
1149
+ }
1150
+ function topLevelItems(text) {
1151
+ const out = [];
1152
+ let depth = 0;
1153
+ let from = 0;
1154
+ for (let i = 0; i < text.length; i++) {
1155
+ const ch = text[i];
1156
+ if (ch === '"' || ch === "'" || ch === '`') {
1157
+ const end = (0, object_literal_1.skipString)(text, i);
1158
+ if (end < 0)
1159
+ break;
1160
+ i = end;
1161
+ }
1162
+ else if (ch === '{' || ch === '[' || ch === '(')
1163
+ depth++;
1164
+ else if (ch === '}' || ch === ']' || ch === ')')
1165
+ depth--;
1166
+ else if (ch === ',' && depth === 0) {
1167
+ out.push(text.slice(from, i).trim());
1168
+ from = i + 1;
1169
+ }
1170
+ }
1171
+ const last = text.slice(from).trim();
1172
+ if (last)
1173
+ out.push(last);
1174
+ return out;
1175
+ }
1176
+ const FIRST_IMPORT = /\bimport\s*\(\s*["']([^"']+)["']\s*\)/;
1177
+ function lazyRouteReference(loader, elementTag) {
1178
+ if (!loader)
1179
+ return undefined;
1180
+ const code = (0, strip_comments_1.stripCommentsForRegex)(loader, 'typescript').trim();
1181
+ const rendered = code.startsWith('{') ? lazyPropertiesRender(code) : routeRender(loaderValue(code, new Map()), elementTag);
1182
+ if (rendered === null)
1183
+ return undefined;
1184
+ if (rendered !== undefined)
1185
+ return rendered;
1186
+ const spec = FIRST_IMPORT.exec(code)?.[1];
1187
+ return spec ? LAZY_ROUTE_PREFIX + spec : undefined;
1188
+ }
1189
+ function routeRender(value, elementTag) {
1190
+ if (value?.kind === 'module')
1191
+ return LAZY_ROUTE_PREFIX + value.spec;
1192
+ if (value?.kind !== 'object')
1193
+ return undefined;
1194
+ const { props, spreads } = objectEntries(value.text);
1195
+ const component = props.get('Component');
1196
+ const element = props.get('element');
1197
+ const shown = component ?? element;
1198
+ if (shown !== undefined) {
1199
+ const held = component !== undefined ? valueOf(component, value.scope) : null;
1200
+ const named = pageReference(held);
1201
+ if (named)
1202
+ return named;
1203
+ const loaded = loadedExports(shown, value.scope);
1204
+ if (loaded.length === 1)
1205
+ return pageReference(loaded[0]);
1206
+ const tag = component === undefined && loaded.length === 0 ? elementTag(element) : undefined;
1207
+ if ((held?.kind === 'name' && held.name === OUTLET) || tag === OUTLET)
1208
+ return OUTLET;
1209
+ return tag ? pageReference(nameValue(tag, value.scope)) : undefined;
1210
+ }
1211
+ if (spreads.length === 0)
1212
+ return null;
1213
+ const spread = spreads.length === 1 ? valueOf(spreads[0], value.scope) : null;
1214
+ return spread?.kind === 'module' ? LAZY_ROUTE_PREFIX + spread.spec : undefined;
1215
+ }
1216
+ function lazyPropertiesRender(code) {
1217
+ if ((0, object_literal_1.matchBracket)(code, 0) !== code.length - 1)
1218
+ return undefined;
1219
+ const component = objectEntries(code.slice(1, -1)).props.get('Component');
1220
+ if (component === undefined)
1221
+ return null;
1222
+ const page = pageReference(loaderValue(component, new Map()));
1223
+ if (page)
1224
+ return page;
1225
+ const spec = FIRST_IMPORT.exec(component)?.[1];
1226
+ return spec ? LAZY_ROUTE_PREFIX + spec : undefined;
1227
+ }
1228
+ function loadedExports(text, scope) {
1229
+ const found = new Map();
1230
+ for (const m of text.matchAll(/(?<![\w$.])([A-Za-z_$][\w$]*)(?:\s*\??\.\s*([A-Za-z_$][\w$]*))?/g)) {
1231
+ const bound = scope.get(m[1]);
1232
+ const value = bound?.kind === 'module' && m[2] ? memberOf(bound, m[2]) : bound;
1233
+ if (value?.kind === 'export')
1234
+ found.set(`${value.spec}#${value.name}`, value);
1235
+ }
1236
+ return [...found.values()];
1237
+ }
1238
+ function pageReference(value) {
1239
+ if (value?.kind === 'export')
1240
+ return `import:${value.spec}#${value.name}`;
1241
+ if (value?.kind === 'name' && /^[A-Z]/.test(value.name) && value.name !== 'Outlet')
1242
+ return value.name;
1243
+ return undefined;
1244
+ }
1245
+ function loaderValue(text, outer, param = null) {
1246
+ const fn = functionParts(text);
1247
+ if (!fn)
1248
+ return null;
1249
+ const scope = new Map(outer);
1250
+ topLevelItems(fn.params).forEach((p, i) => bindPattern(scope, parameterPattern(p), i === 0 ? param : null));
1251
+ return fn.block ? blockValue(fn.body, scope) : valueOf(fn.body, scope);
1252
+ }
1253
+ function functionParts(text) {
1254
+ let s = text.trim().replace(/^async\b\s*/, '');
1255
+ const keyword = /^function\b\s*\*?\s*(?:[A-Za-z_$][\w$]*\s*)?/.exec(s);
1256
+ if (keyword)
1257
+ s = s.slice(keyword[0].length);
1258
+ let params;
1259
+ let rest;
1260
+ if (s.startsWith('(')) {
1261
+ const close = (0, object_literal_1.matchBracket)(s, 0);
1262
+ if (close < 0)
1263
+ return null;
1264
+ params = s.slice(1, close);
1265
+ rest = s.slice(close + 1).trimStart();
1266
+ }
1267
+ else {
1268
+ const id = keyword ? null : /^[A-Za-z_$][\w$]*/.exec(s);
1269
+ if (!id)
1270
+ return null;
1271
+ params = id[0];
1272
+ rest = s.slice(id[0].length).trimStart();
1273
+ }
1274
+ if (!keyword && rest.startsWith(':')) {
1275
+ const arrow = arrowAt(rest);
1276
+ if (arrow < 0)
1277
+ return null;
1278
+ rest = rest.slice(arrow);
1279
+ }
1280
+ if (keyword) {
1281
+ return rest.startsWith('{') && (0, object_literal_1.matchBracket)(rest, 0) === rest.length - 1 ? { params, body: rest.slice(1, -1), block: true } : null;
1282
+ }
1283
+ if (!rest.startsWith('=>'))
1284
+ return null;
1285
+ const body = rest.slice(2).trim();
1286
+ if (!body.startsWith('{'))
1287
+ return { params, body, block: false };
1288
+ return (0, object_literal_1.matchBracket)(body, 0) === body.length - 1 ? { params, body: body.slice(1, -1), block: true } : null;
1289
+ }
1290
+ function arrowAt(text) {
1291
+ for (let i = 0; i < text.length; i++) {
1292
+ const ch = text[i];
1293
+ if (ch === '"' || ch === "'" || ch === '`') {
1294
+ i = (0, object_literal_1.skipString)(text, i);
1295
+ if (i < 0)
1296
+ return -1;
1297
+ }
1298
+ else if (ch === '{' || ch === '(' || ch === '[') {
1299
+ i = (0, object_literal_1.matchBracket)(text, i);
1300
+ if (i < 0)
1301
+ return -1;
1302
+ }
1303
+ else if (ch === '=' && text[i + 1] === '>')
1304
+ return i;
1305
+ }
1306
+ return -1;
1307
+ }
1308
+ function parameterPattern(param) {
1309
+ param = param.replace(/^\.\.\.\s*/, '');
1310
+ if (param.startsWith('{') || param.startsWith('[')) {
1311
+ const close = (0, object_literal_1.matchBracket)(param, 0);
1312
+ return close < 0 ? '' : param.slice(0, close + 1);
1313
+ }
1314
+ return /^[A-Za-z_$][\w$]*/.exec(param)?.[0] ?? '';
1315
+ }
1316
+ function blockValue(body, scope) {
1317
+ const word = /[A-Za-z_$][\w$]*/y;
1318
+ for (let i = 0; i < body.length;) {
1319
+ const ch = body[i];
1320
+ if (ch === '"' || ch === "'" || ch === '`' || ch === '{' || ch === '(' || ch === '[') {
1321
+ const end = ch === '{' || ch === '(' || ch === '[' ? (0, object_literal_1.matchBracket)(body, i) : (0, object_literal_1.skipString)(body, i);
1322
+ if (end < 0)
1323
+ return null;
1324
+ i = end + 1;
1325
+ continue;
1326
+ }
1327
+ word.lastIndex = i;
1328
+ const w = word.exec(body)?.[0];
1329
+ if (!w) {
1330
+ i++;
1331
+ continue;
1332
+ }
1333
+ const after = i + w.length;
1334
+ const statement = i === 0 || !/[\w$.]/.test(body[i - 1]);
1335
+ i = after;
1336
+ if (!statement)
1337
+ continue;
1338
+ if (w === 'return')
1339
+ return valueOf(body.slice(after, statementEnd(body, after)), scope);
1340
+ if (w === 'const' || w === 'let' || w === 'var')
1341
+ i = declare(body, after, scope);
1342
+ else if (w === 'function' || w === 'class') {
1343
+ const name = /^\s*\*?\s*([A-Za-z_$][\w$]*)/.exec(body.slice(after, after + 128));
1344
+ if (name)
1345
+ scope.set(name[1], null);
1346
+ }
1347
+ }
1348
+ return null;
1349
+ }
1350
+ function declare(body, at, scope) {
1351
+ for (let i = at;;) {
1352
+ while (/\s/.test(body[i] ?? ''))
1353
+ i++;
1354
+ let end;
1355
+ if (body[i] === '{' || body[i] === '[')
1356
+ end = (0, object_literal_1.matchBracket)(body, i) + 1;
1357
+ else
1358
+ end = i + (/^[A-Za-z_$][\w$]*/.exec(body.slice(i, i + 128))?.[0].length ?? 0);
1359
+ if (end <= i)
1360
+ return Math.max(end, i + 1);
1361
+ const pattern = body.slice(i, end);
1362
+ const init = initializerAt(body, end);
1363
+ let stop = end;
1364
+ if (init < 0)
1365
+ bindPattern(scope, pattern, null);
1366
+ else {
1367
+ stop = statementEnd(body, init, true);
1368
+ bindPattern(scope, pattern, valueOf(body.slice(init, stop), scope));
1369
+ }
1370
+ while (/\s/.test(body[stop] ?? ''))
1371
+ stop++;
1372
+ if (body[stop] !== ',')
1373
+ return stop;
1374
+ i = stop + 1;
1375
+ }
1376
+ }
1377
+ function initializerAt(body, at) {
1378
+ for (let i = at; i < body.length; i++) {
1379
+ const ch = body[i];
1380
+ if (ch === '"' || ch === "'" || ch === '`') {
1381
+ i = (0, object_literal_1.skipString)(body, i);
1382
+ if (i < 0)
1383
+ return -1;
1384
+ }
1385
+ else if (ch === '{' || ch === '(' || ch === '[') {
1386
+ i = (0, object_literal_1.matchBracket)(body, i);
1387
+ if (i < 0)
1388
+ return -1;
1389
+ }
1390
+ else if (ch === '=') {
1391
+ if (body[i + 1] === '>' || body[i + 1] === '=')
1392
+ i++;
1393
+ else
1394
+ return i + 1;
1395
+ }
1396
+ else if (ch === ';' || ch === ',' || ch === '}' || ch === ')')
1397
+ return -1;
1398
+ }
1399
+ return -1;
1400
+ }
1401
+ function statementEnd(text, from, comma = false) {
1402
+ let last = '';
1403
+ for (let i = from; i < text.length; i++) {
1404
+ const ch = text[i];
1405
+ if (ch === '"' || ch === "'" || ch === '`' || ch === '{' || ch === '(' || ch === '[') {
1406
+ const end = ch === '{' || ch === '(' || ch === '[' ? (0, object_literal_1.matchBracket)(text, i) : (0, object_literal_1.skipString)(text, i);
1407
+ if (end < 0)
1408
+ return text.length;
1409
+ i = end;
1410
+ last = text[end];
1411
+ continue;
1412
+ }
1413
+ if (ch === ';' || ch === '}' || ch === ')' || ch === ']' || (comma && ch === ','))
1414
+ return i;
1415
+ if (ch === '\n') {
1416
+ let j = i + 1;
1417
+ while (j < text.length && /\s/.test(text[j]))
1418
+ j++;
1419
+ if (last && !/[=(,[{?:&|+\-*/%<>!.]/.test(last) && !/[.?:&|+\-*/%=<>,([]/.test(text[j] ?? ''))
1420
+ return i;
1421
+ continue;
1422
+ }
1423
+ if (!/\s/.test(ch))
1424
+ last = ch;
1425
+ }
1426
+ return text.length;
1427
+ }
1428
+ function valueOf(text, scope) {
1429
+ let s = text.trim();
1430
+ for (let before = ''; before !== s;) {
1431
+ before = s;
1432
+ s = s.replace(/^await\b\s*/, '');
1433
+ if (s.startsWith('(') && (0, object_literal_1.matchBracket)(s, 0) === s.length - 1)
1434
+ s = s.slice(1, -1).trim();
1435
+ }
1436
+ if (s.startsWith('{') || s.startsWith('[')) {
1437
+ if ((0, object_literal_1.matchBracket)(s, 0) !== s.length - 1)
1438
+ return null;
1439
+ const inside = s.slice(1, -1);
1440
+ return s[0] === '{'
1441
+ ? { kind: 'object', text: inside, scope }
1442
+ : { kind: 'array', items: topLevelItems(inside).map((item) => (item ? valueOf(item, scope) : null)) };
1443
+ }
1444
+ const head = /^(?:(import)\s*\(|(Promise)\s*\.\s*all\s*\(|([A-Za-z_$][\w$]*)|\()/.exec(s);
1445
+ if (!head)
1446
+ return null;
1447
+ let value;
1448
+ let i;
1449
+ if (head[3]) {
1450
+ value = nameValue(head[3], scope);
1451
+ i = head[0].length;
1452
+ }
1453
+ else {
1454
+ const open = head[0].length - 1;
1455
+ const close = (0, object_literal_1.matchBracket)(s, open);
1456
+ if (close < 0)
1457
+ return null;
1458
+ const inside = s.slice(open + 1, close);
1459
+ if (head[1]) {
1460
+ const spec = /^\s*(["'])([^"'`]+)\1\s*$/.exec(inside)?.[2];
1461
+ value = spec ? { kind: 'module', spec } : null;
1462
+ }
1463
+ else if (head[2]) {
1464
+ const all = valueOf(inside, scope);
1465
+ value = all?.kind === 'array' ? all : null;
1466
+ }
1467
+ else
1468
+ value = valueOf(inside, scope);
1469
+ i = close + 1;
1470
+ }
1471
+ while (value && i < s.length) {
1472
+ const rest = s.slice(i);
1473
+ const then = /^\s*\??\.\s*then\s*\(/.exec(rest);
1474
+ if (then) {
1475
+ const open = i + then[0].length - 1;
1476
+ const close = (0, object_literal_1.matchBracket)(s, open);
1477
+ if (close < 0 || value.kind !== 'module')
1478
+ return null;
1479
+ const callback = topLevelItems(s.slice(open + 1, close))[0];
1480
+ value = callback ? loaderValue(callback, scope, value) : null;
1481
+ i = close + 1;
1482
+ continue;
1483
+ }
1484
+ const dot = /^\s*\??\.\s*([A-Za-z_$][\w$]*)/.exec(rest);
1485
+ const bracket = dot ? null : /^\s*\[\s*(["'])([A-Za-z_$][\w$]*)\1\s*\]/.exec(rest);
1486
+ const name = dot?.[1] ?? bracket?.[2];
1487
+ if (name === undefined)
1488
+ return null;
1489
+ value = memberOf(value, name);
1490
+ i += (dot ?? bracket)[0].length;
1491
+ }
1492
+ return value;
1493
+ }
1494
+ function nameValue(name, scope) {
1495
+ return scope.has(name) ? scope.get(name) ?? null : { kind: 'name', name };
1496
+ }
1497
+ function memberOf(value, key) {
1498
+ if (value?.kind === 'module')
1499
+ return { kind: 'export', spec: value.spec, name: key };
1500
+ if (value?.kind !== 'object')
1501
+ return null;
1502
+ const text = objectEntries(value.text).props.get(key);
1503
+ return text === undefined ? null : valueOf(text, value.scope);
1504
+ }
1505
+ function bindPattern(scope, pattern, value) {
1506
+ const p = pattern.trim();
1507
+ if (!p)
1508
+ return;
1509
+ if (/^[A-Za-z_$][\w$]*$/.test(p)) {
1510
+ scope.set(p, value);
1511
+ return;
1512
+ }
1513
+ const close = p.startsWith('{') || p.startsWith('[') ? (0, object_literal_1.matchBracket)(p, 0) : -1;
1514
+ if (close !== p.length - 1) {
1515
+ for (const name of p.matchAll(/[A-Za-z_$][\w$]*/g))
1516
+ scope.set(name[0], null);
1517
+ return;
1518
+ }
1519
+ const items = topLevelItems(p.slice(1, -1));
1520
+ items.forEach((item, index) => {
1521
+ if (!item)
1522
+ return;
1523
+ const rest = /^\.\.\.\s*([\s\S]*)$/.exec(item);
1524
+ if (rest)
1525
+ return bindPattern(scope, rest[1], null);
1526
+ if (p[0] === '[') {
1527
+ return bindPattern(scope, item.replace(/\s*=(?![=>])[\s\S]*$/, ''), value?.kind === 'array' ? value.items[index] ?? null : null);
1528
+ }
1529
+ const prop = /^(?:([A-Za-z_$][\w$]*)|(["'])([^"']*)\2)\s*(?::\s*([\s\S]+?))?\s*(?:=(?![=>])[\s\S]*)?$/.exec(item);
1530
+ if (!prop)
1531
+ return bindPattern(scope, item.replace(/^[^:]*:/, ''), null);
1532
+ const key = prop[1] ?? prop[3];
1533
+ bindPattern(scope, prop[4] ?? key, memberOf(value, key));
1534
+ });
1535
+ }
1536
+ function objectEntries(text) {
1537
+ const props = new Map();
1538
+ const spreads = [];
1539
+ for (const entry of topLevelEntries(text)) {
1540
+ const spread = /^\.\.\.\s*([\s\S]+)$/.exec(entry);
1541
+ const pair = spread ? null : /^(?:([A-Za-z_$][\w$]*)|(["'])([A-Za-z_$][\w$]*)\2)\s*:\s*([\s\S]+)$/.exec(entry);
1542
+ const method = spread || pair ? null : /^(async\s+)?([A-Za-z_$][\w$]*)\s*\(/.exec(entry);
1543
+ if (spread)
1544
+ spreads.push(spread[1]);
1545
+ else if (pair)
1546
+ props.set(pair[1] ?? pair[3], pair[4]);
1547
+ else if (method)
1548
+ props.set(method[2], `${method[1] ?? ''}function ${entry.slice(method[0].length - 1)}`);
1549
+ else if (/^[A-Za-z_$][\w$]*$/.test(entry))
1550
+ props.set(entry, entry);
1551
+ }
1552
+ return { props, spreads };
1553
+ }
1554
+ const ROUTER_PACKAGES = ['react-router-dom', 'react-router', 'react-router-native'];
1555
+ const MAX_TABLES = 512;
1556
+ const CONSUMER_HINT = /\buseRoutes\b|\bcreate(?:Browser|Hash|Memory)Router\b|<Route\b/;
1557
+ function isTableRoute(node) {
1558
+ return node.kind === 'route' && node.id.startsWith(`route:${node.filePath}:${node.startLine}:table:`);
1559
+ }
1560
+ function routeReferences(route, fromNodeId, filePath, line) {
1561
+ const language = filePath.endsWith('.tsx') ? 'tsx' : 'jsx';
1562
+ const ref = (referenceName) => ({ fromNodeId, referenceName, referenceKind: 'references', line, column: 0, filePath, language });
1563
+ const refs = [];
1564
+ const target = route.component ?? route.lazy;
1565
+ if (target)
1566
+ refs.push(ref(target));
1567
+ for (const layout of route.layouts)
1568
+ refs.push(ref(LAYOUT_PREFIX + layout));
1569
+ return refs;
1570
+ }
1571
+ function tableRoutes(context) {
1572
+ const nodes = [];
1573
+ const references = [];
1574
+ const consumers = new Set();
1575
+ for (const pkg of ROUTER_PACKAGES) {
1576
+ for (const n of context.getNodesByName(pkg)) {
1577
+ if (n.kind === 'import' && !(0, query_utils_1.isTestPath)(n.filePath))
1578
+ consumers.add(n.filePath);
1579
+ }
1580
+ }
1581
+ if (consumers.size === 0)
1582
+ return { nodes, references };
1583
+ const queue = [];
1584
+ const queued = new Set();
1585
+ const enqueue = (table, prefix, from, layouts) => {
1586
+ if (!table || queued.size >= MAX_TABLES)
1587
+ return;
1588
+ const key = `${table.file}\0${table.at}\0${prefix.join('\0')}`;
1589
+ if (queued.has(key))
1590
+ return;
1591
+ queued.add(key);
1592
+ queue.push({ ...table, prefix, layouts: table.file === from ? layouts : [] });
1593
+ };
1594
+ for (const file of [...consumers].sort()) {
1595
+ const source = context.readFile(file);
1596
+ if (!source || !CONSUMER_HINT.test(source))
1597
+ continue;
1598
+ const scan = scanRoutes(source, allowsJsx(file), { objects: ROUTER_CALL.test(source), uses: true });
1599
+ for (const use of scan.uses) {
1600
+ const tables = use.literal !== undefined ? [{ file, at: use.literal }] : tableNamed(use.name, file, context);
1601
+ const prefix = pathValues(use.prefix, file, context);
1602
+ for (const table of tables)
1603
+ enqueue(table, prefix, file, use.layouts);
1604
+ }
1605
+ }
1606
+ const made = new Set();
1607
+ const now = Date.now();
1608
+ for (let next = queue.shift(); next; next = queue.shift()) {
1609
+ const { file, at, prefix, layouts } = next;
1610
+ const source = context.readFile(file);
1611
+ if (!source)
1612
+ continue;
1613
+ const scan = scanRoutes(source, allowsJsx(file), { table: { at, prefix: prefix.map((lit) => ({ lit })), layouts } });
1614
+ for (const named of scan.names) {
1615
+ const prefix = pathValues(named.prefix, file, context);
1616
+ for (const table of tableNamed(named, file, context))
1617
+ enqueue(table, prefix, file, named.layouts);
1618
+ }
1619
+ if (ROUTER_CALL.test(source))
1620
+ continue;
1621
+ const lineAt = (0, synth_utils_1.makeLineAt)(source, 1);
1622
+ for (const route of scan.routes) {
1623
+ const line = lineAt(route.at);
1624
+ const id = `route:${file}:${line}:table:${route.path}`;
1625
+ if (made.has(id))
1626
+ continue;
1627
+ made.add(id);
1628
+ const values = route.parts.map((p) => p.lit ?? (p.expr ? constantPathValue(p.expr, file, context) : null));
1629
+ nodes.push({
1630
+ id,
1631
+ kind: 'route',
1632
+ name: values.every((v) => v !== null) ? composeRoutePath(values) : route.path,
1633
+ qualifiedName: `${file}::route:${route.path}`,
1634
+ filePath: file,
1635
+ startLine: line,
1636
+ endLine: line,
1637
+ startColumn: 0,
1638
+ endColumn: 0,
1639
+ language: file.endsWith('.tsx') ? 'tsx' : 'jsx',
1640
+ updatedAt: now,
1641
+ });
1642
+ references.push(...routeReferences(route, id, file, line));
1643
+ }
1644
+ }
1645
+ return { nodes, references };
1646
+ }
1647
+ function pathValues(parts, fromFile, context) {
1648
+ return parts.map((p) => p.lit ?? (p.expr ? constantPathValue(p.expr, fromFile, context) : null) ?? `{${p.expr}}`);
1649
+ }
1650
+ function allowsJsx(filePath) {
1651
+ return !/\.(?:ts|mts|cts)$/.test(filePath);
1652
+ }
1653
+ function scriptLanguage(filePath) {
1654
+ return /\.tsx$/.test(filePath) ? 'tsx' : /\.[cm]?ts$/.test(filePath) ? 'typescript' : /\.jsx$/.test(filePath) ? 'jsx' : 'javascript';
1655
+ }
1656
+ function tableNamed(named, file, context, depth = 0) {
1657
+ const source = context.readFile(file);
1658
+ if (!source)
1659
+ return [];
1660
+ const safe = (0, strip_comments_1.stripCommentsForRegex)(source, 'typescript');
1661
+ const local = declaredTable(safe, named.name, named.call, visibleAt(named.at, safe, file, context));
1662
+ if (local.length > 0)
1663
+ return tablesAt(local, file, context, depth);
1664
+ const language = scriptLanguage(file);
1665
+ const mapping = context.getImportMappings(file, language).find((m) => m.localName === named.name);
1666
+ if (!mapping || mapping.isNamespace || depth > 3)
1667
+ return [];
1668
+ const target = (0, import_resolver_1.resolveImportPath)(mapping.source, file, language, context);
1669
+ if (!target)
1670
+ return [];
1671
+ return exportedTable(target, mapping.isDefault ? 'default' : mapping.exportedName, named.call, context, depth + 1);
1672
+ }
1673
+ function tablesAt(sites, file, context, depth) {
1674
+ return sites.flatMap((site) => typeof site === 'number' ? [{ file, at: site }] : depth > 3 ? [] : tableNamed(site, file, context, depth + 1));
1675
+ }
1676
+ function exportedTable(file, exported, call, context, depth) {
1677
+ const source = context.readFile(file);
1678
+ if (!source)
1679
+ return [];
1680
+ const safe = (0, strip_comments_1.stripCommentsForRegex)(source, 'typescript');
1681
+ let local = exported;
1682
+ if (exported === 'default') {
1683
+ const m = /\bexport\s+default\s+/.exec(safe);
1684
+ if (m) {
1685
+ const after = m.index + m[0].length;
1686
+ const inline = call ? returnedTables(safe, after) : heldTable(safe, after);
1687
+ if (inline.length > 0)
1688
+ return tablesAt(inline, file, context, depth);
1689
+ local = /^([A-Za-z_$][\w$]*)\s*(?:;|\n|$)/.exec(safe.slice(after))?.[1] ?? '';
1690
+ }
1691
+ else
1692
+ local = /\bexport\s*\{[^}]*?\b([A-Za-z_$][\w$]*)\s+as\s+default\b/.exec(safe)?.[1] ?? '';
1693
+ }
1694
+ else {
1695
+ const alias = new RegExp(`\\bexport\\s*\\{[^}]*?\\b([A-Za-z_$][\\w$]*)\\s+as\\s+${(0, utils_1.escapeRegExp)(exported)}\\b`).exec(safe);
1696
+ if (alias)
1697
+ local = alias[1];
1698
+ }
1699
+ const declared = local ? declaredTable(safe, local, call, visibleAt(undefined, safe, file, context)) : [];
1700
+ if (declared.length > 0)
1701
+ return tablesAt(declared, file, context, depth);
1702
+ if (depth > 3)
1703
+ return [];
1704
+ const language = scriptLanguage(file);
1705
+ for (const re of context.getReExports?.(file, language) ?? []) {
1706
+ if (re.kind === 'named' && re.exportedName !== exported)
1707
+ continue;
1708
+ const target = (0, import_resolver_1.resolveImportPath)(re.source, file, language, context);
1709
+ if (!target)
1710
+ continue;
1711
+ const found = exportedTable(target, re.kind === 'named' ? re.originalName : exported, call, context, depth + 1);
1712
+ if (found.length > 0)
1713
+ return found;
1714
+ }
1715
+ return [];
1716
+ }
1717
+ function declaredTable(safe, name, call, visible) {
1718
+ const id = (0, utils_1.escapeRegExp)(name);
1719
+ const decls = [...safe.matchAll(new RegExp(`(?:^|[^\\w$.])((?:const|let|var)\\s+${id}\\s*(?::[^=;]*)?=\\s*)`, 'g'))];
1720
+ const chosen = decls.length > 0 ? visible(decls.map((d) => d.index + d[0].length - d[1].length)) : undefined;
1721
+ const decl = chosen === undefined ? undefined : decls[chosen];
1722
+ if (decl) {
1723
+ const after = decl.index + decl[0].length;
1724
+ return call ? returnedTables(safe, after) : heldTable(safe, after);
1725
+ }
1726
+ if (!call)
1727
+ return [];
1728
+ const fn = new RegExp(`(?:^|[^\\w$.])function\\s+${id}\\s*\\(`).exec(safe);
1729
+ return fn ? returnedTables(safe, fn.index + fn[0].indexOf('function')) : [];
1730
+ }
1731
+ function heldTable(safe, at) {
1732
+ while (safe[at] === '(')
1733
+ at = skipSpace(safe, at + 1);
1734
+ if (safe[at] === '[' || safe[at] === '{')
1735
+ return [at];
1736
+ const memo = /(?:React\s*\.\s*)?useMemo\s*(?:<[^()]*>)?\s*\(\s*/y;
1737
+ memo.lastIndex = at;
1738
+ if (memo.test(safe)) {
1739
+ const handed = /([A-Za-z_$][\w$]*)\s*,/y;
1740
+ handed.lastIndex = memo.lastIndex;
1741
+ const fn = handed.exec(safe);
1742
+ return fn ? [{ name: fn[1], call: true, at: memo.lastIndex }] : returnedTables(safe, memo.lastIndex);
1743
+ }
1744
+ const call = /(await\s+)?([A-Za-z_$][\w$]*)\s*\(/y;
1745
+ call.lastIndex = at;
1746
+ const m = call.exec(safe);
1747
+ return m ? [{ name: m[2], call: true, at: at + (m[1]?.length ?? 0) }] : [];
1748
+ }
1749
+ function visibleAt(use, safe, file, context) {
1750
+ return (keywords) => {
1751
+ const lineStarts = [0];
1752
+ for (let i = safe.indexOf('\n'); i !== -1; i = safe.indexOf('\n', i + 1))
1753
+ lineStarts.push(i + 1);
1754
+ const offset = (line, column) => (lineStarts[line - 1] ?? safe.length) + column;
1755
+ const fns = context.getNodesInFile(file)
1756
+ .filter((n) => synth_utils_1.FN_KINDS.has(n.kind))
1757
+ .map((n) => ({ start: offset(n.startLine, n.startColumn), end: offset(n.endLine, n.endColumn) }));
1758
+ const around = (at) => fns.filter((f) => f.start < at && f.end > at);
1759
+ const scopes = new Set(use === undefined ? [] : around(use));
1760
+ let best;
1761
+ let depth = -1;
1762
+ keywords.forEach((at, i) => {
1763
+ const encl = around(at);
1764
+ if (!encl.every((f) => scopes.has(f)))
1765
+ return;
1766
+ if (encl.length > depth || (encl.length === depth && use !== undefined && at < use)) {
1767
+ best = i;
1768
+ depth = encl.length;
1769
+ }
1770
+ });
1771
+ return best;
1772
+ };
1773
+ }
1774
+ function returnedTables(safe, at) {
1775
+ const body = functionBody(safe, at);
1776
+ if (!body)
1777
+ return [];
1778
+ if (!body.block)
1779
+ return heldTable(safe, body.start);
1780
+ return ownReturns(safe, body.start, body.end).flatMap((value) => heldTable(safe, value));
1781
+ }
1782
+ function functionBody(safe, at) {
1783
+ let i = skipSpace(safe, at);
1784
+ const keyword = (word) => {
1785
+ const re = new RegExp(`${word}\\b`, 'y');
1786
+ re.lastIndex = i;
1787
+ if (!re.test(safe))
1788
+ return false;
1789
+ i = skipSpace(safe, re.lastIndex);
1790
+ return true;
1791
+ };
1792
+ keyword('async');
1793
+ const arrow = !keyword('function');
1794
+ const name = /\*?\s*[A-Za-z_$][\w$]*/y;
1795
+ if (!arrow) {
1796
+ name.lastIndex = i;
1797
+ if (name.test(safe))
1798
+ i = skipSpace(safe, name.lastIndex);
1799
+ }
1800
+ if (safe[i] === '(') {
1801
+ const close = (0, object_literal_1.matchBracket)(safe, i);
1802
+ if (close < 0)
1803
+ return null;
1804
+ i = skipSpace(safe, close + 1);
1805
+ }
1806
+ else {
1807
+ const param = /[A-Za-z_$][\w$]*/y;
1808
+ param.lastIndex = i;
1809
+ if (!arrow || !param.test(safe))
1810
+ return null;
1811
+ i = skipSpace(safe, param.lastIndex);
1812
+ }
1813
+ if (safe[i] === ':') {
1814
+ const stop = safe.indexOf(arrow ? '=>' : '{', i);
1815
+ if (stop < 0)
1816
+ return null;
1817
+ i = stop;
1818
+ }
1819
+ if (arrow) {
1820
+ if (!safe.startsWith('=>', i))
1821
+ return null;
1822
+ i = skipSpace(safe, i + 2);
1823
+ if (safe[i] !== '{')
1824
+ return { block: false, start: i, end: i };
1825
+ }
1826
+ if (safe[i] !== '{')
1827
+ return null;
1828
+ const end = blockEnd(safe, i);
1829
+ return end < 0 ? null : { block: true, start: i, end };
1830
+ }
1831
+ const BLOCK_HEADS = new Set(['if', 'for', 'while', 'switch', 'catch', 'with']);
1832
+ function ownReturns(safe, open, close) {
1833
+ const values = [];
1834
+ const pastBody = (paren) => {
1835
+ const params = paren < 0 ? -1 : (0, object_literal_1.matchBracket)(safe, paren);
1836
+ if (params < 0)
1837
+ return -1;
1838
+ let i = skipSpace(safe, params + 1);
1839
+ if (safe[i] === ':')
1840
+ i = safe.indexOf('{', i);
1841
+ return i >= 0 && safe[i] === '{' ? blockEnd(safe, i) : -1;
1842
+ };
1843
+ for (let i = open + 1; i < close; i++) {
1844
+ const ch = safe[i];
1845
+ if (opensString(safe, i)) {
1846
+ const end = (0, object_literal_1.skipString)(safe, i);
1847
+ if (end < 0)
1848
+ break;
1849
+ i = end;
1850
+ }
1851
+ else if (ch === '=' && safe[i + 1] === '>') {
1852
+ const body = skipSpace(safe, i + 2);
1853
+ const end = safe[body] === '{' ? blockEnd(safe, body) : -1;
1854
+ i = end < 0 ? i + 1 : end;
1855
+ }
1856
+ else if (/[A-Za-z_$]/.test(ch) && !/[\w$.]/.test(safe[i - 1] ?? '')) {
1857
+ const word = /[A-Za-z_$][\w$]*/y;
1858
+ word.lastIndex = i;
1859
+ word.test(safe);
1860
+ const name = safe.slice(i, word.lastIndex);
1861
+ const next = skipSpace(safe, word.lastIndex);
1862
+ if (name === 'return') {
1863
+ values.push(next);
1864
+ }
1865
+ else if (name === 'function') {
1866
+ const end = pastBody(safe.indexOf('(', next));
1867
+ if (end > 0) {
1868
+ i = end;
1869
+ continue;
1870
+ }
1871
+ }
1872
+ else if (safe[next] === '(' && !BLOCK_HEADS.has(name)) {
1873
+ const end = pastBody(next);
1874
+ if (end > 0) {
1875
+ i = end;
1876
+ continue;
1877
+ }
1878
+ }
1879
+ i = word.lastIndex - 1;
1880
+ }
1881
+ }
1882
+ return values;
1883
+ }
1884
+ function blockEnd(safe, open) {
1885
+ let depth = 0;
1886
+ for (let i = open; i < safe.length; i++) {
1887
+ if (opensString(safe, i)) {
1888
+ const end = (0, object_literal_1.skipString)(safe, i);
1889
+ if (end < 0)
1890
+ return -1;
1891
+ i = end;
1892
+ continue;
1893
+ }
1894
+ const ch = safe[i];
1895
+ if (ch === '{' || ch === '(' || ch === '[')
1896
+ depth++;
1897
+ else if ((ch === '}' || ch === ')' || ch === ']') && --depth === 0)
1898
+ return i;
1899
+ }
1900
+ return -1;
1901
+ }
1902
+ function opensString(safe, i) {
1903
+ const ch = safe[i];
1904
+ return ch === '`' || ((ch === '"' || ch === "'") && !/[\w$]/.test(safe[i - 1] ?? ''));
1905
+ }
1906
+ function skipSpace(safe, i) {
1907
+ while (/\s/.test(safe[i] ?? ''))
1908
+ i++;
1909
+ return i;
1910
+ }
632
1911
  function isPascalCase(str) {
633
1912
  return /^[A-Z][a-zA-Z0-9]*$/.test(str);
634
1913
  }
635
- /**
636
- * Check if name is a built-in type
637
- */
638
1914
  function isBuiltInType(name) {
639
1915
  return BUILT_IN_TYPES.has(name);
640
1916
  }
@@ -644,9 +1920,14 @@ const BUILT_IN_TYPES = new Set([
644
1920
  'React', 'Component', 'Fragment', 'Suspense', 'StrictMode',
645
1921
  ]);
646
1922
  const COMPONENT_KINDS = new Set(['component', 'function', 'class']);
647
- /**
648
- * Resolve a component reference using name-based lookup
649
- */
1923
+ function ownDeclarations(name, filePath, context) {
1924
+ return (context.getNodesInFileNamed?.(filePath, name) ?? context.getNodesInFile(filePath).filter((n) => n.name === name))
1925
+ .filter((n) => n.qualifiedName === name && n.kind !== 'import' && n.kind !== 'export' && n.kind !== 'file');
1926
+ }
1927
+ function namesType(ref) {
1928
+ return ref.referenceKind === 'implements' ||
1929
+ (ref.referenceKind === 'references' && !ref.fromNodeId.startsWith('route:'));
1930
+ }
650
1931
  function resolveComponent(name, fromFile, context) {
651
1932
  const candidates = context.getNodesByName(name);
652
1933
  if (candidates.length === 0)
@@ -654,33 +1935,22 @@ function resolveComponent(name, fromFile, context) {
654
1935
  const components = candidates.filter((n) => COMPONENT_KINDS.has(n.kind));
655
1936
  if (components.length === 0)
656
1937
  return null;
657
- // Prefer same directory
658
- const fromDir = fromFile.substring(0, fromFile.lastIndexOf('/'));
659
- const sameDir = components.filter((n) => n.filePath.startsWith(fromDir));
1938
+ const sameDir = (0, component_folder_1.inReferencingFolder)(fromFile, components, (n) => n.filePath);
660
1939
  if (sameDir.length > 0)
661
1940
  return sameDir[0].id;
662
- // Prefer component directories
663
1941
  const COMPONENT_DIRS = ['/components/', '/src/components/', '/app/components/', '/pages/', '/src/pages/', '/views/', '/src/views/'];
664
1942
  const preferred = components.filter((n) => COMPONENT_DIRS.some((d) => n.filePath.includes(d)));
665
1943
  if (preferred.length > 0)
666
1944
  return preferred[0].id;
667
- // No positional signal: only an UNAMBIGUOUS name may resolve. Returning
668
- // components[0] here picked an arbitrary same-named class anywhere in the
669
- // repo (#764) — let the name-matcher's proximity scoring decide instead.
670
1945
  return components.length === 1 ? components[0].id : null;
671
1946
  }
672
- /** JS/TS (and their JSX dialects): modules where a cross-file name needs an import. */
673
1947
  function isEsmLanguage(language) {
674
1948
  return language === 'typescript' || language === 'tsx' || language === 'javascript' || language === 'jsx';
675
1949
  }
676
- /**
677
- * Resolve a custom hook reference using name-based lookup
678
- */
679
1950
  function resolveHook(name, fromFile, context, language) {
680
1951
  const candidates = context.getNodesByName(name);
681
1952
  if (candidates.length === 0)
682
1953
  return null;
683
- // A hook nested inside another function is only callable in there.
684
1954
  const nested = (n) => context.getNodesInFile(n.filePath).some((f) => f.id !== n.id && (f.kind === 'function' || f.kind === 'method') && f.startLine <= n.startLine && f.endLine >= n.endLine &&
685
1955
  (f.startLine < n.startLine || f.endLine > n.endLine));
686
1956
  const hooks = candidates.filter((n) => n.kind === 'function' && n.name.startsWith('use') && !nested(n));
@@ -689,31 +1959,20 @@ function resolveHook(name, fromFile, context, language) {
689
1959
  const sameFile = hooks.find((n) => n.filePath === fromFile);
690
1960
  if (sameFile)
691
1961
  return sameFile.id;
692
- // A JS/TS module reaches another file's hook only by importing it — the
693
- // import resolver's to follow (an imported name never gets here) — never
694
- // by name alone.
695
1962
  if (isEsmLanguage(language))
696
1963
  return null;
697
- // Prefer hooks directories
698
1964
  const HOOK_DIRS = ['/hooks/', '/src/hooks/', '/lib/hooks/', '/utils/hooks/'];
699
1965
  const preferred = hooks.filter((n) => HOOK_DIRS.some((d) => n.filePath.includes(d)));
700
1966
  if (preferred.length > 0)
701
1967
  return preferred[0].id;
702
1968
  return hooks[0].id;
703
1969
  }
704
- /**
705
- * Resolve a context reference using name-based lookup
706
- */
707
1970
  function resolveContext(name, ref, context) {
708
- // In a JS/TS module only the file's own context is in reach by name; another
709
- // file's comes through an import (trpc's adapters' `createContext?.(…)` is an
710
- // option, not an example app's `createContext`).
711
1971
  if (isEsmLanguage(ref.language)) {
712
1972
  return context.getNodesByName(name).find((n) => n.filePath === ref.filePath)?.id ?? null;
713
1973
  }
714
1974
  const candidates = context.getNodesByName(name);
715
1975
  if (candidates.length === 0) {
716
- // Try without Context/Provider suffix
717
1976
  const baseName = name.replace(/Context$|Provider$/, '');
718
1977
  if (baseName !== name) {
719
1978
  const baseCandidates = context.getNodesByName(baseName);
@@ -722,7 +1981,6 @@ function resolveContext(name, ref, context) {
722
1981
  }
723
1982
  return null;
724
1983
  }
725
- // Prefer context directories
726
1984
  const CONTEXT_DIRS = ['/context/', '/contexts/', '/src/context/', '/src/contexts/', '/providers/', '/src/providers/'];
727
1985
  const preferred = candidates.filter((n) => CONTEXT_DIRS.some((d) => n.filePath.includes(d)));
728
1986
  if (preferred.length > 0)