fork-ts-checker-webpack-plugin 6.2.9 → 6.2.13
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.js +1 -1
- package/lib/ForkTsCheckerWebpackPluginState.d.ts +3 -3
- package/lib/eslint-reporter/reporter/EsLintReporter.js +1 -0
- package/lib/reporter/FilesMatch.d.ts +7 -0
- package/lib/reporter/{Dependencies.js → FilesMatch.js} +0 -0
- package/lib/reporter/Report.d.ts +2 -2
- package/lib/reporter/index.d.ts +1 -1
- package/lib/reporter/reporter-rpc/ReporterRpcClient.js +13 -3
- package/lib/reporter/reporter-rpc/ReporterRpcProcedure.d.ts +2 -2
- package/lib/typescript-reporter/extension/TypeScriptExtension.d.ts +3 -3
- package/lib/typescript-reporter/file-system/MemFileSystem.d.ts +8 -0
- package/lib/typescript-reporter/file-system/MemFileSystem.js +81 -0
- package/lib/typescript-reporter/file-system/PassiveFileSystem.d.ts +2 -2
- package/lib/typescript-reporter/file-system/PassiveFileSystem.js +10 -72
- package/lib/typescript-reporter/issue/TypeScriptIssueFactory.d.ts +1 -1
- package/lib/typescript-reporter/profile/TypeScriptPerformance.d.ts +1 -1
- package/lib/typescript-reporter/reporter/ControlledTypeScriptSystem.d.ts +3 -1
- package/lib/typescript-reporter/reporter/ControlledTypeScriptSystem.js +43 -14
- package/lib/typescript-reporter/reporter/ControlledWatchCompilerHost.d.ts +1 -1
- package/lib/typescript-reporter/reporter/ControlledWatchSolutionBuilderHost.d.ts +1 -1
- package/lib/typescript-reporter/reporter/ControlledWatchSolutionBuilderHost.js +1 -9
- package/lib/typescript-reporter/reporter/TypeScriptConfigurationParser.d.ts +6 -4
- package/lib/typescript-reporter/reporter/TypeScriptConfigurationParser.js +106 -17
- package/lib/typescript-reporter/reporter/TypeScriptReporter.js +17 -3
- package/lib/watch/InclusiveNodeWatchFileSystem.js +7 -6
- package/package.json +1 -1
- package/lib/reporter/Dependencies.d.ts +0 -6
|
@@ -65,7 +65,7 @@ exports.ForkTsCheckerWebpackPlugin = ForkTsCheckerWebpackPlugin;
|
|
|
65
65
|
/**
|
|
66
66
|
* Current version of the plugin
|
|
67
67
|
*/
|
|
68
|
-
ForkTsCheckerWebpackPlugin.version = '6.2.
|
|
68
|
+
ForkTsCheckerWebpackPlugin.version = '6.2.13'; // will be replaced by the @semantic-release/exec
|
|
69
69
|
/**
|
|
70
70
|
* Default pool for the plugin concurrency limit
|
|
71
71
|
*/
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Tap } from 'tapable';
|
|
2
|
-
import {
|
|
2
|
+
import { FilesMatch, Report } from './reporter';
|
|
3
3
|
import { Issue } from './issue';
|
|
4
4
|
interface ForkTsCheckerWebpackPluginState {
|
|
5
5
|
reportPromise: Promise<Report | undefined>;
|
|
6
6
|
issuesPromise: Promise<Issue[] | undefined>;
|
|
7
|
-
dependenciesPromise: Promise<
|
|
8
|
-
lastDependencies:
|
|
7
|
+
dependenciesPromise: Promise<FilesMatch | undefined>;
|
|
8
|
+
lastDependencies: FilesMatch | undefined;
|
|
9
9
|
watching: boolean;
|
|
10
10
|
initialized: boolean;
|
|
11
11
|
webpackDevServerDoneTap: Tap | undefined;
|
|
File without changes
|
package/lib/reporter/Report.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FilesMatch } from './FilesMatch';
|
|
2
2
|
import { Issue } from '../issue';
|
|
3
3
|
interface Report {
|
|
4
|
-
getDependencies(): Promise<
|
|
4
|
+
getDependencies(): Promise<FilesMatch>;
|
|
5
5
|
getIssues(): Promise<Issue[]>;
|
|
6
6
|
close(): Promise<void>;
|
|
7
7
|
}
|
package/lib/reporter/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ export * from './Report';
|
|
|
2
2
|
export * from './Reporter';
|
|
3
3
|
export * from './AggregatedReporter';
|
|
4
4
|
export * from './FilesChange';
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './FilesMatch';
|
|
6
6
|
export * from './reporter-rpc/ReporterRpcClient';
|
|
7
7
|
export * from './reporter-rpc/ReporterRpcService';
|
|
@@ -24,8 +24,17 @@ function createReporterRpcClient(channel, configuration) {
|
|
|
24
24
|
yield channel.open();
|
|
25
25
|
}
|
|
26
26
|
if (!rpcClient.isConnected()) {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
try {
|
|
28
|
+
yield rpcClient.connect();
|
|
29
|
+
yield rpcClient.dispatchCall(ReporterRpcProcedure_1.configure, configuration);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
// connect or configure was not successful -
|
|
33
|
+
// close the reporter and re-throw an error
|
|
34
|
+
yield rpcClient.disconnect();
|
|
35
|
+
yield channel.close();
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
29
38
|
}
|
|
30
39
|
}),
|
|
31
40
|
disconnect: () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -62,8 +71,9 @@ function composeReporterRpcClients(clients) {
|
|
|
62
71
|
getDependencies: () => Promise.all(reports.map((report) => report.getDependencies())).then((dependencies) => dependencies.reduce((mergedDependencies, singleDependencies) => ({
|
|
63
72
|
files: Array.from(new Set([...mergedDependencies.files, ...singleDependencies.files])),
|
|
64
73
|
dirs: Array.from(new Set([...mergedDependencies.dirs, ...singleDependencies.dirs])),
|
|
74
|
+
excluded: Array.from(new Set([...mergedDependencies.excluded, ...singleDependencies.excluded])),
|
|
65
75
|
extensions: Array.from(new Set([...mergedDependencies.extensions, ...singleDependencies.extensions])),
|
|
66
|
-
}), { files: [], dirs: [], extensions: [] })),
|
|
76
|
+
}), { files: [], dirs: [], excluded: [], extensions: [] })),
|
|
67
77
|
getIssues: () => Promise.all(reports.map((report) => report.getIssues())).then((issues) => flatten_1.default(issues)),
|
|
68
78
|
close: () => Promise.all(reports.map((report) => report.close())).then(() => undefined),
|
|
69
79
|
})),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { RpcProcedure } from '../../rpc';
|
|
2
2
|
import { FilesChange } from '../FilesChange';
|
|
3
3
|
import { Issue } from '../../issue';
|
|
4
|
-
import {
|
|
4
|
+
import { FilesMatch } from '../FilesMatch';
|
|
5
5
|
declare const configure: RpcProcedure<object, void>;
|
|
6
6
|
declare const getReport: RpcProcedure<FilesChange, void>;
|
|
7
|
-
declare const getDependencies: RpcProcedure<void,
|
|
7
|
+
declare const getDependencies: RpcProcedure<void, FilesMatch>;
|
|
8
8
|
declare const getIssues: RpcProcedure<void, Issue[]>;
|
|
9
9
|
declare const closeReport: RpcProcedure<void, void>;
|
|
10
10
|
export { configure, getReport, getDependencies, getIssues, closeReport };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as ts from 'typescript';
|
|
1
|
+
import type * as ts from 'typescript';
|
|
2
2
|
import { Issue } from '../../issue';
|
|
3
|
-
import {
|
|
3
|
+
import { FilesMatch } from '../../reporter';
|
|
4
4
|
interface TypeScriptHostExtension {
|
|
5
5
|
extendWatchSolutionBuilderHost?<TProgram extends ts.BuilderProgram, THost extends ts.SolutionBuilderWithWatchHost<TProgram>>(host: THost, parsedCommandLine?: ts.ParsedCommandLine): THost;
|
|
6
6
|
extendWatchCompilerHost?<TProgram extends ts.BuilderProgram, THost extends ts.WatchCompilerHost<TProgram>>(host: THost, parsedCommandLine?: ts.ParsedCommandLine): THost;
|
|
@@ -9,7 +9,7 @@ interface TypeScriptHostExtension {
|
|
|
9
9
|
}
|
|
10
10
|
interface TypeScriptReporterExtension {
|
|
11
11
|
extendIssues?(issues: Issue[]): Issue[];
|
|
12
|
-
extendDependencies?(dependencies:
|
|
12
|
+
extendDependencies?(dependencies: FilesMatch): FilesMatch;
|
|
13
13
|
}
|
|
14
14
|
interface TypeScriptExtension extends TypeScriptHostExtension, TypeScriptReporterExtension {
|
|
15
15
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FileSystem } from './FileSystem';
|
|
2
|
+
/**
|
|
3
|
+
* It's an implementation of FileSystem interface which reads and writes to the in-memory file system.
|
|
4
|
+
*
|
|
5
|
+
* @param realFileSystem
|
|
6
|
+
*/
|
|
7
|
+
declare function createMemFileSystem(realFileSystem: FileSystem): FileSystem;
|
|
8
|
+
export { createMemFileSystem };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const path_1 = require("path");
|
|
4
|
+
const memfs_1 = require("memfs");
|
|
5
|
+
/**
|
|
6
|
+
* It's an implementation of FileSystem interface which reads and writes to the in-memory file system.
|
|
7
|
+
*
|
|
8
|
+
* @param realFileSystem
|
|
9
|
+
*/
|
|
10
|
+
function createMemFileSystem(realFileSystem) {
|
|
11
|
+
function exists(path) {
|
|
12
|
+
return memfs_1.fs.existsSync(realFileSystem.normalizePath(path));
|
|
13
|
+
}
|
|
14
|
+
function readStats(path) {
|
|
15
|
+
return exists(path) ? memfs_1.fs.statSync(realFileSystem.normalizePath(path)) : undefined;
|
|
16
|
+
}
|
|
17
|
+
function readFile(path, encoding) {
|
|
18
|
+
const stats = readStats(path);
|
|
19
|
+
if (stats && stats.isFile()) {
|
|
20
|
+
return memfs_1.fs
|
|
21
|
+
.readFileSync(realFileSystem.normalizePath(path), { encoding: encoding })
|
|
22
|
+
.toString();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function readDir(path) {
|
|
26
|
+
const stats = readStats(path);
|
|
27
|
+
if (stats && stats.isDirectory()) {
|
|
28
|
+
return memfs_1.fs.readdirSync(realFileSystem.normalizePath(path), {
|
|
29
|
+
withFileTypes: true,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
function createDir(path) {
|
|
35
|
+
memfs_1.fs.mkdirSync(realFileSystem.normalizePath(path), { recursive: true });
|
|
36
|
+
}
|
|
37
|
+
function writeFile(path, data) {
|
|
38
|
+
if (!exists(path_1.dirname(path))) {
|
|
39
|
+
createDir(path_1.dirname(path));
|
|
40
|
+
}
|
|
41
|
+
memfs_1.fs.writeFileSync(realFileSystem.normalizePath(path), data);
|
|
42
|
+
}
|
|
43
|
+
function deleteFile(path) {
|
|
44
|
+
if (exists(path)) {
|
|
45
|
+
memfs_1.fs.unlinkSync(realFileSystem.normalizePath(path));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function updateTimes(path, atime, mtime) {
|
|
49
|
+
if (exists(path)) {
|
|
50
|
+
memfs_1.fs.utimesSync(realFileSystem.normalizePath(path), atime, mtime);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return Object.assign(Object.assign({}, realFileSystem), { exists(path) {
|
|
54
|
+
return exists(realFileSystem.realPath(path));
|
|
55
|
+
},
|
|
56
|
+
readFile(path, encoding) {
|
|
57
|
+
return readFile(realFileSystem.realPath(path), encoding);
|
|
58
|
+
},
|
|
59
|
+
readDir(path) {
|
|
60
|
+
return readDir(realFileSystem.realPath(path));
|
|
61
|
+
},
|
|
62
|
+
readStats(path) {
|
|
63
|
+
return readStats(realFileSystem.realPath(path));
|
|
64
|
+
},
|
|
65
|
+
writeFile(path, data) {
|
|
66
|
+
writeFile(realFileSystem.realPath(path), data);
|
|
67
|
+
},
|
|
68
|
+
deleteFile(path) {
|
|
69
|
+
deleteFile(realFileSystem.realPath(path));
|
|
70
|
+
},
|
|
71
|
+
createDir(path) {
|
|
72
|
+
createDir(realFileSystem.realPath(path));
|
|
73
|
+
},
|
|
74
|
+
updateTimes(path, atime, mtime) {
|
|
75
|
+
updateTimes(realFileSystem.realPath(path), atime, mtime);
|
|
76
|
+
},
|
|
77
|
+
clearCache() {
|
|
78
|
+
realFileSystem.clearCache();
|
|
79
|
+
} });
|
|
80
|
+
}
|
|
81
|
+
exports.createMemFileSystem = createMemFileSystem;
|
|
@@ -2,8 +2,8 @@ import { FileSystem } from './FileSystem';
|
|
|
2
2
|
/**
|
|
3
3
|
* It's an implementation of FileSystem interface which reads from the real file system, but write to the in-memory file system.
|
|
4
4
|
*
|
|
5
|
-
* @param
|
|
5
|
+
* @param memFileSystem
|
|
6
6
|
* @param realFileSystem
|
|
7
7
|
*/
|
|
8
|
-
declare function createPassiveFileSystem(
|
|
8
|
+
declare function createPassiveFileSystem(memFileSystem: FileSystem, realFileSystem: FileSystem): FileSystem;
|
|
9
9
|
export { createPassiveFileSystem };
|
|
@@ -1,59 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const path_1 = require("path");
|
|
4
|
-
const memfs_1 = require("memfs");
|
|
5
3
|
/**
|
|
6
4
|
* It's an implementation of FileSystem interface which reads from the real file system, but write to the in-memory file system.
|
|
7
5
|
*
|
|
8
|
-
* @param
|
|
6
|
+
* @param memFileSystem
|
|
9
7
|
* @param realFileSystem
|
|
10
8
|
*/
|
|
11
|
-
function createPassiveFileSystem(
|
|
12
|
-
function normalizePath(path) {
|
|
13
|
-
return caseSensitive ? path_1.normalize(path) : path_1.normalize(path).toLowerCase();
|
|
14
|
-
}
|
|
15
|
-
function memExists(path) {
|
|
16
|
-
return memfs_1.fs.existsSync(normalizePath(path));
|
|
17
|
-
}
|
|
18
|
-
function memReadStats(path) {
|
|
19
|
-
return memExists(path) ? memfs_1.fs.statSync(normalizePath(path)) : undefined;
|
|
20
|
-
}
|
|
21
|
-
function memReadFile(path, encoding) {
|
|
22
|
-
const stats = memReadStats(path);
|
|
23
|
-
if (stats && stats.isFile()) {
|
|
24
|
-
return memfs_1.fs
|
|
25
|
-
.readFileSync(normalizePath(path), { encoding: encoding })
|
|
26
|
-
.toString();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function memReadDir(path) {
|
|
30
|
-
const stats = memReadStats(path);
|
|
31
|
-
if (stats && stats.isDirectory()) {
|
|
32
|
-
return memfs_1.fs.readdirSync(normalizePath(path), { withFileTypes: true });
|
|
33
|
-
}
|
|
34
|
-
return [];
|
|
35
|
-
}
|
|
9
|
+
function createPassiveFileSystem(memFileSystem, realFileSystem) {
|
|
36
10
|
function exists(path) {
|
|
37
|
-
return realFileSystem.exists(path) ||
|
|
11
|
+
return realFileSystem.exists(path) || memFileSystem.exists(path);
|
|
38
12
|
}
|
|
39
13
|
function readFile(path, encoding) {
|
|
40
14
|
const fsStats = realFileSystem.readStats(path);
|
|
41
|
-
const memStats =
|
|
15
|
+
const memStats = memFileSystem.readStats(path);
|
|
42
16
|
if (fsStats && memStats) {
|
|
43
17
|
return fsStats.mtimeMs > memStats.mtimeMs
|
|
44
18
|
? realFileSystem.readFile(path, encoding)
|
|
45
|
-
:
|
|
19
|
+
: memFileSystem.readFile(path, encoding);
|
|
46
20
|
}
|
|
47
21
|
else if (fsStats) {
|
|
48
22
|
return realFileSystem.readFile(path, encoding);
|
|
49
23
|
}
|
|
50
24
|
else if (memStats) {
|
|
51
|
-
return
|
|
25
|
+
return memFileSystem.readFile(path, encoding);
|
|
52
26
|
}
|
|
53
27
|
}
|
|
54
28
|
function readDir(path) {
|
|
55
29
|
const fsDirents = realFileSystem.readDir(path);
|
|
56
|
-
const memDirents =
|
|
30
|
+
const memDirents = memFileSystem.readDir(path);
|
|
57
31
|
// merge list of dirents from fs and mem
|
|
58
32
|
return fsDirents
|
|
59
33
|
.filter((fsDirent) => !memDirents.some((memDirent) => memDirent.name === fsDirent.name))
|
|
@@ -61,7 +35,7 @@ function createPassiveFileSystem(caseSensitive = false, realFileSystem) {
|
|
|
61
35
|
}
|
|
62
36
|
function readStats(path) {
|
|
63
37
|
const fsStats = realFileSystem.readStats(path);
|
|
64
|
-
const memStats =
|
|
38
|
+
const memStats = memFileSystem.readStats(path);
|
|
65
39
|
if (fsStats && memStats) {
|
|
66
40
|
return fsStats.mtimeMs > memStats.mtimeMs ? fsStats : memStats;
|
|
67
41
|
}
|
|
@@ -72,27 +46,7 @@ function createPassiveFileSystem(caseSensitive = false, realFileSystem) {
|
|
|
72
46
|
return memStats;
|
|
73
47
|
}
|
|
74
48
|
}
|
|
75
|
-
|
|
76
|
-
memfs_1.fs.mkdirSync(normalizePath(path), { recursive: true });
|
|
77
|
-
}
|
|
78
|
-
function writeFile(path, data) {
|
|
79
|
-
if (!memExists(path_1.dirname(path))) {
|
|
80
|
-
createDir(path_1.dirname(path));
|
|
81
|
-
}
|
|
82
|
-
memfs_1.fs.writeFileSync(normalizePath(path), data);
|
|
83
|
-
}
|
|
84
|
-
function deleteFile(path) {
|
|
85
|
-
if (memExists(path)) {
|
|
86
|
-
memfs_1.fs.unlinkSync(normalizePath(path));
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
function updateTimes(path, atime, mtime) {
|
|
90
|
-
if (memExists(path)) {
|
|
91
|
-
memfs_1.fs.utimesSync(normalizePath(path), atime, mtime);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return {
|
|
95
|
-
exists(path) {
|
|
49
|
+
return Object.assign(Object.assign({}, memFileSystem), { exists(path) {
|
|
96
50
|
return exists(realFileSystem.realPath(path));
|
|
97
51
|
},
|
|
98
52
|
readFile(path, encoding) {
|
|
@@ -107,24 +61,8 @@ function createPassiveFileSystem(caseSensitive = false, realFileSystem) {
|
|
|
107
61
|
realPath(path) {
|
|
108
62
|
return realFileSystem.realPath(path);
|
|
109
63
|
},
|
|
110
|
-
normalizePath(path) {
|
|
111
|
-
return normalizePath(path);
|
|
112
|
-
},
|
|
113
|
-
writeFile(path, data) {
|
|
114
|
-
writeFile(realFileSystem.realPath(path), data);
|
|
115
|
-
},
|
|
116
|
-
deleteFile(path) {
|
|
117
|
-
deleteFile(realFileSystem.realPath(path));
|
|
118
|
-
},
|
|
119
|
-
createDir(path) {
|
|
120
|
-
createDir(realFileSystem.realPath(path));
|
|
121
|
-
},
|
|
122
|
-
updateTimes(path, atime, mtime) {
|
|
123
|
-
updateTimes(realFileSystem.realPath(path), atime, mtime);
|
|
124
|
-
},
|
|
125
64
|
clearCache() {
|
|
126
65
|
realFileSystem.clearCache();
|
|
127
|
-
}
|
|
128
|
-
};
|
|
66
|
+
} });
|
|
129
67
|
}
|
|
130
68
|
exports.createPassiveFileSystem = createPassiveFileSystem;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import * as ts from 'typescript';
|
|
1
|
+
import type * as ts from 'typescript';
|
|
2
|
+
import { FilesMatch } from '../../reporter';
|
|
2
3
|
interface ControlledTypeScriptSystem extends ts.System {
|
|
3
4
|
invokeFileCreated(path: string): void;
|
|
4
5
|
invokeFileChanged(path: string): void;
|
|
@@ -13,6 +14,7 @@ interface ControlledTypeScriptSystem extends ts.System {
|
|
|
13
14
|
setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): any;
|
|
14
15
|
clearTimeout(timeoutId: any): void;
|
|
15
16
|
waitForQueued(): Promise<void>;
|
|
17
|
+
setArtifacts(artifacts: FilesMatch): void;
|
|
16
18
|
}
|
|
17
19
|
declare type FileSystemMode = 'readonly' | 'write-tsbuildinfo' | 'write-references';
|
|
18
20
|
declare function createControlledTypeScriptSystem(typescript: typeof ts, mode?: FileSystemMode): ControlledTypeScriptSystem;
|
|
@@ -16,7 +16,15 @@ const path_1 = require("path");
|
|
|
16
16
|
const PassiveFileSystem_1 = require("../file-system/PassiveFileSystem");
|
|
17
17
|
const forwardSlash_1 = __importDefault(require("../../utils/path/forwardSlash"));
|
|
18
18
|
const RealFileSystem_1 = require("../file-system/RealFileSystem");
|
|
19
|
+
const MemFileSystem_1 = require("../file-system/MemFileSystem");
|
|
19
20
|
function createControlledTypeScriptSystem(typescript, mode = 'readonly') {
|
|
21
|
+
let artifacts = {
|
|
22
|
+
files: [],
|
|
23
|
+
dirs: [],
|
|
24
|
+
excluded: [],
|
|
25
|
+
extensions: [],
|
|
26
|
+
};
|
|
27
|
+
let isInitialRun = true;
|
|
20
28
|
// watchers
|
|
21
29
|
const fileWatcherCallbacksMap = new Map();
|
|
22
30
|
const directoryWatcherCallbacksMap = new Map();
|
|
@@ -28,7 +36,8 @@ function createControlledTypeScriptSystem(typescript, mode = 'readonly') {
|
|
|
28
36
|
// third-party libraries, like fsevents
|
|
29
37
|
const caseSensitive = true;
|
|
30
38
|
const realFileSystem = RealFileSystem_1.createRealFileSystem(caseSensitive);
|
|
31
|
-
const
|
|
39
|
+
const memFileSystem = MemFileSystem_1.createMemFileSystem(realFileSystem);
|
|
40
|
+
const passiveFileSystem = PassiveFileSystem_1.createPassiveFileSystem(memFileSystem, realFileSystem);
|
|
32
41
|
// based on the ts.ignorePaths
|
|
33
42
|
const ignoredPaths = ['/node_modules/.', '/.git', '/.#'];
|
|
34
43
|
function createWatcher(watchersMap, path, callback) {
|
|
@@ -80,23 +89,35 @@ function createControlledTypeScriptSystem(typescript, mode = 'readonly') {
|
|
|
80
89
|
}
|
|
81
90
|
});
|
|
82
91
|
}
|
|
83
|
-
function
|
|
84
|
-
|
|
85
|
-
|
|
92
|
+
function isArtifact(path) {
|
|
93
|
+
return ((artifacts.dirs.some((dir) => path.includes(dir)) ||
|
|
94
|
+
artifacts.files.some((file) => path === file)) &&
|
|
95
|
+
artifacts.extensions.some((extension) => path.endsWith(extension)));
|
|
96
|
+
}
|
|
97
|
+
function getReadFileSystem(path) {
|
|
98
|
+
if (!isInitialRun &&
|
|
99
|
+
(mode === 'readonly' || mode === 'write-tsbuildinfo') &&
|
|
100
|
+
isArtifact(path)) {
|
|
101
|
+
return memFileSystem;
|
|
86
102
|
}
|
|
87
|
-
|
|
103
|
+
return passiveFileSystem;
|
|
104
|
+
}
|
|
105
|
+
function getWriteFileSystem(path) {
|
|
106
|
+
if (mode === 'write-references' ||
|
|
107
|
+
(mode === 'write-tsbuildinfo' && path.endsWith('.tsbuildinfo'))) {
|
|
88
108
|
return realFileSystem;
|
|
89
109
|
}
|
|
110
|
+
return passiveFileSystem;
|
|
90
111
|
}
|
|
91
112
|
const controlledSystem = Object.assign(Object.assign({}, typescript.sys), { useCaseSensitiveFileNames: caseSensitive, fileExists(path) {
|
|
92
|
-
const stats =
|
|
113
|
+
const stats = getReadFileSystem(path).readStats(path);
|
|
93
114
|
return !!stats && stats.isFile();
|
|
94
115
|
},
|
|
95
116
|
readFile(path, encoding) {
|
|
96
|
-
return
|
|
117
|
+
return getReadFileSystem(path).readFile(path, encoding);
|
|
97
118
|
},
|
|
98
119
|
getFileSize(path) {
|
|
99
|
-
const stats =
|
|
120
|
+
const stats = getReadFileSystem(path).readStats(path);
|
|
100
121
|
return stats ? stats.size : 0;
|
|
101
122
|
},
|
|
102
123
|
writeFile(path, data) {
|
|
@@ -108,19 +129,22 @@ function createControlledTypeScriptSystem(typescript, mode = 'readonly') {
|
|
|
108
129
|
controlledSystem.invokeFileDeleted(path);
|
|
109
130
|
},
|
|
110
131
|
directoryExists(path) {
|
|
111
|
-
|
|
112
|
-
return
|
|
132
|
+
var _a;
|
|
133
|
+
return Boolean((_a = getReadFileSystem(path).readStats(path)) === null || _a === void 0 ? void 0 : _a.isDirectory());
|
|
113
134
|
},
|
|
114
135
|
createDirectory(path) {
|
|
115
136
|
getWriteFileSystem(path).createDir(path);
|
|
116
137
|
invokeDirectoryWatchers(path);
|
|
117
138
|
},
|
|
118
139
|
getDirectories(path) {
|
|
119
|
-
const dirents =
|
|
120
|
-
return dirents
|
|
140
|
+
const dirents = getReadFileSystem(path).readDir(path);
|
|
141
|
+
return dirents
|
|
142
|
+
.filter((dirent) => dirent.isDirectory() ||
|
|
143
|
+
(dirent.isSymbolicLink() && controlledSystem.directoryExists(path_1.join(path, dirent.name))))
|
|
144
|
+
.map((dirent) => dirent.name);
|
|
121
145
|
},
|
|
122
146
|
getModifiedTime(path) {
|
|
123
|
-
const stats =
|
|
147
|
+
const stats = getReadFileSystem(path).readStats(path);
|
|
124
148
|
if (stats) {
|
|
125
149
|
return stats.mtime;
|
|
126
150
|
}
|
|
@@ -152,6 +176,7 @@ function createControlledTypeScriptSystem(typescript, mode = 'readonly') {
|
|
|
152
176
|
while (timeoutCallbacks.size > 0) {
|
|
153
177
|
yield new Promise((resolve) => setImmediate(resolve));
|
|
154
178
|
}
|
|
179
|
+
isInitialRun = false;
|
|
155
180
|
});
|
|
156
181
|
},
|
|
157
182
|
invokeFileCreated(path) {
|
|
@@ -180,8 +205,12 @@ function createControlledTypeScriptSystem(typescript, mode = 'readonly') {
|
|
|
180
205
|
}
|
|
181
206
|
},
|
|
182
207
|
clearCache() {
|
|
183
|
-
passiveFileSystem.clearCache();
|
|
184
208
|
realFileSystem.clearCache();
|
|
209
|
+
memFileSystem.clearCache();
|
|
210
|
+
passiveFileSystem.clearCache();
|
|
211
|
+
},
|
|
212
|
+
setArtifacts(nextArtifacts) {
|
|
213
|
+
artifacts = nextArtifacts;
|
|
185
214
|
} });
|
|
186
215
|
return controlledSystem;
|
|
187
216
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as ts from 'typescript';
|
|
1
|
+
import type * as ts from 'typescript';
|
|
2
2
|
import { TypeScriptHostExtension } from '../extension/TypeScriptExtension';
|
|
3
3
|
import { ControlledTypeScriptSystem } from './ControlledTypeScriptSystem';
|
|
4
4
|
declare function createControlledWatchCompilerHost<TProgram extends ts.BuilderProgram>(typescript: typeof ts, parsedCommandLine: ts.ParsedCommandLine, system: ControlledTypeScriptSystem, createProgram?: ts.CreateProgram<TProgram>, reportDiagnostic?: ts.DiagnosticReporter, reportWatchStatus?: ts.WatchStatusReporter, afterProgramCreate?: (program: TProgram) => void, hostExtensions?: TypeScriptHostExtension[]): ts.WatchCompilerHostOfFilesAndCompilerOptions<TProgram>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as ts from 'typescript';
|
|
1
|
+
import type * as ts from 'typescript';
|
|
2
2
|
import { TypeScriptHostExtension } from '../extension/TypeScriptExtension';
|
|
3
3
|
import { ControlledTypeScriptSystem } from './ControlledTypeScriptSystem';
|
|
4
4
|
declare function createControlledWatchSolutionBuilderHost<TProgram extends ts.BuilderProgram>(typescript: typeof ts, parsedCommandLine: ts.ParsedCommandLine, system: ControlledTypeScriptSystem, createProgram?: ts.CreateProgram<TProgram>, reportDiagnostic?: ts.DiagnosticReporter, reportWatchStatus?: ts.WatchStatusReporter, reportSolutionBuilderStatus?: (diagnostic: ts.Diagnostic) => void, afterProgramCreate?: (program: TProgram) => void, afterProgramEmitAndDiagnostics?: (program: TProgram) => void, hostExtensions?: TypeScriptHostExtension[]): ts.SolutionBuilderWithWatchHost<TProgram>;
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
3
|
-
if (mod && mod.__esModule) return mod;
|
|
4
|
-
var result = {};
|
|
5
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
6
|
-
result["default"] = mod;
|
|
7
|
-
return result;
|
|
8
|
-
};
|
|
9
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
const ts = __importStar(require("typescript"));
|
|
11
3
|
const ControlledWatchCompilerHost_1 = require("./ControlledWatchCompilerHost");
|
|
12
4
|
function createControlledWatchSolutionBuilderHost(typescript, parsedCommandLine, system, createProgram, reportDiagnostic, reportWatchStatus, reportSolutionBuilderStatus, afterProgramCreate, afterProgramEmitAndDiagnostics, hostExtensions = []) {
|
|
13
5
|
const controlledWatchCompilerHost = ControlledWatchCompilerHost_1.createControlledWatchCompilerHost(typescript, parsedCommandLine, system, createProgram, reportDiagnostic, reportWatchStatus, afterProgramCreate, hostExtensions);
|
|
@@ -42,7 +34,7 @@ function createControlledWatchSolutionBuilderHost(typescript, parsedCommandLine,
|
|
|
42
34
|
system.deleteFile(fileName);
|
|
43
35
|
},
|
|
44
36
|
getParsedCommandLine(fileName) {
|
|
45
|
-
return
|
|
37
|
+
return typescript.getParsedCommandLineOfConfigFile(fileName, { skipLibCheck: true }, Object.assign(Object.assign({}, system), { onUnRecoverableConfigFileDiagnostic: (diagnostic) => {
|
|
46
38
|
if (reportDiagnostic) {
|
|
47
39
|
reportDiagnostic(diagnostic);
|
|
48
40
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import * as ts from 'typescript';
|
|
1
|
+
import type * as ts from 'typescript';
|
|
2
2
|
import { TypeScriptConfigurationOverwrite } from '../TypeScriptConfigurationOverwrite';
|
|
3
|
-
import {
|
|
3
|
+
import { FilesMatch } from '../../reporter';
|
|
4
4
|
declare function parseTypeScriptConfiguration(typescript: typeof ts, configFileName: string, configFileContext: string, configOverwriteJSON: TypeScriptConfigurationOverwrite, parseConfigFileHost: ts.ParseConfigFileHost): ts.ParsedCommandLine;
|
|
5
|
-
declare function getDependenciesFromTypeScriptConfiguration(typescript: typeof ts, parsedConfiguration: ts.ParsedCommandLine, configFileContext: string, parseConfigFileHost: ts.ParseConfigFileHost, processedConfigFiles?: string[]):
|
|
6
|
-
export
|
|
5
|
+
declare function getDependenciesFromTypeScriptConfiguration(typescript: typeof ts, parsedConfiguration: ts.ParsedCommandLine, configFileContext: string, parseConfigFileHost: ts.ParseConfigFileHost, processedConfigFiles?: string[]): FilesMatch;
|
|
6
|
+
export declare function isIncrementalCompilation(options: ts.CompilerOptions): boolean;
|
|
7
|
+
declare function getArtifactsFromTypeScriptConfiguration(typescript: typeof ts, parsedConfiguration: ts.ParsedCommandLine, configFileContext: string, parseConfigFileHost: ts.ParseConfigFileHost, processedConfigFiles?: string[]): FilesMatch;
|
|
8
|
+
export { parseTypeScriptConfiguration, getDependenciesFromTypeScriptConfiguration, getArtifactsFromTypeScriptConfiguration, };
|
|
@@ -9,26 +9,28 @@ function parseTypeScriptConfiguration(typescript, configFileName, configFileCont
|
|
|
9
9
|
}
|
|
10
10
|
exports.parseTypeScriptConfiguration = parseTypeScriptConfiguration;
|
|
11
11
|
function getDependenciesFromTypeScriptConfiguration(typescript, parsedConfiguration, configFileContext, parseConfigFileHost, processedConfigFiles = []) {
|
|
12
|
+
var _a;
|
|
12
13
|
const files = new Set(parsedConfiguration.fileNames);
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
const configFilePath = parsedConfiguration.options.configFilePath;
|
|
15
|
+
if (typeof configFilePath === 'string') {
|
|
16
|
+
files.add(configFilePath);
|
|
15
17
|
}
|
|
16
18
|
const dirs = new Set(Object.keys(parsedConfiguration.wildcardDirectories || {}));
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
19
|
+
const excluded = new Set((((_a = parsedConfiguration.raw) === null || _a === void 0 ? void 0 : _a.exclude) || []).map((path) => path_1.resolve(configFileContext, path)));
|
|
20
|
+
for (const projectReference of parsedConfiguration.projectReferences || []) {
|
|
21
|
+
const childConfigFilePath = typescript.resolveProjectReferencePath(projectReference);
|
|
22
|
+
const childConfigContext = path_1.dirname(childConfigFilePath);
|
|
23
|
+
if (processedConfigFiles.includes(childConfigFilePath)) {
|
|
24
|
+
// handle circular dependencies
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
const childParsedConfiguration = parseTypeScriptConfiguration(typescript, childConfigFilePath, childConfigContext, {}, parseConfigFileHost);
|
|
28
|
+
const childDependencies = getDependenciesFromTypeScriptConfiguration(typescript, childParsedConfiguration, childConfigContext, parseConfigFileHost, [...processedConfigFiles, childConfigFilePath]);
|
|
29
|
+
childDependencies.files.forEach((file) => {
|
|
30
|
+
files.add(file);
|
|
31
|
+
});
|
|
32
|
+
childDependencies.dirs.forEach((dir) => {
|
|
33
|
+
dirs.add(dir);
|
|
32
34
|
});
|
|
33
35
|
}
|
|
34
36
|
const extensions = [
|
|
@@ -41,7 +43,94 @@ function getDependenciesFromTypeScriptConfiguration(typescript, parsedConfigurat
|
|
|
41
43
|
return {
|
|
42
44
|
files: Array.from(files).map((file) => path_1.normalize(file)),
|
|
43
45
|
dirs: Array.from(dirs).map((dir) => path_1.normalize(dir)),
|
|
46
|
+
excluded: Array.from(excluded).map((path) => path_1.normalize(path)),
|
|
44
47
|
extensions: extensions,
|
|
45
48
|
};
|
|
46
49
|
}
|
|
47
50
|
exports.getDependenciesFromTypeScriptConfiguration = getDependenciesFromTypeScriptConfiguration;
|
|
51
|
+
function isIncrementalCompilation(options) {
|
|
52
|
+
return Boolean((options.incremental || options.composite) && !options.outFile);
|
|
53
|
+
}
|
|
54
|
+
exports.isIncrementalCompilation = isIncrementalCompilation;
|
|
55
|
+
function removeJsonExtension(path) {
|
|
56
|
+
if (path.endsWith('.json')) {
|
|
57
|
+
return path.slice(0, -'.json'.length);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
return path;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function getTsBuildInfoEmitOutputFilePath(typescript, options) {
|
|
64
|
+
if (typeof typescript.getTsBuildInfoEmitOutputFilePath === 'function') {
|
|
65
|
+
// old TypeScript version doesn't provides this method
|
|
66
|
+
return typescript.getTsBuildInfoEmitOutputFilePath(options);
|
|
67
|
+
}
|
|
68
|
+
// based on the implementation from typescript
|
|
69
|
+
const configFile = options.configFilePath;
|
|
70
|
+
if (!isIncrementalCompilation(options)) {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
if (options.tsBuildInfoFile) {
|
|
74
|
+
return options.tsBuildInfoFile;
|
|
75
|
+
}
|
|
76
|
+
const outPath = options.outFile || options.out;
|
|
77
|
+
let buildInfoExtensionLess;
|
|
78
|
+
if (outPath) {
|
|
79
|
+
buildInfoExtensionLess = removeJsonExtension(outPath);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
if (!configFile) {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
const configFileExtensionLess = removeJsonExtension(configFile);
|
|
86
|
+
buildInfoExtensionLess = options.outDir
|
|
87
|
+
? options.rootDir
|
|
88
|
+
? path_1.resolve(options.outDir, path_1.relative(options.rootDir, configFileExtensionLess))
|
|
89
|
+
: path_1.resolve(options.outDir, path_1.basename(configFileExtensionLess))
|
|
90
|
+
: configFileExtensionLess;
|
|
91
|
+
}
|
|
92
|
+
return buildInfoExtensionLess + '.tsbuildinfo';
|
|
93
|
+
}
|
|
94
|
+
function getArtifactsFromTypeScriptConfiguration(typescript, parsedConfiguration, configFileContext, parseConfigFileHost, processedConfigFiles = []) {
|
|
95
|
+
const files = new Set();
|
|
96
|
+
const dirs = new Set();
|
|
97
|
+
if (parsedConfiguration.fileNames.length > 0) {
|
|
98
|
+
if (parsedConfiguration.options.outFile) {
|
|
99
|
+
files.add(path_1.resolve(configFileContext, parsedConfiguration.options.outFile));
|
|
100
|
+
}
|
|
101
|
+
const tsBuildInfoPath = getTsBuildInfoEmitOutputFilePath(typescript, parsedConfiguration.options);
|
|
102
|
+
if (tsBuildInfoPath) {
|
|
103
|
+
files.add(path_1.resolve(configFileContext, tsBuildInfoPath));
|
|
104
|
+
}
|
|
105
|
+
if (parsedConfiguration.options.outDir) {
|
|
106
|
+
dirs.add(path_1.resolve(configFileContext, parsedConfiguration.options.outDir));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
for (const projectReference of parsedConfiguration.projectReferences || []) {
|
|
110
|
+
const configFile = typescript.resolveProjectReferencePath(projectReference);
|
|
111
|
+
if (processedConfigFiles.includes(configFile)) {
|
|
112
|
+
// handle circular dependencies
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
const parsedConfiguration = parseTypeScriptConfiguration(typescript, configFile, path_1.dirname(configFile), {}, parseConfigFileHost);
|
|
116
|
+
const childArtifacts = getArtifactsFromTypeScriptConfiguration(typescript, parsedConfiguration, configFileContext, parseConfigFileHost, [...processedConfigFiles, configFile]);
|
|
117
|
+
childArtifacts.files.forEach((file) => {
|
|
118
|
+
files.add(file);
|
|
119
|
+
});
|
|
120
|
+
childArtifacts.dirs.forEach((dir) => {
|
|
121
|
+
dirs.add(dir);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
const extensions = [
|
|
125
|
+
typescript.Extension.Dts,
|
|
126
|
+
typescript.Extension.Js,
|
|
127
|
+
typescript.Extension.TsBuildInfo,
|
|
128
|
+
];
|
|
129
|
+
return {
|
|
130
|
+
files: Array.from(files).map((file) => path_1.normalize(file)),
|
|
131
|
+
dirs: Array.from(dirs).map((dir) => path_1.normalize(dir)),
|
|
132
|
+
excluded: [],
|
|
133
|
+
extensions,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
exports.getArtifactsFromTypeScriptConfiguration = getArtifactsFromTypeScriptConfiguration;
|
|
@@ -25,6 +25,7 @@ function createTypeScriptReporter(configuration) {
|
|
|
25
25
|
let parsedConfiguration;
|
|
26
26
|
let parseConfigurationDiagnostics = [];
|
|
27
27
|
let dependencies;
|
|
28
|
+
let artifacts;
|
|
28
29
|
let configurationChanged = false;
|
|
29
30
|
let watchCompilerHost;
|
|
30
31
|
let watchSolutionBuilderHost;
|
|
@@ -77,8 +78,7 @@ function createTypeScriptReporter(configuration) {
|
|
|
77
78
|
function emitTsBuildInfoFileForBuilderProgram(builderProgram) {
|
|
78
79
|
if (configuration.mode !== 'readonly' &&
|
|
79
80
|
parsedConfiguration &&
|
|
80
|
-
parsedConfiguration.options
|
|
81
|
-
!parsedConfiguration.options.outFile) {
|
|
81
|
+
TypeScriptConfigurationParser_1.isIncrementalCompilation(parsedConfiguration.options)) {
|
|
82
82
|
const program = builderProgram.getProgram();
|
|
83
83
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
84
84
|
if (typeof program.emitBuildInfo === 'function') {
|
|
@@ -124,6 +124,17 @@ function createTypeScriptReporter(configuration) {
|
|
|
124
124
|
}
|
|
125
125
|
return dependencies;
|
|
126
126
|
}
|
|
127
|
+
function getArtifacts() {
|
|
128
|
+
parsedConfiguration = parseConfigurationIfNeeded();
|
|
129
|
+
const [parseConfigFileHost] = getParseConfigFileHost();
|
|
130
|
+
return TypeScriptConfigurationParser_1.getArtifactsFromTypeScriptConfiguration(typescript, parsedConfiguration, configuration.context, parseConfigFileHost);
|
|
131
|
+
}
|
|
132
|
+
function getArtifactsIfNeeded() {
|
|
133
|
+
if (!artifacts) {
|
|
134
|
+
artifacts = getArtifacts();
|
|
135
|
+
}
|
|
136
|
+
return artifacts;
|
|
137
|
+
}
|
|
127
138
|
function startProfilingIfNeeded() {
|
|
128
139
|
if (configuration.profile) {
|
|
129
140
|
performance.enable();
|
|
@@ -165,6 +176,7 @@ function createTypeScriptReporter(configuration) {
|
|
|
165
176
|
// we need to re-create programs
|
|
166
177
|
parsedConfiguration = undefined;
|
|
167
178
|
dependencies = undefined;
|
|
179
|
+
artifacts = undefined;
|
|
168
180
|
watchCompilerHost = undefined;
|
|
169
181
|
watchSolutionBuilderHost = undefined;
|
|
170
182
|
watchProgram = undefined;
|
|
@@ -178,12 +190,14 @@ function createTypeScriptReporter(configuration) {
|
|
|
178
190
|
if (previousParsedConfiguration &&
|
|
179
191
|
JSON.stringify(previousParsedConfiguration.fileNames) !==
|
|
180
192
|
JSON.stringify(parsedConfiguration.fileNames)) {
|
|
181
|
-
// root files changed - we need to recompute dependencies
|
|
193
|
+
// root files changed - we need to recompute dependencies and artifacts
|
|
182
194
|
dependencies = getDependencies();
|
|
195
|
+
artifacts = getArtifacts();
|
|
183
196
|
shouldUpdateRootFiles = true;
|
|
184
197
|
}
|
|
185
198
|
}
|
|
186
199
|
parsedConfiguration = parseConfigurationIfNeeded();
|
|
200
|
+
system.setArtifacts(getArtifactsIfNeeded());
|
|
187
201
|
if (configurationChanged) {
|
|
188
202
|
configurationChanged = false;
|
|
189
203
|
// try to remove outdated .tsbuildinfo file for incremental mode
|
|
@@ -8,7 +8,7 @@ const path_1 = require("path");
|
|
|
8
8
|
const reporter_1 = require("../reporter");
|
|
9
9
|
const minimatch_1 = __importDefault(require("minimatch"));
|
|
10
10
|
const BUILTIN_IGNORED_DIRS = ['node_modules', '.git', '.yarn', '.pnp'];
|
|
11
|
-
function createIsIgnored(ignored) {
|
|
11
|
+
function createIsIgnored(ignored, excluded) {
|
|
12
12
|
const ignoredPatterns = ignored ? (Array.isArray(ignored) ? ignored : [ignored]) : [];
|
|
13
13
|
const ignoredFunctions = ignoredPatterns.map((pattern) => {
|
|
14
14
|
// ensure patterns are valid - see https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/594
|
|
@@ -26,6 +26,7 @@ function createIsIgnored(ignored) {
|
|
|
26
26
|
return () => false;
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
|
+
ignoredFunctions.push((path) => excluded.some((excludedPath) => path.startsWith(excludedPath)));
|
|
29
30
|
ignoredFunctions.push((path) => BUILTIN_IGNORED_DIRS.some((ignoredDir) => path.includes(`/${ignoredDir}/`)));
|
|
30
31
|
return function isIgnored(path) {
|
|
31
32
|
return ignoredFunctions.some((ignoredFunction) => ignoredFunction(path));
|
|
@@ -44,24 +45,24 @@ class InclusiveNodeWatchFileSystem {
|
|
|
44
45
|
return this.watchFileSystem.watcher || ((_a = this.watchFileSystem.wfs) === null || _a === void 0 ? void 0 : _a.watcher);
|
|
45
46
|
}
|
|
46
47
|
watch(files, dirs, missing, startTime, options, callback, callbackUndelayed) {
|
|
47
|
-
var _a, _b, _c;
|
|
48
|
+
var _a, _b, _c, _d;
|
|
48
49
|
reporter_1.clearFilesChange(this.compiler);
|
|
49
|
-
const isIgnored = createIsIgnored(options === null || options === void 0 ? void 0 : options.ignored);
|
|
50
|
+
const isIgnored = createIsIgnored(options === null || options === void 0 ? void 0 : options.ignored, ((_a = this.pluginState.lastDependencies) === null || _a === void 0 ? void 0 : _a.excluded) || []);
|
|
50
51
|
// use standard watch file system for files and missing
|
|
51
52
|
const standardWatcher = this.watchFileSystem.watch(files, dirs, missing, startTime, options, callback, callbackUndelayed);
|
|
52
|
-
(
|
|
53
|
+
(_b = this.watcher) === null || _b === void 0 ? void 0 : _b.on('change', (file) => {
|
|
53
54
|
if (typeof file === 'string' && !isIgnored(file)) {
|
|
54
55
|
reporter_1.updateFilesChange(this.compiler, { changedFiles: [file] });
|
|
55
56
|
}
|
|
56
57
|
});
|
|
57
|
-
(
|
|
58
|
+
(_c = this.watcher) === null || _c === void 0 ? void 0 : _c.on('remove', (file) => {
|
|
58
59
|
if (typeof file === 'string' && !isIgnored(file)) {
|
|
59
60
|
reporter_1.updateFilesChange(this.compiler, { deletedFiles: [file] });
|
|
60
61
|
}
|
|
61
62
|
});
|
|
62
63
|
// calculate what to change
|
|
63
64
|
const prevDirs = Array.from(this.dirsWatchers.keys());
|
|
64
|
-
const nextDirs = Array.from(((
|
|
65
|
+
const nextDirs = Array.from(((_d = this.pluginState.lastDependencies) === null || _d === void 0 ? void 0 : _d.dirs) || []);
|
|
65
66
|
const dirsToUnwatch = prevDirs.filter((prevDir) => !nextDirs.includes(prevDir));
|
|
66
67
|
const dirsToWatch = nextDirs.filter((nextDir) => !prevDirs.includes(nextDir) && !isIgnored(nextDir));
|
|
67
68
|
// update dirs watcher
|
package/package.json
CHANGED