@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
package/src/core/ASTWorker.ts
CHANGED
|
@@ -3,14 +3,24 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Receives: { filePath, moduleId, moduleName }
|
|
5
5
|
* Returns: { collections } - extracted AST data for GraphBuilder
|
|
6
|
+
*
|
|
7
|
+
* Uses ScopeTracker for semantic ID generation (REG-133).
|
|
8
|
+
* IDs are stable and don't change when unrelated code is added/removed.
|
|
6
9
|
*/
|
|
7
10
|
|
|
8
11
|
import { parentPort } from 'worker_threads';
|
|
9
12
|
import { readFileSync } from 'fs';
|
|
13
|
+
import { basename } from 'path';
|
|
10
14
|
import { parse, ParserPlugin } from '@babel/parser';
|
|
11
15
|
import traverseModule from '@babel/traverse';
|
|
12
16
|
import type { Node, ImportDeclaration, ExportNamedDeclaration, ExportDefaultDeclaration, VariableDeclaration, FunctionDeclaration, ClassDeclaration, CallExpression, Identifier, ExportSpecifier } from '@babel/types';
|
|
13
17
|
import type { NodePath, Visitor } from '@babel/traverse';
|
|
18
|
+
import { ClassNode, type ClassNodeRecord } from './nodes/ClassNode.js';
|
|
19
|
+
import { ImportNode, type ImportNodeRecord } from './nodes/ImportNode.js';
|
|
20
|
+
import { ExportNode, type ExportNodeRecord } from './nodes/ExportNode.js';
|
|
21
|
+
import { ScopeTracker } from './ScopeTracker.js';
|
|
22
|
+
import { computeSemanticId } from './SemanticId.js';
|
|
23
|
+
import { getLine, getColumn } from '../plugins/analysis/ast/utils/location.js';
|
|
14
24
|
|
|
15
25
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
26
|
const traverse = (traverseModule as any).default || traverseModule;
|
|
@@ -35,32 +45,6 @@ interface ExitMessage {
|
|
|
35
45
|
|
|
36
46
|
type WorkerMessage = ParseMessage | ExitMessage;
|
|
37
47
|
|
|
38
|
-
/**
|
|
39
|
-
* Import node structure
|
|
40
|
-
*/
|
|
41
|
-
interface ImportNode {
|
|
42
|
-
id: string;
|
|
43
|
-
type: 'IMPORT';
|
|
44
|
-
name: string;
|
|
45
|
-
importedName: string;
|
|
46
|
-
source: string;
|
|
47
|
-
file: string;
|
|
48
|
-
line: number;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Export node structure
|
|
53
|
-
*/
|
|
54
|
-
interface ExportNode {
|
|
55
|
-
id: string;
|
|
56
|
-
type: 'EXPORT';
|
|
57
|
-
name: string;
|
|
58
|
-
exportType?: string;
|
|
59
|
-
localName?: string;
|
|
60
|
-
isDefault?: boolean;
|
|
61
|
-
file: string;
|
|
62
|
-
line: number;
|
|
63
|
-
}
|
|
64
48
|
|
|
65
49
|
/**
|
|
66
50
|
* Variable declaration node
|
|
@@ -91,7 +75,6 @@ interface ClassInstantiationInfo {
|
|
|
91
75
|
*/
|
|
92
76
|
interface FunctionNode {
|
|
93
77
|
id: string;
|
|
94
|
-
stableId: string;
|
|
95
78
|
type: 'FUNCTION' | 'METHOD';
|
|
96
79
|
name: string;
|
|
97
80
|
file: string;
|
|
@@ -121,15 +104,11 @@ interface ParameterNode {
|
|
|
121
104
|
}
|
|
122
105
|
|
|
123
106
|
/**
|
|
124
|
-
* Class declaration node
|
|
107
|
+
* Class declaration node (matches ClassNodeRecord from ClassNode factory)
|
|
108
|
+
* Workers use legacy line-based IDs
|
|
125
109
|
*/
|
|
126
|
-
interface ClassDeclarationNode {
|
|
127
|
-
|
|
128
|
-
type: 'CLASS';
|
|
129
|
-
name: string;
|
|
130
|
-
file: string;
|
|
131
|
-
line: number;
|
|
132
|
-
superClass: string | null;
|
|
110
|
+
interface ClassDeclarationNode extends ClassNodeRecord {
|
|
111
|
+
// All fields inherited from ClassNodeRecord
|
|
133
112
|
}
|
|
134
113
|
|
|
135
114
|
/**
|
|
@@ -162,8 +141,8 @@ export interface ASTCollections {
|
|
|
162
141
|
classDeclarations: ClassDeclarationNode[];
|
|
163
142
|
methodCallbacks: unknown[];
|
|
164
143
|
callArguments: unknown[];
|
|
165
|
-
imports:
|
|
166
|
-
exports:
|
|
144
|
+
imports: ImportNodeRecord[];
|
|
145
|
+
exports: ExportNodeRecord[];
|
|
167
146
|
httpRequests: unknown[];
|
|
168
147
|
literals: unknown[];
|
|
169
148
|
variableAssignments: unknown[];
|
|
@@ -171,6 +150,7 @@ export interface ASTCollections {
|
|
|
171
150
|
|
|
172
151
|
/**
|
|
173
152
|
* Counters for unique IDs
|
|
153
|
+
* @deprecated Use ScopeTracker.getItemCounter() instead
|
|
174
154
|
*/
|
|
175
155
|
interface Counters {
|
|
176
156
|
ifScope: number;
|
|
@@ -203,6 +183,9 @@ interface ModuleInfo {
|
|
|
203
183
|
|
|
204
184
|
/**
|
|
205
185
|
* Parse a single module and extract all collections
|
|
186
|
+
*
|
|
187
|
+
* Uses ScopeTracker for semantic ID generation - IDs are stable
|
|
188
|
+
* and don't change when unrelated code is added/removed.
|
|
206
189
|
*/
|
|
207
190
|
function parseModule(filePath: string, moduleId: string, moduleName: string): ASTCollections {
|
|
208
191
|
const code = readFileSync(filePath, 'utf-8');
|
|
@@ -212,6 +195,10 @@ function parseModule(filePath: string, moduleId: string, moduleName: string): AS
|
|
|
212
195
|
plugins: ['jsx', 'typescript'] as ParserPlugin[]
|
|
213
196
|
});
|
|
214
197
|
|
|
198
|
+
// Create ScopeTracker for semantic ID generation
|
|
199
|
+
// Use basename for shorter, more readable IDs
|
|
200
|
+
const scopeTracker = new ScopeTracker(basename(filePath));
|
|
201
|
+
|
|
215
202
|
// Collections to extract
|
|
216
203
|
const collections: ASTCollections = {
|
|
217
204
|
functions: [],
|
|
@@ -232,18 +219,7 @@ function parseModule(filePath: string, moduleId: string, moduleName: string): AS
|
|
|
232
219
|
variableAssignments: []
|
|
233
220
|
};
|
|
234
221
|
|
|
235
|
-
//
|
|
236
|
-
const counters: Counters = {
|
|
237
|
-
ifScope: 0,
|
|
238
|
-
scope: 0,
|
|
239
|
-
varDecl: 0,
|
|
240
|
-
callSite: 0,
|
|
241
|
-
function: 0,
|
|
242
|
-
httpRequest: 0,
|
|
243
|
-
literal: 0
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
// Processed nodes tracking
|
|
222
|
+
// Processed nodes tracking (still needed for deduplication)
|
|
247
223
|
const processed: ProcessedNodes = {
|
|
248
224
|
callSites: new Set(),
|
|
249
225
|
methodCalls: new Set(),
|
|
@@ -274,54 +250,52 @@ function parseModule(filePath: string, moduleId: string, moduleName: string): AS
|
|
|
274
250
|
localName = spec.local.name;
|
|
275
251
|
}
|
|
276
252
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
253
|
+
// Babel AST guarantees node.loc exists with locations: true option
|
|
254
|
+
const importNode = ImportNode.create(
|
|
255
|
+
localName, // name
|
|
256
|
+
filePath, // file
|
|
257
|
+
getLine(node), // line (non-null - Babel guarantees location)
|
|
258
|
+
0, // column (not available in this worker)
|
|
259
|
+
source, // source
|
|
260
|
+
{ imported: importedName, local: localName }
|
|
261
|
+
);
|
|
262
|
+
collections.imports.push(importNode);
|
|
286
263
|
});
|
|
287
264
|
}
|
|
288
265
|
});
|
|
289
266
|
|
|
290
|
-
// Extract exports
|
|
267
|
+
// Extract exports using semantic IDs (via createWithContext)
|
|
291
268
|
traverse(ast, {
|
|
292
269
|
ExportNamedDeclaration(path: NodePath<ExportNamedDeclaration>) {
|
|
293
270
|
const node = path.node;
|
|
294
271
|
|
|
295
272
|
if (node.declaration) {
|
|
296
273
|
if (node.declaration.type === 'FunctionDeclaration' && node.declaration.id) {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
exportType: '
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
});
|
|
274
|
+
const exportNode = ExportNode.createWithContext(
|
|
275
|
+
node.declaration.id.name,
|
|
276
|
+
scopeTracker.getContext(),
|
|
277
|
+
{ line: getLine(node), column: 0 },
|
|
278
|
+
{ exportType: 'named' }
|
|
279
|
+
);
|
|
280
|
+
collections.exports.push(exportNode);
|
|
305
281
|
} else if (node.declaration.type === 'ClassDeclaration' && node.declaration.id) {
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
exportType: '
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
});
|
|
282
|
+
const exportNode = ExportNode.createWithContext(
|
|
283
|
+
node.declaration.id.name,
|
|
284
|
+
scopeTracker.getContext(),
|
|
285
|
+
{ line: getLine(node), column: 0 },
|
|
286
|
+
{ exportType: 'named' }
|
|
287
|
+
);
|
|
288
|
+
collections.exports.push(exportNode);
|
|
314
289
|
} else if (node.declaration.type === 'VariableDeclaration') {
|
|
315
290
|
node.declaration.declarations.forEach(decl => {
|
|
316
291
|
if (decl.id.type === 'Identifier') {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
exportType: '
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
});
|
|
292
|
+
const exportNode = ExportNode.createWithContext(
|
|
293
|
+
decl.id.name,
|
|
294
|
+
scopeTracker.getContext(),
|
|
295
|
+
{ line: getLine(node), column: 0 },
|
|
296
|
+
{ exportType: 'named' }
|
|
297
|
+
);
|
|
298
|
+
collections.exports.push(exportNode);
|
|
325
299
|
}
|
|
326
300
|
});
|
|
327
301
|
}
|
|
@@ -331,41 +305,45 @@ function parseModule(filePath: string, moduleId: string, moduleName: string): AS
|
|
|
331
305
|
node.specifiers.forEach(spec => {
|
|
332
306
|
if (spec.type !== 'ExportSpecifier') return;
|
|
333
307
|
const exportedName = spec.exported.type === 'Identifier' ? spec.exported.name : spec.exported.value;
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
308
|
+
const exportNode = ExportNode.createWithContext(
|
|
309
|
+
exportedName,
|
|
310
|
+
scopeTracker.getContext(),
|
|
311
|
+
{ line: getLine(node), column: 0 },
|
|
312
|
+
{
|
|
313
|
+
local: (spec as ExportSpecifier).local.name,
|
|
314
|
+
exportType: 'named'
|
|
315
|
+
}
|
|
316
|
+
);
|
|
317
|
+
collections.exports.push(exportNode);
|
|
342
318
|
});
|
|
343
319
|
}
|
|
344
320
|
},
|
|
345
321
|
|
|
346
322
|
ExportDefaultDeclaration(path: NodePath<ExportDefaultDeclaration>) {
|
|
347
323
|
const node = path.node;
|
|
348
|
-
let
|
|
324
|
+
let localName = 'default';
|
|
349
325
|
|
|
350
326
|
if (node.declaration.type === 'Identifier') {
|
|
351
|
-
|
|
327
|
+
localName = node.declaration.name;
|
|
352
328
|
} else if ('id' in node.declaration && node.declaration.id) {
|
|
353
|
-
|
|
329
|
+
localName = (node.declaration.id as Identifier).name;
|
|
354
330
|
}
|
|
355
331
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
332
|
+
const exportNode = ExportNode.createWithContext(
|
|
333
|
+
'default',
|
|
334
|
+
scopeTracker.getContext(),
|
|
335
|
+
{ line: getLine(node), column: 0 },
|
|
336
|
+
{
|
|
337
|
+
local: localName,
|
|
338
|
+
default: true,
|
|
339
|
+
exportType: 'default'
|
|
340
|
+
}
|
|
341
|
+
);
|
|
342
|
+
collections.exports.push(exportNode);
|
|
365
343
|
}
|
|
366
344
|
});
|
|
367
345
|
|
|
368
|
-
// Extract top-level variables
|
|
346
|
+
// Extract top-level variables using semantic IDs
|
|
369
347
|
traverse(ast, {
|
|
370
348
|
VariableDeclaration(path: NodePath<VariableDeclaration>) {
|
|
371
349
|
if (path.getFunctionParent()) return;
|
|
@@ -376,17 +354,16 @@ function parseModule(filePath: string, moduleId: string, moduleName: string): AS
|
|
|
376
354
|
node.declarations.forEach(decl => {
|
|
377
355
|
if (decl.id.type === 'Identifier') {
|
|
378
356
|
const varName = decl.id.name;
|
|
379
|
-
const line = decl.id
|
|
380
|
-
const column = decl.id.loc!.start.column;
|
|
357
|
+
const line = getLine(decl.id);
|
|
381
358
|
|
|
382
359
|
const literalValue = ExpressionEvaluator.extractLiteralValue(decl.init);
|
|
383
360
|
const isLiteral = literalValue !== null;
|
|
384
361
|
const isNewExpr = decl.init?.type === 'NewExpression';
|
|
385
362
|
const shouldBeConstant = isConst && (isLiteral || isNewExpr);
|
|
386
363
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
364
|
+
// Generate semantic ID using ScopeTracker
|
|
365
|
+
const nodeType = shouldBeConstant ? 'CONSTANT' : 'VARIABLE';
|
|
366
|
+
const varId = computeSemanticId(nodeType, varName, scopeTracker.getContext());
|
|
390
367
|
|
|
391
368
|
collections.variableDeclarations.push({
|
|
392
369
|
id: varId,
|
|
@@ -412,7 +389,7 @@ function parseModule(filePath: string, moduleId: string, moduleName: string): AS
|
|
|
412
389
|
}
|
|
413
390
|
});
|
|
414
391
|
|
|
415
|
-
// Extract functions and classes
|
|
392
|
+
// Extract functions and classes using semantic IDs
|
|
416
393
|
traverse(ast, {
|
|
417
394
|
FunctionDeclaration(path: NodePath<FunctionDeclaration>) {
|
|
418
395
|
if (path.getFunctionParent()) return;
|
|
@@ -421,35 +398,42 @@ function parseModule(filePath: string, moduleId: string, moduleName: string): AS
|
|
|
421
398
|
if (!node.id) return;
|
|
422
399
|
|
|
423
400
|
const funcName = node.id.name;
|
|
424
|
-
|
|
401
|
+
// Generate semantic ID using ScopeTracker
|
|
402
|
+
const functionId = computeSemanticId('FUNCTION', funcName, scopeTracker.getContext());
|
|
425
403
|
|
|
426
404
|
collections.functions.push({
|
|
427
405
|
id: functionId,
|
|
428
|
-
stableId: functionId,
|
|
429
406
|
type: 'FUNCTION',
|
|
430
407
|
name: funcName,
|
|
431
408
|
file: filePath,
|
|
432
|
-
line: node
|
|
433
|
-
column: node
|
|
409
|
+
line: getLine(node),
|
|
410
|
+
column: getColumn(node),
|
|
434
411
|
async: node.async || false,
|
|
435
412
|
generator: node.generator || false,
|
|
436
413
|
exported: path.parent?.type === 'ExportNamedDeclaration' || path.parent?.type === 'ExportDefaultDeclaration'
|
|
437
414
|
});
|
|
438
415
|
|
|
439
|
-
//
|
|
416
|
+
// Enter function scope for parameter extraction
|
|
417
|
+
scopeTracker.enterScope(funcName, 'FUNCTION');
|
|
418
|
+
|
|
419
|
+
// Extract parameters with semantic IDs
|
|
440
420
|
node.params.forEach((param, index) => {
|
|
441
421
|
if (param.type === 'Identifier') {
|
|
422
|
+
const paramId = computeSemanticId('PARAMETER', param.name, scopeTracker.getContext(), { discriminator: index });
|
|
442
423
|
collections.parameters.push({
|
|
443
|
-
id:
|
|
424
|
+
id: paramId,
|
|
444
425
|
type: 'PARAMETER',
|
|
445
426
|
name: param.name,
|
|
446
427
|
index,
|
|
447
428
|
functionId,
|
|
448
429
|
file: filePath,
|
|
449
|
-
line: param
|
|
430
|
+
line: getLine(param)
|
|
450
431
|
});
|
|
451
432
|
}
|
|
452
433
|
});
|
|
434
|
+
|
|
435
|
+
// Exit function scope
|
|
436
|
+
scopeTracker.exitScope();
|
|
453
437
|
},
|
|
454
438
|
|
|
455
439
|
ClassDeclaration(path: NodePath<ClassDeclaration>) {
|
|
@@ -459,33 +443,41 @@ function parseModule(filePath: string, moduleId: string, moduleName: string): AS
|
|
|
459
443
|
if (!node.id) return;
|
|
460
444
|
|
|
461
445
|
const className = node.id.name;
|
|
462
|
-
const classId = `CLASS#${className}#${filePath}#${node.loc!.start.line}`;
|
|
463
446
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
447
|
+
// Extract superClass name
|
|
448
|
+
const superClassName = node.superClass && node.superClass.type === 'Identifier'
|
|
449
|
+
? (node.superClass as Identifier).name
|
|
450
|
+
: null;
|
|
451
|
+
|
|
452
|
+
// Create CLASS node using ClassNode.createWithContext() for semantic IDs
|
|
453
|
+
const classRecord = ClassNode.createWithContext(
|
|
454
|
+
className,
|
|
455
|
+
scopeTracker.getContext(),
|
|
456
|
+
{ line: getLine(node), column: getColumn(node) },
|
|
457
|
+
{ superClass: superClassName || undefined }
|
|
458
|
+
);
|
|
472
459
|
|
|
473
|
-
|
|
460
|
+
collections.classDeclarations.push(classRecord);
|
|
461
|
+
|
|
462
|
+
// Enter class scope for method extraction
|
|
463
|
+
scopeTracker.enterScope(className, 'CLASS');
|
|
464
|
+
|
|
465
|
+
// Extract methods with semantic IDs (including class scope)
|
|
474
466
|
node.body.body.forEach(member => {
|
|
475
467
|
if (member.type === 'ClassMethod' && member.key.type === 'Identifier') {
|
|
476
468
|
const methodName = member.key.name;
|
|
477
|
-
|
|
469
|
+
// Method ID includes class scope: file->ClassName->FUNCTION->methodName
|
|
470
|
+
const methodId = computeSemanticId('FUNCTION', methodName, scopeTracker.getContext());
|
|
478
471
|
|
|
479
472
|
collections.functions.push({
|
|
480
473
|
id: methodId,
|
|
481
|
-
stableId: methodId,
|
|
482
474
|
type: 'METHOD',
|
|
483
475
|
name: methodName,
|
|
484
476
|
className,
|
|
485
|
-
classId,
|
|
477
|
+
classId: classRecord.id,
|
|
486
478
|
file: filePath,
|
|
487
|
-
line: member
|
|
488
|
-
column: member
|
|
479
|
+
line: getLine(member),
|
|
480
|
+
column: getColumn(member),
|
|
489
481
|
async: member.async || false,
|
|
490
482
|
isClassMethod: true,
|
|
491
483
|
isConstructor: member.kind === 'constructor',
|
|
@@ -493,10 +485,13 @@ function parseModule(filePath: string, moduleId: string, moduleName: string): AS
|
|
|
493
485
|
});
|
|
494
486
|
}
|
|
495
487
|
});
|
|
488
|
+
|
|
489
|
+
// Exit class scope
|
|
490
|
+
scopeTracker.exitScope();
|
|
496
491
|
}
|
|
497
492
|
});
|
|
498
493
|
|
|
499
|
-
// Extract call expressions at module level
|
|
494
|
+
// Extract call expressions at module level using semantic IDs with discriminators
|
|
500
495
|
traverse(ast, {
|
|
501
496
|
CallExpression(path: NodePath<CallExpression>) {
|
|
502
497
|
if (path.getFunctionParent()) return;
|
|
@@ -508,14 +503,19 @@ function parseModule(filePath: string, moduleId: string, moduleName: string): AS
|
|
|
508
503
|
if (processed.callSites.has(nodeKey)) return;
|
|
509
504
|
processed.callSites.add(nodeKey);
|
|
510
505
|
|
|
506
|
+
// Get discriminator for same-named calls in current scope
|
|
507
|
+
const calleeName = node.callee.name;
|
|
508
|
+
const discriminator = scopeTracker.getItemCounter(`CALL:${calleeName}`);
|
|
509
|
+
const callId = computeSemanticId('CALL', calleeName, scopeTracker.getContext(), { discriminator });
|
|
510
|
+
|
|
511
511
|
collections.callSites.push({
|
|
512
|
-
id:
|
|
512
|
+
id: callId,
|
|
513
513
|
type: 'CALL',
|
|
514
|
-
name:
|
|
514
|
+
name: calleeName,
|
|
515
515
|
file: filePath,
|
|
516
|
-
line: node
|
|
516
|
+
line: getLine(node),
|
|
517
517
|
parentScopeId: moduleId,
|
|
518
|
-
targetFunctionName:
|
|
518
|
+
targetFunctionName: calleeName
|
|
519
519
|
});
|
|
520
520
|
} else if (node.callee.type === 'MemberExpression') {
|
|
521
521
|
const obj = node.callee.object;
|
|
@@ -529,14 +529,18 @@ function parseModule(filePath: string, moduleId: string, moduleName: string): AS
|
|
|
529
529
|
const methodName = prop.name;
|
|
530
530
|
const fullName = `${objectName}.${methodName}`;
|
|
531
531
|
|
|
532
|
+
// Get discriminator for same-named method calls
|
|
533
|
+
const discriminator = scopeTracker.getItemCounter(`CALL:${fullName}`);
|
|
534
|
+
const callId = computeSemanticId('CALL', fullName, scopeTracker.getContext(), { discriminator });
|
|
535
|
+
|
|
532
536
|
collections.methodCalls.push({
|
|
533
|
-
id:
|
|
537
|
+
id: callId,
|
|
534
538
|
type: 'CALL',
|
|
535
539
|
name: fullName,
|
|
536
540
|
object: objectName,
|
|
537
541
|
method: methodName,
|
|
538
542
|
file: filePath,
|
|
539
|
-
line: node
|
|
543
|
+
line: getLine(node),
|
|
540
544
|
parentScopeId: moduleId
|
|
541
545
|
});
|
|
542
546
|
}
|