ts-checker-rspack-plugin 1.5.3 → 1.6.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.
@@ -90,32 +90,33 @@ require("node:os");
90
90
  const worker_config_config = getRpcWorkerData();
91
91
  const typescript_typescript = require(worker_config_config.typescriptPath);
92
92
  new Map();
93
- const external_memfs_namespaceObject = require("memfs");
93
+ const external_node_module_namespaceObject = require("node:module");
94
94
  const external_node_fs_namespaceObject = require("node:fs");
95
95
  var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
96
96
  const existsCache = new Map();
97
+ const normalizedPathCache = new Map();
97
98
  const readStatsCache = new Map();
98
99
  const readFileCache = new Map();
99
100
  const readDirCache = new Map();
100
101
  const realPathCache = new Map();
101
102
  const realFileSystem = {
102
103
  exists (path) {
103
- return exists(getRealPath(path));
104
+ return exists(path);
104
105
  },
105
106
  readFile (path, encoding) {
106
- return readFile(getRealPath(path), encoding);
107
+ return readFile(path, encoding);
107
108
  },
108
109
  readDir (path) {
109
- return readDir(getRealPath(path));
110
+ return readDir(path);
110
111
  },
111
112
  readStats (path) {
112
- return readStats(getRealPath(path));
113
+ return readStats(path);
113
114
  },
114
115
  realPath (path) {
115
116
  return getRealPath(path);
116
117
  },
117
118
  normalizePath (path) {
118
- return (0, external_node_path_namespaceObject.normalize)(path);
119
+ return normalizePath(path);
119
120
  },
120
121
  writeFile (path, data) {
121
122
  writeFile(getRealPath(path), data);
@@ -131,6 +132,7 @@ const realFileSystem = {
131
132
  },
132
133
  clearCache () {
133
134
  existsCache.clear();
135
+ normalizedPathCache.clear();
134
136
  readStatsCache.clear();
135
137
  readFileCache.clear();
136
138
  readDirCache.clear();
@@ -138,19 +140,25 @@ const realFileSystem = {
138
140
  }
139
141
  };
140
142
  function exists(path) {
141
- const normalizedPath = (0, external_node_path_namespaceObject.normalize)(path);
142
- if (!existsCache.has(normalizedPath)) existsCache.set(normalizedPath, external_node_fs_default().existsSync(normalizedPath));
143
- return !!existsCache.get(normalizedPath);
143
+ const normalizedPath = normalizePath(path);
144
+ return existsNormalized(normalizedPath);
145
+ }
146
+ function existsNormalized(normalizedPath) {
147
+ const cached = existsCache.get(normalizedPath);
148
+ if (void 0 !== cached) return cached;
149
+ const result = external_node_fs_default().existsSync(normalizedPath);
150
+ existsCache.set(normalizedPath, result);
151
+ return result;
144
152
  }
145
153
  function readStats(path) {
146
- const normalizedPath = (0, external_node_path_namespaceObject.normalize)(path);
154
+ const normalizedPath = normalizePath(path);
147
155
  if (!readStatsCache.has(normalizedPath)) {
148
- if (exists(normalizedPath)) readStatsCache.set(normalizedPath, external_node_fs_default().statSync(normalizedPath));
156
+ if (existsNormalized(normalizedPath)) readStatsCache.set(normalizedPath, external_node_fs_default().statSync(normalizedPath));
149
157
  }
150
158
  return readStatsCache.get(normalizedPath);
151
159
  }
152
160
  function readFile(path, encoding) {
153
- const normalizedPath = (0, external_node_path_namespaceObject.normalize)(path);
161
+ const normalizedPath = normalizePath(path);
154
162
  if (!readFileCache.has(normalizedPath)) {
155
163
  const stats = readStats(normalizedPath);
156
164
  if (stats && stats.isFile()) readFileCache.set(normalizedPath, external_node_fs_default().readFileSync(normalizedPath, {
@@ -161,7 +169,7 @@ function readFile(path, encoding) {
161
169
  return readFileCache.get(normalizedPath);
162
170
  }
163
171
  function readDir(path) {
164
- const normalizedPath = (0, external_node_path_namespaceObject.normalize)(path);
172
+ const normalizedPath = normalizePath(path);
165
173
  if (!readDirCache.has(normalizedPath)) {
166
174
  const stats = readStats(normalizedPath);
167
175
  if (stats && stats.isDirectory()) readDirCache.set(normalizedPath, external_node_fs_default().readdirSync(normalizedPath, {
@@ -172,13 +180,20 @@ function readDir(path) {
172
180
  return readDirCache.get(normalizedPath) || [];
173
181
  }
174
182
  function getRealPath(path) {
175
- const normalizedPath = (0, external_node_path_namespaceObject.normalize)(path);
183
+ const normalizedPath = normalizePath(path);
176
184
  if (!realPathCache.has(normalizedPath)) {
177
185
  let base = normalizedPath;
178
186
  let nested = '';
179
187
  while(base !== (0, external_node_path_namespaceObject.dirname)(base)){
180
- if (exists(base)) {
181
- realPathCache.set(normalizedPath, (0, external_node_path_namespaceObject.normalize)((0, external_node_path_namespaceObject.join)(external_node_fs_default().realpathSync(base), nested)));
188
+ const cachedBase = realPathCache.get(base);
189
+ if (cachedBase) {
190
+ realPathCache.set(normalizedPath, (0, external_node_path_namespaceObject.join)(cachedBase, nested));
191
+ break;
192
+ }
193
+ if (existsNormalized(base)) {
194
+ const realBase = normalizePath(realpath(base));
195
+ realPathCache.set(base, realBase);
196
+ realPathCache.set(normalizedPath, (0, external_node_path_namespaceObject.join)(realBase, nested));
182
197
  break;
183
198
  }
184
199
  nested = (0, external_node_path_namespaceObject.join)((0, external_node_path_namespaceObject.basename)(base), nested);
@@ -187,8 +202,26 @@ function getRealPath(path) {
187
202
  }
188
203
  return realPathCache.get(normalizedPath) || normalizedPath;
189
204
  }
190
- function createDir(path) {
205
+ function normalizePath(path) {
206
+ const cached = normalizedPathCache.get(path);
207
+ if (void 0 !== cached) return cached;
191
208
  const normalizedPath = (0, external_node_path_namespaceObject.normalize)(path);
209
+ normalizedPathCache.set(path, normalizedPath);
210
+ return normalizedPath;
211
+ }
212
+ function fsRealPathHandlingLongPath(path) {
213
+ return path.length < 260 ? external_node_fs_default().realpathSync.native(path) : external_node_fs_default().realpathSync(path);
214
+ }
215
+ const fsRealpath = external_node_fs_default().realpathSync.native ? 'win32' === process.platform ? fsRealPathHandlingLongPath : external_node_fs_default().realpathSync.native : external_node_fs_default().realpathSync;
216
+ function realpath(path) {
217
+ try {
218
+ return fsRealpath(path);
219
+ } catch {
220
+ return path;
221
+ }
222
+ }
223
+ function createDir(path) {
224
+ const normalizedPath = normalizePath(path);
192
225
  external_node_fs_default().mkdirSync(normalizedPath, {
193
226
  recursive: true
194
227
  });
@@ -197,7 +230,7 @@ function createDir(path) {
197
230
  if (readStatsCache.has(normalizedPath)) readStatsCache.delete(normalizedPath);
198
231
  }
199
232
  function writeFile(path, data) {
200
- const normalizedPath = (0, external_node_path_namespaceObject.normalize)(path);
233
+ const normalizedPath = normalizePath(path);
201
234
  if (!exists((0, external_node_path_namespaceObject.dirname)(normalizedPath))) createDir((0, external_node_path_namespaceObject.dirname)(normalizedPath));
202
235
  external_node_fs_default().writeFileSync(normalizedPath, data);
203
236
  existsCache.set(normalizedPath, true);
@@ -207,7 +240,7 @@ function writeFile(path, data) {
207
240
  }
208
241
  function deleteFile(path) {
209
242
  if (exists(path)) {
210
- const normalizedPath = (0, external_node_path_namespaceObject.normalize)(path);
243
+ const normalizedPath = normalizePath(path);
211
244
  external_node_fs_default().unlinkSync(normalizedPath);
212
245
  existsCache.set(normalizedPath, false);
213
246
  if (readDirCache.has((0, external_node_path_namespaceObject.dirname)(normalizedPath))) readDirCache.delete((0, external_node_path_namespaceObject.dirname)(normalizedPath));
@@ -217,13 +250,24 @@ function deleteFile(path) {
217
250
  }
218
251
  function updateTimes(path, atime, mtime) {
219
252
  if (exists(path)) {
220
- const normalizedPath = (0, external_node_path_namespaceObject.normalize)(path);
221
- external_node_fs_default().utimesSync((0, external_node_path_namespaceObject.normalize)(path), atime, mtime);
253
+ const normalizedPath = normalizePath(path);
254
+ external_node_fs_default().utimesSync(normalizedPath, atime, mtime);
222
255
  if (readStatsCache.has(normalizedPath)) readStatsCache.delete(normalizedPath);
223
256
  }
224
257
  }
258
+ let hasChanges = false;
259
+ let mem;
260
+ const requireModule = (0, external_node_module_namespaceObject.createRequire)(__filename);
261
+ function getMemoryFileSystem() {
262
+ if (mem) return mem;
263
+ mem = requireModule('memfs').fs;
264
+ return mem;
265
+ }
225
266
  const memFileSystem = {
226
267
  ...realFileSystem,
268
+ hasChanges () {
269
+ return hasChanges;
270
+ },
227
271
  exists (path) {
228
272
  return mem_file_system_exists(realFileSystem.realPath(path));
229
273
  },
@@ -253,38 +297,42 @@ const memFileSystem = {
253
297
  }
254
298
  };
255
299
  function mem_file_system_exists(path) {
256
- return external_memfs_namespaceObject.fs.existsSync(realFileSystem.normalizePath(path));
300
+ return getMemoryFileSystem().existsSync(realFileSystem.normalizePath(path));
257
301
  }
258
302
  function mem_file_system_readStats(path) {
259
- return mem_file_system_exists(path) ? external_memfs_namespaceObject.fs.statSync(realFileSystem.normalizePath(path)) : void 0;
303
+ return mem_file_system_exists(path) ? getMemoryFileSystem().statSync(realFileSystem.normalizePath(path)) : void 0;
260
304
  }
261
305
  function mem_file_system_readFile(path, encoding) {
262
306
  const stats = mem_file_system_readStats(path);
263
- if (stats && stats.isFile()) return external_memfs_namespaceObject.fs.readFileSync(realFileSystem.normalizePath(path), {
307
+ if (stats && stats.isFile()) return getMemoryFileSystem().readFileSync(realFileSystem.normalizePath(path), {
264
308
  encoding: encoding
265
309
  }).toString();
266
310
  }
267
311
  function mem_file_system_readDir(path) {
268
312
  const stats = mem_file_system_readStats(path);
269
- if (stats && stats.isDirectory()) return external_memfs_namespaceObject.fs.readdirSync(realFileSystem.normalizePath(path), {
313
+ if (stats && stats.isDirectory()) return getMemoryFileSystem().readdirSync(realFileSystem.normalizePath(path), {
270
314
  withFileTypes: true
271
315
  });
272
316
  return [];
273
317
  }
274
318
  function mem_file_system_createDir(path) {
275
- external_memfs_namespaceObject.fs.mkdirSync(realFileSystem.normalizePath(path), {
319
+ hasChanges = true;
320
+ getMemoryFileSystem().mkdirSync(realFileSystem.normalizePath(path), {
276
321
  recursive: true
277
322
  });
278
323
  }
279
324
  function mem_file_system_writeFile(path, data) {
325
+ hasChanges = true;
280
326
  if (!mem_file_system_exists((0, external_node_path_namespaceObject.dirname)(path))) mem_file_system_createDir((0, external_node_path_namespaceObject.dirname)(path));
281
- external_memfs_namespaceObject.fs.writeFileSync(realFileSystem.normalizePath(path), data);
327
+ getMemoryFileSystem().writeFileSync(realFileSystem.normalizePath(path), data);
282
328
  }
283
329
  function mem_file_system_deleteFile(path) {
284
- if (mem_file_system_exists(path)) external_memfs_namespaceObject.fs.unlinkSync(realFileSystem.normalizePath(path));
330
+ hasChanges = true;
331
+ if (mem_file_system_exists(path)) getMemoryFileSystem().unlinkSync(realFileSystem.normalizePath(path));
285
332
  }
286
333
  function mem_file_system_updateTimes(path, atime, mtime) {
287
- if (mem_file_system_exists(path)) external_memfs_namespaceObject.fs.utimesSync(realFileSystem.normalizePath(path), atime, mtime);
334
+ hasChanges = true;
335
+ if (mem_file_system_exists(path)) getMemoryFileSystem().utimesSync(realFileSystem.normalizePath(path), atime, mtime);
288
336
  }
289
337
  const passiveFileSystem = {
290
338
  ...memFileSystem,
@@ -509,7 +557,7 @@ function getReadFileSystem(path) {
509
557
  return memFileSystem;
510
558
  }
511
559
  }
512
- return passiveFileSystem;
560
+ return 'readonly' !== mode || memFileSystem.hasChanges() ? passiveFileSystem : realFileSystem;
513
561
  }
514
562
  function getWriteFileSystem(path) {
515
563
  if ('write-references' === mode || 'write-tsbuildinfo' === mode && path.endsWith('.tsbuildinfo') || 'write-dts' === mode && [
@@ -205,32 +205,33 @@ function createIssueFromDiagnostic(diagnostic, defaultSeverity) {
205
205
  function createIssuesFromDiagnostics(diagnostics, defaultSeverity) {
206
206
  return deduplicateAndSortIssues(diagnostics.map((diagnostic)=>createIssueFromDiagnostic(diagnostic, defaultSeverity)));
207
207
  }
208
- const external_memfs_namespaceObject = require("memfs");
208
+ const external_node_module_namespaceObject = require("node:module");
209
209
  const external_node_fs_namespaceObject = require("node:fs");
210
210
  var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
211
211
  const existsCache = new Map();
212
+ const normalizedPathCache = new Map();
212
213
  const readStatsCache = new Map();
213
214
  const readFileCache = new Map();
214
215
  const readDirCache = new Map();
215
216
  const realPathCache = new Map();
216
217
  const realFileSystem = {
217
218
  exists (path) {
218
- return exists(getRealPath(path));
219
+ return exists(path);
219
220
  },
220
221
  readFile (path, encoding) {
221
- return readFile(getRealPath(path), encoding);
222
+ return readFile(path, encoding);
222
223
  },
223
224
  readDir (path) {
224
- return readDir(getRealPath(path));
225
+ return readDir(path);
225
226
  },
226
227
  readStats (path) {
227
- return readStats(getRealPath(path));
228
+ return readStats(path);
228
229
  },
229
230
  realPath (path) {
230
231
  return getRealPath(path);
231
232
  },
232
233
  normalizePath (path) {
233
- return (0, external_node_path_namespaceObject.normalize)(path);
234
+ return normalizePath(path);
234
235
  },
235
236
  writeFile (path, data) {
236
237
  writeFile(getRealPath(path), data);
@@ -246,6 +247,7 @@ const realFileSystem = {
246
247
  },
247
248
  clearCache () {
248
249
  existsCache.clear();
250
+ normalizedPathCache.clear();
249
251
  readStatsCache.clear();
250
252
  readFileCache.clear();
251
253
  readDirCache.clear();
@@ -253,19 +255,25 @@ const realFileSystem = {
253
255
  }
254
256
  };
255
257
  function exists(path) {
256
- const normalizedPath = (0, external_node_path_namespaceObject.normalize)(path);
257
- if (!existsCache.has(normalizedPath)) existsCache.set(normalizedPath, external_node_fs_default().existsSync(normalizedPath));
258
- return !!existsCache.get(normalizedPath);
258
+ const normalizedPath = normalizePath(path);
259
+ return existsNormalized(normalizedPath);
260
+ }
261
+ function existsNormalized(normalizedPath) {
262
+ const cached = existsCache.get(normalizedPath);
263
+ if (void 0 !== cached) return cached;
264
+ const result = external_node_fs_default().existsSync(normalizedPath);
265
+ existsCache.set(normalizedPath, result);
266
+ return result;
259
267
  }
260
268
  function readStats(path) {
261
- const normalizedPath = (0, external_node_path_namespaceObject.normalize)(path);
269
+ const normalizedPath = normalizePath(path);
262
270
  if (!readStatsCache.has(normalizedPath)) {
263
- if (exists(normalizedPath)) readStatsCache.set(normalizedPath, external_node_fs_default().statSync(normalizedPath));
271
+ if (existsNormalized(normalizedPath)) readStatsCache.set(normalizedPath, external_node_fs_default().statSync(normalizedPath));
264
272
  }
265
273
  return readStatsCache.get(normalizedPath);
266
274
  }
267
275
  function readFile(path, encoding) {
268
- const normalizedPath = (0, external_node_path_namespaceObject.normalize)(path);
276
+ const normalizedPath = normalizePath(path);
269
277
  if (!readFileCache.has(normalizedPath)) {
270
278
  const stats = readStats(normalizedPath);
271
279
  if (stats && stats.isFile()) readFileCache.set(normalizedPath, external_node_fs_default().readFileSync(normalizedPath, {
@@ -276,7 +284,7 @@ function readFile(path, encoding) {
276
284
  return readFileCache.get(normalizedPath);
277
285
  }
278
286
  function readDir(path) {
279
- const normalizedPath = (0, external_node_path_namespaceObject.normalize)(path);
287
+ const normalizedPath = normalizePath(path);
280
288
  if (!readDirCache.has(normalizedPath)) {
281
289
  const stats = readStats(normalizedPath);
282
290
  if (stats && stats.isDirectory()) readDirCache.set(normalizedPath, external_node_fs_default().readdirSync(normalizedPath, {
@@ -287,13 +295,20 @@ function readDir(path) {
287
295
  return readDirCache.get(normalizedPath) || [];
288
296
  }
289
297
  function getRealPath(path) {
290
- const normalizedPath = (0, external_node_path_namespaceObject.normalize)(path);
298
+ const normalizedPath = normalizePath(path);
291
299
  if (!realPathCache.has(normalizedPath)) {
292
300
  let base = normalizedPath;
293
301
  let nested = '';
294
302
  while(base !== (0, external_node_path_namespaceObject.dirname)(base)){
295
- if (exists(base)) {
296
- realPathCache.set(normalizedPath, (0, external_node_path_namespaceObject.normalize)((0, external_node_path_namespaceObject.join)(external_node_fs_default().realpathSync(base), nested)));
303
+ const cachedBase = realPathCache.get(base);
304
+ if (cachedBase) {
305
+ realPathCache.set(normalizedPath, (0, external_node_path_namespaceObject.join)(cachedBase, nested));
306
+ break;
307
+ }
308
+ if (existsNormalized(base)) {
309
+ const realBase = normalizePath(realpath(base));
310
+ realPathCache.set(base, realBase);
311
+ realPathCache.set(normalizedPath, (0, external_node_path_namespaceObject.join)(realBase, nested));
297
312
  break;
298
313
  }
299
314
  nested = (0, external_node_path_namespaceObject.join)((0, external_node_path_namespaceObject.basename)(base), nested);
@@ -302,8 +317,26 @@ function getRealPath(path) {
302
317
  }
303
318
  return realPathCache.get(normalizedPath) || normalizedPath;
304
319
  }
305
- function createDir(path) {
320
+ function normalizePath(path) {
321
+ const cached = normalizedPathCache.get(path);
322
+ if (void 0 !== cached) return cached;
306
323
  const normalizedPath = (0, external_node_path_namespaceObject.normalize)(path);
324
+ normalizedPathCache.set(path, normalizedPath);
325
+ return normalizedPath;
326
+ }
327
+ function fsRealPathHandlingLongPath(path) {
328
+ return path.length < 260 ? external_node_fs_default().realpathSync.native(path) : external_node_fs_default().realpathSync(path);
329
+ }
330
+ const fsRealpath = external_node_fs_default().realpathSync.native ? 'win32' === process.platform ? fsRealPathHandlingLongPath : external_node_fs_default().realpathSync.native : external_node_fs_default().realpathSync;
331
+ function realpath(path) {
332
+ try {
333
+ return fsRealpath(path);
334
+ } catch {
335
+ return path;
336
+ }
337
+ }
338
+ function createDir(path) {
339
+ const normalizedPath = normalizePath(path);
307
340
  external_node_fs_default().mkdirSync(normalizedPath, {
308
341
  recursive: true
309
342
  });
@@ -312,7 +345,7 @@ function createDir(path) {
312
345
  if (readStatsCache.has(normalizedPath)) readStatsCache.delete(normalizedPath);
313
346
  }
314
347
  function writeFile(path, data) {
315
- const normalizedPath = (0, external_node_path_namespaceObject.normalize)(path);
348
+ const normalizedPath = normalizePath(path);
316
349
  if (!exists((0, external_node_path_namespaceObject.dirname)(normalizedPath))) createDir((0, external_node_path_namespaceObject.dirname)(normalizedPath));
317
350
  external_node_fs_default().writeFileSync(normalizedPath, data);
318
351
  existsCache.set(normalizedPath, true);
@@ -322,7 +355,7 @@ function writeFile(path, data) {
322
355
  }
323
356
  function deleteFile(path) {
324
357
  if (exists(path)) {
325
- const normalizedPath = (0, external_node_path_namespaceObject.normalize)(path);
358
+ const normalizedPath = normalizePath(path);
326
359
  external_node_fs_default().unlinkSync(normalizedPath);
327
360
  existsCache.set(normalizedPath, false);
328
361
  if (readDirCache.has((0, external_node_path_namespaceObject.dirname)(normalizedPath))) readDirCache.delete((0, external_node_path_namespaceObject.dirname)(normalizedPath));
@@ -332,13 +365,24 @@ function deleteFile(path) {
332
365
  }
333
366
  function updateTimes(path, atime, mtime) {
334
367
  if (exists(path)) {
335
- const normalizedPath = (0, external_node_path_namespaceObject.normalize)(path);
336
- external_node_fs_default().utimesSync((0, external_node_path_namespaceObject.normalize)(path), atime, mtime);
368
+ const normalizedPath = normalizePath(path);
369
+ external_node_fs_default().utimesSync(normalizedPath, atime, mtime);
337
370
  if (readStatsCache.has(normalizedPath)) readStatsCache.delete(normalizedPath);
338
371
  }
339
372
  }
373
+ let hasChanges = false;
374
+ let mem;
375
+ const requireModule = (0, external_node_module_namespaceObject.createRequire)(__filename);
376
+ function getMemoryFileSystem() {
377
+ if (mem) return mem;
378
+ mem = requireModule('memfs').fs;
379
+ return mem;
380
+ }
340
381
  const memFileSystem = {
341
382
  ...realFileSystem,
383
+ hasChanges () {
384
+ return hasChanges;
385
+ },
342
386
  exists (path) {
343
387
  return mem_file_system_exists(realFileSystem.realPath(path));
344
388
  },
@@ -368,38 +412,42 @@ const memFileSystem = {
368
412
  }
369
413
  };
370
414
  function mem_file_system_exists(path) {
371
- return external_memfs_namespaceObject.fs.existsSync(realFileSystem.normalizePath(path));
415
+ return getMemoryFileSystem().existsSync(realFileSystem.normalizePath(path));
372
416
  }
373
417
  function mem_file_system_readStats(path) {
374
- return mem_file_system_exists(path) ? external_memfs_namespaceObject.fs.statSync(realFileSystem.normalizePath(path)) : void 0;
418
+ return mem_file_system_exists(path) ? getMemoryFileSystem().statSync(realFileSystem.normalizePath(path)) : void 0;
375
419
  }
376
420
  function mem_file_system_readFile(path, encoding) {
377
421
  const stats = mem_file_system_readStats(path);
378
- if (stats && stats.isFile()) return external_memfs_namespaceObject.fs.readFileSync(realFileSystem.normalizePath(path), {
422
+ if (stats && stats.isFile()) return getMemoryFileSystem().readFileSync(realFileSystem.normalizePath(path), {
379
423
  encoding: encoding
380
424
  }).toString();
381
425
  }
382
426
  function mem_file_system_readDir(path) {
383
427
  const stats = mem_file_system_readStats(path);
384
- if (stats && stats.isDirectory()) return external_memfs_namespaceObject.fs.readdirSync(realFileSystem.normalizePath(path), {
428
+ if (stats && stats.isDirectory()) return getMemoryFileSystem().readdirSync(realFileSystem.normalizePath(path), {
385
429
  withFileTypes: true
386
430
  });
387
431
  return [];
388
432
  }
389
433
  function mem_file_system_createDir(path) {
390
- external_memfs_namespaceObject.fs.mkdirSync(realFileSystem.normalizePath(path), {
434
+ hasChanges = true;
435
+ getMemoryFileSystem().mkdirSync(realFileSystem.normalizePath(path), {
391
436
  recursive: true
392
437
  });
393
438
  }
394
439
  function mem_file_system_writeFile(path, data) {
440
+ hasChanges = true;
395
441
  if (!mem_file_system_exists((0, external_node_path_namespaceObject.dirname)(path))) mem_file_system_createDir((0, external_node_path_namespaceObject.dirname)(path));
396
- external_memfs_namespaceObject.fs.writeFileSync(realFileSystem.normalizePath(path), data);
442
+ getMemoryFileSystem().writeFileSync(realFileSystem.normalizePath(path), data);
397
443
  }
398
444
  function mem_file_system_deleteFile(path) {
399
- if (mem_file_system_exists(path)) external_memfs_namespaceObject.fs.unlinkSync(realFileSystem.normalizePath(path));
445
+ hasChanges = true;
446
+ if (mem_file_system_exists(path)) getMemoryFileSystem().unlinkSync(realFileSystem.normalizePath(path));
400
447
  }
401
448
  function mem_file_system_updateTimes(path, atime, mtime) {
402
- if (mem_file_system_exists(path)) external_memfs_namespaceObject.fs.utimesSync(realFileSystem.normalizePath(path), atime, mtime);
449
+ hasChanges = true;
450
+ if (mem_file_system_exists(path)) getMemoryFileSystem().utimesSync(realFileSystem.normalizePath(path), atime, mtime);
403
451
  }
404
452
  const passiveFileSystem = {
405
453
  ...memFileSystem,
@@ -624,7 +672,7 @@ function getReadFileSystem(path) {
624
672
  return memFileSystem;
625
673
  }
626
674
  }
627
- return passiveFileSystem;
675
+ return 'readonly' !== mode || memFileSystem.hasChanges() ? passiveFileSystem : realFileSystem;
628
676
  }
629
677
  function getWriteFileSystem(path) {
630
678
  if ('write-references' === mode || 'write-tsbuildinfo' === mode && path.endsWith('.tsbuildinfo') || 'write-dts' === mode && [
@@ -1082,7 +1130,7 @@ function invalidateWatchProgram(withHost = false) {
1082
1130
  function invalidateWatchProgramRootFileNames() {
1083
1131
  shouldUpdateRootFiles = true;
1084
1132
  }
1085
- const getIssuesWorker = async (change, watching, defaultSeverity)=>{
1133
+ const getIssuesWorker = async (change, watching, defaultSeverity, withDependencies = false)=>{
1086
1134
  system.invalidateCache();
1087
1135
  if (didConfigFileChanged(change)) {
1088
1136
  invalidateConfig();
@@ -1094,10 +1142,11 @@ const getIssuesWorker = async (change, watching, defaultSeverity)=>{
1094
1142
  invalidateSolutionBuilder(true);
1095
1143
  invalidateTsBuildInfo();
1096
1144
  } else if (didDependenciesProbablyChanged(getDependencies(), change)) {
1145
+ const rootFilesChanged = didRootFilesChanged();
1097
1146
  invalidateConfig();
1098
1147
  invalidateDependencies();
1099
1148
  invalidateArtifacts();
1100
- if (didRootFilesChanged()) {
1149
+ if (rootFilesChanged) {
1101
1150
  invalidateWatchProgramRootFileNames();
1102
1151
  invalidateSolutionBuilder();
1103
1152
  }
@@ -1105,7 +1154,10 @@ const getIssuesWorker = async (change, watching, defaultSeverity)=>{
1105
1154
  registerArtifacts();
1106
1155
  enablePerformanceIfNeeded();
1107
1156
  const parseConfigIssues = getParseConfigIssues(defaultSeverity);
1108
- if (parseConfigIssues.length) return parseConfigIssues;
1157
+ if (parseConfigIssues.length) return {
1158
+ issues: parseConfigIssues,
1159
+ dependencies: withDependencies ? getDependencies() : void 0
1160
+ };
1109
1161
  if (worker_config_config.build) useSolutionBuilder();
1110
1162
  else if (watching) useWatchProgram();
1111
1163
  else useProgram();
@@ -1120,7 +1172,10 @@ const getIssuesWorker = async (change, watching, defaultSeverity)=>{
1120
1172
  dumpTracingLegendIfNeeded();
1121
1173
  printPerformanceMeasuresIfNeeded();
1122
1174
  disablePerformanceIfNeeded();
1123
- return issues;
1175
+ return {
1176
+ issues,
1177
+ dependencies: withDependencies ? getDependencies() : void 0
1178
+ };
1124
1179
  };
1125
1180
  exposeRpc(getIssuesWorker);
1126
1181
  for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
package/lib/index.js CHANGED
@@ -4117,16 +4117,17 @@ var __webpack_exports__ = {};
4117
4117
  ].join('\n'));
4118
4118
  }
4119
4119
  state.aggregatedFilesChange = aggregatedFilesChange;
4120
- state.issuesPromise = (state.issuesPromise || Promise.resolve()).catch(()=>void 0).then(()=>{
4120
+ const reuseIssuesWorkerForDependencies = !state.watching || !config.async;
4121
+ const workerResultPromise = (state.issuesPromise || Promise.resolve()).catch(()=>void 0).then(()=>{
4121
4122
  if (abortController.signal.aborted) return;
4122
4123
  debug(`Submitting the getIssuesWorker to the pool, iteration ${iteration}.`);
4123
4124
  return issuesPool.submit(async ()=>{
4124
4125
  try {
4125
4126
  debug(`Running the getIssuesWorker, iteration ${iteration}.`);
4126
- const issues = await getIssuesWorker(aggregatedFilesChange, state.watching, config.issue.defaultSeverity);
4127
+ const result = await getIssuesWorker(aggregatedFilesChange, state.watching, config.issue.defaultSeverity, reuseIssuesWorkerForDependencies);
4127
4128
  if (state.aggregatedFilesChange === aggregatedFilesChange) state.aggregatedFilesChange = void 0;
4128
4129
  if (state.abortController === abortController) state.abortController = void 0;
4129
- return issues;
4130
+ return result;
4130
4131
  } catch (error) {
4131
4132
  hooks.error.call(error, compilation);
4132
4133
  return;
@@ -4135,6 +4136,12 @@ var __webpack_exports__ = {};
4135
4136
  }
4136
4137
  }, abortController.signal);
4137
4138
  });
4139
+ state.issuesPromise = workerResultPromise.then((result)=>result?.issues);
4140
+ if (reuseIssuesWorkerForDependencies) {
4141
+ debug(`Reusing dependencies from the getIssuesWorker, iteration ${iteration}.`);
4142
+ state.dependenciesPromise = workerResultPromise.then((result)=>result?.dependencies);
4143
+ return;
4144
+ }
4138
4145
  debug(`Submitting the getDependenciesWorker to the pool, iteration ${iteration}.`);
4139
4146
  state.dependenciesPromise = dependenciesPool.submit(async ()=>{
4140
4147
  try {
@@ -1,5 +1,10 @@
1
1
  import type { FilesChange } from '../../files-change';
2
+ import type { FilesMatch } from '../../files-match';
2
3
  import type { Issue, IssueDefaultSeverity } from '../../issue';
3
- declare const getIssuesWorker: (change: FilesChange, watching: boolean, defaultSeverity: IssueDefaultSeverity) => Promise<Issue[]>;
4
+ interface GetIssuesWorkerResult {
5
+ issues: Issue[];
6
+ dependencies?: FilesMatch;
7
+ }
8
+ declare const getIssuesWorker: (change: FilesChange, watching: boolean, defaultSeverity: IssueDefaultSeverity, withDependencies?: boolean) => Promise<GetIssuesWorkerResult>;
4
9
  export type GetIssuesWorker = typeof getIssuesWorker;
5
10
  export {};
@@ -1,5 +1,12 @@
1
1
  import type { FileSystem } from './file-system';
2
+ interface MemFileSystem extends FileSystem {
3
+ /**
4
+ * Whether the in-memory layer may contain changes that should overlay files on disk.
5
+ */
6
+ hasChanges(): boolean;
7
+ }
2
8
  /**
3
9
  * It's an implementation of FileSystem interface which reads and writes to the in-memory file system.
4
10
  */
5
- export declare const memFileSystem: FileSystem;
11
+ export declare const memFileSystem: MemFileSystem;
12
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-checker-rspack-plugin",
3
- "version": "1.5.3",
3
+ "version": "1.6.0",
4
4
  "description": "Runs typescript type checker and linter on separate process.",
5
5
  "keywords": [
6
6
  "rspack",
@@ -37,14 +37,12 @@
37
37
  "@rstest/core": "^0.11.2",
38
38
  "@types/babel__code-frame": "^7.27.0",
39
39
  "@types/is-glob": "^4.0.4",
40
- "@types/mock-fs": "^4.13.4",
41
40
  "@types/node": "^24.13.3",
42
41
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
43
42
  "cross-env": "^10.1.0",
44
43
  "husky": "^9.1.7",
45
44
  "is-glob": "^4.0.3",
46
45
  "minimatch": "^10.2.5",
47
- "mock-fs": "^5.5.0",
48
46
  "prettier": "^3.9.5",
49
47
  "strip-ansi": "^7.2.0",
50
48
  "typescript": "^6.0.3"
@@ -73,9 +71,9 @@
73
71
  "lint": "rslint",
74
72
  "lint:write": "rslint --fix",
75
73
  "precommit": "pnpm build && pnpm test:unit",
76
- "test": "pnpm build && pnpm test:unit && pnpm test:e2e",
77
- "test:e2e": "cd test/e2e && pnpm test",
74
+ "test": "pnpm build && rstest",
75
+ "test:e2e": "rstest --project e2e",
78
76
  "test:e2e:setup": "cd test/e2e && pnpm run setup",
79
- "test:unit": "rstest --config=test/unit/rstest.config.ts"
77
+ "test:unit": "rstest --project unit"
80
78
  }
81
79
  }