docusaurus-plugin-typedoc 0.19.2 → 0.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -67,7 +67,7 @@ Once built the docs will be available at `/docs/api` (or equivalent out director
67
67
 
68
68
  ### TypeDoc options
69
69
 
70
- To configure TypeDoc, pass any relevant [TypeDoc options](https://typedoc.org/guides/options/) to the config.
70
+ To configure TypeDoc, pass any relevant [TypeDoc options](https://typedoc.org/options/) to the config.
71
71
 
72
72
  At a minimum the `entryPoints` and `tsconfig` options will need to be set.
73
73
 
@@ -0,0 +1,7 @@
1
+ import { Options, OptionsReader } from 'typedoc';
2
+ export declare class MarkdownThemeOptionsReader implements OptionsReader {
3
+ name: string;
4
+ readonly order = 1000;
5
+ readonly supportsPackages = false;
6
+ read(container: Options): void;
7
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MarkdownThemeOptionsReader = void 0;
4
+ class MarkdownThemeOptionsReader {
5
+ constructor() {
6
+ this.name = 'markdown-theme-reader';
7
+ this.order = 1000;
8
+ this.supportsPackages = false;
9
+ }
10
+ read(container) {
11
+ container.setValue('theme', 'markdown');
12
+ }
13
+ }
14
+ exports.MarkdownThemeOptionsReader = MarkdownThemeOptionsReader;
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,7 +25,6 @@ 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");
@@ -59,14 +58,16 @@ async function generateTypedoc(context, opts) {
59
58
  const { siteDir } = context;
60
59
  const options = (0, options_1.getPluginOptions)(opts);
61
60
  const outputDir = path.resolve(siteDir, options.docsRoot, options.out);
61
+ const { id, docsRoot, sidebar, frontmatter, includeExtension, indexSlug, ...optionsPassedToTypeDoc } = options;
62
62
  if (opts.cleanOutputDir) {
63
63
  (0, render_1.removeDir)(outputDir);
64
64
  }
65
- const app = new typedoc_1.Application();
65
+ const app = await typedoc_1.Application.bootstrapWithPlugins(optionsPassedToTypeDoc);
66
+ (0, render_1.addTypedocDeclarations)(app);
67
+ setOptions(app, options);
66
68
  app.renderer.defineTheme('docusaurus', theme_1.DocusaurusTheme);
67
- (0, typedoc_plugin_markdown_1.load)(app);
68
- await (0, render_1.bootstrap)(app, options);
69
- const project = app.convert();
69
+ app.renderer.render = render_1.render;
70
+ const project = await app.convert();
70
71
  if (!project) {
71
72
  return;
72
73
  }
@@ -79,3 +80,8 @@ async function generateTypedoc(context, opts) {
79
80
  await app.generateDocs(project, outputDir);
80
81
  }
81
82
  }
83
+ function setOptions(app, options, reportErrors = true) {
84
+ for (const [key, val] of Object.entries(options)) {
85
+ app.options.setValue(key, val);
86
+ }
87
+ }
package/dist/render.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Application, ProjectReflection } from 'typedoc';
2
- import { PluginOptions } from './types';
3
- export declare function bootstrap(app: Application, options: PluginOptions): Promise<void>;
4
2
  export declare function render(project: ProjectReflection, outputDirectory: string): Promise<void>;
3
+ export declare const addTypedocDeclarations: (app: Application) => void;
5
4
  export declare function removeDir(path: string): void;
package/dist/render.js CHANGED
@@ -23,16 +23,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.removeDir = exports.render = exports.bootstrap = void 0;
26
+ exports.removeDir = exports.addTypedocDeclarations = exports.render = void 0;
27
27
  const fs = __importStar(require("fs"));
28
28
  const typedoc_1 = require("typedoc");
29
- async function bootstrap(app, options) {
30
- addTypedocReaders(app);
31
- addTypedocDeclarations(app);
32
- app.renderer.render = render;
33
- await app.bootstrapWithPlugins(options);
34
- }
35
- exports.bootstrap = bootstrap;
36
29
  async function render(project, outputDirectory) {
37
30
  var _a;
38
31
  if (!this.prepareTheme()) {
@@ -49,10 +42,6 @@ async function render(project, outputDirectory) {
49
42
  }
50
43
  }
51
44
  exports.render = render;
52
- const addTypedocReaders = (app) => {
53
- app.options.addReader(new typedoc_1.TypeDocReader());
54
- app.options.addReader(new typedoc_1.TSConfigReader());
55
- };
56
45
  const addTypedocDeclarations = (app) => {
57
46
  app.options.addDeclaration({
58
47
  name: 'id',
@@ -84,6 +73,7 @@ const addTypedocDeclarations = (app) => {
84
73
  type: typedoc_1.ParameterType.Mixed,
85
74
  });
86
75
  };
76
+ exports.addTypedocDeclarations = addTypedocDeclarations;
87
77
  function removeDir(path) {
88
78
  if (fs.existsSync(path)) {
89
79
  const files = fs.readdirSync(path);
package/dist/theme.js CHANGED
@@ -45,7 +45,6 @@ const CATEGORY_POSITION = {
45
45
  [typedoc_1.ReflectionKind.TypeAlias]: 5,
46
46
  [typedoc_1.ReflectionKind.Variable]: 6,
47
47
  [typedoc_1.ReflectionKind.Function]: 7,
48
- [typedoc_1.ReflectionKind.ObjectLiteral]: 8,
49
48
  };
50
49
  class DocusaurusTheme extends theme_1.MarkdownTheme {
51
50
  constructor(renderer) {
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.19.2",
3
+ "version": "0.20.1",
4
4
  "description": "A Docusaurus v2 plugin to build API documentation with TypeDoc.",
5
5
  "main": "dist/index.js",
6
6
  "files": [