@utoo/pack-shared 0.0.4 → 0.0.5

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/esm/issue.d.ts CHANGED
@@ -26,4 +26,4 @@ export interface SourcePos {
26
26
  column: number;
27
27
  }
28
28
  export declare function formatIssue(issue: Issue, forceColor?: boolean): string;
29
- export declare function handleIssues(issues: Issue[], forceColor?: boolean): void;
29
+ export declare function handleIssues(issues: Issue[], throwErrors?: boolean, forceColor?: boolean): void;
package/esm/issue.js CHANGED
@@ -49,7 +49,7 @@ export function formatIssue(issue, forceColor = true) {
49
49
  }
50
50
  return message;
51
51
  }
52
- export function handleIssues(issues, forceColor = true) {
52
+ export function handleIssues(issues, throwErrors = true, forceColor = true) {
53
53
  const topLevelErrors = new Set();
54
54
  const topLevelWarnings = new Set();
55
55
  for (const issue of issues) {
@@ -61,10 +61,17 @@ export function handleIssues(issues, forceColor = true) {
61
61
  }
62
62
  }
63
63
  if (topLevelWarnings.size !== 0) {
64
- console.warn(`Utoopack build encountered ${topLevelWarnings.size} warnings:\n${[...topLevelWarnings].join("\n")}`);
64
+ const warnMsg = `Utoopack build encountered ${topLevelWarnings.size} warnings:\n${[...topLevelWarnings].join("\n")}`;
65
+ console.warn(warnMsg);
65
66
  }
66
67
  if (topLevelErrors.size !== 0) {
67
- throw new Error(`Utoopack build failed with ${topLevelErrors.size} errors:\n${[...topLevelErrors].join("\n")}`);
68
+ const errMsg = `Utoopack build failed with ${topLevelErrors.size} errors:\n${[...topLevelErrors].join("\n")}`;
69
+ if (throwErrors) {
70
+ throw new Error(errMsg);
71
+ }
72
+ else {
73
+ console.error(errMsg);
74
+ }
68
75
  }
69
76
  }
70
77
  function isRelevantWarning(issue) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utoo/pack-shared",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "module": "esm/index.js",
5
5
  "types": "esm/index.d.ts",
6
6
  "files": [