docusaurus-plugin-typedoc 0.19.2 → 0.20.0

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/plugin.js CHANGED
@@ -62,11 +62,19 @@ async function generateTypedoc(context, opts) {
62
62
  if (opts.cleanOutputDir) {
63
63
  (0, render_1.removeDir)(outputDir);
64
64
  }
65
- const app = new typedoc_1.Application();
66
- app.renderer.defineTheme('docusaurus', theme_1.DocusaurusTheme);
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
+ ]);
67
72
  (0, typedoc_plugin_markdown_1.load)(app);
68
- await (0, render_1.bootstrap)(app, options);
69
- const project = app.convert();
73
+ (0, render_1.addTypedocDeclarations)(app);
74
+ setOptions(app, options);
75
+ app.renderer.defineTheme('docusaurus', theme_1.DocusaurusTheme);
76
+ app.renderer.render = render_1.render;
77
+ const project = await app.convert();
70
78
  if (!project) {
71
79
  return;
72
80
  }
@@ -79,3 +87,8 @@ async function generateTypedoc(context, opts) {
79
87
  await app.generateDocs(project, outputDir);
80
88
  }
81
89
  }
90
+ function setOptions(app, options, reportErrors = true) {
91
+ for (const [key, val] of Object.entries(options)) {
92
+ app.options.setValue(key, val);
93
+ }
94
+ }
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docusaurus-plugin-typedoc",
3
- "version": "0.19.2",
3
+ "version": "0.20.0",
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 && yarn run test",
27
+ "prepublishOnly": "yarn run lint && yarn run build",
28
28
  "build": "rm -rf ./dist && tsc",
29
29
  "build-and-test": "yarn run build && yarn run test",
30
30
  "test": "jest --colors"