@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
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Glob Resolver for Workspace Packages
|
|
3
|
+
*
|
|
4
|
+
* Resolves workspace glob patterns to actual directories containing package.json.
|
|
5
|
+
* Uses minimatch for pattern matching.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { readdirSync, statSync, existsSync, readFileSync, lstatSync } from 'fs';
|
|
9
|
+
import { join, relative } from 'path';
|
|
10
|
+
import { minimatch } from 'minimatch';
|
|
11
|
+
import type { WorkspaceConfig } from './parsers.js';
|
|
12
|
+
|
|
13
|
+
export interface WorkspacePackage {
|
|
14
|
+
path: string;
|
|
15
|
+
name: string;
|
|
16
|
+
relativePath: string;
|
|
17
|
+
packageJson: PackageJson;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface PackageJson {
|
|
21
|
+
name?: string;
|
|
22
|
+
version?: string;
|
|
23
|
+
main?: string;
|
|
24
|
+
source?: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
private?: boolean;
|
|
27
|
+
dependencies?: Record<string, string>;
|
|
28
|
+
devDependencies?: Record<string, string>;
|
|
29
|
+
[key: string]: unknown;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Resolve workspace glob patterns to actual packages.
|
|
34
|
+
* Only directories with package.json are considered valid packages.
|
|
35
|
+
*
|
|
36
|
+
* @param projectPath - Root directory of the project
|
|
37
|
+
* @param config - Parsed workspace config with patterns and negativePatterns
|
|
38
|
+
* @returns Array of resolved workspace packages
|
|
39
|
+
*/
|
|
40
|
+
export function resolveWorkspacePackages(
|
|
41
|
+
projectPath: string,
|
|
42
|
+
config: WorkspaceConfig
|
|
43
|
+
): WorkspacePackage[] {
|
|
44
|
+
const packages: WorkspacePackage[] = [];
|
|
45
|
+
const seen = new Set<string>();
|
|
46
|
+
|
|
47
|
+
// Expand all positive patterns
|
|
48
|
+
for (const pattern of config.patterns) {
|
|
49
|
+
const matches = expandGlob(projectPath, pattern);
|
|
50
|
+
|
|
51
|
+
for (const dir of matches) {
|
|
52
|
+
// Check for package.json
|
|
53
|
+
const pkgJsonPath = join(dir, 'package.json');
|
|
54
|
+
if (!existsSync(pkgJsonPath)) continue;
|
|
55
|
+
|
|
56
|
+
// Check negative patterns
|
|
57
|
+
const relPath = relative(projectPath, dir);
|
|
58
|
+
if (config.negativePatterns.some(neg => matchesPattern(relPath, neg))) continue;
|
|
59
|
+
|
|
60
|
+
// Avoid duplicates
|
|
61
|
+
if (seen.has(dir)) continue;
|
|
62
|
+
seen.add(dir);
|
|
63
|
+
|
|
64
|
+
// Parse package.json
|
|
65
|
+
let pkgJson: PackageJson;
|
|
66
|
+
try {
|
|
67
|
+
pkgJson = JSON.parse(readFileSync(pkgJsonPath, 'utf-8'));
|
|
68
|
+
} catch {
|
|
69
|
+
// Skip malformed package.json
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
packages.push({
|
|
74
|
+
path: dir,
|
|
75
|
+
name: pkgJson.name || relPath.split('/').pop() || relPath,
|
|
76
|
+
relativePath: relPath,
|
|
77
|
+
packageJson: pkgJson
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return packages;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Check if path matches pattern using minimatch.
|
|
87
|
+
* Normalizes path separators for cross-platform compatibility.
|
|
88
|
+
*/
|
|
89
|
+
function matchesPattern(path: string, pattern: string): boolean {
|
|
90
|
+
// Normalize path separators
|
|
91
|
+
const normalizedPath = path.replace(/\\/g, '/');
|
|
92
|
+
const normalizedPattern = pattern.replace(/\\/g, '/');
|
|
93
|
+
return minimatch(normalizedPath, normalizedPattern);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Expand glob pattern to actual directories.
|
|
98
|
+
*/
|
|
99
|
+
function expandGlob(basePath: string, pattern: string): string[] {
|
|
100
|
+
// Handle literal path (no wildcards)
|
|
101
|
+
if (!pattern.includes('*')) {
|
|
102
|
+
const fullPath = join(basePath, pattern);
|
|
103
|
+
if (existsSync(fullPath) && isDirectory(fullPath)) {
|
|
104
|
+
return [fullPath];
|
|
105
|
+
}
|
|
106
|
+
return [];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Handle recursive glob (**)
|
|
110
|
+
if (pattern.includes('**')) {
|
|
111
|
+
return expandRecursiveGlob(basePath, pattern);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Handle simple glob (packages/*)
|
|
115
|
+
return expandSimpleGlob(basePath, pattern);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Expand simple glob like "packages/*" or "apps/*".
|
|
120
|
+
*/
|
|
121
|
+
function expandSimpleGlob(basePath: string, pattern: string): string[] {
|
|
122
|
+
const parts = pattern.split('/');
|
|
123
|
+
const results: string[] = [];
|
|
124
|
+
|
|
125
|
+
// Find the first part with a wildcard
|
|
126
|
+
let currentPath = basePath;
|
|
127
|
+
let patternIndex = 0;
|
|
128
|
+
|
|
129
|
+
// Navigate to the parent directory of the glob
|
|
130
|
+
while (patternIndex < parts.length - 1) {
|
|
131
|
+
currentPath = join(currentPath, parts[patternIndex]);
|
|
132
|
+
patternIndex++;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// The last part contains the wildcard
|
|
136
|
+
const globPart = parts[patternIndex];
|
|
137
|
+
|
|
138
|
+
if (!existsSync(currentPath)) {
|
|
139
|
+
return [];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
try {
|
|
143
|
+
const entries = readdirSync(currentPath);
|
|
144
|
+
for (const entry of entries) {
|
|
145
|
+
if (minimatch(entry, globPart)) {
|
|
146
|
+
const fullPath = join(currentPath, entry);
|
|
147
|
+
if (isDirectory(fullPath)) {
|
|
148
|
+
results.push(fullPath);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
} catch {
|
|
153
|
+
// Ignore permission errors
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return results;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Expand recursive glob like "apps/**" or "libs/**".
|
|
161
|
+
* Recursively walks directories and matches against pattern.
|
|
162
|
+
*/
|
|
163
|
+
function expandRecursiveGlob(basePath: string, pattern: string): string[] {
|
|
164
|
+
const results: string[] = [];
|
|
165
|
+
const maxDepth = 10; // Safety limit
|
|
166
|
+
|
|
167
|
+
function walk(dir: string, depth: number): void {
|
|
168
|
+
if (depth > maxDepth) return;
|
|
169
|
+
|
|
170
|
+
try {
|
|
171
|
+
const entries = readdirSync(dir);
|
|
172
|
+
|
|
173
|
+
for (const entry of entries) {
|
|
174
|
+
// Skip hidden directories and node_modules
|
|
175
|
+
if (entry.startsWith('.') || entry === 'node_modules') continue;
|
|
176
|
+
|
|
177
|
+
const fullPath = join(dir, entry);
|
|
178
|
+
|
|
179
|
+
// Skip symlinks to avoid infinite loops
|
|
180
|
+
if (!isDirectory(fullPath)) continue;
|
|
181
|
+
|
|
182
|
+
const relPath = relative(basePath, fullPath);
|
|
183
|
+
|
|
184
|
+
// Check if this directory matches the pattern
|
|
185
|
+
if (minimatch(relPath, pattern, { dot: false })) {
|
|
186
|
+
results.push(fullPath);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Continue walking regardless of match (** can match at any depth)
|
|
190
|
+
walk(fullPath, depth + 1);
|
|
191
|
+
}
|
|
192
|
+
} catch {
|
|
193
|
+
// Ignore permission errors
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Start walking from pattern prefix or base
|
|
198
|
+
const parts = pattern.split('**');
|
|
199
|
+
const prefix = parts[0].replace(/\/$/, ''); // Remove trailing slash
|
|
200
|
+
|
|
201
|
+
if (prefix) {
|
|
202
|
+
const startPath = join(basePath, prefix);
|
|
203
|
+
if (existsSync(startPath) && isDirectory(startPath)) {
|
|
204
|
+
// Check if the start path itself matches
|
|
205
|
+
const relPath = relative(basePath, startPath);
|
|
206
|
+
if (minimatch(relPath, pattern, { dot: false })) {
|
|
207
|
+
results.push(startPath);
|
|
208
|
+
}
|
|
209
|
+
walk(startPath, 0);
|
|
210
|
+
}
|
|
211
|
+
} else {
|
|
212
|
+
walk(basePath, 0);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return results;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Check if path is a directory (not following symlinks).
|
|
220
|
+
*/
|
|
221
|
+
function isDirectory(path: string): boolean {
|
|
222
|
+
try {
|
|
223
|
+
const stat = lstatSync(path);
|
|
224
|
+
// Return true for real directories, false for symlinks
|
|
225
|
+
return stat.isDirectory() && !stat.isSymbolicLink();
|
|
226
|
+
} catch {
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace Detection and Resolution
|
|
3
|
+
*
|
|
4
|
+
* Exports utilities for detecting workspace types and resolving workspace packages.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
detectWorkspaceType,
|
|
9
|
+
type WorkspaceType,
|
|
10
|
+
type WorkspaceDetectionResult
|
|
11
|
+
} from './detector.js';
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
parsePnpmWorkspace,
|
|
15
|
+
parseNpmWorkspace,
|
|
16
|
+
parseLernaConfig,
|
|
17
|
+
type WorkspaceConfig
|
|
18
|
+
} from './parsers.js';
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
resolveWorkspacePackages,
|
|
22
|
+
type WorkspacePackage
|
|
23
|
+
} from './globResolver.js';
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace Config Parsers
|
|
3
|
+
*
|
|
4
|
+
* Parse workspace configuration files and extract glob patterns.
|
|
5
|
+
* Supports pnpm-workspace.yaml, package.json workspaces, and lerna.json.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { readFileSync } from 'fs';
|
|
9
|
+
import { parse as parseYaml } from 'yaml';
|
|
10
|
+
|
|
11
|
+
export interface WorkspaceConfig {
|
|
12
|
+
patterns: string[];
|
|
13
|
+
negativePatterns: string[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Parse pnpm-workspace.yaml
|
|
18
|
+
*
|
|
19
|
+
* Format:
|
|
20
|
+
* packages:
|
|
21
|
+
* - 'packages/*'
|
|
22
|
+
* - 'apps/**'
|
|
23
|
+
* - '!packages/internal'
|
|
24
|
+
*/
|
|
25
|
+
export function parsePnpmWorkspace(configPath: string): WorkspaceConfig {
|
|
26
|
+
const content = readFileSync(configPath, 'utf-8');
|
|
27
|
+
const config = parseYaml(content) as { packages?: string[] };
|
|
28
|
+
|
|
29
|
+
const patterns: string[] = [];
|
|
30
|
+
const negativePatterns: string[] = [];
|
|
31
|
+
|
|
32
|
+
for (const pattern of config.packages || []) {
|
|
33
|
+
if (pattern.startsWith('!')) {
|
|
34
|
+
negativePatterns.push(pattern.slice(1));
|
|
35
|
+
} else {
|
|
36
|
+
patterns.push(pattern);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return { patterns, negativePatterns };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Parse npm/yarn workspaces from package.json
|
|
45
|
+
*
|
|
46
|
+
* Formats:
|
|
47
|
+
* - Array: { "workspaces": ["packages/*", "apps/**"] }
|
|
48
|
+
* - Object (yarn): { "workspaces": { "packages": ["packages/*"], "nohoist": [...] } }
|
|
49
|
+
*/
|
|
50
|
+
export function parseNpmWorkspace(packageJsonPath: string): WorkspaceConfig {
|
|
51
|
+
const content = readFileSync(packageJsonPath, 'utf-8');
|
|
52
|
+
const pkg = JSON.parse(content) as {
|
|
53
|
+
workspaces?: string[] | { packages?: string[] };
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
let workspaces: string[] = [];
|
|
57
|
+
|
|
58
|
+
if (Array.isArray(pkg.workspaces)) {
|
|
59
|
+
workspaces = pkg.workspaces;
|
|
60
|
+
} else if (pkg.workspaces?.packages) {
|
|
61
|
+
workspaces = pkg.workspaces.packages;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const patterns: string[] = [];
|
|
65
|
+
const negativePatterns: string[] = [];
|
|
66
|
+
|
|
67
|
+
for (const pattern of workspaces) {
|
|
68
|
+
if (pattern.startsWith('!')) {
|
|
69
|
+
negativePatterns.push(pattern.slice(1));
|
|
70
|
+
} else {
|
|
71
|
+
patterns.push(pattern);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return { patterns, negativePatterns };
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Parse lerna.json
|
|
80
|
+
*
|
|
81
|
+
* Format:
|
|
82
|
+
* { "packages": ["packages/*", "components/*"] }
|
|
83
|
+
*
|
|
84
|
+
* Default: ["packages/*"] if packages field is missing
|
|
85
|
+
*/
|
|
86
|
+
export function parseLernaConfig(lernaJsonPath: string): WorkspaceConfig {
|
|
87
|
+
const content = readFileSync(lernaJsonPath, 'utf-8');
|
|
88
|
+
const config = JSON.parse(content) as { packages?: string[] };
|
|
89
|
+
|
|
90
|
+
// Lerna defaults to packages/* if not specified
|
|
91
|
+
const packages = config.packages ?? ['packages/*'];
|
|
92
|
+
|
|
93
|
+
// Return empty if explicitly set to empty array
|
|
94
|
+
if (packages.length === 0) {
|
|
95
|
+
return { patterns: [], negativePatterns: [] };
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return { patterns: packages, negativePatterns: [] };
|
|
99
|
+
}
|
|
@@ -80,8 +80,9 @@ export class AliasTracker extends Plugin {
|
|
|
80
80
|
|
|
81
81
|
async execute(context: PluginContext): Promise<PluginResult> {
|
|
82
82
|
const { graph, onProgress } = context;
|
|
83
|
+
const logger = this.log(context);
|
|
83
84
|
|
|
84
|
-
|
|
85
|
+
logger.info('Starting alias resolution');
|
|
85
86
|
|
|
86
87
|
let callsProcessed = 0;
|
|
87
88
|
let aliasesFound = 0;
|
|
@@ -105,11 +106,11 @@ export class AliasTracker extends Plugin {
|
|
|
105
106
|
unresolvedCalls.push(callNode);
|
|
106
107
|
}
|
|
107
108
|
|
|
108
|
-
|
|
109
|
+
logger.info('Found unresolved call sites', { count: unresolvedCalls.length });
|
|
109
110
|
|
|
110
111
|
// 2. Строим индекс алиасов: variableName -> EXPRESSION info
|
|
111
112
|
const aliasIndex = await this.buildAliasIndex(graph);
|
|
112
|
-
|
|
113
|
+
logger.debug('Found potential aliases', { count: aliasIndex.size });
|
|
113
114
|
|
|
114
115
|
// 3. Строим индекс методов для резолвинга
|
|
115
116
|
const methodIndex = await this.buildMethodIndex(graph);
|
|
@@ -182,13 +183,18 @@ export class AliasTracker extends Plugin {
|
|
|
182
183
|
|
|
183
184
|
// Алярм если были превышения глубины
|
|
184
185
|
if (this.depthExceeded.length > 0) {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
186
|
+
logger.warn('Alias chains exceeded max depth', {
|
|
187
|
+
count: this.depthExceeded.length,
|
|
188
|
+
maxDepth: AliasTracker.MAX_DEPTH,
|
|
189
|
+
examples: this.depthExceeded.slice(0, 5).map(info => ({
|
|
190
|
+
file: info.file,
|
|
191
|
+
name: info.name,
|
|
192
|
+
chain: info.chain.join(' → ')
|
|
193
|
+
}))
|
|
194
|
+
});
|
|
189
195
|
}
|
|
190
196
|
|
|
191
|
-
|
|
197
|
+
logger.info('Summary', summary);
|
|
192
198
|
|
|
193
199
|
return createSuccessResult({ nodes: 0, edges: edgesCreated }, summary);
|
|
194
200
|
}
|
|
@@ -56,6 +56,7 @@ export class HTTPConnectionEnricher extends Plugin {
|
|
|
56
56
|
|
|
57
57
|
async execute(context: PluginContext): Promise<PluginResult> {
|
|
58
58
|
const { graph } = context;
|
|
59
|
+
const logger = this.log(context);
|
|
59
60
|
|
|
60
61
|
try {
|
|
61
62
|
// Собираем все http:route (backend endpoints)
|
|
@@ -70,13 +71,19 @@ export class HTTPConnectionEnricher extends Plugin {
|
|
|
70
71
|
requests.push(node as HTTPRequestNode);
|
|
71
72
|
}
|
|
72
73
|
|
|
73
|
-
|
|
74
|
+
logger.debug('Found routes and requests', {
|
|
75
|
+
routes: routes.length,
|
|
76
|
+
requests: requests.length
|
|
77
|
+
});
|
|
74
78
|
|
|
75
79
|
// Дедуплицируем по ID (из-за multi-service анализа)
|
|
76
80
|
const uniqueRoutes = this.deduplicateById(routes);
|
|
77
81
|
const uniqueRequests = this.deduplicateById(requests);
|
|
78
82
|
|
|
79
|
-
|
|
83
|
+
logger.info('Unique routes and requests', {
|
|
84
|
+
routes: uniqueRoutes.length,
|
|
85
|
+
requests: uniqueRequests.length
|
|
86
|
+
});
|
|
80
87
|
|
|
81
88
|
let edgesCreated = 0;
|
|
82
89
|
const connections: ConnectionInfo[] = [];
|
|
@@ -120,10 +127,10 @@ export class HTTPConnectionEnricher extends Plugin {
|
|
|
120
127
|
|
|
121
128
|
// Логируем найденные связи
|
|
122
129
|
if (connections.length > 0) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
130
|
+
logger.info('Connections found', {
|
|
131
|
+
count: connections.length,
|
|
132
|
+
examples: connections.slice(0, 5).map(c => `${c.request} → ${c.route}`)
|
|
133
|
+
});
|
|
127
134
|
}
|
|
128
135
|
|
|
129
136
|
return createSuccessResult(
|
|
@@ -136,7 +143,7 @@ export class HTTPConnectionEnricher extends Plugin {
|
|
|
136
143
|
);
|
|
137
144
|
|
|
138
145
|
} catch (error) {
|
|
139
|
-
|
|
146
|
+
logger.error('Error in HTTPConnectionEnricher', { error });
|
|
140
147
|
return createErrorResult(error instanceof Error ? error : new Error(String(error)));
|
|
141
148
|
}
|
|
142
149
|
}
|
|
@@ -42,7 +42,7 @@ export class ImportExportLinker extends Plugin {
|
|
|
42
42
|
priority: 90, // Run early in enrichment, after analysis
|
|
43
43
|
creates: {
|
|
44
44
|
nodes: [],
|
|
45
|
-
edges: ['IMPORTS_FROM']
|
|
45
|
+
edges: ['IMPORTS', 'IMPORTS_FROM']
|
|
46
46
|
},
|
|
47
47
|
dependencies: ['JSASTAnalyzer'] // Requires IMPORT and EXPORT nodes
|
|
48
48
|
};
|
|
@@ -50,26 +50,27 @@ export class ImportExportLinker extends Plugin {
|
|
|
50
50
|
|
|
51
51
|
async execute(context: PluginContext): Promise<PluginResult> {
|
|
52
52
|
const { graph, onProgress } = context;
|
|
53
|
+
const logger = this.log(context);
|
|
53
54
|
|
|
54
|
-
|
|
55
|
+
logger.info('Starting import-export linking');
|
|
55
56
|
|
|
56
57
|
const startTime = Date.now();
|
|
57
58
|
|
|
58
59
|
// Step 1: Build EXPORT index - Map<file, Map<exportKey, exportNode>>
|
|
59
60
|
const exportIndex = await this.buildExportIndex(graph);
|
|
60
61
|
const indexTime = Date.now() - startTime;
|
|
61
|
-
|
|
62
|
+
logger.debug('Indexed exports', { files: exportIndex.size, time: `${indexTime}ms` });
|
|
62
63
|
|
|
63
64
|
// Step 2: Build MODULE lookup - Map<file, moduleNode>
|
|
64
65
|
const modulesByFile = await this.buildModuleLookup(graph);
|
|
65
|
-
|
|
66
|
+
logger.debug('Indexed modules', { count: modulesByFile.size });
|
|
66
67
|
|
|
67
68
|
// Step 3: Process all IMPORT nodes
|
|
68
69
|
const imports: ImportNode[] = [];
|
|
69
70
|
for await (const node of graph.queryNodes({ nodeType: 'IMPORT' })) {
|
|
70
71
|
imports.push(node as ImportNode);
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
+
logger.info('Found imports to link', { count: imports.length });
|
|
73
74
|
|
|
74
75
|
let edgesCreated = 0;
|
|
75
76
|
let skipped = 0;
|
|
@@ -125,6 +126,18 @@ export class ImportExportLinker extends Plugin {
|
|
|
125
126
|
continue;
|
|
126
127
|
}
|
|
127
128
|
|
|
129
|
+
// Create MODULE -> IMPORTS -> MODULE edge for relative imports
|
|
130
|
+
const sourceModule = modulesByFile.get(imp.file!);
|
|
131
|
+
const targetModule = modulesByFile.get(targetFile);
|
|
132
|
+
if (sourceModule && targetModule) {
|
|
133
|
+
await graph.addEdge({
|
|
134
|
+
type: 'IMPORTS',
|
|
135
|
+
src: sourceModule.id,
|
|
136
|
+
dst: targetModule.id
|
|
137
|
+
});
|
|
138
|
+
edgesCreated++;
|
|
139
|
+
}
|
|
140
|
+
|
|
128
141
|
// Find matching export based on import type
|
|
129
142
|
const importType = imp.importType; // 'default', 'named', or 'namespace'
|
|
130
143
|
let targetExport: ExportNode | undefined;
|
|
@@ -155,7 +168,12 @@ export class ImportExportLinker extends Plugin {
|
|
|
155
168
|
}
|
|
156
169
|
|
|
157
170
|
const totalTime = ((Date.now() - startTime) / 1000).toFixed(2);
|
|
158
|
-
|
|
171
|
+
logger.info('Complete', {
|
|
172
|
+
edgesCreated,
|
|
173
|
+
skipped,
|
|
174
|
+
notFound,
|
|
175
|
+
time: `${totalTime}s`
|
|
176
|
+
});
|
|
159
177
|
|
|
160
178
|
return createSuccessResult(
|
|
161
179
|
{ nodes: 0, edges: edgesCreated },
|
|
@@ -48,8 +48,9 @@ export class MethodCallResolver extends Plugin {
|
|
|
48
48
|
|
|
49
49
|
async execute(context: PluginContext): Promise<PluginResult> {
|
|
50
50
|
const { graph, onProgress } = context;
|
|
51
|
+
const logger = this.log(context);
|
|
51
52
|
|
|
52
|
-
|
|
53
|
+
logger.info('Starting method call resolution');
|
|
53
54
|
|
|
54
55
|
let methodCallsProcessed = 0;
|
|
55
56
|
let edgesCreated = 0;
|
|
@@ -64,14 +65,14 @@ export class MethodCallResolver extends Plugin {
|
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
|
|
68
|
+
logger.info('Found method calls to resolve', { count: methodCalls.length });
|
|
68
69
|
|
|
69
70
|
// Собираем все классы и их методы для быстрого поиска
|
|
70
|
-
const classMethodIndex = await this.buildClassMethodIndex(graph);
|
|
71
|
-
|
|
71
|
+
const classMethodIndex = await this.buildClassMethodIndex(graph, logger);
|
|
72
|
+
logger.info('Indexed classes', { count: classMethodIndex.size });
|
|
72
73
|
|
|
73
74
|
// Собираем переменные и их типы (если известны)
|
|
74
|
-
const variableTypes = await this.buildVariableTypeIndex(graph);
|
|
75
|
+
const variableTypes = await this.buildVariableTypeIndex(graph, logger);
|
|
75
76
|
|
|
76
77
|
const startTime = Date.now();
|
|
77
78
|
|
|
@@ -94,7 +95,12 @@ export class MethodCallResolver extends Plugin {
|
|
|
94
95
|
if (methodCallsProcessed % 10 === 0) {
|
|
95
96
|
const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
|
|
96
97
|
const avgTime = ((Date.now() - startTime) / methodCallsProcessed).toFixed(0);
|
|
97
|
-
|
|
98
|
+
logger.debug('Progress', {
|
|
99
|
+
processed: methodCallsProcessed,
|
|
100
|
+
total: methodCalls.length,
|
|
101
|
+
elapsed: `${elapsed}s`,
|
|
102
|
+
avgTime: `${avgTime}ms/call`
|
|
103
|
+
});
|
|
98
104
|
}
|
|
99
105
|
|
|
100
106
|
// Пропускаем внешние методы (console, Array.prototype, etc.)
|
|
@@ -135,7 +141,7 @@ export class MethodCallResolver extends Plugin {
|
|
|
135
141
|
classesIndexed: classMethodIndex.size
|
|
136
142
|
};
|
|
137
143
|
|
|
138
|
-
|
|
144
|
+
logger.info('Summary', summary);
|
|
139
145
|
|
|
140
146
|
return createSuccessResult({ nodes: 0, edges: edgesCreated }, summary);
|
|
141
147
|
}
|
|
@@ -143,7 +149,7 @@ export class MethodCallResolver extends Plugin {
|
|
|
143
149
|
/**
|
|
144
150
|
* Строит индекс классов и их методов
|
|
145
151
|
*/
|
|
146
|
-
private async buildClassMethodIndex(graph: PluginContext['graph']): Promise<Map<string, ClassEntry>> {
|
|
152
|
+
private async buildClassMethodIndex(graph: PluginContext['graph'], logger: ReturnType<typeof this.log>): Promise<Map<string, ClassEntry>> {
|
|
147
153
|
const index = new Map<string, ClassEntry>();
|
|
148
154
|
const startTime = Date.now();
|
|
149
155
|
let classCount = 0;
|
|
@@ -151,7 +157,7 @@ export class MethodCallResolver extends Plugin {
|
|
|
151
157
|
for await (const classNode of graph.queryNodes({ nodeType: 'CLASS' })) {
|
|
152
158
|
classCount++;
|
|
153
159
|
if (classCount % 50 === 0) {
|
|
154
|
-
|
|
160
|
+
logger.debug('Indexing classes', { count: classCount });
|
|
155
161
|
}
|
|
156
162
|
|
|
157
163
|
const className = classNode.name as string;
|
|
@@ -180,7 +186,7 @@ export class MethodCallResolver extends Plugin {
|
|
|
180
186
|
}
|
|
181
187
|
|
|
182
188
|
const totalTime = ((Date.now() - startTime) / 1000).toFixed(1);
|
|
183
|
-
|
|
189
|
+
logger.debug('Indexed class entries', { count: index.size, time: `${totalTime}s` });
|
|
184
190
|
|
|
185
191
|
return index;
|
|
186
192
|
}
|
|
@@ -188,7 +194,7 @@ export class MethodCallResolver extends Plugin {
|
|
|
188
194
|
/**
|
|
189
195
|
* Строит индекс переменных и их типов (из INSTANCE_OF рёбер)
|
|
190
196
|
*/
|
|
191
|
-
private async buildVariableTypeIndex(graph: PluginContext['graph']): Promise<Map<string, string>> {
|
|
197
|
+
private async buildVariableTypeIndex(graph: PluginContext['graph'], logger: ReturnType<typeof this.log>): Promise<Map<string, string>> {
|
|
192
198
|
const startTime = Date.now();
|
|
193
199
|
const index = new Map<string, string>();
|
|
194
200
|
|
|
@@ -202,7 +208,7 @@ export class MethodCallResolver extends Plugin {
|
|
|
202
208
|
}
|
|
203
209
|
|
|
204
210
|
const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
|
|
205
|
-
|
|
211
|
+
logger.debug('Built variable type index', { entries: index.size, time: `${elapsed}s` });
|
|
206
212
|
return index;
|
|
207
213
|
}
|
|
208
214
|
|
|
@@ -52,6 +52,7 @@ export class MountPointResolver extends Plugin {
|
|
|
52
52
|
async execute(context: PluginContext): Promise<PluginResult> {
|
|
53
53
|
try {
|
|
54
54
|
const { graph } = context;
|
|
55
|
+
const logger = this.log(context);
|
|
55
56
|
|
|
56
57
|
let endpointsUpdated = 0;
|
|
57
58
|
let mountPointsProcessed = 0;
|
|
@@ -60,7 +61,7 @@ export class MountPointResolver extends Plugin {
|
|
|
60
61
|
const allNodes = await graph.getAllNodes();
|
|
61
62
|
const mountPoints = allNodes.filter(node => node.type === 'MOUNT_POINT') as MountPointNode[];
|
|
62
63
|
|
|
63
|
-
|
|
64
|
+
logger.info('Found mount points', { count: mountPoints.length });
|
|
64
65
|
|
|
65
66
|
// For each top-level mount point (from app.use in index.js)
|
|
66
67
|
// apply recursive resolver
|
|
@@ -129,7 +130,10 @@ export class MountPointResolver extends Plugin {
|
|
|
129
130
|
mountPointsProcessed++;
|
|
130
131
|
}
|
|
131
132
|
|
|
132
|
-
|
|
133
|
+
logger.info('Updated endpoints', {
|
|
134
|
+
endpoints: endpointsUpdated,
|
|
135
|
+
mountPoints: mountPointsProcessed
|
|
136
|
+
});
|
|
133
137
|
|
|
134
138
|
return createSuccessResult(
|
|
135
139
|
{ nodes: 0, edges: 0 },
|
|
@@ -137,7 +141,8 @@ export class MountPointResolver extends Plugin {
|
|
|
137
141
|
);
|
|
138
142
|
|
|
139
143
|
} catch (error) {
|
|
140
|
-
|
|
144
|
+
const logger = this.log(context);
|
|
145
|
+
logger.error('Error in MountPointResolver', { error });
|
|
141
146
|
return createErrorResult(error as Error);
|
|
142
147
|
}
|
|
143
148
|
}
|