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,376 +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.createTypeScriptReporter = void 0;
16
- const path_1 = __importDefault(require("path"));
17
- const Performance_1 = require("../../profile/Performance");
18
- const TypeScriptVueExtension_1 = require("../extension/vue/TypeScriptVueExtension");
19
- const TypeScriptIssueFactory_1 = require("../issue/TypeScriptIssueFactory");
20
- const TypeScriptPerformance_1 = require("../profile/TypeScriptPerformance");
21
- const ControlledCompilerHost_1 = require("./ControlledCompilerHost");
22
- const ControlledTypeScriptSystem_1 = require("./ControlledTypeScriptSystem");
23
- const ControlledWatchCompilerHost_1 = require("./ControlledWatchCompilerHost");
24
- const ControlledWatchSolutionBuilderHost_1 = require("./ControlledWatchSolutionBuilderHost");
25
- const TypeScriptConfigurationParser_1 = require("./TypeScriptConfigurationParser");
26
- function createTypeScriptReporter(configuration) {
27
- let parsedConfiguration;
28
- let parseConfigurationDiagnostics = [];
29
- let dependencies;
30
- let artifacts;
31
- let configurationChanged = false;
32
- let compilerHost;
33
- let watchCompilerHost;
34
- let watchSolutionBuilderHost;
35
- let program;
36
- let watchProgram;
37
- let solutionBuilder;
38
- let shouldUpdateRootFiles = false;
39
- // eslint-disable-next-line @typescript-eslint/no-var-requires
40
- const typescript = require(configuration.typescriptPath);
41
- const extensions = [];
42
- const system = ControlledTypeScriptSystem_1.createControlledTypeScriptSystem(typescript, configuration.mode);
43
- const diagnosticsPerProject = new Map();
44
- const performance = TypeScriptPerformance_1.connectTypeScriptPerformance(typescript, Performance_1.createPerformance());
45
- if (configuration.extensions.vue.enabled) {
46
- extensions.push(TypeScriptVueExtension_1.createTypeScriptVueExtension(configuration.extensions.vue));
47
- }
48
- function getConfigFilePathFromCompilerOptions(compilerOptions) {
49
- return compilerOptions.configFilePath;
50
- }
51
- function getProjectNameOfBuilderProgram(builderProgram) {
52
- return getConfigFilePathFromCompilerOptions(builderProgram.getProgram().getCompilerOptions());
53
- }
54
- function getTracing() {
55
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
56
- return typescript.tracing;
57
- }
58
- function getDiagnosticsOfProgram(program) {
59
- const diagnostics = [];
60
- if (configuration.diagnosticOptions.syntactic) {
61
- performance.markStart('Syntactic Diagnostics');
62
- diagnostics.push(...program.getSyntacticDiagnostics());
63
- performance.markEnd('Syntactic Diagnostics');
64
- }
65
- if (configuration.diagnosticOptions.global) {
66
- performance.markStart('Global Diagnostics');
67
- diagnostics.push(...program.getGlobalDiagnostics());
68
- performance.markEnd('Global Diagnostics');
69
- }
70
- if (configuration.diagnosticOptions.semantic) {
71
- performance.markStart('Semantic Diagnostics');
72
- diagnostics.push(...program.getSemanticDiagnostics());
73
- performance.markEnd('Semantic Diagnostics');
74
- }
75
- if (configuration.diagnosticOptions.declaration) {
76
- performance.markStart('Declaration Diagnostics');
77
- diagnostics.push(...program.getDeclarationDiagnostics());
78
- performance.markEnd('Declaration Diagnostics');
79
- }
80
- return diagnostics;
81
- }
82
- function emitTsBuildInfoFileForBuilderProgram(builderProgram) {
83
- if (configuration.mode !== 'readonly' &&
84
- parsedConfiguration &&
85
- TypeScriptConfigurationParser_1.isIncrementalCompilation(parsedConfiguration.options)) {
86
- const program = builderProgram.getProgram();
87
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
88
- if (typeof program.emitBuildInfo === 'function') {
89
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
90
- program.emitBuildInfo();
91
- }
92
- }
93
- }
94
- function getParseConfigFileHost() {
95
- const parseConfigDiagnostics = [];
96
- let parseConfigFileHost = Object.assign(Object.assign({}, system), { onUnRecoverableConfigFileDiagnostic: (diagnostic) => {
97
- parseConfigDiagnostics.push(diagnostic);
98
- } });
99
- for (const extension of extensions) {
100
- if (extension.extendParseConfigFileHost) {
101
- parseConfigFileHost = extension.extendParseConfigFileHost(parseConfigFileHost);
102
- }
103
- }
104
- return [parseConfigFileHost, parseConfigDiagnostics];
105
- }
106
- function parseConfiguration() {
107
- const [parseConfigFileHost, parseConfigDiagnostics] = getParseConfigFileHost();
108
- const parsedConfiguration = TypeScriptConfigurationParser_1.parseTypeScriptConfiguration(typescript, configuration.configFile, configuration.context, configuration.configOverwrite, parseConfigFileHost);
109
- if (parsedConfiguration.errors) {
110
- parseConfigDiagnostics.push(...parsedConfiguration.errors);
111
- }
112
- return [parsedConfiguration, parseConfigDiagnostics];
113
- }
114
- function parseConfigurationIfNeeded() {
115
- if (!parsedConfiguration) {
116
- [parsedConfiguration, parseConfigurationDiagnostics] = parseConfiguration();
117
- }
118
- return parsedConfiguration;
119
- }
120
- function getDependencies() {
121
- parsedConfiguration = parseConfigurationIfNeeded();
122
- const [parseConfigFileHost] = getParseConfigFileHost();
123
- let dependencies = TypeScriptConfigurationParser_1.getDependenciesFromTypeScriptConfiguration(typescript, parsedConfiguration, configuration.context, parseConfigFileHost);
124
- for (const extension of extensions) {
125
- if (extension.extendDependencies) {
126
- dependencies = extension.extendDependencies(dependencies);
127
- }
128
- }
129
- return dependencies;
130
- }
131
- function getArtifacts() {
132
- parsedConfiguration = parseConfigurationIfNeeded();
133
- const [parseConfigFileHost] = getParseConfigFileHost();
134
- return TypeScriptConfigurationParser_1.getArtifactsFromTypeScriptConfiguration(typescript, parsedConfiguration, configuration.context, parseConfigFileHost);
135
- }
136
- function getArtifactsIfNeeded() {
137
- if (!artifacts) {
138
- artifacts = getArtifacts();
139
- }
140
- return artifacts;
141
- }
142
- function startProfilingIfNeeded() {
143
- if (configuration.profile) {
144
- performance.enable();
145
- }
146
- }
147
- function stopProfilingIfNeeded() {
148
- if (configuration.profile) {
149
- performance.print();
150
- performance.disable();
151
- }
152
- }
153
- function startTracingIfNeeded(compilerOptions) {
154
- const tracing = getTracing();
155
- if (compilerOptions.generateTrace && tracing) {
156
- tracing.startTracing(getConfigFilePathFromCompilerOptions(compilerOptions), compilerOptions.generateTrace, configuration.build);
157
- }
158
- }
159
- function stopTracingIfNeeded(program) {
160
- const tracing = getTracing();
161
- const compilerOptions = program.getCompilerOptions();
162
- if (compilerOptions.generateTrace && tracing) {
163
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
164
- tracing.stopTracing(program.getProgram().getTypeCatalog());
165
- }
166
- }
167
- function dumpTracingLegendIfNeeded() {
168
- const tracing = getTracing();
169
- if (tracing) {
170
- tracing.dumpLegend();
171
- }
172
- }
173
- return {
174
- getReport: ({ changedFiles = [], deletedFiles = [] }, watching) => __awaiter(this, void 0, void 0, function* () {
175
- // clear cache to be ready for next iteration and to free memory
176
- system.clearCache();
177
- if ([...changedFiles, ...deletedFiles]
178
- .map((affectedFile) => path_1.default.normalize(affectedFile))
179
- .includes(path_1.default.normalize(configuration.configFile))) {
180
- // we need to re-create programs
181
- parsedConfiguration = undefined;
182
- dependencies = undefined;
183
- artifacts = undefined;
184
- compilerHost = undefined;
185
- watchCompilerHost = undefined;
186
- watchSolutionBuilderHost = undefined;
187
- program = undefined;
188
- watchProgram = undefined;
189
- solutionBuilder = undefined;
190
- diagnosticsPerProject.clear();
191
- configurationChanged = true;
192
- }
193
- else {
194
- const previousParsedConfiguration = parsedConfiguration;
195
- [parsedConfiguration, parseConfigurationDiagnostics] = parseConfiguration();
196
- if (previousParsedConfiguration &&
197
- JSON.stringify(previousParsedConfiguration.fileNames) !==
198
- JSON.stringify(parsedConfiguration.fileNames)) {
199
- // root files changed - we need to recompute dependencies and artifacts
200
- dependencies = getDependencies();
201
- artifacts = getArtifacts();
202
- shouldUpdateRootFiles = true;
203
- }
204
- }
205
- parsedConfiguration = parseConfigurationIfNeeded();
206
- system.setArtifacts(getArtifactsIfNeeded());
207
- if (configurationChanged) {
208
- configurationChanged = false;
209
- // try to remove outdated .tsbuildinfo file for incremental mode
210
- if (typeof typescript.getTsBuildInfoEmitOutputFilePath === 'function' &&
211
- configuration.mode !== 'readonly' &&
212
- parsedConfiguration.options.incremental) {
213
- const tsBuildInfoPath = typescript.getTsBuildInfoEmitOutputFilePath(parsedConfiguration.options);
214
- if (tsBuildInfoPath) {
215
- try {
216
- system.deleteFile(tsBuildInfoPath);
217
- }
218
- catch (error) {
219
- // silent
220
- }
221
- }
222
- }
223
- }
224
- return {
225
- getDependencies() {
226
- return __awaiter(this, void 0, void 0, function* () {
227
- if (!dependencies) {
228
- dependencies = getDependencies();
229
- }
230
- return dependencies;
231
- });
232
- },
233
- getIssues() {
234
- return __awaiter(this, void 0, void 0, function* () {
235
- startProfilingIfNeeded();
236
- parsedConfiguration = parseConfigurationIfNeeded();
237
- // report configuration diagnostics and exit
238
- if (parseConfigurationDiagnostics.length) {
239
- let issues = TypeScriptIssueFactory_1.createIssuesFromTsDiagnostics(typescript, parseConfigurationDiagnostics);
240
- issues.forEach((issue) => {
241
- if (!issue.file) {
242
- issue.file = configuration.configFile;
243
- }
244
- });
245
- extensions.forEach((extension) => {
246
- if (extension.extendIssues) {
247
- issues = extension.extendIssues(issues);
248
- }
249
- });
250
- return issues;
251
- }
252
- if (configuration.build) {
253
- // solution builder case
254
- // ensure watch solution builder host exists
255
- if (!watchSolutionBuilderHost) {
256
- performance.markStart('Create Solution Builder Host');
257
- watchSolutionBuilderHost = ControlledWatchSolutionBuilderHost_1.createControlledWatchSolutionBuilderHost(typescript, parsedConfiguration, system, (rootNames, compilerOptions, host, oldProgram, configFileParsingDiagnostics, projectReferences) => {
258
- if (compilerOptions) {
259
- startTracingIfNeeded(compilerOptions);
260
- }
261
- return typescript.createSemanticDiagnosticsBuilderProgram(rootNames, compilerOptions, host, oldProgram, configFileParsingDiagnostics, projectReferences);
262
- }, undefined, undefined, undefined, undefined, (builderProgram) => {
263
- const projectName = getProjectNameOfBuilderProgram(builderProgram);
264
- const diagnostics = getDiagnosticsOfProgram(builderProgram);
265
- // update diagnostics
266
- diagnosticsPerProject.set(projectName, diagnostics);
267
- // emit .tsbuildinfo file if needed
268
- emitTsBuildInfoFileForBuilderProgram(builderProgram);
269
- stopTracingIfNeeded(builderProgram);
270
- }, extensions);
271
- performance.markEnd('Create Solution Builder Host');
272
- solutionBuilder = undefined;
273
- }
274
- // ensure solution builder exists and is up-to-date
275
- if (!solutionBuilder || shouldUpdateRootFiles) {
276
- // not sure if it's the best option - maybe there is a smarter way to do this
277
- shouldUpdateRootFiles = false;
278
- performance.markStart('Create Solution Builder');
279
- solutionBuilder = typescript.createSolutionBuilderWithWatch(watchSolutionBuilderHost, [configuration.configFile], {});
280
- performance.markEnd('Create Solution Builder');
281
- performance.markStart('Build Solutions');
282
- solutionBuilder.build();
283
- performance.markEnd('Build Solutions');
284
- }
285
- }
286
- else if (watching) {
287
- // watch compiler case
288
- // ensure watch compiler host exists
289
- if (!watchCompilerHost) {
290
- performance.markStart('Create Watch Compiler Host');
291
- watchCompilerHost = ControlledWatchCompilerHost_1.createControlledWatchCompilerHost(typescript, parsedConfiguration, system, (rootNames, compilerOptions, host, oldProgram, configFileParsingDiagnostics, projectReferences) => {
292
- if (compilerOptions) {
293
- startTracingIfNeeded(compilerOptions);
294
- }
295
- return typescript.createSemanticDiagnosticsBuilderProgram(rootNames, compilerOptions, host, oldProgram, configFileParsingDiagnostics, projectReferences);
296
- }, undefined, undefined, (builderProgram) => {
297
- const projectName = getProjectNameOfBuilderProgram(builderProgram);
298
- const diagnostics = getDiagnosticsOfProgram(builderProgram);
299
- // update diagnostics
300
- diagnosticsPerProject.set(projectName, diagnostics);
301
- // emit .tsbuildinfo file if needed
302
- emitTsBuildInfoFileForBuilderProgram(builderProgram);
303
- stopTracingIfNeeded(builderProgram);
304
- }, extensions);
305
- performance.markEnd('Create Watch Compiler Host');
306
- watchProgram = undefined;
307
- }
308
- // ensure watch program exists
309
- if (!watchProgram) {
310
- performance.markStart('Create Watch Program');
311
- watchProgram = typescript.createWatchProgram(watchCompilerHost);
312
- performance.markEnd('Create Watch Program');
313
- }
314
- if (shouldUpdateRootFiles && (dependencies === null || dependencies === void 0 ? void 0 : dependencies.files)) {
315
- // we have to update root files manually as don't use config file as a program input
316
- watchProgram.updateRootFileNames(dependencies.files);
317
- shouldUpdateRootFiles = false;
318
- }
319
- }
320
- else {
321
- if (!compilerHost) {
322
- compilerHost = ControlledCompilerHost_1.createControlledCompilerHost(typescript, parsedConfiguration, system, extensions);
323
- }
324
- if (!program) {
325
- program = typescript.createProgram({
326
- rootNames: parsedConfiguration.fileNames,
327
- options: parsedConfiguration.options,
328
- projectReferences: parsedConfiguration.projectReferences,
329
- host: compilerHost,
330
- });
331
- }
332
- const diagnostics = getDiagnosticsOfProgram(program);
333
- const projectName = getConfigFilePathFromCompilerOptions(program.getCompilerOptions());
334
- // update diagnostics
335
- diagnosticsPerProject.set(projectName, diagnostics);
336
- }
337
- changedFiles.forEach((changedFile) => {
338
- if (system) {
339
- system.invokeFileChanged(changedFile);
340
- }
341
- });
342
- deletedFiles.forEach((removedFile) => {
343
- if (system) {
344
- system.invokeFileDeleted(removedFile);
345
- }
346
- });
347
- // wait for all queued events to be processed
348
- performance.markStart('Queued Tasks');
349
- yield system.waitForQueued();
350
- performance.markEnd('Queued Tasks');
351
- // aggregate all diagnostics and map them to issues
352
- const diagnostics = [];
353
- diagnosticsPerProject.forEach((projectDiagnostics) => {
354
- diagnostics.push(...projectDiagnostics);
355
- });
356
- let issues = TypeScriptIssueFactory_1.createIssuesFromTsDiagnostics(typescript, diagnostics);
357
- extensions.forEach((extension) => {
358
- if (extension.extendIssues) {
359
- issues = extension.extendIssues(issues);
360
- }
361
- });
362
- dumpTracingLegendIfNeeded();
363
- stopProfilingIfNeeded();
364
- return issues;
365
- });
366
- },
367
- close() {
368
- return __awaiter(this, void 0, void 0, function* () {
369
- // do nothing
370
- });
371
- },
372
- };
373
- }),
374
- };
375
- }
376
- exports.createTypeScriptReporter = createTypeScriptReporter;
@@ -1,4 +0,0 @@
1
- import type { ReporterRpcClient } from '../../reporter';
2
- import type { TypeScriptReporterConfiguration } from '../TypeScriptReporterConfiguration';
3
- declare function createTypeScriptReporterRpcClient(configuration: TypeScriptReporterConfiguration): ReporterRpcClient;
4
- export { createTypeScriptReporterRpcClient };
@@ -1,14 +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.createTypeScriptReporterRpcClient = void 0;
7
- const path_1 = __importDefault(require("path"));
8
- const reporter_1 = require("../../reporter");
9
- const rpc_ipc_1 = require("../../rpc/rpc-ipc");
10
- function createTypeScriptReporterRpcClient(configuration) {
11
- const channel = rpc_ipc_1.createRpcIpcMessageChannel(path_1.default.resolve(__dirname, './TypeScriptReporterRpcService.js'), configuration.memoryLimit);
12
- return reporter_1.createReporterRpcClient(channel, configuration);
13
- }
14
- exports.createTypeScriptReporterRpcClient = createTypeScriptReporterRpcClient;
@@ -1,11 +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
- const process_1 = __importDefault(require("process"));
7
- const reporter_1 = require("../../reporter");
8
- const rpc_ipc_1 = require("../../rpc/rpc-ipc");
9
- const TypeScriptReporter_1 = require("./TypeScriptReporter");
10
- const service = reporter_1.registerReporterRpcService(rpc_ipc_1.createRpcIpcMessagePort(process_1.default), TypeScriptReporter_1.createTypeScriptReporter);
11
- service.open();