@formatjs/cli-lib 8.2.3 → 8.3.0
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/package.json +4 -5
- package/src/console_utils.js +6 -8
package/package.json
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/cli-lib",
|
|
3
3
|
"description": "Lib for CLI for formatjs.",
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.3.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Linjie Ding <linjie@airtable.com>",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"engines": {
|
|
9
|
-
"node": ">=
|
|
9
|
+
"node": ">= 20.12.0"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@types/estree": "^1.0.8",
|
|
13
13
|
"@types/fs-extra": "^11.0.4",
|
|
14
14
|
"@types/node": "^22.19.5",
|
|
15
|
-
"chalk": "^4.1.2",
|
|
16
15
|
"commander": "^14.0.0",
|
|
17
16
|
"fast-glob": "^3.3.3",
|
|
18
17
|
"fs-extra": "^11.3.3",
|
|
@@ -20,9 +19,9 @@
|
|
|
20
19
|
"loud-rejection": "^2",
|
|
21
20
|
"tslib": "^2.8.1",
|
|
22
21
|
"typescript": "^5.6.0",
|
|
23
|
-
"@formatjs/
|
|
22
|
+
"@formatjs/icu-skeleton-parser": "2.1.1",
|
|
24
23
|
"@formatjs/icu-messageformat-parser": "3.5.1",
|
|
25
|
-
"@formatjs/
|
|
24
|
+
"@formatjs/ts-transformer": "4.4.0"
|
|
26
25
|
},
|
|
27
26
|
"peerDependencies": {
|
|
28
27
|
"@glimmer/syntax": "^0.84.3 || ^0.95.0",
|
package/src/console_utils.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import * as chalkNs from "chalk";
|
|
2
1
|
import { clearLine as nativeClearLine, cursorTo as nativeCursorTo } from "readline";
|
|
3
|
-
import { format, promisify } from "util";
|
|
4
|
-
const chalk = chalkNs.default ?? chalkNs;
|
|
2
|
+
import { format, promisify, styleText } from "node:util";
|
|
5
3
|
const CLEAR_WHOLE_LINE = 0;
|
|
6
4
|
export const writeStderr = promisify(process.stderr.write).bind(process.stderr);
|
|
7
5
|
export const writeStdout = promisify(process.stdout.write).bind(process.stdout);
|
|
8
6
|
// From:
|
|
9
7
|
// https://github.com/yarnpkg/yarn/blob/53d8004229f543f342833310d5af63a4b6e59c8a/src/reporters/console/util.js
|
|
10
8
|
export async function clearLine(terminal) {
|
|
11
|
-
if (!
|
|
9
|
+
if (!terminal.hasColors?.()) {
|
|
12
10
|
if (terminal.isTTY) {
|
|
13
11
|
// terminal
|
|
14
12
|
if (terminal.columns > 0) {
|
|
@@ -22,12 +20,12 @@ export async function clearLine(terminal) {
|
|
|
22
20
|
}
|
|
23
21
|
}
|
|
24
22
|
const LEVEL_COLORS = {
|
|
25
|
-
debug:
|
|
26
|
-
warn:
|
|
27
|
-
error:
|
|
23
|
+
debug: "green",
|
|
24
|
+
warn: "yellow",
|
|
25
|
+
error: "red"
|
|
28
26
|
};
|
|
29
27
|
function label(level, message) {
|
|
30
|
-
return `[@formatjs/cli] [${LEVEL_COLORS[level]
|
|
28
|
+
return `[@formatjs/cli] [${styleText(LEVEL_COLORS[level], level.toUpperCase())}] ${message}`;
|
|
31
29
|
}
|
|
32
30
|
export async function debug(message, ...args) {
|
|
33
31
|
if (process.env.LOG_LEVEL !== "debug") {
|