@codometer/measurement 0.0.9 → 0.0.10
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/CHANGELOG.md +8 -0
- package/README.md +8 -8
- package/dist/src/index.js +113 -112
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -346,13 +346,13 @@ None.
|
|
|
346
346
|
### Project
|
|
347
347
|
|
|
348
348
|

|
|
349
|
-

|
|
350
350
|

|
|
351
351
|

|
|
352
352
|
|
|
353
353
|
### Measured Targets
|
|
354
354
|
|
|
355
|
-

|
|
356
356
|
|
|
357
357
|
### TypeScript
|
|
358
358
|
|
|
@@ -534,16 +534,16 @@ None.
|
|
|
534
534
|
### Markdown
|
|
535
535
|
|
|
536
536
|

|
|
537
|
-

|
|
538
538
|

|
|
539
|
-

|
|
540
|
+

|
|
541
541
|

|
|
542
542
|

|
|
543
543
|

|
|
544
|
-

|
|
545
|
+

|
|
546
|
+

|
|
547
547
|

|
|
548
548
|

|
|
549
549
|

|
package/dist/src/index.js
CHANGED
|
@@ -5,14 +5,15 @@ import d from "pino";
|
|
|
5
5
|
import f from "ignore";
|
|
6
6
|
import { ConfigurationModule as p, DEFAULT_INPUT_NAME as m, REPOSITORY_ROOT_MARKERS as ee } from "@codometer/configuration";
|
|
7
7
|
import { LanguagesModule as te, LanguagesService as h } from "@codometer/languages";
|
|
8
|
-
import { brotliCompressSync as
|
|
8
|
+
import { brotliCompressSync as ne, constants as re, gzipSync as g } from "node:zlib";
|
|
9
|
+
//#endregion
|
|
9
10
|
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/decorateMetadata.js
|
|
10
|
-
function
|
|
11
|
+
function __decorateMetadata(e, t) {
|
|
11
12
|
if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(e, t);
|
|
12
13
|
}
|
|
13
14
|
//#endregion
|
|
14
15
|
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/decorate.js
|
|
15
|
-
function
|
|
16
|
+
function __decorate(e, t, n, r) {
|
|
16
17
|
var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
|
|
17
18
|
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
|
|
18
19
|
else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
|
|
@@ -20,7 +21,7 @@ function b(e, t, n, r) {
|
|
|
20
21
|
}
|
|
21
22
|
//#endregion
|
|
22
23
|
//#region packages/ic-suite/codometer/codometer-measurement/src/modules/customization/customization.service.ts
|
|
23
|
-
var
|
|
24
|
+
var _ = class CustomizationService {
|
|
24
25
|
constructor() {}
|
|
25
26
|
buildCommentResult(e, t) {
|
|
26
27
|
let n = (t[e.label] ?? []).filter((e) => e.breached);
|
|
@@ -74,19 +75,19 @@ var x = class {
|
|
|
74
75
|
}]);
|
|
75
76
|
}
|
|
76
77
|
};
|
|
77
|
-
|
|
78
|
+
_ = __decorate([n(), __decorateMetadata("design:paramtypes", [])], _);
|
|
78
79
|
//#endregion
|
|
79
80
|
//#region packages/ic-suite/codometer/codometer-measurement/src/modules/customization/customization.module.ts
|
|
80
|
-
var
|
|
81
|
-
|
|
81
|
+
var v = class CustomizationModule {};
|
|
82
|
+
v = __decorate([r({
|
|
82
83
|
controllers: [],
|
|
83
|
-
exports: [
|
|
84
|
+
exports: [_],
|
|
84
85
|
imports: [],
|
|
85
|
-
providers: [
|
|
86
|
-
})],
|
|
86
|
+
providers: [_]
|
|
87
|
+
})], v);
|
|
87
88
|
//#endregion
|
|
88
89
|
//#region packages/logging/src/modules/logger/logger.constants.ts
|
|
89
|
-
var
|
|
90
|
+
var y = /^(\p{Extended_Pictographic}️?(?:\p{Extended_Pictographic}️?)*)\s+/u, b = /^([A-Za-z]+)/, ie = /* @__PURE__ */ new Set([
|
|
90
91
|
"built",
|
|
91
92
|
"cut",
|
|
92
93
|
"found",
|
|
@@ -114,9 +115,9 @@ var ne = /^(\p{Extended_Pictographic}️?(?:\p{Extended_Pictographic}️?)*)\
|
|
|
114
115
|
"RouterExplorer",
|
|
115
116
|
"RoutesResolver",
|
|
116
117
|
"TypeOrmModule"
|
|
117
|
-
]),
|
|
118
|
+
]), x, S = class LoggerService extends e {
|
|
118
119
|
static {
|
|
119
|
-
|
|
120
|
+
x = this;
|
|
120
121
|
}
|
|
121
122
|
constructor() {
|
|
122
123
|
super();
|
|
@@ -124,15 +125,15 @@ var ne = /^(\p{Extended_Pictographic}️?(?:\p{Extended_Pictographic}️?)*)\
|
|
|
124
125
|
static isProduction = process.env.NODE_ENV === "production";
|
|
125
126
|
static rootLogger;
|
|
126
127
|
static writesToStandardError = !1;
|
|
127
|
-
child =
|
|
128
|
+
child = x.root;
|
|
128
129
|
static createRootLogger() {
|
|
129
130
|
let e = process.env.LOG_LEVEL ?? "info";
|
|
130
|
-
return
|
|
131
|
+
return x.isProduction ? x.writesToStandardError ? d({ level: e }, d.destination(2)) : d({ level: e }) : d({
|
|
131
132
|
level: e,
|
|
132
133
|
transport: {
|
|
133
134
|
options: {
|
|
134
135
|
colorize: !0,
|
|
135
|
-
destination:
|
|
136
|
+
destination: x.writesToStandardError ? 2 : 1,
|
|
136
137
|
ignore: "pid,hostname,emoji",
|
|
137
138
|
messageFormat: "{emoji} {msg}",
|
|
138
139
|
singleLine: !0
|
|
@@ -142,14 +143,14 @@ var ne = /^(\p{Extended_Pictographic}️?(?:\p{Extended_Pictographic}️?)*)\
|
|
|
142
143
|
});
|
|
143
144
|
}
|
|
144
145
|
static logToStandardError() {
|
|
145
|
-
if (
|
|
146
|
+
if (x.rootLogger !== void 0) {
|
|
146
147
|
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.");
|
|
147
148
|
return;
|
|
148
149
|
}
|
|
149
|
-
|
|
150
|
+
x.writesToStandardError = !0;
|
|
150
151
|
}
|
|
151
152
|
assertConventionalMessage(e) {
|
|
152
|
-
if (
|
|
153
|
+
if (x.isProduction || this.shouldSkipConventionalMessageValidation(e.context)) return;
|
|
153
154
|
let t = this.getConventionalMessageViolation(e.parsed);
|
|
154
155
|
if (t !== void 0) throw Error(t);
|
|
155
156
|
}
|
|
@@ -160,13 +161,13 @@ var ne = /^(\p{Extended_Pictographic}️?(?:\p{Extended_Pictographic}️?)*)\
|
|
|
160
161
|
}), {
|
|
161
162
|
...e.data,
|
|
162
163
|
context: e.context,
|
|
163
|
-
...
|
|
164
|
+
...x.isProduction ? {} : { emoji: e.parsed.emoji }
|
|
164
165
|
};
|
|
165
166
|
}
|
|
166
167
|
getConventionalMessageViolation(e) {
|
|
167
168
|
let t = e.emoji, n = e.text;
|
|
168
169
|
if (t === void 0) return `Log message must start with an emoji naming its subject, then a verb: "${n}"`;
|
|
169
|
-
let r =
|
|
170
|
+
let r = b.exec(n)?.[1];
|
|
170
171
|
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}"`;
|
|
171
172
|
}
|
|
172
173
|
isConventionalVerb(e) {
|
|
@@ -174,7 +175,7 @@ var ne = /^(\p{Extended_Pictographic}️?(?:\p{Extended_Pictographic}️?)*)\
|
|
|
174
175
|
return t.endsWith("ing") || t.endsWith("ed") || ie.has(t);
|
|
175
176
|
}
|
|
176
177
|
parseMessage(e) {
|
|
177
|
-
let t = String(e), n =
|
|
178
|
+
let t = String(e), n = y.exec(t), r = n?.[1];
|
|
178
179
|
return r === void 0 ? {
|
|
179
180
|
emoji: void 0,
|
|
180
181
|
text: t
|
|
@@ -187,7 +188,7 @@ var ne = /^(\p{Extended_Pictographic}️?(?:\p{Extended_Pictographic}️?)*)\
|
|
|
187
188
|
return e !== void 0 && ae.has(e);
|
|
188
189
|
}
|
|
189
190
|
static get root() {
|
|
190
|
-
return
|
|
191
|
+
return x.rootLogger ??= x.createRootLogger(), x.rootLogger;
|
|
191
192
|
}
|
|
192
193
|
buildErrorLogEntry(e, t) {
|
|
193
194
|
let n = t instanceof Error ? t.stack || t.message : String(t);
|
|
@@ -231,7 +232,7 @@ var ne = /^(\p{Extended_Pictographic}️?(?:\p{Extended_Pictographic}️?)*)\
|
|
|
231
232
|
this.info(e, t, n);
|
|
232
233
|
}
|
|
233
234
|
setContext(e) {
|
|
234
|
-
super.setContext(e), this.child =
|
|
235
|
+
super.setContext(e), this.child = x.root.child({ context: e });
|
|
235
236
|
}
|
|
236
237
|
verbose(e, t, n) {
|
|
237
238
|
let r = this.parseMessage(e);
|
|
@@ -250,43 +251,43 @@ var ne = /^(\p{Extended_Pictographic}️?(?:\p{Extended_Pictographic}️?)*)\
|
|
|
250
251
|
}), r.text);
|
|
251
252
|
}
|
|
252
253
|
};
|
|
253
|
-
|
|
254
|
+
S = x = __decorate([n({ scope: i.TRANSIENT }), __decorateMetadata("design:paramtypes", [])], S);
|
|
254
255
|
//#endregion
|
|
255
256
|
//#region packages/logging/src/modules/logger/logger.module.ts
|
|
256
|
-
var
|
|
257
|
-
|
|
257
|
+
var C = class LoggerModule {};
|
|
258
|
+
C = __decorate([t(), r({
|
|
258
259
|
controllers: [],
|
|
259
|
-
exports: [
|
|
260
|
+
exports: [S],
|
|
260
261
|
imports: [],
|
|
261
|
-
providers: [
|
|
262
|
-
})],
|
|
263
|
-
var
|
|
262
|
+
providers: [S]
|
|
263
|
+
})], C);
|
|
264
|
+
var w = ".gitignore", T = /* @__PURE__ */ new Set([
|
|
264
265
|
".cts",
|
|
265
266
|
".mts",
|
|
266
267
|
".ts",
|
|
267
268
|
".tsx"
|
|
268
|
-
]),
|
|
269
|
+
]), E = /* @__PURE__ */ new Set([
|
|
269
270
|
".cjs",
|
|
270
271
|
".js",
|
|
271
272
|
".jsx",
|
|
272
273
|
".mjs"
|
|
273
|
-
]),
|
|
274
|
+
]), oe = /* @__PURE__ */ new Set([
|
|
274
275
|
".markdown",
|
|
275
276
|
".md",
|
|
276
277
|
".mdx"
|
|
277
|
-
]),
|
|
278
|
+
]), se = /* @__PURE__ */ new Set([
|
|
278
279
|
".json",
|
|
279
280
|
".jsonc",
|
|
280
281
|
".jsonl"
|
|
281
|
-
]),
|
|
282
|
+
]), D = /* @__PURE__ */ new Set([".css"]), O = /* @__PURE__ */ new Set([
|
|
282
283
|
".hcl",
|
|
283
284
|
".tf",
|
|
284
285
|
".tfvars"
|
|
285
|
-
]),
|
|
286
|
+
]), k = /* @__PURE__ */ new Set([
|
|
286
287
|
".bash",
|
|
287
288
|
".sh",
|
|
288
289
|
".zsh"
|
|
289
|
-
]),
|
|
290
|
+
]), A = /* @__PURE__ */ new Set([".sql"]), j = /* @__PURE__ */ new Set([".toml"]), M = /* @__PURE__ */ new Set([".yaml", ".yml"]), N = /* @__PURE__ */ new Set([".ipynb"]), P = /\.(test|spec|unit\.test|integration\.test|end-to-end\.test)\.[cm]?[jt]sx?$/, F = class IgnoreRulesService {
|
|
290
291
|
constructor() {}
|
|
291
292
|
toScopedPath(e, t) {
|
|
292
293
|
if (e.directory === "") return t;
|
|
@@ -316,19 +317,19 @@ var oe = ".gitignore", E = /* @__PURE__ */ new Set([
|
|
|
316
317
|
});
|
|
317
318
|
}
|
|
318
319
|
};
|
|
319
|
-
|
|
320
|
+
F = __decorate([n(), __decorateMetadata("design:paramtypes", [])], F);
|
|
320
321
|
//#endregion
|
|
321
322
|
//#region packages/ic-suite/codometer/codometer-measurement/src/modules/discovery/discovery.service.ts
|
|
322
|
-
var
|
|
323
|
+
var I, L = I = class DiscoveryService {
|
|
323
324
|
ignoreRulesService;
|
|
324
325
|
logger;
|
|
325
326
|
constructor(e, t) {
|
|
326
|
-
this.ignoreRulesService = e, this.logger = t, this.logger.setContext(
|
|
327
|
+
this.ignoreRulesService = e, this.logger = t, this.logger.setContext(I.name);
|
|
327
328
|
}
|
|
328
329
|
applyDirectoryIgnoreFile(e) {
|
|
329
330
|
let t = this.ignoreRulesService.readScope({
|
|
330
331
|
directory: e.relativeDirectory,
|
|
331
|
-
filePath: a.join(e.absoluteDirectory,
|
|
332
|
+
filePath: a.join(e.absoluteDirectory, w)
|
|
332
333
|
});
|
|
333
334
|
return t === void 0 ? e : {
|
|
334
335
|
...e,
|
|
@@ -402,46 +403,46 @@ var F, I = F = class {
|
|
|
402
403
|
});
|
|
403
404
|
}
|
|
404
405
|
categorize(e) {
|
|
405
|
-
let t = /* @__PURE__ */ new Set([...
|
|
406
|
+
let t = /* @__PURE__ */ new Set([...T, ...E]), n = e.filter((e) => t.has(a.extname(e)));
|
|
406
407
|
return {
|
|
407
|
-
cssFiles: this.filterByExtension(e,
|
|
408
|
+
cssFiles: this.filterByExtension(e, D),
|
|
408
409
|
files: e,
|
|
409
|
-
hclFiles: this.filterByExtension(e,
|
|
410
|
-
jsFiles: n.filter((e) =>
|
|
411
|
-
jsonFiles: this.filterByExtension(e,
|
|
412
|
-
markdownFiles: this.filterByExtension(e,
|
|
413
|
-
notebookFiles: this.filterByExtension(e,
|
|
410
|
+
hclFiles: this.filterByExtension(e, O),
|
|
411
|
+
jsFiles: n.filter((e) => E.has(a.extname(e))),
|
|
412
|
+
jsonFiles: this.filterByExtension(e, se),
|
|
413
|
+
markdownFiles: this.filterByExtension(e, oe),
|
|
414
|
+
notebookFiles: this.filterByExtension(e, N),
|
|
414
415
|
pyFiles: e.filter((e) => a.extname(e) === ".py"),
|
|
415
|
-
shellFiles: this.filterByExtension(e,
|
|
416
|
+
shellFiles: this.filterByExtension(e, k),
|
|
416
417
|
sourceFiles: n,
|
|
417
|
-
sqlFiles: this.filterByExtension(e,
|
|
418
|
-
testFiles: n.filter((e) =>
|
|
419
|
-
tomlFiles: this.filterByExtension(e,
|
|
420
|
-
tsFiles: n.filter((e) =>
|
|
421
|
-
yamlFiles: this.filterByExtension(e,
|
|
418
|
+
sqlFiles: this.filterByExtension(e, A),
|
|
419
|
+
testFiles: n.filter((e) => P.test(e)),
|
|
420
|
+
tomlFiles: this.filterByExtension(e, j),
|
|
421
|
+
tsFiles: n.filter((e) => T.has(a.extname(e))),
|
|
422
|
+
yamlFiles: this.filterByExtension(e, M)
|
|
422
423
|
};
|
|
423
424
|
}
|
|
424
425
|
discoverFiles(e) {
|
|
425
426
|
return this.categorize(this.listDiscoveredFiles(e));
|
|
426
427
|
}
|
|
427
428
|
};
|
|
428
|
-
|
|
429
|
+
L = I = __decorate([n(), __decorateMetadata("design:paramtypes", [F === void 0 ? Object : F, S === void 0 ? Object : S])], L);
|
|
429
430
|
//#endregion
|
|
430
431
|
//#region packages/ic-suite/codometer/codometer-measurement/src/modules/discovery/discovery.module.ts
|
|
431
|
-
var
|
|
432
|
-
|
|
432
|
+
var R = class DiscoveryModule {};
|
|
433
|
+
R = __decorate([r({
|
|
433
434
|
controllers: [],
|
|
434
|
-
exports: [
|
|
435
|
-
imports: [
|
|
436
|
-
providers: [
|
|
437
|
-
})],
|
|
435
|
+
exports: [L],
|
|
436
|
+
imports: [C],
|
|
437
|
+
providers: [L, F]
|
|
438
|
+
})], R);
|
|
438
439
|
//#endregion
|
|
439
440
|
//#region packages/ic-suite/codometer/codometer-measurement/src/modules/inputs/inputs.constants.ts
|
|
440
|
-
var
|
|
441
|
+
var z = /[!*+?@[\]{}()]/, InputOutsideRepositoryError = class extends Error {
|
|
441
442
|
constructor(e, t, n) {
|
|
442
443
|
super(`Input "${e}" starts at ${t}, which is outside ${n}. An input may reach out of the measured folder but not out of the repository holding it — write its directory relative to something inside.`), this.name = "InputOutsideRepositoryError";
|
|
443
444
|
}
|
|
444
|
-
}, B, V = B = class {
|
|
445
|
+
}, B, V = B = class InputsService {
|
|
445
446
|
logger;
|
|
446
447
|
constructor(e) {
|
|
447
448
|
this.logger = e, this.logger.setContext(B.name);
|
|
@@ -504,7 +505,7 @@ var R = /[!*+?@[\]{}()]/, z = class extends Error {
|
|
|
504
505
|
toIncludeBase(e) {
|
|
505
506
|
let t = [];
|
|
506
507
|
for (let n of e.split("/")) {
|
|
507
|
-
if (
|
|
508
|
+
if (z.test(n)) break;
|
|
508
509
|
t.push(n);
|
|
509
510
|
}
|
|
510
511
|
return t.join("/");
|
|
@@ -523,7 +524,7 @@ var R = /[!*+?@[\]{}()]/, z = class extends Error {
|
|
|
523
524
|
}
|
|
524
525
|
matchFiles(e) {
|
|
525
526
|
let t = a.resolve(e.workingDirectory, e.input.directory), n = this.findBoundary(e.workingDirectory);
|
|
526
|
-
if (!this.sitsInsideBoundary(n, t)) throw new
|
|
527
|
+
if (!this.sitsInsideBoundary(n, t)) throw new InputOutsideRepositoryError(e.input.name, t, n);
|
|
527
528
|
let r = this.readInputPrefix(t, e.workingDirectory), i = this.walk({
|
|
528
529
|
absoluteDirectory: t,
|
|
529
530
|
includeBases: e.input.include.map((e) => this.toIncludeBase(e)),
|
|
@@ -533,30 +534,30 @@ var R = /[!*+?@[\]{}()]/, z = class extends Error {
|
|
|
533
534
|
return r === "" ? i : i.map((e) => `${r}/${e}`);
|
|
534
535
|
}
|
|
535
536
|
};
|
|
536
|
-
V = B =
|
|
537
|
+
V = B = __decorate([n(), __decorateMetadata("design:paramtypes", [S === void 0 ? Object : S])], V);
|
|
537
538
|
//#endregion
|
|
538
539
|
//#region packages/ic-suite/codometer/codometer-measurement/src/modules/inputs/inputs.module.ts
|
|
539
|
-
var H = class {};
|
|
540
|
-
H =
|
|
540
|
+
var H = class InputsModule {};
|
|
541
|
+
H = __decorate([r({
|
|
541
542
|
controllers: [],
|
|
542
543
|
exports: [V],
|
|
543
|
-
imports: [
|
|
544
|
+
imports: [C],
|
|
544
545
|
providers: [V]
|
|
545
546
|
})], H);
|
|
546
547
|
//#endregion
|
|
547
548
|
//#region packages/ic-suite/codometer/codometer-measurement/src/modules/limits/limits.constants.ts
|
|
548
|
-
var
|
|
549
|
+
var U = "files", W = "custom", G = "size", EmptyTargetError = class extends Error {
|
|
549
550
|
constructor(e, t) {
|
|
550
551
|
super(`Input "${e}" matched no files, and a limit is written against its "${t}" metric. A limit says the files are there, so an empty match is a glob that stopped matching or a build that never ran — not a measurement of zero.`), this.name = "EmptyTargetError";
|
|
551
552
|
}
|
|
552
|
-
},
|
|
553
|
+
}, UnboundMetricError = class extends Error {
|
|
553
554
|
constructor(e, t) {
|
|
554
555
|
super(`Cannot bind the limit written against "${e}": ${t}`), this.name = "UnboundMetricError";
|
|
555
556
|
}
|
|
556
|
-
},
|
|
557
|
+
}, K = class LimitsService {
|
|
557
558
|
constructor() {}
|
|
558
559
|
bind(e) {
|
|
559
|
-
if (e.index.ambiguous.has(e.metricPath)) throw new
|
|
560
|
+
if (e.index.ambiguous.has(e.metricPath)) throw new UnboundMetricError(e.path, `the "${e.target}" target measured more than one metric called "${e.metricPath}". Two configured statistics sharing a label is how that happens — rename one of them.`);
|
|
560
561
|
let t = e.index.metrics.get(e.metricPath);
|
|
561
562
|
return t === void 0 ? void 0 : {
|
|
562
563
|
files: e.index.files,
|
|
@@ -593,7 +594,7 @@ var de = "files", fe = "custom", pe = "size", U = class extends Error {
|
|
|
593
594
|
findDefaultCandidate(e) {
|
|
594
595
|
if (e.defaultInput === void 0) return;
|
|
595
596
|
let t = e.indexes.get(e.defaultInput);
|
|
596
|
-
if (t === void 0) throw new
|
|
597
|
+
if (t === void 0) throw new UnboundMetricError(e.path, `the configured default input "${e.defaultInput}" was never measured. Measured targets: ${this.describeTargets(e.indexes)}.`);
|
|
597
598
|
return this.bind({
|
|
598
599
|
index: t,
|
|
599
600
|
metricPath: e.path,
|
|
@@ -603,12 +604,12 @@ var de = "files", fe = "custom", pe = "size", U = class extends Error {
|
|
|
603
604
|
}
|
|
604
605
|
resolve(e) {
|
|
605
606
|
let t = this.findCandidates(e), [n] = t;
|
|
606
|
-
if (n === void 0) throw new
|
|
607
|
+
if (n === void 0) throw new UnboundMetricError(e.path, `nothing measured answers to it. Measured targets: ${this.describeTargets(e.indexes)}. Write the target's name in front of the metric path, or configure a default input.`);
|
|
607
608
|
if (t.length > 1) {
|
|
608
609
|
let n = t.map((e) => this.describeBinding(e)).join(", or ");
|
|
609
|
-
throw new
|
|
610
|
+
throw new UnboundMetricError(e.path, `it could be ${n}. Write the target's name in front of the one it means.`);
|
|
610
611
|
}
|
|
611
|
-
if (n.files === 0) throw new
|
|
612
|
+
if (n.files === 0) throw new EmptyTargetError(n.target, n.metric);
|
|
612
613
|
return n;
|
|
613
614
|
}
|
|
614
615
|
evaluate(e) {
|
|
@@ -640,10 +641,10 @@ var de = "files", fe = "custom", pe = "size", U = class extends Error {
|
|
|
640
641
|
};
|
|
641
642
|
}
|
|
642
643
|
};
|
|
643
|
-
|
|
644
|
+
K = __decorate([n(), __decorateMetadata("design:paramtypes", [])], K);
|
|
644
645
|
//#endregion
|
|
645
646
|
//#region packages/ic-suite/codometer/codometer-measurement/src/modules/limits/metric-index.service.ts
|
|
646
|
-
var
|
|
647
|
+
var q = class MetricIndexService {
|
|
647
648
|
constructor() {}
|
|
648
649
|
addMetric(e) {
|
|
649
650
|
if (e.index.metrics.has(e.metricPath)) {
|
|
@@ -661,11 +662,11 @@ var K = class {
|
|
|
661
662
|
};
|
|
662
663
|
return this.addMetric({
|
|
663
664
|
index: t,
|
|
664
|
-
metricPath:
|
|
665
|
+
metricPath: U,
|
|
665
666
|
value: e.files
|
|
666
667
|
}), e.size !== void 0 && this.addMetric({
|
|
667
668
|
index: t,
|
|
668
|
-
metricPath:
|
|
669
|
+
metricPath: G,
|
|
669
670
|
value: e.size.bytes
|
|
670
671
|
}), e.language !== void 0 && this.indexLanguage(t, e.language), t;
|
|
671
672
|
}
|
|
@@ -691,7 +692,7 @@ var K = class {
|
|
|
691
692
|
for (let t of n) this.addMetric({
|
|
692
693
|
index: e,
|
|
693
694
|
instances: t.instances,
|
|
694
|
-
metricPath: `${
|
|
695
|
+
metricPath: `${W}.${t.label}`,
|
|
695
696
|
value: t.count
|
|
696
697
|
});
|
|
697
698
|
}
|
|
@@ -713,29 +714,29 @@ var K = class {
|
|
|
713
714
|
};
|
|
714
715
|
}
|
|
715
716
|
};
|
|
716
|
-
|
|
717
|
+
q = __decorate([n(), __decorateMetadata("design:paramtypes", [])], q);
|
|
717
718
|
//#endregion
|
|
718
719
|
//#region packages/ic-suite/codometer/codometer-measurement/src/modules/limits/limits.module.ts
|
|
719
|
-
var
|
|
720
|
-
|
|
720
|
+
var J = class LimitsModule {};
|
|
721
|
+
J = __decorate([r({
|
|
721
722
|
controllers: [],
|
|
722
|
-
exports: [
|
|
723
|
+
exports: [K, q],
|
|
723
724
|
imports: [],
|
|
724
|
-
providers: [
|
|
725
|
-
})],
|
|
726
|
-
var
|
|
725
|
+
providers: [K, q]
|
|
726
|
+
})], J);
|
|
727
|
+
var ce = { params: { [re.BROTLI_PARAM_QUALITY]: 11 } }, UnreadableTargetFileError = class extends Error {
|
|
727
728
|
constructor(e, t) {
|
|
728
729
|
super(`Cannot measure ${e}: ${t}`), this.name = "UnreadableTargetFileError";
|
|
729
730
|
}
|
|
730
|
-
}, Y, X = Y = class {
|
|
731
|
+
}, Y, X = Y = class SizeService {
|
|
731
732
|
logger;
|
|
732
733
|
constructor(e) {
|
|
733
734
|
this.logger = e, this.logger.setContext(Y.name);
|
|
734
735
|
}
|
|
735
736
|
compress(e, t) {
|
|
736
737
|
return {
|
|
737
|
-
brotli: () =>
|
|
738
|
-
gzip: () =>
|
|
738
|
+
brotli: () => ne(e, ce).length,
|
|
739
|
+
gzip: () => g(e, { level: 9 }).length,
|
|
739
740
|
none: () => e.length
|
|
740
741
|
}[t]();
|
|
741
742
|
}
|
|
@@ -746,7 +747,7 @@ var me = { params: { [_.BROTLI_PARAM_QUALITY]: 11 } }, J = class extends Error {
|
|
|
746
747
|
throw this.logger.error("🗜️ Failed to measure a target file", void 0, {
|
|
747
748
|
path: e,
|
|
748
749
|
reason: t instanceof Error ? t.message : String(t)
|
|
749
|
-
}), new
|
|
750
|
+
}), new UnreadableTargetFileError(e, String(t));
|
|
750
751
|
}
|
|
751
752
|
}
|
|
752
753
|
analyze(e) {
|
|
@@ -759,19 +760,19 @@ var me = { params: { [_.BROTLI_PARAM_QUALITY]: 11 } }, J = class extends Error {
|
|
|
759
760
|
};
|
|
760
761
|
}
|
|
761
762
|
};
|
|
762
|
-
X = Y =
|
|
763
|
+
X = Y = __decorate([n(), __decorateMetadata("design:paramtypes", [S === void 0 ? Object : S])], X);
|
|
763
764
|
//#endregion
|
|
764
765
|
//#region packages/ic-suite/codometer/codometer-measurement/src/modules/size/size.module.ts
|
|
765
|
-
var Z = class {};
|
|
766
|
-
Z =
|
|
766
|
+
var Z = class SizeModule {};
|
|
767
|
+
Z = __decorate([r({
|
|
767
768
|
controllers: [],
|
|
768
769
|
exports: [X],
|
|
769
|
-
imports: [
|
|
770
|
+
imports: [C],
|
|
770
771
|
providers: [X]
|
|
771
772
|
})], Z);
|
|
772
773
|
//#endregion
|
|
773
774
|
//#region packages/ic-suite/codometer/codometer-measurement/src/modules/measure/measure.constants.ts
|
|
774
|
-
var
|
|
775
|
+
var le = {
|
|
775
776
|
css: {
|
|
776
777
|
atRules: 0,
|
|
777
778
|
comments: 0,
|
|
@@ -943,7 +944,7 @@ var he = {
|
|
|
943
944
|
scalars: 0,
|
|
944
945
|
sequences: 0
|
|
945
946
|
}
|
|
946
|
-
}, Q = class {
|
|
947
|
+
}, Q = class MeasureService {
|
|
947
948
|
discoveryService;
|
|
948
949
|
languagesService;
|
|
949
950
|
customizationService;
|
|
@@ -1115,36 +1116,36 @@ var he = {
|
|
|
1115
1116
|
indexes: s,
|
|
1116
1117
|
inputs: a,
|
|
1117
1118
|
limits: c.limits,
|
|
1118
|
-
statistics: l?.language ??
|
|
1119
|
+
statistics: l?.language ?? le
|
|
1119
1120
|
};
|
|
1120
1121
|
}
|
|
1121
1122
|
};
|
|
1122
|
-
Q =
|
|
1123
|
-
|
|
1123
|
+
Q = __decorate([n(), __decorateMetadata("design:paramtypes", [
|
|
1124
|
+
L === void 0 ? Object : L,
|
|
1124
1125
|
h === void 0 ? Object : h,
|
|
1125
|
-
|
|
1126
|
+
_ === void 0 ? Object : _,
|
|
1126
1127
|
V === void 0 ? Object : V,
|
|
1127
1128
|
X === void 0 ? Object : X,
|
|
1128
|
-
|
|
1129
|
-
|
|
1129
|
+
K === void 0 ? Object : K,
|
|
1130
|
+
q === void 0 ? Object : q
|
|
1130
1131
|
])], Q);
|
|
1131
1132
|
//#endregion
|
|
1132
1133
|
//#region packages/ic-suite/codometer/codometer-measurement/src/modules/measure/measure.module.ts
|
|
1133
|
-
var $ = class {};
|
|
1134
|
-
$ =
|
|
1134
|
+
var $ = class MeasureModule {};
|
|
1135
|
+
$ = __decorate([r({
|
|
1135
1136
|
controllers: [],
|
|
1136
1137
|
exports: [Q],
|
|
1137
1138
|
imports: [
|
|
1138
1139
|
p,
|
|
1139
|
-
|
|
1140
|
-
|
|
1140
|
+
v,
|
|
1141
|
+
R,
|
|
1141
1142
|
H,
|
|
1142
1143
|
te,
|
|
1143
|
-
|
|
1144
|
-
|
|
1144
|
+
J,
|
|
1145
|
+
C,
|
|
1145
1146
|
Z
|
|
1146
1147
|
],
|
|
1147
1148
|
providers: [Q]
|
|
1148
1149
|
})], $);
|
|
1149
1150
|
//#endregion
|
|
1150
|
-
export {
|
|
1151
|
+
export { v as CustomizationModule, _ as CustomizationService, R as DiscoveryModule, L as DiscoveryService, EmptyTargetError, InputOutsideRepositoryError, H as InputsModule, V as InputsService, J as LimitsModule, K as LimitsService, $ as MeasureModule, Q as MeasureService, q as MetricIndexService, Z as SizeModule, X as SizeService, UnboundMetricError, UnreadableTargetFileError };
|
package/package.json
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
"url": "https://github.com/organizzolini/codebase/issues"
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@codometer/configuration": "0.0.
|
|
8
|
-
"@codometer/core": "0.0.
|
|
9
|
-
"@codometer/languages": "0.0.
|
|
7
|
+
"@codometer/configuration": "0.0.10",
|
|
8
|
+
"@codometer/core": "0.0.10",
|
|
9
|
+
"@codometer/languages": "0.0.10",
|
|
10
10
|
"@nestjs/common": "^11.1.21 || ^12.0.1",
|
|
11
11
|
"ignore": "7.0.12",
|
|
12
12
|
"pino": "^10.3.1",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"strict": true
|
|
64
64
|
},
|
|
65
65
|
"types": "./dist/src/index.d.ts",
|
|
66
|
-
"version": "0.0.
|
|
66
|
+
"version": "0.0.10"
|
|
67
67
|
}
|