@optique/core 0.10.0-dev.332 → 0.10.0-dev.333

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.
@@ -2,6 +2,40 @@ import { Annotations } from "./annotations.cjs";
2
2
 
3
3
  //#region src/context.d.ts
4
4
 
5
+ /**
6
+ * Brand symbol for ParserValuePlaceholder type.
7
+ * @internal
8
+ */
9
+ declare const parserValuePlaceholderBrand: unique symbol;
10
+ /**
11
+ * A placeholder type that represents the parser's result value type.
12
+ *
13
+ * Use this type in `SourceContext<TRequiredOptions>` when the required options
14
+ * depend on the parser's result type. The `runWith()` function will substitute
15
+ * this placeholder with the actual parser value type at call site.
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * import type { SourceContext, ParserValuePlaceholder } from "@optique/core/context";
20
+ *
21
+ * // Define a context that requires options depending on parser result
22
+ * interface MyContext extends SourceContext<{
23
+ * extractPath: (parsed: ParserValuePlaceholder) => string | undefined;
24
+ * }> {
25
+ * // ...
26
+ * }
27
+ *
28
+ * // When used with runWith(), the placeholder becomes the actual parser type:
29
+ * // runWith(parser, "app", [myContext], {
30
+ * // extractPath: (parsed) => parsed.configPath // 'parsed' is typed!
31
+ * // });
32
+ * ```
33
+ *
34
+ * @since 0.10.0
35
+ */
36
+ type ParserValuePlaceholder = {
37
+ readonly [parserValuePlaceholderBrand]: "ParserValuePlaceholder";
38
+ };
5
39
  /**
6
40
  * A source context that can provide data to parsers via annotations.
7
41
  *
@@ -12,9 +46,14 @@ import { Annotations } from "./annotations.cjs";
12
46
  * - *Dynamic*: Data depends on parsing results (e.g., config files whose path
13
47
  * is determined by a CLI option)
14
48
  *
49
+ * @template TRequiredOptions Additional options that `runWith()` must provide
50
+ * when this context is used. Use `void` (the default) for contexts that
51
+ * don't require extra options. Use {@link ParserValuePlaceholder} in option
52
+ * types that depend on the parser's result type.
53
+ *
15
54
  * @example
16
55
  * ```typescript
17
- * // Static context example (environment variables)
56
+ * // Static context example (environment variables) - no extra options needed
18
57
  * const envContext: SourceContext = {
19
58
  * id: Symbol.for("@myapp/env"),
20
59
  * getAnnotations() {
@@ -27,24 +66,17 @@ import { Annotations } from "./annotations.cjs";
27
66
  * }
28
67
  * };
29
68
  *
30
- * // Dynamic context example (config file)
31
- * const configContext: SourceContext = {
32
- * id: Symbol.for("@myapp/config"),
33
- * async getAnnotations(parsed?: unknown) {
34
- * if (!parsed) return {}; // Return empty on first pass
35
- * const result = parsed as { config?: string };
36
- * if (!result.config) return {};
37
- * const data = await loadConfigFile(result.config);
38
- * return {
39
- * [Symbol.for("@myapp/config")]: data
40
- * };
41
- * }
42
- * };
69
+ * // Dynamic context that requires options from runWith()
70
+ * interface ConfigContext extends SourceContext<{
71
+ * getConfigPath: (parsed: ParserValuePlaceholder) => string | undefined;
72
+ * }> {
73
+ * // ...
74
+ * }
43
75
  * ```
44
76
  *
45
77
  * @since 0.10.0
46
78
  */
47
- interface SourceContext {
79
+ interface SourceContext<TRequiredOptions = void> {
48
80
  /**
49
81
  * Unique identifier for this context.
50
82
  *
@@ -52,6 +84,11 @@ interface SourceContext {
52
84
  * that consume this context's data.
53
85
  */
54
86
  readonly id: symbol;
87
+ /**
88
+ * Type-level marker for the required options. Not used at runtime.
89
+ * @internal
90
+ */
91
+ readonly _requiredOptions?: TRequiredOptions;
55
92
  /**
56
93
  * Get annotations to inject into parsing.
57
94
  *
@@ -82,6 +119,6 @@ interface SourceContext {
82
119
  * @returns `true` if the context is static, `false` otherwise.
83
120
  * @since 0.10.0
84
121
  */
85
- declare function isStaticContext(context: SourceContext): boolean;
122
+ declare function isStaticContext(context: SourceContext<unknown>): boolean;
86
123
  //#endregion
87
- export { type Annotations, SourceContext, isStaticContext };
124
+ export { type Annotations, ParserValuePlaceholder, SourceContext, isStaticContext };
package/dist/context.d.ts CHANGED
@@ -2,6 +2,40 @@ import { Annotations } from "./annotations.js";
2
2
 
3
3
  //#region src/context.d.ts
4
4
 
5
+ /**
6
+ * Brand symbol for ParserValuePlaceholder type.
7
+ * @internal
8
+ */
9
+ declare const parserValuePlaceholderBrand: unique symbol;
10
+ /**
11
+ * A placeholder type that represents the parser's result value type.
12
+ *
13
+ * Use this type in `SourceContext<TRequiredOptions>` when the required options
14
+ * depend on the parser's result type. The `runWith()` function will substitute
15
+ * this placeholder with the actual parser value type at call site.
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * import type { SourceContext, ParserValuePlaceholder } from "@optique/core/context";
20
+ *
21
+ * // Define a context that requires options depending on parser result
22
+ * interface MyContext extends SourceContext<{
23
+ * extractPath: (parsed: ParserValuePlaceholder) => string | undefined;
24
+ * }> {
25
+ * // ...
26
+ * }
27
+ *
28
+ * // When used with runWith(), the placeholder becomes the actual parser type:
29
+ * // runWith(parser, "app", [myContext], {
30
+ * // extractPath: (parsed) => parsed.configPath // 'parsed' is typed!
31
+ * // });
32
+ * ```
33
+ *
34
+ * @since 0.10.0
35
+ */
36
+ type ParserValuePlaceholder = {
37
+ readonly [parserValuePlaceholderBrand]: "ParserValuePlaceholder";
38
+ };
5
39
  /**
6
40
  * A source context that can provide data to parsers via annotations.
7
41
  *
@@ -12,9 +46,14 @@ import { Annotations } from "./annotations.js";
12
46
  * - *Dynamic*: Data depends on parsing results (e.g., config files whose path
13
47
  * is determined by a CLI option)
14
48
  *
49
+ * @template TRequiredOptions Additional options that `runWith()` must provide
50
+ * when this context is used. Use `void` (the default) for contexts that
51
+ * don't require extra options. Use {@link ParserValuePlaceholder} in option
52
+ * types that depend on the parser's result type.
53
+ *
15
54
  * @example
16
55
  * ```typescript
17
- * // Static context example (environment variables)
56
+ * // Static context example (environment variables) - no extra options needed
18
57
  * const envContext: SourceContext = {
19
58
  * id: Symbol.for("@myapp/env"),
20
59
  * getAnnotations() {
@@ -27,24 +66,17 @@ import { Annotations } from "./annotations.js";
27
66
  * }
28
67
  * };
29
68
  *
30
- * // Dynamic context example (config file)
31
- * const configContext: SourceContext = {
32
- * id: Symbol.for("@myapp/config"),
33
- * async getAnnotations(parsed?: unknown) {
34
- * if (!parsed) return {}; // Return empty on first pass
35
- * const result = parsed as { config?: string };
36
- * if (!result.config) return {};
37
- * const data = await loadConfigFile(result.config);
38
- * return {
39
- * [Symbol.for("@myapp/config")]: data
40
- * };
41
- * }
42
- * };
69
+ * // Dynamic context that requires options from runWith()
70
+ * interface ConfigContext extends SourceContext<{
71
+ * getConfigPath: (parsed: ParserValuePlaceholder) => string | undefined;
72
+ * }> {
73
+ * // ...
74
+ * }
43
75
  * ```
44
76
  *
45
77
  * @since 0.10.0
46
78
  */
47
- interface SourceContext {
79
+ interface SourceContext<TRequiredOptions = void> {
48
80
  /**
49
81
  * Unique identifier for this context.
50
82
  *
@@ -52,6 +84,11 @@ interface SourceContext {
52
84
  * that consume this context's data.
53
85
  */
54
86
  readonly id: symbol;
87
+ /**
88
+ * Type-level marker for the required options. Not used at runtime.
89
+ * @internal
90
+ */
91
+ readonly _requiredOptions?: TRequiredOptions;
55
92
  /**
56
93
  * Get annotations to inject into parsing.
57
94
  *
@@ -82,6 +119,6 @@ interface SourceContext {
82
119
  * @returns `true` if the context is static, `false` otherwise.
83
120
  * @since 0.10.0
84
121
  */
85
- declare function isStaticContext(context: SourceContext): boolean;
122
+ declare function isStaticContext(context: SourceContext<unknown>): boolean;
86
123
  //#endregion
87
- export { type Annotations, SourceContext, isStaticContext };
124
+ export { type Annotations, ParserValuePlaceholder, SourceContext, isStaticContext };
package/dist/facade.d.cts CHANGED
@@ -2,7 +2,7 @@ import { Message } from "./message.cjs";
2
2
  import { ShowDefaultOptions } from "./doc.cjs";
3
3
  import { InferMode, InferValue, Mode, ModeValue, Parser } from "./parser.cjs";
4
4
  import { ShellCompletion } from "./completion.cjs";
5
- import { SourceContext } from "./context.cjs";
5
+ import { ParserValuePlaceholder, SourceContext } from "./context.cjs";
6
6
  import { Program } from "./program.cjs";
7
7
 
8
8
  //#region src/facade.d.ts
@@ -283,6 +283,35 @@ declare function runParserAsync<TParser extends Parser<Mode, unknown, unknown>,
283
283
  declare class RunParserError extends Error {
284
284
  constructor(message: string);
285
285
  }
286
+ /**
287
+ * Substitutes {@link ParserValuePlaceholder} with the actual parser value type.
288
+ *
289
+ * This type recursively traverses `T` and replaces any occurrence of
290
+ * `ParserValuePlaceholder` with `TValue`. Used by `runWith()` to compute
291
+ * the required options type based on the parser's result type.
292
+ *
293
+ * @template T The type to transform.
294
+ * @template TValue The parser value type to substitute.
295
+ * @since 0.10.0
296
+ */
297
+ type SubstituteParserValue<T, TValue> = T extends ParserValuePlaceholder ? TValue : T extends ((...args: infer A) => infer R) ? (...args: { [K in keyof A]: SubstituteParserValue<A[K], TValue> }) => SubstituteParserValue<R, TValue> : T extends object ? { [K in keyof T]: SubstituteParserValue<T[K], TValue> } : T;
298
+ /**
299
+ * Converts a union type to an intersection type.
300
+ * @internal
301
+ */
302
+ type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
303
+ /**
304
+ * Extracts and merges required options from an array of source contexts.
305
+ *
306
+ * For each context in the array, extracts its `TRequiredOptions` type parameter,
307
+ * substitutes any `ParserValuePlaceholder` with `TValue`, and intersects all
308
+ * the resulting option types.
309
+ *
310
+ * @template TContexts The tuple/array type of source contexts.
311
+ * @template TValue The parser value type for placeholder substitution.
312
+ * @since 0.10.0
313
+ */
314
+ type ExtractRequiredOptions<TContexts extends readonly SourceContext<unknown>[], TValue> = UnionToIntersection<TContexts[number] extends SourceContext<infer O> ? O extends void ? unknown : SubstituteParserValue<O, TValue> : unknown>;
286
315
  /**
287
316
  * Options for runWith functions.
288
317
  * Extends RunOptions with additional context-related settings.
@@ -346,7 +375,7 @@ interface RunWithOptions<THelp, TError> extends RunOptions<THelp, TError> {
346
375
  * );
347
376
  * ```
348
377
  */
349
- declare function runWith<TParser extends Parser<Mode, unknown, unknown>, THelp = void, TError = never>(parser: TParser, programName: string, contexts: readonly SourceContext[], options?: RunWithOptions<THelp, TError>): Promise<InferValue<TParser>>;
378
+ declare function runWith<TParser extends Parser<Mode, unknown, unknown>, TContexts extends readonly SourceContext<unknown>[], THelp = void, TError = never>(parser: TParser, programName: string, contexts: TContexts, options: RunWithOptions<THelp, TError> & ExtractRequiredOptions<TContexts, InferValue<TParser>>): Promise<InferValue<TParser>>;
350
379
  /**
351
380
  * Runs a synchronous parser with multiple source contexts.
352
381
  *
@@ -364,7 +393,7 @@ declare function runWith<TParser extends Parser<Mode, unknown, unknown>, THelp =
364
393
  * @throws Error if any context returns a Promise.
365
394
  * @since 0.10.0
366
395
  */
367
- declare function runWithSync<TParser extends Parser<"sync", unknown, unknown>, THelp = void, TError = never>(parser: TParser, programName: string, contexts: readonly SourceContext[], options?: RunWithOptions<THelp, TError>): InferValue<TParser>;
396
+ declare function runWithSync<TParser extends Parser<"sync", unknown, unknown>, TContexts extends readonly SourceContext<unknown>[], THelp = void, TError = never>(parser: TParser, programName: string, contexts: TContexts, options: RunWithOptions<THelp, TError> & ExtractRequiredOptions<TContexts, InferValue<TParser>>): InferValue<TParser>;
368
397
  /**
369
398
  * Runs any parser asynchronously with multiple source contexts.
370
399
  *
@@ -381,6 +410,6 @@ declare function runWithSync<TParser extends Parser<"sync", unknown, unknown>, T
381
410
  * @returns Promise that resolves to the parsed result.
382
411
  * @since 0.10.0
383
412
  */
384
- declare function runWithAsync<TParser extends Parser<Mode, unknown, unknown>, THelp = void, TError = never>(parser: TParser, programName: string, contexts: readonly SourceContext[], options?: RunWithOptions<THelp, TError>): Promise<InferValue<TParser>>;
413
+ declare function runWithAsync<TParser extends Parser<Mode, unknown, unknown>, TContexts extends readonly SourceContext<unknown>[], THelp = void, TError = never>(parser: TParser, programName: string, contexts: TContexts, options: RunWithOptions<THelp, TError> & ExtractRequiredOptions<TContexts, InferValue<TParser>>): Promise<InferValue<TParser>>;
385
414
  //#endregion
386
- export { RunOptions, RunParserError, RunWithOptions, type SourceContext, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync };
415
+ export { ExtractRequiredOptions, type ParserValuePlaceholder, RunOptions, RunParserError, RunWithOptions, type SourceContext, SubstituteParserValue, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync };
package/dist/facade.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Message } from "./message.js";
2
2
  import { ShowDefaultOptions } from "./doc.js";
3
3
  import { InferMode, InferValue, Mode, ModeValue, Parser } from "./parser.js";
4
4
  import { ShellCompletion } from "./completion.js";
5
- import { SourceContext } from "./context.js";
5
+ import { ParserValuePlaceholder, SourceContext } from "./context.js";
6
6
  import { Program } from "./program.js";
7
7
 
8
8
  //#region src/facade.d.ts
@@ -283,6 +283,35 @@ declare function runParserAsync<TParser extends Parser<Mode, unknown, unknown>,
283
283
  declare class RunParserError extends Error {
284
284
  constructor(message: string);
285
285
  }
286
+ /**
287
+ * Substitutes {@link ParserValuePlaceholder} with the actual parser value type.
288
+ *
289
+ * This type recursively traverses `T` and replaces any occurrence of
290
+ * `ParserValuePlaceholder` with `TValue`. Used by `runWith()` to compute
291
+ * the required options type based on the parser's result type.
292
+ *
293
+ * @template T The type to transform.
294
+ * @template TValue The parser value type to substitute.
295
+ * @since 0.10.0
296
+ */
297
+ type SubstituteParserValue<T, TValue> = T extends ParserValuePlaceholder ? TValue : T extends ((...args: infer A) => infer R) ? (...args: { [K in keyof A]: SubstituteParserValue<A[K], TValue> }) => SubstituteParserValue<R, TValue> : T extends object ? { [K in keyof T]: SubstituteParserValue<T[K], TValue> } : T;
298
+ /**
299
+ * Converts a union type to an intersection type.
300
+ * @internal
301
+ */
302
+ type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
303
+ /**
304
+ * Extracts and merges required options from an array of source contexts.
305
+ *
306
+ * For each context in the array, extracts its `TRequiredOptions` type parameter,
307
+ * substitutes any `ParserValuePlaceholder` with `TValue`, and intersects all
308
+ * the resulting option types.
309
+ *
310
+ * @template TContexts The tuple/array type of source contexts.
311
+ * @template TValue The parser value type for placeholder substitution.
312
+ * @since 0.10.0
313
+ */
314
+ type ExtractRequiredOptions<TContexts extends readonly SourceContext<unknown>[], TValue> = UnionToIntersection<TContexts[number] extends SourceContext<infer O> ? O extends void ? unknown : SubstituteParserValue<O, TValue> : unknown>;
286
315
  /**
287
316
  * Options for runWith functions.
288
317
  * Extends RunOptions with additional context-related settings.
@@ -346,7 +375,7 @@ interface RunWithOptions<THelp, TError> extends RunOptions<THelp, TError> {
346
375
  * );
347
376
  * ```
348
377
  */
349
- declare function runWith<TParser extends Parser<Mode, unknown, unknown>, THelp = void, TError = never>(parser: TParser, programName: string, contexts: readonly SourceContext[], options?: RunWithOptions<THelp, TError>): Promise<InferValue<TParser>>;
378
+ declare function runWith<TParser extends Parser<Mode, unknown, unknown>, TContexts extends readonly SourceContext<unknown>[], THelp = void, TError = never>(parser: TParser, programName: string, contexts: TContexts, options: RunWithOptions<THelp, TError> & ExtractRequiredOptions<TContexts, InferValue<TParser>>): Promise<InferValue<TParser>>;
350
379
  /**
351
380
  * Runs a synchronous parser with multiple source contexts.
352
381
  *
@@ -364,7 +393,7 @@ declare function runWith<TParser extends Parser<Mode, unknown, unknown>, THelp =
364
393
  * @throws Error if any context returns a Promise.
365
394
  * @since 0.10.0
366
395
  */
367
- declare function runWithSync<TParser extends Parser<"sync", unknown, unknown>, THelp = void, TError = never>(parser: TParser, programName: string, contexts: readonly SourceContext[], options?: RunWithOptions<THelp, TError>): InferValue<TParser>;
396
+ declare function runWithSync<TParser extends Parser<"sync", unknown, unknown>, TContexts extends readonly SourceContext<unknown>[], THelp = void, TError = never>(parser: TParser, programName: string, contexts: TContexts, options: RunWithOptions<THelp, TError> & ExtractRequiredOptions<TContexts, InferValue<TParser>>): InferValue<TParser>;
368
397
  /**
369
398
  * Runs any parser asynchronously with multiple source contexts.
370
399
  *
@@ -381,6 +410,6 @@ declare function runWithSync<TParser extends Parser<"sync", unknown, unknown>, T
381
410
  * @returns Promise that resolves to the parsed result.
382
411
  * @since 0.10.0
383
412
  */
384
- declare function runWithAsync<TParser extends Parser<Mode, unknown, unknown>, THelp = void, TError = never>(parser: TParser, programName: string, contexts: readonly SourceContext[], options?: RunWithOptions<THelp, TError>): Promise<InferValue<TParser>>;
413
+ declare function runWithAsync<TParser extends Parser<Mode, unknown, unknown>, TContexts extends readonly SourceContext<unknown>[], THelp = void, TError = never>(parser: TParser, programName: string, contexts: TContexts, options: RunWithOptions<THelp, TError> & ExtractRequiredOptions<TContexts, InferValue<TParser>>): Promise<InferValue<TParser>>;
385
414
  //#endregion
386
- export { RunOptions, RunParserError, RunWithOptions, type SourceContext, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync };
415
+ export { ExtractRequiredOptions, type ParserValuePlaceholder, RunOptions, RunParserError, RunWithOptions, type SourceContext, SubstituteParserValue, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync };
package/dist/index.d.cts CHANGED
@@ -10,6 +10,6 @@ import { AnyDependencySource, CombineMode, CombinedDependencyMode, DeferredParse
10
10
  import { ArgumentErrorOptions, ArgumentOptions, CommandErrorOptions, CommandOptions, FlagErrorOptions, FlagOptions, OptionErrorOptions, OptionOptions, OptionState, PassThroughFormat, PassThroughOptions, argument, command, constant, flag, option, passThrough } from "./primitives.cjs";
11
11
  import { CombineModes, DocState, InferMode, InferValue, Mode, ModeIterable, ModeValue, Parser, ParserContext, ParserResult, Result, Suggestion, getDocPage, getDocPageAsync, getDocPageSync, parse, parseAsync, parseSync, suggest, suggestAsync, suggestSync } from "./parser.cjs";
12
12
  import { ShellCompletion, bash, fish, nu, pwsh, zsh } from "./completion.cjs";
13
- import { SourceContext } from "./context.cjs";
14
- import { RunOptions, RunParserError, RunWithOptions, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync } from "./facade.cjs";
15
- export { type Annotations, AnyDependencySource, ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CombineMode, CombineModes, CombinedDependencyMode, CommandErrorOptions, CommandOptions, ConditionalErrorOptions, ConditionalOptions, DeferredParseState, DependencyError, DependencyMode, DependencyRegistry, DependencySource, DependencySourceState, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, DuplicateOptionError, FlagErrorOptions, FlagOptions, FloatOptions, InferMode, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, LocaleOptions, LongestMatchErrorOptions, LongestMatchOptions, MergeOptions, type Message, type MessageFormatOptions, type MessageTerm, Mode, ModeIterable, ModeValue, MultipleErrorOptions, MultipleOptions, NoMatchContext, NonEmptyString, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionName, OptionOptions, OptionState, OrErrorOptions, OrOptions, type ParseOptions, Parser, ParserContext, ParserResult, PassThroughFormat, PassThroughOptions, PendingDependencySourceState, ResolvedDependency, Result, RunOptions, RunParserError, RunWithOptions, ShellCompletion, ShowDefaultOptions, SourceContext, StringOptions, Suggestion, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, type ValueSetOptions, WithDefaultError, WithDefaultOptions, annotationKey, argument, bash, choice, command, commandLine, concat, conditional, constant, createDeferredParseState, createDependencySourceState, createPendingDependencySourceState, defaultValues, deferredParseMarker, dependency, dependencyId, dependencyIds, dependencySourceMarker, dependencySourceStateMarker, deriveFrom, deriveFromAsync, deriveFromSync, derivedValueParserMarker, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractOptionNames, fish, flag, float, formatDependencyError, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getAnnotations, getDefaultValuesFunction, getDependencyIds, getDocPage, getDocPageAsync, getDocPageSync, group, integer, isDeferredParseState, isDependencySource, isDependencySourceState, isDerivedValueParser, isNonEmptyString, isPendingDependencySourceState, isValueParser, isWrappedDependencySource, link, locale, longestMatch, map, merge, message, metavar, multiple, nonEmpty, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, parse, parseAsync, parseSync, parseWithDependency, passThrough, pendingDependencySourceStateMarker, pwsh, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync, string, suggest, suggestAsync, suggestSync, suggestWithDependency, text, transformsDependencyValue, transformsDependencyValueMarker, tuple, url, uuid, value, valueSet, values, withDefault, wrappedDependencySourceMarker, zsh };
13
+ import { ParserValuePlaceholder, SourceContext } from "./context.cjs";
14
+ import { ExtractRequiredOptions, RunOptions, RunParserError, RunWithOptions, SubstituteParserValue, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync } from "./facade.cjs";
15
+ export { type Annotations, AnyDependencySource, ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CombineMode, CombineModes, CombinedDependencyMode, CommandErrorOptions, CommandOptions, ConditionalErrorOptions, ConditionalOptions, DeferredParseState, DependencyError, DependencyMode, DependencyRegistry, DependencySource, DependencySourceState, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, DuplicateOptionError, ExtractRequiredOptions, FlagErrorOptions, FlagOptions, FloatOptions, InferMode, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, LocaleOptions, LongestMatchErrorOptions, LongestMatchOptions, MergeOptions, type Message, type MessageFormatOptions, type MessageTerm, Mode, ModeIterable, ModeValue, MultipleErrorOptions, MultipleOptions, NoMatchContext, NonEmptyString, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionName, OptionOptions, OptionState, OrErrorOptions, OrOptions, type ParseOptions, Parser, ParserContext, ParserResult, ParserValuePlaceholder, PassThroughFormat, PassThroughOptions, PendingDependencySourceState, ResolvedDependency, Result, RunOptions, RunParserError, RunWithOptions, ShellCompletion, ShowDefaultOptions, SourceContext, StringOptions, SubstituteParserValue, Suggestion, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, type ValueSetOptions, WithDefaultError, WithDefaultOptions, annotationKey, argument, bash, choice, command, commandLine, concat, conditional, constant, createDeferredParseState, createDependencySourceState, createPendingDependencySourceState, defaultValues, deferredParseMarker, dependency, dependencyId, dependencyIds, dependencySourceMarker, dependencySourceStateMarker, deriveFrom, deriveFromAsync, deriveFromSync, derivedValueParserMarker, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractOptionNames, fish, flag, float, formatDependencyError, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getAnnotations, getDefaultValuesFunction, getDependencyIds, getDocPage, getDocPageAsync, getDocPageSync, group, integer, isDeferredParseState, isDependencySource, isDependencySourceState, isDerivedValueParser, isNonEmptyString, isPendingDependencySourceState, isValueParser, isWrappedDependencySource, link, locale, longestMatch, map, merge, message, metavar, multiple, nonEmpty, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, parse, parseAsync, parseSync, parseWithDependency, passThrough, pendingDependencySourceStateMarker, pwsh, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync, string, suggest, suggestAsync, suggestSync, suggestWithDependency, text, transformsDependencyValue, transformsDependencyValueMarker, tuple, url, uuid, value, valueSet, values, withDefault, wrappedDependencySourceMarker, zsh };
package/dist/index.d.ts CHANGED
@@ -10,6 +10,6 @@ import { AnyDependencySource, CombineMode, CombinedDependencyMode, DeferredParse
10
10
  import { ArgumentErrorOptions, ArgumentOptions, CommandErrorOptions, CommandOptions, FlagErrorOptions, FlagOptions, OptionErrorOptions, OptionOptions, OptionState, PassThroughFormat, PassThroughOptions, argument, command, constant, flag, option, passThrough } from "./primitives.js";
11
11
  import { CombineModes, DocState, InferMode, InferValue, Mode, ModeIterable, ModeValue, Parser, ParserContext, ParserResult, Result, Suggestion, getDocPage, getDocPageAsync, getDocPageSync, parse, parseAsync, parseSync, suggest, suggestAsync, suggestSync } from "./parser.js";
12
12
  import { ShellCompletion, bash, fish, nu, pwsh, zsh } from "./completion.js";
13
- import { SourceContext } from "./context.js";
14
- import { RunOptions, RunParserError, RunWithOptions, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync } from "./facade.js";
15
- export { type Annotations, AnyDependencySource, ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CombineMode, CombineModes, CombinedDependencyMode, CommandErrorOptions, CommandOptions, ConditionalErrorOptions, ConditionalOptions, DeferredParseState, DependencyError, DependencyMode, DependencyRegistry, DependencySource, DependencySourceState, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, DuplicateOptionError, FlagErrorOptions, FlagOptions, FloatOptions, InferMode, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, LocaleOptions, LongestMatchErrorOptions, LongestMatchOptions, MergeOptions, type Message, type MessageFormatOptions, type MessageTerm, Mode, ModeIterable, ModeValue, MultipleErrorOptions, MultipleOptions, NoMatchContext, NonEmptyString, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionName, OptionOptions, OptionState, OrErrorOptions, OrOptions, type ParseOptions, Parser, ParserContext, ParserResult, PassThroughFormat, PassThroughOptions, PendingDependencySourceState, ResolvedDependency, Result, RunOptions, RunParserError, RunWithOptions, ShellCompletion, ShowDefaultOptions, SourceContext, StringOptions, Suggestion, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, type ValueSetOptions, WithDefaultError, WithDefaultOptions, annotationKey, argument, bash, choice, command, commandLine, concat, conditional, constant, createDeferredParseState, createDependencySourceState, createPendingDependencySourceState, defaultValues, deferredParseMarker, dependency, dependencyId, dependencyIds, dependencySourceMarker, dependencySourceStateMarker, deriveFrom, deriveFromAsync, deriveFromSync, derivedValueParserMarker, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractOptionNames, fish, flag, float, formatDependencyError, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getAnnotations, getDefaultValuesFunction, getDependencyIds, getDocPage, getDocPageAsync, getDocPageSync, group, integer, isDeferredParseState, isDependencySource, isDependencySourceState, isDerivedValueParser, isNonEmptyString, isPendingDependencySourceState, isValueParser, isWrappedDependencySource, link, locale, longestMatch, map, merge, message, metavar, multiple, nonEmpty, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, parse, parseAsync, parseSync, parseWithDependency, passThrough, pendingDependencySourceStateMarker, pwsh, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync, string, suggest, suggestAsync, suggestSync, suggestWithDependency, text, transformsDependencyValue, transformsDependencyValueMarker, tuple, url, uuid, value, valueSet, values, withDefault, wrappedDependencySourceMarker, zsh };
13
+ import { ParserValuePlaceholder, SourceContext } from "./context.js";
14
+ import { ExtractRequiredOptions, RunOptions, RunParserError, RunWithOptions, SubstituteParserValue, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync } from "./facade.js";
15
+ export { type Annotations, AnyDependencySource, ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CombineMode, CombineModes, CombinedDependencyMode, CommandErrorOptions, CommandOptions, ConditionalErrorOptions, ConditionalOptions, DeferredParseState, DependencyError, DependencyMode, DependencyRegistry, DependencySource, DependencySourceState, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, DuplicateOptionError, ExtractRequiredOptions, FlagErrorOptions, FlagOptions, FloatOptions, InferMode, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, LocaleOptions, LongestMatchErrorOptions, LongestMatchOptions, MergeOptions, type Message, type MessageFormatOptions, type MessageTerm, Mode, ModeIterable, ModeValue, MultipleErrorOptions, MultipleOptions, NoMatchContext, NonEmptyString, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionName, OptionOptions, OptionState, OrErrorOptions, OrOptions, type ParseOptions, Parser, ParserContext, ParserResult, ParserValuePlaceholder, PassThroughFormat, PassThroughOptions, PendingDependencySourceState, ResolvedDependency, Result, RunOptions, RunParserError, RunWithOptions, ShellCompletion, ShowDefaultOptions, SourceContext, StringOptions, SubstituteParserValue, Suggestion, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, type ValueSetOptions, WithDefaultError, WithDefaultOptions, annotationKey, argument, bash, choice, command, commandLine, concat, conditional, constant, createDeferredParseState, createDependencySourceState, createPendingDependencySourceState, defaultValues, deferredParseMarker, dependency, dependencyId, dependencyIds, dependencySourceMarker, dependencySourceStateMarker, deriveFrom, deriveFromAsync, deriveFromSync, derivedValueParserMarker, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractOptionNames, fish, flag, float, formatDependencyError, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getAnnotations, getDefaultValuesFunction, getDependencyIds, getDocPage, getDocPageAsync, getDocPageSync, group, integer, isDeferredParseState, isDependencySource, isDependencySourceState, isDerivedValueParser, isNonEmptyString, isPendingDependencySourceState, isValueParser, isWrappedDependencySource, link, locale, longestMatch, map, merge, message, metavar, multiple, nonEmpty, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, parse, parseAsync, parseSync, parseWithDependency, passThrough, pendingDependencySourceStateMarker, pwsh, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync, string, suggest, suggestAsync, suggestSync, suggestWithDependency, text, transformsDependencyValue, transformsDependencyValueMarker, tuple, url, uuid, value, valueSet, values, withDefault, wrappedDependencySourceMarker, zsh };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "0.10.0-dev.332+be2882ab",
3
+ "version": "0.10.0-dev.333+076fceae",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",