typedoc 0.26.11 → 0.27.0-beta.0
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/bin/package.json +3 -0
- package/bin/typedoc +1 -1
- package/dist/index.d.ts +23 -13
- package/dist/index.js +22 -81
- package/dist/lib/application-events.js +1 -4
- package/dist/lib/application.d.ts +26 -16
- package/dist/lib/application.js +222 -242
- package/dist/lib/cli.js +3 -40
- package/dist/lib/converter/comments/blockLexer.d.ts +1 -1
- package/dist/lib/converter/comments/blockLexer.js +24 -30
- package/dist/lib/converter/comments/declarationReference.js +10 -21
- package/dist/lib/converter/comments/declarationReferenceResolver.d.ts +2 -2
- package/dist/lib/converter/comments/declarationReferenceResolver.js +40 -36
- package/dist/lib/converter/comments/discovery.d.ts +4 -4
- package/dist/lib/converter/comments/discovery.js +154 -172
- package/dist/lib/converter/comments/index.d.ts +4 -4
- package/dist/lib/converter/comments/index.js +39 -50
- package/dist/lib/converter/comments/lexer.d.ts +1 -1
- package/dist/lib/converter/comments/lexer.js +2 -5
- package/dist/lib/converter/comments/lineLexer.d.ts +1 -1
- package/dist/lib/converter/comments/lineLexer.js +12 -15
- package/dist/lib/converter/comments/linkResolver.d.ts +2 -2
- package/dist/lib/converter/comments/linkResolver.js +14 -21
- package/dist/lib/converter/comments/parser.d.ts +6 -6
- package/dist/lib/converter/comments/parser.js +69 -96
- package/dist/lib/converter/comments/rawLexer.d.ts +1 -1
- package/dist/lib/converter/comments/rawLexer.js +13 -16
- package/dist/lib/converter/comments/tagName.js +1 -4
- package/dist/lib/converter/comments/textParser.d.ts +4 -4
- package/dist/lib/converter/comments/textParser.js +28 -30
- package/dist/lib/converter/components.d.ts +2 -3
- package/dist/lib/converter/components.js +2 -7
- package/dist/lib/converter/context.d.ts +9 -9
- package/dist/lib/converter/context.js +54 -44
- package/dist/lib/converter/convert-expression.js +16 -23
- package/dist/lib/converter/converter-events.d.ts +1 -0
- package/dist/lib/converter/converter-events.js +2 -4
- package/dist/lib/converter/converter.d.ts +16 -13
- package/dist/lib/converter/converter.js +210 -238
- package/dist/lib/converter/factories/index-signature.d.ts +1 -1
- package/dist/lib/converter/factories/index-signature.js +11 -17
- package/dist/lib/converter/factories/signature.d.ts +2 -2
- package/dist/lib/converter/factories/signature.js +95 -106
- package/dist/lib/converter/index.d.ts +6 -7
- package/dist/lib/converter/index.js +3 -11
- package/dist/lib/converter/jsdoc.d.ts +1 -1
- package/dist/lib/converter/jsdoc.js +34 -41
- package/dist/lib/converter/plugins/CategoryPlugin.d.ts +6 -21
- package/dist/lib/converter/plugins/CategoryPlugin.js +57 -139
- package/dist/lib/converter/plugins/CommentPlugin.d.ts +3 -5
- package/dist/lib/converter/plugins/CommentPlugin.js +153 -163
- package/dist/lib/converter/plugins/GroupPlugin.d.ts +10 -9
- package/dist/lib/converter/plugins/GroupPlugin.js +87 -124
- package/dist/lib/converter/plugins/ImplementsPlugin.d.ts +3 -5
- package/dist/lib/converter/plugins/ImplementsPlugin.js +255 -321
- package/dist/lib/converter/plugins/IncludePlugin.d.ts +11 -0
- package/dist/lib/converter/plugins/IncludePlugin.js +72 -0
- package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +4 -3
- package/dist/lib/converter/plugins/InheritDocPlugin.js +41 -72
- package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +5 -5
- package/dist/lib/converter/plugins/LinkResolverPlugin.js +37 -58
- package/dist/lib/converter/plugins/MergeModuleWithPlugin.d.ts +12 -0
- package/dist/lib/converter/plugins/MergeModuleWithPlugin.js +49 -0
- package/dist/lib/converter/plugins/PackagePlugin.d.ts +4 -3
- package/dist/lib/converter/plugins/PackagePlugin.js +62 -111
- package/dist/lib/converter/plugins/SourcePlugin.d.ts +3 -5
- package/dist/lib/converter/plugins/SourcePlugin.js +69 -110
- package/dist/lib/converter/plugins/TypePlugin.d.ts +4 -6
- package/dist/lib/converter/plugins/TypePlugin.js +95 -158
- package/dist/lib/converter/plugins/index.d.ts +10 -9
- package/dist/lib/converter/plugins/index.js +10 -21
- package/dist/lib/converter/symbols.d.ts +1 -1
- package/dist/lib/converter/symbols.js +234 -227
- package/dist/lib/converter/types.d.ts +2 -2
- package/dist/lib/converter/types.js +252 -237
- package/dist/lib/converter/utils/nodes.js +5 -13
- package/dist/lib/converter/utils/reflections.d.ts +1 -1
- package/dist/lib/converter/utils/reflections.js +4 -7
- package/dist/lib/converter/utils/repository.d.ts +1 -1
- package/dist/lib/converter/utils/repository.js +103 -97
- package/dist/lib/converter/utils/symbols.js +3 -9
- package/dist/lib/internationalization/index.d.ts +3 -4
- package/dist/lib/internationalization/index.js +3 -8
- package/dist/lib/internationalization/internationalization.d.ts +5 -4
- package/dist/lib/internationalization/internationalization.js +97 -103
- package/dist/lib/internationalization/locale-utils.cjs +8 -0
- package/dist/lib/internationalization/locale-utils.d.cts +8 -0
- package/dist/lib/internationalization/locales/en.cjs +366 -2
- package/dist/lib/internationalization/locales/en.d.cts +339 -2
- package/dist/lib/internationalization/locales/jp.cjs +8 -11
- package/dist/lib/internationalization/locales/jp.d.cts +310 -1
- package/dist/lib/internationalization/locales/ko.cjs +7 -9
- package/dist/lib/internationalization/locales/ko.d.cts +223 -1
- package/dist/lib/internationalization/locales/zh.cjs +7 -10
- package/dist/lib/internationalization/locales/zh.d.cts +381 -1
- package/dist/lib/internationalization/translatable.d.ts +4 -327
- package/dist/lib/internationalization/translatable.js +2 -360
- package/dist/lib/models/FileRegistry.d.ts +20 -9
- package/dist/lib/models/FileRegistry.js +54 -45
- package/dist/lib/models/ReflectionCategory.d.ts +2 -2
- package/dist/lib/models/ReflectionCategory.js +16 -12
- package/dist/lib/models/ReflectionGroup.d.ts +3 -3
- package/dist/lib/models/ReflectionGroup.js +23 -14
- package/dist/lib/models/comments/comment.d.ts +23 -37
- package/dist/lib/models/comments/comment.js +388 -325
- package/dist/lib/models/comments/index.d.ts +2 -2
- package/dist/lib/models/comments/index.js +1 -6
- package/dist/lib/models/index.d.ts +7 -7
- package/dist/lib/models/index.js +7 -23
- package/dist/lib/models/reflections/ReflectionSymbolId.d.ts +2 -2
- package/dist/lib/models/reflections/ReflectionSymbolId.js +42 -34
- package/dist/lib/models/reflections/abstract.d.ts +17 -20
- package/dist/lib/models/reflections/abstract.js +249 -256
- package/dist/lib/models/reflections/container.d.ts +7 -7
- package/dist/lib/models/reflections/container.js +43 -16
- package/dist/lib/models/reflections/declaration.d.ts +15 -12
- package/dist/lib/models/reflections/declaration.js +150 -29
- package/dist/lib/models/reflections/document.d.ts +3 -3
- package/dist/lib/models/reflections/document.js +26 -13
- package/dist/lib/models/reflections/index.d.ts +15 -15
- package/dist/lib/models/reflections/index.js +12 -31
- package/dist/lib/models/reflections/kind.d.ts +1 -1
- package/dist/lib/models/reflections/kind.js +3 -6
- package/dist/lib/models/reflections/parameter.d.ts +5 -4
- package/dist/lib/models/reflections/parameter.js +11 -13
- package/dist/lib/models/reflections/project.d.ts +14 -9
- package/dist/lib/models/reflections/project.js +104 -56
- package/dist/lib/models/reflections/reference.d.ts +3 -3
- package/dist/lib/models/reflections/reference.js +6 -9
- package/dist/lib/models/reflections/signature.d.ts +8 -8
- package/dist/lib/models/reflections/signature.js +35 -14
- package/dist/lib/models/reflections/type-parameter.d.ts +5 -5
- package/dist/lib/models/reflections/type-parameter.js +9 -10
- package/dist/lib/models/reflections/utils.js +1 -4
- package/dist/lib/models/reflections/variant.d.ts +8 -7
- package/dist/lib/models/reflections/variant.js +1 -2
- package/dist/lib/models/sources/file.d.ts +2 -2
- package/dist/lib/models/sources/file.js +22 -5
- package/dist/lib/models/sources/index.d.ts +1 -1
- package/dist/lib/models/sources/index.js +1 -5
- package/dist/lib/models/types.d.ts +26 -13
- package/dist/lib/models/types.js +236 -151
- package/dist/lib/output/components.d.ts +5 -11
- package/dist/lib/output/components.js +84 -125
- package/dist/lib/output/events.d.ts +3 -3
- package/dist/lib/output/events.js +128 -94
- package/dist/lib/output/formatter.d.ts +84 -0
- package/dist/lib/output/formatter.js +619 -0
- package/dist/lib/output/index.d.ts +9 -8
- package/dist/lib/output/index.js +7 -19
- package/dist/lib/output/models/UrlMapping.d.ts +2 -2
- package/dist/lib/output/models/UrlMapping.js +4 -5
- package/dist/lib/output/output.d.ts +13 -0
- package/dist/lib/output/output.js +72 -0
- package/dist/lib/output/plugins/AssetsPlugin.d.ts +7 -8
- package/dist/lib/output/plugins/AssetsPlugin.js +62 -80
- package/dist/lib/output/plugins/IconsPlugin.d.ts +3 -2
- package/dist/lib/output/plugins/IconsPlugin.js +28 -84
- package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +9 -2
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +90 -96
- package/dist/lib/output/plugins/NavigationPlugin.d.ts +3 -2
- package/dist/lib/output/plugins/NavigationPlugin.js +22 -102
- package/dist/lib/output/plugins/SitemapPlugin.d.ts +3 -2
- package/dist/lib/output/plugins/SitemapPlugin.js +60 -120
- package/dist/lib/output/plugins/index.d.ts +6 -6
- package/dist/lib/output/plugins/index.js +6 -15
- package/dist/lib/output/renderer.d.ts +14 -13
- package/dist/lib/output/renderer.js +129 -185
- package/dist/lib/output/theme.d.ts +9 -5
- package/dist/lib/output/theme.js +14 -62
- package/dist/lib/output/themes/MarkedPlugin.d.ts +8 -9
- package/dist/lib/output/themes/MarkedPlugin.js +152 -117
- package/dist/lib/output/themes/default/DefaultTheme.d.ts +17 -29
- package/dist/lib/output/themes/default/DefaultTheme.js +334 -310
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +63 -48
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +119 -95
- package/dist/lib/output/themes/default/Slugger.d.ts +13 -0
- package/dist/lib/output/themes/default/Slugger.js +46 -0
- package/dist/lib/output/themes/default/layouts/default.d.ts +5 -5
- package/dist/lib/output/themes/default/layouts/default.js +47 -36
- package/dist/lib/output/themes/default/partials/anchor-icon.d.ts +2 -2
- package/dist/lib/output/themes/default/partials/anchor-icon.js +4 -7
- package/dist/lib/output/themes/default/partials/breadcrumb.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/breadcrumb.js +4 -8
- package/dist/lib/output/themes/default/partials/comment.d.ts +6 -4
- package/dist/lib/output/themes/default/partials/comment.js +52 -29
- package/dist/lib/output/themes/default/partials/footer.d.ts +2 -2
- package/dist/lib/output/themes/default/partials/footer.js +11 -14
- package/dist/lib/output/themes/default/partials/header.d.ts +4 -4
- package/dist/lib/output/themes/default/partials/header.js +9 -13
- package/dist/lib/output/themes/default/partials/hierarchy.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/hierarchy.js +9 -12
- package/dist/lib/output/themes/default/partials/icon.d.ts +4 -4
- package/dist/lib/output/themes/default/partials/icon.js +78 -73
- package/dist/lib/output/themes/default/partials/index.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/index.js +19 -22
- package/dist/lib/output/themes/default/partials/member.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/member.declaration.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/member.declaration.js +18 -61
- package/dist/lib/output/themes/default/partials/member.getterSetter.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/member.getterSetter.js +10 -26
- package/dist/lib/output/themes/default/partials/member.js +19 -24
- package/dist/lib/output/themes/default/partials/member.signature.body.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/member.signature.body.js +17 -21
- package/dist/lib/output/themes/default/partials/member.signature.title.d.ts +4 -7
- package/dist/lib/output/themes/default/partials/member.signature.title.js +8 -35
- package/dist/lib/output/themes/default/partials/member.signatures.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/member.signatures.js +9 -13
- package/dist/lib/output/themes/default/partials/member.sources.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/member.sources.js +13 -17
- package/dist/lib/output/themes/default/partials/members.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/members.js +10 -42
- package/dist/lib/output/themes/default/partials/moduleReflection.d.ts +5 -0
- package/dist/lib/output/themes/default/partials/moduleReflection.js +62 -0
- package/dist/lib/output/themes/default/partials/navigation.d.ts +4 -4
- package/dist/lib/output/themes/default/partials/navigation.js +51 -62
- package/dist/lib/output/themes/default/partials/reflectionPreview.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/reflectionPreview.js +12 -15
- package/dist/lib/output/themes/default/partials/toolbar.d.ts +4 -4
- package/dist/lib/output/themes/default/partials/toolbar.js +16 -20
- package/dist/lib/output/themes/default/partials/type.d.ts +4 -6
- package/dist/lib/output/themes/default/partials/type.js +8 -388
- package/dist/lib/output/themes/default/partials/typeAndParent.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/typeAndParent.js +11 -15
- package/dist/lib/output/themes/default/partials/typeDetails.d.ts +8 -0
- package/dist/lib/output/themes/default/partials/typeDetails.js +221 -0
- package/dist/lib/output/themes/default/partials/typeParameters.d.ts +3 -3
- package/dist/lib/output/themes/default/partials/typeParameters.js +14 -17
- package/dist/lib/output/themes/default/templates/document.d.ts +4 -4
- package/dist/lib/output/themes/default/templates/document.js +3 -7
- package/dist/lib/output/themes/default/templates/hierarchy.d.ts +4 -4
- package/dist/lib/output/themes/default/templates/hierarchy.js +10 -13
- package/dist/lib/output/themes/default/templates/index.d.ts +4 -4
- package/dist/lib/output/themes/default/templates/index.js +3 -7
- package/dist/lib/output/themes/default/templates/reflection.d.ts +4 -4
- package/dist/lib/output/themes/default/templates/reflection.js +31 -34
- package/dist/lib/output/themes/lib.d.ts +17 -3
- package/dist/lib/output/themes/lib.js +110 -49
- package/dist/lib/serialization/components.d.ts +2 -5
- package/dist/lib/serialization/components.js +1 -2
- package/dist/lib/serialization/deserializer.d.ts +21 -7
- package/dist/lib/serialization/deserializer.js +138 -123
- package/dist/lib/serialization/events.d.ts +2 -2
- package/dist/lib/serialization/events.js +6 -5
- package/dist/lib/serialization/index.d.ts +5 -5
- package/dist/lib/serialization/index.js +4 -33
- package/dist/lib/serialization/schema.d.ts +8 -2
- package/dist/lib/serialization/schema.js +2 -2
- package/dist/lib/serialization/serializer.d.ts +11 -5
- package/dist/lib/serialization/serializer.js +32 -25
- package/dist/lib/utils/array.d.ts +3 -0
- package/dist/lib/utils/array.js +26 -27
- package/dist/lib/utils/component.d.ts +2 -44
- package/dist/lib/utils/component.js +10 -102
- package/dist/lib/utils/entry-point.d.ts +3 -4
- package/dist/lib/utils/entry-point.js +114 -85
- package/dist/lib/utils/enum.js +6 -14
- package/dist/lib/utils/events.js +6 -12
- package/dist/lib/utils/fs.js +50 -91
- package/dist/lib/utils/general.d.ts +2 -1
- package/dist/lib/utils/general.js +50 -40
- package/dist/lib/utils/highlighter.js +30 -57
- package/dist/lib/utils/hooks.js +7 -13
- package/dist/lib/utils/html-entities.d.ts +8926 -0
- package/dist/lib/utils/html-entities.js +2329 -0
- package/dist/lib/utils/html.d.ts +8 -0
- package/dist/lib/utils/html.js +81 -34
- package/dist/lib/utils/index.d.ts +22 -22
- package/dist/lib/utils/index.js +20 -91
- package/dist/lib/utils/jsx.d.ts +12 -5
- package/dist/lib/utils/jsx.elements.js +1 -4
- package/dist/lib/utils/jsx.js +53 -20
- package/dist/lib/utils/loggers.d.ts +3 -3
- package/dist/lib/utils/loggers.js +36 -46
- package/dist/lib/utils/map.js +6 -13
- package/dist/lib/utils/minimalSourceFile.js +5 -7
- package/dist/lib/utils/options/declaration.d.ts +33 -7
- package/dist/lib/utils/options/declaration.js +20 -22
- package/dist/lib/utils/options/defaults.d.ts +3 -2
- package/dist/lib/utils/options/defaults.js +18 -38
- package/dist/lib/utils/options/help.d.ts +2 -2
- package/dist/lib/utils/options/help.js +7 -10
- package/dist/lib/utils/options/index.d.ts +6 -6
- package/dist/lib/utils/options/index.js +4 -18
- package/dist/lib/utils/options/options.d.ts +8 -5
- package/dist/lib/utils/options/options.js +47 -71
- package/dist/lib/utils/options/readers/arguments.d.ts +2 -2
- package/dist/lib/utils/options/readers/arguments.js +15 -17
- package/dist/lib/utils/options/readers/index.d.ts +4 -4
- package/dist/lib/utils/options/readers/index.js +4 -11
- package/dist/lib/utils/options/readers/package-json.d.ts +3 -3
- package/dist/lib/utils/options/readers/package-json.js +15 -21
- package/dist/lib/utils/options/readers/tsconfig.d.ts +2 -2
- package/dist/lib/utils/options/readers/tsconfig.js +54 -63
- package/dist/lib/utils/options/readers/typedoc.d.ts +3 -3
- package/dist/lib/utils/options/readers/typedoc.js +44 -76
- package/dist/lib/utils/options/sources/index.d.ts +1 -1
- package/dist/lib/utils/options/sources/index.js +1 -5
- package/dist/lib/utils/options/sources/typedoc.d.ts +1 -1
- package/dist/lib/utils/options/sources/typedoc.js +220 -196
- package/dist/lib/utils/options/tsdoc-defaults.d.ts +3 -3
- package/dist/lib/utils/options/tsdoc-defaults.js +16 -12
- package/dist/lib/utils/package-manifest.d.ts +1 -1
- package/dist/lib/utils/package-manifest.js +15 -19
- package/dist/lib/utils/paths.js +9 -15
- package/dist/lib/utils/perf.js +6 -11
- package/dist/lib/utils/plugins.d.ts +1 -1
- package/dist/lib/utils/plugins.js +7 -10
- package/dist/lib/utils/reflections.d.ts +1 -1
- package/dist/lib/utils/reflections.js +9 -12
- package/dist/lib/utils/set.js +2 -6
- package/dist/lib/utils/sort.d.ts +3 -3
- package/dist/lib/utils/sort.js +20 -24
- package/dist/lib/utils/tsconfig.d.ts +1 -1
- package/dist/lib/utils/tsconfig.js +13 -21
- package/dist/lib/utils/tsutils.d.ts +1 -1
- package/dist/lib/utils/tsutils.js +3 -30
- package/dist/lib/utils/validation.js +6 -12
- package/dist/lib/validation/documentation.d.ts +2 -2
- package/dist/lib/validation/documentation.js +26 -29
- package/dist/lib/validation/exports.d.ts +2 -2
- package/dist/lib/validation/exports.js +9 -11
- package/dist/lib/validation/links.d.ts +2 -2
- package/dist/lib/validation/links.js +4 -7
- package/dist/lib/validation/unusedMergeModuleWith.d.ts +3 -0
- package/dist/lib/validation/unusedMergeModuleWith.js +11 -0
- package/package.json +14 -11
- package/static/main.js +4 -4
- package/static/style.css +91 -2
- package/tsdoc.json +30 -0
- package/dist/lib/output/themes/default/partials/member.reference.d.ts +0 -4
- package/dist/lib/output/themes/default/partials/member.reference.js +0 -30
- package/dist/lib/output/themes/default/partials/parameter.d.ts +0 -4
- package/dist/lib/output/themes/default/partials/parameter.js +0 -79
- package/dist/lib/utils/html-entities.json +0 -2326
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type * as ts from "typescript";
|
|
2
|
-
import type { NeverIfInternal } from "
|
|
3
|
-
import type { Application } from "
|
|
4
|
-
import type { Logger } from "../loggers";
|
|
5
|
-
import { type DeclarationOption, type KeyToDeclaration, type TypeDocOptionMap, type TypeDocOptions, type TypeDocOptionValues } from "./declaration";
|
|
6
|
-
import type { TranslationProxy } from "../../internationalization/internationalization";
|
|
2
|
+
import type { NeverIfInternal } from "../index.js";
|
|
3
|
+
import type { Application } from "../../../index.js";
|
|
4
|
+
import type { Logger } from "../loggers.js";
|
|
5
|
+
import { type DeclarationOption, type KeyToDeclaration, type TypeDocOptionMap, type TypeDocOptions, type TypeDocOptionValues } from "./declaration.js";
|
|
6
|
+
import type { TranslationProxy } from "../../internationalization/internationalization.js";
|
|
7
7
|
/**
|
|
8
8
|
* Describes an option reader that discovers user configuration and converts it to the
|
|
9
9
|
* TypeDoc format.
|
|
@@ -60,6 +60,9 @@ export interface OptionsReader {
|
|
|
60
60
|
* 3. tsconfig-json (200) - Last config file reader, cannot specify the typedoc.json file to read.
|
|
61
61
|
* 4. argv (300) - Read argv again since any options set there should override those set in config
|
|
62
62
|
* files.
|
|
63
|
+
*
|
|
64
|
+
* @group Common
|
|
65
|
+
* @summary Contains all of TypeDoc's option declarations & values
|
|
63
66
|
*/
|
|
64
67
|
export declare class Options {
|
|
65
68
|
private _readers;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const declaration_2 = require("./declaration");
|
|
9
|
-
const sources_1 = require("./sources");
|
|
10
|
-
const help_1 = require("./help");
|
|
1
|
+
import { resolve } from "path";
|
|
2
|
+
import { ParameterType } from "./declaration.js";
|
|
3
|
+
import { insertOrderSorted, unique } from "../array.js";
|
|
4
|
+
import { convert, getDefaultValue, } from "./declaration.js";
|
|
5
|
+
import { addTypeDocOptions } from "./sources/index.js";
|
|
6
|
+
import { getOptionsHelp } from "./help.js";
|
|
7
|
+
import { getSimilarValues } from "../general.js";
|
|
11
8
|
const optionSnapshots = new WeakMap();
|
|
12
9
|
/**
|
|
13
10
|
* Maintains a collection of option declarations split into TypeDoc options
|
|
@@ -28,18 +25,26 @@ const optionSnapshots = new WeakMap();
|
|
|
28
25
|
* 3. tsconfig-json (200) - Last config file reader, cannot specify the typedoc.json file to read.
|
|
29
26
|
* 4. argv (300) - Read argv again since any options set there should override those set in config
|
|
30
27
|
* files.
|
|
28
|
+
*
|
|
29
|
+
* @group Common
|
|
30
|
+
* @summary Contains all of TypeDoc's option declarations & values
|
|
31
31
|
*/
|
|
32
|
-
class Options {
|
|
32
|
+
export class Options {
|
|
33
|
+
_readers = [];
|
|
34
|
+
_declarations = new Map();
|
|
35
|
+
_values = {};
|
|
36
|
+
_setOptions = new Set();
|
|
37
|
+
_compilerOptions = {};
|
|
38
|
+
_fileNames = [];
|
|
39
|
+
_projectReferences = [];
|
|
40
|
+
_i18n;
|
|
41
|
+
/**
|
|
42
|
+
* In packages mode, the directory of the package being converted.
|
|
43
|
+
*/
|
|
44
|
+
packageDir;
|
|
33
45
|
constructor(i18n) {
|
|
34
|
-
this._readers = [];
|
|
35
|
-
this._declarations = new Map();
|
|
36
|
-
this._values = {};
|
|
37
|
-
this._setOptions = new Set();
|
|
38
|
-
this._compilerOptions = {};
|
|
39
|
-
this._fileNames = [];
|
|
40
|
-
this._projectReferences = [];
|
|
41
46
|
this._i18n = i18n;
|
|
42
|
-
|
|
47
|
+
addTypeDocOptions(this);
|
|
43
48
|
}
|
|
44
49
|
/**
|
|
45
50
|
* Clones the options, intended for use in packages mode.
|
|
@@ -94,12 +99,12 @@ class Options {
|
|
|
94
99
|
if (!declaration) {
|
|
95
100
|
throw new Error(`Cannot reset an option (${name}) which has not been declared.`);
|
|
96
101
|
}
|
|
97
|
-
this._values[declaration.name] =
|
|
102
|
+
this._values[declaration.name] = getDefaultValue(declaration);
|
|
98
103
|
this._setOptions.delete(declaration.name);
|
|
99
104
|
}
|
|
100
105
|
else {
|
|
101
106
|
for (const declaration of this.getDeclarations()) {
|
|
102
|
-
this._values[declaration.name] =
|
|
107
|
+
this._values[declaration.name] = getDefaultValue(declaration);
|
|
103
108
|
}
|
|
104
109
|
this._setOptions.clear();
|
|
105
110
|
this._compilerOptions = {};
|
|
@@ -112,7 +117,7 @@ class Options {
|
|
|
112
117
|
* @param reader
|
|
113
118
|
*/
|
|
114
119
|
addReader(reader) {
|
|
115
|
-
|
|
120
|
+
insertOrderSorted(this._readers, reader);
|
|
116
121
|
}
|
|
117
122
|
async read(logger, cwd = process.cwd()) {
|
|
118
123
|
for (const reader of this._readers) {
|
|
@@ -127,7 +132,7 @@ class Options {
|
|
|
127
132
|
else {
|
|
128
133
|
this._declarations.set(declaration.name, declaration);
|
|
129
134
|
}
|
|
130
|
-
this._values[declaration.name] =
|
|
135
|
+
this._values[declaration.name] = getDefaultValue(declaration);
|
|
131
136
|
}
|
|
132
137
|
/**
|
|
133
138
|
* Gets a declaration by one of its names.
|
|
@@ -140,7 +145,7 @@ class Options {
|
|
|
140
145
|
* Gets all declared options.
|
|
141
146
|
*/
|
|
142
147
|
getDeclarations() {
|
|
143
|
-
return
|
|
148
|
+
return unique(this._declarations.values());
|
|
144
149
|
}
|
|
145
150
|
isSet(name) {
|
|
146
151
|
if (!this._declarations.has(name)) {
|
|
@@ -172,12 +177,23 @@ class Options {
|
|
|
172
177
|
throw new Error(this._i18n.unknown_option_0_you_may_have_meant_1(name, nearNames.join("\n\t")));
|
|
173
178
|
}
|
|
174
179
|
let oldValue = this._values[declaration.name];
|
|
175
|
-
if (typeof oldValue === "undefined")
|
|
176
|
-
oldValue =
|
|
177
|
-
|
|
178
|
-
|
|
180
|
+
if (typeof oldValue === "undefined") {
|
|
181
|
+
oldValue = getDefaultValue(declaration);
|
|
182
|
+
}
|
|
183
|
+
const converted = convert(value, declaration, this._i18n, configPath ?? process.cwd(), oldValue);
|
|
184
|
+
if (declaration.type === ParameterType.Flags) {
|
|
179
185
|
this._values[declaration.name] = Object.assign({}, this._values[declaration.name], converted);
|
|
180
186
|
}
|
|
187
|
+
else if (declaration.name === "outputs") {
|
|
188
|
+
// This is very unfortunate... there's probably some smarter way to define options
|
|
189
|
+
// so that this can be done intelligently via the convert function.
|
|
190
|
+
this._values[declaration.name] = converted.map((c) => {
|
|
191
|
+
return {
|
|
192
|
+
...c,
|
|
193
|
+
path: resolve(configPath ?? process.cwd(), c.path),
|
|
194
|
+
};
|
|
195
|
+
});
|
|
196
|
+
}
|
|
181
197
|
else {
|
|
182
198
|
this._values[declaration.name] = converted;
|
|
183
199
|
}
|
|
@@ -237,33 +253,21 @@ class Options {
|
|
|
237
253
|
* Discover similar option names to the given name, for use in error reporting.
|
|
238
254
|
*/
|
|
239
255
|
getSimilarOptions(missingName) {
|
|
240
|
-
|
|
241
|
-
let lowest = Infinity;
|
|
242
|
-
for (const name of this._declarations.keys()) {
|
|
243
|
-
const distance = editDistance(missingName, name);
|
|
244
|
-
lowest = Math.min(lowest, distance);
|
|
245
|
-
results.get(distance).push(name);
|
|
246
|
-
}
|
|
247
|
-
// Experimenting a bit, it seems an edit distance of 3 is roughly the
|
|
248
|
-
// right metric for relevant "similar" results without showing obviously wrong suggestions
|
|
249
|
-
return results
|
|
250
|
-
.get(lowest)
|
|
251
|
-
.concat(results.get(lowest + 1), results.get(lowest + 2));
|
|
256
|
+
return getSimilarValues(this._declarations.keys(), missingName);
|
|
252
257
|
}
|
|
253
258
|
/**
|
|
254
259
|
* Get the help message to be displayed to the user if `--help` is passed.
|
|
255
260
|
*/
|
|
256
261
|
getHelp(i18n) {
|
|
257
|
-
return
|
|
262
|
+
return getOptionsHelp(this, i18n);
|
|
258
263
|
}
|
|
259
264
|
}
|
|
260
|
-
exports.Options = Options;
|
|
261
265
|
/**
|
|
262
266
|
* Binds an option to an accessor. Does not register the option.
|
|
263
267
|
*
|
|
264
268
|
* Note: This is a standard ES decorator. It will not work with pre-TS 5.0 experimental decorators enabled.
|
|
265
269
|
*/
|
|
266
|
-
function Option(name) {
|
|
270
|
+
export function Option(name) {
|
|
267
271
|
return (_, _context) => {
|
|
268
272
|
return {
|
|
269
273
|
get() {
|
|
@@ -276,31 +280,3 @@ function Option(name) {
|
|
|
276
280
|
};
|
|
277
281
|
};
|
|
278
282
|
}
|
|
279
|
-
// Based on https://en.wikipedia.org/wiki/Levenshtein_distance#Iterative_with_two_matrix_rows
|
|
280
|
-
// Slightly modified for improved match results for options
|
|
281
|
-
function editDistance(s, t) {
|
|
282
|
-
if (s.length < t.length)
|
|
283
|
-
return editDistance(t, s);
|
|
284
|
-
let v0 = Array.from({ length: t.length + 1 }, (_, i) => i);
|
|
285
|
-
let v1 = Array.from({ length: t.length + 1 }, () => 0);
|
|
286
|
-
for (let i = 0; i < s.length; i++) {
|
|
287
|
-
v1[0] = i + 1;
|
|
288
|
-
for (let j = 0; j < s.length; j++) {
|
|
289
|
-
const deletionCost = v0[j + 1] + 1;
|
|
290
|
-
const insertionCost = v1[j] + 1;
|
|
291
|
-
let substitutionCost;
|
|
292
|
-
if (s[i] === t[j]) {
|
|
293
|
-
substitutionCost = v0[j];
|
|
294
|
-
}
|
|
295
|
-
else if (s[i]?.toUpperCase() === t[j]?.toUpperCase()) {
|
|
296
|
-
substitutionCost = v0[j] + 1;
|
|
297
|
-
}
|
|
298
|
-
else {
|
|
299
|
-
substitutionCost = v0[j] + 3;
|
|
300
|
-
}
|
|
301
|
-
v1[j + 1] = Math.min(deletionCost, insertionCost, substitutionCost);
|
|
302
|
-
}
|
|
303
|
-
[v0, v1] = [v1, v0];
|
|
304
|
-
}
|
|
305
|
-
return v0[t.length];
|
|
306
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { OptionsReader, Options } from "
|
|
2
|
-
import type { Logger } from "../../loggers";
|
|
1
|
+
import type { OptionsReader, Options } from "../index.js";
|
|
2
|
+
import type { Logger } from "../../loggers.js";
|
|
3
3
|
/**
|
|
4
4
|
* Obtains option values from command-line arguments
|
|
5
5
|
*/
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ArgumentsReader = void 0;
|
|
4
|
-
const assert_1 = require("assert");
|
|
5
|
-
const declaration_1 = require("../declaration");
|
|
1
|
+
import { ok } from "assert";
|
|
2
|
+
import { ParameterType } from "../declaration.js";
|
|
6
3
|
const ARRAY_OPTION_TYPES = new Set([
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
ParameterType.Array,
|
|
5
|
+
ParameterType.PathArray,
|
|
6
|
+
ParameterType.ModuleArray,
|
|
7
|
+
ParameterType.GlobArray,
|
|
11
8
|
]);
|
|
12
9
|
/**
|
|
13
10
|
* Obtains option values from command-line arguments
|
|
14
11
|
*/
|
|
15
|
-
class ArgumentsReader {
|
|
12
|
+
export class ArgumentsReader {
|
|
13
|
+
name = "arguments";
|
|
14
|
+
order;
|
|
15
|
+
supportsPackages = false;
|
|
16
|
+
args;
|
|
16
17
|
constructor(priority, args = process.argv.slice(2)) {
|
|
17
|
-
this.name = "arguments";
|
|
18
|
-
this.supportsPackages = false;
|
|
19
18
|
this.order = priority;
|
|
20
19
|
this.args = args;
|
|
21
20
|
}
|
|
@@ -29,7 +28,7 @@ class ArgumentsReader {
|
|
|
29
28
|
options.setValue(name, value);
|
|
30
29
|
}
|
|
31
30
|
catch (err) {
|
|
32
|
-
|
|
31
|
+
ok(err instanceof Error);
|
|
33
32
|
logger.error(err.message);
|
|
34
33
|
}
|
|
35
34
|
};
|
|
@@ -46,8 +45,8 @@ class ArgumentsReader {
|
|
|
46
45
|
if (seen.has(decl.name) && ARRAY_OPTION_TYPES.has(decl.type)) {
|
|
47
46
|
trySet(decl.name, options.getValue(decl.name).concat(this.args[index]));
|
|
48
47
|
}
|
|
49
|
-
else if (decl.type ===
|
|
50
|
-
decl.type ===
|
|
48
|
+
else if (decl.type === ParameterType.Boolean ||
|
|
49
|
+
decl.type === ParameterType.Flags) {
|
|
51
50
|
const value = String(this.args[index]).toLowerCase();
|
|
52
51
|
if (value === "true" || value === "false") {
|
|
53
52
|
trySet(decl.name, value === "true");
|
|
@@ -72,7 +71,7 @@ class ArgumentsReader {
|
|
|
72
71
|
if (name.includes(".")) {
|
|
73
72
|
const actualName = name.split(".")[0].replace(/^--?/, "");
|
|
74
73
|
const decl = options.getDeclaration(actualName);
|
|
75
|
-
if (decl && decl.type ===
|
|
74
|
+
if (decl && decl.type === ParameterType.Flags) {
|
|
76
75
|
const flagName = name.split(".", 2)[1];
|
|
77
76
|
const value = String(this.args[index]).toLowerCase();
|
|
78
77
|
if (value === "true" || value === "false") {
|
|
@@ -92,4 +91,3 @@ class ArgumentsReader {
|
|
|
92
91
|
}
|
|
93
92
|
}
|
|
94
93
|
}
|
|
95
|
-
exports.ArgumentsReader = ArgumentsReader;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ArgumentsReader } from "./arguments";
|
|
2
|
-
export { PackageJsonReader } from "./package-json";
|
|
3
|
-
export { TSConfigReader } from "./tsconfig";
|
|
4
|
-
export { TypeDocReader } from "./typedoc";
|
|
1
|
+
export { ArgumentsReader } from "./arguments.js";
|
|
2
|
+
export { PackageJsonReader } from "./package-json.js";
|
|
3
|
+
export { TSConfigReader } from "./tsconfig.js";
|
|
4
|
+
export { TypeDocReader } from "./typedoc.js";
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "ArgumentsReader", { enumerable: true, get: function () { return arguments_1.ArgumentsReader; } });
|
|
6
|
-
var package_json_1 = require("./package-json");
|
|
7
|
-
Object.defineProperty(exports, "PackageJsonReader", { enumerable: true, get: function () { return package_json_1.PackageJsonReader; } });
|
|
8
|
-
var tsconfig_1 = require("./tsconfig");
|
|
9
|
-
Object.defineProperty(exports, "TSConfigReader", { enumerable: true, get: function () { return tsconfig_1.TSConfigReader; } });
|
|
10
|
-
var typedoc_1 = require("./typedoc");
|
|
11
|
-
Object.defineProperty(exports, "TypeDocReader", { enumerable: true, get: function () { return typedoc_1.TypeDocReader; } });
|
|
1
|
+
export { ArgumentsReader } from "./arguments.js";
|
|
2
|
+
export { PackageJsonReader } from "./package-json.js";
|
|
3
|
+
export { TSConfigReader } from "./tsconfig.js";
|
|
4
|
+
export { TypeDocReader } from "./typedoc.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { OptionsReader } from "
|
|
2
|
-
import type { Logger } from "../../loggers";
|
|
3
|
-
import type { Options } from "../options";
|
|
1
|
+
import type { OptionsReader } from "../index.js";
|
|
2
|
+
import type { Logger } from "../../loggers.js";
|
|
3
|
+
import type { Options } from "../options.js";
|
|
4
4
|
export declare class PackageJsonReader implements OptionsReader {
|
|
5
5
|
order: number;
|
|
6
6
|
supportsPackages: boolean;
|
|
@@ -1,26 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
// reader, so that it can still specify a path to a `tsconfig.json` file.
|
|
12
|
-
this.order = 150;
|
|
13
|
-
this.supportsPackages = true;
|
|
14
|
-
this.name = "package-json";
|
|
15
|
-
}
|
|
1
|
+
import { ok } from "assert";
|
|
2
|
+
import { nicePath } from "../../paths.js";
|
|
3
|
+
import { discoverPackageJson } from "../../fs.js";
|
|
4
|
+
import { dirname } from "path";
|
|
5
|
+
export class PackageJsonReader {
|
|
6
|
+
// Should run after the TypeDoc config reader but before the TS config
|
|
7
|
+
// reader, so that it can still specify a path to a `tsconfig.json` file.
|
|
8
|
+
order = 150;
|
|
9
|
+
supportsPackages = true;
|
|
10
|
+
name = "package-json";
|
|
16
11
|
read(container, logger, cwd) {
|
|
17
|
-
const result =
|
|
12
|
+
const result = discoverPackageJson(cwd);
|
|
18
13
|
if (!result) {
|
|
19
14
|
return;
|
|
20
15
|
}
|
|
21
16
|
const { file, content } = result;
|
|
22
17
|
if ("typedoc" in content) {
|
|
23
|
-
logger.warn(logger.i18n.typedoc_key_in_0_ignored(
|
|
18
|
+
logger.warn(logger.i18n.typedoc_key_in_0_ignored(nicePath(file)));
|
|
24
19
|
}
|
|
25
20
|
const optsKey = "typedocOptions";
|
|
26
21
|
if (!(optsKey in content)) {
|
|
@@ -28,18 +23,17 @@ class PackageJsonReader {
|
|
|
28
23
|
}
|
|
29
24
|
const opts = content[optsKey];
|
|
30
25
|
if (opts === null || typeof opts !== "object") {
|
|
31
|
-
logger.error(logger.i18n.typedoc_options_must_be_object_in_0(
|
|
26
|
+
logger.error(logger.i18n.typedoc_options_must_be_object_in_0(nicePath(file)));
|
|
32
27
|
return;
|
|
33
28
|
}
|
|
34
29
|
for (const [opt, val] of Object.entries(opts)) {
|
|
35
30
|
try {
|
|
36
|
-
container.setValue(opt, val,
|
|
31
|
+
container.setValue(opt, val, dirname(file));
|
|
37
32
|
}
|
|
38
33
|
catch (err) {
|
|
39
|
-
|
|
34
|
+
ok(err instanceof Error);
|
|
40
35
|
logger.error(err.message);
|
|
41
36
|
}
|
|
42
37
|
}
|
|
43
38
|
}
|
|
44
39
|
}
|
|
45
|
-
exports.PackageJsonReader = PackageJsonReader;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Options, OptionsReader } from "../options";
|
|
2
|
-
import type { Logger } from "../../loggers";
|
|
1
|
+
import type { Options, OptionsReader } from "../options.js";
|
|
2
|
+
import type { Logger } from "../../loggers.js";
|
|
3
3
|
export declare class TSConfigReader implements OptionsReader {
|
|
4
4
|
/**
|
|
5
5
|
* Note: Runs after the {@link TypeDocReader}.
|
|
@@ -1,69 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const validation_1 = require("../../validation");
|
|
12
|
-
const paths_1 = require("../../paths");
|
|
13
|
-
const module_1 = require("module");
|
|
14
|
-
const tsdoc_defaults_1 = require("../tsdoc-defaults");
|
|
15
|
-
const array_1 = require("../../array");
|
|
16
|
-
const tsconfig_1 = require("../../tsconfig");
|
|
1
|
+
import { resolve, join, dirname } from "path";
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
import { isFile } from "../../fs.js";
|
|
4
|
+
import { ok } from "assert";
|
|
5
|
+
import { additionalProperties, isTagString, optional, validate, } from "../../validation.js";
|
|
6
|
+
import { nicePath, normalizePath } from "../../paths.js";
|
|
7
|
+
import { createRequire } from "module";
|
|
8
|
+
import { tsdocBlockTags, tsdocInlineTags, tsdocModifierTags, } from "../tsdoc-defaults.js";
|
|
9
|
+
import { unique } from "../../array.js";
|
|
10
|
+
import { findTsConfigFile, getTypeDocOptionsFromTsConfig, readTsConfig, } from "../../tsconfig.js";
|
|
17
11
|
function isSupportForTags(obj) {
|
|
18
|
-
return (
|
|
12
|
+
return (validate({}, obj) &&
|
|
19
13
|
Object.entries(obj).every(([key, val]) => {
|
|
20
14
|
return (/^@[a-zA-Z][a-zA-Z0-9]*$/.test(key) && typeof val === "boolean");
|
|
21
15
|
}));
|
|
22
16
|
}
|
|
23
17
|
const tsDocSchema = {
|
|
24
|
-
$schema:
|
|
25
|
-
extends:
|
|
26
|
-
noStandardTags:
|
|
27
|
-
tagDefinitions:
|
|
18
|
+
$schema: optional(String),
|
|
19
|
+
extends: optional([Array, String]),
|
|
20
|
+
noStandardTags: optional(Boolean),
|
|
21
|
+
tagDefinitions: optional([
|
|
28
22
|
Array,
|
|
29
23
|
{
|
|
30
|
-
tagName:
|
|
24
|
+
tagName: isTagString,
|
|
31
25
|
syntaxKind: ["inline", "block", "modifier"],
|
|
32
|
-
allowMultiple:
|
|
33
|
-
[
|
|
26
|
+
allowMultiple: optional(Boolean),
|
|
27
|
+
[additionalProperties]: false,
|
|
34
28
|
},
|
|
35
29
|
]),
|
|
36
|
-
supportForTags:
|
|
30
|
+
supportForTags: optional(isSupportForTags),
|
|
37
31
|
// The official parser has code to support for these two, but
|
|
38
32
|
// the schema doesn't allow them... just silently ignore them for now.
|
|
39
|
-
supportedHtmlElements:
|
|
40
|
-
reportUnsupportedHtmlElements:
|
|
41
|
-
[
|
|
33
|
+
supportedHtmlElements: optional({}),
|
|
34
|
+
reportUnsupportedHtmlElements: optional(Boolean),
|
|
35
|
+
[additionalProperties]: false,
|
|
42
36
|
};
|
|
43
|
-
class TSConfigReader {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this.seenTsdocPaths = new Set();
|
|
52
|
-
}
|
|
37
|
+
export class TSConfigReader {
|
|
38
|
+
/**
|
|
39
|
+
* Note: Runs after the {@link TypeDocReader}.
|
|
40
|
+
*/
|
|
41
|
+
order = 200;
|
|
42
|
+
name = "tsconfig-json";
|
|
43
|
+
supportsPackages = true;
|
|
44
|
+
seenTsdocPaths = new Set();
|
|
53
45
|
read(container, logger, cwd) {
|
|
54
46
|
const file = container.getValue("tsconfig") || cwd;
|
|
55
|
-
let fileToRead =
|
|
47
|
+
let fileToRead = findTsConfigFile(file);
|
|
56
48
|
if (!fileToRead) {
|
|
57
49
|
// If the user didn't give us this option, we shouldn't complain about not being able to find it.
|
|
58
50
|
if (container.isSet("tsconfig")) {
|
|
59
|
-
logger.error(logger.i18n.tsconfig_file_0_does_not_exist(
|
|
51
|
+
logger.error(logger.i18n.tsconfig_file_0_does_not_exist(nicePath(file)));
|
|
60
52
|
}
|
|
61
53
|
return;
|
|
62
54
|
}
|
|
63
|
-
fileToRead =
|
|
64
|
-
logger.verbose(`Reading tsconfig at ${
|
|
65
|
-
this.addTagsFromTsdocJson(container, logger,
|
|
66
|
-
const parsed =
|
|
55
|
+
fileToRead = normalizePath(resolve(fileToRead));
|
|
56
|
+
logger.verbose(`Reading tsconfig at ${nicePath(fileToRead)}`);
|
|
57
|
+
this.addTagsFromTsdocJson(container, logger, resolve(fileToRead));
|
|
58
|
+
const parsed = readTsConfig(fileToRead, logger);
|
|
67
59
|
if (!parsed) {
|
|
68
60
|
return;
|
|
69
61
|
}
|
|
@@ -71,7 +63,7 @@ class TSConfigReader {
|
|
|
71
63
|
if (parsed.errors.length) {
|
|
72
64
|
return;
|
|
73
65
|
}
|
|
74
|
-
const typedocOptions =
|
|
66
|
+
const typedocOptions = getTypeDocOptionsFromTsConfig(fileToRead);
|
|
75
67
|
if (typedocOptions.options) {
|
|
76
68
|
logger.error(logger.i18n.tsconfig_file_specifies_options_file());
|
|
77
69
|
delete typedocOptions.options;
|
|
@@ -84,18 +76,18 @@ class TSConfigReader {
|
|
|
84
76
|
for (const [key, val] of Object.entries(typedocOptions || {})) {
|
|
85
77
|
try {
|
|
86
78
|
// We catch the error, so can ignore the strict type checks
|
|
87
|
-
container.setValue(key, val,
|
|
79
|
+
container.setValue(key, val, join(fileToRead, ".."));
|
|
88
80
|
}
|
|
89
81
|
catch (error) {
|
|
90
|
-
|
|
82
|
+
ok(error instanceof Error);
|
|
91
83
|
logger.error(error.message);
|
|
92
84
|
}
|
|
93
85
|
}
|
|
94
86
|
}
|
|
95
87
|
addTagsFromTsdocJson(container, logger, tsconfig) {
|
|
96
88
|
this.seenTsdocPaths.clear();
|
|
97
|
-
const tsdoc =
|
|
98
|
-
if (!
|
|
89
|
+
const tsdoc = join(dirname(tsconfig), "tsdoc.json");
|
|
90
|
+
if (!isFile(tsdoc)) {
|
|
99
91
|
return;
|
|
100
92
|
}
|
|
101
93
|
const overwritten = ["blockTags", "inlineTags", "modifierTags"].filter((opt) => container.isSet(opt));
|
|
@@ -114,9 +106,9 @@ class TSConfigReader {
|
|
|
114
106
|
const inlineTags = [];
|
|
115
107
|
const modifierTags = [];
|
|
116
108
|
if (!config.noStandardTags) {
|
|
117
|
-
blockTags.push(...
|
|
118
|
-
inlineTags.push(...
|
|
119
|
-
modifierTags.push(...
|
|
109
|
+
blockTags.push(...tsdocBlockTags);
|
|
110
|
+
inlineTags.push(...tsdocInlineTags);
|
|
111
|
+
modifierTags.push(...tsdocModifierTags);
|
|
120
112
|
}
|
|
121
113
|
for (const { tagName, syntaxKind } of config.tagDefinitions?.filter(supported) || []) {
|
|
122
114
|
const arr = {
|
|
@@ -126,35 +118,35 @@ class TSConfigReader {
|
|
|
126
118
|
}[syntaxKind];
|
|
127
119
|
arr.push(tagName);
|
|
128
120
|
}
|
|
129
|
-
container.setValue("blockTags",
|
|
130
|
-
container.setValue("inlineTags",
|
|
131
|
-
container.setValue("modifierTags",
|
|
121
|
+
container.setValue("blockTags", unique(blockTags));
|
|
122
|
+
container.setValue("inlineTags", unique(inlineTags));
|
|
123
|
+
container.setValue("modifierTags", unique(modifierTags));
|
|
132
124
|
}
|
|
133
125
|
readTsDoc(logger, path) {
|
|
134
126
|
if (this.seenTsdocPaths.has(path)) {
|
|
135
|
-
logger.error(logger.i18n.circular_reference_extends_0(
|
|
127
|
+
logger.error(logger.i18n.circular_reference_extends_0(nicePath(path)));
|
|
136
128
|
return;
|
|
137
129
|
}
|
|
138
130
|
this.seenTsdocPaths.add(path);
|
|
139
|
-
const { config, error } =
|
|
131
|
+
const { config, error } = ts.readConfigFile(normalizePath(path), ts.sys.readFile);
|
|
140
132
|
if (error) {
|
|
141
|
-
logger.error(logger.i18n.failed_read_tsdoc_json_0(
|
|
133
|
+
logger.error(logger.i18n.failed_read_tsdoc_json_0(nicePath(path)));
|
|
142
134
|
return;
|
|
143
135
|
}
|
|
144
|
-
if (!
|
|
145
|
-
logger.error(logger.i18n.invalid_tsdoc_json_0(
|
|
136
|
+
if (!validate(tsDocSchema, config)) {
|
|
137
|
+
logger.error(logger.i18n.invalid_tsdoc_json_0(nicePath(path)));
|
|
146
138
|
return;
|
|
147
139
|
}
|
|
148
140
|
const workingConfig = {};
|
|
149
141
|
if (config.extends) {
|
|
150
|
-
const resolver =
|
|
142
|
+
const resolver = createRequire(path);
|
|
151
143
|
for (const extendedPath of config.extends) {
|
|
152
144
|
let resolvedPath;
|
|
153
145
|
try {
|
|
154
146
|
resolvedPath = resolver.resolve(extendedPath);
|
|
155
147
|
}
|
|
156
148
|
catch {
|
|
157
|
-
logger.error(logger.i18n.failed_resolve_0_to_file_in_1(extendedPath,
|
|
149
|
+
logger.error(logger.i18n.failed_resolve_0_to_file_in_1(extendedPath, nicePath(path)));
|
|
158
150
|
return;
|
|
159
151
|
}
|
|
160
152
|
const parentConfig = this.readTsDoc(logger, resolvedPath);
|
|
@@ -167,7 +159,6 @@ class TSConfigReader {
|
|
|
167
159
|
return workingConfig;
|
|
168
160
|
}
|
|
169
161
|
}
|
|
170
|
-
exports.TSConfigReader = TSConfigReader;
|
|
171
162
|
function mergeConfigs(from, into) {
|
|
172
163
|
if (from.supportForTags) {
|
|
173
164
|
into.supportForTags ||= {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { OptionsReader } from "
|
|
2
|
-
import type { Logger } from "../../loggers";
|
|
3
|
-
import type { Options } from "../options";
|
|
1
|
+
import type { OptionsReader } from "../options.js";
|
|
2
|
+
import type { Logger } from "../../loggers.js";
|
|
3
|
+
import type { Options } from "../options.js";
|
|
4
4
|
/**
|
|
5
5
|
* Obtains option values from typedoc.json
|
|
6
6
|
*
|