@oclif/core 4.0.8 → 4.0.9
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/args.d.ts +0 -1
- package/lib/args.js +2 -2
- package/lib/config/config.js +6 -0
- package/lib/config/ts-path.js +2 -2
- package/lib/config/util.js +4 -4
- package/lib/errors/error.js +1 -2
- package/lib/errors/errors/cli.js +2 -2
- package/lib/errors/errors/pretty-print.js +2 -3
- package/lib/errors/exit.js +1 -2
- package/lib/errors/handle.js +2 -2
- package/lib/errors/warn.js +2 -3
- package/lib/execute.js +1 -2
- package/lib/flags.d.ts +0 -1
- package/lib/flags.js +4 -4
- package/lib/flush.js +1 -2
- package/lib/help/index.js +2 -2
- package/lib/help/util.js +6 -7
- package/lib/index.js +1 -1
- package/lib/interfaces/config.d.ts +0 -1
- package/lib/logger.js +4 -5
- package/lib/main.d.ts +0 -1
- package/lib/main.js +2 -2
- package/lib/module-loader.js +4 -5
- package/lib/parser/help.js +2 -3
- package/lib/parser/index.js +2 -2
- package/lib/parser/validate.js +1 -2
- package/lib/util/aggregate-flags.js +1 -2
- package/lib/util/cache-command.js +1 -2
- package/lib/util/determine-priority.js +1 -2
- package/lib/util/ensure-arg-object.js +1 -2
- package/lib/util/find-root.js +2 -3
- package/lib/util/fs.js +4 -4
- package/lib/util/ids.js +2 -3
- package/lib/util/os.d.ts +0 -1
- package/lib/util/os.js +2 -3
- package/lib/util/read-pjson.js +1 -2
- package/lib/util/read-tsconfig.js +1 -2
- package/lib/util/util.js +15 -16
- package/lib/ux/colorize-json.js +2 -3
- package/lib/ux/list.js +1 -1
- package/lib/ux/supports-color.js +1 -2
- package/lib/ux/theme.js +2 -3
- package/package.json +2 -2
package/lib/args.d.ts
CHANGED
package/lib/args.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.string = exports.url = exports.file = exports.directory = exports.integer = exports.boolean =
|
|
3
|
+
exports.string = exports.url = exports.file = exports.directory = exports.integer = exports.boolean = void 0;
|
|
4
|
+
exports.custom = custom;
|
|
4
5
|
const node_url_1 = require("node:url");
|
|
5
6
|
const fs_1 = require("./util/fs");
|
|
6
7
|
const util_1 = require("./util/util");
|
|
@@ -13,7 +14,6 @@ function custom(defaults) {
|
|
|
13
14
|
type: 'option',
|
|
14
15
|
});
|
|
15
16
|
}
|
|
16
|
-
exports.custom = custom;
|
|
17
17
|
exports.boolean = custom({
|
|
18
18
|
parse: async (b) => Boolean(b) && (0, util_1.isNotFalsy)(b),
|
|
19
19
|
});
|
package/lib/config/config.js
CHANGED
|
@@ -588,6 +588,12 @@ class Config {
|
|
|
588
588
|
if (SHELL) {
|
|
589
589
|
shellPath = SHELL.split('/');
|
|
590
590
|
}
|
|
591
|
+
else if (this.windows && process.title.toLowerCase().includes('powershell')) {
|
|
592
|
+
shellPath = ['powershell'];
|
|
593
|
+
}
|
|
594
|
+
else if (this.windows && process.title.toLowerCase().includes('command prompt')) {
|
|
595
|
+
shellPath = ['cmd.exe'];
|
|
596
|
+
}
|
|
591
597
|
else if (this.windows && COMSPEC) {
|
|
592
598
|
shellPath = COMSPEC.split(/\\|\//);
|
|
593
599
|
}
|
package/lib/config/ts-path.js
CHANGED
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.TS_CONFIGS = void 0;
|
|
7
|
+
exports.tsPath = tsPath;
|
|
7
8
|
const promises_1 = require("node:fs/promises");
|
|
8
9
|
const node_path_1 = require("node:path");
|
|
9
10
|
const cache_1 = __importDefault(require("../cache"));
|
|
@@ -281,4 +282,3 @@ async function tsPath(root, orig, plugin) {
|
|
|
281
282
|
return orig;
|
|
282
283
|
}
|
|
283
284
|
}
|
|
284
|
-
exports.tsPath = tsPath;
|
package/lib/config/util.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.collectUsableIds =
|
|
3
|
+
exports.collectUsableIds = void 0;
|
|
4
|
+
exports.makeDebug = makeDebug;
|
|
5
|
+
exports.getPermutations = getPermutations;
|
|
6
|
+
exports.getCommandIdPermutations = getCommandIdPermutations;
|
|
4
7
|
const logger_1 = require("../logger");
|
|
5
8
|
function makeDebug(...scope) {
|
|
6
9
|
return (formatter, ...args) => (0, logger_1.getLogger)(['config', ...scope].join(':')).debug(formatter, ...args);
|
|
7
10
|
}
|
|
8
|
-
exports.makeDebug = makeDebug;
|
|
9
11
|
// Adapted from https://github.com/angus-c/just/blob/master/packages/array-permutations/index.js
|
|
10
12
|
function getPermutations(arr) {
|
|
11
13
|
if (arr.length === 0)
|
|
@@ -26,11 +28,9 @@ function getPermutations(arr) {
|
|
|
26
28
|
}
|
|
27
29
|
return output;
|
|
28
30
|
}
|
|
29
|
-
exports.getPermutations = getPermutations;
|
|
30
31
|
function getCommandIdPermutations(commandId) {
|
|
31
32
|
return getPermutations(commandId.split(':')).flatMap((c) => c.join(':'));
|
|
32
33
|
}
|
|
33
|
-
exports.getCommandIdPermutations = getCommandIdPermutations;
|
|
34
34
|
/**
|
|
35
35
|
* Return an array of ids that represent all the usable combinations that a user could enter.
|
|
36
36
|
*
|
package/lib/errors/error.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.error =
|
|
26
|
+
exports.error = error;
|
|
27
27
|
const logger_1 = require("../logger");
|
|
28
28
|
const write_1 = require("../ux/write");
|
|
29
29
|
const cli_1 = require("./errors/cli");
|
|
@@ -50,5 +50,4 @@ function error(input, options = {}) {
|
|
|
50
50
|
else
|
|
51
51
|
throw err;
|
|
52
52
|
}
|
|
53
|
-
exports.error = error;
|
|
54
53
|
exports.default = error;
|
package/lib/errors/errors/cli.js
CHANGED
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CLIError =
|
|
6
|
+
exports.CLIError = void 0;
|
|
7
|
+
exports.addOclifExitCode = addOclifExitCode;
|
|
7
8
|
const ansis_1 = __importDefault(require("ansis"));
|
|
8
9
|
const clean_stack_1 = __importDefault(require("clean-stack"));
|
|
9
10
|
const indent_string_1 = __importDefault(require("indent-string"));
|
|
@@ -22,7 +23,6 @@ function addOclifExitCode(error, options) {
|
|
|
22
23
|
error.oclif.exit = options?.exit === undefined ? cache_1.default.getInstance().get('exitCodes')?.default ?? 2 : options.exit;
|
|
23
24
|
return error;
|
|
24
25
|
}
|
|
25
|
-
exports.addOclifExitCode = addOclifExitCode;
|
|
26
26
|
class CLIError extends Error {
|
|
27
27
|
code;
|
|
28
28
|
oclif = {};
|
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.applyPrettyPrintOptions =
|
|
6
|
+
exports.applyPrettyPrintOptions = applyPrettyPrintOptions;
|
|
7
|
+
exports.default = prettyPrint;
|
|
7
8
|
const indent_string_1 = __importDefault(require("indent-string"));
|
|
8
9
|
const wrap_ansi_1 = __importDefault(require("wrap-ansi"));
|
|
9
10
|
const screen_1 = require("../../screen");
|
|
@@ -19,7 +20,6 @@ function applyPrettyPrintOptions(error, options) {
|
|
|
19
20
|
}
|
|
20
21
|
return error;
|
|
21
22
|
}
|
|
22
|
-
exports.applyPrettyPrintOptions = applyPrettyPrintOptions;
|
|
23
23
|
const formatSuggestions = (suggestions) => {
|
|
24
24
|
const label = 'Try this:';
|
|
25
25
|
if (!suggestions || suggestions.length === 0)
|
|
@@ -49,4 +49,3 @@ function prettyPrint(error) {
|
|
|
49
49
|
output = (0, indent_string_1.default)(output, 1);
|
|
50
50
|
return output;
|
|
51
51
|
}
|
|
52
|
-
exports.default = prettyPrint;
|
package/lib/errors/exit.js
CHANGED
package/lib/errors/handle.js
CHANGED
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.Exit = void 0;
|
|
7
|
+
exports.handle = handle;
|
|
7
8
|
const clean_stack_1 = __importDefault(require("clean-stack"));
|
|
8
9
|
const cache_1 = __importDefault(require("../cache"));
|
|
9
10
|
const index_1 = require("../help/index");
|
|
@@ -57,4 +58,3 @@ async function handle(err) {
|
|
|
57
58
|
exports.Exit.exit(1);
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
|
-
exports.handle = handle;
|
package/lib/errors/warn.js
CHANGED
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.warn = warn;
|
|
7
|
+
exports.memoizedWarn = memoizedWarn;
|
|
7
8
|
const logger_1 = require("../logger");
|
|
8
9
|
const write_1 = require("../ux/write");
|
|
9
10
|
const cli_1 = require("./errors/cli");
|
|
@@ -30,12 +31,10 @@ function warn(input) {
|
|
|
30
31
|
if (err?.stack)
|
|
31
32
|
(0, logger_1.getLogger)().error(err.stack);
|
|
32
33
|
}
|
|
33
|
-
exports.warn = warn;
|
|
34
34
|
const WARNINGS = new Set();
|
|
35
35
|
function memoizedWarn(input) {
|
|
36
36
|
if (!WARNINGS.has(input))
|
|
37
37
|
warn(input);
|
|
38
38
|
WARNINGS.add(input);
|
|
39
39
|
}
|
|
40
|
-
exports.memoizedWarn = memoizedWarn;
|
|
41
40
|
exports.default = warn;
|
package/lib/execute.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.execute =
|
|
3
|
+
exports.execute = execute;
|
|
4
4
|
const errors_1 = require("./errors");
|
|
5
5
|
const handle_1 = require("./errors/handle");
|
|
6
6
|
const flush_1 = require("./flush");
|
|
@@ -62,4 +62,3 @@ async function execute(options) {
|
|
|
62
62
|
})
|
|
63
63
|
.catch(async (error) => (0, handle_1.handle)(error));
|
|
64
64
|
}
|
|
65
|
-
exports.execute = execute;
|
package/lib/flags.d.ts
CHANGED
package/lib/flags.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.help = exports.version = exports.string = exports.url = exports.file = exports.directory = exports.integer = void 0;
|
|
4
|
+
exports.custom = custom;
|
|
5
|
+
exports.boolean = boolean;
|
|
6
|
+
exports.option = option;
|
|
4
7
|
const node_url_1 = require("node:url");
|
|
5
8
|
const errors_1 = require("./errors");
|
|
6
9
|
const help_1 = require("./help");
|
|
@@ -15,7 +18,6 @@ function custom(defaults) {
|
|
|
15
18
|
type: 'option',
|
|
16
19
|
});
|
|
17
20
|
}
|
|
18
|
-
exports.custom = custom;
|
|
19
21
|
/**
|
|
20
22
|
* A boolean flag. Defaults to `false` unless default is set to `true`.
|
|
21
23
|
*
|
|
@@ -29,7 +31,6 @@ function boolean(options = {}) {
|
|
|
29
31
|
type: 'boolean',
|
|
30
32
|
};
|
|
31
33
|
}
|
|
32
|
-
exports.boolean = boolean;
|
|
33
34
|
/**
|
|
34
35
|
* An integer flag. Throws an error if the provided value is not a valid integer.
|
|
35
36
|
*
|
|
@@ -126,4 +127,3 @@ function option(defaults) {
|
|
|
126
127
|
type: 'option',
|
|
127
128
|
});
|
|
128
129
|
}
|
|
129
|
-
exports.option = option;
|
package/lib/flush.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.flush =
|
|
3
|
+
exports.flush = flush;
|
|
4
4
|
const error_1 = require("./errors/error");
|
|
5
5
|
function timeout(p, ms) {
|
|
6
6
|
function wait(ms, unref = false) {
|
|
@@ -24,4 +24,3 @@ async function _flush() {
|
|
|
24
24
|
async function flush(ms = 10_000) {
|
|
25
25
|
await timeout(_flush(), ms);
|
|
26
26
|
}
|
|
27
|
-
exports.flush = flush;
|
package/lib/help/index.js
CHANGED
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.Help = exports.HelpBase = exports.standardizeIDFromArgv = exports.normalizeArgv = exports.getHelpFlagAdditions = exports.HelpFormatter = exports.CommandHelp = void 0;
|
|
7
|
+
exports.loadHelpClass = loadHelpClass;
|
|
7
8
|
const ansis_1 = __importDefault(require("ansis"));
|
|
8
9
|
const ts_path_1 = require("../config/ts-path");
|
|
9
10
|
const error_1 = require("../errors/error");
|
|
@@ -341,4 +342,3 @@ async function loadHelpClass(config) {
|
|
|
341
342
|
}
|
|
342
343
|
return Help;
|
|
343
344
|
}
|
|
344
|
-
exports.loadHelpClass = loadHelpClass;
|
package/lib/help/util.js
CHANGED
|
@@ -23,7 +23,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.template = template;
|
|
27
|
+
exports.standardizeIDFromArgv = standardizeIDFromArgv;
|
|
28
|
+
exports.getHelpFlagAdditions = getHelpFlagAdditions;
|
|
29
|
+
exports.formatFlagDeprecationWarning = formatFlagDeprecationWarning;
|
|
30
|
+
exports.formatCommandDeprecationWarning = formatCommandDeprecationWarning;
|
|
31
|
+
exports.normalizeArgv = normalizeArgv;
|
|
27
32
|
const ejs = __importStar(require("ejs"));
|
|
28
33
|
const util_1 = require("../config/util");
|
|
29
34
|
const ids_1 = require("../util/ids");
|
|
@@ -33,7 +38,6 @@ function template(context) {
|
|
|
33
38
|
}
|
|
34
39
|
return render;
|
|
35
40
|
}
|
|
36
|
-
exports.template = template;
|
|
37
41
|
const isFlag = (s) => s.startsWith('-');
|
|
38
42
|
const isArgWithValue = (s) => s.includes('=');
|
|
39
43
|
function collateSpacedCmdIDFromArgs(argv, config) {
|
|
@@ -79,13 +83,11 @@ function standardizeIDFromArgv(argv, config) {
|
|
|
79
83
|
argv[0] = (0, ids_1.toStandardizedId)(argv[0], config);
|
|
80
84
|
return argv;
|
|
81
85
|
}
|
|
82
|
-
exports.standardizeIDFromArgv = standardizeIDFromArgv;
|
|
83
86
|
function getHelpFlagAdditions(config) {
|
|
84
87
|
const helpFlags = ['--help'];
|
|
85
88
|
const additionalHelpFlags = config.pjson.oclif.additionalHelpFlags ?? [];
|
|
86
89
|
return [...new Set([...helpFlags, ...additionalHelpFlags]).values()];
|
|
87
90
|
}
|
|
88
|
-
exports.getHelpFlagAdditions = getHelpFlagAdditions;
|
|
89
91
|
function formatFlagDeprecationWarning(flag, opts) {
|
|
90
92
|
let message = `The "${flag}" flag has been deprecated`;
|
|
91
93
|
if (opts === true)
|
|
@@ -98,7 +100,6 @@ function formatFlagDeprecationWarning(flag, opts) {
|
|
|
98
100
|
message += opts.to ? `. Use "${opts.to}" instead.` : '.';
|
|
99
101
|
return message;
|
|
100
102
|
}
|
|
101
|
-
exports.formatFlagDeprecationWarning = formatFlagDeprecationWarning;
|
|
102
103
|
function formatCommandDeprecationWarning(command, opts) {
|
|
103
104
|
let message = `The "${command}" command has been deprecated`;
|
|
104
105
|
if (!opts)
|
|
@@ -111,10 +112,8 @@ function formatCommandDeprecationWarning(command, opts) {
|
|
|
111
112
|
message += opts.to ? `. Use "${opts.to}" instead.` : '.';
|
|
112
113
|
return message;
|
|
113
114
|
}
|
|
114
|
-
exports.formatCommandDeprecationWarning = formatCommandDeprecationWarning;
|
|
115
115
|
function normalizeArgv(config, argv = process.argv.slice(2)) {
|
|
116
116
|
if (config.topicSeparator !== ':' && !argv[0]?.includes(':'))
|
|
117
117
|
argv = standardizeIDFromArgv(argv, config);
|
|
118
118
|
return argv;
|
|
119
119
|
}
|
|
120
|
-
exports.normalizeArgv = normalizeArgv;
|
package/lib/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.ux = exports.toStandardizedId = exports.toConfiguredId = exports.settings = exports.Performance = exports.Parser = exports.ModuleLoader = exports.
|
|
26
|
+
exports.ux = exports.toStandardizedId = exports.toConfiguredId = exports.settings = exports.Performance = exports.Parser = exports.ModuleLoader = exports.getLogger = exports.Interfaces = exports.loadHelpClass = exports.HelpBase = exports.Help = exports.CommandHelp = exports.flush = exports.Flags = exports.execute = exports.handle = exports.Errors = exports.Plugin = exports.Config = exports.Command = exports.Args = void 0;
|
|
27
27
|
function checkCWD() {
|
|
28
28
|
try {
|
|
29
29
|
process.cwd();
|
package/lib/logger.js
CHANGED
|
@@ -3,7 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.getLogger = getLogger;
|
|
7
|
+
exports.makeDebug = makeDebug;
|
|
8
|
+
exports.setLogger = setLogger;
|
|
9
|
+
exports.clearLoggers = clearLoggers;
|
|
7
10
|
const debug_1 = __importDefault(require("debug"));
|
|
8
11
|
const OCLIF_NS = 'oclif';
|
|
9
12
|
function makeLogger(namespace = OCLIF_NS) {
|
|
@@ -45,7 +48,6 @@ function getLogger(namespace) {
|
|
|
45
48
|
}
|
|
46
49
|
return rootLogger;
|
|
47
50
|
}
|
|
48
|
-
exports.getLogger = getLogger;
|
|
49
51
|
function ensureItMatchesInterface(newLogger) {
|
|
50
52
|
return (typeof newLogger.child === 'function' &&
|
|
51
53
|
typeof newLogger.debug === 'function' &&
|
|
@@ -74,7 +76,6 @@ function set(newLogger) {
|
|
|
74
76
|
function makeDebug(namespace) {
|
|
75
77
|
return (formatter, ...args) => getLogger(namespace).debug(formatter, ...args);
|
|
76
78
|
}
|
|
77
|
-
exports.makeDebug = makeDebug;
|
|
78
79
|
function setLogger(loadOptions) {
|
|
79
80
|
if (loadOptions && typeof loadOptions !== 'string' && 'logger' in loadOptions && loadOptions.logger) {
|
|
80
81
|
set(loadOptions.logger);
|
|
@@ -83,8 +84,6 @@ function setLogger(loadOptions) {
|
|
|
83
84
|
set(makeLogger(OCLIF_NS));
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
|
-
exports.setLogger = setLogger;
|
|
87
87
|
function clearLoggers() {
|
|
88
88
|
cachedLoggers.clear();
|
|
89
89
|
}
|
|
90
|
-
exports.clearLoggers = clearLoggers;
|
package/lib/main.d.ts
CHANGED
package/lib/main.js
CHANGED
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.versionAddition = exports.helpAddition = void 0;
|
|
7
|
+
exports.run = run;
|
|
7
8
|
const node_url_1 = require("node:url");
|
|
8
9
|
const cache_1 = __importDefault(require("./cache"));
|
|
9
10
|
const config_1 = require("./config");
|
|
@@ -97,4 +98,3 @@ async function run(argv, options) {
|
|
|
97
98
|
await collectPerf();
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
|
-
exports.run = run;
|
package/lib/module-loader.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.load = load;
|
|
4
|
+
exports.loadWithData = loadWithData;
|
|
5
|
+
exports.loadWithDataFromManifest = loadWithDataFromManifest;
|
|
6
|
+
exports.isPathModule = isPathModule;
|
|
4
7
|
const node_fs_1 = require("node:fs");
|
|
5
8
|
const node_path_1 = require("node:path");
|
|
6
9
|
const node_url_1 = require("node:url");
|
|
@@ -47,7 +50,6 @@ async function load(config, modulePath) {
|
|
|
47
50
|
handleError(error, isESM, filePath ?? modulePath);
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
|
-
exports.load = load;
|
|
51
53
|
/**
|
|
52
54
|
* Loads a module and returns an object with the module and data about the module.
|
|
53
55
|
*
|
|
@@ -78,7 +80,6 @@ async function loadWithData(config, modulePath) {
|
|
|
78
80
|
handleError(error, isESM, filePath ?? modulePath);
|
|
79
81
|
}
|
|
80
82
|
}
|
|
81
|
-
exports.loadWithData = loadWithData;
|
|
82
83
|
/**
|
|
83
84
|
* Loads a module and returns an object with the module and data about the module.
|
|
84
85
|
*
|
|
@@ -111,7 +112,6 @@ async function loadWithDataFromManifest(cached, modulePath) {
|
|
|
111
112
|
handleError(error, isESM, filePath ?? modulePath);
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
|
-
exports.loadWithDataFromManifest = loadWithDataFromManifest;
|
|
115
115
|
/**
|
|
116
116
|
* For `.js` files uses `getPackageType` to determine if `type` is set to `module` in associated `package.json`. If
|
|
117
117
|
* the `modulePath` provided ends in `.mjs` it is assumed to be ESM.
|
|
@@ -139,7 +139,6 @@ function isPathModule(filePath) {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
exports.isPathModule = isPathModule;
|
|
143
142
|
/**
|
|
144
143
|
* Resolves a modulePath first by `require.resolve` to allow Node to resolve an actual module. If this fails then
|
|
145
144
|
* the `modulePath` is resolved from the root of the provided config. `Config.tsPath` is used for initial resolution.
|
package/lib/parser/help.js
CHANGED
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.flagUsage = flagUsage;
|
|
7
|
+
exports.flagUsages = flagUsages;
|
|
7
8
|
const ansis_1 = __importDefault(require("ansis"));
|
|
8
9
|
const util_1 = require("../util/util");
|
|
9
10
|
function flagUsage(flag, options = {}) {
|
|
@@ -24,10 +25,8 @@ function flagUsage(flag, options = {}) {
|
|
|
24
25
|
description = description ? ansis_1.default.dim(description) : undefined;
|
|
25
26
|
return [` ${label.join(',').trim()}${usage}`, description];
|
|
26
27
|
}
|
|
27
|
-
exports.flagUsage = flagUsage;
|
|
28
28
|
function flagUsages(flags, options = {}) {
|
|
29
29
|
if (flags.length === 0)
|
|
30
30
|
return [];
|
|
31
31
|
return (0, util_1.sortBy)(flags, (f) => [f.char ? -1 : 1, f.char, f.name]).map((f) => flagUsage(f, options));
|
|
32
32
|
}
|
|
33
|
-
exports.flagUsages = flagUsages;
|
package/lib/parser/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.flagUsages = void 0;
|
|
4
|
+
exports.parse = parse;
|
|
4
5
|
const parse_1 = require("./parse");
|
|
5
6
|
const validate_1 = require("./validate");
|
|
6
7
|
var help_1 = require("./help");
|
|
@@ -19,4 +20,3 @@ async function parse(argv, options) {
|
|
|
19
20
|
await (0, validate_1.validate)({ input, output });
|
|
20
21
|
return output;
|
|
21
22
|
}
|
|
22
|
-
exports.parse = parse;
|
package/lib/parser/validate.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validate =
|
|
3
|
+
exports.validate = validate;
|
|
4
4
|
const util_1 = require("../util/util");
|
|
5
5
|
const errors_1 = require("./errors");
|
|
6
6
|
async function validate(parse) {
|
|
@@ -190,4 +190,3 @@ async function validate(parse) {
|
|
|
190
190
|
validateArgs();
|
|
191
191
|
return validateFlags();
|
|
192
192
|
}
|
|
193
|
-
exports.validate = validate;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.aggregateFlags =
|
|
3
|
+
exports.aggregateFlags = aggregateFlags;
|
|
4
4
|
const flags_1 = require("../flags");
|
|
5
5
|
const json = (0, flags_1.boolean)({
|
|
6
6
|
description: 'Format output as json.',
|
|
@@ -10,4 +10,3 @@ function aggregateFlags(flags, baseFlags, enableJsonFlag) {
|
|
|
10
10
|
const combinedFlags = { ...baseFlags, ...flags };
|
|
11
11
|
return (enableJsonFlag ? { json, ...combinedFlags } : combinedFlags);
|
|
12
12
|
}
|
|
13
|
-
exports.aggregateFlags = aggregateFlags;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cacheCommand =
|
|
3
|
+
exports.cacheCommand = cacheCommand;
|
|
4
4
|
const aggregate_flags_1 = require("./aggregate-flags");
|
|
5
5
|
const cache_default_value_1 = require("./cache-default-value");
|
|
6
6
|
const ensure_arg_object_1 = require("./ensure-arg-object");
|
|
@@ -115,4 +115,3 @@ async function cacheCommand(uncachedCmd, plugin, respectNoCacheDefault = false)
|
|
|
115
115
|
const additionalProperties = Object.fromEntries(keysToAdd.map((key) => [key, cmd[key]]));
|
|
116
116
|
return { ...stdProperties, ...additionalProperties };
|
|
117
117
|
}
|
|
118
|
-
exports.cacheCommand = cacheCommand;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.determinePriority =
|
|
3
|
+
exports.determinePriority = determinePriority;
|
|
4
4
|
/**
|
|
5
5
|
* This function is responsible for locating the correct plugin to use for a named command id
|
|
6
6
|
* It searches the {Config} registered commands to match either the raw command id or the command alias
|
|
@@ -52,4 +52,3 @@ function determinePriority(plugins, commands) {
|
|
|
52
52
|
});
|
|
53
53
|
return commandPlugins[0];
|
|
54
54
|
}
|
|
55
|
-
exports.determinePriority = determinePriority;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ensureArgObject =
|
|
3
|
+
exports.ensureArgObject = ensureArgObject;
|
|
4
4
|
/**
|
|
5
5
|
* Ensure that the provided args are an object. This is for backwards compatibility with v1 commands which
|
|
6
6
|
* defined args as an array.
|
|
@@ -11,4 +11,3 @@ exports.ensureArgObject = void 0;
|
|
|
11
11
|
function ensureArgObject(args) {
|
|
12
12
|
return (Array.isArray(args) ? (args ?? []).reduce((x, y) => ({ ...x, [y.name]: y }), {}) : args ?? {});
|
|
13
13
|
}
|
|
14
|
-
exports.ensureArgObject = ensureArgObject;
|
package/lib/util/find-root.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.debug = debug;
|
|
4
|
+
exports.findRoot = findRoot;
|
|
4
5
|
const node_path_1 = require("node:path");
|
|
5
6
|
const logger_1 = require("../logger");
|
|
6
7
|
const fs_1 = require("./fs");
|
|
7
8
|
function debug(...scope) {
|
|
8
9
|
return (formatter, ...args) => (0, logger_1.getLogger)(['find-root', ...scope].join(':')).debug(formatter, ...args);
|
|
9
10
|
}
|
|
10
|
-
exports.debug = debug;
|
|
11
11
|
// essentially just "cd .."
|
|
12
12
|
function* up(from) {
|
|
13
13
|
while ((0, node_path_1.dirname)(from) !== from) {
|
|
@@ -183,4 +183,3 @@ async function findRoot(name, root) {
|
|
|
183
183
|
debug('root-plugin')(found ? `Found root at ${found}` : 'No root found!');
|
|
184
184
|
return found;
|
|
185
185
|
}
|
|
186
|
-
exports.findRoot = findRoot;
|
package/lib/util/fs.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.fileExists = exports.dirExists = void 0;
|
|
4
|
+
exports.readJson = readJson;
|
|
5
|
+
exports.safeReadJson = safeReadJson;
|
|
6
|
+
exports.existsSync = existsSync;
|
|
4
7
|
const node_fs_1 = require("node:fs");
|
|
5
8
|
const promises_1 = require("node:fs/promises");
|
|
6
9
|
const util_1 = require("./util");
|
|
@@ -70,7 +73,6 @@ async function readJson(path, useCache = true) {
|
|
|
70
73
|
cache.set(path, contents);
|
|
71
74
|
return JSON.parse(contents);
|
|
72
75
|
}
|
|
73
|
-
exports.readJson = readJson;
|
|
74
76
|
/**
|
|
75
77
|
* Safely read a file from disk and cache its contents if in production environment.
|
|
76
78
|
*
|
|
@@ -86,8 +88,6 @@ async function safeReadJson(path, useCache = true) {
|
|
|
86
88
|
}
|
|
87
89
|
catch { }
|
|
88
90
|
}
|
|
89
|
-
exports.safeReadJson = safeReadJson;
|
|
90
91
|
function existsSync(path) {
|
|
91
92
|
return (0, node_fs_1.existsSync)(path);
|
|
92
93
|
}
|
|
93
|
-
exports.existsSync = existsSync;
|
package/lib/util/ids.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.toStandardizedId = toStandardizedId;
|
|
4
|
+
exports.toConfiguredId = toConfiguredId;
|
|
4
5
|
function toStandardizedId(commandID, config) {
|
|
5
6
|
return commandID.replaceAll(new RegExp(config.topicSeparator, 'g'), ':');
|
|
6
7
|
}
|
|
7
|
-
exports.toStandardizedId = toStandardizedId;
|
|
8
8
|
function toConfiguredId(commandID, config) {
|
|
9
9
|
const defaultTopicSeparator = ':';
|
|
10
10
|
return commandID.replaceAll(new RegExp(defaultTopicSeparator, 'g'), config.topicSeparator || defaultTopicSeparator);
|
|
11
11
|
}
|
|
12
|
-
exports.toConfiguredId = toConfiguredId;
|
package/lib/util/os.d.ts
CHANGED
package/lib/util/os.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getHomeDir = getHomeDir;
|
|
4
|
+
exports.getPlatform = getPlatform;
|
|
4
5
|
const node_os_1 = require("node:os");
|
|
5
6
|
/**
|
|
6
7
|
* Call os.homedir() and return the result
|
|
@@ -13,7 +14,6 @@ const node_os_1 = require("node:os");
|
|
|
13
14
|
function getHomeDir() {
|
|
14
15
|
return (0, node_os_1.homedir)();
|
|
15
16
|
}
|
|
16
|
-
exports.getHomeDir = getHomeDir;
|
|
17
17
|
/**
|
|
18
18
|
* Call os.platform() and return the result
|
|
19
19
|
*
|
|
@@ -25,4 +25,3 @@ exports.getHomeDir = getHomeDir;
|
|
|
25
25
|
function getPlatform() {
|
|
26
26
|
return (0, node_os_1.platform)();
|
|
27
27
|
}
|
|
28
|
-
exports.getPlatform = getPlatform;
|
package/lib/util/read-pjson.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readPjson =
|
|
3
|
+
exports.readPjson = readPjson;
|
|
4
4
|
const lilconfig_1 = require("lilconfig");
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
6
|
const logger_1 = require("../logger");
|
|
@@ -53,4 +53,3 @@ async function readPjson(path) {
|
|
|
53
53
|
oclif: result?.config ?? {},
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
exports.readPjson = readPjson;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readTSConfig =
|
|
3
|
+
exports.readTSConfig = readTSConfig;
|
|
4
4
|
const promises_1 = require("node:fs/promises");
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
6
|
const warn_1 = require("../errors/warn");
|
|
@@ -75,4 +75,3 @@ async function readTSConfig(root, tsconfigName = 'tsconfig.json') {
|
|
|
75
75
|
'ts-node': (0, util_1.mergeNestedObjects)(found, 'ts-node'),
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
exports.readTSConfig = readTSConfig;
|
package/lib/util/util.js
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.pickBy = pickBy;
|
|
4
|
+
exports.compact = compact;
|
|
5
|
+
exports.uniqBy = uniqBy;
|
|
6
|
+
exports.last = last;
|
|
7
|
+
exports.sortBy = sortBy;
|
|
8
|
+
exports.castArray = castArray;
|
|
9
|
+
exports.isProd = isProd;
|
|
10
|
+
exports.maxBy = maxBy;
|
|
11
|
+
exports.sumBy = sumBy;
|
|
12
|
+
exports.capitalize = capitalize;
|
|
13
|
+
exports.isTruthy = isTruthy;
|
|
14
|
+
exports.isNotFalsy = isNotFalsy;
|
|
15
|
+
exports.uniq = uniq;
|
|
16
|
+
exports.mapValues = mapValues;
|
|
17
|
+
exports.mergeNestedObjects = mergeNestedObjects;
|
|
4
18
|
function pickBy(obj, fn) {
|
|
5
19
|
return Object.entries(obj).reduce((o, [k, v]) => {
|
|
6
20
|
if (fn(v))
|
|
@@ -8,25 +22,21 @@ function pickBy(obj, fn) {
|
|
|
8
22
|
return o;
|
|
9
23
|
}, {});
|
|
10
24
|
}
|
|
11
|
-
exports.pickBy = pickBy;
|
|
12
25
|
function compact(a) {
|
|
13
26
|
// eslint-disable-next-line unicorn/prefer-native-coercion-functions
|
|
14
27
|
return a.filter((a) => Boolean(a));
|
|
15
28
|
}
|
|
16
|
-
exports.compact = compact;
|
|
17
29
|
function uniqBy(arr, fn) {
|
|
18
30
|
return arr.filter((a, i) => {
|
|
19
31
|
const aVal = fn(a);
|
|
20
32
|
return !arr.some((b, j) => j > i && fn(b) === aVal);
|
|
21
33
|
});
|
|
22
34
|
}
|
|
23
|
-
exports.uniqBy = uniqBy;
|
|
24
35
|
function last(arr) {
|
|
25
36
|
if (!arr)
|
|
26
37
|
return;
|
|
27
38
|
return arr.at(-1);
|
|
28
39
|
}
|
|
29
|
-
exports.last = last;
|
|
30
40
|
function compare(a, b) {
|
|
31
41
|
a = a === undefined ? 0 : a;
|
|
32
42
|
b = b === undefined ? 0 : b;
|
|
@@ -47,17 +57,14 @@ function compare(a, b) {
|
|
|
47
57
|
function sortBy(arr, fn) {
|
|
48
58
|
return arr.sort((a, b) => compare(fn(a), fn(b)));
|
|
49
59
|
}
|
|
50
|
-
exports.sortBy = sortBy;
|
|
51
60
|
function castArray(input) {
|
|
52
61
|
if (input === undefined)
|
|
53
62
|
return [];
|
|
54
63
|
return Array.isArray(input) ? input : [input];
|
|
55
64
|
}
|
|
56
|
-
exports.castArray = castArray;
|
|
57
65
|
function isProd() {
|
|
58
66
|
return !['development', 'test'].includes(process.env.NODE_ENV ?? '');
|
|
59
67
|
}
|
|
60
|
-
exports.isProd = isProd;
|
|
61
68
|
function maxBy(arr, fn) {
|
|
62
69
|
if (arr.length === 0) {
|
|
63
70
|
return undefined;
|
|
@@ -68,38 +75,30 @@ function maxBy(arr, fn) {
|
|
|
68
75
|
return curr > max ? i : maxItem;
|
|
69
76
|
});
|
|
70
77
|
}
|
|
71
|
-
exports.maxBy = maxBy;
|
|
72
78
|
function sumBy(arr, fn) {
|
|
73
79
|
return arr.reduce((sum, i) => sum + fn(i), 0);
|
|
74
80
|
}
|
|
75
|
-
exports.sumBy = sumBy;
|
|
76
81
|
function capitalize(s) {
|
|
77
82
|
return s ? s.charAt(0).toUpperCase() + s.slice(1).toLowerCase() : '';
|
|
78
83
|
}
|
|
79
|
-
exports.capitalize = capitalize;
|
|
80
84
|
function isTruthy(input) {
|
|
81
85
|
return ['1', 'true', 'y', 'yes'].includes(input.toLowerCase());
|
|
82
86
|
}
|
|
83
|
-
exports.isTruthy = isTruthy;
|
|
84
87
|
function isNotFalsy(input) {
|
|
85
88
|
return !['0', 'false', 'n', 'no'].includes(input.toLowerCase());
|
|
86
89
|
}
|
|
87
|
-
exports.isNotFalsy = isNotFalsy;
|
|
88
90
|
function uniq(arr) {
|
|
89
91
|
return [...new Set(arr)].sort();
|
|
90
92
|
}
|
|
91
|
-
exports.uniq = uniq;
|
|
92
93
|
function mapValues(obj, fn) {
|
|
93
94
|
return Object.entries(obj).reduce((o, [k, v]) => {
|
|
94
95
|
o[k] = fn(v, k);
|
|
95
96
|
return o;
|
|
96
97
|
}, {});
|
|
97
98
|
}
|
|
98
|
-
exports.mapValues = mapValues;
|
|
99
99
|
function get(obj, path) {
|
|
100
100
|
return path.split('.').reduce((o, p) => o?.[p], obj);
|
|
101
101
|
}
|
|
102
102
|
function mergeNestedObjects(objs, path) {
|
|
103
103
|
return Object.fromEntries(objs.flatMap((o) => Object.entries(get(o, path) ?? {})).reverse());
|
|
104
104
|
}
|
|
105
|
-
exports.mergeNestedObjects = mergeNestedObjects;
|
package/lib/ux/colorize-json.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tokenize =
|
|
3
|
+
exports.tokenize = tokenize;
|
|
4
|
+
exports.default = colorizeJson;
|
|
4
5
|
const theme_1 = require("./theme");
|
|
5
6
|
const tokenTypes = [
|
|
6
7
|
{ regex: /^\s+/, tokenType: 'whitespace' },
|
|
@@ -38,7 +39,6 @@ function tokenize(json, options) {
|
|
|
38
39
|
} while (hasRemainingTokens(input, foundToken));
|
|
39
40
|
return tokens;
|
|
40
41
|
}
|
|
41
|
-
exports.tokenize = tokenize;
|
|
42
42
|
function hasRemainingTokens(input, foundToken) {
|
|
43
43
|
return (input?.length ?? 0) > 0 && foundToken;
|
|
44
44
|
}
|
|
@@ -64,4 +64,3 @@ function colorizeJson(json, options) {
|
|
|
64
64
|
const opts = { ...options, pretty: options?.pretty ?? true };
|
|
65
65
|
return tokenize(json, opts).reduce((acc, token) => acc + (0, theme_1.colorize)(options?.theme?.[token.type], token.value), '');
|
|
66
66
|
}
|
|
67
|
-
exports.default = colorizeJson;
|
package/lib/ux/list.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = renderList;
|
|
3
4
|
const screen_1 = require("../screen");
|
|
4
5
|
const util_1 = require("../util/util");
|
|
5
6
|
const wordwrap = require('wordwrap');
|
|
@@ -25,4 +26,3 @@ function renderList(items) {
|
|
|
25
26
|
});
|
|
26
27
|
return lines.join('\n');
|
|
27
28
|
}
|
|
28
|
-
exports.default = renderList;
|
package/lib/ux/supports-color.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.supportsColor =
|
|
3
|
+
exports.supportsColor = supportsColor;
|
|
4
4
|
const supports_color_1 = require("supports-color");
|
|
5
5
|
function supportsColor() {
|
|
6
6
|
return Boolean(supports_color_1.stdout) && Boolean(supports_color_1.stderr);
|
|
7
7
|
}
|
|
8
|
-
exports.supportsColor = supportsColor;
|
package/lib/ux/theme.js
CHANGED
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.colorize = colorize;
|
|
7
|
+
exports.parseTheme = parseTheme;
|
|
7
8
|
const ansis_1 = __importDefault(require("ansis"));
|
|
8
9
|
const theme_1 = require("../interfaces/theme");
|
|
9
10
|
const supports_color_1 = require("./supports-color");
|
|
@@ -34,13 +35,11 @@ function colorize(color, text) {
|
|
|
34
35
|
}
|
|
35
36
|
return text;
|
|
36
37
|
}
|
|
37
|
-
exports.colorize = colorize;
|
|
38
38
|
function parseTheme(theme) {
|
|
39
39
|
return Object.fromEntries(Object.entries(theme)
|
|
40
40
|
.map(([key, value]) => [key, typeof value === 'string' ? isValid(value) : parseTheme(value)])
|
|
41
41
|
.filter(([_, value]) => value));
|
|
42
42
|
}
|
|
43
|
-
exports.parseTheme = parseTheme;
|
|
44
43
|
function isValid(color) {
|
|
45
44
|
return color.startsWith('#') || color.startsWith('rgb') || isStandardAnsi(color) ? color : undefined;
|
|
46
45
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oclif/core",
|
|
3
3
|
"description": "base library for oclif CLIs",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.9",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/oclif/core/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"husky": "^9",
|
|
56
56
|
"lint-staged": "^15",
|
|
57
57
|
"madge": "^6.1.0",
|
|
58
|
-
"mocha": "^10.
|
|
58
|
+
"mocha": "^10.6.0",
|
|
59
59
|
"nyc": "^15.1.0",
|
|
60
60
|
"prettier": "^3.3.2",
|
|
61
61
|
"shx": "^0.3.4",
|