@optique/core 1.0.0-dev.1452 → 1.0.0-dev.1458

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/doc.cjs CHANGED
@@ -2,6 +2,20 @@ const require_message = require('./message.cjs');
2
2
  const require_usage = require('./usage.cjs');
3
3
 
4
4
  //#region src/doc.ts
5
+ /**
6
+ * Returns whether a doc entry's term is hidden from documentation.
7
+ * Only term types with a `hidden` field (argument, option, command,
8
+ * passthrough) are checked; other types always return `false`.
9
+ *
10
+ * @param entry The doc entry to check.
11
+ * @returns `true` if the entry should be hidden from documentation.
12
+ * @since 1.0.0
13
+ */
14
+ function isDocEntryHidden(entry) {
15
+ const term = entry.term;
16
+ if (term.type === "argument" || term.type === "option" || term.type === "command" || term.type === "passthrough") return require_usage.isDocHidden(term.hidden);
17
+ return false;
18
+ }
5
19
  function getDocEntryKey(entry) {
6
20
  const term = entry.term;
7
21
  switch (term.type) {
@@ -13,21 +27,25 @@ function getDocEntryKey(entry) {
13
27
  }
14
28
  /**
15
29
  * Removes duplicate {@link DocEntry} values that share the same surface
16
- * syntax (same term type and identifying names). When duplicates exist,
17
- * the first occurrence is kept and later ones are discarded.
30
+ * syntax (same term type and identifying names). Doc-hidden entries are
31
+ * filtered out first so they cannot influence the ordering of visible
32
+ * entries. Among the remaining visible entries, the first occurrence is
33
+ * kept and later duplicates are discarded.
18
34
  *
19
35
  * Positional argument entries are never deduplicated because they are
20
36
  * distinguished by position, not by metavar, and {@link DocEntry} does
21
37
  * not carry position information.
22
38
  *
23
39
  * @param entries The entries to deduplicate.
24
- * @returns A new array with duplicates removed, preserving insertion order.
40
+ * @returns A new array with hidden entries removed and duplicates
41
+ * collapsed, preserving insertion order of visible entries.
25
42
  * @since 1.0.0
26
43
  */
27
44
  function deduplicateDocEntries(entries) {
28
45
  const seen = /* @__PURE__ */ new Set();
29
46
  const result = [];
30
47
  for (const entry of entries) {
48
+ if (isDocEntryHidden(entry)) continue;
31
49
  if (entry.term.type === "argument") {
32
50
  result.push(entry);
33
51
  continue;
@@ -52,18 +70,22 @@ function deduplicateDocEntries(entries) {
52
70
  function deduplicateDocFragments(fragments) {
53
71
  const untitledSeen = /* @__PURE__ */ new Set();
54
72
  const titledSectionMap = /* @__PURE__ */ new Map();
73
+ const titledSectionPositioned = /* @__PURE__ */ new Set();
55
74
  const slots = [];
56
- for (const fragment of fragments) if (fragment.type === "entry") if (fragment.term.type === "argument") slots.push(fragment);
57
- else {
58
- const key = getDocEntryKey(fragment);
59
- if (!untitledSeen.has(key)) {
60
- untitledSeen.add(key);
61
- slots.push(fragment);
75
+ for (const fragment of fragments) if (fragment.type === "entry") {
76
+ if (isDocEntryHidden(fragment)) continue;
77
+ if (fragment.term.type === "argument") slots.push(fragment);
78
+ else {
79
+ const key = getDocEntryKey(fragment);
80
+ if (!untitledSeen.has(key)) {
81
+ untitledSeen.add(key);
82
+ slots.push(fragment);
83
+ }
62
84
  }
63
- }
64
- else if (fragment.title == null) {
85
+ } else if (fragment.title == null) {
65
86
  const dedupedEntries = [];
66
87
  for (const entry of fragment.entries) {
88
+ if (isDocEntryHidden(entry)) continue;
67
89
  if (entry.term.type === "argument") {
68
90
  dedupedEntries.push(entry);
69
91
  continue;
@@ -80,8 +102,9 @@ function deduplicateDocFragments(fragments) {
80
102
  entries: dedupedEntries
81
103
  });
82
104
  } else {
83
- if (!titledSectionMap.has(fragment.title)) {
84
- titledSectionMap.set(fragment.title, []);
105
+ if (!titledSectionMap.has(fragment.title)) titledSectionMap.set(fragment.title, []);
106
+ if (!titledSectionPositioned.has(fragment.title) && fragment.entries.some((e) => !isDocEntryHidden(e))) {
107
+ titledSectionPositioned.add(fragment.title);
85
108
  slots.push(fragment.title);
86
109
  }
87
110
  titledSectionMap.get(fragment.title).push(...fragment.entries);
@@ -442,4 +465,5 @@ function lastLineVisibleLength(text$1) {
442
465
  exports.cloneDocEntry = cloneDocEntry;
443
466
  exports.deduplicateDocEntries = deduplicateDocEntries;
444
467
  exports.deduplicateDocFragments = deduplicateDocFragments;
445
- exports.formatDocPage = formatDocPage;
468
+ exports.formatDocPage = formatDocPage;
469
+ exports.isDocEntryHidden = isDocEntryHidden;
package/dist/doc.d.cts CHANGED
@@ -103,17 +103,30 @@ interface DocFragments {
103
103
  */
104
104
  readonly footer?: Message;
105
105
  }
106
+ /**
107
+ * Returns whether a doc entry's term is hidden from documentation.
108
+ * Only term types with a `hidden` field (argument, option, command,
109
+ * passthrough) are checked; other types always return `false`.
110
+ *
111
+ * @param entry The doc entry to check.
112
+ * @returns `true` if the entry should be hidden from documentation.
113
+ * @since 1.0.0
114
+ */
115
+ declare function isDocEntryHidden(entry: DocEntry): boolean;
106
116
  /**
107
117
  * Removes duplicate {@link DocEntry} values that share the same surface
108
- * syntax (same term type and identifying names). When duplicates exist,
109
- * the first occurrence is kept and later ones are discarded.
118
+ * syntax (same term type and identifying names). Doc-hidden entries are
119
+ * filtered out first so they cannot influence the ordering of visible
120
+ * entries. Among the remaining visible entries, the first occurrence is
121
+ * kept and later duplicates are discarded.
110
122
  *
111
123
  * Positional argument entries are never deduplicated because they are
112
124
  * distinguished by position, not by metavar, and {@link DocEntry} does
113
125
  * not carry position information.
114
126
  *
115
127
  * @param entries The entries to deduplicate.
116
- * @returns A new array with duplicates removed, preserving insertion order.
128
+ * @returns A new array with hidden entries removed and duplicates
129
+ * collapsed, preserving insertion order of visible entries.
117
130
  * @since 1.0.0
118
131
  */
119
132
  declare function deduplicateDocEntries(entries: readonly DocEntry[]): DocEntry[];
@@ -325,4 +338,4 @@ interface DocPageFormatOptions {
325
338
  */
326
339
  declare function formatDocPage(programName: string, page: DocPage, options?: DocPageFormatOptions): string;
327
340
  //#endregion
328
- export { DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, ShowChoicesOptions, ShowDefaultOptions, cloneDocEntry, deduplicateDocEntries, deduplicateDocFragments, formatDocPage };
341
+ export { DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, ShowChoicesOptions, ShowDefaultOptions, cloneDocEntry, deduplicateDocEntries, deduplicateDocFragments, formatDocPage, isDocEntryHidden };
package/dist/doc.d.ts CHANGED
@@ -103,17 +103,30 @@ interface DocFragments {
103
103
  */
104
104
  readonly footer?: Message;
105
105
  }
106
+ /**
107
+ * Returns whether a doc entry's term is hidden from documentation.
108
+ * Only term types with a `hidden` field (argument, option, command,
109
+ * passthrough) are checked; other types always return `false`.
110
+ *
111
+ * @param entry The doc entry to check.
112
+ * @returns `true` if the entry should be hidden from documentation.
113
+ * @since 1.0.0
114
+ */
115
+ declare function isDocEntryHidden(entry: DocEntry): boolean;
106
116
  /**
107
117
  * Removes duplicate {@link DocEntry} values that share the same surface
108
- * syntax (same term type and identifying names). When duplicates exist,
109
- * the first occurrence is kept and later ones are discarded.
118
+ * syntax (same term type and identifying names). Doc-hidden entries are
119
+ * filtered out first so they cannot influence the ordering of visible
120
+ * entries. Among the remaining visible entries, the first occurrence is
121
+ * kept and later duplicates are discarded.
110
122
  *
111
123
  * Positional argument entries are never deduplicated because they are
112
124
  * distinguished by position, not by metavar, and {@link DocEntry} does
113
125
  * not carry position information.
114
126
  *
115
127
  * @param entries The entries to deduplicate.
116
- * @returns A new array with duplicates removed, preserving insertion order.
128
+ * @returns A new array with hidden entries removed and duplicates
129
+ * collapsed, preserving insertion order of visible entries.
117
130
  * @since 1.0.0
118
131
  */
119
132
  declare function deduplicateDocEntries(entries: readonly DocEntry[]): DocEntry[];
@@ -325,4 +338,4 @@ interface DocPageFormatOptions {
325
338
  */
326
339
  declare function formatDocPage(programName: string, page: DocPage, options?: DocPageFormatOptions): string;
327
340
  //#endregion
328
- export { DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, ShowChoicesOptions, ShowDefaultOptions, cloneDocEntry, deduplicateDocEntries, deduplicateDocFragments, formatDocPage };
341
+ export { DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, ShowChoicesOptions, ShowDefaultOptions, cloneDocEntry, deduplicateDocEntries, deduplicateDocFragments, formatDocPage, isDocEntryHidden };
package/dist/doc.js CHANGED
@@ -1,7 +1,21 @@
1
1
  import { cloneMessage, formatMessage, text } from "./message.js";
2
- import { cloneUsageTerm, formatUsage, formatUsageTerm } from "./usage.js";
2
+ import { cloneUsageTerm, formatUsage, formatUsageTerm, isDocHidden } from "./usage.js";
3
3
 
4
4
  //#region src/doc.ts
5
+ /**
6
+ * Returns whether a doc entry's term is hidden from documentation.
7
+ * Only term types with a `hidden` field (argument, option, command,
8
+ * passthrough) are checked; other types always return `false`.
9
+ *
10
+ * @param entry The doc entry to check.
11
+ * @returns `true` if the entry should be hidden from documentation.
12
+ * @since 1.0.0
13
+ */
14
+ function isDocEntryHidden(entry) {
15
+ const term = entry.term;
16
+ if (term.type === "argument" || term.type === "option" || term.type === "command" || term.type === "passthrough") return isDocHidden(term.hidden);
17
+ return false;
18
+ }
5
19
  function getDocEntryKey(entry) {
6
20
  const term = entry.term;
7
21
  switch (term.type) {
@@ -13,21 +27,25 @@ function getDocEntryKey(entry) {
13
27
  }
14
28
  /**
15
29
  * Removes duplicate {@link DocEntry} values that share the same surface
16
- * syntax (same term type and identifying names). When duplicates exist,
17
- * the first occurrence is kept and later ones are discarded.
30
+ * syntax (same term type and identifying names). Doc-hidden entries are
31
+ * filtered out first so they cannot influence the ordering of visible
32
+ * entries. Among the remaining visible entries, the first occurrence is
33
+ * kept and later duplicates are discarded.
18
34
  *
19
35
  * Positional argument entries are never deduplicated because they are
20
36
  * distinguished by position, not by metavar, and {@link DocEntry} does
21
37
  * not carry position information.
22
38
  *
23
39
  * @param entries The entries to deduplicate.
24
- * @returns A new array with duplicates removed, preserving insertion order.
40
+ * @returns A new array with hidden entries removed and duplicates
41
+ * collapsed, preserving insertion order of visible entries.
25
42
  * @since 1.0.0
26
43
  */
27
44
  function deduplicateDocEntries(entries) {
28
45
  const seen = /* @__PURE__ */ new Set();
29
46
  const result = [];
30
47
  for (const entry of entries) {
48
+ if (isDocEntryHidden(entry)) continue;
31
49
  if (entry.term.type === "argument") {
32
50
  result.push(entry);
33
51
  continue;
@@ -52,18 +70,22 @@ function deduplicateDocEntries(entries) {
52
70
  function deduplicateDocFragments(fragments) {
53
71
  const untitledSeen = /* @__PURE__ */ new Set();
54
72
  const titledSectionMap = /* @__PURE__ */ new Map();
73
+ const titledSectionPositioned = /* @__PURE__ */ new Set();
55
74
  const slots = [];
56
- for (const fragment of fragments) if (fragment.type === "entry") if (fragment.term.type === "argument") slots.push(fragment);
57
- else {
58
- const key = getDocEntryKey(fragment);
59
- if (!untitledSeen.has(key)) {
60
- untitledSeen.add(key);
61
- slots.push(fragment);
75
+ for (const fragment of fragments) if (fragment.type === "entry") {
76
+ if (isDocEntryHidden(fragment)) continue;
77
+ if (fragment.term.type === "argument") slots.push(fragment);
78
+ else {
79
+ const key = getDocEntryKey(fragment);
80
+ if (!untitledSeen.has(key)) {
81
+ untitledSeen.add(key);
82
+ slots.push(fragment);
83
+ }
62
84
  }
63
- }
64
- else if (fragment.title == null) {
85
+ } else if (fragment.title == null) {
65
86
  const dedupedEntries = [];
66
87
  for (const entry of fragment.entries) {
88
+ if (isDocEntryHidden(entry)) continue;
67
89
  if (entry.term.type === "argument") {
68
90
  dedupedEntries.push(entry);
69
91
  continue;
@@ -80,8 +102,9 @@ function deduplicateDocFragments(fragments) {
80
102
  entries: dedupedEntries
81
103
  });
82
104
  } else {
83
- if (!titledSectionMap.has(fragment.title)) {
84
- titledSectionMap.set(fragment.title, []);
105
+ if (!titledSectionMap.has(fragment.title)) titledSectionMap.set(fragment.title, []);
106
+ if (!titledSectionPositioned.has(fragment.title) && fragment.entries.some((e) => !isDocEntryHidden(e))) {
107
+ titledSectionPositioned.add(fragment.title);
85
108
  slots.push(fragment.title);
86
109
  }
87
110
  titledSectionMap.get(fragment.title).push(...fragment.entries);
@@ -439,4 +462,4 @@ function lastLineVisibleLength(text$1) {
439
462
  }
440
463
 
441
464
  //#endregion
442
- export { cloneDocEntry, deduplicateDocEntries, deduplicateDocFragments, formatDocPage };
465
+ export { cloneDocEntry, deduplicateDocEntries, deduplicateDocFragments, formatDocPage, isDocEntryHidden };
package/dist/index.cjs CHANGED
@@ -79,6 +79,7 @@ exports.isDeferredParseState = require_dependency.isDeferredParseState;
79
79
  exports.isDependencySource = require_dependency.isDependencySource;
80
80
  exports.isDependencySourceState = require_dependency.isDependencySourceState;
81
81
  exports.isDerivedValueParser = require_dependency.isDerivedValueParser;
82
+ exports.isDocEntryHidden = require_doc.isDocEntryHidden;
82
83
  exports.isDocHidden = require_usage.isDocHidden;
83
84
  exports.isNonEmptyString = require_nonempty.isNonEmptyString;
84
85
  exports.isPendingDependencySourceState = require_dependency.isPendingDependencySourceState;
package/dist/index.d.cts CHANGED
@@ -2,7 +2,7 @@ import { Annotations, ParseOptions, annotationKey, getAnnotations } from "./anno
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, extractOptionNames, formatUsage, formatUsageTerm, isDocHidden, isSuggestionHidden, isUsageHidden, mergeHidden, normalizeUsage } from "./usage.cjs";
5
- import { DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, ShowChoicesOptions, ShowDefaultOptions, cloneDocEntry, deduplicateDocEntries, deduplicateDocFragments, formatDocPage } from "./doc.cjs";
5
+ import { DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, ShowChoicesOptions, ShowDefaultOptions, cloneDocEntry, deduplicateDocEntries, deduplicateDocFragments, formatDocPage, isDocEntryHidden } from "./doc.cjs";
6
6
  import { ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CidrOptions, CidrValue, DomainOptions, EmailOptions, FloatOptions, HostnameOptions, IntegerOptionsBigInt, IntegerOptionsNumber, IpOptions, Ipv4Options, Ipv6Options, LocaleOptions, MacAddressOptions, PortOptionsBigInt, PortOptionsNumber, PortRangeOptionsBigInt, PortRangeOptionsNumber, PortRangeValueBigInt, PortRangeValueNumber, SocketAddressOptions, SocketAddressValue, StringOptions, UrlOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, checkBooleanOption, checkEnumOption, choice, cidr, domain, email, float, hostname, integer, ip, ipv4, ipv6, isValueParser, locale, macAddress, port, portRange, socketAddress, string, url, uuid } from "./valueparser.cjs";
7
7
  import { ConditionalErrorOptions, ConditionalOptions, DuplicateOptionError, GroupOptions, LongestMatchErrorOptions, LongestMatchOptions, MergeOptions, NoMatchContext, ObjectErrorOptions, ObjectOptions, OrErrorOptions, OrOptions, TupleOptions, concat, conditional, group, longestMatch, merge, object, or, tuple } from "./constructs.cjs";
8
8
  import { MultipleErrorOptions, MultipleOptions, WithDefaultError, WithDefaultOptions, map, multiple, nonEmpty, optional, withDefault } from "./modifiers.cjs";
@@ -12,4 +12,4 @@ import { CombineModes, DocState, InferMode, InferValue, Mode, ModeIterable, Mode
12
12
  import { ShellCompletion, bash, fish, nu, pwsh, zsh } from "./completion.cjs";
13
13
  import { ParserValuePlaceholder, SourceContext } from "./context.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, 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, 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, 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, StringOptions, SubstituteParserValue, Suggestion, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, type ValueSetOptions, WithDefaultError, WithDefaultOptions, annotationKey, argument, bash, checkBooleanOption, checkEnumOption, choice, cidr, cloneDocEntry, cloneUsage, cloneUsageTerm, command, commandLine, concat, conditional, constant, createDeferredParseState, createDependencySourceState, createPendingDependencySourceState, deduplicateDocEntries, deduplicateDocFragments, defaultValues, deferredParseMarker, dependency, dependencyId, dependencyIds, dependencySourceMarker, dependencySourceStateMarker, deriveFrom, deriveFromAsync, deriveFromSync, derivedValueParserMarker, domain, email, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractOptionNames, fail, fish, flag, float, formatDependencyError, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getAnnotations, getDefaultValuesFunction, getDependencyIds, getDocPage, getDocPageAsync, getDocPageSync, group, hostname, integer, ip, ipv4, ipv6, isDeferredParseState, isDependencySource, isDependencySourceState, isDerivedValueParser, 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, socketAddress, string, suggest, suggestAsync, suggestSync, suggestWithDependency, text, transformsDependencyValue, transformsDependencyValueMarker, tuple, url, uuid, value, valueSet, values, withDefault, wrappedDependencySourceMarker, zsh };
15
+ export { type Annotations, AnyDependencySource, ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CidrOptions, CidrValue, CombineMode, CombineModes, CombinedDependencyMode, CommandErrorOptions, CommandOptions, CommandSubConfig, ConditionalErrorOptions, ConditionalOptions, ContextOptionsParam, 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, 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, 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, StringOptions, SubstituteParserValue, Suggestion, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, type ValueSetOptions, WithDefaultError, WithDefaultOptions, annotationKey, argument, bash, checkBooleanOption, checkEnumOption, choice, cidr, cloneDocEntry, cloneUsage, cloneUsageTerm, command, commandLine, concat, conditional, constant, createDeferredParseState, createDependencySourceState, createPendingDependencySourceState, deduplicateDocEntries, deduplicateDocFragments, defaultValues, deferredParseMarker, dependency, dependencyId, dependencyIds, dependencySourceMarker, dependencySourceStateMarker, deriveFrom, deriveFromAsync, deriveFromSync, derivedValueParserMarker, domain, email, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractOptionNames, fail, fish, flag, float, formatDependencyError, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getAnnotations, getDefaultValuesFunction, getDependencyIds, getDocPage, getDocPageAsync, getDocPageSync, group, hostname, 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, socketAddress, string, suggest, suggestAsync, suggestSync, suggestWithDependency, text, transformsDependencyValue, transformsDependencyValueMarker, tuple, url, uuid, value, valueSet, values, withDefault, wrappedDependencySourceMarker, zsh };
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Annotations, ParseOptions, annotationKey, getAnnotations } from "./anno
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, extractOptionNames, formatUsage, formatUsageTerm, isDocHidden, isSuggestionHidden, isUsageHidden, mergeHidden, normalizeUsage } from "./usage.js";
5
- import { DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, ShowChoicesOptions, ShowDefaultOptions, cloneDocEntry, deduplicateDocEntries, deduplicateDocFragments, formatDocPage } from "./doc.js";
5
+ import { DocEntry, DocFragment, DocFragments, DocPage, DocPageFormatOptions, DocSection, ShowChoicesOptions, ShowDefaultOptions, cloneDocEntry, deduplicateDocEntries, deduplicateDocFragments, formatDocPage, isDocEntryHidden } from "./doc.js";
6
6
  import { ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CidrOptions, CidrValue, DomainOptions, EmailOptions, FloatOptions, HostnameOptions, IntegerOptionsBigInt, IntegerOptionsNumber, IpOptions, Ipv4Options, Ipv6Options, LocaleOptions, MacAddressOptions, PortOptionsBigInt, PortOptionsNumber, PortRangeOptionsBigInt, PortRangeOptionsNumber, PortRangeValueBigInt, PortRangeValueNumber, SocketAddressOptions, SocketAddressValue, StringOptions, UrlOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, checkBooleanOption, checkEnumOption, choice, cidr, domain, email, float, hostname, integer, ip, ipv4, ipv6, isValueParser, locale, macAddress, port, portRange, socketAddress, string, url, uuid } from "./valueparser.js";
7
7
  import { ConditionalErrorOptions, ConditionalOptions, DuplicateOptionError, GroupOptions, LongestMatchErrorOptions, LongestMatchOptions, MergeOptions, NoMatchContext, ObjectErrorOptions, ObjectOptions, OrErrorOptions, OrOptions, TupleOptions, concat, conditional, group, longestMatch, merge, object, or, tuple } from "./constructs.js";
8
8
  import { MultipleErrorOptions, MultipleOptions, WithDefaultError, WithDefaultOptions, map, multiple, nonEmpty, optional, withDefault } from "./modifiers.js";
@@ -12,4 +12,4 @@ import { CombineModes, DocState, InferMode, InferValue, Mode, ModeIterable, Mode
12
12
  import { ShellCompletion, bash, fish, nu, pwsh, zsh } from "./completion.js";
13
13
  import { ParserValuePlaceholder, SourceContext } from "./context.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, 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, 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, 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, StringOptions, SubstituteParserValue, Suggestion, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, type ValueSetOptions, WithDefaultError, WithDefaultOptions, annotationKey, argument, bash, checkBooleanOption, checkEnumOption, choice, cidr, cloneDocEntry, cloneUsage, cloneUsageTerm, command, commandLine, concat, conditional, constant, createDeferredParseState, createDependencySourceState, createPendingDependencySourceState, deduplicateDocEntries, deduplicateDocFragments, defaultValues, deferredParseMarker, dependency, dependencyId, dependencyIds, dependencySourceMarker, dependencySourceStateMarker, deriveFrom, deriveFromAsync, deriveFromSync, derivedValueParserMarker, domain, email, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractOptionNames, fail, fish, flag, float, formatDependencyError, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getAnnotations, getDefaultValuesFunction, getDependencyIds, getDocPage, getDocPageAsync, getDocPageSync, group, hostname, integer, ip, ipv4, ipv6, isDeferredParseState, isDependencySource, isDependencySourceState, isDerivedValueParser, 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, socketAddress, string, suggest, suggestAsync, suggestSync, suggestWithDependency, text, transformsDependencyValue, transformsDependencyValueMarker, tuple, url, uuid, value, valueSet, values, withDefault, wrappedDependencySourceMarker, zsh };
15
+ export { type Annotations, AnyDependencySource, ArgumentErrorOptions, ArgumentOptions, ChoiceOptions, ChoiceOptionsBase, ChoiceOptionsNumber, ChoiceOptionsString, CidrOptions, CidrValue, CombineMode, CombineModes, CombinedDependencyMode, CommandErrorOptions, CommandOptions, CommandSubConfig, ConditionalErrorOptions, ConditionalOptions, ContextOptionsParam, 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, 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, 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, StringOptions, SubstituteParserValue, Suggestion, TupleOptions, UrlOptions, Usage, UsageFormatOptions, UsageTerm, UsageTermFormatOptions, Uuid, UuidOptions, ValueParser, ValueParserResult, type ValueSetOptions, WithDefaultError, WithDefaultOptions, annotationKey, argument, bash, checkBooleanOption, checkEnumOption, choice, cidr, cloneDocEntry, cloneUsage, cloneUsageTerm, command, commandLine, concat, conditional, constant, createDeferredParseState, createDependencySourceState, createPendingDependencySourceState, deduplicateDocEntries, deduplicateDocFragments, defaultValues, deferredParseMarker, dependency, dependencyId, dependencyIds, dependencySourceMarker, dependencySourceStateMarker, deriveFrom, deriveFromAsync, deriveFromSync, derivedValueParserMarker, domain, email, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractOptionNames, fail, fish, flag, float, formatDependencyError, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getAnnotations, getDefaultValuesFunction, getDependencyIds, getDocPage, getDocPageAsync, getDocPageSync, group, hostname, 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, socketAddress, string, suggest, suggestAsync, suggestSync, suggestWithDependency, text, transformsDependencyValue, transformsDependencyValueMarker, tuple, url, uuid, value, valueSet, values, withDefault, wrappedDependencySourceMarker, zsh };
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { commandLine, envVar, formatMessage, lineBreak, link, message, metavar,
3
3
  import { bash, fish, nu, pwsh, zsh } from "./completion.js";
4
4
  import { DependencyRegistry, createDeferredParseState, createDependencySourceState, createPendingDependencySourceState, defaultValues, deferredParseMarker, dependency, dependencyId, dependencyIds, dependencySourceMarker, dependencySourceStateMarker, deriveFrom, deriveFromAsync, deriveFromSync, derivedValueParserMarker, formatDependencyError, getDefaultValuesFunction, getDependencyIds, isDeferredParseState, isDependencySource, isDependencySourceState, isDerivedValueParser, isPendingDependencySourceState, isWrappedDependencySource, parseWithDependency, pendingDependencySourceStateMarker, suggestWithDependency, transformsDependencyValue, transformsDependencyValueMarker, wrappedDependencySourceMarker } from "./dependency.js";
5
5
  import { cloneUsage, cloneUsageTerm, extractArgumentMetavars, extractCommandNames, extractOptionNames, formatUsage, formatUsageTerm, isDocHidden, isSuggestionHidden, isUsageHidden, mergeHidden, normalizeUsage } from "./usage.js";
6
- import { cloneDocEntry, deduplicateDocEntries, deduplicateDocFragments, formatDocPage } from "./doc.js";
6
+ import { cloneDocEntry, deduplicateDocEntries, deduplicateDocFragments, formatDocPage, isDocEntryHidden } from "./doc.js";
7
7
  import { DuplicateOptionError, concat, conditional, group, longestMatch, merge, object, or, tuple } from "./constructs.js";
8
8
  import { WithDefaultError, map, multiple, nonEmpty, optional, withDefault } from "./modifiers.js";
9
9
  import { ensureNonEmptyString, isNonEmptyString } from "./nonempty.js";
@@ -12,4 +12,4 @@ import { argument, command, constant, fail, flag, option, passThrough } from "./
12
12
  import { getDocPage, getDocPageAsync, getDocPageSync, parse, parseAsync, parseSync, suggest, suggestAsync, suggestSync } from "./parser.js";
13
13
  import { RunParserError, runParser, runParserAsync, runParserSync, runWith, runWithAsync, runWithSync } from "./facade.js";
14
14
 
15
- export { DependencyRegistry, DuplicateOptionError, RunParserError, WithDefaultError, annotationKey, argument, bash, checkBooleanOption, checkEnumOption, choice, cidr, cloneDocEntry, cloneUsage, cloneUsageTerm, command, commandLine, concat, conditional, constant, createDeferredParseState, createDependencySourceState, createPendingDependencySourceState, deduplicateDocEntries, deduplicateDocFragments, defaultValues, deferredParseMarker, dependency, dependencyId, dependencyIds, dependencySourceMarker, dependencySourceStateMarker, deriveFrom, deriveFromAsync, deriveFromSync, derivedValueParserMarker, domain, email, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractOptionNames, fail, fish, flag, float, formatDependencyError, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getAnnotations, getDefaultValuesFunction, getDependencyIds, getDocPage, getDocPageAsync, getDocPageSync, group, hostname, integer, ip, ipv4, ipv6, isDeferredParseState, isDependencySource, isDependencySourceState, isDerivedValueParser, 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, socketAddress, string, suggest, suggestAsync, suggestSync, suggestWithDependency, text, transformsDependencyValue, transformsDependencyValueMarker, tuple, url, uuid, value, valueSet, values, withDefault, wrappedDependencySourceMarker, zsh };
15
+ export { DependencyRegistry, DuplicateOptionError, RunParserError, WithDefaultError, annotationKey, argument, bash, checkBooleanOption, checkEnumOption, choice, cidr, cloneDocEntry, cloneUsage, cloneUsageTerm, command, commandLine, concat, conditional, constant, createDeferredParseState, createDependencySourceState, createPendingDependencySourceState, deduplicateDocEntries, deduplicateDocFragments, defaultValues, deferredParseMarker, dependency, dependencyId, dependencyIds, dependencySourceMarker, dependencySourceStateMarker, deriveFrom, deriveFromAsync, deriveFromSync, derivedValueParserMarker, domain, email, ensureNonEmptyString, envVar, extractArgumentMetavars, extractCommandNames, extractOptionNames, fail, fish, flag, float, formatDependencyError, formatDocPage, formatMessage, formatUsage, formatUsageTerm, getAnnotations, getDefaultValuesFunction, getDependencyIds, getDocPage, getDocPageAsync, getDocPageSync, group, hostname, 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, socketAddress, string, suggest, suggestAsync, suggestSync, suggestWithDependency, text, transformsDependencyValue, transformsDependencyValueMarker, tuple, url, uuid, value, valueSet, values, withDefault, wrappedDependencySourceMarker, zsh };
package/dist/parser.cjs CHANGED
@@ -385,28 +385,33 @@ function buildDocPage(parser, context, args) {
385
385
  let untitledSection = null;
386
386
  const titledSectionMap = /* @__PURE__ */ new Map();
387
387
  for (const fragment of fragments) if (fragment.type === "entry") {
388
+ if (require_doc.isDocEntryHidden(fragment)) continue;
388
389
  if (untitledSection == null) {
389
390
  untitledSection = { entries: [] };
390
391
  buildingSections.push(untitledSection);
391
392
  }
392
393
  untitledSection.entries.push(require_doc.cloneDocEntry(fragment));
393
- } else if (fragment.type === "section") if (fragment.title == null) {
394
- if (untitledSection == null) {
395
- untitledSection = { entries: [] };
396
- buildingSections.push(untitledSection);
397
- }
398
- untitledSection.entries.push(...fragment.entries.map(require_doc.cloneDocEntry));
399
- } else {
400
- let section = titledSectionMap.get(fragment.title);
401
- if (section == null) {
402
- section = {
403
- title: fragment.title,
404
- entries: []
405
- };
406
- titledSectionMap.set(fragment.title, section);
407
- buildingSections.push(section);
394
+ } else if (fragment.type === "section") {
395
+ const visible = fragment.entries.filter((e) => !require_doc.isDocEntryHidden(e));
396
+ if (visible.length === 0) continue;
397
+ if (fragment.title == null) {
398
+ if (untitledSection == null) {
399
+ untitledSection = { entries: [] };
400
+ buildingSections.push(untitledSection);
401
+ }
402
+ untitledSection.entries.push(...visible.map(require_doc.cloneDocEntry));
403
+ } else {
404
+ let section = titledSectionMap.get(fragment.title);
405
+ if (section == null) {
406
+ section = {
407
+ title: fragment.title,
408
+ entries: []
409
+ };
410
+ titledSectionMap.set(fragment.title, section);
411
+ buildingSections.push(section);
412
+ }
413
+ section.entries.push(...visible.map(require_doc.cloneDocEntry));
408
414
  }
409
- section.entries.push(...fragment.entries.map(require_doc.cloneDocEntry));
410
415
  }
411
416
  const sections = buildingSections;
412
417
  const usage = require_usage.cloneUsage(require_usage.normalizeUsage(parser.usage));
package/dist/parser.js CHANGED
@@ -2,7 +2,7 @@ import { injectAnnotations, isInjectedAnnotationWrapper, unwrapInjectedAnnotatio
2
2
  import { cloneMessage, message } from "./message.js";
3
3
  import { dispatchByMode } from "./mode-dispatch.js";
4
4
  import { cloneUsage, normalizeUsage } from "./usage.js";
5
- import { cloneDocEntry } from "./doc.js";
5
+ import { cloneDocEntry, isDocEntryHidden } from "./doc.js";
6
6
  import { DuplicateOptionError, concat, conditional, group, longestMatch, merge, object, or, tuple } from "./constructs.js";
7
7
  import { WithDefaultError, map, multiple, nonEmpty, optional, withDefault } from "./modifiers.js";
8
8
  import { argument, command, constant, fail, flag, option, passThrough } from "./primitives.js";
@@ -385,28 +385,33 @@ function buildDocPage(parser, context, args) {
385
385
  let untitledSection = null;
386
386
  const titledSectionMap = /* @__PURE__ */ new Map();
387
387
  for (const fragment of fragments) if (fragment.type === "entry") {
388
+ if (isDocEntryHidden(fragment)) continue;
388
389
  if (untitledSection == null) {
389
390
  untitledSection = { entries: [] };
390
391
  buildingSections.push(untitledSection);
391
392
  }
392
393
  untitledSection.entries.push(cloneDocEntry(fragment));
393
- } else if (fragment.type === "section") if (fragment.title == null) {
394
- if (untitledSection == null) {
395
- untitledSection = { entries: [] };
396
- buildingSections.push(untitledSection);
397
- }
398
- untitledSection.entries.push(...fragment.entries.map(cloneDocEntry));
399
- } else {
400
- let section = titledSectionMap.get(fragment.title);
401
- if (section == null) {
402
- section = {
403
- title: fragment.title,
404
- entries: []
405
- };
406
- titledSectionMap.set(fragment.title, section);
407
- buildingSections.push(section);
394
+ } else if (fragment.type === "section") {
395
+ const visible = fragment.entries.filter((e) => !isDocEntryHidden(e));
396
+ if (visible.length === 0) continue;
397
+ if (fragment.title == null) {
398
+ if (untitledSection == null) {
399
+ untitledSection = { entries: [] };
400
+ buildingSections.push(untitledSection);
401
+ }
402
+ untitledSection.entries.push(...visible.map(cloneDocEntry));
403
+ } else {
404
+ let section = titledSectionMap.get(fragment.title);
405
+ if (section == null) {
406
+ section = {
407
+ title: fragment.title,
408
+ entries: []
409
+ };
410
+ titledSectionMap.set(fragment.title, section);
411
+ buildingSections.push(section);
412
+ }
413
+ section.entries.push(...visible.map(cloneDocEntry));
408
414
  }
409
- section.entries.push(...fragment.entries.map(cloneDocEntry));
410
415
  }
411
416
  const sections = buildingSections;
412
417
  const usage = cloneUsage(normalizeUsage(parser.usage));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "1.0.0-dev.1452+b060cbd3",
3
+ "version": "1.0.0-dev.1458+3f4a79f6",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",