UNPKG

honkit

Version:

HonKit is building beautiful books using Markdown.

37 lines (35 loc) 1.29 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const timing_1 = __importDefault(require("../utils/timing")); /** List all assets in a book Assets are file not ignored and not a page @param {Book} book @param {List<String>} pages @param */ function listAssets(book, pages) { const fs = book.getContentFS(); const summary = book.getSummary(); const summaryFile = summary.getFile().getPath(); const glossary = book.getGlossary(); const glossaryFile = glossary.getFile().getPath(); const langs = book.getLanguages(); const langsFile = langs.getFile().getPath(); const config = book.getConfig(); const configFile = config.getFile().getPath(); function filterFile(rawFile) { const file = rawFile.replace(/\\/g, "/"); return !(file === summaryFile || file === glossaryFile || file === langsFile || file === configFile || book.isContentFileIgnored(file) || pages.has(file)); } return timing_1.default.measure("parse.listAssets", fs.listAllFiles(".", filterFile)); } exports.default = listAssets;