@topcli/prompts 1.7.0 → 1.8.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/src/utils.js DELETED
@@ -1,43 +0,0 @@
1
- import process from "node:process";
2
-
3
- // CONSTANTS
4
- const kAnsiRegex = ansiRegex();
5
-
6
- /**
7
- * @see https://github.com/chalk/ansi-regex
8
- */
9
- export function ansiRegex({onlyFirst = false} = {}) {
10
- const pattern = [
11
- '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
12
- '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))'
13
- ].join('|');
14
-
15
- return new RegExp(pattern, onlyFirst ? undefined : 'g');
16
- }
17
-
18
- /**
19
- * @param {!string} string
20
- * @returns {string}
21
- */
22
- export function stripAnsi(string) {
23
- return string.replace(kAnsiRegex, "");
24
- }
25
-
26
- /**
27
- * @see https://github.com/sindresorhus/is-unicode-supported
28
- * @returns {boolean}
29
- */
30
- export function isUnicodeSupported() {
31
- if (process.platform !== 'win32') {
32
- return process.env.TERM !== 'linux'; // Linux console (kernel)
33
- }
34
-
35
- return Boolean(process.env.WT_SESSION) // Windows Terminal
36
- || Boolean(process.env.TERMINUS_SUBLIME) // Terminus (<0.2.27)
37
- || process.env.ConEmuTask === '{cmd::Cmder}' // ConEmu and cmder
38
- || process.env.TERM_PROGRAM === 'Terminus-Sublime'
39
- || process.env.TERM_PROGRAM === 'vscode'
40
- || process.env.TERM === 'xterm-256color'
41
- || process.env.TERM === 'alacritty'
42
- || process.env.TERMINAL_EMULATOR === 'JetBrains-JediTerm';
43
- }
package/src/validators.js DELETED
@@ -1,6 +0,0 @@
1
- export function required() {
2
- return {
3
- validate: (input) => (Array.isArray(input) ? input.length > 0 : Boolean(input)),
4
- error: () => "required"
5
- };
6
- }