@zuplo/cli 7.9.6 → 7.9.9
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/node_modules/@inquirer/ansi/README.md +35 -3
- package/node_modules/@inquirer/ansi/package.json +2 -2
- package/node_modules/@inquirer/checkbox/README.md +75 -5
- package/node_modules/@inquirer/checkbox/package.json +5 -5
- package/node_modules/@inquirer/confirm/README.md +81 -5
- package/node_modules/@inquirer/confirm/dist/index.d.ts +10 -0
- package/node_modules/@inquirer/confirm/dist/index.js +29 -6
- package/node_modules/@inquirer/confirm/package.json +4 -4
- package/node_modules/@inquirer/core/README.md +35 -3
- package/node_modules/@inquirer/core/dist/lib/__probe/p1.d.ts +9 -0
- package/node_modules/@inquirer/core/dist/lib/__probe/p1.js +4 -0
- package/node_modules/@inquirer/core/dist/lib/__probe/p2.d.ts +9 -0
- package/node_modules/@inquirer/core/dist/lib/__probe/p2.js +3 -0
- package/node_modules/@inquirer/core/dist/lib/__probe/p3.d.ts +9 -0
- package/node_modules/@inquirer/core/dist/lib/__probe/p3.js +5 -0
- package/node_modules/@inquirer/core/dist/lib/create-prompt.js +4 -3
- package/node_modules/@inquirer/core/dist/lib/hook-engine.js +8 -10
- package/node_modules/@inquirer/core/dist/lib/make-theme.js +2 -2
- package/node_modules/@inquirer/core/package.json +4 -4
- package/node_modules/@inquirer/editor/README.md +75 -5
- package/node_modules/@inquirer/editor/package.json +5 -5
- package/node_modules/@inquirer/expand/README.md +75 -5
- package/node_modules/@inquirer/expand/dist/index.js +3 -3
- package/node_modules/@inquirer/expand/package.json +4 -4
- package/node_modules/@inquirer/external-editor/README.md +35 -3
- package/node_modules/@inquirer/external-editor/package.json +2 -2
- package/node_modules/@inquirer/input/README.md +75 -5
- package/node_modules/@inquirer/input/package.json +4 -4
- package/node_modules/@inquirer/number/README.md +75 -5
- package/node_modules/@inquirer/number/package.json +4 -4
- package/node_modules/@inquirer/password/README.md +75 -5
- package/node_modules/@inquirer/password/package.json +5 -5
- package/node_modules/@inquirer/rawlist/README.md +75 -5
- package/node_modules/@inquirer/rawlist/dist/index.js +5 -4
- package/node_modules/@inquirer/rawlist/package.json +4 -4
- package/node_modules/@inquirer/search/README.md +74 -4
- package/node_modules/@inquirer/search/dist/index.js +1 -1
- package/node_modules/@inquirer/search/package.json +4 -4
- package/node_modules/@inquirer/select/README.md +75 -5
- package/node_modules/@inquirer/select/package.json +5 -5
- package/node_modules/@inquirer/type/dist/utils.d.ts +11 -0
- package/node_modules/@inquirer/type/dist/utils.js +15 -1
- package/node_modules/@inquirer/type/package.json +2 -2
- package/node_modules/@modelcontextprotocol/client/README.md +1 -7
- package/node_modules/@modelcontextprotocol/client/package.json +3 -3
- package/node_modules/@modelcontextprotocol/core/package.json +1 -1
- package/node_modules/@modelcontextprotocol/sdk/README.md +8 -2
- package/node_modules/@modelcontextprotocol/sdk/package.json +1 -1
- package/node_modules/@modelcontextprotocol/server/README.md +1 -7
- package/node_modules/@modelcontextprotocol/server/package.json +3 -3
- package/node_modules/@posthog/core/dist/utils/bot-detection.d.ts +7 -1
- package/node_modules/@posthog/core/dist/utils/bot-detection.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/utils/bot-detection.js +25 -5
- package/node_modules/@posthog/core/dist/utils/bot-detection.mjs +21 -5
- package/node_modules/@posthog/core/package.json +1 -1
- package/node_modules/@posthog/core/src/utils/bot-detection.spec.ts +100 -0
- package/node_modules/@posthog/core/src/utils/bot-detection.ts +48 -4
- package/node_modules/@zuplo/core/package.json +1 -1
- package/node_modules/@zuplo/graphql/package.json +1 -1
- package/node_modules/@zuplo/openapi-tools/package.json +1 -1
- package/node_modules/@zuplo/otel/package.json +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-233GXONP.js → chunk-WFAFGL5Y.js} +91 -91
- package/node_modules/@zuplo/runtime/out/esm/chunk-WFAFGL5Y.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/types/index.d.ts +1 -1
- package/node_modules/@zuplo/runtime/package.json +1 -1
- package/node_modules/hono/dist/cjs/hono-base.js +2 -0
- package/node_modules/hono/dist/cjs/middleware/language/language.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/mount/index.js +71 -0
- package/node_modules/hono/dist/cjs/request.js +4 -4
- package/node_modules/hono/dist/hono-base.js +2 -0
- package/node_modules/hono/dist/middleware/mount/index.js +70 -0
- package/node_modules/hono/dist/request.js +4 -4
- package/node_modules/hono/dist/types/hono-base.d.ts +2 -0
- package/node_modules/hono/dist/types/jsx/base.d.ts +1 -1
- package/node_modules/hono/dist/types/middleware/mount/index.d.ts +46 -0
- package/node_modules/hono/dist/types/request.d.ts +4 -4
- package/node_modules/hono/package.json +9 -1
- package/package.json +12 -12
- package/node_modules/@inquirer/core/dist/lib/promise-polyfill.d.ts +0 -7
- package/node_modules/@inquirer/core/dist/lib/promise-polyfill.js +0 -14
- package/node_modules/@zuplo/runtime/out/esm/chunk-233GXONP.js.map +0 -1
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-233GXONP.js.LEGAL.txt → chunk-WFAFGL5Y.js.LEGAL.txt} +0 -0
|
@@ -6,21 +6,53 @@ A lightweight package providing ANSI escape sequences for terminal cursor manipu
|
|
|
6
6
|
|
|
7
7
|
<table>
|
|
8
8
|
<tr>
|
|
9
|
-
<th>npm</th>
|
|
10
9
|
<th>yarn</th>
|
|
10
|
+
<th>pnpm</th>
|
|
11
11
|
</tr>
|
|
12
12
|
<tr>
|
|
13
13
|
<td>
|
|
14
14
|
|
|
15
15
|
```sh
|
|
16
|
-
|
|
16
|
+
yarn add @inquirer/ansi
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
</td>
|
|
20
20
|
<td>
|
|
21
21
|
|
|
22
22
|
```sh
|
|
23
|
-
|
|
23
|
+
pnpm add @inquirer/ansi
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
</td>
|
|
27
|
+
</tr>
|
|
28
|
+
<tr>
|
|
29
|
+
<th>bun</th>
|
|
30
|
+
<th>deno</th>
|
|
31
|
+
</tr>
|
|
32
|
+
<tr>
|
|
33
|
+
<td>
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
bun add @inquirer/ansi
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
</td>
|
|
40
|
+
<td>
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
deno add npm:@inquirer/ansi
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
</td>
|
|
47
|
+
</tr>
|
|
48
|
+
<tr>
|
|
49
|
+
<th colSpan="2">npm</th>
|
|
50
|
+
</tr>
|
|
51
|
+
<tr>
|
|
52
|
+
<td colSpan="2">
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
npm install @inquirer/ansi
|
|
24
56
|
```
|
|
25
57
|
|
|
26
58
|
</td>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inquirer/ansi",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"ansi",
|
|
6
6
|
"answer",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
},
|
|
76
76
|
"main": "./dist/index.js",
|
|
77
77
|
"types": "./dist/index.d.ts",
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "a9436bd94d55a439df308f50e77a7cd0b2078e98"
|
|
79
79
|
}
|
|
@@ -8,46 +8,116 @@ Simple interactive command line prompt to display a list of checkboxes (multi se
|
|
|
8
8
|
|
|
9
9
|
<table>
|
|
10
10
|
<tr>
|
|
11
|
-
<th>npm</th>
|
|
12
11
|
<th>yarn</th>
|
|
12
|
+
<th>pnpm</th>
|
|
13
13
|
</tr>
|
|
14
14
|
<tr>
|
|
15
15
|
<td>
|
|
16
16
|
|
|
17
17
|
```sh
|
|
18
|
-
|
|
18
|
+
yarn add @inquirer/prompts
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
</td>
|
|
22
22
|
<td>
|
|
23
23
|
|
|
24
24
|
```sh
|
|
25
|
-
|
|
25
|
+
pnpm add @inquirer/prompts
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
</td>
|
|
29
29
|
</tr>
|
|
30
30
|
<tr>
|
|
31
|
-
<
|
|
31
|
+
<th>bun</th>
|
|
32
|
+
<th>deno</th>
|
|
32
33
|
</tr>
|
|
33
34
|
<tr>
|
|
34
35
|
<td>
|
|
35
36
|
|
|
36
37
|
```sh
|
|
37
|
-
|
|
38
|
+
bun add @inquirer/prompts
|
|
38
39
|
```
|
|
39
40
|
|
|
40
41
|
</td>
|
|
41
42
|
<td>
|
|
42
43
|
|
|
44
|
+
```sh
|
|
45
|
+
deno add npm:@inquirer/prompts
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
</td>
|
|
49
|
+
</tr>
|
|
50
|
+
<tr>
|
|
51
|
+
<th colSpan="2">npm</th>
|
|
52
|
+
</tr>
|
|
53
|
+
<tr>
|
|
54
|
+
<td colSpan="2">
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
npm install @inquirer/prompts
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
</td>
|
|
61
|
+
</tr>
|
|
62
|
+
<tr>
|
|
63
|
+
<td colSpan="2" align="center">Or</td>
|
|
64
|
+
</tr>
|
|
65
|
+
<tr>
|
|
66
|
+
<th>yarn</th>
|
|
67
|
+
<th>pnpm</th>
|
|
68
|
+
</tr>
|
|
69
|
+
<tr>
|
|
70
|
+
<td>
|
|
71
|
+
|
|
43
72
|
```sh
|
|
44
73
|
yarn add @inquirer/checkbox
|
|
45
74
|
```
|
|
46
75
|
|
|
76
|
+
</td>
|
|
77
|
+
<td>
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
pnpm add @inquirer/checkbox
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
</td>
|
|
84
|
+
</tr>
|
|
85
|
+
<tr>
|
|
86
|
+
<th>bun</th>
|
|
87
|
+
<th>deno</th>
|
|
88
|
+
</tr>
|
|
89
|
+
<tr>
|
|
90
|
+
<td>
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
bun add @inquirer/checkbox
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
</td>
|
|
97
|
+
<td>
|
|
98
|
+
|
|
99
|
+
```sh
|
|
100
|
+
deno add npm:@inquirer/checkbox
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
</td>
|
|
104
|
+
</tr>
|
|
105
|
+
<tr>
|
|
106
|
+
<th colSpan="2">npm</th>
|
|
107
|
+
</tr>
|
|
108
|
+
<tr>
|
|
109
|
+
<td colSpan="2">
|
|
110
|
+
|
|
111
|
+
```sh
|
|
112
|
+
npm install @inquirer/checkbox
|
|
113
|
+
```
|
|
114
|
+
|
|
47
115
|
</td>
|
|
48
116
|
</tr>
|
|
49
117
|
</table>
|
|
50
118
|
|
|
119
|
+
On Deno, prompts detect the terminal's unicode and color support from the environment, so run your script with `--allow-env`.
|
|
120
|
+
|
|
51
121
|
# Usage
|
|
52
122
|
|
|
53
123
|
```js
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inquirer/checkbox",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.6",
|
|
4
4
|
"description": "Inquirer checkbox prompt",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"answer",
|
|
@@ -67,10 +67,10 @@
|
|
|
67
67
|
"tsc": "tsc"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@inquirer/ansi": "^2.0.
|
|
71
|
-
"@inquirer/core": "^12.0.
|
|
70
|
+
"@inquirer/ansi": "^2.0.9",
|
|
71
|
+
"@inquirer/core": "^12.0.4",
|
|
72
72
|
"@inquirer/figures": "^2.0.9",
|
|
73
|
-
"@inquirer/type": "4.
|
|
73
|
+
"@inquirer/type": "4.2.0"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@repo/tsconfig": "0.0.0",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
},
|
|
90
90
|
"main": "./dist/index.js",
|
|
91
91
|
"types": "./dist/index.d.ts",
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "a9436bd94d55a439df308f50e77a7cd0b2078e98"
|
|
93
93
|
}
|
|
@@ -8,46 +8,116 @@ Simple interactive command line prompt to gather boolean input from users.
|
|
|
8
8
|
|
|
9
9
|
<table>
|
|
10
10
|
<tr>
|
|
11
|
-
<th>npm</th>
|
|
12
11
|
<th>yarn</th>
|
|
12
|
+
<th>pnpm</th>
|
|
13
13
|
</tr>
|
|
14
14
|
<tr>
|
|
15
15
|
<td>
|
|
16
16
|
|
|
17
17
|
```sh
|
|
18
|
-
|
|
18
|
+
yarn add @inquirer/prompts
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
</td>
|
|
22
22
|
<td>
|
|
23
23
|
|
|
24
24
|
```sh
|
|
25
|
-
|
|
25
|
+
pnpm add @inquirer/prompts
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
</td>
|
|
29
29
|
</tr>
|
|
30
30
|
<tr>
|
|
31
|
-
<
|
|
31
|
+
<th>bun</th>
|
|
32
|
+
<th>deno</th>
|
|
32
33
|
</tr>
|
|
33
34
|
<tr>
|
|
34
35
|
<td>
|
|
35
36
|
|
|
36
37
|
```sh
|
|
37
|
-
|
|
38
|
+
bun add @inquirer/prompts
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
</td>
|
|
42
|
+
<td>
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
deno add npm:@inquirer/prompts
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
</td>
|
|
49
|
+
</tr>
|
|
50
|
+
<tr>
|
|
51
|
+
<th colSpan="2">npm</th>
|
|
52
|
+
</tr>
|
|
53
|
+
<tr>
|
|
54
|
+
<td colSpan="2">
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
npm install @inquirer/prompts
|
|
38
58
|
```
|
|
39
59
|
|
|
40
60
|
</td>
|
|
61
|
+
</tr>
|
|
62
|
+
<tr>
|
|
63
|
+
<td colSpan="2" align="center">Or</td>
|
|
64
|
+
</tr>
|
|
65
|
+
<tr>
|
|
66
|
+
<th>yarn</th>
|
|
67
|
+
<th>pnpm</th>
|
|
68
|
+
</tr>
|
|
69
|
+
<tr>
|
|
41
70
|
<td>
|
|
42
71
|
|
|
43
72
|
```sh
|
|
44
73
|
yarn add @inquirer/confirm
|
|
45
74
|
```
|
|
46
75
|
|
|
76
|
+
</td>
|
|
77
|
+
<td>
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
pnpm add @inquirer/confirm
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
</td>
|
|
84
|
+
</tr>
|
|
85
|
+
<tr>
|
|
86
|
+
<th>bun</th>
|
|
87
|
+
<th>deno</th>
|
|
88
|
+
</tr>
|
|
89
|
+
<tr>
|
|
90
|
+
<td>
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
bun add @inquirer/confirm
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
</td>
|
|
97
|
+
<td>
|
|
98
|
+
|
|
99
|
+
```sh
|
|
100
|
+
deno add npm:@inquirer/confirm
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
</td>
|
|
104
|
+
</tr>
|
|
105
|
+
<tr>
|
|
106
|
+
<th colSpan="2">npm</th>
|
|
107
|
+
</tr>
|
|
108
|
+
<tr>
|
|
109
|
+
<td colSpan="2">
|
|
110
|
+
|
|
111
|
+
```sh
|
|
112
|
+
npm install @inquirer/confirm
|
|
113
|
+
```
|
|
114
|
+
|
|
47
115
|
</td>
|
|
48
116
|
</tr>
|
|
49
117
|
</table>
|
|
50
118
|
|
|
119
|
+
On Deno, prompts detect the terminal's unicode and color support from the environment, so run your script with `--allow-env`.
|
|
120
|
+
|
|
51
121
|
# Usage
|
|
52
122
|
|
|
53
123
|
```js
|
|
@@ -81,6 +151,7 @@ type Theme = {
|
|
|
81
151
|
keywords: {
|
|
82
152
|
yes: string;
|
|
83
153
|
no: string;
|
|
154
|
+
error: (keywords: { yes: string; no: string }) => string;
|
|
84
155
|
};
|
|
85
156
|
style: {
|
|
86
157
|
answer: (text: string) => string;
|
|
@@ -94,6 +165,11 @@ type Theme = {
|
|
|
94
165
|
The `keywords` property defines the words accepted as "yes" and "no". Matching is
|
|
95
166
|
prefix-based and case-insensitive, and the first character of each word is shown in
|
|
96
167
|
the hint (e.g. `Y/n`). The matched word is also displayed once the prompt is answered.
|
|
168
|
+
|
|
169
|
+
The built-in `y`/`n`/`yes`/`no` answers are always accepted, whatever the keywords
|
|
170
|
+
are. Unrecognized input shows the `keywords.error` message instead of silently
|
|
171
|
+
falling back on the default answer.
|
|
172
|
+
|
|
97
173
|
Overriding `keywords` is how `@inquirer/i18n` localizes the prompt:
|
|
98
174
|
|
|
99
175
|
```ts
|
|
@@ -11,10 +11,20 @@ type ConfirmTheme = {
|
|
|
11
11
|
* Words accepted as "yes" and "no" answers. Matching is prefix-based and
|
|
12
12
|
* case-insensitive, and the first character of each word is shown in the
|
|
13
13
|
* hint. These words are also displayed once the prompt is answered.
|
|
14
|
+
* Regardless of these keywords, the built-in `y`/`n`/`yes`/`no` answers are
|
|
15
|
+
* always accepted.
|
|
14
16
|
*/
|
|
15
17
|
keywords: {
|
|
16
18
|
yes: string;
|
|
17
19
|
no: string;
|
|
20
|
+
/**
|
|
21
|
+
* Message shown when the submitted input matches no keyword. Receives the
|
|
22
|
+
* yes/no keywords; this is how `@inquirer/i18n` localizes the message.
|
|
23
|
+
*/
|
|
24
|
+
error: (keywords: {
|
|
25
|
+
yes: string;
|
|
26
|
+
no: string;
|
|
27
|
+
}) => string;
|
|
18
28
|
};
|
|
19
29
|
style: {
|
|
20
30
|
/**
|
|
@@ -4,6 +4,7 @@ const confirmTheme = {
|
|
|
4
4
|
keywords: {
|
|
5
5
|
yes: 'Yes',
|
|
6
6
|
no: 'No',
|
|
7
|
+
error: ({ yes, no }) => `You must answer with "${yes}" or "${no}"`,
|
|
7
8
|
},
|
|
8
9
|
style: {
|
|
9
10
|
confirmDefault: (text) => {
|
|
@@ -18,6 +19,7 @@ const confirmTheme = {
|
|
|
18
19
|
export default createPrompt((config, done) => {
|
|
19
20
|
const [status, setStatus] = useState('idle');
|
|
20
21
|
const [value, setValue] = useState('');
|
|
22
|
+
const [errorMsg, setError] = useState();
|
|
21
23
|
const theme = makeTheme(confirmTheme, config.theme);
|
|
22
24
|
const prefix = usePrefix({ status, theme });
|
|
23
25
|
const { yes, no } = theme.keywords;
|
|
@@ -32,33 +34,50 @@ export default createPrompt((config, done) => {
|
|
|
32
34
|
return value ? yes : no;
|
|
33
35
|
}
|
|
34
36
|
const { transformer = boolToString } = config;
|
|
35
|
-
|
|
37
|
+
// Note: the built-in English `y`/`n`/`yes`/`no` answers are always accepted,
|
|
38
|
+
// whatever the localized keywords are; typing a single ASCII key is the
|
|
39
|
+
// terminal muscle memory, even in non-Latin locales.
|
|
40
|
+
function getBooleanValue(value) {
|
|
36
41
|
const v = value.trim().toLowerCase();
|
|
42
|
+
// Empty input selects the default answer (the one highlighted in the hint).
|
|
37
43
|
if (v === '')
|
|
38
|
-
return
|
|
44
|
+
return config.default !== false;
|
|
39
45
|
if (yes.toLowerCase().startsWith(v))
|
|
40
46
|
return true;
|
|
41
47
|
if (no.toLowerCase().startsWith(v))
|
|
42
48
|
return false;
|
|
43
|
-
|
|
49
|
+
if ('yes'.startsWith(v))
|
|
50
|
+
return true;
|
|
51
|
+
if ('no'.startsWith(v))
|
|
52
|
+
return false;
|
|
53
|
+
// Unrecognized input is rejected by the caller (shows an error).
|
|
54
|
+
return undefined;
|
|
44
55
|
}
|
|
45
56
|
useKeypress((key, rl) => {
|
|
46
57
|
if (status !== 'idle')
|
|
47
58
|
return;
|
|
48
59
|
if (isEnterKey(key)) {
|
|
49
|
-
const answer = getBooleanValue(value
|
|
60
|
+
const answer = getBooleanValue(value);
|
|
61
|
+
if (answer === undefined) {
|
|
62
|
+
// Reject unrecognized input instead of silently falling back on the
|
|
63
|
+
// default. Restore the typed input (the line event cleared it).
|
|
64
|
+
rl.write(value);
|
|
65
|
+
setError(theme.keywords.error({ yes, no }));
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
50
68
|
setValue(transformer(answer));
|
|
51
69
|
setStatus('done');
|
|
52
70
|
done(answer);
|
|
53
71
|
}
|
|
54
72
|
else if (isTabKey(key)) {
|
|
55
|
-
const answer = boolToString(!getBooleanValue(value
|
|
73
|
+
const answer = boolToString(!(getBooleanValue(value) ?? config.default !== false));
|
|
56
74
|
rl.clearLine(0); // Remove the tab character.
|
|
57
75
|
rl.write(answer);
|
|
58
76
|
setValue(answer);
|
|
59
77
|
}
|
|
60
78
|
else {
|
|
61
79
|
setValue(rl.line);
|
|
80
|
+
setError(undefined);
|
|
62
81
|
}
|
|
63
82
|
});
|
|
64
83
|
let formattedValue = value;
|
|
@@ -70,5 +89,9 @@ export default createPrompt((config, done) => {
|
|
|
70
89
|
defaultValue = ` ${theme.style.defaultAnswer(hint)}`;
|
|
71
90
|
}
|
|
72
91
|
const message = theme.style.message(config.message, status);
|
|
73
|
-
|
|
92
|
+
let error = '';
|
|
93
|
+
if (errorMsg) {
|
|
94
|
+
error = theme.style.error(errorMsg);
|
|
95
|
+
}
|
|
96
|
+
return [`${prefix} ${message}${defaultValue} ${formattedValue}`, error];
|
|
74
97
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inquirer/confirm",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.3",
|
|
4
4
|
"description": "Inquirer confirm prompt",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"answer",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"tsc": "tsc"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@inquirer/core": "^12.0.
|
|
71
|
-
"@inquirer/type": "4.
|
|
70
|
+
"@inquirer/core": "^12.0.4",
|
|
71
|
+
"@inquirer/type": "4.2.0"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@repo/tsconfig": "0.0.0",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
},
|
|
88
88
|
"main": "./dist/index.js",
|
|
89
89
|
"types": "./dist/index.d.ts",
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "a9436bd94d55a439df308f50e77a7cd0b2078e98"
|
|
91
91
|
}
|
|
@@ -8,21 +8,53 @@ It aims to implements a lightweight API similar to React hooks - but without JSX
|
|
|
8
8
|
|
|
9
9
|
<table>
|
|
10
10
|
<tr>
|
|
11
|
-
<th>npm</th>
|
|
12
11
|
<th>yarn</th>
|
|
12
|
+
<th>pnpm</th>
|
|
13
13
|
</tr>
|
|
14
14
|
<tr>
|
|
15
15
|
<td>
|
|
16
16
|
|
|
17
17
|
```sh
|
|
18
|
-
|
|
18
|
+
yarn add @inquirer/core
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
</td>
|
|
22
22
|
<td>
|
|
23
23
|
|
|
24
24
|
```sh
|
|
25
|
-
|
|
25
|
+
pnpm add @inquirer/core
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
</td>
|
|
29
|
+
</tr>
|
|
30
|
+
<tr>
|
|
31
|
+
<th>bun</th>
|
|
32
|
+
<th>deno</th>
|
|
33
|
+
</tr>
|
|
34
|
+
<tr>
|
|
35
|
+
<td>
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
bun add @inquirer/core
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
</td>
|
|
42
|
+
<td>
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
deno add npm:@inquirer/core
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
</td>
|
|
49
|
+
</tr>
|
|
50
|
+
<tr>
|
|
51
|
+
<th colSpan="2">npm</th>
|
|
52
|
+
</tr>
|
|
53
|
+
<tr>
|
|
54
|
+
<td colSpan="2">
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
npm install @inquirer/core
|
|
26
58
|
```
|
|
27
59
|
|
|
28
60
|
</td>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as readline from 'node:readline';
|
|
2
2
|
import { AsyncResource } from 'node:async_hooks';
|
|
3
|
+
import { withResolver } from '@inquirer/type';
|
|
3
4
|
import MuteStream from 'mute-stream';
|
|
4
5
|
import { onExit as onSignalExit } from 'signal-exit';
|
|
5
6
|
import ScreenManager from "./screen-manager.js";
|
|
6
|
-
import { PromisePolyfill } from "./promise-polyfill.js";
|
|
7
7
|
import { withHooks, effectScheduler } from "./hook-engine.js";
|
|
8
8
|
import { AbortPromptError, CancelPromptError, ExitPromptError } from "./errors.js";
|
|
9
9
|
import path from 'node:path';
|
|
@@ -52,19 +52,20 @@ export function createPrompt(view) {
|
|
|
52
52
|
// Add mute capabilities to the output
|
|
53
53
|
const output = new MuteStream();
|
|
54
54
|
output.pipe(context.output ?? process.stdout);
|
|
55
|
-
|
|
55
|
+
/* oxlint-disable typescript/no-unsafe-type-assertion */
|
|
56
56
|
const rl = readline.createInterface({
|
|
57
57
|
terminal: true,
|
|
58
58
|
input,
|
|
59
59
|
output,
|
|
60
60
|
});
|
|
61
|
+
/* oxlint-enable typescript/no-unsafe-type-assertion */
|
|
61
62
|
// Mute the output after readline has initialized so readline can perform
|
|
62
63
|
// any terminal setup writes (e.g. Windows Console API initialization)
|
|
63
64
|
// before suppressing output. ScreenManager will unmute/mute around each
|
|
64
65
|
// render call as needed.
|
|
65
66
|
output.mute();
|
|
66
67
|
const screen = new ScreenManager(rl);
|
|
67
|
-
const { promise, resolve, reject } =
|
|
68
|
+
const { promise, resolve, reject } = withResolver();
|
|
68
69
|
return withHooks(rl, (cycle) => {
|
|
69
70
|
// Clear hook effects synchronously before the prompt settles: readline
|
|
70
71
|
// emits keypresses synchronously within a single data event, so a
|
|
@@ -16,16 +16,14 @@ function createStore(rl) {
|
|
|
16
16
|
// Run callback in with the hook engine setup.
|
|
17
17
|
export function withHooks(rl, cb) {
|
|
18
18
|
const store = createStore(rl);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
store.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return cb(cycle);
|
|
28
|
-
});
|
|
19
|
+
function cycle(render) {
|
|
20
|
+
store.handleChange = () => {
|
|
21
|
+
store.index = 0;
|
|
22
|
+
render();
|
|
23
|
+
};
|
|
24
|
+
store.handleChange();
|
|
25
|
+
}
|
|
26
|
+
return hookStorage.run(store, () => cb(cycle));
|
|
29
27
|
}
|
|
30
28
|
// Safe getStore utility that'll return the store or throw if undefined.
|
|
31
29
|
function getStore() {
|
|
@@ -23,11 +23,11 @@ function deepMerge(...objects) {
|
|
|
23
23
|
return output;
|
|
24
24
|
}
|
|
25
25
|
export function makeTheme(...themes) {
|
|
26
|
-
|
|
26
|
+
/* oxlint-disable typescript/no-unsafe-type-assertion */
|
|
27
27
|
const themesToMerge = [
|
|
28
28
|
getDefaultTheme(),
|
|
29
29
|
...themes.filter((theme) => theme != null),
|
|
30
30
|
];
|
|
31
|
-
// oxlint-disable-next-line typescript/no-unsafe-type-assertion
|
|
32
31
|
return deepMerge(...themesToMerge);
|
|
32
|
+
/* oxlint-enable typescript/no-unsafe-type-assertion */
|
|
33
33
|
}
|