@codometer/output 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 +573 -0
- package/dist/src/index.d.ts +1571 -0
- package/dist/src/index.js +1338 -0
- package/package.json +66 -0
|
@@ -0,0 +1,1338 @@
|
|
|
1
|
+
import { z as e } from "zod";
|
|
2
|
+
import { ConsoleLogger as t, Global as n, Injectable as r, Module as i, Scope as a } from "@nestjs/common";
|
|
3
|
+
import { existsSync as o, globSync as s, mkdirSync as c, readFileSync as l, writeFileSync as ee } from "node:fs";
|
|
4
|
+
import u from "node:path";
|
|
5
|
+
import d from "pino";
|
|
6
|
+
import { CONFIGURATION_FILE_NAMES as te, ConfigurationModule as ne, ConfigurationService as f, DEFAULT_EXCLUDE_GLOBS as re, DEFAULT_JSON_INDENTATION as p, DEFAULT_MARKDOWN_END_MARKER as ie, DEFAULT_MARKDOWN_START_MARKER as m, REPOSITORY_ROOT_MARKERS as ae } from "@codometer/configuration";
|
|
7
|
+
import { DiscoveryModule as oe, DiscoveryService as se } from "@codometer/measurement";
|
|
8
|
+
import { readFile as ce, writeFile as le } from "node:fs/promises";
|
|
9
|
+
//#region packages/ic-suite/codometer/codometer-output/src/modules/changes/changes.constants.ts
|
|
10
|
+
var h = [
|
|
11
|
+
"codometer-report.json",
|
|
12
|
+
"applications/*/codometer-report.json",
|
|
13
|
+
"packages/*/codometer-report.json",
|
|
14
|
+
"packages/*/*/*/codometer-report.json",
|
|
15
|
+
"tools/*/codometer-report.json"
|
|
16
|
+
], g = e.object({
|
|
17
|
+
failures: e.array(e.object({
|
|
18
|
+
kind: e.enum(["limit", "target"]),
|
|
19
|
+
reason: e.string(),
|
|
20
|
+
subject: e.string()
|
|
21
|
+
})).optional(),
|
|
22
|
+
targets: e.array(e.object({
|
|
23
|
+
empty: e.boolean(),
|
|
24
|
+
metrics: e.array(e.object({
|
|
25
|
+
limits: e.array(e.object({
|
|
26
|
+
breached: e.boolean(),
|
|
27
|
+
label: e.string().nullable(),
|
|
28
|
+
severity: e.enum(["fail", "warn"]),
|
|
29
|
+
value: e.number()
|
|
30
|
+
})),
|
|
31
|
+
name: e.string(),
|
|
32
|
+
unit: e.enum(["bytes"]).nullable(),
|
|
33
|
+
value: e.number()
|
|
34
|
+
})),
|
|
35
|
+
name: e.string()
|
|
36
|
+
}))
|
|
37
|
+
}), ue = /^(\p{Extended_Pictographic}️?(?:\p{Extended_Pictographic}️?)*)\s+/u, de = /^([A-Za-z]+)/, fe = /* @__PURE__ */ new Set([
|
|
38
|
+
"built",
|
|
39
|
+
"cut",
|
|
40
|
+
"found",
|
|
41
|
+
"got",
|
|
42
|
+
"kept",
|
|
43
|
+
"left",
|
|
44
|
+
"lost",
|
|
45
|
+
"made",
|
|
46
|
+
"put",
|
|
47
|
+
"ran",
|
|
48
|
+
"read",
|
|
49
|
+
"rebuilt",
|
|
50
|
+
"sent",
|
|
51
|
+
"set",
|
|
52
|
+
"split",
|
|
53
|
+
"took",
|
|
54
|
+
"wrote"
|
|
55
|
+
]), pe = /* @__PURE__ */ new Set([
|
|
56
|
+
"CommandFactory",
|
|
57
|
+
"ExceptionHandler",
|
|
58
|
+
"GraphQLModule",
|
|
59
|
+
"InstanceLoader",
|
|
60
|
+
"NestApplication",
|
|
61
|
+
"NestFactory",
|
|
62
|
+
"RouterExplorer",
|
|
63
|
+
"RoutesResolver",
|
|
64
|
+
"TypeOrmModule"
|
|
65
|
+
]);
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/decorateMetadata.js
|
|
68
|
+
function _(e, t) {
|
|
69
|
+
if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(e, t);
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/decorate.js
|
|
73
|
+
function v(e, t, n, r) {
|
|
74
|
+
var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
|
|
75
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
|
|
76
|
+
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);
|
|
77
|
+
return i > 3 && a && Object.defineProperty(t, n, a), a;
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region packages/logger/src/modules/logger/logger.service.ts
|
|
81
|
+
var y, b = class extends t {
|
|
82
|
+
static {
|
|
83
|
+
y = this;
|
|
84
|
+
}
|
|
85
|
+
constructor() {
|
|
86
|
+
super();
|
|
87
|
+
}
|
|
88
|
+
static isProduction = process.env.NODE_ENV === "production";
|
|
89
|
+
static rootLogger;
|
|
90
|
+
static writesToStandardError = !1;
|
|
91
|
+
child = y.root;
|
|
92
|
+
static createRootLogger() {
|
|
93
|
+
let e = process.env.LOG_LEVEL ?? "info";
|
|
94
|
+
return y.isProduction ? y.writesToStandardError ? d({ level: e }, d.destination(2)) : d({ level: e }) : d({
|
|
95
|
+
level: e,
|
|
96
|
+
transport: {
|
|
97
|
+
options: {
|
|
98
|
+
colorize: !0,
|
|
99
|
+
destination: y.writesToStandardError ? 2 : 1,
|
|
100
|
+
ignore: "pid,hostname,emoji",
|
|
101
|
+
messageFormat: "{emoji} {msg}",
|
|
102
|
+
singleLine: !0
|
|
103
|
+
},
|
|
104
|
+
target: "pino-pretty"
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
static logToStandardError() {
|
|
109
|
+
if (y.rootLogger !== void 0) {
|
|
110
|
+
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.");
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
y.writesToStandardError = !0;
|
|
114
|
+
}
|
|
115
|
+
assertConventionalMessage(e) {
|
|
116
|
+
if (y.isProduction || this.shouldSkipConventionalMessageValidation(e.context)) return;
|
|
117
|
+
let t = this.getConventionalMessageViolation(e.parsed);
|
|
118
|
+
if (t !== void 0) throw Error(t);
|
|
119
|
+
}
|
|
120
|
+
buildBindings(e) {
|
|
121
|
+
return this.assertConventionalMessage({
|
|
122
|
+
context: e.context,
|
|
123
|
+
parsed: e.parsed
|
|
124
|
+
}), {
|
|
125
|
+
...e.data,
|
|
126
|
+
context: e.context,
|
|
127
|
+
...y.isProduction ? {} : { emoji: e.parsed.emoji }
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
getConventionalMessageViolation(e) {
|
|
131
|
+
let t = e.emoji, n = e.text;
|
|
132
|
+
if (t === void 0) return `Log message must start with an emoji naming its subject, then a verb: "${n}"`;
|
|
133
|
+
let r = de.exec(n)?.[1];
|
|
134
|
+
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}"`;
|
|
135
|
+
}
|
|
136
|
+
isConventionalVerb(e) {
|
|
137
|
+
let t = e.toLowerCase();
|
|
138
|
+
return t.endsWith("ing") || t.endsWith("ed") || fe.has(t);
|
|
139
|
+
}
|
|
140
|
+
parseMessage(e) {
|
|
141
|
+
let t = String(e), n = ue.exec(t), r = n?.[1];
|
|
142
|
+
return r === void 0 ? {
|
|
143
|
+
emoji: void 0,
|
|
144
|
+
text: t
|
|
145
|
+
} : {
|
|
146
|
+
emoji: r,
|
|
147
|
+
text: t.slice(n?.[0].length)
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
shouldSkipConventionalMessageValidation(e) {
|
|
151
|
+
return e !== void 0 && pe.has(e);
|
|
152
|
+
}
|
|
153
|
+
static get root() {
|
|
154
|
+
return y.rootLogger ??= y.createRootLogger(), y.rootLogger;
|
|
155
|
+
}
|
|
156
|
+
buildErrorLogEntry(e, t) {
|
|
157
|
+
let n = t instanceof Error ? t.stack || t.message : String(t);
|
|
158
|
+
return {
|
|
159
|
+
errorMessage: n,
|
|
160
|
+
logLine: `[${(/* @__PURE__ */ new Date()).toISOString()}] ${e}: ${n}\n`
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
createTimestampedOutputLogFilePath(e) {
|
|
164
|
+
let t = u.join(process.cwd(), "output");
|
|
165
|
+
return o(t) || c(t, { recursive: !0 }), u.join(t, `${e}-${(/* @__PURE__ */ new Date()).toISOString().replaceAll(/[:.]/g, "-")}.log`);
|
|
166
|
+
}
|
|
167
|
+
debug(e, t, n) {
|
|
168
|
+
let r = this.parseMessage(e);
|
|
169
|
+
this.child.debug(this.buildBindings({
|
|
170
|
+
context: t ?? this.context,
|
|
171
|
+
data: n,
|
|
172
|
+
parsed: r
|
|
173
|
+
}), r.text);
|
|
174
|
+
}
|
|
175
|
+
error(e, t, n) {
|
|
176
|
+
let r = this.parseMessage(e), i = typeof n == "object" ? n : void 0, a = typeof n == "string" ? n : this.context;
|
|
177
|
+
this.child.error({
|
|
178
|
+
...this.buildBindings({
|
|
179
|
+
context: a,
|
|
180
|
+
data: i,
|
|
181
|
+
parsed: r
|
|
182
|
+
}),
|
|
183
|
+
stack: t
|
|
184
|
+
}, r.text);
|
|
185
|
+
}
|
|
186
|
+
info(e, t, n) {
|
|
187
|
+
let r = this.parseMessage(e);
|
|
188
|
+
this.child.info(this.buildBindings({
|
|
189
|
+
context: t ?? this.context,
|
|
190
|
+
data: n,
|
|
191
|
+
parsed: r
|
|
192
|
+
}), r.text);
|
|
193
|
+
}
|
|
194
|
+
log(e, t, n) {
|
|
195
|
+
this.info(e, t, n);
|
|
196
|
+
}
|
|
197
|
+
setContext(e) {
|
|
198
|
+
super.setContext(e), this.child = y.root.child({ context: e });
|
|
199
|
+
}
|
|
200
|
+
verbose(e, t, n) {
|
|
201
|
+
let r = this.parseMessage(e);
|
|
202
|
+
this.child.trace(this.buildBindings({
|
|
203
|
+
context: t ?? this.context,
|
|
204
|
+
data: n,
|
|
205
|
+
parsed: r
|
|
206
|
+
}), r.text);
|
|
207
|
+
}
|
|
208
|
+
warn(e, t, n) {
|
|
209
|
+
let r = this.parseMessage(e);
|
|
210
|
+
this.child.warn(this.buildBindings({
|
|
211
|
+
context: t ?? this.context,
|
|
212
|
+
data: n,
|
|
213
|
+
parsed: r
|
|
214
|
+
}), r.text);
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
b = y = v([r({ scope: a.TRANSIENT }), _("design:paramtypes", [])], b);
|
|
218
|
+
//#endregion
|
|
219
|
+
//#region packages/logger/src/modules/logger/logger.module.ts
|
|
220
|
+
var x = class {};
|
|
221
|
+
x = v([n(), i({
|
|
222
|
+
controllers: [],
|
|
223
|
+
exports: [b],
|
|
224
|
+
imports: [],
|
|
225
|
+
providers: [b]
|
|
226
|
+
})], x);
|
|
227
|
+
//#endregion
|
|
228
|
+
//#region packages/ic-suite/codometer/codometer-output/src/modules/changes/changes.service.ts
|
|
229
|
+
var S, C = S = class {
|
|
230
|
+
logger;
|
|
231
|
+
constructor(e) {
|
|
232
|
+
this.logger = e, this.logger.setContext(S.name);
|
|
233
|
+
}
|
|
234
|
+
buildBaselineRow(e, t, n) {
|
|
235
|
+
return {
|
|
236
|
+
...e,
|
|
237
|
+
baseValue: e.value,
|
|
238
|
+
breach: void 0,
|
|
239
|
+
empty: !1,
|
|
240
|
+
measured: !1,
|
|
241
|
+
project: t,
|
|
242
|
+
removed: n,
|
|
243
|
+
value: n ? 0 : e.value
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
buildMeasuredRow(e, t, n) {
|
|
247
|
+
return {
|
|
248
|
+
...e,
|
|
249
|
+
baseValue: t?.value,
|
|
250
|
+
measured: !0,
|
|
251
|
+
project: n,
|
|
252
|
+
removed: !1
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
collectProjectRows(e) {
|
|
256
|
+
let t = this.readProjectName(e.reportPath), n = this.readBaseline(e), { failures: r, metrics: i } = this.readReport(e.workingDirectory, e.reportPath), a = i.map((e) => this.buildMeasuredRow(e, n.get(e.name), t)), o = new Set(a.map((e) => e.name));
|
|
257
|
+
for (let [e, r] of n) o.has(e) || a.push(this.buildBaselineRow(r, t, i.length > 0));
|
|
258
|
+
return {
|
|
259
|
+
failures: r.map((e) => ({
|
|
260
|
+
...e,
|
|
261
|
+
project: t
|
|
262
|
+
})),
|
|
263
|
+
rows: a
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
parseReport(e, t) {
|
|
267
|
+
try {
|
|
268
|
+
let n = g.safeParse(JSON.parse(l(u.join(e, t), "utf8")));
|
|
269
|
+
return n.success ? n.data : void 0;
|
|
270
|
+
} catch {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
readBaseline(e) {
|
|
275
|
+
if (e.baselineDirectory === void 0) return /* @__PURE__ */ new Map();
|
|
276
|
+
let { metrics: t } = this.readReport(e.workingDirectory, u.join(e.baselineDirectory, e.reportPath));
|
|
277
|
+
return new Map(t.map((e) => [e.name, e]));
|
|
278
|
+
}
|
|
279
|
+
readBreach(e) {
|
|
280
|
+
let t = e.filter((e) => e.breached);
|
|
281
|
+
if (t.length !== 0) return t.some((e) => e.severity === "fail") ? "fail" : "warn";
|
|
282
|
+
}
|
|
283
|
+
readGoverningLimit(e) {
|
|
284
|
+
let t = e.filter((e) => e.severity === "fail"), n = (t.length > 0 ? t : e).map((e) => e.value);
|
|
285
|
+
return n.length === 0 ? void 0 : Math.min(...n);
|
|
286
|
+
}
|
|
287
|
+
readLabel(e) {
|
|
288
|
+
return e.find((e) => e.label !== null)?.label ?? void 0;
|
|
289
|
+
}
|
|
290
|
+
readMetrics(e) {
|
|
291
|
+
return e.metrics.map((t) => ({
|
|
292
|
+
breach: this.readBreach(t.limits),
|
|
293
|
+
empty: e.empty,
|
|
294
|
+
label: this.readLabel(t.limits) ?? t.name,
|
|
295
|
+
limit: this.readGoverningLimit(t.limits),
|
|
296
|
+
name: t.name,
|
|
297
|
+
unit: t.unit,
|
|
298
|
+
value: t.value
|
|
299
|
+
}));
|
|
300
|
+
}
|
|
301
|
+
readProjectName(e) {
|
|
302
|
+
let t = u.dirname(e);
|
|
303
|
+
return t === "." || t === "" ? "codebase" : u.basename(t);
|
|
304
|
+
}
|
|
305
|
+
readReport(e, t) {
|
|
306
|
+
let n = this.parseReport(e, t);
|
|
307
|
+
return n === void 0 ? (this.logger.warn("⚠️ Skipped an unreadable codometer report", void 0, {
|
|
308
|
+
reportPath: t,
|
|
309
|
+
workingDirectory: e
|
|
310
|
+
}), {
|
|
311
|
+
failures: [],
|
|
312
|
+
metrics: []
|
|
313
|
+
}) : {
|
|
314
|
+
failures: n.failures ?? [],
|
|
315
|
+
metrics: n.targets.flatMap((e) => this.readMetrics(e))
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
readReportPaths(e) {
|
|
319
|
+
let { baselineDirectory: t, workingDirectory: n } = e, r = h.flatMap((e) => s(e, { cwd: n })), i = t === void 0 ? [] : h.flatMap((e) => s(u.join(t, e), { cwd: n })).map((e) => u.relative(t, e));
|
|
320
|
+
return this.logger.debug("📂 Found the codometer reports", void 0, {
|
|
321
|
+
baseline: i.length,
|
|
322
|
+
current: r.length
|
|
323
|
+
}), [.../* @__PURE__ */ new Set([...r, ...i])].toSorted();
|
|
324
|
+
}
|
|
325
|
+
collect(e) {
|
|
326
|
+
let t = this.readReportPaths(e).map((t) => this.collectProjectRows({
|
|
327
|
+
...e,
|
|
328
|
+
reportPath: t
|
|
329
|
+
}));
|
|
330
|
+
return {
|
|
331
|
+
failures: t.flatMap((e) => e.failures),
|
|
332
|
+
rows: t.flatMap((e) => e.rows)
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
C = S = v([r(), _("design:paramtypes", [b === void 0 ? Object : b])], C);
|
|
337
|
+
//#endregion
|
|
338
|
+
//#region packages/ic-suite/codometer/codometer-output/src/modules/changes/changes.module.ts
|
|
339
|
+
var w = class {};
|
|
340
|
+
w = v([i({
|
|
341
|
+
controllers: [],
|
|
342
|
+
exports: [C],
|
|
343
|
+
imports: [x],
|
|
344
|
+
providers: [C]
|
|
345
|
+
})], w);
|
|
346
|
+
//#endregion
|
|
347
|
+
//#region packages/ic-suite/codometer/codometer-output/src/modules/configuration-listing/configuration-listing.constants.ts
|
|
348
|
+
var me = "—", T = "# 🔧 Codometer Configuration", E = [
|
|
349
|
+
"Directory",
|
|
350
|
+
"Metric",
|
|
351
|
+
"Label",
|
|
352
|
+
"Severity",
|
|
353
|
+
"Value",
|
|
354
|
+
"Declared in"
|
|
355
|
+
], he = ".size";
|
|
356
|
+
//#endregion
|
|
357
|
+
//#region packages/ic-suite/codometer/codometer-output/src/modules/render/render.utilities.ts
|
|
358
|
+
function D(e) {
|
|
359
|
+
return Math.abs(e) >= 1e6 ? `${(e / 1e6).toFixed(2)} MB` : `${(e / 1e3).toFixed(2)} kB`;
|
|
360
|
+
}
|
|
361
|
+
function O(e) {
|
|
362
|
+
return e.toLocaleString();
|
|
363
|
+
}
|
|
364
|
+
function ge(e, t) {
|
|
365
|
+
if (e === void 0) return "—";
|
|
366
|
+
let n = k(e, t);
|
|
367
|
+
return e >= 0 ? `+${n}` : n;
|
|
368
|
+
}
|
|
369
|
+
function k(e, t) {
|
|
370
|
+
return t === "bytes" ? D(e) : O(e);
|
|
371
|
+
}
|
|
372
|
+
function _e(e) {
|
|
373
|
+
return e.breach === void 0 ? e.baseValue === void 0 ? e.value !== 0 || e.empty : e.value !== e.baseValue : !0;
|
|
374
|
+
}
|
|
375
|
+
//#endregion
|
|
376
|
+
//#region packages/ic-suite/codometer/codometer-output/src/modules/configuration-listing/configuration-listing.service.ts
|
|
377
|
+
var A = class {
|
|
378
|
+
configurationService;
|
|
379
|
+
discoveryService;
|
|
380
|
+
constructor(e, t) {
|
|
381
|
+
this.configurationService = e, this.discoveryService = t;
|
|
382
|
+
}
|
|
383
|
+
configurationFileNames = new Set(te);
|
|
384
|
+
async describeConfiguration(e) {
|
|
385
|
+
try {
|
|
386
|
+
let { configuration: t } = await this.configurationService.loadConfigurationFile({
|
|
387
|
+
configurationPath: u.resolve(e.workingDirectory, e.file),
|
|
388
|
+
searchDirectory: u.resolve(e.workingDirectory, e.directory)
|
|
389
|
+
});
|
|
390
|
+
return {
|
|
391
|
+
configuration: t,
|
|
392
|
+
directory: e.directory,
|
|
393
|
+
error: void 0,
|
|
394
|
+
path: e.file
|
|
395
|
+
};
|
|
396
|
+
} catch (t) {
|
|
397
|
+
return {
|
|
398
|
+
configuration: void 0,
|
|
399
|
+
directory: e.directory,
|
|
400
|
+
error: t instanceof Error ? t.message : String(t),
|
|
401
|
+
path: e.file
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
formatLimitValue(e, t) {
|
|
406
|
+
return e.endsWith(".size") ? D(t) : O(t);
|
|
407
|
+
}
|
|
408
|
+
async resolveWalkExclusions(e) {
|
|
409
|
+
try {
|
|
410
|
+
let { configuration: t } = await this.configurationService.loadConfigurationFile({
|
|
411
|
+
configurationPath: e.configurationPath,
|
|
412
|
+
searchDirectory: e.workingDirectory
|
|
413
|
+
});
|
|
414
|
+
return {
|
|
415
|
+
error: void 0,
|
|
416
|
+
exclude: t.exclude,
|
|
417
|
+
excludeFrom: t.excludeFrom
|
|
418
|
+
};
|
|
419
|
+
} catch (e) {
|
|
420
|
+
return {
|
|
421
|
+
error: e instanceof Error ? e.message : String(e),
|
|
422
|
+
exclude: [...re],
|
|
423
|
+
excludeFrom: []
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
async describeConfigurations(e) {
|
|
428
|
+
let { files: t, rootError: n } = await this.findConfigurationFiles(e), r = [];
|
|
429
|
+
for (let n of t) r.push(await this.describeConfiguration({
|
|
430
|
+
directory: u.dirname(n),
|
|
431
|
+
file: n,
|
|
432
|
+
workingDirectory: e.workingDirectory
|
|
433
|
+
}));
|
|
434
|
+
return {
|
|
435
|
+
described: r,
|
|
436
|
+
rootError: n
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
async findConfigurationFiles(e) {
|
|
440
|
+
let t = await this.resolveWalkExclusions(e), { files: n } = this.discoveryService.discoverFiles({
|
|
441
|
+
exclude: t.exclude,
|
|
442
|
+
excludeFrom: t.excludeFrom,
|
|
443
|
+
workingDirectory: e.workingDirectory
|
|
444
|
+
});
|
|
445
|
+
return {
|
|
446
|
+
files: n.filter((e) => this.configurationFileNames.has(u.basename(e))).toSorted((e, t) => e.localeCompare(t)),
|
|
447
|
+
rootError: t.error
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
toLimitRows(e) {
|
|
451
|
+
return e.flatMap((e) => (e.configuration?.limits ?? []).map((t) => ({
|
|
452
|
+
directory: e.directory,
|
|
453
|
+
label: t.label ?? "—",
|
|
454
|
+
metric: t.metric,
|
|
455
|
+
path: e.path,
|
|
456
|
+
severity: t.severity,
|
|
457
|
+
value: this.formatLimitValue(t.metric, t.value)
|
|
458
|
+
})));
|
|
459
|
+
}
|
|
460
|
+
};
|
|
461
|
+
A = v([r(), _("design:paramtypes", [f === void 0 ? Object : f, se === void 0 ? Object : se])], A);
|
|
462
|
+
//#endregion
|
|
463
|
+
//#region packages/ic-suite/codometer/codometer-output/src/modules/configuration-listing/render-configuration.service.ts
|
|
464
|
+
var j = class {
|
|
465
|
+
constructor() {}
|
|
466
|
+
renderDirectory(e) {
|
|
467
|
+
let { configuration: t } = e;
|
|
468
|
+
return t === void 0 ? [
|
|
469
|
+
`## ${e.directory}`,
|
|
470
|
+
"",
|
|
471
|
+
`Declared in \`${e.path}\`.`,
|
|
472
|
+
"",
|
|
473
|
+
`- ⚠️ Could not be read: ${e.error ?? "unknown error"}`
|
|
474
|
+
].join("\n") : [
|
|
475
|
+
`## ${e.directory}`,
|
|
476
|
+
"",
|
|
477
|
+
`Declared in \`${e.path}\`.`,
|
|
478
|
+
"",
|
|
479
|
+
`- Inputs: ${this.renderNames(t.inputs.map((e) => e.name))}`,
|
|
480
|
+
`- Limits: ${String(t.limits.length)}`,
|
|
481
|
+
`- Custom statistics: ${this.renderNames(t.custom.map((e) => e.label))}`,
|
|
482
|
+
`- Python command: \`${t.python.command}\``,
|
|
483
|
+
`- Excluded globs: ${String(t.exclude.length)}`,
|
|
484
|
+
`- Exclude files: ${this.renderNames(t.excludeFrom)}`
|
|
485
|
+
].join("\n");
|
|
486
|
+
}
|
|
487
|
+
renderLimitsTable(e) {
|
|
488
|
+
return e.length === 0 ? "No limits are configured." : [
|
|
489
|
+
this.renderRow(E),
|
|
490
|
+
this.renderRow(E.map(() => "---")),
|
|
491
|
+
...e.map((e) => this.renderRow([
|
|
492
|
+
e.directory,
|
|
493
|
+
`\`${e.metric}\``,
|
|
494
|
+
e.label,
|
|
495
|
+
e.severity,
|
|
496
|
+
e.value,
|
|
497
|
+
`\`${e.path}\``
|
|
498
|
+
]))
|
|
499
|
+
].join("\n");
|
|
500
|
+
}
|
|
501
|
+
renderNames(e) {
|
|
502
|
+
return e.length === 0 ? "—" : e.join(", ");
|
|
503
|
+
}
|
|
504
|
+
renderRootError(e) {
|
|
505
|
+
return e === void 0 ? [] : [`- ⚠️ Nothing answered for the walk root, so the built-in exclusions were used instead: ${e}`, ""];
|
|
506
|
+
}
|
|
507
|
+
renderRow(e) {
|
|
508
|
+
return `| ${e.join(" | ")} |`;
|
|
509
|
+
}
|
|
510
|
+
render(e) {
|
|
511
|
+
return e.format === "json" ? JSON.stringify(e.limitsOnly ? {
|
|
512
|
+
limits: e.limitRows,
|
|
513
|
+
rootError: e.rootError ?? null
|
|
514
|
+
} : {
|
|
515
|
+
configurations: e.described,
|
|
516
|
+
rootError: e.rootError ?? null
|
|
517
|
+
}, void 0, 2) : e.limitsOnly ? [
|
|
518
|
+
`${T}: Limits`,
|
|
519
|
+
"",
|
|
520
|
+
...this.renderRootError(e.rootError),
|
|
521
|
+
this.renderLimitsTable(e.limitRows)
|
|
522
|
+
].join("\n") : [
|
|
523
|
+
T,
|
|
524
|
+
"",
|
|
525
|
+
...this.renderRootError(e.rootError),
|
|
526
|
+
...e.described.map((e) => this.renderDirectory(e)),
|
|
527
|
+
"",
|
|
528
|
+
`${T}: Limits`.replace("# 🔧", "## 🔧"),
|
|
529
|
+
"",
|
|
530
|
+
this.renderLimitsTable(e.limitRows)
|
|
531
|
+
].join("\n");
|
|
532
|
+
}
|
|
533
|
+
};
|
|
534
|
+
j = v([r(), _("design:paramtypes", [])], j);
|
|
535
|
+
//#endregion
|
|
536
|
+
//#region packages/ic-suite/codometer/codometer-output/src/modules/configuration-listing/configuration-listing.module.ts
|
|
537
|
+
var M = class {};
|
|
538
|
+
M = v([i({
|
|
539
|
+
controllers: [],
|
|
540
|
+
exports: [A, j],
|
|
541
|
+
imports: [ne, oe],
|
|
542
|
+
providers: [A, j]
|
|
543
|
+
})], M);
|
|
544
|
+
//#endregion
|
|
545
|
+
//#region packages/ic-suite/codometer/codometer-output/src/modules/json/json.service.ts
|
|
546
|
+
var N, P = N = class {
|
|
547
|
+
logger;
|
|
548
|
+
constructor(e) {
|
|
549
|
+
this.logger = e, this.logger.setContext(N.name);
|
|
550
|
+
}
|
|
551
|
+
readExisting(e) {
|
|
552
|
+
try {
|
|
553
|
+
return l(u.resolve(e), "utf8");
|
|
554
|
+
} catch {
|
|
555
|
+
return "";
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
render(e) {
|
|
559
|
+
return `${JSON.stringify(e.report, null, e.indentation)}\n`;
|
|
560
|
+
}
|
|
561
|
+
sync(e) {
|
|
562
|
+
let t = u.resolve(e.path), n = this.render(e);
|
|
563
|
+
return e.check ? this.readExisting(t) === n : (c(u.dirname(t), { recursive: !0 }), ee(t, n, "utf8"), this.logger.info("📝 Wrote the JSON report", void 0, { path: t }), !0);
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
P = N = v([r(), _("design:paramtypes", [b === void 0 ? Object : b])], P);
|
|
567
|
+
//#endregion
|
|
568
|
+
//#region packages/ic-suite/codometer/codometer-output/src/modules/json/json.module.ts
|
|
569
|
+
var F = class {};
|
|
570
|
+
F = v([i({
|
|
571
|
+
controllers: [],
|
|
572
|
+
exports: [P],
|
|
573
|
+
imports: [x],
|
|
574
|
+
providers: [P]
|
|
575
|
+
})], F);
|
|
576
|
+
//#endregion
|
|
577
|
+
//#region packages/ic-suite/codometer/codometer-output/src/modules/markdown/markdown.constants.ts
|
|
578
|
+
var ve = "## ⏲️ Codometer", ye = /[.*+?^${}()|[\]\\]/g, be = /\n+$/, I = class extends Error {
|
|
579
|
+
constructor() {
|
|
580
|
+
super("No markdown path to write to. Set output.markdown.path, pass --markdown, or give syncAnchoredBlock a path of its own."), this.name = "MissingMarkdownPathError";
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
//#endregion
|
|
584
|
+
//#region packages/ic-suite/codometer/codometer-output/src/modules/markdown/markdown.utilities.ts
|
|
585
|
+
function L(e, t, n) {
|
|
586
|
+
return `}-${Le(t)}-${n}?style=flat-square)`;
|
|
587
|
+
}
|
|
588
|
+
function xe(e) {
|
|
589
|
+
let { css: t } = e;
|
|
590
|
+
return z("CSS", [
|
|
591
|
+
L("CSS Files", t.files, "264de4"),
|
|
592
|
+
L("CSS Lines", t.lines, "2965f1"),
|
|
593
|
+
L("CSS Rules", t.rules, "7c3aed"),
|
|
594
|
+
L("CSS Selectors", t.selectors, "8b5cf6"),
|
|
595
|
+
L("CSS Declarations", t.declarations, "0284c7"),
|
|
596
|
+
L("CSS At Rules", t.atRules, "f97316"),
|
|
597
|
+
L("CSS Media Queries", t.mediaQueries, "ea580c"),
|
|
598
|
+
L("CSS Custom Properties", t.customProperties, "16a34a"),
|
|
599
|
+
L("CSS Comments", t.comments, "64748b"),
|
|
600
|
+
...R(e, "css")
|
|
601
|
+
]);
|
|
602
|
+
}
|
|
603
|
+
function R(e, t) {
|
|
604
|
+
return e.custom.filter((e) => e.group === t).map((e) => L(e.label, e.count, e.color));
|
|
605
|
+
}
|
|
606
|
+
function Se(e) {
|
|
607
|
+
let t = R(e, "conventions");
|
|
608
|
+
return t.length === 0 ? "" : z("Conventions", t);
|
|
609
|
+
}
|
|
610
|
+
function Ce(e) {
|
|
611
|
+
return e.custom.filter((e) => (e.instances?.length ?? 0) > 0).map((e) => {
|
|
612
|
+
let t = (e.instances ?? []).map((e) => `- \`${e.file}:${e.line}\` — measured ${e.measured}`);
|
|
613
|
+
return z(`📝 ${e.label}`, t);
|
|
614
|
+
}).join("\n\n");
|
|
615
|
+
}
|
|
616
|
+
function z(e, t) {
|
|
617
|
+
return `### ${e}\n\n${t.join("\n")}`;
|
|
618
|
+
}
|
|
619
|
+
function we(e) {
|
|
620
|
+
let { hcl: t } = e;
|
|
621
|
+
return z("HCL", [
|
|
622
|
+
L("HCL Files", t.files, "844fba"),
|
|
623
|
+
L("HCL Lines", t.lines, "a78bfa"),
|
|
624
|
+
L("HCL Blocks", t.blocks, "7c3aed"),
|
|
625
|
+
L("HCL Resources", t.resources, "0284c7"),
|
|
626
|
+
L("HCL Variables", t.variables, "16a34a"),
|
|
627
|
+
L("HCL Outputs", t.outputs, "059669"),
|
|
628
|
+
L("HCL Attributes", t.attributes, "0ea5e9"),
|
|
629
|
+
L("HCL Interpolations", t.interpolations, "db2777"),
|
|
630
|
+
L("HCL Comments", t.comments, "64748b"),
|
|
631
|
+
...R(e, "hcl")
|
|
632
|
+
]);
|
|
633
|
+
}
|
|
634
|
+
function Te(e) {
|
|
635
|
+
let { javascript: t } = e;
|
|
636
|
+
return z("JavaScript", [
|
|
637
|
+
L("JavaScript Files", t.files, "f7df1e"),
|
|
638
|
+
L("Test Files", t.testFiles, "10b981"),
|
|
639
|
+
L("External Packages", t.externalPackages, "8b5cf6"),
|
|
640
|
+
L("Classes", t.classes, "7c3aed"),
|
|
641
|
+
L("Functions", t.functions, "16a34a"),
|
|
642
|
+
L("Methods", t.methods, "15803d"),
|
|
643
|
+
L("Sync Functions", t.syncFunctions, "4ade80"),
|
|
644
|
+
L("Async Functions", t.asyncFunctions, "059669"),
|
|
645
|
+
L("Constants", t.constants, "dc2626"),
|
|
646
|
+
L("Imports", t.imports, "0284c7"),
|
|
647
|
+
L("Exported Symbols", t.exported, "ea580c"),
|
|
648
|
+
L("Comments", t.comments, "64748b"),
|
|
649
|
+
L("Comment Lines", t.commentLines, "475569"),
|
|
650
|
+
L("TODO Comments", t.todos, "ca8a04")
|
|
651
|
+
]);
|
|
652
|
+
}
|
|
653
|
+
function Ee(e) {
|
|
654
|
+
let { json: t } = e;
|
|
655
|
+
return z("JSON", [
|
|
656
|
+
L("JSON Files", t.files, "a16207"),
|
|
657
|
+
L("JSON Lines", t.lines, "ca8a04"),
|
|
658
|
+
L("JSON Objects", t.objects, "7c3aed"),
|
|
659
|
+
L("JSON Arrays", t.arrays, "8b5cf6"),
|
|
660
|
+
L("JSON Properties", t.properties, "0284c7"),
|
|
661
|
+
L("JSON Strings", t.strings, "16a34a"),
|
|
662
|
+
L("JSON Numbers", t.numbers, "059669"),
|
|
663
|
+
L("JSON Booleans", t.booleans, "0ea5e9"),
|
|
664
|
+
L("JSON Nulls", t.nulls, "64748b"),
|
|
665
|
+
L("JSON Items", t.items, "475569"),
|
|
666
|
+
L("JSON Nodes", t.totalNodes, "dc2626"),
|
|
667
|
+
L("JSON Max Depth", t.maxDepth, "ea580c"),
|
|
668
|
+
...R(e, "json")
|
|
669
|
+
]);
|
|
670
|
+
}
|
|
671
|
+
function De(e) {
|
|
672
|
+
let { jupyter: t } = e;
|
|
673
|
+
return z("Jupyter", [
|
|
674
|
+
L("Notebooks", t.files, "f37626"),
|
|
675
|
+
L("Notebook Cells", t.cells, "e8a33d"),
|
|
676
|
+
L("Code Cells", t.codeCells, "3776ab"),
|
|
677
|
+
L("Markdown Cells", t.markdownCells, "083fa1"),
|
|
678
|
+
L("Raw Cells", t.rawCells, "9ca3af"),
|
|
679
|
+
L("Executed Cells", t.executedCells, "16a34a"),
|
|
680
|
+
L("Cell Outputs", t.outputs, "059669"),
|
|
681
|
+
L("Notebook Code Lines", t.codeLines, "4b8bbe"),
|
|
682
|
+
L("Notebook Classes", t.classes, "7c3aed"),
|
|
683
|
+
L("Notebook Functions", t.functions, "22c55e"),
|
|
684
|
+
L("Notebook Imports", t.imports, "0284c7"),
|
|
685
|
+
L("Notebook Decorators", t.decorators, "db2777"),
|
|
686
|
+
L("Notebook Prose Lines", t.markdownLines, "1f6feb"),
|
|
687
|
+
L("Notebook Headings", t.headings, "a78bfa"),
|
|
688
|
+
L("Notebook Links", t.links, "10b981"),
|
|
689
|
+
L("Notebook Images", t.images, "34d399"),
|
|
690
|
+
L("Notebook Code Blocks", t.codeBlocks, "dc2626"),
|
|
691
|
+
L("Notebook Properties", t.properties, "ca8a04"),
|
|
692
|
+
L("Notebook Nodes", t.totalNodes, "a16207"),
|
|
693
|
+
L("Notebook Max Depth", t.maxDepth, "ea580c"),
|
|
694
|
+
...R(e, "jupyter")
|
|
695
|
+
]);
|
|
696
|
+
}
|
|
697
|
+
function Oe(e) {
|
|
698
|
+
let { markdown: t } = e;
|
|
699
|
+
return z("Markdown", [
|
|
700
|
+
L("Markdown Files", t.files, "083fa1"),
|
|
701
|
+
L("Markdown Lines", t.lines, "1f6feb"),
|
|
702
|
+
L("H1", t.headingLevel1, "7c3aed"),
|
|
703
|
+
L("H2", t.headingLevel2, "8b5cf6"),
|
|
704
|
+
L("H3", t.headingLevel3, "a78bfa"),
|
|
705
|
+
L("H4", t.headingLevel4, "c4b5fd"),
|
|
706
|
+
L("H5", t.headingLevel5, "ddd6fe"),
|
|
707
|
+
L("H6", t.headingLevel6, "ede9fe"),
|
|
708
|
+
L("Paragraphs", t.paragraphs, "64748b"),
|
|
709
|
+
L("Lists", t.lists, "16a34a"),
|
|
710
|
+
L("List Items", t.listItems, "22c55e"),
|
|
711
|
+
L("Task List Items", t.taskListItems, "4ade80"),
|
|
712
|
+
L("Tables", t.tables, "0284c7"),
|
|
713
|
+
L("Table Rows", t.tableRows, "0ea5e9"),
|
|
714
|
+
L("Links", t.links, "059669"),
|
|
715
|
+
L("Images", t.images, "10b981"),
|
|
716
|
+
L("Code Blocks", t.codeBlocks, "dc2626"),
|
|
717
|
+
L("Inline Code", t.inlineCode, "ef4444"),
|
|
718
|
+
L("Block Quotes", t.blockQuotes, "ca8a04"),
|
|
719
|
+
L("Thematic Breaks", t.thematicBreaks, "a16207"),
|
|
720
|
+
...R(e, "markdown")
|
|
721
|
+
]);
|
|
722
|
+
}
|
|
723
|
+
function ke(e) {
|
|
724
|
+
let { python: t } = e;
|
|
725
|
+
return z("Python", [
|
|
726
|
+
L("Python Files", t.files, "3776ab"),
|
|
727
|
+
L("Python Lines", t.lines, "4b8bbe"),
|
|
728
|
+
L("Python Classes", t.classes, "7c3aed"),
|
|
729
|
+
L("Python Functions", t.functions, "16a34a"),
|
|
730
|
+
L("Python Protocols", t.protocols, "0ea5e9"),
|
|
731
|
+
L("Python Constants", t.constants, "dc2626"),
|
|
732
|
+
L("Python Imports", t.imports, "0284c7"),
|
|
733
|
+
L("Python Decorators", t.decorators, "db2777"),
|
|
734
|
+
L("Docstrings", t.docstrings, "6366f1"),
|
|
735
|
+
L("Docstring Lines", t.docstringLines, "818cf8"),
|
|
736
|
+
L("Python Comments", t.comments, "64748b"),
|
|
737
|
+
L("Python Comment Lines", t.commentLines, "475569"),
|
|
738
|
+
...R(e, "python")
|
|
739
|
+
]);
|
|
740
|
+
}
|
|
741
|
+
function Ae(e, t) {
|
|
742
|
+
return z(t === "repository" ? "Repository" : "Project", [
|
|
743
|
+
L("Lines of Code", e.linesOfCode, "22c55e"),
|
|
744
|
+
L("Repository Size", D(e.repositoryBytes), "6b7280"),
|
|
745
|
+
L("Folders", e.folders, "4a4a4a"),
|
|
746
|
+
L("Source Files", e.sourceFiles, "3178c6"),
|
|
747
|
+
...R(e, "repository")
|
|
748
|
+
]);
|
|
749
|
+
}
|
|
750
|
+
function je(e) {
|
|
751
|
+
let { shell: t } = e;
|
|
752
|
+
return z("Shell", [
|
|
753
|
+
L("Shell Files", t.files, "89e051"),
|
|
754
|
+
L("Shell Lines", t.lines, "4eaa25"),
|
|
755
|
+
L("Shell Functions", t.functions, "16a34a"),
|
|
756
|
+
L("Shell Variables", t.variables, "0284c7"),
|
|
757
|
+
L("Shell Exports", t.exports, "ea580c"),
|
|
758
|
+
L("Shell Conditionals", t.conditionals, "7c3aed"),
|
|
759
|
+
L("Shell Loops", t.loops, "8b5cf6"),
|
|
760
|
+
L("Shell Pipelines", t.pipelines, "059669"),
|
|
761
|
+
L("Shebangs", t.shebangs, "6b7280"),
|
|
762
|
+
L("Shell Comments", t.comments, "64748b"),
|
|
763
|
+
L("Shell Comment Lines", t.commentLines, "475569"),
|
|
764
|
+
...R(e, "shell")
|
|
765
|
+
]);
|
|
766
|
+
}
|
|
767
|
+
function Me(e) {
|
|
768
|
+
let { sql: t } = e;
|
|
769
|
+
return z("SQL", [
|
|
770
|
+
L("SQL Files", t.files, "e38c00"),
|
|
771
|
+
L("SQL Lines", t.lines, "f29111"),
|
|
772
|
+
L("SQL Statements", t.statements, "7c3aed"),
|
|
773
|
+
L("SQL Selects", t.selects, "16a34a"),
|
|
774
|
+
L("SQL Inserts", t.inserts, "22c55e"),
|
|
775
|
+
L("SQL Updates", t.updates, "0ea5e9"),
|
|
776
|
+
L("SQL Deletes", t.deletes, "dc2626"),
|
|
777
|
+
L("SQL Creates", t.creates, "0284c7"),
|
|
778
|
+
L("SQL Joins", t.joins, "8b5cf6"),
|
|
779
|
+
L("SQL CTEs", t.commonTableExpressions, "059669"),
|
|
780
|
+
L("SQL Comments", t.comments, "64748b"),
|
|
781
|
+
...R(e, "sql")
|
|
782
|
+
]);
|
|
783
|
+
}
|
|
784
|
+
function Ne(e) {
|
|
785
|
+
return e.length === 0 ? "" : z("Measured Targets", e.map((e) => L(`${e.name} Size`, Re(e), "6b7280")));
|
|
786
|
+
}
|
|
787
|
+
function Pe(e) {
|
|
788
|
+
let { toml: t } = e;
|
|
789
|
+
return z("TOML", [
|
|
790
|
+
L("TOML Files", t.files, "9c4221"),
|
|
791
|
+
L("TOML Lines", t.lines, "b45309"),
|
|
792
|
+
L("TOML Tables", t.tables, "7c3aed"),
|
|
793
|
+
L("TOML Array Tables", t.arrayTables, "8b5cf6"),
|
|
794
|
+
L("TOML Keys", t.keys, "0284c7"),
|
|
795
|
+
L("TOML Arrays", t.arrays, "16a34a"),
|
|
796
|
+
L("TOML Comments", t.comments, "64748b"),
|
|
797
|
+
...R(e, "toml")
|
|
798
|
+
]);
|
|
799
|
+
}
|
|
800
|
+
function Fe(e) {
|
|
801
|
+
let { typescript: t } = e;
|
|
802
|
+
return z("TypeScript", [
|
|
803
|
+
L("TypeScript Files", t.files, "3178c6"),
|
|
804
|
+
L("Interfaces", t.interfaces, "0ea5e9"),
|
|
805
|
+
L("Generic Declarations", t.genericDeclarations, "0369a1"),
|
|
806
|
+
L("Enums", t.enums, "f97316"),
|
|
807
|
+
L("Decorators", t.decorators, "db2777"),
|
|
808
|
+
L("Doc Comments", t.docComments, "6366f1"),
|
|
809
|
+
...R(e, "typescript")
|
|
810
|
+
]);
|
|
811
|
+
}
|
|
812
|
+
function Ie(e) {
|
|
813
|
+
let { yaml: t } = e;
|
|
814
|
+
return z("YAML", [
|
|
815
|
+
L("YAML Files", t.files, "cb171e"),
|
|
816
|
+
L("YAML Lines", t.lines, "e34c26"),
|
|
817
|
+
L("YAML Documents", t.documents, "f97316"),
|
|
818
|
+
L("YAML Mappings", t.mappings, "7c3aed"),
|
|
819
|
+
L("YAML Sequences", t.sequences, "8b5cf6"),
|
|
820
|
+
L("YAML Keys", t.keys, "0284c7"),
|
|
821
|
+
L("YAML Scalars", t.scalars, "16a34a"),
|
|
822
|
+
L("YAML Anchors", t.anchors, "059669"),
|
|
823
|
+
L("YAML Aliases", t.aliases, "10b981"),
|
|
824
|
+
L("YAML Comments", t.comments, "64748b"),
|
|
825
|
+
L("YAML Max Depth", t.maxDepth, "ea580c"),
|
|
826
|
+
...R(e, "yaml")
|
|
827
|
+
]);
|
|
828
|
+
}
|
|
829
|
+
function Le(e) {
|
|
830
|
+
return String(e).replaceAll("-", "--").replaceAll("_", "__").replaceAll(" ", "_");
|
|
831
|
+
}
|
|
832
|
+
function Re(e) {
|
|
833
|
+
let t = D(e.bytes);
|
|
834
|
+
return e.compression === "none" ? t : `${t} ${e.compression}`;
|
|
835
|
+
}
|
|
836
|
+
//#endregion
|
|
837
|
+
//#region packages/ic-suite/codometer/codometer-output/src/modules/markdown/markdown.service.ts
|
|
838
|
+
var B, V = B = class {
|
|
839
|
+
logger;
|
|
840
|
+
constructor(e) {
|
|
841
|
+
this.logger = e, this.logger.setContext(B.name);
|
|
842
|
+
}
|
|
843
|
+
buildAnchorHelpers(e) {
|
|
844
|
+
return {
|
|
845
|
+
endMarker: e.destination.endMarker,
|
|
846
|
+
startMarker: e.destination.startMarker,
|
|
847
|
+
syncAnchoredBlock: (t = {}) => this.syncAnchoredBlock({
|
|
848
|
+
check: e.check,
|
|
849
|
+
content: t.content ?? e.content,
|
|
850
|
+
destination: e.destination,
|
|
851
|
+
path: t.path ?? e.destination.path
|
|
852
|
+
}),
|
|
853
|
+
wrapInAnchors: (t = e.content) => this.wrapInAnchors({
|
|
854
|
+
content: t,
|
|
855
|
+
destination: e.destination
|
|
856
|
+
})
|
|
857
|
+
};
|
|
858
|
+
}
|
|
859
|
+
buildBadgeGroups(e) {
|
|
860
|
+
let { statistics: t } = e;
|
|
861
|
+
return [
|
|
862
|
+
Ae(t, e.scope),
|
|
863
|
+
Ne(e.targets),
|
|
864
|
+
Fe(t),
|
|
865
|
+
Te(t),
|
|
866
|
+
ke(t),
|
|
867
|
+
Ee(t),
|
|
868
|
+
Ie(t),
|
|
869
|
+
Pe(t),
|
|
870
|
+
je(t),
|
|
871
|
+
Me(t),
|
|
872
|
+
we(t),
|
|
873
|
+
xe(t),
|
|
874
|
+
Se(t),
|
|
875
|
+
De(t),
|
|
876
|
+
Oe(t)
|
|
877
|
+
].filter((e) => e !== "").join("\n\n");
|
|
878
|
+
}
|
|
879
|
+
buildBlockRegex(e) {
|
|
880
|
+
return new RegExp(String.raw`${this.escapeRegex(e.startMarker)}[\s\S]*?${this.escapeRegex(e.endMarker)}`);
|
|
881
|
+
}
|
|
882
|
+
escapeRegex(e) {
|
|
883
|
+
return e.replaceAll(ye, String.raw`\$&`);
|
|
884
|
+
}
|
|
885
|
+
readExisting(e) {
|
|
886
|
+
try {
|
|
887
|
+
return l(u.resolve(e), "utf8");
|
|
888
|
+
} catch {
|
|
889
|
+
return "";
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
scopeCustomStatistics(e, t) {
|
|
893
|
+
let n = new Set(t.custom.map((e) => e.label));
|
|
894
|
+
return {
|
|
895
|
+
...e,
|
|
896
|
+
custom: e.custom.filter((e) => n.has(e.label))
|
|
897
|
+
};
|
|
898
|
+
}
|
|
899
|
+
syncAnchoredBlock(e) {
|
|
900
|
+
if (e.path === void 0) throw new I();
|
|
901
|
+
let t = u.resolve(e.path), n = this.readExisting(t), r = this.wrapInAnchors(e), i = this.buildBlockRegex(e.destination), a = i.exec(n)?.[0];
|
|
902
|
+
if (e.check) return a === r;
|
|
903
|
+
if (!n.includes(e.destination.startMarker)) {
|
|
904
|
+
let e = n === "" ? "" : `${n.replace(be, "")}\n\n`;
|
|
905
|
+
return this.writeMarkdownFile(t, `${e}${r}\n`), !0;
|
|
906
|
+
}
|
|
907
|
+
return this.writeMarkdownFile(t, n.replace(i, () => r)), !0;
|
|
908
|
+
}
|
|
909
|
+
wrapInAnchors(e) {
|
|
910
|
+
return `${e.destination.startMarker}\n\n${e.content}\n${e.destination.endMarker}`;
|
|
911
|
+
}
|
|
912
|
+
writeMarkdownFile(e, t) {
|
|
913
|
+
c(u.dirname(e), { recursive: !0 }), ee(e, t, "utf8"), this.logger.info("📝 Wrote the markdown badges", void 0, { path: e });
|
|
914
|
+
}
|
|
915
|
+
renderBadges(e) {
|
|
916
|
+
return this.renderDocument({
|
|
917
|
+
description: e.destination.description,
|
|
918
|
+
scope: e.scope,
|
|
919
|
+
statistics: this.scopeCustomStatistics(e.statistics, e.destination),
|
|
920
|
+
targets: e.targets
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
renderBlock(e) {
|
|
924
|
+
return this.wrapInAnchors({
|
|
925
|
+
content: this.renderBadges(e),
|
|
926
|
+
destination: e.destination
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
renderDocument(e) {
|
|
930
|
+
let t = [ve];
|
|
931
|
+
e.description !== void 0 && t.push(e.description), t.push(this.buildBadgeGroups(e));
|
|
932
|
+
let n = Ce(e.statistics);
|
|
933
|
+
return n !== "" && t.push(n), t.join("\n\n");
|
|
934
|
+
}
|
|
935
|
+
sync(e) {
|
|
936
|
+
let { destination: t } = e, n = this.scopeCustomStatistics(e.statistics, t), r = this.renderDocument({
|
|
937
|
+
description: t.description,
|
|
938
|
+
scope: e.scope,
|
|
939
|
+
statistics: n,
|
|
940
|
+
targets: e.targets
|
|
941
|
+
}), i = this.buildAnchorHelpers({
|
|
942
|
+
check: e.check,
|
|
943
|
+
content: r,
|
|
944
|
+
destination: t
|
|
945
|
+
});
|
|
946
|
+
return t.write === void 0 ? i.syncAnchoredBlock() : t.write({
|
|
947
|
+
anchors: i,
|
|
948
|
+
check: e.check,
|
|
949
|
+
description: t.description,
|
|
950
|
+
path: t.path,
|
|
951
|
+
renderBadges: () => r,
|
|
952
|
+
statistics: n
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
};
|
|
956
|
+
V = B = v([r(), _("design:paramtypes", [b === void 0 ? Object : b])], V);
|
|
957
|
+
//#endregion
|
|
958
|
+
//#region packages/ic-suite/codometer/codometer-output/src/modules/markdown/markdown.module.ts
|
|
959
|
+
var H = class {};
|
|
960
|
+
H = v([i({
|
|
961
|
+
controllers: [],
|
|
962
|
+
exports: [V],
|
|
963
|
+
imports: [x],
|
|
964
|
+
providers: [V]
|
|
965
|
+
})], H);
|
|
966
|
+
//#endregion
|
|
967
|
+
//#region packages/ic-suite/codometer/codometer-output/src/modules/delivery/delivery.constants.ts
|
|
968
|
+
var ze = {
|
|
969
|
+
custom: [],
|
|
970
|
+
description: void 0,
|
|
971
|
+
endMarker: ie,
|
|
972
|
+
path: void 0,
|
|
973
|
+
startMarker: m,
|
|
974
|
+
type: "markdown",
|
|
975
|
+
write: void 0
|
|
976
|
+
}, U = class {
|
|
977
|
+
jsonService;
|
|
978
|
+
markdownService;
|
|
979
|
+
constructor(e, t) {
|
|
980
|
+
this.jsonService = e, this.markdownService = t;
|
|
981
|
+
}
|
|
982
|
+
deliverConsole(e) {
|
|
983
|
+
if (e.format === void 0) return;
|
|
984
|
+
if (e.format === "json") {
|
|
985
|
+
process.stdout.write(this.jsonService.render({
|
|
986
|
+
indentation: e.destinations.json?.indentation ?? p,
|
|
987
|
+
report: e.report
|
|
988
|
+
}));
|
|
989
|
+
return;
|
|
990
|
+
}
|
|
991
|
+
let t = this.markdownService.renderBlock({
|
|
992
|
+
destination: e.consoleMarkdown ?? ze,
|
|
993
|
+
scope: e.scope,
|
|
994
|
+
statistics: e.measurement.statistics,
|
|
995
|
+
targets: this.readTargetSizes(e.measurement)
|
|
996
|
+
});
|
|
997
|
+
process.stdout.write(`${t}\n`);
|
|
998
|
+
}
|
|
999
|
+
deliverJson(e, t) {
|
|
1000
|
+
let n = e.destinations.json;
|
|
1001
|
+
n !== void 0 && this.touchesFiles(e.mode) && !this.jsonService.sync({
|
|
1002
|
+
check: e.mode.checksReports,
|
|
1003
|
+
indentation: n.indentation,
|
|
1004
|
+
path: n.path,
|
|
1005
|
+
report: e.report
|
|
1006
|
+
}) && e.mode.checksReports && t.push(n.path);
|
|
1007
|
+
}
|
|
1008
|
+
deliverMarkdown(e, t) {
|
|
1009
|
+
let n = e.destinations.markdown;
|
|
1010
|
+
n !== void 0 && this.touchesFiles(e.mode) && !this.markdownService.sync({
|
|
1011
|
+
check: e.mode.checksReports,
|
|
1012
|
+
destination: n,
|
|
1013
|
+
scope: e.scope,
|
|
1014
|
+
statistics: e.measurement.statistics,
|
|
1015
|
+
targets: this.readTargetSizes(e.measurement)
|
|
1016
|
+
}) && e.mode.checksReports && t.push(n.path ?? "markdown output");
|
|
1017
|
+
}
|
|
1018
|
+
readTargetSizes(e) {
|
|
1019
|
+
return e.inputs.flatMap((e) => e.size === void 0 || e.size.files === 0 ? [] : [{
|
|
1020
|
+
bytes: e.size.bytes,
|
|
1021
|
+
compression: e.size.compression,
|
|
1022
|
+
name: e.name
|
|
1023
|
+
}]);
|
|
1024
|
+
}
|
|
1025
|
+
touchesFiles(e) {
|
|
1026
|
+
return e.writesJson || e.writesMarkdown || e.checksReports;
|
|
1027
|
+
}
|
|
1028
|
+
deliver(e) {
|
|
1029
|
+
let t = [];
|
|
1030
|
+
return this.deliverConsole(e), this.deliverJson(e, t), this.deliverMarkdown(e, t), t;
|
|
1031
|
+
}
|
|
1032
|
+
};
|
|
1033
|
+
U = v([r(), _("design:paramtypes", [P === void 0 ? Object : P, V === void 0 ? Object : V])], U);
|
|
1034
|
+
//#endregion
|
|
1035
|
+
//#region packages/ic-suite/codometer/codometer-output/src/modules/delivery/delivery.module.ts
|
|
1036
|
+
var W = class {};
|
|
1037
|
+
W = v([i({
|
|
1038
|
+
controllers: [],
|
|
1039
|
+
exports: [U],
|
|
1040
|
+
imports: [F, H],
|
|
1041
|
+
providers: [U]
|
|
1042
|
+
})], W);
|
|
1043
|
+
//#endregion
|
|
1044
|
+
//#region packages/ic-suite/codometer/codometer-output/src/modules/destinations/destinations.service.ts
|
|
1045
|
+
var G = class {
|
|
1046
|
+
constructor() {}
|
|
1047
|
+
findConfiguredOutput(e, t) {
|
|
1048
|
+
return e.find((e) => e.type === t);
|
|
1049
|
+
}
|
|
1050
|
+
resolveJson(e, t, n) {
|
|
1051
|
+
let { outputJson: r } = e.options;
|
|
1052
|
+
if (t && r === void 0) return;
|
|
1053
|
+
let i = this.findConfiguredOutput(e.configuration.outputs, "json");
|
|
1054
|
+
if (typeof r == "string") return {
|
|
1055
|
+
custom: i?.custom ?? [],
|
|
1056
|
+
indentation: i?.indentation ?? p,
|
|
1057
|
+
path: u.resolve(e.workingDirectory, r)
|
|
1058
|
+
};
|
|
1059
|
+
if (i === void 0) {
|
|
1060
|
+
r === !0 && n.push("--output-json needs a path, or a \"json\" entry in the configuration's \"outputs\" to resolve one from: neither was found, so there is nowhere to write it. Pass --output-json <path>, or declare a \"json\" output.");
|
|
1061
|
+
return;
|
|
1062
|
+
}
|
|
1063
|
+
return {
|
|
1064
|
+
custom: i.custom,
|
|
1065
|
+
indentation: i.indentation,
|
|
1066
|
+
path: u.resolve(e.workingDirectory, i.path)
|
|
1067
|
+
};
|
|
1068
|
+
}
|
|
1069
|
+
resolveMarkdown(e, t, n) {
|
|
1070
|
+
let { outputMarkdown: r } = e.options;
|
|
1071
|
+
if (t && r === void 0) return;
|
|
1072
|
+
let i = this.findConfiguredOutput(e.configuration.outputs, "markdown");
|
|
1073
|
+
if (typeof r == "string") return {
|
|
1074
|
+
custom: i?.custom ?? [],
|
|
1075
|
+
description: i?.description,
|
|
1076
|
+
endMarker: i?.endMarker ?? ie,
|
|
1077
|
+
path: this.resolvePath(e.workingDirectory, r),
|
|
1078
|
+
startMarker: i?.startMarker ?? m,
|
|
1079
|
+
type: "markdown",
|
|
1080
|
+
write: i?.write
|
|
1081
|
+
};
|
|
1082
|
+
if (i === void 0) {
|
|
1083
|
+
r === !0 && n.push("--output-markdown needs a path, or a \"markdown\" entry in the configuration's \"outputs\" to resolve one from: neither was found, so there is nowhere to write it. Pass --output-markdown <path>, or declare a \"markdown\" output.");
|
|
1084
|
+
return;
|
|
1085
|
+
}
|
|
1086
|
+
return {
|
|
1087
|
+
custom: i.custom,
|
|
1088
|
+
description: i.description,
|
|
1089
|
+
endMarker: i.endMarker,
|
|
1090
|
+
path: this.resolvePath(e.workingDirectory, i.path),
|
|
1091
|
+
startMarker: i.startMarker,
|
|
1092
|
+
type: "markdown",
|
|
1093
|
+
write: i.write
|
|
1094
|
+
};
|
|
1095
|
+
}
|
|
1096
|
+
resolvePath(e, t) {
|
|
1097
|
+
return t === void 0 ? void 0 : u.resolve(e, t);
|
|
1098
|
+
}
|
|
1099
|
+
listOutputPaths(e) {
|
|
1100
|
+
return [e.destinations.json?.path, e.destinations.markdown?.path].filter((e) => e !== void 0).map((t) => u.relative(e.workingDirectory, t).split(u.sep).join("/"));
|
|
1101
|
+
}
|
|
1102
|
+
resolveConsoleMarkdown(e) {
|
|
1103
|
+
return this.resolveMarkdown(e, !1, []);
|
|
1104
|
+
}
|
|
1105
|
+
resolveDestinations(e) {
|
|
1106
|
+
let t = e.options.outputJson !== void 0 || e.options.outputMarkdown !== void 0, n = [];
|
|
1107
|
+
return {
|
|
1108
|
+
destinations: {
|
|
1109
|
+
json: this.resolveJson(e, t, n),
|
|
1110
|
+
markdown: this.resolveMarkdown(e, t, n)
|
|
1111
|
+
},
|
|
1112
|
+
errors: n
|
|
1113
|
+
};
|
|
1114
|
+
}
|
|
1115
|
+
selectScope(e) {
|
|
1116
|
+
return ae.some((t) => o(u.join(e, t))) ? "repository" : "project";
|
|
1117
|
+
}
|
|
1118
|
+
};
|
|
1119
|
+
G = v([r(), _("design:paramtypes", [])], G);
|
|
1120
|
+
//#endregion
|
|
1121
|
+
//#region packages/ic-suite/codometer/codometer-output/src/modules/destinations/destinations.module.ts
|
|
1122
|
+
var K = class {};
|
|
1123
|
+
K = v([i({
|
|
1124
|
+
controllers: [],
|
|
1125
|
+
exports: [G],
|
|
1126
|
+
imports: [],
|
|
1127
|
+
providers: [G]
|
|
1128
|
+
})], K);
|
|
1129
|
+
//#endregion
|
|
1130
|
+
//#region packages/ic-suite/codometer/codometer-output/src/modules/documents/documents.service.ts
|
|
1131
|
+
var q, J = q = class {
|
|
1132
|
+
logger;
|
|
1133
|
+
constructor(e) {
|
|
1134
|
+
this.logger = e, this.logger.setContext(q.name);
|
|
1135
|
+
}
|
|
1136
|
+
async readDocument(e) {
|
|
1137
|
+
try {
|
|
1138
|
+
return (await ce(e, "utf8")).trimEnd();
|
|
1139
|
+
} catch {
|
|
1140
|
+
return "";
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
async emit(e) {
|
|
1144
|
+
let { body: t, destination: n, label: r, markers: i } = e, a = this.wrap(t, i);
|
|
1145
|
+
if (n.output !== void 0 && (await le(n.output, `${a}\n`, "utf8"), this.logger.info("📝 Wrote a report", void 0, {
|
|
1146
|
+
label: r,
|
|
1147
|
+
path: n.output
|
|
1148
|
+
})), n.markdown !== void 0) {
|
|
1149
|
+
let e = await this.readDocument(n.markdown), t = this.splice(e, a, i);
|
|
1150
|
+
await le(n.markdown, `${t}\n`, "utf8"), this.logger.info("📝 Spliced a report", void 0, {
|
|
1151
|
+
label: r,
|
|
1152
|
+
path: n.markdown
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1155
|
+
n.output === void 0 && n.markdown === void 0 && (process.stdout.write(`${a}\n`), this.logger.debug("🖨️ Printed the report to standard output", void 0, { label: r }));
|
|
1156
|
+
}
|
|
1157
|
+
splice(e, t, n) {
|
|
1158
|
+
let r = e.indexOf(n.start), i = (r === -1 ? e : e.slice(0, r)).trimEnd(), a = e.indexOf(n.end);
|
|
1159
|
+
return [
|
|
1160
|
+
i,
|
|
1161
|
+
t,
|
|
1162
|
+
a === -1 ? "" : e.slice(a + n.end.length).trimStart()
|
|
1163
|
+
].filter((e) => e.length > 0).join("\n\n");
|
|
1164
|
+
}
|
|
1165
|
+
wrap(e, t) {
|
|
1166
|
+
return [
|
|
1167
|
+
t.start,
|
|
1168
|
+
e,
|
|
1169
|
+
t.end
|
|
1170
|
+
].join("\n");
|
|
1171
|
+
}
|
|
1172
|
+
};
|
|
1173
|
+
J = q = v([r(), _("design:paramtypes", [b === void 0 ? Object : b])], J);
|
|
1174
|
+
//#endregion
|
|
1175
|
+
//#region packages/ic-suite/codometer/codometer-output/src/modules/documents/documents.module.ts
|
|
1176
|
+
var Y = class {};
|
|
1177
|
+
Y = v([i({
|
|
1178
|
+
controllers: [],
|
|
1179
|
+
exports: [J],
|
|
1180
|
+
imports: [x],
|
|
1181
|
+
providers: [J]
|
|
1182
|
+
})], Y);
|
|
1183
|
+
//#endregion
|
|
1184
|
+
//#region packages/ic-suite/codometer/codometer-output/src/modules/render/render.constants.ts
|
|
1185
|
+
var Be = "## ⏲️ Codometer", Ve = {
|
|
1186
|
+
end: "<!-- codometer-changes:end -->",
|
|
1187
|
+
start: "<!-- codometer-changes:start -->"
|
|
1188
|
+
}, He = ["| | Metric | Value | `main` | Change |", "|--|--------|-------|--------|--------|"], X = class {
|
|
1189
|
+
constructor() {}
|
|
1190
|
+
groupByProject(e, t) {
|
|
1191
|
+
let n = /* @__PURE__ */ new Map();
|
|
1192
|
+
for (let r of e) {
|
|
1193
|
+
let e = t(r), i = n.get(e);
|
|
1194
|
+
i === void 0 ? n.set(e, [r]) : i.push(r);
|
|
1195
|
+
}
|
|
1196
|
+
return n;
|
|
1197
|
+
}
|
|
1198
|
+
readIsOpen(e, t) {
|
|
1199
|
+
return t.length > 0 || e.some((e) => e.breach !== void 0);
|
|
1200
|
+
}
|
|
1201
|
+
readProjects(e) {
|
|
1202
|
+
return [.../* @__PURE__ */ new Set([...e.rows.map((e) => e.project), ...e.failures.map((e) => e.project)])].toSorted();
|
|
1203
|
+
}
|
|
1204
|
+
readStatus(e) {
|
|
1205
|
+
return e.removed ? "🗑️" : e.empty ? "⁉️" : e.breach === void 0 ? e.baseValue === void 0 ? "🆕" : e.value > e.baseValue ? "📈" : "📉" : e.breach === "warn" ? "❗" : "❌";
|
|
1206
|
+
}
|
|
1207
|
+
renderComparison(e) {
|
|
1208
|
+
return e === void 0 ? [] : [`_Compared against [\`main\`](${e})._`, ""];
|
|
1209
|
+
}
|
|
1210
|
+
renderFailures(e) {
|
|
1211
|
+
return e.length === 0 ? [] : [
|
|
1212
|
+
"> [!CAUTION]",
|
|
1213
|
+
"> **could not be measured:**",
|
|
1214
|
+
">",
|
|
1215
|
+
"> | Subject | Why |",
|
|
1216
|
+
"> |---------|-----|",
|
|
1217
|
+
...e.map((e) => `> | ${e.subject} | ${e.reason} |`),
|
|
1218
|
+
""
|
|
1219
|
+
];
|
|
1220
|
+
}
|
|
1221
|
+
renderProject(e, t, n) {
|
|
1222
|
+
let r = t.filter((e) => _e(e));
|
|
1223
|
+
if (r.length === 0 && n.length === 0) return [];
|
|
1224
|
+
let i = this.readIsOpen(r, n) ? " open" : "", a = r.length === 0 ? `\`${e}\`` : `\`${e}\` — ${r.length} changed`;
|
|
1225
|
+
return [
|
|
1226
|
+
`<details${i}>`,
|
|
1227
|
+
`<summary>${a}</summary>`,
|
|
1228
|
+
"",
|
|
1229
|
+
...this.renderFailures(n),
|
|
1230
|
+
...r.length === 0 ? [] : [...He, ...r.map((e) => this.renderRow(e))],
|
|
1231
|
+
"</details>",
|
|
1232
|
+
""
|
|
1233
|
+
];
|
|
1234
|
+
}
|
|
1235
|
+
renderRow(e) {
|
|
1236
|
+
let t = e.baseValue === void 0 ? void 0 : e.value - e.baseValue;
|
|
1237
|
+
return `| ${[
|
|
1238
|
+
this.readStatus(e),
|
|
1239
|
+
e.removed ? `~~${e.label}~~` : e.label,
|
|
1240
|
+
e.removed ? "—" : k(e.value, e.unit),
|
|
1241
|
+
e.baseValue === void 0 ? "—" : k(e.baseValue, e.unit),
|
|
1242
|
+
ge(t, e.unit)
|
|
1243
|
+
].join(" | ")} |`;
|
|
1244
|
+
}
|
|
1245
|
+
renderSection(e) {
|
|
1246
|
+
let t = this.groupByProject(e.rows, (e) => e.project), n = this.groupByProject(e.failures, (e) => e.project), r = this.readProjects(e).flatMap((e) => this.renderProject(e, t.get(e) ?? [], n.get(e) ?? [])), i = this.renderComparison(e.baselineUrl);
|
|
1247
|
+
return [
|
|
1248
|
+
Be,
|
|
1249
|
+
"",
|
|
1250
|
+
...r.length === 0 ? [...i, "No codometer changes to report for this pull request."] : [
|
|
1251
|
+
...i,
|
|
1252
|
+
...r,
|
|
1253
|
+
"*Updated automatically when you push new commits.*"
|
|
1254
|
+
]
|
|
1255
|
+
].join("\n");
|
|
1256
|
+
}
|
|
1257
|
+
};
|
|
1258
|
+
X = v([r(), _("design:paramtypes", [])], X);
|
|
1259
|
+
//#endregion
|
|
1260
|
+
//#region packages/ic-suite/codometer/codometer-output/src/modules/render/render.module.ts
|
|
1261
|
+
var Z = class {};
|
|
1262
|
+
Z = v([i({
|
|
1263
|
+
controllers: [],
|
|
1264
|
+
exports: [X],
|
|
1265
|
+
imports: [],
|
|
1266
|
+
providers: [X]
|
|
1267
|
+
})], Z);
|
|
1268
|
+
//#endregion
|
|
1269
|
+
//#region packages/ic-suite/codometer/codometer-output/src/modules/report/report.service.ts
|
|
1270
|
+
var Q = class {
|
|
1271
|
+
constructor() {}
|
|
1272
|
+
buildLimit(e) {
|
|
1273
|
+
return {
|
|
1274
|
+
breached: e.breached,
|
|
1275
|
+
label: e.label ?? null,
|
|
1276
|
+
severity: e.severity,
|
|
1277
|
+
value: e.limit
|
|
1278
|
+
};
|
|
1279
|
+
}
|
|
1280
|
+
buildMetricName(e, t) {
|
|
1281
|
+
return `${e}.${t}`;
|
|
1282
|
+
}
|
|
1283
|
+
buildMetrics(e) {
|
|
1284
|
+
let t = [];
|
|
1285
|
+
for (let [n, r] of e.index.metrics) {
|
|
1286
|
+
let i = this.buildMetricName(e.target, n);
|
|
1287
|
+
t.push({
|
|
1288
|
+
instances: e.index.instances.get(n) ?? null,
|
|
1289
|
+
limits: (e.limits.get(i) ?? []).map((e) => this.buildLimit(e)),
|
|
1290
|
+
name: i,
|
|
1291
|
+
path: n,
|
|
1292
|
+
unit: this.readUnit(n),
|
|
1293
|
+
value: r
|
|
1294
|
+
});
|
|
1295
|
+
}
|
|
1296
|
+
return t;
|
|
1297
|
+
}
|
|
1298
|
+
indexLimits(e) {
|
|
1299
|
+
let t = /* @__PURE__ */ new Map();
|
|
1300
|
+
for (let n of e) {
|
|
1301
|
+
let e = this.buildMetricName(n.target, n.metric), r = t.get(e);
|
|
1302
|
+
r === void 0 ? t.set(e, [n]) : r.push(n);
|
|
1303
|
+
}
|
|
1304
|
+
return t;
|
|
1305
|
+
}
|
|
1306
|
+
readUnit(e) {
|
|
1307
|
+
return e === "size" ? "bytes" : null;
|
|
1308
|
+
}
|
|
1309
|
+
build(e) {
|
|
1310
|
+
let t = this.indexLimits(e.limits), n = [];
|
|
1311
|
+
for (let [r, i] of e.indexes) n.push({
|
|
1312
|
+
empty: i.files === 0,
|
|
1313
|
+
files: i.files,
|
|
1314
|
+
metrics: this.buildMetrics({
|
|
1315
|
+
index: i,
|
|
1316
|
+
limits: t,
|
|
1317
|
+
target: r
|
|
1318
|
+
}),
|
|
1319
|
+
name: r
|
|
1320
|
+
});
|
|
1321
|
+
return {
|
|
1322
|
+
failures: [...e.failures],
|
|
1323
|
+
targets: n
|
|
1324
|
+
};
|
|
1325
|
+
}
|
|
1326
|
+
};
|
|
1327
|
+
Q = v([r(), _("design:paramtypes", [])], Q);
|
|
1328
|
+
//#endregion
|
|
1329
|
+
//#region packages/ic-suite/codometer/codometer-output/src/modules/report/report.module.ts
|
|
1330
|
+
var $ = class {};
|
|
1331
|
+
$ = v([i({
|
|
1332
|
+
controllers: [],
|
|
1333
|
+
exports: [Q],
|
|
1334
|
+
imports: [],
|
|
1335
|
+
providers: [Q]
|
|
1336
|
+
})], $);
|
|
1337
|
+
//#endregion
|
|
1338
|
+
export { me as ABSENT_LABEL, Ve as CODOMETER_MARKERS, T as CONFIGURATION_HEADING, w as ChangesModule, C as ChangesService, M as ConfigurationListingModule, A as ConfigurationListingService, W as DeliveryModule, U as DeliveryService, K as DestinationsModule, G as DestinationsService, Y as DocumentsModule, J as DocumentsService, Be as HEADING, F as JsonModule, P as JsonService, E as LIMIT_TABLE_COLUMNS, H as MarkdownModule, V as MarkdownService, I as MissingMarkdownPathError, h as REPORT_GLOBS, j as RenderConfigurationService, Z as RenderModule, X as RenderService, $ as ReportModule, Q as ReportService, he as SIZE_METRIC_SUFFIX, He as TABLE_HEADER, g as codometerReportSchema, D as formatBytes, O as formatCount, ge as formatDelta, k as formatValue, _e as hasChanged };
|