@optique/config 0.10.1 → 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/run.cjs +13 -0
- package/dist/run.js +13 -0
- package/package.json +2 -2
package/dist/run.cjs
CHANGED
|
@@ -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
|
@@ -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
|
}
|
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",
|