@optique/inquirer 1.0.0-dev.459 → 1.0.0-dev.461
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/index.cjs +19 -3
- package/dist/index.js +19 -3
- package/package.json +4 -3
package/dist/index.cjs
CHANGED
|
@@ -173,9 +173,13 @@ function prompt(parser, config) {
|
|
|
173
173
|
parse: (context) => {
|
|
174
174
|
const annotations = (0, __optique_core_annotations.getAnnotations)(context.state);
|
|
175
175
|
const innerState = isPromptBindState(context.state) ? context.state.hasCliValue ? context.state.cliState : parser.initialState : context.state;
|
|
176
|
-
const
|
|
176
|
+
const innerStateWithAnnotations = annotations != null && (innerState == null || typeof innerState === "object" && !(__optique_core_annotations.annotationKey in innerState)) ? {
|
|
177
|
+
...innerState != null && typeof innerState === "object" ? innerState : {},
|
|
178
|
+
[__optique_core_annotations.annotationKey]: annotations
|
|
179
|
+
} : innerState;
|
|
180
|
+
const innerContext = innerStateWithAnnotations !== context.state ? {
|
|
177
181
|
...context,
|
|
178
|
-
state:
|
|
182
|
+
state: innerStateWithAnnotations
|
|
179
183
|
} : context;
|
|
180
184
|
const processResult = (result$1) => {
|
|
181
185
|
if (result$1.success) {
|
|
@@ -226,9 +230,21 @@ function prompt(parser, config) {
|
|
|
226
230
|
promptCache = null;
|
|
227
231
|
return cached;
|
|
228
232
|
}
|
|
229
|
-
|
|
233
|
+
const innerState = parser.initialState;
|
|
234
|
+
const r = parser.complete(innerState);
|
|
235
|
+
const fallback = (res) => res.success ? Promise.resolve(res) : executePrompt();
|
|
236
|
+
promptCache = r instanceof Promise ? r.then(fallback) : fallback(r);
|
|
230
237
|
return promptCache;
|
|
231
238
|
}
|
|
239
|
+
const cliState = isPromptBindState(state) ? state.cliState : void 0;
|
|
240
|
+
const cliStateHasAnnotations = cliState != null && typeof cliState === "object" && __optique_core_annotations.annotationKey in cliState;
|
|
241
|
+
if (cliStateHasAnnotations) {
|
|
242
|
+
const innerState = cliState;
|
|
243
|
+
const r = parser.complete(innerState);
|
|
244
|
+
const fallback = (res) => res.success ? Promise.resolve(res) : executePrompt();
|
|
245
|
+
if (r instanceof Promise) return r.then(fallback);
|
|
246
|
+
return fallback(r);
|
|
247
|
+
}
|
|
232
248
|
return executePrompt();
|
|
233
249
|
},
|
|
234
250
|
suggest: (context, prefix) => {
|
package/dist/index.js
CHANGED
|
@@ -150,9 +150,13 @@ function prompt(parser, config) {
|
|
|
150
150
|
parse: (context) => {
|
|
151
151
|
const annotations = getAnnotations(context.state);
|
|
152
152
|
const innerState = isPromptBindState(context.state) ? context.state.hasCliValue ? context.state.cliState : parser.initialState : context.state;
|
|
153
|
-
const
|
|
153
|
+
const innerStateWithAnnotations = annotations != null && (innerState == null || typeof innerState === "object" && !(annotationKey in innerState)) ? {
|
|
154
|
+
...innerState != null && typeof innerState === "object" ? innerState : {},
|
|
155
|
+
[annotationKey]: annotations
|
|
156
|
+
} : innerState;
|
|
157
|
+
const innerContext = innerStateWithAnnotations !== context.state ? {
|
|
154
158
|
...context,
|
|
155
|
-
state:
|
|
159
|
+
state: innerStateWithAnnotations
|
|
156
160
|
} : context;
|
|
157
161
|
const processResult = (result$1) => {
|
|
158
162
|
if (result$1.success) {
|
|
@@ -203,9 +207,21 @@ function prompt(parser, config) {
|
|
|
203
207
|
promptCache = null;
|
|
204
208
|
return cached;
|
|
205
209
|
}
|
|
206
|
-
|
|
210
|
+
const innerState = parser.initialState;
|
|
211
|
+
const r = parser.complete(innerState);
|
|
212
|
+
const fallback = (res) => res.success ? Promise.resolve(res) : executePrompt();
|
|
213
|
+
promptCache = r instanceof Promise ? r.then(fallback) : fallback(r);
|
|
207
214
|
return promptCache;
|
|
208
215
|
}
|
|
216
|
+
const cliState = isPromptBindState(state) ? state.cliState : void 0;
|
|
217
|
+
const cliStateHasAnnotations = cliState != null && typeof cliState === "object" && annotationKey in cliState;
|
|
218
|
+
if (cliStateHasAnnotations) {
|
|
219
|
+
const innerState = cliState;
|
|
220
|
+
const r = parser.complete(innerState);
|
|
221
|
+
const fallback = (res) => res.success ? Promise.resolve(res) : executePrompt();
|
|
222
|
+
if (r instanceof Promise) return r.then(fallback);
|
|
223
|
+
return fallback(r);
|
|
224
|
+
}
|
|
209
225
|
return executePrompt();
|
|
210
226
|
},
|
|
211
227
|
suggest: (context, prefix) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/inquirer",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.461+42812276",
|
|
4
4
|
"description": "Interactive prompt support for Optique via Inquirer.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -56,12 +56,13 @@
|
|
|
56
56
|
"sideEffects": false,
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@inquirer/prompts": "^8.3.0",
|
|
59
|
-
"@optique/core": "1.0.0-dev.
|
|
59
|
+
"@optique/core": "1.0.0-dev.461+42812276"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/node": "^20.19.9",
|
|
63
63
|
"tsdown": "^0.13.0",
|
|
64
|
-
"typescript": "^5.8.3"
|
|
64
|
+
"typescript": "^5.8.3",
|
|
65
|
+
"@optique/env": "1.0.0-dev.461+42812276"
|
|
65
66
|
},
|
|
66
67
|
"scripts": {
|
|
67
68
|
"build": "tsdown",
|