docusaurus-plugin-typedoc 1.0.0-next.11 → 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
@@ -93,7 +93,6 @@ The following typedoc-plugin-markdown options are preset with the plugin.
93
93
  "hideBreadcrumbs": true,
94
94
  "hidePageHeader": true,
95
95
  "entryFileName": "index.md",
96
- "globalsPageStrategy": "skip",
97
96
  "includeFileNumberPrefixes": true
98
97
  }
99
98
  ```
@@ -106,15 +105,19 @@ Options specific to the plugin should also be declared in the same object.
106
105
 
107
106
  `sidebar.autoConfiguration`
108
107
 
109
- Set to `false` to disable sidebar generation. Defaults to `true`.
108
+ Set to `false` to disable sidebar metadata added to frontmatter. Defaults to `true`.
110
109
 
111
110
  `sidebar.categoryLabel`
112
111
 
113
- The sidebar main parent category label. Defaults to `API`.
112
+ The sidebar main parent category label. Defaults to entry page title.
113
+
114
+ `sidebar.readmeLabel`
115
+
116
+ The label of the readme page. Defaults to the h1 title of the readme page. Ignored if `readme=none`.
114
117
 
115
118
  `sidebar.indexLabel`
116
119
 
117
- The label of the main index page. Please note if `readme=none` this option has no effect because the index page becomes the root page. Defaults to `Index`.
120
+ The label of the index page. Defaults to the index page title.
118
121
 
119
122
  `sidebar.position`
120
123
 
@@ -125,7 +128,7 @@ The position of the sidebar in the tree.
125
128
  The Docusaurus docs folder root. Use `./` if no root folder specified. Defaults to `./docs`.
126
129
 
127
130
  ```shell
128
- --docsRoot <path/to/vitepress-docs/>
131
+ --docsRoot <path/to/docs-dir/>
129
132
  ```
130
133
 
131
134
  ### An example configuration
@@ -143,17 +146,20 @@ module.exports = {
143
146
 
144
147
  // Plugin options
145
148
  out: 'api-xyz',
146
- sidebar: {
147
- categoryLabel: 'API XYZ',
148
- position: 0,
149
- fullNames: true,
150
- },
151
149
  },
152
150
  ],
153
151
  ],
154
152
  };
155
153
  ```
156
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
+
157
163
  ## Frontmatter
158
164
 
159
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.11",
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": [
@@ -15,10 +15,12 @@
15
15
  "directory": "packages/docusaurus-plugin-typedoc"
16
16
  },
17
17
  "homepage": "https://github.com/tgreyuk/typedoc-plugin-markdown/tree/master/packages/docusaurus-plugin-typedoc",
18
- "peerDependencies": {
19
- "typedoc-plugin-markdown": ">=4.0.0-next.13",
18
+ "dependencies": {
20
19
  "typedoc-plugin-frontmatter": ">=0.0.2"
21
20
  },
21
+ "peerDependencies": {
22
+ "typedoc-plugin-markdown": ">=4.0.0-next.14"
23
+ },
22
24
  "scripts": {
23
25
  "lint": "eslint ./src --ext .ts",
24
26
  "prepublishOnly": "npm run lint && npm run build",