@optique/core 1.0.0-dev.1884 → 1.0.0-dev.1886
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/annotations.cjs +68 -648
- package/dist/annotations.d.cts +6 -50
- package/dist/annotations.d.ts +6 -50
- package/dist/annotations.js +69 -647
- package/dist/constructs.cjs +11 -1
- package/dist/constructs.d.cts +6 -3
- package/dist/constructs.d.ts +6 -3
- package/dist/constructs.js +11 -1
- package/dist/context.d.cts +4 -4
- package/dist/context.d.ts +4 -4
- package/dist/facade.cjs +1 -1
- package/dist/facade.js +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/parser.cjs +1 -1
- package/dist/parser.js +2 -2
- package/package.json +1 -1
package/dist/constructs.cjs
CHANGED
|
@@ -493,7 +493,7 @@ var DuplicateOptionError = class extends Error {
|
|
|
493
493
|
function checkDuplicateOptionNames(parserSources) {
|
|
494
494
|
const optionNameSources = /* @__PURE__ */ new Map();
|
|
495
495
|
for (const [source, usage] of parserSources) {
|
|
496
|
-
const names =
|
|
496
|
+
const names = extractParsableOptionNames(usage);
|
|
497
497
|
for (const name of names) {
|
|
498
498
|
if (!optionNameSources.has(name)) optionNameSources.set(name, []);
|
|
499
499
|
optionNameSources.get(name).push(source);
|
|
@@ -502,6 +502,16 @@ function checkDuplicateOptionNames(parserSources) {
|
|
|
502
502
|
for (const [name, sources] of optionNameSources) if (sources.length > 1) throw new DuplicateOptionError(name, sources);
|
|
503
503
|
}
|
|
504
504
|
/**
|
|
505
|
+
* Extracts option names that participate in CLI syntax.
|
|
506
|
+
*
|
|
507
|
+
* Constructor-time collision checks must include fully hidden options because
|
|
508
|
+
* `hidden: true` only removes user-facing visibility. It does not remove the
|
|
509
|
+
* option from the accepted input grammar.
|
|
510
|
+
*/
|
|
511
|
+
function extractParsableOptionNames(usage) {
|
|
512
|
+
return require_usage.extractOptionNames(usage, true);
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
505
515
|
* Generates a contextual error message based on what types of inputs
|
|
506
516
|
* the parsers expect (options, commands, or arguments).
|
|
507
517
|
* @param context Context about what types of inputs are expected
|
package/dist/constructs.d.cts
CHANGED
|
@@ -925,7 +925,8 @@ interface ObjectOptions {
|
|
|
925
925
|
readonly errors?: ObjectErrorOptions;
|
|
926
926
|
/**
|
|
927
927
|
* When `true`, allows duplicate option names across different fields.
|
|
928
|
-
* By default (`false`), duplicate option names
|
|
928
|
+
* By default (`false`), duplicate option names cause a construction-time
|
|
929
|
+
* error.
|
|
929
930
|
*
|
|
930
931
|
* @default `false`
|
|
931
932
|
* @since 0.7.0
|
|
@@ -1056,7 +1057,8 @@ declare function object<T extends {
|
|
|
1056
1057
|
interface TupleOptions {
|
|
1057
1058
|
/**
|
|
1058
1059
|
* When `true`, allows duplicate option names across different parsers.
|
|
1059
|
-
* By default (`false`), duplicate option names
|
|
1060
|
+
* By default (`false`), duplicate option names cause a construction-time
|
|
1061
|
+
* error.
|
|
1060
1062
|
*
|
|
1061
1063
|
* @default `false`
|
|
1062
1064
|
* @since 0.7.0
|
|
@@ -1109,7 +1111,8 @@ type ExtractObjectTypes<P> = P extends Parser<Mode, infer V, unknown> ? [AllObje
|
|
|
1109
1111
|
interface MergeOptions {
|
|
1110
1112
|
/**
|
|
1111
1113
|
* When `true`, allows duplicate option names across merged parsers.
|
|
1112
|
-
* By default (`false`), duplicate option names
|
|
1114
|
+
* By default (`false`), duplicate option names cause a construction-time
|
|
1115
|
+
* error.
|
|
1113
1116
|
*
|
|
1114
1117
|
* @default `false`
|
|
1115
1118
|
* @since 0.7.0
|
package/dist/constructs.d.ts
CHANGED
|
@@ -925,7 +925,8 @@ interface ObjectOptions {
|
|
|
925
925
|
readonly errors?: ObjectErrorOptions;
|
|
926
926
|
/**
|
|
927
927
|
* When `true`, allows duplicate option names across different fields.
|
|
928
|
-
* By default (`false`), duplicate option names
|
|
928
|
+
* By default (`false`), duplicate option names cause a construction-time
|
|
929
|
+
* error.
|
|
929
930
|
*
|
|
930
931
|
* @default `false`
|
|
931
932
|
* @since 0.7.0
|
|
@@ -1056,7 +1057,8 @@ declare function object<T extends {
|
|
|
1056
1057
|
interface TupleOptions {
|
|
1057
1058
|
/**
|
|
1058
1059
|
* When `true`, allows duplicate option names across different parsers.
|
|
1059
|
-
* By default (`false`), duplicate option names
|
|
1060
|
+
* By default (`false`), duplicate option names cause a construction-time
|
|
1061
|
+
* error.
|
|
1060
1062
|
*
|
|
1061
1063
|
* @default `false`
|
|
1062
1064
|
* @since 0.7.0
|
|
@@ -1109,7 +1111,8 @@ type ExtractObjectTypes<P> = P extends Parser<Mode, infer V, unknown> ? [AllObje
|
|
|
1109
1111
|
interface MergeOptions {
|
|
1110
1112
|
/**
|
|
1111
1113
|
* When `true`, allows duplicate option names across merged parsers.
|
|
1112
|
-
* By default (`false`), duplicate option names
|
|
1114
|
+
* By default (`false`), duplicate option names cause a construction-time
|
|
1115
|
+
* error.
|
|
1113
1116
|
*
|
|
1114
1117
|
* @default `false`
|
|
1115
1118
|
* @since 0.7.0
|
package/dist/constructs.js
CHANGED
|
@@ -493,7 +493,7 @@ var DuplicateOptionError = class extends Error {
|
|
|
493
493
|
function checkDuplicateOptionNames(parserSources) {
|
|
494
494
|
const optionNameSources = /* @__PURE__ */ new Map();
|
|
495
495
|
for (const [source, usage] of parserSources) {
|
|
496
|
-
const names =
|
|
496
|
+
const names = extractParsableOptionNames(usage);
|
|
497
497
|
for (const name of names) {
|
|
498
498
|
if (!optionNameSources.has(name)) optionNameSources.set(name, []);
|
|
499
499
|
optionNameSources.get(name).push(source);
|
|
@@ -502,6 +502,16 @@ function checkDuplicateOptionNames(parserSources) {
|
|
|
502
502
|
for (const [name, sources] of optionNameSources) if (sources.length > 1) throw new DuplicateOptionError(name, sources);
|
|
503
503
|
}
|
|
504
504
|
/**
|
|
505
|
+
* Extracts option names that participate in CLI syntax.
|
|
506
|
+
*
|
|
507
|
+
* Constructor-time collision checks must include fully hidden options because
|
|
508
|
+
* `hidden: true` only removes user-facing visibility. It does not remove the
|
|
509
|
+
* option from the accepted input grammar.
|
|
510
|
+
*/
|
|
511
|
+
function extractParsableOptionNames(usage) {
|
|
512
|
+
return extractOptionNames(usage, true);
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
505
515
|
* Generates a contextual error message based on what types of inputs
|
|
506
516
|
* the parsers expect (options, commands, or arguments).
|
|
507
517
|
* @param context Context about what types of inputs are expected
|
package/dist/context.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Annotations
|
|
1
|
+
import { Annotations } from "./annotations.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/context.d.ts
|
|
4
4
|
|
|
@@ -197,7 +197,7 @@ interface SourceContext<TRequiredOptions = void> {
|
|
|
197
197
|
* during phase 1. Can be a Promise for async operations (e.g.,
|
|
198
198
|
* loading config files).
|
|
199
199
|
*/
|
|
200
|
-
getAnnotations(request?: SourceContextRequest, options?: unknown): Promise<Annotations
|
|
200
|
+
getAnnotations(request?: SourceContextRequest, options?: unknown): Promise<Annotations> | Annotations;
|
|
201
201
|
/**
|
|
202
202
|
* Optional hook to provide additional internal annotations during
|
|
203
203
|
* annotation collection. Called after {@link getAnnotations} with the
|
|
@@ -212,7 +212,7 @@ interface SourceContext<TRequiredOptions = void> {
|
|
|
212
212
|
* @returns Additional annotations to merge, or `undefined`.
|
|
213
213
|
* @since 1.0.0
|
|
214
214
|
*/
|
|
215
|
-
getInternalAnnotations?(request: SourceContextRequest, annotations: Annotations
|
|
215
|
+
getInternalAnnotations?(request: SourceContextRequest, annotations: Annotations): Annotations | undefined;
|
|
216
216
|
/**
|
|
217
217
|
* Optional synchronous cleanup method. Called by `runWith()` and
|
|
218
218
|
* `runWithSync()` after parsing completes. In `runWith()`, this happens
|
|
@@ -232,4 +232,4 @@ interface SourceContext<TRequiredOptions = void> {
|
|
|
232
232
|
[Symbol.asyncDispose]?(): void | PromiseLike<void>;
|
|
233
233
|
}
|
|
234
234
|
//#endregion
|
|
235
|
-
export { type Annotations, ParserValuePlaceholder,
|
|
235
|
+
export { type Annotations, ParserValuePlaceholder, SourceContext, SourceContextPhase, SourceContextPhase1Request, SourceContextPhase2Request, SourceContextRequest };
|
package/dist/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Annotations
|
|
1
|
+
import { Annotations } from "./annotations.js";
|
|
2
2
|
|
|
3
3
|
//#region src/context.d.ts
|
|
4
4
|
|
|
@@ -197,7 +197,7 @@ interface SourceContext<TRequiredOptions = void> {
|
|
|
197
197
|
* during phase 1. Can be a Promise for async operations (e.g.,
|
|
198
198
|
* loading config files).
|
|
199
199
|
*/
|
|
200
|
-
getAnnotations(request?: SourceContextRequest, options?: unknown): Promise<Annotations
|
|
200
|
+
getAnnotations(request?: SourceContextRequest, options?: unknown): Promise<Annotations> | Annotations;
|
|
201
201
|
/**
|
|
202
202
|
* Optional hook to provide additional internal annotations during
|
|
203
203
|
* annotation collection. Called after {@link getAnnotations} with the
|
|
@@ -212,7 +212,7 @@ interface SourceContext<TRequiredOptions = void> {
|
|
|
212
212
|
* @returns Additional annotations to merge, or `undefined`.
|
|
213
213
|
* @since 1.0.0
|
|
214
214
|
*/
|
|
215
|
-
getInternalAnnotations?(request: SourceContextRequest, annotations: Annotations
|
|
215
|
+
getInternalAnnotations?(request: SourceContextRequest, annotations: Annotations): Annotations | undefined;
|
|
216
216
|
/**
|
|
217
217
|
* Optional synchronous cleanup method. Called by `runWith()` and
|
|
218
218
|
* `runWithSync()` after parsing completes. In `runWith()`, this happens
|
|
@@ -232,4 +232,4 @@ interface SourceContext<TRequiredOptions = void> {
|
|
|
232
232
|
[Symbol.asyncDispose]?(): void | PromiseLike<void>;
|
|
233
233
|
}
|
|
234
234
|
//#endregion
|
|
235
|
-
export { type Annotations, ParserValuePlaceholder,
|
|
235
|
+
export { type Annotations, ParserValuePlaceholder, SourceContext, SourceContextPhase, SourceContextPhase1Request, SourceContextPhase2Request, SourceContextRequest };
|
package/dist/facade.cjs
CHANGED
|
@@ -1620,7 +1620,7 @@ function runWithAsync(parser, programName, contexts, options) {
|
|
|
1620
1620
|
* @returns A new parser with annotations in its initial state.
|
|
1621
1621
|
*/
|
|
1622
1622
|
function injectAnnotationsIntoParser(parser, annotations) {
|
|
1623
|
-
const newInitialState = require_annotations.
|
|
1623
|
+
const newInitialState = require_annotations.injectAnnotations(parser.initialState, annotations);
|
|
1624
1624
|
const descriptors = { ...Object.getOwnPropertyDescriptors(parser) };
|
|
1625
1625
|
const initialState = descriptors.initialState;
|
|
1626
1626
|
descriptors.initialState = initialState == null ? {
|
package/dist/facade.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { injectAnnotations, isInjectedAnnotationWrapper, unwrapInjectedAnnotationWrapper } from "./annotations.js";
|
|
2
2
|
import { commandLine, formatMessage, lineBreak, message, optionName, text, value } from "./message.js";
|
|
3
3
|
import { bash, fish, nu, pwsh, zsh } from "./completion.js";
|
|
4
4
|
import { validateCommandNames, validateContextIds, validateMetaNameCollisions, validateOptionNames, validateProgramName } from "./validate.js";
|
|
@@ -1620,7 +1620,7 @@ function runWithAsync(parser, programName, contexts, options) {
|
|
|
1620
1620
|
* @returns A new parser with annotations in its initial state.
|
|
1621
1621
|
*/
|
|
1622
1622
|
function injectAnnotationsIntoParser(parser, annotations) {
|
|
1623
|
-
const newInitialState =
|
|
1623
|
+
const newInitialState = injectAnnotations(parser.initialState, annotations);
|
|
1624
1624
|
const descriptors = { ...Object.getOwnPropertyDescriptors(parser) };
|
|
1625
1625
|
const initialState = descriptors.initialState;
|
|
1626
1626
|
descriptors.initialState = initialState == null ? {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Annotations, ParseOptions,
|
|
1
|
+
import { Annotations, ParseOptions, annotationKey, getAnnotations } from "./annotations.cjs";
|
|
2
2
|
import { NonEmptyString, ensureNonEmptyString, isNonEmptyString } from "./nonempty.cjs";
|
|
3
3
|
import { Message, MessageFormatOptions, MessageTerm, ValueSetOptions, commandLine, envVar, formatMessage, lineBreak, link, message, metavar, optionName, optionNames, text, value, valueSet, values } from "./message.cjs";
|
|
4
4
|
import { HiddenVisibility, OptionName, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, cloneUsage, cloneUsageTerm, extractArgumentMetavars, extractCommandNames, extractLiteralValues, extractOptionNames, formatUsage, formatUsageTerm, isDocHidden, isSuggestionHidden, isUsageHidden, mergeHidden, normalizeUsage } from "./usage.cjs";
|
|
@@ -12,4 +12,4 @@ import { ShellCompletion, bash, fish, nu, pwsh, zsh } from "./completion.cjs";
|
|
|
12
12
|
import { ParserValuePlaceholder, SourceContext, SourceContextRequest } from "./context.cjs";
|
|
13
13
|
import { AnyDependencySource, CombineMode, CombinedDependencyMode, DeferredParseState, DependencyError, DependencyMode, DependencyRegistry, DependencySource, DependencySourceState, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, PendingDependencySourceState, ResolvedDependency, createDeferredParseState, createDependencySourceState, createPendingDependencySourceState, defaultDependencyValueSnapshot, defaultValues, deferredParseMarker, dependency, dependencyId, dependencyIds, dependencySourceMarker, dependencySourceStateMarker, deriveFrom, deriveFromAsync, deriveFromSync, derivedValueParserMarker, formatDependencyError, getDefaultValuesFunction, getDependencyIds, getSnapshottedDefaultDependencyValues, isDeferredParseState, isDependencySource, isDependencySourceState, isDerivedValueParser, isPendingDependencySourceState, isWrappedDependencySource, parseWithDependency, pendingDependencySourceStateMarker, singleDefaultValue, snapshotDefaultDependencyValues, suggestWithDependency, transformsDependencyValue, transformsDependencyValueMarker, wrappedDependencySourceMarker } from "./dependency.cjs";
|
|
14
14
|
import { CommandSubConfig, ContextOptionsParam, ExtractRequiredOptions, OptionSubConfig, RunOptions, RunParserError, RunWithOptions, SubstituteParserValue, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync } from "./facade.cjs";
|
|
15
|
-
export { type Annotations, AnyDependencySource, ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CidrOptions, CidrValue, CombineMode, CombineModes, CombinedDependencyMode, CommandErrorOptions, CommandOptions, CommandSubConfig, ConditionalErrorOptions, ConditionalOptions, ContextOptionsParam, DeferredMap, DeferredParseState, DependencyError, DependencyMode, DependencyRegistry, DependencySource, DependencySourceState, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, DomainOptions, DuplicateOptionError, EmailOptions, ExecutionContext, ExecutionPhase, ExtractRequiredOptions, FlagErrorOptions, FlagOptions, FloatOptions, GroupOptions, HiddenVisibility, HostnameOptions, InferMode, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, IpOptions, Ipv4Options, Ipv6Options, LocaleOptions, LongestMatchErrorOptions, LongestMatchOptions, MacAddressOptions, MergeOptions, type Message, type MessageFormatOptions, type MessageTerm, Mode, ModeIterable, ModeValue, MultipleErrorOptions, MultipleOptions, NoMatchContext, NonEmptyString, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionName, OptionOptions, OptionState, OptionSubConfig, OrErrorOptions, OrOptions, ParseFrame, type ParseOptions, Parser, ParserContext, ParserResult, ParserValuePlaceholder, PassThroughFormat, PassThroughOptions, PendingDependencySourceState, PortOptionsBigInt, PortOptionsNumber, PortRangeOptionsBigInt, PortRangeOptionsNumber, PortRangeValueBigInt, PortRangeValueNumber,
|
|
15
|
+
export { type Annotations, AnyDependencySource, ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CidrOptions, CidrValue, CombineMode, CombineModes, CombinedDependencyMode, CommandErrorOptions, CommandOptions, CommandSubConfig, ConditionalErrorOptions, ConditionalOptions, ContextOptionsParam, DeferredMap, DeferredParseState, DependencyError, DependencyMode, DependencyRegistry, DependencySource, DependencySourceState, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, DomainOptions, DuplicateOptionError, EmailOptions, ExecutionContext, ExecutionPhase, ExtractRequiredOptions, FlagErrorOptions, FlagOptions, FloatOptions, GroupOptions, HiddenVisibility, HostnameOptions, InferMode, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, IpOptions, Ipv4Options, Ipv6Options, LocaleOptions, LongestMatchErrorOptions, LongestMatchOptions, MacAddressOptions, MergeOptions, type Message, type MessageFormatOptions, type MessageTerm, Mode, ModeIterable, ModeValue, MultipleErrorOptions, MultipleOptions, NoMatchContext, NonEmptyString, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionName, OptionOptions, OptionState, OptionSubConfig, OrErrorOptions, OrOptions, ParseFrame, type ParseOptions, Parser, ParserContext, ParserResult, ParserValuePlaceholder, PassThroughFormat, PassThroughOptions, PendingDependencySourceState, PortOptionsBigInt, PortOptionsNumber, PortRangeOptionsBigInt, PortRangeOptionsNumber, PortRangeValueBigInt, PortRangeValueNumber, ResolvedDependency, Result, RunOptions, RunParserError, RunWithOptions, ShellCompletion, ShowChoicesOptions, ShowDefaultOptions, SocketAddressOptions, SocketAddressValue, SourceContext, SourceContextRequest, StringOptions, SubstituteParserValue, Suggestion, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, type ValueSetOptions, WithDefaultError, WithDefaultOptions, annotationKey, annotationWrapperRequiresSourceBindingKey, argument, bash, checkBooleanOption, checkEnumOption, choice, cidr, cloneDocEntry, cloneUsage, cloneUsageTerm, command, commandLine, composeWrappedSourceMetadata, concat, conditional, constant, createDeferredParseState, createDependencySourceState, createParserContext, createPendingDependencySourceState, deduplicateDocEntries, deduplicateDocFragments, defaultDependencyValueSnapshot, defaultValues, deferredParseMarker, defineInheritedAnnotationParser, defineSourceBindingOnlyAnnotationCompletionParser, dependency, dependencyId, dependencyIds, dependencySourceMarker, dependencySourceStateMarker, deriveFrom, deriveFromAsync, deriveFromSync, derivedValueParserMarker, domain, email, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractLiteralValues, extractOptionNames, fail, fish, flag, float, formatDependencyError, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getAnnotations, getDefaultValuesFunction, getDelegatingSuggestRuntimeNodes, getDependencyIds, getDocPage, getDocPageAsync, getDocPageSync, getParserSuggestRuntimeNodes, getSnapshottedDefaultDependencyValues, group, hostname, inheritParentAnnotationsKey, integer, ip, ipv4, ipv6, isDeferredParseState, isDependencySource, isDependencySourceState, isDerivedValueParser, isDocEntryHidden, isDocHidden, isNonEmptyString, isPendingDependencySourceState, isSuggestionHidden, isUsageHidden, isValueParser, isWrappedDependencySource, lineBreak, link, locale, longestMatch, macAddress, map, merge, mergeHidden, message, metavar, multiple, nonEmpty, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, parse, parseAsync, parseSync, parseWithDependency, passThrough, pendingDependencySourceStateMarker, port, portRange, pwsh, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync, singleDefaultValue, snapshotDefaultDependencyValues, socketAddress, string, suggest, suggestAsync, suggestSync, suggestWithDependency, text, transformsDependencyValue, transformsDependencyValueMarker, tuple, unmatchedNonCliDependencySourceStateMarker, url, uuid, value, valueSet, values, withDefault, wrappedDependencySourceMarker, zsh };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Annotations, ParseOptions,
|
|
1
|
+
import { Annotations, ParseOptions, annotationKey, getAnnotations } from "./annotations.js";
|
|
2
2
|
import { NonEmptyString, ensureNonEmptyString, isNonEmptyString } from "./nonempty.js";
|
|
3
3
|
import { Message, MessageFormatOptions, MessageTerm, ValueSetOptions, commandLine, envVar, formatMessage, lineBreak, link, message, metavar, optionName, optionNames, text, value, valueSet, values } from "./message.js";
|
|
4
4
|
import { HiddenVisibility, OptionName, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, cloneUsage, cloneUsageTerm, extractArgumentMetavars, extractCommandNames, extractLiteralValues, extractOptionNames, formatUsage, formatUsageTerm, isDocHidden, isSuggestionHidden, isUsageHidden, mergeHidden, normalizeUsage } from "./usage.js";
|
|
@@ -12,4 +12,4 @@ import { ShellCompletion, bash, fish, nu, pwsh, zsh } from "./completion.js";
|
|
|
12
12
|
import { ParserValuePlaceholder, SourceContext, SourceContextRequest } from "./context.js";
|
|
13
13
|
import { AnyDependencySource, CombineMode, CombinedDependencyMode, DeferredParseState, DependencyError, DependencyMode, DependencyRegistry, DependencySource, DependencySourceState, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, PendingDependencySourceState, ResolvedDependency, createDeferredParseState, createDependencySourceState, createPendingDependencySourceState, defaultDependencyValueSnapshot, defaultValues, deferredParseMarker, dependency, dependencyId, dependencyIds, dependencySourceMarker, dependencySourceStateMarker, deriveFrom, deriveFromAsync, deriveFromSync, derivedValueParserMarker, formatDependencyError, getDefaultValuesFunction, getDependencyIds, getSnapshottedDefaultDependencyValues, isDeferredParseState, isDependencySource, isDependencySourceState, isDerivedValueParser, isPendingDependencySourceState, isWrappedDependencySource, parseWithDependency, pendingDependencySourceStateMarker, singleDefaultValue, snapshotDefaultDependencyValues, suggestWithDependency, transformsDependencyValue, transformsDependencyValueMarker, wrappedDependencySourceMarker } from "./dependency.js";
|
|
14
14
|
import { CommandSubConfig, ContextOptionsParam, ExtractRequiredOptions, OptionSubConfig, RunOptions, RunParserError, RunWithOptions, SubstituteParserValue, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync } from "./facade.js";
|
|
15
|
-
export { type Annotations, AnyDependencySource, ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CidrOptions, CidrValue, CombineMode, CombineModes, CombinedDependencyMode, CommandErrorOptions, CommandOptions, CommandSubConfig, ConditionalErrorOptions, ConditionalOptions, ContextOptionsParam, DeferredMap, DeferredParseState, DependencyError, DependencyMode, DependencyRegistry, DependencySource, DependencySourceState, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, DomainOptions, DuplicateOptionError, EmailOptions, ExecutionContext, ExecutionPhase, ExtractRequiredOptions, FlagErrorOptions, FlagOptions, FloatOptions, GroupOptions, HiddenVisibility, HostnameOptions, InferMode, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, IpOptions, Ipv4Options, Ipv6Options, LocaleOptions, LongestMatchErrorOptions, LongestMatchOptions, MacAddressOptions, MergeOptions, type Message, type MessageFormatOptions, type MessageTerm, Mode, ModeIterable, ModeValue, MultipleErrorOptions, MultipleOptions, NoMatchContext, NonEmptyString, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionName, OptionOptions, OptionState, OptionSubConfig, OrErrorOptions, OrOptions, ParseFrame, type ParseOptions, Parser, ParserContext, ParserResult, ParserValuePlaceholder, PassThroughFormat, PassThroughOptions, PendingDependencySourceState, PortOptionsBigInt, PortOptionsNumber, PortRangeOptionsBigInt, PortRangeOptionsNumber, PortRangeValueBigInt, PortRangeValueNumber,
|
|
15
|
+
export { type Annotations, AnyDependencySource, ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CidrOptions, CidrValue, CombineMode, CombineModes, CombinedDependencyMode, CommandErrorOptions, CommandOptions, CommandSubConfig, ConditionalErrorOptions, ConditionalOptions, ContextOptionsParam, DeferredMap, DeferredParseState, DependencyError, DependencyMode, DependencyRegistry, DependencySource, DependencySourceState, DependencyValue, DependencyValues, DeriveAsyncOptions, DeriveFromAsyncOptions, DeriveFromOptions, DeriveFromSyncOptions, DeriveOptions, DeriveSyncOptions, DerivedValueParser, DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, DocState, DomainOptions, DuplicateOptionError, EmailOptions, ExecutionContext, ExecutionPhase, ExtractRequiredOptions, FlagErrorOptions, FlagOptions, FloatOptions, GroupOptions, HiddenVisibility, HostnameOptions, InferMode, InferValue, IntegerOptionsBigInt, IntegerOptionsNumber, IpOptions, Ipv4Options, Ipv6Options, LocaleOptions, LongestMatchErrorOptions, LongestMatchOptions, MacAddressOptions, MergeOptions, type Message, type MessageFormatOptions, type MessageTerm, Mode, ModeIterable, ModeValue, MultipleErrorOptions, MultipleOptions, NoMatchContext, NonEmptyString, ObjectErrorOptions, ObjectOptions, OptionErrorOptions, OptionName, OptionOptions, OptionState, OptionSubConfig, OrErrorOptions, OrOptions, ParseFrame, type ParseOptions, Parser, ParserContext, ParserResult, ParserValuePlaceholder, PassThroughFormat, PassThroughOptions, PendingDependencySourceState, PortOptionsBigInt, PortOptionsNumber, PortRangeOptionsBigInt, PortRangeOptionsNumber, PortRangeValueBigInt, PortRangeValueNumber, ResolvedDependency, Result, RunOptions, RunParserError, RunWithOptions, ShellCompletion, ShowChoicesOptions, ShowDefaultOptions, SocketAddressOptions, SocketAddressValue, SourceContext, SourceContextRequest, StringOptions, SubstituteParserValue, Suggestion, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, type ValueSetOptions, WithDefaultError, WithDefaultOptions, annotationKey, annotationWrapperRequiresSourceBindingKey, argument, bash, checkBooleanOption, checkEnumOption, choice, cidr, cloneDocEntry, cloneUsage, cloneUsageTerm, command, commandLine, composeWrappedSourceMetadata, concat, conditional, constant, createDeferredParseState, createDependencySourceState, createParserContext, createPendingDependencySourceState, deduplicateDocEntries, deduplicateDocFragments, defaultDependencyValueSnapshot, defaultValues, deferredParseMarker, defineInheritedAnnotationParser, defineSourceBindingOnlyAnnotationCompletionParser, dependency, dependencyId, dependencyIds, dependencySourceMarker, dependencySourceStateMarker, deriveFrom, deriveFromAsync, deriveFromSync, derivedValueParserMarker, domain, email, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractLiteralValues, extractOptionNames, fail, fish, flag, float, formatDependencyError, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getAnnotations, getDefaultValuesFunction, getDelegatingSuggestRuntimeNodes, getDependencyIds, getDocPage, getDocPageAsync, getDocPageSync, getParserSuggestRuntimeNodes, getSnapshottedDefaultDependencyValues, group, hostname, inheritParentAnnotationsKey, integer, ip, ipv4, ipv6, isDeferredParseState, isDependencySource, isDependencySourceState, isDerivedValueParser, isDocEntryHidden, isDocHidden, isNonEmptyString, isPendingDependencySourceState, isSuggestionHidden, isUsageHidden, isValueParser, isWrappedDependencySource, lineBreak, link, locale, longestMatch, macAddress, map, merge, mergeHidden, message, metavar, multiple, nonEmpty, normalizeUsage, nu, object, option, optionName, optionNames, optional, or, parse, parseAsync, parseSync, parseWithDependency, passThrough, pendingDependencySourceStateMarker, port, portRange, pwsh, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync, singleDefaultValue, snapshotDefaultDependencyValues, socketAddress, string, suggest, suggestAsync, suggestSync, suggestWithDependency, text, transformsDependencyValue, transformsDependencyValueMarker, tuple, unmatchedNonCliDependencySourceStateMarker, url, uuid, value, valueSet, values, withDefault, wrappedDependencySourceMarker, zsh };
|
package/dist/parser.cjs
CHANGED
|
@@ -69,7 +69,7 @@ function createParserContext(frame, exec) {
|
|
|
69
69
|
function injectAnnotationsIntoState(state, options) {
|
|
70
70
|
const annotations = options?.annotations;
|
|
71
71
|
if (!require_annotations.hasMeaningfulAnnotations(annotations)) return state;
|
|
72
|
-
return require_annotations.
|
|
72
|
+
return require_annotations.injectAnnotations(state, annotations);
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* Parses an array of command-line arguments using the provided combined parser.
|
package/dist/parser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hasMeaningfulAnnotations,
|
|
1
|
+
import { hasMeaningfulAnnotations, injectAnnotations, isInjectedAnnotationWrapper, unwrapInjectedAnnotationWrapper } from "./annotations.js";
|
|
2
2
|
import { cloneMessage, message } from "./message.js";
|
|
3
3
|
import { cloneUsage, normalizeUsage } from "./usage.js";
|
|
4
4
|
import { cloneDocEntry, isDocEntryHidden } from "./doc.js";
|
|
@@ -69,7 +69,7 @@ function createParserContext(frame, exec) {
|
|
|
69
69
|
function injectAnnotationsIntoState(state, options) {
|
|
70
70
|
const annotations = options?.annotations;
|
|
71
71
|
if (!hasMeaningfulAnnotations(annotations)) return state;
|
|
72
|
-
return
|
|
72
|
+
return injectAnnotations(state, annotations);
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* Parses an array of command-line arguments using the provided combined parser.
|