@optique/prompt 1.3.1 → 1.3.2

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
@@ -315,6 +315,7 @@ function createPromptAdapter(adapter) {
315
315
  }
316
316
  }
317
317
  const parserInheritsAnnotations = (0, __optique_core_extension.getTraits)(parser).inheritsAnnotations === true;
318
+ const getCliState = (state) => isPromptBindState(state) ? state.hasCliValue ? state.cliState : parser.initialState : state;
318
319
  const promptedParser = {
319
320
  mode: "async",
320
321
  $valueType: parser.$valueType,
@@ -340,7 +341,7 @@ function createPromptAdapter(adapter) {
340
341
  parse: (context) => {
341
342
  const annotations = (0, __optique_core_annotations.getAnnotations)(context.state);
342
343
  const hadCliValue = isPromptBindState(context.state) && context.state.hasCliValue;
343
- const innerState = isPromptBindState(context.state) ? context.state.hasCliValue ? context.state.cliState : parser.initialState : context.state;
344
+ const innerState = getCliState(context.state);
344
345
  const baseInnerContext = innerState !== context.state ? {
345
346
  ...context,
346
347
  state: innerState
@@ -532,6 +533,7 @@ function createPromptAdapter(adapter) {
532
533
  configurable: true,
533
534
  enumerable: false
534
535
  });
536
+ (0, __optique_core_extension.delegateOptionParsing)(promptedParser, parser, getCliState);
535
537
  return (0, __optique_core_fluent.fluent)(promptedParser);
536
538
  };
537
539
  }
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, injectAnnotations, mapSourceMetadata, unwrapInjectedAnnotationState, withAnnotationView } from "@optique/core/extension";
4
+ import { defineTraits, delegateOptionParsing, delegateSuggestNodes, getTraits, inheritAnnotations, injectAnnotations, mapSourceMetadata, unwrapInjectedAnnotationState, withAnnotationView } from "@optique/core/extension";
5
5
  import { fluent } from "@optique/core/fluent";
6
6
 
7
7
  //#region src/index.ts
@@ -292,6 +292,7 @@ function createPromptAdapter(adapter) {
292
292
  }
293
293
  }
294
294
  const parserInheritsAnnotations = getTraits(parser).inheritsAnnotations === true;
295
+ const getCliState = (state) => isPromptBindState(state) ? state.hasCliValue ? state.cliState : parser.initialState : state;
295
296
  const promptedParser = {
296
297
  mode: "async",
297
298
  $valueType: parser.$valueType,
@@ -317,7 +318,7 @@ function createPromptAdapter(adapter) {
317
318
  parse: (context) => {
318
319
  const annotations = getAnnotations(context.state);
319
320
  const hadCliValue = isPromptBindState(context.state) && context.state.hasCliValue;
320
- const innerState = isPromptBindState(context.state) ? context.state.hasCliValue ? context.state.cliState : parser.initialState : context.state;
321
+ const innerState = getCliState(context.state);
321
322
  const baseInnerContext = innerState !== context.state ? {
322
323
  ...context,
323
324
  state: innerState
@@ -509,6 +510,7 @@ function createPromptAdapter(adapter) {
509
510
  configurable: true,
510
511
  enumerable: false
511
512
  });
513
+ delegateOptionParsing(promptedParser, parser, getCliState);
512
514
  return fluent(promptedParser);
513
515
  };
514
516
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/prompt",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
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.3.1"
63
+ "@optique/core": "1.3.2"
64
64
  },
65
65
  "devDependencies": {
66
- "@optique/config": "1.3.1",
67
- "@optique/env": "1.3.1",
68
- "@optique/run": "1.3.1",
66
+ "@optique/config": "1.3.2",
67
+ "@optique/env": "1.3.2",
68
+ "@optique/run": "1.3.2",
69
69
  "@types/node": "^24.0.0",
70
70
  "fast-check": "^4.7.0",
71
71
  "tsdown": "^0.13.0",