@callidescope/graph 0.0.1

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.
@@ -0,0 +1,1836 @@
1
+ import e from "node:path";
2
+ import { ConsoleLogger as t, Global as n, Injectable as r, Module as i, Scope as a } from "@nestjs/common";
3
+ import o from "typescript";
4
+ import { existsSync as s, mkdirSync as ee, readdirSync as te } from "node:fs";
5
+ import c from "pino";
6
+ import { execFileSync as ne } from "node:child_process";
7
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/callables/address.constants.ts
8
+ var re = /^\d+$/u, ie = /:\d+$/u;
9
+ //#endregion
10
+ //#region \0@oxc-project+runtime@0.151.0/helpers/esm/decorateMetadata.js
11
+ function l(e, t) {
12
+ if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(e, t);
13
+ }
14
+ //#endregion
15
+ //#region \0@oxc-project+runtime@0.151.0/helpers/esm/decorate.js
16
+ function u(e, t, n, r) {
17
+ var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
18
+ if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
19
+ else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
20
+ return i > 3 && a && Object.defineProperty(t, n, a), a;
21
+ }
22
+ //#endregion
23
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/callables/address.service.ts
24
+ var d = class {
25
+ constructor() {}
26
+ countCandidatesByLine(e) {
27
+ let t = /* @__PURE__ */ new Map();
28
+ for (let n of e) {
29
+ let { line: e } = n.location;
30
+ t.set(e, (t.get(e) ?? 0) + 1);
31
+ }
32
+ return t;
33
+ }
34
+ describeInvalidAddress(e) {
35
+ return `"${e}" is not a callable address. It needs a file path and a qualified name joined by "#", as in "src/foo.service.ts#FooService.bar", optionally followed by ":<line>" to disambiguate.`;
36
+ }
37
+ findMatches(e) {
38
+ let t = [];
39
+ for (let n of e.callablesById.values()) {
40
+ let { location: r } = n.node, i = r.filePath === e.workspaceRelativePath, a = n.node.displayName === e.displayName, o = e.line === void 0 || r.line === e.line;
41
+ i && a && o && t.push(n);
42
+ }
43
+ return t;
44
+ }
45
+ parseAddress(e) {
46
+ let t = e.address.lastIndexOf("#");
47
+ if (t <= 0 || t === e.address.length - 1) return;
48
+ let n = e.address.slice(0, t), r = e.address.slice(t + 1), { displayName: i, line: a } = this.parseSymbolPath(r);
49
+ return {
50
+ displayName: i,
51
+ line: a,
52
+ workspaceRelativePath: this.toWorkspaceRelative({
53
+ filePath: n,
54
+ workspaceRoot: e.workspaceRoot
55
+ })
56
+ };
57
+ }
58
+ parseSymbolPath(e) {
59
+ let t = e.lastIndexOf(":"), n = e.slice(t + 1);
60
+ return t === -1 || !re.test(n) ? {
61
+ displayName: e,
62
+ line: void 0
63
+ } : {
64
+ displayName: e.slice(0, t),
65
+ line: Number(n)
66
+ };
67
+ }
68
+ toAddress(e) {
69
+ return `${e.location.filePath}#${e.displayName}`;
70
+ }
71
+ toCandidates(e) {
72
+ return e.map((e) => ({
73
+ id: e.node.id,
74
+ location: e.node.location
75
+ }));
76
+ }
77
+ toWorkspaceRelative(t) {
78
+ let n = e.resolve(t.workspaceRoot, t.filePath);
79
+ return e.relative(t.workspaceRoot, n).split(e.sep).join("/");
80
+ }
81
+ describeCandidates(e) {
82
+ let t = e.address.replace(ie, ""), n = this.countCandidatesByLine(e.candidates), r = [...n.values()].some((e) => e > 1), i = e.candidates.map((e) => {
83
+ let { column: r, line: i } = e.location, a = `${t}:${String(i)}`;
84
+ return n.get(i) === 1 ? a : `${a} (column ${String(r)})`;
85
+ }), a = r ? "Two declarations on one line cannot be told apart by \":<line>\" — rename one, or name a different callable." : "Add \":<line>\" to the address to pick one.";
86
+ return `Candidates: ${[...new Set(i)].join(", ")}. ${a}`;
87
+ }
88
+ listAddresses(e) {
89
+ let t = /* @__PURE__ */ new Map();
90
+ for (let n of e.values()) {
91
+ let e = this.toAddress(n.node);
92
+ t.set(e, (t.get(e) ?? 0) + 1);
93
+ }
94
+ return [...e.values()].map((e) => {
95
+ let n = this.toAddress(e.node);
96
+ return t.get(n) === 1 ? n : `${n}:${String(e.node.location.line)}`;
97
+ }).toSorted((e, t) => e.localeCompare(t));
98
+ }
99
+ resolve(e) {
100
+ let t = this.parseAddress(e);
101
+ if (t === void 0) return {
102
+ kind: "invalid",
103
+ reason: this.describeInvalidAddress(e.address)
104
+ };
105
+ let n = this.findMatches({
106
+ ...t,
107
+ callablesById: e.callablesById
108
+ }), [r] = n;
109
+ return r === void 0 ? { kind: "not-found" } : n.length === 1 ? {
110
+ id: r.node.id,
111
+ kind: "resolved"
112
+ } : {
113
+ candidates: this.toCandidates(n),
114
+ kind: "ambiguous"
115
+ };
116
+ }
117
+ };
118
+ d = u([r(), l("design:paramtypes", [])], d);
119
+ //#endregion
120
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/callables/callables.constants.ts
121
+ var ae = "anonymous", f = class {
122
+ constructor() {}
123
+ describeCallbackArgument(e) {
124
+ let { parent: t } = e;
125
+ if (o.isCallExpression(t)) return `${o.isPropertyAccessExpression(t.expression) ? t.expression.name.text : t.expression.getText()}(…)`;
126
+ }
127
+ readBindingName(e) {
128
+ if ((o.isPropertyDeclaration(e) || o.isPropertyAssignment(e) || o.isVariableDeclaration(e)) && o.isIdentifier(e.name)) return e.name.text;
129
+ }
130
+ readBoundKind(e) {
131
+ return o.isPropertyDeclaration(e) ? "arrow-property" : o.isPropertyAssignment(e) || o.isVariableDeclaration(e) ? "object-literal-method" : "callback";
132
+ }
133
+ buildId(e) {
134
+ return `${e.workspaceRelativePath}#${String(e.declaration.getStart())}`;
135
+ }
136
+ countStatements(e) {
137
+ let { body: t } = e;
138
+ return t === void 0 || !o.isBlock(t) ? t === void 0 ? 0 : 1 : t.statements.length;
139
+ }
140
+ isExported(e) {
141
+ if ((o.getCombinedModifierFlags(e) & o.ModifierFlags.Export) !== 0) return !0;
142
+ let t = o.findAncestor(e, (e) => o.isClassDeclaration(e) || o.isVariableDeclaration(e));
143
+ return t !== void 0 && (o.getCombinedModifierFlags(t) & o.ModifierFlags.Export) !== 0;
144
+ }
145
+ readDisplayName(e) {
146
+ let t = this.readMemberName(e), n = this.readEnclosingTypeName(e);
147
+ return n === void 0 ? t : `${n}.${t}`;
148
+ }
149
+ readEnclosingTypeName(e) {
150
+ return o.findAncestor(e, (e) => o.isClassDeclaration(e) || o.isClassExpression(e))?.name?.text;
151
+ }
152
+ readKind(e) {
153
+ return o.isConstructorDeclaration(e) ? "constructor" : o.isGetAccessorDeclaration(e) || o.isSetAccessorDeclaration(e) ? "accessor" : o.isMethodDeclaration(e) ? o.isObjectLiteralExpression(e.parent) ? "object-literal-method" : "method" : o.isFunctionDeclaration(e) ? "function" : this.readBoundKind(e.parent);
154
+ }
155
+ readLocation(e) {
156
+ let t = e.declaration.getSourceFile().getLineAndCharacterOfPosition(e.declaration.getStart());
157
+ return {
158
+ column: t.character + 1,
159
+ filePath: e.workspaceRelativePath,
160
+ line: t.line + 1
161
+ };
162
+ }
163
+ readMemberName(e) {
164
+ return o.isConstructorDeclaration(e) ? "constructor" : e.name !== void 0 && o.isIdentifier(e.name) ? `${o.isGetAccessorDeclaration(e) ? "get " : o.isSetAccessorDeclaration(e) ? "set " : ""}${e.name.text}` : this.readBindingName(e.parent) ?? this.describeCallbackArgument(e) ?? "anonymous";
165
+ }
166
+ };
167
+ f = u([r(), l("design:paramtypes", [])], f);
168
+ //#endregion
169
+ //#region packages/logger/src/modules/logger/logger.constants.ts
170
+ var oe = /^(\p{Extended_Pictographic}️?(?:‍\p{Extended_Pictographic}️?)*)\s+/u, se = /^([A-Za-z]+)/, ce = /* @__PURE__ */ new Set([
171
+ "built",
172
+ "cut",
173
+ "found",
174
+ "got",
175
+ "kept",
176
+ "left",
177
+ "lost",
178
+ "made",
179
+ "put",
180
+ "ran",
181
+ "read",
182
+ "rebuilt",
183
+ "sent",
184
+ "set",
185
+ "split",
186
+ "took",
187
+ "wrote"
188
+ ]), le = /* @__PURE__ */ new Set([
189
+ "CommandFactory",
190
+ "ExceptionHandler",
191
+ "GraphQLModule",
192
+ "InstanceLoader",
193
+ "NestApplication",
194
+ "NestFactory",
195
+ "RouterExplorer",
196
+ "RoutesResolver",
197
+ "TypeOrmModule"
198
+ ]), p, m = class extends t {
199
+ static {
200
+ p = this;
201
+ }
202
+ constructor() {
203
+ super();
204
+ }
205
+ static isProduction = process.env.NODE_ENV === "production";
206
+ static rootLogger;
207
+ static writesToStandardError = !1;
208
+ child = p.root;
209
+ static createRootLogger() {
210
+ let e = process.env.LOG_LEVEL ?? "info";
211
+ return p.isProduction ? p.writesToStandardError ? c({ level: e }, c.destination(2)) : c({ level: e }) : c({
212
+ level: e,
213
+ transport: {
214
+ options: {
215
+ colorize: !0,
216
+ destination: p.writesToStandardError ? 2 : 1,
217
+ ignore: "pid,hostname,emoji",
218
+ messageFormat: "{emoji} {msg}",
219
+ singleLine: !0
220
+ },
221
+ target: "pino-pretty"
222
+ }
223
+ });
224
+ }
225
+ static logToStandardError() {
226
+ if (p.rootLogger !== void 0) {
227
+ process.emitWarning("LoggerService.logToStandardError() was called after the first log line, so log lines still go to standard output and anything piping that stream will read them as data. Call it as the first statement of the application's bootstrap.");
228
+ return;
229
+ }
230
+ p.writesToStandardError = !0;
231
+ }
232
+ assertConventionalMessage(e) {
233
+ if (p.isProduction || this.shouldSkipConventionalMessageValidation(e.context)) return;
234
+ let t = this.getConventionalMessageViolation(e.parsed);
235
+ if (t !== void 0) throw Error(t);
236
+ }
237
+ buildBindings(e) {
238
+ return this.assertConventionalMessage({
239
+ context: e.context,
240
+ parsed: e.parsed
241
+ }), {
242
+ ...e.data,
243
+ context: e.context,
244
+ ...p.isProduction ? {} : { emoji: e.parsed.emoji }
245
+ };
246
+ }
247
+ getConventionalMessageViolation(e) {
248
+ let t = e.emoji, n = e.text;
249
+ if (t === void 0) return `Log message must start with an emoji naming its subject, then a verb: "${n}"`;
250
+ let r = se.exec(n)?.[1];
251
+ if (r === void 0 || !this.isConventionalVerb(r)) return `Log message must begin with a verb in present progressive or past tense, got "${r ?? ""}": "${t} ${n}"`;
252
+ }
253
+ isConventionalVerb(e) {
254
+ let t = e.toLowerCase();
255
+ return t.endsWith("ing") || t.endsWith("ed") || ce.has(t);
256
+ }
257
+ parseMessage(e) {
258
+ let t = String(e), n = oe.exec(t), r = n?.[1];
259
+ return r === void 0 ? {
260
+ emoji: void 0,
261
+ text: t
262
+ } : {
263
+ emoji: r,
264
+ text: t.slice(n?.[0].length)
265
+ };
266
+ }
267
+ shouldSkipConventionalMessageValidation(e) {
268
+ return e !== void 0 && le.has(e);
269
+ }
270
+ static get root() {
271
+ return p.rootLogger ??= p.createRootLogger(), p.rootLogger;
272
+ }
273
+ buildErrorLogEntry(e, t) {
274
+ let n = t instanceof Error ? t.stack || t.message : String(t);
275
+ return {
276
+ errorMessage: n,
277
+ logLine: `[${(/* @__PURE__ */ new Date()).toISOString()}] ${e}: ${n}\n`
278
+ };
279
+ }
280
+ createTimestampedOutputLogFilePath(t) {
281
+ let n = e.join(process.cwd(), "output");
282
+ return s(n) || ee(n, { recursive: !0 }), e.join(n, `${t}-${(/* @__PURE__ */ new Date()).toISOString().replaceAll(/[:.]/g, "-")}.log`);
283
+ }
284
+ debug(e, t, n) {
285
+ let r = this.parseMessage(e);
286
+ this.child.debug(this.buildBindings({
287
+ context: t ?? this.context,
288
+ data: n,
289
+ parsed: r
290
+ }), r.text);
291
+ }
292
+ error(e, t, n) {
293
+ let r = this.parseMessage(e), i = typeof n == "object" ? n : void 0, a = typeof n == "string" ? n : this.context;
294
+ this.child.error({
295
+ ...this.buildBindings({
296
+ context: a,
297
+ data: i,
298
+ parsed: r
299
+ }),
300
+ stack: t
301
+ }, r.text);
302
+ }
303
+ info(e, t, n) {
304
+ let r = this.parseMessage(e);
305
+ this.child.info(this.buildBindings({
306
+ context: t ?? this.context,
307
+ data: n,
308
+ parsed: r
309
+ }), r.text);
310
+ }
311
+ log(e, t, n) {
312
+ this.info(e, t, n);
313
+ }
314
+ setContext(e) {
315
+ super.setContext(e), this.child = p.root.child({ context: e });
316
+ }
317
+ verbose(e, t, n) {
318
+ let r = this.parseMessage(e);
319
+ this.child.trace(this.buildBindings({
320
+ context: t ?? this.context,
321
+ data: n,
322
+ parsed: r
323
+ }), r.text);
324
+ }
325
+ warn(e, t, n) {
326
+ let r = this.parseMessage(e);
327
+ this.child.warn(this.buildBindings({
328
+ context: t ?? this.context,
329
+ data: n,
330
+ parsed: r
331
+ }), r.text);
332
+ }
333
+ };
334
+ m = p = u([r({ scope: a.TRANSIENT }), l("design:paramtypes", [])], m);
335
+ //#endregion
336
+ //#region packages/logger/src/modules/logger/logger.module.ts
337
+ var h = class {};
338
+ h = u([n(), i({
339
+ controllers: [],
340
+ exports: [m],
341
+ imports: [],
342
+ providers: [m]
343
+ })], h);
344
+ var ue = "the directory holds no tsconfig.json", g = class extends Error {
345
+ constructor(e) {
346
+ super(`Could not read ${e.configurationPath}: ${e.messages.join("; ")}`), this.name = "ProgramConfigurationError";
347
+ }
348
+ }, de = [
349
+ "node_modules",
350
+ ".git",
351
+ ".nx",
352
+ ".conformetry",
353
+ "dist",
354
+ "build",
355
+ "coverage",
356
+ "out"
357
+ ], fe = "package.json", pe = "tsconfig.json", me = "testing", he = /\.(?:end-to-end|integration|unit)?\.?(?:spec|test)\.[cm]?[jt]sx?$/, _, v = _ = class {
358
+ logger;
359
+ constructor(e) {
360
+ this.logger = e, this.logger.setContext(_.name);
361
+ }
362
+ findAllProjectDirectories(e) {
363
+ let t = [];
364
+ return this.findProjectDirectories({
365
+ directory: e,
366
+ found: t,
367
+ workspaceRoot: e
368
+ }), t;
369
+ }
370
+ findProjectDirectories(t) {
371
+ s(e.join(t.directory, "tsconfig.json")) && t.found.push(this.toWorkspaceRelative({
372
+ absolutePath: t.directory,
373
+ workspaceRoot: t.workspaceRoot
374
+ }));
375
+ for (let n of te(t.directory, { withFileTypes: !0 })) n.isDirectory() && !this.isExcludedFromScan(n.name) && this.findProjectDirectories({
376
+ directory: e.join(t.directory, n.name),
377
+ found: t.found,
378
+ workspaceRoot: t.workspaceRoot
379
+ });
380
+ }
381
+ isClosureDestination(e) {
382
+ return e.root !== "" && e.hasPackageManifest;
383
+ }
384
+ isContainedByRoot(e) {
385
+ return e.root === "" || e.workspaceRelativePath === e.root || e.workspaceRelativePath.startsWith(`${e.root}/`);
386
+ }
387
+ isExcludedFromScan(e) {
388
+ return e.startsWith(".") || e.includes("{{") || de.includes(e);
389
+ }
390
+ isExcludedProject(e) {
391
+ return e.fileFilter?.isExcluded(this.toWorkspaceRelative({
392
+ absolutePath: e.configurationPath,
393
+ workspaceRoot: e.workspaceRoot
394
+ })) === !0;
395
+ }
396
+ discoverProjects(t) {
397
+ let n = t.directories.length > 0 ? t.directories.map((n) => this.toWorkspaceRelative({
398
+ absolutePath: e.resolve(t.workspaceRoot, n),
399
+ workspaceRoot: t.workspaceRoot
400
+ })) : this.findAllProjectDirectories(t.workspaceRoot), r = [];
401
+ for (let i of n) {
402
+ let n = e.join(t.workspaceRoot, i, pe);
403
+ if (this.isExcludedProject({
404
+ configurationPath: n,
405
+ fileFilter: t.fileFilter,
406
+ workspaceRoot: t.workspaceRoot
407
+ })) {
408
+ this.logger.debug("🔭 Skipped an excluded project", void 0, { root: i });
409
+ continue;
410
+ }
411
+ if (!s(n)) throw new g({
412
+ configurationPath: n,
413
+ messages: [ue]
414
+ });
415
+ r.push({
416
+ configurationPath: n,
417
+ hasPackageManifest: s(e.join(t.workspaceRoot, i, fe)),
418
+ name: i,
419
+ root: i
420
+ });
421
+ }
422
+ return r.toSorted((e, t) => e.name.localeCompare(t.name));
423
+ }
424
+ isTestFile(e) {
425
+ return he.test(e) || e.split("/").includes("testing");
426
+ }
427
+ resolveOwningProject(e) {
428
+ let t;
429
+ for (let n of e.projects) this.isContainedByRoot({
430
+ root: n.root,
431
+ workspaceRelativePath: e.workspaceRelativePath
432
+ }) && (t === void 0 || n.root.length > t.root.length) && (t = n);
433
+ return t;
434
+ }
435
+ toWorkspaceRelative(t) {
436
+ return e.relative(t.workspaceRoot, t.absolutePath).split(e.sep).join("/");
437
+ }
438
+ walkImportedProjectClosure(e) {
439
+ let t = /* @__PURE__ */ new Set(), n = e.startingProjects;
440
+ for (; n.length > 0;) {
441
+ let r = [];
442
+ for (let i of n) if (!t.has(i.name)) {
443
+ t.add(i.name);
444
+ for (let n of e.resolveProjectFiles(i)) {
445
+ let i = this.resolveOwningProject({
446
+ projects: e.workspaceProjects,
447
+ workspaceRelativePath: n
448
+ });
449
+ i !== void 0 && !t.has(i.name) && this.isClosureDestination(i) && r.push(i);
450
+ }
451
+ }
452
+ n = r;
453
+ }
454
+ }
455
+ };
456
+ v = _ = u([r(), l("design:paramtypes", [m === void 0 ? Object : m])], v);
457
+ //#endregion
458
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/workspace/file-filter.service.ts
459
+ var y, b = y = class {
460
+ workspaceService;
461
+ logger;
462
+ constructor(e, t) {
463
+ this.workspaceService = e, this.logger = t, this.logger.setContext(y.name);
464
+ }
465
+ isExcludedByOwningProject(t) {
466
+ let n = this.workspaceService.resolveOwningProject({
467
+ projects: t.projects,
468
+ workspaceRelativePath: t.workspaceRelativePath
469
+ });
470
+ if (n === void 0) return !1;
471
+ let r = t.excludeByProject.get(n.name);
472
+ if (r === void 0) return !1;
473
+ let i = e.posix.relative(n.root, t.workspaceRelativePath);
474
+ return r.some((t) => e.matchesGlob(i, t));
475
+ }
476
+ listIgnoredFiles(e) {
477
+ try {
478
+ return ne("git", [
479
+ "ls-files",
480
+ "--cached",
481
+ "--ignored",
482
+ `--exclude-from=${e.ignorePath}`
483
+ ], {
484
+ cwd: e.workspaceRoot,
485
+ encoding: "utf8"
486
+ }).trim().split("\n").filter(Boolean);
487
+ } catch {
488
+ return this.logger.warn("🔭 Skipped an unreadable ignore file", void 0, { ignorePath: e.ignorePath }), [];
489
+ }
490
+ }
491
+ buildFileFilter(t) {
492
+ let n = /* @__PURE__ */ new Set();
493
+ for (let r of t.excludeFrom) {
494
+ let i = e.resolve(t.workspaceRoot, r);
495
+ if (!s(i)) {
496
+ this.logger.warn("🔭 Skipped a missing ignore file", void 0, { ignoreFile: r });
497
+ continue;
498
+ }
499
+ for (let e of this.listIgnoredFiles({
500
+ ignorePath: i,
501
+ workspaceRoot: t.workspaceRoot
502
+ })) n.add(e);
503
+ }
504
+ let r = [...t.exclude];
505
+ return { isExcluded: (t) => n.has(t) || r.some((n) => e.matchesGlob(t, n)) };
506
+ }
507
+ buildProjectFileFilter(e) {
508
+ return e.excludeByProject.size === 0 ? e.fileFilter : { isExcluded: (t) => e.fileFilter.isExcluded(t) || this.isExcludedByOwningProject({
509
+ excludeByProject: e.excludeByProject,
510
+ projects: e.projects,
511
+ workspaceRelativePath: t
512
+ }) };
513
+ }
514
+ };
515
+ b = y = u([r(), l("design:paramtypes", [v === void 0 ? Object : v, m === void 0 ? Object : m])], b);
516
+ //#endregion
517
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/workspace/workspace.module.ts
518
+ var x = class {};
519
+ x = u([i({
520
+ controllers: [],
521
+ exports: [b, v],
522
+ imports: [h],
523
+ providers: [b, v]
524
+ })], x);
525
+ //#endregion
526
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/program/compiler-host.service.ts
527
+ var S = class {
528
+ constructor() {}
529
+ moduleResolutionCaches = /* @__PURE__ */ new Map();
530
+ sourceFileCache = /* @__PURE__ */ new Map();
531
+ resolveModuleCache(e, t) {
532
+ let n = this.moduleResolutionCaches.get(t);
533
+ if (n !== void 0) return n;
534
+ let r = o.createModuleResolutionCache(t, (e) => e, e);
535
+ return this.moduleResolutionCaches.set(t, r), r;
536
+ }
537
+ clear() {
538
+ this.sourceFileCache.clear(), this.moduleResolutionCaches.clear();
539
+ }
540
+ createHost(e) {
541
+ let t = o.createCompilerHost(e.options, !0), n = t.getSourceFile.bind(t);
542
+ return this.resolveModuleCache(e.options, e.workspaceRoot), t.getSourceFile = (e, t) => {
543
+ let r = typeof t == "object" ? t.languageVersion : t, i = `${e} ${String(r)}`, a = this.sourceFileCache.get(i);
544
+ if (a !== void 0) return a;
545
+ let o = n(e, t);
546
+ return o !== void 0 && this.sourceFileCache.set(i, o), o;
547
+ }, t;
548
+ }
549
+ };
550
+ S = u([r(), l("design:paramtypes", [])], S);
551
+ //#endregion
552
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/program/program.service.ts
553
+ var C, w = C = class {
554
+ compilerHostService;
555
+ logger;
556
+ workspaceService;
557
+ constructor(e, t, n) {
558
+ this.compilerHostService = e, this.logger = t, this.workspaceService = n, this.logger.setContext(C.name);
559
+ }
560
+ assignOwnership(e) {
561
+ let t = this.toRealPath(e.workspaceRoot), n = e.programs.map((e) => e.project), r = /* @__PURE__ */ new Set();
562
+ for (let t of e.programs) for (let e of t.ownedFilePaths) r.add(e);
563
+ let i = /* @__PURE__ */ new Map();
564
+ for (let a of r) {
565
+ let r = this.workspaceService.toWorkspaceRelative({
566
+ absolutePath: a,
567
+ workspaceRoot: t
568
+ }), o = this.workspaceService.resolveOwningProject({
569
+ projects: n,
570
+ workspaceRelativePath: r
571
+ }), s = e.programs.find((e) => e.project === o);
572
+ if (s === void 0) {
573
+ this.logger.warn("🔭 Skipped a file no traced project contains", void 0, { workspaceRelativePath: r });
574
+ continue;
575
+ }
576
+ i.set(a, s);
577
+ }
578
+ return i;
579
+ }
580
+ buildProgram(e) {
581
+ let t = this.parseConfiguration(e.project), n = this.compilerHostService.createHost({
582
+ options: t.options,
583
+ workspaceRoot: e.workspaceRoot
584
+ }), r = o.createProgram({
585
+ host: n,
586
+ options: t.options,
587
+ rootNames: t.fileNames
588
+ });
589
+ return {
590
+ checker: r.getTypeChecker(),
591
+ ownedFilePaths: new Set(t.fileNames.map((e) => this.toRealPath(e))),
592
+ program: r,
593
+ project: e.project
594
+ };
595
+ }
596
+ parseConfiguration(t) {
597
+ let n = o.readJsonConfigFile(t.configurationPath, (e) => o.sys.readFile(e)), r = o.parseJsonSourceFileConfigFileContent(n, o.sys, e.dirname(t.configurationPath), void 0, t.configurationPath);
598
+ if (r.errors.length > 0) throw new g({
599
+ configurationPath: t.configurationPath,
600
+ messages: r.errors.map((e) => o.flattenDiagnosticMessageText(e.messageText, " "))
601
+ });
602
+ return r;
603
+ }
604
+ readPulledInPaths(e) {
605
+ let t = this.toRealPath(e.workspaceRoot), n = [];
606
+ for (let r of e.program.getSourceFiles()) {
607
+ let e = this.workspaceService.toWorkspaceRelative({
608
+ absolutePath: this.toRealPath(r.fileName),
609
+ workspaceRoot: t
610
+ }), i = e.split("/");
611
+ i[0] !== ".." && !i.includes("node_modules") && n.push(e);
612
+ }
613
+ return n;
614
+ }
615
+ buildPrograms(e) {
616
+ let t = [];
617
+ this.workspaceService.walkImportedProjectClosure({
618
+ resolveProjectFiles: (n) => {
619
+ this.logger.debug("🔭 Reading a project", void 0, { projectName: n.name });
620
+ let r = this.buildProgram({
621
+ project: n,
622
+ workspaceRoot: e.workspaceRoot
623
+ });
624
+ return t.push(r), this.readPulledInPaths({
625
+ program: r.program,
626
+ workspaceRoot: e.workspaceRoot
627
+ });
628
+ },
629
+ startingProjects: e.startingProjects,
630
+ workspaceProjects: e.workspaceProjects
631
+ }), this.logger.debug("🔭 Resolved a dependency closure", void 0, {
632
+ projectCount: t.length,
633
+ startingProjectCount: e.startingProjects.length
634
+ });
635
+ let n = t.toSorted((e, t) => e.project.name.localeCompare(t.project.name));
636
+ return {
637
+ ownerByFilePath: this.assignOwnership({
638
+ programs: n,
639
+ workspaceRoot: e.workspaceRoot
640
+ }),
641
+ programs: n
642
+ };
643
+ }
644
+ toRealPath(e) {
645
+ return o.sys.realpath === void 0 ? e : o.sys.realpath(e);
646
+ }
647
+ };
648
+ w = C = u([r(), l("design:paramtypes", [
649
+ S === void 0 ? Object : S,
650
+ m === void 0 ? Object : m,
651
+ v === void 0 ? Object : v
652
+ ])], w);
653
+ //#endregion
654
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/program/program.module.ts
655
+ var T = class {};
656
+ T = u([i({
657
+ controllers: [],
658
+ exports: [S, w],
659
+ imports: [h, x],
660
+ providers: [S, w]
661
+ })], T);
662
+ //#endregion
663
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/callables/callables.service.ts
664
+ var E = class {
665
+ callableIdentityService;
666
+ programService;
667
+ workspaceService;
668
+ constructor(e, t, n) {
669
+ this.callableIdentityService = e, this.programService = t, this.workspaceService = n;
670
+ }
671
+ collectFromFile(e) {
672
+ let t = [], n = (r) => {
673
+ this.isCallableDeclaration(r) && r.body !== void 0 && t.push(this.describe({
674
+ declaration: r,
675
+ projectProgram: e.projectProgram,
676
+ workspaceRelativePath: e.workspaceRelativePath
677
+ })), o.forEachChild(r, n);
678
+ };
679
+ return o.forEachChild(e.sourceFile, n), t;
680
+ }
681
+ collectFromProgram(e) {
682
+ let t = [], n = e.includeTestsByProject.get(e.projectProgram.project.name) ?? e.includeTests;
683
+ for (let r of e.projectProgram.program.getSourceFiles()) {
684
+ if (r.isDeclarationFile) continue;
685
+ let i = this.readOwnedPath({
686
+ ownerByFilePath: e.ownerByFilePath,
687
+ projectProgram: e.projectProgram,
688
+ sourceFile: r,
689
+ workspaceRoot: e.workspaceRoot
690
+ });
691
+ i === void 0 || e.fileFilter.isExcluded(i) || !n && this.workspaceService.isTestFile(i) || t.push({ callables: this.collectFromFile({
692
+ projectProgram: e.projectProgram,
693
+ sourceFile: r,
694
+ workspaceRelativePath: i
695
+ }) });
696
+ }
697
+ return t;
698
+ }
699
+ describe(e) {
700
+ let { declaration: t, projectProgram: n, workspaceRelativePath: r } = e;
701
+ return {
702
+ declaration: t,
703
+ node: {
704
+ displayName: this.callableIdentityService.readDisplayName(t),
705
+ enclosingTypeName: this.callableIdentityService.readEnclosingTypeName(t),
706
+ id: this.callableIdentityService.buildId({
707
+ declaration: t,
708
+ workspaceRelativePath: r
709
+ }),
710
+ isExported: this.callableIdentityService.isExported(t),
711
+ kind: this.callableIdentityService.readKind(t),
712
+ location: this.callableIdentityService.readLocation({
713
+ declaration: t,
714
+ workspaceRelativePath: r
715
+ }),
716
+ memberName: this.callableIdentityService.readMemberName(t),
717
+ projectName: n.project.name,
718
+ statementCount: this.callableIdentityService.countStatements(t)
719
+ },
720
+ projectProgram: n
721
+ };
722
+ }
723
+ isCallableDeclaration(e) {
724
+ return o.isArrowFunction(e) || o.isConstructorDeclaration(e) || o.isFunctionDeclaration(e) || o.isFunctionExpression(e) || o.isGetAccessorDeclaration(e) || o.isMethodDeclaration(e) || o.isSetAccessorDeclaration(e);
725
+ }
726
+ readOwnedPath(e) {
727
+ let t = this.programService.toRealPath(e.sourceFile.fileName);
728
+ if (e.ownerByFilePath.get(t) === e.projectProgram) return this.workspaceService.toWorkspaceRelative({
729
+ absolutePath: t,
730
+ workspaceRoot: e.workspaceRoot
731
+ });
732
+ }
733
+ collect(e) {
734
+ let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = 0;
735
+ for (let i of new Set(e.ownerByFilePath.values())) {
736
+ let { name: a } = i.project;
737
+ for (let o of this.collectFromProgram({
738
+ ...e,
739
+ projectProgram: i
740
+ })) {
741
+ for (let e of o.callables) t.set(e.node.id, e);
742
+ r += 1, n.set(a, (n.get(a) ?? 0) + 1);
743
+ }
744
+ }
745
+ return {
746
+ byId: t,
747
+ fileCount: r,
748
+ fileCountByProject: n
749
+ };
750
+ }
751
+ };
752
+ E = u([r(), l("design:paramtypes", [
753
+ f === void 0 ? Object : f,
754
+ w === void 0 ? Object : w,
755
+ v === void 0 ? Object : v
756
+ ])], E);
757
+ //#endregion
758
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/callables/callables.module.ts
759
+ var D = class {};
760
+ D = u([i({
761
+ controllers: [],
762
+ exports: [
763
+ d,
764
+ f,
765
+ E
766
+ ],
767
+ imports: [T, x],
768
+ providers: [
769
+ d,
770
+ f,
771
+ E
772
+ ]
773
+ })], D);
774
+ //#endregion
775
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/classes/classes.constants.ts
776
+ var ge = 8, O = class {
777
+ constructor() {}
778
+ ownedFilePaths = /* @__PURE__ */ new Set();
779
+ verdicts = /* @__PURE__ */ new WeakMap();
780
+ workspaceRoot = "";
781
+ computeVerdict(e) {
782
+ if (e.isDeclarationFile) return !0;
783
+ let { fileName: t } = e;
784
+ return t.split("/").includes("node_modules") ? !0 : !t.startsWith(this.workspaceRoot);
785
+ }
786
+ configure(e) {
787
+ this.ownedFilePaths = e.ownedFilePaths, this.workspaceRoot = e.workspaceRoot;
788
+ }
789
+ isExternal(e) {
790
+ let t = this.verdicts.get(e);
791
+ if (t !== void 0) return t;
792
+ let n = this.computeVerdict(e);
793
+ return this.verdicts.set(e, n), n;
794
+ }
795
+ isOwned(e) {
796
+ return this.ownedFilePaths.has(e);
797
+ }
798
+ };
799
+ O = u([r(), l("design:paramtypes", [])], O);
800
+ //#endregion
801
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/classes/classes.service.ts
802
+ var k = class {
803
+ externalService;
804
+ constructor(e) {
805
+ this.externalService = e;
806
+ }
807
+ checkerByClass = /* @__PURE__ */ new WeakMap();
808
+ classesByMemberName = /* @__PURE__ */ new Map();
809
+ derivedByBaseName = /* @__PURE__ */ new Map();
810
+ lookupCache = /* @__PURE__ */ new Map();
811
+ collectDerived(e) {
812
+ let t = [], n = [e], r = /* @__PURE__ */ new Set([e]);
813
+ for (; n.length > 0;) {
814
+ let e = n.pop();
815
+ for (let i of this.derivedByBaseName.get(e ?? "") ?? []) {
816
+ t.push(i);
817
+ let e = i.name?.text;
818
+ e !== void 0 && !r.has(e) && (r.add(e), n.push(e));
819
+ }
820
+ }
821
+ return t;
822
+ }
823
+ filterAssignable(e) {
824
+ let t = e.checker.getDeclaredTypeOfSymbol(e.ownerSymbol);
825
+ return e.candidates.filter((n) => {
826
+ let r = n.name ? e.checker.getSymbolAtLocation(n.name) : void 0;
827
+ return r !== void 0 && e.checker.isTypeAssignableTo(e.checker.getDeclaredTypeOfSymbol(r), t);
828
+ });
829
+ }
830
+ indexHeritage(e) {
831
+ for (let t of e.heritageClauses ?? []) for (let n of t.types) {
832
+ let { expression: t } = n;
833
+ if (!o.isIdentifier(t)) continue;
834
+ let r = this.derivedByBaseName.get(t.text);
835
+ r === void 0 ? this.derivedByBaseName.set(t.text, [e]) : r.push(e);
836
+ }
837
+ }
838
+ indexMembers(e) {
839
+ for (let t of e.members) {
840
+ if (t.name === void 0 || !o.isIdentifier(t.name)) continue;
841
+ let n = this.classesByMemberName.get(t.name.text);
842
+ n === void 0 ? this.classesByMemberName.set(t.name.text, [e]) : n.push(e);
843
+ }
844
+ }
845
+ readMemberDeclarations(e) {
846
+ return e.candidate.members.filter((t) => (o.isMethodDeclaration(t) || o.isPropertyDeclaration(t)) && o.isIdentifier(t.name) && t.name.text === e.memberName).filter((e) => (o.getCombinedModifierFlags(e) & o.ModifierFlags.Abstract) === 0);
847
+ }
848
+ build(e) {
849
+ for (let t of e.programs) this.indexProgram(t);
850
+ }
851
+ indexProgram(e) {
852
+ for (let t of e.program.getSourceFiles()) if (!this.externalService.isExternal(t)) for (let n of t.statements) o.isClassDeclaration(n) && (this.checkerByClass.set(n, e.checker), this.indexMembers(n), this.indexHeritage(n));
853
+ }
854
+ resolveImplementations(e) {
855
+ let t = `${e.ownerName}#${e.memberName}`, n = this.lookupCache.get(t);
856
+ if (n !== void 0) return n;
857
+ let r = this.collectDerived(e.ownerName), i = this.classesByMemberName.get(e.memberName) ?? [], a = r.length > 0 ? r.filter((e) => i.includes(e)) : this.filterAssignable({
858
+ candidates: i,
859
+ checker: e.checker,
860
+ ownerSymbol: e.ownerSymbol
861
+ }), o = a.length > 8 ? {
862
+ declarations: [],
863
+ exceededCandidateLimit: !0
864
+ } : {
865
+ declarations: a.flatMap((t) => this.readMemberDeclarations({
866
+ candidate: t,
867
+ checker: this.checkerByClass.get(t) ?? e.checker,
868
+ memberName: e.memberName
869
+ })),
870
+ exceededCandidateLimit: !1
871
+ };
872
+ return this.lookupCache.set(t, o), o;
873
+ }
874
+ };
875
+ k = u([r(), l("design:paramtypes", [O === void 0 ? Object : O])], k);
876
+ //#endregion
877
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/classes/classes.module.ts
878
+ var A = class {};
879
+ A = u([i({
880
+ controllers: [],
881
+ exports: [k, O],
882
+ imports: [],
883
+ providers: [k, O]
884
+ })], A);
885
+ //#endregion
886
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/documentation/documentation.constants.ts
887
+ var _e = "deprecated", j = class {
888
+ constructor() {}
889
+ readSummary(e) {
890
+ return o.displayPartsToString(e.symbol.getDocumentationComment(e.checker)).replaceAll(/\s+/g, " ").trim();
891
+ }
892
+ readSymbol(e) {
893
+ let { checker: t, declaration: n } = e;
894
+ if (n.name !== void 0) return t.getSymbolAtLocation(n.name);
895
+ let { parent: r } = n;
896
+ return o.isPropertyDeclaration(r) || o.isPropertyAssignment(r) || o.isVariableDeclaration(r) ? t.getSymbolAtLocation(r.name) : void 0;
897
+ }
898
+ read(e) {
899
+ let t = this.readSymbol(e);
900
+ if (t === void 0) return;
901
+ let n = this.readSummary({
902
+ checker: e.checker,
903
+ symbol: t
904
+ }), r = t.getJsDocTags(e.checker).map((e) => e.name).filter((e) => e.length > 0);
905
+ if (n.length !== 0 || r.length !== 0) return {
906
+ isDeprecated: r.includes(_e),
907
+ summary: n,
908
+ tags: [...new Set(r)]
909
+ };
910
+ }
911
+ };
912
+ j = u([r(), l("design:paramtypes", [])], j);
913
+ //#endregion
914
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/documentation/documentation.module.ts
915
+ var M = class {};
916
+ M = u([i({
917
+ controllers: [],
918
+ exports: [j],
919
+ imports: [],
920
+ providers: [j]
921
+ })], M);
922
+ //#endregion
923
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/edges/call-sites.service.ts
924
+ var N = class {
925
+ constructor() {}
926
+ isNestedBody(e) {
927
+ return o.isArrowFunction(e) || o.isFunctionDeclaration(e) || o.isFunctionExpression(e) || o.isMethodDeclaration(e) || o.isConstructorDeclaration(e) || o.isGetAccessorDeclaration(e) || o.isSetAccessorDeclaration(e) || o.isClassDeclaration(e);
928
+ }
929
+ readFunctionArguments(e) {
930
+ return [...e.arguments ?? []].filter((e) => o.isFunctionLike(e));
931
+ }
932
+ collect(e) {
933
+ let { body: t } = e, n = [];
934
+ if (t === void 0) return n;
935
+ let r = (e) => {
936
+ this.isNestedBody(e) || ((o.isCallExpression(e) || o.isNewExpression(e)) && n.push({
937
+ expression: e,
938
+ functionArguments: this.readFunctionArguments(e)
939
+ }), o.forEachChild(e, r));
940
+ };
941
+ return o.isBlock(t) ? o.forEachChild(t, r) : r(t), n;
942
+ }
943
+ };
944
+ N = u([r(), l("design:paramtypes", [])], N);
945
+ //#endregion
946
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/edges/edges.constants.ts
947
+ var P = {
948
+ declarations: [],
949
+ reason: void 0,
950
+ resolution: "direct"
951
+ }, F = {
952
+ declarations: [],
953
+ reason: "dynamic-value",
954
+ resolution: "direct"
955
+ }, ve = {
956
+ declarations: [],
957
+ reason: "computed-member",
958
+ resolution: "direct"
959
+ }, ye = {
960
+ declarations: [],
961
+ reason: "no-symbol",
962
+ resolution: "direct"
963
+ }, be = {
964
+ declarations: [],
965
+ reason: "no-implementation",
966
+ resolution: "direct"
967
+ }, xe = {
968
+ declarations: [],
969
+ reason: "too-many-implementations",
970
+ resolution: "implementation"
971
+ }, I = class {
972
+ classHierarchyService;
973
+ externalService;
974
+ constructor(e, t) {
975
+ this.classHierarchyService = e, this.externalService = t;
976
+ }
977
+ isAbstractMember(e) {
978
+ return o.isMethodSignature(e) || o.isPropertySignature(e) ? !0 : (o.isMethodDeclaration(e) || o.isPropertyDeclaration(e)) && (o.getCombinedModifierFlags(e) & o.ModifierFlags.Abstract) !== 0;
979
+ }
980
+ isBodyCarrying(e) {
981
+ return o.isArrowFunction(e) || o.isConstructorDeclaration(e) || o.isFunctionDeclaration(e) || o.isFunctionExpression(e) || o.isGetAccessorDeclaration(e) || o.isMethodDeclaration(e) || o.isSetAccessorDeclaration(e);
982
+ }
983
+ readBodied(e) {
984
+ return e.filter((e) => this.isBodyCarrying(e) ? e.body !== void 0 : o.isPropertyDeclaration(e) || o.isVariableDeclaration(e) ? e.initializer !== void 0 : !1);
985
+ }
986
+ readCalleeName(e) {
987
+ let t = e.expression;
988
+ return o.isPropertyAccessExpression(t) ? t.name : o.isElementAccessExpression(t) ? o.isStringLiteral(t.argumentExpression) ? t.argumentExpression : void 0 : o.isIdentifier(t) ? t : void 0;
989
+ }
990
+ readOwner(e) {
991
+ let { parent: t } = e;
992
+ if (o.isInterfaceDeclaration(t) || o.isClassDeclaration(t)) return t.name === void 0 ? void 0 : { name: t.name };
993
+ }
994
+ readResolution(e) {
995
+ return o.isPropertyAccessExpression(e.callee) && e.callee.expression.kind === o.SyntaxKind.SuperKeyword ? "super" : (e.symbol.flags & o.SymbolFlags.Alias) === 0 ? "direct" : "alias";
996
+ }
997
+ resolveSymbol(e) {
998
+ let t = this.unwrapAlias({
999
+ checker: e.checker,
1000
+ symbol: e.symbol
1001
+ }), n = t.getDeclarations() ?? [];
1002
+ if (n.length > 0 && n.every((e) => this.externalService.isExternal(e.getSourceFile()))) return P;
1003
+ let r = this.readBodied(n);
1004
+ if (r.length > 0) return {
1005
+ declarations: r,
1006
+ reason: void 0,
1007
+ resolution: this.readResolution({
1008
+ callee: e.callee,
1009
+ symbol: e.symbol
1010
+ })
1011
+ };
1012
+ let i = n.find((e) => this.isAbstractMember(e));
1013
+ return i === void 0 ? F : this.resolveThroughHierarchy({
1014
+ checker: e.checker,
1015
+ declaration: i,
1016
+ memberName: t.getName()
1017
+ });
1018
+ }
1019
+ resolveThroughHierarchy(e) {
1020
+ let t = this.readOwner(e.declaration), n = t === void 0 ? void 0 : e.checker.getSymbolAtLocation(t.name);
1021
+ if (t === void 0 || n === void 0) return be;
1022
+ let r = this.classHierarchyService.resolveImplementations({
1023
+ checker: e.checker,
1024
+ memberName: e.memberName,
1025
+ ownerName: t.name.text,
1026
+ ownerSymbol: n
1027
+ });
1028
+ return r.exceededCandidateLimit ? xe : {
1029
+ declarations: r.declarations,
1030
+ reason: r.declarations.length === 0 ? "no-implementation" : void 0,
1031
+ resolution: "implementation"
1032
+ };
1033
+ }
1034
+ unwrapAlias(e) {
1035
+ return (e.symbol.flags & o.SymbolFlags.Alias) === 0 ? e.symbol : e.checker.getAliasedSymbol(e.symbol);
1036
+ }
1037
+ resolve(e) {
1038
+ let t = e.expression.expression;
1039
+ if (o.isElementAccessExpression(t) && !o.isStringLiteral(t.argumentExpression)) return ve;
1040
+ let n = this.readCalleeName(e.expression);
1041
+ if (n === void 0) return F;
1042
+ let r = e.checker.getSymbolAtLocation(n);
1043
+ return r === void 0 ? ye : this.resolveSymbol({
1044
+ callee: t,
1045
+ checker: e.checker,
1046
+ symbol: r
1047
+ });
1048
+ }
1049
+ resolveConstructor(e) {
1050
+ let t = e.checker.getResolvedSignature(e.expression)?.declaration;
1051
+ return t === void 0 || !o.isConstructorDeclaration(t) || t.body === void 0 ? P : {
1052
+ declarations: [t],
1053
+ reason: void 0,
1054
+ resolution: "direct"
1055
+ };
1056
+ }
1057
+ };
1058
+ I = u([r(), l("design:paramtypes", [k === void 0 ? Object : k, O === void 0 ? Object : O])], I);
1059
+ //#endregion
1060
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/edges/edges.service.ts
1061
+ var L, R = L = class {
1062
+ callSitesService;
1063
+ externalService;
1064
+ programService;
1065
+ symbolResolutionService;
1066
+ workspaceService;
1067
+ logger;
1068
+ constructor(e, t, n, r, i, a) {
1069
+ this.callSitesService = e, this.externalService = t, this.programService = n, this.symbolResolutionService = r, this.workspaceService = i, this.logger = a, this.logger.setContext(L.name);
1070
+ }
1071
+ buildSiteEdges(e) {
1072
+ let t = this.collectCallbackEdges(e), n = [], r = this.resolveSite(e);
1073
+ if (r === void 0) return {
1074
+ edges: t,
1075
+ unresolved: n
1076
+ };
1077
+ let i = r.declarations.filter((e) => !this.externalService.isExternal(e.getSourceFile())).map((t) => this.resolveCallableId({
1078
+ callablesById: e.callablesById,
1079
+ declaration: t,
1080
+ workspaceRoot: e.workspaceRoot
1081
+ })).filter((e) => e !== void 0).filter((t) => !this.isExcludedCallee({
1082
+ callablesById: e.callablesById,
1083
+ calleeId: t,
1084
+ excludeCallees: e.excludeCallees
1085
+ })), a = this.readLocation({
1086
+ node: e.site.expression,
1087
+ workspaceRoot: e.workspaceRoot
1088
+ });
1089
+ for (let n of i) t.push({
1090
+ calleeId: n,
1091
+ callerId: e.caller.node.id,
1092
+ callSite: a,
1093
+ candidateCount: i.length,
1094
+ resolution: r.resolution
1095
+ });
1096
+ return r.reason !== void 0 && i.length === 0 && n.push({
1097
+ calleeText: e.site.expression.expression.getText().slice(0, 80),
1098
+ callerId: e.caller.node.id,
1099
+ callSite: a,
1100
+ reason: r.reason
1101
+ }), {
1102
+ edges: t,
1103
+ unresolved: n
1104
+ };
1105
+ }
1106
+ collectCallbackEdges(e) {
1107
+ return e.site.functionArguments.map((t) => this.resolveCallableId({
1108
+ callablesById: e.callablesById,
1109
+ declaration: t,
1110
+ workspaceRoot: e.workspaceRoot
1111
+ })).filter((e) => e !== void 0).map((t) => ({
1112
+ calleeId: t,
1113
+ callerId: e.caller.node.id,
1114
+ callSite: this.readLocation({
1115
+ node: e.site.expression,
1116
+ workspaceRoot: e.workspaceRoot
1117
+ }),
1118
+ candidateCount: 1,
1119
+ resolution: "callback"
1120
+ }));
1121
+ }
1122
+ isExcludedCallee(t) {
1123
+ let n = t.callablesById.get(t.calleeId)?.node.displayName;
1124
+ return n !== void 0 && t.excludeCallees.some((t) => e.matchesGlob(n, t));
1125
+ }
1126
+ readLocation(e) {
1127
+ let t = e.node.getSourceFile(), n = t.getLineAndCharacterOfPosition(e.node.getStart());
1128
+ return {
1129
+ column: n.character + 1,
1130
+ filePath: this.workspaceService.toWorkspaceRelative({
1131
+ absolutePath: this.programService.toRealPath(t.fileName),
1132
+ workspaceRoot: e.workspaceRoot
1133
+ }),
1134
+ line: n.line + 1
1135
+ };
1136
+ }
1137
+ resolveCallableId(e) {
1138
+ let t = (o.isPropertyDeclaration(e.declaration) || o.isVariableDeclaration(e.declaration)) && e.declaration.initializer !== void 0 ? e.declaration.initializer : e.declaration, n = `${this.workspaceService.toWorkspaceRelative({
1139
+ absolutePath: this.programService.toRealPath(t.getSourceFile().fileName),
1140
+ workspaceRoot: e.workspaceRoot
1141
+ })}#${String(t.getStart())}`;
1142
+ return e.callablesById.has(n) ? n : void 0;
1143
+ }
1144
+ resolveSite(e) {
1145
+ let { checker: t } = e.caller.projectProgram;
1146
+ return o.isNewExpression(e.site.expression) ? e.includeConstructorEdges ? this.symbolResolutionService.resolveConstructor({
1147
+ checker: t,
1148
+ expression: e.site.expression
1149
+ }) : void 0 : this.symbolResolutionService.resolve({
1150
+ checker: t,
1151
+ expression: e.site.expression
1152
+ });
1153
+ }
1154
+ build(e) {
1155
+ let t = [], n = [];
1156
+ for (let r of e.callablesById.values()) for (let i of this.callSitesService.collect(r.declaration)) {
1157
+ let a = this.buildSiteEdges({
1158
+ callablesById: e.callablesById,
1159
+ caller: r,
1160
+ excludeCallees: e.excludeCallees,
1161
+ includeConstructorEdges: e.includeConstructorEdges,
1162
+ site: i,
1163
+ workspaceRoot: e.workspaceRoot
1164
+ });
1165
+ t.push(...a.edges), n.push(...a.unresolved);
1166
+ }
1167
+ return this.logger.info("🔭 Built call graph edges", void 0, { edgeCount: t.length }), {
1168
+ edges: t,
1169
+ unresolvedCalls: n
1170
+ };
1171
+ }
1172
+ };
1173
+ R = L = u([r(), l("design:paramtypes", [
1174
+ N === void 0 ? Object : N,
1175
+ O === void 0 ? Object : O,
1176
+ w === void 0 ? Object : w,
1177
+ I === void 0 ? Object : I,
1178
+ v === void 0 ? Object : v,
1179
+ m === void 0 ? Object : m
1180
+ ])], R);
1181
+ //#endregion
1182
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/edges/edges.module.ts
1183
+ var z = class {};
1184
+ z = u([i({
1185
+ controllers: [],
1186
+ exports: [
1187
+ N,
1188
+ R,
1189
+ I
1190
+ ],
1191
+ imports: [
1192
+ D,
1193
+ A,
1194
+ h,
1195
+ T,
1196
+ x
1197
+ ],
1198
+ providers: [
1199
+ N,
1200
+ R,
1201
+ I
1202
+ ]
1203
+ })], z);
1204
+ //#endregion
1205
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/entries/entries.constants.ts
1206
+ var Se = /* @__PURE__ */ new Set([
1207
+ "beforeApplicationShutdown",
1208
+ "onApplicationBootstrap",
1209
+ "onApplicationShutdown",
1210
+ "onModuleDestroy",
1211
+ "onModuleInit"
1212
+ ]), Ce = "run", we = /* @__PURE__ */ new Set(["bootstrap", "main"]), Te = "/src/main.ts", Ee = "/src/index.ts", B, V = B = class {
1213
+ addressService;
1214
+ logger;
1215
+ constructor(e, t) {
1216
+ this.addressService = e, this.logger = t, this.logger.setContext(B.name);
1217
+ }
1218
+ classify(e) {
1219
+ let { declaration: t, node: n } = e.callable;
1220
+ return this.hasConfiguredDecorator({
1221
+ decorators: e.rules.decorators,
1222
+ node: t
1223
+ }) ? "decorated-method" : Se.has(n.memberName) ? "lifecycle" : this.isCommandRunnerMethod({
1224
+ ...e,
1225
+ declaration: t
1226
+ }) ? "decorated-method" : this.isBootstrapFunction(n.location.filePath, n.memberName) ? "module-bootstrap" : e.rules.includeExportedFunctions && n.isExported && n.location.filePath.endsWith("/src/index.ts") ? "exported-function" : void 0;
1227
+ }
1228
+ classifyEveryCallable(e) {
1229
+ for (let t of e.resolveArguments.callablesById.values()) {
1230
+ let n = this.classify({
1231
+ callable: t,
1232
+ rules: this.readRules(e, t)
1233
+ });
1234
+ n !== void 0 && (e.entryPoints.push({
1235
+ callableId: t.node.id,
1236
+ kind: n
1237
+ }), e.claimed.add(t.node.id));
1238
+ }
1239
+ }
1240
+ hasConfiguredDecorator(e) {
1241
+ return this.readDecoratorNames(e.node).some((t) => e.decorators.has(t));
1242
+ }
1243
+ isBootstrapFunction(e, t) {
1244
+ return e.endsWith("/src/main.ts") && we.has(t);
1245
+ }
1246
+ isCommandRunnerMethod(e) {
1247
+ if (e.callable.node.memberName !== "run") return !1;
1248
+ let t = o.findAncestor(e.declaration, o.isClassDeclaration);
1249
+ return t !== void 0 && this.hasConfiguredDecorator({
1250
+ decorators: e.rules.decorators,
1251
+ node: t
1252
+ });
1253
+ }
1254
+ listDeclaringConfigurations(e) {
1255
+ return [[void 0, e.entryPoints], ...e.entryPointsByProject];
1256
+ }
1257
+ promoteOrphans(e) {
1258
+ for (let t of e.resolveArguments.callablesById.values()) {
1259
+ let n = e.resolveArguments.graph.callerIdsByCallee.get(t.node.id) ?? [];
1260
+ !e.claimed.has(t.node.id) && n.length === 0 && this.readRules(e, t).includeOrphans && (e.entryPoints.push({
1261
+ callableId: t.node.id,
1262
+ kind: "orphan-root"
1263
+ }), e.claimed.add(t.node.id));
1264
+ }
1265
+ }
1266
+ readDecoratorNames(e) {
1267
+ return o.canHaveDecorators(e) ? (o.getDecorators(e) ?? []).map((e) => {
1268
+ let { expression: t } = e, n = o.isCallExpression(t) ? t.expression : t;
1269
+ return o.isIdentifier(n) ? n.text : "";
1270
+ }) : [];
1271
+ }
1272
+ readRules(e, t) {
1273
+ return e.rulesByProject.get(t.node.projectName) ?? e.defaultRules;
1274
+ }
1275
+ rootDeclaredAddress(e) {
1276
+ let t = this.addressService.resolve({
1277
+ address: e.address,
1278
+ callablesById: e.resolveArguments.callablesById,
1279
+ workspaceRoot: e.resolveArguments.workspaceRoot
1280
+ });
1281
+ if (t.kind !== "resolved") return {
1282
+ address: e.address,
1283
+ projectName: e.projectName,
1284
+ resolution: t
1285
+ };
1286
+ e.claimed.has(t.id) || (e.entryPoints.push({
1287
+ callableId: t.id,
1288
+ kind: "declared"
1289
+ }), e.claimed.add(t.id));
1290
+ }
1291
+ rootDeclaredAddresses(e) {
1292
+ let t = [];
1293
+ for (let [n, r] of this.listDeclaringConfigurations(e.resolveArguments)) for (let i of r.addresses) {
1294
+ let r = this.rootDeclaredAddress({
1295
+ address: i,
1296
+ projectName: n,
1297
+ ...e
1298
+ });
1299
+ r !== void 0 && t.push(r);
1300
+ }
1301
+ return t;
1302
+ }
1303
+ toRules(e) {
1304
+ return {
1305
+ decorators: new Set(e.decorators),
1306
+ includeExportedFunctions: e.includeExportedFunctions,
1307
+ includeOrphans: e.includeOrphans
1308
+ };
1309
+ }
1310
+ resolve(e) {
1311
+ let t = [], n = {
1312
+ claimed: /* @__PURE__ */ new Set(),
1313
+ entryPoints: t,
1314
+ resolveArguments: e
1315
+ }, r = {
1316
+ ...n,
1317
+ defaultRules: this.toRules(e.entryPoints),
1318
+ rulesByProject: new Map([...e.entryPointsByProject].map(([e, t]) => [e, this.toRules(t)]))
1319
+ };
1320
+ this.classifyEveryCallable(r);
1321
+ let i = this.rootDeclaredAddresses(n);
1322
+ return this.promoteOrphans(r), this.logger.info("🔭 Resolved entry points", void 0, { total: t.length }), {
1323
+ entryPoints: t,
1324
+ unresolvedAddresses: i
1325
+ };
1326
+ }
1327
+ };
1328
+ V = B = u([r(), l("design:paramtypes", [d === void 0 ? Object : d, m === void 0 ? Object : m])], V);
1329
+ //#endregion
1330
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/entries/entries.module.ts
1331
+ var H = class {};
1332
+ H = u([i({
1333
+ controllers: [],
1334
+ exports: [V],
1335
+ imports: [D, h],
1336
+ providers: [V]
1337
+ })], H);
1338
+ //#endregion
1339
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/graph/address-depth.constants.ts
1340
+ var De = 200, U = o.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope, W = class {
1341
+ constructor() {}
1342
+ readParameter(e) {
1343
+ let { valueDeclaration: t } = e.parameter, n = t !== void 0 && o.isParameter(t);
1344
+ return {
1345
+ isOptional: n && (t.questionToken !== void 0 || t.initializer !== void 0),
1346
+ isRest: n && t.dotDotDotToken !== void 0,
1347
+ name: e.parameter.getName(),
1348
+ type: e.checker.typeToString(e.checker.getTypeOfSymbolAtLocation(e.parameter, t ?? e.declaration), void 0, U)
1349
+ };
1350
+ }
1351
+ read(e) {
1352
+ let t = e.checker.getSignatureFromDeclaration(e.declaration);
1353
+ if (t !== void 0) return {
1354
+ parameters: t.getParameters().map((t) => this.readParameter({
1355
+ checker: e.checker,
1356
+ declaration: e.declaration,
1357
+ parameter: t
1358
+ })),
1359
+ returnType: e.checker.typeToString(t.getReturnType(), void 0, U),
1360
+ text: e.checker.signatureToString(t, e.declaration, U)
1361
+ };
1362
+ }
1363
+ };
1364
+ W = u([r(), l("design:paramtypes", [])], W);
1365
+ //#endregion
1366
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/graph/paths.service.ts
1367
+ var G = class {
1368
+ documentationService;
1369
+ signaturesService;
1370
+ constructor(e, t) {
1371
+ this.documentationService = e, this.signaturesService = t;
1372
+ }
1373
+ orderMembers(e) {
1374
+ if (e.enteredId === void 0 || e.memberIds.length <= 1) return e.memberIds;
1375
+ let t = e.memberIds.indexOf(e.enteredId);
1376
+ return t <= 0 ? e.memberIds : [...e.memberIds.slice(t), ...e.memberIds.slice(0, t)];
1377
+ }
1378
+ buildDeepestPath(e) {
1379
+ let t = [], n = /* @__PURE__ */ new Set(), r = e.condensed.componentIdByCallable.get(e.entryPointId), i = e.entryPointId;
1380
+ for (; r !== void 0 && !n.has(r);) {
1381
+ n.add(r);
1382
+ let a = e.condensed.memberIdsByComponent[r] ?? [], o = a.length > 1;
1383
+ for (let n of this.orderMembers({
1384
+ enteredId: i,
1385
+ memberIds: a
1386
+ })) {
1387
+ let r = e.callablesById.get(n);
1388
+ r !== void 0 && t.push(this.buildFrame({
1389
+ callable: r,
1390
+ isCycle: o
1391
+ }));
1392
+ }
1393
+ let s = e.measurement.byComponent[r]?.deepestSuccessor;
1394
+ i = void 0, r = s;
1395
+ }
1396
+ return t;
1397
+ }
1398
+ buildFrame(e) {
1399
+ let t = {
1400
+ checker: e.callable.projectProgram.checker,
1401
+ declaration: e.callable.declaration
1402
+ };
1403
+ return {
1404
+ displayName: e.callable.node.displayName,
1405
+ documentation: this.documentationService.read(t),
1406
+ id: e.callable.node.id,
1407
+ isCycle: e.isCycle,
1408
+ location: e.callable.node.location,
1409
+ signature: this.signaturesService.read(t)
1410
+ };
1411
+ }
1412
+ };
1413
+ G = u([r(), l("design:paramtypes", [j === void 0 ? Object : j, W === void 0 ? Object : W])], G);
1414
+ //#endregion
1415
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/graph/address-depth.service.ts
1416
+ var K = class {
1417
+ pathsService;
1418
+ constructor(e) {
1419
+ this.pathsService = e;
1420
+ }
1421
+ follow(e) {
1422
+ let { context: t, frame: n, neighborId: r, paths: i, pending: a } = e;
1423
+ if (n.path.includes(r)) {
1424
+ i.push([...n.path, r]);
1425
+ return;
1426
+ }
1427
+ if (!t.callablesById.has(r)) {
1428
+ i.push(n.path);
1429
+ return;
1430
+ }
1431
+ a.push({
1432
+ currentId: r,
1433
+ nextIndex: 0,
1434
+ path: [...n.path, r]
1435
+ });
1436
+ }
1437
+ isLowerBound(e) {
1438
+ return e.path.some((t) => e.unresolvedCallerIds.has(t));
1439
+ }
1440
+ step(e) {
1441
+ let { context: t, frame: n, paths: r, pending: i } = e, a = t.adjacency.get(n.currentId) ?? [], o = n.nextIndex === 0, s = a.at(n.nextIndex);
1442
+ if (n.nextIndex += 1, s === void 0) {
1443
+ o && r.push(n.path), i.pop();
1444
+ return;
1445
+ }
1446
+ this.follow({
1447
+ context: t,
1448
+ frame: n,
1449
+ neighborId: s,
1450
+ paths: r,
1451
+ pending: i
1452
+ });
1453
+ }
1454
+ toStack(e) {
1455
+ let t = e.reversed ? e.path.toReversed() : e.path, n = /* @__PURE__ */ new Set(), r = [];
1456
+ for (let i of t) {
1457
+ let t = n.has(i);
1458
+ n.add(i);
1459
+ let a = e.callablesById.get(i);
1460
+ a !== void 0 && r.push(this.pathsService.buildFrame({
1461
+ callable: a,
1462
+ isCycle: t
1463
+ }));
1464
+ }
1465
+ return {
1466
+ frames: r,
1467
+ isLowerBound: this.isLowerBound({
1468
+ path: e.path,
1469
+ unresolvedCallerIds: e.unresolvedCallerIds
1470
+ })
1471
+ };
1472
+ }
1473
+ traverse(e) {
1474
+ let t = [], n = [{
1475
+ currentId: e.startId,
1476
+ nextIndex: 0,
1477
+ path: [e.startId]
1478
+ }];
1479
+ for (let r = n.at(-1); r !== void 0; r = n.at(-1)) {
1480
+ if (t.length >= 200) return {
1481
+ paths: t,
1482
+ truncated: !0
1483
+ };
1484
+ this.step({
1485
+ context: e,
1486
+ frame: r,
1487
+ paths: t,
1488
+ pending: n
1489
+ });
1490
+ }
1491
+ return {
1492
+ paths: t,
1493
+ truncated: !1
1494
+ };
1495
+ }
1496
+ buildDownwardStacks(e) {
1497
+ let t = this.traverse({
1498
+ adjacency: e.graph.calleeIdsByCaller,
1499
+ callablesById: e.callablesById,
1500
+ startId: e.startId
1501
+ });
1502
+ return {
1503
+ stacks: t.paths.map((t) => this.toStack({
1504
+ callablesById: e.callablesById,
1505
+ path: t,
1506
+ reversed: !1,
1507
+ unresolvedCallerIds: e.graph.unresolvedCallerIds
1508
+ })),
1509
+ truncated: t.truncated
1510
+ };
1511
+ }
1512
+ buildUpwardStacks(e) {
1513
+ let t = this.traverse({
1514
+ adjacency: e.graph.callerIdsByCallee,
1515
+ callablesById: e.callablesById,
1516
+ startId: e.startId
1517
+ });
1518
+ return {
1519
+ stacks: t.paths.map((t) => this.toStack({
1520
+ callablesById: e.callablesById,
1521
+ path: t,
1522
+ reversed: !0,
1523
+ unresolvedCallerIds: e.graph.unresolvedCallerIds
1524
+ })),
1525
+ truncated: t.truncated
1526
+ };
1527
+ }
1528
+ };
1529
+ K = u([r(), l("design:paramtypes", [G === void 0 ? Object : G])], K);
1530
+ //#endregion
1531
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/graph/breadth.service.ts
1532
+ var q = class {
1533
+ constructor() {}
1534
+ toReferences(e) {
1535
+ let t = [];
1536
+ for (let n of e.ids) {
1537
+ let r = e.callablesById.get(n);
1538
+ r !== void 0 && t.push({
1539
+ displayName: r.node.displayName,
1540
+ id: n,
1541
+ location: r.node.location
1542
+ });
1543
+ }
1544
+ return t;
1545
+ }
1546
+ describeDirectCalls(e) {
1547
+ return {
1548
+ callees: this.toReferences({
1549
+ callablesById: e.callablesById,
1550
+ ids: e.graph.calleeIdsByCaller.get(e.id) ?? []
1551
+ }),
1552
+ callers: this.toReferences({
1553
+ callablesById: e.callablesById,
1554
+ ids: e.graph.callerIdsByCallee.get(e.id) ?? []
1555
+ })
1556
+ };
1557
+ }
1558
+ measure(e) {
1559
+ let t = /* @__PURE__ */ new Map();
1560
+ for (let n of e.callableIds) {
1561
+ let r = e.graph.calleeIdsByCaller.get(n) ?? [];
1562
+ t.set(n, {
1563
+ breadth: r.length,
1564
+ calleeIds: r
1565
+ });
1566
+ }
1567
+ return { byCallable: t };
1568
+ }
1569
+ };
1570
+ q = u([r(), l("design:paramtypes", [])], q);
1571
+ //#endregion
1572
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/graph/components.constants.ts
1573
+ var Oe = 0, J = class {
1574
+ constructor() {}
1575
+ closeNode(e) {
1576
+ let { callableId: t, state: n } = e;
1577
+ if (n.lowLink.get(t) !== n.order.get(t)) return;
1578
+ let r = n.pending.splice(n.pending.indexOf(t));
1579
+ for (let e of r) n.onStack.delete(e), n.componentIdByCallable.set(e, n.memberIdsByComponent.length);
1580
+ n.memberIdsByComponent.push(r);
1581
+ }
1582
+ finishFrame(e) {
1583
+ let { callableId: t, state: n } = e;
1584
+ n.frames.pop(), this.closeNode({
1585
+ callableId: t,
1586
+ state: n
1587
+ });
1588
+ let r = n.frames.at(-1);
1589
+ r !== void 0 && this.liftLowLink({
1590
+ child: t,
1591
+ parent: r.callableId,
1592
+ state: n
1593
+ });
1594
+ }
1595
+ liftLowLink(e) {
1596
+ let t = e.state.lowLink.get(e.parent) ?? 0, n = e.state.lowLink.get(e.child) ?? 0;
1597
+ e.state.lowLink.set(e.parent, Math.min(t, n));
1598
+ }
1599
+ openNode(e) {
1600
+ let { callableId: t, state: n } = e;
1601
+ n.order.set(t, n.sequence), n.lowLink.set(t, n.sequence), n.sequence += 1, n.pending.push(t), n.onStack.add(t), n.frames.push({
1602
+ callableId: t,
1603
+ successorIndex: 0
1604
+ });
1605
+ }
1606
+ step(e) {
1607
+ let { frame: t, graph: n, state: r } = e, i = n.calleeIdsByCaller.get(t.callableId) ?? [];
1608
+ if (t.successorIndex >= i.length) {
1609
+ this.finishFrame({
1610
+ callableId: t.callableId,
1611
+ state: r
1612
+ });
1613
+ return;
1614
+ }
1615
+ let a = i[t.successorIndex];
1616
+ t.successorIndex += 1, a !== void 0 && this.visitSuccessor({
1617
+ parentId: t.callableId,
1618
+ state: r,
1619
+ successor: a
1620
+ });
1621
+ }
1622
+ visitSuccessor(e) {
1623
+ let { parentId: t, state: n, successor: r } = e;
1624
+ if (!n.order.has(r)) {
1625
+ this.openNode({
1626
+ callableId: r,
1627
+ state: n
1628
+ });
1629
+ return;
1630
+ }
1631
+ n.onStack.has(r) && this.liftLowLink({
1632
+ child: r,
1633
+ parent: t,
1634
+ state: n
1635
+ });
1636
+ }
1637
+ buildSuccessors(e) {
1638
+ return e.memberIdsByComponent.map((t, n) => {
1639
+ let r = /* @__PURE__ */ new Set();
1640
+ for (let i of t) for (let t of e.graph.calleeIdsByCaller.get(i) ?? []) {
1641
+ let i = e.componentIdByCallable.get(t);
1642
+ i !== void 0 && i !== n && r.add(i);
1643
+ }
1644
+ return r;
1645
+ });
1646
+ }
1647
+ condense(e) {
1648
+ let t = {
1649
+ componentIdByCallable: /* @__PURE__ */ new Map(),
1650
+ frames: [],
1651
+ lowLink: /* @__PURE__ */ new Map(),
1652
+ memberIdsByComponent: [],
1653
+ onStack: /* @__PURE__ */ new Set(),
1654
+ order: /* @__PURE__ */ new Map(),
1655
+ pending: [],
1656
+ sequence: 0
1657
+ };
1658
+ for (let n of e.callableIds) if (!t.order.has(n)) {
1659
+ this.openNode({
1660
+ callableId: n,
1661
+ state: t
1662
+ });
1663
+ for (let n = t.frames.at(-1); n !== void 0; n = t.frames.at(-1)) this.step({
1664
+ frame: n,
1665
+ graph: e.graph,
1666
+ state: t
1667
+ });
1668
+ }
1669
+ return {
1670
+ componentIdByCallable: t.componentIdByCallable,
1671
+ memberIdsByComponent: t.memberIdsByComponent,
1672
+ successorsByComponent: this.buildSuccessors({
1673
+ componentIdByCallable: t.componentIdByCallable,
1674
+ graph: e.graph,
1675
+ memberIdsByComponent: t.memberIdsByComponent
1676
+ })
1677
+ };
1678
+ }
1679
+ };
1680
+ J = u([r(), l("design:paramtypes", [])], J);
1681
+ //#endregion
1682
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/graph/graph-depth.service.ts
1683
+ var Y = class {
1684
+ constructor() {}
1685
+ combine(e) {
1686
+ let t = this.foldSuccessors({
1687
+ memo: e.memo,
1688
+ successors: e.successors
1689
+ });
1690
+ return {
1691
+ deepestSuccessor: t.successor,
1692
+ depth: e.memberIds.length + t.depth,
1693
+ reachesUnresolved: e.reachesUnresolved || t.reachesUnresolved
1694
+ };
1695
+ }
1696
+ foldSuccessors(e) {
1697
+ let t = 0, n = !1, r;
1698
+ for (let i of e.successors) {
1699
+ let a = e.memo.at(i);
1700
+ a !== void 0 && (n ||= a.reachesUnresolved, a.depth > t && (t = a.depth, r = i));
1701
+ }
1702
+ return {
1703
+ depth: t,
1704
+ reachesUnresolved: n,
1705
+ successor: r
1706
+ };
1707
+ }
1708
+ hasUnresolved(e) {
1709
+ return e.memberIds.some((t) => e.unresolvedCallerIds.has(t));
1710
+ }
1711
+ measure(e) {
1712
+ let { condensed: t } = e, n = [];
1713
+ for (let r of t.memberIdsByComponent) n.push(this.combine({
1714
+ memberIds: r,
1715
+ memo: n,
1716
+ reachesUnresolved: this.hasUnresolved({
1717
+ memberIds: r,
1718
+ unresolvedCallerIds: e.graph.unresolvedCallerIds
1719
+ }),
1720
+ successors: t.successorsByComponent.at(n.length) ?? /* @__PURE__ */ new Set()
1721
+ }));
1722
+ return { byComponent: n };
1723
+ }
1724
+ };
1725
+ Y = u([r(), l("design:paramtypes", [])], Y);
1726
+ //#endregion
1727
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/graph/graph.service.ts
1728
+ var X = class {
1729
+ constructor() {}
1730
+ append(e) {
1731
+ let t = e.index.get(e.key);
1732
+ t === void 0 ? e.index.set(e.key, [e.value]) : t.includes(e.value) || t.push(e.value);
1733
+ }
1734
+ assemble(e) {
1735
+ let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
1736
+ for (let r of e.edges) r.callerId !== r.calleeId && (this.append({
1737
+ index: t,
1738
+ key: r.callerId,
1739
+ value: r.calleeId
1740
+ }), this.append({
1741
+ index: n,
1742
+ key: r.calleeId,
1743
+ value: r.callerId
1744
+ }));
1745
+ return {
1746
+ calleeIdsByCaller: t,
1747
+ callerIdsByCallee: n,
1748
+ edges: e.edges,
1749
+ unresolvedCallerIds: new Set(e.unresolvedCalls.map((e) => e.callerId)),
1750
+ unresolvedCalls: e.unresolvedCalls
1751
+ };
1752
+ }
1753
+ };
1754
+ X = u([r(), l("design:paramtypes", [])], X);
1755
+ //#endregion
1756
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/graph/graph-assembly.service.ts
1757
+ var Z = class {
1758
+ breadthService;
1759
+ componentsService;
1760
+ depthService;
1761
+ edgesService;
1762
+ graphService;
1763
+ constructor(e, t, n, r, i) {
1764
+ this.breadthService = e, this.componentsService = t, this.depthService = n, this.edgesService = r, this.graphService = i;
1765
+ }
1766
+ assemble(e) {
1767
+ let t = this.graphService.assemble(this.edgesService.build({
1768
+ callablesById: e.callablesById,
1769
+ excludeCallees: e.excludeCallees,
1770
+ includeConstructorEdges: e.includeConstructorEdges,
1771
+ workspaceRoot: e.workspaceRoot
1772
+ })), n = this.componentsService.condense({
1773
+ callableIds: e.callablesById.keys(),
1774
+ graph: t
1775
+ });
1776
+ return {
1777
+ breadthMeasurement: this.breadthService.measure({
1778
+ callableIds: [...e.callablesById.keys()],
1779
+ graph: t
1780
+ }),
1781
+ condensed: n,
1782
+ graph: t,
1783
+ measurement: this.depthService.measure({
1784
+ condensed: n,
1785
+ graph: t
1786
+ })
1787
+ };
1788
+ }
1789
+ };
1790
+ Z = u([r(), l("design:paramtypes", [
1791
+ q === void 0 ? Object : q,
1792
+ J === void 0 ? Object : J,
1793
+ Y === void 0 ? Object : Y,
1794
+ R === void 0 ? Object : R,
1795
+ X === void 0 ? Object : X
1796
+ ])], Z);
1797
+ //#endregion
1798
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/signatures/signatures.module.ts
1799
+ var Q = class {};
1800
+ Q = u([i({
1801
+ controllers: [],
1802
+ exports: [W],
1803
+ imports: [],
1804
+ providers: [W]
1805
+ })], Q);
1806
+ //#endregion
1807
+ //#region packages/ic-suite/callidescope/callidescope-graph/src/modules/graph/graph.module.ts
1808
+ var $ = class {};
1809
+ $ = u([i({
1810
+ controllers: [],
1811
+ exports: [
1812
+ q,
1813
+ K,
1814
+ J,
1815
+ Y,
1816
+ Z,
1817
+ X,
1818
+ G
1819
+ ],
1820
+ imports: [
1821
+ M,
1822
+ z,
1823
+ Q
1824
+ ],
1825
+ providers: [
1826
+ q,
1827
+ K,
1828
+ J,
1829
+ Y,
1830
+ Z,
1831
+ X,
1832
+ G
1833
+ ]
1834
+ })], $);
1835
+ //#endregion
1836
+ export { ae as ANONYMOUS_MEMBER_NAME, K as AddressDepthService, d as AddressService, Ee as BARREL_FILE_SUFFIX, Te as BOOTSTRAP_FILE_SUFFIX, we as BOOTSTRAP_FUNCTION_NAMES, q as BreadthService, Ce as COMMAND_RUNNER_METHOD_NAME, ve as COMPUTED_MEMBER_CALL, N as CallSitesService, f as CallableIdentityService, D as CallablesModule, E as CallablesService, A as ClassesModule, k as ClassesService, S as CompilerHostService, J as ComponentsService, _e as DEPRECATED_TAG, F as DYNAMIC_CALL, M as DocumentationModule, j as DocumentationService, de as EXCLUDED_SCAN_DIRECTORY_NAMES, P as EXTERNAL_CALL, z as EdgesModule, R as EdgesService, H as EntriesModule, V as EntriesService, O as ExternalService, b as FileFilterService, Z as GraphAssemblyService, Y as GraphDepthService, $ as GraphModule, X as GraphService, Oe as INITIAL_LOW_LINK, Se as LIFECYCLE_METHOD_NAMES, De as MAXIMUM_CALL_ADDRESS_STACKS, ge as MAXIMUM_IMPLEMENTATION_CANDIDATES, be as NO_IMPLEMENTATION_CALL, ye as NO_SYMBOL_CALL, pe as PROJECT_CONFIGURATION_NAME, G as PathsService, g as ProgramConfigurationError, T as ProgramModule, w as ProgramService, U as SIGNATURE_FORMAT_FLAGS, Q as SignaturesModule, W as SignaturesService, I as SymbolResolutionService, me as TEST_DIRECTORY_SEGMENT, he as TEST_FILE_PATTERN, xe as TOO_MANY_IMPLEMENTATIONS_CALL, x as WorkspaceModule, v as WorkspaceService };