fork-ts-checker-webpack-plugin 6.4.2 → 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 (260) hide show
  1. package/README.md +25 -103
  2. package/lib/ForkTsCheckerWebpackPlugin.d.ts +11 -12
  3. package/lib/ForkTsCheckerWebpackPlugin.js +49 -49
  4. package/lib/ForkTsCheckerWebpackPluginConfiguration.d.ts +6 -8
  5. package/lib/ForkTsCheckerWebpackPluginConfiguration.js +3 -4
  6. package/lib/ForkTsCheckerWebpackPluginOptions.d.ts +4 -6
  7. package/lib/ForkTsCheckerWebpackPluginOptions.json +73 -111
  8. package/lib/ForkTsCheckerWebpackPluginState.d.ts +5 -6
  9. package/lib/ForkTsCheckerWebpackPluginState.js +2 -2
  10. package/lib/{reporter/FilesChange.d.ts → files-change.d.ts} +4 -4
  11. package/lib/{reporter/FilesChange.js → files-change.js} +4 -3
  12. package/lib/{reporter/FilesMatch.d.ts → files-match.d.ts} +0 -0
  13. package/lib/{eslint-reporter/EsLintReporterOptions.js → files-match.js} +0 -0
  14. package/lib/formatter/BasicFormatter.d.ts +1 -1
  15. package/lib/formatter/BasicFormatter.js +1 -0
  16. package/lib/formatter/CodeFrameFormatter.d.ts +1 -1
  17. package/lib/formatter/CodeFrameFormatter.js +2 -1
  18. package/lib/formatter/Formatter.d.ts +1 -1
  19. package/lib/formatter/FormatterConfiguration.d.ts +3 -3
  20. package/lib/formatter/FormatterConfiguration.js +21 -2
  21. package/lib/formatter/FormatterOptions.d.ts +11 -6
  22. package/lib/formatter/WebpackFormatter.d.ts +1 -1
  23. package/lib/formatter/WebpackFormatter.js +6 -6
  24. package/lib/formatter/index.d.ts +0 -1
  25. package/lib/formatter/index.js +16 -8
  26. package/lib/hooks/interceptDoneToGetWebpackDevServerTap.d.ts +3 -3
  27. package/lib/hooks/interceptDoneToGetWebpackDevServerTap.js +4 -0
  28. package/lib/hooks/pluginHooks.d.ts +13 -13
  29. package/lib/hooks/pluginHooks.js +1 -0
  30. package/lib/hooks/pluginPools.d.ts +4 -0
  31. package/lib/hooks/pluginPools.js +28 -0
  32. package/lib/hooks/tapAfterCompileToAddDependencies.d.ts +3 -3
  33. package/lib/hooks/tapAfterCompileToAddDependencies.js +4 -0
  34. package/lib/hooks/tapAfterCompileToGetIssues.d.ts +3 -3
  35. package/lib/hooks/tapAfterCompileToGetIssues.js +5 -1
  36. package/lib/hooks/tapAfterEnvironmentToPatchWatching.d.ts +2 -2
  37. package/lib/hooks/tapAfterEnvironmentToPatchWatching.js +10 -1
  38. package/lib/hooks/tapDoneToAsyncGetIssues.d.ts +3 -3
  39. package/lib/hooks/tapDoneToAsyncGetIssues.js +7 -7
  40. package/lib/hooks/tapErrorToLogMessage.d.ts +2 -2
  41. package/lib/hooks/tapErrorToLogMessage.js +5 -4
  42. package/lib/hooks/tapStartToRunWorkers.d.ts +8 -0
  43. package/lib/hooks/tapStartToRunWorkers.js +95 -0
  44. package/lib/hooks/tapStopToTerminateWorkers.d.ts +5 -0
  45. package/lib/hooks/tapStopToTerminateWorkers.js +26 -0
  46. package/lib/infrastructure-logger.d.ts +10 -0
  47. package/lib/infrastructure-logger.js +15 -0
  48. package/lib/issue/Issue.d.ts +2 -3
  49. package/lib/issue/Issue.js +2 -3
  50. package/lib/issue/IssueConfiguration.d.ts +3 -3
  51. package/lib/issue/IssueConfiguration.js +1 -0
  52. package/lib/issue/IssueLocation.d.ts +2 -2
  53. package/lib/issue/IssueLocation.js +17 -2
  54. package/lib/issue/IssueMatch.d.ts +3 -3
  55. package/lib/issue/IssueMatch.js +3 -3
  56. package/lib/issue/IssueOptions.d.ts +2 -2
  57. package/lib/issue/IssuePosition.js +1 -0
  58. package/lib/issue/IssuePredicate.d.ts +1 -1
  59. package/lib/issue/IssuePredicate.js +1 -0
  60. package/lib/issue/IssueSeverity.js +1 -0
  61. package/lib/issue/IssueWebpackError.d.ts +3 -3
  62. package/lib/issue/IssueWebpackError.js +7 -5
  63. package/lib/issue/index.js +13 -6
  64. package/lib/logger/LoggerConfiguration.d.ts +3 -3
  65. package/lib/logger/LoggerConfiguration.js +2 -1
  66. package/lib/logger/LoggerFactory.d.ts +2 -2
  67. package/lib/logger/LoggerFactory.js +2 -1
  68. package/lib/logger/LoggerOptions.d.ts +2 -2
  69. package/lib/logger/PartialLogger.d.ts +1 -1
  70. package/lib/logger/PartialLogger.js +1 -0
  71. package/lib/logger/WebpackInfrastructureLogger.d.ts +2 -2
  72. package/lib/logger/WebpackInfrastructureLogger.js +1 -0
  73. package/lib/{typescript-reporter → typescript}/TypeScriptConfigurationOverwrite.d.ts +1 -1
  74. package/lib/{typescript-reporter → typescript}/TypeScriptConfigurationOverwrite.js +0 -0
  75. package/lib/{typescript-reporter → typescript}/TypeScriptDiagnosticsOptions.d.ts +0 -0
  76. package/lib/{typescript-reporter → typescript}/TypeScriptDiagnosticsOptions.js +0 -0
  77. package/lib/{typescript-reporter → typescript}/TypeScriptReporterConfiguration.d.ts +5 -5
  78. package/lib/{typescript-reporter → typescript}/TypeScriptReporterConfiguration.js +2 -0
  79. package/lib/{typescript-reporter → typescript}/TypeScriptReporterOptions.d.ts +4 -5
  80. package/lib/{typescript-reporter → typescript}/TypeScriptReporterOptions.js +0 -0
  81. package/lib/{typescript-reporter → typescript}/TypeScriptSupport.d.ts +1 -1
  82. package/lib/{typescript-reporter → typescript}/TypeScriptSupport.js +26 -11
  83. package/lib/{typescript-reporter → typescript}/extension/TypeScriptEmbeddedExtension.d.ts +1 -1
  84. package/lib/{typescript-reporter → typescript}/extension/TypeScriptEmbeddedExtension.js +2 -1
  85. package/lib/{typescript-reporter → typescript}/extension/TypeScriptExtension.d.ts +2 -2
  86. package/lib/{typescript-reporter → typescript}/extension/TypeScriptExtension.js +0 -0
  87. package/lib/typescript/extension/vue/TypeScriptVueExtension.d.ts +4 -0
  88. package/lib/{typescript-reporter → typescript}/extension/vue/TypeScriptVueExtension.js +2 -1
  89. package/lib/{typescript-reporter → typescript}/extension/vue/TypeScriptVueExtensionConfiguration.d.ts +1 -1
  90. package/lib/{typescript-reporter → typescript}/extension/vue/TypeScriptVueExtensionConfiguration.js +1 -0
  91. package/lib/{typescript-reporter → typescript}/extension/vue/TypeScriptVueExtensionOptions.d.ts +0 -0
  92. package/lib/{typescript-reporter → typescript}/extension/vue/TypeScriptVueExtensionOptions.js +0 -0
  93. package/lib/{typescript-reporter → typescript}/extension/vue/TypeScriptVueExtensionSupport.d.ts +1 -1
  94. package/lib/{typescript-reporter → typescript}/extension/vue/TypeScriptVueExtensionSupport.js +1 -0
  95. package/lib/{typescript-reporter → typescript}/extension/vue/types/vue-template-compiler.d.ts +0 -0
  96. package/lib/{typescript-reporter → typescript}/extension/vue/types/vue-template-compiler.js +0 -0
  97. package/lib/{typescript-reporter → typescript}/extension/vue/types/vue__compiler-sfc.d.ts +0 -0
  98. package/lib/{typescript-reporter → typescript}/extension/vue/types/vue__compiler-sfc.js +0 -0
  99. package/lib/typescript/worker/get-dependencies-worker.d.ts +5 -0
  100. package/lib/typescript/worker/get-dependencies-worker.js +18 -0
  101. package/lib/typescript/worker/get-issues-worker.d.ts +5 -0
  102. package/lib/typescript/worker/get-issues-worker.js +76 -0
  103. package/lib/typescript/worker/lib/artifacts.d.ts +4 -0
  104. package/lib/typescript/worker/lib/artifacts.js +90 -0
  105. package/lib/typescript/worker/lib/config.d.ts +14 -0
  106. package/lib/typescript/worker/lib/config.js +114 -0
  107. package/lib/typescript/worker/lib/dependencies.d.ts +3 -0
  108. package/lib/typescript/worker/lib/dependencies.js +87 -0
  109. package/lib/typescript/worker/lib/diagnostics.d.ts +7 -0
  110. package/lib/typescript/worker/lib/diagnostics.js +100 -0
  111. package/lib/typescript/worker/lib/extensions.d.ts +3 -0
  112. package/lib/typescript/worker/lib/extensions.js +11 -0
  113. package/lib/{typescript-reporter/file-system/FileSystem.d.ts → typescript/worker/lib/file-system/file-system.d.ts} +2 -3
  114. package/lib/{eslint-reporter/types/eslint.js → typescript/worker/lib/file-system/file-system.js} +0 -0
  115. package/lib/typescript/worker/lib/file-system/mem-file-system.d.ts +5 -0
  116. package/lib/typescript/worker/lib/file-system/mem-file-system.js +78 -0
  117. package/lib/typescript/worker/lib/file-system/passive-file-system.d.ts +5 -0
  118. package/lib/typescript/worker/lib/file-system/passive-file-system.js +65 -0
  119. package/lib/typescript/worker/lib/file-system/real-file-system.d.ts +5 -0
  120. package/lib/typescript/worker/lib/file-system/real-file-system.js +187 -0
  121. package/lib/typescript/worker/lib/host/compiler-host.d.ts +2 -0
  122. package/lib/typescript/worker/lib/host/compiler-host.js +17 -0
  123. package/lib/typescript/worker/lib/host/watch-compiler-host.d.ts +2 -0
  124. package/lib/typescript/worker/lib/host/watch-compiler-host.js +32 -0
  125. package/lib/typescript/worker/lib/host/watch-solution-builder-host.d.ts +2 -0
  126. package/lib/typescript/worker/lib/host/watch-solution-builder-host.js +54 -0
  127. package/lib/typescript/worker/lib/performance.d.ts +3 -0
  128. package/lib/typescript/worker/lib/performance.js +32 -0
  129. package/lib/typescript/worker/lib/program/program.d.ts +2 -0
  130. package/lib/typescript/worker/lib/program/program.js +32 -0
  131. package/lib/typescript/worker/lib/program/solution-builder.d.ts +2 -0
  132. package/lib/typescript/worker/lib/program/solution-builder.js +39 -0
  133. package/lib/typescript/worker/lib/program/watch-program.d.ts +3 -0
  134. package/lib/typescript/worker/lib/program/watch-program.js +49 -0
  135. package/lib/{typescript-reporter/reporter/ControlledTypeScriptSystem.d.ts → typescript/worker/lib/system.d.ts} +4 -6
  136. package/lib/typescript/worker/lib/system.js +209 -0
  137. package/lib/typescript/worker/lib/tracing.d.ts +4 -0
  138. package/lib/typescript/worker/lib/tracing.js +28 -0
  139. package/lib/typescript/worker/lib/tsbuildinfo.d.ts +4 -0
  140. package/lib/typescript/worker/lib/tsbuildinfo.js +92 -0
  141. package/lib/typescript/worker/lib/typescript.d.ts +2 -0
  142. package/lib/typescript/worker/lib/typescript.js +6 -0
  143. package/lib/typescript/worker/lib/worker-config.d.ts +2 -0
  144. package/lib/typescript/worker/lib/worker-config.js +5 -0
  145. package/lib/utils/async/pool.d.ts +2 -1
  146. package/lib/utils/async/pool.js +13 -14
  147. package/lib/utils/path/relativeToContext.d.ts +2 -0
  148. package/lib/utils/path/relativeToContext.js +16 -0
  149. package/lib/{rpc/rpc-ipc/error/RpcIpcMessagePortClosedError.d.ts → utils/rpc/error.d.ts} +2 -3
  150. package/lib/utils/rpc/error.js +12 -0
  151. package/lib/utils/rpc/expose.d.ts +1 -0
  152. package/lib/utils/rpc/expose.js +78 -0
  153. package/lib/utils/rpc/index.d.ts +5 -0
  154. package/lib/utils/rpc/index.js +12 -0
  155. package/lib/utils/rpc/types.d.ts +19 -0
  156. package/lib/{reporter/FilesMatch.js → utils/rpc/types.js} +0 -0
  157. package/lib/utils/rpc/worker.d.ts +13 -0
  158. package/lib/utils/rpc/worker.js +79 -0
  159. package/lib/utils/rpc/wrap.d.ts +4 -0
  160. package/lib/utils/rpc/wrap.js +96 -0
  161. package/lib/watch/InclusiveNodeWatchFileSystem.d.ts +5 -5
  162. package/lib/watch/InclusiveNodeWatchFileSystem.js +90 -92
  163. package/lib/watch/WatchFileSystem.d.ts +5 -22
  164. package/package.json +50 -67
  165. package/CHANGELOG.md +0 -318
  166. package/changelog.config.js +0 -36
  167. package/lib/error/OperationCanceledError.d.ts +0 -4
  168. package/lib/error/OperationCanceledError.js +0 -9
  169. package/lib/eslint-reporter/EsLintReporterConfiguration.d.ts +0 -11
  170. package/lib/eslint-reporter/EsLintReporterConfiguration.js +0 -26
  171. package/lib/eslint-reporter/EsLintReporterOptions.d.ts +0 -8
  172. package/lib/eslint-reporter/assertEsLintSupport.d.ts +0 -3
  173. package/lib/eslint-reporter/assertEsLintSupport.js +0 -30
  174. package/lib/eslint-reporter/issue/EsLintIssueFactory.d.ts +0 -4
  175. package/lib/eslint-reporter/issue/EsLintIssueFactory.js +0 -32
  176. package/lib/eslint-reporter/reporter/EsLintReporter.d.ts +0 -4
  177. package/lib/eslint-reporter/reporter/EsLintReporter.js +0 -179
  178. package/lib/eslint-reporter/reporter/EsLintReporterRpcClient.d.ts +0 -4
  179. package/lib/eslint-reporter/reporter/EsLintReporterRpcClient.js +0 -13
  180. package/lib/eslint-reporter/reporter/EsLintReporterRpcService.d.ts +0 -1
  181. package/lib/eslint-reporter/reporter/EsLintReporterRpcService.js +0 -11
  182. package/lib/eslint-reporter/types/eslint.d.ts +0 -37
  183. package/lib/formatter/FormatterFactory.d.ts +0 -13
  184. package/lib/formatter/FormatterFactory.js +0 -18
  185. package/lib/hooks/tapStartToConnectAndRunReporter.d.ts +0 -6
  186. package/lib/hooks/tapStartToConnectAndRunReporter.js +0 -125
  187. package/lib/hooks/tapStopToDisconnectReporter.d.ts +0 -5
  188. package/lib/hooks/tapStopToDisconnectReporter.js +0 -29
  189. package/lib/profile/Performance.d.ts +0 -11
  190. package/lib/profile/Performance.js +0 -62
  191. package/lib/reporter/AggregatedReporter.d.ts +0 -6
  192. package/lib/reporter/AggregatedReporter.js +0 -60
  193. package/lib/reporter/Report.d.ts +0 -8
  194. package/lib/reporter/Report.js +0 -2
  195. package/lib/reporter/Reporter.d.ts +0 -6
  196. package/lib/reporter/Reporter.js +0 -2
  197. package/lib/reporter/index.d.ts +0 -7
  198. package/lib/reporter/index.js +0 -9
  199. package/lib/reporter/reporter-rpc/ReporterRpcClient.d.ts +0 -10
  200. package/lib/reporter/reporter-rpc/ReporterRpcClient.js +0 -82
  201. package/lib/reporter/reporter-rpc/ReporterRpcProcedure.d.ts +0 -10
  202. package/lib/reporter/reporter-rpc/ReporterRpcProcedure.js +0 -12
  203. package/lib/reporter/reporter-rpc/ReporterRpcService.d.ts +0 -9
  204. package/lib/reporter/reporter-rpc/ReporterRpcService.js +0 -74
  205. package/lib/rpc/RpcClient.d.ts +0 -10
  206. package/lib/rpc/RpcClient.js +0 -78
  207. package/lib/rpc/RpcHost.d.ts +0 -6
  208. package/lib/rpc/RpcHost.js +0 -2
  209. package/lib/rpc/RpcMessage.d.ts +0 -26
  210. package/lib/rpc/RpcMessage.js +0 -45
  211. package/lib/rpc/RpcMessageChannel.d.ts +0 -10
  212. package/lib/rpc/RpcMessageChannel.js +0 -49
  213. package/lib/rpc/RpcMessagePort.d.ts +0 -14
  214. package/lib/rpc/RpcMessagePort.js +0 -2
  215. package/lib/rpc/RpcProcedure.d.ts +0 -5
  216. package/lib/rpc/RpcProcedure.js +0 -2
  217. package/lib/rpc/RpcService.d.ts +0 -12
  218. package/lib/rpc/RpcService.js +0 -63
  219. package/lib/rpc/error/RpcMessagePortClosedError.d.ts +0 -3
  220. package/lib/rpc/error/RpcMessagePortClosedError.js +0 -5
  221. package/lib/rpc/error/RpcRemoteError.d.ts +0 -6
  222. package/lib/rpc/error/RpcRemoteError.js +0 -17
  223. package/lib/rpc/index.d.ts +0 -7
  224. package/lib/rpc/index.js +0 -9
  225. package/lib/rpc/rpc-ipc/ProcessLike.d.ts +0 -12
  226. package/lib/rpc/rpc-ipc/ProcessLike.js +0 -3
  227. package/lib/rpc/rpc-ipc/RpcIpcMessageChannel.d.ts +0 -3
  228. package/lib/rpc/rpc-ipc/RpcIpcMessageChannel.js +0 -10
  229. package/lib/rpc/rpc-ipc/RpcIpcMessagePort.d.ts +0 -5
  230. package/lib/rpc/rpc-ipc/RpcIpcMessagePort.js +0 -150
  231. package/lib/rpc/rpc-ipc/error/RpcIpcMessagePortClosedError.js +0 -12
  232. package/lib/rpc/rpc-ipc/index.d.ts +0 -2
  233. package/lib/rpc/rpc-ipc/index.js +0 -7
  234. package/lib/typescript-reporter/extension/vue/TypeScriptVueExtension.d.ts +0 -4
  235. package/lib/typescript-reporter/file-system/FileSystem.js +0 -2
  236. package/lib/typescript-reporter/file-system/MemFileSystem.d.ts +0 -8
  237. package/lib/typescript-reporter/file-system/MemFileSystem.js +0 -81
  238. package/lib/typescript-reporter/file-system/PassiveFileSystem.d.ts +0 -9
  239. package/lib/typescript-reporter/file-system/PassiveFileSystem.js +0 -68
  240. package/lib/typescript-reporter/file-system/RealFileSystem.d.ts +0 -8
  241. package/lib/typescript-reporter/file-system/RealFileSystem.js +0 -179
  242. package/lib/typescript-reporter/issue/TypeScriptIssueFactory.d.ts +0 -4
  243. package/lib/typescript-reporter/issue/TypeScriptIssueFactory.js +0 -45
  244. package/lib/typescript-reporter/profile/TypeScriptPerformance.d.ts +0 -10
  245. package/lib/typescript-reporter/profile/TypeScriptPerformance.js +0 -33
  246. package/lib/typescript-reporter/reporter/ControlledTypeScriptSystem.js +0 -229
  247. package/lib/typescript-reporter/reporter/ControlledWatchCompilerHost.d.ts +0 -5
  248. package/lib/typescript-reporter/reporter/ControlledWatchCompilerHost.js +0 -28
  249. package/lib/typescript-reporter/reporter/ControlledWatchSolutionBuilderHost.d.ts +0 -5
  250. package/lib/typescript-reporter/reporter/ControlledWatchSolutionBuilderHost.js +0 -50
  251. package/lib/typescript-reporter/reporter/TypeScriptConfigurationParser.d.ts +0 -8
  252. package/lib/typescript-reporter/reporter/TypeScriptConfigurationParser.js +0 -136
  253. package/lib/typescript-reporter/reporter/TypeScriptReporter.d.ts +0 -4
  254. package/lib/typescript-reporter/reporter/TypeScriptReporter.js +0 -352
  255. package/lib/typescript-reporter/reporter/TypeScriptReporterRpcClient.d.ts +0 -4
  256. package/lib/typescript-reporter/reporter/TypeScriptReporterRpcClient.js +0 -13
  257. package/lib/typescript-reporter/reporter/TypeScriptReporterRpcService.d.ts +0 -1
  258. package/lib/typescript-reporter/reporter/TypeScriptReporterRpcService.js +0 -11
  259. package/lib/watch/CompilerWithWatchFileSystem.d.ts +0 -6
  260. package/lib/watch/CompilerWithWatchFileSystem.js +0 -2
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createWatchSolutionBuilderHost = void 0;
4
+ const extensions_1 = require("../extensions");
5
+ const system_1 = require("../system");
6
+ const typescript_1 = require("../typescript");
7
+ const watch_compiler_host_1 = require("./watch-compiler-host");
8
+ function createWatchSolutionBuilderHost(parsedConfig, createProgram, reportDiagnostic, reportWatchStatus, reportSolutionBuilderStatus, afterProgramCreate, afterProgramEmitAndDiagnostics) {
9
+ const controlledWatchCompilerHost = watch_compiler_host_1.createWatchCompilerHost(parsedConfig, createProgram, reportDiagnostic, reportWatchStatus, afterProgramCreate);
10
+ let controlledWatchSolutionBuilderHost = Object.assign(Object.assign({}, controlledWatchCompilerHost), { reportDiagnostic(diagnostic) {
11
+ if (reportDiagnostic) {
12
+ reportDiagnostic(diagnostic);
13
+ }
14
+ },
15
+ reportSolutionBuilderStatus(diagnostic) {
16
+ if (reportSolutionBuilderStatus) {
17
+ reportSolutionBuilderStatus(diagnostic);
18
+ }
19
+ },
20
+ afterProgramEmitAndDiagnostics(program) {
21
+ if (afterProgramEmitAndDiagnostics) {
22
+ afterProgramEmitAndDiagnostics(program);
23
+ }
24
+ },
25
+ createDirectory(path) {
26
+ system_1.system.createDirectory(path);
27
+ },
28
+ writeFile(path, data) {
29
+ system_1.system.writeFile(path, data);
30
+ },
31
+ getModifiedTime(fileName) {
32
+ return system_1.system.getModifiedTime(fileName);
33
+ },
34
+ setModifiedTime(fileName, date) {
35
+ system_1.system.setModifiedTime(fileName, date);
36
+ },
37
+ deleteFile(fileName) {
38
+ system_1.system.deleteFile(fileName);
39
+ },
40
+ getParsedCommandLine(fileName) {
41
+ return typescript_1.typescript.getParsedCommandLineOfConfigFile(fileName, { skipLibCheck: true }, Object.assign(Object.assign({}, system_1.system), { onUnRecoverableConfigFileDiagnostic: (diagnostic) => {
42
+ if (reportDiagnostic) {
43
+ reportDiagnostic(diagnostic);
44
+ }
45
+ } }));
46
+ } });
47
+ extensions_1.extensions.forEach((extension) => {
48
+ if (extension.extendWatchSolutionBuilderHost) {
49
+ controlledWatchSolutionBuilderHost = extension.extendWatchSolutionBuilderHost(controlledWatchSolutionBuilderHost, parsedConfig);
50
+ }
51
+ });
52
+ return controlledWatchSolutionBuilderHost;
53
+ }
54
+ exports.createWatchSolutionBuilderHost = createWatchSolutionBuilderHost;
@@ -0,0 +1,3 @@
1
+ export declare function enablePerformanceIfNeeded(): void;
2
+ export declare function disablePerformanceIfNeeded(): void;
3
+ export declare function printPerformanceMeasuresIfNeeded(): void;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.printPerformanceMeasuresIfNeeded = exports.disablePerformanceIfNeeded = exports.enablePerformanceIfNeeded = void 0;
4
+ const typescript_1 = require("./typescript");
5
+ const worker_config_1 = require("./worker-config");
6
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
+ const performance = typescript_1.typescript.performance;
8
+ function enablePerformanceIfNeeded() {
9
+ var _a;
10
+ if (worker_config_1.config.profile) {
11
+ (_a = performance === null || performance === void 0 ? void 0 : performance.enable) === null || _a === void 0 ? void 0 : _a.call(performance);
12
+ }
13
+ }
14
+ exports.enablePerformanceIfNeeded = enablePerformanceIfNeeded;
15
+ function disablePerformanceIfNeeded() {
16
+ var _a;
17
+ if (worker_config_1.config.profile) {
18
+ (_a = performance === null || performance === void 0 ? void 0 : performance.disable) === null || _a === void 0 ? void 0 : _a.call(performance);
19
+ }
20
+ }
21
+ exports.disablePerformanceIfNeeded = disablePerformanceIfNeeded;
22
+ function printPerformanceMeasuresIfNeeded() {
23
+ var _a;
24
+ if (worker_config_1.config.profile) {
25
+ const measures = {};
26
+ (_a = performance === null || performance === void 0 ? void 0 : performance.forEachMeasure) === null || _a === void 0 ? void 0 : _a.call(performance, (measureName, duration) => {
27
+ measures[measureName] = duration;
28
+ });
29
+ console.table(measures);
30
+ }
31
+ }
32
+ exports.printPerformanceMeasuresIfNeeded = printPerformanceMeasuresIfNeeded;
@@ -0,0 +1,2 @@
1
+ export declare function useProgram(): void;
2
+ export declare function invalidateProgram(withHost?: boolean): void;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.invalidateProgram = exports.useProgram = void 0;
4
+ const config_1 = require("../config");
5
+ const diagnostics_1 = require("../diagnostics");
6
+ const compiler_host_1 = require("../host/compiler-host");
7
+ const typescript_1 = require("../typescript");
8
+ let compilerHost;
9
+ let program;
10
+ function useProgram() {
11
+ const parsedConfig = config_1.getParsedConfig();
12
+ if (!compilerHost) {
13
+ compilerHost = compiler_host_1.createCompilerHost(parsedConfig);
14
+ }
15
+ if (!program) {
16
+ program = typescript_1.typescript.createProgram({
17
+ rootNames: parsedConfig.fileNames,
18
+ options: parsedConfig.options,
19
+ projectReferences: parsedConfig.projectReferences,
20
+ host: compilerHost,
21
+ });
22
+ }
23
+ diagnostics_1.updateDiagnostics(config_1.getConfigFilePathFromProgram(program), diagnostics_1.getDiagnosticsOfProgram(program));
24
+ }
25
+ exports.useProgram = useProgram;
26
+ function invalidateProgram(withHost = false) {
27
+ if (withHost) {
28
+ compilerHost = undefined;
29
+ }
30
+ program = undefined;
31
+ }
32
+ exports.invalidateProgram = invalidateProgram;
@@ -0,0 +1,2 @@
1
+ export declare function useSolutionBuilder(): void;
2
+ export declare function invalidateSolutionBuilder(withHost?: boolean): void;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.invalidateSolutionBuilder = exports.useSolutionBuilder = void 0;
4
+ const config_1 = require("../config");
5
+ const diagnostics_1 = require("../diagnostics");
6
+ const watch_solution_builder_host_1 = require("../host/watch-solution-builder-host");
7
+ const tracing_1 = require("../tracing");
8
+ const tsbuildinfo_1 = require("../tsbuildinfo");
9
+ const typescript_1 = require("../typescript");
10
+ const worker_config_1 = require("../worker-config");
11
+ let solutionBuilderHost;
12
+ let solutionBuilder;
13
+ function useSolutionBuilder() {
14
+ if (!solutionBuilderHost) {
15
+ const parsedConfig = config_1.getParsedConfig();
16
+ solutionBuilderHost = watch_solution_builder_host_1.createWatchSolutionBuilderHost(parsedConfig, (rootNames, compilerOptions, host, oldProgram, configFileParsingDiagnostics, projectReferences) => {
17
+ if (compilerOptions) {
18
+ tracing_1.startTracingIfNeeded(compilerOptions);
19
+ }
20
+ return typescript_1.typescript.createSemanticDiagnosticsBuilderProgram(rootNames, compilerOptions, host, oldProgram, configFileParsingDiagnostics, projectReferences);
21
+ }, undefined, undefined, undefined, undefined, (builderProgram) => {
22
+ diagnostics_1.updateDiagnostics(config_1.getConfigFilePathFromBuilderProgram(builderProgram), diagnostics_1.getDiagnosticsOfProgram(builderProgram));
23
+ tsbuildinfo_1.emitTsBuildInfoIfNeeded(builderProgram);
24
+ tracing_1.stopTracingIfNeeded(builderProgram);
25
+ });
26
+ }
27
+ if (!solutionBuilder) {
28
+ solutionBuilder = typescript_1.typescript.createSolutionBuilderWithWatch(solutionBuilderHost, [worker_config_1.config.configFile], { watch: true });
29
+ solutionBuilder.build();
30
+ }
31
+ }
32
+ exports.useSolutionBuilder = useSolutionBuilder;
33
+ function invalidateSolutionBuilder(withHost = false) {
34
+ if (withHost) {
35
+ solutionBuilderHost = undefined;
36
+ }
37
+ solutionBuilder = undefined;
38
+ }
39
+ exports.invalidateSolutionBuilder = invalidateSolutionBuilder;
@@ -0,0 +1,3 @@
1
+ export declare function useWatchProgram(): void;
2
+ export declare function invalidateWatchProgram(withHost?: boolean): void;
3
+ export declare function invalidateWatchProgramRootFileNames(): void;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.invalidateWatchProgramRootFileNames = exports.invalidateWatchProgram = exports.useWatchProgram = void 0;
4
+ const config_1 = require("../config");
5
+ const dependencies_1 = require("../dependencies");
6
+ const diagnostics_1 = require("../diagnostics");
7
+ const watch_compiler_host_1 = require("../host/watch-compiler-host");
8
+ const tracing_1 = require("../tracing");
9
+ const tsbuildinfo_1 = require("../tsbuildinfo");
10
+ const typescript_1 = require("../typescript");
11
+ let watchCompilerHost;
12
+ let watchProgram;
13
+ let shouldUpdateRootFiles = false;
14
+ function useWatchProgram() {
15
+ if (!watchCompilerHost) {
16
+ const parsedConfig = config_1.getParsedConfig();
17
+ watchCompilerHost = watch_compiler_host_1.createWatchCompilerHost(parsedConfig, (rootNames, compilerOptions, host, oldProgram, configFileParsingDiagnostics, projectReferences) => {
18
+ if (compilerOptions) {
19
+ tracing_1.startTracingIfNeeded(compilerOptions);
20
+ }
21
+ return typescript_1.typescript.createSemanticDiagnosticsBuilderProgram(rootNames, compilerOptions, host, oldProgram, configFileParsingDiagnostics, projectReferences);
22
+ }, undefined, undefined, (builderProgram) => {
23
+ diagnostics_1.updateDiagnostics(config_1.getConfigFilePathFromBuilderProgram(builderProgram), diagnostics_1.getDiagnosticsOfProgram(builderProgram));
24
+ tsbuildinfo_1.emitTsBuildInfoIfNeeded(builderProgram);
25
+ tracing_1.stopTracingIfNeeded(builderProgram);
26
+ });
27
+ watchProgram = undefined;
28
+ }
29
+ if (!watchProgram) {
30
+ watchProgram = typescript_1.typescript.createWatchProgram(watchCompilerHost);
31
+ }
32
+ if (shouldUpdateRootFiles) {
33
+ // we have to update root files manually as don't use config file as a program input
34
+ watchProgram.updateRootFileNames(dependencies_1.getDependencies().files);
35
+ shouldUpdateRootFiles = false;
36
+ }
37
+ }
38
+ exports.useWatchProgram = useWatchProgram;
39
+ function invalidateWatchProgram(withHost = false) {
40
+ if (withHost) {
41
+ watchCompilerHost = undefined;
42
+ }
43
+ watchProgram = undefined;
44
+ }
45
+ exports.invalidateWatchProgram = invalidateWatchProgram;
46
+ function invalidateWatchProgramRootFileNames() {
47
+ shouldUpdateRootFiles = true;
48
+ }
49
+ exports.invalidateWatchProgramRootFileNames = invalidateWatchProgramRootFileNames;
@@ -1,10 +1,10 @@
1
1
  import type * as ts from 'typescript';
2
- import { FilesMatch } from '../../reporter';
3
- interface ControlledTypeScriptSystem extends ts.System {
2
+ import type { FilesMatch } from '../../../files-match';
3
+ export interface ControlledTypeScriptSystem extends ts.System {
4
4
  invokeFileCreated(path: string): void;
5
5
  invokeFileChanged(path: string): void;
6
6
  invokeFileDeleted(path: string): void;
7
- clearCache(): void;
7
+ invalidateCache(): void;
8
8
  getFileSize(path: string): number;
9
9
  watchFile(path: string, callback: ts.FileWatcherCallback, pollingInterval?: number, options?: ts.WatchOptions): ts.FileWatcher;
10
10
  watchDirectory(path: string, callback: ts.DirectoryWatcherCallback, recursive?: boolean, options?: ts.WatchOptions): ts.FileWatcher;
@@ -16,6 +16,4 @@ interface ControlledTypeScriptSystem extends ts.System {
16
16
  waitForQueued(): Promise<void>;
17
17
  setArtifacts(artifacts: FilesMatch): void;
18
18
  }
19
- declare type FileSystemMode = 'readonly' | 'write-tsbuildinfo' | 'write-references';
20
- declare function createControlledTypeScriptSystem(typescript: typeof ts, mode?: FileSystemMode): ControlledTypeScriptSystem;
21
- export { createControlledTypeScriptSystem, ControlledTypeScriptSystem };
19
+ export declare const system: ControlledTypeScriptSystem;
@@ -0,0 +1,209 @@
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.system = void 0;
16
+ const path_1 = require("path");
17
+ const forwardSlash_1 = __importDefault(require("../../../utils/path/forwardSlash"));
18
+ const mem_file_system_1 = require("./file-system/mem-file-system");
19
+ const passive_file_system_1 = require("./file-system/passive-file-system");
20
+ const real_file_system_1 = require("./file-system/real-file-system");
21
+ const typescript_1 = require("./typescript");
22
+ const worker_config_1 = require("./worker-config");
23
+ const mode = worker_config_1.config.mode;
24
+ let artifacts = {
25
+ files: [],
26
+ dirs: [],
27
+ excluded: [],
28
+ extensions: [],
29
+ };
30
+ let isInitialRun = true;
31
+ // watchers
32
+ const fileWatcherCallbacksMap = new Map();
33
+ const directoryWatcherCallbacksMap = new Map();
34
+ const recursiveDirectoryWatcherCallbacksMap = new Map();
35
+ const deletedFiles = new Map();
36
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
+ const timeoutCallbacks = new Set();
38
+ // based on the ts.ignorePaths
39
+ const ignoredPaths = ['/node_modules/.', '/.git', '/.#'];
40
+ exports.system = Object.assign(Object.assign({}, typescript_1.typescript.sys), { useCaseSensitiveFileNames: true, fileExists(path) {
41
+ const stats = getReadFileSystem(path).readStats(path);
42
+ return !!stats && stats.isFile();
43
+ },
44
+ readFile(path, encoding) {
45
+ return getReadFileSystem(path).readFile(path, encoding);
46
+ },
47
+ getFileSize(path) {
48
+ const stats = getReadFileSystem(path).readStats(path);
49
+ return stats ? stats.size : 0;
50
+ },
51
+ writeFile(path, data) {
52
+ getWriteFileSystem(path).writeFile(path, data);
53
+ exports.system.invokeFileChanged(path);
54
+ },
55
+ deleteFile(path) {
56
+ getWriteFileSystem(path).deleteFile(path);
57
+ exports.system.invokeFileDeleted(path);
58
+ },
59
+ directoryExists(path) {
60
+ var _a;
61
+ return Boolean((_a = getReadFileSystem(path).readStats(path)) === null || _a === void 0 ? void 0 : _a.isDirectory());
62
+ },
63
+ createDirectory(path) {
64
+ getWriteFileSystem(path).createDir(path);
65
+ invokeDirectoryWatchers(path);
66
+ },
67
+ getDirectories(path) {
68
+ const dirents = getReadFileSystem(path).readDir(path);
69
+ return dirents
70
+ .filter((dirent) => dirent.isDirectory() ||
71
+ (dirent.isSymbolicLink() && exports.system.directoryExists(path_1.join(path, dirent.name))))
72
+ .map((dirent) => dirent.name);
73
+ },
74
+ getModifiedTime(path) {
75
+ const stats = getReadFileSystem(path).readStats(path);
76
+ if (stats) {
77
+ return stats.mtime;
78
+ }
79
+ },
80
+ setModifiedTime(path, date) {
81
+ getWriteFileSystem(path).updateTimes(path, date, date);
82
+ invokeDirectoryWatchers(path);
83
+ invokeFileWatchers(path, typescript_1.typescript.FileWatcherEventKind.Changed);
84
+ },
85
+ watchFile(path, callback) {
86
+ return createWatcher(fileWatcherCallbacksMap, path, callback);
87
+ },
88
+ watchDirectory(path, callback, recursive = false) {
89
+ return createWatcher(recursive ? recursiveDirectoryWatcherCallbacksMap : directoryWatcherCallbacksMap, path, callback);
90
+ },
91
+ // use immediate instead of timeout to avoid waiting 250ms for batching files changes
92
+ setTimeout: (callback, timeout, ...args) => {
93
+ const timeoutId = setImmediate(() => {
94
+ callback(...args);
95
+ timeoutCallbacks.delete(timeoutId);
96
+ });
97
+ timeoutCallbacks.add(timeoutId);
98
+ return timeoutId;
99
+ }, clearTimeout: (timeoutId) => {
100
+ clearImmediate(timeoutId);
101
+ timeoutCallbacks.delete(timeoutId);
102
+ }, waitForQueued() {
103
+ return __awaiter(this, void 0, void 0, function* () {
104
+ while (timeoutCallbacks.size > 0) {
105
+ yield new Promise((resolve) => setImmediate(resolve));
106
+ }
107
+ isInitialRun = false;
108
+ });
109
+ },
110
+ invokeFileCreated(path) {
111
+ const normalizedPath = real_file_system_1.realFileSystem.normalizePath(path);
112
+ invokeFileWatchers(path, typescript_1.typescript.FileWatcherEventKind.Created);
113
+ invokeDirectoryWatchers(normalizedPath);
114
+ deletedFiles.set(normalizedPath, false);
115
+ },
116
+ invokeFileChanged(path) {
117
+ const normalizedPath = real_file_system_1.realFileSystem.normalizePath(path);
118
+ if (deletedFiles.get(normalizedPath) || !fileWatcherCallbacksMap.has(normalizedPath)) {
119
+ invokeFileWatchers(path, typescript_1.typescript.FileWatcherEventKind.Created);
120
+ invokeDirectoryWatchers(normalizedPath);
121
+ deletedFiles.set(normalizedPath, false);
122
+ }
123
+ else {
124
+ invokeFileWatchers(path, typescript_1.typescript.FileWatcherEventKind.Changed);
125
+ }
126
+ },
127
+ invokeFileDeleted(path) {
128
+ const normalizedPath = real_file_system_1.realFileSystem.normalizePath(path);
129
+ if (!deletedFiles.get(normalizedPath)) {
130
+ invokeFileWatchers(path, typescript_1.typescript.FileWatcherEventKind.Deleted);
131
+ invokeDirectoryWatchers(path);
132
+ deletedFiles.set(normalizedPath, true);
133
+ }
134
+ },
135
+ invalidateCache() {
136
+ real_file_system_1.realFileSystem.clearCache();
137
+ mem_file_system_1.memFileSystem.clearCache();
138
+ passive_file_system_1.passiveFileSystem.clearCache();
139
+ },
140
+ setArtifacts(nextArtifacts) {
141
+ artifacts = nextArtifacts;
142
+ } });
143
+ function createWatcher(watchersMap, path, callback) {
144
+ const normalizedPath = real_file_system_1.realFileSystem.normalizePath(path);
145
+ const watchers = watchersMap.get(normalizedPath) || [];
146
+ const nextWatchers = [...watchers, callback];
147
+ watchersMap.set(normalizedPath, nextWatchers);
148
+ return {
149
+ close: () => {
150
+ const watchers = watchersMap.get(normalizedPath) || [];
151
+ const nextWatchers = watchers.filter((watcher) => watcher !== callback);
152
+ if (nextWatchers.length > 0) {
153
+ watchersMap.set(normalizedPath, nextWatchers);
154
+ }
155
+ else {
156
+ watchersMap.delete(normalizedPath);
157
+ }
158
+ },
159
+ };
160
+ }
161
+ function invokeFileWatchers(path, event) {
162
+ const normalizedPath = real_file_system_1.realFileSystem.normalizePath(path);
163
+ if (normalizedPath.endsWith('.js')) {
164
+ // trigger relevant .d.ts file watcher - handles the case, when we have webpack watcher
165
+ // that points to a symlinked package
166
+ invokeFileWatchers(normalizedPath.slice(0, -3) + '.d.ts', event);
167
+ }
168
+ const fileWatcherCallbacks = fileWatcherCallbacksMap.get(normalizedPath);
169
+ if (fileWatcherCallbacks) {
170
+ // typescript expects normalized paths with posix forward slash
171
+ fileWatcherCallbacks.forEach((fileWatcherCallback) => fileWatcherCallback(forwardSlash_1.default(normalizedPath), event));
172
+ }
173
+ }
174
+ function invokeDirectoryWatchers(path) {
175
+ const normalizedPath = real_file_system_1.realFileSystem.normalizePath(path);
176
+ const directory = path_1.dirname(normalizedPath);
177
+ if (ignoredPaths.some((ignoredPath) => forwardSlash_1.default(normalizedPath).includes(ignoredPath))) {
178
+ return;
179
+ }
180
+ const directoryWatcherCallbacks = directoryWatcherCallbacksMap.get(directory);
181
+ if (directoryWatcherCallbacks) {
182
+ directoryWatcherCallbacks.forEach((directoryWatcherCallback) => directoryWatcherCallback(forwardSlash_1.default(normalizedPath)));
183
+ }
184
+ recursiveDirectoryWatcherCallbacksMap.forEach((recursiveDirectoryWatcherCallbacks, watchedDirectory) => {
185
+ if (watchedDirectory === directory ||
186
+ (directory.startsWith(watchedDirectory) &&
187
+ forwardSlash_1.default(directory)[watchedDirectory.length] === '/')) {
188
+ recursiveDirectoryWatcherCallbacks.forEach((recursiveDirectoryWatcherCallback) => recursiveDirectoryWatcherCallback(forwardSlash_1.default(normalizedPath)));
189
+ }
190
+ });
191
+ }
192
+ function isArtifact(path) {
193
+ return ((artifacts.dirs.some((dir) => path.includes(dir)) ||
194
+ artifacts.files.some((file) => path === file)) &&
195
+ artifacts.extensions.some((extension) => path.endsWith(extension)));
196
+ }
197
+ function getReadFileSystem(path) {
198
+ if (!isInitialRun && (mode === 'readonly' || mode === 'write-tsbuildinfo') && isArtifact(path)) {
199
+ return mem_file_system_1.memFileSystem;
200
+ }
201
+ return passive_file_system_1.passiveFileSystem;
202
+ }
203
+ function getWriteFileSystem(path) {
204
+ if (mode === 'write-references' ||
205
+ (mode === 'write-tsbuildinfo' && path.endsWith('.tsbuildinfo'))) {
206
+ return real_file_system_1.realFileSystem;
207
+ }
208
+ return passive_file_system_1.passiveFileSystem;
209
+ }
@@ -0,0 +1,4 @@
1
+ import type * as ts from 'typescript';
2
+ export declare function startTracingIfNeeded(compilerOptions: ts.CompilerOptions): void;
3
+ export declare function stopTracingIfNeeded(program: ts.BuilderProgram): void;
4
+ export declare function dumpTracingLegendIfNeeded(): void;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dumpTracingLegendIfNeeded = exports.stopTracingIfNeeded = exports.startTracingIfNeeded = void 0;
4
+ const config_1 = require("./config");
5
+ const typescript_1 = require("./typescript");
6
+ const worker_config_1 = require("./worker-config");
7
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
+ const tracing = typescript_1.typescript.tracing;
9
+ function startTracingIfNeeded(compilerOptions) {
10
+ if (compilerOptions.generateTrace && tracing) {
11
+ tracing.startTracing(config_1.getConfigFilePathFromCompilerOptions(compilerOptions), compilerOptions.generateTrace, worker_config_1.config.build);
12
+ }
13
+ }
14
+ exports.startTracingIfNeeded = startTracingIfNeeded;
15
+ function stopTracingIfNeeded(program) {
16
+ const compilerOptions = program.getCompilerOptions();
17
+ if (compilerOptions.generateTrace && tracing) {
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
+ tracing.stopTracing(program.getProgram().getTypeCatalog());
20
+ }
21
+ }
22
+ exports.stopTracingIfNeeded = stopTracingIfNeeded;
23
+ function dumpTracingLegendIfNeeded() {
24
+ if (tracing) {
25
+ tracing.dumpLegend();
26
+ }
27
+ }
28
+ exports.dumpTracingLegendIfNeeded = dumpTracingLegendIfNeeded;
@@ -0,0 +1,4 @@
1
+ import type * as ts from 'typescript';
2
+ export declare function invalidateTsBuildInfo(): void;
3
+ export declare function emitTsBuildInfoIfNeeded(builderProgram: ts.BuilderProgram): void;
4
+ export declare function getTsBuildInfoEmitPath(compilerOptions: ts.CompilerOptions): string | undefined;
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.getTsBuildInfoEmitPath = exports.emitTsBuildInfoIfNeeded = exports.invalidateTsBuildInfo = void 0;
23
+ const path = __importStar(require("path"));
24
+ const config_1 = require("./config");
25
+ const system_1 = require("./system");
26
+ const typescript_1 = require("./typescript");
27
+ const worker_config_1 = require("./worker-config");
28
+ function invalidateTsBuildInfo() {
29
+ const parsedConfig = config_1.getParsedConfig();
30
+ // try to remove outdated .tsbuildinfo file for incremental mode
31
+ if (typeof typescript_1.typescript.getTsBuildInfoEmitOutputFilePath === 'function' &&
32
+ worker_config_1.config.mode !== 'readonly' &&
33
+ parsedConfig.options.incremental) {
34
+ const tsBuildInfoPath = typescript_1.typescript.getTsBuildInfoEmitOutputFilePath(parsedConfig.options);
35
+ if (tsBuildInfoPath) {
36
+ try {
37
+ system_1.system.deleteFile(tsBuildInfoPath);
38
+ }
39
+ catch (error) {
40
+ // silent
41
+ }
42
+ }
43
+ }
44
+ }
45
+ exports.invalidateTsBuildInfo = invalidateTsBuildInfo;
46
+ function emitTsBuildInfoIfNeeded(builderProgram) {
47
+ const parsedConfig = config_1.getParsedConfig();
48
+ if (worker_config_1.config.mode !== 'readonly' && parsedConfig && isIncrementalEnabled(parsedConfig.options)) {
49
+ const program = builderProgram.getProgram();
50
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
51
+ if (typeof program.emitBuildInfo === 'function') {
52
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
+ program.emitBuildInfo();
54
+ }
55
+ }
56
+ }
57
+ exports.emitTsBuildInfoIfNeeded = emitTsBuildInfoIfNeeded;
58
+ function getTsBuildInfoEmitPath(compilerOptions) {
59
+ if (typeof typescript_1.typescript.getTsBuildInfoEmitOutputFilePath === 'function') {
60
+ return typescript_1.typescript.getTsBuildInfoEmitOutputFilePath(compilerOptions);
61
+ }
62
+ const removeJsonExtension = (filePath) => filePath.endsWith('.json') ? filePath.slice(0, -'.json'.length) : filePath;
63
+ // based on the implementation from typescript
64
+ const configFile = compilerOptions.configFilePath;
65
+ if (!isIncrementalEnabled(compilerOptions)) {
66
+ return undefined;
67
+ }
68
+ if (compilerOptions.tsBuildInfoFile) {
69
+ return compilerOptions.tsBuildInfoFile;
70
+ }
71
+ const outPath = compilerOptions.outFile || compilerOptions.out;
72
+ let buildInfoExtensionLess;
73
+ if (outPath) {
74
+ buildInfoExtensionLess = removeJsonExtension(outPath);
75
+ }
76
+ else {
77
+ if (!configFile) {
78
+ return undefined;
79
+ }
80
+ const configFileExtensionLess = removeJsonExtension(configFile);
81
+ buildInfoExtensionLess = compilerOptions.outDir
82
+ ? compilerOptions.rootDir
83
+ ? path.resolve(compilerOptions.outDir, path.relative(compilerOptions.rootDir, configFileExtensionLess))
84
+ : path.resolve(compilerOptions.outDir, path.basename(configFileExtensionLess))
85
+ : configFileExtensionLess;
86
+ }
87
+ return buildInfoExtensionLess + '.tsbuildinfo';
88
+ }
89
+ exports.getTsBuildInfoEmitPath = getTsBuildInfoEmitPath;
90
+ function isIncrementalEnabled(compilerOptions) {
91
+ return Boolean((compilerOptions.incremental || compilerOptions.composite) && !compilerOptions.outFile);
92
+ }
@@ -0,0 +1,2 @@
1
+ import type * as ts from 'typescript';
2
+ export declare const typescript: typeof ts;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.typescript = void 0;
4
+ const worker_config_1 = require("./worker-config");
5
+ // eslint-disable-next-line
6
+ exports.typescript = require(worker_config_1.config.typescriptPath);
@@ -0,0 +1,2 @@
1
+ import type { TypeScriptReporterConfiguration } from '../../TypeScriptReporterConfiguration';
2
+ export declare const config: TypeScriptReporterConfiguration;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.config = void 0;
4
+ const rpc_1 = require("../../../utils/rpc");
5
+ exports.config = rpc_1.getRpcWorkerData();
@@ -1,8 +1,9 @@
1
- declare type Task<T> = (done: () => void) => Promise<T>;
1
+ declare type Task<T> = () => Promise<T>;
2
2
  interface Pool {
3
3
  submit<T>(task: Task<T>): Promise<T>;
4
4
  size: number;
5
5
  readonly pending: number;
6
+ readonly drained: Promise<void>;
6
7
  }
7
8
  declare function createPool(size: number): Pool;
8
9
  export { Pool, createPool };