@colbymchenry/codegraph-win32-arm64 1.6.1 → 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 (1094) 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 +427 -684
  8. package/lib/dist/bin/codegraph.js.map +1 -1
  9. package/lib/dist/bin/command-supervision.d.ts +7 -0
  10. package/lib/dist/bin/command-supervision.d.ts.map +1 -1
  11. package/lib/dist/bin/command-supervision.js +30 -74
  12. package/lib/dist/bin/command-supervision.js.map +1 -1
  13. package/lib/dist/bin/fatal-handler.js +0 -46
  14. package/lib/dist/bin/fatal-handler.js.map +1 -1
  15. package/lib/dist/bin/node-version-check.js +0 -33
  16. package/lib/dist/bin/node-version-check.js.map +1 -1
  17. package/lib/dist/bin/uninstall.js +0 -19
  18. package/lib/dist/bin/uninstall.js.map +1 -1
  19. package/lib/dist/bin/viewer-gate.js +0 -14
  20. package/lib/dist/bin/viewer-gate.js.map +1 -1
  21. package/lib/dist/compile-cache.d.ts +2 -0
  22. package/lib/dist/compile-cache.d.ts.map +1 -0
  23. package/lib/dist/compile-cache.js +45 -0
  24. package/lib/dist/compile-cache.js.map +1 -0
  25. package/lib/dist/context/formatter.js +3 -66
  26. package/lib/dist/context/formatter.js.map +1 -1
  27. package/lib/dist/context/index.d.ts +44 -1
  28. package/lib/dist/context/index.d.ts.map +1 -1
  29. package/lib/dist/context/index.js +123 -430
  30. package/lib/dist/context/index.js.map +1 -1
  31. package/lib/dist/context/markers.js +0 -17
  32. package/lib/dist/context/markers.js.map +1 -1
  33. package/lib/dist/db/index.d.ts +44 -1
  34. package/lib/dist/db/index.d.ts.map +1 -1
  35. package/lib/dist/db/index.js +123 -395
  36. package/lib/dist/db/index.js.map +1 -1
  37. package/lib/dist/db/migrations.d.ts +11 -1
  38. package/lib/dist/db/migrations.d.ts.map +1 -1
  39. package/lib/dist/db/migrations.js +71 -79
  40. package/lib/dist/db/migrations.js.map +1 -1
  41. package/lib/dist/db/name-substring-index.d.ts +63 -0
  42. package/lib/dist/db/name-substring-index.d.ts.map +1 -0
  43. package/lib/dist/db/name-substring-index.js +151 -0
  44. package/lib/dist/db/name-substring-index.js.map +1 -0
  45. package/lib/dist/db/node-sqlite.d.ts +19 -0
  46. package/lib/dist/db/node-sqlite.d.ts.map +1 -0
  47. package/lib/dist/db/node-sqlite.js +23 -0
  48. package/lib/dist/db/node-sqlite.js.map +1 -0
  49. package/lib/dist/db/open-error.d.ts +36 -0
  50. package/lib/dist/db/open-error.d.ts.map +1 -0
  51. package/lib/dist/db/open-error.js +63 -0
  52. package/lib/dist/db/open-error.js.map +1 -0
  53. package/lib/dist/db/parameter-flow-queries.d.ts +120 -0
  54. package/lib/dist/db/parameter-flow-queries.d.ts.map +1 -0
  55. package/lib/dist/db/parameter-flow-queries.js +168 -0
  56. package/lib/dist/db/parameter-flow-queries.js.map +1 -0
  57. package/lib/dist/db/queries.d.ts +641 -40
  58. package/lib/dist/db/queries.d.ts.map +1 -1
  59. package/lib/dist/db/queries.js +1370 -1398
  60. package/lib/dist/db/queries.js.map +1 -1
  61. package/lib/dist/db/reference-tail.d.ts +83 -0
  62. package/lib/dist/db/reference-tail.d.ts.map +1 -0
  63. package/lib/dist/db/reference-tail.js +68 -0
  64. package/lib/dist/db/reference-tail.js.map +1 -0
  65. package/lib/dist/db/schema.sql +18 -2
  66. package/lib/dist/db/sqlite-adapter.d.ts +18 -1
  67. package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
  68. package/lib/dist/db/sqlite-adapter.js +12 -62
  69. package/lib/dist/db/sqlite-adapter.js.map +1 -1
  70. package/lib/dist/db/synthesis-stage.d.ts.map +1 -1
  71. package/lib/dist/db/synthesis-stage.js +2 -6
  72. package/lib/dist/db/synthesis-stage.js.map +1 -1
  73. package/lib/dist/db/wal-valve.js +1 -153
  74. package/lib/dist/db/wal-valve.js.map +1 -1
  75. package/lib/dist/db/wsl-shared-index.js +0 -37
  76. package/lib/dist/db/wsl-shared-index.js.map +1 -1
  77. package/lib/dist/directory.d.ts +81 -0
  78. package/lib/dist/directory.d.ts.map +1 -1
  79. package/lib/dist/directory.js +91 -500
  80. package/lib/dist/directory.js.map +1 -1
  81. package/lib/dist/engine.d.ts +15 -0
  82. package/lib/dist/engine.d.ts.map +1 -0
  83. package/lib/dist/engine.js +34 -0
  84. package/lib/dist/engine.js.map +1 -0
  85. package/lib/dist/errors.d.ts +10 -0
  86. package/lib/dist/errors.d.ts.map +1 -1
  87. package/lib/dist/errors.js +8 -101
  88. package/lib/dist/errors.js.map +1 -1
  89. package/lib/dist/extraction/astro-extractor.d.ts.map +1 -1
  90. package/lib/dist/extraction/astro-extractor.js +15 -133
  91. package/lib/dist/extraction/astro-extractor.js.map +1 -1
  92. package/lib/dist/extraction/cfml-extractor.d.ts +102 -10
  93. package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -1
  94. package/lib/dist/extraction/cfml-extractor.js +260 -179
  95. package/lib/dist/extraction/cfml-extractor.js.map +1 -1
  96. package/lib/dist/extraction/commonjs-requires.d.ts +23 -0
  97. package/lib/dist/extraction/commonjs-requires.d.ts.map +1 -0
  98. package/lib/dist/extraction/commonjs-requires.js +37 -0
  99. package/lib/dist/extraction/commonjs-requires.js.map +1 -0
  100. package/lib/dist/extraction/dfm-extractor.js +0 -21
  101. package/lib/dist/extraction/dfm-extractor.js.map +1 -1
  102. package/lib/dist/extraction/extraction-version.d.ts +1 -1
  103. package/lib/dist/extraction/extraction-version.js +1 -24
  104. package/lib/dist/extraction/extraction-version.js.map +1 -1
  105. package/lib/dist/extraction/function-ref.d.ts +40 -0
  106. package/lib/dist/extraction/function-ref.d.ts.map +1 -1
  107. package/lib/dist/extraction/function-ref.js +145 -206
  108. package/lib/dist/extraction/function-ref.js.map +1 -1
  109. package/lib/dist/extraction/generated-detection.d.ts +9 -0
  110. package/lib/dist/extraction/generated-detection.d.ts.map +1 -1
  111. package/lib/dist/extraction/generated-detection.js +29 -154
  112. package/lib/dist/extraction/generated-detection.js.map +1 -1
  113. package/lib/dist/extraction/grammars.d.ts +47 -4
  114. package/lib/dist/extraction/grammars.d.ts.map +1 -1
  115. package/lib/dist/extraction/grammars.js +91 -374
  116. package/lib/dist/extraction/grammars.js.map +1 -1
  117. package/lib/dist/extraction/index.d.ts +216 -11
  118. package/lib/dist/extraction/index.d.ts.map +1 -1
  119. package/lib/dist/extraction/index.js +703 -1368
  120. package/lib/dist/extraction/index.js.map +1 -1
  121. package/lib/dist/extraction/kernel/decode.js +0 -16
  122. package/lib/dist/extraction/kernel/decode.js.map +1 -1
  123. package/lib/dist/extraction/kernel/index.d.ts +3 -1
  124. package/lib/dist/extraction/kernel/index.d.ts.map +1 -1
  125. package/lib/dist/extraction/kernel/index.js +29 -131
  126. package/lib/dist/extraction/kernel/index.js.map +1 -1
  127. package/lib/dist/extraction/kernel/layout.js +42 -76
  128. package/lib/dist/extraction/kernel/layout.js.map +1 -1
  129. package/lib/dist/extraction/kernel/loader.js +0 -37
  130. package/lib/dist/extraction/kernel/loader.js.map +1 -1
  131. package/lib/dist/extraction/languages/arkts.js +0 -59
  132. package/lib/dist/extraction/languages/arkts.js.map +1 -1
  133. package/lib/dist/extraction/languages/c-cpp.d.ts +140 -28
  134. package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
  135. package/lib/dist/extraction/languages/c-cpp.js +876 -823
  136. package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
  137. package/lib/dist/extraction/languages/cfquery.js +0 -9
  138. package/lib/dist/extraction/languages/cfquery.js.map +1 -1
  139. package/lib/dist/extraction/languages/cfscript.d.ts +20 -0
  140. package/lib/dist/extraction/languages/cfscript.d.ts.map +1 -1
  141. package/lib/dist/extraction/languages/cfscript.js +80 -9
  142. package/lib/dist/extraction/languages/cfscript.js.map +1 -1
  143. package/lib/dist/extraction/languages/cobol.js +0 -114
  144. package/lib/dist/extraction/languages/cobol.js.map +1 -1
  145. package/lib/dist/extraction/languages/cpp-brace-scopes.d.ts +66 -0
  146. package/lib/dist/extraction/languages/cpp-brace-scopes.d.ts.map +1 -0
  147. package/lib/dist/extraction/languages/cpp-brace-scopes.js +343 -0
  148. package/lib/dist/extraction/languages/cpp-brace-scopes.js.map +1 -0
  149. package/lib/dist/extraction/languages/cpp-macro-methods.d.ts +41 -0
  150. package/lib/dist/extraction/languages/cpp-macro-methods.d.ts.map +1 -0
  151. package/lib/dist/extraction/languages/cpp-macro-methods.js +487 -0
  152. package/lib/dist/extraction/languages/cpp-macro-methods.js.map +1 -0
  153. package/lib/dist/extraction/languages/csharp.d.ts.map +1 -1
  154. package/lib/dist/extraction/languages/csharp.js +11 -54
  155. package/lib/dist/extraction/languages/csharp.js.map +1 -1
  156. package/lib/dist/extraction/languages/dart.d.ts +84 -0
  157. package/lib/dist/extraction/languages/dart.d.ts.map +1 -1
  158. package/lib/dist/extraction/languages/dart.js +335 -159
  159. package/lib/dist/extraction/languages/dart.js.map +1 -1
  160. package/lib/dist/extraction/languages/erlang.d.ts.map +1 -1
  161. package/lib/dist/extraction/languages/erlang.js +15 -102
  162. package/lib/dist/extraction/languages/erlang.js.map +1 -1
  163. package/lib/dist/extraction/languages/go.d.ts +48 -0
  164. package/lib/dist/extraction/languages/go.d.ts.map +1 -1
  165. package/lib/dist/extraction/languages/go.js +102 -31
  166. package/lib/dist/extraction/languages/go.js.map +1 -1
  167. package/lib/dist/extraction/languages/index.js +0 -6
  168. package/lib/dist/extraction/languages/index.js.map +1 -1
  169. package/lib/dist/extraction/languages/java.d.ts.map +1 -1
  170. package/lib/dist/extraction/languages/java.js +67 -78
  171. package/lib/dist/extraction/languages/java.js.map +1 -1
  172. package/lib/dist/extraction/languages/javascript.d.ts.map +1 -1
  173. package/lib/dist/extraction/languages/javascript.js +2 -12
  174. package/lib/dist/extraction/languages/javascript.js.map +1 -1
  175. package/lib/dist/extraction/languages/kotlin.d.ts +15 -0
  176. package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -1
  177. package/lib/dist/extraction/languages/kotlin.js +69 -150
  178. package/lib/dist/extraction/languages/kotlin.js.map +1 -1
  179. package/lib/dist/extraction/languages/lua.js +2 -39
  180. package/lib/dist/extraction/languages/lua.js.map +1 -1
  181. package/lib/dist/extraction/languages/luau.js +0 -14
  182. package/lib/dist/extraction/languages/luau.js.map +1 -1
  183. package/lib/dist/extraction/languages/nix.js +0 -16
  184. package/lib/dist/extraction/languages/nix.js.map +1 -1
  185. package/lib/dist/extraction/languages/objc.d.ts.map +1 -1
  186. package/lib/dist/extraction/languages/objc.js +5 -16
  187. package/lib/dist/extraction/languages/objc.js.map +1 -1
  188. package/lib/dist/extraction/languages/pascal-preparse.d.ts +66 -0
  189. package/lib/dist/extraction/languages/pascal-preparse.d.ts.map +1 -0
  190. package/lib/dist/extraction/languages/pascal-preparse.js +958 -0
  191. package/lib/dist/extraction/languages/pascal-preparse.js.map +1 -0
  192. package/lib/dist/extraction/languages/pascal-system.d.ts +11 -0
  193. package/lib/dist/extraction/languages/pascal-system.d.ts.map +1 -0
  194. package/lib/dist/extraction/languages/pascal-system.js +23 -0
  195. package/lib/dist/extraction/languages/pascal-system.js.map +1 -0
  196. package/lib/dist/extraction/languages/pascal.d.ts.map +1 -1
  197. package/lib/dist/extraction/languages/pascal.js +3 -4
  198. package/lib/dist/extraction/languages/pascal.js.map +1 -1
  199. package/lib/dist/extraction/languages/php.js +5 -42
  200. package/lib/dist/extraction/languages/php.js.map +1 -1
  201. package/lib/dist/extraction/languages/python.js +2 -20
  202. package/lib/dist/extraction/languages/python.js.map +1 -1
  203. package/lib/dist/extraction/languages/r.js +8 -78
  204. package/lib/dist/extraction/languages/r.js.map +1 -1
  205. package/lib/dist/extraction/languages/ruby.d.ts.map +1 -1
  206. package/lib/dist/extraction/languages/ruby.js +17 -25
  207. package/lib/dist/extraction/languages/ruby.js.map +1 -1
  208. package/lib/dist/extraction/languages/rust.d.ts +10 -0
  209. package/lib/dist/extraction/languages/rust.d.ts.map +1 -1
  210. package/lib/dist/extraction/languages/rust.js +15 -47
  211. package/lib/dist/extraction/languages/rust.js.map +1 -1
  212. package/lib/dist/extraction/languages/scala.js +5 -41
  213. package/lib/dist/extraction/languages/scala.js.map +1 -1
  214. package/lib/dist/extraction/languages/solidity.js +1 -82
  215. package/lib/dist/extraction/languages/solidity.js.map +1 -1
  216. package/lib/dist/extraction/languages/swift.d.ts +15 -0
  217. package/lib/dist/extraction/languages/swift.d.ts.map +1 -1
  218. package/lib/dist/extraction/languages/swift.js +33 -27
  219. package/lib/dist/extraction/languages/swift.js.map +1 -1
  220. package/lib/dist/extraction/languages/terraform.js +6 -152
  221. package/lib/dist/extraction/languages/terraform.js.map +1 -1
  222. package/lib/dist/extraction/languages/typescript.d.ts +71 -0
  223. package/lib/dist/extraction/languages/typescript.d.ts.map +1 -1
  224. package/lib/dist/extraction/languages/typescript.js +86 -41
  225. package/lib/dist/extraction/languages/typescript.js.map +1 -1
  226. package/lib/dist/extraction/languages/vbnet.d.ts.map +1 -1
  227. package/lib/dist/extraction/languages/vbnet.js +9 -42
  228. package/lib/dist/extraction/languages/vbnet.js.map +1 -1
  229. package/lib/dist/extraction/lazy-frameworks.d.ts +15 -0
  230. package/lib/dist/extraction/lazy-frameworks.d.ts.map +1 -0
  231. package/lib/dist/extraction/lazy-frameworks.js +8 -0
  232. package/lib/dist/extraction/lazy-frameworks.js.map +1 -0
  233. package/lib/dist/extraction/liquid-extractor.d.ts +29 -3
  234. package/lib/dist/extraction/liquid-extractor.d.ts.map +1 -1
  235. package/lib/dist/extraction/liquid-extractor.js +89 -148
  236. package/lib/dist/extraction/liquid-extractor.js.map +1 -1
  237. package/lib/dist/extraction/mybatis-extractor.js +0 -78
  238. package/lib/dist/extraction/mybatis-extractor.js.map +1 -1
  239. package/lib/dist/extraction/parse-budget.d.ts +16 -0
  240. package/lib/dist/extraction/parse-budget.d.ts.map +1 -0
  241. package/lib/dist/extraction/parse-budget.js +11 -0
  242. package/lib/dist/extraction/parse-budget.js.map +1 -0
  243. package/lib/dist/extraction/parse-pool.d.ts +41 -5
  244. package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
  245. package/lib/dist/extraction/parse-pool.js +74 -158
  246. package/lib/dist/extraction/parse-pool.js.map +1 -1
  247. package/lib/dist/extraction/parse-worker.d.ts +1 -1
  248. package/lib/dist/extraction/parse-worker.d.ts.map +1 -1
  249. package/lib/dist/extraction/parse-worker.js +7 -58
  250. package/lib/dist/extraction/parse-worker.js.map +1 -1
  251. package/lib/dist/extraction/razor-extractor.d.ts +9 -0
  252. package/lib/dist/extraction/razor-extractor.d.ts.map +1 -1
  253. package/lib/dist/extraction/razor-extractor.js +45 -69
  254. package/lib/dist/extraction/razor-extractor.js.map +1 -1
  255. package/lib/dist/extraction/razor-script.d.ts +23 -0
  256. package/lib/dist/extraction/razor-script.d.ts.map +1 -0
  257. package/lib/dist/extraction/razor-script.js +244 -0
  258. package/lib/dist/extraction/razor-script.js.map +1 -0
  259. package/lib/dist/extraction/sfc-script.d.ts +85 -0
  260. package/lib/dist/extraction/sfc-script.d.ts.map +1 -0
  261. package/lib/dist/extraction/sfc-script.js +136 -0
  262. package/lib/dist/extraction/sfc-script.js.map +1 -0
  263. package/lib/dist/extraction/store-worker.d.ts +1 -1
  264. package/lib/dist/extraction/store-worker.d.ts.map +1 -1
  265. package/lib/dist/extraction/store-worker.js +5 -37
  266. package/lib/dist/extraction/store-worker.js.map +1 -1
  267. package/lib/dist/extraction/store-writer.d.ts +10 -2
  268. package/lib/dist/extraction/store-writer.d.ts.map +1 -1
  269. package/lib/dist/extraction/store-writer.js +8 -32
  270. package/lib/dist/extraction/store-writer.js.map +1 -1
  271. package/lib/dist/extraction/svelte-extractor.d.ts.map +1 -1
  272. package/lib/dist/extraction/svelte-extractor.js +16 -122
  273. package/lib/dist/extraction/svelte-extractor.js.map +1 -1
  274. package/lib/dist/extraction/syntax-tokens.d.ts +6 -5
  275. package/lib/dist/extraction/syntax-tokens.d.ts.map +1 -1
  276. package/lib/dist/extraction/syntax-tokens.js +6 -153
  277. package/lib/dist/extraction/syntax-tokens.js.map +1 -1
  278. package/lib/dist/extraction/tree-sitter-helpers.d.ts +37 -1
  279. package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
  280. package/lib/dist/extraction/tree-sitter-helpers.js +76 -68
  281. package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -1
  282. package/lib/dist/extraction/tree-sitter-types.d.ts +102 -22
  283. package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
  284. package/lib/dist/extraction/tree-sitter-types.js +0 -7
  285. package/lib/dist/extraction/tree-sitter-types.js.map +1 -1
  286. package/lib/dist/extraction/tree-sitter.d.ts +455 -9
  287. package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
  288. package/lib/dist/extraction/tree-sitter.js +1998 -2517
  289. package/lib/dist/extraction/tree-sitter.js.map +1 -1
  290. package/lib/dist/extraction/vue-extractor.d.ts +20 -0
  291. package/lib/dist/extraction/vue-extractor.d.ts.map +1 -1
  292. package/lib/dist/extraction/vue-extractor.js +113 -115
  293. package/lib/dist/extraction/vue-extractor.js.map +1 -1
  294. package/lib/dist/extraction/vue-options-api.d.ts +28 -0
  295. package/lib/dist/extraction/vue-options-api.d.ts.map +1 -0
  296. package/lib/dist/extraction/vue-options-api.js +164 -0
  297. package/lib/dist/extraction/vue-options-api.js.map +1 -0
  298. package/lib/dist/extraction/vue-template-calls.d.ts +37 -0
  299. package/lib/dist/extraction/vue-template-calls.d.ts.map +1 -0
  300. package/lib/dist/extraction/vue-template-calls.js +497 -0
  301. package/lib/dist/extraction/vue-template-calls.js.map +1 -0
  302. package/lib/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
  303. package/lib/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
  304. package/lib/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
  305. package/lib/dist/extraction/wasm-runtime-flags.d.ts +6 -0
  306. package/lib/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
  307. package/lib/dist/extraction/wasm-runtime-flags.js +1 -88
  308. package/lib/dist/extraction/wasm-runtime-flags.js.map +1 -1
  309. package/lib/dist/file-limits.d.ts +8 -0
  310. package/lib/dist/file-limits.d.ts.map +1 -1
  311. package/lib/dist/file-limits.js +13 -28
  312. package/lib/dist/file-limits.js.map +1 -1
  313. package/lib/dist/graph/branch-guards.d.ts +17 -0
  314. package/lib/dist/graph/branch-guards.d.ts.map +1 -1
  315. package/lib/dist/graph/branch-guards.js +98 -250
  316. package/lib/dist/graph/branch-guards.js.map +1 -1
  317. package/lib/dist/graph/call-sites.d.ts +12 -0
  318. package/lib/dist/graph/call-sites.d.ts.map +1 -0
  319. package/lib/dist/graph/call-sites.js +17 -0
  320. package/lib/dist/graph/call-sites.js.map +1 -0
  321. package/lib/dist/graph/cobol-copybooks.d.ts +75 -0
  322. package/lib/dist/graph/cobol-copybooks.d.ts.map +1 -0
  323. package/lib/dist/graph/cobol-copybooks.js +45 -0
  324. package/lib/dist/graph/cobol-copybooks.js.map +1 -0
  325. package/lib/dist/graph/dead-code.d.ts +26 -4
  326. package/lib/dist/graph/dead-code.d.ts.map +1 -1
  327. package/lib/dist/graph/dead-code.js +157 -311
  328. package/lib/dist/graph/dead-code.js.map +1 -1
  329. package/lib/dist/graph/dynamic-boundary-report.js +1 -88
  330. package/lib/dist/graph/dynamic-boundary-report.js.map +1 -1
  331. package/lib/dist/graph/file-cycles.d.ts +20 -0
  332. package/lib/dist/graph/file-cycles.d.ts.map +1 -0
  333. package/lib/dist/graph/file-cycles.js +79 -0
  334. package/lib/dist/graph/file-cycles.js.map +1 -0
  335. package/lib/dist/graph/go-package.d.ts +27 -0
  336. package/lib/dist/graph/go-package.d.ts.map +1 -0
  337. package/lib/dist/graph/go-package.js +49 -0
  338. package/lib/dist/graph/go-package.js.map +1 -0
  339. package/lib/dist/graph/index.d.ts +2 -0
  340. package/lib/dist/graph/index.d.ts.map +1 -1
  341. package/lib/dist/graph/index.js +4 -6
  342. package/lib/dist/graph/index.js.map +1 -1
  343. package/lib/dist/graph/named-symbol-flow.d.ts +5 -1
  344. package/lib/dist/graph/named-symbol-flow.d.ts.map +1 -1
  345. package/lib/dist/graph/named-symbol-flow.js +85 -219
  346. package/lib/dist/graph/named-symbol-flow.js.map +1 -1
  347. package/lib/dist/graph/owning-package.d.ts +59 -0
  348. package/lib/dist/graph/owning-package.d.ts.map +1 -0
  349. package/lib/dist/graph/owning-package.js +120 -0
  350. package/lib/dist/graph/owning-package.js.map +1 -0
  351. package/lib/dist/graph/queries.d.ts +2 -2
  352. package/lib/dist/graph/queries.d.ts.map +1 -1
  353. package/lib/dist/graph/queries.js +2 -135
  354. package/lib/dist/graph/queries.js.map +1 -1
  355. package/lib/dist/graph/symbol-lookup.d.ts +15 -3
  356. package/lib/dist/graph/symbol-lookup.d.ts.map +1 -1
  357. package/lib/dist/graph/symbol-lookup.js +47 -89
  358. package/lib/dist/graph/symbol-lookup.js.map +1 -1
  359. package/lib/dist/graph/synthesized-hop.d.ts +37 -0
  360. package/lib/dist/graph/synthesized-hop.d.ts.map +1 -0
  361. package/lib/dist/graph/synthesized-hop.js +62 -0
  362. package/lib/dist/graph/synthesized-hop.js.map +1 -0
  363. package/lib/dist/graph/test-code.d.ts +21 -0
  364. package/lib/dist/graph/test-code.d.ts.map +1 -0
  365. package/lib/dist/graph/test-code.js +50 -0
  366. package/lib/dist/graph/test-code.js.map +1 -0
  367. package/lib/dist/graph/traversal.d.ts +31 -2
  368. package/lib/dist/graph/traversal.d.ts.map +1 -1
  369. package/lib/dist/graph/traversal.js +98 -226
  370. package/lib/dist/graph/traversal.js.map +1 -1
  371. package/lib/dist/graph/type-hierarchy.js +0 -138
  372. package/lib/dist/graph/type-hierarchy.js.map +1 -1
  373. package/lib/dist/index.d.ts +195 -25
  374. package/lib/dist/index.d.ts.map +1 -1
  375. package/lib/dist/index.js +697 -1105
  376. package/lib/dist/index.js.map +1 -1
  377. package/lib/dist/installer/beta-signup.js +0 -39
  378. package/lib/dist/installer/beta-signup.js.map +1 -1
  379. package/lib/dist/installer/config-writer.js +0 -24
  380. package/lib/dist/installer/config-writer.js.map +1 -1
  381. package/lib/dist/installer/index.d.ts +9 -5
  382. package/lib/dist/installer/index.d.ts.map +1 -1
  383. package/lib/dist/installer/index.js +25 -159
  384. package/lib/dist/installer/index.js.map +1 -1
  385. package/lib/dist/installer/instructions-template.d.ts +1 -1
  386. package/lib/dist/installer/instructions-template.js +0 -37
  387. package/lib/dist/installer/instructions-template.js.map +1 -1
  388. package/lib/dist/installer/targets/antigravity.js +0 -113
  389. package/lib/dist/installer/targets/antigravity.js.map +1 -1
  390. package/lib/dist/installer/targets/bob.d.ts +20 -0
  391. package/lib/dist/installer/targets/bob.d.ts.map +1 -0
  392. package/lib/dist/installer/targets/bob.js +83 -0
  393. package/lib/dist/installer/targets/bob.js.map +1 -0
  394. package/lib/dist/installer/targets/claude.d.ts.map +1 -1
  395. package/lib/dist/installer/targets/claude.js +1 -185
  396. package/lib/dist/installer/targets/claude.js.map +1 -1
  397. package/lib/dist/installer/targets/codex.d.ts.map +1 -1
  398. package/lib/dist/installer/targets/codex.js +17 -109
  399. package/lib/dist/installer/targets/codex.js.map +1 -1
  400. package/lib/dist/installer/targets/copilot-cli.d.ts.map +1 -1
  401. package/lib/dist/installer/targets/copilot-cli.js +2 -54
  402. package/lib/dist/installer/targets/copilot-cli.js.map +1 -1
  403. package/lib/dist/installer/targets/copilot-jetbrains.js +0 -57
  404. package/lib/dist/installer/targets/copilot-jetbrains.js.map +1 -1
  405. package/lib/dist/installer/targets/copilot-vscode.js +0 -58
  406. package/lib/dist/installer/targets/copilot-vscode.js.map +1 -1
  407. package/lib/dist/installer/targets/cursor.js +7 -88
  408. package/lib/dist/installer/targets/cursor.js.map +1 -1
  409. package/lib/dist/installer/targets/droid.d.ts +18 -0
  410. package/lib/dist/installer/targets/droid.d.ts.map +1 -0
  411. package/lib/dist/installer/targets/droid.js +92 -0
  412. package/lib/dist/installer/targets/droid.js.map +1 -0
  413. package/lib/dist/installer/targets/dsh.d.ts +35 -0
  414. package/lib/dist/installer/targets/dsh.d.ts.map +1 -0
  415. package/lib/dist/installer/targets/dsh.js +267 -0
  416. package/lib/dist/installer/targets/dsh.js.map +1 -0
  417. package/lib/dist/installer/targets/gemini.js +0 -37
  418. package/lib/dist/installer/targets/gemini.js.map +1 -1
  419. package/lib/dist/installer/targets/grok.d.ts +25 -0
  420. package/lib/dist/installer/targets/grok.d.ts.map +1 -0
  421. package/lib/dist/installer/targets/grok.js +96 -0
  422. package/lib/dist/installer/targets/grok.js.map +1 -0
  423. package/lib/dist/installer/targets/hermes.d.ts +19 -7
  424. package/lib/dist/installer/targets/hermes.d.ts.map +1 -1
  425. package/lib/dist/installer/targets/hermes.js +218 -214
  426. package/lib/dist/installer/targets/hermes.js.map +1 -1
  427. package/lib/dist/installer/targets/json-config.d.ts +45 -0
  428. package/lib/dist/installer/targets/json-config.d.ts.map +1 -0
  429. package/lib/dist/installer/targets/json-config.js +128 -0
  430. package/lib/dist/installer/targets/json-config.js.map +1 -0
  431. package/lib/dist/installer/targets/kimi.d.ts +21 -0
  432. package/lib/dist/installer/targets/kimi.d.ts.map +1 -0
  433. package/lib/dist/installer/targets/kimi.js +97 -0
  434. package/lib/dist/installer/targets/kimi.js.map +1 -0
  435. package/lib/dist/installer/targets/kiro.js +1 -41
  436. package/lib/dist/installer/targets/kiro.js.map +1 -1
  437. package/lib/dist/installer/targets/opencode.js +0 -102
  438. package/lib/dist/installer/targets/opencode.js.map +1 -1
  439. package/lib/dist/installer/targets/pi.d.ts +24 -0
  440. package/lib/dist/installer/targets/pi.d.ts.map +1 -0
  441. package/lib/dist/installer/targets/pi.js +100 -0
  442. package/lib/dist/installer/targets/pi.js.map +1 -0
  443. package/lib/dist/installer/targets/qoder.d.ts +23 -0
  444. package/lib/dist/installer/targets/qoder.d.ts.map +1 -0
  445. package/lib/dist/installer/targets/qoder.js +83 -0
  446. package/lib/dist/installer/targets/qoder.js.map +1 -0
  447. package/lib/dist/installer/targets/qwen.d.ts +21 -0
  448. package/lib/dist/installer/targets/qwen.d.ts.map +1 -0
  449. package/lib/dist/installer/targets/qwen.js +115 -0
  450. package/lib/dist/installer/targets/qwen.js.map +1 -0
  451. package/lib/dist/installer/targets/registry.d.ts.map +1 -1
  452. package/lib/dist/installer/targets/registry.js +18 -25
  453. package/lib/dist/installer/targets/registry.js.map +1 -1
  454. package/lib/dist/installer/targets/shared.d.ts +81 -11
  455. package/lib/dist/installer/targets/shared.d.ts.map +1 -1
  456. package/lib/dist/installer/targets/shared.js +183 -129
  457. package/lib/dist/installer/targets/shared.js.map +1 -1
  458. package/lib/dist/installer/targets/toml.d.ts +82 -6
  459. package/lib/dist/installer/targets/toml.d.ts.map +1 -1
  460. package/lib/dist/installer/targets/toml.js +318 -112
  461. package/lib/dist/installer/targets/toml.js.map +1 -1
  462. package/lib/dist/installer/targets/types.d.ts +1 -1
  463. package/lib/dist/installer/targets/types.d.ts.map +1 -1
  464. package/lib/dist/installer/targets/types.js +0 -13
  465. package/lib/dist/installer/targets/types.js.map +1 -1
  466. package/lib/dist/installer/targets/windsurf.d.ts +22 -0
  467. package/lib/dist/installer/targets/windsurf.d.ts.map +1 -0
  468. package/lib/dist/installer/targets/windsurf.js +90 -0
  469. package/lib/dist/installer/targets/windsurf.js.map +1 -0
  470. package/lib/dist/lazy-engine.d.ts +22 -0
  471. package/lib/dist/lazy-engine.d.ts.map +1 -0
  472. package/lib/dist/lazy-engine.js +16 -0
  473. package/lib/dist/lazy-engine.js.map +1 -0
  474. package/lib/dist/mcp/answer-freshness.js +0 -6
  475. package/lib/dist/mcp/answer-freshness.js.map +1 -1
  476. package/lib/dist/mcp/daemon-manager.js +2 -23
  477. package/lib/dist/mcp/daemon-manager.js.map +1 -1
  478. package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
  479. package/lib/dist/mcp/daemon-paths.js +2 -79
  480. package/lib/dist/mcp/daemon-paths.js.map +1 -1
  481. package/lib/dist/mcp/daemon-registry.d.ts +44 -0
  482. package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
  483. package/lib/dist/mcp/daemon-registry.js +189 -118
  484. package/lib/dist/mcp/daemon-registry.js.map +1 -1
  485. package/lib/dist/mcp/daemon.d.ts +23 -0
  486. package/lib/dist/mcp/daemon.d.ts.map +1 -1
  487. package/lib/dist/mcp/daemon.js +89 -373
  488. package/lib/dist/mcp/daemon.js.map +1 -1
  489. package/lib/dist/mcp/dynamic-boundaries.js +4 -78
  490. package/lib/dist/mcp/dynamic-boundaries.js.map +1 -1
  491. package/lib/dist/mcp/early-ppid.js +0 -24
  492. package/lib/dist/mcp/early-ppid.js.map +1 -1
  493. package/lib/dist/mcp/engine.d.ts +10 -0
  494. package/lib/dist/mcp/engine.d.ts.map +1 -1
  495. package/lib/dist/mcp/engine.js +41 -152
  496. package/lib/dist/mcp/engine.js.map +1 -1
  497. package/lib/dist/mcp/explore-dedup.js +0 -108
  498. package/lib/dist/mcp/explore-dedup.js.map +1 -1
  499. package/lib/dist/mcp/explore-diagnostics.js +0 -116
  500. package/lib/dist/mcp/explore-diagnostics.js.map +1 -1
  501. package/lib/dist/mcp/explore-session-state.js +0 -129
  502. package/lib/dist/mcp/explore-session-state.js.map +1 -1
  503. package/lib/dist/mcp/index-freshness-worker.js +5 -4
  504. package/lib/dist/mcp/index-freshness-worker.js.map +1 -1
  505. package/lib/dist/mcp/index-freshness.d.ts +7 -1
  506. package/lib/dist/mcp/index-freshness.d.ts.map +1 -1
  507. package/lib/dist/mcp/index-freshness.js +20 -12
  508. package/lib/dist/mcp/index-freshness.js.map +1 -1
  509. package/lib/dist/mcp/index-version-warning.d.ts +21 -0
  510. package/lib/dist/mcp/index-version-warning.d.ts.map +1 -0
  511. package/lib/dist/mcp/index-version-warning.js +38 -0
  512. package/lib/dist/mcp/index-version-warning.js.map +1 -0
  513. package/lib/dist/mcp/index.d.ts +19 -1
  514. package/lib/dist/mcp/index.d.ts.map +1 -1
  515. package/lib/dist/mcp/index.js +118 -293
  516. package/lib/dist/mcp/index.js.map +1 -1
  517. package/lib/dist/mcp/liveness-watchdog.d.ts +13 -3
  518. package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
  519. package/lib/dist/mcp/liveness-watchdog.js +106 -121
  520. package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
  521. package/lib/dist/mcp/ppid-watchdog.js +0 -24
  522. package/lib/dist/mcp/ppid-watchdog.js.map +1 -1
  523. package/lib/dist/mcp/process-identity.d.ts +42 -0
  524. package/lib/dist/mcp/process-identity.d.ts.map +1 -0
  525. package/lib/dist/mcp/process-identity.js +130 -0
  526. package/lib/dist/mcp/process-identity.js.map +1 -0
  527. package/lib/dist/mcp/project-lifecycle.d.ts.map +1 -1
  528. package/lib/dist/mcp/project-lifecycle.js +55 -21
  529. package/lib/dist/mcp/project-lifecycle.js.map +1 -1
  530. package/lib/dist/mcp/proxy.d.ts +26 -8
  531. package/lib/dist/mcp/proxy.d.ts.map +1 -1
  532. package/lib/dist/mcp/proxy.js +209 -223
  533. package/lib/dist/mcp/proxy.js.map +1 -1
  534. package/lib/dist/mcp/query-pool.d.ts +58 -3
  535. package/lib/dist/mcp/query-pool.d.ts.map +1 -1
  536. package/lib/dist/mcp/query-pool.js +140 -100
  537. package/lib/dist/mcp/query-pool.js.map +1 -1
  538. package/lib/dist/mcp/query-worker.js +24 -36
  539. package/lib/dist/mcp/query-worker.js.map +1 -1
  540. package/lib/dist/mcp/server-instructions.js +0 -31
  541. package/lib/dist/mcp/server-instructions.js.map +1 -1
  542. package/lib/dist/mcp/session.d.ts +27 -0
  543. package/lib/dist/mcp/session.d.ts.map +1 -1
  544. package/lib/dist/mcp/session.js +29 -130
  545. package/lib/dist/mcp/session.js.map +1 -1
  546. package/lib/dist/mcp/startup-handshake.js +1 -48
  547. package/lib/dist/mcp/startup-handshake.js.map +1 -1
  548. package/lib/dist/mcp/stdin-teardown.js +0 -28
  549. package/lib/dist/mcp/stdin-teardown.js.map +1 -1
  550. package/lib/dist/mcp/stdout-teardown.d.ts +26 -0
  551. package/lib/dist/mcp/stdout-teardown.d.ts.map +1 -0
  552. package/lib/dist/mcp/stdout-teardown.js +20 -0
  553. package/lib/dist/mcp/stdout-teardown.js.map +1 -0
  554. package/lib/dist/mcp/tools.d.ts +159 -20
  555. package/lib/dist/mcp/tools.d.ts.map +1 -1
  556. package/lib/dist/mcp/tools.js +730 -3545
  557. package/lib/dist/mcp/tools.js.map +1 -1
  558. package/lib/dist/mcp/transport.d.ts.map +1 -1
  559. package/lib/dist/mcp/transport.js +4 -96
  560. package/lib/dist/mcp/transport.js.map +1 -1
  561. package/lib/dist/mcp/version.d.ts +13 -1
  562. package/lib/dist/mcp/version.d.ts.map +1 -1
  563. package/lib/dist/mcp/version.js +19 -21
  564. package/lib/dist/mcp/version.js.map +1 -1
  565. package/lib/dist/mcp/writer-lock.d.ts +11 -0
  566. package/lib/dist/mcp/writer-lock.d.ts.map +1 -1
  567. package/lib/dist/mcp/writer-lock.js +49 -46
  568. package/lib/dist/mcp/writer-lock.js.map +1 -1
  569. package/lib/dist/project-config.js +1 -138
  570. package/lib/dist/project-config.js.map +1 -1
  571. package/lib/dist/resolution/alias-binding.d.ts +7 -0
  572. package/lib/dist/resolution/alias-binding.d.ts.map +1 -1
  573. package/lib/dist/resolution/alias-binding.js +19 -52
  574. package/lib/dist/resolution/alias-binding.js.map +1 -1
  575. package/lib/dist/resolution/ambient-modules.d.ts +185 -0
  576. package/lib/dist/resolution/ambient-modules.d.ts.map +1 -0
  577. package/lib/dist/resolution/ambient-modules.js +732 -0
  578. package/lib/dist/resolution/ambient-modules.js.map +1 -0
  579. package/lib/dist/resolution/angular-template-synthesizer.d.ts +96 -0
  580. package/lib/dist/resolution/angular-template-synthesizer.d.ts.map +1 -0
  581. package/lib/dist/resolution/angular-template-synthesizer.js +695 -0
  582. package/lib/dist/resolution/angular-template-synthesizer.js.map +1 -0
  583. package/lib/dist/resolution/c-feature-variants.d.ts +40 -0
  584. package/lib/dist/resolution/c-feature-variants.d.ts.map +1 -0
  585. package/lib/dist/resolution/c-feature-variants.js +249 -0
  586. package/lib/dist/resolution/c-feature-variants.js.map +1 -0
  587. package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
  588. package/lib/dist/resolution/c-fnptr-synthesizer.js +23 -391
  589. package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
  590. package/lib/dist/resolution/c-macro-renames.d.ts +25 -0
  591. package/lib/dist/resolution/c-macro-renames.d.ts.map +1 -0
  592. package/lib/dist/resolution/c-macro-renames.js +95 -0
  593. package/lib/dist/resolution/c-macro-renames.js.map +1 -0
  594. package/lib/dist/resolution/callback-synthesizer.d.ts +15 -1
  595. package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
  596. package/lib/dist/resolution/callback-synthesizer.js +1487 -1234
  597. package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
  598. package/lib/dist/resolution/const-alias-synthesizer.d.ts +48 -0
  599. package/lib/dist/resolution/const-alias-synthesizer.d.ts.map +1 -0
  600. package/lib/dist/resolution/const-alias-synthesizer.js +234 -0
  601. package/lib/dist/resolution/const-alias-synthesizer.js.map +1 -0
  602. package/lib/dist/resolution/cooperative-yield.js +0 -27
  603. package/lib/dist/resolution/cooperative-yield.js.map +1 -1
  604. package/lib/dist/resolution/cpp-constructor.d.ts.map +1 -1
  605. package/lib/dist/resolution/cpp-constructor.js +15 -17
  606. package/lib/dist/resolution/cpp-constructor.js.map +1 -1
  607. package/lib/dist/resolution/cpp-includers.d.ts +46 -0
  608. package/lib/dist/resolution/cpp-includers.d.ts.map +1 -0
  609. package/lib/dist/resolution/cpp-includers.js +153 -0
  610. package/lib/dist/resolution/cpp-includers.js.map +1 -0
  611. package/lib/dist/resolution/cpp-macro-visibility.d.ts +16 -0
  612. package/lib/dist/resolution/cpp-macro-visibility.d.ts.map +1 -1
  613. package/lib/dist/resolution/cpp-macro-visibility.js +60 -61
  614. package/lib/dist/resolution/cpp-macro-visibility.js.map +1 -1
  615. package/lib/dist/resolution/cpp-namespaces.d.ts +54 -0
  616. package/lib/dist/resolution/cpp-namespaces.d.ts.map +1 -0
  617. package/lib/dist/resolution/cpp-namespaces.js +151 -0
  618. package/lib/dist/resolution/cpp-namespaces.js.map +1 -0
  619. package/lib/dist/resolution/cpp-raw-strings.d.ts +33 -0
  620. package/lib/dist/resolution/cpp-raw-strings.d.ts.map +1 -0
  621. package/lib/dist/resolution/cpp-raw-strings.js +167 -0
  622. package/lib/dist/resolution/cpp-raw-strings.js.map +1 -0
  623. package/lib/dist/resolution/cpp-supertypes.d.ts +118 -0
  624. package/lib/dist/resolution/cpp-supertypes.d.ts.map +1 -0
  625. package/lib/dist/resolution/cpp-supertypes.js +322 -0
  626. package/lib/dist/resolution/cpp-supertypes.js.map +1 -0
  627. package/lib/dist/resolution/cpp-template-instantiations.d.ts +83 -0
  628. package/lib/dist/resolution/cpp-template-instantiations.d.ts.map +1 -0
  629. package/lib/dist/resolution/cpp-template-instantiations.js +983 -0
  630. package/lib/dist/resolution/cpp-template-instantiations.js.map +1 -0
  631. package/lib/dist/resolution/cpp-type-aliases.d.ts +194 -0
  632. package/lib/dist/resolution/cpp-type-aliases.d.ts.map +1 -0
  633. package/lib/dist/resolution/cpp-type-aliases.js +648 -0
  634. package/lib/dist/resolution/cpp-type-aliases.js.map +1 -0
  635. package/lib/dist/resolution/dart-libraries.d.ts +75 -0
  636. package/lib/dist/resolution/dart-libraries.d.ts.map +1 -0
  637. package/lib/dist/resolution/dart-libraries.js +721 -0
  638. package/lib/dist/resolution/dart-libraries.js.map +1 -0
  639. package/lib/dist/resolution/dart-local-scope.d.ts +41 -0
  640. package/lib/dist/resolution/dart-local-scope.d.ts.map +1 -0
  641. package/lib/dist/resolution/dart-local-scope.js +565 -0
  642. package/lib/dist/resolution/dart-local-scope.js.map +1 -0
  643. package/lib/dist/resolution/expo-router-synthesizer.js +0 -52
  644. package/lib/dist/resolution/expo-router-synthesizer.js.map +1 -1
  645. package/lib/dist/resolution/frameworks/angular-router.d.ts +142 -0
  646. package/lib/dist/resolution/frameworks/angular-router.d.ts.map +1 -0
  647. package/lib/dist/resolution/frameworks/angular-router.js +959 -0
  648. package/lib/dist/resolution/frameworks/angular-router.js.map +1 -0
  649. package/lib/dist/resolution/frameworks/astro.d.ts.map +1 -1
  650. package/lib/dist/resolution/frameworks/astro.js +30 -60
  651. package/lib/dist/resolution/frameworks/astro.js.map +1 -1
  652. package/lib/dist/resolution/frameworks/cargo-workspace.d.ts +18 -1
  653. package/lib/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -1
  654. package/lib/dist/resolution/frameworks/cargo-workspace.js +65 -15
  655. package/lib/dist/resolution/frameworks/cargo-workspace.js.map +1 -1
  656. package/lib/dist/resolution/frameworks/cics.d.ts.map +1 -1
  657. package/lib/dist/resolution/frameworks/cics.js +7 -33
  658. package/lib/dist/resolution/frameworks/cics.js.map +1 -1
  659. package/lib/dist/resolution/frameworks/codeigniter.d.ts +23 -0
  660. package/lib/dist/resolution/frameworks/codeigniter.d.ts.map +1 -0
  661. package/lib/dist/resolution/frameworks/codeigniter.js +271 -0
  662. package/lib/dist/resolution/frameworks/codeigniter.js.map +1 -0
  663. package/lib/dist/resolution/frameworks/component-folder.d.ts +17 -0
  664. package/lib/dist/resolution/frameworks/component-folder.d.ts.map +1 -0
  665. package/lib/dist/resolution/frameworks/component-folder.js +11 -0
  666. package/lib/dist/resolution/frameworks/component-folder.js.map +1 -0
  667. package/lib/dist/resolution/frameworks/csharp.d.ts.map +1 -1
  668. package/lib/dist/resolution/frameworks/csharp.js +106 -101
  669. package/lib/dist/resolution/frameworks/csharp.js.map +1 -1
  670. package/lib/dist/resolution/frameworks/drupal.d.ts +17 -8
  671. package/lib/dist/resolution/frameworks/drupal.d.ts.map +1 -1
  672. package/lib/dist/resolution/frameworks/drupal.js +377 -142
  673. package/lib/dist/resolution/frameworks/drupal.js.map +1 -1
  674. package/lib/dist/resolution/frameworks/expo-modules.d.ts +10 -0
  675. package/lib/dist/resolution/frameworks/expo-modules.d.ts.map +1 -1
  676. package/lib/dist/resolution/frameworks/expo-modules.js +79 -65
  677. package/lib/dist/resolution/frameworks/expo-modules.js.map +1 -1
  678. package/lib/dist/resolution/frameworks/expo-router.d.ts +6 -0
  679. package/lib/dist/resolution/frameworks/expo-router.d.ts.map +1 -1
  680. package/lib/dist/resolution/frameworks/expo-router.js +64 -183
  681. package/lib/dist/resolution/frameworks/expo-router.js.map +1 -1
  682. package/lib/dist/resolution/frameworks/express.d.ts.map +1 -1
  683. package/lib/dist/resolution/frameworks/express.js +215 -173
  684. package/lib/dist/resolution/frameworks/express.js.map +1 -1
  685. package/lib/dist/resolution/frameworks/fabric.d.ts.map +1 -1
  686. package/lib/dist/resolution/frameworks/fabric.js +11 -112
  687. package/lib/dist/resolution/frameworks/fabric.js.map +1 -1
  688. package/lib/dist/resolution/frameworks/go.d.ts.map +1 -1
  689. package/lib/dist/resolution/frameworks/go.js +15 -61
  690. package/lib/dist/resolution/frameworks/go.js.map +1 -1
  691. package/lib/dist/resolution/frameworks/goframe.js +1 -55
  692. package/lib/dist/resolution/frameworks/goframe.js.map +1 -1
  693. package/lib/dist/resolution/frameworks/index.d.ts +16 -2
  694. package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
  695. package/lib/dist/resolution/frameworks/index.js +20 -48
  696. package/lib/dist/resolution/frameworks/index.js.map +1 -1
  697. package/lib/dist/resolution/frameworks/java.d.ts.map +1 -1
  698. package/lib/dist/resolution/frameworks/java.js +209 -147
  699. package/lib/dist/resolution/frameworks/java.js.map +1 -1
  700. package/lib/dist/resolution/frameworks/laravel.d.ts.map +1 -1
  701. package/lib/dist/resolution/frameworks/laravel.js +291 -71
  702. package/lib/dist/resolution/frameworks/laravel.js.map +1 -1
  703. package/lib/dist/resolution/frameworks/name-heuristic.d.ts +35 -0
  704. package/lib/dist/resolution/frameworks/name-heuristic.d.ts.map +1 -0
  705. package/lib/dist/resolution/frameworks/name-heuristic.js +33 -0
  706. package/lib/dist/resolution/frameworks/name-heuristic.js.map +1 -0
  707. package/lib/dist/resolution/frameworks/nestjs.d.ts.map +1 -1
  708. package/lib/dist/resolution/frameworks/nestjs.js +236 -192
  709. package/lib/dist/resolution/frameworks/nestjs.js.map +1 -1
  710. package/lib/dist/resolution/frameworks/next-proxy.d.ts +67 -0
  711. package/lib/dist/resolution/frameworks/next-proxy.d.ts.map +1 -0
  712. package/lib/dist/resolution/frameworks/next-proxy.js +239 -0
  713. package/lib/dist/resolution/frameworks/next-proxy.js.map +1 -0
  714. package/lib/dist/resolution/frameworks/nextjs.d.ts.map +1 -1
  715. package/lib/dist/resolution/frameworks/nextjs.js +11 -66
  716. package/lib/dist/resolution/frameworks/nextjs.js.map +1 -1
  717. package/lib/dist/resolution/frameworks/object-literal.js +0 -21
  718. package/lib/dist/resolution/frameworks/object-literal.js.map +1 -1
  719. package/lib/dist/resolution/frameworks/package-deps.d.ts +11 -7
  720. package/lib/dist/resolution/frameworks/package-deps.d.ts.map +1 -1
  721. package/lib/dist/resolution/frameworks/package-deps.js +35 -26
  722. package/lib/dist/resolution/frameworks/package-deps.js.map +1 -1
  723. package/lib/dist/resolution/frameworks/page-component.d.ts +20 -0
  724. package/lib/dist/resolution/frameworks/page-component.d.ts.map +1 -0
  725. package/lib/dist/resolution/frameworks/page-component.js +31 -0
  726. package/lib/dist/resolution/frameworks/page-component.js.map +1 -0
  727. package/lib/dist/resolution/frameworks/play.d.ts.map +1 -1
  728. package/lib/dist/resolution/frameworks/play.js +27 -33
  729. package/lib/dist/resolution/frameworks/play.js.map +1 -1
  730. package/lib/dist/resolution/frameworks/python.d.ts.map +1 -1
  731. package/lib/dist/resolution/frameworks/python.js +106 -116
  732. package/lib/dist/resolution/frameworks/python.js.map +1 -1
  733. package/lib/dist/resolution/frameworks/react-native.d.ts.map +1 -1
  734. package/lib/dist/resolution/frameworks/react-native.js +1 -166
  735. package/lib/dist/resolution/frameworks/react-native.js.map +1 -1
  736. package/lib/dist/resolution/frameworks/react-router.d.ts +17 -7
  737. package/lib/dist/resolution/frameworks/react-router.d.ts.map +1 -1
  738. package/lib/dist/resolution/frameworks/react-router.js +21 -79
  739. package/lib/dist/resolution/frameworks/react-router.js.map +1 -1
  740. package/lib/dist/resolution/frameworks/react.d.ts +68 -1
  741. package/lib/dist/resolution/frameworks/react.d.ts.map +1 -1
  742. package/lib/dist/resolution/frameworks/react.js +1721 -114
  743. package/lib/dist/resolution/frameworks/react.js.map +1 -1
  744. package/lib/dist/resolution/frameworks/ruby.d.ts.map +1 -1
  745. package/lib/dist/resolution/frameworks/ruby.js +152 -52
  746. package/lib/dist/resolution/frameworks/ruby.js.map +1 -1
  747. package/lib/dist/resolution/frameworks/rust.d.ts.map +1 -1
  748. package/lib/dist/resolution/frameworks/rust.js +51 -70
  749. package/lib/dist/resolution/frameworks/rust.js.map +1 -1
  750. package/lib/dist/resolution/frameworks/svelte.d.ts.map +1 -1
  751. package/lib/dist/resolution/frameworks/svelte.js +9 -74
  752. package/lib/dist/resolution/frameworks/svelte.js.map +1 -1
  753. package/lib/dist/resolution/frameworks/sveltekit-router.d.ts.map +1 -1
  754. package/lib/dist/resolution/frameworks/sveltekit-router.js +8 -46
  755. package/lib/dist/resolution/frameworks/sveltekit-router.js.map +1 -1
  756. package/lib/dist/resolution/frameworks/swift-objc.js +0 -97
  757. package/lib/dist/resolution/frameworks/swift-objc.js.map +1 -1
  758. package/lib/dist/resolution/frameworks/swift.d.ts.map +1 -1
  759. package/lib/dist/resolution/frameworks/swift.js +199 -167
  760. package/lib/dist/resolution/frameworks/swift.js.map +1 -1
  761. package/lib/dist/resolution/frameworks/tanstack-router.d.ts.map +1 -1
  762. package/lib/dist/resolution/frameworks/tanstack-router.js +9 -130
  763. package/lib/dist/resolution/frameworks/tanstack-router.js.map +1 -1
  764. package/lib/dist/resolution/frameworks/terraform.js +1 -85
  765. package/lib/dist/resolution/frameworks/terraform.js.map +1 -1
  766. package/lib/dist/resolution/frameworks/vue-router.d.ts +26 -10
  767. package/lib/dist/resolution/frameworks/vue-router.d.ts.map +1 -1
  768. package/lib/dist/resolution/frameworks/vue-router.js +147 -147
  769. package/lib/dist/resolution/frameworks/vue-router.js.map +1 -1
  770. package/lib/dist/resolution/frameworks/vue.d.ts +9 -2
  771. package/lib/dist/resolution/frameworks/vue.d.ts.map +1 -1
  772. package/lib/dist/resolution/frameworks/vue.js +69 -107
  773. package/lib/dist/resolution/frameworks/vue.js.map +1 -1
  774. package/lib/dist/resolution/go-func-field-synthesizer.d.ts +58 -0
  775. package/lib/dist/resolution/go-func-field-synthesizer.d.ts.map +1 -0
  776. package/lib/dist/resolution/go-func-field-synthesizer.js +696 -0
  777. package/lib/dist/resolution/go-func-field-synthesizer.js.map +1 -0
  778. package/lib/dist/resolution/go-module.d.ts +23 -7
  779. package/lib/dist/resolution/go-module.d.ts.map +1 -1
  780. package/lib/dist/resolution/go-module.js +21 -24
  781. package/lib/dist/resolution/go-module.js.map +1 -1
  782. package/lib/dist/resolution/go-stdlib-methods.d.ts +9 -0
  783. package/lib/dist/resolution/go-stdlib-methods.d.ts.map +1 -0
  784. package/lib/dist/resolution/go-stdlib-methods.js +224 -0
  785. package/lib/dist/resolution/go-stdlib-methods.js.map +1 -0
  786. package/lib/dist/resolution/goframe-synthesizer.js +2 -53
  787. package/lib/dist/resolution/goframe-synthesizer.js.map +1 -1
  788. package/lib/dist/resolution/import-resolver.d.ts +298 -23
  789. package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
  790. package/lib/dist/resolution/import-resolver.js +1802 -1280
  791. package/lib/dist/resolution/import-resolver.js.map +1 -1
  792. package/lib/dist/resolution/index.d.ts +449 -5
  793. package/lib/dist/resolution/index.d.ts.map +1 -1
  794. package/lib/dist/resolution/index.js +1477 -981
  795. package/lib/dist/resolution/index.js.map +1 -1
  796. package/lib/dist/resolution/js-builtins.d.ts +14 -0
  797. package/lib/dist/resolution/js-builtins.d.ts.map +1 -1
  798. package/lib/dist/resolution/js-builtins.js +15 -13
  799. package/lib/dist/resolution/js-builtins.js.map +1 -1
  800. package/lib/dist/resolution/js-class-expressions.d.ts +48 -0
  801. package/lib/dist/resolution/js-class-expressions.d.ts.map +1 -0
  802. package/lib/dist/resolution/js-class-expressions.js +25 -0
  803. package/lib/dist/resolution/js-class-expressions.js.map +1 -0
  804. package/lib/dist/resolution/js-super-calls.d.ts +18 -0
  805. package/lib/dist/resolution/js-super-calls.d.ts.map +1 -0
  806. package/lib/dist/resolution/js-super-calls.js +94 -0
  807. package/lib/dist/resolution/js-super-calls.js.map +1 -0
  808. package/lib/dist/resolution/jsx-code.d.ts +28 -0
  809. package/lib/dist/resolution/jsx-code.d.ts.map +1 -0
  810. package/lib/dist/resolution/jsx-code.js +459 -0
  811. package/lib/dist/resolution/jsx-code.js.map +1 -0
  812. package/lib/dist/resolution/lru-cache.d.ts +5 -13
  813. package/lib/dist/resolution/lru-cache.d.ts.map +1 -1
  814. package/lib/dist/resolution/lru-cache.js +43 -32
  815. package/lib/dist/resolution/lru-cache.js.map +1 -1
  816. package/lib/dist/resolution/memory-budget.js +0 -52
  817. package/lib/dist/resolution/memory-budget.js.map +1 -1
  818. package/lib/dist/resolution/module-importers.d.ts +185 -0
  819. package/lib/dist/resolution/module-importers.d.ts.map +1 -0
  820. package/lib/dist/resolution/module-importers.js +588 -0
  821. package/lib/dist/resolution/module-importers.js.map +1 -0
  822. package/lib/dist/resolution/name-matcher.d.ts +891 -8
  823. package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
  824. package/lib/dist/resolution/name-matcher.js +25013 -2928
  825. package/lib/dist/resolution/name-matcher.js.map +1 -1
  826. package/lib/dist/resolution/next-router-synthesizer.d.ts +19 -0
  827. package/lib/dist/resolution/next-router-synthesizer.d.ts.map +1 -1
  828. package/lib/dist/resolution/next-router-synthesizer.js +46 -28
  829. package/lib/dist/resolution/next-router-synthesizer.js.map +1 -1
  830. package/lib/dist/resolution/override-parameters.d.ts +40 -0
  831. package/lib/dist/resolution/override-parameters.d.ts.map +1 -0
  832. package/lib/dist/resolution/override-parameters.js +339 -0
  833. package/lib/dist/resolution/override-parameters.js.map +1 -0
  834. package/lib/dist/resolution/parameter-flow.d.ts +218 -0
  835. package/lib/dist/resolution/parameter-flow.d.ts.map +1 -0
  836. package/lib/dist/resolution/parameter-flow.js +474 -0
  837. package/lib/dist/resolution/parameter-flow.js.map +1 -0
  838. package/lib/dist/resolution/pascal-scope.d.ts +91 -0
  839. package/lib/dist/resolution/pascal-scope.d.ts.map +1 -0
  840. package/lib/dist/resolution/pascal-scope.js +961 -0
  841. package/lib/dist/resolution/pascal-scope.js.map +1 -0
  842. package/lib/dist/resolution/path-aliases.d.ts +32 -4
  843. package/lib/dist/resolution/path-aliases.d.ts.map +1 -1
  844. package/lib/dist/resolution/path-aliases.js +43 -110
  845. package/lib/dist/resolution/path-aliases.js.map +1 -1
  846. package/lib/dist/resolution/project-scans.d.ts +38 -0
  847. package/lib/dist/resolution/project-scans.d.ts.map +1 -0
  848. package/lib/dist/resolution/project-scans.js +30 -0
  849. package/lib/dist/resolution/project-scans.js.map +1 -0
  850. package/lib/dist/resolution/react-router-synthesizer.d.ts +2 -0
  851. package/lib/dist/resolution/react-router-synthesizer.d.ts.map +1 -1
  852. package/lib/dist/resolution/react-router-synthesizer.js +67 -48
  853. package/lib/dist/resolution/react-router-synthesizer.js.map +1 -1
  854. package/lib/dist/resolution/resolver-pool.d.ts +43 -3
  855. package/lib/dist/resolution/resolver-pool.d.ts.map +1 -1
  856. package/lib/dist/resolution/resolver-pool.js +55 -97
  857. package/lib/dist/resolution/resolver-pool.js.map +1 -1
  858. package/lib/dist/resolution/resolver-worker.d.ts +1 -1
  859. package/lib/dist/resolution/resolver-worker.d.ts.map +1 -1
  860. package/lib/dist/resolution/resolver-worker.js +10 -36
  861. package/lib/dist/resolution/resolver-worker.js.map +1 -1
  862. package/lib/dist/resolution/resurrect-ref.d.ts +25 -0
  863. package/lib/dist/resolution/resurrect-ref.d.ts.map +1 -0
  864. package/lib/dist/resolution/resurrect-ref.js +19 -0
  865. package/lib/dist/resolution/resurrect-ref.js.map +1 -0
  866. package/lib/dist/resolution/ruby-constant-paths.d.ts +56 -0
  867. package/lib/dist/resolution/ruby-constant-paths.d.ts.map +1 -0
  868. package/lib/dist/resolution/ruby-constant-paths.js +255 -0
  869. package/lib/dist/resolution/ruby-constant-paths.js.map +1 -0
  870. package/lib/dist/resolution/ruby-parameter-flow.d.ts +10 -0
  871. package/lib/dist/resolution/ruby-parameter-flow.d.ts.map +1 -0
  872. package/lib/dist/resolution/ruby-parameter-flow.js +801 -0
  873. package/lib/dist/resolution/ruby-parameter-flow.js.map +1 -0
  874. package/lib/dist/resolution/rust-scopes.d.ts +120 -0
  875. package/lib/dist/resolution/rust-scopes.d.ts.map +1 -0
  876. package/lib/dist/resolution/rust-scopes.js +730 -0
  877. package/lib/dist/resolution/rust-scopes.js.map +1 -0
  878. package/lib/dist/resolution/shopify-themes.d.ts +10 -0
  879. package/lib/dist/resolution/shopify-themes.d.ts.map +1 -0
  880. package/lib/dist/resolution/shopify-themes.js +19 -0
  881. package/lib/dist/resolution/shopify-themes.js.map +1 -0
  882. package/lib/dist/resolution/strip-comments.d.ts +20 -1
  883. package/lib/dist/resolution/strip-comments.d.ts.map +1 -1
  884. package/lib/dist/resolution/strip-comments.js +164 -119
  885. package/lib/dist/resolution/strip-comments.js.map +1 -1
  886. package/lib/dist/resolution/sveltekit-synthesizer.js +0 -64
  887. package/lib/dist/resolution/sveltekit-synthesizer.js.map +1 -1
  888. package/lib/dist/resolution/swift-objc-bridge.js +0 -160
  889. package/lib/dist/resolution/swift-objc-bridge.js.map +1 -1
  890. package/lib/dist/resolution/swift-type-visibility.d.ts +68 -0
  891. package/lib/dist/resolution/swift-type-visibility.d.ts.map +1 -0
  892. package/lib/dist/resolution/swift-type-visibility.js +355 -0
  893. package/lib/dist/resolution/swift-type-visibility.js.map +1 -0
  894. package/lib/dist/resolution/synth-utils.js +1 -22
  895. package/lib/dist/resolution/synth-utils.js.map +1 -1
  896. package/lib/dist/resolution/tanstack-router-synthesizer.js +0 -32
  897. package/lib/dist/resolution/tanstack-router-synthesizer.js.map +1 -1
  898. package/lib/dist/resolution/tauri-synthesizer.d.ts +37 -0
  899. package/lib/dist/resolution/tauri-synthesizer.d.ts.map +1 -0
  900. package/lib/dist/resolution/tauri-synthesizer.js +1038 -0
  901. package/lib/dist/resolution/tauri-synthesizer.js.map +1 -0
  902. package/lib/dist/resolution/tier-synthesizer.d.ts +7 -2
  903. package/lib/dist/resolution/tier-synthesizer.d.ts.map +1 -1
  904. package/lib/dist/resolution/tier-synthesizer.js +318 -121
  905. package/lib/dist/resolution/tier-synthesizer.js.map +1 -1
  906. package/lib/dist/resolution/type-parameters.d.ts +34 -0
  907. package/lib/dist/resolution/type-parameters.d.ts.map +1 -0
  908. package/lib/dist/resolution/type-parameters.js +285 -0
  909. package/lib/dist/resolution/type-parameters.js.map +1 -0
  910. package/lib/dist/resolution/types.d.ts +209 -10
  911. package/lib/dist/resolution/types.d.ts.map +1 -1
  912. package/lib/dist/resolution/types.js +0 -47
  913. package/lib/dist/resolution/types.js.map +1 -1
  914. package/lib/dist/resolution/vbnet-receivers.d.ts +92 -0
  915. package/lib/dist/resolution/vbnet-receivers.d.ts.map +1 -0
  916. package/lib/dist/resolution/vbnet-receivers.js +1482 -0
  917. package/lib/dist/resolution/vbnet-receivers.js.map +1 -0
  918. package/lib/dist/resolution/vue-router-synthesizer.js +0 -31
  919. package/lib/dist/resolution/vue-router-synthesizer.js.map +1 -1
  920. package/lib/dist/resolution/workspace-packages.d.ts +206 -15
  921. package/lib/dist/resolution/workspace-packages.d.ts.map +1 -1
  922. package/lib/dist/resolution/workspace-packages.js +570 -152
  923. package/lib/dist/resolution/workspace-packages.js.map +1 -1
  924. package/lib/dist/search/identifier-segments.js +2 -93
  925. package/lib/dist/search/identifier-segments.js.map +1 -1
  926. package/lib/dist/search/query-parser.js +0 -54
  927. package/lib/dist/search/query-parser.js.map +1 -1
  928. package/lib/dist/search/query-paths.js +0 -167
  929. package/lib/dist/search/query-paths.js.map +1 -1
  930. package/lib/dist/search/query-utils.d.ts +44 -0
  931. package/lib/dist/search/query-utils.d.ts.map +1 -1
  932. package/lib/dist/search/query-utils.js +120 -198
  933. package/lib/dist/search/query-utils.js.map +1 -1
  934. package/lib/dist/sync/git-hooks.d.ts +14 -5
  935. package/lib/dist/sync/git-hooks.d.ts.map +1 -1
  936. package/lib/dist/sync/git-hooks.js +118 -65
  937. package/lib/dist/sync/git-hooks.js.map +1 -1
  938. package/lib/dist/sync/index.js +0 -14
  939. package/lib/dist/sync/index.js.map +1 -1
  940. package/lib/dist/sync/watch-policy.js +0 -45
  941. package/lib/dist/sync/watch-policy.js.map +1 -1
  942. package/lib/dist/sync/watcher.d.ts +29 -11
  943. package/lib/dist/sync/watcher.d.ts.map +1 -1
  944. package/lib/dist/sync/watcher.js +83 -487
  945. package/lib/dist/sync/watcher.js.map +1 -1
  946. package/lib/dist/sync/worktree.d.ts +29 -2
  947. package/lib/dist/sync/worktree.d.ts.map +1 -1
  948. package/lib/dist/sync/worktree.js +59 -78
  949. package/lib/dist/sync/worktree.js.map +1 -1
  950. package/lib/dist/telemetry/index.d.ts.map +1 -1
  951. package/lib/dist/telemetry/index.js +68 -146
  952. package/lib/dist/telemetry/index.js.map +1 -1
  953. package/lib/dist/types.d.ts +46 -0
  954. package/lib/dist/types.d.ts.map +1 -1
  955. package/lib/dist/types.js +15 -44
  956. package/lib/dist/types.js.map +1 -1
  957. package/lib/dist/ui/color.js +0 -19
  958. package/lib/dist/ui/color.js.map +1 -1
  959. package/lib/dist/ui/glyphs.js +2 -45
  960. package/lib/dist/ui/glyphs.js.map +1 -1
  961. package/lib/dist/ui/shimmer-progress.js +0 -21
  962. package/lib/dist/ui/shimmer-progress.js.map +1 -1
  963. package/lib/dist/ui/shimmer-worker.js +0 -22
  964. package/lib/dist/ui/shimmer-worker.js.map +1 -1
  965. package/lib/dist/ui-server/api/deadcode.d.ts.map +1 -1
  966. package/lib/dist/ui-server/api/deadcode.js +2 -31
  967. package/lib/dist/ui-server/api/deadcode.js.map +1 -1
  968. package/lib/dist/ui-server/api/effects.d.ts +7 -0
  969. package/lib/dist/ui-server/api/effects.d.ts.map +1 -1
  970. package/lib/dist/ui-server/api/effects.js +20 -103
  971. package/lib/dist/ui-server/api/effects.js.map +1 -1
  972. package/lib/dist/ui-server/api/entrypoints.d.ts +6 -0
  973. package/lib/dist/ui-server/api/entrypoints.d.ts.map +1 -1
  974. package/lib/dist/ui-server/api/entrypoints.js +73 -130
  975. package/lib/dist/ui-server/api/entrypoints.js.map +1 -1
  976. package/lib/dist/ui-server/api/events.js +0 -145
  977. package/lib/dist/ui-server/api/events.js.map +1 -1
  978. package/lib/dist/ui-server/api/file.js +0 -80
  979. package/lib/dist/ui-server/api/file.js.map +1 -1
  980. package/lib/dist/ui-server/api/filecode.js +0 -95
  981. package/lib/dist/ui-server/api/filecode.js.map +1 -1
  982. package/lib/dist/ui-server/api/flow.js +0 -149
  983. package/lib/dist/ui-server/api/flow.js.map +1 -1
  984. package/lib/dist/ui-server/api/hierarchy.js +0 -28
  985. package/lib/dist/ui-server/api/hierarchy.js.map +1 -1
  986. package/lib/dist/ui-server/api/index.js +0 -88
  987. package/lib/dist/ui-server/api/index.js.map +1 -1
  988. package/lib/dist/ui-server/api/map.d.ts +41 -6
  989. package/lib/dist/ui-server/api/map.d.ts.map +1 -1
  990. package/lib/dist/ui-server/api/map.js +95 -308
  991. package/lib/dist/ui-server/api/map.js.map +1 -1
  992. package/lib/dist/ui-server/api/node.d.ts.map +1 -1
  993. package/lib/dist/ui-server/api/node.js +4 -109
  994. package/lib/dist/ui-server/api/node.js.map +1 -1
  995. package/lib/dist/ui-server/api/nodes.js +0 -16
  996. package/lib/dist/ui-server/api/nodes.js.map +1 -1
  997. package/lib/dist/ui-server/api/program.js +0 -90
  998. package/lib/dist/ui-server/api/program.js.map +1 -1
  999. package/lib/dist/ui-server/api/respond.js +0 -60
  1000. package/lib/dist/ui-server/api/respond.js.map +1 -1
  1001. package/lib/dist/ui-server/api/route-roots.d.ts +6 -0
  1002. package/lib/dist/ui-server/api/route-roots.d.ts.map +1 -1
  1003. package/lib/dist/ui-server/api/route-roots.js +18 -39
  1004. package/lib/dist/ui-server/api/route-roots.js.map +1 -1
  1005. package/lib/dist/ui-server/api/routes.d.ts +2 -0
  1006. package/lib/dist/ui-server/api/routes.d.ts.map +1 -1
  1007. package/lib/dist/ui-server/api/routes.js +47 -47
  1008. package/lib/dist/ui-server/api/routes.js.map +1 -1
  1009. package/lib/dist/ui-server/api/screens.d.ts.map +1 -1
  1010. package/lib/dist/ui-server/api/screens.js +16 -171
  1011. package/lib/dist/ui-server/api/screens.js.map +1 -1
  1012. package/lib/dist/ui-server/api/search.js +0 -62
  1013. package/lib/dist/ui-server/api/search.js.map +1 -1
  1014. package/lib/dist/ui-server/api/session.js +0 -58
  1015. package/lib/dist/ui-server/api/session.js.map +1 -1
  1016. package/lib/dist/ui-server/api/source.d.ts.map +1 -1
  1017. package/lib/dist/ui-server/api/source.js +0 -161
  1018. package/lib/dist/ui-server/api/source.js.map +1 -1
  1019. package/lib/dist/ui-server/api/stats.js +0 -58
  1020. package/lib/dist/ui-server/api/stats.js.map +1 -1
  1021. package/lib/dist/ui-server/api/steps.d.ts.map +1 -1
  1022. package/lib/dist/ui-server/api/steps.js +105 -373
  1023. package/lib/dist/ui-server/api/steps.js.map +1 -1
  1024. package/lib/dist/ui-server/api/trail-store.d.ts +3 -3
  1025. package/lib/dist/ui-server/api/trail-store.d.ts.map +1 -1
  1026. package/lib/dist/ui-server/api/trail-store.js +24 -106
  1027. package/lib/dist/ui-server/api/trail-store.js.map +1 -1
  1028. package/lib/dist/ui-server/api/trails.d.ts.map +1 -1
  1029. package/lib/dist/ui-server/api/trails.js +20 -94
  1030. package/lib/dist/ui-server/api/trails.js.map +1 -1
  1031. package/lib/dist/ui-server/api/when.d.ts +10 -2
  1032. package/lib/dist/ui-server/api/when.d.ts.map +1 -1
  1033. package/lib/dist/ui-server/api/when.js +32 -44
  1034. package/lib/dist/ui-server/api/when.js.map +1 -1
  1035. package/lib/dist/ui-server/api/wire.js +0 -58
  1036. package/lib/dist/ui-server/api/wire.js.map +1 -1
  1037. package/lib/dist/ui-server/assets.js +0 -35
  1038. package/lib/dist/ui-server/assets.js.map +1 -1
  1039. package/lib/dist/ui-server/constants.js +0 -26
  1040. package/lib/dist/ui-server/constants.js.map +1 -1
  1041. package/lib/dist/ui-server/highlight/bounded-tokenize.d.ts +28 -0
  1042. package/lib/dist/ui-server/highlight/bounded-tokenize.d.ts.map +1 -0
  1043. package/lib/dist/ui-server/highlight/bounded-tokenize.js +114 -0
  1044. package/lib/dist/ui-server/highlight/bounded-tokenize.js.map +1 -0
  1045. package/lib/dist/ui-server/highlight/index.d.ts.map +1 -1
  1046. package/lib/dist/ui-server/highlight/index.js +7 -133
  1047. package/lib/dist/ui-server/highlight/index.js.map +1 -1
  1048. package/lib/dist/ui-server/highlight/languages.d.ts +3 -3
  1049. package/lib/dist/ui-server/highlight/languages.js +0 -31
  1050. package/lib/dist/ui-server/highlight/languages.js.map +1 -1
  1051. package/lib/dist/ui-server/highlight/tokenize-worker.d.ts +7 -0
  1052. package/lib/dist/ui-server/highlight/tokenize-worker.d.ts.map +1 -0
  1053. package/lib/dist/ui-server/highlight/tokenize-worker.js +15 -0
  1054. package/lib/dist/ui-server/highlight/tokenize-worker.js.map +1 -0
  1055. package/lib/dist/ui-server/index.d.ts +25 -0
  1056. package/lib/dist/ui-server/index.d.ts.map +1 -1
  1057. package/lib/dist/ui-server/index.js +35 -103
  1058. package/lib/dist/ui-server/index.js.map +1 -1
  1059. package/lib/dist/ui-server/open-browser.js +0 -34
  1060. package/lib/dist/ui-server/open-browser.js.map +1 -1
  1061. package/lib/dist/ui-server/security.d.ts +5 -0
  1062. package/lib/dist/ui-server/security.d.ts.map +1 -1
  1063. package/lib/dist/ui-server/security.js +11 -147
  1064. package/lib/dist/ui-server/security.js.map +1 -1
  1065. package/lib/dist/ui-server/static.js +0 -41
  1066. package/lib/dist/ui-server/static.js.map +1 -1
  1067. package/lib/dist/upgrade/index.d.ts +61 -10
  1068. package/lib/dist/upgrade/index.d.ts.map +1 -1
  1069. package/lib/dist/upgrade/index.js +191 -225
  1070. package/lib/dist/upgrade/index.js.map +1 -1
  1071. package/lib/dist/upgrade/remove-binary.js +2 -67
  1072. package/lib/dist/upgrade/remove-binary.js.map +1 -1
  1073. package/lib/dist/upgrade/update-check.js +1 -81
  1074. package/lib/dist/upgrade/update-check.js.map +1 -1
  1075. package/lib/dist/utils.d.ts +69 -1
  1076. package/lib/dist/utils.d.ts.map +1 -1
  1077. package/lib/dist/utils.js +224 -266
  1078. package/lib/dist/utils.js.map +1 -1
  1079. package/lib/dist/viewer/assets/{index-D4S7YUPf.js → index-BSGpxBr9.js} +60 -58
  1080. package/lib/dist/viewer/index.html +1 -1
  1081. package/lib/dist/worker-teardown.d.ts +48 -0
  1082. package/lib/dist/worker-teardown.d.ts.map +1 -0
  1083. package/lib/dist/worker-teardown.js +53 -0
  1084. package/lib/dist/worker-teardown.js.map +1 -0
  1085. package/lib/kernel/codegraph-kernel.node +2 -2
  1086. package/lib/node_modules/.package-lock.json +4 -4
  1087. package/lib/node_modules/ignore/README.md +138 -8
  1088. package/lib/node_modules/ignore/index.d.ts +56 -20
  1089. package/lib/node_modules/ignore/index.js +1033 -221
  1090. package/lib/node_modules/ignore/legacy.js +871 -178
  1091. package/lib/node_modules/ignore/package.json +10 -4
  1092. package/lib/package.json +14 -8
  1093. package/node.exe +2 -2
  1094. package/package.json +1 -1
@@ -1,79 +1,63 @@
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");
23
+ const angular_template_synthesizer_1 = require("./angular-template-synthesizer");
15
24
  const sveltekit_synthesizer_1 = require("./sveltekit-synthesizer");
16
25
  const cooperative_yield_1 = require("./cooperative-yield");
17
26
  const tier_synthesizer_1 = require("./tier-synthesizer");
27
+ const tauri_synthesizer_1 = require("./tauri-synthesizer");
18
28
  const synth_utils_1 = require("./synth-utils");
19
29
  const import_resolver_1 = require("./import-resolver");
20
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");
21
36
  const REGISTRAR_NAME = /^(on[A-Z]\w*|subscribe|addListener|addEventListener|register|watch|listen|addCallback)$/;
22
37
  const DISPATCHER_NAME = /(emit|trigger|notify|dispatch|fire|publish|flush)/i;
23
38
  const MAX_CALLBACKS_PER_CHANNEL = 40;
24
- const EVENT_FANOUT_CAP = 6; // skip events with more handlers/dispatchers than this (too generic without type info)
39
+ const EVENT_FANOUT_CAP = 6;
25
40
  const ON_RE = /\.(?:on|once|addListener)\(\s*['"]([^'"]+)['"]\s*,\s*(?:function\s+(\w+)|(?:this\.)?(\w+))/g;
26
41
  const EMIT_RE = /\.(?:emit|fire|dispatchEvent)\(\s*['"]([^'"]+)['"]/g;
27
42
  const SETSTATE_RE = /this\.setState\s*\(/;
28
- const FLUTTER_SETSTATE_RE = /\bsetState\s*\(/; // Flutter: setState((){…}) / this.setState
43
+ const FLUTTER_SETSTATE_RE = /\bsetState\s*\(/;
29
44
  const JS_FAMILY = ['typescript', 'javascript', 'tsx', 'jsx'];
30
- 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;
31
47
  const MAX_JSX_CHILDREN = 30;
32
- // Vue SFC templates: kebab-case child components (<el-button> → ElButton) and
33
- // event bindings (@click="fn" / v-on:click="fn"). PascalCase children (<VPNav/>)
34
- // 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]/;
35
49
  const VUE_KEBAB_RE = /<([a-z][a-z0-9]*(?:-[a-z0-9]+)+)[\s/>]/g;
36
- // PascalCase component tags — `<MediaCard ...>`, `<NavBar/>`. HTML elements are
37
- // lowercase, so an uppercase-initial tag is a component usage; built-ins
38
- // (`<NuxtLink>`, `<Transition>`) simply resolve to nothing and emit no edge.
39
50
  const VUE_PASCAL_RE = /<([A-Z][A-Za-z0-9]*)[\s/>]/g;
40
51
  const VUE_HANDLER_RE = /(?:@|v-on:)([a-zA-Z][\w-]*)(?:\.[\w]+)*\s*=\s*"([^"]+)"/g;
41
- // Composable/hook destructure: `const { close: closeSidebar } = useSidebarControl()`.
42
- // Captures the destructure body + the called composable; only `use*` calls qualify.
43
52
  const VUE_DESTRUCTURE_RE = /(?:const|let|var)\s*\{([^}]+)\}\s*=\s*(\w+)\s*\(/g;
44
- // Closure-collection dynamic dispatch (language-agnostic, Swift-first). A method
45
- // appends a closure to a collection property; another method iterates that
46
- // property *invoking each element* (`coll.forEach { $0() }` / `{ it() }`). The
47
- // element-invoke (`$0(` / `it(`) PROVES the collection holds closures, so pairing
48
- // a dispatcher to same-named registrars (`.append`/`.add`/`.push`/`.insert`,
49
- // incl. Swift `prop.write { $0.append }`) is high-precision. Cross-file/class by
50
- // design: Alamofire appends in `DataRequest.validate` but iterates in the base
51
- // `Request.didCompleteTask` — neither same-file nor same-class pairing reaches it.
52
53
  const CC_DISPATCH_RE = /(\w+)\.forEach\s*\{\s*(?:\$0|it)\s*\(/g;
53
54
  const CC_APPEND_WRITE_RE = /(\w+)\.write\s*\{\s*\$0(?:\.(\w+))?\.(?:append|add|push|insert)\s*\(/g;
54
55
  const CC_APPEND_DIRECT_RE = /(\w+)\.(?:append|add|push|insert)\s*\(/g;
55
- const CC_FANOUT_CAP = 8; // skip a field name with more dispatchers/registrars than this (too generic to pair confidently)
56
- // The dispatcher gate — `{ $0( ` / `{ it( ` element-invocation — is Swift/Kotlin
57
- // trailing-closure syntax, so ONLY those languages can ever contribute a
58
- // dispatcher, and a cross-language registrar pairing (a JS `.push(` against a
59
- // Swift dispatcher's field name) would be a wrong edge, not a missed one.
60
- // Gating both sides here isn't just precision: `.push(`/`.add(` is everywhere
61
- // in JS/PHP, so an ungated scan slices + regexes nearly every function on repos
62
- // where the pass cannot emit a single edge — on a 12k-file PHP/JS app that was
63
- // 20+ minutes of the "Resolving refs" tail and a #850 watchdog kill (#1235).
56
+ const CC_FANOUT_CAP = 8;
64
57
  const CC_LANGUAGES = new Set(['swift', 'kotlin']);
65
58
  function kebabToPascal(s) {
66
59
  return s.split('-').map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join('');
67
60
  }
68
- /**
69
- * Nuxt auto-import name for a component, derived from its path UNDER `components/`:
70
- * `components/media/Card.vue` → `MediaCard`, `components/base/foo/Bar.vue` →
71
- * `BaseFooBar`. Each directory segment and the filename is PascalCased and
72
- * concatenated; a directory whose PascalCase name prefixes the next segment is
73
- * collapsed (Nuxt's de-dup: `base/BaseButton.vue` → `BaseButton`, not
74
- * `BaseBaseButton`). Returns null for a flat component (`components/NavBar.vue`)
75
- * — its node is already named by basename, so a direct tag match finds it.
76
- */
77
61
  function nuxtComponentName(filePath) {
78
62
  const marker = filePath.lastIndexOf('components/');
79
63
  if (marker === -1)
@@ -92,10 +76,31 @@ function nuxtComponentName(filePath) {
92
76
  }
93
77
  return out.join('');
94
78
  }
79
+ let sliceLinesSource = null;
80
+ let sliceLinesSplit = [];
95
81
  function sliceLines(content, startLine, endLine) {
96
82
  if (!startLine || !endLine)
97
83
  return null;
98
- 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;
99
104
  }
100
105
  function registrarField(src) {
101
106
  const m = src.match(/this\.(\w+)\.(?:add|push|set)\(/);
@@ -110,24 +115,17 @@ function dispatcherField(src) {
110
115
  return forEach[1];
111
116
  return null;
112
117
  }
113
- /**
114
- * Stream method + function nodes lazily. The synthesizers only scan-and-filter
115
- * down to a tiny matched subset, so materializing every function/method (which
116
- * is gigabytes on a symbol-dense project) just to iterate it once is what OOM'd
117
- * #610. Iterating keeps memory O(1) in the node count.
118
- */
119
118
  function* methodAndFunctionNodes(queries) {
120
119
  yield* queries.iterateNodesByKind('method');
121
120
  yield* queries.iterateNodesByKind('function');
122
121
  }
123
- /** Phase 1: field-backed observer channels (registrar/dispatcher share a store). */
124
122
  async function fieldChannelEdges(queries, ctx, onYield) {
125
123
  const registrars = [];
126
124
  const dispatchers = [];
127
125
  let scanned = 0;
128
126
  for (const m of methodAndFunctionNodes(queries)) {
129
127
  if ((++scanned & 255) === 0)
130
- await onYield(); // #1091: yield mid-scan on huge graphs
128
+ await onYield();
131
129
  const isReg = REGISTRAR_NAME.test(m.name);
132
130
  const isDisp = DISPATCHER_NAME.test(m.name);
133
131
  if (!isReg && !isDisp)
@@ -153,7 +151,7 @@ async function fieldChannelEdges(queries, ctx, onYield) {
153
151
  const chDispatchers = dispatchers.filter((d) => d.node.filePath === reg.node.filePath && d.field === reg.field);
154
152
  if (chDispatchers.length === 0)
155
153
  continue;
156
- 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*(?=[,)])`);
157
155
  let added = 0;
158
156
  for (const e of queries.getIncomingEdges(reg.node.id, ['calls'])) {
159
157
  if (added >= MAX_CALLBACKS_PER_CHANNEL)
@@ -167,8 +165,6 @@ async function fieldChannelEdges(queries, ctx, onYield) {
167
165
  const am = line?.match(argRe);
168
166
  if (!am)
169
167
  continue;
170
- // Reuse the resolved value at this registration site: it retains the
171
- // receiver's class/inheritance and import binding, unlike a name lookup.
172
168
  const refs = queries.getOutgoingEdges(caller.id, ['references']).filter((r) => r.line === e.line && r.metadata?.fnRef === true && r.metadata.refName === am[1]);
173
169
  if (refs.length !== 1)
174
170
  continue;
@@ -189,9 +185,6 @@ async function fieldChannelEdges(queries, ctx, onYield) {
189
185
  provenance: 'heuristic',
190
186
  metadata: {
191
187
  synthesizedBy: 'callback', via: reg.node.name, field: reg.field,
192
- // Where the callback was wired up (`scene.onUpdate(this.triggerRender)`).
193
- // This is the #1 thing an agent reads/greps to explain the flow — surface
194
- // it so node/trace/context can show it without a callers() + Read round-trip.
195
188
  registeredAt: `${caller.filePath}:${e.line}`,
196
189
  },
197
190
  });
@@ -201,36 +194,17 @@ async function fieldChannelEdges(queries, ctx, onYield) {
201
194
  }
202
195
  return edges;
203
196
  }
204
- /**
205
- * Closure-collection dispatch: dispatcher iterates a closure-collection property
206
- * invoking each element; registrar appends a closure to the same-named property.
207
- * Emits dispatcher → registrar so a flow reaches the registration site (where the
208
- * appended closure's body — and its callers — live). High-precision: the
209
- * dispatcher's element-invoke is the gate (a `.forEach` that does NOT invoke its
210
- * element is ignored), so a repo with no closure-collection dispatch yields zero
211
- * edges regardless of how many `.append`/`.push` sites it has.
212
- *
213
- * Pairs globally by field name (cross-file/class is required — see Alamofire's
214
- * base-class `Request.didCompleteTask` iterating `validators` appended by the
215
- * subclass `DataRequest.validate`), bounded by a fan-out cap so a generic field
216
- * name shared across unrelated classes can't fan out into noise.
217
- */
218
197
  async function closureCollectionEdges(queries, ctx, onYield) {
219
- const dispatchers = new Map(); // field → dispatcher methods + forEach line
220
- const registrars = new Map(); // field → registrar methods + append line
198
+ const dispatchers = new Map();
199
+ const registrars = new Map();
221
200
  const addReg = (field, node, absLine) => {
222
201
  if (!field || /^\d+$/.test(field))
223
- return; // `$0.append` mis-captures the `0`; the write-RE owns that field
202
+ return;
224
203
  const arr = registrars.get(field) ?? [];
225
204
  if (!arr.some((r) => r.node.id === node.id))
226
205
  arr.push({ node, line: absLine });
227
206
  registrars.set(field, arr);
228
207
  };
229
- // Slices EVERY Swift/Kotlin method/function's source (no cheap name-gate), so
230
- // on a repo with a huge file this is the heaviest synthesis pass — yield
231
- // mid-scan (and mid-match-loop below: a single generated function dense with
232
- // matches must not starve the watchdog either) so it can't wedge the #850
233
- // watchdog on its own (#1091, #1235).
234
208
  let scanned = 0;
235
209
  let matchTick = 0;
236
210
  for (const m of methodAndFunctionNodes(queries)) {
@@ -265,7 +239,7 @@ async function closureCollectionEdges(queries, ctx, onYield) {
265
239
  while ((w = CC_APPEND_WRITE_RE.exec(src))) {
266
240
  if ((++matchTick & 255) === 0)
267
241
  await onYield();
268
- 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));
269
243
  }
270
244
  CC_APPEND_DIRECT_RE.lastIndex = 0;
271
245
  let a;
@@ -283,7 +257,7 @@ async function closureCollectionEdges(queries, ctx, onYield) {
283
257
  if (!regs || regs.length === 0)
284
258
  continue;
285
259
  if (disps.length > CC_FANOUT_CAP || regs.length > CC_FANOUT_CAP)
286
- continue; // generic field — can't pair confidently
260
+ continue;
287
261
  for (const disp of disps)
288
262
  for (const reg of regs) {
289
263
  if (disp.node.id === reg.node.id)
@@ -301,17 +275,16 @@ async function closureCollectionEdges(queries, ctx, onYield) {
301
275
  }
302
276
  return edges;
303
277
  }
304
- /** Phase 2: string-keyed EventEmitter channels (on('e', fn) ↔ emit('e')). */
305
278
  async function eventEmitterEdges(ctx, onYield) {
306
279
  let scannedFiles = 0;
307
- const emitsByEvent = new Map(); // event → dispatcher node ids
308
- const handlersByEvent = new Map(); // event → handler id → registration site (file:line)
280
+ const emitsByEvent = new Map();
281
+ const handlersByEvent = new Map();
309
282
  let scanned = 0;
310
283
  for (const file of ctx.getAllFiles()) {
311
284
  if ((++scannedFiles & 15) === 0)
312
285
  await onYield();
313
286
  if ((++scanned & 255) === 0)
314
- await onYield(); // #1091: yield mid-scan on huge graphs
287
+ await onYield();
315
288
  const content = ctx.readFile(file);
316
289
  if (!content)
317
290
  continue;
@@ -340,7 +313,7 @@ async function eventEmitterEdges(ctx, onYield) {
340
313
  const handlerName = m[2] || m[3];
341
314
  if (!handlerName)
342
315
  continue;
343
- 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));
344
317
  if (!handler)
345
318
  continue;
346
319
  const map = handlersByEvent.get(m[1]) ?? new Map();
@@ -355,8 +328,6 @@ async function eventEmitterEdges(ctx, onYield) {
355
328
  const handlers = handlersByEvent.get(event);
356
329
  if (!handlers)
357
330
  continue;
358
- // Precision guard: a generic event name with many handlers/dispatchers can't
359
- // be matched without receiver-type info (Phase 3) — skip rather than over-link.
360
331
  if (dispatchers.size > EVENT_FANOUT_CAP || handlers.size > EVENT_FANOUT_CAP)
361
332
  continue;
362
333
  for (const d of dispatchers)
@@ -372,29 +343,10 @@ async function eventEmitterEdges(ctx, onYield) {
372
343
  }
373
344
  return edges;
374
345
  }
375
- /**
376
- * Phase 4: React class-component re-render. `this.setState(...)` re-runs the
377
- * component's `render()`, but that hop is React-internal — no static edge — so a
378
- * flow like "mutation → setState → canvas repaint" dead-ends at setState even
379
- * though `render → getRenderableElements → …` is fully call-connected after it.
380
- * Bridge it: for each class that has a `render` method, link every sibling method
381
- * whose body calls `this.setState(` → `render`. The setState gate keeps this to
382
- * React class components (a non-React class with a `render` method won't call
383
- * `this.setState`). Over-approximation (all setState methods reach render) is
384
- * accepted — it's reachability-correct, like the callback channels.
385
- */
386
346
  async function reactRenderEdges(queries, ctx, onYield) {
387
347
  let scanned255 = 0;
388
348
  const edges = [];
389
349
  const seen = new Set();
390
- // A class can only emit here if it CONTAINS a method named `render` — so one
391
- // indexed name lookup bounds the candidate set up front, and the class scan
392
- // below skips everything else before its per-class edge/node queries. On a
393
- // repo with few/no render methods (any non-React codebase) this collapses
394
- // the pass from every-class fan-out to ~zero DB work, with identical output:
395
- // the skipped classes fail the same `render` check today, just after paying
396
- // for their children. (Not a language gate: `render` + `this.setState(` in
397
- // Java — e.g. Litho — legitimately matches today and still does.)
398
350
  const renderOwners = new Set();
399
351
  for (const n of ctx.getNodesByName('render')) {
400
352
  if (n.kind !== 'method')
@@ -439,15 +391,6 @@ async function reactRenderEdges(queries, ctx, onYield) {
439
391
  }
440
392
  return edges;
441
393
  }
442
- /**
443
- * Phase 4b: Flutter setState → build (the Dart analog of react-render). In a
444
- * StatefulWidget's State class, `setState(() {…})` re-runs `build(context)`, but
445
- * that hop is framework-internal (Flutter calls build), so a flow like
446
- * "onPressed → _increment → setState → rebuilt UI" dead-ends at setState. Bridge
447
- * it: for each Dart class with a `build` method, link every sibling method whose
448
- * body calls `setState(` → `build`. The setState gate + `.dart` file keep this to
449
- * Flutter State classes. Over-approximation accepted (reachability-correct).
450
- */
451
394
  async function flutterBuildEdges(queries, ctx, onYield) {
452
395
  let scanned255 = 0;
453
396
  const edges = [];
@@ -485,34 +428,12 @@ async function flutterBuildEdges(queries, ctx, onYield) {
485
428
  }
486
429
  return edges;
487
430
  }
488
- /**
489
- * Reactive ArkUI property decorators: assigning a property carrying one of
490
- * these re-runs the owning struct's `build()`. Covers both state models —
491
- * V1 (`@Component`: State/Prop/Link/Provide/Consume/Storage*) and V2
492
- * (`@ComponentV2`: Local/Provider/Consumer; `@Param` is read-only in V2 so
493
- * the assignment gate never fires on it, and `@Trace` lives on `@ObservedV2`
494
- * data classes, not struct properties).
495
- */
496
431
  const ARKUI_REACTIVE_DECORATORS = new Set([
497
432
  'State', 'Prop', 'Link', 'Provide', 'Consume', 'StorageLink', 'StorageProp',
498
433
  'LocalStorageLink', 'LocalStorageProp', 'ObjectLink',
499
434
  'Local', 'Provider', 'Consumer',
500
435
  ]);
501
- /** ArkUI-observed array mutators — `this.todos.push(x)` re-renders like an assignment. */
502
436
  const ARKUI_ARRAY_MUTATORS = 'push|pop|shift|unshift|splice|sort|reverse|fill';
503
- /**
504
- * Phase 4b-ets: ArkUI state → build (the ArkTS analog of react-render /
505
- * flutter-build). Assigning a reactive-decorated property (`@State count`,
506
- * `@Link selected`, …) re-runs the `@Component struct`'s `build()`, but that
507
- * hop is framework-internal — no static edge — so "onClick → markAllDone →
508
- * this.todos = […] → rebuilt list" dead-ends at the assignment. Bridge it:
509
- * for each arkts struct with a `build()` method and at least one reactive
510
- * property, link every sibling method whose body ASSIGNS (or array-mutates)
511
- * one of those properties → `build`. Assignment-gated on the struct's OWN
512
- * reactive property names — a method that merely reads state, or a struct
513
- * with no reactive properties, gets nothing (this is the precision line the
514
- * all-sibling-methods design would erase).
515
- */
516
437
  async function arkuiStateBuildEdges(queries, ctx, onYield) {
517
438
  let scanned255 = 0;
518
439
  const edges = [];
@@ -532,8 +453,6 @@ async function arkuiStateBuildEdges(queries, ctx, onYield) {
532
453
  const propAlternation = reactiveProps
533
454
  .map((p) => p.name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
534
455
  .join('|');
535
- // `this.count = …` / `+=` / `++` / `--` / `this.todos.push(…)`. The
536
- // `=(?!=)` keeps `this.done == x` comparisons out.
537
456
  const mutationRe = new RegExp(`this\\.(?:${propAlternation})\\s*(?:=(?!=)|\\+\\+|--|[+\\-*/%&|^]=|\\.(?:${ARKUI_ARRAY_MUTATORS})\\s*\\()`);
538
457
  let added = 0;
539
458
  for (const m of children) {
@@ -559,32 +478,10 @@ async function arkuiStateBuildEdges(queries, ctx, onYield) {
559
478
  }
560
479
  return edges;
561
480
  }
562
- /** Emit/subscribe call sites of HarmonyOS's `@ohos.events.emitter` bus. */
563
481
  const ARKUI_EMITTER_CALL_RE = /\bemitter\s*\.\s*(emit|on|once)\s*\(\s*([A-Za-z_$][\w$.]*|\{[^)]{0,120}?\beventId\s*:\s*[^,}]+[^)]*?\})/g;
564
- /** Cap per event bucket — a generic key with many parties is dynamic routing, not a static pair. */
565
482
  const ARKUI_EMITTER_FANOUT_CAP = 8;
566
- /**
567
- * Phase 4b-ets2: HarmonyOS `@ohos.events.emitter` bridge. The cross-component
568
- * bus — `emitter.emit(eventId)` fires `emitter.on(eventId, cb)` — is
569
- * framework-internal, so an order flow riding it (OrangeShopping's
570
- * add-to-cart) dead-ends at the emit. Link emit-site enclosing
571
- * function/method → on/once-site enclosing function/method when both
572
- * reference the SAME statically-recoverable event key.
573
- *
574
- * Key recovery, per call site (comment-stripped enclosing-file source): the
575
- * first argument is an `{ eventId: K }` literal, a `Names.Dotted` constant, or
576
- * a local whose same-file declaration is `new EventsId(K)` / `= K` — chase one
577
- * level. Precision scoping learned from the samples monorepo (thousands of
578
- * unrelated samples, most using eventId 1): NUMERIC keys pair within the same
579
- * FILE only; NAMED keys pair within the same workspace module directory (or
580
- * the whole project when it declares no modules — the single-app case), both
581
- * behind a fan-out cap. Inline `on(id, (e) => {…})` arrows need no special
582
- * handling — their bodies' calls already attribute to the registering method,
583
- * so targeting that method keeps the chain connected.
584
- */
585
483
  async function arkuiEmitterEdges(ctx, onYield) {
586
484
  let scannedFiles = 0;
587
- // bucket key -> emit sites / handler sites
588
485
  const emits = new Map();
589
486
  const handlers = new Map();
590
487
  const moduleDirs = (() => {
@@ -614,26 +511,23 @@ async function arkuiEmitterEdges(ctx, onYield) {
614
511
  while ((m = ARKUI_EMITTER_CALL_RE.exec(safe))) {
615
512
  const verb = m[1];
616
513
  const arg = m[2].trim();
617
- const line = safe.slice(0, m.index).split('\n').length;
514
+ const line = lineOf(safe, m.index);
618
515
  const encl = nodes
619
516
  .filter((n) => n.startLine <= line && n.endLine >= line)
620
517
  .sort((a, b) => (a.endLine - a.startLine) - (b.endLine - b.startLine))[0];
621
518
  if (!encl)
622
519
  continue;
623
- // Recover the event key from the first argument.
624
520
  let key = null;
625
521
  const idLit = arg.startsWith('{') ? arg.match(/\beventId\s*:\s*([\w$.]+)/)?.[1] : undefined;
626
522
  const token = idLit ?? arg;
627
523
  if (token !== undefined) {
628
524
  if (/^\d+$/.test(token)) {
629
- key = `num:${file}:${token}`; // numeric: same-file only
525
+ key = `num:${file}:${token}`;
630
526
  }
631
527
  else if (token.includes('.')) {
632
528
  key = `name:${moduleScopeOf(file)}:${token}`;
633
529
  }
634
530
  else {
635
- // Local variable — chase its same-file declaration one level:
636
- // `let x = new EventsId(K)` / `const x = K`.
637
531
  const declRe = new RegExp(`\\b${token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\b\\s*(?::[^=\\n]+)?=\\s*(?:new\\s+[\\w$.]+\\(\\s*([^)\\n]+?)\\s*\\)|([\\w$.]+))`);
638
532
  const decl = safe.match(declRe);
639
533
  const inner = (decl?.[1] ?? decl?.[2])?.trim();
@@ -680,19 +574,7 @@ async function arkuiEmitterEdges(ctx, onYield) {
680
574
  }
681
575
  return edges;
682
576
  }
683
- /** `router.pushUrl({ url: 'pages/Detail' })` / replaceUrl — literal urls only. */
684
577
  const ARKUI_ROUTER_RE = /\brouter\s*\.\s*(?:pushUrl|replaceUrl)\s*\(\s*\{[^)]{0,200}?\burl\s*:\s*['"]([\w\-./]+)['"]/g;
685
- /**
686
- * Phase 4b-ets3: HarmonyOS page navigation. `router.pushUrl({ url:
687
- * 'pages/Detail' })` reaches the `@Entry struct` of
688
- * `<module>/src/main/ets/pages/Detail.ets`, but the hop is a string — no
689
- * static edge — so "tap → openDetail → ???" ends at the router call. Bridge
690
- * literal urls to the page struct: the url resolves against the standard
691
- * `src/main/ets/` layout (what main_pages.json entries name); candidates
692
- * prefer the caller's own workspace module (routes are module-scoped), and
693
- * anything still ambiguous is dropped rather than guessed. Only `@Entry`
694
- * structs qualify as targets — the decorator is what makes a file a page.
695
- */
696
578
  async function arkuiRouterEdges(ctx, onYield) {
697
579
  const edges = [];
698
580
  const seen = new Set();
@@ -724,7 +606,7 @@ async function arkuiRouterEdges(ctx, onYield) {
724
606
  let m;
725
607
  while ((m = ARKUI_ROUTER_RE.exec(safe))) {
726
608
  const url = m[1];
727
- const line = safe.slice(0, m.index).split('\n').length;
609
+ const line = lineOf(safe, m.index);
728
610
  const encl = nodes
729
611
  .filter((n) => n.startLine <= line && n.endLine >= line)
730
612
  .sort((a, b) => (a.endLine - a.startLine) - (b.endLine - b.startLine))[0];
@@ -739,7 +621,7 @@ async function arkuiRouterEdges(ctx, onYield) {
739
621
  candidates = sameModule;
740
622
  }
741
623
  if (candidates.length !== 1)
742
- continue; // ambiguous or unresolved — never guess
624
+ continue;
743
625
  const page = ctx.getNodesInFile(candidates[0]).find((n) => n.kind === 'struct' && (n.decorators ?? []).includes('Entry'));
744
626
  if (!page)
745
627
  continue;
@@ -756,17 +638,7 @@ async function arkuiRouterEdges(ctx, onYield) {
756
638
  }
757
639
  return edges;
758
640
  }
759
- /**
760
- * Phase 4c: C++ virtual override. A call through a base/interface pointer
761
- * (`db->Get(...)`, `iter->Next()`) dispatches at runtime to a subclass override,
762
- * but that hop is a vtable indirection — no static call edge — so a flow stops at
763
- * the abstract base method. Bridge it like react-render: for each C++ class that
764
- * `extends` a base, link each base method → the subclass method of the same name
765
- * (the override), so trace/callees from the interface method reach the
766
- * implementation(s). Over-approximation accepted (reachability-correct); capped
767
- * per class and gated to C++ to avoid touching other languages' dispatch.
768
- */
769
- async function cppOverrideEdges(queries, onYield) {
641
+ async function cppOverrideEdges(queries, ctx, onYield) {
770
642
  let scanned255 = 0;
771
643
  const edges = [];
772
644
  const seen = new Set();
@@ -774,6 +646,7 @@ async function cppOverrideEdges(queries, onYield) {
774
646
  .getOutgoingEdges(classId, ['contains'])
775
647
  .map((e) => queries.getNodeById(e.target))
776
648
  .filter((n) => !!n && n.kind === 'method');
649
+ const overridable = (m) => (0, name_matcher_1.cppSpecializationArguments)(m, ctx) === null;
777
650
  for (const cls of queries.iterateNodesByKind('class')) {
778
651
  if ((++scanned255 & 63) === 0)
779
652
  await onYield();
@@ -784,13 +657,13 @@ async function cppOverrideEdges(queries, onYield) {
784
657
  const base = queries.getNodeById(ext.target);
785
658
  if (!base || base.language !== 'cpp' || base.id === cls.id)
786
659
  continue;
787
- 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]));
788
661
  let added = 0;
789
662
  for (const m of subMethods) {
790
663
  if (added >= MAX_CALLBACKS_PER_CHANNEL)
791
664
  break;
792
665
  const bm = baseMethods.get(m.name);
793
- if (!bm || bm.id === m.id)
666
+ if (!bm || bm.id === m.id || !overridable(m))
794
667
  continue;
795
668
  const key = `${bm.id}>${m.id}`;
796
669
  if (seen.has(key))
@@ -810,86 +683,429 @@ async function cppOverrideEdges(queries, onYield) {
810
683
  }
811
684
  return edges;
812
685
  }
813
- /**
814
- * Phase 5.5: interface / abstract dispatch (Java, Kotlin). A call through an
815
- * injected interface (`@Autowired FooService svc; svc.list()`) or an abstract
816
- * base dispatches at runtime to the implementing class's override — a vtable
817
- * indirection with no static call edge — so a request→service flow stops at the
818
- * interface method. Bridge it like cpp-override: for each class that
819
- * `implements` an interface (or `extends` an abstract base), link each
820
- * base/interface method → the class's same-name method (the override) so
821
- * trace/callees reach the implementation. Over-approximation accepted
822
- * (reachability-correct); capped per class, gated to JVM languages.
823
- */
824
- // Languages whose static `implements`/`extends` edges should bridge an
825
- // interface (or abstract base) method to the matching concrete-class method.
826
- // The set is "languages with explicit nominal subtyping and a single class
827
- // kind that holds methods" — i.e. the shape this loop expects. Swift and
828
- // Scala fit shape-wise (Swift `protocol`/`class`, Scala `trait`/`class`)
829
- // and are added below; their concrete-side nodes can be a `struct` (Swift)
830
- // or an `object` (Scala) so the loop also iterates those kinds.
831
686
  const IFACE_OVERRIDE_LANGS = new Set([
832
- 'java', 'kotlin', 'csharp', 'typescript', 'javascript', 'swift', 'scala', 'go', 'rust',
687
+ 'java', 'kotlin', 'csharp', 'typescript', 'tsx', 'javascript', 'jsx', 'swift', 'scala', 'go', 'rust',
833
688
  'arkts',
834
689
  ]);
835
- /**
836
- * Go implicit interface satisfaction (#584). Go has no `implements` keyword — a
837
- * struct satisfies an interface structurally when its method set covers the
838
- * interface's. Synthesize the missing `implements` edge (struct → interface) by
839
- * matching method-NAME sets, so impl-navigation works and the interface-dispatch
840
- * bridge ({@link interfaceOverrideEdges}, now 'go'-enabled) can link an interface
841
- * method call to the concrete overrides.
842
- *
843
- * Name-only matching (signatures ignored) — over-approximation accepted, in line
844
- * with the other dispatch synthesizers; capped per interface. Empty interfaces
845
- * (`any`) are skipped so they don't match every struct.
846
- */
847
- 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) {
848
817
  let scanned255 = 0;
849
818
  const edges = [];
850
819
  const seen = new Set();
851
- const methodNameSet = (id) => new Set(queries
852
- .getOutgoingEdges(id, ['contains'])
853
- .map((e) => queries.getNodeById(e.target))
854
- .filter((n) => !!n && n.kind === 'method')
855
- .map((n) => n.name));
856
- // Materializes GO structs only (the pass is language-gated by the caller),
857
- // never the whole struct kind — that array is O(nodes) on struct-heavy
858
- // repos like the Linux kernel (#1212).
859
- const goStructs = [];
860
- for (const s of queries.iterateNodesByKindIn('struct', ['go'])) {
820
+ const goImplementers = [];
821
+ for (const n of queries.iterateNodesByKindIn(['struct', 'type_alias'], ['go'])) {
861
822
  if ((++scanned255 & 63) === 0)
862
823
  await onYield();
863
- goStructs.push(s);
824
+ goImplementers.push(n);
864
825
  }
865
- const structMethods = new Map();
866
- for (const s of goStructs)
867
- structMethods.set(s.id, methodNameSet(s.id));
868
- for (const iface of queries.iterateNodesByKindIn('interface', ['go'])) {
826
+ const goInterfaces = [];
827
+ for (const i of queries.iterateNodesByKindIn('interface', ['go'])) {
869
828
  if ((++scanned255 & 63) === 0)
870
829
  await onYield();
871
- const want = methodNameSet(iface.id);
872
- if (want.size === 0)
873
- continue; // empty interface (`any`) — would match everything
874
- let added = 0;
875
- for (const s of goStructs) {
876
- if (added >= MAX_CALLBACKS_PER_CHANNEL)
877
- break;
878
- const have = structMethods.get(s.id);
879
- 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))
869
+ continue;
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)
880
928
  continue;
881
- let all = true;
882
- for (const m of want) {
883
- if (!have.has(m)) {
884
- all = false;
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;
885
1021
  break;
886
1022
  }
887
1023
  }
888
- 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)
889
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) => {
890
1106
  const key = `${s.id}>${iface.id}`;
891
1107
  if (seen.has(key))
892
- continue;
1108
+ return;
893
1109
  seen.add(key);
894
1110
  edges.push({
895
1111
  source: s.id,
@@ -900,32 +1116,45 @@ async function goImplementsEdges(queries, onYield) {
900
1116
  metadata: { synthesizedBy: 'go-implements', via: iface.name, registeredAt: `${s.filePath}:${s.startLine}` },
901
1117
  });
902
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);
903
1154
  }
904
1155
  }
905
1156
  return edges;
906
1157
  }
907
- /**
908
- * Cross-file Go method → receiver-type `contains` edges. In Go a type's methods
909
- * are commonly declared in a different file from the `type` declaration itself
910
- * (`type User struct{…}` in `user.go`, `func (u *User) Save()` in
911
- * `user_store.go`). Extraction attaches the struct→method `contains` edge only
912
- * when the receiver type is in the SAME file — the owner lookup in
913
- * `tree-sitter.ts` is scoped to the file being parsed — so a cross-file method
914
- * is left orphaned from its type (it's still `contains`ed by its file, just not
915
- * its struct). That breaks `codegraph_node` member outlines, any
916
- * callers/callees/impact traversal that goes through the type's `contains`
917
- * edges, and the {@link goImplementsEdges} method-set computation (which derives
918
- * a struct's method set from those same edges, so it under-counts interfaces a
919
- * cross-file struct satisfies).
920
- *
921
- * Go guarantees a method's receiver type is declared in the SAME PACKAGE as the
922
- * method, and a Go package is a single directory — so this is a deterministic
923
- * structural link, not a heuristic: find the same-named type in the method's
924
- * own directory and add the missing `contains` edge with no provenance, matching
925
- * same-file extraction. Tag synthesis ownership so an incremental
926
- * refresh can replace it alongside implicit `implements`. Skips methods that
927
- * already have a type parent (the same-file case). (#583, cross-file half)
928
- */
929
1158
  async function goCrossFileMethodContainsEdges(queries, onYield) {
930
1159
  let scanned255 = 0;
931
1160
  const edges = [];
@@ -938,8 +1167,6 @@ async function goCrossFileMethodContainsEdges(queries, onYield) {
938
1167
  for (const method of queries.iterateNodesByKindIn('method', ['go'])) {
939
1168
  if ((++scanned255 & 63) === 0)
940
1169
  await onYield();
941
- // The receiver type is encoded in the method's qualifiedName as `Recv::name`
942
- // (extraction sets `${receiverType}::${name}` for receiver methods).
943
1170
  const qn = method.qualifiedName;
944
1171
  if (!qn)
945
1172
  continue;
@@ -949,7 +1176,6 @@ async function goCrossFileMethodContainsEdges(queries, onYield) {
949
1176
  const receiver = qn.slice(0, sep);
950
1177
  if (!receiver)
951
1178
  continue;
952
- // Already attached to its type (same-file case handled at extraction)?
953
1179
  const hasTypeParent = queries
954
1180
  .getIncomingEdges(method.id, ['contains'])
955
1181
  .some((e) => {
@@ -958,10 +1184,6 @@ async function goCrossFileMethodContainsEdges(queries, onYield) {
958
1184
  });
959
1185
  if (hasTypeParent)
960
1186
  continue;
961
- // Find the receiver type in the SAME directory (= same Go package). Go forbids
962
- // duplicate type names within a package, so a same-name same-dir match is
963
- // unambiguous; scoping to the directory avoids linking to a same-named type
964
- // in another package.
965
1187
  const dir = dirOf(method.filePath);
966
1188
  const owner = queries
967
1189
  .getNodesByName(receiver)
@@ -977,31 +1199,6 @@ async function goCrossFileMethodContainsEdges(queries, onYield) {
977
1199
  }
978
1200
  return edges;
979
1201
  }
980
- /**
981
- * Kotlin Multiplatform `expect`/`actual` linking. A `common` source set declares
982
- * `expect fun foo()` / `expect class Bar`; each platform source set (jvm, native,
983
- * js, …) provides an `actual` implementation with the IDENTICAL fully-qualified
984
- * name in a different file. Callers in common code resolve to the `expect`
985
- * declaration, so every `actual` impl ends up with zero dependents — invisible to
986
- * impact/affected even though editing it can break every caller of the API.
987
- *
988
- * Synthesize a `calls` edge from the common declaration to each platform `actual`
989
- * (mirroring the interface-impl bridge: abstract → concrete), so editing a
990
- * platform impl surfaces the common `expect` and its callers, and the impl file
991
- * participates in the graph.
992
- *
993
- * `expect`/`actual` are captured onto the node's `decorators` list at extraction
994
- * (kotlin.ts `extractModifiers`). Members of an `expect class` are NOT themselves
995
- * keyword-marked, so the declaration side is matched as the same-FQN, same-kind
996
- * node that is NOT marked `actual`. Requiring an `actual`-marked counterpart also
997
- * gates out plain cross-file overloads (neither side is marked).
998
- */
999
- // Kinds that an `expect`/`actual` pair may legitimately straddle. `expect class`
1000
- // is routinely fulfilled by an `actual typealias` (e.g. `actual typealias
1001
- // CancellationException = …`, `actual typealias SchedulerTask = Task`), so a
1002
- // strict kind match would miss those one-line alias files. Same-FQN + the
1003
- // `actual` marker already gates out unrelated symbols, so widening to the
1004
- // type-like kinds is safe.
1005
1202
  const KMP_TYPE_KINDS = new Set(['class', 'interface', 'struct', 'enum', 'type_alias']);
1006
1203
  function kmpKindsCompatible(a, b) {
1007
1204
  return a === b || (KMP_TYPE_KINDS.has(a) && KMP_TYPE_KINDS.has(b));
@@ -1010,11 +1207,6 @@ async function kotlinExpectActualEdges(queries, onYield) {
1010
1207
  let scanned255 = 0;
1011
1208
  const edges = [];
1012
1209
  const seen = new Set();
1013
- // SQL-side language+decorator pre-filter, streamed. The old
1014
- // `getAllNodes().filter(...)` hydrated the ENTIRE node table into one array
1015
- // just to find kotlin `actual` declarations — on a 2M-node graph that alone
1016
- // exceeded Node's default heap and killed the index (#1212). The LIKE
1017
- // pre-filter can over-match (substring), so the exact decorator check stays.
1018
1210
  for (const act of queries.iterateNodesByLanguageWithDecorator('kotlin', 'actual')) {
1019
1211
  if ((++scanned255 & 63) === 0)
1020
1212
  await onYield();
@@ -1024,8 +1216,6 @@ async function kotlinExpectActualEdges(queries, onYield) {
1024
1216
  for (const cand of queries.getNodesByQualifiedNameExact(act.qualifiedName)) {
1025
1217
  if (added >= MAX_CALLBACKS_PER_CHANNEL)
1026
1218
  break;
1027
- // The declaration side: same FQN + compatible kind, a different file, NOT
1028
- // itself an `actual` (that would be a sibling platform impl, not the decl).
1029
1219
  if (cand.language !== 'kotlin' || cand.id === act.id)
1030
1220
  continue;
1031
1221
  if (!kmpKindsCompatible(cand.kind, act.kind) || cand.filePath === act.filePath)
@@ -1053,13 +1243,106 @@ async function kotlinExpectActualEdges(queries, onYield) {
1053
1243
  }
1054
1244
  return edges;
1055
1245
  }
1056
- 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) {
1057
1343
  let scanned255 = 0;
1058
1344
  const edges = [];
1059
1345
  const seen = new Set();
1060
- // Memoized: a popular base interface's method list is otherwise re-fetched
1061
- // once per implementer (dubbo-style hub interfaces have hundreds), and the
1062
- // memo only ever serves reads. Same rows, same order — byte-identical.
1063
1346
  const methodsMemo = new Map();
1064
1347
  const methodsOf = (classId) => {
1065
1348
  const hit = methodsMemo.get(classId);
@@ -1072,48 +1355,89 @@ async function interfaceOverrideEdges(queries, onYield) {
1072
1355
  methodsMemo.set(classId, methods);
1073
1356
  return methods;
1074
1357
  };
1075
- // Concrete-side kinds vary by language: `class` covers Java / Kotlin /
1076
- // C# / TS / Swift-classes / Scala-classes; `struct` covers Swift value
1077
- // types that conform to protocols. Iterate both.
1358
+ const protocolMemo = new Map();
1359
+ const baseMethodsOf = (base) => {
1360
+ if (base.language !== 'swift' || base.kind !== 'interface')
1361
+ return methodsOf(base.id);
1362
+ const hit = protocolMemo.get(base.id);
1363
+ if (hit)
1364
+ return hit;
1365
+ const methods = [
1366
+ ...methodsOf(base.id),
1367
+ ...queries
1368
+ .getNodesByName(base.name)
1369
+ .filter((n) => n.language === 'swift' && n.kind === 'class')
1370
+ .flatMap((n) => methodsOf(n.id)),
1371
+ ];
1372
+ protocolMemo.set(base.id, methods);
1373
+ return methods;
1374
+ };
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 = [];
1078
1389
  const concreteKinds = ['class', 'struct', 'union'];
1079
- for (const kind of concreteKinds) {
1080
- 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()) {
1081
1396
  if ((++scanned255 & 63) === 0)
1082
1397
  await onYield();
1083
- // A class can only emit here if it HAS a supertype edge — check that
1084
- // (one edge query) before materializing its methods: most classes in a
1085
- // typical graph extend/implement nothing and skip in one hop.
1086
1398
  const sups = queries.getOutgoingEdges(cls.id, ['implements', 'extends']);
1087
1399
  if (sups.length === 0)
1088
1400
  continue;
1089
1401
  const implMethods = methodsOf(cls.id).filter((n) => IFACE_OVERRIDE_LANGS.has(n.language));
1090
- 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')))
1091
1404
  continue;
1092
1405
  for (const sup of sups) {
1093
1406
  const base = queries.getNodeById(sup.target);
1094
1407
  if (!base || !IFACE_OVERRIDE_LANGS.has(base.language) || base.id === cls.id)
1095
1408
  continue;
1096
- // Group impl methods by name to handle OVERLOADS: an interface `list()` and
1097
- // `list(params)` are distinct nodes and a call may resolve to either, so
1098
- // link every base overload → every same-name impl overload (keying by name
1099
- // alone would drop all but one and miss the resolved overload).
1100
- 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();
1101
1414
  for (const m of implMethods) {
1102
- const arr = implByName.get(m.name);
1415
+ const key = keyOf(m);
1416
+ const arr = implsByKey.get(key);
1103
1417
  if (arr)
1104
1418
  arr.push(m);
1105
1419
  else
1106
- implByName.set(m.name, [m]);
1420
+ implsByKey.set(key, [m]);
1107
1421
  }
1108
1422
  let added = 0;
1109
- for (const bm of methodsOf(base.id)) {
1423
+ const unmatched = [];
1424
+ for (const bm of baseMethodsOf(base)) {
1110
1425
  if (added >= MAX_CALLBACKS_PER_CHANNEL)
1111
1426
  break;
1112
- 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) {
1113
1435
  if (added >= MAX_CALLBACKS_PER_CHANNEL)
1114
1436
  break;
1115
1437
  if (bm.id === m.id)
1116
1438
  continue;
1439
+ if (STATIC_SPLIT_LANGS.has(m.language) && (bm.isStatic === true) !== (m.isStatic === true))
1440
+ continue;
1117
1441
  const key = `${bm.id}>${m.id}`;
1118
1442
  if (seen.has(key))
1119
1443
  continue;
@@ -1129,46 +1453,54 @@ async function interfaceOverrideEdges(queries, onYield) {
1129
1453
  added++;
1130
1454
  }
1131
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--;
1132
1493
  }
1133
1494
  }
1134
1495
  }
1135
1496
  return edges;
1136
1497
  }
1137
- /**
1138
- * Go gRPC stub → impl bridge. The protoc-gen-go-grpc codegen emits an
1139
- * `UnimplementedXxxServer` struct in `*_grpc.pb.go` carrying one method
1140
- * per service RPC; the real handler is a hand-written struct in another
1141
- * file (`x/bank/keeper/msg_server.go::msgServer.Send` in cosmos-sdk).
1142
- * Go's structural typing means no `implements` edge exists for our
1143
- * resolver to follow, so `trace("Send","SendCoins")` lands on the
1144
- * empty stub and reports "no path" (validated empirically — the cosmos
1145
- * Q1 r1 trace failure that drove this work).
1146
- *
1147
- * Bridge: for each `UnimplementedXxxServer` whose RPC-method names are
1148
- * a SUBSET of some other Go struct's method names, emit `calls` edges
1149
- * `stub.method → impl.method` (paired by name). Excludes the gRPC
1150
- * internal markers `mustEmbedUnimplementedXxxServer` and
1151
- * `testEmbeddedByValue`, and skips candidate impls that themselves
1152
- * live in a generated file (their `xxxClient` / sibling stubs would
1153
- * otherwise look like impls).
1154
- *
1155
- * Multiple candidates is allowed and capped at MAX_CALLBACKS_PER_CHANNEL —
1156
- * a service often has both a production impl and one or more test
1157
- * mocks; linking to all preserves trace utility without false-favoring.
1158
- *
1159
- * Provenance: `heuristic`, `synthesizedBy: 'go-grpc-stub-impl'`. The
1160
- * stub's source line is the wiring site shown in the trace trail.
1161
- */
1162
1498
  async function goGrpcStubImplEdges(queries, onYield) {
1163
1499
  let scanned255 = 0;
1164
1500
  const edges = [];
1165
1501
  const seen = new Set();
1166
1502
  const STUB_RE = /^Unimplemented.*Server$/;
1167
- // gRPC internal-helper methods that appear on every Unimplemented*Server;
1168
- // not part of the service contract, so exclude when computing the RPC-method
1169
- // signature used to match impls.
1170
1503
  const isInternalMarker = (n) => n.startsWith('mustEmbed') || n === 'testEmbeddedByValue';
1171
- // Methods directly contained by each Go struct, name-only. Built once.
1172
1504
  const methodNamesByStruct = new Map();
1173
1505
  const methodNodesByStruct = new Map();
1174
1506
  const goStructs = [];
@@ -1186,10 +1518,6 @@ async function goGrpcStubImplEdges(queries, onYield) {
1186
1518
  for (const stub of goStructs) {
1187
1519
  if (!STUB_RE.test(stub.name))
1188
1520
  continue;
1189
- // The stub MUST live in a generated file — that's what tells us this is
1190
- // a protoc-emitted scaffold rather than someone naming a struct
1191
- // `UnimplementedXxxServer` by hand. Without this gate we'd also bridge
1192
- // such hand-written structs and create misleading edges.
1193
1521
  if (!(0, generated_detection_1.isGeneratedFile)(stub.filePath))
1194
1522
  continue;
1195
1523
  const stubMethods = (methodNodesByStruct.get(stub.id) ?? []).filter((m) => !isInternalMarker(m.name));
@@ -1199,18 +1527,11 @@ async function goGrpcStubImplEdges(queries, onYield) {
1199
1527
  for (const cand of goStructs) {
1200
1528
  if (cand.id === stub.id)
1201
1529
  continue;
1202
- // Skip generated-file candidates — they're siblings (msgClient,
1203
- // UnsafeMsgServer, …) whose method sets coincidentally match.
1204
1530
  if ((0, generated_detection_1.isGeneratedFile)(cand.filePath))
1205
1531
  continue;
1206
1532
  const candNames = methodNamesByStruct.get(cand.id);
1207
1533
  if (!candNames)
1208
1534
  continue;
1209
- // Subset: every RPC method must exist on the candidate by name.
1210
- // Signature-level match would tighten this further, but name-match
1211
- // alone already gives one-to-one pairing in real codebases because
1212
- // gRPC method-name sets are highly distinctive (Send + MultiSend +
1213
- // UpdateParams + SetSendEnabled is unique to bank's MsgServer).
1214
1535
  if (!stubMethodNames.every((n) => candNames.has(n)))
1215
1536
  continue;
1216
1537
  const candMethods = methodNodesByStruct.get(cand.id) ?? [];
@@ -1246,52 +1567,104 @@ async function goGrpcStubImplEdges(queries, onYield) {
1246
1567
  }
1247
1568
  return edges;
1248
1569
  }
1249
- /** Kinds a JSX tag can name. A tag that resolves only to a type is markup we drop. */
1250
1570
  const JSX_CHILD_KINDS = new Set(['component', 'function', 'class']);
1251
- /**
1252
- * The languages a JSX tag can plausibly name a component in. Preferred over a
1253
- * same-named symbol in another language, never required — a React Native tag
1254
- * whose only match is the native class it bridges to (`requireNativeComponent`)
1255
- * still links there.
1256
- */
1257
1571
  const JSX_CHILD_LANGUAGES = [...JS_FAMILY, 'vue', 'svelte'];
1258
- /** `localName` → the project file it is imported from, for one file's imports. */
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
+ }
1577
+ function languageForJsxFile(file) {
1578
+ if (file.endsWith('.tsx'))
1579
+ return 'tsx';
1580
+ if (/\.[cm]?ts$/.test(file))
1581
+ return 'typescript';
1582
+ if (file.endsWith('.jsx'))
1583
+ return 'jsx';
1584
+ if (file.endsWith('.vue'))
1585
+ return 'vue';
1586
+ if (file.endsWith('.svelte'))
1587
+ return 'svelte';
1588
+ return 'javascript';
1589
+ }
1259
1590
  function importedFrom(ctx, file, language) {
1260
1591
  const out = new Map();
1261
1592
  for (const im of ctx.getImportMappings(file, language)) {
1262
- // The mappings name the module as written; the file it is comes from the
1263
- // same resolution the import resolver uses (aliases, extensions, index files).
1264
1593
  const resolved = im.resolvedPath ?? (0, import_resolver_1.resolveImportPath)(im.source, file, language, ctx);
1265
1594
  if (resolved)
1266
1595
  out.set(im.localName, resolved);
1267
1596
  }
1268
1597
  return out;
1269
1598
  }
1270
- /**
1271
- * The component a JSX tag names, among every node that shares the name.
1272
- *
1273
- * A tag is written in one file, and that file already says which `FrameCard` it
1274
- * means: the one it declares, or the one it imports. Taking the FIRST node of
1275
- * that name — which is what this did — is a coin flip once a name repeats, and
1276
- * it costs twice over. The parent gets an edge to a component it never renders,
1277
- * and the component it does render is left with no caller at all, so every walk
1278
- * back from that subtree dead-ends: on an Expo app whose `<FrameCard/>` was one
1279
- * of two, the folder sheet's `openBackgroundNoiseDetail` stood alone on Screens
1280
- * with no screen behind it, while the edge pointed at an unrelated card in
1281
- * another sheet.
1282
- *
1283
- * Same file first — a small component declared beside its use is the commonest
1284
- * shape, and the one an import can never disambiguate. Then the file the name
1285
- * is imported from. Then the language, which only decides a tie: a `.tsx` tag
1286
- * naming both a TS component and a same-named Swift class means the TS one.
1287
- */
1288
- function jsxChild(ctx, name, file, importsOf) {
1289
- const candidates = ctx.getNodesByName(name).filter((n) => JSX_CHILD_KINDS.has(n.kind));
1290
- if (candidates.length <= 1)
1291
- return candidates[0];
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));
1292
1642
  const local = candidates.find((n) => n.filePath === file);
1293
1643
  if (local)
1294
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
+ }
1658
+ if (candidates.length === 0) {
1659
+ const isDefault = ctx
1660
+ .getImportMappings(file, languageForJsxFile(file))
1661
+ .some((m) => m.localName === name && m.isDefault);
1662
+ const from = isDefault ? importsOf().get(name) : undefined;
1663
+ const components = from ? ctx.getNodesInFile(from).filter((n) => n.kind === 'component') : [];
1664
+ return components.length === 1 ? components[0] : undefined;
1665
+ }
1666
+ if (candidates.length === 1)
1667
+ return candidates[0];
1295
1668
  const from = importsOf().get(name);
1296
1669
  if (from) {
1297
1670
  const imported = candidates.find((n) => n.filePath === from);
@@ -1300,51 +1673,423 @@ function jsxChild(ctx, name, file, importsOf) {
1300
1673
  }
1301
1674
  return candidates.find((n) => JSX_CHILD_LANGUAGES.includes(n.language)) ?? candidates[0];
1302
1675
  }
1303
- /**
1304
- * Phase 5: React JSX child rendering. A component that returns `<Child .../>`
1305
- * mounts Child — React calls it — but JSX instantiation isn't a static call edge,
1306
- * so a render tree (App.render → StaticCanvas → renderStaticScene) breaks at the
1307
- * JSX hop. Link parent → each capitalized JSX child it renders. File-oriented
1308
- * (read each JSX file once). Precision gate: the child name must resolve to a
1309
- * component/function/class node — TS generics like `Array<Foo>` resolve to a type
1310
- * (or nothing) and are dropped.
1311
- */
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
+ }
1312
1924
  async function reactJsxChildEdges(ctx, onYield) {
1313
1925
  let scannedFiles = 0;
1314
1926
  const edges = [];
1315
1927
  const seen = new Set();
1316
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
+ };
1317
1941
  let scanned = 0;
1318
1942
  for (const file of ctx.getAllFiles()) {
1319
1943
  if ((++scannedFiles & 15) === 0)
1320
1944
  await onYield();
1321
1945
  if ((++scanned & 255) === 0)
1322
- await onYield(); // #1091: yield mid-scan on huge graphs
1946
+ await onYield();
1323
1947
  const content = ctx.readFile(file);
1324
- if (!content || (!content.includes('</') && !content.includes('/>')))
1325
- continue; // JSX-file gate
1326
- // File-level language gate, not merely a project-level one: mixed C/JS
1327
- // monorepos must not interpret `"<Foo/>"` inside C as JSX (#1560).
1328
- 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] : [])];
1329
2028
  if (parents.length === 0)
1330
2029
  continue;
1331
- // Read once per file, and only when a name actually turns out ambiguous.
1332
2030
  let imports = null;
1333
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
+ };
1334
2057
  for (const parent of parents) {
1335
- const src = sliceLines(content, parent.startLine, parent.endLine);
1336
- if (!src || (!src.includes('</') && !src.includes('/>')))
2058
+ if (!parent.startLine || !parent.endLine)
1337
2059
  continue;
1338
- const names = new Set();
1339
- JSX_TAG_RE.lastIndex = 0;
1340
- let m;
1341
- while ((m = JSX_TAG_RE.exec(src)))
1342
- names.add(m[1]);
2060
+ const names = spanOf(parent);
2061
+ let around = null;
1343
2062
  let added = 0;
1344
- for (const name of names) {
2063
+ for (const [name, line] of names.tags) {
1345
2064
  if (added >= MAX_JSX_CHILDREN)
1346
2065
  break;
1347
- 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
+ }
1348
2093
  if (!child || child.id === parent.id || (0, name_matcher_1.crossesCodeBoundary)(parent.language, child.language))
1349
2094
  continue;
1350
2095
  const key = `${parent.id}>${child.id}`;
@@ -1362,18 +2107,6 @@ async function reactJsxChildEdges(ctx, onYield) {
1362
2107
  }
1363
2108
  return edges;
1364
2109
  }
1365
- /**
1366
- * Phase 6: Vue SFC templates. The `.vue` extractor only parses `<script>`, so
1367
- * template usage is invisible — child components and event handlers used ONLY in
1368
- * the template have no edge to them. PascalCase children (`<VPNav/>`) are already
1369
- * caught by reactJsxChildEdges (which scans the SFC component node), so this adds
1370
- * the two Vue-specific shapes:
1371
- * - kebab-case children: `<el-button>` → `ElButton` component (renders).
1372
- * - event bindings: `@click="onClick"` / `v-on:submit="save"` → handler method.
1373
- * Scoped to the `<template>` block of `.vue` files; resolution gate (kebab→
1374
- * component, handler→function/method) keeps precision; inline arrows / `$emit`
1375
- * skipped.
1376
- */
1377
2110
  async function vueTemplateEdges(ctx, onYield) {
1378
2111
  let scannedFiles = 0;
1379
2112
  let scanned255 = 0;
@@ -1381,14 +2114,7 @@ async function vueTemplateEdges(ctx, onYield) {
1381
2114
  const seen = new Set();
1382
2115
  const COMPONENT_KINDS = new Set(['component', 'function', 'class']);
1383
2116
  const HANDLER_KINDS = new Set(['method', 'function']);
1384
- // A composable's returned member may be a fn (`function close(){}`) or an
1385
- // arrow assigned to a const (`const close = () => {}`).
1386
2117
  const RETURN_KINDS = new Set(['method', 'function', 'variable', 'constant']);
1387
- // Nuxt auto-imports nested components by a DIRECTORY-PREFIXED name —
1388
- // `components/media/Card.vue` is used as `<MediaCard/>`, not `<Card/>` — but
1389
- // the component node is named by basename (`Card`), so a direct tag match
1390
- // misses it (flat components match by basename and don't need this). Map each
1391
- // nested component's Nuxt name → node so those template usages resolve.
1392
2118
  const nuxtComponents = new Map();
1393
2119
  for (const c of (ctx.iterateNodesByKind?.('component') ?? ctx.getNodesByKind('component'))) {
1394
2120
  if ((++scanned255 & 63) === 0)
@@ -1409,18 +2135,15 @@ async function vueTemplateEdges(ctx, onYield) {
1409
2135
  const comp = ctx.getNodesInFile(file).find((n) => n.kind === 'component');
1410
2136
  if (!comp)
1411
2137
  continue;
1412
- // Composable-destructure map: alias → { composable, key }. Lets us resolve a
1413
- // template handler that isn't a local function but a destructured composable
1414
- // return (`@click="closeSidebar"` ← `const { close: closeSidebar } = useSidebarControl()`).
1415
2138
  const script = content.match(/<script[^>]*>([\s\S]*?)<\/script>/i)?.[1] ?? '';
1416
2139
  const destructured = new Map();
1417
2140
  VUE_DESTRUCTURE_RE.lastIndex = 0;
1418
2141
  let dm;
1419
2142
  while ((dm = VUE_DESTRUCTURE_RE.exec(script))) {
1420
2143
  if (!/^use[A-Z]/.test(dm[2]))
1421
- continue; // composables / hooks only
2144
+ continue;
1422
2145
  for (const part of dm[1].split(',')) {
1423
- const pm = part.trim().match(/^(\w+)\s*(?::\s*(\w+))?$/); // key | key: alias
2146
+ const pm = part.trim().match(/^(\w+)\s*(?::\s*(\w+))?$/);
1424
2147
  if (pm)
1425
2148
  destructured.set(pm[2] || pm[1], { composable: dm[2], key: pm[1] });
1426
2149
  }
@@ -1437,49 +2160,42 @@ async function vueTemplateEdges(ctx, onYield) {
1437
2160
  edges.push({ source: comp.id, target: target.id, kind: 'calls', line: comp.startLine, provenance: 'heuristic', metadata: meta });
1438
2161
  added++;
1439
2162
  };
1440
- // Prefer a target in THIS SFC (handlers live in the same file's script) —
1441
- // avoids cross-file mis-match when a name repeats across a monorepo.
1442
- const resolve = (name, kinds) => {
1443
- const matches = ctx.getNodesByName(name).filter((n) => kinds.has(n.kind));
1444
- 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;
1445
2169
  };
1446
2170
  let m;
1447
2171
  VUE_KEBAB_RE.lastIndex = 0;
1448
2172
  while ((m = VUE_KEBAB_RE.exec(tpl))) {
1449
2173
  const tag = kebabToPascal(m[1]);
1450
- 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] });
1451
2175
  }
1452
- // PascalCase component tags. Try a direct name match first (flat components
1453
- // and explicit registrations), then the Nuxt dir-prefixed auto-import name
1454
- // (`<MediaCard>` → components/media/Card.vue). Built-ins match neither → no edge.
1455
2176
  VUE_PASCAL_RE.lastIndex = 0;
1456
2177
  while ((m = VUE_PASCAL_RE.exec(tpl))) {
1457
2178
  const tag = m[1];
1458
- 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 });
1459
2180
  }
1460
2181
  VUE_HANDLER_RE.lastIndex = 0;
1461
2182
  while ((m = VUE_HANDLER_RE.exec(tpl))) {
1462
2183
  const event = m[1];
1463
2184
  const expr = m[2].trim();
1464
2185
  if (expr.includes('=>') || expr.startsWith('$'))
1465
- continue; // inline arrow / $emit
1466
- const name = expr.match(/^([A-Za-z_]\w*)/)?.[1];
2186
+ continue;
2187
+ const name = expr.match(/^([A-Za-z_$][\w$]*)\s*(?:\(|$)/)?.[1];
1467
2188
  if (!name)
1468
2189
  continue;
1469
- const direct = resolve(name, HANDLER_KINDS);
2190
+ const direct = name === expr ? resolve(name, HANDLER_KINDS) : undefined;
1470
2191
  if (direct) {
1471
2192
  addEdge(direct, { synthesizedBy: 'vue-handler', event });
1472
2193
  continue;
1473
2194
  }
1474
- // Composable-destructure handler → resolve to the composable's returned fn.
1475
2195
  const d = destructured.get(name);
1476
2196
  if (!d)
1477
2197
  continue;
1478
2198
  const composable = resolve(d.composable, HANDLER_KINDS);
1479
- // Resolve to the SPECIFIC returned member (e.g. `close`) defined in the
1480
- // composable's file. No fallback to the composable itself — the component
1481
- // already has a static `useX()` call edge, so that would just be redundant
1482
- // and less precise.
1483
2199
  const keyFn = composable
1484
2200
  ? ctx.getNodesByName(d.key).find((n) => RETURN_KINDS.has(n.kind) && n.filePath === composable.filePath)
1485
2201
  : undefined;
@@ -1489,59 +2205,67 @@ async function vueTemplateEdges(ctx, onYield) {
1489
2205
  }
1490
2206
  return edges;
1491
2207
  }
1492
- /**
1493
- * React Native cross-language event channel (Phase 3 of the mixed-iOS/RN
1494
- * bridging effort). Same shape as `eventEmitterEdges` but cross-language:
1495
- *
1496
- * Native (ObjC, on RCTEventEmitter subclass):
1497
- * [self sendEventWithName:@"locationUpdate" body:@{...}];
1498
- *
1499
- * Native (Java/Kotlin, via the JS module dispatcher):
1500
- * emitter.emit("locationUpdate", body);
1501
- * reactContext.getJSModule(RCTDeviceEventEmitter.class).emit("locationUpdate", body);
1502
- *
1503
- * JS (subscriber):
1504
- * new NativeEventEmitter(NativeModules.Geo).addListener("locationUpdate", handler);
1505
- * DeviceEventEmitter.addListener("locationUpdate", handler);
1506
- *
1507
- * Synthesize: native dispatch site → JS handler, keyed by the literal
1508
- * event name. A NAMED handler (`addListener('x', handleX)`) is the target
1509
- * when it is a node; an unnamed one — a parameter passed through, or an
1510
- * inline `(data) => {…}` written in a `useEffect` — is attributed to the
1511
- * enclosing function, where the event demonstrably lands. (The in-language
1512
- * synthesizer stays named-only; this channel pairs across a language
1513
- * boundary on a literal, which is the evidence that makes the wider
1514
- * attribution safe.)
1515
- *
1516
- * Provenance `'heuristic'`, synthesizedBy `'rn-event-channel'`.
1517
- */
1518
- // ObjC's `[self sendEventWithName:@"X" body:...]` shape (bracket syntax,
1519
- // `@` string literals).
1520
2208
  const RN_OBJC_SEND_RE = /\bsendEventWithName\s*:\s*@"([^"]+)"/g;
1521
- // Swift's `sendEvent(withName: "X", body: ...)` shape — same RCTEventEmitter
1522
- // method, different call syntax. Both Objective-C and Swift subclass
1523
- // RCTEventEmitter so this catches the Swift-side equivalent emission sites
1524
- // (e.g. RNFusedLocation.swift's `sendEvent(withName: "geolocationDidChange",
1525
- // body: locationData)`).
1526
2209
  const RN_SWIFT_SEND_RE = /\bsendEvent\s*\(\s*withName\s*:\s*"([^"]+)"/g;
1527
- // JVM-side emitter calls: `emitter.emit("X", body)`. Matches both Java
1528
- // and Kotlin syntax because the call form is identical. Restricted to
1529
- // JVM source files in the consumer so we don't re-process JS emits
1530
- // (which `eventEmitterEdges` already handles).
1531
2210
  const RN_JVM_EMIT_RE = /\.emit\s*\(\s*"([^"]+)"\s*,/g;
1532
- // Custom `sendEvent(reactContext, "X", body)` wrapper — extremely common
1533
- // (react-native-device-info and many libs wrap `DeviceEventManagerModule…emit`
1534
- // behind a helper whose `.emit(eventName, …)` uses a VARIABLE, so RN_JVM_EMIT_RE
1535
- // misses it; the literal lives in the wrapper CALL instead). Captures the first
1536
- // string literal inside a `sendEvent(...)` call. `[^;{}]*?` keeps it on one
1537
- // statement and stops at a block boundary, so the wrapper DEFINITION (whose `(`
1538
- // is followed by `… ) {`) never matches. Multi-line tolerant. (java/kotlin/swift)
1539
2211
  const RN_NATIVE_SENDEVENT_RE = /\bsendEvent\s*\([^;{}]*?"([^"]+)"/g;
2212
+ const RN_OBJC_SEND_CONST_RE = /\bsendEventWithName\s*:\s*([A-Za-z_]\w*)\b/g;
2213
+ const RN_SWIFT_SEND_CONST_RE = /\bsendEvent\s*\(\s*withName\s*:\s*([A-Za-z_][\w.]*)/g;
2214
+ const RN_JVM_EMIT_CONST_RE = /\.emit\s*\(\s*([A-Za-z_][\w.]*)\s*,/g;
2215
+ const RN_NATIVE_SENDEVENT_CONST_RE = /\bsendEvent\s*\(\s*[A-Za-z_][\w.]*\s*,\s*([A-Za-z_][\w.]*)\s*,/g;
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;
2217
+ const CONSTANT_KINDS = new Set(['constant', 'variable', 'field', 'property', 'enum_member']);
2218
+ function constantEventName(expr, file, ctx, memo) {
2219
+ const key = `${file}\0${expr}`;
2220
+ if (memo.has(key))
2221
+ return memo.get(key);
2222
+ const parts = expr.replace(/\.rawValue$/, '').split('.');
2223
+ const name = parts[parts.length - 1];
2224
+ const owner = parts.length > 1 ? parts[parts.length - 2] : null;
2225
+ let value = null;
2226
+ if (/^[A-Za-z_$][\w$]*$/.test(name) && name !== 'this' && (parts.length <= 2 || parts[0] !== 'this')) {
2227
+ const read = (n) => {
2228
+ const line = (ctx.getFileLines?.(n.filePath) ?? ctx.readFile(n.filePath)?.split(/\r?\n/))?.[n.startLine - 1] ?? '';
2229
+ const at = line.indexOf(name);
2230
+ if (at < 0)
2231
+ return null;
2232
+ const rest = line.slice(at + name.length);
2233
+ const m = /^\s*(?::[^=;]*)?[=:]\s*@?(["'`])([^"'`]+)\1/.exec(rest) ?? /^\s+@?(")([^"]+)"/.exec(rest);
2234
+ return m ? m[2] : null;
2235
+ };
2236
+ const declaredIn = (f) => ctx.getNodesInFile(f).filter((n) => n.name === name && CONSTANT_KINDS.has(n.kind));
2237
+ const js = /\.(?:[cm]?[jt]sx?)$/.test(file);
2238
+ const language = /\.tsx$/.test(file) ? 'tsx' : /\.[cm]?ts$/.test(file) ? 'typescript' : file.endsWith('.jsx') ? 'jsx' : 'javascript';
2239
+ const importedFile = (local) => {
2240
+ if (!js)
2241
+ return null;
2242
+ const binding = ctx.getImportMappings(file, language).find((m) => m.localName === local);
2243
+ return binding ? (0, import_resolver_1.resolveImportPath)(binding.source, file, language, ctx) : null;
2244
+ };
2245
+ let decls = [];
2246
+ if (owner === null) {
2247
+ decls = declaredIn(file);
2248
+ if (decls.length === 0) {
2249
+ const from = importedFile(name);
2250
+ if (from)
2251
+ decls = declaredIn(from);
2252
+ }
2253
+ }
2254
+ else {
2255
+ const from = importedFile(owner);
2256
+ decls = from
2257
+ ? declaredIn(from)
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))));
2259
+ }
2260
+ const values = new Set(decls.map(read).filter((v) => v !== null));
2261
+ value = values.size === 1 ? [...values][0] : null;
2262
+ }
2263
+ memo.set(key, value);
2264
+ return value;
2265
+ }
1540
2266
  async function rnEventEdges(ctx, onYield) {
1541
2267
  let scannedFiles = 0;
1542
- // Native dispatchers (source = the native method whose body sends the
1543
- // event) and JS handlers (target = the function/method registered as
1544
- // the listener) keyed by event name.
2268
+ const constants = new Map();
1545
2269
  const nativeDispatchersByEvent = new Map();
1546
2270
  const jsHandlersByEvent = new Map();
1547
2271
  for (const file of ctx.getAllFiles()) {
@@ -1560,8 +2284,6 @@ async function rnEventEdges(ctx, onYield) {
1560
2284
  set.add(disp.id);
1561
2285
  nativeDispatchersByEvent.set(event, set);
1562
2286
  };
1563
- // ObjC side: `sendEventWithName:@"X"` only fires inside `.m`/`.mm`
1564
- // files (RCTEventEmitter subclasses).
1565
2287
  if (file.endsWith('.m') || file.endsWith('.mm')) {
1566
2288
  RN_OBJC_SEND_RE.lastIndex = 0;
1567
2289
  let m;
@@ -1569,8 +2291,13 @@ async function rnEventEdges(ctx, onYield) {
1569
2291
  if (m[1])
1570
2292
  addDispatcher(m[1], lineOf(m.index));
1571
2293
  }
2294
+ RN_OBJC_SEND_CONST_RE.lastIndex = 0;
2295
+ while ((m = RN_OBJC_SEND_CONST_RE.exec(content))) {
2296
+ const event = constantEventName(m[1], file, ctx, constants);
2297
+ if (event)
2298
+ addDispatcher(event, lineOf(m.index));
2299
+ }
1572
2300
  }
1573
- // Swift side: same RCTEventEmitter method, parens/named-args syntax.
1574
2301
  if (file.endsWith('.swift')) {
1575
2302
  RN_SWIFT_SEND_RE.lastIndex = 0;
1576
2303
  let m;
@@ -1583,11 +2310,13 @@ async function rnEventEdges(ctx, onYield) {
1583
2310
  if (m[1])
1584
2311
  addDispatcher(m[1], lineOf(m.index));
1585
2312
  }
2313
+ RN_SWIFT_SEND_CONST_RE.lastIndex = 0;
2314
+ while ((m = RN_SWIFT_SEND_CONST_RE.exec(content))) {
2315
+ const event = constantEventName(m[1], file, ctx, constants);
2316
+ if (event)
2317
+ addDispatcher(event, lineOf(m.index));
2318
+ }
1586
2319
  }
1587
- // JVM side: `.emit("X", …)` in Java/Kotlin, plus the common
1588
- // `sendEvent(ctx, "X", body)` wrapper. (We pattern-match anywhere in the
1589
- // file; the JS in-language path uses a separate emitter object pattern and
1590
- // is already handled by eventEmitterEdges.)
1591
2320
  if (file.endsWith('.java') || file.endsWith('.kt')) {
1592
2321
  let m;
1593
2322
  RN_JVM_EMIT_RE.lastIndex = 0;
@@ -1600,26 +2329,22 @@ async function rnEventEdges(ctx, onYield) {
1600
2329
  if (m[1])
1601
2330
  addDispatcher(m[1], lineOf(m.index));
1602
2331
  }
2332
+ for (const re of [RN_JVM_EMIT_CONST_RE, RN_NATIVE_SENDEVENT_CONST_RE]) {
2333
+ re.lastIndex = 0;
2334
+ while ((m = re.exec(content))) {
2335
+ const event = constantEventName(m[1], file, ctx, constants);
2336
+ if (event)
2337
+ addDispatcher(event, lineOf(m.index));
2338
+ }
2339
+ }
1603
2340
  }
1604
- // JS subscribers (.addListener("X", handler)). Restrict to JS-family
1605
- // files so a native file's `addListener:` (the ObjC method) doesn't
1606
- // get mistaken for a JS subscription — they're entirely different
1607
- // things despite sharing a name.
1608
2341
  if (file.endsWith('.js') ||
1609
2342
  file.endsWith('.jsx') ||
1610
2343
  file.endsWith('.ts') ||
1611
2344
  file.endsWith('.tsx') ||
1612
2345
  file.endsWith('.mjs') ||
1613
2346
  file.endsWith('.cjs')) {
1614
- // Match BOTH the named-handler form (`.addListener('x', fn)`) and
1615
- // an unnamed-handler form (`.addListener('x', listener)` where
1616
- // `listener` is a parameter — common in RN wrapper APIs like
1617
- // RNFirebase's `messaging().onMessageReceived(listener)`). For the
1618
- // unnamed case we attribute the subscription to the ENCLOSING JS
1619
- // function (the abstraction layer), giving a reachability-correct
1620
- // hop even when the actual user-side handler lives one call up.
1621
2347
  const ADDLISTENER_ANY = /\.(?:on|once|addListener)\(\s*['"]([^'"]+)['"]\s*,\s*([A-Za-z_][\w.]*)/g;
1622
- // The inline form: `.addListener('x', (data) => {…})` / `function () {…}`.
1623
2348
  const ADDLISTENER_INLINE = /\.(?:on|once|addListener)\(\s*['"]([^'"]+)['"]\s*,\s*(?:async\s*)?(?:\([^)]*\)\s*=>|[A-Za-z_$][\w$]*\s*=>|function\s*\()/g;
1624
2349
  ADDLISTENER_ANY.lastIndex = 0;
1625
2350
  let m;
@@ -1629,26 +2354,15 @@ async function rnEventEdges(ctx, onYield) {
1629
2354
  if (!event || !arg)
1630
2355
  continue;
1631
2356
  const bareName = arg.includes('.') ? arg.slice(arg.lastIndexOf('.') + 1) : arg;
1632
- // Try a named-symbol match first (matches the in-language semantic).
1633
2357
  const namedHandler = ctx
1634
2358
  .getNodesByName(bareName)
1635
2359
  .find((n) => n.kind === 'function' || n.kind === 'method');
1636
2360
  let targetId = namedHandler?.id ?? null;
1637
2361
  if (!targetId) {
1638
- // Fall back to the enclosing function — the subscribe-wrapper
1639
- // pattern means the event fires THROUGH this function on its
1640
- // way to user code. Reachability-correct attribution.
1641
2362
  const enclosing = (0, synth_utils_1.enclosingFn)(nodesInFile, lineOf(m.index));
1642
2363
  targetId = enclosing?.id ?? null;
1643
2364
  }
1644
2365
  if (!targetId) {
1645
- // Broader fallback for JS object-literal API shape
1646
- // (`const Foo = { watchX(...) { … addListener(...) … } }`):
1647
- // method shorthand inside an object literal isn't extracted
1648
- // as a method node, so enclosingFn returns null. Attribute to
1649
- // the smallest enclosing `constant` / `variable` node — that's
1650
- // the API surface a downstream caller would `import` and
1651
- // invoke. Reachability-correct.
1652
2366
  const line = lineOf(m.index);
1653
2367
  let smallest = null;
1654
2368
  for (const n of nodesInFile) {
@@ -1668,13 +2382,6 @@ async function rnEventEdges(ctx, onYield) {
1668
2382
  map.set(targetId, `${file}:${lineOf(m.index)}`);
1669
2383
  jsHandlersByEvent.set(event, map);
1670
2384
  }
1671
- // Inline listeners — the shape a React component registers inside a
1672
- // `useEffect`: `nativeEmitter.addListener('onCaptureComplete', (data) =>
1673
- // { … router.push('/review') })`. There is no handler symbol to name,
1674
- // so the subscription is attributed to the enclosing function exactly
1675
- // as the unnamed-argument form above is: the native event lands in that
1676
- // component, and its body is where a reader looks next. This channel
1677
- // only — the in-language synthesizer keeps its named-handler policy.
1678
2385
  ADDLISTENER_INLINE.lastIndex = 0;
1679
2386
  while ((m = ADDLISTENER_INLINE.exec(content))) {
1680
2387
  const event = m[1];
@@ -1688,6 +2395,23 @@ async function rnEventEdges(ctx, onYield) {
1688
2395
  map.set(enclosing.id, `${file}:${lineOf(m.index)}`);
1689
2396
  jsHandlersByEvent.set(event, map);
1690
2397
  }
2398
+ RN_JS_LISTEN_CONST_RE.lastIndex = 0;
2399
+ while ((m = RN_JS_LISTEN_CONST_RE.exec(content))) {
2400
+ const event = constantEventName(m[1], file, ctx, constants);
2401
+ if (!event)
2402
+ continue;
2403
+ const arg = m[2];
2404
+ const bare = /^[A-Za-z_$][\w$.]*$/.test(arg) ? arg.slice(arg.lastIndexOf('.') + 1) : null;
2405
+ const line = lineOf(m.index);
2406
+ const named = bare ? nodesInFile.find((n) => (n.kind === 'function' || n.kind === 'method') && n.name === bare) : undefined;
2407
+ const target = named ?? (0, synth_utils_1.enclosingFn)(nodesInFile, line);
2408
+ if (!target)
2409
+ continue;
2410
+ const map = jsHandlersByEvent.get(event) ?? new Map();
2411
+ if (!map.has(target.id))
2412
+ map.set(target.id, `${file}:${line}`);
2413
+ jsHandlersByEvent.set(event, map);
2414
+ }
1691
2415
  }
1692
2416
  }
1693
2417
  const edges = [];
@@ -1696,9 +2420,6 @@ async function rnEventEdges(ctx, onYield) {
1696
2420
  const handlers = jsHandlersByEvent.get(event);
1697
2421
  if (!handlers)
1698
2422
  continue;
1699
- // Same fan-out guard as the in-language channel: generic event names
1700
- // (e.g. 'change', 'error', 'data') with many handlers/dispatchers
1701
- // can't be matched precisely without receiver-type info.
1702
2423
  if (dispatchers.size > EVENT_FANOUT_CAP || handlers.size > EVENT_FANOUT_CAP)
1703
2424
  continue;
1704
2425
  for (const d of dispatchers) {
@@ -1721,41 +2442,7 @@ async function rnEventEdges(ctx, onYield) {
1721
2442
  }
1722
2443
  return edges;
1723
2444
  }
1724
- /**
1725
- * Phase 6 — React Native Fabric/Codegen view component bridge.
1726
- *
1727
- * The Fabric framework extractor (`frameworks/fabric.ts`) emits
1728
- * `component` nodes named after the JS-visible component (e.g.
1729
- * `RNSScreenStack`) from each `codegenNativeComponent<Props>('Name')`
1730
- * spec declaration. The native implementation lives in an ObjC++/.mm or
1731
- * Kotlin/Java class whose name follows one of RN's conventions:
1732
- *
1733
- * - Exact: `RNSScreenStack`
1734
- * - With suffix: `RNSScreenStackView`, `RNSScreenStackViewManager`,
1735
- * `RNSScreenStackComponentView`, `RNSScreenStackManager`
1736
- *
1737
- * This synthesizer walks every Fabric component node and looks for a
1738
- * native class matching one of those names; when found, emits a
1739
- * `calls` edge `component → native class` (provenance `'heuristic'`,
1740
- * `synthesizedBy:'fabric-native-impl'`) so trace from JSX usage of the
1741
- * component continues into native.
1742
- *
1743
- * The convention-based suffix lookup is precise: there's no name
1744
- * collision in RN view-manager codebases by design (Codegen output would
1745
- * conflict otherwise).
1746
- */
1747
2445
  const FABRIC_NATIVE_SUFFIXES = ['', 'View', 'ViewManager', 'ComponentView', 'Manager'];
1748
- /**
1749
- * Expo Modules cross-platform pairing. An Expo Module exposes the SAME
1750
- * JS-visible method (`AsyncFunction("getBatteryLevelAsync")`) from BOTH an iOS
1751
- * (Swift) and an Android (Kotlin) implementation. A JS callsite name-resolves to
1752
- * only ONE of them, so the other platform's impl looked like nothing called it
1753
- * (and editing it showed no blast radius). Link the iOS and Android impls of the
1754
- * same `<module>.<method>` to each other (both directions), so a JS call that
1755
- * reaches one platform reaches the other, and editing either surfaces the JS
1756
- * caller. The Expo method nodes are id-prefixed `expo-module:` and qualified
1757
- * `<file>::<module>.<method>` by the framework extractor.
1758
- */
1759
2446
  async function expoCrossPlatformEdges(queries, onYield) {
1760
2447
  let scanned255 = 0;
1761
2448
  const edges = [];
@@ -1766,7 +2453,7 @@ async function expoCrossPlatformEdges(queries, onYield) {
1766
2453
  await onYield();
1767
2454
  if (!m.id.startsWith('expo-module:'))
1768
2455
  continue;
1769
- const key = m.qualifiedName.split('::').pop(); // `<module>.<method>`
2456
+ const key = m.qualifiedName.split('::').pop();
1770
2457
  if (!key)
1771
2458
  continue;
1772
2459
  const arr = byKey.get(key);
@@ -1781,7 +2468,7 @@ async function expoCrossPlatformEdges(queries, onYield) {
1781
2468
  for (const a of group) {
1782
2469
  for (const b of group) {
1783
2470
  if (a.id === b.id || a.language === b.language)
1784
- continue; // cross-platform only
2471
+ continue;
1785
2472
  const key = `${a.id}>${b.id}`;
1786
2473
  if (seen.has(key))
1787
2474
  continue;
@@ -1799,28 +2486,12 @@ async function expoCrossPlatformEdges(queries, onYield) {
1799
2486
  }
1800
2487
  return edges;
1801
2488
  }
1802
- /**
1803
- * Classic React Native NativeModules cross-platform pairing. A native module
1804
- * method (`@ReactMethod` on Android, `RCT_EXPORT_METHOD` on iOS) is implemented
1805
- * on BOTH platforms, but a JS callsite name-resolves to only ONE — so the other
1806
- * platform's impl looked like nothing called it. A native method that HAS a JS
1807
- * caller is a confirmed bridge method; link it to the same-named native method
1808
- * in another language (the other platform's impl) so a JS call reaching one
1809
- * platform reaches the other, and editing either surfaces the JS caller.
1810
- *
1811
- * Names are normalized to the first selector keyword (`getFreeDiskStorage:` →
1812
- * `getFreeDiskStorage`) — that's the JS-visible name, and how the iOS selector
1813
- * lines up with the bare Android method name.
1814
- */
1815
2489
  async function rnCrossPlatformEdges(queries, onYield) {
1816
2490
  let scanned255 = 0;
1817
2491
  const edges = [];
1818
2492
  const seen = new Set();
1819
2493
  const NATIVE = new Set(['java', 'kotlin', 'objc', 'cpp']);
1820
2494
  const JS = new Set(['typescript', 'tsx', 'javascript', 'jsx']);
1821
- // RN module INFRASTRUCTURE methods exist on every native module (called by the
1822
- // RN runtime, not user JS), so pairing them by name would cross-link unrelated
1823
- // modules in a multi-module repo. Skip them — they aren't user-facing methods.
1824
2495
  const RN_INFRA = new Set([
1825
2496
  'addListener', 'removeListeners', 'getConstants', 'constantsToExport', 'getName',
1826
2497
  'invalidate', 'initialize', 'getDefaultEventTypes', 'supportedEvents',
@@ -1830,9 +2501,6 @@ async function rnCrossPlatformEdges(queries, onYield) {
1830
2501
  const i = name.indexOf(':');
1831
2502
  return i >= 0 ? name.slice(0, i) : name;
1832
2503
  };
1833
- // Index native methods by their JS-visible (normalized) name. Only names with
1834
- // impls in ≥2 native languages can pair, so the per-method JS-caller check
1835
- // below only runs for genuine cross-platform candidates.
1836
2504
  const byName = new Map();
1837
2505
  for (const m of queries.iterateNodesByKindIn('method', [...NATIVE])) {
1838
2506
  if ((++scanned255 & 63) === 0)
@@ -1849,9 +2517,8 @@ async function rnCrossPlatformEdges(queries, onYield) {
1849
2517
  continue;
1850
2518
  const langs = new Set(group.map((m) => m.language));
1851
2519
  if (langs.size < 2)
1852
- continue; // single-platform — nothing to pair
2520
+ continue;
1853
2521
  for (const m of group) {
1854
- // Is m a bridge method? (a JS-language `calls` edge points at it)
1855
2522
  const incoming = queries.getIncomingEdges(m.id, ['calls']);
1856
2523
  if (incoming.length === 0)
1857
2524
  continue;
@@ -1862,7 +2529,6 @@ async function rnCrossPlatformEdges(queries, onYield) {
1862
2529
  });
1863
2530
  if (!isBridge)
1864
2531
  continue;
1865
- // Link to the other-platform impls (both directions).
1866
2532
  for (const sib of group) {
1867
2533
  if (sib.id === m.id || sib.language === m.language)
1868
2534
  continue;
@@ -1889,9 +2555,6 @@ async function fabricNativeImplEdges(ctx, onYield) {
1889
2555
  let scanned255 = 0;
1890
2556
  const edges = [];
1891
2557
  const seen = new Set();
1892
- // The Fabric extractor IDs are prefixed `fabric-component:` so we can
1893
- // filter to just those while streaming — never materializing the whole
1894
- // `component` kind (#1212).
1895
2558
  const components = [];
1896
2559
  for (const n of (ctx.iterateNodesByKind?.('component') ?? ctx.getNodesByKind('component'))) {
1897
2560
  if ((++scanned255 & 63) === 0)
@@ -1901,7 +2564,6 @@ async function fabricNativeImplEdges(ctx, onYield) {
1901
2564
  }
1902
2565
  if (components.length === 0)
1903
2566
  return edges;
1904
- // Pre-index native classes by name for O(1) lookup.
1905
2567
  const nativeClassesByName = new Map();
1906
2568
  for (const n of (ctx.iterateNodesByKind?.('class') ?? ctx.getNodesByKind('class'))) {
1907
2569
  if ((++scanned255 & 63) === 0)
@@ -1920,8 +2582,6 @@ async function fabricNativeImplEdges(ctx, onYield) {
1920
2582
  const matches = nativeClassesByName.get(candidate);
1921
2583
  if (!matches || matches.length === 0)
1922
2584
  continue;
1923
- // Link the component node to every matching native class (iOS +
1924
- // Android each have one).
1925
2585
  for (const native of matches) {
1926
2586
  const key = `${component.id}>${native.id}`;
1927
2587
  if (seen.has(key))
@@ -1943,30 +2603,10 @@ async function fabricNativeImplEdges(ctx, onYield) {
1943
2603
  }
1944
2604
  return edges;
1945
2605
  }
1946
- /**
1947
- * MyBatis: link a Java mapper interface method to the XML statement that holds
1948
- * its SQL. The XML extractor (`src/extraction/mybatis-extractor.ts`) qualifies
1949
- * each `<select|insert|update|delete|sql id="X">` as `<namespace>::<id>` where
1950
- * `<namespace>` is the Java FQN of the mapper interface. A Java method's
1951
- * qualifiedName ends with `<ClassName>::<methodName>`, so we suffix-match the
1952
- * last two segments of the XML qualified name to find a unique Java method by
1953
- * `<ClassName>::<methodName>` (`ClassName` = last dotted segment of the XML
1954
- * namespace). Cross-mapper `<include refid="other.X">` references go through
1955
- * the normal qualified-name resolver — only the Java↔XML bridge is synthetic.
1956
- *
1957
- * Precision over recall: ambiguous mappers (multiple Java classes with the
1958
- * same simple name) are dropped. We need-not bridge by package because Java
1959
- * mapper interfaces are typically uniquely named within a project.
1960
- */
1961
2606
  async function mybatisJavaXmlEdges(queries, onYield) {
1962
2607
  let scanned255 = 0;
1963
2608
  const edges = [];
1964
2609
  const seen = new Set();
1965
- // Collect the XML side FIRST (mapper `<select id=…>` statements extracted as
1966
- // xml-language method nodes): if the project has none — every Java+XML repo
1967
- // that doesn't use MyBatis — return before paying the full java-method
1968
- // stream below. Same rowid stream order as matching inline, so the edge
1969
- // output is byte-identical when mappers do exist.
1970
2610
  const xmlMethods = [];
1971
2611
  for (const m of queries.iterateNodesByKindIn('method', ['xml'])) {
1972
2612
  if ((++scanned255 & 63) === 0)
@@ -1975,7 +2615,6 @@ async function mybatisJavaXmlEdges(queries, onYield) {
1975
2615
  }
1976
2616
  if (xmlMethods.length === 0)
1977
2617
  return edges;
1978
- // Index Java methods by `<ClassName>::<methodName>` for O(1) lookup.
1979
2618
  const javaIndex = new Map();
1980
2619
  for (const m of queries.iterateNodesByKindIn('method', ['java', 'kotlin'])) {
1981
2620
  if ((++scanned255 & 63) === 0)
@@ -1995,7 +2634,6 @@ async function mybatisJavaXmlEdges(queries, onYield) {
1995
2634
  for (const xml of xmlMethods) {
1996
2635
  if ((++scanned255 & 63) === 0)
1997
2636
  await onYield();
1998
- // Qualified name: `<namespace>::<id>`. Extract the simple class name.
1999
2637
  const colonIdx = xml.qualifiedName.lastIndexOf('::');
2000
2638
  if (colonIdx < 0)
2001
2639
  continue;
@@ -2008,8 +2646,6 @@ async function mybatisJavaXmlEdges(queries, onYield) {
2008
2646
  const candidates = javaIndex.get(`${className}::${id}`);
2009
2647
  if (!candidates || candidates.length === 0)
2010
2648
  continue;
2011
- // Drop ambiguous matches (multiple same-name classes); the user can
2012
- // disambiguate by adding the package-suffix match in a future enhancement.
2013
2649
  if (candidates.length > 1)
2014
2650
  continue;
2015
2651
  const java = candidates[0];
@@ -2032,34 +2668,8 @@ async function mybatisJavaXmlEdges(queries, onYield) {
2032
2668
  }
2033
2669
  return edges;
2034
2670
  }
2035
- /**
2036
- * Gin middleware chain. Gin runs its entire handler chain through one dynamic
2037
- * line in `(*Context).Next`:
2038
- * for c.index < len(c.handlers) { c.handlers[c.index](c); c.index++ }
2039
- * `c.handlers` is a `HandlersChain` (`[]HandlerFunc`) assembled at registration
2040
- * time by `combineHandlers` from the funcs passed to `r.Use(...)` /
2041
- * `r.GET("/path", h...)` / `r.Handle(...)`. Because the call is a computed index
2042
- * into a runtime-built slice, tree-sitter resolves `c.handlers[c.index](c)` to
2043
- * NOTHING — so `callees(Next)` is just the `len()` helper and the flow
2044
- * `ServeHTTP → handleHTTPRequest → Next` dead-ends at the exact symbol the
2045
- * "how do requests flow through the middleware chain" question is about. The
2046
- * agent then re-queries Next and falls back to Read/grep (validated: the gin
2047
- * WITH-arm rabbit-holed on precisely this dead-end).
2048
- *
2049
- * Bridge it: find the chain DISPATCHER (a Go method whose body invokes a
2050
- * `handlers` slice by index) and link it → every HandlerFunc registered via a
2051
- * gin registration call, so `callees(Next)` and `trace(ServeHTTP, <handler>)`
2052
- * connect end-to-end. Named handlers only (`gin.Logger()` → `Logger`,
2053
- * `authMiddleware`); inline closures are anonymous and skipped. Like
2054
- * react-render / interface-impl this is a deliberate over-approximation —
2055
- * reachability-correct (any registered handler CAN run for some route), capped,
2056
- * and gated on the dispatcher existing so it never runs on non-gin Go repos.
2057
- * Provenance `heuristic`, `synthesizedBy:'gin-middleware-chain'`; `registeredAt`
2058
- * is the `.Use`/`.GET` site an agent would otherwise grep for.
2059
- */
2060
- const GIN_DISPATCH_RE = /\.handlers\s*\[[^\]]*\]\s*\(/; // c.handlers[c.index](c)
2671
+ const GIN_DISPATCH_RE = /\.handlers\s*\[[^\]]*\]\s*\(/;
2061
2672
  const GIN_REG_RE = /\.(?:Use|GET|POST|PUT|PATCH|DELETE|OPTIONS|HEAD|Any|Handle)\s*\(/g;
2062
- /** Balanced `(...)` body starting at the '(' index; null if unbalanced. */
2063
2673
  function goBalancedArgs(s, openIdx) {
2064
2674
  let depth = 0;
2065
2675
  for (let i = openIdx; i < s.length; i++) {
@@ -2074,7 +2684,6 @@ function goBalancedArgs(s, openIdx) {
2074
2684
  }
2075
2685
  return null;
2076
2686
  }
2077
- /** Split a top-level comma list, respecting nested () [] {}. */
2078
2687
  function goSplitArgs(args) {
2079
2688
  const out = [];
2080
2689
  let depth = 0, cur = '';
@@ -2098,9 +2707,8 @@ function goSplitArgs(args) {
2098
2707
  out.push(cur);
2099
2708
  return out;
2100
2709
  }
2101
- /** Tail ident of a handler arg: `gin.Logger()`→`Logger`, `mw`→`mw`; null for string paths / closures. */
2102
2710
  function goHandlerIdent(expr) {
2103
- const cleaned = expr.trim().replace(/\(\s*\)$/, ''); // drop a trailing call ()
2711
+ const cleaned = expr.trim().replace(/\(\s*\)$/, '');
2104
2712
  if (!cleaned || cleaned.startsWith('"') || cleaned.startsWith('`') || cleaned.startsWith('func'))
2105
2713
  return null;
2106
2714
  const m = cleaned.match(/(?:\.|^)([A-Za-z_]\w*)$/);
@@ -2109,7 +2717,6 @@ function goHandlerIdent(expr) {
2109
2717
  async function ginMiddlewareChainEdges(queries, ctx, onYield) {
2110
2718
  let scanned255 = 0;
2111
2719
  let scannedFiles = 0;
2112
- // 1. Find the chain dispatcher(s): a Go method that invokes a `handlers` slice by index.
2113
2720
  const dispatchers = [];
2114
2721
  for (const n of queries.iterateNodesByKindIn('method', ['go'])) {
2115
2722
  if ((++scanned255 & 63) === 0)
@@ -2120,11 +2727,8 @@ async function ginMiddlewareChainEdges(queries, ctx, onYield) {
2120
2727
  dispatchers.push(n);
2121
2728
  }
2122
2729
  if (dispatchers.length === 0)
2123
- return []; // not a gin repo — bail
2124
- // 2. Collect handler identifiers registered via gin registration calls
2125
- // (.Use / .GET / … / .Handle). String args (paths/methods) and inline
2126
- // closures are dropped by goHandlerIdent; the rest are HandlerFuncs.
2127
- const registered = new Map(); // name → registeredAt (file:line)
2730
+ return [];
2731
+ const registered = new Map();
2128
2732
  for (const file of ctx.getAllFiles()) {
2129
2733
  if ((++scannedFiles & 15) === 0)
2130
2734
  await onYield();
@@ -2141,7 +2745,7 @@ async function ginMiddlewareChainEdges(queries, ctx, onYield) {
2141
2745
  const argStr = goBalancedArgs(safe, parenIdx);
2142
2746
  if (!argStr)
2143
2747
  continue;
2144
- const line = safe.slice(0, m.index).split('\n').length;
2748
+ const line = lineOf(safe, m.index);
2145
2749
  for (const arg of goSplitArgs(argStr)) {
2146
2750
  const name = goHandlerIdent(arg);
2147
2751
  if (name && !registered.has(name))
@@ -2151,7 +2755,6 @@ async function ginMiddlewareChainEdges(queries, ctx, onYield) {
2151
2755
  }
2152
2756
  if (registered.size === 0)
2153
2757
  return [];
2154
- // 3. Link each dispatcher → each registered handler node (dedup, capped).
2155
2758
  const edges = [];
2156
2759
  const seen = new Set();
2157
2760
  for (const disp of dispatchers) {
@@ -2176,13 +2779,6 @@ async function ginMiddlewareChainEdges(queries, ctx, onYield) {
2176
2779
  }
2177
2780
  return edges;
2178
2781
  }
2179
- /**
2180
- * Delphi form code-behind: a form unit `UFRMAbout.pas` owns its visual form
2181
- * definition `UFRMAbout.dfm` (VCL) / `.fmx` (FireMonkey) — paired by basename in
2182
- * the same directory, wired by the `{$R *.dfm}` directive rather than a `uses`
2183
- * clause. Link the unit → its form so a `.dfm`/`.fmx` used only as a form
2184
- * definition isn't orphaned, and editing the form surfaces its code-behind unit.
2185
- */
2186
2782
  async function pascalFormEdges(ctx, onYield) {
2187
2783
  let scannedFiles = 0;
2188
2784
  const edges = [];
@@ -2210,21 +2806,6 @@ async function pascalFormEdges(ctx, onYield) {
2210
2806
  }
2211
2807
  return edges;
2212
2808
  }
2213
- /**
2214
- * SvelteKit file-convention data flow. A route directory's `+page.svelte` (a
2215
- * `component` node) receives its `data` from the sibling `+page.server.{ts,js}`
2216
- * / `+page.{ts,js}` `load` function and posts forms to its `actions` — wired by
2217
- * the framework BY FILE PATH, with no static import between them. So editing a
2218
- * `load` shows no impact on the page it feeds, and the page looks like it has no
2219
- * server-side dependency. Link the page component to its sibling loader's
2220
- * `load` / `actions` (same for `+layout`). The pairing is path-deterministic
2221
- * (same directory, matching `+page`/`+layout` prefix), so it's precise — but
2222
- * it's a framework-convention edge, so provenance stays `heuristic`.
2223
- *
2224
- * Direction: page → load, so `getImpactRadius(load)` surfaces the page (editing
2225
- * a loader's data shows the page it feeds) and the page's dependencies include
2226
- * its loader.
2227
- */
2228
2809
  async function svelteKitLoadEdges(ctx, onYield) {
2229
2810
  let scannedFiles = 0;
2230
2811
  const edges = [];
@@ -2247,10 +2828,6 @@ async function svelteKitLoadEdges(ctx, onYield) {
2247
2828
  if (!allFiles.has(loaderFile))
2248
2829
  continue;
2249
2830
  for (const hook of ctx.getNodesInFile(loaderFile)) {
2250
- // `load` and `actions` by name, and every function the loader file
2251
- // declares — a form action is an arrow inside `actions`, and it is a
2252
- // node of its own (`default`, `logout`), where the redirect that ends
2253
- // the submission is actually written.
2254
2831
  const named = HOOK_KINDS.has(hook.kind) && HOOKS.has(hook.name);
2255
2832
  if (!named && hook.kind !== 'function' && hook.kind !== 'method')
2256
2833
  continue;
@@ -2271,19 +2848,6 @@ async function svelteKitLoadEdges(ctx, onYield) {
2271
2848
  }
2272
2849
  return edges;
2273
2850
  }
2274
- /**
2275
- * Redux-thunk dispatch chain. `export const X = createAsyncThunk(prefix, async (a, api) => {...})`
2276
- * (or a wrapper like trezor's `createThunk(...)`) passes the async body as an ARGUMENT, so
2277
- * tree-sitter never extracts it as a function node: `X` is a `constant` whose body's calls are
2278
- * ORPHANED. The `dispatch(nextThunk(...))` calls that drive a thunk chain forward therefore produce
2279
- * no edges, so `callees(X)` is empty and a flow `dispatch(X(...)) → X → nextThunk` dead-ends at the
2280
- * constant (validated on trezor-suite: the signXxxThunk constants had ZERO outgoing edges). Bridge
2281
- * it: body-scan each thunk constant for `dispatch(Y(...))` and link `X → Y`, so the dispatch chain
2282
- * connects. High-precision — the `dispatch(` keyword plus `Y` must resolve to a function/constant/
2283
- * method node; capped; gated on thunk constants existing so it never runs on non-RTK repos.
2284
- * Cross-file by design (a suite thunk dispatches a wallet-core thunk). Provenance `heuristic`,
2285
- * `synthesizedBy:'redux-thunk'`; `registeredAt` is the dispatch site.
2286
- */
2287
2851
  const THUNK_DECL_RE = /create(?:Async)?Thunk/;
2288
2852
  const THUNK_DISPATCH_RE = /\bdispatch\s*\(\s*([A-Za-z_]\w*)\s*[(),]/g;
2289
2853
  const THUNK_FANOUT_CAP = 24;
@@ -2294,15 +2858,12 @@ async function reduxThunkEdges(queries, ctx, onYield) {
2294
2858
  for (const node of queries.iterateNodesByKind('constant')) {
2295
2859
  if ((++scanned255 & 63) === 0)
2296
2860
  await onYield();
2297
- // Cheap gate: the initializer (captured in `signature`) must be a create(Async)Thunk call —
2298
- // avoids reading every constant's body on a large repo.
2299
2861
  if (!node.signature || !THUNK_DECL_RE.test(node.signature))
2300
2862
  continue;
2301
2863
  const content = ctx.readFile(node.filePath);
2302
2864
  const src = content && sliceLines(content, node.startLine, node.endLine);
2303
2865
  if (!src)
2304
2866
  continue;
2305
- // Thunks are TS/JS-family (same // and /* */ comment syntax); map to a CommentLang.
2306
2867
  const safe = (0, strip_comments_1.stripCommentsForRegex)(src, node.language === 'javascript' || node.language === 'jsx' ? 'javascript' : 'typescript');
2307
2868
  THUNK_DISPATCH_RE.lastIndex = 0;
2308
2869
  let m;
@@ -2310,13 +2871,7 @@ async function reduxThunkEdges(queries, ctx, onYield) {
2310
2871
  while ((m = THUNK_DISPATCH_RE.exec(safe)) && added < THUNK_FANOUT_CAP) {
2311
2872
  const name = m[1];
2312
2873
  if (name === node.name)
2313
- continue; // self-dispatch (recursive thunk) — skip
2314
- // Resolve the dispatched name, PREFERRING the thunk/action-creator over a same-named
2315
- // service function. `dispatch(X(...))` dispatches a thunk or an action-creator (both
2316
- // `constant`s) — never an unrelated helper that merely shares the name. On octo-call,
2317
- // `leaveCall` is BOTH a `createAsyncThunk` const AND a service function, and the bare
2318
- // `.find()` picked the function (wrong). Order: thunk const > other const > same-file
2319
- // callable > first match. A single candidate (no collision) is unaffected.
2874
+ continue;
2320
2875
  const cands = ctx
2321
2876
  .getNodesByName(name)
2322
2877
  .filter((n) => n.kind === 'constant' || n.kind === 'function' || n.kind === 'method');
@@ -2330,7 +2885,7 @@ async function reduxThunkEdges(queries, ctx, onYield) {
2330
2885
  if (seen.has(key))
2331
2886
  continue;
2332
2887
  seen.add(key);
2333
- const line = node.startLine + safe.slice(0, m.index).split('\n').length - 1;
2888
+ const line = node.startLine + lineOf(safe, m.index) - 1;
2334
2889
  edges.push({
2335
2890
  source: node.id,
2336
2891
  target: target.id,
@@ -2344,36 +2899,16 @@ async function reduxThunkEdges(queries, ctx, onYield) {
2344
2899
  }
2345
2900
  return edges;
2346
2901
  }
2347
- // ── Object-literal registry dispatch ─────────────────────────────────────────
2348
- // A command/handler registry maps string keys → handler class/function symbols in an
2349
- // object literal, then dispatches by a RUNTIME key static parsing can't follow:
2350
- // this.commands = { [Cmd.ADD]: AddObjectCommand, ... } // registration
2351
- // new this.commands[command](args).execute() // dynamic dispatch
2352
- // Bridge it like gin-middleware-chain: link each dispatching function → each registered
2353
- // handler's callable entry (a class's execute/run/handle/… method — preferring the method
2354
- // chained at the dispatch site — or the function value). Scoped to a registry + dispatch in
2355
- // the SAME file (the cross-file barrel-namespace variant, e.g. trezor's getMethod, is
2356
- // deferred). Gated on a real object literal with ≥2 entries that RESOLVE to callables (a
2357
- // `{ width: 5 }` literal resolves to nothing → no edges); fan-out capped.
2358
- // Both scans only START a name at an identifier's first character (or at a `this.`): the
2359
- // engine otherwise retries the greedy name at every later character of every identifier in
2360
- // the file. A match found from inside an identifier always has one from the identifier's
2361
- // start (same name tail, same continuation), so the result is unchanged — except where the
2362
- // scan itself resumes mid-identifier after a dispatch ending in `.method`, which
2363
- // `nextRegistryDispatch` covers with the unguarded pattern.
2364
2902
  const REGISTRY_NAME_START = String.raw `(?:(?<![A-Za-z_$])(?<![A-Za-z_$][\w$]+)|(?=this\.))`;
2365
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');
2366
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_$])`;
2367
2905
  const REGISTRY_DISPATCH_AT = new RegExp(REGISTRY_DISPATCH_SRC, 'y');
2368
- // `\bnew` can follow a `$` inside an identifier run, hence the extra `(?<!\w)` start.
2369
2906
  const REGISTRY_DISPATCH_RE = new RegExp(String.raw `(?:(?<!\w)|${REGISTRY_NAME_START})${REGISTRY_DISPATCH_SRC}`, 'g');
2370
2907
  const IDENT_RUN_CHAR = /[\w$]/;
2371
2908
  const REGISTRY_MIN_ENTRIES = 2;
2372
2909
  const REGISTRY_FANOUT_CAP = 40;
2373
2910
  const REGISTRY_CLASS_ENTRY = new Set(['execute', 'run', 'handle', 'perform', 'process', 'call', 'apply', 'dispatch']);
2374
2911
  const REGISTRY_JS_EXT = /\.(?:ts|tsx|js|jsx|mjs|cjs)$/;
2375
- /** The first registry dispatch at or after `from`, exactly as a `g` scan of the unguarded
2376
- * pattern resuming at `from` would find it. */
2377
2912
  function nextRegistryDispatch(src, from) {
2378
2913
  let at = from;
2379
2914
  if (at > 0 && at < src.length && IDENT_RUN_CHAR.test(src[at - 1]) && IDENT_RUN_CHAR.test(src[at])) {
@@ -2387,7 +2922,6 @@ function nextRegistryDispatch(src, from) {
2387
2922
  REGISTRY_DISPATCH_RE.lastIndex = at;
2388
2923
  return REGISTRY_DISPATCH_RE.exec(src);
2389
2924
  }
2390
- /** From the index of an opening `{`, return the brace-balanced body up to its matching `}`. */
2391
2925
  function braceBody(src, openIdx) {
2392
2926
  let depth = 0;
2393
2927
  for (let i = openIdx; i < src.length; i++) {
@@ -2398,11 +2932,6 @@ function braceBody(src, openIdx) {
2398
2932
  }
2399
2933
  return null;
2400
2934
  }
2401
- /** Top-level `key: Identifier` entries of an object-literal body. DEPTH-AWARE: only depth-0
2402
- * segments are considered, so method-shorthand bodies (`number(a,b){…}`), arrow values
2403
- * (`x: () => …`), and nested objects (`x: { … }`) don't leak their inner `k: v` pairs as
2404
- * bogus handlers. The per-segment anchor (`^… key: Ident …$`) keeps only pure identifier
2405
- * values — a data value (`x: 5`), call, or arrow fails to match. */
2406
2935
  function registryEntryNames(body) {
2407
2936
  const segs = [];
2408
2937
  let depth = 0;
@@ -2427,8 +2956,6 @@ function registryEntryNames(body) {
2427
2956
  }
2428
2957
  return names;
2429
2958
  }
2430
- /** Resolve a registered handler name to its callable entry: a function value, or a class's
2431
- * `execute`-like method (preferring the method chained at the dispatch site), else the class. */
2432
2959
  function resolveRegistryHandler(ctx, name, chained) {
2433
2960
  const cands = ctx.getNodesByName(name);
2434
2961
  const fn = cands.find((n) => n.kind === 'function');
@@ -2445,9 +2972,6 @@ function resolveRegistryHandler(ctx, name, chained) {
2445
2972
  methods.find((m) => m.name === 'constructor');
2446
2973
  return entry ?? cls;
2447
2974
  }
2448
- // Require a CALLABLE target — a registry dispatched as `reg[k](…)` invokes a function/
2449
- // method, never a data `constant` (dropping it removes false positives like a `{ x: URL }`
2450
- // entry resolving to the global URL constant).
2451
2975
  return cands.find((n) => n.kind === 'method') ?? null;
2452
2976
  }
2453
2977
  async function objectRegistryEdges(ctx, onYield) {
@@ -2459,22 +2983,16 @@ async function objectRegistryEdges(ctx, onYield) {
2459
2983
  if ((++scannedFiles & 15) === 0)
2460
2984
  await onYield();
2461
2985
  if ((++scanned & 255) === 0)
2462
- await onYield(); // #1091: yield mid-scan on huge graphs
2986
+ await onYield();
2463
2987
  if (!REGISTRY_JS_EXT.test(file))
2464
2988
  continue;
2465
2989
  const content = ctx.readFile(file);
2466
- // Cheap pre-filter: a computed member access BY NAME (`ident[ident`) — the dispatch shape.
2467
2990
  if (!content || !/[\w$]\s*\[\s*[A-Za-z_$]/.test(content))
2468
2991
  continue;
2469
- // Skip minified/generated bundles (draco, three.min, base64…): their pervasive `h[x](...)`
2470
- // calls + single-letter `{a:b}` literals are a false-positive minefield. Average line
2471
- // length is the reliable tell — real source ~30–80, minified in the hundreds/thousands.
2472
2992
  const newlines = (content.match(/\n/g)?.length ?? 0) + 1;
2473
2993
  if (content.length / newlines > 200)
2474
2994
  continue;
2475
2995
  const safe = (0, strip_comments_1.stripCommentsForRegex)(content, /\.(?:jsx?|mjs|cjs)$/.test(file) ? 'javascript' : 'typescript');
2476
- // 1. Dispatch sites: `(new )?<ref>[<ident-key>]` followed by a call or a chained method.
2477
- // A quoted-string key (`['save']`) does NOT match — that's a static access, not dispatch.
2478
2996
  const lineOf = (0, synth_utils_1.makeLineAt)(safe, 1);
2479
2997
  const dispatches = [];
2480
2998
  for (let dm = nextRegistryDispatch(safe, 0); dm; dm = nextRegistryDispatch(safe, dm.index + dm[0].length)) {
@@ -2484,11 +3002,8 @@ async function objectRegistryEdges(ctx, onYield) {
2484
3002
  }
2485
3003
  if (!dispatches.length)
2486
3004
  continue;
2487
- // Normalize a leading `this.` so a class FIELD-INITIALIZER registry (`commands = {…}`)
2488
- // matches a `this.commands[k]` dispatch, not just the constructor form `this.commands = {…}`.
2489
3005
  const norm = (r) => r.replace(/^this\./, '');
2490
3006
  const refs = new Set(dispatches.map((d) => norm(d.ref)));
2491
- // 2. Registries: an object literal assigned to a dispatched ref, ≥2 entries resolving to callables.
2492
3007
  REGISTRY_ASSIGN_RE.lastIndex = 0;
2493
3008
  const registries = new Map();
2494
3009
  let am;
@@ -2499,14 +3014,13 @@ async function objectRegistryEdges(ctx, onYield) {
2499
3014
  const body = braceBody(safe, am.index + am[0].length - 1);
2500
3015
  if (!body)
2501
3016
  continue;
2502
- const names = registryEntryNames(body); // depth-0 `key: Identifier` entries only
3017
+ const names = registryEntryNames(body);
2503
3018
  if (names.length >= REGISTRY_MIN_ENTRIES) {
2504
3019
  registries.set(lhs, { names, line: lineOf(am.index) });
2505
3020
  }
2506
3021
  }
2507
3022
  if (!registries.size)
2508
3023
  continue;
2509
- // 3. Link each dispatcher → each registered handler's callable entry.
2510
3024
  const nodesInFile = ctx.getNodesInFile(file);
2511
3025
  for (const d of dispatches) {
2512
3026
  const reg = registries.get(norm(d.ref));
@@ -2540,30 +3054,15 @@ async function objectRegistryEdges(ctx, onYield) {
2540
3054
  }
2541
3055
  return edges;
2542
3056
  }
2543
- // ── RTK Query generated-hook → endpoint ──────────────────────────────────────
2544
- // RTK Query generates one `useGetXQuery`/`useUpdateYMutation` hook per endpoint
2545
- // (`createApi({ endpoints: b => ({ getX: b.query(...) }) })`). Components call the
2546
- // hook; the fetch logic lives in the endpoint's queryFn. The hook↔endpoint link is
2547
- // pure NAMING CONVENTION (no static edge): strip `use` + the optional `Lazy`
2548
- // variant + the `Query|Mutation` suffix, lowercase the head → the endpoint key.
2549
- // Both are extracted as function nodes (the hook from its `export const {…}=api`
2550
- // binding, carrying a sentinel signature; the endpoint from the createApi object),
2551
- // so bridging hook→endpoint connects `component → useGetXQuery → getX → queryFn`.
2552
- // Gated on the extraction sentinel so it only ever fires on genuinely-generated
2553
- // hooks (never a hand-written `useFooQuery`), and on a SAME-FILE endpoint (RTK
2554
- // colocates the hooks and their api in one module) — 0 on any non-RTK repo.
2555
3057
  const RTK_HOOK_DERIVE_RE = /^use([A-Z][A-Za-z0-9]*?)(?:Query|Mutation)$/;
2556
- // MUST match the signature set in tree-sitter.ts `extractRtkHookBindings`.
2557
3058
  const RTK_GENERATED_HOOK_SIGNATURE = '= RTK Query generated hook';
2558
- /** Derive the endpoint key from a generated-hook name (`useLazyGetRecordsQuery`
2559
- * → `getRecords`), or null if it doesn't fit the convention. */
2560
3059
  function rtkEndpointNameFromHook(hook) {
2561
3060
  const m = RTK_HOOK_DERIVE_RE.exec(hook);
2562
3061
  if (!m)
2563
3062
  return null;
2564
3063
  let mid = m[1];
2565
3064
  if (mid.startsWith('Lazy'))
2566
- mid = mid.slice(4); // useLazyGetX → getX (same endpoint)
3065
+ mid = mid.slice(4);
2567
3066
  if (!mid)
2568
3067
  return null;
2569
3068
  return mid.charAt(0).toLowerCase() + mid.slice(1);
@@ -2575,14 +3074,11 @@ async function rtkQueryEdges(queries, ctx, onYield) {
2575
3074
  for (const hook of queries.iterateNodesByKind('function')) {
2576
3075
  if ((++scanned255 & 63) === 0)
2577
3076
  await onYield();
2578
- // Only our extracted generated-hook bindings (sentinel) — not a real hook fn.
2579
3077
  if (hook.signature !== RTK_GENERATED_HOOK_SIGNATURE)
2580
3078
  continue;
2581
3079
  const endpointName = rtkEndpointNameFromHook(hook.name);
2582
3080
  if (!endpointName)
2583
3081
  continue;
2584
- // The endpoint is a same-file function by the derived name (RTK colocates the
2585
- // api definition and its generated-hook exports in one module).
2586
3082
  const target = ctx
2587
3083
  .getNodesByName(endpointName)
2588
3084
  .find((n) => n.kind === 'function' && n.filePath === hook.filePath);
@@ -2603,16 +3099,6 @@ async function rtkQueryEdges(queries, ctx, onYield) {
2603
3099
  }
2604
3100
  return edges;
2605
3101
  }
2606
- // ── Pinia useStore().action() dispatch bridge ────────────────────────────────
2607
- // A Pinia store factory `export const useXStore = defineStore(...)` exposes its
2608
- // actions as methods on the store instance; a consumer does `const s = useXStore()`
2609
- // then `s.action()`. The call is a method-on-instance with no static edge to the
2610
- // action (which lives in the store's module). Bridge it: map each factory → its
2611
- // file, bind `const <var> = useXStore()` per consumer file, and link the enclosing
2612
- // function → the `<var>.method()` action node IN THE STORE'S FILE. The same-store-
2613
- // file gate keeps it precise (a Pinia built-in like `$patch` or an unrelated
2614
- // same-named method resolves to nothing). Covers both the options and setup store
2615
- // forms uniformly (the action is a function node in the store file either way).
2616
3102
  const PINIA_CONSUMER_EXT = /\.(?:ts|tsx|js|jsx|mjs|cjs|vue)$/;
2617
3103
  const PINIA_FACTORY_RE = /\b(?:export\s+)?const\s+(\w+)\s*=\s*defineStore\s*\(/g;
2618
3104
  const PINIA_BIND_RE = /\bconst\s+(\w+)\s*=\s*(?:await\s+)?(\w+)\s*\(/g;
@@ -2620,7 +3106,6 @@ const PINIA_CALL_RE = /(\w+)\s*\.\s*(\w+)\s*\(/g;
2620
3106
  const PINIA_FANOUT_CAP = 80;
2621
3107
  async function piniaStoreEdges(ctx, onYield) {
2622
3108
  let scannedFiles = 0;
2623
- // 1. Map each `const useXStore = defineStore(...)` factory → its store file.
2624
3109
  const factoryFile = new Map();
2625
3110
  for (const file of ctx.getAllFiles()) {
2626
3111
  if ((++scannedFiles & 15) === 0)
@@ -2648,7 +3133,6 @@ async function piniaStoreEdges(ctx, onYield) {
2648
3133
  if (!content || !content.includes('Store'))
2649
3134
  continue;
2650
3135
  const safe = (0, strip_comments_1.stripCommentsForRegex)(content, /\.(?:jsx?|mjs|cjs)$/.test(file) ? 'javascript' : 'typescript');
2651
- // 2. Bind store vars in this file: `const <var> = <known-factory>(...)`.
2652
3136
  const varStore = new Map();
2653
3137
  PINIA_BIND_RE.lastIndex = 0;
2654
3138
  let bm;
@@ -2659,9 +3143,8 @@ async function piniaStoreEdges(ctx, onYield) {
2659
3143
  }
2660
3144
  if (!varStore.size)
2661
3145
  continue;
2662
- // 3. Link `<var>.<method>(` → the action function node in the store's file.
2663
3146
  const nodesInFile = ctx.getNodesInFile(file);
2664
- const fallbackDispatcher = nodesInFile.find((n) => n.kind === 'component'); // .vue top-level setup
3147
+ const fallbackDispatcher = nodesInFile.find((n) => n.kind === 'component');
2665
3148
  PINIA_CALL_RE.lastIndex = 0;
2666
3149
  let cm;
2667
3150
  let added = 0;
@@ -2670,7 +3153,7 @@ async function piniaStoreEdges(ctx, onYield) {
2670
3153
  if (!storeFile)
2671
3154
  continue;
2672
3155
  const method = cm[2];
2673
- const line = safe.slice(0, cm.index).split('\n').length;
3156
+ const line = lineOf(safe, cm.index);
2674
3157
  const disp = (0, synth_utils_1.enclosingFn)(nodesInFile, line) ?? fallbackDispatcher;
2675
3158
  if (!disp)
2676
3159
  continue;
@@ -2696,21 +3179,9 @@ async function piniaStoreEdges(ctx, onYield) {
2696
3179
  }
2697
3180
  return edges;
2698
3181
  }
2699
- // ── Vuex string-keyed dispatch / commit bridge ───────────────────────────────
2700
- // Vuex dispatches actions/mutations by a runtime STRING key: `dispatch('user/login')`
2701
- // / `commit('SET_TOKEN')` / `this.$store.dispatch('app/toggleDevice')`. The action
2702
- // & mutation definitions are object-literal methods in store module files (now
2703
- // extracted as function nodes). Bridge the string key to its node: the LAST `/`
2704
- // segment is the action/mutation name; the preceding segment is the namespace
2705
- // (≈ the store module's file). Resolve the name to a function node IN A STORE FILE
2706
- // (the store-file gate excludes a same-named `api/` helper — `getInfo`/`login`
2707
- // commonly collide), disambiguated by the namespace appearing in the path (or, for
2708
- // a root key, the same file — Vuex's local-module `commit('M')` inside an action).
2709
3182
  const VUEX_DISPATCH_RE = /\b(?:dispatch|commit)\s*\(\s*['"]([A-Za-z][\w/]*)['"]/g;
2710
3183
  const VUEX_STORE_SIGNAL = /\bdefineStore\b|\bcreateStore\b|\bVuex\b|\bmutations\b|\bactions\b|\bgetters\b|\bnamespaced\b/g;
2711
3184
  const VUEX_FANOUT_CAP = 120;
2712
- /** A path segment (dir or filename stem) equals `seg` — `…/modules/user.js` has
2713
- * the segment `user` for namespace `user`. */
2714
3185
  function pathHasSegment(filePath, seg) {
2715
3186
  return new RegExp('[\\\\/]' + seg.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '[\\\\/.]').test(filePath);
2716
3187
  }
@@ -2743,11 +3214,9 @@ async function vuexDispatchEdges(ctx, onYield) {
2743
3214
  if (!cands.length)
2744
3215
  return null;
2745
3216
  if (segs.length > 1) {
2746
- const mod = segs[segs.length - 2]; // immediate namespace ≈ the module file
3217
+ const mod = segs[segs.length - 2];
2747
3218
  return cands.find((c) => pathHasSegment(c.filePath, mod)) ?? (cands.length === 1 ? cands[0] : null);
2748
3219
  }
2749
- // Root key: a local `commit('M')` inside an action targets the same module file;
2750
- // otherwise accept only an unambiguous single store-wide match.
2751
3220
  return cands.find((c) => c.filePath === dispatchFile) ?? (cands.length === 1 ? cands[0] : null);
2752
3221
  };
2753
3222
  const edges = [];
@@ -2762,13 +3231,13 @@ async function vuexDispatchEdges(ctx, onYield) {
2762
3231
  continue;
2763
3232
  const safe = (0, strip_comments_1.stripCommentsForRegex)(content, /\.(?:jsx?|mjs|cjs)$/.test(file) ? 'javascript' : 'typescript');
2764
3233
  const nodesInFile = ctx.getNodesInFile(file);
2765
- const fallback = nodesInFile.find((n) => n.kind === 'component'); // .vue top-level
3234
+ const fallback = nodesInFile.find((n) => n.kind === 'component');
2766
3235
  VUEX_DISPATCH_RE.lastIndex = 0;
2767
3236
  let m;
2768
3237
  let added = 0;
2769
3238
  while ((m = VUEX_DISPATCH_RE.exec(safe)) && added < VUEX_FANOUT_CAP) {
2770
3239
  const key = m[1];
2771
- const line = safe.slice(0, m.index).split('\n').length;
3240
+ const line = lineOf(safe, m.index);
2772
3241
  const disp = (0, synth_utils_1.enclosingFn)(nodesInFile, line) ?? fallback;
2773
3242
  if (!disp)
2774
3243
  continue;
@@ -2792,33 +3261,13 @@ async function vuexDispatchEdges(ctx, onYield) {
2792
3261
  }
2793
3262
  return edges;
2794
3263
  }
2795
- // ── Celery task dispatch (Python) ─────────────────────────────────────────────
2796
- // Celery decouples a task's call site from its body through async dispatch:
2797
- // # tasks.py
2798
- // @shared_task # also @app.task / @celery_app.task / @<app>.task / @task
2799
- // def process(account_ids): ...
2800
- // # views.py — a DIFFERENT module
2801
- // process.apply_async(kwargs={...}) # or process.delay(...) — dynamic, no static edge
2802
- // Bridge it: link the enclosing function/method at each `.delay(`/`.apply_async(` site → the
2803
- // task function body. Precision rests on the DECORATOR gate — the dispatched name must resolve
2804
- // to a Python function carrying a celery task decorator (read from the source lines above its
2805
- // `def`, since the def's own startLine excludes the decorator). A `.delay()` on a non-task
2806
- // object resolves to no task node → no edge, so a Celery-free repo yields 0. Same-file /
2807
- // unique-candidate disambiguation like vuex. (Canvas forms — `group(t).delay()`, `t.s()`/`.si()`
2808
- // — have no single identifier before `.delay`/`.apply_async`, so they're skipped, not mis-bridged.)
2809
3264
  const CELERY_DISPATCH_RE = /\b([A-Za-z_]\w*)\s*\.\s*(?:delay|apply_async)\s*\(/g;
2810
- // A task decorator: bare `@shared_task`/`@task` or attribute `@app.task`/`@celery_app.task`,
2811
- // each optionally called with args. `\b`-bounded and `@`-anchored so `@mytask`, or a symbol
2812
- // merely named `task`, can't match. No `/g`, so `.test()` is stateless across reuse.
2813
3265
  const CELERY_TASK_DECORATOR_RE = /@\s*(?:[A-Za-z_][\w.]*\.)?(?:shared_task|task)\b/;
2814
3266
  const CELERY_PY_EXT = /\.py$/;
2815
3267
  const CELERY_FANOUT_CAP = 80;
2816
- const CELERY_DECORATOR_LOOKBACK = 12; // max lines above a `def` to scan for its decorators
3268
+ const CELERY_DECORATOR_LOOKBACK = 12;
2817
3269
  async function celeryDispatchEdges(ctx, onYield) {
2818
3270
  let scannedFiles = 0;
2819
- // Memoize the decorator check per task-candidate node: it reads the file and scans a few
2820
- // lines above the def. Only called on names that are actually `.delay`/`.apply_async`
2821
- // receivers, so the candidate set stays small.
2822
3271
  const taskCache = new Map();
2823
3272
  const isCeleryTask = (node) => {
2824
3273
  let v = taskCache.get(node.id);
@@ -2829,13 +3278,11 @@ async function celeryDispatchEdges(ctx, onYield) {
2829
3278
  const content = ctx.readFile(node.filePath);
2830
3279
  if (content) {
2831
3280
  const lines = content.split('\n');
2832
- // startLine is the `def` line (decorators sit ABOVE it). Walk upward, stopping at the
2833
- // previous declaration so a non-task def can never inherit the prior def's decorator.
2834
3281
  const stop = Math.max(0, node.startLine - 1 - CELERY_DECORATOR_LOOKBACK);
2835
3282
  for (let i = node.startLine - 2; i >= stop; i--) {
2836
3283
  const t = (lines[i] ?? '').trim();
2837
3284
  if (/^(?:async\s+def|def|class)\b/.test(t))
2838
- break; // previous decl → stop
3285
+ break;
2839
3286
  if (CELERY_TASK_DECORATOR_RE.test(t)) {
2840
3287
  v = true;
2841
3288
  break;
@@ -2852,8 +3299,6 @@ async function celeryDispatchEdges(ctx, onYield) {
2852
3299
  return null;
2853
3300
  if (cands.length === 1)
2854
3301
  return cands[0];
2855
- // Cross-module name collision: prefer a task defined in the dispatching file, else bail
2856
- // (ambiguous — precision over recall, like vuex's root-key resolution).
2857
3302
  return cands.find((c) => c.filePath === dispatchFile) ?? null;
2858
3303
  };
2859
3304
  const edges = [];
@@ -2873,10 +3318,10 @@ async function celeryDispatchEdges(ctx, onYield) {
2873
3318
  let added = 0;
2874
3319
  while ((m = CELERY_DISPATCH_RE.exec(safe)) && added < CELERY_FANOUT_CAP) {
2875
3320
  const name = m[1];
2876
- const line = safe.slice(0, m.index).split('\n').length;
3321
+ const line = lineOf(safe, m.index);
2877
3322
  const disp = (0, synth_utils_1.enclosingFn)(nodesInFile, line);
2878
3323
  if (!disp)
2879
- continue; // module-level dispatch — no source symbol to attribute
3324
+ continue;
2880
3325
  const target = resolve(name, file);
2881
3326
  if (!target || target.id === disp.id)
2882
3327
  continue;
@@ -2897,31 +3342,12 @@ async function celeryDispatchEdges(ctx, onYield) {
2897
3342
  }
2898
3343
  return edges;
2899
3344
  }
2900
- // ── Spring application events (Java) ──────────────────────────────────────────
2901
- // Spring decouples an event PUBLISHER from its LISTENER(s) through the application
2902
- // event bus, linked by the EVENT TYPE (not a name):
2903
- // // SomeService.java
2904
- // eventPublisher.publishEvent(new PasswordChangedEvent(this, username)); // publish
2905
- // // RememberMeTokenRevoker.java — a DIFFERENT file
2906
- // @EventListener(PasswordChangedEvent.class) // listen
2907
- // public void onPasswordChanged(PasswordChangedEvent event) { ... }
2908
- // Bridge it: link the enclosing method at each `publishEvent(new XEvent(...))` site →
2909
- // every listener method of XEvent. Listeners are `@EventListener` / `@TransactionalEventListener`
2910
- // methods (event type = the first param type, or the `@EventListener(X.class)` value form) and
2911
- // the older `class … implements ApplicationListener<X> { void onApplicationEvent(X e) }`. Keyed
2912
- // by exact type name, usually cross-file. A repo with no `@EventListener`/`publishEvent` yields 0.
2913
- // (Java method nodes INCLUDE their leading annotations in the range — startLine is the first
2914
- // `@…` line — so the annotation block is scanned DOWNWARD from startLine, bounded to consecutive
2915
- // `@`-lines so it can't bleed into an adjacent method.)
2916
3345
  const SPRING_PUBLISH_RE = /\.publishEvent\s*\(\s*new\s+([A-Z][A-Za-z0-9_]*)/g;
2917
3346
  const SPRING_LISTENER_ANNO_RE = /@(?:EventListener|TransactionalEventListener)\b/;
2918
3347
  const SPRING_ANNO_TYPE_RE = /@(?:EventListener|TransactionalEventListener)\s*\(\s*([A-Z][A-Za-z0-9_]*)\.class/;
2919
3348
  const SPRING_APP_LISTENER_RE = /\bApplicationListener\s*</;
2920
3349
  const SPRING_JAVA_EXT = /\.java$/;
2921
3350
  const SPRING_FANOUT_CAP = 80;
2922
- /** The first parameter's type from a Java method `signature` (`"void (XEvent e)"` → `XEvent`).
2923
- * Skips a leading `final`/`@Anno`, strips generics, and requires a PascalCase class name (event
2924
- * types are classes) — so a no-arg or primitive-param method yields null. */
2925
3351
  function springFirstParamType(sig) {
2926
3352
  if (!sig)
2927
3353
  return null;
@@ -2935,16 +3361,12 @@ function springFirstParamType(sig) {
2935
3361
  const first = inner.split(',')[0].trim();
2936
3362
  const toks = first.split(/\s+/).filter((t) => t && t !== 'final' && !t.startsWith('@'));
2937
3363
  if (toks.length < 2)
2938
- return null; // need `Type name`
2939
- const type = toks[toks.length - 2].replace(/<.*$/, ''); // drop generic args
3364
+ return null;
3365
+ const type = toks[toks.length - 2].replace(/<.*$/, '');
2940
3366
  return /^[A-Z][A-Za-z0-9_]*$/.test(type) ? type : null;
2941
3367
  }
2942
3368
  async function springEventEdges(ctx, onYield) {
2943
3369
  let scannedFiles = 0;
2944
- // Pass 1 — event-type → listener methods, scanning only event-relevant files.
2945
- // This is the ONLY full read sweep: publisher files are recorded here so
2946
- // pass 2 re-reads just those instead of every .java file again (#1212 —
2947
- // the double full-repo read was one of the tail's longest unyielded spans).
2948
3370
  const listeners = new Map();
2949
3371
  const publisherFiles = [];
2950
3372
  for (const file of ctx.getAllFiles()) {
@@ -2965,12 +3387,11 @@ async function springEventEdges(ctx, onYield) {
2965
3387
  for (const node of ctx.getNodesInFile(file)) {
2966
3388
  if (node.kind !== 'method')
2967
3389
  continue;
2968
- // Collect this method's own leading annotation block (consecutive `@`-lines from startLine).
2969
3390
  const annoLines = [];
2970
3391
  for (let i = node.startLine - 1; i < lines.length && i < node.startLine + 7; i++) {
2971
3392
  const t = (lines[i] ?? '').trim();
2972
3393
  if (!t.startsWith('@'))
2973
- break; // reached the declaration → stop (no bleed into next method)
3394
+ break;
2974
3395
  annoLines.push(t);
2975
3396
  }
2976
3397
  const head = annoLines.join('\n');
@@ -2996,8 +3417,6 @@ async function springEventEdges(ctx, onYield) {
2996
3417
  }
2997
3418
  if (!listeners.size)
2998
3419
  return [];
2999
- // Pass 2 — link each publishEvent(new XEvent(...)) site → every listener of
3000
- // XEvent. Only the publisher files recorded in pass 1 are (re-)read.
3001
3420
  const edges = [];
3002
3421
  const seen = new Set();
3003
3422
  for (const file of publisherFiles) {
@@ -3015,7 +3434,7 @@ async function springEventEdges(ctx, onYield) {
3015
3434
  const targets = listeners.get(m[1]);
3016
3435
  if (!targets || !targets.length)
3017
3436
  continue;
3018
- const line = safe.slice(0, m.index).split('\n').length;
3437
+ const line = lineOf(safe, m.index);
3019
3438
  const disp = (0, synth_utils_1.enclosingFn)(nodesInFile, line);
3020
3439
  if (!disp)
3021
3440
  continue;
@@ -3040,31 +3459,50 @@ async function springEventEdges(ctx, onYield) {
3040
3459
  }
3041
3460
  return edges;
3042
3461
  }
3043
- // ── MediatR request/notification dispatch (C#/.NET) ───────────────────────────
3044
- // MediatR decouples a Send/Publish call site from its Handle method through a mediator,
3045
- // linked by the request/notification TYPE (the IRequestHandler<T,…> generic):
3046
- // // CancelOrderCommandHandler.cs — the handler
3047
- // public class CancelOrderCommandHandler : IRequestHandler<CancelOrderCommand, bool> {
3048
- // public async Task<bool> Handle(CancelOrderCommand request, CancellationToken ct) { … }
3049
- // // some controller — the dispatch (usually a DIFFERENT file)
3050
- // var command = new CancelOrderCommand(orderId); await _mediator.Send(command);
3051
- // Bridge it: link the enclosing method at each mediator `.Send(x)`/`.Publish(x)` site → the
3052
- // `Handle` method of the handler for x's type. The sent type is resolved from the argument —
3053
- // inline `new X(…)`, a local `var v = new X(…)`, or a parameter/local declared `X v` — bounded
3054
- // to the enclosing method. Precision rests on TWO gates: the receiver must be mediator-ish
3055
- // (`mediator`/`sender`/`publisher`, so MAUI `MessagingCenter.Send` is ignored) AND the resolved
3056
- // type must be a known handler request type (so a same-named non-request DTO is never bridged).
3057
- // C# has no `signature` on method nodes, so the handler's request type is read from the class
3058
- // base-list source (`: IRequestHandler<X,…>`), not a param signature.
3059
3462
  const MEDIATR_HANDLER_BASE_RE = /(?:IRequestHandler|INotificationHandler)\s*<\s*([A-Za-z_]\w*)/;
3060
- 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;
3061
3464
  const MEDIATR_RECEIVER_RE = /(?:mediator|sender|publisher)/i;
3062
3465
  const MEDIATR_CS_EXT = /\.cs$/;
3063
3466
  const MEDIATR_FANOUT_CAP = 80;
3064
- const MEDIATR_HANDLER_DECL_LOOKAHEAD = 4; // lines from a class startLine to find a wrapped base list
3065
- /** The type sent at a MediatR `.Send(arg)`/`.Publish(arg)` site: an inline `new X(…)`, else
3066
- * `arg` as an identifier resolved within the enclosing method — a `… arg = new X(…)` assignment
3067
- * (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
+ }
3068
3506
  function resolveMediatrArgType(arg, lines, methodStart, dispatchLine) {
3069
3507
  const inl = /^new\s+([A-Z]\w*)/.exec(arg);
3070
3508
  if (inl)
@@ -3072,24 +3510,55 @@ function resolveMediatrArgType(arg, lines, methodStart, dispatchLine) {
3072
3510
  if (!/^[A-Za-z_]\w*$/.test(arg))
3073
3511
  return null;
3074
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*\\(`);
3075
3514
  const declRe = new RegExp(`\\b([A-Z]\\w*)\\b\\s+${arg}\\b`);
3076
3515
  let declType = null;
3077
3516
  for (let i = Math.max(0, methodStart - 1); i < dispatchLine && i < lines.length; i++) {
3078
3517
  const ln = lines[i] ?? '';
3079
3518
  const a = assignRe.exec(ln);
3080
3519
  if (a)
3081
- 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];
3082
3524
  if (!declType) {
3083
3525
  const d = declRe.exec(ln);
3084
3526
  if (d)
3085
- declType = d[1]; // a `X arg` declaration — remember, but keep scanning for an assignment
3527
+ declType = d[1];
3086
3528
  }
3087
3529
  }
3088
3530
  return declType;
3089
3531
  }
3090
3532
  async function mediatrDispatchEdges(ctx, onYield) {
3091
3533
  let scannedFiles = 0;
3092
- // 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 [];
3093
3562
  const handlers = new Map();
3094
3563
  for (const file of ctx.getAllFiles()) {
3095
3564
  if ((++scannedFiles & 15) === 0)
@@ -3097,105 +3566,79 @@ async function mediatrDispatchEdges(ctx, onYield) {
3097
3566
  if (!MEDIATR_CS_EXT.test(file))
3098
3567
  continue;
3099
3568
  const content = ctx.readFile(file);
3100
- if (!content || (!content.includes('IRequestHandler<') && !content.includes('INotificationHandler<')))
3569
+ if (!content || !content.includes('Handle('))
3101
3570
  continue;
3102
3571
  const lines = content.split('\n');
3103
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
+ };
3104
3583
  for (const cls of nodesInFile) {
3105
3584
  if (cls.kind !== 'class')
3106
3585
  continue;
3107
- const decl = lines.slice(cls.startLine - 1, cls.startLine - 1 + MEDIATR_HANDLER_DECL_LOOKAHEAD).join('\n');
3108
- const m = MEDIATR_HANDLER_BASE_RE.exec(decl);
3109
- if (!m)
3110
- continue;
3111
- const type = m[1];
3112
3586
  const end = cls.endLine ?? cls.startLine;
3113
- const handle = nodesInFile.find((n) => n.kind === 'method' && n.name === 'Handle' && n.startLine >= cls.startLine && n.startLine <= end);
3114
- if (!handle)
3587
+ const handles = handleMethods.filter((n) => n.startLine >= cls.startLine && n.startLine <= end);
3588
+ if (handles.length === 0)
3115
3589
  continue;
3116
- let arr = handlers.get(type);
3117
- if (!arr) {
3118
- arr = [];
3119
- 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);
3120
3600
  }
3121
- arr.push(handle);
3122
3601
  }
3123
3602
  }
3124
3603
  if (!handlers.size)
3125
3604
  return [];
3126
- // Pass 2 — link each mediator-ish .Send(x)/.Publish(x) → the handler of x's type.
3127
3605
  const edges = [];
3128
3606
  const seen = new Set();
3129
- for (const file of ctx.getAllFiles()) {
3130
- if ((++scannedFiles & 15) === 0)
3131
- await onYield();
3132
- 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)
3133
3611
  continue;
3134
- const content = ctx.readFile(file);
3135
- if (!content || (!content.includes('.Send(') && !content.includes('.Publish(')))
3612
+ let added = addedPerFile.get(file) ?? 0;
3613
+ if (added >= MEDIATR_FANOUT_CAP)
3136
3614
  continue;
3137
- const safe = (0, strip_comments_1.stripCommentsForRegex)(content, 'csharp');
3138
- const safeLines = safe.split('\n');
3139
- const nodesInFile = ctx.getNodesInFile(file);
3140
- MEDIATR_DISPATCH_RE.lastIndex = 0;
3141
- let m;
3142
- let added = 0;
3143
- while ((m = MEDIATR_DISPATCH_RE.exec(safe)) && added < MEDIATR_FANOUT_CAP) {
3144
- if (!MEDIATR_RECEIVER_RE.test(m[1]))
3145
- continue; // not a mediator (MessagingCenter, HttpClient, …)
3146
- const line = safe.slice(0, m.index).split('\n').length;
3147
- const disp = (0, synth_utils_1.enclosingFn)(nodesInFile, line);
3148
- if (!disp)
3615
+ for (const target of reachableHandlers(targets, file, verb)) {
3616
+ if (target.id === from.id)
3149
3617
  continue;
3150
- const type = resolveMediatrArgType(m[2], safeLines, disp.startLine, line);
3151
- if (!type)
3152
- continue;
3153
- const targets = handlers.get(type);
3154
- if (!targets)
3618
+ const key = `${from.id}>${target.id}`;
3619
+ if (seen.has(key))
3155
3620
  continue;
3156
- for (const target of targets) {
3157
- if (target.id === disp.id)
3158
- continue;
3159
- const key = `${disp.id}>${target.id}`;
3160
- if (seen.has(key))
3161
- continue;
3162
- seen.add(key);
3163
- edges.push({
3164
- source: disp.id,
3165
- target: target.id,
3166
- kind: 'calls',
3167
- line,
3168
- provenance: 'heuristic',
3169
- metadata: { synthesizedBy: 'mediatr-dispatch', via: type, registeredAt: `${file}:${line}` },
3170
- });
3171
- added++;
3172
- }
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++;
3173
3631
  }
3632
+ addedPerFile.set(file, added);
3174
3633
  }
3175
3634
  return edges;
3176
3635
  }
3177
- // ── Sidekiq job dispatch (Ruby) ───────────────────────────────────────────────
3178
- // Sidekiq decouples a job's enqueue site from the worker's `perform`, linked by the WORKER
3179
- // CLASS NAME:
3180
- // # app/workers/destroy_user_worker.rb
3181
- // class DestroyUserWorker
3182
- // include Sidekiq::Worker # or Sidekiq::Job (the modern alias)
3183
- // def perform(user_id) … end
3184
- // # app/services/… — a DIFFERENT file
3185
- // DestroyUserWorker.perform_async(user.id) # also .perform_in(t, …) / .perform_at(t, …)
3186
- // Bridge it: link the enclosing method at each `Worker.perform_async/_in/_at(…)` site → that
3187
- // worker's instance `perform`. Name-keyed (like Celery): the receiver class must be a Sidekiq
3188
- // worker — gated by reading `include Sidekiq::Job|Worker` from the class body, since that mixin
3189
- // is an external gem module that forms no resolvable edge. ActiveJob's `perform_later`/`_now` is
3190
- // a different shape and deliberately not matched, so an ActiveJob-only app yields 0.
3191
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;
3192
3637
  const SIDEKIQ_WORKER_RE = /\binclude\s+Sidekiq::(?:Job|Worker)\b/;
3193
3638
  const SIDEKIQ_RB_EXT = /\.rb$/;
3194
3639
  const SIDEKIQ_FANOUT_CAP = 80;
3195
3640
  async function sidekiqDispatchEdges(ctx, onYield) {
3196
3641
  let scannedFiles = 0;
3197
- // class node id → its instance `perform` method (null if the class isn't a Sidekiq worker),
3198
- // memoized. Reads the class body for the mixin; only consulted for actual dispatch receivers.
3199
3642
  const performCache = new Map();
3200
3643
  const performOf = (cls) => {
3201
3644
  let v = performCache.get(cls.id);
@@ -3213,11 +3656,6 @@ async function sidekiqDispatchEdges(ctx, onYield) {
3213
3656
  performCache.set(cls.id, v);
3214
3657
  return v;
3215
3658
  };
3216
- // Resolve a (possibly namespaced) worker reference to its `perform`. A namespaced ref is
3217
- // matched by EXACT qualified name first, so same-named workers in different namespaces
3218
- // (forem has four `SendEmailNotificationWorker`s) resolve to the right one; an unqualified
3219
- // ref falls back to the simple name and links only when a single worker bears it — an
3220
- // ambiguous collision bails (precision over recall).
3221
3659
  const resolve = (ref) => {
3222
3660
  if (ref.includes('::')) {
3223
3661
  const q = ctx.getNodesByQualifiedName(ref).find((n) => n.kind === 'class' && performOf(n));
@@ -3243,7 +3681,7 @@ async function sidekiqDispatchEdges(ctx, onYield) {
3243
3681
  let m;
3244
3682
  let added = 0;
3245
3683
  while ((m = SIDEKIQ_DISPATCH_RE.exec(safe)) && added < SIDEKIQ_FANOUT_CAP) {
3246
- const line = safe.slice(0, m.index).split('\n').length;
3684
+ const line = lineOf(safe, m.index);
3247
3685
  const disp = (0, synth_utils_1.enclosingFn)(nodesInFile, line);
3248
3686
  if (!disp)
3249
3687
  continue;
@@ -3267,46 +3705,12 @@ async function sidekiqDispatchEdges(ctx, onYield) {
3267
3705
  }
3268
3706
  return edges;
3269
3707
  }
3270
- // ── Erlang behaviour-callback dispatch ────────────────────────────────────────
3271
- // An Erlang behaviour is a compile-checked callback contract: the behaviour
3272
- // module declares `-callback init(...) -> ...`, implementers declare
3273
- // `-behaviour(B)` and export the callbacks, and the framework side dispatches
3274
- // through a VARIABLE module — cowboy's `Handler:init(Req, Opts)` and
3275
- // `Middleware:execute(Req, Env)` folds, ejabberd's `Mod:start/2`. Extraction
3276
- // deliberately leaves var-module calls silent (no static target), so the flow
3277
- // breaks at exactly the hop agents ask about (request → handler init). Bridge:
3278
- //
3279
- // dispatch site `Var:fn(args…)` → every in-repo implementer of the behaviour
3280
- // declaring `fn` with the SITE's arity — provided exactly ONE in-repo
3281
- // behaviour declares (fn, arity); a name+arity collision across behaviours
3282
- // bails (silent beats wrong) — and the implementer defines and exports `fn`.
3283
- //
3284
- // Behaviours are discovered by scanning every Erlang file for `-callback`
3285
- // declarations (not just `implements` targets), so a behaviour with zero
3286
- // implementers still participates in the ambiguity gate. Fan-out control: a
3287
- // mega-behaviour (ejabberd's gen_mod, ~200 mod_* implementers) would mint
3288
- // hundreds of edges per site that READ as complete coverage while being
3289
- // arbitrary — above the cap the site is skipped entirely and the boundary
3290
- // stays visibly dynamic (explore's boundary announcer covers it) instead of
3291
- // silently truncated.
3292
3708
  const ERLANG_EXT = /\.(?:erl|hrl)$/;
3293
- // `Var:fn(` — variable (capitalized) module, lowercase function, immediate
3294
- // open-paren. The leading char class rejects `?MODULE:fn(` (macro), `a:b(`
3295
- // (static remote call, already linked), and mid-word matches.
3296
3709
  const ERLANG_DISPATCH_RE = /(^|[^?\w@'])([A-Z][A-Za-z0-9_@]*):([a-z][A-Za-z0-9_@]*)\(/g;
3297
3710
  const ERLANG_CALLBACK_DECL_RE = /(^|\n)\s*-callback\s+('[^'\n]+'|[a-z][A-Za-z0-9_@]*)\s*\(/g;
3298
3711
  const ERLANG_BEHAVIOUR_FANOUT_CAP = 24;
3299
- /**
3300
- * Argument count of the call/declaration whose `(` sits at `openIdx` —
3301
- * top-level commas + 1, `()` → 0, unbalanced/oversized → -1. Skips nested
3302
- * (), [], {}, <<>> content, `"strings"`, `'atoms'`, and `$c` char literals,
3303
- * so `-callback init(fun((a, b) -> ok), #{k => v}) -> ok.` counts 2.
3304
- */
3305
3712
  function erlangArityAt(src, openIdx) {
3306
3713
  let depth = 1;
3307
- // `<<1,2,3>>` binary literals: commas inside are element separators, not
3308
- // argument separators. Tracked separately from bracket depth because the
3309
- // single-char `<`/`>` comparison operators must stay inert (#1358).
3310
3714
  let binDepth = 0;
3311
3715
  let commas = 0;
3312
3716
  let sawArg = false;
@@ -3361,40 +3765,12 @@ function erlangArityAt(src, openIdx) {
3361
3765
  }
3362
3766
  return -1;
3363
3767
  }
3364
- /**
3365
- * Nix module-system option wiring. A NixOS/home-manager/nix-darwin option is
3366
- * DECLARED in one module (`options.launchd.user.agents = mkOption { ... }`)
3367
- * and SET in others (`launchd.user.agents.yabai = { ... }` inside a module's
3368
- * config) — the connection happens by option-path unification inside the
3369
- * module-system evaluator, so there is no static call/import edge to follow
3370
- * and flow questions ("how does services.yabai.enable become a launchd
3371
- * service?") go dark at the module boundary.
3372
- *
3373
- * This pass links each config-write binding to the option declaration whose
3374
- * path is the longest static-segment prefix of the write path. Precision gates:
3375
- * - only STATIC segments participate: plain identifiers, plus quoted segments
3376
- * (`"git/config"`, `"com.apple.dock"`) as opaque verbatim tokens that match
3377
- * only quote-exactly; an interpolated (`${name}`) segment ends the prefix,
3378
- * so dynamic paths never match beyond their static head;
3379
- * - matched prefixes must be ≥2 segments: 1-segment paths would wrongly link
3380
- * every package's `meta = { ... }` attrset to nixos's `options.meta`;
3381
- * - a prefix declared in more than one file is ambiguous → no edge (a wrong
3382
- * edge is worse than none);
3383
- * - writes physically inside an options block are declaration internals
3384
- * (types, defaults, examples), never config writes → excluded.
3385
- * Both declaration spellings register: flat (`options.a.b = ...`) by name, and
3386
- * nested (`options = { a.b = ...; }`) by line-span containment.
3387
- */
3388
3768
  function nixLeadingPlainSegments(name) {
3389
3769
  const segs = [];
3390
3770
  let i = 0;
3391
3771
  const n = name.length;
3392
3772
  while (i < n) {
3393
3773
  if (name[i] === '"') {
3394
- // Quoted segment — an opaque verbatim token (quotes kept, so it can
3395
- // never collide with a plain identifier). `NSGlobalDomain."com.apple.
3396
- // mouse.tapBehavior"` must match ITS OWN quoted declaration, not
3397
- // whichever sibling registered the shared plain prefix first.
3398
3774
  let j = i + 1;
3399
3775
  while (j < n && name[j] !== '"') {
3400
3776
  if (name[j] === '\\')
@@ -3402,10 +3778,10 @@ function nixLeadingPlainSegments(name) {
3402
3778
  j++;
3403
3779
  }
3404
3780
  if (j >= n)
3405
- return segs; // unterminated — stop at the static head
3781
+ return segs;
3406
3782
  const tok = name.slice(i, j + 1);
3407
3783
  if (tok.includes('${'))
3408
- return segs; // interpolated → dynamic → stop
3784
+ return segs;
3409
3785
  segs.push(tok);
3410
3786
  i = j + 1;
3411
3787
  if (i >= n)
@@ -3431,8 +3807,6 @@ function nixLeadingPlainSegments(name) {
3431
3807
  }
3432
3808
  async function nixOptionPathEdges(queries, onYield) {
3433
3809
  let scanned255 = 0;
3434
- // One streaming pass over nix bindings (variables + the odd function-valued
3435
- // option); memory stays O(bindings-kept), not O(all nodes) (#610).
3436
3810
  const byFile = new Map();
3437
3811
  let scanned = 0;
3438
3812
  for (const kind of ['variable', 'function']) {
@@ -3458,13 +3832,6 @@ async function nixOptionPathEdges(queries, onYield) {
3458
3832
  byFile.set(node.filePath, [rec]);
3459
3833
  }
3460
3834
  }
3461
- // Per file: walk bindings outermost-first with a stack of active option
3462
- // spans, composing nested declaration paths (`options = { services.foo = {
3463
- // enable = mkOption ...; }; }` registers services.foo AND services.foo.enable).
3464
- // An `options` binding nested inside another option span is a SUBMODULE's
3465
- // own namespace (`attrsOf (submodule { options = ...; })`) — its internals
3466
- // are not globally addressable, so the sentinel blocks registration below it
3467
- // while still excluding the region from write candidates.
3468
3835
  const SUBMODULE = '\u0000submodule';
3469
3836
  const decls = new Map();
3470
3837
  const writes = [];
@@ -3484,9 +3851,6 @@ async function nixOptionPathEdges(queries, onYield) {
3484
3851
  for (const rec of recs) {
3485
3852
  while (stack.length > 0 && stack[stack.length - 1].end < rec.startLine)
3486
3853
  stack.pop();
3487
- // Strict containment at line granularity: a one-line nested binding is
3488
- // indistinguishable from its container, so it stays unclassified (rare
3489
- // in module code, where option blocks are multi-line).
3490
3854
  const enclosing = stack.length > 0 &&
3491
3855
  rec.startLine >= stack[stack.length - 1].start &&
3492
3856
  rec.endLine <= stack[stack.length - 1].end &&
@@ -3494,7 +3858,7 @@ async function nixOptionPathEdges(queries, onYield) {
3494
3858
  ? stack[stack.length - 1]
3495
3859
  : null;
3496
3860
  if (rec.segs[0] === 'options') {
3497
- const ownPath = rec.segs.slice(1); // [] for the bare `options = { ... }` spelling
3861
+ const ownPath = rec.segs.slice(1);
3498
3862
  const prefix = enclosing ? [SUBMODULE] : ownPath;
3499
3863
  register(prefix, rec);
3500
3864
  stack.push({ start: rec.startLine, end: rec.endLine, prefix });
@@ -3515,13 +3879,9 @@ async function nixOptionPathEdges(queries, onYield) {
3515
3879
  return [];
3516
3880
  const edges = [];
3517
3881
  for (const w of writes) {
3518
- // `config.services.x = ...` spells the same write with an explicit prefix.
3519
3882
  const segs = w.segs[0] === 'config' ? w.segs.slice(1) : w.segs;
3520
3883
  if (segs.length < 2)
3521
3884
  continue;
3522
- // Longest prefix wins; an ambiguous longest match does NOT fall back to a
3523
- // shorter one (that would link `services.nginx.virtualHosts.x` to
3524
- // `options.services.nginx` when virtualHosts is the contested path).
3525
3885
  for (let len = Math.min(segs.length, 6); len >= 2; len--) {
3526
3886
  const candidates = decls.get(segs.slice(0, len).join('.'));
3527
3887
  if (!candidates || candidates.length === 0)
@@ -3544,7 +3904,7 @@ async function nixOptionPathEdges(queries, onYield) {
3544
3904
  });
3545
3905
  }
3546
3906
  }
3547
- break; // longest hit decides, matched or ambiguous
3907
+ break;
3548
3908
  }
3549
3909
  }
3550
3910
  return edges;
@@ -3552,8 +3912,6 @@ async function nixOptionPathEdges(queries, onYield) {
3552
3912
  async function erlangBehaviourDispatchEdges(queries, ctx, onYield) {
3553
3913
  let scannedFiles = 0;
3554
3914
  let scanned255 = 0;
3555
- // Cheap language gate: no Erlang modules → no cost beyond one streamed
3556
- // kind scan (never a materialized array of every namespace — #1212).
3557
3915
  const erlangModules = [];
3558
3916
  for (const n of queries.iterateNodesByKindIn('namespace', ['erlang'])) {
3559
3917
  if ((++scanned255 & 63) === 0)
@@ -3562,15 +3920,12 @@ async function erlangBehaviourDispatchEdges(queries, ctx, onYield) {
3562
3920
  }
3563
3921
  if (erlangModules.length === 0)
3564
3922
  return [];
3565
- // Pass 1 — scan every Erlang file with `-callback` decls: behaviour module →
3566
- // its (name, arity) callback set, and the global `name/arity` → declaring
3567
- // behaviours map that drives the ambiguity gate.
3568
3923
  const moduleByFile = new Map();
3569
3924
  for (const ns of erlangModules) {
3570
3925
  if (!moduleByFile.has(ns.filePath))
3571
3926
  moduleByFile.set(ns.filePath, ns);
3572
3927
  }
3573
- const declaringBehaviours = new Map(); // `fn/arity` → behaviour namespaces
3928
+ const declaringBehaviours = new Map();
3574
3929
  const callbackNames = new Set();
3575
3930
  for (const file of ctx.getAllFiles()) {
3576
3931
  if ((++scannedFiles & 15) === 0)
@@ -3579,7 +3934,7 @@ async function erlangBehaviourDispatchEdges(queries, ctx, onYield) {
3579
3934
  continue;
3580
3935
  const behaviour = moduleByFile.get(file);
3581
3936
  if (!behaviour)
3582
- continue; // a .hrl or module-less file can't be a behaviour
3937
+ continue;
3583
3938
  const content = ctx.readFile(file);
3584
3939
  if (!content || !content.includes('-callback'))
3585
3940
  continue;
@@ -3605,11 +3960,6 @@ async function erlangBehaviourDispatchEdges(queries, ctx, onYield) {
3605
3960
  }
3606
3961
  if (declaringBehaviours.size === 0)
3607
3962
  return [];
3608
- // Implementer target lookup, lazy per (behaviour, fn, arity): implementers
3609
- // come from the `implements` edges extraction resolved, and the target is
3610
- // the implementer module's own exported `fn` node OF THE SITE'S ARITY —
3611
- // function qualifiedNames carry arity (`mod::fn/2`, #1610), so the arity the
3612
- // dispatch site used selects among same-named definitions.
3613
3963
  const targetCache = new Map();
3614
3964
  const qnArity = (qn) => {
3615
3965
  const m = /\/(\d{1,3})$/.exec(qn);
@@ -3637,8 +3987,6 @@ async function erlangBehaviourDispatchEdges(queries, ctx, onYield) {
3637
3987
  targetCache.set(cacheKey, targets);
3638
3988
  return targets;
3639
3989
  };
3640
- // Pass 2 — dispatch sites. Only files containing a var-module call shape are
3641
- // scanned in full.
3642
3990
  const edges = [];
3643
3991
  const seen = new Set();
3644
3992
  for (const file of ctx.getAllFiles()) {
@@ -3663,12 +4011,12 @@ async function erlangBehaviourDispatchEdges(queries, ctx, onYield) {
3663
4011
  continue;
3664
4012
  const behaviours = declaringBehaviours.get(`${fn}/${arity}`);
3665
4013
  if (!behaviours || behaviours.length !== 1)
3666
- continue; // unknown or ambiguous
4014
+ continue;
3667
4015
  const behaviour = behaviours[0];
3668
4016
  const targets = targetsOf(behaviour, fn, arity);
3669
4017
  if (targets.length === 0 || targets.length > ERLANG_BEHAVIOUR_FANOUT_CAP)
3670
4018
  continue;
3671
- const line = safe.slice(0, m.index).split('\n').length;
4019
+ const line = lineOf(safe, m.index);
3672
4020
  const disp = (0, synth_utils_1.enclosingFn)(nodesInFile, line);
3673
4021
  if (!disp)
3674
4022
  continue;
@@ -3696,31 +4044,14 @@ async function erlangBehaviourDispatchEdges(queries, ctx, onYield) {
3696
4044
  }
3697
4045
  return edges;
3698
4046
  }
3699
- // ── Laravel events (PHP) ──────────────────────────────────────────────────────
3700
- // Laravel decouples an event dispatch from its listener(s), linked by the EVENT CLASS:
3701
- // // app/Events/PlaybackStarted.php + app/Listeners/UpdateLastfmNowPlaying.php
3702
- // class UpdateLastfmNowPlaying { public function handle(PlaybackStarted $event) { … } }
3703
- // // a controller / service — a DIFFERENT file
3704
- // event(new PlaybackStarted($song, $user));
3705
- // Bridge it: link the enclosing method at each `event(new XEvent(...))` site → every listener's
3706
- // `handle` for XEvent. Listeners come from TWO registration mechanisms (both real, both needed):
3707
- // (A) auto-discovery — a `handle(EventType $e)` typed first param (also splits a union A|B);
3708
- // (B) the `protected $listen = [ XEvent::class => [Listener::class, …] ]` map in an
3709
- // EventServiceProvider, which also covers a listener whose `handle()` is UNTYPED.
3710
- // Only `event(new X)` is matched — queued JOBS dispatch via `::dispatch()` and their `handle()`
3711
- // takes an injected service, never an event type, so jobs are excluded by construction.
3712
4047
  const LARAVEL_DISPATCH_RE = /\bevent\s*\(\s*new\s+\\?([A-Za-z_][\w\\]*)/g;
3713
4048
  const LARAVEL_PHP_EXT = /\.php$/;
3714
4049
  const LARAVEL_FANOUT_CAP = 200;
3715
- // A `$listen` entry: `Event::class => [Listener::class, …]`, key/values as `::class` or strings.
3716
4050
  const LISTEN_ENTRY_RE = /(?:([A-Za-z_\\][\w\\]*)::class|'([^']+)'|"([^"]+)")\s*=>\s*\[([^\]]*)\]/g;
3717
4051
  const LISTEN_CLASS_RE = /(?:([A-Za-z_\\][\w\\]*)::class|'([^']+)'|"([^"]+)")/g;
3718
- /** Short class name from a PHP reference: `\App\Events\Foo` / `App\Events::Foo` → `Foo`. */
3719
4052
  function phpSimpleName(s) {
3720
4053
  return s.replace(/^\\/, '').split('\\').pop().split('::').pop().trim();
3721
4054
  }
3722
- /** The first-parameter class type(s) of a `handle(...)` declaration — union-split, short-named,
3723
- * primitives dropped. `handle(A|B $e)` → [A, B]; `handle(string $x)` / `handle()` → []. */
3724
4055
  function laravelHandleEventTypes(decl) {
3725
4056
  const m = /function\s+handle\s*\(\s*(?:\.\.\.\s*)?(\??[A-Za-z_\\][\w\\|]*)\s+&?\s*(?:\.\.\.\s*)?\$/.exec(decl);
3726
4057
  if (!m)
@@ -3731,7 +4062,6 @@ function laravelHandleEventTypes(decl) {
3731
4062
  .map((t) => phpSimpleName(t))
3732
4063
  .filter((t) => /^[A-Z]\w*$/.test(t));
3733
4064
  }
3734
- /** From an opening `[`, the bracket-balanced body up to its matching `]`. */
3735
4065
  function phpArrayBody(src, openIdx) {
3736
4066
  let depth = 0;
3737
4067
  for (let i = openIdx; i < src.length; i++) {
@@ -3744,7 +4074,6 @@ function phpArrayBody(src, openIdx) {
3744
4074
  }
3745
4075
  async function laravelEventEdges(ctx, onYield) {
3746
4076
  let scannedFiles = 0;
3747
- // event short name → its listener `handle` methods (deduped by node id).
3748
4077
  const listeners = new Map();
3749
4078
  const add = (event, handle) => {
3750
4079
  let m = listeners.get(event);
@@ -3758,7 +4087,6 @@ async function laravelEventEdges(ctx, onYield) {
3758
4087
  .getNodesInFile(cls.filePath)
3759
4088
  .find((n) => n.kind === 'method' && n.name === 'handle'
3760
4089
  && n.startLine >= cls.startLine && n.startLine <= (cls.endLine ?? cls.startLine)) ?? null;
3761
- // Pass 1 — build the event→handle map from both registration mechanisms.
3762
4090
  for (const file of ctx.getAllFiles()) {
3763
4091
  if ((++scannedFiles & 15) === 0)
3764
4092
  await onYield();
@@ -3767,7 +4095,6 @@ async function laravelEventEdges(ctx, onYield) {
3767
4095
  const content = ctx.readFile(file);
3768
4096
  if (!content)
3769
4097
  continue;
3770
- // (A) typed listener handles — node-driven, so a commented-out method can't leak in.
3771
4098
  if (content.includes('function handle')) {
3772
4099
  const lines = content.split('\n');
3773
4100
  for (const node of ctx.getNodesInFile(file)) {
@@ -3778,8 +4105,6 @@ async function laravelEventEdges(ctx, onYield) {
3778
4105
  add(ev, node);
3779
4106
  }
3780
4107
  }
3781
- // (B) the EventServiceProvider `$listen` map — parsed from comment-stripped source so a
3782
- // fully-commented map (firefly's, on auto-discovery) contributes nothing.
3783
4108
  if (content.includes('$listen')) {
3784
4109
  const safe = (0, strip_comments_1.stripCommentsForRegex)(content, 'php');
3785
4110
  const decl = safe.search(/\$listen\s*=\s*\[/);
@@ -3803,7 +4128,6 @@ async function laravelEventEdges(ctx, onYield) {
3803
4128
  }
3804
4129
  if (!listeners.size)
3805
4130
  return [];
3806
- // Pass 2 — link each event(new X(...)) site → every listener of X.
3807
4131
  const edges = [];
3808
4132
  const seen = new Set();
3809
4133
  for (const file of ctx.getAllFiles()) {
@@ -3823,7 +4147,7 @@ async function laravelEventEdges(ctx, onYield) {
3823
4147
  const targets = listeners.get(phpSimpleName(m[1]));
3824
4148
  if (!targets)
3825
4149
  continue;
3826
- const line = safe.slice(0, m.index).split('\n').length;
4150
+ const line = lineOf(safe, m.index);
3827
4151
  const disp = (0, synth_utils_1.enclosingFn)(nodesInFile, line);
3828
4152
  if (!disp)
3829
4153
  continue;
@@ -3849,23 +4173,26 @@ async function laravelEventEdges(ctx, onYield) {
3849
4173
  return edges;
3850
4174
  }
3851
4175
  const ALWAYS = () => true;
3852
- /** Conservative input gates for SYNTH_PASSES; keep these in sync when adding a pass. */
3853
4176
  function hasSynthesisPattern(filePath, content) {
3854
- // These passes consume declarations/layouts as well as dispatch sites. A
3855
- // header or markup edit can change a channel whose endpoints live elsewhere.
3856
4177
  if (/\.(?:vue|svelte|dfm|fmx|nix|xml)$/.test(filePath))
3857
4178
  return true;
4179
+ if (next_proxy_1.NEXT_PROXY_FILE.test(filePath) || (0, nextjs_1.nextRouteForFile)(filePath) !== null)
4180
+ return true;
3858
4181
  if (/\.(?:c|h|cc|cpp|cxx|hpp|hh|hxx|cppm|ipp|inl|tcc|def|inc|tbl)$/i.test(filePath) &&
3859
- /\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))
3860
4183
  return true;
3861
4184
  if (/\b(?:class|interface|protocol|trait|impl|extends|implements|expect|actual)\b/.test(content))
3862
4185
  return true;
3863
- if (/\.go$/.test(filePath) && /\b(?:struct|interface)\b|\bfunc\s*\(/.test(content))
4186
+ if (/\.go$/.test(filePath))
3864
4187
  return true;
3865
- if ((0, tier_synthesizer_1.hasCrossTierPattern)(content))
4188
+ if ((0, tier_synthesizer_1.hasCrossTierPattern)(content) || (0, tier_synthesizer_1.hasTestRequestPattern)(filePath, content) || (0, tauri_synthesizer_1.hasTauriPattern)(filePath, content))
3866
4189
  return true;
3867
4190
  if (/\b(?:render|build|setState|defineStore|createStore|createApi|Store|href|sendEvent|sendEventWithName)\b|<\/|\/>/.test(content))
3868
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;
3869
4196
  if (/\.(?:forEach|append|add|push|insert|fire|dispatchEvent|addListener|Use|GET|POST|PUT|PATCH|DELETE|OPTIONS|HEAD|Any|Handle)\s*\(/.test(content))
3870
4197
  return true;
3871
4198
  if (/[\w$]\s*\[\s*[A-Za-z_$]/.test(content) || /\b(?:dispatch|commit)\s*\(/.test(content))
@@ -3882,24 +4209,14 @@ function hasSynthesisPattern(filePath, content) {
3882
4209
  if (matches)
3883
4210
  return true;
3884
4211
  }
3885
- // Field-backed observers use method-name gates rather than fixed call names.
3886
4212
  return (content.match(/[A-Za-z_$][\w$]*/g) ?? []).some((name) => REGISTRAR_NAME.test(name) || DISPATCHER_NAME.test(name));
3887
4213
  }
3888
- /**
3889
- * The independent passes, in MERGE ORDER — the first-seen dedup in
3890
- * synthesizeCallbackEdges follows this array, so reordering entries changes
3891
- * which duplicate edge wins. The two Go pre-passes (cross-file method
3892
- * `contains`, implicit `implements`) are NOT here: they persist before these
3893
- * run because interfaceOverrideEdges reads their edges from the DB.
3894
- */
3895
4214
  exports.SYNTH_PASSES = [
3896
4215
  { name: 'fieldEdges', gate: ALWAYS, run: (q, c, y) => fieldChannelEdges(q, c, y) },
3897
4216
  { name: 'closureCollEdges', gate: ALWAYS, run: (q, c, y) => closureCollectionEdges(q, c, y) },
3898
- // Cross-tier channels — a client's `fetch('/api/x')` onto its own route,
3899
- // a queue job onto its consumer, a bus / socket event onto its handler.
3900
- // Before the in-process emitter pass: the same (source, target) pair
3901
- // keeps the more specific edge — the one that says which tier it crosses.
3902
4217
  { name: 'tierEdges', gate: (has) => has(...JS_FAMILY), run: (_q, c, y) => (0, tier_synthesizer_1.crossTierEdges)(c, y) },
4218
+ { name: 'tauriEdges', gate: (has) => has('rust') && has('vue', 'svelte', ...JS_FAMILY), run: (q, c, y) => (0, tauri_synthesizer_1.tauriEdges)(q, c, y) },
4219
+ { name: 'testRequestEdges', gate: (has) => has('java', 'kotlin', 'php'), run: (_q, c, y) => (0, tier_synthesizer_1.testRequestEdges)(c, y) },
3903
4220
  { name: 'emitterEdges', gate: ALWAYS, run: (_q, c, y) => eventEmitterEdges(c, y) },
3904
4221
  { name: 'renderEdges', gate: ALWAYS, run: (q, c, y) => reactRenderEdges(q, c, y) },
3905
4222
  { name: 'jsxEdges', gate: (has) => has(...JS_FAMILY), run: (_q, c, y) => reactJsxChildEdges(c, y) },
@@ -3910,24 +4227,17 @@ exports.SYNTH_PASSES = [
3910
4227
  { name: 'arkuiStateEdges', gate: (has) => has('arkts'), run: (q, c, y) => arkuiStateBuildEdges(q, c, y) },
3911
4228
  { name: 'arkuiEmitter', gate: (has) => has('arkts'), run: (_q, c, y) => arkuiEmitterEdges(c, y) },
3912
4229
  { name: 'arkuiRoutes', gate: (has) => has('arkts'), run: (_q, c, y) => arkuiRouterEdges(c, y) },
3913
- { 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) },
3914
4231
  {
3915
4232
  name: 'ifaceEdges',
3916
4233
  gate: (has) => has('java', 'kotlin', 'csharp', 'swift', 'scala', 'go', 'rust', 'arkts', ...JS_FAMILY),
3917
- run: (q, _c, y) => interfaceOverrideEdges(q, y),
4234
+ run: (q, c, y) => interfaceOverrideEdges(q, c, y),
3918
4235
  },
3919
4236
  { name: 'kotlinExpectActual', gate: (has) => has('kotlin'), run: (q, _c, y) => kotlinExpectActualEdges(q, y) },
3920
4237
  { name: 'goGrpcEdges', gate: (has) => has('go'), run: (q, _c, y) => goGrpcStubImplEdges(q, y) },
3921
4238
  { name: 'rnEventEdgesList', gate: (has) => has(...JS_FAMILY), run: (_q, c, y) => rnEventEdges(c, y) },
3922
4239
  { name: 'fabricNativeEdges', gate: ALWAYS, run: (_q, c, y) => fabricNativeImplEdges(c, y) },
3923
- // Expo module nodes (`expo-module:` ids) are emitted only from .swift/.kt
3924
- // files, and a pair needs BOTH platforms — so without both languages the
3925
- // pass's only collection loop is provably empty (it was streaming every
3926
- // method row on pure-Java repos to find nothing).
3927
4240
  { name: 'expoXPlatEdges', gate: (has) => has('swift') && has('kotlin'), run: (q, _c, y) => expoCrossPlatformEdges(q, y) },
3928
- // An RN cross-platform edge requires a JS-language caller on the native
3929
- // method (`isBridge`) — no JS-family files means no JS-language nodes, so
3930
- // the result is provably empty.
3931
4241
  { name: 'rnXPlatEdges', gate: (has) => has(...JS_FAMILY), run: (q, _c, y) => rnCrossPlatformEdges(q, y) },
3932
4242
  {
3933
4243
  name: 'mybatisEdges',
@@ -3936,6 +4246,7 @@ exports.SYNTH_PASSES = [
3936
4246
  },
3937
4247
  { name: 'ginEdges', gate: (has) => has('go'), run: (q, c, y) => ginMiddlewareChainEdges(q, c, y) },
3938
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) },
3939
4250
  { name: 'registryEdges', gate: ALWAYS, run: (_q, c, y) => objectRegistryEdges(c, y) },
3940
4251
  { name: 'rtkEdges', gate: (has) => has(...JS_FAMILY), run: (q, c, y) => rtkQueryEdges(q, c, y) },
3941
4252
  { name: 'piniaEdges', gate: (has) => has('vue', ...JS_FAMILY), run: (_q, c, y) => piniaStoreEdges(c, y) },
@@ -3955,62 +4266,42 @@ exports.SYNTH_PASSES = [
3955
4266
  gate: (has) => has('c', 'cpp'),
3956
4267
  run: (q, c, y, sub) => (0, c_fnptr_synthesizer_1.cFnPointerDispatchEdges)(q, c, y, sub),
3957
4268
  },
4269
+ { name: 'cppTemplateEdges', gate: (has) => has('cpp'), run: (q, c, y) => (0, cpp_template_instantiations_1.cppTemplateArgumentEdges)(q, c, y) },
3958
4270
  { name: 'goframeEdges', gate: (has) => has('go'), run: (_q, c, y) => (0, goframe_synthesizer_1.goframeRouteEdges)(c, y) },
3959
- // `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) },
3960
4272
  { name: 'expoRouterReturnEdges', gate: (has) => has(...JS_FAMILY), run: (_q, c, y) => (0, expo_router_synthesizer_1.expoRouterReturnEdges)(c, y) },
3961
- // `<Link href="/x">` / an internal `<a href>` — markup, not a call; the component navigates.
3962
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) },
3963
4275
  { name: 'reactRouterLinkEdges', gate: (has) => has(...JS_FAMILY), run: (_q, c, y) => (0, react_router_synthesizer_1.reactRouterLinkEdges)(c, y) },
3964
4276
  { name: 'tanstackLinkEdges', gate: (has) => has(...JS_FAMILY), run: (_q, c, y) => (0, tanstack_router_synthesizer_1.tanstackLinkEdges)(c, y) },
3965
4277
  { name: 'vueRouterLinkEdges', gate: (has) => has('vue', ...JS_FAMILY), run: (_q, c, y) => (0, vue_router_synthesizer_1.vueRouterLinkEdges)(c, y) },
4278
+ { name: 'angularTemplateEdges', gate: (has) => has('typescript'), run: (_q, c, y) => (0, angular_template_synthesizer_1.angularTemplateEdges)(c, y) },
3966
4279
  { name: 'svelteKitPageEdges', gate: (has) => has('svelte'), run: (_q, c, y) => (0, sveltekit_synthesizer_1.svelteKitPageComponentEdges)(c, y) },
3967
4280
  { name: 'svelteKitLinkEdges', gate: (has) => has('svelte'), run: (_q, c, y) => (0, sveltekit_synthesizer_1.svelteKitLinkEdges)(c, y) },
3968
4281
  { name: 'nixOptionEdges', gate: (has) => has('nix'), run: (q, _c, y) => nixOptionPathEdges(q, y) },
3969
4282
  ];
3970
- /**
3971
- * Rough relative cost of the passes that run longest on large repos. Only
3972
- * the pooled dispatch ORDER reads it — heaviest first, so the longest passes
3973
- * start before the short ones fill the workers; unlisted passes keep registry
3974
- * order after these. A wrong hint costs wall time, never edges.
3975
- */
3976
4283
  const SYNTH_PASS_COST_HINT = {
3977
- cFnPtrEdges: 100, registryEdges: 60, tierEdges: 55, jsxEdges: 25, rnEventEdgesList: 24,
4284
+ cFnPtrEdges: 100, registryEdges: 60, tierEdges: 55, goFuncFieldEdges: 30, jsxEdges: 25, rnEventEdgesList: 24,
3978
4285
  ifaceEdges: 18, flutterEdges: 16, cppEdges: 15, emitterEdges: 12, fieldEdges: 11,
3979
4286
  mybatisEdges: 10, vuexEdges: 8, closureCollEdges: 6, piniaEdges: 5, renderEdges: 4,
3980
4287
  };
3981
4288
  function synthPassCostHint(name) {
3982
4289
  return SYNTH_PASS_COST_HINT[name] ?? 0;
3983
4290
  }
3984
- /** Fixed non-registry steps: goMethodContains, goImplements, dedupe-merge, insertMergedEdges. */
3985
4291
  const FIXED_SYNTH_STEPS = 4;
3986
4292
  exports.SYNTH_PROGRESS_STEPS = exports.SYNTH_PASSES.length + FIXED_SYNTH_STEPS;
3987
- async function synthesizeCallbackEdges(queries, ctx, onProgress,
3988
- // A live resolver pool to fan the independent passes across (structural type
3989
- // so this file never imports the pool — resolver-worker imports THIS file).
3990
- // Null/omitted → the sequential path, byte-identical to the pool path.
3991
- pool,
3992
- // WAL-valve writer backstop (WalCheckpointValve.backpressure), called at
3993
- // pool-idle points in the edge-insert loops below — the passes themselves
3994
- // only read; every write in this function happens with the pool idle.
3995
- backpressure,
3996
- // Main-thread work to run while the pool computes the passes (the main
3997
- // thread otherwise only waits there) — e.g. building a deferred index.
3998
- whilePoolBusy) {
3999
- // Each sub-pass below is a whole-graph scan, and there are ~30 of them, all
4000
- // running synchronously on the indexer's main thread. Their AGGREGATE can run
4001
- // for well over a minute on a large repo — long enough for the #850 liveness
4002
- // watchdog to SIGKILL the process mid-index (#1091), since its heartbeat lives
4003
- // on this same thread. Yield between passes so the heartbeat can fire; a pass
4004
- // that itself hangs (a real wedge) never reaches the next yield, so the
4005
- // 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) {
4006
4304
  const yieldToLoop = (0, cooperative_yield_1.createYielder)();
4007
- // Synthesis runs AFTER the resolution progress bar reaches 100%, so without
4008
- // its own progress the UI freezes at "Resolving refs 100%" for the whole
4009
- // tail — long enough on big repos that users conclude the index hung and
4010
- // kill it. Report each completed pass; the caller surfaces it as its own
4011
- // progress phase. Emit 0/total up front so the phase flips immediately.
4012
- // Emissions are throttled to whole-percent movement (each consumes a UI
4013
- // message); values may be fractional steps from within-pass reporting.
4014
4305
  let passesDone = 0;
4015
4306
  let lastPct = -1;
4016
4307
  const emit = (value) => {
@@ -4023,14 +4314,8 @@ whilePoolBusy) {
4023
4314
  lastPct = pct;
4024
4315
  onProgress(v, exports.SYNTH_PROGRESS_STEPS);
4025
4316
  };
4026
- // A single long pass otherwise parks the bar between steps; a pass that
4027
- // takes this callback reports a 0..1 fraction of its own work, surfaced
4028
- // here as fractional progress within its step.
4029
4317
  const subProgress = (fraction) => emit(passesDone + Math.max(0, Math.min(fraction, 1)));
4030
4318
  emit(0);
4031
- // Per-pass wall-clock timing to stderr, opt-in via CODEGRAPH_SYNTH_TIMINGS
4032
- // (=1: passes over 250ms; =all: every pass). This is the diagnostic that
4033
- // located both the #1091/#1122 watchdog stalls and the #1212 OOM — keep it.
4034
4319
  const markT = { t: Date.now() };
4035
4320
  const __mark = (label) => {
4036
4321
  const now = Date.now();
@@ -4042,22 +4327,9 @@ whilePoolBusy) {
4042
4327
  passesDone++;
4043
4328
  emit(passesDone);
4044
4329
  };
4045
- // Language gating: one indexed DISTINCT over the files table lets a pass
4046
- // whose own filters reference a specific language/extension be skipped
4047
- // outright when the project has no such files — its result is provably
4048
- // empty, so skipping is behavior-identical and the cost drops to zero
4049
- // (the Kotlin pass was the OOM culprit on the pure-C Linux kernel, #1212).
4050
- // Passes without an explicit language filter always run.
4051
4330
  const langs = queries.getDistinctFileLanguages();
4052
4331
  const has = (...ls) => ls.some((l) => langs.has(l));
4053
4332
  const NONE = [];
4054
- // Cross-file Go method→type `contains` edges must be synthesized AND persisted
4055
- // FIRST: a method declared in a different file from its receiver type is
4056
- // otherwise orphaned from the struct, and goImplementsEdges (next) derives a
4057
- // struct's method set from its `contains` edges — so without this it would
4058
- // under-count the interfaces a cross-file struct satisfies. (#583)
4059
- // Writer-side WAL backstop for the insert loops here (see the param doc):
4060
- // one fstat when under the valve's hard cap, a parked full backfill past it.
4061
4333
  const foldIfOver = async () => {
4062
4334
  const bp = backpressure?.();
4063
4335
  if (bp)
@@ -4071,11 +4343,7 @@ whilePoolBusy) {
4071
4343
  }
4072
4344
  await yieldToLoop();
4073
4345
  __mark('goMethodContains');
4074
- // Go implicit `implements` edges must be synthesized AND persisted next: the
4075
- // interface-dispatch bridge below reads `implements` edges from the DB, and
4076
- // Go has none statically. (Other languages already have static implements
4077
- // edges from extraction, so they don't need this pre-pass.)
4078
- const goImpl = has('go') ? await goImplementsEdges(queries, yieldToLoop) : NONE;
4346
+ const goImpl = has('go') ? await goImplementsEdges(queries, ctx, yieldToLoop) : NONE;
4079
4347
  for (let i = 0; i < goImpl.length; i += 2000) {
4080
4348
  queries.insertEdges(goImpl.slice(i, i + 2000));
4081
4349
  await yieldToLoop();
@@ -4083,14 +4351,6 @@ whilePoolBusy) {
4083
4351
  }
4084
4352
  await yieldToLoop();
4085
4353
  __mark('goImplements');
4086
- // Run the independent passes (see SYNTH_PASSES). Their results are merged in
4087
- // REGISTRY ORDER below regardless of execution order, and none of their edges
4088
- // persist until that merge — so every pass sees the same committed
4089
- // post-resolution DB state whether it runs sequentially here or on a resolver
4090
- // pool worker. With a live pool (already booted on ≥150k-ref repos), passes
4091
- // fan out across its read-only workers and the per-pass wall-clock comes from
4092
- // the worker; a pass that fails on a worker falls back to running on the main
4093
- // thread, so a worker crash isolates to a retry instead of failing synthesis.
4094
4354
  const passEdges = new Array(exports.SYNTH_PASSES.length).fill(NONE);
4095
4355
  const markPass = (label, dt) => {
4096
4356
  if (process.env.CODEGRAPH_SYNTH_TIMINGS && (dt > 250 || process.env.CODEGRAPH_SYNTH_TIMINGS === 'all')) {
@@ -4113,27 +4373,26 @@ whilePoolBusy) {
4113
4373
  else
4114
4374
  markPass(exports.SYNTH_PASSES[i].name, 0);
4115
4375
  }
4116
- // Above this node count, a pass that OOM-killed its worker must NOT be
4117
- // retried on the main thread — the retry would OOM the whole process and
4118
- // take the index with it (the #1212 failure class). Below it, a worker
4119
- // failure is more likely a transient crash than a memory ceiling, and the
4120
- // main-thread retry keeps coverage. Skipping loses only that pass's
4121
- // synthesized edges; the index still completes.
4122
4376
  const MAIN_RETRY_MAX_NODES = 1_500_000;
4123
4377
  const graphNodes = queries.getNodeAndEdgeCount().nodes;
4124
- // Files whose text could feed a pass (inputs that produce NO edges included,
4125
- // e.g. an over-cap channel: deleting one may make the full pass viable). It
4126
- // depends only on the files, so with a pool the main thread reads them while
4127
- // the workers run the passes instead of after.
4128
4378
  const collectInputs = async () => {
4129
- const found = [];
4379
+ const found = new Set();
4380
+ const tagModules = new Map();
4130
4381
  for (const file of ctx.getAllFiles()) {
4131
4382
  const content = ctx.readFile(file);
4132
- if (content !== null && hasSynthesisPattern(file, content))
4133
- 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
+ }
4134
4393
  await yieldToLoop();
4135
4394
  }
4136
- return found;
4395
+ return [...found];
4137
4396
  };
4138
4397
  let inputs = null;
4139
4398
  if (pool && gatedIn.length > 1) {
@@ -4146,22 +4405,13 @@ whilePoolBusy) {
4146
4405
  }
4147
4406
  catch (err) {
4148
4407
  if (graphNodes > MAIN_RETRY_MAX_NODES) {
4149
- // Worker died at a scale where the main-thread retry is a process
4150
- // OOM risk: skip the pass, keep the index alive, and say so.
4151
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)}`);
4152
4409
  markPass(`${pass.name} (skipped at scale)`, 0);
4153
4410
  return;
4154
4411
  }
4155
- // Worker-side failure (crash, OOM, unknown pass after a version
4156
- // mismatch): retry this one pass on the main thread.
4157
4412
  await runPassOnMain(i);
4158
4413
  }
4159
4414
  };
4160
- // One pass per worker at a time, heaviest first. Handing every pass out
4161
- // at once split them by count, and a worker interleaves what it holds, so
4162
- // a heavy pass finished only with its worker's whole share: on vscode the
4163
- // 6s registry pass ended ~16s in. Pulling keeps workers busy until the
4164
- // queue drains. Edges merge by registry index below, so order is free.
4165
4415
  const lanes = Math.min(pool.size ?? gatedIn.length, gatedIn.length);
4166
4416
  const queue = [...gatedIn].sort((a, b) => synthPassCostHint(exports.SYNTH_PASSES[b].name) - synthPassCostHint(exports.SYNTH_PASSES[a].name) || a - b);
4167
4417
  const lane = async () => {
@@ -4169,8 +4419,6 @@ whilePoolBusy) {
4169
4419
  await runPooled(i);
4170
4420
  };
4171
4421
  const fanOut = Promise.all(Array.from({ length: lanes }, lane));
4172
- // Observed now, awaited below: a rejection while the scan runs must not
4173
- // surface as an unhandled one.
4174
4422
  fanOut.catch(() => undefined);
4175
4423
  whilePoolBusy?.();
4176
4424
  inputs = await collectInputs();
@@ -4181,6 +4429,12 @@ whilePoolBusy) {
4181
4429
  await runPassOnMain(i);
4182
4430
  }
4183
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
+ };
4184
4438
  const merged = [];
4185
4439
  const seen = new Set();
4186
4440
  for (const e of passEdges.flat()) {
@@ -4188,12 +4442,11 @@ whilePoolBusy) {
4188
4442
  if (seen.has(key))
4189
4443
  continue;
4190
4444
  seen.add(key);
4445
+ if (mockNodes.size > 0 && mockNodes.has(e.target) && !fromTestCode(e.source))
4446
+ continue;
4191
4447
  merged.push(e);
4192
4448
  }
4193
4449
  __mark('dedupe-merge');
4194
- // Chunked insert with yields: on the Linux kernel the merged synthesized
4195
- // edge set is ~275k rows, and one transaction for all of them was a 20s
4196
- // unyielded main-thread span (#1212 follow-up) — the last one in the tail.
4197
4450
  for (let i = 0; i < merged.length; i += 2000) {
4198
4451
  queries.insertEdges(merged.slice(i, i + 2000));
4199
4452
  await yieldToLoop();