@optique/inquirer 1.0.7 → 1.0.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/dist/index.cjs CHANGED
@@ -311,6 +311,7 @@ function prompt(parser, config) {
311
311
  },
312
312
  parse: (context) => {
313
313
  const annotations = (0, __optique_core_annotations.getAnnotations)(context.state);
314
+ const hadCliValue = isPromptBindState(context.state) && context.state.hasCliValue;
314
315
  const innerState = isPromptBindState(context.state) ? context.state.hasCliValue ? context.state.cliState : parser.initialState : context.state;
315
316
  const baseInnerContext = innerState !== context.state ? {
316
317
  ...context,
@@ -320,7 +321,8 @@ function prompt(parser, config) {
320
321
  const processResult = (result$1) => {
321
322
  if (result$1.success) {
322
323
  const cliState = annotations != null && result$1.next.state != null && typeof result$1.next.state === "object" && (0, __optique_core_annotations.getAnnotations)(result$1.next.state) !== annotations ? (0, __optique_core_extension.injectAnnotations)(result$1.next.state, annotations) : result$1.next.state;
323
- const cliConsumed = result$1.consumed.length > 0;
324
+ const terminatorOnly = result$1.consumed.length === 1 && result$1.consumed[0] === "--" && !context.optionsTerminated && result$1.next.optionsTerminated;
325
+ const cliConsumed = hadCliValue || result$1.consumed.length > 0 && !terminatorOnly;
324
326
  const nextState$1 = (0, __optique_core_extension.injectAnnotations)({
325
327
  [promptBindStateKey]: true,
326
328
  hasCliValue: cliConsumed,
@@ -337,6 +339,11 @@ function prompt(parser, config) {
337
339
  };
338
340
  }
339
341
  if (result$1.consumed > 0) return result$1;
342
+ if (hadCliValue) return {
343
+ success: true,
344
+ next: context,
345
+ consumed: []
346
+ };
340
347
  const nextState = (0, __optique_core_extension.injectAnnotations)({
341
348
  [promptBindStateKey]: true,
342
349
  hasCliValue: false
package/dist/index.js CHANGED
@@ -288,6 +288,7 @@ function prompt(parser, config) {
288
288
  },
289
289
  parse: (context) => {
290
290
  const annotations = getAnnotations(context.state);
291
+ const hadCliValue = isPromptBindState(context.state) && context.state.hasCliValue;
291
292
  const innerState = isPromptBindState(context.state) ? context.state.hasCliValue ? context.state.cliState : parser.initialState : context.state;
292
293
  const baseInnerContext = innerState !== context.state ? {
293
294
  ...context,
@@ -297,7 +298,8 @@ function prompt(parser, config) {
297
298
  const processResult = (result$1) => {
298
299
  if (result$1.success) {
299
300
  const cliState = annotations != null && result$1.next.state != null && typeof result$1.next.state === "object" && getAnnotations(result$1.next.state) !== annotations ? injectAnnotations(result$1.next.state, annotations) : result$1.next.state;
300
- const cliConsumed = result$1.consumed.length > 0;
301
+ const terminatorOnly = result$1.consumed.length === 1 && result$1.consumed[0] === "--" && !context.optionsTerminated && result$1.next.optionsTerminated;
302
+ const cliConsumed = hadCliValue || result$1.consumed.length > 0 && !terminatorOnly;
301
303
  const nextState$1 = injectAnnotations({
302
304
  [promptBindStateKey]: true,
303
305
  hasCliValue: cliConsumed,
@@ -314,6 +316,11 @@ function prompt(parser, config) {
314
316
  };
315
317
  }
316
318
  if (result$1.consumed > 0) return result$1;
319
+ if (hadCliValue) return {
320
+ success: true,
321
+ next: context,
322
+ consumed: []
323
+ };
317
324
  const nextState = injectAnnotations({
318
325
  [promptBindStateKey]: true,
319
326
  hasCliValue: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/inquirer",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
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.7"
59
+ "@optique/core": "1.0.9"
60
60
  },
61
61
  "devDependencies": {
62
- "@optique/env": "1.0.7",
63
62
  "@types/node": "^20.19.9",
64
63
  "tsdown": "^0.13.0",
65
- "typescript": "^5.8.3"
64
+ "typescript": "^5.8.3",
65
+ "@optique/env": "1.0.9"
66
66
  },
67
67
  "scripts": {
68
68
  "build": "tsdown",