@code-pushup/core 0.6.4 → 0.6.6

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.
Files changed (2) hide show
  1. package/index.js +31 -41
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -664,20 +664,18 @@ function logMultipleFileResults(fileResults, messagePrefix) {
664
664
  }
665
665
  var NoExportError = class extends Error {
666
666
  constructor(filepath) {
667
- super(`No export found in ${filepath}`);
667
+ super(`No default export found in ${filepath}`);
668
668
  }
669
669
  };
670
- async function importEsmModule(options, parse) {
671
- parse = parse || ((v) => v);
672
- options = {
670
+ async function importEsmModule(options) {
671
+ const { mod } = await bundleRequire({
673
672
  format: "esm",
674
673
  ...options
675
- };
676
- const { mod } = await bundleRequire(options);
677
- if (mod.default === void 0) {
674
+ });
675
+ if (!("default" in mod)) {
678
676
  throw new NoExportError(options.filepath);
679
677
  }
680
- return parse(mod.default);
678
+ return mod.default;
681
679
  }
682
680
 
683
681
  // packages/utils/src/lib/report.ts
@@ -1282,29 +1280,6 @@ function reportToHeaderSection2(report) {
1282
1280
  const { packageName, version: version2 } = report;
1283
1281
  return `${chalk3.bold(reportHeadlineText)} - ${packageName}@${version2}`;
1284
1282
  }
1285
- function reportToOverviewSection2({
1286
- categories,
1287
- plugins
1288
- }) {
1289
- let output = addLine(chalk3.magentaBright.bold("Categories"));
1290
- output += addLine();
1291
- const table = new Table({
1292
- head: reportRawOverviewTableHeaders,
1293
- colAligns: ["left", "right", "right"],
1294
- style: {
1295
- head: ["cyan"]
1296
- }
1297
- });
1298
- table.push(
1299
- ...categories.map(({ title, score, refs }) => [
1300
- title,
1301
- withColor({ score }),
1302
- countCategoryAudits(refs, plugins)
1303
- ])
1304
- );
1305
- output += addLine(table.toString());
1306
- return output;
1307
- }
1308
1283
  function reportToDetailSection(report) {
1309
1284
  const { plugins } = report;
1310
1285
  let output = "";
@@ -1336,6 +1311,29 @@ function reportToDetailSection(report) {
1336
1311
  });
1337
1312
  return output;
1338
1313
  }
1314
+ function reportToOverviewSection2({
1315
+ categories,
1316
+ plugins
1317
+ }) {
1318
+ let output = addLine(chalk3.magentaBright.bold("Categories"));
1319
+ output += addLine();
1320
+ const table = new Table({
1321
+ head: reportRawOverviewTableHeaders,
1322
+ colAligns: ["left", "right", "right"],
1323
+ style: {
1324
+ head: ["cyan"]
1325
+ }
1326
+ });
1327
+ table.push(
1328
+ ...categories.map(({ title, score, refs }) => [
1329
+ title,
1330
+ withColor({ score }),
1331
+ countCategoryAudits(refs, plugins)
1332
+ ])
1333
+ );
1334
+ output += addLine(table.toString());
1335
+ return output;
1336
+ }
1339
1337
  function withColor({ score, text }) {
1340
1338
  const formattedScore = text ?? formatReportScore(score);
1341
1339
  const style2 = text ? chalk3 : chalk3.bold;
@@ -1622,7 +1620,7 @@ function auditOutputsCorrelateWithPluginOutput(auditOutputs, pluginConfigAudits)
1622
1620
 
1623
1621
  // packages/core/package.json
1624
1622
  var name = "@code-pushup/core";
1625
- var version = "0.6.4";
1623
+ var version = "0.6.6";
1626
1624
 
1627
1625
  // packages/core/src/lib/implementation/collect.ts
1628
1626
  async function collect(options) {
@@ -1771,18 +1769,10 @@ var ConfigPathError = class extends Error {
1771
1769
  }
1772
1770
  };
1773
1771
  async function readCodePushupConfig(filepath) {
1774
- if (!filepath.length) {
1775
- throw new Error("The configuration path is empty.");
1776
- }
1777
1772
  if (!await fileExists(filepath)) {
1778
1773
  throw new ConfigPathError(filepath);
1779
1774
  }
1780
- return importEsmModule(
1781
- {
1782
- filepath
1783
- },
1784
- (d) => coreConfigSchema.parse(d)
1785
- );
1775
+ return coreConfigSchema.parse(await importEsmModule({ filepath }));
1786
1776
  }
1787
1777
  export {
1788
1778
  ConfigPathError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-pushup/core",
3
- "version": "0.6.4",
3
+ "version": "0.6.6",
4
4
  "dependencies": {
5
5
  "@code-pushup/models": "*",
6
6
  "@code-pushup/utils": "*",