mirror of https://github.com/ghostfolio/ghostfolio
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
1.3 KiB
28 lines
1.3 KiB
"use strict";
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.createWebpackFormatter = void 0;
|
|
const os_1 = __importDefault(require("os"));
|
|
const chalk_1 = __importDefault(require("chalk"));
|
|
const issue_1 = require("../issue");
|
|
const relative_to_context_1 = require("../utils/path/relative-to-context");
|
|
function createWebpackFormatter(formatter) {
|
|
// mimics webpack error formatter
|
|
return function webpackFormatter(issue) {
|
|
const color = issue.severity === 'warning' ? chalk_1.default.yellow.bold : chalk_1.default.red.bold;
|
|
const severity = issue.severity.toUpperCase();
|
|
if (issue.file) {
|
|
let location = chalk_1.default.bold((0, relative_to_context_1.relativeToContext)(issue.file, process.cwd()));
|
|
if (issue.location) {
|
|
location += `:${chalk_1.default.green.bold((0, issue_1.formatIssueLocation)(issue.location))}`;
|
|
}
|
|
return [`${color(severity)} in ${location}`, formatter(issue), ''].join(os_1.default.EOL);
|
|
}
|
|
else {
|
|
return [`${color(severity)} in ` + formatter(issue), ''].join(os_1.default.EOL);
|
|
}
|
|
};
|
|
}
|
|
exports.createWebpackFormatter = createWebpackFormatter;
|
|
|