UNPKG

honkit

Version:

HonKit is building beautiful books using Markdown.

37 lines (36 loc) 1.11 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const plugins_1 = __importDefault(require("../plugins")); const promise_1 = __importDefault(require("../utils/promise")); /** * Load and setup plugins * * @param {Output} * @return {Promise<Output>} */ function preparePlugins(output) { const book = output.getBook(); return ((0, promise_1.default)() // Only load plugins for main book .then(() => { if (book.isLanguageBook()) { return output.getPlugins(); } else { return plugins_1.default.loadForBook(book); } }) // Update book's configuration using the plugins .then((plugins) => { return plugins_1.default.validateConfig(book, plugins).then((newBook) => { return output.merge({ book: newBook, plugins: plugins }); }); })); } exports.default = preparePlugins;