docusaurus-plugin-typedoc 0.17.2 → 0.17.3

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
@@ -1,38 +1,39 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPluginOptions = void 0;
4
- const DEFAULT_PLUGIN_OPTIONS = {
5
- id: 'default',
6
- docsRoot: 'docs',
7
- out: 'api',
8
- cleanOutputDir: true,
9
- sidebar: {
10
- fullNames: false,
11
- categoryLabel: 'API',
12
- indexLabel: undefined,
13
- readmeLabel: 'Readme',
14
- position: null,
15
- },
16
- hideInPageTOC: true,
17
- hideBreadcrumbs: true,
18
- hidePageTitle: true,
19
- entryDocument: 'index.md',
20
- plugin: ['none'],
21
- watch: false,
22
- includeExtension: true,
23
- indexSlug: undefined,
24
- theme: 'docusaurus',
25
- frontmatter: undefined,
26
- };
27
- const getPluginOptions = (opts) => {
28
- const options = {
29
- ...DEFAULT_PLUGIN_OPTIONS,
30
- ...opts,
31
- sidebar: {
32
- ...DEFAULT_PLUGIN_OPTIONS.sidebar,
33
- ...opts.sidebar,
34
- },
35
- };
36
- return options;
37
- };
38
- exports.getPluginOptions = getPluginOptions;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPluginOptions = void 0;
4
+ const DEFAULT_PLUGIN_OPTIONS = {
5
+ id: 'default',
6
+ docsRoot: 'docs',
7
+ out: 'api',
8
+ cleanOutputDir: true,
9
+ sidebar: {
10
+ fullNames: false,
11
+ categoryLabel: 'API',
12
+ indexLabel: undefined,
13
+ readmeLabel: 'Readme',
14
+ position: null,
15
+ },
16
+ hideInPageTOC: true,
17
+ hideBreadcrumbs: true,
18
+ hidePageTitle: true,
19
+ hideMembersSymbol: false,
20
+ entryDocument: 'index.md',
21
+ plugin: ['none'],
22
+ watch: false,
23
+ includeExtension: true,
24
+ indexSlug: undefined,
25
+ theme: 'docusaurus',
26
+ frontmatter: undefined,
27
+ };
28
+ const getPluginOptions = (opts) => {
29
+ const options = {
30
+ ...DEFAULT_PLUGIN_OPTIONS,
31
+ ...opts,
32
+ sidebar: {
33
+ ...DEFAULT_PLUGIN_OPTIONS.sidebar,
34
+ ...opts.sidebar,
35
+ },
36
+ };
37
+ return options;
38
+ };
39
+ exports.getPluginOptions = getPluginOptions;
package/dist/plugin.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { PluginOptions } from './types';
2
- export default function pluginDocusaurus(context: any, opts: Partial<PluginOptions>): {
3
- name: string;
4
- loadContent(): Promise<void>;
5
- };
1
+ import { PluginOptions } from './types';
2
+ export default function pluginDocusaurus(context: any, opts: Partial<PluginOptions>): {
3
+ name: string;
4
+ loadContent(): Promise<void>;
5
+ };
package/dist/plugin.js CHANGED
@@ -1,65 +1,65 @@
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_markdown_1 = require("typedoc-plugin-markdown");
29
- const options_1 = require("./options");
30
- const render_1 = require("./render");
31
- const theme_1 = require("./theme");
32
- const apps = [];
33
- function pluginDocusaurus(context, opts) {
34
- return {
35
- name: 'docusaurus-plugin-typedoc',
36
- async loadContent() {
37
- if (opts.id && !apps.includes(opts.id)) {
38
- apps.push(opts.id);
39
- const { siteDir } = context;
40
- const options = (0, options_1.getPluginOptions)(opts);
41
- const outputDir = path.resolve(siteDir, options.docsRoot, options.out);
42
- if (opts.cleanOutputDir) {
43
- (0, render_1.removeDir)(outputDir);
44
- }
45
- const app = new typedoc_1.Application();
46
- app.renderer.defineTheme('docusaurus', theme_1.DocusaurusTheme);
47
- (0, typedoc_plugin_markdown_1.load)(app);
48
- (0, render_1.bootstrap)(app, options);
49
- const project = app.convert();
50
- if (!project) {
51
- return;
52
- }
53
- if (options.watch) {
54
- app.convertAndWatch(async (project) => {
55
- await app.generateDocs(project, outputDir);
56
- });
57
- }
58
- else {
59
- await app.generateDocs(project, outputDir);
60
- }
61
- }
62
- },
63
- };
64
- }
65
- exports.default = pluginDocusaurus;
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_markdown_1 = require("typedoc-plugin-markdown");
29
+ const options_1 = require("./options");
30
+ const render_1 = require("./render");
31
+ const theme_1 = require("./theme");
32
+ const apps = [];
33
+ function pluginDocusaurus(context, opts) {
34
+ return {
35
+ name: 'docusaurus-plugin-typedoc',
36
+ async loadContent() {
37
+ if (opts.id && !apps.includes(opts.id)) {
38
+ apps.push(opts.id);
39
+ const { siteDir } = context;
40
+ const options = (0, options_1.getPluginOptions)(opts);
41
+ const outputDir = path.resolve(siteDir, options.docsRoot, options.out);
42
+ if (opts.cleanOutputDir) {
43
+ (0, render_1.removeDir)(outputDir);
44
+ }
45
+ const app = new typedoc_1.Application();
46
+ app.renderer.defineTheme('docusaurus', theme_1.DocusaurusTheme);
47
+ (0, typedoc_plugin_markdown_1.load)(app);
48
+ (0, render_1.bootstrap)(app, options);
49
+ const project = app.convert();
50
+ if (!project) {
51
+ return;
52
+ }
53
+ if (options.watch) {
54
+ app.convertAndWatch(async (project) => {
55
+ await app.generateDocs(project, outputDir);
56
+ });
57
+ }
58
+ else {
59
+ await app.generateDocs(project, outputDir);
60
+ }
61
+ }
62
+ },
63
+ };
64
+ }
65
+ exports.default = pluginDocusaurus;
package/dist/render.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Application, ProjectReflection } from 'typedoc';
2
- import { PluginOptions } from './types';
3
- export declare const bootstrap: (app: Application, options: PluginOptions) => void;
4
- export declare function render(project: ProjectReflection, outputDirectory: string): Promise<void>;
5
- export declare function removeDir(path: string): void;
1
+ import { Application, ProjectReflection } from 'typedoc';
2
+ import { PluginOptions } from './types';
3
+ export declare const bootstrap: (app: Application, options: PluginOptions) => void;
4
+ export declare function render(project: ProjectReflection, outputDirectory: string): Promise<void>;
5
+ export declare function removeDir(path: string): void;
package/dist/render.js CHANGED
@@ -1,106 +1,106 @@
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
- exports.removeDir = exports.render = exports.bootstrap = void 0;
27
- const fs = __importStar(require("fs"));
28
- const typedoc_1 = require("typedoc");
29
- const bootstrap = (app, options) => {
30
- addTypedocReaders(app);
31
- addTypedocDeclarations(app);
32
- app.renderer.render = render;
33
- app.bootstrap(options);
34
- };
35
- exports.bootstrap = bootstrap;
36
- async function render(project, outputDirectory) {
37
- var _a;
38
- if (!this.prepareTheme()) {
39
- return;
40
- }
41
- const output = new typedoc_1.RendererEvent(typedoc_1.RendererEvent.BEGIN, outputDirectory, project);
42
- output.urls = this.theme.getUrls(project);
43
- this.trigger(output);
44
- if (!output.isDefaultPrevented) {
45
- (_a = output === null || output === void 0 ? void 0 : output.urls) === null || _a === void 0 ? void 0 : _a.forEach((mapping) => {
46
- this.renderDocument(output.createPageEvent(mapping));
47
- });
48
- this.trigger(typedoc_1.RendererEvent.END, output);
49
- }
50
- }
51
- 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
- const addTypedocDeclarations = (app) => {
57
- app.options.addDeclaration({
58
- name: 'id',
59
- });
60
- app.options.addDeclaration({
61
- name: 'docsRoot',
62
- });
63
- app.options.addDeclaration({
64
- name: 'siteDir',
65
- });
66
- app.options.addDeclaration({
67
- name: 'globalsTitle',
68
- });
69
- app.options.addDeclaration({
70
- name: 'readmeTitle',
71
- });
72
- app.options.addDeclaration({
73
- name: 'indexSlug',
74
- });
75
- app.options.addDeclaration({
76
- name: 'includeExtension',
77
- });
78
- app.options.addDeclaration({
79
- name: 'sidebar',
80
- type: typedoc_1.ParameterType.Mixed,
81
- });
82
- app.options.addDeclaration({
83
- name: 'frontmatter',
84
- type: typedoc_1.ParameterType.Mixed,
85
- });
86
- };
87
- function removeDir(path) {
88
- if (fs.existsSync(path)) {
89
- const files = fs.readdirSync(path);
90
- if (files.length > 0) {
91
- files.forEach(function (filename) {
92
- if (fs.statSync(path + '/' + filename).isDirectory()) {
93
- removeDir(path + '/' + filename);
94
- }
95
- else {
96
- fs.unlinkSync(path + '/' + filename);
97
- }
98
- });
99
- fs.rmdirSync(path);
100
- }
101
- else {
102
- fs.rmdirSync(path);
103
- }
104
- }
105
- }
106
- exports.removeDir = removeDir;
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
+ exports.removeDir = exports.render = exports.bootstrap = void 0;
27
+ const fs = __importStar(require("fs"));
28
+ const typedoc_1 = require("typedoc");
29
+ const bootstrap = (app, options) => {
30
+ addTypedocReaders(app);
31
+ addTypedocDeclarations(app);
32
+ app.renderer.render = render;
33
+ app.bootstrap(options);
34
+ };
35
+ exports.bootstrap = bootstrap;
36
+ async function render(project, outputDirectory) {
37
+ var _a;
38
+ if (!this.prepareTheme()) {
39
+ return;
40
+ }
41
+ const output = new typedoc_1.RendererEvent(typedoc_1.RendererEvent.BEGIN, outputDirectory, project);
42
+ output.urls = this.theme.getUrls(project);
43
+ this.trigger(output);
44
+ if (!output.isDefaultPrevented) {
45
+ (_a = output === null || output === void 0 ? void 0 : output.urls) === null || _a === void 0 ? void 0 : _a.forEach((mapping) => {
46
+ this.renderDocument(output.createPageEvent(mapping));
47
+ });
48
+ this.trigger(typedoc_1.RendererEvent.END, output);
49
+ }
50
+ }
51
+ 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
+ const addTypedocDeclarations = (app) => {
57
+ app.options.addDeclaration({
58
+ name: 'id',
59
+ });
60
+ app.options.addDeclaration({
61
+ name: 'docsRoot',
62
+ });
63
+ app.options.addDeclaration({
64
+ name: 'siteDir',
65
+ });
66
+ app.options.addDeclaration({
67
+ name: 'globalsTitle',
68
+ });
69
+ app.options.addDeclaration({
70
+ name: 'readmeTitle',
71
+ });
72
+ app.options.addDeclaration({
73
+ name: 'indexSlug',
74
+ });
75
+ app.options.addDeclaration({
76
+ name: 'includeExtension',
77
+ });
78
+ app.options.addDeclaration({
79
+ name: 'sidebar',
80
+ type: typedoc_1.ParameterType.Mixed,
81
+ });
82
+ app.options.addDeclaration({
83
+ name: 'frontmatter',
84
+ type: typedoc_1.ParameterType.Mixed,
85
+ });
86
+ };
87
+ function removeDir(path) {
88
+ if (fs.existsSync(path)) {
89
+ const files = fs.readdirSync(path);
90
+ if (files.length > 0) {
91
+ files.forEach(function (filename) {
92
+ if (fs.statSync(path + '/' + filename).isDirectory()) {
93
+ removeDir(path + '/' + filename);
94
+ }
95
+ else {
96
+ fs.unlinkSync(path + '/' + filename);
97
+ }
98
+ });
99
+ fs.rmdirSync(path);
100
+ }
101
+ else {
102
+ fs.rmdirSync(path);
103
+ }
104
+ }
105
+ }
106
+ exports.removeDir = removeDir;
package/dist/theme.d.ts CHANGED
@@ -1,27 +1,27 @@
1
- import { DeclarationReflection, PageEvent, ReflectionKind, Renderer, RendererEvent } from 'typedoc';
2
- import { MarkdownTheme } from 'typedoc-plugin-markdown/dist/theme';
3
- import { FrontMatter, SidebarOptions } from './types';
4
- export declare class DocusaurusTheme extends MarkdownTheme {
5
- sidebar: SidebarOptions;
6
- readmeTitle: string;
7
- indexSlug: string;
8
- includeExtension: string;
9
- frontmatter: FrontMatter;
10
- constructor(renderer: Renderer);
11
- getRelativeUrl(url: string): string;
12
- onPageEnd(page: PageEvent<DeclarationReflection>): void;
13
- onRendererEnd(renderer: RendererEvent): void;
14
- getYamlItems(page: PageEvent<DeclarationReflection>): FrontMatter;
15
- getSidebarLabel(page: PageEvent<DeclarationReflection>): string | undefined;
16
- getSidebarPosition(page: PageEvent<DeclarationReflection>): "0.5" | "0" | null;
17
- getId(page: PageEvent): string;
18
- getTitle(page: PageEvent): any;
19
- getSlug(): string;
20
- get mappings(): {
21
- kind: ReflectionKind[];
22
- isLeaf: boolean;
23
- directory: string;
24
- template: (pageEvent: PageEvent<import("typedoc").ContainerReflection>) => string;
25
- }[];
26
- get globalsFile(): string;
27
- }
1
+ import { DeclarationReflection, PageEvent, ReflectionKind, Renderer, RendererEvent } from 'typedoc';
2
+ import { MarkdownTheme } from 'typedoc-plugin-markdown/dist/theme';
3
+ import { FrontMatter, SidebarOptions } from './types';
4
+ export declare class DocusaurusTheme extends MarkdownTheme {
5
+ sidebar: SidebarOptions;
6
+ readmeTitle: string;
7
+ indexSlug: string;
8
+ includeExtension: string;
9
+ frontmatter: FrontMatter;
10
+ constructor(renderer: Renderer);
11
+ getRelativeUrl(url: string): string;
12
+ onPageEnd(page: PageEvent<DeclarationReflection>): void;
13
+ onRendererEnd(renderer: RendererEvent): void;
14
+ getYamlItems(page: PageEvent<DeclarationReflection>): FrontMatter;
15
+ getSidebarLabel(page: PageEvent<DeclarationReflection>): string | undefined;
16
+ getSidebarPosition(page: PageEvent<DeclarationReflection>): "0.5" | "0" | null;
17
+ getId(page: PageEvent): string;
18
+ getTitle(page: PageEvent): any;
19
+ getSlug(): string;
20
+ get mappings(): {
21
+ kind: ReflectionKind[];
22
+ isLeaf: boolean;
23
+ directory: string;
24
+ template: (pageEvent: PageEvent<import("typedoc").ContainerReflection>) => string;
25
+ }[];
26
+ get globalsFile(): string;
27
+ }