@oclif/core 4.0.0-beta.13 → 4.0.0-beta.14
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/lib/ux/theme.js +8 -3
- package/package.json +4 -3
package/lib/ux/theme.js
CHANGED
|
@@ -5,8 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.parseTheme = exports.colorize = void 0;
|
|
7
7
|
const ansis_1 = __importDefault(require("ansis"));
|
|
8
|
+
const supports_color_1 = require("supports-color");
|
|
8
9
|
const theme_1 = require("../interfaces/theme");
|
|
9
|
-
function
|
|
10
|
+
function isStandardAnsi(color) {
|
|
10
11
|
return theme_1.STANDARD_ANSI.includes(color);
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
@@ -18,7 +19,11 @@ function isStandardChalk(color) {
|
|
|
18
19
|
function colorize(color, text) {
|
|
19
20
|
if (!color)
|
|
20
21
|
return text;
|
|
21
|
-
if (
|
|
22
|
+
if (!supports_color_1.stdout)
|
|
23
|
+
return text;
|
|
24
|
+
if (!supports_color_1.stderr)
|
|
25
|
+
return text;
|
|
26
|
+
if (isStandardAnsi(color))
|
|
22
27
|
return ansis_1.default[color](text);
|
|
23
28
|
if (color.startsWith('#'))
|
|
24
29
|
return ansis_1.default.hex(color)(text);
|
|
@@ -39,5 +44,5 @@ function parseTheme(theme) {
|
|
|
39
44
|
}
|
|
40
45
|
exports.parseTheme = parseTheme;
|
|
41
46
|
function isValid(color) {
|
|
42
|
-
return color.startsWith('#') || color.startsWith('rgb') ||
|
|
47
|
+
return color.startsWith('#') || color.startsWith('rgb') || isStandardAnsi(color) ? color : undefined;
|
|
43
48
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oclif/core",
|
|
3
3
|
"description": "base library for oclif CLIs",
|
|
4
|
-
"version": "4.0.0-beta.
|
|
4
|
+
"version": "4.0.0-beta.14",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/oclif/core/issues",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"ansi-escapes": "^4.3.2",
|
|
9
|
-
"ansis": "^3.
|
|
9
|
+
"ansis": "^3.1.1",
|
|
10
10
|
"clean-stack": "^3.0.1",
|
|
11
11
|
"cli-spinners": "^2.9.2",
|
|
12
12
|
"cosmiconfig": "^9.0.0",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"is-wsl": "^2.2.0",
|
|
19
19
|
"minimatch": "^9.0.4",
|
|
20
20
|
"string-width": "^4.2.3",
|
|
21
|
-
"supports-color": "^
|
|
21
|
+
"supports-color": "^8",
|
|
22
22
|
"widest-line": "^3.1.0",
|
|
23
23
|
"wordwrap": "^1.0.0",
|
|
24
24
|
"wrap-ansi": "^7.0.0"
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"@types/node": "^18",
|
|
41
41
|
"@types/pnpapi": "^0.0.5",
|
|
42
42
|
"@types/sinon": "^17.0.3",
|
|
43
|
+
"@types/supports-color": "^8.1.3",
|
|
43
44
|
"@types/wordwrap": "^1.0.3",
|
|
44
45
|
"@types/wrap-ansi": "^3.0.0",
|
|
45
46
|
"benchmark": "^2.1.4",
|