@callidescope/cli 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.
- package/LICENSE +21 -0
- package/README.md +1763 -0
- package/dist/main.module-tKMvFmcY.js +1476 -0
- package/dist/src/index.d.ts +649 -0
- package/dist/src/index.js +2 -0
- package/dist/src/main.d.ts +1 -0
- package/dist/src/main.js +17 -0
- package/package.json +80 -0
|
@@ -0,0 +1,1476 @@
|
|
|
1
|
+
import { CHECK_NAMES as e, ConfigurationModule as t, ConfigurationService as n, DEFAULT_JSON_INDENTATION as r, DEFAULT_PREVIEW_COUNT as i, DEFAULT_RUN_HEADING as a, InputError as o, ProjectConfigurationError as s, ProjectConfigurationFieldNotPermittedError as c } from "@callidescope/configuration";
|
|
2
|
+
import { ConsoleLogger as l, Global as u, Injectable as d, Module as f, Scope as ee } from "@nestjs/common";
|
|
3
|
+
import { ConfigModule as te } from "@nestjs/config";
|
|
4
|
+
import { DiscoveryModule as ne } from "@nestjs/core";
|
|
5
|
+
import { existsSync as re, mkdirSync as ie } from "node:fs";
|
|
6
|
+
import p from "node:path";
|
|
7
|
+
import m from "pino";
|
|
8
|
+
import { z as ae } from "zod";
|
|
9
|
+
import { AddressDepthService as oe, AddressService as h, BreadthService as se, CallablesModule as g, CallablesService as ce, ClassesModule as le, ClassesService as ue, EdgesModule as de, EntriesModule as fe, EntriesService as pe, ExternalService as me, FileFilterService as _, GraphAssemblyService as he, GraphModule as v, ProgramConfigurationError as ge, ProgramModule as _e, ProgramService as y, WorkspaceModule as b, WorkspaceService as x } from "@callidescope/graph";
|
|
10
|
+
import { AddressReportModule as ve, AddressReportService as S, MarkdownReportService as ye, OutputJsonModule as be, OutputJsonService as xe, OutputMarkdownModule as Se, ProjectReportsModule as Ce, ProjectReportsService as we, ReportFindingsModule as Te, ReportFindingsService as Ee, ReportModule as De, WriteDestinationsModule as Oe, WriteDestinationsService as ke } from "@callidescope/output";
|
|
11
|
+
import { Command as C, CommandRunner as w, Option as T } from "nest-commander";
|
|
12
|
+
//#region packages/logger/src/modules/logger/logger.constants.ts
|
|
13
|
+
var Ae = /^(\p{Extended_Pictographic}️?(?:\p{Extended_Pictographic}️?)*)\s+/u, je = /^([A-Za-z]+)/, Me = /* @__PURE__ */ new Set([
|
|
14
|
+
"built",
|
|
15
|
+
"cut",
|
|
16
|
+
"found",
|
|
17
|
+
"got",
|
|
18
|
+
"kept",
|
|
19
|
+
"left",
|
|
20
|
+
"lost",
|
|
21
|
+
"made",
|
|
22
|
+
"put",
|
|
23
|
+
"ran",
|
|
24
|
+
"read",
|
|
25
|
+
"rebuilt",
|
|
26
|
+
"sent",
|
|
27
|
+
"set",
|
|
28
|
+
"split",
|
|
29
|
+
"took",
|
|
30
|
+
"wrote"
|
|
31
|
+
]), Ne = /* @__PURE__ */ new Set([
|
|
32
|
+
"CommandFactory",
|
|
33
|
+
"ExceptionHandler",
|
|
34
|
+
"GraphQLModule",
|
|
35
|
+
"InstanceLoader",
|
|
36
|
+
"NestApplication",
|
|
37
|
+
"NestFactory",
|
|
38
|
+
"RouterExplorer",
|
|
39
|
+
"RoutesResolver",
|
|
40
|
+
"TypeOrmModule"
|
|
41
|
+
]);
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/decorateMetadata.js
|
|
44
|
+
function E(e, t) {
|
|
45
|
+
if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(e, t);
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/decorate.js
|
|
49
|
+
function D(e, t, n, r) {
|
|
50
|
+
var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
|
|
51
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
|
|
52
|
+
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);
|
|
53
|
+
return i > 3 && a && Object.defineProperty(t, n, a), a;
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region packages/logger/src/modules/logger/logger.service.ts
|
|
57
|
+
var O, k = class extends l {
|
|
58
|
+
static {
|
|
59
|
+
O = this;
|
|
60
|
+
}
|
|
61
|
+
constructor() {
|
|
62
|
+
super();
|
|
63
|
+
}
|
|
64
|
+
static isProduction = process.env.NODE_ENV === "production";
|
|
65
|
+
static rootLogger;
|
|
66
|
+
static writesToStandardError = !1;
|
|
67
|
+
child = O.root;
|
|
68
|
+
static createRootLogger() {
|
|
69
|
+
let e = process.env.LOG_LEVEL ?? "info";
|
|
70
|
+
return O.isProduction ? O.writesToStandardError ? m({ level: e }, m.destination(2)) : m({ level: e }) : m({
|
|
71
|
+
level: e,
|
|
72
|
+
transport: {
|
|
73
|
+
options: {
|
|
74
|
+
colorize: !0,
|
|
75
|
+
destination: O.writesToStandardError ? 2 : 1,
|
|
76
|
+
ignore: "pid,hostname,emoji",
|
|
77
|
+
messageFormat: "{emoji} {msg}",
|
|
78
|
+
singleLine: !0
|
|
79
|
+
},
|
|
80
|
+
target: "pino-pretty"
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
static logToStandardError() {
|
|
85
|
+
if (O.rootLogger !== void 0) {
|
|
86
|
+
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.");
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
O.writesToStandardError = !0;
|
|
90
|
+
}
|
|
91
|
+
assertConventionalMessage(e) {
|
|
92
|
+
if (O.isProduction || this.shouldSkipConventionalMessageValidation(e.context)) return;
|
|
93
|
+
let t = this.getConventionalMessageViolation(e.parsed);
|
|
94
|
+
if (t !== void 0) throw Error(t);
|
|
95
|
+
}
|
|
96
|
+
buildBindings(e) {
|
|
97
|
+
return this.assertConventionalMessage({
|
|
98
|
+
context: e.context,
|
|
99
|
+
parsed: e.parsed
|
|
100
|
+
}), {
|
|
101
|
+
...e.data,
|
|
102
|
+
context: e.context,
|
|
103
|
+
...O.isProduction ? {} : { emoji: e.parsed.emoji }
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
getConventionalMessageViolation(e) {
|
|
107
|
+
let t = e.emoji, n = e.text;
|
|
108
|
+
if (t === void 0) return `Log message must start with an emoji naming its subject, then a verb: "${n}"`;
|
|
109
|
+
let r = je.exec(n)?.[1];
|
|
110
|
+
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}"`;
|
|
111
|
+
}
|
|
112
|
+
isConventionalVerb(e) {
|
|
113
|
+
let t = e.toLowerCase();
|
|
114
|
+
return t.endsWith("ing") || t.endsWith("ed") || Me.has(t);
|
|
115
|
+
}
|
|
116
|
+
parseMessage(e) {
|
|
117
|
+
let t = String(e), n = Ae.exec(t), r = n?.[1];
|
|
118
|
+
return r === void 0 ? {
|
|
119
|
+
emoji: void 0,
|
|
120
|
+
text: t
|
|
121
|
+
} : {
|
|
122
|
+
emoji: r,
|
|
123
|
+
text: t.slice(n?.[0].length)
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
shouldSkipConventionalMessageValidation(e) {
|
|
127
|
+
return e !== void 0 && Ne.has(e);
|
|
128
|
+
}
|
|
129
|
+
static get root() {
|
|
130
|
+
return O.rootLogger ??= O.createRootLogger(), O.rootLogger;
|
|
131
|
+
}
|
|
132
|
+
buildErrorLogEntry(e, t) {
|
|
133
|
+
let n = t instanceof Error ? t.stack || t.message : String(t);
|
|
134
|
+
return {
|
|
135
|
+
errorMessage: n,
|
|
136
|
+
logLine: `[${(/* @__PURE__ */ new Date()).toISOString()}] ${e}: ${n}\n`
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
createTimestampedOutputLogFilePath(e) {
|
|
140
|
+
let t = p.join(process.cwd(), "output");
|
|
141
|
+
return re(t) || ie(t, { recursive: !0 }), p.join(t, `${e}-${(/* @__PURE__ */ new Date()).toISOString().replaceAll(/[:.]/g, "-")}.log`);
|
|
142
|
+
}
|
|
143
|
+
debug(e, t, n) {
|
|
144
|
+
let r = this.parseMessage(e);
|
|
145
|
+
this.child.debug(this.buildBindings({
|
|
146
|
+
context: t ?? this.context,
|
|
147
|
+
data: n,
|
|
148
|
+
parsed: r
|
|
149
|
+
}), r.text);
|
|
150
|
+
}
|
|
151
|
+
error(e, t, n) {
|
|
152
|
+
let r = this.parseMessage(e), i = typeof n == "object" ? n : void 0, a = typeof n == "string" ? n : this.context;
|
|
153
|
+
this.child.error({
|
|
154
|
+
...this.buildBindings({
|
|
155
|
+
context: a,
|
|
156
|
+
data: i,
|
|
157
|
+
parsed: r
|
|
158
|
+
}),
|
|
159
|
+
stack: t
|
|
160
|
+
}, r.text);
|
|
161
|
+
}
|
|
162
|
+
info(e, t, n) {
|
|
163
|
+
let r = this.parseMessage(e);
|
|
164
|
+
this.child.info(this.buildBindings({
|
|
165
|
+
context: t ?? this.context,
|
|
166
|
+
data: n,
|
|
167
|
+
parsed: r
|
|
168
|
+
}), r.text);
|
|
169
|
+
}
|
|
170
|
+
log(e, t, n) {
|
|
171
|
+
this.info(e, t, n);
|
|
172
|
+
}
|
|
173
|
+
setContext(e) {
|
|
174
|
+
super.setContext(e), this.child = O.root.child({ context: e });
|
|
175
|
+
}
|
|
176
|
+
verbose(e, t, n) {
|
|
177
|
+
let r = this.parseMessage(e);
|
|
178
|
+
this.child.trace(this.buildBindings({
|
|
179
|
+
context: t ?? this.context,
|
|
180
|
+
data: n,
|
|
181
|
+
parsed: r
|
|
182
|
+
}), r.text);
|
|
183
|
+
}
|
|
184
|
+
warn(e, t, n) {
|
|
185
|
+
let r = this.parseMessage(e);
|
|
186
|
+
this.child.warn(this.buildBindings({
|
|
187
|
+
context: t ?? this.context,
|
|
188
|
+
data: n,
|
|
189
|
+
parsed: r
|
|
190
|
+
}), r.text);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
k = O = D([d({ scope: ee.TRANSIENT }), E("design:paramtypes", [])], k);
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region packages/logger/src/modules/logger/logger.module.ts
|
|
196
|
+
var A = class {};
|
|
197
|
+
A = D([u(), f({
|
|
198
|
+
controllers: [],
|
|
199
|
+
exports: [k],
|
|
200
|
+
imports: [],
|
|
201
|
+
providers: [k]
|
|
202
|
+
})], A);
|
|
203
|
+
//#endregion
|
|
204
|
+
//#region packages/ic-suite/callidescope/callidescope-cli/src/constants.ts
|
|
205
|
+
var Pe = ae.object({}), Fe = "Check the file path and the qualified name callidescope prints for it in a stack.", Ie = "🔭 Rejected a callable address", Le = (e) => e instanceof s || e instanceof c, j = "🔭 Rejected the command line", Re = "🔭 Rejected a project it could not read", ze = "🔭 Rejected a project configuration", Be = (e) => `${e} is not a callidescope command, and the trace takes no positional arguments. Run one of depth, breadth, or limits, or drop the argument to trace the workspace.`, M = (e) => e instanceof ge ? Re : Le(e) || e instanceof N ? ze : e instanceof o ? j : void 0, N = class e extends Error {
|
|
206
|
+
constructor(t) {
|
|
207
|
+
super(e.joinDescriptions(t)), this.name = "UnresolvedEntryPointAddressError";
|
|
208
|
+
}
|
|
209
|
+
static joinDescriptions(e) {
|
|
210
|
+
let [t] = e;
|
|
211
|
+
if (t !== void 0 && e.length === 1) return t;
|
|
212
|
+
let n = e.map((e, t) => `(${String(t + 1)}) ${e}`).join(" ");
|
|
213
|
+
return `${String(e.length)} declared entry points did not resolve. ${n}`;
|
|
214
|
+
}
|
|
215
|
+
}, P, F = P = class {
|
|
216
|
+
callablesService;
|
|
217
|
+
classHierarchyService;
|
|
218
|
+
entryPointsService;
|
|
219
|
+
externalService;
|
|
220
|
+
fileFilterService;
|
|
221
|
+
graphAssemblyService;
|
|
222
|
+
programService;
|
|
223
|
+
configurationService;
|
|
224
|
+
projectReportsService;
|
|
225
|
+
workspaceService;
|
|
226
|
+
logger;
|
|
227
|
+
constructor(e, t, n, r, i, a, o, s, c, l, u) {
|
|
228
|
+
this.callablesService = e, this.classHierarchyService = t, this.entryPointsService = n, this.externalService = r, this.fileFilterService = i, this.graphAssemblyService = a, this.programService = o, this.configurationService = s, this.projectReportsService = c, this.workspaceService = l, this.logger = u, this.logger.setContext(P.name);
|
|
229
|
+
}
|
|
230
|
+
async discoverCallables(e) {
|
|
231
|
+
let { fileFilter: t, programSet: n, projects: r, startingProjects: i } = this.discoverPrograms(e), a = r.map((e) => e.name), o = await this.loadProjectDeclarations({
|
|
232
|
+
authoredLimits: e.authoredLimits,
|
|
233
|
+
configuration: e.configuration,
|
|
234
|
+
configurationPath: e.configurationPath,
|
|
235
|
+
limitOverrides: e.limitOverrides,
|
|
236
|
+
projectNames: a,
|
|
237
|
+
workspaceRoot: e.workspaceRoot
|
|
238
|
+
});
|
|
239
|
+
this.externalService.configure({
|
|
240
|
+
ownedFilePaths: new Set(n.ownerByFilePath.keys()),
|
|
241
|
+
workspaceRoot: e.workspaceRoot
|
|
242
|
+
}), this.classHierarchyService.build({ programs: n.programs });
|
|
243
|
+
let s = this.callablesService.collect({
|
|
244
|
+
fileFilter: this.fileFilterService.buildProjectFileFilter({
|
|
245
|
+
excludeByProject: o.excludeByProject,
|
|
246
|
+
fileFilter: t,
|
|
247
|
+
projects: r
|
|
248
|
+
}),
|
|
249
|
+
includeTests: e.configuration.entryPoints.includeTests,
|
|
250
|
+
includeTestsByProject: new Map([...o.entryPointsByProject].map(([e, t]) => [e, t.includeTests])),
|
|
251
|
+
ownerByFilePath: n.ownerByFilePath,
|
|
252
|
+
workspaceRoot: e.workspaceRoot
|
|
253
|
+
});
|
|
254
|
+
return {
|
|
255
|
+
...o,
|
|
256
|
+
collection: s,
|
|
257
|
+
projectNames: a,
|
|
258
|
+
startingProjectRoots: new Map(i.map((e) => [e.name, e.root]))
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
discoverPrograms(e) {
|
|
262
|
+
let t = this.fileFilterService.buildFileFilter({
|
|
263
|
+
exclude: e.configuration.exclude,
|
|
264
|
+
excludeFrom: e.configuration.excludeFrom,
|
|
265
|
+
workspaceRoot: e.workspaceRoot
|
|
266
|
+
}), n = this.workspaceService.discoverProjects({
|
|
267
|
+
directories: e.directories,
|
|
268
|
+
fileFilter: t,
|
|
269
|
+
workspaceRoot: e.workspaceRoot
|
|
270
|
+
}), r = e.directories.length === 0 ? n : this.workspaceService.discoverProjects({
|
|
271
|
+
directories: [],
|
|
272
|
+
fileFilter: t,
|
|
273
|
+
workspaceRoot: e.workspaceRoot
|
|
274
|
+
}), i = this.programService.buildPrograms({
|
|
275
|
+
startingProjects: n,
|
|
276
|
+
workspaceProjects: r,
|
|
277
|
+
workspaceRoot: e.workspaceRoot
|
|
278
|
+
});
|
|
279
|
+
return {
|
|
280
|
+
fileFilter: t,
|
|
281
|
+
programSet: i,
|
|
282
|
+
projects: i.programs.map((e) => e.project),
|
|
283
|
+
startingProjects: n
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
async loadProjectDeclarations(e) {
|
|
287
|
+
let t = await this.configurationService.loadProjectConfigurations({
|
|
288
|
+
projects: e.projectNames,
|
|
289
|
+
workspaceConfigurationPath: e.configurationPath,
|
|
290
|
+
workspaceRoot: e.workspaceRoot
|
|
291
|
+
});
|
|
292
|
+
return {
|
|
293
|
+
entryPointsByProject: new Map(t.map((e) => [e.project, e.configuration.entryPoints])),
|
|
294
|
+
excludeByProject: new Map(t.filter((e) => (e.authored.exclude ?? []).length > 0).map((e) => [e.project, e.authored.exclude ?? []])),
|
|
295
|
+
projectLimits: this.configurationService.resolveLimits({
|
|
296
|
+
limitOverrides: e.limitOverrides,
|
|
297
|
+
projectConfigurations: t,
|
|
298
|
+
projects: e.projectNames,
|
|
299
|
+
workspaceAuthoredLimits: e.authoredLimits,
|
|
300
|
+
workspaceConfiguration: e.configuration,
|
|
301
|
+
workspaceConfigurationPath: e.configurationPath
|
|
302
|
+
}),
|
|
303
|
+
writeByProject: new Map(t.map((e) => [e.project, e.configuration.write]))
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
readMaximumDepth(e) {
|
|
307
|
+
return e.byComponent.reduce((e, t) => Math.max(e, t.depth), 0);
|
|
308
|
+
}
|
|
309
|
+
analyze(e) {
|
|
310
|
+
let { breadthMeasurement: t, condensed: n, graph: r, measurement: i } = this.graphAssemblyService.assemble({
|
|
311
|
+
callablesById: e.callablesById,
|
|
312
|
+
excludeCallees: e.configuration.excludeCallees,
|
|
313
|
+
includeConstructorEdges: !0,
|
|
314
|
+
workspaceRoot: e.workspaceRoot
|
|
315
|
+
}), a = this.entryPointsService.resolve({
|
|
316
|
+
callablesById: e.callablesById,
|
|
317
|
+
entryPoints: e.configuration.entryPoints,
|
|
318
|
+
entryPointsByProject: e.entryPointsByProject,
|
|
319
|
+
graph: r,
|
|
320
|
+
workspaceRoot: e.workspaceRoot
|
|
321
|
+
}), o = this.projectReportsService.build({
|
|
322
|
+
breadthMeasurement: t,
|
|
323
|
+
callablesById: e.callablesById,
|
|
324
|
+
condensed: n,
|
|
325
|
+
entryPoints: a,
|
|
326
|
+
fileCountByProject: e.fileCountByProject,
|
|
327
|
+
graph: r,
|
|
328
|
+
measurement: i,
|
|
329
|
+
projectNames: e.projectNames
|
|
330
|
+
}), s = {
|
|
331
|
+
callableCount: e.callablesById.size,
|
|
332
|
+
cyclicComponentCount: n.memberIdsByComponent.filter((e) => e.length > 1).length,
|
|
333
|
+
edgeCount: r.edges.length,
|
|
334
|
+
entryPointCount: a.entryPoints.length,
|
|
335
|
+
fileCount: e.fileCount,
|
|
336
|
+
maximumDepth: this.readMaximumDepth(i),
|
|
337
|
+
projectCount: e.projectCount,
|
|
338
|
+
unresolvedCallCount: r.unresolvedCalls.length
|
|
339
|
+
};
|
|
340
|
+
return this.logger.info("🔭 Finished an analysis", void 0, {
|
|
341
|
+
callableCount: s.callableCount,
|
|
342
|
+
edgeCount: s.edgeCount,
|
|
343
|
+
entryPointCount: s.entryPointCount,
|
|
344
|
+
maximumDepthTraced: s.maximumDepth
|
|
345
|
+
}), {
|
|
346
|
+
projectLimits: e.projectLimits,
|
|
347
|
+
result: {
|
|
348
|
+
deepStacks: this.projectReportsService.findDeepStacks({
|
|
349
|
+
limits: e.projectLimits,
|
|
350
|
+
reports: o
|
|
351
|
+
}),
|
|
352
|
+
projects: o,
|
|
353
|
+
summary: s,
|
|
354
|
+
wideCallables: this.projectReportsService.findWideCallables({
|
|
355
|
+
limits: e.projectLimits,
|
|
356
|
+
reports: o
|
|
357
|
+
})
|
|
358
|
+
},
|
|
359
|
+
unresolvedAddresses: a.unresolvedAddresses
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
async locate(e) {
|
|
363
|
+
let { collection: t, startingProjectRoots: n } = await this.discoverCallables(e), { graph: r } = this.graphAssemblyService.assemble({
|
|
364
|
+
callablesById: t.byId,
|
|
365
|
+
excludeCallees: e.configuration.excludeCallees,
|
|
366
|
+
includeConstructorEdges: !0,
|
|
367
|
+
workspaceRoot: e.workspaceRoot
|
|
368
|
+
});
|
|
369
|
+
return {
|
|
370
|
+
callablesById: t.byId,
|
|
371
|
+
graph: r,
|
|
372
|
+
startingProjectRoots: n
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
async trace(e) {
|
|
376
|
+
this.logger.info("🔭 Tracing a workspace", void 0, { workspaceRoot: e.workspaceRoot });
|
|
377
|
+
let { collection: t, entryPointsByProject: n, projectLimits: r, projectNames: i, startingProjectRoots: a, writeByProject: o } = await this.discoverCallables(e);
|
|
378
|
+
return {
|
|
379
|
+
...this.analyze({
|
|
380
|
+
callablesById: t.byId,
|
|
381
|
+
configuration: e.configuration,
|
|
382
|
+
entryPointsByProject: n,
|
|
383
|
+
fileCount: t.fileCount,
|
|
384
|
+
fileCountByProject: t.fileCountByProject,
|
|
385
|
+
projectCount: i.length,
|
|
386
|
+
projectLimits: r,
|
|
387
|
+
projectNames: i,
|
|
388
|
+
workspaceRoot: e.workspaceRoot
|
|
389
|
+
}),
|
|
390
|
+
projectNames: i,
|
|
391
|
+
startingProjectRoots: a,
|
|
392
|
+
writeByProject: o
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
F = P = D([d(), E("design:paramtypes", [
|
|
397
|
+
ce === void 0 ? Object : ce,
|
|
398
|
+
ue === void 0 ? Object : ue,
|
|
399
|
+
pe === void 0 ? Object : pe,
|
|
400
|
+
me === void 0 ? Object : me,
|
|
401
|
+
_ === void 0 ? Object : _,
|
|
402
|
+
he === void 0 ? Object : he,
|
|
403
|
+
y === void 0 ? Object : y,
|
|
404
|
+
n === void 0 ? Object : n,
|
|
405
|
+
we === void 0 ? Object : we,
|
|
406
|
+
x === void 0 ? Object : x,
|
|
407
|
+
k === void 0 ? Object : k
|
|
408
|
+
])], F);
|
|
409
|
+
//#endregion
|
|
410
|
+
//#region packages/ic-suite/callidescope/callidescope-cli/src/modules/callidescope/callidescope.command.ts
|
|
411
|
+
var I, L = I = class extends w {
|
|
412
|
+
addressService;
|
|
413
|
+
callidescopeService;
|
|
414
|
+
configurationService;
|
|
415
|
+
outputJsonService;
|
|
416
|
+
markdownReportService;
|
|
417
|
+
reportFindingsService;
|
|
418
|
+
writeDestinationsService;
|
|
419
|
+
logger;
|
|
420
|
+
constructor(e, t, n, r, i, a, o, s) {
|
|
421
|
+
super(), this.addressService = e, this.callidescopeService = t, this.configurationService = n, this.outputJsonService = r, this.markdownReportService = i, this.reportFindingsService = a, this.writeDestinationsService = o, this.logger = s, this.logger.setContext(I.name);
|
|
422
|
+
}
|
|
423
|
+
describeUnresolvedAddress(e) {
|
|
424
|
+
let t = e.projectName ?? "the workspace configuration", { address: n, resolution: r } = e;
|
|
425
|
+
return r.kind === "not-found" ? `${t} declares an entryPoints.addresses entry that resolves to nothing: "${n}". ${Fe}` : r.kind === "invalid" ? `${t} declares an invalid entryPoints.addresses entry. ${r.reason}` : `${t} declares an entryPoints.addresses entry that matches more than one declaration: "${n}". ${this.addressService.describeCandidates({
|
|
426
|
+
address: n,
|
|
427
|
+
candidates: r.candidates
|
|
428
|
+
})}`;
|
|
429
|
+
}
|
|
430
|
+
reject(e, t) {
|
|
431
|
+
this.logger.error(e, void 0, t), process.exitCode = 1;
|
|
432
|
+
}
|
|
433
|
+
report(e) {
|
|
434
|
+
let { json: t } = e.configuration.write;
|
|
435
|
+
if (e.format === "json") {
|
|
436
|
+
process.stdout.write(this.outputJsonService.buildReport({
|
|
437
|
+
destination: t ?? {
|
|
438
|
+
indentation: r,
|
|
439
|
+
path: ""
|
|
440
|
+
},
|
|
441
|
+
result: e.result
|
|
442
|
+
}));
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
process.stdout.write(this.markdownReportService.renderRun({
|
|
446
|
+
description: void 0,
|
|
447
|
+
heading: a,
|
|
448
|
+
limits: e.projectLimits,
|
|
449
|
+
previewCount: i,
|
|
450
|
+
rendering: e.format === "mermaid" ? "diagram" : "tree",
|
|
451
|
+
result: e.result
|
|
452
|
+
}));
|
|
453
|
+
}
|
|
454
|
+
async traceWorkspace(e) {
|
|
455
|
+
let t = await this.configurationService.resolveFormatOption(e), { errors: n, run: r } = await this.configurationService.prepareRun(t);
|
|
456
|
+
if (r === void 0) {
|
|
457
|
+
this.reject(j, { reasons: n });
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
this.logger.debug("🔭 Starting a call-stack trace", void 0, {
|
|
461
|
+
format: t.format,
|
|
462
|
+
workspaceRoot: r.workspaceRoot
|
|
463
|
+
});
|
|
464
|
+
let { authoredLimits: i, configuration: a, configurationPath: o, format: s, limitOverrides: c, mode: l, workspaceRoot: u } = r, d = await this.callidescopeService.trace({
|
|
465
|
+
authoredLimits: i,
|
|
466
|
+
configuration: a,
|
|
467
|
+
configurationPath: o,
|
|
468
|
+
directories: a.directories,
|
|
469
|
+
limitOverrides: c,
|
|
470
|
+
workspaceRoot: u
|
|
471
|
+
});
|
|
472
|
+
if (d.unresolvedAddresses.length > 0) throw new N(d.unresolvedAddresses.map((e) => this.describeUnresolvedAddress(e)));
|
|
473
|
+
this.report({
|
|
474
|
+
configuration: a,
|
|
475
|
+
format: s,
|
|
476
|
+
projectLimits: d.projectLimits,
|
|
477
|
+
result: d.result
|
|
478
|
+
});
|
|
479
|
+
let f = this.configurationService.touchesFiles(l) ? this.writeDestinationsService.syncDestinations({
|
|
480
|
+
check: l.checksReports,
|
|
481
|
+
configuration: a,
|
|
482
|
+
projectLimits: d.projectLimits,
|
|
483
|
+
result: d.result,
|
|
484
|
+
startingProjectRoots: d.startingProjectRoots,
|
|
485
|
+
writeByProject: d.writeByProject
|
|
486
|
+
}) : [];
|
|
487
|
+
this.logger.info("🔭 Finished a call-stack trace", void 0, {
|
|
488
|
+
deepStackCount: d.result.deepStacks.length,
|
|
489
|
+
staleReportCount: f.length,
|
|
490
|
+
wideCallableCount: d.result.wideCallables.length
|
|
491
|
+
}), this.reportFindingsService.reportFindings({
|
|
492
|
+
mode: l,
|
|
493
|
+
result: d.result,
|
|
494
|
+
stalePaths: f
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
parseCheck(e) {
|
|
498
|
+
return e;
|
|
499
|
+
}
|
|
500
|
+
parseConfig(e) {
|
|
501
|
+
return this.configurationService.parseOptionalOption(e);
|
|
502
|
+
}
|
|
503
|
+
parseDirectories(e) {
|
|
504
|
+
return this.configurationService.parseCommaDelimitedOption(e);
|
|
505
|
+
}
|
|
506
|
+
parseEntryPointAddresses(e) {
|
|
507
|
+
return this.configurationService.parseCommaDelimitedOption(e);
|
|
508
|
+
}
|
|
509
|
+
parseEntryPointDecorators(e) {
|
|
510
|
+
return this.configurationService.parseCommaDelimitedOption(e);
|
|
511
|
+
}
|
|
512
|
+
parseExclude(e) {
|
|
513
|
+
return this.configurationService.parseCommaDelimitedOption(e);
|
|
514
|
+
}
|
|
515
|
+
parseExcludeCallees(e) {
|
|
516
|
+
return this.configurationService.parseCommaDelimitedOption(e);
|
|
517
|
+
}
|
|
518
|
+
parseFormat(e) {
|
|
519
|
+
return this.configurationService.parseOptionalOption(e);
|
|
520
|
+
}
|
|
521
|
+
parseIncludeExportedFunctions(e) {
|
|
522
|
+
return this.configurationService.parseOptionalOption(e);
|
|
523
|
+
}
|
|
524
|
+
parseIncludeOrphans(e) {
|
|
525
|
+
return this.configurationService.parseOptionalOption(e);
|
|
526
|
+
}
|
|
527
|
+
parseIncludeTests(e) {
|
|
528
|
+
return this.configurationService.parseOptionalOption(e);
|
|
529
|
+
}
|
|
530
|
+
parseJson(e) {
|
|
531
|
+
return this.configurationService.parseOptionalOption(e);
|
|
532
|
+
}
|
|
533
|
+
parseMarkdown(e) {
|
|
534
|
+
return this.configurationService.parseOptionalOption(e);
|
|
535
|
+
}
|
|
536
|
+
parseMaximumBreadth(e) {
|
|
537
|
+
return this.configurationService.parseOptionalOption(e);
|
|
538
|
+
}
|
|
539
|
+
parseMaximumDepth(e) {
|
|
540
|
+
return this.configurationService.parseOptionalOption(e);
|
|
541
|
+
}
|
|
542
|
+
parseMermaid(e) {
|
|
543
|
+
return this.configurationService.parseOptionalOption(e);
|
|
544
|
+
}
|
|
545
|
+
parseWrite(e) {
|
|
546
|
+
return e ?? !0;
|
|
547
|
+
}
|
|
548
|
+
async run(e, t) {
|
|
549
|
+
let [n] = e;
|
|
550
|
+
if (n !== void 0) {
|
|
551
|
+
this.reject(j, { reason: Be(n) });
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
try {
|
|
555
|
+
await this.traceWorkspace(t);
|
|
556
|
+
} catch (e) {
|
|
557
|
+
let t = M(e);
|
|
558
|
+
if (t === void 0 || !(e instanceof Error)) throw e;
|
|
559
|
+
this.reject(t, { reason: e.message });
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
D([
|
|
564
|
+
T({
|
|
565
|
+
description: `Fail on a comma-separated set drawn from ${e.map((e) => `"${e}"`).join(" and ")}`,
|
|
566
|
+
flags: "--check [check]"
|
|
567
|
+
}),
|
|
568
|
+
E("design:type", Function),
|
|
569
|
+
E("design:paramtypes", [String]),
|
|
570
|
+
E("design:returntype", String)
|
|
571
|
+
], L.prototype, "parseCheck", null), D([
|
|
572
|
+
T({
|
|
573
|
+
description: "Path to a callidescope configuration file",
|
|
574
|
+
flags: "--config [config]"
|
|
575
|
+
}),
|
|
576
|
+
E("design:type", Function),
|
|
577
|
+
E("design:paramtypes", [Object]),
|
|
578
|
+
E("design:returntype", Object)
|
|
579
|
+
], L.prototype, "parseConfig", null), D([
|
|
580
|
+
T({
|
|
581
|
+
description: "Comma-separated project directories to trace",
|
|
582
|
+
flags: "-d, --directories [directories]"
|
|
583
|
+
}),
|
|
584
|
+
E("design:type", Function),
|
|
585
|
+
E("design:paramtypes", [Object]),
|
|
586
|
+
E("design:returntype", Array)
|
|
587
|
+
], L.prototype, "parseDirectories", null), D([
|
|
588
|
+
T({
|
|
589
|
+
description: "Comma-separated callable addresses to root stacks at",
|
|
590
|
+
flags: "--entry-point-addresses [entryPointAddresses]"
|
|
591
|
+
}),
|
|
592
|
+
E("design:type", Function),
|
|
593
|
+
E("design:paramtypes", [Object]),
|
|
594
|
+
E("design:returntype", Array)
|
|
595
|
+
], L.prototype, "parseEntryPointAddresses", null), D([
|
|
596
|
+
T({
|
|
597
|
+
description: "Comma-separated decorators whose methods a framework invokes",
|
|
598
|
+
flags: "--entry-point-decorators [entryPointDecorators]"
|
|
599
|
+
}),
|
|
600
|
+
E("design:type", Function),
|
|
601
|
+
E("design:paramtypes", [Object]),
|
|
602
|
+
E("design:returntype", Array)
|
|
603
|
+
], L.prototype, "parseEntryPointDecorators", null), D([
|
|
604
|
+
T({
|
|
605
|
+
description: "Comma-separated globs to leave untraced",
|
|
606
|
+
flags: "--exclude [exclude]"
|
|
607
|
+
}),
|
|
608
|
+
E("design:type", Function),
|
|
609
|
+
E("design:paramtypes", [Object]),
|
|
610
|
+
E("design:returntype", Array)
|
|
611
|
+
], L.prototype, "parseExclude", null), D([
|
|
612
|
+
T({
|
|
613
|
+
description: "Comma-separated display-name globs to drop calls landing on",
|
|
614
|
+
flags: "--exclude-callees [excludeCallees]"
|
|
615
|
+
}),
|
|
616
|
+
E("design:type", Function),
|
|
617
|
+
E("design:paramtypes", [Object]),
|
|
618
|
+
E("design:returntype", Array)
|
|
619
|
+
], L.prototype, "parseExcludeCallees", null), D([
|
|
620
|
+
T({
|
|
621
|
+
description: "What to print: markdown, mermaid, or json",
|
|
622
|
+
flags: "-f, --format [format]"
|
|
623
|
+
}),
|
|
624
|
+
E("design:type", Function),
|
|
625
|
+
E("design:paramtypes", [Object]),
|
|
626
|
+
E("design:returntype", Object)
|
|
627
|
+
], L.prototype, "parseFormat", null), D([
|
|
628
|
+
T({
|
|
629
|
+
description: "Treat every src/index.ts export as a root: \"true\" or \"false\"",
|
|
630
|
+
flags: "--include-exported-functions [includeExportedFunctions]"
|
|
631
|
+
}),
|
|
632
|
+
E("design:type", Function),
|
|
633
|
+
E("design:paramtypes", [Object]),
|
|
634
|
+
E("design:returntype", Object)
|
|
635
|
+
], L.prototype, "parseIncludeExportedFunctions", null), D([
|
|
636
|
+
T({
|
|
637
|
+
description: "Promote callables nothing calls: \"true\" or \"false\"",
|
|
638
|
+
flags: "--include-orphans [includeOrphans]"
|
|
639
|
+
}),
|
|
640
|
+
E("design:type", Function),
|
|
641
|
+
E("design:paramtypes", [Object]),
|
|
642
|
+
E("design:returntype", Object)
|
|
643
|
+
], L.prototype, "parseIncludeOrphans", null), D([
|
|
644
|
+
T({
|
|
645
|
+
description: "Trace test files too: \"true\" or \"false\"",
|
|
646
|
+
flags: "--include-tests [includeTests]"
|
|
647
|
+
}),
|
|
648
|
+
E("design:type", Function),
|
|
649
|
+
E("design:paramtypes", [Object]),
|
|
650
|
+
E("design:returntype", Object)
|
|
651
|
+
], L.prototype, "parseIncludeTests", null), D([
|
|
652
|
+
T({
|
|
653
|
+
description: "Where the JSON report goes when --write or --check reports asks for it",
|
|
654
|
+
flags: "--json [json]"
|
|
655
|
+
}),
|
|
656
|
+
E("design:type", Function),
|
|
657
|
+
E("design:paramtypes", [Object]),
|
|
658
|
+
E("design:returntype", Object)
|
|
659
|
+
], L.prototype, "parseJson", null), D([
|
|
660
|
+
T({
|
|
661
|
+
description: "Where the markdown block goes when --write or --check reports asks for it",
|
|
662
|
+
flags: "-m, --markdown [markdown]"
|
|
663
|
+
}),
|
|
664
|
+
E("design:type", Function),
|
|
665
|
+
E("design:paramtypes", [Object]),
|
|
666
|
+
E("design:returntype", Object)
|
|
667
|
+
], L.prototype, "parseMarkdown", null), D([
|
|
668
|
+
T({
|
|
669
|
+
description: "Override the configured limits.maximumBreadth",
|
|
670
|
+
flags: "--maximum-breadth <maximumBreadth>"
|
|
671
|
+
}),
|
|
672
|
+
E("design:type", Function),
|
|
673
|
+
E("design:paramtypes", [Object]),
|
|
674
|
+
E("design:returntype", Object)
|
|
675
|
+
], L.prototype, "parseMaximumBreadth", null), D([
|
|
676
|
+
T({
|
|
677
|
+
description: "Override the configured limits.maximumDepth",
|
|
678
|
+
flags: "--maximum-depth <maximumDepth>"
|
|
679
|
+
}),
|
|
680
|
+
E("design:type", Function),
|
|
681
|
+
E("design:paramtypes", [Object]),
|
|
682
|
+
E("design:returntype", Object)
|
|
683
|
+
], L.prototype, "parseMaximumDepth", null), D([
|
|
684
|
+
T({
|
|
685
|
+
description: "Where the mermaid block goes when --write or --check reports asks for it",
|
|
686
|
+
flags: "--mermaid [mermaid]"
|
|
687
|
+
}),
|
|
688
|
+
E("design:type", Function),
|
|
689
|
+
E("design:paramtypes", [Object]),
|
|
690
|
+
E("design:returntype", Object)
|
|
691
|
+
], L.prototype, "parseMermaid", null), D([
|
|
692
|
+
T({
|
|
693
|
+
description: "Write every configured destination",
|
|
694
|
+
flags: "--write"
|
|
695
|
+
}),
|
|
696
|
+
E("design:type", Function),
|
|
697
|
+
E("design:paramtypes", [Object]),
|
|
698
|
+
E("design:returntype", Boolean)
|
|
699
|
+
], L.prototype, "parseWrite", null), L = I = D([
|
|
700
|
+
C({
|
|
701
|
+
description: "Run the callidescope command",
|
|
702
|
+
name: "callidescope",
|
|
703
|
+
options: { isDefault: !0 }
|
|
704
|
+
}),
|
|
705
|
+
d(),
|
|
706
|
+
E("design:paramtypes", [
|
|
707
|
+
h === void 0 ? Object : h,
|
|
708
|
+
F === void 0 ? Object : F,
|
|
709
|
+
n === void 0 ? Object : n,
|
|
710
|
+
xe === void 0 ? Object : xe,
|
|
711
|
+
ye === void 0 ? Object : ye,
|
|
712
|
+
Ee === void 0 ? Object : Ee,
|
|
713
|
+
ke === void 0 ? Object : ke,
|
|
714
|
+
k === void 0 ? Object : k
|
|
715
|
+
])
|
|
716
|
+
], L);
|
|
717
|
+
//#endregion
|
|
718
|
+
//#region packages/ic-suite/callidescope/callidescope-cli/src/modules/callidescope/callidescope.module.ts
|
|
719
|
+
var R = class {};
|
|
720
|
+
R = D([f({
|
|
721
|
+
controllers: [],
|
|
722
|
+
exports: [L, F],
|
|
723
|
+
imports: [
|
|
724
|
+
g,
|
|
725
|
+
t,
|
|
726
|
+
de,
|
|
727
|
+
fe,
|
|
728
|
+
v,
|
|
729
|
+
le,
|
|
730
|
+
A,
|
|
731
|
+
be,
|
|
732
|
+
Se,
|
|
733
|
+
_e,
|
|
734
|
+
Ce,
|
|
735
|
+
Te,
|
|
736
|
+
De,
|
|
737
|
+
b,
|
|
738
|
+
Oe
|
|
739
|
+
],
|
|
740
|
+
providers: [L, F]
|
|
741
|
+
})], R);
|
|
742
|
+
//#endregion
|
|
743
|
+
//#region packages/ic-suite/callidescope/callidescope-cli/src/modules/address-lookup/address-lookup.service.ts
|
|
744
|
+
var z = class {
|
|
745
|
+
addressService;
|
|
746
|
+
callidescopeService;
|
|
747
|
+
configurationService;
|
|
748
|
+
constructor(e, t, n) {
|
|
749
|
+
this.addressService = e, this.callidescopeService = t, this.configurationService = n;
|
|
750
|
+
}
|
|
751
|
+
describeProblem(e) {
|
|
752
|
+
let { resolution: t } = e;
|
|
753
|
+
if (t.kind !== "resolved") return t.kind === "invalid" ? t.reason : t.kind === "not-found" ? `No callable matches "${e.address}". ${Fe}` : `"${e.address}" matches more than one declaration. ${this.addressService.describeCandidates({
|
|
754
|
+
address: e.address,
|
|
755
|
+
candidates: t.candidates
|
|
756
|
+
})}`;
|
|
757
|
+
}
|
|
758
|
+
listAddresses(e) {
|
|
759
|
+
return this.addressService.listAddresses(e.located.callablesById);
|
|
760
|
+
}
|
|
761
|
+
async locate(e) {
|
|
762
|
+
let { authoredLimits: t, configuration: n, configurationPath: r, format: i, workspaceRoot: a } = await this.configurationService.prepareLookup(e);
|
|
763
|
+
return {
|
|
764
|
+
configuration: n,
|
|
765
|
+
format: i,
|
|
766
|
+
located: await this.callidescopeService.locate({
|
|
767
|
+
authoredLimits: t,
|
|
768
|
+
configuration: n,
|
|
769
|
+
configurationPath: r,
|
|
770
|
+
directories: n.directories,
|
|
771
|
+
workspaceRoot: a
|
|
772
|
+
}),
|
|
773
|
+
workspaceRoot: a
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
resolve(e) {
|
|
777
|
+
return this.addressService.resolve({
|
|
778
|
+
address: e.address,
|
|
779
|
+
callablesById: e.workspace.located.callablesById,
|
|
780
|
+
workspaceRoot: e.workspace.workspaceRoot
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
};
|
|
784
|
+
z = D([d(), E("design:paramtypes", [
|
|
785
|
+
h === void 0 ? Object : h,
|
|
786
|
+
F === void 0 ? Object : F,
|
|
787
|
+
n === void 0 ? Object : n
|
|
788
|
+
])], z);
|
|
789
|
+
//#endregion
|
|
790
|
+
//#region packages/ic-suite/callidescope/callidescope-cli/src/modules/address-lookup/address-lookup.module.ts
|
|
791
|
+
var B = class {};
|
|
792
|
+
B = D([f({
|
|
793
|
+
controllers: [],
|
|
794
|
+
exports: [z],
|
|
795
|
+
imports: [
|
|
796
|
+
g,
|
|
797
|
+
R,
|
|
798
|
+
t
|
|
799
|
+
],
|
|
800
|
+
providers: [z]
|
|
801
|
+
})], B);
|
|
802
|
+
//#endregion
|
|
803
|
+
//#region packages/ic-suite/callidescope/callidescope-cli/src/modules/breadth/breadth.command.ts
|
|
804
|
+
var V, H = V = class extends w {
|
|
805
|
+
addressLookupService;
|
|
806
|
+
addressReportService;
|
|
807
|
+
breadthService;
|
|
808
|
+
configurationService;
|
|
809
|
+
logger;
|
|
810
|
+
constructor(e, t, n, r, i) {
|
|
811
|
+
super(), this.addressLookupService = e, this.addressReportService = t, this.breadthService = n, this.configurationService = r, this.logger = i, this.logger.setContext(V.name);
|
|
812
|
+
}
|
|
813
|
+
buildReports(e) {
|
|
814
|
+
let t = [], n = [];
|
|
815
|
+
for (let r of e.addresses) {
|
|
816
|
+
let i = this.describeAddress({
|
|
817
|
+
address: r,
|
|
818
|
+
workspace: e.workspace
|
|
819
|
+
});
|
|
820
|
+
if (typeof i == "string") {
|
|
821
|
+
n.push(i);
|
|
822
|
+
continue;
|
|
823
|
+
}
|
|
824
|
+
t.push(i);
|
|
825
|
+
}
|
|
826
|
+
if (n.length > 0) {
|
|
827
|
+
this.reject(Ie, { problems: n });
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
830
|
+
return t;
|
|
831
|
+
}
|
|
832
|
+
describeAddress(e) {
|
|
833
|
+
let t = this.addressLookupService.resolve(e), n = this.addressLookupService.describeProblem({
|
|
834
|
+
address: e.address,
|
|
835
|
+
resolution: t
|
|
836
|
+
});
|
|
837
|
+
if (n !== void 0 || t.kind !== "resolved") return n ?? `"${e.address}" resolved to nothing.`;
|
|
838
|
+
let { id: r } = t, { located: i } = e.workspace, a = i.callablesById.get(r);
|
|
839
|
+
return a === void 0 ? `"${e.address}" resolved to a callable that was not traced.` : {
|
|
840
|
+
address: e.address,
|
|
841
|
+
directCalls: this.breadthService.describeDirectCalls({
|
|
842
|
+
callablesById: i.callablesById,
|
|
843
|
+
graph: i.graph,
|
|
844
|
+
id: r
|
|
845
|
+
}),
|
|
846
|
+
displayName: a.node.displayName,
|
|
847
|
+
id: r,
|
|
848
|
+
location: a.node.location
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
async printBreadth(e) {
|
|
852
|
+
let t = await this.configurationService.resolveFormatOption(e), n = await this.addressLookupService.locate(t), r = await this.resolveAddresses({
|
|
853
|
+
options: t,
|
|
854
|
+
workspace: n
|
|
855
|
+
}), i = this.buildReports({
|
|
856
|
+
addresses: r,
|
|
857
|
+
workspace: n
|
|
858
|
+
});
|
|
859
|
+
i !== void 0 && process.stdout.write(this.addressReportService.renderBreadthReports({
|
|
860
|
+
format: n.format,
|
|
861
|
+
reports: i
|
|
862
|
+
}));
|
|
863
|
+
}
|
|
864
|
+
reject(e, t) {
|
|
865
|
+
this.logger.error(e, void 0, t), process.exitCode = 1;
|
|
866
|
+
}
|
|
867
|
+
async resolveAddresses(e) {
|
|
868
|
+
let t = e.options.addresses ?? [];
|
|
869
|
+
return t.length > 0 ? t : this.configurationService.promptForAutocompleteMultiselect({
|
|
870
|
+
message: "Which callables? (file#qualified-name)",
|
|
871
|
+
subject: "At least one callable address, as in \"breadth --addresses src/foo.service.ts#FooService.bar\"",
|
|
872
|
+
suggestions: this.addressLookupService.listAddresses(e.workspace)
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
parseAddresses(e) {
|
|
876
|
+
return this.configurationService.parseCommaDelimitedOption(e);
|
|
877
|
+
}
|
|
878
|
+
parseConfig(e) {
|
|
879
|
+
return this.configurationService.parseOptionalOption(e);
|
|
880
|
+
}
|
|
881
|
+
parseDirectories(e) {
|
|
882
|
+
return this.configurationService.parseCommaDelimitedOption(e);
|
|
883
|
+
}
|
|
884
|
+
parseEntryPointAddresses(e) {
|
|
885
|
+
return this.configurationService.parseCommaDelimitedOption(e);
|
|
886
|
+
}
|
|
887
|
+
parseEntryPointDecorators(e) {
|
|
888
|
+
return this.configurationService.parseCommaDelimitedOption(e);
|
|
889
|
+
}
|
|
890
|
+
parseExclude(e) {
|
|
891
|
+
return this.configurationService.parseCommaDelimitedOption(e);
|
|
892
|
+
}
|
|
893
|
+
parseExcludeCallees(e) {
|
|
894
|
+
return this.configurationService.parseCommaDelimitedOption(e);
|
|
895
|
+
}
|
|
896
|
+
parseFormat(e) {
|
|
897
|
+
return this.configurationService.parseOptionalOption(e);
|
|
898
|
+
}
|
|
899
|
+
parseIncludeExportedFunctions(e) {
|
|
900
|
+
return this.configurationService.parseOptionalOption(e);
|
|
901
|
+
}
|
|
902
|
+
parseIncludeOrphans(e) {
|
|
903
|
+
return this.configurationService.parseOptionalOption(e);
|
|
904
|
+
}
|
|
905
|
+
parseIncludeTests(e) {
|
|
906
|
+
return this.configurationService.parseOptionalOption(e);
|
|
907
|
+
}
|
|
908
|
+
async run(e, t) {
|
|
909
|
+
try {
|
|
910
|
+
await this.printBreadth(t);
|
|
911
|
+
} catch (e) {
|
|
912
|
+
let t = M(e);
|
|
913
|
+
if (t === void 0 || !(e instanceof Error)) throw e;
|
|
914
|
+
this.reject(t, { reason: e.message });
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
};
|
|
918
|
+
D([
|
|
919
|
+
T({
|
|
920
|
+
description: "Comma-separated callable addresses, each <file>#<qualified-name>",
|
|
921
|
+
flags: "-a, --addresses [addresses]"
|
|
922
|
+
}),
|
|
923
|
+
E("design:type", Function),
|
|
924
|
+
E("design:paramtypes", [Object]),
|
|
925
|
+
E("design:returntype", Array)
|
|
926
|
+
], H.prototype, "parseAddresses", null), D([
|
|
927
|
+
T({
|
|
928
|
+
description: "Path to a callidescope configuration file",
|
|
929
|
+
flags: "--config [config]"
|
|
930
|
+
}),
|
|
931
|
+
E("design:type", Function),
|
|
932
|
+
E("design:paramtypes", [Object]),
|
|
933
|
+
E("design:returntype", Object)
|
|
934
|
+
], H.prototype, "parseConfig", null), D([
|
|
935
|
+
T({
|
|
936
|
+
description: "Comma-separated project directories to trace",
|
|
937
|
+
flags: "-d, --directories [directories]"
|
|
938
|
+
}),
|
|
939
|
+
E("design:type", Function),
|
|
940
|
+
E("design:paramtypes", [Object]),
|
|
941
|
+
E("design:returntype", Array)
|
|
942
|
+
], H.prototype, "parseDirectories", null), D([
|
|
943
|
+
T({
|
|
944
|
+
description: "Comma-separated callable addresses to root stacks at",
|
|
945
|
+
flags: "--entry-point-addresses [entryPointAddresses]"
|
|
946
|
+
}),
|
|
947
|
+
E("design:type", Function),
|
|
948
|
+
E("design:paramtypes", [Object]),
|
|
949
|
+
E("design:returntype", Array)
|
|
950
|
+
], H.prototype, "parseEntryPointAddresses", null), D([
|
|
951
|
+
T({
|
|
952
|
+
description: "Comma-separated decorators whose methods a framework invokes",
|
|
953
|
+
flags: "--entry-point-decorators [entryPointDecorators]"
|
|
954
|
+
}),
|
|
955
|
+
E("design:type", Function),
|
|
956
|
+
E("design:paramtypes", [Object]),
|
|
957
|
+
E("design:returntype", Array)
|
|
958
|
+
], H.prototype, "parseEntryPointDecorators", null), D([
|
|
959
|
+
T({
|
|
960
|
+
description: "Comma-separated globs to leave untraced",
|
|
961
|
+
flags: "--exclude [exclude]"
|
|
962
|
+
}),
|
|
963
|
+
E("design:type", Function),
|
|
964
|
+
E("design:paramtypes", [Object]),
|
|
965
|
+
E("design:returntype", Array)
|
|
966
|
+
], H.prototype, "parseExclude", null), D([
|
|
967
|
+
T({
|
|
968
|
+
description: "Comma-separated display-name globs to drop calls landing on",
|
|
969
|
+
flags: "--exclude-callees [excludeCallees]"
|
|
970
|
+
}),
|
|
971
|
+
E("design:type", Function),
|
|
972
|
+
E("design:paramtypes", [Object]),
|
|
973
|
+
E("design:returntype", Array)
|
|
974
|
+
], H.prototype, "parseExcludeCallees", null), D([
|
|
975
|
+
T({
|
|
976
|
+
description: "What to print: markdown, mermaid, or json",
|
|
977
|
+
flags: "-f, --format [format]"
|
|
978
|
+
}),
|
|
979
|
+
E("design:type", Function),
|
|
980
|
+
E("design:paramtypes", [Object]),
|
|
981
|
+
E("design:returntype", Object)
|
|
982
|
+
], H.prototype, "parseFormat", null), D([
|
|
983
|
+
T({
|
|
984
|
+
description: "Treat every src/index.ts export as a root: \"true\" or \"false\"",
|
|
985
|
+
flags: "--include-exported-functions [includeExportedFunctions]"
|
|
986
|
+
}),
|
|
987
|
+
E("design:type", Function),
|
|
988
|
+
E("design:paramtypes", [Object]),
|
|
989
|
+
E("design:returntype", Object)
|
|
990
|
+
], H.prototype, "parseIncludeExportedFunctions", null), D([
|
|
991
|
+
T({
|
|
992
|
+
description: "Promote callables nothing calls: \"true\" or \"false\"",
|
|
993
|
+
flags: "--include-orphans [includeOrphans]"
|
|
994
|
+
}),
|
|
995
|
+
E("design:type", Function),
|
|
996
|
+
E("design:paramtypes", [Object]),
|
|
997
|
+
E("design:returntype", Object)
|
|
998
|
+
], H.prototype, "parseIncludeOrphans", null), D([
|
|
999
|
+
T({
|
|
1000
|
+
description: "Trace test files too: \"true\" or \"false\"",
|
|
1001
|
+
flags: "--include-tests [includeTests]"
|
|
1002
|
+
}),
|
|
1003
|
+
E("design:type", Function),
|
|
1004
|
+
E("design:paramtypes", [Object]),
|
|
1005
|
+
E("design:returntype", Object)
|
|
1006
|
+
], H.prototype, "parseIncludeTests", null), H = V = D([
|
|
1007
|
+
C({
|
|
1008
|
+
description: "Print the direct callers and callees of one or more callables, each addressed as <file>#<qualified-name>",
|
|
1009
|
+
name: "breadth"
|
|
1010
|
+
}),
|
|
1011
|
+
d(),
|
|
1012
|
+
E("design:paramtypes", [
|
|
1013
|
+
z === void 0 ? Object : z,
|
|
1014
|
+
S === void 0 ? Object : S,
|
|
1015
|
+
se === void 0 ? Object : se,
|
|
1016
|
+
n === void 0 ? Object : n,
|
|
1017
|
+
k === void 0 ? Object : k
|
|
1018
|
+
])
|
|
1019
|
+
], H);
|
|
1020
|
+
//#endregion
|
|
1021
|
+
//#region packages/ic-suite/callidescope/callidescope-cli/src/modules/breadth/breadth.module.ts
|
|
1022
|
+
var U = class {};
|
|
1023
|
+
U = D([f({
|
|
1024
|
+
controllers: [],
|
|
1025
|
+
exports: [H],
|
|
1026
|
+
imports: [
|
|
1027
|
+
B,
|
|
1028
|
+
ve,
|
|
1029
|
+
v,
|
|
1030
|
+
t,
|
|
1031
|
+
A
|
|
1032
|
+
],
|
|
1033
|
+
providers: [H]
|
|
1034
|
+
})], U);
|
|
1035
|
+
//#endregion
|
|
1036
|
+
//#region packages/ic-suite/callidescope/callidescope-cli/src/modules/depth/depth.command.ts
|
|
1037
|
+
var W, G = W = class extends w {
|
|
1038
|
+
addressLookupService;
|
|
1039
|
+
addressReportService;
|
|
1040
|
+
addressDepthService;
|
|
1041
|
+
configurationService;
|
|
1042
|
+
logger;
|
|
1043
|
+
constructor(e, t, n, r, i) {
|
|
1044
|
+
super(), this.addressLookupService = e, this.addressReportService = t, this.addressDepthService = n, this.configurationService = r, this.logger = i, this.logger.setContext(W.name);
|
|
1045
|
+
}
|
|
1046
|
+
identifyAddresses(e) {
|
|
1047
|
+
let t = [], n = [];
|
|
1048
|
+
for (let r of e.addresses) {
|
|
1049
|
+
let i = this.addressLookupService.resolve({
|
|
1050
|
+
address: r,
|
|
1051
|
+
workspace: e.workspace
|
|
1052
|
+
}), a = this.addressLookupService.describeProblem({
|
|
1053
|
+
address: r,
|
|
1054
|
+
resolution: i
|
|
1055
|
+
});
|
|
1056
|
+
if (a !== void 0 || i.kind !== "resolved") {
|
|
1057
|
+
n.push(a ?? `"${r}" resolved to nothing.`);
|
|
1058
|
+
continue;
|
|
1059
|
+
}
|
|
1060
|
+
t.push({
|
|
1061
|
+
address: r,
|
|
1062
|
+
id: i.id
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
if (n.length > 0) {
|
|
1066
|
+
this.reject(Ie, { problems: n });
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
return t;
|
|
1070
|
+
}
|
|
1071
|
+
async printDepth(e) {
|
|
1072
|
+
let t = await this.configurationService.resolveFormatOption(e), n = await this.addressLookupService.locate(t), r = await this.resolveAddresses({
|
|
1073
|
+
options: t,
|
|
1074
|
+
workspace: n
|
|
1075
|
+
}), i = this.identifyAddresses({
|
|
1076
|
+
addresses: r,
|
|
1077
|
+
workspace: n
|
|
1078
|
+
});
|
|
1079
|
+
i !== void 0 && process.stdout.write(this.addressReportService.renderDepthReports({
|
|
1080
|
+
format: n.format,
|
|
1081
|
+
reports: i.map(({ address: e, id: t }) => ({
|
|
1082
|
+
address: e,
|
|
1083
|
+
downward: this.addressDepthService.buildDownwardStacks({
|
|
1084
|
+
callablesById: n.located.callablesById,
|
|
1085
|
+
graph: n.located.graph,
|
|
1086
|
+
startId: t
|
|
1087
|
+
}),
|
|
1088
|
+
upward: this.addressDepthService.buildUpwardStacks({
|
|
1089
|
+
callablesById: n.located.callablesById,
|
|
1090
|
+
graph: n.located.graph,
|
|
1091
|
+
startId: t
|
|
1092
|
+
})
|
|
1093
|
+
}))
|
|
1094
|
+
}));
|
|
1095
|
+
}
|
|
1096
|
+
reject(e, t) {
|
|
1097
|
+
this.logger.error(e, void 0, t), process.exitCode = 1;
|
|
1098
|
+
}
|
|
1099
|
+
async resolveAddresses(e) {
|
|
1100
|
+
let t = e.options.addresses ?? [];
|
|
1101
|
+
return t.length > 0 ? t : this.configurationService.promptForAutocompleteMultiselect({
|
|
1102
|
+
message: "Which callables? (file#qualified-name)",
|
|
1103
|
+
subject: "At least one callable address, as in \"depth --addresses src/foo.service.ts#FooService.bar\"",
|
|
1104
|
+
suggestions: this.addressLookupService.listAddresses(e.workspace)
|
|
1105
|
+
});
|
|
1106
|
+
}
|
|
1107
|
+
parseAddresses(e) {
|
|
1108
|
+
return this.configurationService.parseCommaDelimitedOption(e);
|
|
1109
|
+
}
|
|
1110
|
+
parseConfig(e) {
|
|
1111
|
+
return this.configurationService.parseOptionalOption(e);
|
|
1112
|
+
}
|
|
1113
|
+
parseDirectories(e) {
|
|
1114
|
+
return this.configurationService.parseCommaDelimitedOption(e);
|
|
1115
|
+
}
|
|
1116
|
+
parseEntryPointAddresses(e) {
|
|
1117
|
+
return this.configurationService.parseCommaDelimitedOption(e);
|
|
1118
|
+
}
|
|
1119
|
+
parseEntryPointDecorators(e) {
|
|
1120
|
+
return this.configurationService.parseCommaDelimitedOption(e);
|
|
1121
|
+
}
|
|
1122
|
+
parseExclude(e) {
|
|
1123
|
+
return this.configurationService.parseCommaDelimitedOption(e);
|
|
1124
|
+
}
|
|
1125
|
+
parseExcludeCallees(e) {
|
|
1126
|
+
return this.configurationService.parseCommaDelimitedOption(e);
|
|
1127
|
+
}
|
|
1128
|
+
parseFormat(e) {
|
|
1129
|
+
return this.configurationService.parseOptionalOption(e);
|
|
1130
|
+
}
|
|
1131
|
+
parseIncludeExportedFunctions(e) {
|
|
1132
|
+
return this.configurationService.parseOptionalOption(e);
|
|
1133
|
+
}
|
|
1134
|
+
parseIncludeOrphans(e) {
|
|
1135
|
+
return this.configurationService.parseOptionalOption(e);
|
|
1136
|
+
}
|
|
1137
|
+
parseIncludeTests(e) {
|
|
1138
|
+
return this.configurationService.parseOptionalOption(e);
|
|
1139
|
+
}
|
|
1140
|
+
async run(e, t) {
|
|
1141
|
+
try {
|
|
1142
|
+
await this.printDepth(t);
|
|
1143
|
+
} catch (e) {
|
|
1144
|
+
let t = M(e);
|
|
1145
|
+
if (t === void 0 || !(e instanceof Error)) throw e;
|
|
1146
|
+
this.reject(t, { reason: e.message });
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
};
|
|
1150
|
+
D([
|
|
1151
|
+
T({
|
|
1152
|
+
description: "Comma-separated callable addresses, each <file>#<qualified-name>",
|
|
1153
|
+
flags: "-a, --addresses [addresses]"
|
|
1154
|
+
}),
|
|
1155
|
+
E("design:type", Function),
|
|
1156
|
+
E("design:paramtypes", [Object]),
|
|
1157
|
+
E("design:returntype", Array)
|
|
1158
|
+
], G.prototype, "parseAddresses", null), D([
|
|
1159
|
+
T({
|
|
1160
|
+
description: "Path to a callidescope configuration file",
|
|
1161
|
+
flags: "--config [config]"
|
|
1162
|
+
}),
|
|
1163
|
+
E("design:type", Function),
|
|
1164
|
+
E("design:paramtypes", [Object]),
|
|
1165
|
+
E("design:returntype", Object)
|
|
1166
|
+
], G.prototype, "parseConfig", null), D([
|
|
1167
|
+
T({
|
|
1168
|
+
description: "Comma-separated project directories to trace",
|
|
1169
|
+
flags: "-d, --directories [directories]"
|
|
1170
|
+
}),
|
|
1171
|
+
E("design:type", Function),
|
|
1172
|
+
E("design:paramtypes", [Object]),
|
|
1173
|
+
E("design:returntype", Array)
|
|
1174
|
+
], G.prototype, "parseDirectories", null), D([
|
|
1175
|
+
T({
|
|
1176
|
+
description: "Comma-separated callable addresses to root stacks at",
|
|
1177
|
+
flags: "--entry-point-addresses [entryPointAddresses]"
|
|
1178
|
+
}),
|
|
1179
|
+
E("design:type", Function),
|
|
1180
|
+
E("design:paramtypes", [Object]),
|
|
1181
|
+
E("design:returntype", Array)
|
|
1182
|
+
], G.prototype, "parseEntryPointAddresses", null), D([
|
|
1183
|
+
T({
|
|
1184
|
+
description: "Comma-separated decorators whose methods a framework invokes",
|
|
1185
|
+
flags: "--entry-point-decorators [entryPointDecorators]"
|
|
1186
|
+
}),
|
|
1187
|
+
E("design:type", Function),
|
|
1188
|
+
E("design:paramtypes", [Object]),
|
|
1189
|
+
E("design:returntype", Array)
|
|
1190
|
+
], G.prototype, "parseEntryPointDecorators", null), D([
|
|
1191
|
+
T({
|
|
1192
|
+
description: "Comma-separated globs to leave untraced",
|
|
1193
|
+
flags: "--exclude [exclude]"
|
|
1194
|
+
}),
|
|
1195
|
+
E("design:type", Function),
|
|
1196
|
+
E("design:paramtypes", [Object]),
|
|
1197
|
+
E("design:returntype", Array)
|
|
1198
|
+
], G.prototype, "parseExclude", null), D([
|
|
1199
|
+
T({
|
|
1200
|
+
description: "Comma-separated display-name globs to drop calls landing on",
|
|
1201
|
+
flags: "--exclude-callees [excludeCallees]"
|
|
1202
|
+
}),
|
|
1203
|
+
E("design:type", Function),
|
|
1204
|
+
E("design:paramtypes", [Object]),
|
|
1205
|
+
E("design:returntype", Array)
|
|
1206
|
+
], G.prototype, "parseExcludeCallees", null), D([
|
|
1207
|
+
T({
|
|
1208
|
+
description: "What to print: markdown, mermaid, or json",
|
|
1209
|
+
flags: "-f, --format [format]"
|
|
1210
|
+
}),
|
|
1211
|
+
E("design:type", Function),
|
|
1212
|
+
E("design:paramtypes", [Object]),
|
|
1213
|
+
E("design:returntype", Object)
|
|
1214
|
+
], G.prototype, "parseFormat", null), D([
|
|
1215
|
+
T({
|
|
1216
|
+
description: "Treat every src/index.ts export as a root: \"true\" or \"false\"",
|
|
1217
|
+
flags: "--include-exported-functions [includeExportedFunctions]"
|
|
1218
|
+
}),
|
|
1219
|
+
E("design:type", Function),
|
|
1220
|
+
E("design:paramtypes", [Object]),
|
|
1221
|
+
E("design:returntype", Object)
|
|
1222
|
+
], G.prototype, "parseIncludeExportedFunctions", null), D([
|
|
1223
|
+
T({
|
|
1224
|
+
description: "Promote callables nothing calls: \"true\" or \"false\"",
|
|
1225
|
+
flags: "--include-orphans [includeOrphans]"
|
|
1226
|
+
}),
|
|
1227
|
+
E("design:type", Function),
|
|
1228
|
+
E("design:paramtypes", [Object]),
|
|
1229
|
+
E("design:returntype", Object)
|
|
1230
|
+
], G.prototype, "parseIncludeOrphans", null), D([
|
|
1231
|
+
T({
|
|
1232
|
+
description: "Trace test files too: \"true\" or \"false\"",
|
|
1233
|
+
flags: "--include-tests [includeTests]"
|
|
1234
|
+
}),
|
|
1235
|
+
E("design:type", Function),
|
|
1236
|
+
E("design:paramtypes", [Object]),
|
|
1237
|
+
E("design:returntype", Object)
|
|
1238
|
+
], G.prototype, "parseIncludeTests", null), G = W = D([
|
|
1239
|
+
C({
|
|
1240
|
+
description: "Print every call stack above and below one or more callables, each addressed as <file>#<qualified-name>",
|
|
1241
|
+
name: "depth"
|
|
1242
|
+
}),
|
|
1243
|
+
d(),
|
|
1244
|
+
E("design:paramtypes", [
|
|
1245
|
+
z === void 0 ? Object : z,
|
|
1246
|
+
S === void 0 ? Object : S,
|
|
1247
|
+
oe === void 0 ? Object : oe,
|
|
1248
|
+
n === void 0 ? Object : n,
|
|
1249
|
+
k === void 0 ? Object : k
|
|
1250
|
+
])
|
|
1251
|
+
], G);
|
|
1252
|
+
//#endregion
|
|
1253
|
+
//#region packages/ic-suite/callidescope/callidescope-cli/src/modules/depth/depth.module.ts
|
|
1254
|
+
var K = class {};
|
|
1255
|
+
K = D([f({
|
|
1256
|
+
controllers: [],
|
|
1257
|
+
exports: [G],
|
|
1258
|
+
imports: [
|
|
1259
|
+
B,
|
|
1260
|
+
ve,
|
|
1261
|
+
v,
|
|
1262
|
+
t,
|
|
1263
|
+
A
|
|
1264
|
+
],
|
|
1265
|
+
providers: [G]
|
|
1266
|
+
})], K);
|
|
1267
|
+
//#endregion
|
|
1268
|
+
//#region packages/ic-suite/callidescope/callidescope-cli/src/modules/limits/limits.service.ts
|
|
1269
|
+
var q, J = q = class {
|
|
1270
|
+
configurationService;
|
|
1271
|
+
fileFilterService;
|
|
1272
|
+
workspaceService;
|
|
1273
|
+
logger;
|
|
1274
|
+
constructor(e, t, n, r) {
|
|
1275
|
+
this.configurationService = e, this.fileFilterService = t, this.workspaceService = n, this.logger = r, this.logger.setContext(q.name);
|
|
1276
|
+
}
|
|
1277
|
+
discoverProjects(e) {
|
|
1278
|
+
let t = this.fileFilterService.buildFileFilter({
|
|
1279
|
+
exclude: e.configuration.exclude,
|
|
1280
|
+
excludeFrom: e.configuration.excludeFrom,
|
|
1281
|
+
workspaceRoot: e.workspaceRoot
|
|
1282
|
+
});
|
|
1283
|
+
return this.workspaceService.discoverProjects({
|
|
1284
|
+
directories: e.configuration.directories,
|
|
1285
|
+
fileFilter: t,
|
|
1286
|
+
workspaceRoot: e.workspaceRoot
|
|
1287
|
+
}).map((e) => e.name);
|
|
1288
|
+
}
|
|
1289
|
+
toProjectRows(e) {
|
|
1290
|
+
return [this.toRow({
|
|
1291
|
+
...e,
|
|
1292
|
+
limit: "maximumDepth"
|
|
1293
|
+
}), this.toRow({
|
|
1294
|
+
...e,
|
|
1295
|
+
limit: "maximumBreadth"
|
|
1296
|
+
})];
|
|
1297
|
+
}
|
|
1298
|
+
toRow(e) {
|
|
1299
|
+
let t = e.limits[e.limit];
|
|
1300
|
+
return {
|
|
1301
|
+
limit: e.limit,
|
|
1302
|
+
path: e.limits.path === void 0 || t === void 0 ? void 0 : p.relative(e.workspaceRoot, e.limits.path),
|
|
1303
|
+
project: e.project,
|
|
1304
|
+
value: t
|
|
1305
|
+
};
|
|
1306
|
+
}
|
|
1307
|
+
toWorkspaceRows(e) {
|
|
1308
|
+
return [this.toRow({
|
|
1309
|
+
...e,
|
|
1310
|
+
limit: "maximumDepth",
|
|
1311
|
+
project: void 0
|
|
1312
|
+
}), this.toRow({
|
|
1313
|
+
...e,
|
|
1314
|
+
limit: "maximumBreadth",
|
|
1315
|
+
project: void 0
|
|
1316
|
+
})];
|
|
1317
|
+
}
|
|
1318
|
+
async list(e) {
|
|
1319
|
+
let t = process.cwd(), { authored: n, configuration: r, path: i } = await this.configurationService.loadConfigurationFile({
|
|
1320
|
+
configurationPath: e.config,
|
|
1321
|
+
searchDirectory: t
|
|
1322
|
+
}), a = this.discoverProjects({
|
|
1323
|
+
configuration: r,
|
|
1324
|
+
workspaceRoot: t
|
|
1325
|
+
}), o = await this.configurationService.loadProjectConfigurations({
|
|
1326
|
+
projects: a,
|
|
1327
|
+
workspaceConfigurationPath: i,
|
|
1328
|
+
workspaceRoot: t
|
|
1329
|
+
}), s = this.configurationService.resolveLimits({
|
|
1330
|
+
projectConfigurations: o,
|
|
1331
|
+
projects: a,
|
|
1332
|
+
workspaceAuthoredLimits: n.limits,
|
|
1333
|
+
workspaceConfiguration: r,
|
|
1334
|
+
workspaceConfigurationPath: i
|
|
1335
|
+
});
|
|
1336
|
+
return this.logger.info("🔭 Listed every project's limits", void 0, {
|
|
1337
|
+
declaringProjectCount: o.length,
|
|
1338
|
+
projectCount: a.length
|
|
1339
|
+
}), [...this.toWorkspaceRows({
|
|
1340
|
+
limits: s.workspace,
|
|
1341
|
+
workspaceRoot: t
|
|
1342
|
+
}), ...[...s.byProject].flatMap(([e, n]) => this.toProjectRows({
|
|
1343
|
+
limits: n,
|
|
1344
|
+
project: e,
|
|
1345
|
+
workspaceRoot: t
|
|
1346
|
+
}))];
|
|
1347
|
+
}
|
|
1348
|
+
};
|
|
1349
|
+
J = q = D([d(), E("design:paramtypes", [
|
|
1350
|
+
n === void 0 ? Object : n,
|
|
1351
|
+
_ === void 0 ? Object : _,
|
|
1352
|
+
x === void 0 ? Object : x,
|
|
1353
|
+
k === void 0 ? Object : k
|
|
1354
|
+
])], J);
|
|
1355
|
+
//#endregion
|
|
1356
|
+
//#region packages/ic-suite/callidescope/callidescope-cli/src/modules/limits/limits.constants.ts
|
|
1357
|
+
var Ve = [
|
|
1358
|
+
"Project",
|
|
1359
|
+
"Limit",
|
|
1360
|
+
"Value",
|
|
1361
|
+
"Declared in"
|
|
1362
|
+
], He = "# 🔭 Callidescope Limits", Ue = "Every project in scope, what it is judged against, and the file each number is written in — which is that project's own `callidescope.config.ts`, every traced project declaring a complete one. The `workspace` row is the starting point those files spread, and the numbers the directory holding this configuration is itself judged by.", We = "none", Ge = "workspace", Y = class {
|
|
1363
|
+
constructor() {}
|
|
1364
|
+
renderProject(e) {
|
|
1365
|
+
return e === void 0 ? Ge : e === "" ? "." : e;
|
|
1366
|
+
}
|
|
1367
|
+
renderRow(e) {
|
|
1368
|
+
return `| ${e.join(" | ")} |`;
|
|
1369
|
+
}
|
|
1370
|
+
renderTable(e) {
|
|
1371
|
+
return [
|
|
1372
|
+
this.renderRow(Ve),
|
|
1373
|
+
this.renderRow(Ve.map(() => "---")),
|
|
1374
|
+
...e.map((e) => this.renderRow([
|
|
1375
|
+
this.renderProject(e.project),
|
|
1376
|
+
`\`${e.limit}\``,
|
|
1377
|
+
e.value === void 0 ? We : String(e.value),
|
|
1378
|
+
e.path === void 0 ? "—" : `\`${e.path}\``
|
|
1379
|
+
]))
|
|
1380
|
+
].join("\n");
|
|
1381
|
+
}
|
|
1382
|
+
render(e) {
|
|
1383
|
+
return [
|
|
1384
|
+
He,
|
|
1385
|
+
"",
|
|
1386
|
+
Ue,
|
|
1387
|
+
"",
|
|
1388
|
+
this.renderTable(e)
|
|
1389
|
+
].join("\n");
|
|
1390
|
+
}
|
|
1391
|
+
};
|
|
1392
|
+
Y = D([d(), E("design:paramtypes", [])], Y);
|
|
1393
|
+
//#endregion
|
|
1394
|
+
//#region packages/ic-suite/callidescope/callidescope-cli/src/modules/limits/limits.command.ts
|
|
1395
|
+
var X, Z = X = class extends w {
|
|
1396
|
+
limitsService;
|
|
1397
|
+
renderLimitsService;
|
|
1398
|
+
configurationService;
|
|
1399
|
+
logger;
|
|
1400
|
+
constructor(e, t, n, r) {
|
|
1401
|
+
super(), this.limitsService = e, this.renderLimitsService = t, this.configurationService = n, this.logger = r, this.logger.setContext(X.name);
|
|
1402
|
+
}
|
|
1403
|
+
reject(e, t) {
|
|
1404
|
+
this.logger.error(e, void 0, t), process.exitCode = 1;
|
|
1405
|
+
}
|
|
1406
|
+
parseConfig(e) {
|
|
1407
|
+
return this.configurationService.parseOptionalOption(e);
|
|
1408
|
+
}
|
|
1409
|
+
async run(e, t = {}) {
|
|
1410
|
+
try {
|
|
1411
|
+
let e = await this.limitsService.list(t);
|
|
1412
|
+
process.stdout.write(`${this.renderLimitsService.render(e)}\n`);
|
|
1413
|
+
} catch (e) {
|
|
1414
|
+
let t = M(e);
|
|
1415
|
+
if (t === void 0 || !(e instanceof Error)) throw e;
|
|
1416
|
+
this.reject(t, { reason: e.message });
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
};
|
|
1420
|
+
D([
|
|
1421
|
+
T({
|
|
1422
|
+
description: "Path to a callidescope configuration file",
|
|
1423
|
+
flags: "--config [config]"
|
|
1424
|
+
}),
|
|
1425
|
+
E("design:type", Function),
|
|
1426
|
+
E("design:paramtypes", [Object]),
|
|
1427
|
+
E("design:returntype", Object)
|
|
1428
|
+
], Z.prototype, "parseConfig", null), Z = X = D([
|
|
1429
|
+
C({
|
|
1430
|
+
description: "List every project's resolved depth and breadth limits, and the file each came from",
|
|
1431
|
+
name: "limits"
|
|
1432
|
+
}),
|
|
1433
|
+
d(),
|
|
1434
|
+
E("design:paramtypes", [
|
|
1435
|
+
J === void 0 ? Object : J,
|
|
1436
|
+
Y === void 0 ? Object : Y,
|
|
1437
|
+
n === void 0 ? Object : n,
|
|
1438
|
+
k === void 0 ? Object : k
|
|
1439
|
+
])
|
|
1440
|
+
], Z);
|
|
1441
|
+
//#endregion
|
|
1442
|
+
//#region packages/ic-suite/callidescope/callidescope-cli/src/modules/limits/limits.module.ts
|
|
1443
|
+
var Q = class {};
|
|
1444
|
+
Q = D([f({
|
|
1445
|
+
controllers: [],
|
|
1446
|
+
exports: [Z, J],
|
|
1447
|
+
imports: [
|
|
1448
|
+
t,
|
|
1449
|
+
A,
|
|
1450
|
+
b
|
|
1451
|
+
],
|
|
1452
|
+
providers: [
|
|
1453
|
+
Z,
|
|
1454
|
+
J,
|
|
1455
|
+
Y
|
|
1456
|
+
]
|
|
1457
|
+
})], Q);
|
|
1458
|
+
//#endregion
|
|
1459
|
+
//#region packages/ic-suite/callidescope/callidescope-cli/src/main.module.ts
|
|
1460
|
+
var $ = class {};
|
|
1461
|
+
$ = D([f({ imports: [
|
|
1462
|
+
te.forRoot({
|
|
1463
|
+
envFilePath: ".env",
|
|
1464
|
+
isGlobal: !0,
|
|
1465
|
+
validate: (e) => Pe.parse(e)
|
|
1466
|
+
}),
|
|
1467
|
+
ne,
|
|
1468
|
+
A,
|
|
1469
|
+
U,
|
|
1470
|
+
R,
|
|
1471
|
+
K,
|
|
1472
|
+
Q,
|
|
1473
|
+
t
|
|
1474
|
+
] })], $);
|
|
1475
|
+
//#endregion
|
|
1476
|
+
export { F as a, R as i, B as n, k as o, z as r, $ as t };
|