typedoc 0.26.11 → 0.27.0-beta.1
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 +212 -239
- package/dist/lib/converter/factories/index-signature.d.ts +3 -3
- package/dist/lib/converter/factories/index-signature.js +43 -26
- 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 +372 -2
- package/dist/lib/internationalization/locales/en.d.cts +343 -2
- package/dist/lib/internationalization/locales/jp.cjs +13 -14
- package/dist/lib/internationalization/locales/jp.d.cts +307 -1
- package/dist/lib/internationalization/locales/ko.cjs +12 -11
- package/dist/lib/internationalization/locales/ko.d.cts +221 -1
- package/dist/lib/internationalization/locales/zh.cjs +43 -19
- package/dist/lib/internationalization/locales/zh.d.cts +409 -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 +29 -16
- 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 +624 -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 +14 -0
- package/dist/lib/output/output.js +91 -0
- package/dist/lib/output/plugins/AssetsPlugin.d.ts +9 -8
- package/dist/lib/output/plugins/AssetsPlugin.js +64 -80
- package/dist/lib/output/plugins/HierarchyPlugin.d.ts +7 -0
- package/dist/lib/output/plugins/HierarchyPlugin.js +67 -0
- 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 +7 -6
- package/dist/lib/output/plugins/index.js +7 -15
- package/dist/lib/output/renderer.d.ts +14 -13
- package/dist/lib/output/renderer.js +130 -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 +48 -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 +4 -4
- package/dist/lib/output/themes/default/partials/hierarchy.js +12 -15
- 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 +222 -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 +24 -22
- 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 +32 -34
- package/dist/lib/output/themes/lib.d.ts +17 -3
- package/dist/lib/output/themes/lib.js +118 -50
- 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 -6
- package/dist/lib/utils/jsx.elements.d.ts +1 -1
- package/dist/lib/utils/jsx.elements.js +3 -4
- package/dist/lib/utils/jsx.js +82 -52
- 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 +35 -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 +232 -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 +17 -14
- package/static/main.js +4 -4
- package/static/style.css +109 -17
- 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,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
3
2
|
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
4
3
|
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
@@ -33,28 +32,39 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
33
32
|
}
|
|
34
33
|
return useValue ? value : void 0;
|
|
35
34
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const ReflectionSymbolId_1 = require("../reflections/ReflectionSymbolId");
|
|
40
|
-
const general_1 = require("../../utils/general");
|
|
35
|
+
import { assertNever, removeIf } from "../../utils/index.js";
|
|
36
|
+
import { ReflectionSymbolId } from "../reflections/ReflectionSymbolId.js";
|
|
37
|
+
import { NonEnumerable } from "../../utils/general.js";
|
|
41
38
|
/**
|
|
42
39
|
* A model that represents a single TypeDoc comment tag.
|
|
43
40
|
*
|
|
44
41
|
* Tags are stored in the {@link Comment.blockTags} property.
|
|
45
42
|
* @category Comments
|
|
46
43
|
*/
|
|
47
|
-
class CommentTag {
|
|
44
|
+
export class CommentTag {
|
|
45
|
+
/**
|
|
46
|
+
* The name of this tag, e.g. `@returns`, `@example`
|
|
47
|
+
*/
|
|
48
|
+
tag;
|
|
49
|
+
/**
|
|
50
|
+
* Some tags, (`@typedef`, `@param`, `@property`, etc.) may have a user defined identifier associated with them.
|
|
51
|
+
* If this tag is one of those, it will be parsed out and included here.
|
|
52
|
+
*/
|
|
53
|
+
name;
|
|
54
|
+
/**
|
|
55
|
+
* The actual body text of this tag.
|
|
56
|
+
*/
|
|
57
|
+
content;
|
|
58
|
+
/**
|
|
59
|
+
* A flag which may be set by plugins to prevent TypeDoc from rendering this tag, if the plugin provides
|
|
60
|
+
* custom rendering. Note: This flag is **not** serialized, it is expected to be set just before the comment
|
|
61
|
+
* is rendered.
|
|
62
|
+
*/
|
|
63
|
+
skipRendering = false;
|
|
48
64
|
/**
|
|
49
65
|
* Create a new CommentTag instance.
|
|
50
66
|
*/
|
|
51
67
|
constructor(tag, text) {
|
|
52
|
-
/**
|
|
53
|
-
* A flag which may be set by plugins to prevent TypeDoc from rendering this tag, if the plugin provides
|
|
54
|
-
* custom rendering. Note: This flag is **not** serialized, it is expected to be set just before the comment
|
|
55
|
-
* is rendered.
|
|
56
|
-
*/
|
|
57
|
-
this.skipRendering = false;
|
|
58
68
|
this.tag = tag;
|
|
59
69
|
this.content = text;
|
|
60
70
|
}
|
|
@@ -89,7 +99,6 @@ class CommentTag {
|
|
|
89
99
|
this.content = Comment.deserializeDisplayParts(de, obj.content);
|
|
90
100
|
}
|
|
91
101
|
}
|
|
92
|
-
exports.CommentTag = CommentTag;
|
|
93
102
|
/**
|
|
94
103
|
* A model that represents a comment.
|
|
95
104
|
*
|
|
@@ -98,7 +107,6 @@ exports.CommentTag = CommentTag;
|
|
|
98
107
|
* @category Comments
|
|
99
108
|
*/
|
|
100
109
|
let Comment = (() => {
|
|
101
|
-
var _a;
|
|
102
110
|
let _sourcePath_decorators;
|
|
103
111
|
let _sourcePath_initializers = [];
|
|
104
112
|
let _sourcePath_extraInitializers = [];
|
|
@@ -108,347 +116,402 @@ let Comment = (() => {
|
|
|
108
116
|
let _inheritedFromParentDeclaration_decorators;
|
|
109
117
|
let _inheritedFromParentDeclaration_initializers = [];
|
|
110
118
|
let _inheritedFromParentDeclaration_extraInitializers = [];
|
|
111
|
-
return
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
119
|
+
return class Comment {
|
|
120
|
+
static {
|
|
121
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
122
|
+
_sourcePath_decorators = [NonEnumerable];
|
|
123
|
+
_discoveryId_decorators = [NonEnumerable];
|
|
124
|
+
_inheritedFromParentDeclaration_decorators = [NonEnumerable];
|
|
125
|
+
__esDecorate(null, null, _sourcePath_decorators, { kind: "field", name: "sourcePath", static: false, private: false, access: { has: obj => "sourcePath" in obj, get: obj => obj.sourcePath, set: (obj, value) => { obj.sourcePath = value; } }, metadata: _metadata }, _sourcePath_initializers, _sourcePath_extraInitializers);
|
|
126
|
+
__esDecorate(null, null, _discoveryId_decorators, { kind: "field", name: "discoveryId", static: false, private: false, access: { has: obj => "discoveryId" in obj, get: obj => obj.discoveryId, set: (obj, value) => { obj.discoveryId = value; } }, metadata: _metadata }, _discoveryId_initializers, _discoveryId_extraInitializers);
|
|
127
|
+
__esDecorate(null, null, _inheritedFromParentDeclaration_decorators, { kind: "field", name: "inheritedFromParentDeclaration", static: false, private: false, access: { has: obj => "inheritedFromParentDeclaration" in obj, get: obj => obj.inheritedFromParentDeclaration, set: (obj, value) => { obj.inheritedFromParentDeclaration = value; } }, metadata: _metadata }, _inheritedFromParentDeclaration_initializers, _inheritedFromParentDeclaration_extraInitializers);
|
|
128
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Debugging utility for combining parts into a simple string. Not suitable for
|
|
132
|
+
* rendering, but can be useful in tests.
|
|
133
|
+
*/
|
|
134
|
+
static combineDisplayParts(parts) {
|
|
135
|
+
let result = "";
|
|
136
|
+
for (const item of parts || []) {
|
|
137
|
+
switch (item.kind) {
|
|
138
|
+
case "text":
|
|
139
|
+
case "code":
|
|
140
|
+
case "relative-link":
|
|
141
|
+
result += item.text;
|
|
142
|
+
break;
|
|
143
|
+
case "inline-tag":
|
|
144
|
+
result += `{${item.tag} ${item.text}}`;
|
|
145
|
+
break;
|
|
146
|
+
default:
|
|
147
|
+
assertNever(item);
|
|
131
148
|
}
|
|
132
|
-
return result;
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Helper utility to clone {@link Comment.summary} or {@link CommentTag.content}
|
|
136
|
-
*/
|
|
137
|
-
static cloneDisplayParts(parts) {
|
|
138
|
-
return parts.map((p) => ({ ...p }));
|
|
139
149
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
+
return result;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Helper utility to clone {@link Comment.summary} or {@link CommentTag.content}
|
|
154
|
+
*/
|
|
155
|
+
static cloneDisplayParts(parts) {
|
|
156
|
+
return parts.map((p) => ({ ...p }));
|
|
157
|
+
}
|
|
158
|
+
static serializeDisplayParts(serializer, parts) {
|
|
159
|
+
return parts?.map((part) => {
|
|
160
|
+
switch (part.kind) {
|
|
161
|
+
case "text":
|
|
162
|
+
case "code":
|
|
163
|
+
return { ...part };
|
|
164
|
+
case "inline-tag": {
|
|
165
|
+
let target;
|
|
166
|
+
if (typeof part.target === "string") {
|
|
167
|
+
target = part.target;
|
|
168
|
+
}
|
|
169
|
+
else if (part.target) {
|
|
170
|
+
if ("id" in part.target) {
|
|
171
|
+
target = part.target.id;
|
|
150
172
|
}
|
|
151
|
-
else
|
|
152
|
-
|
|
153
|
-
target = part.target.id;
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
target = part.target.toObject(serializer);
|
|
157
|
-
}
|
|
173
|
+
else {
|
|
174
|
+
target = part.target.toObject(serializer);
|
|
158
175
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
176
|
+
}
|
|
177
|
+
return {
|
|
178
|
+
...part,
|
|
179
|
+
target,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
case "relative-link": {
|
|
183
|
+
return {
|
|
184
|
+
...part,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
//Since display parts are plain objects, this lives here
|
|
191
|
+
static deserializeDisplayParts(de, parts) {
|
|
192
|
+
const links = [];
|
|
193
|
+
const files = [];
|
|
194
|
+
const result = parts.map((part) => {
|
|
195
|
+
switch (part.kind) {
|
|
196
|
+
case "text":
|
|
197
|
+
case "code":
|
|
198
|
+
return { ...part };
|
|
199
|
+
case "inline-tag": {
|
|
200
|
+
if (typeof part.target === "number") {
|
|
201
|
+
const part2 = {
|
|
202
|
+
kind: part.kind,
|
|
203
|
+
tag: part.tag,
|
|
204
|
+
text: part.text,
|
|
205
|
+
target: undefined,
|
|
206
|
+
tsLinkText: part.tsLinkText,
|
|
162
207
|
};
|
|
208
|
+
links.push([part.target, part2]);
|
|
209
|
+
return part2;
|
|
163
210
|
}
|
|
164
|
-
|
|
211
|
+
else if (typeof part.target === "string" ||
|
|
212
|
+
part.target === undefined) {
|
|
165
213
|
return {
|
|
166
|
-
|
|
214
|
+
kind: "inline-tag",
|
|
215
|
+
tag: part.tag,
|
|
216
|
+
text: part.text,
|
|
217
|
+
target: part.target,
|
|
218
|
+
tsLinkText: part.tsLinkText,
|
|
167
219
|
};
|
|
168
220
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
switch (part.kind) {
|
|
178
|
-
case "text":
|
|
179
|
-
case "code":
|
|
180
|
-
return { ...part };
|
|
181
|
-
case "inline-tag": {
|
|
182
|
-
if (typeof part.target === "number") {
|
|
183
|
-
const part2 = {
|
|
184
|
-
kind: part.kind,
|
|
185
|
-
tag: part.tag,
|
|
186
|
-
text: part.text,
|
|
187
|
-
target: undefined,
|
|
188
|
-
tsLinkText: part.tsLinkText,
|
|
189
|
-
};
|
|
190
|
-
links.push([part.target, part2]);
|
|
191
|
-
return part2;
|
|
192
|
-
}
|
|
193
|
-
else if (typeof part.target === "string" ||
|
|
194
|
-
part.target === undefined) {
|
|
195
|
-
return {
|
|
196
|
-
kind: "inline-tag",
|
|
197
|
-
tag: part.tag,
|
|
198
|
-
text: part.text,
|
|
199
|
-
target: part.target,
|
|
200
|
-
tsLinkText: part.tsLinkText,
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
else if (typeof part.target === "object") {
|
|
204
|
-
return {
|
|
205
|
-
kind: "inline-tag",
|
|
206
|
-
tag: part.tag,
|
|
207
|
-
text: part.text,
|
|
208
|
-
target: new ReflectionSymbolId_1.ReflectionSymbolId(part.target),
|
|
209
|
-
tsLinkText: part.tsLinkText,
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
else {
|
|
213
|
-
(0, utils_1.assertNever)(part.target);
|
|
214
|
-
}
|
|
215
|
-
break;
|
|
221
|
+
else if (typeof part.target === "object") {
|
|
222
|
+
return {
|
|
223
|
+
kind: "inline-tag",
|
|
224
|
+
tag: part.tag,
|
|
225
|
+
text: part.text,
|
|
226
|
+
target: new ReflectionSymbolId(part.target),
|
|
227
|
+
tsLinkText: part.tsLinkText,
|
|
228
|
+
};
|
|
216
229
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
const part2 = {
|
|
220
|
-
kind: "relative-link",
|
|
221
|
-
text: part.text,
|
|
222
|
-
target: null,
|
|
223
|
-
};
|
|
224
|
-
files.push([part.target, part2]);
|
|
225
|
-
return part2;
|
|
226
|
-
}
|
|
227
|
-
return { ...part, target: undefined };
|
|
230
|
+
else {
|
|
231
|
+
assertNever(part.target);
|
|
228
232
|
}
|
|
233
|
+
break;
|
|
229
234
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}
|
|
235
|
+
case "relative-link": {
|
|
236
|
+
if (part.target) {
|
|
237
|
+
const part2 = {
|
|
238
|
+
kind: "relative-link",
|
|
239
|
+
text: part.text,
|
|
240
|
+
target: null,
|
|
241
|
+
targetAnchor: part.targetAnchor,
|
|
242
|
+
};
|
|
243
|
+
files.push([part.target, part2]);
|
|
244
|
+
return part2;
|
|
241
245
|
}
|
|
242
|
-
|
|
246
|
+
return {
|
|
247
|
+
...part,
|
|
248
|
+
target: undefined,
|
|
249
|
+
targetAnchor: part.targetAnchor,
|
|
250
|
+
};
|
|
251
|
+
}
|
|
243
252
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
case "code":
|
|
256
|
-
return part.text.includes("\n");
|
|
257
|
-
case "inline-tag":
|
|
258
|
-
case "relative-link":
|
|
259
|
-
return false;
|
|
253
|
+
});
|
|
254
|
+
if (links.length || files.length) {
|
|
255
|
+
de.defer((project) => {
|
|
256
|
+
for (const [oldFileId, part] of files) {
|
|
257
|
+
part.target = de.oldFileIdToNewFileId[oldFileId];
|
|
258
|
+
}
|
|
259
|
+
for (const [oldId, part] of links) {
|
|
260
|
+
part.target = project.getReflectionById(de.oldIdToNewId[oldId] ?? -1);
|
|
261
|
+
if (!part.target) {
|
|
262
|
+
de.logger.warn(de.application.i18n.serialized_project_referenced_0_not_part_of_project(oldId.toString()));
|
|
263
|
+
}
|
|
260
264
|
}
|
|
261
265
|
});
|
|
262
|
-
if (index === -1) {
|
|
263
|
-
return {
|
|
264
|
-
header: _a.combineDisplayParts(parts),
|
|
265
|
-
body: [],
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
// Do not split a code block, stop the header at the end of the previous block
|
|
269
|
-
if (parts[index].kind === "code") {
|
|
270
|
-
--index;
|
|
271
|
-
}
|
|
272
|
-
if (index === -1) {
|
|
273
|
-
return { header: "", body: _a.cloneDisplayParts(parts) };
|
|
274
|
-
}
|
|
275
|
-
let header = _a.combineDisplayParts(parts.slice(0, index));
|
|
276
|
-
const split = parts[index].text.indexOf("\n");
|
|
277
|
-
let body;
|
|
278
|
-
if (split === -1) {
|
|
279
|
-
header += parts[index].text;
|
|
280
|
-
body = _a.cloneDisplayParts(parts.slice(index + 1));
|
|
281
|
-
}
|
|
282
|
-
else {
|
|
283
|
-
header += parts[index].text.substring(0, split);
|
|
284
|
-
body = _a.cloneDisplayParts(parts.slice(index));
|
|
285
|
-
body[0].text = body[0].text.substring(split + 1);
|
|
286
|
-
}
|
|
287
|
-
if (!body[0].text) {
|
|
288
|
-
body.shift();
|
|
289
|
-
}
|
|
290
|
-
return { header: header.trim(), body };
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Creates a new Comment instance.
|
|
294
|
-
*/
|
|
295
|
-
constructor(summary = [], blockTags = [], modifierTags = new Set()) {
|
|
296
|
-
/**
|
|
297
|
-
* All associated block level tags.
|
|
298
|
-
*/
|
|
299
|
-
this.blockTags = [];
|
|
300
|
-
/**
|
|
301
|
-
* All modifier tags present on the comment, e.g. `@alpha`, `@beta`.
|
|
302
|
-
*/
|
|
303
|
-
this.modifierTags = new Set();
|
|
304
|
-
/**
|
|
305
|
-
* Full path to the file where this comment originated from, if any.
|
|
306
|
-
* This field will not be serialized, so will not be present when handling JSON-revived reflections.
|
|
307
|
-
*
|
|
308
|
-
* Note: This field is non-enumerable to make testing comment contents with `deepEqual` easier.
|
|
309
|
-
*/
|
|
310
|
-
this.sourcePath = __runInitializers(this, _sourcePath_initializers, void 0);
|
|
311
|
-
/**
|
|
312
|
-
* Internal discovery ID used to prevent symbol comments from
|
|
313
|
-
* being duplicated on signatures. Only set when the comment was created
|
|
314
|
-
* from a `ts.CommentRange`.
|
|
315
|
-
* @internal
|
|
316
|
-
*/
|
|
317
|
-
this.discoveryId = (__runInitializers(this, _sourcePath_extraInitializers), __runInitializers(this, _discoveryId_initializers, void 0));
|
|
318
|
-
/**
|
|
319
|
-
* If the comment was inherited from a different "parent" declaration
|
|
320
|
-
* (see #2545), then it is desirable to know this as any `@param` tags
|
|
321
|
-
* which do not apply should not cause warnings. This is not serialized,
|
|
322
|
-
* and only set when the comment was created from a `ts.CommentRange`.
|
|
323
|
-
*/
|
|
324
|
-
this.inheritedFromParentDeclaration = (__runInitializers(this, _discoveryId_extraInitializers), __runInitializers(this, _inheritedFromParentDeclaration_initializers, void 0));
|
|
325
|
-
__runInitializers(this, _inheritedFromParentDeclaration_extraInitializers);
|
|
326
|
-
this.summary = summary;
|
|
327
|
-
this.blockTags = blockTags;
|
|
328
|
-
this.modifierTags = modifierTags;
|
|
329
|
-
extractLabelTag(this);
|
|
330
266
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
for (let i = 0; i < this.blockTags.length; ++i) {
|
|
347
|
-
if (!this.blockTags[i].similarTo(other.blockTags[i])) {
|
|
267
|
+
return result;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Splits the provided parts into a header (first line, as a string)
|
|
271
|
+
* and body (remaining lines). If the header line contains inline tags
|
|
272
|
+
* they will be serialized to a string.
|
|
273
|
+
*/
|
|
274
|
+
static splitPartsToHeaderAndBody(parts) {
|
|
275
|
+
let index = parts.findIndex((part) => {
|
|
276
|
+
switch (part.kind) {
|
|
277
|
+
case "text":
|
|
278
|
+
case "code":
|
|
279
|
+
return part.text.includes("\n");
|
|
280
|
+
case "inline-tag":
|
|
281
|
+
case "relative-link":
|
|
348
282
|
return false;
|
|
349
|
-
}
|
|
350
283
|
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
const comment = new _a(_a.cloneDisplayParts(this.summary), this.blockTags.map((tag) => tag.clone()), new Set(this.modifierTags));
|
|
358
|
-
comment.discoveryId = this.discoveryId;
|
|
359
|
-
comment.sourcePath = this.sourcePath;
|
|
360
|
-
comment.inheritedFromParentDeclaration =
|
|
361
|
-
this.inheritedFromParentDeclaration;
|
|
362
|
-
return comment;
|
|
284
|
+
});
|
|
285
|
+
if (index === -1) {
|
|
286
|
+
return {
|
|
287
|
+
header: Comment.combineDisplayParts(parts),
|
|
288
|
+
body: [],
|
|
289
|
+
};
|
|
363
290
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
*/
|
|
368
|
-
isEmpty() {
|
|
369
|
-
return !this.hasVisibleComponent() && this.modifierTags.size === 0;
|
|
291
|
+
// Do not split a code block, stop the header at the end of the previous block
|
|
292
|
+
if (parts[index].kind === "code") {
|
|
293
|
+
--index;
|
|
370
294
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
*
|
|
374
|
-
* @returns TRUE when this comment has a visible component.
|
|
375
|
-
*/
|
|
376
|
-
hasVisibleComponent() {
|
|
377
|
-
return (this.summary.some((x) => x.kind !== "text" || x.text !== "") ||
|
|
378
|
-
this.blockTags.length > 0);
|
|
295
|
+
if (index === -1) {
|
|
296
|
+
return { header: "", body: Comment.cloneDisplayParts(parts) };
|
|
379
297
|
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
hasModifier(tagName) {
|
|
387
|
-
return this.modifierTags.has(tagName);
|
|
298
|
+
let header = Comment.combineDisplayParts(parts.slice(0, index));
|
|
299
|
+
const split = parts[index].text.indexOf("\n");
|
|
300
|
+
let body;
|
|
301
|
+
if (split === -1) {
|
|
302
|
+
header += parts[index].text;
|
|
303
|
+
body = Comment.cloneDisplayParts(parts.slice(index + 1));
|
|
388
304
|
}
|
|
389
|
-
|
|
390
|
-
|
|
305
|
+
else {
|
|
306
|
+
header += parts[index].text.substring(0, split);
|
|
307
|
+
body = Comment.cloneDisplayParts(parts.slice(index));
|
|
308
|
+
body[0].text = body[0].text.substring(split + 1);
|
|
391
309
|
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
*
|
|
395
|
-
* @param tagName The name of the tag to look for.
|
|
396
|
-
* @returns The found tag or undefined.
|
|
397
|
-
*/
|
|
398
|
-
getTag(tagName) {
|
|
399
|
-
return this.blockTags.find((tag) => tag.tag === tagName);
|
|
310
|
+
if (!body[0].text) {
|
|
311
|
+
body.shift();
|
|
400
312
|
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
313
|
+
return { header: header.trim(), body };
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* The content of the comment which is not associated with a block tag.
|
|
317
|
+
*/
|
|
318
|
+
summary;
|
|
319
|
+
/**
|
|
320
|
+
* All associated block level tags.
|
|
321
|
+
*/
|
|
322
|
+
blockTags = [];
|
|
323
|
+
/**
|
|
324
|
+
* All modifier tags present on the comment, e.g. `@alpha`, `@beta`.
|
|
325
|
+
*/
|
|
326
|
+
modifierTags = new Set();
|
|
327
|
+
/**
|
|
328
|
+
* Label associated with this reflection, if any (https://tsdoc.org/pages/tags/label/)
|
|
329
|
+
*/
|
|
330
|
+
label;
|
|
331
|
+
/**
|
|
332
|
+
* Full path to the file where this comment originated from, if any.
|
|
333
|
+
* This field will not be serialized, so will not be present when handling JSON-revived reflections.
|
|
334
|
+
*
|
|
335
|
+
* Note: This field is non-enumerable to make testing comment contents with `deepEqual` easier.
|
|
336
|
+
*/
|
|
337
|
+
sourcePath = __runInitializers(this, _sourcePath_initializers, void 0);
|
|
338
|
+
/**
|
|
339
|
+
* Internal discovery ID used to prevent symbol comments from
|
|
340
|
+
* being duplicated on signatures. Only set when the comment was created
|
|
341
|
+
* from a `ts.CommentRange`.
|
|
342
|
+
* @internal
|
|
343
|
+
*/
|
|
344
|
+
discoveryId = (__runInitializers(this, _sourcePath_extraInitializers), __runInitializers(this, _discoveryId_initializers, void 0));
|
|
345
|
+
/**
|
|
346
|
+
* If the comment was inherited from a different "parent" declaration
|
|
347
|
+
* (see #2545), then it is desirable to know this as any `@param` tags
|
|
348
|
+
* which do not apply should not cause warnings. This is not serialized,
|
|
349
|
+
* and only set when the comment was created from a `ts.CommentRange`.
|
|
350
|
+
*/
|
|
351
|
+
inheritedFromParentDeclaration = (__runInitializers(this, _discoveryId_extraInitializers), __runInitializers(this, _inheritedFromParentDeclaration_initializers, void 0));
|
|
352
|
+
/**
|
|
353
|
+
* Creates a new Comment instance.
|
|
354
|
+
*/
|
|
355
|
+
constructor(summary = [], blockTags = [], modifierTags = new Set()) {
|
|
356
|
+
__runInitializers(this, _inheritedFromParentDeclaration_extraInitializers);
|
|
357
|
+
this.summary = summary;
|
|
358
|
+
this.blockTags = blockTags;
|
|
359
|
+
this.modifierTags = modifierTags;
|
|
360
|
+
extractLabelTag(this);
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Gets either the `@summary` tag, or a short version of the comment summary
|
|
364
|
+
* section for rendering in module/namespace pages.
|
|
365
|
+
*/
|
|
366
|
+
getShortSummary(useFirstParagraph) {
|
|
367
|
+
const tag = this.getTag("@summary");
|
|
368
|
+
if (tag)
|
|
369
|
+
return tag.content;
|
|
370
|
+
if (!useFirstParagraph)
|
|
371
|
+
return [];
|
|
372
|
+
let partsEnd = this.summary.findIndex((part) => {
|
|
373
|
+
switch (part.kind) {
|
|
374
|
+
case "text":
|
|
375
|
+
return part.text.includes("\n\n");
|
|
376
|
+
case "code":
|
|
377
|
+
return part.text.includes("\n");
|
|
378
|
+
case "inline-tag":
|
|
379
|
+
case "relative-link":
|
|
380
|
+
return false;
|
|
381
|
+
default:
|
|
382
|
+
assertNever(part);
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
const foundEnd = partsEnd !== -1;
|
|
386
|
+
if (partsEnd === -1) {
|
|
387
|
+
partsEnd = this.summary.length - 1;
|
|
406
388
|
}
|
|
407
|
-
|
|
408
|
-
|
|
389
|
+
const summaryParts = this.summary.slice(0, partsEnd);
|
|
390
|
+
if (partsEnd !== -1) {
|
|
391
|
+
const text = this.summary[partsEnd].text;
|
|
392
|
+
const paragraphEnd = text.indexOf("\n\n");
|
|
393
|
+
if (paragraphEnd !== -1) {
|
|
394
|
+
summaryParts.push({
|
|
395
|
+
...this.summary[partsEnd],
|
|
396
|
+
text: text.slice(0, paragraphEnd),
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
else if (!foundEnd) {
|
|
400
|
+
summaryParts.push(this.summary[partsEnd]);
|
|
401
|
+
}
|
|
409
402
|
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
403
|
+
return summaryParts;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Checks if this comment is roughly equal to the other comment.
|
|
407
|
+
* This isn't exactly equal, but just "roughly equal" by the comment
|
|
408
|
+
* text.
|
|
409
|
+
*/
|
|
410
|
+
similarTo(other) {
|
|
411
|
+
if (Comment.combineDisplayParts(this.summary) !==
|
|
412
|
+
Comment.combineDisplayParts(other.summary)) {
|
|
413
|
+
return false;
|
|
416
414
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
modifierTags: this.modifierTags.size > 0
|
|
422
|
-
? Array.from(this.modifierTags)
|
|
423
|
-
: undefined,
|
|
424
|
-
label: this.label,
|
|
425
|
-
};
|
|
415
|
+
// Ignore modifier tags, as they could cause false negatives
|
|
416
|
+
// if a cascaded modifier tag is present in one comment but not the other.
|
|
417
|
+
if (this.blockTags.length !== other.blockTags.length) {
|
|
418
|
+
return false;
|
|
426
419
|
}
|
|
427
|
-
|
|
428
|
-
this.
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
const tag = new CommentTag(tagObj.tag, []);
|
|
432
|
-
de.fromObject(tag, tagObj);
|
|
433
|
-
return tag;
|
|
434
|
-
}) || [];
|
|
435
|
-
this.modifierTags = new Set(obj.modifierTags);
|
|
436
|
-
this.label = obj.label;
|
|
420
|
+
for (let i = 0; i < this.blockTags.length; ++i) {
|
|
421
|
+
if (!this.blockTags[i].similarTo(other.blockTags[i])) {
|
|
422
|
+
return false;
|
|
423
|
+
}
|
|
437
424
|
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
425
|
+
return true;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Create a deep clone of this comment.
|
|
429
|
+
*/
|
|
430
|
+
clone() {
|
|
431
|
+
const comment = new Comment(Comment.cloneDisplayParts(this.summary), this.blockTags.map((tag) => tag.clone()), new Set(this.modifierTags));
|
|
432
|
+
comment.discoveryId = this.discoveryId;
|
|
433
|
+
comment.sourcePath = this.sourcePath;
|
|
434
|
+
comment.inheritedFromParentDeclaration =
|
|
435
|
+
this.inheritedFromParentDeclaration;
|
|
436
|
+
return comment;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Returns true if this comment is completely empty.
|
|
440
|
+
* @internal
|
|
441
|
+
*/
|
|
442
|
+
isEmpty() {
|
|
443
|
+
return !this.hasVisibleComponent() && this.modifierTags.size === 0;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Has this comment a visible component?
|
|
447
|
+
*
|
|
448
|
+
* @returns TRUE when this comment has a visible component.
|
|
449
|
+
*/
|
|
450
|
+
hasVisibleComponent() {
|
|
451
|
+
return (this.summary.some((x) => x.kind !== "text" || x.text !== "") ||
|
|
452
|
+
this.blockTags.length > 0);
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Test whether this comment contains a tag with the given name.
|
|
456
|
+
*
|
|
457
|
+
* @param tagName The name of the tag to look for.
|
|
458
|
+
* @returns TRUE when this comment contains a tag with the given name, otherwise FALSE.
|
|
459
|
+
*/
|
|
460
|
+
hasModifier(tagName) {
|
|
461
|
+
return this.modifierTags.has(tagName);
|
|
462
|
+
}
|
|
463
|
+
removeModifier(tagName) {
|
|
464
|
+
this.modifierTags.delete(tagName);
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Return the first tag with the given name.
|
|
468
|
+
*
|
|
469
|
+
* @param tagName The name of the tag to look for.
|
|
470
|
+
* @returns The found tag or undefined.
|
|
471
|
+
*/
|
|
472
|
+
getTag(tagName) {
|
|
473
|
+
return this.blockTags.find((tag) => tag.tag === tagName);
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Get all tags with the given tag name.
|
|
477
|
+
*/
|
|
478
|
+
getTags(tagName) {
|
|
479
|
+
return this.blockTags.filter((tag) => tag.tag === tagName);
|
|
480
|
+
}
|
|
481
|
+
getIdentifiedTag(identifier, tagName) {
|
|
482
|
+
return this.blockTags.find((tag) => tag.tag === tagName && tag.name === identifier);
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Removes all block tags with the given tag name from the comment.
|
|
486
|
+
* @param tagName
|
|
487
|
+
*/
|
|
488
|
+
removeTags(tagName) {
|
|
489
|
+
removeIf(this.blockTags, (tag) => tag.tag === tagName);
|
|
490
|
+
}
|
|
491
|
+
toObject(serializer) {
|
|
492
|
+
return {
|
|
493
|
+
summary: Comment.serializeDisplayParts(serializer, this.summary),
|
|
494
|
+
blockTags: serializer.toObjectsOptional(this.blockTags),
|
|
495
|
+
modifierTags: this.modifierTags.size > 0
|
|
496
|
+
? Array.from(this.modifierTags)
|
|
497
|
+
: undefined,
|
|
498
|
+
label: this.label,
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
fromObject(de, obj) {
|
|
502
|
+
this.summary = Comment.deserializeDisplayParts(de, obj.summary);
|
|
503
|
+
this.blockTags =
|
|
504
|
+
obj.blockTags?.map((tagObj) => {
|
|
505
|
+
const tag = new CommentTag(tagObj.tag, []);
|
|
506
|
+
de.fromObject(tag, tagObj);
|
|
507
|
+
return tag;
|
|
508
|
+
}) || [];
|
|
509
|
+
this.modifierTags = new Set(obj.modifierTags);
|
|
510
|
+
this.label = obj.label;
|
|
511
|
+
}
|
|
512
|
+
};
|
|
450
513
|
})();
|
|
451
|
-
|
|
514
|
+
export { Comment };
|
|
452
515
|
function extractLabelTag(comment) {
|
|
453
516
|
const index = comment.summary.findIndex((part) => part.kind === "inline-tag" && part.tag === "@label");
|
|
454
517
|
if (index !== -1) {
|