typedoc 0.25.0 → 0.25.2
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/dist/index.d.ts +2 -2
- package/dist/index.js +2 -1
- package/dist/lib/application.d.ts +3 -3
- package/dist/lib/application.js +440 -359
- package/dist/lib/cli.js +6 -3
- package/dist/lib/converter/comments/discovery.js +8 -2
- package/dist/lib/converter/comments/index.js +9 -1
- package/dist/lib/converter/comments/parser.js +5 -11
- 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 +11 -11
- package/dist/lib/converter/converter.js +436 -311
- package/dist/lib/converter/factories/signature.d.ts +1 -0
- package/dist/lib/converter/factories/signature.js +31 -5
- package/dist/lib/converter/jsdoc.js +2 -6
- package/dist/lib/converter/plugins/CategoryPlugin.d.ts +8 -8
- package/dist/lib/converter/plugins/CategoryPlugin.js +293 -200
- package/dist/lib/converter/plugins/CommentPlugin.d.ts +8 -5
- package/dist/lib/converter/plugins/CommentPlugin.js +433 -305
- package/dist/lib/converter/plugins/GroupPlugin.d.ts +4 -3
- package/dist/lib/converter/plugins/GroupPlugin.js +226 -145
- package/dist/lib/converter/plugins/ImplementsPlugin.js +239 -194
- package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +1 -1
- package/dist/lib/converter/plugins/InheritDocPlugin.js +201 -138
- package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +1 -1
- package/dist/lib/converter/plugins/LinkResolverPlugin.js +110 -44
- package/dist/lib/converter/plugins/PackagePlugin.d.ts +6 -4
- package/dist/lib/converter/plugins/PackagePlugin.js +191 -96
- package/dist/lib/converter/plugins/SourcePlugin.d.ts +6 -6
- package/dist/lib/converter/plugins/SourcePlugin.js +234 -146
- package/dist/lib/converter/plugins/TypePlugin.js +147 -102
- package/dist/lib/converter/symbols.js +1 -1
- package/dist/lib/converter/types.js +10 -0
- package/dist/lib/converter/utils/repository.js +2 -2
- package/dist/lib/models/reflections/ReflectionSymbolId.js +1 -1
- package/dist/lib/models/reflections/abstract.d.ts +4 -0
- package/dist/lib/models/reflections/abstract.js +14 -2
- package/dist/lib/models/reflections/index.d.ts +1 -1
- package/dist/lib/output/components.d.ts +1 -0
- package/dist/lib/output/components.js +9 -1
- 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 +111 -44
- package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +2 -1
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +173 -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 +315 -202
- package/dist/lib/output/theme.js +63 -18
- package/dist/lib/output/themes/MarkedPlugin.d.ts +4 -4
- package/dist/lib/output/themes/MarkedPlugin.js +223 -145
- package/dist/lib/output/themes/default/DefaultTheme.d.ts +14 -1
- package/dist/lib/output/themes/default/DefaultTheme.js +72 -0
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +42 -36
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +15 -1
- package/dist/lib/output/themes/default/layouts/default.js +2 -0
- package/dist/lib/output/themes/default/partials/header.js +1 -1
- package/dist/lib/output/themes/default/partials/icon.d.ts +4 -1
- package/dist/lib/output/themes/default/partials/icon.js +46 -35
- package/dist/lib/output/themes/default/partials/member.signature.body.js +1 -1
- package/dist/lib/output/themes/default/partials/navigation.js +34 -67
- package/dist/lib/utils/component.d.ts +1 -1
- package/dist/lib/utils/component.js +3 -1
- package/dist/lib/utils/entry-point.js +36 -18
- 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.js +1 -1
- package/dist/lib/utils/options/declaration.d.ts +4 -0
- 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 +19 -0
- package/dist/lib/utils/options/options.js +22 -2
- package/dist/lib/utils/options/readers/tsconfig.js +2 -7
- package/dist/lib/utils/options/sources/typedoc.js +22 -0
- package/dist/lib/utils/perf.d.ts +1 -1
- package/dist/lib/utils/perf.js +10 -20
- package/package.json +9 -9
- package/static/main.js +4 -3
- package/static/style.css +7 -3
package/dist/lib/application.js
CHANGED
|
@@ -15,11 +15,39 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
19
|
+
var useValue = arguments.length > 2;
|
|
20
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
21
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
22
|
+
}
|
|
23
|
+
return useValue ? value : void 0;
|
|
24
|
+
};
|
|
25
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
26
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
27
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
28
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
29
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
30
|
+
var _, done = false;
|
|
31
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
32
|
+
var context = {};
|
|
33
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
34
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
35
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
36
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
37
|
+
if (kind === "accessor") {
|
|
38
|
+
if (result === void 0) continue;
|
|
39
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
40
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
41
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
42
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
43
|
+
}
|
|
44
|
+
else if (_ = accept(result)) {
|
|
45
|
+
if (kind === "field") initializers.unshift(_);
|
|
46
|
+
else descriptor[key] = _;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
50
|
+
done = true;
|
|
23
51
|
};
|
|
24
52
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
53
|
if (mod && mod.__esModule) return mod;
|
|
@@ -28,10 +56,24 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
28
56
|
__setModuleDefault(result, mod);
|
|
29
57
|
return result;
|
|
30
58
|
};
|
|
59
|
+
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
60
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
61
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
62
|
+
};
|
|
63
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
64
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
65
|
+
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");
|
|
66
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
67
|
+
};
|
|
68
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
69
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
70
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
71
|
+
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");
|
|
72
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
73
|
+
};
|
|
31
74
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
32
75
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
33
76
|
};
|
|
34
|
-
var Application_1;
|
|
35
77
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
78
|
exports.Application = exports.createAppForTesting = void 0;
|
|
37
79
|
const Path = __importStar(require("path"));
|
|
@@ -83,397 +125,436 @@ const DEFAULT_READERS = [
|
|
|
83
125
|
* Both the {@link Converter} and the {@link Renderer} emit a series of events while processing the project.
|
|
84
126
|
* Subscribe to these Events to control the application flow or alter the output.
|
|
85
127
|
*/
|
|
86
|
-
let Application =
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
128
|
+
let Application = (() => {
|
|
129
|
+
var _Application_skipErrorChecking_accessor_storage, _Application_entryPointStrategy_accessor_storage, _Application_entryPoints_accessor_storage;
|
|
130
|
+
let _classDecorators = [(0, component_1.Component)({ name: "application", internal: true })];
|
|
131
|
+
let _classDescriptor;
|
|
132
|
+
let _classExtraInitializers = [];
|
|
133
|
+
let _classThis;
|
|
134
|
+
let _classSuper = component_1.ChildableComponent;
|
|
135
|
+
let _instanceExtraInitializers = [];
|
|
136
|
+
let _skipErrorChecking_decorators;
|
|
137
|
+
let _skipErrorChecking_initializers = [];
|
|
138
|
+
let _entryPointStrategy_decorators;
|
|
139
|
+
let _entryPointStrategy_initializers = [];
|
|
140
|
+
let _entryPoints_decorators;
|
|
141
|
+
let _entryPoints_initializers = [];
|
|
142
|
+
var Application = _classThis = class extends _classSuper {
|
|
143
|
+
/** @internal */
|
|
144
|
+
get skipErrorChecking() { return __classPrivateFieldGet(this, _Application_skipErrorChecking_accessor_storage, "f"); }
|
|
145
|
+
set skipErrorChecking(value) { __classPrivateFieldSet(this, _Application_skipErrorChecking_accessor_storage, value, "f"); }
|
|
146
|
+
/** @internal */
|
|
147
|
+
get entryPointStrategy() { return __classPrivateFieldGet(this, _Application_entryPointStrategy_accessor_storage, "f"); }
|
|
148
|
+
set entryPointStrategy(value) { __classPrivateFieldSet(this, _Application_entryPointStrategy_accessor_storage, value, "f"); }
|
|
149
|
+
/** @internal */
|
|
150
|
+
get entryPoints() { return __classPrivateFieldGet(this, _Application_entryPoints_accessor_storage, "f"); }
|
|
151
|
+
set entryPoints(value) { __classPrivateFieldSet(this, _Application_entryPoints_accessor_storage, value, "f"); }
|
|
95
152
|
/**
|
|
96
|
-
*
|
|
153
|
+
* Create a new TypeDoc application instance.
|
|
97
154
|
*/
|
|
98
|
-
|
|
155
|
+
constructor(detector) {
|
|
156
|
+
if (detector !== DETECTOR) {
|
|
157
|
+
throw new Error("An application handle must be retrieved with Application.bootstrap or Application.bootstrapWithPlugins");
|
|
158
|
+
}
|
|
159
|
+
super(null); // We own ourselves
|
|
160
|
+
/**
|
|
161
|
+
* The converter used to create the declaration reflections.
|
|
162
|
+
*/
|
|
163
|
+
this.converter = (__runInitializers(this, _instanceExtraInitializers), void 0);
|
|
164
|
+
/**
|
|
165
|
+
* The serializer used to generate JSON output.
|
|
166
|
+
*/
|
|
167
|
+
this.serializer = new serialization_1.Serializer();
|
|
168
|
+
/**
|
|
169
|
+
* The deserializer used to restore previously serialized JSON output.
|
|
170
|
+
*/
|
|
171
|
+
this.deserializer = new serialization_1.Deserializer(this);
|
|
172
|
+
/**
|
|
173
|
+
* The logger that should be used to output messages.
|
|
174
|
+
*/
|
|
175
|
+
this.logger = new index_2.ConsoleLogger();
|
|
176
|
+
this.options = new utils_1.Options();
|
|
177
|
+
_Application_skipErrorChecking_accessor_storage.set(this, __runInitializers(this, _skipErrorChecking_initializers, void 0));
|
|
178
|
+
_Application_entryPointStrategy_accessor_storage.set(this, __runInitializers(this, _entryPointStrategy_initializers, void 0));
|
|
179
|
+
_Application_entryPoints_accessor_storage.set(this, __runInitializers(this, _entryPoints_initializers, void 0));
|
|
180
|
+
this.converter = this.addComponent("converter", index_1.Converter);
|
|
181
|
+
this.renderer = this.addComponent("renderer", renderer_1.Renderer);
|
|
182
|
+
}
|
|
99
183
|
/**
|
|
100
|
-
*
|
|
184
|
+
* Initialize TypeDoc, loading plugins if applicable.
|
|
101
185
|
*/
|
|
102
|
-
|
|
186
|
+
static async bootstrapWithPlugins(options = {}, readers = DEFAULT_READERS) {
|
|
187
|
+
const app = new Application(DETECTOR);
|
|
188
|
+
readers.forEach((r) => app.options.addReader(r));
|
|
189
|
+
app.options.reset();
|
|
190
|
+
app.setOptions(options, /* reportErrors */ false);
|
|
191
|
+
await app.options.read(new index_2.Logger());
|
|
192
|
+
app.logger.level = app.options.getValue("logLevel");
|
|
193
|
+
await (0, index_2.loadPlugins)(app, app.options.getValue("plugin"));
|
|
194
|
+
await app._bootstrap(options);
|
|
195
|
+
return app;
|
|
196
|
+
}
|
|
103
197
|
/**
|
|
104
|
-
*
|
|
198
|
+
* Initialize TypeDoc without loading plugins.
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* Initialize the application with pretty-printing output disabled.
|
|
202
|
+
* ```ts
|
|
203
|
+
* const app = Application.bootstrap({ pretty: false });
|
|
204
|
+
* ```
|
|
205
|
+
*
|
|
206
|
+
* @param options Options to set during initialization
|
|
207
|
+
* @param readers Option readers to use to discover options from config files.
|
|
105
208
|
*/
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Initialize TypeDoc, loading plugins if applicable.
|
|
113
|
-
*/
|
|
114
|
-
static async bootstrapWithPlugins(options = {}, readers = DEFAULT_READERS) {
|
|
115
|
-
const app = new Application_1(DETECTOR);
|
|
116
|
-
readers.forEach((r) => app.options.addReader(r));
|
|
117
|
-
app.options.reset();
|
|
118
|
-
app.setOptions(options, /* reportErrors */ false);
|
|
119
|
-
await app.options.read(new index_2.Logger());
|
|
120
|
-
app.logger.level = app.options.getValue("logLevel");
|
|
121
|
-
await (0, index_2.loadPlugins)(app, app.options.getValue("plugin"));
|
|
122
|
-
await app._bootstrap(options);
|
|
123
|
-
return app;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Initialize TypeDoc without loading plugins.
|
|
127
|
-
*
|
|
128
|
-
* @example
|
|
129
|
-
* Initialize the application with pretty-printing output disabled.
|
|
130
|
-
* ```ts
|
|
131
|
-
* const app = Application.bootstrap({ pretty: false });
|
|
132
|
-
* ```
|
|
133
|
-
*
|
|
134
|
-
* @param options Options to set during initialization
|
|
135
|
-
* @param readers Option readers to use to discover options from config files.
|
|
136
|
-
*/
|
|
137
|
-
static async bootstrap(options = {}, readers = DEFAULT_READERS) {
|
|
138
|
-
const app = new Application_1(DETECTOR);
|
|
139
|
-
readers.forEach((r) => app.options.addReader(r));
|
|
140
|
-
await app._bootstrap(options);
|
|
141
|
-
return app;
|
|
142
|
-
}
|
|
143
|
-
async _bootstrap(options) {
|
|
144
|
-
this.options.reset();
|
|
145
|
-
this.setOptions(options, /* reportErrors */ false);
|
|
146
|
-
await this.options.read(this.logger);
|
|
147
|
-
this.setOptions(options);
|
|
148
|
-
this.logger.level = this.options.getValue("logLevel");
|
|
149
|
-
if ((0, general_1.hasBeenLoadedMultipleTimes)()) {
|
|
150
|
-
this.logger.warn(`TypeDoc has been loaded multiple times. This is commonly caused by plugins which have their own installation of TypeDoc. The loaded paths are:\n\t${(0, general_1.getLoadedPaths)().join("\n\t")}`);
|
|
209
|
+
static async bootstrap(options = {}, readers = DEFAULT_READERS) {
|
|
210
|
+
const app = new Application(DETECTOR);
|
|
211
|
+
readers.forEach((r) => app.options.addReader(r));
|
|
212
|
+
await app._bootstrap(options);
|
|
213
|
+
return app;
|
|
151
214
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
215
|
+
async _bootstrap(options) {
|
|
216
|
+
this.options.reset();
|
|
217
|
+
this.setOptions(options, /* reportErrors */ false);
|
|
218
|
+
await this.options.read(this.logger);
|
|
219
|
+
this.setOptions(options);
|
|
220
|
+
this.logger.level = this.options.getValue("logLevel");
|
|
221
|
+
if ((0, general_1.hasBeenLoadedMultipleTimes)()) {
|
|
222
|
+
this.logger.warn(`TypeDoc has been loaded multiple times. This is commonly caused by plugins which have their own installation of TypeDoc. The loaded paths are:\n\t${(0, general_1.getLoadedPaths)().join("\n\t")}`);
|
|
158
223
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
224
|
+
this.trigger(application_events_1.ApplicationEvents.BOOTSTRAP_END, this);
|
|
225
|
+
}
|
|
226
|
+
setOptions(options, reportErrors = true) {
|
|
227
|
+
for (const [key, val] of Object.entries(options)) {
|
|
228
|
+
try {
|
|
229
|
+
this.options.setValue(key, val);
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
(0, assert_1.ok)(error instanceof Error);
|
|
233
|
+
if (reportErrors) {
|
|
234
|
+
this.logger.error(error.message);
|
|
235
|
+
}
|
|
163
236
|
}
|
|
164
237
|
}
|
|
165
238
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
return (0, paths_1.nicePath)(Path.dirname(require.resolve("typescript")));
|
|
172
|
-
}
|
|
173
|
-
getTypeScriptVersion() {
|
|
174
|
-
return typescript_1.default.version;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Gets the entry points to be documented according to the current `entryPoints` and `entryPointStrategy` options.
|
|
178
|
-
* May return undefined if entry points fail to be expanded.
|
|
179
|
-
*/
|
|
180
|
-
getEntryPoints() {
|
|
181
|
-
return (0, entry_point_1.getEntryPoints)(this.logger, this.options);
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Run the converter for the given set of files and return the generated reflections.
|
|
185
|
-
*
|
|
186
|
-
* @returns An instance of ProjectReflection on success, undefined otherwise.
|
|
187
|
-
*/
|
|
188
|
-
async convert() {
|
|
189
|
-
const start = Date.now();
|
|
190
|
-
// We freeze here rather than in the Converter class since TypeDoc's tests reuse the Application
|
|
191
|
-
// with a few different settings.
|
|
192
|
-
this.options.freeze();
|
|
193
|
-
this.logger.verbose(`Using TypeScript ${this.getTypeScriptVersion()} from ${this.getTypeScriptPath()}`);
|
|
194
|
-
if (this.entryPointStrategy === entry_point_1.EntryPointStrategy.Merge) {
|
|
195
|
-
return this._merge();
|
|
196
|
-
}
|
|
197
|
-
if (this.entryPointStrategy === entry_point_1.EntryPointStrategy.Packages) {
|
|
198
|
-
return this._convertPackages();
|
|
239
|
+
/**
|
|
240
|
+
* Return the path to the TypeScript compiler.
|
|
241
|
+
*/
|
|
242
|
+
getTypeScriptPath() {
|
|
243
|
+
return (0, paths_1.nicePath)(Path.dirname(require.resolve("typescript")));
|
|
199
244
|
}
|
|
200
|
-
|
|
201
|
-
|
|
245
|
+
getTypeScriptVersion() {
|
|
246
|
+
return typescript_1.default.version;
|
|
202
247
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
248
|
+
/**
|
|
249
|
+
* Gets the entry points to be documented according to the current `entryPoints` and `entryPointStrategy` options.
|
|
250
|
+
* May return undefined if entry points fail to be expanded.
|
|
251
|
+
*/
|
|
252
|
+
getEntryPoints() {
|
|
253
|
+
return (0, entry_point_1.getEntryPoints)(this.logger, this.options);
|
|
207
254
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
255
|
+
/**
|
|
256
|
+
* Run the converter for the given set of files and return the generated reflections.
|
|
257
|
+
*
|
|
258
|
+
* @returns An instance of ProjectReflection on success, undefined otherwise.
|
|
259
|
+
*/
|
|
260
|
+
async convert() {
|
|
261
|
+
const start = Date.now();
|
|
262
|
+
// We freeze here rather than in the Converter class since TypeDoc's tests reuse the Application
|
|
263
|
+
// with a few different settings.
|
|
264
|
+
this.options.freeze();
|
|
265
|
+
this.logger.verbose(`Using TypeScript ${this.getTypeScriptVersion()} from ${this.getTypeScriptPath()}`);
|
|
266
|
+
if (this.entryPointStrategy === entry_point_1.EntryPointStrategy.Merge) {
|
|
267
|
+
return this._merge();
|
|
268
|
+
}
|
|
269
|
+
if (this.entryPointStrategy === entry_point_1.EntryPointStrategy.Packages) {
|
|
270
|
+
return this._convertPackages();
|
|
271
|
+
}
|
|
272
|
+
if (!supportedVersionMajorMinor.some((version) => version == typescript_1.default.versionMajorMinor)) {
|
|
273
|
+
this.logger.warn(`You are running with an unsupported TypeScript version! If TypeDoc crashes, this is why. TypeDoc supports ${supportedVersionMajorMinor.join(", ")}`);
|
|
274
|
+
}
|
|
275
|
+
const entryPoints = this.getEntryPoints();
|
|
276
|
+
if (!entryPoints) {
|
|
277
|
+
// Fatal error already reported.
|
|
214
278
|
return;
|
|
215
279
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
program.
|
|
280
|
+
const programs = (0, array_1.unique)(entryPoints.map((e) => e.program));
|
|
281
|
+
this.logger.verbose(`Converting with ${programs.length} programs ${entryPoints.length} entry points`);
|
|
282
|
+
if (this.skipErrorChecking === false) {
|
|
283
|
+
const errors = programs.flatMap((program) => typescript_1.default.getPreEmitDiagnostics(program));
|
|
284
|
+
if (errors.length) {
|
|
285
|
+
this.logger.diagnostics(errors);
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
220
288
|
}
|
|
289
|
+
if (this.options.getValue("emit") === "both") {
|
|
290
|
+
for (const program of programs) {
|
|
291
|
+
program.emit();
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
const startConversion = Date.now();
|
|
295
|
+
this.logger.verbose(`Finished getting entry points in ${Date.now() - start}ms`);
|
|
296
|
+
const project = this.converter.convert(entryPoints);
|
|
297
|
+
this.logger.verbose(`Finished conversion in ${Date.now() - startConversion}ms`);
|
|
298
|
+
return project;
|
|
221
299
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
this.logger.verbose(`Finished conversion in ${Date.now() - startConversion}ms`);
|
|
226
|
-
return project;
|
|
227
|
-
}
|
|
228
|
-
convertAndWatch(success) {
|
|
229
|
-
this.options.freeze();
|
|
230
|
-
if (!this.options.getValue("preserveWatchOutput") &&
|
|
231
|
-
this.logger instanceof index_2.ConsoleLogger) {
|
|
232
|
-
typescript_1.default.sys.clearScreen?.();
|
|
233
|
-
}
|
|
234
|
-
this.logger.verbose(`Using TypeScript ${this.getTypeScriptVersion()} from ${this.getTypeScriptPath()}`);
|
|
235
|
-
if (!supportedVersionMajorMinor.some((version) => version == typescript_1.default.versionMajorMinor)) {
|
|
236
|
-
this.logger.warn(`You are running with an unsupported TypeScript version! TypeDoc supports ${supportedVersionMajorMinor.join(", ")}`);
|
|
237
|
-
}
|
|
238
|
-
if (Object.keys(this.options.getCompilerOptions()).length === 0) {
|
|
239
|
-
this.logger.warn(`No compiler options set. This likely means that TypeDoc did not find your tsconfig.json. Generated documentation will probably be empty.`);
|
|
240
|
-
}
|
|
241
|
-
// Doing this is considerably more complicated, we'd need to manage an array of programs, not convert until all programs
|
|
242
|
-
// have reported in the first time... just error out for now. I'm not convinced anyone will actually notice.
|
|
243
|
-
if (this.options.getFileNames().length === 0) {
|
|
244
|
-
this.logger.error("The provided tsconfig file looks like a solution style tsconfig, which is not supported in watch mode.");
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
// Support for packages mode is currently unimplemented
|
|
248
|
-
if (this.entryPointStrategy !== entry_point_1.EntryPointStrategy.Resolve &&
|
|
249
|
-
this.entryPointStrategy !== entry_point_1.EntryPointStrategy.Expand) {
|
|
250
|
-
this.logger.error("entryPointStrategy must be set to either resolve or expand for watch mode.");
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
const tsconfigFile = (0, tsconfig_1.findTsConfigFile)(this.options.getValue("tsconfig")) ??
|
|
254
|
-
"tsconfig.json";
|
|
255
|
-
// We don't want to do it the first time to preserve initial debug status messages. They'll be lost
|
|
256
|
-
// after the user saves a file, but better than nothing...
|
|
257
|
-
let firstStatusReport = true;
|
|
258
|
-
const host = typescript_1.default.createWatchCompilerHost(tsconfigFile, {}, typescript_1.default.sys, typescript_1.default.createEmitAndSemanticDiagnosticsBuilderProgram, (diagnostic) => this.logger.diagnostic(diagnostic), (status, newLine, _options, errorCount) => {
|
|
259
|
-
if (!firstStatusReport &&
|
|
260
|
-
errorCount === void 0 &&
|
|
261
|
-
!this.options.getValue("preserveWatchOutput") &&
|
|
300
|
+
convertAndWatch(success) {
|
|
301
|
+
this.options.freeze();
|
|
302
|
+
if (!this.options.getValue("preserveWatchOutput") &&
|
|
262
303
|
this.logger instanceof index_2.ConsoleLogger) {
|
|
263
304
|
typescript_1.default.sys.clearScreen?.();
|
|
264
305
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
306
|
+
this.logger.verbose(`Using TypeScript ${this.getTypeScriptVersion()} from ${this.getTypeScriptPath()}`);
|
|
307
|
+
if (!supportedVersionMajorMinor.some((version) => version == typescript_1.default.versionMajorMinor)) {
|
|
308
|
+
this.logger.warn(`You are running with an unsupported TypeScript version! TypeDoc supports ${supportedVersionMajorMinor.join(", ")}`);
|
|
309
|
+
}
|
|
310
|
+
if (Object.keys(this.options.getCompilerOptions()).length === 0) {
|
|
311
|
+
this.logger.warn(`No compiler options set. This likely means that TypeDoc did not find your tsconfig.json. Generated documentation will probably be empty.`);
|
|
312
|
+
}
|
|
313
|
+
// Doing this is considerably more complicated, we'd need to manage an array of programs, not convert until all programs
|
|
314
|
+
// have reported in the first time... just error out for now. I'm not convinced anyone will actually notice.
|
|
315
|
+
if (this.options.getFileNames().length === 0) {
|
|
316
|
+
this.logger.error("The provided tsconfig file looks like a solution style tsconfig, which is not supported in watch mode.");
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
// Support for packages mode is currently unimplemented
|
|
320
|
+
if (this.entryPointStrategy !== entry_point_1.EntryPointStrategy.Resolve &&
|
|
321
|
+
this.entryPointStrategy !== entry_point_1.EntryPointStrategy.Expand) {
|
|
322
|
+
this.logger.error("entryPointStrategy must be set to either resolve or expand for watch mode.");
|
|
272
323
|
return;
|
|
273
324
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
325
|
+
const tsconfigFile = (0, tsconfig_1.findTsConfigFile)(this.options.getValue("tsconfig")) ??
|
|
326
|
+
"tsconfig.json";
|
|
327
|
+
// We don't want to do it the first time to preserve initial debug status messages. They'll be lost
|
|
328
|
+
// after the user saves a file, but better than nothing...
|
|
329
|
+
let firstStatusReport = true;
|
|
330
|
+
const host = typescript_1.default.createWatchCompilerHost(tsconfigFile, {}, typescript_1.default.sys, typescript_1.default.createEmitAndSemanticDiagnosticsBuilderProgram, (diagnostic) => this.logger.diagnostic(diagnostic), (status, newLine, _options, errorCount) => {
|
|
331
|
+
if (!firstStatusReport &&
|
|
332
|
+
errorCount === void 0 &&
|
|
333
|
+
!this.options.getValue("preserveWatchOutput") &&
|
|
334
|
+
this.logger instanceof index_2.ConsoleLogger) {
|
|
335
|
+
typescript_1.default.sys.clearScreen?.();
|
|
277
336
|
}
|
|
278
|
-
|
|
279
|
-
this.logger.
|
|
280
|
-
|
|
281
|
-
|
|
337
|
+
firstStatusReport = false;
|
|
338
|
+
this.logger.info(typescript_1.default.flattenDiagnosticMessageText(status.messageText, newLine));
|
|
339
|
+
});
|
|
340
|
+
let successFinished = true;
|
|
341
|
+
let currentProgram;
|
|
342
|
+
const runSuccess = () => {
|
|
343
|
+
if (!currentProgram) {
|
|
282
344
|
return;
|
|
283
345
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
346
|
+
if (successFinished) {
|
|
347
|
+
if (this.options.getValue("emit") === "both") {
|
|
348
|
+
currentProgram.emit();
|
|
349
|
+
}
|
|
350
|
+
this.logger.resetErrors();
|
|
351
|
+
this.logger.resetWarnings();
|
|
352
|
+
const entryPoints = (0, entry_point_1.getWatchEntryPoints)(this.logger, this.options, currentProgram);
|
|
353
|
+
if (!entryPoints) {
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
const project = this.converter.convert(entryPoints);
|
|
357
|
+
currentProgram = undefined;
|
|
358
|
+
successFinished = false;
|
|
359
|
+
void success(project).then(() => {
|
|
360
|
+
successFinished = true;
|
|
361
|
+
runSuccess();
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
const origCreateProgram = host.createProgram;
|
|
366
|
+
host.createProgram = (rootNames, options, host, oldProgram, configDiagnostics, references) => {
|
|
367
|
+
// If we always do this, we'll get a crash the second time a program is created.
|
|
368
|
+
if (rootNames !== undefined) {
|
|
369
|
+
options = this.options.fixCompilerOptions(options || {});
|
|
370
|
+
}
|
|
371
|
+
return origCreateProgram(rootNames, options, host, oldProgram, configDiagnostics, references);
|
|
372
|
+
};
|
|
373
|
+
const origAfterProgramCreate = host.afterProgramCreate;
|
|
374
|
+
host.afterProgramCreate = (program) => {
|
|
375
|
+
if (typescript_1.default.getPreEmitDiagnostics(program.getProgram()).length === 0) {
|
|
376
|
+
currentProgram = program.getProgram();
|
|
289
377
|
runSuccess();
|
|
290
|
-
}
|
|
378
|
+
}
|
|
379
|
+
origAfterProgramCreate?.(program);
|
|
380
|
+
};
|
|
381
|
+
typescript_1.default.createWatchProgram(host);
|
|
382
|
+
}
|
|
383
|
+
validate(project) {
|
|
384
|
+
const checks = this.options.getValue("validation");
|
|
385
|
+
const start = Date.now();
|
|
386
|
+
// No point in validating exports when merging. Warnings will have already been emitted when
|
|
387
|
+
// creating the project jsons that this run merges together.
|
|
388
|
+
if (checks.notExported &&
|
|
389
|
+
this.entryPointStrategy !== entry_point_1.EntryPointStrategy.Merge) {
|
|
390
|
+
(0, exports_1.validateExports)(project, this.logger, this.options.getValue("intentionallyNotExported"));
|
|
291
391
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
host.createProgram = (rootNames, options, host, oldProgram, configDiagnostics, references) => {
|
|
295
|
-
// If we always do this, we'll get a crash the second time a program is created.
|
|
296
|
-
if (rootNames !== undefined) {
|
|
297
|
-
options = this.options.fixCompilerOptions(options || {});
|
|
392
|
+
if (checks.notDocumented) {
|
|
393
|
+
(0, documentation_1.validateDocumentation)(project, this.logger, this.options.getValue("requiredToBeDocumented"));
|
|
298
394
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
const origAfterProgramCreate = host.afterProgramCreate;
|
|
302
|
-
host.afterProgramCreate = (program) => {
|
|
303
|
-
if (typescript_1.default.getPreEmitDiagnostics(program.getProgram()).length === 0) {
|
|
304
|
-
currentProgram = program.getProgram();
|
|
305
|
-
runSuccess();
|
|
395
|
+
if (checks.invalidLink) {
|
|
396
|
+
(0, links_1.validateLinks)(project, this.logger);
|
|
306
397
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
typescript_1.default.createWatchProgram(host);
|
|
310
|
-
}
|
|
311
|
-
validate(project) {
|
|
312
|
-
const checks = this.options.getValue("validation");
|
|
313
|
-
const start = Date.now();
|
|
314
|
-
// No point in validating exports when merging. Warnings will have already been emitted when
|
|
315
|
-
// creating the project jsons that this run merges together.
|
|
316
|
-
if (checks.notExported &&
|
|
317
|
-
this.entryPointStrategy !== entry_point_1.EntryPointStrategy.Merge) {
|
|
318
|
-
(0, exports_1.validateExports)(project, this.logger, this.options.getValue("intentionallyNotExported"));
|
|
319
|
-
}
|
|
320
|
-
if (checks.notDocumented) {
|
|
321
|
-
(0, documentation_1.validateDocumentation)(project, this.logger, this.options.getValue("requiredToBeDocumented"));
|
|
322
|
-
}
|
|
323
|
-
if (checks.invalidLink) {
|
|
324
|
-
(0, links_1.validateLinks)(project, this.logger);
|
|
325
|
-
}
|
|
326
|
-
this.trigger(Application_1.EVENT_VALIDATE_PROJECT, project);
|
|
327
|
-
this.logger.verbose(`Validation took ${Date.now() - start}ms`);
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Render HTML for the given project
|
|
331
|
-
*/
|
|
332
|
-
async generateDocs(project, out) {
|
|
333
|
-
const start = Date.now();
|
|
334
|
-
out = Path.resolve(out);
|
|
335
|
-
await this.renderer.render(project, out);
|
|
336
|
-
if (this.logger.hasErrors()) {
|
|
337
|
-
this.logger.error("Documentation could not be generated due to the errors above.");
|
|
398
|
+
this.trigger(Application.EVENT_VALIDATE_PROJECT, project);
|
|
399
|
+
this.logger.verbose(`Validation took ${Date.now() - start}ms`);
|
|
338
400
|
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
* @returns Whether the JSON file could be written successfully.
|
|
349
|
-
*/
|
|
350
|
-
async generateJson(project, out) {
|
|
351
|
-
const start = Date.now();
|
|
352
|
-
out = Path.resolve(out);
|
|
353
|
-
const ser = this.serializer.projectToObject(project, process.cwd());
|
|
354
|
-
const space = this.options.getValue("pretty") ? "\t" : "";
|
|
355
|
-
await (0, index_2.writeFile)(out, JSON.stringify(ser, null, space));
|
|
356
|
-
this.logger.info(`JSON written to ${(0, paths_1.nicePath)(out)}`);
|
|
357
|
-
this.logger.verbose(`JSON rendering took ${Date.now() - start}ms`);
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* Print the version number.
|
|
361
|
-
*/
|
|
362
|
-
toString() {
|
|
363
|
-
return [
|
|
364
|
-
"",
|
|
365
|
-
`TypeDoc ${Application_1.VERSION}`,
|
|
366
|
-
`Using TypeScript ${this.getTypeScriptVersion()} from ${this.getTypeScriptPath()}`,
|
|
367
|
-
"",
|
|
368
|
-
].join("\n");
|
|
369
|
-
}
|
|
370
|
-
async _convertPackages() {
|
|
371
|
-
if (!this.options.isSet("entryPoints")) {
|
|
372
|
-
this.logger.error("No entry points provided to packages mode, documentation cannot be generated.");
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
const packageDirs = (0, entry_point_1.getPackageDirectories)(this.logger, this.options, this.options.getValue("entryPoints"));
|
|
376
|
-
if (packageDirs.length === 0) {
|
|
377
|
-
this.logger.error("Failed to find any packages, ensure you have provided at least one directory as an entry point containing package.json");
|
|
378
|
-
return;
|
|
379
|
-
}
|
|
380
|
-
const origOptions = this.options;
|
|
381
|
-
const projects = [];
|
|
382
|
-
// Generate a json file for each package
|
|
383
|
-
for (const dir of packageDirs) {
|
|
384
|
-
this.logger.info(`Converting project at ${(0, paths_1.nicePath)(dir)}`);
|
|
385
|
-
const opts = origOptions.copyForPackage(dir);
|
|
386
|
-
// Invalid links should only be reported after everything has been merged.
|
|
387
|
-
opts.setValue("validation", { invalidLink: false });
|
|
388
|
-
await opts.read(this.logger, dir);
|
|
389
|
-
if (opts.getValue("entryPointStrategy") ===
|
|
390
|
-
entry_point_1.EntryPointStrategy.Packages) {
|
|
391
|
-
this.logger.error(`Project at ${(0, paths_1.nicePath)(dir)} has entryPointStrategy set to packages, but nested packages are not supported.`);
|
|
392
|
-
continue;
|
|
401
|
+
/**
|
|
402
|
+
* Render HTML for the given project
|
|
403
|
+
*/
|
|
404
|
+
async generateDocs(project, out) {
|
|
405
|
+
const start = Date.now();
|
|
406
|
+
out = Path.resolve(out);
|
|
407
|
+
await this.renderer.render(project, out);
|
|
408
|
+
if (this.logger.hasErrors()) {
|
|
409
|
+
this.logger.error("Documentation could not be generated due to the errors above.");
|
|
393
410
|
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
this.validate(project);
|
|
398
|
-
projects.push(this.serializer.projectToObject(project, process.cwd()));
|
|
411
|
+
else {
|
|
412
|
+
this.logger.info(`Documentation generated at ${(0, paths_1.nicePath)(out)}`);
|
|
413
|
+
this.logger.verbose(`HTML rendering took ${Date.now() - start}ms`);
|
|
399
414
|
}
|
|
400
|
-
(0, abstract_1.resetReflectionID)();
|
|
401
415
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
416
|
+
/**
|
|
417
|
+
* Write the reflections to a json file.
|
|
418
|
+
*
|
|
419
|
+
* @param out The path and file name of the target file.
|
|
420
|
+
* @returns Whether the JSON file could be written successfully.
|
|
421
|
+
*/
|
|
422
|
+
async generateJson(project, out) {
|
|
423
|
+
const start = Date.now();
|
|
424
|
+
out = Path.resolve(out);
|
|
425
|
+
const ser = this.serializer.projectToObject(project, process.cwd());
|
|
426
|
+
const space = this.options.getValue("pretty") ? "\t" : "";
|
|
427
|
+
await (0, index_2.writeFile)(out, JSON.stringify(ser, null, space));
|
|
428
|
+
this.logger.info(`JSON written to ${(0, paths_1.nicePath)(out)}`);
|
|
429
|
+
this.logger.verbose(`JSON rendering took ${Date.now() - start}ms`);
|
|
407
430
|
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
431
|
+
/**
|
|
432
|
+
* Print the version number.
|
|
433
|
+
*/
|
|
434
|
+
toString() {
|
|
435
|
+
return [
|
|
436
|
+
"",
|
|
437
|
+
`TypeDoc ${Application.VERSION}`,
|
|
438
|
+
`Using TypeScript ${this.getTypeScriptVersion()} from ${this.getTypeScriptPath()}`,
|
|
439
|
+
"",
|
|
440
|
+
].join("\n");
|
|
417
441
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
this.logger.warn(`The entrypoint glob ${(0, paths_1.nicePath)(entry)} did not match any files.`);
|
|
442
|
+
async _convertPackages() {
|
|
443
|
+
if (!this.options.isSet("entryPoints")) {
|
|
444
|
+
this.logger.error("No entry points provided to packages mode, documentation cannot be generated.");
|
|
445
|
+
return;
|
|
423
446
|
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
447
|
+
const packageDirs = (0, entry_point_1.getPackageDirectories)(this.logger, this.options, this.options.getValue("entryPoints"));
|
|
448
|
+
if (packageDirs.length === 0) {
|
|
449
|
+
this.logger.error("Failed to find any packages, ensure you have provided at least one directory as an entry point containing package.json");
|
|
450
|
+
return;
|
|
428
451
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
452
|
+
const origOptions = this.options;
|
|
453
|
+
const projects = [];
|
|
454
|
+
// Generate a json file for each package
|
|
455
|
+
for (const dir of packageDirs) {
|
|
456
|
+
this.logger.info(`Converting project at ${(0, paths_1.nicePath)(dir)}`);
|
|
457
|
+
const opts = origOptions.copyForPackage(dir);
|
|
458
|
+
await opts.read(this.logger, dir);
|
|
459
|
+
// Invalid links should only be reported after everything has been merged.
|
|
460
|
+
opts.setValue("validation", { invalidLink: false });
|
|
461
|
+
if (opts.getValue("entryPointStrategy") ===
|
|
462
|
+
entry_point_1.EntryPointStrategy.Packages) {
|
|
463
|
+
this.logger.error(`Project at ${(0, paths_1.nicePath)(dir)} has entryPointStrategy set to packages, but nested packages are not supported.`);
|
|
464
|
+
continue;
|
|
465
|
+
}
|
|
466
|
+
this.options = opts;
|
|
467
|
+
const project = await this.convert();
|
|
468
|
+
if (project) {
|
|
469
|
+
this.validate(project);
|
|
470
|
+
projects.push(this.serializer.projectToObject(project, process.cwd()));
|
|
471
|
+
}
|
|
472
|
+
(0, abstract_1.resetReflectionID)();
|
|
434
473
|
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
474
|
+
this.options = origOptions;
|
|
475
|
+
this.logger.info(`Merging converted projects`);
|
|
476
|
+
if (projects.length !== packageDirs.length) {
|
|
477
|
+
this.logger.error("Failed to convert one or more packages, result will not be merged together.");
|
|
478
|
+
return;
|
|
438
479
|
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
return;
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
480
|
+
const result = this.deserializer.reviveProjects(this.options.getValue("name") || "Documentation", projects);
|
|
481
|
+
this.trigger(application_events_1.ApplicationEvents.REVIVE, result);
|
|
482
|
+
return result;
|
|
483
|
+
}
|
|
484
|
+
_merge() {
|
|
485
|
+
const start = Date.now();
|
|
486
|
+
if (!this.options.isSet("entryPoints")) {
|
|
487
|
+
this.logger.error("No entry points provided to merge.");
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
const rootDir = (0, fs_1.deriveRootDir)(this.entryPoints);
|
|
491
|
+
const entryPoints = this.entryPoints.flatMap((entry) => {
|
|
492
|
+
const result = (0, fs_1.glob)(entry, rootDir);
|
|
493
|
+
if (result.length === 0) {
|
|
494
|
+
this.logger.warn(`The entrypoint glob ${(0, paths_1.nicePath)(entry)} did not match any files.`);
|
|
495
|
+
}
|
|
496
|
+
else {
|
|
497
|
+
this.logger.verbose(`Expanded ${(0, paths_1.nicePath)(entry)} to:\n\t${result
|
|
498
|
+
.map(paths_1.nicePath)
|
|
499
|
+
.join("\n\t")}`);
|
|
500
|
+
}
|
|
501
|
+
return result;
|
|
502
|
+
});
|
|
503
|
+
const jsonProjects = entryPoints.map((path) => {
|
|
504
|
+
try {
|
|
505
|
+
return JSON.parse((0, fs_1.readFile)(path));
|
|
506
|
+
}
|
|
507
|
+
catch {
|
|
508
|
+
this.logger.error(`Failed to parse file at ${(0, paths_1.nicePath)(path)} as json.`);
|
|
509
|
+
return null;
|
|
510
|
+
}
|
|
511
|
+
});
|
|
512
|
+
if (this.logger.hasErrors())
|
|
513
|
+
return;
|
|
514
|
+
const result = this.deserializer.reviveProjects(this.options.getValue("name"), jsonProjects);
|
|
515
|
+
this.logger.verbose(`Reviving projects took ${Date.now() - start}ms`);
|
|
516
|
+
this.trigger(application_events_1.ApplicationEvents.REVIVE, result);
|
|
517
|
+
return result;
|
|
518
|
+
}
|
|
519
|
+
};
|
|
520
|
+
_Application_skipErrorChecking_accessor_storage = new WeakMap();
|
|
521
|
+
_Application_entryPointStrategy_accessor_storage = new WeakMap();
|
|
522
|
+
_Application_entryPoints_accessor_storage = new WeakMap();
|
|
523
|
+
__setFunctionName(_classThis, "Application");
|
|
524
|
+
(() => {
|
|
525
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
526
|
+
_skipErrorChecking_decorators = [(0, utils_1.Option)("skipErrorChecking")];
|
|
527
|
+
_entryPointStrategy_decorators = [(0, utils_1.Option)("entryPointStrategy")];
|
|
528
|
+
_entryPoints_decorators = [(0, utils_1.Option)("entryPoints")];
|
|
529
|
+
__esDecorate(_classThis, null, _skipErrorChecking_decorators, { kind: "accessor", name: "skipErrorChecking", static: false, private: false, access: { has: obj => "skipErrorChecking" in obj, get: obj => obj.skipErrorChecking, set: (obj, value) => { obj.skipErrorChecking = value; } }, metadata: _metadata }, _skipErrorChecking_initializers, _instanceExtraInitializers);
|
|
530
|
+
__esDecorate(_classThis, null, _entryPointStrategy_decorators, { kind: "accessor", name: "entryPointStrategy", static: false, private: false, access: { has: obj => "entryPointStrategy" in obj, get: obj => obj.entryPointStrategy, set: (obj, value) => { obj.entryPointStrategy = value; } }, metadata: _metadata }, _entryPointStrategy_initializers, _instanceExtraInitializers);
|
|
531
|
+
__esDecorate(_classThis, null, _entryPoints_decorators, { kind: "accessor", name: "entryPoints", static: false, private: false, access: { has: obj => "entryPoints" in obj, get: obj => obj.entryPoints, set: (obj, value) => { obj.entryPoints = value; } }, metadata: _metadata }, _entryPoints_initializers, _instanceExtraInitializers);
|
|
532
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
533
|
+
Application = _classThis = _classDescriptor.value;
|
|
534
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
535
|
+
})();
|
|
536
|
+
/**
|
|
537
|
+
* The version number of TypeDoc.
|
|
538
|
+
*/
|
|
539
|
+
_classThis.VERSION = packageInfo.version;
|
|
540
|
+
/**
|
|
541
|
+
* Emitted after plugins have been loaded and options have been read, but before they have been frozen.
|
|
542
|
+
* The listener will be given an instance of {@link Application}.
|
|
543
|
+
*/
|
|
544
|
+
_classThis.EVENT_BOOTSTRAP_END = application_events_1.ApplicationEvents.BOOTSTRAP_END;
|
|
545
|
+
/**
|
|
546
|
+
* Emitted after a project has been deserialized from JSON.
|
|
547
|
+
* The listener will be given an instance of {@link ProjectReflection}.
|
|
548
|
+
*/
|
|
549
|
+
_classThis.EVENT_PROJECT_REVIVE = application_events_1.ApplicationEvents.REVIVE;
|
|
550
|
+
/**
|
|
551
|
+
* Emitted when validation is being run.
|
|
552
|
+
* The listener will be given an instance of {@link ProjectReflection}.
|
|
553
|
+
*/
|
|
554
|
+
_classThis.EVENT_VALIDATE_PROJECT = application_events_1.ApplicationEvents.VALIDATE_PROJECT;
|
|
555
|
+
(() => {
|
|
556
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
557
|
+
})();
|
|
558
|
+
return Application = _classThis;
|
|
559
|
+
})();
|
|
448
560
|
exports.Application = Application;
|
|
449
|
-
/**
|
|
450
|
-
* The version number of TypeDoc.
|
|
451
|
-
*/
|
|
452
|
-
Application.VERSION = packageInfo.version;
|
|
453
|
-
/**
|
|
454
|
-
* Emitted after plugins have been loaded and options have been read, but before they have been frozen.
|
|
455
|
-
* The listener will be given an instance of {@link Application}.
|
|
456
|
-
*/
|
|
457
|
-
Application.EVENT_BOOTSTRAP_END = application_events_1.ApplicationEvents.BOOTSTRAP_END;
|
|
458
|
-
/**
|
|
459
|
-
* Emitted after a project has been deserialized from JSON.
|
|
460
|
-
* The listener will be given an instance of {@link ProjectReflection}.
|
|
461
|
-
*/
|
|
462
|
-
Application.EVENT_PROJECT_REVIVE = application_events_1.ApplicationEvents.REVIVE;
|
|
463
|
-
/**
|
|
464
|
-
* Emitted when validation is being run.
|
|
465
|
-
* The listener will be given an instance of {@link ProjectReflection}.
|
|
466
|
-
*/
|
|
467
|
-
Application.EVENT_VALIDATE_PROJECT = application_events_1.ApplicationEvents.VALIDATE_PROJECT;
|
|
468
|
-
__decorate([
|
|
469
|
-
(0, utils_1.BindOption)("skipErrorChecking")
|
|
470
|
-
], Application.prototype, "skipErrorChecking", void 0);
|
|
471
|
-
__decorate([
|
|
472
|
-
(0, utils_1.BindOption)("entryPointStrategy")
|
|
473
|
-
], Application.prototype, "entryPointStrategy", void 0);
|
|
474
|
-
__decorate([
|
|
475
|
-
(0, utils_1.BindOption)("entryPoints")
|
|
476
|
-
], Application.prototype, "entryPoints", void 0);
|
|
477
|
-
exports.Application = Application = Application_1 = __decorate([
|
|
478
|
-
(0, component_1.Component)({ name: "application", internal: true })
|
|
479
|
-
], Application);
|