@code-pushup/coverage-plugin 0.39.0 → 0.42.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/index.js CHANGED
@@ -2,8 +2,277 @@
2
2
  import { dirname as dirname2, join as join3 } from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
 
5
- // packages/models/src/lib/audit.ts
6
- import { z as z2 } from "zod";
5
+ // packages/utils/src/lib/text-formats/constants.ts
6
+ var NEW_LINE = "\n";
7
+ var TAB = " ";
8
+
9
+ // packages/utils/src/lib/text-formats/html/details.ts
10
+ function details(title, content, cfg = { open: false }) {
11
+ return `<details${cfg.open ? " open" : ""}>${NEW_LINE}<summary>${title}</summary>${NEW_LINE}${// ⚠️ The blank line is needed to ensure Markdown in content is rendered correctly.
12
+ NEW_LINE}${content}${NEW_LINE}${// @TODO in the future we could consider adding it only if the content ends with a code block
13
+ // ⚠️ The blank line ensure Markdown in content is rendered correctly.
14
+ NEW_LINE}</details>${// ⚠️ The blank line is needed to ensure Markdown after details is rendered correctly.
15
+ NEW_LINE}`;
16
+ }
17
+
18
+ // packages/utils/src/lib/text-formats/html/font-style.ts
19
+ var boldElement = "b";
20
+ function bold(text) {
21
+ return `<${boldElement}>${text}</${boldElement}>`;
22
+ }
23
+ var italicElement = "i";
24
+ function italic(text) {
25
+ return `<${italicElement}>${text}</${italicElement}>`;
26
+ }
27
+ var codeElement = "code";
28
+ function code(text) {
29
+ return `<${codeElement}>${text}</${codeElement}>`;
30
+ }
31
+
32
+ // packages/utils/src/lib/text-formats/html/link.ts
33
+ function link(href, text) {
34
+ return `<a href="${href}">${text || href}"</a>`;
35
+ }
36
+
37
+ // packages/utils/src/lib/transform.ts
38
+ function capitalize(text) {
39
+ return `${text.charAt(0).toLocaleUpperCase()}${text.slice(
40
+ 1
41
+ )}`;
42
+ }
43
+
44
+ // packages/utils/src/lib/table.ts
45
+ function rowToStringArray({ rows, columns = [] }) {
46
+ if (Array.isArray(rows.at(0)) && typeof columns.at(0) === "object") {
47
+ throw new TypeError(
48
+ "Column can`t be object when rows are primitive values"
49
+ );
50
+ }
51
+ return rows.map((row) => {
52
+ if (Array.isArray(row)) {
53
+ return row.map(String);
54
+ }
55
+ const objectRow = row;
56
+ if (columns.length === 0 || typeof columns.at(0) === "string") {
57
+ return Object.values(objectRow).map(String);
58
+ }
59
+ return columns.map(
60
+ ({ key }) => String(objectRow[key])
61
+ );
62
+ });
63
+ }
64
+ function columnsToStringArray({ rows, columns = [] }) {
65
+ const firstRow = rows.at(0);
66
+ const primitiveRows = Array.isArray(firstRow);
67
+ if (typeof columns.at(0) === "string" && !primitiveRows) {
68
+ throw new Error("invalid union type. Caught by model parsing.");
69
+ }
70
+ if (columns.length === 0) {
71
+ if (Array.isArray(firstRow)) {
72
+ return firstRow.map((_, idx) => String(idx));
73
+ }
74
+ return Object.keys(firstRow);
75
+ }
76
+ if (typeof columns.at(0) === "string") {
77
+ return columns.map(String);
78
+ }
79
+ const cols = columns;
80
+ return cols.map(({ label, key }) => label ?? capitalize(key));
81
+ }
82
+ function getColumnAlignmentForKeyAndIndex(targetKey, targetIdx, columns = []) {
83
+ const column = columns.at(targetIdx) ?? columns.find((col) => col.key === targetKey);
84
+ if (typeof column === "string") {
85
+ return column;
86
+ } else if (typeof column === "object") {
87
+ return column.align ?? "center";
88
+ } else {
89
+ return "center";
90
+ }
91
+ }
92
+ function getColumnAlignmentForIndex(targetIdx, columns = []) {
93
+ const column = columns.at(targetIdx);
94
+ if (column == null) {
95
+ return "center";
96
+ } else if (typeof column === "string") {
97
+ return column;
98
+ } else if (typeof column === "object") {
99
+ return column.align ?? "center";
100
+ } else {
101
+ return "center";
102
+ }
103
+ }
104
+ function getColumnAlignments({
105
+ rows,
106
+ columns = []
107
+ }) {
108
+ if (rows.at(0) == null) {
109
+ throw new Error("first row can`t be undefined.");
110
+ }
111
+ if (Array.isArray(rows.at(0))) {
112
+ const firstPrimitiveRow = rows.at(0);
113
+ return Array.from({ length: firstPrimitiveRow.length }).map(
114
+ (_, idx) => getColumnAlignmentForIndex(idx, columns)
115
+ );
116
+ }
117
+ const firstObject = rows.at(0);
118
+ return Object.keys(firstObject).map(
119
+ (key, idx) => getColumnAlignmentForKeyAndIndex(key, idx, columns)
120
+ );
121
+ }
122
+
123
+ // packages/utils/src/lib/text-formats/html/table.ts
124
+ function wrap(elem, content) {
125
+ return `<${elem}>${content}</${elem}>${NEW_LINE}`;
126
+ }
127
+ function wrapRow(content) {
128
+ const elem = "tr";
129
+ return `<${elem}>${NEW_LINE}${content}</${elem}>${NEW_LINE}`;
130
+ }
131
+ function table(tableData) {
132
+ if (tableData.rows.length === 0) {
133
+ throw new Error("Data can't be empty");
134
+ }
135
+ const tableHeaderCols = columnsToStringArray(tableData).map((s) => wrap("th", s)).join("");
136
+ const tableHeaderRow = wrapRow(tableHeaderCols);
137
+ const tableBody = rowToStringArray(tableData).map((arr) => {
138
+ const columns = arr.map((s) => wrap("td", s)).join("");
139
+ return wrapRow(columns);
140
+ }).join("");
141
+ return wrap("table", `${NEW_LINE}${tableHeaderRow}${tableBody}`);
142
+ }
143
+
144
+ // packages/utils/src/lib/text-formats/md/font-style.ts
145
+ var boldWrap = "**";
146
+ function bold2(text) {
147
+ return `${boldWrap}${text}${boldWrap}`;
148
+ }
149
+ var italicWrap = "_";
150
+ function italic2(text) {
151
+ return `${italicWrap}${text}${italicWrap}`;
152
+ }
153
+ var strikeThroughWrap = "~";
154
+ function strikeThrough(text) {
155
+ return `${strikeThroughWrap}${text}${strikeThroughWrap}`;
156
+ }
157
+ var codeWrap = "`";
158
+ function code2(text) {
159
+ return `${codeWrap}${text}${codeWrap}`;
160
+ }
161
+
162
+ // packages/utils/src/lib/text-formats/md/headline.ts
163
+ function headline(text, hierarchy = 1) {
164
+ return `${"#".repeat(hierarchy)} ${text}${NEW_LINE}`;
165
+ }
166
+ function h(text, hierarchy = 1) {
167
+ return headline(text, hierarchy);
168
+ }
169
+ function h1(text) {
170
+ return headline(text, 1);
171
+ }
172
+ function h2(text) {
173
+ return headline(text, 2);
174
+ }
175
+ function h3(text) {
176
+ return headline(text, 3);
177
+ }
178
+ function h4(text) {
179
+ return headline(text, 4);
180
+ }
181
+ function h5(text) {
182
+ return headline(text, 5);
183
+ }
184
+ function h6(text) {
185
+ return headline(text, 6);
186
+ }
187
+
188
+ // packages/utils/src/lib/text-formats/md/image.ts
189
+ function image(src, alt) {
190
+ return `![${alt}](${src})`;
191
+ }
192
+
193
+ // packages/utils/src/lib/text-formats/md/link.ts
194
+ function link2(href, text) {
195
+ return `[${text || href}](${href})`;
196
+ }
197
+
198
+ // packages/utils/src/lib/text-formats/md/list.ts
199
+ function li(text, order = "unordered") {
200
+ const style = order === "unordered" ? "-" : "- [ ]";
201
+ return `${style} ${text}`;
202
+ }
203
+ function indentation(text, level = 1) {
204
+ return `${TAB.repeat(level)}${text}`;
205
+ }
206
+
207
+ // packages/utils/src/lib/text-formats/md/paragraphs.ts
208
+ function paragraphs(...sections) {
209
+ return sections.filter(Boolean).join(`${NEW_LINE}${NEW_LINE}`);
210
+ }
211
+
212
+ // packages/utils/src/lib/text-formats/md/section.ts
213
+ function section(...contents) {
214
+ return `${lines(...contents)}${NEW_LINE}`;
215
+ }
216
+ function lines(...contents) {
217
+ return `${contents.filter(Boolean).join(NEW_LINE)}`;
218
+ }
219
+
220
+ // packages/utils/src/lib/text-formats/md/table.ts
221
+ var alignString = /* @__PURE__ */ new Map([
222
+ ["left", ":--"],
223
+ ["center", ":--:"],
224
+ ["right", "--:"]
225
+ ]);
226
+ function tableRow(rows) {
227
+ return `|${rows.join("|")}|`;
228
+ }
229
+ function table2(data) {
230
+ if (data.rows.length === 0) {
231
+ throw new Error("Data can't be empty");
232
+ }
233
+ const alignmentRow = getColumnAlignments(data).map(
234
+ (s) => alignString.get(s) ?? String(alignString.get("center"))
235
+ );
236
+ return section(
237
+ `${lines(
238
+ tableRow(columnsToStringArray(data)),
239
+ tableRow(alignmentRow),
240
+ ...rowToStringArray(data).map(tableRow)
241
+ )}`
242
+ );
243
+ }
244
+
245
+ // packages/utils/src/lib/text-formats/index.ts
246
+ var md = {
247
+ bold: bold2,
248
+ italic: italic2,
249
+ strikeThrough,
250
+ code: code2,
251
+ link: link2,
252
+ image,
253
+ headline,
254
+ h,
255
+ h1,
256
+ h2,
257
+ h3,
258
+ h4,
259
+ h5,
260
+ h6,
261
+ indentation,
262
+ lines,
263
+ li,
264
+ section,
265
+ paragraphs,
266
+ table: table2
267
+ };
268
+ var html = {
269
+ bold,
270
+ italic,
271
+ code,
272
+ link,
273
+ details,
274
+ table
275
+ };
7
276
 
8
277
  // packages/models/src/lib/implementation/schemas.ts
9
278
  import { MATERIAL_ICONS } from "vscode-material-icons";
@@ -70,6 +339,7 @@ function missingRefsForCategoriesErrorMsg(categories, plugins) {
70
339
  }
71
340
 
72
341
  // packages/models/src/lib/implementation/schemas.ts
342
+ var primitiveValueSchema = z.union([z.string(), z.number()]);
73
343
  function executionMetaSchema(options = {
74
344
  descriptionDate: "Execution start date and time",
75
345
  descriptionDuration: "Execution duration in ms"
@@ -161,6 +431,7 @@ function hasNonZeroWeightedRef(refs) {
161
431
  }
162
432
 
163
433
  // packages/models/src/lib/audit.ts
434
+ import { z as z2 } from "zod";
164
435
  var auditSchema = z2.object({
165
436
  slug: slugSchema.describe("ID (unique within plugin)")
166
437
  }).merge(
@@ -190,7 +461,7 @@ function getDuplicateSlugsInAudits(audits) {
190
461
  }
191
462
 
192
463
  // packages/models/src/lib/audit-output.ts
193
- import { z as z4 } from "zod";
464
+ import { z as z5 } from "zod";
194
465
 
195
466
  // packages/models/src/lib/issue.ts
196
467
  import { z as z3 } from "zod";
@@ -221,16 +492,61 @@ var issueSchema = z3.object(
221
492
  { description: "Issue information" }
222
493
  );
223
494
 
495
+ // packages/models/src/lib/table.ts
496
+ import { z as z4 } from "zod";
497
+ var tableAlignmentSchema = z4.enum(["left", "center", "right"], {
498
+ description: "Cell alignment"
499
+ });
500
+ var tableColumnObjectSchema = z4.object({
501
+ key: z4.string(),
502
+ label: z4.string().optional(),
503
+ align: tableAlignmentSchema.optional()
504
+ });
505
+ var tableRowObjectSchema = z4.record(primitiveValueSchema, {
506
+ description: "Object row"
507
+ });
508
+ var tableRowPrimitiveSchema = z4.array(primitiveValueSchema, {
509
+ description: "Primitive row"
510
+ });
511
+ var tableSharedSchema = z4.object({
512
+ title: z4.string().optional().describe("Display title for table")
513
+ });
514
+ var tablePrimitiveSchema = tableSharedSchema.merge(
515
+ z4.object(
516
+ {
517
+ columns: z4.array(tableAlignmentSchema).optional(),
518
+ rows: z4.array(tableRowPrimitiveSchema)
519
+ },
520
+ { description: "Table with primitive rows and optional alignment columns" }
521
+ )
522
+ );
523
+ var tableObjectSchema = tableSharedSchema.merge(
524
+ z4.object(
525
+ {
526
+ columns: z4.union([
527
+ z4.array(tableAlignmentSchema),
528
+ z4.array(tableColumnObjectSchema)
529
+ ]).optional(),
530
+ rows: z4.array(tableRowObjectSchema)
531
+ },
532
+ {
533
+ description: "Table with object rows and optional alignment or object columns"
534
+ }
535
+ )
536
+ );
537
+ var tableSchema = (description = "Table information") => z4.union([tablePrimitiveSchema, tableObjectSchema], { description });
538
+
224
539
  // packages/models/src/lib/audit-output.ts
225
540
  var auditValueSchema = nonnegativeIntSchema.describe("Raw numeric value");
226
- var auditDisplayValueSchema = z4.string({ description: "Formatted value (e.g. '0.9 s', '2.1 MB')" }).optional();
227
- var auditDetailsSchema = z4.object(
541
+ var auditDisplayValueSchema = z5.string({ description: "Formatted value (e.g. '0.9 s', '2.1 MB')" }).optional();
542
+ var auditDetailsSchema = z5.object(
228
543
  {
229
- issues: z4.array(issueSchema, { description: "List of findings" })
544
+ issues: z5.array(issueSchema, { description: "List of findings" }).optional(),
545
+ table: tableSchema("Table of related findings").optional()
230
546
  },
231
547
  { description: "Detailed information" }
232
548
  );
233
- var auditOutputSchema = z4.object(
549
+ var auditOutputSchema = z5.object(
234
550
  {
235
551
  slug: slugSchema.describe("Reference to audit"),
236
552
  displayValue: auditDisplayValueSchema,
@@ -240,7 +556,7 @@ var auditOutputSchema = z4.object(
240
556
  },
241
557
  { description: "Audit information" }
242
558
  );
243
- var auditOutputsSchema = z4.array(auditOutputSchema, {
559
+ var auditOutputsSchema = z5.array(auditOutputSchema, {
244
560
  description: "List of JSON formatted audit output emitted by the runner process of a plugin"
245
561
  }).refine(
246
562
  (audits) => !getDuplicateSlugsInAudits2(audits),
@@ -257,13 +573,13 @@ function getDuplicateSlugsInAudits2(audits) {
257
573
  }
258
574
 
259
575
  // packages/models/src/lib/category-config.ts
260
- import { z as z5 } from "zod";
576
+ import { z as z6 } from "zod";
261
577
  var categoryRefSchema = weightedRefSchema(
262
578
  "Weighted references to audits and/or groups for the category",
263
579
  "Slug of an audit or group (depending on `type`)"
264
580
  ).merge(
265
- z5.object({
266
- type: z5.enum(["audit", "group"], {
581
+ z6.object({
582
+ type: z6.enum(["audit", "group"], {
267
583
  description: "Discriminant for reference kind, affects where `slug` is looked up"
268
584
  }),
269
585
  plugin: slugSchema.describe(
@@ -284,8 +600,8 @@ var categoryConfigSchema = scorableSchema(
284
600
  description: "Meta info for category"
285
601
  })
286
602
  ).merge(
287
- z5.object({
288
- isBinary: z5.boolean({
603
+ z6.object({
604
+ isBinary: z6.boolean({
289
605
  description: 'Is this a binary category (i.e. only a perfect score considered a "pass")?'
290
606
  }).optional()
291
607
  })
@@ -301,7 +617,7 @@ function getDuplicateRefsInCategoryMetrics(metrics) {
301
617
  metrics.map(({ slug, type, plugin }) => `${type} :: ${plugin} / ${slug}`)
302
618
  );
303
619
  }
304
- var categoriesSchema = z5.array(categoryConfigSchema, {
620
+ var categoriesSchema = z6.array(categoryConfigSchema, {
305
621
  description: "Categorization of individual audits"
306
622
  }).refine(
307
623
  (categoryCfg) => !getDuplicateSlugCategories(categoryCfg),
@@ -320,18 +636,18 @@ function getDuplicateSlugCategories(categories) {
320
636
  }
321
637
 
322
638
  // packages/models/src/lib/commit.ts
323
- import { z as z6 } from "zod";
324
- var commitSchema = z6.object(
639
+ import { z as z7 } from "zod";
640
+ var commitSchema = z7.object(
325
641
  {
326
- hash: z6.string({ description: "Commit SHA (full)" }).regex(
642
+ hash: z7.string({ description: "Commit SHA (full)" }).regex(
327
643
  /^[\da-f]{40}$/,
328
644
  "Commit SHA should be a 40-character hexadecimal string"
329
645
  ),
330
- message: z6.string({ description: "Commit message" }),
331
- date: z6.coerce.date({
646
+ message: z7.string({ description: "Commit message" }),
647
+ date: z7.coerce.date({
332
648
  description: "Date and time when commit was authored"
333
649
  }),
334
- author: z6.string({
650
+ author: z7.string({
335
651
  description: "Commit author name"
336
652
  }).trim()
337
653
  },
@@ -339,22 +655,22 @@ var commitSchema = z6.object(
339
655
  );
340
656
 
341
657
  // packages/models/src/lib/core-config.ts
342
- import { z as z12 } from "zod";
658
+ import { z as z13 } from "zod";
343
659
 
344
660
  // packages/models/src/lib/persist-config.ts
345
- import { z as z7 } from "zod";
346
- var formatSchema = z7.enum(["json", "md"]);
347
- var persistConfigSchema = z7.object({
661
+ import { z as z8 } from "zod";
662
+ var formatSchema = z8.enum(["json", "md"]);
663
+ var persistConfigSchema = z8.object({
348
664
  outputDir: filePathSchema.describe("Artifacts folder").optional(),
349
665
  filename: fileNameSchema.describe("Artifacts file name (without extension)").optional(),
350
- format: z7.array(formatSchema).optional()
666
+ format: z8.array(formatSchema).optional()
351
667
  });
352
668
 
353
669
  // packages/models/src/lib/plugin-config.ts
354
- import { z as z10 } from "zod";
670
+ import { z as z11 } from "zod";
355
671
 
356
672
  // packages/models/src/lib/group.ts
357
- import { z as z8 } from "zod";
673
+ import { z as z9 } from "zod";
358
674
  var groupRefSchema = weightedRefSchema(
359
675
  "Weighted reference to a group",
360
676
  "Reference slug to a group within this plugin (e.g. 'max-lines')"
@@ -371,7 +687,7 @@ var groupSchema = scorableSchema(
371
687
  getDuplicateRefsInGroups,
372
688
  duplicateRefsInGroupsErrorMsg
373
689
  ).merge(groupMetaSchema);
374
- var groupsSchema = z8.array(groupSchema, {
690
+ var groupsSchema = z9.array(groupSchema, {
375
691
  description: "List of groups"
376
692
  }).optional().refine(
377
693
  (groups) => !getDuplicateSlugsInGroups(groups),
@@ -399,14 +715,14 @@ function getDuplicateSlugsInGroups(groups) {
399
715
  }
400
716
 
401
717
  // packages/models/src/lib/runner-config.ts
402
- import { z as z9 } from "zod";
403
- var outputTransformSchema = z9.function().args(z9.unknown()).returns(z9.union([auditOutputsSchema, z9.promise(auditOutputsSchema)]));
404
- var runnerConfigSchema = z9.object(
718
+ import { z as z10 } from "zod";
719
+ var outputTransformSchema = z10.function().args(z10.unknown()).returns(z10.union([auditOutputsSchema, z10.promise(auditOutputsSchema)]));
720
+ var runnerConfigSchema = z10.object(
405
721
  {
406
- command: z9.string({
722
+ command: z10.string({
407
723
  description: "Shell command to execute"
408
724
  }),
409
- args: z9.array(z9.string({ description: "Command arguments" })).optional(),
725
+ args: z10.array(z10.string({ description: "Command arguments" })).optional(),
410
726
  outputFile: filePathSchema.describe("Output path"),
411
727
  outputTransform: outputTransformSchema.optional()
412
728
  },
@@ -414,8 +730,8 @@ var runnerConfigSchema = z9.object(
414
730
  description: "How to execute runner"
415
731
  }
416
732
  );
417
- var onProgressSchema = z9.function().args(z9.unknown()).returns(z9.void());
418
- var runnerFunctionSchema = z9.function().args(onProgressSchema.optional()).returns(z9.union([auditOutputsSchema, z9.promise(auditOutputsSchema)]));
733
+ var onProgressSchema = z10.function().args(z10.unknown()).returns(z10.void());
734
+ var runnerFunctionSchema = z10.function().args(onProgressSchema.optional()).returns(z10.union([auditOutputsSchema, z10.promise(auditOutputsSchema)]));
419
735
 
420
736
  // packages/models/src/lib/plugin-config.ts
421
737
  var pluginMetaSchema = packageVersionSchema().merge(
@@ -426,13 +742,13 @@ var pluginMetaSchema = packageVersionSchema().merge(
426
742
  description: "Plugin metadata"
427
743
  })
428
744
  ).merge(
429
- z10.object({
745
+ z11.object({
430
746
  slug: slugSchema.describe("Unique plugin slug within core config"),
431
747
  icon: materialIconSchema
432
748
  })
433
749
  );
434
- var pluginDataSchema = z10.object({
435
- runner: z10.union([runnerConfigSchema, runnerFunctionSchema]),
750
+ var pluginDataSchema = z11.object({
751
+ runner: z11.union([runnerConfigSchema, runnerFunctionSchema]),
436
752
  audits: pluginAuditsSchema,
437
753
  groups: groupsSchema
438
754
  });
@@ -458,22 +774,22 @@ function getMissingRefsFromGroups(pluginCfg) {
458
774
  }
459
775
 
460
776
  // packages/models/src/lib/upload-config.ts
461
- import { z as z11 } from "zod";
462
- var uploadConfigSchema = z11.object({
777
+ import { z as z12 } from "zod";
778
+ var uploadConfigSchema = z12.object({
463
779
  server: urlSchema.describe("URL of deployed portal API"),
464
- apiKey: z11.string({
780
+ apiKey: z12.string({
465
781
  description: "API key with write access to portal (use `process.env` for security)"
466
782
  }),
467
783
  organization: slugSchema.describe(
468
784
  "Organization slug from Code PushUp portal"
469
785
  ),
470
786
  project: slugSchema.describe("Project slug from Code PushUp portal"),
471
- timeout: z11.number({ description: "Request timeout in minutes (default is 5)" }).positive().int().optional()
787
+ timeout: z12.number({ description: "Request timeout in minutes (default is 5)" }).positive().int().optional()
472
788
  });
473
789
 
474
790
  // packages/models/src/lib/core-config.ts
475
- var unrefinedCoreConfigSchema = z12.object({
476
- plugins: z12.array(pluginConfigSchema, {
791
+ var unrefinedCoreConfigSchema = z13.object({
792
+ plugins: z13.array(pluginConfigSchema, {
477
793
  description: "List of plugins to be used (official, community-provided, or custom)"
478
794
  }).min(1),
479
795
  /** portal configuration for persisting results */
@@ -496,7 +812,7 @@ function refineCoreConfig(schema) {
496
812
  }
497
813
 
498
814
  // packages/models/src/lib/report.ts
499
- import { z as z13 } from "zod";
815
+ import { z as z14 } from "zod";
500
816
  var auditReportSchema = auditSchema.merge(auditOutputSchema);
501
817
  var pluginReportSchema = pluginMetaSchema.merge(
502
818
  executionMetaSchema({
@@ -504,9 +820,9 @@ var pluginReportSchema = pluginMetaSchema.merge(
504
820
  descriptionDuration: "Duration of the plugin run in ms"
505
821
  })
506
822
  ).merge(
507
- z13.object({
508
- audits: z13.array(auditReportSchema).min(1),
509
- groups: z13.array(groupSchema).optional()
823
+ z14.object({
824
+ audits: z14.array(auditReportSchema).min(1),
825
+ groups: z14.array(groupSchema).optional()
510
826
  })
511
827
  ).refine(
512
828
  (pluginReport) => !getMissingRefsFromGroups2(pluginReport.audits, pluginReport.groups ?? []),
@@ -540,10 +856,10 @@ var reportSchema = packageVersionSchema({
540
856
  descriptionDuration: "Duration of the collect run in ms"
541
857
  })
542
858
  ).merge(
543
- z13.object(
859
+ z14.object(
544
860
  {
545
- categories: z13.array(categoryConfigSchema),
546
- plugins: z13.array(pluginReportSchema).min(1),
861
+ categories: z14.array(categoryConfigSchema),
862
+ plugins: z14.array(pluginReportSchema).min(1),
547
863
  commit: commitSchema.describe("Git commit for which report was collected").nullable()
548
864
  },
549
865
  { description: "Collect output data" }
@@ -559,40 +875,40 @@ var reportSchema = packageVersionSchema({
559
875
  );
560
876
 
561
877
  // packages/models/src/lib/reports-diff.ts
562
- import { z as z14 } from "zod";
878
+ import { z as z15 } from "zod";
563
879
  function makeComparisonSchema(schema) {
564
880
  const sharedDescription = schema.description || "Result";
565
- return z14.object({
881
+ return z15.object({
566
882
  before: schema.describe(`${sharedDescription} (source commit)`),
567
883
  after: schema.describe(`${sharedDescription} (target commit)`)
568
884
  });
569
885
  }
570
886
  function makeArraysComparisonSchema(diffSchema, resultSchema, description) {
571
- return z14.object(
887
+ return z15.object(
572
888
  {
573
- changed: z14.array(diffSchema),
574
- unchanged: z14.array(resultSchema),
575
- added: z14.array(resultSchema),
576
- removed: z14.array(resultSchema)
889
+ changed: z15.array(diffSchema),
890
+ unchanged: z15.array(resultSchema),
891
+ added: z15.array(resultSchema),
892
+ removed: z15.array(resultSchema)
577
893
  },
578
894
  { description }
579
895
  );
580
896
  }
581
- var scorableMetaSchema = z14.object({
897
+ var scorableMetaSchema = z15.object({
582
898
  slug: slugSchema,
583
899
  title: titleSchema,
584
900
  docsUrl: docsUrlSchema
585
901
  });
586
902
  var scorableWithPluginMetaSchema = scorableMetaSchema.merge(
587
- z14.object({
903
+ z15.object({
588
904
  plugin: pluginMetaSchema.pick({ slug: true, title: true, docsUrl: true }).describe("Plugin which defines it")
589
905
  })
590
906
  );
591
907
  var scorableDiffSchema = scorableMetaSchema.merge(
592
- z14.object({
908
+ z15.object({
593
909
  scores: makeComparisonSchema(scoreSchema).merge(
594
- z14.object({
595
- diff: z14.number().min(-1).max(1).describe("Score change (`scores.after - scores.before`)")
910
+ z15.object({
911
+ diff: z15.number().min(-1).max(1).describe("Score change (`scores.after - scores.before`)")
596
912
  })
597
913
  ).describe("Score comparison")
598
914
  })
@@ -603,10 +919,10 @@ var scorableWithPluginDiffSchema = scorableDiffSchema.merge(
603
919
  var categoryDiffSchema = scorableDiffSchema;
604
920
  var groupDiffSchema = scorableWithPluginDiffSchema;
605
921
  var auditDiffSchema = scorableWithPluginDiffSchema.merge(
606
- z14.object({
922
+ z15.object({
607
923
  values: makeComparisonSchema(auditValueSchema).merge(
608
- z14.object({
609
- diff: z14.number().int().describe("Value change (`values.after - values.before`)")
924
+ z15.object({
925
+ diff: z15.number().int().describe("Value change (`values.after - values.before`)")
610
926
  })
611
927
  ).describe("Audit `value` comparison"),
612
928
  displayValues: makeComparisonSchema(auditDisplayValueSchema).describe(
@@ -615,15 +931,15 @@ var auditDiffSchema = scorableWithPluginDiffSchema.merge(
615
931
  })
616
932
  );
617
933
  var categoryResultSchema = scorableMetaSchema.merge(
618
- z14.object({ score: scoreSchema })
934
+ z15.object({ score: scoreSchema })
619
935
  );
620
936
  var groupResultSchema = scorableWithPluginMetaSchema.merge(
621
- z14.object({ score: scoreSchema })
937
+ z15.object({ score: scoreSchema })
622
938
  );
623
939
  var auditResultSchema = scorableWithPluginMetaSchema.merge(
624
940
  auditOutputSchema.pick({ score: true, value: true, displayValue: true })
625
941
  );
626
- var reportsDiffSchema = z14.object({
942
+ var reportsDiffSchema = z15.object({
627
943
  commits: makeComparisonSchema(commitSchema).nullable().describe("Commits identifying compared reports"),
628
944
  categories: makeArraysComparisonSchema(
629
945
  categoryDiffSchema,
@@ -721,57 +1037,82 @@ function pluginWorkDir(slug) {
721
1037
  return join("node_modules", ".code-pushup", slug);
722
1038
  }
723
1039
 
724
- // packages/utils/src/lib/git.ts
1040
+ // packages/utils/src/lib/reports/utils.ts
1041
+ var { image: image2, bold: boldMd } = md;
1042
+
1043
+ // packages/utils/src/lib/git/git.ts
725
1044
  import { simpleGit } from "simple-git";
726
1045
 
727
- // packages/utils/src/lib/transform.ts
728
- function capitalize(text) {
729
- return `${text.charAt(0).toLocaleUpperCase()}${text.slice(
730
- 1
731
- )}`;
732
- }
1046
+ // packages/utils/src/lib/git/git.commits-and-tags.ts
1047
+ import { simpleGit as simpleGit2 } from "simple-git";
1048
+
1049
+ // packages/utils/src/lib/semver.ts
1050
+ import { rcompare, valid } from "semver";
733
1051
 
734
1052
  // packages/utils/src/lib/progress.ts
735
1053
  import chalk3 from "chalk";
736
1054
  import { MultiProgressBars } from "multi-progress-bars";
737
1055
 
1056
+ // packages/utils/src/lib/reports/formatting.ts
1057
+ var { headline: headline2, lines: lines2, link: link3, section: section2, table: table3 } = md;
1058
+
1059
+ // packages/utils/src/lib/reports/generate-md-report-categoy-section.ts
1060
+ var { link: link4, section: section3, h2: h22, lines: lines3, li: li2, bold: boldMd2, h3: h32, indentation: indentation2 } = md;
1061
+
1062
+ // packages/utils/src/lib/reports/generate-md-report.ts
1063
+ var { h1: h12, h2: h23, h3: h33, lines: lines4, link: link5, section: section4, code: codeMd } = md;
1064
+ var { bold: boldHtml, details: details2 } = html;
1065
+
1066
+ // packages/utils/src/lib/reports/generate-md-reports-diff.ts
1067
+ var {
1068
+ h1: h13,
1069
+ h2: h24,
1070
+ lines: lines5,
1071
+ link: link6,
1072
+ bold: boldMd3,
1073
+ italic: italicMd,
1074
+ table: table4,
1075
+ section: section5
1076
+ } = md;
1077
+ var { details: details3 } = html;
1078
+
738
1079
  // packages/utils/src/lib/reports/log-stdout-summary.ts
739
1080
  import chalk4 from "chalk";
740
1081
 
741
1082
  // packages/plugin-coverage/package.json
742
1083
  var name = "@code-pushup/coverage-plugin";
743
- var version = "0.39.0";
1084
+ var version = "0.42.1";
744
1085
 
745
1086
  // packages/plugin-coverage/src/lib/config.ts
746
- import { z as z15 } from "zod";
747
- var coverageTypeSchema = z15.enum(["function", "branch", "line"]);
748
- var coverageResultSchema = z15.union([
749
- z15.object({
750
- resultsPath: z15.string({
1087
+ import { z as z16 } from "zod";
1088
+ var coverageTypeSchema = z16.enum(["function", "branch", "line"]);
1089
+ var coverageResultSchema = z16.union([
1090
+ z16.object({
1091
+ resultsPath: z16.string({
751
1092
  description: "Path to coverage results for Nx setup."
752
1093
  }).includes("lcov"),
753
- pathToProject: z15.string({
1094
+ pathToProject: z16.string({
754
1095
  description: "Path from workspace root to project root. Necessary for LCOV reports which provide a relative path."
755
1096
  }).optional()
756
1097
  }),
757
- z15.string({
1098
+ z16.string({
758
1099
  description: "Path to coverage results for a single project setup."
759
1100
  }).includes("lcov")
760
1101
  ]);
761
- var coveragePluginConfigSchema = z15.object({
762
- coverageToolCommand: z15.object({
763
- command: z15.string({ description: "Command to run coverage tool." }).min(1),
764
- args: z15.array(z15.string(), {
1102
+ var coveragePluginConfigSchema = z16.object({
1103
+ coverageToolCommand: z16.object({
1104
+ command: z16.string({ description: "Command to run coverage tool." }).min(1),
1105
+ args: z16.array(z16.string(), {
765
1106
  description: "Arguments to be passed to the coverage tool."
766
1107
  }).optional()
767
1108
  }).optional(),
768
- coverageTypes: z15.array(coverageTypeSchema, {
1109
+ coverageTypes: z16.array(coverageTypeSchema, {
769
1110
  description: "Coverage types measured. Defaults to all available types."
770
1111
  }).min(1).default(["function", "branch", "line"]),
771
- reports: z15.array(coverageResultSchema, {
1112
+ reports: z16.array(coverageResultSchema, {
772
1113
  description: "Path to all code coverage report files. Only LCOV format is supported for now."
773
1114
  }).min(1),
774
- perfectScoreThreshold: z15.number({
1115
+ perfectScoreThreshold: z16.number({
775
1116
  description: "Score will be 1 (perfect) for this coverage and above. Score range is 0 - 1."
776
1117
  }).gt(0).max(1).optional()
777
1118
  });