@topcli/prompts 1.7.0 → 1.8.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.
- package/LICENSE +13 -13
- package/README.md +211 -214
- package/dist/index.cjs +871 -0
- package/dist/index.d.cts +77 -0
- package/dist/index.d.ts +77 -0
- package/dist/index.js +830 -0
- package/package.json +55 -43
- package/index.d.ts +0 -77
- package/index.js +0 -30
- package/src/constants.js +0 -39
- package/src/prompt-agent.js +0 -56
- package/src/prompts/abstract.js +0 -68
- package/src/prompts/confirm.js +0 -135
- package/src/prompts/index.js +0 -12
- package/src/prompts/multiselect.js +0 -346
- package/src/prompts/question.js +0 -115
- package/src/prompts/select.js +0 -215
- package/src/utils.js +0 -43
- package/src/validators.js +0 -6
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
|
-
}
|