@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,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* createParameterNodes - Shared utility for creating PARAMETER nodes
|
|
3
|
+
*
|
|
4
|
+
* Used by FunctionVisitor and ClassVisitor to create PARAMETER nodes
|
|
5
|
+
* for function/method parameters with consistent behavior.
|
|
6
|
+
*
|
|
7
|
+
* Uses semantic IDs for stable, scope-based identification that doesn't
|
|
8
|
+
* change when lines are added/removed above the function.
|
|
9
|
+
*/
|
|
10
|
+
import { computeSemanticId } from '../../../../core/SemanticId.js';
|
|
11
|
+
/**
|
|
12
|
+
* Create PARAMETER nodes for function parameters
|
|
13
|
+
*
|
|
14
|
+
* Handles:
|
|
15
|
+
* - Simple Identifier parameters: function(a, b)
|
|
16
|
+
* - AssignmentPattern (default parameters): function(a = 1)
|
|
17
|
+
* - RestElement (rest parameters): function(...args)
|
|
18
|
+
*
|
|
19
|
+
* Does NOT handle (can be added later):
|
|
20
|
+
* - ObjectPattern (destructuring): function({ x, y })
|
|
21
|
+
* - ArrayPattern (destructuring): function([a, b])
|
|
22
|
+
*
|
|
23
|
+
* @param params - AST nodes for function parameters
|
|
24
|
+
* @param functionId - ID of the parent function (for parentFunctionId field)
|
|
25
|
+
* @param file - File path
|
|
26
|
+
* @param line - Line number of the function (for ParameterInfo.line fallback)
|
|
27
|
+
* @param parameters - Array to push ParameterInfo objects into
|
|
28
|
+
* @param scopeTracker - REQUIRED for semantic ID generation
|
|
29
|
+
*/
|
|
30
|
+
export function createParameterNodes(params, functionId, file, line, parameters, scopeTracker) {
|
|
31
|
+
if (!parameters)
|
|
32
|
+
return; // Guard for backward compatibility
|
|
33
|
+
params.forEach((param, index) => {
|
|
34
|
+
// Handle different parameter types
|
|
35
|
+
if (param.type === 'Identifier') {
|
|
36
|
+
const name = param.name;
|
|
37
|
+
const paramId = computeSemanticId('PARAMETER', name, scopeTracker.getContext(), { discriminator: index });
|
|
38
|
+
parameters.push({
|
|
39
|
+
id: paramId,
|
|
40
|
+
semanticId: paramId,
|
|
41
|
+
type: 'PARAMETER',
|
|
42
|
+
name,
|
|
43
|
+
file: file,
|
|
44
|
+
line: param.loc?.start.line || line,
|
|
45
|
+
index: index,
|
|
46
|
+
parentFunctionId: functionId
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
else if (param.type === 'AssignmentPattern') {
|
|
50
|
+
// Default parameter: function(a = 1)
|
|
51
|
+
const assignmentParam = param;
|
|
52
|
+
if (assignmentParam.left.type === 'Identifier') {
|
|
53
|
+
const name = assignmentParam.left.name;
|
|
54
|
+
const paramId = computeSemanticId('PARAMETER', name, scopeTracker.getContext(), { discriminator: index });
|
|
55
|
+
parameters.push({
|
|
56
|
+
id: paramId,
|
|
57
|
+
semanticId: paramId,
|
|
58
|
+
type: 'PARAMETER',
|
|
59
|
+
name,
|
|
60
|
+
file: file,
|
|
61
|
+
line: assignmentParam.left.loc?.start.line || line,
|
|
62
|
+
index: index,
|
|
63
|
+
hasDefault: true,
|
|
64
|
+
parentFunctionId: functionId
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else if (param.type === 'RestElement') {
|
|
69
|
+
// Rest parameter: function(...args)
|
|
70
|
+
const restParam = param;
|
|
71
|
+
if (restParam.argument.type === 'Identifier') {
|
|
72
|
+
const name = restParam.argument.name;
|
|
73
|
+
const paramId = computeSemanticId('PARAMETER', name, scopeTracker.getContext(), { discriminator: index });
|
|
74
|
+
parameters.push({
|
|
75
|
+
id: paramId,
|
|
76
|
+
semanticId: paramId,
|
|
77
|
+
type: 'PARAMETER',
|
|
78
|
+
name,
|
|
79
|
+
file: file,
|
|
80
|
+
line: restParam.argument.loc?.start.line || line,
|
|
81
|
+
index: index,
|
|
82
|
+
isRest: true,
|
|
83
|
+
parentFunctionId: functionId
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// ObjectPattern and ArrayPattern (destructuring parameters) can be added later
|
|
88
|
+
});
|
|
89
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/analysis/ast/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACL,eAAe,EACf,OAAO,EACP,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,KAAK,YAAY,EAClB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Location extraction utilities for AST nodes.
|
|
3
|
+
*
|
|
4
|
+
* Convention: 0:0 means "unknown location" when AST node lacks position data.
|
|
5
|
+
* This can happen with synthetic nodes, transformed AST, or malformed source.
|
|
6
|
+
*
|
|
7
|
+
* This is the single source of truth for location extraction across all analyzers.
|
|
8
|
+
*
|
|
9
|
+
* @module location
|
|
10
|
+
*/
|
|
11
|
+
import type { Node } from '@babel/types';
|
|
12
|
+
/**
|
|
13
|
+
* Fallback location for nodes without position data.
|
|
14
|
+
* Used when AST was generated without source maps or from synthetic nodes.
|
|
15
|
+
*/
|
|
16
|
+
export declare const UNKNOWN_LOCATION: {
|
|
17
|
+
readonly line: 0;
|
|
18
|
+
readonly column: 0;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Location information extracted from an AST node.
|
|
22
|
+
* Both line and column are guaranteed to be numbers (not undefined).
|
|
23
|
+
*/
|
|
24
|
+
export interface NodeLocation {
|
|
25
|
+
readonly line: number;
|
|
26
|
+
readonly column: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Extract start location from an AST node.
|
|
30
|
+
*
|
|
31
|
+
* Returns { line: 0, column: 0 } if node is null, undefined, or lacks location data.
|
|
32
|
+
* This is the preferred way to get location info - use this instead of node.loc!
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // Instead of:
|
|
36
|
+
* const line = node.loc!.start.line;
|
|
37
|
+
* const column = node.loc!.start.column;
|
|
38
|
+
*
|
|
39
|
+
* // Use:
|
|
40
|
+
* const { line, column } = getNodeLocation(node);
|
|
41
|
+
*
|
|
42
|
+
* @param node - Babel AST node (may be null or undefined)
|
|
43
|
+
* @returns Location with line and column (both guaranteed numbers)
|
|
44
|
+
*/
|
|
45
|
+
export declare function getNodeLocation(node: Node | null | undefined): NodeLocation;
|
|
46
|
+
/**
|
|
47
|
+
* Extract start line number from an AST node.
|
|
48
|
+
*
|
|
49
|
+
* Returns 0 if node is null, undefined, or lacks location data.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* // Instead of:
|
|
53
|
+
* const line = node.loc!.start.line;
|
|
54
|
+
*
|
|
55
|
+
* // Use:
|
|
56
|
+
* const line = getLine(node);
|
|
57
|
+
*
|
|
58
|
+
* @param node - Babel AST node (may be null or undefined)
|
|
59
|
+
* @returns Line number (1-based) or 0 for unknown
|
|
60
|
+
*/
|
|
61
|
+
export declare function getLine(node: Node | null | undefined): number;
|
|
62
|
+
/**
|
|
63
|
+
* Extract start column number from an AST node.
|
|
64
|
+
*
|
|
65
|
+
* Returns 0 if node is null, undefined, or lacks location data.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* // Instead of:
|
|
69
|
+
* const col = node.loc!.start.column;
|
|
70
|
+
*
|
|
71
|
+
* // Use:
|
|
72
|
+
* const col = getColumn(node);
|
|
73
|
+
*
|
|
74
|
+
* @param node - Babel AST node (may be null or undefined)
|
|
75
|
+
* @returns Column number (0-based) or 0 for unknown
|
|
76
|
+
*/
|
|
77
|
+
export declare function getColumn(node: Node | null | undefined): number;
|
|
78
|
+
/**
|
|
79
|
+
* Extract end location from an AST node.
|
|
80
|
+
*
|
|
81
|
+
* Returns { line: 0, column: 0 } if node is null, undefined, or lacks location data.
|
|
82
|
+
*
|
|
83
|
+
* @param node - Babel AST node (may be null or undefined)
|
|
84
|
+
* @returns End location with line and column (both guaranteed numbers)
|
|
85
|
+
*/
|
|
86
|
+
export declare function getEndLocation(node: Node | null | undefined): NodeLocation;
|
|
87
|
+
//# sourceMappingURL=location.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"location.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/analysis/ast/utils/location.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;CAAkC,CAAC;AAEhE;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,YAAY,CAK3E;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAE7D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAE/D;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,YAAY,CAK1E"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fallback location for nodes without position data.
|
|
3
|
+
* Used when AST was generated without source maps or from synthetic nodes.
|
|
4
|
+
*/
|
|
5
|
+
export const UNKNOWN_LOCATION = { line: 0, column: 0 };
|
|
6
|
+
/**
|
|
7
|
+
* Extract start location from an AST node.
|
|
8
|
+
*
|
|
9
|
+
* Returns { line: 0, column: 0 } if node is null, undefined, or lacks location data.
|
|
10
|
+
* This is the preferred way to get location info - use this instead of node.loc!
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // Instead of:
|
|
14
|
+
* const line = node.loc!.start.line;
|
|
15
|
+
* const column = node.loc!.start.column;
|
|
16
|
+
*
|
|
17
|
+
* // Use:
|
|
18
|
+
* const { line, column } = getNodeLocation(node);
|
|
19
|
+
*
|
|
20
|
+
* @param node - Babel AST node (may be null or undefined)
|
|
21
|
+
* @returns Location with line and column (both guaranteed numbers)
|
|
22
|
+
*/
|
|
23
|
+
export function getNodeLocation(node) {
|
|
24
|
+
return {
|
|
25
|
+
line: node?.loc?.start?.line ?? 0,
|
|
26
|
+
column: node?.loc?.start?.column ?? 0
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Extract start line number from an AST node.
|
|
31
|
+
*
|
|
32
|
+
* Returns 0 if node is null, undefined, or lacks location data.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // Instead of:
|
|
36
|
+
* const line = node.loc!.start.line;
|
|
37
|
+
*
|
|
38
|
+
* // Use:
|
|
39
|
+
* const line = getLine(node);
|
|
40
|
+
*
|
|
41
|
+
* @param node - Babel AST node (may be null or undefined)
|
|
42
|
+
* @returns Line number (1-based) or 0 for unknown
|
|
43
|
+
*/
|
|
44
|
+
export function getLine(node) {
|
|
45
|
+
return node?.loc?.start?.line ?? 0;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Extract start column number from an AST node.
|
|
49
|
+
*
|
|
50
|
+
* Returns 0 if node is null, undefined, or lacks location data.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* // Instead of:
|
|
54
|
+
* const col = node.loc!.start.column;
|
|
55
|
+
*
|
|
56
|
+
* // Use:
|
|
57
|
+
* const col = getColumn(node);
|
|
58
|
+
*
|
|
59
|
+
* @param node - Babel AST node (may be null or undefined)
|
|
60
|
+
* @returns Column number (0-based) or 0 for unknown
|
|
61
|
+
*/
|
|
62
|
+
export function getColumn(node) {
|
|
63
|
+
return node?.loc?.start?.column ?? 0;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Extract end location from an AST node.
|
|
67
|
+
*
|
|
68
|
+
* Returns { line: 0, column: 0 } if node is null, undefined, or lacks location data.
|
|
69
|
+
*
|
|
70
|
+
* @param node - Babel AST node (may be null or undefined)
|
|
71
|
+
* @returns End location with line and column (both guaranteed numbers)
|
|
72
|
+
*/
|
|
73
|
+
export function getEndLocation(node) {
|
|
74
|
+
return {
|
|
75
|
+
line: node?.loc?.end?.line ?? 0,
|
|
76
|
+
column: node?.loc?.end?.column ?? 0
|
|
77
|
+
};
|
|
78
|
+
}
|
|
@@ -53,11 +53,13 @@ export interface VisitorCollections {
|
|
|
53
53
|
[key: string]: unknown;
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
|
-
* Location info extracted from AST node
|
|
56
|
+
* Location info extracted from AST node.
|
|
57
|
+
* Both line and column are guaranteed to be numbers (not undefined).
|
|
58
|
+
* Convention: 0:0 means "unknown location".
|
|
57
59
|
*/
|
|
58
60
|
export interface LocationInfo {
|
|
59
|
-
line: number
|
|
60
|
-
column: number
|
|
61
|
+
line: number;
|
|
62
|
+
column: number;
|
|
61
63
|
}
|
|
62
64
|
/**
|
|
63
65
|
* Handler function type for Babel traverse
|
|
@@ -86,7 +88,10 @@ export declare abstract class ASTVisitor {
|
|
|
86
88
|
*/
|
|
87
89
|
abstract getHandlers(): VisitorHandlers;
|
|
88
90
|
/**
|
|
89
|
-
* Utility to get source location info
|
|
91
|
+
* Utility to get source location info.
|
|
92
|
+
* Returns { line: 0, column: 0 } if location is unavailable.
|
|
93
|
+
*
|
|
94
|
+
* @deprecated Prefer using getLine() or getNodeLocation() directly from utils/location.js
|
|
90
95
|
*/
|
|
91
96
|
protected getLoc(node: Node): LocationInfo;
|
|
92
97
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ASTVisitor.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/analysis/ast/visitors/ASTVisitor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ASTVisitor.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/analysis/ast/visitors/ASTVisitor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAC;AAEzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EACV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IAAI,EAAE,IAAI,GAAG,YAAY;CAG3C"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getNodeLocation } from '../utils/location.js';
|
|
1
2
|
/**
|
|
2
3
|
* Base class for AST visitors
|
|
3
4
|
*/
|
|
@@ -13,12 +14,12 @@ export class ASTVisitor {
|
|
|
13
14
|
this.collections = collections;
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
|
-
* Utility to get source location info
|
|
17
|
+
* Utility to get source location info.
|
|
18
|
+
* Returns { line: 0, column: 0 } if location is unavailable.
|
|
19
|
+
*
|
|
20
|
+
* @deprecated Prefer using getLine() or getNodeLocation() directly from utils/location.js
|
|
17
21
|
*/
|
|
18
22
|
getLoc(node) {
|
|
19
|
-
return
|
|
20
|
-
line: node.loc?.start?.line,
|
|
21
|
-
column: node.loc?.start?.column
|
|
22
|
-
};
|
|
23
|
+
return getNodeLocation(node);
|
|
23
24
|
}
|
|
24
25
|
}
|
|
@@ -7,9 +7,71 @@
|
|
|
7
7
|
* - Event handlers: obj.on('event', handler)
|
|
8
8
|
* - Constructor calls: new Foo(), new Function()
|
|
9
9
|
*/
|
|
10
|
-
import type { Node, CallExpression } from '@babel/types';
|
|
10
|
+
import type { Node, CallExpression, ObjectExpression, ArrayExpression } from '@babel/types';
|
|
11
11
|
import type { NodePath } from '@babel/traverse';
|
|
12
12
|
import { ASTVisitor, type VisitorModule, type VisitorCollections, type VisitorHandlers, type CounterRef } from './ASTVisitor.js';
|
|
13
|
+
import { ScopeTracker } from '../../../../core/ScopeTracker.js';
|
|
14
|
+
/**
|
|
15
|
+
* Object literal info for OBJECT_LITERAL nodes
|
|
16
|
+
*/
|
|
17
|
+
interface ObjectLiteralInfo {
|
|
18
|
+
id: string;
|
|
19
|
+
type: 'OBJECT_LITERAL';
|
|
20
|
+
file: string;
|
|
21
|
+
line: number;
|
|
22
|
+
column: number;
|
|
23
|
+
parentCallId?: string;
|
|
24
|
+
argIndex?: number;
|
|
25
|
+
isSpread?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Object property info for HAS_PROPERTY edges
|
|
29
|
+
*/
|
|
30
|
+
interface ObjectPropertyInfo {
|
|
31
|
+
objectId: string;
|
|
32
|
+
propertyName: string;
|
|
33
|
+
valueNodeId?: string;
|
|
34
|
+
valueType: 'LITERAL' | 'VARIABLE' | 'CALL' | 'EXPRESSION' | 'OBJECT_LITERAL' | 'ARRAY_LITERAL' | 'SPREAD';
|
|
35
|
+
valueName?: string;
|
|
36
|
+
literalValue?: unknown;
|
|
37
|
+
file: string;
|
|
38
|
+
line: number;
|
|
39
|
+
column: number;
|
|
40
|
+
callLine?: number;
|
|
41
|
+
callColumn?: number;
|
|
42
|
+
nestedObjectId?: string;
|
|
43
|
+
nestedArrayId?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Array literal info for ARRAY_LITERAL nodes
|
|
47
|
+
*/
|
|
48
|
+
interface ArrayLiteralInfo {
|
|
49
|
+
id: string;
|
|
50
|
+
type: 'ARRAY_LITERAL';
|
|
51
|
+
file: string;
|
|
52
|
+
line: number;
|
|
53
|
+
column: number;
|
|
54
|
+
parentCallId?: string;
|
|
55
|
+
argIndex?: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Array element info for HAS_ELEMENT edges
|
|
59
|
+
*/
|
|
60
|
+
interface ArrayElementInfo {
|
|
61
|
+
arrayId: string;
|
|
62
|
+
index: number;
|
|
63
|
+
valueNodeId?: string;
|
|
64
|
+
valueType: 'LITERAL' | 'VARIABLE' | 'CALL' | 'EXPRESSION' | 'OBJECT_LITERAL' | 'ARRAY_LITERAL' | 'SPREAD';
|
|
65
|
+
valueName?: string;
|
|
66
|
+
literalValue?: unknown;
|
|
67
|
+
file: string;
|
|
68
|
+
line: number;
|
|
69
|
+
column: number;
|
|
70
|
+
callLine?: number;
|
|
71
|
+
callColumn?: number;
|
|
72
|
+
nestedObjectId?: string;
|
|
73
|
+
nestedArrayId?: string;
|
|
74
|
+
}
|
|
13
75
|
/**
|
|
14
76
|
* Argument info for PASSES_ARGUMENT edges
|
|
15
77
|
*/
|
|
@@ -50,7 +112,13 @@ interface LiteralInfo {
|
|
|
50
112
|
argIndex: number;
|
|
51
113
|
}
|
|
52
114
|
export declare class CallExpressionVisitor extends ASTVisitor {
|
|
53
|
-
|
|
115
|
+
private scopeTracker?;
|
|
116
|
+
/**
|
|
117
|
+
* @param module - Current module being analyzed
|
|
118
|
+
* @param collections - Must contain arrays and counter refs
|
|
119
|
+
* @param scopeTracker - Optional ScopeTracker for semantic ID generation
|
|
120
|
+
*/
|
|
121
|
+
constructor(module: VisitorModule, collections: VisitorCollections, scopeTracker?: ScopeTracker);
|
|
54
122
|
/**
|
|
55
123
|
* Extract argument information for PASSES_ARGUMENT edges
|
|
56
124
|
*/
|
|
@@ -61,14 +129,36 @@ export declare class CallExpressionVisitor extends ASTVisitor {
|
|
|
61
129
|
*/
|
|
62
130
|
extractIdentifiers(node: Node | null | undefined, identifiers?: Set<string>): string[];
|
|
63
131
|
/**
|
|
64
|
-
*
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
132
|
+
* Extract object properties and create ObjectPropertyInfo records
|
|
133
|
+
*/
|
|
134
|
+
extractObjectProperties(objectExpr: ObjectExpression, objectId: string, module: VisitorModule, objectProperties: ObjectPropertyInfo[], objectLiterals: ObjectLiteralInfo[], objectLiteralCounterRef: CounterRef, literals: LiteralInfo[], literalCounterRef: CounterRef): void;
|
|
135
|
+
/**
|
|
136
|
+
* Extract array elements and create ArrayElementInfo records
|
|
137
|
+
*/
|
|
138
|
+
extractArrayElements(arrayExpr: ArrayExpression, arrayId: string, module: VisitorModule, arrayElements: ArrayElementInfo[], arrayLiterals: ArrayLiteralInfo[], arrayLiteralCounterRef: CounterRef, objectLiterals: ObjectLiteralInfo[], objectLiteralCounterRef: CounterRef, objectProperties: ObjectPropertyInfo[], literals: LiteralInfo[], literalCounterRef: CounterRef): void;
|
|
139
|
+
/**
|
|
140
|
+
* Detect array mutation calls (push, unshift, splice) and collect mutation info
|
|
141
|
+
* for later FLOWS_INTO edge creation in GraphBuilder
|
|
142
|
+
*
|
|
143
|
+
* REG-117: Added isNested, baseObjectName, propertyName for nested mutations
|
|
144
|
+
*/
|
|
145
|
+
private detectArrayMutation;
|
|
146
|
+
/**
|
|
147
|
+
* Detect Object.assign(target, source1, source2, ...) calls
|
|
148
|
+
* Creates ObjectMutationInfo for FLOWS_INTO edge generation in GraphBuilder
|
|
149
|
+
*
|
|
150
|
+
* @param callNode - The call expression node
|
|
151
|
+
* @param module - Current module being analyzed
|
|
152
|
+
*/
|
|
153
|
+
private detectObjectAssign;
|
|
154
|
+
/**
|
|
155
|
+
* Get a stable scope ID for a function parent.
|
|
156
|
+
*
|
|
157
|
+
* Format must match what FunctionVisitor/ClassVisitor creates (semantic ID):
|
|
158
|
+
* - Module-level function: {file}->global->FUNCTION->{name}
|
|
159
|
+
* - Class method: {file}->{className}->FUNCTION->{methodName}
|
|
68
160
|
*
|
|
69
|
-
*
|
|
70
|
-
* we try to match by name+file+line:col. This may not always work for
|
|
71
|
-
* multiple arrow functions on the same line.
|
|
161
|
+
* Reconstructs scope path by walking up the AST.
|
|
72
162
|
*/
|
|
73
163
|
getFunctionScopeId(functionParent: NodePath, module: VisitorModule): string;
|
|
74
164
|
getHandlers(): VisitorHandlers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CallExpressionVisitor.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/analysis/ast/visitors/CallExpressionVisitor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAA+C,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"CallExpressionVisitor.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/analysis/ast/visitors/CallExpressionVisitor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAA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