@oclif/core 4.0.28 → 4.0.30
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/config/config.js +11 -6
- package/lib/ux/colorize-json.d.ts +1 -1
- package/lib/ux/colorize-json.js +36 -34
- package/package.json +3 -3
package/lib/config/config.js
CHANGED
|
@@ -40,6 +40,7 @@ const performance_1 = require("../performance");
|
|
|
40
40
|
const settings_1 = require("../settings");
|
|
41
41
|
const determine_priority_1 = require("../util/determine-priority");
|
|
42
42
|
const fs_1 = require("../util/fs");
|
|
43
|
+
const ids_1 = require("../util/ids");
|
|
43
44
|
const os_1 = require("../util/os");
|
|
44
45
|
const util_2 = require("../util/util");
|
|
45
46
|
const ux_1 = require("../ux");
|
|
@@ -696,22 +697,26 @@ class Config {
|
|
|
696
697
|
this.commandPermutations.add(permutation, command.id);
|
|
697
698
|
}
|
|
698
699
|
const handleAlias = (alias, hidden = false) => {
|
|
699
|
-
|
|
700
|
+
const aliasWithDefaultTopicSeparator = (0, ids_1.toStandardizedId)(alias, this);
|
|
701
|
+
if (this._commands.has(aliasWithDefaultTopicSeparator)) {
|
|
700
702
|
const prioritizedCommand = (0, determine_priority_1.determinePriority)(this.pjson.oclif.plugins ?? [], [
|
|
701
|
-
this._commands.get(
|
|
703
|
+
this._commands.get(aliasWithDefaultTopicSeparator),
|
|
702
704
|
command,
|
|
703
705
|
]);
|
|
704
|
-
this._commands.set(
|
|
706
|
+
this._commands.set(aliasWithDefaultTopicSeparator, {
|
|
707
|
+
...prioritizedCommand,
|
|
708
|
+
id: aliasWithDefaultTopicSeparator,
|
|
709
|
+
});
|
|
705
710
|
}
|
|
706
711
|
else {
|
|
707
|
-
this._commands.set(
|
|
712
|
+
this._commands.set(aliasWithDefaultTopicSeparator, { ...command, hidden, id: aliasWithDefaultTopicSeparator });
|
|
708
713
|
}
|
|
709
714
|
// set every permutation of the aliases
|
|
710
715
|
// v3 moved command alias permutations to the manifest, but some plugins may not have
|
|
711
716
|
// the new manifest yet. For those, we need to calculate the permutations here.
|
|
712
717
|
const aliasPermutations = this.flexibleTaxonomy && command.aliasPermutations === undefined
|
|
713
|
-
? (0, util_3.getCommandIdPermutations)(
|
|
714
|
-
: (command.permutations ?? [
|
|
718
|
+
? (0, util_3.getCommandIdPermutations)(aliasWithDefaultTopicSeparator)
|
|
719
|
+
: (command.permutations ?? [aliasWithDefaultTopicSeparator]);
|
|
715
720
|
// set every permutation
|
|
716
721
|
for (const permutation of aliasPermutations) {
|
|
717
722
|
this.commandPermutations.add(permutation, command.id);
|
|
@@ -2,7 +2,7 @@ type Options = {
|
|
|
2
2
|
pretty?: boolean | undefined;
|
|
3
3
|
theme?: Record<string, string> | undefined;
|
|
4
4
|
};
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function stringifyInput(json?: unknown, options?: Options): string;
|
|
6
6
|
export declare function tokenize(json?: unknown, options?: Options): {
|
|
7
7
|
type: string;
|
|
8
8
|
value: string;
|
package/lib/ux/colorize-json.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.stringifyInput = stringifyInput;
|
|
4
4
|
exports.tokenize = tokenize;
|
|
5
5
|
exports.default = colorizeJson;
|
|
6
6
|
const theme_1 = require("./theme");
|
|
@@ -16,46 +16,48 @@ const tokenTypes = [
|
|
|
16
16
|
{ regex: /^true|^false/, tokenType: 'boolean' },
|
|
17
17
|
{ regex: /^null/, tokenType: 'null' },
|
|
18
18
|
];
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (
|
|
29
|
-
return;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
19
|
+
function stringify(value, replacer, spaces) {
|
|
20
|
+
return JSON.stringify(value, serializer(replacer, replacer), spaces);
|
|
21
|
+
}
|
|
22
|
+
// Inspired by https://github.com/moll/json-stringify-safe
|
|
23
|
+
function serializer(replacer, cycleReplacer) {
|
|
24
|
+
const stack = [];
|
|
25
|
+
const keys = [];
|
|
26
|
+
if (!cycleReplacer)
|
|
27
|
+
cycleReplacer = function (key, value) {
|
|
28
|
+
if (stack[0] === value)
|
|
29
|
+
return '[Circular ~]';
|
|
30
|
+
return '[Circular ~.' + keys.slice(0, stack.indexOf(value)).join('.') + ']';
|
|
31
|
+
};
|
|
32
|
+
return function (key, value) {
|
|
33
|
+
if (stack.length > 0) {
|
|
34
|
+
// @ts-expect-error because `this` is not typed
|
|
35
|
+
const thisPos = stack.indexOf(this);
|
|
36
|
+
// @ts-expect-error because `this` is not typed
|
|
37
|
+
// eslint-disable-next-line no-bitwise
|
|
38
|
+
~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
|
|
39
|
+
// eslint-disable-next-line no-bitwise
|
|
40
|
+
~thisPos ? keys.splice(thisPos, Number.POSITIVE_INFINITY, key) : keys.push(key);
|
|
41
|
+
// @ts-expect-error because `this` is not typed
|
|
42
|
+
if (stack.includes(value))
|
|
43
|
+
value = cycleReplacer.call(this, key, value);
|
|
45
44
|
}
|
|
46
|
-
|
|
45
|
+
else
|
|
46
|
+
stack.push(value);
|
|
47
|
+
// @ts-expect-error because `this` is not typed
|
|
48
|
+
return replacer ? replacer.call(this, key, value) : value;
|
|
47
49
|
};
|
|
48
|
-
return _removeCycles(object);
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
-
|
|
52
|
-
?
|
|
51
|
+
function stringifyInput(json, options) {
|
|
52
|
+
const str = options?.pretty
|
|
53
|
+
? stringify(typeof json === 'string' ? JSON.parse(json) : json, undefined, 2)
|
|
53
54
|
: typeof json === 'string'
|
|
54
55
|
? json
|
|
55
|
-
:
|
|
56
|
+
: stringify(json);
|
|
57
|
+
return str;
|
|
56
58
|
}
|
|
57
59
|
function tokenize(json, options) {
|
|
58
|
-
let input =
|
|
60
|
+
let input = stringifyInput(json, options);
|
|
59
61
|
const tokens = [];
|
|
60
62
|
let foundToken = false;
|
|
61
63
|
do {
|
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.30",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/oclif/core/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@types/debug": "^4.1.10",
|
|
38
38
|
"@types/ejs": "^3.1.5",
|
|
39
39
|
"@types/indent-string": "^4.0.1",
|
|
40
|
-
"@types/mocha": "^10.0.
|
|
40
|
+
"@types/mocha": "^10.0.9",
|
|
41
41
|
"@types/node": "^18",
|
|
42
42
|
"@types/pnpapi": "^0.0.5",
|
|
43
43
|
"@types/sinon": "^17.0.3",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"cross-env": "^7.0.3",
|
|
52
52
|
"eslint": "^8.57.1",
|
|
53
53
|
"eslint-config-oclif": "^5.2.1",
|
|
54
|
-
"eslint-config-oclif-typescript": "^3.1.
|
|
54
|
+
"eslint-config-oclif-typescript": "^3.1.12",
|
|
55
55
|
"eslint-config-prettier": "^9.1.0",
|
|
56
56
|
"husky": "^9.1.6",
|
|
57
57
|
"lint-staged": "^15",
|