source: frontend/node_modules/fork-ts-checker-webpack-plugin/lib/hooks/tapAfterCompileToGetIssues.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 2.2 KB
RevLine 
[9af201e]1"use strict";
2var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4 return new (P || (P = Promise))(function (resolve, reject) {
5 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8 step((generator = generator.apply(thisArg, _arguments || [])).next());
9 });
10};
11Object.defineProperty(exports, "__esModule", { value: true });
12const pluginHooks_1 = require("./pluginHooks");
13const IssueWebpackError_1 = require("../issue/IssueWebpackError");
14function tapAfterCompileToGetIssues(compiler, configuration, state) {
15 const hooks = pluginHooks_1.getForkTsCheckerWebpackPluginHooks(compiler);
16 compiler.hooks.afterCompile.tapPromise('ForkTsCheckerWebpackPlugin', (compilation) => __awaiter(this, void 0, void 0, function* () {
17 if (compilation.compiler !== compiler) {
18 // run only for the compiler that the plugin was registered for
19 return;
20 }
21 let issues = [];
22 try {
23 issues = yield state.issuesPromise;
24 }
25 catch (error) {
26 hooks.error.call(error, compilation);
27 return;
28 }
29 if (!issues) {
30 // some error has been thrown or it was canceled
31 return;
32 }
33 // filter list of issues by provided issue predicate
34 issues = issues.filter(configuration.issue.predicate);
35 // modify list of issues in the plugin hooks
36 issues = hooks.issues.call(issues, compilation);
37 issues.forEach((issue) => {
38 const error = new IssueWebpackError_1.IssueWebpackError(configuration.formatter(issue), issue);
39 if (issue.severity === 'warning') {
40 compilation.warnings.push(error);
41 }
42 else {
43 compilation.errors.push(error);
44 }
45 });
46 }));
47}
48exports.tapAfterCompileToGetIssues = tapAfterCompileToGetIssues;
Note: See TracBrowser for help on using the repository browser.