@optique/config 0.10.0 → 0.10.2-dev.388
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 +1 -1
- package/dist/index.js +1 -1
- package/dist/run.cjs +14 -1
- package/dist/run.js +14 -1
- package/dist/{src-D2CgNyXF.cjs → src-9MkUoh9z.cjs} +4 -1
- package/dist/{src-BM0vQxHd.js → src-Dm_17c1d.js} +4 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { bindConfig, clearActiveConfig, configKey, createConfigContext, getActiveConfig, setActiveConfig } from "./src-
|
|
1
|
+
import { bindConfig, clearActiveConfig, configKey, createConfigContext, getActiveConfig, setActiveConfig } from "./src-Dm_17c1d.js";
|
|
2
2
|
|
|
3
3
|
export { bindConfig, clearActiveConfig, configKey, createConfigContext, getActiveConfig, setActiveConfig };
|
package/dist/run.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_src = require('./src-
|
|
1
|
+
const require_src = require('./src-9MkUoh9z.cjs');
|
|
2
2
|
const node_fs_promises = require_src.__toESM(require("node:fs/promises"));
|
|
3
3
|
const node_path = require_src.__toESM(require("node:path"));
|
|
4
4
|
const node_process = require_src.__toESM(require("node:process"));
|
|
@@ -57,6 +57,7 @@ function createConfigSourceContext(context, options) {
|
|
|
57
57
|
configData = validationResult.value;
|
|
58
58
|
} catch (error) {
|
|
59
59
|
if (isErrnoException(error) && error.code === "ENOENT") configData = void 0;
|
|
60
|
+
else if (error instanceof SyntaxError) throw new Error(`Failed to parse config file ${configPath}: ${error.message}`);
|
|
60
61
|
else throw error;
|
|
61
62
|
}
|
|
62
63
|
}
|
|
@@ -167,6 +168,18 @@ async function runWithConfig(parser, context, options) {
|
|
|
167
168
|
footer: options.footer,
|
|
168
169
|
onError: options.onError
|
|
169
170
|
});
|
|
171
|
+
} catch (error) {
|
|
172
|
+
if (error instanceof Error && error.message.startsWith("Failed to parse config file ")) {
|
|
173
|
+
const stderr = options.stderr ?? console.error;
|
|
174
|
+
stderr(`Error: ${error.message}`);
|
|
175
|
+
if (options.onError) try {
|
|
176
|
+
options.onError(1);
|
|
177
|
+
} catch {
|
|
178
|
+
options.onError();
|
|
179
|
+
}
|
|
180
|
+
throw error;
|
|
181
|
+
}
|
|
182
|
+
throw error;
|
|
170
183
|
} finally {
|
|
171
184
|
require_src.clearActiveConfig(context.id);
|
|
172
185
|
}
|
package/dist/run.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { clearActiveConfig, configKey, setActiveConfig } from "./src-
|
|
1
|
+
import { clearActiveConfig, configKey, setActiveConfig } from "./src-Dm_17c1d.js";
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
3
|
import { basename } from "node:path";
|
|
4
4
|
import process from "node:process";
|
|
@@ -57,6 +57,7 @@ function createConfigSourceContext(context, options) {
|
|
|
57
57
|
configData = validationResult.value;
|
|
58
58
|
} catch (error) {
|
|
59
59
|
if (isErrnoException(error) && error.code === "ENOENT") configData = void 0;
|
|
60
|
+
else if (error instanceof SyntaxError) throw new Error(`Failed to parse config file ${configPath}: ${error.message}`);
|
|
60
61
|
else throw error;
|
|
61
62
|
}
|
|
62
63
|
}
|
|
@@ -167,6 +168,18 @@ async function runWithConfig(parser, context, options) {
|
|
|
167
168
|
footer: options.footer,
|
|
168
169
|
onError: options.onError
|
|
169
170
|
});
|
|
171
|
+
} catch (error) {
|
|
172
|
+
if (error instanceof Error && error.message.startsWith("Failed to parse config file ")) {
|
|
173
|
+
const stderr = options.stderr ?? console.error;
|
|
174
|
+
stderr(`Error: ${error.message}`);
|
|
175
|
+
if (options.onError) try {
|
|
176
|
+
options.onError(1);
|
|
177
|
+
} catch {
|
|
178
|
+
options.onError();
|
|
179
|
+
}
|
|
180
|
+
throw error;
|
|
181
|
+
}
|
|
182
|
+
throw error;
|
|
170
183
|
} finally {
|
|
171
184
|
clearActiveConfig(context.id);
|
|
172
185
|
}
|
|
@@ -130,7 +130,10 @@ function bindConfig(parser, options) {
|
|
|
130
130
|
$valueType: parser.$valueType,
|
|
131
131
|
$stateType: parser.$stateType,
|
|
132
132
|
priority: parser.priority,
|
|
133
|
-
usage:
|
|
133
|
+
usage: options.default !== void 0 ? [{
|
|
134
|
+
type: "optional",
|
|
135
|
+
terms: parser.usage
|
|
136
|
+
}] : parser.usage,
|
|
134
137
|
initialState: parser.initialState,
|
|
135
138
|
parse: (context) => {
|
|
136
139
|
const annotations = (0, __optique_core_annotations.getAnnotations)(context.state);
|
|
@@ -107,7 +107,10 @@ function bindConfig(parser, options) {
|
|
|
107
107
|
$valueType: parser.$valueType,
|
|
108
108
|
$stateType: parser.$stateType,
|
|
109
109
|
priority: parser.priority,
|
|
110
|
-
usage:
|
|
110
|
+
usage: options.default !== void 0 ? [{
|
|
111
|
+
type: "optional",
|
|
112
|
+
terms: parser.usage
|
|
113
|
+
}] : parser.usage,
|
|
111
114
|
initialState: parser.initialState,
|
|
112
115
|
parse: (context) => {
|
|
113
116
|
const annotations = getAnnotations(context.state);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/config",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2-dev.388+87a32614",
|
|
4
4
|
"description": "Configuration file support for Optique with Standard Schema validation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@standard-schema/spec": "^1.1.0"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@optique/core": "0.10.
|
|
70
|
+
"@optique/core": "0.10.2-dev.388+87a32614"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@standard-schema/spec": "^1.1.0",
|