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.
Files changed (138) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.ts +6 -2
  3. package/dist/index.js +6 -1
  4. package/dist/lib/application.d.ts +13 -11
  5. package/dist/lib/application.js +455 -347
  6. package/dist/lib/cli.js +29 -22
  7. package/dist/lib/converter/comments/blockLexer.js +10 -1
  8. package/dist/lib/converter/comments/declarationReference.js +2 -0
  9. package/dist/lib/converter/comments/declarationReferenceResolver.js +2 -1
  10. package/dist/lib/converter/comments/discovery.js +0 -1
  11. package/dist/lib/converter/comments/linkResolver.d.ts +5 -2
  12. package/dist/lib/converter/comments/linkResolver.js +21 -13
  13. package/dist/lib/converter/comments/parser.js +7 -12
  14. package/dist/lib/converter/comments/tagName.d.ts +8 -0
  15. package/dist/lib/converter/comments/tagName.js +62 -0
  16. package/dist/lib/converter/context.js +1 -2
  17. package/dist/lib/converter/converter.d.ts +12 -10
  18. package/dist/lib/converter/converter.js +440 -309
  19. package/dist/lib/converter/factories/index-signature.js +2 -1
  20. package/dist/lib/converter/factories/signature.js +3 -4
  21. package/dist/lib/converter/plugins/CategoryPlugin.d.ts +8 -8
  22. package/dist/lib/converter/plugins/CategoryPlugin.js +294 -200
  23. package/dist/lib/converter/plugins/CommentPlugin.d.ts +8 -5
  24. package/dist/lib/converter/plugins/CommentPlugin.js +434 -305
  25. package/dist/lib/converter/plugins/GroupPlugin.d.ts +3 -3
  26. package/dist/lib/converter/plugins/GroupPlugin.js +216 -145
  27. package/dist/lib/converter/plugins/ImplementsPlugin.js +240 -192
  28. package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +2 -0
  29. package/dist/lib/converter/plugins/InheritDocPlugin.js +202 -132
  30. package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +1 -1
  31. package/dist/lib/converter/plugins/LinkResolverPlugin.js +111 -43
  32. package/dist/lib/converter/plugins/PackagePlugin.d.ts +6 -4
  33. package/dist/lib/converter/plugins/PackagePlugin.js +192 -96
  34. package/dist/lib/converter/plugins/SourcePlugin.d.ts +6 -5
  35. package/dist/lib/converter/plugins/SourcePlugin.js +239 -132
  36. package/dist/lib/converter/plugins/TypePlugin.js +148 -101
  37. package/dist/lib/converter/symbols.js +16 -4
  38. package/dist/lib/converter/types.js +16 -1
  39. package/dist/lib/converter/utils/nodes.d.ts +2 -2
  40. package/dist/lib/converter/utils/repository.d.ts +15 -5
  41. package/dist/lib/converter/utils/repository.js +29 -12
  42. package/dist/lib/models/ReflectionGroup.d.ts +4 -2
  43. package/dist/lib/models/ReflectionGroup.js +3 -1
  44. package/dist/lib/models/comments/comment.d.ts +9 -2
  45. package/dist/lib/models/comments/comment.js +2 -0
  46. package/dist/lib/models/reflections/ReflectionSymbolId.js +1 -1
  47. package/dist/lib/models/reflections/abstract.d.ts +6 -1
  48. package/dist/lib/models/reflections/abstract.js +15 -2
  49. package/dist/lib/models/reflections/container.d.ts +3 -0
  50. package/dist/lib/models/reflections/container.js +4 -1
  51. package/dist/lib/models/reflections/declaration.d.ts +1 -0
  52. package/dist/lib/models/reflections/declaration.js +1 -0
  53. package/dist/lib/models/reflections/index.d.ts +1 -1
  54. package/dist/lib/models/reflections/kind.d.ts +4 -4
  55. package/dist/lib/models/reflections/kind.js +5 -7
  56. package/dist/lib/models/reflections/parameter.d.ts +3 -0
  57. package/dist/lib/models/reflections/parameter.js +3 -0
  58. package/dist/lib/models/reflections/project.d.ts +1 -0
  59. package/dist/lib/models/reflections/project.js +3 -1
  60. package/dist/lib/models/reflections/reference.d.ts +1 -0
  61. package/dist/lib/models/reflections/reference.js +1 -0
  62. package/dist/lib/models/reflections/signature.d.ts +3 -0
  63. package/dist/lib/models/reflections/signature.js +3 -0
  64. package/dist/lib/models/reflections/type-parameter.d.ts +3 -0
  65. package/dist/lib/models/reflections/type-parameter.js +3 -0
  66. package/dist/lib/models/sources/file.d.ts +2 -0
  67. package/dist/lib/models/sources/file.js +5 -0
  68. package/dist/lib/models/types.d.ts +24 -0
  69. package/dist/lib/models/types.js +21 -0
  70. package/dist/lib/output/components.d.ts +1 -0
  71. package/dist/lib/output/components.js +10 -3
  72. package/dist/lib/output/events.d.ts +2 -2
  73. package/dist/lib/output/index.d.ts +1 -1
  74. package/dist/lib/output/plugins/AssetsPlugin.d.ts +1 -1
  75. package/dist/lib/output/plugins/AssetsPlugin.js +112 -44
  76. package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +2 -1
  77. package/dist/lib/output/plugins/JavascriptIndexPlugin.js +174 -99
  78. package/dist/lib/output/plugins/NavigationPlugin.d.ts +6 -0
  79. package/dist/lib/output/plugins/NavigationPlugin.js +109 -0
  80. package/dist/lib/output/plugins/index.d.ts +2 -1
  81. package/dist/lib/output/plugins/index.js +5 -3
  82. package/dist/lib/output/renderer.d.ts +10 -8
  83. package/dist/lib/output/renderer.js +317 -203
  84. package/dist/lib/output/theme.d.ts +1 -1
  85. package/dist/lib/output/theme.js +64 -18
  86. package/dist/lib/output/themes/MarkedPlugin.d.ts +4 -4
  87. package/dist/lib/output/themes/MarkedPlugin.js +224 -145
  88. package/dist/lib/output/themes/default/DefaultTheme.d.ts +14 -1
  89. package/dist/lib/output/themes/default/DefaultTheme.js +68 -0
  90. package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +43 -44
  91. package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +16 -11
  92. package/dist/lib/output/themes/default/layouts/default.js +2 -0
  93. package/dist/lib/output/themes/default/partials/comment.d.ts +1 -1
  94. package/dist/lib/output/themes/default/partials/comment.js +16 -14
  95. package/dist/lib/output/themes/default/partials/footer.js +1 -1
  96. package/dist/lib/output/themes/default/partials/header.js +2 -2
  97. package/dist/lib/output/themes/default/partials/icon.d.ts +4 -1
  98. package/dist/lib/output/themes/default/partials/icon.js +40 -38
  99. package/dist/lib/output/themes/default/partials/member.js +1 -1
  100. package/dist/lib/output/themes/default/partials/member.signature.body.js +2 -2
  101. package/dist/lib/output/themes/default/partials/navigation.d.ts +1 -1
  102. package/dist/lib/output/themes/default/partials/navigation.js +36 -56
  103. package/dist/lib/output/themes/default/partials/parameter.js +3 -3
  104. package/dist/lib/output/themes/lib.d.ts +1 -2
  105. package/dist/lib/output/themes/lib.js +1 -11
  106. package/dist/lib/serialization/schema.d.ts +37 -1
  107. package/dist/lib/utils/component.d.ts +1 -1
  108. package/dist/lib/utils/component.js +3 -1
  109. package/dist/lib/utils/entry-point.d.ts +0 -6
  110. package/dist/lib/utils/entry-point.js +27 -113
  111. package/dist/lib/utils/events.js +1 -1
  112. package/dist/lib/utils/general.js +1 -1
  113. package/dist/lib/utils/index.d.ts +1 -1
  114. package/dist/lib/utils/index.js +2 -1
  115. package/dist/lib/utils/jsx.d.ts +1 -1
  116. package/dist/lib/utils/jsx.js +24 -15
  117. package/dist/lib/utils/options/declaration.d.ts +5 -1
  118. package/dist/lib/utils/options/declaration.js +1 -1
  119. package/dist/lib/utils/options/index.d.ts +1 -1
  120. package/dist/lib/utils/options/index.js +2 -1
  121. package/dist/lib/utils/options/options.d.ts +22 -9
  122. package/dist/lib/utils/options/options.js +27 -15
  123. package/dist/lib/utils/options/readers/tsconfig.js +2 -7
  124. package/dist/lib/utils/options/readers/typedoc.d.ts +4 -2
  125. package/dist/lib/utils/options/readers/typedoc.js +33 -7
  126. package/dist/lib/utils/options/sources/typedoc.js +25 -4
  127. package/dist/lib/utils/options/tsdoc-defaults.d.ts +1 -1
  128. package/dist/lib/utils/options/tsdoc-defaults.js +4 -0
  129. package/dist/lib/utils/package-manifest.d.ts +0 -25
  130. package/dist/lib/utils/package-manifest.js +7 -148
  131. package/dist/lib/utils/perf.d.ts +1 -1
  132. package/dist/lib/utils/perf.js +36 -31
  133. package/dist/lib/utils/sort.js +0 -1
  134. package/dist/lib/validation/links.js +10 -2
  135. package/package.json +12 -12
  136. package/static/main.js +4 -3
  137. package/static/style.css +26 -10
  138. package/tsdoc.json +16 -0
@@ -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,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 = exports.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 reflection of Object.values(project.reflections)) {
107
- if (reflection instanceof index_1.DeclarationReflection) {
108
- this.tryResolve(project, reflection);
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
- tryResolve(project, reflection) {
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
- else {
128
- for (const req of requirements) {
129
- const future = this.postponed.get(req) ?? new Set();
130
- future.add(reflection);
131
- 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
+ }
132
149
  }
133
150
  }
134
- }
135
- doResolve(project, reflection) {
136
- if (reflection.kindOf(index_1.ReflectionKind.Class) &&
137
- reflection.implementedTypes) {
138
- reflection.implementedTypes.forEach((type) => {
139
- if (!(type instanceof types_1.ReferenceType)) {
140
- 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);
141
163
  }
142
- if (type.reflection &&
143
- type.reflection.kindOf(index_1.ReflectionKind.ClassOrInterface)) {
144
- 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);
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
- return { symbol, declaration };
172
- }
173
- onSignature(context, reflection) {
174
- this.onDeclaration(context, reflection.parent);
175
- }
176
- /**
177
- * Responsible for setting the {@link DeclarationReflection.inheritedFrom},
178
- * {@link DeclarationReflection.overwrites}, and {@link DeclarationReflection.implementationOf}
179
- * properties on the provided reflection temporarily, these links will be replaced
180
- * during the resolve step with links which actually point to the right place.
181
- */
182
- onDeclaration(context, reflection) {
183
- const info = this.getExtensionInfo(context, reflection);
184
- if (!info) {
185
- 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
+ }
186
191
  }
187
- if (reflection.kind === index_1.ReflectionKind.Constructor) {
188
- const ctor = info.declaration.members.find(typescript_1.default.isConstructorDeclaration);
189
- constructorInheritance(context, reflection, info.declaration, ctor);
190
- 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 };
191
211
  }
192
- const childType = reflection.flags.isStatic
193
- ? context.checker.getTypeOfSymbolAtLocation(info.symbol, info.declaration)
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
- // Need to check both extends and implements clauses.
202
- out: for (const clause of info.declaration.heritageClauses ?? []) {
203
- // No point checking implemented types for static members, they won't exist.
204
- if (reflection.flags.isStatic &&
205
- clause.token === typescript_1.default.SyntaxKind.ImplementsKeyword) {
206
- 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;
207
240
  }
208
- for (const expr of clause.types) {
209
- const parentType = context.checker.getTypeAtLocation(reflection.flags.isStatic ? expr.expression : expr);
210
- const parentProperty = findProperty(reflection, parentType);
211
- if (parentProperty) {
212
- const isInherit = property
213
- .getDeclarations()
214
- ?.some((d) => d.parent !== info.declaration) ??
215
- true;
216
- createLink(context, reflection, clause, expr, parentProperty, isInherit);
217
- // Can't always break because we need to also set `implementationOf` if we
218
- // inherit from a base class and also implement an interface.
219
- if (clause.token === typescript_1.default.SyntaxKind.ImplementsKeyword) {
220
- 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
+ }
221
262
  }
222
263
  }
223
264
  }
224
265
  }
225
- }
226
- };
227
- exports.ImplementsPlugin = ImplementsPlugin = __decorate([
228
- (0, components_1.Component)({ name: "implements" })
229
- ], ImplementsPlugin);
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] ?? (reflection[key] = types_1.ReferenceType.createBrokenReference(name, context.project));
284
+ reflection[key] ??= types_1.ReferenceType.createBrokenReference(name, context.project);
237
285
  for (const sig of reflection.signatures ?? []) {
238
- sig[key] ?? (sig[key] = types_1.ReferenceType.createBrokenReference(name, context.project));
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 ?? (target.implementationOf = types_1.ReferenceType.createBrokenReference(name, project));
312
+ target.implementationOf ??= types_1.ReferenceType.createBrokenReference(name, project);
265
313
  return;
266
314
  }
267
315
  if (isOverwrite) {
268
- target.inheritedFrom ?? (target.inheritedFrom = types_1.ReferenceType.createBrokenReference(name, project));
316
+ target.inheritedFrom ??= types_1.ReferenceType.createBrokenReference(name, project);
269
317
  }
270
318
  else {
271
- target.overwrites ?? (target.overwrites = types_1.ReferenceType.createBrokenReference(name, project));
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.