@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactAnalyzer.d.ts","sourceRoot":"","sources":["../../../src/plugins/analysis/ReactAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,OAAO,KAAK,EAAE,IAAI,EAAqF,MAAM,cAAc,CAAC;AAC5H,OAAO,EAAE,MAAM,EAA0C,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ReactAnalyzer.d.ts","sourceRoot":"","sources":["../../../src/plugins/analysis/ReactAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,OAAO,KAAK,EAAE,IAAI,EAAqF,MAAM,cAAc,CAAC;AAC5H,OAAO,EAAE,MAAM,EAA0C,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAyKhF;;GAEG;AACH,UAAU,aAAa;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,qBAAa,aAAc,SAAQ,MAAM;IACvC,IAAI,QAAQ,IAAI,cAAc,CAuB7B;IAEK,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAuD5D,OAAO,CAAC,WAAW;YAQL,aAAa;IAU3B;;OAEG;IACG,UAAU,CACd,GAAG,EAAE,IAAI,EACT,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,EAC7B,QAAQ,GAAE,MAAM,GAAG,IAAW,GAC7B,OAAO,CAAC,aAAa,CAAC;IAwHzB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA+BxB;;OAEG;IACH,OAAO,CAAC,WAAW;IAkLnB;;OAEG;IACH,OAAO,CAAC,WAAW;IAenB,OAAO,CAAC,uBAAuB;IAU/B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAyCxB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAwJzB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAqF3B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAuCzB,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,eAAe;IAcvB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAyF3B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAiBzB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAmB5B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA+IzB,OAAO,CAAC,kBAAkB;IAc1B;;OAEG;YACW,UAAU;CA8CzB"}
|
|
@@ -13,6 +13,7 @@ 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 { getLine, getColumn } from './ast/utils/location.js';
|
|
16
17
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
18
|
const traverse = traverseModule.default || traverseModule;
|
|
18
19
|
// React event handlers mapping
|
|
@@ -115,6 +116,7 @@ export class ReactAnalyzer extends Plugin {
|
|
|
115
116
|
};
|
|
116
117
|
}
|
|
117
118
|
async execute(context) {
|
|
119
|
+
const logger = this.log(context);
|
|
118
120
|
try {
|
|
119
121
|
const { graph } = context;
|
|
120
122
|
const modules = await this.getModules(graph);
|
|
@@ -141,17 +143,22 @@ export class ReactAnalyzer extends Plugin {
|
|
|
141
143
|
stats.edges += result.edges;
|
|
142
144
|
}
|
|
143
145
|
catch (err) {
|
|
144
|
-
|
|
146
|
+
// Silent - per-module errors shouldn't spam logs
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
|
-
|
|
149
|
+
logger.info('Analysis complete', {
|
|
150
|
+
components: stats.components,
|
|
151
|
+
hooks: stats.hooks,
|
|
152
|
+
events: stats.events,
|
|
153
|
+
issues: stats.issues
|
|
154
|
+
});
|
|
148
155
|
return createSuccessResult({
|
|
149
156
|
nodes: stats.components + stats.hooks + stats.events + stats.browserAPIs + stats.issues,
|
|
150
157
|
edges: stats.edges
|
|
151
158
|
}, stats);
|
|
152
159
|
}
|
|
153
160
|
catch (error) {
|
|
154
|
-
|
|
161
|
+
logger.error('Analysis failed', { error });
|
|
155
162
|
return createErrorResult(error);
|
|
156
163
|
}
|
|
157
164
|
}
|
|
@@ -201,14 +208,13 @@ export class ReactAnalyzer extends Plugin {
|
|
|
201
208
|
if (this.isReactComponent(path)) {
|
|
202
209
|
const node = path.node;
|
|
203
210
|
const name = node.id.name;
|
|
204
|
-
const loc = node.loc;
|
|
205
211
|
const component = {
|
|
206
|
-
id: `react:component#${name}#${filePath}:${
|
|
212
|
+
id: `react:component#${name}#${filePath}:${getLine(node)}`,
|
|
207
213
|
type: 'react:component',
|
|
208
214
|
name,
|
|
209
215
|
file: filePath,
|
|
210
|
-
line:
|
|
211
|
-
column:
|
|
216
|
+
line: getLine(node),
|
|
217
|
+
column: getColumn(node),
|
|
212
218
|
kind: 'arrow'
|
|
213
219
|
};
|
|
214
220
|
analysis.components.push(component);
|
|
@@ -220,14 +226,13 @@ export class ReactAnalyzer extends Plugin {
|
|
|
220
226
|
const name = path.node.id?.name;
|
|
221
227
|
if (!name)
|
|
222
228
|
return;
|
|
223
|
-
const loc = path.node.loc;
|
|
224
229
|
const component = {
|
|
225
|
-
id: `react:component#${name}#${filePath}:${
|
|
230
|
+
id: `react:component#${name}#${filePath}:${getLine(path.node)}`,
|
|
226
231
|
type: 'react:component',
|
|
227
232
|
name,
|
|
228
233
|
file: filePath,
|
|
229
|
-
line:
|
|
230
|
-
column:
|
|
234
|
+
line: getLine(path.node),
|
|
235
|
+
column: getColumn(path.node),
|
|
231
236
|
kind: 'function'
|
|
232
237
|
};
|
|
233
238
|
analysis.components.push(component);
|
|
@@ -315,12 +320,11 @@ export class ReactAnalyzer extends Plugin {
|
|
|
315
320
|
analyzeHook(path, filePath) {
|
|
316
321
|
const callee = path.node.callee;
|
|
317
322
|
const hookName = callee.name;
|
|
318
|
-
const loc = path.node.loc;
|
|
319
323
|
const args = path.node.arguments;
|
|
320
324
|
const hookBase = {
|
|
321
325
|
file: filePath,
|
|
322
|
-
line:
|
|
323
|
-
column:
|
|
326
|
+
line: getLine(path.node),
|
|
327
|
+
column: getColumn(path.node),
|
|
324
328
|
hookName
|
|
325
329
|
};
|
|
326
330
|
switch (hookName) {
|
|
@@ -334,7 +338,7 @@ export class ReactAnalyzer extends Plugin {
|
|
|
334
338
|
const setterName = parent.id.elements[1]?.name;
|
|
335
339
|
const initialValue = args[0];
|
|
336
340
|
return {
|
|
337
|
-
id: `react:state#${stateName}#${filePath}:${
|
|
341
|
+
id: `react:state#${stateName}#${filePath}:${hookBase.line}`,
|
|
338
342
|
type: 'react:state',
|
|
339
343
|
...hookBase,
|
|
340
344
|
stateName,
|
|
@@ -356,7 +360,7 @@ export class ReactAnalyzer extends Plugin {
|
|
|
356
360
|
hookName === 'useLayoutEffect' ? 'react:layout-effect' :
|
|
357
361
|
'react:insertion-effect';
|
|
358
362
|
return {
|
|
359
|
-
id: `${effectType}#${filePath}:${
|
|
363
|
+
id: `${effectType}#${filePath}:${hookBase.line}`,
|
|
360
364
|
type: effectType,
|
|
361
365
|
...hookBase,
|
|
362
366
|
deps,
|
|
@@ -371,7 +375,7 @@ export class ReactAnalyzer extends Plugin {
|
|
|
371
375
|
const depsArg = args[1];
|
|
372
376
|
const deps = this.extractDeps(depsArg);
|
|
373
377
|
return {
|
|
374
|
-
id: `react:callback#${callbackName || 'anonymous'}#${filePath}:${
|
|
378
|
+
id: `react:callback#${callbackName || 'anonymous'}#${filePath}:${hookBase.line}`,
|
|
375
379
|
type: 'react:callback',
|
|
376
380
|
...hookBase,
|
|
377
381
|
callbackName,
|
|
@@ -385,7 +389,7 @@ export class ReactAnalyzer extends Plugin {
|
|
|
385
389
|
const depsArg = args[1];
|
|
386
390
|
const deps = this.extractDeps(depsArg);
|
|
387
391
|
return {
|
|
388
|
-
id: `react:memo#${memoName || 'anonymous'}#${filePath}:${
|
|
392
|
+
id: `react:memo#${memoName || 'anonymous'}#${filePath}:${hookBase.line}`,
|
|
389
393
|
type: 'react:memo',
|
|
390
394
|
...hookBase,
|
|
391
395
|
memoName,
|
|
@@ -398,7 +402,7 @@ export class ReactAnalyzer extends Plugin {
|
|
|
398
402
|
const refName = parent.type === 'VariableDeclarator' ? parent.id?.name : null;
|
|
399
403
|
const initialValue = args[0];
|
|
400
404
|
return {
|
|
401
|
-
id: `react:ref#${refName || 'anonymous'}#${filePath}:${
|
|
405
|
+
id: `react:ref#${refName || 'anonymous'}#${filePath}:${hookBase.line}`,
|
|
402
406
|
type: 'react:ref',
|
|
403
407
|
...hookBase,
|
|
404
408
|
refName,
|
|
@@ -416,7 +420,7 @@ export class ReactAnalyzer extends Plugin {
|
|
|
416
420
|
const reducerArg = args[0];
|
|
417
421
|
const reducerName = reducerArg?.type === 'Identifier' ? reducerArg.name : null;
|
|
418
422
|
return {
|
|
419
|
-
id: `react:reducer#${stateName}#${filePath}:${
|
|
423
|
+
id: `react:reducer#${stateName}#${filePath}:${hookBase.line}`,
|
|
420
424
|
type: 'react:reducer',
|
|
421
425
|
...hookBase,
|
|
422
426
|
stateName,
|
|
@@ -433,7 +437,7 @@ export class ReactAnalyzer extends Plugin {
|
|
|
433
437
|
const contextArg = args[0];
|
|
434
438
|
const contextName = contextArg?.type === 'Identifier' ? contextArg.name : null;
|
|
435
439
|
return {
|
|
436
|
-
id: `react:context-use#${contextName || 'unknown'}#${filePath}:${
|
|
440
|
+
id: `react:context-use#${contextName || 'unknown'}#${filePath}:${hookBase.line}`,
|
|
437
441
|
type: 'react:context-use',
|
|
438
442
|
...hookBase,
|
|
439
443
|
valueName,
|
|
@@ -460,7 +464,7 @@ export class ReactAnalyzer extends Plugin {
|
|
|
460
464
|
}
|
|
461
465
|
}
|
|
462
466
|
return {
|
|
463
|
-
id: `react:imperative-handle#${filePath}:${
|
|
467
|
+
id: `react:imperative-handle#${filePath}:${hookBase.line}`,
|
|
464
468
|
type: 'react:imperative-handle',
|
|
465
469
|
...hookBase,
|
|
466
470
|
refName,
|
|
@@ -776,7 +780,6 @@ export class ReactAnalyzer extends Plugin {
|
|
|
776
780
|
return;
|
|
777
781
|
}
|
|
778
782
|
// This is a React component being rendered
|
|
779
|
-
const loc = openingElement.loc;
|
|
780
783
|
// Find parent component
|
|
781
784
|
let parentComponent = null;
|
|
782
785
|
let parentPath = path.parentPath;
|
|
@@ -799,7 +802,7 @@ export class ReactAnalyzer extends Plugin {
|
|
|
799
802
|
src: `react:component#${parentComponent}`,
|
|
800
803
|
dst: `react:component#${elementName}`,
|
|
801
804
|
file: filePath,
|
|
802
|
-
line:
|
|
805
|
+
line: getLine(openingElement)
|
|
803
806
|
});
|
|
804
807
|
}
|
|
805
808
|
}
|
|
@@ -834,7 +837,6 @@ export class ReactAnalyzer extends Plugin {
|
|
|
834
837
|
if (!attr.name || attr.name.type !== 'JSXIdentifier')
|
|
835
838
|
return;
|
|
836
839
|
const attrName = attr.name.name;
|
|
837
|
-
const loc = attr.loc;
|
|
838
840
|
// Get parent JSX element info first
|
|
839
841
|
const jsxOpeningElement = path.parent;
|
|
840
842
|
let componentName = null;
|
|
@@ -858,13 +860,13 @@ export class ReactAnalyzer extends Plugin {
|
|
|
858
860
|
}
|
|
859
861
|
}
|
|
860
862
|
const event = {
|
|
861
|
-
id: `dom:event#${eventType}#${filePath}:${
|
|
863
|
+
id: `dom:event#${eventType}#${filePath}:${getLine(attr)}`,
|
|
862
864
|
type: 'dom:event',
|
|
863
865
|
eventType,
|
|
864
866
|
reactProp: attrName,
|
|
865
867
|
handler: handlerName,
|
|
866
868
|
file: filePath,
|
|
867
|
-
line:
|
|
869
|
+
line: getLine(attr)
|
|
868
870
|
};
|
|
869
871
|
analysis.events.push(event);
|
|
870
872
|
}
|
|
@@ -909,7 +911,7 @@ export class ReactAnalyzer extends Plugin {
|
|
|
909
911
|
propName: attrName,
|
|
910
912
|
propValue,
|
|
911
913
|
file: filePath,
|
|
912
|
-
line:
|
|
914
|
+
line: getLine(attr)
|
|
913
915
|
});
|
|
914
916
|
}
|
|
915
917
|
}
|
|
@@ -918,17 +920,16 @@ export class ReactAnalyzer extends Plugin {
|
|
|
918
920
|
* Analyze forwardRef usage
|
|
919
921
|
*/
|
|
920
922
|
analyzeForwardRef(path, filePath, analysis) {
|
|
921
|
-
const loc = path.node.loc;
|
|
922
923
|
const parent = path.parent;
|
|
923
924
|
const componentName = parent.type === 'VariableDeclarator' ? parent.id?.name : null;
|
|
924
925
|
if (componentName) {
|
|
925
926
|
analysis.components.push({
|
|
926
|
-
id: `react:component#${componentName}#${filePath}:${
|
|
927
|
+
id: `react:component#${componentName}#${filePath}:${getLine(path.node)}`,
|
|
927
928
|
type: 'react:component',
|
|
928
929
|
name: componentName,
|
|
929
930
|
file: filePath,
|
|
930
|
-
line:
|
|
931
|
-
column:
|
|
931
|
+
line: getLine(path.node),
|
|
932
|
+
column: getColumn(path.node),
|
|
932
933
|
kind: 'forwardRef'
|
|
933
934
|
});
|
|
934
935
|
}
|
|
@@ -937,18 +938,17 @@ export class ReactAnalyzer extends Plugin {
|
|
|
937
938
|
* Analyze createContext usage
|
|
938
939
|
*/
|
|
939
940
|
analyzeCreateContext(path, filePath, analysis) {
|
|
940
|
-
const loc = path.node.loc;
|
|
941
941
|
const parent = path.parent;
|
|
942
942
|
const contextName = parent.type === 'VariableDeclarator' ? parent.id?.name : null;
|
|
943
943
|
if (contextName) {
|
|
944
944
|
const defaultValue = path.node.arguments[0];
|
|
945
945
|
analysis.hooks.push({
|
|
946
|
-
id: `react:context#${contextName}#${filePath}:${
|
|
946
|
+
id: `react:context#${contextName}#${filePath}:${getLine(path.node)}`,
|
|
947
947
|
type: 'react:context',
|
|
948
948
|
contextName,
|
|
949
949
|
file: filePath,
|
|
950
|
-
line:
|
|
951
|
-
column:
|
|
950
|
+
line: getLine(path.node),
|
|
951
|
+
column: getColumn(path.node),
|
|
952
952
|
hookName: 'createContext',
|
|
953
953
|
defaultValue: this.getExpressionValue(defaultValue)
|
|
954
954
|
});
|
|
@@ -959,40 +959,39 @@ export class ReactAnalyzer extends Plugin {
|
|
|
959
959
|
*/
|
|
960
960
|
analyzeBrowserAPI(path, filePath, analysis) {
|
|
961
961
|
const callee = path.node.callee;
|
|
962
|
-
const loc = path.node.loc;
|
|
963
962
|
// Direct function call: setTimeout, fetch, alert
|
|
964
963
|
if (callee.type === 'Identifier') {
|
|
965
964
|
const name = callee.name;
|
|
966
965
|
// Timers
|
|
967
966
|
if (BROWSER_APIS.timers.includes(name)) {
|
|
968
967
|
analysis.browserAPIs.push({
|
|
969
|
-
id: `browser:timer#${name}#${filePath}:${
|
|
968
|
+
id: `browser:timer#${name}#${filePath}:${getLine(path.node)}`,
|
|
970
969
|
type: 'browser:timer',
|
|
971
970
|
api: name,
|
|
972
971
|
file: filePath,
|
|
973
|
-
line:
|
|
972
|
+
line: getLine(path.node)
|
|
974
973
|
});
|
|
975
974
|
return;
|
|
976
975
|
}
|
|
977
976
|
// Blocking APIs
|
|
978
977
|
if (BROWSER_APIS.blocking.includes(name)) {
|
|
979
978
|
analysis.browserAPIs.push({
|
|
980
|
-
id: `browser:blocking#${name}#${filePath}:${
|
|
979
|
+
id: `browser:blocking#${name}#${filePath}:${getLine(path.node)}`,
|
|
981
980
|
type: 'browser:blocking',
|
|
982
981
|
api: name,
|
|
983
982
|
file: filePath,
|
|
984
|
-
line:
|
|
983
|
+
line: getLine(path.node)
|
|
985
984
|
});
|
|
986
985
|
return;
|
|
987
986
|
}
|
|
988
987
|
// Fetch
|
|
989
988
|
if (name === 'fetch') {
|
|
990
989
|
analysis.browserAPIs.push({
|
|
991
|
-
id: `browser:async#fetch#${filePath}:${
|
|
990
|
+
id: `browser:async#fetch#${filePath}:${getLine(path.node)}`,
|
|
992
991
|
type: 'browser:async',
|
|
993
992
|
api: 'fetch',
|
|
994
993
|
file: filePath,
|
|
995
|
-
line:
|
|
994
|
+
line: getLine(path.node)
|
|
996
995
|
});
|
|
997
996
|
return;
|
|
998
997
|
}
|
|
@@ -1007,12 +1006,12 @@ export class ReactAnalyzer extends Plugin {
|
|
|
1007
1006
|
method === 'setItem' ? 'write' :
|
|
1008
1007
|
method === 'removeItem' ? 'delete' : method;
|
|
1009
1008
|
analysis.browserAPIs.push({
|
|
1010
|
-
id: `browser:storage#${storage}:${operation}#${filePath}:${
|
|
1009
|
+
id: `browser:storage#${storage}:${operation}#${filePath}:${getLine(path.node)}`,
|
|
1011
1010
|
type: 'browser:storage',
|
|
1012
1011
|
storage,
|
|
1013
1012
|
operation,
|
|
1014
1013
|
file: filePath,
|
|
1015
|
-
line:
|
|
1014
|
+
line: getLine(path.node)
|
|
1016
1015
|
});
|
|
1017
1016
|
return;
|
|
1018
1017
|
}
|
|
@@ -1020,45 +1019,45 @@ export class ReactAnalyzer extends Plugin {
|
|
|
1020
1019
|
if (fullName.startsWith('document.') &&
|
|
1021
1020
|
(fullName.includes('querySelector') || fullName.includes('getElementById'))) {
|
|
1022
1021
|
analysis.browserAPIs.push({
|
|
1023
|
-
id: `browser:dom#query#${filePath}:${
|
|
1022
|
+
id: `browser:dom#query#${filePath}:${getLine(path.node)}`,
|
|
1024
1023
|
type: 'browser:dom',
|
|
1025
1024
|
operation: 'query',
|
|
1026
1025
|
api: fullName,
|
|
1027
1026
|
file: filePath,
|
|
1028
|
-
line:
|
|
1027
|
+
line: getLine(path.node)
|
|
1029
1028
|
});
|
|
1030
1029
|
return;
|
|
1031
1030
|
}
|
|
1032
1031
|
// History API
|
|
1033
1032
|
if (fullName.startsWith('history.') || fullName.startsWith('window.history.')) {
|
|
1034
1033
|
analysis.browserAPIs.push({
|
|
1035
|
-
id: `browser:history#${filePath}:${
|
|
1034
|
+
id: `browser:history#${filePath}:${getLine(path.node)}`,
|
|
1036
1035
|
type: 'browser:history',
|
|
1037
1036
|
api: fullName,
|
|
1038
1037
|
file: filePath,
|
|
1039
|
-
line:
|
|
1038
|
+
line: getLine(path.node)
|
|
1040
1039
|
});
|
|
1041
1040
|
return;
|
|
1042
1041
|
}
|
|
1043
1042
|
// Clipboard API
|
|
1044
1043
|
if (fullName.includes('clipboard')) {
|
|
1045
1044
|
analysis.browserAPIs.push({
|
|
1046
|
-
id: `browser:clipboard#${filePath}:${
|
|
1045
|
+
id: `browser:clipboard#${filePath}:${getLine(path.node)}`,
|
|
1047
1046
|
type: 'browser:clipboard',
|
|
1048
1047
|
api: fullName,
|
|
1049
1048
|
file: filePath,
|
|
1050
|
-
line:
|
|
1049
|
+
line: getLine(path.node)
|
|
1051
1050
|
});
|
|
1052
1051
|
return;
|
|
1053
1052
|
}
|
|
1054
1053
|
// Geolocation
|
|
1055
1054
|
if (fullName.includes('geolocation')) {
|
|
1056
1055
|
analysis.browserAPIs.push({
|
|
1057
|
-
id: `browser:geolocation#${filePath}:${
|
|
1056
|
+
id: `browser:geolocation#${filePath}:${getLine(path.node)}`,
|
|
1058
1057
|
type: 'browser:geolocation',
|
|
1059
1058
|
api: fullName,
|
|
1060
1059
|
file: filePath,
|
|
1061
|
-
line:
|
|
1060
|
+
line: getLine(path.node)
|
|
1062
1061
|
});
|
|
1063
1062
|
return;
|
|
1064
1063
|
}
|
|
@@ -1066,22 +1065,22 @@ export class ReactAnalyzer extends Plugin {
|
|
|
1066
1065
|
if (fullName.match(/\.(fillRect|strokeRect|fillText|strokeText|beginPath|closePath|moveTo|lineTo|arc|fill|stroke|clearRect|drawImage|save|restore|translate|rotate|scale)$/)) {
|
|
1067
1066
|
const method = fullName.split('.').pop();
|
|
1068
1067
|
analysis.browserAPIs.push({
|
|
1069
|
-
id: `canvas:draw#${method}#${filePath}:${
|
|
1068
|
+
id: `canvas:draw#${method}#${filePath}:${getLine(path.node)}`,
|
|
1070
1069
|
type: 'canvas:draw',
|
|
1071
1070
|
method,
|
|
1072
1071
|
file: filePath,
|
|
1073
|
-
line:
|
|
1072
|
+
line: getLine(path.node)
|
|
1074
1073
|
});
|
|
1075
1074
|
return;
|
|
1076
1075
|
}
|
|
1077
1076
|
// matchMedia
|
|
1078
1077
|
if (fullName === 'window.matchMedia' || fullName === 'matchMedia') {
|
|
1079
1078
|
analysis.browserAPIs.push({
|
|
1080
|
-
id: `browser:media-query#${filePath}:${
|
|
1079
|
+
id: `browser:media-query#${filePath}:${getLine(path.node)}`,
|
|
1081
1080
|
type: 'browser:media-query',
|
|
1082
1081
|
api: 'matchMedia',
|
|
1083
1082
|
file: filePath,
|
|
1084
|
-
line:
|
|
1083
|
+
line: getLine(path.node)
|
|
1085
1084
|
});
|
|
1086
1085
|
return;
|
|
1087
1086
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RustAnalyzer.d.ts","sourceRoot":"","sources":["../../../src/plugins/analysis/RustAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,MAAM,EAA0C,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"RustAnalyzer.d.ts","sourceRoot":"","sources":["../../../src/plugins/analysis/RustAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,MAAM,EAA0C,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAuJhF,qBAAa,YAAa,SAAQ,MAAM;IACtC,IAAI,QAAQ,IAAI,cAAc,CAkB7B;IAEK,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;YAgF9C,kBAAkB;CAsLjC"}
|
|
@@ -8,9 +8,10 @@ import { Plugin, createSuccessResult } from '../Plugin.js';
|
|
|
8
8
|
// NAPI binding - will be exported from rust-engine after build
|
|
9
9
|
let parseRustFile;
|
|
10
10
|
// Try to load the native binding
|
|
11
|
+
// Path: from dist/plugins/analysis/ go up 5 levels to reach project root, then rust-engine/
|
|
11
12
|
try {
|
|
12
13
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
-
const nativeBinding = await import('
|
|
14
|
+
const nativeBinding = await import('../../../../../rust-engine/grafema-graph-engine.node');
|
|
14
15
|
parseRustFile = nativeBinding.parseRustFile;
|
|
15
16
|
}
|
|
16
17
|
catch {
|
|
@@ -18,11 +19,11 @@ catch {
|
|
|
18
19
|
try {
|
|
19
20
|
const { createRequire } = await import('module');
|
|
20
21
|
const require = createRequire(import.meta.url);
|
|
21
|
-
const nativeBinding = require('
|
|
22
|
+
const nativeBinding = require('../../../../../rust-engine/grafema-graph-engine.node');
|
|
22
23
|
parseRustFile = nativeBinding.parseRustFile;
|
|
23
24
|
}
|
|
24
|
-
catch
|
|
25
|
-
|
|
25
|
+
catch {
|
|
26
|
+
// Silent - will be reported during execute if needed
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
export class RustAnalyzer extends Plugin {
|
|
@@ -47,8 +48,9 @@ export class RustAnalyzer extends Plugin {
|
|
|
47
48
|
}
|
|
48
49
|
async execute(context) {
|
|
49
50
|
const { graph, onProgress } = context;
|
|
51
|
+
const logger = this.log(context);
|
|
50
52
|
if (!parseRustFile) {
|
|
51
|
-
|
|
53
|
+
logger.info('Skipping - native binding not available');
|
|
52
54
|
return createSuccessResult({ nodes: 0, edges: 0 }, { skipped: true, reason: 'Native binding not available' });
|
|
53
55
|
}
|
|
54
56
|
// Get all RUST_MODULE nodes
|
|
@@ -57,10 +59,10 @@ export class RustAnalyzer extends Plugin {
|
|
|
57
59
|
modules.push(node);
|
|
58
60
|
}
|
|
59
61
|
if (modules.length === 0) {
|
|
60
|
-
|
|
62
|
+
logger.info('No RUST_MODULE nodes found, skipping');
|
|
61
63
|
return createSuccessResult({ nodes: 0, edges: 0 }, { skipped: true, reason: 'No modules' });
|
|
62
64
|
}
|
|
63
|
-
|
|
65
|
+
logger.info('Analyzing Rust modules', { count: modules.length });
|
|
64
66
|
const stats = {
|
|
65
67
|
functions: 0,
|
|
66
68
|
structs: 0,
|
|
@@ -96,13 +98,16 @@ export class RustAnalyzer extends Plugin {
|
|
|
96
98
|
}
|
|
97
99
|
catch (err) {
|
|
98
100
|
errors.push({ file: module.file, error: err.message });
|
|
99
|
-
|
|
101
|
+
logger.warn('Error parsing module', {
|
|
102
|
+
file: module.file,
|
|
103
|
+
error: err.message
|
|
104
|
+
});
|
|
100
105
|
}
|
|
101
106
|
}
|
|
102
107
|
if (errors.length > 0) {
|
|
103
|
-
|
|
108
|
+
logger.warn('Analysis completed with errors', { errorCount: errors.length });
|
|
104
109
|
}
|
|
105
|
-
|
|
110
|
+
logger.info('Analysis complete', { ...stats });
|
|
106
111
|
return createSuccessResult({ nodes: stats.functions + stats.structs + stats.impls + stats.methods + stats.traits + stats.calls, edges: stats.edges }, { ...stats, errors: errors.length });
|
|
107
112
|
}
|
|
108
113
|
async processParseResult(parseResult, module, graph) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SQLiteAnalyzer.d.ts","sourceRoot":"","sources":["../../../src/plugins/analysis/SQLiteAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,OAAO,EAAE,MAAM,EAA0C,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"SQLiteAnalyzer.d.ts","sourceRoot":"","sources":["../../../src/plugins/analysis/SQLiteAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,OAAO,EAAE,MAAM,EAA0C,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAkChF,qBAAa,cAAe,SAAQ,MAAM;IACxC,IAAI,QAAQ,IAAI,cAAc,CAW7B;IAEK,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;YAiC9C,aAAa;IAiO3B,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,sBAAsB;IAY9B,OAAO,CAAC,mBAAmB;IAY3B,OAAO,CAAC,gBAAgB;CAiCzB"}
|
|
@@ -11,6 +11,7 @@ import { readFileSync } from 'fs';
|
|
|
11
11
|
import { parse } from '@babel/parser';
|
|
12
12
|
import traverseModule from '@babel/traverse';
|
|
13
13
|
import { Plugin, createSuccessResult, createErrorResult } from '../Plugin.js';
|
|
14
|
+
import { getLine } from './ast/utils/location.js';
|
|
14
15
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
16
|
const traverse = traverseModule.default || traverseModule;
|
|
16
17
|
const SQLITE_METHODS = ['all', 'get', 'run', 'exec', 'prepare', 'query', 'execute'];
|
|
@@ -28,6 +29,7 @@ export class SQLiteAnalyzer extends Plugin {
|
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
31
|
async execute(context) {
|
|
32
|
+
const logger = this.log(context);
|
|
31
33
|
try {
|
|
32
34
|
const { graph } = context;
|
|
33
35
|
// Получаем все MODULE ноды
|
|
@@ -42,11 +44,11 @@ export class SQLiteAnalyzer extends Plugin {
|
|
|
42
44
|
operationsCreated += result.operations;
|
|
43
45
|
edgesCreated += result.edges;
|
|
44
46
|
}
|
|
45
|
-
|
|
47
|
+
logger.info('Analysis complete', { queriesCreated, operationsCreated });
|
|
46
48
|
return createSuccessResult({ nodes: queriesCreated + operationsCreated, edges: edgesCreated }, { modulesAnalyzed: modules.length, queries: queriesCreated, operations: operationsCreated });
|
|
47
49
|
}
|
|
48
50
|
catch (error) {
|
|
49
|
-
|
|
51
|
+
logger.error('Analysis failed', { error });
|
|
50
52
|
return createErrorResult(error);
|
|
51
53
|
}
|
|
52
54
|
}
|
|
@@ -112,7 +114,7 @@ export class SQLiteAnalyzer extends Plugin {
|
|
|
112
114
|
// Определяем тип операции из SQL
|
|
113
115
|
const operationType = this.detectOperationType(query);
|
|
114
116
|
const tableName = this.extractTableName(query, operationType);
|
|
115
|
-
const queryId = `${module.file}:DATABASE_QUERY:${method}:${node
|
|
117
|
+
const queryId = `${module.file}:DATABASE_QUERY:${method}:${getLine(node)}`;
|
|
116
118
|
queries.push({
|
|
117
119
|
id: queryId,
|
|
118
120
|
type: 'db:query',
|
|
@@ -122,7 +124,7 @@ export class SQLiteAnalyzer extends Plugin {
|
|
|
122
124
|
operationType: operationType,
|
|
123
125
|
tableName: tableName,
|
|
124
126
|
file: module.file,
|
|
125
|
-
line: node
|
|
127
|
+
line: getLine(node)
|
|
126
128
|
});
|
|
127
129
|
}
|
|
128
130
|
}
|
|
@@ -174,7 +176,7 @@ export class SQLiteAnalyzer extends Plugin {
|
|
|
174
176
|
if (query) {
|
|
175
177
|
const operationType = this.detectOperationType(query);
|
|
176
178
|
const tableName = this.extractTableName(query, operationType);
|
|
177
|
-
const queryId = `${module.file}:DATABASE_QUERY:${method}:${innerNode
|
|
179
|
+
const queryId = `${module.file}:DATABASE_QUERY:${method}:${getLine(innerNode)}`;
|
|
178
180
|
queries.push({
|
|
179
181
|
id: queryId,
|
|
180
182
|
type: 'db:query',
|
|
@@ -184,7 +186,7 @@ export class SQLiteAnalyzer extends Plugin {
|
|
|
184
186
|
operationType: operationType,
|
|
185
187
|
tableName: tableName,
|
|
186
188
|
file: module.file,
|
|
187
|
-
line: innerNode
|
|
189
|
+
line: getLine(innerNode),
|
|
188
190
|
promiseWrapped: true
|
|
189
191
|
});
|
|
190
192
|
}
|
|
@@ -232,7 +234,7 @@ export class SQLiteAnalyzer extends Plugin {
|
|
|
232
234
|
}
|
|
233
235
|
}
|
|
234
236
|
catch (error) {
|
|
235
|
-
|
|
237
|
+
// Silent - per-module errors shouldn't spam logs
|
|
236
238
|
}
|
|
237
239
|
return {
|
|
238
240
|
queries: queriesCreated,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceLayerAnalyzer.d.ts","sourceRoot":"","sources":["../../../src/plugins/analysis/ServiceLayerAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAcH,OAAO,EAAE,MAAM,EAA0C,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ServiceLayerAnalyzer.d.ts","sourceRoot":"","sources":["../../../src/plugins/analysis/ServiceLayerAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAcH,OAAO,EAAE,MAAM,EAA0C,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AA+DhF,qBAAa,oBAAqB,SAAQ,MAAM;IAC9C,IAAI,QAAQ,IAAI,cAAc,CAW7B;IAEK,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;YA8D9C,aAAa;IAmN3B;;;OAGG;IACH,OAAO,CAAC,cAAc;IAStB;;OAEG;IACH,OAAO,CAAC,aAAa;IAWrB;;OAEG;IACH,OAAO,CAAC,cAAc;IAatB;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAczB"}
|