@depup/fork-ts-checker-webpack-plugin 9.1.0-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +42 -0
  3. package/changes.json +54 -0
  4. package/lib/files-change.d.ts +17 -0
  5. package/lib/files-change.js +57 -0
  6. package/lib/files-match.d.ts +7 -0
  7. package/lib/files-match.js +2 -0
  8. package/lib/formatter/basic-formatter.d.ts +3 -0
  9. package/lib/formatter/basic-formatter.js +13 -0
  10. package/lib/formatter/code-frame-formatter.d.ts +4 -0
  11. package/lib/formatter/code-frame-formatter.js +29 -0
  12. package/lib/formatter/formatter-config.d.ts +8 -0
  13. package/lib/formatter/formatter-config.js +36 -0
  14. package/lib/formatter/formatter-options.d.ts +14 -0
  15. package/lib/formatter/formatter-options.js +2 -0
  16. package/lib/formatter/formatter.d.ts +4 -0
  17. package/lib/formatter/formatter.js +2 -0
  18. package/lib/formatter/index.d.ts +6 -0
  19. package/lib/formatter/index.js +22 -0
  20. package/lib/formatter/stats-formatter.d.ts +3 -0
  21. package/lib/formatter/stats-formatter.js +28 -0
  22. package/lib/formatter/types/babel__code-frame.d.ts +21 -0
  23. package/lib/formatter/types/babel__code-frame.js +7 -0
  24. package/lib/formatter/webpack-formatter.d.ts +3 -0
  25. package/lib/formatter/webpack-formatter.js +32 -0
  26. package/lib/hooks/intercept-done-to-get-dev-server-tap.d.ts +5 -0
  27. package/lib/hooks/intercept-done-to-get-dev-server-tap.js +18 -0
  28. package/lib/hooks/tap-after-compile-to-add-dependencies.d.ts +5 -0
  29. package/lib/hooks/tap-after-compile-to-add-dependencies.js +31 -0
  30. package/lib/hooks/tap-after-compile-to-get-issues.d.ts +5 -0
  31. package/lib/hooks/tap-after-compile-to-get-issues.js +52 -0
  32. package/lib/hooks/tap-after-environment-to-patch-watching.d.ts +4 -0
  33. package/lib/hooks/tap-after-environment-to-patch-watching.js +22 -0
  34. package/lib/hooks/tap-done-to-async-get-issues.d.ts +5 -0
  35. package/lib/hooks/tap-done-to-async-get-issues.js +86 -0
  36. package/lib/hooks/tap-error-to-log-message.d.ts +4 -0
  37. package/lib/hooks/tap-error-to-log-message.js +32 -0
  38. package/lib/hooks/tap-start-to-run-workers.d.ts +8 -0
  39. package/lib/hooks/tap-start-to-run-workers.js +132 -0
  40. package/lib/hooks/tap-stop-to-terminate-workers.d.ts +5 -0
  41. package/lib/hooks/tap-stop-to-terminate-workers.js +26 -0
  42. package/lib/index.d.ts +2 -0
  43. package/lib/index.js +3 -0
  44. package/lib/infrastructure-logger.d.ts +9 -0
  45. package/lib/infrastructure-logger.js +14 -0
  46. package/lib/issue/index.d.ts +3 -0
  47. package/lib/issue/index.js +19 -0
  48. package/lib/issue/issue-config.d.ts +8 -0
  49. package/lib/issue/issue-config.js +29 -0
  50. package/lib/issue/issue-location.d.ts +8 -0
  51. package/lib/issue/issue-location.js +22 -0
  52. package/lib/issue/issue-match.d.ts +5 -0
  53. package/lib/issue/issue-match.js +20 -0
  54. package/lib/issue/issue-options.d.ts +8 -0
  55. package/lib/issue/issue-options.js +2 -0
  56. package/lib/issue/issue-position.d.ts +6 -0
  57. package/lib/issue/issue-position.js +16 -0
  58. package/lib/issue/issue-predicate.d.ts +5 -0
  59. package/lib/issue/issue-predicate.js +11 -0
  60. package/lib/issue/issue-severity.d.ts +4 -0
  61. package/lib/issue/issue-severity.js +12 -0
  62. package/lib/issue/issue-webpack-error.d.ts +9 -0
  63. package/lib/issue/issue-webpack-error.js +55 -0
  64. package/lib/issue/issue.d.ts +12 -0
  65. package/lib/issue/issue.js +41 -0
  66. package/lib/logger.d.ts +5 -0
  67. package/lib/logger.js +2 -0
  68. package/lib/plugin-config.d.ts +16 -0
  69. package/lib/plugin-config.js +26 -0
  70. package/lib/plugin-hooks.d.ts +20 -0
  71. package/lib/plugin-hooks.js +45 -0
  72. package/lib/plugin-options.d.ts +13 -0
  73. package/lib/plugin-options.js +2 -0
  74. package/lib/plugin-options.json +197 -0
  75. package/lib/plugin-pools.d.ts +4 -0
  76. package/lib/plugin-pools.js +32 -0
  77. package/lib/plugin-state.d.ts +18 -0
  78. package/lib/plugin-state.js +17 -0
  79. package/lib/plugin.d.ts +28 -0
  80. package/lib/plugin.js +86 -0
  81. package/lib/rpc/expose-rpc.d.ts +1 -0
  82. package/lib/rpc/expose-rpc.js +78 -0
  83. package/lib/rpc/index.d.ts +5 -0
  84. package/lib/rpc/index.js +12 -0
  85. package/lib/rpc/rpc-error.d.ts +6 -0
  86. package/lib/rpc/rpc-error.js +12 -0
  87. package/lib/rpc/rpc-worker.d.ts +13 -0
  88. package/lib/rpc/rpc-worker.js +83 -0
  89. package/lib/rpc/types.d.ts +19 -0
  90. package/lib/rpc/types.js +2 -0
  91. package/lib/rpc/wrap-rpc.d.ts +4 -0
  92. package/lib/rpc/wrap-rpc.js +79 -0
  93. package/lib/typescript/type-script-config-overwrite.d.ts +12 -0
  94. package/lib/typescript/type-script-config-overwrite.js +2 -0
  95. package/lib/typescript/type-script-diagnostics-options.d.ts +7 -0
  96. package/lib/typescript/type-script-diagnostics-options.js +2 -0
  97. package/lib/typescript/type-script-support.d.ts +3 -0
  98. package/lib/typescript/type-script-support.js +67 -0
  99. package/lib/typescript/type-script-worker-config.d.ts +17 -0
  100. package/lib/typescript/type-script-worker-config.js +18 -0
  101. package/lib/typescript/type-script-worker-options.d.ts +14 -0
  102. package/lib/typescript/type-script-worker-options.js +2 -0
  103. package/lib/typescript/worker/get-dependencies-worker.d.ts +5 -0
  104. package/lib/typescript/worker/get-dependencies-worker.js +15 -0
  105. package/lib/typescript/worker/get-issues-worker.d.ts +5 -0
  106. package/lib/typescript/worker/get-issues-worker.js +80 -0
  107. package/lib/typescript/worker/lib/artifacts.d.ts +4 -0
  108. package/lib/typescript/worker/lib/artifacts.js +94 -0
  109. package/lib/typescript/worker/lib/config.d.ts +15 -0
  110. package/lib/typescript/worker/lib/config.js +135 -0
  111. package/lib/typescript/worker/lib/dependencies.d.ts +3 -0
  112. package/lib/typescript/worker/lib/dependencies.js +85 -0
  113. package/lib/typescript/worker/lib/diagnostics.d.ts +7 -0
  114. package/lib/typescript/worker/lib/diagnostics.js +112 -0
  115. package/lib/typescript/worker/lib/emit.d.ts +2 -0
  116. package/lib/typescript/worker/lib/emit.js +13 -0
  117. package/lib/typescript/worker/lib/file-system/file-system.d.ts +18 -0
  118. package/lib/typescript/worker/lib/file-system/file-system.js +2 -0
  119. package/lib/typescript/worker/lib/file-system/mem-file-system.d.ts +5 -0
  120. package/lib/typescript/worker/lib/file-system/mem-file-system.js +78 -0
  121. package/lib/typescript/worker/lib/file-system/passive-file-system.d.ts +5 -0
  122. package/lib/typescript/worker/lib/file-system/passive-file-system.js +65 -0
  123. package/lib/typescript/worker/lib/file-system/real-file-system.d.ts +5 -0
  124. package/lib/typescript/worker/lib/file-system/real-file-system.js +191 -0
  125. package/lib/typescript/worker/lib/host/compiler-host.d.ts +2 -0
  126. package/lib/typescript/worker/lib/host/compiler-host.js +10 -0
  127. package/lib/typescript/worker/lib/host/watch-compiler-host.d.ts +2 -0
  128. package/lib/typescript/worker/lib/host/watch-compiler-host.js +20 -0
  129. package/lib/typescript/worker/lib/host/watch-solution-builder-host.d.ts +2 -0
  130. package/lib/typescript/worker/lib/host/watch-solution-builder-host.js +47 -0
  131. package/lib/typescript/worker/lib/performance.d.ts +3 -0
  132. package/lib/typescript/worker/lib/performance.js +32 -0
  133. package/lib/typescript/worker/lib/program/program.d.ts +2 -0
  134. package/lib/typescript/worker/lib/program/program.js +37 -0
  135. package/lib/typescript/worker/lib/program/solution-builder.d.ts +2 -0
  136. package/lib/typescript/worker/lib/program/solution-builder.js +39 -0
  137. package/lib/typescript/worker/lib/program/watch-program.d.ts +3 -0
  138. package/lib/typescript/worker/lib/program/watch-program.js +51 -0
  139. package/lib/typescript/worker/lib/system.d.ts +19 -0
  140. package/lib/typescript/worker/lib/system.js +232 -0
  141. package/lib/typescript/worker/lib/tracing.d.ts +4 -0
  142. package/lib/typescript/worker/lib/tracing.js +29 -0
  143. package/lib/typescript/worker/lib/tsbuildinfo.d.ts +4 -0
  144. package/lib/typescript/worker/lib/tsbuildinfo.js +96 -0
  145. package/lib/typescript/worker/lib/typescript.d.ts +2 -0
  146. package/lib/typescript/worker/lib/typescript.js +6 -0
  147. package/lib/typescript/worker/lib/worker-config.d.ts +2 -0
  148. package/lib/typescript/worker/lib/worker-config.js +5 -0
  149. package/lib/utils/async/abort-error.d.ts +6 -0
  150. package/lib/utils/async/abort-error.js +15 -0
  151. package/lib/utils/async/controlled-promise.d.ts +6 -0
  152. package/lib/utils/async/controlled-promise.js +17 -0
  153. package/lib/utils/async/is-pending.d.ts +2 -0
  154. package/lib/utils/async/is-pending.js +10 -0
  155. package/lib/utils/async/pool.d.ts +10 -0
  156. package/lib/utils/async/pool.js +47 -0
  157. package/lib/utils/async/wait.d.ts +2 -0
  158. package/lib/utils/async/wait.js +7 -0
  159. package/lib/utils/path/forward-slash.d.ts +6 -0
  160. package/lib/utils/path/forward-slash.js +15 -0
  161. package/lib/utils/path/is-inside-another-path.d.ts +2 -0
  162. package/lib/utils/path/is-inside-another-path.js +22 -0
  163. package/lib/utils/path/relative-to-context.d.ts +2 -0
  164. package/lib/utils/path/relative-to-context.js +16 -0
  165. package/lib/watch/inclusive-node-watch-file-system.d.ts +15 -0
  166. package/lib/watch/inclusive-node-watch-file-system.js +166 -0
  167. package/lib/watch/watch-file-system.d.ts +16 -0
  168. package/lib/watch/watch-file-system.js +2 -0
  169. package/package.json +182 -0
@@ -0,0 +1,191 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.realFileSystem = void 0;
27
+ const path_1 = require("path");
28
+ const fs = __importStar(require("fs-extra"));
29
+ const existsCache = new Map();
30
+ const readStatsCache = new Map();
31
+ const readFileCache = new Map();
32
+ const readDirCache = new Map();
33
+ const realPathCache = new Map();
34
+ /**
35
+ * It's an implementation of the FileSystem interface which reads and writes directly to the real file system.
36
+ */
37
+ exports.realFileSystem = {
38
+ exists(path) {
39
+ return exists(getRealPath(path));
40
+ },
41
+ readFile(path, encoding) {
42
+ return readFile(getRealPath(path), encoding);
43
+ },
44
+ readDir(path) {
45
+ return readDir(getRealPath(path));
46
+ },
47
+ readStats(path) {
48
+ return readStats(getRealPath(path));
49
+ },
50
+ realPath(path) {
51
+ return getRealPath(path);
52
+ },
53
+ normalizePath(path) {
54
+ return (0, path_1.normalize)(path);
55
+ },
56
+ writeFile(path, data) {
57
+ writeFile(getRealPath(path), data);
58
+ },
59
+ deleteFile(path) {
60
+ deleteFile(getRealPath(path));
61
+ },
62
+ createDir(path) {
63
+ createDir(getRealPath(path));
64
+ },
65
+ updateTimes(path, atime, mtime) {
66
+ updateTimes(getRealPath(path), atime, mtime);
67
+ },
68
+ clearCache() {
69
+ existsCache.clear();
70
+ readStatsCache.clear();
71
+ readFileCache.clear();
72
+ readDirCache.clear();
73
+ realPathCache.clear();
74
+ },
75
+ };
76
+ // read methods
77
+ function exists(path) {
78
+ const normalizedPath = (0, path_1.normalize)(path);
79
+ if (!existsCache.has(normalizedPath)) {
80
+ existsCache.set(normalizedPath, fs.existsSync(normalizedPath));
81
+ }
82
+ return !!existsCache.get(normalizedPath);
83
+ }
84
+ function readStats(path) {
85
+ const normalizedPath = (0, path_1.normalize)(path);
86
+ if (!readStatsCache.has(normalizedPath)) {
87
+ if (exists(normalizedPath)) {
88
+ readStatsCache.set(normalizedPath, fs.statSync(normalizedPath));
89
+ }
90
+ }
91
+ return readStatsCache.get(normalizedPath);
92
+ }
93
+ function readFile(path, encoding) {
94
+ const normalizedPath = (0, path_1.normalize)(path);
95
+ if (!readFileCache.has(normalizedPath)) {
96
+ const stats = readStats(normalizedPath);
97
+ if (stats && stats.isFile()) {
98
+ readFileCache.set(normalizedPath, fs.readFileSync(normalizedPath, { encoding: encoding }).toString());
99
+ }
100
+ else {
101
+ readFileCache.set(normalizedPath, undefined);
102
+ }
103
+ }
104
+ return readFileCache.get(normalizedPath);
105
+ }
106
+ function readDir(path) {
107
+ const normalizedPath = (0, path_1.normalize)(path);
108
+ if (!readDirCache.has(normalizedPath)) {
109
+ const stats = readStats(normalizedPath);
110
+ if (stats && stats.isDirectory()) {
111
+ readDirCache.set(normalizedPath, fs.readdirSync(normalizedPath, { withFileTypes: true }));
112
+ }
113
+ else {
114
+ readDirCache.set(normalizedPath, []);
115
+ }
116
+ }
117
+ return readDirCache.get(normalizedPath) || [];
118
+ }
119
+ function getRealPath(path) {
120
+ const normalizedPath = (0, path_1.normalize)(path);
121
+ if (!realPathCache.has(normalizedPath)) {
122
+ let base = normalizedPath;
123
+ let nested = '';
124
+ while (base !== (0, path_1.dirname)(base)) {
125
+ if (exists(base)) {
126
+ realPathCache.set(normalizedPath, (0, path_1.normalize)((0, path_1.join)(fs.realpathSync(base), nested)));
127
+ break;
128
+ }
129
+ nested = (0, path_1.join)((0, path_1.basename)(base), nested);
130
+ base = (0, path_1.dirname)(base);
131
+ }
132
+ }
133
+ return realPathCache.get(normalizedPath) || normalizedPath;
134
+ }
135
+ function createDir(path) {
136
+ const normalizedPath = (0, path_1.normalize)(path);
137
+ fs.mkdirSync(normalizedPath, { recursive: true });
138
+ // update cache
139
+ existsCache.set(normalizedPath, true);
140
+ if (readDirCache.has((0, path_1.dirname)(normalizedPath))) {
141
+ readDirCache.delete((0, path_1.dirname)(normalizedPath));
142
+ }
143
+ if (readStatsCache.has(normalizedPath)) {
144
+ readStatsCache.delete(normalizedPath);
145
+ }
146
+ }
147
+ function writeFile(path, data) {
148
+ const normalizedPath = (0, path_1.normalize)(path);
149
+ if (!exists((0, path_1.dirname)(normalizedPath))) {
150
+ createDir((0, path_1.dirname)(normalizedPath));
151
+ }
152
+ fs.writeFileSync(normalizedPath, data);
153
+ // update cache
154
+ existsCache.set(normalizedPath, true);
155
+ if (readDirCache.has((0, path_1.dirname)(normalizedPath))) {
156
+ readDirCache.delete((0, path_1.dirname)(normalizedPath));
157
+ }
158
+ if (readStatsCache.has(normalizedPath)) {
159
+ readStatsCache.delete(normalizedPath);
160
+ }
161
+ if (readFileCache.has(normalizedPath)) {
162
+ readFileCache.delete(normalizedPath);
163
+ }
164
+ }
165
+ function deleteFile(path) {
166
+ if (exists(path)) {
167
+ const normalizedPath = (0, path_1.normalize)(path);
168
+ fs.unlinkSync(normalizedPath);
169
+ // update cache
170
+ existsCache.set(normalizedPath, false);
171
+ if (readDirCache.has((0, path_1.dirname)(normalizedPath))) {
172
+ readDirCache.delete((0, path_1.dirname)(normalizedPath));
173
+ }
174
+ if (readStatsCache.has(normalizedPath)) {
175
+ readStatsCache.delete(normalizedPath);
176
+ }
177
+ if (readFileCache.has(normalizedPath)) {
178
+ readFileCache.delete(normalizedPath);
179
+ }
180
+ }
181
+ }
182
+ function updateTimes(path, atime, mtime) {
183
+ if (exists(path)) {
184
+ const normalizedPath = (0, path_1.normalize)(path);
185
+ fs.utimesSync((0, path_1.normalize)(path), atime, mtime);
186
+ // update cache
187
+ if (readStatsCache.has(normalizedPath)) {
188
+ readStatsCache.delete(normalizedPath);
189
+ }
190
+ }
191
+ }
@@ -0,0 +1,2 @@
1
+ import type * as ts from 'typescript';
2
+ export declare function createCompilerHost(parsedConfig: ts.ParsedCommandLine): ts.CompilerHost;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createCompilerHost = void 0;
4
+ const system_1 = require("../system");
5
+ const typescript_1 = require("../typescript");
6
+ function createCompilerHost(parsedConfig) {
7
+ const baseCompilerHost = typescript_1.typescript.createCompilerHost(parsedConfig.options);
8
+ return Object.assign(Object.assign({}, baseCompilerHost), { fileExists: system_1.system.fileExists, readFile: system_1.system.readFile, directoryExists: system_1.system.directoryExists, getDirectories: system_1.system.getDirectories, realpath: system_1.system.realpath });
9
+ }
10
+ exports.createCompilerHost = createCompilerHost;
@@ -0,0 +1,2 @@
1
+ import type * as ts from 'typescript';
2
+ export declare function createWatchCompilerHost<TProgram extends ts.BuilderProgram>(parsedConfig: ts.ParsedCommandLine, createProgram?: ts.CreateProgram<TProgram>, reportDiagnostic?: ts.DiagnosticReporter, reportWatchStatus?: ts.WatchStatusReporter, afterProgramCreate?: (program: TProgram) => void): ts.WatchCompilerHostOfFilesAndCompilerOptions<TProgram>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createWatchCompilerHost = void 0;
4
+ const system_1 = require("../system");
5
+ const typescript_1 = require("../typescript");
6
+ function createWatchCompilerHost(parsedConfig, createProgram, reportDiagnostic, reportWatchStatus, afterProgramCreate) {
7
+ const baseWatchCompilerHost = typescript_1.typescript.createWatchCompilerHost(parsedConfig.fileNames, parsedConfig.options, system_1.system, createProgram, reportDiagnostic, reportWatchStatus, parsedConfig.projectReferences);
8
+ return Object.assign(Object.assign({}, baseWatchCompilerHost), { createProgram(rootNames, options, compilerHost, oldProgram, configFileParsingDiagnostics, projectReferences) {
9
+ return baseWatchCompilerHost.createProgram(rootNames, options, compilerHost, oldProgram, configFileParsingDiagnostics, projectReferences);
10
+ },
11
+ afterProgramCreate(program) {
12
+ if (afterProgramCreate) {
13
+ afterProgramCreate(program);
14
+ }
15
+ },
16
+ onWatchStatusChange() {
17
+ // do nothing
18
+ }, watchFile: system_1.system.watchFile, watchDirectory: system_1.system.watchDirectory, setTimeout: system_1.system.setTimeout, clearTimeout: system_1.system.clearTimeout, fileExists: system_1.system.fileExists, readFile: system_1.system.readFile, directoryExists: system_1.system.directoryExists, getDirectories: system_1.system.getDirectories, realpath: system_1.system.realpath });
19
+ }
20
+ exports.createWatchCompilerHost = createWatchCompilerHost;
@@ -0,0 +1,2 @@
1
+ import type * as ts from 'typescript';
2
+ export declare function createWatchSolutionBuilderHost<TProgram extends ts.BuilderProgram>(parsedConfig: ts.ParsedCommandLine, createProgram?: ts.CreateProgram<TProgram>, reportDiagnostic?: ts.DiagnosticReporter, reportWatchStatus?: ts.WatchStatusReporter, reportSolutionBuilderStatus?: (diagnostic: ts.Diagnostic) => void, afterProgramCreate?: (program: TProgram) => void, afterProgramEmitAndDiagnostics?: (program: TProgram) => void): ts.SolutionBuilderWithWatchHost<TProgram>;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createWatchSolutionBuilderHost = void 0;
4
+ const system_1 = require("../system");
5
+ const typescript_1 = require("../typescript");
6
+ const watch_compiler_host_1 = require("./watch-compiler-host");
7
+ function createWatchSolutionBuilderHost(parsedConfig, createProgram, reportDiagnostic, reportWatchStatus, reportSolutionBuilderStatus, afterProgramCreate, afterProgramEmitAndDiagnostics) {
8
+ const controlledWatchCompilerHost = (0, watch_compiler_host_1.createWatchCompilerHost)(parsedConfig, createProgram, reportDiagnostic, reportWatchStatus, afterProgramCreate);
9
+ return Object.assign(Object.assign({}, controlledWatchCompilerHost), { reportDiagnostic(diagnostic) {
10
+ if (reportDiagnostic) {
11
+ reportDiagnostic(diagnostic);
12
+ }
13
+ },
14
+ reportSolutionBuilderStatus(diagnostic) {
15
+ if (reportSolutionBuilderStatus) {
16
+ reportSolutionBuilderStatus(diagnostic);
17
+ }
18
+ },
19
+ afterProgramEmitAndDiagnostics(program) {
20
+ if (afterProgramEmitAndDiagnostics) {
21
+ afterProgramEmitAndDiagnostics(program);
22
+ }
23
+ },
24
+ createDirectory(path) {
25
+ system_1.system.createDirectory(path);
26
+ },
27
+ writeFile(path, data) {
28
+ system_1.system.writeFile(path, data);
29
+ },
30
+ getModifiedTime(fileName) {
31
+ return system_1.system.getModifiedTime(fileName);
32
+ },
33
+ setModifiedTime(fileName, date) {
34
+ system_1.system.setModifiedTime(fileName, date);
35
+ },
36
+ deleteFile(fileName) {
37
+ system_1.system.deleteFile(fileName);
38
+ },
39
+ getParsedCommandLine(fileName) {
40
+ return typescript_1.typescript.getParsedCommandLineOfConfigFile(fileName, { skipLibCheck: true }, Object.assign(Object.assign({}, system_1.system), { onUnRecoverableConfigFileDiagnostic: (diagnostic) => {
41
+ if (reportDiagnostic) {
42
+ reportDiagnostic(diagnostic);
43
+ }
44
+ } }));
45
+ } });
46
+ }
47
+ 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,37 @@
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 emit_1 = require("../emit");
7
+ const compiler_host_1 = require("../host/compiler-host");
8
+ const tracing_1 = require("../tracing");
9
+ const typescript_1 = require("../typescript");
10
+ let compilerHost;
11
+ let program;
12
+ function useProgram() {
13
+ const parsedConfig = (0, config_1.getParsedConfig)();
14
+ if (!compilerHost) {
15
+ compilerHost = (0, compiler_host_1.createCompilerHost)(parsedConfig);
16
+ }
17
+ if (!program) {
18
+ (0, tracing_1.startTracingIfNeeded)(parsedConfig.options);
19
+ program = typescript_1.typescript.createProgram({
20
+ rootNames: parsedConfig.fileNames,
21
+ options: parsedConfig.options,
22
+ projectReferences: parsedConfig.projectReferences,
23
+ host: compilerHost,
24
+ });
25
+ }
26
+ (0, diagnostics_1.updateDiagnostics)((0, config_1.getConfigFilePathFromProgram)(program), (0, diagnostics_1.getDiagnosticsOfProgram)(program));
27
+ (0, emit_1.emitDtsIfNeeded)(program);
28
+ (0, tracing_1.stopTracingIfNeeded)(program);
29
+ }
30
+ exports.useProgram = useProgram;
31
+ function invalidateProgram(withHost = false) {
32
+ if (withHost) {
33
+ compilerHost = undefined;
34
+ }
35
+ program = undefined;
36
+ }
37
+ 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 = (0, config_1.getParsedConfig)();
16
+ solutionBuilderHost = (0, watch_solution_builder_host_1.createWatchSolutionBuilderHost)(parsedConfig, (rootNames, compilerOptions, host, oldProgram, configFileParsingDiagnostics, projectReferences) => {
17
+ if (compilerOptions) {
18
+ (0, tracing_1.startTracingIfNeeded)(compilerOptions);
19
+ }
20
+ return typescript_1.typescript.createSemanticDiagnosticsBuilderProgram(rootNames, compilerOptions, host, oldProgram, configFileParsingDiagnostics, projectReferences);
21
+ }, undefined, undefined, undefined, undefined, (builderProgram) => {
22
+ (0, diagnostics_1.updateDiagnostics)((0, config_1.getConfigFilePathFromBuilderProgram)(builderProgram), (0, diagnostics_1.getDiagnosticsOfProgram)(builderProgram));
23
+ (0, tsbuildinfo_1.emitTsBuildInfoIfNeeded)(builderProgram);
24
+ (0, 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,51 @@
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 emit_1 = require("../emit");
8
+ const watch_compiler_host_1 = require("../host/watch-compiler-host");
9
+ const tracing_1 = require("../tracing");
10
+ const tsbuildinfo_1 = require("../tsbuildinfo");
11
+ const typescript_1 = require("../typescript");
12
+ let watchCompilerHost;
13
+ let watchProgram;
14
+ let shouldUpdateRootFiles = false;
15
+ function useWatchProgram() {
16
+ if (!watchCompilerHost) {
17
+ const parsedConfig = (0, config_1.getParsedConfig)();
18
+ watchCompilerHost = (0, watch_compiler_host_1.createWatchCompilerHost)(parsedConfig, (rootNames, compilerOptions, host, oldProgram, configFileParsingDiagnostics, projectReferences) => {
19
+ if (compilerOptions) {
20
+ (0, tracing_1.startTracingIfNeeded)(compilerOptions);
21
+ }
22
+ return typescript_1.typescript.createSemanticDiagnosticsBuilderProgram(rootNames, compilerOptions, host, oldProgram, configFileParsingDiagnostics, projectReferences);
23
+ }, undefined, undefined, (builderProgram) => {
24
+ (0, diagnostics_1.updateDiagnostics)((0, config_1.getConfigFilePathFromBuilderProgram)(builderProgram), (0, diagnostics_1.getDiagnosticsOfProgram)(builderProgram));
25
+ (0, emit_1.emitDtsIfNeeded)(builderProgram);
26
+ (0, tsbuildinfo_1.emitTsBuildInfoIfNeeded)(builderProgram);
27
+ (0, tracing_1.stopTracingIfNeeded)(builderProgram);
28
+ });
29
+ watchProgram = undefined;
30
+ }
31
+ if (!watchProgram) {
32
+ watchProgram = typescript_1.typescript.createWatchProgram(watchCompilerHost);
33
+ }
34
+ if (shouldUpdateRootFiles) {
35
+ // we have to update root files manually as don't use config file as a program input
36
+ watchProgram.updateRootFileNames((0, dependencies_1.getDependencies)().files);
37
+ shouldUpdateRootFiles = false;
38
+ }
39
+ }
40
+ exports.useWatchProgram = useWatchProgram;
41
+ function invalidateWatchProgram(withHost = false) {
42
+ if (withHost) {
43
+ watchCompilerHost = undefined;
44
+ }
45
+ watchProgram = undefined;
46
+ }
47
+ exports.invalidateWatchProgram = invalidateWatchProgram;
48
+ function invalidateWatchProgramRootFileNames() {
49
+ shouldUpdateRootFiles = true;
50
+ }
51
+ exports.invalidateWatchProgramRootFileNames = invalidateWatchProgramRootFileNames;
@@ -0,0 +1,19 @@
1
+ import type * as ts from 'typescript';
2
+ import type { FilesMatch } from '../../../files-match';
3
+ export interface ControlledTypeScriptSystem extends ts.System {
4
+ invokeFileCreated(path: string): void;
5
+ invokeFileChanged(path: string): void;
6
+ invokeFileDeleted(path: string): void;
7
+ invalidateCache(): void;
8
+ getFileSize(path: string): number;
9
+ watchFile(path: string, callback: ts.FileWatcherCallback, pollingInterval?: number, options?: ts.WatchOptions): ts.FileWatcher;
10
+ watchDirectory(path: string, callback: ts.DirectoryWatcherCallback, recursive?: boolean, options?: ts.WatchOptions): ts.FileWatcher;
11
+ getModifiedTime(path: string): Date | undefined;
12
+ setModifiedTime(path: string, time: Date): void;
13
+ deleteFile(path: string): void;
14
+ setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): any;
15
+ clearTimeout(timeoutId: any): void;
16
+ waitForQueued(): Promise<void>;
17
+ setArtifacts(artifacts: FilesMatch): void;
18
+ }
19
+ export declare const system: ControlledTypeScriptSystem;