fork-ts-checker-webpack-plugin 5.0.10 → 5.0.14
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/README.md +14 -7
- package/lib/ForkTsCheckerWebpackPlugin.js +1 -1
- package/lib/eslint-reporter/reporter/EsLintReporter.js +2 -1
- package/lib/formatter/WebpackFormatter.js +1 -1
- package/lib/issue/IssueLocation.js +1 -6
- package/lib/issue/IssueWebpackError.js +1 -1
- package/lib/typescript-reporter/reporter/ControlledWatchSolutionBuilderHost.js +15 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -62,11 +62,14 @@ module.exports = {
|
|
|
62
62
|
};
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
If you are using **TypeScript >= 3.8.0**, it's recommended to
|
|
66
|
-
|
|
65
|
+
If you are using **TypeScript >= 3.8.0**, it's recommended to:
|
|
66
|
+
* for `ts-loader` set `"importsNotUsedAsValues": "preserve"` [compiler option](https://www.typescriptlang.org/docs/handbook/compiler-options.html) in the [`tsconfig.json`](./examples/ts-loader/tsconfig.json)
|
|
67
|
+
* for `babel-loader` set `"onlyRemoveTypeImports": true` [preset option](https://babeljs.io/docs/en/babel-preset-typescript#onlyremovetypeimports) in the [babel configuration](./examples/babel-loader/.babelrc.js)
|
|
67
68
|
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
[Read more](#type-only-modules-watching) about type-only modules watching.
|
|
70
|
+
|
|
71
|
+
> Examples how to configure it with [babel-loader](https://github.com/babel/babel-loader), [ts-loader](https://github.com/TypeStrong/ts-loader),
|
|
72
|
+
> [eslint](https://github.com/eslint/eslint) and [Visual Studio Code](https://code.visualstudio.com/) are in the
|
|
70
73
|
> [**examples**](./examples) directory.
|
|
71
74
|
|
|
72
75
|
## Modules resolution
|
|
@@ -312,10 +315,14 @@ declare module "*.vue" {
|
|
|
312
315
|
|
|
313
316
|
## Type-Only modules watching
|
|
314
317
|
|
|
315
|
-
At present
|
|
316
|
-
|
|
318
|
+
At present `ts-loader` with `transpileOnly` mode and `babel-loader` will not add type-only files (files that contains only interfaces and/or types)
|
|
319
|
+
to the webpack dependencies set. Webpack watches only files that are in the dependencies set. This means that
|
|
320
|
+
changes in type-only files will **not** trigger new compilation and therefore type-checker in watch mode.
|
|
321
|
+
|
|
322
|
+
If you use **TypeScript >=3.8.0**, you can fix it:
|
|
323
|
+
* for `ts-loader` set `"importsNotUsedAsValues": "preserve"` [compiler option](https://www.typescriptlang.org/docs/handbook/compiler-options.html) in the [`tsconfig.json`](./examples/ts-loader/tsconfig.json)
|
|
324
|
+
* for `babel-loader` set `"onlyRemoveTypeImports": true` [preset option](https://babeljs.io/docs/en/babel-preset-typescript#onlyremovetypeimports) in the [babel configuration](./examples/babel-loader/.babelrc.js)
|
|
317
325
|
|
|
318
|
-
If you use **TypeScript >=3.8.0**, you can fix it by passing `"importsNotUsedAsValues": "preserve"` option to the compiler options in the `tsconfig.json`.
|
|
319
326
|
|
|
320
327
|
## Plugin hooks
|
|
321
328
|
|
|
@@ -60,4 +60,4 @@ class ForkTsCheckerWebpackPlugin {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
exports.ForkTsCheckerWebpackPlugin = ForkTsCheckerWebpackPlugin;
|
|
63
|
-
ForkTsCheckerWebpackPlugin.version = '5.0.
|
|
63
|
+
ForkTsCheckerWebpackPlugin.version = '5.0.14'; // will be replaced by the @semantic-release/exec
|
|
@@ -40,7 +40,8 @@ function createEsLintReporter(configuration) {
|
|
|
40
40
|
// we need to take care to not lint files that are not included by the configuration.
|
|
41
41
|
// the eslint engine will not exclude them automatically
|
|
42
42
|
const changedAndIncludedFiles = changedFiles.filter((changedFile) => includedFilesPatterns.some((includedFilesPattern) => minimatch_1.default(changedFile, includedFilesPattern)) &&
|
|
43
|
-
(configuration.options.extensions || []).some((extension) => changedFile.endsWith(extension))
|
|
43
|
+
(configuration.options.extensions || []).some((extension) => changedFile.endsWith(extension)) &&
|
|
44
|
+
!engine.isPathIgnored(changedFile));
|
|
44
45
|
if (changedAndIncludedFiles.length) {
|
|
45
46
|
lintReports.push(engine.executeOnFiles(changedAndIncludedFiles));
|
|
46
47
|
}
|
|
@@ -16,7 +16,7 @@ function createWebpackFormatter(formatter, context) {
|
|
|
16
16
|
if (issue.file) {
|
|
17
17
|
let location = forwardSlash_1.default(path_1.default.relative(context, issue.file));
|
|
18
18
|
if (issue.location) {
|
|
19
|
-
location +=
|
|
19
|
+
location += `:${issue_1.formatIssueLocation(issue.location)}`;
|
|
20
20
|
}
|
|
21
21
|
return [color(`${severity} in ${location}`), formatter(issue), ''].join(os_1.default.EOL);
|
|
22
22
|
}
|
|
@@ -16,11 +16,6 @@ function compareIssueLocations(locationA, locationB) {
|
|
|
16
16
|
}
|
|
17
17
|
exports.compareIssueLocations = compareIssueLocations;
|
|
18
18
|
function formatIssueLocation(location) {
|
|
19
|
-
return
|
|
20
|
-
`${location.start.line}:${location.start.column}`,
|
|
21
|
-
location.start.line !== location.end.line
|
|
22
|
-
? `${location.end.line}:${location.end.column}`
|
|
23
|
-
: `${location.end.column}`,
|
|
24
|
-
].join('-');
|
|
19
|
+
return `${location.start.line}:${location.start.column}`;
|
|
25
20
|
}
|
|
26
21
|
exports.formatIssueLocation = formatIssueLocation;
|
|
@@ -17,7 +17,7 @@ class IssueWebpackError extends Error {
|
|
|
17
17
|
if (issue.file) {
|
|
18
18
|
this.file = forwardSlash_1.default(path_1.relative(context, issue.file));
|
|
19
19
|
if (issue.location) {
|
|
20
|
-
this.file +=
|
|
20
|
+
this.file += `:${IssueLocation_1.formatIssueLocation(issue.location)}`;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
Error.captureStackTrace(this, this.constructor);
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
3
|
+
if (mod && mod.__esModule) return mod;
|
|
4
|
+
var result = {};
|
|
5
|
+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
6
|
+
result["default"] = mod;
|
|
7
|
+
return result;
|
|
8
|
+
};
|
|
2
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
const ts = __importStar(require("typescript"));
|
|
3
11
|
const ControlledWatchCompilerHost_1 = require("./ControlledWatchCompilerHost");
|
|
4
12
|
function createControlledWatchSolutionBuilderHost(parsedCommandLine, system, createProgram, reportDiagnostic, reportWatchStatus, reportSolutionBuilderStatus, afterProgramCreate, afterProgramEmitAndDiagnostics, hostExtensions = []) {
|
|
5
13
|
const controlledWatchCompilerHost = ControlledWatchCompilerHost_1.createControlledWatchCompilerHost(parsedCommandLine, system, createProgram, reportDiagnostic, reportWatchStatus, afterProgramCreate, hostExtensions);
|
|
@@ -32,6 +40,13 @@ function createControlledWatchSolutionBuilderHost(parsedCommandLine, system, cre
|
|
|
32
40
|
},
|
|
33
41
|
deleteFile(fileName) {
|
|
34
42
|
system.deleteFile(fileName);
|
|
43
|
+
},
|
|
44
|
+
getParsedCommandLine(fileName) {
|
|
45
|
+
return ts.getParsedCommandLineOfConfigFile(fileName, { skipLibCheck: true }, Object.assign(Object.assign({}, system), { onUnRecoverableConfigFileDiagnostic: (diagnostic) => {
|
|
46
|
+
if (reportDiagnostic) {
|
|
47
|
+
reportDiagnostic(diagnostic);
|
|
48
|
+
}
|
|
49
|
+
} }));
|
|
35
50
|
} });
|
|
36
51
|
hostExtensions.forEach((hostExtension) => {
|
|
37
52
|
if (hostExtension.extendWatchSolutionBuilderHost) {
|