@optique/prompt 1.4.0-dev.2638 → 1.4.0-dev.2661

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
@@ -335,6 +335,7 @@ function createPromptAdapter(adapter) {
335
335
  }
336
336
  }
337
337
  const parserInheritsAnnotations = (0, __optique_core_extension.getTraits)(parser).inheritsAnnotations === true;
338
+ const getCliState = (state) => isPromptBindState(state) ? state.hasCliValue ? state.cliState : parser.initialState : state;
338
339
  const promptedParser = {
339
340
  mode: "async",
340
341
  $valueType: parser.$valueType,
@@ -360,7 +361,7 @@ function createPromptAdapter(adapter) {
360
361
  parse: (context) => {
361
362
  const annotations = (0, __optique_core_annotations.getAnnotations)(context.state);
362
363
  const hadCliValue = isPromptBindState(context.state) && context.state.hasCliValue;
363
- const innerState = isPromptBindState(context.state) ? context.state.hasCliValue ? context.state.cliState : parser.initialState : context.state;
364
+ const innerState = getCliState(context.state);
364
365
  const baseInnerContext = innerState !== context.state ? {
365
366
  ...context,
366
367
  state: innerState
@@ -553,6 +554,7 @@ function createPromptAdapter(adapter) {
553
554
  configurable: true,
554
555
  enumerable: false
555
556
  });
557
+ (0, __optique_core_extension.delegateOptionParsing)(promptedParser, parser, getCliState);
556
558
  return (0, __optique_core_fluent.fluent)(promptedParser);
557
559
  };
558
560
  }
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { getAnnotations } from "@optique/core/annotations";
2
2
  import { getDependencySourceInfo } from "@optique/core/dependency";
3
3
  import { message, values } from "@optique/core/message";
4
- import { defineTraits, delegateSuggestNodes, getTraits, inheritAnnotations, inheritOptionScope, injectAnnotations, mapSourceMetadata, unwrapInjectedAnnotationState, withAnnotationView } from "@optique/core/extension";
4
+ import { defineTraits, delegateOptionParsing, delegateSuggestNodes, getTraits, inheritAnnotations, inheritOptionScope, injectAnnotations, mapSourceMetadata, unwrapInjectedAnnotationState, withAnnotationView } from "@optique/core/extension";
5
5
  import { fluent } from "@optique/core/fluent";
6
6
 
7
7
  //#region src/index.ts
@@ -312,6 +312,7 @@ function createPromptAdapter(adapter) {
312
312
  }
313
313
  }
314
314
  const parserInheritsAnnotations = getTraits(parser).inheritsAnnotations === true;
315
+ const getCliState = (state) => isPromptBindState(state) ? state.hasCliValue ? state.cliState : parser.initialState : state;
315
316
  const promptedParser = {
316
317
  mode: "async",
317
318
  $valueType: parser.$valueType,
@@ -337,7 +338,7 @@ function createPromptAdapter(adapter) {
337
338
  parse: (context) => {
338
339
  const annotations = getAnnotations(context.state);
339
340
  const hadCliValue = isPromptBindState(context.state) && context.state.hasCliValue;
340
- const innerState = isPromptBindState(context.state) ? context.state.hasCliValue ? context.state.cliState : parser.initialState : context.state;
341
+ const innerState = getCliState(context.state);
341
342
  const baseInnerContext = innerState !== context.state ? {
342
343
  ...context,
343
344
  state: innerState
@@ -530,6 +531,7 @@ function createPromptAdapter(adapter) {
530
531
  configurable: true,
531
532
  enumerable: false
532
533
  });
534
+ delegateOptionParsing(promptedParser, parser, getCliState);
533
535
  return fluent(promptedParser);
534
536
  };
535
537
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/prompt",
3
- "version": "1.4.0-dev.2638",
3
+ "version": "1.4.0-dev.2661",
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.4.0-dev.2638+75cb8142"
63
+ "@optique/core": "1.4.0-dev.2661+04e7de36"
64
64
  },
65
65
  "devDependencies": {
66
- "@optique/config": "1.4.0-dev.2638+75cb8142",
67
- "@optique/env": "1.4.0-dev.2638+75cb8142",
68
- "@optique/run": "1.4.0-dev.2638+75cb8142",
66
+ "@optique/config": "1.4.0-dev.2661+04e7de36",
67
+ "@optique/env": "1.4.0-dev.2661+04e7de36",
68
+ "@optique/run": "1.4.0-dev.2661+04e7de36",
69
69
  "@types/node": "^24.0.0",
70
70
  "fast-check": "^4.7.0",
71
71
  "tsdown": "^0.13.0",