@optique/inquirer 1.0.0-dev.788 → 1.0.0-dev.885
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 +44 -11
- package/dist/index.js +44 -11
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -348,19 +348,52 @@ function prompt(parser, config) {
|
|
|
348
348
|
promptCache = null;
|
|
349
349
|
return cached;
|
|
350
350
|
}
|
|
351
|
-
const innerInitialState = parser.initialState;
|
|
352
|
-
const annotations = (0, __optique_core_annotations.getAnnotations)(state);
|
|
353
351
|
const hasDeferHook = typeof Reflect.get(parser, deferPromptUntilConfigResolvesKey) === "function";
|
|
354
|
-
const
|
|
355
|
-
const
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
352
|
+
const annotations = (0, __optique_core_annotations.getAnnotations)(state);
|
|
353
|
+
const innerInitialState = parser.initialState;
|
|
354
|
+
const effectiveInitialState = annotations != null && innerInitialState == null ? (0, __optique_core_annotations.injectAnnotations)(innerInitialState, annotations) : innerInitialState;
|
|
355
|
+
if (hasDeferHook) {
|
|
356
|
+
const annotatedR = withAnnotatedInnerState(state, effectiveInitialState, (annotatedInnerState) => parser.complete(annotatedInnerState));
|
|
357
|
+
const usePromptOrDeferSentinel = (res) => {
|
|
358
|
+
if (res.success && res.value === void 0) return usePromptOrDefer(state, {
|
|
359
|
+
success: false,
|
|
360
|
+
error: []
|
|
361
|
+
});
|
|
362
|
+
return usePromptOrDefer(state, res);
|
|
363
|
+
};
|
|
364
|
+
const cachedResult$1 = annotatedR instanceof Promise ? annotatedR.then(usePromptOrDeferSentinel) : usePromptOrDeferSentinel(annotatedR);
|
|
365
|
+
promptCache = {
|
|
366
|
+
state,
|
|
367
|
+
result: cachedResult$1
|
|
368
|
+
};
|
|
369
|
+
return cachedResult$1;
|
|
370
|
+
}
|
|
371
|
+
const simParseR = withAnnotatedInnerState(state, effectiveInitialState, (annotatedState) => parser.parse({
|
|
372
|
+
buffer: [],
|
|
373
|
+
state: annotatedState,
|
|
374
|
+
optionsTerminated: false,
|
|
375
|
+
usage: parser.usage
|
|
376
|
+
}));
|
|
377
|
+
const decideFromParse = (parseResult) => {
|
|
378
|
+
const consumed = parseResult.success ? parseResult.consumed.length : 0;
|
|
379
|
+
const cliState$1 = parseResult.success && consumed === 0 ? parseResult.next.state : void 0;
|
|
380
|
+
const hasSourceBindingMarker = (s) => s != null && typeof s === "object" && "hasCliValue" in s && Object.getOwnPropertySymbols(s).length > 0;
|
|
381
|
+
const cliStateIsPassthrough = cliState$1 != null && typeof cliState$1 === "object" && (0, __optique_core_annotations.unwrapInjectedAnnotationWrapper)(cliState$1) !== cliState$1;
|
|
382
|
+
const isSourceBinding = shouldAttemptInnerCompletion(cliState$1, state) && !cliStateIsPassthrough || hasSourceBindingMarker(cliState$1) || Array.isArray(cliState$1) && cliState$1.length === 1 && (hasSourceBindingMarker(cliState$1[0]) || typeof cliState$1[0] === "object" && cliState$1[0] != null && __optique_core_annotations.annotationKey in cliState$1[0]);
|
|
383
|
+
if (isSourceBinding) {
|
|
384
|
+
const cliStateIsInjected = cliState$1 != null && typeof cliState$1 === "object" && (0, __optique_core_annotations.unwrapInjectedAnnotationWrapper)(cliState$1) !== cliState$1;
|
|
385
|
+
const handleCompleteResult = (res) => {
|
|
386
|
+
if (res.success && res.value === void 0 && cliStateIsInjected) return executePrompt();
|
|
387
|
+
return usePromptOrDefer(state, res);
|
|
388
|
+
};
|
|
389
|
+
const completeState = parseResult.success ? parseResult.next.state : effectiveInitialState;
|
|
390
|
+
const completeR = parser.complete(completeState);
|
|
391
|
+
if (completeR instanceof Promise) return completeR.then(handleCompleteResult);
|
|
392
|
+
return handleCompleteResult(completeR);
|
|
393
|
+
}
|
|
394
|
+
return executePrompt();
|
|
362
395
|
};
|
|
363
|
-
const cachedResult =
|
|
396
|
+
const cachedResult = simParseR instanceof Promise ? simParseR.then(decideFromParse) : decideFromParse(simParseR);
|
|
364
397
|
promptCache = {
|
|
365
398
|
state,
|
|
366
399
|
result: cachedResult
|
package/dist/index.js
CHANGED
|
@@ -325,19 +325,52 @@ function prompt(parser, config) {
|
|
|
325
325
|
promptCache = null;
|
|
326
326
|
return cached;
|
|
327
327
|
}
|
|
328
|
-
const innerInitialState = parser.initialState;
|
|
329
|
-
const annotations = getAnnotations(state);
|
|
330
328
|
const hasDeferHook = typeof Reflect.get(parser, deferPromptUntilConfigResolvesKey) === "function";
|
|
331
|
-
const
|
|
332
|
-
const
|
|
333
|
-
const
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
329
|
+
const annotations = getAnnotations(state);
|
|
330
|
+
const innerInitialState = parser.initialState;
|
|
331
|
+
const effectiveInitialState = annotations != null && innerInitialState == null ? injectAnnotations(innerInitialState, annotations) : innerInitialState;
|
|
332
|
+
if (hasDeferHook) {
|
|
333
|
+
const annotatedR = withAnnotatedInnerState(state, effectiveInitialState, (annotatedInnerState) => parser.complete(annotatedInnerState));
|
|
334
|
+
const usePromptOrDeferSentinel = (res) => {
|
|
335
|
+
if (res.success && res.value === void 0) return usePromptOrDefer(state, {
|
|
336
|
+
success: false,
|
|
337
|
+
error: []
|
|
338
|
+
});
|
|
339
|
+
return usePromptOrDefer(state, res);
|
|
340
|
+
};
|
|
341
|
+
const cachedResult$1 = annotatedR instanceof Promise ? annotatedR.then(usePromptOrDeferSentinel) : usePromptOrDeferSentinel(annotatedR);
|
|
342
|
+
promptCache = {
|
|
343
|
+
state,
|
|
344
|
+
result: cachedResult$1
|
|
345
|
+
};
|
|
346
|
+
return cachedResult$1;
|
|
347
|
+
}
|
|
348
|
+
const simParseR = withAnnotatedInnerState(state, effectiveInitialState, (annotatedState) => parser.parse({
|
|
349
|
+
buffer: [],
|
|
350
|
+
state: annotatedState,
|
|
351
|
+
optionsTerminated: false,
|
|
352
|
+
usage: parser.usage
|
|
353
|
+
}));
|
|
354
|
+
const decideFromParse = (parseResult) => {
|
|
355
|
+
const consumed = parseResult.success ? parseResult.consumed.length : 0;
|
|
356
|
+
const cliState$1 = parseResult.success && consumed === 0 ? parseResult.next.state : void 0;
|
|
357
|
+
const hasSourceBindingMarker = (s) => s != null && typeof s === "object" && "hasCliValue" in s && Object.getOwnPropertySymbols(s).length > 0;
|
|
358
|
+
const cliStateIsPassthrough = cliState$1 != null && typeof cliState$1 === "object" && unwrapInjectedAnnotationWrapper(cliState$1) !== cliState$1;
|
|
359
|
+
const isSourceBinding = shouldAttemptInnerCompletion(cliState$1, state) && !cliStateIsPassthrough || hasSourceBindingMarker(cliState$1) || Array.isArray(cliState$1) && cliState$1.length === 1 && (hasSourceBindingMarker(cliState$1[0]) || typeof cliState$1[0] === "object" && cliState$1[0] != null && annotationKey in cliState$1[0]);
|
|
360
|
+
if (isSourceBinding) {
|
|
361
|
+
const cliStateIsInjected = cliState$1 != null && typeof cliState$1 === "object" && unwrapInjectedAnnotationWrapper(cliState$1) !== cliState$1;
|
|
362
|
+
const handleCompleteResult = (res) => {
|
|
363
|
+
if (res.success && res.value === void 0 && cliStateIsInjected) return executePrompt();
|
|
364
|
+
return usePromptOrDefer(state, res);
|
|
365
|
+
};
|
|
366
|
+
const completeState = parseResult.success ? parseResult.next.state : effectiveInitialState;
|
|
367
|
+
const completeR = parser.complete(completeState);
|
|
368
|
+
if (completeR instanceof Promise) return completeR.then(handleCompleteResult);
|
|
369
|
+
return handleCompleteResult(completeR);
|
|
370
|
+
}
|
|
371
|
+
return executePrompt();
|
|
339
372
|
};
|
|
340
|
-
const cachedResult =
|
|
373
|
+
const cachedResult = simParseR instanceof Promise ? simParseR.then(decideFromParse) : decideFromParse(simParseR);
|
|
341
374
|
promptCache = {
|
|
342
375
|
state,
|
|
343
376
|
result: cachedResult
|
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.885+3300ebe1",
|
|
4
4
|
"description": "Interactive prompt support for Optique via Inquirer.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -56,13 +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.885+3300ebe1"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/node": "^20.19.9",
|
|
63
63
|
"tsdown": "^0.13.0",
|
|
64
64
|
"typescript": "^5.8.3",
|
|
65
|
-
"@optique/env": "1.0.0-dev.
|
|
65
|
+
"@optique/env": "1.0.0-dev.885+3300ebe1"
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
68
|
"build": "tsdown",
|