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
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
41
|
exports.TypePlugin = void 0;
|
|
@@ -15,112 +47,127 @@ const application_events_1 = require("../../application-events");
|
|
|
15
47
|
/**
|
|
16
48
|
* Responsible for adding `implementedBy` / `implementedFrom`
|
|
17
49
|
*/
|
|
18
|
-
let TypePlugin =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
[converter_1.Converter.EVENT_RESOLVE]: this.onResolve,
|
|
29
|
-
[converter_1.Converter.EVENT_RESOLVE_END]: this.onResolveEnd,
|
|
30
|
-
[converter_1.Converter.EVENT_END]: () => this.reflections.clear(),
|
|
31
|
-
});
|
|
32
|
-
this.listenTo(this.application, {
|
|
33
|
-
[application_events_1.ApplicationEvents.REVIVE]: this.onRevive,
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
onRevive(project) {
|
|
37
|
-
for (const refl of Object.values(project.reflections)) {
|
|
38
|
-
this.resolve(project, refl);
|
|
50
|
+
let TypePlugin = (() => {
|
|
51
|
+
let _classDecorators = [(0, components_1.Component)({ name: "type" })];
|
|
52
|
+
let _classDescriptor;
|
|
53
|
+
let _classExtraInitializers = [];
|
|
54
|
+
let _classThis;
|
|
55
|
+
let _classSuper = components_1.ConverterComponent;
|
|
56
|
+
var TypePlugin = _classThis = class extends _classSuper {
|
|
57
|
+
constructor() {
|
|
58
|
+
super(...arguments);
|
|
59
|
+
this.reflections = new Set();
|
|
39
60
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return;
|
|
49
|
-
if (reflection.kindOf(index_1.ReflectionKind.ClassOrInterface)) {
|
|
50
|
-
this.postpone(reflection);
|
|
51
|
-
walk(reflection.implementedTypes, (target) => {
|
|
52
|
-
this.postpone(target);
|
|
53
|
-
if (!target.implementedBy) {
|
|
54
|
-
target.implementedBy = [];
|
|
55
|
-
}
|
|
56
|
-
target.implementedBy.push(types_1.ReferenceType.createResolvedReference(reflection.name, reflection, project));
|
|
61
|
+
/**
|
|
62
|
+
* Create a new TypeHandler instance.
|
|
63
|
+
*/
|
|
64
|
+
initialize() {
|
|
65
|
+
this.listenTo(this.owner, {
|
|
66
|
+
[converter_1.Converter.EVENT_RESOLVE]: this.onResolve,
|
|
67
|
+
[converter_1.Converter.EVENT_RESOLVE_END]: this.onResolveEnd,
|
|
68
|
+
[converter_1.Converter.EVENT_END]: () => this.reflections.clear(),
|
|
57
69
|
});
|
|
58
|
-
|
|
59
|
-
this.
|
|
60
|
-
if (!target.extendedBy) {
|
|
61
|
-
target.extendedBy = [];
|
|
62
|
-
}
|
|
63
|
-
target.extendedBy.push(types_1.ReferenceType.createResolvedReference(reflection.name, reflection, project));
|
|
70
|
+
this.listenTo(this.application, {
|
|
71
|
+
[application_events_1.ApplicationEvents.REVIVE]: this.onRevive,
|
|
64
72
|
});
|
|
65
73
|
}
|
|
66
|
-
|
|
67
|
-
|
|
74
|
+
onRevive(project) {
|
|
75
|
+
for (const id in project.reflections) {
|
|
76
|
+
this.resolve(project, project.reflections[id],
|
|
77
|
+
/* create links */ false);
|
|
78
|
+
}
|
|
79
|
+
this.finishResolve(project);
|
|
80
|
+
this.reflections.clear();
|
|
81
|
+
}
|
|
82
|
+
onResolve(context, reflection) {
|
|
83
|
+
this.resolve(context.project, reflection);
|
|
84
|
+
}
|
|
85
|
+
resolve(project, reflection, createLinks = true) {
|
|
86
|
+
if (!(reflection instanceof index_1.DeclarationReflection))
|
|
68
87
|
return;
|
|
88
|
+
if (reflection.kindOf(index_1.ReflectionKind.ClassOrInterface)) {
|
|
89
|
+
this.postpone(reflection);
|
|
90
|
+
walk(reflection.implementedTypes, (target) => {
|
|
91
|
+
this.postpone(target);
|
|
92
|
+
target.implementedBy ||= [];
|
|
93
|
+
if (createLinks) {
|
|
94
|
+
target.implementedBy.push(types_1.ReferenceType.createResolvedReference(reflection.name, reflection, project));
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
walk(reflection.extendedTypes, (target) => {
|
|
98
|
+
this.postpone(target);
|
|
99
|
+
target.extendedBy ||= [];
|
|
100
|
+
if (createLinks) {
|
|
101
|
+
target.extendedBy.push(types_1.ReferenceType.createResolvedReference(reflection.name, reflection, project));
|
|
102
|
+
}
|
|
103
|
+
});
|
|
69
104
|
}
|
|
70
|
-
types
|
|
71
|
-
if (!
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
if (!type.reflection ||
|
|
75
|
-
!(type.reflection instanceof index_1.DeclarationReflection)) {
|
|
105
|
+
function walk(types, callback) {
|
|
106
|
+
if (!types) {
|
|
76
107
|
return;
|
|
77
108
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
postpone(reflection) {
|
|
83
|
-
this.reflections.add(reflection);
|
|
84
|
-
}
|
|
85
|
-
onResolveEnd(context) {
|
|
86
|
-
this.finishResolve(context.project);
|
|
87
|
-
}
|
|
88
|
-
finishResolve(project) {
|
|
89
|
-
this.reflections.forEach((reflection) => {
|
|
90
|
-
if (reflection.implementedBy) {
|
|
91
|
-
reflection.implementedBy.sort((a, b) => {
|
|
92
|
-
if (a.name === b.name) {
|
|
93
|
-
return 0;
|
|
109
|
+
types.forEach((type) => {
|
|
110
|
+
if (!(type instanceof types_1.ReferenceType)) {
|
|
111
|
+
return;
|
|
94
112
|
}
|
|
95
|
-
|
|
113
|
+
if (!type.reflection ||
|
|
114
|
+
!(type.reflection instanceof index_1.DeclarationReflection)) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
callback(type.reflection);
|
|
96
118
|
});
|
|
97
119
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
120
|
+
}
|
|
121
|
+
postpone(reflection) {
|
|
122
|
+
this.reflections.add(reflection);
|
|
123
|
+
}
|
|
124
|
+
onResolveEnd(context) {
|
|
125
|
+
this.finishResolve(context.project);
|
|
126
|
+
}
|
|
127
|
+
finishResolve(project) {
|
|
128
|
+
this.reflections.forEach((reflection) => {
|
|
129
|
+
if (reflection.implementedBy) {
|
|
130
|
+
reflection.implementedBy.sort((a, b) => {
|
|
131
|
+
if (a.name === b.name) {
|
|
132
|
+
return 0;
|
|
133
|
+
}
|
|
134
|
+
return a.name > b.name ? 1 : -1;
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
let root;
|
|
138
|
+
let hierarchy;
|
|
139
|
+
function push(types) {
|
|
140
|
+
const level = { types: types };
|
|
141
|
+
if (hierarchy) {
|
|
142
|
+
hierarchy.next = level;
|
|
143
|
+
hierarchy = level;
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
root = hierarchy = level;
|
|
147
|
+
}
|
|
105
148
|
}
|
|
106
|
-
|
|
107
|
-
|
|
149
|
+
if (reflection.extendedTypes) {
|
|
150
|
+
push(reflection.extendedTypes);
|
|
108
151
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
152
|
+
push([
|
|
153
|
+
types_1.ReferenceType.createResolvedReference(reflection.name, reflection, project),
|
|
154
|
+
]);
|
|
155
|
+
hierarchy.isTarget = true;
|
|
156
|
+
if (reflection.extendedBy) {
|
|
157
|
+
push(reflection.extendedBy);
|
|
158
|
+
}
|
|
159
|
+
reflection.typeHierarchy = root;
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
__setFunctionName(_classThis, "TypePlugin");
|
|
164
|
+
(() => {
|
|
165
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
166
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
167
|
+
TypePlugin = _classThis = _classDescriptor.value;
|
|
168
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
169
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
170
|
+
})();
|
|
171
|
+
return TypePlugin = _classThis;
|
|
172
|
+
})();
|
|
173
|
+
exports.TypePlugin = TypePlugin;
|
|
@@ -176,8 +176,16 @@ function convertNamespace(context, symbol, exportSymbol) {
|
|
|
176
176
|
return;
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
|
|
180
|
-
context.
|
|
179
|
+
// #2364, @namespace on a variable might be merged with a namespace containing types.
|
|
180
|
+
const existingReflection = context.project.getReflectionFromSymbol(exportSymbol || symbol);
|
|
181
|
+
let reflection;
|
|
182
|
+
if (existingReflection?.kind === models_1.ReflectionKind.Namespace) {
|
|
183
|
+
reflection = existingReflection;
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
reflection = context.createDeclarationReflection(models_1.ReflectionKind.Namespace, symbol, exportSymbol);
|
|
187
|
+
context.finalizeDeclarationReflection(reflection);
|
|
188
|
+
}
|
|
181
189
|
convertSymbols(context.withScope(reflection), context.checker
|
|
182
190
|
.getExportsOfModule(symbol)
|
|
183
191
|
.filter((s) => s.flags & exportFlags));
|
|
@@ -216,6 +224,9 @@ function convertTypeAliasAsInterface(context, symbol, exportSymbol, declaration)
|
|
|
216
224
|
context.finalizeDeclarationReflection(reflection);
|
|
217
225
|
const rc = context.withScope(reflection);
|
|
218
226
|
const type = context.checker.getTypeAtLocation(declaration);
|
|
227
|
+
if (type.getFlags() & typescript_1.default.TypeFlags.Union) {
|
|
228
|
+
context.logger.warn(`Using @interface on a union type will discard properties not present on all branches of the union. TypeDoc's output may not accurately describe your source code.`, declaration);
|
|
229
|
+
}
|
|
219
230
|
// Interfaces have properties
|
|
220
231
|
convertSymbols(rc, type.getProperties());
|
|
221
232
|
// And type arguments
|
|
@@ -511,7 +522,8 @@ function convertVariableAsNamespace(context, symbol, exportSymbol) {
|
|
|
511
522
|
const reflection = context.createDeclarationReflection(models_1.ReflectionKind.Namespace, symbol, exportSymbol);
|
|
512
523
|
context.finalizeDeclarationReflection(reflection);
|
|
513
524
|
const rc = context.withScope(reflection);
|
|
514
|
-
const declaration = symbol.declarations
|
|
525
|
+
const declaration = symbol.declarations?.find(typescript_1.default.isVariableDeclaration);
|
|
526
|
+
(0, assert_1.default)(declaration, "Missing variable declaration");
|
|
515
527
|
const type = context.checker.getTypeAtLocation(declaration);
|
|
516
528
|
convertSymbols(rc, type.getProperties());
|
|
517
529
|
return typescript_1.default.SymbolFlags.Property;
|
|
@@ -529,7 +541,7 @@ function convertVariableAsFunction(context, symbol, exportSymbol) {
|
|
|
529
541
|
reflection.conversionFlags |= models_1.ConversionFlags.VariableOrPropertySource;
|
|
530
542
|
context.finalizeDeclarationReflection(reflection);
|
|
531
543
|
const reflectionContext = context.withScope(reflection);
|
|
532
|
-
reflection.signatures
|
|
544
|
+
reflection.signatures ??= [];
|
|
533
545
|
for (const signature of type.getCallSignatures()) {
|
|
534
546
|
(0, signature_1.createSignature)(reflectionContext, models_1.ReflectionKind.CallSignature, signature, symbol);
|
|
535
547
|
}
|
|
@@ -29,6 +29,7 @@ function loadConverters() {
|
|
|
29
29
|
indexedAccessConverter,
|
|
30
30
|
inferredConverter,
|
|
31
31
|
intersectionConverter,
|
|
32
|
+
intrinsicConverter,
|
|
32
33
|
jsDocVariadicTypeConverter,
|
|
33
34
|
keywordConverter,
|
|
34
35
|
optionalConverter,
|
|
@@ -262,6 +263,15 @@ const intersectionConverter = {
|
|
|
262
263
|
return new models_1.IntersectionType(type.types.map((type) => convertType(context, type)));
|
|
263
264
|
},
|
|
264
265
|
};
|
|
266
|
+
const intrinsicConverter = {
|
|
267
|
+
kind: [typescript_1.default.SyntaxKind.IntrinsicKeyword],
|
|
268
|
+
convert() {
|
|
269
|
+
return new models_1.IntrinsicType("intrinsic");
|
|
270
|
+
},
|
|
271
|
+
convertType() {
|
|
272
|
+
return new models_1.IntrinsicType("intrinsic");
|
|
273
|
+
},
|
|
274
|
+
};
|
|
265
275
|
const jsDocVariadicTypeConverter = {
|
|
266
276
|
kind: [typescript_1.default.SyntaxKind.JSDocVariadicType],
|
|
267
277
|
convert(context, node) {
|
|
@@ -561,7 +571,12 @@ const tupleConverter = {
|
|
|
561
571
|
let elements = types?.map((type) => convertType(context, type));
|
|
562
572
|
if (type.target.labeledElementDeclarations) {
|
|
563
573
|
const namedDeclarations = type.target.labeledElementDeclarations;
|
|
564
|
-
elements = elements?.map((el, i) =>
|
|
574
|
+
elements = elements?.map((el, i) => {
|
|
575
|
+
const namedDecl = namedDeclarations[i];
|
|
576
|
+
return namedDecl
|
|
577
|
+
? new models_1.NamedTupleMember(namedDecl.name.getText(), !!namedDecl.questionToken, (0, reflections_1.removeUndefined)(el))
|
|
578
|
+
: el;
|
|
579
|
+
});
|
|
565
580
|
}
|
|
566
581
|
elements = elements?.map((el, i) => {
|
|
567
582
|
if (type.target.elementFlags[i] & typescript_1.default.ElementFlags.Variable) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
|
-
export declare function isNamedNode(node:
|
|
3
|
-
name: ts.Identifier | ts.PrivateIdentifier | ts.ComputedPropertyName;
|
|
2
|
+
export declare function isNamedNode(node: unknown): node is {
|
|
3
|
+
readonly name: ts.Identifier | ts.PrivateIdentifier | ts.ComputedPropertyName;
|
|
4
4
|
};
|
|
5
5
|
export declare function getHeritageTypes(declarations: readonly (ts.ClassDeclaration | ts.InterfaceDeclaration)[], kind: ts.SyntaxKind.ImplementsKeyword | ts.SyntaxKind.ExtendsKeyword): ts.ExpressionWithTypeArguments[];
|
|
6
6
|
export declare function isObjectType(type: ts.Type): type is ts.ObjectType;
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import type { Logger } from "../../utils";
|
|
2
|
-
export declare
|
|
2
|
+
export declare function gitIsInstalled(): boolean;
|
|
3
|
+
export interface Repository {
|
|
4
|
+
getURL(fileName: string, line: number): string | undefined;
|
|
5
|
+
}
|
|
6
|
+
export declare class AssumedRepository implements Repository {
|
|
7
|
+
readonly path: string;
|
|
8
|
+
readonly gitRevision: string;
|
|
9
|
+
readonly sourceLinkTemplate: string;
|
|
10
|
+
constructor(path: string, gitRevision: string, sourceLinkTemplate: string);
|
|
11
|
+
getURL(fileName: string, line: number): string | undefined;
|
|
12
|
+
}
|
|
3
13
|
/**
|
|
4
14
|
* Stores data of a repository.
|
|
5
15
|
*/
|
|
6
|
-
export declare class Repository {
|
|
16
|
+
export declare class GitRepository implements Repository {
|
|
7
17
|
/**
|
|
8
18
|
* The path of this repository on disk.
|
|
9
19
|
*/
|
|
@@ -31,11 +41,11 @@ export declare class Repository {
|
|
|
31
41
|
* Try to create a new repository instance.
|
|
32
42
|
*
|
|
33
43
|
* Checks whether the given path is the root of a valid repository and if so
|
|
34
|
-
* creates a new instance of {@link
|
|
44
|
+
* creates a new instance of {@link GitRepository}.
|
|
35
45
|
*
|
|
36
46
|
* @param path The potential repository root.
|
|
37
|
-
* @returns A new instance of {@link
|
|
47
|
+
* @returns A new instance of {@link GitRepository} or undefined.
|
|
38
48
|
*/
|
|
39
|
-
static tryCreateRepository(path: string, sourceLinkTemplate: string, gitRevision: string, gitRemote: string, logger: Logger):
|
|
49
|
+
static tryCreateRepository(path: string, sourceLinkTemplate: string, gitRevision: string, gitRemote: string, logger: Logger): GitRepository | undefined;
|
|
40
50
|
}
|
|
41
51
|
export declare function guessSourceUrlTemplate(remotes: string[]): string | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.guessSourceUrlTemplate = exports.
|
|
3
|
+
exports.guessSourceUrlTemplate = exports.GitRepository = exports.AssumedRepository = exports.gitIsInstalled = void 0;
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
5
|
const base_path_1 = require("../utils/base-path");
|
|
6
6
|
const TEN_MEGABYTES = 1024 * 10000;
|
|
@@ -11,11 +11,32 @@ function git(...args) {
|
|
|
11
11
|
maxBuffer: TEN_MEGABYTES,
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
let haveGit;
|
|
15
|
+
function gitIsInstalled() {
|
|
16
|
+
haveGit ??= git("--version").status === 0;
|
|
17
|
+
return haveGit;
|
|
18
|
+
}
|
|
19
|
+
exports.gitIsInstalled = gitIsInstalled;
|
|
20
|
+
class AssumedRepository {
|
|
21
|
+
constructor(path, gitRevision, sourceLinkTemplate) {
|
|
22
|
+
this.path = path;
|
|
23
|
+
this.gitRevision = gitRevision;
|
|
24
|
+
this.sourceLinkTemplate = sourceLinkTemplate;
|
|
25
|
+
}
|
|
26
|
+
getURL(fileName, line) {
|
|
27
|
+
const replacements = {
|
|
28
|
+
gitRevision: this.gitRevision,
|
|
29
|
+
path: fileName.substring(this.path.length + 1),
|
|
30
|
+
line,
|
|
31
|
+
};
|
|
32
|
+
return this.sourceLinkTemplate.replace(/\{(path|line)\}/g, (_, key) => replacements[key]);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.AssumedRepository = AssumedRepository;
|
|
15
36
|
/**
|
|
16
37
|
* Stores data of a repository.
|
|
17
38
|
*/
|
|
18
|
-
class
|
|
39
|
+
class GitRepository {
|
|
19
40
|
/**
|
|
20
41
|
* Create a new Repository instance.
|
|
21
42
|
*
|
|
@@ -59,26 +80,22 @@ class Repository {
|
|
|
59
80
|
* Try to create a new repository instance.
|
|
60
81
|
*
|
|
61
82
|
* Checks whether the given path is the root of a valid repository and if so
|
|
62
|
-
* creates a new instance of {@link
|
|
83
|
+
* creates a new instance of {@link GitRepository}.
|
|
63
84
|
*
|
|
64
85
|
* @param path The potential repository root.
|
|
65
|
-
* @returns A new instance of {@link
|
|
86
|
+
* @returns A new instance of {@link GitRepository} or undefined.
|
|
66
87
|
*/
|
|
67
88
|
static tryCreateRepository(path, sourceLinkTemplate, gitRevision, gitRemote, logger) {
|
|
68
89
|
const topLevel = git("-C", path, "rev-parse", "--show-toplevel");
|
|
69
90
|
if (topLevel.status !== 0)
|
|
70
91
|
return;
|
|
71
|
-
gitRevision
|
|
92
|
+
gitRevision ||= git("-C", path, "rev-parse", "--short", "HEAD").stdout.trim();
|
|
72
93
|
if (!gitRevision)
|
|
73
94
|
return; // Will only happen in a repo with no commits.
|
|
74
95
|
let urlTemplate;
|
|
75
96
|
if (sourceLinkTemplate) {
|
|
76
97
|
urlTemplate = sourceLinkTemplate;
|
|
77
98
|
}
|
|
78
|
-
else if (/^https?:\/\//.test(gitRemote)) {
|
|
79
|
-
logger.warn("Using a link as the gitRemote is deprecated and will be removed in 0.24.");
|
|
80
|
-
urlTemplate = `${gitRemote}/{gitRevision}`;
|
|
81
|
-
}
|
|
82
99
|
else {
|
|
83
100
|
const remotesOut = git("-C", path, "remote", "get-url", gitRemote);
|
|
84
101
|
if (remotesOut.status === 0) {
|
|
@@ -90,10 +107,10 @@ class Repository {
|
|
|
90
107
|
}
|
|
91
108
|
if (!urlTemplate)
|
|
92
109
|
return;
|
|
93
|
-
return new
|
|
110
|
+
return new GitRepository(base_path_1.BasePath.normalize(topLevel.stdout.replace("\n", "")), gitRevision, urlTemplate);
|
|
94
111
|
}
|
|
95
112
|
}
|
|
96
|
-
exports.
|
|
113
|
+
exports.GitRepository = GitRepository;
|
|
97
114
|
// Should have three capturing groups:
|
|
98
115
|
// 1. hostname
|
|
99
116
|
// 2. user
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReflectionCategory } from "./ReflectionCategory";
|
|
2
|
-
import type { DeclarationReflection } from ".";
|
|
2
|
+
import type { DeclarationReflection, Reflection } from ".";
|
|
3
3
|
import type { Serializer, JSONOutput, Deserializer } from "../serialization";
|
|
4
4
|
/**
|
|
5
5
|
* A group of reflections. All reflections in a group are of the same kind.
|
|
@@ -9,6 +9,7 @@ import type { Serializer, JSONOutput, Deserializer } from "../serialization";
|
|
|
9
9
|
* render human readable children lists in templates.
|
|
10
10
|
*/
|
|
11
11
|
export declare class ReflectionGroup {
|
|
12
|
+
readonly owningReflection: Reflection;
|
|
12
13
|
/**
|
|
13
14
|
* The title, a string representation of the typescript kind, of this group.
|
|
14
15
|
*/
|
|
@@ -25,8 +26,9 @@ export declare class ReflectionGroup {
|
|
|
25
26
|
* Create a new ReflectionGroup instance.
|
|
26
27
|
*
|
|
27
28
|
* @param title The title of this group.
|
|
29
|
+
* @param owningReflection The reflection containing this group, useful for changing rendering based on a comment on a reflection.
|
|
28
30
|
*/
|
|
29
|
-
constructor(title: string);
|
|
31
|
+
constructor(title: string, owningReflection: Reflection);
|
|
30
32
|
/**
|
|
31
33
|
* Do all children of this group have a separate document?
|
|
32
34
|
*/
|
|
@@ -14,8 +14,10 @@ class ReflectionGroup {
|
|
|
14
14
|
* Create a new ReflectionGroup instance.
|
|
15
15
|
*
|
|
16
16
|
* @param title The title of this group.
|
|
17
|
+
* @param owningReflection The reflection containing this group, useful for changing rendering based on a comment on a reflection.
|
|
17
18
|
*/
|
|
18
|
-
constructor(title) {
|
|
19
|
+
constructor(title, owningReflection) {
|
|
20
|
+
this.owningReflection = owningReflection;
|
|
19
21
|
/**
|
|
20
22
|
* All reflections of this group.
|
|
21
23
|
*/
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { Reflection } from "../reflections";
|
|
2
2
|
import { ReflectionSymbolId } from "../reflections/ReflectionSymbolId";
|
|
3
3
|
import type { Serializer, Deserializer, JSONOutput } from "../../serialization";
|
|
4
|
+
/**
|
|
5
|
+
* Represents a parsed piece of a comment.
|
|
6
|
+
* @category Comments
|
|
7
|
+
*/
|
|
4
8
|
export type CommentDisplayPart = {
|
|
5
9
|
kind: "text";
|
|
6
10
|
text: string;
|
|
@@ -13,6 +17,7 @@ export type CommentDisplayPart = {
|
|
|
13
17
|
* property set indicating which reflection/url they link to. They may also
|
|
14
18
|
* have a `tsLinkText` property which includes the part of the `text` which
|
|
15
19
|
* TypeScript thinks should be displayed as the link text.
|
|
20
|
+
* @category Comments
|
|
16
21
|
*/
|
|
17
22
|
export interface InlineTagDisplayPart {
|
|
18
23
|
kind: "inline-tag";
|
|
@@ -25,6 +30,7 @@ export interface InlineTagDisplayPart {
|
|
|
25
30
|
* A model that represents a single TypeDoc comment tag.
|
|
26
31
|
*
|
|
27
32
|
* Tags are stored in the {@link Comment.blockTags} property.
|
|
33
|
+
* @category Comments
|
|
28
34
|
*/
|
|
29
35
|
export declare class CommentTag {
|
|
30
36
|
/**
|
|
@@ -53,6 +59,7 @@ export declare class CommentTag {
|
|
|
53
59
|
*
|
|
54
60
|
* Instances of this model are created by the CommentPlugin. You can retrieve comments
|
|
55
61
|
* through the {@link DeclarationReflection.comment} property.
|
|
62
|
+
* @category Comments
|
|
56
63
|
*/
|
|
57
64
|
export declare class Comment {
|
|
58
65
|
/**
|
|
@@ -97,7 +104,7 @@ export declare class Comment {
|
|
|
97
104
|
/**
|
|
98
105
|
* All modifier tags present on the comment, e.g. `@alpha`, `@beta`.
|
|
99
106
|
*/
|
|
100
|
-
modifierTags: Set
|
|
107
|
+
modifierTags: Set<`@${string}`>;
|
|
101
108
|
/**
|
|
102
109
|
* Label associated with this reflection, if any (https://tsdoc.org/pages/tags/label/)
|
|
103
110
|
*/
|
|
@@ -105,7 +112,7 @@ export declare class Comment {
|
|
|
105
112
|
/**
|
|
106
113
|
* Creates a new Comment instance.
|
|
107
114
|
*/
|
|
108
|
-
constructor(summary?: CommentDisplayPart[], blockTags?: CommentTag[], modifierTags?: Set
|
|
115
|
+
constructor(summary?: CommentDisplayPart[], blockTags?: CommentTag[], modifierTags?: Set<`@${string}`>);
|
|
109
116
|
/**
|
|
110
117
|
* Create a deep clone of this comment.
|
|
111
118
|
*/
|
|
@@ -8,6 +8,7 @@ const ReflectionSymbolId_1 = require("../reflections/ReflectionSymbolId");
|
|
|
8
8
|
* A model that represents a single TypeDoc comment tag.
|
|
9
9
|
*
|
|
10
10
|
* Tags are stored in the {@link Comment.blockTags} property.
|
|
11
|
+
* @category Comments
|
|
11
12
|
*/
|
|
12
13
|
class CommentTag {
|
|
13
14
|
/**
|
|
@@ -43,6 +44,7 @@ exports.CommentTag = CommentTag;
|
|
|
43
44
|
*
|
|
44
45
|
* Instances of this model are created by the CommentPlugin. You can retrieve comments
|
|
45
46
|
* through the {@link DeclarationReflection.comment} property.
|
|
47
|
+
* @category Comments
|
|
46
48
|
*/
|
|
47
49
|
class Comment {
|
|
48
50
|
/**
|
|
@@ -19,7 +19,7 @@ const paths_1 = require("../../utils/paths");
|
|
|
19
19
|
class ReflectionSymbolId {
|
|
20
20
|
constructor(symbol, declaration) {
|
|
21
21
|
if ("name" in symbol) {
|
|
22
|
-
declaration
|
|
22
|
+
declaration ??= symbol?.declarations?.[0];
|
|
23
23
|
this.fileName = (0, paths_1.normalizePath)(declaration?.getSourceFile().fileName ?? "\0");
|
|
24
24
|
if (symbol.declarations?.some(typescript_1.default.isSourceFile)) {
|
|
25
25
|
this.qualifiedName = "";
|
|
@@ -90,6 +90,9 @@ export interface TraverseCallback {
|
|
|
90
90
|
*/
|
|
91
91
|
(reflection: Reflection, property: TraverseProperty): boolean | NeverIfInternal<void>;
|
|
92
92
|
}
|
|
93
|
+
export type ReflectionVisitor = {
|
|
94
|
+
[K in keyof ReflectionVariant]?: (refl: ReflectionVariant[K]) => void;
|
|
95
|
+
};
|
|
93
96
|
/**
|
|
94
97
|
* Base class for all reflection classes.
|
|
95
98
|
*
|
|
@@ -100,6 +103,7 @@ export interface TraverseCallback {
|
|
|
100
103
|
* This base class exposes the basic properties one may use to traverse the reflection tree.
|
|
101
104
|
* You can use the {@link ContainerReflection.children} and {@link parent} properties to walk the tree. The {@link ContainerReflection.groups} property
|
|
102
105
|
* contains a list of all children grouped and sorted for rendering.
|
|
106
|
+
* @category Reflections
|
|
103
107
|
*/
|
|
104
108
|
export declare abstract class Reflection {
|
|
105
109
|
/**
|
|
@@ -207,7 +211,7 @@ export declare abstract class Reflection {
|
|
|
207
211
|
* Traverse most potential child reflections of this reflection.
|
|
208
212
|
*
|
|
209
213
|
* Note: This may not necessarily traverse child reflections contained within the `type` property
|
|
210
|
-
* of the reflection, and should not be relied on for this. Support for checking object types will likely be removed in v0.
|
|
214
|
+
* of the reflection, and should not be relied on for this. Support for checking object types will likely be removed in v0.26.
|
|
211
215
|
*
|
|
212
216
|
* The given callback will be invoked for all children, signatures and type parameters
|
|
213
217
|
* attached to this reflection.
|
|
@@ -215,6 +219,7 @@ export declare abstract class Reflection {
|
|
|
215
219
|
* @param callback The callback function that should be applied for each child reflection.
|
|
216
220
|
*/
|
|
217
221
|
abstract traverse(callback: TraverseCallback): void;
|
|
222
|
+
visit(visitor: ReflectionVisitor): void;
|
|
218
223
|
/**
|
|
219
224
|
* Return a string representation of this reflection.
|
|
220
225
|
*/
|