@optique/run 1.0.0-dev.1227 → 1.0.0-dev.1236
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 +2 -0
- package/dist/run.d.cts +2 -0
- package/dist/run.d.ts +2 -0
- package/dist/run.js +2 -0
- package/package.json +2 -2
package/dist/run.cjs
CHANGED
|
@@ -32,6 +32,8 @@ function run(parserOrProgram, options = {}) {
|
|
|
32
32
|
return runImpl(parserOrProgram, options);
|
|
33
33
|
}
|
|
34
34
|
function runSync(parserOrProgram, options = {}) {
|
|
35
|
+
const parserToCheck = "parser" in parserOrProgram && "metadata" in parserOrProgram ? parserOrProgram.parser : parserOrProgram;
|
|
36
|
+
if (parserToCheck.$mode !== "sync") throw new TypeError("Cannot use an async parser with runSync(). Use run() or runAsync() instead.");
|
|
35
37
|
const contexts = options.contexts;
|
|
36
38
|
if (contexts && contexts.length > 0) {
|
|
37
39
|
const resolved = resolveProgramInput(parserOrProgram, options);
|
package/dist/run.d.cts
CHANGED
|
@@ -369,6 +369,8 @@ declare function run<T extends Parser<Mode, unknown, unknown>>(parser: T, option
|
|
|
369
369
|
* @param parser The synchronous command-line parser to execute.
|
|
370
370
|
* @param options Configuration options for customizing behavior.
|
|
371
371
|
* @returns The parsed result if successful.
|
|
372
|
+
* @throws {TypeError} If an async parser (or a {@link Program} wrapping one)
|
|
373
|
+
* is passed at runtime. Use {@link run} or {@link runAsync} instead.
|
|
372
374
|
* @since 0.9.0
|
|
373
375
|
*/
|
|
374
376
|
declare function runSync<T extends Parser<"sync", unknown, unknown>, TContexts extends readonly SourceContext<unknown>[]>(parser: T, options: RunOptions & {
|
package/dist/run.d.ts
CHANGED
|
@@ -369,6 +369,8 @@ declare function run<T extends Parser<Mode, unknown, unknown>>(parser: T, option
|
|
|
369
369
|
* @param parser The synchronous command-line parser to execute.
|
|
370
370
|
* @param options Configuration options for customizing behavior.
|
|
371
371
|
* @returns The parsed result if successful.
|
|
372
|
+
* @throws {TypeError} If an async parser (or a {@link Program} wrapping one)
|
|
373
|
+
* is passed at runtime. Use {@link run} or {@link runAsync} instead.
|
|
372
374
|
* @since 0.9.0
|
|
373
375
|
*/
|
|
374
376
|
declare function runSync<T extends Parser<"sync", unknown, unknown>, TContexts extends readonly SourceContext<unknown>[]>(parser: T, options: RunOptions & {
|
package/dist/run.js
CHANGED
|
@@ -31,6 +31,8 @@ function run(parserOrProgram, options = {}) {
|
|
|
31
31
|
return runImpl(parserOrProgram, options);
|
|
32
32
|
}
|
|
33
33
|
function runSync(parserOrProgram, options = {}) {
|
|
34
|
+
const parserToCheck = "parser" in parserOrProgram && "metadata" in parserOrProgram ? parserOrProgram.parser : parserOrProgram;
|
|
35
|
+
if (parserToCheck.$mode !== "sync") throw new TypeError("Cannot use an async parser with runSync(). Use run() or runAsync() instead.");
|
|
34
36
|
const contexts = options.contexts;
|
|
35
37
|
if (contexts && contexts.length > 0) {
|
|
36
38
|
const resolved = resolveProgramInput(parserOrProgram, options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/run",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.1236+3ee9891d",
|
|
4
4
|
"description": "Type-safe combinatorial command-line interface parser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
},
|
|
71
71
|
"sideEffects": false,
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@optique/core": "1.0.0-dev.
|
|
73
|
+
"@optique/core": "1.0.0-dev.1236+3ee9891d"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@types/node": "^20.19.9",
|