fork-ts-checker-webpack-plugin 7.0.0-alpha.1 → 7.0.0-alpha.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/README.md +17 -83
- package/lib/ForkTsCheckerWebpackPlugin.d.ts +15 -11
- package/lib/ForkTsCheckerWebpackPlugin.js +30 -38
- package/lib/ForkTsCheckerWebpackPluginConfiguration.d.ts +6 -8
- package/lib/ForkTsCheckerWebpackPluginConfiguration.js +3 -4
- package/lib/ForkTsCheckerWebpackPluginOptions.d.ts +4 -6
- package/lib/ForkTsCheckerWebpackPluginOptions.json +73 -111
- package/lib/ForkTsCheckerWebpackPluginState.d.ts +8 -7
- package/lib/ForkTsCheckerWebpackPluginState.js +3 -1
- package/lib/error/OperationCanceledError.js +1 -0
- package/lib/formatter/BasicFormatter.d.ts +1 -1
- package/lib/formatter/BasicFormatter.js +1 -0
- package/lib/formatter/CodeFrameFormatter.d.ts +1 -1
- package/lib/formatter/CodeFrameFormatter.js +2 -1
- package/lib/formatter/Formatter.d.ts +1 -1
- package/lib/formatter/FormatterConfiguration.d.ts +3 -3
- package/lib/formatter/FormatterConfiguration.js +21 -2
- package/lib/formatter/FormatterOptions.d.ts +11 -6
- package/lib/formatter/WebpackFormatter.d.ts +1 -1
- package/lib/formatter/WebpackFormatter.js +6 -6
- package/lib/formatter/index.d.ts +0 -1
- package/lib/formatter/index.js +16 -8
- package/lib/formatter/types/babel__code-frame.js +1 -1
- package/lib/hooks/interceptDoneToGetWebpackDevServerTap.d.ts +3 -3
- package/lib/hooks/interceptDoneToGetWebpackDevServerTap.js +1 -0
- package/lib/hooks/pluginHooks.d.ts +13 -13
- package/lib/hooks/pluginHooks.js +1 -0
- package/lib/hooks/pluginPools.d.ts +4 -0
- package/lib/hooks/pluginPools.js +28 -0
- package/lib/hooks/tapAfterCompileToAddDependencies.d.ts +3 -3
- package/lib/hooks/tapAfterCompileToAddDependencies.js +1 -0
- package/lib/hooks/tapAfterCompileToGetIssues.d.ts +3 -3
- package/lib/hooks/tapAfterCompileToGetIssues.js +2 -1
- package/lib/hooks/tapAfterEnvironmentToPatchWatching.d.ts +2 -2
- package/lib/hooks/tapAfterEnvironmentToPatchWatching.js +4 -1
- package/lib/hooks/tapDoneToAsyncGetIssues.d.ts +3 -3
- package/lib/hooks/tapDoneToAsyncGetIssues.js +6 -5
- package/lib/hooks/tapErrorToLogMessage.d.ts +2 -2
- package/lib/hooks/tapErrorToLogMessage.js +4 -3
- package/lib/hooks/tapStartToConnectAndRunReporter.d.ts +5 -5
- package/lib/hooks/tapStartToConnectAndRunReporter.js +47 -22
- package/lib/hooks/tapStopToDisconnectReporter.d.ts +4 -4
- package/lib/hooks/tapStopToDisconnectReporter.js +7 -4
- package/lib/issue/Issue.d.ts +2 -3
- package/lib/issue/Issue.js +2 -3
- package/lib/issue/IssueConfiguration.d.ts +3 -3
- package/lib/issue/IssueConfiguration.js +1 -0
- package/lib/issue/IssueLocation.d.ts +2 -2
- package/lib/issue/IssueLocation.js +17 -2
- package/lib/issue/IssueMatch.d.ts +3 -3
- package/lib/issue/IssueMatch.js +3 -3
- package/lib/issue/IssueOptions.d.ts +2 -2
- package/lib/issue/IssuePosition.js +1 -0
- package/lib/issue/IssuePredicate.d.ts +1 -1
- package/lib/issue/IssuePredicate.js +1 -0
- package/lib/issue/IssueSeverity.js +1 -0
- package/lib/issue/IssueWebpackError.d.ts +3 -3
- package/lib/issue/IssueWebpackError.js +7 -5
- package/lib/issue/index.js +13 -6
- package/lib/logger/LoggerConfiguration.d.ts +3 -3
- package/lib/logger/LoggerConfiguration.js +2 -1
- package/lib/logger/LoggerFactory.d.ts +2 -2
- package/lib/logger/LoggerFactory.js +2 -1
- package/lib/logger/LoggerOptions.d.ts +2 -2
- package/lib/logger/PartialLogger.d.ts +1 -1
- package/lib/logger/PartialLogger.js +1 -0
- package/lib/logger/WebpackInfrastructureLogger.d.ts +2 -2
- package/lib/logger/WebpackInfrastructureLogger.js +1 -0
- package/lib/profile/Performance.js +1 -0
- package/lib/reporter/AggregatedReporter.d.ts +1 -1
- package/lib/reporter/AggregatedReporter.js +2 -1
- package/lib/reporter/FilesChange.d.ts +1 -1
- package/lib/reporter/FilesChange.js +2 -1
- package/lib/reporter/FilesMatch.d.ts +7 -0
- package/lib/{eslint-reporter/EsLintReporterOptions.js → reporter/FilesMatch.js} +0 -0
- package/lib/reporter/Report.d.ts +3 -3
- package/lib/reporter/Reporter.d.ts +2 -2
- package/lib/reporter/index.d.ts +1 -1
- package/lib/reporter/index.js +17 -7
- package/lib/reporter/reporter-rpc/ReporterRpcClient.d.ts +2 -2
- package/lib/reporter/reporter-rpc/ReporterRpcClient.js +17 -4
- package/lib/reporter/reporter-rpc/ReporterRpcProcedure.d.ts +5 -5
- package/lib/reporter/reporter-rpc/ReporterRpcProcedure.js +3 -0
- package/lib/reporter/reporter-rpc/ReporterRpcService.d.ts +2 -2
- package/lib/reporter/reporter-rpc/ReporterRpcService.js +3 -0
- package/lib/rpc/RpcClient.d.ts +2 -2
- package/lib/rpc/RpcClient.js +2 -1
- package/lib/rpc/RpcMessage.d.ts +1 -1
- package/lib/rpc/RpcMessage.js +3 -0
- package/lib/rpc/RpcMessageChannel.d.ts +1 -1
- package/lib/rpc/RpcMessageChannel.js +1 -0
- package/lib/rpc/RpcService.d.ts +2 -2
- package/lib/rpc/RpcService.js +1 -0
- package/lib/rpc/error/RpcMessagePortClosedError.js +1 -0
- package/lib/rpc/error/RpcRemoteError.js +1 -0
- package/lib/rpc/index.js +17 -7
- package/lib/rpc/rpc-ipc/RpcIpcMessageChannel.d.ts +1 -1
- package/lib/rpc/rpc-ipc/RpcIpcMessageChannel.js +1 -0
- package/lib/rpc/rpc-ipc/RpcIpcMessagePort.d.ts +2 -2
- package/lib/rpc/rpc-ipc/RpcIpcMessagePort.js +1 -0
- package/lib/rpc/rpc-ipc/error/RpcIpcMessagePortClosedError.js +1 -0
- package/lib/rpc/rpc-ipc/index.js +12 -5
- package/lib/typescript-reporter/TypeScriptConfigurationOverwrite.d.ts +1 -1
- package/lib/typescript-reporter/TypeScriptReporterConfiguration.d.ts +5 -5
- package/lib/typescript-reporter/TypeScriptReporterConfiguration.js +2 -0
- package/lib/typescript-reporter/TypeScriptReporterOptions.d.ts +4 -5
- package/lib/typescript-reporter/TypeScriptSupport.d.ts +1 -1
- package/lib/typescript-reporter/TypeScriptSupport.js +26 -11
- package/lib/typescript-reporter/extension/TypeScriptEmbeddedExtension.d.ts +1 -1
- package/lib/typescript-reporter/extension/TypeScriptEmbeddedExtension.js +2 -1
- package/lib/typescript-reporter/extension/TypeScriptExtension.d.ts +4 -4
- package/lib/typescript-reporter/extension/vue/TypeScriptVueExtension.d.ts +2 -2
- package/lib/typescript-reporter/extension/vue/TypeScriptVueExtension.js +2 -1
- package/lib/typescript-reporter/extension/vue/TypeScriptVueExtensionConfiguration.d.ts +1 -1
- package/lib/typescript-reporter/extension/vue/TypeScriptVueExtensionConfiguration.js +1 -0
- package/lib/typescript-reporter/extension/vue/TypeScriptVueExtensionSupport.d.ts +1 -1
- package/lib/typescript-reporter/extension/vue/TypeScriptVueExtensionSupport.js +1 -0
- package/lib/typescript-reporter/file-system/FileSystem.d.ts +1 -1
- package/lib/typescript-reporter/file-system/MemFileSystem.d.ts +8 -0
- package/lib/typescript-reporter/file-system/MemFileSystem.js +83 -0
- package/lib/typescript-reporter/file-system/PassiveFileSystem.d.ts +3 -3
- package/lib/typescript-reporter/file-system/PassiveFileSystem.js +11 -72
- package/lib/typescript-reporter/file-system/RealFileSystem.d.ts +1 -1
- package/lib/typescript-reporter/file-system/RealFileSystem.js +2 -0
- package/lib/typescript-reporter/issue/TypeScriptIssueFactory.d.ts +2 -2
- package/lib/typescript-reporter/issue/TypeScriptIssueFactory.js +17 -5
- package/lib/typescript-reporter/profile/TypeScriptPerformance.d.ts +2 -2
- package/lib/typescript-reporter/profile/TypeScriptPerformance.js +1 -0
- package/lib/typescript-reporter/reporter/ControlledCompilerHost.d.ts +3 -3
- package/lib/typescript-reporter/reporter/ControlledCompilerHost.js +1 -0
- package/lib/typescript-reporter/reporter/ControlledTypeScriptSystem.d.ts +3 -1
- package/lib/typescript-reporter/reporter/ControlledTypeScriptSystem.js +50 -15
- package/lib/typescript-reporter/reporter/ControlledWatchCompilerHost.d.ts +3 -3
- package/lib/typescript-reporter/reporter/ControlledWatchCompilerHost.js +1 -0
- package/lib/typescript-reporter/reporter/ControlledWatchSolutionBuilderHost.d.ts +3 -3
- package/lib/typescript-reporter/reporter/ControlledWatchSolutionBuilderHost.js +2 -9
- package/lib/typescript-reporter/reporter/TypeScriptConfigurationParser.d.ts +7 -5
- package/lib/typescript-reporter/reporter/TypeScriptConfigurationParser.js +114 -19
- package/lib/typescript-reporter/reporter/TypeScriptReporter.d.ts +2 -2
- package/lib/typescript-reporter/reporter/TypeScriptReporter.js +24 -16
- package/lib/typescript-reporter/reporter/TypeScriptReporterRpcClient.d.ts +2 -2
- package/lib/typescript-reporter/reporter/TypeScriptReporterRpcClient.js +1 -0
- package/lib/typescript-reporter/reporter/TypeScriptReporterRpcService.js +2 -2
- package/lib/utils/async/pool.d.ts +1 -0
- package/lib/utils/async/pool.js +10 -0
- package/lib/utils/path/relativeToContext.d.ts +2 -0
- package/lib/utils/path/relativeToContext.js +16 -0
- package/lib/watch/InclusiveNodeWatchFileSystem.d.ts +5 -5
- package/lib/watch/InclusiveNodeWatchFileSystem.js +111 -90
- package/lib/watch/WatchFileSystem.d.ts +5 -22
- package/package.json +52 -54
- package/CHANGELOG.md +0 -318
- package/changelog.config.js +0 -36
- package/lib/eslint-reporter/EsLintReporterConfiguration.d.ts +0 -11
- package/lib/eslint-reporter/EsLintReporterConfiguration.js +0 -26
- package/lib/eslint-reporter/EsLintReporterOptions.d.ts +0 -8
- package/lib/eslint-reporter/assertEsLintSupport.d.ts +0 -3
- package/lib/eslint-reporter/assertEsLintSupport.js +0 -30
- package/lib/eslint-reporter/issue/EsLintIssueFactory.d.ts +0 -4
- package/lib/eslint-reporter/issue/EsLintIssueFactory.js +0 -32
- package/lib/eslint-reporter/reporter/EsLintReporter.d.ts +0 -4
- package/lib/eslint-reporter/reporter/EsLintReporter.js +0 -85
- package/lib/eslint-reporter/reporter/EsLintReporterRpcClient.d.ts +0 -4
- package/lib/eslint-reporter/reporter/EsLintReporterRpcClient.js +0 -13
- package/lib/eslint-reporter/reporter/EsLintReporterRpcService.d.ts +0 -1
- package/lib/eslint-reporter/reporter/EsLintReporterRpcService.js +0 -11
- package/lib/eslint-reporter/types/eslint.d.ts +0 -31
- package/lib/eslint-reporter/types/eslint.js +0 -2
- package/lib/formatter/FormatterFactory.d.ts +0 -13
- package/lib/formatter/FormatterFactory.js +0 -17
- package/lib/reporter/Dependencies.d.ts +0 -6
- package/lib/reporter/Dependencies.js +0 -2
- package/lib/watch/CompilerWithWatchFileSystem.d.ts +0 -6
- package/lib/watch/CompilerWithWatchFileSystem.js +0 -2
package/lib/utils/async/pool.js
CHANGED
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.createPool = void 0;
|
|
12
13
|
function createPool(size) {
|
|
13
14
|
let pendingPromises = [];
|
|
14
15
|
const pool = {
|
|
@@ -39,6 +40,15 @@ function createPool(size) {
|
|
|
39
40
|
get pending() {
|
|
40
41
|
return pendingPromises.length;
|
|
41
42
|
},
|
|
43
|
+
get drained() {
|
|
44
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
45
|
+
return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
while (pendingPromises.length > 0) {
|
|
47
|
+
yield Promise.race(pendingPromises).catch(() => undefined);
|
|
48
|
+
}
|
|
49
|
+
resolve(undefined);
|
|
50
|
+
}));
|
|
51
|
+
},
|
|
42
52
|
};
|
|
43
53
|
return pool;
|
|
44
54
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
exports.relativeToContext = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const forwardSlash_1 = __importDefault(require("./forwardSlash"));
|
|
9
|
+
function relativeToContext(file, context) {
|
|
10
|
+
let fileInContext = forwardSlash_1.default(path_1.default.relative(context, file));
|
|
11
|
+
if (!fileInContext.startsWith('../')) {
|
|
12
|
+
fileInContext = './' + fileInContext;
|
|
13
|
+
}
|
|
14
|
+
return fileInContext;
|
|
15
|
+
}
|
|
16
|
+
exports.relativeToContext = relativeToContext;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type { FSWatcher } from 'chokidar';
|
|
2
|
+
import type { Compiler } from 'webpack';
|
|
3
|
+
import type { ForkTsCheckerWebpackPluginState } from '../ForkTsCheckerWebpackPluginState';
|
|
4
|
+
import type { WatchFileSystem } from './WatchFileSystem';
|
|
5
5
|
declare class InclusiveNodeWatchFileSystem implements WatchFileSystem {
|
|
6
6
|
private watchFileSystem;
|
|
7
7
|
private compiler;
|
|
@@ -10,6 +10,6 @@ declare class InclusiveNodeWatchFileSystem implements WatchFileSystem {
|
|
|
10
10
|
readonly dirsWatchers: Map<string, FSWatcher | undefined>;
|
|
11
11
|
constructor(watchFileSystem: WatchFileSystem, compiler: Compiler, pluginState: ForkTsCheckerWebpackPluginState);
|
|
12
12
|
private paused;
|
|
13
|
-
watch
|
|
13
|
+
watch: WatchFileSystem['watch'];
|
|
14
14
|
}
|
|
15
15
|
export { InclusiveNodeWatchFileSystem };
|
|
@@ -3,12 +3,32 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
6
|
+
exports.InclusiveNodeWatchFileSystem = void 0;
|
|
7
7
|
const path_1 = require("path");
|
|
8
|
+
const chokidar_1 = __importDefault(require("chokidar"));
|
|
9
|
+
const minimatch_1 = __importDefault(require("minimatch"));
|
|
8
10
|
const reporter_1 = require("../reporter");
|
|
9
|
-
const
|
|
10
|
-
function
|
|
11
|
-
|
|
11
|
+
const BUILTIN_IGNORED_DIRS = ['node_modules', '.git', '.yarn', '.pnp'];
|
|
12
|
+
function createIsIgnored(ignored, excluded) {
|
|
13
|
+
const ignoredPatterns = ignored ? (Array.isArray(ignored) ? ignored : [ignored]) : [];
|
|
14
|
+
const ignoredFunctions = ignoredPatterns.map((pattern) => {
|
|
15
|
+
// ensure patterns are valid - see https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/594
|
|
16
|
+
if (typeof pattern === 'string') {
|
|
17
|
+
return (path) => minimatch_1.default(path, pattern);
|
|
18
|
+
}
|
|
19
|
+
else if (pattern instanceof RegExp) {
|
|
20
|
+
return (path) => pattern.test(path);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
// fallback to no-ignore function
|
|
24
|
+
return () => false;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
ignoredFunctions.push((path) => excluded.some((excludedPath) => path.startsWith(excludedPath)));
|
|
28
|
+
ignoredFunctions.push((path) => BUILTIN_IGNORED_DIRS.some((ignoredDir) => path.includes(`/${ignoredDir}/`)));
|
|
29
|
+
return function isIgnored(path) {
|
|
30
|
+
return ignoredFunctions.some((ignoredFunction) => ignoredFunction(path));
|
|
31
|
+
};
|
|
12
32
|
}
|
|
13
33
|
class InclusiveNodeWatchFileSystem {
|
|
14
34
|
constructor(watchFileSystem, compiler, pluginState) {
|
|
@@ -16,97 +36,98 @@ class InclusiveNodeWatchFileSystem {
|
|
|
16
36
|
this.compiler = compiler;
|
|
17
37
|
this.pluginState = pluginState;
|
|
18
38
|
this.paused = true;
|
|
19
|
-
this.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// use standard watch file system for files and missing
|
|
29
|
-
const standardWatcher = this.watchFileSystem.watch(files, dirs, missing, startTime, options, callback, callbackUndelayed);
|
|
30
|
-
(_a = this.watcher) === null || _a === void 0 ? void 0 : _a.on('change', (file) => {
|
|
31
|
-
if (typeof file === 'string' && !isIgnored(file)) {
|
|
32
|
-
reporter_1.updateFilesChange(this.compiler, { changedFiles: [file] });
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
(_b = this.watcher) === null || _b === void 0 ? void 0 : _b.on('remove', (file) => {
|
|
36
|
-
if (typeof file === 'string' && !isIgnored(file)) {
|
|
37
|
-
reporter_1.updateFilesChange(this.compiler, { deletedFiles: [file] });
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
// calculate what to change
|
|
41
|
-
const prevDirs = Array.from(this.dirsWatchers.keys());
|
|
42
|
-
const nextDirs = Array.from(((_c = this.pluginState.lastDependencies) === null || _c === void 0 ? void 0 : _c.dirs) || []);
|
|
43
|
-
const dirsToUnwatch = prevDirs.filter((prevDir) => !nextDirs.includes(prevDir));
|
|
44
|
-
const dirsToWatch = nextDirs.filter((nextDir) => !prevDirs.includes(nextDir) && !isIgnored(nextDir));
|
|
45
|
-
// update dirs watcher
|
|
46
|
-
dirsToUnwatch.forEach((dirToUnwatch) => {
|
|
47
|
-
var _a;
|
|
48
|
-
(_a = this.dirsWatchers.get(dirToUnwatch)) === null || _a === void 0 ? void 0 : _a.close();
|
|
49
|
-
this.dirsWatchers.delete(dirToUnwatch);
|
|
50
|
-
});
|
|
51
|
-
dirsToWatch.forEach((dirToWatch) => {
|
|
52
|
-
const interval = typeof (options === null || options === void 0 ? void 0 : options.poll) === 'number' ? options.poll : undefined;
|
|
53
|
-
const dirWatcher = chokidar_1.default.watch(dirToWatch, {
|
|
54
|
-
ignoreInitial: true,
|
|
55
|
-
ignorePermissionErrors: true,
|
|
56
|
-
ignored: (path) => isIgnored(path),
|
|
57
|
-
usePolling: (options === null || options === void 0 ? void 0 : options.poll) ? true : undefined,
|
|
58
|
-
interval: interval,
|
|
59
|
-
binaryInterval: interval,
|
|
60
|
-
alwaysStat: true,
|
|
61
|
-
atomic: true,
|
|
62
|
-
awaitWriteFinish: true,
|
|
63
|
-
});
|
|
64
|
-
dirWatcher.on('add', (file, stats) => {
|
|
65
|
-
var _a, _b;
|
|
66
|
-
if (this.paused) {
|
|
67
|
-
return;
|
|
39
|
+
this.watch = (files, dirs, missing, startTime, options, callback, callbackUndelayed) => {
|
|
40
|
+
var _a, _b, _c, _d;
|
|
41
|
+
reporter_1.clearFilesChange(this.compiler);
|
|
42
|
+
const isIgnored = createIsIgnored(options === null || options === void 0 ? void 0 : options.ignored, ((_a = this.pluginState.lastDependencies) === null || _a === void 0 ? void 0 : _a.excluded) || []);
|
|
43
|
+
// use standard watch file system for files and missing
|
|
44
|
+
const standardWatcher = this.watchFileSystem.watch(files, dirs, missing, startTime, options, callback, callbackUndelayed);
|
|
45
|
+
(_b = this.watcher) === null || _b === void 0 ? void 0 : _b.on('change', (file) => {
|
|
46
|
+
if (typeof file === 'string' && !isIgnored(file)) {
|
|
47
|
+
reporter_1.updateFilesChange(this.compiler, { changedFiles: [file] });
|
|
68
48
|
}
|
|
69
|
-
const extension = path_1.extname(file);
|
|
70
|
-
const supportedExtensions = ((_a = this.pluginState.lastDependencies) === null || _a === void 0 ? void 0 : _a.extensions) || [];
|
|
71
|
-
if (!supportedExtensions.includes(extension)) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
reporter_1.updateFilesChange(this.compiler, { changedFiles: [file] });
|
|
75
|
-
const mtime = (stats === null || stats === void 0 ? void 0 : stats.mtimeMs) || (stats === null || stats === void 0 ? void 0 : stats.ctimeMs) || 1;
|
|
76
|
-
(_b = this.watcher) === null || _b === void 0 ? void 0 : _b._onChange(dirToWatch, mtime, file, 'rename');
|
|
77
49
|
});
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
const extension = path_1.extname(file);
|
|
84
|
-
const supportedExtensions = ((_a = this.pluginState.lastDependencies) === null || _a === void 0 ? void 0 : _a.extensions) || [];
|
|
85
|
-
if (!supportedExtensions.includes(extension)) {
|
|
86
|
-
return;
|
|
50
|
+
(_c = this.watcher) === null || _c === void 0 ? void 0 : _c.on('remove', (file) => {
|
|
51
|
+
if (typeof file === 'string' && !isIgnored(file)) {
|
|
52
|
+
reporter_1.updateFilesChange(this.compiler, { deletedFiles: [file] });
|
|
87
53
|
}
|
|
88
|
-
reporter_1.updateFilesChange(this.compiler, { deletedFiles: [file] });
|
|
89
|
-
(_b = this.watcher) === null || _b === void 0 ? void 0 : _b._onRemove(dirToWatch, file, 'rename');
|
|
90
54
|
});
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
this.dirsWatchers.
|
|
100
|
-
|
|
55
|
+
// calculate what to change
|
|
56
|
+
const prevDirs = Array.from(this.dirsWatchers.keys());
|
|
57
|
+
const nextDirs = Array.from(((_d = this.pluginState.lastDependencies) === null || _d === void 0 ? void 0 : _d.dirs) || []);
|
|
58
|
+
const dirsToUnwatch = prevDirs.filter((prevDir) => !nextDirs.includes(prevDir));
|
|
59
|
+
const dirsToWatch = nextDirs.filter((nextDir) => !prevDirs.includes(nextDir) && !isIgnored(nextDir));
|
|
60
|
+
// update dirs watcher
|
|
61
|
+
dirsToUnwatch.forEach((dirToUnwatch) => {
|
|
62
|
+
var _a;
|
|
63
|
+
(_a = this.dirsWatchers.get(dirToUnwatch)) === null || _a === void 0 ? void 0 : _a.close();
|
|
64
|
+
this.dirsWatchers.delete(dirToUnwatch);
|
|
65
|
+
});
|
|
66
|
+
dirsToWatch.forEach((dirToWatch) => {
|
|
67
|
+
const interval = typeof (options === null || options === void 0 ? void 0 : options.poll) === 'number' ? options.poll : undefined;
|
|
68
|
+
const dirWatcher = chokidar_1.default.watch(dirToWatch, {
|
|
69
|
+
ignoreInitial: true,
|
|
70
|
+
ignorePermissionErrors: true,
|
|
71
|
+
ignored: (path) => isIgnored(path),
|
|
72
|
+
usePolling: (options === null || options === void 0 ? void 0 : options.poll) ? true : undefined,
|
|
73
|
+
interval: interval,
|
|
74
|
+
binaryInterval: interval,
|
|
75
|
+
alwaysStat: true,
|
|
76
|
+
atomic: true,
|
|
77
|
+
awaitWriteFinish: true,
|
|
101
78
|
});
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
79
|
+
dirWatcher.on('add', (file, stats) => {
|
|
80
|
+
var _a, _b;
|
|
81
|
+
if (this.paused) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const extension = path_1.extname(file);
|
|
85
|
+
const supportedExtensions = ((_a = this.pluginState.lastDependencies) === null || _a === void 0 ? void 0 : _a.extensions) || [];
|
|
86
|
+
if (!supportedExtensions.includes(extension)) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
reporter_1.updateFilesChange(this.compiler, { changedFiles: [file] });
|
|
90
|
+
const mtime = (stats === null || stats === void 0 ? void 0 : stats.mtimeMs) || (stats === null || stats === void 0 ? void 0 : stats.ctimeMs) || 1;
|
|
91
|
+
(_b = this.watcher) === null || _b === void 0 ? void 0 : _b._onChange(dirToWatch, mtime, file, 'rename');
|
|
92
|
+
});
|
|
93
|
+
dirWatcher.on('unlink', (file) => {
|
|
94
|
+
var _a, _b;
|
|
95
|
+
if (this.paused) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const extension = path_1.extname(file);
|
|
99
|
+
const supportedExtensions = ((_a = this.pluginState.lastDependencies) === null || _a === void 0 ? void 0 : _a.extensions) || [];
|
|
100
|
+
if (!supportedExtensions.includes(extension)) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
reporter_1.updateFilesChange(this.compiler, { deletedFiles: [file] });
|
|
104
|
+
(_b = this.watcher) === null || _b === void 0 ? void 0 : _b._onRemove(dirToWatch, file, 'rename');
|
|
105
|
+
});
|
|
106
|
+
this.dirsWatchers.set(dirToWatch, dirWatcher);
|
|
107
|
+
});
|
|
108
|
+
this.paused = false;
|
|
109
|
+
return Object.assign(Object.assign({}, standardWatcher), { close: () => {
|
|
110
|
+
reporter_1.clearFilesChange(this.compiler);
|
|
111
|
+
if (standardWatcher) {
|
|
112
|
+
standardWatcher.close();
|
|
113
|
+
}
|
|
114
|
+
this.dirsWatchers.forEach((dirWatcher) => {
|
|
115
|
+
dirWatcher === null || dirWatcher === void 0 ? void 0 : dirWatcher.close();
|
|
116
|
+
});
|
|
117
|
+
this.dirsWatchers.clear();
|
|
118
|
+
this.paused = true;
|
|
119
|
+
}, pause: () => {
|
|
120
|
+
if (standardWatcher) {
|
|
121
|
+
standardWatcher.pause();
|
|
122
|
+
}
|
|
123
|
+
this.paused = true;
|
|
124
|
+
} });
|
|
125
|
+
};
|
|
126
|
+
this.dirsWatchers = new Map();
|
|
127
|
+
}
|
|
128
|
+
get watcher() {
|
|
129
|
+
var _a;
|
|
130
|
+
return this.watchFileSystem.watcher || ((_a = this.watchFileSystem.wfs) === null || _a === void 0 ? void 0 : _a.watcher);
|
|
110
131
|
}
|
|
111
132
|
}
|
|
112
133
|
exports.InclusiveNodeWatchFileSystem = InclusiveNodeWatchFileSystem;
|
|
@@ -1,33 +1,16 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { EventEmitter } from 'events';
|
|
3
|
-
|
|
4
|
-
aggregateTimeout: number;
|
|
5
|
-
poll: boolean;
|
|
6
|
-
followSymlinks: boolean;
|
|
7
|
-
ignored: string | RegExp | (string | RegExp)[];
|
|
8
|
-
}
|
|
2
|
+
import type { EventEmitter } from 'events';
|
|
3
|
+
import type webpack from 'webpack';
|
|
9
4
|
interface Watchpack extends EventEmitter {
|
|
10
5
|
_onChange(item: string, mtime: number, file: string, type?: string): void;
|
|
11
6
|
_onRemove(item: string, file: string, type?: string): void;
|
|
12
7
|
}
|
|
13
|
-
|
|
14
|
-
close(): void;
|
|
15
|
-
pause(): void;
|
|
16
|
-
getFileTimestamps(): Map<string, number>;
|
|
17
|
-
getContextTimestamps(): Map<string, number>;
|
|
18
|
-
}
|
|
19
|
-
interface WatcherV5 {
|
|
20
|
-
close(): void;
|
|
21
|
-
pause(): void;
|
|
22
|
-
getFileTimeInfoEntries(): Map<string, number>;
|
|
23
|
-
getContextTimeInfoEntries(): Map<string, number>;
|
|
24
|
-
}
|
|
25
|
-
declare type Watcher = WatcherV4 | WatcherV5;
|
|
8
|
+
declare type Watch = webpack.Compiler['watchFileSystem']['watch'];
|
|
26
9
|
interface WatchFileSystem {
|
|
27
10
|
watcher: Watchpack;
|
|
28
11
|
wfs?: {
|
|
29
12
|
watcher: Watchpack;
|
|
30
13
|
};
|
|
31
|
-
watch
|
|
14
|
+
watch: Watch;
|
|
32
15
|
}
|
|
33
|
-
export { WatchFileSystem,
|
|
16
|
+
export { WatchFileSystem, Watchpack };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fork-ts-checker-webpack-plugin",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.10",
|
|
4
4
|
"description": "Runs typescript type checker and linter on separate process.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fast",
|
|
@@ -38,13 +38,8 @@
|
|
|
38
38
|
"test:e2e": "npm pack && cross-env jest --config=test/e2e/jest.config.js --ci -i -b",
|
|
39
39
|
"precommit": "cross-env lint-staged && yarn build && yarn test:unit",
|
|
40
40
|
"commit": "cross-env git-cz",
|
|
41
|
-
"semantic-release": "semantic-release"
|
|
42
|
-
|
|
43
|
-
"husky": {
|
|
44
|
-
"hooks": {
|
|
45
|
-
"pre-commit": "lint-staged && yarn build && yarn test:unit",
|
|
46
|
-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
|
|
47
|
-
}
|
|
41
|
+
"semantic-release": "semantic-release",
|
|
42
|
+
"prepare": "husky install"
|
|
48
43
|
},
|
|
49
44
|
"commitlint": {
|
|
50
45
|
"extends": [
|
|
@@ -60,64 +55,67 @@
|
|
|
60
55
|
}
|
|
61
56
|
},
|
|
62
57
|
"dependencies": {
|
|
63
|
-
"@babel/code-frame": "^7.
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"cosmiconfig": "^6.0.0",
|
|
58
|
+
"@babel/code-frame": "^7.14.5",
|
|
59
|
+
"chalk": "^4.1.2",
|
|
60
|
+
"chokidar": "^3.5.2",
|
|
61
|
+
"cosmiconfig": "^7.0.0",
|
|
68
62
|
"deepmerge": "^4.2.2",
|
|
69
|
-
"fs-extra": "^
|
|
70
|
-
"
|
|
63
|
+
"fs-extra": "^10.0.0",
|
|
64
|
+
"glob": "^7.1.7",
|
|
65
|
+
"memfs": "^3.2.2",
|
|
71
66
|
"minimatch": "^3.0.4",
|
|
72
|
-
"schema-utils": "
|
|
73
|
-
"semver": "^7.3.
|
|
74
|
-
"tapable": "^
|
|
67
|
+
"schema-utils": "3.1.1",
|
|
68
|
+
"semver": "^7.3.5",
|
|
69
|
+
"tapable": "^2.0.0"
|
|
70
|
+
},
|
|
71
|
+
"peerDependencies": {
|
|
72
|
+
"typescript": ">3.6.0",
|
|
73
|
+
"webpack": "^5.11.0"
|
|
75
74
|
},
|
|
76
75
|
"devDependencies": {
|
|
77
|
-
"@commitlint/config-conventional": "^
|
|
76
|
+
"@commitlint/config-conventional": "^13.1.0",
|
|
78
77
|
"@semantic-release/commit-analyzer": "^8.0.1",
|
|
79
78
|
"@semantic-release/exec": "^5.0.0",
|
|
80
|
-
"@semantic-release/github": "^7.
|
|
81
|
-
"@semantic-release/npm": "^7.
|
|
82
|
-
"@semantic-release/release-notes-generator": "^9.0.
|
|
83
|
-
"@types/babel__code-frame": "^7.0.
|
|
79
|
+
"@semantic-release/github": "^7.2.3",
|
|
80
|
+
"@semantic-release/npm": "^7.1.3",
|
|
81
|
+
"@semantic-release/release-notes-generator": "^9.0.3",
|
|
82
|
+
"@types/babel__code-frame": "^7.0.3",
|
|
84
83
|
"@types/cross-spawn": "^6.0.2",
|
|
85
|
-
"@types/
|
|
86
|
-
"@types/
|
|
87
|
-
"@types/
|
|
88
|
-
"@types/minimatch": "^3.0.
|
|
89
|
-
"@types/mock-fs": "^4.13.
|
|
90
|
-
"@types/node": "^
|
|
91
|
-
"@types/rimraf": "^3.0.
|
|
92
|
-
"@types/semver": "^7.3.
|
|
93
|
-
"@
|
|
94
|
-
"@typescript-eslint/
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"eslint": "^6.8.0",
|
|
100
|
-
"eslint-config-prettier": "^6.13.0",
|
|
84
|
+
"@types/fs-extra": "^9.0.12",
|
|
85
|
+
"@types/jest": "^26.0.24",
|
|
86
|
+
"@types/json-schema": "^7.0.9",
|
|
87
|
+
"@types/minimatch": "^3.0.5",
|
|
88
|
+
"@types/mock-fs": "^4.13.1",
|
|
89
|
+
"@types/node": "^16.4.13",
|
|
90
|
+
"@types/rimraf": "^3.0.1",
|
|
91
|
+
"@types/semver": "^7.3.8",
|
|
92
|
+
"@typescript-eslint/eslint-plugin": "^5.1.0",
|
|
93
|
+
"@typescript-eslint/parser": "^5.1.0",
|
|
94
|
+
"commitlint": "^13.1.0",
|
|
95
|
+
"cross-env": "^7.0.3",
|
|
96
|
+
"eslint": "^7.32.0",
|
|
97
|
+
"eslint-plugin-import": "^2.25.2",
|
|
101
98
|
"eslint-plugin-node": "^11.1.0",
|
|
102
|
-
"eslint-plugin-prettier": "^
|
|
103
|
-
"git-cz": "^4.7.
|
|
104
|
-
"husky": "^
|
|
105
|
-
"jest": "^
|
|
106
|
-
"jest-circus": "^
|
|
107
|
-
"jest-environment-node": "^
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
99
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
100
|
+
"git-cz": "^4.7.6",
|
|
101
|
+
"husky": "^7.0.0",
|
|
102
|
+
"jest": "^27.0.6",
|
|
103
|
+
"jest-circus": "^27.0.6",
|
|
104
|
+
"jest-environment-node": "^27.0.6",
|
|
105
|
+
"json-schema": "^0.3.0",
|
|
106
|
+
"karton": "^0.4.1",
|
|
107
|
+
"lint-staged": "^11.1.2",
|
|
108
|
+
"mock-fs": "^5.0.0",
|
|
109
|
+
"prettier": "^2.3.2",
|
|
111
110
|
"rimraf": "^3.0.2",
|
|
112
|
-
"semantic-release": "^17.
|
|
111
|
+
"semantic-release": "^17.4.4",
|
|
113
112
|
"strip-ansi": "^6.0.0",
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"webpack": "^4.42.1"
|
|
113
|
+
"ts-jest": "^27.0.4",
|
|
114
|
+
"typescript": "^4.3.5",
|
|
115
|
+
"webpack": "^5.49.0"
|
|
118
116
|
},
|
|
119
117
|
"engines": {
|
|
120
|
-
"node": ">=
|
|
118
|
+
"node": ">=12.13.0",
|
|
121
119
|
"yarn": ">=1.0.0"
|
|
122
120
|
}
|
|
123
121
|
}
|