@inquirer/select 3.0.1 → 4.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/dist/{cjs → commonjs}/index.js +5 -6
- package/dist/commonjs/package.json +3 -0
- package/dist/esm/{index.mjs → index.js} +2 -2
- package/dist/esm/package.json +3 -0
- package/package.json +52 -36
- package/dist/types/index.d.ts +0 -28
- /package/dist/{cjs/types → commonjs}/index.d.ts +0 -0
- /package/dist/esm/{types/index.d.mts → index.d.ts} +0 -0
|
@@ -21,7 +21,6 @@ function isSelectable(item) {
|
|
|
21
21
|
}
|
|
22
22
|
function normalizeChoices(choices) {
|
|
23
23
|
return choices.map((choice) => {
|
|
24
|
-
var _a, _b, _c;
|
|
25
24
|
if (core_1.Separator.isSeparator(choice))
|
|
26
25
|
return choice;
|
|
27
26
|
if (typeof choice === 'string') {
|
|
@@ -32,13 +31,13 @@ function normalizeChoices(choices) {
|
|
|
32
31
|
disabled: false,
|
|
33
32
|
};
|
|
34
33
|
}
|
|
35
|
-
const name =
|
|
34
|
+
const name = choice.name ?? String(choice.value);
|
|
36
35
|
return {
|
|
37
36
|
value: choice.value,
|
|
38
37
|
name,
|
|
39
38
|
description: choice.description,
|
|
40
|
-
short:
|
|
41
|
-
disabled:
|
|
39
|
+
short: choice.short ?? name,
|
|
40
|
+
disabled: choice.disabled ?? false,
|
|
42
41
|
};
|
|
43
42
|
});
|
|
44
43
|
}
|
|
@@ -53,7 +52,7 @@ exports.default = (0, core_1.createPrompt)((config, done) => {
|
|
|
53
52
|
const bounds = (0, core_1.useMemo)(() => {
|
|
54
53
|
const first = items.findIndex(isSelectable);
|
|
55
54
|
const last = items.findLastIndex(isSelectable);
|
|
56
|
-
if (first
|
|
55
|
+
if (first === -1) {
|
|
57
56
|
throw new core_1.ValidationError('[select prompt] No selectable choices. All choices are disabled.');
|
|
58
57
|
}
|
|
59
58
|
return { first, last };
|
|
@@ -104,7 +103,7 @@ exports.default = (0, core_1.createPrompt)((config, done) => {
|
|
|
104
103
|
return false;
|
|
105
104
|
return item.name.toLowerCase().startsWith(searchTerm);
|
|
106
105
|
});
|
|
107
|
-
if (matchIndex
|
|
106
|
+
if (matchIndex !== -1) {
|
|
108
107
|
setActive(matchIndex);
|
|
109
108
|
}
|
|
110
109
|
searchTimeoutRef.current = setTimeout(() => {
|
|
@@ -46,7 +46,7 @@ export default createPrompt((config, done) => {
|
|
|
46
46
|
const bounds = useMemo(() => {
|
|
47
47
|
const first = items.findIndex(isSelectable);
|
|
48
48
|
const last = items.findLastIndex(isSelectable);
|
|
49
|
-
if (first
|
|
49
|
+
if (first === -1) {
|
|
50
50
|
throw new ValidationError('[select prompt] No selectable choices. All choices are disabled.');
|
|
51
51
|
}
|
|
52
52
|
return { first, last };
|
|
@@ -97,7 +97,7 @@ export default createPrompt((config, done) => {
|
|
|
97
97
|
return false;
|
|
98
98
|
return item.name.toLowerCase().startsWith(searchTerm);
|
|
99
99
|
});
|
|
100
|
-
if (matchIndex
|
|
100
|
+
if (matchIndex !== -1) {
|
|
101
101
|
setActive(matchIndex);
|
|
102
102
|
}
|
|
103
103
|
searchTimeoutRef.current = setTimeout(() => {
|
package/package.json
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inquirer/select",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Inquirer select/list prompt",
|
|
5
|
-
"main": "./dist/cjs/index.js",
|
|
6
|
-
"typings": "./dist/cjs/types/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"dist/**/*"
|
|
9
|
-
],
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "https://github.com/SBoudrias/Inquirer.js.git"
|
|
13
|
-
},
|
|
14
5
|
"keywords": [
|
|
15
6
|
"answer",
|
|
16
7
|
"answers",
|
|
@@ -50,43 +41,68 @@
|
|
|
50
41
|
"yo",
|
|
51
42
|
"zsh"
|
|
52
43
|
],
|
|
53
|
-
"author": "Simon Boudrias <admin@simonboudrias.com>",
|
|
54
|
-
"license": "MIT",
|
|
55
44
|
"homepage": "https://github.com/SBoudrias/Inquirer.js/blob/main/packages/select/README.md",
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "https://github.com/SBoudrias/Inquirer.js.git"
|
|
48
|
+
},
|
|
49
|
+
"license": "MIT",
|
|
50
|
+
"author": "Simon Boudrias <admin@simonboudrias.com>",
|
|
51
|
+
"sideEffects": false,
|
|
52
|
+
"type": "module",
|
|
53
|
+
"exports": {
|
|
54
|
+
"./package.json": "./package.json",
|
|
55
|
+
".": {
|
|
56
|
+
"import": {
|
|
57
|
+
"types": "./dist/esm/index.d.ts",
|
|
58
|
+
"default": "./dist/esm/index.js"
|
|
59
|
+
},
|
|
60
|
+
"require": {
|
|
61
|
+
"types": "./dist/commonjs/index.d.ts",
|
|
62
|
+
"default": "./dist/commonjs/index.js"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"main": "./dist/commonjs/index.js",
|
|
67
|
+
"module": "./dist/esm/index.js",
|
|
68
|
+
"types": "./dist/commonjs/index.d.ts",
|
|
69
|
+
"files": [
|
|
70
|
+
"dist"
|
|
71
|
+
],
|
|
72
|
+
"scripts": {
|
|
73
|
+
"attw": "attw --pack",
|
|
74
|
+
"tsc": "tshy"
|
|
75
|
+
},
|
|
56
76
|
"dependencies": {
|
|
57
|
-
"@inquirer/core": "^
|
|
58
|
-
"@inquirer/figures": "^1.0.
|
|
59
|
-
"@inquirer/type": "^
|
|
77
|
+
"@inquirer/core": "^10.0.1",
|
|
78
|
+
"@inquirer/figures": "^1.0.7",
|
|
79
|
+
"@inquirer/type": "^3.0.0",
|
|
60
80
|
"ansi-escapes": "^4.3.2",
|
|
61
81
|
"yoctocolors-cjs": "^2.1.2"
|
|
62
82
|
},
|
|
63
83
|
"devDependencies": {
|
|
64
|
-
"@
|
|
84
|
+
"@arethetypeswrong/cli": "^0.16.4",
|
|
85
|
+
"@inquirer/testing": "^2.1.36",
|
|
86
|
+
"@repo/tsconfig": "workspace:*",
|
|
87
|
+
"tshy": "^3.0.2"
|
|
65
88
|
},
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"tsc:esm": "rm -rf dist/esm && tsc -p ./tsconfig.json",
|
|
69
|
-
"tsc:cjs": "rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs",
|
|
70
|
-
"attw": "attw --pack"
|
|
89
|
+
"engines": {
|
|
90
|
+
"node": ">=18"
|
|
71
91
|
},
|
|
72
92
|
"publishConfig": {
|
|
73
93
|
"access": "public"
|
|
74
94
|
},
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
|
|
82
|
-
"default": "./dist/esm/index.mjs"
|
|
83
|
-
},
|
|
84
|
-
"require": {
|
|
85
|
-
"types": "./dist/cjs/types/index.d.ts",
|
|
86
|
-
"default": "./dist/cjs/index.js"
|
|
87
|
-
}
|
|
95
|
+
"tshy": {
|
|
96
|
+
"exclude": [
|
|
97
|
+
"src/**/*.test.ts"
|
|
98
|
+
],
|
|
99
|
+
"exports": {
|
|
100
|
+
"./package.json": "./package.json",
|
|
101
|
+
".": "./src/index.ts"
|
|
88
102
|
}
|
|
89
103
|
},
|
|
90
|
-
"
|
|
91
|
-
|
|
104
|
+
"peerDependencies": {
|
|
105
|
+
"@types/node": ">=18"
|
|
106
|
+
},
|
|
107
|
+
"gitHead": "da3dd749325495266025f2dbdb339a812da468f8"
|
|
92
108
|
}
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Separator, type Theme } from '@inquirer/core';
|
|
2
|
-
import type { PartialDeep } from '@inquirer/type';
|
|
3
|
-
type SelectTheme = {
|
|
4
|
-
icon: {
|
|
5
|
-
cursor: string;
|
|
6
|
-
};
|
|
7
|
-
style: {
|
|
8
|
-
disabled: (text: string) => string;
|
|
9
|
-
};
|
|
10
|
-
helpMode: 'always' | 'never' | 'auto';
|
|
11
|
-
};
|
|
12
|
-
type Choice<Value> = {
|
|
13
|
-
value: Value;
|
|
14
|
-
name?: string;
|
|
15
|
-
description?: string;
|
|
16
|
-
disabled?: boolean | string;
|
|
17
|
-
type?: never;
|
|
18
|
-
};
|
|
19
|
-
declare const _default: <Value>(config: {
|
|
20
|
-
message: string;
|
|
21
|
-
choices: readonly (Separator | Choice<Value>)[];
|
|
22
|
-
pageSize?: number;
|
|
23
|
-
loop?: boolean;
|
|
24
|
-
default?: unknown;
|
|
25
|
-
theme?: PartialDeep<Theme<SelectTheme>>;
|
|
26
|
-
}, context?: import("@inquirer/type").Context) => import("@inquirer/type").CancelablePromise<Value>;
|
|
27
|
-
export default _default;
|
|
28
|
-
export { Separator } from '@inquirer/core';
|
|
File without changes
|
|
File without changes
|