@optique/config 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 +3 -1
- package/dist/index.js +4 -2
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -310,6 +310,7 @@ function bindConfig(parser, options) {
|
|
|
310
310
|
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.");
|
|
311
311
|
return configValue !== void 0;
|
|
312
312
|
}
|
|
313
|
+
const getCliState = (state) => isConfigBindState(state) ? state.hasCliValue ? state.cliState : (0, __optique_core_extension.inheritAnnotations)(state, parser.initialState) : state;
|
|
313
314
|
const boundParser = {
|
|
314
315
|
mode: parser.mode,
|
|
315
316
|
$valueType: parser.$valueType,
|
|
@@ -338,7 +339,7 @@ function bindConfig(parser, options) {
|
|
|
338
339
|
parse: (context) => {
|
|
339
340
|
const annotations = (0, __optique_core_annotations.getAnnotations)(context.state);
|
|
340
341
|
const hadCliValue = isConfigBindState(context.state) && context.state.hasCliValue;
|
|
341
|
-
const innerState =
|
|
342
|
+
const innerState = getCliState(context.state);
|
|
342
343
|
const innerContext = innerState !== context.state ? {
|
|
343
344
|
...context,
|
|
344
345
|
state: innerState
|
|
@@ -449,6 +450,7 @@ function bindConfig(parser, options) {
|
|
|
449
450
|
configurable: true,
|
|
450
451
|
enumerable: false
|
|
451
452
|
});
|
|
453
|
+
(0, __optique_core_extension.delegateOptionParsing)(boundParser, parser, getCliState);
|
|
452
454
|
return (0, __optique_core_fluent.fluent)(boundParser);
|
|
453
455
|
}
|
|
454
456
|
/**
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { readFileSync } from "node:fs";
|
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { dirname, join, resolve, sep } from "node:path";
|
|
4
4
|
import { getAnnotations } from "@optique/core/annotations";
|
|
5
|
-
import { defineTraits, delegateSuggestNodes, inheritAnnotations, inheritOptionScope, injectAnnotations, mapModeValue, mapSourceMetadata, withAnnotationView, wrapForMode } from "@optique/core/extension";
|
|
5
|
+
import { defineTraits, delegateOptionParsing, delegateSuggestNodes, inheritAnnotations, inheritOptionScope, injectAnnotations, mapModeValue, mapSourceMetadata, withAnnotationView, wrapForMode } from "@optique/core/extension";
|
|
6
6
|
import { fluent } from "@optique/core/fluent";
|
|
7
7
|
import { message } from "@optique/core/message";
|
|
8
8
|
|
|
@@ -287,6 +287,7 @@ function bindConfig(parser, options) {
|
|
|
287
287
|
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.");
|
|
288
288
|
return configValue !== void 0;
|
|
289
289
|
}
|
|
290
|
+
const getCliState = (state) => isConfigBindState(state) ? state.hasCliValue ? state.cliState : inheritAnnotations(state, parser.initialState) : state;
|
|
290
291
|
const boundParser = {
|
|
291
292
|
mode: parser.mode,
|
|
292
293
|
$valueType: parser.$valueType,
|
|
@@ -315,7 +316,7 @@ function bindConfig(parser, options) {
|
|
|
315
316
|
parse: (context) => {
|
|
316
317
|
const annotations = getAnnotations(context.state);
|
|
317
318
|
const hadCliValue = isConfigBindState(context.state) && context.state.hasCliValue;
|
|
318
|
-
const innerState =
|
|
319
|
+
const innerState = getCliState(context.state);
|
|
319
320
|
const innerContext = innerState !== context.state ? {
|
|
320
321
|
...context,
|
|
321
322
|
state: innerState
|
|
@@ -426,6 +427,7 @@ function bindConfig(parser, options) {
|
|
|
426
427
|
configurable: true,
|
|
427
428
|
enumerable: false
|
|
428
429
|
});
|
|
430
|
+
delegateOptionParsing(boundParser, parser, getCliState);
|
|
429
431
|
return fluent(boundParser);
|
|
430
432
|
}
|
|
431
433
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/config",
|
|
3
|
-
"version": "1.4.0-dev.
|
|
3
|
+
"version": "1.4.0-dev.2661",
|
|
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.4.0-dev.
|
|
68
|
+
"@optique/core": "1.4.0-dev.2661+04e7de36"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@optique/env": "1.4.0-dev.
|
|
71
|
+
"@optique/env": "1.4.0-dev.2661+04e7de36",
|
|
72
72
|
"@standard-schema/spec": "^1.1.0",
|
|
73
73
|
"@types/node": "^24.0.0",
|
|
74
74
|
"fast-check": "^4.7.0",
|