fork-ts-checker-webpack-plugin 6.2.11 → 6.2.12

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.
@@ -65,7 +65,7 @@ exports.ForkTsCheckerWebpackPlugin = ForkTsCheckerWebpackPlugin;
65
65
  /**
66
66
  * Current version of the plugin
67
67
  */
68
- ForkTsCheckerWebpackPlugin.version = '6.2.11'; // will be replaced by the @semantic-release/exec
68
+ ForkTsCheckerWebpackPlugin.version = '6.2.12'; // will be replaced by the @semantic-release/exec
69
69
  /**
70
70
  * Default pool for the plugin concurrency limit
71
71
  */
@@ -78,6 +78,7 @@ function createEsLintReporter(configuration) {
78
78
  return {
79
79
  files: (yield getFiles()).map((file) => path_1.normalize(file)),
80
80
  dirs: getDirs().map((dir) => path_1.normalize(dir)),
81
+ excluded: [],
81
82
  extensions: getExtensions(),
82
83
  };
83
84
  });
@@ -1,6 +1,7 @@
1
1
  interface FilesMatch {
2
2
  files: string[];
3
3
  dirs: string[];
4
+ excluded: string[];
4
5
  extensions: string[];
5
6
  }
6
7
  export { FilesMatch };
@@ -62,8 +62,9 @@ function composeReporterRpcClients(clients) {
62
62
  getDependencies: () => Promise.all(reports.map((report) => report.getDependencies())).then((dependencies) => dependencies.reduce((mergedDependencies, singleDependencies) => ({
63
63
  files: Array.from(new Set([...mergedDependencies.files, ...singleDependencies.files])),
64
64
  dirs: Array.from(new Set([...mergedDependencies.dirs, ...singleDependencies.dirs])),
65
+ excluded: Array.from(new Set([...mergedDependencies.excluded, ...singleDependencies.excluded])),
65
66
  extensions: Array.from(new Set([...mergedDependencies.extensions, ...singleDependencies.extensions])),
66
- }), { files: [], dirs: [], extensions: [] })),
67
+ }), { files: [], dirs: [], excluded: [], extensions: [] })),
67
68
  getIssues: () => Promise.all(reports.map((report) => report.getIssues())).then((issues) => flatten_1.default(issues)),
68
69
  close: () => Promise.all(reports.map((report) => report.close())).then(() => undefined),
69
70
  })),
@@ -21,6 +21,7 @@ function createControlledTypeScriptSystem(typescript, mode = 'readonly') {
21
21
  let artifacts = {
22
22
  files: [],
23
23
  dirs: [],
24
+ excluded: [],
24
25
  extensions: [],
25
26
  };
26
27
  let isInitialRun = true;
@@ -2,7 +2,7 @@ import * as ts from 'typescript';
2
2
  import { TypeScriptConfigurationOverwrite } from '../TypeScriptConfigurationOverwrite';
3
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, parseConfigFileHost: ts.ParseConfigFileHost, processedConfigFiles?: string[]): FilesMatch;
5
+ declare function getDependenciesFromTypeScriptConfiguration(typescript: typeof ts, parsedConfiguration: ts.ParsedCommandLine, configFileContext: string, parseConfigFileHost: ts.ParseConfigFileHost, processedConfigFiles?: string[]): FilesMatch;
6
6
  export declare function isIncrementalCompilation(options: ts.CompilerOptions): boolean;
7
7
  declare function getArtifactsFromTypeScriptConfiguration(typescript: typeof ts, parsedConfiguration: ts.ParsedCommandLine, configFileContext: string, parseConfigFileHost: ts.ParseConfigFileHost, processedConfigFiles?: string[]): FilesMatch;
8
8
  export { parseTypeScriptConfiguration, getDependenciesFromTypeScriptConfiguration, getArtifactsFromTypeScriptConfiguration, };
@@ -16,20 +16,24 @@ function parseTypeScriptConfiguration(typescript, configFileName, configFileCont
16
16
  return Object.assign(Object.assign({}, parsedConfigFile), { options: Object.assign(Object.assign({}, parsedConfigFile.options), { configFilePath: configFileName }), errors: parsedConfigFileJSON.error ? [parsedConfigFileJSON.error] : parsedConfigFile.errors });
17
17
  }
18
18
  exports.parseTypeScriptConfiguration = parseTypeScriptConfiguration;
19
- function getDependenciesFromTypeScriptConfiguration(typescript, parsedConfiguration, parseConfigFileHost, processedConfigFiles = []) {
19
+ function getDependenciesFromTypeScriptConfiguration(typescript, parsedConfiguration, configFileContext, parseConfigFileHost, processedConfigFiles = []) {
20
+ var _a;
20
21
  const files = new Set(parsedConfiguration.fileNames);
21
- if (typeof parsedConfiguration.options.configFilePath === 'string') {
22
- files.add(parsedConfiguration.options.configFilePath);
22
+ const configFilePath = parsedConfiguration.options.configFilePath;
23
+ if (typeof configFilePath === 'string') {
24
+ files.add(configFilePath);
23
25
  }
24
26
  const dirs = new Set(Object.keys(parsedConfiguration.wildcardDirectories || {}));
27
+ const excluded = new Set((((_a = parsedConfiguration.raw) === null || _a === void 0 ? void 0 : _a.exclude) || []).map((path) => path_1.resolve(configFileContext, path)));
25
28
  for (const projectReference of parsedConfiguration.projectReferences || []) {
26
- const configFile = typescript.resolveProjectReferencePath(projectReference);
27
- if (processedConfigFiles.includes(configFile)) {
29
+ const childConfigFilePath = typescript.resolveProjectReferencePath(projectReference);
30
+ const childConfigContext = path_1.dirname(childConfigFilePath);
31
+ if (processedConfigFiles.includes(childConfigFilePath)) {
28
32
  // handle circular dependencies
29
33
  continue;
30
34
  }
31
- const parsedConfiguration = parseTypeScriptConfiguration(typescript, configFile, path_1.dirname(configFile), {}, parseConfigFileHost);
32
- const childDependencies = getDependenciesFromTypeScriptConfiguration(typescript, parsedConfiguration, parseConfigFileHost, [...processedConfigFiles, configFile]);
35
+ const childParsedConfiguration = parseTypeScriptConfiguration(typescript, childConfigFilePath, childConfigContext, {}, parseConfigFileHost);
36
+ const childDependencies = getDependenciesFromTypeScriptConfiguration(typescript, childParsedConfiguration, childConfigContext, parseConfigFileHost, [...processedConfigFiles, childConfigFilePath]);
33
37
  childDependencies.files.forEach((file) => {
34
38
  files.add(file);
35
39
  });
@@ -47,6 +51,7 @@ function getDependenciesFromTypeScriptConfiguration(typescript, parsedConfigurat
47
51
  return {
48
52
  files: Array.from(files).map((file) => path_1.normalize(file)),
49
53
  dirs: Array.from(dirs).map((dir) => path_1.normalize(dir)),
54
+ excluded: Array.from(excluded).map((path) => path_1.normalize(path)),
50
55
  extensions: extensions,
51
56
  };
52
57
  }
@@ -132,6 +137,7 @@ function getArtifactsFromTypeScriptConfiguration(typescript, parsedConfiguration
132
137
  return {
133
138
  files: Array.from(files).map((file) => path_1.normalize(file)),
134
139
  dirs: Array.from(dirs).map((dir) => path_1.normalize(dir)),
140
+ excluded: [],
135
141
  extensions,
136
142
  };
137
143
  }
@@ -116,7 +116,7 @@ function createTypeScriptReporter(configuration) {
116
116
  function getDependencies() {
117
117
  parsedConfiguration = parseConfigurationIfNeeded();
118
118
  const [parseConfigFileHost] = getParseConfigFileHost();
119
- let dependencies = TypeScriptConfigurationParser_1.getDependenciesFromTypeScriptConfiguration(typescript, parsedConfiguration, parseConfigFileHost);
119
+ let dependencies = TypeScriptConfigurationParser_1.getDependenciesFromTypeScriptConfiguration(typescript, parsedConfiguration, configuration.context, parseConfigFileHost);
120
120
  for (const extension of extensions) {
121
121
  if (extension.extendDependencies) {
122
122
  dependencies = extension.extendDependencies(dependencies);
@@ -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
- (_a = this.watcher) === null || _a === void 0 ? void 0 : _a.on('change', (file) => {
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
- (_b = this.watcher) === null || _b === void 0 ? void 0 : _b.on('remove', (file) => {
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(((_c = this.pluginState.lastDependencies) === null || _c === void 0 ? void 0 : _c.dirs) || []);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fork-ts-checker-webpack-plugin",
3
- "version": "6.2.11",
3
+ "version": "6.2.12",
4
4
  "description": "Runs typescript type checker and linter on separate process.",
5
5
  "keywords": [
6
6
  "fast",