@grafema/core 0.1.0-alpha.1

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 (402) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +76 -0
  3. package/dist/Orchestrator.d.ts +142 -0
  4. package/dist/Orchestrator.d.ts.map +1 -0
  5. package/dist/Orchestrator.js +481 -0
  6. package/dist/api/GraphAPI.d.ts +87 -0
  7. package/dist/api/GraphAPI.d.ts.map +1 -0
  8. package/dist/api/GraphAPI.js +210 -0
  9. package/dist/api/GuaranteeAPI.d.ts +147 -0
  10. package/dist/api/GuaranteeAPI.d.ts.map +1 -0
  11. package/dist/api/GuaranteeAPI.js +288 -0
  12. package/dist/core/ASTWorker.d.ts +133 -0
  13. package/dist/core/ASTWorker.d.ts.map +1 -0
  14. package/dist/core/ASTWorker.js +352 -0
  15. package/dist/core/ASTWorkerPool.d.ts +85 -0
  16. package/dist/core/ASTWorkerPool.d.ts.map +1 -0
  17. package/dist/core/ASTWorkerPool.js +207 -0
  18. package/dist/core/AnalysisQueue.d.ts +104 -0
  19. package/dist/core/AnalysisQueue.d.ts.map +1 -0
  20. package/dist/core/AnalysisQueue.js +299 -0
  21. package/dist/core/AnalysisWorker.d.ts +14 -0
  22. package/dist/core/AnalysisWorker.d.ts.map +1 -0
  23. package/dist/core/AnalysisWorker.js +307 -0
  24. package/dist/core/GraphBackend.d.ts +156 -0
  25. package/dist/core/GraphBackend.d.ts.map +1 -0
  26. package/dist/core/GraphBackend.js +85 -0
  27. package/dist/core/GuaranteeManager.d.ts +230 -0
  28. package/dist/core/GuaranteeManager.d.ts.map +1 -0
  29. package/dist/core/GuaranteeManager.js +352 -0
  30. package/dist/core/ManifestStore.d.ts +71 -0
  31. package/dist/core/ManifestStore.d.ts.map +1 -0
  32. package/dist/core/ManifestStore.js +146 -0
  33. package/dist/core/NodeFactory.d.ts +160 -0
  34. package/dist/core/NodeFactory.d.ts.map +1 -0
  35. package/dist/core/NodeFactory.js +137 -0
  36. package/dist/core/NodeId.d.ts +88 -0
  37. package/dist/core/NodeId.d.ts.map +1 -0
  38. package/dist/core/NodeId.js +170 -0
  39. package/dist/core/ParallelAnalyzer.d.ts +120 -0
  40. package/dist/core/ParallelAnalyzer.d.ts.map +1 -0
  41. package/dist/core/ParallelAnalyzer.js +331 -0
  42. package/dist/core/PriorityQueue.d.ts +106 -0
  43. package/dist/core/PriorityQueue.d.ts.map +1 -0
  44. package/dist/core/PriorityQueue.js +168 -0
  45. package/dist/core/Profiler.d.ts +75 -0
  46. package/dist/core/Profiler.d.ts.map +1 -0
  47. package/dist/core/Profiler.js +149 -0
  48. package/dist/core/QueueWorker.d.ts +12 -0
  49. package/dist/core/QueueWorker.d.ts.map +1 -0
  50. package/dist/core/QueueWorker.js +567 -0
  51. package/dist/core/RFDBClient.d.ts +179 -0
  52. package/dist/core/RFDBClient.d.ts.map +1 -0
  53. package/dist/core/RFDBClient.js +429 -0
  54. package/dist/core/Task.d.ts +56 -0
  55. package/dist/core/Task.d.ts.map +1 -0
  56. package/dist/core/Task.js +85 -0
  57. package/dist/core/TaskTypes.d.ts +20 -0
  58. package/dist/core/TaskTypes.d.ts.map +1 -0
  59. package/dist/core/TaskTypes.js +10 -0
  60. package/dist/core/VersionManager.d.ts +166 -0
  61. package/dist/core/VersionManager.d.ts.map +1 -0
  62. package/dist/core/VersionManager.js +237 -0
  63. package/dist/core/WorkerPool.d.ts +82 -0
  64. package/dist/core/WorkerPool.d.ts.map +1 -0
  65. package/dist/core/WorkerPool.js +109 -0
  66. package/dist/core/nodes/CallSiteNode.d.ts +26 -0
  67. package/dist/core/nodes/CallSiteNode.d.ts.map +1 -0
  68. package/dist/core/nodes/CallSiteNode.js +44 -0
  69. package/dist/core/nodes/ClassNode.d.ts +25 -0
  70. package/dist/core/nodes/ClassNode.d.ts.map +1 -0
  71. package/dist/core/nodes/ClassNode.js +40 -0
  72. package/dist/core/nodes/ConstantNode.d.ts +24 -0
  73. package/dist/core/nodes/ConstantNode.d.ts.map +1 -0
  74. package/dist/core/nodes/ConstantNode.js +39 -0
  75. package/dist/core/nodes/DatabaseQueryNode.d.ts +22 -0
  76. package/dist/core/nodes/DatabaseQueryNode.d.ts.map +1 -0
  77. package/dist/core/nodes/DatabaseQueryNode.js +37 -0
  78. package/dist/core/nodes/EntrypointNode.d.ts +102 -0
  79. package/dist/core/nodes/EntrypointNode.d.ts.map +1 -0
  80. package/dist/core/nodes/EntrypointNode.js +119 -0
  81. package/dist/core/nodes/EventListenerNode.d.ts +25 -0
  82. package/dist/core/nodes/EventListenerNode.d.ts.map +1 -0
  83. package/dist/core/nodes/EventListenerNode.js +39 -0
  84. package/dist/core/nodes/ExportNode.d.ts +26 -0
  85. package/dist/core/nodes/ExportNode.d.ts.map +1 -0
  86. package/dist/core/nodes/ExportNode.js +40 -0
  87. package/dist/core/nodes/ExternalStdioNode.d.ts +17 -0
  88. package/dist/core/nodes/ExternalStdioNode.d.ts.map +1 -0
  89. package/dist/core/nodes/ExternalStdioNode.js +26 -0
  90. package/dist/core/nodes/FunctionNode.d.ts +27 -0
  91. package/dist/core/nodes/FunctionNode.d.ts.map +1 -0
  92. package/dist/core/nodes/FunctionNode.js +53 -0
  93. package/dist/core/nodes/GuaranteeNode.d.ts +76 -0
  94. package/dist/core/nodes/GuaranteeNode.d.ts.map +1 -0
  95. package/dist/core/nodes/GuaranteeNode.js +117 -0
  96. package/dist/core/nodes/HttpRequestNode.d.ts +24 -0
  97. package/dist/core/nodes/HttpRequestNode.d.ts.map +1 -0
  98. package/dist/core/nodes/HttpRequestNode.js +38 -0
  99. package/dist/core/nodes/ImportNode.d.ts +27 -0
  100. package/dist/core/nodes/ImportNode.d.ts.map +1 -0
  101. package/dist/core/nodes/ImportNode.js +43 -0
  102. package/dist/core/nodes/LiteralNode.d.ts +26 -0
  103. package/dist/core/nodes/LiteralNode.d.ts.map +1 -0
  104. package/dist/core/nodes/LiteralNode.js +40 -0
  105. package/dist/core/nodes/MethodCallNode.d.ts +29 -0
  106. package/dist/core/nodes/MethodCallNode.d.ts.map +1 -0
  107. package/dist/core/nodes/MethodCallNode.js +47 -0
  108. package/dist/core/nodes/MethodNode.d.ts +29 -0
  109. package/dist/core/nodes/MethodNode.d.ts.map +1 -0
  110. package/dist/core/nodes/MethodNode.js +44 -0
  111. package/dist/core/nodes/ModuleNode.d.ts +29 -0
  112. package/dist/core/nodes/ModuleNode.d.ts.map +1 -0
  113. package/dist/core/nodes/ModuleNode.js +49 -0
  114. package/dist/core/nodes/NodeKind.d.ts +91 -0
  115. package/dist/core/nodes/NodeKind.d.ts.map +1 -0
  116. package/dist/core/nodes/NodeKind.js +146 -0
  117. package/dist/core/nodes/ParameterNode.d.ts +26 -0
  118. package/dist/core/nodes/ParameterNode.d.ts.map +1 -0
  119. package/dist/core/nodes/ParameterNode.js +43 -0
  120. package/dist/core/nodes/ScopeNode.d.ts +32 -0
  121. package/dist/core/nodes/ScopeNode.d.ts.map +1 -0
  122. package/dist/core/nodes/ScopeNode.js +47 -0
  123. package/dist/core/nodes/ServiceNode.d.ts +44 -0
  124. package/dist/core/nodes/ServiceNode.d.ts.map +1 -0
  125. package/dist/core/nodes/ServiceNode.js +49 -0
  126. package/dist/core/nodes/VariableDeclarationNode.d.ts +22 -0
  127. package/dist/core/nodes/VariableDeclarationNode.d.ts.map +1 -0
  128. package/dist/core/nodes/VariableDeclarationNode.js +38 -0
  129. package/dist/core/nodes/index.d.ts +25 -0
  130. package/dist/core/nodes/index.d.ts.map +1 -0
  131. package/dist/core/nodes/index.js +30 -0
  132. package/dist/index.d.ts +57 -0
  133. package/dist/index.d.ts.map +1 -0
  134. package/dist/index.js +63 -0
  135. package/dist/plugins/Plugin.d.ts +44 -0
  136. package/dist/plugins/Plugin.d.ts.map +1 -0
  137. package/dist/plugins/Plugin.js +46 -0
  138. package/dist/plugins/analysis/DatabaseAnalyzer.d.ts +23 -0
  139. package/dist/plugins/analysis/DatabaseAnalyzer.d.ts.map +1 -0
  140. package/dist/plugins/analysis/DatabaseAnalyzer.js +260 -0
  141. package/dist/plugins/analysis/ExpressAnalyzer.d.ts +19 -0
  142. package/dist/plugins/analysis/ExpressAnalyzer.d.ts.map +1 -0
  143. package/dist/plugins/analysis/ExpressAnalyzer.js +306 -0
  144. package/dist/plugins/analysis/ExpressRouteAnalyzer.d.ts +17 -0
  145. package/dist/plugins/analysis/ExpressRouteAnalyzer.d.ts.map +1 -0
  146. package/dist/plugins/analysis/ExpressRouteAnalyzer.js +308 -0
  147. package/dist/plugins/analysis/FetchAnalyzer.d.ts +38 -0
  148. package/dist/plugins/analysis/FetchAnalyzer.d.ts.map +1 -0
  149. package/dist/plugins/analysis/FetchAnalyzer.js +344 -0
  150. package/dist/plugins/analysis/IncrementalAnalysisPlugin.d.ts +65 -0
  151. package/dist/plugins/analysis/IncrementalAnalysisPlugin.d.ts.map +1 -0
  152. package/dist/plugins/analysis/IncrementalAnalysisPlugin.js +472 -0
  153. package/dist/plugins/analysis/JSASTAnalyzer.d.ts +84 -0
  154. package/dist/plugins/analysis/JSASTAnalyzer.d.ts.map +1 -0
  155. package/dist/plugins/analysis/JSASTAnalyzer.js +1378 -0
  156. package/dist/plugins/analysis/ReactAnalyzer.d.ts +90 -0
  157. package/dist/plugins/analysis/ReactAnalyzer.d.ts.map +1 -0
  158. package/dist/plugins/analysis/ReactAnalyzer.js +1153 -0
  159. package/dist/plugins/analysis/RustAnalyzer.d.ts +13 -0
  160. package/dist/plugins/analysis/RustAnalyzer.d.ts.map +1 -0
  161. package/dist/plugins/analysis/RustAnalyzer.js +259 -0
  162. package/dist/plugins/analysis/SQLiteAnalyzer.d.ts +21 -0
  163. package/dist/plugins/analysis/SQLiteAnalyzer.d.ts.map +1 -0
  164. package/dist/plugins/analysis/SQLiteAnalyzer.js +317 -0
  165. package/dist/plugins/analysis/ServiceLayerAnalyzer.d.ts +35 -0
  166. package/dist/plugins/analysis/ServiceLayerAnalyzer.d.ts.map +1 -0
  167. package/dist/plugins/analysis/ServiceLayerAnalyzer.js +303 -0
  168. package/dist/plugins/analysis/SocketIOAnalyzer.d.ts +33 -0
  169. package/dist/plugins/analysis/SocketIOAnalyzer.d.ts.map +1 -0
  170. package/dist/plugins/analysis/SocketIOAnalyzer.js +283 -0
  171. package/dist/plugins/analysis/SystemDbAnalyzer.d.ts +27 -0
  172. package/dist/plugins/analysis/SystemDbAnalyzer.d.ts.map +1 -0
  173. package/dist/plugins/analysis/SystemDbAnalyzer.js +211 -0
  174. package/dist/plugins/analysis/ast/ConditionParser.d.ts +85 -0
  175. package/dist/plugins/analysis/ast/ConditionParser.d.ts.map +1 -0
  176. package/dist/plugins/analysis/ast/ConditionParser.js +277 -0
  177. package/dist/plugins/analysis/ast/ExpressionEvaluator.d.ts +15 -0
  178. package/dist/plugins/analysis/ast/ExpressionEvaluator.d.ts.map +1 -0
  179. package/dist/plugins/analysis/ast/ExpressionEvaluator.js +91 -0
  180. package/dist/plugins/analysis/ast/GraphBuilder.d.ts +77 -0
  181. package/dist/plugins/analysis/ast/GraphBuilder.d.ts.map +1 -0
  182. package/dist/plugins/analysis/ast/GraphBuilder.js +1077 -0
  183. package/dist/plugins/analysis/ast/OxcAdapter.d.ts +41 -0
  184. package/dist/plugins/analysis/ast/OxcAdapter.d.ts.map +1 -0
  185. package/dist/plugins/analysis/ast/OxcAdapter.js +40 -0
  186. package/dist/plugins/analysis/ast/types.d.ts +346 -0
  187. package/dist/plugins/analysis/ast/types.d.ts.map +1 -0
  188. package/dist/plugins/analysis/ast/types.js +4 -0
  189. package/dist/plugins/analysis/ast/visitors/ASTVisitor.d.ts +93 -0
  190. package/dist/plugins/analysis/ast/visitors/ASTVisitor.d.ts.map +1 -0
  191. package/dist/plugins/analysis/ast/visitors/ASTVisitor.js +24 -0
  192. package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.d.ts +77 -0
  193. package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.d.ts.map +1 -0
  194. package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.js +377 -0
  195. package/dist/plugins/analysis/ast/visitors/ClassVisitor.d.ts +27 -0
  196. package/dist/plugins/analysis/ast/visitors/ClassVisitor.d.ts.map +1 -0
  197. package/dist/plugins/analysis/ast/visitors/ClassVisitor.js +232 -0
  198. package/dist/plugins/analysis/ast/visitors/FunctionVisitor.d.ts +25 -0
  199. package/dist/plugins/analysis/ast/visitors/FunctionVisitor.d.ts.map +1 -0
  200. package/dist/plugins/analysis/ast/visitors/FunctionVisitor.js +172 -0
  201. package/dist/plugins/analysis/ast/visitors/ImportExportVisitor.d.ts +29 -0
  202. package/dist/plugins/analysis/ast/visitors/ImportExportVisitor.d.ts.map +1 -0
  203. package/dist/plugins/analysis/ast/visitors/ImportExportVisitor.js +180 -0
  204. package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.d.ts +14 -0
  205. package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.d.ts.map +1 -0
  206. package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.js +200 -0
  207. package/dist/plugins/analysis/ast/visitors/VariableVisitor.d.ts +45 -0
  208. package/dist/plugins/analysis/ast/visitors/VariableVisitor.d.ts.map +1 -0
  209. package/dist/plugins/analysis/ast/visitors/VariableVisitor.js +150 -0
  210. package/dist/plugins/analysis/ast/visitors/index.d.ts +17 -0
  211. package/dist/plugins/analysis/ast/visitors/index.d.ts.map +1 -0
  212. package/dist/plugins/analysis/ast/visitors/index.js +13 -0
  213. package/dist/plugins/discovery/DiscoveryPlugin.d.ts +34 -0
  214. package/dist/plugins/discovery/DiscoveryPlugin.d.ts.map +1 -0
  215. package/dist/plugins/discovery/DiscoveryPlugin.js +26 -0
  216. package/dist/plugins/discovery/MonorepoServiceDiscovery.d.ts +26 -0
  217. package/dist/plugins/discovery/MonorepoServiceDiscovery.d.ts.map +1 -0
  218. package/dist/plugins/discovery/MonorepoServiceDiscovery.js +79 -0
  219. package/dist/plugins/discovery/SimpleProjectDiscovery.d.ts +14 -0
  220. package/dist/plugins/discovery/SimpleProjectDiscovery.d.ts.map +1 -0
  221. package/dist/plugins/discovery/SimpleProjectDiscovery.js +65 -0
  222. package/dist/plugins/discovery/ZonServiceDiscovery.d.ts +19 -0
  223. package/dist/plugins/discovery/ZonServiceDiscovery.d.ts.map +1 -0
  224. package/dist/plugins/discovery/ZonServiceDiscovery.js +204 -0
  225. package/dist/plugins/enrichment/AliasTracker.d.ts +40 -0
  226. package/dist/plugins/enrichment/AliasTracker.d.ts.map +1 -0
  227. package/dist/plugins/enrichment/AliasTracker.js +290 -0
  228. package/dist/plugins/enrichment/HTTPConnectionEnricher.d.ts +30 -0
  229. package/dist/plugins/enrichment/HTTPConnectionEnricher.d.ts.map +1 -0
  230. package/dist/plugins/enrichment/HTTPConnectionEnricher.js +135 -0
  231. package/dist/plugins/enrichment/ImportExportLinker.d.ts +30 -0
  232. package/dist/plugins/enrichment/ImportExportLinker.d.ts.map +1 -0
  233. package/dist/plugins/enrichment/ImportExportLinker.js +176 -0
  234. package/dist/plugins/enrichment/InstanceOfResolver.d.ts +21 -0
  235. package/dist/plugins/enrichment/InstanceOfResolver.d.ts.map +1 -0
  236. package/dist/plugins/enrichment/InstanceOfResolver.js +117 -0
  237. package/dist/plugins/enrichment/MethodCallResolver.d.ts +41 -0
  238. package/dist/plugins/enrichment/MethodCallResolver.d.ts.map +1 -0
  239. package/dist/plugins/enrichment/MethodCallResolver.js +252 -0
  240. package/dist/plugins/enrichment/MountPointResolver.d.ts +26 -0
  241. package/dist/plugins/enrichment/MountPointResolver.d.ts.map +1 -0
  242. package/dist/plugins/enrichment/MountPointResolver.js +189 -0
  243. package/dist/plugins/enrichment/PrefixEvaluator.d.ts +89 -0
  244. package/dist/plugins/enrichment/PrefixEvaluator.d.ts.map +1 -0
  245. package/dist/plugins/enrichment/PrefixEvaluator.js +415 -0
  246. package/dist/plugins/enrichment/RustFFIEnricher.d.ts +25 -0
  247. package/dist/plugins/enrichment/RustFFIEnricher.d.ts.map +1 -0
  248. package/dist/plugins/enrichment/RustFFIEnricher.js +170 -0
  249. package/dist/plugins/enrichment/ValueDomainAnalyzer.d.ts +114 -0
  250. package/dist/plugins/enrichment/ValueDomainAnalyzer.d.ts.map +1 -0
  251. package/dist/plugins/enrichment/ValueDomainAnalyzer.js +464 -0
  252. package/dist/plugins/indexing/IncrementalModuleIndexer.d.ts +27 -0
  253. package/dist/plugins/indexing/IncrementalModuleIndexer.d.ts.map +1 -0
  254. package/dist/plugins/indexing/IncrementalModuleIndexer.js +238 -0
  255. package/dist/plugins/indexing/JSModuleIndexer.d.ts +33 -0
  256. package/dist/plugins/indexing/JSModuleIndexer.d.ts.map +1 -0
  257. package/dist/plugins/indexing/JSModuleIndexer.js +299 -0
  258. package/dist/plugins/indexing/RustModuleIndexer.d.ts +28 -0
  259. package/dist/plugins/indexing/RustModuleIndexer.d.ts.map +1 -0
  260. package/dist/plugins/indexing/RustModuleIndexer.js +140 -0
  261. package/dist/plugins/indexing/ServiceDetector.d.ts +46 -0
  262. package/dist/plugins/indexing/ServiceDetector.d.ts.map +1 -0
  263. package/dist/plugins/indexing/ServiceDetector.js +164 -0
  264. package/dist/plugins/validation/CallResolverValidator.d.ts +23 -0
  265. package/dist/plugins/validation/CallResolverValidator.d.ts.map +1 -0
  266. package/dist/plugins/validation/CallResolverValidator.js +108 -0
  267. package/dist/plugins/validation/DataFlowValidator.d.ts +24 -0
  268. package/dist/plugins/validation/DataFlowValidator.d.ts.map +1 -0
  269. package/dist/plugins/validation/DataFlowValidator.js +148 -0
  270. package/dist/plugins/validation/EvalBanValidator.d.ts +25 -0
  271. package/dist/plugins/validation/EvalBanValidator.d.ts.map +1 -0
  272. package/dist/plugins/validation/EvalBanValidator.js +123 -0
  273. package/dist/plugins/validation/GraphConnectivityValidator.d.ts +11 -0
  274. package/dist/plugins/validation/GraphConnectivityValidator.d.ts.map +1 -0
  275. package/dist/plugins/validation/GraphConnectivityValidator.js +135 -0
  276. package/dist/plugins/validation/SQLInjectionValidator.d.ts +43 -0
  277. package/dist/plugins/validation/SQLInjectionValidator.d.ts.map +1 -0
  278. package/dist/plugins/validation/SQLInjectionValidator.js +251 -0
  279. package/dist/plugins/validation/ShadowingDetector.d.ts +26 -0
  280. package/dist/plugins/validation/ShadowingDetector.d.ts.map +1 -0
  281. package/dist/plugins/validation/ShadowingDetector.js +119 -0
  282. package/dist/plugins/validation/TypeScriptDeadCodeValidator.d.ts +21 -0
  283. package/dist/plugins/validation/TypeScriptDeadCodeValidator.d.ts.map +1 -0
  284. package/dist/plugins/validation/TypeScriptDeadCodeValidator.js +151 -0
  285. package/dist/plugins/vcs/GitPlugin.d.ts +84 -0
  286. package/dist/plugins/vcs/GitPlugin.d.ts.map +1 -0
  287. package/dist/plugins/vcs/GitPlugin.js +295 -0
  288. package/dist/plugins/vcs/VCSPlugin.d.ts +133 -0
  289. package/dist/plugins/vcs/VCSPlugin.d.ts.map +1 -0
  290. package/dist/plugins/vcs/VCSPlugin.js +82 -0
  291. package/dist/plugins/vcs/index.d.ts +10 -0
  292. package/dist/plugins/vcs/index.d.ts.map +1 -0
  293. package/dist/plugins/vcs/index.js +18 -0
  294. package/dist/storage/backends/RFDBServerBackend.d.ts +258 -0
  295. package/dist/storage/backends/RFDBServerBackend.d.ts.map +1 -0
  296. package/dist/storage/backends/RFDBServerBackend.js +565 -0
  297. package/dist/storage/backends/typeValidation.d.ts +47 -0
  298. package/dist/storage/backends/typeValidation.d.ts.map +1 -0
  299. package/dist/storage/backends/typeValidation.js +137 -0
  300. package/dist/validation/PathValidator.d.ts +81 -0
  301. package/dist/validation/PathValidator.d.ts.map +1 -0
  302. package/dist/validation/PathValidator.js +251 -0
  303. package/package.json +57 -0
  304. package/src/.rfguard/current-session.txt +1 -0
  305. package/src/Orchestrator.ts +673 -0
  306. package/src/api/GraphAPI.ts +305 -0
  307. package/src/api/GuaranteeAPI.ts +401 -0
  308. package/src/core/ASTWorker.ts +567 -0
  309. package/src/core/ASTWorkerPool.ts +299 -0
  310. package/src/core/AnalysisQueue.ts +447 -0
  311. package/src/core/AnalysisWorker.ts +410 -0
  312. package/src/core/GraphBackend.ts +265 -0
  313. package/src/core/GuaranteeManager.ts +581 -0
  314. package/src/core/ManifestStore.ts +196 -0
  315. package/src/core/NodeFactory.ts +274 -0
  316. package/src/core/NodeId.ts +257 -0
  317. package/src/core/ParallelAnalyzer.ts +476 -0
  318. package/src/core/PriorityQueue.ts +227 -0
  319. package/src/core/Profiler.ts +188 -0
  320. package/src/core/QueueWorker.ts +780 -0
  321. package/src/core/Task.ts +107 -0
  322. package/src/core/TaskTypes.ts +40 -0
  323. package/src/core/VersionManager.ts +404 -0
  324. package/src/core/WorkerPool.ts +180 -0
  325. package/src/core/nodes/CallSiteNode.ts +72 -0
  326. package/src/core/nodes/ClassNode.ts +69 -0
  327. package/src/core/nodes/ConstantNode.ts +63 -0
  328. package/src/core/nodes/DatabaseQueryNode.ts +60 -0
  329. package/src/core/nodes/EntrypointNode.ts +164 -0
  330. package/src/core/nodes/EventListenerNode.ts +64 -0
  331. package/src/core/nodes/ExportNode.ts +71 -0
  332. package/src/core/nodes/ExternalStdioNode.ts +36 -0
  333. package/src/core/nodes/FunctionNode.ts +78 -0
  334. package/src/core/nodes/GuaranteeNode.ts +162 -0
  335. package/src/core/nodes/HttpRequestNode.ts +63 -0
  336. package/src/core/nodes/ImportNode.ts +75 -0
  337. package/src/core/nodes/LiteralNode.ts +67 -0
  338. package/src/core/nodes/MethodCallNode.ts +79 -0
  339. package/src/core/nodes/MethodNode.ts +78 -0
  340. package/src/core/nodes/ModuleNode.ts +74 -0
  341. package/src/core/nodes/NodeKind.ts +171 -0
  342. package/src/core/nodes/ParameterNode.ts +73 -0
  343. package/src/core/nodes/ScopeNode.ts +80 -0
  344. package/src/core/nodes/ServiceNode.ts +86 -0
  345. package/src/core/nodes/VariableDeclarationNode.ts +60 -0
  346. package/src/core/nodes/index.ts +49 -0
  347. package/src/index.ts +93 -0
  348. package/src/plugins/Plugin.ts +74 -0
  349. package/src/plugins/analysis/DatabaseAnalyzer.ts +322 -0
  350. package/src/plugins/analysis/ExpressAnalyzer.ts +401 -0
  351. package/src/plugins/analysis/ExpressRouteAnalyzer.ts +414 -0
  352. package/src/plugins/analysis/FetchAnalyzer.ts +441 -0
  353. package/src/plugins/analysis/IncrementalAnalysisPlugin.ts +686 -0
  354. package/src/plugins/analysis/JSASTAnalyzer.ts +1680 -0
  355. package/src/plugins/analysis/ReactAnalyzer.ts +1368 -0
  356. package/src/plugins/analysis/RustAnalyzer.ts +438 -0
  357. package/src/plugins/analysis/SQLiteAnalyzer.ts +388 -0
  358. package/src/plugins/analysis/ServiceLayerAnalyzer.ts +429 -0
  359. package/src/plugins/analysis/SocketIOAnalyzer.ts +395 -0
  360. package/src/plugins/analysis/SystemDbAnalyzer.ts +284 -0
  361. package/src/plugins/analysis/ast/ConditionParser.ts +333 -0
  362. package/src/plugins/analysis/ast/ExpressionEvaluator.ts +117 -0
  363. package/src/plugins/analysis/ast/GraphBuilder.ts +1371 -0
  364. package/src/plugins/analysis/ast/OxcAdapter.ts +63 -0
  365. package/src/plugins/analysis/ast/types.ts +400 -0
  366. package/src/plugins/analysis/ast/visitors/ASTVisitor.ts +137 -0
  367. package/src/plugins/analysis/ast/visitors/CallExpressionVisitor.ts +528 -0
  368. package/src/plugins/analysis/ast/visitors/ClassVisitor.ts +339 -0
  369. package/src/plugins/analysis/ast/visitors/FunctionVisitor.ts +273 -0
  370. package/src/plugins/analysis/ast/visitors/ImportExportVisitor.ts +259 -0
  371. package/src/plugins/analysis/ast/visitors/TypeScriptVisitor.ts +235 -0
  372. package/src/plugins/analysis/ast/visitors/VariableVisitor.ts +268 -0
  373. package/src/plugins/analysis/ast/visitors/index.ts +36 -0
  374. package/src/plugins/discovery/DiscoveryPlugin.ts +50 -0
  375. package/src/plugins/discovery/MonorepoServiceDiscovery.ts +117 -0
  376. package/src/plugins/discovery/SimpleProjectDiscovery.ts +102 -0
  377. package/src/plugins/enrichment/AliasTracker.ts +399 -0
  378. package/src/plugins/enrichment/HTTPConnectionEnricher.ts +192 -0
  379. package/src/plugins/enrichment/ImportExportLinker.ts +221 -0
  380. package/src/plugins/enrichment/InstanceOfResolver.ts +165 -0
  381. package/src/plugins/enrichment/MethodCallResolver.ts +333 -0
  382. package/src/plugins/enrichment/MountPointResolver.ts +264 -0
  383. package/src/plugins/enrichment/PrefixEvaluator.ts +527 -0
  384. package/src/plugins/enrichment/RustFFIEnricher.ts +218 -0
  385. package/src/plugins/enrichment/ValueDomainAnalyzer.ts +682 -0
  386. package/src/plugins/indexing/IncrementalModuleIndexer.ts +287 -0
  387. package/src/plugins/indexing/JSModuleIndexer.ts +374 -0
  388. package/src/plugins/indexing/RustModuleIndexer.ts +160 -0
  389. package/src/plugins/indexing/ServiceDetector.ts +230 -0
  390. package/src/plugins/validation/CallResolverValidator.ts +170 -0
  391. package/src/plugins/validation/DataFlowValidator.ts +233 -0
  392. package/src/plugins/validation/EvalBanValidator.ts +175 -0
  393. package/src/plugins/validation/GraphConnectivityValidator.ts +201 -0
  394. package/src/plugins/validation/SQLInjectionValidator.ts +363 -0
  395. package/src/plugins/validation/ShadowingDetector.ts +173 -0
  396. package/src/plugins/validation/TypeScriptDeadCodeValidator.ts +203 -0
  397. package/src/plugins/vcs/GitPlugin.ts +344 -0
  398. package/src/plugins/vcs/VCSPlugin.ts +190 -0
  399. package/src/plugins/vcs/index.ts +32 -0
  400. package/src/storage/backends/RFDBServerBackend.ts +687 -0
  401. package/src/storage/backends/typeValidation.ts +151 -0
  402. package/src/validation/PathValidator.ts +342 -0
@@ -0,0 +1,63 @@
1
+ /**
2
+ * OxcAdapter - адаптер для перехода с Babel на Oxc parser
3
+ * Предоставляет API совместимый с Babel parse и traverse
4
+ */
5
+
6
+ import { parseSync, Visitor } from 'oxc-parser';
7
+ import type * as t from '@babel/types';
8
+
9
+ /**
10
+ * Parse options
11
+ */
12
+ interface ParseOptions {
13
+ filename?: string;
14
+ sourceType?: 'module' | 'script';
15
+ plugins?: string[];
16
+ }
17
+
18
+ /**
19
+ * Visitor handlers type
20
+ */
21
+ interface VisitorHandlers {
22
+ [key: string]: ((node: t.Node) => void) | undefined;
23
+ }
24
+
25
+ /**
26
+ * Parse code with Oxc (compatible with Babel parse API)
27
+ * @param code - Source code to parse
28
+ * @param options - Parse options
29
+ * @returns AST with program property
30
+ */
31
+ export function parse(code: string, options: ParseOptions = {}): t.Program {
32
+ // Oxc doesn't need sourceType or plugins config
33
+ // It auto-detects JSX and handles all modern syntax
34
+ const filename = options.filename || 'unknown.js';
35
+
36
+ const result = parseSync(filename, code);
37
+
38
+ // Oxc returns { program, comments, errors }
39
+ // Babel returns just the program node
40
+ // For compatibility, return the program directly
41
+ return result.program as unknown as t.Program;
42
+ }
43
+
44
+ /**
45
+ * Traverse AST with Oxc Visitor (compatible with Babel traverse API)
46
+ * @param ast - AST to traverse
47
+ * @param visitors - Visitor handlers
48
+ */
49
+ export function traverse(ast: t.Node, visitors: VisitorHandlers): void {
50
+ // Oxc Visitor accepts an object with node type handlers
51
+ // This is already compatible with our Babel usage pattern
52
+ const visitor = new Visitor(visitors as unknown as Record<string, (node: unknown) => void>);
53
+ // Cast to Oxc Program through unknown - types are structurally similar but from different packages
54
+ visitor.visit(ast as unknown as Parameters<typeof visitor.visit>[0]);
55
+ }
56
+
57
+ /**
58
+ * Default export for compatibility
59
+ */
60
+ export default {
61
+ parse,
62
+ traverse
63
+ };
@@ -0,0 +1,400 @@
1
+ /**
2
+ * AST Analysis Types - общие типы для JSASTAnalyzer и GraphBuilder
3
+ */
4
+
5
+ import type * as t from '@babel/types';
6
+ import type { GraphBackend } from '@grafema/types';
7
+
8
+ // === MODULE NODE ===
9
+ export interface ModuleNode {
10
+ id: string;
11
+ type: 'MODULE';
12
+ name: string;
13
+ file: string;
14
+ line: number;
15
+ contentHash?: string;
16
+ [key: string]: unknown;
17
+ }
18
+
19
+ // === FUNCTION INFO ===
20
+ export interface FunctionInfo {
21
+ id: string;
22
+ stableId: string;
23
+ type: 'FUNCTION';
24
+ name: string;
25
+ file: string;
26
+ line: number;
27
+ column: number;
28
+ async?: boolean;
29
+ generator?: boolean;
30
+ arrowFunction?: boolean;
31
+ isAssignment?: boolean;
32
+ isCallback?: boolean;
33
+ parentScopeId?: string;
34
+ }
35
+
36
+ // === PARAMETER INFO ===
37
+ export interface ParameterInfo {
38
+ id: string;
39
+ type: 'PARAMETER';
40
+ name: string;
41
+ file: string;
42
+ line: number;
43
+ index?: number;
44
+ functionId: string;
45
+ parentFunctionId?: string;
46
+ }
47
+
48
+ // === SCOPE INFO ===
49
+ export interface ScopeInfo {
50
+ id: string;
51
+ type: 'SCOPE';
52
+ scopeType: string;
53
+ name?: string;
54
+ semanticId?: string; // Stable ID for diff comparison (e.g., "MyClass.myMethod:if_statement[0]")
55
+ conditional?: boolean;
56
+ condition?: string;
57
+ constraints?: unknown[];
58
+ file?: string;
59
+ line: number;
60
+ parentScopeId?: string;
61
+ parentFunctionId?: string;
62
+ capturesFrom?: string;
63
+ modifies?: Array<{ variableId: string; variableName: string; line: number }>;
64
+ }
65
+
66
+ // === VARIABLE DECLARATION INFO ===
67
+ export interface VariableDeclarationInfo {
68
+ id: string;
69
+ type: 'VARIABLE' | 'CONSTANT';
70
+ name: string;
71
+ file: string;
72
+ line: number;
73
+ column?: number;
74
+ value?: unknown;
75
+ parentScopeId?: string;
76
+ }
77
+
78
+ // === CALL SITE INFO ===
79
+ export interface CallSiteInfo {
80
+ id: string;
81
+ type: 'CALL';
82
+ name: string;
83
+ file: string;
84
+ line: number;
85
+ column?: number;
86
+ parentScopeId?: string;
87
+ targetFunctionName?: string;
88
+ isNew?: boolean;
89
+ }
90
+
91
+ // === METHOD CALL INFO ===
92
+ export interface MethodCallInfo {
93
+ id: string;
94
+ type: 'CALL';
95
+ name: string;
96
+ object: string;
97
+ method: string;
98
+ file: string;
99
+ line: number;
100
+ column?: number;
101
+ parentScopeId?: string;
102
+ arguments?: unknown[];
103
+ isNew?: boolean;
104
+ }
105
+
106
+ // === EVENT LISTENER INFO ===
107
+ export interface EventListenerInfo {
108
+ id: string;
109
+ type: 'event:listener';
110
+ name: string;
111
+ object: string;
112
+ file: string;
113
+ line: number;
114
+ parentScopeId?: string;
115
+ callbackArg?: t.Node;
116
+ }
117
+
118
+ // === CLASS INSTANTIATION INFO ===
119
+ export interface ClassInstantiationInfo {
120
+ variableId: string;
121
+ variableName: string;
122
+ className: string;
123
+ line: number;
124
+ parentScopeId?: string;
125
+ }
126
+
127
+ // === CLASS DECLARATION INFO ===
128
+ export interface ClassDeclarationInfo {
129
+ id: string;
130
+ type: 'CLASS';
131
+ name: string;
132
+ file: string;
133
+ line: number;
134
+ column?: number;
135
+ superClass?: string;
136
+ implements?: string[]; // имена интерфейсов, которые реализует класс
137
+ methods: string[];
138
+ }
139
+
140
+ // === INTERFACE DECLARATION INFO ===
141
+ export interface InterfaceDeclarationInfo {
142
+ id: string;
143
+ type: 'INTERFACE';
144
+ name: string;
145
+ file: string;
146
+ line: number;
147
+ column?: number;
148
+ extends?: string[]; // имена родительских интерфейсов
149
+ properties: InterfacePropertyInfo[];
150
+ }
151
+
152
+ export interface InterfacePropertyInfo {
153
+ name: string;
154
+ type?: string;
155
+ optional?: boolean;
156
+ readonly?: boolean;
157
+ }
158
+
159
+ // === TYPE ALIAS INFO ===
160
+ export interface TypeAliasInfo {
161
+ id: string;
162
+ type: 'TYPE';
163
+ name: string;
164
+ file: string;
165
+ line: number;
166
+ column?: number;
167
+ aliasOf?: string; // строковое представление типа
168
+ }
169
+
170
+ // === ENUM DECLARATION INFO ===
171
+ export interface EnumDeclarationInfo {
172
+ id: string;
173
+ type: 'ENUM';
174
+ name: string;
175
+ file: string;
176
+ line: number;
177
+ column?: number;
178
+ isConst?: boolean; // const enum
179
+ members: EnumMemberInfo[];
180
+ }
181
+
182
+ export interface EnumMemberInfo {
183
+ name: string;
184
+ value?: string | number;
185
+ }
186
+
187
+ // === DECORATOR INFO ===
188
+ export interface DecoratorInfo {
189
+ id: string;
190
+ type: 'DECORATOR';
191
+ name: string;
192
+ file: string;
193
+ line: number;
194
+ column?: number;
195
+ arguments?: unknown[]; // аргументы декоратора
196
+ targetId: string; // ID класса/метода/свойства
197
+ targetType: 'CLASS' | 'METHOD' | 'PROPERTY' | 'PARAMETER';
198
+ }
199
+
200
+ // === METHOD CALLBACK INFO ===
201
+ export interface MethodCallbackInfo {
202
+ methodCallId: string;
203
+ callbackLine: number;
204
+ callbackColumn: number;
205
+ callbackType: string;
206
+ }
207
+
208
+ // === CALL ARGUMENT INFO ===
209
+ export interface CallArgumentInfo {
210
+ callId: string;
211
+ argIndex: number;
212
+ argValue?: unknown;
213
+ targetType?: string;
214
+ targetId?: string;
215
+ targetName?: string;
216
+ file?: string;
217
+ isSpread?: boolean;
218
+ functionLine?: number;
219
+ functionColumn?: number;
220
+ nestedCallLine?: number;
221
+ nestedCallColumn?: number;
222
+ }
223
+
224
+ // === IMPORT INFO ===
225
+ export interface ImportInfo {
226
+ id: string;
227
+ type: 'IMPORT';
228
+ name: string;
229
+ source: string;
230
+ file: string;
231
+ line: number;
232
+ specifiers: ImportSpecifier[];
233
+ }
234
+
235
+ export interface ImportSpecifier {
236
+ imported: string; // имя в экспортируемом модуле (default, *, или имя)
237
+ local: string; // имя в текущем модуле
238
+ }
239
+
240
+ // === EXPORT INFO ===
241
+ export interface ExportInfo {
242
+ id: string;
243
+ type: 'EXPORT' | 'default' | 'named' | 'all';
244
+ name: string;
245
+ file: string;
246
+ line: number;
247
+ specifiers?: ExportSpecifier[];
248
+ source?: string; // для re-exports: export { foo } from './other'
249
+ }
250
+
251
+ export interface ExportSpecifier {
252
+ local: string;
253
+ exported: string;
254
+ }
255
+
256
+ // === HTTP REQUEST INFO ===
257
+ export interface HttpRequestInfo {
258
+ id: string;
259
+ type: 'http:request';
260
+ method: string;
261
+ url: string;
262
+ file: string;
263
+ line: number;
264
+ parentScopeId?: string;
265
+ }
266
+
267
+ // === LITERAL INFO ===
268
+ export interface LiteralInfo {
269
+ id: string;
270
+ type: 'LITERAL' | 'CALL';
271
+ value?: unknown;
272
+ valueType?: string;
273
+ name?: string;
274
+ object?: string;
275
+ method?: string;
276
+ arguments?: unknown[];
277
+ file: string;
278
+ line: number;
279
+ column?: number;
280
+ parentCallId?: string;
281
+ argIndex?: number;
282
+ }
283
+
284
+ // === VARIABLE ASSIGNMENT INFO ===
285
+ export interface VariableAssignmentInfo {
286
+ variableId: string;
287
+ sourceId?: string | null;
288
+ sourceType: string;
289
+ callName?: string;
290
+ callLine?: number;
291
+ callColumn?: number;
292
+ sourceName?: string;
293
+ sourceLine?: number;
294
+ sourceColumn?: number;
295
+ sourceFile?: string;
296
+ className?: string;
297
+ functionName?: string;
298
+ line?: number;
299
+ expressionType?: string;
300
+ object?: string;
301
+ property?: string;
302
+ computed?: boolean;
303
+ computedPropertyVar?: string | null;
304
+ objectSourceName?: string | null;
305
+ operator?: string;
306
+ leftSourceName?: string | null;
307
+ rightSourceName?: string | null;
308
+ consequentSourceName?: string | null;
309
+ alternateSourceName?: string | null;
310
+ expressionSourceNames?: string[];
311
+ file?: string;
312
+ }
313
+
314
+ // === COUNTER REF ===
315
+ export interface CounterRef {
316
+ value: number;
317
+ }
318
+
319
+ // === PROCESSED NODES ===
320
+ export interface ProcessedNodes {
321
+ functions: Set<string>;
322
+ classes: Set<string>;
323
+ imports: Set<string>;
324
+ exports: Set<string>;
325
+ variables: Set<string>;
326
+ callSites: Set<string>;
327
+ methodCalls: Set<string>;
328
+ varDecls: Set<string>;
329
+ eventListeners: Set<string>;
330
+ [key: string]: Set<string>;
331
+ }
332
+
333
+ // === COLLECTIONS (все данные для GraphBuilder) ===
334
+ export interface ASTCollections {
335
+ functions: FunctionInfo[];
336
+ parameters?: ParameterInfo[];
337
+ scopes: ScopeInfo[];
338
+ variableDeclarations: VariableDeclarationInfo[];
339
+ callSites: CallSiteInfo[];
340
+ methodCalls?: MethodCallInfo[];
341
+ eventListeners?: EventListenerInfo[];
342
+ classInstantiations?: ClassInstantiationInfo[];
343
+ classDeclarations?: ClassDeclarationInfo[];
344
+ methodCallbacks?: MethodCallbackInfo[];
345
+ callArguments?: CallArgumentInfo[];
346
+ imports?: ImportInfo[];
347
+ exports?: ExportInfo[];
348
+ httpRequests?: HttpRequestInfo[];
349
+ literals?: LiteralInfo[];
350
+ variableAssignments?: VariableAssignmentInfo[];
351
+ // TypeScript-specific collections
352
+ interfaces?: InterfaceDeclarationInfo[];
353
+ typeAliases?: TypeAliasInfo[];
354
+ enums?: EnumDeclarationInfo[];
355
+ decorators?: DecoratorInfo[];
356
+ // Counter refs (used internally during collection)
357
+ ifScopeCounterRef?: CounterRef;
358
+ scopeCounterRef?: CounterRef;
359
+ varDeclCounterRef?: CounterRef;
360
+ callSiteCounterRef?: CounterRef;
361
+ functionCounterRef?: CounterRef;
362
+ httpRequestCounterRef?: CounterRef;
363
+ literalCounterRef?: CounterRef;
364
+ processedNodes?: ProcessedNodes;
365
+ }
366
+
367
+ // === EXTRACTED VARIABLE ===
368
+ export interface ExtractedVariable {
369
+ name: string;
370
+ loc: { start: { line: number; column: number } };
371
+ propertyPath?: string[];
372
+ arrayIndex?: number;
373
+ isRest?: boolean;
374
+ }
375
+
376
+ // === GRAPH NODE (generic node for buffer) ===
377
+ export interface GraphNode {
378
+ id: string;
379
+ type: string;
380
+ name?: string;
381
+ file?: string;
382
+ line?: number;
383
+ column?: number;
384
+ [key: string]: unknown;
385
+ }
386
+
387
+ // === GRAPH EDGE (generic edge for buffer) ===
388
+ export interface GraphEdge {
389
+ type: string;
390
+ src: string;
391
+ dst: string;
392
+ index?: number;
393
+ metadata?: Record<string, unknown>;
394
+ }
395
+
396
+ // === BUILD RESULT ===
397
+ export interface BuildResult {
398
+ nodes: number;
399
+ edges: number;
400
+ }
@@ -0,0 +1,137 @@
1
+ /**
2
+ * Base class for AST visitors
3
+ * Each visitor handles specific AST node types and collects relevant data
4
+ */
5
+ import type { Node, SourceLocation } from '@babel/types';
6
+ import type { NodePath } from '@babel/traverse';
7
+ import type {
8
+ FunctionInfo,
9
+ ClassDeclarationInfo,
10
+ ClassInstantiationInfo,
11
+ ScopeInfo,
12
+ VariableDeclarationInfo,
13
+ CallSiteInfo,
14
+ MethodCallInfo,
15
+ EventListenerInfo,
16
+ MethodCallbackInfo,
17
+ LiteralInfo,
18
+ ImportInfo,
19
+ ExportInfo,
20
+ HttpRequestInfo,
21
+ VariableAssignmentInfo,
22
+ CallArgumentInfo,
23
+ ParameterInfo,
24
+ CounterRef,
25
+ ProcessedNodes
26
+ } from '../types.js';
27
+
28
+ /**
29
+ * Module info passed to visitors
30
+ */
31
+ export interface VisitorModule {
32
+ id: string;
33
+ file: string;
34
+ name: string;
35
+ [key: string]: unknown;
36
+ }
37
+
38
+ // Re-export types that were previously defined locally
39
+ export type { CounterRef, ProcessedNodes, VariableAssignmentInfo as VariableAssignment };
40
+
41
+ /**
42
+ * Shared collections populated by visitors
43
+ */
44
+ export interface VisitorCollections {
45
+ // Core collections - all optional for partial passing
46
+ functions?: FunctionInfo[];
47
+ classes?: ClassDeclarationInfo[];
48
+ methods?: FunctionInfo[]; // Methods are also FunctionInfo
49
+ imports?: ImportInfo[];
50
+ exports?: ExportInfo[];
51
+ variables?: VariableDeclarationInfo[];
52
+ variableDeclarations?: VariableDeclarationInfo[]; // Alias for variables
53
+ variableAssignments?: VariableAssignmentInfo[];
54
+ callSites?: CallSiteInfo[];
55
+ methodCalls?: MethodCallInfo[];
56
+ eventListeners?: EventListenerInfo[];
57
+ methodCallbacks?: MethodCallbackInfo[];
58
+ classInstantiations?: ClassInstantiationInfo[];
59
+ classDeclarations?: ClassDeclarationInfo[]; // Alias for classes
60
+ literals?: LiteralInfo[];
61
+ callArguments?: CallArgumentInfo[];
62
+ scopes?: ScopeInfo[];
63
+ httpRequests?: HttpRequestInfo[];
64
+ parameters?: ParameterInfo[];
65
+ sideEffects?: unknown[]; // TODO: define SideEffectInfo type
66
+ code?: string; // Source code for condition extraction
67
+
68
+ // Counters - optional
69
+ functionCounterRef?: CounterRef;
70
+ callSiteCounterRef?: CounterRef;
71
+ literalCounterRef?: CounterRef;
72
+ variableCounterRef?: CounterRef;
73
+ scopeCounterRef?: CounterRef;
74
+ ifScopeCounterRef?: CounterRef;
75
+ varDeclCounterRef?: CounterRef;
76
+ httpRequestCounterRef?: CounterRef;
77
+ anonymousFunctionCounterRef?: CounterRef;
78
+
79
+ // Deduplication - optional
80
+ processedNodes?: ProcessedNodes;
81
+
82
+ // Allow additional collections
83
+ [key: string]: unknown;
84
+ }
85
+
86
+ /**
87
+ * Location info extracted from AST node
88
+ */
89
+ export interface LocationInfo {
90
+ line: number | undefined;
91
+ column: number | undefined;
92
+ }
93
+
94
+ /**
95
+ * Handler function type for Babel traverse
96
+ */
97
+ export type VisitorHandler = (path: NodePath) => void;
98
+
99
+ /**
100
+ * Visitor handlers object
101
+ */
102
+ export interface VisitorHandlers {
103
+ [nodeType: string]: VisitorHandler;
104
+ }
105
+
106
+ /**
107
+ * Base class for AST visitors
108
+ */
109
+ export abstract class ASTVisitor {
110
+ protected module: VisitorModule;
111
+ protected collections: VisitorCollections;
112
+
113
+ /**
114
+ * @param module - Current module being analyzed (file, path etc)
115
+ * @param collections - Shared collections to populate
116
+ */
117
+ constructor(module: VisitorModule, collections: VisitorCollections) {
118
+ this.module = module;
119
+ this.collections = collections;
120
+ }
121
+
122
+ /**
123
+ * Returns the Babel traverse visitor handlers
124
+ * @returns Object with AST node type handlers
125
+ */
126
+ abstract getHandlers(): VisitorHandlers;
127
+
128
+ /**
129
+ * Utility to get source location info
130
+ */
131
+ protected getLoc(node: Node): LocationInfo {
132
+ return {
133
+ line: node.loc?.start?.line,
134
+ column: node.loc?.start?.column
135
+ };
136
+ }
137
+ }