fork-ts-checker-webpack-plugin 6.0.1 → 6.0.5
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/lib/ForkTsCheckerWebpackPlugin.js +1 -1
- package/lib/hooks/tapAfterCompileToAddDependencies.js +0 -3
- package/lib/hooks/tapAfterCompileToGetIssues.js +1 -1
- package/lib/hooks/tapAfterEnvironmentToPatchWatching.js +1 -1
- package/lib/hooks/tapDoneToAsyncGetIssues.js +1 -1
- package/lib/hooks/tapStartToConnectAndRunReporter.js +2 -6
- package/lib/issue/IssueWebpackError.d.ts +1 -1
- package/lib/issue/IssueWebpackError.js +2 -2
- package/lib/reporter/FilesChange.d.ts +5 -1
- package/lib/reporter/FilesChange.js +13 -0
- package/lib/watch/InclusiveNodeWatchFileSystem.d.ts +5 -5
- package/lib/watch/InclusiveNodeWatchFileSystem.js +27 -30
- package/package.json +1 -1
- package/lib/hooks/getChangedFiles.d.ts +0 -3
- package/lib/hooks/getChangedFiles.js +0 -14
- package/lib/hooks/getDeletedFiles.d.ts +0 -3
- package/lib/hooks/getDeletedFiles.js +0 -14
- package/lib/hooks/getWatcher.d.ts +0 -8
- package/lib/hooks/getWatcher.js +0 -11
|
@@ -60,4 +60,4 @@ class ForkTsCheckerWebpackPlugin {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
exports.ForkTsCheckerWebpackPlugin = ForkTsCheckerWebpackPlugin;
|
|
63
|
-
ForkTsCheckerWebpackPlugin.version = '6.0.
|
|
63
|
+
ForkTsCheckerWebpackPlugin.version = '6.0.5'; // will be replaced by the @semantic-release/exec
|
|
@@ -21,9 +21,6 @@ function tapAfterCompileToAddDependencies(compiler, configuration, state) {
|
|
|
21
21
|
dependencies.files.forEach((file) => {
|
|
22
22
|
compilation.fileDependencies.add(file);
|
|
23
23
|
});
|
|
24
|
-
dependencies.dirs.forEach((dir) => {
|
|
25
|
-
compilation.contextDependencies.add(dir);
|
|
26
|
-
});
|
|
27
24
|
}
|
|
28
25
|
}));
|
|
29
26
|
}
|
|
@@ -35,7 +35,7 @@ function tapAfterCompileToGetIssues(compiler, configuration, state) {
|
|
|
35
35
|
// modify list of issues in the plugin hooks
|
|
36
36
|
issues = hooks.issues.call(issues, compilation);
|
|
37
37
|
issues.forEach((issue) => {
|
|
38
|
-
const error = new IssueWebpackError_1.IssueWebpackError(configuration.formatter(issue),
|
|
38
|
+
const error = new IssueWebpackError_1.IssueWebpackError(configuration.formatter(issue), issue);
|
|
39
39
|
if (issue.severity === 'warning') {
|
|
40
40
|
compilation.warnings.push(error);
|
|
41
41
|
}
|
|
@@ -6,7 +6,7 @@ function tapAfterEnvironmentToPatchWatching(compiler, state) {
|
|
|
6
6
|
const watchFileSystem = compiler.watchFileSystem;
|
|
7
7
|
if (watchFileSystem) {
|
|
8
8
|
// wrap original watch file system
|
|
9
|
-
compiler.watchFileSystem = new InclusiveNodeWatchFileSystem_1.InclusiveNodeWatchFileSystem(watchFileSystem, state);
|
|
9
|
+
compiler.watchFileSystem = new InclusiveNodeWatchFileSystem_1.InclusiveNodeWatchFileSystem(watchFileSystem, compiler, state);
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
}
|
|
@@ -65,7 +65,7 @@ function tapDoneToAsyncGetIssues(compiler, configuration, state) {
|
|
|
65
65
|
}
|
|
66
66
|
if (state.webpackDevServerDoneTap) {
|
|
67
67
|
issues.forEach((issue) => {
|
|
68
|
-
const error = new IssueWebpackError_1.IssueWebpackError(configuration.formatter(issue),
|
|
68
|
+
const error = new IssueWebpackError_1.IssueWebpackError(configuration.formatter(issue), issue);
|
|
69
69
|
if (issue.severity === 'warning') {
|
|
70
70
|
stats.compilation.warnings.push(error);
|
|
71
71
|
}
|
|
@@ -10,8 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const pluginHooks_1 = require("./pluginHooks");
|
|
13
|
-
const
|
|
14
|
-
const getChangedFiles_1 = require("./getChangedFiles");
|
|
13
|
+
const reporter_1 = require("../reporter");
|
|
15
14
|
const OperationCanceledError_1 = require("../error/OperationCanceledError");
|
|
16
15
|
const tapDoneToAsyncGetIssues_1 = require("./tapDoneToAsyncGetIssues");
|
|
17
16
|
const tapAfterCompileToGetIssues_1 = require("./tapAfterCompileToGetIssues");
|
|
@@ -45,10 +44,7 @@ function tapStartToConnectAndRunReporter(compiler, reporter, configuration, stat
|
|
|
45
44
|
}
|
|
46
45
|
let change = {};
|
|
47
46
|
if (state.watching) {
|
|
48
|
-
change =
|
|
49
|
-
changedFiles: getChangedFiles_1.getChangedFiles(compilation.compiler),
|
|
50
|
-
deletedFiles: getDeletedFiles_1.getDeletedFiles(compilation.compiler),
|
|
51
|
-
};
|
|
47
|
+
change = reporter_1.getFilesChange(compiler);
|
|
52
48
|
configuration.logger.infrastructure.info([
|
|
53
49
|
'Calling reporter service for incremental check.',
|
|
54
50
|
` Changed files: ${JSON.stringify(change.changedFiles)}`,
|
|
@@ -3,6 +3,6 @@ declare class IssueWebpackError extends Error {
|
|
|
3
3
|
readonly issue: Issue;
|
|
4
4
|
readonly hideStack = true;
|
|
5
5
|
readonly file: string | undefined;
|
|
6
|
-
constructor(message: string,
|
|
6
|
+
constructor(message: string, issue: Issue);
|
|
7
7
|
}
|
|
8
8
|
export { IssueWebpackError };
|
|
@@ -7,7 +7,7 @@ const path_1 = require("path");
|
|
|
7
7
|
const IssueLocation_1 = require("./IssueLocation");
|
|
8
8
|
const forwardSlash_1 = __importDefault(require("../utils/path/forwardSlash"));
|
|
9
9
|
class IssueWebpackError extends Error {
|
|
10
|
-
constructor(message,
|
|
10
|
+
constructor(message, issue) {
|
|
11
11
|
super(message);
|
|
12
12
|
this.issue = issue;
|
|
13
13
|
this.hideStack = true;
|
|
@@ -15,7 +15,7 @@ class IssueWebpackError extends Error {
|
|
|
15
15
|
// should be a NormalModule instance.
|
|
16
16
|
// to avoid such a dependency, we do a workaround - error.file will contain formatted location instead
|
|
17
17
|
if (issue.file) {
|
|
18
|
-
this.file = forwardSlash_1.default(path_1.relative(
|
|
18
|
+
this.file = forwardSlash_1.default(path_1.relative(process.cwd(), issue.file));
|
|
19
19
|
if (issue.location) {
|
|
20
20
|
this.file += `:${IssueLocation_1.formatIssueLocation(issue.location)}`;
|
|
21
21
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import { Compiler } from 'webpack';
|
|
1
2
|
interface FilesChange {
|
|
2
3
|
changedFiles?: string[];
|
|
3
4
|
deletedFiles?: string[];
|
|
4
5
|
}
|
|
6
|
+
declare function getFilesChange(compiler: Compiler): FilesChange;
|
|
7
|
+
declare function updateFilesChange(compiler: Compiler, change: FilesChange): void;
|
|
8
|
+
declare function clearFilesChange(compiler: Compiler): void;
|
|
5
9
|
/**
|
|
6
10
|
* Computes aggregated files change based on the subsequent files changes.
|
|
7
11
|
*
|
|
@@ -9,4 +13,4 @@ interface FilesChange {
|
|
|
9
13
|
* @returns Files change that represents all subsequent changes as a one event
|
|
10
14
|
*/
|
|
11
15
|
declare function aggregateFilesChanges(changes: FilesChange[]): FilesChange;
|
|
12
|
-
export { FilesChange, aggregateFilesChanges };
|
|
16
|
+
export { FilesChange, getFilesChange, updateFilesChange, clearFilesChange, aggregateFilesChanges };
|
|
@@ -5,6 +5,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const substract_1 = __importDefault(require("../utils/array/substract"));
|
|
7
7
|
const unique_1 = __importDefault(require("../utils/array/unique"));
|
|
8
|
+
const compilerFilesChangeMap = new WeakMap();
|
|
9
|
+
function getFilesChange(compiler) {
|
|
10
|
+
return compilerFilesChangeMap.get(compiler) || {};
|
|
11
|
+
}
|
|
12
|
+
exports.getFilesChange = getFilesChange;
|
|
13
|
+
function updateFilesChange(compiler, change) {
|
|
14
|
+
compilerFilesChangeMap.set(compiler, aggregateFilesChanges([getFilesChange(compiler), change]));
|
|
15
|
+
}
|
|
16
|
+
exports.updateFilesChange = updateFilesChange;
|
|
17
|
+
function clearFilesChange(compiler) {
|
|
18
|
+
compilerFilesChangeMap.delete(compiler);
|
|
19
|
+
}
|
|
20
|
+
exports.clearFilesChange = clearFilesChange;
|
|
8
21
|
/**
|
|
9
22
|
* Computes aggregated files change based on the subsequent files changes.
|
|
10
23
|
*
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ForkTsCheckerWebpackPluginState } from '../ForkTsCheckerWebpackPluginState';
|
|
2
|
+
import { FSWatcher } from 'chokidar';
|
|
2
3
|
import { Watcher, WatchFileSystem, WatchFileSystemOptions } from './WatchFileSystem';
|
|
4
|
+
import { Compiler } from 'webpack';
|
|
3
5
|
declare class InclusiveNodeWatchFileSystem implements WatchFileSystem {
|
|
4
6
|
private watchFileSystem;
|
|
7
|
+
private compiler;
|
|
5
8
|
private pluginState;
|
|
6
9
|
get watcher(): import("./WatchFileSystem").Watchpack;
|
|
7
|
-
readonly
|
|
8
|
-
|
|
9
|
-
constructor(watchFileSystem: WatchFileSystem, pluginState: ForkTsCheckerWebpackPluginState);
|
|
10
|
+
readonly dirsWatchers: Map<string, FSWatcher | undefined>;
|
|
11
|
+
constructor(watchFileSystem: WatchFileSystem, compiler: Compiler, pluginState: ForkTsCheckerWebpackPluginState);
|
|
10
12
|
private paused;
|
|
11
|
-
private fileWatcher;
|
|
12
|
-
private dirsWatchers;
|
|
13
13
|
watch(files: Iterable<string>, dirs: Iterable<string>, missing: Iterable<string>, startTime?: number, options?: Partial<WatchFileSystemOptions>, callback?: Function, callbackUndelayed?: Function): Watcher;
|
|
14
14
|
}
|
|
15
15
|
export { InclusiveNodeWatchFileSystem };
|
|
@@ -5,13 +5,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const chokidar_1 = __importDefault(require("chokidar"));
|
|
7
7
|
const path_1 = require("path");
|
|
8
|
+
const reporter_1 = require("../reporter");
|
|
9
|
+
const IGNORED_DIRS = ['node_modules', '.git', '.yarn', '.pnp'];
|
|
10
|
+
function isIgnored(path) {
|
|
11
|
+
return IGNORED_DIRS.some((ignoredDir) => path.includes(`/${ignoredDir}/`));
|
|
12
|
+
}
|
|
8
13
|
class InclusiveNodeWatchFileSystem {
|
|
9
|
-
constructor(watchFileSystem, pluginState) {
|
|
14
|
+
constructor(watchFileSystem, compiler, pluginState) {
|
|
10
15
|
this.watchFileSystem = watchFileSystem;
|
|
16
|
+
this.compiler = compiler;
|
|
11
17
|
this.pluginState = pluginState;
|
|
12
18
|
this.paused = true;
|
|
13
|
-
this.changedFiles = new Set();
|
|
14
|
-
this.removedFiles = new Set();
|
|
15
19
|
this.dirsWatchers = new Map();
|
|
16
20
|
}
|
|
17
21
|
get watcher() {
|
|
@@ -19,28 +23,25 @@ class InclusiveNodeWatchFileSystem {
|
|
|
19
23
|
return this.watchFileSystem.watcher || ((_a = this.watchFileSystem.wfs) === null || _a === void 0 ? void 0 : _a.watcher);
|
|
20
24
|
}
|
|
21
25
|
watch(files, dirs, missing, startTime, options, callback, callbackUndelayed) {
|
|
22
|
-
var _a, _b;
|
|
23
|
-
this.
|
|
24
|
-
this.removedFiles.clear();
|
|
25
|
-
// cleanup old standard watchers
|
|
26
|
-
if (this.fileWatcher) {
|
|
27
|
-
this.fileWatcher.close();
|
|
28
|
-
}
|
|
26
|
+
var _a, _b, _c;
|
|
27
|
+
reporter_1.clearFilesChange(this.compiler);
|
|
29
28
|
// use standard watch file system for files and missing
|
|
30
|
-
|
|
29
|
+
const standardWatcher = this.watchFileSystem.watch(files, dirs, missing, startTime, options, callback, callbackUndelayed);
|
|
31
30
|
(_a = this.watcher) === null || _a === void 0 ? void 0 : _a.on('change', (file) => {
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
if (typeof file === 'string' && !isIgnored(file)) {
|
|
32
|
+
reporter_1.updateFilesChange(this.compiler, { changedFiles: [file] });
|
|
33
|
+
}
|
|
34
34
|
});
|
|
35
35
|
(_b = this.watcher) === null || _b === void 0 ? void 0 : _b.on('remove', (file) => {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
if (typeof file === 'string' && !isIgnored(file)) {
|
|
37
|
+
reporter_1.updateFilesChange(this.compiler, { deletedFiles: [file] });
|
|
38
|
+
}
|
|
38
39
|
});
|
|
39
40
|
// calculate what to change
|
|
40
41
|
const prevDirs = Array.from(this.dirsWatchers.keys());
|
|
41
|
-
const nextDirs = Array.from(dirs);
|
|
42
|
+
const nextDirs = Array.from(((_c = this.pluginState.lastDependencies) === null || _c === void 0 ? void 0 : _c.dirs) || []);
|
|
42
43
|
const dirsToUnwatch = prevDirs.filter((prevDir) => !nextDirs.includes(prevDir));
|
|
43
|
-
const dirsToWatch = nextDirs.filter((nextDir) => !prevDirs.includes(nextDir));
|
|
44
|
+
const dirsToWatch = nextDirs.filter((nextDir) => !prevDirs.includes(nextDir) && !isIgnored(nextDir));
|
|
44
45
|
// update dirs watcher
|
|
45
46
|
dirsToUnwatch.forEach((dirToUnwatch) => {
|
|
46
47
|
var _a;
|
|
@@ -52,7 +53,7 @@ class InclusiveNodeWatchFileSystem {
|
|
|
52
53
|
const dirWatcher = chokidar_1.default.watch(dirToWatch, {
|
|
53
54
|
ignoreInitial: true,
|
|
54
55
|
ignorePermissionErrors: true,
|
|
55
|
-
ignored:
|
|
56
|
+
ignored: (path) => isIgnored(path),
|
|
56
57
|
usePolling: (options === null || options === void 0 ? void 0 : options.poll) ? true : undefined,
|
|
57
58
|
interval: interval,
|
|
58
59
|
binaryInterval: interval,
|
|
@@ -70,8 +71,7 @@ class InclusiveNodeWatchFileSystem {
|
|
|
70
71
|
if (!supportedExtensions.includes(extension)) {
|
|
71
72
|
return;
|
|
72
73
|
}
|
|
73
|
-
this.changedFiles
|
|
74
|
-
this.removedFiles.delete(file);
|
|
74
|
+
reporter_1.updateFilesChange(this.compiler, { changedFiles: [file] });
|
|
75
75
|
const mtime = (stats === null || stats === void 0 ? void 0 : stats.mtimeMs) || (stats === null || stats === void 0 ? void 0 : stats.ctimeMs) || 1;
|
|
76
76
|
(_b = this.watcher) === null || _b === void 0 ? void 0 : _b._onChange(dirToWatch, mtime, file, 'rename');
|
|
77
77
|
});
|
|
@@ -85,19 +85,16 @@ class InclusiveNodeWatchFileSystem {
|
|
|
85
85
|
if (!supportedExtensions.includes(extension)) {
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
|
-
this.
|
|
89
|
-
this.changedFiles.delete(file);
|
|
88
|
+
reporter_1.updateFilesChange(this.compiler, { deletedFiles: [file] });
|
|
90
89
|
(_b = this.watcher) === null || _b === void 0 ? void 0 : _b._onRemove(dirToWatch, file, 'rename');
|
|
91
90
|
});
|
|
92
91
|
this.dirsWatchers.set(dirToWatch, dirWatcher);
|
|
93
92
|
});
|
|
94
93
|
this.paused = false;
|
|
95
|
-
return Object.assign(Object.assign({},
|
|
96
|
-
this.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
this.fileWatcher.close();
|
|
100
|
-
this.fileWatcher = undefined;
|
|
94
|
+
return Object.assign(Object.assign({}, standardWatcher), { close: () => {
|
|
95
|
+
reporter_1.clearFilesChange(this.compiler);
|
|
96
|
+
if (standardWatcher) {
|
|
97
|
+
standardWatcher.close();
|
|
101
98
|
}
|
|
102
99
|
this.dirsWatchers.forEach((dirWatcher) => {
|
|
103
100
|
dirWatcher === null || dirWatcher === void 0 ? void 0 : dirWatcher.close();
|
|
@@ -105,8 +102,8 @@ class InclusiveNodeWatchFileSystem {
|
|
|
105
102
|
this.dirsWatchers.clear();
|
|
106
103
|
this.paused = true;
|
|
107
104
|
}, pause: () => {
|
|
108
|
-
if (
|
|
109
|
-
|
|
105
|
+
if (standardWatcher) {
|
|
106
|
+
standardWatcher.pause();
|
|
110
107
|
}
|
|
111
108
|
this.paused = true;
|
|
112
109
|
} });
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
function getChangedFiles(compiler) {
|
|
8
|
-
const watchFileSystem = compiler
|
|
9
|
-
.watchFileSystem;
|
|
10
|
-
return watchFileSystem
|
|
11
|
-
? Array.from(watchFileSystem.changedFiles).map((changedFile) => path_1.default.normalize(changedFile))
|
|
12
|
-
: [];
|
|
13
|
-
}
|
|
14
|
-
exports.getChangedFiles = getChangedFiles;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
function getDeletedFiles(compiler) {
|
|
8
|
-
const watchFileSystem = compiler
|
|
9
|
-
.watchFileSystem;
|
|
10
|
-
return watchFileSystem
|
|
11
|
-
? Array.from(watchFileSystem.removedFiles).map((removeFile) => path_1.default.normalize(removeFile))
|
|
12
|
-
: [];
|
|
13
|
-
}
|
|
14
|
-
exports.getDeletedFiles = getDeletedFiles;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import webpack from 'webpack';
|
|
3
|
-
import { EventEmitter } from 'events';
|
|
4
|
-
interface Watcher extends EventEmitter {
|
|
5
|
-
mtimes: Record<string, number>;
|
|
6
|
-
}
|
|
7
|
-
declare function getWatcher(compiler: webpack.Compiler): Watcher | undefined;
|
|
8
|
-
export { getWatcher, Watcher };
|
package/lib/hooks/getWatcher.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function getWatcher(compiler) {
|
|
4
|
-
// webpack 4
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
-
const { watchFileSystem } = compiler;
|
|
7
|
-
if (watchFileSystem) {
|
|
8
|
-
return watchFileSystem.watcher || (watchFileSystem.wfs && watchFileSystem.wfs.watcher);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.getWatcher = getWatcher;
|