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,14 +1,56 @@
|
|
|
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 });
|
|
39
|
+
};
|
|
40
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
41
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
42
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
43
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
44
|
+
};
|
|
45
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
46
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
47
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
48
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
49
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
50
|
};
|
|
8
51
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
52
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
53
|
};
|
|
11
|
-
var Converter_1;
|
|
12
54
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
55
|
exports.Converter = void 0;
|
|
14
56
|
const typescript_1 = __importDefault(require("typescript"));
|
|
@@ -28,328 +70,415 @@ const linkResolver_1 = require("./comments/linkResolver");
|
|
|
28
70
|
/**
|
|
29
71
|
* Compiles source files using TypeScript and converts compiler symbols to reflections.
|
|
30
72
|
*/
|
|
31
|
-
let Converter =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
73
|
+
let Converter = (() => {
|
|
74
|
+
var _Converter_externalPattern_accessor_storage, _Converter_excludeExternals_accessor_storage, _Converter_excludeNotDocumented_accessor_storage, _Converter_excludePrivate_accessor_storage, _Converter_excludeProtected_accessor_storage, _Converter_excludeReferences_accessor_storage, _Converter_commentStyle_accessor_storage, _Converter_validation_accessor_storage, _Converter_externalSymbolLinkMappings_accessor_storage, _Converter_useTsLinkResolution_accessor_storage, _Converter_preserveLinkText_accessor_storage;
|
|
75
|
+
let _classDecorators = [(0, component_1.Component)({
|
|
76
|
+
name: "converter",
|
|
77
|
+
internal: true,
|
|
78
|
+
childClass: components_1.ConverterComponent,
|
|
79
|
+
})];
|
|
80
|
+
let _classDescriptor;
|
|
81
|
+
let _classExtraInitializers = [];
|
|
82
|
+
let _classThis;
|
|
83
|
+
let _classSuper = component_1.ChildableComponent;
|
|
84
|
+
let _instanceExtraInitializers = [];
|
|
85
|
+
let _externalPattern_decorators;
|
|
86
|
+
let _externalPattern_initializers = [];
|
|
87
|
+
let _excludeExternals_decorators;
|
|
88
|
+
let _excludeExternals_initializers = [];
|
|
89
|
+
let _excludeNotDocumented_decorators;
|
|
90
|
+
let _excludeNotDocumented_initializers = [];
|
|
91
|
+
let _excludePrivate_decorators;
|
|
92
|
+
let _excludePrivate_initializers = [];
|
|
93
|
+
let _excludeProtected_decorators;
|
|
94
|
+
let _excludeProtected_initializers = [];
|
|
95
|
+
let _excludeReferences_decorators;
|
|
96
|
+
let _excludeReferences_initializers = [];
|
|
97
|
+
let _commentStyle_decorators;
|
|
98
|
+
let _commentStyle_initializers = [];
|
|
99
|
+
let _validation_decorators;
|
|
100
|
+
let _validation_initializers = [];
|
|
101
|
+
let _externalSymbolLinkMappings_decorators;
|
|
102
|
+
let _externalSymbolLinkMappings_initializers = [];
|
|
103
|
+
let _useTsLinkResolution_decorators;
|
|
104
|
+
let _useTsLinkResolution_initializers = [];
|
|
105
|
+
let _preserveLinkText_decorators;
|
|
106
|
+
let _preserveLinkText_initializers = [];
|
|
107
|
+
var Converter = _classThis = class extends _classSuper {
|
|
108
|
+
/** @internal */
|
|
109
|
+
get externalPattern() { return __classPrivateFieldGet(this, _Converter_externalPattern_accessor_storage, "f"); }
|
|
110
|
+
set externalPattern(value) { __classPrivateFieldSet(this, _Converter_externalPattern_accessor_storage, value, "f"); }
|
|
111
|
+
/** @internal */
|
|
112
|
+
get excludeExternals() { return __classPrivateFieldGet(this, _Converter_excludeExternals_accessor_storage, "f"); }
|
|
113
|
+
set excludeExternals(value) { __classPrivateFieldSet(this, _Converter_excludeExternals_accessor_storage, value, "f"); }
|
|
114
|
+
/** @internal */
|
|
115
|
+
get excludeNotDocumented() { return __classPrivateFieldGet(this, _Converter_excludeNotDocumented_accessor_storage, "f"); }
|
|
116
|
+
set excludeNotDocumented(value) { __classPrivateFieldSet(this, _Converter_excludeNotDocumented_accessor_storage, value, "f"); }
|
|
117
|
+
/** @internal */
|
|
118
|
+
get excludePrivate() { return __classPrivateFieldGet(this, _Converter_excludePrivate_accessor_storage, "f"); }
|
|
119
|
+
set excludePrivate(value) { __classPrivateFieldSet(this, _Converter_excludePrivate_accessor_storage, value, "f"); }
|
|
120
|
+
/** @internal */
|
|
121
|
+
get excludeProtected() { return __classPrivateFieldGet(this, _Converter_excludeProtected_accessor_storage, "f"); }
|
|
122
|
+
set excludeProtected(value) { __classPrivateFieldSet(this, _Converter_excludeProtected_accessor_storage, value, "f"); }
|
|
123
|
+
/** @internal */
|
|
124
|
+
get excludeReferences() { return __classPrivateFieldGet(this, _Converter_excludeReferences_accessor_storage, "f"); }
|
|
125
|
+
set excludeReferences(value) { __classPrivateFieldSet(this, _Converter_excludeReferences_accessor_storage, value, "f"); }
|
|
126
|
+
/** @internal */
|
|
127
|
+
get commentStyle() { return __classPrivateFieldGet(this, _Converter_commentStyle_accessor_storage, "f"); }
|
|
128
|
+
set commentStyle(value) { __classPrivateFieldSet(this, _Converter_commentStyle_accessor_storage, value, "f"); }
|
|
129
|
+
/** @internal */
|
|
130
|
+
get validation() { return __classPrivateFieldGet(this, _Converter_validation_accessor_storage, "f"); }
|
|
131
|
+
set validation(value) { __classPrivateFieldSet(this, _Converter_validation_accessor_storage, value, "f"); }
|
|
132
|
+
/** @internal */
|
|
133
|
+
get externalSymbolLinkMappings() { return __classPrivateFieldGet(this, _Converter_externalSymbolLinkMappings_accessor_storage, "f"); }
|
|
134
|
+
set externalSymbolLinkMappings(value) { __classPrivateFieldSet(this, _Converter_externalSymbolLinkMappings_accessor_storage, value, "f"); }
|
|
135
|
+
/** @internal */
|
|
136
|
+
get useTsLinkResolution() { return __classPrivateFieldGet(this, _Converter_useTsLinkResolution_accessor_storage, "f"); }
|
|
137
|
+
set useTsLinkResolution(value) { __classPrivateFieldSet(this, _Converter_useTsLinkResolution_accessor_storage, value, "f"); }
|
|
138
|
+
/** @internal */
|
|
139
|
+
get preserveLinkText() { return __classPrivateFieldGet(this, _Converter_preserveLinkText_accessor_storage, "f"); }
|
|
140
|
+
set preserveLinkText(value) { __classPrivateFieldSet(this, _Converter_preserveLinkText_accessor_storage, value, "f"); }
|
|
141
|
+
get config() {
|
|
142
|
+
return this._config || this._buildCommentParserConfig();
|
|
143
|
+
}
|
|
144
|
+
constructor(owner) {
|
|
145
|
+
super(owner);
|
|
146
|
+
_Converter_externalPattern_accessor_storage.set(this, (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _externalPattern_initializers, void 0)));
|
|
147
|
+
_Converter_excludeExternals_accessor_storage.set(this, __runInitializers(this, _excludeExternals_initializers, void 0));
|
|
148
|
+
_Converter_excludeNotDocumented_accessor_storage.set(this, __runInitializers(this, _excludeNotDocumented_initializers, void 0));
|
|
149
|
+
_Converter_excludePrivate_accessor_storage.set(this, __runInitializers(this, _excludePrivate_initializers, void 0));
|
|
150
|
+
_Converter_excludeProtected_accessor_storage.set(this, __runInitializers(this, _excludeProtected_initializers, void 0));
|
|
151
|
+
_Converter_excludeReferences_accessor_storage.set(this, __runInitializers(this, _excludeReferences_initializers, void 0));
|
|
152
|
+
_Converter_commentStyle_accessor_storage.set(this, __runInitializers(this, _commentStyle_initializers, void 0));
|
|
153
|
+
_Converter_validation_accessor_storage.set(this, __runInitializers(this, _validation_initializers, void 0));
|
|
154
|
+
_Converter_externalSymbolLinkMappings_accessor_storage.set(this, __runInitializers(this, _externalSymbolLinkMappings_initializers, void 0));
|
|
155
|
+
_Converter_useTsLinkResolution_accessor_storage.set(this, __runInitializers(this, _useTsLinkResolution_initializers, void 0));
|
|
156
|
+
_Converter_preserveLinkText_accessor_storage.set(this, __runInitializers(this, _preserveLinkText_initializers, void 0));
|
|
157
|
+
this._externalSymbolResolvers = [];
|
|
158
|
+
this.addUnknownSymbolResolver((ref) => {
|
|
159
|
+
// Require global links, matching local ones will likely hide mistakes where the
|
|
160
|
+
// user meant to link to a local type.
|
|
161
|
+
if (ref.resolutionStart !== "global" || !ref.symbolReference) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const modLinks = this.externalSymbolLinkMappings[ref.moduleSource ?? "global"];
|
|
165
|
+
if (typeof modLinks !== "object") {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
let name = "";
|
|
169
|
+
if (ref.symbolReference.path) {
|
|
170
|
+
name += ref.symbolReference.path.map((p) => p.path).join(".");
|
|
171
|
+
}
|
|
172
|
+
if (ref.symbolReference.meaning) {
|
|
173
|
+
name += ":" + ref.symbolReference.meaning;
|
|
174
|
+
}
|
|
175
|
+
if (typeof modLinks[name] === "string") {
|
|
176
|
+
return modLinks[name];
|
|
177
|
+
}
|
|
178
|
+
if (typeof modLinks["*"] === "string") {
|
|
179
|
+
return modLinks["*"];
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Compile the given source files and create a project reflection for them.
|
|
185
|
+
*/
|
|
186
|
+
convert(entryPoints) {
|
|
187
|
+
const programs = entryPoints.map((e) => e.program);
|
|
188
|
+
this.externalPatternCache = void 0;
|
|
189
|
+
const project = new index_1.ProjectReflection(this.application.options.getValue("name"));
|
|
190
|
+
const context = new context_1.Context(this, programs, project);
|
|
191
|
+
this.trigger(Converter.EVENT_BEGIN, context);
|
|
192
|
+
this.compile(entryPoints, context);
|
|
193
|
+
this.resolve(context);
|
|
194
|
+
this.trigger(Converter.EVENT_END, context);
|
|
195
|
+
this._config = undefined;
|
|
196
|
+
return project;
|
|
197
|
+
}
|
|
198
|
+
/** @internal */
|
|
199
|
+
convertSymbol(context, symbol, exportSymbol) {
|
|
200
|
+
(0, symbols_1.convertSymbol)(context, symbol, exportSymbol);
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Convert the given TypeScript type into its TypeDoc type reflection.
|
|
204
|
+
*
|
|
205
|
+
* @param context The context object describing the current state the converter is in.
|
|
206
|
+
* @param referenceTarget The target to be used to attempt to resolve reference types
|
|
207
|
+
* @returns The TypeDoc type reflection representing the given node and type.
|
|
208
|
+
* @internal
|
|
209
|
+
*/
|
|
210
|
+
convertType(context, node) {
|
|
211
|
+
return (0, types_1.convertType)(context, node);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Parse the given file into a comment. Intended to be used with markdown files.
|
|
215
|
+
*/
|
|
216
|
+
parseRawComment(file) {
|
|
217
|
+
return (0, parser_1.parseComment)((0, rawLexer_1.lexCommentString)(file.text), this.config, file, this.application.logger);
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Adds a new resolver that the theme can use to try to figure out how to link to a symbol declared
|
|
221
|
+
* by a third-party library which is not included in the documentation.
|
|
222
|
+
*
|
|
223
|
+
* The resolver function will be passed a declaration reference which it can attempt to resolve. If
|
|
224
|
+
* resolution fails, the function should return undefined.
|
|
225
|
+
*
|
|
226
|
+
* Note: This will be used for both references to types declared in node_modules (in which case the
|
|
227
|
+
* reference passed will have the `moduleSource` set and the `symbolReference` will navigate via `.`)
|
|
228
|
+
* and user defined \{\@link\} tags which cannot be resolved. If the link being resolved is inferred
|
|
229
|
+
* from a type, then no `part` will be passed to the resolver function.
|
|
230
|
+
* @since 0.22.14
|
|
231
|
+
*/
|
|
232
|
+
addUnknownSymbolResolver(resolver) {
|
|
233
|
+
this._externalSymbolResolvers.push(resolver);
|
|
234
|
+
}
|
|
235
|
+
/** @internal */
|
|
236
|
+
resolveExternalLink(ref, refl, part, symbolId) {
|
|
237
|
+
for (const resolver of this._externalSymbolResolvers) {
|
|
238
|
+
const resolved = resolver(ref, refl, part, symbolId);
|
|
239
|
+
if (resolved)
|
|
240
|
+
return resolved;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
resolveLinks(comment, owner) {
|
|
244
|
+
if (comment instanceof index_1.Comment) {
|
|
245
|
+
(0, linkResolver_1.resolveLinks)(comment, owner, (ref, part, refl, id) => this.resolveExternalLink(ref, part, refl, id), { preserveLinkText: this.preserveLinkText });
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
return (0, linkResolver_1.resolvePartLinks)(owner, comment, (ref, part, refl, id) => this.resolveExternalLink(ref, part, refl, id), { preserveLinkText: this.preserveLinkText });
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Compile the files within the given context and convert the compiler symbols to reflections.
|
|
253
|
+
*
|
|
254
|
+
* @param context The context object describing the current state the converter is in.
|
|
255
|
+
* @returns An array containing all errors generated by the TypeScript compiler.
|
|
256
|
+
*/
|
|
257
|
+
compile(entryPoints, context) {
|
|
258
|
+
const entries = entryPoints.map((e) => {
|
|
259
|
+
return {
|
|
260
|
+
entryPoint: e,
|
|
261
|
+
context: undefined,
|
|
262
|
+
};
|
|
263
|
+
});
|
|
264
|
+
entries.forEach((e) => {
|
|
265
|
+
context.setActiveProgram(e.entryPoint.program);
|
|
266
|
+
e.context = this.convertExports(context, e.entryPoint, entries.length === 1);
|
|
267
|
+
});
|
|
268
|
+
for (const { entryPoint, context } of entries) {
|
|
269
|
+
// active program is already set on context
|
|
270
|
+
// if we don't have a context, then this entry point is being ignored
|
|
271
|
+
if (context) {
|
|
272
|
+
this.convertReExports(context, entryPoint.sourceFile);
|
|
273
|
+
}
|
|
43
274
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
275
|
+
context.setActiveProgram(undefined);
|
|
276
|
+
}
|
|
277
|
+
convertExports(context, entryPoint, singleEntryPoint) {
|
|
278
|
+
const node = entryPoint.sourceFile;
|
|
279
|
+
const entryName = entryPoint.displayName;
|
|
280
|
+
const symbol = getSymbolForModuleLike(context, node);
|
|
281
|
+
let moduleContext;
|
|
282
|
+
if (singleEntryPoint) {
|
|
283
|
+
// Special case for when we're giving a single entry point, we don't need to
|
|
284
|
+
// create modules for each entry. Register the project as this module.
|
|
285
|
+
context.project.registerReflection(context.project, symbol);
|
|
286
|
+
context.project.comment = symbol
|
|
287
|
+
? context.getComment(symbol, context.project.kind)
|
|
288
|
+
: context.getFileComment(node);
|
|
289
|
+
context.trigger(Converter.EVENT_CREATE_DECLARATION, context.project);
|
|
290
|
+
moduleContext = context;
|
|
47
291
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
292
|
+
else {
|
|
293
|
+
const reflection = context.createDeclarationReflection(index_1.ReflectionKind.Module, symbol, void 0, entryName);
|
|
294
|
+
if (!reflection.comment && !symbol) {
|
|
295
|
+
reflection.comment = context.getFileComment(node);
|
|
296
|
+
}
|
|
297
|
+
if (entryPoint.readmeFile) {
|
|
298
|
+
const readme = (0, utils_1.readFile)(entryPoint.readmeFile);
|
|
299
|
+
const comment = this.parseRawComment(new utils_1.MinimalSourceFile(readme, entryPoint.readmeFile));
|
|
300
|
+
if (comment.blockTags.length || comment.modifierTags.size) {
|
|
301
|
+
const ignored = [
|
|
302
|
+
...comment.blockTags.map((tag) => tag.tag),
|
|
303
|
+
...comment.modifierTags,
|
|
304
|
+
];
|
|
305
|
+
context.logger.warn(`Block and modifier tags will be ignored within the readme:\n\t${ignored.join("\n\t")}`);
|
|
306
|
+
}
|
|
307
|
+
reflection.readme = comment.summary;
|
|
308
|
+
}
|
|
309
|
+
reflection.packageVersion = entryPoint.version;
|
|
310
|
+
context.finalizeDeclarationReflection(reflection);
|
|
311
|
+
moduleContext = context.withScope(reflection);
|
|
51
312
|
}
|
|
52
|
-
|
|
53
|
-
|
|
313
|
+
const allExports = getExports(context, node, symbol);
|
|
314
|
+
for (const exp of allExports.filter((exp) => isDirectExport(context.resolveAliasedSymbol(exp), node))) {
|
|
315
|
+
this.convertSymbol(moduleContext, exp);
|
|
54
316
|
}
|
|
55
|
-
|
|
56
|
-
|
|
317
|
+
return moduleContext;
|
|
318
|
+
}
|
|
319
|
+
convertReExports(moduleContext, node) {
|
|
320
|
+
for (const exp of getExports(moduleContext, node, moduleContext.project.getSymbolFromReflection(moduleContext.scope)).filter((exp) => !isDirectExport(moduleContext.resolveAliasedSymbol(exp), node))) {
|
|
321
|
+
this.convertSymbol(moduleContext, exp);
|
|
57
322
|
}
|
|
58
|
-
|
|
59
|
-
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Resolve the project within the given context.
|
|
326
|
+
*
|
|
327
|
+
* @param context The context object describing the current state the converter is in.
|
|
328
|
+
* @returns The final project reflection.
|
|
329
|
+
*/
|
|
330
|
+
resolve(context) {
|
|
331
|
+
this.trigger(Converter.EVENT_RESOLVE_BEGIN, context);
|
|
332
|
+
const project = context.project;
|
|
333
|
+
for (const id in project.reflections) {
|
|
334
|
+
this.trigger(Converter.EVENT_RESOLVE, context, project.reflections[id]);
|
|
60
335
|
}
|
|
61
|
-
|
|
62
|
-
|
|
336
|
+
this.trigger(Converter.EVENT_RESOLVE_END, context);
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Used to determine if we should immediately bail when creating a reflection.
|
|
340
|
+
* Note: This should not be used for excludeNotDocumented because we don't have enough
|
|
341
|
+
* information at this point since comment discovery hasn't happened.
|
|
342
|
+
* @internal
|
|
343
|
+
*/
|
|
344
|
+
shouldIgnore(symbol) {
|
|
345
|
+
if (this.isExcluded(symbol)) {
|
|
346
|
+
return true;
|
|
347
|
+
}
|
|
348
|
+
return this.excludeExternals && this.isExternal(symbol);
|
|
349
|
+
}
|
|
350
|
+
isExcluded(symbol) {
|
|
351
|
+
this.excludeCache ??= (0, paths_1.createMinimatch)(this.application.options.getValue("exclude"));
|
|
352
|
+
const cache = this.excludeCache;
|
|
353
|
+
return (symbol.getDeclarations() ?? []).some((node) => (0, paths_1.matchesAny)(cache, node.getSourceFile().fileName));
|
|
354
|
+
}
|
|
355
|
+
/** @internal */
|
|
356
|
+
isExternal(symbol) {
|
|
357
|
+
this.externalPatternCache ??= (0, paths_1.createMinimatch)(this.externalPattern);
|
|
358
|
+
const cache = this.externalPatternCache;
|
|
359
|
+
return (symbol.getDeclarations() ?? []).some((node) => (0, paths_1.matchesAny)(cache, node.getSourceFile().fileName));
|
|
360
|
+
}
|
|
361
|
+
_buildCommentParserConfig() {
|
|
362
|
+
this._config = {
|
|
363
|
+
blockTags: new Set(this.application.options.getValue("blockTags")),
|
|
364
|
+
inlineTags: new Set(this.application.options.getValue("inlineTags")),
|
|
365
|
+
modifierTags: new Set(this.application.options.getValue("modifierTags")),
|
|
366
|
+
jsDocCompatibility: this.application.options.getValue("jsDocCompatibility"),
|
|
367
|
+
};
|
|
368
|
+
return this._config;
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
_Converter_externalPattern_accessor_storage = new WeakMap();
|
|
372
|
+
_Converter_excludeExternals_accessor_storage = new WeakMap();
|
|
373
|
+
_Converter_excludeNotDocumented_accessor_storage = new WeakMap();
|
|
374
|
+
_Converter_excludePrivate_accessor_storage = new WeakMap();
|
|
375
|
+
_Converter_excludeProtected_accessor_storage = new WeakMap();
|
|
376
|
+
_Converter_excludeReferences_accessor_storage = new WeakMap();
|
|
377
|
+
_Converter_commentStyle_accessor_storage = new WeakMap();
|
|
378
|
+
_Converter_validation_accessor_storage = new WeakMap();
|
|
379
|
+
_Converter_externalSymbolLinkMappings_accessor_storage = new WeakMap();
|
|
380
|
+
_Converter_useTsLinkResolution_accessor_storage = new WeakMap();
|
|
381
|
+
_Converter_preserveLinkText_accessor_storage = new WeakMap();
|
|
382
|
+
__setFunctionName(_classThis, "Converter");
|
|
383
|
+
(() => {
|
|
384
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
385
|
+
_externalPattern_decorators = [(0, utils_1.Option)("externalPattern")];
|
|
386
|
+
_excludeExternals_decorators = [(0, utils_1.Option)("excludeExternals")];
|
|
387
|
+
_excludeNotDocumented_decorators = [(0, utils_1.Option)("excludeNotDocumented")];
|
|
388
|
+
_excludePrivate_decorators = [(0, utils_1.Option)("excludePrivate")];
|
|
389
|
+
_excludeProtected_decorators = [(0, utils_1.Option)("excludeProtected")];
|
|
390
|
+
_excludeReferences_decorators = [(0, utils_1.Option)("excludeReferences")];
|
|
391
|
+
_commentStyle_decorators = [(0, utils_1.Option)("commentStyle")];
|
|
392
|
+
_validation_decorators = [(0, utils_1.Option)("validation")];
|
|
393
|
+
_externalSymbolLinkMappings_decorators = [(0, utils_1.Option)("externalSymbolLinkMappings")];
|
|
394
|
+
_useTsLinkResolution_decorators = [(0, utils_1.Option)("useTsLinkResolution")];
|
|
395
|
+
_preserveLinkText_decorators = [(0, utils_1.Option)("preserveLinkText")];
|
|
396
|
+
__esDecorate(_classThis, null, _externalPattern_decorators, { kind: "accessor", name: "externalPattern", static: false, private: false, access: { has: obj => "externalPattern" in obj, get: obj => obj.externalPattern, set: (obj, value) => { obj.externalPattern = value; } }, metadata: _metadata }, _externalPattern_initializers, _instanceExtraInitializers);
|
|
397
|
+
__esDecorate(_classThis, null, _excludeExternals_decorators, { kind: "accessor", name: "excludeExternals", static: false, private: false, access: { has: obj => "excludeExternals" in obj, get: obj => obj.excludeExternals, set: (obj, value) => { obj.excludeExternals = value; } }, metadata: _metadata }, _excludeExternals_initializers, _instanceExtraInitializers);
|
|
398
|
+
__esDecorate(_classThis, null, _excludeNotDocumented_decorators, { kind: "accessor", name: "excludeNotDocumented", static: false, private: false, access: { has: obj => "excludeNotDocumented" in obj, get: obj => obj.excludeNotDocumented, set: (obj, value) => { obj.excludeNotDocumented = value; } }, metadata: _metadata }, _excludeNotDocumented_initializers, _instanceExtraInitializers);
|
|
399
|
+
__esDecorate(_classThis, null, _excludePrivate_decorators, { kind: "accessor", name: "excludePrivate", static: false, private: false, access: { has: obj => "excludePrivate" in obj, get: obj => obj.excludePrivate, set: (obj, value) => { obj.excludePrivate = value; } }, metadata: _metadata }, _excludePrivate_initializers, _instanceExtraInitializers);
|
|
400
|
+
__esDecorate(_classThis, null, _excludeProtected_decorators, { kind: "accessor", name: "excludeProtected", static: false, private: false, access: { has: obj => "excludeProtected" in obj, get: obj => obj.excludeProtected, set: (obj, value) => { obj.excludeProtected = value; } }, metadata: _metadata }, _excludeProtected_initializers, _instanceExtraInitializers);
|
|
401
|
+
__esDecorate(_classThis, null, _excludeReferences_decorators, { kind: "accessor", name: "excludeReferences", static: false, private: false, access: { has: obj => "excludeReferences" in obj, get: obj => obj.excludeReferences, set: (obj, value) => { obj.excludeReferences = value; } }, metadata: _metadata }, _excludeReferences_initializers, _instanceExtraInitializers);
|
|
402
|
+
__esDecorate(_classThis, null, _commentStyle_decorators, { kind: "accessor", name: "commentStyle", static: false, private: false, access: { has: obj => "commentStyle" in obj, get: obj => obj.commentStyle, set: (obj, value) => { obj.commentStyle = value; } }, metadata: _metadata }, _commentStyle_initializers, _instanceExtraInitializers);
|
|
403
|
+
__esDecorate(_classThis, null, _validation_decorators, { kind: "accessor", name: "validation", static: false, private: false, access: { has: obj => "validation" in obj, get: obj => obj.validation, set: (obj, value) => { obj.validation = value; } }, metadata: _metadata }, _validation_initializers, _instanceExtraInitializers);
|
|
404
|
+
__esDecorate(_classThis, null, _externalSymbolLinkMappings_decorators, { kind: "accessor", name: "externalSymbolLinkMappings", static: false, private: false, access: { has: obj => "externalSymbolLinkMappings" in obj, get: obj => obj.externalSymbolLinkMappings, set: (obj, value) => { obj.externalSymbolLinkMappings = value; } }, metadata: _metadata }, _externalSymbolLinkMappings_initializers, _instanceExtraInitializers);
|
|
405
|
+
__esDecorate(_classThis, null, _useTsLinkResolution_decorators, { kind: "accessor", name: "useTsLinkResolution", static: false, private: false, access: { has: obj => "useTsLinkResolution" in obj, get: obj => obj.useTsLinkResolution, set: (obj, value) => { obj.useTsLinkResolution = value; } }, metadata: _metadata }, _useTsLinkResolution_initializers, _instanceExtraInitializers);
|
|
406
|
+
__esDecorate(_classThis, null, _preserveLinkText_decorators, { kind: "accessor", name: "preserveLinkText", static: false, private: false, access: { has: obj => "preserveLinkText" in obj, get: obj => obj.preserveLinkText, set: (obj, value) => { obj.preserveLinkText = value; } }, metadata: _metadata }, _preserveLinkText_initializers, _instanceExtraInitializers);
|
|
407
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
408
|
+
Converter = _classThis = _classDescriptor.value;
|
|
409
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
410
|
+
})();
|
|
63
411
|
/**
|
|
64
|
-
*
|
|
412
|
+
* General events
|
|
65
413
|
*/
|
|
66
|
-
convert(entryPoints) {
|
|
67
|
-
const programs = entryPoints.map((e) => e.program);
|
|
68
|
-
this.externalPatternCache = void 0;
|
|
69
|
-
const project = new index_1.ProjectReflection(this.application.options.getValue("name"));
|
|
70
|
-
const context = new context_1.Context(this, programs, project);
|
|
71
|
-
this.trigger(Converter_1.EVENT_BEGIN, context);
|
|
72
|
-
this.compile(entryPoints, context);
|
|
73
|
-
this.resolve(context);
|
|
74
|
-
this.trigger(Converter_1.EVENT_END, context);
|
|
75
|
-
this._config = undefined;
|
|
76
|
-
return project;
|
|
77
|
-
}
|
|
78
|
-
/** @internal */
|
|
79
|
-
convertSymbol(context, symbol, exportSymbol) {
|
|
80
|
-
(0, symbols_1.convertSymbol)(context, symbol, exportSymbol);
|
|
81
|
-
}
|
|
82
414
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* @
|
|
86
|
-
* @param referenceTarget The target to be used to attempt to resolve reference types
|
|
87
|
-
* @returns The TypeDoc type reflection representing the given node and type.
|
|
88
|
-
* @internal
|
|
415
|
+
* Triggered when the converter begins converting a project.
|
|
416
|
+
* The listener will be given a {@link Context} object.
|
|
417
|
+
* @event
|
|
89
418
|
*/
|
|
90
|
-
|
|
91
|
-
return (0, types_1.convertType)(context, node);
|
|
92
|
-
}
|
|
419
|
+
_classThis.EVENT_BEGIN = converter_events_1.ConverterEvents.BEGIN;
|
|
93
420
|
/**
|
|
94
|
-
*
|
|
421
|
+
* Triggered when the converter has finished converting a project.
|
|
422
|
+
* The listener will be given a {@link Context} object.
|
|
423
|
+
* @event
|
|
95
424
|
*/
|
|
96
|
-
|
|
97
|
-
return (0, parser_1.parseComment)((0, rawLexer_1.lexCommentString)(file.text), this.config, file, this.application.logger);
|
|
98
|
-
}
|
|
425
|
+
_classThis.EVENT_END = converter_events_1.ConverterEvents.END;
|
|
99
426
|
/**
|
|
100
|
-
*
|
|
101
|
-
* by a third-party library which is not included in the documentation.
|
|
102
|
-
*
|
|
103
|
-
* The resolver function will be passed a declaration reference which it can attempt to resolve. If
|
|
104
|
-
* resolution fails, the function should return undefined.
|
|
105
|
-
*
|
|
106
|
-
* Note: This will be used for both references to types declared in node_modules (in which case the
|
|
107
|
-
* reference passed will have the `moduleSource` set and the `symbolReference` will navigate via `.`)
|
|
108
|
-
* and user defined \{\@link\} tags which cannot be resolved. If the link being resolved is inferred
|
|
109
|
-
* from a type, then no `part` will be passed to the resolver function.
|
|
110
|
-
* @since 0.22.14
|
|
427
|
+
* Factory events
|
|
111
428
|
*/
|
|
112
|
-
addUnknownSymbolResolver(resolver) {
|
|
113
|
-
this._externalSymbolResolvers.push(resolver);
|
|
114
|
-
}
|
|
115
|
-
/** @internal */
|
|
116
|
-
resolveExternalLink(ref, refl, part, symbolId) {
|
|
117
|
-
for (const resolver of this._externalSymbolResolvers) {
|
|
118
|
-
const resolved = resolver(ref, refl, part, symbolId);
|
|
119
|
-
if (resolved)
|
|
120
|
-
return resolved;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
resolveLinks(comment, owner) {
|
|
124
|
-
if (comment instanceof index_1.Comment) {
|
|
125
|
-
(0, linkResolver_1.resolveLinks)(comment, owner, (ref, part, refl, id) => this.resolveExternalLink(ref, part, refl, id));
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
return (0, linkResolver_1.resolvePartLinks)(owner, comment, (ref, part, refl, id) => this.resolveExternalLink(ref, part, refl, id));
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
429
|
/**
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* @
|
|
135
|
-
* @returns An array containing all errors generated by the TypeScript compiler.
|
|
430
|
+
* Triggered when the converter has created a declaration reflection.
|
|
431
|
+
* The listener will be given {@link Context} and a {@link Models.DeclarationReflection}.
|
|
432
|
+
* @event
|
|
136
433
|
*/
|
|
137
|
-
|
|
138
|
-
const entries = entryPoints.map((e) => {
|
|
139
|
-
return {
|
|
140
|
-
entryPoint: e,
|
|
141
|
-
context: undefined,
|
|
142
|
-
};
|
|
143
|
-
});
|
|
144
|
-
entries.forEach((e) => {
|
|
145
|
-
context.setActiveProgram(e.entryPoint.program);
|
|
146
|
-
e.context = this.convertExports(context, e.entryPoint, entries.length === 1);
|
|
147
|
-
});
|
|
148
|
-
for (const { entryPoint, context } of entries) {
|
|
149
|
-
// active program is already set on context
|
|
150
|
-
// if we don't have a context, then this entry point is being ignored
|
|
151
|
-
if (context) {
|
|
152
|
-
this.convertReExports(context, entryPoint.sourceFile);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
context.setActiveProgram(undefined);
|
|
156
|
-
}
|
|
157
|
-
convertExports(context, entryPoint, singleEntryPoint) {
|
|
158
|
-
const node = entryPoint.sourceFile;
|
|
159
|
-
const entryName = entryPoint.displayName;
|
|
160
|
-
const symbol = getSymbolForModuleLike(context, node);
|
|
161
|
-
let moduleContext;
|
|
162
|
-
if (singleEntryPoint) {
|
|
163
|
-
// Special case for when we're giving a single entry point, we don't need to
|
|
164
|
-
// create modules for each entry. Register the project as this module.
|
|
165
|
-
context.project.registerReflection(context.project, symbol);
|
|
166
|
-
context.project.comment = symbol
|
|
167
|
-
? context.getComment(symbol, context.project.kind)
|
|
168
|
-
: context.getFileComment(node);
|
|
169
|
-
context.trigger(Converter_1.EVENT_CREATE_DECLARATION, context.project);
|
|
170
|
-
moduleContext = context;
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
const reflection = context.createDeclarationReflection(index_1.ReflectionKind.Module, symbol, void 0, entryName);
|
|
174
|
-
if (!reflection.comment && !symbol) {
|
|
175
|
-
reflection.comment = context.getFileComment(node);
|
|
176
|
-
}
|
|
177
|
-
if (entryPoint.readmeFile) {
|
|
178
|
-
const readme = (0, utils_1.readFile)(entryPoint.readmeFile);
|
|
179
|
-
const comment = this.parseRawComment(new utils_1.MinimalSourceFile(readme, entryPoint.readmeFile));
|
|
180
|
-
if (comment.blockTags.length || comment.modifierTags.size) {
|
|
181
|
-
const ignored = [
|
|
182
|
-
...comment.blockTags.map((tag) => tag.tag),
|
|
183
|
-
...comment.modifierTags,
|
|
184
|
-
];
|
|
185
|
-
context.logger.warn(`Block and modifier tags will be ignored within the readme:\n\t${ignored.join("\n\t")}`);
|
|
186
|
-
}
|
|
187
|
-
reflection.readme = comment.summary;
|
|
188
|
-
}
|
|
189
|
-
reflection.packageVersion = entryPoint.version;
|
|
190
|
-
context.finalizeDeclarationReflection(reflection);
|
|
191
|
-
moduleContext = context.withScope(reflection);
|
|
192
|
-
}
|
|
193
|
-
const allExports = getExports(context, node, symbol);
|
|
194
|
-
for (const exp of allExports.filter((exp) => isDirectExport(context.resolveAliasedSymbol(exp), node))) {
|
|
195
|
-
(0, symbols_1.convertSymbol)(moduleContext, exp);
|
|
196
|
-
}
|
|
197
|
-
return moduleContext;
|
|
198
|
-
}
|
|
199
|
-
convertReExports(moduleContext, node) {
|
|
200
|
-
for (const exp of getExports(moduleContext, node, moduleContext.project.getSymbolFromReflection(moduleContext.scope)).filter((exp) => !isDirectExport(moduleContext.resolveAliasedSymbol(exp), node))) {
|
|
201
|
-
(0, symbols_1.convertSymbol)(moduleContext, exp);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
434
|
+
_classThis.EVENT_CREATE_DECLARATION = converter_events_1.ConverterEvents.CREATE_DECLARATION;
|
|
204
435
|
/**
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
436
|
+
* Triggered when the converter has created a signature reflection.
|
|
437
|
+
* The listener will be given {@link Context}, {@link Models.SignatureReflection} | {@link Models.ProjectReflection} the declaration,
|
|
438
|
+
* `ts.SignatureDeclaration | ts.IndexSignatureDeclaration | ts.JSDocSignature | undefined`,
|
|
439
|
+
* and `ts.Signature | undefined`. The signature will be undefined if the created signature is an index signature.
|
|
440
|
+
* @event
|
|
209
441
|
*/
|
|
210
|
-
|
|
211
|
-
this.trigger(Converter_1.EVENT_RESOLVE_BEGIN, context);
|
|
212
|
-
const project = context.project;
|
|
213
|
-
for (const reflection of Object.values(project.reflections)) {
|
|
214
|
-
this.trigger(Converter_1.EVENT_RESOLVE, context, reflection);
|
|
215
|
-
}
|
|
216
|
-
this.trigger(Converter_1.EVENT_RESOLVE_END, context);
|
|
217
|
-
}
|
|
442
|
+
_classThis.EVENT_CREATE_SIGNATURE = converter_events_1.ConverterEvents.CREATE_SIGNATURE;
|
|
218
443
|
/**
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
* @internal
|
|
444
|
+
* Triggered when the converter has created a parameter reflection.
|
|
445
|
+
* The listener will be given {@link Context}, {@link Models.ParameterReflection} and a `ts.Node?`
|
|
446
|
+
* @event
|
|
223
447
|
*/
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
*/
|
|
259
|
-
Converter.EVENT_BEGIN = converter_events_1.ConverterEvents.BEGIN;
|
|
260
|
-
/**
|
|
261
|
-
* Triggered when the converter has finished converting a project.
|
|
262
|
-
* The listener will be given a {@link Context} object.
|
|
263
|
-
* @event
|
|
264
|
-
*/
|
|
265
|
-
Converter.EVENT_END = converter_events_1.ConverterEvents.END;
|
|
266
|
-
/**
|
|
267
|
-
* Factory events
|
|
268
|
-
*/
|
|
269
|
-
/**
|
|
270
|
-
* Triggered when the converter has created a declaration reflection.
|
|
271
|
-
* The listener will be given {@link Context} and a {@link Models.DeclarationReflection}.
|
|
272
|
-
* @event
|
|
273
|
-
*/
|
|
274
|
-
Converter.EVENT_CREATE_DECLARATION = converter_events_1.ConverterEvents.CREATE_DECLARATION;
|
|
275
|
-
/**
|
|
276
|
-
* Triggered when the converter has created a signature reflection.
|
|
277
|
-
* The listener will be given {@link Context}, {@link Models.SignatureReflection} | {@link Models.ProjectReflection} the declaration,
|
|
278
|
-
* `ts.SignatureDeclaration | ts.IndexSignatureDeclaration | ts.JSDocSignature | undefined`,
|
|
279
|
-
* and `ts.Signature | undefined`. The signature will be undefined if the created signature is an index signature.
|
|
280
|
-
* @event
|
|
281
|
-
*/
|
|
282
|
-
Converter.EVENT_CREATE_SIGNATURE = converter_events_1.ConverterEvents.CREATE_SIGNATURE;
|
|
283
|
-
/**
|
|
284
|
-
* Triggered when the converter has created a parameter reflection.
|
|
285
|
-
* The listener will be given {@link Context}, {@link Models.ParameterReflection} and a `ts.Node?`
|
|
286
|
-
* @event
|
|
287
|
-
*/
|
|
288
|
-
Converter.EVENT_CREATE_PARAMETER = converter_events_1.ConverterEvents.CREATE_PARAMETER;
|
|
289
|
-
/**
|
|
290
|
-
* Triggered when the converter has created a type parameter reflection.
|
|
291
|
-
* The listener will be given {@link Context} and a {@link Models.TypeParameterReflection}
|
|
292
|
-
* @event
|
|
293
|
-
*/
|
|
294
|
-
Converter.EVENT_CREATE_TYPE_PARAMETER = converter_events_1.ConverterEvents.CREATE_TYPE_PARAMETER;
|
|
295
|
-
/**
|
|
296
|
-
* Resolve events
|
|
297
|
-
*/
|
|
298
|
-
/**
|
|
299
|
-
* Triggered when the converter begins resolving a project.
|
|
300
|
-
* The listener will be given {@link Context}.
|
|
301
|
-
* @event
|
|
302
|
-
*/
|
|
303
|
-
Converter.EVENT_RESOLVE_BEGIN = converter_events_1.ConverterEvents.RESOLVE_BEGIN;
|
|
304
|
-
/**
|
|
305
|
-
* Triggered when the converter resolves a reflection.
|
|
306
|
-
* The listener will be given {@link Context} and a {@link Reflection}.
|
|
307
|
-
* @event
|
|
308
|
-
*/
|
|
309
|
-
Converter.EVENT_RESOLVE = converter_events_1.ConverterEvents.RESOLVE;
|
|
310
|
-
/**
|
|
311
|
-
* Triggered when the converter has finished resolving a project.
|
|
312
|
-
* The listener will be given {@link Context}.
|
|
313
|
-
* @event
|
|
314
|
-
*/
|
|
315
|
-
Converter.EVENT_RESOLVE_END = converter_events_1.ConverterEvents.RESOLVE_END;
|
|
316
|
-
__decorate([
|
|
317
|
-
(0, utils_1.BindOption)("externalPattern")
|
|
318
|
-
], Converter.prototype, "externalPattern", void 0);
|
|
319
|
-
__decorate([
|
|
320
|
-
(0, utils_1.BindOption)("excludeExternals")
|
|
321
|
-
], Converter.prototype, "excludeExternals", void 0);
|
|
322
|
-
__decorate([
|
|
323
|
-
(0, utils_1.BindOption)("excludeNotDocumented")
|
|
324
|
-
], Converter.prototype, "excludeNotDocumented", void 0);
|
|
325
|
-
__decorate([
|
|
326
|
-
(0, utils_1.BindOption)("excludePrivate")
|
|
327
|
-
], Converter.prototype, "excludePrivate", void 0);
|
|
328
|
-
__decorate([
|
|
329
|
-
(0, utils_1.BindOption)("excludeProtected")
|
|
330
|
-
], Converter.prototype, "excludeProtected", void 0);
|
|
331
|
-
__decorate([
|
|
332
|
-
(0, utils_1.BindOption)("excludeReferences")
|
|
333
|
-
], Converter.prototype, "excludeReferences", void 0);
|
|
334
|
-
__decorate([
|
|
335
|
-
(0, utils_1.BindOption)("commentStyle")
|
|
336
|
-
], Converter.prototype, "commentStyle", void 0);
|
|
337
|
-
__decorate([
|
|
338
|
-
(0, utils_1.BindOption)("validation")
|
|
339
|
-
], Converter.prototype, "validation", void 0);
|
|
340
|
-
__decorate([
|
|
341
|
-
(0, utils_1.BindOption)("externalSymbolLinkMappings")
|
|
342
|
-
], Converter.prototype, "externalSymbolLinkMappings", void 0);
|
|
343
|
-
__decorate([
|
|
344
|
-
(0, utils_1.BindOption)("useTsLinkResolution")
|
|
345
|
-
], Converter.prototype, "useTsLinkResolution", void 0);
|
|
346
|
-
exports.Converter = Converter = Converter_1 = __decorate([
|
|
347
|
-
(0, component_1.Component)({
|
|
348
|
-
name: "converter",
|
|
349
|
-
internal: true,
|
|
350
|
-
childClass: components_1.ConverterComponent,
|
|
351
|
-
})
|
|
352
|
-
], Converter);
|
|
448
|
+
_classThis.EVENT_CREATE_PARAMETER = converter_events_1.ConverterEvents.CREATE_PARAMETER;
|
|
449
|
+
/**
|
|
450
|
+
* Triggered when the converter has created a type parameter reflection.
|
|
451
|
+
* The listener will be given {@link Context} and a {@link Models.TypeParameterReflection}
|
|
452
|
+
* @event
|
|
453
|
+
*/
|
|
454
|
+
_classThis.EVENT_CREATE_TYPE_PARAMETER = converter_events_1.ConverterEvents.CREATE_TYPE_PARAMETER;
|
|
455
|
+
/**
|
|
456
|
+
* Resolve events
|
|
457
|
+
*/
|
|
458
|
+
/**
|
|
459
|
+
* Triggered when the converter begins resolving a project.
|
|
460
|
+
* The listener will be given {@link Context}.
|
|
461
|
+
* @event
|
|
462
|
+
*/
|
|
463
|
+
_classThis.EVENT_RESOLVE_BEGIN = converter_events_1.ConverterEvents.RESOLVE_BEGIN;
|
|
464
|
+
/**
|
|
465
|
+
* Triggered when the converter resolves a reflection.
|
|
466
|
+
* The listener will be given {@link Context} and a {@link Reflection}.
|
|
467
|
+
* @event
|
|
468
|
+
*/
|
|
469
|
+
_classThis.EVENT_RESOLVE = converter_events_1.ConverterEvents.RESOLVE;
|
|
470
|
+
/**
|
|
471
|
+
* Triggered when the converter has finished resolving a project.
|
|
472
|
+
* The listener will be given {@link Context}.
|
|
473
|
+
* @event
|
|
474
|
+
*/
|
|
475
|
+
_classThis.EVENT_RESOLVE_END = converter_events_1.ConverterEvents.RESOLVE_END;
|
|
476
|
+
(() => {
|
|
477
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
478
|
+
})();
|
|
479
|
+
return Converter = _classThis;
|
|
480
|
+
})();
|
|
481
|
+
exports.Converter = Converter;
|
|
353
482
|
function getSymbolForModuleLike(context, node) {
|
|
354
483
|
const symbol = context.checker.getSymbolAtLocation(node) ?? node.symbol;
|
|
355
484
|
if (symbol) {
|
|
@@ -361,7 +490,9 @@ function getSymbolForModuleLike(context, node) {
|
|
|
361
490
|
const sourceFile = node.getSourceFile();
|
|
362
491
|
const globalSymbols = context.checker
|
|
363
492
|
.getSymbolsInScope(node, typescript_1.default.SymbolFlags.ModuleMember)
|
|
364
|
-
.filter((s) => s
|
|
493
|
+
.filter((s) => s
|
|
494
|
+
.getDeclarations()
|
|
495
|
+
?.some((d) => d.getSourceFile() === sourceFile));
|
|
365
496
|
// Detect declaration files with declare module "foo" as their only export
|
|
366
497
|
// and lift that up one level as the source file symbol
|
|
367
498
|
if (globalSymbols.length === 1 &&
|