docusaurus-plugin-typedoc 0.20.0 → 0.20.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/options.js CHANGED
@@ -25,6 +25,7 @@ const DEFAULT_PLUGIN_OPTIONS = {
25
25
  indexSlug: undefined,
26
26
  theme: 'docusaurus',
27
27
  frontmatter: undefined,
28
+ plugin: ['typedoc-plugin-markdown'],
28
29
  };
29
30
  const getPluginOptions = (opts) => {
30
31
  const options = {
@@ -34,6 +35,9 @@ const getPluginOptions = (opts) => {
34
35
  ...DEFAULT_PLUGIN_OPTIONS.sidebar,
35
36
  ...opts.sidebar,
36
37
  },
38
+ plugin: [
39
+ ...new Set([...DEFAULT_PLUGIN_OPTIONS.plugin, ...(opts.plugin || [])]),
40
+ ],
37
41
  };
38
42
  return options;
39
43
  };
package/dist/plugin.js CHANGED
@@ -25,14 +25,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const path = __importStar(require("path"));
27
27
  const typedoc_1 = require("typedoc");
28
- const typedoc_plugin_markdown_1 = require("typedoc-plugin-markdown");
29
28
  const options_1 = require("./options");
30
29
  const render_1 = require("./render");
31
30
  const theme_1 = require("./theme");
32
31
  const apps = [];
32
+ const PLUGIN_NAME = 'docusaurus-plugin-typedoc';
33
33
  function pluginDocusaurus(context, opts) {
34
34
  return {
35
- name: 'docusaurus-plugin-typedoc',
35
+ name: PLUGIN_NAME,
36
36
  async loadContent() {
37
37
  if (opts.id && !apps.includes(opts.id)) {
38
38
  apps.push(opts.id);
@@ -42,11 +42,11 @@ function pluginDocusaurus(context, opts) {
42
42
  extendCli(cli) {
43
43
  cli
44
44
  .command('generate-typedoc')
45
- .description('(docusaurus-plugin-typedoc) Generate TypeDoc docs independently of the Docusaurus build process.')
45
+ .description(`(${PLUGIN_NAME}) Generate TypeDoc docs independently of the Docusaurus build process.`)
46
46
  .action(async () => {
47
47
  var _a;
48
48
  (_a = context.siteConfig) === null || _a === void 0 ? void 0 : _a.plugins.forEach((pluginConfig) => {
49
- if (pluginConfig && typeof pluginConfig[1] === 'object') {
49
+ if (pluginConfig && typeof pluginConfig[1] === 'object' && pluginConfig[0] === PLUGIN_NAME) {
50
50
  generateTypedoc(context, pluginConfig[1]);
51
51
  }
52
52
  });
@@ -59,17 +59,11 @@ async function generateTypedoc(context, opts) {
59
59
  const { siteDir } = context;
60
60
  const options = (0, options_1.getPluginOptions)(opts);
61
61
  const outputDir = path.resolve(siteDir, options.docsRoot, options.out);
62
+ const { id, docsRoot, sidebar, frontmatter, includeExtension, indexSlug, ...optionsPassedToTypeDoc } = options;
62
63
  if (opts.cleanOutputDir) {
63
64
  (0, render_1.removeDir)(outputDir);
64
65
  }
65
- const app = await typedoc_1.Application.bootstrapWithPlugins({}, [
66
- new typedoc_1.ArgumentsReader(0),
67
- new typedoc_1.TypeDocReader(),
68
- new typedoc_1.PackageJsonReader(),
69
- new typedoc_1.TSConfigReader(),
70
- new typedoc_1.ArgumentsReader(300),
71
- ]);
72
- (0, typedoc_plugin_markdown_1.load)(app);
66
+ const app = await typedoc_1.Application.bootstrapWithPlugins(optionsPassedToTypeDoc);
73
67
  (0, render_1.addTypedocDeclarations)(app);
74
68
  setOptions(app, options);
75
69
  app.renderer.defineTheme('docusaurus', theme_1.DocusaurusTheme);
package/dist/types.d.ts CHANGED
@@ -5,7 +5,7 @@ export interface PluginOptions {
5
5
  sidebar: SidebarOptions;
6
6
  readmeTitle?: string;
7
7
  globalsTitle?: string;
8
- plugin?: string[];
8
+ plugin: string[];
9
9
  readme?: string;
10
10
  disableOutputCheck?: boolean;
11
11
  cleanOutputDir?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docusaurus-plugin-typedoc",
3
- "version": "0.20.0",
3
+ "version": "0.20.2",
4
4
  "description": "A Docusaurus v2 plugin to build API documentation with TypeDoc.",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "scripts": {
26
26
  "lint": "eslint ./src --ext .ts",
27
- "prepublishOnly": "yarn run lint && yarn run build",
27
+ "prepublishOnly": "yarn run lint && yarn run build && yarn run test",
28
28
  "build": "rm -rf ./dist && tsc",
29
29
  "build-and-test": "yarn run build && yarn run test",
30
30
  "test": "jest --colors"