@utoo/pack-shared 0.0.5 → 0.0.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.
- package/cjs/index.d.ts +3 -0
- package/cjs/index.js +10 -0
- package/cjs/issue.d.ts +29 -0
- package/cjs/issue.js +95 -0
- package/cjs/magicIdentifier.d.ts +2 -0
- package/cjs/magicIdentifier.js +89 -0
- package/cjs/styledString.d.ts +17 -0
- package/cjs/styledString.js +31 -0
- package/esm/index.js +10 -3
- package/esm/issue.js +12 -8
- package/esm/magicIdentifier.js +6 -2
- package/esm/styledString.js +11 -8
- package/package.json +18 -4
package/cjs/index.d.ts
ADDED
package/cjs/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderStyledStringToErrorAnsi = exports.decodeMagicIdentifier = exports.handleIssues = exports.formatIssue = void 0;
|
|
4
|
+
var issue_1 = require("./issue");
|
|
5
|
+
Object.defineProperty(exports, "formatIssue", { enumerable: true, get: function () { return issue_1.formatIssue; } });
|
|
6
|
+
Object.defineProperty(exports, "handleIssues", { enumerable: true, get: function () { return issue_1.handleIssues; } });
|
|
7
|
+
var magicIdentifier_1 = require("./magicIdentifier");
|
|
8
|
+
Object.defineProperty(exports, "decodeMagicIdentifier", { enumerable: true, get: function () { return magicIdentifier_1.decodeMagicIdentifier; } });
|
|
9
|
+
var styledString_1 = require("./styledString");
|
|
10
|
+
Object.defineProperty(exports, "renderStyledStringToErrorAnsi", { enumerable: true, get: function () { return styledString_1.renderStyledStringToErrorAnsi; } });
|
package/cjs/issue.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface Issue {
|
|
2
|
+
severity: string;
|
|
3
|
+
stage: string;
|
|
4
|
+
filePath: string;
|
|
5
|
+
title: any;
|
|
6
|
+
description?: any;
|
|
7
|
+
detail?: any;
|
|
8
|
+
source?: IssueSource;
|
|
9
|
+
documentationLink: string;
|
|
10
|
+
importTraces: any;
|
|
11
|
+
}
|
|
12
|
+
export interface IssueSource {
|
|
13
|
+
source: Source;
|
|
14
|
+
range?: IssueSourceRange;
|
|
15
|
+
}
|
|
16
|
+
export interface IssueSourceRange {
|
|
17
|
+
start: SourcePos;
|
|
18
|
+
end: SourcePos;
|
|
19
|
+
}
|
|
20
|
+
export interface Source {
|
|
21
|
+
ident: string;
|
|
22
|
+
content?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface SourcePos {
|
|
25
|
+
line: number;
|
|
26
|
+
column: number;
|
|
27
|
+
}
|
|
28
|
+
export declare function formatIssue(issue: Issue, forceColor?: boolean): string;
|
|
29
|
+
export declare function handleIssues(issues: Issue[], throwErrors?: boolean, forceColor?: boolean): void;
|
package/cjs/issue.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatIssue = formatIssue;
|
|
4
|
+
exports.handleIssues = handleIssues;
|
|
5
|
+
const code_frame_1 = require("@babel/code-frame");
|
|
6
|
+
const styledString_1 = require("./styledString");
|
|
7
|
+
function formatIssue(issue, forceColor = true) {
|
|
8
|
+
const { filePath, title, description, source } = issue;
|
|
9
|
+
let { documentationLink } = issue;
|
|
10
|
+
let formattedTitle = (0, styledString_1.renderStyledStringToErrorAnsi)(title).replace(/\n/g, "\n ");
|
|
11
|
+
let formattedFilePath = filePath
|
|
12
|
+
.replace("[project]/", "./")
|
|
13
|
+
.replaceAll("/./", "/")
|
|
14
|
+
.replace("\\\\?\\", "");
|
|
15
|
+
let message = "";
|
|
16
|
+
if (source && source.range) {
|
|
17
|
+
const { start } = source.range;
|
|
18
|
+
message = `${formattedFilePath}:${start.line + 1}:${start.column + 1}\n${formattedTitle}`;
|
|
19
|
+
}
|
|
20
|
+
else if (formattedFilePath) {
|
|
21
|
+
message = `${formattedFilePath}\n${formattedTitle}`;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
message = formattedTitle;
|
|
25
|
+
}
|
|
26
|
+
message += "\n";
|
|
27
|
+
if ((source === null || source === void 0 ? void 0 : source.range) && source.source.content) {
|
|
28
|
+
const { start, end } = source.range;
|
|
29
|
+
message +=
|
|
30
|
+
(0, code_frame_1.codeFrameColumns)(source.source.content, {
|
|
31
|
+
start: {
|
|
32
|
+
line: start.line + 1,
|
|
33
|
+
column: start.column + 1,
|
|
34
|
+
},
|
|
35
|
+
end: {
|
|
36
|
+
line: end.line + 1,
|
|
37
|
+
column: end.column + 1,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
// forceColor display is noise on browser
|
|
41
|
+
{ forceColor }).trim() + "\n\n";
|
|
42
|
+
}
|
|
43
|
+
if (description) {
|
|
44
|
+
message += (0, styledString_1.renderStyledStringToErrorAnsi)(description) + "\n\n";
|
|
45
|
+
}
|
|
46
|
+
// TODO: make it possible to enable this for debugging, but not in tests.
|
|
47
|
+
// if (detail) {
|
|
48
|
+
// message += renderStyledStringToErrorAnsi(detail) + '\n\n'
|
|
49
|
+
// }
|
|
50
|
+
// TODO: Include a trace from the issue.
|
|
51
|
+
if (documentationLink) {
|
|
52
|
+
message += documentationLink + "\n\n";
|
|
53
|
+
}
|
|
54
|
+
return message;
|
|
55
|
+
}
|
|
56
|
+
function handleIssues(issues, throwErrors = true, forceColor = true) {
|
|
57
|
+
const topLevelErrors = new Set();
|
|
58
|
+
const topLevelWarnings = new Set();
|
|
59
|
+
for (const issue of issues) {
|
|
60
|
+
if (issue.severity === "error" || issue.severity === "fatal") {
|
|
61
|
+
topLevelErrors.add(formatIssue(issue, forceColor));
|
|
62
|
+
}
|
|
63
|
+
else if (isRelevantWarning(issue)) {
|
|
64
|
+
topLevelWarnings.add(formatIssue(issue, forceColor));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (topLevelWarnings.size !== 0) {
|
|
68
|
+
const warnMsg = `Utoopack build encountered ${topLevelWarnings.size} warnings:\n${[...topLevelWarnings].join("\n")}`;
|
|
69
|
+
console.warn(warnMsg);
|
|
70
|
+
}
|
|
71
|
+
if (topLevelErrors.size !== 0) {
|
|
72
|
+
const errMsg = `Utoopack build failed with ${topLevelErrors.size} errors:\n${[...topLevelErrors].join("\n")}`;
|
|
73
|
+
if (throwErrors) {
|
|
74
|
+
throw new Error(errMsg);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
console.error(errMsg);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function isRelevantWarning(issue) {
|
|
82
|
+
return issue.severity === "warning" && !isNodeModulesIssue(issue);
|
|
83
|
+
}
|
|
84
|
+
function isNodeModulesIssue(issue) {
|
|
85
|
+
if (issue.severity === "warning" && issue.stage === "config") {
|
|
86
|
+
// Override for the externalize issue
|
|
87
|
+
// `Package foo (serverExternalPackages or default list) can't be external`
|
|
88
|
+
if ((0, styledString_1.renderStyledStringToErrorAnsi)(issue.title).includes("can't be external")) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return (issue.severity === "warning" &&
|
|
93
|
+
(issue.filePath.match(/^(?:.*[\\/])?node_modules(?:[\\/].*)?$/) !== null ||
|
|
94
|
+
issue.filePath.includes("@utoo/pack")));
|
|
95
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MAGIC_IDENTIFIER_REGEX = void 0;
|
|
4
|
+
exports.decodeMagicIdentifier = decodeMagicIdentifier;
|
|
5
|
+
function decodeHex(hexStr) {
|
|
6
|
+
if (hexStr.trim() === "") {
|
|
7
|
+
throw new Error("can't decode empty hex");
|
|
8
|
+
}
|
|
9
|
+
const num = parseInt(hexStr, 16);
|
|
10
|
+
if (isNaN(num)) {
|
|
11
|
+
throw new Error(`invalid hex: \`${hexStr}\``);
|
|
12
|
+
}
|
|
13
|
+
return String.fromCodePoint(num);
|
|
14
|
+
}
|
|
15
|
+
const DECODE_REGEX = /^__TURBOPACK__([a-zA-Z0-9_$]+)__$/;
|
|
16
|
+
function decodeMagicIdentifier(identifier) {
|
|
17
|
+
const matches = identifier.match(DECODE_REGEX);
|
|
18
|
+
if (!matches) {
|
|
19
|
+
return identifier;
|
|
20
|
+
}
|
|
21
|
+
const inner = matches[1];
|
|
22
|
+
let output = "";
|
|
23
|
+
let mode = 0 /* Mode.Text */;
|
|
24
|
+
let buffer = "";
|
|
25
|
+
for (let i = 0; i < inner.length; i++) {
|
|
26
|
+
const char = inner[i];
|
|
27
|
+
if (mode === 0 /* Mode.Text */) {
|
|
28
|
+
if (char === "_") {
|
|
29
|
+
mode = 1 /* Mode.Underscore */;
|
|
30
|
+
}
|
|
31
|
+
else if (char === "$") {
|
|
32
|
+
mode = 2 /* Mode.Hex */;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
output += char;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else if (mode === 1 /* Mode.Underscore */) {
|
|
39
|
+
if (char === "_") {
|
|
40
|
+
output += " ";
|
|
41
|
+
mode = 0 /* Mode.Text */;
|
|
42
|
+
}
|
|
43
|
+
else if (char === "$") {
|
|
44
|
+
output += "_";
|
|
45
|
+
mode = 2 /* Mode.Hex */;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
output += char;
|
|
49
|
+
mode = 0 /* Mode.Text */;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else if (mode === 2 /* Mode.Hex */) {
|
|
53
|
+
if (buffer.length === 2) {
|
|
54
|
+
output += decodeHex(buffer);
|
|
55
|
+
buffer = "";
|
|
56
|
+
}
|
|
57
|
+
if (char === "_") {
|
|
58
|
+
if (buffer !== "") {
|
|
59
|
+
throw new Error(`invalid hex: \`${buffer}\``);
|
|
60
|
+
}
|
|
61
|
+
mode = 3 /* Mode.LongHex */;
|
|
62
|
+
}
|
|
63
|
+
else if (char === "$") {
|
|
64
|
+
if (buffer !== "") {
|
|
65
|
+
throw new Error(`invalid hex: \`${buffer}\``);
|
|
66
|
+
}
|
|
67
|
+
mode = 0 /* Mode.Text */;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
buffer += char;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else if (mode === 3 /* Mode.LongHex */) {
|
|
74
|
+
if (char === "_") {
|
|
75
|
+
throw new Error(`invalid hex: \`${buffer + char}\``);
|
|
76
|
+
}
|
|
77
|
+
else if (char === "$") {
|
|
78
|
+
output += decodeHex(buffer);
|
|
79
|
+
buffer = "";
|
|
80
|
+
mode = 0 /* Mode.Text */;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
buffer += char;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return output;
|
|
88
|
+
}
|
|
89
|
+
exports.MAGIC_IDENTIFIER_REGEX = /__TURBOPACK__[a-zA-Z0-9_$]+__/g;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type StyledString = {
|
|
2
|
+
type: "text";
|
|
3
|
+
value: string;
|
|
4
|
+
} | {
|
|
5
|
+
type: "code";
|
|
6
|
+
value: string;
|
|
7
|
+
} | {
|
|
8
|
+
type: "strong";
|
|
9
|
+
value: string;
|
|
10
|
+
} | {
|
|
11
|
+
type: "stack";
|
|
12
|
+
value: StyledString[];
|
|
13
|
+
} | {
|
|
14
|
+
type: "line";
|
|
15
|
+
value: StyledString[];
|
|
16
|
+
};
|
|
17
|
+
export declare function renderStyledStringToErrorAnsi(string: StyledString): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderStyledStringToErrorAnsi = renderStyledStringToErrorAnsi;
|
|
4
|
+
const picocolors_1 = require("picocolors");
|
|
5
|
+
const magicIdentifier_1 = require("./magicIdentifier");
|
|
6
|
+
function renderStyledStringToErrorAnsi(string) {
|
|
7
|
+
function decodeMagicIdentifiers(str) {
|
|
8
|
+
return str.replaceAll(magicIdentifier_1.MAGIC_IDENTIFIER_REGEX, (ident) => {
|
|
9
|
+
try {
|
|
10
|
+
return (0, picocolors_1.magenta)(`{${(0, magicIdentifier_1.decodeMagicIdentifier)(ident)}}`);
|
|
11
|
+
}
|
|
12
|
+
catch (e) {
|
|
13
|
+
return (0, picocolors_1.magenta)(`{${ident} (decoding failed: ${e})}`);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
switch (string.type) {
|
|
18
|
+
case "text":
|
|
19
|
+
return decodeMagicIdentifiers(string.value);
|
|
20
|
+
case "strong":
|
|
21
|
+
return (0, picocolors_1.bold)((0, picocolors_1.red)(decodeMagicIdentifiers(string.value)));
|
|
22
|
+
case "code":
|
|
23
|
+
return (0, picocolors_1.green)(decodeMagicIdentifiers(string.value));
|
|
24
|
+
case "line":
|
|
25
|
+
return string.value.map(renderStyledStringToErrorAnsi).join("");
|
|
26
|
+
case "stack":
|
|
27
|
+
return string.value.map(renderStyledStringToErrorAnsi).join("\n");
|
|
28
|
+
default:
|
|
29
|
+
throw new Error("Unknown StyledString type", string);
|
|
30
|
+
}
|
|
31
|
+
}
|
package/esm/index.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderStyledStringToErrorAnsi = exports.decodeMagicIdentifier = exports.handleIssues = exports.formatIssue = void 0;
|
|
4
|
+
var issue_1 = require("./issue");
|
|
5
|
+
Object.defineProperty(exports, "formatIssue", { enumerable: true, get: function () { return issue_1.formatIssue; } });
|
|
6
|
+
Object.defineProperty(exports, "handleIssues", { enumerable: true, get: function () { return issue_1.handleIssues; } });
|
|
7
|
+
var magicIdentifier_1 = require("./magicIdentifier");
|
|
8
|
+
Object.defineProperty(exports, "decodeMagicIdentifier", { enumerable: true, get: function () { return magicIdentifier_1.decodeMagicIdentifier; } });
|
|
9
|
+
var styledString_1 = require("./styledString");
|
|
10
|
+
Object.defineProperty(exports, "renderStyledStringToErrorAnsi", { enumerable: true, get: function () { return styledString_1.renderStyledStringToErrorAnsi; } });
|
package/esm/issue.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatIssue = formatIssue;
|
|
4
|
+
exports.handleIssues = handleIssues;
|
|
5
|
+
const code_frame_1 = require("@babel/code-frame");
|
|
6
|
+
const styledString_1 = require("./styledString");
|
|
7
|
+
function formatIssue(issue, forceColor = true) {
|
|
4
8
|
const { filePath, title, description, source } = issue;
|
|
5
9
|
let { documentationLink } = issue;
|
|
6
|
-
let formattedTitle = renderStyledStringToErrorAnsi(title).replace(/\n/g, "\n ");
|
|
10
|
+
let formattedTitle = (0, styledString_1.renderStyledStringToErrorAnsi)(title).replace(/\n/g, "\n ");
|
|
7
11
|
let formattedFilePath = filePath
|
|
8
12
|
.replace("[project]/", "./")
|
|
9
13
|
.replaceAll("/./", "/")
|
|
@@ -23,7 +27,7 @@ export function formatIssue(issue, forceColor = true) {
|
|
|
23
27
|
if ((source === null || source === void 0 ? void 0 : source.range) && source.source.content) {
|
|
24
28
|
const { start, end } = source.range;
|
|
25
29
|
message +=
|
|
26
|
-
codeFrameColumns(source.source.content, {
|
|
30
|
+
(0, code_frame_1.codeFrameColumns)(source.source.content, {
|
|
27
31
|
start: {
|
|
28
32
|
line: start.line + 1,
|
|
29
33
|
column: start.column + 1,
|
|
@@ -37,7 +41,7 @@ export function formatIssue(issue, forceColor = true) {
|
|
|
37
41
|
{ forceColor }).trim() + "\n\n";
|
|
38
42
|
}
|
|
39
43
|
if (description) {
|
|
40
|
-
message += renderStyledStringToErrorAnsi(description) + "\n\n";
|
|
44
|
+
message += (0, styledString_1.renderStyledStringToErrorAnsi)(description) + "\n\n";
|
|
41
45
|
}
|
|
42
46
|
// TODO: make it possible to enable this for debugging, but not in tests.
|
|
43
47
|
// if (detail) {
|
|
@@ -49,7 +53,7 @@ export function formatIssue(issue, forceColor = true) {
|
|
|
49
53
|
}
|
|
50
54
|
return message;
|
|
51
55
|
}
|
|
52
|
-
|
|
56
|
+
function handleIssues(issues, throwErrors = true, forceColor = true) {
|
|
53
57
|
const topLevelErrors = new Set();
|
|
54
58
|
const topLevelWarnings = new Set();
|
|
55
59
|
for (const issue of issues) {
|
|
@@ -81,7 +85,7 @@ function isNodeModulesIssue(issue) {
|
|
|
81
85
|
if (issue.severity === "warning" && issue.stage === "config") {
|
|
82
86
|
// Override for the externalize issue
|
|
83
87
|
// `Package foo (serverExternalPackages or default list) can't be external`
|
|
84
|
-
if (renderStyledStringToErrorAnsi(issue.title).includes("can't be external")) {
|
|
88
|
+
if ((0, styledString_1.renderStyledStringToErrorAnsi)(issue.title).includes("can't be external")) {
|
|
85
89
|
return false;
|
|
86
90
|
}
|
|
87
91
|
}
|
package/esm/magicIdentifier.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MAGIC_IDENTIFIER_REGEX = void 0;
|
|
4
|
+
exports.decodeMagicIdentifier = decodeMagicIdentifier;
|
|
1
5
|
function decodeHex(hexStr) {
|
|
2
6
|
if (hexStr.trim() === "") {
|
|
3
7
|
throw new Error("can't decode empty hex");
|
|
@@ -9,7 +13,7 @@ function decodeHex(hexStr) {
|
|
|
9
13
|
return String.fromCodePoint(num);
|
|
10
14
|
}
|
|
11
15
|
const DECODE_REGEX = /^__TURBOPACK__([a-zA-Z0-9_$]+)__$/;
|
|
12
|
-
|
|
16
|
+
function decodeMagicIdentifier(identifier) {
|
|
13
17
|
const matches = identifier.match(DECODE_REGEX);
|
|
14
18
|
if (!matches) {
|
|
15
19
|
return identifier;
|
|
@@ -82,4 +86,4 @@ export function decodeMagicIdentifier(identifier) {
|
|
|
82
86
|
}
|
|
83
87
|
return output;
|
|
84
88
|
}
|
|
85
|
-
|
|
89
|
+
exports.MAGIC_IDENTIFIER_REGEX = /__TURBOPACK__[a-zA-Z0-9_$]+__/g;
|
package/esm/styledString.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderStyledStringToErrorAnsi = renderStyledStringToErrorAnsi;
|
|
4
|
+
const picocolors_1 = require("picocolors");
|
|
5
|
+
const magicIdentifier_1 = require("./magicIdentifier");
|
|
6
|
+
function renderStyledStringToErrorAnsi(string) {
|
|
4
7
|
function decodeMagicIdentifiers(str) {
|
|
5
|
-
return str.replaceAll(MAGIC_IDENTIFIER_REGEX, (ident) => {
|
|
8
|
+
return str.replaceAll(magicIdentifier_1.MAGIC_IDENTIFIER_REGEX, (ident) => {
|
|
6
9
|
try {
|
|
7
|
-
return magenta(`{${decodeMagicIdentifier(ident)}}`);
|
|
10
|
+
return (0, picocolors_1.magenta)(`{${(0, magicIdentifier_1.decodeMagicIdentifier)(ident)}}`);
|
|
8
11
|
}
|
|
9
12
|
catch (e) {
|
|
10
|
-
return magenta(`{${ident} (decoding failed: ${e})}`);
|
|
13
|
+
return (0, picocolors_1.magenta)(`{${ident} (decoding failed: ${e})}`);
|
|
11
14
|
}
|
|
12
15
|
});
|
|
13
16
|
}
|
|
@@ -15,9 +18,9 @@ export function renderStyledStringToErrorAnsi(string) {
|
|
|
15
18
|
case "text":
|
|
16
19
|
return decodeMagicIdentifiers(string.value);
|
|
17
20
|
case "strong":
|
|
18
|
-
return bold(red(decodeMagicIdentifiers(string.value)));
|
|
21
|
+
return (0, picocolors_1.bold)((0, picocolors_1.red)(decodeMagicIdentifiers(string.value)));
|
|
19
22
|
case "code":
|
|
20
|
-
return green(decodeMagicIdentifiers(string.value));
|
|
23
|
+
return (0, picocolors_1.green)(decodeMagicIdentifiers(string.value));
|
|
21
24
|
case "line":
|
|
22
25
|
return string.value.map(renderStyledStringToErrorAnsi).join("");
|
|
23
26
|
case "stack":
|
package/package.json
CHANGED
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utoo/pack-shared",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
|
+
"main": "cjs/index.js",
|
|
4
5
|
"module": "esm/index.js",
|
|
5
|
-
"
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./esm/index.js",
|
|
9
|
+
"require": "./cjs/index.js"
|
|
10
|
+
},
|
|
11
|
+
"./cjs/*": "./cjs/*",
|
|
12
|
+
"./esm/*": "./esm/*",
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
6
15
|
"files": [
|
|
7
|
-
"
|
|
16
|
+
"./cjs/*.js",
|
|
17
|
+
"./cjs/*.d.ts",
|
|
18
|
+
"./esm/*.js",
|
|
19
|
+
"./esm/*.d.ts"
|
|
8
20
|
],
|
|
9
21
|
"scripts": {
|
|
10
|
-
"build": "rm -rf
|
|
22
|
+
"build:cjs": "rm -rf cjs && tsc -p ./tsconfig.json --module commonjs --outDir cjs",
|
|
23
|
+
"build:esm": "rm -rf esm && tsc -p ./tsconfig.json --module commonjs --outDir esm",
|
|
24
|
+
"build": "npm run build:cjs && npm run build:esm"
|
|
11
25
|
},
|
|
12
26
|
"dependencies": {
|
|
13
27
|
"@babel/code-frame": "7.22.5",
|