@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
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* - ExportAllDeclaration: export * from './module'
|
|
9
9
|
*/
|
|
10
10
|
import { ASTVisitor } from './ASTVisitor.js';
|
|
11
|
+
import { getLine, getColumn } from '../utils/location.js';
|
|
11
12
|
export class ImportExportVisitor extends ASTVisitor {
|
|
12
13
|
extractVariableNamesFromPattern;
|
|
13
14
|
/**
|
|
@@ -59,7 +60,8 @@ export class ImportExportVisitor extends ASTVisitor {
|
|
|
59
60
|
imports.push({
|
|
60
61
|
source,
|
|
61
62
|
specifiers,
|
|
62
|
-
line: node
|
|
63
|
+
line: getLine(node),
|
|
64
|
+
column: getColumn(node)
|
|
63
65
|
});
|
|
64
66
|
}
|
|
65
67
|
};
|
|
@@ -72,12 +74,13 @@ export class ImportExportVisitor extends ASTVisitor {
|
|
|
72
74
|
const node = path.node;
|
|
73
75
|
exports.push({
|
|
74
76
|
type: 'default',
|
|
75
|
-
line: node
|
|
77
|
+
line: getLine(node),
|
|
76
78
|
declaration: node.declaration
|
|
77
79
|
});
|
|
78
80
|
},
|
|
79
81
|
ExportNamedDeclaration: (path) => {
|
|
80
82
|
const node = path.node;
|
|
83
|
+
const exportLine = getLine(node);
|
|
81
84
|
// export { foo, bar } from './module'
|
|
82
85
|
if (node.source) {
|
|
83
86
|
const specifiers = node.specifiers.map((spec) => {
|
|
@@ -95,7 +98,7 @@ export class ImportExportVisitor extends ASTVisitor {
|
|
|
95
98
|
});
|
|
96
99
|
exports.push({
|
|
97
100
|
type: 'named',
|
|
98
|
-
line:
|
|
101
|
+
line: exportLine,
|
|
99
102
|
specifiers,
|
|
100
103
|
source: node.source.value
|
|
101
104
|
});
|
|
@@ -114,7 +117,7 @@ export class ImportExportVisitor extends ASTVisitor {
|
|
|
114
117
|
});
|
|
115
118
|
exports.push({
|
|
116
119
|
type: 'named',
|
|
117
|
-
line:
|
|
120
|
+
line: exportLine,
|
|
118
121
|
specifiers
|
|
119
122
|
});
|
|
120
123
|
}
|
|
@@ -127,7 +130,7 @@ export class ImportExportVisitor extends ASTVisitor {
|
|
|
127
130
|
if (funcDecl.id) {
|
|
128
131
|
exports.push({
|
|
129
132
|
type: 'named',
|
|
130
|
-
line:
|
|
133
|
+
line: exportLine,
|
|
131
134
|
name: funcDecl.id.name
|
|
132
135
|
});
|
|
133
136
|
}
|
|
@@ -141,7 +144,7 @@ export class ImportExportVisitor extends ASTVisitor {
|
|
|
141
144
|
variables.forEach((varInfo) => {
|
|
142
145
|
exports.push({
|
|
143
146
|
type: 'named',
|
|
144
|
-
line:
|
|
147
|
+
line: exportLine,
|
|
145
148
|
name: varInfo.name
|
|
146
149
|
});
|
|
147
150
|
});
|
|
@@ -153,7 +156,7 @@ export class ImportExportVisitor extends ASTVisitor {
|
|
|
153
156
|
if (classDecl.id) {
|
|
154
157
|
exports.push({
|
|
155
158
|
type: 'named',
|
|
156
|
-
line:
|
|
159
|
+
line: exportLine,
|
|
157
160
|
name: classDecl.id.name
|
|
158
161
|
});
|
|
159
162
|
}
|
|
@@ -165,7 +168,7 @@ export class ImportExportVisitor extends ASTVisitor {
|
|
|
165
168
|
// export * from './module'
|
|
166
169
|
exports.push({
|
|
167
170
|
type: 'all',
|
|
168
|
-
line: node
|
|
171
|
+
line: getLine(node),
|
|
169
172
|
source: node.source.value
|
|
170
173
|
});
|
|
171
174
|
}
|
|
@@ -7,8 +7,19 @@
|
|
|
7
7
|
* - TSEnumDeclaration
|
|
8
8
|
*/
|
|
9
9
|
import { ASTVisitor, type VisitorModule, type VisitorCollections, type VisitorHandlers } from './ASTVisitor.js';
|
|
10
|
+
import { ScopeTracker } from '../../../../core/ScopeTracker.js';
|
|
11
|
+
/**
|
|
12
|
+
* Extracts a string representation of a TypeScript type node
|
|
13
|
+
*/
|
|
14
|
+
export declare function typeNodeToString(node: unknown): string;
|
|
10
15
|
export declare class TypeScriptVisitor extends ASTVisitor {
|
|
11
|
-
|
|
16
|
+
private scopeTracker?;
|
|
17
|
+
/**
|
|
18
|
+
* @param module - Current module being analyzed
|
|
19
|
+
* @param collections - Must contain interfaces, typeAliases, enums arrays
|
|
20
|
+
* @param scopeTracker - Optional ScopeTracker for semantic ID generation
|
|
21
|
+
*/
|
|
22
|
+
constructor(module: VisitorModule, collections: VisitorCollections, scopeTracker?: ScopeTracker);
|
|
12
23
|
getHandlers(): VisitorHandlers;
|
|
13
24
|
}
|
|
14
25
|
//# sourceMappingURL=TypeScriptVisitor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeScriptVisitor.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/analysis/ast/visitors/TypeScriptVisitor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAaH,OAAO,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"TypeScriptVisitor.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/analysis/ast/visitors/TypeScriptVisitor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAaH,OAAO,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAQhH,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAIhE;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAgEtD;AAED,qBAAa,iBAAkB,SAAQ,UAAU;IAC/C,OAAO,CAAC,YAAY,CAAC,CAAe;IAEpC;;;;OAIG;gBACS,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,kBAAkB,EAAE,YAAY,CAAC,EAAE,YAAY;IAK/F,WAAW,IAAI,eAAe;CAmJ/B"}
|
|
@@ -7,10 +7,12 @@
|
|
|
7
7
|
* - TSEnumDeclaration
|
|
8
8
|
*/
|
|
9
9
|
import { ASTVisitor } from './ASTVisitor.js';
|
|
10
|
+
import { computeSemanticId } from '../../../../core/SemanticId.js';
|
|
11
|
+
import { getLine, getColumn } from '../utils/location.js';
|
|
10
12
|
/**
|
|
11
13
|
* Extracts a string representation of a TypeScript type node
|
|
12
14
|
*/
|
|
13
|
-
function typeNodeToString(node) {
|
|
15
|
+
export function typeNodeToString(node) {
|
|
14
16
|
if (!node || typeof node !== 'object')
|
|
15
17
|
return 'unknown';
|
|
16
18
|
const typeNode = node;
|
|
@@ -77,19 +79,31 @@ function typeNodeToString(node) {
|
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
81
|
export class TypeScriptVisitor extends ASTVisitor {
|
|
80
|
-
|
|
82
|
+
scopeTracker;
|
|
83
|
+
/**
|
|
84
|
+
* @param module - Current module being analyzed
|
|
85
|
+
* @param collections - Must contain interfaces, typeAliases, enums arrays
|
|
86
|
+
* @param scopeTracker - Optional ScopeTracker for semantic ID generation
|
|
87
|
+
*/
|
|
88
|
+
constructor(module, collections, scopeTracker) {
|
|
81
89
|
super(module, collections);
|
|
90
|
+
this.scopeTracker = scopeTracker;
|
|
82
91
|
}
|
|
83
92
|
getHandlers() {
|
|
84
93
|
const { module } = this;
|
|
85
94
|
const { interfaces, typeAliases, enums } = this.collections;
|
|
95
|
+
const scopeTracker = this.scopeTracker;
|
|
86
96
|
return {
|
|
87
97
|
TSInterfaceDeclaration: (path) => {
|
|
88
98
|
const node = path.node;
|
|
89
99
|
if (!node.id)
|
|
90
100
|
return;
|
|
91
101
|
const interfaceName = node.id.name;
|
|
92
|
-
|
|
102
|
+
// Generate semantic ID if scopeTracker available
|
|
103
|
+
let interfaceSemanticId;
|
|
104
|
+
if (scopeTracker) {
|
|
105
|
+
interfaceSemanticId = computeSemanticId('INTERFACE', interfaceName, scopeTracker.getContext());
|
|
106
|
+
}
|
|
93
107
|
// Extract extends
|
|
94
108
|
const extendsNames = [];
|
|
95
109
|
if (node.extends && node.extends.length > 0) {
|
|
@@ -128,12 +142,12 @@ export class TypeScriptVisitor extends ASTVisitor {
|
|
|
128
142
|
}
|
|
129
143
|
}
|
|
130
144
|
interfaces.push({
|
|
131
|
-
|
|
145
|
+
semanticId: interfaceSemanticId,
|
|
132
146
|
type: 'INTERFACE',
|
|
133
147
|
name: interfaceName,
|
|
134
148
|
file: module.file,
|
|
135
|
-
line: node
|
|
136
|
-
column: node
|
|
149
|
+
line: getLine(node),
|
|
150
|
+
column: getColumn(node),
|
|
137
151
|
extends: extendsNames.length > 0 ? extendsNames : undefined,
|
|
138
152
|
properties
|
|
139
153
|
});
|
|
@@ -143,16 +157,20 @@ export class TypeScriptVisitor extends ASTVisitor {
|
|
|
143
157
|
if (!node.id)
|
|
144
158
|
return;
|
|
145
159
|
const typeName = node.id.name;
|
|
146
|
-
|
|
160
|
+
// Generate semantic ID if scopeTracker available
|
|
161
|
+
let typeSemanticId;
|
|
162
|
+
if (scopeTracker) {
|
|
163
|
+
typeSemanticId = computeSemanticId('TYPE', typeName, scopeTracker.getContext());
|
|
164
|
+
}
|
|
147
165
|
// Extract the type being aliased
|
|
148
166
|
const aliasOf = typeNodeToString(node.typeAnnotation);
|
|
149
167
|
typeAliases.push({
|
|
150
|
-
|
|
168
|
+
semanticId: typeSemanticId,
|
|
151
169
|
type: 'TYPE',
|
|
152
170
|
name: typeName,
|
|
153
171
|
file: module.file,
|
|
154
|
-
line: node
|
|
155
|
-
column: node
|
|
172
|
+
line: getLine(node),
|
|
173
|
+
column: getColumn(node),
|
|
156
174
|
aliasOf
|
|
157
175
|
});
|
|
158
176
|
},
|
|
@@ -161,7 +179,11 @@ export class TypeScriptVisitor extends ASTVisitor {
|
|
|
161
179
|
if (!node.id)
|
|
162
180
|
return;
|
|
163
181
|
const enumName = node.id.name;
|
|
164
|
-
|
|
182
|
+
// Generate semantic ID if scopeTracker available
|
|
183
|
+
let enumSemanticId;
|
|
184
|
+
if (scopeTracker) {
|
|
185
|
+
enumSemanticId = computeSemanticId('ENUM', enumName, scopeTracker.getContext());
|
|
186
|
+
}
|
|
165
187
|
// Extract members
|
|
166
188
|
const members = [];
|
|
167
189
|
if (node.members) {
|
|
@@ -185,12 +207,12 @@ export class TypeScriptVisitor extends ASTVisitor {
|
|
|
185
207
|
}
|
|
186
208
|
}
|
|
187
209
|
enums.push({
|
|
188
|
-
|
|
210
|
+
semanticId: enumSemanticId,
|
|
189
211
|
type: 'ENUM',
|
|
190
212
|
name: enumName,
|
|
191
213
|
file: module.file,
|
|
192
|
-
line: node
|
|
193
|
-
column: node
|
|
214
|
+
line: getLine(node),
|
|
215
|
+
column: getColumn(node),
|
|
194
216
|
isConst: node.const || false,
|
|
195
217
|
members
|
|
196
218
|
});
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { Node } from '@babel/types';
|
|
10
10
|
import { ASTVisitor, type VisitorModule, type VisitorCollections, type VisitorHandlers, type CounterRef } from './ASTVisitor.js';
|
|
11
|
+
import { ScopeTracker } from '../../../../core/ScopeTracker.js';
|
|
11
12
|
/**
|
|
12
13
|
* Variable info extracted from pattern
|
|
13
14
|
*/
|
|
@@ -33,13 +34,15 @@ export type TrackVariableAssignmentCallback = (initNode: Node, variableId: strin
|
|
|
33
34
|
export declare class VariableVisitor extends ASTVisitor {
|
|
34
35
|
private extractVariableNamesFromPattern;
|
|
35
36
|
private trackVariableAssignment;
|
|
37
|
+
private scopeTracker?;
|
|
36
38
|
/**
|
|
37
39
|
* @param module - Current module being analyzed
|
|
38
40
|
* @param collections - Must contain arrays and counter refs
|
|
39
41
|
* @param extractVariableNamesFromPattern - Helper for destructuring
|
|
40
42
|
* @param trackVariableAssignment - Helper for data flow tracking
|
|
43
|
+
* @param scopeTracker - Optional ScopeTracker for semantic ID generation
|
|
41
44
|
*/
|
|
42
|
-
constructor(module: VisitorModule, collections: VisitorCollections, extractVariableNamesFromPattern: ExtractVariableNamesCallback, trackVariableAssignment: TrackVariableAssignmentCallback);
|
|
45
|
+
constructor(module: VisitorModule, collections: VisitorCollections, extractVariableNamesFromPattern: ExtractVariableNamesCallback, trackVariableAssignment: TrackVariableAssignmentCallback, scopeTracker?: ScopeTracker);
|
|
43
46
|
getHandlers(): VisitorHandlers;
|
|
44
47
|
}
|
|
45
48
|
//# sourceMappingURL=VariableVisitor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VariableVisitor.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/analysis/ast/visitors/VariableVisitor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAKV,IAAI,EACL,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"VariableVisitor.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/analysis/ast/visitors/VariableVisitor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAKV,IAAI,EACL,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEjI,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAIhE;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE;QAAE,KAAK,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;IACjD,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,CAAC,OAAO,EAAE,IAAI,KAAK,YAAY,EAAE,CAAC;AAE7E;;GAEG;AACH,MAAM,MAAM,+BAA+B,GAAG,CAC5C,QAAQ,EAAE,IAAI,EACd,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,OAAO,EAAE,EACnB,mBAAmB,EAAE,OAAO,EAAE,EAC9B,iBAAiB,EAAE,UAAU,KAC1B,IAAI,CAAC;AAoDV,qBAAa,eAAgB,SAAQ,UAAU;IAC7C,OAAO,CAAC,+BAA+B,CAA+B;IACtE,OAAO,CAAC,uBAAuB,CAAkC;IACjE,OAAO,CAAC,YAAY,CAAC,CAAe;IAEpC;;;;;;OAMG;gBAED,MAAM,EAAE,aAAa,EACrB,WAAW,EAAE,kBAAkB,EAC/B,+BAA+B,EAAE,4BAA4B,EAC7D,uBAAuB,EAAE,+BAA+B,EACxD,YAAY,CAAC,EAAE,YAAY;IAQ7B,WAAW,IAAI,eAAe;CAgK/B"}
|
|
@@ -8,19 +8,24 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { ASTVisitor } from './ASTVisitor.js';
|
|
10
10
|
import { ExpressionEvaluator } from '../ExpressionEvaluator.js';
|
|
11
|
+
import { IdGenerator } from '../IdGenerator.js';
|
|
12
|
+
import { NodeFactory } from '../../../../core/NodeFactory.js';
|
|
11
13
|
export class VariableVisitor extends ASTVisitor {
|
|
12
14
|
extractVariableNamesFromPattern;
|
|
13
15
|
trackVariableAssignment;
|
|
16
|
+
scopeTracker;
|
|
14
17
|
/**
|
|
15
18
|
* @param module - Current module being analyzed
|
|
16
19
|
* @param collections - Must contain arrays and counter refs
|
|
17
20
|
* @param extractVariableNamesFromPattern - Helper for destructuring
|
|
18
21
|
* @param trackVariableAssignment - Helper for data flow tracking
|
|
22
|
+
* @param scopeTracker - Optional ScopeTracker for semantic ID generation
|
|
19
23
|
*/
|
|
20
|
-
constructor(module, collections, extractVariableNamesFromPattern, trackVariableAssignment) {
|
|
24
|
+
constructor(module, collections, extractVariableNamesFromPattern, trackVariableAssignment, scopeTracker) {
|
|
21
25
|
super(module, collections);
|
|
22
26
|
this.extractVariableNamesFromPattern = extractVariableNamesFromPattern;
|
|
23
27
|
this.trackVariableAssignment = trackVariableAssignment;
|
|
28
|
+
this.scopeTracker = scopeTracker;
|
|
24
29
|
}
|
|
25
30
|
getHandlers() {
|
|
26
31
|
const { module } = this;
|
|
@@ -30,6 +35,7 @@ export class VariableVisitor extends ASTVisitor {
|
|
|
30
35
|
const variableAssignments = this.collections.variableAssignments ?? [];
|
|
31
36
|
const varDeclCounterRef = (this.collections.varDeclCounterRef ?? { value: 0 });
|
|
32
37
|
const literalCounterRef = (this.collections.literalCounterRef ?? { value: 0 });
|
|
38
|
+
const scopeTracker = this.scopeTracker;
|
|
33
39
|
const extractVariableNamesFromPattern = this.extractVariableNamesFromPattern;
|
|
34
40
|
const trackVariableAssignment = this.trackVariableAssignment;
|
|
35
41
|
return {
|
|
@@ -49,9 +55,10 @@ export class VariableVisitor extends ASTVisitor {
|
|
|
49
55
|
// For const with literal or NewExpression create CONSTANT
|
|
50
56
|
// For everything else - VARIABLE
|
|
51
57
|
const shouldBeConstant = isConst && (isLiteral || isNewExpression);
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
58
|
+
const nodeType = shouldBeConstant ? 'CONSTANT' : 'VARIABLE';
|
|
59
|
+
// Generate ID using centralized IdGenerator
|
|
60
|
+
const idGenerator = new IdGenerator(scopeTracker);
|
|
61
|
+
const varId = idGenerator.generate(nodeType, varInfo.name, module.file, varInfo.loc.start.line, varInfo.loc.start.column, varDeclCounterRef);
|
|
55
62
|
if (shouldBeConstant) {
|
|
56
63
|
// CONSTANT node
|
|
57
64
|
const constantData = {
|
|
@@ -106,19 +113,16 @@ export class VariableVisitor extends ASTVisitor {
|
|
|
106
113
|
else if (varInfo.arrayIndex !== undefined) {
|
|
107
114
|
expressionPath = `${initName}[${varInfo.arrayIndex}]`;
|
|
108
115
|
}
|
|
109
|
-
const expressionId = `EXPRESSION#${expressionPath}#${module.file}#${varInfo.loc.start.line}:${varInfo.loc.start.column}`;
|
|
110
116
|
// Create EXPRESSION node representing the property access
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
type: 'EXPRESSION',
|
|
114
|
-
expressionType: varInfo.propertyPath ? 'MemberExpression' : 'ArrayAccess',
|
|
117
|
+
const expressionType = varInfo.propertyPath ? 'MemberExpression' : 'ArrayAccess';
|
|
118
|
+
const expressionNode = NodeFactory.createExpression(expressionType, module.file, varInfo.loc.start.line, varInfo.loc.start.column, {
|
|
115
119
|
path: expressionPath,
|
|
116
120
|
baseName: initName,
|
|
117
|
-
propertyPath: varInfo.propertyPath ||
|
|
118
|
-
arrayIndex: varInfo.arrayIndex
|
|
119
|
-
file: module.file,
|
|
120
|
-
line: varInfo.loc.start.line
|
|
121
|
+
propertyPath: varInfo.propertyPath || undefined,
|
|
122
|
+
arrayIndex: varInfo.arrayIndex
|
|
121
123
|
});
|
|
124
|
+
const expressionId = expressionNode.id;
|
|
125
|
+
literals.push(expressionNode);
|
|
122
126
|
// Create ASSIGNED_FROM edge: VARIABLE -> EXPRESSION
|
|
123
127
|
variableAssignments.push({
|
|
124
128
|
variableId: varId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonorepoServiceDiscovery.d.ts","sourceRoot":"","sources":["../../../src/plugins/discovery/MonorepoServiceDiscovery.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAehF;;GAEG;AACH,UAAU,cAAe,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,qBAAa,wBAAyB,SAAQ,eAAe;IAC3D,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAW;gBAElB,MAAM,GAAE,cAAmB;IAOvC,IAAI,QAAQ,IAAI,cAAc,CAW7B;IAEK,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"MonorepoServiceDiscovery.d.ts","sourceRoot":"","sources":["../../../src/plugins/discovery/MonorepoServiceDiscovery.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAehF;;GAEG;AACH,UAAU,cAAe,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,qBAAa,wBAAyB,SAAQ,eAAe;IAC3D,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAW;gBAElB,MAAM,GAAE,cAAmB;IAOvC,IAAI,QAAQ,IAAI,cAAc,CAW7B;IAEK,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;CA2D7D"}
|
|
@@ -32,16 +32,17 @@ export class MonorepoServiceDiscovery extends DiscoveryPlugin {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
async execute(context) {
|
|
35
|
+
const logger = this.log(context);
|
|
35
36
|
const { projectPath, graph } = context;
|
|
36
37
|
const servicesPath = join(projectPath, this.servicesDir);
|
|
37
|
-
|
|
38
|
+
logger.debug('Looking for services', { servicesPath });
|
|
38
39
|
if (!existsSync(servicesPath)) {
|
|
39
40
|
return createErrorResult(new Error(`Services directory not found: ${servicesPath}`));
|
|
40
41
|
}
|
|
41
42
|
try {
|
|
42
43
|
const services = [];
|
|
43
44
|
const entries = readdirSync(servicesPath);
|
|
44
|
-
|
|
45
|
+
logger.debug('Found entries', { count: entries.length });
|
|
45
46
|
for (const entry of entries) {
|
|
46
47
|
const fullPath = join(servicesPath, entry);
|
|
47
48
|
const stat = statSync(fullPath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleProjectDiscovery.d.ts","sourceRoot":"","sources":["../../../src/plugins/discovery/SimpleProjectDiscovery.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAAE,MAAM,EAA0C,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"SimpleProjectDiscovery.d.ts","sourceRoot":"","sources":["../../../src/plugins/discovery/SimpleProjectDiscovery.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAAE,MAAM,EAA0C,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AA6BhF,qBAAa,sBAAuB,SAAQ,MAAM;IAEhD,IAAI,QAAQ,IAAI,cAAc,CAW7B;IAEK,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;CAkD7D"}
|
|
@@ -9,6 +9,7 @@ import { existsSync, readFileSync } from 'fs';
|
|
|
9
9
|
import { join } from 'path';
|
|
10
10
|
import { NodeFactory } from '../../core/NodeFactory.js';
|
|
11
11
|
import { Plugin, createSuccessResult, createErrorResult } from '../Plugin.js';
|
|
12
|
+
import { resolveSourceEntrypoint } from './resolveSourceEntrypoint.js';
|
|
12
13
|
export class SimpleProjectDiscovery extends Plugin {
|
|
13
14
|
get metadata() {
|
|
14
15
|
return {
|
|
@@ -36,7 +37,10 @@ export class SimpleProjectDiscovery extends Plugin {
|
|
|
36
37
|
try {
|
|
37
38
|
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
38
39
|
const serviceName = packageJson.name || 'unnamed-service';
|
|
39
|
-
|
|
40
|
+
// Prefer TypeScript source over compiled output
|
|
41
|
+
const entrypoint = resolveSourceEntrypoint(projectPath, packageJson)
|
|
42
|
+
?? packageJson.main
|
|
43
|
+
?? 'index.js';
|
|
40
44
|
// Используем NodeFactory для создания SERVICE ноды
|
|
41
45
|
const serviceNode = NodeFactory.createService(serviceName, projectPath, {
|
|
42
46
|
discoveryMethod: 'simple',
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WorkspaceDiscovery - Discovery plugin for npm/pnpm/yarn/lerna workspaces
|
|
3
|
+
*
|
|
4
|
+
* Detects workspace configuration and creates SERVICE nodes for each package.
|
|
5
|
+
* Priority: 110 (higher than MonorepoServiceDiscovery at 100)
|
|
6
|
+
*
|
|
7
|
+
* Supports:
|
|
8
|
+
* - pnpm-workspace.yaml
|
|
9
|
+
* - package.json workspaces (npm/yarn)
|
|
10
|
+
* - lerna.json
|
|
11
|
+
*/
|
|
12
|
+
import { DiscoveryPlugin } from './DiscoveryPlugin.js';
|
|
13
|
+
import type { PluginContext, PluginResult, PluginMetadata } from '../Plugin.js';
|
|
14
|
+
export declare class WorkspaceDiscovery extends DiscoveryPlugin {
|
|
15
|
+
get metadata(): PluginMetadata;
|
|
16
|
+
execute(context: PluginContext): Promise<PluginResult>;
|
|
17
|
+
/**
|
|
18
|
+
* Create SERVICE node from workspace package.
|
|
19
|
+
*/
|
|
20
|
+
private createServiceNode;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=WorkspaceDiscovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkspaceDiscovery.d.ts","sourceRoot":"","sources":["../../../src/plugins/discovery/WorkspaceDiscovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAuBhF,qBAAa,kBAAmB,SAAQ,eAAe;IACrD,IAAI,QAAQ,IAAI,cAAc,CAW7B;IAEK,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IA4F5D;;OAEG;IACH,OAAO,CAAC,iBAAiB;CA8B1B"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WorkspaceDiscovery - Discovery plugin for npm/pnpm/yarn/lerna workspaces
|
|
3
|
+
*
|
|
4
|
+
* Detects workspace configuration and creates SERVICE nodes for each package.
|
|
5
|
+
* Priority: 110 (higher than MonorepoServiceDiscovery at 100)
|
|
6
|
+
*
|
|
7
|
+
* Supports:
|
|
8
|
+
* - pnpm-workspace.yaml
|
|
9
|
+
* - package.json workspaces (npm/yarn)
|
|
10
|
+
* - lerna.json
|
|
11
|
+
*/
|
|
12
|
+
import { DiscoveryPlugin } from './DiscoveryPlugin.js';
|
|
13
|
+
import { createSuccessResult, createErrorResult } from '../Plugin.js';
|
|
14
|
+
import { detectWorkspaceType } from './workspaces/detector.js';
|
|
15
|
+
import { parsePnpmWorkspace, parseNpmWorkspace, parseLernaConfig } from './workspaces/parsers.js';
|
|
16
|
+
import { resolveWorkspacePackages } from './workspaces/globResolver.js';
|
|
17
|
+
import { NodeFactory } from '../../core/NodeFactory.js';
|
|
18
|
+
import { resolveSourceEntrypoint } from './resolveSourceEntrypoint.js';
|
|
19
|
+
export class WorkspaceDiscovery extends DiscoveryPlugin {
|
|
20
|
+
get metadata() {
|
|
21
|
+
return {
|
|
22
|
+
name: 'WorkspaceDiscovery',
|
|
23
|
+
phase: 'DISCOVERY',
|
|
24
|
+
priority: 110, // Higher than MonorepoServiceDiscovery (100)
|
|
25
|
+
creates: {
|
|
26
|
+
nodes: ['SERVICE'],
|
|
27
|
+
edges: []
|
|
28
|
+
},
|
|
29
|
+
dependencies: []
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
async execute(context) {
|
|
33
|
+
const logger = this.log(context);
|
|
34
|
+
const { projectPath, graph } = context;
|
|
35
|
+
// Validate projectPath
|
|
36
|
+
if (!projectPath) {
|
|
37
|
+
return createErrorResult(new Error('projectPath is required'));
|
|
38
|
+
}
|
|
39
|
+
logger.debug('Detecting workspace type', { projectPath });
|
|
40
|
+
// Step 1: Detect workspace type
|
|
41
|
+
const detection = detectWorkspaceType(projectPath);
|
|
42
|
+
if (!detection.type) {
|
|
43
|
+
logger.debug('Not a workspace project, skipping');
|
|
44
|
+
return createSuccessResult({ nodes: 0, edges: 0 }, {
|
|
45
|
+
services: [],
|
|
46
|
+
skipped: true,
|
|
47
|
+
reason: 'No workspace configuration found'
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
logger.info('Workspace detected', {
|
|
51
|
+
type: detection.type,
|
|
52
|
+
configPath: detection.configPath
|
|
53
|
+
});
|
|
54
|
+
// Step 2: Parse workspace configuration
|
|
55
|
+
let config;
|
|
56
|
+
try {
|
|
57
|
+
switch (detection.type) {
|
|
58
|
+
case 'pnpm':
|
|
59
|
+
config = parsePnpmWorkspace(detection.configPath);
|
|
60
|
+
break;
|
|
61
|
+
case 'npm':
|
|
62
|
+
case 'yarn':
|
|
63
|
+
config = parseNpmWorkspace(detection.configPath);
|
|
64
|
+
break;
|
|
65
|
+
case 'lerna':
|
|
66
|
+
config = parseLernaConfig(detection.configPath);
|
|
67
|
+
break;
|
|
68
|
+
default:
|
|
69
|
+
throw new Error(`Unknown workspace type: ${detection.type}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
return createErrorResult(error);
|
|
74
|
+
}
|
|
75
|
+
logger.debug('Workspace config parsed', {
|
|
76
|
+
patterns: config.patterns,
|
|
77
|
+
negativePatterns: config.negativePatterns
|
|
78
|
+
});
|
|
79
|
+
// Step 3: Resolve patterns to packages
|
|
80
|
+
const packages = resolveWorkspacePackages(projectPath, config);
|
|
81
|
+
logger.info('Workspace packages resolved', { count: packages.length });
|
|
82
|
+
// Step 4: Create SERVICE nodes
|
|
83
|
+
const services = [];
|
|
84
|
+
for (const pkg of packages) {
|
|
85
|
+
const serviceNode = this.createServiceNode(pkg, detection.type, projectPath);
|
|
86
|
+
await graph.addNode(serviceNode);
|
|
87
|
+
services.push({
|
|
88
|
+
id: serviceNode.id,
|
|
89
|
+
name: pkg.name,
|
|
90
|
+
path: pkg.path,
|
|
91
|
+
type: 'workspace-package',
|
|
92
|
+
metadata: {
|
|
93
|
+
workspaceType: detection.type,
|
|
94
|
+
relativePath: pkg.relativePath,
|
|
95
|
+
entrypoint: serviceNode.entrypoint,
|
|
96
|
+
packageJson: pkg.packageJson
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
logger.info('Services created from workspace', {
|
|
101
|
+
count: services.length,
|
|
102
|
+
workspaceType: detection.type
|
|
103
|
+
});
|
|
104
|
+
return createSuccessResult({ nodes: services.length, edges: 0 }, { services, workspaceType: detection.type });
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Create SERVICE node from workspace package.
|
|
108
|
+
*/
|
|
109
|
+
createServiceNode(pkg, workspaceType, _projectPath) {
|
|
110
|
+
// Resolve entrypoint (prefer TypeScript source)
|
|
111
|
+
const entrypoint = resolveSourceEntrypoint(pkg.path, pkg.packageJson)
|
|
112
|
+
?? pkg.packageJson.main
|
|
113
|
+
?? null;
|
|
114
|
+
const serviceNode = NodeFactory.createService(pkg.name, pkg.path, {
|
|
115
|
+
discoveryMethod: 'workspace',
|
|
116
|
+
entrypoint: entrypoint ?? undefined,
|
|
117
|
+
version: pkg.packageJson.version,
|
|
118
|
+
description: pkg.packageJson.description,
|
|
119
|
+
dependencies: Object.keys(pkg.packageJson.dependencies || {})
|
|
120
|
+
});
|
|
121
|
+
// Add metadata for workspace-specific information
|
|
122
|
+
// BaseNodeRecord supports optional metadata field
|
|
123
|
+
const nodeWithMetadata = serviceNode;
|
|
124
|
+
nodeWithMetadata.metadata = {
|
|
125
|
+
workspaceType,
|
|
126
|
+
discoveryMethod: 'workspace',
|
|
127
|
+
relativePath: pkg.relativePath,
|
|
128
|
+
version: pkg.packageJson.version,
|
|
129
|
+
description: pkg.packageJson.description,
|
|
130
|
+
private: pkg.packageJson.private,
|
|
131
|
+
dependencies: Object.keys(pkg.packageJson.dependencies || {}),
|
|
132
|
+
entrypoint: entrypoint
|
|
133
|
+
};
|
|
134
|
+
return nodeWithMetadata;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves TypeScript source entrypoints for projects.
|
|
3
|
+
*
|
|
4
|
+
* This utility prefers TypeScript source files (src/index.ts) over compiled
|
|
5
|
+
* output (dist/index.js) when analyzing TypeScript projects.
|
|
6
|
+
*
|
|
7
|
+
* Resolution order:
|
|
8
|
+
* 1. If no tsconfig.json exists -> return null (not a TypeScript project)
|
|
9
|
+
* 2. Check package.json "source" field (explicit source declaration)
|
|
10
|
+
* 3. Try standard TypeScript source candidates
|
|
11
|
+
* 4. Return null if no source found (caller should fallback to main)
|
|
12
|
+
*
|
|
13
|
+
* @module resolveSourceEntrypoint
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Package.json fields relevant for source resolution
|
|
17
|
+
*/
|
|
18
|
+
export interface PackageJsonForResolution {
|
|
19
|
+
main?: string;
|
|
20
|
+
source?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Resolves the source entrypoint for a project, preferring TypeScript source
|
|
24
|
+
* over compiled output.
|
|
25
|
+
*
|
|
26
|
+
* @param projectPath - Absolute path to the project/service directory
|
|
27
|
+
* @param packageJson - Parsed package.json content (only relevant fields needed)
|
|
28
|
+
* @returns Source entrypoint relative to projectPath, or null if not found
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* // TypeScript project with src/index.ts
|
|
32
|
+
* resolveSourceEntrypoint('/path/to/project', { main: 'dist/index.js' })
|
|
33
|
+
* // Returns: 'src/index.ts'
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* // JavaScript project (no tsconfig.json)
|
|
37
|
+
* resolveSourceEntrypoint('/path/to/project', { main: 'index.js' })
|
|
38
|
+
* // Returns: null
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* // TypeScript project with explicit source field
|
|
42
|
+
* resolveSourceEntrypoint('/path/to/project', { main: 'dist/index.js', source: 'lib/entry.ts' })
|
|
43
|
+
* // Returns: 'lib/entry.ts' (if file exists)
|
|
44
|
+
*/
|
|
45
|
+
export declare function resolveSourceEntrypoint(projectPath: string, packageJson: PackageJsonForResolution): string | null;
|
|
46
|
+
//# sourceMappingURL=resolveSourceEntrypoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveSourceEntrypoint.d.ts","sourceRoot":"","sources":["../../../src/plugins/discovery/resolveSourceEntrypoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA2BD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,wBAAwB,GACpC,MAAM,GAAG,IAAI,CAyBf"}
|