fork-ts-checker-webpack-plugin 0.2.9 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/lib/NormalizedMessage.js +12 -4
- package/lib/index.js +19 -22
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/lib/NormalizedMessage.js
CHANGED
|
@@ -12,15 +12,23 @@ var NormalizedMessage = /** @class */ (function () {
|
|
|
12
12
|
// message types
|
|
13
13
|
NormalizedMessage.createFromDiagnostic = function (diagnostic) {
|
|
14
14
|
var ts = require('typescript');
|
|
15
|
-
var
|
|
15
|
+
var file;
|
|
16
|
+
var line;
|
|
17
|
+
var character;
|
|
18
|
+
if (diagnostic.file) {
|
|
19
|
+
file = diagnostic.file.fileName;
|
|
20
|
+
var position = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
|
21
|
+
line = position.line + 1;
|
|
22
|
+
character = position.character + 1;
|
|
23
|
+
}
|
|
16
24
|
return new NormalizedMessage({
|
|
17
25
|
type: NormalizedMessage.TYPE_DIAGNOSTIC,
|
|
18
26
|
code: diagnostic.code,
|
|
19
27
|
severity: ts.DiagnosticCategory[diagnostic.category].toLowerCase(),
|
|
20
28
|
content: ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'),
|
|
21
|
-
file:
|
|
22
|
-
line:
|
|
23
|
-
character:
|
|
29
|
+
file: file,
|
|
30
|
+
line: line,
|
|
31
|
+
character: character
|
|
24
32
|
});
|
|
25
33
|
};
|
|
26
34
|
NormalizedMessage.createFromLint = function (lint) {
|
package/lib/index.js
CHANGED
|
@@ -286,11 +286,10 @@ var ForkTsCheckerWebpackPlugin = /** @class */ (function () {
|
|
|
286
286
|
}
|
|
287
287
|
};
|
|
288
288
|
ForkTsCheckerWebpackPlugin.prototype.createEmitCallback = function (compilation, callback) {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
_this.diagnostics.concat(_this.lints).forEach(function (message) {
|
|
289
|
+
return function emitCallback() {
|
|
290
|
+
var elapsed = Math.round(this.elapsed[0] * 1E9 + this.elapsed[1]);
|
|
291
|
+
this.compiler.applyPlugins('fork-ts-checker-emit', this.diagnostics, this.lints, elapsed);
|
|
292
|
+
this.diagnostics.concat(this.lints).forEach(function (message) {
|
|
294
293
|
// webpack message format
|
|
295
294
|
var formatted = {
|
|
296
295
|
rawMessage: (message.getSeverity().toUpperCase() + ' ' + message.getFormattedCode() + ': ' +
|
|
@@ -311,38 +310,36 @@ var ForkTsCheckerWebpackPlugin = /** @class */ (function () {
|
|
|
311
310
|
});
|
|
312
311
|
callback();
|
|
313
312
|
};
|
|
314
|
-
return emitCallback;
|
|
315
313
|
};
|
|
316
314
|
ForkTsCheckerWebpackPlugin.prototype.createNoopEmitCallback = function () {
|
|
317
315
|
// tslint:disable-next-line:no-empty
|
|
318
316
|
return function noopEmitCallback() { };
|
|
319
317
|
};
|
|
320
318
|
ForkTsCheckerWebpackPlugin.prototype.createDoneCallback = function () {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
var elapsed = Math.round(
|
|
324
|
-
if (
|
|
325
|
-
|
|
319
|
+
return function doneCallback() {
|
|
320
|
+
var _this = this;
|
|
321
|
+
var elapsed = Math.round(this.elapsed[0] * 1E9 + this.elapsed[1]);
|
|
322
|
+
if (this.compiler) {
|
|
323
|
+
this.compiler.applyPlugins('fork-ts-checker-done', this.diagnostics, this.lints, elapsed);
|
|
326
324
|
}
|
|
327
|
-
if (!
|
|
328
|
-
if (
|
|
329
|
-
(
|
|
325
|
+
if (!this.silent && this.logger) {
|
|
326
|
+
if (this.diagnostics.length || this.lints.length) {
|
|
327
|
+
(this.lints || []).concat(this.diagnostics).forEach(function (message) {
|
|
330
328
|
var formattedMessage = _this.formatter(message, _this.useColors);
|
|
331
329
|
message.isWarningSeverity() ? _this.logger.warn(formattedMessage) : _this.logger.error(formattedMessage);
|
|
332
330
|
});
|
|
333
331
|
}
|
|
334
|
-
if (!
|
|
335
|
-
|
|
332
|
+
if (!this.diagnostics.length) {
|
|
333
|
+
this.logger.info(this.colors.green('No type errors found'));
|
|
336
334
|
}
|
|
337
|
-
if (
|
|
338
|
-
|
|
335
|
+
if (this.tslint && !this.lints.length) {
|
|
336
|
+
this.logger.info(this.colors.green('No lint errors found'));
|
|
339
337
|
}
|
|
340
|
-
|
|
341
|
-
(
|
|
342
|
-
|
|
338
|
+
this.logger.info('Version: typescript ' + this.colors.bold(this.typescriptVersion) +
|
|
339
|
+
(this.tslint ? ', tslint ' + this.colors.bold(this.tslintVersion) : ''));
|
|
340
|
+
this.logger.info('Time: ' + this.colors.bold(Math.round(elapsed / 1E6).toString()) + 'ms');
|
|
343
341
|
}
|
|
344
342
|
};
|
|
345
|
-
return doneCallback;
|
|
346
343
|
};
|
|
347
344
|
ForkTsCheckerWebpackPlugin.DEFAULT_MEMORY_LIMIT = 2048;
|
|
348
345
|
ForkTsCheckerWebpackPlugin.ONE_CPU = 1;
|