@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/dist/index.js
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @grafema/core - Core analysis engine for GraphDD
|
|
3
3
|
*/
|
|
4
|
+
// Error types
|
|
5
|
+
export { GrafemaError, ConfigError, FileAccessError, LanguageError, DatabaseError, PluginError, AnalysisError, } from './errors/GrafemaError.js';
|
|
6
|
+
// Logging
|
|
7
|
+
export { ConsoleLogger, createLogger } from './logging/Logger.js';
|
|
8
|
+
// Diagnostics
|
|
9
|
+
export { DiagnosticCollector, DiagnosticReporter, DiagnosticWriter } from './diagnostics/index.js';
|
|
10
|
+
// Config
|
|
11
|
+
export { loadConfig, DEFAULT_CONFIG } from './config/index.js';
|
|
4
12
|
// Main orchestrator
|
|
5
13
|
export { Orchestrator } from './Orchestrator.js';
|
|
6
14
|
// Plugin base
|
|
@@ -13,19 +21,56 @@ export { RFDBServerBackend } from './storage/backends/RFDBServerBackend.js';
|
|
|
13
21
|
// Core utilities
|
|
14
22
|
export { NodeFactory } from './core/NodeFactory.js';
|
|
15
23
|
export { Profiler } from './core/Profiler.js';
|
|
24
|
+
export { computeSemanticId, parseSemanticId, computeDiscriminator } from './core/SemanticId.js';
|
|
25
|
+
export { ScopeTracker } from './core/ScopeTracker.js';
|
|
16
26
|
export { AnalysisQueue } from './core/AnalysisQueue.js';
|
|
27
|
+
export { ASTWorkerPool } from './core/ASTWorkerPool.js';
|
|
17
28
|
export { GuaranteeManager } from './core/GuaranteeManager.js';
|
|
29
|
+
export { clearFileNodesIfNeeded, clearServiceNodeIfExists } from './core/FileNodeManager.js';
|
|
30
|
+
export { CoverageAnalyzer } from './core/CoverageAnalyzer.js';
|
|
31
|
+
// Hash utilities
|
|
32
|
+
export { calculateFileHash, calculateFileHashAsync, calculateContentHash } from './core/HashUtils.js';
|
|
33
|
+
// Type validation and path validation
|
|
34
|
+
export { levenshtein, checkTypoAgainstKnownTypes, resetKnownNodeTypes, getKnownNodeTypes } from './storage/backends/typeValidation.js';
|
|
35
|
+
export { PathValidator } from './validation/PathValidator.js';
|
|
36
|
+
// Version management
|
|
37
|
+
export { VersionManager, versionManager } from './core/VersionManager.js';
|
|
38
|
+
// Freshness checking and incremental reanalysis
|
|
39
|
+
export { GraphFreshnessChecker } from './core/GraphFreshnessChecker.js';
|
|
40
|
+
export { IncrementalReanalyzer } from './core/IncrementalReanalyzer.js';
|
|
18
41
|
// API
|
|
19
42
|
export { GraphAPI } from './api/GraphAPI.js';
|
|
20
43
|
export { GuaranteeAPI } from './api/GuaranteeAPI.js';
|
|
21
44
|
// Node kinds
|
|
22
45
|
export { isGuaranteeType } from './core/nodes/NodeKind.js';
|
|
46
|
+
// Issue nodes (detected problems)
|
|
47
|
+
export { IssueNode } from './core/nodes/IssueNode.js';
|
|
48
|
+
// Node contracts
|
|
49
|
+
export { FunctionNode } from './core/nodes/FunctionNode.js';
|
|
50
|
+
export { CallSiteNode } from './core/nodes/CallSiteNode.js';
|
|
51
|
+
export { MethodCallNode } from './core/nodes/MethodCallNode.js';
|
|
52
|
+
export { ScopeNode } from './core/nodes/ScopeNode.js';
|
|
53
|
+
export { ClassNode } from './core/nodes/ClassNode.js';
|
|
54
|
+
export { MethodNode } from './core/nodes/MethodNode.js';
|
|
55
|
+
export { ExportNode } from './core/nodes/ExportNode.js';
|
|
56
|
+
export { VariableDeclarationNode } from './core/nodes/VariableDeclarationNode.js';
|
|
57
|
+
export { ExternalModuleNode } from './core/nodes/ExternalModuleNode.js';
|
|
58
|
+
export { NetworkRequestNode } from './core/nodes/NetworkRequestNode.js';
|
|
59
|
+
export { InterfaceNode } from './core/nodes/InterfaceNode.js';
|
|
60
|
+
export { TypeNode } from './core/nodes/TypeNode.js';
|
|
61
|
+
export { EnumNode } from './core/nodes/EnumNode.js';
|
|
62
|
+
export { DecoratorNode } from './core/nodes/DecoratorNode.js';
|
|
63
|
+
export { ExpressionNode } from './core/nodes/ExpressionNode.js';
|
|
64
|
+
export { ArgumentExpressionNode } from './core/nodes/ArgumentExpressionNode.js';
|
|
65
|
+
// AST Visitors (for advanced usage)
|
|
66
|
+
export { ASTVisitor, ImportExportVisitor, VariableVisitor, FunctionVisitor, ClassVisitor, CallExpressionVisitor, TypeScriptVisitor } from './plugins/analysis/ast/visitors/index.js';
|
|
67
|
+
// AST Location utilities (REG-122)
|
|
68
|
+
export { getNodeLocation, getLine, getColumn, getEndLocation, UNKNOWN_LOCATION } from './plugins/analysis/ast/utils/location.js';
|
|
23
69
|
// === PLUGINS ===
|
|
24
70
|
// Indexing plugins
|
|
25
71
|
export { JSModuleIndexer } from './plugins/indexing/JSModuleIndexer.js';
|
|
26
72
|
export { IncrementalModuleIndexer } from './plugins/indexing/IncrementalModuleIndexer.js';
|
|
27
73
|
export { RustModuleIndexer } from './plugins/indexing/RustModuleIndexer.js';
|
|
28
|
-
export { ServiceDetector } from './plugins/indexing/ServiceDetector.js';
|
|
29
74
|
// Analysis plugins
|
|
30
75
|
export { JSASTAnalyzer } from './plugins/analysis/JSASTAnalyzer.js';
|
|
31
76
|
export { ExpressRouteAnalyzer } from './plugins/analysis/ExpressRouteAnalyzer.js';
|
|
@@ -57,7 +102,15 @@ export { ShadowingDetector } from './plugins/validation/ShadowingDetector.js';
|
|
|
57
102
|
export { GraphConnectivityValidator } from './plugins/validation/GraphConnectivityValidator.js';
|
|
58
103
|
export { DataFlowValidator } from './plugins/validation/DataFlowValidator.js';
|
|
59
104
|
export { TypeScriptDeadCodeValidator } from './plugins/validation/TypeScriptDeadCodeValidator.js';
|
|
105
|
+
export { NodeCreationValidator } from './plugins/validation/NodeCreationValidator.js';
|
|
60
106
|
// Discovery plugins
|
|
61
107
|
export { SimpleProjectDiscovery } from './plugins/discovery/SimpleProjectDiscovery.js';
|
|
62
108
|
export { DiscoveryPlugin } from './plugins/discovery/DiscoveryPlugin.js';
|
|
63
109
|
export { MonorepoServiceDiscovery } from './plugins/discovery/MonorepoServiceDiscovery.js';
|
|
110
|
+
export { WorkspaceDiscovery } from './plugins/discovery/WorkspaceDiscovery.js';
|
|
111
|
+
export { resolveSourceEntrypoint } from './plugins/discovery/resolveSourceEntrypoint.js';
|
|
112
|
+
// Workspace detection utilities
|
|
113
|
+
export { detectWorkspaceType, parsePnpmWorkspace, parseNpmWorkspace, parseLernaConfig, resolveWorkspacePackages } from './plugins/discovery/workspaces/index.js';
|
|
114
|
+
// VCS plugins
|
|
115
|
+
export { GitPlugin } from './plugins/vcs/GitPlugin.js';
|
|
116
|
+
export { VCSPlugin, VCSPluginFactory, FileStatus } from './plugins/vcs/VCSPlugin.js';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logger - Lightweight logging for Grafema
|
|
3
|
+
*
|
|
4
|
+
* Features:
|
|
5
|
+
* - 5 log levels: silent, errors, warnings, info, debug
|
|
6
|
+
* - Context support for structured logging
|
|
7
|
+
* - No external dependencies
|
|
8
|
+
* - Safe handling of circular references
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* const logger = createLogger('info');
|
|
12
|
+
* logger.info('Processing files', { count: 150 });
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Log level type
|
|
16
|
+
*/
|
|
17
|
+
export type LogLevel = 'silent' | 'errors' | 'warnings' | 'info' | 'debug';
|
|
18
|
+
/**
|
|
19
|
+
* Logger interface
|
|
20
|
+
*/
|
|
21
|
+
export interface Logger {
|
|
22
|
+
error(message: string, context?: Record<string, unknown>): void;
|
|
23
|
+
warn(message: string, context?: Record<string, unknown>): void;
|
|
24
|
+
info(message: string, context?: Record<string, unknown>): void;
|
|
25
|
+
debug(message: string, context?: Record<string, unknown>): void;
|
|
26
|
+
trace(message: string, context?: Record<string, unknown>): void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Console-based Logger implementation
|
|
30
|
+
*
|
|
31
|
+
* Respects log level threshold - methods below threshold are no-ops.
|
|
32
|
+
*/
|
|
33
|
+
export declare class ConsoleLogger implements Logger {
|
|
34
|
+
private readonly level;
|
|
35
|
+
private readonly priority;
|
|
36
|
+
constructor(logLevel?: LogLevel);
|
|
37
|
+
private shouldLog;
|
|
38
|
+
error(message: string, context?: Record<string, unknown>): void;
|
|
39
|
+
warn(message: string, context?: Record<string, unknown>): void;
|
|
40
|
+
info(message: string, context?: Record<string, unknown>): void;
|
|
41
|
+
debug(message: string, context?: Record<string, unknown>): void;
|
|
42
|
+
trace(message: string, context?: Record<string, unknown>): void;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Create a Logger instance with the specified log level
|
|
46
|
+
*/
|
|
47
|
+
export declare function createLogger(level: LogLevel): Logger;
|
|
48
|
+
//# sourceMappingURL=Logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../src/logging/Logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAChE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC/D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC/D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAChE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CACjE;AAsDD;;;;GAIG;AACH,qBAAa,aAAc,YAAW,MAAM;IAC1C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAW;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAEtB,QAAQ,GAAE,QAAiB;IAKvC,OAAO,CAAC,SAAS;IAIjB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAS/D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAS9D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAS9D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAS/D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAQhE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAEpD"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logger - Lightweight logging for Grafema
|
|
3
|
+
*
|
|
4
|
+
* Features:
|
|
5
|
+
* - 5 log levels: silent, errors, warnings, info, debug
|
|
6
|
+
* - Context support for structured logging
|
|
7
|
+
* - No external dependencies
|
|
8
|
+
* - Safe handling of circular references
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* const logger = createLogger('info');
|
|
12
|
+
* logger.info('Processing files', { count: 150 });
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Log level priorities (higher = more verbose)
|
|
16
|
+
*/
|
|
17
|
+
const LOG_LEVEL_PRIORITY = {
|
|
18
|
+
silent: 0,
|
|
19
|
+
errors: 1,
|
|
20
|
+
warnings: 2,
|
|
21
|
+
info: 3,
|
|
22
|
+
debug: 4,
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Minimum level required for each method
|
|
26
|
+
*/
|
|
27
|
+
const METHOD_LEVELS = {
|
|
28
|
+
error: LOG_LEVEL_PRIORITY.errors,
|
|
29
|
+
warn: LOG_LEVEL_PRIORITY.warnings,
|
|
30
|
+
info: LOG_LEVEL_PRIORITY.info,
|
|
31
|
+
debug: LOG_LEVEL_PRIORITY.debug,
|
|
32
|
+
trace: LOG_LEVEL_PRIORITY.debug,
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Safe JSON stringify that handles circular references
|
|
36
|
+
*/
|
|
37
|
+
function safeStringify(obj) {
|
|
38
|
+
const seen = new WeakSet();
|
|
39
|
+
return JSON.stringify(obj, (_key, value) => {
|
|
40
|
+
if (typeof value === 'object' && value !== null) {
|
|
41
|
+
if (seen.has(value)) {
|
|
42
|
+
return '[Circular]';
|
|
43
|
+
}
|
|
44
|
+
seen.add(value);
|
|
45
|
+
}
|
|
46
|
+
return value;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Format log message with optional context
|
|
51
|
+
*/
|
|
52
|
+
function formatMessage(message, context) {
|
|
53
|
+
if (!context || Object.keys(context).length === 0) {
|
|
54
|
+
return message;
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
return `${message} ${safeStringify(context)}`;
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return `${message} [context serialization failed]`;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Console-based Logger implementation
|
|
65
|
+
*
|
|
66
|
+
* Respects log level threshold - methods below threshold are no-ops.
|
|
67
|
+
*/
|
|
68
|
+
export class ConsoleLogger {
|
|
69
|
+
level;
|
|
70
|
+
priority;
|
|
71
|
+
constructor(logLevel = 'info') {
|
|
72
|
+
this.level = logLevel;
|
|
73
|
+
this.priority = LOG_LEVEL_PRIORITY[logLevel];
|
|
74
|
+
}
|
|
75
|
+
shouldLog(methodLevel) {
|
|
76
|
+
return this.priority >= methodLevel;
|
|
77
|
+
}
|
|
78
|
+
error(message, context) {
|
|
79
|
+
if (!this.shouldLog(METHOD_LEVELS.error))
|
|
80
|
+
return;
|
|
81
|
+
try {
|
|
82
|
+
console.error(formatMessage(`[ERROR] ${message}`, context));
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
console.log(`[ERROR] ${message} [logging failed]`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
warn(message, context) {
|
|
89
|
+
if (!this.shouldLog(METHOD_LEVELS.warn))
|
|
90
|
+
return;
|
|
91
|
+
try {
|
|
92
|
+
console.warn(formatMessage(`[WARN] ${message}`, context));
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
console.log(`[WARN] ${message} [logging failed]`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
info(message, context) {
|
|
99
|
+
if (!this.shouldLog(METHOD_LEVELS.info))
|
|
100
|
+
return;
|
|
101
|
+
try {
|
|
102
|
+
console.info(formatMessage(`[INFO] ${message}`, context));
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
console.log(`[INFO] ${message} [logging failed]`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
debug(message, context) {
|
|
109
|
+
if (!this.shouldLog(METHOD_LEVELS.debug))
|
|
110
|
+
return;
|
|
111
|
+
try {
|
|
112
|
+
console.debug(formatMessage(`[DEBUG] ${message}`, context));
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
console.log(`[DEBUG] ${message} [logging failed]`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
trace(message, context) {
|
|
119
|
+
if (!this.shouldLog(METHOD_LEVELS.trace))
|
|
120
|
+
return;
|
|
121
|
+
try {
|
|
122
|
+
console.debug(formatMessage(`[TRACE] ${message}`, context));
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
console.log(`[TRACE] ${message} [logging failed]`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Create a Logger instance with the specified log level
|
|
131
|
+
*/
|
|
132
|
+
export function createLogger(level) {
|
|
133
|
+
return new ConsoleLogger(level);
|
|
134
|
+
}
|
package/dist/plugins/Plugin.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* 2. Execute - plugin logic execution
|
|
8
8
|
* 3. Return value - PluginResult
|
|
9
9
|
*/
|
|
10
|
-
import type { PluginMetadata, PluginContext, PluginResult, IPlugin } from '@grafema/types';
|
|
10
|
+
import type { PluginMetadata, PluginContext, PluginResult, IPlugin, Logger } from '@grafema/types';
|
|
11
11
|
import type { NodeRecord } from '@grafema/types';
|
|
12
12
|
export type { PluginMetadata, PluginContext, PluginResult, IPlugin };
|
|
13
13
|
export { createSuccessResult, createErrorResult } from '@grafema/types';
|
|
@@ -40,5 +40,9 @@ export declare abstract class Plugin implements IPlugin {
|
|
|
40
40
|
* Works with RFDBServerBackend
|
|
41
41
|
*/
|
|
42
42
|
getModules(graph: PluginContext['graph']): Promise<NodeRecord[]>;
|
|
43
|
+
/**
|
|
44
|
+
* Get a logger from context with console fallback for backward compatibility.
|
|
45
|
+
*/
|
|
46
|
+
protected log(context: PluginContext): Logger;
|
|
43
47
|
}
|
|
44
48
|
//# sourceMappingURL=Plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/plugins/Plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,YAAY,EACZ,OAAO,
|
|
1
|
+
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/plugins/Plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,YAAY,EACZ,OAAO,EAEP,MAAM,EACP,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC;AAGrE,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExE;;GAEG;AACH,8BAAsB,MAAO,YAAW,OAAO;IAC7C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAEpB,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;IAIhD;;OAEG;IACH,QAAQ,KAAK,QAAQ,IAAI,cAAc,CAAC;IAExC;;;OAGG;IACG,UAAU,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxD;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAE/D;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B;;;OAGG;IACG,UAAU,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAStE;;OAEG;IACH,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM;CAqC9C"}
|
package/dist/plugins/Plugin.js
CHANGED
|
@@ -43,4 +43,37 @@ export class Plugin {
|
|
|
43
43
|
}
|
|
44
44
|
return modules;
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Get a logger from context with console fallback for backward compatibility.
|
|
48
|
+
*/
|
|
49
|
+
log(context) {
|
|
50
|
+
if (context.logger) {
|
|
51
|
+
return context.logger;
|
|
52
|
+
}
|
|
53
|
+
// Fallback to console for backward compatibility
|
|
54
|
+
const safeStringify = (obj) => {
|
|
55
|
+
try {
|
|
56
|
+
const seen = new WeakSet();
|
|
57
|
+
return JSON.stringify(obj, (_key, value) => {
|
|
58
|
+
if (typeof value === 'object' && value !== null) {
|
|
59
|
+
if (seen.has(value))
|
|
60
|
+
return '[Circular]';
|
|
61
|
+
seen.add(value);
|
|
62
|
+
}
|
|
63
|
+
return value;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return '[serialization failed]';
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const format = (msg, ctx) => ctx ? `${msg} ${safeStringify(ctx)}` : msg;
|
|
71
|
+
return {
|
|
72
|
+
error: (msg, ctx) => console.error(`[ERROR] ${format(msg, ctx)}`),
|
|
73
|
+
warn: (msg, ctx) => console.warn(`[WARN] ${format(msg, ctx)}`),
|
|
74
|
+
info: (msg, ctx) => console.log(`[INFO] ${format(msg, ctx)}`),
|
|
75
|
+
debug: (msg, ctx) => console.debug(`[DEBUG] ${format(msg, ctx)}`),
|
|
76
|
+
trace: (msg, ctx) => console.debug(`[TRACE] ${format(msg, ctx)}`),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
46
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatabaseAnalyzer.d.ts","sourceRoot":"","sources":["../../../src/plugins/analysis/DatabaseAnalyzer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,MAAM,EAA0C,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"DatabaseAnalyzer.d.ts","sourceRoot":"","sources":["../../../src/plugins/analysis/DatabaseAnalyzer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,MAAM,EAA0C,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAgChF,qBAAa,gBAAiB,SAAQ,MAAM;IAC1C,IAAI,QAAQ,IAAI,cAAc,CAW7B;IAEK,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAyD5D;;OAEG;YACW,YAAY;IAQ1B;;OAEG;YACW,aAAa;IAsL3B;;OAEG;IACH,OAAO,CAAC,kBAAkB;CAc3B"}
|
|
@@ -6,6 +6,7 @@ import { readFileSync } from 'fs';
|
|
|
6
6
|
import { parse } from '@babel/parser';
|
|
7
7
|
import traverseModule from '@babel/traverse';
|
|
8
8
|
import { Plugin, createSuccessResult, createErrorResult } from '../Plugin.js';
|
|
9
|
+
import { getLine } from './ast/utils/location.js';
|
|
9
10
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
11
|
const traverse = traverseModule.default || traverseModule;
|
|
11
12
|
export class DatabaseAnalyzer extends Plugin {
|
|
@@ -22,11 +23,12 @@ export class DatabaseAnalyzer extends Plugin {
|
|
|
22
23
|
};
|
|
23
24
|
}
|
|
24
25
|
async execute(context) {
|
|
26
|
+
const logger = this.log(context);
|
|
25
27
|
try {
|
|
26
28
|
const { graph } = context;
|
|
27
29
|
// Получаем все MODULE ноды
|
|
28
30
|
const modules = await this.getModules(graph);
|
|
29
|
-
|
|
31
|
+
logger.info('Processing modules', { count: modules.length });
|
|
30
32
|
// Получаем все FUNCTION ноды для связывания
|
|
31
33
|
const functions = await this.getFunctions(graph);
|
|
32
34
|
let queriesCreated = 0;
|
|
@@ -44,10 +46,15 @@ export class DatabaseAnalyzer extends Plugin {
|
|
|
44
46
|
if ((i + 1) % 20 === 0 || i === modules.length - 1) {
|
|
45
47
|
const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
|
|
46
48
|
const avgTime = ((Date.now() - startTime) / (i + 1)).toFixed(0);
|
|
47
|
-
|
|
49
|
+
logger.debug('Progress', {
|
|
50
|
+
current: i + 1,
|
|
51
|
+
total: modules.length,
|
|
52
|
+
elapsed: `${elapsed}s`,
|
|
53
|
+
avgTime: `${avgTime}ms/module`
|
|
54
|
+
});
|
|
48
55
|
}
|
|
49
56
|
}
|
|
50
|
-
|
|
57
|
+
logger.info('Analysis complete', { queriesCreated, tablesCreated });
|
|
51
58
|
return createSuccessResult({
|
|
52
59
|
nodes: queriesCreated + tablesCreated,
|
|
53
60
|
edges: edgesCreated
|
|
@@ -57,7 +64,7 @@ export class DatabaseAnalyzer extends Plugin {
|
|
|
57
64
|
});
|
|
58
65
|
}
|
|
59
66
|
catch (error) {
|
|
60
|
-
|
|
67
|
+
logger.error('Analysis failed', { error });
|
|
61
68
|
return createErrorResult(error);
|
|
62
69
|
}
|
|
63
70
|
}
|
|
@@ -170,7 +177,7 @@ export class DatabaseAnalyzer extends Plugin {
|
|
|
170
177
|
object: objectName,
|
|
171
178
|
method: methodName,
|
|
172
179
|
file: module.file,
|
|
173
|
-
line: node
|
|
180
|
+
line: getLine(node)
|
|
174
181
|
});
|
|
175
182
|
}
|
|
176
183
|
}
|
|
@@ -235,7 +242,7 @@ export class DatabaseAnalyzer extends Plugin {
|
|
|
235
242
|
}
|
|
236
243
|
}
|
|
237
244
|
catch (error) {
|
|
238
|
-
|
|
245
|
+
// Silent - per-module errors shouldn't spam logs
|
|
239
246
|
}
|
|
240
247
|
return {
|
|
241
248
|
queries: queriesCreated,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpressAnalyzer.d.ts","sourceRoot":"","sources":["../../../src/plugins/analysis/ExpressAnalyzer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,MAAM,EAA0C,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ExpressAnalyzer.d.ts","sourceRoot":"","sources":["../../../src/plugins/analysis/ExpressAnalyzer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,MAAM,EAA0C,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAsDhF,qBAAa,eAAgB,SAAQ,MAAM;IACzC,IAAI,QAAQ,IAAI,cAAc,CAW7B;IAEK,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IA2C5D;;OAEG;YACW,aAAa;IA6N3B;;OAEG;YACW,gBAAgB;CA4D/B"}
|
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
import { readFileSync } from 'fs';
|
|
6
6
|
import { parse } from '@babel/parser';
|
|
7
7
|
import traverseModule from '@babel/traverse';
|
|
8
|
-
import { dirname, resolve } from 'path';
|
|
8
|
+
import { dirname, resolve, relative } from 'path';
|
|
9
9
|
import { Plugin, createSuccessResult, createErrorResult } from '../Plugin.js';
|
|
10
|
+
import { NetworkRequestNode } from '../../core/nodes/NetworkRequestNode.js';
|
|
11
|
+
import { getLine } from './ast/utils/location.js';
|
|
10
12
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
13
|
const traverse = traverseModule.default || traverseModule;
|
|
12
14
|
export class ExpressAnalyzer extends Plugin {
|
|
@@ -23,16 +25,12 @@ export class ExpressAnalyzer extends Plugin {
|
|
|
23
25
|
};
|
|
24
26
|
}
|
|
25
27
|
async execute(context) {
|
|
28
|
+
const logger = this.log(context);
|
|
26
29
|
try {
|
|
27
30
|
const { graph } = context;
|
|
28
|
-
//
|
|
29
|
-
const
|
|
30
|
-
await graph.addNode(
|
|
31
|
-
id: networkId,
|
|
32
|
-
type: 'net:request',
|
|
33
|
-
name: '__network__',
|
|
34
|
-
description: 'External HTTP network'
|
|
35
|
-
});
|
|
31
|
+
// Create net:request singleton (GraphBackend handles deduplication)
|
|
32
|
+
const networkNode = NetworkRequestNode.create();
|
|
33
|
+
await graph.addNode(networkNode);
|
|
36
34
|
// Получаем все MODULE ноды
|
|
37
35
|
const modules = await this.getModules(graph);
|
|
38
36
|
let endpointsCreated = 0;
|
|
@@ -40,12 +38,12 @@ export class ExpressAnalyzer extends Plugin {
|
|
|
40
38
|
let edgesCreated = 0;
|
|
41
39
|
// Анализируем каждый модуль
|
|
42
40
|
for (const module of modules) {
|
|
43
|
-
const result = await this.analyzeModule(module, graph,
|
|
41
|
+
const result = await this.analyzeModule(module, graph, networkNode.id);
|
|
44
42
|
endpointsCreated += result.endpoints;
|
|
45
43
|
mountPointsCreated += result.mountPoints;
|
|
46
44
|
edgesCreated += result.edges;
|
|
47
45
|
}
|
|
48
|
-
|
|
46
|
+
logger.info('Analysis complete', { endpointsCreated, mountPointsCreated });
|
|
49
47
|
return createSuccessResult({
|
|
50
48
|
nodes: endpointsCreated + mountPointsCreated + 1, // +1 для EXTERNAL_NETWORK
|
|
51
49
|
edges: edgesCreated
|
|
@@ -55,7 +53,7 @@ export class ExpressAnalyzer extends Plugin {
|
|
|
55
53
|
});
|
|
56
54
|
}
|
|
57
55
|
catch (error) {
|
|
58
|
-
|
|
56
|
+
logger.error('Analysis failed', { error });
|
|
59
57
|
return createErrorResult(error);
|
|
60
58
|
}
|
|
61
59
|
}
|
|
@@ -97,7 +95,7 @@ export class ExpressAnalyzer extends Plugin {
|
|
|
97
95
|
imports.push({
|
|
98
96
|
source,
|
|
99
97
|
specifiers,
|
|
100
|
-
line: importNode
|
|
98
|
+
line: getLine(importNode)
|
|
101
99
|
});
|
|
102
100
|
}
|
|
103
101
|
});
|
|
@@ -126,13 +124,13 @@ export class ExpressAnalyzer extends Plugin {
|
|
|
126
124
|
if (routePath) {
|
|
127
125
|
const method = methodName.toUpperCase();
|
|
128
126
|
endpoints.push({
|
|
129
|
-
id: `http:route#${method}:${routePath}#${module.file}#${node
|
|
127
|
+
id: `http:route#${method}:${routePath}#${module.file}#${getLine(node)}`,
|
|
130
128
|
type: 'http:route',
|
|
131
129
|
method: method,
|
|
132
130
|
path: routePath,
|
|
133
131
|
localPath: routePath,
|
|
134
132
|
file: module.file,
|
|
135
|
-
line: node
|
|
133
|
+
line: getLine(node),
|
|
136
134
|
mountedOn: objectName
|
|
137
135
|
});
|
|
138
136
|
}
|
|
@@ -205,13 +203,13 @@ export class ExpressAnalyzer extends Plugin {
|
|
|
205
203
|
// Создаём mount point
|
|
206
204
|
if ((targetFunction || targetVariable) && prefix) {
|
|
207
205
|
mountPoints.push({
|
|
208
|
-
id: `express:mount#${prefix}#${module.file}#${node
|
|
206
|
+
id: `express:mount#${prefix}#${module.file}#${getLine(node)}`,
|
|
209
207
|
type: 'express:mount',
|
|
210
208
|
prefix: prefix,
|
|
211
209
|
targetFunction: targetFunction,
|
|
212
210
|
targetVariable: targetVariable,
|
|
213
211
|
file: module.file,
|
|
214
|
-
line: node
|
|
212
|
+
line: getLine(node),
|
|
215
213
|
mountedOn: objectName
|
|
216
214
|
});
|
|
217
215
|
}
|
|
@@ -255,7 +253,7 @@ export class ExpressAnalyzer extends Plugin {
|
|
|
255
253
|
}
|
|
256
254
|
}
|
|
257
255
|
catch (error) {
|
|
258
|
-
|
|
256
|
+
// Silent - per-module errors shouldn't spam logs
|
|
259
257
|
}
|
|
260
258
|
return {
|
|
261
259
|
endpoints: endpointsCreated,
|
|
@@ -289,7 +287,17 @@ export class ExpressAnalyzer extends Plugin {
|
|
|
289
287
|
}
|
|
290
288
|
// Если нашли целевой модуль, создаем MOUNTS ребро
|
|
291
289
|
if (targetModulePath) {
|
|
292
|
-
|
|
290
|
+
// Derive project root from module's absolute and relative paths
|
|
291
|
+
// module.file is absolute path, module.name is relative path
|
|
292
|
+
const moduleAbsPath = module.file;
|
|
293
|
+
const moduleRelPath = module.name;
|
|
294
|
+
// projectRoot = absolute path minus relative path suffix
|
|
295
|
+
const projectRoot = moduleAbsPath.endsWith(moduleRelPath)
|
|
296
|
+
? moduleAbsPath.slice(0, moduleAbsPath.length - moduleRelPath.length)
|
|
297
|
+
: dirname(moduleAbsPath); // fallback
|
|
298
|
+
// Convert target absolute path to relative path for semantic ID
|
|
299
|
+
const targetRelativePath = relative(projectRoot, targetModulePath);
|
|
300
|
+
const targetModuleId = `${targetRelativePath}->global->MODULE->module`;
|
|
293
301
|
// Проверяем что модуль существует в графе
|
|
294
302
|
const targetModule = await graph.getNode(targetModuleId);
|
|
295
303
|
if (targetModule) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpressRouteAnalyzer.d.ts","sourceRoot":"","sources":["../../../src/plugins/analysis/ExpressRouteAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,OAAO,EAAE,MAAM,EAA0C,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ExpressRouteAnalyzer.d.ts","sourceRoot":"","sources":["../../../src/plugins/analysis/ExpressRouteAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,OAAO,EAAE,MAAM,EAA0C,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AA+ChF,qBAAa,oBAAqB,SAAQ,MAAM;IAC9C,IAAI,QAAQ,IAAI,cAAc,CAW7B;IAEK,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;YAmD9C,aAAa;CA8R5B"}
|