@inquirer/confirm 5.1.21 → 6.0.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inquirer/confirm",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "Inquirer confirm prompt",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"answer",
|
|
@@ -53,51 +53,30 @@
|
|
|
53
53
|
"exports": {
|
|
54
54
|
"./package.json": "./package.json",
|
|
55
55
|
".": {
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
"default": "./dist/esm/index.js"
|
|
59
|
-
},
|
|
60
|
-
"require": {
|
|
61
|
-
"types": "./dist/commonjs/index.d.ts",
|
|
62
|
-
"default": "./dist/commonjs/index.js"
|
|
63
|
-
}
|
|
56
|
+
"types": "./dist/index.d.ts",
|
|
57
|
+
"default": "./dist/index.js"
|
|
64
58
|
}
|
|
65
59
|
},
|
|
66
|
-
"main": "./dist/commonjs/index.js",
|
|
67
|
-
"module": "./dist/esm/index.js",
|
|
68
|
-
"types": "./dist/commonjs/index.d.ts",
|
|
69
60
|
"files": [
|
|
70
61
|
"dist"
|
|
71
62
|
],
|
|
72
63
|
"scripts": {
|
|
73
|
-
"
|
|
74
|
-
"tsc": "tshy"
|
|
64
|
+
"tsc": "tsc"
|
|
75
65
|
},
|
|
76
66
|
"dependencies": {
|
|
77
|
-
"@inquirer/core": "^
|
|
78
|
-
"@inquirer/type": "^
|
|
67
|
+
"@inquirer/core": "^11.0.1",
|
|
68
|
+
"@inquirer/type": "^4.0.1"
|
|
79
69
|
},
|
|
80
70
|
"devDependencies": {
|
|
81
|
-
"@
|
|
82
|
-
"
|
|
83
|
-
"@repo/tsconfig": "0.0.0",
|
|
84
|
-
"tshy": "^3.0.3"
|
|
71
|
+
"@inquirer/testing": "^3.0.1",
|
|
72
|
+
"typescript": "^5.9.3"
|
|
85
73
|
},
|
|
86
74
|
"engines": {
|
|
87
|
-
"node": ">=
|
|
75
|
+
"node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0"
|
|
88
76
|
},
|
|
89
77
|
"publishConfig": {
|
|
90
78
|
"access": "public"
|
|
91
79
|
},
|
|
92
|
-
"tshy": {
|
|
93
|
-
"exclude": [
|
|
94
|
-
"src/**/*.test.ts"
|
|
95
|
-
],
|
|
96
|
-
"exports": {
|
|
97
|
-
"./package.json": "./package.json",
|
|
98
|
-
".": "./src/index.ts"
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
80
|
"peerDependencies": {
|
|
102
81
|
"@types/node": ">=18"
|
|
103
82
|
},
|
|
@@ -106,5 +85,5 @@
|
|
|
106
85
|
"optional": true
|
|
107
86
|
}
|
|
108
87
|
},
|
|
109
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "cce79ce3b9bbdfb4dbb798078cf3b94b9adc7d1b"
|
|
110
89
|
}
|
package/dist/commonjs/index.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const core_1 = require("@inquirer/core");
|
|
4
|
-
function getBooleanValue(value, defaultValue) {
|
|
5
|
-
let answer = defaultValue !== false;
|
|
6
|
-
if (/^(y|yes)/i.test(value))
|
|
7
|
-
answer = true;
|
|
8
|
-
else if (/^(n|no)/i.test(value))
|
|
9
|
-
answer = false;
|
|
10
|
-
return answer;
|
|
11
|
-
}
|
|
12
|
-
function boolToString(value) {
|
|
13
|
-
return value ? 'Yes' : 'No';
|
|
14
|
-
}
|
|
15
|
-
exports.default = (0, core_1.createPrompt)((config, done) => {
|
|
16
|
-
const { transformer = boolToString } = config;
|
|
17
|
-
const [status, setStatus] = (0, core_1.useState)('idle');
|
|
18
|
-
const [value, setValue] = (0, core_1.useState)('');
|
|
19
|
-
const theme = (0, core_1.makeTheme)(config.theme);
|
|
20
|
-
const prefix = (0, core_1.usePrefix)({ status, theme });
|
|
21
|
-
(0, core_1.useKeypress)((key, rl) => {
|
|
22
|
-
if (status !== 'idle')
|
|
23
|
-
return;
|
|
24
|
-
if ((0, core_1.isEnterKey)(key)) {
|
|
25
|
-
const answer = getBooleanValue(value, config.default);
|
|
26
|
-
setValue(transformer(answer));
|
|
27
|
-
setStatus('done');
|
|
28
|
-
done(answer);
|
|
29
|
-
}
|
|
30
|
-
else if ((0, core_1.isTabKey)(key)) {
|
|
31
|
-
const answer = boolToString(!getBooleanValue(value, config.default));
|
|
32
|
-
rl.clearLine(0); // Remove the tab character.
|
|
33
|
-
rl.write(answer);
|
|
34
|
-
setValue(answer);
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
setValue(rl.line);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
let formattedValue = value;
|
|
41
|
-
let defaultValue = '';
|
|
42
|
-
if (status === 'done') {
|
|
43
|
-
formattedValue = theme.style.answer(value);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
defaultValue = ` ${theme.style.defaultAnswer(config.default === false ? 'y/N' : 'Y/n')}`;
|
|
47
|
-
}
|
|
48
|
-
const message = theme.style.message(config.message, status);
|
|
49
|
-
return `${prefix} ${message}${defaultValue} ${formattedValue}`;
|
|
50
|
-
});
|
package/dist/esm/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type Theme } from '@inquirer/core';
|
|
2
|
-
import type { PartialDeep } from '@inquirer/type';
|
|
3
|
-
type ConfirmConfig = {
|
|
4
|
-
message: string;
|
|
5
|
-
default?: boolean;
|
|
6
|
-
transformer?: (value: boolean) => string;
|
|
7
|
-
theme?: PartialDeep<Theme>;
|
|
8
|
-
};
|
|
9
|
-
declare const _default: import("@inquirer/type").Prompt<boolean, ConfirmConfig>;
|
|
10
|
-
export default _default;
|
package/dist/esm/package.json
DELETED
|
File without changes
|
|
File without changes
|