1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
10 | exports.addError = exports.addWarning = exports.createDiagnosticsReporter = void 0;
|
11 | const compiler_cli_1 = require("@angular/compiler-cli");
|
12 | const typescript_1 = require("typescript");
|
13 | function createDiagnosticsReporter(compilation) {
|
14 | return (diagnostics) => {
|
15 | for (const diagnostic of diagnostics) {
|
16 | const text = compiler_cli_1.formatDiagnostics([diagnostic]);
|
17 | if (diagnostic.category === typescript_1.DiagnosticCategory.Error) {
|
18 | addError(compilation, text);
|
19 | }
|
20 | else {
|
21 | addWarning(compilation, text);
|
22 | }
|
23 | }
|
24 | };
|
25 | }
|
26 | exports.createDiagnosticsReporter = createDiagnosticsReporter;
|
27 | function addWarning(compilation, message) {
|
28 | compilation.warnings.push(new compilation.compiler.webpack.WebpackError(message));
|
29 | }
|
30 | exports.addWarning = addWarning;
|
31 | function addError(compilation, message) {
|
32 | compilation.errors.push(new compilation.compiler.webpack.WebpackError(message));
|
33 | }
|
34 | exports.addError = addError;
|