typedoc 0.24.8 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.js +6 -1
- package/dist/lib/application.d.ts +13 -11
- package/dist/lib/application.js +455 -347
- package/dist/lib/cli.js +29 -22
- package/dist/lib/converter/comments/blockLexer.js +10 -1
- package/dist/lib/converter/comments/declarationReference.js +2 -0
- package/dist/lib/converter/comments/declarationReferenceResolver.js +2 -1
- package/dist/lib/converter/comments/discovery.js +0 -1
- package/dist/lib/converter/comments/linkResolver.d.ts +5 -2
- package/dist/lib/converter/comments/linkResolver.js +21 -13
- package/dist/lib/converter/comments/parser.js +7 -12
- package/dist/lib/converter/comments/tagName.d.ts +8 -0
- package/dist/lib/converter/comments/tagName.js +62 -0
- package/dist/lib/converter/context.js +1 -2
- package/dist/lib/converter/converter.d.ts +12 -10
- package/dist/lib/converter/converter.js +440 -309
- package/dist/lib/converter/factories/index-signature.js +2 -1
- package/dist/lib/converter/factories/signature.js +3 -4
- package/dist/lib/converter/plugins/CategoryPlugin.d.ts +8 -8
- package/dist/lib/converter/plugins/CategoryPlugin.js +294 -200
- package/dist/lib/converter/plugins/CommentPlugin.d.ts +8 -5
- package/dist/lib/converter/plugins/CommentPlugin.js +434 -305
- package/dist/lib/converter/plugins/GroupPlugin.d.ts +3 -3
- package/dist/lib/converter/plugins/GroupPlugin.js +216 -145
- package/dist/lib/converter/plugins/ImplementsPlugin.js +240 -192
- package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +2 -0
- package/dist/lib/converter/plugins/InheritDocPlugin.js +202 -132
- package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +1 -1
- package/dist/lib/converter/plugins/LinkResolverPlugin.js +111 -43
- package/dist/lib/converter/plugins/PackagePlugin.d.ts +6 -4
- package/dist/lib/converter/plugins/PackagePlugin.js +192 -96
- package/dist/lib/converter/plugins/SourcePlugin.d.ts +6 -5
- package/dist/lib/converter/plugins/SourcePlugin.js +239 -132
- package/dist/lib/converter/plugins/TypePlugin.js +148 -101
- package/dist/lib/converter/symbols.js +16 -4
- package/dist/lib/converter/types.js +16 -1
- package/dist/lib/converter/utils/nodes.d.ts +2 -2
- package/dist/lib/converter/utils/repository.d.ts +15 -5
- package/dist/lib/converter/utils/repository.js +29 -12
- package/dist/lib/models/ReflectionGroup.d.ts +4 -2
- package/dist/lib/models/ReflectionGroup.js +3 -1
- package/dist/lib/models/comments/comment.d.ts +9 -2
- package/dist/lib/models/comments/comment.js +2 -0
- package/dist/lib/models/reflections/ReflectionSymbolId.js +1 -1
- package/dist/lib/models/reflections/abstract.d.ts +6 -1
- package/dist/lib/models/reflections/abstract.js +15 -2
- package/dist/lib/models/reflections/container.d.ts +3 -0
- package/dist/lib/models/reflections/container.js +4 -1
- package/dist/lib/models/reflections/declaration.d.ts +1 -0
- package/dist/lib/models/reflections/declaration.js +1 -0
- package/dist/lib/models/reflections/index.d.ts +1 -1
- package/dist/lib/models/reflections/kind.d.ts +4 -4
- package/dist/lib/models/reflections/kind.js +5 -7
- package/dist/lib/models/reflections/parameter.d.ts +3 -0
- package/dist/lib/models/reflections/parameter.js +3 -0
- package/dist/lib/models/reflections/project.d.ts +1 -0
- package/dist/lib/models/reflections/project.js +3 -1
- package/dist/lib/models/reflections/reference.d.ts +1 -0
- package/dist/lib/models/reflections/reference.js +1 -0
- package/dist/lib/models/reflections/signature.d.ts +3 -0
- package/dist/lib/models/reflections/signature.js +3 -0
- package/dist/lib/models/reflections/type-parameter.d.ts +3 -0
- package/dist/lib/models/reflections/type-parameter.js +3 -0
- package/dist/lib/models/sources/file.d.ts +2 -0
- package/dist/lib/models/sources/file.js +5 -0
- package/dist/lib/models/types.d.ts +24 -0
- package/dist/lib/models/types.js +21 -0
- package/dist/lib/output/components.d.ts +1 -0
- package/dist/lib/output/components.js +10 -3
- package/dist/lib/output/events.d.ts +2 -2
- package/dist/lib/output/index.d.ts +1 -1
- package/dist/lib/output/plugins/AssetsPlugin.d.ts +1 -1
- package/dist/lib/output/plugins/AssetsPlugin.js +112 -44
- package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +2 -1
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +174 -99
- package/dist/lib/output/plugins/NavigationPlugin.d.ts +6 -0
- package/dist/lib/output/plugins/NavigationPlugin.js +109 -0
- package/dist/lib/output/plugins/index.d.ts +2 -1
- package/dist/lib/output/plugins/index.js +5 -3
- package/dist/lib/output/renderer.d.ts +10 -8
- package/dist/lib/output/renderer.js +317 -203
- package/dist/lib/output/theme.d.ts +1 -1
- package/dist/lib/output/theme.js +64 -18
- package/dist/lib/output/themes/MarkedPlugin.d.ts +4 -4
- package/dist/lib/output/themes/MarkedPlugin.js +224 -145
- package/dist/lib/output/themes/default/DefaultTheme.d.ts +14 -1
- package/dist/lib/output/themes/default/DefaultTheme.js +68 -0
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +43 -44
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +16 -11
- package/dist/lib/output/themes/default/layouts/default.js +2 -0
- package/dist/lib/output/themes/default/partials/comment.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/comment.js +16 -14
- package/dist/lib/output/themes/default/partials/footer.js +1 -1
- package/dist/lib/output/themes/default/partials/header.js +2 -2
- package/dist/lib/output/themes/default/partials/icon.d.ts +4 -1
- package/dist/lib/output/themes/default/partials/icon.js +40 -38
- package/dist/lib/output/themes/default/partials/member.js +1 -1
- package/dist/lib/output/themes/default/partials/member.signature.body.js +2 -2
- package/dist/lib/output/themes/default/partials/navigation.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/navigation.js +36 -56
- package/dist/lib/output/themes/default/partials/parameter.js +3 -3
- package/dist/lib/output/themes/lib.d.ts +1 -2
- package/dist/lib/output/themes/lib.js +1 -11
- package/dist/lib/serialization/schema.d.ts +37 -1
- package/dist/lib/utils/component.d.ts +1 -1
- package/dist/lib/utils/component.js +3 -1
- package/dist/lib/utils/entry-point.d.ts +0 -6
- package/dist/lib/utils/entry-point.js +27 -113
- package/dist/lib/utils/events.js +1 -1
- package/dist/lib/utils/general.js +1 -1
- package/dist/lib/utils/index.d.ts +1 -1
- package/dist/lib/utils/index.js +2 -1
- package/dist/lib/utils/jsx.d.ts +1 -1
- package/dist/lib/utils/jsx.js +24 -15
- package/dist/lib/utils/options/declaration.d.ts +5 -1
- package/dist/lib/utils/options/declaration.js +1 -1
- package/dist/lib/utils/options/index.d.ts +1 -1
- package/dist/lib/utils/options/index.js +2 -1
- package/dist/lib/utils/options/options.d.ts +22 -9
- package/dist/lib/utils/options/options.js +27 -15
- package/dist/lib/utils/options/readers/tsconfig.js +2 -7
- package/dist/lib/utils/options/readers/typedoc.d.ts +4 -2
- package/dist/lib/utils/options/readers/typedoc.js +33 -7
- package/dist/lib/utils/options/sources/typedoc.js +25 -4
- package/dist/lib/utils/options/tsdoc-defaults.d.ts +1 -1
- package/dist/lib/utils/options/tsdoc-defaults.js +4 -0
- package/dist/lib/utils/package-manifest.d.ts +0 -25
- package/dist/lib/utils/package-manifest.js +7 -148
- package/dist/lib/utils/perf.d.ts +1 -1
- package/dist/lib/utils/perf.js +36 -31
- package/dist/lib/utils/sort.js +0 -1
- package/dist/lib/validation/links.js +10 -2
- package/package.json +12 -12
- package/static/main.js +4 -3
- package/static/style.css +26 -10
- package/tsdoc.json +16 -0
|
@@ -1,9 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
3
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
4
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
5
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
6
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
7
|
+
var _, done = false;
|
|
8
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
+
var context = {};
|
|
10
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
+
if (kind === "accessor") {
|
|
15
|
+
if (result === void 0) continue;
|
|
16
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
+
}
|
|
21
|
+
else if (_ = accept(result)) {
|
|
22
|
+
if (kind === "field") initializers.unshift(_);
|
|
23
|
+
else descriptor[key] = _;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
+
done = true;
|
|
28
|
+
};
|
|
29
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
30
|
+
var useValue = arguments.length > 2;
|
|
31
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
+
}
|
|
34
|
+
return useValue ? value : void 0;
|
|
35
|
+
};
|
|
36
|
+
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
37
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
38
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
7
39
|
};
|
|
8
40
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
41
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -22,220 +54,236 @@ const utils_1 = require("../../utils");
|
|
|
22
54
|
* A plugin that detects interface implementations of functions and
|
|
23
55
|
* properties on classes and links them.
|
|
24
56
|
*/
|
|
25
|
-
let ImplementsPlugin =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this.listenTo(this.owner, converter_1.Converter.EVENT_CREATE_DECLARATION, this.onDeclaration, -1000);
|
|
37
|
-
this.listenTo(this.owner, converter_1.Converter.EVENT_CREATE_SIGNATURE, this.onSignature, 1000);
|
|
38
|
-
this.listenTo(this.application, application_events_1.ApplicationEvents.REVIVE, this.resolve);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Mark all members of the given class to be the implementation of the matching interface member.
|
|
42
|
-
*/
|
|
43
|
-
analyzeImplements(project, classReflection, interfaceReflection) {
|
|
44
|
-
handleInheritedComments(classReflection, interfaceReflection);
|
|
45
|
-
if (!interfaceReflection.children) {
|
|
46
|
-
return;
|
|
57
|
+
let ImplementsPlugin = (() => {
|
|
58
|
+
let _classDecorators = [(0, components_1.Component)({ name: "implements" })];
|
|
59
|
+
let _classDescriptor;
|
|
60
|
+
let _classExtraInitializers = [];
|
|
61
|
+
let _classThis;
|
|
62
|
+
let _classSuper = components_1.ConverterComponent;
|
|
63
|
+
var ImplementsPlugin = _classThis = class extends _classSuper {
|
|
64
|
+
constructor() {
|
|
65
|
+
super(...arguments);
|
|
66
|
+
this.resolved = new WeakSet();
|
|
67
|
+
this.postponed = new WeakMap();
|
|
47
68
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Create a new ImplementsPlugin instance.
|
|
71
|
+
*/
|
|
72
|
+
initialize() {
|
|
73
|
+
this.listenTo(this.owner, converter_1.Converter.EVENT_RESOLVE_END, this.onResolveEnd);
|
|
74
|
+
this.listenTo(this.owner, converter_1.Converter.EVENT_CREATE_DECLARATION, this.onDeclaration, -1000);
|
|
75
|
+
this.listenTo(this.owner, converter_1.Converter.EVENT_CREATE_SIGNATURE, this.onSignature, 1000);
|
|
76
|
+
this.listenTo(this.application, application_events_1.ApplicationEvents.REVIVE, this.resolve);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Mark all members of the given class to be the implementation of the matching interface member.
|
|
80
|
+
*/
|
|
81
|
+
analyzeImplements(project, classReflection, interfaceReflection) {
|
|
82
|
+
handleInheritedComments(classReflection, interfaceReflection);
|
|
83
|
+
if (!interfaceReflection.children) {
|
|
51
84
|
return;
|
|
52
85
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
interfaceMember.type?.visit({
|
|
58
|
-
reflection: (r) => r.declaration.signatures,
|
|
59
|
-
});
|
|
60
|
-
const clsSigs = classMember.signatures ||
|
|
61
|
-
classMember.type?.visit({
|
|
62
|
-
reflection: (r) => r.declaration.signatures,
|
|
63
|
-
});
|
|
64
|
-
if (intSigs && clsSigs) {
|
|
65
|
-
for (const [clsSig, intSig] of (0, array_1.zip)(clsSigs, intSigs)) {
|
|
66
|
-
if (clsSig.implementationOf) {
|
|
67
|
-
const target = intSig.parent.kindOf(index_1.ReflectionKind.FunctionOrMethod)
|
|
68
|
-
? intSig
|
|
69
|
-
: intSig.parent.parent;
|
|
70
|
-
clsSig.implementationOf =
|
|
71
|
-
types_1.ReferenceType.createResolvedReference(clsSig.implementationOf.name, target, project);
|
|
72
|
-
}
|
|
86
|
+
interfaceReflection.children.forEach((interfaceMember) => {
|
|
87
|
+
const classMember = findMatchingMember(interfaceMember, classReflection);
|
|
88
|
+
if (!classMember) {
|
|
89
|
+
return;
|
|
73
90
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
childSig[key] = types_1.ReferenceType.createResolvedReference(`${parent.name}.${parentMember.name}`, parentSig, project);
|
|
91
|
+
const interfaceMemberName = interfaceReflection.name + "." + interfaceMember.name;
|
|
92
|
+
classMember.implementationOf =
|
|
93
|
+
types_1.ReferenceType.createResolvedReference(interfaceMemberName, interfaceMember, project);
|
|
94
|
+
const intSigs = interfaceMember.signatures ||
|
|
95
|
+
interfaceMember.type?.visit({
|
|
96
|
+
reflection: (r) => r.declaration.signatures,
|
|
97
|
+
});
|
|
98
|
+
const clsSigs = classMember.signatures ||
|
|
99
|
+
classMember.type?.visit({
|
|
100
|
+
reflection: (r) => r.declaration.signatures,
|
|
101
|
+
});
|
|
102
|
+
if (intSigs && clsSigs) {
|
|
103
|
+
for (const [clsSig, intSig] of (0, array_1.zip)(clsSigs, intSigs)) {
|
|
104
|
+
if (clsSig.implementationOf) {
|
|
105
|
+
const target = intSig.parent.kindOf(index_1.ReflectionKind.FunctionOrMethod)
|
|
106
|
+
? intSig
|
|
107
|
+
: intSig.parent.parent;
|
|
108
|
+
clsSig.implementationOf =
|
|
109
|
+
types_1.ReferenceType.createResolvedReference(clsSig.implementationOf.name, target, project);
|
|
110
|
+
}
|
|
95
111
|
}
|
|
96
|
-
child[key] = types_1.ReferenceType.createResolvedReference(`${parent.name}.${parentMember.name}`, parentMember, project);
|
|
97
|
-
handleInheritedComments(child, parentMember);
|
|
98
112
|
}
|
|
99
|
-
|
|
113
|
+
handleInheritedComments(classMember, interfaceMember);
|
|
114
|
+
});
|
|
100
115
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
116
|
+
analyzeInheritance(project, reflection) {
|
|
117
|
+
const extendedTypes = (0, array_1.filterMap)(reflection.extendedTypes ?? [], (type) => {
|
|
118
|
+
return type instanceof types_1.ReferenceType &&
|
|
119
|
+
type.reflection instanceof index_1.DeclarationReflection
|
|
120
|
+
? type
|
|
121
|
+
: void 0;
|
|
122
|
+
});
|
|
123
|
+
for (const parent of extendedTypes) {
|
|
124
|
+
handleInheritedComments(reflection, parent.reflection);
|
|
125
|
+
for (const parentMember of parent.reflection.children ?? []) {
|
|
126
|
+
const child = findMatchingMember(parentMember, reflection);
|
|
127
|
+
if (child) {
|
|
128
|
+
const key = child.overwrites
|
|
129
|
+
? "overwrites"
|
|
130
|
+
: "inheritedFrom";
|
|
131
|
+
for (const [childSig, parentSig] of (0, array_1.zip)(child.signatures ?? [], parentMember.signatures ?? [])) {
|
|
132
|
+
childSig[key] = types_1.ReferenceType.createResolvedReference(`${parent.name}.${parentMember.name}`, parentSig, project);
|
|
133
|
+
}
|
|
134
|
+
child[key] = types_1.ReferenceType.createResolvedReference(`${parent.name}.${parentMember.name}`, parentMember, project);
|
|
135
|
+
handleInheritedComments(child, parentMember);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
109
138
|
}
|
|
110
139
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const requirements = (0, array_1.filterMap)([
|
|
114
|
-
...(reflection.implementedTypes ?? []),
|
|
115
|
-
...(reflection.extendedTypes ?? []),
|
|
116
|
-
], (type) => {
|
|
117
|
-
return type instanceof types_1.ReferenceType ? type.reflection : void 0;
|
|
118
|
-
});
|
|
119
|
-
if (requirements.every((req) => this.resolved.has(req))) {
|
|
120
|
-
this.doResolve(project, reflection);
|
|
121
|
-
this.resolved.add(reflection);
|
|
122
|
-
for (const refl of this.postponed.get(reflection) ?? []) {
|
|
123
|
-
this.tryResolve(project, refl);
|
|
124
|
-
}
|
|
125
|
-
this.postponed.delete(reflection);
|
|
140
|
+
onResolveEnd(context) {
|
|
141
|
+
this.resolve(context.project);
|
|
126
142
|
}
|
|
127
|
-
|
|
128
|
-
for (const
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
143
|
+
resolve(project) {
|
|
144
|
+
for (const id in project.reflections) {
|
|
145
|
+
const refl = project.reflections[id];
|
|
146
|
+
if (refl instanceof index_1.DeclarationReflection) {
|
|
147
|
+
this.tryResolve(project, refl);
|
|
148
|
+
}
|
|
132
149
|
}
|
|
133
150
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
151
|
+
tryResolve(project, reflection) {
|
|
152
|
+
const requirements = (0, array_1.filterMap)([
|
|
153
|
+
...(reflection.implementedTypes ?? []),
|
|
154
|
+
...(reflection.extendedTypes ?? []),
|
|
155
|
+
], (type) => {
|
|
156
|
+
return type instanceof types_1.ReferenceType ? type.reflection : void 0;
|
|
157
|
+
});
|
|
158
|
+
if (requirements.every((req) => this.resolved.has(req))) {
|
|
159
|
+
this.doResolve(project, reflection);
|
|
160
|
+
this.resolved.add(reflection);
|
|
161
|
+
for (const refl of this.postponed.get(reflection) ?? []) {
|
|
162
|
+
this.tryResolve(project, refl);
|
|
141
163
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
164
|
+
this.postponed.delete(reflection);
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
for (const req of requirements) {
|
|
168
|
+
const future = this.postponed.get(req) ?? new Set();
|
|
169
|
+
future.add(reflection);
|
|
170
|
+
this.postponed.set(req, future);
|
|
145
171
|
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
if (reflection.kindOf(index_1.ReflectionKind.ClassOrInterface) &&
|
|
149
|
-
reflection.extendedTypes) {
|
|
150
|
-
this.analyzeInheritance(project, reflection);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
getExtensionInfo(context, reflection) {
|
|
154
|
-
if (!reflection || !reflection.kindOf(index_1.ReflectionKind.Inheritable)) {
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
// Need this because we re-use reflections for type literals.
|
|
158
|
-
if (!reflection.parent?.kindOf(index_1.ReflectionKind.ClassOrInterface)) {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
const symbol = context.project.getSymbolFromReflection(reflection.parent);
|
|
162
|
-
if (!symbol) {
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
const declaration = symbol
|
|
166
|
-
.getDeclarations()
|
|
167
|
-
?.find((n) => typescript_1.default.isClassDeclaration(n) || typescript_1.default.isInterfaceDeclaration(n));
|
|
168
|
-
if (!declaration) {
|
|
169
|
-
return;
|
|
172
|
+
}
|
|
170
173
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
174
|
+
doResolve(project, reflection) {
|
|
175
|
+
if (reflection.kindOf(index_1.ReflectionKind.Class) &&
|
|
176
|
+
reflection.implementedTypes) {
|
|
177
|
+
reflection.implementedTypes.forEach((type) => {
|
|
178
|
+
if (!(type instanceof types_1.ReferenceType)) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (type.reflection &&
|
|
182
|
+
type.reflection.kindOf(index_1.ReflectionKind.ClassOrInterface)) {
|
|
183
|
+
this.analyzeImplements(project, reflection, type.reflection);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
if (reflection.kindOf(index_1.ReflectionKind.ClassOrInterface) &&
|
|
188
|
+
reflection.extendedTypes) {
|
|
189
|
+
this.analyzeInheritance(project, reflection);
|
|
190
|
+
}
|
|
186
191
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
192
|
+
getExtensionInfo(context, reflection) {
|
|
193
|
+
if (!reflection || !reflection.kindOf(index_1.ReflectionKind.Inheritable)) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
// Need this because we re-use reflections for type literals.
|
|
197
|
+
if (!reflection.parent?.kindOf(index_1.ReflectionKind.ClassOrInterface)) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
const symbol = context.project.getSymbolFromReflection(reflection.parent);
|
|
201
|
+
if (!symbol) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
const declaration = symbol
|
|
205
|
+
.getDeclarations()
|
|
206
|
+
?.find((n) => typescript_1.default.isClassDeclaration(n) || typescript_1.default.isInterfaceDeclaration(n));
|
|
207
|
+
if (!declaration) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
return { symbol, declaration };
|
|
191
211
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
: context.checker.getDeclaredTypeOfSymbol(info.symbol);
|
|
195
|
-
const property = findProperty(reflection, childType);
|
|
196
|
-
if (!property) {
|
|
197
|
-
// We're probably broken... but I don't think this should be fatal.
|
|
198
|
-
context.logger.warn(`Failed to retrieve${reflection.flags.isStatic ? " static" : ""} member "${reflection.escapedName ?? reflection.name}" of "${reflection.parent?.name}" for inheritance analysis. Please report a bug.`);
|
|
199
|
-
return;
|
|
212
|
+
onSignature(context, reflection) {
|
|
213
|
+
this.onDeclaration(context, reflection.parent);
|
|
200
214
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
215
|
+
/**
|
|
216
|
+
* Responsible for setting the {@link DeclarationReflection.inheritedFrom},
|
|
217
|
+
* {@link DeclarationReflection.overwrites}, and {@link DeclarationReflection.implementationOf}
|
|
218
|
+
* properties on the provided reflection temporarily, these links will be replaced
|
|
219
|
+
* during the resolve step with links which actually point to the right place.
|
|
220
|
+
*/
|
|
221
|
+
onDeclaration(context, reflection) {
|
|
222
|
+
const info = this.getExtensionInfo(context, reflection);
|
|
223
|
+
if (!info) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (reflection.kind === index_1.ReflectionKind.Constructor) {
|
|
227
|
+
const ctor = info.declaration.members.find(typescript_1.default.isConstructorDeclaration);
|
|
228
|
+
constructorInheritance(context, reflection, info.declaration, ctor);
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
const childType = reflection.flags.isStatic
|
|
232
|
+
? context.checker.getTypeOfSymbolAtLocation(info.symbol, info.declaration)
|
|
233
|
+
: context.checker.getDeclaredTypeOfSymbol(info.symbol);
|
|
234
|
+
const property = findProperty(reflection, childType);
|
|
235
|
+
if (!property) {
|
|
236
|
+
// We're probably broken... but I don't think this should be fatal.
|
|
237
|
+
context.logger.warn(`Failed to retrieve${reflection.flags.isStatic ? " static" : ""} member "${reflection.escapedName ?? reflection.name}" of "${reflection.parent
|
|
238
|
+
?.name}" for inheritance analysis. Please report a bug.`);
|
|
239
|
+
return;
|
|
207
240
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
if (
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
241
|
+
// Need to check both extends and implements clauses.
|
|
242
|
+
out: for (const clause of info.declaration.heritageClauses ?? []) {
|
|
243
|
+
// No point checking implemented types for static members, they won't exist.
|
|
244
|
+
if (reflection.flags.isStatic &&
|
|
245
|
+
clause.token === typescript_1.default.SyntaxKind.ImplementsKeyword) {
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
for (const expr of clause.types) {
|
|
249
|
+
const parentType = context.checker.getTypeAtLocation(reflection.flags.isStatic ? expr.expression : expr);
|
|
250
|
+
const parentProperty = findProperty(reflection, parentType);
|
|
251
|
+
if (parentProperty) {
|
|
252
|
+
const isInherit = property
|
|
253
|
+
.getDeclarations()
|
|
254
|
+
?.some((d) => d.parent !== info.declaration) ??
|
|
255
|
+
true;
|
|
256
|
+
createLink(context, reflection, clause, expr, parentProperty, isInherit);
|
|
257
|
+
// Can't always break because we need to also set `implementationOf` if we
|
|
258
|
+
// inherit from a base class and also implement an interface.
|
|
259
|
+
if (clause.token === typescript_1.default.SyntaxKind.ImplementsKeyword) {
|
|
260
|
+
break out;
|
|
261
|
+
}
|
|
221
262
|
}
|
|
222
263
|
}
|
|
223
264
|
}
|
|
224
265
|
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
266
|
+
};
|
|
267
|
+
__setFunctionName(_classThis, "ImplementsPlugin");
|
|
268
|
+
(() => {
|
|
269
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
270
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
271
|
+
ImplementsPlugin = _classThis = _classDescriptor.value;
|
|
272
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
273
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
274
|
+
})();
|
|
275
|
+
return ImplementsPlugin = _classThis;
|
|
276
|
+
})();
|
|
277
|
+
exports.ImplementsPlugin = ImplementsPlugin;
|
|
230
278
|
function constructorInheritance(context, reflection, childDecl, constructorDecl) {
|
|
231
279
|
const extendsClause = childDecl.heritageClauses?.find((cl) => cl.token === typescript_1.default.SyntaxKind.ExtendsKeyword);
|
|
232
280
|
if (!extendsClause)
|
|
233
281
|
return;
|
|
234
282
|
const name = `${extendsClause.types[0].getText()}.constructor`;
|
|
235
283
|
const key = constructorDecl ? "overwrites" : "inheritedFrom";
|
|
236
|
-
reflection[key]
|
|
284
|
+
reflection[key] ??= types_1.ReferenceType.createBrokenReference(name, context.project);
|
|
237
285
|
for (const sig of reflection.signatures ?? []) {
|
|
238
|
-
sig[key]
|
|
286
|
+
sig[key] ??= types_1.ReferenceType.createBrokenReference(name, context.project);
|
|
239
287
|
}
|
|
240
288
|
}
|
|
241
289
|
function findProperty(reflection, parent) {
|
|
@@ -261,14 +309,14 @@ function createLink(context, reflection, clause, expr, symbol, isOverwrite) {
|
|
|
261
309
|
if (!target)
|
|
262
310
|
return;
|
|
263
311
|
if (clause.token === typescript_1.default.SyntaxKind.ImplementsKeyword) {
|
|
264
|
-
target.implementationOf
|
|
312
|
+
target.implementationOf ??= types_1.ReferenceType.createBrokenReference(name, project);
|
|
265
313
|
return;
|
|
266
314
|
}
|
|
267
315
|
if (isOverwrite) {
|
|
268
|
-
target.inheritedFrom
|
|
316
|
+
target.inheritedFrom ??= types_1.ReferenceType.createBrokenReference(name, project);
|
|
269
317
|
}
|
|
270
318
|
else {
|
|
271
|
-
target.overwrites
|
|
319
|
+
target.overwrites ??= types_1.ReferenceType.createBrokenReference(name, project);
|
|
272
320
|
}
|
|
273
321
|
}
|
|
274
322
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ConverterComponent } from "../components";
|
|
2
|
+
import { ValidationOptions } from "../../utils";
|
|
2
3
|
/**
|
|
3
4
|
* A plugin that handles `@inheritDoc` tags by copying documentation from another API item.
|
|
4
5
|
* It is NOT responsible for handling bare JSDoc style `@inheritDoc` tags which do not specify
|
|
@@ -13,6 +14,7 @@ import { ConverterComponent } from "../components";
|
|
|
13
14
|
* - `@return` block
|
|
14
15
|
*/
|
|
15
16
|
export declare class InheritDocPlugin extends ConverterComponent {
|
|
17
|
+
accessor validation: ValidationOptions;
|
|
16
18
|
private dependencies;
|
|
17
19
|
/**
|
|
18
20
|
* Create a new InheritDocPlugin instance.
|