@optique/config 1.0.0-dev.555 → 1.0.0-dev.557
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 -11
- package/dist/index.js +1 -9
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -25,6 +25,7 @@ const node_fs_promises = __toESM(require("node:fs/promises"));
|
|
|
25
25
|
const node_path = __toESM(require("node:path"));
|
|
26
26
|
const __optique_core_annotations = __toESM(require("@optique/core/annotations"));
|
|
27
27
|
const __optique_core_message = __toESM(require("@optique/core/message"));
|
|
28
|
+
const __optique_core_mode_dispatch = __toESM(require("@optique/core/mode-dispatch"));
|
|
28
29
|
|
|
29
30
|
//#region src/index.ts
|
|
30
31
|
/**
|
|
@@ -271,11 +272,11 @@ function bindConfig(parser, options) {
|
|
|
271
272
|
consumed: []
|
|
272
273
|
};
|
|
273
274
|
};
|
|
274
|
-
return mapModeValue(parser.$mode, parser.parse(innerContext), processResult);
|
|
275
|
+
return (0, __optique_core_mode_dispatch.mapModeValue)(parser.$mode, parser.parse(innerContext), processResult);
|
|
275
276
|
},
|
|
276
277
|
complete: (state) => {
|
|
277
278
|
if (isConfigBindState(state) && state.hasCliValue) return parser.complete(state.cliState);
|
|
278
|
-
return wrapForMode(parser.$mode, getConfigOrDefault(state, options));
|
|
279
|
+
return (0, __optique_core_mode_dispatch.wrapForMode)(parser.$mode, getConfigOrDefault(state, options));
|
|
279
280
|
},
|
|
280
281
|
suggest: parser.suggest,
|
|
281
282
|
getDocFragments(state, upperDefaultValue) {
|
|
@@ -284,15 +285,6 @@ function bindConfig(parser, options) {
|
|
|
284
285
|
}
|
|
285
286
|
};
|
|
286
287
|
}
|
|
287
|
-
function wrapForMode(mode, value) {
|
|
288
|
-
if (mode === "async") return Promise.resolve(value);
|
|
289
|
-
return value;
|
|
290
|
-
}
|
|
291
|
-
function mapModeValue(mode, value, mapFn) {
|
|
292
|
-
if (mode === "async") return Promise.resolve(value).then(mapFn);
|
|
293
|
-
if (value instanceof Promise) throw new TypeError("Synchronous mode cannot map Promise value.");
|
|
294
|
-
return mapFn(value);
|
|
295
|
-
}
|
|
296
288
|
/**
|
|
297
289
|
* Helper function to get value from config or default.
|
|
298
290
|
* Checks both annotations (for top-level parsers) and the active config
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { readFile } from "node:fs/promises";
|
|
|
2
2
|
import { dirname, resolve } from "node:path";
|
|
3
3
|
import { annotationKey, getAnnotations } from "@optique/core/annotations";
|
|
4
4
|
import { message } from "@optique/core/message";
|
|
5
|
+
import { mapModeValue, wrapForMode } from "@optique/core/mode-dispatch";
|
|
5
6
|
|
|
6
7
|
//#region src/index.ts
|
|
7
8
|
/**
|
|
@@ -261,15 +262,6 @@ function bindConfig(parser, options) {
|
|
|
261
262
|
}
|
|
262
263
|
};
|
|
263
264
|
}
|
|
264
|
-
function wrapForMode(mode, value) {
|
|
265
|
-
if (mode === "async") return Promise.resolve(value);
|
|
266
|
-
return value;
|
|
267
|
-
}
|
|
268
|
-
function mapModeValue(mode, value, mapFn) {
|
|
269
|
-
if (mode === "async") return Promise.resolve(value).then(mapFn);
|
|
270
|
-
if (value instanceof Promise) throw new TypeError("Synchronous mode cannot map Promise value.");
|
|
271
|
-
return mapFn(value);
|
|
272
|
-
}
|
|
273
265
|
/**
|
|
274
266
|
* Helper function to get value from config or default.
|
|
275
267
|
* Checks both annotations (for top-level parsers) and the active config
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/config",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.557+7de4cc60",
|
|
4
4
|
"description": "Configuration file support for Optique with Standard Schema validation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@standard-schema/spec": "^1.1.0"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@optique/core": "1.0.0-dev.
|
|
62
|
+
"@optique/core": "1.0.0-dev.557+7de4cc60"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@standard-schema/spec": "^1.1.0",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"tsdown": "^0.13.0",
|
|
68
68
|
"typescript": "^5.8.3",
|
|
69
69
|
"zod": "^3.25.0 || ^4.0.0",
|
|
70
|
-
"@optique/env": "1.0.0-dev.
|
|
70
|
+
"@optique/env": "1.0.0-dev.557+7de4cc60"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
73
|
"build": "tsdown",
|