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,151 +1,119 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.discoverFileComments = discoverFileComments;
|
|
30
|
-
exports.discoverNodeComment = discoverNodeComment;
|
|
31
|
-
exports.discoverComment = discoverComment;
|
|
32
|
-
exports.discoverSignatureComment = discoverSignatureComment;
|
|
33
|
-
const typescript_1 = __importDefault(require("typescript"));
|
|
34
|
-
const models_1 = require("../../models");
|
|
35
|
-
const utils_1 = require("../../utils");
|
|
36
|
-
const declaration_1 = require("../../utils/options/declaration");
|
|
37
|
-
const paths_1 = require("../../utils/paths");
|
|
38
|
-
const assert_1 = __importStar(require("assert"));
|
|
39
|
-
const array_1 = require("../../utils/array");
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { ReflectionKind } from "../../models/index.js";
|
|
3
|
+
import { assertNever } from "../../utils/index.js";
|
|
4
|
+
import { CommentStyle } from "../../utils/options/declaration.js";
|
|
5
|
+
import { nicePath } from "../../utils/paths.js";
|
|
6
|
+
import { ok } from "assert";
|
|
7
|
+
import { filter, firstDefined } from "../../utils/array.js";
|
|
40
8
|
const variablePropertyKinds = [
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
9
|
+
ts.SyntaxKind.PropertyDeclaration,
|
|
10
|
+
ts.SyntaxKind.PropertySignature,
|
|
11
|
+
ts.SyntaxKind.BinaryExpression,
|
|
12
|
+
ts.SyntaxKind.PropertyAssignment,
|
|
13
|
+
ts.SyntaxKind.ShorthandPropertyAssignment,
|
|
46
14
|
// class X { constructor(/** Comment */ readonly z: string) }
|
|
47
|
-
|
|
15
|
+
ts.SyntaxKind.Parameter,
|
|
48
16
|
// Variable values
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
17
|
+
ts.SyntaxKind.VariableDeclaration,
|
|
18
|
+
ts.SyntaxKind.BindingElement,
|
|
19
|
+
ts.SyntaxKind.ExportAssignment,
|
|
20
|
+
ts.SyntaxKind.PropertyAccessExpression,
|
|
53
21
|
];
|
|
54
22
|
// Note: This does NOT include JSDoc syntax kinds. This is important!
|
|
55
23
|
// Comments from @typedef and @callback tags are handled specially by
|
|
56
24
|
// the JSDoc converter because we only want part of the comment when
|
|
57
25
|
// getting them.
|
|
58
26
|
const wantedKinds = {
|
|
59
|
-
[
|
|
60
|
-
|
|
61
|
-
|
|
27
|
+
[ReflectionKind.Project]: [
|
|
28
|
+
ts.SyntaxKind.SourceFile,
|
|
29
|
+
ts.SyntaxKind.ModuleDeclaration,
|
|
62
30
|
],
|
|
63
|
-
[
|
|
64
|
-
|
|
65
|
-
|
|
31
|
+
[ReflectionKind.Module]: [
|
|
32
|
+
ts.SyntaxKind.SourceFile,
|
|
33
|
+
ts.SyntaxKind.ModuleDeclaration,
|
|
66
34
|
],
|
|
67
|
-
[
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
35
|
+
[ReflectionKind.Namespace]: [
|
|
36
|
+
ts.SyntaxKind.ModuleDeclaration,
|
|
37
|
+
ts.SyntaxKind.SourceFile,
|
|
38
|
+
ts.SyntaxKind.BindingElement,
|
|
39
|
+
ts.SyntaxKind.ExportSpecifier,
|
|
40
|
+
ts.SyntaxKind.NamespaceExport,
|
|
73
41
|
// @namespace support
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
42
|
+
ts.SyntaxKind.VariableDeclaration,
|
|
43
|
+
ts.SyntaxKind.BindingElement,
|
|
44
|
+
ts.SyntaxKind.ExportAssignment,
|
|
45
|
+
ts.SyntaxKind.PropertyAccessExpression,
|
|
46
|
+
ts.SyntaxKind.PropertyDeclaration,
|
|
47
|
+
ts.SyntaxKind.PropertyAssignment,
|
|
48
|
+
ts.SyntaxKind.ShorthandPropertyAssignment,
|
|
81
49
|
],
|
|
82
|
-
[
|
|
83
|
-
|
|
84
|
-
|
|
50
|
+
[ReflectionKind.Enum]: [
|
|
51
|
+
ts.SyntaxKind.EnumDeclaration,
|
|
52
|
+
ts.SyntaxKind.VariableDeclaration,
|
|
85
53
|
],
|
|
86
|
-
[
|
|
87
|
-
|
|
54
|
+
[ReflectionKind.EnumMember]: [
|
|
55
|
+
ts.SyntaxKind.EnumMember,
|
|
88
56
|
// These here so that @enum gets comments
|
|
89
|
-
|
|
90
|
-
|
|
57
|
+
ts.SyntaxKind.PropertyAssignment,
|
|
58
|
+
ts.SyntaxKind.PropertySignature,
|
|
91
59
|
],
|
|
92
|
-
[
|
|
93
|
-
[
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
60
|
+
[ReflectionKind.Variable]: variablePropertyKinds,
|
|
61
|
+
[ReflectionKind.Function]: [
|
|
62
|
+
ts.SyntaxKind.FunctionDeclaration,
|
|
63
|
+
ts.SyntaxKind.BindingElement,
|
|
64
|
+
ts.SyntaxKind.VariableDeclaration,
|
|
65
|
+
ts.SyntaxKind.ExportAssignment,
|
|
66
|
+
ts.SyntaxKind.PropertyAccessExpression,
|
|
67
|
+
ts.SyntaxKind.PropertyDeclaration,
|
|
68
|
+
ts.SyntaxKind.PropertyAssignment,
|
|
69
|
+
ts.SyntaxKind.ShorthandPropertyAssignment,
|
|
102
70
|
],
|
|
103
|
-
[
|
|
104
|
-
|
|
105
|
-
|
|
71
|
+
[ReflectionKind.Class]: [
|
|
72
|
+
ts.SyntaxKind.ClassDeclaration,
|
|
73
|
+
ts.SyntaxKind.BindingElement,
|
|
106
74
|
// If marked with @class
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
75
|
+
ts.SyntaxKind.VariableDeclaration,
|
|
76
|
+
ts.SyntaxKind.ExportAssignment,
|
|
77
|
+
ts.SyntaxKind.FunctionDeclaration,
|
|
110
78
|
],
|
|
111
|
-
[
|
|
112
|
-
|
|
113
|
-
|
|
79
|
+
[ReflectionKind.Interface]: [
|
|
80
|
+
ts.SyntaxKind.InterfaceDeclaration,
|
|
81
|
+
ts.SyntaxKind.TypeAliasDeclaration,
|
|
114
82
|
],
|
|
115
|
-
[
|
|
116
|
-
[
|
|
117
|
-
[
|
|
118
|
-
|
|
119
|
-
|
|
83
|
+
[ReflectionKind.Constructor]: [ts.SyntaxKind.Constructor],
|
|
84
|
+
[ReflectionKind.Property]: variablePropertyKinds,
|
|
85
|
+
[ReflectionKind.Method]: [
|
|
86
|
+
ts.SyntaxKind.FunctionDeclaration,
|
|
87
|
+
ts.SyntaxKind.MethodDeclaration,
|
|
120
88
|
],
|
|
121
|
-
[
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
89
|
+
[ReflectionKind.CallSignature]: [
|
|
90
|
+
ts.SyntaxKind.FunctionDeclaration,
|
|
91
|
+
ts.SyntaxKind.VariableDeclaration,
|
|
92
|
+
ts.SyntaxKind.MethodDeclaration,
|
|
93
|
+
ts.SyntaxKind.MethodDeclaration,
|
|
94
|
+
ts.SyntaxKind.PropertyDeclaration,
|
|
95
|
+
ts.SyntaxKind.PropertySignature,
|
|
96
|
+
ts.SyntaxKind.CallSignature,
|
|
129
97
|
],
|
|
130
|
-
[
|
|
131
|
-
[
|
|
132
|
-
[
|
|
133
|
-
[
|
|
134
|
-
[
|
|
135
|
-
[
|
|
136
|
-
[
|
|
137
|
-
[
|
|
138
|
-
[
|
|
139
|
-
[
|
|
140
|
-
|
|
141
|
-
|
|
98
|
+
[ReflectionKind.IndexSignature]: [ts.SyntaxKind.IndexSignature],
|
|
99
|
+
[ReflectionKind.ConstructorSignature]: [ts.SyntaxKind.ConstructSignature],
|
|
100
|
+
[ReflectionKind.Parameter]: [ts.SyntaxKind.Parameter],
|
|
101
|
+
[ReflectionKind.TypeLiteral]: [ts.SyntaxKind.TypeLiteral],
|
|
102
|
+
[ReflectionKind.TypeParameter]: [ts.SyntaxKind.TypeParameter],
|
|
103
|
+
[ReflectionKind.Accessor]: [ts.SyntaxKind.PropertyDeclaration],
|
|
104
|
+
[ReflectionKind.GetSignature]: [ts.SyntaxKind.GetAccessor],
|
|
105
|
+
[ReflectionKind.SetSignature]: [ts.SyntaxKind.SetAccessor],
|
|
106
|
+
[ReflectionKind.TypeAlias]: [ts.SyntaxKind.TypeAliasDeclaration],
|
|
107
|
+
[ReflectionKind.Reference]: [
|
|
108
|
+
ts.SyntaxKind.NamespaceExport,
|
|
109
|
+
ts.SyntaxKind.ExportSpecifier,
|
|
142
110
|
],
|
|
143
111
|
// Non-TS kind, will never have comments.
|
|
144
|
-
[
|
|
112
|
+
[ReflectionKind.Document]: [],
|
|
145
113
|
};
|
|
146
|
-
function discoverFileComments(node, commentStyle) {
|
|
114
|
+
export function discoverFileComments(node, commentStyle) {
|
|
147
115
|
const text = node.text;
|
|
148
|
-
const comments = collectCommentRanges(
|
|
116
|
+
const comments = collectCommentRanges(ts.getLeadingCommentRanges(text, node.pos));
|
|
149
117
|
const selectedDocComments = comments.filter((ranges) => permittedRange(text, ranges, commentStyle));
|
|
150
118
|
return selectedDocComments.map((ranges) => {
|
|
151
119
|
return {
|
|
@@ -156,9 +124,9 @@ function discoverFileComments(node, commentStyle) {
|
|
|
156
124
|
};
|
|
157
125
|
});
|
|
158
126
|
}
|
|
159
|
-
function discoverNodeComment(node, commentStyle) {
|
|
127
|
+
export function discoverNodeComment(node, commentStyle) {
|
|
160
128
|
const text = node.getSourceFile().text;
|
|
161
|
-
const comments = collectCommentRanges(
|
|
129
|
+
const comments = collectCommentRanges(ts.getLeadingCommentRanges(text, node.pos));
|
|
162
130
|
comments.reverse();
|
|
163
131
|
const selectedDocComment = comments.find((ranges) => permittedRange(text, ranges, commentStyle));
|
|
164
132
|
if (selectedDocComment) {
|
|
@@ -174,7 +142,7 @@ function checkCommentDeclarations(commentNodes, reverse, commentStyle) {
|
|
|
174
142
|
const discovered = [];
|
|
175
143
|
for (const { node, inheritedFromParentDeclaration } of commentNodes) {
|
|
176
144
|
const text = node.getSourceFile().text;
|
|
177
|
-
const comments = collectCommentRanges(
|
|
145
|
+
const comments = collectCommentRanges(ts.getLeadingCommentRanges(text, node.pos));
|
|
178
146
|
if (reverse) {
|
|
179
147
|
comments.reverse();
|
|
180
148
|
}
|
|
@@ -190,22 +158,22 @@ function checkCommentDeclarations(commentNodes, reverse, commentStyle) {
|
|
|
190
158
|
}
|
|
191
159
|
return discovered;
|
|
192
160
|
}
|
|
193
|
-
function discoverComment(symbol, kind, logger, commentStyle, checker) {
|
|
161
|
+
export function discoverComment(symbol, kind, logger, commentStyle, checker, declarationWarnings) {
|
|
194
162
|
// For a module comment, we want the first one defined in the file,
|
|
195
163
|
// not the last one, since that will apply to the import or declaration.
|
|
196
|
-
const reverse = !symbol.declarations?.some(
|
|
197
|
-
const wantedDeclarations =
|
|
164
|
+
const reverse = !symbol.declarations?.some(ts.isSourceFile);
|
|
165
|
+
const wantedDeclarations = filter(symbol.declarations, (decl) => wantedKinds[kind].includes(decl.kind));
|
|
198
166
|
const commentNodes = wantedDeclarations.flatMap((decl) => declarationToCommentNodes(decl, checker));
|
|
199
167
|
// Special behavior here!
|
|
200
168
|
// Signatures and symbols have two distinct discovery methods as of TypeDoc 0.26.
|
|
201
169
|
// This method discovers comments for symbols, and function-likes will only have
|
|
202
170
|
// a symbol comment if there is more than one signature (== more than one declaration)
|
|
203
171
|
// and there is a comment on the implementation signature.
|
|
204
|
-
if (kind &
|
|
172
|
+
if (kind & ReflectionKind.ContainsCallSignatures) {
|
|
205
173
|
const canHaveOverloads = wantedDeclarations.some((node) => [
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
174
|
+
ts.SyntaxKind.FunctionDeclaration,
|
|
175
|
+
ts.SyntaxKind.MethodDeclaration,
|
|
176
|
+
ts.SyntaxKind.Constructor,
|
|
209
177
|
].includes(node.kind));
|
|
210
178
|
const isOverloaded = canHaveOverloads && wantedDeclarations.length > 1;
|
|
211
179
|
if (isOverloaded) {
|
|
@@ -235,11 +203,13 @@ function discoverComment(symbol, kind, logger, commentStyle, checker) {
|
|
|
235
203
|
return discovered[0];
|
|
236
204
|
default: {
|
|
237
205
|
if (discovered.filter((n) => !n.inheritedFromParentDeclaration)
|
|
238
|
-
.length > 1
|
|
206
|
+
.length > 1 &&
|
|
207
|
+
(declarationWarnings ||
|
|
208
|
+
discovered.some((dc) => !dc.file.isDeclarationFile))) {
|
|
239
209
|
logger.warn(logger.i18n.symbol_0_has_multiple_declarations_with_comment(symbol.name));
|
|
240
210
|
const locations = discovered.map(({ file, ranges: [{ pos }] }) => {
|
|
241
|
-
const path =
|
|
242
|
-
const line =
|
|
211
|
+
const path = nicePath(file.fileName);
|
|
212
|
+
const line = ts.getLineAndCharacterOfPosition(file, pos).line +
|
|
243
213
|
1;
|
|
244
214
|
return `${path}:${line}`;
|
|
245
215
|
});
|
|
@@ -249,16 +219,16 @@ function discoverComment(symbol, kind, logger, commentStyle, checker) {
|
|
|
249
219
|
}
|
|
250
220
|
}
|
|
251
221
|
}
|
|
252
|
-
function discoverSignatureComment(declaration, checker, commentStyle) {
|
|
222
|
+
export function discoverSignatureComment(declaration, checker, commentStyle) {
|
|
253
223
|
for (const { node, inheritedFromParentDeclaration, } of declarationToCommentNodes(declaration, checker)) {
|
|
254
|
-
if (
|
|
224
|
+
if (ts.isJSDocSignature(node)) {
|
|
255
225
|
const comment = node.parent.parent;
|
|
256
|
-
|
|
226
|
+
ok(ts.isJSDoc(comment));
|
|
257
227
|
return {
|
|
258
228
|
file: node.getSourceFile(),
|
|
259
229
|
ranges: [
|
|
260
230
|
{
|
|
261
|
-
kind:
|
|
231
|
+
kind: ts.SyntaxKind.MultiLineCommentTrivia,
|
|
262
232
|
pos: comment.pos,
|
|
263
233
|
end: comment.end,
|
|
264
234
|
},
|
|
@@ -268,7 +238,7 @@ function discoverSignatureComment(declaration, checker, commentStyle) {
|
|
|
268
238
|
};
|
|
269
239
|
}
|
|
270
240
|
const text = node.getSourceFile().text;
|
|
271
|
-
const comments = collectCommentRanges(
|
|
241
|
+
const comments = collectCommentRanges(ts.getLeadingCommentRanges(text, node.pos));
|
|
272
242
|
comments.reverse();
|
|
273
243
|
const comment = comments.find((ranges) => permittedRange(text, ranges, commentStyle));
|
|
274
244
|
if (comment) {
|
|
@@ -282,15 +252,15 @@ function discoverSignatureComment(declaration, checker, commentStyle) {
|
|
|
282
252
|
}
|
|
283
253
|
}
|
|
284
254
|
function findJsDocForComment(node, ranges) {
|
|
285
|
-
if (ranges[0].kind ===
|
|
286
|
-
const jsDocs =
|
|
255
|
+
if (ranges[0].kind === ts.SyntaxKind.MultiLineCommentTrivia) {
|
|
256
|
+
const jsDocs = ts
|
|
287
257
|
.getJSDocCommentsAndTags(node)
|
|
288
|
-
.map((doc) =>
|
|
289
|
-
if (
|
|
258
|
+
.map((doc) => ts.findAncestor(doc, ts.isJSDoc));
|
|
259
|
+
if (ts.isSourceFile(node)) {
|
|
290
260
|
if (node.statements.length) {
|
|
291
|
-
jsDocs.push(...
|
|
261
|
+
jsDocs.push(...ts
|
|
292
262
|
.getJSDocCommentsAndTags(node.statements[0])
|
|
293
|
-
.map((doc) =>
|
|
263
|
+
.map((doc) => ts.findAncestor(doc, ts.isJSDoc)));
|
|
294
264
|
}
|
|
295
265
|
}
|
|
296
266
|
return jsDocs.find((doc) => doc.pos === ranges[0].pos);
|
|
@@ -310,7 +280,7 @@ function findJsDocForComment(node, ranges) {
|
|
|
310
280
|
* @return TRUE if the given node is the topmost module declaration, FALSE otherwise.
|
|
311
281
|
*/
|
|
312
282
|
function isTopmostModuleDeclaration(node) {
|
|
313
|
-
return node.getChildren().some(
|
|
283
|
+
return node.getChildren().some(ts.isModuleBlock);
|
|
314
284
|
}
|
|
315
285
|
/**
|
|
316
286
|
* Return the root module declaration of the given module declaration.
|
|
@@ -323,7 +293,7 @@ function isTopmostModuleDeclaration(node) {
|
|
|
323
293
|
* ```
|
|
324
294
|
*/
|
|
325
295
|
function getRootModuleDeclaration(node) {
|
|
326
|
-
while (node.parent.kind ===
|
|
296
|
+
while (node.parent.kind === ts.SyntaxKind.ModuleDeclaration) {
|
|
327
297
|
const parent = node.parent;
|
|
328
298
|
if (node.name.pos === parent.name.end + 1) {
|
|
329
299
|
node = parent;
|
|
@@ -340,17 +310,17 @@ function declarationToCommentNodeIgnoringParents(node) {
|
|
|
340
310
|
return node;
|
|
341
311
|
// function foo(x: number)
|
|
342
312
|
// ^^^^^^^^^
|
|
343
|
-
if (node.kind ===
|
|
313
|
+
if (node.kind === ts.SyntaxKind.Parameter) {
|
|
344
314
|
return node;
|
|
345
315
|
}
|
|
346
316
|
// const abc = 123
|
|
347
317
|
// ^^^
|
|
348
|
-
if (node.parent.kind ===
|
|
318
|
+
if (node.parent.kind === ts.SyntaxKind.VariableDeclarationList) {
|
|
349
319
|
return node.parent.parent;
|
|
350
320
|
}
|
|
351
321
|
// const a = () => {}
|
|
352
322
|
// ^^^^^^^^
|
|
353
|
-
if (node.parent.kind ===
|
|
323
|
+
if (node.parent.kind === ts.SyntaxKind.VariableDeclaration) {
|
|
354
324
|
return node.parent.parent.parent;
|
|
355
325
|
}
|
|
356
326
|
// class X { y = () => {} }
|
|
@@ -361,13 +331,13 @@ function declarationToCommentNodeIgnoringParents(node) {
|
|
|
361
331
|
// export default () => {}
|
|
362
332
|
// ^^^^^^^^
|
|
363
333
|
if ([
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
334
|
+
ts.SyntaxKind.PropertyDeclaration,
|
|
335
|
+
ts.SyntaxKind.BinaryExpression,
|
|
336
|
+
ts.SyntaxKind.ExportAssignment,
|
|
367
337
|
].includes(node.parent.kind)) {
|
|
368
338
|
return node.parent;
|
|
369
339
|
}
|
|
370
|
-
if (
|
|
340
|
+
if (ts.isModuleDeclaration(node)) {
|
|
371
341
|
if (!isTopmostModuleDeclaration(node)) {
|
|
372
342
|
return;
|
|
373
343
|
}
|
|
@@ -375,10 +345,10 @@ function declarationToCommentNodeIgnoringParents(node) {
|
|
|
375
345
|
return getRootModuleDeclaration(node);
|
|
376
346
|
}
|
|
377
347
|
}
|
|
378
|
-
if (node.kind ===
|
|
348
|
+
if (node.kind === ts.SyntaxKind.ExportSpecifier) {
|
|
379
349
|
return node.parent.parent;
|
|
380
350
|
}
|
|
381
|
-
if (
|
|
351
|
+
if (ts.SyntaxKind.NamespaceExport === node.kind) {
|
|
382
352
|
return node.parent;
|
|
383
353
|
}
|
|
384
354
|
}
|
|
@@ -399,13 +369,13 @@ function declarationToCommentNodes(node, checker) {
|
|
|
399
369
|
},
|
|
400
370
|
];
|
|
401
371
|
let overloadIndex = undefined;
|
|
402
|
-
if (
|
|
372
|
+
if (ts.isMethodDeclaration(node)) {
|
|
403
373
|
const symbol = checker.getSymbolAtLocation(node.name || node);
|
|
404
374
|
if (symbol) {
|
|
405
375
|
overloadIndex = symbol.declarations
|
|
406
376
|
?.filter((d) => d.kind === node.kind)
|
|
407
377
|
.indexOf(node);
|
|
408
|
-
(
|
|
378
|
+
ok(overloadIndex !== -1, "Should always find declaration");
|
|
409
379
|
}
|
|
410
380
|
}
|
|
411
381
|
const seenSymbols = new Set();
|
|
@@ -430,17 +400,29 @@ function declarationToCommentNodes(node, checker) {
|
|
|
430
400
|
inheritedFromParentDeclaration: true,
|
|
431
401
|
});
|
|
432
402
|
}
|
|
403
|
+
// With overloaded functions/methods, TypeScript will use the comment on the first signature
|
|
404
|
+
// declaration
|
|
405
|
+
if ((ts.isFunctionDeclaration(node) || ts.isMethodDeclaration(node)) &&
|
|
406
|
+
node.name) {
|
|
407
|
+
const symbol = checker.getSymbolAtLocation(node.name);
|
|
408
|
+
if (symbol && symbol.declarations[0] !== node) {
|
|
409
|
+
result.push({
|
|
410
|
+
node: symbol.declarations[0],
|
|
411
|
+
inheritedFromParentDeclaration: true,
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
}
|
|
433
415
|
return result;
|
|
434
416
|
}
|
|
435
417
|
// Lifted from the TS source, with a couple minor modifications
|
|
436
418
|
function findBaseOfDeclaration(checker, declaration, cb) {
|
|
437
|
-
const classOrInterfaceDeclaration = declaration.parent?.kind ===
|
|
419
|
+
const classOrInterfaceDeclaration = declaration.parent?.kind === ts.SyntaxKind.Constructor
|
|
438
420
|
? declaration.parent.parent
|
|
439
421
|
: declaration.parent;
|
|
440
422
|
if (!classOrInterfaceDeclaration)
|
|
441
423
|
return;
|
|
442
|
-
const isStaticMember =
|
|
443
|
-
return
|
|
424
|
+
const isStaticMember = ts.getCombinedModifierFlags(declaration) & ts.ModifierFlags.Static;
|
|
425
|
+
return firstDefined(ts.getAllSuperTypeNodes(classOrInterfaceDeclaration), (superTypeNode) => {
|
|
444
426
|
const baseType = checker.getTypeAtLocation(superTypeNode);
|
|
445
427
|
const type = isStaticMember && baseType.symbol
|
|
446
428
|
? checker.getTypeOfSymbol(baseType.symbol)
|
|
@@ -459,19 +441,19 @@ function collectCommentRanges(ranges) {
|
|
|
459
441
|
for (const range of ranges || []) {
|
|
460
442
|
collect.push(range);
|
|
461
443
|
switch (range.kind) {
|
|
462
|
-
case
|
|
444
|
+
case ts.SyntaxKind.MultiLineCommentTrivia:
|
|
463
445
|
if (collect.length) {
|
|
464
446
|
result.push(collect);
|
|
465
447
|
collect = [];
|
|
466
448
|
}
|
|
467
449
|
result.push([range]);
|
|
468
450
|
break;
|
|
469
|
-
case
|
|
451
|
+
case ts.SyntaxKind.SingleLineCommentTrivia:
|
|
470
452
|
collect.push(range);
|
|
471
453
|
break;
|
|
472
454
|
/* istanbul ignore next */
|
|
473
455
|
default:
|
|
474
|
-
|
|
456
|
+
assertNever(range.kind);
|
|
475
457
|
}
|
|
476
458
|
}
|
|
477
459
|
if (collect.length) {
|
|
@@ -481,14 +463,14 @@ function collectCommentRanges(ranges) {
|
|
|
481
463
|
}
|
|
482
464
|
function permittedRange(text, ranges, commentStyle) {
|
|
483
465
|
switch (commentStyle) {
|
|
484
|
-
case
|
|
466
|
+
case CommentStyle.All:
|
|
485
467
|
return true;
|
|
486
|
-
case
|
|
487
|
-
return ranges[0].kind ===
|
|
488
|
-
case
|
|
489
|
-
return ranges[0].kind ===
|
|
490
|
-
case
|
|
491
|
-
return (ranges[0].kind ===
|
|
468
|
+
case CommentStyle.Block:
|
|
469
|
+
return ranges[0].kind === ts.SyntaxKind.MultiLineCommentTrivia;
|
|
470
|
+
case CommentStyle.Line:
|
|
471
|
+
return ranges[0].kind === ts.SyntaxKind.SingleLineCommentTrivia;
|
|
472
|
+
case CommentStyle.JSDoc:
|
|
473
|
+
return (ranges[0].kind === ts.SyntaxKind.MultiLineCommentTrivia &&
|
|
492
474
|
text[ranges[0].pos] === "/" &&
|
|
493
475
|
text[ranges[0].pos + 1] === "*" &&
|
|
494
476
|
text[ranges[0].pos + 2] === "*");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
|
-
import { Comment, ReflectionKind } from "../../models";
|
|
3
|
-
import { type Logger } from "../../utils";
|
|
4
|
-
import type { CommentStyle, JsDocCompatibility } from "../../utils/options/declaration";
|
|
5
|
-
import type { FileRegistry } from "../../models/FileRegistry";
|
|
2
|
+
import { Comment, ReflectionKind } from "../../models/index.js";
|
|
3
|
+
import { type Logger } from "../../utils/index.js";
|
|
4
|
+
import type { CommentStyle, JsDocCompatibility } from "../../utils/options/declaration.js";
|
|
5
|
+
import type { FileRegistry } from "../../models/FileRegistry.js";
|
|
6
6
|
export interface CommentParserConfig {
|
|
7
7
|
blockTags: Set<string>;
|
|
8
8
|
inlineTags: Set<string>;
|