@optique/prompt 1.2.8 → 1.2.10
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 +3 -1
- package/dist/index.js +4 -2
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -112,6 +112,7 @@ function createPromptAdapter(adapter) {
|
|
|
112
112
|
return adapter.execute(config);
|
|
113
113
|
}
|
|
114
114
|
const parserInheritsAnnotations = (0, __optique_core_extension.getTraits)(parser).inheritsAnnotations === true;
|
|
115
|
+
const getCliState = (state) => isPromptBindState(state) ? state.hasCliValue ? state.cliState : parser.initialState : state;
|
|
115
116
|
const promptedParser = {
|
|
116
117
|
mode: "async",
|
|
117
118
|
$valueType: parser.$valueType,
|
|
@@ -137,7 +138,7 @@ function createPromptAdapter(adapter) {
|
|
|
137
138
|
parse: (context) => {
|
|
138
139
|
const annotations = (0, __optique_core_annotations.getAnnotations)(context.state);
|
|
139
140
|
const hadCliValue = isPromptBindState(context.state) && context.state.hasCliValue;
|
|
140
|
-
const innerState =
|
|
141
|
+
const innerState = getCliState(context.state);
|
|
141
142
|
const baseInnerContext = innerState !== context.state ? {
|
|
142
143
|
...context,
|
|
143
144
|
state: innerState
|
|
@@ -305,6 +306,7 @@ function createPromptAdapter(adapter) {
|
|
|
305
306
|
configurable: true,
|
|
306
307
|
enumerable: false
|
|
307
308
|
});
|
|
309
|
+
(0, __optique_core_extension.delegateOptionParsing)(promptedParser, parser, getCliState);
|
|
308
310
|
return (0, __optique_core_fluent.fluent)(promptedParser);
|
|
309
311
|
};
|
|
310
312
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getAnnotations } from "@optique/core/annotations";
|
|
2
|
-
import { defineTraits, delegateSuggestNodes, getTraits, inheritAnnotations, injectAnnotations, mapSourceMetadata, unwrapInjectedAnnotationState, withAnnotationView } from "@optique/core/extension";
|
|
2
|
+
import { defineTraits, delegateOptionParsing, delegateSuggestNodes, getTraits, inheritAnnotations, injectAnnotations, mapSourceMetadata, unwrapInjectedAnnotationState, withAnnotationView } from "@optique/core/extension";
|
|
3
3
|
import { fluent } from "@optique/core/fluent";
|
|
4
4
|
|
|
5
5
|
//#region src/index.ts
|
|
@@ -89,6 +89,7 @@ function createPromptAdapter(adapter) {
|
|
|
89
89
|
return adapter.execute(config);
|
|
90
90
|
}
|
|
91
91
|
const parserInheritsAnnotations = getTraits(parser).inheritsAnnotations === true;
|
|
92
|
+
const getCliState = (state) => isPromptBindState(state) ? state.hasCliValue ? state.cliState : parser.initialState : state;
|
|
92
93
|
const promptedParser = {
|
|
93
94
|
mode: "async",
|
|
94
95
|
$valueType: parser.$valueType,
|
|
@@ -114,7 +115,7 @@ function createPromptAdapter(adapter) {
|
|
|
114
115
|
parse: (context) => {
|
|
115
116
|
const annotations = getAnnotations(context.state);
|
|
116
117
|
const hadCliValue = isPromptBindState(context.state) && context.state.hasCliValue;
|
|
117
|
-
const innerState =
|
|
118
|
+
const innerState = getCliState(context.state);
|
|
118
119
|
const baseInnerContext = innerState !== context.state ? {
|
|
119
120
|
...context,
|
|
120
121
|
state: innerState
|
|
@@ -282,6 +283,7 @@ function createPromptAdapter(adapter) {
|
|
|
282
283
|
configurable: true,
|
|
283
284
|
enumerable: false
|
|
284
285
|
});
|
|
286
|
+
delegateOptionParsing(promptedParser, parser, getCliState);
|
|
285
287
|
return fluent(promptedParser);
|
|
286
288
|
};
|
|
287
289
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/prompt",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.10",
|
|
4
4
|
"description": "Generic prompt adapter support for Optique",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -60,12 +60,12 @@
|
|
|
60
60
|
},
|
|
61
61
|
"sideEffects": false,
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@optique/core": "1.2.
|
|
63
|
+
"@optique/core": "1.2.10"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@optique/config": "1.2.
|
|
67
|
-
"@optique/env": "1.2.
|
|
68
|
-
"@optique/run": "1.2.
|
|
66
|
+
"@optique/config": "1.2.10",
|
|
67
|
+
"@optique/env": "1.2.10",
|
|
68
|
+
"@optique/run": "1.2.10",
|
|
69
69
|
"@types/node": "^24.0.0",
|
|
70
70
|
"fast-check": "^4.7.0",
|
|
71
71
|
"tsdown": "^0.13.0",
|