@grafema/core 0.1.0-alpha.5 → 0.1.1-alpha
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 +0 -1
- package/dist/Orchestrator.d.ts +24 -2
- package/dist/Orchestrator.d.ts.map +1 -1
- package/dist/Orchestrator.js +197 -24
- package/dist/config/ConfigLoader.d.ts +72 -0
- package/dist/config/ConfigLoader.d.ts.map +1 -0
- package/dist/config/ConfigLoader.js +187 -0
- package/dist/config/index.d.ts +6 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +4 -0
- package/dist/core/ASTWorker.d.ts +11 -36
- package/dist/core/ASTWorker.d.ts.map +1 -1
- package/dist/core/ASTWorker.js +93 -99
- package/dist/core/CoverageAnalyzer.d.ts +65 -0
- package/dist/core/CoverageAnalyzer.d.ts.map +1 -0
- package/dist/core/CoverageAnalyzer.js +198 -0
- package/dist/core/FileNodeManager.d.ts +40 -0
- package/dist/core/FileNodeManager.d.ts.map +1 -0
- package/dist/core/FileNodeManager.js +84 -0
- package/dist/core/GraphFreshnessChecker.d.ts +33 -0
- package/dist/core/GraphFreshnessChecker.d.ts.map +1 -0
- package/dist/core/GraphFreshnessChecker.js +101 -0
- package/dist/core/HashUtils.d.ts +24 -0
- package/dist/core/HashUtils.d.ts.map +1 -0
- package/dist/core/HashUtils.js +45 -0
- package/dist/core/IncrementalReanalyzer.d.ts +36 -0
- package/dist/core/IncrementalReanalyzer.d.ts.map +1 -0
- package/dist/core/IncrementalReanalyzer.js +132 -0
- package/dist/core/NodeFactory.d.ts +225 -17
- package/dist/core/NodeFactory.d.ts.map +1 -1
- package/dist/core/NodeFactory.js +208 -18
- package/dist/core/ScopeTracker.d.ts +84 -0
- package/dist/core/ScopeTracker.d.ts.map +1 -0
- package/dist/core/ScopeTracker.js +116 -0
- package/dist/core/SemanticId.d.ts +90 -0
- package/dist/core/SemanticId.d.ts.map +1 -0
- package/dist/core/SemanticId.js +115 -0
- package/dist/core/VersionManager.d.ts.map +1 -1
- package/dist/core/VersionManager.js +3 -2
- package/dist/core/nodes/ArgumentExpressionNode.d.ts +43 -0
- package/dist/core/nodes/ArgumentExpressionNode.d.ts.map +1 -0
- package/dist/core/nodes/ArgumentExpressionNode.js +60 -0
- package/dist/core/nodes/ArrayLiteralNode.d.ts +27 -0
- package/dist/core/nodes/ArrayLiteralNode.d.ts.map +1 -0
- package/dist/core/nodes/ArrayLiteralNode.js +41 -0
- package/dist/core/nodes/CallSiteNode.d.ts +28 -0
- package/dist/core/nodes/CallSiteNode.d.ts.map +1 -1
- package/dist/core/nodes/CallSiteNode.js +46 -0
- package/dist/core/nodes/ClassNode.d.ts +33 -1
- package/dist/core/nodes/ClassNode.d.ts.map +1 -1
- package/dist/core/nodes/ClassNode.js +46 -2
- package/dist/core/nodes/DecoratorNode.d.ts +42 -0
- package/dist/core/nodes/DecoratorNode.d.ts.map +1 -0
- package/dist/core/nodes/DecoratorNode.js +62 -0
- package/dist/core/nodes/EnumNode.d.ts +42 -0
- package/dist/core/nodes/EnumNode.d.ts.map +1 -0
- package/dist/core/nodes/EnumNode.js +54 -0
- package/dist/core/nodes/ExportNode.d.ts +37 -1
- package/dist/core/nodes/ExportNode.d.ts.map +1 -1
- package/dist/core/nodes/ExportNode.js +48 -2
- package/dist/core/nodes/ExpressionNode.d.ts +97 -0
- package/dist/core/nodes/ExpressionNode.d.ts.map +1 -0
- package/dist/core/nodes/ExpressionNode.js +178 -0
- package/dist/core/nodes/ExternalModuleNode.d.ts +28 -0
- package/dist/core/nodes/ExternalModuleNode.d.ts.map +1 -0
- package/dist/core/nodes/ExternalModuleNode.js +41 -0
- package/dist/core/nodes/ExternalStdioNode.d.ts +13 -6
- package/dist/core/nodes/ExternalStdioNode.d.ts.map +1 -1
- package/dist/core/nodes/ExternalStdioNode.js +15 -8
- package/dist/core/nodes/FunctionNode.d.ts +36 -0
- package/dist/core/nodes/FunctionNode.d.ts.map +1 -1
- package/dist/core/nodes/FunctionNode.js +80 -1
- package/dist/core/nodes/ImportNode.d.ts +19 -5
- package/dist/core/nodes/ImportNode.d.ts.map +1 -1
- package/dist/core/nodes/ImportNode.js +23 -5
- package/dist/core/nodes/InterfaceNode.d.ts +46 -0
- package/dist/core/nodes/InterfaceNode.d.ts.map +1 -0
- package/dist/core/nodes/InterfaceNode.js +55 -0
- package/dist/core/nodes/IssueNode.d.ts +73 -0
- package/dist/core/nodes/IssueNode.d.ts.map +1 -0
- package/dist/core/nodes/IssueNode.js +129 -0
- package/dist/core/nodes/MethodCallNode.d.ts +30 -0
- package/dist/core/nodes/MethodCallNode.d.ts.map +1 -1
- package/dist/core/nodes/MethodCallNode.js +49 -0
- package/dist/core/nodes/MethodNode.d.ts +32 -0
- package/dist/core/nodes/MethodNode.d.ts.map +1 -1
- package/dist/core/nodes/MethodNode.js +48 -0
- package/dist/core/nodes/ModuleNode.d.ts +31 -0
- package/dist/core/nodes/ModuleNode.d.ts.map +1 -1
- package/dist/core/nodes/ModuleNode.js +37 -0
- package/dist/core/nodes/NetworkRequestNode.d.ts +54 -0
- package/dist/core/nodes/NetworkRequestNode.d.ts.map +1 -0
- package/dist/core/nodes/NetworkRequestNode.js +65 -0
- package/dist/core/nodes/ObjectLiteralNode.d.ts +27 -0
- package/dist/core/nodes/ObjectLiteralNode.d.ts.map +1 -0
- package/dist/core/nodes/ObjectLiteralNode.js +41 -0
- package/dist/core/nodes/ScopeNode.d.ts +31 -0
- package/dist/core/nodes/ScopeNode.d.ts.map +1 -1
- package/dist/core/nodes/ScopeNode.js +49 -0
- package/dist/core/nodes/TypeNode.d.ts +36 -0
- package/dist/core/nodes/TypeNode.d.ts.map +1 -0
- package/dist/core/nodes/TypeNode.js +53 -0
- package/dist/core/nodes/VariableDeclarationNode.d.ts +27 -0
- package/dist/core/nodes/VariableDeclarationNode.d.ts.map +1 -1
- package/dist/core/nodes/VariableDeclarationNode.js +40 -0
- package/dist/core/nodes/index.d.ts +12 -1
- package/dist/core/nodes/index.d.ts.map +1 -1
- package/dist/core/nodes/index.js +14 -0
- package/dist/diagnostics/DiagnosticCollector.d.ts +98 -0
- package/dist/diagnostics/DiagnosticCollector.d.ts.map +1 -0
- package/dist/diagnostics/DiagnosticCollector.js +129 -0
- package/dist/diagnostics/DiagnosticReporter.d.ts +77 -0
- package/dist/diagnostics/DiagnosticReporter.d.ts.map +1 -0
- package/dist/diagnostics/DiagnosticReporter.js +159 -0
- package/dist/diagnostics/DiagnosticWriter.d.ts +31 -0
- package/dist/diagnostics/DiagnosticWriter.d.ts.map +1 -0
- package/dist/diagnostics/DiagnosticWriter.js +43 -0
- package/dist/diagnostics/index.d.ts +14 -0
- package/dist/diagnostics/index.d.ts.map +1 -0
- package/dist/diagnostics/index.js +11 -0
- package/dist/errors/GrafemaError.d.ts +118 -0
- package/dist/errors/GrafemaError.d.ts.map +1 -0
- package/dist/errors/GrafemaError.js +131 -0
- package/dist/index.d.ts +57 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +54 -1
- package/dist/logging/Logger.d.ts +48 -0
- package/dist/logging/Logger.d.ts.map +1 -0
- package/dist/logging/Logger.js +134 -0
- package/dist/plugins/Plugin.d.ts +5 -1
- package/dist/plugins/Plugin.d.ts.map +1 -1
- package/dist/plugins/Plugin.js +33 -0
- package/dist/plugins/analysis/DatabaseAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/DatabaseAnalyzer.js +13 -6
- package/dist/plugins/analysis/ExpressAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/ExpressAnalyzer.js +27 -19
- package/dist/plugins/analysis/ExpressRouteAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/ExpressRouteAnalyzer.js +21 -14
- package/dist/plugins/analysis/FetchAnalyzer.d.ts +1 -0
- package/dist/plugins/analysis/FetchAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/FetchAnalyzer.js +34 -14
- package/dist/plugins/analysis/IncrementalAnalysisPlugin.d.ts +6 -3
- package/dist/plugins/analysis/IncrementalAnalysisPlugin.d.ts.map +1 -1
- package/dist/plugins/analysis/IncrementalAnalysisPlugin.js +76 -80
- package/dist/plugins/analysis/JSASTAnalyzer.d.ts +180 -17
- package/dist/plugins/analysis/JSASTAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/JSASTAnalyzer.js +1171 -471
- package/dist/plugins/analysis/ReactAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/ReactAnalyzer.js +56 -57
- package/dist/plugins/analysis/RustAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/RustAnalyzer.js +15 -10
- package/dist/plugins/analysis/SQLiteAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/SQLiteAnalyzer.js +9 -7
- package/dist/plugins/analysis/ServiceLayerAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/ServiceLayerAnalyzer.js +21 -9
- package/dist/plugins/analysis/SocketIOAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/SocketIOAnalyzer.js +27 -15
- package/dist/plugins/analysis/SystemDbAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/SystemDbAnalyzer.js +15 -5
- package/dist/plugins/analysis/ast/GraphBuilder.d.ts +34 -4
- package/dist/plugins/analysis/ast/GraphBuilder.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/GraphBuilder.js +318 -298
- package/dist/plugins/analysis/ast/IdGenerator.d.ts +105 -0
- package/dist/plugins/analysis/ast/IdGenerator.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/IdGenerator.js +116 -0
- package/dist/plugins/analysis/ast/types.d.ts +176 -5
- package/dist/plugins/analysis/ast/types.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/utils/createParameterNodes.d.ts +33 -0
- package/dist/plugins/analysis/ast/utils/createParameterNodes.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/utils/createParameterNodes.js +89 -0
- package/dist/plugins/analysis/ast/utils/index.d.ts +6 -0
- package/dist/plugins/analysis/ast/utils/index.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/utils/index.js +5 -0
- package/dist/plugins/analysis/ast/utils/location.d.ts +87 -0
- package/dist/plugins/analysis/ast/utils/location.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/utils/location.js +78 -0
- package/dist/plugins/analysis/ast/visitors/ASTVisitor.d.ts +9 -4
- package/dist/plugins/analysis/ast/visitors/ASTVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/ASTVisitor.js +6 -5
- package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.d.ts +99 -9
- package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.js +663 -125
- package/dist/plugins/analysis/ast/visitors/ClassVisitor.d.ts +4 -1
- package/dist/plugins/analysis/ast/visitors/ClassVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/ClassVisitor.js +72 -32
- package/dist/plugins/analysis/ast/visitors/FunctionVisitor.d.ts +4 -1
- package/dist/plugins/analysis/ast/visitors/FunctionVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/FunctionVisitor.js +128 -63
- package/dist/plugins/analysis/ast/visitors/ImportExportVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/ImportExportVisitor.js +11 -8
- package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.d.ts +12 -1
- package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.js +36 -14
- package/dist/plugins/analysis/ast/visitors/VariableVisitor.d.ts +4 -1
- package/dist/plugins/analysis/ast/visitors/VariableVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/VariableVisitor.js +17 -13
- package/dist/plugins/discovery/MonorepoServiceDiscovery.d.ts.map +1 -1
- package/dist/plugins/discovery/MonorepoServiceDiscovery.js +3 -2
- package/dist/plugins/discovery/SimpleProjectDiscovery.d.ts.map +1 -1
- package/dist/plugins/discovery/SimpleProjectDiscovery.js +5 -1
- package/dist/plugins/discovery/WorkspaceDiscovery.d.ts +22 -0
- package/dist/plugins/discovery/WorkspaceDiscovery.d.ts.map +1 -0
- package/dist/plugins/discovery/WorkspaceDiscovery.js +136 -0
- package/dist/plugins/discovery/resolveSourceEntrypoint.d.ts +46 -0
- package/dist/plugins/discovery/resolveSourceEntrypoint.d.ts.map +1 -0
- package/dist/plugins/discovery/resolveSourceEntrypoint.js +86 -0
- package/dist/plugins/discovery/workspaces/detector.d.ts +21 -0
- package/dist/plugins/discovery/workspaces/detector.d.ts.map +1 -0
- package/dist/plugins/discovery/workspaces/detector.js +49 -0
- package/dist/plugins/discovery/workspaces/globResolver.d.ts +35 -0
- package/dist/plugins/discovery/workspaces/globResolver.d.ts.map +1 -0
- package/dist/plugins/discovery/workspaces/globResolver.js +184 -0
- package/dist/plugins/discovery/workspaces/index.d.ts +9 -0
- package/dist/plugins/discovery/workspaces/index.d.ts.map +1 -0
- package/dist/plugins/discovery/workspaces/index.js +8 -0
- package/dist/plugins/discovery/workspaces/parsers.d.ts +38 -0
- package/dist/plugins/discovery/workspaces/parsers.d.ts.map +1 -0
- package/dist/plugins/discovery/workspaces/parsers.js +80 -0
- package/dist/plugins/enrichment/AliasTracker.d.ts.map +1 -1
- package/dist/plugins/enrichment/AliasTracker.js +14 -8
- package/dist/plugins/enrichment/HTTPConnectionEnricher.d.ts.map +1 -1
- package/dist/plugins/enrichment/HTTPConnectionEnricher.js +14 -7
- package/dist/plugins/enrichment/ImportExportLinker.d.ts.map +1 -1
- package/dist/plugins/enrichment/ImportExportLinker.js +23 -6
- package/dist/plugins/enrichment/MethodCallResolver.d.ts.map +1 -1
- package/dist/plugins/enrichment/MethodCallResolver.js +18 -12
- package/dist/plugins/enrichment/MountPointResolver.d.ts.map +1 -1
- package/dist/plugins/enrichment/MountPointResolver.js +8 -3
- package/dist/plugins/enrichment/PrefixEvaluator.d.ts.map +1 -1
- package/dist/plugins/enrichment/PrefixEvaluator.js +16 -7
- package/dist/plugins/enrichment/RustFFIEnricher.d.ts.map +1 -1
- package/dist/plugins/enrichment/RustFFIEnricher.js +6 -5
- package/dist/plugins/enrichment/ValueDomainAnalyzer.d.ts +17 -0
- package/dist/plugins/enrichment/ValueDomainAnalyzer.d.ts.map +1 -1
- package/dist/plugins/enrichment/ValueDomainAnalyzer.js +129 -10
- package/dist/plugins/indexing/IncrementalModuleIndexer.d.ts.map +1 -1
- package/dist/plugins/indexing/IncrementalModuleIndexer.js +23 -14
- package/dist/plugins/indexing/JSModuleIndexer.d.ts.map +1 -1
- package/dist/plugins/indexing/JSModuleIndexer.js +63 -31
- package/dist/plugins/indexing/RustModuleIndexer.d.ts.map +1 -1
- package/dist/plugins/indexing/RustModuleIndexer.js +5 -4
- package/dist/plugins/indexing/ServiceDetector.d.ts +10 -0
- package/dist/plugins/indexing/ServiceDetector.d.ts.map +1 -1
- package/dist/plugins/indexing/ServiceDetector.js +28 -15
- package/dist/plugins/validation/CallResolverValidator.d.ts.map +1 -1
- package/dist/plugins/validation/CallResolverValidator.js +8 -7
- package/dist/plugins/validation/DataFlowValidator.d.ts.map +1 -1
- package/dist/plugins/validation/DataFlowValidator.js +17 -12
- package/dist/plugins/validation/EvalBanValidator.d.ts.map +1 -1
- package/dist/plugins/validation/EvalBanValidator.js +17 -16
- package/dist/plugins/validation/GraphConnectivityValidator.d.ts.map +1 -1
- package/dist/plugins/validation/GraphConnectivityValidator.js +19 -23
- package/dist/plugins/validation/NodeCreationValidator.d.ts +85 -0
- package/dist/plugins/validation/NodeCreationValidator.d.ts.map +1 -0
- package/dist/plugins/validation/NodeCreationValidator.js +415 -0
- package/dist/plugins/validation/SQLInjectionValidator.d.ts.map +1 -1
- package/dist/plugins/validation/SQLInjectionValidator.js +59 -16
- package/dist/plugins/validation/ShadowingDetector.d.ts.map +1 -1
- package/dist/plugins/validation/ShadowingDetector.js +6 -5
- package/dist/plugins/validation/TypeScriptDeadCodeValidator.d.ts.map +1 -1
- package/dist/plugins/validation/TypeScriptDeadCodeValidator.js +12 -11
- package/dist/plugins/vcs/GitPlugin.d.ts.map +1 -1
- package/dist/plugins/vcs/GitPlugin.js +10 -12
- package/dist/plugins/vcs/VCSPlugin.d.ts +3 -2
- package/dist/plugins/vcs/VCSPlugin.d.ts.map +1 -1
- package/dist/plugins/vcs/VCSPlugin.js +5 -5
- package/dist/storage/backends/RFDBServerBackend.d.ts +10 -17
- package/dist/storage/backends/RFDBServerBackend.d.ts.map +1 -1
- package/dist/storage/backends/RFDBServerBackend.js +31 -10
- package/dist/validation/PathValidator.d.ts +1 -2
- package/dist/validation/PathValidator.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/Orchestrator.ts +237 -24
- package/src/config/ConfigLoader.ts +263 -0
- package/src/config/index.ts +5 -0
- package/src/core/ASTWorker.ts +143 -139
- package/src/core/CoverageAnalyzer.ts +243 -0
- package/src/core/FileNodeManager.ts +100 -0
- package/src/core/GraphFreshnessChecker.ts +143 -0
- package/src/core/HashUtils.ts +48 -0
- package/src/core/IncrementalReanalyzer.ts +192 -0
- package/src/core/NodeFactory.ts +401 -18
- package/src/core/ScopeTracker.ts +154 -0
- package/src/core/SemanticId.ts +192 -0
- package/src/core/VersionManager.ts +3 -2
- package/src/core/nodes/ArgumentExpressionNode.ts +89 -0
- package/src/core/nodes/ArrayLiteralNode.ts +65 -0
- package/src/core/nodes/CallSiteNode.ts +58 -0
- package/src/core/nodes/ClassNode.ts +63 -2
- package/src/core/nodes/DecoratorNode.ts +91 -0
- package/src/core/nodes/EnumNode.ts +86 -0
- package/src/core/nodes/ExportNode.ts +70 -2
- package/src/core/nodes/ExpressionNode.ts +231 -0
- package/src/core/nodes/ExternalModuleNode.ts +56 -0
- package/src/core/nodes/ExternalStdioNode.ts +17 -9
- package/src/core/nodes/FunctionNode.ts +101 -1
- package/src/core/nodes/ImportNode.ts +32 -10
- package/src/core/nodes/InterfaceNode.ts +91 -0
- package/src/core/nodes/IssueNode.ts +177 -0
- package/src/core/nodes/MethodCallNode.ts +64 -0
- package/src/core/nodes/MethodNode.ts +63 -0
- package/src/core/nodes/ModuleNode.ts +50 -0
- package/src/core/nodes/NetworkRequestNode.ts +77 -0
- package/src/core/nodes/ObjectLiteralNode.ts +65 -0
- package/src/core/nodes/ScopeNode.ts +65 -0
- package/src/core/nodes/TypeNode.ts +78 -0
- package/src/core/nodes/VariableDeclarationNode.ts +52 -0
- package/src/core/nodes/index.ts +18 -1
- package/src/diagnostics/DiagnosticCollector.ts +163 -0
- package/src/diagnostics/DiagnosticReporter.ts +204 -0
- package/src/diagnostics/DiagnosticWriter.ts +50 -0
- package/src/diagnostics/index.ts +16 -0
- package/src/errors/GrafemaError.ts +174 -0
- package/src/index.ts +148 -1
- package/src/logging/Logger.ts +152 -0
- package/src/plugins/Plugin.ts +42 -0
- package/src/plugins/analysis/DatabaseAnalyzer.ts +14 -8
- package/src/plugins/analysis/ExpressAnalyzer.ts +29 -19
- package/src/plugins/analysis/ExpressRouteAnalyzer.ts +22 -21
- package/src/plugins/analysis/FetchAnalyzer.ts +39 -16
- package/src/plugins/analysis/IncrementalAnalysisPlugin.ts +84 -101
- package/src/plugins/analysis/JSASTAnalyzer.ts +1483 -503
- package/src/plugins/analysis/ReactAnalyzer.ts +57 -57
- package/src/plugins/analysis/RustAnalyzer.ts +15 -10
- package/src/plugins/analysis/SQLiteAnalyzer.ts +10 -7
- package/src/plugins/analysis/ServiceLayerAnalyzer.ts +22 -16
- package/src/plugins/analysis/SocketIOAnalyzer.ts +31 -22
- package/src/plugins/analysis/SystemDbAnalyzer.ts +16 -11
- package/src/plugins/analysis/ast/GraphBuilder.ts +439 -327
- package/src/plugins/analysis/ast/IdGenerator.ts +177 -0
- package/src/plugins/analysis/ast/types.ts +209 -6
- package/src/plugins/analysis/ast/utils/createParameterNodes.ts +104 -0
- package/src/plugins/analysis/ast/utils/index.ts +12 -0
- package/src/plugins/analysis/ast/utils/location.ts +103 -0
- package/src/plugins/analysis/ast/visitors/ASTVisitor.ts +11 -8
- package/src/plugins/analysis/ast/visitors/CallExpressionVisitor.ts +909 -83
- package/src/plugins/analysis/ast/visitors/ClassVisitor.ts +97 -44
- package/src/plugins/analysis/ast/visitors/FunctionVisitor.ts +159 -93
- package/src/plugins/analysis/ast/visitors/ImportExportVisitor.ts +12 -8
- package/src/plugins/analysis/ast/visitors/TypeScriptVisitor.ts +41 -14
- package/src/plugins/analysis/ast/visitors/VariableVisitor.ts +37 -17
- package/src/plugins/discovery/MonorepoServiceDiscovery.ts +3 -2
- package/src/plugins/discovery/SimpleProjectDiscovery.ts +6 -1
- package/src/plugins/discovery/WorkspaceDiscovery.ts +177 -0
- package/src/plugins/discovery/resolveSourceEntrypoint.ts +103 -0
- package/src/plugins/discovery/workspaces/detector.ts +63 -0
- package/src/plugins/discovery/workspaces/globResolver.ts +229 -0
- package/src/plugins/discovery/workspaces/index.ts +23 -0
- package/src/plugins/discovery/workspaces/parsers.ts +99 -0
- package/src/plugins/enrichment/AliasTracker.ts +14 -8
- package/src/plugins/enrichment/HTTPConnectionEnricher.ts +14 -7
- package/src/plugins/enrichment/ImportExportLinker.ts +24 -6
- package/src/plugins/enrichment/MethodCallResolver.ts +18 -12
- package/src/plugins/enrichment/MountPointResolver.ts +8 -3
- package/src/plugins/enrichment/PrefixEvaluator.ts +16 -7
- package/src/plugins/enrichment/RustFFIEnricher.ts +6 -5
- package/src/plugins/enrichment/ValueDomainAnalyzer.ts +149 -12
- package/src/plugins/indexing/IncrementalModuleIndexer.ts +23 -14
- package/src/plugins/indexing/JSModuleIndexer.ts +74 -34
- package/src/plugins/indexing/RustModuleIndexer.ts +5 -4
- package/src/plugins/validation/CallResolverValidator.ts +8 -7
- package/src/plugins/validation/DataFlowValidator.ts +16 -12
- package/src/plugins/validation/EvalBanValidator.ts +17 -16
- package/src/plugins/validation/GraphConnectivityValidator.ts +19 -23
- package/src/plugins/validation/NodeCreationValidator.ts +554 -0
- package/src/plugins/validation/SQLInjectionValidator.ts +61 -15
- package/src/plugins/validation/ShadowingDetector.ts +6 -5
- package/src/plugins/validation/TypeScriptDeadCodeValidator.ts +12 -11
- package/src/plugins/vcs/GitPlugin.ts +40 -12
- package/src/plugins/vcs/VCSPlugin.ts +7 -5
- package/src/storage/backends/RFDBServerBackend.ts +43 -29
- package/src/validation/PathValidator.ts +1 -1
- package/dist/core/AnalysisWorker.d.ts +0 -14
- package/dist/core/AnalysisWorker.d.ts.map +0 -1
- package/dist/core/AnalysisWorker.js +0 -307
- package/dist/core/ParallelAnalyzer.d.ts +0 -120
- package/dist/core/ParallelAnalyzer.d.ts.map +0 -1
- package/dist/core/ParallelAnalyzer.js +0 -331
- package/dist/core/QueueWorker.d.ts +0 -12
- package/dist/core/QueueWorker.d.ts.map +0 -1
- package/dist/core/QueueWorker.js +0 -567
- package/dist/core/RFDBClient.d.ts +0 -179
- package/dist/core/RFDBClient.d.ts.map +0 -1
- package/dist/core/RFDBClient.js +0 -429
- package/dist/plugins/discovery/ZonServiceDiscovery.d.ts +0 -19
- package/dist/plugins/discovery/ZonServiceDiscovery.d.ts.map +0 -1
- package/dist/plugins/discovery/ZonServiceDiscovery.js +0 -204
- package/src/core/AnalysisWorker.ts +0 -410
- package/src/core/ParallelAnalyzer.ts +0 -476
- package/src/core/QueueWorker.ts +0 -780
- package/src/plugins/indexing/ServiceDetector.ts +0 -230
|
@@ -18,6 +18,7 @@ import type { Node, CallExpression, JSXElement, JSXAttribute, VariableDeclarator
|
|
|
18
18
|
import { Plugin, createSuccessResult, createErrorResult } from '../Plugin.js';
|
|
19
19
|
import type { PluginContext, PluginResult, PluginMetadata } from '../Plugin.js';
|
|
20
20
|
import type { NodeRecord } from '@grafema/types';
|
|
21
|
+
import { getLine, getColumn } from './ast/utils/location.js';
|
|
21
22
|
|
|
22
23
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
24
|
const traverse = (traverseModule as any).default || traverseModule;
|
|
@@ -224,6 +225,8 @@ export class ReactAnalyzer extends Plugin {
|
|
|
224
225
|
}
|
|
225
226
|
|
|
226
227
|
async execute(context: PluginContext): Promise<PluginResult> {
|
|
228
|
+
const logger = this.log(context);
|
|
229
|
+
|
|
227
230
|
try {
|
|
228
231
|
const { graph } = context;
|
|
229
232
|
const modules = await this.getModules(graph);
|
|
@@ -252,11 +255,16 @@ export class ReactAnalyzer extends Plugin {
|
|
|
252
255
|
stats.issues += result.issues;
|
|
253
256
|
stats.edges += result.edges;
|
|
254
257
|
} catch (err) {
|
|
255
|
-
|
|
258
|
+
// Silent - per-module errors shouldn't spam logs
|
|
256
259
|
}
|
|
257
260
|
}
|
|
258
261
|
|
|
259
|
-
|
|
262
|
+
logger.info('Analysis complete', {
|
|
263
|
+
components: stats.components,
|
|
264
|
+
hooks: stats.hooks,
|
|
265
|
+
events: stats.events,
|
|
266
|
+
issues: stats.issues
|
|
267
|
+
});
|
|
260
268
|
|
|
261
269
|
return createSuccessResult(
|
|
262
270
|
{
|
|
@@ -266,7 +274,7 @@ export class ReactAnalyzer extends Plugin {
|
|
|
266
274
|
stats
|
|
267
275
|
);
|
|
268
276
|
} catch (error) {
|
|
269
|
-
|
|
277
|
+
logger.error('Analysis failed', { error });
|
|
270
278
|
return createErrorResult(error as Error);
|
|
271
279
|
}
|
|
272
280
|
}
|
|
@@ -328,14 +336,13 @@ export class ReactAnalyzer extends Plugin {
|
|
|
328
336
|
if (this.isReactComponent(path)) {
|
|
329
337
|
const node = path.node;
|
|
330
338
|
const name = (node.id as { name: string }).name;
|
|
331
|
-
const loc = node.loc!;
|
|
332
339
|
const component: ComponentNode = {
|
|
333
|
-
id: `react:component#${name}#${filePath}:${
|
|
340
|
+
id: `react:component#${name}#${filePath}:${getLine(node)}`,
|
|
334
341
|
type: 'react:component',
|
|
335
342
|
name,
|
|
336
343
|
file: filePath,
|
|
337
|
-
line:
|
|
338
|
-
column:
|
|
344
|
+
line: getLine(node),
|
|
345
|
+
column: getColumn(node),
|
|
339
346
|
kind: 'arrow'
|
|
340
347
|
};
|
|
341
348
|
analysis.components.push(component);
|
|
@@ -348,14 +355,13 @@ export class ReactAnalyzer extends Plugin {
|
|
|
348
355
|
const name = path.node.id?.name;
|
|
349
356
|
if (!name) return;
|
|
350
357
|
|
|
351
|
-
const loc = path.node.loc!;
|
|
352
358
|
const component: ComponentNode = {
|
|
353
|
-
id: `react:component#${name}#${filePath}:${
|
|
359
|
+
id: `react:component#${name}#${filePath}:${getLine(path.node)}`,
|
|
354
360
|
type: 'react:component',
|
|
355
361
|
name,
|
|
356
362
|
file: filePath,
|
|
357
|
-
line:
|
|
358
|
-
column:
|
|
363
|
+
line: getLine(path.node),
|
|
364
|
+
column: getColumn(path.node),
|
|
359
365
|
kind: 'function'
|
|
360
366
|
};
|
|
361
367
|
analysis.components.push(component);
|
|
@@ -459,13 +465,12 @@ export class ReactAnalyzer extends Plugin {
|
|
|
459
465
|
private analyzeHook(path: NodePath<CallExpression>, filePath: string): HookNode | null {
|
|
460
466
|
const callee = path.node.callee as { name: string };
|
|
461
467
|
const hookName = callee.name;
|
|
462
|
-
const loc = path.node.loc!;
|
|
463
468
|
const args = path.node.arguments;
|
|
464
469
|
|
|
465
470
|
const hookBase = {
|
|
466
471
|
file: filePath,
|
|
467
|
-
line:
|
|
468
|
-
column:
|
|
472
|
+
line: getLine(path.node),
|
|
473
|
+
column: getColumn(path.node),
|
|
469
474
|
hookName
|
|
470
475
|
};
|
|
471
476
|
|
|
@@ -481,7 +486,7 @@ export class ReactAnalyzer extends Plugin {
|
|
|
481
486
|
const initialValue = args[0];
|
|
482
487
|
|
|
483
488
|
return {
|
|
484
|
-
id: `react:state#${stateName}#${filePath}:${
|
|
489
|
+
id: `react:state#${stateName}#${filePath}:${hookBase.line}`,
|
|
485
490
|
type: 'react:state',
|
|
486
491
|
...hookBase,
|
|
487
492
|
stateName,
|
|
@@ -506,7 +511,7 @@ export class ReactAnalyzer extends Plugin {
|
|
|
506
511
|
'react:insertion-effect';
|
|
507
512
|
|
|
508
513
|
return {
|
|
509
|
-
id: `${effectType}#${filePath}:${
|
|
514
|
+
id: `${effectType}#${filePath}:${hookBase.line}`,
|
|
510
515
|
type: effectType,
|
|
511
516
|
...hookBase,
|
|
512
517
|
deps,
|
|
@@ -523,7 +528,7 @@ export class ReactAnalyzer extends Plugin {
|
|
|
523
528
|
const deps = this.extractDeps(depsArg as Node);
|
|
524
529
|
|
|
525
530
|
return {
|
|
526
|
-
id: `react:callback#${callbackName || 'anonymous'}#${filePath}:${
|
|
531
|
+
id: `react:callback#${callbackName || 'anonymous'}#${filePath}:${hookBase.line}`,
|
|
527
532
|
type: 'react:callback',
|
|
528
533
|
...hookBase,
|
|
529
534
|
callbackName,
|
|
@@ -539,7 +544,7 @@ export class ReactAnalyzer extends Plugin {
|
|
|
539
544
|
const deps = this.extractDeps(depsArg as Node);
|
|
540
545
|
|
|
541
546
|
return {
|
|
542
|
-
id: `react:memo#${memoName || 'anonymous'}#${filePath}:${
|
|
547
|
+
id: `react:memo#${memoName || 'anonymous'}#${filePath}:${hookBase.line}`,
|
|
543
548
|
type: 'react:memo',
|
|
544
549
|
...hookBase,
|
|
545
550
|
memoName,
|
|
@@ -554,7 +559,7 @@ export class ReactAnalyzer extends Plugin {
|
|
|
554
559
|
const initialValue = args[0];
|
|
555
560
|
|
|
556
561
|
return {
|
|
557
|
-
id: `react:ref#${refName || 'anonymous'}#${filePath}:${
|
|
562
|
+
id: `react:ref#${refName || 'anonymous'}#${filePath}:${hookBase.line}`,
|
|
558
563
|
type: 'react:ref',
|
|
559
564
|
...hookBase,
|
|
560
565
|
refName,
|
|
@@ -574,7 +579,7 @@ export class ReactAnalyzer extends Plugin {
|
|
|
574
579
|
const reducerName = reducerArg?.type === 'Identifier' ? (reducerArg as { name: string }).name : null;
|
|
575
580
|
|
|
576
581
|
return {
|
|
577
|
-
id: `react:reducer#${stateName}#${filePath}:${
|
|
582
|
+
id: `react:reducer#${stateName}#${filePath}:${hookBase.line}`,
|
|
578
583
|
type: 'react:reducer',
|
|
579
584
|
...hookBase,
|
|
580
585
|
stateName,
|
|
@@ -593,7 +598,7 @@ export class ReactAnalyzer extends Plugin {
|
|
|
593
598
|
const contextName = contextArg?.type === 'Identifier' ? (contextArg as { name: string }).name : null;
|
|
594
599
|
|
|
595
600
|
return {
|
|
596
|
-
id: `react:context-use#${contextName || 'unknown'}#${filePath}:${
|
|
601
|
+
id: `react:context-use#${contextName || 'unknown'}#${filePath}:${hookBase.line}`,
|
|
597
602
|
type: 'react:context-use',
|
|
598
603
|
...hookBase,
|
|
599
604
|
valueName,
|
|
@@ -623,7 +628,7 @@ export class ReactAnalyzer extends Plugin {
|
|
|
623
628
|
}
|
|
624
629
|
|
|
625
630
|
return {
|
|
626
|
-
id: `react:imperative-handle#${filePath}:${
|
|
631
|
+
id: `react:imperative-handle#${filePath}:${hookBase.line}`,
|
|
627
632
|
type: 'react:imperative-handle',
|
|
628
633
|
...hookBase,
|
|
629
634
|
refName,
|
|
@@ -963,7 +968,6 @@ export class ReactAnalyzer extends Plugin {
|
|
|
963
968
|
}
|
|
964
969
|
|
|
965
970
|
// This is a React component being rendered
|
|
966
|
-
const loc = openingElement.loc!;
|
|
967
971
|
|
|
968
972
|
// Find parent component
|
|
969
973
|
let parentComponent: string | null = null;
|
|
@@ -988,7 +992,7 @@ export class ReactAnalyzer extends Plugin {
|
|
|
988
992
|
src: `react:component#${parentComponent}`,
|
|
989
993
|
dst: `react:component#${elementName}`,
|
|
990
994
|
file: filePath,
|
|
991
|
-
line:
|
|
995
|
+
line: getLine(openingElement)
|
|
992
996
|
});
|
|
993
997
|
}
|
|
994
998
|
}
|
|
@@ -1026,7 +1030,6 @@ export class ReactAnalyzer extends Plugin {
|
|
|
1026
1030
|
if (!attr.name || attr.name.type !== 'JSXIdentifier') return;
|
|
1027
1031
|
|
|
1028
1032
|
const attrName = attr.name.name;
|
|
1029
|
-
const loc = attr.loc!;
|
|
1030
1033
|
|
|
1031
1034
|
// Get parent JSX element info first
|
|
1032
1035
|
const jsxOpeningElement = path.parent as { type: string; name?: Node };
|
|
@@ -1054,13 +1057,13 @@ export class ReactAnalyzer extends Plugin {
|
|
|
1054
1057
|
}
|
|
1055
1058
|
|
|
1056
1059
|
const event: EventNode = {
|
|
1057
|
-
id: `dom:event#${eventType}#${filePath}:${
|
|
1060
|
+
id: `dom:event#${eventType}#${filePath}:${getLine(attr)}`,
|
|
1058
1061
|
type: 'dom:event',
|
|
1059
1062
|
eventType,
|
|
1060
1063
|
reactProp: attrName,
|
|
1061
1064
|
handler: handlerName,
|
|
1062
1065
|
file: filePath,
|
|
1063
|
-
line:
|
|
1066
|
+
line: getLine(attr)
|
|
1064
1067
|
};
|
|
1065
1068
|
analysis.events.push(event);
|
|
1066
1069
|
}
|
|
@@ -1105,7 +1108,7 @@ export class ReactAnalyzer extends Plugin {
|
|
|
1105
1108
|
propName: attrName,
|
|
1106
1109
|
propValue,
|
|
1107
1110
|
file: filePath,
|
|
1108
|
-
line:
|
|
1111
|
+
line: getLine(attr)
|
|
1109
1112
|
});
|
|
1110
1113
|
}
|
|
1111
1114
|
}
|
|
@@ -1115,18 +1118,17 @@ export class ReactAnalyzer extends Plugin {
|
|
|
1115
1118
|
* Analyze forwardRef usage
|
|
1116
1119
|
*/
|
|
1117
1120
|
private analyzeForwardRef(path: NodePath<CallExpression>, filePath: string, analysis: AnalysisResult): void {
|
|
1118
|
-
const loc = path.node.loc!;
|
|
1119
1121
|
const parent = path.parent as { type: string; id?: { name: string } };
|
|
1120
1122
|
const componentName = parent.type === 'VariableDeclarator' ? parent.id?.name : null;
|
|
1121
1123
|
|
|
1122
1124
|
if (componentName) {
|
|
1123
1125
|
analysis.components.push({
|
|
1124
|
-
id: `react:component#${componentName}#${filePath}:${
|
|
1126
|
+
id: `react:component#${componentName}#${filePath}:${getLine(path.node)}`,
|
|
1125
1127
|
type: 'react:component',
|
|
1126
1128
|
name: componentName,
|
|
1127
1129
|
file: filePath,
|
|
1128
|
-
line:
|
|
1129
|
-
column:
|
|
1130
|
+
line: getLine(path.node),
|
|
1131
|
+
column: getColumn(path.node),
|
|
1130
1132
|
kind: 'forwardRef'
|
|
1131
1133
|
});
|
|
1132
1134
|
}
|
|
@@ -1136,19 +1138,18 @@ export class ReactAnalyzer extends Plugin {
|
|
|
1136
1138
|
* Analyze createContext usage
|
|
1137
1139
|
*/
|
|
1138
1140
|
private analyzeCreateContext(path: NodePath<CallExpression>, filePath: string, analysis: AnalysisResult): void {
|
|
1139
|
-
const loc = path.node.loc!;
|
|
1140
1141
|
const parent = path.parent as { type: string; id?: { name: string } };
|
|
1141
1142
|
const contextName = parent.type === 'VariableDeclarator' ? parent.id?.name : null;
|
|
1142
1143
|
|
|
1143
1144
|
if (contextName) {
|
|
1144
1145
|
const defaultValue = path.node.arguments[0];
|
|
1145
1146
|
analysis.hooks.push({
|
|
1146
|
-
id: `react:context#${contextName}#${filePath}:${
|
|
1147
|
+
id: `react:context#${contextName}#${filePath}:${getLine(path.node)}`,
|
|
1147
1148
|
type: 'react:context',
|
|
1148
1149
|
contextName,
|
|
1149
1150
|
file: filePath,
|
|
1150
|
-
line:
|
|
1151
|
-
column:
|
|
1151
|
+
line: getLine(path.node),
|
|
1152
|
+
column: getColumn(path.node),
|
|
1152
1153
|
hookName: 'createContext',
|
|
1153
1154
|
defaultValue: this.getExpressionValue(defaultValue as Node)
|
|
1154
1155
|
});
|
|
@@ -1160,7 +1161,6 @@ export class ReactAnalyzer extends Plugin {
|
|
|
1160
1161
|
*/
|
|
1161
1162
|
private analyzeBrowserAPI(path: NodePath<CallExpression>, filePath: string, analysis: AnalysisResult): void {
|
|
1162
1163
|
const callee = path.node.callee;
|
|
1163
|
-
const loc = path.node.loc!;
|
|
1164
1164
|
|
|
1165
1165
|
// Direct function call: setTimeout, fetch, alert
|
|
1166
1166
|
if (callee.type === 'Identifier') {
|
|
@@ -1169,11 +1169,11 @@ export class ReactAnalyzer extends Plugin {
|
|
|
1169
1169
|
// Timers
|
|
1170
1170
|
if (BROWSER_APIS.timers.includes(name)) {
|
|
1171
1171
|
analysis.browserAPIs.push({
|
|
1172
|
-
id: `browser:timer#${name}#${filePath}:${
|
|
1172
|
+
id: `browser:timer#${name}#${filePath}:${getLine(path.node)}`,
|
|
1173
1173
|
type: 'browser:timer',
|
|
1174
1174
|
api: name,
|
|
1175
1175
|
file: filePath,
|
|
1176
|
-
line:
|
|
1176
|
+
line: getLine(path.node)
|
|
1177
1177
|
});
|
|
1178
1178
|
return;
|
|
1179
1179
|
}
|
|
@@ -1181,11 +1181,11 @@ export class ReactAnalyzer extends Plugin {
|
|
|
1181
1181
|
// Blocking APIs
|
|
1182
1182
|
if (BROWSER_APIS.blocking.includes(name)) {
|
|
1183
1183
|
analysis.browserAPIs.push({
|
|
1184
|
-
id: `browser:blocking#${name}#${filePath}:${
|
|
1184
|
+
id: `browser:blocking#${name}#${filePath}:${getLine(path.node)}`,
|
|
1185
1185
|
type: 'browser:blocking',
|
|
1186
1186
|
api: name,
|
|
1187
1187
|
file: filePath,
|
|
1188
|
-
line:
|
|
1188
|
+
line: getLine(path.node)
|
|
1189
1189
|
});
|
|
1190
1190
|
return;
|
|
1191
1191
|
}
|
|
@@ -1193,11 +1193,11 @@ export class ReactAnalyzer extends Plugin {
|
|
|
1193
1193
|
// Fetch
|
|
1194
1194
|
if (name === 'fetch') {
|
|
1195
1195
|
analysis.browserAPIs.push({
|
|
1196
|
-
id: `browser:async#fetch#${filePath}:${
|
|
1196
|
+
id: `browser:async#fetch#${filePath}:${getLine(path.node)}`,
|
|
1197
1197
|
type: 'browser:async',
|
|
1198
1198
|
api: 'fetch',
|
|
1199
1199
|
file: filePath,
|
|
1200
|
-
line:
|
|
1200
|
+
line: getLine(path.node)
|
|
1201
1201
|
});
|
|
1202
1202
|
return;
|
|
1203
1203
|
}
|
|
@@ -1215,12 +1215,12 @@ export class ReactAnalyzer extends Plugin {
|
|
|
1215
1215
|
method === 'removeItem' ? 'delete' : method;
|
|
1216
1216
|
|
|
1217
1217
|
analysis.browserAPIs.push({
|
|
1218
|
-
id: `browser:storage#${storage}:${operation}#${filePath}:${
|
|
1218
|
+
id: `browser:storage#${storage}:${operation}#${filePath}:${getLine(path.node)}`,
|
|
1219
1219
|
type: 'browser:storage',
|
|
1220
1220
|
storage,
|
|
1221
1221
|
operation,
|
|
1222
1222
|
file: filePath,
|
|
1223
|
-
line:
|
|
1223
|
+
line: getLine(path.node)
|
|
1224
1224
|
});
|
|
1225
1225
|
return;
|
|
1226
1226
|
}
|
|
@@ -1229,12 +1229,12 @@ export class ReactAnalyzer extends Plugin {
|
|
|
1229
1229
|
if (fullName.startsWith('document.') &&
|
|
1230
1230
|
(fullName.includes('querySelector') || fullName.includes('getElementById'))) {
|
|
1231
1231
|
analysis.browserAPIs.push({
|
|
1232
|
-
id: `browser:dom#query#${filePath}:${
|
|
1232
|
+
id: `browser:dom#query#${filePath}:${getLine(path.node)}`,
|
|
1233
1233
|
type: 'browser:dom',
|
|
1234
1234
|
operation: 'query',
|
|
1235
1235
|
api: fullName,
|
|
1236
1236
|
file: filePath,
|
|
1237
|
-
line:
|
|
1237
|
+
line: getLine(path.node)
|
|
1238
1238
|
});
|
|
1239
1239
|
return;
|
|
1240
1240
|
}
|
|
@@ -1242,11 +1242,11 @@ export class ReactAnalyzer extends Plugin {
|
|
|
1242
1242
|
// History API
|
|
1243
1243
|
if (fullName.startsWith('history.') || fullName.startsWith('window.history.')) {
|
|
1244
1244
|
analysis.browserAPIs.push({
|
|
1245
|
-
id: `browser:history#${filePath}:${
|
|
1245
|
+
id: `browser:history#${filePath}:${getLine(path.node)}`,
|
|
1246
1246
|
type: 'browser:history',
|
|
1247
1247
|
api: fullName,
|
|
1248
1248
|
file: filePath,
|
|
1249
|
-
line:
|
|
1249
|
+
line: getLine(path.node)
|
|
1250
1250
|
});
|
|
1251
1251
|
return;
|
|
1252
1252
|
}
|
|
@@ -1254,11 +1254,11 @@ export class ReactAnalyzer extends Plugin {
|
|
|
1254
1254
|
// Clipboard API
|
|
1255
1255
|
if (fullName.includes('clipboard')) {
|
|
1256
1256
|
analysis.browserAPIs.push({
|
|
1257
|
-
id: `browser:clipboard#${filePath}:${
|
|
1257
|
+
id: `browser:clipboard#${filePath}:${getLine(path.node)}`,
|
|
1258
1258
|
type: 'browser:clipboard',
|
|
1259
1259
|
api: fullName,
|
|
1260
1260
|
file: filePath,
|
|
1261
|
-
line:
|
|
1261
|
+
line: getLine(path.node)
|
|
1262
1262
|
});
|
|
1263
1263
|
return;
|
|
1264
1264
|
}
|
|
@@ -1266,11 +1266,11 @@ export class ReactAnalyzer extends Plugin {
|
|
|
1266
1266
|
// Geolocation
|
|
1267
1267
|
if (fullName.includes('geolocation')) {
|
|
1268
1268
|
analysis.browserAPIs.push({
|
|
1269
|
-
id: `browser:geolocation#${filePath}:${
|
|
1269
|
+
id: `browser:geolocation#${filePath}:${getLine(path.node)}`,
|
|
1270
1270
|
type: 'browser:geolocation',
|
|
1271
1271
|
api: fullName,
|
|
1272
1272
|
file: filePath,
|
|
1273
|
-
line:
|
|
1273
|
+
line: getLine(path.node)
|
|
1274
1274
|
});
|
|
1275
1275
|
return;
|
|
1276
1276
|
}
|
|
@@ -1279,11 +1279,11 @@ export class ReactAnalyzer extends Plugin {
|
|
|
1279
1279
|
if (fullName.match(/\.(fillRect|strokeRect|fillText|strokeText|beginPath|closePath|moveTo|lineTo|arc|fill|stroke|clearRect|drawImage|save|restore|translate|rotate|scale)$/)) {
|
|
1280
1280
|
const method = fullName.split('.').pop();
|
|
1281
1281
|
analysis.browserAPIs.push({
|
|
1282
|
-
id: `canvas:draw#${method}#${filePath}:${
|
|
1282
|
+
id: `canvas:draw#${method}#${filePath}:${getLine(path.node)}`,
|
|
1283
1283
|
type: 'canvas:draw',
|
|
1284
1284
|
method,
|
|
1285
1285
|
file: filePath,
|
|
1286
|
-
line:
|
|
1286
|
+
line: getLine(path.node)
|
|
1287
1287
|
});
|
|
1288
1288
|
return;
|
|
1289
1289
|
}
|
|
@@ -1291,11 +1291,11 @@ export class ReactAnalyzer extends Plugin {
|
|
|
1291
1291
|
// matchMedia
|
|
1292
1292
|
if (fullName === 'window.matchMedia' || fullName === 'matchMedia') {
|
|
1293
1293
|
analysis.browserAPIs.push({
|
|
1294
|
-
id: `browser:media-query#${filePath}:${
|
|
1294
|
+
id: `browser:media-query#${filePath}:${getLine(path.node)}`,
|
|
1295
1295
|
type: 'browser:media-query',
|
|
1296
1296
|
api: 'matchMedia',
|
|
1297
1297
|
file: filePath,
|
|
1298
|
-
line:
|
|
1298
|
+
line: getLine(path.node)
|
|
1299
1299
|
});
|
|
1300
1300
|
return;
|
|
1301
1301
|
}
|
|
@@ -140,19 +140,20 @@ interface EdgeToAdd {
|
|
|
140
140
|
let parseRustFile: ((code: string) => RustParseResult) | undefined;
|
|
141
141
|
|
|
142
142
|
// Try to load the native binding
|
|
143
|
+
// Path: from dist/plugins/analysis/ go up 5 levels to reach project root, then rust-engine/
|
|
143
144
|
try {
|
|
144
145
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
145
|
-
const nativeBinding = await import('
|
|
146
|
+
const nativeBinding = await import('../../../../../rust-engine/grafema-graph-engine.node' as any);
|
|
146
147
|
parseRustFile = nativeBinding.parseRustFile;
|
|
147
148
|
} catch {
|
|
148
149
|
// Fallback: try require
|
|
149
150
|
try {
|
|
150
151
|
const { createRequire } = await import('module');
|
|
151
152
|
const require = createRequire(import.meta.url);
|
|
152
|
-
const nativeBinding = require('
|
|
153
|
+
const nativeBinding = require('../../../../../rust-engine/grafema-graph-engine.node');
|
|
153
154
|
parseRustFile = nativeBinding.parseRustFile;
|
|
154
|
-
} catch
|
|
155
|
-
|
|
155
|
+
} catch {
|
|
156
|
+
// Silent - will be reported during execute if needed
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
159
|
|
|
@@ -179,9 +180,10 @@ export class RustAnalyzer extends Plugin {
|
|
|
179
180
|
|
|
180
181
|
async execute(context: PluginContext): Promise<PluginResult> {
|
|
181
182
|
const { graph, onProgress } = context;
|
|
183
|
+
const logger = this.log(context);
|
|
182
184
|
|
|
183
185
|
if (!parseRustFile) {
|
|
184
|
-
|
|
186
|
+
logger.info('Skipping - native binding not available');
|
|
185
187
|
return createSuccessResult(
|
|
186
188
|
{ nodes: 0, edges: 0 },
|
|
187
189
|
{ skipped: true, reason: 'Native binding not available' }
|
|
@@ -195,11 +197,11 @@ export class RustAnalyzer extends Plugin {
|
|
|
195
197
|
}
|
|
196
198
|
|
|
197
199
|
if (modules.length === 0) {
|
|
198
|
-
|
|
200
|
+
logger.info('No RUST_MODULE nodes found, skipping');
|
|
199
201
|
return createSuccessResult({ nodes: 0, edges: 0 }, { skipped: true, reason: 'No modules' });
|
|
200
202
|
}
|
|
201
203
|
|
|
202
|
-
|
|
204
|
+
logger.info('Analyzing Rust modules', { count: modules.length });
|
|
203
205
|
|
|
204
206
|
const stats: AnalysisStats = {
|
|
205
207
|
functions: 0,
|
|
@@ -238,15 +240,18 @@ export class RustAnalyzer extends Plugin {
|
|
|
238
240
|
}
|
|
239
241
|
} catch (err) {
|
|
240
242
|
errors.push({ file: module.file!, error: (err as Error).message });
|
|
241
|
-
|
|
243
|
+
logger.warn('Error parsing module', {
|
|
244
|
+
file: module.file,
|
|
245
|
+
error: (err as Error).message
|
|
246
|
+
});
|
|
242
247
|
}
|
|
243
248
|
}
|
|
244
249
|
|
|
245
250
|
if (errors.length > 0) {
|
|
246
|
-
|
|
251
|
+
logger.warn('Analysis completed with errors', { errorCount: errors.length });
|
|
247
252
|
}
|
|
248
253
|
|
|
249
|
-
|
|
254
|
+
logger.info('Analysis complete', { ...stats });
|
|
250
255
|
return createSuccessResult(
|
|
251
256
|
{ nodes: stats.functions + stats.structs + stats.impls + stats.methods + stats.traits + stats.calls, edges: stats.edges },
|
|
252
257
|
{ ...stats, errors: errors.length }
|
|
@@ -16,6 +16,7 @@ import type { NodePath } from '@babel/traverse';
|
|
|
16
16
|
import { Plugin, createSuccessResult, createErrorResult } from '../Plugin.js';
|
|
17
17
|
import type { PluginContext, PluginResult, PluginMetadata } from '../Plugin.js';
|
|
18
18
|
import type { NodeRecord } from '@grafema/types';
|
|
19
|
+
import { getLine } from './ast/utils/location.js';
|
|
19
20
|
|
|
20
21
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
22
|
const traverse = (traverseModule as any).default || traverseModule;
|
|
@@ -62,6 +63,8 @@ export class SQLiteAnalyzer extends Plugin {
|
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
async execute(context: PluginContext): Promise<PluginResult> {
|
|
66
|
+
const logger = this.log(context);
|
|
67
|
+
|
|
65
68
|
try {
|
|
66
69
|
const { graph } = context;
|
|
67
70
|
|
|
@@ -80,14 +83,14 @@ export class SQLiteAnalyzer extends Plugin {
|
|
|
80
83
|
edgesCreated += result.edges;
|
|
81
84
|
}
|
|
82
85
|
|
|
83
|
-
|
|
86
|
+
logger.info('Analysis complete', { queriesCreated, operationsCreated });
|
|
84
87
|
|
|
85
88
|
return createSuccessResult(
|
|
86
89
|
{ nodes: queriesCreated + operationsCreated, edges: edgesCreated },
|
|
87
90
|
{ modulesAnalyzed: modules.length, queries: queriesCreated, operations: operationsCreated }
|
|
88
91
|
);
|
|
89
92
|
} catch (error) {
|
|
90
|
-
|
|
93
|
+
logger.error('Analysis failed', { error });
|
|
91
94
|
return createErrorResult(error as Error);
|
|
92
95
|
}
|
|
93
96
|
}
|
|
@@ -167,7 +170,7 @@ export class SQLiteAnalyzer extends Plugin {
|
|
|
167
170
|
const operationType = this.detectOperationType(query);
|
|
168
171
|
const tableName = this.extractTableName(query, operationType);
|
|
169
172
|
|
|
170
|
-
const queryId = `${module.file}:DATABASE_QUERY:${method}:${node
|
|
173
|
+
const queryId = `${module.file}:DATABASE_QUERY:${method}:${getLine(node)}`;
|
|
171
174
|
|
|
172
175
|
queries.push({
|
|
173
176
|
id: queryId,
|
|
@@ -178,7 +181,7 @@ export class SQLiteAnalyzer extends Plugin {
|
|
|
178
181
|
operationType: operationType,
|
|
179
182
|
tableName: tableName,
|
|
180
183
|
file: module.file!,
|
|
181
|
-
line: node
|
|
184
|
+
line: getLine(node)
|
|
182
185
|
});
|
|
183
186
|
}
|
|
184
187
|
}
|
|
@@ -239,7 +242,7 @@ export class SQLiteAnalyzer extends Plugin {
|
|
|
239
242
|
const operationType = this.detectOperationType(query);
|
|
240
243
|
const tableName = this.extractTableName(query, operationType);
|
|
241
244
|
|
|
242
|
-
const queryId = `${module.file}:DATABASE_QUERY:${method}:${innerNode
|
|
245
|
+
const queryId = `${module.file}:DATABASE_QUERY:${method}:${getLine(innerNode)}`;
|
|
243
246
|
|
|
244
247
|
queries.push({
|
|
245
248
|
id: queryId,
|
|
@@ -250,7 +253,7 @@ export class SQLiteAnalyzer extends Plugin {
|
|
|
250
253
|
operationType: operationType,
|
|
251
254
|
tableName: tableName,
|
|
252
255
|
file: module.file!,
|
|
253
|
-
line: innerNode
|
|
256
|
+
line: getLine(innerNode),
|
|
254
257
|
promiseWrapped: true
|
|
255
258
|
});
|
|
256
259
|
}
|
|
@@ -307,7 +310,7 @@ export class SQLiteAnalyzer extends Plugin {
|
|
|
307
310
|
}
|
|
308
311
|
}
|
|
309
312
|
} catch (error) {
|
|
310
|
-
|
|
313
|
+
// Silent - per-module errors shouldn't spam logs
|
|
311
314
|
}
|
|
312
315
|
|
|
313
316
|
return {
|
|
@@ -24,6 +24,7 @@ import type { NodePath } from '@babel/traverse';
|
|
|
24
24
|
import { Plugin, createSuccessResult, createErrorResult } from '../Plugin.js';
|
|
25
25
|
import type { PluginContext, PluginResult, PluginMetadata } from '../Plugin.js';
|
|
26
26
|
import type { NodeRecord } from '@grafema/types';
|
|
27
|
+
import { getLine } from './ast/utils/location.js';
|
|
27
28
|
|
|
28
29
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
30
|
const traverse = (traverseModule as any).default || traverseModule;
|
|
@@ -99,12 +100,14 @@ export class ServiceLayerAnalyzer extends Plugin {
|
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
async execute(context: PluginContext): Promise<PluginResult> {
|
|
103
|
+
const logger = this.log(context);
|
|
104
|
+
|
|
102
105
|
try {
|
|
103
106
|
const { graph } = context;
|
|
104
107
|
|
|
105
108
|
// Получаем все модули
|
|
106
109
|
const modules = await this.getModules(graph);
|
|
107
|
-
|
|
110
|
+
logger.info('Processing modules', { count: modules.length });
|
|
108
111
|
|
|
109
112
|
let classesCount = 0;
|
|
110
113
|
let instancesCount = 0;
|
|
@@ -124,15 +127,21 @@ export class ServiceLayerAnalyzer extends Plugin {
|
|
|
124
127
|
if ((i + 1) % 20 === 0 || i === modules.length - 1) {
|
|
125
128
|
const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
|
|
126
129
|
const avgTime = ((Date.now() - startTime) / (i + 1)).toFixed(0);
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
+
logger.debug('Progress', {
|
|
131
|
+
current: i + 1,
|
|
132
|
+
total: modules.length,
|
|
133
|
+
elapsed: `${elapsed}s`,
|
|
134
|
+
avgTime: `${avgTime}ms/module`
|
|
135
|
+
});
|
|
130
136
|
}
|
|
131
137
|
}
|
|
132
138
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
139
|
+
logger.info('Analysis complete', {
|
|
140
|
+
classesCount,
|
|
141
|
+
instancesCount,
|
|
142
|
+
registrationsCount,
|
|
143
|
+
usagesCount
|
|
144
|
+
});
|
|
136
145
|
|
|
137
146
|
return createSuccessResult(
|
|
138
147
|
{
|
|
@@ -147,7 +156,7 @@ export class ServiceLayerAnalyzer extends Plugin {
|
|
|
147
156
|
}
|
|
148
157
|
);
|
|
149
158
|
} catch (error) {
|
|
150
|
-
|
|
159
|
+
logger.error('Analysis failed', { error });
|
|
151
160
|
return createErrorResult(error as Error);
|
|
152
161
|
}
|
|
153
162
|
}
|
|
@@ -186,7 +195,7 @@ export class ServiceLayerAnalyzer extends Plugin {
|
|
|
186
195
|
const className = node.id?.name;
|
|
187
196
|
|
|
188
197
|
if (className && this.isServiceClass(className)) {
|
|
189
|
-
const line = node
|
|
198
|
+
const line = getLine(node);
|
|
190
199
|
|
|
191
200
|
// Извлекаем методы сервиса
|
|
192
201
|
const methods = node.body.body
|
|
@@ -213,7 +222,7 @@ export class ServiceLayerAnalyzer extends Plugin {
|
|
|
213
222
|
const className = (callee as Identifier).name;
|
|
214
223
|
|
|
215
224
|
if (this.isServiceClass(className)) {
|
|
216
|
-
const line = node
|
|
225
|
+
const line = getLine(node);
|
|
217
226
|
|
|
218
227
|
serviceInstances.push({
|
|
219
228
|
id: `${module.file}:SERVICE_INSTANCE:${className}:${line}`,
|
|
@@ -240,7 +249,7 @@ export class ServiceLayerAnalyzer extends Plugin {
|
|
|
240
249
|
const objectName = this.getObjectName(callee.object);
|
|
241
250
|
if (objectName === 'app' && node.arguments.length >= 2) {
|
|
242
251
|
const serviceName = this.extractStringArg(node.arguments[0]);
|
|
243
|
-
const line = node
|
|
252
|
+
const line = getLine(node);
|
|
244
253
|
|
|
245
254
|
// Проверяем что это похоже на service (имя содержит 'service' или '*Service')
|
|
246
255
|
if (
|
|
@@ -273,7 +282,7 @@ export class ServiceLayerAnalyzer extends Plugin {
|
|
|
273
282
|
) {
|
|
274
283
|
if (node.arguments.length >= 1) {
|
|
275
284
|
const serviceName = this.extractStringArg(node.arguments[0]);
|
|
276
|
-
const line = node
|
|
285
|
+
const line = getLine(node);
|
|
277
286
|
|
|
278
287
|
// Проверяем что это похоже на service
|
|
279
288
|
if (
|
|
@@ -358,10 +367,7 @@ export class ServiceLayerAnalyzer extends Plugin {
|
|
|
358
367
|
usages: serviceUsages.length
|
|
359
368
|
};
|
|
360
369
|
} catch (error) {
|
|
361
|
-
|
|
362
|
-
`[ServiceLayerAnalyzer] Error analyzing ${module.file}:`,
|
|
363
|
-
(error as Error).message
|
|
364
|
-
);
|
|
370
|
+
// Silent - per-module errors shouldn't spam logs
|
|
365
371
|
return { classes: 0, instances: 0, registrations: 0, usages: 0 };
|
|
366
372
|
}
|
|
367
373
|
}
|