@grafema/core 0.2.5-beta → 0.2.7

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 (769) hide show
  1. package/README.md +61 -23
  2. package/dist/DiscoveryManager.d.ts +59 -0
  3. package/dist/DiscoveryManager.d.ts.map +1 -0
  4. package/dist/DiscoveryManager.js +249 -0
  5. package/dist/DiscoveryManager.js.map +1 -0
  6. package/dist/GraphInitializer.d.ts +44 -0
  7. package/dist/GraphInitializer.d.ts.map +1 -0
  8. package/dist/GraphInitializer.js +121 -0
  9. package/dist/GraphInitializer.js.map +1 -0
  10. package/dist/GuaranteeChecker.d.ts +35 -0
  11. package/dist/GuaranteeChecker.d.ts.map +1 -0
  12. package/dist/GuaranteeChecker.js +81 -0
  13. package/dist/GuaranteeChecker.js.map +1 -0
  14. package/dist/Orchestrator.d.ts +34 -151
  15. package/dist/Orchestrator.d.ts.map +1 -1
  16. package/dist/Orchestrator.js +173 -741
  17. package/dist/Orchestrator.js.map +1 -1
  18. package/dist/OrchestratorTypes.d.ts +115 -0
  19. package/dist/OrchestratorTypes.d.ts.map +1 -0
  20. package/dist/OrchestratorTypes.js +6 -0
  21. package/dist/OrchestratorTypes.js.map +1 -0
  22. package/dist/ParallelAnalysisRunner.d.ts +43 -0
  23. package/dist/ParallelAnalysisRunner.d.ts.map +1 -0
  24. package/dist/ParallelAnalysisRunner.js +161 -0
  25. package/dist/ParallelAnalysisRunner.js.map +1 -0
  26. package/dist/PhaseRunner.d.ts +94 -0
  27. package/dist/PhaseRunner.d.ts.map +1 -0
  28. package/dist/PhaseRunner.js +332 -0
  29. package/dist/PhaseRunner.js.map +1 -0
  30. package/dist/config/ConfigLoader.d.ts +51 -1
  31. package/dist/config/ConfigLoader.d.ts.map +1 -1
  32. package/dist/config/ConfigLoader.js +121 -1
  33. package/dist/config/ConfigLoader.js.map +1 -1
  34. package/dist/config/index.d.ts +1 -1
  35. package/dist/config/index.d.ts.map +1 -1
  36. package/dist/config/index.js +1 -1
  37. package/dist/config/index.js.map +1 -1
  38. package/dist/core/ASTWorker.d.ts +2 -0
  39. package/dist/core/ASTWorker.d.ts.map +1 -1
  40. package/dist/core/ASTWorker.js +6 -2
  41. package/dist/core/ASTWorker.js.map +1 -1
  42. package/dist/core/FileOverview.d.ts +124 -0
  43. package/dist/core/FileOverview.d.ts.map +1 -0
  44. package/dist/core/FileOverview.js +257 -0
  45. package/dist/core/FileOverview.js.map +1 -0
  46. package/dist/core/GraphFreshnessChecker.d.ts +1 -1
  47. package/dist/core/GraphFreshnessChecker.d.ts.map +1 -1
  48. package/dist/core/GraphFreshnessChecker.js +7 -5
  49. package/dist/core/GraphFreshnessChecker.js.map +1 -1
  50. package/dist/core/GuaranteeManager.d.ts +13 -0
  51. package/dist/core/GuaranteeManager.d.ts.map +1 -1
  52. package/dist/core/GuaranteeManager.js +63 -2
  53. package/dist/core/GuaranteeManager.js.map +1 -1
  54. package/dist/core/IncrementalReanalyzer.d.ts.map +1 -1
  55. package/dist/core/IncrementalReanalyzer.js +6 -3
  56. package/dist/core/IncrementalReanalyzer.js.map +1 -1
  57. package/dist/core/NodeFactory.d.ts +81 -415
  58. package/dist/core/NodeFactory.d.ts.map +1 -1
  59. package/dist/core/NodeFactory.js +139 -336
  60. package/dist/core/NodeFactory.js.map +1 -1
  61. package/dist/core/ResourceRegistry.d.ts +17 -0
  62. package/dist/core/ResourceRegistry.d.ts.map +1 -0
  63. package/dist/core/ResourceRegistry.js +32 -0
  64. package/dist/core/ResourceRegistry.js.map +1 -0
  65. package/dist/core/ScopeTracker.d.ts +12 -0
  66. package/dist/core/ScopeTracker.d.ts.map +1 -1
  67. package/dist/core/ScopeTracker.js +24 -0
  68. package/dist/core/ScopeTracker.js.map +1 -1
  69. package/dist/core/SemanticId.d.ts +69 -0
  70. package/dist/core/SemanticId.d.ts.map +1 -1
  71. package/dist/core/SemanticId.js +134 -0
  72. package/dist/core/SemanticId.js.map +1 -1
  73. package/dist/core/brandNodeInternal.d.ts +14 -0
  74. package/dist/core/brandNodeInternal.d.ts.map +1 -0
  75. package/dist/core/brandNodeInternal.js +4 -0
  76. package/dist/core/brandNodeInternal.js.map +1 -0
  77. package/dist/core/buildDependencyGraph.d.ts +36 -0
  78. package/dist/core/buildDependencyGraph.d.ts.map +1 -0
  79. package/dist/core/buildDependencyGraph.js +78 -0
  80. package/dist/core/buildDependencyGraph.js.map +1 -0
  81. package/dist/core/factories/CoreFactory.d.ts +223 -0
  82. package/dist/core/factories/CoreFactory.d.ts.map +1 -0
  83. package/dist/core/factories/CoreFactory.js +127 -0
  84. package/dist/core/factories/CoreFactory.js.map +1 -0
  85. package/dist/core/factories/DatabaseFactory.d.ts +29 -0
  86. package/dist/core/factories/DatabaseFactory.d.ts.map +1 -0
  87. package/dist/core/factories/DatabaseFactory.js +25 -0
  88. package/dist/core/factories/DatabaseFactory.js.map +1 -0
  89. package/dist/core/factories/ExternalFactory.d.ts +11 -0
  90. package/dist/core/factories/ExternalFactory.d.ts.map +1 -0
  91. package/dist/core/factories/ExternalFactory.js +16 -0
  92. package/dist/core/factories/ExternalFactory.js.map +1 -0
  93. package/dist/core/factories/HttpFactory.d.ts +22 -0
  94. package/dist/core/factories/HttpFactory.d.ts.map +1 -0
  95. package/dist/core/factories/HttpFactory.js +32 -0
  96. package/dist/core/factories/HttpFactory.js.map +1 -0
  97. package/dist/core/factories/ReactFactory.d.ts +14 -0
  98. package/dist/core/factories/ReactFactory.d.ts.map +1 -0
  99. package/dist/core/factories/ReactFactory.js +13 -0
  100. package/dist/core/factories/ReactFactory.js.map +1 -0
  101. package/dist/core/factories/RustFactory.d.ts +62 -0
  102. package/dist/core/factories/RustFactory.d.ts.map +1 -0
  103. package/dist/core/factories/RustFactory.js +32 -0
  104. package/dist/core/factories/RustFactory.js.map +1 -0
  105. package/dist/core/factories/ServiceFactory.d.ts +12 -0
  106. package/dist/core/factories/ServiceFactory.d.ts.map +1 -0
  107. package/dist/core/factories/ServiceFactory.js +22 -0
  108. package/dist/core/factories/ServiceFactory.js.map +1 -0
  109. package/dist/core/factories/SocketFactory.d.ts +31 -0
  110. package/dist/core/factories/SocketFactory.d.ts.map +1 -0
  111. package/dist/core/factories/SocketFactory.js +35 -0
  112. package/dist/core/factories/SocketFactory.js.map +1 -0
  113. package/dist/core/nodes/DatabaseNode.d.ts +85 -0
  114. package/dist/core/nodes/DatabaseNode.d.ts.map +1 -0
  115. package/dist/core/nodes/DatabaseNode.js +118 -0
  116. package/dist/core/nodes/DatabaseNode.js.map +1 -0
  117. package/dist/core/nodes/ExpressMiddlewareNode.d.ts +47 -0
  118. package/dist/core/nodes/ExpressMiddlewareNode.d.ts.map +1 -0
  119. package/dist/core/nodes/ExpressMiddlewareNode.js +63 -0
  120. package/dist/core/nodes/ExpressMiddlewareNode.js.map +1 -0
  121. package/dist/core/nodes/ExpressMountNode.d.ts +44 -0
  122. package/dist/core/nodes/ExpressMountNode.d.ts.map +1 -0
  123. package/dist/core/nodes/ExpressMountNode.js +61 -0
  124. package/dist/core/nodes/ExpressMountNode.js.map +1 -0
  125. package/dist/core/nodes/ExternalApiNode.d.ts +29 -0
  126. package/dist/core/nodes/ExternalApiNode.d.ts.map +1 -0
  127. package/dist/core/nodes/ExternalApiNode.js +41 -0
  128. package/dist/core/nodes/ExternalApiNode.js.map +1 -0
  129. package/dist/core/nodes/ExternalFunctionNode.d.ts +40 -0
  130. package/dist/core/nodes/ExternalFunctionNode.d.ts.map +1 -0
  131. package/dist/core/nodes/ExternalFunctionNode.js +54 -0
  132. package/dist/core/nodes/ExternalFunctionNode.js.map +1 -0
  133. package/dist/core/nodes/FetchRequestNode.d.ts +54 -0
  134. package/dist/core/nodes/FetchRequestNode.d.ts.map +1 -0
  135. package/dist/core/nodes/FetchRequestNode.js +67 -0
  136. package/dist/core/nodes/FetchRequestNode.js.map +1 -0
  137. package/dist/core/nodes/HttpRouteNode.d.ts +58 -0
  138. package/dist/core/nodes/HttpRouteNode.d.ts.map +1 -0
  139. package/dist/core/nodes/HttpRouteNode.js +72 -0
  140. package/dist/core/nodes/HttpRouteNode.js.map +1 -0
  141. package/dist/core/nodes/NodeKind.d.ts +1 -0
  142. package/dist/core/nodes/NodeKind.d.ts.map +1 -1
  143. package/dist/core/nodes/NodeKind.js +1 -0
  144. package/dist/core/nodes/NodeKind.js.map +1 -1
  145. package/dist/core/nodes/ReactNode.d.ts +53 -0
  146. package/dist/core/nodes/ReactNode.d.ts.map +1 -0
  147. package/dist/core/nodes/ReactNode.js +70 -0
  148. package/dist/core/nodes/ReactNode.js.map +1 -0
  149. package/dist/core/nodes/RustCallNode.d.ts +46 -0
  150. package/dist/core/nodes/RustCallNode.d.ts.map +1 -0
  151. package/dist/core/nodes/RustCallNode.js +62 -0
  152. package/dist/core/nodes/RustCallNode.js.map +1 -0
  153. package/dist/core/nodes/RustFunctionNode.d.ts +58 -0
  154. package/dist/core/nodes/RustFunctionNode.d.ts.map +1 -0
  155. package/dist/core/nodes/RustFunctionNode.js +67 -0
  156. package/dist/core/nodes/RustFunctionNode.js.map +1 -0
  157. package/dist/core/nodes/RustImplNode.d.ts +35 -0
  158. package/dist/core/nodes/RustImplNode.d.ts.map +1 -0
  159. package/dist/core/nodes/RustImplNode.js +55 -0
  160. package/dist/core/nodes/RustImplNode.js.map +1 -0
  161. package/dist/core/nodes/RustMethodNode.d.ts +64 -0
  162. package/dist/core/nodes/RustMethodNode.d.ts.map +1 -0
  163. package/dist/core/nodes/RustMethodNode.js +76 -0
  164. package/dist/core/nodes/RustMethodNode.js.map +1 -0
  165. package/dist/core/nodes/RustModuleNode.d.ts +40 -0
  166. package/dist/core/nodes/RustModuleNode.d.ts.map +1 -0
  167. package/dist/core/nodes/RustModuleNode.js +57 -0
  168. package/dist/core/nodes/RustModuleNode.js.map +1 -0
  169. package/dist/core/nodes/RustStructNode.d.ts +38 -0
  170. package/dist/core/nodes/RustStructNode.d.ts.map +1 -0
  171. package/dist/core/nodes/RustStructNode.js +54 -0
  172. package/dist/core/nodes/RustStructNode.js.map +1 -0
  173. package/dist/core/nodes/RustTraitNode.d.ts +40 -0
  174. package/dist/core/nodes/RustTraitNode.d.ts.map +1 -0
  175. package/dist/core/nodes/RustTraitNode.js +52 -0
  176. package/dist/core/nodes/RustTraitNode.js.map +1 -0
  177. package/dist/core/nodes/ServiceLayerNode.d.ts +85 -0
  178. package/dist/core/nodes/ServiceLayerNode.d.ts.map +1 -0
  179. package/dist/core/nodes/ServiceLayerNode.js +122 -0
  180. package/dist/core/nodes/ServiceLayerNode.js.map +1 -0
  181. package/dist/core/nodes/SocketIONode.d.ts +71 -0
  182. package/dist/core/nodes/SocketIONode.d.ts.map +1 -0
  183. package/dist/core/nodes/SocketIONode.js +111 -0
  184. package/dist/core/nodes/SocketIONode.js.map +1 -0
  185. package/dist/core/nodes/SocketNode.d.ts +87 -0
  186. package/dist/core/nodes/SocketNode.d.ts.map +1 -0
  187. package/dist/core/nodes/SocketNode.js +124 -0
  188. package/dist/core/nodes/SocketNode.js.map +1 -0
  189. package/dist/core/nodes/TypeNode.d.ts +26 -1
  190. package/dist/core/nodes/TypeNode.d.ts.map +1 -1
  191. package/dist/core/nodes/TypeNode.js +21 -3
  192. package/dist/core/nodes/TypeNode.js.map +1 -1
  193. package/dist/core/nodes/TypeParameterNode.d.ts +44 -0
  194. package/dist/core/nodes/TypeParameterNode.d.ts.map +1 -0
  195. package/dist/core/nodes/TypeParameterNode.js +64 -0
  196. package/dist/core/nodes/TypeParameterNode.js.map +1 -0
  197. package/dist/core/nodes/index.d.ts +19 -0
  198. package/dist/core/nodes/index.d.ts.map +1 -1
  199. package/dist/core/nodes/index.js +26 -0
  200. package/dist/core/nodes/index.js.map +1 -1
  201. package/dist/index.d.ts +33 -6
  202. package/dist/index.d.ts.map +1 -1
  203. package/dist/index.js +30 -3
  204. package/dist/index.js.map +1 -1
  205. package/dist/plugins/InfraAnalyzer.d.ts +110 -0
  206. package/dist/plugins/InfraAnalyzer.d.ts.map +1 -0
  207. package/dist/plugins/InfraAnalyzer.js +170 -0
  208. package/dist/plugins/InfraAnalyzer.js.map +1 -0
  209. package/dist/plugins/analysis/DatabaseAnalyzer.d.ts.map +1 -1
  210. package/dist/plugins/analysis/DatabaseAnalyzer.js +18 -15
  211. package/dist/plugins/analysis/DatabaseAnalyzer.js.map +1 -1
  212. package/dist/plugins/analysis/ExpressAnalyzer.d.ts.map +1 -1
  213. package/dist/plugins/analysis/ExpressAnalyzer.js +27 -26
  214. package/dist/plugins/analysis/ExpressAnalyzer.js.map +1 -1
  215. package/dist/plugins/analysis/ExpressResponseAnalyzer.d.ts.map +1 -1
  216. package/dist/plugins/analysis/ExpressResponseAnalyzer.js +5 -3
  217. package/dist/plugins/analysis/ExpressResponseAnalyzer.js.map +1 -1
  218. package/dist/plugins/analysis/ExpressRouteAnalyzer.d.ts.map +1 -1
  219. package/dist/plugins/analysis/ExpressRouteAnalyzer.js +36 -39
  220. package/dist/plugins/analysis/ExpressRouteAnalyzer.js.map +1 -1
  221. package/dist/plugins/analysis/FetchAnalyzer.d.ts.map +1 -1
  222. package/dist/plugins/analysis/FetchAnalyzer.js +23 -39
  223. package/dist/plugins/analysis/FetchAnalyzer.js.map +1 -1
  224. package/dist/plugins/analysis/IncrementalAnalysisPlugin.d.ts.map +1 -1
  225. package/dist/plugins/analysis/IncrementalAnalysisPlugin.js +3 -2
  226. package/dist/plugins/analysis/IncrementalAnalysisPlugin.js.map +1 -1
  227. package/dist/plugins/analysis/JSASTAnalyzer.d.ts +23 -85
  228. package/dist/plugins/analysis/JSASTAnalyzer.d.ts.map +1 -1
  229. package/dist/plugins/analysis/JSASTAnalyzer.js +351 -1887
  230. package/dist/plugins/analysis/JSASTAnalyzer.js.map +1 -1
  231. package/dist/plugins/analysis/NestJSRouteAnalyzer.d.ts +28 -0
  232. package/dist/plugins/analysis/NestJSRouteAnalyzer.d.ts.map +1 -0
  233. package/dist/plugins/analysis/NestJSRouteAnalyzer.js +196 -0
  234. package/dist/plugins/analysis/NestJSRouteAnalyzer.js.map +1 -0
  235. package/dist/plugins/analysis/ReactAnalyzer.d.ts +1 -61
  236. package/dist/plugins/analysis/ReactAnalyzer.d.ts.map +1 -1
  237. package/dist/plugins/analysis/ReactAnalyzer.js +24 -915
  238. package/dist/plugins/analysis/ReactAnalyzer.js.map +1 -1
  239. package/dist/plugins/analysis/RustAnalyzer.d.ts.map +1 -1
  240. package/dist/plugins/analysis/RustAnalyzer.js +31 -66
  241. package/dist/plugins/analysis/RustAnalyzer.js.map +1 -1
  242. package/dist/plugins/analysis/SQLiteAnalyzer.d.ts.map +1 -1
  243. package/dist/plugins/analysis/SQLiteAnalyzer.js +13 -6
  244. package/dist/plugins/analysis/SQLiteAnalyzer.js.map +1 -1
  245. package/dist/plugins/analysis/ServiceLayerAnalyzer.d.ts.map +1 -1
  246. package/dist/plugins/analysis/ServiceLayerAnalyzer.js +10 -7
  247. package/dist/plugins/analysis/ServiceLayerAnalyzer.js.map +1 -1
  248. package/dist/plugins/analysis/SocketAnalyzer.d.ts +81 -0
  249. package/dist/plugins/analysis/SocketAnalyzer.d.ts.map +1 -0
  250. package/dist/plugins/analysis/SocketAnalyzer.js +475 -0
  251. package/dist/plugins/analysis/SocketAnalyzer.js.map +1 -0
  252. package/dist/plugins/analysis/SocketIOAnalyzer.d.ts.map +1 -1
  253. package/dist/plugins/analysis/SocketIOAnalyzer.js +13 -18
  254. package/dist/plugins/analysis/SocketIOAnalyzer.js.map +1 -1
  255. package/dist/plugins/analysis/SystemDbAnalyzer.d.ts.map +1 -1
  256. package/dist/plugins/analysis/SystemDbAnalyzer.js +8 -5
  257. package/dist/plugins/analysis/SystemDbAnalyzer.js.map +1 -1
  258. package/dist/plugins/analysis/ast/CollisionResolver.d.ts +65 -0
  259. package/dist/plugins/analysis/ast/CollisionResolver.d.ts.map +1 -0
  260. package/dist/plugins/analysis/ast/CollisionResolver.js +106 -0
  261. package/dist/plugins/analysis/ast/CollisionResolver.js.map +1 -0
  262. package/dist/plugins/analysis/ast/FunctionBodyContext.d.ts +124 -0
  263. package/dist/plugins/analysis/ast/FunctionBodyContext.d.ts.map +1 -0
  264. package/dist/plugins/analysis/ast/FunctionBodyContext.js +151 -0
  265. package/dist/plugins/analysis/ast/FunctionBodyContext.js.map +1 -0
  266. package/dist/plugins/analysis/ast/GraphBuilder.d.ts +26 -261
  267. package/dist/plugins/analysis/ast/GraphBuilder.d.ts.map +1 -1
  268. package/dist/plugins/analysis/ast/GraphBuilder.js +251 -2494
  269. package/dist/plugins/analysis/ast/GraphBuilder.js.map +1 -1
  270. package/dist/plugins/analysis/ast/IdGenerator.d.ts +42 -0
  271. package/dist/plugins/analysis/ast/IdGenerator.d.ts.map +1 -1
  272. package/dist/plugins/analysis/ast/IdGenerator.js +61 -1
  273. package/dist/plugins/analysis/ast/IdGenerator.js.map +1 -1
  274. package/dist/plugins/analysis/ast/builders/AssignmentBuilder.d.ts +15 -0
  275. package/dist/plugins/analysis/ast/builders/AssignmentBuilder.d.ts.map +1 -0
  276. package/dist/plugins/analysis/ast/builders/AssignmentBuilder.js +274 -0
  277. package/dist/plugins/analysis/ast/builders/AssignmentBuilder.js.map +1 -0
  278. package/dist/plugins/analysis/ast/builders/CallFlowBuilder.d.ts +22 -0
  279. package/dist/plugins/analysis/ast/builders/CallFlowBuilder.d.ts.map +1 -0
  280. package/dist/plugins/analysis/ast/builders/CallFlowBuilder.js +178 -0
  281. package/dist/plugins/analysis/ast/builders/CallFlowBuilder.js.map +1 -0
  282. package/dist/plugins/analysis/ast/builders/ControlFlowBuilder.d.ts +76 -0
  283. package/dist/plugins/analysis/ast/builders/ControlFlowBuilder.d.ts.map +1 -0
  284. package/dist/plugins/analysis/ast/builders/ControlFlowBuilder.js +387 -0
  285. package/dist/plugins/analysis/ast/builders/ControlFlowBuilder.js.map +1 -0
  286. package/dist/plugins/analysis/ast/builders/CoreBuilder.d.ts +38 -0
  287. package/dist/plugins/analysis/ast/builders/CoreBuilder.d.ts.map +1 -0
  288. package/dist/plugins/analysis/ast/builders/CoreBuilder.js +240 -0
  289. package/dist/plugins/analysis/ast/builders/CoreBuilder.js.map +1 -0
  290. package/dist/plugins/analysis/ast/builders/ModuleRuntimeBuilder.d.ts +53 -0
  291. package/dist/plugins/analysis/ast/builders/ModuleRuntimeBuilder.d.ts.map +1 -0
  292. package/dist/plugins/analysis/ast/builders/ModuleRuntimeBuilder.js +355 -0
  293. package/dist/plugins/analysis/ast/builders/ModuleRuntimeBuilder.js.map +1 -0
  294. package/dist/plugins/analysis/ast/builders/MutationBuilder.d.ts +46 -0
  295. package/dist/plugins/analysis/ast/builders/MutationBuilder.d.ts.map +1 -0
  296. package/dist/plugins/analysis/ast/builders/MutationBuilder.js +264 -0
  297. package/dist/plugins/analysis/ast/builders/MutationBuilder.js.map +1 -0
  298. package/dist/plugins/analysis/ast/builders/ReturnBuilder.d.ts +23 -0
  299. package/dist/plugins/analysis/ast/builders/ReturnBuilder.d.ts.map +1 -0
  300. package/dist/plugins/analysis/ast/builders/ReturnBuilder.js +206 -0
  301. package/dist/plugins/analysis/ast/builders/ReturnBuilder.js.map +1 -0
  302. package/dist/plugins/analysis/ast/builders/TypeSystemBuilder.d.ts +64 -0
  303. package/dist/plugins/analysis/ast/builders/TypeSystemBuilder.d.ts.map +1 -0
  304. package/dist/plugins/analysis/ast/builders/TypeSystemBuilder.js +370 -0
  305. package/dist/plugins/analysis/ast/builders/TypeSystemBuilder.js.map +1 -0
  306. package/dist/plugins/analysis/ast/builders/UpdateExpressionBuilder.d.ts +46 -0
  307. package/dist/plugins/analysis/ast/builders/UpdateExpressionBuilder.d.ts.map +1 -0
  308. package/dist/plugins/analysis/ast/builders/UpdateExpressionBuilder.js +191 -0
  309. package/dist/plugins/analysis/ast/builders/UpdateExpressionBuilder.js.map +1 -0
  310. package/dist/plugins/analysis/ast/builders/YieldBuilder.d.ts +30 -0
  311. package/dist/plugins/analysis/ast/builders/YieldBuilder.d.ts.map +1 -0
  312. package/dist/plugins/analysis/ast/builders/YieldBuilder.js +214 -0
  313. package/dist/plugins/analysis/ast/builders/YieldBuilder.js.map +1 -0
  314. package/dist/plugins/analysis/ast/builders/index.d.ts +12 -0
  315. package/dist/plugins/analysis/ast/builders/index.d.ts.map +1 -0
  316. package/dist/plugins/analysis/ast/builders/index.js +11 -0
  317. package/dist/plugins/analysis/ast/builders/index.js.map +1 -0
  318. package/dist/plugins/analysis/ast/builders/types.d.ts +30 -0
  319. package/dist/plugins/analysis/ast/builders/types.d.ts.map +1 -0
  320. package/dist/plugins/analysis/ast/builders/types.js +8 -0
  321. package/dist/plugins/analysis/ast/builders/types.js.map +1 -0
  322. package/dist/plugins/analysis/ast/handlers/AnalyzerDelegate.d.ts +50 -0
  323. package/dist/plugins/analysis/ast/handlers/AnalyzerDelegate.d.ts.map +1 -0
  324. package/dist/plugins/analysis/ast/handlers/AnalyzerDelegate.js +2 -0
  325. package/dist/plugins/analysis/ast/handlers/AnalyzerDelegate.js.map +1 -0
  326. package/dist/plugins/analysis/ast/handlers/BranchHandler.d.ts +18 -0
  327. package/dist/plugins/analysis/ast/handlers/BranchHandler.d.ts.map +1 -0
  328. package/dist/plugins/analysis/ast/handlers/BranchHandler.js +244 -0
  329. package/dist/plugins/analysis/ast/handlers/BranchHandler.js.map +1 -0
  330. package/dist/plugins/analysis/ast/handlers/CallExpressionHandler.d.ts +7 -0
  331. package/dist/plugins/analysis/ast/handlers/CallExpressionHandler.d.ts.map +1 -0
  332. package/dist/plugins/analysis/ast/handlers/CallExpressionHandler.js +295 -0
  333. package/dist/plugins/analysis/ast/handlers/CallExpressionHandler.js.map +1 -0
  334. package/dist/plugins/analysis/ast/handlers/FunctionBodyHandler.d.ts +22 -0
  335. package/dist/plugins/analysis/ast/handlers/FunctionBodyHandler.d.ts.map +1 -0
  336. package/dist/plugins/analysis/ast/handlers/FunctionBodyHandler.js +9 -0
  337. package/dist/plugins/analysis/ast/handlers/FunctionBodyHandler.js.map +1 -0
  338. package/dist/plugins/analysis/ast/handlers/LoopHandler.d.ts +13 -0
  339. package/dist/plugins/analysis/ast/handlers/LoopHandler.d.ts.map +1 -0
  340. package/dist/plugins/analysis/ast/handlers/LoopHandler.js +207 -0
  341. package/dist/plugins/analysis/ast/handlers/LoopHandler.js.map +1 -0
  342. package/dist/plugins/analysis/ast/handlers/NestedFunctionHandler.d.ts +13 -0
  343. package/dist/plugins/analysis/ast/handlers/NestedFunctionHandler.d.ts.map +1 -0
  344. package/dist/plugins/analysis/ast/handlers/NestedFunctionHandler.js +174 -0
  345. package/dist/plugins/analysis/ast/handlers/NestedFunctionHandler.js.map +1 -0
  346. package/dist/plugins/analysis/ast/handlers/NewExpressionHandler.d.ts +12 -0
  347. package/dist/plugins/analysis/ast/handlers/NewExpressionHandler.d.ts.map +1 -0
  348. package/dist/plugins/analysis/ast/handlers/NewExpressionHandler.js +135 -0
  349. package/dist/plugins/analysis/ast/handlers/NewExpressionHandler.js.map +1 -0
  350. package/dist/plugins/analysis/ast/handlers/PropertyAccessHandler.d.ts +13 -0
  351. package/dist/plugins/analysis/ast/handlers/PropertyAccessHandler.d.ts.map +1 -0
  352. package/dist/plugins/analysis/ast/handlers/PropertyAccessHandler.js +71 -0
  353. package/dist/plugins/analysis/ast/handlers/PropertyAccessHandler.js.map +1 -0
  354. package/dist/plugins/analysis/ast/handlers/ReturnYieldHandler.d.ts +12 -0
  355. package/dist/plugins/analysis/ast/handlers/ReturnYieldHandler.d.ts.map +1 -0
  356. package/dist/plugins/analysis/ast/handlers/ReturnYieldHandler.js +135 -0
  357. package/dist/plugins/analysis/ast/handlers/ReturnYieldHandler.js.map +1 -0
  358. package/dist/plugins/analysis/ast/handlers/ThrowHandler.d.ts +12 -0
  359. package/dist/plugins/analysis/ast/handlers/ThrowHandler.d.ts.map +1 -0
  360. package/dist/plugins/analysis/ast/handlers/ThrowHandler.js +82 -0
  361. package/dist/plugins/analysis/ast/handlers/ThrowHandler.js.map +1 -0
  362. package/dist/plugins/analysis/ast/handlers/TryCatchHandler.d.ts +14 -0
  363. package/dist/plugins/analysis/ast/handlers/TryCatchHandler.d.ts.map +1 -0
  364. package/dist/plugins/analysis/ast/handlers/TryCatchHandler.js +220 -0
  365. package/dist/plugins/analysis/ast/handlers/TryCatchHandler.js.map +1 -0
  366. package/dist/plugins/analysis/ast/handlers/VariableHandler.d.ts +12 -0
  367. package/dist/plugins/analysis/ast/handlers/VariableHandler.d.ts.map +1 -0
  368. package/dist/plugins/analysis/ast/handlers/VariableHandler.js +57 -0
  369. package/dist/plugins/analysis/ast/handlers/VariableHandler.js.map +1 -0
  370. package/dist/plugins/analysis/ast/handlers/index.d.ts +13 -0
  371. package/dist/plugins/analysis/ast/handlers/index.d.ts.map +1 -0
  372. package/dist/plugins/analysis/ast/handlers/index.js +12 -0
  373. package/dist/plugins/analysis/ast/handlers/index.js.map +1 -0
  374. package/dist/plugins/analysis/ast/types.d.ts +57 -6
  375. package/dist/plugins/analysis/ast/types.d.ts.map +1 -1
  376. package/dist/plugins/analysis/ast/utils/createParameterNodes.d.ts +5 -4
  377. package/dist/plugins/analysis/ast/utils/createParameterNodes.d.ts.map +1 -1
  378. package/dist/plugins/analysis/ast/utils/createParameterNodes.js +94 -13
  379. package/dist/plugins/analysis/ast/utils/createParameterNodes.js.map +1 -1
  380. package/dist/plugins/analysis/ast/utils/extractNamesFromPattern.d.ts +81 -0
  381. package/dist/plugins/analysis/ast/utils/extractNamesFromPattern.d.ts.map +1 -0
  382. package/dist/plugins/analysis/ast/utils/extractNamesFromPattern.js +140 -0
  383. package/dist/plugins/analysis/ast/utils/extractNamesFromPattern.js.map +1 -0
  384. package/dist/plugins/analysis/ast/utils/getExpressionValue.d.ts +22 -0
  385. package/dist/plugins/analysis/ast/utils/getExpressionValue.d.ts.map +1 -0
  386. package/dist/plugins/analysis/ast/utils/getExpressionValue.js +35 -0
  387. package/dist/plugins/analysis/ast/utils/getExpressionValue.js.map +1 -0
  388. package/dist/plugins/analysis/ast/utils/getMemberExpressionName.d.ts +25 -0
  389. package/dist/plugins/analysis/ast/utils/getMemberExpressionName.d.ts.map +1 -0
  390. package/dist/plugins/analysis/ast/utils/getMemberExpressionName.js +21 -0
  391. package/dist/plugins/analysis/ast/utils/getMemberExpressionName.js.map +1 -0
  392. package/dist/plugins/analysis/ast/utils/index.d.ts +2 -0
  393. package/dist/plugins/analysis/ast/utils/index.d.ts.map +1 -1
  394. package/dist/plugins/analysis/ast/utils/index.js +2 -0
  395. package/dist/plugins/analysis/ast/utils/index.js.map +1 -1
  396. package/dist/plugins/analysis/ast/visitors/ArgumentExtractor.d.ts +23 -0
  397. package/dist/plugins/analysis/ast/visitors/ArgumentExtractor.d.ts.map +1 -0
  398. package/dist/plugins/analysis/ast/visitors/ArgumentExtractor.js +241 -0
  399. package/dist/plugins/analysis/ast/visitors/ArgumentExtractor.js.map +1 -0
  400. package/dist/plugins/analysis/ast/visitors/ArrayElementExtractor.d.ts +20 -0
  401. package/dist/plugins/analysis/ast/visitors/ArrayElementExtractor.d.ts.map +1 -0
  402. package/dist/plugins/analysis/ast/visitors/ArrayElementExtractor.js +110 -0
  403. package/dist/plugins/analysis/ast/visitors/ArrayElementExtractor.js.map +1 -0
  404. package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.d.ts +15 -142
  405. package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.d.ts.map +1 -1
  406. package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.js +304 -937
  407. package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.js.map +1 -1
  408. package/dist/plugins/analysis/ast/visitors/ClassVisitor.d.ts.map +1 -1
  409. package/dist/plugins/analysis/ast/visitors/ClassVisitor.js +26 -11
  410. package/dist/plugins/analysis/ast/visitors/ClassVisitor.js.map +1 -1
  411. package/dist/plugins/analysis/ast/visitors/FunctionVisitor.d.ts.map +1 -1
  412. package/dist/plugins/analysis/ast/visitors/FunctionVisitor.js +21 -6
  413. package/dist/plugins/analysis/ast/visitors/FunctionVisitor.js.map +1 -1
  414. package/dist/plugins/analysis/ast/visitors/MutationDetector.d.ts +25 -0
  415. package/dist/plugins/analysis/ast/visitors/MutationDetector.d.ts.map +1 -0
  416. package/dist/plugins/analysis/ast/visitors/MutationDetector.js +181 -0
  417. package/dist/plugins/analysis/ast/visitors/MutationDetector.js.map +1 -0
  418. package/dist/plugins/analysis/ast/visitors/ObjectPropertyExtractor.d.ts +20 -0
  419. package/dist/plugins/analysis/ast/visitors/ObjectPropertyExtractor.d.ts.map +1 -0
  420. package/dist/plugins/analysis/ast/visitors/ObjectPropertyExtractor.js +155 -0
  421. package/dist/plugins/analysis/ast/visitors/ObjectPropertyExtractor.js.map +1 -0
  422. package/dist/plugins/analysis/ast/visitors/PropertyAccessVisitor.d.ts +9 -1
  423. package/dist/plugins/analysis/ast/visitors/PropertyAccessVisitor.d.ts.map +1 -1
  424. package/dist/plugins/analysis/ast/visitors/PropertyAccessVisitor.js +51 -3
  425. package/dist/plugins/analysis/ast/visitors/PropertyAccessVisitor.js.map +1 -1
  426. package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.d.ts +20 -0
  427. package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.d.ts.map +1 -1
  428. package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.js +188 -12
  429. package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.js.map +1 -1
  430. package/dist/plugins/analysis/ast/visitors/VariableVisitor.d.ts.map +1 -1
  431. package/dist/plugins/analysis/ast/visitors/VariableVisitor.js +6 -4
  432. package/dist/plugins/analysis/ast/visitors/VariableVisitor.js.map +1 -1
  433. package/dist/plugins/analysis/ast/visitors/call-expression-helpers.d.ts +19 -0
  434. package/dist/plugins/analysis/ast/visitors/call-expression-helpers.d.ts.map +1 -0
  435. package/dist/plugins/analysis/ast/visitors/call-expression-helpers.js +57 -0
  436. package/dist/plugins/analysis/ast/visitors/call-expression-helpers.js.map +1 -0
  437. package/dist/plugins/analysis/ast/visitors/call-expression-types.d.ts +168 -0
  438. package/dist/plugins/analysis/ast/visitors/call-expression-types.d.ts.map +1 -0
  439. package/dist/plugins/analysis/ast/visitors/call-expression-types.js +7 -0
  440. package/dist/plugins/analysis/ast/visitors/call-expression-types.js.map +1 -0
  441. package/dist/plugins/analysis/react-internal/browser-api.d.ts +20 -0
  442. package/dist/plugins/analysis/react-internal/browser-api.d.ts.map +1 -0
  443. package/dist/plugins/analysis/react-internal/browser-api.js +140 -0
  444. package/dist/plugins/analysis/react-internal/browser-api.js.map +1 -0
  445. package/dist/plugins/analysis/react-internal/hooks.d.ts +31 -0
  446. package/dist/plugins/analysis/react-internal/hooks.d.ts.map +1 -0
  447. package/dist/plugins/analysis/react-internal/hooks.js +465 -0
  448. package/dist/plugins/analysis/react-internal/hooks.js.map +1 -0
  449. package/dist/plugins/analysis/react-internal/jsx.d.ts +43 -0
  450. package/dist/plugins/analysis/react-internal/jsx.d.ts.map +1 -0
  451. package/dist/plugins/analysis/react-internal/jsx.js +231 -0
  452. package/dist/plugins/analysis/react-internal/jsx.js.map +1 -0
  453. package/dist/plugins/analysis/react-internal/types.d.ts +116 -0
  454. package/dist/plugins/analysis/react-internal/types.d.ts.map +1 -0
  455. package/dist/plugins/analysis/react-internal/types.js +83 -0
  456. package/dist/plugins/analysis/react-internal/types.js.map +1 -0
  457. package/dist/plugins/discovery/MonorepoServiceDiscovery.d.ts.map +1 -1
  458. package/dist/plugins/discovery/MonorepoServiceDiscovery.js +6 -13
  459. package/dist/plugins/discovery/MonorepoServiceDiscovery.js.map +1 -1
  460. package/dist/plugins/enrichment/AliasTracker.d.ts.map +1 -1
  461. package/dist/plugins/enrichment/AliasTracker.js +3 -1
  462. package/dist/plugins/enrichment/AliasTracker.js.map +1 -1
  463. package/dist/plugins/enrichment/ArgumentParameterLinker.d.ts.map +1 -1
  464. package/dist/plugins/enrichment/ArgumentParameterLinker.js +3 -1
  465. package/dist/plugins/enrichment/ArgumentParameterLinker.js.map +1 -1
  466. package/dist/plugins/enrichment/CallbackCallResolver.d.ts +42 -0
  467. package/dist/plugins/enrichment/CallbackCallResolver.d.ts.map +1 -0
  468. package/dist/plugins/enrichment/CallbackCallResolver.js +311 -0
  469. package/dist/plugins/enrichment/CallbackCallResolver.js.map +1 -0
  470. package/dist/plugins/enrichment/ClosureCaptureEnricher.d.ts.map +1 -1
  471. package/dist/plugins/enrichment/ClosureCaptureEnricher.js +3 -1
  472. package/dist/plugins/enrichment/ClosureCaptureEnricher.js.map +1 -1
  473. package/dist/plugins/enrichment/ConfigRoutingMapBuilder.d.ts +17 -0
  474. package/dist/plugins/enrichment/ConfigRoutingMapBuilder.d.ts.map +1 -0
  475. package/dist/plugins/enrichment/ConfigRoutingMapBuilder.js +55 -0
  476. package/dist/plugins/enrichment/ConfigRoutingMapBuilder.js.map +1 -0
  477. package/dist/plugins/enrichment/ExpressHandlerLinker.d.ts.map +1 -1
  478. package/dist/plugins/enrichment/ExpressHandlerLinker.js +3 -1
  479. package/dist/plugins/enrichment/ExpressHandlerLinker.js.map +1 -1
  480. package/dist/plugins/enrichment/ExternalCallResolver.d.ts.map +1 -1
  481. package/dist/plugins/enrichment/ExternalCallResolver.js +5 -8
  482. package/dist/plugins/enrichment/ExternalCallResolver.js.map +1 -1
  483. package/dist/plugins/enrichment/FunctionCallResolver.d.ts.map +1 -1
  484. package/dist/plugins/enrichment/FunctionCallResolver.js +6 -9
  485. package/dist/plugins/enrichment/FunctionCallResolver.js.map +1 -1
  486. package/dist/plugins/enrichment/HTTPConnectionEnricher.d.ts.map +1 -1
  487. package/dist/plugins/enrichment/HTTPConnectionEnricher.js +3 -1
  488. package/dist/plugins/enrichment/HTTPConnectionEnricher.js.map +1 -1
  489. package/dist/plugins/enrichment/ImportExportLinker.d.ts.map +1 -1
  490. package/dist/plugins/enrichment/ImportExportLinker.js +5 -3
  491. package/dist/plugins/enrichment/ImportExportLinker.js.map +1 -1
  492. package/dist/plugins/enrichment/InstanceOfResolver.d.ts.map +1 -1
  493. package/dist/plugins/enrichment/InstanceOfResolver.js +3 -1
  494. package/dist/plugins/enrichment/InstanceOfResolver.js.map +1 -1
  495. package/dist/plugins/enrichment/MethodCallResolver.d.ts +17 -68
  496. package/dist/plugins/enrichment/MethodCallResolver.d.ts.map +1 -1
  497. package/dist/plugins/enrichment/MethodCallResolver.js +42 -517
  498. package/dist/plugins/enrichment/MethodCallResolver.js.map +1 -1
  499. package/dist/plugins/enrichment/MountPointResolver.d.ts.map +1 -1
  500. package/dist/plugins/enrichment/MountPointResolver.js +9 -2
  501. package/dist/plugins/enrichment/MountPointResolver.js.map +1 -1
  502. package/dist/plugins/enrichment/NodejsBuiltinsResolver.d.ts.map +1 -1
  503. package/dist/plugins/enrichment/NodejsBuiltinsResolver.js +7 -16
  504. package/dist/plugins/enrichment/NodejsBuiltinsResolver.js.map +1 -1
  505. package/dist/plugins/enrichment/PrefixEvaluator.d.ts.map +1 -1
  506. package/dist/plugins/enrichment/PrefixEvaluator.js +6 -2
  507. package/dist/plugins/enrichment/PrefixEvaluator.js.map +1 -1
  508. package/dist/plugins/enrichment/RejectionPropagationEnricher.d.ts.map +1 -1
  509. package/dist/plugins/enrichment/RejectionPropagationEnricher.js +3 -1
  510. package/dist/plugins/enrichment/RejectionPropagationEnricher.js.map +1 -1
  511. package/dist/plugins/enrichment/RustFFIEnricher.d.ts.map +1 -1
  512. package/dist/plugins/enrichment/RustFFIEnricher.js +3 -1
  513. package/dist/plugins/enrichment/RustFFIEnricher.js.map +1 -1
  514. package/dist/plugins/enrichment/ServiceConnectionEnricher.d.ts +76 -0
  515. package/dist/plugins/enrichment/ServiceConnectionEnricher.d.ts.map +1 -0
  516. package/dist/plugins/enrichment/ServiceConnectionEnricher.js +355 -0
  517. package/dist/plugins/enrichment/ServiceConnectionEnricher.js.map +1 -0
  518. package/dist/plugins/enrichment/SocketConnectionEnricher.d.ts +42 -0
  519. package/dist/plugins/enrichment/SocketConnectionEnricher.d.ts.map +1 -0
  520. package/dist/plugins/enrichment/SocketConnectionEnricher.js +166 -0
  521. package/dist/plugins/enrichment/SocketConnectionEnricher.js.map +1 -0
  522. package/dist/plugins/enrichment/ValueDomainAnalyzer.d.ts.map +1 -1
  523. package/dist/plugins/enrichment/ValueDomainAnalyzer.js +3 -1
  524. package/dist/plugins/enrichment/ValueDomainAnalyzer.js.map +1 -1
  525. package/dist/plugins/enrichment/method-call/MethodCallData.d.ts +68 -0
  526. package/dist/plugins/enrichment/method-call/MethodCallData.d.ts.map +1 -0
  527. package/dist/plugins/enrichment/method-call/MethodCallData.js +227 -0
  528. package/dist/plugins/enrichment/method-call/MethodCallData.js.map +1 -0
  529. package/dist/plugins/enrichment/method-call/MethodCallDetectors.d.ts +21 -0
  530. package/dist/plugins/enrichment/method-call/MethodCallDetectors.d.ts.map +1 -0
  531. package/dist/plugins/enrichment/method-call/MethodCallDetectors.js +52 -0
  532. package/dist/plugins/enrichment/method-call/MethodCallDetectors.js.map +1 -0
  533. package/dist/plugins/enrichment/method-call/MethodCallErrorAnalysis.d.ts +22 -0
  534. package/dist/plugins/enrichment/method-call/MethodCallErrorAnalysis.d.ts.map +1 -0
  535. package/dist/plugins/enrichment/method-call/MethodCallErrorAnalysis.js +105 -0
  536. package/dist/plugins/enrichment/method-call/MethodCallErrorAnalysis.js.map +1 -0
  537. package/dist/plugins/enrichment/method-call/MethodCallIndexers.d.ts +19 -0
  538. package/dist/plugins/enrichment/method-call/MethodCallIndexers.d.ts.map +1 -0
  539. package/dist/plugins/enrichment/method-call/MethodCallIndexers.js +63 -0
  540. package/dist/plugins/enrichment/method-call/MethodCallIndexers.js.map +1 -0
  541. package/dist/plugins/enrichment/method-call/MethodCallResolution.d.ts +30 -0
  542. package/dist/plugins/enrichment/method-call/MethodCallResolution.d.ts.map +1 -0
  543. package/dist/plugins/enrichment/method-call/MethodCallResolution.js +138 -0
  544. package/dist/plugins/enrichment/method-call/MethodCallResolution.js.map +1 -0
  545. package/dist/plugins/indexing/IncrementalModuleIndexer.d.ts.map +1 -1
  546. package/dist/plugins/indexing/IncrementalModuleIndexer.js +2 -8
  547. package/dist/plugins/indexing/IncrementalModuleIndexer.js.map +1 -1
  548. package/dist/plugins/indexing/JSModuleIndexer.d.ts.map +1 -1
  549. package/dist/plugins/indexing/JSModuleIndexer.js +13 -20
  550. package/dist/plugins/indexing/JSModuleIndexer.js.map +1 -1
  551. package/dist/plugins/indexing/RustModuleIndexer.d.ts.map +1 -1
  552. package/dist/plugins/indexing/RustModuleIndexer.js +4 -8
  553. package/dist/plugins/indexing/RustModuleIndexer.js.map +1 -1
  554. package/dist/plugins/validation/AwaitInLoopValidator.d.ts +24 -0
  555. package/dist/plugins/validation/AwaitInLoopValidator.d.ts.map +1 -0
  556. package/dist/plugins/validation/AwaitInLoopValidator.js +69 -0
  557. package/dist/plugins/validation/AwaitInLoopValidator.js.map +1 -0
  558. package/dist/plugins/validation/PackageCoverageValidator.d.ts +33 -0
  559. package/dist/plugins/validation/PackageCoverageValidator.d.ts.map +1 -0
  560. package/dist/plugins/validation/PackageCoverageValidator.js +149 -0
  561. package/dist/plugins/validation/PackageCoverageValidator.js.map +1 -0
  562. package/dist/plugins/validation/UnconnectedRouteValidator.d.ts +18 -0
  563. package/dist/plugins/validation/UnconnectedRouteValidator.d.ts.map +1 -0
  564. package/dist/plugins/validation/UnconnectedRouteValidator.js +68 -0
  565. package/dist/plugins/validation/UnconnectedRouteValidator.js.map +1 -0
  566. package/dist/queries/NodeContext.d.ts +81 -0
  567. package/dist/queries/NodeContext.d.ts.map +1 -0
  568. package/dist/queries/NodeContext.js +193 -0
  569. package/dist/queries/NodeContext.js.map +1 -0
  570. package/dist/queries/findCallsInFunction.d.ts.map +1 -1
  571. package/dist/queries/findCallsInFunction.js +10 -2
  572. package/dist/queries/findCallsInFunction.js.map +1 -1
  573. package/dist/queries/findContainingFunction.d.ts +3 -2
  574. package/dist/queries/findContainingFunction.d.ts.map +1 -1
  575. package/dist/queries/findContainingFunction.js +13 -3
  576. package/dist/queries/findContainingFunction.js.map +1 -1
  577. package/dist/queries/index.d.ts +2 -0
  578. package/dist/queries/index.d.ts.map +1 -1
  579. package/dist/queries/index.js +1 -0
  580. package/dist/queries/index.js.map +1 -1
  581. package/dist/resources/InfraResourceMapImpl.d.ts +31 -0
  582. package/dist/resources/InfraResourceMapImpl.d.ts.map +1 -0
  583. package/dist/resources/InfraResourceMapImpl.js +110 -0
  584. package/dist/resources/InfraResourceMapImpl.js.map +1 -0
  585. package/dist/resources/RoutingMapImpl.d.ts +33 -0
  586. package/dist/resources/RoutingMapImpl.d.ts.map +1 -0
  587. package/dist/resources/RoutingMapImpl.js +115 -0
  588. package/dist/resources/RoutingMapImpl.js.map +1 -0
  589. package/dist/storage/backends/RFDBServerBackend.d.ts +35 -6
  590. package/dist/storage/backends/RFDBServerBackend.d.ts.map +1 -1
  591. package/dist/storage/backends/RFDBServerBackend.js +102 -70
  592. package/dist/storage/backends/RFDBServerBackend.js.map +1 -1
  593. package/dist/utils/findRfdbBinary.d.ts +3 -2
  594. package/dist/utils/findRfdbBinary.d.ts.map +1 -1
  595. package/dist/utils/findRfdbBinary.js +22 -7
  596. package/dist/utils/findRfdbBinary.js.map +1 -1
  597. package/dist/utils/moduleResolution.d.ts.map +1 -1
  598. package/dist/utils/moduleResolution.js +26 -1
  599. package/dist/utils/moduleResolution.js.map +1 -1
  600. package/dist/utils/resolveNodeFile.d.ts +13 -0
  601. package/dist/utils/resolveNodeFile.d.ts.map +1 -0
  602. package/dist/utils/resolveNodeFile.js +18 -0
  603. package/dist/utils/resolveNodeFile.js.map +1 -0
  604. package/dist/version.d.ts +11 -0
  605. package/dist/version.d.ts.map +1 -0
  606. package/dist/version.js +26 -0
  607. package/dist/version.js.map +1 -0
  608. package/package.json +3 -3
  609. package/src/DiscoveryManager.ts +279 -0
  610. package/src/GraphInitializer.ts +131 -0
  611. package/src/GuaranteeChecker.ts +90 -0
  612. package/src/Orchestrator.ts +222 -963
  613. package/src/OrchestratorTypes.ts +122 -0
  614. package/src/ParallelAnalysisRunner.ts +188 -0
  615. package/src/PhaseRunner.ts +450 -0
  616. package/src/config/ConfigLoader.ts +176 -2
  617. package/src/config/index.ts +2 -0
  618. package/src/core/ASTWorker.ts +9 -2
  619. package/src/core/FileOverview.ts +374 -0
  620. package/src/core/GraphFreshnessChecker.ts +7 -5
  621. package/src/core/GuaranteeManager.ts +70 -2
  622. package/src/core/IncrementalReanalyzer.ts +6 -3
  623. package/src/core/NodeFactory.ts +173 -652
  624. package/src/core/ResourceRegistry.ts +39 -0
  625. package/src/core/ScopeTracker.ts +23 -0
  626. package/src/core/SemanticId.ts +183 -0
  627. package/src/core/brandNodeInternal.ts +16 -0
  628. package/src/core/buildDependencyGraph.ts +98 -0
  629. package/src/core/factories/CoreFactory.ts +489 -0
  630. package/src/core/factories/DatabaseFactory.ts +63 -0
  631. package/src/core/factories/ExternalFactory.ts +23 -0
  632. package/src/core/factories/HttpFactory.ts +57 -0
  633. package/src/core/factories/ReactFactory.ts +15 -0
  634. package/src/core/factories/RustFactory.ts +128 -0
  635. package/src/core/factories/ServiceFactory.ts +27 -0
  636. package/src/core/factories/SocketFactory.ts +94 -0
  637. package/src/core/nodes/DatabaseNode.ts +175 -0
  638. package/src/core/nodes/ExpressMiddlewareNode.ts +98 -0
  639. package/src/core/nodes/ExpressMountNode.ts +94 -0
  640. package/src/core/nodes/ExternalApiNode.ts +53 -0
  641. package/src/core/nodes/ExternalFunctionNode.ts +77 -0
  642. package/src/core/nodes/FetchRequestNode.ts +105 -0
  643. package/src/core/nodes/HttpRouteNode.ts +113 -0
  644. package/src/core/nodes/NodeKind.ts +1 -0
  645. package/src/core/nodes/ReactNode.ts +78 -0
  646. package/src/core/nodes/RustCallNode.ts +96 -0
  647. package/src/core/nodes/RustFunctionNode.ts +112 -0
  648. package/src/core/nodes/RustImplNode.ts +78 -0
  649. package/src/core/nodes/RustMethodNode.ts +125 -0
  650. package/src/core/nodes/RustModuleNode.ts +84 -0
  651. package/src/core/nodes/RustStructNode.ts +80 -0
  652. package/src/core/nodes/RustTraitNode.ts +82 -0
  653. package/src/core/nodes/ServiceLayerNode.ts +183 -0
  654. package/src/core/nodes/SocketIONode.ts +177 -0
  655. package/src/core/nodes/SocketNode.ts +206 -0
  656. package/src/core/nodes/TypeNode.ts +46 -3
  657. package/src/core/nodes/TypeParameterNode.ts +91 -0
  658. package/src/core/nodes/index.ts +57 -0
  659. package/src/index.ts +60 -4
  660. package/src/plugins/InfraAnalyzer.ts +208 -0
  661. package/src/plugins/analysis/DatabaseAnalyzer.ts +27 -17
  662. package/src/plugins/analysis/ExpressAnalyzer.ts +51 -38
  663. package/src/plugins/analysis/ExpressResponseAnalyzer.ts +15 -12
  664. package/src/plugins/analysis/ExpressRouteAnalyzer.ts +56 -56
  665. package/src/plugins/analysis/FetchAnalyzer.ts +42 -52
  666. package/src/plugins/analysis/IncrementalAnalysisPlugin.ts +3 -2
  667. package/src/plugins/analysis/JSASTAnalyzer.ts +391 -2304
  668. package/src/plugins/analysis/NestJSRouteAnalyzer.ts +241 -0
  669. package/src/plugins/analysis/ReactAnalyzer.ts +33 -1085
  670. package/src/plugins/analysis/RustAnalyzer.ts +112 -116
  671. package/src/plugins/analysis/SQLiteAnalyzer.ts +23 -9
  672. package/src/plugins/analysis/ServiceLayerAnalyzer.ts +32 -10
  673. package/src/plugins/analysis/SocketAnalyzer.ts +601 -0
  674. package/src/plugins/analysis/SocketIOAnalyzer.ts +25 -34
  675. package/src/plugins/analysis/SystemDbAnalyzer.ts +15 -12
  676. package/src/plugins/analysis/ast/CollisionResolver.ts +137 -0
  677. package/src/plugins/analysis/ast/FunctionBodyContext.ts +291 -0
  678. package/src/plugins/analysis/ast/GraphBuilder.ts +274 -3180
  679. package/src/plugins/analysis/ast/IdGenerator.ts +81 -1
  680. package/src/plugins/analysis/ast/builders/AssignmentBuilder.ts +407 -0
  681. package/src/plugins/analysis/ast/builders/CallFlowBuilder.ts +255 -0
  682. package/src/plugins/analysis/ast/builders/ControlFlowBuilder.ts +470 -0
  683. package/src/plugins/analysis/ast/builders/CoreBuilder.ts +306 -0
  684. package/src/plugins/analysis/ast/builders/ModuleRuntimeBuilder.ts +452 -0
  685. package/src/plugins/analysis/ast/builders/MutationBuilder.ts +372 -0
  686. package/src/plugins/analysis/ast/builders/ReturnBuilder.ts +279 -0
  687. package/src/plugins/analysis/ast/builders/TypeSystemBuilder.ts +475 -0
  688. package/src/plugins/analysis/ast/builders/UpdateExpressionBuilder.ts +262 -0
  689. package/src/plugins/analysis/ast/builders/YieldBuilder.ts +287 -0
  690. package/src/plugins/analysis/ast/builders/index.ts +11 -0
  691. package/src/plugins/analysis/ast/builders/types.ts +65 -0
  692. package/src/plugins/analysis/ast/handlers/AnalyzerDelegate.ts +183 -0
  693. package/src/plugins/analysis/ast/handlers/BranchHandler.ts +313 -0
  694. package/src/plugins/analysis/ast/handlers/CallExpressionHandler.ts +347 -0
  695. package/src/plugins/analysis/ast/handlers/FunctionBodyHandler.ts +24 -0
  696. package/src/plugins/analysis/ast/handlers/LoopHandler.ts +240 -0
  697. package/src/plugins/analysis/ast/handlers/NestedFunctionHandler.ts +201 -0
  698. package/src/plugins/analysis/ast/handlers/NewExpressionHandler.ts +159 -0
  699. package/src/plugins/analysis/ast/handlers/PropertyAccessHandler.ts +112 -0
  700. package/src/plugins/analysis/ast/handlers/ReturnYieldHandler.ts +166 -0
  701. package/src/plugins/analysis/ast/handlers/ThrowHandler.ts +101 -0
  702. package/src/plugins/analysis/ast/handlers/TryCatchHandler.ts +262 -0
  703. package/src/plugins/analysis/ast/handlers/VariableHandler.ts +93 -0
  704. package/src/plugins/analysis/ast/handlers/index.ts +12 -0
  705. package/src/plugins/analysis/ast/types.ts +68 -9
  706. package/src/plugins/analysis/ast/utils/createParameterNodes.ts +118 -13
  707. package/src/plugins/analysis/ast/utils/extractNamesFromPattern.ts +166 -0
  708. package/src/plugins/analysis/ast/utils/getExpressionValue.ts +34 -0
  709. package/src/plugins/analysis/ast/utils/getMemberExpressionName.ts +33 -0
  710. package/src/plugins/analysis/ast/utils/index.ts +2 -0
  711. package/src/plugins/analysis/ast/visitors/ArgumentExtractor.ts +307 -0
  712. package/src/plugins/analysis/ast/visitors/ArrayElementExtractor.ts +172 -0
  713. package/src/plugins/analysis/ast/visitors/CallExpressionVisitor.ts +425 -1374
  714. package/src/plugins/analysis/ast/visitors/ClassVisitor.ts +43 -12
  715. package/src/plugins/analysis/ast/visitors/FunctionVisitor.ts +39 -8
  716. package/src/plugins/analysis/ast/visitors/MutationDetector.ts +211 -0
  717. package/src/plugins/analysis/ast/visitors/ObjectPropertyExtractor.ts +217 -0
  718. package/src/plugins/analysis/ast/visitors/PropertyAccessVisitor.ts +69 -4
  719. package/src/plugins/analysis/ast/visitors/TypeScriptVisitor.ts +232 -13
  720. package/src/plugins/analysis/ast/visitors/VariableVisitor.ts +8 -11
  721. package/src/plugins/analysis/ast/visitors/call-expression-helpers.ts +65 -0
  722. package/src/plugins/analysis/ast/visitors/call-expression-types.ts +179 -0
  723. package/src/plugins/analysis/react-internal/browser-api.ts +168 -0
  724. package/src/plugins/analysis/react-internal/hooks.ts +517 -0
  725. package/src/plugins/analysis/react-internal/jsx.ts +279 -0
  726. package/src/plugins/analysis/react-internal/types.ts +183 -0
  727. package/src/plugins/discovery/MonorepoServiceDiscovery.ts +6 -14
  728. package/src/plugins/enrichment/AliasTracker.ts +3 -1
  729. package/src/plugins/enrichment/ArgumentParameterLinker.ts +3 -1
  730. package/src/plugins/enrichment/CallbackCallResolver.ts +398 -0
  731. package/src/plugins/enrichment/ClosureCaptureEnricher.ts +3 -1
  732. package/src/plugins/enrichment/ConfigRoutingMapBuilder.ts +67 -0
  733. package/src/plugins/enrichment/ExpressHandlerLinker.ts +3 -1
  734. package/src/plugins/enrichment/ExternalCallResolver.ts +5 -8
  735. package/src/plugins/enrichment/FunctionCallResolver.ts +6 -9
  736. package/src/plugins/enrichment/HTTPConnectionEnricher.ts +3 -1
  737. package/src/plugins/enrichment/ImportExportLinker.ts +5 -3
  738. package/src/plugins/enrichment/InstanceOfResolver.ts +3 -1
  739. package/src/plugins/enrichment/MethodCallResolver.ts +48 -659
  740. package/src/plugins/enrichment/MountPointResolver.ts +9 -2
  741. package/src/plugins/enrichment/NodejsBuiltinsResolver.ts +13 -18
  742. package/src/plugins/enrichment/PrefixEvaluator.ts +6 -2
  743. package/src/plugins/enrichment/RejectionPropagationEnricher.ts +3 -1
  744. package/src/plugins/enrichment/RustFFIEnricher.ts +3 -1
  745. package/src/plugins/enrichment/ServiceConnectionEnricher.ts +472 -0
  746. package/src/plugins/enrichment/SocketConnectionEnricher.ts +228 -0
  747. package/src/plugins/enrichment/ValueDomainAnalyzer.ts +3 -1
  748. package/src/plugins/enrichment/method-call/MethodCallData.ts +299 -0
  749. package/src/plugins/enrichment/method-call/MethodCallDetectors.ts +70 -0
  750. package/src/plugins/enrichment/method-call/MethodCallErrorAnalysis.ts +131 -0
  751. package/src/plugins/enrichment/method-call/MethodCallIndexers.ts +83 -0
  752. package/src/plugins/enrichment/method-call/MethodCallResolution.ts +181 -0
  753. package/src/plugins/indexing/IncrementalModuleIndexer.ts +5 -10
  754. package/src/plugins/indexing/JSModuleIndexer.ts +17 -21
  755. package/src/plugins/indexing/RustModuleIndexer.ts +14 -13
  756. package/src/plugins/validation/AwaitInLoopValidator.ts +91 -0
  757. package/src/plugins/validation/PackageCoverageValidator.ts +181 -0
  758. package/src/plugins/validation/UnconnectedRouteValidator.ts +93 -0
  759. package/src/queries/NodeContext.ts +277 -0
  760. package/src/queries/findCallsInFunction.ts +11 -2
  761. package/src/queries/findContainingFunction.ts +14 -3
  762. package/src/queries/index.ts +13 -0
  763. package/src/resources/InfraResourceMapImpl.ts +119 -0
  764. package/src/resources/RoutingMapImpl.ts +133 -0
  765. package/src/storage/backends/RFDBServerBackend.ts +106 -77
  766. package/src/utils/findRfdbBinary.ts +22 -7
  767. package/src/utils/moduleResolution.ts +28 -1
  768. package/src/utils/resolveNodeFile.ts +18 -0
  769. package/src/version.ts +28 -0
@@ -18,186 +18,24 @@ import type { NodePath } from '@babel/traverse';
18
18
  import type { Node, CallExpression, JSXElement, JSXAttribute, VariableDeclarator, FunctionDeclaration } from '@babel/types';
19
19
  import { Plugin, createSuccessResult, createErrorResult } from '../Plugin.js';
20
20
  import type { PluginContext, PluginResult, PluginMetadata } from '../Plugin.js';
21
- import type { NodeRecord } from '@grafema/types';
21
+ import type { NodeRecord, AnyBrandedNode } from '@grafema/types';
22
+ import { NodeFactory } from '../../core/NodeFactory.js';
22
23
  import { getLine, getColumn } from './ast/utils/location.js';
24
+ import { resolveNodeFile } from '../../utils/resolveNodeFile.js';
25
+ import { REACT_HOOKS } from './react-internal/types.js';
26
+ import type {
27
+ ComponentNode,
28
+ AnalysisResult, AnalysisStats,
29
+ } from './react-internal/types.js';
30
+ import { analyzeBrowserAPI } from './react-internal/browser-api.js';
31
+ import {
32
+ isReactComponent, analyzeJSXElement, analyzeJSXAttribute,
33
+ analyzeForwardRef, analyzeCreateContext,
34
+ } from './react-internal/jsx.js';
35
+ import { analyzeHook, checkEffectIssues } from './react-internal/hooks.js';
23
36
 
24
37
  const traverse = (traverseModule as any).default || traverseModule;
25
38
 
26
- // React event handlers mapping
27
- const REACT_EVENTS: Record<string, string> = {
28
- // Mouse events
29
- onClick: 'click', onDoubleClick: 'dblclick', onContextMenu: 'contextmenu',
30
- onMouseDown: 'mousedown', onMouseUp: 'mouseup', onMouseEnter: 'mouseenter',
31
- onMouseLeave: 'mouseleave', onMouseMove: 'mousemove', onMouseOver: 'mouseover',
32
- onMouseOut: 'mouseout',
33
- // Keyboard events
34
- onKeyDown: 'keydown', onKeyUp: 'keyup', onKeyPress: 'keypress',
35
- // Focus events
36
- onFocus: 'focus', onBlur: 'blur', onFocusCapture: 'focus:capture',
37
- // Form events
38
- onSubmit: 'submit', onReset: 'reset', onChange: 'change', onInput: 'input',
39
- onInvalid: 'invalid',
40
- // Touch events
41
- onTouchStart: 'touchstart', onTouchMove: 'touchmove', onTouchEnd: 'touchend',
42
- onTouchCancel: 'touchcancel',
43
- // Drag events
44
- onDragStart: 'dragstart', onDrag: 'drag', onDragEnd: 'dragend',
45
- onDragEnter: 'dragenter', onDragOver: 'dragover', onDragLeave: 'dragleave',
46
- onDrop: 'drop',
47
- // Scroll/Wheel events
48
- onScroll: 'scroll', onWheel: 'wheel',
49
- // Clipboard events
50
- onCopy: 'copy', onCut: 'cut', onPaste: 'paste',
51
- // Composition events
52
- onCompositionStart: 'compositionstart', onCompositionUpdate: 'compositionupdate',
53
- onCompositionEnd: 'compositionend',
54
- // Media events
55
- onPlay: 'play', onPause: 'pause', onEnded: 'ended', onTimeUpdate: 'timeupdate',
56
- onLoadedData: 'loadeddata', onLoadedMetadata: 'loadedmetadata',
57
- onCanPlay: 'canplay', onWaiting: 'waiting', onSeeking: 'seeking',
58
- onSeeked: 'seeked', onError: 'error', onVolumeChange: 'volumechange',
59
- // Image events
60
- onLoad: 'load',
61
- // Animation events
62
- onAnimationStart: 'animationstart', onAnimationEnd: 'animationend',
63
- onAnimationIteration: 'animationiteration',
64
- // Transition events
65
- onTransitionEnd: 'transitionend',
66
- // Pointer events
67
- onPointerDown: 'pointerdown', onPointerUp: 'pointerup', onPointerMove: 'pointermove',
68
- onPointerEnter: 'pointerenter', onPointerLeave: 'pointerleave',
69
- onPointerCancel: 'pointercancel', onGotPointerCapture: 'gotpointercapture',
70
- onLostPointerCapture: 'lostpointercapture'
71
- };
72
-
73
- // React hooks that need tracking
74
- const REACT_HOOKS = [
75
- 'useState', 'useEffect', 'useLayoutEffect', 'useInsertionEffect',
76
- 'useCallback', 'useMemo', 'useRef', 'useReducer', 'useContext',
77
- 'useImperativeHandle', 'useDebugValue', 'useDeferredValue',
78
- 'useTransition', 'useId', 'useSyncExternalStore'
79
- ];
80
-
81
- // Browser APIs that create side effects
82
- const BROWSER_APIS = {
83
- timers: ['setTimeout', 'setInterval', 'requestAnimationFrame', 'requestIdleCallback'],
84
- cleanup: {
85
- setTimeout: 'clearTimeout',
86
- setInterval: 'clearInterval',
87
- requestAnimationFrame: 'cancelAnimationFrame',
88
- requestIdleCallback: 'cancelIdleCallback'
89
- } as Record<string, string>,
90
- observers: ['IntersectionObserver', 'ResizeObserver', 'MutationObserver', 'PerformanceObserver'],
91
- storage: ['localStorage', 'sessionStorage'],
92
- async: ['fetch', 'XMLHttpRequest', 'WebSocket', 'EventSource'],
93
- dom: ['document', 'getElementById', 'querySelector', 'querySelectorAll'],
94
- workers: ['Worker', 'SharedWorker', 'ServiceWorker'],
95
- geolocation: ['grafemagator.geolocation'],
96
- notifications: ['Notification'],
97
- fullscreen: ['requestFullscreen', 'exitFullscreen'],
98
- clipboard: ['grafemagator.clipboard'],
99
- history: ['history.pushState', 'history.replaceState'],
100
- blocking: ['alert', 'confirm', 'prompt']
101
- };
102
-
103
- /**
104
- * Component node
105
- */
106
- interface ComponentNode {
107
- id: string;
108
- type: 'react:component';
109
- name: string;
110
- file: string;
111
- line: number;
112
- column: number;
113
- kind: 'arrow' | 'function' | 'forwardRef';
114
- }
115
-
116
- /**
117
- * Hook node
118
- */
119
- interface HookNode {
120
- id: string;
121
- type: string;
122
- file: string;
123
- line: number;
124
- column: number;
125
- hookName: string;
126
- [key: string]: unknown;
127
- }
128
-
129
- /**
130
- * Event node
131
- */
132
- interface EventNode {
133
- id: string;
134
- type: 'dom:event';
135
- eventType: string;
136
- reactProp: string;
137
- handler: string;
138
- file: string;
139
- line: number;
140
- }
141
-
142
- /**
143
- * Browser API node
144
- */
145
- interface BrowserAPINode {
146
- id: string;
147
- type: string;
148
- file: string;
149
- line: number;
150
- [key: string]: unknown;
151
- }
152
-
153
- /**
154
- * Issue node
155
- */
156
- interface IssueNode {
157
- id: string;
158
- type: string;
159
- file: string;
160
- line: number;
161
- [key: string]: unknown;
162
- }
163
-
164
- /**
165
- * Edge info
166
- */
167
- interface EdgeInfo {
168
- edgeType: string;
169
- src: string;
170
- dst: string;
171
- file: string;
172
- line: number;
173
- [key: string]: unknown;
174
- }
175
-
176
- /**
177
- * Analysis result
178
- */
179
- interface AnalysisResult {
180
- components: ComponentNode[];
181
- hooks: HookNode[];
182
- events: EventNode[];
183
- browserAPIs: BrowserAPINode[];
184
- issues: IssueNode[];
185
- edges: EdgeInfo[];
186
- }
187
-
188
- /**
189
- * Analysis stats
190
- */
191
- interface AnalysisStats {
192
- components: number;
193
- hooks: number;
194
- events: number;
195
- browserAPIs: number;
196
- issues: number;
197
- edges: number;
198
- [key: string]: unknown;
199
- }
200
-
201
39
  export class ReactAnalyzer extends Plugin {
202
40
  get metadata(): PluginMetadata {
203
41
  return {
@@ -228,6 +66,7 @@ export class ReactAnalyzer extends Plugin {
228
66
 
229
67
  try {
230
68
  const { graph } = context;
69
+ const projectPath = (context.manifest as { projectPath?: string })?.projectPath ?? '';
231
70
  const modules = await this.getModules(graph);
232
71
 
233
72
  const stats: AnalysisStats = {
@@ -246,7 +85,7 @@ export class ReactAnalyzer extends Plugin {
246
85
  }
247
86
 
248
87
  try {
249
- const result = await this.analyzeModule(module, graph);
88
+ const result = await this.analyzeModule(module, graph, projectPath);
250
89
  stats.components += result.components;
251
90
  stats.hooks += result.hooks;
252
91
  stats.events += result.events;
@@ -287,8 +126,8 @@ export class ReactAnalyzer extends Plugin {
287
126
  return false;
288
127
  }
289
128
 
290
- private async analyzeModule(module: NodeRecord, graph: PluginContext['graph']): Promise<AnalysisStats> {
291
- const code = readFileSync(module.file!, 'utf-8');
129
+ private async analyzeModule(module: NodeRecord, graph: PluginContext['graph'], projectPath: string): Promise<AnalysisStats> {
130
+ const code = readFileSync(resolveNodeFile(module.file!, projectPath), 'utf-8');
292
131
  const ast = parse(code, {
293
132
  sourceType: 'module',
294
133
  plugins: ['jsx', 'typescript'] as ParserPlugin[]
@@ -333,7 +172,7 @@ export class ReactAnalyzer extends Plugin {
333
172
  traverse(ast, {
334
173
  // Arrow function components: const App = () => ...
335
174
  VariableDeclarator: (path: NodePath<VariableDeclarator>) => {
336
- if (this.isReactComponent(path)) {
175
+ if (isReactComponent(path)) {
337
176
  const node = path.node;
338
177
  const name = (node.id as { name: string }).name;
339
178
  const component: ComponentNode = {
@@ -351,7 +190,7 @@ export class ReactAnalyzer extends Plugin {
351
190
 
352
191
  // Function declaration components: function App() {...}
353
192
  FunctionDeclaration: (path: NodePath<FunctionDeclaration>) => {
354
- if (this.isReactComponent(path)) {
193
+ if (isReactComponent(path)) {
355
194
  const name = path.node.id?.name;
356
195
  if (!name) return;
357
196
 
@@ -376,39 +215,39 @@ export class ReactAnalyzer extends Plugin {
376
215
 
377
216
  // Detect React hooks
378
217
  if (callee.type === 'Identifier' && REACT_HOOKS.includes(callee.name)) {
379
- const hookData = this.analyzeHook(path, filePath);
218
+ const hookData = analyzeHook(path, filePath);
380
219
  if (hookData) {
381
220
  analysis.hooks.push(hookData);
382
221
 
383
222
  // Check for issues in hooks
384
223
  if (callee.name === 'useEffect' || callee.name === 'useLayoutEffect') {
385
- this.checkEffectIssues(path, filePath, analysis, hookData, importedIdentifiers);
224
+ checkEffectIssues(path, filePath, analysis, hookData, importedIdentifiers);
386
225
  }
387
226
  }
388
227
  }
389
228
 
390
229
  // Detect forwardRef
391
230
  if (callee.type === 'Identifier' && callee.name === 'forwardRef') {
392
- this.analyzeForwardRef(path, filePath, analysis);
231
+ analyzeForwardRef(path, filePath, analysis);
393
232
  }
394
233
 
395
234
  // Detect createContext
396
235
  if (callee.type === 'Identifier' && callee.name === 'createContext') {
397
- this.analyzeCreateContext(path, filePath, analysis);
236
+ analyzeCreateContext(path, filePath, analysis);
398
237
  }
399
238
 
400
239
  // Detect browser APIs
401
- this.analyzeBrowserAPI(path, filePath, analysis);
240
+ analyzeBrowserAPI(path, filePath, analysis);
402
241
  },
403
242
 
404
243
  // JSX elements
405
244
  JSXElement: (path: NodePath<JSXElement>) => {
406
- this.analyzeJSXElement(path, filePath, analysis);
245
+ analyzeJSXElement(path, filePath, analysis);
407
246
  },
408
247
 
409
248
  // JSX attributes (for event handlers and props)
410
249
  JSXAttribute: (path: NodePath<JSXAttribute>) => {
411
- this.analyzeJSXAttribute(path, filePath, analysis);
250
+ analyzeJSXAttribute(path, filePath, analysis);
412
251
  }
413
252
  });
414
253
 
@@ -425,897 +264,6 @@ export class ReactAnalyzer extends Plugin {
425
264
  };
426
265
  }
427
266
 
428
- /**
429
- * Check if a function is a React component (returns JSX)
430
- */
431
- private isReactComponent(path: NodePath): boolean {
432
- let hasJSXReturn = false;
433
-
434
- // Check for arrow function or function
435
- const node = path.node as { init?: Node };
436
- const func = node.init || path.node;
437
- if (!func) return false;
438
-
439
- // Must be a function
440
- if (func.type !== 'ArrowFunctionExpression' &&
441
- func.type !== 'FunctionExpression' &&
442
- func.type !== 'FunctionDeclaration') {
443
- return false;
444
- }
445
-
446
- // Name must start with uppercase (React component convention)
447
- const pathNode = path.node as { id?: { name: string } };
448
- const name = pathNode.id?.name;
449
- if (!name || !/^[A-Z]/.test(name)) {
450
- return false;
451
- }
452
-
453
- // Check if body contains JSX
454
- path.traverse({
455
- JSXElement: () => { hasJSXReturn = true; },
456
- JSXFragment: () => { hasJSXReturn = true; }
457
- });
458
-
459
- return hasJSXReturn;
460
- }
461
-
462
- /**
463
- * Analyze React hooks
464
- */
465
- private analyzeHook(path: NodePath<CallExpression>, filePath: string): HookNode | null {
466
- const callee = path.node.callee as { name: string };
467
- const hookName = callee.name;
468
- const args = path.node.arguments;
469
-
470
- const hookBase = {
471
- file: filePath,
472
- line: getLine(path.node),
473
- column: getColumn(path.node),
474
- hookName
475
- };
476
-
477
- switch (hookName) {
478
- case 'useState': {
479
- // const [state, setState] = useState(initialValue)
480
- const parent = path.parent as { type: string; id?: { type: string; elements?: Array<{ name?: string }> } };
481
- if (parent.type === 'VariableDeclarator' &&
482
- parent.id?.type === 'ArrayPattern' &&
483
- parent.id.elements?.length === 2) {
484
- const stateName = parent.id.elements[0]?.name;
485
- const setterName = parent.id.elements[1]?.name;
486
- const initialValue = args[0];
487
-
488
- return {
489
- id: `react:state#${stateName}#${filePath}:${hookBase.line}`,
490
- type: 'react:state',
491
- ...hookBase,
492
- stateName,
493
- setterName,
494
- initialValue: this.getExpressionValue(initialValue as Node)
495
- };
496
- }
497
- break;
498
- }
499
-
500
- case 'useEffect':
501
- case 'useLayoutEffect':
502
- case 'useInsertionEffect': {
503
- // useEffect(() => {...}, [deps])
504
- const callback = args[0];
505
- const depsArg = args[1];
506
- const deps = this.extractDeps(depsArg as Node);
507
- const hasCleanup = this.hasCleanupReturn(callback as Node);
508
-
509
- const effectType = hookName === 'useEffect' ? 'react:effect' :
510
- hookName === 'useLayoutEffect' ? 'react:layout-effect' :
511
- 'react:insertion-effect';
512
-
513
- return {
514
- id: `${effectType}#${filePath}:${hookBase.line}`,
515
- type: effectType,
516
- ...hookBase,
517
- deps,
518
- hasCleanup,
519
- depsType: !depsArg ? 'none' : (deps?.length === 0 ? 'empty' : 'array')
520
- };
521
- }
522
-
523
- case 'useCallback': {
524
- // const fn = useCallback(() => {...}, [deps])
525
- const parent = path.parent as { type: string; id?: { name: string } };
526
- const callbackName = parent.type === 'VariableDeclarator' ? parent.id?.name : null;
527
- const depsArg = args[1];
528
- const deps = this.extractDeps(depsArg as Node);
529
-
530
- return {
531
- id: `react:callback#${callbackName || 'anonymous'}#${filePath}:${hookBase.line}`,
532
- type: 'react:callback',
533
- ...hookBase,
534
- callbackName,
535
- deps
536
- };
537
- }
538
-
539
- case 'useMemo': {
540
- // const value = useMemo(() => computation, [deps])
541
- const parent = path.parent as { type: string; id?: { name: string } };
542
- const memoName = parent.type === 'VariableDeclarator' ? parent.id?.name : null;
543
- const depsArg = args[1];
544
- const deps = this.extractDeps(depsArg as Node);
545
-
546
- return {
547
- id: `react:memo#${memoName || 'anonymous'}#${filePath}:${hookBase.line}`,
548
- type: 'react:memo',
549
- ...hookBase,
550
- memoName,
551
- deps
552
- };
553
- }
554
-
555
- case 'useRef': {
556
- // const ref = useRef(initialValue)
557
- const parent = path.parent as { type: string; id?: { name: string } };
558
- const refName = parent.type === 'VariableDeclarator' ? parent.id?.name : null;
559
- const initialValue = args[0];
560
-
561
- return {
562
- id: `react:ref#${refName || 'anonymous'}#${filePath}:${hookBase.line}`,
563
- type: 'react:ref',
564
- ...hookBase,
565
- refName,
566
- initialValue: this.getExpressionValue(initialValue as Node)
567
- };
568
- }
569
-
570
- case 'useReducer': {
571
- // const [state, dispatch] = useReducer(reducer, initialState)
572
- const parent = path.parent as { type: string; id?: { type: string; elements?: Array<{ name?: string }> } };
573
- if (parent.type === 'VariableDeclarator' &&
574
- parent.id?.type === 'ArrayPattern' &&
575
- parent.id.elements && parent.id.elements.length >= 2) {
576
- const stateName = parent.id.elements[0]?.name;
577
- const dispatchName = parent.id.elements[1]?.name;
578
- const reducerArg = args[0] as Node | undefined;
579
- const reducerName = reducerArg?.type === 'Identifier' ? (reducerArg as { name: string }).name : null;
580
-
581
- return {
582
- id: `react:reducer#${stateName}#${filePath}:${hookBase.line}`,
583
- type: 'react:reducer',
584
- ...hookBase,
585
- stateName,
586
- dispatchName,
587
- reducerName
588
- };
589
- }
590
- break;
591
- }
592
-
593
- case 'useContext': {
594
- // const value = useContext(Context)
595
- const parent = path.parent as { type: string; id?: { name: string } };
596
- const valueName = parent.type === 'VariableDeclarator' ? parent.id?.name : null;
597
- const contextArg = args[0] as Node | undefined;
598
- const contextName = contextArg?.type === 'Identifier' ? (contextArg as { name: string }).name : null;
599
-
600
- return {
601
- id: `react:context-use#${contextName || 'unknown'}#${filePath}:${hookBase.line}`,
602
- type: 'react:context-use',
603
- ...hookBase,
604
- valueName,
605
- contextName
606
- };
607
- }
608
-
609
- case 'useImperativeHandle': {
610
- // useImperativeHandle(ref, () => ({ method1, method2 }), [deps])
611
- const refArg = args[0] as Node | undefined;
612
- const refName = refArg?.type === 'Identifier' ? (refArg as { name: string }).name : null;
613
- const createHandle = args[1] as Node | undefined;
614
-
615
- // Extract exposed methods
616
- const exposedMethods: string[] = [];
617
- if (createHandle?.type === 'ArrowFunctionExpression' ||
618
- createHandle?.type === 'FunctionExpression') {
619
- const body = (createHandle as { body: Node }).body;
620
- if (body.type === 'ObjectExpression') {
621
- const objExpr = body as { properties: Array<{ key?: { name: string } }> };
622
- for (const prop of objExpr.properties) {
623
- if (prop.key?.name) {
624
- exposedMethods.push(prop.key.name);
625
- }
626
- }
627
- }
628
- }
629
-
630
- return {
631
- id: `react:imperative-handle#${filePath}:${hookBase.line}`,
632
- type: 'react:imperative-handle',
633
- ...hookBase,
634
- refName,
635
- exposedMethods
636
- };
637
- }
638
- }
639
-
640
- return null;
641
- }
642
-
643
- /**
644
- * Extract dependency array from hook
645
- */
646
- private extractDeps(depsArg: Node | undefined): string[] | null {
647
- if (!depsArg) return null; // No deps argument
648
- if (depsArg.type !== 'ArrayExpression') return ['<dynamic>'];
649
-
650
- const arrExpr = depsArg as { elements: Array<Node | null> };
651
- return arrExpr.elements.map(el => {
652
- if (!el) return '<empty>';
653
- if (el.type === 'Identifier') return (el as { name: string }).name;
654
- if (el.type === 'MemberExpression') {
655
- return this.getMemberExpressionName(el);
656
- }
657
- return '<expression>';
658
- });
659
- }
660
-
661
- private getMemberExpressionName(node: Node): string {
662
- if (node.type !== 'MemberExpression') {
663
- return (node as { name?: string }).name || '<unknown>';
664
- }
665
- const memExpr = node as { object: Node; property: { name?: string; value?: string } };
666
- const object = this.getMemberExpressionName(memExpr.object);
667
- const property = memExpr.property.name || memExpr.property.value || '<computed>';
668
- return `${object}.${property}`;
669
- }
670
-
671
- /**
672
- * Check if effect callback has cleanup return
673
- */
674
- private hasCleanupReturn(callback: Node | undefined): boolean {
675
- if (!callback) return false;
676
- if (callback.type !== 'ArrowFunctionExpression' &&
677
- callback.type !== 'FunctionExpression') {
678
- return false;
679
- }
680
-
681
- // Simple AST traversal without using babel traverse
682
- const checkForCleanupReturn = (node: Node | null): boolean => {
683
- if (!node) return false;
684
-
685
- if (node.type === 'ReturnStatement') {
686
- const retStmt = node as { argument?: Node };
687
- const arg = retStmt.argument;
688
- if (arg && (arg.type === 'ArrowFunctionExpression' ||
689
- arg.type === 'FunctionExpression')) {
690
- return true;
691
- }
692
- }
693
-
694
- // Check body
695
- const nodeWithBody = node as { body?: Node | Node[] };
696
- if (nodeWithBody.body) {
697
- if (Array.isArray(nodeWithBody.body)) {
698
- return nodeWithBody.body.some(n => checkForCleanupReturn(n));
699
- } else if (nodeWithBody.body.type === 'BlockStatement') {
700
- const blockStmt = nodeWithBody.body as { body?: Node[] };
701
- if (blockStmt.body) {
702
- return blockStmt.body.some(n => checkForCleanupReturn(n));
703
- }
704
- } else {
705
- return checkForCleanupReturn(nodeWithBody.body);
706
- }
707
- }
708
-
709
- return false;
710
- };
711
-
712
- return checkForCleanupReturn(callback);
713
- }
714
-
715
- /**
716
- * Check for issues in useEffect/useLayoutEffect
717
- */
718
- private checkEffectIssues(
719
- path: NodePath<CallExpression>,
720
- filePath: string,
721
- analysis: AnalysisResult,
722
- hookData: HookNode,
723
- importedIdentifiers: Set<string> = new Set()
724
- ): void {
725
- const callback = path.node.arguments[0];
726
- if (!callback) return;
727
-
728
- const deps = hookData.deps as string[] | null;
729
- const usedVars = new Set<string>();
730
- const setterCalls = new Set<string>();
731
- const callbackParams = new Set<string>(); // Track parameters of nested callback functions
732
-
733
- // Simple recursive AST walker to collect identifiers
734
- const collectIdentifiers = (node: Node | null, _parentType: string | null = null, isPropertyKey = false): void => {
735
- if (!node) return;
736
-
737
- if (node.type === 'Identifier') {
738
- const id = node as { name: string };
739
- // Skip if it's a property access key
740
- if (!isPropertyKey && !callbackParams.has(id.name)) {
741
- usedVars.add(id.name);
742
- }
743
- return;
744
- }
745
-
746
- if (node.type === 'MemberExpression') {
747
- const memExpr = node as { object: Node; property: { type: string; name?: string } };
748
- // Check for ref.current pattern (valid for stable refs)
749
- if (memExpr.property?.type === 'Identifier' && memExpr.property.name === 'current') {
750
- // This is likely a ref.current access - collect only the ref name, not 'current'
751
- collectIdentifiers(memExpr.object, 'MemberExpression', false);
752
- return;
753
- }
754
- collectIdentifiers(memExpr.object, 'MemberExpression', false);
755
- // Skip property name
756
- return;
757
- }
758
-
759
- if (node.type === 'CallExpression') {
760
- const callExpr = node as { callee: Node & { name?: string }; arguments: Node[] };
761
- const callee = callExpr.callee;
762
- if (callee.type === 'Identifier' && callee.name?.startsWith('set')) {
763
- const arg = callExpr.arguments[0];
764
- if (arg?.type === 'ArrowFunctionExpression' ||
765
- arg?.type === 'FunctionExpression') {
766
- setterCalls.add(callee.name);
767
- }
768
- }
769
- collectIdentifiers(callee, 'CallExpression', false);
770
- callExpr.arguments?.forEach(arg => collectIdentifiers(arg, 'CallExpression', false));
771
- return;
772
- }
773
-
774
- if (node.type === 'ObjectProperty') {
775
- const prop = node as { value: Node };
776
- // Skip key, process value
777
- collectIdentifiers(prop.value, 'ObjectProperty', false);
778
- return;
779
- }
780
-
781
- // Handle function parameters - skip them (AC-1: callback parameters are not external deps)
782
- if (node.type === 'ArrowFunctionExpression' || node.type === 'FunctionExpression') {
783
- const func = node as { params?: Array<{ type: string; name?: string }>; body: Node };
784
- // Collect parameter names from nested callbacks
785
- func.params?.forEach(p => {
786
- if (p.type === 'Identifier' && p.name) {
787
- callbackParams.add(p.name); // Add to global tracking
788
- }
789
- });
790
-
791
- const collectInBody = (bodyNode: Node | null): void => {
792
- if (!bodyNode) return;
793
- if (bodyNode.type === 'Identifier') {
794
- const id = bodyNode as { name: string };
795
- if (!callbackParams.has(id.name)) {
796
- usedVars.add(id.name);
797
- }
798
- } else if (typeof bodyNode === 'object') {
799
- Object.values(bodyNode).forEach(child => {
800
- if (child && typeof child === 'object') {
801
- if (Array.isArray(child)) {
802
- child.forEach(c => collectInBody(c as Node));
803
- } else {
804
- collectInBody(child as Node);
805
- }
806
- }
807
- });
808
- }
809
- };
810
- collectInBody(func.body);
811
- return;
812
- }
813
-
814
- // Recurse into child nodes
815
- if (typeof node === 'object') {
816
- Object.entries(node).forEach(([key, child]) => {
817
- if (key === 'loc' || key === 'start' || key === 'end' || key === 'type') return;
818
- if (child && typeof child === 'object') {
819
- if (Array.isArray(child)) {
820
- child.forEach(c => collectIdentifiers(c as Node, node.type, false));
821
- } else {
822
- collectIdentifiers(child as Node, node.type, false);
823
- }
824
- }
825
- });
826
- }
827
- };
828
-
829
- collectIdentifiers(callback as Node);
830
-
831
- // Check for stale closures
832
- if (deps !== null && deps.length >= 0) { // Has deps array
833
- const depsSet = new Set(deps);
834
-
835
- // Hooks that don't cause stale closure issues
836
- const safeHooks = ['useState', 'useReducer', 'useRef', 'useCallback', 'useMemo',
837
- 'useEffect', 'useLayoutEffect', 'useContext'];
838
- const setterPrefixes = ['set'];
839
-
840
- for (const used of usedVars) {
841
- // Skip safe identifiers
842
- if (safeHooks.includes(used)) continue;
843
- if (setterPrefixes.some(p => used.startsWith(p))) continue;
844
- if (depsSet.has(used)) continue;
845
- if (used === 'console' || used === 'window' || used === 'document') continue;
846
- if (used === 'Math' || used === 'JSON' || used === 'Date') continue;
847
- if (used === 'undefined' || used === 'null' || used === 'true' || used === 'false') continue;
848
- // AC-2: Skip imported identifiers (stable references)
849
- if (importedIdentifiers.has(used)) continue;
850
-
851
- // This variable is used but not in deps - potential stale closure
852
- const issue: IssueNode = {
853
- id: `issue:stale-closure#${used}#${filePath}:${hookData.line}`,
854
- type: 'issue:stale-closure',
855
- file: filePath,
856
- line: hookData.line,
857
- variable: used,
858
- hookType: hookData.hookName,
859
- deps: deps,
860
- message: `Variable '${used}' is used in ${hookData.hookName} but not listed in dependencies`
861
- };
862
- analysis.issues.push(issue);
863
- }
864
- }
865
-
866
- // Check for missing cleanup
867
- this.checkMissingCleanup(callback as Node, filePath, analysis, hookData);
868
- }
869
-
870
- /**
871
- * Check for missing cleanup in effect callback
872
- */
873
- private checkMissingCleanup(
874
- callback: Node,
875
- filePath: string,
876
- analysis: AnalysisResult,
877
- hookData: HookNode
878
- ): void {
879
- const hasCleanup = hookData.hasCleanup as boolean;
880
-
881
- // Simple recursive AST walker
882
- const checkNode = (node: Node | null, _parent: Node | null = null): void => {
883
- if (!node || typeof node !== 'object') return;
884
-
885
- if (node.type === 'CallExpression') {
886
- const callExpr = node as { callee?: { type: string; name?: string }; loc?: { start: { line: number } } };
887
- const callee = callExpr.callee;
888
- const loc = callExpr.loc;
889
-
890
- // Check for timer APIs
891
- if (callee?.type === 'Identifier') {
892
- const api = callee.name;
893
- if (api && BROWSER_APIS.timers.includes(api)) {
894
- // Timer called without storing reference
895
- if (!hasCleanup && api === 'requestAnimationFrame') {
896
- analysis.issues.push({
897
- id: `issue:raf-leak#${filePath}:${loc?.start?.line || 0}`,
898
- type: 'issue:raf-leak',
899
- file: filePath,
900
- line: loc?.start?.line || 0,
901
- message: `requestAnimationFrame called without cleanup - will leak on unmount`
902
- });
903
- }
904
- }
905
- }
906
- }
907
-
908
- if (node.type === 'NewExpression') {
909
- const newExpr = node as { callee?: { type: string; name?: string }; loc?: { start: { line: number } } };
910
- const callee = newExpr.callee;
911
- const loc = newExpr.loc;
912
-
913
- // Check for WebSocket without cleanup
914
- if (callee?.type === 'Identifier' && callee.name === 'WebSocket') {
915
- if (!hasCleanup) {
916
- analysis.issues.push({
917
- id: `issue:missing-cleanup#websocket#${filePath}:${loc?.start?.line || 0}`,
918
- type: 'issue:missing-cleanup',
919
- file: filePath,
920
- line: loc?.start?.line || 0,
921
- api: 'WebSocket',
922
- message: `WebSocket created without cleanup - connection will leak on unmount`
923
- });
924
- }
925
- }
926
-
927
- // Check for observers without cleanup
928
- if (callee?.type === 'Identifier' && callee.name && BROWSER_APIS.observers.includes(callee.name)) {
929
- if (!hasCleanup) {
930
- analysis.issues.push({
931
- id: `issue:missing-cleanup#${callee.name}#${filePath}:${loc?.start?.line || 0}`,
932
- type: 'issue:missing-cleanup',
933
- file: filePath,
934
- line: loc?.start?.line || 0,
935
- api: callee.name,
936
- message: `${callee.name} created without disconnect in cleanup`
937
- });
938
- }
939
- }
940
- }
941
-
942
- // Recurse into child nodes
943
- Object.entries(node).forEach(([key, child]) => {
944
- if (key === 'loc' || key === 'start' || key === 'end' || key === 'type') return;
945
- if (child && typeof child === 'object') {
946
- if (Array.isArray(child)) {
947
- child.forEach(c => checkNode(c as Node, node));
948
- } else {
949
- checkNode(child as Node, node);
950
- }
951
- }
952
- });
953
- };
954
-
955
- checkNode(callback);
956
- }
957
-
958
- /**
959
- * Analyze JSX element for component rendering
960
- */
961
- private analyzeJSXElement(path: NodePath<JSXElement>, filePath: string, analysis: AnalysisResult): void {
962
- const openingElement = path.node.openingElement;
963
- const elementName = this.getJSXElementName(openingElement.name);
964
-
965
- // Skip native HTML elements (lowercase)
966
- if (/^[a-z]/.test(elementName)) {
967
- return;
968
- }
969
-
970
- // This is a React component being rendered
971
-
972
- // Find parent component
973
- let parentComponent: string | null = null;
974
- let parentPath: NodePath<Node> | null = path.parentPath;
975
- while (parentPath) {
976
- if (parentPath.node.type === 'FunctionDeclaration' ||
977
- parentPath.node.type === 'ArrowFunctionExpression' ||
978
- parentPath.node.type === 'FunctionExpression') {
979
- // Check if this function is a component
980
- const funcName = this.getFunctionName(parentPath);
981
- if (funcName && /^[A-Z]/.test(funcName)) {
982
- parentComponent = funcName;
983
- break;
984
- }
985
- }
986
- parentPath = parentPath.parentPath;
987
- }
988
-
989
- if (parentComponent) {
990
- analysis.edges.push({
991
- edgeType: 'RENDERS',
992
- src: `react:component#${parentComponent}`,
993
- dst: `react:component#${elementName}`,
994
- file: filePath,
995
- line: getLine(openingElement)
996
- });
997
- }
998
- }
999
-
1000
- private getJSXElementName(nameNode: Node): string {
1001
- if (nameNode.type === 'JSXIdentifier') {
1002
- return (nameNode as { name: string }).name;
1003
- }
1004
- if (nameNode.type === 'JSXMemberExpression') {
1005
- const memExpr = nameNode as { object: Node; property: { name: string } };
1006
- return `${this.getJSXElementName(memExpr.object)}.${memExpr.property.name}`;
1007
- }
1008
- return '<unknown>';
1009
- }
1010
-
1011
- private getFunctionName(path: NodePath): string | null {
1012
- // Arrow function assigned to variable
1013
- const parent = path.parent as { type: string; id?: { name: string } };
1014
- if (parent?.type === 'VariableDeclarator') {
1015
- return parent.id?.name || null;
1016
- }
1017
- // Function declaration
1018
- const node = path.node as { id?: { name: string } };
1019
- if (node.id?.name) {
1020
- return node.id.name;
1021
- }
1022
- return null;
1023
- }
1024
-
1025
- /**
1026
- * Analyze JSX attribute for props and event handlers
1027
- */
1028
- private analyzeJSXAttribute(path: NodePath<JSXAttribute>, filePath: string, analysis: AnalysisResult): void {
1029
- const attr = path.node;
1030
- if (!attr.name || attr.name.type !== 'JSXIdentifier') return;
1031
-
1032
- const attrName = attr.name.name;
1033
-
1034
- // Get parent JSX element info first
1035
- const jsxOpeningElement = path.parent as { type: string; name?: Node };
1036
- let componentName: string | null = null;
1037
- let isReactComponent = false;
1038
-
1039
- if (jsxOpeningElement?.type === 'JSXOpeningElement' && jsxOpeningElement.name) {
1040
- componentName = this.getJSXElementName(jsxOpeningElement.name);
1041
- isReactComponent = /^[A-Z]/.test(componentName);
1042
- }
1043
-
1044
- // Check if it's an event handler
1045
- if (REACT_EVENTS[attrName]) {
1046
- const eventType = REACT_EVENTS[attrName];
1047
- const handler = attr.value as { type: string; expression?: Node } | null;
1048
-
1049
- let handlerName = '<inline>';
1050
- if (handler?.type === 'JSXExpressionContainer') {
1051
- const expr = handler.expression;
1052
- if (expr?.type === 'Identifier') {
1053
- handlerName = (expr as { name: string }).name;
1054
- } else if (expr?.type === 'MemberExpression') {
1055
- handlerName = this.getMemberExpressionName(expr);
1056
- }
1057
- }
1058
-
1059
- const event: EventNode = {
1060
- id: `dom:event#${eventType}#${filePath}:${getLine(attr)}`,
1061
- type: 'dom:event',
1062
- eventType,
1063
- reactProp: attrName,
1064
- handler: handlerName,
1065
- file: filePath,
1066
- line: getLine(attr)
1067
- };
1068
- analysis.events.push(event);
1069
- }
1070
-
1071
- // For React components (uppercase), create PASSES_PROP edges for all props
1072
- if (isReactComponent && componentName && attrName !== 'key' && attrName !== 'ref' && attrName !== 'children') {
1073
- let propValue = '<expression>';
1074
- const value = attr.value as { type: string; value?: string; expression?: Node } | null;
1075
- if (value?.type === 'StringLiteral') {
1076
- propValue = value.value || '';
1077
- } else if (value?.type === 'JSXExpressionContainer') {
1078
- propValue = this.getExpressionValue(value.expression!);
1079
- } else if (value === null) {
1080
- propValue = 'true'; // Boolean shorthand
1081
- }
1082
-
1083
- // Find parent component
1084
- let parentComponent: string | null = null;
1085
- let parentPath: NodePath | null = path.parentPath;
1086
- while (parentPath) {
1087
- const node = parentPath.node as { type: string; id?: { name: string } };
1088
- if (node.type === 'FunctionDeclaration' && node.id?.name) {
1089
- if (/^[A-Z]/.test(node.id.name)) {
1090
- parentComponent = node.id.name;
1091
- break;
1092
- }
1093
- } else if (node.type === 'ArrowFunctionExpression' || node.type === 'FunctionExpression') {
1094
- const funcName = this.getFunctionName(parentPath);
1095
- if (funcName && /^[A-Z]/.test(funcName)) {
1096
- parentComponent = funcName;
1097
- break;
1098
- }
1099
- }
1100
- parentPath = parentPath.parentPath;
1101
- }
1102
-
1103
- if (parentComponent) {
1104
- analysis.edges.push({
1105
- edgeType: 'PASSES_PROP',
1106
- src: `react:component#${parentComponent}`,
1107
- dst: `react:component#${componentName}`,
1108
- propName: attrName,
1109
- propValue,
1110
- file: filePath,
1111
- line: getLine(attr)
1112
- });
1113
- }
1114
- }
1115
- }
1116
-
1117
- /**
1118
- * Analyze forwardRef usage
1119
- */
1120
- private analyzeForwardRef(path: NodePath<CallExpression>, filePath: string, analysis: AnalysisResult): void {
1121
- const parent = path.parent as { type: string; id?: { name: string } };
1122
- const componentName = parent.type === 'VariableDeclarator' ? parent.id?.name : null;
1123
-
1124
- if (componentName) {
1125
- analysis.components.push({
1126
- id: `react:component#${componentName}#${filePath}:${getLine(path.node)}`,
1127
- type: 'react:component',
1128
- name: componentName,
1129
- file: filePath,
1130
- line: getLine(path.node),
1131
- column: getColumn(path.node),
1132
- kind: 'forwardRef'
1133
- });
1134
- }
1135
- }
1136
-
1137
- /**
1138
- * Analyze createContext usage
1139
- */
1140
- private analyzeCreateContext(path: NodePath<CallExpression>, filePath: string, analysis: AnalysisResult): void {
1141
- const parent = path.parent as { type: string; id?: { name: string } };
1142
- const contextName = parent.type === 'VariableDeclarator' ? parent.id?.name : null;
1143
-
1144
- if (contextName) {
1145
- const defaultValue = path.node.arguments[0];
1146
- analysis.hooks.push({
1147
- id: `react:context#${contextName}#${filePath}:${getLine(path.node)}`,
1148
- type: 'react:context',
1149
- contextName,
1150
- file: filePath,
1151
- line: getLine(path.node),
1152
- column: getColumn(path.node),
1153
- hookName: 'createContext',
1154
- defaultValue: this.getExpressionValue(defaultValue as Node)
1155
- });
1156
- }
1157
- }
1158
-
1159
- /**
1160
- * Analyze browser API calls
1161
- */
1162
- private analyzeBrowserAPI(path: NodePath<CallExpression>, filePath: string, analysis: AnalysisResult): void {
1163
- const callee = path.node.callee;
1164
-
1165
- // Direct function call: setTimeout, fetch, alert
1166
- if (callee.type === 'Identifier') {
1167
- const name = callee.name;
1168
-
1169
- // Timers
1170
- if (BROWSER_APIS.timers.includes(name)) {
1171
- analysis.browserAPIs.push({
1172
- id: `browser:timer#${name}#${filePath}:${getLine(path.node)}`,
1173
- type: 'browser:timer',
1174
- api: name,
1175
- file: filePath,
1176
- line: getLine(path.node)
1177
- });
1178
- return;
1179
- }
1180
-
1181
- // Blocking APIs
1182
- if (BROWSER_APIS.blocking.includes(name)) {
1183
- analysis.browserAPIs.push({
1184
- id: `browser:blocking#${name}#${filePath}:${getLine(path.node)}`,
1185
- type: 'browser:blocking',
1186
- api: name,
1187
- file: filePath,
1188
- line: getLine(path.node)
1189
- });
1190
- return;
1191
- }
1192
-
1193
- // Fetch
1194
- if (name === 'fetch') {
1195
- analysis.browserAPIs.push({
1196
- id: `browser:async#fetch#${filePath}:${getLine(path.node)}`,
1197
- type: 'browser:async',
1198
- api: 'fetch',
1199
- file: filePath,
1200
- line: getLine(path.node)
1201
- });
1202
- return;
1203
- }
1204
- }
1205
-
1206
- // Member expression: localStorage.setItem, document.querySelector
1207
- if (callee.type === 'MemberExpression') {
1208
- const fullName = this.getMemberExpressionName(callee);
1209
-
1210
- // localStorage/sessionStorage
1211
- if (fullName.startsWith('localStorage.') || fullName.startsWith('sessionStorage.')) {
1212
- const [storage, method] = fullName.split('.');
1213
- const operation = method === 'getItem' ? 'read' :
1214
- method === 'setItem' ? 'write' :
1215
- method === 'removeItem' ? 'delete' : method;
1216
-
1217
- analysis.browserAPIs.push({
1218
- id: `browser:storage#${storage}:${operation}#${filePath}:${getLine(path.node)}`,
1219
- type: 'browser:storage',
1220
- storage,
1221
- operation,
1222
- file: filePath,
1223
- line: getLine(path.node)
1224
- });
1225
- return;
1226
- }
1227
-
1228
- // DOM queries
1229
- if (fullName.startsWith('document.') &&
1230
- (fullName.includes('querySelector') || fullName.includes('getElementById'))) {
1231
- analysis.browserAPIs.push({
1232
- id: `browser:dom#query#${filePath}:${getLine(path.node)}`,
1233
- type: 'browser:dom',
1234
- operation: 'query',
1235
- api: fullName,
1236
- file: filePath,
1237
- line: getLine(path.node)
1238
- });
1239
- return;
1240
- }
1241
-
1242
- // History API
1243
- if (fullName.startsWith('history.') || fullName.startsWith('window.history.')) {
1244
- analysis.browserAPIs.push({
1245
- id: `browser:history#${filePath}:${getLine(path.node)}`,
1246
- type: 'browser:history',
1247
- api: fullName,
1248
- file: filePath,
1249
- line: getLine(path.node)
1250
- });
1251
- return;
1252
- }
1253
-
1254
- // Clipboard API
1255
- if (fullName.includes('clipboard')) {
1256
- analysis.browserAPIs.push({
1257
- id: `browser:clipboard#${filePath}:${getLine(path.node)}`,
1258
- type: 'browser:clipboard',
1259
- api: fullName,
1260
- file: filePath,
1261
- line: getLine(path.node)
1262
- });
1263
- return;
1264
- }
1265
-
1266
- // Geolocation
1267
- if (fullName.includes('geolocation')) {
1268
- analysis.browserAPIs.push({
1269
- id: `browser:geolocation#${filePath}:${getLine(path.node)}`,
1270
- type: 'browser:geolocation',
1271
- api: fullName,
1272
- file: filePath,
1273
- line: getLine(path.node)
1274
- });
1275
- return;
1276
- }
1277
-
1278
- // Canvas context
1279
- if (fullName.match(/\.(fillRect|strokeRect|fillText|strokeText|beginPath|closePath|moveTo|lineTo|arc|fill|stroke|clearRect|drawImage|save|restore|translate|rotate|scale)$/)) {
1280
- const method = fullName.split('.').pop();
1281
- analysis.browserAPIs.push({
1282
- id: `canvas:draw#${method}#${filePath}:${getLine(path.node)}`,
1283
- type: 'canvas:draw',
1284
- method,
1285
- file: filePath,
1286
- line: getLine(path.node)
1287
- });
1288
- return;
1289
- }
1290
-
1291
- // matchMedia
1292
- if (fullName === 'window.matchMedia' || fullName === 'matchMedia') {
1293
- analysis.browserAPIs.push({
1294
- id: `browser:media-query#${filePath}:${getLine(path.node)}`,
1295
- type: 'browser:media-query',
1296
- api: 'matchMedia',
1297
- file: filePath,
1298
- line: getLine(path.node)
1299
- });
1300
- return;
1301
- }
1302
- }
1303
- }
1304
-
1305
- private getExpressionValue(expr: Node | undefined): string {
1306
- if (!expr) return 'undefined';
1307
- if (expr.type === 'StringLiteral') return `"${(expr as { value: string }).value}"`;
1308
- if (expr.type === 'NumericLiteral') return String((expr as { value: number }).value);
1309
- if (expr.type === 'BooleanLiteral') return String((expr as { value: boolean }).value);
1310
- if (expr.type === 'NullLiteral') return 'null';
1311
- if (expr.type === 'Identifier') return (expr as { name: string }).name;
1312
- if (expr.type === 'ObjectExpression') return '{...}';
1313
- if (expr.type === 'ArrayExpression') return '[...]';
1314
- if (expr.type === 'ArrowFunctionExpression') return '() => {...}';
1315
- if (expr.type === 'FunctionExpression') return 'function() {...}';
1316
- return '<expression>';
1317
- }
1318
-
1319
267
  /**
1320
268
  * Add all analysis results to graph
1321
269
  */
@@ -1324,12 +272,12 @@ export class ReactAnalyzer extends Plugin {
1324
272
  graph: PluginContext['graph'],
1325
273
  moduleId: string | null
1326
274
  ): Promise<void> {
1327
- const nodes: NodeRecord[] = [];
275
+ const nodes: AnyBrandedNode[] = [];
1328
276
  const edges: Array<{ type: string; src: string; dst: string; [key: string]: unknown }> = [];
1329
277
 
1330
278
  // Collect component nodes and DEFINES edges
1331
279
  for (const component of analysis.components) {
1332
- nodes.push(component as unknown as NodeRecord);
280
+ nodes.push(NodeFactory.createReactNode(component));
1333
281
  if (moduleId) {
1334
282
  edges.push({
1335
283
  type: 'DEFINES',
@@ -1341,22 +289,22 @@ export class ReactAnalyzer extends Plugin {
1341
289
 
1342
290
  // Collect hook nodes
1343
291
  for (const hook of analysis.hooks) {
1344
- nodes.push(hook as unknown as NodeRecord);
292
+ nodes.push(NodeFactory.createReactNode(hook));
1345
293
  }
1346
294
 
1347
295
  // Collect event nodes
1348
296
  for (const event of analysis.events) {
1349
- nodes.push(event as unknown as NodeRecord);
297
+ nodes.push(NodeFactory.createReactNode(event));
1350
298
  }
1351
299
 
1352
300
  // Collect browser API nodes
1353
301
  for (const api of analysis.browserAPIs) {
1354
- nodes.push(api as unknown as NodeRecord);
302
+ nodes.push(NodeFactory.createReactNode(api));
1355
303
  }
1356
304
 
1357
305
  // Collect issue nodes
1358
306
  for (const issue of analysis.issues) {
1359
- nodes.push(issue as unknown as NodeRecord);
307
+ nodes.push(NodeFactory.createReactNode(issue));
1360
308
  }
1361
309
 
1362
310
  // Collect edges from analysis