typedoc 0.25.0 → 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.
Files changed (81) hide show
  1. package/dist/index.d.ts +2 -2
  2. package/dist/index.js +2 -1
  3. package/dist/lib/application.d.ts +3 -3
  4. package/dist/lib/application.js +440 -359
  5. package/dist/lib/cli.js +6 -3
  6. package/dist/lib/converter/comments/parser.js +5 -11
  7. package/dist/lib/converter/comments/tagName.d.ts +8 -0
  8. package/dist/lib/converter/comments/tagName.js +62 -0
  9. package/dist/lib/converter/context.js +1 -2
  10. package/dist/lib/converter/converter.d.ts +11 -11
  11. package/dist/lib/converter/converter.js +436 -311
  12. package/dist/lib/converter/factories/signature.js +3 -4
  13. package/dist/lib/converter/plugins/CategoryPlugin.d.ts +8 -8
  14. package/dist/lib/converter/plugins/CategoryPlugin.js +293 -200
  15. package/dist/lib/converter/plugins/CommentPlugin.d.ts +8 -5
  16. package/dist/lib/converter/plugins/CommentPlugin.js +433 -305
  17. package/dist/lib/converter/plugins/GroupPlugin.d.ts +3 -3
  18. package/dist/lib/converter/plugins/GroupPlugin.js +215 -145
  19. package/dist/lib/converter/plugins/ImplementsPlugin.js +239 -194
  20. package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +1 -1
  21. package/dist/lib/converter/plugins/InheritDocPlugin.js +201 -138
  22. package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +1 -1
  23. package/dist/lib/converter/plugins/LinkResolverPlugin.js +110 -44
  24. package/dist/lib/converter/plugins/PackagePlugin.d.ts +6 -4
  25. package/dist/lib/converter/plugins/PackagePlugin.js +191 -96
  26. package/dist/lib/converter/plugins/SourcePlugin.d.ts +6 -6
  27. package/dist/lib/converter/plugins/SourcePlugin.js +234 -146
  28. package/dist/lib/converter/plugins/TypePlugin.js +147 -102
  29. package/dist/lib/converter/symbols.js +1 -1
  30. package/dist/lib/converter/types.js +10 -0
  31. package/dist/lib/converter/utils/repository.js +2 -2
  32. package/dist/lib/models/reflections/ReflectionSymbolId.js +1 -1
  33. package/dist/lib/models/reflections/abstract.d.ts +4 -0
  34. package/dist/lib/models/reflections/abstract.js +14 -2
  35. package/dist/lib/models/reflections/index.d.ts +1 -1
  36. package/dist/lib/output/components.d.ts +1 -0
  37. package/dist/lib/output/components.js +9 -1
  38. package/dist/lib/output/index.d.ts +1 -1
  39. package/dist/lib/output/plugins/AssetsPlugin.d.ts +1 -1
  40. package/dist/lib/output/plugins/AssetsPlugin.js +111 -44
  41. package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +2 -1
  42. package/dist/lib/output/plugins/JavascriptIndexPlugin.js +173 -99
  43. package/dist/lib/output/plugins/NavigationPlugin.d.ts +6 -0
  44. package/dist/lib/output/plugins/NavigationPlugin.js +109 -0
  45. package/dist/lib/output/plugins/index.d.ts +2 -1
  46. package/dist/lib/output/plugins/index.js +5 -3
  47. package/dist/lib/output/renderer.d.ts +10 -8
  48. package/dist/lib/output/renderer.js +315 -202
  49. package/dist/lib/output/theme.js +63 -18
  50. package/dist/lib/output/themes/MarkedPlugin.d.ts +4 -4
  51. package/dist/lib/output/themes/MarkedPlugin.js +223 -145
  52. package/dist/lib/output/themes/default/DefaultTheme.d.ts +14 -1
  53. package/dist/lib/output/themes/default/DefaultTheme.js +68 -0
  54. package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +42 -36
  55. package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +15 -1
  56. package/dist/lib/output/themes/default/layouts/default.js +2 -0
  57. package/dist/lib/output/themes/default/partials/header.js +1 -1
  58. package/dist/lib/output/themes/default/partials/icon.d.ts +4 -1
  59. package/dist/lib/output/themes/default/partials/icon.js +40 -35
  60. package/dist/lib/output/themes/default/partials/member.signature.body.js +1 -1
  61. package/dist/lib/output/themes/default/partials/navigation.js +34 -67
  62. package/dist/lib/utils/component.d.ts +1 -1
  63. package/dist/lib/utils/component.js +3 -1
  64. package/dist/lib/utils/entry-point.js +27 -14
  65. package/dist/lib/utils/events.js +1 -1
  66. package/dist/lib/utils/general.js +1 -1
  67. package/dist/lib/utils/index.d.ts +1 -1
  68. package/dist/lib/utils/index.js +2 -1
  69. package/dist/lib/utils/jsx.js +1 -1
  70. package/dist/lib/utils/options/declaration.d.ts +2 -0
  71. package/dist/lib/utils/options/index.d.ts +1 -1
  72. package/dist/lib/utils/options/index.js +2 -1
  73. package/dist/lib/utils/options/options.d.ts +19 -0
  74. package/dist/lib/utils/options/options.js +22 -2
  75. package/dist/lib/utils/options/readers/tsconfig.js +2 -7
  76. package/dist/lib/utils/options/sources/typedoc.js +11 -0
  77. package/dist/lib/utils/perf.d.ts +1 -1
  78. package/dist/lib/utils/perf.js +10 -20
  79. package/package.json +1 -1
  80. package/static/main.js +4 -3
  81. package/static/style.css +7 -3
@@ -1,9 +1,41 @@
1
1
  "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
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,223 +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 = class ImplementsPlugin extends components_1.ConverterComponent {
26
- constructor() {
27
- super(...arguments);
28
- this.resolved = new WeakSet();
29
- this.postponed = new WeakMap();
30
- }
31
- /**
32
- * Create a new ImplementsPlugin instance.
33
- */
34
- initialize() {
35
- this.listenTo(this.owner, converter_1.Converter.EVENT_RESOLVE_END, this.onResolveEnd);
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
- interfaceReflection.children.forEach((interfaceMember) => {
49
- const classMember = findMatchingMember(interfaceMember, classReflection);
50
- if (!classMember) {
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
- const interfaceMemberName = interfaceReflection.name + "." + interfaceMember.name;
54
- classMember.implementationOf =
55
- types_1.ReferenceType.createResolvedReference(interfaceMemberName, interfaceMember, project);
56
- const intSigs = interfaceMember.signatures ||
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
- handleInheritedComments(classMember, interfaceMember);
76
- });
77
- }
78
- analyzeInheritance(project, reflection) {
79
- const extendedTypes = (0, array_1.filterMap)(reflection.extendedTypes ?? [], (type) => {
80
- return type instanceof types_1.ReferenceType &&
81
- type.reflection instanceof index_1.DeclarationReflection
82
- ? type
83
- : void 0;
84
- });
85
- for (const parent of extendedTypes) {
86
- handleInheritedComments(reflection, parent.reflection);
87
- for (const parentMember of parent.reflection.children ?? []) {
88
- const child = findMatchingMember(parentMember, reflection);
89
- if (child) {
90
- const key = child.overwrites
91
- ? "overwrites"
92
- : "inheritedFrom";
93
- for (const [childSig, parentSig] of (0, array_1.zip)(child.signatures ?? [], parentMember.signatures ?? [])) {
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
- onResolveEnd(context) {
103
- this.resolve(context.project);
104
- }
105
- resolve(project) {
106
- for (const id in project.reflections) {
107
- const refl = project.reflections[id];
108
- if (refl instanceof index_1.DeclarationReflection) {
109
- this.tryResolve(project, refl);
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
+ }
110
138
  }
111
139
  }
112
- }
113
- tryResolve(project, reflection) {
114
- const requirements = (0, array_1.filterMap)([
115
- ...(reflection.implementedTypes ?? []),
116
- ...(reflection.extendedTypes ?? []),
117
- ], (type) => {
118
- return type instanceof types_1.ReferenceType ? type.reflection : void 0;
119
- });
120
- if (requirements.every((req) => this.resolved.has(req))) {
121
- this.doResolve(project, reflection);
122
- this.resolved.add(reflection);
123
- for (const refl of this.postponed.get(reflection) ?? []) {
124
- this.tryResolve(project, refl);
125
- }
126
- this.postponed.delete(reflection);
140
+ onResolveEnd(context) {
141
+ this.resolve(context.project);
127
142
  }
128
- else {
129
- for (const req of requirements) {
130
- const future = this.postponed.get(req) ?? new Set();
131
- future.add(reflection);
132
- this.postponed.set(req, future);
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
+ }
133
149
  }
134
150
  }
135
- }
136
- doResolve(project, reflection) {
137
- if (reflection.kindOf(index_1.ReflectionKind.Class) &&
138
- reflection.implementedTypes) {
139
- reflection.implementedTypes.forEach((type) => {
140
- if (!(type instanceof types_1.ReferenceType)) {
141
- return;
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);
142
163
  }
143
- if (type.reflection &&
144
- type.reflection.kindOf(index_1.ReflectionKind.ClassOrInterface)) {
145
- this.analyzeImplements(project, reflection, type.reflection);
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);
146
171
  }
147
- });
148
- }
149
- if (reflection.kindOf(index_1.ReflectionKind.ClassOrInterface) &&
150
- reflection.extendedTypes) {
151
- this.analyzeInheritance(project, reflection);
152
- }
153
- }
154
- getExtensionInfo(context, reflection) {
155
- if (!reflection || !reflection.kindOf(index_1.ReflectionKind.Inheritable)) {
156
- return;
157
- }
158
- // Need this because we re-use reflections for type literals.
159
- if (!reflection.parent?.kindOf(index_1.ReflectionKind.ClassOrInterface)) {
160
- return;
161
- }
162
- const symbol = context.project.getSymbolFromReflection(reflection.parent);
163
- if (!symbol) {
164
- return;
165
- }
166
- const declaration = symbol
167
- .getDeclarations()
168
- ?.find((n) => typescript_1.default.isClassDeclaration(n) || typescript_1.default.isInterfaceDeclaration(n));
169
- if (!declaration) {
170
- return;
172
+ }
171
173
  }
172
- return { symbol, declaration };
173
- }
174
- onSignature(context, reflection) {
175
- this.onDeclaration(context, reflection.parent);
176
- }
177
- /**
178
- * Responsible for setting the {@link DeclarationReflection.inheritedFrom},
179
- * {@link DeclarationReflection.overwrites}, and {@link DeclarationReflection.implementationOf}
180
- * properties on the provided reflection temporarily, these links will be replaced
181
- * during the resolve step with links which actually point to the right place.
182
- */
183
- onDeclaration(context, reflection) {
184
- const info = this.getExtensionInfo(context, reflection);
185
- if (!info) {
186
- return;
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
+ }
187
191
  }
188
- if (reflection.kind === index_1.ReflectionKind.Constructor) {
189
- const ctor = info.declaration.members.find(typescript_1.default.isConstructorDeclaration);
190
- constructorInheritance(context, reflection, info.declaration, ctor);
191
- return;
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 };
192
211
  }
193
- const childType = reflection.flags.isStatic
194
- ? context.checker.getTypeOfSymbolAtLocation(info.symbol, info.declaration)
195
- : context.checker.getDeclaredTypeOfSymbol(info.symbol);
196
- const property = findProperty(reflection, childType);
197
- if (!property) {
198
- // We're probably broken... but I don't think this should be fatal.
199
- context.logger.warn(`Failed to retrieve${reflection.flags.isStatic ? " static" : ""} member "${reflection.escapedName ?? reflection.name}" of "${reflection.parent
200
- ?.name}" for inheritance analysis. Please report a bug.`);
201
- return;
212
+ onSignature(context, reflection) {
213
+ this.onDeclaration(context, reflection.parent);
202
214
  }
203
- // Need to check both extends and implements clauses.
204
- out: for (const clause of info.declaration.heritageClauses ?? []) {
205
- // No point checking implemented types for static members, they won't exist.
206
- if (reflection.flags.isStatic &&
207
- clause.token === typescript_1.default.SyntaxKind.ImplementsKeyword) {
208
- continue;
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;
209
240
  }
210
- for (const expr of clause.types) {
211
- const parentType = context.checker.getTypeAtLocation(reflection.flags.isStatic ? expr.expression : expr);
212
- const parentProperty = findProperty(reflection, parentType);
213
- if (parentProperty) {
214
- const isInherit = property
215
- .getDeclarations()
216
- ?.some((d) => d.parent !== info.declaration) ??
217
- true;
218
- createLink(context, reflection, clause, expr, parentProperty, isInherit);
219
- // Can't always break because we need to also set `implementationOf` if we
220
- // inherit from a base class and also implement an interface.
221
- if (clause.token === typescript_1.default.SyntaxKind.ImplementsKeyword) {
222
- break out;
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
+ }
223
262
  }
224
263
  }
225
264
  }
226
265
  }
227
- }
228
- };
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
+ })();
229
277
  exports.ImplementsPlugin = ImplementsPlugin;
230
- exports.ImplementsPlugin = ImplementsPlugin = __decorate([
231
- (0, components_1.Component)({ name: "implements" })
232
- ], ImplementsPlugin);
233
278
  function constructorInheritance(context, reflection, childDecl, constructorDecl) {
234
279
  const extendsClause = childDecl.heritageClauses?.find((cl) => cl.token === typescript_1.default.SyntaxKind.ExtendsKeyword);
235
280
  if (!extendsClause)
236
281
  return;
237
282
  const name = `${extendsClause.types[0].getText()}.constructor`;
238
283
  const key = constructorDecl ? "overwrites" : "inheritedFrom";
239
- reflection[key] ?? (reflection[key] = types_1.ReferenceType.createBrokenReference(name, context.project));
284
+ reflection[key] ??= types_1.ReferenceType.createBrokenReference(name, context.project);
240
285
  for (const sig of reflection.signatures ?? []) {
241
- sig[key] ?? (sig[key] = types_1.ReferenceType.createBrokenReference(name, context.project));
286
+ sig[key] ??= types_1.ReferenceType.createBrokenReference(name, context.project);
242
287
  }
243
288
  }
244
289
  function findProperty(reflection, parent) {
@@ -264,14 +309,14 @@ function createLink(context, reflection, clause, expr, symbol, isOverwrite) {
264
309
  if (!target)
265
310
  return;
266
311
  if (clause.token === typescript_1.default.SyntaxKind.ImplementsKeyword) {
267
- target.implementationOf ?? (target.implementationOf = types_1.ReferenceType.createBrokenReference(name, project));
312
+ target.implementationOf ??= types_1.ReferenceType.createBrokenReference(name, project);
268
313
  return;
269
314
  }
270
315
  if (isOverwrite) {
271
- target.inheritedFrom ?? (target.inheritedFrom = types_1.ReferenceType.createBrokenReference(name, project));
316
+ target.inheritedFrom ??= types_1.ReferenceType.createBrokenReference(name, project);
272
317
  }
273
318
  else {
274
- target.overwrites ?? (target.overwrites = types_1.ReferenceType.createBrokenReference(name, project));
319
+ target.overwrites ??= types_1.ReferenceType.createBrokenReference(name, project);
275
320
  }
276
321
  }
277
322
  }
@@ -14,7 +14,7 @@ import { ValidationOptions } from "../../utils";
14
14
  * - `@return` block
15
15
  */
16
16
  export declare class InheritDocPlugin extends ConverterComponent {
17
- validation: ValidationOptions;
17
+ accessor validation: ValidationOptions;
18
18
  private dependencies;
19
19
  /**
20
20
  * Create a new InheritDocPlugin instance.