@grafema/core 0.1.1-alpha → 0.2.0-beta
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/dist/Orchestrator.d.ts +7 -0
- package/dist/Orchestrator.d.ts.map +1 -1
- package/dist/Orchestrator.js +25 -3
- package/dist/config/ConfigLoader.d.ts +18 -0
- package/dist/config/ConfigLoader.d.ts.map +1 -1
- package/dist/config/ConfigLoader.js +65 -3
- package/dist/core/FileExplainer.d.ts +101 -0
- package/dist/core/FileExplainer.d.ts.map +1 -0
- package/dist/core/FileExplainer.js +139 -0
- package/dist/core/NodeFactory.d.ts +44 -5
- package/dist/core/NodeFactory.d.ts.map +1 -1
- package/dist/core/NodeFactory.js +52 -7
- package/dist/core/nodes/ArrayLiteralNode.d.ts.map +1 -1
- package/dist/core/nodes/ArrayLiteralNode.js +4 -2
- package/dist/core/nodes/BranchNode.d.ts +41 -0
- package/dist/core/nodes/BranchNode.d.ts.map +1 -0
- package/dist/core/nodes/BranchNode.js +82 -0
- package/dist/core/nodes/CallSiteNode.d.ts +2 -2
- package/dist/core/nodes/CallSiteNode.d.ts.map +1 -1
- package/dist/core/nodes/CallSiteNode.js +9 -5
- package/dist/core/nodes/CaseNode.d.ts +43 -0
- package/dist/core/nodes/CaseNode.d.ts.map +1 -0
- package/dist/core/nodes/CaseNode.js +81 -0
- package/dist/core/nodes/ClassNode.d.ts +2 -2
- package/dist/core/nodes/ClassNode.d.ts.map +1 -1
- package/dist/core/nodes/ClassNode.js +8 -4
- package/dist/core/nodes/ConstantNode.d.ts +2 -2
- package/dist/core/nodes/ConstantNode.d.ts.map +1 -1
- package/dist/core/nodes/ConstantNode.js +6 -4
- package/dist/core/nodes/ConstructorCallNode.d.ts +51 -0
- package/dist/core/nodes/ConstructorCallNode.d.ts.map +1 -0
- package/dist/core/nodes/ConstructorCallNode.js +171 -0
- package/dist/core/nodes/DatabaseQueryNode.d.ts +3 -2
- package/dist/core/nodes/DatabaseQueryNode.d.ts.map +1 -1
- package/dist/core/nodes/DatabaseQueryNode.js +5 -2
- package/dist/core/nodes/DecoratorNode.d.ts +2 -2
- package/dist/core/nodes/DecoratorNode.d.ts.map +1 -1
- package/dist/core/nodes/DecoratorNode.js +5 -3
- package/dist/core/nodes/EnumNode.d.ts +2 -2
- package/dist/core/nodes/EnumNode.d.ts.map +1 -1
- package/dist/core/nodes/EnumNode.js +5 -3
- package/dist/core/nodes/EventListenerNode.d.ts +4 -4
- package/dist/core/nodes/EventListenerNode.d.ts.map +1 -1
- package/dist/core/nodes/EventListenerNode.js +7 -4
- package/dist/core/nodes/ExportNode.d.ts +2 -2
- package/dist/core/nodes/ExportNode.d.ts.map +1 -1
- package/dist/core/nodes/ExportNode.js +8 -4
- package/dist/core/nodes/ExpressionNode.d.ts +2 -2
- package/dist/core/nodes/ExpressionNode.d.ts.map +1 -1
- package/dist/core/nodes/ExpressionNode.js +6 -4
- package/dist/core/nodes/ExternalModuleNode.d.ts +4 -0
- package/dist/core/nodes/ExternalModuleNode.d.ts.map +1 -1
- package/dist/core/nodes/ExternalModuleNode.js +10 -2
- package/dist/core/nodes/HttpRequestNode.d.ts +4 -4
- package/dist/core/nodes/HttpRequestNode.d.ts.map +1 -1
- package/dist/core/nodes/HttpRequestNode.js +7 -4
- package/dist/core/nodes/ImportNode.d.ts +10 -2
- package/dist/core/nodes/ImportNode.d.ts.map +1 -1
- package/dist/core/nodes/ImportNode.js +21 -4
- package/dist/core/nodes/InterfaceNode.d.ts +2 -2
- package/dist/core/nodes/InterfaceNode.d.ts.map +1 -1
- package/dist/core/nodes/InterfaceNode.js +5 -3
- package/dist/core/nodes/LiteralNode.d.ts +2 -2
- package/dist/core/nodes/LiteralNode.d.ts.map +1 -1
- package/dist/core/nodes/LiteralNode.js +6 -4
- package/dist/core/nodes/MethodCallNode.d.ts +2 -2
- package/dist/core/nodes/MethodCallNode.d.ts.map +1 -1
- package/dist/core/nodes/MethodCallNode.js +9 -5
- package/dist/core/nodes/MethodNode.d.ts +2 -2
- package/dist/core/nodes/MethodNode.d.ts.map +1 -1
- package/dist/core/nodes/MethodNode.js +8 -4
- package/dist/core/nodes/ObjectLiteralNode.d.ts.map +1 -1
- package/dist/core/nodes/ObjectLiteralNode.js +4 -2
- package/dist/core/nodes/ParameterNode.d.ts +2 -2
- package/dist/core/nodes/ParameterNode.d.ts.map +1 -1
- package/dist/core/nodes/ParameterNode.js +5 -3
- package/dist/core/nodes/TypeNode.d.ts +2 -2
- package/dist/core/nodes/TypeNode.d.ts.map +1 -1
- package/dist/core/nodes/TypeNode.js +5 -3
- package/dist/core/nodes/VariableDeclarationNode.d.ts +2 -2
- package/dist/core/nodes/VariableDeclarationNode.d.ts.map +1 -1
- package/dist/core/nodes/VariableDeclarationNode.js +9 -5
- package/dist/core/nodes/index.d.ts +3 -0
- package/dist/core/nodes/index.d.ts.map +1 -1
- package/dist/core/nodes/index.js +3 -0
- package/dist/data/builtins/BuiltinRegistry.d.ts +78 -0
- package/dist/data/builtins/BuiltinRegistry.d.ts.map +1 -0
- package/dist/data/builtins/BuiltinRegistry.js +110 -0
- package/dist/data/builtins/definitions.d.ts +28 -0
- package/dist/data/builtins/definitions.d.ts.map +1 -0
- package/dist/data/builtins/definitions.js +250 -0
- package/dist/data/builtins/index.d.ts +10 -0
- package/dist/data/builtins/index.d.ts.map +1 -0
- package/dist/data/builtins/index.js +8 -0
- package/dist/data/builtins/jsGlobals.d.ts +18 -0
- package/dist/data/builtins/jsGlobals.d.ts.map +1 -0
- package/dist/data/builtins/jsGlobals.js +26 -0
- package/dist/data/builtins/types.d.ts +34 -0
- package/dist/data/builtins/types.d.ts.map +1 -0
- package/dist/data/builtins/types.js +7 -0
- package/dist/data/globals/definitions.d.ts +27 -0
- package/dist/data/globals/definitions.d.ts.map +1 -0
- package/dist/data/globals/definitions.js +117 -0
- package/dist/data/globals/index.d.ts +36 -0
- package/dist/data/globals/index.d.ts.map +1 -0
- package/dist/data/globals/index.js +52 -0
- package/dist/diagnostics/DiagnosticReporter.d.ts +23 -0
- package/dist/diagnostics/DiagnosticReporter.d.ts.map +1 -1
- package/dist/diagnostics/DiagnosticReporter.js +88 -0
- package/dist/diagnostics/index.d.ts +1 -1
- package/dist/diagnostics/index.d.ts.map +1 -1
- package/dist/errors/GrafemaError.d.ts +43 -0
- package/dist/errors/GrafemaError.d.ts.map +1 -1
- package/dist/errors/GrafemaError.js +50 -0
- package/dist/index.d.ts +17 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -1
- package/dist/plugins/analysis/DatabaseAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/DatabaseAnalyzer.js +3 -2
- package/dist/plugins/analysis/ExpressAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/ExpressAnalyzer.js +3 -1
- package/dist/plugins/analysis/ExpressResponseAnalyzer.d.ts +148 -0
- package/dist/plugins/analysis/ExpressResponseAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/ExpressResponseAnalyzer.js +495 -0
- package/dist/plugins/analysis/ExpressRouteAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/ExpressRouteAnalyzer.js +53 -18
- package/dist/plugins/analysis/FetchAnalyzer.d.ts +40 -0
- package/dist/plugins/analysis/FetchAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/FetchAnalyzer.js +163 -15
- package/dist/plugins/analysis/JSASTAnalyzer.d.ts +157 -26
- package/dist/plugins/analysis/JSASTAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/JSASTAnalyzer.js +2418 -191
- package/dist/plugins/analysis/RustAnalyzer.js +4 -4
- package/dist/plugins/analysis/SQLiteAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/SQLiteAnalyzer.js +4 -2
- package/dist/plugins/analysis/SocketIOAnalyzer.d.ts +9 -0
- package/dist/plugins/analysis/SocketIOAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/SocketIOAnalyzer.js +91 -7
- package/dist/plugins/analysis/ast/GraphBuilder.d.ts +173 -0
- package/dist/plugins/analysis/ast/GraphBuilder.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/GraphBuilder.js +1256 -65
- package/dist/plugins/analysis/ast/types.d.ts +294 -0
- package/dist/plugins/analysis/ast/types.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/ASTVisitor.d.ts +5 -1
- package/dist/plugins/analysis/ast/visitors/ASTVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.d.ts +1 -0
- package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.js +12 -1
- package/dist/plugins/analysis/ast/visitors/FunctionVisitor.d.ts +10 -0
- package/dist/plugins/analysis/ast/visitors/FunctionVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/FunctionVisitor.js +62 -0
- package/dist/plugins/analysis/ast/visitors/ImportExportVisitor.d.ts +4 -0
- package/dist/plugins/analysis/ast/visitors/ImportExportVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/ImportExportVisitor.js +101 -0
- package/dist/plugins/analysis/ast/visitors/VariableVisitor.d.ts +16 -1
- package/dist/plugins/analysis/ast/visitors/VariableVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/VariableVisitor.js +233 -39
- package/dist/plugins/discovery/WorkspaceDiscovery.d.ts.map +1 -1
- package/dist/plugins/discovery/WorkspaceDiscovery.js +9 -4
- package/dist/plugins/enrichment/AliasTracker.d.ts.map +1 -1
- package/dist/plugins/enrichment/AliasTracker.js +16 -1
- package/dist/plugins/enrichment/ArgumentParameterLinker.d.ts +32 -0
- package/dist/plugins/enrichment/ArgumentParameterLinker.d.ts.map +1 -0
- package/dist/plugins/enrichment/ArgumentParameterLinker.js +175 -0
- package/dist/plugins/enrichment/ClosureCaptureEnricher.d.ts +51 -0
- package/dist/plugins/enrichment/ClosureCaptureEnricher.d.ts.map +1 -0
- package/dist/plugins/enrichment/ClosureCaptureEnricher.js +205 -0
- package/dist/plugins/enrichment/ExternalCallResolver.d.ts +42 -0
- package/dist/plugins/enrichment/ExternalCallResolver.d.ts.map +1 -0
- package/dist/plugins/enrichment/ExternalCallResolver.js +213 -0
- package/dist/plugins/enrichment/FunctionCallResolver.d.ts +58 -0
- package/dist/plugins/enrichment/FunctionCallResolver.d.ts.map +1 -0
- package/dist/plugins/enrichment/FunctionCallResolver.js +340 -0
- package/dist/plugins/enrichment/HTTPConnectionEnricher.d.ts +16 -3
- package/dist/plugins/enrichment/HTTPConnectionEnricher.d.ts.map +1 -1
- package/dist/plugins/enrichment/HTTPConnectionEnricher.js +64 -20
- package/dist/plugins/enrichment/MethodCallResolver.d.ts.map +1 -1
- package/dist/plugins/enrichment/MethodCallResolver.js +15 -1
- package/dist/plugins/enrichment/MountPointResolver.d.ts +14 -12
- package/dist/plugins/enrichment/MountPointResolver.d.ts.map +1 -1
- package/dist/plugins/enrichment/MountPointResolver.js +172 -151
- package/dist/plugins/enrichment/NodejsBuiltinsResolver.d.ts +44 -0
- package/dist/plugins/enrichment/NodejsBuiltinsResolver.d.ts.map +1 -0
- package/dist/plugins/enrichment/NodejsBuiltinsResolver.js +271 -0
- package/dist/plugins/enrichment/ValueDomainAnalyzer.d.ts +5 -27
- package/dist/plugins/enrichment/ValueDomainAnalyzer.d.ts.map +1 -1
- package/dist/plugins/enrichment/ValueDomainAnalyzer.js +62 -139
- package/dist/plugins/indexing/JSModuleIndexer.d.ts +15 -0
- package/dist/plugins/indexing/JSModuleIndexer.d.ts.map +1 -1
- package/dist/plugins/indexing/JSModuleIndexer.js +58 -0
- package/dist/plugins/indexing/RustModuleIndexer.d.ts +1 -1
- package/dist/plugins/indexing/RustModuleIndexer.js +4 -4
- package/dist/plugins/validation/BrokenImportValidator.d.ts +31 -0
- package/dist/plugins/validation/BrokenImportValidator.d.ts.map +1 -0
- package/dist/plugins/validation/BrokenImportValidator.js +249 -0
- package/dist/plugins/validation/CallResolverValidator.d.ts +21 -10
- package/dist/plugins/validation/CallResolverValidator.d.ts.map +1 -1
- package/dist/plugins/validation/CallResolverValidator.js +101 -76
- package/dist/plugins/validation/DataFlowValidator.d.ts.map +1 -1
- package/dist/plugins/validation/DataFlowValidator.js +49 -41
- package/dist/plugins/validation/GraphConnectivityValidator.d.ts.map +1 -1
- package/dist/plugins/validation/GraphConnectivityValidator.js +25 -1
- package/dist/plugins/validation/SQLInjectionValidator.d.ts.map +1 -1
- package/dist/plugins/validation/SQLInjectionValidator.js +2 -3
- package/dist/queries/findCallsInFunction.d.ts +52 -0
- package/dist/queries/findCallsInFunction.d.ts.map +1 -0
- package/dist/queries/findCallsInFunction.js +135 -0
- package/dist/queries/findContainingFunction.d.ts +45 -0
- package/dist/queries/findContainingFunction.d.ts.map +1 -0
- package/dist/queries/findContainingFunction.js +54 -0
- package/dist/queries/index.d.ts +14 -0
- package/dist/queries/index.d.ts.map +1 -0
- package/dist/queries/index.js +11 -0
- package/dist/queries/traceValues.d.ts +70 -0
- package/dist/queries/traceValues.d.ts.map +1 -0
- package/dist/queries/traceValues.js +299 -0
- package/dist/queries/types.d.ts +163 -0
- package/dist/queries/types.d.ts.map +1 -0
- package/dist/queries/types.js +9 -0
- package/dist/schema/GraphSchemaExtractor.d.ts +53 -0
- package/dist/schema/GraphSchemaExtractor.d.ts.map +1 -0
- package/dist/schema/GraphSchemaExtractor.js +124 -0
- package/dist/schema/InterfaceSchemaExtractor.d.ts +73 -0
- package/dist/schema/InterfaceSchemaExtractor.d.ts.map +1 -0
- package/dist/schema/InterfaceSchemaExtractor.js +112 -0
- package/dist/schema/index.d.ts +5 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +2 -0
- package/dist/storage/backends/RFDBServerBackend.d.ts +12 -18
- package/dist/storage/backends/RFDBServerBackend.d.ts.map +1 -1
- package/dist/storage/backends/RFDBServerBackend.js +41 -52
- package/dist/storage/backends/typeValidation.d.ts.map +1 -1
- package/dist/storage/backends/typeValidation.js +1 -0
- package/package.json +3 -3
- package/src/Orchestrator.ts +35 -3
- package/src/config/ConfigLoader.ts +94 -3
- package/src/core/FileExplainer.ts +179 -0
- package/src/core/NodeFactory.ts +72 -8
- package/src/core/nodes/ArrayLiteralNode.ts +3 -2
- package/src/core/nodes/BranchNode.ts +113 -0
- package/src/core/nodes/CallSiteNode.ts +7 -5
- package/src/core/nodes/CaseNode.ts +123 -0
- package/src/core/nodes/ClassNode.ts +6 -4
- package/src/core/nodes/ConstantNode.ts +5 -4
- package/src/core/nodes/ConstructorCallNode.ts +217 -0
- package/src/core/nodes/DatabaseQueryNode.ts +5 -1
- package/src/core/nodes/DecoratorNode.ts +4 -3
- package/src/core/nodes/EnumNode.ts +4 -3
- package/src/core/nodes/EventListenerNode.ts +7 -4
- package/src/core/nodes/ExportNode.ts +6 -4
- package/src/core/nodes/ExpressionNode.ts +5 -4
- package/src/core/nodes/ExternalModuleNode.ts +11 -2
- package/src/core/nodes/HttpRequestNode.ts +7 -4
- package/src/core/nodes/ImportNode.ts +31 -4
- package/src/core/nodes/InterfaceNode.ts +4 -3
- package/src/core/nodes/LiteralNode.ts +5 -4
- package/src/core/nodes/MethodCallNode.ts +7 -5
- package/src/core/nodes/MethodNode.ts +6 -4
- package/src/core/nodes/ObjectLiteralNode.ts +3 -2
- package/src/core/nodes/ParameterNode.ts +4 -3
- package/src/core/nodes/TypeNode.ts +4 -3
- package/src/core/nodes/VariableDeclarationNode.ts +7 -5
- package/src/core/nodes/index.ts +3 -0
- package/src/data/builtins/BuiltinRegistry.ts +124 -0
- package/src/data/builtins/definitions.ts +267 -0
- package/src/data/builtins/index.ts +10 -0
- package/src/data/builtins/jsGlobals.ts +28 -0
- package/src/data/builtins/types.ts +36 -0
- package/src/data/globals/definitions.ts +156 -0
- package/src/data/globals/index.ts +66 -0
- package/src/diagnostics/DiagnosticReporter.ts +120 -0
- package/src/diagnostics/index.ts +1 -1
- package/src/errors/GrafemaError.ts +65 -0
- package/src/index.ts +45 -0
- package/src/plugins/analysis/DatabaseAnalyzer.ts +4 -2
- package/src/plugins/analysis/ExpressAnalyzer.ts +5 -1
- package/src/plugins/analysis/ExpressResponseAnalyzer.ts +636 -0
- package/src/plugins/analysis/ExpressRouteAnalyzer.ts +57 -18
- package/src/plugins/analysis/FetchAnalyzer.ts +204 -16
- package/src/plugins/analysis/JSASTAnalyzer.ts +2958 -260
- package/src/plugins/analysis/RustAnalyzer.ts +4 -4
- package/src/plugins/analysis/SQLiteAnalyzer.ts +5 -2
- package/src/plugins/analysis/SocketIOAnalyzer.ts +121 -7
- package/src/plugins/analysis/ast/GraphBuilder.ts +1578 -70
- package/src/plugins/analysis/ast/types.ts +387 -0
- package/src/plugins/analysis/ast/visitors/ASTVisitor.ts +8 -0
- package/src/plugins/analysis/ast/visitors/CallExpressionVisitor.ts +16 -1
- package/src/plugins/analysis/ast/visitors/FunctionVisitor.ts +77 -2
- package/src/plugins/analysis/ast/visitors/ImportExportVisitor.ts +112 -1
- package/src/plugins/analysis/ast/visitors/VariableVisitor.ts +272 -47
- package/src/plugins/discovery/WorkspaceDiscovery.ts +11 -4
- package/src/plugins/enrichment/AliasTracker.ts +22 -1
- package/src/plugins/enrichment/ArgumentParameterLinker.ts +240 -0
- package/src/plugins/enrichment/ClosureCaptureEnricher.ts +267 -0
- package/src/plugins/enrichment/ExternalCallResolver.ts +262 -0
- package/src/plugins/enrichment/FunctionCallResolver.ts +456 -0
- package/src/plugins/enrichment/HTTPConnectionEnricher.ts +70 -20
- package/src/plugins/enrichment/MethodCallResolver.ts +21 -1
- package/src/plugins/enrichment/MountPointResolver.ts +206 -198
- package/src/plugins/enrichment/NodejsBuiltinsResolver.ts +365 -0
- package/src/plugins/enrichment/ValueDomainAnalyzer.ts +67 -184
- package/src/plugins/indexing/JSModuleIndexer.ts +66 -0
- package/src/plugins/indexing/RustModuleIndexer.ts +4 -4
- package/src/plugins/validation/BrokenImportValidator.ts +325 -0
- package/src/plugins/validation/CallResolverValidator.ts +129 -109
- package/src/plugins/validation/DataFlowValidator.ts +75 -58
- package/src/plugins/validation/GraphConnectivityValidator.ts +39 -1
- package/src/plugins/validation/SQLInjectionValidator.ts +2 -5
- package/src/queries/README.md +46 -0
- package/src/queries/findCallsInFunction.ts +206 -0
- package/src/queries/findContainingFunction.ts +83 -0
- package/src/queries/index.ts +23 -0
- package/src/queries/traceValues.ts +398 -0
- package/src/queries/types.ts +187 -0
- package/src/schema/GraphSchemaExtractor.ts +177 -0
- package/src/schema/InterfaceSchemaExtractor.ts +173 -0
- package/src/schema/index.ts +5 -0
- package/src/storage/backends/RFDBServerBackend.ts +58 -70
- package/src/storage/backends/typeValidation.ts +1 -0
|
@@ -6,13 +6,13 @@ import type { BaseNodeRecord } from '@grafema/types';
|
|
|
6
6
|
|
|
7
7
|
interface EventListenerNodeRecord extends BaseNodeRecord {
|
|
8
8
|
type: 'EVENT_LISTENER';
|
|
9
|
+
column: number;
|
|
9
10
|
object?: string;
|
|
10
11
|
parentScopeId?: string;
|
|
11
12
|
callbackArg?: string;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
interface EventListenerNodeOptions {
|
|
15
|
-
column?: number;
|
|
16
16
|
parentScopeId?: string;
|
|
17
17
|
callbackArg?: string;
|
|
18
18
|
counter?: number;
|
|
@@ -21,22 +21,24 @@ interface EventListenerNodeOptions {
|
|
|
21
21
|
export class EventListenerNode {
|
|
22
22
|
static readonly TYPE = 'EVENT_LISTENER' as const;
|
|
23
23
|
|
|
24
|
-
static readonly REQUIRED = ['name', 'file', 'line'] as const;
|
|
25
|
-
static readonly OPTIONAL = ['object', '
|
|
24
|
+
static readonly REQUIRED = ['name', 'file', 'line', 'column'] as const;
|
|
25
|
+
static readonly OPTIONAL = ['object', 'parentScopeId', 'callbackArg'] as const;
|
|
26
26
|
|
|
27
27
|
static create(
|
|
28
28
|
eventName: string,
|
|
29
29
|
objectName: string | undefined,
|
|
30
30
|
file: string,
|
|
31
31
|
line: number,
|
|
32
|
+
column: number,
|
|
32
33
|
options: EventListenerNodeOptions = {}
|
|
33
34
|
): EventListenerNodeRecord {
|
|
34
35
|
if (!eventName) throw new Error('EventListenerNode.create: eventName is required');
|
|
35
36
|
if (!file) throw new Error('EventListenerNode.create: file is required');
|
|
36
37
|
if (line === undefined) throw new Error('EventListenerNode.create: line is required');
|
|
38
|
+
if (column === undefined) throw new Error('EventListenerNode.create: column is required');
|
|
37
39
|
|
|
38
40
|
const counter = options.counter !== undefined ? `:${options.counter}` : '';
|
|
39
|
-
const id = `${file}:EVENT_LISTENER:${eventName}:${line}:${
|
|
41
|
+
const id = `${file}:EVENT_LISTENER:${eventName}:${line}:${column}${counter}`;
|
|
40
42
|
|
|
41
43
|
return {
|
|
42
44
|
id,
|
|
@@ -45,6 +47,7 @@ export class EventListenerNode {
|
|
|
45
47
|
object: objectName,
|
|
46
48
|
file,
|
|
47
49
|
line,
|
|
50
|
+
column,
|
|
48
51
|
parentScopeId: options.parentScopeId,
|
|
49
52
|
callbackArg: options.callbackArg
|
|
50
53
|
};
|
|
@@ -48,8 +48,8 @@ interface ExportContextOptions {
|
|
|
48
48
|
export class ExportNode {
|
|
49
49
|
static readonly TYPE = 'EXPORT' as const;
|
|
50
50
|
|
|
51
|
-
static readonly REQUIRED = ['name', 'file', 'line'] as const;
|
|
52
|
-
static readonly OPTIONAL = ['
|
|
51
|
+
static readonly REQUIRED = ['name', 'file', 'line', 'column'] as const;
|
|
52
|
+
static readonly OPTIONAL = ['exportKind', 'local', 'default', 'source', 'exportType'] as const;
|
|
53
53
|
|
|
54
54
|
static create(
|
|
55
55
|
name: string,
|
|
@@ -61,6 +61,7 @@ export class ExportNode {
|
|
|
61
61
|
if (!name) throw new Error('ExportNode.create: name is required');
|
|
62
62
|
if (!file) throw new Error('ExportNode.create: file is required');
|
|
63
63
|
if (!line) throw new Error('ExportNode.create: line is required');
|
|
64
|
+
if (column === undefined) throw new Error('ExportNode.create: column is required');
|
|
64
65
|
|
|
65
66
|
return {
|
|
66
67
|
id: `${file}:EXPORT:${name}:${line}`,
|
|
@@ -68,7 +69,7 @@ export class ExportNode {
|
|
|
68
69
|
name,
|
|
69
70
|
file,
|
|
70
71
|
line,
|
|
71
|
-
column
|
|
72
|
+
column,
|
|
72
73
|
exportKind: options.exportKind || 'value',
|
|
73
74
|
local: options.local || name,
|
|
74
75
|
default: options.default || false,
|
|
@@ -99,6 +100,7 @@ export class ExportNode {
|
|
|
99
100
|
if (!name) throw new Error('ExportNode.createWithContext: name is required');
|
|
100
101
|
if (!context.file) throw new Error('ExportNode.createWithContext: file is required');
|
|
101
102
|
if (location.line === undefined) throw new Error('ExportNode.createWithContext: line is required');
|
|
103
|
+
if (location.column === undefined) throw new Error('ExportNode.createWithContext: column is required');
|
|
102
104
|
|
|
103
105
|
// Compute semantic ID
|
|
104
106
|
const id = computeSemanticId(this.TYPE, name, context);
|
|
@@ -109,7 +111,7 @@ export class ExportNode {
|
|
|
109
111
|
name,
|
|
110
112
|
file: context.file,
|
|
111
113
|
line: location.line,
|
|
112
|
-
column: location.column
|
|
114
|
+
column: location.column,
|
|
113
115
|
exportKind: options.exportKind || 'value',
|
|
114
116
|
local: options.local || name,
|
|
115
117
|
default: options.default || false,
|
|
@@ -46,9 +46,9 @@ interface ExpressionNodeOptions {
|
|
|
46
46
|
export class ExpressionNode {
|
|
47
47
|
static readonly TYPE = 'EXPRESSION' as const;
|
|
48
48
|
|
|
49
|
-
static readonly REQUIRED = ['expressionType', 'file', 'line'] as const;
|
|
49
|
+
static readonly REQUIRED = ['expressionType', 'file', 'line', 'column'] as const;
|
|
50
50
|
static readonly OPTIONAL = [
|
|
51
|
-
'
|
|
51
|
+
'object', 'property', 'computed', 'computedPropertyVar',
|
|
52
52
|
'operator', 'path', 'baseName', 'propertyPath', 'arrayIndex'
|
|
53
53
|
] as const;
|
|
54
54
|
|
|
@@ -72,6 +72,7 @@ export class ExpressionNode {
|
|
|
72
72
|
if (!expressionType) throw new Error('ExpressionNode.create: expressionType is required');
|
|
73
73
|
if (!file) throw new Error('ExpressionNode.create: file is required');
|
|
74
74
|
if (!line) throw new Error('ExpressionNode.create: line is required');
|
|
75
|
+
if (column === undefined) throw new Error('ExpressionNode.create: column is required');
|
|
75
76
|
|
|
76
77
|
const node: ExpressionNodeRecord = {
|
|
77
78
|
id: `${file}:EXPRESSION:${expressionType}:${line}:${column}`,
|
|
@@ -79,7 +80,7 @@ export class ExpressionNode {
|
|
|
79
80
|
name: this._computeName(expressionType, options),
|
|
80
81
|
file,
|
|
81
82
|
line,
|
|
82
|
-
column
|
|
83
|
+
column,
|
|
83
84
|
expressionType
|
|
84
85
|
};
|
|
85
86
|
|
|
@@ -191,7 +192,7 @@ export class ExpressionNode {
|
|
|
191
192
|
name: this._computeName(expressionType, options),
|
|
192
193
|
file,
|
|
193
194
|
line,
|
|
194
|
-
column
|
|
195
|
+
column,
|
|
195
196
|
expressionType
|
|
196
197
|
};
|
|
197
198
|
|
|
@@ -23,16 +23,25 @@ export class ExternalModuleNode {
|
|
|
23
23
|
/**
|
|
24
24
|
* Create EXTERNAL_MODULE node
|
|
25
25
|
*
|
|
26
|
+
* Normalizes node: prefix for Node.js builtins:
|
|
27
|
+
* - 'node:fs' -> 'fs'
|
|
28
|
+
* - 'node:path' -> 'path'
|
|
29
|
+
*
|
|
26
30
|
* @param source - Module name (e.g., 'lodash', '@tanstack/react-query', 'node:fs')
|
|
27
31
|
* @returns ExternalModuleNodeRecord
|
|
28
32
|
*/
|
|
29
33
|
static create(source: string): ExternalModuleNodeRecord {
|
|
30
34
|
if (!source) throw new Error('ExternalModuleNode.create: source is required');
|
|
31
35
|
|
|
36
|
+
// Normalize node: prefix for Node.js builtins
|
|
37
|
+
const normalizedSource = source.startsWith('node:')
|
|
38
|
+
? source.slice(5)
|
|
39
|
+
: source;
|
|
40
|
+
|
|
32
41
|
return {
|
|
33
|
-
id: `EXTERNAL_MODULE:${
|
|
42
|
+
id: `EXTERNAL_MODULE:${normalizedSource}`,
|
|
34
43
|
type: this.TYPE,
|
|
35
|
-
name:
|
|
44
|
+
name: normalizedSource,
|
|
36
45
|
file: '',
|
|
37
46
|
line: 0
|
|
38
47
|
};
|
|
@@ -6,13 +6,13 @@ import type { BaseNodeRecord } from '@grafema/types';
|
|
|
6
6
|
|
|
7
7
|
interface HttpRequestNodeRecord extends BaseNodeRecord {
|
|
8
8
|
type: 'HTTP_REQUEST';
|
|
9
|
+
column: number;
|
|
9
10
|
url?: string;
|
|
10
11
|
method: string;
|
|
11
12
|
parentScopeId?: string;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
interface HttpRequestNodeOptions {
|
|
15
|
-
column?: number;
|
|
16
16
|
parentScopeId?: string;
|
|
17
17
|
counter?: number;
|
|
18
18
|
}
|
|
@@ -20,22 +20,24 @@ interface HttpRequestNodeOptions {
|
|
|
20
20
|
export class HttpRequestNode {
|
|
21
21
|
static readonly TYPE = 'HTTP_REQUEST' as const;
|
|
22
22
|
|
|
23
|
-
static readonly REQUIRED = ['name', 'file', 'line'] as const;
|
|
24
|
-
static readonly OPTIONAL = ['url', 'method', '
|
|
23
|
+
static readonly REQUIRED = ['name', 'file', 'line', 'column'] as const;
|
|
24
|
+
static readonly OPTIONAL = ['url', 'method', 'parentScopeId'] as const;
|
|
25
25
|
|
|
26
26
|
static create(
|
|
27
27
|
url: string | undefined,
|
|
28
28
|
method: string | undefined,
|
|
29
29
|
file: string,
|
|
30
30
|
line: number,
|
|
31
|
+
column: number,
|
|
31
32
|
options: HttpRequestNodeOptions = {}
|
|
32
33
|
): HttpRequestNodeRecord {
|
|
33
34
|
if (!file) throw new Error('HttpRequestNode.create: file is required');
|
|
34
35
|
if (line === undefined) throw new Error('HttpRequestNode.create: line is required');
|
|
36
|
+
if (column === undefined) throw new Error('HttpRequestNode.create: column is required');
|
|
35
37
|
|
|
36
38
|
const httpMethod = method || 'GET';
|
|
37
39
|
const counter = options.counter !== undefined ? `:${options.counter}` : '';
|
|
38
|
-
const id = `${file}:HTTP_REQUEST:${httpMethod}:${line}:${
|
|
40
|
+
const id = `${file}:HTTP_REQUEST:${httpMethod}:${line}:${column}${counter}`;
|
|
39
41
|
|
|
40
42
|
return {
|
|
41
43
|
id,
|
|
@@ -45,6 +47,7 @@ export class HttpRequestNode {
|
|
|
45
47
|
method: httpMethod,
|
|
46
48
|
file,
|
|
47
49
|
line,
|
|
50
|
+
column,
|
|
48
51
|
parentScopeId: options.parentScopeId
|
|
49
52
|
};
|
|
50
53
|
}
|
|
@@ -15,6 +15,10 @@ interface ImportNodeRecord extends BaseNodeRecord {
|
|
|
15
15
|
importBinding: ImportBinding; // RENAMED: WHAT is imported (semantics)
|
|
16
16
|
imported: string;
|
|
17
17
|
local: string;
|
|
18
|
+
isDynamic?: boolean; // true for dynamic import() expressions
|
|
19
|
+
isResolvable?: boolean; // true if path is a string literal (statically analyzable)
|
|
20
|
+
dynamicPath?: string; // original expression for template/variable paths
|
|
21
|
+
sideEffect?: boolean; // REG-273: true for side-effect-only imports
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
interface ImportNodeOptions {
|
|
@@ -22,13 +26,17 @@ interface ImportNodeOptions {
|
|
|
22
26
|
importBinding?: ImportBinding;
|
|
23
27
|
imported?: string; // Used for auto-detection if importType not provided
|
|
24
28
|
local?: string;
|
|
29
|
+
isDynamic?: boolean; // true for dynamic import() expressions
|
|
30
|
+
isResolvable?: boolean; // true if path is a string literal (statically analyzable)
|
|
31
|
+
dynamicPath?: string; // original expression for template/variable paths
|
|
32
|
+
sideEffect?: boolean; // REG-273: true for side-effect-only imports
|
|
25
33
|
}
|
|
26
34
|
|
|
27
35
|
export class ImportNode {
|
|
28
36
|
static readonly TYPE = 'IMPORT' as const;
|
|
29
37
|
|
|
30
|
-
static readonly REQUIRED = ['name', 'file', 'line', 'source'] as const;
|
|
31
|
-
static readonly OPTIONAL = ['
|
|
38
|
+
static readonly REQUIRED = ['name', 'file', 'line', 'column', 'source'] as const;
|
|
39
|
+
static readonly OPTIONAL = ['importType', 'importBinding', 'imported', 'local', 'isDynamic', 'isResolvable', 'dynamicPath', 'sideEffect'] as const;
|
|
32
40
|
|
|
33
41
|
/**
|
|
34
42
|
* Create IMPORT node
|
|
@@ -52,6 +60,7 @@ export class ImportNode {
|
|
|
52
60
|
if (!name) throw new Error('ImportNode.create: name is required');
|
|
53
61
|
if (!file) throw new Error('ImportNode.create: file is required');
|
|
54
62
|
if (line === undefined) throw new Error('ImportNode.create: line is required');
|
|
63
|
+
if (column === undefined) throw new Error('ImportNode.create: column is required');
|
|
55
64
|
if (!source) throw new Error('ImportNode.create: source is required');
|
|
56
65
|
|
|
57
66
|
// Auto-detect importType from imported field if not explicitly provided
|
|
@@ -61,19 +70,37 @@ export class ImportNode {
|
|
|
61
70
|
options.imported === '*' ? 'namespace' : 'named';
|
|
62
71
|
}
|
|
63
72
|
|
|
64
|
-
|
|
73
|
+
const record: ImportNodeRecord = {
|
|
65
74
|
id: `${file}:IMPORT:${source}:${name}`, // SEMANTIC ID: no line number
|
|
66
75
|
type: this.TYPE,
|
|
67
76
|
name,
|
|
68
77
|
file,
|
|
69
78
|
line, // Stored as field, not in ID
|
|
70
|
-
column
|
|
79
|
+
column,
|
|
71
80
|
source,
|
|
72
81
|
importType: importType || 'named', // NEW field with auto-detection
|
|
73
82
|
importBinding: options.importBinding || 'value', // RENAMED field
|
|
74
83
|
imported: options.imported || name,
|
|
75
84
|
local: options.local || name
|
|
76
85
|
};
|
|
86
|
+
|
|
87
|
+
// Add dynamic import fields if provided
|
|
88
|
+
if (options.isDynamic !== undefined) {
|
|
89
|
+
record.isDynamic = options.isDynamic;
|
|
90
|
+
}
|
|
91
|
+
if (options.isResolvable !== undefined) {
|
|
92
|
+
record.isResolvable = options.isResolvable;
|
|
93
|
+
}
|
|
94
|
+
if (options.dynamicPath !== undefined) {
|
|
95
|
+
record.dynamicPath = options.dynamicPath;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// REG-273: Add sideEffect field if provided
|
|
99
|
+
if (options.sideEffect !== undefined) {
|
|
100
|
+
record.sideEffect = options.sideEffect;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return record;
|
|
77
104
|
}
|
|
78
105
|
|
|
79
106
|
static validate(node: ImportNodeRecord): string[] {
|
|
@@ -33,8 +33,8 @@ interface InterfaceNodeOptions {
|
|
|
33
33
|
export class InterfaceNode {
|
|
34
34
|
static readonly TYPE = 'INTERFACE' as const;
|
|
35
35
|
|
|
36
|
-
static readonly REQUIRED = ['name', 'file', 'line'] as const;
|
|
37
|
-
static readonly OPTIONAL = ['
|
|
36
|
+
static readonly REQUIRED = ['name', 'file', 'line', 'column'] as const;
|
|
37
|
+
static readonly OPTIONAL = ['extends', 'properties', 'isExternal'] as const;
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* Create INTERFACE node
|
|
@@ -56,6 +56,7 @@ export class InterfaceNode {
|
|
|
56
56
|
if (!name) throw new Error('InterfaceNode.create: name is required');
|
|
57
57
|
if (!file) throw new Error('InterfaceNode.create: file is required');
|
|
58
58
|
if (!line) throw new Error('InterfaceNode.create: line is required');
|
|
59
|
+
if (column === undefined) throw new Error('InterfaceNode.create: column is required');
|
|
59
60
|
|
|
60
61
|
return {
|
|
61
62
|
id: `${file}:INTERFACE:${name}:${line}`,
|
|
@@ -63,7 +64,7 @@ export class InterfaceNode {
|
|
|
63
64
|
name,
|
|
64
65
|
file,
|
|
65
66
|
line,
|
|
66
|
-
column
|
|
67
|
+
column,
|
|
67
68
|
extends: options.extends || [],
|
|
68
69
|
properties: options.properties || [],
|
|
69
70
|
...(options.isExternal !== undefined && { isExternal: options.isExternal })
|
|
@@ -22,8 +22,8 @@ interface LiteralNodeOptions {
|
|
|
22
22
|
export class LiteralNode {
|
|
23
23
|
static readonly TYPE = 'LITERAL' as const;
|
|
24
24
|
|
|
25
|
-
static readonly REQUIRED = ['file', 'line'] as const;
|
|
26
|
-
static readonly OPTIONAL = ['value', 'valueType', '
|
|
25
|
+
static readonly REQUIRED = ['file', 'line', 'column'] as const;
|
|
26
|
+
static readonly OPTIONAL = ['value', 'valueType', 'parentCallId', 'argIndex'] as const;
|
|
27
27
|
|
|
28
28
|
static create(
|
|
29
29
|
value: unknown,
|
|
@@ -34,10 +34,11 @@ export class LiteralNode {
|
|
|
34
34
|
): LiteralNodeRecord {
|
|
35
35
|
if (!file) throw new Error('LiteralNode.create: file is required');
|
|
36
36
|
if (line === undefined) throw new Error('LiteralNode.create: line is required');
|
|
37
|
+
if (column === undefined) throw new Error('LiteralNode.create: column is required');
|
|
37
38
|
|
|
38
39
|
const counter = options.counter !== undefined ? `:${options.counter}` : '';
|
|
39
40
|
const argIndex = options.argIndex !== undefined ? `arg${options.argIndex}` : 'value';
|
|
40
|
-
const id = `${file}:LITERAL:${argIndex}:${line}:${column
|
|
41
|
+
const id = `${file}:LITERAL:${argIndex}:${line}:${column}${counter}`;
|
|
41
42
|
|
|
42
43
|
return {
|
|
43
44
|
id,
|
|
@@ -47,7 +48,7 @@ export class LiteralNode {
|
|
|
47
48
|
valueType: typeof value,
|
|
48
49
|
file,
|
|
49
50
|
line,
|
|
50
|
-
column
|
|
51
|
+
column,
|
|
51
52
|
parentCallId: options.parentCallId,
|
|
52
53
|
argIndex: options.argIndex
|
|
53
54
|
};
|
|
@@ -39,8 +39,8 @@ interface MethodCallContextOptions {
|
|
|
39
39
|
export class MethodCallNode {
|
|
40
40
|
static readonly TYPE = 'METHOD_CALL' as const;
|
|
41
41
|
|
|
42
|
-
static readonly REQUIRED = ['name', 'file', 'line', 'args'] as const;
|
|
43
|
-
static readonly OPTIONAL = ['object', 'method', '
|
|
42
|
+
static readonly REQUIRED = ['name', 'file', 'line', 'column', 'args'] as const;
|
|
43
|
+
static readonly OPTIONAL = ['object', 'method', 'parentScopeId'] as const;
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* Create METHOD_CALL node
|
|
@@ -56,10 +56,11 @@ export class MethodCallNode {
|
|
|
56
56
|
if (!methodName) throw new Error('MethodCallNode.create: methodName is required');
|
|
57
57
|
if (!file) throw new Error('MethodCallNode.create: file is required');
|
|
58
58
|
if (line === undefined) throw new Error('MethodCallNode.create: line is required');
|
|
59
|
+
if (column === undefined) throw new Error('MethodCallNode.create: column is required');
|
|
59
60
|
|
|
60
61
|
const fullName = objectName ? `${objectName}.${methodName}` : methodName;
|
|
61
62
|
const counter = options.counter !== undefined ? `:${options.counter}` : '';
|
|
62
|
-
const id = `${file}:METHOD_CALL:${fullName}:${line}:${column
|
|
63
|
+
const id = `${file}:METHOD_CALL:${fullName}:${line}:${column}${counter}`;
|
|
63
64
|
|
|
64
65
|
return {
|
|
65
66
|
id,
|
|
@@ -69,7 +70,7 @@ export class MethodCallNode {
|
|
|
69
70
|
method: methodName,
|
|
70
71
|
file,
|
|
71
72
|
line,
|
|
72
|
-
column
|
|
73
|
+
column,
|
|
73
74
|
parentScopeId: options.parentScopeId,
|
|
74
75
|
args: options.args || []
|
|
75
76
|
};
|
|
@@ -99,6 +100,7 @@ export class MethodCallNode {
|
|
|
99
100
|
if (!methodName) throw new Error('MethodCallNode.createWithContext: methodName is required');
|
|
100
101
|
if (!context.file) throw new Error('MethodCallNode.createWithContext: file is required');
|
|
101
102
|
if (location.line === undefined) throw new Error('MethodCallNode.createWithContext: line is required');
|
|
103
|
+
if (location.column === undefined) throw new Error('MethodCallNode.createWithContext: column is required');
|
|
102
104
|
if (options.discriminator === undefined) throw new Error('MethodCallNode.createWithContext: discriminator is required');
|
|
103
105
|
|
|
104
106
|
const fullName = objectName ? `${objectName}.${methodName}` : methodName;
|
|
@@ -116,7 +118,7 @@ export class MethodCallNode {
|
|
|
116
118
|
method: methodName,
|
|
117
119
|
file: context.file,
|
|
118
120
|
line: location.line,
|
|
119
|
-
column: location.column
|
|
121
|
+
column: location.column,
|
|
120
122
|
parentScopeId: options.parentScopeId,
|
|
121
123
|
args: options.args || []
|
|
122
124
|
};
|
|
@@ -44,8 +44,8 @@ interface MethodContextOptions {
|
|
|
44
44
|
export class MethodNode {
|
|
45
45
|
static readonly TYPE = 'METHOD' as const;
|
|
46
46
|
|
|
47
|
-
static readonly REQUIRED = ['name', 'file', 'line', 'className'] as const;
|
|
48
|
-
static readonly OPTIONAL = ['
|
|
47
|
+
static readonly REQUIRED = ['name', 'file', 'line', 'column', 'className'] as const;
|
|
48
|
+
static readonly OPTIONAL = ['async', 'generator', 'static', 'kind'] as const;
|
|
49
49
|
|
|
50
50
|
static create(
|
|
51
51
|
name: string,
|
|
@@ -58,6 +58,7 @@ export class MethodNode {
|
|
|
58
58
|
if (!name) throw new Error('MethodNode.create: name is required');
|
|
59
59
|
if (!file) throw new Error('MethodNode.create: file is required');
|
|
60
60
|
if (!line) throw new Error('MethodNode.create: line is required');
|
|
61
|
+
if (column === undefined) throw new Error('MethodNode.create: column is required');
|
|
61
62
|
if (!className) throw new Error('MethodNode.create: className is required');
|
|
62
63
|
|
|
63
64
|
return {
|
|
@@ -66,7 +67,7 @@ export class MethodNode {
|
|
|
66
67
|
name,
|
|
67
68
|
file,
|
|
68
69
|
line,
|
|
69
|
-
column
|
|
70
|
+
column,
|
|
70
71
|
className,
|
|
71
72
|
async: options.async || false,
|
|
72
73
|
generator: options.generator || false,
|
|
@@ -101,6 +102,7 @@ export class MethodNode {
|
|
|
101
102
|
if (!className) throw new Error('MethodNode.createWithContext: className is required');
|
|
102
103
|
if (!context.file) throw new Error('MethodNode.createWithContext: file is required');
|
|
103
104
|
if (location.line === undefined) throw new Error('MethodNode.createWithContext: line is required');
|
|
105
|
+
if (location.column === undefined) throw new Error('MethodNode.createWithContext: column is required');
|
|
104
106
|
|
|
105
107
|
// Compute semantic ID
|
|
106
108
|
const id = computeSemanticId(this.TYPE, name, context);
|
|
@@ -111,7 +113,7 @@ export class MethodNode {
|
|
|
111
113
|
name,
|
|
112
114
|
file: context.file,
|
|
113
115
|
line: location.line,
|
|
114
|
-
column: location.column
|
|
116
|
+
column: location.column,
|
|
115
117
|
className,
|
|
116
118
|
async: options.async || false,
|
|
117
119
|
generator: options.generator || false,
|
|
@@ -34,10 +34,11 @@ export class ObjectLiteralNode {
|
|
|
34
34
|
): ObjectLiteralNodeRecord {
|
|
35
35
|
if (!file) throw new Error('ObjectLiteralNode.create: file is required');
|
|
36
36
|
if (line === undefined) throw new Error('ObjectLiteralNode.create: line is required');
|
|
37
|
+
if (column === undefined) throw new Error('ObjectLiteralNode.create: column is required');
|
|
37
38
|
|
|
38
39
|
const counter = options.counter !== undefined ? `:${options.counter}` : '';
|
|
39
40
|
const argSuffix = options.argIndex !== undefined ? `arg${options.argIndex}` : 'obj';
|
|
40
|
-
const id = `OBJECT_LITERAL#${argSuffix}#${file}#${line}:${column
|
|
41
|
+
const id = `OBJECT_LITERAL#${argSuffix}#${file}#${line}:${column}${counter}`;
|
|
41
42
|
|
|
42
43
|
return {
|
|
43
44
|
id,
|
|
@@ -45,7 +46,7 @@ export class ObjectLiteralNode {
|
|
|
45
46
|
name: `<object>`,
|
|
46
47
|
file,
|
|
47
48
|
line,
|
|
48
|
-
column
|
|
49
|
+
column,
|
|
49
50
|
parentCallId: options.parentCallId,
|
|
50
51
|
argIndex: options.argIndex
|
|
51
52
|
};
|
|
@@ -22,8 +22,8 @@ interface ParameterNodeOptions {
|
|
|
22
22
|
export class ParameterNode {
|
|
23
23
|
static readonly TYPE = 'PARAMETER' as const;
|
|
24
24
|
|
|
25
|
-
static readonly REQUIRED = ['name', 'file', 'line', 'functionId'] as const;
|
|
26
|
-
static readonly OPTIONAL = ['
|
|
25
|
+
static readonly REQUIRED = ['name', 'file', 'line', 'column', 'functionId'] as const;
|
|
26
|
+
static readonly OPTIONAL = ['index', 'defaultValue', 'rest'] as const;
|
|
27
27
|
|
|
28
28
|
static create(
|
|
29
29
|
name: string,
|
|
@@ -36,6 +36,7 @@ export class ParameterNode {
|
|
|
36
36
|
if (!name) throw new Error('ParameterNode.create: name is required');
|
|
37
37
|
if (!file) throw new Error('ParameterNode.create: file is required');
|
|
38
38
|
if (!line) throw new Error('ParameterNode.create: line is required');
|
|
39
|
+
if (column === undefined) throw new Error('ParameterNode.create: column is required');
|
|
39
40
|
if (!functionId) throw new Error('ParameterNode.create: functionId is required');
|
|
40
41
|
|
|
41
42
|
return {
|
|
@@ -44,7 +45,7 @@ export class ParameterNode {
|
|
|
44
45
|
name,
|
|
45
46
|
file,
|
|
46
47
|
line,
|
|
47
|
-
column
|
|
48
|
+
column,
|
|
48
49
|
functionId,
|
|
49
50
|
index: options.index || 0,
|
|
50
51
|
defaultValue: options.defaultValue,
|
|
@@ -22,8 +22,8 @@ interface TypeNodeOptions {
|
|
|
22
22
|
export class TypeNode {
|
|
23
23
|
static readonly TYPE = 'TYPE' as const;
|
|
24
24
|
|
|
25
|
-
static readonly REQUIRED = ['name', 'file', 'line'] as const;
|
|
26
|
-
static readonly OPTIONAL = ['
|
|
25
|
+
static readonly REQUIRED = ['name', 'file', 'line', 'column'] as const;
|
|
26
|
+
static readonly OPTIONAL = ['aliasOf'] as const;
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Create TYPE node
|
|
@@ -45,6 +45,7 @@ export class TypeNode {
|
|
|
45
45
|
if (!name) throw new Error('TypeNode.create: name is required');
|
|
46
46
|
if (!file) throw new Error('TypeNode.create: file is required');
|
|
47
47
|
if (!line) throw new Error('TypeNode.create: line is required');
|
|
48
|
+
if (column === undefined) throw new Error('TypeNode.create: column is required');
|
|
48
49
|
|
|
49
50
|
return {
|
|
50
51
|
id: `${file}:TYPE:${name}:${line}`,
|
|
@@ -52,7 +53,7 @@ export class TypeNode {
|
|
|
52
53
|
name,
|
|
53
54
|
file,
|
|
54
55
|
line,
|
|
55
|
-
column
|
|
56
|
+
column,
|
|
56
57
|
aliasOf: options.aliasOf
|
|
57
58
|
};
|
|
58
59
|
}
|
|
@@ -33,8 +33,8 @@ interface VariableContextOptions {
|
|
|
33
33
|
export class VariableDeclarationNode {
|
|
34
34
|
static readonly TYPE = 'VARIABLE_DECLARATION' as const;
|
|
35
35
|
|
|
36
|
-
static readonly REQUIRED = ['name', 'file', 'line'] as const;
|
|
37
|
-
static readonly OPTIONAL = ['
|
|
36
|
+
static readonly REQUIRED = ['name', 'file', 'line', 'column'] as const;
|
|
37
|
+
static readonly OPTIONAL = ['parentScopeId'] as const;
|
|
38
38
|
|
|
39
39
|
static create(
|
|
40
40
|
name: string,
|
|
@@ -46,9 +46,10 @@ export class VariableDeclarationNode {
|
|
|
46
46
|
if (!name) throw new Error('VariableDeclarationNode.create: name is required');
|
|
47
47
|
if (!file) throw new Error('VariableDeclarationNode.create: file is required');
|
|
48
48
|
if (line === undefined) throw new Error('VariableDeclarationNode.create: line is required');
|
|
49
|
+
if (column === undefined) throw new Error('VariableDeclarationNode.create: column is required');
|
|
49
50
|
|
|
50
51
|
const counter = options.counter !== undefined ? `:${options.counter}` : '';
|
|
51
|
-
const id = `${file}:VARIABLE_DECLARATION:${name}:${line}:${column
|
|
52
|
+
const id = `${file}:VARIABLE_DECLARATION:${name}:${line}:${column}${counter}`;
|
|
52
53
|
|
|
53
54
|
return {
|
|
54
55
|
id,
|
|
@@ -56,7 +57,7 @@ export class VariableDeclarationNode {
|
|
|
56
57
|
name,
|
|
57
58
|
file,
|
|
58
59
|
line,
|
|
59
|
-
column
|
|
60
|
+
column,
|
|
60
61
|
parentScopeId: options.parentScopeId
|
|
61
62
|
};
|
|
62
63
|
}
|
|
@@ -83,6 +84,7 @@ export class VariableDeclarationNode {
|
|
|
83
84
|
if (!name) throw new Error('VariableDeclarationNode.createWithContext: name is required');
|
|
84
85
|
if (!context.file) throw new Error('VariableDeclarationNode.createWithContext: file is required');
|
|
85
86
|
if (location.line === undefined) throw new Error('VariableDeclarationNode.createWithContext: line is required');
|
|
87
|
+
if (location.column === undefined) throw new Error('VariableDeclarationNode.createWithContext: column is required');
|
|
86
88
|
|
|
87
89
|
// Compute semantic ID using 'VARIABLE' type for cleaner IDs
|
|
88
90
|
const id = computeSemanticId('VARIABLE', name, context);
|
|
@@ -93,7 +95,7 @@ export class VariableDeclarationNode {
|
|
|
93
95
|
name,
|
|
94
96
|
file: context.file,
|
|
95
97
|
line: location.line,
|
|
96
|
-
column: location.column
|
|
98
|
+
column: location.column,
|
|
97
99
|
parentScopeId: options.parentScopeId
|
|
98
100
|
};
|
|
99
101
|
}
|
package/src/core/nodes/index.ts
CHANGED
|
@@ -11,10 +11,13 @@ export { ClassNode, type ClassNodeRecord } from './ClassNode.js';
|
|
|
11
11
|
export { MethodNode, type MethodNodeRecord, type MethodKind } from './MethodNode.js';
|
|
12
12
|
export { ParameterNode, type ParameterNodeRecord } from './ParameterNode.js';
|
|
13
13
|
export { ScopeNode, type ScopeNodeRecord } from './ScopeNode.js';
|
|
14
|
+
export { BranchNode, type BranchNodeRecord } from './BranchNode.js';
|
|
15
|
+
export { CaseNode, type CaseNodeRecord } from './CaseNode.js';
|
|
14
16
|
|
|
15
17
|
// Call/reference nodes
|
|
16
18
|
export { CallSiteNode, type CallSiteNodeRecord } from './CallSiteNode.js';
|
|
17
19
|
export { MethodCallNode, type MethodCallNodeRecord } from './MethodCallNode.js';
|
|
20
|
+
export { ConstructorCallNode, type ConstructorCallNodeRecord } from './ConstructorCallNode.js';
|
|
18
21
|
export { VariableDeclarationNode, type VariableDeclarationNodeRecord } from './VariableDeclarationNode.js';
|
|
19
22
|
export { ConstantNode, type ConstantNodeRecord } from './ConstantNode.js';
|
|
20
23
|
export { LiteralNode, type LiteralNodeRecord } from './LiteralNode.js';
|