UNPKG

@modyo/cli

Version:

Modyo CLI Command line to expose local development tools

25 lines (24 loc) 900 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const promises_1 = tslib_1.__importDefault(require("node:fs/promises")); const node_path_1 = tslib_1.__importDefault(require("node:path")); const cheerio_1 = tslib_1.__importDefault(require("cheerio")); async function extractRoot(buildDirectory) { const indexPath = node_path_1.default.resolve(buildDirectory, 'index.html'); const buildDirectoryPath = node_path_1.default.resolve(buildDirectory); const indexString = await promises_1.default.readFile(indexPath); const $ = cheerio_1.default.load(indexString, { // withDomLvl1: true, normalizeWhitespace: false, // xmlMode: true, decodeEntities: true, }); return { indexPath, buildDirectoryPath, indexString, $, }; } exports.default = extractRoot;