ts-checker-rspack-plugin 1.1.7 → 1.2.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 +69 -22
- package/lib/getDependenciesWorker.js +652 -0
- package/lib/getIssuesWorker.js +1095 -0
- package/lib/index.js +972 -4
- package/lib/issue/issue-config.d.ts +2 -0
- package/lib/issue/issue-options.d.ts +2 -0
- package/lib/issue/issue-severity.d.ts +4 -4
- package/lib/plugin-state.d.ts +0 -1
- package/lib/plugin.d.ts +1 -1
- package/lib/rpc/rpc-worker.d.ts +0 -1
- package/lib/rpc/wrap-rpc.d.ts +0 -1
- package/lib/typescript/worker/get-issues-worker.d.ts +2 -2
- package/lib/typescript/worker/lib/config.d.ts +2 -2
- package/lib/typescript/worker/lib/diagnostics.d.ts +3 -3
- package/lib/typescript/worker/lib/file-system/file-system.d.ts +0 -1
- package/lib/utils/async/abort-error.d.ts +0 -1
- package/lib/utils/async/pool.d.ts +0 -1
- package/lib/watch/watch-file-system.d.ts +0 -1
- package/package.json +12 -11
- package/lib/files-change.js +0 -57
- package/lib/files-match.js +0 -2
- package/lib/formatter/basic-formatter.js +0 -13
- package/lib/formatter/code-frame-formatter.js +0 -32
- package/lib/formatter/formatter-config.js +0 -36
- package/lib/formatter/formatter-options.js +0 -2
- package/lib/formatter/formatter.js +0 -2
- package/lib/formatter/index.js +0 -22
- package/lib/formatter/stats-formatter.js +0 -30
- package/lib/formatter/types/babel__code-frame.js +0 -7
- package/lib/formatter/webpack-formatter.js +0 -32
- package/lib/hooks/intercept-done-to-get-dev-server-tap.js +0 -18
- package/lib/hooks/tap-after-compile-to-add-dependencies.js +0 -59
- package/lib/hooks/tap-after-compile-to-get-issues.js +0 -43
- package/lib/hooks/tap-after-environment-to-patch-watching.js +0 -22
- package/lib/hooks/tap-done-to-async-get-issues.js +0 -74
- package/lib/hooks/tap-error-to-log-message.js +0 -32
- package/lib/hooks/tap-start-to-run-workers.js +0 -122
- package/lib/hooks/tap-stop-to-terminate-workers.js +0 -26
- package/lib/infrastructure-logger.js +0 -14
- package/lib/issue/index.js +0 -19
- package/lib/issue/issue-config.js +0 -29
- package/lib/issue/issue-location.js +0 -22
- package/lib/issue/issue-match.js +0 -20
- package/lib/issue/issue-options.js +0 -2
- package/lib/issue/issue-position.js +0 -16
- package/lib/issue/issue-predicate.js +0 -11
- package/lib/issue/issue-severity.js +0 -12
- package/lib/issue/issue-webpack-error.js +0 -31
- package/lib/issue/issue.js +0 -41
- package/lib/logger.js +0 -2
- package/lib/plugin-config.js +0 -26
- package/lib/plugin-hooks.js +0 -45
- package/lib/plugin-options.js +0 -2
- package/lib/plugin-pools.js +0 -32
- package/lib/plugin-state.js +0 -17
- package/lib/plugin.js +0 -74
- package/lib/rpc/expose-rpc.js +0 -69
- package/lib/rpc/index.js +0 -12
- package/lib/rpc/rpc-error.js +0 -12
- package/lib/rpc/rpc-worker.js +0 -86
- package/lib/rpc/types.js +0 -2
- package/lib/rpc/wrap-rpc.js +0 -70
- package/lib/typescript/type-script-config-overwrite.js +0 -2
- package/lib/typescript/type-script-diagnostics-options.js +0 -2
- package/lib/typescript/type-script-support.js +0 -31
- package/lib/typescript/type-script-worker-config.js +0 -36
- package/lib/typescript/type-script-worker-options.js +0 -2
- package/lib/typescript/worker/get-dependencies-worker.js +0 -15
- package/lib/typescript/worker/get-issues-worker.js +0 -70
- package/lib/typescript/worker/lib/artifacts.js +0 -94
- package/lib/typescript/worker/lib/config.js +0 -162
- package/lib/typescript/worker/lib/dependencies.js +0 -84
- package/lib/typescript/worker/lib/diagnostics.js +0 -112
- package/lib/typescript/worker/lib/emit.js +0 -13
- package/lib/typescript/worker/lib/file-system/file-system.js +0 -2
- package/lib/typescript/worker/lib/file-system/mem-file-system.js +0 -81
- package/lib/typescript/worker/lib/file-system/passive-file-system.js +0 -68
- package/lib/typescript/worker/lib/file-system/real-file-system.js +0 -171
- package/lib/typescript/worker/lib/host/compiler-host.js +0 -17
- package/lib/typescript/worker/lib/host/watch-compiler-host.js +0 -32
- package/lib/typescript/worker/lib/host/watch-solution-builder-host.js +0 -53
- package/lib/typescript/worker/lib/performance.js +0 -29
- package/lib/typescript/worker/lib/program/program.js +0 -37
- package/lib/typescript/worker/lib/program/solution-builder.js +0 -39
- package/lib/typescript/worker/lib/program/watch-program.js +0 -51
- package/lib/typescript/worker/lib/system.js +0 -229
- package/lib/typescript/worker/lib/tracing.js +0 -27
- package/lib/typescript/worker/lib/tsbuildinfo.js +0 -96
- package/lib/typescript/worker/lib/typescript.js +0 -6
- package/lib/typescript/worker/lib/worker-config.js +0 -5
- package/lib/utils/async/abort-error.js +0 -15
- package/lib/utils/async/controlled-promise.js +0 -17
- package/lib/utils/async/is-pending.js +0 -10
- package/lib/utils/async/pool.js +0 -36
- package/lib/utils/async/wait.js +0 -7
- package/lib/utils/path/forward-slash.js +0 -15
- package/lib/utils/path/is-inside-another-path.js +0 -22
- package/lib/utils/path/relative-to-context.js +0 -16
- package/lib/watch/inclusive-node-watch-file-system.js +0 -183
- package/lib/watch/watch-file-system.js +0 -2
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.tapDoneToAsyncGetIssues = void 0;
|
|
7
|
-
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
|
-
const stats_formatter_1 = require("../formatter/stats-formatter");
|
|
9
|
-
const webpack_formatter_1 = require("../formatter/webpack-formatter");
|
|
10
|
-
const infrastructure_logger_1 = require("../infrastructure-logger");
|
|
11
|
-
const issue_webpack_error_1 = require("../issue/issue-webpack-error");
|
|
12
|
-
const plugin_hooks_1 = require("../plugin-hooks");
|
|
13
|
-
const is_pending_1 = require("../utils/async/is-pending");
|
|
14
|
-
const wait_1 = require("../utils/async/wait");
|
|
15
|
-
function tapDoneToAsyncGetIssues(compiler, config, state) {
|
|
16
|
-
const hooks = (0, plugin_hooks_1.getPluginHooks)(compiler);
|
|
17
|
-
const { debug } = (0, infrastructure_logger_1.getInfrastructureLogger)(compiler);
|
|
18
|
-
compiler.hooks.done.tap('TsCheckerRspackPlugin', async (stats) => {
|
|
19
|
-
if (stats.compilation.compiler !== compiler) {
|
|
20
|
-
// run only for the compiler that the plugin was registered for
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
const issuesPromise = state.issuesPromise;
|
|
24
|
-
let issues;
|
|
25
|
-
try {
|
|
26
|
-
if (await (0, is_pending_1.isPending)(issuesPromise)) {
|
|
27
|
-
hooks.waiting.call(stats.compilation);
|
|
28
|
-
config.logger.log(picocolors_1.default.cyan('[type-check] in progress...'));
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
// wait 10ms to log issues after webpack stats
|
|
32
|
-
await (0, wait_1.wait)(10);
|
|
33
|
-
}
|
|
34
|
-
issues = await issuesPromise;
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
hooks.error.call(error, stats.compilation);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (!issues || // some error has been thrown
|
|
41
|
-
state.issuesPromise !== issuesPromise // we have a new request - don't show results for the old one
|
|
42
|
-
) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
debug(`Got ${issues?.length || 0} issues from getIssuesWorker.`);
|
|
46
|
-
// filter list of issues by provided issue predicate
|
|
47
|
-
issues = issues.filter(config.issue.predicate);
|
|
48
|
-
// modify list of issues in the plugin hooks
|
|
49
|
-
issues = hooks.issues.call(issues, stats.compilation);
|
|
50
|
-
const formatter = (0, webpack_formatter_1.createWebpackFormatter)(config.formatter.format, config.formatter.pathType);
|
|
51
|
-
if (issues.length) {
|
|
52
|
-
// follow webpack's approach - one process.write to stderr with all errors and warnings
|
|
53
|
-
config.logger.error(issues.map((issue) => formatter(issue)).join('\n'));
|
|
54
|
-
}
|
|
55
|
-
// print stats of the compilation
|
|
56
|
-
config.logger.log((0, stats_formatter_1.statsFormatter)(issues, stats));
|
|
57
|
-
// report issues to dev-server (overlay), if it's listening
|
|
58
|
-
// skip reporting if there are no issues, to avoid an extra hot reload
|
|
59
|
-
if (issues.length && state.DevServerDoneTap) {
|
|
60
|
-
issues.forEach((issue) => {
|
|
61
|
-
const error = new issue_webpack_error_1.IssueWebpackError(config.formatter.format(issue), config.formatter.pathType, issue);
|
|
62
|
-
if (issue.severity === 'warning') {
|
|
63
|
-
stats.compilation.warnings.push(error);
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
stats.compilation.errors.push(error);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
debug('Sending issues to the dev-server.');
|
|
70
|
-
state.DevServerDoneTap.fn(stats);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
exports.tapDoneToAsyncGetIssues = tapDoneToAsyncGetIssues;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.tapErrorToLogMessage = void 0;
|
|
7
|
-
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
|
-
const plugin_hooks_1 = require("../plugin-hooks");
|
|
9
|
-
const rpc_1 = require("../rpc");
|
|
10
|
-
const abort_error_1 = require("../utils/async/abort-error");
|
|
11
|
-
function tapErrorToLogMessage(compiler, config) {
|
|
12
|
-
const hooks = (0, plugin_hooks_1.getPluginHooks)(compiler);
|
|
13
|
-
hooks.error.tap('TsCheckerRspackPlugin', (error) => {
|
|
14
|
-
if (error instanceof abort_error_1.AbortError) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
config.logger.error(String(error));
|
|
18
|
-
if (error instanceof rpc_1.RpcExitError) {
|
|
19
|
-
if (error.signal === 'SIGINT') {
|
|
20
|
-
config.logger.error(picocolors_1.default.red('[type-check] Issues checking service interrupted - If running in a docker container, this may be caused ' +
|
|
21
|
-
"by the container running out of memory. If so, try increasing the container's memory limit " +
|
|
22
|
-
'or lowering the `memoryLimit` value in the TsCheckerRspackPlugin configuration.'));
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
config.logger.error(picocolors_1.default.red('[type-check] Issues checking service aborted - probably out of memory. ' +
|
|
26
|
-
'Check the `memoryLimit` option in the TsCheckerRspackPlugin configuration.\n' +
|
|
27
|
-
"If increasing the memory doesn't solve the issue, it's most probably a bug in the TypeScript."));
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
exports.tapErrorToLogMessage = tapErrorToLogMessage;
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tapStartToRunWorkers = void 0;
|
|
4
|
-
const files_change_1 = require("../files-change");
|
|
5
|
-
const infrastructure_logger_1 = require("../infrastructure-logger");
|
|
6
|
-
const plugin_hooks_1 = require("../plugin-hooks");
|
|
7
|
-
const plugin_pools_1 = require("../plugin-pools");
|
|
8
|
-
const intercept_done_to_get_dev_server_tap_1 = require("./intercept-done-to-get-dev-server-tap");
|
|
9
|
-
const tap_after_compile_to_get_issues_1 = require("./tap-after-compile-to-get-issues");
|
|
10
|
-
const tap_done_to_async_get_issues_1 = require("./tap-done-to-async-get-issues");
|
|
11
|
-
function tapStartToRunWorkers(compiler, getIssuesWorker, getDependenciesWorker, config, state) {
|
|
12
|
-
const hooks = (0, plugin_hooks_1.getPluginHooks)(compiler);
|
|
13
|
-
const { log, debug } = (0, infrastructure_logger_1.getInfrastructureLogger)(compiler);
|
|
14
|
-
compiler.hooks.run.tap('TsCheckerRspackPlugin', () => {
|
|
15
|
-
if (!state.initialized) {
|
|
16
|
-
debug('Initializing plugin for single run (not async).');
|
|
17
|
-
state.initialized = true;
|
|
18
|
-
state.watching = false;
|
|
19
|
-
(0, tap_after_compile_to_get_issues_1.tapAfterCompileToGetIssues)(compiler, config, state);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
compiler.hooks.watchRun.tap('TsCheckerRspackPlugin', async () => {
|
|
23
|
-
if (!state.initialized) {
|
|
24
|
-
state.initialized = true;
|
|
25
|
-
state.watching = true;
|
|
26
|
-
if (config.async) {
|
|
27
|
-
debug('Initializing plugin for watch run (async).');
|
|
28
|
-
(0, tap_done_to_async_get_issues_1.tapDoneToAsyncGetIssues)(compiler, config, state);
|
|
29
|
-
(0, intercept_done_to_get_dev_server_tap_1.interceptDoneToGetDevServerTap)(compiler, config, state);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
debug('Initializing plugin for watch run (not async).');
|
|
33
|
-
(0, tap_after_compile_to_get_issues_1.tapAfterCompileToGetIssues)(compiler, config, state);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
compiler.hooks.compilation.tap('TsCheckerRspackPlugin', async (compilation) => {
|
|
38
|
-
if (compilation.compiler !== compiler) {
|
|
39
|
-
// run only for the compiler that the plugin was registered for
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
// get current iteration number
|
|
43
|
-
const iteration = ++state.iteration;
|
|
44
|
-
// abort previous iteration
|
|
45
|
-
if (state.abortController) {
|
|
46
|
-
debug(`Aborting iteration ${iteration - 1}.`);
|
|
47
|
-
state.abortController.abort();
|
|
48
|
-
}
|
|
49
|
-
// create new abort controller for the new iteration
|
|
50
|
-
const abortController = new AbortController();
|
|
51
|
-
state.abortController = abortController;
|
|
52
|
-
let filesChange = {};
|
|
53
|
-
if (state.watching) {
|
|
54
|
-
filesChange = (0, files_change_1.consumeFilesChange)(compiler);
|
|
55
|
-
log([
|
|
56
|
-
'Calling reporter service for incremental check.',
|
|
57
|
-
` Changed files: ${JSON.stringify(filesChange.changedFiles)}`,
|
|
58
|
-
` Deleted files: ${JSON.stringify(filesChange.deletedFiles)}`,
|
|
59
|
-
].join('\n'));
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
log('Calling reporter service for single check.');
|
|
63
|
-
}
|
|
64
|
-
filesChange = await hooks.start.promise(filesChange, compilation);
|
|
65
|
-
let aggregatedFilesChange = filesChange;
|
|
66
|
-
if (state.aggregatedFilesChange) {
|
|
67
|
-
aggregatedFilesChange = (0, files_change_1.aggregateFilesChanges)([aggregatedFilesChange, filesChange]);
|
|
68
|
-
debug([
|
|
69
|
-
`Aggregating with previous files change, iteration ${iteration}.`,
|
|
70
|
-
` Changed files: ${JSON.stringify(aggregatedFilesChange.changedFiles)}`,
|
|
71
|
-
` Deleted files: ${JSON.stringify(aggregatedFilesChange.deletedFiles)}`,
|
|
72
|
-
].join('\n'));
|
|
73
|
-
}
|
|
74
|
-
state.aggregatedFilesChange = aggregatedFilesChange;
|
|
75
|
-
// submit one at a time for a single compiler
|
|
76
|
-
state.issuesPromise = (state.issuesPromise || Promise.resolve())
|
|
77
|
-
// resolve to undefined on error
|
|
78
|
-
.catch(() => undefined)
|
|
79
|
-
.then(() => {
|
|
80
|
-
// early return
|
|
81
|
-
if (abortController.signal.aborted) {
|
|
82
|
-
return undefined;
|
|
83
|
-
}
|
|
84
|
-
debug(`Submitting the getIssuesWorker to the pool, iteration ${iteration}.`);
|
|
85
|
-
return plugin_pools_1.issuesPool.submit(async () => {
|
|
86
|
-
try {
|
|
87
|
-
debug(`Running the getIssuesWorker, iteration ${iteration}.`);
|
|
88
|
-
const issues = await getIssuesWorker(aggregatedFilesChange, state.watching);
|
|
89
|
-
if (state.aggregatedFilesChange === aggregatedFilesChange) {
|
|
90
|
-
state.aggregatedFilesChange = undefined;
|
|
91
|
-
}
|
|
92
|
-
if (state.abortController === abortController) {
|
|
93
|
-
state.abortController = undefined;
|
|
94
|
-
}
|
|
95
|
-
return issues;
|
|
96
|
-
}
|
|
97
|
-
catch (error) {
|
|
98
|
-
hooks.error.call(error, compilation);
|
|
99
|
-
return undefined;
|
|
100
|
-
}
|
|
101
|
-
finally {
|
|
102
|
-
debug(`The getIssuesWorker finished its job, iteration ${iteration}.`);
|
|
103
|
-
}
|
|
104
|
-
}, abortController.signal);
|
|
105
|
-
});
|
|
106
|
-
debug(`Submitting the getDependenciesWorker to the pool, iteration ${iteration}.`);
|
|
107
|
-
state.dependenciesPromise = plugin_pools_1.dependenciesPool.submit(async () => {
|
|
108
|
-
try {
|
|
109
|
-
debug(`Running the getDependenciesWorker, iteration ${iteration}.`);
|
|
110
|
-
return await getDependenciesWorker(filesChange);
|
|
111
|
-
}
|
|
112
|
-
catch (error) {
|
|
113
|
-
hooks.error.call(error, compilation);
|
|
114
|
-
return undefined;
|
|
115
|
-
}
|
|
116
|
-
finally {
|
|
117
|
-
debug(`The getDependenciesWorker finished its job, iteration ${iteration}.`);
|
|
118
|
-
}
|
|
119
|
-
}); // don't pass abortController.signal because getDependencies() is blocking
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
exports.tapStartToRunWorkers = tapStartToRunWorkers;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tapStopToTerminateWorkers = void 0;
|
|
4
|
-
const infrastructure_logger_1 = require("../infrastructure-logger");
|
|
5
|
-
function tapStopToTerminateWorkers(compiler, getIssuesWorker, getDependenciesWorker, state) {
|
|
6
|
-
const { debug } = (0, infrastructure_logger_1.getInfrastructureLogger)(compiler);
|
|
7
|
-
const terminateWorkers = () => {
|
|
8
|
-
debug('Compiler is going to close - terminating workers...');
|
|
9
|
-
getIssuesWorker.terminate();
|
|
10
|
-
getDependenciesWorker.terminate();
|
|
11
|
-
};
|
|
12
|
-
compiler.hooks.watchClose.tap('TsCheckerRspackPlugin', () => {
|
|
13
|
-
terminateWorkers();
|
|
14
|
-
});
|
|
15
|
-
compiler.hooks.done.tap('TsCheckerRspackPlugin', () => {
|
|
16
|
-
if (!state.watching) {
|
|
17
|
-
terminateWorkers();
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
compiler.hooks.failed.tap('TsCheckerRspackPlugin', () => {
|
|
21
|
-
if (!state.watching) {
|
|
22
|
-
terminateWorkers();
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
exports.tapStopToTerminateWorkers = tapStopToTerminateWorkers;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getInfrastructureLogger = void 0;
|
|
4
|
-
function getInfrastructureLogger(compiler) {
|
|
5
|
-
const logger = compiler.getInfrastructureLogger('TsCheckerRspackPlugin');
|
|
6
|
-
return {
|
|
7
|
-
log: logger.log.bind(logger),
|
|
8
|
-
debug: logger.debug.bind(logger),
|
|
9
|
-
error: logger.error.bind(logger),
|
|
10
|
-
warn: logger.warn.bind(logger),
|
|
11
|
-
info: logger.info.bind(logger),
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
exports.getInfrastructureLogger = getInfrastructureLogger;
|
package/lib/issue/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
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./issue"), exports);
|
|
18
|
-
__exportStar(require("./issue-severity"), exports);
|
|
19
|
-
__exportStar(require("./issue-location"), exports);
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createIssueConfig = void 0;
|
|
4
|
-
const issue_match_1 = require("./issue-match");
|
|
5
|
-
const issue_predicate_1 = require("./issue-predicate");
|
|
6
|
-
function createIssuePredicateFromOption(context, option) {
|
|
7
|
-
if (Array.isArray(option)) {
|
|
8
|
-
return (0, issue_predicate_1.composeIssuePredicates)(option.map((option) => typeof option === 'function' ? option : (0, issue_match_1.createIssuePredicateFromIssueMatch)(context, option)));
|
|
9
|
-
}
|
|
10
|
-
return typeof option === 'function'
|
|
11
|
-
? option
|
|
12
|
-
: (0, issue_match_1.createIssuePredicateFromIssueMatch)(context, option);
|
|
13
|
-
}
|
|
14
|
-
function createIssueConfig(compiler, options) {
|
|
15
|
-
const context = compiler.options.context || process.cwd();
|
|
16
|
-
if (!options) {
|
|
17
|
-
options = {};
|
|
18
|
-
}
|
|
19
|
-
const include = options.include
|
|
20
|
-
? createIssuePredicateFromOption(context, options.include)
|
|
21
|
-
: (0, issue_predicate_1.createTrivialIssuePredicate)(true);
|
|
22
|
-
const exclude = options.exclude
|
|
23
|
-
? createIssuePredicateFromOption(context, options.exclude)
|
|
24
|
-
: (0, issue_predicate_1.createTrivialIssuePredicate)(false);
|
|
25
|
-
return {
|
|
26
|
-
predicate: (issue) => include(issue) && !exclude(issue),
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
exports.createIssueConfig = createIssueConfig;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatIssueLocation = exports.compareIssueLocations = void 0;
|
|
4
|
-
const issue_position_1 = require("./issue-position");
|
|
5
|
-
function compareIssueLocations(locationA, locationB) {
|
|
6
|
-
if (locationA === locationB) {
|
|
7
|
-
return 0;
|
|
8
|
-
}
|
|
9
|
-
if (!locationA) {
|
|
10
|
-
return -1;
|
|
11
|
-
}
|
|
12
|
-
if (!locationB) {
|
|
13
|
-
return 1;
|
|
14
|
-
}
|
|
15
|
-
return ((0, issue_position_1.compareIssuePositions)(locationA.start, locationB.start) ||
|
|
16
|
-
(0, issue_position_1.compareIssuePositions)(locationA.end, locationB.end));
|
|
17
|
-
}
|
|
18
|
-
exports.compareIssueLocations = compareIssueLocations;
|
|
19
|
-
function formatIssueLocation(location) {
|
|
20
|
-
return `${location.start.line}:${location.start.column}`;
|
|
21
|
-
}
|
|
22
|
-
exports.formatIssueLocation = formatIssueLocation;
|
package/lib/issue/issue-match.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createIssuePredicateFromIssueMatch = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const minimatch_1 = require("minimatch");
|
|
9
|
-
const forward_slash_1 = require("../utils/path/forward-slash");
|
|
10
|
-
function createIssuePredicateFromIssueMatch(context, match) {
|
|
11
|
-
return (issue) => {
|
|
12
|
-
const matchesSeverity = !match.severity || match.severity === issue.severity;
|
|
13
|
-
const matchesCode = !match.code || match.code === issue.code;
|
|
14
|
-
const matchesFile = !issue.file ||
|
|
15
|
-
(!!issue.file &&
|
|
16
|
-
(!match.file || (0, minimatch_1.minimatch)((0, forward_slash_1.forwardSlash)(path_1.default.relative(context, issue.file)), match.file)));
|
|
17
|
-
return matchesSeverity && matchesCode && matchesFile;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
exports.createIssuePredicateFromIssueMatch = createIssuePredicateFromIssueMatch;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.compareIssuePositions = void 0;
|
|
4
|
-
function compareIssuePositions(positionA, positionB) {
|
|
5
|
-
if (positionA === positionB) {
|
|
6
|
-
return 0;
|
|
7
|
-
}
|
|
8
|
-
if (!positionA) {
|
|
9
|
-
return -1;
|
|
10
|
-
}
|
|
11
|
-
if (!positionB) {
|
|
12
|
-
return 1;
|
|
13
|
-
}
|
|
14
|
-
return (Math.sign(positionA.line - positionB.line) || Math.sign(positionA.column - positionB.column));
|
|
15
|
-
}
|
|
16
|
-
exports.compareIssuePositions = compareIssuePositions;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.composeIssuePredicates = exports.createTrivialIssuePredicate = void 0;
|
|
4
|
-
function createTrivialIssuePredicate(result) {
|
|
5
|
-
return () => result;
|
|
6
|
-
}
|
|
7
|
-
exports.createTrivialIssuePredicate = createTrivialIssuePredicate;
|
|
8
|
-
function composeIssuePredicates(predicates) {
|
|
9
|
-
return (issue) => predicates.some((predicate) => predicate(issue));
|
|
10
|
-
}
|
|
11
|
-
exports.composeIssuePredicates = composeIssuePredicates;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.compareIssueSeverities = exports.isIssueSeverity = void 0;
|
|
4
|
-
function isIssueSeverity(value) {
|
|
5
|
-
return ['error', 'warning'].includes(value);
|
|
6
|
-
}
|
|
7
|
-
exports.isIssueSeverity = isIssueSeverity;
|
|
8
|
-
function compareIssueSeverities(severityA, severityB) {
|
|
9
|
-
const [priorityA, priorityB] = [severityA, severityB].map((severity) => ['warning' /* 0 */, 'error' /* 1 */].indexOf(severity));
|
|
10
|
-
return Math.sign(priorityB - priorityA);
|
|
11
|
-
}
|
|
12
|
-
exports.compareIssueSeverities = compareIssueSeverities;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.IssueWebpackError = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const forward_slash_1 = require("../utils/path/forward-slash");
|
|
9
|
-
const relative_to_context_1 = require("../utils/path/relative-to-context");
|
|
10
|
-
const issue_location_1 = require("./issue-location");
|
|
11
|
-
class IssueWebpackError extends Error {
|
|
12
|
-
constructor(message, pathType, issue) {
|
|
13
|
-
super(message);
|
|
14
|
-
this.issue = issue;
|
|
15
|
-
this.hideStack = true;
|
|
16
|
-
// to display issue location using `loc` property, Rspack requires `error.module` which
|
|
17
|
-
// should be a NormalModule instance.
|
|
18
|
-
// to avoid such a dependency, we do a workaround - error.file will contain formatted location instead
|
|
19
|
-
if (issue.file) {
|
|
20
|
-
this.file =
|
|
21
|
-
pathType === 'absolute'
|
|
22
|
-
? (0, forward_slash_1.forwardSlash)(path_1.default.resolve(issue.file))
|
|
23
|
-
: (0, relative_to_context_1.relativeToContext)(issue.file, process.cwd());
|
|
24
|
-
if (issue.location) {
|
|
25
|
-
this.file += `:${(0, issue_location_1.formatIssueLocation)(issue.location)}`;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
Error.captureStackTrace(this, this.constructor);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.IssueWebpackError = IssueWebpackError;
|
package/lib/issue/issue.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deduplicateAndSortIssues = exports.isIssue = void 0;
|
|
4
|
-
const issue_location_1 = require("./issue-location");
|
|
5
|
-
const issue_severity_1 = require("./issue-severity");
|
|
6
|
-
function isIssue(value) {
|
|
7
|
-
return (!!value &&
|
|
8
|
-
typeof value === 'object' &&
|
|
9
|
-
(0, issue_severity_1.isIssueSeverity)(value.severity) &&
|
|
10
|
-
!!value.code &&
|
|
11
|
-
!!value.message);
|
|
12
|
-
}
|
|
13
|
-
exports.isIssue = isIssue;
|
|
14
|
-
function compareStrings(stringA, stringB) {
|
|
15
|
-
if (stringA === stringB) {
|
|
16
|
-
return 0;
|
|
17
|
-
}
|
|
18
|
-
if (stringA === undefined || stringA === null) {
|
|
19
|
-
return -1;
|
|
20
|
-
}
|
|
21
|
-
if (stringB === undefined || stringB === null) {
|
|
22
|
-
return 1;
|
|
23
|
-
}
|
|
24
|
-
return stringA.toString().localeCompare(stringB.toString());
|
|
25
|
-
}
|
|
26
|
-
function compareIssues(issueA, issueB) {
|
|
27
|
-
return ((0, issue_severity_1.compareIssueSeverities)(issueA.severity, issueB.severity) ||
|
|
28
|
-
compareStrings(issueA.file, issueB.file) ||
|
|
29
|
-
(0, issue_location_1.compareIssueLocations)(issueA.location, issueB.location) ||
|
|
30
|
-
compareStrings(issueA.code, issueB.code) ||
|
|
31
|
-
compareStrings(issueA.message, issueB.message) ||
|
|
32
|
-
0 /* EqualTo */);
|
|
33
|
-
}
|
|
34
|
-
function equalsIssues(issueA, issueB) {
|
|
35
|
-
return compareIssues(issueA, issueB) === 0;
|
|
36
|
-
}
|
|
37
|
-
function deduplicateAndSortIssues(issues) {
|
|
38
|
-
const sortedIssues = issues.filter(isIssue).sort(compareIssues);
|
|
39
|
-
return sortedIssues.filter((issue, index) => index === 0 || !equalsIssues(issue, sortedIssues[index - 1]));
|
|
40
|
-
}
|
|
41
|
-
exports.deduplicateAndSortIssues = deduplicateAndSortIssues;
|
package/lib/logger.js
DELETED
package/lib/plugin-config.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPluginConfig = void 0;
|
|
4
|
-
const formatter_1 = require("./formatter");
|
|
5
|
-
const infrastructure_logger_1 = require("./infrastructure-logger");
|
|
6
|
-
const issue_config_1 = require("./issue/issue-config");
|
|
7
|
-
const type_script_worker_config_1 = require("./typescript/type-script-worker-config");
|
|
8
|
-
function createPluginConfig(compiler, options = {}) {
|
|
9
|
-
return {
|
|
10
|
-
async: options.async === undefined ? compiler.options.mode === 'development' : options.async,
|
|
11
|
-
typescript: (0, type_script_worker_config_1.createTypeScriptWorkerConfig)(compiler, options.typescript),
|
|
12
|
-
issue: (0, issue_config_1.createIssueConfig)(compiler, options.issue),
|
|
13
|
-
formatter: (0, formatter_1.createFormatterConfig)(options.formatter),
|
|
14
|
-
logger: options.logger === 'webpack-infrastructure'
|
|
15
|
-
? (() => {
|
|
16
|
-
const { info, error } = (0, infrastructure_logger_1.getInfrastructureLogger)(compiler);
|
|
17
|
-
return {
|
|
18
|
-
log: info,
|
|
19
|
-
error,
|
|
20
|
-
};
|
|
21
|
-
})()
|
|
22
|
-
: options.logger || console,
|
|
23
|
-
devServer: options.devServer !== false,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
exports.createPluginConfig = createPluginConfig;
|
package/lib/plugin-hooks.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPluginHooks = void 0;
|
|
4
|
-
const lite_tapable_1 = require("@rspack/lite-tapable");
|
|
5
|
-
const compilerHookMap = new WeakMap();
|
|
6
|
-
function createPluginHooks() {
|
|
7
|
-
return {
|
|
8
|
-
start: new lite_tapable_1.AsyncSeriesWaterfallHook([
|
|
9
|
-
'change',
|
|
10
|
-
'compilation',
|
|
11
|
-
]),
|
|
12
|
-
waiting: new lite_tapable_1.SyncHook(['compilation']),
|
|
13
|
-
canceled: new lite_tapable_1.SyncHook(['compilation']),
|
|
14
|
-
error: new lite_tapable_1.SyncHook(['error', 'compilation']),
|
|
15
|
-
issues: new lite_tapable_1.SyncWaterfallHook([
|
|
16
|
-
'issues',
|
|
17
|
-
'compilation',
|
|
18
|
-
]),
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
function forwardPluginHooks(source, target) {
|
|
22
|
-
source.start.tapPromise('TsCheckerRspackPlugin', target.start.promise);
|
|
23
|
-
source.waiting.tap('TsCheckerRspackPlugin', target.waiting.call);
|
|
24
|
-
source.canceled.tap('TsCheckerRspackPlugin', target.canceled.call);
|
|
25
|
-
source.error.tap('TsCheckerRspackPlugin', target.error.call);
|
|
26
|
-
source.issues.tap('TsCheckerRspackPlugin', target.issues.call);
|
|
27
|
-
}
|
|
28
|
-
function getPluginHooks(compiler) {
|
|
29
|
-
let hooks = compilerHookMap.get(compiler);
|
|
30
|
-
if (hooks === undefined) {
|
|
31
|
-
hooks = createPluginHooks();
|
|
32
|
-
compilerHookMap.set(compiler, hooks);
|
|
33
|
-
// proxy hooks for multi-compiler
|
|
34
|
-
if ('compilers' in compiler) {
|
|
35
|
-
compiler.compilers.forEach((childCompiler) => {
|
|
36
|
-
const childHooks = getPluginHooks(childCompiler);
|
|
37
|
-
if (hooks) {
|
|
38
|
-
forwardPluginHooks(childHooks, hooks);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return hooks;
|
|
44
|
-
}
|
|
45
|
-
exports.getPluginHooks = getPluginHooks;
|
package/lib/plugin-options.js
DELETED
package/lib/plugin-pools.js
DELETED
|
@@ -1,32 +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
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.dependenciesPool = exports.issuesPool = void 0;
|
|
27
|
-
const os = __importStar(require("os"));
|
|
28
|
-
const pool_1 = require("./utils/async/pool");
|
|
29
|
-
const issuesPool = (0, pool_1.createPool)(Math.max(1, os.cpus().length));
|
|
30
|
-
exports.issuesPool = issuesPool;
|
|
31
|
-
const dependenciesPool = (0, pool_1.createPool)(Math.max(1, os.cpus().length));
|
|
32
|
-
exports.dependenciesPool = dependenciesPool;
|
package/lib/plugin-state.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPluginState = void 0;
|
|
4
|
-
function createPluginState() {
|
|
5
|
-
return {
|
|
6
|
-
issuesPromise: Promise.resolve(undefined),
|
|
7
|
-
dependenciesPromise: Promise.resolve(undefined),
|
|
8
|
-
abortController: undefined,
|
|
9
|
-
aggregatedFilesChange: undefined,
|
|
10
|
-
lastDependencies: undefined,
|
|
11
|
-
watching: false,
|
|
12
|
-
initialized: false,
|
|
13
|
-
iteration: 0,
|
|
14
|
-
DevServerDoneTap: undefined,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
exports.createPluginState = createPluginState;
|