1 | const utils = require('../utils');
|
2 |
|
3 | const ansiHTML = require('ansi-html');
|
4 |
|
5 | const _require = require('html-entities'),
|
6 | AllHtmlEntities = _require.AllHtmlEntities;
|
7 |
|
8 | const entities = new AllHtmlEntities();
|
9 | const colors = {
|
10 | reset: ['transparent', 'transparent'],
|
11 | black: '181818',
|
12 | red: 'E36049',
|
13 | green: 'B3CB74',
|
14 | yellow: 'FFD080',
|
15 | blue: '7CAFC2',
|
16 | magenta: '7FACCA',
|
17 | cyan: 'C3C2EF',
|
18 | lightgrey: 'EBE7E3',
|
19 | darkgrey: '6D7891'
|
20 | };
|
21 | ansiHTML.setColors(colors);
|
22 |
|
23 | const toHtml = (log) => {
|
24 | let tempHtml = "<span style=\"color: #".concat(colors.red, "\">Failed to compile.</span><br/><br/>");
|
25 | utils.each(typeof log == 'object' ? log : [log], (index, item) => {
|
26 | tempHtml = tempHtml.concat(ansiHTML(entities.encode(item)))
|
27 | });
|
28 | tempHtml = tempHtml.replace(new RegExp("BabelLoaderError: SyntaxError((?:.|\\n)*?)</span>\\n\\n"), "");
|
29 | return tempHtml;
|
30 | };
|
31 |
|
32 | module.exports = {
|
33 | toHtml,
|
34 | }; |
\ | No newline at end of file |