@inquirer/password 0.0.18-alpha.0 → 0.0.21-alpha.0

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.
@@ -0,0 +1,6 @@
1
+ import input, { InputConfig } from '@inquirer/input/src';
2
+ declare type PasswordConfig = InputConfig & {
3
+ mask?: boolean | string;
4
+ };
5
+ declare const _default: (config: PasswordConfig, stdio?: Parameters<typeof input>[1]) => Promise<string>;
6
+ export default _default;
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ import input from '@inquirer/input/src';
2
+ import chalk from 'chalk';
3
+ export default (config, stdio) => {
4
+ if (config.transformer) {
5
+ throw new Error('Inquirer password prompt do not support custom transformer function. Use the input prompt instead.');
6
+ }
7
+ return input({
8
+ ...config,
9
+ default: undefined,
10
+ transformer(input, { isFinal }) {
11
+ if (config.mask) {
12
+ return String(config.mask).repeat(input.length);
13
+ }
14
+ if (!isFinal) {
15
+ return chalk.dim('[input is masked]');
16
+ }
17
+ return '';
18
+ },
19
+ }, stdio);
20
+ };
package/package.json CHANGED
@@ -1,8 +1,13 @@
1
1
  {
2
2
  "name": "@inquirer/password",
3
- "version": "0.0.18-alpha.0",
3
+ "type": "module",
4
+ "version": "0.0.21-alpha.0",
4
5
  "description": "Inquirer password prompt",
5
- "main": "index.js",
6
+ "main": "dist/index.js",
7
+ "typings": "dist/index.d.ts",
8
+ "files": [
9
+ "dist/"
10
+ ],
6
11
  "repository": "SBoudrias/Inquirer.js",
7
12
  "keywords": [
8
13
  "cli",
@@ -18,11 +23,14 @@
18
23
  "license": "MIT",
19
24
  "homepage": "https://github.com/SBoudrias/Inquirer.js/blob/master/packages/password/README.md",
20
25
  "dependencies": {
21
- "@inquirer/input": "^0.0.19-alpha.0",
22
- "chalk": "^4.1.1"
26
+ "@inquirer/input": "^0.0.22-alpha.0",
27
+ "chalk": "^5.0.1"
28
+ },
29
+ "scripts": {
30
+ "tsc": "tsc"
23
31
  },
24
32
  "publishConfig": {
25
33
  "access": "public"
26
34
  },
27
- "gitHead": "9baee326b04b4e8565e815b1fa577c36e0b93727"
35
+ "gitHead": "1d5e7e3d15c86851f2e5df2bb9f55084ba231c54"
28
36
  }
package/demo.js DELETED
@@ -1,16 +0,0 @@
1
- const password = require('.');
2
-
3
- (async () => {
4
- let answer;
5
-
6
- answer = await password({
7
- message: 'Enter a silent password?',
8
- });
9
- console.log('Answer:', answer);
10
-
11
- answer = await password({
12
- message: 'Enter a masked password?',
13
- mask: '*',
14
- });
15
- console.log('Answer:', answer);
16
- })();
package/index.js DELETED
@@ -1,29 +0,0 @@
1
- const input = require('@inquirer/input');
2
- const chalk = require('chalk');
3
-
4
- module.exports = (config, ...args) => {
5
- if (config.transformer) {
6
- throw new Error(
7
- 'Inquirer password prompt do not support custom transformer function. Use the input prompt instead.'
8
- );
9
- }
10
-
11
- return input(
12
- {
13
- ...config, // Make sure we do not display the default password
14
- default: undefined,
15
- transformer: (input, { isFinal }) => {
16
- if (config.mask) {
17
- return String(config.mask).repeat(input.length);
18
- }
19
-
20
- if (!isFinal) {
21
- return chalk.dim('[input is masked]');
22
- }
23
-
24
- return '';
25
- },
26
- },
27
- ...args
28
- );
29
- };