@inquirer/core 8.2.4 → 9.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/README.md CHANGED
@@ -6,16 +6,33 @@ It aims to implements a lightweight API similar to React hooks - but without JSX
6
6
 
7
7
  # Installation
8
8
 
9
+ <table>
10
+ <tr>
11
+ <th>npm</th>
12
+ <th>yarn</th>
13
+ </tr>
14
+ <tr>
15
+ <td>
16
+
9
17
  ```sh
10
18
  npm install @inquirer/core
19
+ ```
20
+
21
+ </td>
22
+ <td>
11
23
 
24
+ ```sh
12
25
  yarn add @inquirer/core
13
26
  ```
14
27
 
28
+ </td>
29
+ </tr>
30
+ </table>
31
+
15
32
  # Usage
16
33
 
17
34
  ```ts
18
- import pc from 'picocolors';
35
+ import colors from 'yoctocolors';
19
36
  import {
20
37
  createPrompt,
21
38
  useState,
@@ -44,12 +61,12 @@ const confirm = createPrompt<boolean, { message: string; default?: boolean }>(
44
61
  let formattedValue = value;
45
62
  let defaultValue = '';
46
63
  if (status === 'done') {
47
- formattedValue = pc.cyan(value);
64
+ formattedValue = colors.cyan(value);
48
65
  } else {
49
- defaultValue = pc.dim(config.default === false ? ' (y/N)' : ' (Y/n)');
66
+ defaultValue = colors.dim(config.default === false ? ' (y/N)' : ' (Y/n)');
50
67
  }
51
68
 
52
- const message = pc.bold(config.message);
69
+ const message = colors.bold(config.message);
53
70
  return `${prefix} ${message}${defaultValue} ${formattedValue}`;
54
71
  },
55
72
  );
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Separator = void 0;
7
- const picocolors_1 = __importDefault(require("picocolors"));
7
+ const yoctocolors_cjs_1 = __importDefault(require("yoctocolors-cjs"));
8
8
  const figures_1 = __importDefault(require("@inquirer/figures"));
9
9
  /**
10
10
  * Separator object
@@ -16,7 +16,7 @@ class Separator {
16
16
  enumerable: true,
17
17
  configurable: true,
18
18
  writable: true,
19
- value: picocolors_1.default.dim(Array.from({ length: 15 }).join(figures_1.default.line))
19
+ value: yoctocolors_cjs_1.default.dim(Array.from({ length: 15 }).join(figures_1.default.line))
20
20
  });
21
21
  Object.defineProperty(this, "type", {
22
22
  enumerable: true,
@@ -4,21 +4,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.defaultTheme = void 0;
7
- const picocolors_1 = __importDefault(require("picocolors"));
7
+ const yoctocolors_cjs_1 = __importDefault(require("yoctocolors-cjs"));
8
8
  const cli_spinners_1 = __importDefault(require("cli-spinners"));
9
9
  exports.defaultTheme = {
10
- prefix: picocolors_1.default.green('?'),
10
+ prefix: yoctocolors_cjs_1.default.green('?'),
11
11
  spinner: {
12
12
  interval: cli_spinners_1.default.dots.interval,
13
- frames: cli_spinners_1.default.dots.frames.map((frame) => picocolors_1.default.yellow(frame)),
13
+ frames: cli_spinners_1.default.dots.frames.map((frame) => yoctocolors_cjs_1.default.yellow(frame)),
14
14
  },
15
15
  style: {
16
- answer: picocolors_1.default.cyan,
17
- message: picocolors_1.default.bold,
18
- error: (text) => picocolors_1.default.red(`> ${text}`),
19
- defaultAnswer: (text) => picocolors_1.default.dim(`(${text})`),
20
- help: picocolors_1.default.dim,
21
- highlight: picocolors_1.default.cyan,
22
- key: (text) => picocolors_1.default.cyan(picocolors_1.default.bold(`<${text}>`)),
16
+ answer: yoctocolors_cjs_1.default.cyan,
17
+ message: yoctocolors_cjs_1.default.bold,
18
+ error: (text) => yoctocolors_cjs_1.default.red(`> ${text}`),
19
+ defaultAnswer: (text) => yoctocolors_cjs_1.default.dim(`(${text})`),
20
+ help: yoctocolors_cjs_1.default.dim,
21
+ highlight: yoctocolors_cjs_1.default.cyan,
22
+ key: (text) => yoctocolors_cjs_1.default.cyan(yoctocolors_cjs_1.default.bold(`<${text}>`)),
23
23
  },
24
24
  };
@@ -11,4 +11,3 @@ export type { Theme } from './lib/theme.js';
11
11
  export { usePagination } from './lib/pagination/use-pagination.js';
12
12
  export { createPrompt } from './lib/create-prompt.js';
13
13
  export { Separator } from './lib/Separator.js';
14
- export { type InquirerReadline } from './lib/read-line.type.js';
@@ -1,4 +1,4 @@
1
- import type { InquirerReadline } from './read-line.type.js';
1
+ import type { InquirerReadline } from '@inquirer/type';
2
2
  type HookStore = {
3
3
  rl: InquirerReadline;
4
4
  hooks: any[];
@@ -1,4 +1,4 @@
1
- import type { InquirerReadline } from './read-line.type.js';
1
+ import type { InquirerReadline } from '@inquirer/type';
2
2
  export default class ScreenManager {
3
3
  private readonly rl;
4
4
  private height;
@@ -1,2 +1,2 @@
1
- import type { InquirerReadline } from './read-line.type.js';
1
+ import type { InquirerReadline } from '@inquirer/type';
2
2
  export declare function useEffect(cb: (rl: InquirerReadline) => void | (() => void), depArray: ReadonlyArray<unknown>): void;
@@ -1,3 +1,3 @@
1
- import { type InquirerReadline } from './read-line.type.js';
1
+ import { type InquirerReadline } from '@inquirer/type';
2
2
  import { type KeypressEvent } from './key.js';
3
3
  export declare function useKeypress(userHandler: (event: KeypressEvent, rl: InquirerReadline) => void): void;
@@ -1,11 +1,11 @@
1
- import pc from 'picocolors';
1
+ import colors from 'yoctocolors-cjs';
2
2
  import figures from '@inquirer/figures';
3
3
  /**
4
4
  * Separator object
5
5
  * Used to space/separate choices group
6
6
  */
7
7
  export class Separator {
8
- separator = pc.dim(Array.from({ length: 15 }).join(figures.line));
8
+ separator = colors.dim(Array.from({ length: 15 }).join(figures.line));
9
9
  type = 'separator';
10
10
  constructor(separator) {
11
11
  if (separator) {
@@ -1,18 +1,18 @@
1
- import pc from 'picocolors';
1
+ import colors from 'yoctocolors-cjs';
2
2
  import spinners from 'cli-spinners';
3
3
  export const defaultTheme = {
4
- prefix: pc.green('?'),
4
+ prefix: colors.green('?'),
5
5
  spinner: {
6
6
  interval: spinners.dots.interval,
7
- frames: spinners.dots.frames.map((frame) => pc.yellow(frame)),
7
+ frames: spinners.dots.frames.map((frame) => colors.yellow(frame)),
8
8
  },
9
9
  style: {
10
- answer: pc.cyan,
11
- message: pc.bold,
12
- error: (text) => pc.red(`> ${text}`),
13
- defaultAnswer: (text) => pc.dim(`(${text})`),
14
- help: pc.dim,
15
- highlight: pc.cyan,
16
- key: (text) => pc.cyan(pc.bold(`<${text}>`)),
10
+ answer: colors.cyan,
11
+ message: colors.bold,
12
+ error: (text) => colors.red(`> ${text}`),
13
+ defaultAnswer: (text) => colors.dim(`(${text})`),
14
+ help: colors.dim,
15
+ highlight: colors.cyan,
16
+ key: (text) => colors.cyan(colors.bold(`<${text}>`)),
17
17
  },
18
18
  };
@@ -11,4 +11,3 @@ export type { Theme } from './lib/theme.mjs';
11
11
  export { usePagination } from './lib/pagination/use-pagination.mjs';
12
12
  export { createPrompt } from './lib/create-prompt.mjs';
13
13
  export { Separator } from './lib/Separator.mjs';
14
- export { type InquirerReadline } from './lib/read-line.type.mjs';
@@ -1,4 +1,4 @@
1
- import type { InquirerReadline } from './read-line.type.mjs';
1
+ import type { InquirerReadline } from '@inquirer/type';
2
2
  type HookStore = {
3
3
  rl: InquirerReadline;
4
4
  hooks: any[];
@@ -1,4 +1,4 @@
1
- import type { InquirerReadline } from './read-line.type.mjs';
1
+ import type { InquirerReadline } from '@inquirer/type';
2
2
  export default class ScreenManager {
3
3
  private readonly rl;
4
4
  private height;
@@ -1,2 +1,2 @@
1
- import type { InquirerReadline } from './read-line.type.mjs';
1
+ import type { InquirerReadline } from '@inquirer/type';
2
2
  export declare function useEffect(cb: (rl: InquirerReadline) => void | (() => void), depArray: ReadonlyArray<unknown>): void;
@@ -1,3 +1,3 @@
1
- import { type InquirerReadline } from './read-line.type.mjs';
1
+ import { type InquirerReadline } from '@inquirer/type';
2
2
  import { type KeypressEvent } from './key.mjs';
3
3
  export declare function useKeypress(userHandler: (event: KeypressEvent, rl: InquirerReadline) => void): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inquirer/core",
3
- "version": "8.2.4",
3
+ "version": "9.0.1",
4
4
  "engines": {
5
5
  "node": ">=18"
6
6
  },
@@ -58,7 +58,7 @@
58
58
  "homepage": "https://github.com/SBoudrias/Inquirer.js/blob/master/packages/core/README.md",
59
59
  "dependencies": {
60
60
  "@inquirer/figures": "^1.0.3",
61
- "@inquirer/type": "^1.3.3",
61
+ "@inquirer/type": "^1.4.0",
62
62
  "@types/mute-stream": "^0.0.4",
63
63
  "@types/node": "^20.14.9",
64
64
  "@types/wrap-ansi": "^3.0.0",
@@ -66,13 +66,13 @@
66
66
  "cli-spinners": "^2.9.2",
67
67
  "cli-width": "^4.1.0",
68
68
  "mute-stream": "^1.0.0",
69
- "picocolors": "^1.0.1",
70
69
  "signal-exit": "^4.1.0",
71
70
  "strip-ansi": "^6.0.1",
72
- "wrap-ansi": "^6.2.0"
71
+ "wrap-ansi": "^6.2.0",
72
+ "yoctocolors-cjs": "^2.1.1"
73
73
  },
74
74
  "devDependencies": {
75
- "@inquirer/testing": "^2.1.23"
75
+ "@inquirer/testing": "^2.1.25"
76
76
  },
77
77
  "scripts": {
78
78
  "tsc": "yarn run tsc:esm && yarn run tsc:cjs",
@@ -97,5 +97,5 @@
97
97
  }
98
98
  },
99
99
  "sideEffects": false,
100
- "gitHead": "d5f62c6ee3e671f7d1b776b85d43781869d70918"
100
+ "gitHead": "2285f2c043448ff4317635cf6481df7ffda2d3bd"
101
101
  }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +0,0 @@
1
- import * as readline from 'node:readline';
2
- import MuteStream from 'mute-stream';
3
- export type InquirerReadline = readline.ReadLine & {
4
- output: MuteStream;
5
- input: NodeJS.ReadableStream;
6
- clearLine: (dir: 0 | 1 | -1) => void;
7
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- import * as readline from 'node:readline';
2
- import MuteStream from 'mute-stream';
3
- export type InquirerReadline = readline.ReadLine & {
4
- output: MuteStream;
5
- input: NodeJS.ReadableStream;
6
- clearLine: (dir: 0 | 1 | -1) => void;
7
- };