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