@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,14 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SYNTH_PROGRESS_STEPS = exports.SYNTH_PASSES = void 0;
4
+ exports.goSignatureArity = goSignatureArity;
5
+ exports.isJsxChildCandidate = isJsxChildCandidate;
4
6
  exports.hasSynthesisPattern = hasSynthesisPattern;
5
7
  exports.synthesizeCallbackEdges = synthesizeCallbackEdges;
6
8
  const generated_detection_1 = require("../extraction/generated-detection");
7
9
  const strip_comments_1 = require("./strip-comments");
10
+ const utils_1 = require("../utils");
8
11
  const c_fnptr_synthesizer_1 = require("./c-fnptr-synthesizer");
12
+ const cpp_template_instantiations_1 = require("./cpp-template-instantiations");
9
13
  const goframe_synthesizer_1 = require("./goframe-synthesizer");
14
+ const go_func_field_synthesizer_1 = require("./go-func-field-synthesizer");
10
15
  const expo_router_synthesizer_1 = require("./expo-router-synthesizer");
11
16
  const next_router_synthesizer_1 = require("./next-router-synthesizer");
17
+ const const_alias_synthesizer_1 = require("./const-alias-synthesizer");
18
+ const nextjs_1 = require("./frameworks/nextjs");
19
+ const next_proxy_1 = require("./frameworks/next-proxy");
12
20
  const react_router_synthesizer_1 = require("./react-router-synthesizer");
13
21
  const tanstack_router_synthesizer_1 = require("./tanstack-router-synthesizer");
14
22
  const vue_router_synthesizer_1 = require("./vue-router-synthesizer");
@@ -16,65 +24,39 @@ const angular_template_synthesizer_1 = require("./angular-template-synthesizer")
16
24
  const sveltekit_synthesizer_1 = require("./sveltekit-synthesizer");
17
25
  const cooperative_yield_1 = require("./cooperative-yield");
18
26
  const tier_synthesizer_1 = require("./tier-synthesizer");
27
+ const tauri_synthesizer_1 = require("./tauri-synthesizer");
19
28
  const synth_utils_1 = require("./synth-utils");
29
+ const event_emitter_synthesizer_1 = require("./event-emitter-synthesizer");
20
30
  const import_resolver_1 = require("./import-resolver");
21
31
  const name_matcher_1 = require("./name-matcher");
32
+ const go_stdlib_methods_1 = require("./go-stdlib-methods");
33
+ const override_parameters_1 = require("./override-parameters");
34
+ const react_1 = require("./frameworks/react");
35
+ const jsx_code_1 = require("./jsx-code");
36
+ const query_utils_1 = require("../search/query-utils");
22
37
  const REGISTRAR_NAME = /^(on[A-Z]\w*|subscribe|addListener|addEventListener|register|watch|listen|addCallback)$/;
23
38
  const DISPATCHER_NAME = /(emit|trigger|notify|dispatch|fire|publish|flush)/i;
24
39
  const MAX_CALLBACKS_PER_CHANNEL = 40;
25
- const EVENT_FANOUT_CAP = 6; // skip events with more handlers/dispatchers than this (too generic without type info)
26
- const ON_RE = /\.(?:on|once|addListener)\(\s*['"]([^'"]+)['"]\s*,\s*(?:function\s+(\w+)|(?:this\.)?(\w+))/g;
27
- const EMIT_RE = /\.(?:emit|fire|dispatchEvent)\(\s*['"]([^'"]+)['"]/g;
40
+ const EVENT_FANOUT_CAP = 6;
28
41
  const SETSTATE_RE = /this\.setState\s*\(/;
29
- const FLUTTER_SETSTATE_RE = /\bsetState\s*\(/; // Flutter: setState((){…}) / this.setState
42
+ const FLUTTER_SETSTATE_RE = /\bsetState\s*\(/;
30
43
  const JS_FAMILY = ['typescript', 'javascript', 'tsx', 'jsx'];
31
- const JSX_TAG_RE = /<([A-Z][A-Za-z0-9_]*)[\s/>]/g;
44
+ const JSX_FAMILY = ['tsx', 'jsx', 'javascript'];
45
+ const JSX_TAG_RE = /<([A-Z][A-Za-z0-9_]*)(?=[\s/><])/g;
32
46
  const MAX_JSX_CHILDREN = 30;
33
- // Vue SFC templates: kebab-case child components (<el-button> → ElButton) and
34
- // event bindings (@click="fn" / v-on:click="fn"). PascalCase children (<VPNav/>)
35
- // are already caught by JSX_TAG_RE via the SFC component node.
47
+ const WRAPPER_CALL_RE = /\b(?:styled|memo|forwardRef)\s*\(\s*[A-Z]/;
36
48
  const VUE_KEBAB_RE = /<([a-z][a-z0-9]*(?:-[a-z0-9]+)+)[\s/>]/g;
37
- // PascalCase component tags — `<MediaCard ...>`, `<NavBar/>`. HTML elements are
38
- // lowercase, so an uppercase-initial tag is a component usage; built-ins
39
- // (`<NuxtLink>`, `<Transition>`) simply resolve to nothing and emit no edge.
40
49
  const VUE_PASCAL_RE = /<([A-Z][A-Za-z0-9]*)[\s/>]/g;
41
50
  const VUE_HANDLER_RE = /(?:@|v-on:)([a-zA-Z][\w-]*)(?:\.[\w]+)*\s*=\s*"([^"]+)"/g;
42
- // Composable/hook destructure: `const { close: closeSidebar } = useSidebarControl()`.
43
- // Captures the destructure body + the called composable; only `use*` calls qualify.
44
51
  const VUE_DESTRUCTURE_RE = /(?:const|let|var)\s*\{([^}]+)\}\s*=\s*(\w+)\s*\(/g;
45
- // Closure-collection dynamic dispatch (language-agnostic, Swift-first). A method
46
- // appends a closure to a collection property; another method iterates that
47
- // property *invoking each element* (`coll.forEach { $0() }` / `{ it() }`). The
48
- // element-invoke (`$0(` / `it(`) PROVES the collection holds closures, so pairing
49
- // a dispatcher to same-named registrars (`.append`/`.add`/`.push`/`.insert`,
50
- // incl. Swift `prop.write { $0.append }`) is high-precision. Cross-file/class by
51
- // design: Alamofire appends in `DataRequest.validate` but iterates in the base
52
- // `Request.didCompleteTask` — neither same-file nor same-class pairing reaches it.
53
52
  const CC_DISPATCH_RE = /(\w+)\.forEach\s*\{\s*(?:\$0|it)\s*\(/g;
54
53
  const CC_APPEND_WRITE_RE = /(\w+)\.write\s*\{\s*\$0(?:\.(\w+))?\.(?:append|add|push|insert)\s*\(/g;
55
54
  const CC_APPEND_DIRECT_RE = /(\w+)\.(?:append|add|push|insert)\s*\(/g;
56
- const CC_FANOUT_CAP = 8; // skip a field name with more dispatchers/registrars than this (too generic to pair confidently)
57
- // The dispatcher gate — `{ $0( ` / `{ it( ` element-invocation — is Swift/Kotlin
58
- // trailing-closure syntax, so ONLY those languages can ever contribute a
59
- // dispatcher, and a cross-language registrar pairing (a JS `.push(` against a
60
- // Swift dispatcher's field name) would be a wrong edge, not a missed one.
61
- // Gating both sides here isn't just precision: `.push(`/`.add(` is everywhere
62
- // in JS/PHP, so an ungated scan slices + regexes nearly every function on repos
63
- // where the pass cannot emit a single edge — on a 12k-file PHP/JS app that was
64
- // 20+ minutes of the "Resolving refs" tail and a #850 watchdog kill (#1235).
55
+ const CC_FANOUT_CAP = 8;
65
56
  const CC_LANGUAGES = new Set(['swift', 'kotlin']);
66
57
  function kebabToPascal(s) {
67
58
  return s.split('-').map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join('');
68
59
  }
69
- /**
70
- * Nuxt auto-import name for a component, derived from its path UNDER `components/`:
71
- * `components/media/Card.vue` → `MediaCard`, `components/base/foo/Bar.vue` →
72
- * `BaseFooBar`. Each directory segment and the filename is PascalCased and
73
- * concatenated; a directory whose PascalCase name prefixes the next segment is
74
- * collapsed (Nuxt's de-dup: `base/BaseButton.vue` → `BaseButton`, not
75
- * `BaseBaseButton`). Returns null for a flat component (`components/NavBar.vue`)
76
- * — its node is already named by basename, so a direct tag match finds it.
77
- */
78
60
  function nuxtComponentName(filePath) {
79
61
  const marker = filePath.lastIndexOf('components/');
80
62
  if (marker === -1)
@@ -93,10 +75,31 @@ function nuxtComponentName(filePath) {
93
75
  }
94
76
  return out.join('');
95
77
  }
78
+ let sliceLinesSource = null;
79
+ let sliceLinesSplit = [];
96
80
  function sliceLines(content, startLine, endLine) {
97
81
  if (!startLine || !endLine)
98
82
  return null;
99
- return content.split('\n').slice(startLine - 1, endLine).join('\n');
83
+ if (content !== sliceLinesSource) {
84
+ sliceLinesSource = content;
85
+ sliceLinesSplit = content.split('\n');
86
+ }
87
+ return sliceLinesSplit.slice(startLine - 1, endLine).join('\n');
88
+ }
89
+ let lineOfSource = null;
90
+ let lineOfIndex = () => 1;
91
+ function lineOf(src, idx) {
92
+ if (src !== lineOfSource) {
93
+ lineOfSource = src;
94
+ lineOfIndex = (0, synth_utils_1.makeLineAt)(src, 1);
95
+ }
96
+ return lineOfIndex(idx);
97
+ }
98
+ function releaseLineCaches() {
99
+ sliceLinesSource = null;
100
+ sliceLinesSplit = [];
101
+ lineOfSource = null;
102
+ lineOfIndex = () => 1;
100
103
  }
101
104
  function registrarField(src) {
102
105
  const m = src.match(/this\.(\w+)\.(?:add|push|set)\(/);
@@ -111,24 +114,17 @@ function dispatcherField(src) {
111
114
  return forEach[1];
112
115
  return null;
113
116
  }
114
- /**
115
- * Stream method + function nodes lazily. The synthesizers only scan-and-filter
116
- * down to a tiny matched subset, so materializing every function/method (which
117
- * is gigabytes on a symbol-dense project) just to iterate it once is what OOM'd
118
- * #610. Iterating keeps memory O(1) in the node count.
119
- */
120
117
  function* methodAndFunctionNodes(queries) {
121
118
  yield* queries.iterateNodesByKind('method');
122
119
  yield* queries.iterateNodesByKind('function');
123
120
  }
124
- /** Phase 1: field-backed observer channels (registrar/dispatcher share a store). */
125
121
  async function fieldChannelEdges(queries, ctx, onYield) {
126
122
  const registrars = [];
127
123
  const dispatchers = [];
128
124
  let scanned = 0;
129
125
  for (const m of methodAndFunctionNodes(queries)) {
130
126
  if ((++scanned & 255) === 0)
131
- await onYield(); // #1091: yield mid-scan on huge graphs
127
+ await onYield();
132
128
  const isReg = REGISTRAR_NAME.test(m.name);
133
129
  const isDisp = DISPATCHER_NAME.test(m.name);
134
130
  if (!isReg && !isDisp)
@@ -154,7 +150,7 @@ async function fieldChannelEdges(queries, ctx, onYield) {
154
150
  const chDispatchers = dispatchers.filter((d) => d.node.filePath === reg.node.filePath && d.field === reg.field);
155
151
  if (chDispatchers.length === 0)
156
152
  continue;
157
- const argRe = new RegExp(`${reg.node.name}\\s*\\(\\s*(this\\.\\w+|\\w+)\\s*(?=[,)])`);
153
+ const argRe = new RegExp(`${(0, utils_1.escapeRegExp)(reg.node.name)}\\s*\\(\\s*(this\\.\\w+|\\w+)\\s*(?=[,)])`);
158
154
  let added = 0;
159
155
  for (const e of queries.getIncomingEdges(reg.node.id, ['calls'])) {
160
156
  if (added >= MAX_CALLBACKS_PER_CHANNEL)
@@ -168,8 +164,6 @@ async function fieldChannelEdges(queries, ctx, onYield) {
168
164
  const am = line?.match(argRe);
169
165
  if (!am)
170
166
  continue;
171
- // Reuse the resolved value at this registration site: it retains the
172
- // receiver's class/inheritance and import binding, unlike a name lookup.
173
167
  const refs = queries.getOutgoingEdges(caller.id, ['references']).filter((r) => r.line === e.line && r.metadata?.fnRef === true && r.metadata.refName === am[1]);
174
168
  if (refs.length !== 1)
175
169
  continue;
@@ -190,9 +184,6 @@ async function fieldChannelEdges(queries, ctx, onYield) {
190
184
  provenance: 'heuristic',
191
185
  metadata: {
192
186
  synthesizedBy: 'callback', via: reg.node.name, field: reg.field,
193
- // Where the callback was wired up (`scene.onUpdate(this.triggerRender)`).
194
- // This is the #1 thing an agent reads/greps to explain the flow — surface
195
- // it so node/trace/context can show it without a callers() + Read round-trip.
196
187
  registeredAt: `${caller.filePath}:${e.line}`,
197
188
  },
198
189
  });
@@ -202,36 +193,17 @@ async function fieldChannelEdges(queries, ctx, onYield) {
202
193
  }
203
194
  return edges;
204
195
  }
205
- /**
206
- * Closure-collection dispatch: dispatcher iterates a closure-collection property
207
- * invoking each element; registrar appends a closure to the same-named property.
208
- * Emits dispatcher → registrar so a flow reaches the registration site (where the
209
- * appended closure's body — and its callers — live). High-precision: the
210
- * dispatcher's element-invoke is the gate (a `.forEach` that does NOT invoke its
211
- * element is ignored), so a repo with no closure-collection dispatch yields zero
212
- * edges regardless of how many `.append`/`.push` sites it has.
213
- *
214
- * Pairs globally by field name (cross-file/class is required — see Alamofire's
215
- * base-class `Request.didCompleteTask` iterating `validators` appended by the
216
- * subclass `DataRequest.validate`), bounded by a fan-out cap so a generic field
217
- * name shared across unrelated classes can't fan out into noise.
218
- */
219
196
  async function closureCollectionEdges(queries, ctx, onYield) {
220
- const dispatchers = new Map(); // field → dispatcher methods + forEach line
221
- const registrars = new Map(); // field → registrar methods + append line
197
+ const dispatchers = new Map();
198
+ const registrars = new Map();
222
199
  const addReg = (field, node, absLine) => {
223
200
  if (!field || /^\d+$/.test(field))
224
- return; // `$0.append` mis-captures the `0`; the write-RE owns that field
201
+ return;
225
202
  const arr = registrars.get(field) ?? [];
226
203
  if (!arr.some((r) => r.node.id === node.id))
227
204
  arr.push({ node, line: absLine });
228
205
  registrars.set(field, arr);
229
206
  };
230
- // Slices EVERY Swift/Kotlin method/function's source (no cheap name-gate), so
231
- // on a repo with a huge file this is the heaviest synthesis pass — yield
232
- // mid-scan (and mid-match-loop below: a single generated function dense with
233
- // matches must not starve the watchdog either) so it can't wedge the #850
234
- // watchdog on its own (#1091, #1235).
235
207
  let scanned = 0;
236
208
  let matchTick = 0;
237
209
  for (const m of methodAndFunctionNodes(queries)) {
@@ -266,7 +238,7 @@ async function closureCollectionEdges(queries, ctx, onYield) {
266
238
  while ((w = CC_APPEND_WRITE_RE.exec(src))) {
267
239
  if ((++matchTick & 255) === 0)
268
240
  await onYield();
269
- addReg(w[2] || w[1], m, lineAt(w.index)); // nested `$0.streams` else the `.write` receiver
241
+ addReg(w[2] || w[1], m, lineAt(w.index));
270
242
  }
271
243
  CC_APPEND_DIRECT_RE.lastIndex = 0;
272
244
  let a;
@@ -284,7 +256,7 @@ async function closureCollectionEdges(queries, ctx, onYield) {
284
256
  if (!regs || regs.length === 0)
285
257
  continue;
286
258
  if (disps.length > CC_FANOUT_CAP || regs.length > CC_FANOUT_CAP)
287
- continue; // generic field — can't pair confidently
259
+ continue;
288
260
  for (const disp of disps)
289
261
  for (const reg of regs) {
290
262
  if (disp.node.id === reg.node.id)
@@ -302,100 +274,10 @@ async function closureCollectionEdges(queries, ctx, onYield) {
302
274
  }
303
275
  return edges;
304
276
  }
305
- /** Phase 2: string-keyed EventEmitter channels (on('e', fn) ↔ emit('e')). */
306
- async function eventEmitterEdges(ctx, onYield) {
307
- let scannedFiles = 0;
308
- const emitsByEvent = new Map(); // event → dispatcher node ids
309
- const handlersByEvent = new Map(); // event → handler id → registration site (file:line)
310
- let scanned = 0;
311
- for (const file of ctx.getAllFiles()) {
312
- if ((++scannedFiles & 15) === 0)
313
- await onYield();
314
- if ((++scanned & 255) === 0)
315
- await onYield(); // #1091: yield mid-scan on huge graphs
316
- const content = ctx.readFile(file);
317
- if (!content)
318
- continue;
319
- const hasEmit = content.includes('.emit(') || content.includes('.fire(') || content.includes('.dispatchEvent(');
320
- const hasOn = content.includes('.on(') || content.includes('.once(') || content.includes('.addListener(');
321
- if (!hasEmit && !hasOn)
322
- continue;
323
- const nodesInFile = ctx.getNodesInFile(file);
324
- const lineOf = (0, synth_utils_1.makeLineAt)(content, 1);
325
- if (hasEmit) {
326
- EMIT_RE.lastIndex = 0;
327
- let m;
328
- while ((m = EMIT_RE.exec(content))) {
329
- const disp = (0, synth_utils_1.enclosingFn)(nodesInFile, lineOf(m.index));
330
- if (!disp)
331
- continue;
332
- const set = emitsByEvent.get(m[1]) ?? new Set();
333
- set.add(disp.id);
334
- emitsByEvent.set(m[1], set);
335
- }
336
- }
337
- if (hasOn) {
338
- ON_RE.lastIndex = 0;
339
- let m;
340
- while ((m = ON_RE.exec(content))) {
341
- const handlerName = m[2] || m[3];
342
- if (!handlerName)
343
- continue;
344
- const handler = ctx.getNodesByName(handlerName).find((n) => n.kind === 'function' || n.kind === 'method');
345
- if (!handler)
346
- continue;
347
- const map = handlersByEvent.get(m[1]) ?? new Map();
348
- map.set(handler.id, `${file}:${lineOf(m.index)}`);
349
- handlersByEvent.set(m[1], map);
350
- }
351
- }
352
- }
353
- const edges = [];
354
- const seen = new Set();
355
- for (const [event, dispatchers] of emitsByEvent) {
356
- const handlers = handlersByEvent.get(event);
357
- if (!handlers)
358
- continue;
359
- // Precision guard: a generic event name with many handlers/dispatchers can't
360
- // be matched without receiver-type info (Phase 3) — skip rather than over-link.
361
- if (dispatchers.size > EVENT_FANOUT_CAP || handlers.size > EVENT_FANOUT_CAP)
362
- continue;
363
- for (const d of dispatchers)
364
- for (const [h, registeredAt] of handlers) {
365
- if (d === h)
366
- continue;
367
- const key = `${d}>${h}`;
368
- if (seen.has(key))
369
- continue;
370
- seen.add(key);
371
- edges.push({ source: d, target: h, kind: 'calls', provenance: 'heuristic', metadata: { synthesizedBy: 'event-emitter', event, registeredAt } });
372
- }
373
- }
374
- return edges;
375
- }
376
- /**
377
- * Phase 4: React class-component re-render. `this.setState(...)` re-runs the
378
- * component's `render()`, but that hop is React-internal — no static edge — so a
379
- * flow like "mutation → setState → canvas repaint" dead-ends at setState even
380
- * though `render → getRenderableElements → …` is fully call-connected after it.
381
- * Bridge it: for each class that has a `render` method, link every sibling method
382
- * whose body calls `this.setState(` → `render`. The setState gate keeps this to
383
- * React class components (a non-React class with a `render` method won't call
384
- * `this.setState`). Over-approximation (all setState methods reach render) is
385
- * accepted — it's reachability-correct, like the callback channels.
386
- */
387
277
  async function reactRenderEdges(queries, ctx, onYield) {
388
278
  let scanned255 = 0;
389
279
  const edges = [];
390
280
  const seen = new Set();
391
- // A class can only emit here if it CONTAINS a method named `render` — so one
392
- // indexed name lookup bounds the candidate set up front, and the class scan
393
- // below skips everything else before its per-class edge/node queries. On a
394
- // repo with few/no render methods (any non-React codebase) this collapses
395
- // the pass from every-class fan-out to ~zero DB work, with identical output:
396
- // the skipped classes fail the same `render` check today, just after paying
397
- // for their children. (Not a language gate: `render` + `this.setState(` in
398
- // Java — e.g. Litho — legitimately matches today and still does.)
399
281
  const renderOwners = new Set();
400
282
  for (const n of ctx.getNodesByName('render')) {
401
283
  if (n.kind !== 'method')
@@ -440,15 +322,6 @@ async function reactRenderEdges(queries, ctx, onYield) {
440
322
  }
441
323
  return edges;
442
324
  }
443
- /**
444
- * Phase 4b: Flutter setState → build (the Dart analog of react-render). In a
445
- * StatefulWidget's State class, `setState(() {…})` re-runs `build(context)`, but
446
- * that hop is framework-internal (Flutter calls build), so a flow like
447
- * "onPressed → _increment → setState → rebuilt UI" dead-ends at setState. Bridge
448
- * it: for each Dart class with a `build` method, link every sibling method whose
449
- * body calls `setState(` → `build`. The setState gate + `.dart` file keep this to
450
- * Flutter State classes. Over-approximation accepted (reachability-correct).
451
- */
452
325
  async function flutterBuildEdges(queries, ctx, onYield) {
453
326
  let scanned255 = 0;
454
327
  const edges = [];
@@ -486,34 +359,12 @@ async function flutterBuildEdges(queries, ctx, onYield) {
486
359
  }
487
360
  return edges;
488
361
  }
489
- /**
490
- * Reactive ArkUI property decorators: assigning a property carrying one of
491
- * these re-runs the owning struct's `build()`. Covers both state models —
492
- * V1 (`@Component`: State/Prop/Link/Provide/Consume/Storage*) and V2
493
- * (`@ComponentV2`: Local/Provider/Consumer; `@Param` is read-only in V2 so
494
- * the assignment gate never fires on it, and `@Trace` lives on `@ObservedV2`
495
- * data classes, not struct properties).
496
- */
497
362
  const ARKUI_REACTIVE_DECORATORS = new Set([
498
363
  'State', 'Prop', 'Link', 'Provide', 'Consume', 'StorageLink', 'StorageProp',
499
364
  'LocalStorageLink', 'LocalStorageProp', 'ObjectLink',
500
365
  'Local', 'Provider', 'Consumer',
501
366
  ]);
502
- /** ArkUI-observed array mutators — `this.todos.push(x)` re-renders like an assignment. */
503
367
  const ARKUI_ARRAY_MUTATORS = 'push|pop|shift|unshift|splice|sort|reverse|fill';
504
- /**
505
- * Phase 4b-ets: ArkUI state → build (the ArkTS analog of react-render /
506
- * flutter-build). Assigning a reactive-decorated property (`@State count`,
507
- * `@Link selected`, …) re-runs the `@Component struct`'s `build()`, but that
508
- * hop is framework-internal — no static edge — so "onClick → markAllDone →
509
- * this.todos = […] → rebuilt list" dead-ends at the assignment. Bridge it:
510
- * for each arkts struct with a `build()` method and at least one reactive
511
- * property, link every sibling method whose body ASSIGNS (or array-mutates)
512
- * one of those properties → `build`. Assignment-gated on the struct's OWN
513
- * reactive property names — a method that merely reads state, or a struct
514
- * with no reactive properties, gets nothing (this is the precision line the
515
- * all-sibling-methods design would erase).
516
- */
517
368
  async function arkuiStateBuildEdges(queries, ctx, onYield) {
518
369
  let scanned255 = 0;
519
370
  const edges = [];
@@ -533,8 +384,6 @@ async function arkuiStateBuildEdges(queries, ctx, onYield) {
533
384
  const propAlternation = reactiveProps
534
385
  .map((p) => p.name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
535
386
  .join('|');
536
- // `this.count = …` / `+=` / `++` / `--` / `this.todos.push(…)`. The
537
- // `=(?!=)` keeps `this.done == x` comparisons out.
538
387
  const mutationRe = new RegExp(`this\\.(?:${propAlternation})\\s*(?:=(?!=)|\\+\\+|--|[+\\-*/%&|^]=|\\.(?:${ARKUI_ARRAY_MUTATORS})\\s*\\()`);
539
388
  let added = 0;
540
389
  for (const m of children) {
@@ -560,32 +409,10 @@ async function arkuiStateBuildEdges(queries, ctx, onYield) {
560
409
  }
561
410
  return edges;
562
411
  }
563
- /** Emit/subscribe call sites of HarmonyOS's `@ohos.events.emitter` bus. */
564
412
  const ARKUI_EMITTER_CALL_RE = /\bemitter\s*\.\s*(emit|on|once)\s*\(\s*([A-Za-z_$][\w$.]*|\{[^)]{0,120}?\beventId\s*:\s*[^,}]+[^)]*?\})/g;
565
- /** Cap per event bucket — a generic key with many parties is dynamic routing, not a static pair. */
566
413
  const ARKUI_EMITTER_FANOUT_CAP = 8;
567
- /**
568
- * Phase 4b-ets2: HarmonyOS `@ohos.events.emitter` bridge. The cross-component
569
- * bus — `emitter.emit(eventId)` fires `emitter.on(eventId, cb)` — is
570
- * framework-internal, so an order flow riding it (OrangeShopping's
571
- * add-to-cart) dead-ends at the emit. Link emit-site enclosing
572
- * function/method → on/once-site enclosing function/method when both
573
- * reference the SAME statically-recoverable event key.
574
- *
575
- * Key recovery, per call site (comment-stripped enclosing-file source): the
576
- * first argument is an `{ eventId: K }` literal, a `Names.Dotted` constant, or
577
- * a local whose same-file declaration is `new EventsId(K)` / `= K` — chase one
578
- * level. Precision scoping learned from the samples monorepo (thousands of
579
- * unrelated samples, most using eventId 1): NUMERIC keys pair within the same
580
- * FILE only; NAMED keys pair within the same workspace module directory (or
581
- * the whole project when it declares no modules — the single-app case), both
582
- * behind a fan-out cap. Inline `on(id, (e) => {…})` arrows need no special
583
- * handling — their bodies' calls already attribute to the registering method,
584
- * so targeting that method keeps the chain connected.
585
- */
586
414
  async function arkuiEmitterEdges(ctx, onYield) {
587
415
  let scannedFiles = 0;
588
- // bucket key -> emit sites / handler sites
589
416
  const emits = new Map();
590
417
  const handlers = new Map();
591
418
  const moduleDirs = (() => {
@@ -615,26 +442,23 @@ async function arkuiEmitterEdges(ctx, onYield) {
615
442
  while ((m = ARKUI_EMITTER_CALL_RE.exec(safe))) {
616
443
  const verb = m[1];
617
444
  const arg = m[2].trim();
618
- const line = safe.slice(0, m.index).split('\n').length;
445
+ const line = lineOf(safe, m.index);
619
446
  const encl = nodes
620
447
  .filter((n) => n.startLine <= line && n.endLine >= line)
621
448
  .sort((a, b) => (a.endLine - a.startLine) - (b.endLine - b.startLine))[0];
622
449
  if (!encl)
623
450
  continue;
624
- // Recover the event key from the first argument.
625
451
  let key = null;
626
452
  const idLit = arg.startsWith('{') ? arg.match(/\beventId\s*:\s*([\w$.]+)/)?.[1] : undefined;
627
453
  const token = idLit ?? arg;
628
454
  if (token !== undefined) {
629
455
  if (/^\d+$/.test(token)) {
630
- key = `num:${file}:${token}`; // numeric: same-file only
456
+ key = `num:${file}:${token}`;
631
457
  }
632
458
  else if (token.includes('.')) {
633
459
  key = `name:${moduleScopeOf(file)}:${token}`;
634
460
  }
635
461
  else {
636
- // Local variable — chase its same-file declaration one level:
637
- // `let x = new EventsId(K)` / `const x = K`.
638
462
  const declRe = new RegExp(`\\b${token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\b\\s*(?::[^=\\n]+)?=\\s*(?:new\\s+[\\w$.]+\\(\\s*([^)\\n]+?)\\s*\\)|([\\w$.]+))`);
639
463
  const decl = safe.match(declRe);
640
464
  const inner = (decl?.[1] ?? decl?.[2])?.trim();
@@ -681,19 +505,7 @@ async function arkuiEmitterEdges(ctx, onYield) {
681
505
  }
682
506
  return edges;
683
507
  }
684
- /** `router.pushUrl({ url: 'pages/Detail' })` / replaceUrl — literal urls only. */
685
508
  const ARKUI_ROUTER_RE = /\brouter\s*\.\s*(?:pushUrl|replaceUrl)\s*\(\s*\{[^)]{0,200}?\burl\s*:\s*['"]([\w\-./]+)['"]/g;
686
- /**
687
- * Phase 4b-ets3: HarmonyOS page navigation. `router.pushUrl({ url:
688
- * 'pages/Detail' })` reaches the `@Entry struct` of
689
- * `<module>/src/main/ets/pages/Detail.ets`, but the hop is a string — no
690
- * static edge — so "tap → openDetail → ???" ends at the router call. Bridge
691
- * literal urls to the page struct: the url resolves against the standard
692
- * `src/main/ets/` layout (what main_pages.json entries name); candidates
693
- * prefer the caller's own workspace module (routes are module-scoped), and
694
- * anything still ambiguous is dropped rather than guessed. Only `@Entry`
695
- * structs qualify as targets — the decorator is what makes a file a page.
696
- */
697
509
  async function arkuiRouterEdges(ctx, onYield) {
698
510
  const edges = [];
699
511
  const seen = new Set();
@@ -725,7 +537,7 @@ async function arkuiRouterEdges(ctx, onYield) {
725
537
  let m;
726
538
  while ((m = ARKUI_ROUTER_RE.exec(safe))) {
727
539
  const url = m[1];
728
- const line = safe.slice(0, m.index).split('\n').length;
540
+ const line = lineOf(safe, m.index);
729
541
  const encl = nodes
730
542
  .filter((n) => n.startLine <= line && n.endLine >= line)
731
543
  .sort((a, b) => (a.endLine - a.startLine) - (b.endLine - b.startLine))[0];
@@ -740,7 +552,7 @@ async function arkuiRouterEdges(ctx, onYield) {
740
552
  candidates = sameModule;
741
553
  }
742
554
  if (candidates.length !== 1)
743
- continue; // ambiguous or unresolved — never guess
555
+ continue;
744
556
  const page = ctx.getNodesInFile(candidates[0]).find((n) => n.kind === 'struct' && (n.decorators ?? []).includes('Entry'));
745
557
  if (!page)
746
558
  continue;
@@ -757,17 +569,7 @@ async function arkuiRouterEdges(ctx, onYield) {
757
569
  }
758
570
  return edges;
759
571
  }
760
- /**
761
- * Phase 4c: C++ virtual override. A call through a base/interface pointer
762
- * (`db->Get(...)`, `iter->Next()`) dispatches at runtime to a subclass override,
763
- * but that hop is a vtable indirection — no static call edge — so a flow stops at
764
- * the abstract base method. Bridge it like react-render: for each C++ class that
765
- * `extends` a base, link each base method → the subclass method of the same name
766
- * (the override), so trace/callees from the interface method reach the
767
- * implementation(s). Over-approximation accepted (reachability-correct); capped
768
- * per class and gated to C++ to avoid touching other languages' dispatch.
769
- */
770
- async function cppOverrideEdges(queries, onYield) {
572
+ async function cppOverrideEdges(queries, ctx, onYield) {
771
573
  let scanned255 = 0;
772
574
  const edges = [];
773
575
  const seen = new Set();
@@ -775,6 +577,7 @@ async function cppOverrideEdges(queries, onYield) {
775
577
  .getOutgoingEdges(classId, ['contains'])
776
578
  .map((e) => queries.getNodeById(e.target))
777
579
  .filter((n) => !!n && n.kind === 'method');
580
+ const overridable = (m) => (0, name_matcher_1.cppSpecializationArguments)(m, ctx) === null;
778
581
  for (const cls of queries.iterateNodesByKind('class')) {
779
582
  if ((++scanned255 & 63) === 0)
780
583
  await onYield();
@@ -785,13 +588,13 @@ async function cppOverrideEdges(queries, onYield) {
785
588
  const base = queries.getNodeById(ext.target);
786
589
  if (!base || base.language !== 'cpp' || base.id === cls.id)
787
590
  continue;
788
- const baseMethods = new Map(methodsOf(base.id).map((m) => [m.name, m]));
591
+ const baseMethods = new Map(methodsOf(base.id).filter(overridable).map((m) => [m.name, m]));
789
592
  let added = 0;
790
593
  for (const m of subMethods) {
791
594
  if (added >= MAX_CALLBACKS_PER_CHANNEL)
792
595
  break;
793
596
  const bm = baseMethods.get(m.name);
794
- if (!bm || bm.id === m.id)
597
+ if (!bm || bm.id === m.id || !overridable(m))
795
598
  continue;
796
599
  const key = `${bm.id}>${m.id}`;
797
600
  if (seen.has(key))
@@ -811,86 +614,429 @@ async function cppOverrideEdges(queries, onYield) {
811
614
  }
812
615
  return edges;
813
616
  }
814
- /**
815
- * Phase 5.5: interface / abstract dispatch (Java, Kotlin). A call through an
816
- * injected interface (`@Autowired FooService svc; svc.list()`) or an abstract
817
- * base dispatches at runtime to the implementing class's override — a vtable
818
- * indirection with no static call edge — so a request→service flow stops at the
819
- * interface method. Bridge it like cpp-override: for each class that
820
- * `implements` an interface (or `extends` an abstract base), link each
821
- * base/interface method → the class's same-name method (the override) so
822
- * trace/callees reach the implementation. Over-approximation accepted
823
- * (reachability-correct); capped per class, gated to JVM languages.
824
- */
825
- // Languages whose static `implements`/`extends` edges should bridge an
826
- // interface (or abstract base) method to the matching concrete-class method.
827
- // The set is "languages with explicit nominal subtyping and a single class
828
- // kind that holds methods" — i.e. the shape this loop expects. Swift and
829
- // Scala fit shape-wise (Swift `protocol`/`class`, Scala `trait`/`class`)
830
- // and are added below; their concrete-side nodes can be a `struct` (Swift)
831
- // or an `object` (Scala) so the loop also iterates those kinds.
832
617
  const IFACE_OVERRIDE_LANGS = new Set([
833
- 'java', 'kotlin', 'csharp', 'typescript', 'javascript', 'swift', 'scala', 'go', 'rust',
618
+ 'java', 'kotlin', 'csharp', 'typescript', 'tsx', 'javascript', 'jsx', 'swift', 'scala', 'go', 'rust',
834
619
  'arkts',
835
620
  ]);
836
- /**
837
- * Go implicit interface satisfaction (#584). Go has no `implements` keyword — a
838
- * struct satisfies an interface structurally when its method set covers the
839
- * interface's. Synthesize the missing `implements` edge (struct → interface) by
840
- * matching method-NAME sets, so impl-navigation works and the interface-dispatch
841
- * bridge ({@link interfaceOverrideEdges}, now 'go'-enabled) can link an interface
842
- * method call to the concrete overrides.
843
- *
844
- * Name-only matching (signatures ignored) — over-approximation accepted, in line
845
- * with the other dispatch synthesizers; capped per interface. Empty interfaces
846
- * (`any`) are skipped so they don't match every struct.
847
- */
848
- async function goImplementsEdges(queries, onYield) {
621
+ const STATIC_SPLIT_LANGS = new Set(['typescript', 'tsx', 'javascript', 'jsx']);
622
+ function isGoEmbedding(e, kindOf) {
623
+ if (e.provenance === 'heuristic')
624
+ return false;
625
+ const to = kindOf(e.target);
626
+ return to !== null && (kindOf(e.source) !== 'interface' || to === 'interface');
627
+ }
628
+ const GO_EXPORTED_NAME = /^\p{Lu}/u;
629
+ function goMethodKey(m) {
630
+ if (GO_EXPORTED_NAME.test(m.name))
631
+ return m.name;
632
+ const file = m.filePath.replace(/\\/g, '/');
633
+ return `${file.slice(0, Math.max(file.lastIndexOf('/'), 0))}\0${m.name}`;
634
+ }
635
+ function goStdlibMethodKey(importPath, name) {
636
+ return GO_EXPORTED_NAME.test(name) ? name : `std:${importPath ?? ''}\0${name}`;
637
+ }
638
+ function goListItems(text, open) {
639
+ const items = [];
640
+ let depth = 0;
641
+ let item = '';
642
+ for (let i = open; i < text.length; i++) {
643
+ const c = text[i];
644
+ if (c === '/' && (text[i + 1] === '/' || text[i + 1] === '*')) {
645
+ const end = text[i + 1] === '/' ? text.indexOf('\n', i) : text.indexOf('*/', i + 2) + 1;
646
+ if (end <= 0)
647
+ return null;
648
+ i = end;
649
+ item += ' ';
650
+ continue;
651
+ }
652
+ if (c === '"' || c === '`' || c === "'") {
653
+ let j = i + 1;
654
+ while (j < text.length && text[j] !== c)
655
+ j += c !== '`' && text[j] === '\\' ? 2 : 1;
656
+ if (j >= text.length)
657
+ return null;
658
+ item += text.slice(i, j + 1);
659
+ i = j;
660
+ continue;
661
+ }
662
+ if (c === '(' || c === '[' || c === '{') {
663
+ if (depth++ === 0)
664
+ continue;
665
+ }
666
+ else if (c === ')' || c === ']' || c === '}') {
667
+ if (--depth === 0) {
668
+ if (item.trim())
669
+ items.push(item.trim());
670
+ return { items, end: i };
671
+ }
672
+ }
673
+ else if (c === ',' && depth === 1) {
674
+ if (item.trim())
675
+ items.push(item.trim());
676
+ item = '';
677
+ continue;
678
+ }
679
+ item += c;
680
+ }
681
+ return null;
682
+ }
683
+ function goSignatureParts(signature) {
684
+ const sig = signature?.trim();
685
+ if (!sig || sig[0] !== '(')
686
+ return null;
687
+ const params = goListItems(sig, 0);
688
+ if (!params)
689
+ return null;
690
+ const rest = sig.slice(params.end + 1).trim();
691
+ if (rest[0] !== '(')
692
+ return { params: params.items, results: rest ? [rest] : [] };
693
+ const results = goListItems(rest, 0);
694
+ if (!results || rest.slice(results.end + 1).trim())
695
+ return null;
696
+ return { params: params.items, results: results.items };
697
+ }
698
+ function goSignatureArity(signature) {
699
+ const parts = goSignatureParts(signature);
700
+ return parts ? `${parts.params.length}/${parts.results.length}` : null;
701
+ }
702
+ const GO_TYPE_WORDS = new Set(['func', 'chan', 'map', 'struct', 'interface']);
703
+ function goItemTypes(items) {
704
+ const named = items.map((item) => {
705
+ const m = /^([A-Za-z_]\w*)\s+(\S[\s\S]*)$/.exec(item);
706
+ return m && !GO_TYPE_WORDS.has(m[1]) ? m[2] : null;
707
+ });
708
+ if (named.every((type) => type === null))
709
+ return [...items];
710
+ const types = [];
711
+ let type = '';
712
+ for (let i = items.length - 1; i >= 0; i--)
713
+ types[i] = type = named[i] ?? type;
714
+ return types;
715
+ }
716
+ function goComparableType(written) {
717
+ const flat = written.replace(/\s+/g, '').replace(/interface\{\}/g, 'any');
718
+ if (/\bfunc\(|\bstruct\{|\binterface\{/.test(flat))
719
+ return null;
720
+ return flat.replace(/[A-Za-z_]\w*\./g, '').replace(/\buint8\b/g, 'byte').replace(/\bint32\b/g, 'rune');
721
+ }
722
+ function goMethodTypes(signature) {
723
+ const parts = goSignatureParts(signature);
724
+ return parts ? [...goItemTypes(parts.params), ...goItemTypes(parts.results)].map(goComparableType) : null;
725
+ }
726
+ function goDeclarationText(n, ctx) {
727
+ const lines = ctx.getFileLines?.(n.filePath) ?? ctx.readFile(n.filePath)?.split(/\r?\n/) ?? [];
728
+ return lines.slice(n.startLine - 1, n.startLine + 2).join('\n');
729
+ }
730
+ function goTypeParameterNames(n, ctx) {
731
+ const text = goDeclarationText(n, ctx);
732
+ const open = /^\s*(?:type\s+)?[A-Za-z_]\w*\s*\[/.exec(text);
733
+ const list = open ? goListItems(text, open[0].length - 1) : null;
734
+ return list ? list.items.flatMap((item) => /^[A-Za-z_]\w*/.exec(item)?.[0] ?? []) : [];
735
+ }
736
+ function isGoTrueAlias(n, ctx) {
737
+ return /^\s*(?:type\s+)?[A-Za-z_]\w*\s*(?:\[[^\]]*\]\s*)?=/.test(goDeclarationText(n, ctx));
738
+ }
739
+ function goGrpcServerArity(signature) {
740
+ const parts = goSignatureParts(signature);
741
+ const opts = parts?.params[parts.params.length - 1];
742
+ if (!parts || !opts || !/^(?:[A-Za-z_]\w*\s+)?\.\.\.\s*(?:grpc\.)?CallOption$/.test(opts))
743
+ return null;
744
+ const unary = parts.results.length === 2 && parts.results[0].startsWith('*');
745
+ return `${parts.params.length - 1}/${unary ? 2 : 1}`;
746
+ }
747
+ async function goImplementsEdges(queries, ctx, onYield) {
849
748
  let scanned255 = 0;
850
749
  const edges = [];
851
750
  const seen = new Set();
852
- const methodNameSet = (id) => new Set(queries
853
- .getOutgoingEdges(id, ['contains'])
854
- .map((e) => queries.getNodeById(e.target))
855
- .filter((n) => !!n && n.kind === 'method')
856
- .map((n) => n.name));
857
- // Materializes GO structs only (the pass is language-gated by the caller),
858
- // never the whole struct kind — that array is O(nodes) on struct-heavy
859
- // repos like the Linux kernel (#1212).
860
- const goStructs = [];
861
- for (const s of queries.iterateNodesByKindIn('struct', ['go'])) {
751
+ const goImplementers = [];
752
+ for (const n of queries.iterateNodesByKindIn(['struct', 'type_alias'], ['go'])) {
862
753
  if ((++scanned255 & 63) === 0)
863
754
  await onYield();
864
- goStructs.push(s);
755
+ goImplementers.push(n);
865
756
  }
866
- const structMethods = new Map();
867
- for (const s of goStructs)
868
- structMethods.set(s.id, methodNameSet(s.id));
869
- for (const iface of queries.iterateNodesByKindIn('interface', ['go'])) {
757
+ const goInterfaces = [];
758
+ for (const i of queries.iterateNodesByKindIn('interface', ['go'])) {
870
759
  if ((++scanned255 & 63) === 0)
871
760
  await onYield();
872
- const want = methodNameSet(iface.id);
873
- if (want.size === 0)
874
- continue; // empty interface (`any`) — would match everything
875
- let added = 0;
876
- for (const s of goStructs) {
877
- if (added >= MAX_CALLBACKS_PER_CHANNEL)
878
- break;
879
- const have = structMethods.get(s.id);
880
- if (!have || have.size < want.size)
761
+ goInterfaces.push(i);
762
+ }
763
+ const typeKind = new Map();
764
+ for (const n of goImplementers)
765
+ typeKind.set(n.id, n.kind);
766
+ for (const i of goInterfaces)
767
+ typeKind.set(i.id, 'interface');
768
+ const kindOf = (id) => typeKind.get(id) ?? null;
769
+ const ownMemo = new Map();
770
+ const ownSignatures = new Map();
771
+ const ownMethods = (id) => {
772
+ let names = ownMemo.get(id);
773
+ if (!names) {
774
+ names = new Set();
775
+ const signatures = new Map();
776
+ for (const e of queries.getOutgoingEdges(id, ['contains'])) {
777
+ const n = queries.getNodeById(e.target);
778
+ if (!n || n.kind !== 'method')
779
+ continue;
780
+ const key = goMethodKey(n);
781
+ names.add(key);
782
+ const list = signatures.get(key);
783
+ if (list)
784
+ list.push(n.signature);
785
+ else
786
+ signatures.set(key, [n.signature]);
787
+ }
788
+ ownMemo.set(id, names);
789
+ ownSignatures.set(id, signatures);
790
+ }
791
+ return names;
792
+ };
793
+ const isEmbedding = (e) => isGoEmbedding(e, kindOf);
794
+ const NO_EMBEDS = [];
795
+ const embedMemo = new Map();
796
+ const typeIds = [...typeKind.keys()];
797
+ for (let i = 0; i < typeIds.length; i += 2000) {
798
+ for (const e of queries.getOutgoingEdgesFrom(typeIds.slice(i, i + 2000), ['extends', 'implements'])) {
799
+ if (!isEmbedding(e))
881
800
  continue;
882
- let all = true;
883
- for (const m of want) {
884
- if (!have.has(m)) {
885
- all = false;
801
+ const targets = embedMemo.get(e.source);
802
+ if (targets)
803
+ targets.push(e.target);
804
+ else
805
+ embedMemo.set(e.source, [e.target]);
806
+ }
807
+ await onYield();
808
+ }
809
+ const embeds = (id) => embedMemo.get(id) ?? NO_EMBEDS;
810
+ const embedClosure = (id) => {
811
+ if (embeds(id).length === 0)
812
+ return [id];
813
+ const reached = new Set([id]);
814
+ const pending = [id];
815
+ while (pending.length > 0) {
816
+ const at = pending.pop();
817
+ for (const t of embeds(at)) {
818
+ if (reached.has(t))
819
+ continue;
820
+ reached.add(t);
821
+ pending.push(t);
822
+ }
823
+ }
824
+ return [...reached];
825
+ };
826
+ const outside = new Map();
827
+ for (const ref of queries.getUnresolvedReferencesFromNodes(typeIds, ['extends'])) {
828
+ if (ref.language !== 'go' || !ref.filePath)
829
+ continue;
830
+ const name = ref.referenceName;
831
+ const { written, imported } = (0, name_matcher_1.goRefQualification)({ ...ref, filePath: ref.filePath, language: 'go' }, ctx);
832
+ const importPath = imported?.source ?? null;
833
+ const known = imported ? (0, go_stdlib_methods_1.goStdlibMethods)(importPath, name) : written ? undefined : (0, go_stdlib_methods_1.goStdlibMethods)(null, name);
834
+ let found = outside.get(ref.fromNodeId);
835
+ if (!found)
836
+ outside.set(ref.fromNodeId, (found = { stdlib: [], opaque: [] }));
837
+ if (known)
838
+ found.stdlib.push(new Map([...known].map(([m, arity]) => [goStdlibMethodKey(importPath, m), arity])));
839
+ else if (imported)
840
+ found.opaque.push(`${imported.source}.${name}`);
841
+ else if (written)
842
+ found.opaque.push(`${written}.${name}`);
843
+ else
844
+ found.opaque.push(`${ref.filePath.replace(/\\/g, '/').replace(/\/?[^/]*$/, '')}#${name}`);
845
+ }
846
+ await onYield();
847
+ const NONE_OPAQUE = new Set();
848
+ const methodNames = (id) => {
849
+ const types = embedClosure(id);
850
+ if (types.length === 1 && !outside.has(id))
851
+ return { methods: ownMethods(id), opaque: NONE_OPAQUE };
852
+ const methods = new Set();
853
+ const opaque = new Set();
854
+ for (const t of types) {
855
+ for (const m of ownMethods(t))
856
+ methods.add(m);
857
+ const out = outside.get(t);
858
+ if (!out)
859
+ continue;
860
+ for (const known of out.stdlib)
861
+ for (const key of known.keys())
862
+ methods.add(key);
863
+ for (const type of out.opaque)
864
+ opaque.add(type);
865
+ }
866
+ return { methods, opaque };
867
+ };
868
+ const covers = (have, want) => {
869
+ if (have.size < want.size)
870
+ return false;
871
+ for (const m of want) {
872
+ if (!have.has(m))
873
+ return false;
874
+ }
875
+ return true;
876
+ };
877
+ const coversOpaque = (have, want) => {
878
+ for (const type of want.opaque) {
879
+ if (!have.opaque.has(type))
880
+ return false;
881
+ }
882
+ return true;
883
+ };
884
+ const arityMemo = new Map();
885
+ const methodArities = (id) => {
886
+ let arities = arityMemo.get(id);
887
+ if (arities)
888
+ return arities;
889
+ arities = new Map();
890
+ for (const t of embedClosure(id)) {
891
+ ownMethods(t);
892
+ for (const [name, signatures] of ownSignatures.get(t) ?? []) {
893
+ let known = arities.get(name);
894
+ if (known === null)
895
+ continue;
896
+ if (!known)
897
+ arities.set(name, (known = new Set()));
898
+ for (const signature of signatures) {
899
+ const arity = goSignatureArity(signature);
900
+ if (arity === null) {
901
+ arities.set(name, null);
902
+ break;
903
+ }
904
+ known.add(arity);
905
+ }
906
+ }
907
+ for (const methods of outside.get(t)?.stdlib ?? []) {
908
+ for (const [name, arity] of methods) {
909
+ let known = arities.get(name);
910
+ if (known === null)
911
+ continue;
912
+ if (!known)
913
+ arities.set(name, (known = new Set()));
914
+ known.add(arity);
915
+ }
916
+ }
917
+ }
918
+ arityMemo.set(id, arities);
919
+ return arities;
920
+ };
921
+ const wantedArities = (iface) => {
922
+ const own = methodArities(iface.id);
923
+ const wanted = new Map();
924
+ for (const t of embedClosure(iface.id)) {
925
+ for (const [name, signatures] of ownSignatures.get(t) ?? []) {
926
+ let arities = wanted.get(name);
927
+ if (!arities)
928
+ wanted.set(name, (arities = new Set(own.get(name))));
929
+ for (const signature of signatures) {
930
+ const served = goGrpcServerArity(signature);
931
+ if (served === null)
932
+ return own;
933
+ arities.add(served);
934
+ }
935
+ }
936
+ }
937
+ for (const [name, arities] of own)
938
+ if (!wanted.has(name))
939
+ wanted.set(name, arities);
940
+ return wanted;
941
+ };
942
+ const aritiesFit = (typeId, wanted) => {
943
+ const have = methodArities(typeId);
944
+ for (const [name, arities] of wanted) {
945
+ const got = have.get(name);
946
+ if (!arities || !got)
947
+ continue;
948
+ let fits = false;
949
+ for (const arity of arities) {
950
+ if (got.has(arity)) {
951
+ fits = true;
886
952
  break;
887
953
  }
888
954
  }
889
- if (!all)
955
+ if (!fits)
956
+ return false;
957
+ }
958
+ return true;
959
+ };
960
+ const typesMemo = new Map();
961
+ const methodTypes = (id) => {
962
+ let types = typesMemo.get(id);
963
+ if (types)
964
+ return types;
965
+ types = new Map();
966
+ for (const t of embedClosure(id)) {
967
+ ownMethods(t);
968
+ for (const [name, signatures] of ownSignatures.get(t) ?? []) {
969
+ let known = types.get(name);
970
+ if (known === null)
971
+ continue;
972
+ if (!known)
973
+ types.set(name, (known = []));
974
+ for (const signature of signatures) {
975
+ const read = goMethodTypes(signature);
976
+ if (!read) {
977
+ types.set(name, null);
978
+ break;
979
+ }
980
+ known.push(read);
981
+ }
982
+ }
983
+ for (const methods of outside.get(t)?.stdlib ?? [])
984
+ for (const name of methods.keys())
985
+ types.set(name, null);
986
+ }
987
+ typesMemo.set(id, types);
988
+ return types;
989
+ };
990
+ let aliases;
991
+ const parameterMemo = new Map();
992
+ const typeParameters = (id) => {
993
+ let names = parameterMemo.get(id);
994
+ if (!names) {
995
+ const type = queries.getNodeById(id);
996
+ parameterMemo.set(id, (names = type ? goTypeParameterNames(type, ctx) : []));
997
+ }
998
+ return names;
999
+ };
1000
+ const typesFit = (s, iface) => {
1001
+ aliases ??= new Set(goImplementers.filter((n) => n.kind === 'type_alias' && isGoTrueAlias(n, ctx)).map((n) => n.name));
1002
+ const known = aliases;
1003
+ const parameters = new Set([...embedClosure(s.id), ...embedClosure(iface.id)].flatMap(typeParameters));
1004
+ const open = (type) => type === null ||
1005
+ type.split(/\W+/).some((word) => known.has(word) || parameters.has(word));
1006
+ const sameType = (a, b) => a === b || open(a) || open(b);
1007
+ const have = methodTypes(s.id);
1008
+ for (const [name, wantedTypes] of methodTypes(iface.id)) {
1009
+ const got = have.get(name);
1010
+ if (!wantedTypes || !got)
890
1011
  continue;
1012
+ const fits = wantedTypes.some((want) => got.some((type) => type.length !== want.length || type.every((t, i) => sameType(t, want[i]))));
1013
+ if (!fits)
1014
+ return false;
1015
+ }
1016
+ return true;
1017
+ };
1018
+ const candidates = [];
1019
+ const candidateMethods = new Map();
1020
+ for (const s of goImplementers) {
1021
+ if ((++scanned255 & 63) === 0)
1022
+ await onYield();
1023
+ const have = methodNames(s.id);
1024
+ if (have.methods.size + have.opaque.size === 0)
1025
+ continue;
1026
+ candidates.push(s);
1027
+ candidateMethods.set(s.id, have);
1028
+ }
1029
+ for (const iface of goInterfaces) {
1030
+ if ((++scanned255 & 63) === 0)
1031
+ await onYield();
1032
+ const want = methodNames(iface.id);
1033
+ if (want.methods.size + want.opaque.size === 0)
1034
+ continue;
1035
+ let added = 0;
1036
+ const link = (s) => {
891
1037
  const key = `${s.id}>${iface.id}`;
892
1038
  if (seen.has(key))
893
- continue;
1039
+ return;
894
1040
  seen.add(key);
895
1041
  edges.push({
896
1042
  source: s.id,
@@ -901,32 +1047,45 @@ async function goImplementsEdges(queries, onYield) {
901
1047
  metadata: { synthesizedBy: 'go-implements', via: iface.name, registeredAt: `${s.filePath}:${s.startLine}` },
902
1048
  });
903
1049
  added++;
1050
+ };
1051
+ const throughEmbedding = [];
1052
+ let wanted;
1053
+ let covering = 0;
1054
+ let sole;
1055
+ for (const s of candidates) {
1056
+ if (added >= MAX_CALLBACKS_PER_CHANNEL)
1057
+ break;
1058
+ const have = candidateMethods.get(s.id);
1059
+ if (!covers(have.methods, want.methods))
1060
+ continue;
1061
+ if (!wanted)
1062
+ wanted = wantedArities(iface);
1063
+ if (!aritiesFit(s.id, wanted) || !typesFit(s, iface))
1064
+ continue;
1065
+ covering++;
1066
+ if (embeds(s.id).includes(iface.id))
1067
+ continue;
1068
+ if (!coversOpaque(have, want)) {
1069
+ if (covering === 1)
1070
+ sole = s;
1071
+ continue;
1072
+ }
1073
+ const own = ownMethods(s.id);
1074
+ if (want.opaque.size > 0 || (own !== have.methods && !covers(own, want.methods)))
1075
+ throughEmbedding.push(s);
1076
+ else
1077
+ link(s);
1078
+ }
1079
+ if (sole && covering === 1 && want.methods.size > 0)
1080
+ throughEmbedding.push(sole);
1081
+ for (const s of throughEmbedding) {
1082
+ if (added >= MAX_CALLBACKS_PER_CHANNEL)
1083
+ break;
1084
+ link(s);
904
1085
  }
905
1086
  }
906
1087
  return edges;
907
1088
  }
908
- /**
909
- * Cross-file Go method → receiver-type `contains` edges. In Go a type's methods
910
- * are commonly declared in a different file from the `type` declaration itself
911
- * (`type User struct{…}` in `user.go`, `func (u *User) Save()` in
912
- * `user_store.go`). Extraction attaches the struct→method `contains` edge only
913
- * when the receiver type is in the SAME file — the owner lookup in
914
- * `tree-sitter.ts` is scoped to the file being parsed — so a cross-file method
915
- * is left orphaned from its type (it's still `contains`ed by its file, just not
916
- * its struct). That breaks `codegraph_node` member outlines, any
917
- * callers/callees/impact traversal that goes through the type's `contains`
918
- * edges, and the {@link goImplementsEdges} method-set computation (which derives
919
- * a struct's method set from those same edges, so it under-counts interfaces a
920
- * cross-file struct satisfies).
921
- *
922
- * Go guarantees a method's receiver type is declared in the SAME PACKAGE as the
923
- * method, and a Go package is a single directory — so this is a deterministic
924
- * structural link, not a heuristic: find the same-named type in the method's
925
- * own directory and add the missing `contains` edge with no provenance, matching
926
- * same-file extraction. Tag synthesis ownership so an incremental
927
- * refresh can replace it alongside implicit `implements`. Skips methods that
928
- * already have a type parent (the same-file case). (#583, cross-file half)
929
- */
930
1089
  async function goCrossFileMethodContainsEdges(queries, onYield) {
931
1090
  let scanned255 = 0;
932
1091
  const edges = [];
@@ -939,8 +1098,6 @@ async function goCrossFileMethodContainsEdges(queries, onYield) {
939
1098
  for (const method of queries.iterateNodesByKindIn('method', ['go'])) {
940
1099
  if ((++scanned255 & 63) === 0)
941
1100
  await onYield();
942
- // The receiver type is encoded in the method's qualifiedName as `Recv::name`
943
- // (extraction sets `${receiverType}::${name}` for receiver methods).
944
1101
  const qn = method.qualifiedName;
945
1102
  if (!qn)
946
1103
  continue;
@@ -950,7 +1107,6 @@ async function goCrossFileMethodContainsEdges(queries, onYield) {
950
1107
  const receiver = qn.slice(0, sep);
951
1108
  if (!receiver)
952
1109
  continue;
953
- // Already attached to its type (same-file case handled at extraction)?
954
1110
  const hasTypeParent = queries
955
1111
  .getIncomingEdges(method.id, ['contains'])
956
1112
  .some((e) => {
@@ -959,10 +1115,6 @@ async function goCrossFileMethodContainsEdges(queries, onYield) {
959
1115
  });
960
1116
  if (hasTypeParent)
961
1117
  continue;
962
- // Find the receiver type in the SAME directory (= same Go package). Go forbids
963
- // duplicate type names within a package, so a same-name same-dir match is
964
- // unambiguous; scoping to the directory avoids linking to a same-named type
965
- // in another package.
966
1118
  const dir = dirOf(method.filePath);
967
1119
  const owner = queries
968
1120
  .getNodesByName(receiver)
@@ -978,31 +1130,6 @@ async function goCrossFileMethodContainsEdges(queries, onYield) {
978
1130
  }
979
1131
  return edges;
980
1132
  }
981
- /**
982
- * Kotlin Multiplatform `expect`/`actual` linking. A `common` source set declares
983
- * `expect fun foo()` / `expect class Bar`; each platform source set (jvm, native,
984
- * js, …) provides an `actual` implementation with the IDENTICAL fully-qualified
985
- * name in a different file. Callers in common code resolve to the `expect`
986
- * declaration, so every `actual` impl ends up with zero dependents — invisible to
987
- * impact/affected even though editing it can break every caller of the API.
988
- *
989
- * Synthesize a `calls` edge from the common declaration to each platform `actual`
990
- * (mirroring the interface-impl bridge: abstract → concrete), so editing a
991
- * platform impl surfaces the common `expect` and its callers, and the impl file
992
- * participates in the graph.
993
- *
994
- * `expect`/`actual` are captured onto the node's `decorators` list at extraction
995
- * (kotlin.ts `extractModifiers`). Members of an `expect class` are NOT themselves
996
- * keyword-marked, so the declaration side is matched as the same-FQN, same-kind
997
- * node that is NOT marked `actual`. Requiring an `actual`-marked counterpart also
998
- * gates out plain cross-file overloads (neither side is marked).
999
- */
1000
- // Kinds that an `expect`/`actual` pair may legitimately straddle. `expect class`
1001
- // is routinely fulfilled by an `actual typealias` (e.g. `actual typealias
1002
- // CancellationException = …`, `actual typealias SchedulerTask = Task`), so a
1003
- // strict kind match would miss those one-line alias files. Same-FQN + the
1004
- // `actual` marker already gates out unrelated symbols, so widening to the
1005
- // type-like kinds is safe.
1006
1133
  const KMP_TYPE_KINDS = new Set(['class', 'interface', 'struct', 'enum', 'type_alias']);
1007
1134
  function kmpKindsCompatible(a, b) {
1008
1135
  return a === b || (KMP_TYPE_KINDS.has(a) && KMP_TYPE_KINDS.has(b));
@@ -1011,11 +1138,6 @@ async function kotlinExpectActualEdges(queries, onYield) {
1011
1138
  let scanned255 = 0;
1012
1139
  const edges = [];
1013
1140
  const seen = new Set();
1014
- // SQL-side language+decorator pre-filter, streamed. The old
1015
- // `getAllNodes().filter(...)` hydrated the ENTIRE node table into one array
1016
- // just to find kotlin `actual` declarations — on a 2M-node graph that alone
1017
- // exceeded Node's default heap and killed the index (#1212). The LIKE
1018
- // pre-filter can over-match (substring), so the exact decorator check stays.
1019
1141
  for (const act of queries.iterateNodesByLanguageWithDecorator('kotlin', 'actual')) {
1020
1142
  if ((++scanned255 & 63) === 0)
1021
1143
  await onYield();
@@ -1025,8 +1147,6 @@ async function kotlinExpectActualEdges(queries, onYield) {
1025
1147
  for (const cand of queries.getNodesByQualifiedNameExact(act.qualifiedName)) {
1026
1148
  if (added >= MAX_CALLBACKS_PER_CHANNEL)
1027
1149
  break;
1028
- // The declaration side: same FQN + compatible kind, a different file, NOT
1029
- // itself an `actual` (that would be a sibling platform impl, not the decl).
1030
1150
  if (cand.language !== 'kotlin' || cand.id === act.id)
1031
1151
  continue;
1032
1152
  if (!kmpKindsCompatible(cand.kind, act.kind) || cand.filePath === act.filePath)
@@ -1054,13 +1174,106 @@ async function kotlinExpectActualEdges(queries, onYield) {
1054
1174
  }
1055
1175
  return edges;
1056
1176
  }
1057
- async function interfaceOverrideEdges(queries, onYield) {
1177
+ function goPromotions(queries, methodsOf) {
1178
+ const kinds = new Map();
1179
+ const kindOf = (id) => {
1180
+ let kind = kinds.get(id);
1181
+ if (kind === undefined) {
1182
+ const n = queries.getNodeById(id);
1183
+ kind = n?.language === 'go' && (n.kind === 'struct' || n.kind === 'interface' || n.kind === 'type_alias')
1184
+ ? n.kind
1185
+ : null;
1186
+ kinds.set(id, kind);
1187
+ }
1188
+ return kind;
1189
+ };
1190
+ const embedMemo = new Map();
1191
+ const embeds = (id) => {
1192
+ let out = embedMemo.get(id);
1193
+ if (!out) {
1194
+ const targets = new Set();
1195
+ out = queries.getOutgoingEdges(id, ['extends', 'implements']).filter((e) => {
1196
+ if (!isGoEmbedding(e, kindOf) || targets.has(e.target))
1197
+ return false;
1198
+ targets.add(e.target);
1199
+ return true;
1200
+ });
1201
+ embedMemo.set(id, out);
1202
+ }
1203
+ return out;
1204
+ };
1205
+ const ifaceMemo = new Map();
1206
+ const ifaceMethods = (id) => {
1207
+ let names = ifaceMemo.get(id);
1208
+ if (!names) {
1209
+ names = new Set();
1210
+ const reached = new Set([id]);
1211
+ const pending = [id];
1212
+ while (pending.length > 0) {
1213
+ const at = pending.pop();
1214
+ for (const m of methodsOf(at))
1215
+ names.add(goMethodKey(m));
1216
+ for (const e of embeds(at)) {
1217
+ if (reached.has(e.target))
1218
+ continue;
1219
+ reached.add(e.target);
1220
+ pending.push(e.target);
1221
+ }
1222
+ }
1223
+ ifaceMemo.set(id, names);
1224
+ }
1225
+ return names;
1226
+ };
1227
+ const provides = (id, key) => kindOf(id) === 'interface' ? ifaceMethods(id).has(key) : methodsOf(id).some((m) => goMethodKey(m) === key);
1228
+ const memo = new Map();
1229
+ return (structId, key) => {
1230
+ const memoKey = `${structId}>${key}`;
1231
+ const hit = memo.get(memoKey);
1232
+ if (hit !== undefined)
1233
+ return hit;
1234
+ let found = null;
1235
+ let level = new Map([[structId, { paths: 1, line: 0 }]]);
1236
+ const met = new Set([structId]);
1237
+ for (let depth = 0; level.size > 0; depth++) {
1238
+ const next = new Map();
1239
+ for (const [id, at] of level) {
1240
+ if (kindOf(id) === 'interface')
1241
+ continue;
1242
+ for (const e of embeds(id)) {
1243
+ if (met.has(e.target))
1244
+ continue;
1245
+ const to = next.get(e.target);
1246
+ if (to)
1247
+ to.paths += at.paths;
1248
+ else
1249
+ next.set(e.target, { paths: at.paths, line: depth === 0 ? (e.line ?? 0) : at.line });
1250
+ }
1251
+ }
1252
+ let paths = 0;
1253
+ let provider;
1254
+ for (const [id, at] of next) {
1255
+ met.add(id);
1256
+ if (!provides(id, key))
1257
+ continue;
1258
+ paths += at.paths;
1259
+ provider = id;
1260
+ }
1261
+ if (provider !== undefined) {
1262
+ if (paths === 1 && kindOf(provider) !== 'interface') {
1263
+ found = { methods: methodsOf(provider).filter((m) => goMethodKey(m) === key), line: next.get(provider).line };
1264
+ }
1265
+ break;
1266
+ }
1267
+ level = next;
1268
+ }
1269
+ memo.set(memoKey, found);
1270
+ return found;
1271
+ };
1272
+ }
1273
+ async function interfaceOverrideEdges(queries, ctx, onYield) {
1058
1274
  let scanned255 = 0;
1059
1275
  const edges = [];
1060
1276
  const seen = new Set();
1061
- // Memoized: a popular base interface's method list is otherwise re-fetched
1062
- // once per implementer (dubbo-style hub interfaces have hundreds), and the
1063
- // memo only ever serves reads. Same rows, same order — byte-identical.
1064
1277
  const methodsMemo = new Map();
1065
1278
  const methodsOf = (classId) => {
1066
1279
  const hit = methodsMemo.get(classId);
@@ -1073,10 +1286,6 @@ async function interfaceOverrideEdges(queries, onYield) {
1073
1286
  methodsMemo.set(classId, methods);
1074
1287
  return methods;
1075
1288
  };
1076
- // A Swift protocol's methods live in its extensions: requirements are not
1077
- // extracted as methods, and `extension EventMonitor { func request(…) }` is
1078
- // where the default implementations a conformer overrides are. A class-kind
1079
- // node sharing a protocol's name is one of its extensions.
1080
1289
  const protocolMemo = new Map();
1081
1290
  const baseMethodsOf = (base) => {
1082
1291
  if (base.language !== 'swift' || base.kind !== 'interface')
@@ -1094,48 +1303,72 @@ async function interfaceOverrideEdges(queries, onYield) {
1094
1303
  protocolMemo.set(base.id, methods);
1095
1304
  return methods;
1096
1305
  };
1097
- // Concrete-side kinds vary by language: `class` covers Java / Kotlin /
1098
- // C# / TS / Swift-classes / Scala-classes; `struct` covers Swift value
1099
- // types that conform to protocols. Iterate both.
1306
+ const overridesOf = (0, override_parameters_1.overrideFilter)(ctx);
1307
+ const nameCounts = new Map();
1308
+ const declaredNamed = (base, name) => {
1309
+ let counts = nameCounts.get(base.id);
1310
+ if (!counts) {
1311
+ counts = new Map();
1312
+ for (const m of baseMethodsOf(base))
1313
+ counts.set(m.name, (counts.get(m.name) ?? 0) + 1);
1314
+ nameCounts.set(base.id, counts);
1315
+ }
1316
+ return counts.get(name) ?? 0;
1317
+ };
1318
+ const goPromotion = goPromotions(queries, methodsOf);
1319
+ const promoted = [];
1100
1320
  const concreteKinds = ['class', 'struct', 'union'];
1101
- for (const kind of concreteKinds) {
1102
- for (const cls of queries.iterateNodesByKind(kind)) {
1321
+ const concrete = [
1322
+ ...concreteKinds.map((kind) => () => queries.iterateNodesByKind(kind)),
1323
+ () => queries.iterateNodesByKindIn('type_alias', ['go']),
1324
+ ];
1325
+ for (const nodesOfKind of concrete) {
1326
+ for (const cls of nodesOfKind()) {
1103
1327
  if ((++scanned255 & 63) === 0)
1104
1328
  await onYield();
1105
- // A class can only emit here if it HAS a supertype edge — check that
1106
- // (one edge query) before materializing its methods: most classes in a
1107
- // typical graph extend/implement nothing and skip in one hop.
1108
1329
  const sups = queries.getOutgoingEdges(cls.id, ['implements', 'extends']);
1109
1330
  if (sups.length === 0)
1110
1331
  continue;
1111
1332
  const implMethods = methodsOf(cls.id).filter((n) => IFACE_OVERRIDE_LANGS.has(n.language));
1112
- if (implMethods.length === 0)
1333
+ const goStruct = cls.language === 'go' && cls.kind === 'struct';
1334
+ if (implMethods.length === 0 && !(goStruct && sups.some((s) => s.provenance === 'heuristic')))
1113
1335
  continue;
1114
1336
  for (const sup of sups) {
1115
1337
  const base = queries.getNodeById(sup.target);
1116
1338
  if (!base || !IFACE_OVERRIDE_LANGS.has(base.language) || base.id === cls.id)
1117
1339
  continue;
1118
- // Group impl methods by name to handle OVERLOADS: an interface `list()` and
1119
- // `list(params)` are distinct nodes and a call may resolve to either, so
1120
- // link every base overload → every same-name impl overload (keying by name
1121
- // alone would drop all but one and miss the resolved overload).
1122
- const implByName = new Map();
1340
+ if (cls.language === 'go' && base.kind !== 'interface')
1341
+ continue;
1342
+ const promotes = goStruct && sup.provenance === 'heuristic' && base.kind === 'interface';
1343
+ const keyOf = base.language === 'go' && base.kind === 'interface' ? goMethodKey : (m) => m.name;
1344
+ const implsByKey = new Map();
1123
1345
  for (const m of implMethods) {
1124
- const arr = implByName.get(m.name);
1346
+ const key = keyOf(m);
1347
+ const arr = implsByKey.get(key);
1125
1348
  if (arr)
1126
1349
  arr.push(m);
1127
1350
  else
1128
- implByName.set(m.name, [m]);
1351
+ implsByKey.set(key, [m]);
1129
1352
  }
1130
1353
  let added = 0;
1354
+ const unmatched = [];
1131
1355
  for (const bm of baseMethodsOf(base)) {
1132
1356
  if (added >= MAX_CALLBACKS_PER_CHANNEL)
1133
1357
  break;
1134
- for (const m of implByName.get(bm.name) ?? []) {
1358
+ const impls = implsByKey.get(keyOf(bm));
1359
+ if (!impls) {
1360
+ if (promotes)
1361
+ unmatched.push(bm);
1362
+ continue;
1363
+ }
1364
+ const overloaded = impls.length > 1 || declaredNamed(base, bm.name) > 1;
1365
+ for (const m of overloaded ? overridesOf(bm, impls) : impls) {
1135
1366
  if (added >= MAX_CALLBACKS_PER_CHANNEL)
1136
1367
  break;
1137
1368
  if (bm.id === m.id)
1138
1369
  continue;
1370
+ if (STATIC_SPLIT_LANGS.has(m.language) && (bm.isStatic === true) !== (m.isStatic === true))
1371
+ continue;
1139
1372
  const key = `${bm.id}>${m.id}`;
1140
1373
  if (seen.has(key))
1141
1374
  continue;
@@ -1151,46 +1384,54 @@ async function interfaceOverrideEdges(queries, onYield) {
1151
1384
  added++;
1152
1385
  }
1153
1386
  }
1387
+ if (unmatched.length > 0 && added < MAX_CALLBACKS_PER_CHANNEL) {
1388
+ promoted.push({ cls, methods: unmatched, left: MAX_CALLBACKS_PER_CHANNEL - added });
1389
+ }
1390
+ }
1391
+ }
1392
+ }
1393
+ for (const { cls, methods, left } of promoted) {
1394
+ if ((++scanned255 & 63) === 0)
1395
+ await onYield();
1396
+ let budget = left;
1397
+ for (const bm of methods) {
1398
+ if (budget <= 0)
1399
+ break;
1400
+ const promotion = goPromotion(cls.id, goMethodKey(bm));
1401
+ if (!promotion)
1402
+ continue;
1403
+ for (const m of promotion.methods) {
1404
+ if (budget <= 0)
1405
+ break;
1406
+ const key = `${bm.id}>${m.id}`;
1407
+ if (seen.has(key))
1408
+ continue;
1409
+ seen.add(key);
1410
+ edges.push({
1411
+ source: bm.id,
1412
+ target: m.id,
1413
+ kind: 'calls',
1414
+ line: bm.startLine,
1415
+ provenance: 'heuristic',
1416
+ metadata: {
1417
+ synthesizedBy: 'interface-impl',
1418
+ via: m.name,
1419
+ promotedInto: cls.name,
1420
+ registeredAt: `${cls.filePath}:${promotion.line || cls.startLine}`,
1421
+ },
1422
+ });
1423
+ budget--;
1154
1424
  }
1155
1425
  }
1156
1426
  }
1157
1427
  return edges;
1158
1428
  }
1159
- /**
1160
- * Go gRPC stub → impl bridge. The protoc-gen-go-grpc codegen emits an
1161
- * `UnimplementedXxxServer` struct in `*_grpc.pb.go` carrying one method
1162
- * per service RPC; the real handler is a hand-written struct in another
1163
- * file (`x/bank/keeper/msg_server.go::msgServer.Send` in cosmos-sdk).
1164
- * Go's structural typing means no `implements` edge exists for our
1165
- * resolver to follow, so `trace("Send","SendCoins")` lands on the
1166
- * empty stub and reports "no path" (validated empirically — the cosmos
1167
- * Q1 r1 trace failure that drove this work).
1168
- *
1169
- * Bridge: for each `UnimplementedXxxServer` whose RPC-method names are
1170
- * a SUBSET of some other Go struct's method names, emit `calls` edges
1171
- * `stub.method → impl.method` (paired by name). Excludes the gRPC
1172
- * internal markers `mustEmbedUnimplementedXxxServer` and
1173
- * `testEmbeddedByValue`, and skips candidate impls that themselves
1174
- * live in a generated file (their `xxxClient` / sibling stubs would
1175
- * otherwise look like impls).
1176
- *
1177
- * Multiple candidates is allowed and capped at MAX_CALLBACKS_PER_CHANNEL —
1178
- * a service often has both a production impl and one or more test
1179
- * mocks; linking to all preserves trace utility without false-favoring.
1180
- *
1181
- * Provenance: `heuristic`, `synthesizedBy: 'go-grpc-stub-impl'`. The
1182
- * stub's source line is the wiring site shown in the trace trail.
1183
- */
1184
1429
  async function goGrpcStubImplEdges(queries, onYield) {
1185
1430
  let scanned255 = 0;
1186
1431
  const edges = [];
1187
1432
  const seen = new Set();
1188
1433
  const STUB_RE = /^Unimplemented.*Server$/;
1189
- // gRPC internal-helper methods that appear on every Unimplemented*Server;
1190
- // not part of the service contract, so exclude when computing the RPC-method
1191
- // signature used to match impls.
1192
1434
  const isInternalMarker = (n) => n.startsWith('mustEmbed') || n === 'testEmbeddedByValue';
1193
- // Methods directly contained by each Go struct, name-only. Built once.
1194
1435
  const methodNamesByStruct = new Map();
1195
1436
  const methodNodesByStruct = new Map();
1196
1437
  const goStructs = [];
@@ -1208,10 +1449,6 @@ async function goGrpcStubImplEdges(queries, onYield) {
1208
1449
  for (const stub of goStructs) {
1209
1450
  if (!STUB_RE.test(stub.name))
1210
1451
  continue;
1211
- // The stub MUST live in a generated file — that's what tells us this is
1212
- // a protoc-emitted scaffold rather than someone naming a struct
1213
- // `UnimplementedXxxServer` by hand. Without this gate we'd also bridge
1214
- // such hand-written structs and create misleading edges.
1215
1452
  if (!(0, generated_detection_1.isGeneratedFile)(stub.filePath))
1216
1453
  continue;
1217
1454
  const stubMethods = (methodNodesByStruct.get(stub.id) ?? []).filter((m) => !isInternalMarker(m.name));
@@ -1221,18 +1458,11 @@ async function goGrpcStubImplEdges(queries, onYield) {
1221
1458
  for (const cand of goStructs) {
1222
1459
  if (cand.id === stub.id)
1223
1460
  continue;
1224
- // Skip generated-file candidates — they're siblings (msgClient,
1225
- // UnsafeMsgServer, …) whose method sets coincidentally match.
1226
1461
  if ((0, generated_detection_1.isGeneratedFile)(cand.filePath))
1227
1462
  continue;
1228
1463
  const candNames = methodNamesByStruct.get(cand.id);
1229
1464
  if (!candNames)
1230
1465
  continue;
1231
- // Subset: every RPC method must exist on the candidate by name.
1232
- // Signature-level match would tighten this further, but name-match
1233
- // alone already gives one-to-one pairing in real codebases because
1234
- // gRPC method-name sets are highly distinctive (Send + MultiSend +
1235
- // UpdateParams + SetSendEnabled is unique to bank's MsgServer).
1236
1466
  if (!stubMethodNames.every((n) => candNames.has(n)))
1237
1467
  continue;
1238
1468
  const candMethods = methodNodesByStruct.get(cand.id) ?? [];
@@ -1268,15 +1498,13 @@ async function goGrpcStubImplEdges(queries, onYield) {
1268
1498
  }
1269
1499
  return edges;
1270
1500
  }
1271
- /** Kinds a JSX tag can name. A tag that resolves only to a type is markup we drop. */
1272
1501
  const JSX_CHILD_KINDS = new Set(['component', 'function', 'class']);
1273
- /**
1274
- * The languages a JSX tag can plausibly name a component in. Preferred over a
1275
- * same-named symbol in another language, never required — a React Native tag
1276
- * whose only match is the native class it bridges to (`requireNativeComponent`)
1277
- * still links there.
1278
- */
1279
1502
  const JSX_CHILD_LANGUAGES = [...JS_FAMILY, 'vue', 'svelte'];
1503
+ const JSX_INPUT_FILE = /\.(?:[cm]?[jt]sx?|vue|svelte|astro)$/;
1504
+ function isJsxChildCandidate(node) {
1505
+ return JSX_CHILD_KINDS.has(node.kind) && JS_FAMILY.includes(node.language) &&
1506
+ (node.kind === 'component' || /^[A-Z]/.test(node.name));
1507
+ }
1280
1508
  function languageForJsxFile(file) {
1281
1509
  if (file.endsWith('.tsx'))
1282
1510
  return 'tsx';
@@ -1290,45 +1518,75 @@ function languageForJsxFile(file) {
1290
1518
  return 'svelte';
1291
1519
  return 'javascript';
1292
1520
  }
1293
- /** `localName` → the project file it is imported from, for one file's imports. */
1294
1521
  function importedFrom(ctx, file, language) {
1295
1522
  const out = new Map();
1296
1523
  for (const im of ctx.getImportMappings(file, language)) {
1297
- // The mappings name the module as written; the file it is comes from the
1298
- // same resolution the import resolver uses (aliases, extensions, index files).
1299
1524
  const resolved = im.resolvedPath ?? (0, import_resolver_1.resolveImportPath)(im.source, file, language, ctx);
1300
1525
  if (resolved)
1301
1526
  out.set(im.localName, resolved);
1302
1527
  }
1303
1528
  return out;
1304
1529
  }
1305
- /**
1306
- * The component a JSX tag names, among every node that shares the name.
1307
- *
1308
- * A tag is written in one file, and that file already says which `FrameCard` it
1309
- * means: the one it declares, or the one it imports. Taking the FIRST node of
1310
- * that name — which is what this did — is a coin flip once a name repeats, and
1311
- * it costs twice over. The parent gets an edge to a component it never renders,
1312
- * and the component it does render is left with no caller at all, so every walk
1313
- * back from that subtree dead-ends: on an Expo app whose `<FrameCard/>` was one
1314
- * of two, the folder sheet's `openBackgroundNoiseDetail` stood alone on Screens
1315
- * with no screen behind it, while the edge pointed at an unrelated card in
1316
- * another sheet.
1317
- *
1318
- * Same file first — a small component declared beside its use is the commonest
1319
- * shape, and the one an import can never disambiguate. Then the file the name
1320
- * is imported from. Then the language, which only decides a tie: a `.tsx` tag
1321
- * naming both a TS component and a same-named Swift class means the TS one.
1322
- */
1323
- function jsxChild(ctx, name, file, importsOf) {
1324
- const candidates = ctx.getNodesByName(name).filter((n) => JSX_CHILD_KINDS.has(n.kind));
1530
+ function importedFromPackage(ctx, name, file) {
1531
+ const language = languageForJsxFile(file);
1532
+ const binding = ctx.getImportMappings(file, language).find((m) => m.localName === name);
1533
+ return !!binding && ctx.isOutOfRepoImport?.(binding.source, file, language) === true;
1534
+ }
1535
+ function projectImport(ctx, name, file) {
1536
+ const language = languageForJsxFile(file);
1537
+ const binding = ctx.getImportMappings(file, language).find((m) => m.localName === name);
1538
+ if (!binding || binding.isNamespace)
1539
+ return undefined;
1540
+ const module = binding.resolvedPath ?? (0, import_resolver_1.resolveImportPath)(binding.source, file, language, ctx);
1541
+ if (!module || !ctx.getNodesInFile(module).some((n) => n.kind === 'file'))
1542
+ return undefined;
1543
+ return { module, exported: binding.isDefault || binding.exportedName === 'default' ? 'default' : binding.exportedName };
1544
+ }
1545
+ function importedTagModules(ctx, file, content, memo) {
1546
+ const out = new Set();
1547
+ JSX_TAG_RE.lastIndex = 0;
1548
+ const names = new Set();
1549
+ for (let m = JSX_TAG_RE.exec(content); m; m = JSX_TAG_RE.exec(content))
1550
+ names.add(m[1]);
1551
+ for (const name of names) {
1552
+ const imported = projectImport(ctx, name, file);
1553
+ if (!imported)
1554
+ continue;
1555
+ const key = `${imported.module}\0${imported.exported}`;
1556
+ let reads = memo.get(key);
1557
+ if (!reads) {
1558
+ reads = new Set();
1559
+ (0, react_1.exportedComponent)(imported.module, imported.exported, ctx, new Set(), reads);
1560
+ memo.set(key, reads);
1561
+ }
1562
+ for (const read of reads)
1563
+ out.add(read);
1564
+ }
1565
+ out.delete(file);
1566
+ return out;
1567
+ }
1568
+ function jsxChild(ctx, name, file, importsOf, ownValueOf, exportOf) {
1569
+ const own = ownValueOf(name);
1570
+ if (own)
1571
+ return own.component ?? own.declaration;
1572
+ const candidates = ctx.getNodesByName(name).filter((n) => JSX_CHILD_KINDS.has(n.kind) && !(0, name_matcher_1.isManualMockHiddenFrom)(n.filePath, file));
1573
+ const local = candidates.find((n) => n.filePath === file);
1574
+ if (local)
1575
+ return local;
1576
+ if (importedFromPackage(ctx, name, file))
1577
+ return undefined;
1578
+ const imported = projectImport(ctx, name, file);
1579
+ if (imported) {
1580
+ const exported = exportOf(imported.module, imported.exported);
1581
+ if (exported)
1582
+ return exported;
1583
+ const inModule = candidates.find((n) => n.filePath === imported.module);
1584
+ if (inModule)
1585
+ return inModule;
1586
+ if (candidates.length > 0)
1587
+ return undefined;
1588
+ }
1325
1589
  if (candidates.length === 0) {
1326
- // A name nothing declares is the file's DEFAULT import of a module's one
1327
- // component under another name: segmented-control renders
1328
- // `<RNCSegmentedControlNativeComponent>`, the default export of a module
1329
- // that is `requireNativeComponent('RNCSegmentedControl')`; element-plus's
1330
- // tests render `<Autocomplete>` from `autocomplete.vue`. A named import
1331
- // names an export of its own, which a barrel's one component is not.
1332
1590
  const isDefault = ctx
1333
1591
  .getImportMappings(file, languageForJsxFile(file))
1334
1592
  .some((m) => m.localName === name && m.isDefault);
@@ -1338,9 +1596,6 @@ function jsxChild(ctx, name, file, importsOf) {
1338
1596
  }
1339
1597
  if (candidates.length === 1)
1340
1598
  return candidates[0];
1341
- const local = candidates.find((n) => n.filePath === file);
1342
- if (local)
1343
- return local;
1344
1599
  const from = importsOf().get(name);
1345
1600
  if (from) {
1346
1601
  const imported = candidates.find((n) => n.filePath === from);
@@ -1349,51 +1604,423 @@ function jsxChild(ctx, name, file, importsOf) {
1349
1604
  }
1350
1605
  return candidates.find((n) => JSX_CHILD_LANGUAGES.includes(n.language)) ?? candidates[0];
1351
1606
  }
1352
- /**
1353
- * Phase 5: React JSX child rendering. A component that returns `<Child .../>`
1354
- * mounts Child — React calls it — but JSX instantiation isn't a static call edge,
1355
- * so a render tree (App.render → StaticCanvas → renderStaticScene) breaks at the
1356
- * JSX hop. Link parent → each capitalized JSX child it renders. File-oriented
1357
- * (read each JSX file once). Precision gate: the child name must resolve to a
1358
- * component/function/class node — TS generics like `Array<Foo>` resolve to a type
1359
- * (or nothing) and are dropped.
1360
- */
1607
+ function wrappedChild(ctx, name, file, importsOf, ownValueOf, exportOf) {
1608
+ const declared = ownValueOf(name) !== undefined ||
1609
+ (ctx.getNodesInFileNamed?.(file, name) ?? ctx.getNodesInFile(file).filter((n) => n.name === name))
1610
+ .some((n) => JSX_CHILD_KINDS.has(n.kind));
1611
+ if (!declared && !projectImport(ctx, name, file))
1612
+ return undefined;
1613
+ return jsxChild(ctx, name, file, importsOf, ownValueOf, exportOf);
1614
+ }
1615
+ function opensTag(src, at, name) {
1616
+ const end = at + 1 + name.length;
1617
+ if (/^\s+extends\s/.test(src.slice(end, end + 40)))
1618
+ return false;
1619
+ return !/[\w$]/.test(src[at - 1] ?? '') || /\breturn$/.test(src.slice(Math.max(0, at - 7), at));
1620
+ }
1621
+ function writtenBare(src, name) {
1622
+ for (let at = src.indexOf(name); at !== -1; at = src.indexOf(name, at + name.length)) {
1623
+ if (/[\w$]/.test(src[at - 1] ?? '') || /[\w$]/.test(src[at + name.length] ?? ''))
1624
+ continue;
1625
+ if (src[at - 1] === '<' || (src[at - 1] === '/' && src[at - 2] === '<'))
1626
+ continue;
1627
+ return true;
1628
+ }
1629
+ return false;
1630
+ }
1631
+ function ownLinesBind(name, src) {
1632
+ const n = (0, utils_1.escapeRegExp)(name);
1633
+ return new RegExp(`\\b(?:const|let|var)\\s+${n}\\b(?!\\s*[,\\]}])`).test(src);
1634
+ }
1635
+ function declaredInside(ctx, name, parent, child) {
1636
+ const inside = (n) => n.id !== parent.id && n.filePath === parent.filePath &&
1637
+ n.startLine >= parent.startLine && n.startLine <= parent.endLine;
1638
+ if (inside(child))
1639
+ return child;
1640
+ return ctx.getNodesByName(name).find((n) => JSX_CHILD_KINDS.has(n.kind) && inside(n));
1641
+ }
1642
+ function spanTags(src, startLine) {
1643
+ const names = { tags: new Map(), bare: new Set(), src, destructured: new Map() };
1644
+ if (src.includes('</') || src.includes('/>')) {
1645
+ let line = startLine;
1646
+ let counted = 0;
1647
+ JSX_TAG_RE.lastIndex = 0;
1648
+ let m;
1649
+ while ((m = JSX_TAG_RE.exec(src))) {
1650
+ for (let nl = src.indexOf('\n', counted); nl !== -1 && nl < m.index; nl = src.indexOf('\n', nl + 1))
1651
+ line++;
1652
+ counted = m.index;
1653
+ if (!names.tags.get(m[1]))
1654
+ names.tags.set(m[1], opensTag(src, m.index, m[1]) ? line : 0);
1655
+ }
1656
+ for (const [name, first] of names.tags)
1657
+ if (first && writtenBare(src, name))
1658
+ names.bare.add(name);
1659
+ }
1660
+ return names;
1661
+ }
1662
+ function scopeBinds(names, fn, name, line, file, ctx) {
1663
+ return names.bare.has(name) &&
1664
+ ((0, name_matcher_1.jsCodeBindsName)(name, fn, file, line, ctx) || destructuredBy(names, name, line - fn.startLine));
1665
+ }
1666
+ function functionsAround(parents, fn) {
1667
+ const around = [];
1668
+ for (const n of parents) {
1669
+ if (n.startLine <= fn.startLine && n.endLine >= fn.endLine &&
1670
+ (n.startLine !== fn.startLine || n.endLine !== fn.endLine))
1671
+ around.push(n);
1672
+ }
1673
+ return around.sort((a, b) => b.startLine - a.startLine || a.endLine - b.endLine);
1674
+ }
1675
+ function destructuredBy(names, name, index) {
1676
+ const key = `${index}\0${name}`;
1677
+ let binds = names.destructured.get(key);
1678
+ if (binds === undefined)
1679
+ names.destructured.set(key, (binds = destructures(names.src, name, lineEnd(names.src, index))));
1680
+ return binds;
1681
+ }
1682
+ function lineEnd(src, index) {
1683
+ let at = -1;
1684
+ for (let i = 0; i <= index; i++) {
1685
+ at = src.indexOf('\n', at + 1);
1686
+ if (at === -1)
1687
+ return src.length;
1688
+ }
1689
+ return at;
1690
+ }
1691
+ const ID_CHAR = /[\w$]/;
1692
+ const SPACE = /\s/;
1693
+ const PATTERN_REACH = 10_000;
1694
+ const CONTROL_HEADS = new Set(['if', 'while', 'for', 'switch', 'with']);
1695
+ const PARAMETERS_END = /\s*(?::[^=;{}()\n]*)?(?:=>|\{)/y;
1696
+ const IMPORTED_VALUE = /\s*(?::[^=;]*)?=\s*(?:await\s+)?(?:require|import)\s*\(/y;
1697
+ function destructures(src, name, end) {
1698
+ for (let at = src.indexOf(name); at !== -1 && at < end; at = src.indexOf(name, at + name.length)) {
1699
+ if (bindingElementAt(src, at, name.length))
1700
+ return true;
1701
+ }
1702
+ return false;
1703
+ }
1704
+ const DESTRUCTURING_DECLARATION = /\b(?:const|let|var)\s*[{[]/g;
1705
+ function topLevelPatterns(code) {
1706
+ const patterns = [];
1707
+ let depth = 0;
1708
+ let at = 0;
1709
+ DESTRUCTURING_DECLARATION.lastIndex = 0;
1710
+ for (let m = DESTRUCTURING_DECLARATION.exec(code); m; m = DESTRUCTURING_DECLARATION.exec(code)) {
1711
+ for (; at < m.index; at++) {
1712
+ if (code[at] === '{')
1713
+ depth++;
1714
+ else if (code[at] === '}')
1715
+ depth--;
1716
+ }
1717
+ if (depth !== 0)
1718
+ continue;
1719
+ const open = m.index + m[0].length - 1;
1720
+ const close = matchingCloser(code, open);
1721
+ if (close > open)
1722
+ patterns.push([open, close]);
1723
+ }
1724
+ return patterns;
1725
+ }
1726
+ function patternsBind(code, patterns, name) {
1727
+ for (const [open, close] of patterns) {
1728
+ for (let at = code.indexOf(name, open); at !== -1 && at < close; at = code.indexOf(name, at + name.length)) {
1729
+ if (bindingElementAt(code, at, name.length))
1730
+ return true;
1731
+ }
1732
+ }
1733
+ return false;
1734
+ }
1735
+ function bindingElementAt(code, at, length) {
1736
+ if (ID_CHAR.test(code[at - 1] ?? '') || ID_CHAR.test(code[at + length] ?? ''))
1737
+ return false;
1738
+ const next = skipSpace(code, at + length, 1);
1739
+ const after = code[next];
1740
+ if (after !== ',' && after !== '}' && after !== ']' &&
1741
+ (after !== '=' || code[next + 1] === '=' || code[next + 1] === '>'))
1742
+ return false;
1743
+ let prev = skipSpace(code, at - 1, -1);
1744
+ if (code[prev] === '.') {
1745
+ if (code[prev - 1] !== '.' || code[prev - 2] !== '.')
1746
+ return false;
1747
+ prev = skipSpace(code, prev - 3, -1);
1748
+ }
1749
+ let opener = prev;
1750
+ if (code[prev] === ',') {
1751
+ opener = enclosingOpener(code, prev - 1);
1752
+ }
1753
+ else if (code[prev] === ':') {
1754
+ if (!keyOpensElement(code, prev))
1755
+ return false;
1756
+ opener = enclosingOpener(code, prev - 1);
1757
+ if (code[opener] !== '{')
1758
+ return false;
1759
+ }
1760
+ return (code[opener] === '{' || code[opener] === '[') && bindsPattern(code, opener, 0);
1761
+ }
1762
+ function bindsPattern(code, opener, depth) {
1763
+ if (depth > 8)
1764
+ return false;
1765
+ const p = skipSpace(code, opener - 1, -1);
1766
+ const c = code[p];
1767
+ if (c === '(')
1768
+ return opensParameters(code, p);
1769
+ if (c === '[')
1770
+ return bindsPattern(code, p, depth + 1);
1771
+ if (c === ',') {
1772
+ const q = enclosingOpener(code, p - 1);
1773
+ if (code[q] === '(')
1774
+ return opensParameters(code, q);
1775
+ return code[q] === '[' && bindsPattern(code, q, depth + 1);
1776
+ }
1777
+ if (c === ':') {
1778
+ if (!keyOpensElement(code, p))
1779
+ return false;
1780
+ const q = enclosingOpener(code, p - 1);
1781
+ return code[q] === '{' && bindsPattern(code, q, depth + 1);
1782
+ }
1783
+ if (!ID_CHAR.test(c ?? ''))
1784
+ return false;
1785
+ const word = wordEndingAt(code, p);
1786
+ if (word !== 'const' && word !== 'let' && word !== 'var')
1787
+ return false;
1788
+ const close = matchingCloser(code, opener);
1789
+ if (close < 0)
1790
+ return false;
1791
+ IMPORTED_VALUE.lastIndex = close + 1;
1792
+ return !IMPORTED_VALUE.test(code);
1793
+ }
1794
+ function opensParameters(code, paren) {
1795
+ const p = skipSpace(code, paren - 1, -1);
1796
+ if (ID_CHAR.test(code[p] ?? '') && CONTROL_HEADS.has(wordEndingAt(code, p)))
1797
+ return false;
1798
+ const close = matchingCloser(code, paren);
1799
+ if (close < 0)
1800
+ return false;
1801
+ PARAMETERS_END.lastIndex = close + 1;
1802
+ return PARAMETERS_END.test(code);
1803
+ }
1804
+ function keyOpensElement(code, colon) {
1805
+ let k = skipSpace(code, colon - 1, -1);
1806
+ const c = code[k];
1807
+ if (c === ']')
1808
+ k = enclosingOpener(code, k - 1) - 1;
1809
+ else if (c === '"' || c === "'")
1810
+ k = code.lastIndexOf(c, k - 1) - 1;
1811
+ else if (ID_CHAR.test(c ?? ''))
1812
+ while (k >= 0 && ID_CHAR.test(code[k]))
1813
+ k--;
1814
+ else
1815
+ return false;
1816
+ const b = code[skipSpace(code, k, -1)];
1817
+ return b === '{' || b === ',';
1818
+ }
1819
+ function enclosingOpener(code, from) {
1820
+ let depth = 0;
1821
+ for (let i = from, stop = Math.max(0, from - PATTERN_REACH); i >= stop; i--) {
1822
+ const c = code[i];
1823
+ if (c === ')' || c === ']' || c === '}')
1824
+ depth++;
1825
+ else if (c === '(' || c === '[' || c === '{') {
1826
+ if (depth === 0)
1827
+ return i;
1828
+ depth--;
1829
+ }
1830
+ }
1831
+ return -1;
1832
+ }
1833
+ function matchingCloser(code, open) {
1834
+ let depth = 0;
1835
+ for (let i = open, stop = Math.min(code.length, open + PATTERN_REACH); i < stop; i++) {
1836
+ const c = code[i];
1837
+ if (c === '(' || c === '[' || c === '{')
1838
+ depth++;
1839
+ else if ((c === ')' || c === ']' || c === '}') && --depth === 0)
1840
+ return i;
1841
+ }
1842
+ return -1;
1843
+ }
1844
+ function wordEndingAt(code, end) {
1845
+ let start = end;
1846
+ while (start > 0 && ID_CHAR.test(code[start - 1]))
1847
+ start--;
1848
+ return code.slice(start, end + 1);
1849
+ }
1850
+ function skipSpace(code, at, step) {
1851
+ while (at >= 0 && at < code.length && SPACE.test(code[at]))
1852
+ at += step;
1853
+ return at;
1854
+ }
1361
1855
  async function reactJsxChildEdges(ctx, onYield) {
1362
1856
  let scannedFiles = 0;
1363
1857
  const edges = [];
1364
1858
  const seen = new Set();
1365
1859
  const PARENT_KINDS = new Set(['method', 'function', 'component']);
1860
+ const VALUE_PARENT_KINDS = new Set(['constant', 'variable']);
1861
+ const exports = new Map();
1862
+ const exportOf = (module, exported) => {
1863
+ const key = `${module}\0${exported}`;
1864
+ let node = exports.get(key);
1865
+ if (node === undefined) {
1866
+ const id = (0, react_1.exportedComponent)(module, exported, ctx);
1867
+ node = id ? ctx.getNodeById?.(id) ?? null : null;
1868
+ exports.set(key, node);
1869
+ }
1870
+ return node;
1871
+ };
1366
1872
  let scanned = 0;
1367
1873
  for (const file of ctx.getAllFiles()) {
1368
1874
  if ((++scannedFiles & 15) === 0)
1369
1875
  await onYield();
1370
1876
  if ((++scanned & 255) === 0)
1371
- await onYield(); // #1091: yield mid-scan on huge graphs
1877
+ await onYield();
1372
1878
  const content = ctx.readFile(file);
1373
- if (!content || (!content.includes('</') && !content.includes('/>')))
1374
- continue; // JSX-file gate
1375
- // File-level language gate, not merely a project-level one: mixed C/JS
1376
- // monorepos must not interpret `"<Foo/>"` inside C as JSX (#1560).
1377
- const parents = ctx.getNodesInFile(file).filter((n) => PARENT_KINDS.has(n.kind) && JS_FAMILY.includes(n.language));
1879
+ if (!content)
1880
+ continue;
1881
+ const hasTags = content.includes('</') || content.includes('/>');
1882
+ const wraps = WRAPPER_CALL_RE.test(content);
1883
+ if (!hasTags && !wraps)
1884
+ continue;
1885
+ const inFile = ctx.getNodesInFile(file);
1886
+ const ownValues = new Map();
1887
+ const ownValueOf = (name) => {
1888
+ if (!ownValues.has(name))
1889
+ ownValues.set(name, (0, react_1.declaredComponent)(name, file, ctx));
1890
+ return ownValues.get(name);
1891
+ };
1892
+ if (wraps) {
1893
+ let wrapperImports = null;
1894
+ for (const wrapper of inFile) {
1895
+ if (wrapper.kind !== 'component' || !JS_FAMILY.includes(wrapper.language))
1896
+ continue;
1897
+ const name = (0, react_1.wrappedComponentName)(wrapper, ctx);
1898
+ if (!name)
1899
+ continue;
1900
+ const importsOf = () => (wrapperImports ??= importedFrom(ctx, file, wrapper.language));
1901
+ const child = wrappedChild(ctx, name, file, importsOf, ownValueOf, exportOf);
1902
+ if (!child || child.id === wrapper.id || (0, name_matcher_1.crossesCodeBoundary)(wrapper.language, child.language))
1903
+ continue;
1904
+ const key = `${wrapper.id}>${child.id}`;
1905
+ if (seen.has(key))
1906
+ continue;
1907
+ seen.add(key);
1908
+ edges.push({
1909
+ source: wrapper.id, target: child.id, kind: 'calls', line: wrapper.startLine,
1910
+ provenance: 'heuristic',
1911
+ metadata: { synthesizedBy: 'jsx-render', via: name, wrapped: true },
1912
+ });
1913
+ }
1914
+ }
1915
+ if (!hasTags)
1916
+ continue;
1917
+ const fns = inFile.filter((n) => PARENT_KINDS.has(n.kind) && JSX_FAMILY.includes(n.language));
1918
+ let code;
1919
+ const codeOf = () => (code === undefined ? (code = (0, jsx_code_1.jsxCode)(content)) : code);
1920
+ let lines = null;
1921
+ const holds = (n) => PARENT_KINDS.has(n.kind) || n.kind === 'class';
1922
+ let fileNode = inFile.find((n) => n.kind === 'file' && JSX_FAMILY.includes(n.language));
1923
+ const owns = new Map();
1924
+ let values = [];
1925
+ if (fileNode) {
1926
+ const held = new Uint8Array((fileNode.endLine || 0) + 2);
1927
+ const valuesOn = new Uint8Array(held.length);
1928
+ for (const n of inFile) {
1929
+ if (n.kind === 'file' || n.kind === 'import' || n.kind === 'export' || n.kind === 'route' ||
1930
+ !n.startLine || !n.endLine)
1931
+ continue;
1932
+ const mark = holds(n) ? 1 : 2;
1933
+ for (let l = n.startLine; l <= n.endLine && l < held.length; l++)
1934
+ if (held[l] !== 1)
1935
+ held[l] = mark;
1936
+ }
1937
+ values = inFile.filter((n) => VALUE_PARENT_KINDS.has(n.kind) && JSX_FAMILY.includes(n.language) &&
1938
+ held[n.startLine] !== 1);
1939
+ const raw = (lines ??= (codeOf() ?? content).split('\n'));
1940
+ for (const v of values) {
1941
+ for (let l = v.startLine; l <= v.endLine && l < valuesOn.length; l++)
1942
+ if (valuesOn[l] < 2)
1943
+ valuesOn[l]++;
1944
+ const before = (raw[v.startLine - 1] ?? '').slice(0, v.startColumn ?? 0);
1945
+ const after = (raw[v.endLine - 1] ?? '').slice(v.endColumn ?? Infinity);
1946
+ if (!/^\s*(?:(?:export|declare|default|const|let|var)\s+)*$/.test(before))
1947
+ valuesOn[v.startLine] = 2;
1948
+ if (!/^[\s;]*$/.test(after))
1949
+ valuesOn[v.endLine] = 2;
1950
+ }
1951
+ for (const v of values)
1952
+ owns.set(v.id, (line) => held[line] !== 1 && valuesOn[line] === 1);
1953
+ if (held.subarray(1, fileNode.endLine + 1).includes(0))
1954
+ owns.set(fileNode.id, (line) => !held[line]);
1955
+ else
1956
+ fileNode = undefined;
1957
+ }
1958
+ const parents = [...fns, ...values, ...(fileNode ? [fileNode] : [])];
1378
1959
  if (parents.length === 0)
1379
1960
  continue;
1380
- // Read once per file, and only when a name actually turns out ambiguous.
1381
1961
  let imports = null;
1382
1962
  const importsOf = () => (imports ??= importedFrom(ctx, file, parents[0].language));
1963
+ const tagsBySpan = new Map();
1964
+ const spanOf = (fn) => {
1965
+ const own = owns.get(fn.id);
1966
+ const span = own ? fn.id : `${fn.startLine}:${fn.endLine}`;
1967
+ let names = tagsBySpan.get(span);
1968
+ if (!names) {
1969
+ lines ??= (codeOf() ?? content).split('\n');
1970
+ const spanLines = lines.slice(fn.startLine - 1, fn.endLine);
1971
+ names = spanTags((own ? spanLines.map((text, i) => (own(fn.startLine + i) ? text : '')) : spanLines).join('\n'), fn.startLine);
1972
+ tagsBySpan.set(span, names);
1973
+ }
1974
+ return names;
1975
+ };
1976
+ let topPatterns = null;
1977
+ const topBinds = new Map();
1978
+ const destructuredAtTop = (name) => {
1979
+ let binds = topBinds.get(name);
1980
+ if (binds === undefined) {
1981
+ const src = codeOf();
1982
+ topPatterns ??= src === null ? [] : topLevelPatterns(src);
1983
+ binds = src !== null && topPatterns.length > 0 && patternsBind(src, topPatterns, name);
1984
+ topBinds.set(name, binds);
1985
+ }
1986
+ return binds;
1987
+ };
1383
1988
  for (const parent of parents) {
1384
- const src = sliceLines(content, parent.startLine, parent.endLine);
1385
- if (!src || (!src.includes('</') && !src.includes('/>')))
1989
+ if (!parent.startLine || !parent.endLine)
1386
1990
  continue;
1387
- const names = new Set();
1388
- JSX_TAG_RE.lastIndex = 0;
1389
- let m;
1390
- while ((m = JSX_TAG_RE.exec(src)))
1391
- names.add(m[1]);
1991
+ const names = spanOf(parent);
1992
+ let around = null;
1392
1993
  let added = 0;
1393
- for (const name of names) {
1994
+ for (const [name, line] of names.tags) {
1394
1995
  if (added >= MAX_JSX_CHILDREN)
1395
1996
  break;
1396
- const child = jsxChild(ctx, name, file, importsOf);
1997
+ if (!line)
1998
+ continue;
1999
+ let child = jsxChild(ctx, name, file, importsOf, ownValueOf, exportOf);
2000
+ if (child) {
2001
+ const own = owns.get(parent.id);
2002
+ if (own) {
2003
+ if ((names.bare.has(name) && ownLinesBind(name, names.src)) || destructuredAtTop(name)) {
2004
+ child = declaredInside(ctx, name, parent, child);
2005
+ }
2006
+ }
2007
+ else {
2008
+ let binder = scopeBinds(names, parent, name, line, file, ctx) ? parent : undefined;
2009
+ if (!binder) {
2010
+ around ??= functionsAround(fns, parent);
2011
+ for (const fn of around) {
2012
+ if (scopeBinds(spanOf(fn), fn, name, line, file, ctx)) {
2013
+ binder = fn;
2014
+ break;
2015
+ }
2016
+ }
2017
+ }
2018
+ if (binder)
2019
+ child = declaredInside(ctx, name, binder, child);
2020
+ else if (destructuredAtTop(name))
2021
+ child = declaredInside(ctx, name, around?.[around.length - 1] ?? parent, child);
2022
+ }
2023
+ }
1397
2024
  if (!child || child.id === parent.id || (0, name_matcher_1.crossesCodeBoundary)(parent.language, child.language))
1398
2025
  continue;
1399
2026
  const key = `${parent.id}>${child.id}`;
@@ -1411,18 +2038,6 @@ async function reactJsxChildEdges(ctx, onYield) {
1411
2038
  }
1412
2039
  return edges;
1413
2040
  }
1414
- /**
1415
- * Phase 6: Vue SFC templates. The `.vue` extractor only parses `<script>`, so
1416
- * template usage is invisible — child components and event handlers used ONLY in
1417
- * the template have no edge to them. PascalCase children (`<VPNav/>`) are already
1418
- * caught by reactJsxChildEdges (which scans the SFC component node), so this adds
1419
- * the two Vue-specific shapes:
1420
- * - kebab-case children: `<el-button>` → `ElButton` component (renders).
1421
- * - event bindings: `@click="onClick"` / `v-on:submit="save"` → handler method.
1422
- * Scoped to the `<template>` block of `.vue` files; resolution gate (kebab→
1423
- * component, handler→function/method) keeps precision; inline arrows / `$emit`
1424
- * skipped.
1425
- */
1426
2041
  async function vueTemplateEdges(ctx, onYield) {
1427
2042
  let scannedFiles = 0;
1428
2043
  let scanned255 = 0;
@@ -1430,14 +2045,7 @@ async function vueTemplateEdges(ctx, onYield) {
1430
2045
  const seen = new Set();
1431
2046
  const COMPONENT_KINDS = new Set(['component', 'function', 'class']);
1432
2047
  const HANDLER_KINDS = new Set(['method', 'function']);
1433
- // A composable's returned member may be a fn (`function close(){}`) or an
1434
- // arrow assigned to a const (`const close = () => {}`).
1435
2048
  const RETURN_KINDS = new Set(['method', 'function', 'variable', 'constant']);
1436
- // Nuxt auto-imports nested components by a DIRECTORY-PREFIXED name —
1437
- // `components/media/Card.vue` is used as `<MediaCard/>`, not `<Card/>` — but
1438
- // the component node is named by basename (`Card`), so a direct tag match
1439
- // misses it (flat components match by basename and don't need this). Map each
1440
- // nested component's Nuxt name → node so those template usages resolve.
1441
2049
  const nuxtComponents = new Map();
1442
2050
  for (const c of (ctx.iterateNodesByKind?.('component') ?? ctx.getNodesByKind('component'))) {
1443
2051
  if ((++scanned255 & 63) === 0)
@@ -1458,18 +2066,15 @@ async function vueTemplateEdges(ctx, onYield) {
1458
2066
  const comp = ctx.getNodesInFile(file).find((n) => n.kind === 'component');
1459
2067
  if (!comp)
1460
2068
  continue;
1461
- // Composable-destructure map: alias → { composable, key }. Lets us resolve a
1462
- // template handler that isn't a local function but a destructured composable
1463
- // return (`@click="closeSidebar"` ← `const { close: closeSidebar } = useSidebarControl()`).
1464
2069
  const script = content.match(/<script[^>]*>([\s\S]*?)<\/script>/i)?.[1] ?? '';
1465
2070
  const destructured = new Map();
1466
2071
  VUE_DESTRUCTURE_RE.lastIndex = 0;
1467
2072
  let dm;
1468
2073
  while ((dm = VUE_DESTRUCTURE_RE.exec(script))) {
1469
2074
  if (!/^use[A-Z]/.test(dm[2]))
1470
- continue; // composables / hooks only
2075
+ continue;
1471
2076
  for (const part of dm[1].split(',')) {
1472
- const pm = part.trim().match(/^(\w+)\s*(?::\s*(\w+))?$/); // key | key: alias
2077
+ const pm = part.trim().match(/^(\w+)\s*(?::\s*(\w+))?$/);
1473
2078
  if (pm)
1474
2079
  destructured.set(pm[2] || pm[1], { composable: dm[2], key: pm[1] });
1475
2080
  }
@@ -1486,49 +2091,42 @@ async function vueTemplateEdges(ctx, onYield) {
1486
2091
  edges.push({ source: comp.id, target: target.id, kind: 'calls', line: comp.startLine, provenance: 'heuristic', metadata: meta });
1487
2092
  added++;
1488
2093
  };
1489
- // Prefer a target in THIS SFC (handlers live in the same file's script) —
1490
- // avoids cross-file mis-match when a name repeats across a monorepo.
1491
- const resolve = (name, kinds) => {
1492
- const matches = ctx.getNodesByName(name).filter((n) => kinds.has(n.kind));
1493
- return matches.find((n) => n.filePath === file) ?? matches[0];
2094
+ const resolve = (name, kinds, fallback) => {
2095
+ const matches = ctx.getNodesByName(name).filter((n) => kinds.has(n.kind) && !(0, name_matcher_1.isManualMockHiddenFrom)(n.filePath, file));
2096
+ const local = matches.find((n) => n.filePath === file);
2097
+ if (local || importedFromPackage(ctx, name, file))
2098
+ return local;
2099
+ return matches[0] ?? fallback;
1494
2100
  };
1495
2101
  let m;
1496
2102
  VUE_KEBAB_RE.lastIndex = 0;
1497
2103
  while ((m = VUE_KEBAB_RE.exec(tpl))) {
1498
2104
  const tag = kebabToPascal(m[1]);
1499
- addEdge(resolve(tag, COMPONENT_KINDS) ?? nuxtComponents.get(tag), { synthesizedBy: 'jsx-render', via: m[1] });
2105
+ addEdge(resolve(tag, COMPONENT_KINDS, nuxtComponents.get(tag)), { synthesizedBy: 'jsx-render', via: m[1] });
1500
2106
  }
1501
- // PascalCase component tags. Try a direct name match first (flat components
1502
- // and explicit registrations), then the Nuxt dir-prefixed auto-import name
1503
- // (`<MediaCard>` → components/media/Card.vue). Built-ins match neither → no edge.
1504
2107
  VUE_PASCAL_RE.lastIndex = 0;
1505
2108
  while ((m = VUE_PASCAL_RE.exec(tpl))) {
1506
2109
  const tag = m[1];
1507
- addEdge(resolve(tag, COMPONENT_KINDS) ?? nuxtComponents.get(tag), { synthesizedBy: 'jsx-render', via: tag });
2110
+ addEdge(resolve(tag, COMPONENT_KINDS, nuxtComponents.get(tag)), { synthesizedBy: 'jsx-render', via: tag });
1508
2111
  }
1509
2112
  VUE_HANDLER_RE.lastIndex = 0;
1510
2113
  while ((m = VUE_HANDLER_RE.exec(tpl))) {
1511
2114
  const event = m[1];
1512
2115
  const expr = m[2].trim();
1513
2116
  if (expr.includes('=>') || expr.startsWith('$'))
1514
- continue; // inline arrow / $emit
1515
- const name = expr.match(/^([A-Za-z_]\w*)/)?.[1];
2117
+ continue;
2118
+ const name = expr.match(/^([A-Za-z_$][\w$]*)\s*(?:\(|$)/)?.[1];
1516
2119
  if (!name)
1517
2120
  continue;
1518
- const direct = resolve(name, HANDLER_KINDS);
2121
+ const direct = name === expr ? resolve(name, HANDLER_KINDS) : undefined;
1519
2122
  if (direct) {
1520
2123
  addEdge(direct, { synthesizedBy: 'vue-handler', event });
1521
2124
  continue;
1522
2125
  }
1523
- // Composable-destructure handler → resolve to the composable's returned fn.
1524
2126
  const d = destructured.get(name);
1525
2127
  if (!d)
1526
2128
  continue;
1527
2129
  const composable = resolve(d.composable, HANDLER_KINDS);
1528
- // Resolve to the SPECIFIC returned member (e.g. `close`) defined in the
1529
- // composable's file. No fallback to the composable itself — the component
1530
- // already has a static `useX()` call edge, so that would just be redundant
1531
- // and less precise.
1532
2130
  const keyFn = composable
1533
2131
  ? ctx.getNodesByName(d.key).find((n) => RETURN_KINDS.has(n.kind) && n.filePath === composable.filePath)
1534
2132
  : undefined;
@@ -1538,78 +2136,16 @@ async function vueTemplateEdges(ctx, onYield) {
1538
2136
  }
1539
2137
  return edges;
1540
2138
  }
1541
- /**
1542
- * React Native cross-language event channel (Phase 3 of the mixed-iOS/RN
1543
- * bridging effort). Same shape as `eventEmitterEdges` but cross-language:
1544
- *
1545
- * Native (ObjC, on RCTEventEmitter subclass):
1546
- * [self sendEventWithName:@"locationUpdate" body:@{...}];
1547
- *
1548
- * Native (Java/Kotlin, via the JS module dispatcher):
1549
- * emitter.emit("locationUpdate", body);
1550
- * reactContext.getJSModule(RCTDeviceEventEmitter.class).emit("locationUpdate", body);
1551
- *
1552
- * JS (subscriber):
1553
- * new NativeEventEmitter(NativeModules.Geo).addListener("locationUpdate", handler);
1554
- * DeviceEventEmitter.addListener("locationUpdate", handler);
1555
- *
1556
- * Synthesize: native dispatch site → JS handler, keyed by the literal
1557
- * event name. A NAMED handler (`addListener('x', handleX)`) is the target
1558
- * when it is a node; an unnamed one — a parameter passed through, or an
1559
- * inline `(data) => {…}` written in a `useEffect` — is attributed to the
1560
- * enclosing function, where the event demonstrably lands. (The in-language
1561
- * synthesizer stays named-only; this channel pairs across a language
1562
- * boundary on a literal, which is the evidence that makes the wider
1563
- * attribution safe.)
1564
- *
1565
- * Provenance `'heuristic'`, synthesizedBy `'rn-event-channel'`.
1566
- */
1567
- // ObjC's `[self sendEventWithName:@"X" body:...]` shape (bracket syntax,
1568
- // `@` string literals).
1569
2139
  const RN_OBJC_SEND_RE = /\bsendEventWithName\s*:\s*@"([^"]+)"/g;
1570
- // Swift's `sendEvent(withName: "X", body: ...)` shape — same RCTEventEmitter
1571
- // method, different call syntax. Both Objective-C and Swift subclass
1572
- // RCTEventEmitter so this catches the Swift-side equivalent emission sites
1573
- // (e.g. RNFusedLocation.swift's `sendEvent(withName: "geolocationDidChange",
1574
- // body: locationData)`).
1575
2140
  const RN_SWIFT_SEND_RE = /\bsendEvent\s*\(\s*withName\s*:\s*"([^"]+)"/g;
1576
- // JVM-side emitter calls: `emitter.emit("X", body)`. Matches both Java
1577
- // and Kotlin syntax because the call form is identical. Restricted to
1578
- // JVM source files in the consumer so we don't re-process JS emits
1579
- // (which `eventEmitterEdges` already handles).
1580
2141
  const RN_JVM_EMIT_RE = /\.emit\s*\(\s*"([^"]+)"\s*,/g;
1581
- // Custom `sendEvent(reactContext, "X", body)` wrapper — extremely common
1582
- // (react-native-device-info and many libs wrap `DeviceEventManagerModule…emit`
1583
- // behind a helper whose `.emit(eventName, …)` uses a VARIABLE, so RN_JVM_EMIT_RE
1584
- // misses it; the literal lives in the wrapper CALL instead). Captures the first
1585
- // string literal inside a `sendEvent(...)` call. `[^;{}]*?` keeps it on one
1586
- // statement and stops at a block boundary, so the wrapper DEFINITION (whose `(`
1587
- // is followed by `… ) {`) never matches. Multi-line tolerant. (java/kotlin/swift)
1588
2142
  const RN_NATIVE_SENDEVENT_RE = /\bsendEvent\s*\([^;{}]*?"([^"]+)"/g;
1589
- // The same calls with the event named by a CONSTANT — NetInfo listens with
1590
- // `addListener(PrivateTypes.DEVICE_CONNECTIVITY_EVENT, …)`, many libraries emit
1591
- // with `.emit(EVENT_NAME, …)` or `sendEventWithName:kLocationEvent`.
1592
2143
  const RN_OBJC_SEND_CONST_RE = /\bsendEventWithName\s*:\s*([A-Za-z_]\w*)\b/g;
1593
2144
  const RN_SWIFT_SEND_CONST_RE = /\bsendEvent\s*\(\s*withName\s*:\s*([A-Za-z_][\w.]*)/g;
1594
2145
  const RN_JVM_EMIT_CONST_RE = /\.emit\s*\(\s*([A-Za-z_][\w.]*)\s*,/g;
1595
2146
  const RN_NATIVE_SENDEVENT_CONST_RE = /\bsendEvent\s*\(\s*[A-Za-z_][\w.]*\s*,\s*([A-Za-z_][\w.]*)\s*,/g;
1596
2147
  const RN_JS_LISTEN_CONST_RE = /\.(?:on|once|addListener)\(\s*((?:[A-Za-z_$][\w$]*\.)*[A-Za-z_$][\w$]*)\s*,\s*([A-Za-z_$][\w$.]*|(?:async\s*)?(?:\([^)]*\)\s*=>|[A-Za-z_$][\w$]*\s*=>|function\s*\())/g;
1597
2148
  const CONSTANT_KINDS = new Set(['constant', 'variable', 'field', 'property', 'enum_member']);
1598
- /**
1599
- * The string an event-name constant holds, read off its declaration line:
1600
- * `export const DEVICE_CONNECTIVITY_EVENT = 'netInfo.networkStatusDidChange'`,
1601
- * `static final String EVENT = "x"`, `const val EVENT = "x"`,
1602
- * `NSString *const kEvent = @"x"`, `#define kEvent @"x"`, `static let event = "x"`,
1603
- * an enum case `Changed = 'changed'`.
1604
- *
1605
- * Scoped as the language scopes the name, never by the name alone — a
1606
- * parameter `eventName` is not some test's `eventName = "pong"`:
1607
- * - a bare `NAME` is a declaration in the same file, or (JS) the one an
1608
- * import of that name points at;
1609
- * - `Owner.NAME` is a declaration inside `Owner`, or (JS) `NAME` in the file
1610
- * a namespace import `Owner` points at.
1611
- * Null unless those declarations agree on one literal.
1612
- */
1613
2149
  function constantEventName(expr, file, ctx, memo) {
1614
2150
  const key = `${file}\0${expr}`;
1615
2151
  if (memo.has(key))
@@ -1650,7 +2186,7 @@ function constantEventName(expr, file, ctx, memo) {
1650
2186
  const from = importedFile(owner);
1651
2187
  decls = from
1652
2188
  ? declaredIn(from)
1653
- : ctx.getNodesByName(name).filter((n) => CONSTANT_KINDS.has(n.kind) && new RegExp(`(?:^|[.:])${owner}(?:[.:]|$)`).test(n.qualifiedName.slice(0, n.qualifiedName.lastIndexOf(name))));
2189
+ : ctx.getNodesByName(name).filter((n) => CONSTANT_KINDS.has(n.kind) && new RegExp(`(?:^|[.:])${(0, utils_1.escapeRegExp)(owner)}(?:[.:]|$)`).test(n.qualifiedName.slice(0, n.qualifiedName.lastIndexOf(name))));
1654
2190
  }
1655
2191
  const values = new Set(decls.map(read).filter((v) => v !== null));
1656
2192
  value = values.size === 1 ? [...values][0] : null;
@@ -1661,9 +2197,6 @@ function constantEventName(expr, file, ctx, memo) {
1661
2197
  async function rnEventEdges(ctx, onYield) {
1662
2198
  let scannedFiles = 0;
1663
2199
  const constants = new Map();
1664
- // Native dispatchers (source = the native method whose body sends the
1665
- // event) and JS handlers (target = the function/method registered as
1666
- // the listener) keyed by event name.
1667
2200
  const nativeDispatchersByEvent = new Map();
1668
2201
  const jsHandlersByEvent = new Map();
1669
2202
  for (const file of ctx.getAllFiles()) {
@@ -1682,8 +2215,6 @@ async function rnEventEdges(ctx, onYield) {
1682
2215
  set.add(disp.id);
1683
2216
  nativeDispatchersByEvent.set(event, set);
1684
2217
  };
1685
- // ObjC side: `sendEventWithName:@"X"` only fires inside `.m`/`.mm`
1686
- // files (RCTEventEmitter subclasses).
1687
2218
  if (file.endsWith('.m') || file.endsWith('.mm')) {
1688
2219
  RN_OBJC_SEND_RE.lastIndex = 0;
1689
2220
  let m;
@@ -1698,7 +2229,6 @@ async function rnEventEdges(ctx, onYield) {
1698
2229
  addDispatcher(event, lineOf(m.index));
1699
2230
  }
1700
2231
  }
1701
- // Swift side: same RCTEventEmitter method, parens/named-args syntax.
1702
2232
  if (file.endsWith('.swift')) {
1703
2233
  RN_SWIFT_SEND_RE.lastIndex = 0;
1704
2234
  let m;
@@ -1718,10 +2248,6 @@ async function rnEventEdges(ctx, onYield) {
1718
2248
  addDispatcher(event, lineOf(m.index));
1719
2249
  }
1720
2250
  }
1721
- // JVM side: `.emit("X", …)` in Java/Kotlin, plus the common
1722
- // `sendEvent(ctx, "X", body)` wrapper. (We pattern-match anywhere in the
1723
- // file; the JS in-language path uses a separate emitter object pattern and
1724
- // is already handled by eventEmitterEdges.)
1725
2251
  if (file.endsWith('.java') || file.endsWith('.kt')) {
1726
2252
  let m;
1727
2253
  RN_JVM_EMIT_RE.lastIndex = 0;
@@ -1743,25 +2269,13 @@ async function rnEventEdges(ctx, onYield) {
1743
2269
  }
1744
2270
  }
1745
2271
  }
1746
- // JS subscribers (.addListener("X", handler)). Restrict to JS-family
1747
- // files so a native file's `addListener:` (the ObjC method) doesn't
1748
- // get mistaken for a JS subscription — they're entirely different
1749
- // things despite sharing a name.
1750
2272
  if (file.endsWith('.js') ||
1751
2273
  file.endsWith('.jsx') ||
1752
2274
  file.endsWith('.ts') ||
1753
2275
  file.endsWith('.tsx') ||
1754
2276
  file.endsWith('.mjs') ||
1755
2277
  file.endsWith('.cjs')) {
1756
- // Match BOTH the named-handler form (`.addListener('x', fn)`) and
1757
- // an unnamed-handler form (`.addListener('x', listener)` where
1758
- // `listener` is a parameter — common in RN wrapper APIs like
1759
- // RNFirebase's `messaging().onMessageReceived(listener)`). For the
1760
- // unnamed case we attribute the subscription to the ENCLOSING JS
1761
- // function (the abstraction layer), giving a reachability-correct
1762
- // hop even when the actual user-side handler lives one call up.
1763
2278
  const ADDLISTENER_ANY = /\.(?:on|once|addListener)\(\s*['"]([^'"]+)['"]\s*,\s*([A-Za-z_][\w.]*)/g;
1764
- // The inline form: `.addListener('x', (data) => {…})` / `function () {…}`.
1765
2279
  const ADDLISTENER_INLINE = /\.(?:on|once|addListener)\(\s*['"]([^'"]+)['"]\s*,\s*(?:async\s*)?(?:\([^)]*\)\s*=>|[A-Za-z_$][\w$]*\s*=>|function\s*\()/g;
1766
2280
  ADDLISTENER_ANY.lastIndex = 0;
1767
2281
  let m;
@@ -1771,26 +2285,15 @@ async function rnEventEdges(ctx, onYield) {
1771
2285
  if (!event || !arg)
1772
2286
  continue;
1773
2287
  const bareName = arg.includes('.') ? arg.slice(arg.lastIndexOf('.') + 1) : arg;
1774
- // Try a named-symbol match first (matches the in-language semantic).
1775
2288
  const namedHandler = ctx
1776
2289
  .getNodesByName(bareName)
1777
2290
  .find((n) => n.kind === 'function' || n.kind === 'method');
1778
2291
  let targetId = namedHandler?.id ?? null;
1779
2292
  if (!targetId) {
1780
- // Fall back to the enclosing function — the subscribe-wrapper
1781
- // pattern means the event fires THROUGH this function on its
1782
- // way to user code. Reachability-correct attribution.
1783
2293
  const enclosing = (0, synth_utils_1.enclosingFn)(nodesInFile, lineOf(m.index));
1784
2294
  targetId = enclosing?.id ?? null;
1785
2295
  }
1786
2296
  if (!targetId) {
1787
- // Broader fallback for JS object-literal API shape
1788
- // (`const Foo = { watchX(...) { … addListener(...) … } }`):
1789
- // method shorthand inside an object literal isn't extracted
1790
- // as a method node, so enclosingFn returns null. Attribute to
1791
- // the smallest enclosing `constant` / `variable` node — that's
1792
- // the API surface a downstream caller would `import` and
1793
- // invoke. Reachability-correct.
1794
2297
  const line = lineOf(m.index);
1795
2298
  let smallest = null;
1796
2299
  for (const n of nodesInFile) {
@@ -1810,13 +2313,6 @@ async function rnEventEdges(ctx, onYield) {
1810
2313
  map.set(targetId, `${file}:${lineOf(m.index)}`);
1811
2314
  jsHandlersByEvent.set(event, map);
1812
2315
  }
1813
- // Inline listeners — the shape a React component registers inside a
1814
- // `useEffect`: `nativeEmitter.addListener('onCaptureComplete', (data) =>
1815
- // { … router.push('/review') })`. There is no handler symbol to name,
1816
- // so the subscription is attributed to the enclosing function exactly
1817
- // as the unnamed-argument form above is: the native event lands in that
1818
- // component, and its body is where a reader looks next. This channel
1819
- // only — the in-language synthesizer keeps its named-handler policy.
1820
2316
  ADDLISTENER_INLINE.lastIndex = 0;
1821
2317
  while ((m = ADDLISTENER_INLINE.exec(content))) {
1822
2318
  const event = m[1];
@@ -1830,8 +2326,6 @@ async function rnEventEdges(ctx, onYield) {
1830
2326
  map.set(enclosing.id, `${file}:${lineOf(m.index)}`);
1831
2327
  jsHandlersByEvent.set(event, map);
1832
2328
  }
1833
- // A constant event name: the listener lands where a literal one would —
1834
- // the named handler when it is a node, else the enclosing function.
1835
2329
  RN_JS_LISTEN_CONST_RE.lastIndex = 0;
1836
2330
  while ((m = RN_JS_LISTEN_CONST_RE.exec(content))) {
1837
2331
  const event = constantEventName(m[1], file, ctx, constants);
@@ -1840,7 +2334,6 @@ async function rnEventEdges(ctx, onYield) {
1840
2334
  const arg = m[2];
1841
2335
  const bare = /^[A-Za-z_$][\w$.]*$/.test(arg) ? arg.slice(arg.lastIndexOf('.') + 1) : null;
1842
2336
  const line = lineOf(m.index);
1843
- // The handler this file names — never a same-named function elsewhere.
1844
2337
  const named = bare ? nodesInFile.find((n) => (n.kind === 'function' || n.kind === 'method') && n.name === bare) : undefined;
1845
2338
  const target = named ?? (0, synth_utils_1.enclosingFn)(nodesInFile, line);
1846
2339
  if (!target)
@@ -1858,9 +2351,6 @@ async function rnEventEdges(ctx, onYield) {
1858
2351
  const handlers = jsHandlersByEvent.get(event);
1859
2352
  if (!handlers)
1860
2353
  continue;
1861
- // Same fan-out guard as the in-language channel: generic event names
1862
- // (e.g. 'change', 'error', 'data') with many handlers/dispatchers
1863
- // can't be matched precisely without receiver-type info.
1864
2354
  if (dispatchers.size > EVENT_FANOUT_CAP || handlers.size > EVENT_FANOUT_CAP)
1865
2355
  continue;
1866
2356
  for (const d of dispatchers) {
@@ -1883,41 +2373,7 @@ async function rnEventEdges(ctx, onYield) {
1883
2373
  }
1884
2374
  return edges;
1885
2375
  }
1886
- /**
1887
- * Phase 6 — React Native Fabric/Codegen view component bridge.
1888
- *
1889
- * The Fabric framework extractor (`frameworks/fabric.ts`) emits
1890
- * `component` nodes named after the JS-visible component (e.g.
1891
- * `RNSScreenStack`) from each `codegenNativeComponent<Props>('Name')`
1892
- * spec declaration. The native implementation lives in an ObjC++/.mm or
1893
- * Kotlin/Java class whose name follows one of RN's conventions:
1894
- *
1895
- * - Exact: `RNSScreenStack`
1896
- * - With suffix: `RNSScreenStackView`, `RNSScreenStackViewManager`,
1897
- * `RNSScreenStackComponentView`, `RNSScreenStackManager`
1898
- *
1899
- * This synthesizer walks every Fabric component node and looks for a
1900
- * native class matching one of those names; when found, emits a
1901
- * `calls` edge `component → native class` (provenance `'heuristic'`,
1902
- * `synthesizedBy:'fabric-native-impl'`) so trace from JSX usage of the
1903
- * component continues into native.
1904
- *
1905
- * The convention-based suffix lookup is precise: there's no name
1906
- * collision in RN view-manager codebases by design (Codegen output would
1907
- * conflict otherwise).
1908
- */
1909
2376
  const FABRIC_NATIVE_SUFFIXES = ['', 'View', 'ViewManager', 'ComponentView', 'Manager'];
1910
- /**
1911
- * Expo Modules cross-platform pairing. An Expo Module exposes the SAME
1912
- * JS-visible method (`AsyncFunction("getBatteryLevelAsync")`) from BOTH an iOS
1913
- * (Swift) and an Android (Kotlin) implementation. A JS callsite name-resolves to
1914
- * only ONE of them, so the other platform's impl looked like nothing called it
1915
- * (and editing it showed no blast radius). Link the iOS and Android impls of the
1916
- * same `<module>.<method>` to each other (both directions), so a JS call that
1917
- * reaches one platform reaches the other, and editing either surfaces the JS
1918
- * caller. The Expo method nodes are id-prefixed `expo-module:` and qualified
1919
- * `<file>::<module>.<method>` by the framework extractor.
1920
- */
1921
2377
  async function expoCrossPlatformEdges(queries, onYield) {
1922
2378
  let scanned255 = 0;
1923
2379
  const edges = [];
@@ -1928,7 +2384,7 @@ async function expoCrossPlatformEdges(queries, onYield) {
1928
2384
  await onYield();
1929
2385
  if (!m.id.startsWith('expo-module:'))
1930
2386
  continue;
1931
- const key = m.qualifiedName.split('::').pop(); // `<module>.<method>`
2387
+ const key = m.qualifiedName.split('::').pop();
1932
2388
  if (!key)
1933
2389
  continue;
1934
2390
  const arr = byKey.get(key);
@@ -1943,7 +2399,7 @@ async function expoCrossPlatformEdges(queries, onYield) {
1943
2399
  for (const a of group) {
1944
2400
  for (const b of group) {
1945
2401
  if (a.id === b.id || a.language === b.language)
1946
- continue; // cross-platform only
2402
+ continue;
1947
2403
  const key = `${a.id}>${b.id}`;
1948
2404
  if (seen.has(key))
1949
2405
  continue;
@@ -1961,28 +2417,12 @@ async function expoCrossPlatformEdges(queries, onYield) {
1961
2417
  }
1962
2418
  return edges;
1963
2419
  }
1964
- /**
1965
- * Classic React Native NativeModules cross-platform pairing. A native module
1966
- * method (`@ReactMethod` on Android, `RCT_EXPORT_METHOD` on iOS) is implemented
1967
- * on BOTH platforms, but a JS callsite name-resolves to only ONE — so the other
1968
- * platform's impl looked like nothing called it. A native method that HAS a JS
1969
- * caller is a confirmed bridge method; link it to the same-named native method
1970
- * in another language (the other platform's impl) so a JS call reaching one
1971
- * platform reaches the other, and editing either surfaces the JS caller.
1972
- *
1973
- * Names are normalized to the first selector keyword (`getFreeDiskStorage:` →
1974
- * `getFreeDiskStorage`) — that's the JS-visible name, and how the iOS selector
1975
- * lines up with the bare Android method name.
1976
- */
1977
2420
  async function rnCrossPlatformEdges(queries, onYield) {
1978
2421
  let scanned255 = 0;
1979
2422
  const edges = [];
1980
2423
  const seen = new Set();
1981
2424
  const NATIVE = new Set(['java', 'kotlin', 'objc', 'cpp']);
1982
2425
  const JS = new Set(['typescript', 'tsx', 'javascript', 'jsx']);
1983
- // RN module INFRASTRUCTURE methods exist on every native module (called by the
1984
- // RN runtime, not user JS), so pairing them by name would cross-link unrelated
1985
- // modules in a multi-module repo. Skip them — they aren't user-facing methods.
1986
2426
  const RN_INFRA = new Set([
1987
2427
  'addListener', 'removeListeners', 'getConstants', 'constantsToExport', 'getName',
1988
2428
  'invalidate', 'initialize', 'getDefaultEventTypes', 'supportedEvents',
@@ -1992,9 +2432,6 @@ async function rnCrossPlatformEdges(queries, onYield) {
1992
2432
  const i = name.indexOf(':');
1993
2433
  return i >= 0 ? name.slice(0, i) : name;
1994
2434
  };
1995
- // Index native methods by their JS-visible (normalized) name. Only names with
1996
- // impls in ≥2 native languages can pair, so the per-method JS-caller check
1997
- // below only runs for genuine cross-platform candidates.
1998
2435
  const byName = new Map();
1999
2436
  for (const m of queries.iterateNodesByKindIn('method', [...NATIVE])) {
2000
2437
  if ((++scanned255 & 63) === 0)
@@ -2011,9 +2448,8 @@ async function rnCrossPlatformEdges(queries, onYield) {
2011
2448
  continue;
2012
2449
  const langs = new Set(group.map((m) => m.language));
2013
2450
  if (langs.size < 2)
2014
- continue; // single-platform — nothing to pair
2451
+ continue;
2015
2452
  for (const m of group) {
2016
- // Is m a bridge method? (a JS-language `calls` edge points at it)
2017
2453
  const incoming = queries.getIncomingEdges(m.id, ['calls']);
2018
2454
  if (incoming.length === 0)
2019
2455
  continue;
@@ -2024,7 +2460,6 @@ async function rnCrossPlatformEdges(queries, onYield) {
2024
2460
  });
2025
2461
  if (!isBridge)
2026
2462
  continue;
2027
- // Link to the other-platform impls (both directions).
2028
2463
  for (const sib of group) {
2029
2464
  if (sib.id === m.id || sib.language === m.language)
2030
2465
  continue;
@@ -2051,9 +2486,6 @@ async function fabricNativeImplEdges(ctx, onYield) {
2051
2486
  let scanned255 = 0;
2052
2487
  const edges = [];
2053
2488
  const seen = new Set();
2054
- // The Fabric extractor IDs are prefixed `fabric-component:` so we can
2055
- // filter to just those while streaming — never materializing the whole
2056
- // `component` kind (#1212).
2057
2489
  const components = [];
2058
2490
  for (const n of (ctx.iterateNodesByKind?.('component') ?? ctx.getNodesByKind('component'))) {
2059
2491
  if ((++scanned255 & 63) === 0)
@@ -2063,7 +2495,6 @@ async function fabricNativeImplEdges(ctx, onYield) {
2063
2495
  }
2064
2496
  if (components.length === 0)
2065
2497
  return edges;
2066
- // Pre-index native classes by name for O(1) lookup.
2067
2498
  const nativeClassesByName = new Map();
2068
2499
  for (const n of (ctx.iterateNodesByKind?.('class') ?? ctx.getNodesByKind('class'))) {
2069
2500
  if ((++scanned255 & 63) === 0)
@@ -2082,8 +2513,6 @@ async function fabricNativeImplEdges(ctx, onYield) {
2082
2513
  const matches = nativeClassesByName.get(candidate);
2083
2514
  if (!matches || matches.length === 0)
2084
2515
  continue;
2085
- // Link the component node to every matching native class (iOS +
2086
- // Android each have one).
2087
2516
  for (const native of matches) {
2088
2517
  const key = `${component.id}>${native.id}`;
2089
2518
  if (seen.has(key))
@@ -2105,30 +2534,10 @@ async function fabricNativeImplEdges(ctx, onYield) {
2105
2534
  }
2106
2535
  return edges;
2107
2536
  }
2108
- /**
2109
- * MyBatis: link a Java mapper interface method to the XML statement that holds
2110
- * its SQL. The XML extractor (`src/extraction/mybatis-extractor.ts`) qualifies
2111
- * each `<select|insert|update|delete|sql id="X">` as `<namespace>::<id>` where
2112
- * `<namespace>` is the Java FQN of the mapper interface. A Java method's
2113
- * qualifiedName ends with `<ClassName>::<methodName>`, so we suffix-match the
2114
- * last two segments of the XML qualified name to find a unique Java method by
2115
- * `<ClassName>::<methodName>` (`ClassName` = last dotted segment of the XML
2116
- * namespace). Cross-mapper `<include refid="other.X">` references go through
2117
- * the normal qualified-name resolver — only the Java↔XML bridge is synthetic.
2118
- *
2119
- * Precision over recall: ambiguous mappers (multiple Java classes with the
2120
- * same simple name) are dropped. We need-not bridge by package because Java
2121
- * mapper interfaces are typically uniquely named within a project.
2122
- */
2123
2537
  async function mybatisJavaXmlEdges(queries, onYield) {
2124
2538
  let scanned255 = 0;
2125
2539
  const edges = [];
2126
2540
  const seen = new Set();
2127
- // Collect the XML side FIRST (mapper `<select id=…>` statements extracted as
2128
- // xml-language method nodes): if the project has none — every Java+XML repo
2129
- // that doesn't use MyBatis — return before paying the full java-method
2130
- // stream below. Same rowid stream order as matching inline, so the edge
2131
- // output is byte-identical when mappers do exist.
2132
2541
  const xmlMethods = [];
2133
2542
  for (const m of queries.iterateNodesByKindIn('method', ['xml'])) {
2134
2543
  if ((++scanned255 & 63) === 0)
@@ -2137,7 +2546,6 @@ async function mybatisJavaXmlEdges(queries, onYield) {
2137
2546
  }
2138
2547
  if (xmlMethods.length === 0)
2139
2548
  return edges;
2140
- // Index Java methods by `<ClassName>::<methodName>` for O(1) lookup.
2141
2549
  const javaIndex = new Map();
2142
2550
  for (const m of queries.iterateNodesByKindIn('method', ['java', 'kotlin'])) {
2143
2551
  if ((++scanned255 & 63) === 0)
@@ -2157,7 +2565,6 @@ async function mybatisJavaXmlEdges(queries, onYield) {
2157
2565
  for (const xml of xmlMethods) {
2158
2566
  if ((++scanned255 & 63) === 0)
2159
2567
  await onYield();
2160
- // Qualified name: `<namespace>::<id>`. Extract the simple class name.
2161
2568
  const colonIdx = xml.qualifiedName.lastIndexOf('::');
2162
2569
  if (colonIdx < 0)
2163
2570
  continue;
@@ -2170,8 +2577,6 @@ async function mybatisJavaXmlEdges(queries, onYield) {
2170
2577
  const candidates = javaIndex.get(`${className}::${id}`);
2171
2578
  if (!candidates || candidates.length === 0)
2172
2579
  continue;
2173
- // Drop ambiguous matches (multiple same-name classes); the user can
2174
- // disambiguate by adding the package-suffix match in a future enhancement.
2175
2580
  if (candidates.length > 1)
2176
2581
  continue;
2177
2582
  const java = candidates[0];
@@ -2194,34 +2599,8 @@ async function mybatisJavaXmlEdges(queries, onYield) {
2194
2599
  }
2195
2600
  return edges;
2196
2601
  }
2197
- /**
2198
- * Gin middleware chain. Gin runs its entire handler chain through one dynamic
2199
- * line in `(*Context).Next`:
2200
- * for c.index < len(c.handlers) { c.handlers[c.index](c); c.index++ }
2201
- * `c.handlers` is a `HandlersChain` (`[]HandlerFunc`) assembled at registration
2202
- * time by `combineHandlers` from the funcs passed to `r.Use(...)` /
2203
- * `r.GET("/path", h...)` / `r.Handle(...)`. Because the call is a computed index
2204
- * into a runtime-built slice, tree-sitter resolves `c.handlers[c.index](c)` to
2205
- * NOTHING — so `callees(Next)` is just the `len()` helper and the flow
2206
- * `ServeHTTP → handleHTTPRequest → Next` dead-ends at the exact symbol the
2207
- * "how do requests flow through the middleware chain" question is about. The
2208
- * agent then re-queries Next and falls back to Read/grep (validated: the gin
2209
- * WITH-arm rabbit-holed on precisely this dead-end).
2210
- *
2211
- * Bridge it: find the chain DISPATCHER (a Go method whose body invokes a
2212
- * `handlers` slice by index) and link it → every HandlerFunc registered via a
2213
- * gin registration call, so `callees(Next)` and `trace(ServeHTTP, <handler>)`
2214
- * connect end-to-end. Named handlers only (`gin.Logger()` → `Logger`,
2215
- * `authMiddleware`); inline closures are anonymous and skipped. Like
2216
- * react-render / interface-impl this is a deliberate over-approximation —
2217
- * reachability-correct (any registered handler CAN run for some route), capped,
2218
- * and gated on the dispatcher existing so it never runs on non-gin Go repos.
2219
- * Provenance `heuristic`, `synthesizedBy:'gin-middleware-chain'`; `registeredAt`
2220
- * is the `.Use`/`.GET` site an agent would otherwise grep for.
2221
- */
2222
- const GIN_DISPATCH_RE = /\.handlers\s*\[[^\]]*\]\s*\(/; // c.handlers[c.index](c)
2602
+ const GIN_DISPATCH_RE = /\.handlers\s*\[[^\]]*\]\s*\(/;
2223
2603
  const GIN_REG_RE = /\.(?:Use|GET|POST|PUT|PATCH|DELETE|OPTIONS|HEAD|Any|Handle)\s*\(/g;
2224
- /** Balanced `(...)` body starting at the '(' index; null if unbalanced. */
2225
2604
  function goBalancedArgs(s, openIdx) {
2226
2605
  let depth = 0;
2227
2606
  for (let i = openIdx; i < s.length; i++) {
@@ -2236,7 +2615,6 @@ function goBalancedArgs(s, openIdx) {
2236
2615
  }
2237
2616
  return null;
2238
2617
  }
2239
- /** Split a top-level comma list, respecting nested () [] {}. */
2240
2618
  function goSplitArgs(args) {
2241
2619
  const out = [];
2242
2620
  let depth = 0, cur = '';
@@ -2260,9 +2638,8 @@ function goSplitArgs(args) {
2260
2638
  out.push(cur);
2261
2639
  return out;
2262
2640
  }
2263
- /** Tail ident of a handler arg: `gin.Logger()`→`Logger`, `mw`→`mw`; null for string paths / closures. */
2264
2641
  function goHandlerIdent(expr) {
2265
- const cleaned = expr.trim().replace(/\(\s*\)$/, ''); // drop a trailing call ()
2642
+ const cleaned = expr.trim().replace(/\(\s*\)$/, '');
2266
2643
  if (!cleaned || cleaned.startsWith('"') || cleaned.startsWith('`') || cleaned.startsWith('func'))
2267
2644
  return null;
2268
2645
  const m = cleaned.match(/(?:\.|^)([A-Za-z_]\w*)$/);
@@ -2271,7 +2648,6 @@ function goHandlerIdent(expr) {
2271
2648
  async function ginMiddlewareChainEdges(queries, ctx, onYield) {
2272
2649
  let scanned255 = 0;
2273
2650
  let scannedFiles = 0;
2274
- // 1. Find the chain dispatcher(s): a Go method that invokes a `handlers` slice by index.
2275
2651
  const dispatchers = [];
2276
2652
  for (const n of queries.iterateNodesByKindIn('method', ['go'])) {
2277
2653
  if ((++scanned255 & 63) === 0)
@@ -2282,11 +2658,8 @@ async function ginMiddlewareChainEdges(queries, ctx, onYield) {
2282
2658
  dispatchers.push(n);
2283
2659
  }
2284
2660
  if (dispatchers.length === 0)
2285
- return []; // not a gin repo — bail
2286
- // 2. Collect handler identifiers registered via gin registration calls
2287
- // (.Use / .GET / … / .Handle). String args (paths/methods) and inline
2288
- // closures are dropped by goHandlerIdent; the rest are HandlerFuncs.
2289
- const registered = new Map(); // name → registeredAt (file:line)
2661
+ return [];
2662
+ const registered = new Map();
2290
2663
  for (const file of ctx.getAllFiles()) {
2291
2664
  if ((++scannedFiles & 15) === 0)
2292
2665
  await onYield();
@@ -2303,7 +2676,7 @@ async function ginMiddlewareChainEdges(queries, ctx, onYield) {
2303
2676
  const argStr = goBalancedArgs(safe, parenIdx);
2304
2677
  if (!argStr)
2305
2678
  continue;
2306
- const line = safe.slice(0, m.index).split('\n').length;
2679
+ const line = lineOf(safe, m.index);
2307
2680
  for (const arg of goSplitArgs(argStr)) {
2308
2681
  const name = goHandlerIdent(arg);
2309
2682
  if (name && !registered.has(name))
@@ -2313,7 +2686,6 @@ async function ginMiddlewareChainEdges(queries, ctx, onYield) {
2313
2686
  }
2314
2687
  if (registered.size === 0)
2315
2688
  return [];
2316
- // 3. Link each dispatcher → each registered handler node (dedup, capped).
2317
2689
  const edges = [];
2318
2690
  const seen = new Set();
2319
2691
  for (const disp of dispatchers) {
@@ -2338,13 +2710,6 @@ async function ginMiddlewareChainEdges(queries, ctx, onYield) {
2338
2710
  }
2339
2711
  return edges;
2340
2712
  }
2341
- /**
2342
- * Delphi form code-behind: a form unit `UFRMAbout.pas` owns its visual form
2343
- * definition `UFRMAbout.dfm` (VCL) / `.fmx` (FireMonkey) — paired by basename in
2344
- * the same directory, wired by the `{$R *.dfm}` directive rather than a `uses`
2345
- * clause. Link the unit → its form so a `.dfm`/`.fmx` used only as a form
2346
- * definition isn't orphaned, and editing the form surfaces its code-behind unit.
2347
- */
2348
2713
  async function pascalFormEdges(ctx, onYield) {
2349
2714
  let scannedFiles = 0;
2350
2715
  const edges = [];
@@ -2372,21 +2737,6 @@ async function pascalFormEdges(ctx, onYield) {
2372
2737
  }
2373
2738
  return edges;
2374
2739
  }
2375
- /**
2376
- * SvelteKit file-convention data flow. A route directory's `+page.svelte` (a
2377
- * `component` node) receives its `data` from the sibling `+page.server.{ts,js}`
2378
- * / `+page.{ts,js}` `load` function and posts forms to its `actions` — wired by
2379
- * the framework BY FILE PATH, with no static import between them. So editing a
2380
- * `load` shows no impact on the page it feeds, and the page looks like it has no
2381
- * server-side dependency. Link the page component to its sibling loader's
2382
- * `load` / `actions` (same for `+layout`). The pairing is path-deterministic
2383
- * (same directory, matching `+page`/`+layout` prefix), so it's precise — but
2384
- * it's a framework-convention edge, so provenance stays `heuristic`.
2385
- *
2386
- * Direction: page → load, so `getImpactRadius(load)` surfaces the page (editing
2387
- * a loader's data shows the page it feeds) and the page's dependencies include
2388
- * its loader.
2389
- */
2390
2740
  async function svelteKitLoadEdges(ctx, onYield) {
2391
2741
  let scannedFiles = 0;
2392
2742
  const edges = [];
@@ -2409,10 +2759,6 @@ async function svelteKitLoadEdges(ctx, onYield) {
2409
2759
  if (!allFiles.has(loaderFile))
2410
2760
  continue;
2411
2761
  for (const hook of ctx.getNodesInFile(loaderFile)) {
2412
- // `load` and `actions` by name, and every function the loader file
2413
- // declares — a form action is an arrow inside `actions`, and it is a
2414
- // node of its own (`default`, `logout`), where the redirect that ends
2415
- // the submission is actually written.
2416
2762
  const named = HOOK_KINDS.has(hook.kind) && HOOKS.has(hook.name);
2417
2763
  if (!named && hook.kind !== 'function' && hook.kind !== 'method')
2418
2764
  continue;
@@ -2433,19 +2779,6 @@ async function svelteKitLoadEdges(ctx, onYield) {
2433
2779
  }
2434
2780
  return edges;
2435
2781
  }
2436
- /**
2437
- * Redux-thunk dispatch chain. `export const X = createAsyncThunk(prefix, async (a, api) => {...})`
2438
- * (or a wrapper like trezor's `createThunk(...)`) passes the async body as an ARGUMENT, so
2439
- * tree-sitter never extracts it as a function node: `X` is a `constant` whose body's calls are
2440
- * ORPHANED. The `dispatch(nextThunk(...))` calls that drive a thunk chain forward therefore produce
2441
- * no edges, so `callees(X)` is empty and a flow `dispatch(X(...)) → X → nextThunk` dead-ends at the
2442
- * constant (validated on trezor-suite: the signXxxThunk constants had ZERO outgoing edges). Bridge
2443
- * it: body-scan each thunk constant for `dispatch(Y(...))` and link `X → Y`, so the dispatch chain
2444
- * connects. High-precision — the `dispatch(` keyword plus `Y` must resolve to a function/constant/
2445
- * method node; capped; gated on thunk constants existing so it never runs on non-RTK repos.
2446
- * Cross-file by design (a suite thunk dispatches a wallet-core thunk). Provenance `heuristic`,
2447
- * `synthesizedBy:'redux-thunk'`; `registeredAt` is the dispatch site.
2448
- */
2449
2782
  const THUNK_DECL_RE = /create(?:Async)?Thunk/;
2450
2783
  const THUNK_DISPATCH_RE = /\bdispatch\s*\(\s*([A-Za-z_]\w*)\s*[(),]/g;
2451
2784
  const THUNK_FANOUT_CAP = 24;
@@ -2456,15 +2789,12 @@ async function reduxThunkEdges(queries, ctx, onYield) {
2456
2789
  for (const node of queries.iterateNodesByKind('constant')) {
2457
2790
  if ((++scanned255 & 63) === 0)
2458
2791
  await onYield();
2459
- // Cheap gate: the initializer (captured in `signature`) must be a create(Async)Thunk call —
2460
- // avoids reading every constant's body on a large repo.
2461
2792
  if (!node.signature || !THUNK_DECL_RE.test(node.signature))
2462
2793
  continue;
2463
2794
  const content = ctx.readFile(node.filePath);
2464
2795
  const src = content && sliceLines(content, node.startLine, node.endLine);
2465
2796
  if (!src)
2466
2797
  continue;
2467
- // Thunks are TS/JS-family (same // and /* */ comment syntax); map to a CommentLang.
2468
2798
  const safe = (0, strip_comments_1.stripCommentsForRegex)(src, node.language === 'javascript' || node.language === 'jsx' ? 'javascript' : 'typescript');
2469
2799
  THUNK_DISPATCH_RE.lastIndex = 0;
2470
2800
  let m;
@@ -2472,13 +2802,7 @@ async function reduxThunkEdges(queries, ctx, onYield) {
2472
2802
  while ((m = THUNK_DISPATCH_RE.exec(safe)) && added < THUNK_FANOUT_CAP) {
2473
2803
  const name = m[1];
2474
2804
  if (name === node.name)
2475
- continue; // self-dispatch (recursive thunk) — skip
2476
- // Resolve the dispatched name, PREFERRING the thunk/action-creator over a same-named
2477
- // service function. `dispatch(X(...))` dispatches a thunk or an action-creator (both
2478
- // `constant`s) — never an unrelated helper that merely shares the name. On octo-call,
2479
- // `leaveCall` is BOTH a `createAsyncThunk` const AND a service function, and the bare
2480
- // `.find()` picked the function (wrong). Order: thunk const > other const > same-file
2481
- // callable > first match. A single candidate (no collision) is unaffected.
2805
+ continue;
2482
2806
  const cands = ctx
2483
2807
  .getNodesByName(name)
2484
2808
  .filter((n) => n.kind === 'constant' || n.kind === 'function' || n.kind === 'method');
@@ -2492,7 +2816,7 @@ async function reduxThunkEdges(queries, ctx, onYield) {
2492
2816
  if (seen.has(key))
2493
2817
  continue;
2494
2818
  seen.add(key);
2495
- const line = node.startLine + safe.slice(0, m.index).split('\n').length - 1;
2819
+ const line = node.startLine + lineOf(safe, m.index) - 1;
2496
2820
  edges.push({
2497
2821
  source: node.id,
2498
2822
  target: target.id,
@@ -2506,36 +2830,16 @@ async function reduxThunkEdges(queries, ctx, onYield) {
2506
2830
  }
2507
2831
  return edges;
2508
2832
  }
2509
- // ── Object-literal registry dispatch ─────────────────────────────────────────
2510
- // A command/handler registry maps string keys → handler class/function symbols in an
2511
- // object literal, then dispatches by a RUNTIME key static parsing can't follow:
2512
- // this.commands = { [Cmd.ADD]: AddObjectCommand, ... } // registration
2513
- // new this.commands[command](args).execute() // dynamic dispatch
2514
- // Bridge it like gin-middleware-chain: link each dispatching function → each registered
2515
- // handler's callable entry (a class's execute/run/handle/… method — preferring the method
2516
- // chained at the dispatch site — or the function value). Scoped to a registry + dispatch in
2517
- // the SAME file (the cross-file barrel-namespace variant, e.g. trezor's getMethod, is
2518
- // deferred). Gated on a real object literal with ≥2 entries that RESOLVE to callables (a
2519
- // `{ width: 5 }` literal resolves to nothing → no edges); fan-out capped.
2520
- // Both scans only START a name at an identifier's first character (or at a `this.`): the
2521
- // engine otherwise retries the greedy name at every later character of every identifier in
2522
- // the file. A match found from inside an identifier always has one from the identifier's
2523
- // start (same name tail, same continuation), so the result is unchanged — except where the
2524
- // scan itself resumes mid-identifier after a dispatch ending in `.method`, which
2525
- // `nextRegistryDispatch` covers with the unguarded pattern.
2526
2833
  const REGISTRY_NAME_START = String.raw `(?:(?<![A-Za-z_$])(?<![A-Za-z_$][\w$]+)|(?=this\.))`;
2527
2834
  const REGISTRY_ASSIGN_RE = new RegExp(String.raw `(?:(?:const|let|var)\s+([A-Za-z_$][\w$]*)|${REGISTRY_NAME_START}((?:this\.)?[A-Za-z_$][\w$]*))\s*=\s*\{`, 'g');
2528
2835
  const REGISTRY_DISPATCH_SRC = String.raw `(?:\bnew\s+)?((?:this\.)?[A-Za-z_$][\w$]*)\s*\[\s*([A-Za-z_$][\w$.]*)\s*\]\s*(?:\(|\.[A-Za-z_$])`;
2529
2836
  const REGISTRY_DISPATCH_AT = new RegExp(REGISTRY_DISPATCH_SRC, 'y');
2530
- // `\bnew` can follow a `$` inside an identifier run, hence the extra `(?<!\w)` start.
2531
2837
  const REGISTRY_DISPATCH_RE = new RegExp(String.raw `(?:(?<!\w)|${REGISTRY_NAME_START})${REGISTRY_DISPATCH_SRC}`, 'g');
2532
2838
  const IDENT_RUN_CHAR = /[\w$]/;
2533
2839
  const REGISTRY_MIN_ENTRIES = 2;
2534
2840
  const REGISTRY_FANOUT_CAP = 40;
2535
2841
  const REGISTRY_CLASS_ENTRY = new Set(['execute', 'run', 'handle', 'perform', 'process', 'call', 'apply', 'dispatch']);
2536
2842
  const REGISTRY_JS_EXT = /\.(?:ts|tsx|js|jsx|mjs|cjs)$/;
2537
- /** The first registry dispatch at or after `from`, exactly as a `g` scan of the unguarded
2538
- * pattern resuming at `from` would find it. */
2539
2843
  function nextRegistryDispatch(src, from) {
2540
2844
  let at = from;
2541
2845
  if (at > 0 && at < src.length && IDENT_RUN_CHAR.test(src[at - 1]) && IDENT_RUN_CHAR.test(src[at])) {
@@ -2549,7 +2853,6 @@ function nextRegistryDispatch(src, from) {
2549
2853
  REGISTRY_DISPATCH_RE.lastIndex = at;
2550
2854
  return REGISTRY_DISPATCH_RE.exec(src);
2551
2855
  }
2552
- /** From the index of an opening `{`, return the brace-balanced body up to its matching `}`. */
2553
2856
  function braceBody(src, openIdx) {
2554
2857
  let depth = 0;
2555
2858
  for (let i = openIdx; i < src.length; i++) {
@@ -2560,11 +2863,6 @@ function braceBody(src, openIdx) {
2560
2863
  }
2561
2864
  return null;
2562
2865
  }
2563
- /** Top-level `key: Identifier` entries of an object-literal body. DEPTH-AWARE: only depth-0
2564
- * segments are considered, so method-shorthand bodies (`number(a,b){…}`), arrow values
2565
- * (`x: () => …`), and nested objects (`x: { … }`) don't leak their inner `k: v` pairs as
2566
- * bogus handlers. The per-segment anchor (`^… key: Ident …$`) keeps only pure identifier
2567
- * values — a data value (`x: 5`), call, or arrow fails to match. */
2568
2866
  function registryEntryNames(body) {
2569
2867
  const segs = [];
2570
2868
  let depth = 0;
@@ -2589,8 +2887,6 @@ function registryEntryNames(body) {
2589
2887
  }
2590
2888
  return names;
2591
2889
  }
2592
- /** Resolve a registered handler name to its callable entry: a function value, or a class's
2593
- * `execute`-like method (preferring the method chained at the dispatch site), else the class. */
2594
2890
  function resolveRegistryHandler(ctx, name, chained) {
2595
2891
  const cands = ctx.getNodesByName(name);
2596
2892
  const fn = cands.find((n) => n.kind === 'function');
@@ -2607,9 +2903,6 @@ function resolveRegistryHandler(ctx, name, chained) {
2607
2903
  methods.find((m) => m.name === 'constructor');
2608
2904
  return entry ?? cls;
2609
2905
  }
2610
- // Require a CALLABLE target — a registry dispatched as `reg[k](…)` invokes a function/
2611
- // method, never a data `constant` (dropping it removes false positives like a `{ x: URL }`
2612
- // entry resolving to the global URL constant).
2613
2906
  return cands.find((n) => n.kind === 'method') ?? null;
2614
2907
  }
2615
2908
  async function objectRegistryEdges(ctx, onYield) {
@@ -2621,22 +2914,16 @@ async function objectRegistryEdges(ctx, onYield) {
2621
2914
  if ((++scannedFiles & 15) === 0)
2622
2915
  await onYield();
2623
2916
  if ((++scanned & 255) === 0)
2624
- await onYield(); // #1091: yield mid-scan on huge graphs
2917
+ await onYield();
2625
2918
  if (!REGISTRY_JS_EXT.test(file))
2626
2919
  continue;
2627
2920
  const content = ctx.readFile(file);
2628
- // Cheap pre-filter: a computed member access BY NAME (`ident[ident`) — the dispatch shape.
2629
2921
  if (!content || !/[\w$]\s*\[\s*[A-Za-z_$]/.test(content))
2630
2922
  continue;
2631
- // Skip minified/generated bundles (draco, three.min, base64…): their pervasive `h[x](...)`
2632
- // calls + single-letter `{a:b}` literals are a false-positive minefield. Average line
2633
- // length is the reliable tell — real source ~30–80, minified in the hundreds/thousands.
2634
2923
  const newlines = (content.match(/\n/g)?.length ?? 0) + 1;
2635
2924
  if (content.length / newlines > 200)
2636
2925
  continue;
2637
2926
  const safe = (0, strip_comments_1.stripCommentsForRegex)(content, /\.(?:jsx?|mjs|cjs)$/.test(file) ? 'javascript' : 'typescript');
2638
- // 1. Dispatch sites: `(new )?<ref>[<ident-key>]` followed by a call or a chained method.
2639
- // A quoted-string key (`['save']`) does NOT match — that's a static access, not dispatch.
2640
2927
  const lineOf = (0, synth_utils_1.makeLineAt)(safe, 1);
2641
2928
  const dispatches = [];
2642
2929
  for (let dm = nextRegistryDispatch(safe, 0); dm; dm = nextRegistryDispatch(safe, dm.index + dm[0].length)) {
@@ -2646,11 +2933,8 @@ async function objectRegistryEdges(ctx, onYield) {
2646
2933
  }
2647
2934
  if (!dispatches.length)
2648
2935
  continue;
2649
- // Normalize a leading `this.` so a class FIELD-INITIALIZER registry (`commands = {…}`)
2650
- // matches a `this.commands[k]` dispatch, not just the constructor form `this.commands = {…}`.
2651
2936
  const norm = (r) => r.replace(/^this\./, '');
2652
2937
  const refs = new Set(dispatches.map((d) => norm(d.ref)));
2653
- // 2. Registries: an object literal assigned to a dispatched ref, ≥2 entries resolving to callables.
2654
2938
  REGISTRY_ASSIGN_RE.lastIndex = 0;
2655
2939
  const registries = new Map();
2656
2940
  let am;
@@ -2661,14 +2945,13 @@ async function objectRegistryEdges(ctx, onYield) {
2661
2945
  const body = braceBody(safe, am.index + am[0].length - 1);
2662
2946
  if (!body)
2663
2947
  continue;
2664
- const names = registryEntryNames(body); // depth-0 `key: Identifier` entries only
2948
+ const names = registryEntryNames(body);
2665
2949
  if (names.length >= REGISTRY_MIN_ENTRIES) {
2666
2950
  registries.set(lhs, { names, line: lineOf(am.index) });
2667
2951
  }
2668
2952
  }
2669
2953
  if (!registries.size)
2670
2954
  continue;
2671
- // 3. Link each dispatcher → each registered handler's callable entry.
2672
2955
  const nodesInFile = ctx.getNodesInFile(file);
2673
2956
  for (const d of dispatches) {
2674
2957
  const reg = registries.get(norm(d.ref));
@@ -2702,30 +2985,15 @@ async function objectRegistryEdges(ctx, onYield) {
2702
2985
  }
2703
2986
  return edges;
2704
2987
  }
2705
- // ── RTK Query generated-hook → endpoint ──────────────────────────────────────
2706
- // RTK Query generates one `useGetXQuery`/`useUpdateYMutation` hook per endpoint
2707
- // (`createApi({ endpoints: b => ({ getX: b.query(...) }) })`). Components call the
2708
- // hook; the fetch logic lives in the endpoint's queryFn. The hook↔endpoint link is
2709
- // pure NAMING CONVENTION (no static edge): strip `use` + the optional `Lazy`
2710
- // variant + the `Query|Mutation` suffix, lowercase the head → the endpoint key.
2711
- // Both are extracted as function nodes (the hook from its `export const {…}=api`
2712
- // binding, carrying a sentinel signature; the endpoint from the createApi object),
2713
- // so bridging hook→endpoint connects `component → useGetXQuery → getX → queryFn`.
2714
- // Gated on the extraction sentinel so it only ever fires on genuinely-generated
2715
- // hooks (never a hand-written `useFooQuery`), and on a SAME-FILE endpoint (RTK
2716
- // colocates the hooks and their api in one module) — 0 on any non-RTK repo.
2717
2988
  const RTK_HOOK_DERIVE_RE = /^use([A-Z][A-Za-z0-9]*?)(?:Query|Mutation)$/;
2718
- // MUST match the signature set in tree-sitter.ts `extractRtkHookBindings`.
2719
2989
  const RTK_GENERATED_HOOK_SIGNATURE = '= RTK Query generated hook';
2720
- /** Derive the endpoint key from a generated-hook name (`useLazyGetRecordsQuery`
2721
- * → `getRecords`), or null if it doesn't fit the convention. */
2722
2990
  function rtkEndpointNameFromHook(hook) {
2723
2991
  const m = RTK_HOOK_DERIVE_RE.exec(hook);
2724
2992
  if (!m)
2725
2993
  return null;
2726
2994
  let mid = m[1];
2727
2995
  if (mid.startsWith('Lazy'))
2728
- mid = mid.slice(4); // useLazyGetX → getX (same endpoint)
2996
+ mid = mid.slice(4);
2729
2997
  if (!mid)
2730
2998
  return null;
2731
2999
  return mid.charAt(0).toLowerCase() + mid.slice(1);
@@ -2737,14 +3005,11 @@ async function rtkQueryEdges(queries, ctx, onYield) {
2737
3005
  for (const hook of queries.iterateNodesByKind('function')) {
2738
3006
  if ((++scanned255 & 63) === 0)
2739
3007
  await onYield();
2740
- // Only our extracted generated-hook bindings (sentinel) — not a real hook fn.
2741
3008
  if (hook.signature !== RTK_GENERATED_HOOK_SIGNATURE)
2742
3009
  continue;
2743
3010
  const endpointName = rtkEndpointNameFromHook(hook.name);
2744
3011
  if (!endpointName)
2745
3012
  continue;
2746
- // The endpoint is a same-file function by the derived name (RTK colocates the
2747
- // api definition and its generated-hook exports in one module).
2748
3013
  const target = ctx
2749
3014
  .getNodesByName(endpointName)
2750
3015
  .find((n) => n.kind === 'function' && n.filePath === hook.filePath);
@@ -2765,16 +3030,6 @@ async function rtkQueryEdges(queries, ctx, onYield) {
2765
3030
  }
2766
3031
  return edges;
2767
3032
  }
2768
- // ── Pinia useStore().action() dispatch bridge ────────────────────────────────
2769
- // A Pinia store factory `export const useXStore = defineStore(...)` exposes its
2770
- // actions as methods on the store instance; a consumer does `const s = useXStore()`
2771
- // then `s.action()`. The call is a method-on-instance with no static edge to the
2772
- // action (which lives in the store's module). Bridge it: map each factory → its
2773
- // file, bind `const <var> = useXStore()` per consumer file, and link the enclosing
2774
- // function → the `<var>.method()` action node IN THE STORE'S FILE. The same-store-
2775
- // file gate keeps it precise (a Pinia built-in like `$patch` or an unrelated
2776
- // same-named method resolves to nothing). Covers both the options and setup store
2777
- // forms uniformly (the action is a function node in the store file either way).
2778
3033
  const PINIA_CONSUMER_EXT = /\.(?:ts|tsx|js|jsx|mjs|cjs|vue)$/;
2779
3034
  const PINIA_FACTORY_RE = /\b(?:export\s+)?const\s+(\w+)\s*=\s*defineStore\s*\(/g;
2780
3035
  const PINIA_BIND_RE = /\bconst\s+(\w+)\s*=\s*(?:await\s+)?(\w+)\s*\(/g;
@@ -2782,7 +3037,6 @@ const PINIA_CALL_RE = /(\w+)\s*\.\s*(\w+)\s*\(/g;
2782
3037
  const PINIA_FANOUT_CAP = 80;
2783
3038
  async function piniaStoreEdges(ctx, onYield) {
2784
3039
  let scannedFiles = 0;
2785
- // 1. Map each `const useXStore = defineStore(...)` factory → its store file.
2786
3040
  const factoryFile = new Map();
2787
3041
  for (const file of ctx.getAllFiles()) {
2788
3042
  if ((++scannedFiles & 15) === 0)
@@ -2810,7 +3064,6 @@ async function piniaStoreEdges(ctx, onYield) {
2810
3064
  if (!content || !content.includes('Store'))
2811
3065
  continue;
2812
3066
  const safe = (0, strip_comments_1.stripCommentsForRegex)(content, /\.(?:jsx?|mjs|cjs)$/.test(file) ? 'javascript' : 'typescript');
2813
- // 2. Bind store vars in this file: `const <var> = <known-factory>(...)`.
2814
3067
  const varStore = new Map();
2815
3068
  PINIA_BIND_RE.lastIndex = 0;
2816
3069
  let bm;
@@ -2821,9 +3074,8 @@ async function piniaStoreEdges(ctx, onYield) {
2821
3074
  }
2822
3075
  if (!varStore.size)
2823
3076
  continue;
2824
- // 3. Link `<var>.<method>(` → the action function node in the store's file.
2825
3077
  const nodesInFile = ctx.getNodesInFile(file);
2826
- const fallbackDispatcher = nodesInFile.find((n) => n.kind === 'component'); // .vue top-level setup
3078
+ const fallbackDispatcher = nodesInFile.find((n) => n.kind === 'component');
2827
3079
  PINIA_CALL_RE.lastIndex = 0;
2828
3080
  let cm;
2829
3081
  let added = 0;
@@ -2832,7 +3084,7 @@ async function piniaStoreEdges(ctx, onYield) {
2832
3084
  if (!storeFile)
2833
3085
  continue;
2834
3086
  const method = cm[2];
2835
- const line = safe.slice(0, cm.index).split('\n').length;
3087
+ const line = lineOf(safe, cm.index);
2836
3088
  const disp = (0, synth_utils_1.enclosingFn)(nodesInFile, line) ?? fallbackDispatcher;
2837
3089
  if (!disp)
2838
3090
  continue;
@@ -2858,28 +3110,18 @@ async function piniaStoreEdges(ctx, onYield) {
2858
3110
  }
2859
3111
  return edges;
2860
3112
  }
2861
- // ── Vuex string-keyed dispatch / commit bridge ───────────────────────────────
2862
- // Vuex dispatches actions/mutations by a runtime STRING key: `dispatch('user/login')`
2863
- // / `commit('SET_TOKEN')` / `this.$store.dispatch('app/toggleDevice')`. The action
2864
- // & mutation definitions are object-literal methods in store module files (now
2865
- // extracted as function nodes). Bridge the string key to its node: the LAST `/`
2866
- // segment is the action/mutation name; the preceding segment is the namespace
2867
- // (≈ the store module's file). Resolve the name to a function node IN A STORE FILE
2868
- // (the store-file gate excludes a same-named `api/` helper — `getInfo`/`login`
2869
- // commonly collide), disambiguated by the namespace appearing in the path (or, for
2870
- // a root key, the same file — Vuex's local-module `commit('M')` inside an action).
2871
- const VUEX_DISPATCH_RE = /\b(?:dispatch|commit)\s*\(\s*['"]([A-Za-z][\w/]*)['"]/g;
3113
+ const VUEX_DISPATCH_RE = /\b(dispatch|commit)\s*\(\s*['"]([A-Za-z][\w/]*)['"]/g;
2872
3114
  const VUEX_STORE_SIGNAL = /\bdefineStore\b|\bcreateStore\b|\bVuex\b|\bmutations\b|\bactions\b|\bgetters\b|\bnamespaced\b/g;
2873
3115
  const VUEX_FANOUT_CAP = 120;
2874
- /** A path segment (dir or filename stem) equals `seg` — `…/modules/user.js` has
2875
- * the segment `user` for namespace `user`. */
3116
+ const VUEX_COLLECTION_IMPORT = /\bimport\s+(?:actions|mutations|getters)\s+from\b/;
3117
+ const VUEX_COLLECTION_NAMES = new Set(['actions', 'mutations', 'getters']);
2876
3118
  function pathHasSegment(filePath, seg) {
2877
3119
  return new RegExp('[\\\\/]' + seg.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '[\\\\/.]').test(filePath);
2878
3120
  }
2879
3121
  async function vuexDispatchEdges(ctx, onYield) {
2880
3122
  let scannedFiles = 0;
2881
3123
  const storeFileCache = new Map();
2882
- const isStoreFile = (file) => {
3124
+ const hasStoreSignals = (file) => {
2883
3125
  let v = storeFileCache.get(file);
2884
3126
  if (v === undefined) {
2885
3127
  const c = ctx.readFile(file);
@@ -2898,18 +3140,50 @@ async function vuexDispatchEdges(ctx, onYield) {
2898
3140
  }
2899
3141
  return v;
2900
3142
  };
2901
- const resolve = (key, dispatchFile) => {
3143
+ let collectionFiles = null;
3144
+ const collectionOf = (file) => {
3145
+ if (collectionFiles === null) {
3146
+ collectionFiles = new Map();
3147
+ for (const store of ctx.getAllFiles()) {
3148
+ if (!PINIA_CONSUMER_EXT.test(store))
3149
+ continue;
3150
+ const c = ctx.readFile(store);
3151
+ if (!c || !VUEX_COLLECTION_IMPORT.test(c) || !hasStoreSignals(store))
3152
+ continue;
3153
+ const language = languageForJsxFile(store);
3154
+ for (const im of ctx.getImportMappings(store, language)) {
3155
+ if (!im.isDefault || !VUEX_COLLECTION_NAMES.has(im.localName))
3156
+ continue;
3157
+ const target = im.resolvedPath ?? (0, import_resolver_1.resolveImportPath)(im.source, store, language, ctx);
3158
+ if (target && !collectionFiles.has(target))
3159
+ collectionFiles.set(target, im.localName);
3160
+ }
3161
+ }
3162
+ }
3163
+ return collectionFiles.get(file);
3164
+ };
3165
+ const isStoreFile = (file) => hasStoreSignals(file) || collectionOf(file) !== undefined;
3166
+ const collectionHolding = (n) => {
3167
+ const cut = n.qualifiedName.lastIndexOf('::');
3168
+ const owner = cut < 0 ? '' : n.qualifiedName.slice(0, cut);
3169
+ return VUEX_COLLECTION_NAMES.has(owner) ? owner : collectionOf(n.filePath);
3170
+ };
3171
+ const resolve = (verb, key, dispatchFile) => {
2902
3172
  const segs = key.split('/');
2903
3173
  const action = segs[segs.length - 1];
2904
- const cands = ctx.getNodesByName(action).filter((n) => n.kind === 'function' && isStoreFile(n.filePath));
3174
+ const runs = verb === 'commit' ? 'mutations' : 'actions';
3175
+ const cands = ctx.getNodesByName(action).filter((n) => {
3176
+ if (n.kind !== 'function' || !isStoreFile(n.filePath))
3177
+ return false;
3178
+ const holder = collectionHolding(n);
3179
+ return holder === undefined || holder === runs;
3180
+ });
2905
3181
  if (!cands.length)
2906
3182
  return null;
2907
3183
  if (segs.length > 1) {
2908
- const mod = segs[segs.length - 2]; // immediate namespace ≈ the module file
3184
+ const mod = segs[segs.length - 2];
2909
3185
  return cands.find((c) => pathHasSegment(c.filePath, mod)) ?? (cands.length === 1 ? cands[0] : null);
2910
3186
  }
2911
- // Root key: a local `commit('M')` inside an action targets the same module file;
2912
- // otherwise accept only an unambiguous single store-wide match.
2913
3187
  return cands.find((c) => c.filePath === dispatchFile) ?? (cands.length === 1 ? cands[0] : null);
2914
3188
  };
2915
3189
  const edges = [];
@@ -2924,17 +3198,17 @@ async function vuexDispatchEdges(ctx, onYield) {
2924
3198
  continue;
2925
3199
  const safe = (0, strip_comments_1.stripCommentsForRegex)(content, /\.(?:jsx?|mjs|cjs)$/.test(file) ? 'javascript' : 'typescript');
2926
3200
  const nodesInFile = ctx.getNodesInFile(file);
2927
- const fallback = nodesInFile.find((n) => n.kind === 'component'); // .vue top-level
3201
+ const fallback = nodesInFile.find((n) => n.kind === 'component');
2928
3202
  VUEX_DISPATCH_RE.lastIndex = 0;
2929
3203
  let m;
2930
3204
  let added = 0;
2931
3205
  while ((m = VUEX_DISPATCH_RE.exec(safe)) && added < VUEX_FANOUT_CAP) {
2932
- const key = m[1];
2933
- const line = safe.slice(0, m.index).split('\n').length;
3206
+ const key = m[2];
3207
+ const line = lineOf(safe, m.index);
2934
3208
  const disp = (0, synth_utils_1.enclosingFn)(nodesInFile, line) ?? fallback;
2935
3209
  if (!disp)
2936
3210
  continue;
2937
- const target = resolve(key, file);
3211
+ const target = resolve(m[1], key, file);
2938
3212
  if (!target || target.id === disp.id)
2939
3213
  continue;
2940
3214
  const edgeKey = `${disp.id}>${target.id}`;
@@ -2954,33 +3228,13 @@ async function vuexDispatchEdges(ctx, onYield) {
2954
3228
  }
2955
3229
  return edges;
2956
3230
  }
2957
- // ── Celery task dispatch (Python) ─────────────────────────────────────────────
2958
- // Celery decouples a task's call site from its body through async dispatch:
2959
- // # tasks.py
2960
- // @shared_task # also @app.task / @celery_app.task / @<app>.task / @task
2961
- // def process(account_ids): ...
2962
- // # views.py — a DIFFERENT module
2963
- // process.apply_async(kwargs={...}) # or process.delay(...) — dynamic, no static edge
2964
- // Bridge it: link the enclosing function/method at each `.delay(`/`.apply_async(` site → the
2965
- // task function body. Precision rests on the DECORATOR gate — the dispatched name must resolve
2966
- // to a Python function carrying a celery task decorator (read from the source lines above its
2967
- // `def`, since the def's own startLine excludes the decorator). A `.delay()` on a non-task
2968
- // object resolves to no task node → no edge, so a Celery-free repo yields 0. Same-file /
2969
- // unique-candidate disambiguation like vuex. (Canvas forms — `group(t).delay()`, `t.s()`/`.si()`
2970
- // — have no single identifier before `.delay`/`.apply_async`, so they're skipped, not mis-bridged.)
2971
3231
  const CELERY_DISPATCH_RE = /\b([A-Za-z_]\w*)\s*\.\s*(?:delay|apply_async)\s*\(/g;
2972
- // A task decorator: bare `@shared_task`/`@task` or attribute `@app.task`/`@celery_app.task`,
2973
- // each optionally called with args. `\b`-bounded and `@`-anchored so `@mytask`, or a symbol
2974
- // merely named `task`, can't match. No `/g`, so `.test()` is stateless across reuse.
2975
3232
  const CELERY_TASK_DECORATOR_RE = /@\s*(?:[A-Za-z_][\w.]*\.)?(?:shared_task|task)\b/;
2976
3233
  const CELERY_PY_EXT = /\.py$/;
2977
3234
  const CELERY_FANOUT_CAP = 80;
2978
- const CELERY_DECORATOR_LOOKBACK = 12; // max lines above a `def` to scan for its decorators
3235
+ const CELERY_DECORATOR_LOOKBACK = 12;
2979
3236
  async function celeryDispatchEdges(ctx, onYield) {
2980
3237
  let scannedFiles = 0;
2981
- // Memoize the decorator check per task-candidate node: it reads the file and scans a few
2982
- // lines above the def. Only called on names that are actually `.delay`/`.apply_async`
2983
- // receivers, so the candidate set stays small.
2984
3238
  const taskCache = new Map();
2985
3239
  const isCeleryTask = (node) => {
2986
3240
  let v = taskCache.get(node.id);
@@ -2991,13 +3245,11 @@ async function celeryDispatchEdges(ctx, onYield) {
2991
3245
  const content = ctx.readFile(node.filePath);
2992
3246
  if (content) {
2993
3247
  const lines = content.split('\n');
2994
- // startLine is the `def` line (decorators sit ABOVE it). Walk upward, stopping at the
2995
- // previous declaration so a non-task def can never inherit the prior def's decorator.
2996
3248
  const stop = Math.max(0, node.startLine - 1 - CELERY_DECORATOR_LOOKBACK);
2997
3249
  for (let i = node.startLine - 2; i >= stop; i--) {
2998
3250
  const t = (lines[i] ?? '').trim();
2999
3251
  if (/^(?:async\s+def|def|class)\b/.test(t))
3000
- break; // previous decl → stop
3252
+ break;
3001
3253
  if (CELERY_TASK_DECORATOR_RE.test(t)) {
3002
3254
  v = true;
3003
3255
  break;
@@ -3014,8 +3266,6 @@ async function celeryDispatchEdges(ctx, onYield) {
3014
3266
  return null;
3015
3267
  if (cands.length === 1)
3016
3268
  return cands[0];
3017
- // Cross-module name collision: prefer a task defined in the dispatching file, else bail
3018
- // (ambiguous — precision over recall, like vuex's root-key resolution).
3019
3269
  return cands.find((c) => c.filePath === dispatchFile) ?? null;
3020
3270
  };
3021
3271
  const edges = [];
@@ -3035,10 +3285,10 @@ async function celeryDispatchEdges(ctx, onYield) {
3035
3285
  let added = 0;
3036
3286
  while ((m = CELERY_DISPATCH_RE.exec(safe)) && added < CELERY_FANOUT_CAP) {
3037
3287
  const name = m[1];
3038
- const line = safe.slice(0, m.index).split('\n').length;
3288
+ const line = lineOf(safe, m.index);
3039
3289
  const disp = (0, synth_utils_1.enclosingFn)(nodesInFile, line);
3040
3290
  if (!disp)
3041
- continue; // module-level dispatch — no source symbol to attribute
3291
+ continue;
3042
3292
  const target = resolve(name, file);
3043
3293
  if (!target || target.id === disp.id)
3044
3294
  continue;
@@ -3059,31 +3309,12 @@ async function celeryDispatchEdges(ctx, onYield) {
3059
3309
  }
3060
3310
  return edges;
3061
3311
  }
3062
- // ── Spring application events (Java) ──────────────────────────────────────────
3063
- // Spring decouples an event PUBLISHER from its LISTENER(s) through the application
3064
- // event bus, linked by the EVENT TYPE (not a name):
3065
- // // SomeService.java
3066
- // eventPublisher.publishEvent(new PasswordChangedEvent(this, username)); // publish
3067
- // // RememberMeTokenRevoker.java — a DIFFERENT file
3068
- // @EventListener(PasswordChangedEvent.class) // listen
3069
- // public void onPasswordChanged(PasswordChangedEvent event) { ... }
3070
- // Bridge it: link the enclosing method at each `publishEvent(new XEvent(...))` site →
3071
- // every listener method of XEvent. Listeners are `@EventListener` / `@TransactionalEventListener`
3072
- // methods (event type = the first param type, or the `@EventListener(X.class)` value form) and
3073
- // the older `class … implements ApplicationListener<X> { void onApplicationEvent(X e) }`. Keyed
3074
- // by exact type name, usually cross-file. A repo with no `@EventListener`/`publishEvent` yields 0.
3075
- // (Java method nodes INCLUDE their leading annotations in the range — startLine is the first
3076
- // `@…` line — so the annotation block is scanned DOWNWARD from startLine, bounded to consecutive
3077
- // `@`-lines so it can't bleed into an adjacent method.)
3078
3312
  const SPRING_PUBLISH_RE = /\.publishEvent\s*\(\s*new\s+([A-Z][A-Za-z0-9_]*)/g;
3079
3313
  const SPRING_LISTENER_ANNO_RE = /@(?:EventListener|TransactionalEventListener)\b/;
3080
3314
  const SPRING_ANNO_TYPE_RE = /@(?:EventListener|TransactionalEventListener)\s*\(\s*([A-Z][A-Za-z0-9_]*)\.class/;
3081
3315
  const SPRING_APP_LISTENER_RE = /\bApplicationListener\s*</;
3082
3316
  const SPRING_JAVA_EXT = /\.java$/;
3083
3317
  const SPRING_FANOUT_CAP = 80;
3084
- /** The first parameter's type from a Java method `signature` (`"void (XEvent e)"` → `XEvent`).
3085
- * Skips a leading `final`/`@Anno`, strips generics, and requires a PascalCase class name (event
3086
- * types are classes) — so a no-arg or primitive-param method yields null. */
3087
3318
  function springFirstParamType(sig) {
3088
3319
  if (!sig)
3089
3320
  return null;
@@ -3097,16 +3328,12 @@ function springFirstParamType(sig) {
3097
3328
  const first = inner.split(',')[0].trim();
3098
3329
  const toks = first.split(/\s+/).filter((t) => t && t !== 'final' && !t.startsWith('@'));
3099
3330
  if (toks.length < 2)
3100
- return null; // need `Type name`
3101
- const type = toks[toks.length - 2].replace(/<.*$/, ''); // drop generic args
3331
+ return null;
3332
+ const type = toks[toks.length - 2].replace(/<.*$/, '');
3102
3333
  return /^[A-Z][A-Za-z0-9_]*$/.test(type) ? type : null;
3103
3334
  }
3104
3335
  async function springEventEdges(ctx, onYield) {
3105
3336
  let scannedFiles = 0;
3106
- // Pass 1 — event-type → listener methods, scanning only event-relevant files.
3107
- // This is the ONLY full read sweep: publisher files are recorded here so
3108
- // pass 2 re-reads just those instead of every .java file again (#1212 —
3109
- // the double full-repo read was one of the tail's longest unyielded spans).
3110
3337
  const listeners = new Map();
3111
3338
  const publisherFiles = [];
3112
3339
  for (const file of ctx.getAllFiles()) {
@@ -3127,12 +3354,11 @@ async function springEventEdges(ctx, onYield) {
3127
3354
  for (const node of ctx.getNodesInFile(file)) {
3128
3355
  if (node.kind !== 'method')
3129
3356
  continue;
3130
- // Collect this method's own leading annotation block (consecutive `@`-lines from startLine).
3131
3357
  const annoLines = [];
3132
3358
  for (let i = node.startLine - 1; i < lines.length && i < node.startLine + 7; i++) {
3133
3359
  const t = (lines[i] ?? '').trim();
3134
3360
  if (!t.startsWith('@'))
3135
- break; // reached the declaration → stop (no bleed into next method)
3361
+ break;
3136
3362
  annoLines.push(t);
3137
3363
  }
3138
3364
  const head = annoLines.join('\n');
@@ -3158,8 +3384,6 @@ async function springEventEdges(ctx, onYield) {
3158
3384
  }
3159
3385
  if (!listeners.size)
3160
3386
  return [];
3161
- // Pass 2 — link each publishEvent(new XEvent(...)) site → every listener of
3162
- // XEvent. Only the publisher files recorded in pass 1 are (re-)read.
3163
3387
  const edges = [];
3164
3388
  const seen = new Set();
3165
3389
  for (const file of publisherFiles) {
@@ -3177,7 +3401,7 @@ async function springEventEdges(ctx, onYield) {
3177
3401
  const targets = listeners.get(m[1]);
3178
3402
  if (!targets || !targets.length)
3179
3403
  continue;
3180
- const line = safe.slice(0, m.index).split('\n').length;
3404
+ const line = lineOf(safe, m.index);
3181
3405
  const disp = (0, synth_utils_1.enclosingFn)(nodesInFile, line);
3182
3406
  if (!disp)
3183
3407
  continue;
@@ -3202,31 +3426,50 @@ async function springEventEdges(ctx, onYield) {
3202
3426
  }
3203
3427
  return edges;
3204
3428
  }
3205
- // ── MediatR request/notification dispatch (C#/.NET) ───────────────────────────
3206
- // MediatR decouples a Send/Publish call site from its Handle method through a mediator,
3207
- // linked by the request/notification TYPE (the IRequestHandler<T,…> generic):
3208
- // // CancelOrderCommandHandler.cs — the handler
3209
- // public class CancelOrderCommandHandler : IRequestHandler<CancelOrderCommand, bool> {
3210
- // public async Task<bool> Handle(CancelOrderCommand request, CancellationToken ct) { … }
3211
- // // some controller — the dispatch (usually a DIFFERENT file)
3212
- // var command = new CancelOrderCommand(orderId); await _mediator.Send(command);
3213
- // Bridge it: link the enclosing method at each mediator `.Send(x)`/`.Publish(x)` site → the
3214
- // `Handle` method of the handler for x's type. The sent type is resolved from the argument —
3215
- // inline `new X(…)`, a local `var v = new X(…)`, or a parameter/local declared `X v` — bounded
3216
- // to the enclosing method. Precision rests on TWO gates: the receiver must be mediator-ish
3217
- // (`mediator`/`sender`/`publisher`, so MAUI `MessagingCenter.Send` is ignored) AND the resolved
3218
- // type must be a known handler request type (so a same-named non-request DTO is never bridged).
3219
- // C# has no `signature` on method nodes, so the handler's request type is read from the class
3220
- // base-list source (`: IRequestHandler<X,…>`), not a param signature.
3221
3429
  const MEDIATR_HANDLER_BASE_RE = /(?:IRequestHandler|INotificationHandler)\s*<\s*([A-Za-z_]\w*)/;
3222
- const MEDIATR_DISPATCH_RE = /([A-Za-z_][\w.]*)\s*\.\s*(?:Send|Publish)\s*\(\s*(new\s+[A-Z]\w*|[A-Za-z_]\w*)/g;
3430
+ const MEDIATR_DISPATCH_RE = /([A-Za-z_][\w.]*)\s*\.\s*(Send|Publish)\s*\(\s*(new\s+[A-Z]\w*|[A-Za-z_]\w*)/g;
3223
3431
  const MEDIATR_RECEIVER_RE = /(?:mediator|sender|publisher)/i;
3224
3432
  const MEDIATR_CS_EXT = /\.cs$/;
3225
3433
  const MEDIATR_FANOUT_CAP = 80;
3226
- const MEDIATR_HANDLER_DECL_LOOKAHEAD = 4; // lines from a class startLine to find a wrapped base list
3227
- /** The type sent at a MediatR `.Send(arg)`/`.Publish(arg)` site: an inline `new X(…)`, else
3228
- * `arg` as an identifier resolved within the enclosing method — a `… arg = new X(…)` assignment
3229
- * (wins), or a parameter/local declared `X arg`. Returns null when the type can't be seen. */
3434
+ const MEDIATR_HANDLER_DECL_LOOKAHEAD = 4;
3435
+ const MEDIATR_CLASS_HEAD_LINES = 16;
3436
+ const MEDIATR_HANDLE_FIRST_PARAM_RE = /\bHandle\s*\(\s*(?:\[[^\]]*\]\s*)?(?:[A-Za-z_]\w*\.)*([A-Za-z_]\w*)/;
3437
+ function sharedFolders(a, b) {
3438
+ const left = a.split('/');
3439
+ const right = b.split('/');
3440
+ let n = 0;
3441
+ while (n < left.length - 1 && n < right.length - 1 && left[n] === right[n])
3442
+ n++;
3443
+ return n;
3444
+ }
3445
+ function reachableHandlers(targets, file, verb) {
3446
+ if (targets.length < 2)
3447
+ return targets;
3448
+ const shared = targets.map((t) => sharedFolders(file, t.filePath));
3449
+ const best = Math.max(...shared);
3450
+ if (verb === 'Send')
3451
+ return targets.filter((_, i) => shared[i] === best);
3452
+ return best > 0 ? targets.filter((_, i) => shared[i] > 0) : targets;
3453
+ }
3454
+ function mediatrBaseListTypes(lines, classStart) {
3455
+ const head = lines.slice(classStart - 1, classStart - 1 + MEDIATR_CLASS_HEAD_LINES).join('\n');
3456
+ const open = head.indexOf('{');
3457
+ const text = (open >= 0 ? head.slice(0, open) : head).replace(/\([^()]*(?:\([^()]*\)[^()]*)*\)/g, ' ');
3458
+ const colon = text.indexOf(':');
3459
+ const types = new Set();
3460
+ if (colon < 0)
3461
+ return types;
3462
+ const own = /<([^<>]*)>/.exec(text.slice(0, colon))?.[1]?.split(',').map((t) => t.trim()) ?? [];
3463
+ for (const m of text.slice(colon + 1).matchAll(/[<,]\s*(?:[A-Za-z_]\w*\.)*([A-Za-z_]\w*)/g)) {
3464
+ if (!own.includes(m[1]))
3465
+ types.add(m[1]);
3466
+ }
3467
+ return types;
3468
+ }
3469
+ function mediatrHandledType(lines, handle) {
3470
+ const head = lines.slice(handle.startLine - 1, handle.startLine + 2).join(' ');
3471
+ return MEDIATR_HANDLE_FIRST_PARAM_RE.exec(head)?.[1] ?? null;
3472
+ }
3230
3473
  function resolveMediatrArgType(arg, lines, methodStart, dispatchLine) {
3231
3474
  const inl = /^new\s+([A-Z]\w*)/.exec(arg);
3232
3475
  if (inl)
@@ -3234,24 +3477,55 @@ function resolveMediatrArgType(arg, lines, methodStart, dispatchLine) {
3234
3477
  if (!/^[A-Za-z_]\w*$/.test(arg))
3235
3478
  return null;
3236
3479
  const assignRe = new RegExp(`\\b${arg}\\b\\s*=\\s*new\\s+([A-Z]\\w*)`);
3480
+ const mappedRe = new RegExp(`\\b${arg}\\b\\s*=[^;]*?\\.\\s*\\w+<(?:[^<>;]*,\\s*)?(?:\\w+\\.)*([A-Z]\\w*)>\\s*\\(`);
3237
3481
  const declRe = new RegExp(`\\b([A-Z]\\w*)\\b\\s+${arg}\\b`);
3238
3482
  let declType = null;
3239
3483
  for (let i = Math.max(0, methodStart - 1); i < dispatchLine && i < lines.length; i++) {
3240
3484
  const ln = lines[i] ?? '';
3241
3485
  const a = assignRe.exec(ln);
3242
3486
  if (a)
3243
- return a[1]; // an explicit `arg = new X` is the most specific — take it
3487
+ return a[1];
3488
+ const mapped = mappedRe.exec(ln);
3489
+ if (mapped)
3490
+ return mapped[1];
3244
3491
  if (!declType) {
3245
3492
  const d = declRe.exec(ln);
3246
3493
  if (d)
3247
- declType = d[1]; // a `X arg` declaration — remember, but keep scanning for an assignment
3494
+ declType = d[1];
3248
3495
  }
3249
3496
  }
3250
3497
  return declType;
3251
3498
  }
3252
3499
  async function mediatrDispatchEdges(ctx, onYield) {
3253
3500
  let scannedFiles = 0;
3254
- // Pass 1 — request/notification type → the Handle method of each handler class.
3501
+ const sites = [];
3502
+ for (const file of ctx.getAllFiles()) {
3503
+ if ((++scannedFiles & 15) === 0)
3504
+ await onYield();
3505
+ if (!MEDIATR_CS_EXT.test(file))
3506
+ continue;
3507
+ const content = ctx.readFile(file);
3508
+ if (!content || (!content.includes('.Send(') && !content.includes('.Publish(')))
3509
+ continue;
3510
+ const safe = (0, strip_comments_1.stripCommentsForRegex)(content, 'csharp');
3511
+ const safeLines = safe.split('\n');
3512
+ const nodesInFile = ctx.getNodesInFile(file);
3513
+ MEDIATR_DISPATCH_RE.lastIndex = 0;
3514
+ let m;
3515
+ while ((m = MEDIATR_DISPATCH_RE.exec(safe))) {
3516
+ if (!MEDIATR_RECEIVER_RE.test(m[1]))
3517
+ continue;
3518
+ const line = lineOf(safe, m.index);
3519
+ const from = (0, synth_utils_1.enclosingFn)(nodesInFile, line);
3520
+ if (!from)
3521
+ continue;
3522
+ const type = resolveMediatrArgType(m[3], safeLines, from.startLine, line);
3523
+ if (type)
3524
+ sites.push({ file, line, verb: m[2], type, from });
3525
+ }
3526
+ }
3527
+ if (!sites.length)
3528
+ return [];
3255
3529
  const handlers = new Map();
3256
3530
  for (const file of ctx.getAllFiles()) {
3257
3531
  if ((++scannedFiles & 15) === 0)
@@ -3259,105 +3533,79 @@ async function mediatrDispatchEdges(ctx, onYield) {
3259
3533
  if (!MEDIATR_CS_EXT.test(file))
3260
3534
  continue;
3261
3535
  const content = ctx.readFile(file);
3262
- if (!content || (!content.includes('IRequestHandler<') && !content.includes('INotificationHandler<')))
3536
+ if (!content || !content.includes('Handle('))
3263
3537
  continue;
3264
3538
  const lines = content.split('\n');
3265
3539
  const nodesInFile = ctx.getNodesInFile(file);
3540
+ const handleMethods = nodesInFile.filter((n) => n.kind === 'method' && n.name === 'Handle');
3541
+ if (handleMethods.length === 0)
3542
+ continue;
3543
+ const addHandler = (type, handle) => {
3544
+ const known = handlers.get(type);
3545
+ if (!known)
3546
+ handlers.set(type, [handle]);
3547
+ else if (!known.includes(handle))
3548
+ known.push(handle);
3549
+ };
3266
3550
  for (const cls of nodesInFile) {
3267
3551
  if (cls.kind !== 'class')
3268
3552
  continue;
3269
- const decl = lines.slice(cls.startLine - 1, cls.startLine - 1 + MEDIATR_HANDLER_DECL_LOOKAHEAD).join('\n');
3270
- const m = MEDIATR_HANDLER_BASE_RE.exec(decl);
3271
- if (!m)
3272
- continue;
3273
- const type = m[1];
3274
3553
  const end = cls.endLine ?? cls.startLine;
3275
- const handle = nodesInFile.find((n) => n.kind === 'method' && n.name === 'Handle' && n.startLine >= cls.startLine && n.startLine <= end);
3276
- if (!handle)
3554
+ const handles = handleMethods.filter((n) => n.startLine >= cls.startLine && n.startLine <= end);
3555
+ if (handles.length === 0)
3277
3556
  continue;
3278
- let arr = handlers.get(type);
3279
- if (!arr) {
3280
- arr = [];
3281
- handlers.set(type, arr);
3557
+ const lookahead = lines.slice(cls.startLine - 1, cls.startLine - 1 + MEDIATR_HANDLER_DECL_LOOKAHEAD).join('\n');
3558
+ const decl = lookahead.split('{', 1)[0];
3559
+ const m = MEDIATR_HANDLER_BASE_RE.exec(decl);
3560
+ if (m)
3561
+ addHandler(m[1], handles[0]);
3562
+ const baseTypes = mediatrBaseListTypes(lines, cls.startLine);
3563
+ for (const handle of handles) {
3564
+ const type = mediatrHandledType(lines, handle);
3565
+ if (type && baseTypes.has(type))
3566
+ addHandler(type, handle);
3282
3567
  }
3283
- arr.push(handle);
3284
3568
  }
3285
3569
  }
3286
3570
  if (!handlers.size)
3287
3571
  return [];
3288
- // Pass 2 — link each mediator-ish .Send(x)/.Publish(x) → the handler of x's type.
3289
3572
  const edges = [];
3290
3573
  const seen = new Set();
3291
- for (const file of ctx.getAllFiles()) {
3292
- if ((++scannedFiles & 15) === 0)
3293
- await onYield();
3294
- if (!MEDIATR_CS_EXT.test(file))
3574
+ const addedPerFile = new Map();
3575
+ for (const { file, line, verb, type, from } of sites) {
3576
+ const targets = handlers.get(type);
3577
+ if (!targets)
3295
3578
  continue;
3296
- const content = ctx.readFile(file);
3297
- if (!content || (!content.includes('.Send(') && !content.includes('.Publish(')))
3579
+ let added = addedPerFile.get(file) ?? 0;
3580
+ if (added >= MEDIATR_FANOUT_CAP)
3298
3581
  continue;
3299
- const safe = (0, strip_comments_1.stripCommentsForRegex)(content, 'csharp');
3300
- const safeLines = safe.split('\n');
3301
- const nodesInFile = ctx.getNodesInFile(file);
3302
- MEDIATR_DISPATCH_RE.lastIndex = 0;
3303
- let m;
3304
- let added = 0;
3305
- while ((m = MEDIATR_DISPATCH_RE.exec(safe)) && added < MEDIATR_FANOUT_CAP) {
3306
- if (!MEDIATR_RECEIVER_RE.test(m[1]))
3307
- continue; // not a mediator (MessagingCenter, HttpClient, …)
3308
- const line = safe.slice(0, m.index).split('\n').length;
3309
- const disp = (0, synth_utils_1.enclosingFn)(nodesInFile, line);
3310
- if (!disp)
3582
+ for (const target of reachableHandlers(targets, file, verb)) {
3583
+ if (target.id === from.id)
3311
3584
  continue;
3312
- const type = resolveMediatrArgType(m[2], safeLines, disp.startLine, line);
3313
- if (!type)
3314
- continue;
3315
- const targets = handlers.get(type);
3316
- if (!targets)
3585
+ const key = `${from.id}>${target.id}`;
3586
+ if (seen.has(key))
3317
3587
  continue;
3318
- for (const target of targets) {
3319
- if (target.id === disp.id)
3320
- continue;
3321
- const key = `${disp.id}>${target.id}`;
3322
- if (seen.has(key))
3323
- continue;
3324
- seen.add(key);
3325
- edges.push({
3326
- source: disp.id,
3327
- target: target.id,
3328
- kind: 'calls',
3329
- line,
3330
- provenance: 'heuristic',
3331
- metadata: { synthesizedBy: 'mediatr-dispatch', via: type, registeredAt: `${file}:${line}` },
3332
- });
3333
- added++;
3334
- }
3588
+ seen.add(key);
3589
+ edges.push({
3590
+ source: from.id,
3591
+ target: target.id,
3592
+ kind: 'calls',
3593
+ line,
3594
+ provenance: 'heuristic',
3595
+ metadata: { synthesizedBy: 'mediatr-dispatch', via: type, registeredAt: `${file}:${line}` },
3596
+ });
3597
+ added++;
3335
3598
  }
3599
+ addedPerFile.set(file, added);
3336
3600
  }
3337
3601
  return edges;
3338
3602
  }
3339
- // ── Sidekiq job dispatch (Ruby) ───────────────────────────────────────────────
3340
- // Sidekiq decouples a job's enqueue site from the worker's `perform`, linked by the WORKER
3341
- // CLASS NAME:
3342
- // # app/workers/destroy_user_worker.rb
3343
- // class DestroyUserWorker
3344
- // include Sidekiq::Worker # or Sidekiq::Job (the modern alias)
3345
- // def perform(user_id) … end
3346
- // # app/services/… — a DIFFERENT file
3347
- // DestroyUserWorker.perform_async(user.id) # also .perform_in(t, …) / .perform_at(t, …)
3348
- // Bridge it: link the enclosing method at each `Worker.perform_async/_in/_at(…)` site → that
3349
- // worker's instance `perform`. Name-keyed (like Celery): the receiver class must be a Sidekiq
3350
- // worker — gated by reading `include Sidekiq::Job|Worker` from the class body, since that mixin
3351
- // is an external gem module that forms no resolvable edge. ActiveJob's `perform_later`/`_now` is
3352
- // a different shape and deliberately not matched, so an ActiveJob-only app yields 0.
3353
3603
  const SIDEKIQ_DISPATCH_RE = /([A-Z][A-Za-z0-9_]*(?:::[A-Z][A-Za-z0-9_]*)*)\s*\.\s*perform_(?:async|in|at)\b/g;
3354
3604
  const SIDEKIQ_WORKER_RE = /\binclude\s+Sidekiq::(?:Job|Worker)\b/;
3355
3605
  const SIDEKIQ_RB_EXT = /\.rb$/;
3356
3606
  const SIDEKIQ_FANOUT_CAP = 80;
3357
3607
  async function sidekiqDispatchEdges(ctx, onYield) {
3358
3608
  let scannedFiles = 0;
3359
- // class node id → its instance `perform` method (null if the class isn't a Sidekiq worker),
3360
- // memoized. Reads the class body for the mixin; only consulted for actual dispatch receivers.
3361
3609
  const performCache = new Map();
3362
3610
  const performOf = (cls) => {
3363
3611
  let v = performCache.get(cls.id);
@@ -3375,11 +3623,6 @@ async function sidekiqDispatchEdges(ctx, onYield) {
3375
3623
  performCache.set(cls.id, v);
3376
3624
  return v;
3377
3625
  };
3378
- // Resolve a (possibly namespaced) worker reference to its `perform`. A namespaced ref is
3379
- // matched by EXACT qualified name first, so same-named workers in different namespaces
3380
- // (forem has four `SendEmailNotificationWorker`s) resolve to the right one; an unqualified
3381
- // ref falls back to the simple name and links only when a single worker bears it — an
3382
- // ambiguous collision bails (precision over recall).
3383
3626
  const resolve = (ref) => {
3384
3627
  if (ref.includes('::')) {
3385
3628
  const q = ctx.getNodesByQualifiedName(ref).find((n) => n.kind === 'class' && performOf(n));
@@ -3405,7 +3648,7 @@ async function sidekiqDispatchEdges(ctx, onYield) {
3405
3648
  let m;
3406
3649
  let added = 0;
3407
3650
  while ((m = SIDEKIQ_DISPATCH_RE.exec(safe)) && added < SIDEKIQ_FANOUT_CAP) {
3408
- const line = safe.slice(0, m.index).split('\n').length;
3651
+ const line = lineOf(safe, m.index);
3409
3652
  const disp = (0, synth_utils_1.enclosingFn)(nodesInFile, line);
3410
3653
  if (!disp)
3411
3654
  continue;
@@ -3429,46 +3672,12 @@ async function sidekiqDispatchEdges(ctx, onYield) {
3429
3672
  }
3430
3673
  return edges;
3431
3674
  }
3432
- // ── Erlang behaviour-callback dispatch ────────────────────────────────────────
3433
- // An Erlang behaviour is a compile-checked callback contract: the behaviour
3434
- // module declares `-callback init(...) -> ...`, implementers declare
3435
- // `-behaviour(B)` and export the callbacks, and the framework side dispatches
3436
- // through a VARIABLE module — cowboy's `Handler:init(Req, Opts)` and
3437
- // `Middleware:execute(Req, Env)` folds, ejabberd's `Mod:start/2`. Extraction
3438
- // deliberately leaves var-module calls silent (no static target), so the flow
3439
- // breaks at exactly the hop agents ask about (request → handler init). Bridge:
3440
- //
3441
- // dispatch site `Var:fn(args…)` → every in-repo implementer of the behaviour
3442
- // declaring `fn` with the SITE's arity — provided exactly ONE in-repo
3443
- // behaviour declares (fn, arity); a name+arity collision across behaviours
3444
- // bails (silent beats wrong) — and the implementer defines and exports `fn`.
3445
- //
3446
- // Behaviours are discovered by scanning every Erlang file for `-callback`
3447
- // declarations (not just `implements` targets), so a behaviour with zero
3448
- // implementers still participates in the ambiguity gate. Fan-out control: a
3449
- // mega-behaviour (ejabberd's gen_mod, ~200 mod_* implementers) would mint
3450
- // hundreds of edges per site that READ as complete coverage while being
3451
- // arbitrary — above the cap the site is skipped entirely and the boundary
3452
- // stays visibly dynamic (explore's boundary announcer covers it) instead of
3453
- // silently truncated.
3454
3675
  const ERLANG_EXT = /\.(?:erl|hrl)$/;
3455
- // `Var:fn(` — variable (capitalized) module, lowercase function, immediate
3456
- // open-paren. The leading char class rejects `?MODULE:fn(` (macro), `a:b(`
3457
- // (static remote call, already linked), and mid-word matches.
3458
3676
  const ERLANG_DISPATCH_RE = /(^|[^?\w@'])([A-Z][A-Za-z0-9_@]*):([a-z][A-Za-z0-9_@]*)\(/g;
3459
3677
  const ERLANG_CALLBACK_DECL_RE = /(^|\n)\s*-callback\s+('[^'\n]+'|[a-z][A-Za-z0-9_@]*)\s*\(/g;
3460
3678
  const ERLANG_BEHAVIOUR_FANOUT_CAP = 24;
3461
- /**
3462
- * Argument count of the call/declaration whose `(` sits at `openIdx` —
3463
- * top-level commas + 1, `()` → 0, unbalanced/oversized → -1. Skips nested
3464
- * (), [], {}, <<>> content, `"strings"`, `'atoms'`, and `$c` char literals,
3465
- * so `-callback init(fun((a, b) -> ok), #{k => v}) -> ok.` counts 2.
3466
- */
3467
3679
  function erlangArityAt(src, openIdx) {
3468
3680
  let depth = 1;
3469
- // `<<1,2,3>>` binary literals: commas inside are element separators, not
3470
- // argument separators. Tracked separately from bracket depth because the
3471
- // single-char `<`/`>` comparison operators must stay inert (#1358).
3472
3681
  let binDepth = 0;
3473
3682
  let commas = 0;
3474
3683
  let sawArg = false;
@@ -3523,40 +3732,12 @@ function erlangArityAt(src, openIdx) {
3523
3732
  }
3524
3733
  return -1;
3525
3734
  }
3526
- /**
3527
- * Nix module-system option wiring. A NixOS/home-manager/nix-darwin option is
3528
- * DECLARED in one module (`options.launchd.user.agents = mkOption { ... }`)
3529
- * and SET in others (`launchd.user.agents.yabai = { ... }` inside a module's
3530
- * config) — the connection happens by option-path unification inside the
3531
- * module-system evaluator, so there is no static call/import edge to follow
3532
- * and flow questions ("how does services.yabai.enable become a launchd
3533
- * service?") go dark at the module boundary.
3534
- *
3535
- * This pass links each config-write binding to the option declaration whose
3536
- * path is the longest static-segment prefix of the write path. Precision gates:
3537
- * - only STATIC segments participate: plain identifiers, plus quoted segments
3538
- * (`"git/config"`, `"com.apple.dock"`) as opaque verbatim tokens that match
3539
- * only quote-exactly; an interpolated (`${name}`) segment ends the prefix,
3540
- * so dynamic paths never match beyond their static head;
3541
- * - matched prefixes must be ≥2 segments: 1-segment paths would wrongly link
3542
- * every package's `meta = { ... }` attrset to nixos's `options.meta`;
3543
- * - a prefix declared in more than one file is ambiguous → no edge (a wrong
3544
- * edge is worse than none);
3545
- * - writes physically inside an options block are declaration internals
3546
- * (types, defaults, examples), never config writes → excluded.
3547
- * Both declaration spellings register: flat (`options.a.b = ...`) by name, and
3548
- * nested (`options = { a.b = ...; }`) by line-span containment.
3549
- */
3550
3735
  function nixLeadingPlainSegments(name) {
3551
3736
  const segs = [];
3552
3737
  let i = 0;
3553
3738
  const n = name.length;
3554
3739
  while (i < n) {
3555
3740
  if (name[i] === '"') {
3556
- // Quoted segment — an opaque verbatim token (quotes kept, so it can
3557
- // never collide with a plain identifier). `NSGlobalDomain."com.apple.
3558
- // mouse.tapBehavior"` must match ITS OWN quoted declaration, not
3559
- // whichever sibling registered the shared plain prefix first.
3560
3741
  let j = i + 1;
3561
3742
  while (j < n && name[j] !== '"') {
3562
3743
  if (name[j] === '\\')
@@ -3564,10 +3745,10 @@ function nixLeadingPlainSegments(name) {
3564
3745
  j++;
3565
3746
  }
3566
3747
  if (j >= n)
3567
- return segs; // unterminated — stop at the static head
3748
+ return segs;
3568
3749
  const tok = name.slice(i, j + 1);
3569
3750
  if (tok.includes('${'))
3570
- return segs; // interpolated → dynamic → stop
3751
+ return segs;
3571
3752
  segs.push(tok);
3572
3753
  i = j + 1;
3573
3754
  if (i >= n)
@@ -3593,8 +3774,6 @@ function nixLeadingPlainSegments(name) {
3593
3774
  }
3594
3775
  async function nixOptionPathEdges(queries, onYield) {
3595
3776
  let scanned255 = 0;
3596
- // One streaming pass over nix bindings (variables + the odd function-valued
3597
- // option); memory stays O(bindings-kept), not O(all nodes) (#610).
3598
3777
  const byFile = new Map();
3599
3778
  let scanned = 0;
3600
3779
  for (const kind of ['variable', 'function']) {
@@ -3620,13 +3799,6 @@ async function nixOptionPathEdges(queries, onYield) {
3620
3799
  byFile.set(node.filePath, [rec]);
3621
3800
  }
3622
3801
  }
3623
- // Per file: walk bindings outermost-first with a stack of active option
3624
- // spans, composing nested declaration paths (`options = { services.foo = {
3625
- // enable = mkOption ...; }; }` registers services.foo AND services.foo.enable).
3626
- // An `options` binding nested inside another option span is a SUBMODULE's
3627
- // own namespace (`attrsOf (submodule { options = ...; })`) — its internals
3628
- // are not globally addressable, so the sentinel blocks registration below it
3629
- // while still excluding the region from write candidates.
3630
3802
  const SUBMODULE = '\u0000submodule';
3631
3803
  const decls = new Map();
3632
3804
  const writes = [];
@@ -3646,9 +3818,6 @@ async function nixOptionPathEdges(queries, onYield) {
3646
3818
  for (const rec of recs) {
3647
3819
  while (stack.length > 0 && stack[stack.length - 1].end < rec.startLine)
3648
3820
  stack.pop();
3649
- // Strict containment at line granularity: a one-line nested binding is
3650
- // indistinguishable from its container, so it stays unclassified (rare
3651
- // in module code, where option blocks are multi-line).
3652
3821
  const enclosing = stack.length > 0 &&
3653
3822
  rec.startLine >= stack[stack.length - 1].start &&
3654
3823
  rec.endLine <= stack[stack.length - 1].end &&
@@ -3656,7 +3825,7 @@ async function nixOptionPathEdges(queries, onYield) {
3656
3825
  ? stack[stack.length - 1]
3657
3826
  : null;
3658
3827
  if (rec.segs[0] === 'options') {
3659
- const ownPath = rec.segs.slice(1); // [] for the bare `options = { ... }` spelling
3828
+ const ownPath = rec.segs.slice(1);
3660
3829
  const prefix = enclosing ? [SUBMODULE] : ownPath;
3661
3830
  register(prefix, rec);
3662
3831
  stack.push({ start: rec.startLine, end: rec.endLine, prefix });
@@ -3677,13 +3846,9 @@ async function nixOptionPathEdges(queries, onYield) {
3677
3846
  return [];
3678
3847
  const edges = [];
3679
3848
  for (const w of writes) {
3680
- // `config.services.x = ...` spells the same write with an explicit prefix.
3681
3849
  const segs = w.segs[0] === 'config' ? w.segs.slice(1) : w.segs;
3682
3850
  if (segs.length < 2)
3683
3851
  continue;
3684
- // Longest prefix wins; an ambiguous longest match does NOT fall back to a
3685
- // shorter one (that would link `services.nginx.virtualHosts.x` to
3686
- // `options.services.nginx` when virtualHosts is the contested path).
3687
3852
  for (let len = Math.min(segs.length, 6); len >= 2; len--) {
3688
3853
  const candidates = decls.get(segs.slice(0, len).join('.'));
3689
3854
  if (!candidates || candidates.length === 0)
@@ -3706,7 +3871,7 @@ async function nixOptionPathEdges(queries, onYield) {
3706
3871
  });
3707
3872
  }
3708
3873
  }
3709
- break; // longest hit decides, matched or ambiguous
3874
+ break;
3710
3875
  }
3711
3876
  }
3712
3877
  return edges;
@@ -3714,8 +3879,6 @@ async function nixOptionPathEdges(queries, onYield) {
3714
3879
  async function erlangBehaviourDispatchEdges(queries, ctx, onYield) {
3715
3880
  let scannedFiles = 0;
3716
3881
  let scanned255 = 0;
3717
- // Cheap language gate: no Erlang modules → no cost beyond one streamed
3718
- // kind scan (never a materialized array of every namespace — #1212).
3719
3882
  const erlangModules = [];
3720
3883
  for (const n of queries.iterateNodesByKindIn('namespace', ['erlang'])) {
3721
3884
  if ((++scanned255 & 63) === 0)
@@ -3724,15 +3887,12 @@ async function erlangBehaviourDispatchEdges(queries, ctx, onYield) {
3724
3887
  }
3725
3888
  if (erlangModules.length === 0)
3726
3889
  return [];
3727
- // Pass 1 — scan every Erlang file with `-callback` decls: behaviour module →
3728
- // its (name, arity) callback set, and the global `name/arity` → declaring
3729
- // behaviours map that drives the ambiguity gate.
3730
3890
  const moduleByFile = new Map();
3731
3891
  for (const ns of erlangModules) {
3732
3892
  if (!moduleByFile.has(ns.filePath))
3733
3893
  moduleByFile.set(ns.filePath, ns);
3734
3894
  }
3735
- const declaringBehaviours = new Map(); // `fn/arity` → behaviour namespaces
3895
+ const declaringBehaviours = new Map();
3736
3896
  const callbackNames = new Set();
3737
3897
  for (const file of ctx.getAllFiles()) {
3738
3898
  if ((++scannedFiles & 15) === 0)
@@ -3741,7 +3901,7 @@ async function erlangBehaviourDispatchEdges(queries, ctx, onYield) {
3741
3901
  continue;
3742
3902
  const behaviour = moduleByFile.get(file);
3743
3903
  if (!behaviour)
3744
- continue; // a .hrl or module-less file can't be a behaviour
3904
+ continue;
3745
3905
  const content = ctx.readFile(file);
3746
3906
  if (!content || !content.includes('-callback'))
3747
3907
  continue;
@@ -3767,11 +3927,6 @@ async function erlangBehaviourDispatchEdges(queries, ctx, onYield) {
3767
3927
  }
3768
3928
  if (declaringBehaviours.size === 0)
3769
3929
  return [];
3770
- // Implementer target lookup, lazy per (behaviour, fn, arity): implementers
3771
- // come from the `implements` edges extraction resolved, and the target is
3772
- // the implementer module's own exported `fn` node OF THE SITE'S ARITY —
3773
- // function qualifiedNames carry arity (`mod::fn/2`, #1610), so the arity the
3774
- // dispatch site used selects among same-named definitions.
3775
3930
  const targetCache = new Map();
3776
3931
  const qnArity = (qn) => {
3777
3932
  const m = /\/(\d{1,3})$/.exec(qn);
@@ -3799,8 +3954,6 @@ async function erlangBehaviourDispatchEdges(queries, ctx, onYield) {
3799
3954
  targetCache.set(cacheKey, targets);
3800
3955
  return targets;
3801
3956
  };
3802
- // Pass 2 — dispatch sites. Only files containing a var-module call shape are
3803
- // scanned in full.
3804
3957
  const edges = [];
3805
3958
  const seen = new Set();
3806
3959
  for (const file of ctx.getAllFiles()) {
@@ -3825,12 +3978,12 @@ async function erlangBehaviourDispatchEdges(queries, ctx, onYield) {
3825
3978
  continue;
3826
3979
  const behaviours = declaringBehaviours.get(`${fn}/${arity}`);
3827
3980
  if (!behaviours || behaviours.length !== 1)
3828
- continue; // unknown or ambiguous
3981
+ continue;
3829
3982
  const behaviour = behaviours[0];
3830
3983
  const targets = targetsOf(behaviour, fn, arity);
3831
3984
  if (targets.length === 0 || targets.length > ERLANG_BEHAVIOUR_FANOUT_CAP)
3832
3985
  continue;
3833
- const line = safe.slice(0, m.index).split('\n').length;
3986
+ const line = lineOf(safe, m.index);
3834
3987
  const disp = (0, synth_utils_1.enclosingFn)(nodesInFile, line);
3835
3988
  if (!disp)
3836
3989
  continue;
@@ -3858,31 +4011,14 @@ async function erlangBehaviourDispatchEdges(queries, ctx, onYield) {
3858
4011
  }
3859
4012
  return edges;
3860
4013
  }
3861
- // ── Laravel events (PHP) ──────────────────────────────────────────────────────
3862
- // Laravel decouples an event dispatch from its listener(s), linked by the EVENT CLASS:
3863
- // // app/Events/PlaybackStarted.php + app/Listeners/UpdateLastfmNowPlaying.php
3864
- // class UpdateLastfmNowPlaying { public function handle(PlaybackStarted $event) { … } }
3865
- // // a controller / service — a DIFFERENT file
3866
- // event(new PlaybackStarted($song, $user));
3867
- // Bridge it: link the enclosing method at each `event(new XEvent(...))` site → every listener's
3868
- // `handle` for XEvent. Listeners come from TWO registration mechanisms (both real, both needed):
3869
- // (A) auto-discovery — a `handle(EventType $e)` typed first param (also splits a union A|B);
3870
- // (B) the `protected $listen = [ XEvent::class => [Listener::class, …] ]` map in an
3871
- // EventServiceProvider, which also covers a listener whose `handle()` is UNTYPED.
3872
- // Only `event(new X)` is matched — queued JOBS dispatch via `::dispatch()` and their `handle()`
3873
- // takes an injected service, never an event type, so jobs are excluded by construction.
3874
4014
  const LARAVEL_DISPATCH_RE = /\bevent\s*\(\s*new\s+\\?([A-Za-z_][\w\\]*)/g;
3875
4015
  const LARAVEL_PHP_EXT = /\.php$/;
3876
4016
  const LARAVEL_FANOUT_CAP = 200;
3877
- // A `$listen` entry: `Event::class => [Listener::class, …]`, key/values as `::class` or strings.
3878
4017
  const LISTEN_ENTRY_RE = /(?:([A-Za-z_\\][\w\\]*)::class|'([^']+)'|"([^"]+)")\s*=>\s*\[([^\]]*)\]/g;
3879
4018
  const LISTEN_CLASS_RE = /(?:([A-Za-z_\\][\w\\]*)::class|'([^']+)'|"([^"]+)")/g;
3880
- /** Short class name from a PHP reference: `\App\Events\Foo` / `App\Events::Foo` → `Foo`. */
3881
4019
  function phpSimpleName(s) {
3882
4020
  return s.replace(/^\\/, '').split('\\').pop().split('::').pop().trim();
3883
4021
  }
3884
- /** The first-parameter class type(s) of a `handle(...)` declaration — union-split, short-named,
3885
- * primitives dropped. `handle(A|B $e)` → [A, B]; `handle(string $x)` / `handle()` → []. */
3886
4022
  function laravelHandleEventTypes(decl) {
3887
4023
  const m = /function\s+handle\s*\(\s*(?:\.\.\.\s*)?(\??[A-Za-z_\\][\w\\|]*)\s+&?\s*(?:\.\.\.\s*)?\$/.exec(decl);
3888
4024
  if (!m)
@@ -3893,7 +4029,6 @@ function laravelHandleEventTypes(decl) {
3893
4029
  .map((t) => phpSimpleName(t))
3894
4030
  .filter((t) => /^[A-Z]\w*$/.test(t));
3895
4031
  }
3896
- /** From an opening `[`, the bracket-balanced body up to its matching `]`. */
3897
4032
  function phpArrayBody(src, openIdx) {
3898
4033
  let depth = 0;
3899
4034
  for (let i = openIdx; i < src.length; i++) {
@@ -3906,7 +4041,6 @@ function phpArrayBody(src, openIdx) {
3906
4041
  }
3907
4042
  async function laravelEventEdges(ctx, onYield) {
3908
4043
  let scannedFiles = 0;
3909
- // event short name → its listener `handle` methods (deduped by node id).
3910
4044
  const listeners = new Map();
3911
4045
  const add = (event, handle) => {
3912
4046
  let m = listeners.get(event);
@@ -3920,7 +4054,6 @@ async function laravelEventEdges(ctx, onYield) {
3920
4054
  .getNodesInFile(cls.filePath)
3921
4055
  .find((n) => n.kind === 'method' && n.name === 'handle'
3922
4056
  && n.startLine >= cls.startLine && n.startLine <= (cls.endLine ?? cls.startLine)) ?? null;
3923
- // Pass 1 — build the event→handle map from both registration mechanisms.
3924
4057
  for (const file of ctx.getAllFiles()) {
3925
4058
  if ((++scannedFiles & 15) === 0)
3926
4059
  await onYield();
@@ -3929,7 +4062,6 @@ async function laravelEventEdges(ctx, onYield) {
3929
4062
  const content = ctx.readFile(file);
3930
4063
  if (!content)
3931
4064
  continue;
3932
- // (A) typed listener handles — node-driven, so a commented-out method can't leak in.
3933
4065
  if (content.includes('function handle')) {
3934
4066
  const lines = content.split('\n');
3935
4067
  for (const node of ctx.getNodesInFile(file)) {
@@ -3940,8 +4072,6 @@ async function laravelEventEdges(ctx, onYield) {
3940
4072
  add(ev, node);
3941
4073
  }
3942
4074
  }
3943
- // (B) the EventServiceProvider `$listen` map — parsed from comment-stripped source so a
3944
- // fully-commented map (firefly's, on auto-discovery) contributes nothing.
3945
4075
  if (content.includes('$listen')) {
3946
4076
  const safe = (0, strip_comments_1.stripCommentsForRegex)(content, 'php');
3947
4077
  const decl = safe.search(/\$listen\s*=\s*\[/);
@@ -3965,7 +4095,6 @@ async function laravelEventEdges(ctx, onYield) {
3965
4095
  }
3966
4096
  if (!listeners.size)
3967
4097
  return [];
3968
- // Pass 2 — link each event(new X(...)) site → every listener of X.
3969
4098
  const edges = [];
3970
4099
  const seen = new Set();
3971
4100
  for (const file of ctx.getAllFiles()) {
@@ -3985,7 +4114,7 @@ async function laravelEventEdges(ctx, onYield) {
3985
4114
  const targets = listeners.get(phpSimpleName(m[1]));
3986
4115
  if (!targets)
3987
4116
  continue;
3988
- const line = safe.slice(0, m.index).split('\n').length;
4117
+ const line = lineOf(safe, m.index);
3989
4118
  const disp = (0, synth_utils_1.enclosingFn)(nodesInFile, line);
3990
4119
  if (!disp)
3991
4120
  continue;
@@ -4011,23 +4140,26 @@ async function laravelEventEdges(ctx, onYield) {
4011
4140
  return edges;
4012
4141
  }
4013
4142
  const ALWAYS = () => true;
4014
- /** Conservative input gates for SYNTH_PASSES; keep these in sync when adding a pass. */
4015
4143
  function hasSynthesisPattern(filePath, content) {
4016
- // These passes consume declarations/layouts as well as dispatch sites. A
4017
- // header or markup edit can change a channel whose endpoints live elsewhere.
4018
4144
  if (/\.(?:vue|svelte|dfm|fmx|nix|xml)$/.test(filePath))
4019
4145
  return true;
4146
+ if (next_proxy_1.NEXT_PROXY_FILE.test(filePath) || (0, nextjs_1.nextRouteForFile)(filePath) !== null)
4147
+ return true;
4020
4148
  if (/\.(?:c|h|cc|cpp|cxx|hpp|hh|hxx|cppm|ipp|inl|tcc|def|inc|tbl)$/i.test(filePath) &&
4021
- /\b(?:struct|union|typedef|virtual|override)\b|#\s*(?:include|define|if)|=|->|\[/.test(content))
4149
+ /\b(?:struct|union|typedef|virtual|override)\b|#\s*(?:include|define|if)|=|->|\[|</.test(content))
4022
4150
  return true;
4023
4151
  if (/\b(?:class|interface|protocol|trait|impl|extends|implements|expect|actual)\b/.test(content))
4024
4152
  return true;
4025
- if (/\.go$/.test(filePath) && /\b(?:struct|interface)\b|\bfunc\s*\(/.test(content))
4153
+ if (/\.go$/.test(filePath))
4026
4154
  return true;
4027
- if ((0, tier_synthesizer_1.hasCrossTierPattern)(content) || (0, tier_synthesizer_1.hasTestRequestPattern)(filePath, content))
4155
+ if ((0, tier_synthesizer_1.hasCrossTierPattern)(content) || (0, tier_synthesizer_1.hasTestRequestPattern)(filePath, content) || (0, tauri_synthesizer_1.hasTauriPattern)(filePath, content))
4028
4156
  return true;
4029
4157
  if (/\b(?:render|build|setState|defineStore|createStore|createApi|Store|href|sendEvent|sendEventWithName)\b|<\/|\/>/.test(content))
4030
4158
  return true;
4159
+ if (WRAPPER_CALL_RE.test(content))
4160
+ return true;
4161
+ if ((0, const_alias_synthesizer_1.hasConstAliasShape)(filePath, content))
4162
+ return true;
4031
4163
  if (/\.(?:forEach|append|add|push|insert|fire|dispatchEvent|addListener|Use|GET|POST|PUT|PATCH|DELETE|OPTIONS|HEAD|Any|Handle)\s*\(/.test(content))
4032
4164
  return true;
4033
4165
  if (/[\w$]\s*\[\s*[A-Za-z_$]/.test(content) || /\b(?:dispatch|commit)\s*\(/.test(content))
@@ -4044,29 +4176,15 @@ function hasSynthesisPattern(filePath, content) {
4044
4176
  if (matches)
4045
4177
  return true;
4046
4178
  }
4047
- // Field-backed observers use method-name gates rather than fixed call names.
4048
4179
  return (content.match(/[A-Za-z_$][\w$]*/g) ?? []).some((name) => REGISTRAR_NAME.test(name) || DISPATCHER_NAME.test(name));
4049
4180
  }
4050
- /**
4051
- * The independent passes, in MERGE ORDER — the first-seen dedup in
4052
- * synthesizeCallbackEdges follows this array, so reordering entries changes
4053
- * which duplicate edge wins. The two Go pre-passes (cross-file method
4054
- * `contains`, implicit `implements`) are NOT here: they persist before these
4055
- * run because interfaceOverrideEdges reads their edges from the DB.
4056
- */
4057
4181
  exports.SYNTH_PASSES = [
4058
4182
  { name: 'fieldEdges', gate: ALWAYS, run: (q, c, y) => fieldChannelEdges(q, c, y) },
4059
4183
  { name: 'closureCollEdges', gate: ALWAYS, run: (q, c, y) => closureCollectionEdges(q, c, y) },
4060
- // Cross-tier channels — a client's `fetch('/api/x')` onto its own route,
4061
- // a queue job onto its consumer, a bus / socket event onto its handler.
4062
- // Before the in-process emitter pass: the same (source, target) pair
4063
- // keeps the more specific edge — the one that says which tier it crosses.
4064
4184
  { name: 'tierEdges', gate: (has) => has(...JS_FAMILY), run: (_q, c, y) => (0, tier_synthesizer_1.crossTierEdges)(c, y) },
4065
- // A Spring / Laravel test's request (`mockMvc.perform(post("/x"))`,
4066
- // `$this->postJson('api/x')`) onto the route it reaches, so the handler
4067
- // counts as tested.
4185
+ { name: 'tauriEdges', gate: (has) => has('rust') && has('vue', 'svelte', ...JS_FAMILY), run: (q, c, y) => (0, tauri_synthesizer_1.tauriEdges)(q, c, y) },
4068
4186
  { name: 'testRequestEdges', gate: (has) => has('java', 'kotlin', 'php'), run: (_q, c, y) => (0, tier_synthesizer_1.testRequestEdges)(c, y) },
4069
- { name: 'emitterEdges', gate: ALWAYS, run: (_q, c, y) => eventEmitterEdges(c, y) },
4187
+ { name: 'emitterEdges', gate: ALWAYS, run: (q, c, y) => (0, event_emitter_synthesizer_1.eventEmitterEdges)(q, c, y) },
4070
4188
  { name: 'renderEdges', gate: ALWAYS, run: (q, c, y) => reactRenderEdges(q, c, y) },
4071
4189
  { name: 'jsxEdges', gate: (has) => has(...JS_FAMILY), run: (_q, c, y) => reactJsxChildEdges(c, y) },
4072
4190
  { name: 'vueEdges', gate: (has) => has('vue'), run: (_q, c, y) => vueTemplateEdges(c, y) },
@@ -4076,24 +4194,17 @@ exports.SYNTH_PASSES = [
4076
4194
  { name: 'arkuiStateEdges', gate: (has) => has('arkts'), run: (q, c, y) => arkuiStateBuildEdges(q, c, y) },
4077
4195
  { name: 'arkuiEmitter', gate: (has) => has('arkts'), run: (_q, c, y) => arkuiEmitterEdges(c, y) },
4078
4196
  { name: 'arkuiRoutes', gate: (has) => has('arkts'), run: (_q, c, y) => arkuiRouterEdges(c, y) },
4079
- { name: 'cppEdges', gate: (has) => has('cpp'), run: (q, _c, y) => cppOverrideEdges(q, y) },
4197
+ { name: 'cppEdges', gate: (has) => has('cpp'), run: (q, c, y) => cppOverrideEdges(q, c, y) },
4080
4198
  {
4081
4199
  name: 'ifaceEdges',
4082
4200
  gate: (has) => has('java', 'kotlin', 'csharp', 'swift', 'scala', 'go', 'rust', 'arkts', ...JS_FAMILY),
4083
- run: (q, _c, y) => interfaceOverrideEdges(q, y),
4201
+ run: (q, c, y) => interfaceOverrideEdges(q, c, y),
4084
4202
  },
4085
4203
  { name: 'kotlinExpectActual', gate: (has) => has('kotlin'), run: (q, _c, y) => kotlinExpectActualEdges(q, y) },
4086
4204
  { name: 'goGrpcEdges', gate: (has) => has('go'), run: (q, _c, y) => goGrpcStubImplEdges(q, y) },
4087
4205
  { name: 'rnEventEdgesList', gate: (has) => has(...JS_FAMILY), run: (_q, c, y) => rnEventEdges(c, y) },
4088
4206
  { name: 'fabricNativeEdges', gate: ALWAYS, run: (_q, c, y) => fabricNativeImplEdges(c, y) },
4089
- // Expo module nodes (`expo-module:` ids) are emitted only from .swift/.kt
4090
- // files, and a pair needs BOTH platforms — so without both languages the
4091
- // pass's only collection loop is provably empty (it was streaming every
4092
- // method row on pure-Java repos to find nothing).
4093
4207
  { name: 'expoXPlatEdges', gate: (has) => has('swift') && has('kotlin'), run: (q, _c, y) => expoCrossPlatformEdges(q, y) },
4094
- // An RN cross-platform edge requires a JS-language caller on the native
4095
- // method (`isBridge`) — no JS-family files means no JS-language nodes, so
4096
- // the result is provably empty.
4097
4208
  { name: 'rnXPlatEdges', gate: (has) => has(...JS_FAMILY), run: (q, _c, y) => rnCrossPlatformEdges(q, y) },
4098
4209
  {
4099
4210
  name: 'mybatisEdges',
@@ -4102,6 +4213,7 @@ exports.SYNTH_PASSES = [
4102
4213
  },
4103
4214
  { name: 'ginEdges', gate: (has) => has('go'), run: (q, c, y) => ginMiddlewareChainEdges(q, c, y) },
4104
4215
  { name: 'thunkEdges', gate: (has) => has(...JS_FAMILY), run: (q, c, y) => reduxThunkEdges(q, c, y) },
4216
+ { name: 'constAliasEdges', gate: (has) => has(...JS_FAMILY), run: (q, c, y) => (0, const_alias_synthesizer_1.constAliasEdges)(q, c, y) },
4105
4217
  { name: 'registryEdges', gate: ALWAYS, run: (_q, c, y) => objectRegistryEdges(c, y) },
4106
4218
  { name: 'rtkEdges', gate: (has) => has(...JS_FAMILY), run: (q, c, y) => rtkQueryEdges(q, c, y) },
4107
4219
  { name: 'piniaEdges', gate: (has) => has('vue', ...JS_FAMILY), run: (_q, c, y) => piniaStoreEdges(c, y) },
@@ -4121,64 +4233,42 @@ exports.SYNTH_PASSES = [
4121
4233
  gate: (has) => has('c', 'cpp'),
4122
4234
  run: (q, c, y, sub) => (0, c_fnptr_synthesizer_1.cFnPointerDispatchEdges)(q, c, y, sub),
4123
4235
  },
4236
+ { name: 'cppTemplateEdges', gate: (has) => has('cpp'), run: (q, c, y) => (0, cpp_template_instantiations_1.cppTemplateArgumentEdges)(q, c, y) },
4124
4237
  { name: 'goframeEdges', gate: (has) => has('go'), run: (_q, c, y) => (0, goframe_synthesizer_1.goframeRouteEdges)(c, y) },
4125
- // `router.push(await helper())` — the helper's return literals are the screens.
4238
+ { name: 'goFuncFieldEdges', gate: (has) => has('go'), run: (q, c, y) => (0, go_func_field_synthesizer_1.goFuncFieldEdges)(q, c, y, MAX_CALLBACKS_PER_CHANNEL) },
4126
4239
  { name: 'expoRouterReturnEdges', gate: (has) => has(...JS_FAMILY), run: (_q, c, y) => (0, expo_router_synthesizer_1.expoRouterReturnEdges)(c, y) },
4127
- // `<Link href="/x">` / an internal `<a href>` — markup, not a call; the component navigates.
4128
4240
  { name: 'nextLinkEdges', gate: (has) => has(...JS_FAMILY), run: (_q, c, y) => (0, next_router_synthesizer_1.nextLinkEdges)(c, y) },
4241
+ { name: 'nextProxyEdges', gate: (has) => has(...JS_FAMILY), run: (_q, c, y) => (0, next_router_synthesizer_1.nextProxyEdges)(c, y) },
4129
4242
  { name: 'reactRouterLinkEdges', gate: (has) => has(...JS_FAMILY), run: (_q, c, y) => (0, react_router_synthesizer_1.reactRouterLinkEdges)(c, y) },
4130
4243
  { name: 'tanstackLinkEdges', gate: (has) => has(...JS_FAMILY), run: (_q, c, y) => (0, tanstack_router_synthesizer_1.tanstackLinkEdges)(c, y) },
4131
4244
  { name: 'vueRouterLinkEdges', gate: (has) => has('vue', ...JS_FAMILY), run: (_q, c, y) => (0, vue_router_synthesizer_1.vueRouterLinkEdges)(c, y) },
4132
- // An Angular template: the child components it renders and its `routerLink`s.
4133
4245
  { name: 'angularTemplateEdges', gate: (has) => has('typescript'), run: (_q, c, y) => (0, angular_template_synthesizer_1.angularTemplateEdges)(c, y) },
4134
4246
  { name: 'svelteKitPageEdges', gate: (has) => has('svelte'), run: (_q, c, y) => (0, sveltekit_synthesizer_1.svelteKitPageComponentEdges)(c, y) },
4135
4247
  { name: 'svelteKitLinkEdges', gate: (has) => has('svelte'), run: (_q, c, y) => (0, sveltekit_synthesizer_1.svelteKitLinkEdges)(c, y) },
4136
4248
  { name: 'nixOptionEdges', gate: (has) => has('nix'), run: (q, _c, y) => nixOptionPathEdges(q, y) },
4137
4249
  ];
4138
- /**
4139
- * Rough relative cost of the passes that run longest on large repos. Only
4140
- * the pooled dispatch ORDER reads it — heaviest first, so the longest passes
4141
- * start before the short ones fill the workers; unlisted passes keep registry
4142
- * order after these. A wrong hint costs wall time, never edges.
4143
- */
4144
4250
  const SYNTH_PASS_COST_HINT = {
4145
- cFnPtrEdges: 100, registryEdges: 60, tierEdges: 55, jsxEdges: 25, rnEventEdgesList: 24,
4251
+ cFnPtrEdges: 100, registryEdges: 60, tierEdges: 55, goFuncFieldEdges: 30, jsxEdges: 25, rnEventEdgesList: 24,
4146
4252
  ifaceEdges: 18, flutterEdges: 16, cppEdges: 15, emitterEdges: 12, fieldEdges: 11,
4147
4253
  mybatisEdges: 10, vuexEdges: 8, closureCollEdges: 6, piniaEdges: 5, renderEdges: 4,
4148
4254
  };
4149
4255
  function synthPassCostHint(name) {
4150
4256
  return SYNTH_PASS_COST_HINT[name] ?? 0;
4151
4257
  }
4152
- /** Fixed non-registry steps: goMethodContains, goImplements, dedupe-merge, insertMergedEdges. */
4153
4258
  const FIXED_SYNTH_STEPS = 4;
4154
4259
  exports.SYNTH_PROGRESS_STEPS = exports.SYNTH_PASSES.length + FIXED_SYNTH_STEPS;
4155
- async function synthesizeCallbackEdges(queries, ctx, onProgress,
4156
- // A live resolver pool to fan the independent passes across (structural type
4157
- // so this file never imports the pool — resolver-worker imports THIS file).
4158
- // Null/omitted → the sequential path, byte-identical to the pool path.
4159
- pool,
4160
- // WAL-valve writer backstop (WalCheckpointValve.backpressure), called at
4161
- // pool-idle points in the edge-insert loops below — the passes themselves
4162
- // only read; every write in this function happens with the pool idle.
4163
- backpressure,
4164
- // Main-thread work to run while the pool computes the passes (the main
4165
- // thread otherwise only waits there) — e.g. building a deferred index.
4166
- whilePoolBusy) {
4167
- // Each sub-pass below is a whole-graph scan, and there are ~30 of them, all
4168
- // running synchronously on the indexer's main thread. Their AGGREGATE can run
4169
- // for well over a minute on a large repo — long enough for the #850 liveness
4170
- // watchdog to SIGKILL the process mid-index (#1091), since its heartbeat lives
4171
- // on this same thread. Yield between passes so the heartbeat can fire; a pass
4172
- // that itself hangs (a real wedge) never reaches the next yield, so the
4173
- // watchdog still catches that. See ./cooperative-yield.
4260
+ function manualMockNodeIds(ctx) {
4261
+ const ids = new Set();
4262
+ for (const file of ctx.getAllFiles()) {
4263
+ if (!(0, name_matcher_1.isManualMockPath)(file))
4264
+ continue;
4265
+ for (const n of ctx.getNodesInFile(file))
4266
+ ids.add(n.id);
4267
+ }
4268
+ return ids;
4269
+ }
4270
+ async function synthesizeCallbackEdges(queries, ctx, onProgress, pool, backpressure, whilePoolBusy) {
4174
4271
  const yieldToLoop = (0, cooperative_yield_1.createYielder)();
4175
- // Synthesis runs AFTER the resolution progress bar reaches 100%, so without
4176
- // its own progress the UI freezes at "Resolving refs 100%" for the whole
4177
- // tail — long enough on big repos that users conclude the index hung and
4178
- // kill it. Report each completed pass; the caller surfaces it as its own
4179
- // progress phase. Emit 0/total up front so the phase flips immediately.
4180
- // Emissions are throttled to whole-percent movement (each consumes a UI
4181
- // message); values may be fractional steps from within-pass reporting.
4182
4272
  let passesDone = 0;
4183
4273
  let lastPct = -1;
4184
4274
  const emit = (value) => {
@@ -4191,14 +4281,8 @@ whilePoolBusy) {
4191
4281
  lastPct = pct;
4192
4282
  onProgress(v, exports.SYNTH_PROGRESS_STEPS);
4193
4283
  };
4194
- // A single long pass otherwise parks the bar between steps; a pass that
4195
- // takes this callback reports a 0..1 fraction of its own work, surfaced
4196
- // here as fractional progress within its step.
4197
4284
  const subProgress = (fraction) => emit(passesDone + Math.max(0, Math.min(fraction, 1)));
4198
4285
  emit(0);
4199
- // Per-pass wall-clock timing to stderr, opt-in via CODEGRAPH_SYNTH_TIMINGS
4200
- // (=1: passes over 250ms; =all: every pass). This is the diagnostic that
4201
- // located both the #1091/#1122 watchdog stalls and the #1212 OOM — keep it.
4202
4286
  const markT = { t: Date.now() };
4203
4287
  const __mark = (label) => {
4204
4288
  const now = Date.now();
@@ -4210,22 +4294,9 @@ whilePoolBusy) {
4210
4294
  passesDone++;
4211
4295
  emit(passesDone);
4212
4296
  };
4213
- // Language gating: one indexed DISTINCT over the files table lets a pass
4214
- // whose own filters reference a specific language/extension be skipped
4215
- // outright when the project has no such files — its result is provably
4216
- // empty, so skipping is behavior-identical and the cost drops to zero
4217
- // (the Kotlin pass was the OOM culprit on the pure-C Linux kernel, #1212).
4218
- // Passes without an explicit language filter always run.
4219
4297
  const langs = queries.getDistinctFileLanguages();
4220
4298
  const has = (...ls) => ls.some((l) => langs.has(l));
4221
4299
  const NONE = [];
4222
- // Cross-file Go method→type `contains` edges must be synthesized AND persisted
4223
- // FIRST: a method declared in a different file from its receiver type is
4224
- // otherwise orphaned from the struct, and goImplementsEdges (next) derives a
4225
- // struct's method set from its `contains` edges — so without this it would
4226
- // under-count the interfaces a cross-file struct satisfies. (#583)
4227
- // Writer-side WAL backstop for the insert loops here (see the param doc):
4228
- // one fstat when under the valve's hard cap, a parked full backfill past it.
4229
4300
  const foldIfOver = async () => {
4230
4301
  const bp = backpressure?.();
4231
4302
  if (bp)
@@ -4239,11 +4310,7 @@ whilePoolBusy) {
4239
4310
  }
4240
4311
  await yieldToLoop();
4241
4312
  __mark('goMethodContains');
4242
- // Go implicit `implements` edges must be synthesized AND persisted next: the
4243
- // interface-dispatch bridge below reads `implements` edges from the DB, and
4244
- // Go has none statically. (Other languages already have static implements
4245
- // edges from extraction, so they don't need this pre-pass.)
4246
- const goImpl = has('go') ? await goImplementsEdges(queries, yieldToLoop) : NONE;
4313
+ const goImpl = has('go') ? await goImplementsEdges(queries, ctx, yieldToLoop) : NONE;
4247
4314
  for (let i = 0; i < goImpl.length; i += 2000) {
4248
4315
  queries.insertEdges(goImpl.slice(i, i + 2000));
4249
4316
  await yieldToLoop();
@@ -4251,14 +4318,6 @@ whilePoolBusy) {
4251
4318
  }
4252
4319
  await yieldToLoop();
4253
4320
  __mark('goImplements');
4254
- // Run the independent passes (see SYNTH_PASSES). Their results are merged in
4255
- // REGISTRY ORDER below regardless of execution order, and none of their edges
4256
- // persist until that merge — so every pass sees the same committed
4257
- // post-resolution DB state whether it runs sequentially here or on a resolver
4258
- // pool worker. With a live pool (already booted on ≥150k-ref repos), passes
4259
- // fan out across its read-only workers and the per-pass wall-clock comes from
4260
- // the worker; a pass that fails on a worker falls back to running on the main
4261
- // thread, so a worker crash isolates to a retry instead of failing synthesis.
4262
4321
  const passEdges = new Array(exports.SYNTH_PASSES.length).fill(NONE);
4263
4322
  const markPass = (label, dt) => {
4264
4323
  if (process.env.CODEGRAPH_SYNTH_TIMINGS && (dt > 250 || process.env.CODEGRAPH_SYNTH_TIMINGS === 'all')) {
@@ -4281,27 +4340,26 @@ whilePoolBusy) {
4281
4340
  else
4282
4341
  markPass(exports.SYNTH_PASSES[i].name, 0);
4283
4342
  }
4284
- // Above this node count, a pass that OOM-killed its worker must NOT be
4285
- // retried on the main thread — the retry would OOM the whole process and
4286
- // take the index with it (the #1212 failure class). Below it, a worker
4287
- // failure is more likely a transient crash than a memory ceiling, and the
4288
- // main-thread retry keeps coverage. Skipping loses only that pass's
4289
- // synthesized edges; the index still completes.
4290
4343
  const MAIN_RETRY_MAX_NODES = 1_500_000;
4291
4344
  const graphNodes = queries.getNodeAndEdgeCount().nodes;
4292
- // Files whose text could feed a pass (inputs that produce NO edges included,
4293
- // e.g. an over-cap channel: deleting one may make the full pass viable). It
4294
- // depends only on the files, so with a pool the main thread reads them while
4295
- // the workers run the passes instead of after.
4296
4345
  const collectInputs = async () => {
4297
- const found = [];
4346
+ const found = new Set();
4347
+ const tagModules = new Map();
4298
4348
  for (const file of ctx.getAllFiles()) {
4299
4349
  const content = ctx.readFile(file);
4300
- if (content !== null && hasSynthesisPattern(file, content))
4301
- found.push(file);
4350
+ if (content !== null && hasSynthesisPattern(file, content)) {
4351
+ found.add(file);
4352
+ if (/\bimport\s*\(/.test(content))
4353
+ for (const read of (0, react_1.lazyValueModules)(file, ctx))
4354
+ found.add(read);
4355
+ if (JSX_INPUT_FILE.test(file) && (content.includes('</') || content.includes('/>'))) {
4356
+ for (const read of importedTagModules(ctx, file, content, tagModules))
4357
+ found.add(read);
4358
+ }
4359
+ }
4302
4360
  await yieldToLoop();
4303
4361
  }
4304
- return found;
4362
+ return [...found];
4305
4363
  };
4306
4364
  let inputs = null;
4307
4365
  if (pool && gatedIn.length > 1) {
@@ -4314,22 +4372,13 @@ whilePoolBusy) {
4314
4372
  }
4315
4373
  catch (err) {
4316
4374
  if (graphNodes > MAIN_RETRY_MAX_NODES) {
4317
- // Worker died at a scale where the main-thread retry is a process
4318
- // OOM risk: skip the pass, keep the index alive, and say so.
4319
4375
  console.error(`[synthesis] pass '${pass.name}' failed on a worker at ${graphNodes} nodes — skipped (edges from this pass are absent): ${err instanceof Error ? err.message : String(err)}`);
4320
4376
  markPass(`${pass.name} (skipped at scale)`, 0);
4321
4377
  return;
4322
4378
  }
4323
- // Worker-side failure (crash, OOM, unknown pass after a version
4324
- // mismatch): retry this one pass on the main thread.
4325
4379
  await runPassOnMain(i);
4326
4380
  }
4327
4381
  };
4328
- // One pass per worker at a time, heaviest first. Handing every pass out
4329
- // at once split them by count, and a worker interleaves what it holds, so
4330
- // a heavy pass finished only with its worker's whole share: on vscode the
4331
- // 6s registry pass ended ~16s in. Pulling keeps workers busy until the
4332
- // queue drains. Edges merge by registry index below, so order is free.
4333
4382
  const lanes = Math.min(pool.size ?? gatedIn.length, gatedIn.length);
4334
4383
  const queue = [...gatedIn].sort((a, b) => synthPassCostHint(exports.SYNTH_PASSES[b].name) - synthPassCostHint(exports.SYNTH_PASSES[a].name) || a - b);
4335
4384
  const lane = async () => {
@@ -4337,8 +4386,6 @@ whilePoolBusy) {
4337
4386
  await runPooled(i);
4338
4387
  };
4339
4388
  const fanOut = Promise.all(Array.from({ length: lanes }, lane));
4340
- // Observed now, awaited below: a rejection while the scan runs must not
4341
- // surface as an unhandled one.
4342
4389
  fanOut.catch(() => undefined);
4343
4390
  whilePoolBusy?.();
4344
4391
  inputs = await collectInputs();
@@ -4349,6 +4396,12 @@ whilePoolBusy) {
4349
4396
  await runPassOnMain(i);
4350
4397
  }
4351
4398
  }
4399
+ releaseLineCaches();
4400
+ const mockNodes = manualMockNodeIds(ctx);
4401
+ const fromTestCode = (id) => {
4402
+ const source = ctx.getNodeById?.(id);
4403
+ return !source || (0, query_utils_1.isTestPath)(source.filePath);
4404
+ };
4352
4405
  const merged = [];
4353
4406
  const seen = new Set();
4354
4407
  for (const e of passEdges.flat()) {
@@ -4356,12 +4409,11 @@ whilePoolBusy) {
4356
4409
  if (seen.has(key))
4357
4410
  continue;
4358
4411
  seen.add(key);
4412
+ if (mockNodes.size > 0 && mockNodes.has(e.target) && !fromTestCode(e.source))
4413
+ continue;
4359
4414
  merged.push(e);
4360
4415
  }
4361
4416
  __mark('dedupe-merge');
4362
- // Chunked insert with yields: on the Linux kernel the merged synthesized
4363
- // edge set is ~275k rows, and one transaction for all of them was a 20s
4364
- // unyielded main-thread span (#1212 follow-up) — the last one in the tail.
4365
4417
  for (let i = 0; i < merged.length; i += 2000) {
4366
4418
  queries.insertEdges(merged.slice(i, i + 2000));
4367
4419
  await yieldToLoop();