@utoo/pack-shared 1.2.10-rc.1 → 1.2.10-rc.2
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/styledString.js +10 -5
- package/esm/index.js +7 -7
- package/esm/issue.js +1 -1
- package/esm/styledString.js +4 -2
- package/esm/utils.js +2 -2
- package/package.json +2 -2
package/cjs/styledString.js
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.renderStyledStringToErrorAnsi = renderStyledStringToErrorAnsi;
|
|
4
|
-
const picocolors_1 = require("picocolors");
|
|
7
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
5
8
|
const magicIdentifier_1 = require("./magicIdentifier");
|
|
9
|
+
// picocolors is a CommonJS module, so we need to import it as a default import
|
|
10
|
+
const { bold, green, magenta, red } = picocolors_1.default;
|
|
6
11
|
function renderStyledStringToErrorAnsi(string) {
|
|
7
12
|
function decodeMagicIdentifiers(str) {
|
|
8
13
|
return str.replaceAll(magicIdentifier_1.MAGIC_IDENTIFIER_REGEX, (ident) => {
|
|
9
14
|
try {
|
|
10
|
-
return
|
|
15
|
+
return magenta(`{${(0, magicIdentifier_1.decodeMagicIdentifier)(ident)}}`);
|
|
11
16
|
}
|
|
12
17
|
catch (e) {
|
|
13
|
-
return
|
|
18
|
+
return magenta(`{${ident} (decoding failed: ${e})}`);
|
|
14
19
|
}
|
|
15
20
|
});
|
|
16
21
|
}
|
|
@@ -18,9 +23,9 @@ function renderStyledStringToErrorAnsi(string) {
|
|
|
18
23
|
case "text":
|
|
19
24
|
return decodeMagicIdentifiers(string.value);
|
|
20
25
|
case "strong":
|
|
21
|
-
return
|
|
26
|
+
return bold(red(decodeMagicIdentifiers(string.value)));
|
|
22
27
|
case "code":
|
|
23
|
-
return
|
|
28
|
+
return green(decodeMagicIdentifiers(string.value));
|
|
24
29
|
case "line":
|
|
25
30
|
return string.value.map(renderStyledStringToErrorAnsi).join("");
|
|
26
31
|
case "stack":
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from "./config";
|
|
2
|
-
export * from "./hmr";
|
|
3
|
-
export { formatIssue, handleIssues } from "./issue";
|
|
4
|
-
export { decodeMagicIdentifier } from "./magicIdentifier";
|
|
5
|
-
export { renderStyledStringToErrorAnsi } from "./styledString";
|
|
6
|
-
export * from "./utils";
|
|
7
|
-
export * from "./webpackCompat";
|
|
1
|
+
export * from "./config.js";
|
|
2
|
+
export * from "./hmr.js";
|
|
3
|
+
export { formatIssue, handleIssues } from "./issue.js";
|
|
4
|
+
export { decodeMagicIdentifier } from "./magicIdentifier.js";
|
|
5
|
+
export { renderStyledStringToErrorAnsi } from "./styledString.js";
|
|
6
|
+
export * from "./utils.js";
|
|
7
|
+
export * from "./webpackCompat.js";
|
package/esm/issue.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { codeFrameColumns } from "@babel/code-frame";
|
|
2
|
-
import { renderStyledStringToErrorAnsi } from "./styledString";
|
|
2
|
+
import { renderStyledStringToErrorAnsi } from "./styledString.js";
|
|
3
3
|
export function formatIssue(issue, forceColor = true) {
|
|
4
4
|
const { filePath, title, description, source } = issue;
|
|
5
5
|
let { documentationLink } = issue;
|
package/esm/styledString.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { decodeMagicIdentifier, MAGIC_IDENTIFIER_REGEX, } from "./magicIdentifier";
|
|
1
|
+
import picocolors from "picocolors";
|
|
2
|
+
import { decodeMagicIdentifier, MAGIC_IDENTIFIER_REGEX, } from "./magicIdentifier.js";
|
|
3
|
+
// picocolors is a CommonJS module, so we need to import it as a default import
|
|
4
|
+
const { bold, green, magenta, red } = picocolors;
|
|
3
5
|
export function renderStyledStringToErrorAnsi(string) {
|
|
4
6
|
function decodeMagicIdentifiers(str) {
|
|
5
7
|
return str.replaceAll(MAGIC_IDENTIFIER_REGEX, (ident) => {
|
package/esm/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { formatIssue } from "./issue";
|
|
2
|
-
import { renderStyledStringToErrorAnsi } from "./styledString";
|
|
1
|
+
import { formatIssue } from "./issue.js";
|
|
2
|
+
import { renderStyledStringToErrorAnsi } from "./styledString.js";
|
|
3
3
|
export class ModuleBuildError extends Error {
|
|
4
4
|
constructor() {
|
|
5
5
|
super(...arguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utoo/pack-shared",
|
|
3
|
-
"version": "1.2.10-rc.
|
|
3
|
+
"version": "1.2.10-rc.2",
|
|
4
4
|
"main": "cjs/index.js",
|
|
5
5
|
"module": "esm/index.js",
|
|
6
6
|
"types": "esm/index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
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 esnext --outDir esm",
|
|
23
|
+
"build:esm": "rm -rf esm && tsc -p ./tsconfig.json --module esnext --outDir esm && node ../../scripts/add-esm-extensions.cjs",
|
|
24
24
|
"build": "npm run build:cjs && npm run build:esm",
|
|
25
25
|
"clean": "rm -rf cjs esm",
|
|
26
26
|
"prepublishOnly": "turbo run build --filter=@utoo/pack-shared"
|