@optique/config 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
@@ -295,6 +295,7 @@ function bindConfig(parser, options) {
295
295
  if (configValue != null && (typeof configValue === "object" || typeof configValue === "function") && "then" in configValue && typeof configValue.then === "function") throw new TypeError("The key callback must return a synchronous value, but got a thenable.");
296
296
  return configValue !== void 0;
297
297
  }
298
+ const getCliState = (state) => isConfigBindState(state) ? state.hasCliValue ? state.cliState : (0, __optique_core_extension.inheritAnnotations)(state, parser.initialState) : state;
298
299
  const boundParser = {
299
300
  mode: parser.mode,
300
301
  $valueType: parser.$valueType,
@@ -323,7 +324,7 @@ function bindConfig(parser, options) {
323
324
  parse: (context) => {
324
325
  const annotations = (0, __optique_core_annotations.getAnnotations)(context.state);
325
326
  const hadCliValue = isConfigBindState(context.state) && context.state.hasCliValue;
326
- const innerState = isConfigBindState(context.state) ? context.state.hasCliValue ? context.state.cliState : (0, __optique_core_extension.inheritAnnotations)(context.state, parser.initialState) : context.state;
327
+ const innerState = getCliState(context.state);
327
328
  const innerContext = innerState !== context.state ? {
328
329
  ...context,
329
330
  state: innerState
@@ -433,6 +434,7 @@ function bindConfig(parser, options) {
433
434
  configurable: true,
434
435
  enumerable: false
435
436
  });
437
+ (0, __optique_core_extension.delegateOptionParsing)(boundParser, parser, getCliState);
436
438
  return (0, __optique_core_fluent.fluent)(boundParser);
437
439
  }
438
440
  /**
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { readFileSync } from "node:fs";
2
2
  import { dirname, resolve } from "node:path";
3
3
  import { getAnnotations } from "@optique/core/annotations";
4
- import { defineTraits, delegateSuggestNodes, inheritAnnotations, injectAnnotations, mapModeValue, mapSourceMetadata, withAnnotationView, wrapForMode } from "@optique/core/extension";
4
+ import { defineTraits, delegateOptionParsing, delegateSuggestNodes, inheritAnnotations, injectAnnotations, mapModeValue, mapSourceMetadata, withAnnotationView, wrapForMode } from "@optique/core/extension";
5
5
  import { fluent } from "@optique/core/fluent";
6
6
  import { message } from "@optique/core/message";
7
7
 
@@ -272,6 +272,7 @@ function bindConfig(parser, options) {
272
272
  if (configValue != null && (typeof configValue === "object" || typeof configValue === "function") && "then" in configValue && typeof configValue.then === "function") throw new TypeError("The key callback must return a synchronous value, but got a thenable.");
273
273
  return configValue !== void 0;
274
274
  }
275
+ const getCliState = (state) => isConfigBindState(state) ? state.hasCliValue ? state.cliState : inheritAnnotations(state, parser.initialState) : state;
275
276
  const boundParser = {
276
277
  mode: parser.mode,
277
278
  $valueType: parser.$valueType,
@@ -300,7 +301,7 @@ function bindConfig(parser, options) {
300
301
  parse: (context) => {
301
302
  const annotations = getAnnotations(context.state);
302
303
  const hadCliValue = isConfigBindState(context.state) && context.state.hasCliValue;
303
- const innerState = isConfigBindState(context.state) ? context.state.hasCliValue ? context.state.cliState : inheritAnnotations(context.state, parser.initialState) : context.state;
304
+ const innerState = getCliState(context.state);
304
305
  const innerContext = innerState !== context.state ? {
305
306
  ...context,
306
307
  state: innerState
@@ -410,6 +411,7 @@ function bindConfig(parser, options) {
410
411
  configurable: true,
411
412
  enumerable: false
412
413
  });
414
+ delegateOptionParsing(boundParser, parser, getCliState);
413
415
  return fluent(boundParser);
414
416
  }
415
417
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/config",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "Configuration file support for Optique with Standard Schema validation",
5
5
  "keywords": [
6
6
  "CLI",
@@ -65,10 +65,10 @@
65
65
  "@standard-schema/spec": "^1.1.0"
66
66
  },
67
67
  "dependencies": {
68
- "@optique/core": "1.3.1"
68
+ "@optique/core": "1.3.2"
69
69
  },
70
70
  "devDependencies": {
71
- "@optique/env": "1.3.1",
71
+ "@optique/env": "1.3.2",
72
72
  "@standard-schema/spec": "^1.1.0",
73
73
  "@types/node": "^24.0.0",
74
74
  "fast-check": "^4.7.0",