typedoc 0.23.9 → 0.23.12
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 +1 -1
- package/dist/lib/application-events.d.ts +3 -0
- package/dist/lib/application-events.js +6 -0
- package/dist/lib/application.d.ts +9 -1
- package/dist/lib/application.js +18 -5
- package/dist/lib/converter/comments/declarationReferenceResolver.js +9 -1
- package/dist/lib/converter/comments/discovery.js +2 -0
- 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 +19 -0
- package/dist/lib/converter/factories/signature.js +1 -0
- 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/converter/utils/nodes.js +1 -3
- 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 +14 -5
- package/dist/lib/utils/fs.js +4 -1
- package/dist/lib/utils/general.d.ts +1 -0
- package/dist/lib/utils/general.js +13 -5
- package/dist/lib/utils/index.d.ts +1 -1
- package/dist/lib/utils/options/declaration.d.ts +51 -31
- package/dist/lib/utils/options/declaration.js +16 -3
- package/dist/lib/utils/options/index.d.ts +1 -1
- package/dist/lib/utils/options/options.js +4 -1
- package/dist/lib/utils/options/sources/typedoc.js +6 -0
- package/dist/lib/utils/package-manifest.d.ts +2 -2
- package/dist/lib/utils/package-manifest.js +8 -12
- package/dist/lib/utils/paths.d.ts +3 -3
- package/package.json +19 -20
- package/static/main.js +1 -1
- package/static/style.css +1 -0
- package/tsdoc.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export { Converter, Context, type CommentParserConfig } from "./lib/converter";
|
|
|
7
7
|
export { Renderer, DefaultTheme, DefaultThemeRenderContext, UrlMapping, Theme, PageEvent, RendererEvent, MarkdownEvent, IndexEvent, } from "./lib/output";
|
|
8
8
|
export type { RenderTemplate, RendererHooks } from "./lib/output";
|
|
9
9
|
export { ArgumentsReader, BindOption, CommentStyle, JSX, LogLevel, Logger, Options, ParameterHint, ParameterType, TSConfigReader, TypeDocReader, EntryPointStrategy, EventHooks, MinimalSourceFile, } from "./lib/utils";
|
|
10
|
-
export type { OptionsReader, TypeDocOptions, TypeDocOptionMap, ValidationOptions, TypeDocOptionValues, KeyToDeclaration, DeclarationOption, DeclarationOptionBase, StringDeclarationOption, NumberDeclarationOption, BooleanDeclarationOption, ArrayDeclarationOption, MixedDeclarationOption, MapDeclarationOption, FlagsDeclarationOption, DeclarationOptionToOptionType, SortStrategy, ParameterTypeToOptionTypeMap, DocumentationEntryPoint, ManuallyValidatedOption, } from "./lib/utils";
|
|
10
|
+
export type { OptionsReader, TypeDocOptions, TypeDocOptionMap, ValidationOptions, TypeDocOptionValues, KeyToDeclaration, DeclarationOption, DeclarationOptionBase, StringDeclarationOption, NumberDeclarationOption, BooleanDeclarationOption, ArrayDeclarationOption, MixedDeclarationOption, ObjectDeclarationOption, MapDeclarationOption, FlagsDeclarationOption, DeclarationOptionToOptionType, SortStrategy, ParameterTypeToOptionTypeMap, DocumentationEntryPoint, ManuallyValidatedOption, } from "./lib/utils";
|
|
11
11
|
export type { EventMap, EventCallback } from "./lib/utils/events";
|
|
12
12
|
export { JSONOutput, Serializer, type SerializerComponent, SerializeEvent, } from "./lib/serialization";
|
|
13
13
|
export type { SerializeEventData } from "./lib/serialization";
|
|
@@ -39,11 +39,19 @@ 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
|
*/
|
|
46
48
|
static VERSION: string;
|
|
49
|
+
/**
|
|
50
|
+
* Emitted after plugins have been loaded and options have been read, but before they have been frozen.
|
|
51
|
+
* The listener will be given an instance of {@link Application} and the {@link TypeDocOptions | Partial<TypeDocOptions>}
|
|
52
|
+
* passed to `bootstrap`.
|
|
53
|
+
*/
|
|
54
|
+
static readonly EVENT_BOOTSTRAP_END: string;
|
|
47
55
|
/**
|
|
48
56
|
* Create a new TypeDoc application instance.
|
|
49
57
|
*
|
package/dist/lib/application.js
CHANGED
|
@@ -24,6 +24,7 @@ const general_1 = require("./utils/general");
|
|
|
24
24
|
const exports_1 = require("./validation/exports");
|
|
25
25
|
const documentation_1 = require("./validation/documentation");
|
|
26
26
|
const links_1 = require("./validation/links");
|
|
27
|
+
const application_events_1 = require("./application-events");
|
|
27
28
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
28
29
|
const packageInfo = require("../../package.json");
|
|
29
30
|
const supportedVersionMajorMinor = packageInfo.peerDependencies.typescript
|
|
@@ -96,8 +97,9 @@ let Application = Application_1 = class Application extends component_1.Childabl
|
|
|
96
97
|
}
|
|
97
98
|
this.options.read(this.logger);
|
|
98
99
|
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.
|
|
100
|
+
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
101
|
}
|
|
102
|
+
this.trigger(application_events_1.ApplicationEvents.BOOTSTRAP_END, this, options);
|
|
101
103
|
}
|
|
102
104
|
/**
|
|
103
105
|
* Return the path to the TypeScript compiler.
|
|
@@ -136,10 +138,12 @@ let Application = Application_1 = class Application extends component_1.Childabl
|
|
|
136
138
|
}
|
|
137
139
|
const programs = (0, array_1.unique)(entryPoints.map((e) => e.program));
|
|
138
140
|
this.logger.verbose(`Converting with ${programs.length} programs ${entryPoints.length} entry points`);
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
if (this.skipErrorChecking === false) {
|
|
142
|
+
const errors = programs.flatMap((program) => ts.getPreEmitDiagnostics(program));
|
|
143
|
+
if (errors.length) {
|
|
144
|
+
this.logger.diagnostics(errors);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
143
147
|
}
|
|
144
148
|
if (this.options.getValue("emit") === "both") {
|
|
145
149
|
for (const program of programs) {
|
|
@@ -302,9 +306,18 @@ let Application = Application_1 = class Application extends component_1.Childabl
|
|
|
302
306
|
* The version number of TypeDoc.
|
|
303
307
|
*/
|
|
304
308
|
Application.VERSION = packageInfo.version;
|
|
309
|
+
/**
|
|
310
|
+
* Emitted after plugins have been loaded and options have been read, but before they have been frozen.
|
|
311
|
+
* The listener will be given an instance of {@link Application} and the {@link TypeDocOptions | Partial<TypeDocOptions>}
|
|
312
|
+
* passed to `bootstrap`.
|
|
313
|
+
*/
|
|
314
|
+
Application.EVENT_BOOTSTRAP_END = application_events_1.ApplicationEvents.BOOTSTRAP_END;
|
|
305
315
|
__decorate([
|
|
306
316
|
(0, utils_1.BindOption)("logger")
|
|
307
317
|
], Application.prototype, "loggerType", void 0);
|
|
318
|
+
__decorate([
|
|
319
|
+
(0, utils_1.BindOption)("skipErrorChecking")
|
|
320
|
+
], Application.prototype, "skipErrorChecking", void 0);
|
|
308
321
|
Application = Application_1 = __decorate([
|
|
309
322
|
(0, component_1.Component)({ name: "application", internal: true })
|
|
310
323
|
], 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) {
|
|
@@ -54,6 +54,8 @@ const wantedKinds = {
|
|
|
54
54
|
ts.SyntaxKind.PropertySignature,
|
|
55
55
|
ts.SyntaxKind.BinaryExpression,
|
|
56
56
|
ts.SyntaxKind.PropertyAssignment,
|
|
57
|
+
// class X { constructor(/** Comment */ readonly z: any) }
|
|
58
|
+
ts.SyntaxKind.Parameter,
|
|
57
59
|
],
|
|
58
60
|
[models_1.ReflectionKind.Method]: [
|
|
59
61
|
ts.SyntaxKind.FunctionDeclaration,
|
|
@@ -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
|
*
|
|
@@ -267,6 +283,9 @@ __decorate([
|
|
|
267
283
|
__decorate([
|
|
268
284
|
(0, utils_1.BindOption)("commentStyle")
|
|
269
285
|
], Converter.prototype, "commentStyle", void 0);
|
|
286
|
+
__decorate([
|
|
287
|
+
(0, utils_1.BindOption)("validation")
|
|
288
|
+
], Converter.prototype, "validation", void 0);
|
|
270
289
|
Converter = Converter_1 = __decorate([
|
|
271
290
|
(0, component_1.Component)({
|
|
272
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;
|
|
@@ -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
|
}
|