ts-checker-rspack-plugin 1.1.6 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/lib/getDependenciesWorker.js +652 -0
  2. package/lib/getIssuesWorker.js +1091 -0
  3. package/lib/index.js +970 -4
  4. package/lib/plugin-state.d.ts +0 -1
  5. package/lib/plugin.d.ts +1 -1
  6. package/lib/rpc/rpc-worker.d.ts +0 -1
  7. package/lib/rpc/wrap-rpc.d.ts +0 -1
  8. package/lib/typescript/worker/lib/file-system/file-system.d.ts +0 -1
  9. package/lib/utils/async/abort-error.d.ts +0 -1
  10. package/lib/utils/async/pool.d.ts +0 -1
  11. package/lib/watch/watch-file-system.d.ts +0 -1
  12. package/package.json +11 -10
  13. package/lib/files-change.js +0 -57
  14. package/lib/files-match.js +0 -2
  15. package/lib/formatter/basic-formatter.js +0 -13
  16. package/lib/formatter/code-frame-formatter.js +0 -32
  17. package/lib/formatter/formatter-config.js +0 -36
  18. package/lib/formatter/formatter-options.js +0 -2
  19. package/lib/formatter/formatter.js +0 -2
  20. package/lib/formatter/index.js +0 -22
  21. package/lib/formatter/stats-formatter.js +0 -30
  22. package/lib/formatter/types/babel__code-frame.js +0 -7
  23. package/lib/formatter/webpack-formatter.js +0 -32
  24. package/lib/hooks/intercept-done-to-get-dev-server-tap.js +0 -18
  25. package/lib/hooks/tap-after-compile-to-add-dependencies.js +0 -22
  26. package/lib/hooks/tap-after-compile-to-get-issues.js +0 -43
  27. package/lib/hooks/tap-after-environment-to-patch-watching.js +0 -22
  28. package/lib/hooks/tap-done-to-async-get-issues.js +0 -74
  29. package/lib/hooks/tap-error-to-log-message.js +0 -32
  30. package/lib/hooks/tap-start-to-run-workers.js +0 -122
  31. package/lib/hooks/tap-stop-to-terminate-workers.js +0 -26
  32. package/lib/infrastructure-logger.js +0 -14
  33. package/lib/issue/index.js +0 -19
  34. package/lib/issue/issue-config.js +0 -29
  35. package/lib/issue/issue-location.js +0 -22
  36. package/lib/issue/issue-match.js +0 -20
  37. package/lib/issue/issue-options.js +0 -2
  38. package/lib/issue/issue-position.js +0 -16
  39. package/lib/issue/issue-predicate.js +0 -11
  40. package/lib/issue/issue-severity.js +0 -12
  41. package/lib/issue/issue-webpack-error.js +0 -31
  42. package/lib/issue/issue.js +0 -41
  43. package/lib/logger.js +0 -2
  44. package/lib/plugin-config.js +0 -26
  45. package/lib/plugin-hooks.js +0 -45
  46. package/lib/plugin-options.js +0 -2
  47. package/lib/plugin-pools.js +0 -32
  48. package/lib/plugin-state.js +0 -17
  49. package/lib/plugin.js +0 -74
  50. package/lib/rpc/expose-rpc.js +0 -69
  51. package/lib/rpc/index.js +0 -12
  52. package/lib/rpc/rpc-error.js +0 -12
  53. package/lib/rpc/rpc-worker.js +0 -86
  54. package/lib/rpc/types.js +0 -2
  55. package/lib/rpc/wrap-rpc.js +0 -70
  56. package/lib/typescript/type-script-config-overwrite.js +0 -2
  57. package/lib/typescript/type-script-diagnostics-options.js +0 -2
  58. package/lib/typescript/type-script-support.js +0 -31
  59. package/lib/typescript/type-script-worker-config.js +0 -36
  60. package/lib/typescript/type-script-worker-options.js +0 -2
  61. package/lib/typescript/worker/get-dependencies-worker.js +0 -15
  62. package/lib/typescript/worker/get-issues-worker.js +0 -70
  63. package/lib/typescript/worker/lib/artifacts.js +0 -94
  64. package/lib/typescript/worker/lib/config.js +0 -162
  65. package/lib/typescript/worker/lib/dependencies.js +0 -84
  66. package/lib/typescript/worker/lib/diagnostics.js +0 -112
  67. package/lib/typescript/worker/lib/emit.js +0 -13
  68. package/lib/typescript/worker/lib/file-system/file-system.js +0 -2
  69. package/lib/typescript/worker/lib/file-system/mem-file-system.js +0 -81
  70. package/lib/typescript/worker/lib/file-system/passive-file-system.js +0 -68
  71. package/lib/typescript/worker/lib/file-system/real-file-system.js +0 -171
  72. package/lib/typescript/worker/lib/host/compiler-host.js +0 -17
  73. package/lib/typescript/worker/lib/host/watch-compiler-host.js +0 -32
  74. package/lib/typescript/worker/lib/host/watch-solution-builder-host.js +0 -53
  75. package/lib/typescript/worker/lib/performance.js +0 -29
  76. package/lib/typescript/worker/lib/program/program.js +0 -37
  77. package/lib/typescript/worker/lib/program/solution-builder.js +0 -39
  78. package/lib/typescript/worker/lib/program/watch-program.js +0 -51
  79. package/lib/typescript/worker/lib/system.js +0 -229
  80. package/lib/typescript/worker/lib/tracing.js +0 -27
  81. package/lib/typescript/worker/lib/tsbuildinfo.js +0 -96
  82. package/lib/typescript/worker/lib/typescript.js +0 -6
  83. package/lib/typescript/worker/lib/worker-config.js +0 -5
  84. package/lib/utils/async/abort-error.js +0 -15
  85. package/lib/utils/async/controlled-promise.js +0 -17
  86. package/lib/utils/async/is-pending.js +0 -10
  87. package/lib/utils/async/pool.js +0 -36
  88. package/lib/utils/async/wait.js +0 -7
  89. package/lib/utils/path/forward-slash.js +0 -15
  90. package/lib/utils/path/is-inside-another-path.js +0 -22
  91. package/lib/utils/path/relative-to-context.js +0 -16
  92. package/lib/watch/inclusive-node-watch-file-system.js +0 -183
  93. package/lib/watch/watch-file-system.js +0 -2
@@ -1,183 +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.InclusiveNodeWatchFileSystem = exports.createIsIgnored = void 0;
7
- const path_1 = require("path");
8
- const chokidar_1 = __importDefault(require("chokidar"));
9
- const minimatch_1 = require("minimatch");
10
- const is_glob_1 = __importDefault(require("is-glob"));
11
- const files_change_1 = require("../files-change");
12
- const infrastructure_logger_1 = require("../infrastructure-logger");
13
- const is_inside_another_path_1 = require("../utils/path/is-inside-another-path");
14
- const BUILTIN_IGNORED_DIRS = ['.git'];
15
- function createIsIgnored(ignored, excluded) {
16
- const ignoredPatterns = ignored ? (Array.isArray(ignored) ? [...ignored] : [ignored]) : [];
17
- const filteredExcluded = excluded.filter((pattern) => {
18
- // Use `minimatch` to check if the path is a glob pattern.
19
- if ((0, is_glob_1.default)(pattern)) {
20
- // Append `/**` to the pattern to align minimatch's behavior
21
- // with the `exclude` option in tsconfig.json.
22
- const shouldAppendStar = pattern.includes('**') && !pattern.endsWith('*');
23
- if (shouldAppendStar) {
24
- ignoredPatterns.push(pattern.endsWith('/') ? `${pattern}**` : `${pattern}/**`);
25
- }
26
- else {
27
- ignoredPatterns.push(pattern);
28
- }
29
- return false;
30
- }
31
- return true;
32
- });
33
- const ignoredFunctions = ignoredPatterns.map((pattern) => {
34
- // ensure patterns are valid - see https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/594
35
- if (typeof pattern === 'string') {
36
- return (path) => (0, minimatch_1.minimatch)(path, pattern);
37
- }
38
- else if (pattern instanceof RegExp) {
39
- return (path) => pattern.test(path);
40
- }
41
- else {
42
- // fallback to no-ignore function
43
- return () => false;
44
- }
45
- });
46
- ignoredFunctions.push((path) => filteredExcluded.some((excludedPath) => (0, is_inside_another_path_1.isInsideAnotherPath)(excludedPath, path)));
47
- ignoredFunctions.push((path) => BUILTIN_IGNORED_DIRS.some((ignoredDir) => path.includes(`/${ignoredDir}/`) || path.includes(`\\${ignoredDir}\\`)));
48
- return function isIgnored(path) {
49
- return ignoredFunctions.some((ignoredFunction) => ignoredFunction(path));
50
- };
51
- }
52
- exports.createIsIgnored = createIsIgnored;
53
- class InclusiveNodeWatchFileSystem {
54
- get watcher() {
55
- return this.watchFileSystem.watcher || this.watchFileSystem.wfs?.watcher;
56
- }
57
- constructor(watchFileSystem, compiler, pluginState) {
58
- this.watchFileSystem = watchFileSystem;
59
- this.compiler = compiler;
60
- this.pluginState = pluginState;
61
- this.paused = true;
62
- this.watch = (files, dirs, missing, startTime, options, callback, callbackUndelayed) => {
63
- const { debug } = (0, infrastructure_logger_1.getInfrastructureLogger)(this.compiler);
64
- (0, files_change_1.clearFilesChange)(this.compiler);
65
- const isIgnored = createIsIgnored(options?.ignored, this.pluginState.lastDependencies?.excluded || []);
66
- // use standard watch file system for files and missing
67
- const standardWatcher = this.watchFileSystem.watch(files, dirs, missing, startTime, options, callback, callbackUndelayed);
68
- this.watcher?.on('change', (file) => {
69
- if (typeof file !== 'string') {
70
- return;
71
- }
72
- if (!isIgnored(file)) {
73
- debug('Detected file change', file);
74
- this.deletedFiles.delete(file);
75
- (0, files_change_1.updateFilesChange)(this.compiler, { changedFiles: [file] });
76
- }
77
- else {
78
- debug("Detected file change but it's ignored", file);
79
- }
80
- });
81
- this.watcher?.on('remove', (file) => {
82
- if (typeof file !== 'string') {
83
- return;
84
- }
85
- if (this.deletedFiles.has(file)) {
86
- debug('Skipping duplicated remove event.');
87
- return;
88
- }
89
- if (!isIgnored(file)) {
90
- debug('Detected file remove', file);
91
- this.deletedFiles.add(file);
92
- (0, files_change_1.updateFilesChange)(this.compiler, { deletedFiles: [file] });
93
- }
94
- else {
95
- debug("Detected file remove but it's ignored", file);
96
- }
97
- });
98
- // calculate what to change
99
- const prevDirs = Array.from(this.dirsWatchers.keys());
100
- const nextDirs = Array.from(this.pluginState.lastDependencies?.dirs || []);
101
- const dirsToUnwatch = prevDirs.filter((prevDir) => !nextDirs.includes(prevDir));
102
- const dirsToWatch = nextDirs.filter((nextDir) => !prevDirs.includes(nextDir) && !isIgnored(nextDir));
103
- // update dirs watcher
104
- dirsToUnwatch.forEach((dirToUnwatch) => {
105
- this.dirsWatchers.get(dirToUnwatch)?.close();
106
- this.dirsWatchers.delete(dirToUnwatch);
107
- });
108
- dirsToWatch.forEach((dirToWatch) => {
109
- const interval = typeof options?.poll === 'number' ? options.poll : undefined;
110
- const dirWatcher = chokidar_1.default.watch(dirToWatch, {
111
- ignoreInitial: true,
112
- ignorePermissionErrors: true,
113
- ignored: (path) => isIgnored(path),
114
- usePolling: options?.poll ? true : undefined,
115
- interval: interval,
116
- binaryInterval: interval,
117
- alwaysStat: true,
118
- atomic: true,
119
- awaitWriteFinish: true,
120
- });
121
- dirWatcher.on('add', (file, stats) => {
122
- if (this.paused) {
123
- return;
124
- }
125
- const extension = (0, path_1.extname)(file);
126
- const supportedExtensions = this.pluginState.lastDependencies?.extensions || [];
127
- if (!supportedExtensions.includes(extension)) {
128
- debug('Detected new file add but extension is not supported', file);
129
- return;
130
- }
131
- debug('Detected new file add', file);
132
- this.deletedFiles.delete(file);
133
- (0, files_change_1.updateFilesChange)(this.compiler, { changedFiles: [file] });
134
- this.watcher?._onChange(dirToWatch, stats?.mtimeMs || stats?.ctimeMs || 1, file, 'rename');
135
- });
136
- dirWatcher.on('unlink', (file) => {
137
- if (this.paused) {
138
- return;
139
- }
140
- const extension = (0, path_1.extname)(file);
141
- const supportedExtensions = this.pluginState.lastDependencies?.extensions || [];
142
- if (!supportedExtensions.includes(extension)) {
143
- debug('Detected new file remove but extension is not supported', file);
144
- return;
145
- }
146
- if (this.deletedFiles.has(file)) {
147
- debug('Skipping duplicated unlink event.');
148
- return;
149
- }
150
- debug('Detected new file remove', file);
151
- this.deletedFiles.add(file);
152
- (0, files_change_1.updateFilesChange)(this.compiler, { deletedFiles: [file] });
153
- this.watcher?._onRemove(dirToWatch, file, 'rename');
154
- });
155
- this.dirsWatchers.set(dirToWatch, dirWatcher);
156
- });
157
- this.paused = false;
158
- return {
159
- ...standardWatcher,
160
- close: () => {
161
- (0, files_change_1.clearFilesChange)(this.compiler);
162
- if (standardWatcher) {
163
- standardWatcher.close();
164
- }
165
- this.dirsWatchers.forEach((dirWatcher) => {
166
- dirWatcher?.close();
167
- });
168
- this.dirsWatchers.clear();
169
- this.paused = true;
170
- },
171
- pause: () => {
172
- if (standardWatcher) {
173
- standardWatcher.pause();
174
- }
175
- this.paused = true;
176
- },
177
- };
178
- };
179
- this.dirsWatchers = new Map();
180
- this.deletedFiles = new Set();
181
- }
182
- }
183
- exports.InclusiveNodeWatchFileSystem = InclusiveNodeWatchFileSystem;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });