ts-checker-rspack-plugin 1.1.7 → 1.2.0
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/getDependenciesWorker.js +652 -0
- package/lib/getIssuesWorker.js +1091 -0
- package/lib/index.js +970 -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/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 +9 -8
- 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,183 +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.InclusiveNodeWatchFileSystem = exports.createIsIgnored = void 0;
|
|
7
|
-
const path_1 = require("path");
|
|
8
|
-
const chokidar_1 = __importDefault(require("chokidar"));
|
|
9
|
-
const minimatch_1 = require("minimatch");
|
|
10
|
-
const is_glob_1 = __importDefault(require("is-glob"));
|
|
11
|
-
const files_change_1 = require("../files-change");
|
|
12
|
-
const infrastructure_logger_1 = require("../infrastructure-logger");
|
|
13
|
-
const is_inside_another_path_1 = require("../utils/path/is-inside-another-path");
|
|
14
|
-
const BUILTIN_IGNORED_DIRS = ['.git'];
|
|
15
|
-
function createIsIgnored(ignored, excluded) {
|
|
16
|
-
const ignoredPatterns = ignored ? (Array.isArray(ignored) ? [...ignored] : [ignored]) : [];
|
|
17
|
-
const filteredExcluded = excluded.filter((pattern) => {
|
|
18
|
-
// Use `minimatch` to check if the path is a glob pattern.
|
|
19
|
-
if ((0, is_glob_1.default)(pattern)) {
|
|
20
|
-
// Append `/**` to the pattern to align minimatch's behavior
|
|
21
|
-
// with the `exclude` option in tsconfig.json.
|
|
22
|
-
const shouldAppendStar = pattern.includes('**') && !pattern.endsWith('*');
|
|
23
|
-
if (shouldAppendStar) {
|
|
24
|
-
ignoredPatterns.push(pattern.endsWith('/') ? `${pattern}**` : `${pattern}/**`);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
ignoredPatterns.push(pattern);
|
|
28
|
-
}
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
return true;
|
|
32
|
-
});
|
|
33
|
-
const ignoredFunctions = ignoredPatterns.map((pattern) => {
|
|
34
|
-
// ensure patterns are valid - see https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/594
|
|
35
|
-
if (typeof pattern === 'string') {
|
|
36
|
-
return (path) => (0, minimatch_1.minimatch)(path, pattern);
|
|
37
|
-
}
|
|
38
|
-
else if (pattern instanceof RegExp) {
|
|
39
|
-
return (path) => pattern.test(path);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
// fallback to no-ignore function
|
|
43
|
-
return () => false;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
ignoredFunctions.push((path) => filteredExcluded.some((excludedPath) => (0, is_inside_another_path_1.isInsideAnotherPath)(excludedPath, path)));
|
|
47
|
-
ignoredFunctions.push((path) => BUILTIN_IGNORED_DIRS.some((ignoredDir) => path.includes(`/${ignoredDir}/`) || path.includes(`\\${ignoredDir}\\`)));
|
|
48
|
-
return function isIgnored(path) {
|
|
49
|
-
return ignoredFunctions.some((ignoredFunction) => ignoredFunction(path));
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
exports.createIsIgnored = createIsIgnored;
|
|
53
|
-
class InclusiveNodeWatchFileSystem {
|
|
54
|
-
get watcher() {
|
|
55
|
-
return this.watchFileSystem.watcher || this.watchFileSystem.wfs?.watcher;
|
|
56
|
-
}
|
|
57
|
-
constructor(watchFileSystem, compiler, pluginState) {
|
|
58
|
-
this.watchFileSystem = watchFileSystem;
|
|
59
|
-
this.compiler = compiler;
|
|
60
|
-
this.pluginState = pluginState;
|
|
61
|
-
this.paused = true;
|
|
62
|
-
this.watch = (files, dirs, missing, startTime, options, callback, callbackUndelayed) => {
|
|
63
|
-
const { debug } = (0, infrastructure_logger_1.getInfrastructureLogger)(this.compiler);
|
|
64
|
-
(0, files_change_1.clearFilesChange)(this.compiler);
|
|
65
|
-
const isIgnored = createIsIgnored(options?.ignored, this.pluginState.lastDependencies?.excluded || []);
|
|
66
|
-
// use standard watch file system for files and missing
|
|
67
|
-
const standardWatcher = this.watchFileSystem.watch(files, dirs, missing, startTime, options, callback, callbackUndelayed);
|
|
68
|
-
this.watcher?.on('change', (file) => {
|
|
69
|
-
if (typeof file !== 'string') {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
if (!isIgnored(file)) {
|
|
73
|
-
debug('Detected file change', file);
|
|
74
|
-
this.deletedFiles.delete(file);
|
|
75
|
-
(0, files_change_1.updateFilesChange)(this.compiler, { changedFiles: [file] });
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
debug("Detected file change but it's ignored", file);
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
this.watcher?.on('remove', (file) => {
|
|
82
|
-
if (typeof file !== 'string') {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
if (this.deletedFiles.has(file)) {
|
|
86
|
-
debug('Skipping duplicated remove event.');
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
if (!isIgnored(file)) {
|
|
90
|
-
debug('Detected file remove', file);
|
|
91
|
-
this.deletedFiles.add(file);
|
|
92
|
-
(0, files_change_1.updateFilesChange)(this.compiler, { deletedFiles: [file] });
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
debug("Detected file remove but it's ignored", file);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
// calculate what to change
|
|
99
|
-
const prevDirs = Array.from(this.dirsWatchers.keys());
|
|
100
|
-
const nextDirs = Array.from(this.pluginState.lastDependencies?.dirs || []);
|
|
101
|
-
const dirsToUnwatch = prevDirs.filter((prevDir) => !nextDirs.includes(prevDir));
|
|
102
|
-
const dirsToWatch = nextDirs.filter((nextDir) => !prevDirs.includes(nextDir) && !isIgnored(nextDir));
|
|
103
|
-
// update dirs watcher
|
|
104
|
-
dirsToUnwatch.forEach((dirToUnwatch) => {
|
|
105
|
-
this.dirsWatchers.get(dirToUnwatch)?.close();
|
|
106
|
-
this.dirsWatchers.delete(dirToUnwatch);
|
|
107
|
-
});
|
|
108
|
-
dirsToWatch.forEach((dirToWatch) => {
|
|
109
|
-
const interval = typeof options?.poll === 'number' ? options.poll : undefined;
|
|
110
|
-
const dirWatcher = chokidar_1.default.watch(dirToWatch, {
|
|
111
|
-
ignoreInitial: true,
|
|
112
|
-
ignorePermissionErrors: true,
|
|
113
|
-
ignored: (path) => isIgnored(path),
|
|
114
|
-
usePolling: options?.poll ? true : undefined,
|
|
115
|
-
interval: interval,
|
|
116
|
-
binaryInterval: interval,
|
|
117
|
-
alwaysStat: true,
|
|
118
|
-
atomic: true,
|
|
119
|
-
awaitWriteFinish: true,
|
|
120
|
-
});
|
|
121
|
-
dirWatcher.on('add', (file, stats) => {
|
|
122
|
-
if (this.paused) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
const extension = (0, path_1.extname)(file);
|
|
126
|
-
const supportedExtensions = this.pluginState.lastDependencies?.extensions || [];
|
|
127
|
-
if (!supportedExtensions.includes(extension)) {
|
|
128
|
-
debug('Detected new file add but extension is not supported', file);
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
debug('Detected new file add', file);
|
|
132
|
-
this.deletedFiles.delete(file);
|
|
133
|
-
(0, files_change_1.updateFilesChange)(this.compiler, { changedFiles: [file] });
|
|
134
|
-
this.watcher?._onChange(file, stats?.mtimeMs || stats?.ctimeMs || 1, file, 'rename');
|
|
135
|
-
});
|
|
136
|
-
dirWatcher.on('unlink', (file) => {
|
|
137
|
-
if (this.paused) {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
const extension = (0, path_1.extname)(file);
|
|
141
|
-
const supportedExtensions = this.pluginState.lastDependencies?.extensions || [];
|
|
142
|
-
if (!supportedExtensions.includes(extension)) {
|
|
143
|
-
debug('Detected new file remove but extension is not supported', file);
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
if (this.deletedFiles.has(file)) {
|
|
147
|
-
debug('Skipping duplicated unlink event.');
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
debug('Detected new file remove', file);
|
|
151
|
-
this.deletedFiles.add(file);
|
|
152
|
-
(0, files_change_1.updateFilesChange)(this.compiler, { deletedFiles: [file] });
|
|
153
|
-
this.watcher?._onRemove(dirToWatch, file, 'rename');
|
|
154
|
-
});
|
|
155
|
-
this.dirsWatchers.set(dirToWatch, dirWatcher);
|
|
156
|
-
});
|
|
157
|
-
this.paused = false;
|
|
158
|
-
return {
|
|
159
|
-
...standardWatcher,
|
|
160
|
-
close: () => {
|
|
161
|
-
(0, files_change_1.clearFilesChange)(this.compiler);
|
|
162
|
-
if (standardWatcher) {
|
|
163
|
-
standardWatcher.close();
|
|
164
|
-
}
|
|
165
|
-
this.dirsWatchers.forEach((dirWatcher) => {
|
|
166
|
-
dirWatcher?.close();
|
|
167
|
-
});
|
|
168
|
-
this.dirsWatchers.clear();
|
|
169
|
-
this.paused = true;
|
|
170
|
-
},
|
|
171
|
-
pause: () => {
|
|
172
|
-
if (standardWatcher) {
|
|
173
|
-
standardWatcher.pause();
|
|
174
|
-
}
|
|
175
|
-
this.paused = true;
|
|
176
|
-
},
|
|
177
|
-
};
|
|
178
|
-
};
|
|
179
|
-
this.dirsWatchers = new Map();
|
|
180
|
-
this.deletedFiles = new Set();
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
exports.InclusiveNodeWatchFileSystem = InclusiveNodeWatchFileSystem;
|