@colbymchenry/codegraph-win32-arm64 1.6.2 → 1.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1036) hide show
  1. package/bin/codegraph +1 -1
  2. package/bin/codegraph.cmd +1 -1
  3. package/lib/dist/.test-build-engine.json +1 -1
  4. package/lib/dist/.test-build-viewer.json +1 -1
  5. package/lib/dist/bin/codegraph.d.ts +3 -0
  6. package/lib/dist/bin/codegraph.d.ts.map +1 -1
  7. package/lib/dist/bin/codegraph.js +425 -688
  8. package/lib/dist/bin/codegraph.js.map +1 -1
  9. package/lib/dist/bin/command-supervision.js +1 -57
  10. package/lib/dist/bin/command-supervision.js.map +1 -1
  11. package/lib/dist/bin/fatal-handler.js +0 -46
  12. package/lib/dist/bin/fatal-handler.js.map +1 -1
  13. package/lib/dist/bin/node-version-check.js +0 -33
  14. package/lib/dist/bin/node-version-check.js.map +1 -1
  15. package/lib/dist/bin/uninstall.js +0 -19
  16. package/lib/dist/bin/uninstall.js.map +1 -1
  17. package/lib/dist/bin/viewer-gate.js +0 -14
  18. package/lib/dist/bin/viewer-gate.js.map +1 -1
  19. package/lib/dist/compile-cache.d.ts +2 -0
  20. package/lib/dist/compile-cache.d.ts.map +1 -0
  21. package/lib/dist/compile-cache.js +45 -0
  22. package/lib/dist/compile-cache.js.map +1 -0
  23. package/lib/dist/context/formatter.js +3 -66
  24. package/lib/dist/context/formatter.js.map +1 -1
  25. package/lib/dist/context/index.d.ts +44 -1
  26. package/lib/dist/context/index.d.ts.map +1 -1
  27. package/lib/dist/context/index.js +123 -430
  28. package/lib/dist/context/index.js.map +1 -1
  29. package/lib/dist/context/markers.js +0 -17
  30. package/lib/dist/context/markers.js.map +1 -1
  31. package/lib/dist/db/index.d.ts +44 -1
  32. package/lib/dist/db/index.d.ts.map +1 -1
  33. package/lib/dist/db/index.js +123 -395
  34. package/lib/dist/db/index.js.map +1 -1
  35. package/lib/dist/db/migrations.d.ts +11 -1
  36. package/lib/dist/db/migrations.d.ts.map +1 -1
  37. package/lib/dist/db/migrations.js +71 -79
  38. package/lib/dist/db/migrations.js.map +1 -1
  39. package/lib/dist/db/name-substring-index.d.ts +63 -0
  40. package/lib/dist/db/name-substring-index.d.ts.map +1 -0
  41. package/lib/dist/db/name-substring-index.js +151 -0
  42. package/lib/dist/db/name-substring-index.js.map +1 -0
  43. package/lib/dist/db/node-sqlite.d.ts +19 -0
  44. package/lib/dist/db/node-sqlite.d.ts.map +1 -0
  45. package/lib/dist/db/node-sqlite.js +23 -0
  46. package/lib/dist/db/node-sqlite.js.map +1 -0
  47. package/lib/dist/db/open-error.d.ts +36 -0
  48. package/lib/dist/db/open-error.d.ts.map +1 -0
  49. package/lib/dist/db/open-error.js +63 -0
  50. package/lib/dist/db/open-error.js.map +1 -0
  51. package/lib/dist/db/parameter-flow-queries.d.ts +120 -0
  52. package/lib/dist/db/parameter-flow-queries.d.ts.map +1 -0
  53. package/lib/dist/db/parameter-flow-queries.js +168 -0
  54. package/lib/dist/db/parameter-flow-queries.js.map +1 -0
  55. package/lib/dist/db/queries.d.ts +610 -33
  56. package/lib/dist/db/queries.d.ts.map +1 -1
  57. package/lib/dist/db/queries.js +1345 -1419
  58. package/lib/dist/db/queries.js.map +1 -1
  59. package/lib/dist/db/reference-tail.d.ts +83 -0
  60. package/lib/dist/db/reference-tail.d.ts.map +1 -0
  61. package/lib/dist/db/reference-tail.js +68 -0
  62. package/lib/dist/db/reference-tail.js.map +1 -0
  63. package/lib/dist/db/schema.sql +18 -2
  64. package/lib/dist/db/sqlite-adapter.d.ts +18 -1
  65. package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
  66. package/lib/dist/db/sqlite-adapter.js +12 -62
  67. package/lib/dist/db/sqlite-adapter.js.map +1 -1
  68. package/lib/dist/db/synthesis-stage.d.ts.map +1 -1
  69. package/lib/dist/db/synthesis-stage.js +2 -6
  70. package/lib/dist/db/synthesis-stage.js.map +1 -1
  71. package/lib/dist/db/wal-valve.js +1 -153
  72. package/lib/dist/db/wal-valve.js.map +1 -1
  73. package/lib/dist/db/wsl-shared-index.js +0 -37
  74. package/lib/dist/db/wsl-shared-index.js.map +1 -1
  75. package/lib/dist/directory.d.ts +51 -0
  76. package/lib/dist/directory.d.ts.map +1 -1
  77. package/lib/dist/directory.js +76 -530
  78. package/lib/dist/directory.js.map +1 -1
  79. package/lib/dist/engine.d.ts +15 -0
  80. package/lib/dist/engine.d.ts.map +1 -0
  81. package/lib/dist/engine.js +34 -0
  82. package/lib/dist/engine.js.map +1 -0
  83. package/lib/dist/errors.d.ts +10 -0
  84. package/lib/dist/errors.d.ts.map +1 -1
  85. package/lib/dist/errors.js +8 -101
  86. package/lib/dist/errors.js.map +1 -1
  87. package/lib/dist/extraction/astro-extractor.d.ts.map +1 -1
  88. package/lib/dist/extraction/astro-extractor.js +11 -101
  89. package/lib/dist/extraction/astro-extractor.js.map +1 -1
  90. package/lib/dist/extraction/cfml-extractor.d.ts +27 -1
  91. package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -1
  92. package/lib/dist/extraction/cfml-extractor.js +66 -204
  93. package/lib/dist/extraction/cfml-extractor.js.map +1 -1
  94. package/lib/dist/extraction/commonjs-requires.js +0 -31
  95. package/lib/dist/extraction/commonjs-requires.js.map +1 -1
  96. package/lib/dist/extraction/dfm-extractor.js +0 -21
  97. package/lib/dist/extraction/dfm-extractor.js.map +1 -1
  98. package/lib/dist/extraction/extraction-version.d.ts +1 -1
  99. package/lib/dist/extraction/extraction-version.js +1 -24
  100. package/lib/dist/extraction/extraction-version.js.map +1 -1
  101. package/lib/dist/extraction/function-ref.d.ts +40 -0
  102. package/lib/dist/extraction/function-ref.d.ts.map +1 -1
  103. package/lib/dist/extraction/function-ref.js +145 -206
  104. package/lib/dist/extraction/function-ref.js.map +1 -1
  105. package/lib/dist/extraction/generated-detection.js +0 -165
  106. package/lib/dist/extraction/generated-detection.js.map +1 -1
  107. package/lib/dist/extraction/grammars.d.ts +45 -4
  108. package/lib/dist/extraction/grammars.d.ts.map +1 -1
  109. package/lib/dist/extraction/grammars.js +53 -430
  110. package/lib/dist/extraction/grammars.js.map +1 -1
  111. package/lib/dist/extraction/index.d.ts +197 -7
  112. package/lib/dist/extraction/index.d.ts.map +1 -1
  113. package/lib/dist/extraction/index.js +554 -1382
  114. package/lib/dist/extraction/index.js.map +1 -1
  115. package/lib/dist/extraction/kernel/decode.js +0 -16
  116. package/lib/dist/extraction/kernel/decode.js.map +1 -1
  117. package/lib/dist/extraction/kernel/index.d.ts +3 -1
  118. package/lib/dist/extraction/kernel/index.d.ts.map +1 -1
  119. package/lib/dist/extraction/kernel/index.js +25 -133
  120. package/lib/dist/extraction/kernel/index.js.map +1 -1
  121. package/lib/dist/extraction/kernel/layout.js +42 -76
  122. package/lib/dist/extraction/kernel/layout.js.map +1 -1
  123. package/lib/dist/extraction/kernel/loader.js +0 -37
  124. package/lib/dist/extraction/kernel/loader.js.map +1 -1
  125. package/lib/dist/extraction/languages/arkts.js +0 -59
  126. package/lib/dist/extraction/languages/arkts.js.map +1 -1
  127. package/lib/dist/extraction/languages/c-cpp.d.ts +125 -28
  128. package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
  129. package/lib/dist/extraction/languages/c-cpp.js +789 -856
  130. package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
  131. package/lib/dist/extraction/languages/cfquery.js +0 -9
  132. package/lib/dist/extraction/languages/cfquery.js.map +1 -1
  133. package/lib/dist/extraction/languages/cfscript.d.ts +20 -0
  134. package/lib/dist/extraction/languages/cfscript.d.ts.map +1 -1
  135. package/lib/dist/extraction/languages/cfscript.js +80 -9
  136. package/lib/dist/extraction/languages/cfscript.js.map +1 -1
  137. package/lib/dist/extraction/languages/cobol.js +0 -114
  138. package/lib/dist/extraction/languages/cobol.js.map +1 -1
  139. package/lib/dist/extraction/languages/cpp-brace-scopes.d.ts +66 -0
  140. package/lib/dist/extraction/languages/cpp-brace-scopes.d.ts.map +1 -0
  141. package/lib/dist/extraction/languages/cpp-brace-scopes.js +343 -0
  142. package/lib/dist/extraction/languages/cpp-brace-scopes.js.map +1 -0
  143. package/lib/dist/extraction/languages/cpp-macro-methods.d.ts +41 -0
  144. package/lib/dist/extraction/languages/cpp-macro-methods.d.ts.map +1 -0
  145. package/lib/dist/extraction/languages/cpp-macro-methods.js +487 -0
  146. package/lib/dist/extraction/languages/cpp-macro-methods.js.map +1 -0
  147. package/lib/dist/extraction/languages/csharp.js +3 -55
  148. package/lib/dist/extraction/languages/csharp.js.map +1 -1
  149. package/lib/dist/extraction/languages/dart.d.ts +84 -0
  150. package/lib/dist/extraction/languages/dart.d.ts.map +1 -1
  151. package/lib/dist/extraction/languages/dart.js +329 -161
  152. package/lib/dist/extraction/languages/dart.js.map +1 -1
  153. package/lib/dist/extraction/languages/erlang.d.ts.map +1 -1
  154. package/lib/dist/extraction/languages/erlang.js +15 -102
  155. package/lib/dist/extraction/languages/erlang.js.map +1 -1
  156. package/lib/dist/extraction/languages/go.d.ts +48 -0
  157. package/lib/dist/extraction/languages/go.d.ts.map +1 -1
  158. package/lib/dist/extraction/languages/go.js +102 -31
  159. package/lib/dist/extraction/languages/go.js.map +1 -1
  160. package/lib/dist/extraction/languages/index.js +0 -6
  161. package/lib/dist/extraction/languages/index.js.map +1 -1
  162. package/lib/dist/extraction/languages/java.d.ts.map +1 -1
  163. package/lib/dist/extraction/languages/java.js +67 -78
  164. package/lib/dist/extraction/languages/java.js.map +1 -1
  165. package/lib/dist/extraction/languages/javascript.d.ts.map +1 -1
  166. package/lib/dist/extraction/languages/javascript.js +2 -12
  167. package/lib/dist/extraction/languages/javascript.js.map +1 -1
  168. package/lib/dist/extraction/languages/kotlin.d.ts +11 -0
  169. package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -1
  170. package/lib/dist/extraction/languages/kotlin.js +35 -184
  171. package/lib/dist/extraction/languages/kotlin.js.map +1 -1
  172. package/lib/dist/extraction/languages/lua.js +2 -39
  173. package/lib/dist/extraction/languages/lua.js.map +1 -1
  174. package/lib/dist/extraction/languages/luau.js +0 -14
  175. package/lib/dist/extraction/languages/luau.js.map +1 -1
  176. package/lib/dist/extraction/languages/nix.js +0 -16
  177. package/lib/dist/extraction/languages/nix.js.map +1 -1
  178. package/lib/dist/extraction/languages/objc.d.ts.map +1 -1
  179. package/lib/dist/extraction/languages/objc.js +5 -16
  180. package/lib/dist/extraction/languages/objc.js.map +1 -1
  181. package/lib/dist/extraction/languages/pascal-preparse.d.ts +66 -0
  182. package/lib/dist/extraction/languages/pascal-preparse.d.ts.map +1 -0
  183. package/lib/dist/extraction/languages/pascal-preparse.js +958 -0
  184. package/lib/dist/extraction/languages/pascal-preparse.js.map +1 -0
  185. package/lib/dist/extraction/languages/pascal-system.d.ts +11 -0
  186. package/lib/dist/extraction/languages/pascal-system.d.ts.map +1 -0
  187. package/lib/dist/extraction/languages/pascal-system.js +23 -0
  188. package/lib/dist/extraction/languages/pascal-system.js.map +1 -0
  189. package/lib/dist/extraction/languages/pascal.d.ts.map +1 -1
  190. package/lib/dist/extraction/languages/pascal.js +3 -4
  191. package/lib/dist/extraction/languages/pascal.js.map +1 -1
  192. package/lib/dist/extraction/languages/php.js +5 -42
  193. package/lib/dist/extraction/languages/php.js.map +1 -1
  194. package/lib/dist/extraction/languages/python.js +2 -20
  195. package/lib/dist/extraction/languages/python.js.map +1 -1
  196. package/lib/dist/extraction/languages/r.js +8 -78
  197. package/lib/dist/extraction/languages/r.js.map +1 -1
  198. package/lib/dist/extraction/languages/ruby.d.ts.map +1 -1
  199. package/lib/dist/extraction/languages/ruby.js +17 -25
  200. package/lib/dist/extraction/languages/ruby.js.map +1 -1
  201. package/lib/dist/extraction/languages/rust.d.ts +10 -0
  202. package/lib/dist/extraction/languages/rust.d.ts.map +1 -1
  203. package/lib/dist/extraction/languages/rust.js +15 -47
  204. package/lib/dist/extraction/languages/rust.js.map +1 -1
  205. package/lib/dist/extraction/languages/scala.js +5 -41
  206. package/lib/dist/extraction/languages/scala.js.map +1 -1
  207. package/lib/dist/extraction/languages/solidity.js +1 -82
  208. package/lib/dist/extraction/languages/solidity.js.map +1 -1
  209. package/lib/dist/extraction/languages/swift.js +3 -47
  210. package/lib/dist/extraction/languages/swift.js.map +1 -1
  211. package/lib/dist/extraction/languages/terraform.js +6 -152
  212. package/lib/dist/extraction/languages/terraform.js.map +1 -1
  213. package/lib/dist/extraction/languages/typescript.d.ts +64 -0
  214. package/lib/dist/extraction/languages/typescript.d.ts.map +1 -1
  215. package/lib/dist/extraction/languages/typescript.js +73 -49
  216. package/lib/dist/extraction/languages/typescript.js.map +1 -1
  217. package/lib/dist/extraction/languages/vbnet.d.ts.map +1 -1
  218. package/lib/dist/extraction/languages/vbnet.js +9 -42
  219. package/lib/dist/extraction/languages/vbnet.js.map +1 -1
  220. package/lib/dist/extraction/lazy-frameworks.d.ts +15 -0
  221. package/lib/dist/extraction/lazy-frameworks.d.ts.map +1 -0
  222. package/lib/dist/extraction/lazy-frameworks.js +8 -0
  223. package/lib/dist/extraction/lazy-frameworks.js.map +1 -0
  224. package/lib/dist/extraction/liquid-extractor.d.ts +29 -3
  225. package/lib/dist/extraction/liquid-extractor.d.ts.map +1 -1
  226. package/lib/dist/extraction/liquid-extractor.js +89 -148
  227. package/lib/dist/extraction/liquid-extractor.js.map +1 -1
  228. package/lib/dist/extraction/mybatis-extractor.js +0 -78
  229. package/lib/dist/extraction/mybatis-extractor.js.map +1 -1
  230. package/lib/dist/extraction/parse-budget.js +0 -13
  231. package/lib/dist/extraction/parse-budget.js.map +1 -1
  232. package/lib/dist/extraction/parse-pool.d.ts +29 -5
  233. package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
  234. package/lib/dist/extraction/parse-pool.js +42 -174
  235. package/lib/dist/extraction/parse-pool.js.map +1 -1
  236. package/lib/dist/extraction/parse-worker.d.ts +1 -1
  237. package/lib/dist/extraction/parse-worker.d.ts.map +1 -1
  238. package/lib/dist/extraction/parse-worker.js +5 -58
  239. package/lib/dist/extraction/parse-worker.js.map +1 -1
  240. package/lib/dist/extraction/razor-extractor.d.ts +9 -0
  241. package/lib/dist/extraction/razor-extractor.d.ts.map +1 -1
  242. package/lib/dist/extraction/razor-extractor.js +45 -69
  243. package/lib/dist/extraction/razor-extractor.js.map +1 -1
  244. package/lib/dist/extraction/razor-script.d.ts +23 -0
  245. package/lib/dist/extraction/razor-script.d.ts.map +1 -0
  246. package/lib/dist/extraction/razor-script.js +244 -0
  247. package/lib/dist/extraction/razor-script.js.map +1 -0
  248. package/lib/dist/extraction/sfc-script.d.ts +42 -0
  249. package/lib/dist/extraction/sfc-script.d.ts.map +1 -1
  250. package/lib/dist/extraction/sfc-script.js +32 -31
  251. package/lib/dist/extraction/sfc-script.js.map +1 -1
  252. package/lib/dist/extraction/store-worker.d.ts +1 -1
  253. package/lib/dist/extraction/store-worker.d.ts.map +1 -1
  254. package/lib/dist/extraction/store-worker.js +1 -38
  255. package/lib/dist/extraction/store-worker.js.map +1 -1
  256. package/lib/dist/extraction/store-writer.js +2 -34
  257. package/lib/dist/extraction/store-writer.js.map +1 -1
  258. package/lib/dist/extraction/svelte-extractor.d.ts.map +1 -1
  259. package/lib/dist/extraction/svelte-extractor.js +11 -87
  260. package/lib/dist/extraction/svelte-extractor.js.map +1 -1
  261. package/lib/dist/extraction/syntax-tokens.d.ts +6 -5
  262. package/lib/dist/extraction/syntax-tokens.d.ts.map +1 -1
  263. package/lib/dist/extraction/syntax-tokens.js +4 -152
  264. package/lib/dist/extraction/syntax-tokens.js.map +1 -1
  265. package/lib/dist/extraction/tree-sitter-helpers.d.ts +37 -1
  266. package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
  267. package/lib/dist/extraction/tree-sitter-helpers.js +76 -68
  268. package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -1
  269. package/lib/dist/extraction/tree-sitter-types.d.ts +102 -22
  270. package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
  271. package/lib/dist/extraction/tree-sitter-types.js +0 -7
  272. package/lib/dist/extraction/tree-sitter-types.js.map +1 -1
  273. package/lib/dist/extraction/tree-sitter.d.ts +447 -9
  274. package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
  275. package/lib/dist/extraction/tree-sitter.js +1908 -2544
  276. package/lib/dist/extraction/tree-sitter.js.map +1 -1
  277. package/lib/dist/extraction/vue-extractor.d.ts +13 -0
  278. package/lib/dist/extraction/vue-extractor.d.ts.map +1 -1
  279. package/lib/dist/extraction/vue-extractor.js +52 -92
  280. package/lib/dist/extraction/vue-extractor.js.map +1 -1
  281. package/lib/dist/extraction/vue-options-api.js +0 -32
  282. package/lib/dist/extraction/vue-options-api.js.map +1 -1
  283. package/lib/dist/extraction/vue-template-calls.d.ts +37 -0
  284. package/lib/dist/extraction/vue-template-calls.d.ts.map +1 -0
  285. package/lib/dist/extraction/vue-template-calls.js +497 -0
  286. package/lib/dist/extraction/vue-template-calls.js.map +1 -0
  287. package/lib/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
  288. package/lib/dist/extraction/wasm-runtime-flags.d.ts +6 -0
  289. package/lib/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
  290. package/lib/dist/extraction/wasm-runtime-flags.js +1 -88
  291. package/lib/dist/extraction/wasm-runtime-flags.js.map +1 -1
  292. package/lib/dist/file-limits.d.ts +8 -0
  293. package/lib/dist/file-limits.d.ts.map +1 -1
  294. package/lib/dist/file-limits.js +13 -28
  295. package/lib/dist/file-limits.js.map +1 -1
  296. package/lib/dist/graph/branch-guards.d.ts.map +1 -1
  297. package/lib/dist/graph/branch-guards.js +4 -251
  298. package/lib/dist/graph/branch-guards.js.map +1 -1
  299. package/lib/dist/graph/call-sites.d.ts +12 -0
  300. package/lib/dist/graph/call-sites.d.ts.map +1 -0
  301. package/lib/dist/graph/call-sites.js +17 -0
  302. package/lib/dist/graph/call-sites.js.map +1 -0
  303. package/lib/dist/graph/cobol-copybooks.d.ts +75 -0
  304. package/lib/dist/graph/cobol-copybooks.d.ts.map +1 -0
  305. package/lib/dist/graph/cobol-copybooks.js +45 -0
  306. package/lib/dist/graph/cobol-copybooks.js.map +1 -0
  307. package/lib/dist/graph/dead-code.d.ts +26 -4
  308. package/lib/dist/graph/dead-code.d.ts.map +1 -1
  309. package/lib/dist/graph/dead-code.js +157 -311
  310. package/lib/dist/graph/dead-code.js.map +1 -1
  311. package/lib/dist/graph/dynamic-boundary-report.js +1 -88
  312. package/lib/dist/graph/dynamic-boundary-report.js.map +1 -1
  313. package/lib/dist/graph/file-cycles.d.ts +20 -0
  314. package/lib/dist/graph/file-cycles.d.ts.map +1 -0
  315. package/lib/dist/graph/file-cycles.js +79 -0
  316. package/lib/dist/graph/file-cycles.js.map +1 -0
  317. package/lib/dist/graph/go-package.d.ts +27 -0
  318. package/lib/dist/graph/go-package.d.ts.map +1 -0
  319. package/lib/dist/graph/go-package.js +49 -0
  320. package/lib/dist/graph/go-package.js.map +1 -0
  321. package/lib/dist/graph/index.d.ts +2 -0
  322. package/lib/dist/graph/index.d.ts.map +1 -1
  323. package/lib/dist/graph/index.js +4 -6
  324. package/lib/dist/graph/index.js.map +1 -1
  325. package/lib/dist/graph/named-symbol-flow.d.ts +5 -1
  326. package/lib/dist/graph/named-symbol-flow.d.ts.map +1 -1
  327. package/lib/dist/graph/named-symbol-flow.js +82 -223
  328. package/lib/dist/graph/named-symbol-flow.js.map +1 -1
  329. package/lib/dist/graph/owning-package.d.ts +59 -0
  330. package/lib/dist/graph/owning-package.d.ts.map +1 -0
  331. package/lib/dist/graph/owning-package.js +120 -0
  332. package/lib/dist/graph/owning-package.js.map +1 -0
  333. package/lib/dist/graph/queries.d.ts +2 -2
  334. package/lib/dist/graph/queries.d.ts.map +1 -1
  335. package/lib/dist/graph/queries.js +2 -135
  336. package/lib/dist/graph/queries.js.map +1 -1
  337. package/lib/dist/graph/symbol-lookup.d.ts +15 -3
  338. package/lib/dist/graph/symbol-lookup.d.ts.map +1 -1
  339. package/lib/dist/graph/symbol-lookup.js +47 -89
  340. package/lib/dist/graph/symbol-lookup.js.map +1 -1
  341. package/lib/dist/graph/synthesized-hop.d.ts +37 -0
  342. package/lib/dist/graph/synthesized-hop.d.ts.map +1 -0
  343. package/lib/dist/graph/synthesized-hop.js +62 -0
  344. package/lib/dist/graph/synthesized-hop.js.map +1 -0
  345. package/lib/dist/graph/test-code.d.ts +21 -0
  346. package/lib/dist/graph/test-code.d.ts.map +1 -0
  347. package/lib/dist/graph/test-code.js +50 -0
  348. package/lib/dist/graph/test-code.js.map +1 -0
  349. package/lib/dist/graph/traversal.d.ts +31 -2
  350. package/lib/dist/graph/traversal.d.ts.map +1 -1
  351. package/lib/dist/graph/traversal.js +98 -226
  352. package/lib/dist/graph/traversal.js.map +1 -1
  353. package/lib/dist/graph/type-hierarchy.js +0 -138
  354. package/lib/dist/graph/type-hierarchy.js.map +1 -1
  355. package/lib/dist/index.d.ts +190 -25
  356. package/lib/dist/index.d.ts.map +1 -1
  357. package/lib/dist/index.js +694 -1109
  358. package/lib/dist/index.js.map +1 -1
  359. package/lib/dist/installer/beta-signup.js +0 -39
  360. package/lib/dist/installer/beta-signup.js.map +1 -1
  361. package/lib/dist/installer/config-writer.js +0 -24
  362. package/lib/dist/installer/config-writer.js.map +1 -1
  363. package/lib/dist/installer/index.d.ts +9 -5
  364. package/lib/dist/installer/index.d.ts.map +1 -1
  365. package/lib/dist/installer/index.js +25 -159
  366. package/lib/dist/installer/index.js.map +1 -1
  367. package/lib/dist/installer/instructions-template.d.ts +1 -1
  368. package/lib/dist/installer/instructions-template.js +0 -37
  369. package/lib/dist/installer/instructions-template.js.map +1 -1
  370. package/lib/dist/installer/targets/antigravity.js +0 -113
  371. package/lib/dist/installer/targets/antigravity.js.map +1 -1
  372. package/lib/dist/installer/targets/bob.d.ts +20 -0
  373. package/lib/dist/installer/targets/bob.d.ts.map +1 -0
  374. package/lib/dist/installer/targets/bob.js +83 -0
  375. package/lib/dist/installer/targets/bob.js.map +1 -0
  376. package/lib/dist/installer/targets/claude.d.ts.map +1 -1
  377. package/lib/dist/installer/targets/claude.js +1 -185
  378. package/lib/dist/installer/targets/claude.js.map +1 -1
  379. package/lib/dist/installer/targets/codex.d.ts.map +1 -1
  380. package/lib/dist/installer/targets/codex.js +17 -109
  381. package/lib/dist/installer/targets/codex.js.map +1 -1
  382. package/lib/dist/installer/targets/copilot-cli.d.ts.map +1 -1
  383. package/lib/dist/installer/targets/copilot-cli.js +2 -54
  384. package/lib/dist/installer/targets/copilot-cli.js.map +1 -1
  385. package/lib/dist/installer/targets/copilot-jetbrains.js +0 -57
  386. package/lib/dist/installer/targets/copilot-jetbrains.js.map +1 -1
  387. package/lib/dist/installer/targets/copilot-vscode.js +0 -58
  388. package/lib/dist/installer/targets/copilot-vscode.js.map +1 -1
  389. package/lib/dist/installer/targets/cursor.js +7 -88
  390. package/lib/dist/installer/targets/cursor.js.map +1 -1
  391. package/lib/dist/installer/targets/droid.d.ts +18 -0
  392. package/lib/dist/installer/targets/droid.d.ts.map +1 -0
  393. package/lib/dist/installer/targets/droid.js +92 -0
  394. package/lib/dist/installer/targets/droid.js.map +1 -0
  395. package/lib/dist/installer/targets/dsh.d.ts +35 -0
  396. package/lib/dist/installer/targets/dsh.d.ts.map +1 -0
  397. package/lib/dist/installer/targets/dsh.js +267 -0
  398. package/lib/dist/installer/targets/dsh.js.map +1 -0
  399. package/lib/dist/installer/targets/gemini.js +0 -37
  400. package/lib/dist/installer/targets/gemini.js.map +1 -1
  401. package/lib/dist/installer/targets/grok.d.ts +25 -0
  402. package/lib/dist/installer/targets/grok.d.ts.map +1 -0
  403. package/lib/dist/installer/targets/grok.js +96 -0
  404. package/lib/dist/installer/targets/grok.js.map +1 -0
  405. package/lib/dist/installer/targets/hermes.d.ts +19 -7
  406. package/lib/dist/installer/targets/hermes.d.ts.map +1 -1
  407. package/lib/dist/installer/targets/hermes.js +218 -214
  408. package/lib/dist/installer/targets/hermes.js.map +1 -1
  409. package/lib/dist/installer/targets/json-config.d.ts +45 -0
  410. package/lib/dist/installer/targets/json-config.d.ts.map +1 -0
  411. package/lib/dist/installer/targets/json-config.js +128 -0
  412. package/lib/dist/installer/targets/json-config.js.map +1 -0
  413. package/lib/dist/installer/targets/kimi.d.ts +21 -0
  414. package/lib/dist/installer/targets/kimi.d.ts.map +1 -0
  415. package/lib/dist/installer/targets/kimi.js +97 -0
  416. package/lib/dist/installer/targets/kimi.js.map +1 -0
  417. package/lib/dist/installer/targets/kiro.js +1 -41
  418. package/lib/dist/installer/targets/kiro.js.map +1 -1
  419. package/lib/dist/installer/targets/opencode.js +0 -102
  420. package/lib/dist/installer/targets/opencode.js.map +1 -1
  421. package/lib/dist/installer/targets/pi.d.ts +24 -0
  422. package/lib/dist/installer/targets/pi.d.ts.map +1 -0
  423. package/lib/dist/installer/targets/pi.js +100 -0
  424. package/lib/dist/installer/targets/pi.js.map +1 -0
  425. package/lib/dist/installer/targets/qoder.d.ts +23 -0
  426. package/lib/dist/installer/targets/qoder.d.ts.map +1 -0
  427. package/lib/dist/installer/targets/qoder.js +83 -0
  428. package/lib/dist/installer/targets/qoder.js.map +1 -0
  429. package/lib/dist/installer/targets/qwen.d.ts +21 -0
  430. package/lib/dist/installer/targets/qwen.d.ts.map +1 -0
  431. package/lib/dist/installer/targets/qwen.js +115 -0
  432. package/lib/dist/installer/targets/qwen.js.map +1 -0
  433. package/lib/dist/installer/targets/registry.d.ts.map +1 -1
  434. package/lib/dist/installer/targets/registry.js +18 -25
  435. package/lib/dist/installer/targets/registry.js.map +1 -1
  436. package/lib/dist/installer/targets/shared.d.ts +81 -11
  437. package/lib/dist/installer/targets/shared.d.ts.map +1 -1
  438. package/lib/dist/installer/targets/shared.js +183 -129
  439. package/lib/dist/installer/targets/shared.js.map +1 -1
  440. package/lib/dist/installer/targets/toml.d.ts +82 -6
  441. package/lib/dist/installer/targets/toml.d.ts.map +1 -1
  442. package/lib/dist/installer/targets/toml.js +318 -112
  443. package/lib/dist/installer/targets/toml.js.map +1 -1
  444. package/lib/dist/installer/targets/types.d.ts +1 -1
  445. package/lib/dist/installer/targets/types.d.ts.map +1 -1
  446. package/lib/dist/installer/targets/types.js +0 -13
  447. package/lib/dist/installer/targets/types.js.map +1 -1
  448. package/lib/dist/installer/targets/windsurf.d.ts +22 -0
  449. package/lib/dist/installer/targets/windsurf.d.ts.map +1 -0
  450. package/lib/dist/installer/targets/windsurf.js +90 -0
  451. package/lib/dist/installer/targets/windsurf.js.map +1 -0
  452. package/lib/dist/lazy-engine.d.ts +22 -0
  453. package/lib/dist/lazy-engine.d.ts.map +1 -0
  454. package/lib/dist/lazy-engine.js +16 -0
  455. package/lib/dist/lazy-engine.js.map +1 -0
  456. package/lib/dist/mcp/answer-freshness.js +0 -6
  457. package/lib/dist/mcp/answer-freshness.js.map +1 -1
  458. package/lib/dist/mcp/daemon-manager.js +2 -23
  459. package/lib/dist/mcp/daemon-manager.js.map +1 -1
  460. package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
  461. package/lib/dist/mcp/daemon-paths.js +2 -85
  462. package/lib/dist/mcp/daemon-paths.js.map +1 -1
  463. package/lib/dist/mcp/daemon-registry.d.ts +40 -0
  464. package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
  465. package/lib/dist/mcp/daemon-registry.js +174 -137
  466. package/lib/dist/mcp/daemon-registry.js.map +1 -1
  467. package/lib/dist/mcp/daemon.d.ts +23 -0
  468. package/lib/dist/mcp/daemon.d.ts.map +1 -1
  469. package/lib/dist/mcp/daemon.js +89 -373
  470. package/lib/dist/mcp/daemon.js.map +1 -1
  471. package/lib/dist/mcp/dynamic-boundaries.js +4 -78
  472. package/lib/dist/mcp/dynamic-boundaries.js.map +1 -1
  473. package/lib/dist/mcp/early-ppid.js +0 -24
  474. package/lib/dist/mcp/early-ppid.js.map +1 -1
  475. package/lib/dist/mcp/engine.d.ts +8 -0
  476. package/lib/dist/mcp/engine.d.ts.map +1 -1
  477. package/lib/dist/mcp/engine.js +33 -152
  478. package/lib/dist/mcp/engine.js.map +1 -1
  479. package/lib/dist/mcp/explore-dedup.js +0 -108
  480. package/lib/dist/mcp/explore-dedup.js.map +1 -1
  481. package/lib/dist/mcp/explore-diagnostics.js +0 -116
  482. package/lib/dist/mcp/explore-diagnostics.js.map +1 -1
  483. package/lib/dist/mcp/explore-session-state.js +0 -129
  484. package/lib/dist/mcp/explore-session-state.js.map +1 -1
  485. package/lib/dist/mcp/index-freshness-worker.js +1 -6
  486. package/lib/dist/mcp/index-freshness-worker.js.map +1 -1
  487. package/lib/dist/mcp/index-freshness.js +0 -15
  488. package/lib/dist/mcp/index-freshness.js.map +1 -1
  489. package/lib/dist/mcp/index-version-warning.d.ts +21 -0
  490. package/lib/dist/mcp/index-version-warning.d.ts.map +1 -0
  491. package/lib/dist/mcp/index-version-warning.js +38 -0
  492. package/lib/dist/mcp/index-version-warning.js.map +1 -0
  493. package/lib/dist/mcp/index.d.ts +19 -1
  494. package/lib/dist/mcp/index.d.ts.map +1 -1
  495. package/lib/dist/mcp/index.js +118 -293
  496. package/lib/dist/mcp/index.js.map +1 -1
  497. package/lib/dist/mcp/liveness-watchdog.d.ts +13 -3
  498. package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
  499. package/lib/dist/mcp/liveness-watchdog.js +106 -121
  500. package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
  501. package/lib/dist/mcp/ppid-watchdog.js +0 -24
  502. package/lib/dist/mcp/ppid-watchdog.js.map +1 -1
  503. package/lib/dist/mcp/process-identity.d.ts +42 -0
  504. package/lib/dist/mcp/process-identity.d.ts.map +1 -0
  505. package/lib/dist/mcp/process-identity.js +130 -0
  506. package/lib/dist/mcp/process-identity.js.map +1 -0
  507. package/lib/dist/mcp/project-lifecycle.d.ts.map +1 -1
  508. package/lib/dist/mcp/project-lifecycle.js +50 -17
  509. package/lib/dist/mcp/project-lifecycle.js.map +1 -1
  510. package/lib/dist/mcp/proxy.d.ts +17 -6
  511. package/lib/dist/mcp/proxy.d.ts.map +1 -1
  512. package/lib/dist/mcp/proxy.js +74 -248
  513. package/lib/dist/mcp/proxy.js.map +1 -1
  514. package/lib/dist/mcp/query-pool.d.ts +43 -3
  515. package/lib/dist/mcp/query-pool.d.ts.map +1 -1
  516. package/lib/dist/mcp/query-pool.js +109 -123
  517. package/lib/dist/mcp/query-pool.js.map +1 -1
  518. package/lib/dist/mcp/query-worker.js +24 -36
  519. package/lib/dist/mcp/query-worker.js.map +1 -1
  520. package/lib/dist/mcp/server-instructions.js +0 -31
  521. package/lib/dist/mcp/server-instructions.js.map +1 -1
  522. package/lib/dist/mcp/session.d.ts +27 -0
  523. package/lib/dist/mcp/session.d.ts.map +1 -1
  524. package/lib/dist/mcp/session.js +29 -130
  525. package/lib/dist/mcp/session.js.map +1 -1
  526. package/lib/dist/mcp/startup-handshake.js +1 -48
  527. package/lib/dist/mcp/startup-handshake.js.map +1 -1
  528. package/lib/dist/mcp/stdin-teardown.js +0 -28
  529. package/lib/dist/mcp/stdin-teardown.js.map +1 -1
  530. package/lib/dist/mcp/stdout-teardown.d.ts +26 -0
  531. package/lib/dist/mcp/stdout-teardown.d.ts.map +1 -0
  532. package/lib/dist/mcp/stdout-teardown.js +20 -0
  533. package/lib/dist/mcp/stdout-teardown.js.map +1 -0
  534. package/lib/dist/mcp/tools.d.ts +127 -18
  535. package/lib/dist/mcp/tools.d.ts.map +1 -1
  536. package/lib/dist/mcp/tools.js +661 -3590
  537. package/lib/dist/mcp/tools.js.map +1 -1
  538. package/lib/dist/mcp/transport.d.ts.map +1 -1
  539. package/lib/dist/mcp/transport.js +4 -96
  540. package/lib/dist/mcp/transport.js.map +1 -1
  541. package/lib/dist/mcp/version.d.ts +13 -1
  542. package/lib/dist/mcp/version.d.ts.map +1 -1
  543. package/lib/dist/mcp/version.js +19 -21
  544. package/lib/dist/mcp/version.js.map +1 -1
  545. package/lib/dist/mcp/writer-lock.d.ts +11 -0
  546. package/lib/dist/mcp/writer-lock.d.ts.map +1 -1
  547. package/lib/dist/mcp/writer-lock.js +49 -46
  548. package/lib/dist/mcp/writer-lock.js.map +1 -1
  549. package/lib/dist/project-config.js +1 -138
  550. package/lib/dist/project-config.js.map +1 -1
  551. package/lib/dist/resolution/alias-binding.d.ts +7 -0
  552. package/lib/dist/resolution/alias-binding.d.ts.map +1 -1
  553. package/lib/dist/resolution/alias-binding.js +7 -56
  554. package/lib/dist/resolution/alias-binding.js.map +1 -1
  555. package/lib/dist/resolution/ambient-modules.d.ts +185 -0
  556. package/lib/dist/resolution/ambient-modules.d.ts.map +1 -0
  557. package/lib/dist/resolution/ambient-modules.js +732 -0
  558. package/lib/dist/resolution/ambient-modules.js.map +1 -0
  559. package/lib/dist/resolution/angular-template-synthesizer.d.ts +48 -1
  560. package/lib/dist/resolution/angular-template-synthesizer.d.ts.map +1 -1
  561. package/lib/dist/resolution/angular-template-synthesizer.js +401 -65
  562. package/lib/dist/resolution/angular-template-synthesizer.js.map +1 -1
  563. package/lib/dist/resolution/c-feature-variants.d.ts +40 -0
  564. package/lib/dist/resolution/c-feature-variants.d.ts.map +1 -0
  565. package/lib/dist/resolution/c-feature-variants.js +249 -0
  566. package/lib/dist/resolution/c-feature-variants.js.map +1 -0
  567. package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
  568. package/lib/dist/resolution/c-fnptr-synthesizer.js +23 -391
  569. package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
  570. package/lib/dist/resolution/c-macro-renames.d.ts +25 -0
  571. package/lib/dist/resolution/c-macro-renames.d.ts.map +1 -0
  572. package/lib/dist/resolution/c-macro-renames.js +95 -0
  573. package/lib/dist/resolution/c-macro-renames.js.map +1 -0
  574. package/lib/dist/resolution/callback-synthesizer.d.ts +15 -1
  575. package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
  576. package/lib/dist/resolution/callback-synthesizer.js +1355 -1270
  577. package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
  578. package/lib/dist/resolution/const-alias-synthesizer.d.ts +48 -0
  579. package/lib/dist/resolution/const-alias-synthesizer.d.ts.map +1 -0
  580. package/lib/dist/resolution/const-alias-synthesizer.js +234 -0
  581. package/lib/dist/resolution/const-alias-synthesizer.js.map +1 -0
  582. package/lib/dist/resolution/cooperative-yield.js +0 -27
  583. package/lib/dist/resolution/cooperative-yield.js.map +1 -1
  584. package/lib/dist/resolution/cpp-constructor.d.ts.map +1 -1
  585. package/lib/dist/resolution/cpp-constructor.js +15 -17
  586. package/lib/dist/resolution/cpp-constructor.js.map +1 -1
  587. package/lib/dist/resolution/cpp-includers.d.ts +46 -0
  588. package/lib/dist/resolution/cpp-includers.d.ts.map +1 -0
  589. package/lib/dist/resolution/cpp-includers.js +153 -0
  590. package/lib/dist/resolution/cpp-includers.js.map +1 -0
  591. package/lib/dist/resolution/cpp-macro-visibility.d.ts +16 -0
  592. package/lib/dist/resolution/cpp-macro-visibility.d.ts.map +1 -1
  593. package/lib/dist/resolution/cpp-macro-visibility.js +17 -68
  594. package/lib/dist/resolution/cpp-macro-visibility.js.map +1 -1
  595. package/lib/dist/resolution/cpp-namespaces.d.ts +54 -0
  596. package/lib/dist/resolution/cpp-namespaces.d.ts.map +1 -0
  597. package/lib/dist/resolution/cpp-namespaces.js +151 -0
  598. package/lib/dist/resolution/cpp-namespaces.js.map +1 -0
  599. package/lib/dist/resolution/cpp-raw-strings.d.ts +33 -0
  600. package/lib/dist/resolution/cpp-raw-strings.d.ts.map +1 -0
  601. package/lib/dist/resolution/cpp-raw-strings.js +167 -0
  602. package/lib/dist/resolution/cpp-raw-strings.js.map +1 -0
  603. package/lib/dist/resolution/cpp-supertypes.d.ts +118 -0
  604. package/lib/dist/resolution/cpp-supertypes.d.ts.map +1 -0
  605. package/lib/dist/resolution/cpp-supertypes.js +322 -0
  606. package/lib/dist/resolution/cpp-supertypes.js.map +1 -0
  607. package/lib/dist/resolution/cpp-template-instantiations.d.ts +83 -0
  608. package/lib/dist/resolution/cpp-template-instantiations.d.ts.map +1 -0
  609. package/lib/dist/resolution/cpp-template-instantiations.js +983 -0
  610. package/lib/dist/resolution/cpp-template-instantiations.js.map +1 -0
  611. package/lib/dist/resolution/cpp-type-aliases.d.ts +194 -0
  612. package/lib/dist/resolution/cpp-type-aliases.d.ts.map +1 -0
  613. package/lib/dist/resolution/cpp-type-aliases.js +648 -0
  614. package/lib/dist/resolution/cpp-type-aliases.js.map +1 -0
  615. package/lib/dist/resolution/dart-libraries.d.ts +75 -0
  616. package/lib/dist/resolution/dart-libraries.d.ts.map +1 -0
  617. package/lib/dist/resolution/dart-libraries.js +721 -0
  618. package/lib/dist/resolution/dart-libraries.js.map +1 -0
  619. package/lib/dist/resolution/dart-local-scope.d.ts +41 -0
  620. package/lib/dist/resolution/dart-local-scope.d.ts.map +1 -0
  621. package/lib/dist/resolution/dart-local-scope.js +565 -0
  622. package/lib/dist/resolution/dart-local-scope.js.map +1 -0
  623. package/lib/dist/resolution/expo-router-synthesizer.js +0 -52
  624. package/lib/dist/resolution/expo-router-synthesizer.js.map +1 -1
  625. package/lib/dist/resolution/frameworks/angular-router.d.ts.map +1 -1
  626. package/lib/dist/resolution/frameworks/angular-router.js +41 -208
  627. package/lib/dist/resolution/frameworks/angular-router.js.map +1 -1
  628. package/lib/dist/resolution/frameworks/astro.d.ts.map +1 -1
  629. package/lib/dist/resolution/frameworks/astro.js +4 -60
  630. package/lib/dist/resolution/frameworks/astro.js.map +1 -1
  631. package/lib/dist/resolution/frameworks/cargo-workspace.d.ts +18 -1
  632. package/lib/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -1
  633. package/lib/dist/resolution/frameworks/cargo-workspace.js +65 -15
  634. package/lib/dist/resolution/frameworks/cargo-workspace.js.map +1 -1
  635. package/lib/dist/resolution/frameworks/cics.d.ts.map +1 -1
  636. package/lib/dist/resolution/frameworks/cics.js +7 -33
  637. package/lib/dist/resolution/frameworks/cics.js.map +1 -1
  638. package/lib/dist/resolution/frameworks/codeigniter.d.ts +23 -0
  639. package/lib/dist/resolution/frameworks/codeigniter.d.ts.map +1 -0
  640. package/lib/dist/resolution/frameworks/codeigniter.js +271 -0
  641. package/lib/dist/resolution/frameworks/codeigniter.js.map +1 -0
  642. package/lib/dist/resolution/frameworks/component-folder.d.ts +17 -0
  643. package/lib/dist/resolution/frameworks/component-folder.d.ts.map +1 -0
  644. package/lib/dist/resolution/frameworks/component-folder.js +11 -0
  645. package/lib/dist/resolution/frameworks/component-folder.js.map +1 -0
  646. package/lib/dist/resolution/frameworks/csharp.d.ts.map +1 -1
  647. package/lib/dist/resolution/frameworks/csharp.js +5 -68
  648. package/lib/dist/resolution/frameworks/csharp.js.map +1 -1
  649. package/lib/dist/resolution/frameworks/drupal.d.ts +17 -8
  650. package/lib/dist/resolution/frameworks/drupal.d.ts.map +1 -1
  651. package/lib/dist/resolution/frameworks/drupal.js +377 -142
  652. package/lib/dist/resolution/frameworks/drupal.js.map +1 -1
  653. package/lib/dist/resolution/frameworks/expo-modules.d.ts.map +1 -1
  654. package/lib/dist/resolution/frameworks/expo-modules.js +8 -88
  655. package/lib/dist/resolution/frameworks/expo-modules.js.map +1 -1
  656. package/lib/dist/resolution/frameworks/expo-router.d.ts.map +1 -1
  657. package/lib/dist/resolution/frameworks/expo-router.js +9 -190
  658. package/lib/dist/resolution/frameworks/expo-router.js.map +1 -1
  659. package/lib/dist/resolution/frameworks/express.d.ts.map +1 -1
  660. package/lib/dist/resolution/frameworks/express.js +182 -199
  661. package/lib/dist/resolution/frameworks/express.js.map +1 -1
  662. package/lib/dist/resolution/frameworks/fabric.js +1 -104
  663. package/lib/dist/resolution/frameworks/fabric.js.map +1 -1
  664. package/lib/dist/resolution/frameworks/go.d.ts.map +1 -1
  665. package/lib/dist/resolution/frameworks/go.js +14 -43
  666. package/lib/dist/resolution/frameworks/go.js.map +1 -1
  667. package/lib/dist/resolution/frameworks/goframe.js +1 -55
  668. package/lib/dist/resolution/frameworks/goframe.js.map +1 -1
  669. package/lib/dist/resolution/frameworks/index.d.ts +13 -0
  670. package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
  671. package/lib/dist/resolution/frameworks/index.js +12 -50
  672. package/lib/dist/resolution/frameworks/index.js.map +1 -1
  673. package/lib/dist/resolution/frameworks/java.d.ts.map +1 -1
  674. package/lib/dist/resolution/frameworks/java.js +203 -129
  675. package/lib/dist/resolution/frameworks/java.js.map +1 -1
  676. package/lib/dist/resolution/frameworks/laravel.js +2 -125
  677. package/lib/dist/resolution/frameworks/laravel.js.map +1 -1
  678. package/lib/dist/resolution/frameworks/name-heuristic.js +0 -12
  679. package/lib/dist/resolution/frameworks/name-heuristic.js.map +1 -1
  680. package/lib/dist/resolution/frameworks/nestjs.js +2 -199
  681. package/lib/dist/resolution/frameworks/nestjs.js.map +1 -1
  682. package/lib/dist/resolution/frameworks/next-proxy.d.ts +67 -0
  683. package/lib/dist/resolution/frameworks/next-proxy.d.ts.map +1 -0
  684. package/lib/dist/resolution/frameworks/next-proxy.js +239 -0
  685. package/lib/dist/resolution/frameworks/next-proxy.js.map +1 -0
  686. package/lib/dist/resolution/frameworks/nextjs.d.ts.map +1 -1
  687. package/lib/dist/resolution/frameworks/nextjs.js +10 -66
  688. package/lib/dist/resolution/frameworks/nextjs.js.map +1 -1
  689. package/lib/dist/resolution/frameworks/object-literal.js +0 -21
  690. package/lib/dist/resolution/frameworks/object-literal.js.map +1 -1
  691. package/lib/dist/resolution/frameworks/package-deps.d.ts +11 -7
  692. package/lib/dist/resolution/frameworks/package-deps.d.ts.map +1 -1
  693. package/lib/dist/resolution/frameworks/package-deps.js +35 -26
  694. package/lib/dist/resolution/frameworks/package-deps.js.map +1 -1
  695. package/lib/dist/resolution/frameworks/page-component.js +0 -14
  696. package/lib/dist/resolution/frameworks/page-component.js.map +1 -1
  697. package/lib/dist/resolution/frameworks/play.d.ts.map +1 -1
  698. package/lib/dist/resolution/frameworks/play.js +26 -34
  699. package/lib/dist/resolution/frameworks/play.js.map +1 -1
  700. package/lib/dist/resolution/frameworks/python.js +5 -102
  701. package/lib/dist/resolution/frameworks/python.js.map +1 -1
  702. package/lib/dist/resolution/frameworks/react-native.d.ts.map +1 -1
  703. package/lib/dist/resolution/frameworks/react-native.js +1 -166
  704. package/lib/dist/resolution/frameworks/react-native.js.map +1 -1
  705. package/lib/dist/resolution/frameworks/react-router.d.ts +13 -4
  706. package/lib/dist/resolution/frameworks/react-router.d.ts.map +1 -1
  707. package/lib/dist/resolution/frameworks/react-router.js +10 -82
  708. package/lib/dist/resolution/frameworks/react-router.js.map +1 -1
  709. package/lib/dist/resolution/frameworks/react.d.ts +57 -0
  710. package/lib/dist/resolution/frameworks/react.d.ts.map +1 -1
  711. package/lib/dist/resolution/frameworks/react.js +1449 -191
  712. package/lib/dist/resolution/frameworks/react.js.map +1 -1
  713. package/lib/dist/resolution/frameworks/ruby.js +1 -61
  714. package/lib/dist/resolution/frameworks/ruby.js.map +1 -1
  715. package/lib/dist/resolution/frameworks/rust.d.ts.map +1 -1
  716. package/lib/dist/resolution/frameworks/rust.js +35 -56
  717. package/lib/dist/resolution/frameworks/rust.js.map +1 -1
  718. package/lib/dist/resolution/frameworks/svelte.d.ts.map +1 -1
  719. package/lib/dist/resolution/frameworks/svelte.js +7 -75
  720. package/lib/dist/resolution/frameworks/svelte.js.map +1 -1
  721. package/lib/dist/resolution/frameworks/sveltekit-router.d.ts.map +1 -1
  722. package/lib/dist/resolution/frameworks/sveltekit-router.js +8 -46
  723. package/lib/dist/resolution/frameworks/sveltekit-router.js.map +1 -1
  724. package/lib/dist/resolution/frameworks/swift-objc.js +0 -97
  725. package/lib/dist/resolution/frameworks/swift-objc.js.map +1 -1
  726. package/lib/dist/resolution/frameworks/swift.js +0 -97
  727. package/lib/dist/resolution/frameworks/swift.js.map +1 -1
  728. package/lib/dist/resolution/frameworks/tanstack-router.d.ts.map +1 -1
  729. package/lib/dist/resolution/frameworks/tanstack-router.js +9 -130
  730. package/lib/dist/resolution/frameworks/tanstack-router.js.map +1 -1
  731. package/lib/dist/resolution/frameworks/terraform.js +1 -85
  732. package/lib/dist/resolution/frameworks/terraform.js.map +1 -1
  733. package/lib/dist/resolution/frameworks/vue-router.d.ts.map +1 -1
  734. package/lib/dist/resolution/frameworks/vue-router.js +11 -134
  735. package/lib/dist/resolution/frameworks/vue-router.js.map +1 -1
  736. package/lib/dist/resolution/frameworks/vue.d.ts.map +1 -1
  737. package/lib/dist/resolution/frameworks/vue.js +42 -114
  738. package/lib/dist/resolution/frameworks/vue.js.map +1 -1
  739. package/lib/dist/resolution/go-func-field-synthesizer.d.ts +58 -0
  740. package/lib/dist/resolution/go-func-field-synthesizer.d.ts.map +1 -0
  741. package/lib/dist/resolution/go-func-field-synthesizer.js +696 -0
  742. package/lib/dist/resolution/go-func-field-synthesizer.js.map +1 -0
  743. package/lib/dist/resolution/go-module.d.ts +23 -7
  744. package/lib/dist/resolution/go-module.d.ts.map +1 -1
  745. package/lib/dist/resolution/go-module.js +21 -24
  746. package/lib/dist/resolution/go-module.js.map +1 -1
  747. package/lib/dist/resolution/go-stdlib-methods.d.ts +9 -0
  748. package/lib/dist/resolution/go-stdlib-methods.d.ts.map +1 -0
  749. package/lib/dist/resolution/go-stdlib-methods.js +224 -0
  750. package/lib/dist/resolution/go-stdlib-methods.js.map +1 -0
  751. package/lib/dist/resolution/goframe-synthesizer.js +2 -53
  752. package/lib/dist/resolution/goframe-synthesizer.js.map +1 -1
  753. package/lib/dist/resolution/import-resolver.d.ts +276 -29
  754. package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
  755. package/lib/dist/resolution/import-resolver.js +1670 -1380
  756. package/lib/dist/resolution/import-resolver.js.map +1 -1
  757. package/lib/dist/resolution/index.d.ts +415 -6
  758. package/lib/dist/resolution/index.d.ts.map +1 -1
  759. package/lib/dist/resolution/index.js +1323 -1037
  760. package/lib/dist/resolution/index.js.map +1 -1
  761. package/lib/dist/resolution/js-builtins.d.ts +14 -0
  762. package/lib/dist/resolution/js-builtins.d.ts.map +1 -1
  763. package/lib/dist/resolution/js-builtins.js +14 -14
  764. package/lib/dist/resolution/js-builtins.js.map +1 -1
  765. package/lib/dist/resolution/js-class-expressions.d.ts +48 -0
  766. package/lib/dist/resolution/js-class-expressions.d.ts.map +1 -0
  767. package/lib/dist/resolution/js-class-expressions.js +25 -0
  768. package/lib/dist/resolution/js-class-expressions.js.map +1 -0
  769. package/lib/dist/resolution/js-super-calls.d.ts +18 -0
  770. package/lib/dist/resolution/js-super-calls.d.ts.map +1 -0
  771. package/lib/dist/resolution/js-super-calls.js +94 -0
  772. package/lib/dist/resolution/js-super-calls.js.map +1 -0
  773. package/lib/dist/resolution/jsx-code.d.ts +28 -0
  774. package/lib/dist/resolution/jsx-code.d.ts.map +1 -0
  775. package/lib/dist/resolution/jsx-code.js +459 -0
  776. package/lib/dist/resolution/jsx-code.js.map +1 -0
  777. package/lib/dist/resolution/lru-cache.d.ts +5 -13
  778. package/lib/dist/resolution/lru-cache.d.ts.map +1 -1
  779. package/lib/dist/resolution/lru-cache.js +43 -32
  780. package/lib/dist/resolution/lru-cache.js.map +1 -1
  781. package/lib/dist/resolution/memory-budget.js +0 -52
  782. package/lib/dist/resolution/memory-budget.js.map +1 -1
  783. package/lib/dist/resolution/module-importers.d.ts +185 -0
  784. package/lib/dist/resolution/module-importers.d.ts.map +1 -0
  785. package/lib/dist/resolution/module-importers.js +588 -0
  786. package/lib/dist/resolution/module-importers.js.map +1 -0
  787. package/lib/dist/resolution/name-matcher.d.ts +858 -7
  788. package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
  789. package/lib/dist/resolution/name-matcher.js +21030 -5110
  790. package/lib/dist/resolution/name-matcher.js.map +1 -1
  791. package/lib/dist/resolution/next-router-synthesizer.d.ts +19 -0
  792. package/lib/dist/resolution/next-router-synthesizer.d.ts.map +1 -1
  793. package/lib/dist/resolution/next-router-synthesizer.js +46 -28
  794. package/lib/dist/resolution/next-router-synthesizer.js.map +1 -1
  795. package/lib/dist/resolution/override-parameters.d.ts +40 -0
  796. package/lib/dist/resolution/override-parameters.d.ts.map +1 -0
  797. package/lib/dist/resolution/override-parameters.js +339 -0
  798. package/lib/dist/resolution/override-parameters.js.map +1 -0
  799. package/lib/dist/resolution/parameter-flow.d.ts +218 -0
  800. package/lib/dist/resolution/parameter-flow.d.ts.map +1 -0
  801. package/lib/dist/resolution/parameter-flow.js +474 -0
  802. package/lib/dist/resolution/parameter-flow.js.map +1 -0
  803. package/lib/dist/resolution/pascal-scope.d.ts +91 -0
  804. package/lib/dist/resolution/pascal-scope.d.ts.map +1 -0
  805. package/lib/dist/resolution/pascal-scope.js +961 -0
  806. package/lib/dist/resolution/pascal-scope.js.map +1 -0
  807. package/lib/dist/resolution/path-aliases.d.ts +32 -4
  808. package/lib/dist/resolution/path-aliases.d.ts.map +1 -1
  809. package/lib/dist/resolution/path-aliases.js +43 -110
  810. package/lib/dist/resolution/path-aliases.js.map +1 -1
  811. package/lib/dist/resolution/project-scans.d.ts +38 -0
  812. package/lib/dist/resolution/project-scans.d.ts.map +1 -0
  813. package/lib/dist/resolution/project-scans.js +30 -0
  814. package/lib/dist/resolution/project-scans.js.map +1 -0
  815. package/lib/dist/resolution/react-router-synthesizer.d.ts.map +1 -1
  816. package/lib/dist/resolution/react-router-synthesizer.js +3 -55
  817. package/lib/dist/resolution/react-router-synthesizer.js.map +1 -1
  818. package/lib/dist/resolution/resolver-pool.d.ts +23 -2
  819. package/lib/dist/resolution/resolver-pool.d.ts.map +1 -1
  820. package/lib/dist/resolution/resolver-pool.js +43 -111
  821. package/lib/dist/resolution/resolver-pool.js.map +1 -1
  822. package/lib/dist/resolution/resolver-worker.d.ts +1 -1
  823. package/lib/dist/resolution/resolver-worker.d.ts.map +1 -1
  824. package/lib/dist/resolution/resolver-worker.js +8 -37
  825. package/lib/dist/resolution/resolver-worker.js.map +1 -1
  826. package/lib/dist/resolution/resurrect-ref.d.ts +25 -0
  827. package/lib/dist/resolution/resurrect-ref.d.ts.map +1 -0
  828. package/lib/dist/resolution/resurrect-ref.js +19 -0
  829. package/lib/dist/resolution/resurrect-ref.js.map +1 -0
  830. package/lib/dist/resolution/ruby-constant-paths.d.ts +56 -0
  831. package/lib/dist/resolution/ruby-constant-paths.d.ts.map +1 -0
  832. package/lib/dist/resolution/ruby-constant-paths.js +255 -0
  833. package/lib/dist/resolution/ruby-constant-paths.js.map +1 -0
  834. package/lib/dist/resolution/ruby-parameter-flow.d.ts +10 -0
  835. package/lib/dist/resolution/ruby-parameter-flow.d.ts.map +1 -0
  836. package/lib/dist/resolution/ruby-parameter-flow.js +801 -0
  837. package/lib/dist/resolution/ruby-parameter-flow.js.map +1 -0
  838. package/lib/dist/resolution/rust-scopes.d.ts +120 -0
  839. package/lib/dist/resolution/rust-scopes.d.ts.map +1 -0
  840. package/lib/dist/resolution/rust-scopes.js +730 -0
  841. package/lib/dist/resolution/rust-scopes.js.map +1 -0
  842. package/lib/dist/resolution/shopify-themes.d.ts +10 -0
  843. package/lib/dist/resolution/shopify-themes.d.ts.map +1 -0
  844. package/lib/dist/resolution/shopify-themes.js +19 -0
  845. package/lib/dist/resolution/shopify-themes.js.map +1 -0
  846. package/lib/dist/resolution/strip-comments.d.ts +20 -1
  847. package/lib/dist/resolution/strip-comments.d.ts.map +1 -1
  848. package/lib/dist/resolution/strip-comments.js +164 -119
  849. package/lib/dist/resolution/strip-comments.js.map +1 -1
  850. package/lib/dist/resolution/sveltekit-synthesizer.js +0 -64
  851. package/lib/dist/resolution/sveltekit-synthesizer.js.map +1 -1
  852. package/lib/dist/resolution/swift-objc-bridge.js +0 -160
  853. package/lib/dist/resolution/swift-objc-bridge.js.map +1 -1
  854. package/lib/dist/resolution/swift-type-visibility.d.ts.map +1 -1
  855. package/lib/dist/resolution/swift-type-visibility.js +2 -101
  856. package/lib/dist/resolution/swift-type-visibility.js.map +1 -1
  857. package/lib/dist/resolution/synth-utils.js +1 -22
  858. package/lib/dist/resolution/synth-utils.js.map +1 -1
  859. package/lib/dist/resolution/tanstack-router-synthesizer.js +0 -32
  860. package/lib/dist/resolution/tanstack-router-synthesizer.js.map +1 -1
  861. package/lib/dist/resolution/tauri-synthesizer.d.ts +37 -0
  862. package/lib/dist/resolution/tauri-synthesizer.d.ts.map +1 -0
  863. package/lib/dist/resolution/tauri-synthesizer.js +1038 -0
  864. package/lib/dist/resolution/tauri-synthesizer.js.map +1 -0
  865. package/lib/dist/resolution/tier-synthesizer.js +4 -170
  866. package/lib/dist/resolution/tier-synthesizer.js.map +1 -1
  867. package/lib/dist/resolution/type-parameters.d.ts +23 -0
  868. package/lib/dist/resolution/type-parameters.d.ts.map +1 -1
  869. package/lib/dist/resolution/type-parameters.js +52 -54
  870. package/lib/dist/resolution/type-parameters.js.map +1 -1
  871. package/lib/dist/resolution/types.d.ts +183 -11
  872. package/lib/dist/resolution/types.d.ts.map +1 -1
  873. package/lib/dist/resolution/types.js +0 -47
  874. package/lib/dist/resolution/types.js.map +1 -1
  875. package/lib/dist/resolution/vbnet-receivers.d.ts +92 -0
  876. package/lib/dist/resolution/vbnet-receivers.d.ts.map +1 -0
  877. package/lib/dist/resolution/vbnet-receivers.js +1482 -0
  878. package/lib/dist/resolution/vbnet-receivers.js.map +1 -0
  879. package/lib/dist/resolution/vue-router-synthesizer.js +0 -31
  880. package/lib/dist/resolution/vue-router-synthesizer.js.map +1 -1
  881. package/lib/dist/resolution/workspace-packages.d.ts +206 -15
  882. package/lib/dist/resolution/workspace-packages.d.ts.map +1 -1
  883. package/lib/dist/resolution/workspace-packages.js +570 -152
  884. package/lib/dist/resolution/workspace-packages.js.map +1 -1
  885. package/lib/dist/search/identifier-segments.js +2 -93
  886. package/lib/dist/search/identifier-segments.js.map +1 -1
  887. package/lib/dist/search/query-parser.js +0 -54
  888. package/lib/dist/search/query-parser.js.map +1 -1
  889. package/lib/dist/search/query-paths.js +0 -167
  890. package/lib/dist/search/query-paths.js.map +1 -1
  891. package/lib/dist/search/query-utils.d.ts +44 -0
  892. package/lib/dist/search/query-utils.d.ts.map +1 -1
  893. package/lib/dist/search/query-utils.js +120 -198
  894. package/lib/dist/search/query-utils.js.map +1 -1
  895. package/lib/dist/sync/git-hooks.d.ts +14 -5
  896. package/lib/dist/sync/git-hooks.d.ts.map +1 -1
  897. package/lib/dist/sync/git-hooks.js +118 -65
  898. package/lib/dist/sync/git-hooks.js.map +1 -1
  899. package/lib/dist/sync/index.js +0 -14
  900. package/lib/dist/sync/index.js.map +1 -1
  901. package/lib/dist/sync/watch-policy.js +0 -45
  902. package/lib/dist/sync/watch-policy.js.map +1 -1
  903. package/lib/dist/sync/watcher.d.ts +29 -11
  904. package/lib/dist/sync/watcher.d.ts.map +1 -1
  905. package/lib/dist/sync/watcher.js +83 -487
  906. package/lib/dist/sync/watcher.js.map +1 -1
  907. package/lib/dist/sync/worktree.d.ts +7 -2
  908. package/lib/dist/sync/worktree.d.ts.map +1 -1
  909. package/lib/dist/sync/worktree.js +24 -97
  910. package/lib/dist/sync/worktree.js.map +1 -1
  911. package/lib/dist/telemetry/index.d.ts.map +1 -1
  912. package/lib/dist/telemetry/index.js +15 -135
  913. package/lib/dist/telemetry/index.js.map +1 -1
  914. package/lib/dist/types.d.ts +46 -0
  915. package/lib/dist/types.d.ts.map +1 -1
  916. package/lib/dist/types.js +15 -44
  917. package/lib/dist/types.js.map +1 -1
  918. package/lib/dist/ui/color.js +0 -19
  919. package/lib/dist/ui/color.js.map +1 -1
  920. package/lib/dist/ui/glyphs.js +2 -45
  921. package/lib/dist/ui/glyphs.js.map +1 -1
  922. package/lib/dist/ui/shimmer-progress.js +0 -21
  923. package/lib/dist/ui/shimmer-progress.js.map +1 -1
  924. package/lib/dist/ui/shimmer-worker.js +0 -22
  925. package/lib/dist/ui/shimmer-worker.js.map +1 -1
  926. package/lib/dist/ui-server/api/deadcode.d.ts.map +1 -1
  927. package/lib/dist/ui-server/api/deadcode.js +2 -31
  928. package/lib/dist/ui-server/api/deadcode.js.map +1 -1
  929. package/lib/dist/ui-server/api/effects.js +0 -111
  930. package/lib/dist/ui-server/api/effects.js.map +1 -1
  931. package/lib/dist/ui-server/api/entrypoints.js +0 -142
  932. package/lib/dist/ui-server/api/entrypoints.js.map +1 -1
  933. package/lib/dist/ui-server/api/events.js +0 -145
  934. package/lib/dist/ui-server/api/events.js.map +1 -1
  935. package/lib/dist/ui-server/api/file.js +0 -80
  936. package/lib/dist/ui-server/api/file.js.map +1 -1
  937. package/lib/dist/ui-server/api/filecode.js +0 -95
  938. package/lib/dist/ui-server/api/filecode.js.map +1 -1
  939. package/lib/dist/ui-server/api/flow.js +0 -149
  940. package/lib/dist/ui-server/api/flow.js.map +1 -1
  941. package/lib/dist/ui-server/api/hierarchy.js +0 -28
  942. package/lib/dist/ui-server/api/hierarchy.js.map +1 -1
  943. package/lib/dist/ui-server/api/index.js +0 -88
  944. package/lib/dist/ui-server/api/index.js.map +1 -1
  945. package/lib/dist/ui-server/api/map.d.ts.map +1 -1
  946. package/lib/dist/ui-server/api/map.js +4 -317
  947. package/lib/dist/ui-server/api/map.js.map +1 -1
  948. package/lib/dist/ui-server/api/node.js +0 -111
  949. package/lib/dist/ui-server/api/node.js.map +1 -1
  950. package/lib/dist/ui-server/api/nodes.js +0 -16
  951. package/lib/dist/ui-server/api/nodes.js.map +1 -1
  952. package/lib/dist/ui-server/api/program.js +0 -90
  953. package/lib/dist/ui-server/api/program.js.map +1 -1
  954. package/lib/dist/ui-server/api/respond.js +0 -60
  955. package/lib/dist/ui-server/api/respond.js.map +1 -1
  956. package/lib/dist/ui-server/api/route-roots.d.ts.map +1 -1
  957. package/lib/dist/ui-server/api/route-roots.js +2 -44
  958. package/lib/dist/ui-server/api/route-roots.js.map +1 -1
  959. package/lib/dist/ui-server/api/routes.d.ts.map +1 -1
  960. package/lib/dist/ui-server/api/routes.js +4 -60
  961. package/lib/dist/ui-server/api/routes.js.map +1 -1
  962. package/lib/dist/ui-server/api/screens.d.ts.map +1 -1
  963. package/lib/dist/ui-server/api/screens.js +4 -174
  964. package/lib/dist/ui-server/api/screens.js.map +1 -1
  965. package/lib/dist/ui-server/api/search.js +0 -62
  966. package/lib/dist/ui-server/api/search.js.map +1 -1
  967. package/lib/dist/ui-server/api/session.js +0 -58
  968. package/lib/dist/ui-server/api/session.js.map +1 -1
  969. package/lib/dist/ui-server/api/source.d.ts.map +1 -1
  970. package/lib/dist/ui-server/api/source.js +0 -161
  971. package/lib/dist/ui-server/api/source.js.map +1 -1
  972. package/lib/dist/ui-server/api/stats.js +0 -58
  973. package/lib/dist/ui-server/api/stats.js.map +1 -1
  974. package/lib/dist/ui-server/api/steps.d.ts.map +1 -1
  975. package/lib/dist/ui-server/api/steps.js +5 -381
  976. package/lib/dist/ui-server/api/steps.js.map +1 -1
  977. package/lib/dist/ui-server/api/trail-store.d.ts +3 -3
  978. package/lib/dist/ui-server/api/trail-store.d.ts.map +1 -1
  979. package/lib/dist/ui-server/api/trail-store.js +24 -106
  980. package/lib/dist/ui-server/api/trail-store.js.map +1 -1
  981. package/lib/dist/ui-server/api/trails.d.ts.map +1 -1
  982. package/lib/dist/ui-server/api/trails.js +19 -94
  983. package/lib/dist/ui-server/api/trails.js.map +1 -1
  984. package/lib/dist/ui-server/api/when.js +0 -36
  985. package/lib/dist/ui-server/api/when.js.map +1 -1
  986. package/lib/dist/ui-server/api/wire.js +0 -58
  987. package/lib/dist/ui-server/api/wire.js.map +1 -1
  988. package/lib/dist/ui-server/assets.js +0 -35
  989. package/lib/dist/ui-server/assets.js.map +1 -1
  990. package/lib/dist/ui-server/constants.js +0 -26
  991. package/lib/dist/ui-server/constants.js.map +1 -1
  992. package/lib/dist/ui-server/highlight/bounded-tokenize.js +0 -25
  993. package/lib/dist/ui-server/highlight/bounded-tokenize.js.map +1 -1
  994. package/lib/dist/ui-server/highlight/index.js +1 -132
  995. package/lib/dist/ui-server/highlight/index.js.map +1 -1
  996. package/lib/dist/ui-server/highlight/languages.d.ts +3 -3
  997. package/lib/dist/ui-server/highlight/languages.js +0 -31
  998. package/lib/dist/ui-server/highlight/languages.js.map +1 -1
  999. package/lib/dist/ui-server/highlight/tokenize-worker.js +0 -5
  1000. package/lib/dist/ui-server/highlight/tokenize-worker.js.map +1 -1
  1001. package/lib/dist/ui-server/index.d.ts +25 -0
  1002. package/lib/dist/ui-server/index.d.ts.map +1 -1
  1003. package/lib/dist/ui-server/index.js +35 -103
  1004. package/lib/dist/ui-server/index.js.map +1 -1
  1005. package/lib/dist/ui-server/open-browser.js +0 -34
  1006. package/lib/dist/ui-server/open-browser.js.map +1 -1
  1007. package/lib/dist/ui-server/security.d.ts +5 -0
  1008. package/lib/dist/ui-server/security.d.ts.map +1 -1
  1009. package/lib/dist/ui-server/security.js +11 -147
  1010. package/lib/dist/ui-server/security.js.map +1 -1
  1011. package/lib/dist/ui-server/static.js +0 -41
  1012. package/lib/dist/ui-server/static.js.map +1 -1
  1013. package/lib/dist/upgrade/index.d.ts +18 -5
  1014. package/lib/dist/upgrade/index.d.ts.map +1 -1
  1015. package/lib/dist/upgrade/index.js +73 -229
  1016. package/lib/dist/upgrade/index.js.map +1 -1
  1017. package/lib/dist/upgrade/remove-binary.js +2 -67
  1018. package/lib/dist/upgrade/remove-binary.js.map +1 -1
  1019. package/lib/dist/upgrade/update-check.js +1 -81
  1020. package/lib/dist/upgrade/update-check.js.map +1 -1
  1021. package/lib/dist/utils.d.ts +69 -1
  1022. package/lib/dist/utils.d.ts.map +1 -1
  1023. package/lib/dist/utils.js +224 -266
  1024. package/lib/dist/utils.js.map +1 -1
  1025. package/lib/dist/worker-teardown.js +0 -47
  1026. package/lib/dist/worker-teardown.js.map +1 -1
  1027. package/lib/kernel/codegraph-kernel.node +2 -2
  1028. package/lib/node_modules/.package-lock.json +4 -4
  1029. package/lib/node_modules/ignore/README.md +138 -8
  1030. package/lib/node_modules/ignore/index.d.ts +56 -20
  1031. package/lib/node_modules/ignore/index.js +1033 -221
  1032. package/lib/node_modules/ignore/legacy.js +871 -178
  1033. package/lib/node_modules/ignore/package.json +10 -4
  1034. package/lib/package.json +14 -8
  1035. package/node.exe +2 -2
  1036. package/package.json +1 -1
@@ -1,9 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Reference Resolution Orchestrator
4
- *
5
- * Coordinates all reference resolution strategies.
6
- */
7
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
3
  if (k2 === undefined) k2 = k;
9
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -42,6 +37,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
42
37
  };
43
38
  Object.defineProperty(exports, "__esModule", { value: true });
44
39
  exports.ReferenceResolver = void 0;
40
+ exports.parseModuleConfigSnapshot = parseModuleConfigSnapshot;
41
+ exports.changedModuleConfigs = changedModuleConfigs;
42
+ exports.moduleConfigLanguages = moduleConfigLanguages;
43
+ exports.changedRoutes = changedRoutes;
45
44
  exports.createResolver = createResolver;
46
45
  const fs = __importStar(require("fs"));
47
46
  const path = __importStar(require("path"));
@@ -50,59 +49,58 @@ const types_1 = require("./types");
50
49
  const name_matcher_1 = require("./name-matcher");
51
50
  const cpp_macro_visibility_1 = require("./cpp-macro-visibility");
52
51
  const cpp_constructor_1 = require("./cpp-constructor");
52
+ const cpp_supertypes_1 = require("./cpp-supertypes");
53
53
  const swift_type_visibility_1 = require("./swift-type-visibility");
54
+ const dart_libraries_1 = require("./dart-libraries");
55
+ const vbnet_receivers_1 = require("./vbnet-receivers");
56
+ const pascal_scope_1 = require("./pascal-scope");
54
57
  const type_parameters_1 = require("./type-parameters");
58
+ const dart_local_scope_1 = require("./dart-local-scope");
59
+ const cpp_type_aliases_1 = require("./cpp-type-aliases");
60
+ const project_scans_1 = require("./project-scans");
61
+ const cpp_includers_1 = require("./cpp-includers");
62
+ const c_macro_renames_1 = require("./c-macro-renames");
63
+ const name_matcher_2 = require("./name-matcher");
64
+ const c_feature_variants_1 = require("./c-feature-variants");
65
+ const ambient_modules_1 = require("./ambient-modules");
66
+ const shopify_themes_1 = require("./shopify-themes");
67
+ const js_super_calls_1 = require("./js-super-calls");
68
+ const js_class_expressions_1 = require("./js-class-expressions");
69
+ const ruby_constant_paths_1 = require("./ruby-constant-paths");
55
70
  const import_resolver_1 = require("./import-resolver");
56
71
  const resolver_pool_1 = require("./resolver-pool");
57
72
  const alias_binding_1 = require("./alias-binding");
73
+ const cargo_workspace_1 = require("./frameworks/cargo-workspace");
58
74
  const frameworks_1 = require("./frameworks");
75
+ const package_deps_1 = require("./frameworks/package-deps");
59
76
  const callback_synthesizer_1 = require("./callback-synthesizer");
60
77
  const cooperative_yield_1 = require("./cooperative-yield");
78
+ const parameter_flow_1 = require("./parameter-flow");
61
79
  const file_limits_1 = require("../file-limits");
80
+ const crypto_1 = require("crypto");
62
81
  const path_aliases_1 = require("./path-aliases");
63
82
  const go_module_1 = require("./go-module");
64
83
  const workspace_packages_1 = require("./workspace-packages");
65
84
  const errors_1 = require("../errors");
85
+ const strip_comments_1 = require("./strip-comments");
66
86
  const utils_1 = require("../utils");
87
+ const resurrect_ref_1 = require("./resurrect-ref");
67
88
  const lru_cache_1 = require("./lru-cache");
89
+ const query_utils_1 = require("../search/query-utils");
68
90
  const js_builtins_1 = require("./js-builtins");
69
91
  const module_1 = require("module");
70
92
  const jsonc_parser_1 = require("jsonc-parser");
71
93
  const NODE_BUILTINS = new Set(module_1.builtinModules);
72
- /** Node kinds that can declare supertypes (extends/implements). */
73
94
  const SUPERTYPE_BEARING_KINDS = new Set([
74
95
  'class', 'struct', 'interface', 'trait', 'protocol', 'enum',
75
96
  ]);
76
- /**
77
- * The only edges resolving a reference reads (getSupertypes' walk). The batch
78
- * loop commits a batch that made any of these before the next batch fans out;
79
- * its other edges land while that batch resolves. A resolution strategy that
80
- * reads another edge kind must be added here.
81
- */
82
97
  const RESOLUTION_READ_EDGE_KINDS = ['implements', 'extends'];
83
- // SUPERTYPE_TARGET_KINDS (the kinds an extends/implements edge may TARGET)
84
- // lives in ./types — the name-matcher needs the same set to restrict its
85
- // candidate pool before ranking. It is deliberately wider than
86
- // SUPERTYPE_BEARING_KINDS above, which is about the DECLARING side.
87
- /**
88
- * Languages whose chained static-factory/fluent calls defer to the conformance
89
- * second pass. Dotted-receiver languages resolve via matchDottedCallChain; the
90
- * `::`-receiver ones (Rust) via matchScopedCallChain.
91
- */
92
98
  const CHAIN_LANGUAGES = new Set(['java', 'kotlin', 'csharp', 'swift', 'rust', 'go', 'scala', 'dart', 'objc', 'pascal']);
93
99
  const SCOPED_CHAIN_LANGUAGES = new Set(['rust']);
94
- /** The extractor's chained-receiver encoding: `<inner>().<method>`. */
95
100
  const CHAIN_SHAPE = /^(.+)\(\)\.(\w+)$/;
96
- /** PHP `$this->prop->method()` encoded as `this->prop.method` — no `()`, so CHAIN_SHAPE misses it. */
97
101
  const PHP_PROP_SHAPE = /^this->\w+\.\w+$/;
98
- /**
99
- * Cache size limits. Each per-resolver cache is bounded so memory
100
- * stays flat on large codebases (20k+ files). Sizes were chosen to
101
- * cover the working set for typical resolution batches without
102
- * exceeding a few hundred MB worst-case. Override via the env var
103
- * `CODEGRAPH_RESOLVER_CACHE_SIZE` (single integer applied to all
104
- * caches) when tuning for very large or very small projects.
105
- */
102
+ const CFML_CONSTRUCTED_CALL = /^([A-Za-z_$][\w$.-]*)\(\)\.([A-Za-z_$][\w$]*)$/;
103
+ const DEFAULT_READER_SAMPLE_FILES = 8;
106
104
  const DEFAULT_CACHE_LIMIT = 5_000;
107
105
  function resolveCacheLimit() {
108
106
  const raw = process.env.CODEGRAPH_RESOLVER_CACHE_SIZE;
@@ -113,9 +111,7 @@ function resolveCacheLimit() {
113
111
  return parsed;
114
112
  return DEFAULT_CACHE_LIMIT;
115
113
  }
116
- // Re-export types
117
114
  __exportStar(require("./types"), exports);
118
- // Pre-built Sets for O(1) built-in lookups (allocated once, shared across all instances)
119
115
  const REACT_HOOKS = new Set([
120
116
  'useState', 'useEffect', 'useContext', 'useReducer', 'useCallback',
121
117
  'useMemo', 'useRef', 'useLayoutEffect', 'useImperativeHandle', 'useDebugValue',
@@ -138,19 +134,6 @@ const PYTHON_BUILT_IN_METHODS = new Set([
138
134
  'format', 'isdigit', 'isalpha', 'isalnum',
139
135
  'read', 'write', 'readline', 'readlines', 'close', 'flush', 'seek',
140
136
  ]);
141
- const GO_STDLIB_PACKAGES = new Set([
142
- 'fmt', 'os', 'io', 'net', 'http', 'log', 'math', 'sort', 'sync',
143
- 'time', 'path', 'bytes', 'strings', 'strconv', 'errors', 'context',
144
- 'json', 'xml', 'csv', 'html', 'template', 'regexp', 'reflect',
145
- 'runtime', 'testing', 'flag', 'bufio', 'crypto', 'encoding',
146
- 'filepath', 'hash', 'mime', 'rand', 'signal', 'sql', 'syscall',
147
- 'unicode', 'unsafe', 'atomic', 'binary', 'debug', 'exec', 'heap',
148
- 'ring', 'scanner', 'tar', 'zip', 'gzip', 'zlib', 'tls', 'url',
149
- 'user', 'pprof', 'trace', 'ast', 'build', 'parser', 'printer',
150
- 'token', 'types', 'cgo', 'plugin', 'race', 'ioutil',
151
- // Kubernetes-common stdlib aliases
152
- 'utilruntime', 'utilwait', 'utilnet',
153
- ]);
154
137
  const GO_BUILT_INS = new Set([
155
138
  'make', 'new', 'len', 'cap', 'append', 'copy', 'delete', 'close',
156
139
  'panic', 'recover', 'print', 'println', 'complex', 'real', 'imag',
@@ -160,6 +143,8 @@ const GO_BUILT_INS = new Set([
160
143
  'float32', 'float64', 'complex64', 'complex128',
161
144
  'string', 'bool', 'byte', 'rune', 'any',
162
145
  ]);
146
+ const PASCAL_CAST_TARGET_KINDS = new Set(['class', 'struct', 'interface', 'enum', 'type_alias']);
147
+ const TYPE_COMPANION_VALUE_KINDS = new Set(['function', 'class', 'component', 'constant', 'variable']);
163
148
  const PASCAL_UNIT_PREFIXES = [
164
149
  'System.', 'Winapi.', 'Vcl.', 'Fmx.', 'Data.', 'Datasnap.',
165
150
  'Soap.', 'Xml.', 'Web.', 'REST.', 'FireDAC.', 'IBX.',
@@ -183,9 +168,8 @@ const PASCAL_BUILT_INS = new Set([
183
168
  'TList', 'TStringList', 'TStrings', 'TStream', 'TMemoryStream', 'TFileStream',
184
169
  'Exception', 'EAbort', 'EConvertError', 'EAccessViolation',
185
170
  'IInterface', 'IUnknown',
186
- ]);
171
+ ].map((name) => name.toLowerCase()));
187
172
  const C_BUILT_INS = new Set([
188
- // Standard C library functions
189
173
  'printf', 'fprintf', 'sprintf', 'snprintf', 'scanf', 'fscanf', 'sscanf',
190
174
  'malloc', 'calloc', 'realloc', 'free',
191
175
  'memcpy', 'memmove', 'memset', 'memcmp', 'memchr',
@@ -209,123 +193,144 @@ const C_BUILT_INS = new Set([
209
193
  'int8_t', 'int16_t', 'int32_t', 'int64_t',
210
194
  'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t',
211
195
  'FILE',
212
- // POSIX additions commonly seen
213
196
  'stat', 'lstat', 'fstat', 'open', 'close', 'read', 'write', 'pipe',
214
197
  'fork', 'exec', 'waitpid', 'getpid', 'getppid', 'kill', 'sleep', 'usleep',
215
198
  'pthread_create', 'pthread_join', 'pthread_mutex_lock', 'pthread_mutex_unlock',
216
199
  'dlopen', 'dlsym', 'dlclose',
217
200
  ]);
218
201
  const CPP_BUILT_INS = new Set([
219
- // iostream objects (often used without std:: prefix via using)
220
202
  'cout', 'cin', 'cerr', 'clog', 'endl', 'flush', 'ws',
221
- 'std', // the namespace itself when used as std::something
222
- // Common C++ keywords that leak as references
203
+ 'std',
223
204
  'nullptr', 'true', 'false', 'this', 'sizeof', 'alignof', 'typeid',
224
205
  'static_cast', 'dynamic_cast', 'reinterpret_cast', 'const_cast',
225
206
  'make_unique', 'make_shared', 'make_pair',
226
207
  'move', 'forward', 'swap',
227
208
  ]);
228
- /**
229
- * Reference Resolver
230
- *
231
- * Orchestrates reference resolution using multiple strategies.
232
- */
209
+ const MODULE_CONFIG_ROOT_FILES = ['tsconfig.json', 'jsconfig.json', 'tsconfig.base.json', 'go.mod', 'Cargo.toml', ...import_resolver_1.CPP_COMPILE_DB_FILES];
210
+ function parseModuleConfigSnapshot(stored) {
211
+ if (!stored)
212
+ return {};
213
+ try {
214
+ const parsed = JSON.parse(stored);
215
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))
216
+ return {};
217
+ return Object.fromEntries(Object.entries(parsed).filter(([, v]) => typeof v === 'string'));
218
+ }
219
+ catch {
220
+ return {};
221
+ }
222
+ }
223
+ function moduleConfigSnapshot(projectRoot, files, previous) {
224
+ const snapshot = {};
225
+ for (const abs of files) {
226
+ const rel = path.relative(projectRoot, abs).replace(/\\/g, '/');
227
+ snapshot[rel] = moduleConfigEntry(abs, previous[rel], projectRoot);
228
+ }
229
+ return snapshot;
230
+ }
231
+ function moduleConfigEntry(abs, previous, projectRoot) {
232
+ let stat;
233
+ try {
234
+ stat = fs.statSync(abs, { throwIfNoEntry: false });
235
+ }
236
+ catch { }
237
+ if (!stat?.isFile())
238
+ return 'absent';
239
+ const stamp = `${stat.mtimeMs}:${stat.size}`;
240
+ return previous?.endsWith(`@${stamp}`) ? previous : `${moduleConfigDigest(abs, projectRoot)}@${stamp}`;
241
+ }
242
+ function moduleConfigDigest(abs, projectRoot) {
243
+ const file = path.basename(abs);
244
+ const read = file === 'go.mod' ? (0, go_module_1.loadGoModule)(path.dirname(abs))?.modulePath ?? ''
245
+ : file === 'Cargo.toml' ? cargoManifestDigestText(abs)
246
+ : file === 'compile_commands.json' ? ((0, import_resolver_1.readCompileDbIncludeDirs)(abs, projectRoot) ?? []).join('\n')
247
+ : (0, path_aliases_1.aliasConfigFields)(abs) ?? '';
248
+ return (0, crypto_1.createHash)('sha256').update(read).digest('hex').slice(0, 16);
249
+ }
250
+ function cargoManifestDigestText(abs) {
251
+ try {
252
+ return (0, name_matcher_1.cargoManifestFields)(fs.readFileSync(abs, 'utf-8'));
253
+ }
254
+ catch {
255
+ return '';
256
+ }
257
+ }
258
+ function changedModuleConfigs(was, now) {
259
+ const digest = (entry) => entry.split('@')[0];
260
+ const buildFilesKnown = 'Cargo.toml' in was;
261
+ return Object.keys(now).filter((rel) => (buildFilesKnown || !/(?:^|\/)(?:Cargo\.toml|compile_commands\.json)$/.test(rel)) &&
262
+ digest(was[rel] ?? 'absent') !== digest(now[rel]));
263
+ }
264
+ function moduleConfigLanguages(changed) {
265
+ const languages = new Set();
266
+ for (const rel of changed) {
267
+ if (/(?:^|\/)go\.mod$/.test(rel))
268
+ languages.add('go');
269
+ else if (/(?:^|\/)Cargo\.toml$/.test(rel))
270
+ languages.add('rust');
271
+ else if (/(?:^|\/)compile_commands\.json$/.test(rel))
272
+ for (const language of ['c', 'cpp'])
273
+ languages.add(language);
274
+ else
275
+ for (const language of import_resolver_1.ESM_IMPORT_LANGUAGES)
276
+ languages.add(language);
277
+ }
278
+ return languages;
279
+ }
233
280
  class ReferenceResolver {
234
281
  projectRoot;
235
282
  queries;
236
283
  context;
237
284
  frameworks = [];
238
- // Chained static-factory/fluent call refs the first pass couldn't resolve,
239
- // collected in-memory and left pending in the DB until the post-pass
240
- // finishes, so a restart can recover the queue (#1577). Drained by
241
- // resolveChainedCallsViaConformance
242
- // once implements/extends edges exist, to resolve methods on a supertype the
243
- // receiver conforms to (#750).
285
+ frameworksByLanguage = new Map();
244
286
  deferredChainRefs = [];
245
- // `this.<member>` function-as-value refs whose member is NOT on the
246
- // enclosing class itself — possibly inherited. Collected in-memory for the
247
- // same reason as deferredChainRefs and drained by
248
- // resolveDeferredThisMemberRefs once implements/extends edges exist (#808).
249
287
  deferredThisMemberRefs = [];
250
288
  deferredRowIds = new Set();
251
- // Per-`.razor`/`.cshtml`-file `@using` namespace set (own directives + folder
252
- // `_Imports.razor`, cascading to the project root). Used to disambiguate a
253
- // markup type ref to the right C# namespace.
254
289
  razorUsingsCache = new Map();
255
- // All per-resolver caches are LRU-bounded. Previously these were
256
- // unbounded Maps that grew with every distinct lookup and OOM'd on
257
- // codebases with 20k+ files (see issue: unbounded cache growth).
258
- nodeCache; // per-file node cache
259
- fileCache; // per-file content cache
290
+ nodeCache;
291
+ fileCache;
260
292
  importMappingCache;
261
293
  reExportCache;
262
- nameCache; // name → nodes cache
263
- lowerNameCache; // lower(name) → nodes cache
264
- qualifiedNameCache; // qualified_name → nodes cache
265
- fileLinesCache; // file → split lines cache
266
- // id → node for the resolver's own point reads. Every resolved reference
267
- // re-reads its target a few times (kind gate, language gate, alias
268
- // following, edge creation) and targets recur ~5× on large repos; the query
269
- // layer's cache is too small for that working set. Same stable window as the
270
- // name caches above; absent ids are not cached.
294
+ nameCache;
295
+ lowerNameCache;
296
+ qualifiedNameCache;
297
+ fileLinesCache;
271
298
  nodeByIdCache;
272
- methodMatchCache; // lang\0Type::method → matching method nodes
273
- // Per-(language, methodName) owner index for getMethodMatches: buckets a
274
- // method name's candidates by their qualifiedName's last two segments so a
275
- // (type, method) query is a lookup instead of an O(candidates) filter per
276
- // methodMatchCache miss. Derived purely from node rows (stable through the
277
- // resolution loop, same window nameCache relies on); dropped in clearCaches.
299
+ methodMatchCache;
278
300
  methodOwnerIndexCache = new Map();
279
- // Generation-tagged memo for getSupertypes. Supertype edges GROW during the
280
- // resolution loop (batch k persists its implements/extends edges BEFORE
281
- // batch k+1 fans out — the #1320 ordering), so a plain cache would freeze an
282
- // early batch's emptier answer and change later batches' outcomes. Within
283
- // one batch the edge state is fixed by that same ordering, so entries are
284
- // tagged with a generation that advances at every batch entry point
285
- // (resolveBatchYielding / resolveListForAdmission) — a stale-gen entry is
286
- // recomputed, making the memo behavior-identical to no memo at every point
287
- // in time. On the Swift compiler the unmemoized walk ran 971k times for
288
- // 565s of combined worker time (~581µs each, recursion-multiplied).
289
301
  supertypeGen = 0;
290
302
  supertypeMemo = new Map();
291
- /** Invalidate the getSupertypes memo — call when resolved edges may have advanced. */
303
+ supertypeNodeMemo = new Map();
304
+ superclassNodeMemo = new Map();
292
305
  advanceSupertypeGeneration() {
293
306
  this.supertypeGen++;
294
- // Lazy invalidation via the gen tag; bound the map so a long run over many
295
- // batches doesn't accrete dead entries.
296
307
  if (this.supertypeMemo.size > 50_000)
297
308
  this.supertypeMemo.clear();
309
+ if (this.supertypeNodeMemo.size > 50_000)
310
+ this.supertypeNodeMemo.clear();
311
+ if (this.superclassNodeMemo.size > 50_000)
312
+ this.superclassNodeMemo.clear();
298
313
  }
299
- // Node kinds are a small fixed set (~24), so this is a plain Map, not an LRU.
300
- // getNodesByKind returns the FULL node list for a kind; it was previously
301
- // uncached — a per-ref `SELECT * FROM nodes WHERE kind=?` + row-mapping. Called
302
- // for every dotted call ref by the Spring resolver (constants) and every
303
- // `hook_` ref by the Drupal resolver (functions), that scan dominated
304
- // resolution on large repos (#1180). The node set is stable within a
305
- // resolution pass (same lifetime assumption as nameCache); clearCaches() resets
306
- // it between passes. Callers must treat the returned array as read-only.
307
314
  nodesByKindCache = new Map();
308
- // Filesystem existence probes behind context.fileExists (paths not in knownFiles).
309
315
  fileExistsMemo = new Map();
310
- knownNames = null; // all known symbol names for fast pre-filtering
316
+ knownNames = null;
311
317
  knownFiles = null;
312
318
  cachesWarmed = false;
313
- // tsconfig/jsconfig path-alias map. `undefined` = not yet computed,
314
- // `null` = computed and absent. Treated as immutable for the
315
- // resolver's lifetime; callers re-create the resolver if config changes.
316
319
  projectAliases = undefined;
317
- // Per directory: the aliases of the nearest non-root tsconfig declaring `paths`.
318
320
  dirAliases = new Map();
319
- // go.mod module path. Same lazy/immutable convention as projectAliases.
320
- goModule = undefined;
321
- // Monorepo workspace member packages. Same lazy/immutable convention.
321
+ cargoCrates = undefined;
322
+ compileDbIncludeDirs = undefined;
323
+ layoutIncludeDirs = undefined;
324
+ goModuleByDir = new Map();
325
+ goModules = null;
326
+ goPackageDirs = new Map();
322
327
  workspacePackages = undefined;
328
+ workspaceDiscovery = null;
329
+ moduleConfigFiles = new Set();
323
330
  constructor(projectRoot, queries) {
324
331
  this.projectRoot = projectRoot;
325
332
  this.queries = queries;
326
333
  const limit = resolveCacheLimit();
327
- // The content cache is heavier (full file text), so we give it a
328
- // smaller budget than the metadata caches.
329
334
  const contentLimit = Math.max(64, Math.floor(limit / 5));
330
335
  this.nodeCache = new lru_cache_1.LRUCache(limit);
331
336
  this.fileCache = new lru_cache_1.LRUCache(contentLimit);
@@ -334,28 +339,31 @@ class ReferenceResolver {
334
339
  this.nameCache = new lru_cache_1.LRUCache(limit);
335
340
  this.lowerNameCache = new lru_cache_1.LRUCache(limit);
336
341
  this.qualifiedNameCache = new lru_cache_1.LRUCache(limit);
337
- // Split-lines arrays are heavier than content strings; refs arrive
338
- // file-ordered, so a small cache still hits nearly always.
339
342
  this.fileLinesCache = new lru_cache_1.LRUCache(contentLimit);
340
343
  this.nodeByIdCache = new lru_cache_1.LRUCache(Math.max(limit * 4, 20_000));
341
344
  this.methodMatchCache = new lru_cache_1.LRUCache(limit);
342
345
  this.context = this.createContext();
343
346
  }
344
- /**
345
- * Initialize the resolver (detect frameworks, etc.)
346
- */
347
- initialize() {
348
- this.frameworks = (0, frameworks_1.detectFrameworks)(this.context);
347
+ initialize(frameworks) {
348
+ this.workspacePackages = undefined;
349
+ this.workspaceDiscovery = null;
350
+ this.cargoCrates = undefined;
351
+ this.compileDbIncludeDirs = undefined;
352
+ this.layoutIncludeDirs = undefined;
349
353
  this.clearCaches();
354
+ this.frameworks = frameworks
355
+ ? (0, frameworks_1.getAllFrameworkResolvers)().filter((f) => frameworks.includes(f.name))
356
+ : (0, frameworks_1.detectFrameworks)(this.context);
357
+ this.frameworksByLanguage.clear();
358
+ }
359
+ frameworksFor(language) {
360
+ let frameworks = this.frameworksByLanguage.get(language);
361
+ if (!frameworks) {
362
+ frameworks = (0, frameworks_1.getResolvingFrameworks)(this.frameworks, language);
363
+ this.frameworksByLanguage.set(language, frameworks);
364
+ }
365
+ return frameworks;
350
366
  }
351
- /**
352
- * Run each framework resolver's cross-file finalization pass and persist
353
- * the returned node updates. Idempotent — safe to call after every indexAll
354
- * and every incremental sync. Returns the number of nodes updated.
355
- *
356
- * Caches are cleared before/after so the post-extract pass sees fresh DB
357
- * state and downstream queries see the updated names.
358
- */
359
367
  runPostExtract() {
360
368
  let updated = 0;
361
369
  this.clearCaches();
@@ -375,33 +383,91 @@ class ReferenceResolver {
375
383
  });
376
384
  }
377
385
  }
386
+ for (const fw of this.frameworks) {
387
+ if (!fw.crossFileNodes)
388
+ continue;
389
+ try {
390
+ updated += this.reconcileCrossFileNodes(fw.crossFileNodes(this.context));
391
+ }
392
+ catch (err) {
393
+ (0, errors_1.logDebug)(`Framework '${fw.name}' crossFileNodes failed`, {
394
+ error: err instanceof Error ? err.message : String(err),
395
+ });
396
+ }
397
+ }
378
398
  if (updated > 0)
379
399
  this.clearCaches();
380
400
  return updated;
381
401
  }
382
- /**
383
- * Pre-build lightweight caches for resolution.
384
- * Node lookups are now handled by indexed SQLite queries instead of
385
- * loading all nodes into memory (which caused OOM on large codebases).
386
- * We cache the set of known symbol names for fast pre-filtering.
387
- */
402
+ reconcileCrossFileNodes(result) {
403
+ const wanted = new Map();
404
+ for (const node of result.nodes)
405
+ if (result.owns(node))
406
+ wanted.set(node.id, node);
407
+ const existing = new Map();
408
+ for (const node of this.queries.getNodesByKind(result.kind))
409
+ if (result.owns(node))
410
+ existing.set(node.id, node);
411
+ let changed = 0;
412
+ for (const [id, old] of existing) {
413
+ if (wanted.has(id))
414
+ continue;
415
+ const refs = this.queries.getCrossFileIncomingEdgesWithTarget(old.filePath)
416
+ .filter((e) => e.target === id)
417
+ .map((e) => (0, resurrect_ref_1.resurrectRefFromDroppedEdge)(e))
418
+ .filter((r) => r !== null);
419
+ if (refs.length > 0)
420
+ this.queries.insertUnresolvedRefsBatch(refs);
421
+ this.queries.deleteNode(id);
422
+ changed++;
423
+ }
424
+ const added = [];
425
+ for (const [id, node] of wanted) {
426
+ const old = existing.get(id);
427
+ if (!old)
428
+ added.push(node);
429
+ else if (old.name !== node.name || old.qualifiedName !== node.qualifiedName) {
430
+ this.queries.updateNode(node);
431
+ changed++;
432
+ }
433
+ }
434
+ if (added.length > 0) {
435
+ this.queries.insertNodes(added);
436
+ const ids = new Set(added.map((n) => n.id));
437
+ this.queries.insertUnresolvedRefsBatch(result.references.filter((r) => ids.has(r.fromNodeId)));
438
+ changed += added.length;
439
+ }
440
+ return changed;
441
+ }
442
+ reopenRouteModuleReaders(changedFilePaths) {
443
+ const readers = this.frameworks.filter((f) => f.lazyModules);
444
+ if (readers.length === 0 || changedFilePaths.length === 0)
445
+ return 0;
446
+ const changed = new Set(changedFilePaths);
447
+ const edgeIds = [];
448
+ const refs = [];
449
+ for (const edge of this.queries.getRouteEdgesMovedBy(changedFilePaths)) {
450
+ const ref = (0, resurrect_ref_1.resurrectRefFromDroppedEdge)(edge);
451
+ if (!ref)
452
+ continue;
453
+ const asked = { ...ref, filePath: edge.sourceFilePath, language: edge.sourceLanguage };
454
+ const reads = readers.some((f) => f.lazyModules(asked, this.context).some((file) => changed.has(file)));
455
+ if (!reads)
456
+ continue;
457
+ edgeIds.push(edge.edgeId);
458
+ refs.push(ref);
459
+ }
460
+ if (refs.length > 0)
461
+ this.queries.replaceResolutionEdgesWithUnresolvedRefs(edgeIds, refs);
462
+ return refs.length;
463
+ }
388
464
  warmCaches() {
389
465
  if (this.cachesWarmed)
390
466
  return;
391
- // Only cache the set of known file paths (lightweight string set)
392
467
  this.knownFiles = new Set(this.queries.getAllFilePaths());
393
- // Cache all distinct symbol names for fast pre-filtering (just strings, not full nodes)
394
468
  this.knownNames = new Set(this.queries.getAllNodeNames());
395
469
  this.cachesWarmed = true;
396
470
  }
397
- /**
398
- * warmCaches for the async resolution entry points: streams the distinct
399
- * name set with periodic yields instead of one synchronous `.all()`. On a
400
- * multi-million-node index the DISTINCT scan is a solid multi-second block
401
- * (measured up to 28s inside `codegraph sync` on the Linux kernel index),
402
- * long enough to matter to the #850 watchdog on slower hardware. Same
403
- * result, same memory — only the event loop keeps turning.
404
- */
405
471
  async warmCachesYielding(onYield) {
406
472
  if (this.cachesWarmed)
407
473
  return;
@@ -416,7 +482,12 @@ class ReferenceResolver {
416
482
  this.knownNames = names;
417
483
  this.cachesWarmed = true;
418
484
  }
419
- /** `queries.getNodeById` through the resolver's own id → node cache. */
485
+ projectScans() {
486
+ return (0, project_scans_1.readProjectScans)(this.context, this.queries, this.fileExistsMemo);
487
+ }
488
+ adoptProjectScans(scans) {
489
+ (0, project_scans_1.adoptProjectScans)(this.context, scans, this.fileExistsMemo);
490
+ }
420
491
  nodeById(id) {
421
492
  const cached = this.nodeByIdCache.get(id);
422
493
  if (cached !== undefined)
@@ -426,10 +497,14 @@ class ReferenceResolver {
426
497
  this.nodeByIdCache.set(id, node);
427
498
  return node;
428
499
  }
429
- /**
430
- * Clear internal caches
431
- */
432
500
  clearCaches() {
501
+ this.mocklessContext = null;
502
+ this.mocklessBase = null;
503
+ this.manualMocks = undefined;
504
+ this.classExpressionFreeViews = new WeakMap();
505
+ this.classExpressionFreeBases = new WeakMap();
506
+ this.classExpressionIndex = undefined;
507
+ this.classExpressionOnlyNameSet = null;
433
508
  this.nodeCache.clear();
434
509
  this.fileCache.clear();
435
510
  this.importMappingCache.clear();
@@ -442,6 +517,8 @@ class ReferenceResolver {
442
517
  this.methodMatchCache.clear();
443
518
  this.methodOwnerIndexCache.clear();
444
519
  this.supertypeMemo.clear();
520
+ this.supertypeNodeMemo.clear();
521
+ this.superclassNodeMemo.clear();
445
522
  this.supertypeGen++;
446
523
  this.nodesByKindCache.clear();
447
524
  this.fileExistsMemo.clear();
@@ -449,33 +526,73 @@ class ReferenceResolver {
449
526
  this.knownNames = null;
450
527
  this.knownLowerNames = null;
451
528
  this.knownFiles = null;
529
+ this.goModules = null;
530
+ this.goPackageDirs.clear();
452
531
  this.cachesWarmed = false;
453
- // The import-resolver's and name-matcher's per-context memos assume the
454
- // same stable window as the caches above — drop them together.
455
532
  if (this.context) {
456
533
  (0, import_resolver_1.clearImportResolverMemos)(this.context);
457
534
  (0, name_matcher_1.clearNameMatcherMemos)(this.context);
535
+ (0, ruby_constant_paths_1.clearRubyConstantPathMemos)(this.context);
458
536
  (0, cpp_macro_visibility_1.clearCppMacroVisibility)(this.context);
459
537
  (0, swift_type_visibility_1.clearSwiftTypeVisibility)(this.context);
538
+ (0, dart_libraries_1.clearDartLibraryMemos)(this.context);
539
+ (0, vbnet_receivers_1.clearVbnetReceiverMemos)(this.context);
540
+ (0, pascal_scope_1.clearPascalScopeMemos)(this.context);
460
541
  (0, type_parameters_1.clearTypeParameterMemos)(this.context);
542
+ (0, dart_local_scope_1.clearDartLocalScopeMemos)(this.context);
543
+ (0, cpp_type_aliases_1.clearCppTypeAliasMemos)(this.context);
544
+ (0, cpp_supertypes_1.clearCppSupertypeMemos)(this.context);
545
+ (0, cpp_includers_1.clearCppIncluderMemos)(this.context);
546
+ (0, c_macro_renames_1.clearCMacroRenames)(this.context);
547
+ (0, c_feature_variants_1.clearCFeatureVariantMemos)(this.context);
548
+ (0, ambient_modules_1.clearAmbientModuleMemos)(this.context);
549
+ (0, package_deps_1.clearDeclaredDependencies)(this.context);
461
550
  }
462
551
  }
463
- /** `readFile` through the LRU content cache (null = read failed, also cached). */
552
+ nearestGoModule(dir) {
553
+ const walked = [];
554
+ let found;
555
+ for (;;) {
556
+ found = this.goModuleByDir.get(dir);
557
+ if (found !== undefined)
558
+ break;
559
+ walked.push(dir);
560
+ found = (0, go_module_1.loadGoModule)(path.join(this.projectRoot, dir));
561
+ if (found)
562
+ this.moduleConfigFiles.add(path.join(this.projectRoot, dir, 'go.mod'));
563
+ if (found || dir === '')
564
+ break;
565
+ dir = goDirOf(dir);
566
+ }
567
+ for (const d of walked)
568
+ this.goModuleByDir.set(d, found);
569
+ return found;
570
+ }
571
+ getGoModules() {
572
+ if (this.goModules)
573
+ return this.goModules;
574
+ const dirs = new Set(['']);
575
+ for (const file of this.knownFiles ?? this.queries.getAllFilePaths()) {
576
+ if (file.endsWith('.go'))
577
+ dirs.add(goDirOf(file));
578
+ }
579
+ const modules = new Set();
580
+ for (const dir of dirs) {
581
+ const mod = this.nearestGoModule(dir);
582
+ const modDir = mod ? path.relative(this.projectRoot, mod.rootDir).split(path.sep).join('/') : '';
583
+ if (mod && !/(?:^|\/)(?:testdata|[_.][^/]*)(?:\/|$)/.test(modDir))
584
+ modules.add(mod);
585
+ }
586
+ this.goModules = [...modules];
587
+ return this.goModules;
588
+ }
464
589
  readFileCached(filePath) {
465
590
  if (this.fileCache.has(filePath)) {
466
591
  return this.fileCache.get(filePath);
467
592
  }
468
593
  const fullPath = path.join(this.projectRoot, filePath);
469
594
  try {
470
- // Import resolvers may follow package metadata to an archive (`file:*.har`,
471
- // for example). Reject anything extraction would not accept before UTF-8
472
- // decoding can multiply a large binary blob into gigabytes of V8 heap.
473
- const stats = fs.statSync(fullPath);
474
- if (!stats.isFile() || stats.size > file_limits_1.MAX_SOURCE_FILE_SIZE_BYTES) {
475
- this.fileCache.set(filePath, null);
476
- return null;
477
- }
478
- const content = fs.readFileSync(fullPath, 'utf-8');
595
+ const content = (0, file_limits_1.readSourceText)(fullPath);
479
596
  this.fileCache.set(filePath, content);
480
597
  return content;
481
598
  }
@@ -485,11 +602,6 @@ class ReferenceResolver {
485
602
  return null;
486
603
  }
487
604
  }
488
- /**
489
- * `readFileCached(filePath)?.includes(needle)` for an ASCII needle, searched
490
- * in the raw bytes: an ASCII byte sequence survives UTF-8 decoding
491
- * unchanged, and decoding is most of reading a file nobody keeps.
492
- */
493
605
  fileContains(filePath, needle) {
494
606
  if (this.fileCache.has(filePath))
495
607
  return this.fileCache.get(filePath)?.includes(needle) ?? false;
@@ -504,15 +616,32 @@ class ReferenceResolver {
504
616
  return false;
505
617
  }
506
618
  }
507
- /**
508
- * Create the resolution context
509
- */
619
+ scanFile(filePath) {
620
+ if (this.fileCache.has(filePath))
621
+ return this.fileCache.get(filePath) ?? null;
622
+ try {
623
+ return (0, file_limits_1.readSourceText)(path.join(this.projectRoot, filePath), 'latin1');
624
+ }
625
+ catch {
626
+ return null;
627
+ }
628
+ }
510
629
  createContext() {
511
630
  return {
512
- resolveImport: (ref) => (0, import_resolver_1.resolveViaImport)(ref, this.context),
513
- isOutOfRepoImport: (source, fromFile, language) => (0, import_resolver_1.isExternalImport)(source, language, this.context) &&
514
- (0, import_resolver_1.resolveImportPath)(source, fromFile, language, this.context) === null &&
515
- this.isDeclaredOutsidePackage(source, fromFile),
631
+ resolveImport: (ref) => (0, import_resolver_1.resolveViaImport)(ref, this.context) ??
632
+ ((ref.language === 'c' || ref.language === 'cpp') && ref.referenceKind === 'imports' &&
633
+ !(0, import_resolver_1.isExternalImport)(ref.referenceName, ref.language, this.context) ? (0, name_matcher_1.matchByFilePath)(ref, this.context) : null),
634
+ isOutOfRepoImport: (source, fromFile, language) => {
635
+ if (!(0, import_resolver_1.isExternalImport)(source, language, this.context, { aliasPrefixes: false, fromFile }))
636
+ return false;
637
+ const resolved = (0, import_resolver_1.resolveImportPath)(source, fromFile, language, this.context);
638
+ if (resolved !== null && this.isIndexedFile(resolved))
639
+ return false;
640
+ return this.isDeclaredOutsidePackage(source, fromFile);
641
+ },
642
+ resolveModuleFile: (source, fromFile, language) => (0, import_resolver_1.resolveImportPath)(source, fromFile, language, this.context),
643
+ isDeclaredPackage: (source, fromFile) => this.isDeclaredOutsidePackage(source, fromFile),
644
+ isIndexedFile: (filePath) => this.isIndexedFile(filePath),
516
645
  getNodesInFile: (filePath) => {
517
646
  if (!this.nodeCache.has(filePath)) {
518
647
  this.nodeCache.set(filePath, this.queries.getNodesByFile(filePath));
@@ -539,6 +668,7 @@ class ReferenceResolver {
539
668
  this.nameCache.set(name, result);
540
669
  return result;
541
670
  },
671
+ isAbsentName: (name) => this.knownNames !== null && !this.knownNames.has(name),
542
672
  getMethodMatches: (typeName, methodName, language) => {
543
673
  const key = `${language} ${typeName}::${methodName}`;
544
674
  const cached = this.methodMatchCache.get(key);
@@ -552,11 +682,6 @@ class ReferenceResolver {
552
682
  const want = `${typeName}::${methodName}`;
553
683
  let matches;
554
684
  if (typeName.includes('::') || methodName.includes(':')) {
555
- // Legacy linear filter for the shapes the owner index below can't
556
- // key exactly: a multi-segment typeName (the endsWith test then
557
- // spans more than two `::` segments) and ObjC selectors (whose
558
- // single/empty-keyword colons defeat the segment split). Tiny
559
- // populations; the per-key memo above still amortizes them.
560
685
  matches = [];
561
686
  for (const m of candidates) {
562
687
  if (m.kind !== 'method')
@@ -569,18 +694,6 @@ class ReferenceResolver {
569
694
  }
570
695
  }
571
696
  else {
572
- // Owner index: the linear filter above is O(all same-named methods)
573
- // per CACHE MISS, and on overload-heavy landscapes the distinct
574
- // (type, method) key space is so large the per-key memo never
575
- // amortizes — Swift's `init` has tens of thousands of candidates
576
- // and the compiler repo measured 732µs per failing call, most of it
577
- // this scan (re-entered once per supertype recursion level, too).
578
- // Bucket each (language, methodName)'s candidates ONCE by the
579
- // qualifiedName's last two `::` segments — exactly the span the
580
- // `qn === want || qn.endsWith('::' + want)` predicate tests for a
581
- // segment-clean typeName — then every query is a map lookup.
582
- // Bucket insertion follows candidate order, so each bucket is
583
- // byte-identical to what the linear filter produced.
584
697
  const idxKey = `${language} ${methodName}`;
585
698
  let ownerIndex = this.methodOwnerIndexCache.get(idxKey);
586
699
  if (!ownerIndex) {
@@ -593,7 +706,7 @@ class ReferenceResolver {
593
706
  const qn = m.qualifiedName;
594
707
  const i2 = qn.lastIndexOf('::');
595
708
  if (i2 < 0)
596
- continue; // single-segment qn can never match `T::m`
709
+ continue;
597
710
  const i1 = qn.lastIndexOf('::', i2 - 1);
598
711
  const bucketKey = i1 < 0 ? qn : qn.slice(i1 + 2);
599
712
  const bucket = ownerIndex.get(bucketKey);
@@ -625,33 +738,14 @@ class ReferenceResolver {
625
738
  this.nodesByKindCache.set(kind, result);
626
739
  return result;
627
740
  },
628
- // Streamed, uncached — synthesizers scan-and-filter whole kinds, and
629
- // both the materialized array AND the per-kind cache retention are
630
- // O(nodes) memory (#1212). Per-ref resolvers keep the cached array
631
- // variant above.
632
741
  iterateNodesByKind: (kind) => this.queries.iterateNodesByKind(kind),
633
742
  fileExists: (filePath) => {
634
- // Check pre-built known files set first (O(1))
635
743
  if (this.knownFiles) {
636
- const normalized = filePath.replace(/\\/g, '/');
637
- if (this.knownFiles.has(filePath) || this.knownFiles.has(normalized)) {
744
+ if (this.knownFiles.has(filePath))
745
+ return true;
746
+ if (filePath.includes('\\') && this.knownFiles.has(filePath.replace(/\\/g, '/')))
638
747
  return true;
639
- }
640
748
  }
641
- // Fall back to filesystem for files not yet indexed. `path.join` does
642
- // not clamp, and relative-import resolution hands us paths carrying
643
- // `../` segments, so the probe has to be contained (#1631): a path
644
- // outside the root can never be an indexed project file, and the
645
- // `knownFiles` check above already answered for everything that is.
646
- // Lexical containment only: this is a per-candidate hot path, and the
647
- // symlink half of `validatePathWithinRoot` costs two `realpathSync`
648
- // calls per probe (~70x slower here). It would also be wrong to apply
649
- // — indexing deliberately follows in-root symlinks whose targets live
650
- // outside the root (#935), so only the `../` escape is refused.
651
- // Memoized: import resolution probes the same candidate paths (every
652
- // extension of a specifier) from every file that imports it, and the
653
- // tree does not change within a resolution pass (same window as the
654
- // file-content cache; dropped by clearCaches).
655
749
  const probed = this.fileExistsMemo.get(filePath);
656
750
  if (probed !== undefined)
657
751
  return probed;
@@ -672,6 +766,7 @@ class ReferenceResolver {
672
766
  },
673
767
  readFile: (filePath) => this.readFileCached(filePath),
674
768
  fileContains: (filePath, needle) => this.fileContains(filePath, needle),
769
+ scanFile: (filePath) => this.scanFile(filePath),
675
770
  getFileLines: (filePath) => {
676
771
  const cached = this.fileLinesCache.get(filePath);
677
772
  if (cached !== undefined)
@@ -711,25 +806,21 @@ class ReferenceResolver {
711
806
  this.lowerNameCache.set(lowerName, result);
712
807
  return result;
713
808
  },
809
+ getNodeNamesOfKinds: (language, kinds) => this.queries.getNodeNamesOfKinds(language, kinds),
810
+ rememberNode: (node) => {
811
+ if (!this.nodeByIdCache.has(node.id))
812
+ this.nodeByIdCache.set(node.id, node);
813
+ },
714
814
  getNodeById: (id) => {
715
815
  return this.nodeById(id);
716
816
  },
717
817
  getSupertypes: (typeName, language) => {
718
- // Union the `implements`/`extends` targets of every same-named type node.
719
- // Matching by simple name (not id) reconciles a type declared in one node
720
- // (`KF::Builder`) with conformance declared in a separate extension node
721
- // (`KF.Builder: KFOptionSetter`) — both have name `Builder`.
722
- // Memoized per batch generation (see supertypeMemo): within a batch the
723
- // edge state is fixed, and the conformance walk re-queries the same
724
- // popular supertypes (Swift stdlib protocols especially) thousands of
725
- // times per batch.
726
818
  const memoKey = `${language} ${typeName}`;
727
819
  const hit = this.supertypeMemo.get(memoKey);
728
820
  if (hit && hit.gen === this.supertypeGen)
729
821
  return hit.supers;
730
822
  const typeNodes = this.context
731
823
  .getNodesByName(typeName)
732
- // Scala singletons can inherit members even though they cannot be parents.
733
824
  .filter((n) => n.language === language && (SUPERTYPE_BEARING_KINDS.has(n.kind) ||
734
825
  (n.language === 'scala' && n.kind === 'module')));
735
826
  let supers;
@@ -744,9 +835,6 @@ class ReferenceResolver {
744
835
  if (target?.name && target.name !== typeName)
745
836
  supertypes.add(target.name);
746
837
  }
747
- // A Swift conformance to a type the project only extends (SwiftUI's
748
- // `View`) resolves to nothing — the extension is not the type — yet
749
- // the members its extensions add are still the conformer's.
750
838
  if (language === 'swift') {
751
839
  for (const name of (0, swift_type_visibility_1.swiftExtendedConformances)(tn, this.context)) {
752
840
  if (name !== typeName)
@@ -759,6 +847,32 @@ class ReferenceResolver {
759
847
  this.supertypeMemo.set(memoKey, { gen: this.supertypeGen, supers });
760
848
  return supers;
761
849
  },
850
+ getSupertypeNodes: (id) => {
851
+ const hit = this.supertypeNodeMemo.get(id);
852
+ if (hit && hit.gen === this.supertypeGen)
853
+ return hit.nodes;
854
+ const nodes = [];
855
+ for (const edge of this.queries.getOutgoingEdges(id, RESOLUTION_READ_EDGE_KINDS)) {
856
+ const target = this.nodeById(edge.target);
857
+ if (target)
858
+ nodes.push(target);
859
+ }
860
+ this.supertypeNodeMemo.set(id, { gen: this.supertypeGen, nodes });
861
+ return nodes;
862
+ },
863
+ getSuperclassNodes: (id) => {
864
+ const hit = this.superclassNodeMemo.get(id);
865
+ if (hit && hit.gen === this.supertypeGen)
866
+ return hit.nodes;
867
+ const nodes = [];
868
+ for (const edge of this.queries.getOutgoingEdges(id, ['extends'])) {
869
+ const target = this.nodeById(edge.target);
870
+ if (target)
871
+ nodes.push(target);
872
+ }
873
+ this.superclassNodeMemo.set(id, { gen: this.supertypeGen, nodes });
874
+ return nodes;
875
+ },
762
876
  getImportMappings: (filePath, language) => {
763
877
  const cacheKey = filePath;
764
878
  const cached = this.importMappingCache.get(cacheKey);
@@ -775,7 +889,7 @@ class ReferenceResolver {
775
889
  },
776
890
  getProjectAliases: () => {
777
891
  if (this.projectAliases === undefined) {
778
- this.projectAliases = (0, path_aliases_1.loadProjectAliases)(this.projectRoot);
892
+ this.projectAliases = (0, path_aliases_1.loadProjectAliases)(this.projectRoot, this.moduleConfigFiles);
779
893
  }
780
894
  return this.projectAliases;
781
895
  },
@@ -792,7 +906,7 @@ class ReferenceResolver {
792
906
  walked.push(dir);
793
907
  const abs = path.join(this.projectRoot, dir);
794
908
  if (['tsconfig.json', 'jsconfig.json'].some((name) => fs.existsSync(path.join(abs, name)))) {
795
- const aliases = (0, path_aliases_1.loadProjectAliases)(abs);
909
+ const aliases = (0, path_aliases_1.loadProjectAliases)(abs, this.moduleConfigFiles);
796
910
  if (aliases) {
797
911
  found = aliases;
798
912
  break;
@@ -804,15 +918,22 @@ class ReferenceResolver {
804
918
  this.dirAliases.set(d, found);
805
919
  return found;
806
920
  },
807
- getGoModule: () => {
808
- if (this.goModule === undefined) {
809
- this.goModule = (0, go_module_1.loadGoModule)(this.projectRoot);
810
- }
811
- return this.goModule;
921
+ getGoPackageDir: (importPath, fromFile) => {
922
+ const own = fromFile === undefined ? null : this.nearestGoModule(goDirOf(fromFile));
923
+ const key = `${importPath}\0${own?.rootDir ?? ''}`;
924
+ const hit = this.goPackageDirs.get(key);
925
+ if (hit !== undefined)
926
+ return hit;
927
+ const mod = (0, go_module_1.findGoModuleForImport)(importPath, this.getGoModules(), own);
928
+ const dir = mod ? (0, go_module_1.goModulePackageDir)(importPath, mod, this.projectRoot) : null;
929
+ this.goPackageDirs.set(key, dir);
930
+ return dir;
812
931
  },
813
932
  getWorkspacePackages: () => {
814
933
  if (this.workspacePackages === undefined) {
815
- this.workspacePackages = (0, workspace_packages_1.loadWorkspacePackages)(this.projectRoot);
934
+ const { packages, discovery } = (0, workspace_packages_1.loadWorkspacePackagesAndManifests)(this.projectRoot);
935
+ this.workspacePackages = packages;
936
+ this.workspaceDiscovery = discovery;
816
937
  }
817
938
  return this.workspacePackages;
818
939
  },
@@ -825,34 +946,27 @@ class ReferenceResolver {
825
946
  this.reExportCache.set(filePath, []);
826
947
  return [];
827
948
  }
828
- // Re-exports are a JS/TS-only construct, and what matters is the
829
- // BARREL file's own language — not the consuming reference's. A
830
- // `.svelte`/`.vue` consumer threads its own language down the
831
- // re-export chase, which would make extractReExports() bail on a
832
- // `.ts` index barrel and silently break the chain (#629). Re-key
833
- // the parse on the barrel's extension so the chase works no matter
834
- // what kind of file imports through it.
835
949
  const isJsFamily = /\.(?:d\.ts|[cm]?tsx?|[cm]?jsx?|ets)$/i.test(filePath);
836
- const reExports = (0, import_resolver_1.extractReExports)(content, isJsFamily ? 'typescript' : language);
950
+ const barrelLanguage = isJsFamily ? 'typescript' : /\.py$/i.test(filePath) ? 'python' : language;
951
+ const reExports = (0, import_resolver_1.extractReExports)(content, barrelLanguage);
837
952
  this.reExportCache.set(filePath, reExports);
838
953
  return reExports;
839
954
  },
840
955
  getCppIncludeDirs: () => {
841
- return (0, import_resolver_1.loadCppIncludeDirs)(this.projectRoot);
956
+ if (this.compileDbIncludeDirs === undefined)
957
+ this.compileDbIncludeDirs = (0, import_resolver_1.loadCppIncludeDirsFromCompileDB)(this.projectRoot);
958
+ return this.compileDbIncludeDirs ?? (this.layoutIncludeDirs ??= (0, import_resolver_1.loadCppIncludeDirsHeuristic)(this.projectRoot));
842
959
  },
960
+ getCargoCrates: () => this.readCargoCrates(),
961
+ getCppIncludeNodes: () => this.queries.getCppIncludeNodes(),
843
962
  };
844
963
  }
845
- /**
846
- * Resolve all unresolved references
847
- */
848
964
  resolveAll(unresolvedRefs, onProgress) {
849
- // Pre-load all nodes into memory for fast lookups
850
965
  this.warmCaches();
851
966
  this.advanceSupertypeGeneration();
852
967
  const resolved = [];
853
968
  const unresolved = [];
854
969
  const byMethod = {};
855
- // Convert to our internal format, using denormalized fields when available
856
970
  const refs = unresolvedRefs.map((ref) => ({
857
971
  fromNodeId: ref.fromNodeId,
858
972
  referenceName: ref.referenceName,
@@ -866,16 +980,15 @@ class ReferenceResolver {
866
980
  const total = refs.length;
867
981
  let lastReportedPercent = -1;
868
982
  for (let i = 0; i < refs.length; i++) {
869
- const ref = refs[i]; // Array index is guaranteed to be in bounds
983
+ const ref = refs[i];
870
984
  const result = this.resolveOneTimed(ref);
871
985
  if (result) {
872
986
  resolved.push(result);
873
987
  byMethod[result.resolvedBy] = (byMethod[result.resolvedBy] || 0) + 1;
874
988
  }
875
989
  else {
876
- unresolved.push(ref);
990
+ unresolved.push(this.parkable(ref));
877
991
  }
878
- // Report progress every 1% to avoid too many updates
879
992
  if (onProgress) {
880
993
  const currentPercent = Math.floor((i / total) * 100);
881
994
  if (currentPercent > lastReportedPercent) {
@@ -884,7 +997,6 @@ class ReferenceResolver {
884
997
  }
885
998
  }
886
999
  }
887
- // Final progress report
888
1000
  if (onProgress && total > 0) {
889
1001
  onProgress(total, total);
890
1002
  }
@@ -899,9 +1011,7 @@ class ReferenceResolver {
899
1011
  },
900
1012
  };
901
1013
  }
902
- /** Lowercased `knownNames`, built the first time a case-insensitive language asks. */
903
1014
  knownLowerNames = null;
904
- /** `hasAnyPossibleMatch` for a language whose names ignore case: the name, or any `.`/`::`/`->` part of it. */
905
1015
  hasAnyPossibleMatchIgnoringCase(name) {
906
1016
  if (!this.knownNames)
907
1017
  return true;
@@ -915,35 +1025,26 @@ class ReferenceResolver {
915
1025
  return true;
916
1026
  return lower.split(/::|->|\./).some((part) => part.length > 0 && this.knownLowerNames.has(part));
917
1027
  }
918
- /**
919
- * Check if a reference name has any possible match in the codebase.
920
- * Uses the pre-built knownNames set to skip expensive resolution
921
- * for names that definitely don't exist as symbols.
922
- */
923
1028
  hasAnyPossibleMatch(name) {
924
1029
  if (!this.knownNames)
925
- return true; // no pre-filter available
926
- // Direct name match
927
- if (this.knownNames.has(name))
928
1030
  return true;
929
- // For qualified names like "obj.method" or "Class::method", check the parts
1031
+ const only = this.classExpressionFreeBases.has(this.context) ? this.classExpressionOnlyNames() : null;
1032
+ const known = (n) => this.knownNames.has(n) && !(only?.has(n) ?? false);
1033
+ if (known(name))
1034
+ return true;
930
1035
  const dotIdx = name.indexOf('.');
931
1036
  if (dotIdx > 0) {
932
1037
  const receiver = name.substring(0, dotIdx);
933
1038
  const member = name.substring(dotIdx + 1);
934
- if (this.knownNames.has(receiver) || this.knownNames.has(member))
1039
+ if (known(receiver) || known(member))
935
1040
  return true;
936
- // Also check capitalized receiver (instance-method resolution)
937
1041
  const capitalized = receiver.charAt(0).toUpperCase() + receiver.slice(1);
938
- if (this.knownNames.has(capitalized))
1042
+ if (known(capitalized))
939
1043
  return true;
940
- // JVM FQN: `com.example.foo.Bar` — the only useful segment is the
941
- // last one (`Bar`); the earlier check finds `example.foo.Bar` which
942
- // never matches a node name.
943
1044
  const lastDot = name.lastIndexOf('.');
944
1045
  if (lastDot > dotIdx) {
945
1046
  const tail = name.substring(lastDot + 1);
946
- if (tail && this.knownNames.has(tail))
1047
+ if (tail && known(tail))
947
1048
  return true;
948
1049
  }
949
1050
  }
@@ -951,24 +1052,15 @@ class ReferenceResolver {
951
1052
  if (colonIdx > 0) {
952
1053
  const receiver = name.substring(0, colonIdx);
953
1054
  const member = name.substring(colonIdx + 2);
954
- if (this.knownNames.has(receiver) || this.knownNames.has(member))
1055
+ if (known(receiver) || known(member))
955
1056
  return true;
956
- // Multi-segment path `a::b::c` (a Rust/C++ module call like
957
- // `database::profiles::find`) — the only segment that names a symbol is
958
- // the last (`c`); `member` above is `b::c`, which never matches a node
959
- // name, so without this the pre-filter drops the ref before the Rust path
960
- // resolver ever sees it. Mirror the dotted-name leaf check above.
961
1057
  const lastColon = name.lastIndexOf('::');
962
1058
  if (lastColon > colonIdx) {
963
1059
  const tail = name.substring(lastColon + 2);
964
- if (tail && this.knownNames.has(tail))
1060
+ if (tail && known(tail))
965
1061
  return true;
966
1062
  }
967
1063
  }
968
- // Lua/Luau method calls use a single `:` (`lg:log`); R uses `$` (`lg$log`).
969
- // Check the member (and receiver) around these separators too, so the ref
970
- // isn't dropped here before the method-call resolver ever sees it. The `:`
971
- // case is skipped when the name actually contains `::` (handled above).
972
1064
  for (const sep of [':', '$']) {
973
1065
  if (sep === ':' && name.includes('::'))
974
1066
  continue;
@@ -976,27 +1068,21 @@ class ReferenceResolver {
976
1068
  if (sepIdx > 0) {
977
1069
  const receiver = name.substring(0, sepIdx);
978
1070
  const member = name.substring(sepIdx + 1);
979
- if (this.knownNames.has(member) || this.knownNames.has(receiver))
1071
+ if (known(member) || known(receiver))
980
1072
  return true;
981
1073
  const capitalized = receiver.charAt(0).toUpperCase() + receiver.slice(1);
982
- if (this.knownNames.has(capitalized))
1074
+ if (known(capitalized))
983
1075
  return true;
984
1076
  }
985
1077
  }
986
- // For path-like references (e.g., "snippets/drawer-menu.liquid"), check the filename
987
1078
  const slashIdx = name.lastIndexOf('/');
988
1079
  if (slashIdx > 0) {
989
1080
  const fileName = name.substring(slashIdx + 1);
990
- if (this.knownNames.has(fileName))
1081
+ if (known(fileName))
991
1082
  return true;
992
1083
  }
993
1084
  return false;
994
1085
  }
995
- /**
996
- * Does `ref.referenceName` match an import declared in its containing
997
- * file? Used as a pre-filter escape so re-export chain resolution
998
- * still gets a chance when the name has no project-wide declaration.
999
- */
1000
1086
  matchesAnyImport(ref) {
1001
1087
  const imports = this.context.getImportMappings(ref.filePath, ref.language);
1002
1088
  if (imports.length === 0)
@@ -1009,116 +1095,270 @@ class ReferenceResolver {
1009
1095
  }
1010
1096
  return false;
1011
1097
  }
1012
- /**
1013
- * Resolve a single reference.
1014
- *
1015
- * Thin decorator over `resolveOneInner` so every strategy — framework,
1016
- * import, name-match, chain, CFML component path — passes through the
1017
- * inheritance target-kind gate at ONE seam. Filtering inside the
1018
- * name-matcher would have covered `matchByExactName` only.
1019
- * Calls that land on an alias binding then forward once to the callable
1020
- * the alias names (see ./alias-binding), regardless of the strategy.
1021
- */
1098
+ pythonAttrRetryCandidates(touched, ceiling = 2000) {
1099
+ const touchedSet = new Set(touched);
1100
+ const closure = this.queries.getPythonImporterClosure(touched).filter((f) => !touchedSet.has(f));
1101
+ const keyOf = (ref) => `${ref.fromNodeId}\0${ref.referenceName}`;
1102
+ const resolvable = (refs) => {
1103
+ const answers = new Map();
1104
+ return refs.filter((ref) => {
1105
+ if (!ref.filePath || !ref.language)
1106
+ return false;
1107
+ const key = keyOf(ref);
1108
+ let ok = answers.get(key);
1109
+ if (ok === undefined)
1110
+ answers.set(key, (ok = (0, name_matcher_1.pythonAttrRefResolves)(ref, this.context)));
1111
+ return ok;
1112
+ });
1113
+ };
1114
+ const candidates = this.queries.getFailedPythonAttrRefKeys(closure);
1115
+ const load = (keys) => this.queries.getUnresolvedReferencesByIds(keys.map((k) => k.id));
1116
+ if (new Set(candidates.map(keyOf)).size <= ceiling)
1117
+ return resolvable(load(candidates));
1118
+ const assigned = new Set();
1119
+ const defined = new Set();
1120
+ const subclassing = new Set();
1121
+ const calling = new Set();
1122
+ for (const file of touched) {
1123
+ const source = this.context.readFile(file);
1124
+ if (source) {
1125
+ const text = (0, strip_comments_1.stripCommentsForRegex)(source, 'python');
1126
+ for (const m of text.matchAll(/\b(?:self|cls)\.(\w+)\s*(?::[^=\n]*)?=(?!=)|^[ \t]+(\w+)\s*(?::[^=\n]*)?=(?!=)/gm)) {
1127
+ assigned.add((m[1] ?? m[2]));
1128
+ }
1129
+ }
1130
+ for (const n of this.context.getNodesInFile(file)) {
1131
+ if (n.kind === 'class' || n.kind === 'function' || n.kind === 'method')
1132
+ defined.add(n.name);
1133
+ }
1134
+ for (const f of this.queries.getPythonFilesWithEdgesInto(file, ['extends'], ['class']))
1135
+ subclassing.add(f);
1136
+ for (const f of this.queries.getPythonFilesWithEdgesInto(file, ['calls', 'instantiates'], ['function', 'method', 'class'])) {
1137
+ calling.add(f);
1138
+ }
1139
+ }
1140
+ const callees = new Map();
1141
+ const assignedCallees = (file, attr) => {
1142
+ let byAttr = callees.get(file);
1143
+ if (!byAttr) {
1144
+ byAttr = new Map();
1145
+ const source = this.context.readFile(file);
1146
+ const text = source ? (0, strip_comments_1.stripCommentsForRegex)(source, 'python') : '';
1147
+ for (const m of text.matchAll(/\b(\w+)\s*(?::[^=\n]*)?=(?!=)\s*(?:await\s+)?(?:[\w.]*\.)?(\w+)\s*\(/g)) {
1148
+ let set = byAttr.get(m[1]);
1149
+ if (!set)
1150
+ byAttr.set(m[1], (set = new Set()));
1151
+ set.add(m[2]);
1152
+ }
1153
+ callees.set(file, byAttr);
1154
+ }
1155
+ return byAttr.get(attr) ?? new Set();
1156
+ };
1157
+ const kept = candidates.filter((ref) => {
1158
+ const name = ref.referenceName;
1159
+ if (name.includes('().'))
1160
+ return defined.has(name.split('().')[0].split('.').pop());
1161
+ const segs = name.split('.');
1162
+ if (segs.length !== 3 || !segs.every((seg) => /^[A-Za-z_]\w*$/.test(seg)))
1163
+ return false;
1164
+ const attr = segs[1];
1165
+ if (assigned.has(attr))
1166
+ return true;
1167
+ if (subclassing.has(ref.filePath) && (segs[0] === 'self' || segs[0] === 'cls'))
1168
+ return true;
1169
+ return calling.has(ref.filePath) && [...assignedCallees(ref.filePath, attr)].some((c) => defined.has(c));
1170
+ });
1171
+ return new Set(kept.map(keyOf)).size <= ceiling ? resolvable(load(kept)) : null;
1172
+ }
1022
1173
  resolveOne(ref) {
1023
- // A C/C++ "call" whose name is a function-like macro visible in this
1024
- // translation unit is a macro expansion, not a call — it must never bind
1025
- // to a same-named function in another file (#1838).
1174
+ const outer = this.context;
1175
+ const unviewed = this.classExpressionFreeBases.get(outer) ?? outer;
1176
+ const base = unviewed === this.mocklessContext && this.mocklessBase ? this.mocklessBase : unviewed;
1177
+ const mockless = this.mocklessContextFor(ref, base) ?? base;
1178
+ const context = this.classExpressionFreeContextFor(ref, mockless) ?? mockless;
1179
+ this.lastResolved = { ref, context };
1180
+ return this.resolveOneWith(context, ref);
1181
+ }
1182
+ lastResolved = null;
1183
+ resolveOneWith(context, ref) {
1184
+ const outer = this.context;
1185
+ if (context === outer)
1186
+ return this.resolveOneIn(ref);
1187
+ this.context = context;
1188
+ try {
1189
+ return this.resolveOneIn(ref);
1190
+ }
1191
+ finally {
1192
+ this.context = outer;
1193
+ }
1194
+ }
1195
+ resolveOneIn(ref) {
1196
+ const byName = (0, name_matcher_1.rustChainedCallByName)(ref);
1197
+ if (byName) {
1198
+ const resolved = this.resolveOneIn(byName);
1199
+ return resolved && { ...resolved, original: ref };
1200
+ }
1026
1201
  if ((0, cpp_macro_visibility_1.isVisibleCppMacro)(ref, this.context))
1027
1202
  return null;
1028
- // A Swift type reference never lands on an `extension X {}` node, nor on a
1029
- // nested type it cannot name bare (see ./swift-type-visibility).
1030
- // A name a declaration around the reference declares as a type parameter
1031
- // (`def f[A]`, `class Foo<T>`) is that parameter (see ./type-parameters).
1032
- const candidate = (0, type_parameters_1.gateTypeParameter)((0, swift_type_visibility_1.gateSwiftTypeTarget)(this.gateTargetKind(this.resolveOneInner(ref), ref), ref, this.context), ref, this.context);
1203
+ const candidate = (0, dart_local_scope_1.gateDartLocal)((0, type_parameters_1.gateTypeParameter)((0, swift_type_visibility_1.gateSwiftTypeTarget)(this.gateTargetKind(this.resolveOneInner(ref), ref), ref, this.context), ref, this.context), ref, this.context);
1033
1204
  const scoped = this.gateRustScope(candidate, ref);
1034
- const resolved = this.gateSuperSelfCall(scoped?.resolvedBy === 'framework' ? this.gateFrameworkLanguage(scoped, ref) : this.gateLanguage(scoped, ref), ref);
1205
+ const resolved = (0, name_matcher_1.preferGoBuildTwin)(this.gateSuperSelfCall(scoped?.resolvedBy === 'framework' ? this.gateFrameworkLanguage(scoped, ref) : this.gateLanguage(scoped, ref), ref), ref, this.context);
1206
+ if (resolved && ref.language === 'dart' && ref.referenceKind === 'references' &&
1207
+ resolved.targetNodeId === ref.fromNodeId)
1208
+ return null;
1209
+ if (resolved && (0, name_matcher_1.isPythonFromImportModule)(ref, this.context)) {
1210
+ const module = this.nodeById(resolved.targetNodeId);
1211
+ if (module && module.kind !== 'file' && module.kind !== 'module')
1212
+ return null;
1213
+ }
1214
+ if (resolved && (resolved.byName || resolved.resolvedBy === 'exact-match' || resolved.resolvedBy === 'fuzzy') &&
1215
+ (0, name_matcher_1.isGuessedRecordAccessor)(resolved, ref, this.context))
1216
+ return null;
1217
+ if (resolved && (resolved.byName || resolved.resolvedBy === 'exact-match' || resolved.resolvedBy === 'fuzzy')) {
1218
+ const target = this.nodeById(resolved.targetNodeId);
1219
+ if (target && (0, name_matcher_1.crossesWorkspaceRoot)(target, ref, this.context))
1220
+ return null;
1221
+ }
1222
+ if (resolved && resolved.resolvedBy === 'import' && (0, name_matcher_1.isImportShadowedByJsBinding)(resolved, ref, this.context))
1223
+ return null;
1224
+ if (resolved && resolved.resolvedBy !== 'import') {
1225
+ const specifier = (0, ambient_modules_1.ambientModuleDeclarations)(this.context).get(resolved.targetNodeId);
1226
+ const declaringFile = specifier === undefined ? undefined : this.nodeById(resolved.targetNodeId)?.filePath;
1227
+ if (declaringFile !== undefined && declaringFile !== ref.filePath &&
1228
+ !(0, import_resolver_1.reachesAmbientModule)(ref, specifier, declaringFile, this.context))
1229
+ return null;
1230
+ }
1035
1231
  if (!resolved || ref.referenceKind !== 'calls')
1036
1232
  return resolved;
1037
- const target = this.nodeById(resolved.targetNodeId);
1233
+ const call = ref.language === 'pascal' ? (0, pascal_scope_1.gatePascalCall)(resolved, ref, this.context) : resolved;
1234
+ if (!call)
1235
+ return null;
1236
+ const target = this.nodeById(call.targetNodeId);
1038
1237
  if (!target)
1039
- return resolved;
1238
+ return call;
1040
1239
  const dot = ref.referenceName.lastIndexOf('.');
1041
1240
  const memberName = dot >= 0 ? ref.referenceName.slice(dot + 1) : null;
1042
1241
  const forwarded = (0, alias_binding_1.resolveAliasBinding)(target, memberName, this.context);
1043
- if (!forwarded || forwarded.id === resolved.targetNodeId)
1044
- return resolved;
1242
+ if (!forwarded || forwarded.id === call.targetNodeId)
1243
+ return call;
1045
1244
  return this.gateLanguage({
1046
- ...resolved,
1245
+ ...call,
1047
1246
  targetNodeId: forwarded.id,
1048
- confidence: Math.min(resolved.confidence, 0.85),
1247
+ confidence: Math.min(call.confidence, 0.85),
1049
1248
  }, ref);
1050
1249
  }
1051
1250
  resolveOneInner(ref) {
1052
- // A local C++ object construction (`T obj(args)`, ref `ns::T::T/1`)
1053
- // resolves ONLY to a constructor of the lexically nearest `T` (#1839).
1054
1251
  if ((0, cpp_constructor_1.isCppConstructorRef)(ref))
1055
1252
  return (0, cpp_constructor_1.matchCppConstructor)(ref, this.context);
1056
- // Skip built-in/external references
1253
+ if ((0, cpp_supertypes_1.isCppSupertypeRef)(ref))
1254
+ return (0, cpp_supertypes_1.matchCppSupertype)(ref, this.context);
1255
+ if ((0, cpp_supertypes_1.isCppDeclaredTypeRef)(ref, this.context))
1256
+ return (0, cpp_supertypes_1.matchCppDeclaredType)(ref, this.context);
1257
+ if ((0, name_matcher_2.isObjcDeclaredTypeRef)(ref))
1258
+ return (0, name_matcher_2.matchByExactName)(ref, this.context);
1259
+ if ((0, pascal_scope_1.isPascalParenlessRef)(ref))
1260
+ return (0, pascal_scope_1.matchPascalParenlessRef)(ref, this.context);
1261
+ if ((0, pascal_scope_1.isPascalSystemCall)(ref, this.context))
1262
+ return (0, pascal_scope_1.matchPascalSystemCall)(ref, this.context);
1263
+ const nested = (0, pascal_scope_1.matchPascalNestedCall)(ref, this.context);
1264
+ if (nested)
1265
+ return nested;
1266
+ if ((0, name_matcher_1.isDartMemberRead)(ref))
1267
+ return (0, name_matcher_1.matchDartMemberRead)(ref, this.context);
1268
+ if ((0, name_matcher_1.isDartChainLink)(ref, this.context))
1269
+ return (0, name_matcher_1.matchDartChainLink)(ref, this.context);
1270
+ if ((0, name_matcher_1.isDartAnnotation)(ref))
1271
+ return (0, name_matcher_1.matchDartAnnotation)(ref, this.context);
1272
+ const asserted = (0, name_matcher_1.matchGoAssertedCall)(ref, this.context);
1273
+ if (asserted !== undefined)
1274
+ return asserted;
1275
+ const indexed = (0, name_matcher_1.matchGoIndexedCall)(ref, this.context);
1276
+ if (indexed !== undefined)
1277
+ return indexed;
1278
+ const chained = (0, name_matcher_1.matchGoChainedCall)(ref, this.context);
1279
+ if (chained !== undefined)
1280
+ return chained;
1281
+ const themeFile = (0, shopify_themes_1.matchShopifyThemeFile)(ref, this.context);
1282
+ if (themeFile !== undefined)
1283
+ return themeFile;
1284
+ const superCall = (0, js_super_calls_1.matchJsSuperCall)(ref, this.context);
1285
+ if (superCall !== undefined)
1286
+ return superCall;
1287
+ if (ref.language === 'kotlin' && ref.referenceKind === 'calls') {
1288
+ const root = ref.referenceName.slice(0, ref.referenceName.indexOf('.'));
1289
+ if (root && this.context.getImportMappings(ref.filePath, ref.language).some((m) => m.localName === root)) {
1290
+ const viaImport = this.gateLanguage((0, import_resolver_1.resolveViaImport)(ref, this.context), ref);
1291
+ if (viaImport)
1292
+ return viaImport;
1293
+ }
1294
+ const chain = (0, name_matcher_1.matchKotlinReceiverChain)(ref, this.context);
1295
+ if (chain && 'method' in chain) {
1296
+ const bare = this.resolveOneInner({ ...ref, referenceName: chain.method });
1297
+ return bare ? { ...bare, original: ref } : null;
1298
+ }
1299
+ if (chain !== undefined)
1300
+ return this.gateLanguage(chain, ref);
1301
+ }
1057
1302
  if (this.isBuiltInOrExternal(ref)) {
1058
- return null;
1303
+ return this.isPythonBuiltinNamedMethodCall(ref)
1304
+ ? this.gateLanguage((0, name_matcher_1.matchPythonTypedLocalCall)(ref, this.context), ref)
1305
+ : null;
1059
1306
  }
1060
- // CFML component paths in inheritance (#1152): `extends="coldbox.system.web.
1061
- // Controller"` names the supertype by its dot-separated path (or `extends=
1062
- // "../base"` by relative file path) — the graph indexes the class under its
1063
- // final segment only, so these die at the fast pre-filter below and never
1064
- // resolved. Handled by a dedicated path-corroborated matcher, gated to
1065
- // inheritance refs only (a dotted `calls` ref is a member-access chain, not
1066
- // a component path). No fallthrough on miss: the full path string can only
1067
- // ever mis-match downstream, and an unresolvable supertype usually lives in
1068
- // an out-of-repo library (mxunit, testbox) — silent beats wrong.
1069
1307
  if ((ref.language === 'cfml' || ref.language === 'cfscript') &&
1070
1308
  (ref.referenceKind === 'extends' || ref.referenceKind === 'implements') &&
1071
1309
  (ref.referenceName.includes('.') || ref.referenceName.includes('/'))) {
1072
1310
  return this.resolveCfmlComponentPath(ref);
1073
1311
  }
1074
- // A PHP class written with a namespace in it — `new Alias\X()` through a
1075
- // `use Ns as Alias;` namespace alias, `extends Sub\Base`, `\Ns\X::make()`
1076
- // (#2256). The pre-filter below would drop most of these before any import
1077
- // strategy ran, and PHP gives each one exactly one meaning; resolve it first.
1312
+ if (ref.language === 'cfml' || ref.language === 'cfscript') {
1313
+ if (ref.referenceKind === 'instantiates' && ref.referenceName.includes('.'))
1314
+ return this.resolveCfmlComponentPath(ref);
1315
+ if (ref.referenceKind === 'calls' && CFML_CONSTRUCTED_CALL.test(ref.referenceName))
1316
+ return this.resolveCfmlConstructedCall(ref);
1317
+ }
1318
+ if ((ref.language === 'cfml' || ref.language === 'cfscript') && ref.referenceKind === 'imports' && isCfmlTemplatePath(ref.referenceName)) {
1319
+ const included = this.resolveCfmlIncludePath(ref) ?? (0, name_matcher_1.matchByFilePath)(ref, this.context);
1320
+ if (included && this.nodeById(included.targetNodeId)?.filePath === ref.filePath)
1321
+ return null;
1322
+ return this.gateLanguage(included, ref);
1323
+ }
1078
1324
  const phpQualified = (0, import_resolver_1.resolvePhpQualifiedClassRef)(ref, this.context);
1079
1325
  if (phpQualified !== undefined)
1080
1326
  return this.gateLanguage(phpQualified, ref);
1081
- // Fast pre-filter: skip if no symbol with this name exists anywhere
1082
- // AND the name doesn't match a local import. The import escape is
1083
- // necessary because re-export rename chains (`import { login }
1084
- // from './barrel'` where the barrel has `export { signIn as login }
1085
- // from './auth'`) intentionally call a name that has no
1086
- // declaration anywhere — only the renamed upstream symbol does.
1087
- // ArkTS chained-attribute refs carry a leading dot (`.titleStyle`) that
1088
- // routes them to the decorator-gated matcher; the symbol itself is
1089
- // indexed under the bare name, so the existence check strips the dot.
1090
- // Nix static path imports (`import ./x.nix`) and JS/TS module paths
1091
- // (`require('./x')`) name a FILE, not a symbol — they bypass the
1092
- // symbol-existence check and resolve via resolveViaImport.
1327
+ const rubyPath = (0, ruby_constant_paths_1.matchRubyConstantPathRef)(ref, this.context);
1328
+ if (rubyPath !== undefined)
1329
+ return this.gateLanguage(rubyPath, ref);
1330
+ const rustBound = (0, name_matcher_1.matchRustUseBoundName)(ref, this.context);
1331
+ if (rustBound !== undefined)
1332
+ return this.gateLanguage(rustBound, ref);
1093
1333
  let existenceName = ref.language === 'arkts' && ref.referenceName.startsWith('.')
1094
1334
  ? ref.referenceName.slice(1)
1095
1335
  : ref.referenceName;
1096
- // Erlang refs carry the call-site arity (`f/1`, `mod::f/2` — #1610); the
1097
- // name index stores bare names, so existence is checked arity-less.
1098
1336
  if (ref.language === 'erlang')
1099
1337
  existenceName = existenceName.replace(/\/\d{1,3}$/, '');
1338
+ if ((ref.language === 'cpp' || ref.language === 'c') && existenceName.startsWith('::')) {
1339
+ existenceName = existenceName.slice(2);
1340
+ }
1100
1341
  const tPre = this.profileStages ? process.hrtime.bigint() : 0n;
1101
1342
  const preFilterPass = (0, import_resolver_1.isNixPathImportRef)(ref) ||
1102
1343
  (0, import_resolver_1.isJsPathImportRef)(ref) ||
1103
1344
  this.hasAnyPossibleMatch(existenceName) ||
1104
- // PHP, Pascal, CFML, COBOL and VB.NET names ignore case: `formatprice()`
1105
- // calls `FormatPrice`, which the exact-name set never lists.
1106
1345
  (name_matcher_1.CASE_INSENSITIVE_LANGUAGES.has(ref.language) && this.hasAnyPossibleMatchIgnoringCase(existenceName)) ||
1107
1346
  this.matchesAnyImport(ref) ||
1108
- this.frameworks.some((f) => f.claimsReference?.(ref.referenceName));
1347
+ this.frameworksFor(ref.language).some((f) => f.claimsReference?.(ref.referenceName));
1109
1348
  if (this.profileStages)
1110
1349
  this.stageAdd('preFilter', ref, preFilterPass, tPre);
1111
1350
  if (!preFilterPass) {
1112
1351
  return this.gateLanguage((0, name_matcher_1.matchJsStoreBindingCall)(ref, this.context), ref);
1113
1352
  }
1114
- // Function-as-value refs (#756) get a dedicated, strictly-gated path:
1115
- // import-based resolution first (an imported callback resolves through its
1116
- // import, the most precise cross-file signal), then matchFunctionRef
1117
- // (same-file first, unique-only cross-file, function/method targets only).
1118
- // They never reach the framework or fuzzy strategies below.
1353
+ if ((0, vbnet_receivers_1.isVbMemberRead)(ref))
1354
+ return this.gateLanguage((0, vbnet_receivers_1.matchVbMemberRead)(ref, this.context), ref);
1355
+ if ((0, vbnet_receivers_1.isVbPathCall)(ref)) {
1356
+ return this.gateLanguage((0, vbnet_receivers_1.matchVbPathCall)(ref, this.context, (name) => (0, name_matcher_1.isStdMethodName)('vbnet', name)), ref);
1357
+ }
1358
+ const tsQualified = (0, import_resolver_1.resolveTsQualifiedTypeRef)(ref, this.context);
1359
+ if (tsQualified !== undefined)
1360
+ return this.gateLanguage(tsQualified, ref);
1119
1361
  if (ref.referenceKind === 'function_ref') {
1120
- // `this.<member>` values (TS/JS) resolve ONLY against the enclosing
1121
- // class's own members — never a same-named symbol elsewhere.
1122
1362
  if (ref.referenceName.startsWith('this.')) {
1123
1363
  return this.gateLanguage(this.resolveThisMemberFnRef(ref), ref);
1124
1364
  }
@@ -1131,55 +1371,35 @@ class ReferenceResolver {
1131
1371
  if (target &&
1132
1372
  (target.kind === 'function' ||
1133
1373
  target.kind === 'method' ||
1134
- // Python (#1478): an imported class used as a value (`return
1135
- // OrgSerializerFull`) resolves through its import like any
1136
- // callback — mirrors matchFunctionRef's bareClassOk.
1137
1374
  (ref.language === 'python' && target.kind === 'class'))) {
1138
1375
  return viaImport;
1139
1376
  }
1140
1377
  }
1141
1378
  return this.gateLanguage((0, name_matcher_1.matchFunctionRef)(ref, this.context), ref);
1142
1379
  }
1143
- // JVM FQN imports skip framework/name-matcher: `import com.example.Bar`
1144
- // resolves directly through the qualifiedName index, which is unambiguous
1145
- // even when several `Bar` classes exist in different packages.
1146
1380
  const tJvm = this.profileStages ? process.hrtime.bigint() : 0n;
1147
1381
  const jvmImport = (0, import_resolver_1.resolveJvmImport)(ref, this.context);
1148
1382
  if (this.profileStages)
1149
1383
  this.stageAdd('jvmImport', ref, !!jvmImport, tJvm);
1150
1384
  if (jvmImport)
1151
1385
  return jvmImport;
1152
- // Razor/Blazor: a markup or `@code` type ref resolves through the file's
1153
- // `@using` namespaces (incl. folder `_Imports.razor`). This precisely
1154
- // disambiguates a simple name that exists in several namespaces — e.g.
1155
- // `CatalogBrand` resolving to `BlazorShared.Models::CatalogBrand` (the DTO,
1156
- // which the `.razor` `@using`s) rather than the same-named domain entity.
1157
1386
  if (ref.language === 'razor') {
1158
1387
  const razorResult = this.resolveRazorUsing(ref);
1159
1388
  if (razorResult)
1160
1389
  return razorResult;
1161
1390
  }
1162
- // An explicit PHP class import owns its static calls, including an
1163
- // unavailable method. Do not let same-name fallbacks change the receiver
1164
- // to an unrelated Service/Repository type (#1545).
1165
1391
  const phpStaticImport = (0, import_resolver_1.resolvePhpImportedStaticCall)(ref, this.context);
1166
1392
  if (phpStaticImport !== undefined)
1167
1393
  return this.gateLanguage(phpStaticImport, ref);
1168
1394
  const candidates = [];
1169
- // Strategy 1: Try framework-specific resolution. Cross-language bridges
1170
- // are deliberately preserved (Drupal `routing.yml` → PHP controller, RN
1171
- // JS → native `calls`); other code references obey the shared family gate.
1172
1395
  const tFw = this.profileStages ? process.hrtime.bigint() : 0n;
1173
1396
  let fwEarly = null;
1174
- for (const framework of this.frameworks) {
1397
+ for (const framework of this.frameworksFor(ref.language)) {
1175
1398
  const resolved = this.gateFrameworkLanguage(framework.resolve(ref, this.context), ref);
1176
- // Name the resolver on the edge (`metadata.framework`): a Swift→ObjC or
1177
- // React Native bridge hop says how it got into the graph, as a
1178
- // synthesized edge's `synthesizedBy` does.
1179
1399
  const result = resolved ? { ...resolved, metadata: { ...resolved.metadata, framework: framework.name } } : null;
1180
1400
  if (result) {
1181
1401
  if (result.confidence >= 0.9) {
1182
- fwEarly = result; // High confidence, return immediately (below)
1402
+ fwEarly = result;
1183
1403
  break;
1184
1404
  }
1185
1405
  candidates.push(result);
@@ -1189,34 +1409,34 @@ class ReferenceResolver {
1189
1409
  this.stageAdd('frameworks', ref, fwEarly !== null, tFw);
1190
1410
  if (fwEarly)
1191
1411
  return fwEarly;
1192
- // A retained untyped chain supplies effect/call-site evidence only. In
1193
- // particular, importing its root does not make the root its call target.
1194
- // A path through module namespaces is not untyped: `z.coerce.number()`
1195
- // after `import * as z`, where the barrel has `export * as coerce`.
1412
+ if (this.frameworksFor(ref.language).some((f) => f.ownsReference?.(ref, this.context))) {
1413
+ return candidates.length > 0
1414
+ ? candidates.reduce((best, curr) => (curr.confidence > best.confidence ? curr : best))
1415
+ : null;
1416
+ }
1196
1417
  if ((0, name_matcher_1.isUnresolvedJsMemberCall)(ref)) {
1197
1418
  const root = ref.referenceName.slice(0, ref.referenceName.indexOf('.'));
1198
1419
  const namespace = this.context.getImportMappings(ref.filePath, ref.language).some((m) => m.isNamespace && m.localName === root);
1199
1420
  if (!namespace)
1200
- return null;
1421
+ return this.gateLanguage((0, name_matcher_1.matchObjectPathCall)(ref, this.context), ref);
1201
1422
  const viaNamespace = this.gateLanguage((0, import_resolver_1.resolveViaImport)(ref, this.context), ref);
1202
1423
  const target = viaNamespace ? this.nodeById(viaNamespace.targetNodeId) : null;
1203
1424
  return target && (target.kind === 'function' || target.kind === 'method' || target.kind === 'class' || target.kind === 'constant' || target.kind === 'variable')
1204
1425
  ? viaNamespace : null;
1205
1426
  }
1206
- // Strategy 2: Try import-based resolution
1207
- // A TS/JS/Python call-receiver chain (`useStore.getState().reset`, #1683)
1208
- // names the ROOT's import, not the method's: letting resolveViaImport see
1209
- // it binds the call to the imported store constant and the method is
1210
- // never looked up. The name-matcher owns the chain shape for these
1211
- // languages — the Java/Kotlin/C++ chains keep their existing path.
1212
1427
  if (ref.referenceKind === 'calls' &&
1213
1428
  CHAIN_SHAPE.test(ref.referenceName) &&
1214
1429
  (ref.language === 'typescript' || ref.language === 'javascript' || ref.language === 'tsx' || ref.language === 'jsx' || ref.language === 'python')) {
1215
- return this.gateLanguage((0, name_matcher_1.matchReference)(ref, this.context), ref);
1430
+ const chainResult = this.gateLanguage((0, name_matcher_1.matchReference)(ref, this.context), ref);
1431
+ if (!chainResult && name_matcher_1.NEW_RECEIVER_SHAPE.test(ref.referenceName)) {
1432
+ const cls = (0, name_matcher_1.newReceiverClass)(ref, this.context);
1433
+ if (cls && this.context.getNodesByName(cls).some((n) => n.kind === 'class' && (0, name_matcher_1.sameLanguageFamily)(n.language, ref.language))) {
1434
+ this.deferReference(ref, this.deferredChainRefs);
1435
+ }
1436
+ }
1437
+ return chainResult;
1216
1438
  }
1217
1439
  const tImp = this.profileStages ? process.hrtime.bigint() : 0n;
1218
- // `self.get_ip()` is a method call on the instance even when the file
1219
- // also imports a function named `get_ip`: the import never names it.
1220
1440
  const selfCall = ref.language === 'python' && ref.referenceKind === 'calls' &&
1221
1441
  this.context.getImportMappings(ref.filePath, ref.language).some((m) => m.localName === ref.referenceName) &&
1222
1442
  (0, name_matcher_1.isPythonSelfCall)(ref, this.context);
@@ -1228,38 +1448,17 @@ class ReferenceResolver {
1228
1448
  return importResult;
1229
1449
  candidates.push(importResult);
1230
1450
  }
1231
- // PHP include/require paths resolve to files via import resolution only.
1232
- // If that didn't find the file, do NOT fall back to the symbol
1233
- // name-matcher — it would mis-connect e.g. "inc/db.php" to an unrelated
1234
- // db.php elsewhere in the tree (a wrong edge is worse than none, #660).
1235
- // Terraform refs are directory-scoped by language semantics — the
1236
- // framework resolver IS the whole rulebook (`var.X` can never legally
1237
- // bind outside its module directory), so the name-matcher's
1238
- // qualified-name fallback would only ever add wrong cross-module edges.
1239
- // Nix static path imports are file references for the same reason —
1240
- // falling through would let "./x.nix" name-match an unrelated node.
1241
- if ((0, import_resolver_1.isPhpIncludePathRef)(ref) || (0, import_resolver_1.isCobolCopybookRef)(ref) || (0, import_resolver_1.isNixPathImportRef)(ref) || ref.language === 'terraform') {
1451
+ if ((0, import_resolver_1.isPhpIncludePathRef)(ref) || (0, import_resolver_1.isCobolCopybookRef)(ref) || (0, import_resolver_1.isNixPathImportRef)(ref) || (0, import_resolver_1.isDartImportRef)(ref) || (0, import_resolver_1.isLuaRequireRef)(ref) || ref.language === 'terraform') {
1242
1452
  return candidates.length > 0
1243
1453
  ? candidates.reduce((best, curr) => curr.confidence > best.confidence ? curr : best)
1244
1454
  : null;
1245
1455
  }
1246
- // Strategy 3: Try name matching
1247
1456
  const tName = this.profileStages ? process.hrtime.bigint() : 0n;
1248
1457
  let nameResult = this.gateLanguage((0, name_matcher_1.matchReference)(ref, this.context), ref);
1249
1458
  if (this.profileStages)
1250
1459
  this.stageAdd('nameMatch', ref, !!nameResult, tName);
1251
- // Nix has no ambient cross-file namespace — a callee binds lexically
1252
- // (same file) or through explicit import/callPackage wiring (the import
1253
- // path above). A cross-file name match is wrong by construction: every
1254
- // module `inherit (lib) mkOption`s the same nixpkgs helpers, so the
1255
- // matcher would link each `mkOption` call to whichever file's inherit
1256
- // binding it happened to pick. Same-file matches only.
1257
1460
  if (nameResult) {
1258
1461
  const target = this.nodeById(nameResult.targetNodeId);
1259
- // A definition its language makes file-local — a C `static`, a Kotlin
1260
- // `private fun`, a Go unexported name in another package, a Rust
1261
- // non-`pub` item outside its module subtree — cannot be what a name in
1262
- // another file means, whichever strategy chose it (#1730).
1263
1462
  if (target && !(0, name_matcher_1.isVisibleAcrossFiles)(target, ref, this.context)) {
1264
1463
  nameResult = null;
1265
1464
  }
@@ -1269,10 +1468,6 @@ class ReferenceResolver {
1269
1468
  }
1270
1469
  }
1271
1470
  else if (target && target.language === 'nix') {
1272
- // The reverse direction is just as impossible: no other language can
1273
- // symbolically call into a .nix binding (interop is eval/CLI, never a
1274
- // linkable symbol) — without this, a Python script's `split()` lands
1275
- // on some module's `split = ...` binding as a low-confidence match.
1276
1471
  nameResult = null;
1277
1472
  }
1278
1473
  }
@@ -1280,41 +1475,24 @@ class ReferenceResolver {
1280
1475
  candidates.push(nameResult);
1281
1476
  }
1282
1477
  if (candidates.length === 0) {
1283
- // Defer a chained static-factory/fluent call the first pass couldn't
1284
- // resolve — its method may live on a supertype the receiver conforms to,
1285
- // resolvable once implements/extends edges exist (the conformance pass).
1286
1478
  if (ref.referenceKind === 'calls' &&
1287
1479
  CHAIN_LANGUAGES.has(ref.language) &&
1288
1480
  CHAIN_SHAPE.test(ref.referenceName)) {
1289
1481
  this.deferReference(ref, this.deferredChainRefs);
1290
1482
  }
1291
- else if (
1292
- // PHP `$this->prop->method()` (encoded `this->prop.method`): its method
1293
- // may live on the property's declared supertype, resolvable only once
1294
- // implements/extends edges exist — defer to the same conformance pass.
1295
- ref.referenceKind === 'calls' &&
1483
+ else if (ref.referenceKind === 'calls' &&
1296
1484
  ref.language === 'php' &&
1297
1485
  PHP_PROP_SHAPE.test(ref.referenceName)) {
1298
1486
  this.deferReference(ref, this.deferredChainRefs);
1299
1487
  }
1300
1488
  return null;
1301
1489
  }
1302
- // Return highest confidence candidate
1303
1490
  return candidates.reduce((best, curr) => curr.confidence > best.confidence ? curr : best);
1304
1491
  }
1305
- /**
1306
- * Create edges from resolved references
1307
- */
1308
1492
  createEdges(resolved) {
1309
1493
  return resolved.flatMap((ref) => {
1310
- // `function_ref` (#756) is internal-only: it persists as a `references`
1311
- // edge (the registration site depends on the callback), distinguishable
1312
- // by metadata.resolvedBy === 'function-ref'. callers/impact already
1313
- // traverse `references`, so registration sites surface with no
1314
- // graph-layer changes.
1315
1494
  let kind = ref.edgeKind ??
1316
1495
  (ref.original.referenceKind === 'function_ref' ? 'references' : ref.original.referenceKind);
1317
- // Promote "extends" to "implements" when a class/struct targets an interface
1318
1496
  if (kind === 'extends') {
1319
1497
  const targetNode = this.nodeById(ref.targetNodeId);
1320
1498
  if (targetNode && (targetNode.kind === 'interface' || targetNode.kind === 'protocol')) {
@@ -1324,11 +1502,17 @@ class ReferenceResolver {
1324
1502
  }
1325
1503
  }
1326
1504
  }
1327
- // Promote "calls" to "instantiates" when the resolved target is a
1328
- // class/struct/union. Languages without a `new` keyword (Python, Ruby)
1329
- // express instantiation as `Foo()` — extraction can't tell that
1330
- // apart from a function call without symbol info, but resolution
1331
- // can: if `Foo` resolves to a class, the call IS an instantiation.
1505
+ if (kind === 'calls' && ref.original.language === 'go') {
1506
+ const targetNode = this.nodeById(ref.targetNodeId);
1507
+ if (targetNode && name_matcher_1.GO_TYPE_KINDS.has(targetNode.kind))
1508
+ kind = 'references';
1509
+ }
1510
+ if (kind === 'calls' &&
1511
+ ref.original.language === 'pascal' &&
1512
+ !ref.original.referenceName.includes('.') &&
1513
+ PASCAL_CAST_TARGET_KINDS.has(this.nodeById(ref.targetNodeId)?.kind ?? '')) {
1514
+ kind = 'references';
1515
+ }
1332
1516
  if (kind === 'calls') {
1333
1517
  const targetNode = this.nodeById(ref.targetNodeId);
1334
1518
  if (targetNode &&
@@ -1336,9 +1520,6 @@ class ReferenceResolver {
1336
1520
  kind = 'instantiates';
1337
1521
  }
1338
1522
  }
1339
- // One reference can name several targets — a navigation whose
1340
- // destination is a conditional reaches every arm. Each becomes its own
1341
- // edge, sharing this resolution's kind and confidence.
1342
1523
  const targets = [
1343
1524
  { targetNodeId: ref.targetNodeId, metadata: ref.metadata },
1344
1525
  ...(ref.alsoTargets ?? []),
@@ -1353,36 +1534,13 @@ class ReferenceResolver {
1353
1534
  ...(t.metadata ?? {}),
1354
1535
  confidence: ref.confidence,
1355
1536
  resolvedBy: ref.resolvedBy,
1356
- // The ORIGINAL reference text (and kind, when edge-kind promotion
1357
- // rewrote it — calls→instantiates, extends→implements,
1358
- // function_ref→references). If this edge's target is later removed
1359
- // by a re-index, the edge is resurrected as exactly this ref and
1360
- // re-resolved (#1240 removal case) — a faithful resurrection, so
1361
- // re-resolution can never bind anywhere a full re-index wouldn't.
1362
- // Reconstruction from the target node's name instead would strip
1363
- // receiver/qualifier context (`h.greet` → `greet`) and risk a
1364
- // wrong rebind; edges without refName (pre-#1240, synthesized) are
1365
- // deliberately NOT resurrected for the same reason.
1366
1537
  refName: ref.original.referenceName,
1367
1538
  ...(ref.original.referenceKind !== kind ? { refKind: ref.original.referenceKind } : {}),
1368
- // Uniform marker for function-as-value edges (#756), regardless of
1369
- // which strategy resolved them (import vs matchFunctionRef) — lets
1370
- // tooling label "callback registration" and lets validation diff
1371
- // exactly the edges this feature added.
1372
1539
  ...(ref.original.referenceKind === 'function_ref' ? { fnRef: true } : {}),
1373
1540
  },
1374
1541
  }));
1375
1542
  });
1376
1543
  }
1377
- /**
1378
- * Split resolved refs into rows deletable by id and hand-built refs that
1379
- * must fall back to the key-tuple delete. Rows loaded from the database
1380
- * carry their row id and are deleted by exactly that id; the key tuple
1381
- * omits line/col, so it also removes SIBLING rows — the same caller calling
1382
- * the same callee at other lines — that a later batch hadn't attempted yet:
1383
- * when a batch boundary split a caller's same-named call sites, the later
1384
- * sites' edges were silently never created (#1269).
1385
- */
1386
1544
  static partitionResolvedCleanup(resolved) {
1387
1545
  const rowIds = [];
1388
1546
  const legacyKeys = [];
@@ -1398,29 +1556,29 @@ class ReferenceResolver {
1398
1556
  }
1399
1557
  return { rowIds, legacyKeys };
1400
1558
  }
1401
- /**
1402
- * Same row-id precision for parking unresolvable refs as status='failed'
1403
- * (#1240): the key-tuple fallback would flip same-key sibling rows in later
1404
- * batches to 'failed' before they were ever attempted, and resolution
1405
- * outcome can differ per call site (receiver-type inference reads the
1406
- * ref's line), so a sibling must not inherit this row's failure (#1269).
1407
- */
1408
1559
  static partitionFailedCleanup(unresolved) {
1409
1560
  const byRowId = [];
1410
1561
  const legacyKeys = [];
1411
1562
  for (const r of unresolved) {
1412
1563
  if (r.rowId != null)
1413
- byRowId.push({ rowId: r.rowId, referenceName: r.referenceName });
1564
+ byRowId.push({ rowId: r.rowId, referenceName: r.referenceName, referenceKind: r.referenceKind, nameTail: r.nameTail });
1414
1565
  else
1415
1566
  legacyKeys.push({
1416
1567
  fromNodeId: r.fromNodeId,
1417
1568
  referenceName: r.referenceName,
1418
1569
  referenceKind: r.referenceKind,
1570
+ nameTail: r.nameTail,
1419
1571
  });
1420
1572
  }
1421
1573
  return { byRowId, legacyKeys };
1422
1574
  }
1423
- /** A deferred attempt is unfinished work, not a final failure (#1577). */
1575
+ parkable(ref) {
1576
+ const read = this.lastResolved?.ref === ref ? this.lastResolved.context : this.context;
1577
+ const tail = (0, import_resolver_1.importBindingTail)(ref, this.context, read);
1578
+ if (tail)
1579
+ ref.nameTail = tail;
1580
+ return ref;
1581
+ }
1424
1582
  nonDeferredFailures(unresolved) {
1425
1583
  return unresolved.filter((ref) => ref.rowId == null || !this.deferredRowIds.has(ref.rowId));
1426
1584
  }
@@ -1429,9 +1587,6 @@ class ReferenceResolver {
1429
1587
  if (ref.rowId != null)
1430
1588
  this.deferredRowIds.add(ref.rowId);
1431
1589
  }
1432
- /**
1433
- * Resolve and persist edges to database
1434
- */
1435
1590
  resolveAndPersist(unresolvedRefs, onProgress) {
1436
1591
  const prerequisites = unresolvedRefs.filter(ReferenceResolver.isPrerequisite);
1437
1592
  if (prerequisites.length > 0 && prerequisites.length < unresolvedRefs.length) {
@@ -1440,27 +1595,15 @@ class ReferenceResolver {
1440
1595
  return ReferenceResolver.mergeResults(first, rest);
1441
1596
  }
1442
1597
  const result = this.resolveAll(unresolvedRefs, onProgress);
1443
- // Create edges from resolved references
1444
1598
  const edges = this.createEdges(result.resolved);
1445
- // Insert edges into database
1446
1599
  if (edges.length > 0) {
1447
1600
  this.queries.insertEdges(edges);
1448
1601
  }
1449
- // Clean up resolved refs from unresolved_refs table so metrics are accurate
1450
1602
  if (result.resolved.length > 0) {
1451
1603
  const { rowIds, legacyKeys } = ReferenceResolver.partitionResolvedCleanup(result.resolved);
1452
1604
  this.queries.deleteReferencesByRowIds(rowIds);
1453
1605
  this.queries.deleteSpecificResolvedReferences(legacyKeys);
1454
1606
  }
1455
- // Park unresolvable refs as status='failed' — parity with
1456
- // resolveAndPersistBatched. Deleting them was wrong (#1240): a ref whose
1457
- // own file never changes is otherwise gone forever, so when a DIFFERENT
1458
- // file later gains the export/symbol that would satisfy it, no sync can
1459
- // recreate the edge — only a full re-index. Failed rows are excluded from
1460
- // the pending readers, which preserves the #1187 orphan sweep's
1461
- // invariant in status form: after a COMPLETED pass nothing it processed
1462
- // is still 'pending', so any pending row at rest belongs to an
1463
- // interrupted run and the sweep can key off the pending count.
1464
1607
  if (result.unresolved.length > 0) {
1465
1608
  const { byRowId, legacyKeys } = ReferenceResolver.partitionFailedCleanup(this.nonDeferredFailures(result.unresolved));
1466
1609
  this.queries.markReferencesFailedByRowIds(byRowId);
@@ -1468,15 +1611,6 @@ class ReferenceResolver {
1468
1611
  }
1469
1612
  return result;
1470
1613
  }
1471
- /**
1472
- * Yielding counterpart of {@link resolveAndPersist} for a caller-supplied
1473
- * ref list — used by sync's failed-ref retry pass (#1240). Same persistence
1474
- * semantics: resolved refs become edges and their rows are deleted;
1475
- * still-unresolvable refs are (re-)marked failed (a no-op for rows already
1476
- * in that status). Yields per-ref because sync can run on the daemon's
1477
- * liveness-watchdog thread (#850/#1091) and a retry set is unbounded when
1478
- * a large edit lands many popular symbol names at once.
1479
- */
1480
1614
  async resolveAndPersistListYielding(refs) {
1481
1615
  const prerequisites = refs.filter(ReferenceResolver.isPrerequisite);
1482
1616
  if (prerequisites.length > 0 && prerequisites.length < refs.length) {
@@ -1516,7 +1650,6 @@ class ReferenceResolver {
1516
1650
  }
1517
1651
  return edges.length;
1518
1652
  }
1519
- /** Finalize the durable queue only AFTER its edges have been inserted. */
1520
1653
  async persistDeferredReferences(deferred, resolved) {
1521
1654
  for (const ref of deferred)
1522
1655
  if (ref.rowId != null)
@@ -1532,7 +1665,6 @@ class ReferenceResolver {
1532
1665
  this.clearCaches();
1533
1666
  return count;
1534
1667
  }
1535
- /** Same two phases as the bounded DB reader: persist wiring before calls. */
1536
1668
  static isPrerequisite(ref) {
1537
1669
  return ref.referenceKind === 'imports' || ref.referenceKind === 'extends' || ref.referenceKind === 'implements';
1538
1670
  }
@@ -1552,43 +1684,22 @@ class ReferenceResolver {
1552
1684
  },
1553
1685
  };
1554
1686
  }
1555
- /**
1556
- * Second resolution pass for chained static-factory / fluent calls whose
1557
- * chained method is defined on a SUPERTYPE the receiver's type conforms to —
1558
- * a protocol-extension / inherited / default-interface method (#750). The
1559
- * first pass can't resolve these because `implements`/`extends` edges aren't
1560
- * built yet; this runs AFTER edges are persisted, so `context.getSupertypes`
1561
- * (and the conformance fallback in resolveMethodOnType) can walk them.
1562
- *
1563
- * Operates only on the leftover unresolved refs that have the `inner().method`
1564
- * chain shape, for the dotted-chain languages — a small set — and is idempotent
1565
- * (re-resolving an already-resolved ref is a no-op since it's been deleted).
1566
- * Returns the number of newly-created edges.
1567
- */
1568
1687
  async resolveChainedCallsViaConformance() {
1569
1688
  const deferred = this.deferredChainRefs;
1570
1689
  this.deferredChainRefs = [];
1571
1690
  if (deferred.length === 0)
1572
1691
  return 0;
1573
- // Read fresh edges (the main pass built the implements/extends edges after
1574
- // these refs were deferred). matchDottedCallChain now resolves a method on a
1575
- // supertype via context.getSupertypes -> resolveMethodOnType's conformance walk.
1576
1692
  this.clearCaches();
1577
- // This post-pass runs synchronously on the indexer's main thread; yield
1578
- // periodically so the #850 liveness watchdog heartbeat can fire on a repo
1579
- // with many deferred chained calls (#1091).
1580
1693
  const maybeYield = (0, cooperative_yield_1.createYielder)();
1581
1694
  const resolved = [];
1582
1695
  for (const ref of deferred) {
1583
- // PHP `this->prop.method` resolves via matchMethodCall (declared-type
1584
- // inference + resolveMethodOnType conformance walk); `::`-receiver
1585
- // languages (Rust) split on `::` (matchScopedCallChain); other
1586
- // dotted-receiver languages on `.` (matchDottedCallChain).
1587
1696
  const chainMatch = (ref.language === 'php' && PHP_PROP_SHAPE.test(ref.referenceName))
1588
1697
  ? (0, name_matcher_1.matchMethodCall)(ref, this.context)
1589
- : SCOPED_CHAIN_LANGUAGES.has(ref.language)
1590
- ? (0, name_matcher_1.matchScopedCallChain)(ref, this.context)
1591
- : (0, name_matcher_1.matchDottedCallChain)(ref, this.context);
1698
+ : name_matcher_1.NEW_RECEIVER_SHAPE.test(ref.referenceName)
1699
+ ? (0, name_matcher_1.matchNewReceiverCall)(ref, this.context)
1700
+ : SCOPED_CHAIN_LANGUAGES.has(ref.language)
1701
+ ? (0, name_matcher_1.matchScopedCallChain)(ref, this.context)
1702
+ : (0, name_matcher_1.matchDottedCallChain)(ref, this.context);
1592
1703
  const match = this.gateLanguage(chainMatch, ref);
1593
1704
  if (match)
1594
1705
  resolved.push(match);
@@ -1596,19 +1707,6 @@ class ReferenceResolver {
1596
1707
  }
1597
1708
  return this.persistDeferredReferences(deferred, resolved);
1598
1709
  }
1599
- /**
1600
- * Resolve one batch with a yield checkpoint between EVERY ref so the #850
1601
- * liveness heartbeat can fire on a slow/dense batch (#1091). The checkpoint
1602
- * granularity is per-ref — not per-N-refs — because per-ref cost is unbounded
1603
- * in the worst case (a collision-heavy method name whose candidate set misses
1604
- * the LRU re-fetches tens of thousands of rows): any fixed N multiplies that
1605
- * worst case into the watchdog window, which is how v1.2.0 still got killed
1606
- * at "Resolving refs" on large Java monorepos (#1122). `maybeYield()` is a
1607
- * ~ns time check when under budget, so per-ref checkpoints cost nothing.
1608
- * Behaviourally identical to `resolveAll(batch)`: `warmCaches()` is
1609
- * idempotent (guarded) and `resolveOne` is independent per ref, so yielding
1610
- * between refs changes only timing, never which edges get created.
1611
- */
1612
1710
  async resolveBatchYielding(batch, maybeYield) {
1613
1711
  this.warmCaches();
1614
1712
  this.advanceSupertypeGeneration();
@@ -1632,10 +1730,8 @@ class ReferenceResolver {
1632
1730
  byMethod[result.resolvedBy] = (byMethod[result.resolvedBy] || 0) + 1;
1633
1731
  }
1634
1732
  else {
1635
- unresolved.push(ref);
1733
+ unresolved.push(this.parkable(ref));
1636
1734
  }
1637
- // Fast-path the per-ref yield check: awaiting the async no-op costs a
1638
- // microtask hop per ref, which dominates at ~10⁵ refs (see MaybeYield).
1639
1735
  const y = maybeYield();
1640
1736
  if (y)
1641
1737
  await y;
@@ -1651,30 +1747,7 @@ class ReferenceResolver {
1651
1747
  },
1652
1748
  };
1653
1749
  }
1654
- /**
1655
- * Resolve a list of refs and return everything the ADMISSION side needs to
1656
- * persist the outcome: resolutions, failures, the deferred post-pass refs
1657
- * this run produced (drained, so the caller owns routing them), and stats.
1658
- * This is the resolver-worker entry point — it runs the exact per-ref loop
1659
- * of resolveBatchYielding, minus the main-thread yields (worker threads have
1660
- * no watchdog heartbeat to starve). Results are in input order.
1661
- */
1662
- /**
1663
- * CODEGRAPH_RESOLVE_PROFILE=1: per-outcome wall-clock histogram of
1664
- * resolveOne, keyed by the winning strategy (`resolvedBy`) or
1665
- * `fail:<referenceKind>` — the §7a.2 "profile the per-ref path" probe. The
1666
- * kernel-scale batch loop is ~430s and CORE-INVARIANT (835.9s pooled-4-on-8
1667
- * ≈ 812.5s sequential-on-2 for the whole superphase), so the next lever is
1668
- * which CLASS of ref the time belongs to, not more parallelism. Off by
1669
- * default: the hrtime pair costs ~100ns/ref only when the env is set.
1670
- */
1671
1750
  resolveProfile = process.env.CODEGRAPH_RESOLVE_PROFILE ? new Map() : null;
1672
- /**
1673
- * CODEGRAPH_RESOLVE_PROFILE=2 additionally attributes time to the
1674
- * STRATEGIES inside resolveOne (`stage:<name>|<refKind>|hit/miss` rows in
1675
- * the same histogram) — i.e. WHICH machinery a failing class of refs pays
1676
- * for, not just that it fails. =1 keeps the per-outcome rows only.
1677
- */
1678
1751
  profileStages = process.env.CODEGRAPH_RESOLVE_PROFILE === '2';
1679
1752
  stageAdd(stage, ref, hit, t0) {
1680
1753
  if (!this.resolveProfile)
@@ -1707,7 +1780,6 @@ class ReferenceResolver {
1707
1780
  }
1708
1781
  return result;
1709
1782
  }
1710
- /** Dump the CODEGRAPH_RESOLVE_PROFILE histogram to stderr (no-op when off). */
1711
1783
  dumpResolveProfile(label) {
1712
1784
  if (!this.resolveProfile || this.resolveProfile.size === 0)
1713
1785
  return;
@@ -1717,7 +1789,6 @@ class ReferenceResolver {
1717
1789
  for (const r of rows) {
1718
1790
  console.error(`[resolve-profile] ${label} ${r.k}: n=${r.n} total=${(r.ms / 1000).toFixed(1)}s avg=${((r.ms * 1000) / Math.max(1, r.n)).toFixed(0)}µs`);
1719
1791
  }
1720
- // =2 only: this thread's matchReference sub-stage table rides along.
1721
1792
  (0, name_matcher_1.dumpNameMatcherProfile)(label);
1722
1793
  }
1723
1794
  resolveListForAdmission(refs) {
@@ -1743,10 +1814,10 @@ class ReferenceResolver {
1743
1814
  byMethod[result.resolvedBy] = (byMethod[result.resolvedBy] || 0) + 1;
1744
1815
  }
1745
1816
  else {
1746
- unresolved.push(ref);
1817
+ unresolved.push(this.parkable(ref));
1747
1818
  }
1748
1819
  }
1749
- this.deferredRowIds.clear(); // the admission side now owns both queues
1820
+ this.deferredRowIds.clear();
1750
1821
  return {
1751
1822
  resolved,
1752
1823
  unresolved,
@@ -1755,57 +1826,20 @@ class ReferenceResolver {
1755
1826
  byMethod,
1756
1827
  };
1757
1828
  }
1758
- /**
1759
- * The resolver's live ResolutionContext — resolver-pool workers use it to
1760
- * run synthesis passes against their own read-only connection.
1761
- */
1762
1829
  getResolutionContext() {
1763
1830
  return this.context;
1764
1831
  }
1765
- /**
1766
- * Re-queue deferred post-pass refs produced by resolver workers, preserving
1767
- * their admission order so resolveChainedCallsViaConformance /
1768
- * resolveDeferredThisMemberRefs process them exactly as the sequential path
1769
- * would have.
1770
- */
1771
1832
  appendDeferredFromWorkers(deferredChain, deferredThisMember) {
1772
1833
  for (const ref of deferredChain)
1773
1834
  this.deferReference(ref, this.deferredChainRefs);
1774
1835
  for (const ref of deferredThisMember)
1775
1836
  this.deferReference(ref, this.deferredThisMemberRefs);
1776
1837
  }
1777
- /**
1778
- * Resolve and persist in batches to keep memory bounded.
1779
- * Processes unresolved references in chunks, persisting edges and cleaning
1780
- * up resolved refs after each batch to avoid accumulating large arrays.
1781
- */
1782
- async resolveAndPersistBatched(onProgress, batchSize = 5000, onSynthesisProgress,
1783
- // When provided, big batches fan out across a read-only resolver-worker
1784
- // pool with results admitted in canonical order (see resolver-pool.ts).
1785
- // Sequential fallback on any pool failure. CODEGRAPH_NO_PARALLEL_RESOLVE=1
1786
- // disables entirely. bulkEdgeLoad hooks (when provided) bracket the batch
1787
- // loop with drop/recreate of the non-unique edge indexes on big runs —
1788
- // see DatabaseConnection.beginBulkEdgeLoad. backpressure (when provided)
1789
- // is the WAL valve's writer-side backstop (WalCheckpointValve.backpressure):
1790
- // called at pool-idle boundaries so a full backfill can actually complete —
1791
- // the valve's timer-driven passive passes stay perpetually partial against
1792
- // the pool's continuous reads, which is how a kernel-scale resolution grew
1793
- // a 22GB WAL on a 4.6GB DB (migration plan §7a.1).
1794
- parallel, synthesize = true) {
1795
- // Resolution runs on the indexer's MAIN thread, and the #850 liveness
1796
- // watchdog SIGKILLs a process whose event loop stalls past its window (60s
1797
- // by default). A single dense batch's resolveAll — or the synthesis pass
1798
- // below — can exceed that on a large repo, killing a VALID in-progress index
1799
- // (#1091). A shared yielder lets both give the watchdog heartbeat a regular
1800
- // window to fire; see ./cooperative-yield.
1838
+ async resolveAndPersistBatched(onProgress, batchSize = 5000, onSynthesisProgress, parallel, synthesize = true) {
1801
1839
  const maybeYield = (0, cooperative_yield_1.createYielder)();
1802
1840
  if (process.env.CODEGRAPH_SYNTH_TIMINGS) {
1803
1841
  console.error(`[pool-timing] backpressure hook: ${parallel?.backpressure ? 'present' : 'absent'}`);
1804
1842
  }
1805
- // CODEGRAPH_RESOLVE_PROFILE loop-stage attribution: the §7a.2 kernel-scale
1806
- // histogram showed resolveOne owns only ~93s of the ~436s batch loop —
1807
- // these counters name where the other ~340s goes (reads, edge build+insert,
1808
- // deletes/marks, the per-batch count guard).
1809
1843
  const loopProf = process.env.CODEGRAPH_RESOLVE_PROFILE
1810
1844
  ? { read: 0, settle: 0, backpressure: 0, recycle: 0, createEdges: 0, insertEdges: 0, deletes: 0, marks: 0, countGuard: 0 }
1811
1845
  : null;
@@ -1821,24 +1855,21 @@ class ReferenceResolver {
1821
1855
  unresolved: 0,
1822
1856
  byMethod: {},
1823
1857
  };
1824
- // Parallel pool, started immediately but never awaited up front: early
1825
- // batches run sequentially while the workers boot (module load + readonly
1826
- // DB open + framework detect + cache warm ≈ hundreds of ms), and the loop
1827
- // switches to fan-out the moment the pool reports ready — so pool boot
1828
- // costs zero wall-clock. Any failure downgrades to sequential permanently.
1829
1858
  let pool = null;
1830
1859
  let poolReady = false;
1831
- // True once pool creation has been attempted by EITHER engage site (the
1832
- // up-front ref-count gate or the adaptive projection below) — a pool that
1833
- // failed or was destroyed must stay down (downgrade is permanent), and
1834
- // tryCreate's sizing probes shouldn't re-run every batch on hosts that
1835
- // declined.
1836
1860
  let poolEngageTried = false;
1837
- const createPool = (t0, why) => {
1861
+ const createPool = (t0, why, worth) => {
1838
1862
  poolEngageTried = true;
1839
1863
  if (!parallel)
1840
1864
  return null;
1841
- const p = resolver_pool_1.ResolverPool.tryCreate(parallel.dbPath, this.projectRoot);
1865
+ const p = resolver_pool_1.ResolverPool.tryCreate(parallel.dbPath, this.projectRoot, parallel.shareFrameworks ? this.getDetectedFrameworks() : undefined, worth);
1866
+ if (p && parallel.shareFrameworks) {
1867
+ const scans = this.projectScans();
1868
+ if (process.env.CODEGRAPH_SYNTH_TIMINGS)
1869
+ console.error(`[pool-timing] project scans: ${scans.cpp ? 'shared' : 'none'}`);
1870
+ if (scans.cpp)
1871
+ p.shareScans(scans);
1872
+ }
1842
1873
  p?.ready().then(() => {
1843
1874
  poolReady = true;
1844
1875
  if (process.env.CODEGRAPH_SYNTH_TIMINGS)
@@ -1852,33 +1883,15 @@ class ReferenceResolver {
1852
1883
  };
1853
1884
  if (parallel && total >= (0, resolver_pool_1.minRefsForPool)()) {
1854
1885
  pool = createPool(Date.now(), 'ref-count');
1886
+ if (pool)
1887
+ await (0, resolver_pool_1.poolStartSettled)(pool.ready());
1855
1888
  }
1856
- // Adaptive engagement bar (see the batch-loop hook): projected remaining
1857
- // sequential settle above this boots the pool mid-loop. Boot is async and
1858
- // fan-out waits for ready, so a marginal engage costs background boot
1859
- // only; the bar just needs to clear the fan-out's own overhead class.
1860
1889
  const ADAPTIVE_ENGAGE_SETTLE_MS = 400;
1861
1890
  let adaptiveSeqMs = 0;
1862
1891
  let adaptiveSeqRefs = 0;
1863
- // Process in PIPELINED batches (double-buffer). The enumeration is the
1864
- // head of the pending set in rowid order; every ref a persisted batch
1865
- // processed leaves the pending set (resolved rows are deleted,
1866
- // unresolvable ones flip to status='failed'), shifting the remaining
1867
- // pending rows forward.
1868
1892
  let prevRemaining = Number.POSITIVE_INFINITY;
1869
- // Cadence for the worker connection recycling below — ~8 batches
1870
- // ≈ 40k refs between recycles keeps the WAL shallow at kernel scale
1871
- // while a small sync never recycles at all. (25 recovered only half
1872
- // the write tax — the WAL re-deepened between recycles; reopens are
1873
- // sub-millisecond so the shorter cadence is ~free.)
1874
1893
  const RECYCLE_EVERY_BATCHES = 8;
1875
1894
  let batchesSinceRecycle = 0;
1876
- // Begin one batch: fan out to the pool when it's ready and the batch is
1877
- // big enough — workers then resolve batch k+1 WHILE the main thread
1878
- // persists batch k (persist measured at ~58% of resolution wall on a
1879
- // 255k-ref repo, all of it previously spent with the pool idle).
1880
- // Sequential batches stay lazy: they run on the main thread at settle
1881
- // time, where an early start would only contend with the persist.
1882
1895
  const beginBatch = (batch) => {
1883
1896
  if (pool && poolReady && resolver_pool_1.ResolverPool.worthParallel(batch.length)) {
1884
1897
  return {
@@ -1888,11 +1901,6 @@ class ReferenceResolver {
1888
1901
  }
1889
1902
  return { mode: 'seq' };
1890
1903
  };
1891
- // Settle an in-flight batch to a ResolutionResult. Deferred post-pass refs
1892
- // are appended HERE, in loop order — never inside the fan-out promise — so
1893
- // admission order stays exactly the sequential order even while a later
1894
- // batch resolves concurrently. A pool failure downgrades to sequential
1895
- // permanently and re-resolves this batch on the main thread.
1896
1904
  const settleBatch = async (inFlight, batch) => {
1897
1905
  if (inFlight.mode === 'pool') {
1898
1906
  const settled = await inFlight.settled;
@@ -1918,41 +1926,27 @@ class ReferenceResolver {
1918
1926
  }
1919
1927
  return this.resolveBatchYielding(batch, maybeYield);
1920
1928
  };
1921
- // Bulk edge load: on big runs, drop the non-unique edge indexes for the
1922
- // duration of the batch loop (the identity index stays — OR IGNORE dedup
1923
- // and the source-keyed supertype-walk reads both live on it). Recreated in
1924
- // the inner finally BEFORE synthesis, whose passes read kind-keyed.
1925
- // Measured on a 224k-edge resolution set: insert 2.8s → 1.1s + 0.3s
1926
- // recreate. Same ref-count gate as the pool so small syncs never pay the
1927
- // recreate cost.
1928
1929
  let bulkEdgesActive = false;
1929
1930
  if (parallel?.bulkEdgeLoad && total >= (0, resolver_pool_1.minRefsForPool)()) {
1930
1931
  try {
1931
1932
  parallel.bulkEdgeLoad.begin();
1932
1933
  bulkEdgesActive = true;
1933
1934
  }
1934
- catch { /* keep the indexes; inserts just pay the per-row maintenance */ }
1935
+ catch { }
1935
1936
  }
1936
- // Same gate for the ref-index window: the loop's deletes stop maintaining
1937
- // the five sync-path unresolved_refs indexes, and the end-of-loop rebuild
1938
- // is near-free (only failed refs survive the loop).
1939
1937
  let bulkRefsActive = false;
1940
1938
  if (parallel?.refIndexLoad && total >= (0, resolver_pool_1.minRefsForPool)()) {
1941
1939
  try {
1942
1940
  parallel.refIndexLoad.begin();
1943
1941
  bulkRefsActive = true;
1944
1942
  }
1945
- catch { /* keep the indexes; deletes just pay the per-row maintenance */ }
1943
+ catch { }
1946
1944
  }
1947
1945
  try {
1948
1946
  try {
1949
- // Orphans retain interruption/re-extraction order, not clean-index order.
1950
- // A caller can precede its imports or supertypes by many batches (#1577).
1951
- // Drain those prerequisites first, then start a fresh keyset cursor over
1952
- // the remaining kinds. The disjoint filters let us prefetch across the
1953
- // phase boundary before cleanup without re-reading the current batch.
1954
1947
  let prerequisites = true;
1955
1948
  let afterRowId = 0;
1949
+ let readDependents = false;
1956
1950
  const readNextBatch = () => {
1957
1951
  let next = this.queries.getUnresolvedReferencesBatchAfter(afterRowId, batchSize, prerequisites);
1958
1952
  if (next.length === 0 && prerequisites) {
@@ -1962,35 +1956,30 @@ class ReferenceResolver {
1962
1956
  }
1963
1957
  if (next.length > 0)
1964
1958
  afterRowId = next[next.length - 1].rowId;
1959
+ readDependents = !prerequisites;
1965
1960
  return next;
1966
1961
  };
1967
1962
  tLp = Date.now();
1968
1963
  let batch = readNextBatch();
1969
1964
  lp('read', tLp);
1965
+ let batchIsDependents = readDependents;
1970
1966
  let inFlight = batch.length > 0 ? beginBatch(batch) : null;
1971
1967
  while (batch.length > 0 && inFlight) {
1972
- // Prefetch the NEXT batch before this one persists: this batch's rows
1973
- // are still pending (nothing has mutated the table since they were
1974
- // read), so seeking past this batch's last row id in the same rowid
1975
- // enumeration yields the following batch (keyset — OFFSET re-walked the
1976
- // accumulated failed prefix every read, 54.6s at kernel scale, §7a.2).
1977
1968
  tLp = Date.now();
1978
1969
  const nextBatch = readNextBatch();
1979
1970
  lp('read', tLp);
1971
+ const nextIsDependents = readDependents;
1972
+ let nextInFlight = null;
1973
+ if (batchIsDependents && inFlight.mode === 'pool' && nextBatch.length > 0 && batchesSinceRecycle + 1 < RECYCLE_EVERY_BATCHES) {
1974
+ const ahead = beginBatch(nextBatch);
1975
+ if (ahead.mode === 'pool')
1976
+ nextInFlight = ahead;
1977
+ }
1980
1978
  const tBatch = Date.now();
1981
1979
  const result = await settleBatch(inFlight, batch);
1982
1980
  if (process.env.CODEGRAPH_SYNTH_TIMINGS)
1983
1981
  console.error(`[pool-timing] batch ${inFlight.mode}: ${batch.length} refs in ${Date.now() - tBatch}ms`);
1984
1982
  lp('settle', tBatch);
1985
- // Adaptive pool engagement: the fixed ref-count gate can't see PER-REF
1986
- // cost, and settle rates differ ~9× by language (56k Rust refs cost
1987
- // more sequential settle than 154k Go refs — 36µs vs 4µs measured on
1988
- // tokio/prometheus). After each sequential batch, project the remaining
1989
- // settle from the observed rate and boot the pool mid-loop when it
1990
- // clears the bar. The loop already switches to fan-out only when the
1991
- // async boot reports ready, admission order is mode-independent, and
1992
- // 2-core/low-memory hosts still decline inside tryCreate's sizing —
1993
- // so the switch changes wall-clock, never the graph.
1994
1983
  if (inFlight.mode === 'seq' && parallel && pool === null && !poolEngageTried) {
1995
1984
  adaptiveSeqMs += Date.now() - tBatch;
1996
1985
  adaptiveSeqRefs += batch.length;
@@ -2000,30 +1989,14 @@ class ReferenceResolver {
2000
1989
  if (process.env.CODEGRAPH_SYNTH_TIMINGS) {
2001
1990
  console.error(`[pool-timing] adaptive engage: projected ${Math.round(projectedMs)}ms sequential settle over ${remaining} remaining refs`);
2002
1991
  }
2003
- pool = createPool(Date.now(), 'adaptive');
1992
+ pool = createPool(Date.now(), 'adaptive', (0, resolver_pool_1.resolveWorkersWorthStarting)(projectedMs));
2004
1993
  }
2005
1994
  }
2006
- // WAL-valve backstop at the ONE pool-idle boundary of the double-buffer
2007
- // (this batch settled, the next not yet fanned out): past the hard cap
2008
- // the writer parks for a full backfill here, where the pool's readers
2009
- // are all between statements — so the backfill completes, readers
2010
- // re-enter at SQLite's backfilled mark, and the next persist commit
2011
- // WRAPS the WAL instead of growing it. No-op (one fstat) under the cap.
2012
1995
  tLp = Date.now();
2013
- const bp = parallel?.backpressure?.();
1996
+ const bp = nextInFlight ? null : parallel?.backpressure?.();
2014
1997
  if (bp)
2015
1998
  await bp;
2016
1999
  lp('backpressure', tLp);
2017
- // Recycle the workers' read connections periodically at this same
2018
- // worker-idle boundary (batch k settled, batch k+1 not yet fanned
2019
- // out): a long-lived reader pins WAL checkpoint progress, and the
2020
- // deep WAL that accumulates behind it taxes the writer's OWN page
2021
- // operations — the §7a.6 writes-under-readers finding (deletes
2022
- // 42.6s → 118.8s from 0 to 4 attached readers; an aggressive valve
2023
- // recovered the writes but paid +129s in full-park folds). Releasing
2024
- // the read marks every ~25 batches lets the existing checkpoints
2025
- // advance instead, at ~milliseconds of reopen cost. A failed recycle
2026
- // downgrades to sequential permanently, same as a failed fan-out.
2027
2000
  if (pool && poolReady && ++batchesSinceRecycle >= RECYCLE_EVERY_BATCHES) {
2028
2001
  batchesSinceRecycle = 0;
2029
2002
  tLp = Date.now();
@@ -2039,49 +2012,24 @@ class ReferenceResolver {
2039
2012
  }
2040
2013
  lp('recycle', tLp);
2041
2014
  }
2042
- // Persist in bounded sub-transactions with yields between: a whole
2043
- // batch's edge insert / keyed deletes are otherwise one solid
2044
- // synchronous span each on a multi-GB index, sitting BETWEEN the
2045
- // per-ref yields — the last unyielded stretch of the resolution loop.
2046
- // Crash semantics are unchanged (already several transactions): edges
2047
- // land before their refs are deleted, so a kill mid-way re-resolves
2048
- // the remainder idempotently on the next run/sweep (#1187).
2049
2015
  const PERSIST_CHUNK = 1000;
2050
2016
  const tPersist = Date.now();
2051
- // A batch that made `extends`/`implements` edges persists them BEFORE
2052
- // fanning out the next batch: later batches read them —
2053
- // resolveMethodOnType walks supertype chains over edges that earlier
2054
- // batches resolved, so a receiver typed as a subclass only reaches a
2055
- // method declared on its base class if those edges are visible.
2056
- // (Validated on dubbo: fanning out first downgraded exactly those
2057
- // supertype-method resolutions from the 0.9 typed-receiver path to the
2058
- // 0.65 word-overlap fallback.) They are the only edges resolution reads
2059
- // (RESOLUTION_READ_EDGE_KINDS), so a batch that made none — every batch
2060
- // after the prerequisite phase readNextBatch drains first — fans the
2061
- // next batch out now and inserts while it resolves: the same writes in
2062
- // the same order, and nothing the workers read differs.
2063
2017
  tLp = Date.now();
2064
2018
  const edges = this.createEdges(result.resolved);
2065
2019
  lp('createEdges', tLp);
2066
2020
  const readEdge = edges.some((e) => RESOLUTION_READ_EDGE_KINDS.includes(e.kind));
2067
- let nextInFlight = !readEdge && nextBatch.length > 0 ? beginBatch(nextBatch) : null;
2021
+ if (readEdge)
2022
+ nextInFlight = null;
2023
+ else if (!nextInFlight && nextBatch.length > 0)
2024
+ nextInFlight = beginBatch(nextBatch);
2068
2025
  tLp = Date.now();
2069
2026
  for (let i = 0; i < edges.length; i += PERSIST_CHUNK) {
2070
2027
  this.queries.insertEdges(edges.slice(i, i + PERSIST_CHUNK));
2071
2028
  await maybeYield();
2072
2029
  }
2073
2030
  lp('insertEdges', tLp);
2074
- // NOW fan the next batch out (if not already) — workers see exactly the
2075
- // edge state the sequential baseline would (every batch ≤ this one
2076
- // committed), while the main thread spends the REST of the persist (ref
2077
- // deletes + failed parking below) overlapped with their resolution —
2078
- // the double-buffer.
2079
2031
  if (!nextInFlight && nextBatch.length > 0)
2080
2032
  nextInFlight = beginBatch(nextBatch);
2081
- // Clean up resolved refs so they don't appear in the next batch —
2082
- // by row id, so a same-key sibling ref in a LATER batch (same caller
2083
- // calling the same callee at another line) is left pending for its own
2084
- // attempt instead of being swept out with this batch's rows (#1269).
2085
2033
  tLp = Date.now();
2086
2034
  let removedThisBatch = 0;
2087
2035
  const resolvedCleanup = ReferenceResolver.partitionResolvedCleanup(result.resolved);
@@ -2094,10 +2042,6 @@ class ReferenceResolver {
2094
2042
  await maybeYield();
2095
2043
  }
2096
2044
  lp('deletes', tLp);
2097
- // Park unresolvable refs from this batch as status='failed' so they
2098
- // leave the pending set (the batch reader and non-progress guard below
2099
- // only see pending rows) but stay retryable when a later sync adds a
2100
- // symbol that could satisfy them (#1240).
2101
2045
  tLp = Date.now();
2102
2046
  const failures = this.nonDeferredFailures(result.unresolved);
2103
2047
  const deferredCount = result.unresolved.length - failures.length;
@@ -2113,7 +2057,6 @@ class ReferenceResolver {
2113
2057
  lp('marks', tLp);
2114
2058
  if (process.env.CODEGRAPH_SYNTH_TIMINGS)
2115
2059
  console.error(`[pool-timing] batch persist: ${Date.now() - tPersist}ms`);
2116
- // Aggregate stats
2117
2060
  aggregateStats.total += result.stats.total;
2118
2061
  aggregateStats.resolved += result.stats.resolved;
2119
2062
  aggregateStats.unresolved += result.stats.unresolved;
@@ -2122,31 +2065,7 @@ class ReferenceResolver {
2122
2065
  }
2123
2066
  processed += batch.length;
2124
2067
  onProgress?.(processed, total);
2125
- // Yield so progress UI can render between batches
2126
2068
  await new Promise(resolve => setImmediate(resolve));
2127
- // NOTE: there used to be an extra early break here when a batch resolved
2128
- // nothing (`result.unresolved.length === batch.length`). That was wrong:
2129
- // an all-unresolvable batch still DELETES its rows (progress), yet the
2130
- // break abandoned every batch after it in the same run — on a repo whose
2131
- // first 5000 refs are all external/stdlib calls, resolution stopped at
2132
- // batch one and left the rest of the table as permanent orphans (#1187).
2133
- // The count-based guard below catches the true no-progress case.
2134
- // Non-progress guard (defense-in-depth). Ordinary attempts must leave
2135
- // the pending set; a mismatched original reference can make legacy-key
2136
- // cleanup a no-op. Keep the guard against that broken persistence even
2137
- // though keyset pagination now advances independently of row cleanup.
2138
- // An abandoned prefetched batch has no side effects until settleBatch.
2139
- // Non-progress signal, now O(1): `changes` summed across this batch's
2140
- // deletes + failed-parks is the DIRECT evidence the guard's old count
2141
- // diff inferred — a resolver returning a mismatched name makes the keyed
2142
- // cleanup no-op, which shows up here as zero removals. The per-batch
2143
- // COUNT(*) it replaces walked every remaining pending row — O(N²/batch)
2144
- // over a run, 93.9s of the kernel-scale batch loop (§7a.2). A REAL count
2145
- // runs only on the suspicious path (claimed-work batch removed nothing —
2146
- // e.g. every row was a sibling a legacy-key sweep already consumed),
2147
- // where it arbitrates stop-vs-continue exactly as before.
2148
- // Deferred refs legitimately remain pending for the post-pass. The
2149
- // keyset cursor advances past them; they must not trigger this guard.
2150
2069
  if (removedThisBatch + deferredCount <= 0 && batch.length > 0) {
2151
2070
  tLp = Date.now();
2152
2071
  const remaining = this.queries.getUnresolvedReferencesCount();
@@ -2155,16 +2074,12 @@ class ReferenceResolver {
2155
2074
  break;
2156
2075
  prevRemaining = remaining;
2157
2076
  }
2158
- // Advance the pipeline: the prefetched batch (already fanned out when
2159
- // the pool is on) becomes the current one.
2160
2077
  batch = nextBatch;
2078
+ batchIsDependents = nextIsDependents;
2161
2079
  inFlight = nextInFlight;
2162
2080
  }
2163
2081
  }
2164
2082
  finally {
2165
- // Recreate the edge indexes BEFORE synthesis (kind-keyed reads) and on
2166
- // any error path. A crash before this line is healed by the next
2167
- // DatabaseConnection open (schema.sql re-applies IF NOT EXISTS).
2168
2083
  if (bulkRefsActive) {
2169
2084
  const tRef = Date.now();
2170
2085
  await parallel.refIndexLoad.end();
@@ -2176,16 +2091,11 @@ class ReferenceResolver {
2176
2091
  await parallel.bulkEdgeLoad.end();
2177
2092
  if (process.env.CODEGRAPH_SYNTH_TIMINGS)
2178
2093
  console.error(`[phase-timing] edge-index-recreate: ${Date.now() - tIdx}ms`);
2179
- // The recreate just wrote every non-unique edge index into the WAL
2180
- // (multi-GB at kernel scale) with the pool idle — fold before the
2181
- // synthesis passes pin readers against it for minutes.
2182
2094
  const bp = parallel?.backpressure?.();
2183
2095
  if (bp)
2184
2096
  await bp;
2185
2097
  }
2186
2098
  }
2187
- // Indexes the bulk-edge window's end deferred: built once, while the pool
2188
- // is busy with synthesis when it is, and in any case before this returns.
2189
2099
  let deferredBuilt = !bulkEdgesActive || !parallel?.bulkEdgeLoad?.deferred;
2190
2100
  const buildDeferredIndexes = () => {
2191
2101
  if (deferredBuilt)
@@ -2195,24 +2105,16 @@ class ReferenceResolver {
2195
2105
  try {
2196
2106
  parallel.bulkEdgeLoad.deferred();
2197
2107
  }
2198
- catch { /* healed by schema.sql on the next open, like a crash in the window */ }
2108
+ catch { }
2199
2109
  if (process.env.CODEGRAPH_SYNTH_TIMINGS)
2200
2110
  console.error(`[phase-timing] deferred-edge-index: ${Date.now() - tDeferred}ms`);
2201
2111
  };
2202
- // Dynamic-edge synthesis: now that all base `calls` edges are persisted,
2203
- // synthesize observer/callback dispatch edges (dispatcher → registered
2204
- // callbacks) that static parsing leaves out. Best-effort — never fail the
2205
- // index on it. The pool (when it survived resolution) is REUSED to fan the
2206
- // independent passes across its read-only workers — that's why its destroy
2207
- // lives in the finally below, after synthesis, not at the end of the batch
2208
- // loop. See docs/design/callback-edge-synthesis.md.
2209
2112
  const tSynth = Date.now();
2210
2113
  try {
2211
2114
  if (synthesize)
2212
2115
  aggregateStats.byMethod['callback-synthesis'] = await (0, callback_synthesizer_1.synthesizeCallbackEdges)(this.queries, this.context, onSynthesisProgress, pool, parallel?.backpressure, buildDeferredIndexes);
2213
2116
  }
2214
2117
  catch {
2215
- // synthesis is additive and optional; ignore failures
2216
2118
  }
2217
2119
  buildDeferredIndexes();
2218
2120
  if (process.env.CODEGRAPH_SYNTH_TIMINGS)
@@ -2233,7 +2135,35 @@ class ReferenceResolver {
2233
2135
  stats: aggregateStats,
2234
2136
  };
2235
2137
  }
2236
- /** Replace synthesis only after every base-resolution pass has finished. */
2138
+ trackParameterFlows() {
2139
+ return new parameter_flow_1.FlowChange(this.queries);
2140
+ }
2141
+ async resolveParameterFlows(change) {
2142
+ const t0 = Date.now();
2143
+ let changed = 0;
2144
+ try {
2145
+ const flows = this.queries.parameterFlows;
2146
+ for (const { retarget, drop, restore, stats, language, record } of await (0, parameter_flow_1.planParameterFlows)(this.queries, this.context, change)) {
2147
+ flows.retargetCalls(retarget.flatMap((r) => (r.edgeId === undefined ? [] : [r.edgeId])), retarget.flatMap((r) => (r.rowId === undefined ? [] : [r.rowId])), this.createEdges(retarget.map((r) => r.resolved)));
2148
+ flows.replaceEdgesWithFlowMarkedRefs(drop.map((d) => d.edgeId), drop.map((d) => d.reference));
2149
+ if (retarget.length + drop.length > 0)
2150
+ flows.noteParameterFlows();
2151
+ if (restore.length > 0) {
2152
+ flows.restoreCalls(restore.flatMap((r) => (r.edgeId === undefined ? [] : [r.edgeId])), restore.flatMap((r) => (r.rowId === undefined ? [] : [r.rowId])), restore.map((r) => r.reference));
2153
+ const files = new Set(restore.flatMap((r) => (r.reference.filePath === undefined ? [] : [r.reference.filePath])));
2154
+ await this.resolveAndPersistListYielding(this.queries.getUnresolvedReferencesByFiles([...files]));
2155
+ }
2156
+ flows.setRecord(language, record);
2157
+ changed += retarget.length + drop.length + restore.length;
2158
+ if (process.env.CODEGRAPH_SYNTH_TIMINGS)
2159
+ console.error(`[phase-timing] parameter-flow: ${Date.now() - t0}ms ${JSON.stringify(stats)}`);
2160
+ }
2161
+ }
2162
+ catch (error) {
2163
+ (0, errors_1.logDebug)('Parameter flows failed', { error: String(error) });
2164
+ }
2165
+ return changed;
2166
+ }
2237
2167
  async refreshSynthesis(dbPath, onProgress, backpressure) {
2238
2168
  this.clearCaches();
2239
2169
  const stage = new synthesis_stage_1.SynthesisStage(dbPath);
@@ -2248,37 +2178,256 @@ class ReferenceResolver {
2248
2178
  this.clearCaches();
2249
2179
  }
2250
2180
  }
2251
- /**
2252
- * Get detected frameworks
2253
- */
2181
+ getPythonRootFingerprint() {
2182
+ return (0, import_resolver_1.pythonRootFingerprint)(this.diskContext());
2183
+ }
2184
+ refreshWorkspacePackages(knownManifests) {
2185
+ const { packages: fresh, discovery } = (0, workspace_packages_1.loadWorkspacePackagesAndManifests)(this.projectRoot, knownManifests);
2186
+ if (discovery)
2187
+ this.workspaceDiscovery = discovery;
2188
+ const fingerprint = (0, workspace_packages_1.workspaceFingerprint)(fresh);
2189
+ if (this.workspacePackages === undefined || (0, workspace_packages_1.workspaceFingerprint)(this.workspacePackages) !== fingerprint) {
2190
+ this.workspacePackages = fresh;
2191
+ this.clearCaches();
2192
+ }
2193
+ return fingerprint;
2194
+ }
2195
+ getWorkspaceDiscovery() {
2196
+ return this.workspaceDiscovery;
2197
+ }
2198
+ getModuleConfigSnapshot(previous, treeMoved = false) {
2199
+ const was = parseModuleConfigSnapshot(previous);
2200
+ if (treeMoved || !('Cargo.toml' in was)) {
2201
+ this.cargoCrates = undefined;
2202
+ this.layoutIncludeDirs = undefined;
2203
+ this.readCargoCrates();
2204
+ }
2205
+ const files = new Set(this.moduleConfigFiles);
2206
+ for (const name of MODULE_CONFIG_ROOT_FILES)
2207
+ files.add(path.join(this.projectRoot, name));
2208
+ for (const rel of Object.keys(was))
2209
+ files.add(path.join(this.projectRoot, rel));
2210
+ return moduleConfigSnapshot(this.projectRoot, files, was);
2211
+ }
2212
+ readCargoCrates() {
2213
+ if (!this.cargoCrates) {
2214
+ this.cargoCrates = (0, cargo_workspace_1.readCargoWorkspaceCrateMap)(this.diskContext());
2215
+ for (const dir of this.cargoCrates.values())
2216
+ this.moduleConfigFiles.add(path.join(this.projectRoot, dir, 'Cargo.toml'));
2217
+ }
2218
+ return this.cargoCrates;
2219
+ }
2220
+ resetModuleConfig() {
2221
+ this.projectAliases = undefined;
2222
+ this.dirAliases.clear();
2223
+ this.goModuleByDir.clear();
2224
+ this.goPackageDirs.clear();
2225
+ this.cargoCrates = undefined;
2226
+ this.compileDbIncludeDirs = undefined;
2227
+ this.moduleConfigFiles.clear();
2228
+ this.clearCaches();
2229
+ this.readCargoCrates();
2230
+ }
2231
+ getWorkspaceFingerprint() {
2232
+ return (0, workspace_packages_1.workspaceFingerprint)(this.context.getWorkspacePackages?.() ?? null);
2233
+ }
2234
+ workspacePackageDirOf(file) {
2235
+ const ws = this.context.getWorkspacePackages?.();
2236
+ return ws ? (0, workspace_packages_1.workspacePackageDirOf)(ws, file) : null;
2237
+ }
2238
+ getPythonReopenScope(changedFiles) {
2239
+ return (0, import_resolver_1.pythonReopenScope)(this.diskContext(), changedFiles);
2240
+ }
2241
+ getPythonScriptModuleScope(editedFiles) {
2242
+ return (0, import_resolver_1.pythonScriptModuleScope)(this.context, editedFiles);
2243
+ }
2244
+ getPythonPackageImporters(initFiles) {
2245
+ return (0, import_resolver_1.pythonPackageImporters)(this.context, initFiles);
2246
+ }
2247
+ diskContext() {
2248
+ return {
2249
+ ...this.context,
2250
+ readFile: (filePath) => {
2251
+ try {
2252
+ const abs = path.join(this.projectRoot, filePath);
2253
+ return fs.statSync(abs).isFile() ? fs.readFileSync(abs, 'utf-8') : null;
2254
+ }
2255
+ catch {
2256
+ return null;
2257
+ }
2258
+ },
2259
+ };
2260
+ }
2254
2261
  getDetectedFrameworks() {
2255
2262
  return this.frameworks.map((f) => f.name);
2256
2263
  }
2257
- /**
2258
- * True when `receiver` is a local name bound by an import that resolves to a
2259
- * file IN THIS PROJECT — the only case where letting a python
2260
- * built-in-method name through the filter is safe (#1681).
2261
- *
2262
- * Asking only whether SOME import bound the local name is not enough: every
2263
- * import produces a mapping, stdlib and PyPI included, so that would also be
2264
- * true for `os`, `requests`, `np`. Opening the filter for them lets
2265
- * resolveViaImport find no project file, fall through to bare-name matching,
2266
- * and bind `os.remove(p)` to whatever project method happens to be named
2267
- * `remove` — reintroducing, through its own escape hatch, the fabricated-edge
2268
- * class this filter exists to prevent.
2269
- *
2270
- * Resolving the specifier is the same question resolveViaImport will ask
2271
- * next, so a receiver that passes here is one the qualified path can actually
2272
- * serve; anything else stays a silent miss rather than a wrong edge.
2273
- */
2264
+ resolveModuleFile(specifier, fromFile, language) {
2265
+ return (0, import_resolver_1.resolveImportPath)(specifier, fromFile, language, this.context);
2266
+ }
2267
+ resolveNow(ref) {
2268
+ if (!ref.filePath || !ref.language)
2269
+ return null;
2270
+ const resolved = this.resolveOne({ ...ref, filePath: ref.filePath, language: ref.language });
2271
+ return resolved ? { targetNodeId: resolved.targetNodeId, resolvedBy: resolved.resolvedBy } : null;
2272
+ }
2273
+ hasNavigationRouters() {
2274
+ return this.frameworks.some((f) => f.navigation !== undefined);
2275
+ }
2276
+ reopenNavigationsFor(routes, changedFilePaths = [], perNameCeiling = 500) {
2277
+ if (routes.length === 0)
2278
+ return 0;
2279
+ const plans = [];
2280
+ const tails = new Set();
2281
+ for (const router of this.frameworks) {
2282
+ if (!router.navigation)
2283
+ continue;
2284
+ const scopes = new Set();
2285
+ for (const route of routes) {
2286
+ for (const scope of router.navigation.scope(route, this.context) ?? [])
2287
+ scopes.add(scope);
2288
+ }
2289
+ if (scopes.size === 0)
2290
+ continue;
2291
+ plans.push({ router, scopes: [...scopes] });
2292
+ for (const tail of router.navigation.tails)
2293
+ tails.add(tail);
2294
+ }
2295
+ if (plans.length === 0)
2296
+ return 0;
2297
+ const claimed = (name, filePath) => plans.some(({ router, scopes }) => scopes.some((scope) => filePath.startsWith(scope)) && router.claimsReference?.(name) === true);
2298
+ const fresh = new Set(changedFilePaths);
2299
+ const failed = new Map();
2300
+ for (const ref of this.queries.getFailedCallsByTail([...tails])) {
2301
+ if (fresh.has(ref.filePath) || !claimed(ref.referenceName, ref.filePath))
2302
+ continue;
2303
+ const rowIds = failed.get(ref.referenceName);
2304
+ if (rowIds)
2305
+ rowIds.push(ref.rowId);
2306
+ else
2307
+ failed.set(ref.referenceName, [ref.rowId]);
2308
+ }
2309
+ const resolved = new Map();
2310
+ for (const edge of this.queries.getResolvedNavigations()) {
2311
+ const name = edge.metadata?.refName;
2312
+ if (typeof name !== 'string' || fresh.has(edge.sourceFilePath) || !claimed(name, edge.sourceFilePath))
2313
+ continue;
2314
+ const edges = resolved.get(name);
2315
+ if (edges)
2316
+ edges.push(edge);
2317
+ else
2318
+ resolved.set(name, [edge]);
2319
+ }
2320
+ const rowIds = [];
2321
+ const edgeIds = [];
2322
+ const refs = [];
2323
+ const sites = new Set();
2324
+ for (const name of new Set([...failed.keys(), ...resolved.keys()])) {
2325
+ const rows = failed.get(name) ?? [];
2326
+ const edges = resolved.get(name) ?? [];
2327
+ if (rows.length + edges.length > perNameCeiling)
2328
+ continue;
2329
+ for (const rowId of rows)
2330
+ rowIds.push(rowId);
2331
+ for (const edge of edges) {
2332
+ const ref = (0, resurrect_ref_1.resurrectRefFromDroppedEdge)(edge);
2333
+ if (!ref)
2334
+ continue;
2335
+ edgeIds.push(edge.edgeId);
2336
+ const site = `${ref.fromNodeId}\0${ref.referenceName}\0${ref.line}\0${ref.column}`;
2337
+ if (sites.has(site))
2338
+ continue;
2339
+ sites.add(site);
2340
+ refs.push(ref);
2341
+ }
2342
+ }
2343
+ if (edgeIds.length > 0)
2344
+ this.queries.replaceResolutionEdgesWithUnresolvedRefs(edgeIds, refs);
2345
+ return this.queries.reopenFailedReferences(rowIds) + refs.length;
2346
+ }
2347
+ changedDefaultExports(modifiedFilePaths, changedFilePaths, resolvedUpToEdgeId) {
2348
+ const fresh = new Set(changedFilePaths);
2349
+ const moved = [];
2350
+ for (const filePath of modifiedFilePaths) {
2351
+ if (!(0, import_resolver_1.isJsFamilyFile)(filePath))
2352
+ continue;
2353
+ const bindings = new Map();
2354
+ for (const i of this.queries.getImportsInto(`file:${filePath}`, filePath)) {
2355
+ if (i.refName === null || fresh.has(i.filePath) || !(0, import_resolver_1.isModuleBindingName)(i.refName))
2356
+ continue;
2357
+ const names = bindings.get(i.filePath) ?? new Set();
2358
+ names.add(i.refName);
2359
+ bindings.set(i.filePath, names);
2360
+ }
2361
+ if (bindings.size === 0)
2362
+ continue;
2363
+ const language = this.queries.getFileByPath(filePath)?.language;
2364
+ if (!language)
2365
+ continue;
2366
+ const readsDefault = (e) => {
2367
+ const name = e.metadata?.refName;
2368
+ return typeof name === 'string' && e.metadata?.resolvedBy === 'import' && e.edgeId <= resolvedUpToEdgeId &&
2369
+ !e.target.startsWith('file:') && bindings.get(e.sourceFilePath)?.has(name) === true;
2370
+ };
2371
+ let readers = this.queries.getCrossFileIncomingEdgesWithTarget(filePath).filter(readsDefault);
2372
+ if (readers.length === 0) {
2373
+ const now = (0, import_resolver_1.moduleDefaultExport)(filePath, language, this.context);
2374
+ if (!now || now.filePath === filePath)
2375
+ continue;
2376
+ readers = [...bindings].slice(0, DEFAULT_READER_SAMPLE_FILES)
2377
+ .flatMap(([file, names]) => this.queries.getResolutionEdgesThrough(file, [...names]))
2378
+ .filter(readsDefault);
2379
+ }
2380
+ const was = new Set();
2381
+ for (const e of readers) {
2382
+ const now = (0, import_resolver_1.moduleDefaultExport)(filePath, e.sourceLanguage, this.context);
2383
+ if (now && (e.target === now.id || (e.kind === 'calls' && (0, alias_binding_1.resolveAliasBinding)(now, null, this.context)?.id === e.target)))
2384
+ continue;
2385
+ was.add(e.target);
2386
+ }
2387
+ if (was.size > 0)
2388
+ moved.push({ path: filePath, language, was: [...was] });
2389
+ }
2390
+ return moved;
2391
+ }
2392
+ couldNameAnyOf(files) {
2393
+ const added = new Set(files);
2394
+ const names = new Set(files.map((file) => file.slice(file.lastIndexOf('/') + 1)));
2395
+ return (reference) => {
2396
+ const language = reference.language || this.getLanguageFromNodeId(reference.fromNodeId);
2397
+ if (!import_resolver_1.ESM_IMPORT_LANGUAGES.has(language))
2398
+ return false;
2399
+ const ref = {
2400
+ fromNodeId: reference.fromNodeId,
2401
+ referenceName: reference.referenceName,
2402
+ referenceKind: reference.referenceKind,
2403
+ line: reference.line,
2404
+ column: reference.column,
2405
+ filePath: reference.filePath || this.getFilePathFromNodeId(reference.fromNodeId),
2406
+ language,
2407
+ rowId: reference.rowId,
2408
+ };
2409
+ const name = ref.referenceName;
2410
+ if (names.has(name.slice(name.lastIndexOf('/') + 1)))
2411
+ return true;
2412
+ const target = (0, import_resolver_1.resolveImportPath)(name, ref.filePath, language, this.context);
2413
+ if (target !== null && added.has(target) && (0, import_resolver_1.jsModuleFile)(ref, this.context) === target)
2414
+ return true;
2415
+ return name.includes('/') && this.frameworksFor(language).some((framework) => {
2416
+ const result = framework.resolve(ref, this.context);
2417
+ return result !== null && added.has(this.nodeById(result.targetNodeId)?.filePath ?? '');
2418
+ });
2419
+ };
2420
+ }
2274
2421
  isPythonProjectModule(ref, receiver) {
2275
- for (const imp of this.context.getImportMappings(ref.filePath, ref.language)) {
2422
+ const imports = this.context.getImportMappings(ref.filePath, ref.language);
2423
+ if (!imports.some((imp) => imp.localName === receiver))
2424
+ return false;
2425
+ const local = (0, name_matcher_1.pythonFunctionModuleAlias)(receiver, ref, this.context);
2426
+ if (local)
2427
+ return (0, import_resolver_1.resolveImportPath)(local, ref.filePath, ref.language, this.context) !== null;
2428
+ for (const imp of (0, import_resolver_1.pythonImportsInScope)(ref, imports, this.context)) {
2276
2429
  if (imp.localName !== receiver)
2277
2430
  continue;
2278
- // `import pkg.mod` / `import pkg.mod as m` binds the module `source`
2279
- // names. `from pkg import mod` binds `pkg.mod`, and `from . import mod`
2280
- // binds `.mod` — join without doubling the dot that makes `.` mean the
2281
- // current package.
2282
2431
  const specifier = imp.isNamespace
2283
2432
  ? imp.source
2284
2433
  : imp.source.endsWith('.')
@@ -2290,61 +2439,48 @@ class ReferenceResolver {
2290
2439
  }
2291
2440
  return false;
2292
2441
  }
2293
- /**
2294
- * Check if reference is to a built-in or external symbol
2295
- */
2442
+ isPythonBuiltinNamedMethodCall(ref) {
2443
+ if (ref.language !== 'python' || ref.referenceKind !== 'calls')
2444
+ return false;
2445
+ const dot = ref.referenceName.indexOf('.');
2446
+ return dot > 0 && PYTHON_BUILT_IN_METHODS.has(ref.referenceName.slice(dot + 1)) &&
2447
+ !PYTHON_BUILT_IN_TYPES.has(ref.referenceName.slice(0, dot));
2448
+ }
2449
+ isGoProjectPackage(ref, qualifier) {
2450
+ return this.context
2451
+ .getImportMappings(ref.filePath, ref.language)
2452
+ .some((imp) => imp.localName === qualifier && this.context.getGoPackageDir?.(imp.source, ref.filePath) != null);
2453
+ }
2296
2454
  isBuiltInOrExternal(ref) {
2297
2455
  const name = ref.referenceName;
2298
2456
  const isJsTs = ref.language === 'typescript' || ref.language === 'javascript'
2299
2457
  || ref.language === 'tsx' || ref.language === 'jsx' || ref.language === 'arkts'
2300
2458
  || ref.language === 'vue' || ref.language === 'svelte' || ref.language === 'astro';
2301
- // JavaScript/TypeScript built-ins — unless the file imports its own
2302
- // binding of that name (`import Map from './Map.svelte'`).
2303
2459
  if (isJsTs && js_builtins_1.JS_BUILT_INS.has(name) &&
2304
2460
  !this.context.getImportMappings(ref.filePath, ref.language).some((m) => m.localName === name)) {
2305
2461
  return true;
2306
2462
  }
2307
- // ArkTS resource-reference intrinsics — `$r('app.string.x')` /
2308
- // `$rawfile('x.png')` are framework-provided and appear dozens of times
2309
- // per UI file; without this they can resolve to a stray same-named
2310
- // symbol (e.g. a checked-in hvigor wrapper's `$r`).
2311
2463
  if (ref.language === 'arkts' && (name === '$r' || name === '$rawfile')) {
2312
2464
  return true;
2313
2465
  }
2314
- // Common JS/TS library calls (console.log, Math.floor, JSON.parse)
2315
2466
  if (isJsTs && (name.startsWith('console.') || name.startsWith('Math.') || name.startsWith('JSON.'))) {
2316
2467
  return true;
2317
2468
  }
2318
- // React hooks from React itself
2319
2469
  if (isJsTs && REACT_HOOKS.has(name)) {
2320
2470
  return true;
2321
2471
  }
2322
- // Python built-ins (bare calls only — dotted calls like console.print are method calls)
2323
2472
  if (ref.language === 'python' && PYTHON_BUILT_INS.has(name)) {
2324
2473
  return true;
2325
2474
  }
2326
- // Python built-in method calls (e.g., list.extend, dict.update)
2327
2475
  if (ref.language === 'python') {
2328
2476
  const dotIdx = name.indexOf('.');
2329
2477
  if (dotIdx > 0) {
2330
2478
  const receiver = name.substring(0, dotIdx);
2331
2479
  const method = name.substring(dotIdx + 1);
2332
- // Filter calls on built-in types (list.append, dict.update, etc.)
2333
2480
  if (PYTHON_BUILT_IN_TYPES.has(receiver)) {
2334
2481
  return true;
2335
2482
  }
2336
- // Filter built-in methods on non-class receivers
2337
- // (e.g., items.append where items is a local list variable)
2338
- // But allow if the capitalized receiver matches a known codebase class,
2339
- // OR the receiver is itself an imported project module — a module can
2340
- // export a top-level function sharing a common collection-method name
2341
- // (`ledger.append`, `from . import ledger`), and that call is a real
2342
- // project dependency, not `list.append` (#1681). Without this, the
2343
- // qualified ref never reaches resolveViaImport / resolvePythonModuleMember.
2344
2483
  if (PYTHON_BUILT_IN_METHODS.has(method)) {
2345
- // A module-scope collection binding is stronger evidence than a
2346
- // coincidentally matching class name (#1652). Only use this file's
2347
- // binding: an unrelated module may reuse the receiver for a collection.
2348
2484
  const isCollection = this.context.getNodesByName(receiver).some((node) => node.language === 'python' && node.filePath === ref.filePath &&
2349
2485
  (node.kind === 'variable' || node.kind === 'constant') &&
2350
2486
  node.qualifiedName === receiver &&
@@ -2360,21 +2496,16 @@ class ReferenceResolver {
2360
2496
  }
2361
2497
  }
2362
2498
  }
2363
- // A bare name colliding with a builtin method (index, get, update, count…)
2364
- // is only a builtin when NOTHING in the codebase declares it. A declared
2365
- // symbol with that exact name — e.g. a Flask/FastAPI view `def index()` or
2366
- // `def get()` — is a real reference target. Without this guard, every
2367
- // handler named after a builtin method silently loses its route→handler edge.
2368
2499
  if (PYTHON_BUILT_IN_METHODS.has(name) && !this.knownNames?.has(name)) {
2369
2500
  return true;
2370
2501
  }
2371
2502
  }
2372
- // Go standard library packages — refs like "fmt.Println", "http.ListenAndServe", etc.
2373
2503
  if (ref.language === 'go') {
2374
2504
  const dotIdx = name.indexOf('.');
2375
- if (dotIdx > 0) {
2505
+ if (dotIdx > 0 && !this.isGoProjectPackage(ref, name.substring(0, dotIdx))) {
2376
2506
  const pkg = name.substring(0, dotIdx);
2377
- if (GO_STDLIB_PACKAGES.has(pkg)) {
2507
+ if (name_matcher_1.GO_STDLIB_PACKAGES.has(pkg) && !(0, name_matcher_1.isGoAssertedLocal)(pkg, ref, this.context) &&
2508
+ !(0, name_matcher_1.isGoProjectLocalCall)(ref, this.context)) {
2378
2509
  return true;
2379
2510
  }
2380
2511
  }
@@ -2382,54 +2513,33 @@ class ReferenceResolver {
2382
2513
  return true;
2383
2514
  }
2384
2515
  }
2385
- // Pascal/Delphi built-ins and standard library units
2386
2516
  if (ref.language === 'pascal') {
2387
- if (PASCAL_UNIT_PREFIXES.some((p) => name.startsWith(p))) {
2517
+ const lower = name.toLowerCase();
2518
+ if (PASCAL_UNIT_PREFIXES.some((p) => name.startsWith(p)) || lower.startsWith('system.')) {
2388
2519
  return true;
2389
2520
  }
2390
- if (PASCAL_BUILT_INS.has(name)) {
2521
+ if (PASCAL_BUILT_INS.has(lower)) {
2391
2522
  return true;
2392
2523
  }
2393
2524
  }
2394
- // C/C++ standard library symbols (printf, malloc, std::vector, etc.).
2395
- // Names that collide with user-defined symbols are NOT filtered —
2396
- // C and C++ projects routinely shadow stdlib names (custom allocators
2397
- // define `malloc`/`free`, stream wrappers define `read`/`write`/`open`,
2398
- // containers define `move`/`swap`, logging libs wrap `printf`). Killing
2399
- // those resolutions makes the graph wrong, not cleaner. We only filter
2400
- // when there's no user node with this name — then name-matching would
2401
- // produce zero edges anyway and the filter just short-circuits work.
2402
2525
  if (ref.language === 'c' || ref.language === 'cpp') {
2403
- // C++ std:: namespace prefix — safe to filter unconditionally,
2404
- // since `std::foo` is never a user-defined qualified name in
2405
- // tree-sitter output.
2406
- if (name.startsWith('std::'))
2526
+ const scoped = name.startsWith('::') ? name.slice(2) : name;
2527
+ if (scoped.startsWith('std::'))
2407
2528
  return true;
2408
- if (C_BUILT_INS.has(name) || CPP_BUILT_INS.has(name)) {
2409
- return !this.hasAnyPossibleMatch(name);
2529
+ if (C_BUILT_INS.has(scoped) || CPP_BUILT_INS.has(scoped)) {
2530
+ return !this.hasAnyPossibleMatch(scoped);
2410
2531
  }
2411
2532
  }
2412
2533
  return false;
2413
2534
  }
2414
- /**
2415
- * Get file path from node ID
2416
- */
2417
2535
  getFilePathFromNodeId(nodeId) {
2418
2536
  const node = this.nodeById(nodeId);
2419
2537
  return node?.filePath || '';
2420
2538
  }
2421
- /**
2422
- * Get language from node ID
2423
- */
2424
2539
  getLanguageFromNodeId(nodeId) {
2425
2540
  const node = this.nodeById(nodeId);
2426
2541
  return node?.language || 'unknown';
2427
2542
  }
2428
- /**
2429
- * Collect the `@using` namespaces in scope for a `.razor`/`.cshtml` file: its
2430
- * own `@using` directives plus every `_Imports.razor` from the file's folder up
2431
- * to the project root (Razor `_Imports` cascade). Cached per file.
2432
- */
2433
2543
  getRazorUsings(filePath) {
2434
2544
  const cached = this.razorUsingsCache.get(filePath);
2435
2545
  if (cached)
@@ -2443,7 +2553,6 @@ class ReferenceResolver {
2443
2553
  };
2444
2554
  addFrom(this.context.readFile(filePath));
2445
2555
  let dir = filePath.includes('/') ? filePath.slice(0, filePath.lastIndexOf('/')) : '';
2446
- // Walk up to the project root, reading each level's _Imports.razor.
2447
2556
  for (;;) {
2448
2557
  addFrom(this.context.readFile(dir ? `${dir}/_Imports.razor` : '_Imports.razor'));
2449
2558
  if (!dir)
@@ -2455,13 +2564,6 @@ class ReferenceResolver {
2455
2564
  this.razorUsingsCache.set(filePath, arr);
2456
2565
  return arr;
2457
2566
  }
2458
- /**
2459
- * Resolve a Razor/Blazor simple type ref through the file's `@using`
2460
- * namespaces: `CatalogBrand` + `@using BlazorShared.Models` → the node whose
2461
- * qualified name is `BlazorShared.Models::CatalogBrand`. Only resolves when the
2462
- * `@using` set yields exactly ONE type (otherwise it stays ambiguous and falls
2463
- * through to name-matching).
2464
- */
2465
2567
  resolveRazorUsing(ref) {
2466
2568
  if (ref.referenceName.includes('.') || ref.referenceName.includes('::'))
2467
2569
  return null;
@@ -2479,37 +2581,12 @@ class ReferenceResolver {
2479
2581
  const target = found.values().next().value;
2480
2582
  return { original: ref, targetNodeId: target.id, confidence: 0.9, resolvedBy: 'import' };
2481
2583
  }
2482
- /**
2483
- * Resolve a CFML inheritance reference written as a component path (#1152).
2484
- * Two forms exist in real code:
2485
- *
2486
- * - Dotted: `extends="coldbox.system.web.Controller"` — dots are directory
2487
- * separators from the webroot or a CFML mapping. Mappings live in server
2488
- * config / Application.cfc, so the leading segments may not exist in the
2489
- * repo at all (in the coldbox repo itself the path is `system/web/
2490
- * Controller.cfc` — the `coldbox.` root IS the repo). Matched by final
2491
- * segment (the class), corroborated right-to-left against the candidate's
2492
- * parent directories.
2493
- * - Relative: `extends="../base"` / `extends="./base"` (the FW/1 style) —
2494
- * resolved against the referencing file's own directory.
2495
- *
2496
- * Conservative by design: a candidate needs at least one corroborating
2497
- * directory segment (a dotted path whose only same-named class sits in an
2498
- * unrelated directory is almost always an out-of-repo library supertype —
2499
- * mxunit/testbox/coldbox-as-dependency), and a corroboration tie yields no
2500
- * edge. Directory comparison is case-insensitive (CFML path resolution is);
2501
- * the class segment itself is matched exactly, which real code satisfies —
2502
- * dotted paths are written to match the on-disk file name.
2503
- */
2504
2584
  resolveCfmlComponentPath(ref) {
2505
2585
  const cfmlCandidates = (name) => this.context
2506
2586
  .getNodesByName(name)
2507
2587
  .filter((n) => (n.kind === 'class' || n.kind === 'interface') &&
2508
2588
  (n.language === 'cfml' || n.language === 'cfscript'));
2509
2589
  const norm = (p) => p.replace(/\\/g, '/').toLowerCase();
2510
- // Relative-path form: `../base`, `./base`, `sub/thing` — resolve against
2511
- // the referencing file's directory and require an exact (case-insensitive)
2512
- // file match.
2513
2590
  if (ref.referenceName.includes('/')) {
2514
2591
  const rel = ref.referenceName.replace(/\.cfc$/i, '');
2515
2592
  const fromDir = ref.filePath.replace(/\\/g, '/').split('/').slice(0, -1);
@@ -2519,7 +2596,7 @@ class ReferenceResolver {
2519
2596
  continue;
2520
2597
  if (seg === '..') {
2521
2598
  if (parts.length === 0)
2522
- return null; // escapes the project root
2599
+ return null;
2523
2600
  parts.pop();
2524
2601
  }
2525
2602
  else {
@@ -2535,20 +2612,18 @@ class ReferenceResolver {
2535
2612
  ? { original: ref, targetNodeId: target.id, confidence: 0.95, resolvedBy: 'file-path' }
2536
2613
  : null;
2537
2614
  }
2538
- // Dotted form.
2539
2615
  const segments = ref.referenceName.split('.').map((s) => s.trim()).filter(Boolean);
2540
2616
  if (segments.length < 2)
2541
2617
  return null;
2542
2618
  const className = segments[segments.length - 1];
2543
2619
  const dirSegments = segments.slice(0, -1);
2544
- let best = null;
2620
+ const fromTest = (0, query_utils_1.isTestPath)(ref.filePath);
2545
2621
  let bestScore = 0;
2546
- let tie = false;
2622
+ let tied = [];
2547
2623
  for (const cand of cfmlCandidates(className)) {
2624
+ if (!fromTest && (0, name_matcher_1.isTestSuitePath)(cand.filePath))
2625
+ continue;
2548
2626
  const dirs = cand.filePath.replace(/\\/g, '/').split('/').slice(0, -1);
2549
- // Count matching directory segments right-to-left: for
2550
- // `coldbox.system.web.Controller` vs `system/web/Controller.cfc`,
2551
- // `web` and `system` match, then the repo root ends the run → score 2.
2552
2627
  let score = 0;
2553
2628
  while (score < dirSegments.length &&
2554
2629
  score < dirs.length &&
@@ -2556,38 +2631,99 @@ class ReferenceResolver {
2556
2631
  dirs[dirs.length - 1 - score].toLowerCase()) {
2557
2632
  score++;
2558
2633
  }
2634
+ if (score === 0 && dirs.length === 0 && dirSegments.length === 1 &&
2635
+ cand.filePath.replace(/\.cfc$/i, '').toLowerCase() === className.toLowerCase()) {
2636
+ score = 0.5;
2637
+ }
2559
2638
  if (score > bestScore) {
2560
- best = cand;
2561
2639
  bestScore = score;
2562
- tie = false;
2640
+ tied = [cand];
2563
2641
  }
2564
2642
  else if (score === bestScore && score > 0) {
2565
- tie = true;
2643
+ tied.push(cand);
2566
2644
  }
2567
2645
  }
2568
- if (!best || bestScore === 0 || tie)
2646
+ if (tied.length > 1)
2647
+ tied = tied.filter((c) => !(0, name_matcher_1.isTestSuitePath)(c.filePath));
2648
+ if (bestScore === 0 || tied.length !== 1)
2569
2649
  return null;
2570
- return { original: ref, targetNodeId: best.id, confidence: 0.9, resolvedBy: 'qualified-name' };
2571
- }
2572
- /**
2573
- * Resolve a `this.<member>` function-as-value reference (#756/#808) to the
2574
- * ENCLOSING CLASS's own member — never a same-named symbol elsewhere. The
2575
- * registration idiom (`btn.on('click', this.handleClick)`) names a member
2576
- * of the class being defined, so the only valid target shares the
2577
- * from-symbol's qualified-name scope. Function/method targets only — a
2578
- * property (a data field, post-#808 classification) yields no edge — same
2579
- * file required, no fallback of any kind.
2580
- */
2650
+ return { original: ref, targetNodeId: tied[0].id, confidence: bestScore >= 1 ? 0.9 : 0.8, resolvedBy: 'qualified-name' };
2651
+ }
2652
+ resolveCfmlConstructedCall(ref) {
2653
+ const match = CFML_CONSTRUCTED_CALL.exec(ref.referenceName);
2654
+ if (!match)
2655
+ return null;
2656
+ const component = match[1];
2657
+ const cls = component.includes('.')
2658
+ ? this.nodeById(this.resolveCfmlComponentPath({ ...ref, referenceName: component, referenceKind: 'instantiates' })?.targetNodeId ?? '')
2659
+ : this.cfmlComponentByName(component, ref.filePath);
2660
+ const method = cls ? this.cfmlMethodOf(cls, match[2].toLowerCase(), new Set()) : undefined;
2661
+ return method ? { original: ref, targetNodeId: method.id, confidence: 0.9, resolvedBy: 'instance-method' } : null;
2662
+ }
2663
+ cfmlComponentByName(name, fromFile) {
2664
+ const components = this.context
2665
+ .getNodesByLowerName(name.toLowerCase())
2666
+ .filter((n) => (n.kind === 'class' || n.kind === 'interface') && (n.language === 'cfml' || n.language === 'cfscript'));
2667
+ const dirOf = (p) => p.slice(0, p.lastIndexOf('/') + 1);
2668
+ const beside = components.filter((n) => dirOf(n.filePath) === dirOf(fromFile));
2669
+ if (beside.length === 1)
2670
+ return beside[0];
2671
+ return components.length === 1 ? components[0] : undefined;
2672
+ }
2673
+ cfmlMethodOf(cls, lowerName, seen) {
2674
+ if (seen.has(cls.id) || seen.size >= 8)
2675
+ return undefined;
2676
+ seen.add(cls.id);
2677
+ const own = this.context.getNodesInFile(cls.filePath).find((n) => n.kind === 'method' &&
2678
+ n.name.toLowerCase() === lowerName &&
2679
+ n.qualifiedName.toLowerCase() === `${cls.name}::${n.name}`.toLowerCase() &&
2680
+ n.startLine >= cls.startLine && n.endLine <= cls.endLine);
2681
+ if (own)
2682
+ return own;
2683
+ for (const supertype of this.context.getSupertypeNodes?.(cls.id) ?? []) {
2684
+ const inherited = this.cfmlMethodOf(supertype, lowerName, seen);
2685
+ if (inherited)
2686
+ return inherited;
2687
+ }
2688
+ return undefined;
2689
+ }
2690
+ resolveCfmlIncludePath(ref) {
2691
+ const written = ref.referenceName.trim().replace(/\\/g, '/');
2692
+ const fromRoot = written.startsWith('/');
2693
+ const parts = fromRoot ? [] : ref.filePath.replace(/\\/g, '/').split('/').slice(0, -1);
2694
+ for (const seg of written.split('/')) {
2695
+ if (seg === '' || seg === '.')
2696
+ continue;
2697
+ if (seg === '..') {
2698
+ if (parts.length === 0)
2699
+ return null;
2700
+ parts.pop();
2701
+ }
2702
+ else {
2703
+ parts.push(seg);
2704
+ }
2705
+ }
2706
+ const fileName = parts[parts.length - 1];
2707
+ if (!fileName)
2708
+ return null;
2709
+ const wanted = parts.join('/');
2710
+ const files = this.context.getNodesByLowerName(fileName.toLowerCase()).filter((n) => n.kind === 'file');
2711
+ const exact = files.find((n) => n.filePath === wanted);
2712
+ if (exact)
2713
+ return { original: ref, targetNodeId: exact.id, confidence: fromRoot ? 0.85 : 0.95, resolvedBy: 'file-path' };
2714
+ const folded = files.filter((n) => n.filePath.toLowerCase() === wanted.toLowerCase());
2715
+ return folded.length === 1
2716
+ ? { original: ref, targetNodeId: folded[0].id, confidence: fromRoot ? 0.8 : 0.9, resolvedBy: 'file-path' }
2717
+ : null;
2718
+ }
2581
2719
  resolveThisMemberFnRef(ref) {
2582
2720
  const member = ref.referenceName.slice('this.'.length);
2583
2721
  if (!member)
2584
2722
  return null;
2585
- const fromNode = this.nodeById(ref.fromNodeId);
2586
- if (!fromNode)
2723
+ const written = this.nodeById(ref.fromNodeId);
2724
+ if (!written)
2587
2725
  return null;
2588
- // A hook declared at class-body level (Ruby `before_action :authenticate`)
2589
- // attributes to the CLASS node itself — its qualified name IS the scope.
2590
- // For members, strip the member segment.
2726
+ const fromNode = (0, name_matcher_1.thisScopeCaller)(written, this.context);
2591
2727
  let classPrefix;
2592
2728
  if (SUPERTYPE_BEARING_KINDS.has(fromNode.kind) || fromNode.kind === 'module') {
2593
2729
  classPrefix = fromNode.qualifiedName;
@@ -2595,7 +2731,7 @@ class ReferenceResolver {
2595
2731
  else {
2596
2732
  const sep = fromNode.qualifiedName.lastIndexOf('::');
2597
2733
  if (sep <= 0)
2598
- return null; // not inside a class scope
2734
+ return null;
2599
2735
  classPrefix = fromNode.qualifiedName.slice(0, sep);
2600
2736
  }
2601
2737
  const candidates = this.context
@@ -2604,9 +2740,6 @@ class ReferenceResolver {
2604
2740
  n.filePath === ref.filePath &&
2605
2741
  n.id !== ref.fromNodeId);
2606
2742
  if (candidates.length === 0) {
2607
- // Not on the class itself — possibly INHERITED. implements/extends
2608
- // edges don't exist yet in this pass, so retry in the supertype pass
2609
- // (resolveDeferredThisMemberRefs) instead of giving up.
2610
2743
  this.deferReference(ref, this.deferredThisMemberRefs);
2611
2744
  return null;
2612
2745
  }
@@ -2618,29 +2751,14 @@ class ReferenceResolver {
2618
2751
  resolvedBy: 'function-ref',
2619
2752
  };
2620
2753
  }
2621
- /**
2622
- * Second pass for `this.<member>` refs whose member wasn't on the enclosing
2623
- * class itself (#808): once implements/extends edges exist, walk the
2624
- * class's supertypes (transitively, depth-capped) and resolve the member on
2625
- * the nearest one that declares it — `this.handleSubmit` registered in a
2626
- * subclass resolves to `FormBase::handleSubmit`. Validated targets only
2627
- * (function/method kind, same language family); no match → no edge.
2628
- * Mirrors resolveChainedCallsViaConformance's lifecycle. Returns the number
2629
- * of newly-created edges.
2630
- */
2631
2754
  async resolveDeferredThisMemberRefs() {
2632
2755
  const deferred = this.deferredThisMemberRefs;
2633
2756
  this.deferredThisMemberRefs = [];
2634
2757
  if (deferred.length === 0)
2635
2758
  return 0;
2636
2759
  this.clearCaches();
2637
- // Synchronous main-thread post-pass with a per-ref supertype BFS — yield
2638
- // periodically so the #850 liveness watchdog heartbeat can fire (#1091).
2639
2760
  const maybeYield = (0, cooperative_yield_1.createYielder)();
2640
2761
  const resolved = [];
2641
- // Refs share supertypes (every `this.dispose` walks the same chain), and
2642
- // nothing is written until the loop ends: read each type's supertype
2643
- // edges, and each supertype's callable members by name, once.
2644
2762
  const supertypeEdges = new Map();
2645
2763
  const callableMembers = new Map();
2646
2764
  const supertypesOf = (id) => {
@@ -2672,10 +2790,10 @@ class ReferenceResolver {
2672
2790
  for (const ref of deferred) {
2673
2791
  await maybeYield();
2674
2792
  const member = ref.referenceName.slice('this.'.length);
2675
- const fromNode = this.nodeById(ref.fromNodeId);
2676
- if (!fromNode || !member)
2793
+ const written = this.nodeById(ref.fromNodeId);
2794
+ if (!written || !member)
2677
2795
  continue;
2678
- // Class-body-level hooks (Ruby) attribute to the CLASS node itself.
2796
+ const fromNode = (0, name_matcher_1.thisScopeCaller)(written, this.context);
2679
2797
  let className;
2680
2798
  if (SUPERTYPE_BEARING_KINDS.has(fromNode.kind) || fromNode.kind === 'module') {
2681
2799
  className = fromNode.name;
@@ -2689,19 +2807,11 @@ class ReferenceResolver {
2689
2807
  ? classPrefix.slice(classPrefix.lastIndexOf('::') + 2)
2690
2808
  : classPrefix;
2691
2809
  }
2692
- // NODE-anchored BFS up the supertype graph: start from the class node
2693
- // in the ref's own file (never a same-named class elsewhere — rails has
2694
- // a dozen `Engine`s), follow implements/extends EDGES to supertype
2695
- // NODES, and look members up through `contains` edges. No name-based
2696
- // unions anywhere — a name-keyed getSupertypes('Engine') merged every
2697
- // Engine's parents and produced a cross-class wrong edge on rails.
2698
2810
  let frontierNodes = this.context
2699
2811
  .getNodesByName(className)
2700
2812
  .filter((n) => SUPERTYPE_BEARING_KINDS.has(n.kind) &&
2701
2813
  n.filePath === ref.filePath);
2702
2814
  if (frontierNodes.length === 0) {
2703
- // The class itself may be declared in another file (partial/reopened
2704
- // classes); fall back to same-family nodes of that name.
2705
2815
  frontierNodes = this.context
2706
2816
  .getNodesByName(className)
2707
2817
  .filter((n) => SUPERTYPE_BEARING_KINDS.has(n.kind) &&
@@ -2719,7 +2829,6 @@ class ReferenceResolver {
2719
2829
  seenNodes.add(superNode.id);
2720
2830
  if (!SUPERTYPE_BEARING_KINDS.has(superNode.kind))
2721
2831
  continue;
2722
- // Member lookup anchored on the supertype's contains edges.
2723
2832
  target =
2724
2833
  callableMembersOf(superNode.id)
2725
2834
  .get(member)
@@ -2744,53 +2853,42 @@ class ReferenceResolver {
2744
2853
  }
2745
2854
  return this.persistDeferredReferences(deferred, resolved);
2746
2855
  }
2747
- /**
2748
- * Drop a resolution whose target cannot be what the reference names.
2749
- * Applied at the `resolveOne` seam so it covers every strategy uniformly —
2750
- * framework, import, name-match, chain, CFML component path.
2751
- *
2752
- * For `imports`: the target must be importable. A member that only exists
2753
- * inside a type never is.
2754
- *
2755
- * For `extends`/`implements`, it cannot be describing a real supertype when:
2756
- *
2757
- * 1. The target's kind can never be a supertype (an enum member, a method,
2758
- * a variable). `matchByExactName` additionally narrows its candidate
2759
- * pool by the same set, so a legitimate supertype outranks a same-named
2760
- * non-type rather than merely losing its edge.
2761
- * 2. The name is imported from outside the repo, so NO local node is the
2762
- * referent. Without this, filtering by kind alone just relocates the
2763
- * false edge onto the next same-named local type.
2764
- *
2765
- * One exception to (1): a TypeScript VALUE that shares its name with a type
2766
- * in the same file. `export const IFoo = createDecorator<IFoo>('foo')` beside
2767
- * `export interface IFoo` is how VS Code declares every service, and an
2768
- * import of `IFoo` resolves to the file with both — a strategy that takes the
2769
- * first export of that name gets the value. The strategy found the right
2770
- * file and name; the type declared there is the supertype, so the edge moves
2771
- * to it rather than being dropped (dropping it lost ~900 `implements` edges
2772
- * on vscode).
2773
- *
2774
- * Otherwise this only ever REMOVES an edge, never adds one. A dropped ref
2775
- * stays in `unresolved_refs` as `failed`, which is the honest record for a
2776
- * supertype that lives outside the repo — silent beats wrong.
2777
- */
2778
2856
  gateTargetKind(result, ref) {
2779
2857
  if (!result)
2780
2858
  return result;
2781
- // A `#define` is a value, never a callee (#1838): a macro defined only in
2782
- // an unrelated file is not what `NAME(x)` here expands to either.
2859
+ if (ref.language === 'go' && (ref.referenceKind === 'calls' || ref.referenceKind === 'function_ref') &&
2860
+ (0, name_matcher_1.isGoBareName)(ref, this.context) && (0, name_matcher_1.isGoLocallyBound)(ref, this.context))
2861
+ return null;
2783
2862
  if (ref.referenceKind === 'calls') {
2784
2863
  const target = this.nodeById(result.targetNodeId);
2785
2864
  if (target?.kind === 'constant' && types_1.CPP_DEFINE_SIGNATURE.test(target.signature ?? ''))
2786
2865
  return null;
2866
+ if (target && ref.language === 'go' && name_matcher_1.GO_TYPE_KINDS.has(target.kind) &&
2867
+ !ref.referenceName.includes('.') && !(0, name_matcher_1.isGoBareName)(ref, this.context))
2868
+ return null;
2869
+ }
2870
+ if ((ref.referenceKind === 'calls' || ref.referenceKind === 'instantiates') && import_resolver_1.ESM_IMPORT_LANGUAGES.has(ref.language)) {
2871
+ const target = this.nodeById(result.targetNodeId);
2872
+ if (target && (target.kind === 'interface' || target.kind === 'type_alias')) {
2873
+ const value = this.sameNamedValueOfType(target);
2874
+ if (!value)
2875
+ return null;
2876
+ result = { ...result, targetNodeId: value.id };
2877
+ }
2787
2878
  }
2788
- // An `imports` reference names something importable — never a member that
2789
- // only exists inside a type.
2790
2879
  if (ref.referenceKind === 'imports') {
2791
2880
  const target = this.nodeById(result.targetNodeId);
2881
+ if (target?.kind === 'import' && target.filePath === ref.filePath)
2882
+ return null;
2792
2883
  return target && !(0, types_1.isImportableKind)(target.kind) ? null : result;
2793
2884
  }
2885
+ if (ref.language === 'go' && ref.referenceKind === 'references' &&
2886
+ name_matcher_1.GO_TYPE_KINDS.has(this.nodeById(ref.fromNodeId)?.kind ?? '') && (0, name_matcher_1.isGoUnknownQualified)(ref, this.context))
2887
+ return null;
2888
+ if (ref.language === 'go' && (ref.referenceKind === 'instantiates' ||
2889
+ (ref.referenceKind === 'references' && this.nodeById(ref.fromNodeId)?.kind !== 'route'))) {
2890
+ return (0, name_matcher_1.goTypePositionTarget)(result, ref, this.context);
2891
+ }
2794
2892
  if (!(0, types_1.isInheritanceRef)(ref))
2795
2893
  return result;
2796
2894
  const target = this.nodeById(result.targetNodeId);
@@ -2800,24 +2898,19 @@ class ReferenceResolver {
2800
2898
  return null;
2801
2899
  result = { ...result, targetNodeId: type.id };
2802
2900
  }
2803
- if ((0, import_resolver_1.isBoundToOutOfRepoImport)(ref, this.context))
2901
+ if ((0, import_resolver_1.isBoundToOutOfRepoImport)(ref, this.context, target))
2804
2902
  return null;
2903
+ if (ref.language === 'go' && (0, name_matcher_1.isGoUnknownQualified)(ref, this.context))
2904
+ return null;
2905
+ if (ref.language === 'go')
2906
+ return (0, name_matcher_1.goDotImportedSupertype)(result, ref, this.context);
2805
2907
  return result;
2806
2908
  }
2807
- /**
2808
- * `super.didMoveToWindow()` inside an override of `didMoveToWindow` calls
2809
- * the PARENT's implementation, never the method making the call. Extraction
2810
- * keeps a `super` call under the bare method name, so every strategy found
2811
- * the enclosing method itself: one expo-camera view had eleven of its
2812
- * overrides "calling" themselves. The parent's method is usually a
2813
- * framework's (UIKit, Android, React); a self-edge is never it. Real
2814
- * recursion keeps its edge — only a call written through `super` / `base`
2815
- * (C#) / `[super …]` (Objective-C) / `parent::` (PHP) / `super().` (Python)
2816
- * is declined.
2817
- */
2818
2909
  gateSuperSelfCall(result, ref) {
2819
2910
  if (!result || ref.referenceKind !== 'calls' || result.targetNodeId !== ref.fromNodeId)
2820
2911
  return result;
2912
+ if ((0, js_super_calls_1.isJsSuperCallLanguage)(ref.language))
2913
+ return (0, js_super_calls_1.isJsSuperCallSite)(ref, this.context) ? null : result;
2821
2914
  const name = ref.referenceName.slice(Math.max(ref.referenceName.lastIndexOf('.'), ref.referenceName.lastIndexOf(':')) + 1);
2822
2915
  if (!/^[A-Za-z_$][\w$]*$/.test(name))
2823
2916
  return result;
@@ -2828,29 +2921,218 @@ class ReferenceResolver {
2828
2921
  const viaSuper = new RegExp(String.raw `(?:\b(?:super|base)\s*(?:\(\s*(?:[\w.]+\s*,\s*\w+)?\s*\))?\s*\??\.\s*|\[\s*super\s+|\bparent\s*::\s*)` + escaped + String.raw `\b`);
2829
2922
  return viaSuper.test(line) ? null : result;
2830
2923
  }
2831
- /**
2832
- * A bare Rust name reaches only what is in scope — every strategy's result,
2833
- * a framework resolver's `Ok(x)` → `struct Ok` construction included (see
2834
- * isRustNameInScope).
2835
- */
2836
2924
  gateRustScope(result, ref) {
2837
- if (!result || ref.language !== 'rust' || !/^[A-Za-z_]\w*$/.test(ref.referenceName))
2925
+ if (!result || ref.language !== 'rust')
2926
+ return result;
2927
+ const bare = /^[A-Za-z_]\w*$/.test(ref.referenceName);
2928
+ if (!bare && ref.referenceKind !== 'calls')
2838
2929
  return result;
2839
2930
  const target = this.nodeById(result.targetNodeId);
2840
- return target && !(0, name_matcher_1.isRustNameInScope)(target, ref, this.context) ? null : result;
2931
+ if (!target)
2932
+ return result;
2933
+ if (bare && !(0, name_matcher_1.isRustNameInScope)(target, ref, this.context))
2934
+ return null;
2935
+ if (ref.referenceKind !== 'calls')
2936
+ return result;
2937
+ if (!bare && !(0, name_matcher_1.isRustPathCallReachable)(target, ref, this.context))
2938
+ return null;
2939
+ return (0, name_matcher_1.isRustForeignImplCallable)(target, ref, this.context) ? result : null;
2940
+ }
2941
+ mocklessContextFor(ref, base) {
2942
+ if ((0, query_utils_1.isTestPath)(ref.filePath))
2943
+ return null;
2944
+ const mocks = this.manualMockNames();
2945
+ if (!mocks)
2946
+ return null;
2947
+ if (this.mocklessContext && this.mocklessBase === base)
2948
+ return this.mocklessContext;
2949
+ const isMock = (n) => (0, name_matcher_1.isManualMockPath)(n.filePath);
2950
+ const real = (nodes) => (nodes.some(isMock) ? nodes.filter((n) => !isMock(n)) : nodes);
2951
+ const byName = new Map();
2952
+ const byLowerName = new Map();
2953
+ const byKind = new Map();
2954
+ const getMethodMatches = base.getMethodMatches;
2955
+ const iterateNodesByKind = base.iterateNodesByKind;
2956
+ this.mocklessBase = base;
2957
+ this.mocklessContext = {
2958
+ ...base,
2959
+ getNodesByName: (name) => {
2960
+ if (!mocks.names.has(name))
2961
+ return base.getNodesByName(name);
2962
+ let nodes = byName.get(name);
2963
+ if (!nodes)
2964
+ byName.set(name, (nodes = real(base.getNodesByName(name))));
2965
+ return nodes;
2966
+ },
2967
+ getNodesByLowerName: (lowerName) => {
2968
+ if (!mocks.lowerNames.has(lowerName))
2969
+ return base.getNodesByLowerName(lowerName);
2970
+ let nodes = byLowerName.get(lowerName);
2971
+ if (!nodes)
2972
+ byLowerName.set(lowerName, (nodes = real(base.getNodesByLowerName(lowerName))));
2973
+ return nodes;
2974
+ },
2975
+ getNodesByQualifiedName: (qualifiedName) => real(base.getNodesByQualifiedName(qualifiedName)),
2976
+ getNodesByKind: (kind) => {
2977
+ let nodes = byKind.get(kind);
2978
+ if (!nodes)
2979
+ byKind.set(kind, (nodes = real(base.getNodesByKind(kind))));
2980
+ return nodes;
2981
+ },
2982
+ getMethodMatches: getMethodMatches
2983
+ ? (typeName, methodName, language) => {
2984
+ const nodes = getMethodMatches(typeName, methodName, language);
2985
+ return mocks.names.has(methodName) ? real(nodes) : nodes;
2986
+ }
2987
+ : undefined,
2988
+ iterateNodesByKind: iterateNodesByKind
2989
+ ? function* (kind) {
2990
+ for (const n of iterateNodesByKind(kind))
2991
+ if (!isMock(n))
2992
+ yield n;
2993
+ }
2994
+ : undefined,
2995
+ };
2996
+ return this.mocklessContext;
2997
+ }
2998
+ mocklessContext = null;
2999
+ mocklessBase = null;
3000
+ manualMocks;
3001
+ manualMockNames() {
3002
+ if (this.manualMocks !== undefined)
3003
+ return this.manualMocks;
3004
+ const files = [...(this.knownFiles ?? this.queries.getAllFilePaths())].filter(name_matcher_1.isManualMockPath);
3005
+ const names = new Set();
3006
+ const lowerNames = new Set();
3007
+ if (files.length > 0) {
3008
+ for (const n of this.queries.getNodesByFiles(files)) {
3009
+ names.add(n.name);
3010
+ lowerNames.add(n.name.toLowerCase());
3011
+ }
3012
+ }
3013
+ this.manualMocks = names.size > 0 ? { names, lowerNames } : null;
3014
+ return this.manualMocks;
3015
+ }
3016
+ classExpressionFreeContextFor(ref, base) {
3017
+ if (!js_class_expressions_1.CLASS_EXPRESSION_REF_LANGUAGES.has(ref.language))
3018
+ return null;
3019
+ const expressions = this.classExpressions();
3020
+ if (!expressions)
3021
+ return null;
3022
+ const dot = ref.referenceName.indexOf('.');
3023
+ const named = expressions.byName.get(dot > 0 ? ref.referenceName.slice(0, dot) : ref.referenceName);
3024
+ const inside = expressions.byFile.get(ref.filePath)?.some((n) => (0, js_class_expressions_1.writtenIn)(n, ref)) ?? false;
3025
+ if (inside && !(named && !named.some((n) => (0, js_class_expressions_1.writtenIn)(n, ref))))
3026
+ return null;
3027
+ let view = this.classExpressionFreeViews.get(base);
3028
+ if (!view) {
3029
+ view = this.classExpressionFreeView(base);
3030
+ this.classExpressionFreeViews.set(base, view);
3031
+ this.classExpressionFreeBases.set(view, base);
3032
+ }
3033
+ return view;
3034
+ }
3035
+ classExpressionFreeView(base) {
3036
+ const { hiddenIds } = this.classExpressions();
3037
+ const hidden = (n) => hiddenIds.has(n.id);
3038
+ const keep = (nodes) => (nodes.some(hidden) ? nodes.filter((n) => !hidden(n)) : nodes);
3039
+ const byKind = new Map();
3040
+ const getMethodMatches = base.getMethodMatches;
3041
+ const iterateNodesByKind = base.iterateNodesByKind;
3042
+ const { files } = this.classExpressions();
3043
+ return {
3044
+ ...base,
3045
+ getNodesByName: (name) => keep(base.getNodesByName(name)),
3046
+ getNodesByLowerName: (lowerName) => keep(base.getNodesByLowerName(lowerName)),
3047
+ getNodesByQualifiedName: (qualifiedName) => keep(base.getNodesByQualifiedName(qualifiedName)),
3048
+ getNodesInFile: (filePath) => (files.has(filePath) ? keep(base.getNodesInFile(filePath)) : base.getNodesInFile(filePath)),
3049
+ getNodesByKind: (kind) => {
3050
+ let nodes = byKind.get(kind);
3051
+ if (!nodes)
3052
+ byKind.set(kind, (nodes = keep(base.getNodesByKind(kind))));
3053
+ return nodes;
3054
+ },
3055
+ getMethodMatches: getMethodMatches
3056
+ ? (typeName, methodName, language) => keep(getMethodMatches(typeName, methodName, language))
3057
+ : undefined,
3058
+ iterateNodesByKind: iterateNodesByKind
3059
+ ? function* (kind) {
3060
+ for (const n of iterateNodesByKind(kind))
3061
+ if (!hidden(n))
3062
+ yield n;
3063
+ }
3064
+ : undefined,
3065
+ };
3066
+ }
3067
+ classExpressionFreeViews = new WeakMap();
3068
+ classExpressionFreeBases = new WeakMap();
3069
+ classExpressionOnlyNames() {
3070
+ if (this.classExpressionOnlyNameSet)
3071
+ return this.classExpressionOnlyNameSet;
3072
+ const only = new Set();
3073
+ const expressions = this.classExpressions();
3074
+ if (expressions) {
3075
+ const names = new Set();
3076
+ for (const id of expressions.hiddenIds) {
3077
+ const n = this.nodeById(id);
3078
+ if (n)
3079
+ names.add(n.name);
3080
+ }
3081
+ for (const name of names) {
3082
+ if (!this.queries.getNodesByName(name).some((n) => !expressions.hiddenIds.has(n.id)))
3083
+ only.add(name);
3084
+ }
3085
+ }
3086
+ this.classExpressionOnlyNameSet = only;
3087
+ return only;
3088
+ }
3089
+ classExpressionOnlyNameSet = null;
3090
+ classExpressionIndex;
3091
+ classExpressions() {
3092
+ if (this.classExpressionIndex !== undefined)
3093
+ return this.classExpressionIndex;
3094
+ const byName = new Map();
3095
+ const byFile = new Map();
3096
+ const byKey = new Map();
3097
+ const files = new Set();
3098
+ const hiddenIds = new Set();
3099
+ const linesOf = (file) => this.context.getFileLines?.(file) ?? this.context.readFile(file)?.split(/\r?\n/) ?? [];
3100
+ for (const n of this.queries.getNodesByKind('class')) {
3101
+ if (!(0, js_class_expressions_1.isJsClassExpression)(n) || (0, js_class_expressions_1.isCommonJsExportedClass)(n, linesOf(n.filePath)))
3102
+ continue;
3103
+ const named = byName.get(n.name);
3104
+ if (named)
3105
+ named.push(n);
3106
+ else
3107
+ byName.set(n.name, [n]);
3108
+ const inFile = byFile.get(n.filePath);
3109
+ if (inFile)
3110
+ inFile.push(n);
3111
+ else
3112
+ byFile.set(n.filePath, [n]);
3113
+ byKey.set(`${n.filePath}\0${n.qualifiedName}`, n);
3114
+ files.add(n.filePath);
3115
+ hiddenIds.add(n.id);
3116
+ }
3117
+ const ownerOf = (member) => {
3118
+ const cut = member.qualifiedName.lastIndexOf('::');
3119
+ return cut > 0 ? byKey.get(`${member.filePath}\0${member.qualifiedName.slice(0, cut)}`) : undefined;
3120
+ };
3121
+ if (files.size > 0) {
3122
+ for (const n of this.queries.getNodesByFiles([...files])) {
3123
+ if ((n.kind === 'method' || n.kind === 'property' || n.kind === 'field') && ownerOf(n))
3124
+ hiddenIds.add(n.id);
3125
+ }
3126
+ }
3127
+ this.classExpressionIndex = byName.size > 0 ? { byName, byFile, files, hiddenIds, ownerOf } : null;
3128
+ return this.classExpressionIndex;
3129
+ }
3130
+ isIndexedFile(filePath) {
3131
+ const normalized = filePath.replace(/\\/g, '/');
3132
+ return this.knownFiles ? this.knownFiles.has(normalized) : this.queries.getFileByPath(normalized) !== null;
2841
3133
  }
2842
- /** The repository's own package name, from its root package.json; null without one. */
2843
- /** Per directory: the package names its package.json and every enclosing one own and depend on. */
2844
3134
  manifestScopes = new Map();
2845
- /**
2846
- * Is `source` a package from outside the repository? Only when the importing
2847
- * file's package.json (or an enclosing one) declares it, or it is a Node
2848
- * built-in or a runtime's virtual module. A specifier nothing declares is
2849
- * an alias this resolver does not know — SvelteKit's `$lib/…`, Nuxt's
2850
- * `~/…`, a nested app's own `@/…` — and stays the project's.
2851
- */
2852
3135
  isDeclaredOutsidePackage(source, fromFile) {
2853
- // Deno's standard library is `@std/…` from JSR.
2854
3136
  if (/^(?:node|bun|jsr|npm|https?):/.test(source) || source.startsWith('@std/') || NODE_BUILTINS.has(source))
2855
3137
  return true;
2856
3138
  const name = source.startsWith('@') ? source.split('/').slice(0, 2).join('/') : source.split('/')[0];
@@ -2860,8 +3142,6 @@ class ReferenceResolver {
2860
3142
  return false;
2861
3143
  if (scope.deps.has(name))
2862
3144
  return true;
2863
- // SvelteKit's `$app/…` and Astro's `astro:…` belong to the framework —
2864
- // unless this repository is that framework.
2865
3145
  const provider = source.startsWith('astro:') ? 'astro' : /^\$(?:app|env|service-worker)(?:\/|$)/.test(source) ? '@sveltejs/kit' : null;
2866
3146
  return provider !== null && !scope.own.has(provider) && !this.context.getWorkspacePackages?.()?.byName.has(provider);
2867
3147
  }
@@ -2882,7 +3162,6 @@ class ReferenceResolver {
2882
3162
  if (!deps || typeof deps !== 'object')
2883
3163
  continue;
2884
3164
  for (const [dep, version] of Object.entries(deps)) {
2885
- // `workspace:*`, `file:../shared`, `link:…`: a package in this repository.
2886
3165
  if (typeof version === 'string' && /^(?:workspace|file|link|portal):/.test(version))
2887
3166
  scope.own.add(dep);
2888
3167
  else
@@ -2891,9 +3170,7 @@ class ReferenceResolver {
2891
3170
  }
2892
3171
  }
2893
3172
  }
2894
- catch { /* no or unreadable package.json */ }
2895
- // A Deno import map names packages the same way — an entry that maps to a
2896
- // registry or a URL, not one that maps to a path in the repository.
3173
+ catch { }
2897
3174
  for (const file of ['deno.json', 'deno.jsonc']) {
2898
3175
  const raw = this.context.readFile(dir ? `${dir}/${file}` : file);
2899
3176
  if (!raw)
@@ -2913,7 +3190,12 @@ class ReferenceResolver {
2913
3190
  this.manifestScopes.set(dir, scope);
2914
3191
  return scope;
2915
3192
  }
2916
- /** The one supertype-kind node a TypeScript value shares its name and file with. */
3193
+ sameNamedValueOfType(type) {
3194
+ return this.context
3195
+ .getNodesInFile(type.filePath)
3196
+ .filter((n) => n.name === type.name && TYPE_COMPANION_VALUE_KINDS.has(n.kind))
3197
+ .sort((a, b) => a.startLine - b.startLine || a.startColumn - b.startColumn)[0] ?? null;
3198
+ }
2917
3199
  sameNamedTypeOfValue(value) {
2918
3200
  if (value.kind !== 'constant' && value.kind !== 'variable')
2919
3201
  return null;
@@ -2929,18 +3211,12 @@ class ReferenceResolver {
2929
3211
  return result;
2930
3212
  return (0, name_matcher_1.gateLanguageMatch)(result, ref, this.context);
2931
3213
  }
2932
- /**
2933
- * Framework calls carry bridge evidence (RN/Expo JS → native). Other
2934
- * framework results obey the same code-family boundary as name matches;
2935
- * markup/config transitions remain open.
2936
- */
2937
3214
  gateFrameworkLanguage(result, ref) {
2938
3215
  if (!result)
2939
3216
  return result;
2940
3217
  if (ref.referenceKind === 'calls')
2941
3218
  return result;
2942
3219
  const tgt = this.getLanguageFromNodeId(result.targetNodeId);
2943
- // Package imports cannot target prose found by a framework's name lookup.
2944
3220
  if (ref.referenceKind === 'imports' && tgt === 'markdown' && ref.language !== 'markdown')
2945
3221
  return null;
2946
3222
  if (tgt && ref.language && (0, name_matcher_1.crossesCodeBoundary)(tgt, ref.language))
@@ -2949,9 +3225,19 @@ class ReferenceResolver {
2949
3225
  }
2950
3226
  }
2951
3227
  exports.ReferenceResolver = ReferenceResolver;
2952
- /**
2953
- * Create a reference resolver instance
2954
- */
3228
+ function isCfmlTemplatePath(name) {
3229
+ return !name.includes(':') && (name.includes('/') || name.includes('\\') || /\.(?:cfml?|cfc|cfs)$/i.test(name.trim()));
3230
+ }
3231
+ function goDirOf(p) {
3232
+ const dir = path.posix.dirname(p.replace(/\\/g, '/'));
3233
+ return dir === '.' || dir === '/' ? '' : dir;
3234
+ }
3235
+ function changedRoutes(before, after) {
3236
+ const key = (route) => `${route.filePath}\0${route.name}`;
3237
+ const beforeKeys = new Set(before.map(key));
3238
+ const afterKeys = new Set(after.map(key));
3239
+ return [...before.filter((route) => !afterKeys.has(key(route))), ...after.filter((route) => !beforeKeys.has(key(route)))];
3240
+ }
2955
3241
  function createResolver(projectRoot, queries) {
2956
3242
  const resolver = new ReferenceResolver(projectRoot, queries);
2957
3243
  resolver.initialize();