summaryrefslogtreecommitdiffhomepage
path: root/typedoc-plugin-external-module-name/index.js
diff options
context:
space:
mode:
authorGerrit Birkeland <gerrit@gerritbirkeland.com>2020-10-25 15:15:51 -0600
committerGerrit Birkeland <gerrit@gerritbirkeland.com>2020-10-25 15:15:51 -0600
commit5c34f5069aea47bdb936a46b5f8dd92aa3d3eec8 (patch)
tree7a8f187bcd82568da3bf6521c9a5c79f689b299b /typedoc-plugin-external-module-name/index.js
parent4c7c26d1da7280c344af74c2f1f1fde7bf426ee1 (diff)
chore: Switch to typedoc@beta for documentation generation
Diffstat (limited to 'typedoc-plugin-external-module-name/index.js')
-rw-r--r--typedoc-plugin-external-module-name/index.js22
1 files changed, 18 insertions, 4 deletions
diff --git a/typedoc-plugin-external-module-name/index.js b/typedoc-plugin-external-module-name/index.js
index 5b93a8b..d4f5080 100644
--- a/typedoc-plugin-external-module-name/index.js
+++ b/typedoc-plugin-external-module-name/index.js
@@ -1,6 +1,20 @@
+//@ts-check
+
/* eslint-disable @typescript-eslint/no-var-requires */
-var plugin = require('./typedoc-plugin-external-module-name');
-module.exports = function(PluginHost) {
- var app = PluginHost.owner;
- app.converter.addComponent('external-module-name', plugin.ExternalModuleNamePlugin);
+const { ReflectionKind } = require('typedoc');
+const { Converter } = require('typedoc/dist/lib/converter');
+
+/** @param {import("typedoc/dist/lib/utils/plugins").PluginHost} host */
+exports.load = function (host) {
+ host.application.converter.on(Converter.EVENT_RESOLVE_BEGIN, context => {
+ /** @type {import("typedoc").ProjectReflection} */
+ const project = context.project;
+
+ for (const mod of project.children.filter(child => child.kind === ReflectionKind.Module)) {
+ const tag = mod.comment?.getTag('module');
+ if (!tag) continue;
+ mod.name = tag.text;
+ mod.comment.removeTags('module');
+ }
+ });
};