@utoo/pack-shared 0.0.2 → 0.0.3

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
@@ -25,5 +25,5 @@ export interface SourcePos {
25
25
  line: number;
26
26
  column: number;
27
27
  }
28
- export declare function formatIssue(issue: Issue): string;
29
- export declare function handleIssues(issues: Issue[]): void;
28
+ export declare function formatIssue(issue: Issue, forceColor?: boolean): string;
29
+ export declare function handleIssues(issues: Issue[], forceColor?: boolean): void;
package/esm/issue.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { codeFrameColumns } from "@babel/code-frame";
2
2
  import { renderStyledStringToErrorAnsi } from "./styledString";
3
- export function formatIssue(issue) {
3
+ export function formatIssue(issue, forceColor = true) {
4
4
  const { filePath, title, description, source } = issue;
5
5
  let { documentationLink } = issue;
6
6
  let formattedTitle = renderStyledStringToErrorAnsi(title).replace(/\n/g, "\n ");
@@ -32,7 +32,9 @@ export function formatIssue(issue) {
32
32
  line: end.line + 1,
33
33
  column: end.column + 1,
34
34
  },
35
- }, { forceColor: true }).trim() + "\n\n";
35
+ },
36
+ // forceColor display is noise on browser
37
+ { forceColor }).trim() + "\n\n";
36
38
  }
37
39
  if (description) {
38
40
  message += renderStyledStringToErrorAnsi(description) + "\n\n";
@@ -47,15 +49,15 @@ export function formatIssue(issue) {
47
49
  }
48
50
  return message;
49
51
  }
50
- export function handleIssues(issues) {
52
+ export function handleIssues(issues, forceColor = true) {
51
53
  const topLevelErrors = [];
52
54
  const topLevelWarnings = [];
53
55
  for (const issue of issues) {
54
56
  if (issue.severity === "error" || issue.severity === "fatal") {
55
- topLevelErrors.push(formatIssue(issue));
57
+ topLevelErrors.push(formatIssue(issue, forceColor));
56
58
  }
57
59
  else if (isRelevantWarning(issue)) {
58
- topLevelWarnings.push(formatIssue(issue));
60
+ topLevelWarnings.push(formatIssue(issue, forceColor));
59
61
  }
60
62
  }
61
63
  if (topLevelWarnings.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utoo/pack-shared",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "module": "esm/index.js",
5
5
  "types": "esm/index.d.ts",
6
6
  "files": [