docusaurus-plugin-typedoc 1.0.0-next.12 → 1.0.0-next.13

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
@@ -128,7 +128,7 @@ The position of the sidebar in the tree.
128
128
  The Docusaurus docs folder root. Use `./` if no root folder specified. Defaults to `./docs`.
129
129
 
130
130
  ```shell
131
- --docsRoot <path/to/vitepress-docs/>
131
+ --docsRoot <path/to/docs-dir/>
132
132
  ```
133
133
 
134
134
  ### An example configuration
@@ -152,6 +152,14 @@ module.exports = {
152
152
  };
153
153
  ```
154
154
 
155
+ ## Typing the config file
156
+
157
+ The config can be typed using JSDoc type annotations. See https://docusaurus.io/docs/typescript-support#typing-config.
158
+
159
+ ```js
160
+ /** @type {import('docusaurus-plugin-typedoc').PluginOptions} */
161
+ ```
162
+
155
163
  ## Frontmatter
156
164
 
157
165
  Additional frontmatter options can be added to the config. Please see [typedoc-plugin-frontmatter](https://github.com/tgreyuk/typedoc-plugin-frontmatter#typedoc-plugin-frontmatter).
package/dist/index.d.ts CHANGED
@@ -1,5 +1,2 @@
1
- export default function pluginDocusaurus(context: any, opts: Record<string, any>): {
2
- name: string;
3
- loadContent(): Promise<void>;
4
- extendCli(cli: any): void;
5
- };
1
+ export { PluginOptions } from './models';
2
+ export { default } from './plugin';
package/dist/index.js CHANGED
@@ -1,91 +1,8 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
4
  };
25
5
  Object.defineProperty(exports, "__esModule", { value: true });
26
- const path = __importStar(require("path"));
27
- const typedoc_1 = require("typedoc");
28
- const typedoc_plugin_frontmatter_1 = require("typedoc-plugin-frontmatter");
29
- const typedoc_plugin_markdown_1 = require("typedoc-plugin-markdown");
30
- const options_1 = require("./options");
31
- const renderer_1 = require("./renderer");
32
- // store list of plugin ids when running multiple instances
33
- const apps = [];
34
- function pluginDocusaurus(context, opts) {
35
- return {
36
- name: 'docusaurus-plugin-typedoc',
37
- async loadContent() {
38
- if (opts.id && !apps.includes(opts.id)) {
39
- apps.push(opts.id);
40
- generateTypedoc(context, opts);
41
- }
42
- },
43
- extendCli(cli) {
44
- cli
45
- .command('generate-typedoc')
46
- .description('(docusaurus-plugin-typedoc) Generate TypeDoc docs independently of the Docusaurus build process.')
47
- .action(async () => {
48
- var _a;
49
- (_a = context.siteConfig) === null || _a === void 0 ? void 0 : _a.plugins.forEach((pluginConfig) => {
50
- // Check PluginConfig is typed to [string, PluginOptions]
51
- if (pluginConfig && typeof pluginConfig[1] === 'object') {
52
- generateTypedoc(context, pluginConfig[1]);
53
- }
54
- });
55
- });
56
- },
57
- };
58
- }
59
- exports.default = pluginDocusaurus;
60
- /**
61
- * Initiates a new typedoc Application bootstraped with plugin options
62
- */
63
- async function generateTypedoc(context, opts) {
64
- const { siteDir } = context;
65
- const options = (0, options_1.getPluginOptions)(opts);
66
- const { id, docsRoot, ...optionsPassedToTypeDoc } = options;
67
- const outputDir = path.resolve(siteDir, options.docsRoot, options.out);
68
- const app = new typedoc_1.Application();
69
- (0, options_1.loadOptions)(app);
70
- (0, renderer_1.loadRenderer)(app);
71
- (0, typedoc_plugin_markdown_1.load)(app);
72
- (0, typedoc_plugin_frontmatter_1.load)(app);
73
- await app.bootstrapWithPlugins(optionsPassedToTypeDoc);
74
- const project = app.convert();
75
- // if project is undefined typedoc has a problem - error logging will be supplied by typedoc.
76
- if (!project) {
77
- if (app.options.getValue('skipErrorChecking')) {
78
- return;
79
- }
80
- console.error('[docusaurus-plugin-typedoc] TypeDoc exited with an error. Use the "skipErrorChecking" option to disable TypeDoc error checking.');
81
- process.exit();
82
- }
83
- if (app.options.getValue('watch')) {
84
- app.convertAndWatch(async (project) => {
85
- await app.generateDocs(project, outputDir);
86
- });
87
- }
88
- else {
89
- await app.generateDocs(project, outputDir);
90
- }
91
- }
6
+ exports.default = void 0;
7
+ var plugin_1 = require("./plugin");
8
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(plugin_1).default; } });
package/dist/models.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- export interface PluginOptions {
1
+ import { PluginOptions as TypedocPluginMarkdownOptions } from 'typedoc-plugin-markdown';
2
+ export interface PluginOptions extends TypedocPluginMarkdownOptions {
2
3
  id: string;
3
4
  docsRoot: string;
4
- sidebar: SidebarOptions;
5
+ sidebar: Partial<SidebarOptions>;
5
6
  }
6
7
  export interface SidebarOptions {
7
8
  autoConfiguration: boolean;
@@ -0,0 +1,6 @@
1
+ import { PluginOptions } from '.';
2
+ export default function pluginDocusaurus(context: any, opts: Partial<PluginOptions>): {
3
+ name: string;
4
+ loadContent(): Promise<void>;
5
+ extendCli(cli: any): void;
6
+ };
package/dist/plugin.js ADDED
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const path = __importStar(require("path"));
27
+ const typedoc_1 = require("typedoc");
28
+ const typedoc_plugin_frontmatter_1 = require("typedoc-plugin-frontmatter");
29
+ const typedoc_plugin_markdown_1 = require("typedoc-plugin-markdown");
30
+ const options_1 = require("./options");
31
+ const renderer_1 = require("./renderer");
32
+ // store list of plugin ids when running multiple instances
33
+ const apps = [];
34
+ function pluginDocusaurus(context, opts) {
35
+ return {
36
+ name: 'docusaurus-plugin-typedoc',
37
+ async loadContent() {
38
+ if (opts.id && !apps.includes(opts.id)) {
39
+ apps.push(opts.id);
40
+ generateTypedoc(context, opts);
41
+ }
42
+ },
43
+ extendCli(cli) {
44
+ cli
45
+ .command('generate-typedoc')
46
+ .description('(docusaurus-plugin-typedoc) Generate TypeDoc docs independently of the Docusaurus build process.')
47
+ .action(async () => {
48
+ var _a;
49
+ (_a = context.siteConfig) === null || _a === void 0 ? void 0 : _a.plugins.forEach((pluginConfig) => {
50
+ // Check PluginConfig is typed to [string, PluginOptions]
51
+ if (pluginConfig && typeof pluginConfig[1] === 'object') {
52
+ generateTypedoc(context, pluginConfig[1]);
53
+ }
54
+ });
55
+ });
56
+ },
57
+ };
58
+ }
59
+ exports.default = pluginDocusaurus;
60
+ /**
61
+ * Initiates a new typedoc Application bootstraped with plugin options
62
+ */
63
+ async function generateTypedoc(context, opts) {
64
+ const { siteDir } = context;
65
+ const options = (0, options_1.getPluginOptions)(opts);
66
+ const { id, docsRoot, ...optionsPassedToTypeDoc } = options;
67
+ const outputDir = path.resolve(siteDir, options.docsRoot, options.out);
68
+ const app = new typedoc_1.Application();
69
+ (0, options_1.loadOptions)(app);
70
+ (0, renderer_1.loadRenderer)(app);
71
+ (0, typedoc_plugin_markdown_1.load)(app);
72
+ (0, typedoc_plugin_frontmatter_1.load)(app);
73
+ await app.bootstrapWithPlugins(optionsPassedToTypeDoc);
74
+ const project = app.convert();
75
+ // if project is undefined typedoc has a problem - error logging will be supplied by typedoc.
76
+ if (!project) {
77
+ if (app.options.getValue('skipErrorChecking')) {
78
+ return;
79
+ }
80
+ console.error('[docusaurus-plugin-typedoc] TypeDoc exited with an error. Use the "skipErrorChecking" option to disable TypeDoc error checking.');
81
+ process.exit();
82
+ }
83
+ if (app.options.getValue('watch')) {
84
+ app.convertAndWatch(async (project) => {
85
+ await app.generateDocs(project, outputDir);
86
+ });
87
+ }
88
+ else {
89
+ await app.generateDocs(project, outputDir);
90
+ }
91
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docusaurus-plugin-typedoc",
3
- "version": "1.0.0-next.12",
3
+ "version": "1.0.0-next.13",
4
4
  "description": "A Docusaurus v2 plugin to build API documentation with TypeDoc.",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -19,7 +19,7 @@
19
19
  "typedoc-plugin-frontmatter": ">=0.0.2"
20
20
  },
21
21
  "peerDependencies": {
22
- "typedoc-plugin-markdown": ">=4.0.0-next.13"
22
+ "typedoc-plugin-markdown": ">=4.0.0-next.14"
23
23
  },
24
24
  "scripts": {
25
25
  "lint": "eslint ./src --ext .ts",