typedoc 0.24.8 → 0.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.ts +6 -2
  3. package/dist/index.js +6 -1
  4. package/dist/lib/application.d.ts +13 -11
  5. package/dist/lib/application.js +455 -347
  6. package/dist/lib/cli.js +29 -22
  7. package/dist/lib/converter/comments/blockLexer.js +10 -1
  8. package/dist/lib/converter/comments/declarationReference.js +2 -0
  9. package/dist/lib/converter/comments/declarationReferenceResolver.js +2 -1
  10. package/dist/lib/converter/comments/discovery.js +0 -1
  11. package/dist/lib/converter/comments/linkResolver.d.ts +5 -2
  12. package/dist/lib/converter/comments/linkResolver.js +21 -13
  13. package/dist/lib/converter/comments/parser.js +7 -12
  14. package/dist/lib/converter/comments/tagName.d.ts +8 -0
  15. package/dist/lib/converter/comments/tagName.js +62 -0
  16. package/dist/lib/converter/context.js +1 -2
  17. package/dist/lib/converter/converter.d.ts +12 -10
  18. package/dist/lib/converter/converter.js +440 -309
  19. package/dist/lib/converter/factories/index-signature.js +2 -1
  20. package/dist/lib/converter/factories/signature.js +3 -4
  21. package/dist/lib/converter/plugins/CategoryPlugin.d.ts +8 -8
  22. package/dist/lib/converter/plugins/CategoryPlugin.js +294 -200
  23. package/dist/lib/converter/plugins/CommentPlugin.d.ts +8 -5
  24. package/dist/lib/converter/plugins/CommentPlugin.js +434 -305
  25. package/dist/lib/converter/plugins/GroupPlugin.d.ts +3 -3
  26. package/dist/lib/converter/plugins/GroupPlugin.js +216 -145
  27. package/dist/lib/converter/plugins/ImplementsPlugin.js +240 -192
  28. package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +2 -0
  29. package/dist/lib/converter/plugins/InheritDocPlugin.js +202 -132
  30. package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +1 -1
  31. package/dist/lib/converter/plugins/LinkResolverPlugin.js +111 -43
  32. package/dist/lib/converter/plugins/PackagePlugin.d.ts +6 -4
  33. package/dist/lib/converter/plugins/PackagePlugin.js +192 -96
  34. package/dist/lib/converter/plugins/SourcePlugin.d.ts +6 -5
  35. package/dist/lib/converter/plugins/SourcePlugin.js +239 -132
  36. package/dist/lib/converter/plugins/TypePlugin.js +148 -101
  37. package/dist/lib/converter/symbols.js +16 -4
  38. package/dist/lib/converter/types.js +16 -1
  39. package/dist/lib/converter/utils/nodes.d.ts +2 -2
  40. package/dist/lib/converter/utils/repository.d.ts +15 -5
  41. package/dist/lib/converter/utils/repository.js +29 -12
  42. package/dist/lib/models/ReflectionGroup.d.ts +4 -2
  43. package/dist/lib/models/ReflectionGroup.js +3 -1
  44. package/dist/lib/models/comments/comment.d.ts +9 -2
  45. package/dist/lib/models/comments/comment.js +2 -0
  46. package/dist/lib/models/reflections/ReflectionSymbolId.js +1 -1
  47. package/dist/lib/models/reflections/abstract.d.ts +6 -1
  48. package/dist/lib/models/reflections/abstract.js +15 -2
  49. package/dist/lib/models/reflections/container.d.ts +3 -0
  50. package/dist/lib/models/reflections/container.js +4 -1
  51. package/dist/lib/models/reflections/declaration.d.ts +1 -0
  52. package/dist/lib/models/reflections/declaration.js +1 -0
  53. package/dist/lib/models/reflections/index.d.ts +1 -1
  54. package/dist/lib/models/reflections/kind.d.ts +4 -4
  55. package/dist/lib/models/reflections/kind.js +5 -7
  56. package/dist/lib/models/reflections/parameter.d.ts +3 -0
  57. package/dist/lib/models/reflections/parameter.js +3 -0
  58. package/dist/lib/models/reflections/project.d.ts +1 -0
  59. package/dist/lib/models/reflections/project.js +3 -1
  60. package/dist/lib/models/reflections/reference.d.ts +1 -0
  61. package/dist/lib/models/reflections/reference.js +1 -0
  62. package/dist/lib/models/reflections/signature.d.ts +3 -0
  63. package/dist/lib/models/reflections/signature.js +3 -0
  64. package/dist/lib/models/reflections/type-parameter.d.ts +3 -0
  65. package/dist/lib/models/reflections/type-parameter.js +3 -0
  66. package/dist/lib/models/sources/file.d.ts +2 -0
  67. package/dist/lib/models/sources/file.js +5 -0
  68. package/dist/lib/models/types.d.ts +24 -0
  69. package/dist/lib/models/types.js +21 -0
  70. package/dist/lib/output/components.d.ts +1 -0
  71. package/dist/lib/output/components.js +10 -3
  72. package/dist/lib/output/events.d.ts +2 -2
  73. package/dist/lib/output/index.d.ts +1 -1
  74. package/dist/lib/output/plugins/AssetsPlugin.d.ts +1 -1
  75. package/dist/lib/output/plugins/AssetsPlugin.js +112 -44
  76. package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +2 -1
  77. package/dist/lib/output/plugins/JavascriptIndexPlugin.js +174 -99
  78. package/dist/lib/output/plugins/NavigationPlugin.d.ts +6 -0
  79. package/dist/lib/output/plugins/NavigationPlugin.js +109 -0
  80. package/dist/lib/output/plugins/index.d.ts +2 -1
  81. package/dist/lib/output/plugins/index.js +5 -3
  82. package/dist/lib/output/renderer.d.ts +10 -8
  83. package/dist/lib/output/renderer.js +317 -203
  84. package/dist/lib/output/theme.d.ts +1 -1
  85. package/dist/lib/output/theme.js +64 -18
  86. package/dist/lib/output/themes/MarkedPlugin.d.ts +4 -4
  87. package/dist/lib/output/themes/MarkedPlugin.js +224 -145
  88. package/dist/lib/output/themes/default/DefaultTheme.d.ts +14 -1
  89. package/dist/lib/output/themes/default/DefaultTheme.js +68 -0
  90. package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +43 -44
  91. package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +16 -11
  92. package/dist/lib/output/themes/default/layouts/default.js +2 -0
  93. package/dist/lib/output/themes/default/partials/comment.d.ts +1 -1
  94. package/dist/lib/output/themes/default/partials/comment.js +16 -14
  95. package/dist/lib/output/themes/default/partials/footer.js +1 -1
  96. package/dist/lib/output/themes/default/partials/header.js +2 -2
  97. package/dist/lib/output/themes/default/partials/icon.d.ts +4 -1
  98. package/dist/lib/output/themes/default/partials/icon.js +40 -38
  99. package/dist/lib/output/themes/default/partials/member.js +1 -1
  100. package/dist/lib/output/themes/default/partials/member.signature.body.js +2 -2
  101. package/dist/lib/output/themes/default/partials/navigation.d.ts +1 -1
  102. package/dist/lib/output/themes/default/partials/navigation.js +36 -56
  103. package/dist/lib/output/themes/default/partials/parameter.js +3 -3
  104. package/dist/lib/output/themes/lib.d.ts +1 -2
  105. package/dist/lib/output/themes/lib.js +1 -11
  106. package/dist/lib/serialization/schema.d.ts +37 -1
  107. package/dist/lib/utils/component.d.ts +1 -1
  108. package/dist/lib/utils/component.js +3 -1
  109. package/dist/lib/utils/entry-point.d.ts +0 -6
  110. package/dist/lib/utils/entry-point.js +27 -113
  111. package/dist/lib/utils/events.js +1 -1
  112. package/dist/lib/utils/general.js +1 -1
  113. package/dist/lib/utils/index.d.ts +1 -1
  114. package/dist/lib/utils/index.js +2 -1
  115. package/dist/lib/utils/jsx.d.ts +1 -1
  116. package/dist/lib/utils/jsx.js +24 -15
  117. package/dist/lib/utils/options/declaration.d.ts +5 -1
  118. package/dist/lib/utils/options/declaration.js +1 -1
  119. package/dist/lib/utils/options/index.d.ts +1 -1
  120. package/dist/lib/utils/options/index.js +2 -1
  121. package/dist/lib/utils/options/options.d.ts +22 -9
  122. package/dist/lib/utils/options/options.js +27 -15
  123. package/dist/lib/utils/options/readers/tsconfig.js +2 -7
  124. package/dist/lib/utils/options/readers/typedoc.d.ts +4 -2
  125. package/dist/lib/utils/options/readers/typedoc.js +33 -7
  126. package/dist/lib/utils/options/sources/typedoc.js +25 -4
  127. package/dist/lib/utils/options/tsdoc-defaults.d.ts +1 -1
  128. package/dist/lib/utils/options/tsdoc-defaults.js +4 -0
  129. package/dist/lib/utils/package-manifest.d.ts +0 -25
  130. package/dist/lib/utils/package-manifest.js +7 -148
  131. package/dist/lib/utils/perf.d.ts +1 -1
  132. package/dist/lib/utils/perf.js +36 -31
  133. package/dist/lib/utils/sort.js +0 -1
  134. package/dist/lib/validation/links.js +10 -2
  135. package/package.json +12 -12
  136. package/static/main.js +4 -3
  137. package/static/style.css +26 -10
  138. package/tsdoc.json +16 -0
@@ -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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
- return c > 3 && r && Object.defineProperty(target, key, r), r;
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,12 +56,26 @@ 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
- exports.Application = void 0;
78
+ exports.Application = exports.createAppForTesting = void 0;
37
79
  const Path = __importStar(require("path"));
38
80
  const typescript_1 = __importDefault(require("typescript"));
39
81
  const index_1 = require("./converter/index");
@@ -59,6 +101,17 @@ const packageInfo = require("../../package.json");
59
101
  const supportedVersionMajorMinor = packageInfo.peerDependencies.typescript
60
102
  .split("||")
61
103
  .map((version) => version.replace(/^\s*|\.x\s*$/g, ""));
104
+ const DETECTOR = Symbol();
105
+ function createAppForTesting() {
106
+ // @ts-expect-error private constructor
107
+ return new Application(DETECTOR);
108
+ }
109
+ exports.createAppForTesting = createAppForTesting;
110
+ const DEFAULT_READERS = [
111
+ new index_2.TypeDocReader(),
112
+ new index_2.PackageJsonReader(),
113
+ new index_2.TSConfigReader(),
114
+ ];
62
115
  /**
63
116
  * The default TypeDoc main application class.
64
117
  *
@@ -72,381 +125,436 @@ const supportedVersionMajorMinor = packageInfo.peerDependencies.typescript
72
125
  * Both the {@link Converter} and the {@link Renderer} emit a series of events while processing the project.
73
126
  * Subscribe to these Events to control the application flow or alter the output.
74
127
  */
75
- let Application = exports.Application = Application_1 = class Application extends component_1.ChildableComponent {
76
- /**
77
- * Create a new TypeDoc application instance.
78
- */
79
- constructor() {
80
- super(null); // We own ourselves
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"); }
81
152
  /**
82
- * The serializer used to generate JSON output.
153
+ * Create a new TypeDoc application instance.
83
154
  */
84
- this.serializer = new serialization_1.Serializer();
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
+ }
85
183
  /**
86
- * The deserializer used to restore previously serialized JSON output.
184
+ * Initialize TypeDoc, loading plugins if applicable.
87
185
  */
88
- this.deserializer = new serialization_1.Deserializer(this);
89
- this.logger = new index_2.ConsoleLogger();
90
- this.options = new utils_1.Options(this.logger);
91
- this.converter = this.addComponent("converter", index_1.Converter);
92
- this.renderer = this.addComponent("renderer", renderer_1.Renderer);
93
- }
94
- /**
95
- * Initialize TypeDoc, loading plugins if applicable.
96
- */
97
- async bootstrapWithPlugins(options = {}) {
98
- this.options.reset();
99
- this.setOptions(options, /* reportErrors */ false);
100
- this.options.read(new index_2.Logger());
101
- this.logger.level = this.options.getValue("logLevel");
102
- await (0, index_2.loadPlugins)(this, this.options.getValue("plugin"));
103
- this.bootstrap(options);
104
- }
105
- /**
106
- * Initialize TypeDoc without loading plugins.
107
- *
108
- * @example
109
- * Initialize the application with pretty-printing output disabled.
110
- * ```ts
111
- * const app = new Application();
112
- * app.bootstrap({ pretty: false });
113
- * ```
114
- *
115
- * @param options - Options to set during initialization
116
- */
117
- bootstrap(options = {}) {
118
- this.options.reset();
119
- this.setOptions(options, /* reportErrors */ false);
120
- this.options.read(this.logger);
121
- this.setOptions(options);
122
- this.logger.level = this.options.getValue("logLevel");
123
- if ((0, general_1.hasBeenLoadedMultipleTimes)()) {
124
- 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")}`);
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;
125
196
  }
126
- this.trigger(application_events_1.ApplicationEvents.BOOTSTRAP_END, this);
127
- }
128
- setOptions(options, reportErrors = true) {
129
- for (const [key, val] of Object.entries(options)) {
130
- try {
131
- this.options.setValue(key, val);
197
+ /**
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.
208
+ */
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;
214
+ }
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")}`);
132
223
  }
133
- catch (error) {
134
- (0, assert_1.ok)(error instanceof Error);
135
- if (reportErrors) {
136
- this.logger.error(error.message);
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
+ }
137
236
  }
138
237
  }
139
238
  }
140
- }
141
- /**
142
- * Return the path to the TypeScript compiler.
143
- */
144
- getTypeScriptPath() {
145
- return (0, paths_1.nicePath)(Path.dirname(require.resolve("typescript")));
146
- }
147
- getTypeScriptVersion() {
148
- return typescript_1.default.version;
149
- }
150
- /**
151
- * Gets the entry points to be documented according to the current `entryPoints` and `entryPointStrategy` options.
152
- * May return undefined if entry points fail to be expanded.
153
- */
154
- getEntryPoints() {
155
- return (0, entry_point_1.getEntryPoints)(this.logger, this.options);
156
- }
157
- /**
158
- * Run the converter for the given set of files and return the generated reflections.
159
- *
160
- * @returns An instance of ProjectReflection on success, undefined otherwise.
161
- */
162
- convert() {
163
- const start = Date.now();
164
- // We freeze here rather than in the Converter class since TypeDoc's tests reuse the Application
165
- // with a few different settings.
166
- this.options.freeze();
167
- this.logger.verbose(`Using TypeScript ${this.getTypeScriptVersion()} from ${this.getTypeScriptPath()}`);
168
- if (this.entryPointStrategy === entry_point_1.EntryPointStrategy.Merge) {
169
- return this._merge();
170
- }
171
- if (this.entryPointStrategy === entry_point_1.EntryPointStrategy.Packages) {
172
- 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")));
173
244
  }
174
- if (!supportedVersionMajorMinor.some((version) => version == typescript_1.default.versionMajorMinor)) {
175
- this.logger.warn(`You are running with an unsupported TypeScript version! If TypeDoc crashes, this is why. TypeDoc supports ${supportedVersionMajorMinor.join(", ")}`);
245
+ getTypeScriptVersion() {
246
+ return typescript_1.default.version;
176
247
  }
177
- const entryPoints = this.getEntryPoints();
178
- if (!entryPoints) {
179
- // Fatal error already reported.
180
- return;
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);
181
254
  }
182
- const programs = (0, array_1.unique)(entryPoints.map((e) => e.program));
183
- this.logger.verbose(`Converting with ${programs.length} programs ${entryPoints.length} entry points`);
184
- if (this.skipErrorChecking === false) {
185
- const errors = programs.flatMap((program) => typescript_1.default.getPreEmitDiagnostics(program));
186
- if (errors.length) {
187
- this.logger.diagnostics(errors);
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.
188
278
  return;
189
279
  }
190
- }
191
- if (this.options.getValue("emit") === "both") {
192
- for (const program of programs) {
193
- program.emit();
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
+ }
194
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;
195
299
  }
196
- const startConversion = Date.now();
197
- this.logger.verbose(`Finished getting entry points in ${Date.now() - start}ms`);
198
- const project = this.converter.convert(entryPoints);
199
- this.logger.verbose(`Finished conversion in ${Date.now() - startConversion}ms`);
200
- return project;
201
- }
202
- convertAndWatch(success) {
203
- this.options.freeze();
204
- if (!this.options.getValue("preserveWatchOutput") &&
205
- this.logger instanceof index_2.ConsoleLogger) {
206
- typescript_1.default.sys.clearScreen?.();
207
- }
208
- this.logger.verbose(`Using TypeScript ${this.getTypeScriptVersion()} from ${this.getTypeScriptPath()}`);
209
- if (!supportedVersionMajorMinor.some((version) => version == typescript_1.default.versionMajorMinor)) {
210
- this.logger.warn(`You are running with an unsupported TypeScript version! TypeDoc supports ${supportedVersionMajorMinor.join(", ")}`);
211
- }
212
- if (Object.keys(this.options.getCompilerOptions()).length === 0) {
213
- this.logger.warn(`No compiler options set. This likely means that TypeDoc did not find your tsconfig.json. Generated documentation will probably be empty.`);
214
- }
215
- // Doing this is considerably more complicated, we'd need to manage an array of programs, not convert until all programs
216
- // have reported in the first time... just error out for now. I'm not convinced anyone will actually notice.
217
- if (this.options.getFileNames().length === 0) {
218
- this.logger.error("The provided tsconfig file looks like a solution style tsconfig, which is not supported in watch mode.");
219
- return;
220
- }
221
- // Support for packages mode is currently unimplemented
222
- if (this.entryPointStrategy !== entry_point_1.EntryPointStrategy.Resolve &&
223
- this.entryPointStrategy !== entry_point_1.EntryPointStrategy.Expand) {
224
- this.logger.error("entryPointStrategy must be set to either resolve or expand for watch mode.");
225
- return;
226
- }
227
- const tsconfigFile = (0, tsconfig_1.findTsConfigFile)(this.options.getValue("tsconfig")) ??
228
- "tsconfig.json";
229
- // We don't want to do it the first time to preserve initial debug status messages. They'll be lost
230
- // after the user saves a file, but better than nothing...
231
- let firstStatusReport = true;
232
- const host = typescript_1.default.createWatchCompilerHost(tsconfigFile, {}, typescript_1.default.sys, typescript_1.default.createEmitAndSemanticDiagnosticsBuilderProgram, (diagnostic) => this.logger.diagnostic(diagnostic), (status, newLine, _options, errorCount) => {
233
- if (!firstStatusReport &&
234
- errorCount === void 0 &&
235
- !this.options.getValue("preserveWatchOutput") &&
300
+ convertAndWatch(success) {
301
+ this.options.freeze();
302
+ if (!this.options.getValue("preserveWatchOutput") &&
236
303
  this.logger instanceof index_2.ConsoleLogger) {
237
304
  typescript_1.default.sys.clearScreen?.();
238
305
  }
239
- firstStatusReport = false;
240
- this.logger.info(typescript_1.default.flattenDiagnosticMessageText(status.messageText, newLine));
241
- });
242
- let successFinished = true;
243
- let currentProgram;
244
- const runSuccess = () => {
245
- if (!currentProgram) {
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.");
246
323
  return;
247
324
  }
248
- if (successFinished) {
249
- if (this.options.getValue("emit") === "both") {
250
- currentProgram.emit();
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?.();
251
336
  }
252
- this.logger.resetErrors();
253
- this.logger.resetWarnings();
254
- const entryPoints = (0, entry_point_1.getWatchEntryPoints)(this.logger, this.options, currentProgram);
255
- if (!entryPoints) {
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) {
256
344
  return;
257
345
  }
258
- const project = this.converter.convert(entryPoints);
259
- currentProgram = undefined;
260
- successFinished = false;
261
- void success(project).then(() => {
262
- successFinished = true;
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();
263
377
  runSuccess();
264
- });
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"));
265
391
  }
266
- };
267
- const origCreateProgram = host.createProgram;
268
- host.createProgram = (rootNames, options, host, oldProgram, configDiagnostics, references) => {
269
- // If we always do this, we'll get a crash the second time a program is created.
270
- if (rootNames !== undefined) {
271
- options = this.options.fixCompilerOptions(options || {});
392
+ if (checks.notDocumented) {
393
+ (0, documentation_1.validateDocumentation)(project, this.logger, this.options.getValue("requiredToBeDocumented"));
272
394
  }
273
- return origCreateProgram(rootNames, options, host, oldProgram, configDiagnostics, references);
274
- };
275
- const origAfterProgramCreate = host.afterProgramCreate;
276
- host.afterProgramCreate = (program) => {
277
- if (typescript_1.default.getPreEmitDiagnostics(program.getProgram()).length === 0) {
278
- currentProgram = program.getProgram();
279
- runSuccess();
395
+ if (checks.invalidLink) {
396
+ (0, links_1.validateLinks)(project, this.logger);
280
397
  }
281
- origAfterProgramCreate?.(program);
282
- };
283
- typescript_1.default.createWatchProgram(host);
284
- }
285
- validate(project) {
286
- const checks = this.options.getValue("validation");
287
- const start = Date.now();
288
- // No point in validating exports when merging. Warnings will have already been emitted when
289
- // creating the project jsons that this run merges together.
290
- if (checks.notExported &&
291
- this.entryPointStrategy !== entry_point_1.EntryPointStrategy.Merge) {
292
- (0, exports_1.validateExports)(project, this.logger, this.options.getValue("intentionallyNotExported"));
293
- }
294
- if (checks.notDocumented) {
295
- (0, documentation_1.validateDocumentation)(project, this.logger, this.options.getValue("requiredToBeDocumented"));
296
- }
297
- if (checks.invalidLink) {
298
- (0, links_1.validateLinks)(project, this.logger);
299
- }
300
- this.trigger(Application_1.EVENT_VALIDATE_PROJECT, project);
301
- this.logger.verbose(`Validation took ${Date.now() - start}ms`);
302
- }
303
- /**
304
- * Render HTML for the given project
305
- */
306
- async generateDocs(project, out) {
307
- const start = Date.now();
308
- out = Path.resolve(out);
309
- await this.renderer.render(project, out);
310
- if (this.logger.hasErrors()) {
311
- 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`);
312
400
  }
313
- else {
314
- this.logger.info(`Documentation generated at ${(0, paths_1.nicePath)(out)}`);
315
- this.logger.verbose(`HTML rendering took ${Date.now() - start}ms`);
316
- }
317
- }
318
- /**
319
- * Write the reflections to a json file.
320
- *
321
- * @param out The path and file name of the target file.
322
- * @returns Whether the JSON file could be written successfully.
323
- */
324
- async generateJson(project, out) {
325
- const start = Date.now();
326
- out = Path.resolve(out);
327
- const ser = this.serializer.projectToObject(project, process.cwd());
328
- const space = this.options.getValue("pretty") ? "\t" : "";
329
- await (0, index_2.writeFile)(out, JSON.stringify(ser, null, space));
330
- this.logger.info(`JSON written to ${(0, paths_1.nicePath)(out)}`);
331
- this.logger.verbose(`JSON rendering took ${Date.now() - start}ms`);
332
- }
333
- /**
334
- * Print the version number.
335
- */
336
- toString() {
337
- return [
338
- "",
339
- `TypeDoc ${Application_1.VERSION}`,
340
- `Using TypeScript ${this.getTypeScriptVersion()} from ${this.getTypeScriptPath()}`,
341
- "",
342
- ].join("\n");
343
- }
344
- _convertPackages() {
345
- if (!this.options.isSet("entryPoints")) {
346
- this.logger.error("No entry points provided to packages mode, documentation cannot be generated.");
347
- return;
348
- }
349
- const packageDirs = (0, entry_point_1.getPackageDirectories)(this.logger, this.options, this.options.getValue("entryPoints"));
350
- if (packageDirs.length === 0) {
351
- this.logger.error("Failed to find any packages, ensure you have provided at least one directory as an entry point containing package.json");
352
- return;
353
- }
354
- const origOptions = this.options;
355
- const projects = [];
356
- // Generate a json file for each package
357
- for (const dir of packageDirs) {
358
- this.logger.info(`Converting project at ${(0, paths_1.nicePath)(dir)}`);
359
- const opts = origOptions.copyForPackage(dir);
360
- // Invalid links should only be reported after everything has been merged.
361
- opts.setValue("validation", { invalidLink: false });
362
- opts.read(this.logger, dir);
363
- if (opts.getValue("entryPointStrategy") ===
364
- entry_point_1.EntryPointStrategy.Packages) {
365
- this.logger.error(`Project at ${(0, paths_1.nicePath)(dir)} has entryPointStrategy set to packages, but nested packages are not supported.`);
366
- 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.");
367
410
  }
368
- this.options = opts;
369
- const project = this.convert();
370
- if (project) {
371
- this.validate(project);
372
- 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`);
373
414
  }
374
- (0, abstract_1.resetReflectionID)();
375
415
  }
376
- this.options = origOptions;
377
- this.logger.info(`Merging converted projects`);
378
- if (projects.length !== packageDirs.length) {
379
- this.logger.error("Failed to convert one or more packages, result will not be merged together.");
380
- return;
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`);
381
430
  }
382
- const result = this.deserializer.reviveProjects(this.options.getValue("name") || "Documentation", projects);
383
- this.trigger(application_events_1.ApplicationEvents.REVIVE, result);
384
- return result;
385
- }
386
- _merge() {
387
- const start = Date.now();
388
- if (!this.options.isSet("entryPoints")) {
389
- this.logger.error("No entry points provided to merge.");
390
- return;
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");
391
441
  }
392
- const rootDir = (0, fs_1.deriveRootDir)(this.entryPoints);
393
- const entryPoints = this.entryPoints.flatMap((entry) => {
394
- const result = (0, fs_1.glob)(entry, rootDir);
395
- if (result.length === 0) {
396
- 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;
397
446
  }
398
- else {
399
- this.logger.verbose(`Expanded ${(0, paths_1.nicePath)(entry)} to:\n\t${result
400
- .map(paths_1.nicePath)
401
- .join("\n\t")}`);
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;
402
451
  }
403
- return result;
404
- });
405
- const jsonProjects = entryPoints.map((path) => {
406
- try {
407
- return JSON.parse((0, fs_1.readFile)(path));
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
+ // Invalid links should only be reported after everything has been merged.
459
+ opts.setValue("validation", { invalidLink: false });
460
+ await opts.read(this.logger, dir);
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)();
408
473
  }
409
- catch {
410
- this.logger.error(`Failed to parse file at ${(0, paths_1.nicePath)(path)} as json.`);
411
- return null;
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;
412
479
  }
413
- });
414
- if (this.logger.hasErrors())
415
- return;
416
- const result = this.deserializer.reviveProjects(this.options.getValue("name"), jsonProjects);
417
- this.logger.verbose(`Reviving projects took ${Date.now() - start}ms`);
418
- this.trigger(application_events_1.ApplicationEvents.REVIVE, result);
419
- return result;
420
- }
421
- };
422
- /**
423
- * The version number of TypeDoc.
424
- */
425
- Application.VERSION = packageInfo.version;
426
- /**
427
- * Emitted after plugins have been loaded and options have been read, but before they have been frozen.
428
- * The listener will be given an instance of {@link Application}.
429
- */
430
- Application.EVENT_BOOTSTRAP_END = application_events_1.ApplicationEvents.BOOTSTRAP_END;
431
- /**
432
- * Emitted after a project has been deserialized from JSON.
433
- * The listener will be given an instance of {@link ProjectReflection}.
434
- */
435
- Application.EVENT_PROJECT_REVIVE = application_events_1.ApplicationEvents.REVIVE;
436
- /**
437
- * Emitted when validation is being run.
438
- * The listener will be given an instance of {@link ProjectReflection}.
439
- */
440
- Application.EVENT_VALIDATE_PROJECT = application_events_1.ApplicationEvents.VALIDATE_PROJECT;
441
- __decorate([
442
- (0, utils_1.BindOption)("skipErrorChecking")
443
- ], Application.prototype, "skipErrorChecking", void 0);
444
- __decorate([
445
- (0, utils_1.BindOption)("entryPointStrategy")
446
- ], Application.prototype, "entryPointStrategy", void 0);
447
- __decorate([
448
- (0, utils_1.BindOption)("entryPoints")
449
- ], Application.prototype, "entryPoints", void 0);
450
- exports.Application = Application = Application_1 = __decorate([
451
- (0, component_1.Component)({ name: "application", internal: true })
452
- ], Application);
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
+ })();
560
+ exports.Application = Application;