@inquirer/password 1.1.4 → 1.1.6

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/dist/cjs/index.js CHANGED
@@ -5,8 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const input_1 = __importDefault(require("@inquirer/input"));
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
+ const ansi_escapes_1 = __importDefault(require("ansi-escapes"));
8
9
  const password = (config, context) => {
9
- if (config.transformer) {
10
+ if ('transformer' in config) {
10
11
  throw new Error('Inquirer password prompt do not support custom transformer function. Use the input prompt instead.');
11
12
  }
12
13
  return (0, input_1.default)(Object.assign(Object.assign({}, config), { default: undefined, transformer(input, { isFinal }) {
@@ -14,7 +15,7 @@ const password = (config, context) => {
14
15
  return String(config.mask).repeat(input.length);
15
16
  }
16
17
  if (!isFinal) {
17
- return chalk_1.default.dim('[input is masked]');
18
+ return `${chalk_1.default.dim('[input is masked]')}${ansi_escapes_1.default.cursorHide}`;
18
19
  }
19
20
  return '';
20
21
  } }), context);
@@ -1,6 +1,7 @@
1
1
  import type { Prompt } from '@inquirer/type';
2
2
  import input from '@inquirer/input';
3
- type PasswordConfig = Parameters<typeof input>[0] & {
3
+ type InputConfig = Parameters<typeof input>[0];
4
+ type PasswordConfig = Omit<InputConfig, 'transformer' | 'default'> & {
4
5
  mask?: boolean | string;
5
6
  };
6
7
  declare const password: Prompt<string, PasswordConfig>;
@@ -1,7 +1,8 @@
1
1
  import input from '@inquirer/input';
2
2
  import chalk from 'chalk';
3
+ import ansiEscapes from 'ansi-escapes';
3
4
  const password = (config, context) => {
4
- if (config.transformer) {
5
+ if ('transformer' in config) {
5
6
  throw new Error('Inquirer password prompt do not support custom transformer function. Use the input prompt instead.');
6
7
  }
7
8
  return input({
@@ -12,7 +13,7 @@ const password = (config, context) => {
12
13
  return String(config.mask).repeat(input.length);
13
14
  }
14
15
  if (!isFinal) {
15
- return chalk.dim('[input is masked]');
16
+ return `${chalk.dim('[input is masked]')}${ansiEscapes.cursorHide}`;
16
17
  }
17
18
  return '';
18
19
  },
@@ -1,6 +1,7 @@
1
1
  import type { Prompt } from '@inquirer/type';
2
2
  import input from '@inquirer/input';
3
- type PasswordConfig = Parameters<typeof input>[0] & {
3
+ type InputConfig = Parameters<typeof input>[0];
4
+ type PasswordConfig = Omit<InputConfig, 'transformer' | 'default'> & {
4
5
  mask?: boolean | string;
5
6
  };
6
7
  declare const password: Prompt<string, PasswordConfig>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inquirer/password",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "engines": {
5
5
  "node": ">=14.18.0"
6
6
  },
@@ -57,8 +57,9 @@
57
57
  "license": "MIT",
58
58
  "homepage": "https://github.com/SBoudrias/Inquirer.js/blob/master/packages/password/README.md",
59
59
  "dependencies": {
60
- "@inquirer/input": "^1.2.4",
60
+ "@inquirer/input": "^1.2.6",
61
61
  "@inquirer/type": "^1.1.1",
62
+ "ansi-escapes": "^4.3.2",
62
63
  "chalk": "^4.1.2"
63
64
  },
64
65
  "scripts": {
@@ -83,5 +84,5 @@
83
84
  }
84
85
  }
85
86
  },
86
- "gitHead": "b1b29c0b6da9420d739cd46704c205515de2db04"
87
+ "gitHead": "ab9dd2f301e02d2cc0fec699ce100b174f2b798e"
87
88
  }