@optique/run 1.0.0-dev.590 → 1.0.0-dev.594
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.d.cts +11 -3
- package/dist/run.d.ts +11 -3
- package/package.json +2 -2
package/dist/run.d.cts
CHANGED
|
@@ -228,7 +228,7 @@ interface RunOptions {
|
|
|
228
228
|
}
|
|
229
229
|
/**
|
|
230
230
|
* Rejects context tuples that are statically known to be empty so those calls
|
|
231
|
-
* fall back to the
|
|
231
|
+
* fall back to the no-context overloads.
|
|
232
232
|
*/
|
|
233
233
|
type RejectEmptyContexts<TContexts extends readonly SourceContext<unknown>[]> = TContexts extends readonly [] ? never : unknown;
|
|
234
234
|
/**
|
|
@@ -240,9 +240,10 @@ type NonEmptySourceContexts = readonly [SourceContext<unknown>, ...SourceContext
|
|
|
240
240
|
* Rejects option shapes that may carry a non-empty `contexts` array so plain
|
|
241
241
|
* Program overloads do not bypass the context-aware overloads.
|
|
242
242
|
*/
|
|
243
|
-
type
|
|
243
|
+
type ContextsFromOptions<TOptions> = [Exclude<TOptions, undefined>] extends [never] ? undefined : Exclude<TOptions, undefined> extends {
|
|
244
244
|
readonly contexts?: infer TContexts extends readonly SourceContext<unknown>[] | undefined;
|
|
245
|
-
} ?
|
|
245
|
+
} ? TContexts : undefined;
|
|
246
|
+
type RejectContextfulOptions<TOptions> = [ContextsFromOptions<TOptions>] extends [undefined | readonly []] ? unknown : never;
|
|
246
247
|
/**
|
|
247
248
|
* Rejects option shapes that introduce keys outside the public `RunOptions`
|
|
248
249
|
* contract, preserving typo detection for direct object literals and wider
|
|
@@ -254,6 +255,11 @@ type RejectUnknownRunOptionKeys<TOptions> = [TOptions] extends [undefined] ? unk
|
|
|
254
255
|
* conservative fallback overloads because they may hide context presence.
|
|
255
256
|
*/
|
|
256
257
|
type AcceptExactRunOptions<TOptions> = [TOptions] extends [RunOptions] ? [RunOptions] extends [TOptions] ? unknown : never : never;
|
|
258
|
+
/**
|
|
259
|
+
* Accepts only values typed exactly as `RunOptions | undefined`, which model
|
|
260
|
+
* optional forwarding wrappers without widening generic Program overloads.
|
|
261
|
+
*/
|
|
262
|
+
type AcceptExactOptionalRunOptions<TOptions> = [TOptions] extends [RunOptions | undefined] ? [RunOptions | undefined] extends [TOptions] ? unknown : never : never;
|
|
257
263
|
/**
|
|
258
264
|
* Runs a command-line parser with automatic process integration.
|
|
259
265
|
*
|
|
@@ -362,6 +368,7 @@ declare function runSync<T, const TContexts extends readonly SourceContext<unkno
|
|
|
362
368
|
} & RejectEmptyContexts<TContexts> & ExtractRequiredOptions<TContexts, T>): T;
|
|
363
369
|
declare function runSync<T, const TOptions extends RunOptions | undefined>(program: Program<"sync", T>, options?: TOptions & RejectContextfulOptions<TOptions> & RejectUnknownRunOptionKeys<TOptions>): T;
|
|
364
370
|
declare function runSync<T, TOptions extends RunOptions>(program: Program<"sync", T>, options: TOptions & AcceptExactRunOptions<TOptions>): T;
|
|
371
|
+
declare function runSync<T, TOptions extends RunOptions | undefined>(program: Program<"sync", T>, options: TOptions & AcceptExactOptionalRunOptions<TOptions>): T;
|
|
365
372
|
declare function runSync<T extends Parser<"sync", unknown, unknown>>(parser: T, options?: RunOptions): InferValue<T>;
|
|
366
373
|
/**
|
|
367
374
|
* Runs an asynchronous command-line parser with automatic process integration.
|
|
@@ -385,6 +392,7 @@ declare function runAsync<M extends Mode, T, const TContexts extends readonly So
|
|
|
385
392
|
declare function runAsync<T, const TOptions extends RunOptions | undefined>(program: Program<"sync", T>, options?: TOptions & RejectContextfulOptions<TOptions> & RejectUnknownRunOptionKeys<TOptions>): Promise<T>;
|
|
386
393
|
declare function runAsync<T, const TOptions extends RunOptions | undefined>(program: Program<"async", T>, options?: TOptions & RejectContextfulOptions<TOptions> & RejectUnknownRunOptionKeys<TOptions>): Promise<T>;
|
|
387
394
|
declare function runAsync<T, TOptions extends RunOptions>(program: Program<Mode, T>, options: TOptions & AcceptExactRunOptions<TOptions>): Promise<T>;
|
|
395
|
+
declare function runAsync<T, TOptions extends RunOptions | undefined>(program: Program<Mode, T>, options: TOptions & AcceptExactOptionalRunOptions<TOptions>): Promise<T>;
|
|
388
396
|
declare function runAsync<T extends Parser<Mode, unknown, unknown>>(parser: T, options?: RunOptions): Promise<InferValue<T>>;
|
|
389
397
|
//#endregion
|
|
390
398
|
export { RunOptions, run, runAsync, runSync };
|
package/dist/run.d.ts
CHANGED
|
@@ -228,7 +228,7 @@ interface RunOptions {
|
|
|
228
228
|
}
|
|
229
229
|
/**
|
|
230
230
|
* Rejects context tuples that are statically known to be empty so those calls
|
|
231
|
-
* fall back to the
|
|
231
|
+
* fall back to the no-context overloads.
|
|
232
232
|
*/
|
|
233
233
|
type RejectEmptyContexts<TContexts extends readonly SourceContext<unknown>[]> = TContexts extends readonly [] ? never : unknown;
|
|
234
234
|
/**
|
|
@@ -240,9 +240,10 @@ type NonEmptySourceContexts = readonly [SourceContext<unknown>, ...SourceContext
|
|
|
240
240
|
* Rejects option shapes that may carry a non-empty `contexts` array so plain
|
|
241
241
|
* Program overloads do not bypass the context-aware overloads.
|
|
242
242
|
*/
|
|
243
|
-
type
|
|
243
|
+
type ContextsFromOptions<TOptions> = [Exclude<TOptions, undefined>] extends [never] ? undefined : Exclude<TOptions, undefined> extends {
|
|
244
244
|
readonly contexts?: infer TContexts extends readonly SourceContext<unknown>[] | undefined;
|
|
245
|
-
} ?
|
|
245
|
+
} ? TContexts : undefined;
|
|
246
|
+
type RejectContextfulOptions<TOptions> = [ContextsFromOptions<TOptions>] extends [undefined | readonly []] ? unknown : never;
|
|
246
247
|
/**
|
|
247
248
|
* Rejects option shapes that introduce keys outside the public `RunOptions`
|
|
248
249
|
* contract, preserving typo detection for direct object literals and wider
|
|
@@ -254,6 +255,11 @@ type RejectUnknownRunOptionKeys<TOptions> = [TOptions] extends [undefined] ? unk
|
|
|
254
255
|
* conservative fallback overloads because they may hide context presence.
|
|
255
256
|
*/
|
|
256
257
|
type AcceptExactRunOptions<TOptions> = [TOptions] extends [RunOptions] ? [RunOptions] extends [TOptions] ? unknown : never : never;
|
|
258
|
+
/**
|
|
259
|
+
* Accepts only values typed exactly as `RunOptions | undefined`, which model
|
|
260
|
+
* optional forwarding wrappers without widening generic Program overloads.
|
|
261
|
+
*/
|
|
262
|
+
type AcceptExactOptionalRunOptions<TOptions> = [TOptions] extends [RunOptions | undefined] ? [RunOptions | undefined] extends [TOptions] ? unknown : never : never;
|
|
257
263
|
/**
|
|
258
264
|
* Runs a command-line parser with automatic process integration.
|
|
259
265
|
*
|
|
@@ -362,6 +368,7 @@ declare function runSync<T, const TContexts extends readonly SourceContext<unkno
|
|
|
362
368
|
} & RejectEmptyContexts<TContexts> & ExtractRequiredOptions<TContexts, T>): T;
|
|
363
369
|
declare function runSync<T, const TOptions extends RunOptions | undefined>(program: Program<"sync", T>, options?: TOptions & RejectContextfulOptions<TOptions> & RejectUnknownRunOptionKeys<TOptions>): T;
|
|
364
370
|
declare function runSync<T, TOptions extends RunOptions>(program: Program<"sync", T>, options: TOptions & AcceptExactRunOptions<TOptions>): T;
|
|
371
|
+
declare function runSync<T, TOptions extends RunOptions | undefined>(program: Program<"sync", T>, options: TOptions & AcceptExactOptionalRunOptions<TOptions>): T;
|
|
365
372
|
declare function runSync<T extends Parser<"sync", unknown, unknown>>(parser: T, options?: RunOptions): InferValue<T>;
|
|
366
373
|
/**
|
|
367
374
|
* Runs an asynchronous command-line parser with automatic process integration.
|
|
@@ -385,6 +392,7 @@ declare function runAsync<M extends Mode, T, const TContexts extends readonly So
|
|
|
385
392
|
declare function runAsync<T, const TOptions extends RunOptions | undefined>(program: Program<"sync", T>, options?: TOptions & RejectContextfulOptions<TOptions> & RejectUnknownRunOptionKeys<TOptions>): Promise<T>;
|
|
386
393
|
declare function runAsync<T, const TOptions extends RunOptions | undefined>(program: Program<"async", T>, options?: TOptions & RejectContextfulOptions<TOptions> & RejectUnknownRunOptionKeys<TOptions>): Promise<T>;
|
|
387
394
|
declare function runAsync<T, TOptions extends RunOptions>(program: Program<Mode, T>, options: TOptions & AcceptExactRunOptions<TOptions>): Promise<T>;
|
|
395
|
+
declare function runAsync<T, TOptions extends RunOptions | undefined>(program: Program<Mode, T>, options: TOptions & AcceptExactOptionalRunOptions<TOptions>): Promise<T>;
|
|
388
396
|
declare function runAsync<T extends Parser<Mode, unknown, unknown>>(parser: T, options?: RunOptions): Promise<InferValue<T>>;
|
|
389
397
|
//#endregion
|
|
390
398
|
export { RunOptions, run, runAsync, runSync };
|
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.594+de4e1bda",
|
|
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.594+de4e1bda"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@types/node": "^20.19.9",
|