@@ -10,17 +10,14 @@ import { SORT_STRATEGIES } from "../../sort";
10
10
import { EntryPointStrategy } from "../../entry-point" ;
11
11
import { ReflectionKind } from "../../../models/reflections/kind" ;
12
12
import * as Validation from "../../validation" ;
13
- import { blockTags , inlineTags , modifierTags } from "../tsdoc-defaults" ;
14
13
import { getEnumKeys } from "../../enum" ;
15
- import type {
16
- BundledLanguage ,
17
- BundledTheme ,
18
- } from "shiki" with { "resolution-mode" : "import" } ;
14
+ import type { BundledTheme } from "shiki" with { "resolution-mode" : "import" } ;
19
15
import {
20
16
getSupportedLanguagesWithoutAliases ,
21
17
getSupportedThemes ,
22
18
} from "../../highlighter" ;
23
19
import { setDifference } from "../../set" ;
20
+ import { OptionDefaults } from "../defaults" ;
24
21
25
22
// For convenience, added in the same order as they are documented on the website.
26
23
export function addTypeDocOptions ( options : Pick < Options , "addDeclaration" > ) {
@@ -176,27 +173,7 @@ export function addTypeDocOptions(options: Pick<Options, "addDeclaration">) {
176
173
) ;
177
174
}
178
175
} ,
179
- defaultValue : [
180
- ReflectionKind [ ReflectionKind . Module ] ,
181
- ReflectionKind [ ReflectionKind . Namespace ] ,
182
- ReflectionKind [ ReflectionKind . Enum ] ,
183
- // Not including enum member here by default
184
- ReflectionKind [ ReflectionKind . Variable ] ,
185
- ReflectionKind [ ReflectionKind . Function ] ,
186
- ReflectionKind [ ReflectionKind . Class ] ,
187
- ReflectionKind [ ReflectionKind . Interface ] ,
188
- ReflectionKind [ ReflectionKind . Constructor ] ,
189
- ReflectionKind [ ReflectionKind . Property ] ,
190
- ReflectionKind [ ReflectionKind . Method ] ,
191
- ReflectionKind [ ReflectionKind . CallSignature ] ,
192
- ReflectionKind [ ReflectionKind . IndexSignature ] ,
193
- ReflectionKind [ ReflectionKind . ConstructorSignature ] ,
194
- ReflectionKind [ ReflectionKind . Accessor ] ,
195
- ReflectionKind [ ReflectionKind . GetSignature ] ,
196
- ReflectionKind [ ReflectionKind . SetSignature ] ,
197
- ReflectionKind [ ReflectionKind . TypeAlias ] ,
198
- ReflectionKind [ ReflectionKind . Reference ] ,
199
- ] ,
176
+ defaultValue : OptionDefaults . excludeNotDocumentedKinds ,
200
177
} ) ;
201
178
options . addDeclaration ( {
202
179
name : "excludeInternal" ,
@@ -331,18 +308,7 @@ export function addTypeDocOptions(options: Pick<Options, "addDeclaration">) {
331
308
name : "highlightLanguages" ,
332
309
help : ( i18n ) => i18n . help_highlightLanguages ( ) ,
333
310
type : ParameterType . Array ,
334
- defaultValue : [
335
- "bash" ,
336
- "console" ,
337
- "css" ,
338
- "html" ,
339
- "javascript" ,
340
- "json" ,
341
- "jsonc" ,
342
- "json5" ,
343
- "tsx" ,
344
- "typescript" ,
345
- ] satisfies BundledLanguage [ ] ,
311
+ defaultValue : OptionDefaults . highlightLanguages ,
346
312
validate ( value , i18n ) {
347
313
const invalid = setDifference (
348
314
value ,
@@ -441,13 +407,7 @@ export function addTypeDocOptions(options: Pick<Options, "addDeclaration">) {
441
407
name : "excludeTags" ,
442
408
help : ( i18n ) => i18n . help_excludeTags ( ) ,
443
409
type : ParameterType . Array ,
444
- defaultValue : [
445
- "@override" ,
446
- "@virtual" ,
447
- "@privateRemarks" ,
448
- "@satisfies" ,
449
- "@overload" ,
450
- ] ,
410
+ defaultValue : OptionDefaults . excludeTags ,
451
411
validate ( value , i18n ) {
452
412
if ( ! Validation . validate ( [ Array , Validation . isTagString ] , value ) ) {
453
413
throw new Error (
@@ -716,7 +676,7 @@ export function addTypeDocOptions(options: Pick<Options, "addDeclaration">) {
716
676
name : "blockTags" ,
717
677
help : ( i18n ) => i18n . help_blockTags ( ) ,
718
678
type : ParameterType . Array ,
719
- defaultValue : blockTags ,
679
+ defaultValue : OptionDefaults . blockTags ,
720
680
validate ( value , i18n ) {
721
681
if ( ! Validation . validate ( [ Array , Validation . isTagString ] , value ) ) {
722
682
throw new Error (
@@ -729,7 +689,7 @@ export function addTypeDocOptions(options: Pick<Options, "addDeclaration">) {
729
689
name : "inlineTags" ,
730
690
help : ( i18n ) => i18n . help_inlineTags ( ) ,
731
691
type : ParameterType . Array ,
732
- defaultValue : inlineTags ,
692
+ defaultValue : OptionDefaults . inlineTags ,
733
693
validate ( value , i18n ) {
734
694
if ( ! Validation . validate ( [ Array , Validation . isTagString ] , value ) ) {
735
695
throw new Error (
@@ -742,7 +702,7 @@ export function addTypeDocOptions(options: Pick<Options, "addDeclaration">) {
742
702
name : "modifierTags" ,
743
703
help : ( i18n ) => i18n . help_modifierTags ( ) ,
744
704
type : ParameterType . Array ,
745
- defaultValue : modifierTags ,
705
+ defaultValue : OptionDefaults . modifierTags ,
746
706
validate ( value , i18n ) {
747
707
if ( ! Validation . validate ( [ Array , Validation . isTagString ] , value ) ) {
748
708
throw new Error (
@@ -755,7 +715,7 @@ export function addTypeDocOptions(options: Pick<Options, "addDeclaration">) {
755
715
name : "cascadedModifierTags" ,
756
716
help : ( i18n ) => i18n . help_modifierTags ( ) ,
757
717
type : ParameterType . Array ,
758
- defaultValue : [ "@alpha" , "@beta" , "@experimental" ] ,
718
+ defaultValue : OptionDefaults . cascadedModifierTags ,
759
719
validate ( value , i18n ) {
760
720
if ( ! Validation . validate ( [ Array , Validation . isTagString ] , value ) ) {
761
721
throw new Error (
@@ -797,7 +757,7 @@ export function addTypeDocOptions(options: Pick<Options, "addDeclaration">) {
797
757
name : "sort" ,
798
758
help : ( i18n ) => i18n . help_sort ( ) ,
799
759
type : ParameterType . Array ,
800
- defaultValue : [ "kind" , "instance-first" , "alphabetical" ] ,
760
+ defaultValue : OptionDefaults . sort ,
801
761
validate ( value , i18n ) {
802
762
const invalid = new Set ( value ) ;
803
763
for ( const v of SORT_STRATEGIES ) {
@@ -827,18 +787,14 @@ export function addTypeDocOptions(options: Pick<Options, "addDeclaration">) {
827
787
type : ParameterType . Array ,
828
788
defaultValue : [ ] ,
829
789
validate ( value , i18n ) {
830
- const invalid = new Set ( value ) ;
831
- const valid = getEnumKeys ( ReflectionKind ) ;
832
- for ( const v of valid ) {
833
- invalid . delete ( v ) ;
834
- }
790
+ const invalid = setDifference ( value , getEnumKeys ( ReflectionKind ) ) ;
835
791
836
792
if ( invalid . size !== 0 ) {
837
793
throw new Error (
838
794
i18n . option_0_specified_1_but_only_2_is_valid (
839
795
`kindSortOrder` ,
840
796
Array . from ( invalid ) . join ( ", " ) ,
841
- valid . join ( ", " ) ,
797
+ getEnumKeys ( ReflectionKind ) . join ( ", " ) ,
842
798
) ,
843
799
) ;
844
800
}
@@ -929,18 +885,7 @@ export function addTypeDocOptions(options: Pick<Options, "addDeclaration">) {
929
885
}
930
886
}
931
887
} ,
932
- defaultValue : [
933
- ReflectionKind [ ReflectionKind . Enum ] ,
934
- ReflectionKind [ ReflectionKind . EnumMember ] ,
935
- ReflectionKind [ ReflectionKind . Variable ] ,
936
- ReflectionKind [ ReflectionKind . Function ] ,
937
- ReflectionKind [ ReflectionKind . Class ] ,
938
- ReflectionKind [ ReflectionKind . Interface ] ,
939
- ReflectionKind [ ReflectionKind . Property ] ,
940
- ReflectionKind [ ReflectionKind . Method ] ,
941
- ReflectionKind [ ReflectionKind . Accessor ] ,
942
- ReflectionKind [ ReflectionKind . TypeAlias ] ,
943
- ] ,
888
+ defaultValue : OptionDefaults . requiredToBeDocumented ,
944
889
} ) ;
945
890
946
891
options . addDeclaration ( {
0 commit comments