vuepress-plugin-typedoc
Advanced tools
Comparing version 0.12.1 to 0.13.0
import { PluginOptions } from '../shared/types'; | ||
declare const _default: (opts: Partial<PluginOptions>, ctx: any) => { | ||
declare const _default: (opts: Partial<PluginOptions>, ctx: any) => Promise<{ | ||
name: string; | ||
@@ -8,3 +8,3 @@ enhanceAppFiles(): Promise<{ | ||
} | undefined>; | ||
} | undefined; | ||
} | undefined>; | ||
export = _default; |
@@ -34,3 +34,3 @@ "use strict"; | ||
let project; | ||
module.exports = (opts, ctx) => { | ||
module.exports = async (opts, ctx) => { | ||
const typedocOptions = (0, options_1.getTypedocOptions)(opts); | ||
@@ -41,3 +41,3 @@ const outputDirectory = ctx.sourceDir + '/' + typedocOptions.out; | ||
} | ||
app = new typedoc_1.Application(); | ||
app = await typedoc_1.Application.bootstrapWithPlugins(); | ||
(0, typedoc_plugin_markdown_1.load)(app); | ||
@@ -47,4 +47,3 @@ (0, options_1.addOptions)(app); | ||
app.renderer.defineTheme('vuepress', theme_1.VuepressTheme); | ||
app.bootstrap(typedocOptions); | ||
project = app.convert(); | ||
project = await app.convert(); | ||
if (!project) { | ||
@@ -51,0 +50,0 @@ return; |
import { PluginOptions } from '../shared/types'; | ||
export declare const typedocPlugin: (opts: Partial<PluginOptions>) => (ctx: any) => { | ||
name: string; | ||
extendsPageOptions: (pageOptions: any) => void; | ||
} | undefined; | ||
onInitialized: () => Promise<void>; | ||
}; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.typedocPlugin = void 0; | ||
const fs = __importStar(require("fs")); | ||
const path = __importStar(require("path")); | ||
const typedoc_1 = require("typedoc"); | ||
@@ -16,27 +41,26 @@ const typedoc_plugin_markdown_1 = require("typedoc-plugin-markdown"); | ||
const outputDirectory = ctx.dir.source() + '/' + typedocOptions.out; | ||
if (typedocOptions.cleanOutputDir) { | ||
(0, render_1.removeDir)(outputDirectory); | ||
} | ||
app = new typedoc_1.Application(); | ||
(0, typedoc_plugin_markdown_1.load)(app); | ||
(0, options_1.addOptions)(app); | ||
app.renderer.render = render_1.render; | ||
app.renderer.defineTheme('vuepress', theme_1.VuepressTheme); | ||
app.bootstrap(typedocOptions); | ||
project = app.convert(); | ||
if (!project) { | ||
return; | ||
} | ||
if (typedocOptions.watch) { | ||
app.convertAndWatch(async (project) => { | ||
app.generateDocs(project, outputDirectory); | ||
}); | ||
} | ||
else { | ||
app.generateDocs(project, outputDirectory); | ||
} | ||
return { | ||
name: 'vuepress-plugin-typedoc', | ||
extendsPageOptions: (pageOptions) => { | ||
var _a; | ||
onInitialized: async () => { | ||
if (typedocOptions.cleanOutputDir) { | ||
(0, render_1.removeDir)(outputDirectory); | ||
} | ||
app = await typedoc_1.Application.bootstrapWithPlugins(); | ||
(0, typedoc_plugin_markdown_1.load)(app); | ||
(0, options_1.addOptions)(app); | ||
app.renderer.render = render_1.render; | ||
setOptions(app, typedocOptions); | ||
app.renderer.defineTheme('vuepress', theme_1.VuepressTheme); | ||
project = await app.convert(); | ||
if (!project) { | ||
return; | ||
} | ||
if (typedocOptions.watch) { | ||
app.convertAndWatch(async (project) => { | ||
await app.generateDocs(project, outputDirectory); | ||
}); | ||
} | ||
else { | ||
await app.generateDocs(project, outputDirectory); | ||
} | ||
const sidebarOptions = (0, options_1.getSidebarOptions)(opts); | ||
@@ -46,9 +70,8 @@ if (!sidebarOptions.autoConfiguration) { | ||
} | ||
if ((_a = pageOptions.filePath) === null || _a === void 0 ? void 0 : _a.startsWith(outputDirectory)) { | ||
if (sidebarOptions.autoConfiguration) { | ||
const theme = app.renderer.theme; | ||
const navigation = theme.getNavigation(project); | ||
const sidebarPath = path.resolve(outputDirectory, 'typedoc-sidebar.json'); | ||
const sidebarJson = (0, sidebar_1.getSidebarJson)(navigation, sidebarOptions, typedocOptions.out); | ||
pageOptions.frontmatter = { | ||
sidebar: sidebarJson, | ||
}; | ||
fs.writeFileSync(sidebarPath, JSON.stringify(sidebarJson)); | ||
} | ||
@@ -60,1 +83,6 @@ }, | ||
exports.typedocPlugin = typedocPlugin; | ||
function setOptions(app, options, reportErrors = true) { | ||
for (const [key, val] of Object.entries(options)) { | ||
app.options.setValue(key, val); | ||
} | ||
} |
{ | ||
"name": "vuepress-plugin-typedoc", | ||
"version": "0.12.1", | ||
"version": "0.13.0", | ||
"description": "A VuePress plugin to build API documentation with TypeDoc.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/v1/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23509
451
1
2