fork-ts-checker-webpack-plugin 7.0.0-alpha.10 → 7.0.0-alpha.11

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 (187) hide show
  1. package/lib/ForkTsCheckerWebpackPlugin.d.ts +1 -1
  2. package/lib/ForkTsCheckerWebpackPlugin.js +29 -9
  3. package/lib/ForkTsCheckerWebpackPluginConfiguration.d.ts +1 -1
  4. package/lib/ForkTsCheckerWebpackPluginConfiguration.js +1 -1
  5. package/lib/ForkTsCheckerWebpackPluginOptions.d.ts +1 -1
  6. package/lib/ForkTsCheckerWebpackPluginState.d.ts +2 -3
  7. package/lib/ForkTsCheckerWebpackPluginState.js +1 -2
  8. package/lib/{reporter/FilesChange.d.ts → files-change.d.ts} +4 -4
  9. package/lib/{reporter/FilesChange.js → files-change.js} +2 -2
  10. package/lib/{reporter/FilesMatch.d.ts → files-match.d.ts} +0 -0
  11. package/lib/{reporter/FilesMatch.js → files-match.js} +0 -0
  12. package/lib/hooks/interceptDoneToGetWebpackDevServerTap.js +3 -0
  13. package/lib/hooks/pluginHooks.d.ts +1 -1
  14. package/lib/hooks/tapAfterCompileToAddDependencies.js +3 -0
  15. package/lib/hooks/tapAfterCompileToGetIssues.js +3 -0
  16. package/lib/hooks/tapAfterEnvironmentToPatchWatching.js +6 -0
  17. package/lib/hooks/tapDoneToAsyncGetIssues.js +5 -6
  18. package/lib/hooks/tapErrorToLogMessage.js +2 -2
  19. package/lib/hooks/tapStartToRunWorkers.d.ts +8 -0
  20. package/lib/hooks/tapStartToRunWorkers.js +95 -0
  21. package/lib/hooks/tapStopToTerminateWorkers.d.ts +5 -0
  22. package/lib/hooks/tapStopToTerminateWorkers.js +26 -0
  23. package/lib/infrastructure-logger.d.ts +10 -0
  24. package/lib/infrastructure-logger.js +15 -0
  25. package/lib/{typescript-reporter → typescript}/TypeScriptConfigurationOverwrite.d.ts +0 -0
  26. package/lib/{typescript-reporter → typescript}/TypeScriptConfigurationOverwrite.js +0 -0
  27. package/lib/{typescript-reporter → typescript}/TypeScriptDiagnosticsOptions.d.ts +0 -0
  28. package/lib/{typescript-reporter → typescript}/TypeScriptDiagnosticsOptions.js +0 -0
  29. package/lib/{typescript-reporter → typescript}/TypeScriptReporterConfiguration.d.ts +0 -0
  30. package/lib/{typescript-reporter → typescript}/TypeScriptReporterConfiguration.js +0 -0
  31. package/lib/{typescript-reporter → typescript}/TypeScriptReporterOptions.d.ts +0 -0
  32. package/lib/{typescript-reporter → typescript}/TypeScriptReporterOptions.js +0 -0
  33. package/lib/{typescript-reporter → typescript}/TypeScriptSupport.d.ts +0 -0
  34. package/lib/{typescript-reporter → typescript}/TypeScriptSupport.js +0 -0
  35. package/lib/{typescript-reporter → typescript}/extension/TypeScriptEmbeddedExtension.d.ts +0 -0
  36. package/lib/{typescript-reporter → typescript}/extension/TypeScriptEmbeddedExtension.js +0 -0
  37. package/lib/{typescript-reporter → typescript}/extension/TypeScriptExtension.d.ts +1 -1
  38. package/lib/{typescript-reporter → typescript}/extension/TypeScriptExtension.js +0 -0
  39. package/lib/{typescript-reporter → typescript}/extension/vue/TypeScriptVueExtension.d.ts +0 -0
  40. package/lib/{typescript-reporter → typescript}/extension/vue/TypeScriptVueExtension.js +0 -0
  41. package/lib/{typescript-reporter → typescript}/extension/vue/TypeScriptVueExtensionConfiguration.d.ts +0 -0
  42. package/lib/{typescript-reporter → typescript}/extension/vue/TypeScriptVueExtensionConfiguration.js +0 -0
  43. package/lib/{typescript-reporter → typescript}/extension/vue/TypeScriptVueExtensionOptions.d.ts +0 -0
  44. package/lib/{typescript-reporter → typescript}/extension/vue/TypeScriptVueExtensionOptions.js +0 -0
  45. package/lib/{typescript-reporter → typescript}/extension/vue/TypeScriptVueExtensionSupport.d.ts +0 -0
  46. package/lib/{typescript-reporter → typescript}/extension/vue/TypeScriptVueExtensionSupport.js +0 -0
  47. package/lib/{typescript-reporter → typescript}/extension/vue/types/vue-template-compiler.d.ts +0 -0
  48. package/lib/{typescript-reporter → typescript}/extension/vue/types/vue-template-compiler.js +0 -0
  49. package/lib/{typescript-reporter → typescript}/extension/vue/types/vue__compiler-sfc.d.ts +0 -0
  50. package/lib/{typescript-reporter → typescript}/extension/vue/types/vue__compiler-sfc.js +0 -0
  51. package/lib/typescript/worker/get-dependencies-worker.d.ts +5 -0
  52. package/lib/typescript/worker/get-dependencies-worker.js +18 -0
  53. package/lib/typescript/worker/get-issues-worker.d.ts +5 -0
  54. package/lib/typescript/worker/get-issues-worker.js +76 -0
  55. package/lib/typescript/worker/lib/artifacts.d.ts +4 -0
  56. package/lib/typescript/worker/lib/artifacts.js +90 -0
  57. package/lib/typescript/worker/lib/config.d.ts +14 -0
  58. package/lib/typescript/worker/lib/config.js +114 -0
  59. package/lib/typescript/worker/lib/dependencies.d.ts +3 -0
  60. package/lib/typescript/worker/lib/dependencies.js +87 -0
  61. package/lib/typescript/worker/lib/diagnostics.d.ts +7 -0
  62. package/lib/typescript/worker/lib/diagnostics.js +100 -0
  63. package/lib/typescript/worker/lib/extensions.d.ts +3 -0
  64. package/lib/typescript/worker/lib/extensions.js +11 -0
  65. package/lib/{typescript-reporter/file-system/FileSystem.d.ts → typescript/worker/lib/file-system/file-system.d.ts} +1 -2
  66. package/lib/{reporter/Report.js → typescript/worker/lib/file-system/file-system.js} +0 -0
  67. package/lib/typescript/worker/lib/file-system/mem-file-system.d.ts +5 -0
  68. package/lib/typescript/worker/lib/file-system/mem-file-system.js +78 -0
  69. package/lib/typescript/worker/lib/file-system/passive-file-system.d.ts +5 -0
  70. package/lib/typescript/worker/lib/file-system/passive-file-system.js +65 -0
  71. package/lib/typescript/worker/lib/file-system/real-file-system.d.ts +5 -0
  72. package/lib/typescript/worker/lib/file-system/real-file-system.js +187 -0
  73. package/lib/typescript/worker/lib/host/compiler-host.d.ts +2 -0
  74. package/lib/typescript/worker/lib/host/compiler-host.js +17 -0
  75. package/lib/typescript/worker/lib/host/watch-compiler-host.d.ts +2 -0
  76. package/lib/typescript/worker/lib/host/watch-compiler-host.js +32 -0
  77. package/lib/typescript/worker/lib/host/watch-solution-builder-host.d.ts +2 -0
  78. package/lib/typescript/worker/lib/host/watch-solution-builder-host.js +54 -0
  79. package/lib/typescript/worker/lib/performance.d.ts +3 -0
  80. package/lib/typescript/worker/lib/performance.js +32 -0
  81. package/lib/typescript/worker/lib/program/program.d.ts +2 -0
  82. package/lib/typescript/worker/lib/program/program.js +32 -0
  83. package/lib/typescript/worker/lib/program/solution-builder.d.ts +2 -0
  84. package/lib/typescript/worker/lib/program/solution-builder.js +39 -0
  85. package/lib/typescript/worker/lib/program/watch-program.d.ts +3 -0
  86. package/lib/typescript/worker/lib/program/watch-program.js +49 -0
  87. package/lib/{typescript-reporter/reporter/ControlledTypeScriptSystem.d.ts → typescript/worker/lib/system.d.ts} +4 -6
  88. package/lib/typescript/worker/lib/system.js +209 -0
  89. package/lib/typescript/worker/lib/tracing.d.ts +4 -0
  90. package/lib/typescript/worker/lib/tracing.js +28 -0
  91. package/lib/typescript/worker/lib/tsbuildinfo.d.ts +4 -0
  92. package/lib/typescript/worker/lib/tsbuildinfo.js +92 -0
  93. package/lib/typescript/worker/lib/typescript.d.ts +2 -0
  94. package/lib/typescript/worker/lib/typescript.js +6 -0
  95. package/lib/typescript/worker/lib/worker-config.d.ts +2 -0
  96. package/lib/typescript/worker/lib/worker-config.js +5 -0
  97. package/lib/utils/async/pool.d.ts +1 -1
  98. package/lib/utils/async/pool.js +3 -14
  99. package/lib/{rpc/rpc-ipc/error/RpcIpcMessagePortClosedError.d.ts → utils/rpc/error.d.ts} +2 -3
  100. package/lib/utils/rpc/error.js +12 -0
  101. package/lib/utils/rpc/expose.d.ts +1 -0
  102. package/lib/utils/rpc/expose.js +78 -0
  103. package/lib/utils/rpc/index.d.ts +5 -0
  104. package/lib/utils/rpc/index.js +12 -0
  105. package/lib/utils/rpc/types.d.ts +19 -0
  106. package/lib/{reporter/Reporter.js → utils/rpc/types.js} +0 -0
  107. package/lib/utils/rpc/worker.d.ts +13 -0
  108. package/lib/utils/rpc/worker.js +79 -0
  109. package/lib/utils/rpc/wrap.d.ts +4 -0
  110. package/lib/utils/rpc/wrap.js +96 -0
  111. package/lib/watch/InclusiveNodeWatchFileSystem.js +7 -7
  112. package/package.json +1 -1
  113. package/lib/error/OperationCanceledError.d.ts +0 -4
  114. package/lib/error/OperationCanceledError.js +0 -10
  115. package/lib/hooks/tapStartToConnectAndRunReporter.d.ts +0 -6
  116. package/lib/hooks/tapStartToConnectAndRunReporter.js +0 -130
  117. package/lib/hooks/tapStopToDisconnectReporter.d.ts +0 -5
  118. package/lib/hooks/tapStopToDisconnectReporter.js +0 -30
  119. package/lib/profile/Performance.d.ts +0 -11
  120. package/lib/profile/Performance.js +0 -63
  121. package/lib/reporter/AggregatedReporter.d.ts +0 -6
  122. package/lib/reporter/AggregatedReporter.js +0 -61
  123. package/lib/reporter/Report.d.ts +0 -8
  124. package/lib/reporter/Reporter.d.ts +0 -6
  125. package/lib/reporter/index.d.ts +0 -7
  126. package/lib/reporter/index.js +0 -19
  127. package/lib/reporter/reporter-rpc/ReporterRpcClient.d.ts +0 -10
  128. package/lib/reporter/reporter-rpc/ReporterRpcClient.js +0 -85
  129. package/lib/reporter/reporter-rpc/ReporterRpcProcedure.d.ts +0 -13
  130. package/lib/reporter/reporter-rpc/ReporterRpcProcedure.js +0 -15
  131. package/lib/reporter/reporter-rpc/ReporterRpcService.d.ts +0 -9
  132. package/lib/reporter/reporter-rpc/ReporterRpcService.js +0 -77
  133. package/lib/rpc/RpcClient.d.ts +0 -10
  134. package/lib/rpc/RpcClient.js +0 -79
  135. package/lib/rpc/RpcHost.d.ts +0 -6
  136. package/lib/rpc/RpcHost.js +0 -2
  137. package/lib/rpc/RpcMessage.d.ts +0 -26
  138. package/lib/rpc/RpcMessage.js +0 -48
  139. package/lib/rpc/RpcMessageChannel.d.ts +0 -10
  140. package/lib/rpc/RpcMessageChannel.js +0 -50
  141. package/lib/rpc/RpcMessagePort.d.ts +0 -14
  142. package/lib/rpc/RpcMessagePort.js +0 -2
  143. package/lib/rpc/RpcProcedure.d.ts +0 -5
  144. package/lib/rpc/RpcProcedure.js +0 -2
  145. package/lib/rpc/RpcService.d.ts +0 -12
  146. package/lib/rpc/RpcService.js +0 -64
  147. package/lib/rpc/error/RpcMessagePortClosedError.d.ts +0 -3
  148. package/lib/rpc/error/RpcMessagePortClosedError.js +0 -6
  149. package/lib/rpc/error/RpcRemoteError.d.ts +0 -6
  150. package/lib/rpc/error/RpcRemoteError.js +0 -18
  151. package/lib/rpc/index.d.ts +0 -7
  152. package/lib/rpc/index.js +0 -19
  153. package/lib/rpc/rpc-ipc/ProcessLike.d.ts +0 -12
  154. package/lib/rpc/rpc-ipc/ProcessLike.js +0 -3
  155. package/lib/rpc/rpc-ipc/RpcIpcMessageChannel.d.ts +0 -3
  156. package/lib/rpc/rpc-ipc/RpcIpcMessageChannel.js +0 -11
  157. package/lib/rpc/rpc-ipc/RpcIpcMessagePort.d.ts +0 -5
  158. package/lib/rpc/rpc-ipc/RpcIpcMessagePort.js +0 -151
  159. package/lib/rpc/rpc-ipc/error/RpcIpcMessagePortClosedError.js +0 -13
  160. package/lib/rpc/rpc-ipc/index.d.ts +0 -2
  161. package/lib/rpc/rpc-ipc/index.js +0 -14
  162. package/lib/typescript-reporter/file-system/FileSystem.js +0 -2
  163. package/lib/typescript-reporter/file-system/MemFileSystem.d.ts +0 -8
  164. package/lib/typescript-reporter/file-system/MemFileSystem.js +0 -83
  165. package/lib/typescript-reporter/file-system/PassiveFileSystem.d.ts +0 -9
  166. package/lib/typescript-reporter/file-system/PassiveFileSystem.js +0 -69
  167. package/lib/typescript-reporter/file-system/RealFileSystem.d.ts +0 -8
  168. package/lib/typescript-reporter/file-system/RealFileSystem.js +0 -181
  169. package/lib/typescript-reporter/issue/TypeScriptIssueFactory.d.ts +0 -4
  170. package/lib/typescript-reporter/issue/TypeScriptIssueFactory.js +0 -57
  171. package/lib/typescript-reporter/profile/TypeScriptPerformance.d.ts +0 -10
  172. package/lib/typescript-reporter/profile/TypeScriptPerformance.js +0 -34
  173. package/lib/typescript-reporter/reporter/ControlledCompilerHost.d.ts +0 -5
  174. package/lib/typescript-reporter/reporter/ControlledCompilerHost.js +0 -14
  175. package/lib/typescript-reporter/reporter/ControlledTypeScriptSystem.js +0 -218
  176. package/lib/typescript-reporter/reporter/ControlledWatchCompilerHost.d.ts +0 -5
  177. package/lib/typescript-reporter/reporter/ControlledWatchCompilerHost.js +0 -29
  178. package/lib/typescript-reporter/reporter/ControlledWatchSolutionBuilderHost.d.ts +0 -5
  179. package/lib/typescript-reporter/reporter/ControlledWatchSolutionBuilderHost.js +0 -51
  180. package/lib/typescript-reporter/reporter/TypeScriptConfigurationParser.d.ts +0 -8
  181. package/lib/typescript-reporter/reporter/TypeScriptConfigurationParser.js +0 -142
  182. package/lib/typescript-reporter/reporter/TypeScriptReporter.d.ts +0 -4
  183. package/lib/typescript-reporter/reporter/TypeScriptReporter.js +0 -376
  184. package/lib/typescript-reporter/reporter/TypeScriptReporterRpcClient.d.ts +0 -4
  185. package/lib/typescript-reporter/reporter/TypeScriptReporterRpcClient.js +0 -14
  186. package/lib/typescript-reporter/reporter/TypeScriptReporterRpcService.d.ts +0 -1
  187. package/lib/typescript-reporter/reporter/TypeScriptReporterRpcService.js +0 -11
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createControlledCompilerHost = void 0;
4
- function createControlledCompilerHost(typescript, parsedCommandLine, system, hostExtensions = []) {
5
- const baseCompilerHost = typescript.createCompilerHost(parsedCommandLine.options);
6
- let controlledCompilerHost = Object.assign(Object.assign({}, baseCompilerHost), { fileExists: system.fileExists, readFile: system.readFile, directoryExists: system.directoryExists, getDirectories: system.getDirectories, realpath: system.realpath });
7
- hostExtensions.forEach((hostExtension) => {
8
- if (hostExtension.extendCompilerHost) {
9
- controlledCompilerHost = hostExtension.extendCompilerHost(controlledCompilerHost, parsedCommandLine);
10
- }
11
- });
12
- return controlledCompilerHost;
13
- }
14
- exports.createControlledCompilerHost = createControlledCompilerHost;
@@ -1,218 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.createControlledTypeScriptSystem = void 0;
16
- const path_1 = require("path");
17
- const forwardSlash_1 = __importDefault(require("../../utils/path/forwardSlash"));
18
- const MemFileSystem_1 = require("../file-system/MemFileSystem");
19
- const PassiveFileSystem_1 = require("../file-system/PassiveFileSystem");
20
- const RealFileSystem_1 = require("../file-system/RealFileSystem");
21
- function createControlledTypeScriptSystem(typescript, mode = 'readonly') {
22
- let artifacts = {
23
- files: [],
24
- dirs: [],
25
- excluded: [],
26
- extensions: [],
27
- };
28
- let isInitialRun = true;
29
- // watchers
30
- const fileWatcherCallbacksMap = new Map();
31
- const directoryWatcherCallbacksMap = new Map();
32
- const recursiveDirectoryWatcherCallbacksMap = new Map();
33
- const deletedFiles = new Map();
34
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
- const timeoutCallbacks = new Set();
36
- // always use case-sensitive as normalization to lower-case can be a problem for some
37
- // third-party libraries, like fsevents
38
- const caseSensitive = true;
39
- const realFileSystem = RealFileSystem_1.createRealFileSystem(caseSensitive);
40
- const memFileSystem = MemFileSystem_1.createMemFileSystem(realFileSystem);
41
- const passiveFileSystem = PassiveFileSystem_1.createPassiveFileSystem(memFileSystem, realFileSystem);
42
- // based on the ts.ignorePaths
43
- const ignoredPaths = ['/node_modules/.', '/.git', '/.#'];
44
- function createWatcher(watchersMap, path, callback) {
45
- const normalizedPath = realFileSystem.normalizePath(path);
46
- const watchers = watchersMap.get(normalizedPath) || [];
47
- const nextWatchers = [...watchers, callback];
48
- watchersMap.set(normalizedPath, nextWatchers);
49
- return {
50
- close: () => {
51
- const watchers = watchersMap.get(normalizedPath) || [];
52
- const nextWatchers = watchers.filter((watcher) => watcher !== callback);
53
- if (nextWatchers.length > 0) {
54
- watchersMap.set(normalizedPath, nextWatchers);
55
- }
56
- else {
57
- watchersMap.delete(normalizedPath);
58
- }
59
- },
60
- };
61
- }
62
- function invokeFileWatchers(path, event) {
63
- const normalizedPath = realFileSystem.normalizePath(path);
64
- if (normalizedPath.endsWith('.js')) {
65
- // trigger relevant .d.ts file watcher - handles the case, when we have webpack watcher
66
- // that points to a symlinked package
67
- invokeFileWatchers(normalizedPath.slice(0, -3) + '.d.ts', event);
68
- }
69
- const fileWatcherCallbacks = fileWatcherCallbacksMap.get(normalizedPath);
70
- if (fileWatcherCallbacks) {
71
- // typescript expects normalized paths with posix forward slash
72
- fileWatcherCallbacks.forEach((fileWatcherCallback) => fileWatcherCallback(forwardSlash_1.default(normalizedPath), event));
73
- }
74
- }
75
- function invokeDirectoryWatchers(path) {
76
- const normalizedPath = realFileSystem.normalizePath(path);
77
- const directory = path_1.dirname(normalizedPath);
78
- if (ignoredPaths.some((ignoredPath) => forwardSlash_1.default(normalizedPath).includes(ignoredPath))) {
79
- return;
80
- }
81
- const directoryWatcherCallbacks = directoryWatcherCallbacksMap.get(directory);
82
- if (directoryWatcherCallbacks) {
83
- directoryWatcherCallbacks.forEach((directoryWatcherCallback) => directoryWatcherCallback(forwardSlash_1.default(normalizedPath)));
84
- }
85
- recursiveDirectoryWatcherCallbacksMap.forEach((recursiveDirectoryWatcherCallbacks, watchedDirectory) => {
86
- if (watchedDirectory === directory ||
87
- (directory.startsWith(watchedDirectory) &&
88
- forwardSlash_1.default(directory)[watchedDirectory.length] === '/')) {
89
- recursiveDirectoryWatcherCallbacks.forEach((recursiveDirectoryWatcherCallback) => recursiveDirectoryWatcherCallback(forwardSlash_1.default(normalizedPath)));
90
- }
91
- });
92
- }
93
- function isArtifact(path) {
94
- return ((artifacts.dirs.some((dir) => path.includes(dir)) ||
95
- artifacts.files.some((file) => path === file)) &&
96
- artifacts.extensions.some((extension) => path.endsWith(extension)));
97
- }
98
- function getReadFileSystem(path) {
99
- if (!isInitialRun &&
100
- (mode === 'readonly' || mode === 'write-tsbuildinfo') &&
101
- isArtifact(path)) {
102
- return memFileSystem;
103
- }
104
- return passiveFileSystem;
105
- }
106
- function getWriteFileSystem(path) {
107
- if (mode === 'write-references' ||
108
- (mode === 'write-tsbuildinfo' && path.endsWith('.tsbuildinfo'))) {
109
- return realFileSystem;
110
- }
111
- return passiveFileSystem;
112
- }
113
- const controlledSystem = Object.assign(Object.assign({}, typescript.sys), { useCaseSensitiveFileNames: caseSensitive, fileExists(path) {
114
- const stats = getReadFileSystem(path).readStats(path);
115
- return !!stats && stats.isFile();
116
- },
117
- readFile(path, encoding) {
118
- return getReadFileSystem(path).readFile(path, encoding);
119
- },
120
- getFileSize(path) {
121
- const stats = getReadFileSystem(path).readStats(path);
122
- return stats ? stats.size : 0;
123
- },
124
- writeFile(path, data) {
125
- getWriteFileSystem(path).writeFile(path, data);
126
- controlledSystem.invokeFileChanged(path);
127
- },
128
- deleteFile(path) {
129
- getWriteFileSystem(path).deleteFile(path);
130
- controlledSystem.invokeFileDeleted(path);
131
- },
132
- directoryExists(path) {
133
- var _a;
134
- return Boolean((_a = getReadFileSystem(path).readStats(path)) === null || _a === void 0 ? void 0 : _a.isDirectory());
135
- },
136
- createDirectory(path) {
137
- getWriteFileSystem(path).createDir(path);
138
- invokeDirectoryWatchers(path);
139
- },
140
- getDirectories(path) {
141
- const dirents = getReadFileSystem(path).readDir(path);
142
- return dirents
143
- .filter((dirent) => dirent.isDirectory() ||
144
- (dirent.isSymbolicLink() && controlledSystem.directoryExists(path_1.join(path, dirent.name))))
145
- .map((dirent) => dirent.name);
146
- },
147
- getModifiedTime(path) {
148
- const stats = getReadFileSystem(path).readStats(path);
149
- if (stats) {
150
- return stats.mtime;
151
- }
152
- },
153
- setModifiedTime(path, date) {
154
- getWriteFileSystem(path).updateTimes(path, date, date);
155
- invokeDirectoryWatchers(path);
156
- invokeFileWatchers(path, typescript.FileWatcherEventKind.Changed);
157
- },
158
- watchFile(path, callback) {
159
- return createWatcher(fileWatcherCallbacksMap, path, callback);
160
- },
161
- watchDirectory(path, callback, recursive = false) {
162
- return createWatcher(recursive ? recursiveDirectoryWatcherCallbacksMap : directoryWatcherCallbacksMap, path, callback);
163
- },
164
- // use immediate instead of timeout to avoid waiting 250ms for batching files changes
165
- setTimeout: (callback, timeout, ...args) => {
166
- const timeoutId = setImmediate(() => {
167
- callback(...args);
168
- timeoutCallbacks.delete(timeoutId);
169
- });
170
- timeoutCallbacks.add(timeoutId);
171
- return timeoutId;
172
- }, clearTimeout: (timeoutId) => {
173
- clearImmediate(timeoutId);
174
- timeoutCallbacks.delete(timeoutId);
175
- }, waitForQueued() {
176
- return __awaiter(this, void 0, void 0, function* () {
177
- while (timeoutCallbacks.size > 0) {
178
- yield new Promise((resolve) => setImmediate(resolve));
179
- }
180
- isInitialRun = false;
181
- });
182
- },
183
- invokeFileCreated(path) {
184
- const normalizedPath = realFileSystem.normalizePath(path);
185
- invokeFileWatchers(path, typescript.FileWatcherEventKind.Created);
186
- invokeDirectoryWatchers(normalizedPath);
187
- deletedFiles.set(normalizedPath, false);
188
- },
189
- invokeFileChanged(path) {
190
- const normalizedPath = realFileSystem.normalizePath(path);
191
- if (deletedFiles.get(normalizedPath) || !fileWatcherCallbacksMap.has(normalizedPath)) {
192
- invokeFileWatchers(path, typescript.FileWatcherEventKind.Created);
193
- invokeDirectoryWatchers(normalizedPath);
194
- deletedFiles.set(normalizedPath, false);
195
- }
196
- else {
197
- invokeFileWatchers(path, typescript.FileWatcherEventKind.Changed);
198
- }
199
- },
200
- invokeFileDeleted(path) {
201
- const normalizedPath = realFileSystem.normalizePath(path);
202
- if (!deletedFiles.get(normalizedPath)) {
203
- invokeFileWatchers(path, typescript.FileWatcherEventKind.Deleted);
204
- invokeDirectoryWatchers(path);
205
- deletedFiles.set(normalizedPath, true);
206
- }
207
- },
208
- clearCache() {
209
- realFileSystem.clearCache();
210
- memFileSystem.clearCache();
211
- passiveFileSystem.clearCache();
212
- },
213
- setArtifacts(nextArtifacts) {
214
- artifacts = nextArtifacts;
215
- } });
216
- return controlledSystem;
217
- }
218
- exports.createControlledTypeScriptSystem = createControlledTypeScriptSystem;
@@ -1,5 +0,0 @@
1
- import type * as ts from 'typescript';
2
- import type { TypeScriptHostExtension } from '../extension/TypeScriptExtension';
3
- import type { ControlledTypeScriptSystem } from './ControlledTypeScriptSystem';
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>;
5
- export { createControlledWatchCompilerHost };
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createControlledWatchCompilerHost = void 0;
4
- function createControlledWatchCompilerHost(typescript, parsedCommandLine, system, createProgram, reportDiagnostic, reportWatchStatus, afterProgramCreate, hostExtensions = []) {
5
- const baseWatchCompilerHost = typescript.createWatchCompilerHost(parsedCommandLine.fileNames, parsedCommandLine.options, system, createProgram, reportDiagnostic, reportWatchStatus, parsedCommandLine.projectReferences);
6
- let controlledWatchCompilerHost = Object.assign(Object.assign({}, baseWatchCompilerHost), { createProgram(rootNames, options, compilerHost, oldProgram, configFileParsingDiagnostics, projectReferences) {
7
- hostExtensions.forEach((hostExtension) => {
8
- if (compilerHost && hostExtension.extendCompilerHost) {
9
- compilerHost = hostExtension.extendCompilerHost(compilerHost, parsedCommandLine);
10
- }
11
- });
12
- return baseWatchCompilerHost.createProgram(rootNames, options, compilerHost, oldProgram, configFileParsingDiagnostics, projectReferences);
13
- },
14
- afterProgramCreate(program) {
15
- if (afterProgramCreate) {
16
- afterProgramCreate(program);
17
- }
18
- },
19
- onWatchStatusChange() {
20
- // do nothing
21
- }, watchFile: system.watchFile, watchDirectory: system.watchDirectory, setTimeout: system.setTimeout, clearTimeout: system.clearTimeout, fileExists: system.fileExists, readFile: system.readFile, directoryExists: system.directoryExists, getDirectories: system.getDirectories, realpath: system.realpath });
22
- hostExtensions.forEach((hostExtension) => {
23
- if (hostExtension.extendWatchCompilerHost) {
24
- controlledWatchCompilerHost = hostExtension.extendWatchCompilerHost(controlledWatchCompilerHost, parsedCommandLine);
25
- }
26
- });
27
- return controlledWatchCompilerHost;
28
- }
29
- exports.createControlledWatchCompilerHost = createControlledWatchCompilerHost;
@@ -1,5 +0,0 @@
1
- import type * as ts from 'typescript';
2
- import type { TypeScriptHostExtension } from '../extension/TypeScriptExtension';
3
- import type { ControlledTypeScriptSystem } from './ControlledTypeScriptSystem';
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>;
5
- export { createControlledWatchSolutionBuilderHost };
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createControlledWatchSolutionBuilderHost = void 0;
4
- const ControlledWatchCompilerHost_1 = require("./ControlledWatchCompilerHost");
5
- function createControlledWatchSolutionBuilderHost(typescript, parsedCommandLine, system, createProgram, reportDiagnostic, reportWatchStatus, reportSolutionBuilderStatus, afterProgramCreate, afterProgramEmitAndDiagnostics, hostExtensions = []) {
6
- const controlledWatchCompilerHost = ControlledWatchCompilerHost_1.createControlledWatchCompilerHost(typescript, parsedCommandLine, system, createProgram, reportDiagnostic, reportWatchStatus, afterProgramCreate, hostExtensions);
7
- let controlledWatchSolutionBuilderHost = Object.assign(Object.assign({}, controlledWatchCompilerHost), { reportDiagnostic(diagnostic) {
8
- if (reportDiagnostic) {
9
- reportDiagnostic(diagnostic);
10
- }
11
- },
12
- reportSolutionBuilderStatus(diagnostic) {
13
- if (reportSolutionBuilderStatus) {
14
- reportSolutionBuilderStatus(diagnostic);
15
- }
16
- },
17
- afterProgramEmitAndDiagnostics(program) {
18
- if (afterProgramEmitAndDiagnostics) {
19
- afterProgramEmitAndDiagnostics(program);
20
- }
21
- },
22
- createDirectory(path) {
23
- system.createDirectory(path);
24
- },
25
- writeFile(path, data) {
26
- system.writeFile(path, data);
27
- },
28
- getModifiedTime(fileName) {
29
- return system.getModifiedTime(fileName);
30
- },
31
- setModifiedTime(fileName, date) {
32
- system.setModifiedTime(fileName, date);
33
- },
34
- deleteFile(fileName) {
35
- system.deleteFile(fileName);
36
- },
37
- getParsedCommandLine(fileName) {
38
- return typescript.getParsedCommandLineOfConfigFile(fileName, { skipLibCheck: true }, Object.assign(Object.assign({}, system), { onUnRecoverableConfigFileDiagnostic: (diagnostic) => {
39
- if (reportDiagnostic) {
40
- reportDiagnostic(diagnostic);
41
- }
42
- } }));
43
- } });
44
- hostExtensions.forEach((hostExtension) => {
45
- if (hostExtension.extendWatchSolutionBuilderHost) {
46
- controlledWatchSolutionBuilderHost = hostExtension.extendWatchSolutionBuilderHost(controlledWatchSolutionBuilderHost, parsedCommandLine);
47
- }
48
- });
49
- return controlledWatchSolutionBuilderHost;
50
- }
51
- exports.createControlledWatchSolutionBuilderHost = createControlledWatchSolutionBuilderHost;
@@ -1,8 +0,0 @@
1
- import type * as ts from 'typescript';
2
- import type { FilesMatch } from '../../reporter';
3
- import type { TypeScriptConfigurationOverwrite } from '../TypeScriptConfigurationOverwrite';
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[]): 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, };
@@ -1,142 +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.getArtifactsFromTypeScriptConfiguration = exports.getDependenciesFromTypeScriptConfiguration = exports.parseTypeScriptConfiguration = exports.isIncrementalCompilation = void 0;
7
- const path_1 = require("path");
8
- const forwardSlash_1 = __importDefault(require("../../utils/path/forwardSlash"));
9
- function parseTypeScriptConfiguration(typescript, configFileName, configFileContext, configOverwriteJSON, parseConfigFileHost) {
10
- const configFilePath = forwardSlash_1.default(configFileName);
11
- const parsedConfigFileJSON = typescript.readConfigFile(configFilePath, parseConfigFileHost.readFile);
12
- const overwrittenConfigFileJSON = Object.assign(Object.assign(Object.assign({}, (parsedConfigFileJSON.config || {})), configOverwriteJSON), { compilerOptions: Object.assign(Object.assign({}, ((parsedConfigFileJSON.config || {}).compilerOptions || {})), (configOverwriteJSON.compilerOptions || {})) });
13
- const parsedConfigFile = typescript.parseJsonConfigFileContent(overwrittenConfigFileJSON, parseConfigFileHost, configFileContext);
14
- return Object.assign(Object.assign({}, parsedConfigFile), { options: Object.assign(Object.assign({}, parsedConfigFile.options), { configFilePath: configFilePath }), errors: parsedConfigFileJSON.error ? [parsedConfigFileJSON.error] : parsedConfigFile.errors });
15
- }
16
- exports.parseTypeScriptConfiguration = parseTypeScriptConfiguration;
17
- function getDependenciesFromTypeScriptConfiguration(typescript, parsedConfiguration, configFileContext, parseConfigFileHost, processedConfigFiles = []) {
18
- var _a;
19
- const files = new Set(parsedConfiguration.fileNames);
20
- const configFilePath = parsedConfiguration.options.configFilePath;
21
- if (typeof configFilePath === 'string') {
22
- files.add(configFilePath);
23
- }
24
- const dirs = new Set(Object.keys(parsedConfiguration.wildcardDirectories || {}));
25
- const excluded = new Set((((_a = parsedConfiguration.raw) === null || _a === void 0 ? void 0 : _a.exclude) || []).map((path) => path_1.resolve(configFileContext, path)));
26
- for (const projectReference of parsedConfiguration.projectReferences || []) {
27
- const childConfigFilePath = typescript.resolveProjectReferencePath(projectReference);
28
- const childConfigContext = path_1.dirname(childConfigFilePath);
29
- if (processedConfigFiles.includes(childConfigFilePath)) {
30
- // handle circular dependencies
31
- continue;
32
- }
33
- const childParsedConfiguration = parseTypeScriptConfiguration(typescript, childConfigFilePath, childConfigContext, {}, parseConfigFileHost);
34
- const childDependencies = getDependenciesFromTypeScriptConfiguration(typescript, childParsedConfiguration, childConfigContext, parseConfigFileHost, [...processedConfigFiles, childConfigFilePath]);
35
- childDependencies.files.forEach((file) => {
36
- files.add(file);
37
- });
38
- childDependencies.dirs.forEach((dir) => {
39
- dirs.add(dir);
40
- });
41
- }
42
- const extensions = [
43
- typescript.Extension.Ts,
44
- typescript.Extension.Tsx,
45
- typescript.Extension.Js,
46
- typescript.Extension.Jsx,
47
- typescript.Extension.TsBuildInfo,
48
- ];
49
- return {
50
- files: Array.from(files).map((file) => path_1.normalize(file)),
51
- dirs: Array.from(dirs).map((dir) => path_1.normalize(dir)),
52
- excluded: Array.from(excluded).map((path) => path_1.normalize(path)),
53
- extensions: extensions,
54
- };
55
- }
56
- exports.getDependenciesFromTypeScriptConfiguration = getDependenciesFromTypeScriptConfiguration;
57
- function isIncrementalCompilation(options) {
58
- return Boolean((options.incremental || options.composite) && !options.outFile);
59
- }
60
- exports.isIncrementalCompilation = isIncrementalCompilation;
61
- function removeJsonExtension(path) {
62
- if (path.endsWith('.json')) {
63
- return path.slice(0, -'.json'.length);
64
- }
65
- else {
66
- return path;
67
- }
68
- }
69
- function getTsBuildInfoEmitOutputFilePath(typescript, options) {
70
- if (typeof typescript.getTsBuildInfoEmitOutputFilePath === 'function') {
71
- // old TypeScript version doesn't provides this method
72
- return typescript.getTsBuildInfoEmitOutputFilePath(options);
73
- }
74
- // based on the implementation from typescript
75
- const configFile = options.configFilePath;
76
- if (!isIncrementalCompilation(options)) {
77
- return undefined;
78
- }
79
- if (options.tsBuildInfoFile) {
80
- return options.tsBuildInfoFile;
81
- }
82
- const outPath = options.outFile || options.out;
83
- let buildInfoExtensionLess;
84
- if (outPath) {
85
- buildInfoExtensionLess = removeJsonExtension(outPath);
86
- }
87
- else {
88
- if (!configFile) {
89
- return undefined;
90
- }
91
- const configFileExtensionLess = removeJsonExtension(configFile);
92
- buildInfoExtensionLess = options.outDir
93
- ? options.rootDir
94
- ? path_1.resolve(options.outDir, path_1.relative(options.rootDir, configFileExtensionLess))
95
- : path_1.resolve(options.outDir, path_1.basename(configFileExtensionLess))
96
- : configFileExtensionLess;
97
- }
98
- return buildInfoExtensionLess + '.tsbuildinfo';
99
- }
100
- function getArtifactsFromTypeScriptConfiguration(typescript, parsedConfiguration, configFileContext, parseConfigFileHost, processedConfigFiles = []) {
101
- const files = new Set();
102
- const dirs = new Set();
103
- if (parsedConfiguration.fileNames.length > 0) {
104
- if (parsedConfiguration.options.outFile) {
105
- files.add(path_1.resolve(configFileContext, parsedConfiguration.options.outFile));
106
- }
107
- const tsBuildInfoPath = getTsBuildInfoEmitOutputFilePath(typescript, parsedConfiguration.options);
108
- if (tsBuildInfoPath) {
109
- files.add(path_1.resolve(configFileContext, tsBuildInfoPath));
110
- }
111
- if (parsedConfiguration.options.outDir) {
112
- dirs.add(path_1.resolve(configFileContext, parsedConfiguration.options.outDir));
113
- }
114
- }
115
- for (const projectReference of parsedConfiguration.projectReferences || []) {
116
- const configFile = typescript.resolveProjectReferencePath(projectReference);
117
- if (processedConfigFiles.includes(configFile)) {
118
- // handle circular dependencies
119
- continue;
120
- }
121
- const parsedConfiguration = parseTypeScriptConfiguration(typescript, configFile, path_1.dirname(configFile), {}, parseConfigFileHost);
122
- const childArtifacts = getArtifactsFromTypeScriptConfiguration(typescript, parsedConfiguration, configFileContext, parseConfigFileHost, [...processedConfigFiles, configFile]);
123
- childArtifacts.files.forEach((file) => {
124
- files.add(file);
125
- });
126
- childArtifacts.dirs.forEach((dir) => {
127
- dirs.add(dir);
128
- });
129
- }
130
- const extensions = [
131
- typescript.Extension.Dts,
132
- typescript.Extension.Js,
133
- typescript.Extension.TsBuildInfo,
134
- ];
135
- return {
136
- files: Array.from(files).map((file) => path_1.normalize(file)),
137
- dirs: Array.from(dirs).map((dir) => path_1.normalize(dir)),
138
- excluded: [],
139
- extensions,
140
- };
141
- }
142
- exports.getArtifactsFromTypeScriptConfiguration = getArtifactsFromTypeScriptConfiguration;
@@ -1,4 +0,0 @@
1
- import type { Reporter } from '../../reporter';
2
- import type { TypeScriptReporterConfiguration } from '../TypeScriptReporterConfiguration';
3
- declare function createTypeScriptReporter(configuration: TypeScriptReporterConfiguration): Reporter;
4
- export { createTypeScriptReporter };