@slidev/cli 0.43.14 → 0.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ViteSlidevPlugin,
3
3
  mergeViteConfigs
4
- } from "./chunk-72OPDAKL.mjs";
4
+ } from "./chunk-WSLI6C3D.mjs";
5
5
  import {
6
6
  packageExists,
7
7
  resolveImportPath
@@ -142,14 +142,14 @@ var require_parse_options = __commonJS({
142
142
  "use strict";
143
143
  var looseOption = Object.freeze({ loose: true });
144
144
  var emptyOpts = Object.freeze({});
145
- var parseOptions = (options) => {
146
- if (!options) {
145
+ var parseOptions = (options2) => {
146
+ if (!options2) {
147
147
  return emptyOpts;
148
148
  }
149
- if (typeof options !== "object") {
149
+ if (typeof options2 !== "object") {
150
150
  return looseOption;
151
151
  }
152
- return options;
152
+ return options2;
153
153
  };
154
154
  module.exports = parseOptions;
155
155
  }
@@ -187,10 +187,10 @@ var require_semver = __commonJS({
187
187
  var parseOptions = require_parse_options();
188
188
  var { compareIdentifiers } = require_identifiers();
189
189
  var SemVer = class _SemVer {
190
- constructor(version3, options) {
191
- options = parseOptions(options);
190
+ constructor(version3, options2) {
191
+ options2 = parseOptions(options2);
192
192
  if (version3 instanceof _SemVer) {
193
- if (version3.loose === !!options.loose && version3.includePrerelease === !!options.includePrerelease) {
193
+ if (version3.loose === !!options2.loose && version3.includePrerelease === !!options2.includePrerelease) {
194
194
  return version3;
195
195
  } else {
196
196
  version3 = version3.version;
@@ -203,11 +203,11 @@ var require_semver = __commonJS({
203
203
  `version is longer than ${MAX_LENGTH} characters`
204
204
  );
205
205
  }
206
- debug2("SemVer", version3, options);
207
- this.options = options;
208
- this.loose = !!options.loose;
209
- this.includePrerelease = !!options.includePrerelease;
210
- const m = version3.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
206
+ debug2("SemVer", version3, options2);
207
+ this.options = options2;
208
+ this.loose = !!options2.loose;
209
+ this.includePrerelease = !!options2.includePrerelease;
210
+ const m = version3.trim().match(options2.loose ? re[t.LOOSE] : re[t.FULL]);
211
211
  if (!m) {
212
212
  throw new TypeError(`Invalid Version: ${version3}`);
213
213
  }
@@ -425,12 +425,12 @@ var require_parse = __commonJS({
425
425
  "../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/functions/parse.js"(exports, module) {
426
426
  "use strict";
427
427
  var SemVer = require_semver();
428
- var parse2 = (version3, options, throwErrors = false) => {
428
+ var parse2 = (version3, options2, throwErrors = false) => {
429
429
  if (version3 instanceof SemVer) {
430
430
  return version3;
431
431
  }
432
432
  try {
433
- return new SemVer(version3, options);
433
+ return new SemVer(version3, options2);
434
434
  } catch (er) {
435
435
  if (!throwErrors) {
436
436
  return null;
@@ -447,8 +447,8 @@ var require_valid = __commonJS({
447
447
  "../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/functions/valid.js"(exports, module) {
448
448
  "use strict";
449
449
  var parse2 = require_parse();
450
- var valid = (version3, options) => {
451
- const v = parse2(version3, options);
450
+ var valid = (version3, options2) => {
451
+ const v = parse2(version3, options2);
452
452
  return v ? v.version : null;
453
453
  };
454
454
  module.exports = valid;
@@ -460,8 +460,8 @@ var require_clean = __commonJS({
460
460
  "../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/functions/clean.js"(exports, module) {
461
461
  "use strict";
462
462
  var parse2 = require_parse();
463
- var clean = (version3, options) => {
464
- const s = parse2(version3.trim().replace(/^[=v]+/, ""), options);
463
+ var clean = (version3, options2) => {
464
+ const s = parse2(version3.trim().replace(/^[=v]+/, ""), options2);
465
465
  return s ? s.version : null;
466
466
  };
467
467
  module.exports = clean;
@@ -473,16 +473,16 @@ var require_inc = __commonJS({
473
473
  "../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/functions/inc.js"(exports, module) {
474
474
  "use strict";
475
475
  var SemVer = require_semver();
476
- var inc = (version3, release, options, identifier, identifierBase) => {
477
- if (typeof options === "string") {
476
+ var inc = (version3, release, options2, identifier, identifierBase) => {
477
+ if (typeof options2 === "string") {
478
478
  identifierBase = identifier;
479
- identifier = options;
480
- options = void 0;
479
+ identifier = options2;
480
+ options2 = void 0;
481
481
  }
482
482
  try {
483
483
  return new SemVer(
484
484
  version3 instanceof SemVer ? version3.version : version3,
485
- options
485
+ options2
486
486
  ).inc(release, identifier, identifierBase).version;
487
487
  } catch (er) {
488
488
  return null;
@@ -572,8 +572,8 @@ var require_prerelease = __commonJS({
572
572
  "../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/functions/prerelease.js"(exports, module) {
573
573
  "use strict";
574
574
  var parse2 = require_parse();
575
- var prerelease = (version3, options) => {
576
- const parsed = parse2(version3, options);
575
+ var prerelease = (version3, options2) => {
576
+ const parsed = parse2(version3, options2);
577
577
  return parsed && parsed.prerelease.length ? parsed.prerelease : null;
578
578
  };
579
579
  module.exports = prerelease;
@@ -761,7 +761,7 @@ var require_coerce = __commonJS({
761
761
  var SemVer = require_semver();
762
762
  var parse2 = require_parse();
763
763
  var { safeRe: re, t } = require_re();
764
- var coerce = (version3, options) => {
764
+ var coerce = (version3, options2) => {
765
765
  if (version3 instanceof SemVer) {
766
766
  return version3;
767
767
  }
@@ -771,9 +771,9 @@ var require_coerce = __commonJS({
771
771
  if (typeof version3 !== "string") {
772
772
  return null;
773
773
  }
774
- options = options || {};
774
+ options2 = options2 || {};
775
775
  let match = null;
776
- if (!options.rtl) {
776
+ if (!options2.rtl) {
777
777
  match = version3.match(re[t.COERCE]);
778
778
  } else {
779
779
  let next;
@@ -788,7 +788,7 @@ var require_coerce = __commonJS({
788
788
  if (match === null) {
789
789
  return null;
790
790
  }
791
- return parse2(`${match[2]}.${match[3] || "0"}.${match[4] || "0"}`, options);
791
+ return parse2(`${match[2]}.${match[3] || "0"}.${match[4] || "0"}`, options2);
792
792
  };
793
793
  module.exports = coerce;
794
794
  }
@@ -1194,23 +1194,23 @@ var require_lru_cache = __commonJS({
1194
1194
  var UPDATE_AGE_ON_GET = Symbol("updateAgeOnGet");
1195
1195
  var naiveLength = () => 1;
1196
1196
  var LRUCache = class {
1197
- constructor(options) {
1198
- if (typeof options === "number")
1199
- options = { max: options };
1200
- if (!options)
1201
- options = {};
1202
- if (options.max && (typeof options.max !== "number" || options.max < 0))
1197
+ constructor(options2) {
1198
+ if (typeof options2 === "number")
1199
+ options2 = { max: options2 };
1200
+ if (!options2)
1201
+ options2 = {};
1202
+ if (options2.max && (typeof options2.max !== "number" || options2.max < 0))
1203
1203
  throw new TypeError("max must be a non-negative number");
1204
- const max = this[MAX] = options.max || Infinity;
1205
- const lc = options.length || naiveLength;
1204
+ const max = this[MAX] = options2.max || Infinity;
1205
+ const lc = options2.length || naiveLength;
1206
1206
  this[LENGTH_CALCULATOR] = typeof lc !== "function" ? naiveLength : lc;
1207
- this[ALLOW_STALE] = options.stale || false;
1208
- if (options.maxAge && typeof options.maxAge !== "number")
1207
+ this[ALLOW_STALE] = options2.stale || false;
1208
+ if (options2.maxAge && typeof options2.maxAge !== "number")
1209
1209
  throw new TypeError("maxAge must be a number");
1210
- this[MAX_AGE] = options.maxAge || 0;
1211
- this[DISPOSE] = options.dispose;
1212
- this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
1213
- this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
1210
+ this[MAX_AGE] = options2.maxAge || 0;
1211
+ this[DISPOSE] = options2.dispose;
1212
+ this[NO_DISPOSE_ON_SET] = options2.noDisposeOnSet || false;
1213
+ this[UPDATE_AGE_ON_GET] = options2.updateAgeOnGet || false;
1214
1214
  this.reset();
1215
1215
  }
1216
1216
  // resize the cache when the max changes.
@@ -1452,13 +1452,13 @@ var require_range = __commonJS({
1452
1452
  "../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/classes/range.js"(exports, module) {
1453
1453
  "use strict";
1454
1454
  var Range = class _Range {
1455
- constructor(range, options) {
1456
- options = parseOptions(options);
1455
+ constructor(range, options2) {
1456
+ options2 = parseOptions(options2);
1457
1457
  if (range instanceof _Range) {
1458
- if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
1458
+ if (range.loose === !!options2.loose && range.includePrerelease === !!options2.includePrerelease) {
1459
1459
  return range;
1460
1460
  } else {
1461
- return new _Range(range.raw, options);
1461
+ return new _Range(range.raw, options2);
1462
1462
  }
1463
1463
  }
1464
1464
  if (range instanceof Comparator) {
@@ -1467,9 +1467,9 @@ var require_range = __commonJS({
1467
1467
  this.format();
1468
1468
  return this;
1469
1469
  }
1470
- this.options = options;
1471
- this.loose = !!options.loose;
1472
- this.includePrerelease = !!options.includePrerelease;
1470
+ this.options = options2;
1471
+ this.loose = !!options2.loose;
1472
+ this.includePrerelease = !!options2.includePrerelease;
1473
1473
  this.raw = range.trim().split(/\s+/).join(" ");
1474
1474
  this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c2) => c2.length);
1475
1475
  if (!this.set.length) {
@@ -1538,15 +1538,15 @@ var require_range = __commonJS({
1538
1538
  cache.set(memoKey, result);
1539
1539
  return result;
1540
1540
  }
1541
- intersects(range, options) {
1541
+ intersects(range, options2) {
1542
1542
  if (!(range instanceof _Range)) {
1543
1543
  throw new TypeError("a Range is required");
1544
1544
  }
1545
1545
  return this.set.some((thisComparators) => {
1546
- return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
1547
- return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
1546
+ return isSatisfiable(thisComparators, options2) && range.set.some((rangeComparators) => {
1547
+ return isSatisfiable(rangeComparators, options2) && thisComparators.every((thisComparator) => {
1548
1548
  return rangeComparators.every((rangeComparator) => {
1549
- return thisComparator.intersects(rangeComparator, options);
1549
+ return thisComparator.intersects(rangeComparator, options2);
1550
1550
  });
1551
1551
  });
1552
1552
  });
@@ -1589,36 +1589,36 @@ var require_range = __commonJS({
1589
1589
  var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
1590
1590
  var isNullSet = (c2) => c2.value === "<0.0.0-0";
1591
1591
  var isAny = (c2) => c2.value === "";
1592
- var isSatisfiable = (comparators, options) => {
1592
+ var isSatisfiable = (comparators, options2) => {
1593
1593
  let result = true;
1594
1594
  const remainingComparators = comparators.slice();
1595
1595
  let testComparator = remainingComparators.pop();
1596
1596
  while (result && remainingComparators.length) {
1597
1597
  result = remainingComparators.every((otherComparator) => {
1598
- return testComparator.intersects(otherComparator, options);
1598
+ return testComparator.intersects(otherComparator, options2);
1599
1599
  });
1600
1600
  testComparator = remainingComparators.pop();
1601
1601
  }
1602
1602
  return result;
1603
1603
  };
1604
- var parseComparator = (comp, options) => {
1605
- debug2("comp", comp, options);
1606
- comp = replaceCarets(comp, options);
1604
+ var parseComparator = (comp, options2) => {
1605
+ debug2("comp", comp, options2);
1606
+ comp = replaceCarets(comp, options2);
1607
1607
  debug2("caret", comp);
1608
- comp = replaceTildes(comp, options);
1608
+ comp = replaceTildes(comp, options2);
1609
1609
  debug2("tildes", comp);
1610
- comp = replaceXRanges(comp, options);
1610
+ comp = replaceXRanges(comp, options2);
1611
1611
  debug2("xrange", comp);
1612
- comp = replaceStars(comp, options);
1612
+ comp = replaceStars(comp, options2);
1613
1613
  debug2("stars", comp);
1614
1614
  return comp;
1615
1615
  };
1616
1616
  var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
1617
- var replaceTildes = (comp, options) => {
1618
- return comp.trim().split(/\s+/).map((c2) => replaceTilde(c2, options)).join(" ");
1617
+ var replaceTildes = (comp, options2) => {
1618
+ return comp.trim().split(/\s+/).map((c2) => replaceTilde(c2, options2)).join(" ");
1619
1619
  };
1620
- var replaceTilde = (comp, options) => {
1621
- const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
1620
+ var replaceTilde = (comp, options2) => {
1621
+ const r = options2.loose ? re[t.TILDELOOSE] : re[t.TILDE];
1622
1622
  return comp.replace(r, (_, M, m, p, pr) => {
1623
1623
  debug2("tilde", comp, _, M, m, p, pr);
1624
1624
  let ret;
@@ -1638,13 +1638,13 @@ var require_range = __commonJS({
1638
1638
  return ret;
1639
1639
  });
1640
1640
  };
1641
- var replaceCarets = (comp, options) => {
1642
- return comp.trim().split(/\s+/).map((c2) => replaceCaret(c2, options)).join(" ");
1641
+ var replaceCarets = (comp, options2) => {
1642
+ return comp.trim().split(/\s+/).map((c2) => replaceCaret(c2, options2)).join(" ");
1643
1643
  };
1644
- var replaceCaret = (comp, options) => {
1645
- debug2("caret", comp, options);
1646
- const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
1647
- const z = options.includePrerelease ? "-0" : "";
1644
+ var replaceCaret = (comp, options2) => {
1645
+ debug2("caret", comp, options2);
1646
+ const r = options2.loose ? re[t.CARETLOOSE] : re[t.CARET];
1647
+ const z = options2.includePrerelease ? "-0" : "";
1648
1648
  return comp.replace(r, (_, M, m, p, pr) => {
1649
1649
  debug2("caret", comp, _, M, m, p, pr);
1650
1650
  let ret;
@@ -1685,13 +1685,13 @@ var require_range = __commonJS({
1685
1685
  return ret;
1686
1686
  });
1687
1687
  };
1688
- var replaceXRanges = (comp, options) => {
1689
- debug2("replaceXRanges", comp, options);
1690
- return comp.split(/\s+/).map((c2) => replaceXRange(c2, options)).join(" ");
1688
+ var replaceXRanges = (comp, options2) => {
1689
+ debug2("replaceXRanges", comp, options2);
1690
+ return comp.split(/\s+/).map((c2) => replaceXRange(c2, options2)).join(" ");
1691
1691
  };
1692
- var replaceXRange = (comp, options) => {
1692
+ var replaceXRange = (comp, options2) => {
1693
1693
  comp = comp.trim();
1694
- const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
1694
+ const r = options2.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
1695
1695
  return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
1696
1696
  debug2("xRange", comp, ret, gtlt, M, m, p, pr);
1697
1697
  const xM = isX(M);
@@ -1701,7 +1701,7 @@ var require_range = __commonJS({
1701
1701
  if (gtlt === "=" && anyX) {
1702
1702
  gtlt = "";
1703
1703
  }
1704
- pr = options.includePrerelease ? "-0" : "";
1704
+ pr = options2.includePrerelease ? "-0" : "";
1705
1705
  if (xM) {
1706
1706
  if (gtlt === ">" || gtlt === "<") {
1707
1707
  ret = "<0.0.0-0";
@@ -1744,13 +1744,13 @@ var require_range = __commonJS({
1744
1744
  return ret;
1745
1745
  });
1746
1746
  };
1747
- var replaceStars = (comp, options) => {
1748
- debug2("replaceStars", comp, options);
1747
+ var replaceStars = (comp, options2) => {
1748
+ debug2("replaceStars", comp, options2);
1749
1749
  return comp.trim().replace(re[t.STAR], "");
1750
1750
  };
1751
- var replaceGTE0 = (comp, options) => {
1752
- debug2("replaceGTE0", comp, options);
1753
- return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
1751
+ var replaceGTE0 = (comp, options2) => {
1752
+ debug2("replaceGTE0", comp, options2);
1753
+ return comp.trim().replace(re[options2.includePrerelease ? t.GTE0PRE : t.GTE0], "");
1754
1754
  };
1755
1755
  var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) => {
1756
1756
  if (isX(fM)) {
@@ -1779,13 +1779,13 @@ var require_range = __commonJS({
1779
1779
  }
1780
1780
  return `${from} ${to}`.trim();
1781
1781
  };
1782
- var testSet = (set, version3, options) => {
1782
+ var testSet = (set, version3, options2) => {
1783
1783
  for (let i = 0; i < set.length; i++) {
1784
1784
  if (!set[i].test(version3)) {
1785
1785
  return false;
1786
1786
  }
1787
1787
  }
1788
- if (version3.prerelease.length && !options.includePrerelease) {
1788
+ if (version3.prerelease.length && !options2.includePrerelease) {
1789
1789
  for (let i = 0; i < set.length; i++) {
1790
1790
  debug2(set[i].semver);
1791
1791
  if (set[i].semver === Comparator.ANY) {
@@ -1814,19 +1814,19 @@ var require_comparator = __commonJS({
1814
1814
  static get ANY() {
1815
1815
  return ANY;
1816
1816
  }
1817
- constructor(comp, options) {
1818
- options = parseOptions(options);
1817
+ constructor(comp, options2) {
1818
+ options2 = parseOptions(options2);
1819
1819
  if (comp instanceof _Comparator) {
1820
- if (comp.loose === !!options.loose) {
1820
+ if (comp.loose === !!options2.loose) {
1821
1821
  return comp;
1822
1822
  } else {
1823
1823
  comp = comp.value;
1824
1824
  }
1825
1825
  }
1826
1826
  comp = comp.trim().split(/\s+/).join(" ");
1827
- debug2("comparator", comp, options);
1828
- this.options = options;
1829
- this.loose = !!options.loose;
1827
+ debug2("comparator", comp, options2);
1828
+ this.options = options2;
1829
+ this.loose = !!options2.loose;
1830
1830
  this.parse(comp);
1831
1831
  if (this.semver === ANY) {
1832
1832
  this.value = "";
@@ -1868,7 +1868,7 @@ var require_comparator = __commonJS({
1868
1868
  }
1869
1869
  return cmp(version3, this.operator, this.semver, this.options);
1870
1870
  }
1871
- intersects(comp, options) {
1871
+ intersects(comp, options2) {
1872
1872
  if (!(comp instanceof _Comparator)) {
1873
1873
  throw new TypeError("a Comparator is required");
1874
1874
  }
@@ -1876,18 +1876,18 @@ var require_comparator = __commonJS({
1876
1876
  if (this.value === "") {
1877
1877
  return true;
1878
1878
  }
1879
- return new Range(comp.value, options).test(this.value);
1879
+ return new Range(comp.value, options2).test(this.value);
1880
1880
  } else if (comp.operator === "") {
1881
1881
  if (comp.value === "") {
1882
1882
  return true;
1883
1883
  }
1884
- return new Range(this.value, options).test(comp.semver);
1884
+ return new Range(this.value, options2).test(comp.semver);
1885
1885
  }
1886
- options = parseOptions(options);
1887
- if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
1886
+ options2 = parseOptions(options2);
1887
+ if (options2.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
1888
1888
  return false;
1889
1889
  }
1890
- if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
1890
+ if (!options2.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
1891
1891
  return false;
1892
1892
  }
1893
1893
  if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
@@ -1899,10 +1899,10 @@ var require_comparator = __commonJS({
1899
1899
  if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
1900
1900
  return true;
1901
1901
  }
1902
- if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
1902
+ if (cmp(this.semver, "<", comp.semver, options2) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
1903
1903
  return true;
1904
1904
  }
1905
- if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
1905
+ if (cmp(this.semver, ">", comp.semver, options2) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
1906
1906
  return true;
1907
1907
  }
1908
1908
  return false;
@@ -1923,9 +1923,9 @@ var require_satisfies = __commonJS({
1923
1923
  "../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/functions/satisfies.js"(exports, module) {
1924
1924
  "use strict";
1925
1925
  var Range = require_range();
1926
- var satisfies3 = (version3, range, options) => {
1926
+ var satisfies3 = (version3, range, options2) => {
1927
1927
  try {
1928
- range = new Range(range, options);
1928
+ range = new Range(range, options2);
1929
1929
  } catch (er) {
1930
1930
  return false;
1931
1931
  }
@@ -1940,7 +1940,7 @@ var require_to_comparators = __commonJS({
1940
1940
  "../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/ranges/to-comparators.js"(exports, module) {
1941
1941
  "use strict";
1942
1942
  var Range = require_range();
1943
- var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c2) => c2.value).join(" ").trim().split(" "));
1943
+ var toComparators = (range, options2) => new Range(range, options2).set.map((comp) => comp.map((c2) => c2.value).join(" ").trim().split(" "));
1944
1944
  module.exports = toComparators;
1945
1945
  }
1946
1946
  });
@@ -1951,12 +1951,12 @@ var require_max_satisfying = __commonJS({
1951
1951
  "use strict";
1952
1952
  var SemVer = require_semver();
1953
1953
  var Range = require_range();
1954
- var maxSatisfying = (versions, range, options) => {
1954
+ var maxSatisfying = (versions, range, options2) => {
1955
1955
  let max = null;
1956
1956
  let maxSV = null;
1957
1957
  let rangeObj = null;
1958
1958
  try {
1959
- rangeObj = new Range(range, options);
1959
+ rangeObj = new Range(range, options2);
1960
1960
  } catch (er) {
1961
1961
  return null;
1962
1962
  }
@@ -1964,7 +1964,7 @@ var require_max_satisfying = __commonJS({
1964
1964
  if (rangeObj.test(v)) {
1965
1965
  if (!max || maxSV.compare(v) === -1) {
1966
1966
  max = v;
1967
- maxSV = new SemVer(max, options);
1967
+ maxSV = new SemVer(max, options2);
1968
1968
  }
1969
1969
  }
1970
1970
  });
@@ -1980,12 +1980,12 @@ var require_min_satisfying = __commonJS({
1980
1980
  "use strict";
1981
1981
  var SemVer = require_semver();
1982
1982
  var Range = require_range();
1983
- var minSatisfying = (versions, range, options) => {
1983
+ var minSatisfying = (versions, range, options2) => {
1984
1984
  let min = null;
1985
1985
  let minSV = null;
1986
1986
  let rangeObj = null;
1987
1987
  try {
1988
- rangeObj = new Range(range, options);
1988
+ rangeObj = new Range(range, options2);
1989
1989
  } catch (er) {
1990
1990
  return null;
1991
1991
  }
@@ -1993,7 +1993,7 @@ var require_min_satisfying = __commonJS({
1993
1993
  if (rangeObj.test(v)) {
1994
1994
  if (!min || minSV.compare(v) === 1) {
1995
1995
  min = v;
1996
- minSV = new SemVer(min, options);
1996
+ minSV = new SemVer(min, options2);
1997
1997
  }
1998
1998
  }
1999
1999
  });
@@ -2065,9 +2065,9 @@ var require_valid2 = __commonJS({
2065
2065
  "../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/ranges/valid.js"(exports, module) {
2066
2066
  "use strict";
2067
2067
  var Range = require_range();
2068
- var validRange = (range, options) => {
2068
+ var validRange = (range, options2) => {
2069
2069
  try {
2070
- return new Range(range, options).range || "*";
2070
+ return new Range(range, options2).range || "*";
2071
2071
  } catch (er) {
2072
2072
  return null;
2073
2073
  }
@@ -2089,9 +2089,9 @@ var require_outside = __commonJS({
2089
2089
  var lt = require_lt();
2090
2090
  var lte = require_lte();
2091
2091
  var gte = require_gte();
2092
- var outside = (version3, range, hilo, options) => {
2093
- version3 = new SemVer(version3, options);
2094
- range = new Range(range, options);
2092
+ var outside = (version3, range, hilo, options2) => {
2093
+ version3 = new SemVer(version3, options2);
2094
+ range = new Range(range, options2);
2095
2095
  let gtfn, ltefn, ltfn, comp, ecomp;
2096
2096
  switch (hilo) {
2097
2097
  case ">":
@@ -2111,7 +2111,7 @@ var require_outside = __commonJS({
2111
2111
  default:
2112
2112
  throw new TypeError('Must provide a hilo val of "<" or ">"');
2113
2113
  }
2114
- if (satisfies3(version3, range, options)) {
2114
+ if (satisfies3(version3, range, options2)) {
2115
2115
  return false;
2116
2116
  }
2117
2117
  for (let i = 0; i < range.set.length; ++i) {
@@ -2124,9 +2124,9 @@ var require_outside = __commonJS({
2124
2124
  }
2125
2125
  high = high || comparator;
2126
2126
  low = low || comparator;
2127
- if (gtfn(comparator.semver, high.semver, options)) {
2127
+ if (gtfn(comparator.semver, high.semver, options2)) {
2128
2128
  high = comparator;
2129
- } else if (ltfn(comparator.semver, low.semver, options)) {
2129
+ } else if (ltfn(comparator.semver, low.semver, options2)) {
2130
2130
  low = comparator;
2131
2131
  }
2132
2132
  });
@@ -2150,7 +2150,7 @@ var require_gtr = __commonJS({
2150
2150
  "../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/ranges/gtr.js"(exports, module) {
2151
2151
  "use strict";
2152
2152
  var outside = require_outside();
2153
- var gtr = (version3, range, options) => outside(version3, range, ">", options);
2153
+ var gtr = (version3, range, options2) => outside(version3, range, ">", options2);
2154
2154
  module.exports = gtr;
2155
2155
  }
2156
2156
  });
@@ -2160,7 +2160,7 @@ var require_ltr = __commonJS({
2160
2160
  "../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/ranges/ltr.js"(exports, module) {
2161
2161
  "use strict";
2162
2162
  var outside = require_outside();
2163
- var ltr = (version3, range, options) => outside(version3, range, "<", options);
2163
+ var ltr = (version3, range, options2) => outside(version3, range, "<", options2);
2164
2164
  module.exports = ltr;
2165
2165
  }
2166
2166
  });
@@ -2170,10 +2170,10 @@ var require_intersects = __commonJS({
2170
2170
  "../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/ranges/intersects.js"(exports, module) {
2171
2171
  "use strict";
2172
2172
  var Range = require_range();
2173
- var intersects = (r1, r2, options) => {
2174
- r1 = new Range(r1, options);
2175
- r2 = new Range(r2, options);
2176
- return r1.intersects(r2, options);
2173
+ var intersects = (r1, r2, options2) => {
2174
+ r1 = new Range(r1, options2);
2175
+ r2 = new Range(r2, options2);
2176
+ return r1.intersects(r2, options2);
2177
2177
  };
2178
2178
  module.exports = intersects;
2179
2179
  }
@@ -2185,13 +2185,13 @@ var require_simplify = __commonJS({
2185
2185
  "use strict";
2186
2186
  var satisfies3 = require_satisfies();
2187
2187
  var compare = require_compare();
2188
- module.exports = (versions, range, options) => {
2188
+ module.exports = (versions, range, options2) => {
2189
2189
  const set = [];
2190
2190
  let first = null;
2191
2191
  let prev = null;
2192
- const v = versions.sort((a, b) => compare(a, b, options));
2192
+ const v = versions.sort((a, b) => compare(a, b, options2));
2193
2193
  for (const version3 of v) {
2194
- const included = satisfies3(version3, range, options);
2194
+ const included = satisfies3(version3, range, options2);
2195
2195
  if (included) {
2196
2196
  prev = version3;
2197
2197
  if (!first) {
@@ -2238,17 +2238,17 @@ var require_subset = __commonJS({
2238
2238
  var { ANY } = Comparator;
2239
2239
  var satisfies3 = require_satisfies();
2240
2240
  var compare = require_compare();
2241
- var subset = (sub, dom, options = {}) => {
2241
+ var subset = (sub, dom, options2 = {}) => {
2242
2242
  if (sub === dom) {
2243
2243
  return true;
2244
2244
  }
2245
- sub = new Range(sub, options);
2246
- dom = new Range(dom, options);
2245
+ sub = new Range(sub, options2);
2246
+ dom = new Range(dom, options2);
2247
2247
  let sawNonNull = false;
2248
2248
  OUTER:
2249
2249
  for (const simpleSub of sub.set) {
2250
2250
  for (const simpleDom of dom.set) {
2251
- const isSub = simpleSubset(simpleSub, simpleDom, options);
2251
+ const isSub = simpleSubset(simpleSub, simpleDom, options2);
2252
2252
  sawNonNull = sawNonNull || isSub !== null;
2253
2253
  if (isSub) {
2254
2254
  continue OUTER;
@@ -2262,21 +2262,21 @@ var require_subset = __commonJS({
2262
2262
  };
2263
2263
  var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
2264
2264
  var minimumVersion = [new Comparator(">=0.0.0")];
2265
- var simpleSubset = (sub, dom, options) => {
2265
+ var simpleSubset = (sub, dom, options2) => {
2266
2266
  if (sub === dom) {
2267
2267
  return true;
2268
2268
  }
2269
2269
  if (sub.length === 1 && sub[0].semver === ANY) {
2270
2270
  if (dom.length === 1 && dom[0].semver === ANY) {
2271
2271
  return true;
2272
- } else if (options.includePrerelease) {
2272
+ } else if (options2.includePrerelease) {
2273
2273
  sub = minimumVersionWithPreRelease;
2274
2274
  } else {
2275
2275
  sub = minimumVersion;
2276
2276
  }
2277
2277
  }
2278
2278
  if (dom.length === 1 && dom[0].semver === ANY) {
2279
- if (options.includePrerelease) {
2279
+ if (options2.includePrerelease) {
2280
2280
  return true;
2281
2281
  } else {
2282
2282
  dom = minimumVersion;
@@ -2286,9 +2286,9 @@ var require_subset = __commonJS({
2286
2286
  let gt, lt;
2287
2287
  for (const c2 of sub) {
2288
2288
  if (c2.operator === ">" || c2.operator === ">=") {
2289
- gt = higherGT(gt, c2, options);
2289
+ gt = higherGT(gt, c2, options2);
2290
2290
  } else if (c2.operator === "<" || c2.operator === "<=") {
2291
- lt = lowerLT(lt, c2, options);
2291
+ lt = lowerLT(lt, c2, options2);
2292
2292
  } else {
2293
2293
  eqSet.add(c2.semver);
2294
2294
  }
@@ -2298,7 +2298,7 @@ var require_subset = __commonJS({
2298
2298
  }
2299
2299
  let gtltComp;
2300
2300
  if (gt && lt) {
2301
- gtltComp = compare(gt.semver, lt.semver, options);
2301
+ gtltComp = compare(gt.semver, lt.semver, options2);
2302
2302
  if (gtltComp > 0) {
2303
2303
  return null;
2304
2304
  } else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
@@ -2306,14 +2306,14 @@ var require_subset = __commonJS({
2306
2306
  }
2307
2307
  }
2308
2308
  for (const eq of eqSet) {
2309
- if (gt && !satisfies3(eq, String(gt), options)) {
2309
+ if (gt && !satisfies3(eq, String(gt), options2)) {
2310
2310
  return null;
2311
2311
  }
2312
- if (lt && !satisfies3(eq, String(lt), options)) {
2312
+ if (lt && !satisfies3(eq, String(lt), options2)) {
2313
2313
  return null;
2314
2314
  }
2315
2315
  for (const c2 of dom) {
2316
- if (!satisfies3(eq, String(c2), options)) {
2316
+ if (!satisfies3(eq, String(c2), options2)) {
2317
2317
  return false;
2318
2318
  }
2319
2319
  }
@@ -2321,8 +2321,8 @@ var require_subset = __commonJS({
2321
2321
  }
2322
2322
  let higher, lower;
2323
2323
  let hasDomLT, hasDomGT;
2324
- let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
2325
- let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
2324
+ let needDomLTPre = lt && !options2.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
2325
+ let needDomGTPre = gt && !options2.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
2326
2326
  if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
2327
2327
  needDomLTPre = false;
2328
2328
  }
@@ -2336,11 +2336,11 @@ var require_subset = __commonJS({
2336
2336
  }
2337
2337
  }
2338
2338
  if (c2.operator === ">" || c2.operator === ">=") {
2339
- higher = higherGT(gt, c2, options);
2339
+ higher = higherGT(gt, c2, options2);
2340
2340
  if (higher === c2 && higher !== gt) {
2341
2341
  return false;
2342
2342
  }
2343
- } else if (gt.operator === ">=" && !satisfies3(gt.semver, String(c2), options)) {
2343
+ } else if (gt.operator === ">=" && !satisfies3(gt.semver, String(c2), options2)) {
2344
2344
  return false;
2345
2345
  }
2346
2346
  }
@@ -2351,11 +2351,11 @@ var require_subset = __commonJS({
2351
2351
  }
2352
2352
  }
2353
2353
  if (c2.operator === "<" || c2.operator === "<=") {
2354
- lower = lowerLT(lt, c2, options);
2354
+ lower = lowerLT(lt, c2, options2);
2355
2355
  if (lower === c2 && lower !== lt) {
2356
2356
  return false;
2357
2357
  }
2358
- } else if (lt.operator === "<=" && !satisfies3(lt.semver, String(c2), options)) {
2358
+ } else if (lt.operator === "<=" && !satisfies3(lt.semver, String(c2), options2)) {
2359
2359
  return false;
2360
2360
  }
2361
2361
  }
@@ -2374,18 +2374,18 @@ var require_subset = __commonJS({
2374
2374
  }
2375
2375
  return true;
2376
2376
  };
2377
- var higherGT = (a, b, options) => {
2377
+ var higherGT = (a, b, options2) => {
2378
2378
  if (!a) {
2379
2379
  return b;
2380
2380
  }
2381
- const comp = compare(a.semver, b.semver, options);
2381
+ const comp = compare(a.semver, b.semver, options2);
2382
2382
  return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
2383
2383
  };
2384
- var lowerLT = (a, b, options) => {
2384
+ var lowerLT = (a, b, options2) => {
2385
2385
  if (!a) {
2386
2386
  return b;
2387
2387
  }
2388
- const comp = compare(a.semver, b.semver, options);
2388
+ const comp = compare(a.semver, b.semver, options2);
2389
2389
  return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
2390
2390
  };
2391
2391
  module.exports = subset;
@@ -2491,22 +2491,22 @@ var require_semver2 = __commonJS({
2491
2491
  import { join } from "node:path";
2492
2492
  import process2 from "node:process";
2493
2493
  import { createServer as createViteServer, resolveConfig } from "vite";
2494
- async function createServer(options, viteConfig = {}, serverOptions = {}) {
2495
- const rawConfig = await resolveConfig({}, "serve", options.entry);
2494
+ async function createServer(options2, viteConfig = {}, serverOptions = {}) {
2495
+ const rawConfig = await resolveConfig({}, "serve", options2.entry);
2496
2496
  const pluginOptions = rawConfig.slidev || {};
2497
2497
  process2.env.EDITOR = process2.env.EDITOR || "code";
2498
2498
  const server = await createViteServer(
2499
2499
  await mergeViteConfigs(
2500
- options,
2500
+ options2,
2501
2501
  viteConfig,
2502
2502
  {
2503
2503
  optimizeDeps: {
2504
2504
  entries: [
2505
- join(options.clientRoot, "main.ts")
2505
+ join(options2.clientRoot, "main.ts")
2506
2506
  ]
2507
2507
  },
2508
2508
  plugins: [
2509
- await ViteSlidevPlugin(options, pluginOptions, serverOptions)
2509
+ await ViteSlidevPlugin(options2, pluginOptions, serverOptions)
2510
2510
  ]
2511
2511
  },
2512
2512
  "serve"
@@ -2519,31 +2519,30 @@ async function createServer(options, viteConfig = {}, serverOptions = {}) {
2519
2519
  import * as parser from "@slidev/parser/fs";
2520
2520
 
2521
2521
  // package.json
2522
- var version = "0.43.14";
2522
+ var version = "0.44.0";
2523
2523
 
2524
2524
  // node/themes.ts
2525
2525
  import prompts2 from "prompts";
2526
2526
 
2527
- // ../../node_modules/.pnpm/@antfu+ni@0.21.8/node_modules/@antfu/ni/dist/shared/ni.82314ed6.mjs
2528
- import fs$1, { promises, createWriteStream, createReadStream, existsSync } from "node:fs";
2527
+ // ../../node_modules/.pnpm/@antfu+ni@0.21.9/node_modules/@antfu/ni/dist/shared/ni.d43835c0.mjs
2528
+ import fs$1, { createWriteStream, createReadStream, promises, existsSync } from "node:fs";
2529
2529
  import path$3, { join as join$1, dirname, resolve } from "node:path";
2530
2530
  import process$2 from "node:process";
2531
- import url, { fileURLToPath } from "node:url";
2532
2531
  import { Buffer as Buffer$1 } from "node:buffer";
2533
2532
  import childProcess, { ChildProcess } from "node:child_process";
2534
2533
  import require$$0$2 from "child_process";
2535
2534
  import require$$0$1 from "path";
2536
2535
  import require$$0 from "fs";
2536
+ import url, { fileURLToPath } from "node:url";
2537
2537
  import os$1, { constants } from "node:os";
2538
- import require$$0$3 from "assert";
2539
- import require$$2 from "events";
2540
- import require$$0$5 from "buffer";
2541
- import require$$0$4 from "stream";
2542
- import require$$2$1 from "util";
2538
+ import { setTimeout as setTimeout$1 } from "node:timers/promises";
2539
+ import require$$0$3 from "stream";
2543
2540
  import { debuglog } from "node:util";
2544
- import require$$0$6 from "os";
2541
+ import require$$0$4 from "os";
2545
2542
  import require$$1 from "tty";
2546
- import require$$0$7 from "readline";
2543
+ import require$$0$5 from "readline";
2544
+ import require$$2 from "events";
2545
+ import require$$1$1 from "fs/promises";
2547
2546
  function npmRun(agent) {
2548
2547
  return (args) => {
2549
2548
  if (args.length > 1)
@@ -2851,239 +2850,6 @@ var ini = {
2851
2850
  unsafe
2852
2851
  };
2853
2852
  var ini$1 = /* @__PURE__ */ getDefaultExportFromCjs(ini);
2854
- var Node = class {
2855
- value;
2856
- next;
2857
- constructor(value) {
2858
- this.value = value;
2859
- }
2860
- };
2861
- var Queue = class {
2862
- #head;
2863
- #tail;
2864
- #size;
2865
- constructor() {
2866
- this.clear();
2867
- }
2868
- enqueue(value) {
2869
- const node = new Node(value);
2870
- if (this.#head) {
2871
- this.#tail.next = node;
2872
- this.#tail = node;
2873
- } else {
2874
- this.#head = node;
2875
- this.#tail = node;
2876
- }
2877
- this.#size++;
2878
- }
2879
- dequeue() {
2880
- const current = this.#head;
2881
- if (!current) {
2882
- return;
2883
- }
2884
- this.#head = this.#head.next;
2885
- this.#size--;
2886
- return current.value;
2887
- }
2888
- clear() {
2889
- this.#head = void 0;
2890
- this.#tail = void 0;
2891
- this.#size = 0;
2892
- }
2893
- get size() {
2894
- return this.#size;
2895
- }
2896
- *[Symbol.iterator]() {
2897
- let current = this.#head;
2898
- while (current) {
2899
- yield current.value;
2900
- current = current.next;
2901
- }
2902
- }
2903
- };
2904
- function pLimit(concurrency) {
2905
- if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
2906
- throw new TypeError("Expected `concurrency` to be a number from 1 and up");
2907
- }
2908
- const queue = new Queue();
2909
- let activeCount = 0;
2910
- const next = () => {
2911
- activeCount--;
2912
- if (queue.size > 0) {
2913
- queue.dequeue()();
2914
- }
2915
- };
2916
- const run2 = async (fn, resolve3, args) => {
2917
- activeCount++;
2918
- const result = (async () => fn(...args))();
2919
- resolve3(result);
2920
- try {
2921
- await result;
2922
- } catch {
2923
- }
2924
- next();
2925
- };
2926
- const enqueue = (fn, resolve3, args) => {
2927
- queue.enqueue(run2.bind(void 0, fn, resolve3, args));
2928
- (async () => {
2929
- await Promise.resolve();
2930
- if (activeCount < concurrency && queue.size > 0) {
2931
- queue.dequeue()();
2932
- }
2933
- })();
2934
- };
2935
- const generator = (fn, ...args) => new Promise((resolve3) => {
2936
- enqueue(fn, resolve3, args);
2937
- });
2938
- Object.defineProperties(generator, {
2939
- activeCount: {
2940
- get: () => activeCount
2941
- },
2942
- pendingCount: {
2943
- get: () => queue.size
2944
- },
2945
- clearQueue: {
2946
- value: () => {
2947
- queue.clear();
2948
- }
2949
- }
2950
- });
2951
- return generator;
2952
- }
2953
- var EndError = class extends Error {
2954
- constructor(value) {
2955
- super();
2956
- this.value = value;
2957
- }
2958
- };
2959
- var testElement = async (element, tester) => tester(await element);
2960
- var finder = async (element) => {
2961
- const values = await Promise.all(element);
2962
- if (values[1] === true) {
2963
- throw new EndError(values[0]);
2964
- }
2965
- return false;
2966
- };
2967
- async function pLocate(iterable, tester, {
2968
- concurrency = Number.POSITIVE_INFINITY,
2969
- preserveOrder = true
2970
- } = {}) {
2971
- const limit = pLimit(concurrency);
2972
- const items = [...iterable].map((element) => [element, limit(testElement, element, tester)]);
2973
- const checkLimit = pLimit(preserveOrder ? 1 : Number.POSITIVE_INFINITY);
2974
- try {
2975
- await Promise.all(items.map((element) => checkLimit(finder, element)));
2976
- } catch (error) {
2977
- if (error instanceof EndError) {
2978
- return error.value;
2979
- }
2980
- throw error;
2981
- }
2982
- }
2983
- var typeMappings = {
2984
- directory: "isDirectory",
2985
- file: "isFile"
2986
- };
2987
- function checkType(type) {
2988
- if (type in typeMappings) {
2989
- return;
2990
- }
2991
- throw new Error(`Invalid type specified: ${type}`);
2992
- }
2993
- var matchType = (type, stat) => type === void 0 || stat[typeMappings[type]]();
2994
- var toPath$1 = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
2995
- async function locatePath(paths, {
2996
- cwd = process$2.cwd(),
2997
- type = "file",
2998
- allowSymlinks = true,
2999
- concurrency,
3000
- preserveOrder
3001
- } = {}) {
3002
- checkType(type);
3003
- cwd = toPath$1(cwd);
3004
- const statFunction = allowSymlinks ? promises.stat : promises.lstat;
3005
- return pLocate(paths, async (path_) => {
3006
- try {
3007
- const stat = await statFunction(path$3.resolve(cwd, path_));
3008
- return matchType(type, stat);
3009
- } catch {
3010
- return false;
3011
- }
3012
- }, { concurrency, preserveOrder });
3013
- }
3014
- var toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
3015
- var findUpStop = Symbol("findUpStop");
3016
- async function findUpMultiple(name, options = {}) {
3017
- let directory = path$3.resolve(toPath(options.cwd) || "");
3018
- const { root } = path$3.parse(directory);
3019
- const stopAt = path$3.resolve(directory, options.stopAt || root);
3020
- const limit = options.limit || Number.POSITIVE_INFINITY;
3021
- const paths = [name].flat();
3022
- const runMatcher = async (locateOptions) => {
3023
- if (typeof name !== "function") {
3024
- return locatePath(paths, locateOptions);
3025
- }
3026
- const foundPath = await name(locateOptions.cwd);
3027
- if (typeof foundPath === "string") {
3028
- return locatePath([foundPath], locateOptions);
3029
- }
3030
- return foundPath;
3031
- };
3032
- const matches = [];
3033
- while (true) {
3034
- const foundPath = await runMatcher({ ...options, cwd: directory });
3035
- if (foundPath === findUpStop) {
3036
- break;
3037
- }
3038
- if (foundPath) {
3039
- matches.push(path$3.resolve(directory, foundPath));
3040
- }
3041
- if (directory === stopAt || matches.length >= limit) {
3042
- break;
3043
- }
3044
- directory = path$3.dirname(directory);
3045
- }
3046
- return matches;
3047
- }
3048
- async function findUp(name, options = {}) {
3049
- const matches = await findUpMultiple(name, { ...options, limit: 1 });
3050
- return matches[0];
3051
- }
3052
- var customRcPath = process$2.env.NI_CONFIG_FILE;
3053
- var home = process$2.platform === "win32" ? process$2.env.USERPROFILE : process$2.env.HOME;
3054
- var defaultRcPath = path$3.join(home || "~/", ".nirc");
3055
- var rcPath = customRcPath || defaultRcPath;
3056
- var defaultConfig = {
3057
- defaultAgent: "prompt",
3058
- globalAgent: "npm"
3059
- };
3060
- var config;
3061
- async function getConfig() {
3062
- if (!config) {
3063
- const result = await findUp("package.json") || "";
3064
- let packageManager = "";
3065
- if (result)
3066
- packageManager = JSON.parse(fs$1.readFileSync(result, "utf8")).packageManager ?? "";
3067
- const [, agent, version3] = packageManager.match(new RegExp(`^(${Object.values(LOCKS).join("|")})@(\\d).*?$`)) || [];
3068
- if (agent)
3069
- config = Object.assign({}, defaultConfig, { defaultAgent: agent === "yarn" && Number.parseInt(version3) > 1 ? "yarn@berry" : agent });
3070
- else if (!fs$1.existsSync(rcPath))
3071
- config = defaultConfig;
3072
- else
3073
- config = Object.assign({}, defaultConfig, ini$1.parse(fs$1.readFileSync(rcPath, "utf-8")));
3074
- }
3075
- return config;
3076
- }
3077
- async function getDefaultAgent(programmatic) {
3078
- const { defaultAgent } = await getConfig();
3079
- if (defaultAgent === "prompt" && (programmatic || process$2.env.CI))
3080
- return "npm";
3081
- return defaultAgent;
3082
- }
3083
- async function getGlobalAgent() {
3084
- const { globalAgent } = await getConfig();
3085
- return globalAgent;
3086
- }
3087
2853
  var crossSpawn$1 = { exports: {} };
3088
2854
  var windows;
3089
2855
  var hasRequiredWindows;
@@ -3094,8 +2860,8 @@ function requireWindows() {
3094
2860
  windows = isexe2;
3095
2861
  isexe2.sync = sync2;
3096
2862
  var fs4 = require$$0;
3097
- function checkPathExt(path2, options) {
3098
- var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
2863
+ function checkPathExt2(path2, options2) {
2864
+ var pathext = options2.pathExt !== void 0 ? options2.pathExt : process.env.PATHEXT;
3099
2865
  if (!pathext) {
3100
2866
  return true;
3101
2867
  }
@@ -3111,19 +2877,19 @@ function requireWindows() {
3111
2877
  }
3112
2878
  return false;
3113
2879
  }
3114
- function checkStat(stat, path2, options) {
2880
+ function checkStat2(stat, path2, options2) {
3115
2881
  if (!stat.isSymbolicLink() && !stat.isFile()) {
3116
2882
  return false;
3117
2883
  }
3118
- return checkPathExt(path2, options);
2884
+ return checkPathExt2(path2, options2);
3119
2885
  }
3120
- function isexe2(path2, options, cb) {
2886
+ function isexe2(path2, options2, cb) {
3121
2887
  fs4.stat(path2, function(er, stat) {
3122
- cb(er, er ? false : checkStat(stat, path2, options));
2888
+ cb(er, er ? false : checkStat2(stat, path2, options2));
3123
2889
  });
3124
2890
  }
3125
- function sync2(path2, options) {
3126
- return checkStat(fs4.statSync(path2), path2, options);
2891
+ function sync2(path2, options2) {
2892
+ return checkStat2(fs4.statSync(path2), path2, options2);
3127
2893
  }
3128
2894
  return windows;
3129
2895
  }
@@ -3136,23 +2902,23 @@ function requireMode() {
3136
2902
  mode = isexe2;
3137
2903
  isexe2.sync = sync2;
3138
2904
  var fs4 = require$$0;
3139
- function isexe2(path2, options, cb) {
2905
+ function isexe2(path2, options2, cb) {
3140
2906
  fs4.stat(path2, function(er, stat) {
3141
- cb(er, er ? false : checkStat(stat, options));
2907
+ cb(er, er ? false : checkStat2(stat, options2));
3142
2908
  });
3143
2909
  }
3144
- function sync2(path2, options) {
3145
- return checkStat(fs4.statSync(path2), options);
2910
+ function sync2(path2, options2) {
2911
+ return checkStat2(fs4.statSync(path2), options2);
3146
2912
  }
3147
- function checkStat(stat, options) {
3148
- return stat.isFile() && checkMode(stat, options);
2913
+ function checkStat2(stat, options2) {
2914
+ return stat.isFile() && checkMode2(stat, options2);
3149
2915
  }
3150
- function checkMode(stat, options) {
2916
+ function checkMode2(stat, options2) {
3151
2917
  var mod = stat.mode;
3152
2918
  var uid = stat.uid;
3153
2919
  var gid = stat.gid;
3154
- var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
3155
- var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
2920
+ var myUid = options2.uid !== void 0 ? options2.uid : process.getuid && process.getuid();
2921
+ var myGid = options2.gid !== void 0 ? options2.gid : process.getgid && process.getgid();
3156
2922
  var u = parseInt("100", 8);
3157
2923
  var g = parseInt("010", 8);
3158
2924
  var o = parseInt("001", 8);
@@ -3168,19 +2934,19 @@ if (process.platform === "win32" || commonjsGlobal.TESTING_WINDOWS) {
3168
2934
  } else {
3169
2935
  core = requireMode();
3170
2936
  }
3171
- var isexe_1 = isexe$2;
3172
- isexe$2.sync = sync;
3173
- function isexe$2(path2, options, cb) {
3174
- if (typeof options === "function") {
3175
- cb = options;
3176
- options = {};
2937
+ var isexe_1 = isexe$4;
2938
+ isexe$4.sync = sync$2;
2939
+ function isexe$4(path2, options2, cb) {
2940
+ if (typeof options2 === "function") {
2941
+ cb = options2;
2942
+ options2 = {};
3177
2943
  }
3178
2944
  if (!cb) {
3179
2945
  if (typeof Promise !== "function") {
3180
2946
  throw new TypeError("callback not provided");
3181
2947
  }
3182
2948
  return new Promise(function(resolve3, reject) {
3183
- isexe$2(path2, options || {}, function(er, is) {
2949
+ isexe$4(path2, options2 || {}, function(er, is) {
3184
2950
  if (er) {
3185
2951
  reject(er);
3186
2952
  } else {
@@ -3189,9 +2955,9 @@ function isexe$2(path2, options, cb) {
3189
2955
  });
3190
2956
  });
3191
2957
  }
3192
- core(path2, options || {}, function(er, is) {
2958
+ core(path2, options2 || {}, function(er, is) {
3193
2959
  if (er) {
3194
- if (er.code === "EACCES" || options && options.ignoreErrors) {
2960
+ if (er.code === "EACCES" || options2 && options2.ignoreErrors) {
3195
2961
  er = null;
3196
2962
  is = false;
3197
2963
  }
@@ -3199,11 +2965,11 @@ function isexe$2(path2, options, cb) {
3199
2965
  cb(er, is);
3200
2966
  });
3201
2967
  }
3202
- function sync(path2, options) {
2968
+ function sync$2(path2, options2) {
3203
2969
  try {
3204
- return core.sync(path2, options || {});
2970
+ return core.sync(path2, options2 || {});
3205
2971
  } catch (er) {
3206
- if (options && options.ignoreErrors || er.code === "EACCES") {
2972
+ if (options2 && options2.ignoreErrors || er.code === "EACCES") {
3207
2973
  return false;
3208
2974
  } else {
3209
2975
  throw er;
@@ -3213,7 +2979,7 @@ function sync(path2, options) {
3213
2979
  var isWindows$1 = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
3214
2980
  var path$2 = require$$0$1;
3215
2981
  var COLON = isWindows$1 ? ";" : ":";
3216
- var isexe$1 = isexe_1;
2982
+ var isexe$3 = isexe_1;
3217
2983
  var getNotFoundError$1 = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
3218
2984
  var getPathInfo$1 = (cmd, opt) => {
3219
2985
  const colon = opt.colon || COLON;
@@ -3257,7 +3023,7 @@ var which$3 = (cmd, opt, cb) => {
3257
3023
  if (ii === pathExt.length)
3258
3024
  return resolve3(step(i + 1));
3259
3025
  const ext = pathExt[ii];
3260
- isexe$1(p + ext, { pathExt: pathExtExe }, (er, is) => {
3026
+ isexe$3(p + ext, { pathExt: pathExtExe }, (er, is) => {
3261
3027
  if (!er && is) {
3262
3028
  if (opt.all)
3263
3029
  found.push(p + ext);
@@ -3281,7 +3047,7 @@ var whichSync$1 = (cmd, opt) => {
3281
3047
  for (let j = 0; j < pathExt.length; j++) {
3282
3048
  const cur = p + pathExt[j];
3283
3049
  try {
3284
- const is = isexe$1.sync(cur, { pathExt: pathExtExe });
3050
+ const is = isexe$3.sync(cur, { pathExt: pathExtExe });
3285
3051
  if (is) {
3286
3052
  if (opt.all)
3287
3053
  found.push(cur);
@@ -3301,9 +3067,9 @@ var whichSync$1 = (cmd, opt) => {
3301
3067
  var which_1 = which$3;
3302
3068
  which$3.sync = whichSync$1;
3303
3069
  var pathKey$2 = { exports: {} };
3304
- var pathKey$1 = (options = {}) => {
3305
- const environment = options.env || process.env;
3306
- const platform = options.platform || process.platform;
3070
+ var pathKey$1 = (options2 = {}) => {
3071
+ const environment = options2.env || process.env;
3072
+ const platform = options2.platform || process.platform;
3307
3073
  if (platform !== "win32") {
3308
3074
  return "PATH";
3309
3075
  }
@@ -3399,7 +3165,7 @@ var path = require$$0$1;
3399
3165
  var resolveCommand = resolveCommand_1;
3400
3166
  var escape = _escape;
3401
3167
  var readShebang = readShebang_1;
3402
- var isWin$2 = process.platform === "win32";
3168
+ var isWin$1 = process.platform === "win32";
3403
3169
  var isExecutableRegExp = /\.(?:com|exe)$/i;
3404
3170
  var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
3405
3171
  function detectShebang(parsed) {
@@ -3413,7 +3179,7 @@ function detectShebang(parsed) {
3413
3179
  return parsed.file;
3414
3180
  }
3415
3181
  function parseNonShell(parsed) {
3416
- if (!isWin$2) {
3182
+ if (!isWin$1) {
3417
3183
  return parsed;
3418
3184
  }
3419
3185
  const commandFile = detectShebang(parsed);
@@ -3430,27 +3196,27 @@ function parseNonShell(parsed) {
3430
3196
  }
3431
3197
  return parsed;
3432
3198
  }
3433
- function parse$1(command, args, options) {
3199
+ function parse$1(command, args, options2) {
3434
3200
  if (args && !Array.isArray(args)) {
3435
- options = args;
3201
+ options2 = args;
3436
3202
  args = null;
3437
3203
  }
3438
3204
  args = args ? args.slice(0) : [];
3439
- options = Object.assign({}, options);
3205
+ options2 = Object.assign({}, options2);
3440
3206
  const parsed = {
3441
3207
  command,
3442
3208
  args,
3443
- options,
3209
+ options: options2,
3444
3210
  file: void 0,
3445
3211
  original: {
3446
3212
  command,
3447
3213
  args
3448
3214
  }
3449
3215
  };
3450
- return options.shell ? parsed : parseNonShell(parsed);
3216
+ return options2.shell ? parsed : parseNonShell(parsed);
3451
3217
  }
3452
3218
  var parse_1 = parse$1;
3453
- var isWin$1 = process.platform === "win32";
3219
+ var isWin = process.platform === "win32";
3454
3220
  function notFoundError(original, syscall) {
3455
3221
  return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
3456
3222
  code: "ENOENT",
@@ -3461,7 +3227,7 @@ function notFoundError(original, syscall) {
3461
3227
  });
3462
3228
  }
3463
3229
  function hookChildProcess(cp2, parsed) {
3464
- if (!isWin$1) {
3230
+ if (!isWin) {
3465
3231
  return;
3466
3232
  }
3467
3233
  const originalEmit = cp2.emit;
@@ -3476,13 +3242,13 @@ function hookChildProcess(cp2, parsed) {
3476
3242
  };
3477
3243
  }
3478
3244
  function verifyENOENT(status, parsed) {
3479
- if (isWin$1 && status === 1 && !parsed.file) {
3245
+ if (isWin && status === 1 && !parsed.file) {
3480
3246
  return notFoundError(parsed.original, "spawn");
3481
3247
  }
3482
3248
  return null;
3483
3249
  }
3484
3250
  function verifyENOENTSync(status, parsed) {
3485
- if (isWin$1 && status === 1 && !parsed.file) {
3251
+ if (isWin && status === 1 && !parsed.file) {
3486
3252
  return notFoundError(parsed.original, "spawnSync");
3487
3253
  }
3488
3254
  return null;
@@ -3496,14 +3262,14 @@ var enoent$1 = {
3496
3262
  var cp = require$$0$2;
3497
3263
  var parse = parse_1;
3498
3264
  var enoent = enoent$1;
3499
- function spawn(command, args, options) {
3500
- const parsed = parse(command, args, options);
3265
+ function spawn(command, args, options2) {
3266
+ const parsed = parse(command, args, options2);
3501
3267
  const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
3502
3268
  enoent.hookChildProcess(spawned, parsed);
3503
3269
  return spawned;
3504
3270
  }
3505
- function spawnSync(command, args, options) {
3506
- const parsed = parse(command, args, options);
3271
+ function spawnSync(command, args, options2) {
3272
+ const parsed = parse(command, args, options2);
3507
3273
  const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
3508
3274
  result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
3509
3275
  return result;
@@ -3526,22 +3292,22 @@ function stripFinalNewline(input) {
3526
3292
  }
3527
3293
  return input;
3528
3294
  }
3529
- function pathKey(options = {}) {
3295
+ function pathKey(options2 = {}) {
3530
3296
  const {
3531
3297
  env: env2 = process.env,
3532
3298
  platform = process.platform
3533
- } = options;
3299
+ } = options2;
3534
3300
  if (platform !== "win32") {
3535
3301
  return "PATH";
3536
3302
  }
3537
3303
  return Object.keys(env2).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
3538
3304
  }
3539
- function npmRunPath(options = {}) {
3305
+ function npmRunPath(options2 = {}) {
3540
3306
  const {
3541
3307
  cwd = process$2.cwd(),
3542
3308
  path: path_ = process$2.env[pathKey()],
3543
3309
  execPath = process$2.execPath
3544
- } = options;
3310
+ } = options2;
3545
3311
  let previous;
3546
3312
  const cwdString = cwd instanceof URL ? url.fileURLToPath(cwd) : cwd;
3547
3313
  let cwdPath = path$3.resolve(cwdString);
@@ -3554,11 +3320,11 @@ function npmRunPath(options = {}) {
3554
3320
  result.push(path$3.resolve(cwdString, execPath, ".."));
3555
3321
  return [...result, path_].join(path$3.delimiter);
3556
3322
  }
3557
- function npmRunPathEnv({ env: env2 = process$2.env, ...options } = {}) {
3323
+ function npmRunPathEnv({ env: env2 = process$2.env, ...options2 } = {}) {
3558
3324
  env2 = { ...env2 };
3559
3325
  const path2 = pathKey({ env: env2 });
3560
- options.path = env2[path2];
3561
- env2[path2] = npmRunPath(options);
3326
+ options2.path = env2[path2];
3327
+ env2[path2] = npmRunPath(options2);
3562
3328
  return env2;
3563
3329
  }
3564
3330
  var copyProperty = (to, from, property, ignoreNonConfigurable) => {
@@ -3605,7 +3371,7 @@ function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
3605
3371
  return to;
3606
3372
  }
3607
3373
  var calledFunctions = /* @__PURE__ */ new WeakMap();
3608
- var onetime = (function_, options = {}) => {
3374
+ var onetime = (function_, options2 = {}) => {
3609
3375
  if (typeof function_ !== "function") {
3610
3376
  throw new TypeError("Expected a function");
3611
3377
  }
@@ -3617,7 +3383,7 @@ var onetime = (function_, options = {}) => {
3617
3383
  if (callCount === 1) {
3618
3384
  returnValue = function_.apply(this, arguments_);
3619
3385
  function_ = null;
3620
- } else if (options.throw === true) {
3386
+ } else if (options2.throw === true) {
3621
3387
  throw new Error(`Function \`${functionName}\` can only be called once`);
3622
3388
  }
3623
3389
  return returnValue;
@@ -3918,8 +3684,8 @@ var SIGNALS = [
3918
3684
  ];
3919
3685
  var getSignals = () => {
3920
3686
  const realtimeSignals = getRealtimeSignals();
3921
- const signals = [...SIGNALS, ...realtimeSignals].map(normalizeSignal);
3922
- return signals;
3687
+ const signals2 = [...SIGNALS, ...realtimeSignals].map(normalizeSignal);
3688
+ return signals2;
3923
3689
  };
3924
3690
  var normalizeSignal = ({
3925
3691
  name,
@@ -3937,8 +3703,8 @@ var normalizeSignal = ({
3937
3703
  return { name, number: number2, description, supported, action: action2, forced, standard };
3938
3704
  };
3939
3705
  var getSignalsByName = () => {
3940
- const signals = getSignals();
3941
- return Object.fromEntries(signals.map(getSignalByName));
3706
+ const signals2 = getSignals();
3707
+ return Object.fromEntries(signals2.map(getSignalByName));
3942
3708
  };
3943
3709
  var getSignalByName = ({
3944
3710
  name,
@@ -3951,13 +3717,16 @@ var getSignalByName = ({
3951
3717
  }) => [name, { name, number: number2, description, supported, action: action2, forced, standard }];
3952
3718
  var signalsByName = getSignalsByName();
3953
3719
  var getSignalsByNumber = () => {
3954
- const signals = getSignals();
3720
+ const signals2 = getSignals();
3955
3721
  const length = SIGRTMAX + 1;
3956
- const signalsA = Array.from({ length }, (value, number2) => getSignalByNumber(number2, signals));
3722
+ const signalsA = Array.from(
3723
+ { length },
3724
+ (value, number2) => getSignalByNumber(number2, signals2)
3725
+ );
3957
3726
  return Object.assign({}, ...signalsA);
3958
3727
  };
3959
- var getSignalByNumber = (number2, signals) => {
3960
- const signal = findSignalByNumber(number2, signals);
3728
+ var getSignalByNumber = (number2, signals2) => {
3729
+ const signal = findSignalByNumber(number2, signals2);
3961
3730
  if (signal === void 0) {
3962
3731
  return {};
3963
3732
  }
@@ -3974,12 +3743,12 @@ var getSignalByNumber = (number2, signals) => {
3974
3743
  }
3975
3744
  };
3976
3745
  };
3977
- var findSignalByNumber = (number2, signals) => {
3978
- const signal = signals.find(({ name }) => constants.signals[name] === number2);
3746
+ var findSignalByNumber = (number2, signals2) => {
3747
+ const signal = signals2.find(({ name }) => constants.signals[name] === number2);
3979
3748
  if (signal !== void 0) {
3980
3749
  return signal;
3981
3750
  }
3982
- return signals.find((signalA) => signalA.number === number2);
3751
+ return signals2.find((signalA) => signalA.number === number2);
3983
3752
  };
3984
3753
  getSignalsByNumber();
3985
3754
  var getErrorPrefix = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled }) => {
@@ -4012,7 +3781,7 @@ var makeError = ({
4012
3781
  timedOut,
4013
3782
  isCanceled,
4014
3783
  killed,
4015
- parsed: { options: { timeout } }
3784
+ parsed: { options: { timeout, cwd = process$2.cwd() } }
4016
3785
  }) => {
4017
3786
  exitCode = exitCode === null ? void 0 : exitCode;
4018
3787
  signal = signal === null ? void 0 : signal;
@@ -4038,6 +3807,7 @@ ${error.message}` : execaMessage;
4038
3807
  error.signalDescription = signalDescription;
4039
3808
  error.stdout = stdout;
4040
3809
  error.stderr = stderr;
3810
+ error.cwd = cwd;
4041
3811
  if (all !== void 0) {
4042
3812
  error.all = all;
4043
3813
  }
@@ -4051,16 +3821,16 @@ ${error.message}` : execaMessage;
4051
3821
  return error;
4052
3822
  };
4053
3823
  var aliases = ["stdin", "stdout", "stderr"];
4054
- var hasAlias = (options) => aliases.some((alias) => options[alias] !== void 0);
4055
- var normalizeStdio = (options) => {
4056
- if (!options) {
3824
+ var hasAlias = (options2) => aliases.some((alias) => options2[alias] !== void 0);
3825
+ var normalizeStdio = (options2) => {
3826
+ if (!options2) {
4057
3827
  return;
4058
3828
  }
4059
- const { stdio } = options;
3829
+ const { stdio } = options2;
4060
3830
  if (stdio === void 0) {
4061
- return aliases.map((alias) => options[alias]);
3831
+ return aliases.map((alias) => options2[alias]);
4062
3832
  }
4063
- if (hasAlias(options)) {
3833
+ if (hasAlias(options2)) {
4064
3834
  throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map((alias) => `\`${alias}\``).join(", ")}`);
4065
3835
  }
4066
3836
  if (typeof stdio === "string") {
@@ -4072,214 +3842,264 @@ var normalizeStdio = (options) => {
4072
3842
  const length = Math.max(stdio.length, aliases.length);
4073
3843
  return Array.from({ length }, (value, index) => stdio[index]);
4074
3844
  };
4075
- var signalExit = { exports: {} };
4076
- var signals$1 = { exports: {} };
4077
- var hasRequiredSignals;
4078
- function requireSignals() {
4079
- if (hasRequiredSignals)
4080
- return signals$1.exports;
4081
- hasRequiredSignals = 1;
4082
- (function(module) {
4083
- module.exports = [
4084
- "SIGABRT",
4085
- "SIGALRM",
4086
- "SIGHUP",
4087
- "SIGINT",
4088
- "SIGTERM"
4089
- ];
4090
- if (process.platform !== "win32") {
4091
- module.exports.push(
4092
- "SIGVTALRM",
4093
- "SIGXCPU",
4094
- "SIGXFSZ",
4095
- "SIGUSR2",
4096
- "SIGTRAP",
4097
- "SIGSYS",
4098
- "SIGQUIT",
4099
- "SIGIOT"
4100
- // should detect profiler and enable/disable accordingly.
4101
- // see #21
4102
- // 'SIGPROF'
4103
- );
3845
+ var signals = [];
3846
+ signals.push("SIGHUP", "SIGINT", "SIGTERM");
3847
+ if (process.platform !== "win32") {
3848
+ signals.push(
3849
+ "SIGALRM",
3850
+ "SIGABRT",
3851
+ "SIGVTALRM",
3852
+ "SIGXCPU",
3853
+ "SIGXFSZ",
3854
+ "SIGUSR2",
3855
+ "SIGTRAP",
3856
+ "SIGSYS",
3857
+ "SIGQUIT",
3858
+ "SIGIOT"
3859
+ // should detect profiler and enable/disable accordingly.
3860
+ // see #21
3861
+ // 'SIGPROF'
3862
+ );
3863
+ }
3864
+ if (process.platform === "linux") {
3865
+ signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
3866
+ }
3867
+ var processOk = (process4) => !!process4 && typeof process4 === "object" && typeof process4.removeListener === "function" && typeof process4.emit === "function" && typeof process4.reallyExit === "function" && typeof process4.listeners === "function" && typeof process4.kill === "function" && typeof process4.pid === "number" && typeof process4.on === "function";
3868
+ var kExitEmitter = Symbol.for("signal-exit emitter");
3869
+ var global$1 = globalThis;
3870
+ var ObjectDefineProperty = Object.defineProperty.bind(Object);
3871
+ var Emitter = class {
3872
+ emitted = {
3873
+ afterExit: false,
3874
+ exit: false
3875
+ };
3876
+ listeners = {
3877
+ afterExit: [],
3878
+ exit: []
3879
+ };
3880
+ count = 0;
3881
+ id = Math.random();
3882
+ constructor() {
3883
+ if (global$1[kExitEmitter]) {
3884
+ return global$1[kExitEmitter];
3885
+ }
3886
+ ObjectDefineProperty(global$1, kExitEmitter, {
3887
+ value: this,
3888
+ writable: false,
3889
+ enumerable: false,
3890
+ configurable: false
3891
+ });
3892
+ }
3893
+ on(ev, fn) {
3894
+ this.listeners[ev].push(fn);
3895
+ }
3896
+ removeListener(ev, fn) {
3897
+ const list = this.listeners[ev];
3898
+ const i = list.indexOf(fn);
3899
+ if (i === -1) {
3900
+ return;
4104
3901
  }
4105
- if (process.platform === "linux") {
4106
- module.exports.push(
4107
- "SIGIO",
4108
- "SIGPOLL",
4109
- "SIGPWR",
4110
- "SIGSTKFLT",
4111
- "SIGUNUSED"
4112
- );
3902
+ if (i === 0 && list.length === 1) {
3903
+ list.length = 0;
3904
+ } else {
3905
+ list.splice(i, 1);
4113
3906
  }
4114
- })(signals$1);
4115
- return signals$1.exports;
4116
- }
4117
- var process$1 = commonjsGlobal.process;
4118
- var processOk = function(process4) {
4119
- return process4 && typeof process4 === "object" && typeof process4.removeListener === "function" && typeof process4.emit === "function" && typeof process4.reallyExit === "function" && typeof process4.listeners === "function" && typeof process4.kill === "function" && typeof process4.pid === "number" && typeof process4.on === "function";
3907
+ }
3908
+ emit(ev, code, signal) {
3909
+ if (this.emitted[ev]) {
3910
+ return false;
3911
+ }
3912
+ this.emitted[ev] = true;
3913
+ let ret = false;
3914
+ for (const fn of this.listeners[ev]) {
3915
+ ret = fn(code, signal) === true || ret;
3916
+ }
3917
+ if (ev === "exit") {
3918
+ ret = this.emit("afterExit", code, signal) || ret;
3919
+ }
3920
+ return ret;
3921
+ }
4120
3922
  };
4121
- if (!processOk(process$1)) {
4122
- signalExit.exports = function() {
4123
- return function() {
4124
- };
3923
+ var SignalExitBase = class {
3924
+ };
3925
+ var signalExitWrap = (handler) => {
3926
+ return {
3927
+ onExit(cb, opts) {
3928
+ return handler.onExit(cb, opts);
3929
+ },
3930
+ load() {
3931
+ return handler.load();
3932
+ },
3933
+ unload() {
3934
+ return handler.unload();
3935
+ }
4125
3936
  };
4126
- } else {
4127
- assert = require$$0$3;
4128
- signals = requireSignals();
4129
- isWin = /^win/i.test(process$1.platform);
4130
- EE = require$$2;
4131
- if (typeof EE !== "function") {
4132
- EE = EE.EventEmitter;
4133
- }
4134
- if (process$1.__signal_exit_emitter__) {
4135
- emitter = process$1.__signal_exit_emitter__;
4136
- } else {
4137
- emitter = process$1.__signal_exit_emitter__ = new EE();
4138
- emitter.count = 0;
4139
- emitter.emitted = {};
3937
+ };
3938
+ var SignalExitFallback = class extends SignalExitBase {
3939
+ onExit() {
3940
+ return () => {
3941
+ };
3942
+ }
3943
+ load() {
4140
3944
  }
4141
- if (!emitter.infinite) {
4142
- emitter.setMaxListeners(Infinity);
4143
- emitter.infinite = true;
3945
+ unload() {
4144
3946
  }
4145
- signalExit.exports = function(cb, opts) {
4146
- if (!processOk(commonjsGlobal.process)) {
4147
- return function() {
3947
+ };
3948
+ var SignalExit = class extends SignalExitBase {
3949
+ // "SIGHUP" throws an `ENOSYS` error on Windows,
3950
+ // so use a supported signal instead
3951
+ /* c8 ignore start */
3952
+ #hupSig = process$1.platform === "win32" ? "SIGINT" : "SIGHUP";
3953
+ /* c8 ignore stop */
3954
+ #emitter = new Emitter();
3955
+ #process;
3956
+ #originalProcessEmit;
3957
+ #originalProcessReallyExit;
3958
+ #sigListeners = {};
3959
+ #loaded = false;
3960
+ constructor(process4) {
3961
+ super();
3962
+ this.#process = process4;
3963
+ this.#sigListeners = {};
3964
+ for (const sig of signals) {
3965
+ this.#sigListeners[sig] = () => {
3966
+ const listeners = this.#process.listeners(sig);
3967
+ let { count } = this.#emitter;
3968
+ const p = process4;
3969
+ if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
3970
+ count += p.__signal_exit_emitter__.count;
3971
+ }
3972
+ if (listeners.length === count) {
3973
+ this.unload();
3974
+ const ret = this.#emitter.emit("exit", null, sig);
3975
+ const s = sig === "SIGHUP" ? this.#hupSig : sig;
3976
+ if (!ret)
3977
+ process4.kill(process4.pid, s);
3978
+ }
4148
3979
  };
4149
3980
  }
4150
- assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
4151
- if (loaded === false) {
4152
- load();
3981
+ this.#originalProcessReallyExit = process4.reallyExit;
3982
+ this.#originalProcessEmit = process4.emit;
3983
+ }
3984
+ onExit(cb, opts) {
3985
+ if (!processOk(this.#process)) {
3986
+ return () => {
3987
+ };
4153
3988
  }
4154
- var ev = "exit";
4155
- if (opts && opts.alwaysLast) {
4156
- ev = "afterexit";
3989
+ if (this.#loaded === false) {
3990
+ this.load();
4157
3991
  }
4158
- var remove2 = function() {
4159
- emitter.removeListener(ev, cb);
4160
- if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
4161
- unload();
3992
+ const ev = opts?.alwaysLast ? "afterExit" : "exit";
3993
+ this.#emitter.on(ev, cb);
3994
+ return () => {
3995
+ this.#emitter.removeListener(ev, cb);
3996
+ if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
3997
+ this.unload();
4162
3998
  }
4163
3999
  };
4164
- emitter.on(ev, cb);
4165
- return remove2;
4166
- };
4167
- unload = function unload2() {
4168
- if (!loaded || !processOk(commonjsGlobal.process)) {
4000
+ }
4001
+ load() {
4002
+ if (this.#loaded) {
4169
4003
  return;
4170
4004
  }
4171
- loaded = false;
4172
- signals.forEach(function(sig) {
4005
+ this.#loaded = true;
4006
+ this.#emitter.count += 1;
4007
+ for (const sig of signals) {
4173
4008
  try {
4174
- process$1.removeListener(sig, sigListeners[sig]);
4175
- } catch (er) {
4009
+ const fn = this.#sigListeners[sig];
4010
+ if (fn)
4011
+ this.#process.on(sig, fn);
4012
+ } catch (_) {
4176
4013
  }
4177
- });
4178
- process$1.emit = originalProcessEmit;
4179
- process$1.reallyExit = originalProcessReallyExit;
4180
- emitter.count -= 1;
4181
- };
4182
- signalExit.exports.unload = unload;
4183
- emit = function emit2(event, code, signal) {
4184
- if (emitter.emitted[event]) {
4185
- return;
4186
4014
  }
4187
- emitter.emitted[event] = true;
4188
- emitter.emit(event, code, signal);
4189
- };
4190
- sigListeners = {};
4191
- signals.forEach(function(sig) {
4192
- sigListeners[sig] = function listener() {
4193
- if (!processOk(commonjsGlobal.process)) {
4194
- return;
4195
- }
4196
- var listeners = process$1.listeners(sig);
4197
- if (listeners.length === emitter.count) {
4198
- unload();
4199
- emit("exit", null, sig);
4200
- emit("afterexit", null, sig);
4201
- if (isWin && sig === "SIGHUP") {
4202
- sig = "SIGINT";
4203
- }
4204
- process$1.kill(process$1.pid, sig);
4205
- }
4015
+ this.#process.emit = (ev, ...a) => {
4016
+ return this.#processEmit(ev, ...a);
4206
4017
  };
4207
- });
4208
- signalExit.exports.signals = function() {
4209
- return signals;
4210
- };
4211
- loaded = false;
4212
- load = function load2() {
4213
- if (loaded || !processOk(commonjsGlobal.process)) {
4018
+ this.#process.reallyExit = (code) => {
4019
+ return this.#processReallyExit(code);
4020
+ };
4021
+ }
4022
+ unload() {
4023
+ if (!this.#loaded) {
4214
4024
  return;
4215
4025
  }
4216
- loaded = true;
4217
- emitter.count += 1;
4218
- signals = signals.filter(function(sig) {
4026
+ this.#loaded = false;
4027
+ signals.forEach((sig) => {
4028
+ const listener = this.#sigListeners[sig];
4029
+ if (!listener) {
4030
+ throw new Error("Listener not defined for signal: " + sig);
4031
+ }
4219
4032
  try {
4220
- process$1.on(sig, sigListeners[sig]);
4221
- return true;
4222
- } catch (er) {
4223
- return false;
4033
+ this.#process.removeListener(sig, listener);
4034
+ } catch (_) {
4224
4035
  }
4225
4036
  });
4226
- process$1.emit = processEmit;
4227
- process$1.reallyExit = processReallyExit;
4228
- };
4229
- signalExit.exports.load = load;
4230
- originalProcessReallyExit = process$1.reallyExit;
4231
- processReallyExit = function processReallyExit2(code) {
4232
- if (!processOk(commonjsGlobal.process)) {
4233
- return;
4234
- }
4235
- process$1.exitCode = code || /* istanbul ignore next */
4236
- 0;
4237
- emit("exit", process$1.exitCode, null);
4238
- emit("afterexit", process$1.exitCode, null);
4239
- originalProcessReallyExit.call(process$1, process$1.exitCode);
4240
- };
4241
- originalProcessEmit = process$1.emit;
4242
- processEmit = function processEmit2(ev, arg) {
4243
- if (ev === "exit" && processOk(commonjsGlobal.process)) {
4244
- if (arg !== void 0) {
4245
- process$1.exitCode = arg;
4246
- }
4247
- var ret = originalProcessEmit.apply(this, arguments);
4248
- emit("exit", process$1.exitCode, null);
4249
- emit("afterexit", process$1.exitCode, null);
4037
+ this.#process.emit = this.#originalProcessEmit;
4038
+ this.#process.reallyExit = this.#originalProcessReallyExit;
4039
+ this.#emitter.count -= 1;
4040
+ }
4041
+ #processReallyExit(code) {
4042
+ if (!processOk(this.#process)) {
4043
+ return 0;
4044
+ }
4045
+ this.#process.exitCode = code || 0;
4046
+ this.#emitter.emit("exit", this.#process.exitCode, null);
4047
+ return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
4048
+ }
4049
+ #processEmit(ev, ...args) {
4050
+ const og = this.#originalProcessEmit;
4051
+ if (ev === "exit" && processOk(this.#process)) {
4052
+ if (typeof args[0] === "number") {
4053
+ this.#process.exitCode = args[0];
4054
+ }
4055
+ const ret = og.call(this.#process, ev, ...args);
4056
+ this.#emitter.emit("exit", this.#process.exitCode, null);
4250
4057
  return ret;
4251
4058
  } else {
4252
- return originalProcessEmit.apply(this, arguments);
4253
- }
4254
- };
4255
- }
4256
- var assert;
4257
- var signals;
4258
- var isWin;
4259
- var EE;
4260
- var emitter;
4261
- var unload;
4262
- var emit;
4263
- var sigListeners;
4264
- var loaded;
4265
- var load;
4266
- var originalProcessReallyExit;
4267
- var processReallyExit;
4268
- var originalProcessEmit;
4269
- var processEmit;
4270
- var signalExitExports = signalExit.exports;
4271
- var onExit = /* @__PURE__ */ getDefaultExportFromCjs(signalExitExports);
4059
+ return og.call(this.#process, ev, ...args);
4060
+ }
4061
+ }
4062
+ };
4063
+ var process$1 = globalThis.process;
4064
+ var {
4065
+ /**
4066
+ * Called when the process is exiting, whether via signal, explicit
4067
+ * exit, or running out of stuff to do.
4068
+ *
4069
+ * If the global process object is not suitable for instrumentation,
4070
+ * then this will be a no-op.
4071
+ *
4072
+ * Returns a function that may be used to unload signal-exit.
4073
+ */
4074
+ onExit,
4075
+ /**
4076
+ * Load the listeners. Likely you never need to call this, unless
4077
+ * doing a rather deep integration with signal-exit functionality.
4078
+ * Mostly exposed for the benefit of testing.
4079
+ *
4080
+ * @internal
4081
+ */
4082
+ load,
4083
+ /**
4084
+ * Unload the listeners. Likely you never need to call this, unless
4085
+ * doing a rather deep integration with signal-exit functionality.
4086
+ * Mostly exposed for the benefit of testing.
4087
+ *
4088
+ * @internal
4089
+ */
4090
+ unload
4091
+ } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
4272
4092
  var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
4273
- var spawnedKill = (kill, signal = "SIGTERM", options = {}) => {
4093
+ var spawnedKill = (kill, signal = "SIGTERM", options2 = {}) => {
4274
4094
  const killResult = kill(signal);
4275
- setKillTimeout(kill, signal, options, killResult);
4095
+ setKillTimeout(kill, signal, options2, killResult);
4276
4096
  return killResult;
4277
4097
  };
4278
- var setKillTimeout = (kill, signal, options, killResult) => {
4279
- if (!shouldForceKill(signal, options, killResult)) {
4098
+ var setKillTimeout = (kill, signal, options2, killResult) => {
4099
+ if (!shouldForceKill(signal, options2, killResult)) {
4280
4100
  return;
4281
4101
  }
4282
- const timeout = getForceKillAfterTimeout(options);
4102
+ const timeout = getForceKillAfterTimeout(options2);
4283
4103
  const t = setTimeout(() => {
4284
4104
  kill("SIGKILL");
4285
4105
  }, timeout);
@@ -4339,11 +4159,11 @@ var setExitHandler = async (spawned, { cleanup, detached }, timedPromise) => {
4339
4159
  removeExitHandler();
4340
4160
  });
4341
4161
  };
4342
- function isStream(stream2) {
4343
- return stream2 !== null && typeof stream2 === "object" && typeof stream2.pipe === "function";
4162
+ function isStream(stream) {
4163
+ return stream !== null && typeof stream === "object" && typeof stream.pipe === "function";
4344
4164
  }
4345
- function isWritableStream(stream2) {
4346
- return isStream(stream2) && stream2.writable !== false && typeof stream2._write === "function" && typeof stream2._writableState === "object";
4165
+ function isWritableStream(stream) {
4166
+ return isStream(stream) && stream.writable !== false && typeof stream._write === "function" && typeof stream._writableState === "object";
4347
4167
  }
4348
4168
  var isExecaChildProcess = (target) => target instanceof ChildProcess && typeof target.then === "function";
4349
4169
  var pipeToTarget = (spawned, streamName, target) => {
@@ -4375,96 +4195,179 @@ var addPipeMethods = (spawned) => {
4375
4195
  spawned.pipeAll = pipeToTarget.bind(void 0, spawned, "all");
4376
4196
  }
4377
4197
  };
4378
- var getStream$2 = { exports: {} };
4379
- var { PassThrough: PassThroughStream } = require$$0$4;
4380
- var bufferStream$1 = (options) => {
4381
- options = { ...options };
4382
- const { array } = options;
4383
- let { encoding } = options;
4384
- const isBuffer = encoding === "buffer";
4385
- let objectMode = false;
4386
- if (array) {
4387
- objectMode = !(encoding || isBuffer);
4388
- } else {
4389
- encoding = encoding || "utf8";
4198
+ var getStreamContents = async (stream, { init: init2, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, finalize }, { maxBuffer = Number.POSITIVE_INFINITY } = {}) => {
4199
+ if (!isAsyncIterable(stream)) {
4200
+ throw new Error("The first argument must be a Readable, a ReadableStream, or an async iterable.");
4390
4201
  }
4391
- if (isBuffer) {
4392
- encoding = null;
4202
+ const state = init2();
4203
+ state.length = 0;
4204
+ try {
4205
+ for await (const chunk of stream) {
4206
+ const chunkType = getChunkType(chunk);
4207
+ const convertedChunk = convertChunk[chunkType](chunk, state);
4208
+ appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
4209
+ }
4210
+ appendFinalChunk({ state, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer });
4211
+ return finalize(state);
4212
+ } catch (error) {
4213
+ error.bufferedData = finalize(state);
4214
+ throw error;
4393
4215
  }
4394
- const stream2 = new PassThroughStream({ objectMode });
4395
- if (encoding) {
4396
- stream2.setEncoding(encoding);
4216
+ };
4217
+ var appendFinalChunk = ({ state, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer }) => {
4218
+ const convertedChunk = getFinalChunk(state);
4219
+ if (convertedChunk !== void 0) {
4220
+ appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
4397
4221
  }
4398
- let length = 0;
4399
- const chunks = [];
4400
- stream2.on("data", (chunk) => {
4401
- chunks.push(chunk);
4402
- if (objectMode) {
4403
- length = chunks.length;
4404
- } else {
4405
- length += chunk.length;
4406
- }
4407
- });
4408
- stream2.getBufferedValue = () => {
4409
- if (array) {
4410
- return chunks;
4411
- }
4412
- return isBuffer ? Buffer.concat(chunks, length) : chunks.join("");
4413
- };
4414
- stream2.getBufferedLength = () => length;
4415
- return stream2;
4416
- };
4417
- var { constants: BufferConstants } = require$$0$5;
4418
- var stream = require$$0$4;
4419
- var { promisify } = require$$2$1;
4420
- var bufferStream = bufferStream$1;
4421
- var streamPipelinePromisified = promisify(stream.pipeline);
4222
+ };
4223
+ var appendChunk = ({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer }) => {
4224
+ const chunkSize = getSize(convertedChunk);
4225
+ const newLength = state.length + chunkSize;
4226
+ if (newLength <= maxBuffer) {
4227
+ addNewChunk(convertedChunk, state, addChunk, newLength);
4228
+ return;
4229
+ }
4230
+ const truncatedChunk = truncateChunk(convertedChunk, maxBuffer - state.length);
4231
+ if (truncatedChunk !== void 0) {
4232
+ addNewChunk(truncatedChunk, state, addChunk, maxBuffer);
4233
+ }
4234
+ throw new MaxBufferError();
4235
+ };
4236
+ var addNewChunk = (convertedChunk, state, addChunk, newLength) => {
4237
+ state.contents = addChunk(convertedChunk, state, newLength);
4238
+ state.length = newLength;
4239
+ };
4240
+ var isAsyncIterable = (stream) => typeof stream === "object" && stream !== null && typeof stream[Symbol.asyncIterator] === "function";
4241
+ var getChunkType = (chunk) => {
4242
+ const typeOfChunk = typeof chunk;
4243
+ if (typeOfChunk === "string") {
4244
+ return "string";
4245
+ }
4246
+ if (typeOfChunk !== "object" || chunk === null) {
4247
+ return "others";
4248
+ }
4249
+ if (globalThis.Buffer?.isBuffer(chunk)) {
4250
+ return "buffer";
4251
+ }
4252
+ const prototypeName = objectToString.call(chunk);
4253
+ if (prototypeName === "[object ArrayBuffer]") {
4254
+ return "arrayBuffer";
4255
+ }
4256
+ if (prototypeName === "[object DataView]") {
4257
+ return "dataView";
4258
+ }
4259
+ if (Number.isInteger(chunk.byteLength) && Number.isInteger(chunk.byteOffset) && objectToString.call(chunk.buffer) === "[object ArrayBuffer]") {
4260
+ return "typedArray";
4261
+ }
4262
+ return "others";
4263
+ };
4264
+ var { toString: objectToString } = Object.prototype;
4422
4265
  var MaxBufferError = class extends Error {
4266
+ name = "MaxBufferError";
4423
4267
  constructor() {
4424
4268
  super("maxBuffer exceeded");
4425
- this.name = "MaxBufferError";
4426
4269
  }
4427
4270
  };
4428
- async function getStream(inputStream, options) {
4429
- if (!inputStream) {
4430
- throw new Error("Expected a stream");
4271
+ var identity = (value) => value;
4272
+ var noop$1 = () => void 0;
4273
+ var getContentsProp = ({ contents }) => contents;
4274
+ var throwObjectStream = (chunk) => {
4275
+ throw new Error(`Streams in object mode are not supported: ${String(chunk)}`);
4276
+ };
4277
+ var getLengthProp = (convertedChunk) => convertedChunk.length;
4278
+ async function getStreamAsArrayBuffer(stream, options2) {
4279
+ return getStreamContents(stream, arrayBufferMethods, options2);
4280
+ }
4281
+ var initArrayBuffer = () => ({ contents: new ArrayBuffer(0) });
4282
+ var useTextEncoder = (chunk) => textEncoder.encode(chunk);
4283
+ var textEncoder = new TextEncoder();
4284
+ var useUint8Array = (chunk) => new Uint8Array(chunk);
4285
+ var useUint8ArrayWithOffset = (chunk) => new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
4286
+ var truncateArrayBufferChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
4287
+ var addArrayBufferChunk = (convertedChunk, { contents, length: previousLength }, length) => {
4288
+ const newContents = hasArrayBufferResize() ? resizeArrayBuffer(contents, length) : resizeArrayBufferSlow(contents, length);
4289
+ new Uint8Array(newContents).set(convertedChunk, previousLength);
4290
+ return newContents;
4291
+ };
4292
+ var resizeArrayBufferSlow = (contents, length) => {
4293
+ if (length <= contents.byteLength) {
4294
+ return contents;
4295
+ }
4296
+ const arrayBuffer = new ArrayBuffer(getNewContentsLength(length));
4297
+ new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
4298
+ return arrayBuffer;
4299
+ };
4300
+ var resizeArrayBuffer = (contents, length) => {
4301
+ if (length <= contents.maxByteLength) {
4302
+ contents.resize(length);
4303
+ return contents;
4304
+ }
4305
+ const arrayBuffer = new ArrayBuffer(length, { maxByteLength: getNewContentsLength(length) });
4306
+ new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
4307
+ return arrayBuffer;
4308
+ };
4309
+ var getNewContentsLength = (length) => SCALE_FACTOR ** Math.ceil(Math.log(length) / Math.log(SCALE_FACTOR));
4310
+ var SCALE_FACTOR = 2;
4311
+ var finalizeArrayBuffer = ({ contents, length }) => hasArrayBufferResize() ? contents : contents.slice(0, length);
4312
+ var hasArrayBufferResize = () => "resize" in ArrayBuffer.prototype;
4313
+ var arrayBufferMethods = {
4314
+ init: initArrayBuffer,
4315
+ convertChunk: {
4316
+ string: useTextEncoder,
4317
+ buffer: useUint8Array,
4318
+ arrayBuffer: useUint8Array,
4319
+ dataView: useUint8ArrayWithOffset,
4320
+ typedArray: useUint8ArrayWithOffset,
4321
+ others: throwObjectStream
4322
+ },
4323
+ getSize: getLengthProp,
4324
+ truncateChunk: truncateArrayBufferChunk,
4325
+ addChunk: addArrayBufferChunk,
4326
+ getFinalChunk: noop$1,
4327
+ finalize: finalizeArrayBuffer
4328
+ };
4329
+ async function getStreamAsBuffer(stream, options2) {
4330
+ if (!("Buffer" in globalThis)) {
4331
+ throw new Error("getStreamAsBuffer() is only supported in Node.js");
4431
4332
  }
4432
- options = {
4433
- maxBuffer: Infinity,
4434
- ...options
4435
- };
4436
- const { maxBuffer } = options;
4437
- const stream2 = bufferStream(options);
4438
- await new Promise((resolve3, reject) => {
4439
- const rejectPromise = (error) => {
4440
- if (error && stream2.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
4441
- error.bufferedData = stream2.getBufferedValue();
4442
- }
4443
- reject(error);
4444
- };
4445
- (async () => {
4446
- try {
4447
- await streamPipelinePromisified(inputStream, stream2);
4448
- resolve3();
4449
- } catch (error) {
4450
- rejectPromise(error);
4451
- }
4452
- })();
4453
- stream2.on("data", () => {
4454
- if (stream2.getBufferedLength() > maxBuffer) {
4455
- rejectPromise(new MaxBufferError());
4456
- }
4457
- });
4458
- });
4459
- return stream2.getBufferedValue();
4333
+ try {
4334
+ return arrayBufferToNodeBuffer(await getStreamAsArrayBuffer(stream, options2));
4335
+ } catch (error) {
4336
+ if (error.bufferedData !== void 0) {
4337
+ error.bufferedData = arrayBufferToNodeBuffer(error.bufferedData);
4338
+ }
4339
+ throw error;
4340
+ }
4341
+ }
4342
+ var arrayBufferToNodeBuffer = (arrayBuffer) => globalThis.Buffer.from(arrayBuffer);
4343
+ async function getStreamAsString(stream, options2) {
4344
+ return getStreamContents(stream, stringMethods, options2);
4460
4345
  }
4461
- getStream$2.exports = getStream;
4462
- getStream$2.exports.buffer = (stream2, options) => getStream(stream2, { ...options, encoding: "buffer" });
4463
- getStream$2.exports.array = (stream2, options) => getStream(stream2, { ...options, array: true });
4464
- getStream$2.exports.MaxBufferError = MaxBufferError;
4465
- var getStreamExports = getStream$2.exports;
4466
- var getStream$1 = /* @__PURE__ */ getDefaultExportFromCjs(getStreamExports);
4467
- var { PassThrough } = require$$0$4;
4346
+ var initString = () => ({ contents: "", textDecoder: new TextDecoder() });
4347
+ var useTextDecoder = (chunk, { textDecoder }) => textDecoder.decode(chunk, { stream: true });
4348
+ var addStringChunk = (convertedChunk, { contents }) => contents + convertedChunk;
4349
+ var truncateStringChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
4350
+ var getFinalStringChunk = ({ textDecoder }) => {
4351
+ const finalChunk = textDecoder.decode();
4352
+ return finalChunk === "" ? void 0 : finalChunk;
4353
+ };
4354
+ var stringMethods = {
4355
+ init: initString,
4356
+ convertChunk: {
4357
+ string: identity,
4358
+ buffer: useTextDecoder,
4359
+ arrayBuffer: useTextDecoder,
4360
+ dataView: useTextDecoder,
4361
+ typedArray: useTextDecoder,
4362
+ others: throwObjectStream
4363
+ },
4364
+ getSize: getLengthProp,
4365
+ truncateChunk: truncateStringChunk,
4366
+ addChunk: addStringChunk,
4367
+ getFinalChunk: getFinalStringChunk,
4368
+ finalize: getContentsProp
4369
+ };
4370
+ var { PassThrough } = require$$0$3;
4468
4371
  var mergeStream = function() {
4469
4372
  var sources = [];
4470
4373
  var output = new PassThrough({ objectMode: true });
@@ -4510,8 +4413,8 @@ var getInput = ({ input, inputFile }) => {
4510
4413
  validateInputOptions(input);
4511
4414
  return createReadStream(inputFile);
4512
4415
  };
4513
- var handleInput = (spawned, options) => {
4514
- const input = getInput(options);
4416
+ var handleInput = (spawned, options2) => {
4417
+ const input = getInput(options2);
4515
4418
  if (input === void 0) {
4516
4419
  return;
4517
4420
  }
@@ -4534,25 +4437,33 @@ var makeAllStream = (spawned, { all }) => {
4534
4437
  }
4535
4438
  return mixed;
4536
4439
  };
4537
- var getBufferedData = async (stream2, streamPromise) => {
4538
- if (!stream2 || streamPromise === void 0) {
4440
+ var getBufferedData = async (stream, streamPromise) => {
4441
+ if (!stream || streamPromise === void 0) {
4539
4442
  return;
4540
4443
  }
4541
- stream2.destroy();
4444
+ await setTimeout$1(0);
4445
+ stream.destroy();
4542
4446
  try {
4543
4447
  return await streamPromise;
4544
4448
  } catch (error) {
4545
4449
  return error.bufferedData;
4546
4450
  }
4547
4451
  };
4548
- var getStreamPromise = (stream2, { encoding, buffer, maxBuffer }) => {
4549
- if (!stream2 || !buffer) {
4452
+ var getStreamPromise = (stream, { encoding, buffer, maxBuffer }) => {
4453
+ if (!stream || !buffer) {
4550
4454
  return;
4551
4455
  }
4552
- if (encoding) {
4553
- return getStream$1(stream2, { encoding, maxBuffer });
4456
+ if (encoding === "utf8" || encoding === "utf-8") {
4457
+ return getStreamAsString(stream, { maxBuffer });
4554
4458
  }
4555
- return getStream$1.buffer(stream2, { maxBuffer });
4459
+ if (encoding === null || encoding === "buffer") {
4460
+ return getStreamAsBuffer(stream, { maxBuffer });
4461
+ }
4462
+ return applyEncoding(stream, maxBuffer, encoding);
4463
+ };
4464
+ var applyEncoding = async (stream, maxBuffer, encoding) => {
4465
+ const buffer = await getStreamAsBuffer(stream, { maxBuffer });
4466
+ return buffer.toString(encoding);
4556
4467
  };
4557
4468
  var getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone) => {
4558
4469
  const stdoutPromise = getStreamPromise(stdout, { encoding, buffer, maxBuffer });
@@ -4601,12 +4512,11 @@ var normalizeArgs = (file, args = []) => {
4601
4512
  return [file, ...args];
4602
4513
  };
4603
4514
  var NO_ESCAPE_REGEXP = /^[\w.-]+$/;
4604
- var DOUBLE_QUOTES_REGEXP = /"/g;
4605
4515
  var escapeArg = (arg) => {
4606
4516
  if (typeof arg !== "string" || NO_ESCAPE_REGEXP.test(arg)) {
4607
4517
  return arg;
4608
4518
  }
4609
- return `"${arg.replace(DOUBLE_QUOTES_REGEXP, '\\"')}"`;
4519
+ return `"${arg.replaceAll('"', '\\"')}"`;
4610
4520
  };
4611
4521
  var joinCommand = (file, args) => normalizeArgs(file, args).join(" ");
4612
4522
  var getEscapedCommand = (file, args) => normalizeArgs(file, args).map((arg) => escapeArg(arg)).join(" ");
@@ -4614,7 +4524,7 @@ var SPACES_REGEXP = / +/g;
4614
4524
  var parseCommand = (command) => {
4615
4525
  const tokens = [];
4616
4526
  for (const token of command.trim().split(SPACES_REGEXP)) {
4617
- const previousToken = tokens[tokens.length - 1];
4527
+ const previousToken = tokens.at(-1);
4618
4528
  if (previousToken && previousToken.endsWith("\\")) {
4619
4529
  tokens[tokens.length - 1] = `${previousToken.slice(0, -1)} ${token}`;
4620
4530
  } else {
@@ -4644,18 +4554,18 @@ var getEnv = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) =>
4644
4554
  }
4645
4555
  return env2;
4646
4556
  };
4647
- var handleArguments = (file, args, options = {}) => {
4648
- const parsed = crossSpawn._parse(file, args, options);
4557
+ var handleArguments = (file, args, options2 = {}) => {
4558
+ const parsed = crossSpawn._parse(file, args, options2);
4649
4559
  file = parsed.command;
4650
4560
  args = parsed.args;
4651
- options = parsed.options;
4652
- options = {
4561
+ options2 = parsed.options;
4562
+ options2 = {
4653
4563
  maxBuffer: DEFAULT_MAX_BUFFER,
4654
4564
  buffer: true,
4655
4565
  stripFinalNewline: true,
4656
4566
  extendEnv: true,
4657
4567
  preferLocal: false,
4658
- localDir: options.cwd || process$2.cwd(),
4568
+ localDir: options2.cwd || process$2.cwd(),
4659
4569
  execPath: process$2.execPath,
4660
4570
  encoding: "utf8",
4661
4571
  reject: true,
@@ -4663,26 +4573,26 @@ var handleArguments = (file, args, options = {}) => {
4663
4573
  all: false,
4664
4574
  windowsHide: true,
4665
4575
  verbose: verboseDefault,
4666
- ...options
4576
+ ...options2
4667
4577
  };
4668
- options.env = getEnv(options);
4669
- options.stdio = normalizeStdio(options);
4578
+ options2.env = getEnv(options2);
4579
+ options2.stdio = normalizeStdio(options2);
4670
4580
  if (process$2.platform === "win32" && path$3.basename(file, ".exe") === "cmd") {
4671
4581
  args.unshift("/q");
4672
4582
  }
4673
- return { file, args, options, parsed };
4583
+ return { file, args, options: options2, parsed };
4674
4584
  };
4675
- var handleOutput = (options, value, error) => {
4585
+ var handleOutput = (options2, value, error) => {
4676
4586
  if (typeof value !== "string" && !Buffer$1.isBuffer(value)) {
4677
4587
  return error === void 0 ? void 0 : "";
4678
4588
  }
4679
- if (options.stripFinalNewline) {
4589
+ if (options2.stripFinalNewline) {
4680
4590
  return stripFinalNewline(value);
4681
4591
  }
4682
4592
  return value;
4683
4593
  };
4684
- function execa(file, args, options) {
4685
- const parsed = handleArguments(file, args, options);
4594
+ function execa(file, args, options2) {
4595
+ const parsed = handleArguments(file, args, options2);
4686
4596
  const command = joinCommand(file, args);
4687
4597
  const escapedCommand = getEscapedCommand(file, args);
4688
4598
  logCommand(escapedCommand, parsed.options);
@@ -4758,9 +4668,207 @@ function execa(file, args, options) {
4758
4668
  mergePromise(spawned, handlePromiseOnce);
4759
4669
  return spawned;
4760
4670
  }
4761
- function execaCommand(command, options) {
4671
+ function execaCommand(command, options2) {
4762
4672
  const [file, ...args] = parseCommand(command);
4763
- return execa(file, args, options);
4673
+ return execa(file, args, options2);
4674
+ }
4675
+ var Node = class {
4676
+ value;
4677
+ next;
4678
+ constructor(value) {
4679
+ this.value = value;
4680
+ }
4681
+ };
4682
+ var Queue = class {
4683
+ #head;
4684
+ #tail;
4685
+ #size;
4686
+ constructor() {
4687
+ this.clear();
4688
+ }
4689
+ enqueue(value) {
4690
+ const node = new Node(value);
4691
+ if (this.#head) {
4692
+ this.#tail.next = node;
4693
+ this.#tail = node;
4694
+ } else {
4695
+ this.#head = node;
4696
+ this.#tail = node;
4697
+ }
4698
+ this.#size++;
4699
+ }
4700
+ dequeue() {
4701
+ const current = this.#head;
4702
+ if (!current) {
4703
+ return;
4704
+ }
4705
+ this.#head = this.#head.next;
4706
+ this.#size--;
4707
+ return current.value;
4708
+ }
4709
+ clear() {
4710
+ this.#head = void 0;
4711
+ this.#tail = void 0;
4712
+ this.#size = 0;
4713
+ }
4714
+ get size() {
4715
+ return this.#size;
4716
+ }
4717
+ *[Symbol.iterator]() {
4718
+ let current = this.#head;
4719
+ while (current) {
4720
+ yield current.value;
4721
+ current = current.next;
4722
+ }
4723
+ }
4724
+ };
4725
+ function pLimit(concurrency) {
4726
+ if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
4727
+ throw new TypeError("Expected `concurrency` to be a number from 1 and up");
4728
+ }
4729
+ const queue = new Queue();
4730
+ let activeCount = 0;
4731
+ const next = () => {
4732
+ activeCount--;
4733
+ if (queue.size > 0) {
4734
+ queue.dequeue()();
4735
+ }
4736
+ };
4737
+ const run2 = async (fn, resolve3, args) => {
4738
+ activeCount++;
4739
+ const result = (async () => fn(...args))();
4740
+ resolve3(result);
4741
+ try {
4742
+ await result;
4743
+ } catch {
4744
+ }
4745
+ next();
4746
+ };
4747
+ const enqueue = (fn, resolve3, args) => {
4748
+ queue.enqueue(run2.bind(void 0, fn, resolve3, args));
4749
+ (async () => {
4750
+ await Promise.resolve();
4751
+ if (activeCount < concurrency && queue.size > 0) {
4752
+ queue.dequeue()();
4753
+ }
4754
+ })();
4755
+ };
4756
+ const generator = (fn, ...args) => new Promise((resolve3) => {
4757
+ enqueue(fn, resolve3, args);
4758
+ });
4759
+ Object.defineProperties(generator, {
4760
+ activeCount: {
4761
+ get: () => activeCount
4762
+ },
4763
+ pendingCount: {
4764
+ get: () => queue.size
4765
+ },
4766
+ clearQueue: {
4767
+ value: () => {
4768
+ queue.clear();
4769
+ }
4770
+ }
4771
+ });
4772
+ return generator;
4773
+ }
4774
+ var EndError = class extends Error {
4775
+ constructor(value) {
4776
+ super();
4777
+ this.value = value;
4778
+ }
4779
+ };
4780
+ var testElement = async (element, tester) => tester(await element);
4781
+ var finder = async (element) => {
4782
+ const values = await Promise.all(element);
4783
+ if (values[1] === true) {
4784
+ throw new EndError(values[0]);
4785
+ }
4786
+ return false;
4787
+ };
4788
+ async function pLocate(iterable, tester, {
4789
+ concurrency = Number.POSITIVE_INFINITY,
4790
+ preserveOrder = true
4791
+ } = {}) {
4792
+ const limit = pLimit(concurrency);
4793
+ const items = [...iterable].map((element) => [element, limit(testElement, element, tester)]);
4794
+ const checkLimit = pLimit(preserveOrder ? 1 : Number.POSITIVE_INFINITY);
4795
+ try {
4796
+ await Promise.all(items.map((element) => checkLimit(finder, element)));
4797
+ } catch (error) {
4798
+ if (error instanceof EndError) {
4799
+ return error.value;
4800
+ }
4801
+ throw error;
4802
+ }
4803
+ }
4804
+ var typeMappings = {
4805
+ directory: "isDirectory",
4806
+ file: "isFile"
4807
+ };
4808
+ function checkType(type) {
4809
+ if (type in typeMappings) {
4810
+ return;
4811
+ }
4812
+ throw new Error(`Invalid type specified: ${type}`);
4813
+ }
4814
+ var matchType = (type, stat) => type === void 0 || stat[typeMappings[type]]();
4815
+ var toPath$1 = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
4816
+ async function locatePath(paths, {
4817
+ cwd = process$2.cwd(),
4818
+ type = "file",
4819
+ allowSymlinks = true,
4820
+ concurrency,
4821
+ preserveOrder
4822
+ } = {}) {
4823
+ checkType(type);
4824
+ cwd = toPath$1(cwd);
4825
+ const statFunction = allowSymlinks ? promises.stat : promises.lstat;
4826
+ return pLocate(paths, async (path_) => {
4827
+ try {
4828
+ const stat = await statFunction(path$3.resolve(cwd, path_));
4829
+ return matchType(type, stat);
4830
+ } catch {
4831
+ return false;
4832
+ }
4833
+ }, { concurrency, preserveOrder });
4834
+ }
4835
+ var toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
4836
+ var findUpStop = Symbol("findUpStop");
4837
+ async function findUpMultiple(name, options2 = {}) {
4838
+ let directory = path$3.resolve(toPath(options2.cwd) || "");
4839
+ const { root } = path$3.parse(directory);
4840
+ const stopAt = path$3.resolve(directory, options2.stopAt || root);
4841
+ const limit = options2.limit || Number.POSITIVE_INFINITY;
4842
+ const paths = [name].flat();
4843
+ const runMatcher = async (locateOptions) => {
4844
+ if (typeof name !== "function") {
4845
+ return locatePath(paths, locateOptions);
4846
+ }
4847
+ const foundPath = await name(locateOptions.cwd);
4848
+ if (typeof foundPath === "string") {
4849
+ return locatePath([foundPath], locateOptions);
4850
+ }
4851
+ return foundPath;
4852
+ };
4853
+ const matches = [];
4854
+ while (true) {
4855
+ const foundPath = await runMatcher({ ...options2, cwd: directory });
4856
+ if (foundPath === findUpStop) {
4857
+ break;
4858
+ }
4859
+ if (foundPath) {
4860
+ matches.push(path$3.resolve(directory, foundPath));
4861
+ }
4862
+ if (directory === stopAt || matches.length >= limit) {
4863
+ break;
4864
+ }
4865
+ directory = path$3.dirname(directory);
4866
+ }
4867
+ return matches;
4868
+ }
4869
+ async function findUp(name, options2 = {}) {
4870
+ const matches = await findUpMultiple(name, { ...options2, limit: 1 });
4871
+ return matches[0];
4764
4872
  }
4765
4873
  var ESC$1 = "\x1B[";
4766
4874
  var OSC = "\x1B]";
@@ -4849,32 +4957,32 @@ ansiEscapes.link = (text2, url2) => {
4849
4957
  BEL
4850
4958
  ].join("");
4851
4959
  };
4852
- ansiEscapes.image = (buffer, options = {}) => {
4960
+ ansiEscapes.image = (buffer, options2 = {}) => {
4853
4961
  let returnValue = `${OSC}1337;File=inline=1`;
4854
- if (options.width) {
4855
- returnValue += `;width=${options.width}`;
4962
+ if (options2.width) {
4963
+ returnValue += `;width=${options2.width}`;
4856
4964
  }
4857
- if (options.height) {
4858
- returnValue += `;height=${options.height}`;
4965
+ if (options2.height) {
4966
+ returnValue += `;height=${options2.height}`;
4859
4967
  }
4860
- if (options.preserveAspectRatio === false) {
4968
+ if (options2.preserveAspectRatio === false) {
4861
4969
  returnValue += ";preserveAspectRatio=0";
4862
4970
  }
4863
4971
  return returnValue + ":" + buffer.toString("base64") + BEL;
4864
4972
  };
4865
4973
  ansiEscapes.iTerm = {
4866
4974
  setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
4867
- annotation: (message, options = {}) => {
4975
+ annotation: (message, options2 = {}) => {
4868
4976
  let returnValue = `${OSC}1337;`;
4869
- const hasX = typeof options.x !== "undefined";
4870
- const hasY = typeof options.y !== "undefined";
4871
- if ((hasX || hasY) && !(hasX && hasY && typeof options.length !== "undefined")) {
4977
+ const hasX = typeof options2.x !== "undefined";
4978
+ const hasY = typeof options2.y !== "undefined";
4979
+ if ((hasX || hasY) && !(hasX && hasY && typeof options2.length !== "undefined")) {
4872
4980
  throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");
4873
4981
  }
4874
4982
  message = message.replace(/\|/g, "");
4875
- returnValue += options.isHidden ? "AddHiddenAnnotation=" : "AddAnnotation=";
4876
- if (options.length > 0) {
4877
- returnValue += (hasX ? [message, options.length, options.x, options.y] : [options.length, message]).join("|");
4983
+ returnValue += options2.isHidden ? "AddHiddenAnnotation=" : "AddAnnotation=";
4984
+ if (options2.length > 0) {
4985
+ returnValue += (hasX ? [message, options2.length, options2.x, options2.y] : [options2.length, message]).join("|");
4878
4986
  } else {
4879
4987
  returnValue += message;
4880
4988
  }
@@ -4887,7 +4995,7 @@ var hasFlag$2 = (flag, argv = process.argv) => {
4887
4995
  const terminatorPosition = argv.indexOf("--");
4888
4996
  return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
4889
4997
  };
4890
- var os = require$$0$6;
4998
+ var os = require$$0$4;
4891
4999
  var tty = require$$1;
4892
5000
  var hasFlag$1 = hasFlag$2;
4893
5001
  var { env } = process;
@@ -4973,8 +5081,8 @@ function supportsColor$1(haveStream, streamIsTTY) {
4973
5081
  }
4974
5082
  return min;
4975
5083
  }
4976
- function getSupportLevel(stream2) {
4977
- const level = supportsColor$1(stream2, stream2 && stream2.isTTY);
5084
+ function getSupportLevel(stream) {
5085
+ const level = supportsColor$1(stream, stream && stream.isTTY);
4978
5086
  return translateLevel(level);
4979
5087
  }
4980
5088
  var supportsColor_1 = {
@@ -5000,7 +5108,7 @@ function parseVersion(versionString) {
5000
5108
  patch: versions[2]
5001
5109
  };
5002
5110
  }
5003
- function supportsHyperlink(stream2) {
5111
+ function supportsHyperlink(stream) {
5004
5112
  const { env: env2 } = process;
5005
5113
  if ("FORCE_HYPERLINK" in env2) {
5006
5114
  return !(env2.FORCE_HYPERLINK.length > 0 && parseInt(env2.FORCE_HYPERLINK, 10) === 0);
@@ -5011,10 +5119,10 @@ function supportsHyperlink(stream2) {
5011
5119
  if (hasFlag("hyperlink=true") || hasFlag("hyperlink=always")) {
5012
5120
  return true;
5013
5121
  }
5014
- if (!supportsColor.supportsColor(stream2)) {
5122
+ if (!supportsColor.supportsColor(stream)) {
5015
5123
  return false;
5016
5124
  }
5017
- if (stream2 && !stream2.isTTY) {
5125
+ if (stream && !stream.isTTY) {
5018
5126
  return false;
5019
5127
  }
5020
5128
  if (process.platform === "win32") {
@@ -5054,17 +5162,17 @@ var supportsHyperlinks = {
5054
5162
  stderr: supportsHyperlink(process.stderr)
5055
5163
  };
5056
5164
  var supportsHyperlinks$1 = /* @__PURE__ */ getDefaultExportFromCjs(supportsHyperlinks);
5057
- function terminalLink(text2, url2, { target = "stdout", ...options } = {}) {
5165
+ function terminalLink(text2, url2, { target = "stdout", ...options2 } = {}) {
5058
5166
  if (!supportsHyperlinks$1[target]) {
5059
- if (options.fallback === false) {
5167
+ if (options2.fallback === false) {
5060
5168
  return text2;
5061
5169
  }
5062
- return typeof options.fallback === "function" ? options.fallback(text2, url2) : `${text2} (\u200B${url2}\u200B)`;
5170
+ return typeof options2.fallback === "function" ? options2.fallback(text2, url2) : `${text2} (\u200B${url2}\u200B)`;
5063
5171
  }
5064
5172
  return ansiEscapes.link(text2, url2);
5065
5173
  }
5066
5174
  terminalLink.isSupported = supportsHyperlinks$1.stdout;
5067
- terminalLink.stderr = (text2, url2, options = {}) => terminalLink(text2, url2, { target: "stderr", ...options });
5175
+ terminalLink.stderr = (text2, url2, options2 = {}) => terminalLink(text2, url2, { target: "stderr", ...options2 });
5068
5176
  terminalLink.stderr.isSupported = supportsHyperlinks$1.stderr;
5069
5177
  var prompts$3 = {};
5070
5178
  var FORCE_COLOR$1;
@@ -5390,7 +5498,7 @@ var util = {
5390
5498
  wrap: wrap$3,
5391
5499
  entriesToDisplay: entriesToDisplay$3
5392
5500
  };
5393
- var readline = require$$0$7;
5501
+ var readline = require$$0$5;
5394
5502
  var { action } = util;
5395
5503
  var EventEmitter = require$$2;
5396
5504
  var { beep, cursor: cursor$9 } = src;
@@ -6594,28 +6702,28 @@ Instructions:
6594
6702
  return prefix + title + color$3.gray(desc || "");
6595
6703
  }
6596
6704
  // shared with autocompleteMultiselect
6597
- paginateOptions(options) {
6598
- if (options.length === 0) {
6705
+ paginateOptions(options2) {
6706
+ if (options2.length === 0) {
6599
6707
  return color$3.red("No matches for this query.");
6600
6708
  }
6601
- let { startIndex, endIndex } = entriesToDisplay$1(this.cursor, options.length, this.optionsPerPage);
6709
+ let { startIndex, endIndex } = entriesToDisplay$1(this.cursor, options2.length, this.optionsPerPage);
6602
6710
  let prefix, styledOptions = [];
6603
6711
  for (let i = startIndex; i < endIndex; i++) {
6604
6712
  if (i === startIndex && startIndex > 0) {
6605
6713
  prefix = figures$2.arrowUp;
6606
- } else if (i === endIndex - 1 && endIndex < options.length) {
6714
+ } else if (i === endIndex - 1 && endIndex < options2.length) {
6607
6715
  prefix = figures$2.arrowDown;
6608
6716
  } else {
6609
6717
  prefix = " ";
6610
6718
  }
6611
- styledOptions.push(this.renderOption(this.cursor, options[i], i, prefix));
6719
+ styledOptions.push(this.renderOption(this.cursor, options2[i], i, prefix));
6612
6720
  }
6613
6721
  return "\n" + styledOptions.join("\n");
6614
6722
  }
6615
6723
  // shared with autocomleteMultiselect
6616
- renderOptions(options) {
6724
+ renderOptions(options2) {
6617
6725
  if (!this.done) {
6618
- return this.paginateOptions(options);
6726
+ return this.paginateOptions(options2);
6619
6727
  }
6620
6728
  return "";
6621
6729
  }
@@ -7242,7 +7350,152 @@ function override(answers) {
7242
7350
  var lib$1 = Object.assign(prompt, { prompt, prompts: prompts$2, inject, override });
7243
7351
  var prompts = lib$1;
7244
7352
  var prompts$1 = /* @__PURE__ */ getDefaultExportFromCjs(prompts);
7245
- var isexe = isexe_1;
7353
+ var cjs = {};
7354
+ var posix$1 = {};
7355
+ Object.defineProperty(posix$1, "__esModule", { value: true });
7356
+ posix$1.sync = posix$1.isexe = void 0;
7357
+ var fs_1$1 = require$$0;
7358
+ var promises_1$1 = require$$1$1;
7359
+ var isexe$2 = async (path2, options2 = {}) => {
7360
+ const { ignoreErrors = false } = options2;
7361
+ try {
7362
+ return checkStat$1(await (0, promises_1$1.stat)(path2), options2);
7363
+ } catch (e) {
7364
+ const er = e;
7365
+ if (ignoreErrors || er.code === "EACCES")
7366
+ return false;
7367
+ throw er;
7368
+ }
7369
+ };
7370
+ posix$1.isexe = isexe$2;
7371
+ var sync$1 = (path2, options2 = {}) => {
7372
+ const { ignoreErrors = false } = options2;
7373
+ try {
7374
+ return checkStat$1((0, fs_1$1.statSync)(path2), options2);
7375
+ } catch (e) {
7376
+ const er = e;
7377
+ if (ignoreErrors || er.code === "EACCES")
7378
+ return false;
7379
+ throw er;
7380
+ }
7381
+ };
7382
+ posix$1.sync = sync$1;
7383
+ var checkStat$1 = (stat, options2) => stat.isFile() && checkMode(stat, options2);
7384
+ var checkMode = (stat, options2) => {
7385
+ const myUid = options2.uid ?? process.getuid?.();
7386
+ const myGroups = options2.groups ?? process.getgroups?.() ?? [];
7387
+ const myGid = options2.gid ?? process.getgid?.() ?? myGroups[0];
7388
+ if (myUid === void 0 || myGid === void 0) {
7389
+ throw new Error("cannot get uid or gid");
7390
+ }
7391
+ const groups = /* @__PURE__ */ new Set([myGid, ...myGroups]);
7392
+ const mod = stat.mode;
7393
+ const uid = stat.uid;
7394
+ const gid = stat.gid;
7395
+ const u = parseInt("100", 8);
7396
+ const g = parseInt("010", 8);
7397
+ const o = parseInt("001", 8);
7398
+ const ug = u | g;
7399
+ return !!(mod & o || mod & g && groups.has(gid) || mod & u && uid === myUid || mod & ug && myUid === 0);
7400
+ };
7401
+ var win32 = {};
7402
+ Object.defineProperty(win32, "__esModule", { value: true });
7403
+ win32.sync = win32.isexe = void 0;
7404
+ var fs_1 = require$$0;
7405
+ var promises_1 = require$$1$1;
7406
+ var isexe$1 = async (path2, options2 = {}) => {
7407
+ const { ignoreErrors = false } = options2;
7408
+ try {
7409
+ return checkStat(await (0, promises_1.stat)(path2), path2, options2);
7410
+ } catch (e) {
7411
+ const er = e;
7412
+ if (ignoreErrors || er.code === "EACCES")
7413
+ return false;
7414
+ throw er;
7415
+ }
7416
+ };
7417
+ win32.isexe = isexe$1;
7418
+ var sync = (path2, options2 = {}) => {
7419
+ const { ignoreErrors = false } = options2;
7420
+ try {
7421
+ return checkStat((0, fs_1.statSync)(path2), path2, options2);
7422
+ } catch (e) {
7423
+ const er = e;
7424
+ if (ignoreErrors || er.code === "EACCES")
7425
+ return false;
7426
+ throw er;
7427
+ }
7428
+ };
7429
+ win32.sync = sync;
7430
+ var checkPathExt = (path2, options2) => {
7431
+ const { pathExt = process.env.PATHEXT || "" } = options2;
7432
+ const peSplit = pathExt.split(";");
7433
+ if (peSplit.indexOf("") !== -1) {
7434
+ return true;
7435
+ }
7436
+ for (let i = 0; i < peSplit.length; i++) {
7437
+ const p = peSplit[i].toLowerCase();
7438
+ const ext = path2.substring(path2.length - p.length).toLowerCase();
7439
+ if (p && ext === p) {
7440
+ return true;
7441
+ }
7442
+ }
7443
+ return false;
7444
+ };
7445
+ var checkStat = (stat, path2, options2) => stat.isFile() && checkPathExt(path2, options2);
7446
+ var options = {};
7447
+ Object.defineProperty(options, "__esModule", { value: true });
7448
+ (function(exports) {
7449
+ var __createBinding = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function(o, m, k, k2) {
7450
+ if (k2 === void 0)
7451
+ k2 = k;
7452
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7453
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7454
+ desc = { enumerable: true, get: function() {
7455
+ return m[k];
7456
+ } };
7457
+ }
7458
+ Object.defineProperty(o, k2, desc);
7459
+ } : function(o, m, k, k2) {
7460
+ if (k2 === void 0)
7461
+ k2 = k;
7462
+ o[k2] = m[k];
7463
+ });
7464
+ var __setModuleDefault = commonjsGlobal && commonjsGlobal.__setModuleDefault || (Object.create ? function(o, v) {
7465
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
7466
+ } : function(o, v) {
7467
+ o["default"] = v;
7468
+ });
7469
+ var __importStar = commonjsGlobal && commonjsGlobal.__importStar || function(mod) {
7470
+ if (mod && mod.__esModule)
7471
+ return mod;
7472
+ var result = {};
7473
+ if (mod != null) {
7474
+ for (var k in mod)
7475
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
7476
+ __createBinding(result, mod, k);
7477
+ }
7478
+ __setModuleDefault(result, mod);
7479
+ return result;
7480
+ };
7481
+ var __exportStar = commonjsGlobal && commonjsGlobal.__exportStar || function(m, exports2) {
7482
+ for (var p in m)
7483
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
7484
+ __createBinding(exports2, m, p);
7485
+ };
7486
+ Object.defineProperty(exports, "__esModule", { value: true });
7487
+ exports.sync = exports.isexe = exports.posix = exports.win32 = void 0;
7488
+ const posix2 = __importStar(posix$1);
7489
+ exports.posix = posix2;
7490
+ const win32$1 = __importStar(win32);
7491
+ exports.win32 = win32$1;
7492
+ __exportStar(options, exports);
7493
+ const platform = process.env._ISEXE_TEST_PLATFORM_ || process.platform;
7494
+ const impl = platform === "win32" ? win32$1 : posix2;
7495
+ exports.isexe = impl.isexe;
7496
+ exports.sync = impl.sync;
7497
+ })(cjs);
7498
+ var { isexe, sync: isexeSync } = cjs;
7246
7499
  var { join: join2, delimiter, sep, posix } = require$$0$1;
7247
7500
  var isWindows = process.platform === "win32";
7248
7501
  var rSlash = new RegExp(`[${posix.sep}${sep === posix.sep ? "" : sep}]`.replace(/(\\)/g, "\\$1"));
@@ -7261,11 +7514,7 @@ var getPathInfo = (cmd, {
7261
7514
  ];
7262
7515
  if (isWindows) {
7263
7516
  const pathExtExe = optPathExt || [".EXE", ".CMD", ".BAT", ".COM"].join(optDelimiter);
7264
- const pathExt = pathExtExe.split(optDelimiter).reduce((acc, item2) => {
7265
- acc.push(item2);
7266
- acc.push(item2.toLowerCase());
7267
- return acc;
7268
- }, []);
7517
+ const pathExt = pathExtExe.split(optDelimiter).flatMap((item2) => [item2, item2.toLowerCase()]);
7269
7518
  if (cmd.includes(".") && pathExt[0] !== "") {
7270
7519
  pathExt.unshift("");
7271
7520
  }
@@ -7309,7 +7558,7 @@ var whichSync = (cmd, opt = {}) => {
7309
7558
  const p = getPathPart(pathEnvPart, cmd);
7310
7559
  for (const ext of pathExt) {
7311
7560
  const withExt = p + ext;
7312
- const is = isexe.sync(withExt, { pathExt: pathExtExe, ignoreErrors: true });
7561
+ const is = isexeSync(withExt, { pathExt: pathExtExe, ignoreErrors: true });
7313
7562
  if (is) {
7314
7563
  if (!opt.all) {
7315
7564
  return withExt;
@@ -7360,7 +7609,7 @@ async function detect({ autoInstall, programmatic, cwd } = {}) {
7360
7609
  try {
7361
7610
  const pkg = JSON.parse(fs$1.readFileSync(packageJsonPath, "utf8"));
7362
7611
  if (typeof pkg.packageManager === "string") {
7363
- const [name, ver] = pkg.packageManager.split("@");
7612
+ const [name, ver] = pkg.packageManager.replace(/^\^/, "").split("@");
7364
7613
  version3 = ver;
7365
7614
  if (name === "yarn" && Number.parseInt(ver) > 1)
7366
7615
  agent = "yarn@berry";
@@ -7395,6 +7644,35 @@ async function detect({ autoInstall, programmatic, cwd } = {}) {
7395
7644
  }
7396
7645
  return agent;
7397
7646
  }
7647
+ var customRcPath = process$2.env.NI_CONFIG_FILE;
7648
+ var home = process$2.platform === "win32" ? process$2.env.USERPROFILE : process$2.env.HOME;
7649
+ var defaultRcPath = path$3.join(home || "~/", ".nirc");
7650
+ var rcPath = customRcPath || defaultRcPath;
7651
+ var defaultConfig = {
7652
+ defaultAgent: "prompt",
7653
+ globalAgent: "npm"
7654
+ };
7655
+ var config;
7656
+ async function getConfig() {
7657
+ if (!config) {
7658
+ const agent = await detect({ programmatic: true });
7659
+ if (agent)
7660
+ config = { ...defaultConfig, defaultAgent: agent };
7661
+ else
7662
+ config = Object.assign({}, defaultConfig, ini$1.parse(fs$1.readFileSync(rcPath, "utf-8")));
7663
+ }
7664
+ return config;
7665
+ }
7666
+ async function getDefaultAgent(programmatic) {
7667
+ const { defaultAgent } = await getConfig();
7668
+ if (defaultAgent === "prompt" && (programmatic || process$2.env.CI))
7669
+ return "npm";
7670
+ return defaultAgent;
7671
+ }
7672
+ async function getGlobalAgent() {
7673
+ const { globalAgent } = await getConfig();
7674
+ return globalAgent;
7675
+ }
7398
7676
  var UnsupportedCommand = class extends Error {
7399
7677
  constructor({ agent, command }) {
7400
7678
  super(`Command "${command}" is not support by agent "${agent}"`);
@@ -7523,13 +7801,13 @@ function init(open, close) {
7523
7801
  return txt === void 0 ? chain([open], [blk]) : $.enabled ? run$1([blk], txt + "") : txt + "";
7524
7802
  };
7525
7803
  }
7526
- var version2 = "0.21.8";
7804
+ var version2 = "0.21.9";
7527
7805
  var DEBUG_SIGN = "?";
7528
- async function getCliCommand(fn, args, options = {}, cwd = options.cwd ?? process$2.cwd()) {
7806
+ async function getCliCommand(fn, args, options2 = {}, cwd = options2.cwd ?? process$2.cwd()) {
7529
7807
  const isGlobal = args.includes("-g");
7530
7808
  if (isGlobal)
7531
7809
  return await fn(await getGlobalAgent(), args);
7532
- let agent = await detect({ ...options, cwd }) || await getDefaultAgent(options.programmatic);
7810
+ let agent = await detect({ ...options2, cwd }) || await getDefaultAgent(options2.programmatic);
7533
7811
  if (agent === "prompt") {
7534
7812
  agent = (await prompts$1({
7535
7813
  name: "agent",
@@ -7541,25 +7819,26 @@ async function getCliCommand(fn, args, options = {}, cwd = options.cwd ?? proces
7541
7819
  return;
7542
7820
  }
7543
7821
  return await fn(agent, args, {
7544
- programmatic: options.programmatic,
7822
+ programmatic: options2.programmatic,
7545
7823
  hasLock: Boolean(agent),
7546
7824
  cwd
7547
7825
  });
7548
7826
  }
7549
- async function run(fn, args, options = {}) {
7827
+ async function run(fn, args, options2 = {}) {
7550
7828
  const debug2 = args.includes(DEBUG_SIGN);
7551
7829
  if (debug2)
7552
7830
  remove(args, DEBUG_SIGN);
7553
- let cwd = options.cwd ?? process$2.cwd();
7831
+ let cwd = options2.cwd ?? process$2.cwd();
7554
7832
  if (args[0] === "-C") {
7555
7833
  cwd = resolve(cwd, args[1]);
7556
7834
  args.splice(0, 2);
7557
7835
  }
7558
- if (args.length === 1 && args[0]?.toLowerCase() === "-v") {
7559
- const getV = (a, o) => execaCommand(`${a} -v`, o).then((e) => e.stdout).then((e) => e.startsWith("v") ? e : `v${e}`);
7836
+ if (args.length === 1 && (args[0]?.toLowerCase() === "-v" || args[0] === "--version")) {
7837
+ const getCmd = (a) => agents.includes(a) ? getCommand(a, "agent", ["-v"]) : `${a} -v`;
7838
+ const getV = (a, o) => execaCommand(getCmd(a), o).then((e) => e.stdout).then((e) => e.startsWith("v") ? e : `v${e}`);
7560
7839
  const globalAgentPromise = getGlobalAgent();
7561
7840
  const globalAgentVersionPromise = globalAgentPromise.then(getV);
7562
- const agentPromise = detect({ ...options, cwd }).then((a) => a || "");
7841
+ const agentPromise = detect({ ...options2, cwd }).then((a) => a || "");
7563
7842
  const agentVersionPromise = agentPromise.then((a) => a && getV(a, { cwd }));
7564
7843
  const nodeVersionPromise = getV("node", { cwd });
7565
7844
  console.log(`@antfu/ni ${$.cyan(`v${version2}`)}`);
@@ -7581,17 +7860,18 @@ async function run(fn, args, options = {}) {
7581
7860
  const dash = $.dim("-");
7582
7861
  console.log($.green($.bold("@antfu/ni")) + $.dim(` use the right package manager v${version2}
7583
7862
  `));
7584
- console.log(`ni ${dash} install`);
7585
- console.log(`nr ${dash} run`);
7586
- console.log(`nlx ${dash} execute`);
7587
- console.log(`nu ${dash} upgrade`);
7588
- console.log(`nun ${dash} uninstall`);
7589
- console.log(`nci ${dash} clean install`);
7590
- console.log(`na ${dash} agent alias`);
7863
+ console.log(`ni ${dash} install`);
7864
+ console.log(`nr ${dash} run`);
7865
+ console.log(`nlx ${dash} execute`);
7866
+ console.log(`nu ${dash} upgrade`);
7867
+ console.log(`nun ${dash} uninstall`);
7868
+ console.log(`nci ${dash} clean install`);
7869
+ console.log(`na ${dash} agent alias`);
7870
+ console.log(`ni -v ${dash} show used agent`);
7591
7871
  console.log($.yellow("\ncheck https://github.com/antfu/ni for more documentation."));
7592
7872
  return;
7593
7873
  }
7594
- let command = await getCliCommand(fn, args, options, cwd);
7874
+ let command = await getCliCommand(fn, args, options2, cwd);
7595
7875
  if (!command)
7596
7876
  return;
7597
7877
  const voltaPrefix = getVoltaPrefix();
@@ -7601,7 +7881,7 @@ async function run(fn, args, options = {}) {
7601
7881
  console.log(command);
7602
7882
  return;
7603
7883
  }
7604
- await execaCommand(command, { stdio: "inherit", encoding: "utf-8", cwd });
7884
+ await execaCommand(command, { stdio: "inherit", cwd });
7605
7885
  }
7606
7886
 
7607
7887
  // node/themes.ts
@@ -7689,19 +7969,19 @@ function getRoot(name, entry) {
7689
7969
  return resolve2(dirname2(entry), name);
7690
7970
  return dirname2(resolveImportPath(`${name}/package.json`, true));
7691
7971
  }
7692
- function getUserRoot(options) {
7693
- const { entry: rawEntry = "slides.md", userRoot = process3.cwd() } = options;
7972
+ function getUserRoot(options2) {
7973
+ const { entry: rawEntry = "slides.md", userRoot = process3.cwd() } = options2;
7694
7974
  const fullEntry = resolve2(userRoot, rawEntry);
7695
7975
  return { entry: fullEntry, userRoot: dirname2(fullEntry) };
7696
7976
  }
7697
- async function resolveOptions(options, mode2, promptForInstallation = true) {
7698
- const { remote, inspect } = options;
7977
+ async function resolveOptions(options2, mode2, promptForInstallation = true) {
7978
+ const { remote, inspect } = options2;
7699
7979
  const {
7700
7980
  entry,
7701
7981
  userRoot
7702
- } = getUserRoot(options);
7982
+ } = getUserRoot(options2);
7703
7983
  const data = await parser.load(entry);
7704
- const theme = resolveThemeName(options.theme || data.config.theme);
7984
+ const theme = resolveThemeName(options2.theme || data.config.theme);
7705
7985
  if (promptForInstallation) {
7706
7986
  if (await promptForThemeInstallation(theme) === false)
7707
7987
  process3.exit(1);
@@ -7721,7 +8001,7 @@ async function resolveOptions(options, mode2, promptForInstallation = true) {
7721
8001
  const themeMeta = await getThemeMeta(theme, join3(themeRoots[0], "package.json"));
7722
8002
  data.themeMeta = themeMeta;
7723
8003
  if (themeMeta)
7724
- data.config = parser.resolveConfig(data.headmatter, themeMeta, options.entry);
8004
+ data.config = parser.resolveConfig(data.headmatter, themeMeta, options2.entry);
7725
8005
  }
7726
8006
  debug({
7727
8007
  config: data.config,