|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 | "use strict";
|
|---|
| 2 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
|---|
| 3 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
|---|
| 4 | };
|
|---|
| 5 | Object.defineProperty(exports, "__esModule", { value: true });
|
|---|
| 6 | const os_1 = __importDefault(require("os"));
|
|---|
| 7 | const chalk_1 = __importDefault(require("chalk"));
|
|---|
| 8 | const path_1 = __importDefault(require("path"));
|
|---|
| 9 | const issue_1 = require("../issue");
|
|---|
| 10 | const forwardSlash_1 = __importDefault(require("../utils/path/forwardSlash"));
|
|---|
| 11 | function createWebpackFormatter(formatter) {
|
|---|
| 12 | // mimics webpack error formatter
|
|---|
| 13 | return function webpackFormatter(issue) {
|
|---|
| 14 | const color = issue.severity === 'warning' ? chalk_1.default.yellow.bold : chalk_1.default.red.bold;
|
|---|
| 15 | const severity = issue.severity.toUpperCase();
|
|---|
| 16 | if (issue.file) {
|
|---|
| 17 | let location = forwardSlash_1.default(path_1.default.relative(process.cwd(), issue.file));
|
|---|
| 18 | if (issue.location) {
|
|---|
| 19 | location += `:${issue_1.formatIssueLocation(issue.location)}`;
|
|---|
| 20 | }
|
|---|
| 21 | return [color(`${severity} in ${location}`), formatter(issue), ''].join(os_1.default.EOL);
|
|---|
| 22 | }
|
|---|
| 23 | else {
|
|---|
| 24 | return [color(`${severity} in `) + formatter(issue), ''].join(os_1.default.EOL);
|
|---|
| 25 | }
|
|---|
| 26 | };
|
|---|
| 27 | }
|
|---|
| 28 | exports.createWebpackFormatter = createWebpackFormatter;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.