@ariestools/toolchain 8.7.0 → 8.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/actions/license.d.ts +4 -0
  2. package/dist/actions/license.d.ts.map +1 -1
  3. package/dist/actions/lint.d.ts +11 -2
  4. package/dist/actions/lint.d.ts.map +1 -1
  5. package/dist/actions/lintNext.d.ts +22 -1
  6. package/dist/actions/lintNext.d.ts.map +1 -1
  7. package/dist/actions/lintNextRun.d.ts +36 -0
  8. package/dist/actions/lintNextRun.d.ts.map +1 -0
  9. package/dist/actions/lintNextWorker.d.ts +70 -3
  10. package/dist/actions/lintNextWorker.d.ts.map +1 -1
  11. package/dist/actions/lintPackageFilter.d.ts +44 -0
  12. package/dist/actions/lintPackageFilter.d.ts.map +1 -0
  13. package/dist/bin/package/build.mjs +296 -83
  14. package/dist/bin/package/build.mjs.map +1 -1
  15. package/dist/bin/package/clean.mjs +214 -47
  16. package/dist/bin/package/clean.mjs.map +1 -1
  17. package/dist/bin/package/compile.mjs +296 -83
  18. package/dist/bin/package/compile.mjs.map +1 -1
  19. package/dist/bin/package/copy-assets-cjs.mjs +214 -47
  20. package/dist/bin/package/copy-assets-cjs.mjs.map +1 -1
  21. package/dist/bin/package/copy-assets-esm.mjs +214 -47
  22. package/dist/bin/package/copy-assets-esm.mjs.map +1 -1
  23. package/dist/bin/package/publint.mjs +224 -50
  24. package/dist/bin/package/publint.mjs.map +1 -1
  25. package/dist/bin/package/recompile.mjs +296 -83
  26. package/dist/bin/package/recompile.mjs.map +1 -1
  27. package/dist/bin/package/sync-layout.mjs +10 -3
  28. package/dist/bin/package/sync-layout.mjs.map +1 -1
  29. package/dist/bin/skills.mjs +135 -91
  30. package/dist/bin/skills.mjs.map +1 -1
  31. package/dist/bin/source-map-explorer.mjs +7 -2
  32. package/dist/bin/source-map-explorer.mjs.map +1 -1
  33. package/dist/bin/xy.mjs +1068 -281
  34. package/dist/bin/xy.mjs.map +1 -1
  35. package/dist/lib/index.d.ts +1 -0
  36. package/dist/lib/index.d.ts.map +1 -1
  37. package/dist/lib/licenseCheck/checkLicenses.d.ts +23 -0
  38. package/dist/lib/licenseCheck/checkLicenses.d.ts.map +1 -0
  39. package/dist/lib/licenseCheck/collectProductionLicenses.d.ts +21 -0
  40. package/dist/lib/licenseCheck/collectProductionLicenses.d.ts.map +1 -0
  41. package/dist/lib/licenseCheck/index.d.ts +4 -0
  42. package/dist/lib/licenseCheck/index.d.ts.map +1 -0
  43. package/dist/lib/licenseCheck/readPackageLicense.d.ts +25 -0
  44. package/dist/lib/licenseCheck/readPackageLicense.d.ts.map +1 -0
  45. package/dist/xy/common/licenseCommand.d.ts.map +1 -1
  46. package/dist/xy/lint/cycleCommand.d.ts.map +1 -1
  47. package/dist/xy/lint/lint/runCommand.d.ts.map +1 -1
  48. package/package.json +7 -8
package/dist/bin/xy.mjs CHANGED
@@ -27,7 +27,6 @@ import util, { promisify, stripVTControlCharacters } from "node:util";
27
27
  import { createHash, randomBytes } from "node:crypto";
28
28
  import { applyRecommendedConfigTypeChecked, parseRecommendedConfigSource } from "@ariestools/eslint-config-flat";
29
29
  import zlib from "node:zlib";
30
- import { init } from "license-checker-rseidelsohn";
31
30
  import { builtinRules } from "eslint/use-at-your-own-risk";
32
31
  import { notStrictEqual, strictEqual } from "assert";
33
32
  //#region \0rolldown/runtime.js
@@ -72,9 +71,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
72
71
  var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
73
72
  //#endregion
74
73
  //#region src/lib/bundledCliPath.ts
75
- const require$8 = createRequire(import.meta.url);
74
+ const require$9 = createRequire(import.meta.url);
76
75
  function toolchainPackageRoot() {
77
- return PATH.dirname(require$8.resolve("@ariestools/toolchain/package.json"));
76
+ return PATH.dirname(require$9.resolve("@ariestools/toolchain/package.json"));
78
77
  }
79
78
  function bundledCliPath(name) {
80
79
  return PATH.resolve(toolchainPackageRoot(), "dist/bin", name);
@@ -644,10 +643,12 @@ var init_index_min = __esmMin((() => {
644
643
  body: e.slice(r[0] + s.length, r[1]),
645
644
  post: e.slice(r[1] + i.length)
646
645
  };
647
- }, ce = (n, t) => {
646
+ };
647
+ ce = (n, t) => {
648
648
  let e = t.match(n);
649
649
  return e ? e[0] : null;
650
- }, ss = (n, t, e) => {
650
+ };
651
+ ss = (n, t, e) => {
651
652
  let s, i, r, o, h, a = e.indexOf(n), l = e.indexOf(t, a + 1), u = a;
652
653
  if (a >= 0 && l > 0) {
653
654
  if (n === t) return [a, l];
@@ -663,7 +664,22 @@ var init_index_min = __esmMin((() => {
663
664
  }
664
665
  return h;
665
666
  };
666
- fe = "\0SLASH" + Math.random() + "\0", ue = "\0OPEN" + Math.random() + "\0", qt = "\0CLOSE" + Math.random() + "\0", de = "\0COMMA" + Math.random() + "\0", pe = "\0PERIOD" + Math.random() + "\0", is = new RegExp(fe, "g"), rs = new RegExp(ue, "g"), ns = new RegExp(qt, "g"), os$2 = new RegExp(de, "g"), hs = new RegExp(pe, "g"), as = /\\\\/g, ls = /\\{/g, cs = /\\}/g, fs$6 = /\\,/g, us = /\\./g, ds = 1e5;
667
+ fe = "\0SLASH" + Math.random() + "\0";
668
+ ue = "\0OPEN" + Math.random() + "\0";
669
+ qt = "\0CLOSE" + Math.random() + "\0";
670
+ de = "\0COMMA" + Math.random() + "\0";
671
+ pe = "\0PERIOD" + Math.random() + "\0";
672
+ is = new RegExp(fe, "g");
673
+ rs = new RegExp(ue, "g");
674
+ ns = new RegExp(qt, "g");
675
+ os$2 = new RegExp(de, "g");
676
+ hs = new RegExp(pe, "g");
677
+ as = /\\\\/g;
678
+ ls = /\\{/g;
679
+ cs = /\\}/g;
680
+ fs$6 = /\\,/g;
681
+ us = /\\./g;
682
+ ds = 1e5;
667
683
  at = (n) => {
668
684
  if (typeof n != "string") throw new TypeError("invalid pattern");
669
685
  if (n.length > 65536) throw new TypeError("pattern is too long");
@@ -687,7 +703,11 @@ var init_index_min = __esmMin((() => {
687
703
  "[:upper:]": ["\\p{Lu}", !0],
688
704
  "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", !0],
689
705
  "[:xdigit:]": ["A-Fa-f0-9", !1]
690
- }, lt = (n) => n.replace(/[[\]\\-]/g, "\\$&"), Es = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), we = (n) => n.join(""), ye = (n, t) => {
706
+ };
707
+ lt = (n) => n.replace(/[[\]\\-]/g, "\\$&");
708
+ Es = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
709
+ we = (n) => n.join("");
710
+ ye = (n, t) => {
691
711
  let e = t;
692
712
  if (n.charAt(e) !== "[") throw new Error("not in a brace expression");
693
713
  let s = [], i = [], r = e + 1, o = !1, h = !1, a = !1, l = !1, u = e, c = "";
@@ -764,7 +784,18 @@ var init_index_min = __esmMin((() => {
764
784
  "+",
765
785
  "*",
766
786
  "@"
767
- ]), be = (n) => xs.has(n), vs = "(?!(?:^|/)\\.\\.?(?:$|/))", Ct = "(?!\\.)", Cs = /* @__PURE__ */ new Set(["[", "."]), Ts = /* @__PURE__ */ new Set(["..", "."]), As = /* @__PURE__ */ new Set("().*{}+?[]^$\\!"), ks = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), Kt = "[^/]", Se = Kt + "*?", Ee = Kt + "+?", Q = class n {
787
+ ]);
788
+ be = (n) => xs.has(n);
789
+ vs = "(?!(?:^|/)\\.\\.?(?:$|/))";
790
+ Ct = "(?!\\.)";
791
+ Cs = /* @__PURE__ */ new Set(["[", "."]);
792
+ Ts = /* @__PURE__ */ new Set(["..", "."]);
793
+ As = /* @__PURE__ */ new Set("().*{}+?[]^$\\!");
794
+ ks = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
795
+ Kt = "[^/]";
796
+ Se = Kt + "*?";
797
+ Ee = Kt + "+?";
798
+ Q = class n {
768
799
  type;
769
800
  #t;
770
801
  #s;
@@ -1005,34 +1036,60 @@ var init_index_min = __esmMin((() => {
1005
1036
  }
1006
1037
  };
1007
1038
  tt = (n, { windowsPathsNoEscape: t = !1, magicalBraces: e = !1 } = {}) => e ? t ? n.replace(/[?*()[\]{}]/g, "[$&]") : n.replace(/[?*()[\]\\{}]/g, "\\$&") : t ? n.replace(/[?*()[\]]/g, "[$&]") : n.replace(/[?*()[\]\\]/g, "\\$&");
1008
- O = (n, t, e = {}) => (at(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new D(t, e).match(n)), Rs = /^\*+([^+@!?\*\[\(]*)$/, Os = (n) => (t) => !t.startsWith(".") && t.endsWith(n), Fs = (n) => (t) => t.endsWith(n), Ds = (n) => (n = n.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(n)), Ms = (n) => (n = n.toLowerCase(), (t) => t.toLowerCase().endsWith(n)), Ns = /^\*+\.\*+$/, _s = (n) => !n.startsWith(".") && n.includes("."), Ls = (n) => n !== "." && n !== ".." && n.includes("."), Ws = /^\.\*+$/, Ps = (n) => n !== "." && n !== ".." && n.startsWith("."), js = /^\*+$/, Is = (n) => n.length !== 0 && !n.startsWith("."), zs = (n) => n.length !== 0 && n !== "." && n !== "..", Bs = /^\?+([^+@!?\*\[\(]*)?$/, Us = ([n, t = ""]) => {
1039
+ O = (n, t, e = {}) => (at(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new D(t, e).match(n));
1040
+ Rs = /^\*+([^+@!?\*\[\(]*)$/;
1041
+ Os = (n) => (t) => !t.startsWith(".") && t.endsWith(n);
1042
+ Fs = (n) => (t) => t.endsWith(n);
1043
+ Ds = (n) => (n = n.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(n));
1044
+ Ms = (n) => (n = n.toLowerCase(), (t) => t.toLowerCase().endsWith(n));
1045
+ Ns = /^\*+\.\*+$/;
1046
+ _s = (n) => !n.startsWith(".") && n.includes(".");
1047
+ Ls = (n) => n !== "." && n !== ".." && n.includes(".");
1048
+ Ws = /^\.\*+$/;
1049
+ Ps = (n) => n !== "." && n !== ".." && n.startsWith(".");
1050
+ js = /^\*+$/;
1051
+ Is = (n) => n.length !== 0 && !n.startsWith(".");
1052
+ zs = (n) => n.length !== 0 && n !== "." && n !== "..";
1053
+ Bs = /^\?+([^+@!?\*\[\(]*)?$/;
1054
+ Us = ([n, t = ""]) => {
1009
1055
  let e = Ce([n]);
1010
1056
  return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
1011
- }, $s = ([n, t = ""]) => {
1057
+ };
1058
+ $s = ([n, t = ""]) => {
1012
1059
  let e = Te([n]);
1013
1060
  return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
1014
- }, Gs = ([n, t = ""]) => {
1061
+ };
1062
+ Gs = ([n, t = ""]) => {
1015
1063
  let e = Te([n]);
1016
1064
  return t ? (s) => e(s) && s.endsWith(t) : e;
1017
- }, Hs = ([n, t = ""]) => {
1065
+ };
1066
+ Hs = ([n, t = ""]) => {
1018
1067
  let e = Ce([n]);
1019
1068
  return t ? (s) => e(s) && s.endsWith(t) : e;
1020
- }, Ce = ([n]) => {
1069
+ };
1070
+ Ce = ([n]) => {
1021
1071
  let t = n.length;
1022
1072
  return (e) => e.length === t && !e.startsWith(".");
1023
- }, Te = ([n]) => {
1073
+ };
1074
+ Te = ([n]) => {
1024
1075
  let t = n.length;
1025
1076
  return (e) => e.length === t && e !== "." && e !== "..";
1026
- }, Ae = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", xe = {
1077
+ };
1078
+ Ae = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
1079
+ xe = {
1027
1080
  win32: { sep: "\\" },
1028
1081
  posix: { sep: "/" }
1029
1082
  };
1030
1083
  O.sep = Ae === "win32" ? xe.win32.sep : xe.posix.sep;
1031
1084
  A = Symbol("globstar **");
1032
1085
  O.GLOBSTAR = A;
1033
- Vs = "[^/]*?", Ys = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", Xs = "(?:(?!(?:\\/|^)\\.).)*?", Js = (n, t = {}) => (e) => O(e, n, t);
1086
+ Vs = "[^/]*?";
1087
+ Ys = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
1088
+ Xs = "(?:(?!(?:\\/|^)\\.).)*?";
1089
+ Js = (n, t = {}) => (e) => O(e, n, t);
1034
1090
  O.filter = Js;
1035
- N = (n, t = {}) => Object.assign({}, n, t), Zs = (n) => {
1091
+ N = (n, t = {}) => Object.assign({}, n, t);
1092
+ Zs = (n) => {
1036
1093
  if (!n || typeof n != "object" || !Object.keys(n).length) return O;
1037
1094
  let t = O;
1038
1095
  return Object.assign((s, i, r = {}) => t(s, i, N(n, r)), {
@@ -1073,7 +1130,9 @@ var init_index_min = __esmMin((() => {
1073
1130
  return n = n.filter((i) => s.match(i)), s.options.nonull && !n.length && n.push(t), n;
1074
1131
  };
1075
1132
  O.match = ti;
1076
- ve = /[?*]|[+@!]\(.*?\)|\[|\]/, ei = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), D = class {
1133
+ ve = /[?*]|[+@!]\(.*?\)|\[|\]/;
1134
+ ei = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
1135
+ D = class {
1077
1136
  options;
1078
1137
  set;
1079
1138
  pattern;
@@ -1357,9 +1416,14 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
1357
1416
  O.Minimatch = D;
1358
1417
  O.escape = tt;
1359
1418
  O.unescape = W;
1360
- si = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, Oe = /* @__PURE__ */ new Set(), Vt = typeof process == "object" && process ? process : {}, Fe = (n, t, e, s) => {
1419
+ si = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
1420
+ Oe = /* @__PURE__ */ new Set();
1421
+ Vt = typeof process == "object" && process ? process : {};
1422
+ Fe = (n, t, e, s) => {
1361
1423
  typeof Vt.emitWarning == "function" ? Vt.emitWarning(n, t, e, s) : console.error(`[${e}] ${t}: ${n}`);
1362
- }, At = globalThis.AbortController, Re = globalThis.AbortSignal;
1424
+ };
1425
+ At = globalThis.AbortController;
1426
+ Re = globalThis.AbortSignal;
1363
1427
  if (typeof At > "u") {
1364
1428
  Re = class {
1365
1429
  onabort;
@@ -1387,11 +1451,14 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
1387
1451
  };
1388
1452
  }
1389
1453
  ii = (n) => !Oe.has(n);
1390
- q = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n), De = (n) => q(n) ? n <= Math.pow(2, 8) ? Uint8Array : n <= Math.pow(2, 16) ? Uint16Array : n <= Math.pow(2, 32) ? Uint32Array : n <= Number.MAX_SAFE_INTEGER ? Tt : null : null, Tt = class extends Array {
1454
+ q = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n);
1455
+ De = (n) => q(n) ? n <= Math.pow(2, 8) ? Uint8Array : n <= Math.pow(2, 16) ? Uint16Array : n <= Math.pow(2, 32) ? Uint32Array : n <= Number.MAX_SAFE_INTEGER ? Tt : null : null;
1456
+ Tt = class extends Array {
1391
1457
  constructor(n) {
1392
1458
  super(n), this.fill(0);
1393
1459
  }
1394
- }, ri = class ct {
1460
+ };
1461
+ ri = class ct {
1395
1462
  heap;
1396
1463
  length;
1397
1464
  static #t = !1;
@@ -1412,7 +1479,8 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
1412
1479
  pop() {
1413
1480
  return this.heap[--this.length];
1414
1481
  }
1415
- }, ft = class Me {
1482
+ };
1483
+ ft = class Me {
1416
1484
  #t;
1417
1485
  #s;
1418
1486
  #n;
@@ -1955,7 +2023,47 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
1955
2023
  Ne = typeof process == "object" && process ? process : {
1956
2024
  stdout: null,
1957
2025
  stderr: null
1958
- }, oi = (n) => !!n && typeof n == "object" && (n instanceof V || n instanceof Pe || hi(n) || ai(n)), hi = (n) => !!n && typeof n == "object" && n instanceof EventEmitter && typeof n.pipe == "function" && n.pipe !== Pe.Writable.prototype.pipe, ai = (n) => !!n && typeof n == "object" && n instanceof EventEmitter && typeof n.write == "function" && typeof n.end == "function", G = Symbol("EOF"), H = Symbol("maybeEmitEnd"), K = Symbol("emittedEnd"), kt = Symbol("emittingEnd"), ut = Symbol("emittedError"), Rt = Symbol("closed"), _e = Symbol("read"), Ot = Symbol("flush"), Le = Symbol("flushChunk"), P = Symbol("encoding"), et = Symbol("decoder"), v = Symbol("flowing"), dt = Symbol("paused"), st = Symbol("resume"), C = Symbol("buffer"), F = Symbol("pipes"), T = Symbol("bufferLength"), Yt = Symbol("bufferPush"), Ft = Symbol("bufferShift"), k = Symbol("objectMode"), x = Symbol("destroyed"), Xt = Symbol("error"), Jt = Symbol("emitData"), We = Symbol("emitEnd"), Zt = Symbol("emitEnd2"), B = Symbol("async"), Qt = Symbol("abort"), Dt = Symbol("aborted"), pt = Symbol("signal"), Y = Symbol("dataListeners"), M = Symbol("discarded"), mt = (n) => Promise.resolve().then(n), li = (n) => n(), ci = (n) => n === "end" || n === "finish" || n === "prefinish", fi = (n) => n instanceof ArrayBuffer || !!n && typeof n == "object" && n.constructor && n.constructor.name === "ArrayBuffer" && n.byteLength >= 0, ui$1 = (n) => !Buffer.isBuffer(n) && ArrayBuffer.isView(n), Mt = class {
2026
+ };
2027
+ oi = (n) => !!n && typeof n == "object" && (n instanceof V || n instanceof Pe || hi(n) || ai(n));
2028
+ hi = (n) => !!n && typeof n == "object" && n instanceof EventEmitter && typeof n.pipe == "function" && n.pipe !== Pe.Writable.prototype.pipe;
2029
+ ai = (n) => !!n && typeof n == "object" && n instanceof EventEmitter && typeof n.write == "function" && typeof n.end == "function";
2030
+ G = Symbol("EOF");
2031
+ H = Symbol("maybeEmitEnd");
2032
+ K = Symbol("emittedEnd");
2033
+ kt = Symbol("emittingEnd");
2034
+ ut = Symbol("emittedError");
2035
+ Rt = Symbol("closed");
2036
+ _e = Symbol("read");
2037
+ Ot = Symbol("flush");
2038
+ Le = Symbol("flushChunk");
2039
+ P = Symbol("encoding");
2040
+ et = Symbol("decoder");
2041
+ v = Symbol("flowing");
2042
+ dt = Symbol("paused");
2043
+ st = Symbol("resume");
2044
+ C = Symbol("buffer");
2045
+ F = Symbol("pipes");
2046
+ T = Symbol("bufferLength");
2047
+ Yt = Symbol("bufferPush");
2048
+ Ft = Symbol("bufferShift");
2049
+ k = Symbol("objectMode");
2050
+ x = Symbol("destroyed");
2051
+ Xt = Symbol("error");
2052
+ Jt = Symbol("emitData");
2053
+ We = Symbol("emitEnd");
2054
+ Zt = Symbol("emitEnd2");
2055
+ B = Symbol("async");
2056
+ Qt = Symbol("abort");
2057
+ Dt = Symbol("aborted");
2058
+ pt = Symbol("signal");
2059
+ Y = Symbol("dataListeners");
2060
+ M = Symbol("discarded");
2061
+ mt = (n) => Promise.resolve().then(n);
2062
+ li = (n) => n();
2063
+ ci = (n) => n === "end" || n === "finish" || n === "prefinish";
2064
+ fi = (n) => n instanceof ArrayBuffer || !!n && typeof n == "object" && n.constructor && n.constructor.name === "ArrayBuffer" && n.byteLength >= 0;
2065
+ ui$1 = (n) => !Buffer.isBuffer(n) && ArrayBuffer.isView(n);
2066
+ Mt = class {
1959
2067
  src;
1960
2068
  dest;
1961
2069
  opts;
@@ -1970,14 +2078,18 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
1970
2078
  end() {
1971
2079
  this.unpipe(), this.opts.end && this.dest.end();
1972
2080
  }
1973
- }, te = class extends Mt {
2081
+ };
2082
+ te = class extends Mt {
1974
2083
  unpipe() {
1975
2084
  this.src.removeListener("error", this.proxyErrors), super.unpipe();
1976
2085
  }
1977
2086
  constructor(t, e, s) {
1978
2087
  super(t, e, s), this.proxyErrors = (i) => this.dest.emit("error", i), t.on("error", this.proxyErrors);
1979
2088
  }
1980
- }, di = (n) => !!n.objectMode, pi = (n) => !n.objectMode && !!n.encoding && n.encoding !== "buffer", V = class extends EventEmitter {
2089
+ };
2090
+ di = (n) => !!n.objectMode;
2091
+ pi = (n) => !n.objectMode && !!n.encoding && n.encoding !== "buffer";
2092
+ V = class extends EventEmitter {
1981
2093
  [v] = !1;
1982
2094
  [dt] = !1;
1983
2095
  [F] = [];
@@ -2274,7 +2386,8 @@ while (this[Le](this[Ft]()) && this[C].length);
2274
2386
  static get isStream() {
2275
2387
  return oi;
2276
2388
  }
2277
- }, wt = {
2389
+ };
2390
+ wt = {
2278
2391
  lstatSync: lstatSync$1,
2279
2392
  readdir,
2280
2393
  readdirSync: readdirSync$1,
@@ -2286,35 +2399,66 @@ while (this[Le](this[Ft]()) && this[C].length);
2286
2399
  readlink,
2287
2400
  realpath
2288
2401
  }
2289
- }, Ue = (n) => !n || n === wt || n === xi ? wt : {
2402
+ };
2403
+ Ue = (n) => !n || n === wt || n === xi ? wt : {
2290
2404
  ...wt,
2291
2405
  ...n,
2292
2406
  promises: {
2293
2407
  ...wt.promises,
2294
2408
  ...n.promises || {}
2295
2409
  }
2296
- }, $e = /^\\\\\?\\([a-z]:)\\?$/i, Ri = (n) => n.replace(/\//g, "\\").replace($e, "$1\\"), Oi = /[\\\/]/, L = 0, Ge = 1, He = 2, U = 4, qe = 6, Ke = 8, X = 10, Ve = 12, _ = 15, gt = ~_, se = 16, je = 32, yt = 64, j = 128, Nt = 256, Lt = 512, Ie = yt | j | Lt, Fi = 1023, ie = (n) => n.isFile() ? Ke : n.isDirectory() ? U : n.isSymbolicLink() ? X : n.isCharacterDevice() ? He : n.isBlockDevice() ? qe : n.isSocket() ? Ve : n.isFIFO() ? Ge : L, ze = new ft({ max: 2 ** 12 }), bt = (n) => {
2410
+ };
2411
+ $e = /^\\\\\?\\([a-z]:)\\?$/i;
2412
+ Ri = (n) => n.replace(/\//g, "\\").replace($e, "$1\\");
2413
+ Oi = /[\\\/]/;
2414
+ L = 0;
2415
+ Ge = 1;
2416
+ He = 2;
2417
+ U = 4;
2418
+ qe = 6;
2419
+ Ke = 8;
2420
+ X = 10;
2421
+ Ve = 12;
2422
+ _ = 15;
2423
+ gt = ~_;
2424
+ se = 16;
2425
+ je = 32;
2426
+ yt = 64;
2427
+ j = 128;
2428
+ Nt = 256;
2429
+ Lt = 512;
2430
+ Ie = yt | j | Lt;
2431
+ Fi = 1023;
2432
+ ie = (n) => n.isFile() ? Ke : n.isDirectory() ? U : n.isSymbolicLink() ? X : n.isCharacterDevice() ? He : n.isBlockDevice() ? qe : n.isSocket() ? Ve : n.isFIFO() ? Ge : L;
2433
+ ze = new ft({ max: 2 ** 12 });
2434
+ bt = (n) => {
2297
2435
  let t = ze.get(n);
2298
2436
  if (t) return t;
2299
2437
  let e = n.normalize("NFKD");
2300
2438
  return ze.set(n, e), e;
2301
- }, Be = new ft({ max: 2 ** 12 }), _t = (n) => {
2439
+ };
2440
+ Be = new ft({ max: 2 ** 12 });
2441
+ _t = (n) => {
2302
2442
  let t = Be.get(n);
2303
2443
  if (t) return t;
2304
2444
  let e = bt(n.toLowerCase());
2305
2445
  return Be.set(n, e), e;
2306
- }, Wt = class extends ft {
2446
+ };
2447
+ Wt = class extends ft {
2307
2448
  constructor() {
2308
2449
  super({ max: 256 });
2309
2450
  }
2310
- }, ne = class extends ft {
2451
+ };
2452
+ ne = class extends ft {
2311
2453
  constructor(t = 16 * 1024) {
2312
2454
  super({
2313
2455
  maxSize: t,
2314
2456
  sizeCalculation: (e) => e.length + 1
2315
2457
  });
2316
2458
  }
2317
- }, Ye = Symbol("PathScurry setAsCwd"), R = class {
2459
+ };
2460
+ Ye = Symbol("PathScurry setAsCwd");
2461
+ R = class {
2318
2462
  name;
2319
2463
  root;
2320
2464
  roots;
@@ -2727,7 +2871,8 @@ while (this[Le](this[Ft]()) && this[C].length);
2727
2871
  for (; i && i.parent;) e.add(i), i.#x = s.join(this.sep), i.#A = s.join("/"), i = i.parent, s.push("..");
2728
2872
  for (i = t; i && i.parent && !e.has(i);) i.#x = void 0, i.#A = void 0, i = i.parent;
2729
2873
  }
2730
- }, Pt = class n extends R {
2874
+ };
2875
+ Pt = class n extends R {
2731
2876
  sep = "\\";
2732
2877
  splitSep = Oi;
2733
2878
  constructor(t, e = L, s, i, r, o, h) {
@@ -2747,7 +2892,8 @@ while (this[Le](this[Ft]()) && this[C].length);
2747
2892
  sameRoot(t, e = this.root.name) {
2748
2893
  return t = t.toUpperCase().replace(/\//g, "\\").replace($e, "$1\\"), t === e;
2749
2894
  }
2750
- }, jt = class n extends R {
2895
+ };
2896
+ jt = class n extends R {
2751
2897
  splitSep = "/";
2752
2898
  sep = "/";
2753
2899
  constructor(t, e = L, s, i, r, o, h) {
@@ -2762,7 +2908,8 @@ while (this[Le](this[Ft]()) && this[C].length);
2762
2908
  newChild(t, e = L, s = {}) {
2763
2909
  return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
2764
2910
  }
2765
- }, It = class {
2911
+ };
2912
+ It = class {
2766
2913
  root;
2767
2914
  rootPath;
2768
2915
  roots;
@@ -3006,7 +3153,8 @@ while (this[Le](this[Ft]()) && this[C].length);
3006
3153
  let e = this.cwd;
3007
3154
  this.cwd = typeof t == "string" ? this.cwd.resolve(t) : t, this.cwd[Ye](e);
3008
3155
  }
3009
- }, it = class extends It {
3156
+ };
3157
+ it = class extends It {
3010
3158
  sep = "\\";
3011
3159
  constructor(t = process.cwd(), e = {}) {
3012
3160
  let { nocase: s = !0 } = e;
@@ -3025,7 +3173,8 @@ while (this[Le](this[Ft]()) && this[C].length);
3025
3173
  isAbsolute(t) {
3026
3174
  return t.startsWith("/") || t.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(t);
3027
3175
  }
3028
- }, rt = class extends It {
3176
+ };
3177
+ rt = class extends It {
3029
3178
  sep = "/";
3030
3179
  constructor(t = process.cwd(), e = {}) {
3031
3180
  let { nocase: s = !1 } = e;
@@ -3043,7 +3192,8 @@ while (this[Le](this[Ft]()) && this[C].length);
3043
3192
  isAbsolute(t) {
3044
3193
  return t.startsWith("/");
3045
3194
  }
3046
- }, St = class extends rt {
3195
+ };
3196
+ St = class extends rt {
3047
3197
  constructor(t = process.cwd(), e = {}) {
3048
3198
  let { nocase: s = !0 } = e;
3049
3199
  super(t, {
@@ -3054,7 +3204,10 @@ while (this[Le](this[Ft]()) && this[C].length);
3054
3204
  };
3055
3205
  process.platform;
3056
3206
  Xe = process.platform === "win32" ? it : process.platform === "darwin" ? St : rt;
3057
- Di = (n) => n.length >= 1, Mi = (n) => n.length >= 1, Ni = Symbol.for("nodejs.util.inspect.custom"), nt = class n {
3207
+ Di = (n) => n.length >= 1;
3208
+ Mi = (n) => n.length >= 1;
3209
+ Ni = Symbol.for("nodejs.util.inspect.custom");
3210
+ nt = class n {
3058
3211
  #t;
3059
3212
  #s;
3060
3213
  #n;
@@ -3144,7 +3297,8 @@ while (this[Le](this[Ft]()) && this[C].length);
3144
3297
  return this.#n === 0 || !this.isGlobstar() || !this.#u ? !1 : (this.#u = !1, !0);
3145
3298
  }
3146
3299
  };
3147
- _i = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", ot = class {
3300
+ _i = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
3301
+ ot = class {
3148
3302
  relative;
3149
3303
  relativeChildren;
3150
3304
  absolute;
@@ -3203,7 +3357,8 @@ while (this[Le](this[Ft]()) && this[C].length);
3203
3357
  let s = t.fullpath(), i = this.store.get(s);
3204
3358
  i ? i.add(e.globString()) : this.store.set(s, /* @__PURE__ */ new Set([e.globString()]));
3205
3359
  }
3206
- }, he = class {
3360
+ };
3361
+ he = class {
3207
3362
  store = /* @__PURE__ */ new Map();
3208
3363
  add(t, e, s) {
3209
3364
  let i = (e ? 2 : 0) | (s ? 1 : 0), r = this.store.get(t);
@@ -3216,7 +3371,8 @@ while (this[Le](this[Ft]()) && this[C].length);
3216
3371
  !!(e & 1)
3217
3372
  ]);
3218
3373
  }
3219
- }, ae = class {
3374
+ };
3375
+ ae = class {
3220
3376
  store = /* @__PURE__ */ new Map();
3221
3377
  add(t, e) {
3222
3378
  if (!t.canReaddir()) return;
@@ -3234,7 +3390,8 @@ while (this[Le](this[Ft]()) && this[C].length);
3234
3390
  keys() {
3235
3391
  return [...this.store.keys()].filter((t) => t.canReaddir());
3236
3392
  }
3237
- }, Et = class n {
3393
+ };
3394
+ Et = class n {
3238
3395
  hasWalkedCache;
3239
3396
  matches = new he();
3240
3397
  subwalks = new ae();
@@ -3314,7 +3471,8 @@ while (this[Le](this[Ft]()) && this[C].length);
3314
3471
  t.isNamed(e) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
3315
3472
  }
3316
3473
  };
3317
- Li = (n, t) => typeof n == "string" ? new ot([n], t) : Array.isArray(n) ? new ot(n, t) : n, zt = class {
3474
+ Li = (n, t) => typeof n == "string" ? new ot([n], t) : Array.isArray(n) ? new ot(n, t) : n;
3475
+ zt = class {
3318
3476
  path;
3319
3477
  patterns;
3320
3478
  opts;
@@ -3470,7 +3628,8 @@ while (this[Le](this[Ft]()) && this[C].length);
3470
3628
  for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2Sync(h, a, s.child(), o);
3471
3629
  o();
3472
3630
  }
3473
- }, xt = class extends zt {
3631
+ };
3632
+ xt = class extends zt {
3474
3633
  matches = /* @__PURE__ */ new Set();
3475
3634
  constructor(t, e, s) {
3476
3635
  super(t, e, s);
@@ -3492,7 +3651,8 @@ while (this[Le](this[Ft]()) && this[C].length);
3492
3651
  if (this.signal?.aborted) throw this.signal.reason;
3493
3652
  }), this.matches;
3494
3653
  }
3495
- }, vt = class extends zt {
3654
+ };
3655
+ vt = class extends zt {
3496
3656
  results;
3497
3657
  constructor(t, e, s) {
3498
3658
  super(t, e, s), this.results = new V({
@@ -3513,7 +3673,8 @@ while (this[Le](this[Ft]()) && this[C].length);
3513
3673
  return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => this.results.end()), this.results;
3514
3674
  }
3515
3675
  };
3516
- Pi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", I = class {
3676
+ Pi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
3677
+ I = class {
3517
3678
  absolute;
3518
3679
  cwd;
3519
3680
  root;
@@ -3637,10 +3798,15 @@ while (this[Le](this[Ft]()) && this[C].length);
3637
3798
  for (let e of n) if (new D(e, t).hasMagic()) return !0;
3638
3799
  return !1;
3639
3800
  };
3640
- ji = Bt, Ii = Object.assign(Qe, { sync: Bt }), zi = Ut, Bi = Object.assign(es, { sync: Ut }), Ui = Object.assign(ts$1, {
3801
+ ji = Bt;
3802
+ Ii = Object.assign(Qe, { sync: Bt });
3803
+ zi = Ut;
3804
+ Bi = Object.assign(es, { sync: Ut });
3805
+ Ui = Object.assign(ts$1, {
3641
3806
  stream: Bt,
3642
3807
  iterate: Ut
3643
- }), Ze = Object.assign(Je, {
3808
+ });
3809
+ Ze = Object.assign(Je, {
3644
3810
  glob: Je,
3645
3811
  globSync: ts$1,
3646
3812
  sync: Ui,
@@ -6503,9 +6669,9 @@ var require_semver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6503
6669
  }));
6504
6670
  //#endregion
6505
6671
  //#region src/lib/toolchainVersion.ts
6506
- const require$7 = createRequire(import.meta.url);
6672
+ const require$8 = createRequire(import.meta.url);
6507
6673
  function bundledToolchainVersion() {
6508
- const pkgPath = require$7.resolve("@ariestools/toolchain/package.json");
6674
+ const pkgPath = require$8.resolve("@ariestools/toolchain/package.json");
6509
6675
  const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
6510
6676
  if (pkg.version == null || pkg.version.length === 0) throw new Error("Could not read @ariestools/toolchain version");
6511
6677
  return pkg.version;
@@ -6652,8 +6818,8 @@ function setGitConfig(key, value) {
6652
6818
  }
6653
6819
  //#endregion
6654
6820
  //#region src/lib/gitignoreTemplate.ts
6655
- const require$6 = createRequire(import.meta.url);
6656
- const packageRoot$1 = PATH.dirname(require$6.resolve("@ariestools/toolchain/package.json"));
6821
+ const require$7 = createRequire(import.meta.url);
6822
+ const packageRoot$1 = PATH.dirname(require$7.resolve("@ariestools/toolchain/package.json"));
6657
6823
  const templatesDir = PATH.resolve(packageRoot$1, "templates", "gitignore");
6658
6824
  const gitignoreTemplate = () => readFileSync(PATH.resolve(templatesDir, "template.gitignore"), "utf8");
6659
6825
  //#endregion
@@ -6666,6 +6832,151 @@ const latestVersions = {
6666
6832
  yarn: "4.13.0"
6667
6833
  };
6668
6834
  //#endregion
6835
+ //#region src/lib/licenseCheck/checkLicenses.ts
6836
+ /**
6837
+ * Allowlist-style license check used by `xy license`.
6838
+ */
6839
+ /** Default SPDX-ish identifiers accepted by `xy license`. */
6840
+ const DEFAULT_ALLOWED_LICENSES = [
6841
+ "MIT",
6842
+ "MIT*",
6843
+ "ISC",
6844
+ "Apache-2.0",
6845
+ "BSD",
6846
+ "BSD*",
6847
+ "BSD-2-Clause",
6848
+ "BSD-3-Clause",
6849
+ "BlueOak-1.0.0",
6850
+ "CC-BY-4.0",
6851
+ "Unlicense",
6852
+ "CC-BY-3.0",
6853
+ "CC0-1.0",
6854
+ "LGPL-3.0-only",
6855
+ "LGPL-3.0",
6856
+ "LGPL-3.0-or-later",
6857
+ "Python-2.0"
6858
+ ];
6859
+ /**
6860
+ * True when the license is missing (unknown) or at least one `OR` branch is
6861
+ * on the allowlist. Parenthesized SPDX expressions like `(MIT OR Apache-2.0)`
6862
+ * are unwrapped first.
6863
+ */
6864
+ function isAllowedLicense(license, allowed) {
6865
+ if (license == null || license.length === 0) return true;
6866
+ const trimmed = license.trim();
6867
+ return (trimmed.startsWith("(") && trimmed.endsWith(")") ? trimmed.slice(1, -1).trim() : trimmed).split(/\s+OR\s+/i).some((branch) => allowed.has(branch.trim()));
6868
+ }
6869
+ /**
6870
+ * Returns findings for packages whose declared licenses are not on the
6871
+ * allowlist. Empty license arrays are treated as allowed (unknown).
6872
+ */
6873
+ function findDisallowedLicenses(packages, allowed = new Set(DEFAULT_ALLOWED_LICENSES)) {
6874
+ const findings = [];
6875
+ for (const [packageName, info] of Object.entries(packages)) {
6876
+ const licenses = Array.isArray(info.licenses) ? info.licenses : info.licenses === void 0 ? [] : [info.licenses];
6877
+ for (const license of licenses) if (!isAllowedLicense(license, allowed)) findings.push({
6878
+ packageName,
6879
+ license
6880
+ });
6881
+ }
6882
+ return findings;
6883
+ }
6884
+ //#endregion
6885
+ //#region src/lib/licenseCheck/readPackageLicense.ts
6886
+ function licenseType(value) {
6887
+ if (value === void 0) return void 0;
6888
+ if (typeof value === "string") {
6889
+ const trimmed = value.trim();
6890
+ return trimmed.length > 0 ? trimmed : void 0;
6891
+ }
6892
+ const type = value.type?.trim();
6893
+ return type !== void 0 && type.length > 0 ? type : void 0;
6894
+ }
6895
+ /** Returns license identifiers declared on a package.json (may be empty). */
6896
+ function readPackageLicenses(manifest) {
6897
+ const fromLicense = licenseType(manifest.license);
6898
+ if (fromLicense !== void 0) return [fromLicense];
6899
+ if (Array.isArray(manifest.licenses)) {
6900
+ const types = manifest.licenses.map((entry) => licenseType(entry)).filter((entry) => entry !== void 0);
6901
+ if (types.length > 0) return types;
6902
+ }
6903
+ return [];
6904
+ }
6905
+ /** Production dependency names declared by a package (runtime + optional). */
6906
+ function productionDependencyNames(manifest) {
6907
+ return [...Object.keys(manifest.dependencies ?? {}), ...Object.keys(manifest.optionalDependencies ?? {})];
6908
+ }
6909
+ //#endregion
6910
+ //#region src/lib/licenseCheck/collectProductionLicenses.ts
6911
+ function readManifest$1(packageDir) {
6912
+ const pkgPath = PATH.join(packageDir, "package.json");
6913
+ if (!fs.existsSync(pkgPath)) return void 0;
6914
+ try {
6915
+ return JSON.parse(fs.readFileSync(pkgPath, "utf8"));
6916
+ } catch {
6917
+ return;
6918
+ }
6919
+ }
6920
+ /**
6921
+ * Resolves an installed package directory for `name`, walking up from
6922
+ * `fromDir` to honor hoisted / pnpm-style layouts.
6923
+ */
6924
+ function resolveInstalledPackageDir(name, fromDir) {
6925
+ const segments = name.startsWith("@") ? name.split("/") : [name];
6926
+ let current = PATH.resolve(fromDir);
6927
+ while (true) {
6928
+ const candidate = PATH.join(current, "node_modules", ...segments);
6929
+ if (fs.existsSync(PATH.join(candidate, "package.json"))) try {
6930
+ return fs.realpathSync(candidate);
6931
+ } catch {
6932
+ return candidate;
6933
+ }
6934
+ const parent = PATH.dirname(current);
6935
+ if (parent === current) return void 0;
6936
+ current = parent;
6937
+ }
6938
+ }
6939
+ function packageKey(manifest, fallbackDir) {
6940
+ return `${manifest.name ?? PATH.basename(fallbackDir)}@${manifest.version ?? "0.0.0"}`;
6941
+ }
6942
+ /**
6943
+ * Walks the production dependency tree rooted at `startDir` (a package with a
6944
+ * package.json) and returns license metadata for every reachable installed
6945
+ * package. The root package itself is omitted — only its dependency tree is
6946
+ * reported (matches `xy license` "check licenses of dependencies").
6947
+ */
6948
+ function collectProductionLicenses(startDir) {
6949
+ const root = PATH.resolve(startDir);
6950
+ const rootManifest = readManifest$1(root);
6951
+ if (rootManifest === void 0) return {};
6952
+ const result = {};
6953
+ const queue = [];
6954
+ const seenDirs = /* @__PURE__ */ new Set();
6955
+ const enqueueDeps = (packageDir, manifest) => {
6956
+ for (const depName of productionDependencyNames(manifest)) {
6957
+ const resolved = resolveInstalledPackageDir(depName, packageDir);
6958
+ if (resolved === void 0) continue;
6959
+ if (seenDirs.has(resolved)) continue;
6960
+ seenDirs.add(resolved);
6961
+ queue.push(resolved);
6962
+ }
6963
+ };
6964
+ enqueueDeps(root, rootManifest);
6965
+ while (queue.length > 0) {
6966
+ const packageDir = queue.shift();
6967
+ if (packageDir === void 0) break;
6968
+ const manifest = readManifest$1(packageDir);
6969
+ if (manifest === void 0) continue;
6970
+ const key = packageKey(manifest, packageDir);
6971
+ if (result[key] === void 0) result[key] = {
6972
+ path: packageDir,
6973
+ licenses: readPackageLicenses(manifest)
6974
+ };
6975
+ enqueueDeps(packageDir, manifest);
6976
+ }
6977
+ return result;
6978
+ }
6979
+ //#endregion
6669
6980
  //#region ../../node_modules/.pnpm/resolve-from@4.0.0/node_modules/resolve-from/index.js
6670
6981
  var require_resolve_from = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6671
6982
  const path$4 = __require("path");
@@ -6984,7 +7295,9 @@ var require_build = /* @__PURE__ */ __commonJSMin(((exports) => {
6984
7295
  //#endregion
6985
7296
  //#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
6986
7297
  var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6987
- let p = process || {}, argv = p.argv || [], env = p.env || {};
7298
+ let p = process || {};
7299
+ let argv = p.argv || [];
7300
+ let env = p.env || {};
6988
7301
  let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
6989
7302
  let formatter = (open, close, replace = open) => (input) => {
6990
7303
  let string = "" + input, index = string.indexOf(close, open.length);
@@ -10154,7 +10467,8 @@ var require_dumper = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10154
10467
  } else throw new YAMLException("code point within a string may not be greater than 0xFFFFFFFF");
10155
10468
  return "\\" + handle + common.repeat("0", length - string.length) + string;
10156
10469
  }
10157
- var QUOTING_TYPE_SINGLE = 1, QUOTING_TYPE_DOUBLE = 2;
10470
+ var QUOTING_TYPE_SINGLE = 1;
10471
+ var QUOTING_TYPE_DOUBLE = 2;
10158
10472
  function State(options) {
10159
10473
  this.schema = options["schema"] || DEFAULT_SCHEMA;
10160
10474
  this.indent = Math.max(1, options["indent"] || 2);
@@ -10235,7 +10549,11 @@ var require_dumper = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10235
10549
  function needIndentIndicator(string) {
10236
10550
  return /^\n* /.test(string);
10237
10551
  }
10238
- var STYLE_PLAIN = 1, STYLE_SINGLE = 2, STYLE_LITERAL = 3, STYLE_FOLDED = 4, STYLE_DOUBLE = 5;
10552
+ var STYLE_PLAIN = 1;
10553
+ var STYLE_SINGLE = 2;
10554
+ var STYLE_LITERAL = 3;
10555
+ var STYLE_FOLDED = 4;
10556
+ var STYLE_DOUBLE = 5;
10239
10557
  function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
10240
10558
  var i;
10241
10559
  var char = 0;
@@ -20103,8 +20421,8 @@ async function withEnvelope(command, action) {
20103
20421
  }
20104
20422
  //#endregion
20105
20423
  //#region src/lib/repoTemplates.ts
20106
- const require$5 = createRequire(import.meta.url);
20107
- const packageRoot = PATH.dirname(require$5.resolve("@ariestools/toolchain/package.json"));
20424
+ const require$6 = createRequire(import.meta.url);
20425
+ const packageRoot = PATH.dirname(require$6.resolve("@ariestools/toolchain/package.json"));
20108
20426
  const repoTemplatesDir = PATH.resolve(packageRoot, "templates", "repo");
20109
20427
  function collectFiles$1(dir, prefix) {
20110
20428
  const results = [];
@@ -21089,13 +21407,13 @@ async function fetchAllRegistryInfo(packageNames, options = {}) {
21089
21407
  return await fetchAllRegistryInfoDirect(packageNames, options);
21090
21408
  }
21091
21409
  //#endregion
21092
- //#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.1.0/node_modules/@inquirer/core/dist/lib/key.js
21410
+ //#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.1.1/node_modules/@inquirer/core/dist/lib/key.js
21093
21411
  const isUpKey = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p";
21094
21412
  const isDownKey = (key, keybindings = []) => key.name === "down" || keybindings.includes("vim") && key.name === "j" || keybindings.includes("emacs") && key.ctrl && key.name === "n";
21095
21413
  const isSpaceKey = (key) => key.name === "space";
21096
21414
  const isEnterKey = (key) => key.name === "enter" || key.name === "return";
21097
21415
  //#endregion
21098
- //#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.1.0/node_modules/@inquirer/core/dist/lib/errors.js
21416
+ //#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.1.1/node_modules/@inquirer/core/dist/lib/errors.js
21099
21417
  var AbortPromptError = class extends Error {
21100
21418
  name = "AbortPromptError";
21101
21419
  message = "Prompt was aborted";
@@ -21118,7 +21436,7 @@ var ValidationError = class extends Error {
21118
21436
  name = "ValidationError";
21119
21437
  };
21120
21438
  //#endregion
21121
- //#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.1.0/node_modules/@inquirer/core/dist/lib/hook-engine.js
21439
+ //#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.1.1/node_modules/@inquirer/core/dist/lib/hook-engine.js
21122
21440
  const hookStorage = new AsyncLocalStorage();
21123
21441
  function createStore(rl) {
21124
21442
  return {
@@ -21214,7 +21532,7 @@ const effectScheduler = {
21214
21532
  }
21215
21533
  };
21216
21534
  //#endregion
21217
- //#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.1.0/node_modules/@inquirer/core/dist/lib/use-state.js
21535
+ //#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.1.1/node_modules/@inquirer/core/dist/lib/use-state.js
21218
21536
  function isFactory(value) {
21219
21537
  return typeof value === "function";
21220
21538
  }
@@ -21233,7 +21551,7 @@ function useState(defaultValue) {
21233
21551
  });
21234
21552
  }
21235
21553
  //#endregion
21236
- //#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.1.0/node_modules/@inquirer/core/dist/lib/use-effect.js
21554
+ //#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.1.1/node_modules/@inquirer/core/dist/lib/use-effect.js
21237
21555
  function useEffect(cb, depArray) {
21238
21556
  withPointer((pointer) => {
21239
21557
  const oldDeps = pointer.get();
@@ -21242,12 +21560,12 @@ function useEffect(cb, depArray) {
21242
21560
  });
21243
21561
  }
21244
21562
  //#endregion
21245
- //#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.1.0/node_modules/@inquirer/core/dist/lib/use-ref.js
21563
+ //#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.1.1/node_modules/@inquirer/core/dist/lib/use-ref.js
21246
21564
  function useRef(val) {
21247
21565
  return useState({ current: val })[0];
21248
21566
  }
21249
21567
  //#endregion
21250
- //#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.1.0/node_modules/@inquirer/core/dist/lib/use-keypress.js
21568
+ //#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.1.1/node_modules/@inquirer/core/dist/lib/use-keypress.js
21251
21569
  function useKeypress(userHandler) {
21252
21570
  const signal = useRef(userHandler);
21253
21571
  signal.current = userHandler;
@@ -21575,7 +21893,7 @@ function wrapAnsi$1(string, columns, options) {
21575
21893
  return String(string).normalize().split(CRLF_OR_LF).map((line) => exec$1(line, columns, options)).join("\n");
21576
21894
  }
21577
21895
  //#endregion
21578
- //#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.1.0/node_modules/@inquirer/core/dist/lib/utils.js
21896
+ //#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.1.1/node_modules/@inquirer/core/dist/lib/utils.js
21579
21897
  var import_cli_width = /* @__PURE__ */ __toESM(require_cli_width(), 1);
21580
21898
  /**
21581
21899
  * Force line returns at specific width. This function is ANSI code friendly and it'll
@@ -21913,7 +22231,7 @@ const eraseLine = "\x1B[2K";
21913
22231
  /** Erase the specified number of lines above the cursor */
21914
22232
  const eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + "\x1B[2K\x1B[G" : "";
21915
22233
  //#endregion
21916
- //#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.1.0/node_modules/@inquirer/core/dist/lib/screen-manager.js
22234
+ //#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.1.1/node_modules/@inquirer/core/dist/lib/screen-manager.js
21917
22235
  const height = (content) => content.split("\n").length;
21918
22236
  const lastLine = (content) => content.split("\n").pop() ?? "";
21919
22237
  var ScreenManager = class {
@@ -21969,7 +22287,7 @@ var ScreenManager = class {
21969
22287
  }
21970
22288
  };
21971
22289
  //#endregion
21972
- //#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.1.0/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
22290
+ //#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.1.1/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
21973
22291
  var PromisePolyfill = class extends Promise {
21974
22292
  static withResolver() {
21975
22293
  let resolve;
@@ -21985,7 +22303,7 @@ var PromisePolyfill = class extends Promise {
21985
22303
  }
21986
22304
  };
21987
22305
  //#endregion
21988
- //#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.1.0/node_modules/@inquirer/core/dist/lib/create-prompt.js
22306
+ //#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.1.1/node_modules/@inquirer/core/dist/lib/create-prompt.js
21989
22307
  var import_lib = /* @__PURE__ */ __toESM(require_lib(), 1);
21990
22308
  const nativeSetImmediate = globalThis.setImmediate;
21991
22309
  function getCallSites() {
@@ -24556,7 +24874,7 @@ function getReExportSpecs(file) {
24556
24874
  }
24557
24875
  //#endregion
24558
24876
  //#region src/actions/barrel/resolveBarrel.ts
24559
- const require$4 = createRequire(import.meta.url);
24877
+ const require$5 = createRequire(import.meta.url);
24560
24878
  function findPackageRoot(entry, pkg) {
24561
24879
  let dir = PATH.dirname(entry);
24562
24880
  for (;;) {
@@ -24578,10 +24896,10 @@ function findPackageRoot(entry, pkg) {
24578
24896
  */
24579
24897
  function resolvePackageDir(pkg, fromDir) {
24580
24898
  try {
24581
- return PATH.dirname(require$4.resolve(`${pkg}/package.json`, { paths: [fromDir] }));
24899
+ return PATH.dirname(require$5.resolve(`${pkg}/package.json`, { paths: [fromDir] }));
24582
24900
  } catch {}
24583
24901
  try {
24584
- return findPackageRoot(require$4.resolve(pkg, { paths: [fromDir] }), pkg);
24902
+ return findPackageRoot(require$5.resolve(pkg, { paths: [fromDir] }), pkg);
24585
24903
  } catch {
24586
24904
  return;
24587
24905
  }
@@ -30234,13 +30552,27 @@ const deplint = async ({ pkg, classifier, deps, devDeps, fix, peerDeps, verbose,
30234
30552
  //#region src/actions/lintNextWorker.ts
30235
30553
  const lintNextIgnorePatterns = ["packages/**"];
30236
30554
  const lintNextResultMarker = "__XY_LINT_NEXT_RESULT__";
30237
- const chalkImportUrl = pathToFileURL(createRequire(import.meta.url).resolve("chalk")).href;
30238
- const lintNextWorkerSource = String.raw`
30555
+ const require$4 = createRequire(import.meta.url);
30556
+ function resolveChalkImportUrl() {
30557
+ try {
30558
+ return pathToFileURL(require$4.resolve("chalk")).href;
30559
+ } catch {
30560
+ return pathToFileURL(require$4.resolve("chalk", { paths: [process.cwd()] })).href;
30561
+ }
30562
+ }
30563
+ const chalkImportUrl = resolveChalkImportUrl();
30564
+ /**
30565
+ * Long-lived worker: loads ESLint once, then processes NDJSON jobs from stdin.
30566
+ * Sharing a process amortizes plugin/config module load across packages
30567
+ * (~0.5–0.8s fixed tax per cold process in type-aware monorepos).
30568
+ */
30569
+ const lintPoolWorkerSource = String.raw`
30239
30570
  import path from 'node:path'
30571
+ import { performance } from 'node:perf_hooks'
30572
+ import readline from 'node:readline'
30240
30573
  import { ESLint } from 'eslint'
30241
30574
 
30242
30575
  const marker = ${JSON.stringify(lintNextResultMarker)}
30243
- const options = JSON.parse(process.env.XY_LINT_NEXT_OPTIONS ?? '{}')
30244
30576
  const cycleRuleFilePatterns = ${JSON.stringify([
30245
30577
  "**/*.ts",
30246
30578
  "**/*.tsx",
@@ -30256,6 +30588,7 @@ const cycleRuleFilePatterns = ${JSON.stringify([
30256
30588
  "**/*.d.mts",
30257
30589
  "**/*.d.cts"
30258
30590
  ])}
30591
+ const defaultIgnorePatterns = ${JSON.stringify(lintNextIgnorePatterns)}
30259
30592
  const { default: chalk } = await import(process.env.XY_LINT_NEXT_CHALK_URL)
30260
30593
  const colors = ['white', 'yellow', 'red']
30261
30594
  const severity = ['none', 'warning', 'error']
@@ -30295,44 +30628,68 @@ async function resolveAnalyzeOverrideConfig(cwd, analyzeTier) {
30295
30628
  return configs
30296
30629
  }
30297
30630
 
30298
- async function createLintEngine(cwd) {
30299
- if (options.analyzeTier) {
30300
- const overrideConfig = await resolveAnalyzeOverrideConfig(cwd, options.analyzeTier)
30631
+ function cycleOverrideBlock(options) {
30632
+ if (options.cycleDepth === undefined) return undefined
30633
+ return {
30634
+ files: cycleRuleFilePatterns,
30635
+ rules: { 'import-x/no-cycle': ['warn', { maxDepth: options.cycleDepth }] },
30636
+ }
30637
+ }
30638
+
30639
+ async function createLintEngine(cwd, options) {
30640
+ // analyzeTier (legacy) or configOverride force a recommendedConfig preset
30641
+ const overrideSpec = options.configOverride ?? options.analyzeTier
30642
+ if (overrideSpec) {
30643
+ let overrideConfig = await resolveAnalyzeOverrideConfig(cwd, overrideSpec)
30644
+ const cycleBlock = cycleOverrideBlock(options)
30645
+ if (cycleBlock !== undefined) {
30646
+ overrideConfig = [...overrideConfig, cycleBlock]
30647
+ }
30301
30648
  return new ESLint({
30302
30649
  cache: options.cache,
30303
30650
  cacheLocation: options.cacheLocation ?? path.join(cwd, '.eslintcache'),
30304
30651
  cacheStrategy: 'content',
30305
30652
  cwd,
30306
- fix: false,
30307
- ignorePatterns: options.ignorePatterns,
30653
+ // analyze never auto-fixes; light/type-checked overrides may
30654
+ fix: options.analyze === true ? false : options.fix === true,
30655
+ ignorePatterns: options.ignorePatterns ?? defaultIgnorePatterns,
30308
30656
  overrideConfig,
30309
30657
  overrideConfigFile: true,
30310
30658
  warnIgnored: false,
30311
30659
  })
30312
30660
  }
30313
30661
 
30314
- const cycleOverrideConfig = options.cycleDepth === undefined
30315
- ? undefined
30316
- : {
30317
- files: cycleRuleFilePatterns,
30318
- rules: { 'import-x/no-cycle': ['warn', { maxDepth: options.cycleDepth }] },
30319
- }
30320
30662
  return new ESLint({
30321
30663
  cache: options.cache,
30322
30664
  cacheLocation: options.cacheLocation ?? path.join(cwd, '.eslintcache'),
30323
30665
  cacheStrategy: 'content',
30324
30666
  cwd,
30325
30667
  fix: options.fix,
30326
- ignorePatterns: options.ignorePatterns,
30327
- overrideConfig: cycleOverrideConfig,
30668
+ ignorePatterns: options.ignorePatterns ?? defaultIgnorePatterns,
30669
+ overrideConfig: cycleOverrideBlock(options),
30328
30670
  warnIgnored: false,
30329
30671
  })
30330
30672
  }
30331
30673
 
30332
- try {
30333
- const cwd = process.cwd()
30334
- const engine = await createLintEngine(cwd)
30674
+ async function runJob(job) {
30675
+ const cwd = job.cwd
30676
+ const options = job.options ?? {}
30677
+ const profile = options.profile === true
30678
+ const t0 = performance.now()
30679
+ const engine = await createLintEngine(cwd, options)
30680
+
30681
+ if (profile) {
30682
+ try {
30683
+ await engine.calculateConfigForFile(path.join(cwd, 'package.json'))
30684
+ } catch {
30685
+ // package.json may be ignored; config still loads on first lintFiles call
30686
+ }
30687
+ }
30688
+ const t1 = performance.now()
30689
+
30335
30690
  const lintResults = await engine.lintFiles('.')
30691
+ const t2 = performance.now()
30692
+
30336
30693
  if (!options.analyze || options.verbose) {
30337
30694
  dumpMessages(lintResults)
30338
30695
  }
@@ -30351,64 +30708,199 @@ try {
30351
30708
  })))
30352
30709
  : undefined
30353
30710
 
30354
- if (options.verbose) {
30711
+ if (options.verbose || profile) {
30355
30712
  const filesColor = files < 100 ? 'green' : files < 1000 ? 'yellow' : 'red'
30356
30713
  console.log(chalk.white(' ' + chalk[filesColor](files) + ' files linted'))
30357
30714
  }
30358
30715
 
30359
- console.log(marker + JSON.stringify({ errors, files, messages, warnings }))
30360
- } catch (ex) {
30361
- console.error(ex instanceof Error ? (ex.stack ?? ex.message) : String(ex))
30362
- console.log(marker + JSON.stringify({ errors: 1, files: 0, messages: [], warnings: 0 }))
30363
- process.exitCode = 1
30716
+ const payload = { errors, files, messages, warnings, id: job.id }
30717
+ if (profile) {
30718
+ payload.profile = {
30719
+ configMs: Math.round(t1 - t0),
30720
+ lintMs: Math.round(t2 - t1),
30721
+ totalMs: Math.round(t2 - t0),
30722
+ }
30723
+ }
30724
+ return payload
30725
+ }
30726
+
30727
+ const rl = readline.createInterface({ input: process.stdin, crlfDelay: Infinity })
30728
+ for await (const line of rl) {
30729
+ const trimmed = line.trim()
30730
+ if (trimmed.length === 0) continue
30731
+ if (trimmed === '__XY_LINT_POOL_SHUTDOWN__') break
30732
+
30733
+ let job
30734
+ try {
30735
+ job = JSON.parse(trimmed)
30736
+ } catch (ex) {
30737
+ console.error(ex instanceof Error ? (ex.stack ?? ex.message) : String(ex))
30738
+ console.log(marker + JSON.stringify({ id: -1, errors: 1, files: 0, messages: [], warnings: 0 }))
30739
+ continue
30740
+ }
30741
+
30742
+ try {
30743
+ const payload = await runJob(job)
30744
+ console.log(marker + JSON.stringify(payload))
30745
+ } catch (ex) {
30746
+ console.error(ex instanceof Error ? (ex.stack ?? ex.message) : String(ex))
30747
+ console.log(marker + JSON.stringify({
30748
+ id: job.id,
30749
+ errors: 1,
30750
+ files: 0,
30751
+ messages: [],
30752
+ warnings: 0,
30753
+ }))
30754
+ }
30364
30755
  }
30365
30756
  `;
30366
- function parseLintNextOutput(output, status) {
30367
- const markerIndex = output.lastIndexOf(lintNextResultMarker);
30368
- if (markerIndex === -1) return {
30369
- errors: status === 0 ? 0 : 1,
30370
- files: 0,
30371
- messages: [],
30372
- output,
30373
- warnings: 0
30374
- };
30375
- const beforeMarker = output.slice(0, markerIndex);
30376
- const [jsonLine = "", ...remainingLines] = output.slice(markerIndex + 23).split(/\r?\n/);
30377
- try {
30378
- const parsed = JSON.parse(jsonLine);
30379
- return {
30380
- errors: parsed.errors,
30381
- files: parsed.files,
30382
- messages: parsed.messages ?? [],
30383
- output: beforeMarker + remainingLines.join("\n"),
30384
- warnings: parsed.warnings
30385
- };
30386
- } catch {
30387
- return {
30388
- errors: status === 0 ? 0 : 1,
30757
+ /**
30758
+ * Persistent ESLint worker pool. Workers stay alive across packages so the
30759
+ * ESLint plugin graph is paid once per worker instead of once per package.
30760
+ */
30761
+ var LintWorkerPool = class {
30762
+ closed = false;
30763
+ nextJobId = 1;
30764
+ queue = [];
30765
+ rootDir;
30766
+ size;
30767
+ workers = [];
30768
+ constructor(rootDir, size) {
30769
+ this.rootDir = rootDir;
30770
+ this.size = Math.max(1, size);
30771
+ }
30772
+ async close() {
30773
+ this.closed = true;
30774
+ for (const worker of this.workers) {
30775
+ try {
30776
+ worker.child.stdin?.write("__XY_LINT_POOL_SHUTDOWN__\n");
30777
+ worker.child.stdin?.end();
30778
+ } catch {}
30779
+ worker.child.kill("SIGTERM");
30780
+ }
30781
+ this.workers.length = 0;
30782
+ for (const item of this.queue) item.resolve({
30783
+ errors: 1,
30389
30784
  files: 0,
30390
30785
  messages: [],
30391
- output,
30786
+ output: "Lint worker pool closed\n",
30787
+ warnings: 0
30788
+ });
30789
+ this.queue.length = 0;
30790
+ }
30791
+ async run(job) {
30792
+ if (this.closed) return {
30793
+ errors: 1,
30794
+ files: 0,
30795
+ messages: [],
30796
+ output: "Lint worker pool is closed\n",
30392
30797
  warnings: 0
30393
30798
  };
30799
+ this.start();
30800
+ return await new Promise((resolve) => {
30801
+ this.queue.push({
30802
+ job,
30803
+ resolve
30804
+ });
30805
+ this.pump();
30806
+ });
30807
+ }
30808
+ async runAll(jobs) {
30809
+ this.start();
30810
+ return await Promise.all(jobs.map(async (job) => this.run(job)));
30811
+ }
30812
+ /** Start worker processes (idempotent). */
30813
+ start() {
30814
+ if (this.workers.length > 0) return;
30815
+ for (let i = 0; i < this.size; i++) this.workers.push(this.spawnWorker(i));
30816
+ }
30817
+ consumeStdout(worker) {
30818
+ while (true) {
30819
+ const markerIndex = worker.stdoutBuffer.indexOf(lintNextResultMarker);
30820
+ if (markerIndex === -1) return;
30821
+ const afterMarker = worker.stdoutBuffer.slice(markerIndex + 23);
30822
+ const newlineIndex = afterMarker.indexOf("\n");
30823
+ if (newlineIndex === -1) return;
30824
+ const jsonLine = afterMarker.slice(0, newlineIndex).replace(/\r$/, "");
30825
+ const logBefore = worker.stdoutBuffer.slice(0, markerIndex);
30826
+ worker.stdoutBuffer = afterMarker.slice(newlineIndex + 1);
30827
+ let parsed;
30828
+ try {
30829
+ parsed = JSON.parse(jsonLine);
30830
+ } catch {
30831
+ continue;
30832
+ }
30833
+ const jobId = parsed.id;
30834
+ if (jobId === void 0) continue;
30835
+ const pending = worker.pending.get(jobId);
30836
+ if (pending === void 0) continue;
30837
+ worker.pending.delete(jobId);
30838
+ worker.busy = worker.pending.size > 0;
30839
+ pending.resolve({
30840
+ errors: parsed.errors,
30841
+ files: parsed.files,
30842
+ messages: parsed.messages ?? [],
30843
+ output: pending.logChunks.join("") + logBefore,
30844
+ profile: parsed.profile,
30845
+ warnings: parsed.warnings
30846
+ });
30847
+ this.pump();
30848
+ }
30394
30849
  }
30395
- }
30396
- async function lintOnePackageProcess({ analyze, analyzeTier, cache, cacheLocation, cwd, cycleDepth, fix, verbose }) {
30397
- return await new Promise((resolve) => {
30398
- const output = [];
30850
+ failWorkerJobs(worker, output) {
30851
+ worker.busy = false;
30852
+ for (const [jobId, pending] of worker.pending) {
30853
+ worker.pending.delete(jobId);
30854
+ pending.resolve({
30855
+ errors: 1,
30856
+ files: 0,
30857
+ messages: [],
30858
+ output: pending.logChunks.join("") + output,
30859
+ warnings: 0
30860
+ });
30861
+ }
30862
+ }
30863
+ pump() {
30864
+ if (this.closed) return;
30865
+ for (const worker of this.workers) {
30866
+ if (worker.busy || worker.pending.size > 0) continue;
30867
+ const next = this.queue.shift();
30868
+ if (next === void 0) return;
30869
+ const jobId = this.nextJobId++;
30870
+ const pending = {
30871
+ logChunks: [],
30872
+ resolve: next.resolve
30873
+ };
30874
+ worker.pending.set(jobId, pending);
30875
+ worker.busy = true;
30876
+ const payload = {
30877
+ id: jobId,
30878
+ cwd: next.job.cwd,
30879
+ options: {
30880
+ ...next.job.options,
30881
+ cacheLocation: next.job.cacheLocation,
30882
+ ignorePatterns: lintNextIgnorePatterns
30883
+ }
30884
+ };
30885
+ try {
30886
+ worker.child.stdin?.write(`${JSON.stringify(payload)}\n`);
30887
+ } catch (ex) {
30888
+ worker.pending.delete(jobId);
30889
+ worker.busy = false;
30890
+ next.resolve({
30891
+ errors: 1,
30892
+ files: 0,
30893
+ messages: [],
30894
+ output: `${ex instanceof Error ? ex.message : String(ex)}\n`,
30895
+ warnings: 0
30896
+ });
30897
+ }
30898
+ }
30899
+ }
30900
+ spawnWorker(id) {
30399
30901
  const env = {
30400
30902
  ...process.env,
30401
30903
  FORCE_COLOR: "3",
30402
- XY_LINT_NEXT_OPTIONS: JSON.stringify({
30403
- analyze,
30404
- analyzeTier,
30405
- cache,
30406
- cacheLocation,
30407
- cycleDepth,
30408
- fix,
30409
- ignorePatterns: lintNextIgnorePatterns,
30410
- verbose
30411
- }),
30412
30904
  XY_LINT_NEXT_CHALK_URL: chalkImportUrl
30413
30905
  };
30414
30906
  delete env.NO_COLOR;
@@ -30416,35 +30908,263 @@ async function lintOnePackageProcess({ analyze, analyzeTier, cache, cacheLocatio
30416
30908
  const child = spawn(process.execPath, [
30417
30909
  "--input-type=module",
30418
30910
  "--eval",
30419
- lintNextWorkerSource
30911
+ lintPoolWorkerSource
30420
30912
  ], {
30421
- cwd,
30913
+ cwd: this.rootDir,
30422
30914
  env,
30423
30915
  stdio: [
30424
- "ignore",
30916
+ "pipe",
30425
30917
  "pipe",
30426
30918
  "pipe"
30427
30919
  ]
30428
30920
  });
30921
+ const worker = {
30922
+ busy: false,
30923
+ child,
30924
+ id,
30925
+ pending: /* @__PURE__ */ new Map(),
30926
+ stdoutBuffer: ""
30927
+ };
30429
30928
  child.stdout?.on("data", (chunk) => {
30430
- output.push(String(chunk));
30929
+ worker.stdoutBuffer += String(chunk);
30930
+ this.consumeStdout(worker);
30431
30931
  });
30432
30932
  child.stderr?.on("data", (chunk) => {
30433
- output.push(String(chunk));
30933
+ const text = String(chunk);
30934
+ for (const pending of worker.pending.values()) pending.logChunks.push(text);
30434
30935
  });
30435
30936
  child.on("error", (ex) => {
30436
- resolve({
30437
- errors: 1,
30438
- files: 0,
30439
- messages: [],
30440
- output: `${ex.message}\n`,
30441
- warnings: 0
30442
- });
30937
+ this.failWorkerJobs(worker, `${ex.message}\n`);
30443
30938
  });
30444
- child.on("close", (status) => {
30445
- resolve(parseLintNextOutput(output.join(""), status));
30939
+ child.on("close", () => {
30940
+ this.failWorkerJobs(worker, "Lint worker exited unexpectedly\n");
30941
+ if (!this.closed) {
30942
+ const index = this.workers.indexOf(worker);
30943
+ if (index !== -1) this.workers[index] = this.spawnWorker(id);
30944
+ this.pump();
30945
+ }
30446
30946
  });
30947
+ return worker;
30948
+ }
30949
+ };
30950
+ //#endregion
30951
+ //#region src/actions/lintPackageFilter.ts
30952
+ const IGNORED_DIR_NAMES = /* @__PURE__ */ new Set([
30953
+ ".cache",
30954
+ ".git",
30955
+ ".next",
30956
+ ".turbo",
30957
+ ".xy",
30958
+ "build",
30959
+ "coverage",
30960
+ "dist",
30961
+ "docs",
30962
+ "node_modules"
30963
+ ]);
30964
+ const LINTABLE_EXT = /* @__PURE__ */ new Set([
30965
+ ".cjs",
30966
+ ".cts",
30967
+ ".js",
30968
+ ".jsx",
30969
+ ".mjs",
30970
+ ".mts",
30971
+ ".ts",
30972
+ ".tsx"
30973
+ ]);
30974
+ /** Cap walk cost for huge trees when we only need emptiness / meta signals. */
30975
+ const MAX_FILES_TO_COUNT = 50;
30976
+ function isLintableFile(name) {
30977
+ const ext = PATH.extname(name);
30978
+ return LINTABLE_EXT.has(ext);
30979
+ }
30980
+ /**
30981
+ * Fast count of lintable sources under a package. For the monorepo root
30982
+ * (location `.`), ignores a top-level `packages/` directory so nested
30983
+ * workspaces are not double-counted (matches worker ignorePatterns).
30984
+ */
30985
+ function countLintableSourceFiles(packageDir, isRootWorkspace) {
30986
+ let count = 0;
30987
+ const walk = (dir, depth) => {
30988
+ if (count >= MAX_FILES_TO_COUNT) return;
30989
+ let entries;
30990
+ try {
30991
+ entries = readdirSync(dir, { withFileTypes: true });
30992
+ } catch {
30993
+ return;
30994
+ }
30995
+ for (const entry of entries) {
30996
+ if (count >= MAX_FILES_TO_COUNT) return;
30997
+ const name = entry.name;
30998
+ if (name.startsWith(".") && name !== ".config") {}
30999
+ if (entry.isDirectory()) {
31000
+ if (IGNORED_DIR_NAMES.has(name)) continue;
31001
+ if (isRootWorkspace && depth === 0 && name === "packages") continue;
31002
+ walk(PATH.join(dir, name), depth + 1);
31003
+ continue;
31004
+ }
31005
+ if (entry.isFile() && isLintableFile(name)) count++;
31006
+ }
31007
+ };
31008
+ walk(packageDir, 0);
31009
+ return count;
31010
+ }
31011
+ function readPackagePrivate(packageDir) {
31012
+ try {
31013
+ const raw = readFileSync(PATH.join(packageDir, "package.json"), "utf8");
31014
+ return JSON.parse(raw).private === true;
31015
+ } catch {
31016
+ return false;
31017
+ }
31018
+ }
31019
+ /**
31020
+ * Meta package: monorepo root or private package without a `src/` tree, with
31021
+ * few lintable files — typically config/tooling only.
31022
+ */
31023
+ function isMetaLintPackage(packageDir, workspace, sourceFiles, monorepoHasOtherPackages) {
31024
+ if (!monorepoHasOtherPackages) return false;
31025
+ if (existsSync(PATH.join(packageDir, "src"))) return false;
31026
+ if (workspace.location === "." || workspace.location === "") return true;
31027
+ if (readPackagePrivate(packageDir) && sourceFiles < 15) return true;
31028
+ return sourceFiles > 0 && sourceFiles <= 2;
31029
+ }
31030
+ /**
31031
+ * Classify how a workspace should be linted for performance.
31032
+ */
31033
+ function classifyLintPackage(rootDir, workspace, allWorkspaces, options = {}) {
31034
+ const packageDir = PATH.resolve(rootDir, workspace.location);
31035
+ const isRoot = workspace.location === "." || workspace.location === "";
31036
+ const sourceFiles = countLintableSourceFiles(packageDir, isRoot);
31037
+ if (options.forceFull === true) return {
31038
+ mode: "full",
31039
+ sourceFiles
31040
+ };
31041
+ if (options.skipEmpty !== false && sourceFiles === 0) return {
31042
+ mode: "skip",
31043
+ reason: "no lintable source files",
31044
+ sourceFiles
31045
+ };
31046
+ const metaMode = options.meta ?? "light";
31047
+ if (!isMetaLintPackage(packageDir, workspace, sourceFiles, allWorkspaces.length > 1) || metaMode === "full") return {
31048
+ mode: "full",
31049
+ sourceFiles
31050
+ };
31051
+ return {
31052
+ mode: metaMode,
31053
+ reason: isRoot ? "meta root package (config/tooling only)" : "meta package (no src/, tiny surface)",
31054
+ sourceFiles
31055
+ };
31056
+ }
31057
+ //#endregion
31058
+ //#region src/actions/lintNextRun.ts
31059
+ function buildForcedConfigOverride(tierContext, isTypeChecked) {
31060
+ return {
31061
+ configPackageName: tierContext.configPackageName,
31062
+ exportName: "",
31063
+ isReact: tierContext.isReact,
31064
+ isTypeChecked,
31065
+ tier: tierContext.currentTier ?? tierContext.recommendedOptions?.tier ?? 3
31066
+ };
31067
+ }
31068
+ function resolvePackageConfigOverride(packageMode, typeChecked, tierContext, analyzeTier) {
31069
+ if (analyzeTier !== void 0) return analyzeTier;
31070
+ if (tierContext === void 0 || !tierContext.hasXylabsConfig) return void 0;
31071
+ if (typeChecked === true || typeChecked === false) return buildForcedConfigOverride(tierContext, typeChecked);
31072
+ if (packageMode === "light") return buildForcedConfigOverride(tierContext, false);
31073
+ }
31074
+ function printSkippedPackage(pkg, reason) {
31075
+ console.log(chalk.gray(`Skip [${pkg}]`) + chalk.gray(` (${reason})`));
31076
+ }
31077
+ function emptyPackageResult(pkg) {
31078
+ return {
31079
+ errors: 0,
31080
+ files: 0,
31081
+ messages: [],
31082
+ output: "",
31083
+ pkg,
31084
+ timeMs: 0,
31085
+ warnings: 0
31086
+ };
31087
+ }
31088
+ /**
31089
+ * Classify packages, skip empty/meta as configured, then lint the rest via
31090
+ * the persistent ESLint worker pool.
31091
+ */
31092
+ async function runLintNextPackages({ analyze, analyzeTier, cache, concurrency, cycleDepth, fix, meta, onPackageResult, profile, rootDir, skipEmpty, tierContext, typeChecked, verbose, workspaces }) {
31093
+ const forceFull = workspaces.length === 1;
31094
+ const classified = workspaces.map((ws) => {
31095
+ return {
31096
+ classification: classifyLintPackage(rootDir, ws, workspaces, {
31097
+ forceFull,
31098
+ meta,
31099
+ skipEmpty
31100
+ }),
31101
+ ws
31102
+ };
30447
31103
  });
31104
+ const toLint = classified.filter((entry) => entry.classification.mode !== "skip");
31105
+ const skipped = classified.filter((entry) => entry.classification.mode === "skip");
31106
+ for (const entry of skipped) if (verbose || profile) printSkippedPackage(entry.ws.name, entry.classification.reason ?? "skipped");
31107
+ const skippedResults = skipped.map((entry) => emptyPackageResult(entry.ws.name));
31108
+ if (toLint.length === 0) {
31109
+ if (skipped.length > 0) console.log(chalk.gray(` Skipped ${skipped.length} package(s) with nothing to lint`));
31110
+ return skippedResults;
31111
+ }
31112
+ const poolSize = Math.min(Math.max(1, concurrency), toLint.length);
31113
+ const pool = new LintWorkerPool(rootDir, poolSize);
31114
+ if (profile) {
31115
+ console.log(chalk.gray(` ESLint workers: ${poolSize} (persistent pool)`));
31116
+ if (typeChecked !== "auto") console.log(chalk.gray(` type-checked: ${typeChecked ? "forced on" : "forced off"}`));
31117
+ }
31118
+ const lintResults = toLint.map((entry) => emptyPackageResult(entry.ws.name));
31119
+ try {
31120
+ pool.start();
31121
+ await runWithConcurrency(toLint.map((entry, i) => ({
31122
+ entry,
31123
+ i
31124
+ })), concurrency, async ({ entry, i }) => {
31125
+ const { classification, ws } = entry;
31126
+ const pkgStart = Date.now();
31127
+ const absCwd = PATH.resolve(rootDir, ws.location);
31128
+ const cacheLocation = cache ? workspaceEslintCachePath(rootDir, ws.location) : void 0;
31129
+ if (cacheLocation !== void 0) ensureEslintCacheDir(cacheLocation);
31130
+ const configOverride = resolvePackageConfigOverride(classification.mode, typeChecked, analyze ? void 0 : tierContext, analyzeTier);
31131
+ if ((verbose || profile) && classification.mode === "light") console.log(chalk.gray(` light [${ws.name}]: ${classification.reason ?? "non-type-checked"}`));
31132
+ const worker = await pool.run({
31133
+ cacheLocation,
31134
+ cwd: absCwd,
31135
+ options: {
31136
+ analyze,
31137
+ analyzeTier,
31138
+ cache,
31139
+ configOverride: analyze ? void 0 : configOverride,
31140
+ cycleDepth,
31141
+ fix,
31142
+ profile,
31143
+ verbose
31144
+ }
31145
+ });
31146
+ const wallMs = Date.now() - pkgStart;
31147
+ const result = {
31148
+ errors: worker.errors,
31149
+ files: worker.files,
31150
+ messages: worker.messages,
31151
+ output: worker.output,
31152
+ pkg: ws.name,
31153
+ timeMs: wallMs,
31154
+ warnings: worker.warnings
31155
+ };
31156
+ if (worker.profile !== void 0) result.profile = {
31157
+ ...worker.profile,
31158
+ spawnMs: Math.max(0, wallMs - worker.profile.totalMs),
31159
+ wallMs
31160
+ };
31161
+ lintResults[i] = result;
31162
+ onPackageResult(i, toLint.length, result);
31163
+ });
31164
+ } finally {
31165
+ await pool.close();
31166
+ }
31167
+ return [...skippedResults, ...lintResults];
30448
31168
  }
30449
31169
  const tierExportPattern$1 = /config(?:React)?Tier\d+[A-Za-z]*/g;
30450
31170
  const ARIESTOOLS_FLAT_CONFIG_PACKAGE = "@ariestools/eslint-config-flat";
@@ -30748,11 +31468,35 @@ function resultColor(result) {
30748
31468
  if (result.warnings > 0) return "yellow";
30749
31469
  return "green";
30750
31470
  }
31471
+ function formatProfileSuffix(result) {
31472
+ const profile = result.profile;
31473
+ if (profile === void 0) return "";
31474
+ return chalk.gray(` [config ${formatDuration$1(profile.configMs)} · lint ${formatDuration$1(profile.lintMs)} · spawn ${formatDuration$1(profile.spawnMs)}]`);
31475
+ }
30751
31476
  function printPackageResult(label, result) {
30752
31477
  const color = resultColor(result);
30753
- console.log(chalk[color](`${label} [${result.pkg}]`) + chalk.gray(` (${result.files} files, ${formatDuration$1(result.timeMs)})`));
31478
+ console.log(chalk[color](`${label} [${result.pkg}]`) + chalk.gray(` (${result.files} files, ${formatDuration$1(result.timeMs)})`) + formatProfileSuffix(result));
30754
31479
  if (result.output.length > 0) process.stdout.write(result.output.endsWith("\n") ? result.output : `${result.output}\n`);
30755
31480
  }
31481
+ function printLintProfileSummary(results) {
31482
+ const profiled = results.filter((result) => result.profile !== void 0);
31483
+ if (profiled.length === 0) return;
31484
+ let configMs = 0;
31485
+ let lintMs = 0;
31486
+ let spawnMs = 0;
31487
+ let wallMs = 0;
31488
+ for (const result of profiled) {
31489
+ const profile = result.profile;
31490
+ if (profile === void 0) continue;
31491
+ configMs += profile.configMs;
31492
+ lintMs += profile.lintMs;
31493
+ spawnMs += profile.spawnMs;
31494
+ wallMs += profile.wallMs;
31495
+ }
31496
+ console.log(chalk.cyan("Lint profile"));
31497
+ console.log(chalk.gray(` packages: ${profiled.length} · config Σ ${formatDuration$1(configMs)} · lint Σ ${formatDuration$1(lintMs)} · spawn Σ ${formatDuration$1(spawnMs)} · wall Σ ${formatDuration$1(wallMs)}`));
31498
+ console.log(chalk.gray(" (config = ESLint setup + type-aware program; spawn = queue/IPC overhead in the worker pool)"));
31499
+ }
30756
31500
  function printAnalyzePackageProgress(index, total, result) {
30757
31501
  console.log(chalk.gray(` [${index + 1}/${total}] ${result.pkg} — ${result.files} files, ${formatDuration$1(result.timeMs)}`));
30758
31502
  if (result.files === 0 && result.output.length > 0) process.stdout.write(result.output.endsWith("\n") ? result.output : `${result.output}\n`);
@@ -30803,9 +31547,6 @@ function printLintSummary(totalErrors, totalWarnings, totalFiles, packageCount)
30803
31547
  warningCount: totalWarnings
30804
31548
  });
30805
31549
  }
30806
- function appendLintMessages(target, messages) {
30807
- for (const message of messages) target.push(message);
30808
- }
30809
31550
  function totalLintResults(results) {
30810
31551
  const total = {
30811
31552
  errors: 0,
@@ -30817,7 +31558,7 @@ function totalLintResults(results) {
30817
31558
  total.errors += result.errors;
30818
31559
  total.files += result.files;
30819
31560
  total.warnings += result.warnings;
30820
- appendLintMessages(total.messages, result.messages);
31561
+ for (const message of result.messages) total.messages.push(message);
30821
31562
  }
30822
31563
  return total;
30823
31564
  }
@@ -30847,73 +31588,50 @@ function printAnalyzeRunHeader(workspaces) {
30847
31588
  const packageLabel = workspaces.length === 1 ? "package" : "packages";
30848
31589
  console.log(chalk.cyan(`Lint tier analysis: ${workspaces.length} ${packageLabel}`));
30849
31590
  }
30850
- async function runLintNextPackages({ analyze, analyzeTier, cache, concurrency, cycleDepth, fix, label, rootDir, verbose, workspaces }) {
30851
- const results = Array.from({ length: workspaces.length }, () => ({
30852
- errors: 0,
30853
- files: 0,
30854
- messages: [],
30855
- output: "",
30856
- pkg: "",
30857
- timeMs: 0,
30858
- warnings: 0
30859
- }));
30860
- await runWithConcurrency(workspaces.map((ws, i) => ({
30861
- i,
30862
- ws
30863
- })), concurrency, async ({ i, ws }) => {
30864
- const pkgStart = Date.now();
30865
- const absCwd = PATH.resolve(rootDir, ws.location);
30866
- const cacheLocation = cache ? workspaceEslintCachePath(rootDir, ws.location) : void 0;
30867
- if (cacheLocation !== void 0) ensureEslintCacheDir(cacheLocation);
30868
- const { errors, files, messages, output, warnings } = await lintOnePackageProcess({
30869
- analyze,
30870
- analyzeTier,
30871
- cache,
30872
- cacheLocation,
30873
- cwd: absCwd,
30874
- cycleDepth,
30875
- fix,
30876
- verbose
30877
- });
30878
- const result = {
30879
- errors,
30880
- files,
30881
- messages,
30882
- output,
30883
- pkg: ws.name,
30884
- timeMs: Date.now() - pkgStart,
30885
- warnings
30886
- };
30887
- results[i] = result;
30888
- if (analyze) printAnalyzePackageProgress(i, workspaces.length, result);
30889
- else printPackageResult(label, result);
30890
- });
30891
- return results;
30892
- }
30893
- async function finishLintNext({ analyze, analyzeStarted, fix, results, rootDir, tierContext, workspaces }) {
31591
+ async function finishLintNext({ analyze, analyzeStarted, fix, profile, results, rootDir, tierContext, workspaces }) {
30894
31592
  const totals = totalLintResults(results);
30895
31593
  if (analyze && tierContext !== void 0) {
30896
31594
  await printLintAnalyzeReport(rootDir, tierContext, totals, Date.now() - analyzeStarted);
31595
+ if (profile) printLintProfileSummary(results);
30897
31596
  return 0;
30898
31597
  }
30899
31598
  const barrelRestrictionWarnings = fix ? 0 : await checkBarrelImportRestrictions(rootDir);
30900
- return printLintSummary(totals.errors, totals.warnings + barrelRestrictionWarnings, totals.files, workspaces.length);
31599
+ const outcome = printLintSummary(totals.errors, totals.warnings + barrelRestrictionWarnings, totals.files, workspaces.length);
31600
+ if (profile) printLintProfileSummary(results);
31601
+ return outcome;
30901
31602
  }
30902
- async function lintNext({ analyze = false, cache = false, cycleDepth, fix = false, jobs, pkg, verbose = false, workspaces: targetWorkspaces }) {
30903
- const rootDir = INIT_CWD();
31603
+ function resolveTierForLint(analyze, rootDir) {
30904
31604
  const analyzeContext = resolveAnalyzeContext(analyze, rootDir);
31605
+ const detectedContext = detectLintTierContext(rootDir);
31606
+ return {
31607
+ analyzeContext,
31608
+ detectedContext,
31609
+ tierContext: analyzeContext.kind === "ready" ? analyzeContext.tierContext : detectedContext.hasXylabsConfig ? detectedContext : void 0
31610
+ };
31611
+ }
31612
+ function logLintProfileHeader(cache, typeChecked, detectedContext, meta, skipEmpty) {
31613
+ console.log(chalk.gray(` ESLint cache: ${cache ? "on" : "off"}`));
31614
+ const typeCheckedLabel = typeChecked === "auto" ? `auto (project ${detectedContext.isTypeChecked ? "on" : "off"}; meta → light)` : typeChecked ? "forced on" : "forced off";
31615
+ console.log(chalk.gray(` type-checked: ${typeCheckedLabel}`));
31616
+ console.log(chalk.gray(` meta packages: ${meta} · skip empty: ${skipEmpty ? "on" : "off"}`));
31617
+ }
31618
+ async function lintNext({ analyze = false, cache = true, cycleDepth, fix = false, jobs, meta = "light", pkg, profile = false, skipEmpty = true, typeChecked = "auto", verbose = false, workspaces: targetWorkspaces }) {
31619
+ const rootDir = INIT_CWD();
31620
+ const { analyzeContext, detectedContext, tierContext } = resolveTierForLint(analyze, rootDir);
30905
31621
  if (analyzeContext.kind === "invalid") return resultFromExitCode(1);
30906
- const tierContext = analyzeContext.kind === "ready" ? analyzeContext.tierContext : void 0;
30907
- const analyzeTier = tierContext === void 0 ? void 0 : buildAnalyzeLintTierOptions(tierContext);
31622
+ const analyzeTier = analyze && tierContext !== void 0 ? buildAnalyzeLintTierOptions(tierContext) : void 0;
30908
31623
  const workspaceSetup = resolveLintNextWorkspaces(pkg, targetWorkspaces);
30909
31624
  if (workspaceSetup.kind === "done") return workspaceSetup.outcome;
30910
31625
  const { workspaces } = workspaceSetup;
30911
31626
  const analyzeStarted = Date.now();
31627
+ const label = getLintLabel(analyze, fix, cycleDepth);
30912
31628
  if (analyze && tierContext !== void 0) printAnalyzeRunHeader(workspaces);
31629
+ if (profile) logLintProfileHeader(cache, typeChecked, detectedContext, meta, skipEmpty);
30913
31630
  return finishLintNext({
30914
31631
  analyze,
30915
31632
  analyzeStarted,
30916
31633
  fix,
31634
+ profile,
30917
31635
  results: await runLintNextPackages({
30918
31636
  analyze,
30919
31637
  analyzeTier,
@@ -30921,8 +31639,17 @@ async function lintNext({ analyze = false, cache = false, cycleDepth, fix = fals
30921
31639
  concurrency: jobs,
30922
31640
  cycleDepth,
30923
31641
  fix,
30924
- label: getLintLabel(analyze, fix, cycleDepth),
31642
+ label,
31643
+ meta,
31644
+ onPackageResult: (index, total, result) => {
31645
+ if (analyze) printAnalyzePackageProgress(index, total, result);
31646
+ else printPackageResult(label, result);
31647
+ },
31648
+ profile,
30925
31649
  rootDir,
31650
+ skipEmpty,
31651
+ tierContext,
31652
+ typeChecked,
30926
31653
  verbose,
30927
31654
  workspaces
30928
31655
  }),
@@ -30953,7 +31680,7 @@ const lintPackage = ({ pkg, fix, verbose }) => {
30953
31680
  const pm = getPackageManager();
30954
31681
  return runSteps(`${fix ?? false ? "Fix" : "Lint"} [${pkg}]`, [pm.runInWorkspace(pkg, fix ?? false ? "package-fix" : verbose ?? false ? "package-lint-verbose" : "package-lint")]);
30955
31682
  };
30956
- async function lintIncremental({ cache, cycleDepth, fix, jobs, verbose, workspaces: targetWorkspaces }) {
31683
+ async function lintIncremental({ cache, cycleDepth, fix, jobs, meta, profile, skipEmpty, typeChecked, verbose, workspaces: targetWorkspaces }) {
30957
31684
  const pm = getPackageManager();
30958
31685
  const allWorkspaces = targetWorkspaces ?? pm.listWorkspaces();
30959
31686
  if (allWorkspaces.length === 0) return await lintNext({
@@ -30961,6 +31688,10 @@ async function lintIncremental({ cache, cycleDepth, fix, jobs, verbose, workspac
30961
31688
  cycleDepth,
30962
31689
  fix,
30963
31690
  jobs,
31691
+ meta,
31692
+ profile,
31693
+ skipEmpty,
31694
+ typeChecked,
30964
31695
  verbose
30965
31696
  });
30966
31697
  const plan = createIncrementalPlan({
@@ -30986,6 +31717,10 @@ async function lintIncremental({ cache, cycleDepth, fix, jobs, verbose, workspac
30986
31717
  cycleDepth,
30987
31718
  fix,
30988
31719
  jobs,
31720
+ meta,
31721
+ profile,
31722
+ skipEmpty,
31723
+ typeChecked,
30989
31724
  verbose,
30990
31725
  workspaces: plan.full ? allWorkspaces : selectedWorkspaces$2(allWorkspaces, plan.affectedWorkspaceNames)
30991
31726
  });
@@ -30997,7 +31732,7 @@ async function lintIncremental({ cache, cycleDepth, fix, jobs, verbose, workspac
30997
31732
  });
30998
31733
  return result;
30999
31734
  }
31000
- const lint = ({ analyze, cache, cycleDepth, fix, incremental, jobs, prev, pkg, verbose, workspaces }) => {
31735
+ const lint = ({ analyze, cache, cycleDepth, fix, incremental, jobs, meta, prev, pkg, profile, skipEmpty, typeChecked, verbose, workspaces }) => {
31001
31736
  if (analyze === true && fix === true) {
31002
31737
  console.error("The --analyze option cannot be combined with --fix");
31003
31738
  return 1;
@@ -31013,6 +31748,10 @@ const lint = ({ analyze, cache, cycleDepth, fix, incremental, jobs, prev, pkg, v
31013
31748
  cycleDepth,
31014
31749
  fix,
31015
31750
  jobs,
31751
+ meta,
31752
+ profile,
31753
+ skipEmpty,
31754
+ typeChecked,
31016
31755
  verbose,
31017
31756
  workspaces
31018
31757
  });
@@ -31021,7 +31760,11 @@ const lint = ({ analyze, cache, cycleDepth, fix, incremental, jobs, prev, pkg, v
31021
31760
  cache,
31022
31761
  fix,
31023
31762
  jobs,
31763
+ meta,
31024
31764
  pkg,
31765
+ profile,
31766
+ skipEmpty,
31767
+ typeChecked,
31025
31768
  verbose,
31026
31769
  workspaces
31027
31770
  };
@@ -31034,12 +31777,13 @@ const lint = ({ analyze, cache, cycleDepth, fix, incremental, jobs, prev, pkg, v
31034
31777
  verbose
31035
31778
  });
31036
31779
  };
31037
- const cycle = ({ cache, depth = 25, jobs, pkg, verbose }) => {
31780
+ const cycle = ({ cache, depth = 25, jobs, pkg, profile, verbose }) => {
31038
31781
  return lint({
31039
31782
  cache,
31040
31783
  cycleDepth: depth,
31041
31784
  jobs,
31042
31785
  pkg,
31786
+ profile,
31043
31787
  verbose
31044
31788
  });
31045
31789
  };
@@ -37952,64 +38696,28 @@ function install() {
37952
38696
  }
37953
38697
  //#endregion
37954
38698
  //#region src/actions/license.ts
37955
- function isAllowedLicense(license, exclude) {
37956
- if (license == null || license.length === 0) return true;
37957
- return (license.startsWith("(") && license.at(-1) === ")" ? license.slice(1, -2) : license).split(" OR ").some((orLicense) => exclude.has(orLicense));
37958
- }
37959
- function countDisallowedLicenses(packages, exclude) {
37960
- let count = 0;
37961
- for (const [packageName, info] of Object.entries(packages)) {
37962
- const disallowedLicenses = (Array.isArray(info.licenses) ? info.licenses : [info.licenses]).filter((license) => !isAllowedLicense(license, exclude));
37963
- for (const license of disallowedLicenses) {
37964
- count++;
37965
- console.warn(chalk.yellow(`${packageName}: Package License not allowed [${license}]`));
37966
- }
37967
- }
37968
- return count;
37969
- }
38699
+ /**
38700
+ * `xy license` — walk each workspace's production dependency tree and flag
38701
+ * packages whose package.json license is outside the allowlist.
38702
+ */
37970
38703
  const license = async (pkg) => {
37971
- const workspaceList = getPackageManager().listWorkspaces().filter(({ name }) => {
37972
- return pkg === void 0 || name === pkg;
37973
- });
37974
- const exclude = /* @__PURE__ */ new Set([
37975
- "MIT",
37976
- "MIT*",
37977
- "ISC",
37978
- "Apache-2.0",
37979
- "BSD",
37980
- "BSD*",
37981
- "BSD-2-Clause",
37982
- "BSD-3-Clause",
37983
- "CC-BY-4.0",
37984
- "Unlicense",
37985
- "CC-BY-3.0",
37986
- "CC0-1.0",
37987
- "LGPL-3.0-only",
37988
- "LGPL-3.0",
37989
- "LGPL-3.0-or-later",
37990
- "Python-2.0"
37991
- ]);
38704
+ const workspaceList = getPackageManager().listWorkspaces().filter(({ name }) => pkg === void 0 || name === pkg);
38705
+ const allowed = new Set(DEFAULT_ALLOWED_LICENSES);
37992
38706
  console.log(chalk.green("License Checker"));
37993
- return (await Promise.all(workspaceList.map(({ location, name }) => {
37994
- return new Promise((resolve) => {
37995
- init({
37996
- production: true,
37997
- start: location
37998
- }, (error, packages) => {
37999
- if (error) {
38000
- console.error(chalk.red(`License Checker [${name}] Error`));
38001
- console.error(chalk.gray(error));
38002
- console.log("\n");
38003
- resolve(1);
38004
- } else {
38005
- console.log(chalk.green(`License Checker [${name}]`));
38006
- const count = countDisallowedLicenses(packages, exclude);
38007
- console.log("\n");
38008
- resolve(count);
38009
- }
38010
- });
38011
- });
38012
- }))).reduce((prev, value) => prev || value, 0);
38707
+ let exitCode = 0;
38708
+ for (const { location, name } of workspaceList) try {
38709
+ const findings = findDisallowedLicenses(collectProductionLicenses(location), allowed);
38710
+ console.log(chalk.green(`License Checker [${name}]`));
38711
+ for (const finding of findings) console.warn(chalk.yellow(`${finding.packageName}: Package License not allowed [${finding.license}]`));
38712
+ if (findings.length > 0) exitCode = findings.length;
38713
+ console.log("\n");
38714
+ } catch (error) {
38715
+ console.error(chalk.red(`License Checker [${name}] Error`));
38716
+ console.error(chalk.gray(error instanceof Error ? error.message : String(error)));
38717
+ console.log("\n");
38718
+ exitCode = 1;
38719
+ }
38720
+ return exitCode;
38013
38721
  };
38014
38722
  //#endregion
38015
38723
  //#region src/actions/lint-config.ts
@@ -45614,11 +46322,15 @@ var require_lodash_truncate = /* @__PURE__ */ __commonJSMin(((exports, module) =
45614
46322
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
45615
46323
  */
45616
46324
  /** Used as default options for `_.truncate`. */
45617
- var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...";
46325
+ var DEFAULT_TRUNC_LENGTH = 30;
46326
+ var DEFAULT_TRUNC_OMISSION = "...";
45618
46327
  /** Used as references for various `Number` constants. */
45619
- var INFINITY = Infinity, MAX_INTEGER = 17976931348623157e292, NAN = NaN;
46328
+ var INFINITY = Infinity;
46329
+ var MAX_INTEGER = 17976931348623157e292;
46330
+ var NAN = NaN;
45620
46331
  /** `Object#toString` result references. */
45621
- var regexpTag = "[object RegExp]", symbolTag = "[object Symbol]";
46332
+ var regexpTag = "[object RegExp]";
46333
+ var symbolTag = "[object Symbol]";
45622
46334
  /** Used to match leading and trailing whitespace. */
45623
46335
  var reTrim = /^\s+|\s+$/g;
45624
46336
  /** Used to match `RegExp` flags from their coerced string values. */
@@ -45630,15 +46342,29 @@ var require_lodash_truncate = /* @__PURE__ */ __commonJSMin(((exports, module) =
45630
46342
  /** Used to detect octal string values. */
45631
46343
  var reIsOctal = /^0o[0-7]+$/i;
45632
46344
  /** Used to compose unicode character classes. */
45633
- var rsAstralRange = "\\ud800-\\udfff", rsComboMarksRange = "\\u0300-\\u036f\\ufe20-\\ufe23", rsComboSymbolsRange = "\\u20d0-\\u20f0", rsVarRange = "\\ufe0e\\ufe0f";
46345
+ var rsAstralRange = "\\ud800-\\udfff";
46346
+ var rsComboMarksRange = "\\u0300-\\u036f\\ufe20-\\ufe23";
46347
+ var rsComboSymbolsRange = "\\u20d0-\\u20f0";
46348
+ var rsVarRange = "\\ufe0e\\ufe0f";
45634
46349
  /** Used to compose unicode capture groups. */
45635
- var rsAstral = "[" + rsAstralRange + "]", rsCombo = "[" + rsComboMarksRange + rsComboSymbolsRange + "]", rsFitz = "\\ud83c[\\udffb-\\udfff]", rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")", rsNonAstral = "[^" + rsAstralRange + "]", rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsZWJ = "\\u200d";
46350
+ var rsAstral = "[" + rsAstralRange + "]";
46351
+ var rsCombo = "[" + rsComboMarksRange + rsComboSymbolsRange + "]";
46352
+ var rsFitz = "\\ud83c[\\udffb-\\udfff]";
46353
+ var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")";
46354
+ var rsNonAstral = "[^" + rsAstralRange + "]";
46355
+ var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
46356
+ var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
46357
+ var rsZWJ = "\\u200d";
45636
46358
  /** Used to compose unicode regexes. */
45637
- var reOptMod = rsModifier + "?", rsOptVar = "[" + rsVarRange + "]?", rsOptJoin = "(?:" + rsZWJ + "(?:" + [
46359
+ var reOptMod = rsModifier + "?";
46360
+ var rsOptVar = "[" + rsVarRange + "]?";
46361
+ var rsOptJoin = "(?:" + rsZWJ + "(?:" + [
45638
46362
  rsNonAstral,
45639
46363
  rsRegional,
45640
46364
  rsSurrPair
45641
- ].join("|") + ")" + rsOptVar + reOptMod + ")*", rsSeq = rsOptVar + reOptMod + rsOptJoin, rsSymbol = "(?:" + [
46365
+ ].join("|") + ")" + rsOptVar + reOptMod + ")*";
46366
+ var rsSeq = rsOptVar + reOptMod + rsOptJoin;
46367
+ var rsSymbol = "(?:" + [
45642
46368
  rsNonAstral + rsCombo + "?",
45643
46369
  rsCombo,
45644
46370
  rsRegional,
@@ -45773,7 +46499,8 @@ var require_lodash_truncate = /* @__PURE__ */ __commonJSMin(((exports, module) =
45773
46499
  /** Built-in value references. */
45774
46500
  var Symbol = root.Symbol;
45775
46501
  /** Used to convert symbols to primitives and strings. */
45776
- var symbolProto = Symbol ? Symbol.prototype : void 0, symbolToString = symbolProto ? symbolProto.toString : void 0;
46502
+ var symbolProto = Symbol ? Symbol.prototype : void 0;
46503
+ var symbolToString = symbolProto ? symbolProto.toString : void 0;
45777
46504
  /**
45778
46505
  * The base implementation of `_.isRegExp` without Node.js optimizations.
45779
46506
  *
@@ -48761,8 +49488,9 @@ const licenseCommand = {
48761
49488
  command: "license [package]",
48762
49489
  describe: "License - Check licenses of dependencies",
48763
49490
  handler: async (argv) => {
48764
- if (Boolean(argv.verbose)) console.log(`License: ${argv.package ?? "all"}`);
48765
- await withEnvelope("license", () => license());
49491
+ const pkg = argv.package;
49492
+ if (Boolean(argv.verbose)) console.log(`License: ${pkg ?? "all"}`);
49493
+ await withEnvelope("license", () => license(pkg));
48766
49494
  }
48767
49495
  };
48768
49496
  //#endregion
@@ -49649,8 +50377,8 @@ const cycleCommand = {
49649
50377
  builder: (yargs) => {
49650
50378
  return packagePositionalParam(yargs).option("cache", {
49651
50379
  alias: "c",
49652
- default: false,
49653
- description: "Use caching for performance",
50380
+ default: true,
50381
+ description: "Use ESLint content cache under .xy/cache/eslint (disable with --no-cache)",
49654
50382
  type: "boolean"
49655
50383
  }).option("depth", {
49656
50384
  default: 25,
@@ -49677,6 +50405,7 @@ const cycleCommand = {
49677
50405
  depth: argv.depth,
49678
50406
  jobs: argv.jobs,
49679
50407
  pkg: argv.package,
50408
+ profile: argv.profile,
49680
50409
  verbose: !!Boolean(argv.verbose)
49681
50410
  }));
49682
50411
  }
@@ -49863,8 +50592,8 @@ const runCommand = {
49863
50592
  type: "boolean"
49864
50593
  }).option("cache", {
49865
50594
  alias: "c",
49866
- default: false,
49867
- description: "Use caching for performance",
50595
+ default: true,
50596
+ description: "Use ESLint content cache under .xy/cache/eslint (disable with --no-cache)",
49868
50597
  type: "boolean"
49869
50598
  }).option("fresh", {
49870
50599
  default: false,
@@ -49887,6 +50616,23 @@ const runCommand = {
49887
50616
  default: false,
49888
50617
  description: "List effective ESLint rules for this project",
49889
50618
  type: "boolean"
50619
+ }).option("type-checked", {
50620
+ default: void 0,
50621
+ description: "Force type-aware ESLint (true) or disable it (false). Default auto uses project config; meta packages lint without type-checking",
50622
+ type: "boolean"
50623
+ }).option("skip-empty", {
50624
+ default: true,
50625
+ description: "Skip packages with no lintable source files (disable with --no-skip-empty)",
50626
+ type: "boolean"
50627
+ }).option("meta", {
50628
+ choices: [
50629
+ "full",
50630
+ "light",
50631
+ "skip"
50632
+ ],
50633
+ default: "light",
50634
+ description: "Monorepo meta/root packages (no src/): full lint, light (non-type-checked), or skip",
50635
+ type: "string"
49890
50636
  });
49891
50637
  },
49892
50638
  command: "run [package]",
@@ -49906,14 +50652,19 @@ const runCommand = {
49906
50652
  }));
49907
50653
  return;
49908
50654
  }
50655
+ const typeCheckedArg = argv["type-checked"];
49909
50656
  await withEnvelope("lint", () => lint({
49910
50657
  analyze: argv.analyze,
49911
50658
  cache: argv.cache,
49912
50659
  fix: argv.fix,
49913
50660
  incremental: argv.incremental !== false,
49914
50661
  jobs: argv.jobs,
50662
+ meta: argv.meta,
49915
50663
  prev: argv.prev,
49916
50664
  pkg: argv.package,
50665
+ profile: argv.profile,
50666
+ skipEmpty: argv["skip-empty"],
50667
+ typeChecked: typeCheckedArg === void 0 ? "auto" : typeCheckedArg,
49917
50668
  verbose: !!Boolean(argv.verbose)
49918
50669
  }));
49919
50670
  }
@@ -52214,7 +52965,9 @@ function stripQuotes(val) {
52214
52965
  * Copyright (c) 2016, Contributors
52215
52966
  * SPDX-License-Identifier: ISC
52216
52967
  */
52217
- var _a, _b, _c;
52968
+ var _a;
52969
+ var _b;
52970
+ var _c;
52218
52971
  const minNodeVersion = process && process.env && process.env.YARGS_MIN_NODE_VERSION ? Number(process.env.YARGS_MIN_NODE_VERSION) : 20;
52219
52972
  const nodeVersion = (_b = (_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node) !== null && _b !== void 0 ? _b : (_c = process === null || process === void 0 ? void 0 : process.version) === null || _c === void 0 ? void 0 : _c.slice(1);
52220
52973
  if (nodeVersion) {
@@ -54030,7 +54783,41 @@ var __classPrivateFieldGet = function(receiver, state, kind, f) {
54030
54783
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
54031
54784
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
54032
54785
  };
54033
- var _YargsInstance_command, _YargsInstance_cwd, _YargsInstance_context, _YargsInstance_completion, _YargsInstance_completionCommand, _YargsInstance_defaultShowHiddenOpt, _YargsInstance_exitError, _YargsInstance_detectLocale, _YargsInstance_emittedWarnings, _YargsInstance_exitProcess, _YargsInstance_frozens, _YargsInstance_globalMiddleware, _YargsInstance_groups, _YargsInstance_hasOutput, _YargsInstance_helpOpt, _YargsInstance_isGlobalContext, _YargsInstance_logger, _YargsInstance_output, _YargsInstance_options, _YargsInstance_parentRequire, _YargsInstance_parserConfig, _YargsInstance_parseFn, _YargsInstance_parseContext, _YargsInstance_pkgs, _YargsInstance_preservedGroups, _YargsInstance_processArgs, _YargsInstance_recommendCommands, _YargsInstance_shim, _YargsInstance_strict, _YargsInstance_strictCommands, _YargsInstance_strictOptions, _YargsInstance_usage, _YargsInstance_usageConfig, _YargsInstance_versionOpt, _YargsInstance_validation;
54786
+ var _YargsInstance_command;
54787
+ var _YargsInstance_cwd;
54788
+ var _YargsInstance_context;
54789
+ var _YargsInstance_completion;
54790
+ var _YargsInstance_completionCommand;
54791
+ var _YargsInstance_defaultShowHiddenOpt;
54792
+ var _YargsInstance_exitError;
54793
+ var _YargsInstance_detectLocale;
54794
+ var _YargsInstance_emittedWarnings;
54795
+ var _YargsInstance_exitProcess;
54796
+ var _YargsInstance_frozens;
54797
+ var _YargsInstance_globalMiddleware;
54798
+ var _YargsInstance_groups;
54799
+ var _YargsInstance_hasOutput;
54800
+ var _YargsInstance_helpOpt;
54801
+ var _YargsInstance_isGlobalContext;
54802
+ var _YargsInstance_logger;
54803
+ var _YargsInstance_output;
54804
+ var _YargsInstance_options;
54805
+ var _YargsInstance_parentRequire;
54806
+ var _YargsInstance_parserConfig;
54807
+ var _YargsInstance_parseFn;
54808
+ var _YargsInstance_parseContext;
54809
+ var _YargsInstance_pkgs;
54810
+ var _YargsInstance_preservedGroups;
54811
+ var _YargsInstance_processArgs;
54812
+ var _YargsInstance_recommendCommands;
54813
+ var _YargsInstance_shim;
54814
+ var _YargsInstance_strict;
54815
+ var _YargsInstance_strictCommands;
54816
+ var _YargsInstance_strictOptions;
54817
+ var _YargsInstance_usage;
54818
+ var _YargsInstance_usageConfig;
54819
+ var _YargsInstance_versionOpt;
54820
+ var _YargsInstance_validation;
54034
54821
  function YargsFactory(_shim) {
54035
54822
  return (processArgs = [], cwd = _shim.process.cwd(), parentRequire) => {
54036
54823
  const yargs = new YargsInstance(processArgs, cwd, parentRequire, _shim);
@@ -55366,7 +56153,7 @@ const xyParseOptions = () => {
55366
56153
  }).option("profile", {
55367
56154
  alias: "p",
55368
56155
  default: false,
55369
- description: "Profile action",
56156
+ description: "Emit per-package timing profile (lint: config / lint / spawn phases)",
55370
56157
  type: "boolean"
55371
56158
  }).option("json", {
55372
56159
  default: false,