fork-ts-checker-webpack-plugin 9.1.1 → 9.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.
Files changed (64) hide show
  1. package/lib/files-change.js +5 -6
  2. package/lib/formatter/basic-formatter.js +1 -2
  3. package/lib/formatter/code-frame-formatter.js +1 -2
  4. package/lib/formatter/formatter-config.js +1 -2
  5. package/lib/formatter/stats-formatter.js +1 -2
  6. package/lib/formatter/webpack-formatter.js +1 -2
  7. package/lib/hooks/intercept-done-to-get-dev-server-tap.js +1 -2
  8. package/lib/hooks/tap-after-compile-to-add-dependencies.js +1 -2
  9. package/lib/hooks/tap-after-compile-to-get-issues.js +1 -2
  10. package/lib/hooks/tap-after-environment-to-patch-watching.js +1 -2
  11. package/lib/hooks/tap-done-to-async-get-issues.js +1 -2
  12. package/lib/hooks/tap-error-to-log-message.js +1 -2
  13. package/lib/hooks/tap-start-to-run-workers.js +1 -2
  14. package/lib/hooks/tap-stop-to-terminate-workers.js +1 -2
  15. package/lib/infrastructure-logger.js +1 -2
  16. package/lib/issue/issue-config.js +1 -2
  17. package/lib/issue/issue-location.js +2 -3
  18. package/lib/issue/issue-match.js +3 -4
  19. package/lib/issue/issue-position.js +1 -2
  20. package/lib/issue/issue-predicate.js +2 -3
  21. package/lib/issue/issue-severity.js +2 -3
  22. package/lib/issue/issue-webpack-error.js +17 -7
  23. package/lib/issue/issue.js +2 -3
  24. package/lib/plugin-config.js +1 -2
  25. package/lib/plugin-hooks.d.ts +4 -4
  26. package/lib/plugin-hooks.js +1 -2
  27. package/lib/plugin-pools.js +17 -7
  28. package/lib/plugin-state.js +1 -2
  29. package/lib/plugin.d.ts +2 -2
  30. package/lib/plugin.js +24 -9
  31. package/lib/rpc/expose-rpc.js +1 -2
  32. package/lib/rpc/rpc-worker.d.ts +0 -1
  33. package/lib/rpc/rpc-worker.js +19 -10
  34. package/lib/rpc/wrap-rpc.d.ts +0 -1
  35. package/lib/rpc/wrap-rpc.js +1 -2
  36. package/lib/typescript/type-script-support.js +19 -10
  37. package/lib/typescript/type-script-worker-config.js +1 -2
  38. package/lib/typescript/worker/lib/artifacts.js +20 -11
  39. package/lib/typescript/worker/lib/config.js +47 -19
  40. package/lib/typescript/worker/lib/dependencies.js +19 -10
  41. package/lib/typescript/worker/lib/diagnostics.js +35 -13
  42. package/lib/typescript/worker/lib/emit.js +1 -2
  43. package/lib/typescript/worker/lib/file-system/file-system.d.ts +0 -1
  44. package/lib/typescript/worker/lib/file-system/mem-file-system.js +1 -0
  45. package/lib/typescript/worker/lib/file-system/real-file-system.js +17 -7
  46. package/lib/typescript/worker/lib/host/compiler-host.js +1 -2
  47. package/lib/typescript/worker/lib/host/watch-compiler-host.js +1 -2
  48. package/lib/typescript/worker/lib/host/watch-solution-builder-host.js +1 -2
  49. package/lib/typescript/worker/lib/performance.js +3 -4
  50. package/lib/typescript/worker/lib/program/program.js +2 -3
  51. package/lib/typescript/worker/lib/program/solution-builder.js +2 -3
  52. package/lib/typescript/worker/lib/program/watch-program.js +3 -4
  53. package/lib/typescript/worker/lib/tracing.js +3 -4
  54. package/lib/typescript/worker/lib/tsbuildinfo.js +20 -11
  55. package/lib/utils/async/controlled-promise.js +1 -2
  56. package/lib/utils/async/is-pending.js +1 -2
  57. package/lib/utils/async/pool.js +1 -2
  58. package/lib/utils/async/wait.js +1 -2
  59. package/lib/utils/path/forward-slash.js +1 -2
  60. package/lib/utils/path/is-inside-another-path.js +1 -2
  61. package/lib/utils/path/relative-to-context.js +1 -2
  62. package/lib/watch/inclusive-node-watch-file-system.js +2 -2
  63. package/lib/watch/watch-file-system.d.ts +0 -1
  64. package/package.json +38 -40
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.wrapRpc = void 0;
12
+ exports.wrapRpc = wrapRpc;
13
13
  const controlled_promise_1 = require("../utils/async/controlled-promise");
14
14
  const rpc_error_1 = require("./rpc-error");
15
15
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -70,7 +70,6 @@ function wrapRpc(childProcess) {
70
70
  return sendPromise.then(() => resultPromise);
71
71
  }));
72
72
  }
73
- exports.wrapRpc = wrapRpc;
74
73
  function uuid() {
75
74
  return new Array(4)
76
75
  .fill(0)
@@ -15,25 +15,35 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
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
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
37
  };
28
38
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.assertTypeScriptSupport = void 0;
39
+ exports.assertTypeScriptSupport = assertTypeScriptSupport;
30
40
  const os_1 = __importDefault(require("os"));
31
41
  const fs_extra_1 = __importDefault(require("fs-extra"));
32
42
  const semver = __importStar(require("semver"));
33
43
  function assertTypeScriptSupport(config) {
34
44
  let typescriptVersion;
35
45
  try {
36
- // eslint-disable-next-line @typescript-eslint/no-var-requires
46
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
37
47
  typescriptVersion = require(config.typescriptPath).version;
38
48
  }
39
49
  catch (error) {
@@ -64,4 +74,3 @@ function assertTypeScriptSupport(config) {
64
74
  ].join(os_1.default.EOL));
65
75
  }
66
76
  }
67
- exports.assertTypeScriptSupport = assertTypeScriptSupport;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createTypeScriptWorkerConfig = void 0;
6
+ exports.createTypeScriptWorkerConfig = createTypeScriptWorkerConfig;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  function createTypeScriptWorkerConfig(compiler, options) {
9
9
  let configFile = (options === null || options === void 0 ? void 0 : options.configFile) || 'tsconfig.json';
@@ -15,4 +15,3 @@ function createTypeScriptWorkerConfig(compiler, options) {
15
15
  const typescriptPath = optionsAsObject.typescriptPath || require.resolve('typescript');
16
16
  return Object.assign(Object.assign({ memoryLimit: 2048, build: false, mode: optionsAsObject.build ? 'write-tsbuildinfo' : 'readonly', profile: false }, optionsAsObject), { configFile: configFile, configOverwrite: optionsAsObject.configOverwrite || {}, context: optionsAsObject.context || path_1.default.dirname(configFile), diagnosticOptions: Object.assign({ syntactic: false, semantic: true, declaration: false, global: false }, (optionsAsObject.diagnosticOptions || {})), typescriptPath: typescriptPath });
17
17
  }
18
- exports.createTypeScriptWorkerConfig = createTypeScriptWorkerConfig;
@@ -15,15 +15,27 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
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
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.registerArtifacts = exports.invalidateArtifacts = exports.getArtifacts = void 0;
36
+ exports.getArtifacts = getArtifacts;
37
+ exports.invalidateArtifacts = invalidateArtifacts;
38
+ exports.registerArtifacts = registerArtifacts;
27
39
  const path = __importStar(require("path"));
28
40
  const config_1 = require("./config");
29
41
  const system_1 = require("./system");
@@ -38,15 +50,12 @@ function getArtifacts(force = false) {
38
50
  }
39
51
  return artifacts;
40
52
  }
41
- exports.getArtifacts = getArtifacts;
42
53
  function invalidateArtifacts() {
43
54
  artifacts = undefined;
44
55
  }
45
- exports.invalidateArtifacts = invalidateArtifacts;
46
56
  function registerArtifacts() {
47
57
  system_1.system.setArtifacts(getArtifacts());
48
58
  }
49
- exports.registerArtifacts = registerArtifacts;
50
59
  function getArtifactsWorker(parsedConfig, configFileContext, processedConfigFiles = []) {
51
60
  const files = new Set();
52
61
  const dirs = new Set();
@@ -15,15 +15,46 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
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;
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __rest = (this && this.__rest) || function (s, e) {
36
+ var t = {};
37
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
38
+ t[p] = s[p];
39
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
40
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
41
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
42
+ t[p[i]] = s[p[i]];
43
+ }
44
+ return t;
24
45
  };
25
46
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.didRootFilesChanged = exports.didDependenciesProbablyChanged = exports.didConfigFileChanged = exports.getConfigFilePathFromBuilderProgram = exports.getConfigFilePathFromProgram = exports.getConfigFilePathFromCompilerOptions = exports.invalidateConfig = exports.parseNextConfig = exports.getParsedConfig = exports.getParseConfigIssues = exports.parseConfig = void 0;
47
+ exports.parseConfig = parseConfig;
48
+ exports.getParseConfigIssues = getParseConfigIssues;
49
+ exports.getParsedConfig = getParsedConfig;
50
+ exports.parseNextConfig = parseNextConfig;
51
+ exports.invalidateConfig = invalidateConfig;
52
+ exports.getConfigFilePathFromCompilerOptions = getConfigFilePathFromCompilerOptions;
53
+ exports.getConfigFilePathFromProgram = getConfigFilePathFromProgram;
54
+ exports.getConfigFilePathFromBuilderProgram = getConfigFilePathFromBuilderProgram;
55
+ exports.didConfigFileChanged = didConfigFileChanged;
56
+ exports.didDependenciesProbablyChanged = didDependenciesProbablyChanged;
57
+ exports.didRootFilesChanged = didRootFilesChanged;
27
58
  const path = __importStar(require("path"));
28
59
  const forward_slash_1 = require("../../../utils/path/forward-slash");
29
60
  const diagnostics_1 = require("./diagnostics");
@@ -67,14 +98,21 @@ function applyConfigOverwrite(baseConfig, ...overwriteConfigs) {
67
98
  }
68
99
  return config;
69
100
  }
101
+ /**
102
+ * The plugin turns off the "sourceMap" and the "inlineSourceMap" options. Options that depend on
103
+ * them would become invalid, so we remove them as well.
104
+ */
105
+ function removeOrphanedSourceMapOptions(options) {
106
+ const { inlineSources, sourceRoot, mapRoot } = options, otherOptions = __rest(options, ["inlineSources", "sourceRoot", "mapRoot"]);
107
+ return Object.assign(Object.assign(Object.assign({}, otherOptions), (options.sourceMap || options.inlineSourceMap ? { inlineSources, sourceRoot } : {})), (options.sourceMap || options.declarationMap ? { mapRoot } : {}));
108
+ }
70
109
  function parseConfig(configFileName, configFileContext) {
71
110
  const configFilePath = (0, forward_slash_1.forwardSlash)(configFileName);
72
111
  const { config: baseConfig, error: readConfigError } = typescript_1.typescript.readConfigFile(configFilePath, parseConfigFileHost.readFile);
73
112
  const overwrittenConfig = applyConfigOverwrite(baseConfig || {}, getImplicitConfigOverwrite(), getUserProvidedConfigOverwrite());
74
113
  const parsedConfigFile = typescript_1.typescript.parseJsonConfigFileContent(overwrittenConfig, parseConfigFileHost, configFileContext);
75
- return Object.assign(Object.assign({}, parsedConfigFile), { options: Object.assign(Object.assign({}, parsedConfigFile.options), { configFilePath: configFilePath }), errors: readConfigError ? [readConfigError] : parsedConfigFile.errors });
114
+ return Object.assign(Object.assign({}, parsedConfigFile), { options: Object.assign(Object.assign({}, removeOrphanedSourceMapOptions(parsedConfigFile.options)), { configFilePath: configFilePath }), errors: readConfigError ? [readConfigError] : parsedConfigFile.errors });
76
115
  }
77
- exports.parseConfig = parseConfig;
78
116
  function getParseConfigIssues() {
79
117
  const issues = (0, diagnostics_1.createIssuesFromDiagnostics)(parseConfigDiagnostics);
80
118
  issues.forEach((issue) => {
@@ -84,7 +122,6 @@ function getParseConfigIssues() {
84
122
  });
85
123
  return issues;
86
124
  }
87
- exports.getParseConfigIssues = getParseConfigIssues;
88
125
  function getParsedConfig(force = false) {
89
126
  if (!parsedConfig || force) {
90
127
  parsedConfig = parseConfig(worker_config_1.config.configFile, worker_config_1.config.context);
@@ -92,44 +129,35 @@ function getParsedConfig(force = false) {
92
129
  }
93
130
  return parsedConfig;
94
131
  }
95
- exports.getParsedConfig = getParsedConfig;
96
132
  function parseNextConfig() {
97
133
  const prevParsedConfig = parsedConfig;
98
134
  const nextParsedConfig = getParsedConfig(true);
99
135
  return [prevParsedConfig, nextParsedConfig];
100
136
  }
101
- exports.parseNextConfig = parseNextConfig;
102
137
  function invalidateConfig() {
103
138
  parsedConfig = undefined;
104
139
  parseConfigDiagnostics = [];
105
140
  }
106
- exports.invalidateConfig = invalidateConfig;
107
141
  function getConfigFilePathFromCompilerOptions(compilerOptions) {
108
142
  return compilerOptions.configFilePath;
109
143
  }
110
- exports.getConfigFilePathFromCompilerOptions = getConfigFilePathFromCompilerOptions;
111
144
  function getConfigFilePathFromProgram(program) {
112
145
  return getConfigFilePathFromCompilerOptions(program.getCompilerOptions());
113
146
  }
114
- exports.getConfigFilePathFromProgram = getConfigFilePathFromProgram;
115
147
  function getConfigFilePathFromBuilderProgram(builderProgram) {
116
148
  return getConfigFilePathFromCompilerOptions(builderProgram.getProgram().getCompilerOptions());
117
149
  }
118
- exports.getConfigFilePathFromBuilderProgram = getConfigFilePathFromBuilderProgram;
119
150
  function didConfigFileChanged({ changedFiles = [], deletedFiles = [] }) {
120
151
  return [...changedFiles, ...deletedFiles]
121
152
  .map((file) => path.normalize(file))
122
153
  .includes(path.normalize(worker_config_1.config.configFile));
123
154
  }
124
- exports.didConfigFileChanged = didConfigFileChanged;
125
155
  function didDependenciesProbablyChanged(dependencies, { changedFiles = [], deletedFiles = [] }) {
126
156
  const didSomeDependencyHasBeenAdded = changedFiles.some((changeFile) => !dependencies.files.includes(changeFile));
127
157
  const didSomeDependencyHasBeenDeleted = deletedFiles.some((deletedFile) => dependencies.files.includes(deletedFile));
128
158
  return didSomeDependencyHasBeenAdded || didSomeDependencyHasBeenDeleted;
129
159
  }
130
- exports.didDependenciesProbablyChanged = didDependenciesProbablyChanged;
131
160
  function didRootFilesChanged() {
132
161
  const [prevConfig, nextConfig] = parseNextConfig();
133
162
  return (prevConfig && JSON.stringify(prevConfig.fileNames) !== JSON.stringify(nextConfig.fileNames));
134
163
  }
135
- exports.didRootFilesChanged = didRootFilesChanged;
@@ -15,15 +15,26 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
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
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.invalidateDependencies = exports.getDependencies = void 0;
36
+ exports.getDependencies = getDependencies;
37
+ exports.invalidateDependencies = invalidateDependencies;
27
38
  const path = __importStar(require("path"));
28
39
  const config_1 = require("./config");
29
40
  const typescript_1 = require("./typescript");
@@ -36,11 +47,9 @@ function getDependencies(force = false) {
36
47
  }
37
48
  return dependencies;
38
49
  }
39
- exports.getDependencies = getDependencies;
40
50
  function invalidateDependencies() {
41
51
  dependencies = undefined;
42
52
  }
43
- exports.invalidateDependencies = invalidateDependencies;
44
53
  function getDependenciesWorker(parsedConfig, configFileContext, processedConfigFiles = []) {
45
54
  var _a;
46
55
  const files = new Set(parsedConfig.fileNames);
@@ -15,15 +15,29 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
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
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.createIssuesFromDiagnostics = exports.getDiagnosticsOfProgram = exports.invalidateDiagnostics = exports.getIssues = exports.updateDiagnostics = void 0;
36
+ exports.updateDiagnostics = updateDiagnostics;
37
+ exports.getIssues = getIssues;
38
+ exports.invalidateDiagnostics = invalidateDiagnostics;
39
+ exports.getDiagnosticsOfProgram = getDiagnosticsOfProgram;
40
+ exports.createIssuesFromDiagnostics = createIssuesFromDiagnostics;
27
41
  const os = __importStar(require("os"));
28
42
  const issue_1 = require("../../../issue");
29
43
  const typescript_1 = require("./typescript");
@@ -32,7 +46,6 @@ const diagnosticsPerConfigFile = new Map();
32
46
  function updateDiagnostics(configFile, diagnostics) {
33
47
  diagnosticsPerConfigFile.set(configFile, diagnostics);
34
48
  }
35
- exports.updateDiagnostics = updateDiagnostics;
36
49
  function getIssues() {
37
50
  const allDiagnostics = [];
38
51
  diagnosticsPerConfigFile.forEach((diagnostics) => {
@@ -40,14 +53,25 @@ function getIssues() {
40
53
  });
41
54
  return createIssuesFromDiagnostics(allDiagnostics);
42
55
  }
43
- exports.getIssues = getIssues;
44
56
  function invalidateDiagnostics() {
45
57
  diagnosticsPerConfigFile.clear();
46
58
  }
47
- exports.invalidateDiagnostics = invalidateDiagnostics;
59
+ /**
60
+ * Options diagnostics contain errors that the user did not cause, so we skip them.
61
+ */
62
+ function isReportableOptionsDiagnostic(diagnostic) {
63
+ if (diagnostic.code === 6053) {
64
+ // File '{0}' not found.
65
+ // A deleted file stays in the list of root files of a watch program until the next update.
66
+ return false;
67
+ }
68
+ return true;
69
+ }
48
70
  function getDiagnosticsOfProgram(program) {
49
71
  const programDiagnostics = [];
50
72
  try {
73
+ // compiler options errors, for example a deprecated or an invalid option, are always reported
74
+ programDiagnostics.push(...program.getOptionsDiagnostics().filter(isReportableOptionsDiagnostic));
51
75
  if (worker_config_1.config.diagnosticOptions.syntactic) {
52
76
  programDiagnostics.push(...program.getSyntacticDiagnostics());
53
77
  }
@@ -76,7 +100,6 @@ ${e.stack}`,
76
100
  }
77
101
  return programDiagnostics;
78
102
  }
79
- exports.getDiagnosticsOfProgram = getDiagnosticsOfProgram;
80
103
  function createIssueFromDiagnostic(diagnostic) {
81
104
  let file;
82
105
  let location;
@@ -109,4 +132,3 @@ function createIssueFromDiagnostic(diagnostic) {
109
132
  function createIssuesFromDiagnostics(diagnostics) {
110
133
  return (0, issue_1.deduplicateAndSortIssues)(diagnostics.map((diagnostic) => createIssueFromDiagnostic(diagnostic)));
111
134
  }
112
- exports.createIssuesFromDiagnostics = createIssuesFromDiagnostics;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.emitDtsIfNeeded = void 0;
3
+ exports.emitDtsIfNeeded = emitDtsIfNeeded;
4
4
  const config_1 = require("./config");
5
5
  const worker_config_1 = require("./worker-config");
6
6
  function emitDtsIfNeeded(program) {
@@ -10,4 +10,3 @@ function emitDtsIfNeeded(program) {
10
10
  program.emit(undefined, undefined, undefined, true);
11
11
  }
12
12
  }
13
- exports.emitDtsIfNeeded = emitDtsIfNeeded;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { Dirent, Stats } from 'fs';
3
2
  /**
4
3
  * Interface to abstract file system implementation details.
@@ -51,6 +51,7 @@ function readFile(path, encoding) {
51
51
  function readDir(path) {
52
52
  const stats = readStats(path);
53
53
  if (stats && stats.isDirectory()) {
54
+ // memfs has its own Dirent type, which lacks properties added in newer versions of Node.js
54
55
  return memfs_1.fs.readdirSync(real_file_system_1.realFileSystem.normalizePath(path), {
55
56
  withFileTypes: true,
56
57
  });
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
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
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.realFileSystem = void 0;
27
37
  const path_1 = require("path");
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createCompilerHost = void 0;
3
+ exports.createCompilerHost = createCompilerHost;
4
4
  const system_1 = require("../system");
5
5
  const typescript_1 = require("../typescript");
6
6
  function createCompilerHost(parsedConfig) {
7
7
  const baseCompilerHost = typescript_1.typescript.createCompilerHost(parsedConfig.options);
8
8
  return Object.assign(Object.assign({}, baseCompilerHost), { fileExists: system_1.system.fileExists, readFile: system_1.system.readFile, directoryExists: system_1.system.directoryExists, getDirectories: system_1.system.getDirectories, realpath: system_1.system.realpath });
9
9
  }
10
- exports.createCompilerHost = createCompilerHost;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createWatchCompilerHost = void 0;
3
+ exports.createWatchCompilerHost = createWatchCompilerHost;
4
4
  const system_1 = require("../system");
5
5
  const typescript_1 = require("../typescript");
6
6
  function createWatchCompilerHost(parsedConfig, createProgram, reportDiagnostic, reportWatchStatus, afterProgramCreate) {
@@ -17,4 +17,3 @@ function createWatchCompilerHost(parsedConfig, createProgram, reportDiagnostic,
17
17
  // do nothing
18
18
  }, watchFile: system_1.system.watchFile, watchDirectory: system_1.system.watchDirectory, setTimeout: system_1.system.setTimeout, clearTimeout: system_1.system.clearTimeout, fileExists: system_1.system.fileExists, readFile: system_1.system.readFile, directoryExists: system_1.system.directoryExists, getDirectories: system_1.system.getDirectories, realpath: system_1.system.realpath });
19
19
  }
20
- exports.createWatchCompilerHost = createWatchCompilerHost;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createWatchSolutionBuilderHost = void 0;
3
+ exports.createWatchSolutionBuilderHost = createWatchSolutionBuilderHost;
4
4
  const system_1 = require("../system");
5
5
  const typescript_1 = require("../typescript");
6
6
  const watch_compiler_host_1 = require("./watch-compiler-host");
@@ -44,4 +44,3 @@ function createWatchSolutionBuilderHost(parsedConfig, createProgram, reportDiagn
44
44
  } }));
45
45
  } });
46
46
  }
47
- exports.createWatchSolutionBuilderHost = createWatchSolutionBuilderHost;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.printPerformanceMeasuresIfNeeded = exports.disablePerformanceIfNeeded = exports.enablePerformanceIfNeeded = void 0;
3
+ exports.enablePerformanceIfNeeded = enablePerformanceIfNeeded;
4
+ exports.disablePerformanceIfNeeded = disablePerformanceIfNeeded;
5
+ exports.printPerformanceMeasuresIfNeeded = printPerformanceMeasuresIfNeeded;
4
6
  const typescript_1 = require("./typescript");
5
7
  const worker_config_1 = require("./worker-config");
6
8
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -11,14 +13,12 @@ function enablePerformanceIfNeeded() {
11
13
  (_a = performance === null || performance === void 0 ? void 0 : performance.enable) === null || _a === void 0 ? void 0 : _a.call(performance);
12
14
  }
13
15
  }
14
- exports.enablePerformanceIfNeeded = enablePerformanceIfNeeded;
15
16
  function disablePerformanceIfNeeded() {
16
17
  var _a;
17
18
  if (worker_config_1.config.profile) {
18
19
  (_a = performance === null || performance === void 0 ? void 0 : performance.disable) === null || _a === void 0 ? void 0 : _a.call(performance);
19
20
  }
20
21
  }
21
- exports.disablePerformanceIfNeeded = disablePerformanceIfNeeded;
22
22
  function printPerformanceMeasuresIfNeeded() {
23
23
  var _a;
24
24
  if (worker_config_1.config.profile) {
@@ -29,4 +29,3 @@ function printPerformanceMeasuresIfNeeded() {
29
29
  console.table(measures);
30
30
  }
31
31
  }
32
- exports.printPerformanceMeasuresIfNeeded = printPerformanceMeasuresIfNeeded;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.invalidateProgram = exports.useProgram = void 0;
3
+ exports.useProgram = useProgram;
4
+ exports.invalidateProgram = invalidateProgram;
4
5
  const config_1 = require("../config");
5
6
  const diagnostics_1 = require("../diagnostics");
6
7
  const emit_1 = require("../emit");
@@ -27,11 +28,9 @@ function useProgram() {
27
28
  (0, emit_1.emitDtsIfNeeded)(program);
28
29
  (0, tracing_1.stopTracingIfNeeded)(program);
29
30
  }
30
- exports.useProgram = useProgram;
31
31
  function invalidateProgram(withHost = false) {
32
32
  if (withHost) {
33
33
  compilerHost = undefined;
34
34
  }
35
35
  program = undefined;
36
36
  }
37
- exports.invalidateProgram = invalidateProgram;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.invalidateSolutionBuilder = exports.useSolutionBuilder = void 0;
3
+ exports.useSolutionBuilder = useSolutionBuilder;
4
+ exports.invalidateSolutionBuilder = invalidateSolutionBuilder;
4
5
  const config_1 = require("../config");
5
6
  const diagnostics_1 = require("../diagnostics");
6
7
  const watch_solution_builder_host_1 = require("../host/watch-solution-builder-host");
@@ -29,11 +30,9 @@ function useSolutionBuilder() {
29
30
  solutionBuilder.build();
30
31
  }
31
32
  }
32
- exports.useSolutionBuilder = useSolutionBuilder;
33
33
  function invalidateSolutionBuilder(withHost = false) {
34
34
  if (withHost) {
35
35
  solutionBuilderHost = undefined;
36
36
  }
37
37
  solutionBuilder = undefined;
38
38
  }
39
- exports.invalidateSolutionBuilder = invalidateSolutionBuilder;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.invalidateWatchProgramRootFileNames = exports.invalidateWatchProgram = exports.useWatchProgram = void 0;
3
+ exports.useWatchProgram = useWatchProgram;
4
+ exports.invalidateWatchProgram = invalidateWatchProgram;
5
+ exports.invalidateWatchProgramRootFileNames = invalidateWatchProgramRootFileNames;
4
6
  const config_1 = require("../config");
5
7
  const dependencies_1 = require("../dependencies");
6
8
  const diagnostics_1 = require("../diagnostics");
@@ -37,15 +39,12 @@ function useWatchProgram() {
37
39
  shouldUpdateRootFiles = false;
38
40
  }
39
41
  }
40
- exports.useWatchProgram = useWatchProgram;
41
42
  function invalidateWatchProgram(withHost = false) {
42
43
  if (withHost) {
43
44
  watchCompilerHost = undefined;
44
45
  }
45
46
  watchProgram = undefined;
46
47
  }
47
- exports.invalidateWatchProgram = invalidateWatchProgram;
48
48
  function invalidateWatchProgramRootFileNames() {
49
49
  shouldUpdateRootFiles = true;
50
50
  }
51
- exports.invalidateWatchProgramRootFileNames = invalidateWatchProgramRootFileNames;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.dumpTracingLegendIfNeeded = exports.stopTracingIfNeeded = exports.startTracingIfNeeded = void 0;
3
+ exports.startTracingIfNeeded = startTracingIfNeeded;
4
+ exports.stopTracingIfNeeded = stopTracingIfNeeded;
5
+ exports.dumpTracingLegendIfNeeded = dumpTracingLegendIfNeeded;
4
6
  const config_1 = require("./config");
5
7
  const typescript_1 = require("./typescript");
6
8
  const worker_config_1 = require("./worker-config");
@@ -12,7 +14,6 @@ function startTracingIfNeeded(compilerOptions) {
12
14
  traceableTypescript.startTracing(worker_config_1.config.build ? 'build' : 'project', compilerOptions.generateTrace, (0, config_1.getConfigFilePathFromCompilerOptions)(compilerOptions));
13
15
  }
14
16
  }
15
- exports.startTracingIfNeeded = startTracingIfNeeded;
16
17
  function stopTracingIfNeeded(program) {
17
18
  var _a;
18
19
  const compilerOptions = program.getCompilerOptions();
@@ -21,9 +22,7 @@ function stopTracingIfNeeded(program) {
21
22
  traceableTypescript.tracing.stopTracing();
22
23
  }
23
24
  }
24
- exports.stopTracingIfNeeded = stopTracingIfNeeded;
25
25
  function dumpTracingLegendIfNeeded() {
26
26
  var _a;
27
27
  (_a = traceableTypescript.tracing) === null || _a === void 0 ? void 0 : _a.dumpLegend();
28
28
  }
29
- exports.dumpTracingLegendIfNeeded = dumpTracingLegendIfNeeded;