@angular-modernizer/api 0.1.3 → 0.2.0
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/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/investigation/call-graph-builder.d.ts +95 -8
- package/dist/investigation/call-graph-builder.d.ts.map +1 -1
- package/dist/investigation/call-graph-builder.js +424 -81
- package/dist/investigation/call-graph-builder.js.map +1 -1
- package/dist/investigation/codebase-searcher.d.ts +68 -0
- package/dist/investigation/codebase-searcher.d.ts.map +1 -1
- package/dist/investigation/codebase-searcher.js +154 -10
- package/dist/investigation/codebase-searcher.js.map +1 -1
- package/dist/investigation/template-usage-finder.d.ts +64 -0
- package/dist/investigation/template-usage-finder.d.ts.map +1 -0
- package/dist/investigation/template-usage-finder.js +279 -0
- package/dist/investigation/template-usage-finder.js.map +1 -0
- package/dist/investigation/template-usage-scanner.d.ts +69 -0
- package/dist/investigation/template-usage-scanner.d.ts.map +1 -0
- package/dist/investigation/template-usage-scanner.js +375 -0
- package/dist/investigation/template-usage-scanner.js.map +1 -0
- package/dist/investigation/usage-finder.d.ts +51 -5
- package/dist/investigation/usage-finder.d.ts.map +1 -1
- package/dist/investigation/usage-finder.js +129 -36
- package/dist/investigation/usage-finder.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +16 -0
- package/src/investigation/call-graph-builder.ts +528 -103
- package/src/investigation/codebase-searcher.ts +240 -11
- package/src/investigation/template-usage-finder.ts +389 -0
- package/src/investigation/template-usage-scanner.ts +529 -0
- package/src/investigation/usage-finder.ts +194 -54
|
@@ -1,13 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @angular-modernizer/api - Call Graph Builder
|
|
3
3
|
*
|
|
4
|
-
* Builds a call graph for a named
|
|
4
|
+
* Builds a call graph for a named callable within a ts-morph Project.
|
|
5
5
|
* Supports traversal upward (callers) and downward (callees) with configurable depth.
|
|
6
6
|
*
|
|
7
|
+
* Supported targets (and graph nodes):
|
|
8
|
+
* - class methods and top-level functions
|
|
9
|
+
* - constructors (`'constructor'` or `'ClassName.constructor'`); a class
|
|
10
|
+
* without an explicit constructor is represented by its field initializers
|
|
11
|
+
* - get/set accessors
|
|
12
|
+
* - properties and top-level variables initialized with an arrow function or
|
|
13
|
+
* function expression
|
|
14
|
+
*
|
|
15
|
+
* Callees include:
|
|
16
|
+
* - call expressions (resolved via the type checker, name-based fallback
|
|
17
|
+
* only when the symbol cannot be resolved)
|
|
18
|
+
* - `new X()` (edge to X's constructor, including X's field initializers)
|
|
19
|
+
* - `super(...)` (edge to the base class constructor)
|
|
20
|
+
* - property reads/writes that resolve to a getter/setter
|
|
21
|
+
* - for constructors: instance field initializers (they run during
|
|
22
|
+
* construction)
|
|
23
|
+
*
|
|
24
|
+
* Callers are the enclosing callable of each reference: method, function,
|
|
25
|
+
* constructor, accessor, arrow-function property, or (for references in a
|
|
26
|
+
* field initializer) the owning class constructor. Callers of a constructor
|
|
27
|
+
* are the `new X()` sites and the constructors of subclasses.
|
|
28
|
+
*
|
|
7
29
|
* @remarks
|
|
8
30
|
* Used in bug investigation to understand how an error propagates through the
|
|
9
31
|
* codebase. Combine with `find-usages` to trace the full call path from the
|
|
10
|
-
* entry point to the failing code.
|
|
32
|
+
* entry point to the failing code, e.g. "what runs transitively while an
|
|
33
|
+
* interceptor is constructed" (ctor -> helper getter -> static config read).
|
|
11
34
|
*
|
|
12
35
|
* @example
|
|
13
36
|
* ```typescript
|
|
@@ -18,11 +41,19 @@
|
|
|
18
41
|
* });
|
|
19
42
|
* // graph.callers → who calls getUser
|
|
20
43
|
* // graph.callees → what getUser calls
|
|
44
|
+
*
|
|
45
|
+
* const ctorGraph = builder.buildCallGraph(
|
|
46
|
+
* 'AuthInterceptor.constructor',
|
|
47
|
+
* '/src/app/auth.interceptor.ts',
|
|
48
|
+
* { direction: 'down', depth: 3 },
|
|
49
|
+
* );
|
|
21
50
|
* ```
|
|
22
51
|
*/
|
|
23
|
-
import { SyntaxKind } from 'ts-morph';
|
|
52
|
+
import { Node, SyntaxKind, } from 'ts-morph';
|
|
53
|
+
const CONSTRUCTOR_NAME = 'constructor';
|
|
24
54
|
/**
|
|
25
|
-
* Builds caller/callee graphs for methods
|
|
55
|
+
* Builds caller/callee graphs for methods, functions, constructors,
|
|
56
|
+
* accessors and arrow-function properties across a ts-morph Project.
|
|
26
57
|
*/
|
|
27
58
|
export class CallGraphBuilder {
|
|
28
59
|
project;
|
|
@@ -33,10 +64,13 @@ export class CallGraphBuilder {
|
|
|
33
64
|
this.project = project;
|
|
34
65
|
}
|
|
35
66
|
/**
|
|
36
|
-
* Builds a call graph rooted at the named
|
|
67
|
+
* Builds a call graph rooted at the named callable.
|
|
37
68
|
*
|
|
38
|
-
* @param method - Name of the
|
|
39
|
-
*
|
|
69
|
+
* @param method - Name of the callable to analyse. Accepts a method,
|
|
70
|
+
* function, accessor or arrow-function property name, `'constructor'`,
|
|
71
|
+
* or a class-qualified name such as `'AuthInterceptor.constructor'` or
|
|
72
|
+
* `'AuthInterceptor.headers'`.
|
|
73
|
+
* @param file - Absolute path of the source file containing the callable.
|
|
40
74
|
* @param options - Traversal direction and depth. Defaults to `both` / depth `2`.
|
|
41
75
|
* @returns A `CallGraphResult` with the target and its caller/callee trees.
|
|
42
76
|
*/
|
|
@@ -50,127 +84,423 @@ export class CallGraphBuilder {
|
|
|
50
84
|
const targetInfo = {
|
|
51
85
|
name: method,
|
|
52
86
|
file,
|
|
53
|
-
line: target.getStartLineNumber(),
|
|
87
|
+
line: target.node.getStartLineNumber(),
|
|
88
|
+
kind: target.kind,
|
|
89
|
+
...(target.className ? { className: target.className } : {}),
|
|
54
90
|
};
|
|
91
|
+
const rootKey = this.keyOf(target);
|
|
55
92
|
const callers = direction === 'down'
|
|
56
93
|
? []
|
|
57
|
-
: this.buildCallers(target, depth, new Set([
|
|
94
|
+
: this.buildCallers(target, depth, new Set([rootKey]));
|
|
58
95
|
const callees = direction === 'up'
|
|
59
96
|
? []
|
|
60
|
-
: this.buildCallees(target, depth, new Set([
|
|
97
|
+
: this.buildCallees(target, depth, new Set([rootKey]));
|
|
61
98
|
return { target: targetInfo, callers, callees };
|
|
62
99
|
}
|
|
100
|
+
// ---------------------------------------------------------------------------
|
|
101
|
+
// Target resolution
|
|
102
|
+
// ---------------------------------------------------------------------------
|
|
63
103
|
resolveTarget(name, file) {
|
|
64
104
|
const sourceFile = this.project.getSourceFile(file);
|
|
65
105
|
if (!sourceFile) {
|
|
66
106
|
return null;
|
|
67
107
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
108
|
+
const dotIndex = name.lastIndexOf('.');
|
|
109
|
+
const className = dotIndex > 0 ? name.slice(0, dotIndex) : undefined;
|
|
110
|
+
const memberName = dotIndex > 0 ? name.slice(dotIndex + 1) : name;
|
|
111
|
+
const classes = sourceFile
|
|
112
|
+
.getClasses()
|
|
113
|
+
.filter((cls) => !className || cls.getName() === className);
|
|
114
|
+
for (const cls of classes) {
|
|
115
|
+
const member = this.findClassMember(cls, memberName);
|
|
116
|
+
if (member) {
|
|
117
|
+
return member;
|
|
73
118
|
}
|
|
74
119
|
}
|
|
75
|
-
|
|
76
|
-
|
|
120
|
+
if (className) {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
const fn = sourceFile.getFunction(memberName);
|
|
77
124
|
if (fn) {
|
|
78
|
-
return fn;
|
|
125
|
+
return this.toCallable(fn);
|
|
126
|
+
}
|
|
127
|
+
const variable = sourceFile.getVariableDeclaration(memberName);
|
|
128
|
+
if (variable) {
|
|
129
|
+
return this.toCallable(variable);
|
|
130
|
+
}
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
findClassMember(cls, memberName) {
|
|
134
|
+
if (memberName === CONSTRUCTOR_NAME) {
|
|
135
|
+
return this.constructorOf(cls);
|
|
136
|
+
}
|
|
137
|
+
const candidates = [
|
|
138
|
+
cls.getMethod(memberName),
|
|
139
|
+
cls.getGetAccessor(memberName),
|
|
140
|
+
cls.getSetAccessor(memberName),
|
|
141
|
+
cls.getProperty(memberName),
|
|
142
|
+
];
|
|
143
|
+
for (const candidate of candidates) {
|
|
144
|
+
const callable = candidate ? this.toCallable(candidate) : null;
|
|
145
|
+
if (callable) {
|
|
146
|
+
return callable;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
// ---------------------------------------------------------------------------
|
|
152
|
+
// Callable construction
|
|
153
|
+
// ---------------------------------------------------------------------------
|
|
154
|
+
/**
|
|
155
|
+
* Converts a declaration node into a `Callable`, or `null` when the node
|
|
156
|
+
* cannot run code (e.g. a plain data property or an interface member).
|
|
157
|
+
*/
|
|
158
|
+
toCallable(node) {
|
|
159
|
+
if (Node.isConstructorDeclaration(node)) {
|
|
160
|
+
const cls = node.getParent();
|
|
161
|
+
return Node.isClassDeclaration(cls) ? this.constructorOf(cls) : null;
|
|
162
|
+
}
|
|
163
|
+
if (Node.isMethodDeclaration(node)) {
|
|
164
|
+
return {
|
|
165
|
+
node,
|
|
166
|
+
name: node.getName(),
|
|
167
|
+
kind: 'method',
|
|
168
|
+
bodies: this.compact([node.getBody()]),
|
|
169
|
+
nameNode: node.getNameNode(),
|
|
170
|
+
className: this.classNameOf(node),
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
if (Node.isFunctionDeclaration(node)) {
|
|
174
|
+
const name = node.getName();
|
|
175
|
+
if (!name) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
return {
|
|
179
|
+
node,
|
|
180
|
+
name,
|
|
181
|
+
kind: 'function',
|
|
182
|
+
bodies: this.compact([node.getBody()]),
|
|
183
|
+
nameNode: node.getNameNode(),
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
if (Node.isGetAccessorDeclaration(node) || Node.isSetAccessorDeclaration(node)) {
|
|
187
|
+
return {
|
|
188
|
+
node,
|
|
189
|
+
name: node.getName(),
|
|
190
|
+
kind: Node.isGetAccessorDeclaration(node) ? 'getter' : 'setter',
|
|
191
|
+
bodies: this.compact([node.getBody()]),
|
|
192
|
+
nameNode: node.getNameNode(),
|
|
193
|
+
className: this.classNameOf(node),
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
if (Node.isPropertyDeclaration(node) || Node.isVariableDeclaration(node)) {
|
|
197
|
+
const fnBody = this.functionInitializerBody(node.getInitializer());
|
|
198
|
+
if (!fnBody) {
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
node,
|
|
203
|
+
name: node.getName(),
|
|
204
|
+
kind: Node.isPropertyDeclaration(node) ? 'property' : 'variable',
|
|
205
|
+
bodies: [fnBody],
|
|
206
|
+
nameNode: node.getNameNode(),
|
|
207
|
+
className: Node.isPropertyDeclaration(node)
|
|
208
|
+
? this.classNameOf(node)
|
|
209
|
+
: undefined,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Constructor callable for a class: the explicit constructor body (if any)
|
|
216
|
+
* plus all non-static, non-function field initializers.
|
|
217
|
+
*/
|
|
218
|
+
constructorOf(cls) {
|
|
219
|
+
const explicit = cls
|
|
220
|
+
.getConstructors()
|
|
221
|
+
.find((ctor) => ctor.getBody() !== undefined);
|
|
222
|
+
const fieldInitializers = cls
|
|
223
|
+
.getProperties()
|
|
224
|
+
.filter((prop) => !prop.isStatic())
|
|
225
|
+
.map((prop) => prop.getInitializer())
|
|
226
|
+
.filter((init) => init !== undefined && !this.functionInitializerBody(init));
|
|
227
|
+
return {
|
|
228
|
+
node: explicit ?? cls,
|
|
229
|
+
name: CONSTRUCTOR_NAME,
|
|
230
|
+
kind: 'constructor',
|
|
231
|
+
bodies: [...this.compact([explicit?.getBody()]), ...fieldInitializers],
|
|
232
|
+
nameNode: cls.getNameNode(),
|
|
233
|
+
className: cls.getName(),
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
functionInitializerBody(initializer) {
|
|
237
|
+
if (initializer &&
|
|
238
|
+
(Node.isArrowFunction(initializer) ||
|
|
239
|
+
Node.isFunctionExpression(initializer))) {
|
|
240
|
+
return initializer.getBody();
|
|
79
241
|
}
|
|
80
242
|
return null;
|
|
81
243
|
}
|
|
244
|
+
classNameOf(node) {
|
|
245
|
+
const cls = node.getParent();
|
|
246
|
+
return Node.isClassDeclaration(cls) ? cls.getName() : undefined;
|
|
247
|
+
}
|
|
248
|
+
compact(nodes) {
|
|
249
|
+
return nodes.filter((n) => n !== undefined);
|
|
250
|
+
}
|
|
251
|
+
// ---------------------------------------------------------------------------
|
|
252
|
+
// Callees
|
|
253
|
+
// ---------------------------------------------------------------------------
|
|
82
254
|
buildCallees(callable, depth, visited) {
|
|
83
255
|
if (depth <= 0) {
|
|
84
256
|
return [];
|
|
85
257
|
}
|
|
86
258
|
const callees = [];
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
return [];
|
|
90
|
-
}
|
|
91
|
-
body.forEachDescendant((node) => {
|
|
92
|
-
if (node.getKind() !== SyntaxKind.CallExpression) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
const callExpr = node.asKindOrThrow(SyntaxKind.CallExpression);
|
|
96
|
-
const expr = callExpr.getExpression();
|
|
97
|
-
const calleeName = this.extractCallName(expr.getText());
|
|
98
|
-
if (!calleeName) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
const targetDecl = this.findDeclarationInProject(calleeName);
|
|
102
|
-
if (!targetDecl) {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
const targetFile = targetDecl.getSourceFile().getFilePath();
|
|
106
|
-
const key = `${targetFile}:${calleeName}`;
|
|
259
|
+
for (const target of this.collectCalleeCallables(callable)) {
|
|
260
|
+
const key = this.keyOf(target);
|
|
107
261
|
if (visited.has(key)) {
|
|
108
|
-
|
|
262
|
+
continue;
|
|
109
263
|
}
|
|
110
264
|
visited.add(key);
|
|
111
|
-
const children = this.buildCallees(
|
|
112
|
-
callees.push(
|
|
113
|
-
|
|
114
|
-
file: targetFile,
|
|
115
|
-
line: targetDecl.getStartLineNumber(),
|
|
116
|
-
children,
|
|
117
|
-
});
|
|
118
|
-
});
|
|
265
|
+
const children = this.buildCallees(target, depth - 1, new Set(visited));
|
|
266
|
+
callees.push(this.toCallNode(target, children));
|
|
267
|
+
}
|
|
119
268
|
return this.deduplicateNodes(callees);
|
|
120
269
|
}
|
|
270
|
+
collectCalleeCallables(callable) {
|
|
271
|
+
const result = [];
|
|
272
|
+
for (const body of callable.bodies) {
|
|
273
|
+
for (const node of [body, ...body.getDescendants()]) {
|
|
274
|
+
result.push(...this.calleesAt(node));
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return result;
|
|
278
|
+
}
|
|
279
|
+
calleesAt(node) {
|
|
280
|
+
if (Node.isCallExpression(node)) {
|
|
281
|
+
const expr = node.getExpression();
|
|
282
|
+
if (expr.getKind() === SyntaxKind.SuperKeyword) {
|
|
283
|
+
return this.superConstructor(node);
|
|
284
|
+
}
|
|
285
|
+
return this.resolveCallExpressionTarget(expr);
|
|
286
|
+
}
|
|
287
|
+
if (Node.isNewExpression(node)) {
|
|
288
|
+
return this.resolveNewExpressionTarget(node.getExpression());
|
|
289
|
+
}
|
|
290
|
+
if (Node.isPropertyAccessExpression(node)) {
|
|
291
|
+
return this.resolveAccessorTarget(node);
|
|
292
|
+
}
|
|
293
|
+
return [];
|
|
294
|
+
}
|
|
295
|
+
resolveCallExpressionTarget(expr) {
|
|
296
|
+
const resolved = this.resolveSymbolDeclarations(expr);
|
|
297
|
+
if (resolved) {
|
|
298
|
+
return this.pickCallables(resolved);
|
|
299
|
+
}
|
|
300
|
+
// Fallback: name-based lookup when the checker cannot resolve the symbol
|
|
301
|
+
const calleeName = this.extractCallName(expr.getText());
|
|
302
|
+
if (!calleeName) {
|
|
303
|
+
return [];
|
|
304
|
+
}
|
|
305
|
+
const fallback = this.findDeclarationInProject(calleeName);
|
|
306
|
+
return fallback ? [fallback] : [];
|
|
307
|
+
}
|
|
308
|
+
resolveNewExpressionTarget(expr) {
|
|
309
|
+
const declarations = this.resolveSymbolDeclarations(expr);
|
|
310
|
+
const classes = (declarations ?? []).filter((d) => Node.isClassDeclaration(d));
|
|
311
|
+
if (classes.length > 0) {
|
|
312
|
+
return classes.map((cls) => this.constructorOf(cls));
|
|
313
|
+
}
|
|
314
|
+
if (declarations) {
|
|
315
|
+
return [];
|
|
316
|
+
}
|
|
317
|
+
const className = this.extractCallName(expr.getText());
|
|
318
|
+
const cls = className ? this.findClassInProject(className) : null;
|
|
319
|
+
return cls ? [this.constructorOf(cls)] : [];
|
|
320
|
+
}
|
|
321
|
+
resolveAccessorTarget(access) {
|
|
322
|
+
if (!Node.isPropertyAccessExpression(access)) {
|
|
323
|
+
return [];
|
|
324
|
+
}
|
|
325
|
+
const parent = access.getParent();
|
|
326
|
+
// Calls are handled by the CallExpression branch
|
|
327
|
+
if (Node.isCallExpression(parent) && parent.getExpression() === access) {
|
|
328
|
+
return [];
|
|
329
|
+
}
|
|
330
|
+
const declarations = this.resolveSymbolDeclarations(access);
|
|
331
|
+
if (!declarations) {
|
|
332
|
+
return [];
|
|
333
|
+
}
|
|
334
|
+
const isWrite = Node.isBinaryExpression(parent) &&
|
|
335
|
+
parent.getLeft() === access &&
|
|
336
|
+
parent.getOperatorToken().getKind() === SyntaxKind.EqualsToken;
|
|
337
|
+
return declarations
|
|
338
|
+
.filter((d) => isWrite
|
|
339
|
+
? Node.isSetAccessorDeclaration(d)
|
|
340
|
+
: Node.isGetAccessorDeclaration(d))
|
|
341
|
+
.map((d) => this.toCallable(d))
|
|
342
|
+
.filter((c) => c !== null);
|
|
343
|
+
}
|
|
344
|
+
superConstructor(call) {
|
|
345
|
+
const cls = call.getFirstAncestorByKind(SyntaxKind.ClassDeclaration);
|
|
346
|
+
const base = cls?.getBaseClass();
|
|
347
|
+
return base ? [this.constructorOf(base)] : [];
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Resolves the declarations behind an expression via the type checker.
|
|
351
|
+
* Returns `undefined` when no symbol can be resolved (caller may fall back
|
|
352
|
+
* to name-based lookup) and an empty array when the symbol resolves to
|
|
353
|
+
* declarations that cannot be represented.
|
|
354
|
+
*/
|
|
355
|
+
resolveSymbolDeclarations(expr) {
|
|
356
|
+
const target = Node.isPropertyAccessExpression(expr)
|
|
357
|
+
? expr.getNameNode()
|
|
358
|
+
: expr;
|
|
359
|
+
let symbol = target.getSymbol();
|
|
360
|
+
if (!symbol) {
|
|
361
|
+
return undefined;
|
|
362
|
+
}
|
|
363
|
+
if (symbol.isAlias()) {
|
|
364
|
+
symbol = symbol.getAliasedSymbol() ?? symbol;
|
|
365
|
+
}
|
|
366
|
+
return symbol.getDeclarations();
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Maps declarations to callables, preferring implementations (with body)
|
|
370
|
+
* over overload signatures and skipping ambient (.d.ts) declarations.
|
|
371
|
+
*/
|
|
372
|
+
pickCallables(declarations) {
|
|
373
|
+
const callables = declarations
|
|
374
|
+
.filter((d) => !d.getSourceFile().isDeclarationFile())
|
|
375
|
+
.map((d) => this.toCallable(d))
|
|
376
|
+
.filter((c) => c !== null);
|
|
377
|
+
const withBody = callables.filter((c) => c.bodies.length > 0);
|
|
378
|
+
return withBody.length > 0 ? withBody : callables;
|
|
379
|
+
}
|
|
380
|
+
// ---------------------------------------------------------------------------
|
|
381
|
+
// Callers
|
|
382
|
+
// ---------------------------------------------------------------------------
|
|
121
383
|
buildCallers(callable, depth, visited) {
|
|
122
|
-
if (depth <= 0) {
|
|
384
|
+
if (depth <= 0 || !callable.nameNode) {
|
|
123
385
|
return [];
|
|
124
386
|
}
|
|
125
387
|
const callers = [];
|
|
126
|
-
const
|
|
127
|
-
|
|
388
|
+
for (const refNode of this.referenceNodes(callable)) {
|
|
389
|
+
const caller = this.callerForReference(callable, refNode);
|
|
390
|
+
if (!caller) {
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
const key = this.keyOf(caller);
|
|
394
|
+
if (visited.has(key)) {
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
visited.add(key);
|
|
398
|
+
const children = this.buildCallers(caller, depth - 1, new Set(visited));
|
|
399
|
+
callers.push(this.toCallNode(caller, children));
|
|
400
|
+
}
|
|
401
|
+
return this.deduplicateNodes(callers);
|
|
402
|
+
}
|
|
403
|
+
referenceNodes(callable) {
|
|
404
|
+
if (!callable.nameNode) {
|
|
128
405
|
return [];
|
|
129
406
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
continue;
|
|
141
|
-
}
|
|
142
|
-
const callerName = parentMethod.getName();
|
|
143
|
-
if (!callerName) {
|
|
144
|
-
continue;
|
|
407
|
+
try {
|
|
408
|
+
const refs = this.project
|
|
409
|
+
.getLanguageService()
|
|
410
|
+
.findReferences(callable.nameNode);
|
|
411
|
+
const nodes = [];
|
|
412
|
+
for (const refSymbol of refs) {
|
|
413
|
+
for (const ref of refSymbol.getReferences()) {
|
|
414
|
+
if (!ref.isDefinition()) {
|
|
415
|
+
nodes.push(ref.getNode());
|
|
416
|
+
}
|
|
145
417
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
418
|
+
}
|
|
419
|
+
return nodes;
|
|
420
|
+
}
|
|
421
|
+
catch {
|
|
422
|
+
return [];
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Maps a reference to the callable that performs the call. For
|
|
427
|
+
* constructor targets only `new X()` sites and subclass constructors
|
|
428
|
+
* (implicit or explicit `super()` calls) count.
|
|
429
|
+
*/
|
|
430
|
+
callerForReference(target, refNode) {
|
|
431
|
+
if (target.kind === 'constructor') {
|
|
432
|
+
const parent = refNode.getParent();
|
|
433
|
+
if (Node.isNewExpression(parent) && parent.getExpression() === refNode) {
|
|
434
|
+
return this.enclosingCallable(refNode);
|
|
435
|
+
}
|
|
436
|
+
const heritage = refNode.getFirstAncestorByKind(SyntaxKind.HeritageClause);
|
|
437
|
+
const subclass = heritage?.getParent();
|
|
438
|
+
if (heritage?.getToken() === SyntaxKind.ExtendsKeyword &&
|
|
439
|
+
Node.isClassDeclaration(subclass)) {
|
|
440
|
+
return this.constructorOf(subclass);
|
|
441
|
+
}
|
|
442
|
+
return null;
|
|
443
|
+
}
|
|
444
|
+
return this.enclosingCallable(refNode);
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Finds the callable that contains `node`. Anonymous callbacks are
|
|
448
|
+
* attributed to their enclosing named callable; references inside a
|
|
449
|
+
* non-function field initializer are attributed to the class constructor.
|
|
450
|
+
*/
|
|
451
|
+
enclosingCallable(node) {
|
|
452
|
+
for (let current = node.getParent(); current !== undefined; current = current.getParent()) {
|
|
453
|
+
if (Node.isMethodDeclaration(current) ||
|
|
454
|
+
Node.isFunctionDeclaration(current) ||
|
|
455
|
+
Node.isConstructorDeclaration(current) ||
|
|
456
|
+
Node.isGetAccessorDeclaration(current) ||
|
|
457
|
+
Node.isSetAccessorDeclaration(current)) {
|
|
458
|
+
return this.toCallable(current);
|
|
459
|
+
}
|
|
460
|
+
if (Node.isArrowFunction(current) || Node.isFunctionExpression(current)) {
|
|
461
|
+
const owner = current.getParent();
|
|
462
|
+
const isNamedOwner = (Node.isPropertyDeclaration(owner) ||
|
|
463
|
+
Node.isVariableDeclaration(owner)) &&
|
|
464
|
+
owner.getInitializer() === current;
|
|
465
|
+
if (isNamedOwner) {
|
|
466
|
+
return this.toCallable(owner);
|
|
150
467
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
468
|
+
continue;
|
|
469
|
+
}
|
|
470
|
+
if (Node.isPropertyDeclaration(current)) {
|
|
471
|
+
const cls = current.getParent();
|
|
472
|
+
const runsInConstructor = !current.isStatic() && Node.isClassDeclaration(cls);
|
|
473
|
+
return runsInConstructor ? this.constructorOf(cls) : null;
|
|
474
|
+
}
|
|
475
|
+
if (Node.isClassDeclaration(current) || Node.isSourceFile(current)) {
|
|
476
|
+
return null;
|
|
159
477
|
}
|
|
160
478
|
}
|
|
161
|
-
return
|
|
479
|
+
return null;
|
|
162
480
|
}
|
|
481
|
+
// ---------------------------------------------------------------------------
|
|
482
|
+
// Name-based fallback and helpers
|
|
483
|
+
// ---------------------------------------------------------------------------
|
|
163
484
|
findDeclarationInProject(name) {
|
|
164
485
|
for (const sourceFile of this.project.getSourceFiles()) {
|
|
165
486
|
for (const cls of sourceFile.getClasses()) {
|
|
166
487
|
const method = cls.getMethod(name);
|
|
167
488
|
if (method) {
|
|
168
|
-
return method;
|
|
489
|
+
return this.toCallable(method);
|
|
169
490
|
}
|
|
170
491
|
}
|
|
171
492
|
const fn = sourceFile.getFunction(name);
|
|
172
493
|
if (fn) {
|
|
173
|
-
return fn;
|
|
494
|
+
return this.toCallable(fn);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
return null;
|
|
498
|
+
}
|
|
499
|
+
findClassInProject(name) {
|
|
500
|
+
for (const sourceFile of this.project.getSourceFiles()) {
|
|
501
|
+
const cls = sourceFile.getClass(name);
|
|
502
|
+
if (cls) {
|
|
503
|
+
return cls;
|
|
174
504
|
}
|
|
175
505
|
}
|
|
176
506
|
return null;
|
|
@@ -181,10 +511,23 @@ export class CallGraphBuilder {
|
|
|
181
511
|
const last = parts.at(-1);
|
|
182
512
|
return last && /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(last) ? last : null;
|
|
183
513
|
}
|
|
514
|
+
keyOf(callable) {
|
|
515
|
+
return `${callable.node.getSourceFile().getFilePath()}:${callable.node.getStartLineNumber()}:${callable.name}`;
|
|
516
|
+
}
|
|
517
|
+
toCallNode(callable, children) {
|
|
518
|
+
return {
|
|
519
|
+
name: callable.name,
|
|
520
|
+
file: callable.node.getSourceFile().getFilePath(),
|
|
521
|
+
line: callable.node.getStartLineNumber(),
|
|
522
|
+
kind: callable.kind,
|
|
523
|
+
...(callable.className ? { className: callable.className } : {}),
|
|
524
|
+
children,
|
|
525
|
+
};
|
|
526
|
+
}
|
|
184
527
|
deduplicateNodes(nodes) {
|
|
185
528
|
const seen = new Set();
|
|
186
529
|
return nodes.filter((n) => {
|
|
187
|
-
const key = `${n.file}:${n.name}`;
|
|
530
|
+
const key = `${n.file}:${n.line}:${n.name}`;
|
|
188
531
|
if (seen.has(key)) {
|
|
189
532
|
return false;
|
|
190
533
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"call-graph-builder.js","sourceRoot":"","sources":["../../src/investigation/call-graph-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAiDtC;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAIE;IAH7B;;OAEG;IACH,YAA6B,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;IAAG,CAAC;IAEjD;;;;;;;OAOG;IACH,cAAc,CACZ,MAAc,EACd,IAAY,EACZ,UAA4B,EAAE;QAE9B,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,MAAM,CAAC;QAC9C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC;QAEjC,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAChD,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;QACpD,CAAC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