@colbymchenry/codegraph-win32-arm64 1.6.2 → 1.6.3

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 (1036) 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 +425 -688
  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 +610 -33
  56. package/lib/dist/db/queries.d.ts.map +1 -1
  57. package/lib/dist/db/queries.js +1345 -1419
  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 +34 -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 +66 -204
  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 +145 -206
  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 +45 -4
  108. package/lib/dist/extraction/grammars.d.ts.map +1 -1
  109. package/lib/dist/extraction/grammars.js +53 -430
  110. package/lib/dist/extraction/grammars.js.map +1 -1
  111. package/lib/dist/extraction/index.d.ts +197 -7
  112. package/lib/dist/extraction/index.d.ts.map +1 -1
  113. package/lib/dist/extraction/index.js +554 -1382
  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 +25 -133
  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.js +0 -37
  124. package/lib/dist/extraction/kernel/loader.js.map +1 -1
  125. package/lib/dist/extraction/languages/arkts.js +0 -59
  126. package/lib/dist/extraction/languages/arkts.js.map +1 -1
  127. package/lib/dist/extraction/languages/c-cpp.d.ts +125 -28
  128. package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
  129. package/lib/dist/extraction/languages/c-cpp.js +789 -856
  130. package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
  131. package/lib/dist/extraction/languages/cfquery.js +0 -9
  132. package/lib/dist/extraction/languages/cfquery.js.map +1 -1
  133. package/lib/dist/extraction/languages/cfscript.d.ts +20 -0
  134. package/lib/dist/extraction/languages/cfscript.d.ts.map +1 -1
  135. package/lib/dist/extraction/languages/cfscript.js +80 -9
  136. package/lib/dist/extraction/languages/cfscript.js.map +1 -1
  137. package/lib/dist/extraction/languages/cobol.js +0 -114
  138. package/lib/dist/extraction/languages/cobol.js.map +1 -1
  139. package/lib/dist/extraction/languages/cpp-brace-scopes.d.ts +66 -0
  140. package/lib/dist/extraction/languages/cpp-brace-scopes.d.ts.map +1 -0
  141. package/lib/dist/extraction/languages/cpp-brace-scopes.js +343 -0
  142. package/lib/dist/extraction/languages/cpp-brace-scopes.js.map +1 -0
  143. package/lib/dist/extraction/languages/cpp-macro-methods.d.ts +41 -0
  144. package/lib/dist/extraction/languages/cpp-macro-methods.d.ts.map +1 -0
  145. package/lib/dist/extraction/languages/cpp-macro-methods.js +487 -0
  146. package/lib/dist/extraction/languages/cpp-macro-methods.js.map +1 -0
  147. package/lib/dist/extraction/languages/csharp.js +3 -55
  148. package/lib/dist/extraction/languages/csharp.js.map +1 -1
  149. package/lib/dist/extraction/languages/dart.d.ts +84 -0
  150. package/lib/dist/extraction/languages/dart.d.ts.map +1 -1
  151. package/lib/dist/extraction/languages/dart.js +329 -161
  152. package/lib/dist/extraction/languages/dart.js.map +1 -1
  153. package/lib/dist/extraction/languages/erlang.d.ts.map +1 -1
  154. package/lib/dist/extraction/languages/erlang.js +15 -102
  155. package/lib/dist/extraction/languages/erlang.js.map +1 -1
  156. package/lib/dist/extraction/languages/go.d.ts +48 -0
  157. package/lib/dist/extraction/languages/go.d.ts.map +1 -1
  158. package/lib/dist/extraction/languages/go.js +102 -31
  159. package/lib/dist/extraction/languages/go.js.map +1 -1
  160. package/lib/dist/extraction/languages/index.js +0 -6
  161. package/lib/dist/extraction/languages/index.js.map +1 -1
  162. package/lib/dist/extraction/languages/java.d.ts.map +1 -1
  163. package/lib/dist/extraction/languages/java.js +67 -78
  164. package/lib/dist/extraction/languages/java.js.map +1 -1
  165. package/lib/dist/extraction/languages/javascript.d.ts.map +1 -1
  166. package/lib/dist/extraction/languages/javascript.js +2 -12
  167. package/lib/dist/extraction/languages/javascript.js.map +1 -1
  168. package/lib/dist/extraction/languages/kotlin.d.ts +11 -0
  169. package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -1
  170. package/lib/dist/extraction/languages/kotlin.js +35 -184
  171. package/lib/dist/extraction/languages/kotlin.js.map +1 -1
  172. package/lib/dist/extraction/languages/lua.js +2 -39
  173. package/lib/dist/extraction/languages/lua.js.map +1 -1
  174. package/lib/dist/extraction/languages/luau.js +0 -14
  175. package/lib/dist/extraction/languages/luau.js.map +1 -1
  176. package/lib/dist/extraction/languages/nix.js +0 -16
  177. package/lib/dist/extraction/languages/nix.js.map +1 -1
  178. package/lib/dist/extraction/languages/objc.d.ts.map +1 -1
  179. package/lib/dist/extraction/languages/objc.js +5 -16
  180. package/lib/dist/extraction/languages/objc.js.map +1 -1
  181. package/lib/dist/extraction/languages/pascal-preparse.d.ts +66 -0
  182. package/lib/dist/extraction/languages/pascal-preparse.d.ts.map +1 -0
  183. package/lib/dist/extraction/languages/pascal-preparse.js +958 -0
  184. package/lib/dist/extraction/languages/pascal-preparse.js.map +1 -0
  185. package/lib/dist/extraction/languages/pascal-system.d.ts +11 -0
  186. package/lib/dist/extraction/languages/pascal-system.d.ts.map +1 -0
  187. package/lib/dist/extraction/languages/pascal-system.js +23 -0
  188. package/lib/dist/extraction/languages/pascal-system.js.map +1 -0
  189. package/lib/dist/extraction/languages/pascal.d.ts.map +1 -1
  190. package/lib/dist/extraction/languages/pascal.js +3 -4
  191. package/lib/dist/extraction/languages/pascal.js.map +1 -1
  192. package/lib/dist/extraction/languages/php.js +5 -42
  193. package/lib/dist/extraction/languages/php.js.map +1 -1
  194. package/lib/dist/extraction/languages/python.js +2 -20
  195. package/lib/dist/extraction/languages/python.js.map +1 -1
  196. package/lib/dist/extraction/languages/r.js +8 -78
  197. package/lib/dist/extraction/languages/r.js.map +1 -1
  198. package/lib/dist/extraction/languages/ruby.d.ts.map +1 -1
  199. package/lib/dist/extraction/languages/ruby.js +17 -25
  200. package/lib/dist/extraction/languages/ruby.js.map +1 -1
  201. package/lib/dist/extraction/languages/rust.d.ts +10 -0
  202. package/lib/dist/extraction/languages/rust.d.ts.map +1 -1
  203. package/lib/dist/extraction/languages/rust.js +15 -47
  204. package/lib/dist/extraction/languages/rust.js.map +1 -1
  205. package/lib/dist/extraction/languages/scala.js +5 -41
  206. package/lib/dist/extraction/languages/scala.js.map +1 -1
  207. package/lib/dist/extraction/languages/solidity.js +1 -82
  208. package/lib/dist/extraction/languages/solidity.js.map +1 -1
  209. package/lib/dist/extraction/languages/swift.js +3 -47
  210. package/lib/dist/extraction/languages/swift.js.map +1 -1
  211. package/lib/dist/extraction/languages/terraform.js +6 -152
  212. package/lib/dist/extraction/languages/terraform.js.map +1 -1
  213. package/lib/dist/extraction/languages/typescript.d.ts +64 -0
  214. package/lib/dist/extraction/languages/typescript.d.ts.map +1 -1
  215. package/lib/dist/extraction/languages/typescript.js +73 -49
  216. package/lib/dist/extraction/languages/typescript.js.map +1 -1
  217. package/lib/dist/extraction/languages/vbnet.d.ts.map +1 -1
  218. package/lib/dist/extraction/languages/vbnet.js +9 -42
  219. package/lib/dist/extraction/languages/vbnet.js.map +1 -1
  220. package/lib/dist/extraction/lazy-frameworks.d.ts +15 -0
  221. package/lib/dist/extraction/lazy-frameworks.d.ts.map +1 -0
  222. package/lib/dist/extraction/lazy-frameworks.js +8 -0
  223. package/lib/dist/extraction/lazy-frameworks.js.map +1 -0
  224. package/lib/dist/extraction/liquid-extractor.d.ts +29 -3
  225. package/lib/dist/extraction/liquid-extractor.d.ts.map +1 -1
  226. package/lib/dist/extraction/liquid-extractor.js +89 -148
  227. package/lib/dist/extraction/liquid-extractor.js.map +1 -1
  228. package/lib/dist/extraction/mybatis-extractor.js +0 -78
  229. package/lib/dist/extraction/mybatis-extractor.js.map +1 -1
  230. package/lib/dist/extraction/parse-budget.js +0 -13
  231. package/lib/dist/extraction/parse-budget.js.map +1 -1
  232. package/lib/dist/extraction/parse-pool.d.ts +29 -5
  233. package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
  234. package/lib/dist/extraction/parse-pool.js +42 -174
  235. package/lib/dist/extraction/parse-pool.js.map +1 -1
  236. package/lib/dist/extraction/parse-worker.d.ts +1 -1
  237. package/lib/dist/extraction/parse-worker.d.ts.map +1 -1
  238. package/lib/dist/extraction/parse-worker.js +5 -58
  239. package/lib/dist/extraction/parse-worker.js.map +1 -1
  240. package/lib/dist/extraction/razor-extractor.d.ts +9 -0
  241. package/lib/dist/extraction/razor-extractor.d.ts.map +1 -1
  242. package/lib/dist/extraction/razor-extractor.js +45 -69
  243. package/lib/dist/extraction/razor-extractor.js.map +1 -1
  244. package/lib/dist/extraction/razor-script.d.ts +23 -0
  245. package/lib/dist/extraction/razor-script.d.ts.map +1 -0
  246. package/lib/dist/extraction/razor-script.js +244 -0
  247. package/lib/dist/extraction/razor-script.js.map +1 -0
  248. package/lib/dist/extraction/sfc-script.d.ts +42 -0
  249. package/lib/dist/extraction/sfc-script.d.ts.map +1 -1
  250. package/lib/dist/extraction/sfc-script.js +32 -31
  251. package/lib/dist/extraction/sfc-script.js.map +1 -1
  252. package/lib/dist/extraction/store-worker.d.ts +1 -1
  253. package/lib/dist/extraction/store-worker.d.ts.map +1 -1
  254. package/lib/dist/extraction/store-worker.js +1 -38
  255. package/lib/dist/extraction/store-worker.js.map +1 -1
  256. package/lib/dist/extraction/store-writer.js +2 -34
  257. package/lib/dist/extraction/store-writer.js.map +1 -1
  258. package/lib/dist/extraction/svelte-extractor.d.ts.map +1 -1
  259. package/lib/dist/extraction/svelte-extractor.js +11 -87
  260. package/lib/dist/extraction/svelte-extractor.js.map +1 -1
  261. package/lib/dist/extraction/syntax-tokens.d.ts +6 -5
  262. package/lib/dist/extraction/syntax-tokens.d.ts.map +1 -1
  263. package/lib/dist/extraction/syntax-tokens.js +4 -152
  264. package/lib/dist/extraction/syntax-tokens.js.map +1 -1
  265. package/lib/dist/extraction/tree-sitter-helpers.d.ts +37 -1
  266. package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
  267. package/lib/dist/extraction/tree-sitter-helpers.js +76 -68
  268. package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -1
  269. package/lib/dist/extraction/tree-sitter-types.d.ts +102 -22
  270. package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
  271. package/lib/dist/extraction/tree-sitter-types.js +0 -7
  272. package/lib/dist/extraction/tree-sitter-types.js.map +1 -1
  273. package/lib/dist/extraction/tree-sitter.d.ts +447 -9
  274. package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
  275. package/lib/dist/extraction/tree-sitter.js +1908 -2544
  276. package/lib/dist/extraction/tree-sitter.js.map +1 -1
  277. package/lib/dist/extraction/vue-extractor.d.ts +13 -0
  278. package/lib/dist/extraction/vue-extractor.d.ts.map +1 -1
  279. package/lib/dist/extraction/vue-extractor.js +52 -92
  280. package/lib/dist/extraction/vue-extractor.js.map +1 -1
  281. package/lib/dist/extraction/vue-options-api.js +0 -32
  282. package/lib/dist/extraction/vue-options-api.js.map +1 -1
  283. package/lib/dist/extraction/vue-template-calls.d.ts +37 -0
  284. package/lib/dist/extraction/vue-template-calls.d.ts.map +1 -0
  285. package/lib/dist/extraction/vue-template-calls.js +497 -0
  286. package/lib/dist/extraction/vue-template-calls.js.map +1 -0
  287. package/lib/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
  288. package/lib/dist/extraction/wasm-runtime-flags.d.ts +6 -0
  289. package/lib/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
  290. package/lib/dist/extraction/wasm-runtime-flags.js +1 -88
  291. package/lib/dist/extraction/wasm-runtime-flags.js.map +1 -1
  292. package/lib/dist/file-limits.d.ts +8 -0
  293. package/lib/dist/file-limits.d.ts.map +1 -1
  294. package/lib/dist/file-limits.js +13 -28
  295. package/lib/dist/file-limits.js.map +1 -1
  296. package/lib/dist/graph/branch-guards.d.ts.map +1 -1
  297. package/lib/dist/graph/branch-guards.js +4 -251
  298. package/lib/dist/graph/branch-guards.js.map +1 -1
  299. package/lib/dist/graph/call-sites.d.ts +12 -0
  300. package/lib/dist/graph/call-sites.d.ts.map +1 -0
  301. package/lib/dist/graph/call-sites.js +17 -0
  302. package/lib/dist/graph/call-sites.js.map +1 -0
  303. package/lib/dist/graph/cobol-copybooks.d.ts +75 -0
  304. package/lib/dist/graph/cobol-copybooks.d.ts.map +1 -0
  305. package/lib/dist/graph/cobol-copybooks.js +45 -0
  306. package/lib/dist/graph/cobol-copybooks.js.map +1 -0
  307. package/lib/dist/graph/dead-code.d.ts +26 -4
  308. package/lib/dist/graph/dead-code.d.ts.map +1 -1
  309. package/lib/dist/graph/dead-code.js +157 -311
  310. package/lib/dist/graph/dead-code.js.map +1 -1
  311. package/lib/dist/graph/dynamic-boundary-report.js +1 -88
  312. package/lib/dist/graph/dynamic-boundary-report.js.map +1 -1
  313. package/lib/dist/graph/file-cycles.d.ts +20 -0
  314. package/lib/dist/graph/file-cycles.d.ts.map +1 -0
  315. package/lib/dist/graph/file-cycles.js +79 -0
  316. package/lib/dist/graph/file-cycles.js.map +1 -0
  317. package/lib/dist/graph/go-package.d.ts +27 -0
  318. package/lib/dist/graph/go-package.d.ts.map +1 -0
  319. package/lib/dist/graph/go-package.js +49 -0
  320. package/lib/dist/graph/go-package.js.map +1 -0
  321. package/lib/dist/graph/index.d.ts +2 -0
  322. package/lib/dist/graph/index.d.ts.map +1 -1
  323. package/lib/dist/graph/index.js +4 -6
  324. package/lib/dist/graph/index.js.map +1 -1
  325. package/lib/dist/graph/named-symbol-flow.d.ts +5 -1
  326. package/lib/dist/graph/named-symbol-flow.d.ts.map +1 -1
  327. package/lib/dist/graph/named-symbol-flow.js +82 -223
  328. package/lib/dist/graph/named-symbol-flow.js.map +1 -1
  329. package/lib/dist/graph/owning-package.d.ts +59 -0
  330. package/lib/dist/graph/owning-package.d.ts.map +1 -0
  331. package/lib/dist/graph/owning-package.js +120 -0
  332. package/lib/dist/graph/owning-package.js.map +1 -0
  333. package/lib/dist/graph/queries.d.ts +2 -2
  334. package/lib/dist/graph/queries.d.ts.map +1 -1
  335. package/lib/dist/graph/queries.js +2 -135
  336. package/lib/dist/graph/queries.js.map +1 -1
  337. package/lib/dist/graph/symbol-lookup.d.ts +15 -3
  338. package/lib/dist/graph/symbol-lookup.d.ts.map +1 -1
  339. package/lib/dist/graph/symbol-lookup.js +47 -89
  340. package/lib/dist/graph/symbol-lookup.js.map +1 -1
  341. package/lib/dist/graph/synthesized-hop.d.ts +37 -0
  342. package/lib/dist/graph/synthesized-hop.d.ts.map +1 -0
  343. package/lib/dist/graph/synthesized-hop.js +62 -0
  344. package/lib/dist/graph/synthesized-hop.js.map +1 -0
  345. package/lib/dist/graph/test-code.d.ts +21 -0
  346. package/lib/dist/graph/test-code.d.ts.map +1 -0
  347. package/lib/dist/graph/test-code.js +50 -0
  348. package/lib/dist/graph/test-code.js.map +1 -0
  349. package/lib/dist/graph/traversal.d.ts +31 -2
  350. package/lib/dist/graph/traversal.d.ts.map +1 -1
  351. package/lib/dist/graph/traversal.js +98 -226
  352. package/lib/dist/graph/traversal.js.map +1 -1
  353. package/lib/dist/graph/type-hierarchy.js +0 -138
  354. package/lib/dist/graph/type-hierarchy.js.map +1 -1
  355. package/lib/dist/index.d.ts +190 -25
  356. package/lib/dist/index.d.ts.map +1 -1
  357. package/lib/dist/index.js +694 -1109
  358. package/lib/dist/index.js.map +1 -1
  359. package/lib/dist/installer/beta-signup.js +0 -39
  360. package/lib/dist/installer/beta-signup.js.map +1 -1
  361. package/lib/dist/installer/config-writer.js +0 -24
  362. package/lib/dist/installer/config-writer.js.map +1 -1
  363. package/lib/dist/installer/index.d.ts +9 -5
  364. package/lib/dist/installer/index.d.ts.map +1 -1
  365. package/lib/dist/installer/index.js +25 -159
  366. package/lib/dist/installer/index.js.map +1 -1
  367. package/lib/dist/installer/instructions-template.d.ts +1 -1
  368. package/lib/dist/installer/instructions-template.js +0 -37
  369. package/lib/dist/installer/instructions-template.js.map +1 -1
  370. package/lib/dist/installer/targets/antigravity.js +0 -113
  371. package/lib/dist/installer/targets/antigravity.js.map +1 -1
  372. package/lib/dist/installer/targets/bob.d.ts +20 -0
  373. package/lib/dist/installer/targets/bob.d.ts.map +1 -0
  374. package/lib/dist/installer/targets/bob.js +83 -0
  375. package/lib/dist/installer/targets/bob.js.map +1 -0
  376. package/lib/dist/installer/targets/claude.d.ts.map +1 -1
  377. package/lib/dist/installer/targets/claude.js +1 -185
  378. package/lib/dist/installer/targets/claude.js.map +1 -1
  379. package/lib/dist/installer/targets/codex.d.ts.map +1 -1
  380. package/lib/dist/installer/targets/codex.js +17 -109
  381. package/lib/dist/installer/targets/codex.js.map +1 -1
  382. package/lib/dist/installer/targets/copilot-cli.d.ts.map +1 -1
  383. package/lib/dist/installer/targets/copilot-cli.js +2 -54
  384. package/lib/dist/installer/targets/copilot-cli.js.map +1 -1
  385. package/lib/dist/installer/targets/copilot-jetbrains.js +0 -57
  386. package/lib/dist/installer/targets/copilot-jetbrains.js.map +1 -1
  387. package/lib/dist/installer/targets/copilot-vscode.js +0 -58
  388. package/lib/dist/installer/targets/copilot-vscode.js.map +1 -1
  389. package/lib/dist/installer/targets/cursor.js +7 -88
  390. package/lib/dist/installer/targets/cursor.js.map +1 -1
  391. package/lib/dist/installer/targets/droid.d.ts +18 -0
  392. package/lib/dist/installer/targets/droid.d.ts.map +1 -0
  393. package/lib/dist/installer/targets/droid.js +92 -0
  394. package/lib/dist/installer/targets/droid.js.map +1 -0
  395. package/lib/dist/installer/targets/dsh.d.ts +35 -0
  396. package/lib/dist/installer/targets/dsh.d.ts.map +1 -0
  397. package/lib/dist/installer/targets/dsh.js +267 -0
  398. package/lib/dist/installer/targets/dsh.js.map +1 -0
  399. package/lib/dist/installer/targets/gemini.js +0 -37
  400. package/lib/dist/installer/targets/gemini.js.map +1 -1
  401. package/lib/dist/installer/targets/grok.d.ts +25 -0
  402. package/lib/dist/installer/targets/grok.d.ts.map +1 -0
  403. package/lib/dist/installer/targets/grok.js +96 -0
  404. package/lib/dist/installer/targets/grok.js.map +1 -0
  405. package/lib/dist/installer/targets/hermes.d.ts +19 -7
  406. package/lib/dist/installer/targets/hermes.d.ts.map +1 -1
  407. package/lib/dist/installer/targets/hermes.js +218 -214
  408. package/lib/dist/installer/targets/hermes.js.map +1 -1
  409. package/lib/dist/installer/targets/json-config.d.ts +45 -0
  410. package/lib/dist/installer/targets/json-config.d.ts.map +1 -0
  411. package/lib/dist/installer/targets/json-config.js +128 -0
  412. package/lib/dist/installer/targets/json-config.js.map +1 -0
  413. package/lib/dist/installer/targets/kimi.d.ts +21 -0
  414. package/lib/dist/installer/targets/kimi.d.ts.map +1 -0
  415. package/lib/dist/installer/targets/kimi.js +97 -0
  416. package/lib/dist/installer/targets/kimi.js.map +1 -0
  417. package/lib/dist/installer/targets/kiro.js +1 -41
  418. package/lib/dist/installer/targets/kiro.js.map +1 -1
  419. package/lib/dist/installer/targets/opencode.js +0 -102
  420. package/lib/dist/installer/targets/opencode.js.map +1 -1
  421. package/lib/dist/installer/targets/pi.d.ts +24 -0
  422. package/lib/dist/installer/targets/pi.d.ts.map +1 -0
  423. package/lib/dist/installer/targets/pi.js +100 -0
  424. package/lib/dist/installer/targets/pi.js.map +1 -0
  425. package/lib/dist/installer/targets/qoder.d.ts +23 -0
  426. package/lib/dist/installer/targets/qoder.d.ts.map +1 -0
  427. package/lib/dist/installer/targets/qoder.js +83 -0
  428. package/lib/dist/installer/targets/qoder.js.map +1 -0
  429. package/lib/dist/installer/targets/qwen.d.ts +21 -0
  430. package/lib/dist/installer/targets/qwen.d.ts.map +1 -0
  431. package/lib/dist/installer/targets/qwen.js +115 -0
  432. package/lib/dist/installer/targets/qwen.js.map +1 -0
  433. package/lib/dist/installer/targets/registry.d.ts.map +1 -1
  434. package/lib/dist/installer/targets/registry.js +18 -25
  435. package/lib/dist/installer/targets/registry.js.map +1 -1
  436. package/lib/dist/installer/targets/shared.d.ts +81 -11
  437. package/lib/dist/installer/targets/shared.d.ts.map +1 -1
  438. package/lib/dist/installer/targets/shared.js +183 -129
  439. package/lib/dist/installer/targets/shared.js.map +1 -1
  440. package/lib/dist/installer/targets/toml.d.ts +82 -6
  441. package/lib/dist/installer/targets/toml.d.ts.map +1 -1
  442. package/lib/dist/installer/targets/toml.js +318 -112
  443. package/lib/dist/installer/targets/toml.js.map +1 -1
  444. package/lib/dist/installer/targets/types.d.ts +1 -1
  445. package/lib/dist/installer/targets/types.d.ts.map +1 -1
  446. package/lib/dist/installer/targets/types.js +0 -13
  447. package/lib/dist/installer/targets/types.js.map +1 -1
  448. package/lib/dist/installer/targets/windsurf.d.ts +22 -0
  449. package/lib/dist/installer/targets/windsurf.d.ts.map +1 -0
  450. package/lib/dist/installer/targets/windsurf.js +90 -0
  451. package/lib/dist/installer/targets/windsurf.js.map +1 -0
  452. package/lib/dist/lazy-engine.d.ts +22 -0
  453. package/lib/dist/lazy-engine.d.ts.map +1 -0
  454. package/lib/dist/lazy-engine.js +16 -0
  455. package/lib/dist/lazy-engine.js.map +1 -0
  456. package/lib/dist/mcp/answer-freshness.js +0 -6
  457. package/lib/dist/mcp/answer-freshness.js.map +1 -1
  458. package/lib/dist/mcp/daemon-manager.js +2 -23
  459. package/lib/dist/mcp/daemon-manager.js.map +1 -1
  460. package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
  461. package/lib/dist/mcp/daemon-paths.js +2 -85
  462. package/lib/dist/mcp/daemon-paths.js.map +1 -1
  463. package/lib/dist/mcp/daemon-registry.d.ts +40 -0
  464. package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
  465. package/lib/dist/mcp/daemon-registry.js +174 -137
  466. package/lib/dist/mcp/daemon-registry.js.map +1 -1
  467. package/lib/dist/mcp/daemon.d.ts +23 -0
  468. package/lib/dist/mcp/daemon.d.ts.map +1 -1
  469. package/lib/dist/mcp/daemon.js +89 -373
  470. package/lib/dist/mcp/daemon.js.map +1 -1
  471. package/lib/dist/mcp/dynamic-boundaries.js +4 -78
  472. package/lib/dist/mcp/dynamic-boundaries.js.map +1 -1
  473. package/lib/dist/mcp/early-ppid.js +0 -24
  474. package/lib/dist/mcp/early-ppid.js.map +1 -1
  475. package/lib/dist/mcp/engine.d.ts +8 -0
  476. package/lib/dist/mcp/engine.d.ts.map +1 -1
  477. package/lib/dist/mcp/engine.js +33 -152
  478. package/lib/dist/mcp/engine.js.map +1 -1
  479. package/lib/dist/mcp/explore-dedup.js +0 -108
  480. package/lib/dist/mcp/explore-dedup.js.map +1 -1
  481. package/lib/dist/mcp/explore-diagnostics.js +0 -116
  482. package/lib/dist/mcp/explore-diagnostics.js.map +1 -1
  483. package/lib/dist/mcp/explore-session-state.js +0 -129
  484. package/lib/dist/mcp/explore-session-state.js.map +1 -1
  485. package/lib/dist/mcp/index-freshness-worker.js +1 -6
  486. package/lib/dist/mcp/index-freshness-worker.js.map +1 -1
  487. package/lib/dist/mcp/index-freshness.js +0 -15
  488. package/lib/dist/mcp/index-freshness.js.map +1 -1
  489. package/lib/dist/mcp/index-version-warning.d.ts +21 -0
  490. package/lib/dist/mcp/index-version-warning.d.ts.map +1 -0
  491. package/lib/dist/mcp/index-version-warning.js +38 -0
  492. package/lib/dist/mcp/index-version-warning.js.map +1 -0
  493. package/lib/dist/mcp/index.d.ts +19 -1
  494. package/lib/dist/mcp/index.d.ts.map +1 -1
  495. package/lib/dist/mcp/index.js +118 -293
  496. package/lib/dist/mcp/index.js.map +1 -1
  497. package/lib/dist/mcp/liveness-watchdog.d.ts +13 -3
  498. package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
  499. package/lib/dist/mcp/liveness-watchdog.js +106 -121
  500. package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
  501. package/lib/dist/mcp/ppid-watchdog.js +0 -24
  502. package/lib/dist/mcp/ppid-watchdog.js.map +1 -1
  503. package/lib/dist/mcp/process-identity.d.ts +42 -0
  504. package/lib/dist/mcp/process-identity.d.ts.map +1 -0
  505. package/lib/dist/mcp/process-identity.js +130 -0
  506. package/lib/dist/mcp/process-identity.js.map +1 -0
  507. package/lib/dist/mcp/project-lifecycle.d.ts.map +1 -1
  508. package/lib/dist/mcp/project-lifecycle.js +50 -17
  509. package/lib/dist/mcp/project-lifecycle.js.map +1 -1
  510. package/lib/dist/mcp/proxy.d.ts +17 -6
  511. package/lib/dist/mcp/proxy.d.ts.map +1 -1
  512. package/lib/dist/mcp/proxy.js +74 -248
  513. package/lib/dist/mcp/proxy.js.map +1 -1
  514. package/lib/dist/mcp/query-pool.d.ts +43 -3
  515. package/lib/dist/mcp/query-pool.d.ts.map +1 -1
  516. package/lib/dist/mcp/query-pool.js +109 -123
  517. package/lib/dist/mcp/query-pool.js.map +1 -1
  518. package/lib/dist/mcp/query-worker.js +24 -36
  519. package/lib/dist/mcp/query-worker.js.map +1 -1
  520. package/lib/dist/mcp/server-instructions.js +0 -31
  521. package/lib/dist/mcp/server-instructions.js.map +1 -1
  522. package/lib/dist/mcp/session.d.ts +27 -0
  523. package/lib/dist/mcp/session.d.ts.map +1 -1
  524. package/lib/dist/mcp/session.js +29 -130
  525. package/lib/dist/mcp/session.js.map +1 -1
  526. package/lib/dist/mcp/startup-handshake.js +1 -48
  527. package/lib/dist/mcp/startup-handshake.js.map +1 -1
  528. package/lib/dist/mcp/stdin-teardown.js +0 -28
  529. package/lib/dist/mcp/stdin-teardown.js.map +1 -1
  530. package/lib/dist/mcp/stdout-teardown.d.ts +26 -0
  531. package/lib/dist/mcp/stdout-teardown.d.ts.map +1 -0
  532. package/lib/dist/mcp/stdout-teardown.js +20 -0
  533. package/lib/dist/mcp/stdout-teardown.js.map +1 -0
  534. package/lib/dist/mcp/tools.d.ts +127 -18
  535. package/lib/dist/mcp/tools.d.ts.map +1 -1
  536. package/lib/dist/mcp/tools.js +661 -3590
  537. package/lib/dist/mcp/tools.js.map +1 -1
  538. package/lib/dist/mcp/transport.d.ts.map +1 -1
  539. package/lib/dist/mcp/transport.js +4 -96
  540. package/lib/dist/mcp/transport.js.map +1 -1
  541. package/lib/dist/mcp/version.d.ts +13 -1
  542. package/lib/dist/mcp/version.d.ts.map +1 -1
  543. package/lib/dist/mcp/version.js +19 -21
  544. package/lib/dist/mcp/version.js.map +1 -1
  545. package/lib/dist/mcp/writer-lock.d.ts +11 -0
  546. package/lib/dist/mcp/writer-lock.d.ts.map +1 -1
  547. package/lib/dist/mcp/writer-lock.js +49 -46
  548. package/lib/dist/mcp/writer-lock.js.map +1 -1
  549. package/lib/dist/project-config.js +1 -138
  550. package/lib/dist/project-config.js.map +1 -1
  551. package/lib/dist/resolution/alias-binding.d.ts +7 -0
  552. package/lib/dist/resolution/alias-binding.d.ts.map +1 -1
  553. package/lib/dist/resolution/alias-binding.js +7 -56
  554. package/lib/dist/resolution/alias-binding.js.map +1 -1
  555. package/lib/dist/resolution/ambient-modules.d.ts +185 -0
  556. package/lib/dist/resolution/ambient-modules.d.ts.map +1 -0
  557. package/lib/dist/resolution/ambient-modules.js +732 -0
  558. package/lib/dist/resolution/ambient-modules.js.map +1 -0
  559. package/lib/dist/resolution/angular-template-synthesizer.d.ts +48 -1
  560. package/lib/dist/resolution/angular-template-synthesizer.d.ts.map +1 -1
  561. package/lib/dist/resolution/angular-template-synthesizer.js +401 -65
  562. package/lib/dist/resolution/angular-template-synthesizer.js.map +1 -1
  563. package/lib/dist/resolution/c-feature-variants.d.ts +40 -0
  564. package/lib/dist/resolution/c-feature-variants.d.ts.map +1 -0
  565. package/lib/dist/resolution/c-feature-variants.js +249 -0
  566. package/lib/dist/resolution/c-feature-variants.js.map +1 -0
  567. package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
  568. package/lib/dist/resolution/c-fnptr-synthesizer.js +23 -391
  569. package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
  570. package/lib/dist/resolution/c-macro-renames.d.ts +25 -0
  571. package/lib/dist/resolution/c-macro-renames.d.ts.map +1 -0
  572. package/lib/dist/resolution/c-macro-renames.js +95 -0
  573. package/lib/dist/resolution/c-macro-renames.js.map +1 -0
  574. package/lib/dist/resolution/callback-synthesizer.d.ts +15 -1
  575. package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
  576. package/lib/dist/resolution/callback-synthesizer.js +1355 -1270
  577. package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
  578. package/lib/dist/resolution/const-alias-synthesizer.d.ts +48 -0
  579. package/lib/dist/resolution/const-alias-synthesizer.d.ts.map +1 -0
  580. package/lib/dist/resolution/const-alias-synthesizer.js +234 -0
  581. package/lib/dist/resolution/const-alias-synthesizer.js.map +1 -0
  582. package/lib/dist/resolution/cooperative-yield.js +0 -27
  583. package/lib/dist/resolution/cooperative-yield.js.map +1 -1
  584. package/lib/dist/resolution/cpp-constructor.d.ts.map +1 -1
  585. package/lib/dist/resolution/cpp-constructor.js +15 -17
  586. package/lib/dist/resolution/cpp-constructor.js.map +1 -1
  587. package/lib/dist/resolution/cpp-includers.d.ts +46 -0
  588. package/lib/dist/resolution/cpp-includers.d.ts.map +1 -0
  589. package/lib/dist/resolution/cpp-includers.js +153 -0
  590. package/lib/dist/resolution/cpp-includers.js.map +1 -0
  591. package/lib/dist/resolution/cpp-macro-visibility.d.ts +16 -0
  592. package/lib/dist/resolution/cpp-macro-visibility.d.ts.map +1 -1
  593. package/lib/dist/resolution/cpp-macro-visibility.js +17 -68
  594. package/lib/dist/resolution/cpp-macro-visibility.js.map +1 -1
  595. package/lib/dist/resolution/cpp-namespaces.d.ts +54 -0
  596. package/lib/dist/resolution/cpp-namespaces.d.ts.map +1 -0
  597. package/lib/dist/resolution/cpp-namespaces.js +151 -0
  598. package/lib/dist/resolution/cpp-namespaces.js.map +1 -0
  599. package/lib/dist/resolution/cpp-raw-strings.d.ts +33 -0
  600. package/lib/dist/resolution/cpp-raw-strings.d.ts.map +1 -0
  601. package/lib/dist/resolution/cpp-raw-strings.js +167 -0
  602. package/lib/dist/resolution/cpp-raw-strings.js.map +1 -0
  603. package/lib/dist/resolution/cpp-supertypes.d.ts +118 -0
  604. package/lib/dist/resolution/cpp-supertypes.d.ts.map +1 -0
  605. package/lib/dist/resolution/cpp-supertypes.js +322 -0
  606. package/lib/dist/resolution/cpp-supertypes.js.map +1 -0
  607. package/lib/dist/resolution/cpp-template-instantiations.d.ts +83 -0
  608. package/lib/dist/resolution/cpp-template-instantiations.d.ts.map +1 -0
  609. package/lib/dist/resolution/cpp-template-instantiations.js +983 -0
  610. package/lib/dist/resolution/cpp-template-instantiations.js.map +1 -0
  611. package/lib/dist/resolution/cpp-type-aliases.d.ts +194 -0
  612. package/lib/dist/resolution/cpp-type-aliases.d.ts.map +1 -0
  613. package/lib/dist/resolution/cpp-type-aliases.js +648 -0
  614. package/lib/dist/resolution/cpp-type-aliases.js.map +1 -0
  615. package/lib/dist/resolution/dart-libraries.d.ts +75 -0
  616. package/lib/dist/resolution/dart-libraries.d.ts.map +1 -0
  617. package/lib/dist/resolution/dart-libraries.js +721 -0
  618. package/lib/dist/resolution/dart-libraries.js.map +1 -0
  619. package/lib/dist/resolution/dart-local-scope.d.ts +41 -0
  620. package/lib/dist/resolution/dart-local-scope.d.ts.map +1 -0
  621. package/lib/dist/resolution/dart-local-scope.js +565 -0
  622. package/lib/dist/resolution/dart-local-scope.js.map +1 -0
  623. package/lib/dist/resolution/expo-router-synthesizer.js +0 -52
  624. package/lib/dist/resolution/expo-router-synthesizer.js.map +1 -1
  625. package/lib/dist/resolution/frameworks/angular-router.d.ts.map +1 -1
  626. package/lib/dist/resolution/frameworks/angular-router.js +41 -208
  627. package/lib/dist/resolution/frameworks/angular-router.js.map +1 -1
  628. package/lib/dist/resolution/frameworks/astro.d.ts.map +1 -1
  629. package/lib/dist/resolution/frameworks/astro.js +4 -60
  630. package/lib/dist/resolution/frameworks/astro.js.map +1 -1
  631. package/lib/dist/resolution/frameworks/cargo-workspace.d.ts +18 -1
  632. package/lib/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -1
  633. package/lib/dist/resolution/frameworks/cargo-workspace.js +65 -15
  634. package/lib/dist/resolution/frameworks/cargo-workspace.js.map +1 -1
  635. package/lib/dist/resolution/frameworks/cics.d.ts.map +1 -1
  636. package/lib/dist/resolution/frameworks/cics.js +7 -33
  637. package/lib/dist/resolution/frameworks/cics.js.map +1 -1
  638. package/lib/dist/resolution/frameworks/codeigniter.d.ts +23 -0
  639. package/lib/dist/resolution/frameworks/codeigniter.d.ts.map +1 -0
  640. package/lib/dist/resolution/frameworks/codeigniter.js +271 -0
  641. package/lib/dist/resolution/frameworks/codeigniter.js.map +1 -0
  642. package/lib/dist/resolution/frameworks/component-folder.d.ts +17 -0
  643. package/lib/dist/resolution/frameworks/component-folder.d.ts.map +1 -0
  644. package/lib/dist/resolution/frameworks/component-folder.js +11 -0
  645. package/lib/dist/resolution/frameworks/component-folder.js.map +1 -0
  646. package/lib/dist/resolution/frameworks/csharp.d.ts.map +1 -1
  647. package/lib/dist/resolution/frameworks/csharp.js +5 -68
  648. package/lib/dist/resolution/frameworks/csharp.js.map +1 -1
  649. package/lib/dist/resolution/frameworks/drupal.d.ts +17 -8
  650. package/lib/dist/resolution/frameworks/drupal.d.ts.map +1 -1
  651. package/lib/dist/resolution/frameworks/drupal.js +377 -142
  652. package/lib/dist/resolution/frameworks/drupal.js.map +1 -1
  653. package/lib/dist/resolution/frameworks/expo-modules.d.ts.map +1 -1
  654. package/lib/dist/resolution/frameworks/expo-modules.js +8 -88
  655. package/lib/dist/resolution/frameworks/expo-modules.js.map +1 -1
  656. package/lib/dist/resolution/frameworks/expo-router.d.ts.map +1 -1
  657. package/lib/dist/resolution/frameworks/expo-router.js +9 -190
  658. package/lib/dist/resolution/frameworks/expo-router.js.map +1 -1
  659. package/lib/dist/resolution/frameworks/express.d.ts.map +1 -1
  660. package/lib/dist/resolution/frameworks/express.js +182 -199
  661. package/lib/dist/resolution/frameworks/express.js.map +1 -1
  662. package/lib/dist/resolution/frameworks/fabric.js +1 -104
  663. package/lib/dist/resolution/frameworks/fabric.js.map +1 -1
  664. package/lib/dist/resolution/frameworks/go.d.ts.map +1 -1
  665. package/lib/dist/resolution/frameworks/go.js +14 -43
  666. package/lib/dist/resolution/frameworks/go.js.map +1 -1
  667. package/lib/dist/resolution/frameworks/goframe.js +1 -55
  668. package/lib/dist/resolution/frameworks/goframe.js.map +1 -1
  669. package/lib/dist/resolution/frameworks/index.d.ts +13 -0
  670. package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
  671. package/lib/dist/resolution/frameworks/index.js +12 -50
  672. package/lib/dist/resolution/frameworks/index.js.map +1 -1
  673. package/lib/dist/resolution/frameworks/java.d.ts.map +1 -1
  674. package/lib/dist/resolution/frameworks/java.js +203 -129
  675. package/lib/dist/resolution/frameworks/java.js.map +1 -1
  676. package/lib/dist/resolution/frameworks/laravel.js +2 -125
  677. package/lib/dist/resolution/frameworks/laravel.js.map +1 -1
  678. package/lib/dist/resolution/frameworks/name-heuristic.js +0 -12
  679. package/lib/dist/resolution/frameworks/name-heuristic.js.map +1 -1
  680. package/lib/dist/resolution/frameworks/nestjs.js +2 -199
  681. package/lib/dist/resolution/frameworks/nestjs.js.map +1 -1
  682. package/lib/dist/resolution/frameworks/next-proxy.d.ts +67 -0
  683. package/lib/dist/resolution/frameworks/next-proxy.d.ts.map +1 -0
  684. package/lib/dist/resolution/frameworks/next-proxy.js +239 -0
  685. package/lib/dist/resolution/frameworks/next-proxy.js.map +1 -0
  686. package/lib/dist/resolution/frameworks/nextjs.d.ts.map +1 -1
  687. package/lib/dist/resolution/frameworks/nextjs.js +10 -66
  688. package/lib/dist/resolution/frameworks/nextjs.js.map +1 -1
  689. package/lib/dist/resolution/frameworks/object-literal.js +0 -21
  690. package/lib/dist/resolution/frameworks/object-literal.js.map +1 -1
  691. package/lib/dist/resolution/frameworks/package-deps.d.ts +11 -7
  692. package/lib/dist/resolution/frameworks/package-deps.d.ts.map +1 -1
  693. package/lib/dist/resolution/frameworks/package-deps.js +35 -26
  694. package/lib/dist/resolution/frameworks/package-deps.js.map +1 -1
  695. package/lib/dist/resolution/frameworks/page-component.js +0 -14
  696. package/lib/dist/resolution/frameworks/page-component.js.map +1 -1
  697. package/lib/dist/resolution/frameworks/play.d.ts.map +1 -1
  698. package/lib/dist/resolution/frameworks/play.js +26 -34
  699. package/lib/dist/resolution/frameworks/play.js.map +1 -1
  700. package/lib/dist/resolution/frameworks/python.js +5 -102
  701. package/lib/dist/resolution/frameworks/python.js.map +1 -1
  702. package/lib/dist/resolution/frameworks/react-native.d.ts.map +1 -1
  703. package/lib/dist/resolution/frameworks/react-native.js +1 -166
  704. package/lib/dist/resolution/frameworks/react-native.js.map +1 -1
  705. package/lib/dist/resolution/frameworks/react-router.d.ts +13 -4
  706. package/lib/dist/resolution/frameworks/react-router.d.ts.map +1 -1
  707. package/lib/dist/resolution/frameworks/react-router.js +10 -82
  708. package/lib/dist/resolution/frameworks/react-router.js.map +1 -1
  709. package/lib/dist/resolution/frameworks/react.d.ts +57 -0
  710. package/lib/dist/resolution/frameworks/react.d.ts.map +1 -1
  711. package/lib/dist/resolution/frameworks/react.js +1449 -191
  712. package/lib/dist/resolution/frameworks/react.js.map +1 -1
  713. package/lib/dist/resolution/frameworks/ruby.js +1 -61
  714. package/lib/dist/resolution/frameworks/ruby.js.map +1 -1
  715. package/lib/dist/resolution/frameworks/rust.d.ts.map +1 -1
  716. package/lib/dist/resolution/frameworks/rust.js +35 -56
  717. package/lib/dist/resolution/frameworks/rust.js.map +1 -1
  718. package/lib/dist/resolution/frameworks/svelte.d.ts.map +1 -1
  719. package/lib/dist/resolution/frameworks/svelte.js +7 -75
  720. package/lib/dist/resolution/frameworks/svelte.js.map +1 -1
  721. package/lib/dist/resolution/frameworks/sveltekit-router.d.ts.map +1 -1
  722. package/lib/dist/resolution/frameworks/sveltekit-router.js +8 -46
  723. package/lib/dist/resolution/frameworks/sveltekit-router.js.map +1 -1
  724. package/lib/dist/resolution/frameworks/swift-objc.js +0 -97
  725. package/lib/dist/resolution/frameworks/swift-objc.js.map +1 -1
  726. package/lib/dist/resolution/frameworks/swift.js +0 -97
  727. package/lib/dist/resolution/frameworks/swift.js.map +1 -1
  728. package/lib/dist/resolution/frameworks/tanstack-router.d.ts.map +1 -1
  729. package/lib/dist/resolution/frameworks/tanstack-router.js +9 -130
  730. package/lib/dist/resolution/frameworks/tanstack-router.js.map +1 -1
  731. package/lib/dist/resolution/frameworks/terraform.js +1 -85
  732. package/lib/dist/resolution/frameworks/terraform.js.map +1 -1
  733. package/lib/dist/resolution/frameworks/vue-router.d.ts.map +1 -1
  734. package/lib/dist/resolution/frameworks/vue-router.js +11 -134
  735. package/lib/dist/resolution/frameworks/vue-router.js.map +1 -1
  736. package/lib/dist/resolution/frameworks/vue.d.ts.map +1 -1
  737. package/lib/dist/resolution/frameworks/vue.js +42 -114
  738. package/lib/dist/resolution/frameworks/vue.js.map +1 -1
  739. package/lib/dist/resolution/go-func-field-synthesizer.d.ts +58 -0
  740. package/lib/dist/resolution/go-func-field-synthesizer.d.ts.map +1 -0
  741. package/lib/dist/resolution/go-func-field-synthesizer.js +696 -0
  742. package/lib/dist/resolution/go-func-field-synthesizer.js.map +1 -0
  743. package/lib/dist/resolution/go-module.d.ts +23 -7
  744. package/lib/dist/resolution/go-module.d.ts.map +1 -1
  745. package/lib/dist/resolution/go-module.js +21 -24
  746. package/lib/dist/resolution/go-module.js.map +1 -1
  747. package/lib/dist/resolution/go-stdlib-methods.d.ts +9 -0
  748. package/lib/dist/resolution/go-stdlib-methods.d.ts.map +1 -0
  749. package/lib/dist/resolution/go-stdlib-methods.js +224 -0
  750. package/lib/dist/resolution/go-stdlib-methods.js.map +1 -0
  751. package/lib/dist/resolution/goframe-synthesizer.js +2 -53
  752. package/lib/dist/resolution/goframe-synthesizer.js.map +1 -1
  753. package/lib/dist/resolution/import-resolver.d.ts +276 -29
  754. package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
  755. package/lib/dist/resolution/import-resolver.js +1670 -1380
  756. package/lib/dist/resolution/import-resolver.js.map +1 -1
  757. package/lib/dist/resolution/index.d.ts +415 -6
  758. package/lib/dist/resolution/index.d.ts.map +1 -1
  759. package/lib/dist/resolution/index.js +1323 -1037
  760. package/lib/dist/resolution/index.js.map +1 -1
  761. package/lib/dist/resolution/js-builtins.d.ts +14 -0
  762. package/lib/dist/resolution/js-builtins.d.ts.map +1 -1
  763. package/lib/dist/resolution/js-builtins.js +14 -14
  764. package/lib/dist/resolution/js-builtins.js.map +1 -1
  765. package/lib/dist/resolution/js-class-expressions.d.ts +48 -0
  766. package/lib/dist/resolution/js-class-expressions.d.ts.map +1 -0
  767. package/lib/dist/resolution/js-class-expressions.js +25 -0
  768. package/lib/dist/resolution/js-class-expressions.js.map +1 -0
  769. package/lib/dist/resolution/js-super-calls.d.ts +18 -0
  770. package/lib/dist/resolution/js-super-calls.d.ts.map +1 -0
  771. package/lib/dist/resolution/js-super-calls.js +94 -0
  772. package/lib/dist/resolution/js-super-calls.js.map +1 -0
  773. package/lib/dist/resolution/jsx-code.d.ts +28 -0
  774. package/lib/dist/resolution/jsx-code.d.ts.map +1 -0
  775. package/lib/dist/resolution/jsx-code.js +459 -0
  776. package/lib/dist/resolution/jsx-code.js.map +1 -0
  777. package/lib/dist/resolution/lru-cache.d.ts +5 -13
  778. package/lib/dist/resolution/lru-cache.d.ts.map +1 -1
  779. package/lib/dist/resolution/lru-cache.js +43 -32
  780. package/lib/dist/resolution/lru-cache.js.map +1 -1
  781. package/lib/dist/resolution/memory-budget.js +0 -52
  782. package/lib/dist/resolution/memory-budget.js.map +1 -1
  783. package/lib/dist/resolution/module-importers.d.ts +185 -0
  784. package/lib/dist/resolution/module-importers.d.ts.map +1 -0
  785. package/lib/dist/resolution/module-importers.js +588 -0
  786. package/lib/dist/resolution/module-importers.js.map +1 -0
  787. package/lib/dist/resolution/name-matcher.d.ts +858 -7
  788. package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
  789. package/lib/dist/resolution/name-matcher.js +21030 -5110
  790. package/lib/dist/resolution/name-matcher.js.map +1 -1
  791. package/lib/dist/resolution/next-router-synthesizer.d.ts +19 -0
  792. package/lib/dist/resolution/next-router-synthesizer.d.ts.map +1 -1
  793. package/lib/dist/resolution/next-router-synthesizer.js +46 -28
  794. package/lib/dist/resolution/next-router-synthesizer.js.map +1 -1
  795. package/lib/dist/resolution/override-parameters.d.ts +40 -0
  796. package/lib/dist/resolution/override-parameters.d.ts.map +1 -0
  797. package/lib/dist/resolution/override-parameters.js +339 -0
  798. package/lib/dist/resolution/override-parameters.js.map +1 -0
  799. package/lib/dist/resolution/parameter-flow.d.ts +218 -0
  800. package/lib/dist/resolution/parameter-flow.d.ts.map +1 -0
  801. package/lib/dist/resolution/parameter-flow.js +474 -0
  802. package/lib/dist/resolution/parameter-flow.js.map +1 -0
  803. package/lib/dist/resolution/pascal-scope.d.ts +91 -0
  804. package/lib/dist/resolution/pascal-scope.d.ts.map +1 -0
  805. package/lib/dist/resolution/pascal-scope.js +961 -0
  806. package/lib/dist/resolution/pascal-scope.js.map +1 -0
  807. package/lib/dist/resolution/path-aliases.d.ts +32 -4
  808. package/lib/dist/resolution/path-aliases.d.ts.map +1 -1
  809. package/lib/dist/resolution/path-aliases.js +43 -110
  810. package/lib/dist/resolution/path-aliases.js.map +1 -1
  811. package/lib/dist/resolution/project-scans.d.ts +38 -0
  812. package/lib/dist/resolution/project-scans.d.ts.map +1 -0
  813. package/lib/dist/resolution/project-scans.js +30 -0
  814. package/lib/dist/resolution/project-scans.js.map +1 -0
  815. package/lib/dist/resolution/react-router-synthesizer.d.ts.map +1 -1
  816. package/lib/dist/resolution/react-router-synthesizer.js +3 -55
  817. package/lib/dist/resolution/react-router-synthesizer.js.map +1 -1
  818. package/lib/dist/resolution/resolver-pool.d.ts +23 -2
  819. package/lib/dist/resolution/resolver-pool.d.ts.map +1 -1
  820. package/lib/dist/resolution/resolver-pool.js +43 -111
  821. package/lib/dist/resolution/resolver-pool.js.map +1 -1
  822. package/lib/dist/resolution/resolver-worker.d.ts +1 -1
  823. package/lib/dist/resolution/resolver-worker.d.ts.map +1 -1
  824. package/lib/dist/resolution/resolver-worker.js +8 -37
  825. package/lib/dist/resolution/resolver-worker.js.map +1 -1
  826. package/lib/dist/resolution/resurrect-ref.d.ts +25 -0
  827. package/lib/dist/resolution/resurrect-ref.d.ts.map +1 -0
  828. package/lib/dist/resolution/resurrect-ref.js +19 -0
  829. package/lib/dist/resolution/resurrect-ref.js.map +1 -0
  830. package/lib/dist/resolution/ruby-constant-paths.d.ts +56 -0
  831. package/lib/dist/resolution/ruby-constant-paths.d.ts.map +1 -0
  832. package/lib/dist/resolution/ruby-constant-paths.js +255 -0
  833. package/lib/dist/resolution/ruby-constant-paths.js.map +1 -0
  834. package/lib/dist/resolution/ruby-parameter-flow.d.ts +10 -0
  835. package/lib/dist/resolution/ruby-parameter-flow.d.ts.map +1 -0
  836. package/lib/dist/resolution/ruby-parameter-flow.js +801 -0
  837. package/lib/dist/resolution/ruby-parameter-flow.js.map +1 -0
  838. package/lib/dist/resolution/rust-scopes.d.ts +120 -0
  839. package/lib/dist/resolution/rust-scopes.d.ts.map +1 -0
  840. package/lib/dist/resolution/rust-scopes.js +730 -0
  841. package/lib/dist/resolution/rust-scopes.js.map +1 -0
  842. package/lib/dist/resolution/shopify-themes.d.ts +10 -0
  843. package/lib/dist/resolution/shopify-themes.d.ts.map +1 -0
  844. package/lib/dist/resolution/shopify-themes.js +19 -0
  845. package/lib/dist/resolution/shopify-themes.js.map +1 -0
  846. package/lib/dist/resolution/strip-comments.d.ts +20 -1
  847. package/lib/dist/resolution/strip-comments.d.ts.map +1 -1
  848. package/lib/dist/resolution/strip-comments.js +164 -119
  849. package/lib/dist/resolution/strip-comments.js.map +1 -1
  850. package/lib/dist/resolution/sveltekit-synthesizer.js +0 -64
  851. package/lib/dist/resolution/sveltekit-synthesizer.js.map +1 -1
  852. package/lib/dist/resolution/swift-objc-bridge.js +0 -160
  853. package/lib/dist/resolution/swift-objc-bridge.js.map +1 -1
  854. package/lib/dist/resolution/swift-type-visibility.d.ts.map +1 -1
  855. package/lib/dist/resolution/swift-type-visibility.js +2 -101
  856. package/lib/dist/resolution/swift-type-visibility.js.map +1 -1
  857. package/lib/dist/resolution/synth-utils.js +1 -22
  858. package/lib/dist/resolution/synth-utils.js.map +1 -1
  859. package/lib/dist/resolution/tanstack-router-synthesizer.js +0 -32
  860. package/lib/dist/resolution/tanstack-router-synthesizer.js.map +1 -1
  861. package/lib/dist/resolution/tauri-synthesizer.d.ts +37 -0
  862. package/lib/dist/resolution/tauri-synthesizer.d.ts.map +1 -0
  863. package/lib/dist/resolution/tauri-synthesizer.js +1038 -0
  864. package/lib/dist/resolution/tauri-synthesizer.js.map +1 -0
  865. package/lib/dist/resolution/tier-synthesizer.js +4 -170
  866. package/lib/dist/resolution/tier-synthesizer.js.map +1 -1
  867. package/lib/dist/resolution/type-parameters.d.ts +23 -0
  868. package/lib/dist/resolution/type-parameters.d.ts.map +1 -1
  869. package/lib/dist/resolution/type-parameters.js +52 -54
  870. package/lib/dist/resolution/type-parameters.js.map +1 -1
  871. package/lib/dist/resolution/types.d.ts +183 -11
  872. package/lib/dist/resolution/types.d.ts.map +1 -1
  873. package/lib/dist/resolution/types.js +0 -47
  874. package/lib/dist/resolution/types.js.map +1 -1
  875. package/lib/dist/resolution/vbnet-receivers.d.ts +92 -0
  876. package/lib/dist/resolution/vbnet-receivers.d.ts.map +1 -0
  877. package/lib/dist/resolution/vbnet-receivers.js +1482 -0
  878. package/lib/dist/resolution/vbnet-receivers.js.map +1 -0
  879. package/lib/dist/resolution/vue-router-synthesizer.js +0 -31
  880. package/lib/dist/resolution/vue-router-synthesizer.js.map +1 -1
  881. package/lib/dist/resolution/workspace-packages.d.ts +206 -15
  882. package/lib/dist/resolution/workspace-packages.d.ts.map +1 -1
  883. package/lib/dist/resolution/workspace-packages.js +570 -152
  884. package/lib/dist/resolution/workspace-packages.js.map +1 -1
  885. package/lib/dist/search/identifier-segments.js +2 -93
  886. package/lib/dist/search/identifier-segments.js.map +1 -1
  887. package/lib/dist/search/query-parser.js +0 -54
  888. package/lib/dist/search/query-parser.js.map +1 -1
  889. package/lib/dist/search/query-paths.js +0 -167
  890. package/lib/dist/search/query-paths.js.map +1 -1
  891. package/lib/dist/search/query-utils.d.ts +44 -0
  892. package/lib/dist/search/query-utils.d.ts.map +1 -1
  893. package/lib/dist/search/query-utils.js +120 -198
  894. package/lib/dist/search/query-utils.js.map +1 -1
  895. package/lib/dist/sync/git-hooks.d.ts +14 -5
  896. package/lib/dist/sync/git-hooks.d.ts.map +1 -1
  897. package/lib/dist/sync/git-hooks.js +118 -65
  898. package/lib/dist/sync/git-hooks.js.map +1 -1
  899. package/lib/dist/sync/index.js +0 -14
  900. package/lib/dist/sync/index.js.map +1 -1
  901. package/lib/dist/sync/watch-policy.js +0 -45
  902. package/lib/dist/sync/watch-policy.js.map +1 -1
  903. package/lib/dist/sync/watcher.d.ts +29 -11
  904. package/lib/dist/sync/watcher.d.ts.map +1 -1
  905. package/lib/dist/sync/watcher.js +83 -487
  906. package/lib/dist/sync/watcher.js.map +1 -1
  907. package/lib/dist/sync/worktree.d.ts +7 -2
  908. package/lib/dist/sync/worktree.d.ts.map +1 -1
  909. package/lib/dist/sync/worktree.js +24 -97
  910. package/lib/dist/sync/worktree.js.map +1 -1
  911. package/lib/dist/telemetry/index.d.ts.map +1 -1
  912. package/lib/dist/telemetry/index.js +15 -135
  913. package/lib/dist/telemetry/index.js.map +1 -1
  914. package/lib/dist/types.d.ts +46 -0
  915. package/lib/dist/types.d.ts.map +1 -1
  916. package/lib/dist/types.js +15 -44
  917. package/lib/dist/types.js.map +1 -1
  918. package/lib/dist/ui/color.js +0 -19
  919. package/lib/dist/ui/color.js.map +1 -1
  920. package/lib/dist/ui/glyphs.js +2 -45
  921. package/lib/dist/ui/glyphs.js.map +1 -1
  922. package/lib/dist/ui/shimmer-progress.js +0 -21
  923. package/lib/dist/ui/shimmer-progress.js.map +1 -1
  924. package/lib/dist/ui/shimmer-worker.js +0 -22
  925. package/lib/dist/ui/shimmer-worker.js.map +1 -1
  926. package/lib/dist/ui-server/api/deadcode.d.ts.map +1 -1
  927. package/lib/dist/ui-server/api/deadcode.js +2 -31
  928. package/lib/dist/ui-server/api/deadcode.js.map +1 -1
  929. package/lib/dist/ui-server/api/effects.js +0 -111
  930. package/lib/dist/ui-server/api/effects.js.map +1 -1
  931. package/lib/dist/ui-server/api/entrypoints.js +0 -142
  932. package/lib/dist/ui-server/api/entrypoints.js.map +1 -1
  933. package/lib/dist/ui-server/api/events.js +0 -145
  934. package/lib/dist/ui-server/api/events.js.map +1 -1
  935. package/lib/dist/ui-server/api/file.js +0 -80
  936. package/lib/dist/ui-server/api/file.js.map +1 -1
  937. package/lib/dist/ui-server/api/filecode.js +0 -95
  938. package/lib/dist/ui-server/api/filecode.js.map +1 -1
  939. package/lib/dist/ui-server/api/flow.js +0 -149
  940. package/lib/dist/ui-server/api/flow.js.map +1 -1
  941. package/lib/dist/ui-server/api/hierarchy.js +0 -28
  942. package/lib/dist/ui-server/api/hierarchy.js.map +1 -1
  943. package/lib/dist/ui-server/api/index.js +0 -88
  944. package/lib/dist/ui-server/api/index.js.map +1 -1
  945. package/lib/dist/ui-server/api/map.d.ts.map +1 -1
  946. package/lib/dist/ui-server/api/map.js +4 -317
  947. package/lib/dist/ui-server/api/map.js.map +1 -1
  948. package/lib/dist/ui-server/api/node.js +0 -111
  949. package/lib/dist/ui-server/api/node.js.map +1 -1
  950. package/lib/dist/ui-server/api/nodes.js +0 -16
  951. package/lib/dist/ui-server/api/nodes.js.map +1 -1
  952. package/lib/dist/ui-server/api/program.js +0 -90
  953. package/lib/dist/ui-server/api/program.js.map +1 -1
  954. package/lib/dist/ui-server/api/respond.js +0 -60
  955. package/lib/dist/ui-server/api/respond.js.map +1 -1
  956. package/lib/dist/ui-server/api/route-roots.d.ts.map +1 -1
  957. package/lib/dist/ui-server/api/route-roots.js +2 -44
  958. package/lib/dist/ui-server/api/route-roots.js.map +1 -1
  959. package/lib/dist/ui-server/api/routes.d.ts.map +1 -1
  960. package/lib/dist/ui-server/api/routes.js +4 -60
  961. package/lib/dist/ui-server/api/routes.js.map +1 -1
  962. package/lib/dist/ui-server/api/screens.d.ts.map +1 -1
  963. package/lib/dist/ui-server/api/screens.js +4 -174
  964. package/lib/dist/ui-server/api/screens.js.map +1 -1
  965. package/lib/dist/ui-server/api/search.js +0 -62
  966. package/lib/dist/ui-server/api/search.js.map +1 -1
  967. package/lib/dist/ui-server/api/session.js +0 -58
  968. package/lib/dist/ui-server/api/session.js.map +1 -1
  969. package/lib/dist/ui-server/api/source.d.ts.map +1 -1
  970. package/lib/dist/ui-server/api/source.js +0 -161
  971. package/lib/dist/ui-server/api/source.js.map +1 -1
  972. package/lib/dist/ui-server/api/stats.js +0 -58
  973. package/lib/dist/ui-server/api/stats.js.map +1 -1
  974. package/lib/dist/ui-server/api/steps.d.ts.map +1 -1
  975. package/lib/dist/ui-server/api/steps.js +5 -381
  976. package/lib/dist/ui-server/api/steps.js.map +1 -1
  977. package/lib/dist/ui-server/api/trail-store.d.ts +3 -3
  978. package/lib/dist/ui-server/api/trail-store.d.ts.map +1 -1
  979. package/lib/dist/ui-server/api/trail-store.js +24 -106
  980. package/lib/dist/ui-server/api/trail-store.js.map +1 -1
  981. package/lib/dist/ui-server/api/trails.d.ts.map +1 -1
  982. package/lib/dist/ui-server/api/trails.js +19 -94
  983. package/lib/dist/ui-server/api/trails.js.map +1 -1
  984. package/lib/dist/ui-server/api/when.js +0 -36
  985. package/lib/dist/ui-server/api/when.js.map +1 -1
  986. package/lib/dist/ui-server/api/wire.js +0 -58
  987. package/lib/dist/ui-server/api/wire.js.map +1 -1
  988. package/lib/dist/ui-server/assets.js +0 -35
  989. package/lib/dist/ui-server/assets.js.map +1 -1
  990. package/lib/dist/ui-server/constants.js +0 -26
  991. package/lib/dist/ui-server/constants.js.map +1 -1
  992. package/lib/dist/ui-server/highlight/bounded-tokenize.js +0 -25
  993. package/lib/dist/ui-server/highlight/bounded-tokenize.js.map +1 -1
  994. package/lib/dist/ui-server/highlight/index.js +1 -132
  995. package/lib/dist/ui-server/highlight/index.js.map +1 -1
  996. package/lib/dist/ui-server/highlight/languages.d.ts +3 -3
  997. package/lib/dist/ui-server/highlight/languages.js +0 -31
  998. package/lib/dist/ui-server/highlight/languages.js.map +1 -1
  999. package/lib/dist/ui-server/highlight/tokenize-worker.js +0 -5
  1000. package/lib/dist/ui-server/highlight/tokenize-worker.js.map +1 -1
  1001. package/lib/dist/ui-server/index.d.ts +25 -0
  1002. package/lib/dist/ui-server/index.d.ts.map +1 -1
  1003. package/lib/dist/ui-server/index.js +35 -103
  1004. package/lib/dist/ui-server/index.js.map +1 -1
  1005. package/lib/dist/ui-server/open-browser.js +0 -34
  1006. package/lib/dist/ui-server/open-browser.js.map +1 -1
  1007. package/lib/dist/ui-server/security.d.ts +5 -0
  1008. package/lib/dist/ui-server/security.d.ts.map +1 -1
  1009. package/lib/dist/ui-server/security.js +11 -147
  1010. package/lib/dist/ui-server/security.js.map +1 -1
  1011. package/lib/dist/ui-server/static.js +0 -41
  1012. package/lib/dist/ui-server/static.js.map +1 -1
  1013. package/lib/dist/upgrade/index.d.ts +18 -5
  1014. package/lib/dist/upgrade/index.d.ts.map +1 -1
  1015. package/lib/dist/upgrade/index.js +73 -229
  1016. package/lib/dist/upgrade/index.js.map +1 -1
  1017. package/lib/dist/upgrade/remove-binary.js +2 -67
  1018. package/lib/dist/upgrade/remove-binary.js.map +1 -1
  1019. package/lib/dist/upgrade/update-check.js +1 -81
  1020. package/lib/dist/upgrade/update-check.js.map +1 -1
  1021. package/lib/dist/utils.d.ts +69 -1
  1022. package/lib/dist/utils.d.ts.map +1 -1
  1023. package/lib/dist/utils.js +224 -266
  1024. package/lib/dist/utils.js.map +1 -1
  1025. package/lib/dist/worker-teardown.js +0 -47
  1026. package/lib/dist/worker-teardown.js.map +1 -1
  1027. package/lib/kernel/codegraph-kernel.node +2 -2
  1028. package/lib/node_modules/.package-lock.json +4 -4
  1029. package/lib/node_modules/ignore/README.md +138 -8
  1030. package/lib/node_modules/ignore/index.d.ts +56 -20
  1031. package/lib/node_modules/ignore/index.js +1033 -221
  1032. package/lib/node_modules/ignore/legacy.js +871 -178
  1033. package/lib/node_modules/ignore/package.json +10 -4
  1034. package/lib/package.json +14 -8
  1035. package/node.exe +2 -2
  1036. 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,40 @@ 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");
20
29
  const import_resolver_1 = require("./import-resolver");
21
30
  const name_matcher_1 = require("./name-matcher");
31
+ const go_stdlib_methods_1 = require("./go-stdlib-methods");
32
+ const override_parameters_1 = require("./override-parameters");
33
+ const react_1 = require("./frameworks/react");
34
+ const jsx_code_1 = require("./jsx-code");
35
+ const query_utils_1 = require("../search/query-utils");
22
36
  const REGISTRAR_NAME = /^(on[A-Z]\w*|subscribe|addListener|addEventListener|register|watch|listen|addCallback)$/;
23
37
  const DISPATCHER_NAME = /(emit|trigger|notify|dispatch|fire|publish|flush)/i;
24
38
  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)
39
+ const EVENT_FANOUT_CAP = 6;
26
40
  const ON_RE = /\.(?:on|once|addListener)\(\s*['"]([^'"]+)['"]\s*,\s*(?:function\s+(\w+)|(?:this\.)?(\w+))/g;
27
41
  const EMIT_RE = /\.(?:emit|fire|dispatchEvent)\(\s*['"]([^'"]+)['"]/g;
28
42
  const SETSTATE_RE = /this\.setState\s*\(/;
29
- const FLUTTER_SETSTATE_RE = /\bsetState\s*\(/; // Flutter: setState((){…}) / this.setState
43
+ const FLUTTER_SETSTATE_RE = /\bsetState\s*\(/;
30
44
  const JS_FAMILY = ['typescript', 'javascript', 'tsx', 'jsx'];
31
- const JSX_TAG_RE = /<([A-Z][A-Za-z0-9_]*)[\s/>]/g;
45
+ const JSX_FAMILY = ['tsx', 'jsx', 'javascript'];
46
+ const JSX_TAG_RE = /<([A-Z][A-Za-z0-9_]*)(?=[\s/><])/g;
32
47
  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.
48
+ const WRAPPER_CALL_RE = /\b(?:styled|memo|forwardRef)\s*\(\s*[A-Z]/;
36
49
  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
50
  const VUE_PASCAL_RE = /<([A-Z][A-Za-z0-9]*)[\s/>]/g;
41
51
  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
52
  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
53
  const CC_DISPATCH_RE = /(\w+)\.forEach\s*\{\s*(?:\$0|it)\s*\(/g;
54
54
  const CC_APPEND_WRITE_RE = /(\w+)\.write\s*\{\s*\$0(?:\.(\w+))?\.(?:append|add|push|insert)\s*\(/g;
55
55
  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).
56
+ const CC_FANOUT_CAP = 8;
65
57
  const CC_LANGUAGES = new Set(['swift', 'kotlin']);
66
58
  function kebabToPascal(s) {
67
59
  return s.split('-').map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join('');
68
60
  }
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
61
  function nuxtComponentName(filePath) {
79
62
  const marker = filePath.lastIndexOf('components/');
80
63
  if (marker === -1)
@@ -93,10 +76,31 @@ function nuxtComponentName(filePath) {
93
76
  }
94
77
  return out.join('');
95
78
  }
79
+ let sliceLinesSource = null;
80
+ let sliceLinesSplit = [];
96
81
  function sliceLines(content, startLine, endLine) {
97
82
  if (!startLine || !endLine)
98
83
  return null;
99
- return content.split('\n').slice(startLine - 1, endLine).join('\n');
84
+ if (content !== sliceLinesSource) {
85
+ sliceLinesSource = content;
86
+ sliceLinesSplit = content.split('\n');
87
+ }
88
+ return sliceLinesSplit.slice(startLine - 1, endLine).join('\n');
89
+ }
90
+ let lineOfSource = null;
91
+ let lineOfIndex = () => 1;
92
+ function lineOf(src, idx) {
93
+ if (src !== lineOfSource) {
94
+ lineOfSource = src;
95
+ lineOfIndex = (0, synth_utils_1.makeLineAt)(src, 1);
96
+ }
97
+ return lineOfIndex(idx);
98
+ }
99
+ function releaseLineCaches() {
100
+ sliceLinesSource = null;
101
+ sliceLinesSplit = [];
102
+ lineOfSource = null;
103
+ lineOfIndex = () => 1;
100
104
  }
101
105
  function registrarField(src) {
102
106
  const m = src.match(/this\.(\w+)\.(?:add|push|set)\(/);
@@ -111,24 +115,17 @@ function dispatcherField(src) {
111
115
  return forEach[1];
112
116
  return null;
113
117
  }
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
118
  function* methodAndFunctionNodes(queries) {
121
119
  yield* queries.iterateNodesByKind('method');
122
120
  yield* queries.iterateNodesByKind('function');
123
121
  }
124
- /** Phase 1: field-backed observer channels (registrar/dispatcher share a store). */
125
122
  async function fieldChannelEdges(queries, ctx, onYield) {
126
123
  const registrars = [];
127
124
  const dispatchers = [];
128
125
  let scanned = 0;
129
126
  for (const m of methodAndFunctionNodes(queries)) {
130
127
  if ((++scanned & 255) === 0)
131
- await onYield(); // #1091: yield mid-scan on huge graphs
128
+ await onYield();
132
129
  const isReg = REGISTRAR_NAME.test(m.name);
133
130
  const isDisp = DISPATCHER_NAME.test(m.name);
134
131
  if (!isReg && !isDisp)
@@ -154,7 +151,7 @@ async function fieldChannelEdges(queries, ctx, onYield) {
154
151
  const chDispatchers = dispatchers.filter((d) => d.node.filePath === reg.node.filePath && d.field === reg.field);
155
152
  if (chDispatchers.length === 0)
156
153
  continue;
157
- const argRe = new RegExp(`${reg.node.name}\\s*\\(\\s*(this\\.\\w+|\\w+)\\s*(?=[,)])`);
154
+ const argRe = new RegExp(`${(0, utils_1.escapeRegExp)(reg.node.name)}\\s*\\(\\s*(this\\.\\w+|\\w+)\\s*(?=[,)])`);
158
155
  let added = 0;
159
156
  for (const e of queries.getIncomingEdges(reg.node.id, ['calls'])) {
160
157
  if (added >= MAX_CALLBACKS_PER_CHANNEL)
@@ -168,8 +165,6 @@ async function fieldChannelEdges(queries, ctx, onYield) {
168
165
  const am = line?.match(argRe);
169
166
  if (!am)
170
167
  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
168
  const refs = queries.getOutgoingEdges(caller.id, ['references']).filter((r) => r.line === e.line && r.metadata?.fnRef === true && r.metadata.refName === am[1]);
174
169
  if (refs.length !== 1)
175
170
  continue;
@@ -190,9 +185,6 @@ async function fieldChannelEdges(queries, ctx, onYield) {
190
185
  provenance: 'heuristic',
191
186
  metadata: {
192
187
  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
188
  registeredAt: `${caller.filePath}:${e.line}`,
197
189
  },
198
190
  });
@@ -202,36 +194,17 @@ async function fieldChannelEdges(queries, ctx, onYield) {
202
194
  }
203
195
  return edges;
204
196
  }
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
197
  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
198
+ const dispatchers = new Map();
199
+ const registrars = new Map();
222
200
  const addReg = (field, node, absLine) => {
223
201
  if (!field || /^\d+$/.test(field))
224
- return; // `$0.append` mis-captures the `0`; the write-RE owns that field
202
+ return;
225
203
  const arr = registrars.get(field) ?? [];
226
204
  if (!arr.some((r) => r.node.id === node.id))
227
205
  arr.push({ node, line: absLine });
228
206
  registrars.set(field, arr);
229
207
  };
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
208
  let scanned = 0;
236
209
  let matchTick = 0;
237
210
  for (const m of methodAndFunctionNodes(queries)) {
@@ -266,7 +239,7 @@ async function closureCollectionEdges(queries, ctx, onYield) {
266
239
  while ((w = CC_APPEND_WRITE_RE.exec(src))) {
267
240
  if ((++matchTick & 255) === 0)
268
241
  await onYield();
269
- addReg(w[2] || w[1], m, lineAt(w.index)); // nested `$0.streams` else the `.write` receiver
242
+ addReg(w[2] || w[1], m, lineAt(w.index));
270
243
  }
271
244
  CC_APPEND_DIRECT_RE.lastIndex = 0;
272
245
  let a;
@@ -284,7 +257,7 @@ async function closureCollectionEdges(queries, ctx, onYield) {
284
257
  if (!regs || regs.length === 0)
285
258
  continue;
286
259
  if (disps.length > CC_FANOUT_CAP || regs.length > CC_FANOUT_CAP)
287
- continue; // generic field — can't pair confidently
260
+ continue;
288
261
  for (const disp of disps)
289
262
  for (const reg of regs) {
290
263
  if (disp.node.id === reg.node.id)
@@ -302,17 +275,16 @@ async function closureCollectionEdges(queries, ctx, onYield) {
302
275
  }
303
276
  return edges;
304
277
  }
305
- /** Phase 2: string-keyed EventEmitter channels (on('e', fn) ↔ emit('e')). */
306
278
  async function eventEmitterEdges(ctx, onYield) {
307
279
  let scannedFiles = 0;
308
- const emitsByEvent = new Map(); // event → dispatcher node ids
309
- const handlersByEvent = new Map(); // event → handler id → registration site (file:line)
280
+ const emitsByEvent = new Map();
281
+ const handlersByEvent = new Map();
310
282
  let scanned = 0;
311
283
  for (const file of ctx.getAllFiles()) {
312
284
  if ((++scannedFiles & 15) === 0)
313
285
  await onYield();
314
286
  if ((++scanned & 255) === 0)
315
- await onYield(); // #1091: yield mid-scan on huge graphs
287
+ await onYield();
316
288
  const content = ctx.readFile(file);
317
289
  if (!content)
318
290
  continue;
@@ -341,7 +313,7 @@ async function eventEmitterEdges(ctx, onYield) {
341
313
  const handlerName = m[2] || m[3];
342
314
  if (!handlerName)
343
315
  continue;
344
- const handler = ctx.getNodesByName(handlerName).find((n) => n.kind === 'function' || n.kind === 'method');
316
+ const handler = ctx.getNodesByName(handlerName).find((n) => (n.kind === 'function' || n.kind === 'method') && !(0, name_matcher_1.isManualMockHiddenFrom)(n.filePath, file));
345
317
  if (!handler)
346
318
  continue;
347
319
  const map = handlersByEvent.get(m[1]) ?? new Map();
@@ -356,8 +328,6 @@ async function eventEmitterEdges(ctx, onYield) {
356
328
  const handlers = handlersByEvent.get(event);
357
329
  if (!handlers)
358
330
  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
331
  if (dispatchers.size > EVENT_FANOUT_CAP || handlers.size > EVENT_FANOUT_CAP)
362
332
  continue;
363
333
  for (const d of dispatchers)
@@ -373,29 +343,10 @@ async function eventEmitterEdges(ctx, onYield) {
373
343
  }
374
344
  return edges;
375
345
  }
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
346
  async function reactRenderEdges(queries, ctx, onYield) {
388
347
  let scanned255 = 0;
389
348
  const edges = [];
390
349
  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
350
  const renderOwners = new Set();
400
351
  for (const n of ctx.getNodesByName('render')) {
401
352
  if (n.kind !== 'method')
@@ -440,15 +391,6 @@ async function reactRenderEdges(queries, ctx, onYield) {
440
391
  }
441
392
  return edges;
442
393
  }
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
394
  async function flutterBuildEdges(queries, ctx, onYield) {
453
395
  let scanned255 = 0;
454
396
  const edges = [];
@@ -486,34 +428,12 @@ async function flutterBuildEdges(queries, ctx, onYield) {
486
428
  }
487
429
  return edges;
488
430
  }
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
431
  const ARKUI_REACTIVE_DECORATORS = new Set([
498
432
  'State', 'Prop', 'Link', 'Provide', 'Consume', 'StorageLink', 'StorageProp',
499
433
  'LocalStorageLink', 'LocalStorageProp', 'ObjectLink',
500
434
  'Local', 'Provider', 'Consumer',
501
435
  ]);
502
- /** ArkUI-observed array mutators — `this.todos.push(x)` re-renders like an assignment. */
503
436
  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
437
  async function arkuiStateBuildEdges(queries, ctx, onYield) {
518
438
  let scanned255 = 0;
519
439
  const edges = [];
@@ -533,8 +453,6 @@ async function arkuiStateBuildEdges(queries, ctx, onYield) {
533
453
  const propAlternation = reactiveProps
534
454
  .map((p) => p.name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
535
455
  .join('|');
536
- // `this.count = …` / `+=` / `++` / `--` / `this.todos.push(…)`. The
537
- // `=(?!=)` keeps `this.done == x` comparisons out.
538
456
  const mutationRe = new RegExp(`this\\.(?:${propAlternation})\\s*(?:=(?!=)|\\+\\+|--|[+\\-*/%&|^]=|\\.(?:${ARKUI_ARRAY_MUTATORS})\\s*\\()`);
539
457
  let added = 0;
540
458
  for (const m of children) {
@@ -560,32 +478,10 @@ async function arkuiStateBuildEdges(queries, ctx, onYield) {
560
478
  }
561
479
  return edges;
562
480
  }
563
- /** Emit/subscribe call sites of HarmonyOS's `@ohos.events.emitter` bus. */
564
481
  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
482
  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
483
  async function arkuiEmitterEdges(ctx, onYield) {
587
484
  let scannedFiles = 0;
588
- // bucket key -> emit sites / handler sites
589
485
  const emits = new Map();
590
486
  const handlers = new Map();
591
487
  const moduleDirs = (() => {
@@ -615,26 +511,23 @@ async function arkuiEmitterEdges(ctx, onYield) {
615
511
  while ((m = ARKUI_EMITTER_CALL_RE.exec(safe))) {
616
512
  const verb = m[1];
617
513
  const arg = m[2].trim();
618
- const line = safe.slice(0, m.index).split('\n').length;
514
+ const line = lineOf(safe, m.index);
619
515
  const encl = nodes
620
516
  .filter((n) => n.startLine <= line && n.endLine >= line)
621
517
  .sort((a, b) => (a.endLine - a.startLine) - (b.endLine - b.startLine))[0];
622
518
  if (!encl)
623
519
  continue;
624
- // Recover the event key from the first argument.
625
520
  let key = null;
626
521
  const idLit = arg.startsWith('{') ? arg.match(/\beventId\s*:\s*([\w$.]+)/)?.[1] : undefined;
627
522
  const token = idLit ?? arg;
628
523
  if (token !== undefined) {
629
524
  if (/^\d+$/.test(token)) {
630
- key = `num:${file}:${token}`; // numeric: same-file only
525
+ key = `num:${file}:${token}`;
631
526
  }
632
527
  else if (token.includes('.')) {
633
528
  key = `name:${moduleScopeOf(file)}:${token}`;
634
529
  }
635
530
  else {
636
- // Local variable — chase its same-file declaration one level:
637
- // `let x = new EventsId(K)` / `const x = K`.
638
531
  const declRe = new RegExp(`\\b${token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\b\\s*(?::[^=\\n]+)?=\\s*(?:new\\s+[\\w$.]+\\(\\s*([^)\\n]+?)\\s*\\)|([\\w$.]+))`);
639
532
  const decl = safe.match(declRe);
640
533
  const inner = (decl?.[1] ?? decl?.[2])?.trim();
@@ -681,19 +574,7 @@ async function arkuiEmitterEdges(ctx, onYield) {
681
574
  }
682
575
  return edges;
683
576
  }
684
- /** `router.pushUrl({ url: 'pages/Detail' })` / replaceUrl — literal urls only. */
685
577
  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
578
  async function arkuiRouterEdges(ctx, onYield) {
698
579
  const edges = [];
699
580
  const seen = new Set();
@@ -725,7 +606,7 @@ async function arkuiRouterEdges(ctx, onYield) {
725
606
  let m;
726
607
  while ((m = ARKUI_ROUTER_RE.exec(safe))) {
727
608
  const url = m[1];
728
- const line = safe.slice(0, m.index).split('\n').length;
609
+ const line = lineOf(safe, m.index);
729
610
  const encl = nodes
730
611
  .filter((n) => n.startLine <= line && n.endLine >= line)
731
612
  .sort((a, b) => (a.endLine - a.startLine) - (b.endLine - b.startLine))[0];
@@ -740,7 +621,7 @@ async function arkuiRouterEdges(ctx, onYield) {
740
621
  candidates = sameModule;
741
622
  }
742
623
  if (candidates.length !== 1)
743
- continue; // ambiguous or unresolved — never guess
624
+ continue;
744
625
  const page = ctx.getNodesInFile(candidates[0]).find((n) => n.kind === 'struct' && (n.decorators ?? []).includes('Entry'));
745
626
  if (!page)
746
627
  continue;
@@ -757,17 +638,7 @@ async function arkuiRouterEdges(ctx, onYield) {
757
638
  }
758
639
  return edges;
759
640
  }
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) {
641
+ async function cppOverrideEdges(queries, ctx, onYield) {
771
642
  let scanned255 = 0;
772
643
  const edges = [];
773
644
  const seen = new Set();
@@ -775,6 +646,7 @@ async function cppOverrideEdges(queries, onYield) {
775
646
  .getOutgoingEdges(classId, ['contains'])
776
647
  .map((e) => queries.getNodeById(e.target))
777
648
  .filter((n) => !!n && n.kind === 'method');
649
+ const overridable = (m) => (0, name_matcher_1.cppSpecializationArguments)(m, ctx) === null;
778
650
  for (const cls of queries.iterateNodesByKind('class')) {
779
651
  if ((++scanned255 & 63) === 0)
780
652
  await onYield();
@@ -785,13 +657,13 @@ async function cppOverrideEdges(queries, onYield) {
785
657
  const base = queries.getNodeById(ext.target);
786
658
  if (!base || base.language !== 'cpp' || base.id === cls.id)
787
659
  continue;
788
- const baseMethods = new Map(methodsOf(base.id).map((m) => [m.name, m]));
660
+ const baseMethods = new Map(methodsOf(base.id).filter(overridable).map((m) => [m.name, m]));
789
661
  let added = 0;
790
662
  for (const m of subMethods) {
791
663
  if (added >= MAX_CALLBACKS_PER_CHANNEL)
792
664
  break;
793
665
  const bm = baseMethods.get(m.name);
794
- if (!bm || bm.id === m.id)
666
+ if (!bm || bm.id === m.id || !overridable(m))
795
667
  continue;
796
668
  const key = `${bm.id}>${m.id}`;
797
669
  if (seen.has(key))
@@ -811,86 +683,429 @@ async function cppOverrideEdges(queries, onYield) {
811
683
  }
812
684
  return edges;
813
685
  }
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
686
  const IFACE_OVERRIDE_LANGS = new Set([
833
- 'java', 'kotlin', 'csharp', 'typescript', 'javascript', 'swift', 'scala', 'go', 'rust',
687
+ 'java', 'kotlin', 'csharp', 'typescript', 'tsx', 'javascript', 'jsx', 'swift', 'scala', 'go', 'rust',
834
688
  'arkts',
835
689
  ]);
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) {
690
+ const STATIC_SPLIT_LANGS = new Set(['typescript', 'tsx', 'javascript', 'jsx']);
691
+ function isGoEmbedding(e, kindOf) {
692
+ if (e.provenance === 'heuristic')
693
+ return false;
694
+ const to = kindOf(e.target);
695
+ return to !== null && (kindOf(e.source) !== 'interface' || to === 'interface');
696
+ }
697
+ const GO_EXPORTED_NAME = /^\p{Lu}/u;
698
+ function goMethodKey(m) {
699
+ if (GO_EXPORTED_NAME.test(m.name))
700
+ return m.name;
701
+ const file = m.filePath.replace(/\\/g, '/');
702
+ return `${file.slice(0, Math.max(file.lastIndexOf('/'), 0))}\0${m.name}`;
703
+ }
704
+ function goStdlibMethodKey(importPath, name) {
705
+ return GO_EXPORTED_NAME.test(name) ? name : `std:${importPath ?? ''}\0${name}`;
706
+ }
707
+ function goListItems(text, open) {
708
+ const items = [];
709
+ let depth = 0;
710
+ let item = '';
711
+ for (let i = open; i < text.length; i++) {
712
+ const c = text[i];
713
+ if (c === '/' && (text[i + 1] === '/' || text[i + 1] === '*')) {
714
+ const end = text[i + 1] === '/' ? text.indexOf('\n', i) : text.indexOf('*/', i + 2) + 1;
715
+ if (end <= 0)
716
+ return null;
717
+ i = end;
718
+ item += ' ';
719
+ continue;
720
+ }
721
+ if (c === '"' || c === '`' || c === "'") {
722
+ let j = i + 1;
723
+ while (j < text.length && text[j] !== c)
724
+ j += c !== '`' && text[j] === '\\' ? 2 : 1;
725
+ if (j >= text.length)
726
+ return null;
727
+ item += text.slice(i, j + 1);
728
+ i = j;
729
+ continue;
730
+ }
731
+ if (c === '(' || c === '[' || c === '{') {
732
+ if (depth++ === 0)
733
+ continue;
734
+ }
735
+ else if (c === ')' || c === ']' || c === '}') {
736
+ if (--depth === 0) {
737
+ if (item.trim())
738
+ items.push(item.trim());
739
+ return { items, end: i };
740
+ }
741
+ }
742
+ else if (c === ',' && depth === 1) {
743
+ if (item.trim())
744
+ items.push(item.trim());
745
+ item = '';
746
+ continue;
747
+ }
748
+ item += c;
749
+ }
750
+ return null;
751
+ }
752
+ function goSignatureParts(signature) {
753
+ const sig = signature?.trim();
754
+ if (!sig || sig[0] !== '(')
755
+ return null;
756
+ const params = goListItems(sig, 0);
757
+ if (!params)
758
+ return null;
759
+ const rest = sig.slice(params.end + 1).trim();
760
+ if (rest[0] !== '(')
761
+ return { params: params.items, results: rest ? [rest] : [] };
762
+ const results = goListItems(rest, 0);
763
+ if (!results || rest.slice(results.end + 1).trim())
764
+ return null;
765
+ return { params: params.items, results: results.items };
766
+ }
767
+ function goSignatureArity(signature) {
768
+ const parts = goSignatureParts(signature);
769
+ return parts ? `${parts.params.length}/${parts.results.length}` : null;
770
+ }
771
+ const GO_TYPE_WORDS = new Set(['func', 'chan', 'map', 'struct', 'interface']);
772
+ function goItemTypes(items) {
773
+ const named = items.map((item) => {
774
+ const m = /^([A-Za-z_]\w*)\s+(\S[\s\S]*)$/.exec(item);
775
+ return m && !GO_TYPE_WORDS.has(m[1]) ? m[2] : null;
776
+ });
777
+ if (named.every((type) => type === null))
778
+ return [...items];
779
+ const types = [];
780
+ let type = '';
781
+ for (let i = items.length - 1; i >= 0; i--)
782
+ types[i] = type = named[i] ?? type;
783
+ return types;
784
+ }
785
+ function goComparableType(written) {
786
+ const flat = written.replace(/\s+/g, '').replace(/interface\{\}/g, 'any');
787
+ if (/\bfunc\(|\bstruct\{|\binterface\{/.test(flat))
788
+ return null;
789
+ return flat.replace(/[A-Za-z_]\w*\./g, '').replace(/\buint8\b/g, 'byte').replace(/\bint32\b/g, 'rune');
790
+ }
791
+ function goMethodTypes(signature) {
792
+ const parts = goSignatureParts(signature);
793
+ return parts ? [...goItemTypes(parts.params), ...goItemTypes(parts.results)].map(goComparableType) : null;
794
+ }
795
+ function goDeclarationText(n, ctx) {
796
+ const lines = ctx.getFileLines?.(n.filePath) ?? ctx.readFile(n.filePath)?.split(/\r?\n/) ?? [];
797
+ return lines.slice(n.startLine - 1, n.startLine + 2).join('\n');
798
+ }
799
+ function goTypeParameterNames(n, ctx) {
800
+ const text = goDeclarationText(n, ctx);
801
+ const open = /^\s*(?:type\s+)?[A-Za-z_]\w*\s*\[/.exec(text);
802
+ const list = open ? goListItems(text, open[0].length - 1) : null;
803
+ return list ? list.items.flatMap((item) => /^[A-Za-z_]\w*/.exec(item)?.[0] ?? []) : [];
804
+ }
805
+ function isGoTrueAlias(n, ctx) {
806
+ return /^\s*(?:type\s+)?[A-Za-z_]\w*\s*(?:\[[^\]]*\]\s*)?=/.test(goDeclarationText(n, ctx));
807
+ }
808
+ function goGrpcServerArity(signature) {
809
+ const parts = goSignatureParts(signature);
810
+ const opts = parts?.params[parts.params.length - 1];
811
+ if (!parts || !opts || !/^(?:[A-Za-z_]\w*\s+)?\.\.\.\s*(?:grpc\.)?CallOption$/.test(opts))
812
+ return null;
813
+ const unary = parts.results.length === 2 && parts.results[0].startsWith('*');
814
+ return `${parts.params.length - 1}/${unary ? 2 : 1}`;
815
+ }
816
+ async function goImplementsEdges(queries, ctx, onYield) {
849
817
  let scanned255 = 0;
850
818
  const edges = [];
851
819
  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'])) {
820
+ const goImplementers = [];
821
+ for (const n of queries.iterateNodesByKindIn(['struct', 'type_alias'], ['go'])) {
862
822
  if ((++scanned255 & 63) === 0)
863
823
  await onYield();
864
- goStructs.push(s);
824
+ goImplementers.push(n);
865
825
  }
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'])) {
826
+ const goInterfaces = [];
827
+ for (const i of queries.iterateNodesByKindIn('interface', ['go'])) {
870
828
  if ((++scanned255 & 63) === 0)
871
829
  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)
830
+ goInterfaces.push(i);
831
+ }
832
+ const typeKind = new Map();
833
+ for (const n of goImplementers)
834
+ typeKind.set(n.id, n.kind);
835
+ for (const i of goInterfaces)
836
+ typeKind.set(i.id, 'interface');
837
+ const kindOf = (id) => typeKind.get(id) ?? null;
838
+ const ownMemo = new Map();
839
+ const ownSignatures = new Map();
840
+ const ownMethods = (id) => {
841
+ let names = ownMemo.get(id);
842
+ if (!names) {
843
+ names = new Set();
844
+ const signatures = new Map();
845
+ for (const e of queries.getOutgoingEdges(id, ['contains'])) {
846
+ const n = queries.getNodeById(e.target);
847
+ if (!n || n.kind !== 'method')
848
+ continue;
849
+ const key = goMethodKey(n);
850
+ names.add(key);
851
+ const list = signatures.get(key);
852
+ if (list)
853
+ list.push(n.signature);
854
+ else
855
+ signatures.set(key, [n.signature]);
856
+ }
857
+ ownMemo.set(id, names);
858
+ ownSignatures.set(id, signatures);
859
+ }
860
+ return names;
861
+ };
862
+ const isEmbedding = (e) => isGoEmbedding(e, kindOf);
863
+ const NO_EMBEDS = [];
864
+ const embedMemo = new Map();
865
+ const typeIds = [...typeKind.keys()];
866
+ for (let i = 0; i < typeIds.length; i += 2000) {
867
+ for (const e of queries.getOutgoingEdgesFrom(typeIds.slice(i, i + 2000), ['extends', 'implements'])) {
868
+ if (!isEmbedding(e))
881
869
  continue;
882
- let all = true;
883
- for (const m of want) {
884
- if (!have.has(m)) {
885
- all = false;
870
+ const targets = embedMemo.get(e.source);
871
+ if (targets)
872
+ targets.push(e.target);
873
+ else
874
+ embedMemo.set(e.source, [e.target]);
875
+ }
876
+ await onYield();
877
+ }
878
+ const embeds = (id) => embedMemo.get(id) ?? NO_EMBEDS;
879
+ const embedClosure = (id) => {
880
+ if (embeds(id).length === 0)
881
+ return [id];
882
+ const reached = new Set([id]);
883
+ const pending = [id];
884
+ while (pending.length > 0) {
885
+ const at = pending.pop();
886
+ for (const t of embeds(at)) {
887
+ if (reached.has(t))
888
+ continue;
889
+ reached.add(t);
890
+ pending.push(t);
891
+ }
892
+ }
893
+ return [...reached];
894
+ };
895
+ const outside = new Map();
896
+ for (const ref of queries.getUnresolvedReferencesFromNodes(typeIds, ['extends'])) {
897
+ if (ref.language !== 'go' || !ref.filePath)
898
+ continue;
899
+ const name = ref.referenceName;
900
+ const { written, imported } = (0, name_matcher_1.goRefQualification)({ ...ref, filePath: ref.filePath, language: 'go' }, ctx);
901
+ const importPath = imported?.source ?? null;
902
+ const known = imported ? (0, go_stdlib_methods_1.goStdlibMethods)(importPath, name) : written ? undefined : (0, go_stdlib_methods_1.goStdlibMethods)(null, name);
903
+ let found = outside.get(ref.fromNodeId);
904
+ if (!found)
905
+ outside.set(ref.fromNodeId, (found = { stdlib: [], opaque: [] }));
906
+ if (known)
907
+ found.stdlib.push(new Map([...known].map(([m, arity]) => [goStdlibMethodKey(importPath, m), arity])));
908
+ else if (imported)
909
+ found.opaque.push(`${imported.source}.${name}`);
910
+ else if (written)
911
+ found.opaque.push(`${written}.${name}`);
912
+ else
913
+ found.opaque.push(`${ref.filePath.replace(/\\/g, '/').replace(/\/?[^/]*$/, '')}#${name}`);
914
+ }
915
+ await onYield();
916
+ const NONE_OPAQUE = new Set();
917
+ const methodNames = (id) => {
918
+ const types = embedClosure(id);
919
+ if (types.length === 1 && !outside.has(id))
920
+ return { methods: ownMethods(id), opaque: NONE_OPAQUE };
921
+ const methods = new Set();
922
+ const opaque = new Set();
923
+ for (const t of types) {
924
+ for (const m of ownMethods(t))
925
+ methods.add(m);
926
+ const out = outside.get(t);
927
+ if (!out)
928
+ continue;
929
+ for (const known of out.stdlib)
930
+ for (const key of known.keys())
931
+ methods.add(key);
932
+ for (const type of out.opaque)
933
+ opaque.add(type);
934
+ }
935
+ return { methods, opaque };
936
+ };
937
+ const covers = (have, want) => {
938
+ if (have.size < want.size)
939
+ return false;
940
+ for (const m of want) {
941
+ if (!have.has(m))
942
+ return false;
943
+ }
944
+ return true;
945
+ };
946
+ const coversOpaque = (have, want) => {
947
+ for (const type of want.opaque) {
948
+ if (!have.opaque.has(type))
949
+ return false;
950
+ }
951
+ return true;
952
+ };
953
+ const arityMemo = new Map();
954
+ const methodArities = (id) => {
955
+ let arities = arityMemo.get(id);
956
+ if (arities)
957
+ return arities;
958
+ arities = new Map();
959
+ for (const t of embedClosure(id)) {
960
+ ownMethods(t);
961
+ for (const [name, signatures] of ownSignatures.get(t) ?? []) {
962
+ let known = arities.get(name);
963
+ if (known === null)
964
+ continue;
965
+ if (!known)
966
+ arities.set(name, (known = new Set()));
967
+ for (const signature of signatures) {
968
+ const arity = goSignatureArity(signature);
969
+ if (arity === null) {
970
+ arities.set(name, null);
971
+ break;
972
+ }
973
+ known.add(arity);
974
+ }
975
+ }
976
+ for (const methods of outside.get(t)?.stdlib ?? []) {
977
+ for (const [name, arity] of methods) {
978
+ let known = arities.get(name);
979
+ if (known === null)
980
+ continue;
981
+ if (!known)
982
+ arities.set(name, (known = new Set()));
983
+ known.add(arity);
984
+ }
985
+ }
986
+ }
987
+ arityMemo.set(id, arities);
988
+ return arities;
989
+ };
990
+ const wantedArities = (iface) => {
991
+ const own = methodArities(iface.id);
992
+ const wanted = new Map();
993
+ for (const t of embedClosure(iface.id)) {
994
+ for (const [name, signatures] of ownSignatures.get(t) ?? []) {
995
+ let arities = wanted.get(name);
996
+ if (!arities)
997
+ wanted.set(name, (arities = new Set(own.get(name))));
998
+ for (const signature of signatures) {
999
+ const served = goGrpcServerArity(signature);
1000
+ if (served === null)
1001
+ return own;
1002
+ arities.add(served);
1003
+ }
1004
+ }
1005
+ }
1006
+ for (const [name, arities] of own)
1007
+ if (!wanted.has(name))
1008
+ wanted.set(name, arities);
1009
+ return wanted;
1010
+ };
1011
+ const aritiesFit = (typeId, wanted) => {
1012
+ const have = methodArities(typeId);
1013
+ for (const [name, arities] of wanted) {
1014
+ const got = have.get(name);
1015
+ if (!arities || !got)
1016
+ continue;
1017
+ let fits = false;
1018
+ for (const arity of arities) {
1019
+ if (got.has(arity)) {
1020
+ fits = true;
886
1021
  break;
887
1022
  }
888
1023
  }
889
- if (!all)
1024
+ if (!fits)
1025
+ return false;
1026
+ }
1027
+ return true;
1028
+ };
1029
+ const typesMemo = new Map();
1030
+ const methodTypes = (id) => {
1031
+ let types = typesMemo.get(id);
1032
+ if (types)
1033
+ return types;
1034
+ types = new Map();
1035
+ for (const t of embedClosure(id)) {
1036
+ ownMethods(t);
1037
+ for (const [name, signatures] of ownSignatures.get(t) ?? []) {
1038
+ let known = types.get(name);
1039
+ if (known === null)
1040
+ continue;
1041
+ if (!known)
1042
+ types.set(name, (known = []));
1043
+ for (const signature of signatures) {
1044
+ const read = goMethodTypes(signature);
1045
+ if (!read) {
1046
+ types.set(name, null);
1047
+ break;
1048
+ }
1049
+ known.push(read);
1050
+ }
1051
+ }
1052
+ for (const methods of outside.get(t)?.stdlib ?? [])
1053
+ for (const name of methods.keys())
1054
+ types.set(name, null);
1055
+ }
1056
+ typesMemo.set(id, types);
1057
+ return types;
1058
+ };
1059
+ let aliases;
1060
+ const parameterMemo = new Map();
1061
+ const typeParameters = (id) => {
1062
+ let names = parameterMemo.get(id);
1063
+ if (!names) {
1064
+ const type = queries.getNodeById(id);
1065
+ parameterMemo.set(id, (names = type ? goTypeParameterNames(type, ctx) : []));
1066
+ }
1067
+ return names;
1068
+ };
1069
+ const typesFit = (s, iface) => {
1070
+ aliases ??= new Set(goImplementers.filter((n) => n.kind === 'type_alias' && isGoTrueAlias(n, ctx)).map((n) => n.name));
1071
+ const known = aliases;
1072
+ const parameters = new Set([...embedClosure(s.id), ...embedClosure(iface.id)].flatMap(typeParameters));
1073
+ const open = (type) => type === null ||
1074
+ type.split(/\W+/).some((word) => known.has(word) || parameters.has(word));
1075
+ const sameType = (a, b) => a === b || open(a) || open(b);
1076
+ const have = methodTypes(s.id);
1077
+ for (const [name, wantedTypes] of methodTypes(iface.id)) {
1078
+ const got = have.get(name);
1079
+ if (!wantedTypes || !got)
890
1080
  continue;
1081
+ const fits = wantedTypes.some((want) => got.some((type) => type.length !== want.length || type.every((t, i) => sameType(t, want[i]))));
1082
+ if (!fits)
1083
+ return false;
1084
+ }
1085
+ return true;
1086
+ };
1087
+ const candidates = [];
1088
+ const candidateMethods = new Map();
1089
+ for (const s of goImplementers) {
1090
+ if ((++scanned255 & 63) === 0)
1091
+ await onYield();
1092
+ const have = methodNames(s.id);
1093
+ if (have.methods.size + have.opaque.size === 0)
1094
+ continue;
1095
+ candidates.push(s);
1096
+ candidateMethods.set(s.id, have);
1097
+ }
1098
+ for (const iface of goInterfaces) {
1099
+ if ((++scanned255 & 63) === 0)
1100
+ await onYield();
1101
+ const want = methodNames(iface.id);
1102
+ if (want.methods.size + want.opaque.size === 0)
1103
+ continue;
1104
+ let added = 0;
1105
+ const link = (s) => {
891
1106
  const key = `${s.id}>${iface.id}`;
892
1107
  if (seen.has(key))
893
- continue;
1108
+ return;
894
1109
  seen.add(key);
895
1110
  edges.push({
896
1111
  source: s.id,
@@ -901,32 +1116,45 @@ async function goImplementsEdges(queries, onYield) {
901
1116
  metadata: { synthesizedBy: 'go-implements', via: iface.name, registeredAt: `${s.filePath}:${s.startLine}` },
902
1117
  });
903
1118
  added++;
1119
+ };
1120
+ const throughEmbedding = [];
1121
+ let wanted;
1122
+ let covering = 0;
1123
+ let sole;
1124
+ for (const s of candidates) {
1125
+ if (added >= MAX_CALLBACKS_PER_CHANNEL)
1126
+ break;
1127
+ const have = candidateMethods.get(s.id);
1128
+ if (!covers(have.methods, want.methods))
1129
+ continue;
1130
+ if (!wanted)
1131
+ wanted = wantedArities(iface);
1132
+ if (!aritiesFit(s.id, wanted) || !typesFit(s, iface))
1133
+ continue;
1134
+ covering++;
1135
+ if (embeds(s.id).includes(iface.id))
1136
+ continue;
1137
+ if (!coversOpaque(have, want)) {
1138
+ if (covering === 1)
1139
+ sole = s;
1140
+ continue;
1141
+ }
1142
+ const own = ownMethods(s.id);
1143
+ if (want.opaque.size > 0 || (own !== have.methods && !covers(own, want.methods)))
1144
+ throughEmbedding.push(s);
1145
+ else
1146
+ link(s);
1147
+ }
1148
+ if (sole && covering === 1 && want.methods.size > 0)
1149
+ throughEmbedding.push(sole);
1150
+ for (const s of throughEmbedding) {
1151
+ if (added >= MAX_CALLBACKS_PER_CHANNEL)
1152
+ break;
1153
+ link(s);
904
1154
  }
905
1155
  }
906
1156
  return edges;
907
1157
  }
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
1158
  async function goCrossFileMethodContainsEdges(queries, onYield) {
931
1159
  let scanned255 = 0;
932
1160
  const edges = [];
@@ -939,8 +1167,6 @@ async function goCrossFileMethodContainsEdges(queries, onYield) {
939
1167
  for (const method of queries.iterateNodesByKindIn('method', ['go'])) {
940
1168
  if ((++scanned255 & 63) === 0)
941
1169
  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
1170
  const qn = method.qualifiedName;
945
1171
  if (!qn)
946
1172
  continue;
@@ -950,7 +1176,6 @@ async function goCrossFileMethodContainsEdges(queries, onYield) {
950
1176
  const receiver = qn.slice(0, sep);
951
1177
  if (!receiver)
952
1178
  continue;
953
- // Already attached to its type (same-file case handled at extraction)?
954
1179
  const hasTypeParent = queries
955
1180
  .getIncomingEdges(method.id, ['contains'])
956
1181
  .some((e) => {
@@ -959,10 +1184,6 @@ async function goCrossFileMethodContainsEdges(queries, onYield) {
959
1184
  });
960
1185
  if (hasTypeParent)
961
1186
  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
1187
  const dir = dirOf(method.filePath);
967
1188
  const owner = queries
968
1189
  .getNodesByName(receiver)
@@ -978,31 +1199,6 @@ async function goCrossFileMethodContainsEdges(queries, onYield) {
978
1199
  }
979
1200
  return edges;
980
1201
  }
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
1202
  const KMP_TYPE_KINDS = new Set(['class', 'interface', 'struct', 'enum', 'type_alias']);
1007
1203
  function kmpKindsCompatible(a, b) {
1008
1204
  return a === b || (KMP_TYPE_KINDS.has(a) && KMP_TYPE_KINDS.has(b));
@@ -1011,11 +1207,6 @@ async function kotlinExpectActualEdges(queries, onYield) {
1011
1207
  let scanned255 = 0;
1012
1208
  const edges = [];
1013
1209
  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
1210
  for (const act of queries.iterateNodesByLanguageWithDecorator('kotlin', 'actual')) {
1020
1211
  if ((++scanned255 & 63) === 0)
1021
1212
  await onYield();
@@ -1025,8 +1216,6 @@ async function kotlinExpectActualEdges(queries, onYield) {
1025
1216
  for (const cand of queries.getNodesByQualifiedNameExact(act.qualifiedName)) {
1026
1217
  if (added >= MAX_CALLBACKS_PER_CHANNEL)
1027
1218
  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
1219
  if (cand.language !== 'kotlin' || cand.id === act.id)
1031
1220
  continue;
1032
1221
  if (!kmpKindsCompatible(cand.kind, act.kind) || cand.filePath === act.filePath)
@@ -1054,13 +1243,106 @@ async function kotlinExpectActualEdges(queries, onYield) {
1054
1243
  }
1055
1244
  return edges;
1056
1245
  }
1057
- async function interfaceOverrideEdges(queries, onYield) {
1246
+ function goPromotions(queries, methodsOf) {
1247
+ const kinds = new Map();
1248
+ const kindOf = (id) => {
1249
+ let kind = kinds.get(id);
1250
+ if (kind === undefined) {
1251
+ const n = queries.getNodeById(id);
1252
+ kind = n?.language === 'go' && (n.kind === 'struct' || n.kind === 'interface' || n.kind === 'type_alias')
1253
+ ? n.kind
1254
+ : null;
1255
+ kinds.set(id, kind);
1256
+ }
1257
+ return kind;
1258
+ };
1259
+ const embedMemo = new Map();
1260
+ const embeds = (id) => {
1261
+ let out = embedMemo.get(id);
1262
+ if (!out) {
1263
+ const targets = new Set();
1264
+ out = queries.getOutgoingEdges(id, ['extends', 'implements']).filter((e) => {
1265
+ if (!isGoEmbedding(e, kindOf) || targets.has(e.target))
1266
+ return false;
1267
+ targets.add(e.target);
1268
+ return true;
1269
+ });
1270
+ embedMemo.set(id, out);
1271
+ }
1272
+ return out;
1273
+ };
1274
+ const ifaceMemo = new Map();
1275
+ const ifaceMethods = (id) => {
1276
+ let names = ifaceMemo.get(id);
1277
+ if (!names) {
1278
+ names = new Set();
1279
+ const reached = new Set([id]);
1280
+ const pending = [id];
1281
+ while (pending.length > 0) {
1282
+ const at = pending.pop();
1283
+ for (const m of methodsOf(at))
1284
+ names.add(goMethodKey(m));
1285
+ for (const e of embeds(at)) {
1286
+ if (reached.has(e.target))
1287
+ continue;
1288
+ reached.add(e.target);
1289
+ pending.push(e.target);
1290
+ }
1291
+ }
1292
+ ifaceMemo.set(id, names);
1293
+ }
1294
+ return names;
1295
+ };
1296
+ const provides = (id, key) => kindOf(id) === 'interface' ? ifaceMethods(id).has(key) : methodsOf(id).some((m) => goMethodKey(m) === key);
1297
+ const memo = new Map();
1298
+ return (structId, key) => {
1299
+ const memoKey = `${structId}>${key}`;
1300
+ const hit = memo.get(memoKey);
1301
+ if (hit !== undefined)
1302
+ return hit;
1303
+ let found = null;
1304
+ let level = new Map([[structId, { paths: 1, line: 0 }]]);
1305
+ const met = new Set([structId]);
1306
+ for (let depth = 0; level.size > 0; depth++) {
1307
+ const next = new Map();
1308
+ for (const [id, at] of level) {
1309
+ if (kindOf(id) === 'interface')
1310
+ continue;
1311
+ for (const e of embeds(id)) {
1312
+ if (met.has(e.target))
1313
+ continue;
1314
+ const to = next.get(e.target);
1315
+ if (to)
1316
+ to.paths += at.paths;
1317
+ else
1318
+ next.set(e.target, { paths: at.paths, line: depth === 0 ? (e.line ?? 0) : at.line });
1319
+ }
1320
+ }
1321
+ let paths = 0;
1322
+ let provider;
1323
+ for (const [id, at] of next) {
1324
+ met.add(id);
1325
+ if (!provides(id, key))
1326
+ continue;
1327
+ paths += at.paths;
1328
+ provider = id;
1329
+ }
1330
+ if (provider !== undefined) {
1331
+ if (paths === 1 && kindOf(provider) !== 'interface') {
1332
+ found = { methods: methodsOf(provider).filter((m) => goMethodKey(m) === key), line: next.get(provider).line };
1333
+ }
1334
+ break;
1335
+ }
1336
+ level = next;
1337
+ }
1338
+ memo.set(memoKey, found);
1339
+ return found;
1340
+ };
1341
+ }
1342
+ async function interfaceOverrideEdges(queries, ctx, onYield) {
1058
1343
  let scanned255 = 0;
1059
1344
  const edges = [];
1060
1345
  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
1346
  const methodsMemo = new Map();
1065
1347
  const methodsOf = (classId) => {
1066
1348
  const hit = methodsMemo.get(classId);
@@ -1073,10 +1355,6 @@ async function interfaceOverrideEdges(queries, onYield) {
1073
1355
  methodsMemo.set(classId, methods);
1074
1356
  return methods;
1075
1357
  };
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
1358
  const protocolMemo = new Map();
1081
1359
  const baseMethodsOf = (base) => {
1082
1360
  if (base.language !== 'swift' || base.kind !== 'interface')
@@ -1094,48 +1372,72 @@ async function interfaceOverrideEdges(queries, onYield) {
1094
1372
  protocolMemo.set(base.id, methods);
1095
1373
  return methods;
1096
1374
  };
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.
1375
+ const overridesOf = (0, override_parameters_1.overrideFilter)(ctx);
1376
+ const nameCounts = new Map();
1377
+ const declaredNamed = (base, name) => {
1378
+ let counts = nameCounts.get(base.id);
1379
+ if (!counts) {
1380
+ counts = new Map();
1381
+ for (const m of baseMethodsOf(base))
1382
+ counts.set(m.name, (counts.get(m.name) ?? 0) + 1);
1383
+ nameCounts.set(base.id, counts);
1384
+ }
1385
+ return counts.get(name) ?? 0;
1386
+ };
1387
+ const goPromotion = goPromotions(queries, methodsOf);
1388
+ const promoted = [];
1100
1389
  const concreteKinds = ['class', 'struct', 'union'];
1101
- for (const kind of concreteKinds) {
1102
- for (const cls of queries.iterateNodesByKind(kind)) {
1390
+ const concrete = [
1391
+ ...concreteKinds.map((kind) => () => queries.iterateNodesByKind(kind)),
1392
+ () => queries.iterateNodesByKindIn('type_alias', ['go']),
1393
+ ];
1394
+ for (const nodesOfKind of concrete) {
1395
+ for (const cls of nodesOfKind()) {
1103
1396
  if ((++scanned255 & 63) === 0)
1104
1397
  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
1398
  const sups = queries.getOutgoingEdges(cls.id, ['implements', 'extends']);
1109
1399
  if (sups.length === 0)
1110
1400
  continue;
1111
1401
  const implMethods = methodsOf(cls.id).filter((n) => IFACE_OVERRIDE_LANGS.has(n.language));
1112
- if (implMethods.length === 0)
1402
+ const goStruct = cls.language === 'go' && cls.kind === 'struct';
1403
+ if (implMethods.length === 0 && !(goStruct && sups.some((s) => s.provenance === 'heuristic')))
1113
1404
  continue;
1114
1405
  for (const sup of sups) {
1115
1406
  const base = queries.getNodeById(sup.target);
1116
1407
  if (!base || !IFACE_OVERRIDE_LANGS.has(base.language) || base.id === cls.id)
1117
1408
  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();
1409
+ if (cls.language === 'go' && base.kind !== 'interface')
1410
+ continue;
1411
+ const promotes = goStruct && sup.provenance === 'heuristic' && base.kind === 'interface';
1412
+ const keyOf = base.language === 'go' && base.kind === 'interface' ? goMethodKey : (m) => m.name;
1413
+ const implsByKey = new Map();
1123
1414
  for (const m of implMethods) {
1124
- const arr = implByName.get(m.name);
1415
+ const key = keyOf(m);
1416
+ const arr = implsByKey.get(key);
1125
1417
  if (arr)
1126
1418
  arr.push(m);
1127
1419
  else
1128
- implByName.set(m.name, [m]);
1420
+ implsByKey.set(key, [m]);
1129
1421
  }
1130
1422
  let added = 0;
1423
+ const unmatched = [];
1131
1424
  for (const bm of baseMethodsOf(base)) {
1132
1425
  if (added >= MAX_CALLBACKS_PER_CHANNEL)
1133
1426
  break;
1134
- for (const m of implByName.get(bm.name) ?? []) {
1427
+ const impls = implsByKey.get(keyOf(bm));
1428
+ if (!impls) {
1429
+ if (promotes)
1430
+ unmatched.push(bm);
1431
+ continue;
1432
+ }
1433
+ const overloaded = impls.length > 1 || declaredNamed(base, bm.name) > 1;
1434
+ for (const m of overloaded ? overridesOf(bm, impls) : impls) {
1135
1435
  if (added >= MAX_CALLBACKS_PER_CHANNEL)
1136
1436
  break;
1137
1437
  if (bm.id === m.id)
1138
1438
  continue;
1439
+ if (STATIC_SPLIT_LANGS.has(m.language) && (bm.isStatic === true) !== (m.isStatic === true))
1440
+ continue;
1139
1441
  const key = `${bm.id}>${m.id}`;
1140
1442
  if (seen.has(key))
1141
1443
  continue;
@@ -1151,46 +1453,54 @@ async function interfaceOverrideEdges(queries, onYield) {
1151
1453
  added++;
1152
1454
  }
1153
1455
  }
1456
+ if (unmatched.length > 0 && added < MAX_CALLBACKS_PER_CHANNEL) {
1457
+ promoted.push({ cls, methods: unmatched, left: MAX_CALLBACKS_PER_CHANNEL - added });
1458
+ }
1459
+ }
1460
+ }
1461
+ }
1462
+ for (const { cls, methods, left } of promoted) {
1463
+ if ((++scanned255 & 63) === 0)
1464
+ await onYield();
1465
+ let budget = left;
1466
+ for (const bm of methods) {
1467
+ if (budget <= 0)
1468
+ break;
1469
+ const promotion = goPromotion(cls.id, goMethodKey(bm));
1470
+ if (!promotion)
1471
+ continue;
1472
+ for (const m of promotion.methods) {
1473
+ if (budget <= 0)
1474
+ break;
1475
+ const key = `${bm.id}>${m.id}`;
1476
+ if (seen.has(key))
1477
+ continue;
1478
+ seen.add(key);
1479
+ edges.push({
1480
+ source: bm.id,
1481
+ target: m.id,
1482
+ kind: 'calls',
1483
+ line: bm.startLine,
1484
+ provenance: 'heuristic',
1485
+ metadata: {
1486
+ synthesizedBy: 'interface-impl',
1487
+ via: m.name,
1488
+ promotedInto: cls.name,
1489
+ registeredAt: `${cls.filePath}:${promotion.line || cls.startLine}`,
1490
+ },
1491
+ });
1492
+ budget--;
1154
1493
  }
1155
1494
  }
1156
1495
  }
1157
1496
  return edges;
1158
1497
  }
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
1498
  async function goGrpcStubImplEdges(queries, onYield) {
1185
1499
  let scanned255 = 0;
1186
1500
  const edges = [];
1187
1501
  const seen = new Set();
1188
1502
  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
1503
  const isInternalMarker = (n) => n.startsWith('mustEmbed') || n === 'testEmbeddedByValue';
1193
- // Methods directly contained by each Go struct, name-only. Built once.
1194
1504
  const methodNamesByStruct = new Map();
1195
1505
  const methodNodesByStruct = new Map();
1196
1506
  const goStructs = [];
@@ -1208,10 +1518,6 @@ async function goGrpcStubImplEdges(queries, onYield) {
1208
1518
  for (const stub of goStructs) {
1209
1519
  if (!STUB_RE.test(stub.name))
1210
1520
  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
1521
  if (!(0, generated_detection_1.isGeneratedFile)(stub.filePath))
1216
1522
  continue;
1217
1523
  const stubMethods = (methodNodesByStruct.get(stub.id) ?? []).filter((m) => !isInternalMarker(m.name));
@@ -1221,18 +1527,11 @@ async function goGrpcStubImplEdges(queries, onYield) {
1221
1527
  for (const cand of goStructs) {
1222
1528
  if (cand.id === stub.id)
1223
1529
  continue;
1224
- // Skip generated-file candidates — they're siblings (msgClient,
1225
- // UnsafeMsgServer, …) whose method sets coincidentally match.
1226
1530
  if ((0, generated_detection_1.isGeneratedFile)(cand.filePath))
1227
1531
  continue;
1228
1532
  const candNames = methodNamesByStruct.get(cand.id);
1229
1533
  if (!candNames)
1230
1534
  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
1535
  if (!stubMethodNames.every((n) => candNames.has(n)))
1237
1536
  continue;
1238
1537
  const candMethods = methodNodesByStruct.get(cand.id) ?? [];
@@ -1268,15 +1567,13 @@ async function goGrpcStubImplEdges(queries, onYield) {
1268
1567
  }
1269
1568
  return edges;
1270
1569
  }
1271
- /** Kinds a JSX tag can name. A tag that resolves only to a type is markup we drop. */
1272
1570
  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
1571
  const JSX_CHILD_LANGUAGES = [...JS_FAMILY, 'vue', 'svelte'];
1572
+ const JSX_INPUT_FILE = /\.(?:[cm]?[jt]sx?|vue|svelte|astro)$/;
1573
+ function isJsxChildCandidate(node) {
1574
+ return JSX_CHILD_KINDS.has(node.kind) && JS_FAMILY.includes(node.language) &&
1575
+ (node.kind === 'component' || /^[A-Z]/.test(node.name));
1576
+ }
1280
1577
  function languageForJsxFile(file) {
1281
1578
  if (file.endsWith('.tsx'))
1282
1579
  return 'tsx';
@@ -1290,45 +1587,75 @@ function languageForJsxFile(file) {
1290
1587
  return 'svelte';
1291
1588
  return 'javascript';
1292
1589
  }
1293
- /** `localName` → the project file it is imported from, for one file's imports. */
1294
1590
  function importedFrom(ctx, file, language) {
1295
1591
  const out = new Map();
1296
1592
  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
1593
  const resolved = im.resolvedPath ?? (0, import_resolver_1.resolveImportPath)(im.source, file, language, ctx);
1300
1594
  if (resolved)
1301
1595
  out.set(im.localName, resolved);
1302
1596
  }
1303
1597
  return out;
1304
1598
  }
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));
1599
+ function importedFromPackage(ctx, name, file) {
1600
+ const language = languageForJsxFile(file);
1601
+ const binding = ctx.getImportMappings(file, language).find((m) => m.localName === name);
1602
+ return !!binding && ctx.isOutOfRepoImport?.(binding.source, file, language) === true;
1603
+ }
1604
+ function projectImport(ctx, name, file) {
1605
+ const language = languageForJsxFile(file);
1606
+ const binding = ctx.getImportMappings(file, language).find((m) => m.localName === name);
1607
+ if (!binding || binding.isNamespace)
1608
+ return undefined;
1609
+ const module = binding.resolvedPath ?? (0, import_resolver_1.resolveImportPath)(binding.source, file, language, ctx);
1610
+ if (!module || !ctx.getNodesInFile(module).some((n) => n.kind === 'file'))
1611
+ return undefined;
1612
+ return { module, exported: binding.isDefault || binding.exportedName === 'default' ? 'default' : binding.exportedName };
1613
+ }
1614
+ function importedTagModules(ctx, file, content, memo) {
1615
+ const out = new Set();
1616
+ JSX_TAG_RE.lastIndex = 0;
1617
+ const names = new Set();
1618
+ for (let m = JSX_TAG_RE.exec(content); m; m = JSX_TAG_RE.exec(content))
1619
+ names.add(m[1]);
1620
+ for (const name of names) {
1621
+ const imported = projectImport(ctx, name, file);
1622
+ if (!imported)
1623
+ continue;
1624
+ const key = `${imported.module}\0${imported.exported}`;
1625
+ let reads = memo.get(key);
1626
+ if (!reads) {
1627
+ reads = new Set();
1628
+ (0, react_1.exportedComponent)(imported.module, imported.exported, ctx, new Set(), reads);
1629
+ memo.set(key, reads);
1630
+ }
1631
+ for (const read of reads)
1632
+ out.add(read);
1633
+ }
1634
+ out.delete(file);
1635
+ return out;
1636
+ }
1637
+ function jsxChild(ctx, name, file, importsOf, ownValueOf, exportOf) {
1638
+ const own = ownValueOf(name);
1639
+ if (own)
1640
+ return own.component ?? own.declaration;
1641
+ const candidates = ctx.getNodesByName(name).filter((n) => JSX_CHILD_KINDS.has(n.kind) && !(0, name_matcher_1.isManualMockHiddenFrom)(n.filePath, file));
1642
+ const local = candidates.find((n) => n.filePath === file);
1643
+ if (local)
1644
+ return local;
1645
+ if (importedFromPackage(ctx, name, file))
1646
+ return undefined;
1647
+ const imported = projectImport(ctx, name, file);
1648
+ if (imported) {
1649
+ const exported = exportOf(imported.module, imported.exported);
1650
+ if (exported)
1651
+ return exported;
1652
+ const inModule = candidates.find((n) => n.filePath === imported.module);
1653
+ if (inModule)
1654
+ return inModule;
1655
+ if (candidates.length > 0)
1656
+ return undefined;
1657
+ }
1325
1658
  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
1659
  const isDefault = ctx
1333
1660
  .getImportMappings(file, languageForJsxFile(file))
1334
1661
  .some((m) => m.localName === name && m.isDefault);
@@ -1338,9 +1665,6 @@ function jsxChild(ctx, name, file, importsOf) {
1338
1665
  }
1339
1666
  if (candidates.length === 1)
1340
1667
  return candidates[0];
1341
- const local = candidates.find((n) => n.filePath === file);
1342
- if (local)
1343
- return local;
1344
1668
  const from = importsOf().get(name);
1345
1669
  if (from) {
1346
1670
  const imported = candidates.find((n) => n.filePath === from);
@@ -1349,51 +1673,423 @@ function jsxChild(ctx, name, file, importsOf) {
1349
1673
  }
1350
1674
  return candidates.find((n) => JSX_CHILD_LANGUAGES.includes(n.language)) ?? candidates[0];
1351
1675
  }
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
- */
1676
+ function wrappedChild(ctx, name, file, importsOf, ownValueOf, exportOf) {
1677
+ const declared = ownValueOf(name) !== undefined ||
1678
+ (ctx.getNodesInFileNamed?.(file, name) ?? ctx.getNodesInFile(file).filter((n) => n.name === name))
1679
+ .some((n) => JSX_CHILD_KINDS.has(n.kind));
1680
+ if (!declared && !projectImport(ctx, name, file))
1681
+ return undefined;
1682
+ return jsxChild(ctx, name, file, importsOf, ownValueOf, exportOf);
1683
+ }
1684
+ function opensTag(src, at, name) {
1685
+ const end = at + 1 + name.length;
1686
+ if (/^\s+extends\s/.test(src.slice(end, end + 40)))
1687
+ return false;
1688
+ return !/[\w$]/.test(src[at - 1] ?? '') || /\breturn$/.test(src.slice(Math.max(0, at - 7), at));
1689
+ }
1690
+ function writtenBare(src, name) {
1691
+ for (let at = src.indexOf(name); at !== -1; at = src.indexOf(name, at + name.length)) {
1692
+ if (/[\w$]/.test(src[at - 1] ?? '') || /[\w$]/.test(src[at + name.length] ?? ''))
1693
+ continue;
1694
+ if (src[at - 1] === '<' || (src[at - 1] === '/' && src[at - 2] === '<'))
1695
+ continue;
1696
+ return true;
1697
+ }
1698
+ return false;
1699
+ }
1700
+ function ownLinesBind(name, src) {
1701
+ const n = (0, utils_1.escapeRegExp)(name);
1702
+ return new RegExp(`\\b(?:const|let|var)\\s+${n}\\b(?!\\s*[,\\]}])`).test(src);
1703
+ }
1704
+ function declaredInside(ctx, name, parent, child) {
1705
+ const inside = (n) => n.id !== parent.id && n.filePath === parent.filePath &&
1706
+ n.startLine >= parent.startLine && n.startLine <= parent.endLine;
1707
+ if (inside(child))
1708
+ return child;
1709
+ return ctx.getNodesByName(name).find((n) => JSX_CHILD_KINDS.has(n.kind) && inside(n));
1710
+ }
1711
+ function spanTags(src, startLine) {
1712
+ const names = { tags: new Map(), bare: new Set(), src, destructured: new Map() };
1713
+ if (src.includes('</') || src.includes('/>')) {
1714
+ let line = startLine;
1715
+ let counted = 0;
1716
+ JSX_TAG_RE.lastIndex = 0;
1717
+ let m;
1718
+ while ((m = JSX_TAG_RE.exec(src))) {
1719
+ for (let nl = src.indexOf('\n', counted); nl !== -1 && nl < m.index; nl = src.indexOf('\n', nl + 1))
1720
+ line++;
1721
+ counted = m.index;
1722
+ if (!names.tags.get(m[1]))
1723
+ names.tags.set(m[1], opensTag(src, m.index, m[1]) ? line : 0);
1724
+ }
1725
+ for (const [name, first] of names.tags)
1726
+ if (first && writtenBare(src, name))
1727
+ names.bare.add(name);
1728
+ }
1729
+ return names;
1730
+ }
1731
+ function scopeBinds(names, fn, name, line, file, ctx) {
1732
+ return names.bare.has(name) &&
1733
+ ((0, name_matcher_1.jsCodeBindsName)(name, fn, file, line, ctx) || destructuredBy(names, name, line - fn.startLine));
1734
+ }
1735
+ function functionsAround(parents, fn) {
1736
+ const around = [];
1737
+ for (const n of parents) {
1738
+ if (n.startLine <= fn.startLine && n.endLine >= fn.endLine &&
1739
+ (n.startLine !== fn.startLine || n.endLine !== fn.endLine))
1740
+ around.push(n);
1741
+ }
1742
+ return around.sort((a, b) => b.startLine - a.startLine || a.endLine - b.endLine);
1743
+ }
1744
+ function destructuredBy(names, name, index) {
1745
+ const key = `${index}\0${name}`;
1746
+ let binds = names.destructured.get(key);
1747
+ if (binds === undefined)
1748
+ names.destructured.set(key, (binds = destructures(names.src, name, lineEnd(names.src, index))));
1749
+ return binds;
1750
+ }
1751
+ function lineEnd(src, index) {
1752
+ let at = -1;
1753
+ for (let i = 0; i <= index; i++) {
1754
+ at = src.indexOf('\n', at + 1);
1755
+ if (at === -1)
1756
+ return src.length;
1757
+ }
1758
+ return at;
1759
+ }
1760
+ const ID_CHAR = /[\w$]/;
1761
+ const SPACE = /\s/;
1762
+ const PATTERN_REACH = 10_000;
1763
+ const CONTROL_HEADS = new Set(['if', 'while', 'for', 'switch', 'with']);
1764
+ const PARAMETERS_END = /\s*(?::[^=;{}()\n]*)?(?:=>|\{)/y;
1765
+ const IMPORTED_VALUE = /\s*(?::[^=;]*)?=\s*(?:await\s+)?(?:require|import)\s*\(/y;
1766
+ function destructures(src, name, end) {
1767
+ for (let at = src.indexOf(name); at !== -1 && at < end; at = src.indexOf(name, at + name.length)) {
1768
+ if (bindingElementAt(src, at, name.length))
1769
+ return true;
1770
+ }
1771
+ return false;
1772
+ }
1773
+ const DESTRUCTURING_DECLARATION = /\b(?:const|let|var)\s*[{[]/g;
1774
+ function topLevelPatterns(code) {
1775
+ const patterns = [];
1776
+ let depth = 0;
1777
+ let at = 0;
1778
+ DESTRUCTURING_DECLARATION.lastIndex = 0;
1779
+ for (let m = DESTRUCTURING_DECLARATION.exec(code); m; m = DESTRUCTURING_DECLARATION.exec(code)) {
1780
+ for (; at < m.index; at++) {
1781
+ if (code[at] === '{')
1782
+ depth++;
1783
+ else if (code[at] === '}')
1784
+ depth--;
1785
+ }
1786
+ if (depth !== 0)
1787
+ continue;
1788
+ const open = m.index + m[0].length - 1;
1789
+ const close = matchingCloser(code, open);
1790
+ if (close > open)
1791
+ patterns.push([open, close]);
1792
+ }
1793
+ return patterns;
1794
+ }
1795
+ function patternsBind(code, patterns, name) {
1796
+ for (const [open, close] of patterns) {
1797
+ for (let at = code.indexOf(name, open); at !== -1 && at < close; at = code.indexOf(name, at + name.length)) {
1798
+ if (bindingElementAt(code, at, name.length))
1799
+ return true;
1800
+ }
1801
+ }
1802
+ return false;
1803
+ }
1804
+ function bindingElementAt(code, at, length) {
1805
+ if (ID_CHAR.test(code[at - 1] ?? '') || ID_CHAR.test(code[at + length] ?? ''))
1806
+ return false;
1807
+ const next = skipSpace(code, at + length, 1);
1808
+ const after = code[next];
1809
+ if (after !== ',' && after !== '}' && after !== ']' &&
1810
+ (after !== '=' || code[next + 1] === '=' || code[next + 1] === '>'))
1811
+ return false;
1812
+ let prev = skipSpace(code, at - 1, -1);
1813
+ if (code[prev] === '.') {
1814
+ if (code[prev - 1] !== '.' || code[prev - 2] !== '.')
1815
+ return false;
1816
+ prev = skipSpace(code, prev - 3, -1);
1817
+ }
1818
+ let opener = prev;
1819
+ if (code[prev] === ',') {
1820
+ opener = enclosingOpener(code, prev - 1);
1821
+ }
1822
+ else if (code[prev] === ':') {
1823
+ if (!keyOpensElement(code, prev))
1824
+ return false;
1825
+ opener = enclosingOpener(code, prev - 1);
1826
+ if (code[opener] !== '{')
1827
+ return false;
1828
+ }
1829
+ return (code[opener] === '{' || code[opener] === '[') && bindsPattern(code, opener, 0);
1830
+ }
1831
+ function bindsPattern(code, opener, depth) {
1832
+ if (depth > 8)
1833
+ return false;
1834
+ const p = skipSpace(code, opener - 1, -1);
1835
+ const c = code[p];
1836
+ if (c === '(')
1837
+ return opensParameters(code, p);
1838
+ if (c === '[')
1839
+ return bindsPattern(code, p, depth + 1);
1840
+ if (c === ',') {
1841
+ const q = enclosingOpener(code, p - 1);
1842
+ if (code[q] === '(')
1843
+ return opensParameters(code, q);
1844
+ return code[q] === '[' && bindsPattern(code, q, depth + 1);
1845
+ }
1846
+ if (c === ':') {
1847
+ if (!keyOpensElement(code, p))
1848
+ return false;
1849
+ const q = enclosingOpener(code, p - 1);
1850
+ return code[q] === '{' && bindsPattern(code, q, depth + 1);
1851
+ }
1852
+ if (!ID_CHAR.test(c ?? ''))
1853
+ return false;
1854
+ const word = wordEndingAt(code, p);
1855
+ if (word !== 'const' && word !== 'let' && word !== 'var')
1856
+ return false;
1857
+ const close = matchingCloser(code, opener);
1858
+ if (close < 0)
1859
+ return false;
1860
+ IMPORTED_VALUE.lastIndex = close + 1;
1861
+ return !IMPORTED_VALUE.test(code);
1862
+ }
1863
+ function opensParameters(code, paren) {
1864
+ const p = skipSpace(code, paren - 1, -1);
1865
+ if (ID_CHAR.test(code[p] ?? '') && CONTROL_HEADS.has(wordEndingAt(code, p)))
1866
+ return false;
1867
+ const close = matchingCloser(code, paren);
1868
+ if (close < 0)
1869
+ return false;
1870
+ PARAMETERS_END.lastIndex = close + 1;
1871
+ return PARAMETERS_END.test(code);
1872
+ }
1873
+ function keyOpensElement(code, colon) {
1874
+ let k = skipSpace(code, colon - 1, -1);
1875
+ const c = code[k];
1876
+ if (c === ']')
1877
+ k = enclosingOpener(code, k - 1) - 1;
1878
+ else if (c === '"' || c === "'")
1879
+ k = code.lastIndexOf(c, k - 1) - 1;
1880
+ else if (ID_CHAR.test(c ?? ''))
1881
+ while (k >= 0 && ID_CHAR.test(code[k]))
1882
+ k--;
1883
+ else
1884
+ return false;
1885
+ const b = code[skipSpace(code, k, -1)];
1886
+ return b === '{' || b === ',';
1887
+ }
1888
+ function enclosingOpener(code, from) {
1889
+ let depth = 0;
1890
+ for (let i = from, stop = Math.max(0, from - PATTERN_REACH); i >= stop; i--) {
1891
+ const c = code[i];
1892
+ if (c === ')' || c === ']' || c === '}')
1893
+ depth++;
1894
+ else if (c === '(' || c === '[' || c === '{') {
1895
+ if (depth === 0)
1896
+ return i;
1897
+ depth--;
1898
+ }
1899
+ }
1900
+ return -1;
1901
+ }
1902
+ function matchingCloser(code, open) {
1903
+ let depth = 0;
1904
+ for (let i = open, stop = Math.min(code.length, open + PATTERN_REACH); i < stop; i++) {
1905
+ const c = code[i];
1906
+ if (c === '(' || c === '[' || c === '{')
1907
+ depth++;
1908
+ else if ((c === ')' || c === ']' || c === '}') && --depth === 0)
1909
+ return i;
1910
+ }
1911
+ return -1;
1912
+ }
1913
+ function wordEndingAt(code, end) {
1914
+ let start = end;
1915
+ while (start > 0 && ID_CHAR.test(code[start - 1]))
1916
+ start--;
1917
+ return code.slice(start, end + 1);
1918
+ }
1919
+ function skipSpace(code, at, step) {
1920
+ while (at >= 0 && at < code.length && SPACE.test(code[at]))
1921
+ at += step;
1922
+ return at;
1923
+ }
1361
1924
  async function reactJsxChildEdges(ctx, onYield) {
1362
1925
  let scannedFiles = 0;
1363
1926
  const edges = [];
1364
1927
  const seen = new Set();
1365
1928
  const PARENT_KINDS = new Set(['method', 'function', 'component']);
1929
+ const VALUE_PARENT_KINDS = new Set(['constant', 'variable']);
1930
+ const exports = new Map();
1931
+ const exportOf = (module, exported) => {
1932
+ const key = `${module}\0${exported}`;
1933
+ let node = exports.get(key);
1934
+ if (node === undefined) {
1935
+ const id = (0, react_1.exportedComponent)(module, exported, ctx);
1936
+ node = id ? ctx.getNodeById?.(id) ?? null : null;
1937
+ exports.set(key, node);
1938
+ }
1939
+ return node;
1940
+ };
1366
1941
  let scanned = 0;
1367
1942
  for (const file of ctx.getAllFiles()) {
1368
1943
  if ((++scannedFiles & 15) === 0)
1369
1944
  await onYield();
1370
1945
  if ((++scanned & 255) === 0)
1371
- await onYield(); // #1091: yield mid-scan on huge graphs
1946
+ await onYield();
1372
1947
  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));
1948
+ if (!content)
1949
+ continue;
1950
+ const hasTags = content.includes('</') || content.includes('/>');
1951
+ const wraps = WRAPPER_CALL_RE.test(content);
1952
+ if (!hasTags && !wraps)
1953
+ continue;
1954
+ const inFile = ctx.getNodesInFile(file);
1955
+ const ownValues = new Map();
1956
+ const ownValueOf = (name) => {
1957
+ if (!ownValues.has(name))
1958
+ ownValues.set(name, (0, react_1.declaredComponent)(name, file, ctx));
1959
+ return ownValues.get(name);
1960
+ };
1961
+ if (wraps) {
1962
+ let wrapperImports = null;
1963
+ for (const wrapper of inFile) {
1964
+ if (wrapper.kind !== 'component' || !JS_FAMILY.includes(wrapper.language))
1965
+ continue;
1966
+ const name = (0, react_1.wrappedComponentName)(wrapper, ctx);
1967
+ if (!name)
1968
+ continue;
1969
+ const importsOf = () => (wrapperImports ??= importedFrom(ctx, file, wrapper.language));
1970
+ const child = wrappedChild(ctx, name, file, importsOf, ownValueOf, exportOf);
1971
+ if (!child || child.id === wrapper.id || (0, name_matcher_1.crossesCodeBoundary)(wrapper.language, child.language))
1972
+ continue;
1973
+ const key = `${wrapper.id}>${child.id}`;
1974
+ if (seen.has(key))
1975
+ continue;
1976
+ seen.add(key);
1977
+ edges.push({
1978
+ source: wrapper.id, target: child.id, kind: 'calls', line: wrapper.startLine,
1979
+ provenance: 'heuristic',
1980
+ metadata: { synthesizedBy: 'jsx-render', via: name, wrapped: true },
1981
+ });
1982
+ }
1983
+ }
1984
+ if (!hasTags)
1985
+ continue;
1986
+ const fns = inFile.filter((n) => PARENT_KINDS.has(n.kind) && JSX_FAMILY.includes(n.language));
1987
+ let code;
1988
+ const codeOf = () => (code === undefined ? (code = (0, jsx_code_1.jsxCode)(content)) : code);
1989
+ let lines = null;
1990
+ const holds = (n) => PARENT_KINDS.has(n.kind) || n.kind === 'class';
1991
+ let fileNode = inFile.find((n) => n.kind === 'file' && JSX_FAMILY.includes(n.language));
1992
+ const owns = new Map();
1993
+ let values = [];
1994
+ if (fileNode) {
1995
+ const held = new Uint8Array((fileNode.endLine || 0) + 2);
1996
+ const valuesOn = new Uint8Array(held.length);
1997
+ for (const n of inFile) {
1998
+ if (n.kind === 'file' || n.kind === 'import' || n.kind === 'export' || n.kind === 'route' ||
1999
+ !n.startLine || !n.endLine)
2000
+ continue;
2001
+ const mark = holds(n) ? 1 : 2;
2002
+ for (let l = n.startLine; l <= n.endLine && l < held.length; l++)
2003
+ if (held[l] !== 1)
2004
+ held[l] = mark;
2005
+ }
2006
+ values = inFile.filter((n) => VALUE_PARENT_KINDS.has(n.kind) && JSX_FAMILY.includes(n.language) &&
2007
+ held[n.startLine] !== 1);
2008
+ const raw = (lines ??= (codeOf() ?? content).split('\n'));
2009
+ for (const v of values) {
2010
+ for (let l = v.startLine; l <= v.endLine && l < valuesOn.length; l++)
2011
+ if (valuesOn[l] < 2)
2012
+ valuesOn[l]++;
2013
+ const before = (raw[v.startLine - 1] ?? '').slice(0, v.startColumn ?? 0);
2014
+ const after = (raw[v.endLine - 1] ?? '').slice(v.endColumn ?? Infinity);
2015
+ if (!/^\s*(?:(?:export|declare|default|const|let|var)\s+)*$/.test(before))
2016
+ valuesOn[v.startLine] = 2;
2017
+ if (!/^[\s;]*$/.test(after))
2018
+ valuesOn[v.endLine] = 2;
2019
+ }
2020
+ for (const v of values)
2021
+ owns.set(v.id, (line) => held[line] !== 1 && valuesOn[line] === 1);
2022
+ if (held.subarray(1, fileNode.endLine + 1).includes(0))
2023
+ owns.set(fileNode.id, (line) => !held[line]);
2024
+ else
2025
+ fileNode = undefined;
2026
+ }
2027
+ const parents = [...fns, ...values, ...(fileNode ? [fileNode] : [])];
1378
2028
  if (parents.length === 0)
1379
2029
  continue;
1380
- // Read once per file, and only when a name actually turns out ambiguous.
1381
2030
  let imports = null;
1382
2031
  const importsOf = () => (imports ??= importedFrom(ctx, file, parents[0].language));
2032
+ const tagsBySpan = new Map();
2033
+ const spanOf = (fn) => {
2034
+ const own = owns.get(fn.id);
2035
+ const span = own ? fn.id : `${fn.startLine}:${fn.endLine}`;
2036
+ let names = tagsBySpan.get(span);
2037
+ if (!names) {
2038
+ lines ??= (codeOf() ?? content).split('\n');
2039
+ const spanLines = lines.slice(fn.startLine - 1, fn.endLine);
2040
+ names = spanTags((own ? spanLines.map((text, i) => (own(fn.startLine + i) ? text : '')) : spanLines).join('\n'), fn.startLine);
2041
+ tagsBySpan.set(span, names);
2042
+ }
2043
+ return names;
2044
+ };
2045
+ let topPatterns = null;
2046
+ const topBinds = new Map();
2047
+ const destructuredAtTop = (name) => {
2048
+ let binds = topBinds.get(name);
2049
+ if (binds === undefined) {
2050
+ const src = codeOf();
2051
+ topPatterns ??= src === null ? [] : topLevelPatterns(src);
2052
+ binds = src !== null && topPatterns.length > 0 && patternsBind(src, topPatterns, name);
2053
+ topBinds.set(name, binds);
2054
+ }
2055
+ return binds;
2056
+ };
1383
2057
  for (const parent of parents) {
1384
- const src = sliceLines(content, parent.startLine, parent.endLine);
1385
- if (!src || (!src.includes('</') && !src.includes('/>')))
2058
+ if (!parent.startLine || !parent.endLine)
1386
2059
  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]);
2060
+ const names = spanOf(parent);
2061
+ let around = null;
1392
2062
  let added = 0;
1393
- for (const name of names) {
2063
+ for (const [name, line] of names.tags) {
1394
2064
  if (added >= MAX_JSX_CHILDREN)
1395
2065
  break;
1396
- const child = jsxChild(ctx, name, file, importsOf);
2066
+ if (!line)
2067
+ continue;
2068
+ let child = jsxChild(ctx, name, file, importsOf, ownValueOf, exportOf);
2069
+ if (child) {
2070
+ const own = owns.get(parent.id);
2071
+ if (own) {
2072
+ if ((names.bare.has(name) && ownLinesBind(name, names.src)) || destructuredAtTop(name)) {
2073
+ child = declaredInside(ctx, name, parent, child);
2074
+ }
2075
+ }
2076
+ else {
2077
+ let binder = scopeBinds(names, parent, name, line, file, ctx) ? parent : undefined;
2078
+ if (!binder) {
2079
+ around ??= functionsAround(fns, parent);
2080
+ for (const fn of around) {
2081
+ if (scopeBinds(spanOf(fn), fn, name, line, file, ctx)) {
2082
+ binder = fn;
2083
+ break;
2084
+ }
2085
+ }
2086
+ }
2087
+ if (binder)
2088
+ child = declaredInside(ctx, name, binder, child);
2089
+ else if (destructuredAtTop(name))
2090
+ child = declaredInside(ctx, name, around?.[around.length - 1] ?? parent, child);
2091
+ }
2092
+ }
1397
2093
  if (!child || child.id === parent.id || (0, name_matcher_1.crossesCodeBoundary)(parent.language, child.language))
1398
2094
  continue;
1399
2095
  const key = `${parent.id}>${child.id}`;
@@ -1411,18 +2107,6 @@ async function reactJsxChildEdges(ctx, onYield) {
1411
2107
  }
1412
2108
  return edges;
1413
2109
  }
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
2110
  async function vueTemplateEdges(ctx, onYield) {
1427
2111
  let scannedFiles = 0;
1428
2112
  let scanned255 = 0;
@@ -1430,14 +2114,7 @@ async function vueTemplateEdges(ctx, onYield) {
1430
2114
  const seen = new Set();
1431
2115
  const COMPONENT_KINDS = new Set(['component', 'function', 'class']);
1432
2116
  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
2117
  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
2118
  const nuxtComponents = new Map();
1442
2119
  for (const c of (ctx.iterateNodesByKind?.('component') ?? ctx.getNodesByKind('component'))) {
1443
2120
  if ((++scanned255 & 63) === 0)
@@ -1458,18 +2135,15 @@ async function vueTemplateEdges(ctx, onYield) {
1458
2135
  const comp = ctx.getNodesInFile(file).find((n) => n.kind === 'component');
1459
2136
  if (!comp)
1460
2137
  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
2138
  const script = content.match(/<script[^>]*>([\s\S]*?)<\/script>/i)?.[1] ?? '';
1465
2139
  const destructured = new Map();
1466
2140
  VUE_DESTRUCTURE_RE.lastIndex = 0;
1467
2141
  let dm;
1468
2142
  while ((dm = VUE_DESTRUCTURE_RE.exec(script))) {
1469
2143
  if (!/^use[A-Z]/.test(dm[2]))
1470
- continue; // composables / hooks only
2144
+ continue;
1471
2145
  for (const part of dm[1].split(',')) {
1472
- const pm = part.trim().match(/^(\w+)\s*(?::\s*(\w+))?$/); // key | key: alias
2146
+ const pm = part.trim().match(/^(\w+)\s*(?::\s*(\w+))?$/);
1473
2147
  if (pm)
1474
2148
  destructured.set(pm[2] || pm[1], { composable: dm[2], key: pm[1] });
1475
2149
  }
@@ -1486,49 +2160,42 @@ async function vueTemplateEdges(ctx, onYield) {
1486
2160
  edges.push({ source: comp.id, target: target.id, kind: 'calls', line: comp.startLine, provenance: 'heuristic', metadata: meta });
1487
2161
  added++;
1488
2162
  };
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];
2163
+ const resolve = (name, kinds, fallback) => {
2164
+ const matches = ctx.getNodesByName(name).filter((n) => kinds.has(n.kind) && !(0, name_matcher_1.isManualMockHiddenFrom)(n.filePath, file));
2165
+ const local = matches.find((n) => n.filePath === file);
2166
+ if (local || importedFromPackage(ctx, name, file))
2167
+ return local;
2168
+ return matches[0] ?? fallback;
1494
2169
  };
1495
2170
  let m;
1496
2171
  VUE_KEBAB_RE.lastIndex = 0;
1497
2172
  while ((m = VUE_KEBAB_RE.exec(tpl))) {
1498
2173
  const tag = kebabToPascal(m[1]);
1499
- addEdge(resolve(tag, COMPONENT_KINDS) ?? nuxtComponents.get(tag), { synthesizedBy: 'jsx-render', via: m[1] });
2174
+ addEdge(resolve(tag, COMPONENT_KINDS, nuxtComponents.get(tag)), { synthesizedBy: 'jsx-render', via: m[1] });
1500
2175
  }
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
2176
  VUE_PASCAL_RE.lastIndex = 0;
1505
2177
  while ((m = VUE_PASCAL_RE.exec(tpl))) {
1506
2178
  const tag = m[1];
1507
- addEdge(resolve(tag, COMPONENT_KINDS) ?? nuxtComponents.get(tag), { synthesizedBy: 'jsx-render', via: tag });
2179
+ addEdge(resolve(tag, COMPONENT_KINDS, nuxtComponents.get(tag)), { synthesizedBy: 'jsx-render', via: tag });
1508
2180
  }
1509
2181
  VUE_HANDLER_RE.lastIndex = 0;
1510
2182
  while ((m = VUE_HANDLER_RE.exec(tpl))) {
1511
2183
  const event = m[1];
1512
2184
  const expr = m[2].trim();
1513
2185
  if (expr.includes('=>') || expr.startsWith('$'))
1514
- continue; // inline arrow / $emit
1515
- const name = expr.match(/^([A-Za-z_]\w*)/)?.[1];
2186
+ continue;
2187
+ const name = expr.match(/^([A-Za-z_$][\w$]*)\s*(?:\(|$)/)?.[1];
1516
2188
  if (!name)
1517
2189
  continue;
1518
- const direct = resolve(name, HANDLER_KINDS);
2190
+ const direct = name === expr ? resolve(name, HANDLER_KINDS) : undefined;
1519
2191
  if (direct) {
1520
2192
  addEdge(direct, { synthesizedBy: 'vue-handler', event });
1521
2193
  continue;
1522
2194
  }
1523
- // Composable-destructure handler → resolve to the composable's returned fn.
1524
2195
  const d = destructured.get(name);
1525
2196
  if (!d)
1526
2197
  continue;
1527
2198
  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
2199
  const keyFn = composable
1533
2200
  ? ctx.getNodesByName(d.key).find((n) => RETURN_KINDS.has(n.kind) && n.filePath === composable.filePath)
1534
2201
  : undefined;
@@ -1538,78 +2205,16 @@ async function vueTemplateEdges(ctx, onYield) {
1538
2205
  }
1539
2206
  return edges;
1540
2207
  }
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
2208
  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
2209
  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
2210
  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
2211
  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
2212
  const RN_OBJC_SEND_CONST_RE = /\bsendEventWithName\s*:\s*([A-Za-z_]\w*)\b/g;
1593
2213
  const RN_SWIFT_SEND_CONST_RE = /\bsendEvent\s*\(\s*withName\s*:\s*([A-Za-z_][\w.]*)/g;
1594
2214
  const RN_JVM_EMIT_CONST_RE = /\.emit\s*\(\s*([A-Za-z_][\w.]*)\s*,/g;
1595
2215
  const RN_NATIVE_SENDEVENT_CONST_RE = /\bsendEvent\s*\(\s*[A-Za-z_][\w.]*\s*,\s*([A-Za-z_][\w.]*)\s*,/g;
1596
2216
  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
2217
  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
2218
  function constantEventName(expr, file, ctx, memo) {
1614
2219
  const key = `${file}\0${expr}`;
1615
2220
  if (memo.has(key))
@@ -1650,7 +2255,7 @@ function constantEventName(expr, file, ctx, memo) {
1650
2255
  const from = importedFile(owner);
1651
2256
  decls = from
1652
2257
  ? 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))));
2258
+ : 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
2259
  }
1655
2260
  const values = new Set(decls.map(read).filter((v) => v !== null));
1656
2261
  value = values.size === 1 ? [...values][0] : null;
@@ -1661,9 +2266,6 @@ function constantEventName(expr, file, ctx, memo) {
1661
2266
  async function rnEventEdges(ctx, onYield) {
1662
2267
  let scannedFiles = 0;
1663
2268
  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
2269
  const nativeDispatchersByEvent = new Map();
1668
2270
  const jsHandlersByEvent = new Map();
1669
2271
  for (const file of ctx.getAllFiles()) {
@@ -1682,8 +2284,6 @@ async function rnEventEdges(ctx, onYield) {
1682
2284
  set.add(disp.id);
1683
2285
  nativeDispatchersByEvent.set(event, set);
1684
2286
  };
1685
- // ObjC side: `sendEventWithName:@"X"` only fires inside `.m`/`.mm`
1686
- // files (RCTEventEmitter subclasses).
1687
2287
  if (file.endsWith('.m') || file.endsWith('.mm')) {
1688
2288
  RN_OBJC_SEND_RE.lastIndex = 0;
1689
2289
  let m;
@@ -1698,7 +2298,6 @@ async function rnEventEdges(ctx, onYield) {
1698
2298
  addDispatcher(event, lineOf(m.index));
1699
2299
  }
1700
2300
  }
1701
- // Swift side: same RCTEventEmitter method, parens/named-args syntax.
1702
2301
  if (file.endsWith('.swift')) {
1703
2302
  RN_SWIFT_SEND_RE.lastIndex = 0;
1704
2303
  let m;
@@ -1718,10 +2317,6 @@ async function rnEventEdges(ctx, onYield) {
1718
2317
  addDispatcher(event, lineOf(m.index));
1719
2318
  }
1720
2319
  }
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
2320
  if (file.endsWith('.java') || file.endsWith('.kt')) {
1726
2321
  let m;
1727
2322
  RN_JVM_EMIT_RE.lastIndex = 0;
@@ -1743,25 +2338,13 @@ async function rnEventEdges(ctx, onYield) {
1743
2338
  }
1744
2339
  }
1745
2340
  }
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
2341
  if (file.endsWith('.js') ||
1751
2342
  file.endsWith('.jsx') ||
1752
2343
  file.endsWith('.ts') ||
1753
2344
  file.endsWith('.tsx') ||
1754
2345
  file.endsWith('.mjs') ||
1755
2346
  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
2347
  const ADDLISTENER_ANY = /\.(?:on|once|addListener)\(\s*['"]([^'"]+)['"]\s*,\s*([A-Za-z_][\w.]*)/g;
1764
- // The inline form: `.addListener('x', (data) => {…})` / `function () {…}`.
1765
2348
  const ADDLISTENER_INLINE = /\.(?:on|once|addListener)\(\s*['"]([^'"]+)['"]\s*,\s*(?:async\s*)?(?:\([^)]*\)\s*=>|[A-Za-z_$][\w$]*\s*=>|function\s*\()/g;
1766
2349
  ADDLISTENER_ANY.lastIndex = 0;
1767
2350
  let m;
@@ -1771,26 +2354,15 @@ async function rnEventEdges(ctx, onYield) {
1771
2354
  if (!event || !arg)
1772
2355
  continue;
1773
2356
  const bareName = arg.includes('.') ? arg.slice(arg.lastIndexOf('.') + 1) : arg;
1774
- // Try a named-symbol match first (matches the in-language semantic).
1775
2357
  const namedHandler = ctx
1776
2358
  .getNodesByName(bareName)
1777
2359
  .find((n) => n.kind === 'function' || n.kind === 'method');
1778
2360
  let targetId = namedHandler?.id ?? null;
1779
2361
  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
2362
  const enclosing = (0, synth_utils_1.enclosingFn)(nodesInFile, lineOf(m.index));
1784
2363
  targetId = enclosing?.id ?? null;
1785
2364
  }
1786
2365
  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
2366
  const line = lineOf(m.index);
1795
2367
  let smallest = null;
1796
2368
  for (const n of nodesInFile) {
@@ -1810,13 +2382,6 @@ async function rnEventEdges(ctx, onYield) {
1810
2382
  map.set(targetId, `${file}:${lineOf(m.index)}`);
1811
2383
  jsHandlersByEvent.set(event, map);
1812
2384
  }
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
2385
  ADDLISTENER_INLINE.lastIndex = 0;
1821
2386
  while ((m = ADDLISTENER_INLINE.exec(content))) {
1822
2387
  const event = m[1];
@@ -1830,8 +2395,6 @@ async function rnEventEdges(ctx, onYield) {
1830
2395
  map.set(enclosing.id, `${file}:${lineOf(m.index)}`);
1831
2396
  jsHandlersByEvent.set(event, map);
1832
2397
  }
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
2398
  RN_JS_LISTEN_CONST_RE.lastIndex = 0;
1836
2399
  while ((m = RN_JS_LISTEN_CONST_RE.exec(content))) {
1837
2400
  const event = constantEventName(m[1], file, ctx, constants);
@@ -1840,7 +2403,6 @@ async function rnEventEdges(ctx, onYield) {
1840
2403
  const arg = m[2];
1841
2404
  const bare = /^[A-Za-z_$][\w$.]*$/.test(arg) ? arg.slice(arg.lastIndexOf('.') + 1) : null;
1842
2405
  const line = lineOf(m.index);
1843
- // The handler this file names — never a same-named function elsewhere.
1844
2406
  const named = bare ? nodesInFile.find((n) => (n.kind === 'function' || n.kind === 'method') && n.name === bare) : undefined;
1845
2407
  const target = named ?? (0, synth_utils_1.enclosingFn)(nodesInFile, line);
1846
2408
  if (!target)
@@ -1858,9 +2420,6 @@ async function rnEventEdges(ctx, onYield) {
1858
2420
  const handlers = jsHandlersByEvent.get(event);
1859
2421
  if (!handlers)
1860
2422
  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
2423
  if (dispatchers.size > EVENT_FANOUT_CAP || handlers.size > EVENT_FANOUT_CAP)
1865
2424
  continue;
1866
2425
  for (const d of dispatchers) {
@@ -1883,41 +2442,7 @@ async function rnEventEdges(ctx, onYield) {
1883
2442
  }
1884
2443
  return edges;
1885
2444
  }
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
2445
  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
2446
  async function expoCrossPlatformEdges(queries, onYield) {
1922
2447
  let scanned255 = 0;
1923
2448
  const edges = [];
@@ -1928,7 +2453,7 @@ async function expoCrossPlatformEdges(queries, onYield) {
1928
2453
  await onYield();
1929
2454
  if (!m.id.startsWith('expo-module:'))
1930
2455
  continue;
1931
- const key = m.qualifiedName.split('::').pop(); // `<module>.<method>`
2456
+ const key = m.qualifiedName.split('::').pop();
1932
2457
  if (!key)
1933
2458
  continue;
1934
2459
  const arr = byKey.get(key);
@@ -1943,7 +2468,7 @@ async function expoCrossPlatformEdges(queries, onYield) {
1943
2468
  for (const a of group) {
1944
2469
  for (const b of group) {
1945
2470
  if (a.id === b.id || a.language === b.language)
1946
- continue; // cross-platform only
2471
+ continue;
1947
2472
  const key = `${a.id}>${b.id}`;
1948
2473
  if (seen.has(key))
1949
2474
  continue;
@@ -1961,28 +2486,12 @@ async function expoCrossPlatformEdges(queries, onYield) {
1961
2486
  }
1962
2487
  return edges;
1963
2488
  }
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
2489
  async function rnCrossPlatformEdges(queries, onYield) {
1978
2490
  let scanned255 = 0;
1979
2491
  const edges = [];
1980
2492
  const seen = new Set();
1981
2493
  const NATIVE = new Set(['java', 'kotlin', 'objc', 'cpp']);
1982
2494
  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
2495
  const RN_INFRA = new Set([
1987
2496
  'addListener', 'removeListeners', 'getConstants', 'constantsToExport', 'getName',
1988
2497
  'invalidate', 'initialize', 'getDefaultEventTypes', 'supportedEvents',
@@ -1992,9 +2501,6 @@ async function rnCrossPlatformEdges(queries, onYield) {
1992
2501
  const i = name.indexOf(':');
1993
2502
  return i >= 0 ? name.slice(0, i) : name;
1994
2503
  };
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
2504
  const byName = new Map();
1999
2505
  for (const m of queries.iterateNodesByKindIn('method', [...NATIVE])) {
2000
2506
  if ((++scanned255 & 63) === 0)
@@ -2011,9 +2517,8 @@ async function rnCrossPlatformEdges(queries, onYield) {
2011
2517
  continue;
2012
2518
  const langs = new Set(group.map((m) => m.language));
2013
2519
  if (langs.size < 2)
2014
- continue; // single-platform — nothing to pair
2520
+ continue;
2015
2521
  for (const m of group) {
2016
- // Is m a bridge method? (a JS-language `calls` edge points at it)
2017
2522
  const incoming = queries.getIncomingEdges(m.id, ['calls']);
2018
2523
  if (incoming.length === 0)
2019
2524
  continue;
@@ -2024,7 +2529,6 @@ async function rnCrossPlatformEdges(queries, onYield) {
2024
2529
  });
2025
2530
  if (!isBridge)
2026
2531
  continue;
2027
- // Link to the other-platform impls (both directions).
2028
2532
  for (const sib of group) {
2029
2533
  if (sib.id === m.id || sib.language === m.language)
2030
2534
  continue;
@@ -2051,9 +2555,6 @@ async function fabricNativeImplEdges(ctx, onYield) {
2051
2555
  let scanned255 = 0;
2052
2556
  const edges = [];
2053
2557
  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
2558
  const components = [];
2058
2559
  for (const n of (ctx.iterateNodesByKind?.('component') ?? ctx.getNodesByKind('component'))) {
2059
2560
  if ((++scanned255 & 63) === 0)
@@ -2063,7 +2564,6 @@ async function fabricNativeImplEdges(ctx, onYield) {
2063
2564
  }
2064
2565
  if (components.length === 0)
2065
2566
  return edges;
2066
- // Pre-index native classes by name for O(1) lookup.
2067
2567
  const nativeClassesByName = new Map();
2068
2568
  for (const n of (ctx.iterateNodesByKind?.('class') ?? ctx.getNodesByKind('class'))) {
2069
2569
  if ((++scanned255 & 63) === 0)
@@ -2082,8 +2582,6 @@ async function fabricNativeImplEdges(ctx, onYield) {
2082
2582
  const matches = nativeClassesByName.get(candidate);
2083
2583
  if (!matches || matches.length === 0)
2084
2584
  continue;
2085
- // Link the component node to every matching native class (iOS +
2086
- // Android each have one).
2087
2585
  for (const native of matches) {
2088
2586
  const key = `${component.id}>${native.id}`;
2089
2587
  if (seen.has(key))
@@ -2105,30 +2603,10 @@ async function fabricNativeImplEdges(ctx, onYield) {
2105
2603
  }
2106
2604
  return edges;
2107
2605
  }
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
2606
  async function mybatisJavaXmlEdges(queries, onYield) {
2124
2607
  let scanned255 = 0;
2125
2608
  const edges = [];
2126
2609
  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
2610
  const xmlMethods = [];
2133
2611
  for (const m of queries.iterateNodesByKindIn('method', ['xml'])) {
2134
2612
  if ((++scanned255 & 63) === 0)
@@ -2137,7 +2615,6 @@ async function mybatisJavaXmlEdges(queries, onYield) {
2137
2615
  }
2138
2616
  if (xmlMethods.length === 0)
2139
2617
  return edges;
2140
- // Index Java methods by `<ClassName>::<methodName>` for O(1) lookup.
2141
2618
  const javaIndex = new Map();
2142
2619
  for (const m of queries.iterateNodesByKindIn('method', ['java', 'kotlin'])) {
2143
2620
  if ((++scanned255 & 63) === 0)
@@ -2157,7 +2634,6 @@ async function mybatisJavaXmlEdges(queries, onYield) {
2157
2634
  for (const xml of xmlMethods) {
2158
2635
  if ((++scanned255 & 63) === 0)
2159
2636
  await onYield();
2160
- // Qualified name: `<namespace>::<id>`. Extract the simple class name.
2161
2637
  const colonIdx = xml.qualifiedName.lastIndexOf('::');
2162
2638
  if (colonIdx < 0)
2163
2639
  continue;
@@ -2170,8 +2646,6 @@ async function mybatisJavaXmlEdges(queries, onYield) {
2170
2646
  const candidates = javaIndex.get(`${className}::${id}`);
2171
2647
  if (!candidates || candidates.length === 0)
2172
2648
  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
2649
  if (candidates.length > 1)
2176
2650
  continue;
2177
2651
  const java = candidates[0];
@@ -2194,34 +2668,8 @@ async function mybatisJavaXmlEdges(queries, onYield) {
2194
2668
  }
2195
2669
  return edges;
2196
2670
  }
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)
2671
+ const GIN_DISPATCH_RE = /\.handlers\s*\[[^\]]*\]\s*\(/;
2223
2672
  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
2673
  function goBalancedArgs(s, openIdx) {
2226
2674
  let depth = 0;
2227
2675
  for (let i = openIdx; i < s.length; i++) {
@@ -2236,7 +2684,6 @@ function goBalancedArgs(s, openIdx) {
2236
2684
  }
2237
2685
  return null;
2238
2686
  }
2239
- /** Split a top-level comma list, respecting nested () [] {}. */
2240
2687
  function goSplitArgs(args) {
2241
2688
  const out = [];
2242
2689
  let depth = 0, cur = '';
@@ -2260,9 +2707,8 @@ function goSplitArgs(args) {
2260
2707
  out.push(cur);
2261
2708
  return out;
2262
2709
  }
2263
- /** Tail ident of a handler arg: `gin.Logger()`→`Logger`, `mw`→`mw`; null for string paths / closures. */
2264
2710
  function goHandlerIdent(expr) {
2265
- const cleaned = expr.trim().replace(/\(\s*\)$/, ''); // drop a trailing call ()
2711
+ const cleaned = expr.trim().replace(/\(\s*\)$/, '');
2266
2712
  if (!cleaned || cleaned.startsWith('"') || cleaned.startsWith('`') || cleaned.startsWith('func'))
2267
2713
  return null;
2268
2714
  const m = cleaned.match(/(?:\.|^)([A-Za-z_]\w*)$/);
@@ -2271,7 +2717,6 @@ function goHandlerIdent(expr) {
2271
2717
  async function ginMiddlewareChainEdges(queries, ctx, onYield) {
2272
2718
  let scanned255 = 0;
2273
2719
  let scannedFiles = 0;
2274
- // 1. Find the chain dispatcher(s): a Go method that invokes a `handlers` slice by index.
2275
2720
  const dispatchers = [];
2276
2721
  for (const n of queries.iterateNodesByKindIn('method', ['go'])) {
2277
2722
  if ((++scanned255 & 63) === 0)
@@ -2282,11 +2727,8 @@ async function ginMiddlewareChainEdges(queries, ctx, onYield) {
2282
2727
  dispatchers.push(n);
2283
2728
  }
2284
2729
  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)
2730
+ return [];
2731
+ const registered = new Map();
2290
2732
  for (const file of ctx.getAllFiles()) {
2291
2733
  if ((++scannedFiles & 15) === 0)
2292
2734
  await onYield();
@@ -2303,7 +2745,7 @@ async function ginMiddlewareChainEdges(queries, ctx, onYield) {
2303
2745
  const argStr = goBalancedArgs(safe, parenIdx);
2304
2746
  if (!argStr)
2305
2747
  continue;
2306
- const line = safe.slice(0, m.index).split('\n').length;
2748
+ const line = lineOf(safe, m.index);
2307
2749
  for (const arg of goSplitArgs(argStr)) {
2308
2750
  const name = goHandlerIdent(arg);
2309
2751
  if (name && !registered.has(name))
@@ -2313,7 +2755,6 @@ async function ginMiddlewareChainEdges(queries, ctx, onYield) {
2313
2755
  }
2314
2756
  if (registered.size === 0)
2315
2757
  return [];
2316
- // 3. Link each dispatcher → each registered handler node (dedup, capped).
2317
2758
  const edges = [];
2318
2759
  const seen = new Set();
2319
2760
  for (const disp of dispatchers) {
@@ -2338,13 +2779,6 @@ async function ginMiddlewareChainEdges(queries, ctx, onYield) {
2338
2779
  }
2339
2780
  return edges;
2340
2781
  }
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
2782
  async function pascalFormEdges(ctx, onYield) {
2349
2783
  let scannedFiles = 0;
2350
2784
  const edges = [];
@@ -2372,21 +2806,6 @@ async function pascalFormEdges(ctx, onYield) {
2372
2806
  }
2373
2807
  return edges;
2374
2808
  }
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
2809
  async function svelteKitLoadEdges(ctx, onYield) {
2391
2810
  let scannedFiles = 0;
2392
2811
  const edges = [];
@@ -2409,10 +2828,6 @@ async function svelteKitLoadEdges(ctx, onYield) {
2409
2828
  if (!allFiles.has(loaderFile))
2410
2829
  continue;
2411
2830
  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
2831
  const named = HOOK_KINDS.has(hook.kind) && HOOKS.has(hook.name);
2417
2832
  if (!named && hook.kind !== 'function' && hook.kind !== 'method')
2418
2833
  continue;
@@ -2433,19 +2848,6 @@ async function svelteKitLoadEdges(ctx, onYield) {
2433
2848
  }
2434
2849
  return edges;
2435
2850
  }
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
2851
  const THUNK_DECL_RE = /create(?:Async)?Thunk/;
2450
2852
  const THUNK_DISPATCH_RE = /\bdispatch\s*\(\s*([A-Za-z_]\w*)\s*[(),]/g;
2451
2853
  const THUNK_FANOUT_CAP = 24;
@@ -2456,15 +2858,12 @@ async function reduxThunkEdges(queries, ctx, onYield) {
2456
2858
  for (const node of queries.iterateNodesByKind('constant')) {
2457
2859
  if ((++scanned255 & 63) === 0)
2458
2860
  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
2861
  if (!node.signature || !THUNK_DECL_RE.test(node.signature))
2462
2862
  continue;
2463
2863
  const content = ctx.readFile(node.filePath);
2464
2864
  const src = content && sliceLines(content, node.startLine, node.endLine);
2465
2865
  if (!src)
2466
2866
  continue;
2467
- // Thunks are TS/JS-family (same // and /* */ comment syntax); map to a CommentLang.
2468
2867
  const safe = (0, strip_comments_1.stripCommentsForRegex)(src, node.language === 'javascript' || node.language === 'jsx' ? 'javascript' : 'typescript');
2469
2868
  THUNK_DISPATCH_RE.lastIndex = 0;
2470
2869
  let m;
@@ -2472,13 +2871,7 @@ async function reduxThunkEdges(queries, ctx, onYield) {
2472
2871
  while ((m = THUNK_DISPATCH_RE.exec(safe)) && added < THUNK_FANOUT_CAP) {
2473
2872
  const name = m[1];
2474
2873
  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.
2874
+ continue;
2482
2875
  const cands = ctx
2483
2876
  .getNodesByName(name)
2484
2877
  .filter((n) => n.kind === 'constant' || n.kind === 'function' || n.kind === 'method');
@@ -2492,7 +2885,7 @@ async function reduxThunkEdges(queries, ctx, onYield) {
2492
2885
  if (seen.has(key))
2493
2886
  continue;
2494
2887
  seen.add(key);
2495
- const line = node.startLine + safe.slice(0, m.index).split('\n').length - 1;
2888
+ const line = node.startLine + lineOf(safe, m.index) - 1;
2496
2889
  edges.push({
2497
2890
  source: node.id,
2498
2891
  target: target.id,
@@ -2506,36 +2899,16 @@ async function reduxThunkEdges(queries, ctx, onYield) {
2506
2899
  }
2507
2900
  return edges;
2508
2901
  }
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
2902
  const REGISTRY_NAME_START = String.raw `(?:(?<![A-Za-z_$])(?<![A-Za-z_$][\w$]+)|(?=this\.))`;
2527
2903
  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
2904
  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
2905
  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
2906
  const REGISTRY_DISPATCH_RE = new RegExp(String.raw `(?:(?<!\w)|${REGISTRY_NAME_START})${REGISTRY_DISPATCH_SRC}`, 'g');
2532
2907
  const IDENT_RUN_CHAR = /[\w$]/;
2533
2908
  const REGISTRY_MIN_ENTRIES = 2;
2534
2909
  const REGISTRY_FANOUT_CAP = 40;
2535
2910
  const REGISTRY_CLASS_ENTRY = new Set(['execute', 'run', 'handle', 'perform', 'process', 'call', 'apply', 'dispatch']);
2536
2911
  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
2912
  function nextRegistryDispatch(src, from) {
2540
2913
  let at = from;
2541
2914
  if (at > 0 && at < src.length && IDENT_RUN_CHAR.test(src[at - 1]) && IDENT_RUN_CHAR.test(src[at])) {
@@ -2549,7 +2922,6 @@ function nextRegistryDispatch(src, from) {
2549
2922
  REGISTRY_DISPATCH_RE.lastIndex = at;
2550
2923
  return REGISTRY_DISPATCH_RE.exec(src);
2551
2924
  }
2552
- /** From the index of an opening `{`, return the brace-balanced body up to its matching `}`. */
2553
2925
  function braceBody(src, openIdx) {
2554
2926
  let depth = 0;
2555
2927
  for (let i = openIdx; i < src.length; i++) {
@@ -2560,11 +2932,6 @@ function braceBody(src, openIdx) {
2560
2932
  }
2561
2933
  return null;
2562
2934
  }
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
2935
  function registryEntryNames(body) {
2569
2936
  const segs = [];
2570
2937
  let depth = 0;
@@ -2589,8 +2956,6 @@ function registryEntryNames(body) {
2589
2956
  }
2590
2957
  return names;
2591
2958
  }
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
2959
  function resolveRegistryHandler(ctx, name, chained) {
2595
2960
  const cands = ctx.getNodesByName(name);
2596
2961
  const fn = cands.find((n) => n.kind === 'function');
@@ -2607,9 +2972,6 @@ function resolveRegistryHandler(ctx, name, chained) {
2607
2972
  methods.find((m) => m.name === 'constructor');
2608
2973
  return entry ?? cls;
2609
2974
  }
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
2975
  return cands.find((n) => n.kind === 'method') ?? null;
2614
2976
  }
2615
2977
  async function objectRegistryEdges(ctx, onYield) {
@@ -2621,22 +2983,16 @@ async function objectRegistryEdges(ctx, onYield) {
2621
2983
  if ((++scannedFiles & 15) === 0)
2622
2984
  await onYield();
2623
2985
  if ((++scanned & 255) === 0)
2624
- await onYield(); // #1091: yield mid-scan on huge graphs
2986
+ await onYield();
2625
2987
  if (!REGISTRY_JS_EXT.test(file))
2626
2988
  continue;
2627
2989
  const content = ctx.readFile(file);
2628
- // Cheap pre-filter: a computed member access BY NAME (`ident[ident`) — the dispatch shape.
2629
2990
  if (!content || !/[\w$]\s*\[\s*[A-Za-z_$]/.test(content))
2630
2991
  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
2992
  const newlines = (content.match(/\n/g)?.length ?? 0) + 1;
2635
2993
  if (content.length / newlines > 200)
2636
2994
  continue;
2637
2995
  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
2996
  const lineOf = (0, synth_utils_1.makeLineAt)(safe, 1);
2641
2997
  const dispatches = [];
2642
2998
  for (let dm = nextRegistryDispatch(safe, 0); dm; dm = nextRegistryDispatch(safe, dm.index + dm[0].length)) {
@@ -2646,11 +3002,8 @@ async function objectRegistryEdges(ctx, onYield) {
2646
3002
  }
2647
3003
  if (!dispatches.length)
2648
3004
  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
3005
  const norm = (r) => r.replace(/^this\./, '');
2652
3006
  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
3007
  REGISTRY_ASSIGN_RE.lastIndex = 0;
2655
3008
  const registries = new Map();
2656
3009
  let am;
@@ -2661,14 +3014,13 @@ async function objectRegistryEdges(ctx, onYield) {
2661
3014
  const body = braceBody(safe, am.index + am[0].length - 1);
2662
3015
  if (!body)
2663
3016
  continue;
2664
- const names = registryEntryNames(body); // depth-0 `key: Identifier` entries only
3017
+ const names = registryEntryNames(body);
2665
3018
  if (names.length >= REGISTRY_MIN_ENTRIES) {
2666
3019
  registries.set(lhs, { names, line: lineOf(am.index) });
2667
3020
  }
2668
3021
  }
2669
3022
  if (!registries.size)
2670
3023
  continue;
2671
- // 3. Link each dispatcher → each registered handler's callable entry.
2672
3024
  const nodesInFile = ctx.getNodesInFile(file);
2673
3025
  for (const d of dispatches) {
2674
3026
  const reg = registries.get(norm(d.ref));
@@ -2702,30 +3054,15 @@ async function objectRegistryEdges(ctx, onYield) {
2702
3054
  }
2703
3055
  return edges;
2704
3056
  }
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
3057
  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
3058
  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
3059
  function rtkEndpointNameFromHook(hook) {
2723
3060
  const m = RTK_HOOK_DERIVE_RE.exec(hook);
2724
3061
  if (!m)
2725
3062
  return null;
2726
3063
  let mid = m[1];
2727
3064
  if (mid.startsWith('Lazy'))
2728
- mid = mid.slice(4); // useLazyGetX → getX (same endpoint)
3065
+ mid = mid.slice(4);
2729
3066
  if (!mid)
2730
3067
  return null;
2731
3068
  return mid.charAt(0).toLowerCase() + mid.slice(1);
@@ -2737,14 +3074,11 @@ async function rtkQueryEdges(queries, ctx, onYield) {
2737
3074
  for (const hook of queries.iterateNodesByKind('function')) {
2738
3075
  if ((++scanned255 & 63) === 0)
2739
3076
  await onYield();
2740
- // Only our extracted generated-hook bindings (sentinel) — not a real hook fn.
2741
3077
  if (hook.signature !== RTK_GENERATED_HOOK_SIGNATURE)
2742
3078
  continue;
2743
3079
  const endpointName = rtkEndpointNameFromHook(hook.name);
2744
3080
  if (!endpointName)
2745
3081
  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
3082
  const target = ctx
2749
3083
  .getNodesByName(endpointName)
2750
3084
  .find((n) => n.kind === 'function' && n.filePath === hook.filePath);
@@ -2765,16 +3099,6 @@ async function rtkQueryEdges(queries, ctx, onYield) {
2765
3099
  }
2766
3100
  return edges;
2767
3101
  }
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
3102
  const PINIA_CONSUMER_EXT = /\.(?:ts|tsx|js|jsx|mjs|cjs|vue)$/;
2779
3103
  const PINIA_FACTORY_RE = /\b(?:export\s+)?const\s+(\w+)\s*=\s*defineStore\s*\(/g;
2780
3104
  const PINIA_BIND_RE = /\bconst\s+(\w+)\s*=\s*(?:await\s+)?(\w+)\s*\(/g;
@@ -2782,7 +3106,6 @@ const PINIA_CALL_RE = /(\w+)\s*\.\s*(\w+)\s*\(/g;
2782
3106
  const PINIA_FANOUT_CAP = 80;
2783
3107
  async function piniaStoreEdges(ctx, onYield) {
2784
3108
  let scannedFiles = 0;
2785
- // 1. Map each `const useXStore = defineStore(...)` factory → its store file.
2786
3109
  const factoryFile = new Map();
2787
3110
  for (const file of ctx.getAllFiles()) {
2788
3111
  if ((++scannedFiles & 15) === 0)
@@ -2810,7 +3133,6 @@ async function piniaStoreEdges(ctx, onYield) {
2810
3133
  if (!content || !content.includes('Store'))
2811
3134
  continue;
2812
3135
  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
3136
  const varStore = new Map();
2815
3137
  PINIA_BIND_RE.lastIndex = 0;
2816
3138
  let bm;
@@ -2821,9 +3143,8 @@ async function piniaStoreEdges(ctx, onYield) {
2821
3143
  }
2822
3144
  if (!varStore.size)
2823
3145
  continue;
2824
- // 3. Link `<var>.<method>(` → the action function node in the store's file.
2825
3146
  const nodesInFile = ctx.getNodesInFile(file);
2826
- const fallbackDispatcher = nodesInFile.find((n) => n.kind === 'component'); // .vue top-level setup
3147
+ const fallbackDispatcher = nodesInFile.find((n) => n.kind === 'component');
2827
3148
  PINIA_CALL_RE.lastIndex = 0;
2828
3149
  let cm;
2829
3150
  let added = 0;
@@ -2832,7 +3153,7 @@ async function piniaStoreEdges(ctx, onYield) {
2832
3153
  if (!storeFile)
2833
3154
  continue;
2834
3155
  const method = cm[2];
2835
- const line = safe.slice(0, cm.index).split('\n').length;
3156
+ const line = lineOf(safe, cm.index);
2836
3157
  const disp = (0, synth_utils_1.enclosingFn)(nodesInFile, line) ?? fallbackDispatcher;
2837
3158
  if (!disp)
2838
3159
  continue;
@@ -2858,21 +3179,9 @@ async function piniaStoreEdges(ctx, onYield) {
2858
3179
  }
2859
3180
  return edges;
2860
3181
  }
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
3182
  const VUEX_DISPATCH_RE = /\b(?:dispatch|commit)\s*\(\s*['"]([A-Za-z][\w/]*)['"]/g;
2872
3183
  const VUEX_STORE_SIGNAL = /\bdefineStore\b|\bcreateStore\b|\bVuex\b|\bmutations\b|\bactions\b|\bgetters\b|\bnamespaced\b/g;
2873
3184
  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`. */
2876
3185
  function pathHasSegment(filePath, seg) {
2877
3186
  return new RegExp('[\\\\/]' + seg.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '[\\\\/.]').test(filePath);
2878
3187
  }
@@ -2905,11 +3214,9 @@ async function vuexDispatchEdges(ctx, onYield) {
2905
3214
  if (!cands.length)
2906
3215
  return null;
2907
3216
  if (segs.length > 1) {
2908
- const mod = segs[segs.length - 2]; // immediate namespace ≈ the module file
3217
+ const mod = segs[segs.length - 2];
2909
3218
  return cands.find((c) => pathHasSegment(c.filePath, mod)) ?? (cands.length === 1 ? cands[0] : null);
2910
3219
  }
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
3220
  return cands.find((c) => c.filePath === dispatchFile) ?? (cands.length === 1 ? cands[0] : null);
2914
3221
  };
2915
3222
  const edges = [];
@@ -2924,13 +3231,13 @@ async function vuexDispatchEdges(ctx, onYield) {
2924
3231
  continue;
2925
3232
  const safe = (0, strip_comments_1.stripCommentsForRegex)(content, /\.(?:jsx?|mjs|cjs)$/.test(file) ? 'javascript' : 'typescript');
2926
3233
  const nodesInFile = ctx.getNodesInFile(file);
2927
- const fallback = nodesInFile.find((n) => n.kind === 'component'); // .vue top-level
3234
+ const fallback = nodesInFile.find((n) => n.kind === 'component');
2928
3235
  VUEX_DISPATCH_RE.lastIndex = 0;
2929
3236
  let m;
2930
3237
  let added = 0;
2931
3238
  while ((m = VUEX_DISPATCH_RE.exec(safe)) && added < VUEX_FANOUT_CAP) {
2932
3239
  const key = m[1];
2933
- const line = safe.slice(0, m.index).split('\n').length;
3240
+ const line = lineOf(safe, m.index);
2934
3241
  const disp = (0, synth_utils_1.enclosingFn)(nodesInFile, line) ?? fallback;
2935
3242
  if (!disp)
2936
3243
  continue;
@@ -2954,33 +3261,13 @@ async function vuexDispatchEdges(ctx, onYield) {
2954
3261
  }
2955
3262
  return edges;
2956
3263
  }
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
3264
  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
3265
  const CELERY_TASK_DECORATOR_RE = /@\s*(?:[A-Za-z_][\w.]*\.)?(?:shared_task|task)\b/;
2976
3266
  const CELERY_PY_EXT = /\.py$/;
2977
3267
  const CELERY_FANOUT_CAP = 80;
2978
- const CELERY_DECORATOR_LOOKBACK = 12; // max lines above a `def` to scan for its decorators
3268
+ const CELERY_DECORATOR_LOOKBACK = 12;
2979
3269
  async function celeryDispatchEdges(ctx, onYield) {
2980
3270
  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
3271
  const taskCache = new Map();
2985
3272
  const isCeleryTask = (node) => {
2986
3273
  let v = taskCache.get(node.id);
@@ -2991,13 +3278,11 @@ async function celeryDispatchEdges(ctx, onYield) {
2991
3278
  const content = ctx.readFile(node.filePath);
2992
3279
  if (content) {
2993
3280
  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
3281
  const stop = Math.max(0, node.startLine - 1 - CELERY_DECORATOR_LOOKBACK);
2997
3282
  for (let i = node.startLine - 2; i >= stop; i--) {
2998
3283
  const t = (lines[i] ?? '').trim();
2999
3284
  if (/^(?:async\s+def|def|class)\b/.test(t))
3000
- break; // previous decl → stop
3285
+ break;
3001
3286
  if (CELERY_TASK_DECORATOR_RE.test(t)) {
3002
3287
  v = true;
3003
3288
  break;
@@ -3014,8 +3299,6 @@ async function celeryDispatchEdges(ctx, onYield) {
3014
3299
  return null;
3015
3300
  if (cands.length === 1)
3016
3301
  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
3302
  return cands.find((c) => c.filePath === dispatchFile) ?? null;
3020
3303
  };
3021
3304
  const edges = [];
@@ -3035,10 +3318,10 @@ async function celeryDispatchEdges(ctx, onYield) {
3035
3318
  let added = 0;
3036
3319
  while ((m = CELERY_DISPATCH_RE.exec(safe)) && added < CELERY_FANOUT_CAP) {
3037
3320
  const name = m[1];
3038
- const line = safe.slice(0, m.index).split('\n').length;
3321
+ const line = lineOf(safe, m.index);
3039
3322
  const disp = (0, synth_utils_1.enclosingFn)(nodesInFile, line);
3040
3323
  if (!disp)
3041
- continue; // module-level dispatch — no source symbol to attribute
3324
+ continue;
3042
3325
  const target = resolve(name, file);
3043
3326
  if (!target || target.id === disp.id)
3044
3327
  continue;
@@ -3059,31 +3342,12 @@ async function celeryDispatchEdges(ctx, onYield) {
3059
3342
  }
3060
3343
  return edges;
3061
3344
  }
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
3345
  const SPRING_PUBLISH_RE = /\.publishEvent\s*\(\s*new\s+([A-Z][A-Za-z0-9_]*)/g;
3079
3346
  const SPRING_LISTENER_ANNO_RE = /@(?:EventListener|TransactionalEventListener)\b/;
3080
3347
  const SPRING_ANNO_TYPE_RE = /@(?:EventListener|TransactionalEventListener)\s*\(\s*([A-Z][A-Za-z0-9_]*)\.class/;
3081
3348
  const SPRING_APP_LISTENER_RE = /\bApplicationListener\s*</;
3082
3349
  const SPRING_JAVA_EXT = /\.java$/;
3083
3350
  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
3351
  function springFirstParamType(sig) {
3088
3352
  if (!sig)
3089
3353
  return null;
@@ -3097,16 +3361,12 @@ function springFirstParamType(sig) {
3097
3361
  const first = inner.split(',')[0].trim();
3098
3362
  const toks = first.split(/\s+/).filter((t) => t && t !== 'final' && !t.startsWith('@'));
3099
3363
  if (toks.length < 2)
3100
- return null; // need `Type name`
3101
- const type = toks[toks.length - 2].replace(/<.*$/, ''); // drop generic args
3364
+ return null;
3365
+ const type = toks[toks.length - 2].replace(/<.*$/, '');
3102
3366
  return /^[A-Z][A-Za-z0-9_]*$/.test(type) ? type : null;
3103
3367
  }
3104
3368
  async function springEventEdges(ctx, onYield) {
3105
3369
  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
3370
  const listeners = new Map();
3111
3371
  const publisherFiles = [];
3112
3372
  for (const file of ctx.getAllFiles()) {
@@ -3127,12 +3387,11 @@ async function springEventEdges(ctx, onYield) {
3127
3387
  for (const node of ctx.getNodesInFile(file)) {
3128
3388
  if (node.kind !== 'method')
3129
3389
  continue;
3130
- // Collect this method's own leading annotation block (consecutive `@`-lines from startLine).
3131
3390
  const annoLines = [];
3132
3391
  for (let i = node.startLine - 1; i < lines.length && i < node.startLine + 7; i++) {
3133
3392
  const t = (lines[i] ?? '').trim();
3134
3393
  if (!t.startsWith('@'))
3135
- break; // reached the declaration → stop (no bleed into next method)
3394
+ break;
3136
3395
  annoLines.push(t);
3137
3396
  }
3138
3397
  const head = annoLines.join('\n');
@@ -3158,8 +3417,6 @@ async function springEventEdges(ctx, onYield) {
3158
3417
  }
3159
3418
  if (!listeners.size)
3160
3419
  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
3420
  const edges = [];
3164
3421
  const seen = new Set();
3165
3422
  for (const file of publisherFiles) {
@@ -3177,7 +3434,7 @@ async function springEventEdges(ctx, onYield) {
3177
3434
  const targets = listeners.get(m[1]);
3178
3435
  if (!targets || !targets.length)
3179
3436
  continue;
3180
- const line = safe.slice(0, m.index).split('\n').length;
3437
+ const line = lineOf(safe, m.index);
3181
3438
  const disp = (0, synth_utils_1.enclosingFn)(nodesInFile, line);
3182
3439
  if (!disp)
3183
3440
  continue;
@@ -3202,31 +3459,50 @@ async function springEventEdges(ctx, onYield) {
3202
3459
  }
3203
3460
  return edges;
3204
3461
  }
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
3462
  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;
3463
+ 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
3464
  const MEDIATR_RECEIVER_RE = /(?:mediator|sender|publisher)/i;
3224
3465
  const MEDIATR_CS_EXT = /\.cs$/;
3225
3466
  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. */
3467
+ const MEDIATR_HANDLER_DECL_LOOKAHEAD = 4;
3468
+ const MEDIATR_CLASS_HEAD_LINES = 16;
3469
+ const MEDIATR_HANDLE_FIRST_PARAM_RE = /\bHandle\s*\(\s*(?:\[[^\]]*\]\s*)?(?:[A-Za-z_]\w*\.)*([A-Za-z_]\w*)/;
3470
+ function sharedFolders(a, b) {
3471
+ const left = a.split('/');
3472
+ const right = b.split('/');
3473
+ let n = 0;
3474
+ while (n < left.length - 1 && n < right.length - 1 && left[n] === right[n])
3475
+ n++;
3476
+ return n;
3477
+ }
3478
+ function reachableHandlers(targets, file, verb) {
3479
+ if (targets.length < 2)
3480
+ return targets;
3481
+ const shared = targets.map((t) => sharedFolders(file, t.filePath));
3482
+ const best = Math.max(...shared);
3483
+ if (verb === 'Send')
3484
+ return targets.filter((_, i) => shared[i] === best);
3485
+ return best > 0 ? targets.filter((_, i) => shared[i] > 0) : targets;
3486
+ }
3487
+ function mediatrBaseListTypes(lines, classStart) {
3488
+ const head = lines.slice(classStart - 1, classStart - 1 + MEDIATR_CLASS_HEAD_LINES).join('\n');
3489
+ const open = head.indexOf('{');
3490
+ const text = (open >= 0 ? head.slice(0, open) : head).replace(/\([^()]*(?:\([^()]*\)[^()]*)*\)/g, ' ');
3491
+ const colon = text.indexOf(':');
3492
+ const types = new Set();
3493
+ if (colon < 0)
3494
+ return types;
3495
+ const own = /<([^<>]*)>/.exec(text.slice(0, colon))?.[1]?.split(',').map((t) => t.trim()) ?? [];
3496
+ for (const m of text.slice(colon + 1).matchAll(/[<,]\s*(?:[A-Za-z_]\w*\.)*([A-Za-z_]\w*)/g)) {
3497
+ if (!own.includes(m[1]))
3498
+ types.add(m[1]);
3499
+ }
3500
+ return types;
3501
+ }
3502
+ function mediatrHandledType(lines, handle) {
3503
+ const head = lines.slice(handle.startLine - 1, handle.startLine + 2).join(' ');
3504
+ return MEDIATR_HANDLE_FIRST_PARAM_RE.exec(head)?.[1] ?? null;
3505
+ }
3230
3506
  function resolveMediatrArgType(arg, lines, methodStart, dispatchLine) {
3231
3507
  const inl = /^new\s+([A-Z]\w*)/.exec(arg);
3232
3508
  if (inl)
@@ -3234,24 +3510,55 @@ function resolveMediatrArgType(arg, lines, methodStart, dispatchLine) {
3234
3510
  if (!/^[A-Za-z_]\w*$/.test(arg))
3235
3511
  return null;
3236
3512
  const assignRe = new RegExp(`\\b${arg}\\b\\s*=\\s*new\\s+([A-Z]\\w*)`);
3513
+ const mappedRe = new RegExp(`\\b${arg}\\b\\s*=[^;]*?\\.\\s*\\w+<(?:[^<>;]*,\\s*)?(?:\\w+\\.)*([A-Z]\\w*)>\\s*\\(`);
3237
3514
  const declRe = new RegExp(`\\b([A-Z]\\w*)\\b\\s+${arg}\\b`);
3238
3515
  let declType = null;
3239
3516
  for (let i = Math.max(0, methodStart - 1); i < dispatchLine && i < lines.length; i++) {
3240
3517
  const ln = lines[i] ?? '';
3241
3518
  const a = assignRe.exec(ln);
3242
3519
  if (a)
3243
- return a[1]; // an explicit `arg = new X` is the most specific — take it
3520
+ return a[1];
3521
+ const mapped = mappedRe.exec(ln);
3522
+ if (mapped)
3523
+ return mapped[1];
3244
3524
  if (!declType) {
3245
3525
  const d = declRe.exec(ln);
3246
3526
  if (d)
3247
- declType = d[1]; // a `X arg` declaration — remember, but keep scanning for an assignment
3527
+ declType = d[1];
3248
3528
  }
3249
3529
  }
3250
3530
  return declType;
3251
3531
  }
3252
3532
  async function mediatrDispatchEdges(ctx, onYield) {
3253
3533
  let scannedFiles = 0;
3254
- // Pass 1 — request/notification type → the Handle method of each handler class.
3534
+ const sites = [];
3535
+ for (const file of ctx.getAllFiles()) {
3536
+ if ((++scannedFiles & 15) === 0)
3537
+ await onYield();
3538
+ if (!MEDIATR_CS_EXT.test(file))
3539
+ continue;
3540
+ const content = ctx.readFile(file);
3541
+ if (!content || (!content.includes('.Send(') && !content.includes('.Publish(')))
3542
+ continue;
3543
+ const safe = (0, strip_comments_1.stripCommentsForRegex)(content, 'csharp');
3544
+ const safeLines = safe.split('\n');
3545
+ const nodesInFile = ctx.getNodesInFile(file);
3546
+ MEDIATR_DISPATCH_RE.lastIndex = 0;
3547
+ let m;
3548
+ while ((m = MEDIATR_DISPATCH_RE.exec(safe))) {
3549
+ if (!MEDIATR_RECEIVER_RE.test(m[1]))
3550
+ continue;
3551
+ const line = lineOf(safe, m.index);
3552
+ const from = (0, synth_utils_1.enclosingFn)(nodesInFile, line);
3553
+ if (!from)
3554
+ continue;
3555
+ const type = resolveMediatrArgType(m[3], safeLines, from.startLine, line);
3556
+ if (type)
3557
+ sites.push({ file, line, verb: m[2], type, from });
3558
+ }
3559
+ }
3560
+ if (!sites.length)
3561
+ return [];
3255
3562
  const handlers = new Map();
3256
3563
  for (const file of ctx.getAllFiles()) {
3257
3564
  if ((++scannedFiles & 15) === 0)
@@ -3259,105 +3566,79 @@ async function mediatrDispatchEdges(ctx, onYield) {
3259
3566
  if (!MEDIATR_CS_EXT.test(file))
3260
3567
  continue;
3261
3568
  const content = ctx.readFile(file);
3262
- if (!content || (!content.includes('IRequestHandler<') && !content.includes('INotificationHandler<')))
3569
+ if (!content || !content.includes('Handle('))
3263
3570
  continue;
3264
3571
  const lines = content.split('\n');
3265
3572
  const nodesInFile = ctx.getNodesInFile(file);
3573
+ const handleMethods = nodesInFile.filter((n) => n.kind === 'method' && n.name === 'Handle');
3574
+ if (handleMethods.length === 0)
3575
+ continue;
3576
+ const addHandler = (type, handle) => {
3577
+ const known = handlers.get(type);
3578
+ if (!known)
3579
+ handlers.set(type, [handle]);
3580
+ else if (!known.includes(handle))
3581
+ known.push(handle);
3582
+ };
3266
3583
  for (const cls of nodesInFile) {
3267
3584
  if (cls.kind !== 'class')
3268
3585
  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
3586
  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)
3587
+ const handles = handleMethods.filter((n) => n.startLine >= cls.startLine && n.startLine <= end);
3588
+ if (handles.length === 0)
3277
3589
  continue;
3278
- let arr = handlers.get(type);
3279
- if (!arr) {
3280
- arr = [];
3281
- handlers.set(type, arr);
3590
+ const lookahead = lines.slice(cls.startLine - 1, cls.startLine - 1 + MEDIATR_HANDLER_DECL_LOOKAHEAD).join('\n');
3591
+ const decl = lookahead.split('{', 1)[0];
3592
+ const m = MEDIATR_HANDLER_BASE_RE.exec(decl);
3593
+ if (m)
3594
+ addHandler(m[1], handles[0]);
3595
+ const baseTypes = mediatrBaseListTypes(lines, cls.startLine);
3596
+ for (const handle of handles) {
3597
+ const type = mediatrHandledType(lines, handle);
3598
+ if (type && baseTypes.has(type))
3599
+ addHandler(type, handle);
3282
3600
  }
3283
- arr.push(handle);
3284
3601
  }
3285
3602
  }
3286
3603
  if (!handlers.size)
3287
3604
  return [];
3288
- // Pass 2 — link each mediator-ish .Send(x)/.Publish(x) → the handler of x's type.
3289
3605
  const edges = [];
3290
3606
  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))
3607
+ const addedPerFile = new Map();
3608
+ for (const { file, line, verb, type, from } of sites) {
3609
+ const targets = handlers.get(type);
3610
+ if (!targets)
3295
3611
  continue;
3296
- const content = ctx.readFile(file);
3297
- if (!content || (!content.includes('.Send(') && !content.includes('.Publish(')))
3612
+ let added = addedPerFile.get(file) ?? 0;
3613
+ if (added >= MEDIATR_FANOUT_CAP)
3298
3614
  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)
3311
- continue;
3312
- const type = resolveMediatrArgType(m[2], safeLines, disp.startLine, line);
3313
- if (!type)
3615
+ for (const target of reachableHandlers(targets, file, verb)) {
3616
+ if (target.id === from.id)
3314
3617
  continue;
3315
- const targets = handlers.get(type);
3316
- if (!targets)
3618
+ const key = `${from.id}>${target.id}`;
3619
+ if (seen.has(key))
3317
3620
  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
- }
3621
+ seen.add(key);
3622
+ edges.push({
3623
+ source: from.id,
3624
+ target: target.id,
3625
+ kind: 'calls',
3626
+ line,
3627
+ provenance: 'heuristic',
3628
+ metadata: { synthesizedBy: 'mediatr-dispatch', via: type, registeredAt: `${file}:${line}` },
3629
+ });
3630
+ added++;
3335
3631
  }
3632
+ addedPerFile.set(file, added);
3336
3633
  }
3337
3634
  return edges;
3338
3635
  }
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
3636
  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
3637
  const SIDEKIQ_WORKER_RE = /\binclude\s+Sidekiq::(?:Job|Worker)\b/;
3355
3638
  const SIDEKIQ_RB_EXT = /\.rb$/;
3356
3639
  const SIDEKIQ_FANOUT_CAP = 80;
3357
3640
  async function sidekiqDispatchEdges(ctx, onYield) {
3358
3641
  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
3642
  const performCache = new Map();
3362
3643
  const performOf = (cls) => {
3363
3644
  let v = performCache.get(cls.id);
@@ -3375,11 +3656,6 @@ async function sidekiqDispatchEdges(ctx, onYield) {
3375
3656
  performCache.set(cls.id, v);
3376
3657
  return v;
3377
3658
  };
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
3659
  const resolve = (ref) => {
3384
3660
  if (ref.includes('::')) {
3385
3661
  const q = ctx.getNodesByQualifiedName(ref).find((n) => n.kind === 'class' && performOf(n));
@@ -3405,7 +3681,7 @@ async function sidekiqDispatchEdges(ctx, onYield) {
3405
3681
  let m;
3406
3682
  let added = 0;
3407
3683
  while ((m = SIDEKIQ_DISPATCH_RE.exec(safe)) && added < SIDEKIQ_FANOUT_CAP) {
3408
- const line = safe.slice(0, m.index).split('\n').length;
3684
+ const line = lineOf(safe, m.index);
3409
3685
  const disp = (0, synth_utils_1.enclosingFn)(nodesInFile, line);
3410
3686
  if (!disp)
3411
3687
  continue;
@@ -3429,46 +3705,12 @@ async function sidekiqDispatchEdges(ctx, onYield) {
3429
3705
  }
3430
3706
  return edges;
3431
3707
  }
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
3708
  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
3709
  const ERLANG_DISPATCH_RE = /(^|[^?\w@'])([A-Z][A-Za-z0-9_@]*):([a-z][A-Za-z0-9_@]*)\(/g;
3459
3710
  const ERLANG_CALLBACK_DECL_RE = /(^|\n)\s*-callback\s+('[^'\n]+'|[a-z][A-Za-z0-9_@]*)\s*\(/g;
3460
3711
  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
3712
  function erlangArityAt(src, openIdx) {
3468
3713
  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
3714
  let binDepth = 0;
3473
3715
  let commas = 0;
3474
3716
  let sawArg = false;
@@ -3523,40 +3765,12 @@ function erlangArityAt(src, openIdx) {
3523
3765
  }
3524
3766
  return -1;
3525
3767
  }
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
3768
  function nixLeadingPlainSegments(name) {
3551
3769
  const segs = [];
3552
3770
  let i = 0;
3553
3771
  const n = name.length;
3554
3772
  while (i < n) {
3555
3773
  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
3774
  let j = i + 1;
3561
3775
  while (j < n && name[j] !== '"') {
3562
3776
  if (name[j] === '\\')
@@ -3564,10 +3778,10 @@ function nixLeadingPlainSegments(name) {
3564
3778
  j++;
3565
3779
  }
3566
3780
  if (j >= n)
3567
- return segs; // unterminated — stop at the static head
3781
+ return segs;
3568
3782
  const tok = name.slice(i, j + 1);
3569
3783
  if (tok.includes('${'))
3570
- return segs; // interpolated → dynamic → stop
3784
+ return segs;
3571
3785
  segs.push(tok);
3572
3786
  i = j + 1;
3573
3787
  if (i >= n)
@@ -3593,8 +3807,6 @@ function nixLeadingPlainSegments(name) {
3593
3807
  }
3594
3808
  async function nixOptionPathEdges(queries, onYield) {
3595
3809
  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
3810
  const byFile = new Map();
3599
3811
  let scanned = 0;
3600
3812
  for (const kind of ['variable', 'function']) {
@@ -3620,13 +3832,6 @@ async function nixOptionPathEdges(queries, onYield) {
3620
3832
  byFile.set(node.filePath, [rec]);
3621
3833
  }
3622
3834
  }
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
3835
  const SUBMODULE = '\u0000submodule';
3631
3836
  const decls = new Map();
3632
3837
  const writes = [];
@@ -3646,9 +3851,6 @@ async function nixOptionPathEdges(queries, onYield) {
3646
3851
  for (const rec of recs) {
3647
3852
  while (stack.length > 0 && stack[stack.length - 1].end < rec.startLine)
3648
3853
  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
3854
  const enclosing = stack.length > 0 &&
3653
3855
  rec.startLine >= stack[stack.length - 1].start &&
3654
3856
  rec.endLine <= stack[stack.length - 1].end &&
@@ -3656,7 +3858,7 @@ async function nixOptionPathEdges(queries, onYield) {
3656
3858
  ? stack[stack.length - 1]
3657
3859
  : null;
3658
3860
  if (rec.segs[0] === 'options') {
3659
- const ownPath = rec.segs.slice(1); // [] for the bare `options = { ... }` spelling
3861
+ const ownPath = rec.segs.slice(1);
3660
3862
  const prefix = enclosing ? [SUBMODULE] : ownPath;
3661
3863
  register(prefix, rec);
3662
3864
  stack.push({ start: rec.startLine, end: rec.endLine, prefix });
@@ -3677,13 +3879,9 @@ async function nixOptionPathEdges(queries, onYield) {
3677
3879
  return [];
3678
3880
  const edges = [];
3679
3881
  for (const w of writes) {
3680
- // `config.services.x = ...` spells the same write with an explicit prefix.
3681
3882
  const segs = w.segs[0] === 'config' ? w.segs.slice(1) : w.segs;
3682
3883
  if (segs.length < 2)
3683
3884
  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
3885
  for (let len = Math.min(segs.length, 6); len >= 2; len--) {
3688
3886
  const candidates = decls.get(segs.slice(0, len).join('.'));
3689
3887
  if (!candidates || candidates.length === 0)
@@ -3706,7 +3904,7 @@ async function nixOptionPathEdges(queries, onYield) {
3706
3904
  });
3707
3905
  }
3708
3906
  }
3709
- break; // longest hit decides, matched or ambiguous
3907
+ break;
3710
3908
  }
3711
3909
  }
3712
3910
  return edges;
@@ -3714,8 +3912,6 @@ async function nixOptionPathEdges(queries, onYield) {
3714
3912
  async function erlangBehaviourDispatchEdges(queries, ctx, onYield) {
3715
3913
  let scannedFiles = 0;
3716
3914
  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
3915
  const erlangModules = [];
3720
3916
  for (const n of queries.iterateNodesByKindIn('namespace', ['erlang'])) {
3721
3917
  if ((++scanned255 & 63) === 0)
@@ -3724,15 +3920,12 @@ async function erlangBehaviourDispatchEdges(queries, ctx, onYield) {
3724
3920
  }
3725
3921
  if (erlangModules.length === 0)
3726
3922
  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
3923
  const moduleByFile = new Map();
3731
3924
  for (const ns of erlangModules) {
3732
3925
  if (!moduleByFile.has(ns.filePath))
3733
3926
  moduleByFile.set(ns.filePath, ns);
3734
3927
  }
3735
- const declaringBehaviours = new Map(); // `fn/arity` → behaviour namespaces
3928
+ const declaringBehaviours = new Map();
3736
3929
  const callbackNames = new Set();
3737
3930
  for (const file of ctx.getAllFiles()) {
3738
3931
  if ((++scannedFiles & 15) === 0)
@@ -3741,7 +3934,7 @@ async function erlangBehaviourDispatchEdges(queries, ctx, onYield) {
3741
3934
  continue;
3742
3935
  const behaviour = moduleByFile.get(file);
3743
3936
  if (!behaviour)
3744
- continue; // a .hrl or module-less file can't be a behaviour
3937
+ continue;
3745
3938
  const content = ctx.readFile(file);
3746
3939
  if (!content || !content.includes('-callback'))
3747
3940
  continue;
@@ -3767,11 +3960,6 @@ async function erlangBehaviourDispatchEdges(queries, ctx, onYield) {
3767
3960
  }
3768
3961
  if (declaringBehaviours.size === 0)
3769
3962
  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
3963
  const targetCache = new Map();
3776
3964
  const qnArity = (qn) => {
3777
3965
  const m = /\/(\d{1,3})$/.exec(qn);
@@ -3799,8 +3987,6 @@ async function erlangBehaviourDispatchEdges(queries, ctx, onYield) {
3799
3987
  targetCache.set(cacheKey, targets);
3800
3988
  return targets;
3801
3989
  };
3802
- // Pass 2 — dispatch sites. Only files containing a var-module call shape are
3803
- // scanned in full.
3804
3990
  const edges = [];
3805
3991
  const seen = new Set();
3806
3992
  for (const file of ctx.getAllFiles()) {
@@ -3825,12 +4011,12 @@ async function erlangBehaviourDispatchEdges(queries, ctx, onYield) {
3825
4011
  continue;
3826
4012
  const behaviours = declaringBehaviours.get(`${fn}/${arity}`);
3827
4013
  if (!behaviours || behaviours.length !== 1)
3828
- continue; // unknown or ambiguous
4014
+ continue;
3829
4015
  const behaviour = behaviours[0];
3830
4016
  const targets = targetsOf(behaviour, fn, arity);
3831
4017
  if (targets.length === 0 || targets.length > ERLANG_BEHAVIOUR_FANOUT_CAP)
3832
4018
  continue;
3833
- const line = safe.slice(0, m.index).split('\n').length;
4019
+ const line = lineOf(safe, m.index);
3834
4020
  const disp = (0, synth_utils_1.enclosingFn)(nodesInFile, line);
3835
4021
  if (!disp)
3836
4022
  continue;
@@ -3858,31 +4044,14 @@ async function erlangBehaviourDispatchEdges(queries, ctx, onYield) {
3858
4044
  }
3859
4045
  return edges;
3860
4046
  }
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
4047
  const LARAVEL_DISPATCH_RE = /\bevent\s*\(\s*new\s+\\?([A-Za-z_][\w\\]*)/g;
3875
4048
  const LARAVEL_PHP_EXT = /\.php$/;
3876
4049
  const LARAVEL_FANOUT_CAP = 200;
3877
- // A `$listen` entry: `Event::class => [Listener::class, …]`, key/values as `::class` or strings.
3878
4050
  const LISTEN_ENTRY_RE = /(?:([A-Za-z_\\][\w\\]*)::class|'([^']+)'|"([^"]+)")\s*=>\s*\[([^\]]*)\]/g;
3879
4051
  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
4052
  function phpSimpleName(s) {
3882
4053
  return s.replace(/^\\/, '').split('\\').pop().split('::').pop().trim();
3883
4054
  }
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
4055
  function laravelHandleEventTypes(decl) {
3887
4056
  const m = /function\s+handle\s*\(\s*(?:\.\.\.\s*)?(\??[A-Za-z_\\][\w\\|]*)\s+&?\s*(?:\.\.\.\s*)?\$/.exec(decl);
3888
4057
  if (!m)
@@ -3893,7 +4062,6 @@ function laravelHandleEventTypes(decl) {
3893
4062
  .map((t) => phpSimpleName(t))
3894
4063
  .filter((t) => /^[A-Z]\w*$/.test(t));
3895
4064
  }
3896
- /** From an opening `[`, the bracket-balanced body up to its matching `]`. */
3897
4065
  function phpArrayBody(src, openIdx) {
3898
4066
  let depth = 0;
3899
4067
  for (let i = openIdx; i < src.length; i++) {
@@ -3906,7 +4074,6 @@ function phpArrayBody(src, openIdx) {
3906
4074
  }
3907
4075
  async function laravelEventEdges(ctx, onYield) {
3908
4076
  let scannedFiles = 0;
3909
- // event short name → its listener `handle` methods (deduped by node id).
3910
4077
  const listeners = new Map();
3911
4078
  const add = (event, handle) => {
3912
4079
  let m = listeners.get(event);
@@ -3920,7 +4087,6 @@ async function laravelEventEdges(ctx, onYield) {
3920
4087
  .getNodesInFile(cls.filePath)
3921
4088
  .find((n) => n.kind === 'method' && n.name === 'handle'
3922
4089
  && n.startLine >= cls.startLine && n.startLine <= (cls.endLine ?? cls.startLine)) ?? null;
3923
- // Pass 1 — build the event→handle map from both registration mechanisms.
3924
4090
  for (const file of ctx.getAllFiles()) {
3925
4091
  if ((++scannedFiles & 15) === 0)
3926
4092
  await onYield();
@@ -3929,7 +4095,6 @@ async function laravelEventEdges(ctx, onYield) {
3929
4095
  const content = ctx.readFile(file);
3930
4096
  if (!content)
3931
4097
  continue;
3932
- // (A) typed listener handles — node-driven, so a commented-out method can't leak in.
3933
4098
  if (content.includes('function handle')) {
3934
4099
  const lines = content.split('\n');
3935
4100
  for (const node of ctx.getNodesInFile(file)) {
@@ -3940,8 +4105,6 @@ async function laravelEventEdges(ctx, onYield) {
3940
4105
  add(ev, node);
3941
4106
  }
3942
4107
  }
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
4108
  if (content.includes('$listen')) {
3946
4109
  const safe = (0, strip_comments_1.stripCommentsForRegex)(content, 'php');
3947
4110
  const decl = safe.search(/\$listen\s*=\s*\[/);
@@ -3965,7 +4128,6 @@ async function laravelEventEdges(ctx, onYield) {
3965
4128
  }
3966
4129
  if (!listeners.size)
3967
4130
  return [];
3968
- // Pass 2 — link each event(new X(...)) site → every listener of X.
3969
4131
  const edges = [];
3970
4132
  const seen = new Set();
3971
4133
  for (const file of ctx.getAllFiles()) {
@@ -3985,7 +4147,7 @@ async function laravelEventEdges(ctx, onYield) {
3985
4147
  const targets = listeners.get(phpSimpleName(m[1]));
3986
4148
  if (!targets)
3987
4149
  continue;
3988
- const line = safe.slice(0, m.index).split('\n').length;
4150
+ const line = lineOf(safe, m.index);
3989
4151
  const disp = (0, synth_utils_1.enclosingFn)(nodesInFile, line);
3990
4152
  if (!disp)
3991
4153
  continue;
@@ -4011,23 +4173,26 @@ async function laravelEventEdges(ctx, onYield) {
4011
4173
  return edges;
4012
4174
  }
4013
4175
  const ALWAYS = () => true;
4014
- /** Conservative input gates for SYNTH_PASSES; keep these in sync when adding a pass. */
4015
4176
  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
4177
  if (/\.(?:vue|svelte|dfm|fmx|nix|xml)$/.test(filePath))
4019
4178
  return true;
4179
+ if (next_proxy_1.NEXT_PROXY_FILE.test(filePath) || (0, nextjs_1.nextRouteForFile)(filePath) !== null)
4180
+ return true;
4020
4181
  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))
4182
+ /\b(?:struct|union|typedef|virtual|override)\b|#\s*(?:include|define|if)|=|->|\[|</.test(content))
4022
4183
  return true;
4023
4184
  if (/\b(?:class|interface|protocol|trait|impl|extends|implements|expect|actual)\b/.test(content))
4024
4185
  return true;
4025
- if (/\.go$/.test(filePath) && /\b(?:struct|interface)\b|\bfunc\s*\(/.test(content))
4186
+ if (/\.go$/.test(filePath))
4026
4187
  return true;
4027
- if ((0, tier_synthesizer_1.hasCrossTierPattern)(content) || (0, tier_synthesizer_1.hasTestRequestPattern)(filePath, content))
4188
+ if ((0, tier_synthesizer_1.hasCrossTierPattern)(content) || (0, tier_synthesizer_1.hasTestRequestPattern)(filePath, content) || (0, tauri_synthesizer_1.hasTauriPattern)(filePath, content))
4028
4189
  return true;
4029
4190
  if (/\b(?:render|build|setState|defineStore|createStore|createApi|Store|href|sendEvent|sendEventWithName)\b|<\/|\/>/.test(content))
4030
4191
  return true;
4192
+ if (WRAPPER_CALL_RE.test(content))
4193
+ return true;
4194
+ if ((0, const_alias_synthesizer_1.hasConstAliasShape)(filePath, content))
4195
+ return true;
4031
4196
  if (/\.(?:forEach|append|add|push|insert|fire|dispatchEvent|addListener|Use|GET|POST|PUT|PATCH|DELETE|OPTIONS|HEAD|Any|Handle)\s*\(/.test(content))
4032
4197
  return true;
4033
4198
  if (/[\w$]\s*\[\s*[A-Za-z_$]/.test(content) || /\b(?:dispatch|commit)\s*\(/.test(content))
@@ -4044,27 +4209,13 @@ function hasSynthesisPattern(filePath, content) {
4044
4209
  if (matches)
4045
4210
  return true;
4046
4211
  }
4047
- // Field-backed observers use method-name gates rather than fixed call names.
4048
4212
  return (content.match(/[A-Za-z_$][\w$]*/g) ?? []).some((name) => REGISTRAR_NAME.test(name) || DISPATCHER_NAME.test(name));
4049
4213
  }
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
4214
  exports.SYNTH_PASSES = [
4058
4215
  { name: 'fieldEdges', gate: ALWAYS, run: (q, c, y) => fieldChannelEdges(q, c, y) },
4059
4216
  { 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
4217
  { 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.
4218
+ { name: 'tauriEdges', gate: (has) => has('rust') && has('vue', 'svelte', ...JS_FAMILY), run: (q, c, y) => (0, tauri_synthesizer_1.tauriEdges)(q, c, y) },
4068
4219
  { name: 'testRequestEdges', gate: (has) => has('java', 'kotlin', 'php'), run: (_q, c, y) => (0, tier_synthesizer_1.testRequestEdges)(c, y) },
4069
4220
  { name: 'emitterEdges', gate: ALWAYS, run: (_q, c, y) => eventEmitterEdges(c, y) },
4070
4221
  { name: 'renderEdges', gate: ALWAYS, run: (q, c, y) => reactRenderEdges(q, c, y) },
@@ -4076,24 +4227,17 @@ exports.SYNTH_PASSES = [
4076
4227
  { name: 'arkuiStateEdges', gate: (has) => has('arkts'), run: (q, c, y) => arkuiStateBuildEdges(q, c, y) },
4077
4228
  { name: 'arkuiEmitter', gate: (has) => has('arkts'), run: (_q, c, y) => arkuiEmitterEdges(c, y) },
4078
4229
  { 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) },
4230
+ { name: 'cppEdges', gate: (has) => has('cpp'), run: (q, c, y) => cppOverrideEdges(q, c, y) },
4080
4231
  {
4081
4232
  name: 'ifaceEdges',
4082
4233
  gate: (has) => has('java', 'kotlin', 'csharp', 'swift', 'scala', 'go', 'rust', 'arkts', ...JS_FAMILY),
4083
- run: (q, _c, y) => interfaceOverrideEdges(q, y),
4234
+ run: (q, c, y) => interfaceOverrideEdges(q, c, y),
4084
4235
  },
4085
4236
  { name: 'kotlinExpectActual', gate: (has) => has('kotlin'), run: (q, _c, y) => kotlinExpectActualEdges(q, y) },
4086
4237
  { name: 'goGrpcEdges', gate: (has) => has('go'), run: (q, _c, y) => goGrpcStubImplEdges(q, y) },
4087
4238
  { name: 'rnEventEdgesList', gate: (has) => has(...JS_FAMILY), run: (_q, c, y) => rnEventEdges(c, y) },
4088
4239
  { 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
4240
  { 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
4241
  { name: 'rnXPlatEdges', gate: (has) => has(...JS_FAMILY), run: (q, _c, y) => rnCrossPlatformEdges(q, y) },
4098
4242
  {
4099
4243
  name: 'mybatisEdges',
@@ -4102,6 +4246,7 @@ exports.SYNTH_PASSES = [
4102
4246
  },
4103
4247
  { name: 'ginEdges', gate: (has) => has('go'), run: (q, c, y) => ginMiddlewareChainEdges(q, c, y) },
4104
4248
  { name: 'thunkEdges', gate: (has) => has(...JS_FAMILY), run: (q, c, y) => reduxThunkEdges(q, c, y) },
4249
+ { name: 'constAliasEdges', gate: (has) => has(...JS_FAMILY), run: (q, c, y) => (0, const_alias_synthesizer_1.constAliasEdges)(q, c, y) },
4105
4250
  { name: 'registryEdges', gate: ALWAYS, run: (_q, c, y) => objectRegistryEdges(c, y) },
4106
4251
  { name: 'rtkEdges', gate: (has) => has(...JS_FAMILY), run: (q, c, y) => rtkQueryEdges(q, c, y) },
4107
4252
  { name: 'piniaEdges', gate: (has) => has('vue', ...JS_FAMILY), run: (_q, c, y) => piniaStoreEdges(c, y) },
@@ -4121,64 +4266,42 @@ exports.SYNTH_PASSES = [
4121
4266
  gate: (has) => has('c', 'cpp'),
4122
4267
  run: (q, c, y, sub) => (0, c_fnptr_synthesizer_1.cFnPointerDispatchEdges)(q, c, y, sub),
4123
4268
  },
4269
+ { name: 'cppTemplateEdges', gate: (has) => has('cpp'), run: (q, c, y) => (0, cpp_template_instantiations_1.cppTemplateArgumentEdges)(q, c, y) },
4124
4270
  { 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.
4271
+ { 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
4272
  { 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
4273
  { name: 'nextLinkEdges', gate: (has) => has(...JS_FAMILY), run: (_q, c, y) => (0, next_router_synthesizer_1.nextLinkEdges)(c, y) },
4274
+ { name: 'nextProxyEdges', gate: (has) => has(...JS_FAMILY), run: (_q, c, y) => (0, next_router_synthesizer_1.nextProxyEdges)(c, y) },
4129
4275
  { name: 'reactRouterLinkEdges', gate: (has) => has(...JS_FAMILY), run: (_q, c, y) => (0, react_router_synthesizer_1.reactRouterLinkEdges)(c, y) },
4130
4276
  { name: 'tanstackLinkEdges', gate: (has) => has(...JS_FAMILY), run: (_q, c, y) => (0, tanstack_router_synthesizer_1.tanstackLinkEdges)(c, y) },
4131
4277
  { 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
4278
  { name: 'angularTemplateEdges', gate: (has) => has('typescript'), run: (_q, c, y) => (0, angular_template_synthesizer_1.angularTemplateEdges)(c, y) },
4134
4279
  { name: 'svelteKitPageEdges', gate: (has) => has('svelte'), run: (_q, c, y) => (0, sveltekit_synthesizer_1.svelteKitPageComponentEdges)(c, y) },
4135
4280
  { name: 'svelteKitLinkEdges', gate: (has) => has('svelte'), run: (_q, c, y) => (0, sveltekit_synthesizer_1.svelteKitLinkEdges)(c, y) },
4136
4281
  { name: 'nixOptionEdges', gate: (has) => has('nix'), run: (q, _c, y) => nixOptionPathEdges(q, y) },
4137
4282
  ];
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
4283
  const SYNTH_PASS_COST_HINT = {
4145
- cFnPtrEdges: 100, registryEdges: 60, tierEdges: 55, jsxEdges: 25, rnEventEdgesList: 24,
4284
+ cFnPtrEdges: 100, registryEdges: 60, tierEdges: 55, goFuncFieldEdges: 30, jsxEdges: 25, rnEventEdgesList: 24,
4146
4285
  ifaceEdges: 18, flutterEdges: 16, cppEdges: 15, emitterEdges: 12, fieldEdges: 11,
4147
4286
  mybatisEdges: 10, vuexEdges: 8, closureCollEdges: 6, piniaEdges: 5, renderEdges: 4,
4148
4287
  };
4149
4288
  function synthPassCostHint(name) {
4150
4289
  return SYNTH_PASS_COST_HINT[name] ?? 0;
4151
4290
  }
4152
- /** Fixed non-registry steps: goMethodContains, goImplements, dedupe-merge, insertMergedEdges. */
4153
4291
  const FIXED_SYNTH_STEPS = 4;
4154
4292
  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.
4293
+ function manualMockNodeIds(ctx) {
4294
+ const ids = new Set();
4295
+ for (const file of ctx.getAllFiles()) {
4296
+ if (!(0, name_matcher_1.isManualMockPath)(file))
4297
+ continue;
4298
+ for (const n of ctx.getNodesInFile(file))
4299
+ ids.add(n.id);
4300
+ }
4301
+ return ids;
4302
+ }
4303
+ async function synthesizeCallbackEdges(queries, ctx, onProgress, pool, backpressure, whilePoolBusy) {
4174
4304
  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
4305
  let passesDone = 0;
4183
4306
  let lastPct = -1;
4184
4307
  const emit = (value) => {
@@ -4191,14 +4314,8 @@ whilePoolBusy) {
4191
4314
  lastPct = pct;
4192
4315
  onProgress(v, exports.SYNTH_PROGRESS_STEPS);
4193
4316
  };
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
4317
  const subProgress = (fraction) => emit(passesDone + Math.max(0, Math.min(fraction, 1)));
4198
4318
  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
4319
  const markT = { t: Date.now() };
4203
4320
  const __mark = (label) => {
4204
4321
  const now = Date.now();
@@ -4210,22 +4327,9 @@ whilePoolBusy) {
4210
4327
  passesDone++;
4211
4328
  emit(passesDone);
4212
4329
  };
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
4330
  const langs = queries.getDistinctFileLanguages();
4220
4331
  const has = (...ls) => ls.some((l) => langs.has(l));
4221
4332
  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
4333
  const foldIfOver = async () => {
4230
4334
  const bp = backpressure?.();
4231
4335
  if (bp)
@@ -4239,11 +4343,7 @@ whilePoolBusy) {
4239
4343
  }
4240
4344
  await yieldToLoop();
4241
4345
  __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;
4346
+ const goImpl = has('go') ? await goImplementsEdges(queries, ctx, yieldToLoop) : NONE;
4247
4347
  for (let i = 0; i < goImpl.length; i += 2000) {
4248
4348
  queries.insertEdges(goImpl.slice(i, i + 2000));
4249
4349
  await yieldToLoop();
@@ -4251,14 +4351,6 @@ whilePoolBusy) {
4251
4351
  }
4252
4352
  await yieldToLoop();
4253
4353
  __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
4354
  const passEdges = new Array(exports.SYNTH_PASSES.length).fill(NONE);
4263
4355
  const markPass = (label, dt) => {
4264
4356
  if (process.env.CODEGRAPH_SYNTH_TIMINGS && (dt > 250 || process.env.CODEGRAPH_SYNTH_TIMINGS === 'all')) {
@@ -4281,27 +4373,26 @@ whilePoolBusy) {
4281
4373
  else
4282
4374
  markPass(exports.SYNTH_PASSES[i].name, 0);
4283
4375
  }
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
4376
  const MAIN_RETRY_MAX_NODES = 1_500_000;
4291
4377
  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
4378
  const collectInputs = async () => {
4297
- const found = [];
4379
+ const found = new Set();
4380
+ const tagModules = new Map();
4298
4381
  for (const file of ctx.getAllFiles()) {
4299
4382
  const content = ctx.readFile(file);
4300
- if (content !== null && hasSynthesisPattern(file, content))
4301
- found.push(file);
4383
+ if (content !== null && hasSynthesisPattern(file, content)) {
4384
+ found.add(file);
4385
+ if (/\bimport\s*\(/.test(content))
4386
+ for (const read of (0, react_1.lazyValueModules)(file, ctx))
4387
+ found.add(read);
4388
+ if (JSX_INPUT_FILE.test(file) && (content.includes('</') || content.includes('/>'))) {
4389
+ for (const read of importedTagModules(ctx, file, content, tagModules))
4390
+ found.add(read);
4391
+ }
4392
+ }
4302
4393
  await yieldToLoop();
4303
4394
  }
4304
- return found;
4395
+ return [...found];
4305
4396
  };
4306
4397
  let inputs = null;
4307
4398
  if (pool && gatedIn.length > 1) {
@@ -4314,22 +4405,13 @@ whilePoolBusy) {
4314
4405
  }
4315
4406
  catch (err) {
4316
4407
  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
4408
  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
4409
  markPass(`${pass.name} (skipped at scale)`, 0);
4321
4410
  return;
4322
4411
  }
4323
- // Worker-side failure (crash, OOM, unknown pass after a version
4324
- // mismatch): retry this one pass on the main thread.
4325
4412
  await runPassOnMain(i);
4326
4413
  }
4327
4414
  };
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
4415
  const lanes = Math.min(pool.size ?? gatedIn.length, gatedIn.length);
4334
4416
  const queue = [...gatedIn].sort((a, b) => synthPassCostHint(exports.SYNTH_PASSES[b].name) - synthPassCostHint(exports.SYNTH_PASSES[a].name) || a - b);
4335
4417
  const lane = async () => {
@@ -4337,8 +4419,6 @@ whilePoolBusy) {
4337
4419
  await runPooled(i);
4338
4420
  };
4339
4421
  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
4422
  fanOut.catch(() => undefined);
4343
4423
  whilePoolBusy?.();
4344
4424
  inputs = await collectInputs();
@@ -4349,6 +4429,12 @@ whilePoolBusy) {
4349
4429
  await runPassOnMain(i);
4350
4430
  }
4351
4431
  }
4432
+ releaseLineCaches();
4433
+ const mockNodes = manualMockNodeIds(ctx);
4434
+ const fromTestCode = (id) => {
4435
+ const source = ctx.getNodeById?.(id);
4436
+ return !source || (0, query_utils_1.isTestPath)(source.filePath);
4437
+ };
4352
4438
  const merged = [];
4353
4439
  const seen = new Set();
4354
4440
  for (const e of passEdges.flat()) {
@@ -4356,12 +4442,11 @@ whilePoolBusy) {
4356
4442
  if (seen.has(key))
4357
4443
  continue;
4358
4444
  seen.add(key);
4445
+ if (mockNodes.size > 0 && mockNodes.has(e.target) && !fromTestCode(e.source))
4446
+ continue;
4359
4447
  merged.push(e);
4360
4448
  }
4361
4449
  __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
4450
  for (let i = 0; i < merged.length; i += 2000) {
4366
4451
  queries.insertEdges(merged.slice(i, i + 2000));
4367
4452
  await yieldToLoop();