fork-ts-checker-webpack-plugin 7.0.0-alpha.10 → 7.0.0-alpha.11
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.d.ts +1 -1
- package/lib/ForkTsCheckerWebpackPlugin.js +29 -9
- package/lib/ForkTsCheckerWebpackPluginConfiguration.d.ts +1 -1
- package/lib/ForkTsCheckerWebpackPluginConfiguration.js +1 -1
- package/lib/ForkTsCheckerWebpackPluginOptions.d.ts +1 -1
- package/lib/ForkTsCheckerWebpackPluginState.d.ts +2 -3
- package/lib/ForkTsCheckerWebpackPluginState.js +1 -2
- package/lib/{reporter/FilesChange.d.ts → files-change.d.ts} +4 -4
- package/lib/{reporter/FilesChange.js → files-change.js} +2 -2
- package/lib/{reporter/FilesMatch.d.ts → files-match.d.ts} +0 -0
- package/lib/{reporter/FilesMatch.js → files-match.js} +0 -0
- package/lib/hooks/interceptDoneToGetWebpackDevServerTap.js +3 -0
- package/lib/hooks/pluginHooks.d.ts +1 -1
- package/lib/hooks/tapAfterCompileToAddDependencies.js +3 -0
- package/lib/hooks/tapAfterCompileToGetIssues.js +3 -0
- package/lib/hooks/tapAfterEnvironmentToPatchWatching.js +6 -0
- package/lib/hooks/tapDoneToAsyncGetIssues.js +5 -6
- package/lib/hooks/tapErrorToLogMessage.js +2 -2
- package/lib/hooks/tapStartToRunWorkers.d.ts +8 -0
- package/lib/hooks/tapStartToRunWorkers.js +95 -0
- package/lib/hooks/tapStopToTerminateWorkers.d.ts +5 -0
- package/lib/hooks/tapStopToTerminateWorkers.js +26 -0
- package/lib/infrastructure-logger.d.ts +10 -0
- package/lib/infrastructure-logger.js +15 -0
- package/lib/{typescript-reporter → typescript}/TypeScriptConfigurationOverwrite.d.ts +0 -0
- package/lib/{typescript-reporter → typescript}/TypeScriptConfigurationOverwrite.js +0 -0
- package/lib/{typescript-reporter → typescript}/TypeScriptDiagnosticsOptions.d.ts +0 -0
- package/lib/{typescript-reporter → typescript}/TypeScriptDiagnosticsOptions.js +0 -0
- package/lib/{typescript-reporter → typescript}/TypeScriptReporterConfiguration.d.ts +0 -0
- package/lib/{typescript-reporter → typescript}/TypeScriptReporterConfiguration.js +0 -0
- package/lib/{typescript-reporter → typescript}/TypeScriptReporterOptions.d.ts +0 -0
- package/lib/{typescript-reporter → typescript}/TypeScriptReporterOptions.js +0 -0
- package/lib/{typescript-reporter → typescript}/TypeScriptSupport.d.ts +0 -0
- package/lib/{typescript-reporter → typescript}/TypeScriptSupport.js +0 -0
- package/lib/{typescript-reporter → typescript}/extension/TypeScriptEmbeddedExtension.d.ts +0 -0
- package/lib/{typescript-reporter → typescript}/extension/TypeScriptEmbeddedExtension.js +0 -0
- package/lib/{typescript-reporter → typescript}/extension/TypeScriptExtension.d.ts +1 -1
- package/lib/{typescript-reporter → typescript}/extension/TypeScriptExtension.js +0 -0
- package/lib/{typescript-reporter → typescript}/extension/vue/TypeScriptVueExtension.d.ts +0 -0
- package/lib/{typescript-reporter → typescript}/extension/vue/TypeScriptVueExtension.js +0 -0
- package/lib/{typescript-reporter → typescript}/extension/vue/TypeScriptVueExtensionConfiguration.d.ts +0 -0
- package/lib/{typescript-reporter → typescript}/extension/vue/TypeScriptVueExtensionConfiguration.js +0 -0
- package/lib/{typescript-reporter → typescript}/extension/vue/TypeScriptVueExtensionOptions.d.ts +0 -0
- package/lib/{typescript-reporter → typescript}/extension/vue/TypeScriptVueExtensionOptions.js +0 -0
- package/lib/{typescript-reporter → typescript}/extension/vue/TypeScriptVueExtensionSupport.d.ts +0 -0
- package/lib/{typescript-reporter → typescript}/extension/vue/TypeScriptVueExtensionSupport.js +0 -0
- package/lib/{typescript-reporter → typescript}/extension/vue/types/vue-template-compiler.d.ts +0 -0
- package/lib/{typescript-reporter → typescript}/extension/vue/types/vue-template-compiler.js +0 -0
- package/lib/{typescript-reporter → typescript}/extension/vue/types/vue__compiler-sfc.d.ts +0 -0
- package/lib/{typescript-reporter → typescript}/extension/vue/types/vue__compiler-sfc.js +0 -0
- package/lib/typescript/worker/get-dependencies-worker.d.ts +5 -0
- package/lib/typescript/worker/get-dependencies-worker.js +18 -0
- package/lib/typescript/worker/get-issues-worker.d.ts +5 -0
- package/lib/typescript/worker/get-issues-worker.js +76 -0
- package/lib/typescript/worker/lib/artifacts.d.ts +4 -0
- package/lib/typescript/worker/lib/artifacts.js +90 -0
- package/lib/typescript/worker/lib/config.d.ts +14 -0
- package/lib/typescript/worker/lib/config.js +114 -0
- package/lib/typescript/worker/lib/dependencies.d.ts +3 -0
- package/lib/typescript/worker/lib/dependencies.js +87 -0
- package/lib/typescript/worker/lib/diagnostics.d.ts +7 -0
- package/lib/typescript/worker/lib/diagnostics.js +100 -0
- package/lib/typescript/worker/lib/extensions.d.ts +3 -0
- package/lib/typescript/worker/lib/extensions.js +11 -0
- package/lib/{typescript-reporter/file-system/FileSystem.d.ts → typescript/worker/lib/file-system/file-system.d.ts} +1 -2
- package/lib/{reporter/Report.js → typescript/worker/lib/file-system/file-system.js} +0 -0
- package/lib/typescript/worker/lib/file-system/mem-file-system.d.ts +5 -0
- package/lib/typescript/worker/lib/file-system/mem-file-system.js +78 -0
- package/lib/typescript/worker/lib/file-system/passive-file-system.d.ts +5 -0
- package/lib/typescript/worker/lib/file-system/passive-file-system.js +65 -0
- package/lib/typescript/worker/lib/file-system/real-file-system.d.ts +5 -0
- package/lib/typescript/worker/lib/file-system/real-file-system.js +187 -0
- package/lib/typescript/worker/lib/host/compiler-host.d.ts +2 -0
- package/lib/typescript/worker/lib/host/compiler-host.js +17 -0
- package/lib/typescript/worker/lib/host/watch-compiler-host.d.ts +2 -0
- package/lib/typescript/worker/lib/host/watch-compiler-host.js +32 -0
- package/lib/typescript/worker/lib/host/watch-solution-builder-host.d.ts +2 -0
- package/lib/typescript/worker/lib/host/watch-solution-builder-host.js +54 -0
- package/lib/typescript/worker/lib/performance.d.ts +3 -0
- package/lib/typescript/worker/lib/performance.js +32 -0
- package/lib/typescript/worker/lib/program/program.d.ts +2 -0
- package/lib/typescript/worker/lib/program/program.js +32 -0
- package/lib/typescript/worker/lib/program/solution-builder.d.ts +2 -0
- package/lib/typescript/worker/lib/program/solution-builder.js +39 -0
- package/lib/typescript/worker/lib/program/watch-program.d.ts +3 -0
- package/lib/typescript/worker/lib/program/watch-program.js +49 -0
- package/lib/{typescript-reporter/reporter/ControlledTypeScriptSystem.d.ts → typescript/worker/lib/system.d.ts} +4 -6
- package/lib/typescript/worker/lib/system.js +209 -0
- package/lib/typescript/worker/lib/tracing.d.ts +4 -0
- package/lib/typescript/worker/lib/tracing.js +28 -0
- package/lib/typescript/worker/lib/tsbuildinfo.d.ts +4 -0
- package/lib/typescript/worker/lib/tsbuildinfo.js +92 -0
- package/lib/typescript/worker/lib/typescript.d.ts +2 -0
- package/lib/typescript/worker/lib/typescript.js +6 -0
- package/lib/typescript/worker/lib/worker-config.d.ts +2 -0
- package/lib/typescript/worker/lib/worker-config.js +5 -0
- package/lib/utils/async/pool.d.ts +1 -1
- package/lib/utils/async/pool.js +3 -14
- package/lib/{rpc/rpc-ipc/error/RpcIpcMessagePortClosedError.d.ts → utils/rpc/error.d.ts} +2 -3
- package/lib/utils/rpc/error.js +12 -0
- package/lib/utils/rpc/expose.d.ts +1 -0
- package/lib/utils/rpc/expose.js +78 -0
- package/lib/utils/rpc/index.d.ts +5 -0
- package/lib/utils/rpc/index.js +12 -0
- package/lib/utils/rpc/types.d.ts +19 -0
- package/lib/{reporter/Reporter.js → utils/rpc/types.js} +0 -0
- package/lib/utils/rpc/worker.d.ts +13 -0
- package/lib/utils/rpc/worker.js +79 -0
- package/lib/utils/rpc/wrap.d.ts +4 -0
- package/lib/utils/rpc/wrap.js +96 -0
- package/lib/watch/InclusiveNodeWatchFileSystem.js +7 -7
- package/package.json +1 -1
- package/lib/error/OperationCanceledError.d.ts +0 -4
- package/lib/error/OperationCanceledError.js +0 -10
- package/lib/hooks/tapStartToConnectAndRunReporter.d.ts +0 -6
- package/lib/hooks/tapStartToConnectAndRunReporter.js +0 -130
- package/lib/hooks/tapStopToDisconnectReporter.d.ts +0 -5
- package/lib/hooks/tapStopToDisconnectReporter.js +0 -30
- package/lib/profile/Performance.d.ts +0 -11
- package/lib/profile/Performance.js +0 -63
- package/lib/reporter/AggregatedReporter.d.ts +0 -6
- package/lib/reporter/AggregatedReporter.js +0 -61
- package/lib/reporter/Report.d.ts +0 -8
- package/lib/reporter/Reporter.d.ts +0 -6
- package/lib/reporter/index.d.ts +0 -7
- package/lib/reporter/index.js +0 -19
- package/lib/reporter/reporter-rpc/ReporterRpcClient.d.ts +0 -10
- package/lib/reporter/reporter-rpc/ReporterRpcClient.js +0 -85
- package/lib/reporter/reporter-rpc/ReporterRpcProcedure.d.ts +0 -13
- package/lib/reporter/reporter-rpc/ReporterRpcProcedure.js +0 -15
- package/lib/reporter/reporter-rpc/ReporterRpcService.d.ts +0 -9
- package/lib/reporter/reporter-rpc/ReporterRpcService.js +0 -77
- package/lib/rpc/RpcClient.d.ts +0 -10
- package/lib/rpc/RpcClient.js +0 -79
- package/lib/rpc/RpcHost.d.ts +0 -6
- package/lib/rpc/RpcHost.js +0 -2
- package/lib/rpc/RpcMessage.d.ts +0 -26
- package/lib/rpc/RpcMessage.js +0 -48
- package/lib/rpc/RpcMessageChannel.d.ts +0 -10
- package/lib/rpc/RpcMessageChannel.js +0 -50
- package/lib/rpc/RpcMessagePort.d.ts +0 -14
- package/lib/rpc/RpcMessagePort.js +0 -2
- package/lib/rpc/RpcProcedure.d.ts +0 -5
- package/lib/rpc/RpcProcedure.js +0 -2
- package/lib/rpc/RpcService.d.ts +0 -12
- package/lib/rpc/RpcService.js +0 -64
- package/lib/rpc/error/RpcMessagePortClosedError.d.ts +0 -3
- package/lib/rpc/error/RpcMessagePortClosedError.js +0 -6
- package/lib/rpc/error/RpcRemoteError.d.ts +0 -6
- package/lib/rpc/error/RpcRemoteError.js +0 -18
- package/lib/rpc/index.d.ts +0 -7
- package/lib/rpc/index.js +0 -19
- package/lib/rpc/rpc-ipc/ProcessLike.d.ts +0 -12
- package/lib/rpc/rpc-ipc/ProcessLike.js +0 -3
- package/lib/rpc/rpc-ipc/RpcIpcMessageChannel.d.ts +0 -3
- package/lib/rpc/rpc-ipc/RpcIpcMessageChannel.js +0 -11
- package/lib/rpc/rpc-ipc/RpcIpcMessagePort.d.ts +0 -5
- package/lib/rpc/rpc-ipc/RpcIpcMessagePort.js +0 -151
- package/lib/rpc/rpc-ipc/error/RpcIpcMessagePortClosedError.js +0 -13
- package/lib/rpc/rpc-ipc/index.d.ts +0 -2
- package/lib/rpc/rpc-ipc/index.js +0 -14
- package/lib/typescript-reporter/file-system/FileSystem.js +0 -2
- package/lib/typescript-reporter/file-system/MemFileSystem.d.ts +0 -8
- package/lib/typescript-reporter/file-system/MemFileSystem.js +0 -83
- package/lib/typescript-reporter/file-system/PassiveFileSystem.d.ts +0 -9
- package/lib/typescript-reporter/file-system/PassiveFileSystem.js +0 -69
- package/lib/typescript-reporter/file-system/RealFileSystem.d.ts +0 -8
- package/lib/typescript-reporter/file-system/RealFileSystem.js +0 -181
- package/lib/typescript-reporter/issue/TypeScriptIssueFactory.d.ts +0 -4
- package/lib/typescript-reporter/issue/TypeScriptIssueFactory.js +0 -57
- package/lib/typescript-reporter/profile/TypeScriptPerformance.d.ts +0 -10
- package/lib/typescript-reporter/profile/TypeScriptPerformance.js +0 -34
- package/lib/typescript-reporter/reporter/ControlledCompilerHost.d.ts +0 -5
- package/lib/typescript-reporter/reporter/ControlledCompilerHost.js +0 -14
- package/lib/typescript-reporter/reporter/ControlledTypeScriptSystem.js +0 -218
- package/lib/typescript-reporter/reporter/ControlledWatchCompilerHost.d.ts +0 -5
- package/lib/typescript-reporter/reporter/ControlledWatchCompilerHost.js +0 -29
- package/lib/typescript-reporter/reporter/ControlledWatchSolutionBuilderHost.d.ts +0 -5
- package/lib/typescript-reporter/reporter/ControlledWatchSolutionBuilderHost.js +0 -51
- package/lib/typescript-reporter/reporter/TypeScriptConfigurationParser.d.ts +0 -8
- package/lib/typescript-reporter/reporter/TypeScriptConfigurationParser.js +0 -142
- package/lib/typescript-reporter/reporter/TypeScriptReporter.d.ts +0 -4
- package/lib/typescript-reporter/reporter/TypeScriptReporter.js +0 -376
- package/lib/typescript-reporter/reporter/TypeScriptReporterRpcClient.d.ts +0 -4
- package/lib/typescript-reporter/reporter/TypeScriptReporterRpcClient.js +0 -14
- package/lib/typescript-reporter/reporter/TypeScriptReporterRpcService.d.ts +0 -1
- package/lib/typescript-reporter/reporter/TypeScriptReporterRpcService.js +0 -11
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.wrapRpc = void 0;
|
|
32
|
+
const process = __importStar(require("process"));
|
|
33
|
+
const error_1 = require("./error");
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35
|
+
function wrapRpc(childProcess) {
|
|
36
|
+
return ((...args) => __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
if (!childProcess.send) {
|
|
38
|
+
throw new Error(`Process ${childProcess.pid} doesn't have IPC channels`);
|
|
39
|
+
}
|
|
40
|
+
else if (!childProcess.connected) {
|
|
41
|
+
throw new Error(`Process ${childProcess.pid} doesn't have open IPC channels`);
|
|
42
|
+
}
|
|
43
|
+
const id = uuid();
|
|
44
|
+
const resultPromise = new Promise((resolve, reject) => {
|
|
45
|
+
const handleMessage = (message) => {
|
|
46
|
+
if (message.id === id) {
|
|
47
|
+
if (message.type === 'resolve') {
|
|
48
|
+
resolve(message.value);
|
|
49
|
+
unsubscribe();
|
|
50
|
+
}
|
|
51
|
+
else if (message.type === 'reject') {
|
|
52
|
+
reject(message.error);
|
|
53
|
+
unsubscribe();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const handleClose = (code, signal) => {
|
|
58
|
+
reject(new error_1.RpcExitError(code
|
|
59
|
+
? `Process ${process.pid} exited with code "${code}" [${signal}]`
|
|
60
|
+
: `Process ${process.pid} exited [${signal}].`, code, signal));
|
|
61
|
+
unsubscribe();
|
|
62
|
+
};
|
|
63
|
+
const subscribe = () => {
|
|
64
|
+
childProcess.on('message', handleMessage);
|
|
65
|
+
childProcess.on('close', handleClose);
|
|
66
|
+
};
|
|
67
|
+
const unsubscribe = () => {
|
|
68
|
+
childProcess.off('message', handleMessage);
|
|
69
|
+
childProcess.off('exit', handleClose);
|
|
70
|
+
};
|
|
71
|
+
subscribe();
|
|
72
|
+
});
|
|
73
|
+
yield new Promise((resolve, reject) => {
|
|
74
|
+
childProcess.send({
|
|
75
|
+
type: 'call',
|
|
76
|
+
id,
|
|
77
|
+
args,
|
|
78
|
+
}, (error) => {
|
|
79
|
+
if (error) {
|
|
80
|
+
reject(error);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
resolve(undefined);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
return resultPromise;
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
exports.wrapRpc = wrapRpc;
|
|
91
|
+
function uuid() {
|
|
92
|
+
return new Array(4)
|
|
93
|
+
.fill(0)
|
|
94
|
+
.map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))
|
|
95
|
+
.join('-');
|
|
96
|
+
}
|
|
@@ -7,7 +7,7 @@ exports.InclusiveNodeWatchFileSystem = void 0;
|
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const chokidar_1 = __importDefault(require("chokidar"));
|
|
9
9
|
const minimatch_1 = __importDefault(require("minimatch"));
|
|
10
|
-
const
|
|
10
|
+
const files_change_1 = require("../files-change");
|
|
11
11
|
const BUILTIN_IGNORED_DIRS = ['node_modules', '.git', '.yarn', '.pnp'];
|
|
12
12
|
function createIsIgnored(ignored, excluded) {
|
|
13
13
|
const ignoredPatterns = ignored ? (Array.isArray(ignored) ? ignored : [ignored]) : [];
|
|
@@ -38,18 +38,18 @@ class InclusiveNodeWatchFileSystem {
|
|
|
38
38
|
this.paused = true;
|
|
39
39
|
this.watch = (files, dirs, missing, startTime, options, callback, callbackUndelayed) => {
|
|
40
40
|
var _a, _b, _c, _d;
|
|
41
|
-
|
|
41
|
+
files_change_1.clearFilesChange(this.compiler);
|
|
42
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
43
|
// use standard watch file system for files and missing
|
|
44
44
|
const standardWatcher = this.watchFileSystem.watch(files, dirs, missing, startTime, options, callback, callbackUndelayed);
|
|
45
45
|
(_b = this.watcher) === null || _b === void 0 ? void 0 : _b.on('change', (file) => {
|
|
46
46
|
if (typeof file === 'string' && !isIgnored(file)) {
|
|
47
|
-
|
|
47
|
+
files_change_1.updateFilesChange(this.compiler, { changedFiles: [file] });
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
(_c = this.watcher) === null || _c === void 0 ? void 0 : _c.on('remove', (file) => {
|
|
51
51
|
if (typeof file === 'string' && !isIgnored(file)) {
|
|
52
|
-
|
|
52
|
+
files_change_1.updateFilesChange(this.compiler, { deletedFiles: [file] });
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
// calculate what to change
|
|
@@ -86,7 +86,7 @@ class InclusiveNodeWatchFileSystem {
|
|
|
86
86
|
if (!supportedExtensions.includes(extension)) {
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
files_change_1.updateFilesChange(this.compiler, { changedFiles: [file] });
|
|
90
90
|
const mtime = (stats === null || stats === void 0 ? void 0 : stats.mtimeMs) || (stats === null || stats === void 0 ? void 0 : stats.ctimeMs) || 1;
|
|
91
91
|
(_b = this.watcher) === null || _b === void 0 ? void 0 : _b._onChange(dirToWatch, mtime, file, 'rename');
|
|
92
92
|
});
|
|
@@ -100,14 +100,14 @@ class InclusiveNodeWatchFileSystem {
|
|
|
100
100
|
if (!supportedExtensions.includes(extension)) {
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
files_change_1.updateFilesChange(this.compiler, { deletedFiles: [file] });
|
|
104
104
|
(_b = this.watcher) === null || _b === void 0 ? void 0 : _b._onRemove(dirToWatch, file, 'rename');
|
|
105
105
|
});
|
|
106
106
|
this.dirsWatchers.set(dirToWatch, dirWatcher);
|
|
107
107
|
});
|
|
108
108
|
this.paused = false;
|
|
109
109
|
return Object.assign(Object.assign({}, standardWatcher), { close: () => {
|
|
110
|
-
|
|
110
|
+
files_change_1.clearFilesChange(this.compiler);
|
|
111
111
|
if (standardWatcher) {
|
|
112
112
|
standardWatcher.close();
|
|
113
113
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OperationCanceledError = void 0;
|
|
4
|
-
class OperationCanceledError extends Error {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.canceled = true;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.OperationCanceledError = OperationCanceledError;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type webpack from 'webpack';
|
|
2
|
-
import type { ForkTsCheckerWebpackPluginConfiguration } from '../ForkTsCheckerWebpackPluginConfiguration';
|
|
3
|
-
import type { ForkTsCheckerWebpackPluginState } from '../ForkTsCheckerWebpackPluginState';
|
|
4
|
-
import type { ReporterRpcClient } from '../reporter';
|
|
5
|
-
declare function tapStartToConnectAndRunReporter(compiler: webpack.Compiler, issuesReporter: ReporterRpcClient, dependenciesReporter: ReporterRpcClient, configuration: ForkTsCheckerWebpackPluginConfiguration, state: ForkTsCheckerWebpackPluginState): void;
|
|
6
|
-
export { tapStartToConnectAndRunReporter };
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __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
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.tapStartToConnectAndRunReporter = void 0;
|
|
13
|
-
const OperationCanceledError_1 = require("../error/OperationCanceledError");
|
|
14
|
-
const reporter_1 = require("../reporter");
|
|
15
|
-
const interceptDoneToGetWebpackDevServerTap_1 = require("./interceptDoneToGetWebpackDevServerTap");
|
|
16
|
-
const pluginHooks_1 = require("./pluginHooks");
|
|
17
|
-
const pluginPools_1 = require("./pluginPools");
|
|
18
|
-
const tapAfterCompileToGetIssues_1 = require("./tapAfterCompileToGetIssues");
|
|
19
|
-
const tapDoneToAsyncGetIssues_1 = require("./tapDoneToAsyncGetIssues");
|
|
20
|
-
function tapStartToConnectAndRunReporter(compiler, issuesReporter, dependenciesReporter, configuration, state) {
|
|
21
|
-
const hooks = pluginHooks_1.getForkTsCheckerWebpackPluginHooks(compiler);
|
|
22
|
-
compiler.hooks.run.tap('ForkTsCheckerWebpackPlugin', () => {
|
|
23
|
-
if (!state.initialized) {
|
|
24
|
-
state.initialized = true;
|
|
25
|
-
state.watching = false;
|
|
26
|
-
tapAfterCompileToGetIssues_1.tapAfterCompileToGetIssues(compiler, configuration, state);
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
compiler.hooks.watchRun.tap('ForkTsCheckerWebpackPlugin', () => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
if (!state.initialized) {
|
|
31
|
-
state.initialized = true;
|
|
32
|
-
state.watching = true;
|
|
33
|
-
if (configuration.async) {
|
|
34
|
-
tapDoneToAsyncGetIssues_1.tapDoneToAsyncGetIssues(compiler, configuration, state);
|
|
35
|
-
interceptDoneToGetWebpackDevServerTap_1.interceptDoneToGetWebpackDevServerTap(compiler, configuration, state);
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
tapAfterCompileToGetIssues_1.tapAfterCompileToGetIssues(compiler, configuration, state);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}));
|
|
42
|
-
compiler.hooks.compilation.tap('ForkTsCheckerWebpackPlugin', (compilation) => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
if (compilation.compiler !== compiler) {
|
|
44
|
-
// run only for the compiler that the plugin was registered for
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
let change = {};
|
|
48
|
-
if (state.watching) {
|
|
49
|
-
change = reporter_1.getFilesChange(compiler);
|
|
50
|
-
configuration.logger.infrastructure.log([
|
|
51
|
-
'Calling reporter service for incremental check.',
|
|
52
|
-
` Changed files: ${JSON.stringify(change.changedFiles)}`,
|
|
53
|
-
` Deleted files: ${JSON.stringify(change.deletedFiles)}`,
|
|
54
|
-
].join('\n'));
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
configuration.logger.infrastructure.log('Calling reporter service for single check.');
|
|
58
|
-
}
|
|
59
|
-
let resolveDependencies;
|
|
60
|
-
let rejectDependencies;
|
|
61
|
-
let resolveIssues;
|
|
62
|
-
let rejectIssues;
|
|
63
|
-
state.dependenciesPromise = new Promise((resolve, reject) => {
|
|
64
|
-
resolveDependencies = resolve;
|
|
65
|
-
rejectDependencies = reject;
|
|
66
|
-
});
|
|
67
|
-
state.issuesPromise = new Promise((resolve, reject) => {
|
|
68
|
-
resolveIssues = resolve;
|
|
69
|
-
rejectIssues = reject;
|
|
70
|
-
});
|
|
71
|
-
const previousIssuesReportPromise = state.issuesReportPromise;
|
|
72
|
-
const previousDependenciesReportPromise = state.dependenciesReportPromise;
|
|
73
|
-
change = yield hooks.start.promise(change, compilation);
|
|
74
|
-
state.issuesReportPromise = pluginPools_1.issuesPool.submit((done) =>
|
|
75
|
-
// eslint-disable-next-line no-async-promise-executor
|
|
76
|
-
new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
try {
|
|
78
|
-
yield issuesReporter.connect();
|
|
79
|
-
const previousReport = yield previousIssuesReportPromise;
|
|
80
|
-
if (previousReport) {
|
|
81
|
-
yield previousReport.close();
|
|
82
|
-
}
|
|
83
|
-
const report = yield issuesReporter.getReport(change, state.watching);
|
|
84
|
-
resolve(report);
|
|
85
|
-
report.getIssues().then(resolveIssues).catch(rejectIssues).finally(done);
|
|
86
|
-
}
|
|
87
|
-
catch (error) {
|
|
88
|
-
if (error instanceof OperationCanceledError_1.OperationCanceledError) {
|
|
89
|
-
hooks.canceled.call(compilation);
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
hooks.error.call(error, compilation);
|
|
93
|
-
}
|
|
94
|
-
resolve(undefined);
|
|
95
|
-
resolveIssues(undefined);
|
|
96
|
-
done();
|
|
97
|
-
}
|
|
98
|
-
})));
|
|
99
|
-
state.dependenciesReportPromise = pluginPools_1.dependenciesPool.submit((done) =>
|
|
100
|
-
// eslint-disable-next-line no-async-promise-executor
|
|
101
|
-
new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
102
|
-
try {
|
|
103
|
-
yield dependenciesReporter.connect();
|
|
104
|
-
const previousReport = yield previousDependenciesReportPromise;
|
|
105
|
-
if (previousReport) {
|
|
106
|
-
yield previousReport.close();
|
|
107
|
-
}
|
|
108
|
-
const report = yield dependenciesReporter.getReport(change, state.watching);
|
|
109
|
-
resolve(report);
|
|
110
|
-
report
|
|
111
|
-
.getDependencies()
|
|
112
|
-
.then(resolveDependencies)
|
|
113
|
-
.catch(rejectDependencies)
|
|
114
|
-
.finally(done);
|
|
115
|
-
}
|
|
116
|
-
catch (error) {
|
|
117
|
-
if (error instanceof OperationCanceledError_1.OperationCanceledError) {
|
|
118
|
-
hooks.canceled.call(compilation);
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
hooks.error.call(error, compilation);
|
|
122
|
-
}
|
|
123
|
-
resolve(undefined);
|
|
124
|
-
resolveDependencies(undefined);
|
|
125
|
-
done();
|
|
126
|
-
}
|
|
127
|
-
})));
|
|
128
|
-
}));
|
|
129
|
-
}
|
|
130
|
-
exports.tapStartToConnectAndRunReporter = tapStartToConnectAndRunReporter;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type webpack from 'webpack';
|
|
2
|
-
import type { ForkTsCheckerWebpackPluginState } from '../ForkTsCheckerWebpackPluginState';
|
|
3
|
-
import type { ReporterRpcClient } from '../reporter';
|
|
4
|
-
declare function tapStopToDisconnectReporter(compiler: webpack.Compiler, issuesReporter: ReporterRpcClient, dependenciesReporter: ReporterRpcClient, state: ForkTsCheckerWebpackPluginState): void;
|
|
5
|
-
export { tapStopToDisconnectReporter };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __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
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.tapStopToDisconnectReporter = void 0;
|
|
13
|
-
function tapStopToDisconnectReporter(compiler, issuesReporter, dependenciesReporter, state) {
|
|
14
|
-
compiler.hooks.watchClose.tap('ForkTsCheckerWebpackPlugin', () => {
|
|
15
|
-
issuesReporter.disconnect();
|
|
16
|
-
dependenciesReporter.disconnect();
|
|
17
|
-
});
|
|
18
|
-
compiler.hooks.done.tap('ForkTsCheckerWebpackPlugin', () => __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
if (!state.watching) {
|
|
20
|
-
yield Promise.all([issuesReporter.disconnect(), dependenciesReporter.disconnect()]);
|
|
21
|
-
}
|
|
22
|
-
}));
|
|
23
|
-
compiler.hooks.failed.tap('ForkTsCheckerWebpackPlugin', () => {
|
|
24
|
-
if (!state.watching) {
|
|
25
|
-
issuesReporter.disconnect();
|
|
26
|
-
dependenciesReporter.disconnect();
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
exports.tapStopToDisconnectReporter = tapStopToDisconnectReporter;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
interface Performance {
|
|
2
|
-
enable(): void;
|
|
3
|
-
disable(): void;
|
|
4
|
-
mark(name: string): void;
|
|
5
|
-
markStart(name: string): void;
|
|
6
|
-
markEnd(name: string): void;
|
|
7
|
-
measure(name: string, startMark?: string, endMark?: string): void;
|
|
8
|
-
print(): void;
|
|
9
|
-
}
|
|
10
|
-
declare function createPerformance(): Performance;
|
|
11
|
-
export { Performance, createPerformance };
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPerformance = void 0;
|
|
4
|
-
const perf_hooks_1 = require("perf_hooks");
|
|
5
|
-
function createPerformance() {
|
|
6
|
-
let enabled = false;
|
|
7
|
-
let timeOrigin;
|
|
8
|
-
let marks;
|
|
9
|
-
let measurements;
|
|
10
|
-
function enable() {
|
|
11
|
-
enabled = true;
|
|
12
|
-
marks = new Map();
|
|
13
|
-
measurements = new Map();
|
|
14
|
-
timeOrigin = perf_hooks_1.performance.now();
|
|
15
|
-
}
|
|
16
|
-
function disable() {
|
|
17
|
-
enabled = false;
|
|
18
|
-
}
|
|
19
|
-
function mark(name) {
|
|
20
|
-
if (enabled) {
|
|
21
|
-
marks.set(name, perf_hooks_1.performance.now());
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
function measure(name, startMark, endMark) {
|
|
25
|
-
if (enabled) {
|
|
26
|
-
const start = (startMark && marks.get(startMark)) || timeOrigin;
|
|
27
|
-
const end = (endMark && marks.get(endMark)) || perf_hooks_1.performance.now();
|
|
28
|
-
measurements.set(name, (measurements.get(name) || 0) + (end - start));
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
function markStart(name) {
|
|
32
|
-
if (enabled) {
|
|
33
|
-
mark(`${name} start`);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
function markEnd(name) {
|
|
37
|
-
if (enabled) {
|
|
38
|
-
mark(`${name} end`);
|
|
39
|
-
measure(name, `${name} start`, `${name} end`);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function formatName(name, width = 0) {
|
|
43
|
-
return `${name}:`.padEnd(width);
|
|
44
|
-
}
|
|
45
|
-
function formatDuration(duration, width = 0) {
|
|
46
|
-
return `${(duration / 1000).toFixed(2)} s`.padStart(width);
|
|
47
|
-
}
|
|
48
|
-
function print() {
|
|
49
|
-
if (enabled) {
|
|
50
|
-
let nameWidth = 0;
|
|
51
|
-
let durationWidth = 0;
|
|
52
|
-
measurements.forEach((duration, name) => {
|
|
53
|
-
nameWidth = Math.max(nameWidth, formatName(name).length);
|
|
54
|
-
durationWidth = Math.max(durationWidth, formatDuration(duration).length);
|
|
55
|
-
});
|
|
56
|
-
measurements.forEach((duration, name) => {
|
|
57
|
-
console.log(`${formatName(name, nameWidth)} ${formatDuration(duration, durationWidth)}`);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return { enable, disable, mark, markStart, markEnd, measure, print };
|
|
62
|
-
}
|
|
63
|
-
exports.createPerformance = createPerformance;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Reporter } from './Reporter';
|
|
2
|
-
/**
|
|
3
|
-
* This higher order reporter aggregates too frequent getReport requests to avoid unnecessary computation.
|
|
4
|
-
*/
|
|
5
|
-
declare function createAggregatedReporter<TReporter extends Reporter>(reporter: TReporter): TReporter;
|
|
6
|
-
export { createAggregatedReporter };
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __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
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.createAggregatedReporter = void 0;
|
|
13
|
-
const OperationCanceledError_1 = require("../error/OperationCanceledError");
|
|
14
|
-
const FilesChange_1 = require("./FilesChange");
|
|
15
|
-
/**
|
|
16
|
-
* This higher order reporter aggregates too frequent getReport requests to avoid unnecessary computation.
|
|
17
|
-
*/
|
|
18
|
-
function createAggregatedReporter(reporter) {
|
|
19
|
-
let pendingPromise;
|
|
20
|
-
let queuedIndex = 0;
|
|
21
|
-
let queuedChanges = [];
|
|
22
|
-
const aggregatedReporter = Object.assign(Object.assign({}, reporter), { getReport: (change, watching) => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
if (!pendingPromise) {
|
|
24
|
-
let resolvePending;
|
|
25
|
-
pendingPromise = new Promise((resolve) => {
|
|
26
|
-
resolvePending = () => {
|
|
27
|
-
resolve(undefined);
|
|
28
|
-
pendingPromise = undefined;
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
return reporter
|
|
32
|
-
.getReport(change, watching)
|
|
33
|
-
.then((report) => (Object.assign(Object.assign({}, report), { close() {
|
|
34
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
yield report.close();
|
|
36
|
-
resolvePending();
|
|
37
|
-
});
|
|
38
|
-
} })))
|
|
39
|
-
.catch((error) => {
|
|
40
|
-
resolvePending();
|
|
41
|
-
throw error;
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
const currentIndex = ++queuedIndex;
|
|
46
|
-
queuedChanges.push(change);
|
|
47
|
-
return pendingPromise.then(() => {
|
|
48
|
-
if (queuedIndex === currentIndex) {
|
|
49
|
-
const change = FilesChange_1.aggregateFilesChanges(queuedChanges);
|
|
50
|
-
queuedChanges = [];
|
|
51
|
-
return aggregatedReporter.getReport(change, watching);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
throw new OperationCanceledError_1.OperationCanceledError('getReport canceled - new report requested.');
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}) });
|
|
59
|
-
return aggregatedReporter;
|
|
60
|
-
}
|
|
61
|
-
exports.createAggregatedReporter = createAggregatedReporter;
|
package/lib/reporter/Report.d.ts
DELETED
package/lib/reporter/index.d.ts
DELETED
package/lib/reporter/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./Report"), exports);
|
|
14
|
-
__exportStar(require("./Reporter"), exports);
|
|
15
|
-
__exportStar(require("./AggregatedReporter"), exports);
|
|
16
|
-
__exportStar(require("./FilesChange"), exports);
|
|
17
|
-
__exportStar(require("./FilesMatch"), exports);
|
|
18
|
-
__exportStar(require("./reporter-rpc/ReporterRpcClient"), exports);
|
|
19
|
-
__exportStar(require("./reporter-rpc/ReporterRpcService"), exports);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { RpcMessageChannel } from '../../rpc';
|
|
2
|
-
import type { Reporter } from '../Reporter';
|
|
3
|
-
interface ReporterRpcClient extends Reporter {
|
|
4
|
-
isConnected: () => boolean;
|
|
5
|
-
connect: () => Promise<void>;
|
|
6
|
-
disconnect: () => Promise<void>;
|
|
7
|
-
}
|
|
8
|
-
declare function createReporterRpcClient<TConfiguration extends object>(channel: RpcMessageChannel, configuration: TConfiguration): ReporterRpcClient;
|
|
9
|
-
declare function composeReporterRpcClients(clients: ReporterRpcClient[]): ReporterRpcClient;
|
|
10
|
-
export { ReporterRpcClient, createReporterRpcClient, composeReporterRpcClients };
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __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
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.composeReporterRpcClients = exports.createReporterRpcClient = void 0;
|
|
16
|
-
const rpc_1 = require("../../rpc");
|
|
17
|
-
const flatten_1 = __importDefault(require("../../utils/array/flatten"));
|
|
18
|
-
const ReporterRpcProcedure_1 = require("./ReporterRpcProcedure");
|
|
19
|
-
// suppressing because it will be removed anyway
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
21
|
-
function createReporterRpcClient(channel, configuration) {
|
|
22
|
-
const rpcClient = rpc_1.createRpcClient(channel.clientPort);
|
|
23
|
-
return {
|
|
24
|
-
isConnected: () => channel.isOpen() && rpcClient.isConnected(),
|
|
25
|
-
connect: () => __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
if (!channel.isOpen()) {
|
|
27
|
-
yield channel.open();
|
|
28
|
-
}
|
|
29
|
-
if (!rpcClient.isConnected()) {
|
|
30
|
-
try {
|
|
31
|
-
yield rpcClient.connect();
|
|
32
|
-
yield rpcClient.dispatchCall(ReporterRpcProcedure_1.configure, configuration);
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
// connect or configure was not successful -
|
|
36
|
-
// close the reporter and re-throw an error
|
|
37
|
-
yield rpcClient.disconnect();
|
|
38
|
-
yield channel.close();
|
|
39
|
-
throw error;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}),
|
|
43
|
-
disconnect: () => __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
if (rpcClient.isConnected()) {
|
|
45
|
-
yield rpcClient.disconnect();
|
|
46
|
-
}
|
|
47
|
-
if (channel.isOpen()) {
|
|
48
|
-
yield channel.close();
|
|
49
|
-
}
|
|
50
|
-
}),
|
|
51
|
-
getReport: (change, watching) => __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
const reportId = yield rpcClient.dispatchCall(ReporterRpcProcedure_1.getReport, { change, watching });
|
|
53
|
-
return {
|
|
54
|
-
getDependencies() {
|
|
55
|
-
return rpcClient.dispatchCall(ReporterRpcProcedure_1.getDependencies, reportId);
|
|
56
|
-
},
|
|
57
|
-
getIssues() {
|
|
58
|
-
return rpcClient.dispatchCall(ReporterRpcProcedure_1.getIssues, reportId);
|
|
59
|
-
},
|
|
60
|
-
close() {
|
|
61
|
-
return rpcClient.dispatchCall(ReporterRpcProcedure_1.closeReport, reportId);
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
}),
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
exports.createReporterRpcClient = createReporterRpcClient;
|
|
68
|
-
function composeReporterRpcClients(clients) {
|
|
69
|
-
return {
|
|
70
|
-
isConnected: () => clients.every((client) => client.isConnected()),
|
|
71
|
-
connect: () => Promise.all(clients.map((client) => client.connect())).then(() => undefined),
|
|
72
|
-
disconnect: () => Promise.all(clients.map((client) => client.disconnect())).then(() => undefined),
|
|
73
|
-
getReport: (change, watching) => Promise.all(clients.map((client) => client.getReport(change, watching))).then((reports) => ({
|
|
74
|
-
getDependencies: () => Promise.all(reports.map((report) => report.getDependencies())).then((dependencies) => dependencies.reduce((mergedDependencies, singleDependencies) => ({
|
|
75
|
-
files: Array.from(new Set([...mergedDependencies.files, ...singleDependencies.files])),
|
|
76
|
-
dirs: Array.from(new Set([...mergedDependencies.dirs, ...singleDependencies.dirs])),
|
|
77
|
-
excluded: Array.from(new Set([...mergedDependencies.excluded, ...singleDependencies.excluded])),
|
|
78
|
-
extensions: Array.from(new Set([...mergedDependencies.extensions, ...singleDependencies.extensions])),
|
|
79
|
-
}), { files: [], dirs: [], excluded: [], extensions: [] })),
|
|
80
|
-
getIssues: () => Promise.all(reports.map((report) => report.getIssues())).then((issues) => flatten_1.default(issues)),
|
|
81
|
-
close: () => Promise.all(reports.map((report) => report.close())).then(() => undefined),
|
|
82
|
-
})),
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
exports.composeReporterRpcClients = composeReporterRpcClients;
|