@inquirer/core 8.1.0 → 8.2.1
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.
|
@@ -2,9 +2,33 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.makeTheme = void 0;
|
|
4
4
|
const theme_mjs_1 = require('./theme.js');
|
|
5
|
+
function isPlainObject(value) {
|
|
6
|
+
if (typeof value !== 'object' || value === null)
|
|
7
|
+
return false;
|
|
8
|
+
let proto = value;
|
|
9
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
10
|
+
proto = Object.getPrototypeOf(proto);
|
|
11
|
+
}
|
|
12
|
+
return Object.getPrototypeOf(value) === proto;
|
|
13
|
+
}
|
|
14
|
+
function deepMerge(...objects) {
|
|
15
|
+
const output = {};
|
|
16
|
+
for (const obj of objects) {
|
|
17
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
18
|
+
const prevValue = output[key];
|
|
19
|
+
output[key] =
|
|
20
|
+
isPlainObject(prevValue) && isPlainObject(value)
|
|
21
|
+
? deepMerge(prevValue, value)
|
|
22
|
+
: value;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return output;
|
|
26
|
+
}
|
|
5
27
|
function makeTheme(...themes) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
28
|
+
const themesToMerge = [
|
|
29
|
+
theme_mjs_1.defaultTheme,
|
|
30
|
+
...themes.filter((theme) => theme != null),
|
|
31
|
+
];
|
|
32
|
+
return deepMerge(...themesToMerge);
|
|
9
33
|
}
|
|
10
34
|
exports.makeTheme = makeTheme;
|
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
import { defaultTheme } from './theme.mjs';
|
|
2
|
+
function isPlainObject(value) {
|
|
3
|
+
if (typeof value !== 'object' || value === null)
|
|
4
|
+
return false;
|
|
5
|
+
let proto = value;
|
|
6
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
7
|
+
proto = Object.getPrototypeOf(proto);
|
|
8
|
+
}
|
|
9
|
+
return Object.getPrototypeOf(value) === proto;
|
|
10
|
+
}
|
|
11
|
+
function deepMerge(...objects) {
|
|
12
|
+
const output = {};
|
|
13
|
+
for (const obj of objects) {
|
|
14
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
15
|
+
const prevValue = output[key];
|
|
16
|
+
output[key] =
|
|
17
|
+
isPlainObject(prevValue) && isPlainObject(value)
|
|
18
|
+
? deepMerge(prevValue, value)
|
|
19
|
+
: value;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return output;
|
|
23
|
+
}
|
|
2
24
|
export function makeTheme(...themes) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
25
|
+
const themesToMerge = [
|
|
26
|
+
defaultTheme,
|
|
27
|
+
...themes.filter((theme) => theme != null),
|
|
28
|
+
];
|
|
29
|
+
return deepMerge(...themesToMerge);
|
|
6
30
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inquirer/core",
|
|
3
|
-
"version": "8.1
|
|
3
|
+
"version": "8.2.1",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=18"
|
|
6
6
|
},
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
"license": "MIT",
|
|
58
58
|
"homepage": "https://github.com/SBoudrias/Inquirer.js/blob/master/packages/core/README.md",
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@inquirer/figures": "^1.0.
|
|
61
|
-
"@inquirer/type": "^1.3.
|
|
60
|
+
"@inquirer/figures": "^1.0.2",
|
|
61
|
+
"@inquirer/type": "^1.3.2",
|
|
62
62
|
"@types/mute-stream": "^0.0.4",
|
|
63
|
-
"@types/node": "^20.12.
|
|
63
|
+
"@types/node": "^20.12.12",
|
|
64
64
|
"@types/wrap-ansi": "^3.0.0",
|
|
65
65
|
"ansi-escapes": "^4.3.2",
|
|
66
66
|
"chalk": "^4.1.2",
|
|
@@ -72,12 +72,13 @@
|
|
|
72
72
|
"wrap-ansi": "^6.2.0"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@inquirer/testing": "^2.1.
|
|
75
|
+
"@inquirer/testing": "^2.1.20"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
78
78
|
"tsc": "yarn run tsc:esm && yarn run tsc:cjs",
|
|
79
79
|
"tsc:esm": "rm -rf dist/esm && tsc -p ./tsconfig.json",
|
|
80
80
|
"tsc:cjs": "rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs",
|
|
81
|
+
"dev": "tsc -p ./tsconfig.json --watch",
|
|
81
82
|
"attw": "attw --pack"
|
|
82
83
|
},
|
|
83
84
|
"publishConfig": {
|
|
@@ -95,5 +96,5 @@
|
|
|
95
96
|
}
|
|
96
97
|
}
|
|
97
98
|
},
|
|
98
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "a2d925494f290e9c491457413c9f792e24d85c91"
|
|
99
100
|
}
|