fork-ts-checker-webpack-plugin 9.1.1 → 10.0.0-alpha.1
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 +23 -13
- package/lib/files-change.js +5 -6
- package/lib/formatter/basic-formatter.js +3 -4
- package/lib/formatter/code-frame-formatter.d.ts +3 -2
- package/lib/formatter/code-frame-formatter.js +14 -5
- package/lib/formatter/formatter-config.js +3 -3
- package/lib/formatter/formatter-options.d.ts +1 -1
- package/lib/formatter/stats-formatter.js +4 -5
- package/lib/formatter/webpack-formatter.js +6 -11
- package/lib/hooks/intercept-done-to-get-dev-server-tap.js +1 -2
- package/lib/hooks/report-issues.d.ts +8 -0
- package/lib/hooks/report-issues.js +22 -0
- package/lib/hooks/tap-after-compile-to-add-dependencies.js +4 -14
- package/lib/hooks/tap-after-compile-to-get-issues.js +7 -29
- package/lib/hooks/tap-after-environment-to-patch-watching.js +1 -2
- package/lib/hooks/tap-done-to-async-get-issues.js +13 -34
- package/lib/hooks/tap-error-to-log-message.js +6 -9
- package/lib/hooks/tap-start-to-run-workers.js +13 -24
- package/lib/hooks/tap-stop-to-terminate-workers.js +1 -2
- package/lib/infrastructure-logger.js +1 -2
- package/lib/issue/issue-config.js +1 -2
- package/lib/issue/issue-location.js +2 -3
- package/lib/issue/issue-match.js +3 -4
- package/lib/issue/issue-position.js +1 -2
- package/lib/issue/issue-predicate.js +2 -3
- package/lib/issue/issue-severity.js +2 -3
- package/lib/issue/issue-webpack-error.js +21 -18
- package/lib/issue/issue.js +2 -3
- package/lib/plugin-config.js +1 -2
- package/lib/plugin-hooks.d.ts +4 -4
- package/lib/plugin-hooks.js +1 -2
- package/lib/plugin-options.json +4 -8
- package/lib/plugin-pools.js +17 -7
- package/lib/plugin-state.d.ts +0 -1
- package/lib/plugin-state.js +1 -2
- package/lib/plugin.d.ts +2 -2
- package/lib/plugin.js +39 -24
- package/lib/rpc/expose-rpc.js +6 -16
- package/lib/rpc/rpc-error.js +2 -0
- package/lib/rpc/rpc-worker.d.ts +1 -2
- package/lib/rpc/rpc-worker.js +26 -17
- package/lib/rpc/wrap-rpc.d.ts +0 -1
- package/lib/rpc/wrap-rpc.js +4 -14
- package/lib/typescript/type-script-package.d.ts +4 -0
- package/lib/typescript/type-script-package.js +88 -0
- package/lib/typescript/type-script-support.js +26 -27
- package/lib/typescript/type-script-worker-config.d.ts +2 -3
- package/lib/typescript/type-script-worker-config.js +24 -4
- package/lib/typescript/type-script-worker-options.d.ts +4 -3
- package/lib/typescript/type-script-worker-options.js +4 -0
- package/lib/typescript/worker/get-dependencies-worker.js +15 -4
- package/lib/typescript/worker/get-issues-worker.d.ts +1 -1
- package/lib/typescript/worker/get-issues-worker.js +52 -64
- package/lib/typescript/worker/lib/api.d.ts +13 -0
- package/lib/typescript/worker/lib/api.js +62 -0
- package/lib/typescript/worker/lib/config.d.ts +13 -9
- package/lib/typescript/worker/lib/config.js +93 -65
- package/lib/typescript/worker/lib/dependencies.d.ts +6 -1
- package/lib/typescript/worker/lib/dependencies.js +187 -53
- package/lib/typescript/worker/lib/diagnostics.d.ts +5 -4
- package/lib/typescript/worker/lib/diagnostics.js +67 -51
- package/lib/typescript/worker/lib/in-memory-file-system.d.ts +14 -0
- package/lib/typescript/worker/lib/in-memory-file-system.js +140 -0
- package/lib/typescript/worker/lib/performance.d.ts +1 -2
- package/lib/typescript/worker/lib/performance.js +13 -21
- package/lib/typescript/worker/lib/program/program.d.ts +6 -2
- package/lib/typescript/worker/lib/program/program.js +136 -26
- package/lib/typescript/worker/lib/program/solution-builder.d.ts +3 -1
- package/lib/typescript/worker/lib/program/solution-builder.js +43 -27
- package/lib/typescript/worker/lib/typescript.d.ts +4 -2
- package/lib/typescript/worker/lib/typescript.js +69 -3
- package/lib/utils/async/abort-error.d.ts +0 -1
- package/lib/utils/async/abort-error.js +1 -1
- package/lib/utils/async/controlled-promise.js +1 -2
- package/lib/utils/async/is-pending.js +1 -2
- package/lib/utils/async/pool.d.ts +0 -1
- package/lib/utils/async/pool.js +13 -25
- package/lib/utils/async/wait.js +1 -2
- package/lib/utils/deep-merge.d.ts +5 -0
- package/lib/utils/deep-merge.js +56 -0
- package/lib/utils/path/format-file-path.d.ts +3 -0
- package/lib/utils/path/format-file-path.js +15 -0
- package/lib/utils/path/forward-slash.js +1 -2
- package/lib/utils/path/is-inside-another-path.js +1 -2
- package/lib/utils/path/relative-to-context.js +1 -2
- package/lib/watch/inclusive-node-watch-file-system.d.ts +3 -0
- package/lib/watch/inclusive-node-watch-file-system.js +121 -113
- package/lib/watch/watch-file-system.d.ts +0 -1
- package/package.json +43 -53
- package/lib/formatter/types/babel__code-frame.d.ts +0 -21
- package/lib/formatter/types/babel__code-frame.js +0 -7
- package/lib/typescript/worker/lib/artifacts.d.ts +0 -4
- package/lib/typescript/worker/lib/artifacts.js +0 -94
- package/lib/typescript/worker/lib/emit.d.ts +0 -2
- package/lib/typescript/worker/lib/emit.js +0 -13
- package/lib/typescript/worker/lib/file-system/file-system.d.ts +0 -18
- package/lib/typescript/worker/lib/file-system/file-system.js +0 -2
- package/lib/typescript/worker/lib/file-system/mem-file-system.d.ts +0 -5
- package/lib/typescript/worker/lib/file-system/mem-file-system.js +0 -78
- package/lib/typescript/worker/lib/file-system/passive-file-system.d.ts +0 -5
- package/lib/typescript/worker/lib/file-system/passive-file-system.js +0 -65
- package/lib/typescript/worker/lib/file-system/real-file-system.d.ts +0 -5
- package/lib/typescript/worker/lib/file-system/real-file-system.js +0 -191
- package/lib/typescript/worker/lib/host/compiler-host.d.ts +0 -2
- package/lib/typescript/worker/lib/host/compiler-host.js +0 -10
- package/lib/typescript/worker/lib/host/watch-compiler-host.d.ts +0 -2
- package/lib/typescript/worker/lib/host/watch-compiler-host.js +0 -20
- package/lib/typescript/worker/lib/host/watch-solution-builder-host.d.ts +0 -2
- package/lib/typescript/worker/lib/host/watch-solution-builder-host.js +0 -47
- package/lib/typescript/worker/lib/program/watch-program.d.ts +0 -3
- package/lib/typescript/worker/lib/program/watch-program.js +0 -51
- package/lib/typescript/worker/lib/system.d.ts +0 -19
- package/lib/typescript/worker/lib/system.js +0 -232
- package/lib/typescript/worker/lib/tracing.d.ts +0 -4
- package/lib/typescript/worker/lib/tracing.js +0 -29
- package/lib/typescript/worker/lib/tsbuildinfo.d.ts +0 -4
- package/lib/typescript/worker/lib/tsbuildinfo.js +0 -96
|
@@ -1,16 +1,6 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.tapStartToRunWorkers =
|
|
13
|
-
const node_abort_controller_1 = require("node-abort-controller");
|
|
3
|
+
exports.tapStartToRunWorkers = tapStartToRunWorkers;
|
|
14
4
|
const files_change_1 = require("../files-change");
|
|
15
5
|
const infrastructure_logger_1 = require("../infrastructure-logger");
|
|
16
6
|
const plugin_hooks_1 = require("../plugin-hooks");
|
|
@@ -29,7 +19,7 @@ function tapStartToRunWorkers(compiler, getIssuesWorker, getDependenciesWorker,
|
|
|
29
19
|
(0, tap_after_compile_to_get_issues_1.tapAfterCompileToGetIssues)(compiler, config, state);
|
|
30
20
|
}
|
|
31
21
|
});
|
|
32
|
-
compiler.hooks.watchRun.tap('ForkTsCheckerWebpackPlugin', () =>
|
|
22
|
+
compiler.hooks.watchRun.tap('ForkTsCheckerWebpackPlugin', async () => {
|
|
33
23
|
if (!state.initialized) {
|
|
34
24
|
state.initialized = true;
|
|
35
25
|
state.watching = true;
|
|
@@ -43,8 +33,8 @@ function tapStartToRunWorkers(compiler, getIssuesWorker, getDependenciesWorker,
|
|
|
43
33
|
(0, tap_after_compile_to_get_issues_1.tapAfterCompileToGetIssues)(compiler, config, state);
|
|
44
34
|
}
|
|
45
35
|
}
|
|
46
|
-
})
|
|
47
|
-
compiler.hooks.compilation.tap('ForkTsCheckerWebpackPlugin', (compilation) =>
|
|
36
|
+
});
|
|
37
|
+
compiler.hooks.compilation.tap('ForkTsCheckerWebpackPlugin', async (compilation) => {
|
|
48
38
|
if (compilation.compiler !== compiler) {
|
|
49
39
|
// run only for the compiler that the plugin was registered for
|
|
50
40
|
return;
|
|
@@ -57,7 +47,7 @@ function tapStartToRunWorkers(compiler, getIssuesWorker, getDependenciesWorker,
|
|
|
57
47
|
state.abortController.abort();
|
|
58
48
|
}
|
|
59
49
|
// create new abort controller for the new iteration
|
|
60
|
-
const abortController = new
|
|
50
|
+
const abortController = new AbortController();
|
|
61
51
|
state.abortController = abortController;
|
|
62
52
|
let filesChange = {};
|
|
63
53
|
if (state.watching) {
|
|
@@ -71,7 +61,7 @@ function tapStartToRunWorkers(compiler, getIssuesWorker, getDependenciesWorker,
|
|
|
71
61
|
else {
|
|
72
62
|
log('Calling reporter service for single check.');
|
|
73
63
|
}
|
|
74
|
-
filesChange =
|
|
64
|
+
filesChange = await hooks.start.promise(filesChange, compilation);
|
|
75
65
|
let aggregatedFilesChange = filesChange;
|
|
76
66
|
if (state.aggregatedFilesChange) {
|
|
77
67
|
aggregatedFilesChange = (0, files_change_1.aggregateFilesChanges)([aggregatedFilesChange, filesChange]);
|
|
@@ -92,10 +82,10 @@ function tapStartToRunWorkers(compiler, getIssuesWorker, getDependenciesWorker,
|
|
|
92
82
|
return undefined;
|
|
93
83
|
}
|
|
94
84
|
debug(`Submitting the getIssuesWorker to the pool, iteration ${iteration}.`);
|
|
95
|
-
return plugin_pools_1.issuesPool.submit(() =>
|
|
85
|
+
return plugin_pools_1.issuesPool.submit(async () => {
|
|
96
86
|
try {
|
|
97
87
|
debug(`Running the getIssuesWorker, iteration ${iteration}.`);
|
|
98
|
-
const issues =
|
|
88
|
+
const issues = await getIssuesWorker(aggregatedFilesChange);
|
|
99
89
|
if (state.aggregatedFilesChange === aggregatedFilesChange) {
|
|
100
90
|
state.aggregatedFilesChange = undefined;
|
|
101
91
|
}
|
|
@@ -111,13 +101,13 @@ function tapStartToRunWorkers(compiler, getIssuesWorker, getDependenciesWorker,
|
|
|
111
101
|
finally {
|
|
112
102
|
debug(`The getIssuesWorker finished its job, iteration ${iteration}.`);
|
|
113
103
|
}
|
|
114
|
-
}
|
|
104
|
+
}, abortController.signal);
|
|
115
105
|
});
|
|
116
106
|
debug(`Submitting the getDependenciesWorker to the pool, iteration ${iteration}.`);
|
|
117
|
-
state.dependenciesPromise = plugin_pools_1.dependenciesPool.submit(() =>
|
|
107
|
+
state.dependenciesPromise = plugin_pools_1.dependenciesPool.submit(async () => {
|
|
118
108
|
try {
|
|
119
109
|
debug(`Running the getDependenciesWorker, iteration ${iteration}.`);
|
|
120
|
-
return
|
|
110
|
+
return await getDependenciesWorker(filesChange);
|
|
121
111
|
}
|
|
122
112
|
catch (error) {
|
|
123
113
|
hooks.error.call(error, compilation);
|
|
@@ -126,7 +116,6 @@ function tapStartToRunWorkers(compiler, getIssuesWorker, getDependenciesWorker,
|
|
|
126
116
|
finally {
|
|
127
117
|
debug(`The getDependenciesWorker finished its job, iteration ${iteration}.`);
|
|
128
118
|
}
|
|
129
|
-
})
|
|
130
|
-
})
|
|
119
|
+
}); // don't pass abortController.signal because getDependencies() is blocking
|
|
120
|
+
});
|
|
131
121
|
}
|
|
132
|
-
exports.tapStartToRunWorkers = tapStartToRunWorkers;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tapStopToTerminateWorkers =
|
|
3
|
+
exports.tapStopToTerminateWorkers = tapStopToTerminateWorkers;
|
|
4
4
|
const infrastructure_logger_1 = require("../infrastructure-logger");
|
|
5
5
|
function tapStopToTerminateWorkers(compiler, getIssuesWorker, getDependenciesWorker, state) {
|
|
6
6
|
const { debug } = (0, infrastructure_logger_1.getInfrastructureLogger)(compiler);
|
|
@@ -23,4 +23,3 @@ function tapStopToTerminateWorkers(compiler, getIssuesWorker, getDependenciesWor
|
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
exports.tapStopToTerminateWorkers = tapStopToTerminateWorkers;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getInfrastructureLogger =
|
|
3
|
+
exports.getInfrastructureLogger = getInfrastructureLogger;
|
|
4
4
|
function getInfrastructureLogger(compiler) {
|
|
5
5
|
const logger = compiler.getInfrastructureLogger('ForkTsCheckerWebpackPlugin');
|
|
6
6
|
return {
|
|
@@ -11,4 +11,3 @@ function getInfrastructureLogger(compiler) {
|
|
|
11
11
|
info: logger.info.bind(logger),
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
exports.getInfrastructureLogger = getInfrastructureLogger;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createIssueConfig =
|
|
3
|
+
exports.createIssueConfig = createIssueConfig;
|
|
4
4
|
const issue_match_1 = require("./issue-match");
|
|
5
5
|
const issue_predicate_1 = require("./issue-predicate");
|
|
6
6
|
function createIssuePredicateFromOption(context, option) {
|
|
@@ -26,4 +26,3 @@ function createIssueConfig(compiler, options) {
|
|
|
26
26
|
predicate: (issue) => include(issue) && !exclude(issue),
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
exports.createIssueConfig = createIssueConfig;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.compareIssueLocations = compareIssueLocations;
|
|
4
|
+
exports.formatIssueLocation = formatIssueLocation;
|
|
4
5
|
const issue_position_1 = require("./issue-position");
|
|
5
6
|
function compareIssueLocations(locationA, locationB) {
|
|
6
7
|
if (locationA === locationB) {
|
|
@@ -15,8 +16,6 @@ function compareIssueLocations(locationA, locationB) {
|
|
|
15
16
|
return ((0, issue_position_1.compareIssuePositions)(locationA.start, locationB.start) ||
|
|
16
17
|
(0, issue_position_1.compareIssuePositions)(locationA.end, locationB.end));
|
|
17
18
|
}
|
|
18
|
-
exports.compareIssueLocations = compareIssueLocations;
|
|
19
19
|
function formatIssueLocation(location) {
|
|
20
20
|
return `${location.start.line}:${location.start.column}`;
|
|
21
21
|
}
|
|
22
|
-
exports.formatIssueLocation = formatIssueLocation;
|
package/lib/issue/issue-match.js
CHANGED
|
@@ -3,9 +3,9 @@ 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
|
-
exports.createIssuePredicateFromIssueMatch =
|
|
6
|
+
exports.createIssuePredicateFromIssueMatch = createIssuePredicateFromIssueMatch;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const minimatch_1 =
|
|
8
|
+
const minimatch_1 = require("minimatch");
|
|
9
9
|
const forward_slash_1 = require("../utils/path/forward-slash");
|
|
10
10
|
function createIssuePredicateFromIssueMatch(context, match) {
|
|
11
11
|
return (issue) => {
|
|
@@ -13,8 +13,7 @@ function createIssuePredicateFromIssueMatch(context, match) {
|
|
|
13
13
|
const matchesCode = !match.code || match.code === issue.code;
|
|
14
14
|
const matchesFile = !issue.file ||
|
|
15
15
|
(!!issue.file &&
|
|
16
|
-
(!match.file || (0, minimatch_1.
|
|
16
|
+
(!match.file || (0, minimatch_1.minimatch)((0, forward_slash_1.forwardSlash)(path_1.default.relative(context, issue.file)), match.file)));
|
|
17
17
|
return matchesSeverity && matchesCode && matchesFile;
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
exports.createIssuePredicateFromIssueMatch = createIssuePredicateFromIssueMatch;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.compareIssuePositions =
|
|
3
|
+
exports.compareIssuePositions = compareIssuePositions;
|
|
4
4
|
function compareIssuePositions(positionA, positionB) {
|
|
5
5
|
if (positionA === positionB) {
|
|
6
6
|
return 0;
|
|
@@ -13,4 +13,3 @@ function compareIssuePositions(positionA, positionB) {
|
|
|
13
13
|
}
|
|
14
14
|
return (Math.sign(positionA.line - positionB.line) || Math.sign(positionA.column - positionB.column));
|
|
15
15
|
}
|
|
16
|
-
exports.compareIssuePositions = compareIssuePositions;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.createTrivialIssuePredicate = createTrivialIssuePredicate;
|
|
4
|
+
exports.composeIssuePredicates = composeIssuePredicates;
|
|
4
5
|
function createTrivialIssuePredicate(result) {
|
|
5
6
|
return () => result;
|
|
6
7
|
}
|
|
7
|
-
exports.createTrivialIssuePredicate = createTrivialIssuePredicate;
|
|
8
8
|
function composeIssuePredicates(predicates) {
|
|
9
9
|
return (issue) => predicates.some((predicate) => predicate(issue));
|
|
10
10
|
}
|
|
11
|
-
exports.composeIssuePredicates = composeIssuePredicates;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isIssueSeverity = isIssueSeverity;
|
|
4
|
+
exports.compareIssueSeverities = compareIssueSeverities;
|
|
4
5
|
function isIssueSeverity(value) {
|
|
5
6
|
return ['error', 'warning'].includes(value);
|
|
6
7
|
}
|
|
7
|
-
exports.isIssueSeverity = isIssueSeverity;
|
|
8
8
|
function compareIssueSeverities(severityA, severityB) {
|
|
9
9
|
const [priorityA, priorityB] = [severityA, severityB].map((severity) => ['warning' /* 0 */, 'error' /* 1 */].indexOf(severity));
|
|
10
10
|
return Math.sign(priorityB - priorityA);
|
|
11
11
|
}
|
|
12
|
-
exports.compareIssueSeverities = compareIssueSeverities;
|
|
@@ -15,36 +15,39 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
28
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
36
|
exports.IssueWebpackError = void 0;
|
|
30
|
-
const path_1 = __importDefault(require("path"));
|
|
31
37
|
const webpack = __importStar(require("webpack"));
|
|
32
|
-
const
|
|
33
|
-
const relative_to_context_1 = require("../utils/path/relative-to-context");
|
|
38
|
+
const format_file_path_1 = require("../utils/path/format-file-path");
|
|
34
39
|
const issue_location_1 = require("./issue-location");
|
|
35
40
|
class IssueWebpackError extends webpack.WebpackError {
|
|
41
|
+
issue;
|
|
42
|
+
hideStack = true;
|
|
36
43
|
constructor(message, pathType, issue) {
|
|
37
44
|
super(message);
|
|
38
45
|
this.issue = issue;
|
|
39
|
-
this.hideStack = true;
|
|
40
46
|
// to display issue location using `loc` property, webpack requires `error.module` which
|
|
41
47
|
// should be a NormalModule instance.
|
|
42
48
|
// to avoid such a dependency, we do a workaround - error.file will contain formatted location instead
|
|
43
49
|
if (issue.file) {
|
|
44
|
-
this.file =
|
|
45
|
-
pathType === 'absolute'
|
|
46
|
-
? (0, forward_slash_1.forwardSlash)(path_1.default.resolve(issue.file))
|
|
47
|
-
: (0, relative_to_context_1.relativeToContext)(issue.file, process.cwd());
|
|
50
|
+
this.file = (0, format_file_path_1.formatFilePath)(issue.file, pathType);
|
|
48
51
|
if (issue.location) {
|
|
49
52
|
this.file += `:${(0, issue_location_1.formatIssueLocation)(issue.location)}`;
|
|
50
53
|
}
|
package/lib/issue/issue.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isIssue = isIssue;
|
|
4
|
+
exports.deduplicateAndSortIssues = deduplicateAndSortIssues;
|
|
4
5
|
const issue_location_1 = require("./issue-location");
|
|
5
6
|
const issue_severity_1 = require("./issue-severity");
|
|
6
7
|
function isIssue(value) {
|
|
@@ -10,7 +11,6 @@ function isIssue(value) {
|
|
|
10
11
|
!!value.code &&
|
|
11
12
|
!!value.message);
|
|
12
13
|
}
|
|
13
|
-
exports.isIssue = isIssue;
|
|
14
14
|
function compareStrings(stringA, stringB) {
|
|
15
15
|
if (stringA === stringB) {
|
|
16
16
|
return 0;
|
|
@@ -38,4 +38,3 @@ function deduplicateAndSortIssues(issues) {
|
|
|
38
38
|
const sortedIssues = issues.filter(isIssue).sort(compareIssues);
|
|
39
39
|
return sortedIssues.filter((issue, index) => index === 0 || !equalsIssues(issue, sortedIssues[index - 1]));
|
|
40
40
|
}
|
|
41
|
-
exports.deduplicateAndSortIssues = deduplicateAndSortIssues;
|
package/lib/plugin-config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPluginConfig =
|
|
3
|
+
exports.createPluginConfig = createPluginConfig;
|
|
4
4
|
const formatter_1 = require("./formatter");
|
|
5
5
|
const infrastructure_logger_1 = require("./infrastructure-logger");
|
|
6
6
|
const issue_config_1 = require("./issue/issue-config");
|
|
@@ -23,4 +23,3 @@ function createPluginConfig(compiler, options = {}) {
|
|
|
23
23
|
devServer: options.devServer !== false,
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
exports.createPluginConfig = createPluginConfig;
|
package/lib/plugin-hooks.d.ts
CHANGED
|
@@ -3,18 +3,18 @@ import type * as webpack from 'webpack';
|
|
|
3
3
|
import type { FilesChange } from './files-change';
|
|
4
4
|
import type { Issue } from './issue';
|
|
5
5
|
declare function createPluginHooks(): {
|
|
6
|
-
start: AsyncSeriesWaterfallHook<[FilesChange, webpack.Compilation], import("tapable").UnsetAdditionalOptions>;
|
|
6
|
+
start: AsyncSeriesWaterfallHook<[FilesChange, webpack.Compilation], FilesChange, import("tapable").UnsetAdditionalOptions>;
|
|
7
7
|
waiting: SyncHook<[webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
|
|
8
8
|
canceled: SyncHook<[webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
|
|
9
9
|
error: SyncHook<[unknown, webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
|
|
10
|
-
issues: SyncWaterfallHook<[Issue[], webpack.Compilation | undefined],
|
|
10
|
+
issues: SyncWaterfallHook<[Issue[], webpack.Compilation | undefined], Issue[], import("tapable").UnsetAdditionalOptions>;
|
|
11
11
|
};
|
|
12
12
|
type ForkTsCheckerWebpackPluginHooks = ReturnType<typeof createPluginHooks>;
|
|
13
13
|
declare function getPluginHooks(compiler: webpack.Compiler | webpack.MultiCompiler): {
|
|
14
|
-
start: AsyncSeriesWaterfallHook<[FilesChange, webpack.Compilation], import("tapable").UnsetAdditionalOptions>;
|
|
14
|
+
start: AsyncSeriesWaterfallHook<[FilesChange, webpack.Compilation], FilesChange, import("tapable").UnsetAdditionalOptions>;
|
|
15
15
|
waiting: SyncHook<[webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
|
|
16
16
|
canceled: SyncHook<[webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
|
|
17
17
|
error: SyncHook<[unknown, webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
|
|
18
|
-
issues: SyncWaterfallHook<[Issue[], webpack.Compilation | undefined],
|
|
18
|
+
issues: SyncWaterfallHook<[Issue[], webpack.Compilation | undefined], Issue[], import("tapable").UnsetAdditionalOptions>;
|
|
19
19
|
};
|
|
20
20
|
export { getPluginHooks, ForkTsCheckerWebpackPluginHooks };
|
package/lib/plugin-hooks.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPluginHooks =
|
|
3
|
+
exports.getPluginHooks = getPluginHooks;
|
|
4
4
|
const tapable_1 = require("tapable");
|
|
5
5
|
const compilerHookMap = new WeakMap();
|
|
6
6
|
function createPluginHooks() {
|
|
@@ -42,4 +42,3 @@ function getPluginHooks(compiler) {
|
|
|
42
42
|
}
|
|
43
43
|
return hooks;
|
|
44
44
|
}
|
|
45
|
-
exports.getPluginHooks = getPluginHooks;
|
package/lib/plugin-options.json
CHANGED
|
@@ -115,10 +115,6 @@
|
|
|
115
115
|
"TypeScriptOptions": {
|
|
116
116
|
"type": "object",
|
|
117
117
|
"properties": {
|
|
118
|
-
"memoryLimit": {
|
|
119
|
-
"type": "number",
|
|
120
|
-
"description": "Memory limit for TypeScript reporter process."
|
|
121
|
-
},
|
|
122
118
|
"configFile": {
|
|
123
119
|
"type": "string",
|
|
124
120
|
"description": "Path to tsconfig.json. By default plugin uses context or process.cwd() to localize tsconfig.json file."
|
|
@@ -133,8 +129,8 @@
|
|
|
133
129
|
},
|
|
134
130
|
"mode": {
|
|
135
131
|
"type": "string",
|
|
136
|
-
"enum": ["
|
|
137
|
-
"description": "`
|
|
132
|
+
"enum": ["in-memory", "write"],
|
|
133
|
+
"description": "`in-memory` writes nothing to the disk, `write` writes type definition files, or with `build` all outputs of the build, like `tsc --build`"
|
|
138
134
|
},
|
|
139
135
|
"compilerOptions": {
|
|
140
136
|
"type": "object",
|
|
@@ -161,11 +157,11 @@
|
|
|
161
157
|
},
|
|
162
158
|
"profile": {
|
|
163
159
|
"type": "boolean",
|
|
164
|
-
"description": "Measures and prints timings
|
|
160
|
+
"description": "Measures and prints timings of the requests made to TypeScript's native compiler."
|
|
165
161
|
},
|
|
166
162
|
"typescriptPath": {
|
|
167
163
|
"type": "string",
|
|
168
|
-
"description": "If supplied this is a custom path where TypeScript can be found."
|
|
164
|
+
"description": "If supplied this is a custom path where TypeScript (7.1 or newer) can be found."
|
|
169
165
|
}
|
|
170
166
|
}
|
|
171
167
|
},
|
package/lib/plugin-pools.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.dependenciesPool = exports.issuesPool = void 0;
|
|
27
37
|
const os = __importStar(require("os"));
|
package/lib/plugin-state.d.ts
CHANGED
package/lib/plugin-state.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPluginState =
|
|
3
|
+
exports.createPluginState = createPluginState;
|
|
4
4
|
function createPluginState() {
|
|
5
5
|
return {
|
|
6
6
|
issuesPromise: Promise.resolve(undefined),
|
|
@@ -14,4 +14,3 @@ function createPluginState() {
|
|
|
14
14
|
webpackDevServerDoneTap: undefined,
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
exports.createPluginState = createPluginState;
|
package/lib/plugin.d.ts
CHANGED
|
@@ -17,11 +17,11 @@ declare class ForkTsCheckerWebpackPlugin {
|
|
|
17
17
|
private readonly options;
|
|
18
18
|
constructor(options?: ForkTsCheckerWebpackPluginOptions);
|
|
19
19
|
static getCompilerHooks(compiler: webpack.Compiler): {
|
|
20
|
-
start: import("tapable").AsyncSeriesWaterfallHook<[import("./files-change").FilesChange, webpack.Compilation], import("tapable").UnsetAdditionalOptions>;
|
|
20
|
+
start: import("tapable").AsyncSeriesWaterfallHook<[import("./files-change").FilesChange, webpack.Compilation], import("./files-change").FilesChange, import("tapable").UnsetAdditionalOptions>;
|
|
21
21
|
waiting: import("tapable").SyncHook<[webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
|
|
22
22
|
canceled: import("tapable").SyncHook<[webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
|
|
23
23
|
error: import("tapable").SyncHook<[unknown, webpack.Compilation], void, import("tapable").UnsetAdditionalOptions>;
|
|
24
|
-
issues: import("tapable").SyncWaterfallHook<[import("./issue
|
|
24
|
+
issues: import("tapable").SyncWaterfallHook<[import("./issue").Issue[], webpack.Compilation | undefined], import("./issue").Issue[], import("tapable").UnsetAdditionalOptions>;
|
|
25
25
|
};
|
|
26
26
|
apply(compiler: webpack.Compiler): void;
|
|
27
27
|
}
|
package/lib/plugin.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -29,7 +39,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
39
|
exports.ForkTsCheckerWebpackPlugin = void 0;
|
|
30
40
|
const path = __importStar(require("path"));
|
|
31
41
|
const cosmiconfig_1 = require("cosmiconfig");
|
|
32
|
-
const deepmerge_1 = __importDefault(require("deepmerge"));
|
|
33
42
|
const schema_utils_1 = require("schema-utils");
|
|
34
43
|
const tap_after_compile_to_add_dependencies_1 = require("./hooks/tap-after-compile-to-add-dependencies");
|
|
35
44
|
const tap_after_environment_to_patch_watching_1 = require("./hooks/tap-after-environment-to-patch-watching");
|
|
@@ -43,14 +52,33 @@ const plugin_pools_1 = require("./plugin-pools");
|
|
|
43
52
|
const plugin_state_1 = require("./plugin-state");
|
|
44
53
|
const rpc_1 = require("./rpc");
|
|
45
54
|
const type_script_support_1 = require("./typescript/type-script-support");
|
|
55
|
+
const deep_merge_1 = require("./utils/deep-merge");
|
|
46
56
|
class ForkTsCheckerWebpackPlugin {
|
|
57
|
+
/**
|
|
58
|
+
* Current version of the plugin
|
|
59
|
+
*/
|
|
60
|
+
static version = '10.0.0-alpha.1'; // will be replaced by the @semantic-release/exec
|
|
61
|
+
/**
|
|
62
|
+
* Default pools for the plugin concurrency limit
|
|
63
|
+
*/
|
|
64
|
+
static issuesPool = plugin_pools_1.issuesPool;
|
|
65
|
+
static dependenciesPool = plugin_pools_1.dependenciesPool;
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated Use ForkTsCheckerWebpackPlugin.issuesPool instead
|
|
68
|
+
*/
|
|
69
|
+
static pool = plugin_pools_1.issuesPool;
|
|
70
|
+
options;
|
|
47
71
|
constructor(options = {}) {
|
|
48
72
|
const explorerSync = (0, cosmiconfig_1.cosmiconfigSync)('fork-ts-checker');
|
|
49
|
-
const { config:
|
|
73
|
+
const { config: loadedOptions } = explorerSync.search() || {};
|
|
74
|
+
// a config file that is an ES module (`export default`) is loaded as its namespace
|
|
75
|
+
const externalOptions = loadedOptions?.__esModule && 'default' in loadedOptions
|
|
76
|
+
? loadedOptions.default
|
|
77
|
+
: loadedOptions;
|
|
50
78
|
// first validate options directly passed to the constructor
|
|
51
79
|
const config = { name: 'ForkTsCheckerWebpackPlugin' };
|
|
52
80
|
(0, schema_utils_1.validate)(plugin_options_json_1.default, options, config);
|
|
53
|
-
this.options = (0,
|
|
81
|
+
this.options = (0, deep_merge_1.deepMerge)(externalOptions || {}, options || {});
|
|
54
82
|
// then validate merged options
|
|
55
83
|
(0, schema_utils_1.validate)(plugin_options_json_1.default, this.options, config);
|
|
56
84
|
}
|
|
@@ -61,7 +89,7 @@ class ForkTsCheckerWebpackPlugin {
|
|
|
61
89
|
const config = (0, plugin_config_1.createPluginConfig)(compiler, this.options);
|
|
62
90
|
const state = (0, plugin_state_1.createPluginState)();
|
|
63
91
|
(0, type_script_support_1.assertTypeScriptSupport)(config.typescript);
|
|
64
|
-
const getIssuesWorker = (0, rpc_1.createRpcWorker)(path.resolve(__dirname, './typescript/worker/get-issues-worker.js'), config.typescript
|
|
92
|
+
const getIssuesWorker = (0, rpc_1.createRpcWorker)(path.resolve(__dirname, './typescript/worker/get-issues-worker.js'), config.typescript);
|
|
65
93
|
const getDependenciesWorker = (0, rpc_1.createRpcWorker)(path.resolve(__dirname, './typescript/worker/get-dependencies-worker.js'), config.typescript);
|
|
66
94
|
(0, tap_after_environment_to_patch_watching_1.tapAfterEnvironmentToPatchWatching)(compiler, state);
|
|
67
95
|
(0, tap_start_to_run_workers_1.tapStartToRunWorkers)(compiler, getIssuesWorker, getDependenciesWorker, config, state);
|
|
@@ -71,16 +99,3 @@ class ForkTsCheckerWebpackPlugin {
|
|
|
71
99
|
}
|
|
72
100
|
}
|
|
73
101
|
exports.ForkTsCheckerWebpackPlugin = ForkTsCheckerWebpackPlugin;
|
|
74
|
-
/**
|
|
75
|
-
* Current version of the plugin
|
|
76
|
-
*/
|
|
77
|
-
ForkTsCheckerWebpackPlugin.version = '9.1.1'; // will be replaced by the @semantic-release/exec
|
|
78
|
-
/**
|
|
79
|
-
* Default pools for the plugin concurrency limit
|
|
80
|
-
*/
|
|
81
|
-
ForkTsCheckerWebpackPlugin.issuesPool = plugin_pools_1.issuesPool;
|
|
82
|
-
ForkTsCheckerWebpackPlugin.dependenciesPool = plugin_pools_1.dependenciesPool;
|
|
83
|
-
/**
|
|
84
|
-
* @deprecated Use ForkTsCheckerWebpackPlugin.issuesPool instead
|
|
85
|
-
*/
|
|
86
|
-
ForkTsCheckerWebpackPlugin.pool = plugin_pools_1.issuesPool;
|
package/lib/rpc/expose-rpc.js
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
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
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
14
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.exposeRpc =
|
|
6
|
+
exports.exposeRpc = exposeRpc;
|
|
16
7
|
const process_1 = __importDefault(require("process"));
|
|
17
8
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
9
|
function exposeRpc(fn) {
|
|
@@ -34,7 +25,7 @@ function exposeRpc(fn) {
|
|
|
34
25
|
});
|
|
35
26
|
}
|
|
36
27
|
});
|
|
37
|
-
const handleMessage = (message) =>
|
|
28
|
+
const handleMessage = async (message) => {
|
|
38
29
|
if (message.type === 'call') {
|
|
39
30
|
if (!process_1.default.send) {
|
|
40
31
|
// process disconnected - skip
|
|
@@ -43,21 +34,21 @@ function exposeRpc(fn) {
|
|
|
43
34
|
let value;
|
|
44
35
|
let error;
|
|
45
36
|
try {
|
|
46
|
-
value =
|
|
37
|
+
value = await fn(...message.args);
|
|
47
38
|
}
|
|
48
39
|
catch (fnError) {
|
|
49
40
|
error = fnError;
|
|
50
41
|
}
|
|
51
42
|
try {
|
|
52
43
|
if (error) {
|
|
53
|
-
|
|
44
|
+
await sendMessage({
|
|
54
45
|
type: 'reject',
|
|
55
46
|
id: message.id,
|
|
56
47
|
error,
|
|
57
48
|
});
|
|
58
49
|
}
|
|
59
50
|
else {
|
|
60
|
-
|
|
51
|
+
await sendMessage({
|
|
61
52
|
type: 'resolve',
|
|
62
53
|
id: message.id,
|
|
63
54
|
value,
|
|
@@ -72,7 +63,6 @@ function exposeRpc(fn) {
|
|
|
72
63
|
console.error(sendError);
|
|
73
64
|
}
|
|
74
65
|
}
|
|
75
|
-
}
|
|
66
|
+
};
|
|
76
67
|
process_1.default.on('message', handleMessage);
|
|
77
68
|
}
|
|
78
|
-
exports.exposeRpc = exposeRpc;
|