UNPKG

1.04 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.formatError = exports.getOutPath = void 0;
4const tslib_1 = require("tslib");
5const path_1 = tslib_1.__importDefault(require("path"));
6const colorette_1 = tslib_1.__importDefault(require("colorette"));
7/** Convert a path to its output destination. */
8function getOutPath(inDir, fPath, outDir) {
9 return path_1.default.join(outDir, path_1.default.relative(inDir, path_1.default.dirname(fPath)));
10}
11exports.getOutPath = getOutPath;
12/** Format an error in a Typescript style so they match across tools */
13function formatError({ file, line, column, tool, message, code }) {
14 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()}`;
15}
16exports.formatError = formatError;
17//# sourceMappingURL=utils.js.map
\No newline at end of file