@inquirer/password 4.0.23 → 5.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/password",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "Inquirer password prompt",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"answer",
|
|
@@ -53,52 +53,31 @@
|
|
|
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/ansi": "^
|
|
78
|
-
"@inquirer/core": "^
|
|
79
|
-
"@inquirer/type": "^
|
|
67
|
+
"@inquirer/ansi": "^2.0.1",
|
|
68
|
+
"@inquirer/core": "^11.0.1",
|
|
69
|
+
"@inquirer/type": "^4.0.1"
|
|
80
70
|
},
|
|
81
71
|
"devDependencies": {
|
|
82
|
-
"@
|
|
83
|
-
"
|
|
84
|
-
"@repo/tsconfig": "0.0.0",
|
|
85
|
-
"tshy": "^3.0.3"
|
|
72
|
+
"@inquirer/testing": "^3.0.1",
|
|
73
|
+
"typescript": "^5.9.3"
|
|
86
74
|
},
|
|
87
75
|
"engines": {
|
|
88
|
-
"node": ">=
|
|
76
|
+
"node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0"
|
|
89
77
|
},
|
|
90
78
|
"publishConfig": {
|
|
91
79
|
"access": "public"
|
|
92
80
|
},
|
|
93
|
-
"tshy": {
|
|
94
|
-
"exclude": [
|
|
95
|
-
"src/**/*.test.ts"
|
|
96
|
-
],
|
|
97
|
-
"exports": {
|
|
98
|
-
"./package.json": "./package.json",
|
|
99
|
-
".": "./src/index.ts"
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
81
|
"peerDependencies": {
|
|
103
82
|
"@types/node": ">=18"
|
|
104
83
|
},
|
|
@@ -107,5 +86,5 @@
|
|
|
107
86
|
"optional": true
|
|
108
87
|
}
|
|
109
88
|
},
|
|
110
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "cce79ce3b9bbdfb4dbb798078cf3b94b9adc7d1b"
|
|
111
90
|
}
|
package/dist/commonjs/index.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const core_1 = require("@inquirer/core");
|
|
4
|
-
const ansi_1 = require("@inquirer/ansi");
|
|
5
|
-
exports.default = (0, core_1.createPrompt)((config, done) => {
|
|
6
|
-
const { validate = () => true } = config;
|
|
7
|
-
const theme = (0, core_1.makeTheme)(config.theme);
|
|
8
|
-
const [status, setStatus] = (0, core_1.useState)('idle');
|
|
9
|
-
const [errorMsg, setError] = (0, core_1.useState)();
|
|
10
|
-
const [value, setValue] = (0, core_1.useState)('');
|
|
11
|
-
const prefix = (0, core_1.usePrefix)({ status, theme });
|
|
12
|
-
(0, core_1.useKeypress)(async (key, rl) => {
|
|
13
|
-
// Ignore keypress while our prompt is doing other processing.
|
|
14
|
-
if (status !== 'idle') {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
if ((0, core_1.isEnterKey)(key)) {
|
|
18
|
-
const answer = value;
|
|
19
|
-
setStatus('loading');
|
|
20
|
-
const isValid = await validate(answer);
|
|
21
|
-
if (isValid === true) {
|
|
22
|
-
setValue(answer);
|
|
23
|
-
setStatus('done');
|
|
24
|
-
done(answer);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
// Reset the readline line value to the previous value. On line event, the value
|
|
28
|
-
// get cleared, forcing the user to re-enter the value instead of fixing it.
|
|
29
|
-
rl.write(value);
|
|
30
|
-
setError(isValid || 'You must provide a valid value');
|
|
31
|
-
setStatus('idle');
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
setValue(rl.line);
|
|
36
|
-
setError(undefined);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
const message = theme.style.message(config.message, status);
|
|
40
|
-
let formattedValue = '';
|
|
41
|
-
let helpTip;
|
|
42
|
-
if (config.mask) {
|
|
43
|
-
const maskChar = typeof config.mask === 'string' ? config.mask : '*';
|
|
44
|
-
formattedValue = maskChar.repeat(value.length);
|
|
45
|
-
}
|
|
46
|
-
else if (status !== 'done') {
|
|
47
|
-
helpTip = `${theme.style.help('[input is masked]')}${ansi_1.cursorHide}`;
|
|
48
|
-
}
|
|
49
|
-
if (status === 'done') {
|
|
50
|
-
formattedValue = theme.style.answer(formattedValue);
|
|
51
|
-
}
|
|
52
|
-
let error = '';
|
|
53
|
-
if (errorMsg) {
|
|
54
|
-
error = theme.style.error(errorMsg);
|
|
55
|
-
}
|
|
56
|
-
return [[prefix, message, config.mask ? formattedValue : helpTip].join(' '), error];
|
|
57
|
-
});
|
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 PasswordConfig = {
|
|
4
|
-
message: string;
|
|
5
|
-
mask?: boolean | string;
|
|
6
|
-
validate?: (value: string) => boolean | string | Promise<string | boolean>;
|
|
7
|
-
theme?: PartialDeep<Theme>;
|
|
8
|
-
};
|
|
9
|
-
declare const _default: import("@inquirer/type").Prompt<string, PasswordConfig>;
|
|
10
|
-
export default _default;
|
package/dist/esm/package.json
DELETED
|
File without changes
|
|
File without changes
|