typedoc 0.23.8 → 0.23.11
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/lib/application.d.ts +3 -1
- package/dist/lib/application.js +10 -5
- package/dist/lib/converter/comments/declarationReferenceResolver.js +9 -1
- package/dist/lib/converter/comments/discovery.js +11 -2
- package/dist/lib/converter/comments/index.js +13 -1
- package/dist/lib/converter/comments/linkResolver.d.ts +4 -0
- package/dist/lib/converter/comments/linkResolver.js +186 -0
- package/dist/lib/converter/converter.d.ts +7 -3
- package/dist/lib/converter/converter.js +20 -5
- package/dist/lib/converter/factories/signature.js +1 -0
- package/dist/lib/converter/plugins/CommentPlugin.js +11 -2
- package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +0 -21
- package/dist/lib/converter/plugins/LinkResolverPlugin.js +9 -200
- package/dist/lib/converter/types.js +6 -1
- package/dist/lib/models/reflections/abstract.js +7 -4
- package/dist/lib/models/types.js +1 -1
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +5 -5
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +4 -0
- package/dist/lib/output/themes/default/partials/comment.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/comment.js +3 -3
- package/dist/lib/output/themes/default/partials/hierarchy.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/hierarchy.js +5 -3
- package/dist/lib/output/themes/default/partials/index.js +2 -2
- package/dist/lib/output/themes/default/partials/navigation.js +2 -2
- package/dist/lib/output/themes/default/partials/typeParameters.js +14 -11
- package/dist/lib/output/themes/default/templates/index.d.ts +1 -1
- package/dist/lib/output/themes/default/templates/index.js +2 -3
- package/dist/lib/output/themes/default/templates/reflection.js +5 -6
- package/dist/lib/output/themes/lib.d.ts +5 -1
- package/dist/lib/output/themes/lib.js +16 -1
- package/dist/lib/utils/entry-point.js +6 -5
- package/dist/lib/utils/fs.js +5 -1
- package/dist/lib/utils/general.d.ts +1 -0
- package/dist/lib/utils/general.js +13 -5
- package/dist/lib/utils/options/declaration.d.ts +27 -26
- package/dist/lib/utils/options/sources/typedoc.js +6 -0
- package/dist/lib/utils/package-manifest.js +8 -12
- package/package.json +21 -21
- package/static/main.js +1 -1
- package/tsdoc.json +1 -1
|
@@ -39,7 +39,9 @@ export declare class Application extends ChildableComponent<Application, Abstrac
|
|
|
39
39
|
logger: Logger;
|
|
40
40
|
options: Options;
|
|
41
41
|
/** @internal */
|
|
42
|
-
loggerType: string | Function;
|
|
42
|
+
readonly loggerType: string | Function;
|
|
43
|
+
/** @internal */
|
|
44
|
+
readonly skipErrorChecking: boolean;
|
|
43
45
|
/**
|
|
44
46
|
* The version number of TypeDoc.
|
|
45
47
|
*/
|
package/dist/lib/application.js
CHANGED
|
@@ -96,7 +96,7 @@ let Application = Application_1 = class Application extends component_1.Childabl
|
|
|
96
96
|
}
|
|
97
97
|
this.options.read(this.logger);
|
|
98
98
|
if ((0, general_1.hasBeenLoadedMultipleTimes)()) {
|
|
99
|
-
this.logger.warn(`TypeDoc has been loaded multiple times. This is commonly caused by plugins which have their own installation of TypeDoc.
|
|
99
|
+
this.logger.warn(`TypeDoc has been loaded multiple times. This is commonly caused by plugins which have their own installation of TypeDoc. The loaded paths are:\n\t${(0, general_1.getLoadedPaths)().join("\n\t")}`);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
@@ -136,10 +136,12 @@ let Application = Application_1 = class Application extends component_1.Childabl
|
|
|
136
136
|
}
|
|
137
137
|
const programs = (0, array_1.unique)(entryPoints.map((e) => e.program));
|
|
138
138
|
this.logger.verbose(`Converting with ${programs.length} programs ${entryPoints.length} entry points`);
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
if (this.skipErrorChecking === false) {
|
|
140
|
+
const errors = programs.flatMap((program) => ts.getPreEmitDiagnostics(program));
|
|
141
|
+
if (errors.length) {
|
|
142
|
+
this.logger.diagnostics(errors);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
143
145
|
}
|
|
144
146
|
if (this.options.getValue("emit") === "both") {
|
|
145
147
|
for (const program of programs) {
|
|
@@ -305,6 +307,9 @@ Application.VERSION = packageInfo.version;
|
|
|
305
307
|
__decorate([
|
|
306
308
|
(0, utils_1.BindOption)("logger")
|
|
307
309
|
], Application.prototype, "loggerType", void 0);
|
|
310
|
+
__decorate([
|
|
311
|
+
(0, utils_1.BindOption)("skipErrorChecking")
|
|
312
|
+
], Application.prototype, "skipErrorChecking", void 0);
|
|
308
313
|
Application = Application_1 = __decorate([
|
|
309
314
|
(0, component_1.Component)({ name: "application", internal: true })
|
|
310
315
|
], Application);
|
|
@@ -29,6 +29,9 @@ function resolveDeclarationReference(reflection, ref) {
|
|
|
29
29
|
if (refl.kindOf(models_1.ReflectionKind.ExportContainer)) {
|
|
30
30
|
high.push(refl);
|
|
31
31
|
}
|
|
32
|
+
else {
|
|
33
|
+
low.push(refl);
|
|
34
|
+
}
|
|
32
35
|
}
|
|
33
36
|
if (reflection.kindOf(models_1.ReflectionKind.SomeMember)) {
|
|
34
37
|
high.push(reflection.parent);
|
|
@@ -38,7 +41,12 @@ function resolveDeclarationReference(reflection, ref) {
|
|
|
38
41
|
high.push(reflection.parent.parent);
|
|
39
42
|
}
|
|
40
43
|
else if (high[0] !== reflection) {
|
|
41
|
-
|
|
44
|
+
if (reflection.parent instanceof models_1.ContainerReflection) {
|
|
45
|
+
high.push(...(reflection.parent.children?.filter((c) => c.name === reflection.name) || []));
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
high.push(reflection);
|
|
49
|
+
}
|
|
42
50
|
}
|
|
43
51
|
}
|
|
44
52
|
if (ref.symbolReference) {
|
|
@@ -39,6 +39,9 @@ const wantedKinds = {
|
|
|
39
39
|
[models_1.ReflectionKind.Function]: [
|
|
40
40
|
ts.SyntaxKind.FunctionDeclaration,
|
|
41
41
|
ts.SyntaxKind.BindingElement,
|
|
42
|
+
ts.SyntaxKind.VariableDeclaration,
|
|
43
|
+
ts.SyntaxKind.ExportAssignment,
|
|
44
|
+
ts.SyntaxKind.PropertyAccessExpression,
|
|
42
45
|
],
|
|
43
46
|
[models_1.ReflectionKind.Class]: [
|
|
44
47
|
ts.SyntaxKind.ClassDeclaration,
|
|
@@ -51,6 +54,8 @@ const wantedKinds = {
|
|
|
51
54
|
ts.SyntaxKind.PropertySignature,
|
|
52
55
|
ts.SyntaxKind.BinaryExpression,
|
|
53
56
|
ts.SyntaxKind.PropertyAssignment,
|
|
57
|
+
// class X { constructor(/** Comment */ readonly z: any) }
|
|
58
|
+
ts.SyntaxKind.Parameter,
|
|
54
59
|
],
|
|
55
60
|
[models_1.ReflectionKind.Method]: [
|
|
56
61
|
ts.SyntaxKind.FunctionDeclaration,
|
|
@@ -98,8 +103,12 @@ function discoverComment(symbol, kind, logger, commentStyle) {
|
|
|
98
103
|
// However, we don't want to skip the node if it is a reference to something.
|
|
99
104
|
// See the gh1770 test for an example.
|
|
100
105
|
if (kind & models_1.ReflectionKind.ContainsCallSignatures &&
|
|
101
|
-
|
|
102
|
-
|
|
106
|
+
[
|
|
107
|
+
ts.SyntaxKind.FunctionDeclaration,
|
|
108
|
+
ts.SyntaxKind.MethodDeclaration,
|
|
109
|
+
ts.SyntaxKind.Constructor,
|
|
110
|
+
].includes(node.kind) &&
|
|
111
|
+
!node.body) {
|
|
103
112
|
continue;
|
|
104
113
|
}
|
|
105
114
|
const comments = collectCommentRanges(ts.getLeadingCommentRanges(text, node.pos));
|
|
@@ -8,6 +8,13 @@ const blockLexer_1 = require("./blockLexer");
|
|
|
8
8
|
const discovery_1 = require("./discovery");
|
|
9
9
|
const lineLexer_1 = require("./lineLexer");
|
|
10
10
|
const parser_1 = require("./parser");
|
|
11
|
+
const jsDocCommentKinds = [
|
|
12
|
+
ts.SyntaxKind.JSDocPropertyTag,
|
|
13
|
+
ts.SyntaxKind.JSDocCallbackTag,
|
|
14
|
+
ts.SyntaxKind.JSDocTypedefTag,
|
|
15
|
+
ts.SyntaxKind.JSDocTemplateTag,
|
|
16
|
+
ts.SyntaxKind.JSDocEnumTag,
|
|
17
|
+
];
|
|
11
18
|
const commentCache = new WeakMap();
|
|
12
19
|
function getCommentWithCache(discovered, config, logger) {
|
|
13
20
|
if (!discovered)
|
|
@@ -52,6 +59,11 @@ function getCommentImpl(commentSource, config, logger, moduleComment) {
|
|
|
52
59
|
return comment;
|
|
53
60
|
}
|
|
54
61
|
function getComment(symbol, kind, config, logger, commentStyle) {
|
|
62
|
+
if (symbol
|
|
63
|
+
.getDeclarations()
|
|
64
|
+
?.every((d) => jsDocCommentKinds.includes(d.kind))) {
|
|
65
|
+
return getJsDocComment(symbol.declarations[0], config, logger);
|
|
66
|
+
}
|
|
55
67
|
return getCommentImpl((0, discovery_1.discoverComment)(symbol, kind, logger, commentStyle), config, logger, symbol.declarations?.some(ts.isSourceFile) || false);
|
|
56
68
|
}
|
|
57
69
|
exports.getComment = getComment;
|
|
@@ -106,7 +118,7 @@ function getJsDocComment(declaration, config, logger) {
|
|
|
106
118
|
logger.error(`Failed to find JSDoc tag for ${name} after parsing comment, please file a bug report.`, declaration);
|
|
107
119
|
}
|
|
108
120
|
else {
|
|
109
|
-
return new models_1.Comment(tag.content
|
|
121
|
+
return new models_1.Comment(models_1.Comment.cloneDisplayParts(tag.content));
|
|
110
122
|
}
|
|
111
123
|
}
|
|
112
124
|
exports.getJsDocComment = getJsDocComment;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Comment, CommentDisplayPart, Reflection } from "../../models";
|
|
2
|
+
import type { Logger, ValidationOptions } from "../../utils";
|
|
3
|
+
export declare function resolveLinks(comment: Comment, reflection: Reflection, validation: ValidationOptions, logger: Logger): void;
|
|
4
|
+
export declare function resolvePartLinks(reflection: Reflection, parts: readonly CommentDisplayPart[], warn: () => void, validation: ValidationOptions, logger: Logger): CommentDisplayPart[];
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolvePartLinks = exports.resolveLinks = void 0;
|
|
4
|
+
const ts = require("typescript");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
const declarationReference_1 = require("./declarationReference");
|
|
7
|
+
const declarationReferenceResolver_1 = require("./declarationReferenceResolver");
|
|
8
|
+
const urlPrefix = /^(http|ftp)s?:\/\//;
|
|
9
|
+
const brackets = /\[\[(?!include:)([^\]]+)\]\]/g;
|
|
10
|
+
function resolveLinks(comment, reflection, validation, logger) {
|
|
11
|
+
let warned = false;
|
|
12
|
+
const warn = () => {
|
|
13
|
+
if (!warned) {
|
|
14
|
+
warned = true;
|
|
15
|
+
logger.warn(`${reflection.getFriendlyFullName()}: Comment [[target]] style links are deprecated and will be removed in 0.24`);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
comment.summary = resolvePartLinks(reflection, comment.summary, warn, validation, logger);
|
|
19
|
+
for (const tag of comment.blockTags) {
|
|
20
|
+
tag.content = resolvePartLinks(reflection, tag.content, warn, validation, logger);
|
|
21
|
+
}
|
|
22
|
+
if (reflection instanceof models_1.DeclarationReflection && reflection.readme) {
|
|
23
|
+
reflection.readme = resolvePartLinks(reflection, reflection.readme, warn, validation, logger);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.resolveLinks = resolveLinks;
|
|
27
|
+
function resolvePartLinks(reflection, parts, warn, validation, logger) {
|
|
28
|
+
return parts.flatMap((part) => processPart(reflection, part, warn, validation, logger));
|
|
29
|
+
}
|
|
30
|
+
exports.resolvePartLinks = resolvePartLinks;
|
|
31
|
+
function processPart(reflection, part, warn, validation, logger) {
|
|
32
|
+
if (part.kind === "text" && brackets.test(part.text)) {
|
|
33
|
+
warn();
|
|
34
|
+
return replaceBrackets(reflection, part.text, validation, logger);
|
|
35
|
+
}
|
|
36
|
+
if (part.kind === "inline-tag") {
|
|
37
|
+
if (part.tag === "@link" ||
|
|
38
|
+
part.tag === "@linkcode" ||
|
|
39
|
+
part.tag === "@linkplain") {
|
|
40
|
+
return resolveLinkTag(reflection, part, (msg) => {
|
|
41
|
+
if (validation.invalidLink) {
|
|
42
|
+
logger.warn(msg);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return part;
|
|
48
|
+
}
|
|
49
|
+
function resolveLinkTag(reflection, part, warn) {
|
|
50
|
+
let pos = 0;
|
|
51
|
+
const end = part.text.length;
|
|
52
|
+
while (pos < end && ts.isWhiteSpaceLike(part.text.charCodeAt(pos))) {
|
|
53
|
+
pos++;
|
|
54
|
+
}
|
|
55
|
+
const origText = part.text;
|
|
56
|
+
// Try to parse one
|
|
57
|
+
const declRef = (0, declarationReference_1.parseDeclarationReference)(part.text, pos, end);
|
|
58
|
+
let target;
|
|
59
|
+
if (declRef) {
|
|
60
|
+
// Got one, great! Try to resolve the link
|
|
61
|
+
target = (0, declarationReferenceResolver_1.resolveDeclarationReference)(reflection, declRef[0]);
|
|
62
|
+
pos = declRef[1];
|
|
63
|
+
}
|
|
64
|
+
if (!target) {
|
|
65
|
+
if (urlPrefix.test(part.text)) {
|
|
66
|
+
const wsIndex = part.text.search(/\s/);
|
|
67
|
+
target =
|
|
68
|
+
wsIndex === -1 ? part.text : part.text.substring(0, wsIndex);
|
|
69
|
+
pos = target.length;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// If resolution via a declaration reference failed, revert to the legacy "split and check"
|
|
73
|
+
// method... this should go away in 0.24, once people have had a chance to migrate any failing links.
|
|
74
|
+
if (!target) {
|
|
75
|
+
const resolved = legacyResolveLinkTag(reflection, part);
|
|
76
|
+
if (resolved) {
|
|
77
|
+
warn(`Failed to resolve {@link ${origText}} in ${reflection.getFriendlyFullName()} with declaration references. This link will break in v0.24.`);
|
|
78
|
+
}
|
|
79
|
+
return resolved;
|
|
80
|
+
}
|
|
81
|
+
// Remaining text after an optional pipe is the link text, so advance
|
|
82
|
+
// until that's consumed.
|
|
83
|
+
while (pos < end && ts.isWhiteSpaceLike(part.text.charCodeAt(pos))) {
|
|
84
|
+
pos++;
|
|
85
|
+
}
|
|
86
|
+
if (pos < end && part.text[pos] === "|") {
|
|
87
|
+
pos++;
|
|
88
|
+
}
|
|
89
|
+
part.target = target;
|
|
90
|
+
part.text =
|
|
91
|
+
part.text.substring(pos).trim() ||
|
|
92
|
+
(typeof target === "string" ? target : target.name);
|
|
93
|
+
return part;
|
|
94
|
+
}
|
|
95
|
+
function legacyResolveLinkTag(reflection, part) {
|
|
96
|
+
const { caption, target } = splitLinkText(part.text);
|
|
97
|
+
if (urlPrefix.test(target)) {
|
|
98
|
+
part.text = caption;
|
|
99
|
+
part.target = target;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
const targetRefl = reflection.findReflectionByName(target);
|
|
103
|
+
if (targetRefl) {
|
|
104
|
+
part.text = caption;
|
|
105
|
+
part.target = targetRefl;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return part;
|
|
109
|
+
}
|
|
110
|
+
function replaceBrackets(reflection, text, validation, logger) {
|
|
111
|
+
const parts = [];
|
|
112
|
+
let begin = 0;
|
|
113
|
+
brackets.lastIndex = 0;
|
|
114
|
+
for (const match of text.matchAll(brackets)) {
|
|
115
|
+
if (begin != match.index) {
|
|
116
|
+
parts.push({
|
|
117
|
+
kind: "text",
|
|
118
|
+
text: text.substring(begin, match.index),
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
begin = match.index + match[0].length;
|
|
122
|
+
const content = match[1];
|
|
123
|
+
const { target, caption } = splitLinkText(content);
|
|
124
|
+
if (urlPrefix.test(target)) {
|
|
125
|
+
parts.push({
|
|
126
|
+
kind: "inline-tag",
|
|
127
|
+
tag: "@link",
|
|
128
|
+
text: caption,
|
|
129
|
+
target,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
const targetRefl = reflection.findReflectionByName(target);
|
|
134
|
+
if (targetRefl) {
|
|
135
|
+
parts.push({
|
|
136
|
+
kind: "inline-tag",
|
|
137
|
+
tag: "@link",
|
|
138
|
+
text: caption,
|
|
139
|
+
target: targetRefl,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
if (validation.invalidLink) {
|
|
144
|
+
logger.warn("Failed to find target: " + content);
|
|
145
|
+
}
|
|
146
|
+
parts.push({
|
|
147
|
+
kind: "inline-tag",
|
|
148
|
+
tag: "@link",
|
|
149
|
+
text: content,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
parts.push({
|
|
155
|
+
kind: "text",
|
|
156
|
+
text: text.substring(begin),
|
|
157
|
+
});
|
|
158
|
+
return parts;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Split the given link into text and target at first pipe or space.
|
|
162
|
+
*
|
|
163
|
+
* @param text The source string that should be checked for a split character.
|
|
164
|
+
* @returns An object containing the link text and target.
|
|
165
|
+
*/
|
|
166
|
+
function splitLinkText(text) {
|
|
167
|
+
let splitIndex = text.indexOf("|");
|
|
168
|
+
if (splitIndex === -1) {
|
|
169
|
+
splitIndex = text.search(/\s/);
|
|
170
|
+
}
|
|
171
|
+
if (splitIndex !== -1) {
|
|
172
|
+
return {
|
|
173
|
+
caption: text
|
|
174
|
+
.substring(splitIndex + 1)
|
|
175
|
+
.replace(/\n+/, " ")
|
|
176
|
+
.trim(),
|
|
177
|
+
target: text.substring(0, splitIndex).trim(),
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
return {
|
|
182
|
+
caption: text,
|
|
183
|
+
target: text,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as ts from "typescript";
|
|
2
2
|
import type { Application } from "../application";
|
|
3
|
-
import { ProjectReflection, SomeType } from "../models/index";
|
|
3
|
+
import { Comment, CommentDisplayPart, ProjectReflection, Reflection, SomeType } from "../models/index";
|
|
4
4
|
import { Context } from "./context";
|
|
5
5
|
import { ConverterComponent } from "./components";
|
|
6
6
|
import { ChildableComponent } from "../utils/component";
|
|
7
7
|
import { MinimalSourceFile } from "../utils";
|
|
8
8
|
import type { DocumentationEntryPoint } from "../utils/entry-point";
|
|
9
9
|
import { CommentParserConfig } from "./comments";
|
|
10
|
-
import type { CommentStyle } from "../utils/options/declaration";
|
|
10
|
+
import type { CommentStyle, ValidationOptions } from "../utils/options/declaration";
|
|
11
11
|
/**
|
|
12
12
|
* Compiles source files using TypeScript and converts compiler symbols to reflections.
|
|
13
13
|
*/
|
|
@@ -24,6 +24,8 @@ export declare class Converter extends ChildableComponent<Application, Converter
|
|
|
24
24
|
excludePrivate: boolean;
|
|
25
25
|
excludeProtected: boolean;
|
|
26
26
|
commentStyle: CommentStyle;
|
|
27
|
+
/** @internal */
|
|
28
|
+
validation: ValidationOptions;
|
|
27
29
|
private _config?;
|
|
28
30
|
get config(): CommentParserConfig;
|
|
29
31
|
/**
|
|
@@ -108,7 +110,9 @@ export declare class Converter extends ChildableComponent<Application, Converter
|
|
|
108
110
|
/**
|
|
109
111
|
* Parse the given file into a comment. Intended to be used with markdown files.
|
|
110
112
|
*/
|
|
111
|
-
parseRawComment(file: MinimalSourceFile):
|
|
113
|
+
parseRawComment(file: MinimalSourceFile): Comment;
|
|
114
|
+
resolveLinks(comment: Comment, owner: Reflection): void;
|
|
115
|
+
resolveLinks(parts: readonly CommentDisplayPart[], owner: Reflection): CommentDisplayPart[];
|
|
112
116
|
/**
|
|
113
117
|
* Compile the files within the given context and convert the compiler symbols to reflections.
|
|
114
118
|
*
|
|
@@ -22,6 +22,7 @@ const enum_1 = require("../utils/enum");
|
|
|
22
22
|
const comments_1 = require("./comments");
|
|
23
23
|
const parser_1 = require("./comments/parser");
|
|
24
24
|
const rawLexer_1 = require("./comments/rawLexer");
|
|
25
|
+
const linkResolver_1 = require("./comments/linkResolver");
|
|
25
26
|
/**
|
|
26
27
|
* Compiles source files using TypeScript and converts compiler symbols to reflections.
|
|
27
28
|
*/
|
|
@@ -66,6 +67,21 @@ let Converter = Converter_1 = class Converter extends component_1.ChildableCompo
|
|
|
66
67
|
parseRawComment(file) {
|
|
67
68
|
return (0, parser_1.parseComment)((0, rawLexer_1.lexCommentString)(file.text), this.config, file, this.application.logger);
|
|
68
69
|
}
|
|
70
|
+
resolveLinks(comment, owner) {
|
|
71
|
+
if (comment instanceof index_1.Comment) {
|
|
72
|
+
(0, linkResolver_1.resolveLinks)(comment, owner, this.validation, this.owner.logger);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
let warned = false;
|
|
76
|
+
const warn = () => {
|
|
77
|
+
if (!warned) {
|
|
78
|
+
warned = true;
|
|
79
|
+
this.application.logger.warn(`${owner.name}: Comment [[target]] style links are deprecated and will be removed in 0.24`);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
return (0, linkResolver_1.resolvePartLinks)(owner, comment, warn, this.validation, this.owner.logger);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
69
85
|
/**
|
|
70
86
|
* Compile the files within the given context and convert the compiler symbols to reflections.
|
|
71
87
|
*
|
|
@@ -97,11 +113,6 @@ let Converter = Converter_1 = class Converter extends component_1.ChildableCompo
|
|
|
97
113
|
const entryName = entryPoint.displayName;
|
|
98
114
|
const symbol = getSymbolForModuleLike(context, node);
|
|
99
115
|
let moduleContext;
|
|
100
|
-
const allExports = getExports(context, node, symbol);
|
|
101
|
-
if (allExports.every((exp) => this.shouldIgnore(exp))) {
|
|
102
|
-
this.owner.logger.verbose(`All members of ${entryName} are excluded, ignoring entry point.`);
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
116
|
if (singleEntryPoint) {
|
|
106
117
|
// Special case for when we're giving a single entry point, we don't need to
|
|
107
118
|
// create modules for each entry. Register the project as this module.
|
|
@@ -130,6 +141,7 @@ let Converter = Converter_1 = class Converter extends component_1.ChildableCompo
|
|
|
130
141
|
context.finalizeDeclarationReflection(reflection);
|
|
131
142
|
moduleContext = context.withScope(reflection);
|
|
132
143
|
}
|
|
144
|
+
const allExports = getExports(context, node, symbol);
|
|
133
145
|
for (const exp of allExports.filter((exp) => isDirectExport(context.resolveAliasedSymbol(exp), node))) {
|
|
134
146
|
(0, symbols_1.convertSymbol)(moduleContext, exp);
|
|
135
147
|
}
|
|
@@ -271,6 +283,9 @@ __decorate([
|
|
|
271
283
|
__decorate([
|
|
272
284
|
(0, utils_1.BindOption)("commentStyle")
|
|
273
285
|
], Converter.prototype, "commentStyle", void 0);
|
|
286
|
+
__decorate([
|
|
287
|
+
(0, utils_1.BindOption)("validation")
|
|
288
|
+
], Converter.prototype, "validation", void 0);
|
|
274
289
|
Converter = Converter_1 = __decorate([
|
|
275
290
|
(0, component_1.Component)({
|
|
276
291
|
name: "converter",
|
|
@@ -62,6 +62,7 @@ function convertParameters(context, sigRef, parameters, parameterNodes) {
|
|
|
62
62
|
if (declaration && ts.isJSDocParameterTag(declaration)) {
|
|
63
63
|
paramRefl.comment = (0, comments_1.getJsDocComment)(declaration, context.converter.config, context.logger);
|
|
64
64
|
}
|
|
65
|
+
paramRefl.comment || (paramRefl.comment = (0, comments_1.getComment)(param, paramRefl.kind, context.converter.config, context.logger, context.converter.commentStyle));
|
|
65
66
|
context.registerReflection(paramRefl, param);
|
|
66
67
|
context.trigger(converter_events_1.ConverterEvents.CREATE_PARAMETER, paramRefl);
|
|
67
68
|
let type;
|
|
@@ -311,9 +311,18 @@ let CommentPlugin = class CommentPlugin extends components_1.ConverterComponent
|
|
|
311
311
|
}
|
|
312
312
|
return false;
|
|
313
313
|
}
|
|
314
|
-
|
|
314
|
+
const isHidden = comment.hasModifier("@hidden") ||
|
|
315
315
|
comment.hasModifier("@ignore") ||
|
|
316
|
-
(comment.hasModifier("@internal") && this.excludeInternal)
|
|
316
|
+
(comment.hasModifier("@internal") && this.excludeInternal);
|
|
317
|
+
if (isHidden &&
|
|
318
|
+
reflection.kindOf(models_1.ReflectionKind.ContainsCallSignatures)) {
|
|
319
|
+
return reflection
|
|
320
|
+
.getNonIndexSignatures()
|
|
321
|
+
.every((sig) => {
|
|
322
|
+
return !sig.comment || this.isHidden(sig);
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
return isHidden;
|
|
317
326
|
}
|
|
318
327
|
};
|
|
319
328
|
__decorate([
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Reflection } from "../../models/reflections/abstract";
|
|
2
1
|
import { ConverterComponent } from "../components";
|
|
3
2
|
import type { Context } from "../../converter";
|
|
4
3
|
import { ValidationOptions } from "../../utils";
|
|
@@ -11,25 +10,5 @@ export declare class LinkResolverPlugin extends ConverterComponent {
|
|
|
11
10
|
* Create a new LinkResolverPlugin instance.
|
|
12
11
|
*/
|
|
13
12
|
initialize(): void;
|
|
14
|
-
/**
|
|
15
|
-
* Find all old style double bracket references to symbols within the given text and transform them into a link.
|
|
16
|
-
*
|
|
17
|
-
* @param text The text that should be parsed.
|
|
18
|
-
* @returns The text with symbol references replaced by links.
|
|
19
|
-
*/
|
|
20
|
-
private replaceBrackets;
|
|
21
13
|
onResolve(context: Context): void;
|
|
22
|
-
processReflection(reflection: Reflection): void;
|
|
23
|
-
private processParts;
|
|
24
|
-
private processPart;
|
|
25
|
-
/**
|
|
26
|
-
* Split the given link into text and target at first pipe or space.
|
|
27
|
-
*
|
|
28
|
-
* @param text The source string that should be checked for a split character.
|
|
29
|
-
* @returns An object containing the link text and target.
|
|
30
|
-
*/
|
|
31
|
-
static splitLinkText(text: string): {
|
|
32
|
-
caption: string;
|
|
33
|
-
target: string;
|
|
34
|
-
};
|
|
35
14
|
}
|