ts-checker-rspack-plugin 1.7.1 → 1.8.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.
package/lib/index.js CHANGED
@@ -1552,6 +1552,8 @@ var __webpack_exports__ = {};
1552
1552
  }
1553
1553
  });
1554
1554
  }
1555
+ const external_node_fs_namespaceObject = require("node:fs");
1556
+ var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
1555
1557
  const external_chokidar_namespaceObject = require("chokidar");
1556
1558
  var external_chokidar_default = /*#__PURE__*/ __webpack_require__.n(external_chokidar_namespaceObject);
1557
1559
  const balanced = (a, b, str)=>{
@@ -3316,6 +3318,9 @@ var __webpack_exports__ = {};
3316
3318
  deletedFiles: Array.from(deletedFilesSet)
3317
3319
  };
3318
3320
  }
3321
+ function isContentMapperFile(file, contentMappers) {
3322
+ return contentMappers?.extensions.some((extension)=>file.endsWith(extension)) || false;
3323
+ }
3319
3324
  function isInsideAnotherPath(parent, directory) {
3320
3325
  const relativePart = (0, external_node_path_namespaceObject.relative)(parent, directory);
3321
3326
  if (relativePart.startsWith('..')) return false;
@@ -3323,234 +3328,1564 @@ var __webpack_exports__ = {};
3323
3328
  if ((0, external_node_path_namespaceObject.isAbsolute)(relativePart)) return false;
3324
3329
  return true;
3325
3330
  }
3326
- function _define_property(obj, key, value) {
3327
- if (key in obj) Object.defineProperty(obj, key, {
3328
- value: value,
3329
- enumerable: true,
3330
- configurable: true,
3331
- writable: true
3332
- });
3333
- else obj[key] = value;
3334
- return obj;
3335
- }
3336
- const BUILTIN_IGNORED_DIRS = [
3337
- '.git'
3338
- ];
3339
- function createIsIgnored(ignored, excluded) {
3340
- const ignoredPatterns = ignored ? Array.isArray(ignored) ? [
3341
- ...ignored
3342
- ] : [
3343
- ignored
3344
- ] : [];
3345
- const filteredExcluded = excluded.filter((pattern)=>{
3346
- if (is_glob_default()(pattern)) {
3347
- const shouldAppendStar = pattern.includes('**') && !pattern.endsWith('*');
3348
- if (shouldAppendStar) ignoredPatterns.push(pattern.endsWith('/') ? `${pattern}**` : `${pattern}/**`);
3349
- else ignoredPatterns.push(pattern);
3350
- return false;
3331
+ const external_node_child_process_namespaceObject = require("node:child_process");
3332
+ const external_node_url_namespaceObject = require("node:url");
3333
+ const external_node_util_namespaceObject = require("node:util");
3334
+ const external_node_module_namespaceObject = require("node:module");
3335
+ const dist_A = (r)=>null !== r && "object" == typeof r, dist_a = (r, t)=>Object.assign(new Error(`[${r}]: ${t}`), {
3336
+ code: r
3337
+ }), dist_ = "ERR_INVALID_PACKAGE_CONFIG", E = "ERR_INVALID_PACKAGE_TARGET", dist_I = "ERR_PACKAGE_PATH_NOT_EXPORTED", R = /^\d+$/, O = /^(\.{1,2}|node_modules)$/i, dist_w = /\/|\\/;
3338
+ var dist_h = ((r)=>(r.Export = "exports", r.Import = "imports", r))(dist_h || {});
3339
+ const dist_f = (r, t, e, o, c)=>{
3340
+ if (null == t) return [];
3341
+ if ("string" == typeof t) {
3342
+ const [n, ...i] = t.split(dist_w);
3343
+ if (".." === n || i.some((l)=>O.test(l))) throw dist_a(E, `Invalid "${r}" target "${t}" defined in the package config`);
3344
+ return [
3345
+ c ? t.replace(/\*/g, c) : t
3346
+ ];
3347
+ }
3348
+ if (Array.isArray(t)) return t.flatMap((n)=>dist_f(r, n, e, o, c));
3349
+ if (dist_A(t)) {
3350
+ for (const n of Object.keys(t)){
3351
+ if (R.test(n)) throw dist_a(dist_, "Cannot contain numeric property keys");
3352
+ if ("default" === n || o.includes(n)) return dist_f(r, t[n], e, o, c);
3351
3353
  }
3352
- return true;
3354
+ return [];
3355
+ }
3356
+ throw dist_a(E, `Invalid "${r}" target "${t}"`);
3357
+ }, dist_s = "*", dist_m = (r, t)=>{
3358
+ const e = r.indexOf(dist_s), o = t.indexOf(dist_s);
3359
+ return e === o ? t.length > r.length : o > e;
3360
+ };
3361
+ function dist_d(r, t) {
3362
+ if (!t.includes(dist_s) && r.hasOwnProperty(t)) return [
3363
+ t
3364
+ ];
3365
+ let e, o;
3366
+ for (const c of Object.keys(r))if (c.includes(dist_s)) {
3367
+ const [n, i, l] = c.split(dist_s);
3368
+ if (void 0 === l && t.startsWith(n) && t.endsWith(i)) {
3369
+ const g = t.slice(n.length, -i.length || void 0);
3370
+ g && (!e || dist_m(e, c)) && (e = c, o = g);
3371
+ }
3372
+ }
3373
+ return [
3374
+ e,
3375
+ o
3376
+ ];
3377
+ }
3378
+ const dist_p = (r)=>Object.keys(r).reduce((t, e)=>{
3379
+ const o = "" === e || "." !== e[0];
3380
+ if (void 0 === t || t === o) return o;
3381
+ throw dist_a(dist_, '"exports" cannot contain some keys starting with "." and some not');
3382
+ }, void 0), dist_u = /^\w+:/, dist_v = (r, t, e)=>{
3383
+ if (!r) throw new Error('"exports" is required');
3384
+ t = "" === t ? "." : `./${t}`, ("string" == typeof r || Array.isArray(r) || dist_A(r) && dist_p(r)) && (r = {
3385
+ ".": r
3353
3386
  });
3354
- const ignoredFunctions = ignoredPatterns.map((pattern)=>{
3355
- if ('string' == typeof pattern) return (path)=>minimatch(path, pattern);
3356
- else if (pattern instanceof RegExp) return (path)=>pattern.test(path);
3357
- else if ('function' == typeof pattern) return pattern;
3358
- else return ()=>false;
3387
+ const [o, c] = dist_d(r, t), n = dist_f(dist_h.Export, r[o], t, e, c);
3388
+ if (0 === n.length) throw dist_a(dist_I, "." === t ? 'No "exports" main defined' : `Package subpath '${t}' is not defined by "exports"`);
3389
+ for (const i of n)if (!i.startsWith("./") && !dist_u.test(i)) throw dist_a(E, `Invalid "exports" target "${i}" defined in the package config`);
3390
+ return n;
3391
+ };
3392
+ const external_fs_namespaceObject = require("fs");
3393
+ const external_os_namespaceObject = require("os");
3394
+ const external_path_namespaceObject = require("path");
3395
+ var xe = Object.defineProperty;
3396
+ var dist_r = (e, t)=>xe(e, "name", {
3397
+ value: t,
3398
+ configurable: !0
3359
3399
  });
3360
- ignoredFunctions.push((path)=>filteredExcluded.some((excludedPath)=>isInsideAnotherPath(excludedPath, path)));
3361
- ignoredFunctions.push((path)=>BUILTIN_IGNORED_DIRS.some((ignoredDir)=>path.includes(`/${ignoredDir}/`) || path.includes(`\\${ignoredDir}\\`)));
3362
- return function(path) {
3363
- return ignoredFunctions.some((ignoredFunction)=>ignoredFunction(path));
3364
- };
3400
+ function L(e) {
3401
+ return e.startsWith("\\\\?\\") ? e : e.replace(/\\/g, "/");
3365
3402
  }
3366
- class InclusiveNodeWatchFileSystem {
3367
- get watcher() {
3368
- return this.watchFileSystem.watcher || this.watchFileSystem.wfs?.watcher;
3403
+ dist_r(L, "slash");
3404
+ const Q = dist_r((e)=>{
3405
+ const t = external_node_fs_namespaceObject[e];
3406
+ return (l, ...n)=>{
3407
+ const s = `${e}:${n.join(":")}`;
3408
+ let i = null == l ? void 0 : l.get(s);
3409
+ return void 0 === i && (i = Reflect.apply(t, external_node_fs_namespaceObject, n), null == l || l.set(s, i)), i;
3410
+ };
3411
+ }, "cacheFs"), dist_x = Q("existsSync"), Se = Q("readFileSync"), H = Q("statSync"), Ne = Q("realpathSync"), Pe = dist_r((...[e, t])=>{
3412
+ const l = Ne(e, t);
3413
+ if ("string" != typeof l) throw new TypeError(`Unexpected resolved path type for ${l} in ${t}`);
3414
+ return l;
3415
+ }, "realpath"), dist_O = dist_r((e, t, l)=>{
3416
+ for(;;){
3417
+ const n = external_node_path_namespaceObject.posix.join(e, t);
3418
+ if (dist_x(l, n)) return n;
3419
+ const s = external_node_path_namespaceObject.dirname(e);
3420
+ if (s === e) return;
3421
+ e = s;
3369
3422
  }
3370
- constructor(watchFileSystem, compiler, pluginState){
3371
- _define_property(this, "watchFileSystem", void 0);
3372
- _define_property(this, "compiler", void 0);
3373
- _define_property(this, "pluginState", void 0);
3374
- _define_property(this, "dirsWatchers", void 0);
3375
- _define_property(this, "paused", void 0);
3376
- _define_property(this, "deletedFiles", void 0);
3377
- _define_property(this, "watch", void 0);
3378
- this.watchFileSystem = watchFileSystem;
3379
- this.compiler = compiler;
3380
- this.pluginState = pluginState;
3381
- this.paused = true;
3382
- this.watch = (files, dirs, missing, startTime, options, callback, callbackUndelayed)=>{
3383
- const { debug } = getInfrastructureLogger(this.compiler);
3384
- clearFilesChange(this.compiler);
3385
- const isIgnored = createIsIgnored(options?.ignored, this.pluginState.lastDependencies?.excluded || []);
3386
- const standardWatcher = this.watchFileSystem.watch(files, dirs, missing, startTime, options, callback, callbackUndelayed);
3387
- this.watcher?.on('change', (file)=>{
3388
- if ('string' != typeof file) return;
3389
- if (isIgnored(file)) debug("Detected file change but it's ignored", file);
3390
- else {
3391
- debug('Detected file change', file);
3392
- this.deletedFiles.delete(file);
3393
- updateFilesChange(this.compiler, {
3394
- changedFiles: [
3395
- file
3396
- ]
3397
- });
3423
+ }, "findUp"), C = /^\.{1,2}(\/.*)?$/, X = dist_r((e)=>{
3424
+ const t = L(e);
3425
+ return C.test(t) ? t : `./${t}`;
3426
+ }, "normalizeRelativePath");
3427
+ function We(e, t = !1) {
3428
+ const l = e.length;
3429
+ let n = 0, s = "", i = 0, o = 16, f = 0, u = 0, c = 0, w = 0, p = 0;
3430
+ function _(g, j) {
3431
+ let y = 0, A = 0;
3432
+ for(; y < g;){
3433
+ let k = e.charCodeAt(n);
3434
+ if (k >= 48 && k <= 57) A = 16 * A + k - 48;
3435
+ else if (k >= 65 && k <= 70) A = 16 * A + k - 65 + 10;
3436
+ else if (k >= 97 && k <= 102) A = 16 * A + k - 97 + 10;
3437
+ else break;
3438
+ n++, y++;
3439
+ }
3440
+ return y < g && (A = -1), A;
3441
+ }
3442
+ dist_r(_, "scanHexDigits");
3443
+ function h(g) {
3444
+ n = g, s = "", i = 0, o = 16, p = 0;
3445
+ }
3446
+ dist_r(h, "setPosition");
3447
+ function D() {
3448
+ let g = n;
3449
+ if (48 === e.charCodeAt(n)) n++;
3450
+ else for(n++; n < e.length && dist_R(e.charCodeAt(n));)n++;
3451
+ if (n < e.length && 46 === e.charCodeAt(n)) if (n++, !(n < e.length && dist_R(e.charCodeAt(n)))) return p = 3, e.substring(g, n);
3452
+ else for(n++; n < e.length && dist_R(e.charCodeAt(n));)n++;
3453
+ let j = n;
3454
+ if (n < e.length && (69 === e.charCodeAt(n) || 101 === e.charCodeAt(n))) if (n++, (n < e.length && 43 === e.charCodeAt(n) || 45 === e.charCodeAt(n)) && n++, n < e.length && dist_R(e.charCodeAt(n))) {
3455
+ for(n++; n < e.length && dist_R(e.charCodeAt(n));)n++;
3456
+ j = n;
3457
+ } else p = 3;
3458
+ return e.substring(g, j);
3459
+ }
3460
+ dist_r(D, "scanNumber");
3461
+ function T() {
3462
+ let g = "", j = n;
3463
+ for(;;){
3464
+ if (n >= l) {
3465
+ g += e.substring(j, n), p = 2;
3466
+ break;
3467
+ }
3468
+ const y = e.charCodeAt(n);
3469
+ if (34 === y) {
3470
+ g += e.substring(j, n), n++;
3471
+ break;
3472
+ }
3473
+ if (92 === y) {
3474
+ if (g += e.substring(j, n), n++, n >= l) {
3475
+ p = 2;
3476
+ break;
3398
3477
  }
3399
- });
3400
- this.watcher?.on('remove', (file)=>{
3401
- if ('string' != typeof file) return;
3402
- if (this.deletedFiles.has(file)) return void debug('Skipping duplicated remove event.');
3403
- if (isIgnored(file)) debug("Detected file remove but it's ignored", file);
3404
- else {
3405
- debug('Detected file remove', file);
3406
- this.deletedFiles.add(file);
3407
- updateFilesChange(this.compiler, {
3408
- deletedFiles: [
3409
- file
3410
- ]
3411
- });
3478
+ switch(e.charCodeAt(n++)){
3479
+ case 34:
3480
+ g += '"';
3481
+ break;
3482
+ case 92:
3483
+ g += "\\";
3484
+ break;
3485
+ case 47:
3486
+ g += "/";
3487
+ break;
3488
+ case 98:
3489
+ g += "\b";
3490
+ break;
3491
+ case 102:
3492
+ g += "\f";
3493
+ break;
3494
+ case 110:
3495
+ g += `
3496
+ `;
3497
+ break;
3498
+ case 114:
3499
+ g += "\r";
3500
+ break;
3501
+ case 116:
3502
+ g += " ";
3503
+ break;
3504
+ case 117:
3505
+ const k = _(4);
3506
+ k >= 0 ? g += String.fromCharCode(k) : p = 4;
3507
+ break;
3508
+ default:
3509
+ p = 5;
3412
3510
  }
3413
- });
3414
- const prevDirs = Array.from(this.dirsWatchers.keys());
3415
- const nextDirs = Array.from(this.pluginState.lastDependencies?.dirs || []);
3416
- const dirsToUnwatch = prevDirs.filter((prevDir)=>!nextDirs.includes(prevDir));
3417
- const dirsToWatch = nextDirs.filter((nextDir)=>!prevDirs.includes(nextDir) && !isIgnored(nextDir));
3418
- dirsToUnwatch.forEach((dirToUnwatch)=>{
3419
- this.dirsWatchers.get(dirToUnwatch)?.close();
3420
- this.dirsWatchers.delete(dirToUnwatch);
3421
- });
3422
- dirsToWatch.forEach((dirToWatch)=>{
3423
- const interval = 'number' == typeof options?.poll ? options.poll : void 0;
3424
- const dirWatcher = external_chokidar_default().watch(dirToWatch, {
3425
- ignoreInitial: true,
3426
- ignorePermissionErrors: true,
3427
- ignored: (path)=>isIgnored(path),
3428
- usePolling: options?.poll ? true : void 0,
3429
- ...void 0 !== interval && {
3430
- interval,
3431
- binaryInterval: interval
3432
- },
3433
- alwaysStat: true,
3434
- atomic: true,
3435
- awaitWriteFinish: true
3436
- });
3437
- dirWatcher.on('add', (file, stats)=>{
3438
- if (this.paused) return;
3439
- const extension = (0, external_node_path_namespaceObject.extname)(file);
3440
- const supportedExtensions = this.pluginState.lastDependencies?.extensions || [];
3441
- if (!supportedExtensions.includes(extension)) return void debug('Detected new file add but extension is not supported', file);
3442
- debug('Detected new file add', file);
3443
- this.deletedFiles.delete(file);
3444
- updateFilesChange(this.compiler, {
3445
- changedFiles: [
3446
- file
3447
- ]
3448
- });
3449
- this.watcher?._onChange(file, stats?.mtimeMs || stats?.ctimeMs || 1, file, 'rename');
3450
- });
3451
- dirWatcher.on('unlink', (file)=>{
3452
- if (this.paused) return;
3453
- const extension = (0, external_node_path_namespaceObject.extname)(file);
3454
- const supportedExtensions = this.pluginState.lastDependencies?.extensions || [];
3455
- if (!supportedExtensions.includes(extension)) return void debug('Detected new file remove but extension is not supported', file);
3456
- if (this.deletedFiles.has(file)) return void debug('Skipping duplicated unlink event.');
3457
- debug('Detected new file remove', file);
3458
- this.deletedFiles.add(file);
3459
- updateFilesChange(this.compiler, {
3460
- deletedFiles: [
3461
- file
3462
- ]
3463
- });
3464
- this.watcher?._onRemove(dirToWatch, file, 'rename');
3465
- });
3466
- this.dirsWatchers.set(dirToWatch, dirWatcher);
3467
- });
3468
- this.paused = false;
3469
- return {
3470
- ...standardWatcher,
3471
- close: ()=>{
3472
- clearFilesChange(this.compiler);
3473
- if (standardWatcher) standardWatcher.close();
3474
- this.dirsWatchers.forEach((dirWatcher)=>{
3475
- dirWatcher?.close();
3476
- });
3477
- this.dirsWatchers.clear();
3478
- this.paused = true;
3479
- },
3480
- pause: ()=>{
3481
- if (standardWatcher) standardWatcher.pause();
3482
- this.paused = true;
3511
+ j = n;
3512
+ continue;
3513
+ }
3514
+ if (y >= 0 && y <= 31) if (J(y)) {
3515
+ g += e.substring(j, n), p = 2;
3516
+ break;
3517
+ } else p = 6;
3518
+ n++;
3519
+ }
3520
+ return g;
3521
+ }
3522
+ dist_r(T, "scanString");
3523
+ function d() {
3524
+ if (s = "", p = 0, i = n, u = f, w = c, n >= l) return i = l, o = 17;
3525
+ let g = e.charCodeAt(n);
3526
+ if (ee(g)) {
3527
+ do n++, s += String.fromCharCode(g), g = e.charCodeAt(n);
3528
+ while (ee(g));
3529
+ return o = 15;
3530
+ }
3531
+ if (J(g)) return n++, s += String.fromCharCode(g), 13 === g && 10 === e.charCodeAt(n) && (n++, s += `
3532
+ `), f++, c = n, o = 14;
3533
+ switch(g){
3534
+ case 123:
3535
+ return n++, o = 1;
3536
+ case 125:
3537
+ return n++, o = 2;
3538
+ case 91:
3539
+ return n++, o = 3;
3540
+ case 93:
3541
+ return n++, o = 4;
3542
+ case 58:
3543
+ return n++, o = 6;
3544
+ case 44:
3545
+ return n++, o = 5;
3546
+ case 34:
3547
+ return n++, s = T(), o = 10;
3548
+ case 47:
3549
+ const j = n - 1;
3550
+ if (47 === e.charCodeAt(n + 1)) {
3551
+ for(n += 2; n < l && !J(e.charCodeAt(n));)n++;
3552
+ return s = e.substring(j, n), o = 12;
3483
3553
  }
3484
- };
3485
- };
3486
- this.dirsWatchers = new Map();
3487
- this.deletedFiles = new Set();
3554
+ if (42 === e.charCodeAt(n + 1)) {
3555
+ n += 2;
3556
+ const y = l - 1;
3557
+ let A = !1;
3558
+ for(; n < y;){
3559
+ const k = e.charCodeAt(n);
3560
+ if (42 === k && 47 === e.charCodeAt(n + 1)) {
3561
+ n += 2, A = !0;
3562
+ break;
3563
+ }
3564
+ n++, J(k) && (13 === k && 10 === e.charCodeAt(n) && n++, f++, c = n);
3565
+ }
3566
+ return A || (n++, p = 1), s = e.substring(j, n), o = 13;
3567
+ }
3568
+ return s += String.fromCharCode(g), n++, o = 16;
3569
+ case 45:
3570
+ if (s += String.fromCharCode(g), n++, n === l || !dist_R(e.charCodeAt(n))) return o = 16;
3571
+ case 48:
3572
+ case 49:
3573
+ case 50:
3574
+ case 51:
3575
+ case 52:
3576
+ case 53:
3577
+ case 54:
3578
+ case 55:
3579
+ case 56:
3580
+ case 57:
3581
+ return s += D(), o = 11;
3582
+ default:
3583
+ for(; n < l && v(g);)n++, g = e.charCodeAt(n);
3584
+ if (i !== n) {
3585
+ switch(s = e.substring(i, n)){
3586
+ case "true":
3587
+ return o = 8;
3588
+ case "false":
3589
+ return o = 9;
3590
+ case "null":
3591
+ return o = 7;
3592
+ }
3593
+ return o = 16;
3594
+ }
3595
+ return s += String.fromCharCode(g), n++, o = 16;
3596
+ }
3597
+ }
3598
+ dist_r(d, "scanNext");
3599
+ function v(g) {
3600
+ if (ee(g) || J(g)) return !1;
3601
+ switch(g){
3602
+ case 125:
3603
+ case 93:
3604
+ case 123:
3605
+ case 91:
3606
+ case 34:
3607
+ case 58:
3608
+ case 44:
3609
+ case 47:
3610
+ return !1;
3611
+ }
3612
+ return !0;
3613
+ }
3614
+ dist_r(v, "isUnknownContentCharacter");
3615
+ function $() {
3616
+ let g;
3617
+ do g = d();
3618
+ while (g >= 12 && g <= 15);
3619
+ return g;
3488
3620
  }
3621
+ return dist_r($, "scanNextNonTrivia"), {
3622
+ setPosition: h,
3623
+ getPosition: dist_r(()=>n, "getPosition"),
3624
+ scan: t ? $ : d,
3625
+ getToken: dist_r(()=>o, "getToken"),
3626
+ getTokenValue: dist_r(()=>s, "getTokenValue"),
3627
+ getTokenOffset: dist_r(()=>i, "getTokenOffset"),
3628
+ getTokenLength: dist_r(()=>n - i, "getTokenLength"),
3629
+ getTokenStartLine: dist_r(()=>u, "getTokenStartLine"),
3630
+ getTokenStartCharacter: dist_r(()=>i - w, "getTokenStartCharacter"),
3631
+ getTokenError: dist_r(()=>p, "getTokenError")
3632
+ };
3489
3633
  }
3490
- function tapAfterEnvironmentToPatchWatching(compiler, state) {
3491
- const { debug } = getInfrastructureLogger(compiler);
3492
- compiler.hooks.afterEnvironment.tap('TsCheckerRspackPlugin', ()=>{
3493
- const watchFileSystem = compiler.watchFileSystem;
3494
- if (watchFileSystem) {
3495
- debug("Overwriting Rspack's watch file system.");
3496
- compiler.watchFileSystem = new InclusiveNodeWatchFileSystem(watchFileSystem, compiler, state);
3497
- } else debug('No watch file system found - plugin may not work correctly.');
3498
- });
3634
+ dist_r(We, "createScanner");
3635
+ function ee(e) {
3636
+ return 32 === e || 9 === e;
3499
3637
  }
3500
- var external_picocolors_ = __webpack_require__("picocolors");
3501
- var external_picocolors_default = /*#__PURE__*/ __webpack_require__.n(external_picocolors_);
3502
- const lite_tapable_namespaceObject = require("@rspack/lite-tapable");
3503
- const compilerHookMap = new WeakMap();
3504
- function createPluginHooks() {
3505
- return {
3506
- start: new lite_tapable_namespaceObject.AsyncSeriesWaterfallHook([
3507
- 'change',
3508
- 'compilation'
3509
- ]),
3510
- waiting: new lite_tapable_namespaceObject.SyncHook([
3511
- 'compilation'
3512
- ]),
3513
- canceled: new lite_tapable_namespaceObject.SyncHook([
3514
- 'compilation'
3515
- ]),
3516
- error: new lite_tapable_namespaceObject.SyncHook([
3517
- 'error',
3518
- 'compilation'
3519
- ]),
3520
- issues: new lite_tapable_namespaceObject.SyncWaterfallHook([
3521
- 'issues',
3522
- 'compilation'
3523
- ])
3524
- };
3638
+ dist_r(ee, "isWhiteSpace");
3639
+ function J(e) {
3640
+ return 10 === e || 13 === e;
3525
3641
  }
3526
- function forwardPluginHooks(source, target) {
3527
- source.start.tapPromise('TsCheckerRspackPlugin', target.start.promise);
3528
- source.waiting.tap('TsCheckerRspackPlugin', target.waiting.call);
3529
- source.canceled.tap('TsCheckerRspackPlugin', target.canceled.call);
3530
- source.error.tap('TsCheckerRspackPlugin', target.error.call);
3531
- source.issues.tap('TsCheckerRspackPlugin', target.issues.call);
3642
+ dist_r(J, "isLineBreak");
3643
+ function dist_R(e) {
3644
+ return e >= 48 && e <= 57;
3532
3645
  }
3533
- function getPluginHooks(compiler) {
3534
- let hooks = compilerHookMap.get(compiler);
3535
- if (void 0 === hooks) {
3536
- hooks = createPluginHooks();
3537
- compilerHookMap.set(compiler, hooks);
3538
- if ('compilers' in compiler) compiler.compilers.forEach((childCompiler)=>{
3539
- const childHooks = getPluginHooks(childCompiler);
3540
- if (hooks) forwardPluginHooks(childHooks, hooks);
3541
- });
3646
+ dist_r(dist_R, "isDigit");
3647
+ var ge;
3648
+ (function(e) {
3649
+ e[e.lineFeed = 10] = "lineFeed", e[e.carriageReturn = 13] = "carriageReturn", e[e.space = 32] = "space", e[e._0 = 48] = "_0", e[e._1 = 49] = "_1", e[e._2 = 50] = "_2", e[e._3 = 51] = "_3", e[e._4 = 52] = "_4", e[e._5 = 53] = "_5", e[e._6 = 54] = "_6", e[e._7 = 55] = "_7", e[e._8 = 56] = "_8", e[e._9 = 57] = "_9", e[e.a = 97] = "a", e[e.b = 98] = "b", e[e.c = 99] = "c", e[e.d = 100] = "d", e[e.e = 101] = "e", e[e.f = 102] = "f", e[e.g = 103] = "g", e[e.h = 104] = "h", e[e.i = 105] = "i", e[e.j = 106] = "j", e[e.k = 107] = "k", e[e.l = 108] = "l", e[e.m = 109] = "m", e[e.n = 110] = "n", e[e.o = 111] = "o", e[e.p = 112] = "p", e[e.q = 113] = "q", e[e.r = 114] = "r", e[e.s = 115] = "s", e[e.t = 116] = "t", e[e.u = 117] = "u", e[e.v = 118] = "v", e[e.w = 119] = "w", e[e.x = 120] = "x", e[e.y = 121] = "y", e[e.z = 122] = "z", e[e.A = 65] = "A", e[e.B = 66] = "B", e[e.C = 67] = "C", e[e.D = 68] = "D", e[e.E = 69] = "E", e[e.F = 70] = "F", e[e.G = 71] = "G", e[e.H = 72] = "H", e[e.I = 73] = "I", e[e.J = 74] = "J", e[e.K = 75] = "K", e[e.L = 76] = "L", e[e.M = 77] = "M", e[e.N = 78] = "N", e[e.O = 79] = "O", e[e.P = 80] = "P", e[e.Q = 81] = "Q", e[e.R = 82] = "R", e[e.S = 83] = "S", e[e.T = 84] = "T", e[e.U = 85] = "U", e[e.V = 86] = "V", e[e.W = 87] = "W", e[e.X = 88] = "X", e[e.Y = 89] = "Y", e[e.Z = 90] = "Z", e[e.asterisk = 42] = "asterisk", e[e.backslash = 92] = "backslash", e[e.closeBrace = 125] = "closeBrace", e[e.closeBracket = 93] = "closeBracket", e[e.colon = 58] = "colon", e[e.comma = 44] = "comma", e[e.dot = 46] = "dot", e[e.doubleQuote = 34] = "doubleQuote", e[e.minus = 45] = "minus", e[e.openBrace = 123] = "openBrace", e[e.openBracket = 91] = "openBracket", e[e.plus = 43] = "plus", e[e.slash = 47] = "slash", e[e.formFeed = 12] = "formFeed", e[e.tab = 9] = "tab";
3650
+ })(ge || (ge = {})), new Array(20).fill(0).map((e, t)=>" ".repeat(t));
3651
+ const S = 200;
3652
+ new Array(S).fill(0).map((e, t)=>`
3653
+ ` + " ".repeat(t)), new Array(S).fill(0).map((e, t)=>"\r" + " ".repeat(t)), new Array(S).fill(0).map((e, t)=>`\r
3654
+ ` + " ".repeat(t)), new Array(S).fill(0).map((e, t)=>`
3655
+ ` + " ".repeat(t)), new Array(S).fill(0).map((e, t)=>"\r" + " ".repeat(t)), new Array(S).fill(0).map((e, t)=>`\r
3656
+ ` + " ".repeat(t));
3657
+ var Y;
3658
+ (function(e) {
3659
+ e.DEFAULT = {
3660
+ allowTrailingComma: !1
3661
+ };
3662
+ })(Y || (Y = {}));
3663
+ function Je(e, t = [], l = Y.DEFAULT) {
3664
+ let n = null, s = [];
3665
+ const i = [];
3666
+ function o(u) {
3667
+ Array.isArray(s) ? s.push(u) : null !== n && (s[n] = u);
3542
3668
  }
3543
- return hooks;
3669
+ return dist_r(o, "onValue"), Me(e, {
3670
+ onObjectBegin: dist_r(()=>{
3671
+ const u = {};
3672
+ o(u), i.push(s), s = u, n = null;
3673
+ }, "onObjectBegin"),
3674
+ onObjectProperty: dist_r((u)=>{
3675
+ n = u;
3676
+ }, "onObjectProperty"),
3677
+ onObjectEnd: dist_r(()=>{
3678
+ s = i.pop();
3679
+ }, "onObjectEnd"),
3680
+ onArrayBegin: dist_r(()=>{
3681
+ const u = [];
3682
+ o(u), i.push(s), s = u, n = null;
3683
+ }, "onArrayBegin"),
3684
+ onArrayEnd: dist_r(()=>{
3685
+ s = i.pop();
3686
+ }, "onArrayEnd"),
3687
+ onLiteralValue: o,
3688
+ onError: dist_r((u, c, w)=>{
3689
+ t.push({
3690
+ error: u,
3691
+ offset: c,
3692
+ length: w
3693
+ });
3694
+ }, "onError")
3695
+ }, l), s[0];
3544
3696
  }
3545
- const external_node_process_namespaceObject = require("node:process");
3546
- function createControlledPromise() {
3547
- let resolve = ()=>void 0;
3548
- let reject = ()=>void 0;
3549
- const promise = new Promise((aResolve, aReject)=>{
3550
- resolve = aResolve;
3551
- reject = aReject;
3552
- });
3553
- return {
3697
+ dist_r(Je, "parse$1");
3698
+ function Me(e, t, l = Y.DEFAULT) {
3699
+ const n = We(e, !1), s = [];
3700
+ let i = 0;
3701
+ function o(b) {
3702
+ return b ? ()=>0 === i && b(n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter()) : ()=>!0;
3703
+ }
3704
+ dist_r(o, "toNoArgVisit");
3705
+ function f(b) {
3706
+ return b ? (F)=>0 === i && b(F, n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter()) : ()=>!0;
3707
+ }
3708
+ dist_r(f, "toOneArgVisit");
3709
+ function u(b) {
3710
+ return b ? (F)=>0 === i && b(F, n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter(), ()=>s.slice()) : ()=>!0;
3711
+ }
3712
+ dist_r(u, "toOneArgVisitWithPath");
3713
+ function c(b) {
3714
+ return b ? ()=>{
3715
+ i > 0 ? i++ : !1 === b(n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter(), ()=>s.slice()) && (i = 1);
3716
+ } : ()=>!0;
3717
+ }
3718
+ dist_r(c, "toBeginVisit");
3719
+ function w(b) {
3720
+ return b ? ()=>{
3721
+ i > 0 && i--, 0 === i && b(n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter());
3722
+ } : ()=>!0;
3723
+ }
3724
+ dist_r(w, "toEndVisit");
3725
+ const p = c(t.onObjectBegin), _ = u(t.onObjectProperty), h = w(t.onObjectEnd), D = c(t.onArrayBegin), T = w(t.onArrayEnd), d = u(t.onLiteralValue), v = f(t.onSeparator), $ = o(t.onComment), g = f(t.onError), j = l && l.disallowComments, y = l && l.allowTrailingComma;
3726
+ function A() {
3727
+ for(;;){
3728
+ const b = n.scan();
3729
+ switch(n.getTokenError()){
3730
+ case 4:
3731
+ k(14);
3732
+ break;
3733
+ case 5:
3734
+ k(15);
3735
+ break;
3736
+ case 3:
3737
+ k(13);
3738
+ break;
3739
+ case 1:
3740
+ j || k(11);
3741
+ break;
3742
+ case 2:
3743
+ k(12);
3744
+ break;
3745
+ case 6:
3746
+ k(16);
3747
+ break;
3748
+ }
3749
+ switch(b){
3750
+ case 12:
3751
+ case 13:
3752
+ j ? k(10) : $();
3753
+ break;
3754
+ case 16:
3755
+ k(1);
3756
+ break;
3757
+ case 15:
3758
+ case 14:
3759
+ break;
3760
+ default:
3761
+ return b;
3762
+ }
3763
+ }
3764
+ }
3765
+ dist_r(A, "scanNext");
3766
+ function k(b, F = [], W = []) {
3767
+ if (g(b), F.length + W.length > 0) {
3768
+ let I = n.getToken();
3769
+ for(; 17 !== I;){
3770
+ if (-1 !== F.indexOf(I)) {
3771
+ A();
3772
+ break;
3773
+ } else if (-1 !== W.indexOf(I)) break;
3774
+ I = A();
3775
+ }
3776
+ }
3777
+ }
3778
+ dist_r(k, "handleError");
3779
+ function P(b) {
3780
+ const F = n.getTokenValue();
3781
+ return b ? d(F) : (_(F), s.push(F)), A(), !0;
3782
+ }
3783
+ dist_r(P, "parseString");
3784
+ function M() {
3785
+ switch(n.getToken()){
3786
+ case 11:
3787
+ const b = n.getTokenValue();
3788
+ let F = Number(b);
3789
+ isNaN(F) && (k(2), F = 0), d(F);
3790
+ break;
3791
+ case 7:
3792
+ d(null);
3793
+ break;
3794
+ case 8:
3795
+ d(!0);
3796
+ break;
3797
+ case 9:
3798
+ d(!1);
3799
+ break;
3800
+ default:
3801
+ return !1;
3802
+ }
3803
+ return A(), !0;
3804
+ }
3805
+ dist_r(M, "parseLiteral");
3806
+ function V() {
3807
+ return 10 !== n.getToken() ? (k(3, [], [
3808
+ 2,
3809
+ 5
3810
+ ]), !1) : (P(!1), 6 === n.getToken() ? (v(":"), A(), U() || k(4, [], [
3811
+ 2,
3812
+ 5
3813
+ ])) : k(5, [], [
3814
+ 2,
3815
+ 5
3816
+ ]), s.pop(), !0);
3817
+ }
3818
+ dist_r(V, "parseProperty");
3819
+ function z() {
3820
+ p(), A();
3821
+ let b = !1;
3822
+ for(; 2 !== n.getToken() && 17 !== n.getToken();){
3823
+ if (5 === n.getToken()) {
3824
+ if (b || k(4, [], []), v(","), A(), 2 === n.getToken() && y) break;
3825
+ } else b && k(6, [], []);
3826
+ V() || k(4, [], [
3827
+ 2,
3828
+ 5
3829
+ ]), b = !0;
3830
+ }
3831
+ return h(), 2 !== n.getToken() ? k(7, [
3832
+ 2
3833
+ ], []) : A(), !0;
3834
+ }
3835
+ dist_r(z, "parseObject");
3836
+ function G() {
3837
+ D(), A();
3838
+ let b = !0, F = !1;
3839
+ for(; 4 !== n.getToken() && 17 !== n.getToken();){
3840
+ if (5 === n.getToken()) {
3841
+ if (F || k(4, [], []), v(","), A(), 4 === n.getToken() && y) break;
3842
+ } else F && k(6, [], []);
3843
+ b ? (s.push(0), b = !1) : s[s.length - 1]++, U() || k(4, [], [
3844
+ 4,
3845
+ 5
3846
+ ]), F = !0;
3847
+ }
3848
+ return T(), b || s.pop(), 4 !== n.getToken() ? k(8, [
3849
+ 4
3850
+ ], []) : A(), !0;
3851
+ }
3852
+ dist_r(G, "parseArray");
3853
+ function U() {
3854
+ switch(n.getToken()){
3855
+ case 3:
3856
+ return G();
3857
+ case 1:
3858
+ return z();
3859
+ case 10:
3860
+ return P(!0);
3861
+ default:
3862
+ return M();
3863
+ }
3864
+ }
3865
+ return dist_r(U, "parseValue"), A(), 17 === n.getToken() ? l.allowEmptyContent ? !0 : (k(4, [], []), !1) : U() ? (17 !== n.getToken() && k(9, [], []), !0) : (k(4, [], []), !1);
3866
+ }
3867
+ dist_r(Me, "visit");
3868
+ var ke;
3869
+ (function(e) {
3870
+ e[e.None = 0] = "None", e[e.UnexpectedEndOfComment = 1] = "UnexpectedEndOfComment", e[e.UnexpectedEndOfString = 2] = "UnexpectedEndOfString", e[e.UnexpectedEndOfNumber = 3] = "UnexpectedEndOfNumber", e[e.InvalidUnicode = 4] = "InvalidUnicode", e[e.InvalidEscapeCharacter = 5] = "InvalidEscapeCharacter", e[e.InvalidCharacter = 6] = "InvalidCharacter";
3871
+ })(ke || (ke = {}));
3872
+ var dist_me;
3873
+ (function(e) {
3874
+ e[e.OpenBraceToken = 1] = "OpenBraceToken", e[e.CloseBraceToken = 2] = "CloseBraceToken", e[e.OpenBracketToken = 3] = "OpenBracketToken", e[e.CloseBracketToken = 4] = "CloseBracketToken", e[e.CommaToken = 5] = "CommaToken", e[e.ColonToken = 6] = "ColonToken", e[e.NullKeyword = 7] = "NullKeyword", e[e.TrueKeyword = 8] = "TrueKeyword", e[e.FalseKeyword = 9] = "FalseKeyword", e[e.StringLiteral = 10] = "StringLiteral", e[e.NumericLiteral = 11] = "NumericLiteral", e[e.LineCommentTrivia = 12] = "LineCommentTrivia", e[e.BlockCommentTrivia = 13] = "BlockCommentTrivia", e[e.LineBreakTrivia = 14] = "LineBreakTrivia", e[e.Trivia = 15] = "Trivia", e[e.Unknown = 16] = "Unknown", e[e.EOF = 17] = "EOF";
3875
+ })(dist_me || (dist_me = {}));
3876
+ const Ve = Je;
3877
+ var de;
3878
+ (function(e) {
3879
+ e[e.InvalidSymbol = 1] = "InvalidSymbol", e[e.InvalidNumberFormat = 2] = "InvalidNumberFormat", e[e.PropertyNameExpected = 3] = "PropertyNameExpected", e[e.ValueExpected = 4] = "ValueExpected", e[e.ColonExpected = 5] = "ColonExpected", e[e.CommaExpected = 6] = "CommaExpected", e[e.CloseBraceExpected = 7] = "CloseBraceExpected", e[e.CloseBracketExpected = 8] = "CloseBracketExpected", e[e.EndOfFileExpected = 9] = "EndOfFileExpected", e[e.InvalidCommentToken = 10] = "InvalidCommentToken", e[e.UnexpectedEndOfComment = 11] = "UnexpectedEndOfComment", e[e.UnexpectedEndOfString = 12] = "UnexpectedEndOfString", e[e.UnexpectedEndOfNumber = 13] = "UnexpectedEndOfNumber", e[e.InvalidUnicode = 14] = "InvalidUnicode", e[e.InvalidEscapeCharacter = 15] = "InvalidEscapeCharacter", e[e.InvalidCharacter = 16] = "InvalidCharacter";
3880
+ })(de || (de = {}));
3881
+ const we = dist_r((e, t)=>Ve(Se(t, e, "utf8")), "readJsonc"), ne = Symbol("implicitBaseUrl"), dist_E = "${configDir}", ze = dist_r(()=>{
3882
+ const { findPnpApi: e } = external_node_module_namespaceObject;
3883
+ return e && e(process.cwd());
3884
+ }, "getPnpApi"), te = dist_r((e, t, l, n)=>{
3885
+ const s = `resolveFromPackageJsonPath:${e}:${t}:${l}`;
3886
+ if (null != n && n.has(s)) return n.get(s);
3887
+ const i = we(e, n);
3888
+ if (!i) return;
3889
+ let o = t || "tsconfig.json";
3890
+ if (!l && i.exports) try {
3891
+ const [f] = dist_v(i.exports, t, [
3892
+ "require",
3893
+ "types"
3894
+ ]);
3895
+ o = f;
3896
+ } catch {
3897
+ return !1;
3898
+ }
3899
+ else !t && i.tsconfig && (o = i.tsconfig);
3900
+ return o = external_node_path_namespaceObject.join(e, "..", o), null == n || n.set(s, o), o;
3901
+ }, "resolveFromPackageJsonPath"), se = "package.json", le = "tsconfig.json", Ge = dist_r((e, t, l)=>{
3902
+ var n;
3903
+ let s = e;
3904
+ if (".." === e && (s = external_node_path_namespaceObject.join(s, le)), "." === e[0] && (s = external_node_path_namespaceObject.resolve(t, s)), external_node_path_namespaceObject.isAbsolute(s)) {
3905
+ if (dist_x(l, s)) {
3906
+ if (H(l, s).isFile()) return s;
3907
+ } else if (!s.endsWith(".json")) {
3908
+ const T = `${s}.json`;
3909
+ if (dist_x(l, T)) return T;
3910
+ }
3911
+ return;
3912
+ }
3913
+ const [i, ...o] = e.split("/"), f = "@" === i[0] ? `${i}/${o.shift()}` : i, u = o.join("/"), c = ze();
3914
+ if (c) {
3915
+ const { resolveRequest: T } = c;
3916
+ try {
3917
+ if (f === e) {
3918
+ const d = T(external_node_path_namespaceObject.join(f, se), t);
3919
+ if (d) {
3920
+ const v = te(d, u, !1, l);
3921
+ if (v && dist_x(l, v)) return v;
3922
+ }
3923
+ } else {
3924
+ let d;
3925
+ try {
3926
+ d = T(e, t, {
3927
+ extensions: [
3928
+ ".json"
3929
+ ]
3930
+ });
3931
+ } catch {
3932
+ d = T(external_node_path_namespaceObject.join(e, le), t);
3933
+ }
3934
+ if (d) return d;
3935
+ }
3936
+ } catch {}
3937
+ }
3938
+ const w = dist_O(external_node_path_namespaceObject.resolve(t), external_node_path_namespaceObject.join("node_modules", f), l);
3939
+ if (!w || !(null != (n = H(l, w)) && n.isDirectory())) return;
3940
+ const p = Pe(l, w), _ = external_node_path_namespaceObject.join(p, se);
3941
+ if (dist_x(l, _)) {
3942
+ const T = te(_, u, !1, l);
3943
+ if (!1 === T) return;
3944
+ if (T && dist_x(l, T) && H(l, T).isFile()) return T;
3945
+ }
3946
+ const h = external_node_path_namespaceObject.join(p, u), D = h.endsWith(".json");
3947
+ if (!D) {
3948
+ const T = `${h}.json`;
3949
+ if (dist_x(l, T)) return T;
3950
+ }
3951
+ if (dist_x(l, h)) {
3952
+ if (H(l, h).isDirectory()) {
3953
+ const T = external_node_path_namespaceObject.join(h, se);
3954
+ if (dist_x(l, T)) {
3955
+ const v = te(T, "", !0, l);
3956
+ if (v && dist_x(l, v)) return v;
3957
+ }
3958
+ const d = external_node_path_namespaceObject.join(h, le);
3959
+ if (dist_x(l, d)) return d;
3960
+ } else if (D) return h;
3961
+ }
3962
+ }, "resolveExtendsPath"), oe = dist_r((e, t)=>X(external_node_path_namespaceObject.relative(e, t)), "pathRelative"), pe = [
3963
+ "files",
3964
+ "include",
3965
+ "exclude"
3966
+ ], dist_N = dist_r((e, t, l)=>{
3967
+ const n = external_node_path_namespaceObject.join(t, l), s = external_node_path_namespaceObject.relative(e, n);
3968
+ return L(s) || "./";
3969
+ }, "resolveAndRelativize"), Qe = dist_r((e, t, l)=>{
3970
+ const n = external_node_path_namespaceObject.relative(e, t);
3971
+ if (!n) return l;
3972
+ const s = l.startsWith("./") ? l.slice(2) : l;
3973
+ return L(`${n}/${s}`);
3974
+ }, "prefixPattern"), He = dist_r((e, t, l, n)=>{
3975
+ const s = Ge(e, t, n);
3976
+ if (!s) throw new Error(`File '${e}' not found.`);
3977
+ if (l.has(s)) throw new Error(`Circularity detected while resolving configuration: ${s}`);
3978
+ l.add(s);
3979
+ const i = external_node_path_namespaceObject.dirname(s), o = ve(s, n, l, !0);
3980
+ delete o.references;
3981
+ const { compilerOptions: f } = o;
3982
+ if (f) {
3983
+ const { baseUrl: u } = f;
3984
+ u && !u.startsWith(dist_E) && (f.baseUrl = dist_N(t, i, u));
3985
+ const { outDir: c } = f;
3986
+ c && !c.startsWith(dist_E) && (f.outDir = dist_N(t, i, c));
3987
+ const { declarationDir: w } = f;
3988
+ w && !w.startsWith(dist_E) && (f.declarationDir = dist_N(t, i, w));
3989
+ const { rootDir: p } = f;
3990
+ p && !p.startsWith(dist_E) && (f.rootDir = dist_N(t, i, p));
3991
+ const { rootDirs: _ } = f;
3992
+ _ && (f.rootDirs = _.map((D)=>D.startsWith(dist_E) ? D : dist_N(t, i, D)));
3993
+ const { typeRoots: h } = f;
3994
+ h && (f.typeRoots = h.map((D)=>D.startsWith(dist_E) ? D : dist_N(t, i, D)));
3995
+ }
3996
+ for (const u of pe){
3997
+ const c = o[u];
3998
+ c && (o[u] = c.map((w)=>w.startsWith(dist_E) ? w : Qe(t, i, w)));
3999
+ }
4000
+ return o;
4001
+ }, "resolveExtends"), be = [
4002
+ "outDir",
4003
+ "declarationDir"
4004
+ ], ve = dist_r((e, t, l = new Set, n = !1)=>{
4005
+ let s;
4006
+ try {
4007
+ s = we(e, t) || {};
4008
+ } catch {
4009
+ throw new Error(`Cannot resolve tsconfig at path: ${e}`);
4010
+ }
4011
+ if ("object" != typeof s) throw new SyntaxError(`Failed to parse tsconfig at: ${e}`);
4012
+ const i = external_node_path_namespaceObject.dirname(e);
4013
+ if (s.compilerOptions) {
4014
+ const { compilerOptions: o } = s;
4015
+ o.paths && !o.baseUrl && (o[ne] = i);
4016
+ }
4017
+ if (s.extends) {
4018
+ const o = Array.isArray(s.extends) ? s.extends : [
4019
+ s.extends
4020
+ ];
4021
+ delete s.extends;
4022
+ for (const f of o.reverse()){
4023
+ const u = He(f, i, new Set(l), t), c = {
4024
+ ...u,
4025
+ ...s,
4026
+ compilerOptions: {
4027
+ ...u.compilerOptions,
4028
+ ...s.compilerOptions
4029
+ }
4030
+ };
4031
+ u.watchOptions && (c.watchOptions = {
4032
+ ...u.watchOptions,
4033
+ ...s.watchOptions
4034
+ }), s = c;
4035
+ }
4036
+ }
4037
+ if (s.compilerOptions) {
4038
+ const { compilerOptions: o } = s, f = [
4039
+ "baseUrl",
4040
+ "rootDir"
4041
+ ];
4042
+ for (const u of f){
4043
+ const c = o[u];
4044
+ if (c && !c.startsWith(dist_E)) {
4045
+ const w = external_node_path_namespaceObject.resolve(i, c), p = oe(i, w);
4046
+ o[u] = p;
4047
+ }
4048
+ }
4049
+ for (const u of be){
4050
+ let c = o[u];
4051
+ c && (n || Array.isArray(s.exclude) || (s.exclude = be.map((w)=>o[w]).filter(Boolean)), c.startsWith(dist_E) || (c = X(c)), o[u] = c);
4052
+ }
4053
+ } else s.compilerOptions = {};
4054
+ if (s.include && (s.include = s.include.map(L)), s.files && (s.files = s.files.map((o)=>o.startsWith(dist_E) ? o : X(o))), s.watchOptions) {
4055
+ const { watchOptions: o } = s;
4056
+ o.excludeDirectories && (o.excludeDirectories = o.excludeDirectories.map((f)=>L(external_node_path_namespaceObject.resolve(i, f)))), o.excludeFiles && (o.excludeFiles = o.excludeFiles.map((f)=>L(external_node_path_namespaceObject.resolve(i, f)))), o.watchFile && (o.watchFile = o.watchFile.toLowerCase()), o.watchDirectory && (o.watchDirectory = o.watchDirectory.toLowerCase()), o.fallbackPolling && (o.fallbackPolling = o.fallbackPolling.toLowerCase());
4057
+ }
4058
+ return s;
4059
+ }, "_parseTsconfig"), Z = dist_r((e, t)=>{
4060
+ if (e.startsWith(dist_E)) return L(external_node_path_namespaceObject.join(t, e.slice(dist_E.length)));
4061
+ }, "interpolateConfigDir"), Xe = [
4062
+ "outDir",
4063
+ "declarationDir",
4064
+ "outFile",
4065
+ "rootDir",
4066
+ "baseUrl",
4067
+ "tsBuildInfoFile"
4068
+ ], Ye = dist_r((e)=>{
4069
+ if (e.strict) {
4070
+ const a = [
4071
+ "noImplicitAny",
4072
+ "noImplicitThis",
4073
+ "strictNullChecks",
4074
+ "strictFunctionTypes",
4075
+ "strictBindCallApply",
4076
+ "strictPropertyInitialization",
4077
+ "strictBuiltinIteratorReturn",
4078
+ "alwaysStrict",
4079
+ "useUnknownInCatchVariables"
4080
+ ];
4081
+ for (const B of a)void 0 === e[B] && (e[B] = !0);
4082
+ }
4083
+ if (e.composite && (null != e.declaration || (e.declaration = !0), null != e.incremental || (e.incremental = !0)), e.target) {
4084
+ let a = e.target.toLowerCase();
4085
+ "es2015" === a && (a = "es6"), e.target = a, "esnext" === a && (null != e.module || (e.module = "es6"), null != e.useDefineForClassFields || (e.useDefineForClassFields = !0)), ("es6" === a || "es2016" === a || "es2017" === a || "es2018" === a || "es2019" === a || "es2020" === a || "es2021" === a || "es2022" === a || "es2023" === a || "es2024" === a) && (null != e.module || (e.module = "es6")), ("es2022" === a || "es2023" === a || "es2024" === a) && (null != e.useDefineForClassFields || (e.useDefineForClassFields = !0));
4086
+ }
4087
+ if (e.module) {
4088
+ let a = e.module.toLowerCase();
4089
+ if ("es2015" === a && (a = "es6"), e.module = a, ("es6" === a || "es2020" === a || "es2022" === a || "esnext" === a || "none" === a || "system" === a || "umd" === a || "amd" === a) && (null != e.moduleResolution || (e.moduleResolution = "classic")), "system" === a && (null != e.allowSyntheticDefaultImports || (e.allowSyntheticDefaultImports = !0)), ("node16" === a || "node18" === a || "node20" === a || "nodenext" === a || "preserve" === a) && (null != e.esModuleInterop || (e.esModuleInterop = !0), null != e.allowSyntheticDefaultImports || (e.allowSyntheticDefaultImports = !0)), ("node16" === a || "node18" === a || "node20" === a || "nodenext" === a) && (null != e.moduleDetection || (e.moduleDetection = "force")), "node16" === a && (null != e.target || (e.target = "es2022"), null != e.moduleResolution || (e.moduleResolution = "node16")), "node18" === a && (null != e.target || (e.target = "es2022"), null != e.moduleResolution || (e.moduleResolution = "node16")), "node20" === a && (null != e.target || (e.target = "es2023"), null != e.moduleResolution || (e.moduleResolution = "node16"), null != e.resolveJsonModule || (e.resolveJsonModule = !0)), "nodenext" === a && (null != e.target || (e.target = "esnext"), null != e.moduleResolution || (e.moduleResolution = "nodenext"), null != e.resolveJsonModule || (e.resolveJsonModule = !0)), "node16" === a || "node18" === a || "node20" === a || "nodenext" === a) {
4090
+ const B = e.target;
4091
+ ("es3" === B || "es2022" === B || "es2023" === B || "es2024" === B || "esnext" === B) && (null != e.useDefineForClassFields || (e.useDefineForClassFields = !0));
4092
+ }
4093
+ "preserve" === a && (null != e.moduleResolution || (e.moduleResolution = "bundler"));
4094
+ }
4095
+ if (e.moduleResolution) {
4096
+ let a = e.moduleResolution.toLowerCase();
4097
+ "node" === a && (a = "node10"), e.moduleResolution = a, ("node16" === a || "nodenext" === a || "bundler" === a) && (null != e.resolvePackageJsonExports || (e.resolvePackageJsonExports = !0), null != e.resolvePackageJsonImports || (e.resolvePackageJsonImports = !0)), "bundler" === a && (null != e.allowSyntheticDefaultImports || (e.allowSyntheticDefaultImports = !0), null != e.resolveJsonModule || (e.resolveJsonModule = !0));
4098
+ }
4099
+ e.jsx && (e.jsx = e.jsx.toLowerCase()), e.moduleDetection && (e.moduleDetection = e.moduleDetection.toLowerCase()), e.importsNotUsedAsValues && (e.importsNotUsedAsValues = e.importsNotUsedAsValues.toLowerCase()), e.newLine && (e.newLine = e.newLine.toLowerCase()), e.esModuleInterop && (null != e.allowSyntheticDefaultImports || (e.allowSyntheticDefaultImports = !0)), e.verbatimModuleSyntax && (null != e.isolatedModules || (e.isolatedModules = !0), null != e.preserveConstEnums || (e.preserveConstEnums = !0)), e.isolatedModules && (null != e.preserveConstEnums || (e.preserveConstEnums = !0)), e.rewriteRelativeImportExtensions && (null != e.allowImportingTsExtensions || (e.allowImportingTsExtensions = !0)), e.lib && (e.lib = e.lib.map((a)=>a.toLowerCase())), e.checkJs && (null != e.allowJs || (e.allowJs = !0));
4100
+ }, "normalizeCompilerOptions"), ie = dist_r((e, t = new Map)=>{
4101
+ const l = external_node_path_namespaceObject.resolve(e), n = ve(l, t), s = external_node_path_namespaceObject.dirname(l), { compilerOptions: i } = n;
4102
+ if (i) {
4103
+ for (const f of Xe){
4104
+ const u = i[f];
4105
+ if (u) {
4106
+ const c = Z(u, s);
4107
+ i[f] = c ? oe(s, c) : u;
4108
+ }
4109
+ }
4110
+ for (const f of [
4111
+ "rootDirs",
4112
+ "typeRoots"
4113
+ ]){
4114
+ const u = i[f];
4115
+ u && (i[f] = u.map((c)=>{
4116
+ const w = Z(c, s);
4117
+ return w ? oe(s, w) : X(c);
4118
+ }));
4119
+ }
4120
+ const { paths: o } = i;
4121
+ if (o) for (const f of Object.keys(o))o[f] = o[f].map((u)=>{
4122
+ var c;
4123
+ return null != (c = Z(u, s)) ? c : u;
4124
+ });
4125
+ Ye(i);
4126
+ }
4127
+ for (const o of pe){
4128
+ const f = n[o];
4129
+ f && (n[o] = f.map((u)=>{
4130
+ var c;
4131
+ return null != (c = Z(u, s)) ? c : u;
4132
+ }));
4133
+ }
4134
+ return n;
4135
+ }, "parseTsconfig");
4136
+ var Ze = Object.defineProperty, q = dist_r((e, t)=>Ze(e, "name", {
4137
+ value: t,
4138
+ configurable: !0
4139
+ }), "s");
4140
+ const Te = q((e)=>{
4141
+ let t = "";
4142
+ for(let l = 0; l < e.length; l += 1){
4143
+ const n = e[l], s = n.toUpperCase();
4144
+ t += n === s ? n.toLowerCase() : s;
4145
+ }
4146
+ return t;
4147
+ }, "invertCase"), dist_re = new Map, Ae = q((e, t)=>{
4148
+ const l = external_path_namespaceObject.join(e, `.is-fs-case-sensitive-test-${process.pid}`);
4149
+ try {
4150
+ return t.writeFileSync(l, ""), !t.existsSync(Te(l));
4151
+ } finally{
4152
+ try {
4153
+ t.unlinkSync(l);
4154
+ } catch {}
4155
+ }
4156
+ }, "checkDirectoryCaseWithWrite"), qe = q((e, t, l)=>{
4157
+ try {
4158
+ return Ae(e, l);
4159
+ } catch (n) {
4160
+ if (void 0 === t) return Ae(external_os_namespaceObject.tmpdir(), l);
4161
+ throw n;
4162
+ }
4163
+ }, "checkDirectoryCaseWithFallback"), Ke = q((e, t = external_fs_namespaceObject, l = !0)=>{
4164
+ const n = null != e ? e : process.cwd();
4165
+ if (l && dist_re.has(n)) return dist_re.get(n);
4166
+ let s;
4167
+ const i = Te(n);
4168
+ return i !== n && t.existsSync(n) ? s = !t.existsSync(i) : s = qe(n, e, t), l && dist_re.set(n, s), s;
4169
+ }, "isFsCaseSensitive"), { join: Oe } = external_node_path_namespaceObject.posix, _e = dist_r((e, t)=>{
4170
+ const l = Oe(e, t);
4171
+ return e.startsWith("//") && !l.startsWith("//") ? `/${l}` : l;
4172
+ }, "pathJoin"), ue = {
4173
+ ts: [
4174
+ ".ts",
4175
+ ".tsx",
4176
+ ".d.ts"
4177
+ ],
4178
+ cts: [
4179
+ ".cts",
4180
+ ".d.cts"
4181
+ ],
4182
+ mts: [
4183
+ ".mts",
4184
+ ".d.mts"
4185
+ ]
4186
+ }, Ce = dist_r((e)=>{
4187
+ const t = [
4188
+ ...ue.ts
4189
+ ], l = [
4190
+ ...ue.cts
4191
+ ], n = [
4192
+ ...ue.mts
4193
+ ];
4194
+ return null != e && e.allowJs && (t.push(".js", ".jsx"), l.push(".cjs"), n.push(".mjs")), [
4195
+ ...t,
4196
+ ...l,
4197
+ ...n
4198
+ ];
4199
+ }, "getSupportedExtensions"), en = dist_r((e)=>{
4200
+ const t = [];
4201
+ if (!e) return t;
4202
+ const { outDir: l, declarationDir: n } = e;
4203
+ return l && t.push(l), n && t.push(n), t;
4204
+ }, "getDefaultExcludeSpec"), ye = dist_r((e)=>e.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`), "escapeForRegexp"), nn = [
4205
+ "node_modules",
4206
+ "bower_components",
4207
+ "jspm_packages"
4208
+ ], fe = `(?!(${nn.join("|")})(/|$))`, tn = /(?:^|\/)[^.*?]+$/, je = "**/*", K = "[^/]", ae = "[^./]", Fe = "win32" === process.platform, De = dist_r(({ config: e, path: t }, l = Ke())=>{
4209
+ if ("extends" in e) throw new Error("tsconfig#extends must be resolved. Use getTsconfig or parseTsconfig to resolve it.");
4210
+ if (!external_node_path_namespaceObject.isAbsolute(t)) throw new Error("The tsconfig path must be absolute");
4211
+ Fe && (t = L(t));
4212
+ const n = external_node_path_namespaceObject.dirname(t), { files: s, include: i, exclude: o, compilerOptions: f } = e, u = dist_r((d)=>external_node_path_namespaceObject.isAbsolute(d) ? d : _e(n, d), "resolvePattern"), c = null == s ? void 0 : s.map(u), w = Ce(f), p = l ? "" : "i", h = (o || en(f)).map((d)=>{
4213
+ const v = u(d), $ = ye(v).replaceAll(String.raw`\*\*/`, "(.+/)?").replaceAll(String.raw`\*`, `${K}*`).replaceAll(String.raw`\?`, K);
4214
+ return new RegExp(`^${$}($|/)`, p);
4215
+ }), D = s || i ? i : [
4216
+ je
4217
+ ], T = D ? D.map((d)=>{
4218
+ let v = u(d);
4219
+ tn.test(v) && (v = _e(v, je));
4220
+ const $ = ye(v).replaceAll(String.raw`/\*\*`, `(/${fe}${ae}${K}*)*?`).replaceAll(/(\/)?\\\*/g, (g, j)=>{
4221
+ const y = `(${ae}|(\\.(?!min\\.js$))?)*`;
4222
+ return j ? `/${fe}${ae}${y}` : y;
4223
+ }).replaceAll(/(\/)?\\\?/g, (g, j)=>{
4224
+ const y = K;
4225
+ return j ? `/${fe}${y}` : y;
4226
+ });
4227
+ return new RegExp(`^${$}$`, p);
4228
+ }) : void 0;
4229
+ return (d)=>{
4230
+ if (!external_node_path_namespaceObject.isAbsolute(d)) throw new Error("filePath must be absolute");
4231
+ if (Fe && (d = L(d)), null != c && c.includes(d)) return e;
4232
+ if (!(!w.some((v)=>d.endsWith(v)) || h.some((v)=>v.test(d))) && T && T.some((v)=>v.test(d))) return e;
4233
+ };
4234
+ }, "createFilesMatcher"), he = dist_r((e, t, l)=>{
4235
+ const n = external_node_path_namespaceObject.resolve(e);
4236
+ let s = L(e);
4237
+ for(;;){
4238
+ const i = dist_O(s, t, l);
4239
+ if (!i) return;
4240
+ const o = external_node_path_namespaceObject.resolve(i), f = ie(o, l), u = {
4241
+ path: L(o),
4242
+ config: f
4243
+ };
4244
+ if (De(u)(n)) return u;
4245
+ const w = external_node_path_namespaceObject.dirname(i), p = external_node_path_namespaceObject.dirname(w);
4246
+ if (p === w) return;
4247
+ s = p;
4248
+ }
4249
+ }, "findConfigApplicable"), Le = dist_r((e = process.cwd(), t = "tsconfig.json", l = new Map, n = !1)=>{
4250
+ var s;
4251
+ return n ? null == (s = he(e, t, l)) ? void 0 : s.path : dist_O(L(e), t, l);
4252
+ }, "findTsconfig"), ln = (dist_r((e = process.cwd(), t = "tsconfig.json", l = new Map, n = !1)=>{
4253
+ var s;
4254
+ if (!n) {
4255
+ const i = Le(e, t, l);
4256
+ if (!i) return null;
4257
+ const o = ie(i, l);
4258
+ return {
4259
+ path: i,
4260
+ config: o
4261
+ };
4262
+ }
4263
+ return null != (s = he(e, t, l)) ? s : null;
4264
+ }, "getTsconfig"), /\*/g), Ee = dist_r((e, t)=>{
4265
+ const l = e.match(ln);
4266
+ if (l && l.length > 1) throw new Error(t);
4267
+ }, "assertStarCount"), on = dist_r((e)=>{
4268
+ if (e.includes("*")) {
4269
+ const [t, l] = e.split("*");
4270
+ return {
4271
+ prefix: t,
4272
+ suffix: l
4273
+ };
4274
+ }
4275
+ return e;
4276
+ }, "parsePattern"), rn = dist_r(({ prefix: e, suffix: t }, l)=>l.startsWith(e) && l.endsWith(t), "isPatternMatch"), un = dist_r((e, t, l)=>Object.entries(e).map(([n, s])=>(Ee(n, `Pattern '${n}' can have at most one '*' character.`), {
4277
+ pattern: on(n),
4278
+ substitutions: s.map((i)=>{
4279
+ if (Ee(i, `Substitution '${i}' in pattern '${n}' can have at most one '*' character.`), !t && !C.test(i) && !external_node_path_namespaceObject.isAbsolute(i)) throw new Error("Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'?");
4280
+ return external_node_path_namespaceObject.resolve(l, i);
4281
+ })
4282
+ })), "parsePaths");
4283
+ dist_r((e)=>{
4284
+ const { compilerOptions: t } = e.config;
4285
+ if (!t) return null;
4286
+ const { baseUrl: l, paths: n } = t;
4287
+ if (!l && !n) return null;
4288
+ const s = ne in t && t[ne], i = external_node_path_namespaceObject.resolve(external_node_path_namespaceObject.dirname(e.path), l || s || "."), o = n ? un(n, l, i) : [];
4289
+ return (f)=>{
4290
+ if (C.test(f)) return [];
4291
+ const u = [];
4292
+ for (const _ of o){
4293
+ if (_.pattern === f) return _.substitutions.map(L);
4294
+ "string" != typeof _.pattern && u.push(_);
4295
+ }
4296
+ let c, w = -1;
4297
+ for (const _ of u)rn(_.pattern, f) && _.pattern.prefix.length > w && (w = _.pattern.prefix.length, c = _);
4298
+ if (!c) return l ? [
4299
+ L(external_node_path_namespaceObject.join(i, f))
4300
+ ] : [];
4301
+ const p = f.slice(c.pattern.prefix.length, f.length - c.pattern.suffix.length);
4302
+ return c.substitutions.map((_)=>L(_.replace("*", p)));
4303
+ };
4304
+ }, "createPathsMatcher");
4305
+ class AbortError extends Error {
4306
+ static throwIfAborted(signal) {
4307
+ if (signal?.aborted) throw new AbortError();
4308
+ }
4309
+ constructor(message = 'Task aborted.'){
4310
+ super(message);
4311
+ this.name = 'AbortError';
4312
+ }
4313
+ }
4314
+ const TYPESCRIPT_PACKAGE = "typescript";
4315
+ const TYPESCRIPT_PACKAGE_JSON = `${TYPESCRIPT_PACKAGE}/package.json`;
4316
+ const TYPESCRIPT_PREVIEW_PACKAGE = "@typescript/native-preview";
4317
+ const TYPESCRIPT_PREVIEW_PACKAGE_JSON = `${TYPESCRIPT_PREVIEW_PACKAGE}/package.json`;
4318
+ function readTsgoPackageJson(packageJsonPath) {
4319
+ return require(packageJsonPath);
4320
+ }
4321
+ function getTsgoPackage(packageJson) {
4322
+ if (packageJson.name === TYPESCRIPT_PACKAGE) {
4323
+ const versionMatch = packageJson.version?.match(/^(\d+)\.(\d+)(?:\.|$|-)/);
4324
+ if (versionMatch && Number(versionMatch[1]) >= 7) return "typescript";
4325
+ }
4326
+ if (packageJson.name === TYPESCRIPT_PREVIEW_PACKAGE) return 'preview';
4327
+ }
4328
+ function resolveTypeScriptGoPackage(packageJsonPath) {
4329
+ if (!external_node_path_default().isAbsolute(packageJsonPath) || 'package.json' !== external_node_path_default().basename(packageJsonPath)) return;
4330
+ try {
4331
+ const tsgoPackage = getTsgoPackage(readTsgoPackageJson(packageJsonPath));
4332
+ return tsgoPackage ? {
4333
+ packageJsonPath,
4334
+ tsgoPackage
4335
+ } : void 0;
4336
+ } catch {
4337
+ return;
4338
+ }
4339
+ }
4340
+ function supportsContentMappers(config) {
4341
+ const [major = 0, minor = 0] = (readTsgoPackageJson(config.typescriptPath).version || '').split('.').map(Number);
4342
+ return major > 7 || 7 === major && minor >= 1;
4343
+ }
4344
+ function resolveTypeScriptGoPackageJsonPath(config) {
4345
+ if (!external_node_path_default().isAbsolute(config.typescriptPath) || 'package.json' !== external_node_path_default().basename(config.typescriptPath)) throw new Error("The typescriptPath option must be an absolute path to a package.json file when tsgo is enabled.");
4346
+ if (!config.tsgoPackage) throw new Error(`The typescriptPath option must point to "${TYPESCRIPT_PREVIEW_PACKAGE_JSON}" or "${TYPESCRIPT_PACKAGE}@>=7".`);
4347
+ return config.typescriptPath;
4348
+ }
4349
+ async function resolveTypeScriptGoNativeExecutablePath(packageJsonPath, packageName) {
4350
+ const getExePathPath = external_node_path_default().resolve(external_node_path_default().dirname(packageJsonPath), './lib/getExePath.js');
4351
+ const getExePathUrl = (0, external_node_url_namespaceObject.pathToFileURL)(getExePathPath).href;
4352
+ const getExePathModule = await import(getExePathUrl);
4353
+ const getExePath = getExePathModule.default || getExePathModule.getExePath;
4354
+ if ('function' != typeof getExePath) throw new Error(`Cannot resolve the native TypeScript executable from "${packageName}".`);
4355
+ const executablePath = getExePath();
4356
+ if ('string' != typeof executablePath || !external_node_fs_default().existsSync(executablePath)) throw new Error('Executable not found');
4357
+ return executablePath;
4358
+ }
4359
+ async function resolveTypeScriptGoBinPath(config) {
4360
+ const packageJsonPath = resolveTypeScriptGoPackageJsonPath(config);
4361
+ if ("typescript" === config.tsgoPackage) return resolveTypeScriptGoNativeExecutablePath(packageJsonPath, TYPESCRIPT_PACKAGE);
4362
+ return resolveTypeScriptGoNativeExecutablePath(packageJsonPath, TYPESCRIPT_PREVIEW_PACKAGE);
4363
+ }
4364
+ async function resolveTypeScriptGoExecutable(config) {
4365
+ const binPath = await resolveTypeScriptGoBinPath(config);
4366
+ return {
4367
+ command: binPath,
4368
+ args: []
4369
+ };
4370
+ }
4371
+ async function runTypeScriptGoShowConfig(executable, configFile) {
4372
+ const { stdout } = await (0, external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.execFile)(executable.command, [
4373
+ ...executable.args,
4374
+ '--project',
4375
+ configFile,
4376
+ '--showConfig',
4377
+ '--pretty',
4378
+ 'false'
4379
+ ], {
4380
+ cwd: external_node_path_default().dirname(configFile),
4381
+ encoding: 'utf8',
4382
+ maxBuffer: 67108864
4383
+ });
4384
+ const parsedConfig = JSON.parse(stdout);
4385
+ if (!parsedConfig || 'object' != typeof parsedConfig || Array.isArray(parsedConfig)) throw new TypeError('Invalid tsgo --showConfig output.');
4386
+ return parsedConfig;
4387
+ }
4388
+ function toComparisonPath(file) {
4389
+ const normalizedPath = external_node_path_default().normalize(file);
4390
+ return 'win32' === process.platform ? normalizedPath.toLowerCase() : normalizedPath;
4391
+ }
4392
+ function shouldRefreshTypeScriptGoDependencies(dependencies, { changedFiles = [], deletedFiles = [] }) {
4393
+ if (!dependencies) return true;
4394
+ const dependencyKeys = dependencies.files.map((file)=>toComparisonPath(file));
4395
+ return changedFiles.some((file)=>{
4396
+ const key = toComparisonPath(file);
4397
+ const extension = external_node_path_default().extname(file).toLowerCase();
4398
+ return '.json' === extension || dependencies.extensions.includes(extension) && !dependencyKeys.includes(key);
4399
+ }) || deletedFiles.some((file)=>dependencyKeys.includes(toComparisonPath(file)));
4400
+ }
4401
+ function createTypeScriptGoArgs(config) {
4402
+ const args = config.build ? [
4403
+ '--build',
4404
+ config.configFile
4405
+ ] : [
4406
+ '--project',
4407
+ config.configFile
4408
+ ];
4409
+ if (config.build && 'write-references' === config.mode) args.push('--noEmit', 'false');
4410
+ else args.push('--noEmit');
4411
+ args.push('--pretty');
4412
+ return args;
4413
+ }
4414
+ function logOutput(logger, output) {
4415
+ if (!output.trim()) return;
4416
+ logger.error(output.trimEnd());
4417
+ }
4418
+ function stripAnsi(output) {
4419
+ return output.replace(/\u001b\[[0-?]*[ -/]*[@-~]/g, '');
4420
+ }
4421
+ function getTypeScriptGoErrorCount(output) {
4422
+ const plainOutput = stripAnsi(output);
4423
+ const matches = Array.from(plainOutput.matchAll(/\bFound\s+(\d+)\s+errors?\b/g));
4424
+ const lastMatch = matches[matches.length - 1];
4425
+ if (!lastMatch) return;
4426
+ return Number(lastMatch[1]);
4427
+ }
4428
+ function getTypeScriptGoIssueSeverity(severity, defaultSeverity) {
4429
+ return 'auto' === defaultSeverity ? severity : defaultSeverity;
4430
+ }
4431
+ function createTypeScriptGoIssue(message) {
4432
+ return {
4433
+ severity: 'error',
4434
+ code: "TSGO",
4435
+ message
4436
+ };
4437
+ }
4438
+ function getTypeScriptGoDiagnosticMessage(code, message, config) {
4439
+ if ('6310' === code && config.build && ('readonly' === config.mode || 'write-tsbuildinfo' === config.mode)) return [
4440
+ message,
4441
+ "In build mode, set `typescript.mode` to `write-references` to write the required outputs to disk, or build the project graph separately first."
4442
+ ].join(' ');
4443
+ return message;
4444
+ }
4445
+ const diagnosticPattern = /^(.*?):(\d+):(\d+)\s+-\s+(error|warning)\s+TS(\d+):\s+(.+)$/;
4446
+ const globalDiagnosticPattern = /^(error|warning)\s+TS(\d+):\s+(.+)$/;
4447
+ function getTypeScriptGoMarkerLength(output, startIndex) {
4448
+ const lines = output.slice(startIndex).split(/\r?\n/);
4449
+ for (const line of lines){
4450
+ if (diagnosticPattern.test(line) || globalDiagnosticPattern.test(line) || /^Found\s+\d+\s+errors?\b/.test(line)) break;
4451
+ const marker = line.match(/^\s*([~^]+)\s*$/);
4452
+ if (marker) return marker[1].length;
4453
+ }
4454
+ }
4455
+ function parseTypeScriptGoIssues(output, config, defaultSeverity = 'auto') {
4456
+ const issues = [];
4457
+ const plainOutput = stripAnsi(output);
4458
+ const diagnosticPatternWithGlobal = new RegExp(diagnosticPattern, 'gm');
4459
+ const globalDiagnosticPatternWithGlobal = new RegExp(globalDiagnosticPattern, 'gm');
4460
+ for (const match of plainOutput.matchAll(diagnosticPatternWithGlobal)){
4461
+ const [, file, line, column, severity, code, message] = match;
4462
+ const startColumn = Number(column);
4463
+ const markerLength = getTypeScriptGoMarkerLength(plainOutput, (match.index || 0) + match[0].length);
4464
+ const position = {
4465
+ line: Number(line),
4466
+ column: startColumn
4467
+ };
4468
+ issues.push({
4469
+ severity: getTypeScriptGoIssueSeverity(severity, defaultSeverity),
4470
+ code: `TS${code}`,
4471
+ message: getTypeScriptGoDiagnosticMessage(code, message, config),
4472
+ file: external_node_path_default().isAbsolute(file) ? file : external_node_path_default().resolve(config.context, file),
4473
+ location: {
4474
+ start: position,
4475
+ end: {
4476
+ line: position.line,
4477
+ column: markerLength ? startColumn + markerLength : startColumn
4478
+ }
4479
+ }
4480
+ });
4481
+ }
4482
+ for (const match of plainOutput.matchAll(globalDiagnosticPatternWithGlobal)){
4483
+ const [, severity, code, message] = match;
4484
+ issues.push({
4485
+ severity: getTypeScriptGoIssueSeverity(severity, defaultSeverity),
4486
+ code: `TS${code}`,
4487
+ message: getTypeScriptGoDiagnosticMessage(code, message, config)
4488
+ });
4489
+ }
4490
+ return issues;
4491
+ }
4492
+ function createTypeScriptGoExitIssues(output, signal, config, defaultSeverity = 'auto') {
4493
+ const parsedIssues = parseTypeScriptGoIssues(output, config, defaultSeverity);
4494
+ const errorCount = getTypeScriptGoErrorCount(output);
4495
+ if (parsedIssues.length && (void 0 === errorCount || parsedIssues.length >= errorCount)) return parsedIssues;
4496
+ if (void 0 !== errorCount) return Array.from({
4497
+ length: Math.max(errorCount, 1)
4498
+ }, ()=>createTypeScriptGoIssue('tsgo check failed. See the output above for diagnostics.'));
4499
+ if (null !== signal) return [
4500
+ createTypeScriptGoIssue(`tsgo check interrupted by ${signal}. See the output above for diagnostics.`)
4501
+ ];
4502
+ return [
4503
+ createTypeScriptGoIssue('tsgo check failed. See the output above for diagnostics.')
4504
+ ];
4505
+ }
4506
+ function isTypeScriptGoIssue(issue) {
4507
+ return "TSGO" === issue.code;
4508
+ }
4509
+ function isTypeScriptGoStatsError(error) {
4510
+ const issue = error?.issue;
4511
+ if (issue && isTypeScriptGoIssue(issue)) return true;
4512
+ const message = error?.message;
4513
+ return 'string' == typeof message && message.includes("TSGO:");
4514
+ }
4515
+ async function runTypeScriptGo(config, logger, defaultSeverity = 'auto', signal, emittedFiles, dependencies) {
4516
+ AbortError.throwIfAborted(signal);
4517
+ const executable = await resolveTypeScriptGoExecutable(config);
4518
+ const args = createTypeScriptGoArgs(config);
4519
+ if (supportsContentMappers(config)) {
4520
+ const resolvedDependencies = await dependencies || await getTypeScriptGoDependencies(config);
4521
+ if (resolvedDependencies.contentMappers) args.push('--runExternalCode');
4522
+ }
4523
+ if (emittedFiles) args.push('--listEmittedFiles');
4524
+ AbortError.throwIfAborted(signal);
4525
+ return new Promise((resolve, reject)=>{
4526
+ let settled = false;
4527
+ let output = '';
4528
+ const childProcess = (0, external_node_child_process_namespaceObject.spawn)(executable.command, [
4529
+ ...executable.args,
4530
+ ...args
4531
+ ], {
4532
+ cwd: config.context,
4533
+ stdio: [
4534
+ 'inherit',
4535
+ 'pipe',
4536
+ 'pipe'
4537
+ ]
4538
+ });
4539
+ const cleanup = ()=>{
4540
+ signal?.removeEventListener('abort', abort);
4541
+ childProcess.stdout?.removeAllListeners();
4542
+ childProcess.stderr?.removeAllListeners();
4543
+ childProcess.removeAllListeners();
4544
+ };
4545
+ const finish = (callback)=>{
4546
+ if (settled) return;
4547
+ settled = true;
4548
+ cleanup();
4549
+ callback();
4550
+ };
4551
+ const abort = ()=>{
4552
+ childProcess.kill('SIGKILL');
4553
+ };
4554
+ signal?.addEventListener('abort', abort, {
4555
+ once: true
4556
+ });
4557
+ childProcess.stdout?.on('data', (data)=>{
4558
+ output += data.toString();
4559
+ });
4560
+ childProcess.stderr?.on('data', (data)=>{
4561
+ output += data.toString();
4562
+ });
4563
+ childProcess.on('error', (error)=>{
4564
+ finish(()=>reject(error));
4565
+ });
4566
+ childProcess.on('close', (exitCode, exitSignal)=>{
4567
+ output = output.replace(/^TSFILE: (.+?)\r?$/gm, (_, file)=>{
4568
+ try {
4569
+ emittedFiles?.set(toComparisonPath(file), external_node_fs_default().statSync(file).mtimeMs);
4570
+ } catch {}
4571
+ return '';
4572
+ });
4573
+ finish(()=>{
4574
+ if (signal?.aborted) return void reject(new AbortError());
4575
+ if (0 === exitCode && null === exitSignal) {
4576
+ logOutput(logger, output);
4577
+ resolve([]);
4578
+ return;
4579
+ }
4580
+ const issues = createTypeScriptGoExitIssues(output, exitSignal, config, defaultSeverity);
4581
+ if (issues.some(isTypeScriptGoIssue)) logOutput(logger, output);
4582
+ resolve(issues);
4583
+ });
4584
+ });
4585
+ });
4586
+ }
4587
+ async function getTypeScriptGoDependencies(config) {
4588
+ const executable = await resolveTypeScriptGoExecutable(config);
4589
+ const files = new Set();
4590
+ const dirs = new Set();
4591
+ const excluded = new Set();
4592
+ const visitedConfigs = new Set();
4593
+ const canRunContentMappers = supportsContentMappers(config);
4594
+ let contentMappers;
4595
+ const collectConfigDependencies = async (configFile, fallbackRoot, collectExcluded)=>{
4596
+ const normalizedConfigFile = external_node_path_default().normalize(configFile);
4597
+ const configKey = toComparisonPath(normalizedConfigFile);
4598
+ if (visitedConfigs.has(configKey)) return;
4599
+ visitedConfigs.add(configKey);
4600
+ const configDir = external_node_path_default().dirname(normalizedConfigFile);
4601
+ const normalizedRoot = external_node_path_default().normalize(fallbackRoot);
4602
+ files.add(normalizedConfigFile);
4603
+ if (!Array.from(dirs).some((dir)=>'' === external_node_path_default().relative(dir, normalizedRoot) || isInsideAnotherPath(dir, normalizedRoot))) dirs.add(normalizedRoot);
4604
+ excluded.add(external_node_path_default().join(normalizedRoot, 'node_modules'));
4605
+ if (canRunContentMappers) try {
4606
+ const resolvedConfig = ie(normalizedConfigFile);
4607
+ const mappers = 'contentMappers' in resolvedConfig ? resolvedConfig.contentMappers : void 0;
4608
+ if (Array.isArray(mappers) && mappers.length) {
4609
+ contentMappers ||= {
4610
+ extensions: []
4611
+ };
4612
+ for (const mapper of mappers)if (Array.isArray(mapper?.extensions)) {
4613
+ for (const extension of mapper.extensions)if ('string' == typeof extension && extension.length > 0 && !contentMappers.extensions.includes(extension)) contentMappers.extensions.push(extension);
4614
+ }
4615
+ }
4616
+ } catch {}
4617
+ let parsedConfig;
4618
+ try {
4619
+ parsedConfig = await runTypeScriptGoShowConfig(executable, normalizedConfigFile);
4620
+ } catch {
4621
+ return;
4622
+ }
4623
+ for (const file of parsedConfig.files || [])files.add(external_node_path_default().normalize(external_node_path_default().resolve(configDir, file)));
4624
+ if (collectExcluded && !parsedConfig.references?.length) for (const exclude of parsedConfig.exclude || [])excluded.add(external_node_path_default().normalize(external_node_path_default().resolve(configDir, exclude)));
4625
+ for (const reference of parsedConfig.references || [])if (reference.path) {
4626
+ const resolvedReference = external_node_path_default().resolve(configDir, reference.path);
4627
+ const referenceConfig = '.json' === external_node_path_default().extname(resolvedReference).toLowerCase() ? resolvedReference : external_node_path_default().join(resolvedReference, 'tsconfig.json');
4628
+ await collectConfigDependencies(referenceConfig, external_node_path_default().dirname(referenceConfig), false);
4629
+ }
4630
+ };
4631
+ await collectConfigDependencies(config.configFile, config.context, true);
4632
+ return {
4633
+ files: Array.from(files),
4634
+ dirs: Array.from(dirs),
4635
+ excluded: Array.from(excluded),
4636
+ extensions: [
4637
+ '.ts',
4638
+ '.tsx',
4639
+ '.mts',
4640
+ '.cts',
4641
+ '.js',
4642
+ '.jsx',
4643
+ '.mjs',
4644
+ '.cjs',
4645
+ '.json'
4646
+ ],
4647
+ ...contentMappers ? {
4648
+ contentMappers
4649
+ } : {}
4650
+ };
4651
+ }
4652
+ function _define_property(obj, key, value) {
4653
+ if (key in obj) Object.defineProperty(obj, key, {
4654
+ value: value,
4655
+ enumerable: true,
4656
+ configurable: true,
4657
+ writable: true
4658
+ });
4659
+ else obj[key] = value;
4660
+ return obj;
4661
+ }
4662
+ const BUILTIN_IGNORED_DIRS = [
4663
+ '.git'
4664
+ ];
4665
+ function createIsIgnored(ignored, excluded) {
4666
+ const ignoredPatterns = ignored ? Array.isArray(ignored) ? [
4667
+ ...ignored
4668
+ ] : [
4669
+ ignored
4670
+ ] : [];
4671
+ const filteredExcluded = excluded.filter((pattern)=>{
4672
+ if (is_glob_default()(pattern)) {
4673
+ const shouldAppendStar = pattern.includes('**') && !pattern.endsWith('*');
4674
+ if (shouldAppendStar) ignoredPatterns.push(pattern.endsWith('/') ? `${pattern}**` : `${pattern}/**`);
4675
+ else ignoredPatterns.push(pattern);
4676
+ return false;
4677
+ }
4678
+ return true;
4679
+ });
4680
+ const ignoredFunctions = ignoredPatterns.map((pattern)=>{
4681
+ if ('string' == typeof pattern) return (path)=>minimatch(path, pattern);
4682
+ else if (pattern instanceof RegExp) return (path)=>pattern.test(path);
4683
+ else if ('function' == typeof pattern) return pattern;
4684
+ else return ()=>false;
4685
+ });
4686
+ ignoredFunctions.push((path)=>filteredExcluded.some((excludedPath)=>isInsideAnotherPath(excludedPath, path)));
4687
+ ignoredFunctions.push((path)=>BUILTIN_IGNORED_DIRS.some((ignoredDir)=>path.includes(`/${ignoredDir}/`) || path.includes(`\\${ignoredDir}\\`)));
4688
+ return function(path) {
4689
+ return ignoredFunctions.some((ignoredFunction)=>ignoredFunction(path));
4690
+ };
4691
+ }
4692
+ class InclusiveNodeWatchFileSystem {
4693
+ get watcher() {
4694
+ return this.watchFileSystem.watcher || this.watchFileSystem.wfs?.watcher;
4695
+ }
4696
+ constructor(watchFileSystem, compiler, pluginState){
4697
+ _define_property(this, "watchFileSystem", void 0);
4698
+ _define_property(this, "compiler", void 0);
4699
+ _define_property(this, "pluginState", void 0);
4700
+ _define_property(this, "dirsWatchers", void 0);
4701
+ _define_property(this, "paused", void 0);
4702
+ _define_property(this, "deletedFiles", void 0);
4703
+ _define_property(this, "watch", void 0);
4704
+ this.watchFileSystem = watchFileSystem;
4705
+ this.compiler = compiler;
4706
+ this.pluginState = pluginState;
4707
+ this.paused = true;
4708
+ this.watch = (files, dirs, missing, startTime, options, callback, callbackUndelayed)=>{
4709
+ const { debug } = getInfrastructureLogger(this.compiler);
4710
+ clearFilesChange(this.compiler);
4711
+ const isIgnored = createIsIgnored(options?.ignored, this.pluginState.lastDependencies?.excluded || []);
4712
+ const standardWatcher = this.watchFileSystem.watch(files, dirs, missing, startTime, options, callback, callbackUndelayed);
4713
+ this.watcher?.on('change', (file)=>{
4714
+ if ('string' != typeof file) return;
4715
+ if (isIgnored(file)) debug("Detected file change but it's ignored", file);
4716
+ else {
4717
+ debug('Detected file change', file);
4718
+ this.deletedFiles.delete(file);
4719
+ updateFilesChange(this.compiler, {
4720
+ changedFiles: [
4721
+ file
4722
+ ]
4723
+ });
4724
+ }
4725
+ });
4726
+ this.watcher?.on('remove', (file)=>{
4727
+ if ('string' != typeof file) return;
4728
+ if (this.deletedFiles.has(file)) return void debug('Skipping duplicated remove event.');
4729
+ if (isIgnored(file)) debug("Detected file remove but it's ignored", file);
4730
+ else {
4731
+ debug('Detected file remove', file);
4732
+ this.deletedFiles.add(file);
4733
+ updateFilesChange(this.compiler, {
4734
+ deletedFiles: [
4735
+ file
4736
+ ]
4737
+ });
4738
+ }
4739
+ });
4740
+ const prevDirs = Array.from(this.dirsWatchers.keys());
4741
+ const nextDirs = Array.from(this.pluginState.lastDependencies?.dirs || []);
4742
+ const dirsToUnwatch = prevDirs.filter((prevDir)=>!nextDirs.includes(prevDir));
4743
+ const dirsToWatch = nextDirs.filter((nextDir)=>!prevDirs.includes(nextDir) && !isIgnored(nextDir));
4744
+ dirsToUnwatch.forEach((dirToUnwatch)=>{
4745
+ this.dirsWatchers.get(dirToUnwatch)?.close();
4746
+ this.dirsWatchers.delete(dirToUnwatch);
4747
+ });
4748
+ dirsToWatch.forEach((dirToWatch)=>{
4749
+ const interval = 'number' == typeof options?.poll ? options.poll : void 0;
4750
+ const dirWatcher = external_chokidar_default().watch(dirToWatch, {
4751
+ ignoreInitial: true,
4752
+ ignorePermissionErrors: true,
4753
+ ignored: (path)=>isIgnored(path),
4754
+ usePolling: options?.poll ? true : void 0,
4755
+ ...void 0 !== interval && {
4756
+ interval,
4757
+ binaryInterval: interval
4758
+ },
4759
+ alwaysStat: true,
4760
+ atomic: true,
4761
+ awaitWriteFinish: true
4762
+ });
4763
+ dirWatcher.on('add', async (file, stats)=>{
4764
+ if (this.paused) return;
4765
+ const extension = (0, external_node_path_namespaceObject.extname)(file);
4766
+ const supportedExtensions = this.pluginState.lastDependencies?.extensions || [];
4767
+ if (!supportedExtensions.includes(extension) && !isContentMapperFile(file, this.pluginState.lastDependencies?.contentMappers)) return void debug('Detected new file add but extension is not supported', file);
4768
+ this.deletedFiles.delete(file);
4769
+ if (this.pluginState.emittedFiles) {
4770
+ await this.pluginState.issuesPromise.catch(()=>void 0);
4771
+ if (this.dirsWatchers.get(dirToWatch) !== dirWatcher || this.deletedFiles.has(file)) return;
4772
+ const emittedMtime = this.pluginState.emittedFiles.get(toComparisonPath(file));
4773
+ try {
4774
+ if (void 0 !== emittedMtime && external_node_fs_default().statSync(file).mtimeMs === emittedMtime) return;
4775
+ } catch {}
4776
+ }
4777
+ debug('Detected new file add', file);
4778
+ updateFilesChange(this.compiler, {
4779
+ changedFiles: [
4780
+ file
4781
+ ]
4782
+ });
4783
+ this.watcher?._onChange(file, stats?.mtimeMs || stats?.ctimeMs || 1, file, 'rename');
4784
+ });
4785
+ dirWatcher.on('unlink', (file)=>{
4786
+ if (this.paused) return;
4787
+ this.pluginState.emittedFiles?.delete(toComparisonPath(file));
4788
+ const extension = (0, external_node_path_namespaceObject.extname)(file);
4789
+ const supportedExtensions = this.pluginState.lastDependencies?.extensions || [];
4790
+ if (!supportedExtensions.includes(extension) && !isContentMapperFile(file, this.pluginState.lastDependencies?.contentMappers)) return void debug('Detected new file remove but extension is not supported', file);
4791
+ if (this.deletedFiles.has(file)) return void debug('Skipping duplicated unlink event.');
4792
+ debug('Detected new file remove', file);
4793
+ this.deletedFiles.add(file);
4794
+ updateFilesChange(this.compiler, {
4795
+ deletedFiles: [
4796
+ file
4797
+ ]
4798
+ });
4799
+ this.watcher?._onRemove(dirToWatch, file, 'rename');
4800
+ });
4801
+ this.dirsWatchers.set(dirToWatch, dirWatcher);
4802
+ });
4803
+ this.paused = false;
4804
+ return {
4805
+ ...standardWatcher,
4806
+ close: ()=>{
4807
+ clearFilesChange(this.compiler);
4808
+ if (standardWatcher) standardWatcher.close();
4809
+ this.dirsWatchers.forEach((dirWatcher)=>{
4810
+ dirWatcher?.close();
4811
+ });
4812
+ this.dirsWatchers.clear();
4813
+ this.paused = true;
4814
+ },
4815
+ pause: ()=>{
4816
+ if (standardWatcher) standardWatcher.pause();
4817
+ this.paused = true;
4818
+ }
4819
+ };
4820
+ };
4821
+ this.dirsWatchers = new Map();
4822
+ this.deletedFiles = new Set();
4823
+ }
4824
+ }
4825
+ function tapAfterEnvironmentToPatchWatching(compiler, state) {
4826
+ const { debug } = getInfrastructureLogger(compiler);
4827
+ compiler.hooks.afterEnvironment.tap('TsCheckerRspackPlugin', ()=>{
4828
+ const watchFileSystem = compiler.watchFileSystem;
4829
+ if (watchFileSystem) {
4830
+ debug("Overwriting Rspack's watch file system.");
4831
+ compiler.watchFileSystem = new InclusiveNodeWatchFileSystem(watchFileSystem, compiler, state);
4832
+ } else debug('No watch file system found - plugin may not work correctly.');
4833
+ });
4834
+ }
4835
+ var external_picocolors_ = __webpack_require__("picocolors");
4836
+ var external_picocolors_default = /*#__PURE__*/ __webpack_require__.n(external_picocolors_);
4837
+ const lite_tapable_namespaceObject = require("@rspack/lite-tapable");
4838
+ const compilerHookMap = new WeakMap();
4839
+ function createPluginHooks() {
4840
+ return {
4841
+ start: new lite_tapable_namespaceObject.AsyncSeriesWaterfallHook([
4842
+ 'change',
4843
+ 'compilation'
4844
+ ]),
4845
+ waiting: new lite_tapable_namespaceObject.SyncHook([
4846
+ 'compilation'
4847
+ ]),
4848
+ canceled: new lite_tapable_namespaceObject.SyncHook([
4849
+ 'compilation'
4850
+ ]),
4851
+ error: new lite_tapable_namespaceObject.SyncHook([
4852
+ 'error',
4853
+ 'compilation'
4854
+ ]),
4855
+ issues: new lite_tapable_namespaceObject.SyncWaterfallHook([
4856
+ 'issues',
4857
+ 'compilation'
4858
+ ])
4859
+ };
4860
+ }
4861
+ function forwardPluginHooks(source, target) {
4862
+ source.start.tapPromise('TsCheckerRspackPlugin', target.start.promise);
4863
+ source.waiting.tap('TsCheckerRspackPlugin', target.waiting.call);
4864
+ source.canceled.tap('TsCheckerRspackPlugin', target.canceled.call);
4865
+ source.error.tap('TsCheckerRspackPlugin', target.error.call);
4866
+ source.issues.tap('TsCheckerRspackPlugin', target.issues.call);
4867
+ }
4868
+ function getPluginHooks(compiler) {
4869
+ let hooks = compilerHookMap.get(compiler);
4870
+ if (void 0 === hooks) {
4871
+ hooks = createPluginHooks();
4872
+ compilerHookMap.set(compiler, hooks);
4873
+ if ('compilers' in compiler) compiler.compilers.forEach((childCompiler)=>{
4874
+ const childHooks = getPluginHooks(childCompiler);
4875
+ if (hooks) forwardPluginHooks(childHooks, hooks);
4876
+ });
4877
+ }
4878
+ return hooks;
4879
+ }
4880
+ const external_node_process_namespaceObject = require("node:process");
4881
+ function createControlledPromise() {
4882
+ let resolve = ()=>void 0;
4883
+ let reject = ()=>void 0;
4884
+ const promise = new Promise((aResolve, aReject)=>{
4885
+ resolve = aResolve;
4886
+ reject = aReject;
4887
+ });
4888
+ return {
3554
4889
  promise,
3555
4890
  resolve,
3556
4891
  reject
@@ -3617,7 +4952,6 @@ var __webpack_exports__ = {};
3617
4952
  function uuid() {
3618
4953
  return new Array(4).fill(0).map(()=>Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join('-');
3619
4954
  }
3620
- const external_node_child_process_namespaceObject = require("node:child_process");
3621
4955
  const WORKER_DATA_ENV_KEY = 'WORKER_DATA';
3622
4956
  function createRpcWorker(modulePath, data, memoryLimit) {
3623
4957
  const options = {
@@ -3670,15 +5004,6 @@ var __webpack_exports__ = {};
3670
5004
  return remoteMethod(...args);
3671
5005
  }, worker);
3672
5006
  }
3673
- class AbortError extends Error {
3674
- static throwIfAborted(signal) {
3675
- if (signal?.aborted) throw new AbortError();
3676
- }
3677
- constructor(message = 'Task aborted.'){
3678
- super(message);
3679
- this.name = 'AbortError';
3680
- }
3681
- }
3682
5007
  function tapErrorToLogMessage(compiler, config) {
3683
5008
  const hooks = getPluginHooks(compiler);
3684
5009
  hooks.error.tap('TsCheckerRspackPlugin', (error)=>{
@@ -3697,353 +5022,75 @@ var __webpack_exports__ = {};
3697
5022
  while(pendingPromises.length >= pool.size){
3698
5023
  AbortError.throwIfAborted(signal);
3699
5024
  await Promise.race(pendingPromises).catch(()=>void 0);
3700
- }
3701
- AbortError.throwIfAborted(signal);
3702
- const taskPromise = task(signal).finally(()=>{
3703
- pendingPromises = pendingPromises.filter((pendingPromise)=>pendingPromise !== taskPromise);
3704
- });
3705
- pendingPromises.push(taskPromise);
3706
- return taskPromise;
3707
- },
3708
- size,
3709
- get pending () {
3710
- return pendingPromises.length;
3711
- },
3712
- get drained () {
3713
- return new Promise(async (resolve)=>{
3714
- while(pendingPromises.length > 0)await Promise.race(pendingPromises).catch(()=>void 0);
3715
- resolve(void 0);
3716
- });
3717
- }
3718
- };
3719
- return pool;
3720
- }
3721
- const issuesPool = createPool(Math.max(1, external_node_os_namespaceObject.cpus().length));
3722
- const dependenciesPool = createPool(Math.max(1, external_node_os_namespaceObject.cpus().length));
3723
- function interceptDoneToGetDevServerTap(compiler, config, state) {
3724
- const { debug } = getInfrastructureLogger(compiler);
3725
- compiler.hooks.done.intercept({
3726
- register: (tap)=>{
3727
- if ([
3728
- 'webpack-dev-server',
3729
- 'rsbuild-dev-server',
3730
- 'rspack-dev-server'
3731
- ].includes(tap.name) && 'sync' === tap.type && config.devServer) {
3732
- debug('Intercepting dev-server tap.');
3733
- state.DevServerDoneTap = tap;
3734
- }
3735
- return tap;
3736
- }
3737
- });
3738
- }
3739
- function forwardSlash(input) {
3740
- return external_node_path_default().normalize(input).replace(/\\+/g, '/');
3741
- }
3742
- function relativeToContext(file, context) {
3743
- let fileInContext = forwardSlash(external_node_path_default().relative(context, file));
3744
- if (!fileInContext.startsWith('../')) fileInContext = './' + fileInContext;
3745
- return fileInContext;
3746
- }
3747
- function formatIssueLocation(location) {
3748
- return `${location.start.line}:${location.start.column}`;
3749
- }
3750
- function issue_rspack_error_define_property(obj, key, value) {
3751
- if (key in obj) Object.defineProperty(obj, key, {
3752
- value: value,
3753
- enumerable: true,
3754
- configurable: true,
3755
- writable: true
3756
- });
3757
- else obj[key] = value;
3758
- return obj;
3759
- }
3760
- class IssueRspackError extends Error {
3761
- constructor(message, pathType, issue){
3762
- super(message), issue_rspack_error_define_property(this, "issue", void 0), issue_rspack_error_define_property(this, "hideStack", void 0), issue_rspack_error_define_property(this, "file", void 0), this.issue = issue, this.hideStack = true;
3763
- if (issue.file) {
3764
- this.file = 'absolute' === pathType ? forwardSlash(external_node_path_default().resolve(issue.file)) : relativeToContext(issue.file, process.cwd());
3765
- if (issue.location) this.file += `:${formatIssueLocation(issue.location)}`;
3766
- }
3767
- Error.captureStackTrace(this, this.constructor);
3768
- }
3769
- }
3770
- const external_node_fs_namespaceObject = require("node:fs");
3771
- var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
3772
- const external_node_url_namespaceObject = require("node:url");
3773
- const external_node_util_namespaceObject = require("node:util");
3774
- const TYPESCRIPT_PACKAGE = "typescript";
3775
- const TYPESCRIPT_PACKAGE_JSON = `${TYPESCRIPT_PACKAGE}/package.json`;
3776
- const TYPESCRIPT_PREVIEW_PACKAGE = "@typescript/native-preview";
3777
- const TYPESCRIPT_PREVIEW_PACKAGE_JSON = `${TYPESCRIPT_PREVIEW_PACKAGE}/package.json`;
3778
- function resolveTypeScriptGoPackageJsonPath(config) {
3779
- if (!external_node_path_default().isAbsolute(config.typescriptPath) || 'package.json' !== external_node_path_default().basename(config.typescriptPath)) throw new Error("The typescriptPath option must be an absolute path to a package.json file when tsgo is enabled.");
3780
- if (!config.tsgoPackage) throw new Error(`The typescriptPath option must point to "${TYPESCRIPT_PREVIEW_PACKAGE_JSON}" or "${TYPESCRIPT_PACKAGE}@>=7".`);
3781
- return config.typescriptPath;
3782
- }
3783
- async function resolveTypeScriptGoNativeExecutablePath(packageJsonPath, packageName) {
3784
- const getExePathPath = external_node_path_default().resolve(external_node_path_default().dirname(packageJsonPath), './lib/getExePath.js');
3785
- const getExePathUrl = (0, external_node_url_namespaceObject.pathToFileURL)(getExePathPath).href;
3786
- const getExePathModule = await import(getExePathUrl);
3787
- const getExePath = getExePathModule.default || getExePathModule.getExePath;
3788
- if ('function' != typeof getExePath) throw new Error(`Cannot resolve the native TypeScript executable from "${packageName}".`);
3789
- const executablePath = getExePath();
3790
- if ('string' != typeof executablePath || !external_node_fs_default().existsSync(executablePath)) throw new Error('Executable not found');
3791
- return executablePath;
3792
- }
3793
- async function resolveTypeScriptGoBinPath(config) {
3794
- const packageJsonPath = resolveTypeScriptGoPackageJsonPath(config);
3795
- if ("typescript" === config.tsgoPackage) return resolveTypeScriptGoNativeExecutablePath(packageJsonPath, TYPESCRIPT_PACKAGE);
3796
- return resolveTypeScriptGoNativeExecutablePath(packageJsonPath, TYPESCRIPT_PREVIEW_PACKAGE);
3797
- }
3798
- async function resolveTypeScriptGoExecutable(config) {
3799
- const binPath = await resolveTypeScriptGoBinPath(config);
3800
- return {
3801
- command: binPath,
3802
- args: []
3803
- };
3804
- }
3805
- async function runTypeScriptGoShowConfig(executable, configFile) {
3806
- const { stdout } = await (0, external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.execFile)(executable.command, [
3807
- ...executable.args,
3808
- '--project',
3809
- configFile,
3810
- '--showConfig',
3811
- '--pretty',
3812
- 'false'
3813
- ], {
3814
- cwd: external_node_path_default().dirname(configFile),
3815
- encoding: 'utf8',
3816
- maxBuffer: 67108864
3817
- });
3818
- const parsedConfig = JSON.parse(stdout);
3819
- if (!parsedConfig || 'object' != typeof parsedConfig || Array.isArray(parsedConfig)) throw new TypeError('Invalid tsgo --showConfig output.');
3820
- return parsedConfig;
3821
- }
3822
- function toComparisonPath(file) {
3823
- const normalizedPath = external_node_path_default().normalize(file);
3824
- return 'win32' === process.platform ? normalizedPath.toLowerCase() : normalizedPath;
3825
- }
3826
- function shouldRefreshTypeScriptGoDependencies(dependencies, { changedFiles = [], deletedFiles = [] }) {
3827
- if (!dependencies) return true;
3828
- const dependencyKeys = dependencies.files.map((file)=>toComparisonPath(file));
3829
- return changedFiles.some((file)=>{
3830
- const key = toComparisonPath(file);
3831
- const extension = external_node_path_default().extname(file).toLowerCase();
3832
- return '.json' === extension || dependencies.extensions.includes(extension) && !dependencyKeys.includes(key);
3833
- }) || deletedFiles.some((file)=>dependencyKeys.includes(toComparisonPath(file)));
3834
- }
3835
- function createTypeScriptGoArgs(config) {
3836
- const args = config.build ? [
3837
- '--build',
3838
- config.configFile
3839
- ] : [
3840
- '--project',
3841
- config.configFile
3842
- ];
3843
- args.push('--noEmit', '--pretty');
3844
- return args;
3845
- }
3846
- function logOutput(logger, output) {
3847
- if (!output.trim()) return;
3848
- logger.error(output.trimEnd());
3849
- }
3850
- function stripAnsi(output) {
3851
- return output.replace(/\u001b\[[0-?]*[ -/]*[@-~]/g, '');
3852
- }
3853
- function getTypeScriptGoErrorCount(output) {
3854
- const plainOutput = stripAnsi(output);
3855
- const matches = Array.from(plainOutput.matchAll(/\bFound\s+(\d+)\s+errors?\b/g));
3856
- const lastMatch = matches[matches.length - 1];
3857
- if (!lastMatch) return;
3858
- return Number(lastMatch[1]);
3859
- }
3860
- function getTypeScriptGoIssueSeverity(severity, defaultSeverity) {
3861
- return 'auto' === defaultSeverity ? severity : defaultSeverity;
3862
- }
3863
- function createTypeScriptGoIssue(message) {
3864
- return {
3865
- severity: 'error',
3866
- code: "TSGO",
3867
- message
5025
+ }
5026
+ AbortError.throwIfAborted(signal);
5027
+ const taskPromise = task(signal).finally(()=>{
5028
+ pendingPromises = pendingPromises.filter((pendingPromise)=>pendingPromise !== taskPromise);
5029
+ });
5030
+ pendingPromises.push(taskPromise);
5031
+ return taskPromise;
5032
+ },
5033
+ size,
5034
+ get pending () {
5035
+ return pendingPromises.length;
5036
+ },
5037
+ get drained () {
5038
+ return new Promise(async (resolve)=>{
5039
+ while(pendingPromises.length > 0)await Promise.race(pendingPromises).catch(()=>void 0);
5040
+ resolve(void 0);
5041
+ });
5042
+ }
3868
5043
  };
5044
+ return pool;
3869
5045
  }
3870
- const diagnosticPattern = /^(.*?):(\d+):(\d+)\s+-\s+(error|warning)\s+TS(\d+):\s+(.+)$/;
3871
- const globalDiagnosticPattern = /^(error|warning)\s+TS(\d+):\s+(.+)$/;
3872
- function getTypeScriptGoMarkerLength(output, startIndex) {
3873
- const lines = output.slice(startIndex).split(/\r?\n/);
3874
- for (const line of lines){
3875
- if (diagnosticPattern.test(line) || globalDiagnosticPattern.test(line) || /^Found\s+\d+\s+errors?\b/.test(line)) break;
3876
- const marker = line.match(/^\s*([~^]+)\s*$/);
3877
- if (marker) return marker[1].length;
3878
- }
3879
- }
3880
- function parseTypeScriptGoIssues(output, config, defaultSeverity = 'auto') {
3881
- const issues = [];
3882
- const plainOutput = stripAnsi(output);
3883
- const diagnosticPatternWithGlobal = new RegExp(diagnosticPattern, 'gm');
3884
- const globalDiagnosticPatternWithGlobal = new RegExp(globalDiagnosticPattern, 'gm');
3885
- for (const match of plainOutput.matchAll(diagnosticPatternWithGlobal)){
3886
- const [, file, line, column, severity, code, message] = match;
3887
- const startColumn = Number(column);
3888
- const markerLength = getTypeScriptGoMarkerLength(plainOutput, (match.index || 0) + match[0].length);
3889
- const position = {
3890
- line: Number(line),
3891
- column: startColumn
3892
- };
3893
- issues.push({
3894
- severity: getTypeScriptGoIssueSeverity(severity, defaultSeverity),
3895
- code: `TS${code}`,
3896
- message,
3897
- file: external_node_path_default().isAbsolute(file) ? file : external_node_path_default().resolve(config.context, file),
3898
- location: {
3899
- start: position,
3900
- end: {
3901
- line: position.line,
3902
- column: markerLength ? startColumn + markerLength : startColumn
3903
- }
5046
+ const issuesPool = createPool(Math.max(1, external_node_os_namespaceObject.cpus().length));
5047
+ const dependenciesPool = createPool(Math.max(1, external_node_os_namespaceObject.cpus().length));
5048
+ function interceptDoneToGetDevServerTap(compiler, config, state) {
5049
+ const { debug } = getInfrastructureLogger(compiler);
5050
+ compiler.hooks.done.intercept({
5051
+ register: (tap)=>{
5052
+ if ([
5053
+ 'webpack-dev-server',
5054
+ 'rsbuild-dev-server',
5055
+ 'rspack-dev-server'
5056
+ ].includes(tap.name) && 'sync' === tap.type && config.devServer) {
5057
+ debug('Intercepting dev-server tap.');
5058
+ state.DevServerDoneTap = tap;
3904
5059
  }
3905
- });
3906
- }
3907
- for (const match of plainOutput.matchAll(globalDiagnosticPatternWithGlobal)){
3908
- const [, severity, code, message] = match;
3909
- issues.push({
3910
- severity: getTypeScriptGoIssueSeverity(severity, defaultSeverity),
3911
- code: `TS${code}`,
3912
- message
3913
- });
3914
- }
3915
- return issues;
5060
+ return tap;
5061
+ }
5062
+ });
3916
5063
  }
3917
- function createTypeScriptGoExitIssues(output, signal, config, defaultSeverity = 'auto') {
3918
- const parsedIssues = parseTypeScriptGoIssues(output, config, defaultSeverity);
3919
- const errorCount = getTypeScriptGoErrorCount(output);
3920
- if (parsedIssues.length && (void 0 === errorCount || parsedIssues.length >= errorCount)) return parsedIssues;
3921
- if (void 0 !== errorCount) return Array.from({
3922
- length: Math.max(errorCount, 1)
3923
- }, ()=>createTypeScriptGoIssue('tsgo check failed. See the output above for diagnostics.'));
3924
- if (null !== signal) return [
3925
- createTypeScriptGoIssue(`tsgo check interrupted by ${signal}. See the output above for diagnostics.`)
3926
- ];
3927
- return [
3928
- createTypeScriptGoIssue('tsgo check failed. See the output above for diagnostics.')
3929
- ];
5064
+ function forwardSlash(input) {
5065
+ return external_node_path_default().normalize(input).replace(/\\+/g, '/');
3930
5066
  }
3931
- function isTypeScriptGoIssue(issue) {
3932
- return "TSGO" === issue.code;
5067
+ function relativeToContext(file, context) {
5068
+ let fileInContext = forwardSlash(external_node_path_default().relative(context, file));
5069
+ if (!fileInContext.startsWith('../')) fileInContext = './' + fileInContext;
5070
+ return fileInContext;
3933
5071
  }
3934
- function isTypeScriptGoStatsError(error) {
3935
- const issue = error?.issue;
3936
- if (issue && isTypeScriptGoIssue(issue)) return true;
3937
- const message = error?.message;
3938
- return 'string' == typeof message && message.includes("TSGO:");
5072
+ function formatIssueLocation(location) {
5073
+ return `${location.start.line}:${location.start.column}`;
3939
5074
  }
3940
- async function runTypeScriptGo(config, logger, defaultSeverity = 'auto', signal) {
3941
- AbortError.throwIfAborted(signal);
3942
- const executable = await resolveTypeScriptGoExecutable(config);
3943
- const args = createTypeScriptGoArgs(config);
3944
- return new Promise((resolve, reject)=>{
3945
- let settled = false;
3946
- let output = '';
3947
- const childProcess = (0, external_node_child_process_namespaceObject.spawn)(executable.command, [
3948
- ...executable.args,
3949
- ...args
3950
- ], {
3951
- cwd: config.context,
3952
- stdio: [
3953
- 'inherit',
3954
- 'pipe',
3955
- 'pipe'
3956
- ]
3957
- });
3958
- const cleanup = ()=>{
3959
- signal?.removeEventListener('abort', abort);
3960
- childProcess.stdout?.removeAllListeners();
3961
- childProcess.stderr?.removeAllListeners();
3962
- childProcess.removeAllListeners();
3963
- };
3964
- const finish = (callback)=>{
3965
- if (settled) return;
3966
- settled = true;
3967
- cleanup();
3968
- callback();
3969
- };
3970
- const abort = ()=>{
3971
- childProcess.kill('SIGKILL');
3972
- finish(()=>reject(new AbortError()));
3973
- };
3974
- signal?.addEventListener('abort', abort, {
3975
- once: true
3976
- });
3977
- childProcess.stdout?.on('data', (data)=>{
3978
- output += data.toString();
3979
- });
3980
- childProcess.stderr?.on('data', (data)=>{
3981
- output += data.toString();
3982
- });
3983
- childProcess.on('error', (error)=>{
3984
- finish(()=>reject(error));
3985
- });
3986
- childProcess.on('close', (exitCode, exitSignal)=>{
3987
- finish(()=>{
3988
- if (0 === exitCode && null === exitSignal) {
3989
- logOutput(logger, output);
3990
- resolve([]);
3991
- return;
3992
- }
3993
- const issues = createTypeScriptGoExitIssues(output, exitSignal, config, defaultSeverity);
3994
- if (issues.some(isTypeScriptGoIssue)) logOutput(logger, output);
3995
- resolve(issues);
3996
- });
3997
- });
5075
+ function issue_rspack_error_define_property(obj, key, value) {
5076
+ if (key in obj) Object.defineProperty(obj, key, {
5077
+ value: value,
5078
+ enumerable: true,
5079
+ configurable: true,
5080
+ writable: true
3998
5081
  });
5082
+ else obj[key] = value;
5083
+ return obj;
3999
5084
  }
4000
- async function getTypeScriptGoDependencies(config) {
4001
- const executable = await resolveTypeScriptGoExecutable(config);
4002
- const files = new Set();
4003
- const dirs = new Set();
4004
- const excluded = new Set();
4005
- const visitedConfigs = new Set();
4006
- const collectConfigDependencies = async (configFile, fallbackRoot, collectExcluded)=>{
4007
- const normalizedConfigFile = external_node_path_default().normalize(configFile);
4008
- const configKey = toComparisonPath(normalizedConfigFile);
4009
- if (visitedConfigs.has(configKey)) return;
4010
- visitedConfigs.add(configKey);
4011
- const configDir = external_node_path_default().dirname(normalizedConfigFile);
4012
- const normalizedRoot = external_node_path_default().normalize(fallbackRoot);
4013
- files.add(normalizedConfigFile);
4014
- if (!Array.from(dirs).some((dir)=>'' === external_node_path_default().relative(dir, normalizedRoot) || isInsideAnotherPath(dir, normalizedRoot))) dirs.add(normalizedRoot);
4015
- excluded.add(external_node_path_default().join(normalizedRoot, 'node_modules'));
4016
- let parsedConfig;
4017
- try {
4018
- parsedConfig = await runTypeScriptGoShowConfig(executable, normalizedConfigFile);
4019
- } catch {
4020
- return;
4021
- }
4022
- for (const file of parsedConfig.files || [])files.add(external_node_path_default().normalize(external_node_path_default().resolve(configDir, file)));
4023
- if (collectExcluded && !parsedConfig.references?.length) for (const exclude of parsedConfig.exclude || [])excluded.add(external_node_path_default().normalize(external_node_path_default().resolve(configDir, exclude)));
4024
- for (const reference of parsedConfig.references || [])if (reference.path) {
4025
- const resolvedReference = external_node_path_default().resolve(configDir, reference.path);
4026
- const referenceConfig = '.json' === external_node_path_default().extname(resolvedReference).toLowerCase() ? resolvedReference : external_node_path_default().join(resolvedReference, 'tsconfig.json');
4027
- await collectConfigDependencies(referenceConfig, external_node_path_default().dirname(referenceConfig), false);
5085
+ class IssueRspackError extends Error {
5086
+ constructor(message, pathType, issue){
5087
+ super(message), issue_rspack_error_define_property(this, "issue", void 0), issue_rspack_error_define_property(this, "hideStack", void 0), issue_rspack_error_define_property(this, "file", void 0), this.issue = issue, this.hideStack = true;
5088
+ if (issue.file) {
5089
+ this.file = 'absolute' === pathType ? forwardSlash(external_node_path_default().resolve(issue.file)) : relativeToContext(issue.file, process.cwd());
5090
+ if (issue.location) this.file += `:${formatIssueLocation(issue.location)}`;
4028
5091
  }
4029
- };
4030
- await collectConfigDependencies(config.configFile, config.context, true);
4031
- return {
4032
- files: Array.from(files),
4033
- dirs: Array.from(dirs),
4034
- excluded: Array.from(excluded),
4035
- extensions: [
4036
- '.ts',
4037
- '.tsx',
4038
- '.mts',
4039
- '.cts',
4040
- '.js',
4041
- '.jsx',
4042
- '.mjs',
4043
- '.cjs',
4044
- '.json'
4045
- ]
4046
- };
5092
+ Error.captureStackTrace(this, this.constructor);
5093
+ }
4047
5094
  }
4048
5095
  function tapAfterCompileToGetIssues(compiler, config, state) {
4049
5096
  const hooks = getPluginHooks(compiler);
@@ -4260,28 +5307,6 @@ var __webpack_exports__ = {};
4260
5307
  });
4261
5308
  });
4262
5309
  }
4263
- function readTsgoPackageJson(packageJsonPath) {
4264
- return require(packageJsonPath);
4265
- }
4266
- function getTsgoPackage(packageJson) {
4267
- if (packageJson.name === TYPESCRIPT_PACKAGE) {
4268
- const versionMatch = packageJson.version?.match(/^(\d+)\.(\d+)(?:\.|$|-)/);
4269
- if (versionMatch && Number(versionMatch[1]) >= 7) return "typescript";
4270
- }
4271
- if (packageJson.name === TYPESCRIPT_PREVIEW_PACKAGE) return 'preview';
4272
- }
4273
- function resolveTypeScriptGoPackage(packageJsonPath) {
4274
- if (!external_node_path_default().isAbsolute(packageJsonPath) || 'package.json' !== external_node_path_default().basename(packageJsonPath)) return;
4275
- try {
4276
- const tsgoPackage = getTsgoPackage(readTsgoPackageJson(packageJsonPath));
4277
- return tsgoPackage ? {
4278
- packageJsonPath,
4279
- tsgoPackage
4280
- } : void 0;
4281
- } catch {
4282
- return;
4283
- }
4284
- }
4285
5310
  function isDefaultTypeScriptGoPath(typescriptPath) {
4286
5311
  if (typescriptPath === TYPESCRIPT_PREVIEW_PACKAGE_JSON) return true;
4287
5312
  try {
@@ -4374,6 +5399,7 @@ var __webpack_exports__ = {};
4374
5399
  await assertTypeScriptGoExecutableOnce();
4375
5400
  state.initialized = true;
4376
5401
  state.watching = true;
5402
+ if (config.typescript.build && 'write-references' === config.typescript.mode) state.emittedFiles = new Map();
4377
5403
  if (config.async) {
4378
5404
  debug('Initializing tsgo for watch run (async).');
4379
5405
  tapDoneToAsyncGetIssues(compiler, config, state);
@@ -4415,19 +5441,17 @@ var __webpack_exports__ = {};
4415
5441
  ...compiler.modifiedFiles || []
4416
5442
  ];
4417
5443
  const dependencyPaths = new Set(state.lastDependencies?.files.map((file)=>toComparisonPath(file)));
4418
- if (state.watching && canReuseIssues && state.lastDependencies && 0 === hooks.start.taps.length && !filesChange.deletedFiles?.length && !compiler.removedFiles?.size && changedFiles.length > 0 && changedFiles.every((file)=>STYLE_FILE.test(file) && !dependencyPaths.has(toComparisonPath(file)))) {
5444
+ if (state.watching && canReuseIssues && state.lastDependencies && 0 === hooks.start.taps.length && !filesChange.deletedFiles?.length && !compiler.removedFiles?.size && changedFiles.length > 0 && changedFiles.every((file)=>STYLE_FILE.test(file) && !dependencyPaths.has(toComparisonPath(file)) && !isContentMapperFile(file, state.lastDependencies.contentMappers))) {
4419
5445
  debug('Reusing tsgo issues for style-only changes.');
4420
5446
  state.issuesPromise = state.issuesPromise.then((issues)=>issues);
4421
5447
  return;
4422
5448
  }
4423
5449
  canReuseIssues = false;
4424
5450
  const iteration = ++state.iteration;
4425
- if (state.abortController) {
5451
+ if (state.abortController && !state.emittedFiles) {
4426
5452
  debug(`Aborting tsgo iteration ${iteration - 1}.`);
4427
5453
  state.abortController.abort();
4428
5454
  }
4429
- const abortController = new AbortController();
4430
- state.abortController = abortController;
4431
5455
  state.watching ? log([
4432
5456
  'Calling tsgo for incremental check.',
4433
5457
  ` Changed files: ${JSON.stringify(filesChange.changedFiles)}`,
@@ -4435,7 +5459,7 @@ var __webpack_exports__ = {};
4435
5459
  ].join('\n')) : log('Calling tsgo for single check.');
4436
5460
  const cacheGeneration = ++dependenciesCacheGeneration;
4437
5461
  const startPromise = hooks.start.promise(filesChange, compilation);
4438
- state.dependenciesPromise = startPromise.then((nextFilesChange)=>{
5462
+ const currentDependenciesPromise = startPromise.then((nextFilesChange)=>{
4439
5463
  if (cacheGeneration !== dependenciesCacheGeneration) return;
4440
5464
  if (state.watching && dependenciesPromise && !shouldRefreshTypeScriptGoDependencies(state.lastDependencies, nextFilesChange)) {
4441
5465
  debug(`Reusing cached tsgo dependencies, iteration ${iteration}.`);
@@ -4453,6 +5477,7 @@ var __webpack_exports__ = {};
4453
5477
  }
4454
5478
  return nextDependenciesPromise;
4455
5479
  });
5480
+ state.dependenciesPromise = currentDependenciesPromise;
4456
5481
  filesChange = await startPromise;
4457
5482
  let aggregatedFilesChange = filesChange;
4458
5483
  if (state.aggregatedFilesChange) {
@@ -4469,29 +5494,34 @@ var __webpack_exports__ = {};
4469
5494
  state.aggregatedFilesChange = aggregatedFilesChange;
4470
5495
  canReuseIssues = true;
4471
5496
  state.issuesPromise = (state.issuesPromise || Promise.resolve()).catch(()=>void 0).then(()=>{
4472
- if (abortController.signal.aborted) return;
5497
+ if (iteration !== state.iteration) return;
5498
+ const abortController = new AbortController();
5499
+ state.abortController = abortController;
4473
5500
  debug(`Submitting tsgo to the pool, iteration ${iteration}.`);
4474
5501
  return issuesPool.submit(async (signal)=>{
4475
5502
  try {
5503
+ if (iteration !== state.iteration) return;
4476
5504
  debug(`Running tsgo, iteration ${iteration}.`);
4477
- const issues = await runTypeScriptGo(config.typescript, config.logger, config.issue.defaultSeverity, signal);
5505
+ const issues = await runTypeScriptGo(config.typescript, config.logger, config.issue.defaultSeverity, signal, state.emittedFiles, currentDependenciesPromise);
5506
+ if (iteration !== state.iteration) return;
4478
5507
  if (state.aggregatedFilesChange === aggregatedFilesChange) state.aggregatedFilesChange = void 0;
4479
5508
  if (state.abortController === abortController) {
4480
5509
  if (issues.some(isTypeScriptGoIssue)) canReuseIssues = false;
4481
5510
  state.abortController = void 0;
4482
5511
  }
4483
5512
  return issues;
4484
- } catch (error) {
4485
- if (state.abortController === abortController) canReuseIssues = false;
4486
- hooks.error.call(error, compilation);
4487
- return;
4488
5513
  } finally{
4489
5514
  debug(`tsgo finished its job, iteration ${iteration}.`);
4490
5515
  }
4491
- }, abortController.signal);
5516
+ }, abortController.signal).catch((error)=>{
5517
+ if (error instanceof AbortError && abortController.signal.aborted) return;
5518
+ if (state.abortController === abortController) canReuseIssues = false;
5519
+ hooks.error.call(error, compilation);
5520
+ });
4492
5521
  });
4493
5522
  });
4494
5523
  const abortTypeScriptGo = ()=>{
5524
+ ++state.iteration;
4495
5525
  if (state.abortController) {
4496
5526
  debug('Compiler is going to close - terminating tsgo...');
4497
5527
  state.abortController.abort();