typedoc 0.25.13 → 0.26.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/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/lib/application.d.ts +15 -3
- package/dist/lib/application.js +65 -23
- package/dist/lib/cli.js +1 -1
- package/dist/lib/converter/comments/blockLexer.d.ts +1 -1
- package/dist/lib/converter/comments/blockLexer.js +1 -2
- package/dist/lib/converter/comments/declarationReference.js +8 -8
- package/dist/lib/converter/comments/declarationReferenceResolver.d.ts +1 -1
- package/dist/lib/converter/comments/declarationReferenceResolver.js +15 -14
- package/dist/lib/converter/comments/discovery.d.ts +3 -3
- package/dist/lib/converter/comments/discovery.js +21 -19
- package/dist/lib/converter/comments/index.d.ts +1 -1
- package/dist/lib/converter/comments/index.js +35 -16
- package/dist/lib/converter/comments/lineLexer.d.ts +1 -1
- package/dist/lib/converter/comments/lineLexer.js +1 -2
- package/dist/lib/converter/comments/linkResolver.d.ts +2 -2
- package/dist/lib/converter/comments/linkResolver.js +5 -3
- package/dist/lib/converter/comments/parser.d.ts +14 -3
- package/dist/lib/converter/comments/parser.js +144 -39
- package/dist/lib/converter/comments/rawLexer.d.ts +7 -1
- package/dist/lib/converter/comments/rawLexer.js +21 -70
- package/dist/lib/converter/comments/tagName.js +1 -2
- package/dist/lib/converter/context.d.ts +7 -2
- package/dist/lib/converter/context.js +7 -2
- package/dist/lib/converter/convert-expression.js +2 -3
- package/dist/lib/converter/converter.d.ts +8 -3
- package/dist/lib/converter/converter.js +16 -13
- package/dist/lib/converter/factories/index-signature.d.ts +1 -1
- package/dist/lib/converter/factories/index-signature.js +9 -12
- package/dist/lib/converter/factories/signature.d.ts +1 -1
- package/dist/lib/converter/factories/signature.js +11 -12
- package/dist/lib/converter/jsdoc.js +2 -3
- package/dist/lib/converter/plugins/CategoryPlugin.d.ts +3 -3
- package/dist/lib/converter/plugins/CategoryPlugin.js +22 -15
- package/dist/lib/converter/plugins/CommentPlugin.d.ts +1 -1
- package/dist/lib/converter/plugins/CommentPlugin.js +58 -67
- package/dist/lib/converter/plugins/GroupPlugin.d.ts +4 -4
- package/dist/lib/converter/plugins/GroupPlugin.js +52 -18
- package/dist/lib/converter/plugins/ImplementsPlugin.js +4 -3
- package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +1 -1
- package/dist/lib/converter/plugins/InheritDocPlugin.js +5 -6
- package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +2 -2
- package/dist/lib/converter/plugins/PackagePlugin.d.ts +0 -2
- package/dist/lib/converter/plugins/PackagePlugin.js +8 -30
- package/dist/lib/converter/plugins/SourcePlugin.js +2 -2
- package/dist/lib/converter/symbols.js +31 -11
- package/dist/lib/converter/types.d.ts +1 -1
- package/dist/lib/converter/types.js +4 -5
- package/dist/lib/converter/utils/nodes.js +3 -4
- package/dist/lib/converter/utils/reflections.d.ts +1 -1
- package/dist/lib/converter/utils/reflections.js +1 -2
- package/dist/lib/converter/utils/repository.js +4 -4
- package/dist/lib/converter/utils/symbols.js +1 -2
- package/dist/lib/internationalization/index.d.ts +7 -0
- package/dist/lib/internationalization/index.js +11 -0
- package/dist/lib/internationalization/internationalization.d.ts +92 -0
- package/dist/lib/internationalization/internationalization.js +194 -0
- package/dist/lib/internationalization/locales/en.cjs +3 -0
- package/dist/lib/internationalization/locales/en.d.cts +2 -0
- package/dist/lib/internationalization/locales/test.cjs +8 -0
- package/dist/lib/internationalization/locales/test.d.cts +5 -0
- package/dist/lib/internationalization/translatable.d.ts +297 -0
- package/dist/lib/internationalization/translatable.js +322 -0
- package/dist/lib/models/ReflectionCategory.d.ts +2 -2
- package/dist/lib/models/ReflectionGroup.d.ts +2 -2
- package/dist/lib/models/comments/comment.d.ts +17 -3
- package/dist/lib/models/comments/comment.js +377 -298
- package/dist/lib/models/reflections/ReflectionSymbolId.js +2 -2
- package/dist/lib/models/reflections/abstract.d.ts +11 -8
- package/dist/lib/models/reflections/abstract.js +17 -11
- package/dist/lib/models/reflections/container.d.ts +25 -3
- package/dist/lib/models/reflections/container.js +64 -0
- package/dist/lib/models/reflections/declaration.d.ts +3 -15
- package/dist/lib/models/reflections/declaration.js +16 -21
- package/dist/lib/models/reflections/document.d.ts +27 -0
- package/dist/lib/models/reflections/document.js +43 -0
- package/dist/lib/models/reflections/index.d.ts +4 -3
- package/dist/lib/models/reflections/index.js +5 -4
- package/dist/lib/models/reflections/kind.d.ts +13 -1
- package/dist/lib/models/reflections/kind.js +12 -0
- package/dist/lib/models/reflections/parameter.d.ts +1 -1
- package/dist/lib/models/reflections/project.d.ts +2 -2
- package/dist/lib/models/reflections/project.js +8 -7
- package/dist/lib/models/reflections/signature.d.ts +2 -2
- package/dist/lib/models/reflections/type-parameter.d.ts +1 -1
- package/dist/lib/models/reflections/utils.js +1 -2
- package/dist/lib/models/reflections/variant.d.ts +2 -0
- package/dist/lib/models/types.d.ts +4 -4
- package/dist/lib/models/types.js +3 -3
- package/dist/lib/output/events.d.ts +5 -5
- package/dist/lib/output/events.js +2 -1
- package/dist/lib/output/index.d.ts +1 -1
- package/dist/lib/output/index.js +2 -1
- package/dist/lib/output/plugins/AssetsPlugin.js +1 -1
- package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +3 -1
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +28 -8
- package/dist/lib/output/plugins/SitemapPlugin.d.ts +1 -1
- package/dist/lib/output/plugins/SitemapPlugin.js +24 -13
- package/dist/lib/output/renderer.d.ts +1 -1
- package/dist/lib/output/renderer.js +5 -7
- package/dist/lib/output/themes/MarkedPlugin.d.ts +13 -24
- package/dist/lib/output/themes/MarkedPlugin.js +75 -160
- package/dist/lib/output/themes/default/DefaultTheme.d.ts +16 -4
- package/dist/lib/output/themes/default/DefaultTheme.js +62 -16
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +44 -44
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +10 -10
- package/dist/lib/output/themes/default/layouts/default.js +1 -1
- package/dist/lib/output/themes/default/partials/analytics.js +1 -2
- package/dist/lib/output/themes/default/partials/anchor-icon.js +2 -3
- package/dist/lib/output/themes/default/partials/comment.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/comment.js +3 -4
- package/dist/lib/output/themes/default/partials/footer.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/footer.js +19 -5
- package/dist/lib/output/themes/default/partials/header.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/header.js +4 -3
- package/dist/lib/output/themes/default/partials/hierarchy.js +3 -4
- package/dist/lib/output/themes/default/partials/icon.js +7 -2
- package/dist/lib/output/themes/default/partials/index.js +4 -4
- package/dist/lib/output/themes/default/partials/member.d.ts +2 -2
- package/dist/lib/output/themes/default/partials/member.declaration.js +2 -3
- package/dist/lib/output/themes/default/partials/member.js +13 -2
- package/dist/lib/output/themes/default/partials/member.reference.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.reference.js +9 -6
- package/dist/lib/output/themes/default/partials/member.signature.body.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.signature.body.js +4 -4
- package/dist/lib/output/themes/default/partials/member.signature.title.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.signature.title.js +1 -2
- package/dist/lib/output/themes/default/partials/member.sources.js +12 -6
- package/dist/lib/output/themes/default/partials/members.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/members.group.js +1 -2
- package/dist/lib/output/themes/default/partials/members.js +1 -2
- package/dist/lib/output/themes/default/partials/navigation.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/navigation.js +18 -15
- package/dist/lib/output/themes/default/partials/parameter.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/parameter.js +15 -15
- package/dist/lib/output/themes/default/partials/reflectionPreview.js +1 -2
- package/dist/lib/output/themes/default/partials/toolbar.js +4 -4
- package/dist/lib/output/themes/default/partials/type.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/type.js +14 -14
- package/dist/lib/output/themes/default/partials/typeAndParent.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/typeParameters.js +2 -3
- package/dist/lib/output/themes/default/templates/document.d.ts +5 -0
- package/dist/lib/output/themes/default/templates/document.js +7 -0
- package/dist/lib/output/themes/default/templates/hierarchy.js +1 -2
- package/dist/lib/output/themes/default/templates/reflection.d.ts +1 -1
- package/dist/lib/output/themes/default/templates/reflection.js +21 -19
- package/dist/lib/output/themes/lib.d.ts +1 -1
- package/dist/lib/output/themes/lib.js +12 -16
- package/dist/lib/serialization/deserializer.d.ts +3 -3
- package/dist/lib/serialization/deserializer.js +7 -5
- package/dist/lib/serialization/schema.d.ts +10 -3
- package/dist/lib/utils/array.js +9 -10
- package/dist/lib/utils/component.d.ts +1 -1
- package/dist/lib/utils/component.js +2 -2
- package/dist/lib/utils/entry-point.d.ts +11 -0
- package/dist/lib/utils/entry-point.js +51 -24
- package/dist/lib/utils/enum.js +6 -7
- package/dist/lib/utils/fs.js +15 -16
- package/dist/lib/utils/general.d.ts +4 -3
- package/dist/lib/utils/general.js +4 -5
- package/dist/lib/utils/highlighter.d.ts +4 -2
- package/dist/lib/utils/highlighter.js +41 -40
- package/dist/lib/utils/html.js +2 -3
- package/dist/lib/utils/index.d.ts +1 -1
- package/dist/lib/utils/index.js +1 -2
- package/dist/lib/utils/jsx.elements.d.ts +12 -0
- package/dist/lib/utils/jsx.js +4 -4
- package/dist/lib/utils/loggers.d.ts +13 -7
- package/dist/lib/utils/loggers.js +13 -10
- package/dist/lib/utils/map.d.ts +1 -1
- package/dist/lib/utils/map.js +1 -1
- package/dist/lib/utils/options/declaration.d.ts +40 -21
- package/dist/lib/utils/options/declaration.js +36 -36
- package/dist/lib/utils/options/help.d.ts +2 -1
- package/dist/lib/utils/options/help.js +10 -10
- package/dist/lib/utils/options/index.d.ts +1 -1
- package/dist/lib/utils/options/index.js +1 -2
- package/dist/lib/utils/options/options.d.ts +5 -34
- package/dist/lib/utils/options/options.js +10 -23
- package/dist/lib/utils/options/readers/arguments.js +3 -5
- package/dist/lib/utils/options/readers/package-json.js +2 -2
- package/dist/lib/utils/options/readers/tsconfig.js +8 -12
- package/dist/lib/utils/options/readers/typedoc.js +7 -6
- package/dist/lib/utils/options/sources/typedoc.js +187 -178
- package/dist/lib/utils/options/tsdoc-defaults.d.ts +1 -1
- package/dist/lib/utils/options/tsdoc-defaults.js +2 -0
- package/dist/lib/utils/package-manifest.d.ts +1 -1
- package/dist/lib/utils/package-manifest.js +9 -11
- package/dist/lib/utils/paths.js +4 -5
- package/dist/lib/utils/perf.js +3 -4
- package/dist/lib/utils/plugins.js +4 -5
- package/dist/lib/utils/reflections.d.ts +1 -1
- package/dist/lib/utils/reflections.js +2 -3
- package/dist/lib/utils/sort.d.ts +3 -2
- package/dist/lib/utils/sort.js +37 -6
- package/dist/lib/utils/tsconfig.js +3 -4
- package/dist/lib/utils/tsutils.js +2 -3
- package/dist/lib/utils/validation.js +4 -4
- package/dist/lib/validation/documentation.d.ts +1 -1
- package/dist/lib/validation/documentation.js +9 -4
- package/dist/lib/validation/exports.js +3 -5
- package/dist/lib/validation/links.js +2 -3
- package/package.json +12 -11
- package/static/main.js +4 -4
- package/static/style.css +18 -10
- package/tsdoc.json +9 -0
|
@@ -3,7 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.discoverFileComments = discoverFileComments;
|
|
7
|
+
exports.discoverNodeComment = discoverNodeComment;
|
|
8
|
+
exports.discoverComment = discoverComment;
|
|
9
|
+
exports.discoverSignatureComment = discoverSignatureComment;
|
|
7
10
|
const typescript_1 = __importDefault(require("typescript"));
|
|
8
11
|
const models_1 = require("../../models");
|
|
9
12
|
const utils_1 = require("../../utils");
|
|
@@ -106,20 +109,21 @@ const wantedKinds = {
|
|
|
106
109
|
typescript_1.default.SyntaxKind.NamespaceExport,
|
|
107
110
|
typescript_1.default.SyntaxKind.ExportSpecifier,
|
|
108
111
|
],
|
|
112
|
+
// Non-TS kind, will never have comments.
|
|
113
|
+
[models_1.ReflectionKind.Document]: [],
|
|
109
114
|
};
|
|
110
|
-
function
|
|
115
|
+
function discoverFileComments(node, commentStyle) {
|
|
111
116
|
const text = node.text;
|
|
112
117
|
const comments = collectCommentRanges(typescript_1.default.getLeadingCommentRanges(text, node.pos));
|
|
113
|
-
const
|
|
114
|
-
|
|
118
|
+
const selectedDocComments = comments.filter((ranges) => permittedRange(text, ranges, commentStyle));
|
|
119
|
+
return selectedDocComments.map((ranges) => {
|
|
115
120
|
return {
|
|
116
121
|
file: node,
|
|
117
|
-
ranges
|
|
118
|
-
jsDoc: findJsDocForComment(node,
|
|
122
|
+
ranges,
|
|
123
|
+
jsDoc: findJsDocForComment(node, ranges),
|
|
119
124
|
};
|
|
120
|
-
}
|
|
125
|
+
});
|
|
121
126
|
}
|
|
122
|
-
exports.discoverFileComment = discoverFileComment;
|
|
123
127
|
function discoverNodeComment(node, commentStyle) {
|
|
124
128
|
const text = node.getSourceFile().text;
|
|
125
129
|
const comments = collectCommentRanges(typescript_1.default.getLeadingCommentRanges(text, node.pos));
|
|
@@ -133,7 +137,6 @@ function discoverNodeComment(node, commentStyle) {
|
|
|
133
137
|
};
|
|
134
138
|
}
|
|
135
139
|
}
|
|
136
|
-
exports.discoverNodeComment = discoverNodeComment;
|
|
137
140
|
function discoverComment(symbol, kind, logger, commentStyle) {
|
|
138
141
|
// For a module comment, we want the first one defined in the file,
|
|
139
142
|
// not the last one, since that will apply to the import or declaration.
|
|
@@ -148,18 +151,19 @@ function discoverComment(symbol, kind, logger, commentStyle) {
|
|
|
148
151
|
continue;
|
|
149
152
|
}
|
|
150
153
|
seen.add(node);
|
|
151
|
-
// Special behavior here!
|
|
152
|
-
//
|
|
153
|
-
//
|
|
154
|
-
//
|
|
155
|
-
//
|
|
154
|
+
// Special behavior here!
|
|
155
|
+
// Signatures and symbols have two distinct discovery methods as of TypeDoc 0.26.
|
|
156
|
+
// This method discovers comments for symbols, and function-likes will only have
|
|
157
|
+
// a symbol comment if there is more than one signature (== more than one declaration)
|
|
158
|
+
// and there is a comment on the implementation signature.
|
|
156
159
|
if (kind & models_1.ReflectionKind.ContainsCallSignatures &&
|
|
157
160
|
[
|
|
158
161
|
typescript_1.default.SyntaxKind.FunctionDeclaration,
|
|
159
162
|
typescript_1.default.SyntaxKind.MethodDeclaration,
|
|
160
163
|
typescript_1.default.SyntaxKind.Constructor,
|
|
161
164
|
].includes(node.kind) &&
|
|
162
|
-
|
|
165
|
+
(symbol.declarations.filter((d) => wantedKinds[kind].includes(d.kind)).length === 1 ||
|
|
166
|
+
!node.body)) {
|
|
163
167
|
continue;
|
|
164
168
|
}
|
|
165
169
|
const comments = collectCommentRanges(typescript_1.default.getLeadingCommentRanges(text, node.pos));
|
|
@@ -182,18 +186,17 @@ function discoverComment(symbol, kind, logger, commentStyle) {
|
|
|
182
186
|
case 1:
|
|
183
187
|
return discovered[0];
|
|
184
188
|
default: {
|
|
185
|
-
logger.warn(
|
|
189
|
+
logger.warn(logger.i18n.symbol_0_has_multiple_declarations_with_comment(symbol.name));
|
|
186
190
|
const locations = discovered.map(({ file, ranges: [{ pos }] }) => {
|
|
187
191
|
const path = (0, paths_1.nicePath)(file.fileName);
|
|
188
192
|
const line = typescript_1.default.getLineAndCharacterOfPosition(file, pos).line + 1;
|
|
189
193
|
return `${path}:${line}`;
|
|
190
194
|
});
|
|
191
|
-
logger.info(
|
|
195
|
+
logger.info(logger.i18n.comments_for_0_are_declared_at_1(symbol.name, locations.join("\n\t")));
|
|
192
196
|
return discovered[0];
|
|
193
197
|
}
|
|
194
198
|
}
|
|
195
199
|
}
|
|
196
|
-
exports.discoverComment = discoverComment;
|
|
197
200
|
function discoverSignatureComment(declaration, commentStyle) {
|
|
198
201
|
const node = declarationToCommentNode(declaration);
|
|
199
202
|
if (!node) {
|
|
@@ -226,7 +229,6 @@ function discoverSignatureComment(declaration, commentStyle) {
|
|
|
226
229
|
};
|
|
227
230
|
}
|
|
228
231
|
}
|
|
229
|
-
exports.discoverSignatureComment = discoverSignatureComment;
|
|
230
232
|
function findJsDocForComment(node, ranges) {
|
|
231
233
|
if (ranges[0].kind === typescript_1.default.SyntaxKind.MultiLineCommentTrivia) {
|
|
232
234
|
const jsDocs = typescript_1.default
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
import { Comment, ReflectionKind } from "../../models";
|
|
3
|
-
import { Logger } from "../../utils";
|
|
3
|
+
import { type Logger } from "../../utils";
|
|
4
4
|
import type { CommentStyle, JsDocCompatibility } from "../../utils/options/declaration";
|
|
5
5
|
export interface CommentParserConfig {
|
|
6
6
|
blockTags: Set<string>;
|
|
@@ -3,7 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.clearCommentCache = clearCommentCache;
|
|
7
|
+
exports.getComment = getComment;
|
|
8
|
+
exports.getNodeComment = getNodeComment;
|
|
9
|
+
exports.getFileComment = getFileComment;
|
|
10
|
+
exports.getSignatureComment = getSignatureComment;
|
|
11
|
+
exports.getJsDocComment = getJsDocComment;
|
|
7
12
|
const typescript_1 = __importDefault(require("typescript"));
|
|
8
13
|
const models_1 = require("../../models");
|
|
9
14
|
const utils_1 = require("../../utils");
|
|
@@ -18,14 +23,15 @@ const jsDocCommentKinds = [
|
|
|
18
23
|
typescript_1.default.SyntaxKind.JSDocTemplateTag,
|
|
19
24
|
typescript_1.default.SyntaxKind.JSDocEnumTag,
|
|
20
25
|
];
|
|
26
|
+
let commentDiscoveryId = 0;
|
|
21
27
|
let commentCache = new WeakMap();
|
|
22
28
|
// We need to do this for tests so that changing the tsLinkResolution option
|
|
23
29
|
// actually works. Without it, we'd get the old parsed comment which doesn't
|
|
24
30
|
// have the TS symbols attached.
|
|
25
31
|
function clearCommentCache() {
|
|
26
32
|
commentCache = new WeakMap();
|
|
33
|
+
commentDiscoveryId = 0;
|
|
27
34
|
}
|
|
28
|
-
exports.clearCommentCache = clearCommentCache;
|
|
29
35
|
function getCommentWithCache(discovered, config, logger, checker) {
|
|
30
36
|
if (!discovered)
|
|
31
37
|
return;
|
|
@@ -45,6 +51,7 @@ function getCommentWithCache(discovered, config, logger, checker) {
|
|
|
45
51
|
default:
|
|
46
52
|
(0, utils_1.assertNever)(ranges[0].kind);
|
|
47
53
|
}
|
|
54
|
+
comment.discoveryId = ++commentDiscoveryId;
|
|
48
55
|
cache.set(ranges[0].pos, comment);
|
|
49
56
|
commentCache.set(file, cache);
|
|
50
57
|
return comment.clone();
|
|
@@ -74,9 +81,11 @@ function getComment(symbol, kind, config, logger, commentStyle, checker) {
|
|
|
74
81
|
declarations.every((d) => jsDocCommentKinds.includes(d.kind))) {
|
|
75
82
|
return getJsDocComment(declarations[0], config, logger, checker);
|
|
76
83
|
}
|
|
84
|
+
const sf = declarations.find(typescript_1.default.isSourceFile);
|
|
85
|
+
if (sf) {
|
|
86
|
+
return getFileComment(sf, config, logger, commentStyle, checker);
|
|
87
|
+
}
|
|
77
88
|
const isModule = declarations.some((decl) => {
|
|
78
|
-
if (typescript_1.default.isSourceFile(decl))
|
|
79
|
-
return true;
|
|
80
89
|
if (typescript_1.default.isModuleDeclaration(decl) && typescript_1.default.isStringLiteral(decl.name)) {
|
|
81
90
|
return true;
|
|
82
91
|
}
|
|
@@ -88,16 +97,22 @@ function getComment(symbol, kind, config, logger, commentStyle, checker) {
|
|
|
88
97
|
}
|
|
89
98
|
return comment;
|
|
90
99
|
}
|
|
91
|
-
exports.getComment = getComment;
|
|
92
100
|
function getNodeComment(node, kind, config, logger, commentStyle, checker) {
|
|
93
101
|
return getCommentImpl((0, discovery_1.discoverNodeComment)(node, commentStyle), config, logger, kind === models_1.ReflectionKind.Module, checker);
|
|
94
102
|
}
|
|
95
|
-
exports.getNodeComment = getNodeComment;
|
|
96
103
|
function getFileComment(file, config, logger, commentStyle, checker) {
|
|
97
|
-
|
|
98
|
-
|
|
104
|
+
for (const commentSource of (0, discovery_1.discoverFileComments)(file, commentStyle)) {
|
|
105
|
+
const comment = getCommentWithCache(commentSource, config, logger, checker);
|
|
106
|
+
if (comment?.getTag("@license") || comment?.getTag("@import")) {
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
if (comment?.getTag("@module") ||
|
|
110
|
+
comment?.hasModifier("@packageDocumentation")) {
|
|
111
|
+
return comment;
|
|
112
|
+
}
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
99
115
|
}
|
|
100
|
-
exports.getFileComment = getFileComment;
|
|
101
116
|
function getConstructorParamPropertyComment(symbol, config, logger, commentStyle, checker) {
|
|
102
117
|
const decl = symbol.declarations?.find(typescript_1.default.isParameter);
|
|
103
118
|
if (!decl)
|
|
@@ -106,13 +121,14 @@ function getConstructorParamPropertyComment(symbol, config, logger, commentStyle
|
|
|
106
121
|
const comment = getSignatureComment(ctor, config, logger, commentStyle, checker);
|
|
107
122
|
const paramTag = comment?.getIdentifiedTag(symbol.name, "@param");
|
|
108
123
|
if (paramTag) {
|
|
109
|
-
|
|
124
|
+
const result = new models_1.Comment(paramTag.content);
|
|
125
|
+
result.sourcePath = comment.sourcePath;
|
|
126
|
+
return result;
|
|
110
127
|
}
|
|
111
128
|
}
|
|
112
129
|
function getSignatureComment(declaration, config, logger, commentStyle, checker) {
|
|
113
130
|
return getCommentImpl((0, discovery_1.discoverSignatureComment)(declaration, commentStyle), config, logger, false, checker);
|
|
114
131
|
}
|
|
115
|
-
exports.getSignatureComment = getSignatureComment;
|
|
116
132
|
function getJsDocComment(declaration, config, logger, checker) {
|
|
117
133
|
const file = declaration.getSourceFile();
|
|
118
134
|
// First, get the whole comment. We know we'll need all of it.
|
|
@@ -134,7 +150,9 @@ function getJsDocComment(declaration, config, logger, checker) {
|
|
|
134
150
|
}, config, logger, checker);
|
|
135
151
|
// And pull out the tag we actually care about.
|
|
136
152
|
if (typescript_1.default.isJSDocEnumTag(declaration)) {
|
|
137
|
-
|
|
153
|
+
const result = new models_1.Comment(comment.getTag("@enum")?.content);
|
|
154
|
+
result.sourcePath = comment.sourcePath;
|
|
155
|
+
return result;
|
|
138
156
|
}
|
|
139
157
|
if (typescript_1.default.isJSDocTemplateTag(declaration) &&
|
|
140
158
|
declaration.comment &&
|
|
@@ -142,7 +160,7 @@ function getJsDocComment(declaration, config, logger, checker) {
|
|
|
142
160
|
// We could just put the same comment on everything, but due to how comment parsing works,
|
|
143
161
|
// we'd have to search for any @template with a name starting with the first type parameter's name
|
|
144
162
|
// which feels horribly hacky.
|
|
145
|
-
logger.warn(
|
|
163
|
+
logger.warn(logger.i18n.multiple_type_parameters_on_template_tag_unsupported(), declaration);
|
|
146
164
|
return;
|
|
147
165
|
}
|
|
148
166
|
let name;
|
|
@@ -158,10 +176,11 @@ function getJsDocComment(declaration, config, logger, checker) {
|
|
|
158
176
|
}
|
|
159
177
|
const tag = comment.getIdentifiedTag(name, `@${declaration.tagName.text}`);
|
|
160
178
|
if (!tag) {
|
|
161
|
-
logger.error(
|
|
179
|
+
logger.error(logger.i18n.failed_to_find_jsdoc_tag_for_name_0(name), declaration);
|
|
162
180
|
}
|
|
163
181
|
else {
|
|
164
|
-
|
|
182
|
+
const result = new models_1.Comment(models_1.Comment.cloneDisplayParts(tag.content));
|
|
183
|
+
result.sourcePath = comment.sourcePath;
|
|
184
|
+
return result;
|
|
165
185
|
}
|
|
166
186
|
}
|
|
167
|
-
exports.getJsDocComment = getJsDocComment;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.lexLineComments =
|
|
3
|
+
exports.lexLineComments = lexLineComments;
|
|
4
4
|
const lexer_1 = require("./lexer");
|
|
5
5
|
function* lexLineComments(file, ranges) {
|
|
6
6
|
// Wrapper around our real lex function to collapse adjacent text tokens.
|
|
@@ -27,7 +27,6 @@ function* lexLineComments(file, ranges) {
|
|
|
27
27
|
}
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
exports.lexLineComments = lexLineComments;
|
|
31
30
|
function* lexLineComments2(file, pos, end) {
|
|
32
31
|
// Trailing whitespace
|
|
33
32
|
while (pos < end && /\s/.test(file[end - 1])) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Comment, CommentDisplayPart, Reflection, ReflectionSymbolId } from "../../models";
|
|
2
|
-
import { DeclarationReference } from "./declarationReference";
|
|
1
|
+
import { type Comment, type CommentDisplayPart, type Reflection, ReflectionSymbolId } from "../../models";
|
|
2
|
+
import { type DeclarationReference } from "./declarationReference";
|
|
3
3
|
export type ExternalResolveResult = {
|
|
4
4
|
target: string;
|
|
5
5
|
caption?: string;
|
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.resolveLinks = resolveLinks;
|
|
7
|
+
exports.resolvePartLinks = resolvePartLinks;
|
|
7
8
|
const typescript_1 = __importDefault(require("typescript"));
|
|
8
9
|
const models_1 = require("../../models");
|
|
9
10
|
const declarationReference_1 = require("./declarationReference");
|
|
@@ -17,12 +18,13 @@ function resolveLinks(comment, reflection, externalResolver, options) {
|
|
|
17
18
|
if (reflection instanceof models_1.DeclarationReflection && reflection.readme) {
|
|
18
19
|
reflection.readme = resolvePartLinks(reflection, reflection.readme, externalResolver, options);
|
|
19
20
|
}
|
|
21
|
+
if (reflection.isDocument()) {
|
|
22
|
+
reflection.content = resolvePartLinks(reflection, reflection.content, externalResolver, options);
|
|
23
|
+
}
|
|
20
24
|
}
|
|
21
|
-
exports.resolveLinks = resolveLinks;
|
|
22
25
|
function resolvePartLinks(reflection, parts, externalResolver, options) {
|
|
23
26
|
return parts.flatMap((part) => processPart(reflection, part, externalResolver, options));
|
|
24
27
|
}
|
|
25
|
-
exports.resolvePartLinks = resolvePartLinks;
|
|
26
28
|
function processPart(reflection, part, externalResolver, options) {
|
|
27
29
|
if (part.kind === "inline-tag") {
|
|
28
30
|
if (part.tag === "@link" ||
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import type { CommentParserConfig } from ".";
|
|
2
|
-
import { Comment } from "../../models";
|
|
3
|
-
import { Logger } from "../../utils";
|
|
2
|
+
import { Comment, type CommentDisplayPart } from "../../models";
|
|
3
|
+
import { type Logger } from "../../utils";
|
|
4
4
|
import type { MinimalSourceFile } from "../../utils/minimalSourceFile";
|
|
5
|
-
import { Token } from "./lexer";
|
|
5
|
+
import { type Token } from "./lexer";
|
|
6
6
|
export declare function parseComment(tokens: Generator<Token, undefined, undefined>, config: CommentParserConfig, file: MinimalSourceFile, logger: Logger): Comment;
|
|
7
|
+
/**
|
|
8
|
+
* Intended for parsing markdown documents. This only parses code blocks and
|
|
9
|
+
* inline tags outside of code blocks, everything else is text.
|
|
10
|
+
*
|
|
11
|
+
* If you change this, also look at blockContent, as it likely needs similar
|
|
12
|
+
* modifications to ensure parsing is consistent.
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseCommentString(tokens: Generator<Token, undefined, undefined>, config: CommentParserConfig, file: MinimalSourceFile, logger: Logger): {
|
|
15
|
+
content: CommentDisplayPart[];
|
|
16
|
+
frontmatter: Record<string, unknown>;
|
|
17
|
+
};
|