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
|
@@ -1,7 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
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
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseComment =
|
|
4
|
-
|
|
26
|
+
exports.parseComment = parseComment;
|
|
27
|
+
exports.parseCommentString = parseCommentString;
|
|
28
|
+
const assert_1 = __importStar(require("assert"));
|
|
29
|
+
const yaml_1 = require("yaml");
|
|
5
30
|
const models_1 = require("../../models");
|
|
6
31
|
const utils_1 = require("../../utils");
|
|
7
32
|
const paths_1 = require("../../utils/paths");
|
|
@@ -43,20 +68,97 @@ function parseComment(tokens, config, file, logger) {
|
|
|
43
68
|
const lexer = makeLookaheadGenerator(tokens);
|
|
44
69
|
const tok = lexer.done() || lexer.peek();
|
|
45
70
|
const comment = new models_1.Comment();
|
|
46
|
-
comment.
|
|
71
|
+
comment.sourcePath = file.fileName;
|
|
72
|
+
comment.summary = blockContent(comment, lexer, config, logger.i18n, warningImpl);
|
|
47
73
|
while (!lexer.done()) {
|
|
48
|
-
comment.blockTags.push(blockTag(comment, lexer, config, warningImpl));
|
|
74
|
+
comment.blockTags.push(blockTag(comment, lexer, config, logger.i18n, warningImpl));
|
|
49
75
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
logger.warn(`${message} in comment at ${(0, paths_1.nicePath)(file.fileName)}:${file.getLineAndCharacterOfPosition(tok.pos).line + 1}`);
|
|
53
|
-
});
|
|
76
|
+
const tok2 = tok;
|
|
77
|
+
postProcessComment(comment, logger.i18n, () => `${(0, paths_1.nicePath)(file.fileName)}:${file.getLineAndCharacterOfPosition(tok2.pos).line + 1}`, (message) => logger.warn(message));
|
|
54
78
|
return comment;
|
|
55
79
|
function warningImpl(message, token) {
|
|
56
80
|
logger.warn(message, token.pos, file);
|
|
57
81
|
}
|
|
58
82
|
}
|
|
59
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Intended for parsing markdown documents. This only parses code blocks and
|
|
85
|
+
* inline tags outside of code blocks, everything else is text.
|
|
86
|
+
*
|
|
87
|
+
* If you change this, also look at blockContent, as it likely needs similar
|
|
88
|
+
* modifications to ensure parsing is consistent.
|
|
89
|
+
*/
|
|
90
|
+
function parseCommentString(tokens, config, file, logger) {
|
|
91
|
+
const suppressWarningsConfig = {
|
|
92
|
+
...config,
|
|
93
|
+
jsDocCompatibility: {
|
|
94
|
+
defaultTag: true,
|
|
95
|
+
exampleTag: true,
|
|
96
|
+
ignoreUnescapedBraces: true,
|
|
97
|
+
inheritDocTag: true,
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
const content = [];
|
|
101
|
+
const lexer = makeLookaheadGenerator(tokens);
|
|
102
|
+
while (!lexer.done()) {
|
|
103
|
+
let consume = true;
|
|
104
|
+
const next = lexer.peek();
|
|
105
|
+
switch (next.kind) {
|
|
106
|
+
case lexer_1.TokenSyntaxKind.TypeAnnotation:
|
|
107
|
+
// Shouldn't have been produced by our lexer
|
|
108
|
+
(0, assert_1.default)(false, "Should be unreachable");
|
|
109
|
+
break;
|
|
110
|
+
case lexer_1.TokenSyntaxKind.NewLine:
|
|
111
|
+
case lexer_1.TokenSyntaxKind.Text:
|
|
112
|
+
case lexer_1.TokenSyntaxKind.Tag:
|
|
113
|
+
case lexer_1.TokenSyntaxKind.CloseBrace:
|
|
114
|
+
content.push({ kind: "text", text: next.text });
|
|
115
|
+
break;
|
|
116
|
+
case lexer_1.TokenSyntaxKind.Code:
|
|
117
|
+
content.push({ kind: "code", text: next.text });
|
|
118
|
+
break;
|
|
119
|
+
case lexer_1.TokenSyntaxKind.OpenBrace:
|
|
120
|
+
inlineTag(lexer, content, suppressWarningsConfig, logger.i18n, (message, token) => logger.warn(message, token.pos, file));
|
|
121
|
+
consume = false;
|
|
122
|
+
break;
|
|
123
|
+
default:
|
|
124
|
+
(0, utils_1.assertNever)(next.kind);
|
|
125
|
+
}
|
|
126
|
+
if (consume) {
|
|
127
|
+
lexer.take();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// Check for frontmatter
|
|
131
|
+
let frontmatterData = {};
|
|
132
|
+
const firstBlock = content[0];
|
|
133
|
+
if (firstBlock.text.startsWith("---\n")) {
|
|
134
|
+
const end = firstBlock.text.indexOf("\n---\n");
|
|
135
|
+
if (end !== -1) {
|
|
136
|
+
const yamlText = firstBlock.text.slice("---\n".length, end);
|
|
137
|
+
firstBlock.text = firstBlock.text
|
|
138
|
+
.slice(end + "\n---\n".length)
|
|
139
|
+
.trimStart();
|
|
140
|
+
const frontmatter = (0, yaml_1.parseDocument)(yamlText, { prettyErrors: false });
|
|
141
|
+
for (const warning of frontmatter.warnings) {
|
|
142
|
+
// Can't translate issues coming from external library...
|
|
143
|
+
logger.warn(warning.message, warning.pos[0] + "---\n".length, file);
|
|
144
|
+
}
|
|
145
|
+
for (const error of frontmatter.errors) {
|
|
146
|
+
// Can't translate issues coming from external library...
|
|
147
|
+
logger.error(error.message, error.pos[0] + "---\n".length, file);
|
|
148
|
+
}
|
|
149
|
+
if (frontmatter.errors.length === 0) {
|
|
150
|
+
const data = frontmatter.toJS();
|
|
151
|
+
if (typeof data === "object") {
|
|
152
|
+
frontmatterData = data;
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
logger.error(logger.i18n.yaml_frontmatter_not_an_object(), 5, file);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return { content, frontmatter: frontmatterData };
|
|
161
|
+
}
|
|
60
162
|
const HAS_USER_IDENTIFIER = [
|
|
61
163
|
"@callback",
|
|
62
164
|
"@param",
|
|
@@ -74,7 +176,7 @@ function makeCodeBlock(text) {
|
|
|
74
176
|
* Loop over comment, produce lint warnings, and set tag names for tags
|
|
75
177
|
* which have them.
|
|
76
178
|
*/
|
|
77
|
-
function postProcessComment(comment, warning) {
|
|
179
|
+
function postProcessComment(comment, i18n, getPosition, warning) {
|
|
78
180
|
for (const tag of comment.blockTags) {
|
|
79
181
|
if (HAS_USER_IDENTIFIER.includes(tag.tag) && tag.content.length) {
|
|
80
182
|
const first = tag.content[0];
|
|
@@ -91,50 +193,50 @@ function postProcessComment(comment, warning) {
|
|
|
91
193
|
}
|
|
92
194
|
}
|
|
93
195
|
if (tag.content.some((part) => part.kind === "inline-tag" && part.tag === "@inheritDoc")) {
|
|
94
|
-
warning(
|
|
196
|
+
warning(i18n.inline_inheritdoc_should_not_appear_in_block_tag_in_comment_at_0(getPosition()));
|
|
95
197
|
}
|
|
96
198
|
}
|
|
97
199
|
const remarks = comment.blockTags.filter((tag) => tag.tag === "@remarks");
|
|
98
200
|
if (remarks.length > 1) {
|
|
99
|
-
warning(
|
|
201
|
+
warning(i18n.at_most_one_remarks_tag_expected_in_comment_at_0(getPosition()));
|
|
100
202
|
(0, utils_1.removeIf)(comment.blockTags, (tag) => remarks.indexOf(tag) > 0);
|
|
101
203
|
}
|
|
102
204
|
const returns = comment.blockTags.filter((tag) => tag.tag === "@returns");
|
|
103
205
|
if (remarks.length > 1) {
|
|
104
|
-
warning(
|
|
206
|
+
warning(i18n.at_most_one_returns_tag_expected_in_comment_at_0(getPosition()));
|
|
105
207
|
(0, utils_1.removeIf)(comment.blockTags, (tag) => returns.indexOf(tag) > 0);
|
|
106
208
|
}
|
|
107
209
|
const inheritDoc = comment.blockTags.filter((tag) => tag.tag === "@inheritDoc");
|
|
108
210
|
const inlineInheritDoc = comment.summary.filter((part) => part.kind === "inline-tag" && part.tag === "@inheritDoc");
|
|
109
211
|
if (inlineInheritDoc.length + inheritDoc.length > 1) {
|
|
110
|
-
warning(
|
|
212
|
+
warning(i18n.at_most_one_inheritdoc_tag_expected_in_comment_at_0(getPosition()));
|
|
111
213
|
const allInheritTags = [...inlineInheritDoc, ...inheritDoc];
|
|
112
214
|
(0, utils_1.removeIf)(comment.summary, (part) => allInheritTags.indexOf(part) > 0);
|
|
113
215
|
(0, utils_1.removeIf)(comment.blockTags, (tag) => allInheritTags.indexOf(tag) > 0);
|
|
114
216
|
}
|
|
115
217
|
if ((inlineInheritDoc.length || inheritDoc.length) &&
|
|
116
218
|
comment.summary.some((part) => part.kind !== "inline-tag" && /\S/.test(part.text))) {
|
|
117
|
-
warning(
|
|
219
|
+
warning(i18n.content_in_summary_overwritten_by_inheritdoc_in_comment_at_0(getPosition()));
|
|
118
220
|
}
|
|
119
221
|
if ((inlineInheritDoc.length || inheritDoc.length) && remarks.length) {
|
|
120
|
-
warning(
|
|
222
|
+
warning(i18n.content_in_remarks_block_overwritten_by_inheritdoc_in_comment_at_0(getPosition()));
|
|
121
223
|
}
|
|
122
224
|
}
|
|
123
225
|
const aliasedTags = new Map([["@return", "@returns"]]);
|
|
124
|
-
function blockTag(comment, lexer, config, warning) {
|
|
226
|
+
function blockTag(comment, lexer, config, i18n, warning) {
|
|
125
227
|
const blockTag = lexer.take();
|
|
126
228
|
(0, assert_1.ok)(blockTag.kind === lexer_1.TokenSyntaxKind.Tag, "blockTag called not at the start of a block tag."); // blockContent is broken if this fails.
|
|
127
229
|
const tagName = aliasedTags.get(blockTag.text) || blockTag.text;
|
|
128
230
|
let content;
|
|
129
231
|
if (tagName === "@example") {
|
|
130
|
-
return exampleBlock(comment, lexer, config, warning);
|
|
232
|
+
return exampleBlock(comment, lexer, config, i18n, warning);
|
|
131
233
|
}
|
|
132
234
|
else if (["@default", "@defaultValue"].includes(tagName) &&
|
|
133
235
|
config.jsDocCompatibility.defaultTag) {
|
|
134
|
-
content = defaultBlockContent(comment, lexer, config, warning);
|
|
236
|
+
content = defaultBlockContent(comment, lexer, config, i18n, warning);
|
|
135
237
|
}
|
|
136
238
|
else {
|
|
137
|
-
content = blockContent(comment, lexer, config, warning);
|
|
239
|
+
content = blockContent(comment, lexer, config, i18n, warning);
|
|
138
240
|
}
|
|
139
241
|
return new models_1.CommentTag(tagName, content);
|
|
140
242
|
}
|
|
@@ -142,13 +244,13 @@ function blockTag(comment, lexer, config, warning) {
|
|
|
142
244
|
* The `@default` tag gets a special case because otherwise we will produce many warnings
|
|
143
245
|
* about unescaped/mismatched/missing braces in legacy JSDoc comments
|
|
144
246
|
*/
|
|
145
|
-
function defaultBlockContent(comment, lexer, config, warning) {
|
|
247
|
+
function defaultBlockContent(comment, lexer, config, i18n, warning) {
|
|
146
248
|
lexer.mark();
|
|
147
|
-
const content = blockContent(comment, lexer, config, () => { });
|
|
249
|
+
const content = blockContent(comment, lexer, config, i18n, () => { });
|
|
148
250
|
const end = lexer.done() || lexer.peek();
|
|
149
251
|
lexer.release();
|
|
150
252
|
if (content.some((part) => part.kind === "code")) {
|
|
151
|
-
return blockContent(comment, lexer, config, warning);
|
|
253
|
+
return blockContent(comment, lexer, config, i18n, warning);
|
|
152
254
|
}
|
|
153
255
|
const tokens = [];
|
|
154
256
|
while ((lexer.done() || lexer.peek()) !== end) {
|
|
@@ -171,9 +273,9 @@ function defaultBlockContent(comment, lexer, config, warning) {
|
|
|
171
273
|
*
|
|
172
274
|
* In TSDoc, we also want to treat the first line of the block as the example name.
|
|
173
275
|
*/
|
|
174
|
-
function exampleBlock(comment, lexer, config, warning) {
|
|
276
|
+
function exampleBlock(comment, lexer, config, i18n, warning) {
|
|
175
277
|
lexer.mark();
|
|
176
|
-
const content = blockContent(comment, lexer, config, () => { });
|
|
278
|
+
const content = blockContent(comment, lexer, config, i18n, () => { });
|
|
177
279
|
const end = lexer.done() || lexer.peek();
|
|
178
280
|
lexer.release();
|
|
179
281
|
if (!config.jsDocCompatibility.exampleTag ||
|
|
@@ -205,8 +307,7 @@ function exampleBlock(comment, lexer, config, warning) {
|
|
|
205
307
|
case lexer_1.TokenSyntaxKind.CloseBrace:
|
|
206
308
|
case lexer_1.TokenSyntaxKind.OpenBrace:
|
|
207
309
|
if (!warnedAboutRichNameContent) {
|
|
208
|
-
warning(
|
|
209
|
-
" the example name, and should only contain text.", lexer.peek());
|
|
310
|
+
warning(i18n.example_tag_literal_name(), lexer.peek());
|
|
210
311
|
warnedAboutRichNameContent = true;
|
|
211
312
|
}
|
|
212
313
|
exampleName += lexer.take().text;
|
|
@@ -215,7 +316,7 @@ function exampleBlock(comment, lexer, config, warning) {
|
|
|
215
316
|
(0, utils_1.assertNever)(next.kind);
|
|
216
317
|
}
|
|
217
318
|
}
|
|
218
|
-
const content = blockContent(comment, lexer, config, warning);
|
|
319
|
+
const content = blockContent(comment, lexer, config, i18n, warning);
|
|
219
320
|
const tag = new models_1.CommentTag("@example", content);
|
|
220
321
|
if (exampleName.trim()) {
|
|
221
322
|
tag.name = exampleName.trim();
|
|
@@ -250,7 +351,11 @@ function exampleBlock(comment, lexer, config, warning) {
|
|
|
250
351
|
]);
|
|
251
352
|
}
|
|
252
353
|
}
|
|
253
|
-
|
|
354
|
+
/**
|
|
355
|
+
* If you change this, also look at parseCommentString as it
|
|
356
|
+
* likely needs similar modifications to ensure parsing is consistent.
|
|
357
|
+
*/
|
|
358
|
+
function blockContent(comment, lexer, config, i18n, warning) {
|
|
254
359
|
const content = [];
|
|
255
360
|
let atNewLine = true;
|
|
256
361
|
loop: while (!lexer.done()) {
|
|
@@ -267,7 +372,7 @@ function blockContent(comment, lexer, config, warning) {
|
|
|
267
372
|
case lexer_1.TokenSyntaxKind.Tag:
|
|
268
373
|
if (next.text === "@inheritdoc") {
|
|
269
374
|
if (!config.jsDocCompatibility.inheritDocTag) {
|
|
270
|
-
warning(
|
|
375
|
+
warning(i18n.inheritdoc_tag_properly_capitalized(), next);
|
|
271
376
|
}
|
|
272
377
|
next.text = "@inheritDoc";
|
|
273
378
|
}
|
|
@@ -278,7 +383,7 @@ function blockContent(comment, lexer, config, warning) {
|
|
|
278
383
|
else if (!atNewLine && !config.blockTags.has(next.text)) {
|
|
279
384
|
// Treat unknown tag as a modifier, but warn about it.
|
|
280
385
|
comment.modifierTags.add(next.text);
|
|
281
|
-
warning(
|
|
386
|
+
warning(i18n.treating_unrecognized_tag_0_as_modifier(next.text), next);
|
|
282
387
|
break;
|
|
283
388
|
}
|
|
284
389
|
else {
|
|
@@ -292,12 +397,12 @@ function blockContent(comment, lexer, config, warning) {
|
|
|
292
397
|
case lexer_1.TokenSyntaxKind.CloseBrace:
|
|
293
398
|
// Unmatched closing brace, generate a warning, and treat it as text.
|
|
294
399
|
if (!config.jsDocCompatibility.ignoreUnescapedBraces) {
|
|
295
|
-
warning(
|
|
400
|
+
warning(i18n.unmatched_closing_brace(), next);
|
|
296
401
|
}
|
|
297
402
|
content.push({ kind: "text", text: next.text });
|
|
298
403
|
break;
|
|
299
404
|
case lexer_1.TokenSyntaxKind.OpenBrace:
|
|
300
|
-
inlineTag(lexer, content, config, warning);
|
|
405
|
+
inlineTag(lexer, content, config, i18n, warning);
|
|
301
406
|
consume = false;
|
|
302
407
|
break;
|
|
303
408
|
default:
|
|
@@ -334,7 +439,7 @@ function blockContent(comment, lexer, config, warning) {
|
|
|
334
439
|
}
|
|
335
440
|
return content;
|
|
336
441
|
}
|
|
337
|
-
function inlineTag(lexer, block, config, warning) {
|
|
442
|
+
function inlineTag(lexer, block, config, i18n, warning) {
|
|
338
443
|
const openBrace = lexer.take();
|
|
339
444
|
// Now skip whitespace to grab the tag name.
|
|
340
445
|
// If the first non-whitespace text after the brace isn't a tag,
|
|
@@ -342,7 +447,7 @@ function inlineTag(lexer, block, config, warning) {
|
|
|
342
447
|
if (lexer.done() ||
|
|
343
448
|
![lexer_1.TokenSyntaxKind.Text, lexer_1.TokenSyntaxKind.Tag].includes(lexer.peek().kind)) {
|
|
344
449
|
if (!config.jsDocCompatibility.ignoreUnescapedBraces) {
|
|
345
|
-
warning(
|
|
450
|
+
warning(i18n.unescaped_open_brace_without_inline_tag(), openBrace);
|
|
346
451
|
}
|
|
347
452
|
block.push({ kind: "text", text: openBrace.text });
|
|
348
453
|
return;
|
|
@@ -353,7 +458,7 @@ function inlineTag(lexer, block, config, warning) {
|
|
|
353
458
|
(!/^\s+$/.test(tagName.text) ||
|
|
354
459
|
lexer.peek().kind != lexer_1.TokenSyntaxKind.Tag))) {
|
|
355
460
|
if (!config.jsDocCompatibility.ignoreUnescapedBraces) {
|
|
356
|
-
warning(
|
|
461
|
+
warning(i18n.unescaped_open_brace_without_inline_tag(), openBrace);
|
|
357
462
|
}
|
|
358
463
|
block.push({ kind: "text", text: openBrace.text + tagName.text });
|
|
359
464
|
return;
|
|
@@ -362,7 +467,7 @@ function inlineTag(lexer, block, config, warning) {
|
|
|
362
467
|
tagName = lexer.take();
|
|
363
468
|
}
|
|
364
469
|
if (!config.inlineTags.has(tagName.text)) {
|
|
365
|
-
warning(
|
|
470
|
+
warning(i18n.unknown_inline_tag_0(tagName.text), tagName);
|
|
366
471
|
}
|
|
367
472
|
const content = [];
|
|
368
473
|
// At this point, we know we have an inline tag. Treat everything following as plain text,
|
|
@@ -370,12 +475,12 @@ function inlineTag(lexer, block, config, warning) {
|
|
|
370
475
|
while (!lexer.done() && lexer.peek().kind !== lexer_1.TokenSyntaxKind.CloseBrace) {
|
|
371
476
|
const token = lexer.take();
|
|
372
477
|
if (token.kind === lexer_1.TokenSyntaxKind.OpenBrace) {
|
|
373
|
-
warning(
|
|
478
|
+
warning(i18n.open_brace_within_inline_tag(), token);
|
|
374
479
|
}
|
|
375
480
|
content.push(token.kind === lexer_1.TokenSyntaxKind.NewLine ? " " : token.text);
|
|
376
481
|
}
|
|
377
482
|
if (lexer.done()) {
|
|
378
|
-
warning(
|
|
483
|
+
warning(i18n.inline_tag_not_closed(), openBrace);
|
|
379
484
|
}
|
|
380
485
|
else {
|
|
381
486
|
lexer.take(); // Close brace
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
import { Token } from "./lexer";
|
|
1
|
+
import { type Token } from "./lexer";
|
|
2
|
+
/**
|
|
3
|
+
* Note: This lexer intentionally *only* recognizes inline tags and code blocks.
|
|
4
|
+
* This is because it is intended for use on markdown documents, and we shouldn't
|
|
5
|
+
* take some stray `@user` mention within a "Thanks" section of someone's changelog
|
|
6
|
+
* as starting a block!
|
|
7
|
+
*/
|
|
2
8
|
export declare function lexCommentString(file: string): Generator<Token, undefined, undefined>;
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.lexCommentString =
|
|
3
|
+
exports.lexCommentString = lexCommentString;
|
|
4
4
|
const lexer_1 = require("./lexer");
|
|
5
|
+
/**
|
|
6
|
+
* Note: This lexer intentionally *only* recognizes inline tags and code blocks.
|
|
7
|
+
* This is because it is intended for use on markdown documents, and we shouldn't
|
|
8
|
+
* take some stray `@user` mention within a "Thanks" section of someone's changelog
|
|
9
|
+
* as starting a block!
|
|
10
|
+
*/
|
|
5
11
|
function* lexCommentString(file) {
|
|
6
12
|
// Wrapper around our real lex function to collapse adjacent text tokens.
|
|
7
13
|
let textToken;
|
|
8
14
|
for (const token of lexCommentString2(file)) {
|
|
9
|
-
if (token.kind === lexer_1.TokenSyntaxKind.Text
|
|
15
|
+
if (token.kind === lexer_1.TokenSyntaxKind.Text ||
|
|
16
|
+
token.kind === lexer_1.TokenSyntaxKind.NewLine) {
|
|
10
17
|
if (textToken) {
|
|
11
18
|
textToken.text += token.text;
|
|
12
19
|
}
|
|
13
20
|
else {
|
|
21
|
+
token.kind = lexer_1.TokenSyntaxKind.Text;
|
|
14
22
|
textToken = token;
|
|
15
23
|
}
|
|
16
24
|
}
|
|
@@ -27,7 +35,6 @@ function* lexCommentString(file) {
|
|
|
27
35
|
}
|
|
28
36
|
return;
|
|
29
37
|
}
|
|
30
|
-
exports.lexCommentString = lexCommentString;
|
|
31
38
|
function* lexCommentString2(file) {
|
|
32
39
|
let pos = 0;
|
|
33
40
|
let end = file.length;
|
|
@@ -40,7 +47,7 @@ function* lexCommentString2(file) {
|
|
|
40
47
|
end--;
|
|
41
48
|
}
|
|
42
49
|
let lineStart = true;
|
|
43
|
-
let
|
|
50
|
+
let expectingTag = false;
|
|
44
51
|
for (;;) {
|
|
45
52
|
if (pos >= end) {
|
|
46
53
|
return;
|
|
@@ -52,19 +59,15 @@ function* lexCommentString2(file) {
|
|
|
52
59
|
case "\n":
|
|
53
60
|
yield makeToken(lexer_1.TokenSyntaxKind.NewLine, 1);
|
|
54
61
|
lineStart = true;
|
|
62
|
+
expectingTag = false;
|
|
55
63
|
break;
|
|
56
64
|
case "{":
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
braceStartsType = false;
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
yield makeToken(lexer_1.TokenSyntaxKind.OpenBrace, 1);
|
|
63
|
-
}
|
|
65
|
+
yield makeToken(lexer_1.TokenSyntaxKind.OpenBrace, 1);
|
|
66
|
+
expectingTag = true;
|
|
64
67
|
break;
|
|
65
68
|
case "}":
|
|
66
69
|
yield makeToken(lexer_1.TokenSyntaxKind.CloseBrace, 1);
|
|
67
|
-
|
|
70
|
+
expectingTag = false;
|
|
68
71
|
break;
|
|
69
72
|
case "`": {
|
|
70
73
|
// Markdown's code rules are a royal pain. This could be one of several things.
|
|
@@ -72,7 +75,6 @@ function* lexCommentString2(file) {
|
|
|
72
75
|
// 2. Code block: <3 ticks><language, no ticks>\n<text>\n<3 ticks>\n
|
|
73
76
|
// 3. Unmatched tick(s), not code, but part of some text.
|
|
74
77
|
// We don't quite handle #2 correctly yet. PR welcome!
|
|
75
|
-
braceStartsType = false;
|
|
76
78
|
let tickCount = 1;
|
|
77
79
|
let lookahead = pos;
|
|
78
80
|
while (lookahead + 1 < end && file[lookahead + 1] === "`") {
|
|
@@ -91,6 +93,7 @@ function* lexCommentString2(file) {
|
|
|
91
93
|
text: codeText.join(""),
|
|
92
94
|
pos,
|
|
93
95
|
};
|
|
96
|
+
expectingTag = false;
|
|
94
97
|
pos = lookahead;
|
|
95
98
|
break;
|
|
96
99
|
}
|
|
@@ -122,10 +125,12 @@ function* lexCommentString2(file) {
|
|
|
122
125
|
text: codeText.join(""),
|
|
123
126
|
pos,
|
|
124
127
|
};
|
|
128
|
+
expectingTag = false;
|
|
125
129
|
pos = lookahead;
|
|
126
130
|
}
|
|
127
131
|
else {
|
|
128
132
|
yield makeToken(lexer_1.TokenSyntaxKind.Text, tickCount);
|
|
133
|
+
expectingTag = false;
|
|
129
134
|
}
|
|
130
135
|
}
|
|
131
136
|
break;
|
|
@@ -141,9 +146,9 @@ function* lexCommentString2(file) {
|
|
|
141
146
|
lookahead++;
|
|
142
147
|
}
|
|
143
148
|
}
|
|
144
|
-
if (
|
|
149
|
+
if (expectingTag &&
|
|
150
|
+
lookahead !== pos + 1 &&
|
|
145
151
|
(lookahead === end || /[\s}]/.test(file[lookahead]))) {
|
|
146
|
-
braceStartsType = true;
|
|
147
152
|
yield makeToken(lexer_1.TokenSyntaxKind.Tag, lookahead - pos);
|
|
148
153
|
break;
|
|
149
154
|
}
|
|
@@ -173,7 +178,7 @@ function* lexCommentString2(file) {
|
|
|
173
178
|
}
|
|
174
179
|
textParts.push(file.substring(lookaheadStart, lookahead));
|
|
175
180
|
if (textParts.some((part) => /\S/.test(part))) {
|
|
176
|
-
|
|
181
|
+
expectingTag = false;
|
|
177
182
|
}
|
|
178
183
|
// This piece of text had line continuations or escaped text
|
|
179
184
|
yield {
|
|
@@ -201,58 +206,4 @@ function* lexCommentString2(file) {
|
|
|
201
206
|
}
|
|
202
207
|
return file.startsWith("`".repeat(n), pos) && file[pos + n] !== "`";
|
|
203
208
|
}
|
|
204
|
-
function findEndOfType(pos) {
|
|
205
|
-
let openBraces = 0;
|
|
206
|
-
while (pos < end) {
|
|
207
|
-
if (file[pos] === "{") {
|
|
208
|
-
openBraces++;
|
|
209
|
-
}
|
|
210
|
-
else if (file[pos] === "}") {
|
|
211
|
-
if (--openBraces === 0) {
|
|
212
|
-
break;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
else if ("`'\"".includes(file[pos])) {
|
|
216
|
-
pos = findEndOfString(pos);
|
|
217
|
-
}
|
|
218
|
-
pos++;
|
|
219
|
-
}
|
|
220
|
-
if (pos < end && file[pos] === "}") {
|
|
221
|
-
pos++;
|
|
222
|
-
}
|
|
223
|
-
return pos;
|
|
224
|
-
}
|
|
225
|
-
function findEndOfString(pos) {
|
|
226
|
-
const endOfString = file[pos];
|
|
227
|
-
pos++;
|
|
228
|
-
while (pos < end) {
|
|
229
|
-
if (file[pos] === endOfString) {
|
|
230
|
-
break;
|
|
231
|
-
}
|
|
232
|
-
else if (file[pos] === "\\") {
|
|
233
|
-
pos++; // Skip escaped character
|
|
234
|
-
}
|
|
235
|
-
else if (endOfString === "`" &&
|
|
236
|
-
file[pos] === "$" &&
|
|
237
|
-
file[pos + 1] === "{") {
|
|
238
|
-
// Template literal with data inside a ${}
|
|
239
|
-
while (pos < end && file[pos] !== "}") {
|
|
240
|
-
if ("`'\"".includes(file[pos])) {
|
|
241
|
-
pos = findEndOfString(pos) + 1;
|
|
242
|
-
}
|
|
243
|
-
else {
|
|
244
|
-
pos++;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
pos++;
|
|
249
|
-
}
|
|
250
|
-
return pos;
|
|
251
|
-
}
|
|
252
|
-
function nextNonWs(pos) {
|
|
253
|
-
while (pos < end && /\s/.test(file[pos])) {
|
|
254
|
-
pos++;
|
|
255
|
-
}
|
|
256
|
-
return file[pos];
|
|
257
|
-
}
|
|
258
209
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extractTagName =
|
|
3
|
+
exports.extractTagName = extractTagName;
|
|
4
4
|
/**
|
|
5
5
|
* Determines the name of the parameter/template/property from the tag content
|
|
6
6
|
* when processing `@param x`
|
|
@@ -50,7 +50,6 @@ function extractTagName(text) {
|
|
|
50
50
|
newText: text.substring(pos),
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
exports.extractTagName = extractTagName;
|
|
54
53
|
function skipWs(text, pos) {
|
|
55
54
|
return skipWith(text, pos, /\s/);
|
|
56
55
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
|
-
import { Reflection, ProjectReflection, DeclarationReflection, ReflectionKind } from "../models/index";
|
|
2
|
+
import { type Reflection, type ProjectReflection, DeclarationReflection, ReflectionKind, type DocumentReflection } from "../models/index";
|
|
3
3
|
import type { Converter } from "./converter";
|
|
4
|
+
import type { TranslationProxy } from "../internationalization/internationalization";
|
|
4
5
|
/**
|
|
5
6
|
* The context describes the current state the converter is in.
|
|
6
7
|
*/
|
|
@@ -13,6 +14,10 @@ export declare class Context {
|
|
|
13
14
|
* The TypeChecker instance returned by the TypeScript compiler.
|
|
14
15
|
*/
|
|
15
16
|
get checker(): ts.TypeChecker;
|
|
17
|
+
/**
|
|
18
|
+
* Translation interface for log messages.
|
|
19
|
+
*/
|
|
20
|
+
get i18n(): TranslationProxy;
|
|
16
21
|
/**
|
|
17
22
|
* The program currently being converted.
|
|
18
23
|
* Accessing this property will throw if a source file is not currently being converted.
|
|
@@ -56,7 +61,7 @@ export declare class Context {
|
|
|
56
61
|
createDeclarationReflection(kind: ReflectionKind, symbol: ts.Symbol | undefined, exportSymbol: ts.Symbol | undefined, nameOverride?: string): DeclarationReflection;
|
|
57
62
|
postReflectionCreation(reflection: Reflection, symbol: ts.Symbol | undefined, exportSymbol: ts.Symbol | undefined): void;
|
|
58
63
|
finalizeDeclarationReflection(reflection: DeclarationReflection): void;
|
|
59
|
-
addChild(reflection: DeclarationReflection): void;
|
|
64
|
+
addChild(reflection: DeclarationReflection | DocumentReflection): void;
|
|
60
65
|
shouldIgnore(symbol: ts.Symbol): boolean;
|
|
61
66
|
/**
|
|
62
67
|
* Register a newly generated reflection. All created reflections should be
|
|
@@ -22,6 +22,12 @@ class Context {
|
|
|
22
22
|
get checker() {
|
|
23
23
|
return this.program.getTypeChecker();
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Translation interface for log messages.
|
|
27
|
+
*/
|
|
28
|
+
get i18n() {
|
|
29
|
+
return this.converter.application.i18n;
|
|
30
|
+
}
|
|
25
31
|
/**
|
|
26
32
|
* The program currently being converted.
|
|
27
33
|
* Accessing this property will throw if a source file is not currently being converted.
|
|
@@ -139,8 +145,7 @@ class Context {
|
|
|
139
145
|
}
|
|
140
146
|
addChild(reflection) {
|
|
141
147
|
if (this.scope instanceof index_1.ContainerReflection) {
|
|
142
|
-
this.scope.
|
|
143
|
-
this.scope.children.push(reflection);
|
|
148
|
+
this.scope.addChild(reflection);
|
|
144
149
|
}
|
|
145
150
|
}
|
|
146
151
|
shouldIgnore(symbol) {
|
|
@@ -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.convertDefaultValue = convertDefaultValue;
|
|
7
|
+
exports.convertExpression = convertExpression;
|
|
7
8
|
const typescript_1 = __importDefault(require("typescript"));
|
|
8
9
|
/**
|
|
9
10
|
* Return the default value of the given node.
|
|
@@ -20,7 +21,6 @@ function convertDefaultValue(node) {
|
|
|
20
21
|
return undefined;
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
|
-
exports.convertDefaultValue = convertDefaultValue;
|
|
24
24
|
function convertExpression(expression) {
|
|
25
25
|
switch (expression.kind) {
|
|
26
26
|
case typescript_1.default.SyntaxKind.StringLiteral:
|
|
@@ -57,4 +57,3 @@ function convertExpression(expression) {
|
|
|
57
57
|
// Show that there was a value, but not specifics.
|
|
58
58
|
return "...";
|
|
59
59
|
}
|
|
60
|
-
exports.convertExpression = convertExpression;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
import type { Application } from "../application";
|
|
3
|
-
import { Comment, CommentDisplayPart, ProjectReflection, Reflection, ReflectionSymbolId, SomeType } from "../models/index";
|
|
3
|
+
import { Comment, type CommentDisplayPart, ProjectReflection, type Reflection, type ReflectionSymbolId, type SomeType } from "../models/index";
|
|
4
4
|
import { Context } from "./context";
|
|
5
5
|
import { ConverterComponent } from "./components";
|
|
6
6
|
import { ChildableComponent } from "../utils/component";
|
|
@@ -8,7 +8,7 @@ import { MinimalSourceFile } from "../utils";
|
|
|
8
8
|
import type { DocumentationEntryPoint } from "../utils/entry-point";
|
|
9
9
|
import type { CommentParserConfig } from "./comments";
|
|
10
10
|
import type { CommentStyle, ValidationOptions } from "../utils/options/declaration";
|
|
11
|
-
import { ExternalSymbolResolver, ExternalResolveResult } from "./comments/linkResolver";
|
|
11
|
+
import { type ExternalSymbolResolver, type ExternalResolveResult } from "./comments/linkResolver";
|
|
12
12
|
import type { DeclarationReference } from "./comments/declarationReference";
|
|
13
13
|
/**
|
|
14
14
|
* Compiles source files using TypeScript and converts compiler symbols to reflections.
|
|
@@ -114,6 +114,8 @@ export declare class Converter extends ChildableComponent<Application, Converter
|
|
|
114
114
|
*/
|
|
115
115
|
convert(entryPoints: readonly DocumentationEntryPoint[]): ProjectReflection;
|
|
116
116
|
/** @internal */
|
|
117
|
+
addProjectDocuments(project: ProjectReflection): void;
|
|
118
|
+
/** @internal */
|
|
117
119
|
convertSymbol(context: Context, symbol: ts.Symbol, exportSymbol?: ts.Symbol): void;
|
|
118
120
|
/**
|
|
119
121
|
* Convert the given TypeScript type into its TypeDoc type reflection.
|
|
@@ -126,7 +128,10 @@ export declare class Converter extends ChildableComponent<Application, Converter
|
|
|
126
128
|
/**
|
|
127
129
|
* Parse the given file into a comment. Intended to be used with markdown files.
|
|
128
130
|
*/
|
|
129
|
-
parseRawComment(file: MinimalSourceFile):
|
|
131
|
+
parseRawComment(file: MinimalSourceFile): {
|
|
132
|
+
content: CommentDisplayPart[];
|
|
133
|
+
frontmatter: Record<string, unknown>;
|
|
134
|
+
};
|
|
130
135
|
/**
|
|
131
136
|
* Adds a new resolver that the theme can use to try to figure out how to link to a symbol declared
|
|
132
137
|
* by a third-party library which is not included in the documentation.
|