UNPKG

992 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const tslib_1 = require("tslib");
4const path_1 = tslib_1.__importDefault(require("path"));
5const colorette_1 = tslib_1.__importDefault(require("colorette"));
6/** Convert a path to its output destination. */
7function getOutPath(inDir, fPath, outDir) {
8 return path_1.default.join(outDir, path_1.default.relative(inDir, path_1.default.dirname(fPath)));
9}
10exports.getOutPath = getOutPath;
11/** Format an error in a Typescript style so they match across tools */
12function formatError({ file, line, column, tool, message, code }) {
13 return `${colorette_1.default.cyanBright(path_1.default.relative(process.env.INIT_CWD || process.cwd(), file))}:${colorette_1.default.yellowBright(line)}:${colorette_1.default.yellowBright(column)} - ${colorette_1.default.redBright('error')} ${colorette_1.default.dim(tool)}: ${message.trim()}\n${code.trim()}`;
14}
15exports.formatError = formatError;
16//# sourceMappingURL=utils.js.map
\No newline at end of file