ts-checker-rspack-plugin 1.1.6 → 1.1.7
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.
|
@@ -2,6 +2,42 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.tapAfterCompileToAddDependencies = void 0;
|
|
4
4
|
const infrastructure_logger_1 = require("../infrastructure-logger");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const addTrailingSep = (dir) => (dir.endsWith(node_path_1.sep) ? dir : dir + node_path_1.sep);
|
|
7
|
+
const isStrictSubdir = (parent, child) => {
|
|
8
|
+
const parentDir = addTrailingSep(parent);
|
|
9
|
+
const childDir = addTrailingSep(child);
|
|
10
|
+
return parentDir !== childDir && childDir.startsWith(parentDir);
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Excludes the Rspack output directory from watched dependencies
|
|
14
|
+
* when the entire project is being watched.
|
|
15
|
+
*
|
|
16
|
+
* If `writeToDisk` is enabled and the build output path is not ignored,
|
|
17
|
+
* emitted files in `output.path` may leading to an infinite rebuild loop.
|
|
18
|
+
**/
|
|
19
|
+
function excludeOutputPath(dependencies, compiler) {
|
|
20
|
+
const isContextIncluded = dependencies.dirs.includes(compiler.context);
|
|
21
|
+
if (!isContextIncluded) {
|
|
22
|
+
return dependencies;
|
|
23
|
+
}
|
|
24
|
+
const outputPath = typeof compiler.options.output?.path === 'string'
|
|
25
|
+
? compiler.options.output.path
|
|
26
|
+
: compiler.outputPath;
|
|
27
|
+
if (!outputPath ||
|
|
28
|
+
// If output path is not a subdir of context, no need to exclude it
|
|
29
|
+
!isStrictSubdir(compiler.context, outputPath) ||
|
|
30
|
+
// If output path is explicitly included in dirs, should not exclude it
|
|
31
|
+
dependencies.dirs.includes(outputPath)) {
|
|
32
|
+
return dependencies;
|
|
33
|
+
}
|
|
34
|
+
const excluded = new Set(dependencies.excluded);
|
|
35
|
+
excluded.add(outputPath);
|
|
36
|
+
return {
|
|
37
|
+
...dependencies,
|
|
38
|
+
excluded: Array.from(excluded),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
5
41
|
function tapAfterCompileToAddDependencies(compiler, config, state) {
|
|
6
42
|
const { debug } = (0, infrastructure_logger_1.getInfrastructureLogger)(compiler);
|
|
7
43
|
compiler.hooks.afterCompile.tapPromise('TsCheckerRspackPlugin', async (compilation) => {
|
|
@@ -12,8 +48,9 @@ function tapAfterCompileToAddDependencies(compiler, config, state) {
|
|
|
12
48
|
const dependencies = await state.dependenciesPromise;
|
|
13
49
|
debug(`Got dependencies from the getDependenciesWorker.`, dependencies);
|
|
14
50
|
if (dependencies) {
|
|
15
|
-
|
|
16
|
-
|
|
51
|
+
const sanitizedDependencies = excludeOutputPath(dependencies, compiler);
|
|
52
|
+
state.lastDependencies = sanitizedDependencies;
|
|
53
|
+
sanitizedDependencies.files.forEach((file) => {
|
|
17
54
|
compilation.fileDependencies.add(file);
|
|
18
55
|
});
|
|
19
56
|
}
|
|
@@ -131,7 +131,7 @@ class InclusiveNodeWatchFileSystem {
|
|
|
131
131
|
debug('Detected new file add', file);
|
|
132
132
|
this.deletedFiles.delete(file);
|
|
133
133
|
(0, files_change_1.updateFilesChange)(this.compiler, { changedFiles: [file] });
|
|
134
|
-
this.watcher?._onChange(
|
|
134
|
+
this.watcher?._onChange(file, stats?.mtimeMs || stats?.ctimeMs || 1, file, 'rename');
|
|
135
135
|
});
|
|
136
136
|
dirWatcher.on('unlink', (file) => {
|
|
137
137
|
if (this.paused) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-checker-rspack-plugin",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"description": "Runs typescript type checker and linter on separate process.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rspack",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@rspack/lite-tapable": "^1.0.1",
|
|
38
38
|
"chokidar": "^3.6.0",
|
|
39
39
|
"is-glob": "^4.0.3",
|
|
40
|
-
"memfs": "^4.
|
|
40
|
+
"memfs": "^4.50.0",
|
|
41
41
|
"minimatch": "^9.0.5",
|
|
42
42
|
"picocolors": "^1.1.1"
|
|
43
43
|
},
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@jest/console": "^27.5.1",
|
|
55
|
-
"@rspack/core": "^1.
|
|
55
|
+
"@rspack/core": "^1.6.0",
|
|
56
56
|
"@types/babel__code-frame": "^7.0.6",
|
|
57
57
|
"@types/is-glob": "^4.0.4",
|
|
58
58
|
"@types/jest": "^27.5.2",
|