shadcn-svelte 0.8.1 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -19,7 +19,7 @@ import path8 from "path";
19
19
  import chalk2 from "chalk";
20
20
  import { execa as execa2 } from "execa";
21
21
 
22
- // node_modules/.pnpm/tsconfck@2.1.2_typescript@5.3.3/node_modules/tsconfck/dist/index.js
22
+ // ../../node_modules/.pnpm/tsconfck@2.1.2_typescript@5.3.3/node_modules/tsconfck/dist/index.js
23
23
  import path2 from "path";
24
24
  import path3 from "path";
25
25
  import { promises as fs2 } from "fs";
@@ -195,13 +195,13 @@ async function findNative(filename) {
195
195
  }
196
196
  return tsconfigFile;
197
197
  }
198
- async function parseNative(filename, options) {
199
- const cache = options == null ? void 0 : options.cache;
198
+ async function parseNative(filename, options2) {
199
+ const cache = options2 == null ? void 0 : options2.cache;
200
200
  if (cache == null ? void 0 : cache.has(filename)) {
201
201
  return cache.get(filename);
202
202
  }
203
203
  let tsconfigFile;
204
- if (options == null ? void 0 : options.resolveWithEmptyIfConfigNotFound) {
204
+ if (options2 == null ? void 0 : options2.resolveWithEmptyIfConfigNotFound) {
205
205
  try {
206
206
  tsconfigFile = await resolveTSConfig(filename);
207
207
  if (!tsconfigFile) {
@@ -227,16 +227,16 @@ async function parseNative(filename, options) {
227
227
  result = cache.get(tsconfigFile);
228
228
  } else {
229
229
  const ts = await loadTS();
230
- result = await parseFile2(tsconfigFile, ts, options);
231
- await parseReferences2(result, ts, options);
230
+ result = await parseFile2(tsconfigFile, ts, options2);
231
+ await parseReferences2(result, ts, options2);
232
232
  cache == null ? void 0 : cache.set(tsconfigFile, result);
233
233
  }
234
234
  result = resolveSolutionTSConfig(filename, result);
235
235
  cache == null ? void 0 : cache.set(filename, result);
236
236
  return result;
237
237
  }
238
- async function parseFile2(tsconfigFile, ts, options) {
239
- const cache = options == null ? void 0 : options.cache;
238
+ async function parseFile2(tsconfigFile, ts, options2) {
239
+ const cache = options2 == null ? void 0 : options2.cache;
240
240
  if (cache == null ? void 0 : cache.has(tsconfigFile)) {
241
241
  return cache.get(tsconfigFile);
242
242
  }
@@ -252,7 +252,7 @@ async function parseFile2(tsconfigFile, ts, options) {
252
252
  fileExists: sys.fileExists,
253
253
  readFile: sys.readFile
254
254
  };
255
- if (options == null ? void 0 : options.ignoreSourceFiles) {
255
+ if (options2 == null ? void 0 : options2.ignoreSourceFiles) {
256
256
  config.files = [];
257
257
  config.include = [];
258
258
  }
@@ -272,13 +272,13 @@ async function parseFile2(tsconfigFile, ts, options) {
272
272
  cache == null ? void 0 : cache.set(tsconfigFile, result);
273
273
  return result;
274
274
  }
275
- async function parseReferences2(result, ts, options) {
275
+ async function parseReferences2(result, ts, options2) {
276
276
  if (!result.tsconfig.references) {
277
277
  return;
278
278
  }
279
279
  const referencedFiles = resolveReferencedTSConfigFiles(result);
280
280
  result.referenced = await Promise.all(
281
- referencedFiles.map((file) => parseFile2(file, ts, options))
281
+ referencedFiles.map((file) => parseFile2(file, ts, options2))
282
282
  );
283
283
  }
284
284
  function checkErrors(nativeResult, tsconfigFile) {
@@ -384,11 +384,11 @@ import * as z from "zod";
384
384
  // src/utils/find-tsconfig.ts
385
385
  import { promises as fs } from "fs";
386
386
  import path from "path";
387
- async function find(filename, options) {
387
+ async function find(filename, options2) {
388
388
  let dir = path.dirname(path.resolve(filename));
389
- const root = options?.root ? path.resolve(options.root) : null;
389
+ const root = options2?.root ? path.resolve(options2.root) : null;
390
390
  while (dir) {
391
- const tsconfig = await tsconfigInDir(dir, options);
391
+ const tsconfig = await tsconfigInDir(dir, options2);
392
392
  if (tsconfig) {
393
393
  return tsconfig;
394
394
  } else {
@@ -405,11 +405,11 @@ async function find(filename, options) {
405
405
  }
406
406
  throw new Error(`no tsconfig file found for ${filename}`);
407
407
  }
408
- async function tsconfigInDir(dir, options) {
408
+ async function tsconfigInDir(dir, options2) {
409
409
  const tsconfig = path.join(dir, "tsconfig.json");
410
410
  const jsconfig = path.join(dir, "jsconfig.json");
411
- if (options?.tsConfigPaths) {
412
- return options.tsConfigPaths.has(tsconfig) ? tsconfig : void 0;
411
+ if (options2?.tsConfigPaths) {
412
+ return options2.tsConfigPaths.has(tsconfig) ? tsconfig : void 0;
413
413
  }
414
414
  try {
415
415
  const stat = await fs.stat(tsconfig);
@@ -455,11 +455,10 @@ function isUsingSvelteKit(cwd) {
455
455
  return Object.keys(deps).some((dep) => dep === "@sveltejs/kit");
456
456
  }
457
457
 
458
- // node_modules/.pnpm/@antfu+ni@0.21.5/node_modules/@antfu/ni/dist/shared/ni.3ebb7310.mjs
458
+ // ../../node_modules/.pnpm/@antfu+ni@0.21.12/node_modules/@antfu/ni/dist/shared/ni.f699cf8a.mjs
459
+ import fs$1, { createWriteStream, createReadStream, promises, existsSync } from "node:fs";
459
460
  import path$3, { join as join$1, dirname, resolve } from "node:path";
460
461
  import process$2 from "node:process";
461
- import require$$0$7 from "readline";
462
- import require$$2 from "events";
463
462
  import { Buffer as Buffer$1 } from "node:buffer";
464
463
  import childProcess, { ChildProcess } from "node:child_process";
465
464
  import require$$0$2 from "child_process";
@@ -467,14 +466,14 @@ import require$$0$1 from "path";
467
466
  import require$$0 from "fs";
468
467
  import url, { fileURLToPath as fileURLToPath2 } from "node:url";
469
468
  import os$1, { constants } from "node:os";
470
- import require$$0$3 from "assert";
471
- import fs$1, { promises, createWriteStream, createReadStream, existsSync } from "node:fs";
472
- import require$$0$5 from "buffer";
473
- import require$$0$4 from "stream";
474
- import require$$2$1 from "util";
469
+ import { setTimeout as setTimeout$1 } from "node:timers/promises";
470
+ import require$$0$3 from "stream";
475
471
  import { debuglog } from "node:util";
476
- import require$$0$6 from "os";
472
+ import require$$0$4 from "os";
477
473
  import require$$1 from "tty";
474
+ import require$$0$5 from "readline";
475
+ import require$$2 from "events";
476
+ import require$$1$1 from "fs/promises";
478
477
  function npmRun(agent) {
479
478
  return (args) => {
480
479
  if (args.length > 1)
@@ -516,8 +515,8 @@ var bun = {
516
515
  "frozen": "bun install --no-save",
517
516
  "global": "bun add -g {0}",
518
517
  "add": "bun add {0}",
519
- "upgrade": null,
520
- "upgrade-interactive": null,
518
+ "upgrade": "bun update {0}",
519
+ "upgrade-interactive": "bun update {0}",
521
520
  "execute": "bunx {0}",
522
521
  "uninstall": "bun remove {0}",
523
522
  "global_uninstall": "bun remove -g {0}"
@@ -576,207 +575,6 @@ function getDefaultExportFromCjs(x) {
576
575
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
577
576
  }
578
577
  var { hasOwnProperty } = Object.prototype;
579
- var Node = class {
580
- value;
581
- next;
582
- constructor(value) {
583
- this.value = value;
584
- }
585
- };
586
- var Queue = class {
587
- #head;
588
- #tail;
589
- #size;
590
- constructor() {
591
- this.clear();
592
- }
593
- enqueue(value) {
594
- const node = new Node(value);
595
- if (this.#head) {
596
- this.#tail.next = node;
597
- this.#tail = node;
598
- } else {
599
- this.#head = node;
600
- this.#tail = node;
601
- }
602
- this.#size++;
603
- }
604
- dequeue() {
605
- const current = this.#head;
606
- if (!current) {
607
- return;
608
- }
609
- this.#head = this.#head.next;
610
- this.#size--;
611
- return current.value;
612
- }
613
- clear() {
614
- this.#head = void 0;
615
- this.#tail = void 0;
616
- this.#size = 0;
617
- }
618
- get size() {
619
- return this.#size;
620
- }
621
- *[Symbol.iterator]() {
622
- let current = this.#head;
623
- while (current) {
624
- yield current.value;
625
- current = current.next;
626
- }
627
- }
628
- };
629
- function pLimit(concurrency) {
630
- if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
631
- throw new TypeError("Expected `concurrency` to be a number from 1 and up");
632
- }
633
- const queue = new Queue();
634
- let activeCount = 0;
635
- const next = () => {
636
- activeCount--;
637
- if (queue.size > 0) {
638
- queue.dequeue()();
639
- }
640
- };
641
- const run2 = async (fn, resolve2, args) => {
642
- activeCount++;
643
- const result = (async () => fn(...args))();
644
- resolve2(result);
645
- try {
646
- await result;
647
- } catch {
648
- }
649
- next();
650
- };
651
- const enqueue = (fn, resolve2, args) => {
652
- queue.enqueue(run2.bind(void 0, fn, resolve2, args));
653
- (async () => {
654
- await Promise.resolve();
655
- if (activeCount < concurrency && queue.size > 0) {
656
- queue.dequeue()();
657
- }
658
- })();
659
- };
660
- const generator = (fn, ...args) => new Promise((resolve2) => {
661
- enqueue(fn, resolve2, args);
662
- });
663
- Object.defineProperties(generator, {
664
- activeCount: {
665
- get: () => activeCount
666
- },
667
- pendingCount: {
668
- get: () => queue.size
669
- },
670
- clearQueue: {
671
- value: () => {
672
- queue.clear();
673
- }
674
- }
675
- });
676
- return generator;
677
- }
678
- var EndError = class extends Error {
679
- constructor(value) {
680
- super();
681
- this.value = value;
682
- }
683
- };
684
- var testElement = async (element, tester) => tester(await element);
685
- var finder = async (element) => {
686
- const values = await Promise.all(element);
687
- if (values[1] === true) {
688
- throw new EndError(values[0]);
689
- }
690
- return false;
691
- };
692
- async function pLocate(iterable, tester, {
693
- concurrency = Number.POSITIVE_INFINITY,
694
- preserveOrder = true
695
- } = {}) {
696
- const limit = pLimit(concurrency);
697
- const items = [...iterable].map((element) => [element, limit(testElement, element, tester)]);
698
- const checkLimit = pLimit(preserveOrder ? 1 : Number.POSITIVE_INFINITY);
699
- try {
700
- await Promise.all(items.map((element) => checkLimit(finder, element)));
701
- } catch (error) {
702
- if (error instanceof EndError) {
703
- return error.value;
704
- }
705
- throw error;
706
- }
707
- }
708
- var typeMappings = {
709
- directory: "isDirectory",
710
- file: "isFile"
711
- };
712
- function checkType(type) {
713
- if (type in typeMappings) {
714
- return;
715
- }
716
- throw new Error(`Invalid type specified: ${type}`);
717
- }
718
- var matchType = (type, stat) => type === void 0 || stat[typeMappings[type]]();
719
- var toPath$1 = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath2(urlOrPath) : urlOrPath;
720
- async function locatePath(paths, {
721
- cwd = process$2.cwd(),
722
- type = "file",
723
- allowSymlinks = true,
724
- concurrency,
725
- preserveOrder
726
- } = {}) {
727
- checkType(type);
728
- cwd = toPath$1(cwd);
729
- const statFunction = allowSymlinks ? promises.stat : promises.lstat;
730
- return pLocate(paths, async (path_) => {
731
- try {
732
- const stat = await statFunction(path$3.resolve(cwd, path_));
733
- return matchType(type, stat);
734
- } catch {
735
- return false;
736
- }
737
- }, { concurrency, preserveOrder });
738
- }
739
- var toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath2(urlOrPath) : urlOrPath;
740
- var findUpStop = Symbol("findUpStop");
741
- async function findUpMultiple(name, options = {}) {
742
- let directory = path$3.resolve(toPath(options.cwd) || "");
743
- const { root } = path$3.parse(directory);
744
- const stopAt = path$3.resolve(directory, options.stopAt || root);
745
- const limit = options.limit || Number.POSITIVE_INFINITY;
746
- const paths = [name].flat();
747
- const runMatcher = async (locateOptions) => {
748
- if (typeof name !== "function") {
749
- return locatePath(paths, locateOptions);
750
- }
751
- const foundPath = await name(locateOptions.cwd);
752
- if (typeof foundPath === "string") {
753
- return locatePath([foundPath], locateOptions);
754
- }
755
- return foundPath;
756
- };
757
- const matches = [];
758
- while (true) {
759
- const foundPath = await runMatcher({ ...options, cwd: directory });
760
- if (foundPath === findUpStop) {
761
- break;
762
- }
763
- if (foundPath) {
764
- matches.push(path$3.resolve(directory, foundPath));
765
- }
766
- if (directory === stopAt || matches.length >= limit) {
767
- break;
768
- }
769
- directory = path$3.dirname(directory);
770
- }
771
- return matches;
772
- }
773
- async function findUp(name, options = {}) {
774
- const matches = await findUpMultiple(name, { ...options, limit: 1 });
775
- return matches[0];
776
- }
777
- var customRcPath = process$2.env.NI_CONFIG_FILE;
778
- var home = process$2.platform === "win32" ? process$2.env.USERPROFILE : process$2.env.HOME;
779
- var defaultRcPath = path$3.join(home || "~/", ".nirc");
780
578
  var crossSpawn$1 = { exports: {} };
781
579
  var windows;
782
580
  var hasRequiredWindows;
@@ -787,8 +585,8 @@ function requireWindows() {
787
585
  windows = isexe2;
788
586
  isexe2.sync = sync2;
789
587
  var fs9 = require$$0;
790
- function checkPathExt(path13, options) {
791
- var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
588
+ function checkPathExt2(path13, options2) {
589
+ var pathext = options2.pathExt !== void 0 ? options2.pathExt : process.env.PATHEXT;
792
590
  if (!pathext) {
793
591
  return true;
794
592
  }
@@ -804,19 +602,19 @@ function requireWindows() {
804
602
  }
805
603
  return false;
806
604
  }
807
- function checkStat(stat, path13, options) {
605
+ function checkStat2(stat, path13, options2) {
808
606
  if (!stat.isSymbolicLink() && !stat.isFile()) {
809
607
  return false;
810
608
  }
811
- return checkPathExt(path13, options);
609
+ return checkPathExt2(path13, options2);
812
610
  }
813
- function isexe2(path13, options, cb) {
611
+ function isexe2(path13, options2, cb) {
814
612
  fs9.stat(path13, function(er, stat) {
815
- cb(er, er ? false : checkStat(stat, path13, options));
613
+ cb(er, er ? false : checkStat2(stat, path13, options2));
816
614
  });
817
615
  }
818
- function sync2(path13, options) {
819
- return checkStat(fs9.statSync(path13), path13, options);
616
+ function sync2(path13, options2) {
617
+ return checkStat2(fs9.statSync(path13), path13, options2);
820
618
  }
821
619
  return windows;
822
620
  }
@@ -829,23 +627,23 @@ function requireMode() {
829
627
  mode = isexe2;
830
628
  isexe2.sync = sync2;
831
629
  var fs9 = require$$0;
832
- function isexe2(path13, options, cb) {
630
+ function isexe2(path13, options2, cb) {
833
631
  fs9.stat(path13, function(er, stat) {
834
- cb(er, er ? false : checkStat(stat, options));
632
+ cb(er, er ? false : checkStat2(stat, options2));
835
633
  });
836
634
  }
837
- function sync2(path13, options) {
838
- return checkStat(fs9.statSync(path13), options);
635
+ function sync2(path13, options2) {
636
+ return checkStat2(fs9.statSync(path13), options2);
839
637
  }
840
- function checkStat(stat, options) {
841
- return stat.isFile() && checkMode(stat, options);
638
+ function checkStat2(stat, options2) {
639
+ return stat.isFile() && checkMode2(stat, options2);
842
640
  }
843
- function checkMode(stat, options) {
641
+ function checkMode2(stat, options2) {
844
642
  var mod = stat.mode;
845
643
  var uid = stat.uid;
846
644
  var gid = stat.gid;
847
- var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
848
- var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
645
+ var myUid = options2.uid !== void 0 ? options2.uid : process.getuid && process.getuid();
646
+ var myGid = options2.gid !== void 0 ? options2.gid : process.getgid && process.getgid();
849
647
  var u = parseInt("100", 8);
850
648
  var g = parseInt("010", 8);
851
649
  var o = parseInt("001", 8);
@@ -861,19 +659,19 @@ if (process.platform === "win32" || commonjsGlobal.TESTING_WINDOWS) {
861
659
  } else {
862
660
  core = requireMode();
863
661
  }
864
- var isexe_1 = isexe$2;
865
- isexe$2.sync = sync;
866
- function isexe$2(path13, options, cb) {
867
- if (typeof options === "function") {
868
- cb = options;
869
- options = {};
662
+ var isexe_1 = isexe$4;
663
+ isexe$4.sync = sync$2;
664
+ function isexe$4(path13, options2, cb) {
665
+ if (typeof options2 === "function") {
666
+ cb = options2;
667
+ options2 = {};
870
668
  }
871
669
  if (!cb) {
872
670
  if (typeof Promise !== "function") {
873
671
  throw new TypeError("callback not provided");
874
672
  }
875
673
  return new Promise(function(resolve2, reject) {
876
- isexe$2(path13, options || {}, function(er, is) {
674
+ isexe$4(path13, options2 || {}, function(er, is) {
877
675
  if (er) {
878
676
  reject(er);
879
677
  } else {
@@ -882,9 +680,9 @@ function isexe$2(path13, options, cb) {
882
680
  });
883
681
  });
884
682
  }
885
- core(path13, options || {}, function(er, is) {
683
+ core(path13, options2 || {}, function(er, is) {
886
684
  if (er) {
887
- if (er.code === "EACCES" || options && options.ignoreErrors) {
685
+ if (er.code === "EACCES" || options2 && options2.ignoreErrors) {
888
686
  er = null;
889
687
  is = false;
890
688
  }
@@ -892,11 +690,11 @@ function isexe$2(path13, options, cb) {
892
690
  cb(er, is);
893
691
  });
894
692
  }
895
- function sync(path13, options) {
693
+ function sync$2(path13, options2) {
896
694
  try {
897
- return core.sync(path13, options || {});
695
+ return core.sync(path13, options2 || {});
898
696
  } catch (er) {
899
- if (options && options.ignoreErrors || er.code === "EACCES") {
697
+ if (options2 && options2.ignoreErrors || er.code === "EACCES") {
900
698
  return false;
901
699
  } else {
902
700
  throw er;
@@ -906,7 +704,7 @@ function sync(path13, options) {
906
704
  var isWindows$1 = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
907
705
  var path$2 = require$$0$1;
908
706
  var COLON = isWindows$1 ? ";" : ":";
909
- var isexe$1 = isexe_1;
707
+ var isexe$3 = isexe_1;
910
708
  var getNotFoundError$1 = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
911
709
  var getPathInfo$1 = (cmd, opt) => {
912
710
  const colon = opt.colon || COLON;
@@ -950,7 +748,7 @@ var which$3 = (cmd, opt, cb) => {
950
748
  if (ii === pathExt.length)
951
749
  return resolve2(step(i + 1));
952
750
  const ext = pathExt[ii];
953
- isexe$1(p + ext, { pathExt: pathExtExe }, (er, is) => {
751
+ isexe$3(p + ext, { pathExt: pathExtExe }, (er, is) => {
954
752
  if (!er && is) {
955
753
  if (opt.all)
956
754
  found.push(p + ext);
@@ -974,7 +772,7 @@ var whichSync$1 = (cmd, opt) => {
974
772
  for (let j = 0; j < pathExt.length; j++) {
975
773
  const cur = p + pathExt[j];
976
774
  try {
977
- const is = isexe$1.sync(cur, { pathExt: pathExtExe });
775
+ const is = isexe$3.sync(cur, { pathExt: pathExtExe });
978
776
  if (is) {
979
777
  if (opt.all)
980
778
  found.push(cur);
@@ -994,9 +792,9 @@ var whichSync$1 = (cmd, opt) => {
994
792
  var which_1 = which$3;
995
793
  which$3.sync = whichSync$1;
996
794
  var pathKey$2 = { exports: {} };
997
- var pathKey$1 = (options = {}) => {
998
- const environment = options.env || process.env;
999
- const platform = options.platform || process.platform;
795
+ var pathKey$1 = (options2 = {}) => {
796
+ const environment = options2.env || process.env;
797
+ const platform = options2.platform || process.platform;
1000
798
  if (platform !== "win32") {
1001
799
  return "PATH";
1002
800
  }
@@ -1092,7 +890,7 @@ var path7 = require$$0$1;
1092
890
  var resolveCommand = resolveCommand_1;
1093
891
  var escape = _escape;
1094
892
  var readShebang = readShebang_1;
1095
- var isWin$2 = process.platform === "win32";
893
+ var isWin$1 = process.platform === "win32";
1096
894
  var isExecutableRegExp = /\.(?:com|exe)$/i;
1097
895
  var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
1098
896
  function detectShebang(parsed) {
@@ -1106,7 +904,7 @@ function detectShebang(parsed) {
1106
904
  return parsed.file;
1107
905
  }
1108
906
  function parseNonShell(parsed) {
1109
- if (!isWin$2) {
907
+ if (!isWin$1) {
1110
908
  return parsed;
1111
909
  }
1112
910
  const commandFile = detectShebang(parsed);
@@ -1123,27 +921,27 @@ function parseNonShell(parsed) {
1123
921
  }
1124
922
  return parsed;
1125
923
  }
1126
- function parse$1(command, args, options) {
924
+ function parse$1(command, args, options2) {
1127
925
  if (args && !Array.isArray(args)) {
1128
- options = args;
926
+ options2 = args;
1129
927
  args = null;
1130
928
  }
1131
929
  args = args ? args.slice(0) : [];
1132
- options = Object.assign({}, options);
930
+ options2 = Object.assign({}, options2);
1133
931
  const parsed = {
1134
932
  command,
1135
933
  args,
1136
- options,
934
+ options: options2,
1137
935
  file: void 0,
1138
936
  original: {
1139
937
  command,
1140
938
  args
1141
939
  }
1142
940
  };
1143
- return options.shell ? parsed : parseNonShell(parsed);
941
+ return options2.shell ? parsed : parseNonShell(parsed);
1144
942
  }
1145
943
  var parse_1 = parse$1;
1146
- var isWin$1 = process.platform === "win32";
944
+ var isWin = process.platform === "win32";
1147
945
  function notFoundError(original, syscall) {
1148
946
  return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
1149
947
  code: "ENOENT",
@@ -1154,7 +952,7 @@ function notFoundError(original, syscall) {
1154
952
  });
1155
953
  }
1156
954
  function hookChildProcess(cp2, parsed) {
1157
- if (!isWin$1) {
955
+ if (!isWin) {
1158
956
  return;
1159
957
  }
1160
958
  const originalEmit = cp2.emit;
@@ -1169,13 +967,13 @@ function hookChildProcess(cp2, parsed) {
1169
967
  };
1170
968
  }
1171
969
  function verifyENOENT(status, parsed) {
1172
- if (isWin$1 && status === 1 && !parsed.file) {
970
+ if (isWin && status === 1 && !parsed.file) {
1173
971
  return notFoundError(parsed.original, "spawn");
1174
972
  }
1175
973
  return null;
1176
974
  }
1177
975
  function verifyENOENTSync(status, parsed) {
1178
- if (isWin$1 && status === 1 && !parsed.file) {
976
+ if (isWin && status === 1 && !parsed.file) {
1179
977
  return notFoundError(parsed.original, "spawnSync");
1180
978
  }
1181
979
  return null;
@@ -1189,14 +987,14 @@ var enoent$1 = {
1189
987
  var cp = require$$0$2;
1190
988
  var parse = parse_1;
1191
989
  var enoent = enoent$1;
1192
- function spawn(command, args, options) {
1193
- const parsed = parse(command, args, options);
990
+ function spawn(command, args, options2) {
991
+ const parsed = parse(command, args, options2);
1194
992
  const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
1195
993
  enoent.hookChildProcess(spawned, parsed);
1196
994
  return spawned;
1197
995
  }
1198
- function spawnSync(command, args, options) {
1199
- const parsed = parse(command, args, options);
996
+ function spawnSync(command, args, options2) {
997
+ const parsed = parse(command, args, options2);
1200
998
  const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
1201
999
  result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
1202
1000
  return result;
@@ -1219,22 +1017,22 @@ function stripFinalNewline(input) {
1219
1017
  }
1220
1018
  return input;
1221
1019
  }
1222
- function pathKey(options = {}) {
1020
+ function pathKey(options2 = {}) {
1223
1021
  const {
1224
1022
  env: env2 = process.env,
1225
1023
  platform = process.platform
1226
- } = options;
1024
+ } = options2;
1227
1025
  if (platform !== "win32") {
1228
1026
  return "PATH";
1229
1027
  }
1230
1028
  return Object.keys(env2).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
1231
1029
  }
1232
- function npmRunPath(options = {}) {
1030
+ function npmRunPath(options2 = {}) {
1233
1031
  const {
1234
1032
  cwd = process$2.cwd(),
1235
1033
  path: path_ = process$2.env[pathKey()],
1236
1034
  execPath = process$2.execPath
1237
- } = options;
1035
+ } = options2;
1238
1036
  let previous;
1239
1037
  const cwdString = cwd instanceof URL ? url.fileURLToPath(cwd) : cwd;
1240
1038
  let cwdPath = path$3.resolve(cwdString);
@@ -1247,11 +1045,11 @@ function npmRunPath(options = {}) {
1247
1045
  result.push(path$3.resolve(cwdString, execPath, ".."));
1248
1046
  return [...result, path_].join(path$3.delimiter);
1249
1047
  }
1250
- function npmRunPathEnv({ env: env2 = process$2.env, ...options } = {}) {
1048
+ function npmRunPathEnv({ env: env2 = process$2.env, ...options2 } = {}) {
1251
1049
  env2 = { ...env2 };
1252
1050
  const path13 = pathKey({ env: env2 });
1253
- options.path = env2[path13];
1254
- env2[path13] = npmRunPath(options);
1051
+ options2.path = env2[path13];
1052
+ env2[path13] = npmRunPath(options2);
1255
1053
  return env2;
1256
1054
  }
1257
1055
  var copyProperty = (to, from, property, ignoreNonConfigurable) => {
@@ -1298,7 +1096,7 @@ function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
1298
1096
  return to;
1299
1097
  }
1300
1098
  var calledFunctions = /* @__PURE__ */ new WeakMap();
1301
- var onetime = (function_, options = {}) => {
1099
+ var onetime = (function_, options2 = {}) => {
1302
1100
  if (typeof function_ !== "function") {
1303
1101
  throw new TypeError("Expected a function");
1304
1102
  }
@@ -1310,7 +1108,7 @@ var onetime = (function_, options = {}) => {
1310
1108
  if (callCount === 1) {
1311
1109
  returnValue = function_.apply(this, arguments_);
1312
1110
  function_ = null;
1313
- } else if (options.throw === true) {
1111
+ } else if (options2.throw === true) {
1314
1112
  throw new Error(`Function \`${functionName}\` can only be called once`);
1315
1113
  }
1316
1114
  return returnValue;
@@ -1611,8 +1409,8 @@ var SIGNALS = [
1611
1409
  ];
1612
1410
  var getSignals = () => {
1613
1411
  const realtimeSignals = getRealtimeSignals();
1614
- const signals = [...SIGNALS, ...realtimeSignals].map(normalizeSignal);
1615
- return signals;
1412
+ const signals2 = [...SIGNALS, ...realtimeSignals].map(normalizeSignal);
1413
+ return signals2;
1616
1414
  };
1617
1415
  var normalizeSignal = ({
1618
1416
  name,
@@ -1630,8 +1428,8 @@ var normalizeSignal = ({
1630
1428
  return { name, number: number2, description, supported, action: action2, forced, standard };
1631
1429
  };
1632
1430
  var getSignalsByName = () => {
1633
- const signals = getSignals();
1634
- return Object.fromEntries(signals.map(getSignalByName));
1431
+ const signals2 = getSignals();
1432
+ return Object.fromEntries(signals2.map(getSignalByName));
1635
1433
  };
1636
1434
  var getSignalByName = ({
1637
1435
  name,
@@ -1644,13 +1442,16 @@ var getSignalByName = ({
1644
1442
  }) => [name, { name, number: number2, description, supported, action: action2, forced, standard }];
1645
1443
  var signalsByName = getSignalsByName();
1646
1444
  var getSignalsByNumber = () => {
1647
- const signals = getSignals();
1445
+ const signals2 = getSignals();
1648
1446
  const length = SIGRTMAX + 1;
1649
- const signalsA = Array.from({ length }, (value, number2) => getSignalByNumber(number2, signals));
1447
+ const signalsA = Array.from(
1448
+ { length },
1449
+ (value, number2) => getSignalByNumber(number2, signals2)
1450
+ );
1650
1451
  return Object.assign({}, ...signalsA);
1651
1452
  };
1652
- var getSignalByNumber = (number2, signals) => {
1653
- const signal = findSignalByNumber(number2, signals);
1453
+ var getSignalByNumber = (number2, signals2) => {
1454
+ const signal = findSignalByNumber(number2, signals2);
1654
1455
  if (signal === void 0) {
1655
1456
  return {};
1656
1457
  }
@@ -1667,12 +1468,12 @@ var getSignalByNumber = (number2, signals) => {
1667
1468
  }
1668
1469
  };
1669
1470
  };
1670
- var findSignalByNumber = (number2, signals) => {
1671
- const signal = signals.find(({ name }) => constants.signals[name] === number2);
1471
+ var findSignalByNumber = (number2, signals2) => {
1472
+ const signal = signals2.find(({ name }) => constants.signals[name] === number2);
1672
1473
  if (signal !== void 0) {
1673
1474
  return signal;
1674
1475
  }
1675
- return signals.find((signalA) => signalA.number === number2);
1476
+ return signals2.find((signalA) => signalA.number === number2);
1676
1477
  };
1677
1478
  getSignalsByNumber();
1678
1479
  var getErrorPrefix = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled }) => {
@@ -1705,7 +1506,7 @@ var makeError = ({
1705
1506
  timedOut,
1706
1507
  isCanceled,
1707
1508
  killed,
1708
- parsed: { options: { timeout } }
1509
+ parsed: { options: { timeout, cwd = process$2.cwd() } }
1709
1510
  }) => {
1710
1511
  exitCode = exitCode === null ? void 0 : exitCode;
1711
1512
  signal = signal === null ? void 0 : signal;
@@ -1731,6 +1532,7 @@ ${error.message}` : execaMessage;
1731
1532
  error.signalDescription = signalDescription;
1732
1533
  error.stdout = stdout;
1733
1534
  error.stderr = stderr;
1535
+ error.cwd = cwd;
1734
1536
  if (all !== void 0) {
1735
1537
  error.all = all;
1736
1538
  }
@@ -1744,16 +1546,16 @@ ${error.message}` : execaMessage;
1744
1546
  return error;
1745
1547
  };
1746
1548
  var aliases = ["stdin", "stdout", "stderr"];
1747
- var hasAlias = (options) => aliases.some((alias) => options[alias] !== void 0);
1748
- var normalizeStdio = (options) => {
1749
- if (!options) {
1549
+ var hasAlias = (options2) => aliases.some((alias) => options2[alias] !== void 0);
1550
+ var normalizeStdio = (options2) => {
1551
+ if (!options2) {
1750
1552
  return;
1751
1553
  }
1752
- const { stdio } = options;
1554
+ const { stdio } = options2;
1753
1555
  if (stdio === void 0) {
1754
- return aliases.map((alias) => options[alias]);
1556
+ return aliases.map((alias) => options2[alias]);
1755
1557
  }
1756
- if (hasAlias(options)) {
1558
+ if (hasAlias(options2)) {
1757
1559
  throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map((alias) => `\`${alias}\``).join(", ")}`);
1758
1560
  }
1759
1561
  if (typeof stdio === "string") {
@@ -1765,214 +1567,264 @@ var normalizeStdio = (options) => {
1765
1567
  const length = Math.max(stdio.length, aliases.length);
1766
1568
  return Array.from({ length }, (value, index) => stdio[index]);
1767
1569
  };
1768
- var signalExit = { exports: {} };
1769
- var signals$1 = { exports: {} };
1770
- var hasRequiredSignals;
1771
- function requireSignals() {
1772
- if (hasRequiredSignals)
1773
- return signals$1.exports;
1774
- hasRequiredSignals = 1;
1775
- (function(module) {
1776
- module.exports = [
1777
- "SIGABRT",
1778
- "SIGALRM",
1779
- "SIGHUP",
1780
- "SIGINT",
1781
- "SIGTERM"
1782
- ];
1783
- if (process.platform !== "win32") {
1784
- module.exports.push(
1785
- "SIGVTALRM",
1786
- "SIGXCPU",
1787
- "SIGXFSZ",
1788
- "SIGUSR2",
1789
- "SIGTRAP",
1790
- "SIGSYS",
1791
- "SIGQUIT",
1792
- "SIGIOT"
1793
- // should detect profiler and enable/disable accordingly.
1794
- // see #21
1795
- // 'SIGPROF'
1796
- );
1570
+ var signals = [];
1571
+ signals.push("SIGHUP", "SIGINT", "SIGTERM");
1572
+ if (process.platform !== "win32") {
1573
+ signals.push(
1574
+ "SIGALRM",
1575
+ "SIGABRT",
1576
+ "SIGVTALRM",
1577
+ "SIGXCPU",
1578
+ "SIGXFSZ",
1579
+ "SIGUSR2",
1580
+ "SIGTRAP",
1581
+ "SIGSYS",
1582
+ "SIGQUIT",
1583
+ "SIGIOT"
1584
+ // should detect profiler and enable/disable accordingly.
1585
+ // see #21
1586
+ // 'SIGPROF'
1587
+ );
1588
+ }
1589
+ if (process.platform === "linux") {
1590
+ signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
1591
+ }
1592
+ var processOk = (process2) => !!process2 && typeof process2 === "object" && typeof process2.removeListener === "function" && typeof process2.emit === "function" && typeof process2.reallyExit === "function" && typeof process2.listeners === "function" && typeof process2.kill === "function" && typeof process2.pid === "number" && typeof process2.on === "function";
1593
+ var kExitEmitter = Symbol.for("signal-exit emitter");
1594
+ var global$1 = globalThis;
1595
+ var ObjectDefineProperty = Object.defineProperty.bind(Object);
1596
+ var Emitter = class {
1597
+ emitted = {
1598
+ afterExit: false,
1599
+ exit: false
1600
+ };
1601
+ listeners = {
1602
+ afterExit: [],
1603
+ exit: []
1604
+ };
1605
+ count = 0;
1606
+ id = Math.random();
1607
+ constructor() {
1608
+ if (global$1[kExitEmitter]) {
1609
+ return global$1[kExitEmitter];
1610
+ }
1611
+ ObjectDefineProperty(global$1, kExitEmitter, {
1612
+ value: this,
1613
+ writable: false,
1614
+ enumerable: false,
1615
+ configurable: false
1616
+ });
1617
+ }
1618
+ on(ev, fn) {
1619
+ this.listeners[ev].push(fn);
1620
+ }
1621
+ removeListener(ev, fn) {
1622
+ const list = this.listeners[ev];
1623
+ const i = list.indexOf(fn);
1624
+ if (i === -1) {
1625
+ return;
1797
1626
  }
1798
- if (process.platform === "linux") {
1799
- module.exports.push(
1800
- "SIGIO",
1801
- "SIGPOLL",
1802
- "SIGPWR",
1803
- "SIGSTKFLT",
1804
- "SIGUNUSED"
1805
- );
1627
+ if (i === 0 && list.length === 1) {
1628
+ list.length = 0;
1629
+ } else {
1630
+ list.splice(i, 1);
1806
1631
  }
1807
- })(signals$1);
1808
- return signals$1.exports;
1809
- }
1810
- var process$1 = commonjsGlobal.process;
1811
- var processOk = function(process2) {
1812
- return process2 && typeof process2 === "object" && typeof process2.removeListener === "function" && typeof process2.emit === "function" && typeof process2.reallyExit === "function" && typeof process2.listeners === "function" && typeof process2.kill === "function" && typeof process2.pid === "number" && typeof process2.on === "function";
1632
+ }
1633
+ emit(ev, code, signal) {
1634
+ if (this.emitted[ev]) {
1635
+ return false;
1636
+ }
1637
+ this.emitted[ev] = true;
1638
+ let ret = false;
1639
+ for (const fn of this.listeners[ev]) {
1640
+ ret = fn(code, signal) === true || ret;
1641
+ }
1642
+ if (ev === "exit") {
1643
+ ret = this.emit("afterExit", code, signal) || ret;
1644
+ }
1645
+ return ret;
1646
+ }
1813
1647
  };
1814
- if (!processOk(process$1)) {
1815
- signalExit.exports = function() {
1816
- return function() {
1817
- };
1648
+ var SignalExitBase = class {
1649
+ };
1650
+ var signalExitWrap = (handler) => {
1651
+ return {
1652
+ onExit(cb, opts) {
1653
+ return handler.onExit(cb, opts);
1654
+ },
1655
+ load() {
1656
+ return handler.load();
1657
+ },
1658
+ unload() {
1659
+ return handler.unload();
1660
+ }
1818
1661
  };
1819
- } else {
1820
- assert = require$$0$3;
1821
- signals = requireSignals();
1822
- isWin = /^win/i.test(process$1.platform);
1823
- EE = require$$2;
1824
- if (typeof EE !== "function") {
1825
- EE = EE.EventEmitter;
1826
- }
1827
- if (process$1.__signal_exit_emitter__) {
1828
- emitter = process$1.__signal_exit_emitter__;
1829
- } else {
1830
- emitter = process$1.__signal_exit_emitter__ = new EE();
1831
- emitter.count = 0;
1832
- emitter.emitted = {};
1662
+ };
1663
+ var SignalExitFallback = class extends SignalExitBase {
1664
+ onExit() {
1665
+ return () => {
1666
+ };
1667
+ }
1668
+ load() {
1833
1669
  }
1834
- if (!emitter.infinite) {
1835
- emitter.setMaxListeners(Infinity);
1836
- emitter.infinite = true;
1670
+ unload() {
1837
1671
  }
1838
- signalExit.exports = function(cb, opts) {
1839
- if (!processOk(commonjsGlobal.process)) {
1840
- return function() {
1672
+ };
1673
+ var SignalExit = class extends SignalExitBase {
1674
+ // "SIGHUP" throws an `ENOSYS` error on Windows,
1675
+ // so use a supported signal instead
1676
+ /* c8 ignore start */
1677
+ #hupSig = process$1.platform === "win32" ? "SIGINT" : "SIGHUP";
1678
+ /* c8 ignore stop */
1679
+ #emitter = new Emitter();
1680
+ #process;
1681
+ #originalProcessEmit;
1682
+ #originalProcessReallyExit;
1683
+ #sigListeners = {};
1684
+ #loaded = false;
1685
+ constructor(process2) {
1686
+ super();
1687
+ this.#process = process2;
1688
+ this.#sigListeners = {};
1689
+ for (const sig of signals) {
1690
+ this.#sigListeners[sig] = () => {
1691
+ const listeners = this.#process.listeners(sig);
1692
+ let { count } = this.#emitter;
1693
+ const p = process2;
1694
+ if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
1695
+ count += p.__signal_exit_emitter__.count;
1696
+ }
1697
+ if (listeners.length === count) {
1698
+ this.unload();
1699
+ const ret = this.#emitter.emit("exit", null, sig);
1700
+ const s = sig === "SIGHUP" ? this.#hupSig : sig;
1701
+ if (!ret)
1702
+ process2.kill(process2.pid, s);
1703
+ }
1841
1704
  };
1842
1705
  }
1843
- assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
1844
- if (loaded === false) {
1845
- load();
1706
+ this.#originalProcessReallyExit = process2.reallyExit;
1707
+ this.#originalProcessEmit = process2.emit;
1708
+ }
1709
+ onExit(cb, opts) {
1710
+ if (!processOk(this.#process)) {
1711
+ return () => {
1712
+ };
1846
1713
  }
1847
- var ev = "exit";
1848
- if (opts && opts.alwaysLast) {
1849
- ev = "afterexit";
1714
+ if (this.#loaded === false) {
1715
+ this.load();
1850
1716
  }
1851
- var remove2 = function() {
1852
- emitter.removeListener(ev, cb);
1853
- if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
1854
- unload();
1717
+ const ev = opts?.alwaysLast ? "afterExit" : "exit";
1718
+ this.#emitter.on(ev, cb);
1719
+ return () => {
1720
+ this.#emitter.removeListener(ev, cb);
1721
+ if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
1722
+ this.unload();
1855
1723
  }
1856
1724
  };
1857
- emitter.on(ev, cb);
1858
- return remove2;
1859
- };
1860
- unload = function unload2() {
1861
- if (!loaded || !processOk(commonjsGlobal.process)) {
1725
+ }
1726
+ load() {
1727
+ if (this.#loaded) {
1862
1728
  return;
1863
1729
  }
1864
- loaded = false;
1865
- signals.forEach(function(sig) {
1730
+ this.#loaded = true;
1731
+ this.#emitter.count += 1;
1732
+ for (const sig of signals) {
1866
1733
  try {
1867
- process$1.removeListener(sig, sigListeners[sig]);
1868
- } catch (er) {
1734
+ const fn = this.#sigListeners[sig];
1735
+ if (fn)
1736
+ this.#process.on(sig, fn);
1737
+ } catch (_) {
1869
1738
  }
1870
- });
1871
- process$1.emit = originalProcessEmit;
1872
- process$1.reallyExit = originalProcessReallyExit;
1873
- emitter.count -= 1;
1874
- };
1875
- signalExit.exports.unload = unload;
1876
- emit = function emit2(event, code, signal) {
1877
- if (emitter.emitted[event]) {
1878
- return;
1879
1739
  }
1880
- emitter.emitted[event] = true;
1881
- emitter.emit(event, code, signal);
1882
- };
1883
- sigListeners = {};
1884
- signals.forEach(function(sig) {
1885
- sigListeners[sig] = function listener() {
1886
- if (!processOk(commonjsGlobal.process)) {
1887
- return;
1888
- }
1889
- var listeners = process$1.listeners(sig);
1890
- if (listeners.length === emitter.count) {
1891
- unload();
1892
- emit("exit", null, sig);
1893
- emit("afterexit", null, sig);
1894
- if (isWin && sig === "SIGHUP") {
1895
- sig = "SIGINT";
1896
- }
1897
- process$1.kill(process$1.pid, sig);
1898
- }
1740
+ this.#process.emit = (ev, ...a) => {
1741
+ return this.#processEmit(ev, ...a);
1899
1742
  };
1900
- });
1901
- signalExit.exports.signals = function() {
1902
- return signals;
1903
- };
1904
- loaded = false;
1905
- load = function load2() {
1906
- if (loaded || !processOk(commonjsGlobal.process)) {
1743
+ this.#process.reallyExit = (code) => {
1744
+ return this.#processReallyExit(code);
1745
+ };
1746
+ }
1747
+ unload() {
1748
+ if (!this.#loaded) {
1907
1749
  return;
1908
1750
  }
1909
- loaded = true;
1910
- emitter.count += 1;
1911
- signals = signals.filter(function(sig) {
1751
+ this.#loaded = false;
1752
+ signals.forEach((sig) => {
1753
+ const listener = this.#sigListeners[sig];
1754
+ if (!listener) {
1755
+ throw new Error("Listener not defined for signal: " + sig);
1756
+ }
1912
1757
  try {
1913
- process$1.on(sig, sigListeners[sig]);
1914
- return true;
1915
- } catch (er) {
1916
- return false;
1758
+ this.#process.removeListener(sig, listener);
1759
+ } catch (_) {
1917
1760
  }
1918
1761
  });
1919
- process$1.emit = processEmit;
1920
- process$1.reallyExit = processReallyExit;
1921
- };
1922
- signalExit.exports.load = load;
1923
- originalProcessReallyExit = process$1.reallyExit;
1924
- processReallyExit = function processReallyExit2(code) {
1925
- if (!processOk(commonjsGlobal.process)) {
1926
- return;
1927
- }
1928
- process$1.exitCode = code || /* istanbul ignore next */
1929
- 0;
1930
- emit("exit", process$1.exitCode, null);
1931
- emit("afterexit", process$1.exitCode, null);
1932
- originalProcessReallyExit.call(process$1, process$1.exitCode);
1933
- };
1934
- originalProcessEmit = process$1.emit;
1935
- processEmit = function processEmit2(ev, arg) {
1936
- if (ev === "exit" && processOk(commonjsGlobal.process)) {
1937
- if (arg !== void 0) {
1938
- process$1.exitCode = arg;
1762
+ this.#process.emit = this.#originalProcessEmit;
1763
+ this.#process.reallyExit = this.#originalProcessReallyExit;
1764
+ this.#emitter.count -= 1;
1765
+ }
1766
+ #processReallyExit(code) {
1767
+ if (!processOk(this.#process)) {
1768
+ return 0;
1769
+ }
1770
+ this.#process.exitCode = code || 0;
1771
+ this.#emitter.emit("exit", this.#process.exitCode, null);
1772
+ return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
1773
+ }
1774
+ #processEmit(ev, ...args) {
1775
+ const og = this.#originalProcessEmit;
1776
+ if (ev === "exit" && processOk(this.#process)) {
1777
+ if (typeof args[0] === "number") {
1778
+ this.#process.exitCode = args[0];
1939
1779
  }
1940
- var ret = originalProcessEmit.apply(this, arguments);
1941
- emit("exit", process$1.exitCode, null);
1942
- emit("afterexit", process$1.exitCode, null);
1780
+ const ret = og.call(this.#process, ev, ...args);
1781
+ this.#emitter.emit("exit", this.#process.exitCode, null);
1943
1782
  return ret;
1944
1783
  } else {
1945
- return originalProcessEmit.apply(this, arguments);
1946
- }
1947
- };
1948
- }
1949
- var assert;
1950
- var signals;
1951
- var isWin;
1952
- var EE;
1953
- var emitter;
1954
- var unload;
1955
- var emit;
1956
- var sigListeners;
1957
- var loaded;
1958
- var load;
1959
- var originalProcessReallyExit;
1960
- var processReallyExit;
1961
- var originalProcessEmit;
1962
- var processEmit;
1963
- var signalExitExports = signalExit.exports;
1964
- var onExit = /* @__PURE__ */ getDefaultExportFromCjs(signalExitExports);
1784
+ return og.call(this.#process, ev, ...args);
1785
+ }
1786
+ }
1787
+ };
1788
+ var process$1 = globalThis.process;
1789
+ var {
1790
+ /**
1791
+ * Called when the process is exiting, whether via signal, explicit
1792
+ * exit, or running out of stuff to do.
1793
+ *
1794
+ * If the global process object is not suitable for instrumentation,
1795
+ * then this will be a no-op.
1796
+ *
1797
+ * Returns a function that may be used to unload signal-exit.
1798
+ */
1799
+ onExit,
1800
+ /**
1801
+ * Load the listeners. Likely you never need to call this, unless
1802
+ * doing a rather deep integration with signal-exit functionality.
1803
+ * Mostly exposed for the benefit of testing.
1804
+ *
1805
+ * @internal
1806
+ */
1807
+ load,
1808
+ /**
1809
+ * Unload the listeners. Likely you never need to call this, unless
1810
+ * doing a rather deep integration with signal-exit functionality.
1811
+ * Mostly exposed for the benefit of testing.
1812
+ *
1813
+ * @internal
1814
+ */
1815
+ unload
1816
+ } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
1965
1817
  var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
1966
- var spawnedKill = (kill, signal = "SIGTERM", options = {}) => {
1818
+ var spawnedKill = (kill, signal = "SIGTERM", options2 = {}) => {
1967
1819
  const killResult = kill(signal);
1968
- setKillTimeout(kill, signal, options, killResult);
1820
+ setKillTimeout(kill, signal, options2, killResult);
1969
1821
  return killResult;
1970
1822
  };
1971
- var setKillTimeout = (kill, signal, options, killResult) => {
1972
- if (!shouldForceKill(signal, options, killResult)) {
1823
+ var setKillTimeout = (kill, signal, options2, killResult) => {
1824
+ if (!shouldForceKill(signal, options2, killResult)) {
1973
1825
  return;
1974
1826
  }
1975
- const timeout = getForceKillAfterTimeout(options);
1827
+ const timeout = getForceKillAfterTimeout(options2);
1976
1828
  const t = setTimeout(() => {
1977
1829
  kill("SIGKILL");
1978
1830
  }, timeout);
@@ -2032,11 +1884,11 @@ var setExitHandler = async (spawned, { cleanup, detached }, timedPromise) => {
2032
1884
  removeExitHandler();
2033
1885
  });
2034
1886
  };
2035
- function isStream(stream2) {
2036
- return stream2 !== null && typeof stream2 === "object" && typeof stream2.pipe === "function";
1887
+ function isStream(stream) {
1888
+ return stream !== null && typeof stream === "object" && typeof stream.pipe === "function";
2037
1889
  }
2038
- function isWritableStream(stream2) {
2039
- return isStream(stream2) && stream2.writable !== false && typeof stream2._write === "function" && typeof stream2._writableState === "object";
1890
+ function isWritableStream(stream) {
1891
+ return isStream(stream) && stream.writable !== false && typeof stream._write === "function" && typeof stream._writableState === "object";
2040
1892
  }
2041
1893
  var isExecaChildProcess = (target) => target instanceof ChildProcess && typeof target.then === "function";
2042
1894
  var pipeToTarget = (spawned, streamName, target) => {
@@ -2068,96 +1920,179 @@ var addPipeMethods = (spawned) => {
2068
1920
  spawned.pipeAll = pipeToTarget.bind(void 0, spawned, "all");
2069
1921
  }
2070
1922
  };
2071
- var getStream$2 = { exports: {} };
2072
- var { PassThrough: PassThroughStream } = require$$0$4;
2073
- var bufferStream$1 = (options) => {
2074
- options = { ...options };
2075
- const { array: array2 } = options;
2076
- let { encoding } = options;
2077
- const isBuffer = encoding === "buffer";
2078
- let objectMode = false;
2079
- if (array2) {
2080
- objectMode = !(encoding || isBuffer);
2081
- } else {
2082
- encoding = encoding || "utf8";
1923
+ var getStreamContents = async (stream, { init: init3, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, finalize }, { maxBuffer = Number.POSITIVE_INFINITY } = {}) => {
1924
+ if (!isAsyncIterable(stream)) {
1925
+ throw new Error("The first argument must be a Readable, a ReadableStream, or an async iterable.");
2083
1926
  }
2084
- if (isBuffer) {
2085
- encoding = null;
1927
+ const state = init3();
1928
+ state.length = 0;
1929
+ try {
1930
+ for await (const chunk of stream) {
1931
+ const chunkType = getChunkType(chunk);
1932
+ const convertedChunk = convertChunk[chunkType](chunk, state);
1933
+ appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
1934
+ }
1935
+ appendFinalChunk({ state, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer });
1936
+ return finalize(state);
1937
+ } catch (error) {
1938
+ error.bufferedData = finalize(state);
1939
+ throw error;
2086
1940
  }
2087
- const stream2 = new PassThroughStream({ objectMode });
2088
- if (encoding) {
2089
- stream2.setEncoding(encoding);
1941
+ };
1942
+ var appendFinalChunk = ({ state, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer }) => {
1943
+ const convertedChunk = getFinalChunk(state);
1944
+ if (convertedChunk !== void 0) {
1945
+ appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
2090
1946
  }
2091
- let length = 0;
2092
- const chunks = [];
2093
- stream2.on("data", (chunk) => {
2094
- chunks.push(chunk);
2095
- if (objectMode) {
2096
- length = chunks.length;
2097
- } else {
2098
- length += chunk.length;
2099
- }
2100
- });
2101
- stream2.getBufferedValue = () => {
2102
- if (array2) {
2103
- return chunks;
2104
- }
2105
- return isBuffer ? Buffer.concat(chunks, length) : chunks.join("");
2106
- };
2107
- stream2.getBufferedLength = () => length;
2108
- return stream2;
2109
- };
2110
- var { constants: BufferConstants } = require$$0$5;
2111
- var stream = require$$0$4;
2112
- var { promisify } = require$$2$1;
2113
- var bufferStream = bufferStream$1;
2114
- var streamPipelinePromisified = promisify(stream.pipeline);
1947
+ };
1948
+ var appendChunk = ({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer }) => {
1949
+ const chunkSize = getSize(convertedChunk);
1950
+ const newLength = state.length + chunkSize;
1951
+ if (newLength <= maxBuffer) {
1952
+ addNewChunk(convertedChunk, state, addChunk, newLength);
1953
+ return;
1954
+ }
1955
+ const truncatedChunk = truncateChunk(convertedChunk, maxBuffer - state.length);
1956
+ if (truncatedChunk !== void 0) {
1957
+ addNewChunk(truncatedChunk, state, addChunk, maxBuffer);
1958
+ }
1959
+ throw new MaxBufferError();
1960
+ };
1961
+ var addNewChunk = (convertedChunk, state, addChunk, newLength) => {
1962
+ state.contents = addChunk(convertedChunk, state, newLength);
1963
+ state.length = newLength;
1964
+ };
1965
+ var isAsyncIterable = (stream) => typeof stream === "object" && stream !== null && typeof stream[Symbol.asyncIterator] === "function";
1966
+ var getChunkType = (chunk) => {
1967
+ const typeOfChunk = typeof chunk;
1968
+ if (typeOfChunk === "string") {
1969
+ return "string";
1970
+ }
1971
+ if (typeOfChunk !== "object" || chunk === null) {
1972
+ return "others";
1973
+ }
1974
+ if (globalThis.Buffer?.isBuffer(chunk)) {
1975
+ return "buffer";
1976
+ }
1977
+ const prototypeName = objectToString.call(chunk);
1978
+ if (prototypeName === "[object ArrayBuffer]") {
1979
+ return "arrayBuffer";
1980
+ }
1981
+ if (prototypeName === "[object DataView]") {
1982
+ return "dataView";
1983
+ }
1984
+ if (Number.isInteger(chunk.byteLength) && Number.isInteger(chunk.byteOffset) && objectToString.call(chunk.buffer) === "[object ArrayBuffer]") {
1985
+ return "typedArray";
1986
+ }
1987
+ return "others";
1988
+ };
1989
+ var { toString: objectToString } = Object.prototype;
2115
1990
  var MaxBufferError = class extends Error {
1991
+ name = "MaxBufferError";
2116
1992
  constructor() {
2117
1993
  super("maxBuffer exceeded");
2118
- this.name = "MaxBufferError";
2119
1994
  }
2120
1995
  };
2121
- async function getStream(inputStream, options) {
2122
- if (!inputStream) {
2123
- throw new Error("Expected a stream");
1996
+ var identity = (value) => value;
1997
+ var noop$1 = () => void 0;
1998
+ var getContentsProp = ({ contents }) => contents;
1999
+ var throwObjectStream = (chunk) => {
2000
+ throw new Error(`Streams in object mode are not supported: ${String(chunk)}`);
2001
+ };
2002
+ var getLengthProp = (convertedChunk) => convertedChunk.length;
2003
+ async function getStreamAsArrayBuffer(stream, options2) {
2004
+ return getStreamContents(stream, arrayBufferMethods, options2);
2005
+ }
2006
+ var initArrayBuffer = () => ({ contents: new ArrayBuffer(0) });
2007
+ var useTextEncoder = (chunk) => textEncoder.encode(chunk);
2008
+ var textEncoder = new TextEncoder();
2009
+ var useUint8Array = (chunk) => new Uint8Array(chunk);
2010
+ var useUint8ArrayWithOffset = (chunk) => new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
2011
+ var truncateArrayBufferChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
2012
+ var addArrayBufferChunk = (convertedChunk, { contents, length: previousLength }, length) => {
2013
+ const newContents = hasArrayBufferResize() ? resizeArrayBuffer(contents, length) : resizeArrayBufferSlow(contents, length);
2014
+ new Uint8Array(newContents).set(convertedChunk, previousLength);
2015
+ return newContents;
2016
+ };
2017
+ var resizeArrayBufferSlow = (contents, length) => {
2018
+ if (length <= contents.byteLength) {
2019
+ return contents;
2020
+ }
2021
+ const arrayBuffer = new ArrayBuffer(getNewContentsLength(length));
2022
+ new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
2023
+ return arrayBuffer;
2024
+ };
2025
+ var resizeArrayBuffer = (contents, length) => {
2026
+ if (length <= contents.maxByteLength) {
2027
+ contents.resize(length);
2028
+ return contents;
2029
+ }
2030
+ const arrayBuffer = new ArrayBuffer(length, { maxByteLength: getNewContentsLength(length) });
2031
+ new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
2032
+ return arrayBuffer;
2033
+ };
2034
+ var getNewContentsLength = (length) => SCALE_FACTOR ** Math.ceil(Math.log(length) / Math.log(SCALE_FACTOR));
2035
+ var SCALE_FACTOR = 2;
2036
+ var finalizeArrayBuffer = ({ contents, length }) => hasArrayBufferResize() ? contents : contents.slice(0, length);
2037
+ var hasArrayBufferResize = () => "resize" in ArrayBuffer.prototype;
2038
+ var arrayBufferMethods = {
2039
+ init: initArrayBuffer,
2040
+ convertChunk: {
2041
+ string: useTextEncoder,
2042
+ buffer: useUint8Array,
2043
+ arrayBuffer: useUint8Array,
2044
+ dataView: useUint8ArrayWithOffset,
2045
+ typedArray: useUint8ArrayWithOffset,
2046
+ others: throwObjectStream
2047
+ },
2048
+ getSize: getLengthProp,
2049
+ truncateChunk: truncateArrayBufferChunk,
2050
+ addChunk: addArrayBufferChunk,
2051
+ getFinalChunk: noop$1,
2052
+ finalize: finalizeArrayBuffer
2053
+ };
2054
+ async function getStreamAsBuffer(stream, options2) {
2055
+ if (!("Buffer" in globalThis)) {
2056
+ throw new Error("getStreamAsBuffer() is only supported in Node.js");
2124
2057
  }
2125
- options = {
2126
- maxBuffer: Infinity,
2127
- ...options
2128
- };
2129
- const { maxBuffer } = options;
2130
- const stream2 = bufferStream(options);
2131
- await new Promise((resolve2, reject) => {
2132
- const rejectPromise = (error) => {
2133
- if (error && stream2.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
2134
- error.bufferedData = stream2.getBufferedValue();
2135
- }
2136
- reject(error);
2137
- };
2138
- (async () => {
2139
- try {
2140
- await streamPipelinePromisified(inputStream, stream2);
2141
- resolve2();
2142
- } catch (error) {
2143
- rejectPromise(error);
2144
- }
2145
- })();
2146
- stream2.on("data", () => {
2147
- if (stream2.getBufferedLength() > maxBuffer) {
2148
- rejectPromise(new MaxBufferError());
2149
- }
2150
- });
2151
- });
2152
- return stream2.getBufferedValue();
2058
+ try {
2059
+ return arrayBufferToNodeBuffer(await getStreamAsArrayBuffer(stream, options2));
2060
+ } catch (error) {
2061
+ if (error.bufferedData !== void 0) {
2062
+ error.bufferedData = arrayBufferToNodeBuffer(error.bufferedData);
2063
+ }
2064
+ throw error;
2065
+ }
2066
+ }
2067
+ var arrayBufferToNodeBuffer = (arrayBuffer) => globalThis.Buffer.from(arrayBuffer);
2068
+ async function getStreamAsString(stream, options2) {
2069
+ return getStreamContents(stream, stringMethods, options2);
2153
2070
  }
2154
- getStream$2.exports = getStream;
2155
- getStream$2.exports.buffer = (stream2, options) => getStream(stream2, { ...options, encoding: "buffer" });
2156
- getStream$2.exports.array = (stream2, options) => getStream(stream2, { ...options, array: true });
2157
- getStream$2.exports.MaxBufferError = MaxBufferError;
2158
- var getStreamExports = getStream$2.exports;
2159
- var getStream$1 = /* @__PURE__ */ getDefaultExportFromCjs(getStreamExports);
2160
- var { PassThrough } = require$$0$4;
2071
+ var initString = () => ({ contents: "", textDecoder: new TextDecoder() });
2072
+ var useTextDecoder = (chunk, { textDecoder }) => textDecoder.decode(chunk, { stream: true });
2073
+ var addStringChunk = (convertedChunk, { contents }) => contents + convertedChunk;
2074
+ var truncateStringChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
2075
+ var getFinalStringChunk = ({ textDecoder }) => {
2076
+ const finalChunk = textDecoder.decode();
2077
+ return finalChunk === "" ? void 0 : finalChunk;
2078
+ };
2079
+ var stringMethods = {
2080
+ init: initString,
2081
+ convertChunk: {
2082
+ string: identity,
2083
+ buffer: useTextDecoder,
2084
+ arrayBuffer: useTextDecoder,
2085
+ dataView: useTextDecoder,
2086
+ typedArray: useTextDecoder,
2087
+ others: throwObjectStream
2088
+ },
2089
+ getSize: getLengthProp,
2090
+ truncateChunk: truncateStringChunk,
2091
+ addChunk: addStringChunk,
2092
+ getFinalChunk: getFinalStringChunk,
2093
+ finalize: getContentsProp
2094
+ };
2095
+ var { PassThrough } = require$$0$3;
2161
2096
  var mergeStream = function() {
2162
2097
  var sources = [];
2163
2098
  var output = new PassThrough({ objectMode: true });
@@ -2203,8 +2138,8 @@ var getInput = ({ input, inputFile }) => {
2203
2138
  validateInputOptions(input);
2204
2139
  return createReadStream(inputFile);
2205
2140
  };
2206
- var handleInput = (spawned, options) => {
2207
- const input = getInput(options);
2141
+ var handleInput = (spawned, options2) => {
2142
+ const input = getInput(options2);
2208
2143
  if (input === void 0) {
2209
2144
  return;
2210
2145
  }
@@ -2227,25 +2162,33 @@ var makeAllStream = (spawned, { all }) => {
2227
2162
  }
2228
2163
  return mixed;
2229
2164
  };
2230
- var getBufferedData = async (stream2, streamPromise) => {
2231
- if (!stream2 || streamPromise === void 0) {
2165
+ var getBufferedData = async (stream, streamPromise) => {
2166
+ if (!stream || streamPromise === void 0) {
2232
2167
  return;
2233
2168
  }
2234
- stream2.destroy();
2169
+ await setTimeout$1(0);
2170
+ stream.destroy();
2235
2171
  try {
2236
2172
  return await streamPromise;
2237
2173
  } catch (error) {
2238
2174
  return error.bufferedData;
2239
2175
  }
2240
2176
  };
2241
- var getStreamPromise = (stream2, { encoding, buffer, maxBuffer }) => {
2242
- if (!stream2 || !buffer) {
2177
+ var getStreamPromise = (stream, { encoding, buffer, maxBuffer }) => {
2178
+ if (!stream || !buffer) {
2243
2179
  return;
2244
2180
  }
2245
- if (encoding) {
2246
- return getStream$1(stream2, { encoding, maxBuffer });
2181
+ if (encoding === "utf8" || encoding === "utf-8") {
2182
+ return getStreamAsString(stream, { maxBuffer });
2247
2183
  }
2248
- return getStream$1.buffer(stream2, { maxBuffer });
2184
+ if (encoding === null || encoding === "buffer") {
2185
+ return getStreamAsBuffer(stream, { maxBuffer });
2186
+ }
2187
+ return applyEncoding(stream, maxBuffer, encoding);
2188
+ };
2189
+ var applyEncoding = async (stream, maxBuffer, encoding) => {
2190
+ const buffer = await getStreamAsBuffer(stream, { maxBuffer });
2191
+ return buffer.toString(encoding);
2249
2192
  };
2250
2193
  var getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone) => {
2251
2194
  const stdoutPromise = getStreamPromise(stdout, { encoding, buffer, maxBuffer });
@@ -2294,12 +2237,11 @@ var normalizeArgs = (file, args = []) => {
2294
2237
  return [file, ...args];
2295
2238
  };
2296
2239
  var NO_ESCAPE_REGEXP = /^[\w.-]+$/;
2297
- var DOUBLE_QUOTES_REGEXP = /"/g;
2298
2240
  var escapeArg = (arg) => {
2299
2241
  if (typeof arg !== "string" || NO_ESCAPE_REGEXP.test(arg)) {
2300
2242
  return arg;
2301
2243
  }
2302
- return `"${arg.replace(DOUBLE_QUOTES_REGEXP, '\\"')}"`;
2244
+ return `"${arg.replaceAll('"', '\\"')}"`;
2303
2245
  };
2304
2246
  var joinCommand = (file, args) => normalizeArgs(file, args).join(" ");
2305
2247
  var getEscapedCommand = (file, args) => normalizeArgs(file, args).map((arg) => escapeArg(arg)).join(" ");
@@ -2307,7 +2249,7 @@ var SPACES_REGEXP = / +/g;
2307
2249
  var parseCommand = (command) => {
2308
2250
  const tokens = [];
2309
2251
  for (const token of command.trim().split(SPACES_REGEXP)) {
2310
- const previousToken = tokens[tokens.length - 1];
2252
+ const previousToken = tokens.at(-1);
2311
2253
  if (previousToken && previousToken.endsWith("\\")) {
2312
2254
  tokens[tokens.length - 1] = `${previousToken.slice(0, -1)} ${token}`;
2313
2255
  } else {
@@ -2337,18 +2279,18 @@ var getEnv = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) =>
2337
2279
  }
2338
2280
  return env2;
2339
2281
  };
2340
- var handleArguments = (file, args, options = {}) => {
2341
- const parsed = crossSpawn._parse(file, args, options);
2282
+ var handleArguments = (file, args, options2 = {}) => {
2283
+ const parsed = crossSpawn._parse(file, args, options2);
2342
2284
  file = parsed.command;
2343
2285
  args = parsed.args;
2344
- options = parsed.options;
2345
- options = {
2286
+ options2 = parsed.options;
2287
+ options2 = {
2346
2288
  maxBuffer: DEFAULT_MAX_BUFFER,
2347
2289
  buffer: true,
2348
2290
  stripFinalNewline: true,
2349
2291
  extendEnv: true,
2350
2292
  preferLocal: false,
2351
- localDir: options.cwd || process$2.cwd(),
2293
+ localDir: options2.cwd || process$2.cwd(),
2352
2294
  execPath: process$2.execPath,
2353
2295
  encoding: "utf8",
2354
2296
  reject: true,
@@ -2356,26 +2298,26 @@ var handleArguments = (file, args, options = {}) => {
2356
2298
  all: false,
2357
2299
  windowsHide: true,
2358
2300
  verbose: verboseDefault,
2359
- ...options
2301
+ ...options2
2360
2302
  };
2361
- options.env = getEnv(options);
2362
- options.stdio = normalizeStdio(options);
2303
+ options2.env = getEnv(options2);
2304
+ options2.stdio = normalizeStdio(options2);
2363
2305
  if (process$2.platform === "win32" && path$3.basename(file, ".exe") === "cmd") {
2364
2306
  args.unshift("/q");
2365
2307
  }
2366
- return { file, args, options, parsed };
2308
+ return { file, args, options: options2, parsed };
2367
2309
  };
2368
- var handleOutput = (options, value, error) => {
2310
+ var handleOutput = (options2, value, error) => {
2369
2311
  if (typeof value !== "string" && !Buffer$1.isBuffer(value)) {
2370
2312
  return error === void 0 ? void 0 : "";
2371
2313
  }
2372
- if (options.stripFinalNewline) {
2314
+ if (options2.stripFinalNewline) {
2373
2315
  return stripFinalNewline(value);
2374
2316
  }
2375
2317
  return value;
2376
2318
  };
2377
- function execa(file, args, options) {
2378
- const parsed = handleArguments(file, args, options);
2319
+ function execa(file, args, options2) {
2320
+ const parsed = handleArguments(file, args, options2);
2379
2321
  const command = joinCommand(file, args);
2380
2322
  const escapedCommand = getEscapedCommand(file, args);
2381
2323
  logCommand(escapedCommand, parsed.options);
@@ -2451,9 +2393,207 @@ function execa(file, args, options) {
2451
2393
  mergePromise(spawned, handlePromiseOnce);
2452
2394
  return spawned;
2453
2395
  }
2454
- function execaCommand(command, options) {
2396
+ function execaCommand(command, options2) {
2455
2397
  const [file, ...args] = parseCommand(command);
2456
- return execa(file, args, options);
2398
+ return execa(file, args, options2);
2399
+ }
2400
+ var Node = class {
2401
+ value;
2402
+ next;
2403
+ constructor(value) {
2404
+ this.value = value;
2405
+ }
2406
+ };
2407
+ var Queue = class {
2408
+ #head;
2409
+ #tail;
2410
+ #size;
2411
+ constructor() {
2412
+ this.clear();
2413
+ }
2414
+ enqueue(value) {
2415
+ const node = new Node(value);
2416
+ if (this.#head) {
2417
+ this.#tail.next = node;
2418
+ this.#tail = node;
2419
+ } else {
2420
+ this.#head = node;
2421
+ this.#tail = node;
2422
+ }
2423
+ this.#size++;
2424
+ }
2425
+ dequeue() {
2426
+ const current = this.#head;
2427
+ if (!current) {
2428
+ return;
2429
+ }
2430
+ this.#head = this.#head.next;
2431
+ this.#size--;
2432
+ return current.value;
2433
+ }
2434
+ clear() {
2435
+ this.#head = void 0;
2436
+ this.#tail = void 0;
2437
+ this.#size = 0;
2438
+ }
2439
+ get size() {
2440
+ return this.#size;
2441
+ }
2442
+ *[Symbol.iterator]() {
2443
+ let current = this.#head;
2444
+ while (current) {
2445
+ yield current.value;
2446
+ current = current.next;
2447
+ }
2448
+ }
2449
+ };
2450
+ function pLimit(concurrency) {
2451
+ if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
2452
+ throw new TypeError("Expected `concurrency` to be a number from 1 and up");
2453
+ }
2454
+ const queue = new Queue();
2455
+ let activeCount = 0;
2456
+ const next = () => {
2457
+ activeCount--;
2458
+ if (queue.size > 0) {
2459
+ queue.dequeue()();
2460
+ }
2461
+ };
2462
+ const run2 = async (fn, resolve2, args) => {
2463
+ activeCount++;
2464
+ const result = (async () => fn(...args))();
2465
+ resolve2(result);
2466
+ try {
2467
+ await result;
2468
+ } catch {
2469
+ }
2470
+ next();
2471
+ };
2472
+ const enqueue = (fn, resolve2, args) => {
2473
+ queue.enqueue(run2.bind(void 0, fn, resolve2, args));
2474
+ (async () => {
2475
+ await Promise.resolve();
2476
+ if (activeCount < concurrency && queue.size > 0) {
2477
+ queue.dequeue()();
2478
+ }
2479
+ })();
2480
+ };
2481
+ const generator = (fn, ...args) => new Promise((resolve2) => {
2482
+ enqueue(fn, resolve2, args);
2483
+ });
2484
+ Object.defineProperties(generator, {
2485
+ activeCount: {
2486
+ get: () => activeCount
2487
+ },
2488
+ pendingCount: {
2489
+ get: () => queue.size
2490
+ },
2491
+ clearQueue: {
2492
+ value: () => {
2493
+ queue.clear();
2494
+ }
2495
+ }
2496
+ });
2497
+ return generator;
2498
+ }
2499
+ var EndError = class extends Error {
2500
+ constructor(value) {
2501
+ super();
2502
+ this.value = value;
2503
+ }
2504
+ };
2505
+ var testElement = async (element, tester) => tester(await element);
2506
+ var finder = async (element) => {
2507
+ const values = await Promise.all(element);
2508
+ if (values[1] === true) {
2509
+ throw new EndError(values[0]);
2510
+ }
2511
+ return false;
2512
+ };
2513
+ async function pLocate(iterable, tester, {
2514
+ concurrency = Number.POSITIVE_INFINITY,
2515
+ preserveOrder = true
2516
+ } = {}) {
2517
+ const limit = pLimit(concurrency);
2518
+ const items = [...iterable].map((element) => [element, limit(testElement, element, tester)]);
2519
+ const checkLimit = pLimit(preserveOrder ? 1 : Number.POSITIVE_INFINITY);
2520
+ try {
2521
+ await Promise.all(items.map((element) => checkLimit(finder, element)));
2522
+ } catch (error) {
2523
+ if (error instanceof EndError) {
2524
+ return error.value;
2525
+ }
2526
+ throw error;
2527
+ }
2528
+ }
2529
+ var typeMappings = {
2530
+ directory: "isDirectory",
2531
+ file: "isFile"
2532
+ };
2533
+ function checkType(type) {
2534
+ if (Object.hasOwnProperty.call(typeMappings, type)) {
2535
+ return;
2536
+ }
2537
+ throw new Error(`Invalid type specified: ${type}`);
2538
+ }
2539
+ var matchType = (type, stat) => stat[typeMappings[type]]();
2540
+ var toPath$1 = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath2(urlOrPath) : urlOrPath;
2541
+ async function locatePath(paths, {
2542
+ cwd = process$2.cwd(),
2543
+ type = "file",
2544
+ allowSymlinks = true,
2545
+ concurrency,
2546
+ preserveOrder
2547
+ } = {}) {
2548
+ checkType(type);
2549
+ cwd = toPath$1(cwd);
2550
+ const statFunction = allowSymlinks ? promises.stat : promises.lstat;
2551
+ return pLocate(paths, async (path_) => {
2552
+ try {
2553
+ const stat = await statFunction(path$3.resolve(cwd, path_));
2554
+ return matchType(type, stat);
2555
+ } catch {
2556
+ return false;
2557
+ }
2558
+ }, { concurrency, preserveOrder });
2559
+ }
2560
+ var toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath2(urlOrPath) : urlOrPath;
2561
+ var findUpStop = Symbol("findUpStop");
2562
+ async function findUpMultiple(name, options2 = {}) {
2563
+ let directory = path$3.resolve(toPath(options2.cwd) || "");
2564
+ const { root } = path$3.parse(directory);
2565
+ const stopAt = path$3.resolve(directory, options2.stopAt || root);
2566
+ const limit = options2.limit || Number.POSITIVE_INFINITY;
2567
+ const paths = [name].flat();
2568
+ const runMatcher = async (locateOptions) => {
2569
+ if (typeof name !== "function") {
2570
+ return locatePath(paths, locateOptions);
2571
+ }
2572
+ const foundPath = await name(locateOptions.cwd);
2573
+ if (typeof foundPath === "string") {
2574
+ return locatePath([foundPath], locateOptions);
2575
+ }
2576
+ return foundPath;
2577
+ };
2578
+ const matches = [];
2579
+ while (true) {
2580
+ const foundPath = await runMatcher({ ...options2, cwd: directory });
2581
+ if (foundPath === findUpStop) {
2582
+ break;
2583
+ }
2584
+ if (foundPath) {
2585
+ matches.push(path$3.resolve(directory, foundPath));
2586
+ }
2587
+ if (directory === stopAt || matches.length >= limit) {
2588
+ break;
2589
+ }
2590
+ directory = path$3.dirname(directory);
2591
+ }
2592
+ return matches;
2593
+ }
2594
+ async function findUp(name, options2 = {}) {
2595
+ const matches = await findUpMultiple(name, { ...options2, limit: 1 });
2596
+ return matches[0];
2457
2597
  }
2458
2598
  var ESC$1 = "\x1B[";
2459
2599
  var OSC = "\x1B]";
@@ -2542,32 +2682,32 @@ ansiEscapes.link = (text2, url2) => {
2542
2682
  BEL
2543
2683
  ].join("");
2544
2684
  };
2545
- ansiEscapes.image = (buffer, options = {}) => {
2685
+ ansiEscapes.image = (buffer, options2 = {}) => {
2546
2686
  let returnValue = `${OSC}1337;File=inline=1`;
2547
- if (options.width) {
2548
- returnValue += `;width=${options.width}`;
2687
+ if (options2.width) {
2688
+ returnValue += `;width=${options2.width}`;
2549
2689
  }
2550
- if (options.height) {
2551
- returnValue += `;height=${options.height}`;
2690
+ if (options2.height) {
2691
+ returnValue += `;height=${options2.height}`;
2552
2692
  }
2553
- if (options.preserveAspectRatio === false) {
2693
+ if (options2.preserveAspectRatio === false) {
2554
2694
  returnValue += ";preserveAspectRatio=0";
2555
2695
  }
2556
2696
  return returnValue + ":" + buffer.toString("base64") + BEL;
2557
2697
  };
2558
2698
  ansiEscapes.iTerm = {
2559
2699
  setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
2560
- annotation: (message, options = {}) => {
2700
+ annotation: (message, options2 = {}) => {
2561
2701
  let returnValue = `${OSC}1337;`;
2562
- const hasX = typeof options.x !== "undefined";
2563
- const hasY = typeof options.y !== "undefined";
2564
- if ((hasX || hasY) && !(hasX && hasY && typeof options.length !== "undefined")) {
2702
+ const hasX = typeof options2.x !== "undefined";
2703
+ const hasY = typeof options2.y !== "undefined";
2704
+ if ((hasX || hasY) && !(hasX && hasY && typeof options2.length !== "undefined")) {
2565
2705
  throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");
2566
2706
  }
2567
2707
  message = message.replace(/\|/g, "");
2568
- returnValue += options.isHidden ? "AddHiddenAnnotation=" : "AddAnnotation=";
2569
- if (options.length > 0) {
2570
- returnValue += (hasX ? [message, options.length, options.x, options.y] : [options.length, message]).join("|");
2708
+ returnValue += options2.isHidden ? "AddHiddenAnnotation=" : "AddAnnotation=";
2709
+ if (options2.length > 0) {
2710
+ returnValue += (hasX ? [message, options2.length, options2.x, options2.y] : [options2.length, message]).join("|");
2571
2711
  } else {
2572
2712
  returnValue += message;
2573
2713
  }
@@ -2580,7 +2720,7 @@ var hasFlag$2 = (flag, argv = process.argv) => {
2580
2720
  const terminatorPosition = argv.indexOf("--");
2581
2721
  return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
2582
2722
  };
2583
- var os = require$$0$6;
2723
+ var os = require$$0$4;
2584
2724
  var tty = require$$1;
2585
2725
  var hasFlag$1 = hasFlag$2;
2586
2726
  var { env } = process;
@@ -2666,8 +2806,8 @@ function supportsColor$1(haveStream, streamIsTTY) {
2666
2806
  }
2667
2807
  return min;
2668
2808
  }
2669
- function getSupportLevel(stream2) {
2670
- const level = supportsColor$1(stream2, stream2 && stream2.isTTY);
2809
+ function getSupportLevel(stream) {
2810
+ const level = supportsColor$1(stream, stream && stream.isTTY);
2671
2811
  return translateLevel(level);
2672
2812
  }
2673
2813
  var supportsColor_1 = {
@@ -2693,7 +2833,7 @@ function parseVersion(versionString) {
2693
2833
  patch: versions[2]
2694
2834
  };
2695
2835
  }
2696
- function supportsHyperlink(stream2) {
2836
+ function supportsHyperlink(stream) {
2697
2837
  const { env: env2 } = process;
2698
2838
  if ("FORCE_HYPERLINK" in env2) {
2699
2839
  return !(env2.FORCE_HYPERLINK.length > 0 && parseInt(env2.FORCE_HYPERLINK, 10) === 0);
@@ -2704,10 +2844,10 @@ function supportsHyperlink(stream2) {
2704
2844
  if (hasFlag("hyperlink=true") || hasFlag("hyperlink=always")) {
2705
2845
  return true;
2706
2846
  }
2707
- if (!supportsColor.supportsColor(stream2)) {
2847
+ if (!supportsColor.supportsColor(stream)) {
2708
2848
  return false;
2709
2849
  }
2710
- if (stream2 && !stream2.isTTY) {
2850
+ if (stream && !stream.isTTY) {
2711
2851
  return false;
2712
2852
  }
2713
2853
  if (process.platform === "win32") {
@@ -2747,17 +2887,17 @@ var supportsHyperlinks = {
2747
2887
  stderr: supportsHyperlink(process.stderr)
2748
2888
  };
2749
2889
  var supportsHyperlinks$1 = /* @__PURE__ */ getDefaultExportFromCjs(supportsHyperlinks);
2750
- function terminalLink(text2, url2, { target = "stdout", ...options } = {}) {
2890
+ function terminalLink(text2, url2, { target = "stdout", ...options2 } = {}) {
2751
2891
  if (!supportsHyperlinks$1[target]) {
2752
- if (options.fallback === false) {
2892
+ if (options2.fallback === false) {
2753
2893
  return text2;
2754
2894
  }
2755
- return typeof options.fallback === "function" ? options.fallback(text2, url2) : `${text2} (\u200B${url2}\u200B)`;
2895
+ return typeof options2.fallback === "function" ? options2.fallback(text2, url2) : `${text2} (\u200B${url2}\u200B)`;
2756
2896
  }
2757
2897
  return ansiEscapes.link(text2, url2);
2758
2898
  }
2759
2899
  terminalLink.isSupported = supportsHyperlinks$1.stdout;
2760
- terminalLink.stderr = (text2, url2, options = {}) => terminalLink(text2, url2, { target: "stderr", ...options });
2900
+ terminalLink.stderr = (text2, url2, options2 = {}) => terminalLink(text2, url2, { target: "stderr", ...options2 });
2761
2901
  terminalLink.stderr.isSupported = supportsHyperlinks$1.stderr;
2762
2902
  var prompts$3 = {};
2763
2903
  var FORCE_COLOR$1;
@@ -3083,7 +3223,7 @@ var util = {
3083
3223
  wrap: wrap$3,
3084
3224
  entriesToDisplay: entriesToDisplay$3
3085
3225
  };
3086
- var readline = require$$0$7;
3226
+ var readline = require$$0$5;
3087
3227
  var { action } = util;
3088
3228
  var EventEmitter = require$$2;
3089
3229
  var { beep, cursor: cursor$9 } = src;
@@ -4287,28 +4427,28 @@ Instructions:
4287
4427
  return prefix + title + color$3.gray(desc || "");
4288
4428
  }
4289
4429
  // shared with autocompleteMultiselect
4290
- paginateOptions(options) {
4291
- if (options.length === 0) {
4430
+ paginateOptions(options2) {
4431
+ if (options2.length === 0) {
4292
4432
  return color$3.red("No matches for this query.");
4293
4433
  }
4294
- let { startIndex, endIndex } = entriesToDisplay$1(this.cursor, options.length, this.optionsPerPage);
4434
+ let { startIndex, endIndex } = entriesToDisplay$1(this.cursor, options2.length, this.optionsPerPage);
4295
4435
  let prefix, styledOptions = [];
4296
4436
  for (let i = startIndex; i < endIndex; i++) {
4297
4437
  if (i === startIndex && startIndex > 0) {
4298
4438
  prefix = figures$2.arrowUp;
4299
- } else if (i === endIndex - 1 && endIndex < options.length) {
4439
+ } else if (i === endIndex - 1 && endIndex < options2.length) {
4300
4440
  prefix = figures$2.arrowDown;
4301
4441
  } else {
4302
4442
  prefix = " ";
4303
4443
  }
4304
- styledOptions.push(this.renderOption(this.cursor, options[i], i, prefix));
4444
+ styledOptions.push(this.renderOption(this.cursor, options2[i], i, prefix));
4305
4445
  }
4306
4446
  return "\n" + styledOptions.join("\n");
4307
4447
  }
4308
4448
  // shared with autocomleteMultiselect
4309
- renderOptions(options) {
4449
+ renderOptions(options2) {
4310
4450
  if (!this.done) {
4311
- return this.paginateOptions(options);
4451
+ return this.paginateOptions(options2);
4312
4452
  }
4313
4453
  return "";
4314
4454
  }
@@ -4935,7 +5075,152 @@ function override(answers) {
4935
5075
  var lib$1 = Object.assign(prompt, { prompt, prompts: prompts$2, inject, override });
4936
5076
  var prompts = lib$1;
4937
5077
  var prompts$1 = /* @__PURE__ */ getDefaultExportFromCjs(prompts);
4938
- var isexe = isexe_1;
5078
+ var cjs = {};
5079
+ var posix$1 = {};
5080
+ Object.defineProperty(posix$1, "__esModule", { value: true });
5081
+ posix$1.sync = posix$1.isexe = void 0;
5082
+ var fs_1$1 = require$$0;
5083
+ var promises_1$1 = require$$1$1;
5084
+ var isexe$2 = async (path13, options2 = {}) => {
5085
+ const { ignoreErrors = false } = options2;
5086
+ try {
5087
+ return checkStat$1(await (0, promises_1$1.stat)(path13), options2);
5088
+ } catch (e) {
5089
+ const er = e;
5090
+ if (ignoreErrors || er.code === "EACCES")
5091
+ return false;
5092
+ throw er;
5093
+ }
5094
+ };
5095
+ posix$1.isexe = isexe$2;
5096
+ var sync$1 = (path13, options2 = {}) => {
5097
+ const { ignoreErrors = false } = options2;
5098
+ try {
5099
+ return checkStat$1((0, fs_1$1.statSync)(path13), options2);
5100
+ } catch (e) {
5101
+ const er = e;
5102
+ if (ignoreErrors || er.code === "EACCES")
5103
+ return false;
5104
+ throw er;
5105
+ }
5106
+ };
5107
+ posix$1.sync = sync$1;
5108
+ var checkStat$1 = (stat, options2) => stat.isFile() && checkMode(stat, options2);
5109
+ var checkMode = (stat, options2) => {
5110
+ const myUid = options2.uid ?? process.getuid?.();
5111
+ const myGroups = options2.groups ?? process.getgroups?.() ?? [];
5112
+ const myGid = options2.gid ?? process.getgid?.() ?? myGroups[0];
5113
+ if (myUid === void 0 || myGid === void 0) {
5114
+ throw new Error("cannot get uid or gid");
5115
+ }
5116
+ const groups = /* @__PURE__ */ new Set([myGid, ...myGroups]);
5117
+ const mod = stat.mode;
5118
+ const uid = stat.uid;
5119
+ const gid = stat.gid;
5120
+ const u = parseInt("100", 8);
5121
+ const g = parseInt("010", 8);
5122
+ const o = parseInt("001", 8);
5123
+ const ug = u | g;
5124
+ return !!(mod & o || mod & g && groups.has(gid) || mod & u && uid === myUid || mod & ug && myUid === 0);
5125
+ };
5126
+ var win32 = {};
5127
+ Object.defineProperty(win32, "__esModule", { value: true });
5128
+ win32.sync = win32.isexe = void 0;
5129
+ var fs_1 = require$$0;
5130
+ var promises_1 = require$$1$1;
5131
+ var isexe$1 = async (path13, options2 = {}) => {
5132
+ const { ignoreErrors = false } = options2;
5133
+ try {
5134
+ return checkStat(await (0, promises_1.stat)(path13), path13, options2);
5135
+ } catch (e) {
5136
+ const er = e;
5137
+ if (ignoreErrors || er.code === "EACCES")
5138
+ return false;
5139
+ throw er;
5140
+ }
5141
+ };
5142
+ win32.isexe = isexe$1;
5143
+ var sync = (path13, options2 = {}) => {
5144
+ const { ignoreErrors = false } = options2;
5145
+ try {
5146
+ return checkStat((0, fs_1.statSync)(path13), path13, options2);
5147
+ } catch (e) {
5148
+ const er = e;
5149
+ if (ignoreErrors || er.code === "EACCES")
5150
+ return false;
5151
+ throw er;
5152
+ }
5153
+ };
5154
+ win32.sync = sync;
5155
+ var checkPathExt = (path13, options2) => {
5156
+ const { pathExt = process.env.PATHEXT || "" } = options2;
5157
+ const peSplit = pathExt.split(";");
5158
+ if (peSplit.indexOf("") !== -1) {
5159
+ return true;
5160
+ }
5161
+ for (let i = 0; i < peSplit.length; i++) {
5162
+ const p = peSplit[i].toLowerCase();
5163
+ const ext = path13.substring(path13.length - p.length).toLowerCase();
5164
+ if (p && ext === p) {
5165
+ return true;
5166
+ }
5167
+ }
5168
+ return false;
5169
+ };
5170
+ var checkStat = (stat, path13, options2) => stat.isFile() && checkPathExt(path13, options2);
5171
+ var options = {};
5172
+ Object.defineProperty(options, "__esModule", { value: true });
5173
+ (function(exports) {
5174
+ var __createBinding = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function(o, m, k, k2) {
5175
+ if (k2 === void 0)
5176
+ k2 = k;
5177
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5178
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5179
+ desc = { enumerable: true, get: function() {
5180
+ return m[k];
5181
+ } };
5182
+ }
5183
+ Object.defineProperty(o, k2, desc);
5184
+ } : function(o, m, k, k2) {
5185
+ if (k2 === void 0)
5186
+ k2 = k;
5187
+ o[k2] = m[k];
5188
+ });
5189
+ var __setModuleDefault = commonjsGlobal && commonjsGlobal.__setModuleDefault || (Object.create ? function(o, v) {
5190
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
5191
+ } : function(o, v) {
5192
+ o["default"] = v;
5193
+ });
5194
+ var __importStar = commonjsGlobal && commonjsGlobal.__importStar || function(mod) {
5195
+ if (mod && mod.__esModule)
5196
+ return mod;
5197
+ var result = {};
5198
+ if (mod != null) {
5199
+ for (var k in mod)
5200
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
5201
+ __createBinding(result, mod, k);
5202
+ }
5203
+ __setModuleDefault(result, mod);
5204
+ return result;
5205
+ };
5206
+ var __exportStar = commonjsGlobal && commonjsGlobal.__exportStar || function(m, exports2) {
5207
+ for (var p in m)
5208
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
5209
+ __createBinding(exports2, m, p);
5210
+ };
5211
+ Object.defineProperty(exports, "__esModule", { value: true });
5212
+ exports.sync = exports.isexe = exports.posix = exports.win32 = void 0;
5213
+ const posix2 = __importStar(posix$1);
5214
+ exports.posix = posix2;
5215
+ const win32$1 = __importStar(win32);
5216
+ exports.win32 = win32$1;
5217
+ __exportStar(options, exports);
5218
+ const platform = process.env._ISEXE_TEST_PLATFORM_ || process.platform;
5219
+ const impl = platform === "win32" ? win32$1 : posix2;
5220
+ exports.isexe = impl.isexe;
5221
+ exports.sync = impl.sync;
5222
+ })(cjs);
5223
+ var { isexe, sync: isexeSync } = cjs;
4939
5224
  var { join, delimiter, sep: sep2, posix } = require$$0$1;
4940
5225
  var isWindows = process.platform === "win32";
4941
5226
  var rSlash = new RegExp(`[${posix.sep}${sep2 === posix.sep ? "" : sep2}]`.replace(/(\\)/g, "\\$1"));
@@ -4954,11 +5239,7 @@ var getPathInfo = (cmd, {
4954
5239
  ];
4955
5240
  if (isWindows) {
4956
5241
  const pathExtExe = optPathExt || [".EXE", ".CMD", ".BAT", ".COM"].join(optDelimiter);
4957
- const pathExt = pathExtExe.split(optDelimiter).reduce((acc, item2) => {
4958
- acc.push(item2);
4959
- acc.push(item2.toLowerCase());
4960
- return acc;
4961
- }, []);
5242
+ const pathExt = pathExtExe.split(optDelimiter).flatMap((item2) => [item2, item2.toLowerCase()]);
4962
5243
  if (cmd.includes(".") && pathExt[0] !== "") {
4963
5244
  pathExt.unshift("");
4964
5245
  }
@@ -5002,7 +5283,7 @@ var whichSync = (cmd, opt = {}) => {
5002
5283
  const p = getPathPart(pathEnvPart, cmd);
5003
5284
  for (const ext of pathExt) {
5004
5285
  const withExt = p + ext;
5005
- const is = isexe.sync(withExt, { pathExt: pathExtExe, ignoreErrors: true });
5286
+ const is = isexeSync(withExt, { pathExt: pathExtExe, ignoreErrors: true });
5006
5287
  if (is) {
5007
5288
  if (!opt.all) {
5008
5289
  return withExt;
@@ -5039,16 +5320,18 @@ async function detect({ autoInstall, programmatic, cwd } = {}) {
5039
5320
  try {
5040
5321
  const pkg = JSON.parse(fs$1.readFileSync(packageJsonPath, "utf8"));
5041
5322
  if (typeof pkg.packageManager === "string") {
5042
- const [name, ver] = pkg.packageManager.split("@");
5323
+ const [name, ver] = pkg.packageManager.replace(/^\^/, "").split("@");
5043
5324
  version = ver;
5044
- if (name === "yarn" && Number.parseInt(ver) > 1)
5325
+ if (name === "yarn" && Number.parseInt(ver) > 1) {
5045
5326
  agent = "yarn@berry";
5046
- else if (name === "pnpm" && Number.parseInt(ver) < 7)
5327
+ version = "berry";
5328
+ } else if (name === "pnpm" && Number.parseInt(ver) < 7) {
5047
5329
  agent = "pnpm@6";
5048
- else if (name in AGENTS)
5330
+ } else if (name in AGENTS) {
5049
5331
  agent = name;
5050
- else if (!programmatic)
5332
+ } else if (!programmatic) {
5051
5333
  console.warn("[ni] Unknown packageManager:", pkg.packageManager);
5334
+ }
5052
5335
  }
5053
5336
  } catch {
5054
5337
  }
@@ -5070,10 +5353,13 @@ async function detect({ autoInstall, programmatic, cwd } = {}) {
5070
5353
  if (!tryInstall)
5071
5354
  process$2.exit(1);
5072
5355
  }
5073
- await execaCommand(`npm i -g ${agent}${version ? `@${version}` : ""}`, { stdio: "inherit", cwd });
5356
+ await execaCommand(`npm i -g ${agent.split("@")[0]}${version ? `@${version}` : ""}`, { stdio: "inherit", cwd });
5074
5357
  }
5075
5358
  return agent;
5076
5359
  }
5360
+ var customRcPath = process$2.env.NI_CONFIG_FILE;
5361
+ var home = process$2.platform === "win32" ? process$2.env.USERPROFILE : process$2.env.HOME;
5362
+ var defaultRcPath = path$3.join(home || "~/", ".nirc");
5077
5363
  var FORCE_COLOR;
5078
5364
  var NODE_DISABLE_COLORS;
5079
5365
  var NO_COLOR;
@@ -5468,13 +5754,13 @@ async function getItemTargetPath(config, item2, override2) {
5468
5754
  }
5469
5755
  async function fetchRegistry(paths) {
5470
5756
  try {
5471
- let options = {};
5757
+ let options2 = {};
5472
5758
  if (proxyUrl) {
5473
- options.agent = new HttpsProxyAgent(proxyUrl);
5759
+ options2.agent = new HttpsProxyAgent(proxyUrl);
5474
5760
  }
5475
5761
  const results = await Promise.all(
5476
5762
  paths.map(async (path13) => {
5477
- const response = await fetch(`${baseUrl}/registry/${path13}`, options);
5763
+ const response = await fetch(`${baseUrl}/registry/${path13}`, options2);
5478
5764
  return await response.json();
5479
5765
  })
5480
5766
  );
@@ -5485,7 +5771,7 @@ async function fetchRegistry(paths) {
5485
5771
  }
5486
5772
  }
5487
5773
 
5488
- // node_modules/.pnpm/@jridgewell+sourcemap-codec@1.4.15/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
5774
+ // ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.4.15/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
5489
5775
  var comma = ",".charCodeAt(0);
5490
5776
  var semicolon = ";".charCodeAt(0);
5491
5777
  var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@@ -5567,7 +5853,7 @@ function encodeInteger(buf, pos2, state, segment, j) {
5567
5853
  return pos2;
5568
5854
  }
5569
5855
 
5570
- // node_modules/.pnpm/magic-string@0.30.2/node_modules/magic-string/dist/magic-string.es.mjs
5856
+ // ../../node_modules/.pnpm/magic-string@0.30.8/node_modules/magic-string/dist/magic-string.es.mjs
5571
5857
  var BitSet = class {
5572
5858
  constructor(arg) {
5573
5859
  this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
@@ -5642,6 +5928,15 @@ var Chunk = class {
5642
5928
  prependRight(content) {
5643
5929
  this.intro = content + this.intro;
5644
5930
  }
5931
+ reset() {
5932
+ this.intro = "";
5933
+ this.outro = "";
5934
+ if (this.edited) {
5935
+ this.content = this.original;
5936
+ this.storeName = false;
5937
+ this.edited = false;
5938
+ }
5939
+ }
5645
5940
  split(index) {
5646
5941
  const sliceIndex = index - this.start;
5647
5942
  const originalBefore = this.original.slice(0, sliceIndex);
@@ -5675,6 +5970,9 @@ var Chunk = class {
5675
5970
  if (trimmed.length) {
5676
5971
  if (trimmed !== this.content) {
5677
5972
  this.split(this.start + trimmed.length).edit("", void 0, true);
5973
+ if (this.edited) {
5974
+ this.edit(trimmed, this.storeName, true);
5975
+ }
5678
5976
  }
5679
5977
  return true;
5680
5978
  } else {
@@ -5691,7 +5989,10 @@ var Chunk = class {
5691
5989
  const trimmed = this.content.replace(rx, "");
5692
5990
  if (trimmed.length) {
5693
5991
  if (trimmed !== this.content) {
5694
- this.split(this.end - trimmed.length);
5992
+ const newChunk = this.split(this.end - trimmed.length);
5993
+ if (this.edited) {
5994
+ newChunk.edit(trimmed, this.storeName, true);
5995
+ }
5695
5996
  this.edit("", void 0, true);
5696
5997
  }
5697
5998
  return true;
@@ -5704,8 +6005,8 @@ var Chunk = class {
5704
6005
  }
5705
6006
  };
5706
6007
  function getBtoa() {
5707
- if (typeof window !== "undefined" && typeof window.btoa === "function") {
5708
- return (str) => window.btoa(unescape(encodeURIComponent(str)));
6008
+ if (typeof globalThis !== "undefined" && typeof globalThis.btoa === "function") {
6009
+ return (str) => globalThis.btoa(unescape(encodeURIComponent(str)));
5709
6010
  } else if (typeof Buffer === "function") {
5710
6011
  return (str) => Buffer.from(str, "utf-8").toString("base64");
5711
6012
  } else {
@@ -5804,15 +6105,31 @@ var Mappings = class {
5804
6105
  }
5805
6106
  addEdit(sourceIndex, content, loc, nameIndex) {
5806
6107
  if (content.length) {
6108
+ const contentLengthMinusOne = content.length - 1;
6109
+ let contentLineEnd = content.indexOf("\n", 0);
6110
+ let previousContentLineEnd = -1;
6111
+ while (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) {
6112
+ const segment2 = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
6113
+ if (nameIndex >= 0) {
6114
+ segment2.push(nameIndex);
6115
+ }
6116
+ this.rawSegments.push(segment2);
6117
+ this.generatedCodeLine += 1;
6118
+ this.raw[this.generatedCodeLine] = this.rawSegments = [];
6119
+ this.generatedCodeColumn = 0;
6120
+ previousContentLineEnd = contentLineEnd;
6121
+ contentLineEnd = content.indexOf("\n", contentLineEnd + 1);
6122
+ }
5807
6123
  const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
5808
6124
  if (nameIndex >= 0) {
5809
6125
  segment.push(nameIndex);
5810
6126
  }
5811
6127
  this.rawSegments.push(segment);
6128
+ this.advance(content.slice(previousContentLineEnd + 1));
5812
6129
  } else if (this.pending) {
5813
6130
  this.rawSegments.push(this.pending);
6131
+ this.advance(content);
5814
6132
  }
5815
- this.advance(content);
5816
6133
  this.pending = null;
5817
6134
  }
5818
6135
  addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
@@ -5873,7 +6190,7 @@ var warned = {
5873
6190
  storeName: false
5874
6191
  };
5875
6192
  var MagicString = class {
5876
- constructor(string3, options = {}) {
6193
+ constructor(string3, options2 = {}) {
5877
6194
  const chunk = new Chunk(0, string3.length, string3);
5878
6195
  Object.defineProperties(this, {
5879
6196
  original: { writable: true, value: string3 },
@@ -5884,12 +6201,12 @@ var MagicString = class {
5884
6201
  lastSearchedChunk: { writable: true, value: chunk },
5885
6202
  byStart: { writable: true, value: {} },
5886
6203
  byEnd: { writable: true, value: {} },
5887
- filename: { writable: true, value: options.filename },
5888
- indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
6204
+ filename: { writable: true, value: options2.filename },
6205
+ indentExclusionRanges: { writable: true, value: options2.indentExclusionRanges },
5889
6206
  sourcemapLocations: { writable: true, value: new BitSet() },
5890
6207
  storedNames: { writable: true, value: {} },
5891
6208
  indentStr: { writable: true, value: void 0 },
5892
- ignoreList: { writable: true, value: options.ignoreList }
6209
+ ignoreList: { writable: true, value: options2.ignoreList }
5893
6210
  });
5894
6211
  this.byStart[0] = chunk;
5895
6212
  this.byEnd[string3.length] = chunk;
@@ -5952,11 +6269,11 @@ var MagicString = class {
5952
6269
  cloned.outro = this.outro;
5953
6270
  return cloned;
5954
6271
  }
5955
- generateDecodedMap(options) {
5956
- options = options || {};
6272
+ generateDecodedMap(options2) {
6273
+ options2 = options2 || {};
5957
6274
  const sourceIndex = 0;
5958
6275
  const names = Object.keys(this.storedNames);
5959
- const mappings = new Mappings(options.hires);
6276
+ const mappings = new Mappings(options2.hires);
5960
6277
  const locate = getLocator(this.original);
5961
6278
  if (this.intro) {
5962
6279
  mappings.advance(this.intro);
@@ -5979,18 +6296,18 @@ var MagicString = class {
5979
6296
  mappings.advance(chunk.outro);
5980
6297
  });
5981
6298
  return {
5982
- file: options.file ? options.file.split(/[/\\]/).pop() : void 0,
6299
+ file: options2.file ? options2.file.split(/[/\\]/).pop() : void 0,
5983
6300
  sources: [
5984
- options.source ? getRelativePath(options.file || "", options.source) : options.file || ""
6301
+ options2.source ? getRelativePath(options2.file || "", options2.source) : options2.file || ""
5985
6302
  ],
5986
- sourcesContent: options.includeContent ? [this.original] : void 0,
6303
+ sourcesContent: options2.includeContent ? [this.original] : void 0,
5987
6304
  names,
5988
6305
  mappings: mappings.raw,
5989
6306
  x_google_ignoreList: this.ignoreList ? [sourceIndex] : void 0
5990
6307
  };
5991
6308
  }
5992
- generateMap(options) {
5993
- return new SourceMap(this.generateDecodedMap(options));
6309
+ generateMap(options2) {
6310
+ return new SourceMap(this.generateDecodedMap(options2));
5994
6311
  }
5995
6312
  _ensureindentStr() {
5996
6313
  if (this.indentStr === void 0) {
@@ -6005,10 +6322,10 @@ var MagicString = class {
6005
6322
  this._ensureindentStr();
6006
6323
  return this.indentStr === null ? " " : this.indentStr;
6007
6324
  }
6008
- indent(indentStr, options) {
6325
+ indent(indentStr, options2) {
6009
6326
  const pattern = /^[^\r\n]/gm;
6010
6327
  if (isObject(indentStr)) {
6011
- options = indentStr;
6328
+ options2 = indentStr;
6012
6329
  indentStr = void 0;
6013
6330
  }
6014
6331
  if (indentStr === void 0) {
@@ -6017,17 +6334,17 @@ var MagicString = class {
6017
6334
  }
6018
6335
  if (indentStr === "")
6019
6336
  return this;
6020
- options = options || {};
6337
+ options2 = options2 || {};
6021
6338
  const isExcluded = {};
6022
- if (options.exclude) {
6023
- const exclusions = typeof options.exclude[0] === "number" ? [options.exclude] : options.exclude;
6339
+ if (options2.exclude) {
6340
+ const exclusions = typeof options2.exclude[0] === "number" ? [options2.exclude] : options2.exclude;
6024
6341
  exclusions.forEach((exclusion) => {
6025
6342
  for (let i = exclusion[0]; i < exclusion[1]; i += 1) {
6026
6343
  isExcluded[i] = true;
6027
6344
  }
6028
6345
  });
6029
6346
  }
6030
- let shouldIndentNextCharacter = options.indentStart !== false;
6347
+ let shouldIndentNextCharacter = options2.indentStart !== false;
6031
6348
  const replacer = (match) => {
6032
6349
  if (shouldIndentNextCharacter)
6033
6350
  return `${indentStr}${match}`;
@@ -6132,11 +6449,11 @@ var MagicString = class {
6132
6449
  this.lastChunk = last;
6133
6450
  return this;
6134
6451
  }
6135
- overwrite(start, end, content, options) {
6136
- options = options || {};
6137
- return this.update(start, end, content, { ...options, overwrite: !options.contentOnly });
6452
+ overwrite(start, end, content, options2) {
6453
+ options2 = options2 || {};
6454
+ return this.update(start, end, content, { ...options2, overwrite: !options2.contentOnly });
6138
6455
  }
6139
- update(start, end, content, options) {
6456
+ update(start, end, content, options2) {
6140
6457
  if (typeof content !== "string")
6141
6458
  throw new TypeError("replacement content must be a string");
6142
6459
  while (start < 0)
@@ -6151,17 +6468,17 @@ var MagicString = class {
6151
6468
  );
6152
6469
  this._split(start);
6153
6470
  this._split(end);
6154
- if (options === true) {
6471
+ if (options2 === true) {
6155
6472
  if (!warned.storeName) {
6156
6473
  console.warn(
6157
6474
  "The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"
6158
6475
  );
6159
6476
  warned.storeName = true;
6160
6477
  }
6161
- options = { storeName: true };
6478
+ options2 = { storeName: true };
6162
6479
  }
6163
- const storeName = options !== void 0 ? options.storeName : false;
6164
- const overwrite = options !== void 0 ? options.overwrite : false;
6480
+ const storeName = options2 !== void 0 ? options2.storeName : false;
6481
+ const overwrite = options2 !== void 0 ? options2.overwrite : false;
6165
6482
  if (storeName) {
6166
6483
  const original = this.original.slice(start, end);
6167
6484
  Object.defineProperty(this.storedNames, original, {
@@ -6241,6 +6558,26 @@ var MagicString = class {
6241
6558
  }
6242
6559
  return this;
6243
6560
  }
6561
+ reset(start, end) {
6562
+ while (start < 0)
6563
+ start += this.original.length;
6564
+ while (end < 0)
6565
+ end += this.original.length;
6566
+ if (start === end)
6567
+ return this;
6568
+ if (start < 0 || end > this.original.length)
6569
+ throw new Error("Character is out of bounds");
6570
+ if (start > end)
6571
+ throw new Error("end must be greater than start");
6572
+ this._split(start);
6573
+ this._split(end);
6574
+ let chunk = this.byStart[start];
6575
+ while (chunk) {
6576
+ chunk.reset();
6577
+ chunk = end > chunk.end ? this.byStart[chunk.end] : null;
6578
+ }
6579
+ return this;
6580
+ }
6244
6581
  lastChar() {
6245
6582
  if (this.outro.length)
6246
6583
  return this.outro[this.outro.length - 1];
@@ -6529,7 +6866,7 @@ var MagicString = class {
6529
6866
  // src/utils/transformers.ts
6530
6867
  function transformImports(content, config) {
6531
6868
  const s = new MagicString(content);
6532
- s.replaceAll(/@\/registry\/[^/]+/g, config.aliases.components);
6869
+ s.replaceAll(/\$lib\/registry\/[^/]+/g, config.aliases.components);
6533
6870
  s.replaceAll(/\$lib\/utils/g, config.aliases.utils);
6534
6871
  return s.toString();
6535
6872
  }
@@ -6551,11 +6888,11 @@ var add = new Command().command("add").description("add components to your proje
6551
6888
  process.cwd()
6552
6889
  ).option("-p, --path <path>", "the path to add the component to.").action(async (components, opts) => {
6553
6890
  try {
6554
- const options = addOptionsSchema.parse({
6891
+ const options2 = addOptionsSchema.parse({
6555
6892
  components,
6556
6893
  ...opts
6557
6894
  });
6558
- const cwd = path10.resolve(options.cwd);
6895
+ const cwd = path10.resolve(options2.cwd);
6559
6896
  if (!existsSync2(cwd)) {
6560
6897
  logger.error(`The path ${cwd} does not exist. Please try again.`);
6561
6898
  process.exitCode = 1;
@@ -6571,17 +6908,17 @@ var add = new Command().command("add").description("add components to your proje
6571
6908
  process.exitCode = 1;
6572
6909
  return;
6573
6910
  }
6574
- const chosenProxy = options.proxy ?? getEnvProxy();
6911
+ const chosenProxy = options2.proxy ?? getEnvProxy();
6575
6912
  if (chosenProxy) {
6576
- const isCustom = !!options.proxy;
6913
+ const isCustom = !!options2.proxy;
6577
6914
  if (isCustom)
6578
- process.env.HTTP_PROXY = options.proxy;
6915
+ process.env.HTTP_PROXY = options2.proxy;
6579
6916
  logger.warn(
6580
6917
  `You are using a ${isCustom ? "provided" : "system environment"} proxy: ${chalk3.green(chosenProxy)}`
6581
6918
  );
6582
6919
  }
6583
6920
  const registryIndex = await getRegistryIndex();
6584
- let selectedComponents = options.all ? registryIndex.map(({ name }) => name) : options.components;
6921
+ let selectedComponents = options2.all ? registryIndex.map(({ name }) => name) : options2.components;
6585
6922
  if (!selectedComponents?.length) {
6586
6923
  const { components: components2 } = await prompts2({
6587
6924
  type: "multiselect",
@@ -6611,7 +6948,7 @@ var add = new Command().command("add").description("add components to your proje
6611
6948
  }
6612
6949
  logger.info(`Selected components:
6613
6950
  ${logger.highlight(selectedComponents)}`);
6614
- if (!options.yes) {
6951
+ if (!options2.yes) {
6615
6952
  const { proceed } = await prompts2({
6616
6953
  type: "confirm",
6617
6954
  name: "proceed",
@@ -6631,7 +6968,7 @@ ${logger.highlight(selectedComponents)}`);
6631
6968
  const targetDir = await getItemTargetPath(
6632
6969
  config,
6633
6970
  item2,
6634
- options.path ? path10.resolve(cwd, options.path) : void 0
6971
+ options2.path ? path10.resolve(cwd, options2.path) : void 0
6635
6972
  );
6636
6973
  if (!targetDir) {
6637
6974
  continue;
@@ -6646,7 +6983,7 @@ ${logger.highlight(selectedComponents)}`);
6646
6983
  const existingComponent = item2.files.filter((file) => {
6647
6984
  return existsSync2(path10.resolve(targetDir, item2.name, file.name));
6648
6985
  });
6649
- if (existingComponent.length && !options.overwrite) {
6986
+ if (existingComponent.length && !options2.overwrite) {
6650
6987
  if (selectedComponents.includes(item2.name)) {
6651
6988
  logger.warn(
6652
6989
  `
@@ -6672,7 +7009,7 @@ Component ${logger.highlight(
6672
7009
  await fs6.writeFile(filePath, content);
6673
7010
  }
6674
7011
  if (item2.dependencies?.length) {
6675
- if (options.nodep) {
7012
+ if (options2.nodep) {
6676
7013
  item2.dependencies.forEach((dep) => skippedDeps.add(dep));
6677
7014
  continue;
6678
7015
  }
@@ -6685,7 +7022,7 @@ Component ${logger.highlight(
6685
7022
  }
6686
7023
  logger.info("");
6687
7024
  logger.info("");
6688
- if (options.nodep) {
7025
+ if (options2.nodep) {
6689
7026
  logger.warn(
6690
7027
  `Components have installed without dependencies, consider adding the following to your dependencies:
6691
7028
  - ${[
@@ -6893,14 +7230,14 @@ var init2 = new Command2().command("init").description("Configure your SvelteKit
6893
7230
  "-c, --cwd <cwd>",
6894
7231
  "the working directory. defaults to the current directory.",
6895
7232
  process.cwd()
6896
- ).action(async (options) => {
6897
- const cwd = path11.resolve(options.cwd);
7233
+ ).action(async (options2) => {
7234
+ const cwd = path11.resolve(options2.cwd);
6898
7235
  logger.warn("This command assumes a SvelteKit project with Tailwind CSS.");
6899
7236
  logger.warn(
6900
7237
  "If you don't have these, follow the manual steps at https://shadcn-svelte.com/docs/installation."
6901
7238
  );
6902
7239
  logger.warn("");
6903
- if (!options.yes) {
7240
+ if (!options2.yes) {
6904
7241
  const { proceed } = await prompts3([
6905
7242
  {
6906
7243
  type: "confirm",
@@ -6921,7 +7258,7 @@ var init2 = new Command2().command("init").description("Configure your SvelteKit
6921
7258
  return;
6922
7259
  }
6923
7260
  const existingConfig = await getConfig2(cwd);
6924
- const config = await promptForConfig(cwd, existingConfig, options.yes);
7261
+ const config = await promptForConfig(cwd, existingConfig, options2.yes);
6925
7262
  await runInit(cwd, config);
6926
7263
  logger.info("");
6927
7264
  logger.info(`${chalk4.green("Success!")} Project initialization completed.`);
@@ -6936,7 +7273,7 @@ async function promptForConfig(cwd, defaultConfig = null, skip = false) {
6936
7273
  const highlight = logger.highlight;
6937
7274
  const styles2 = await getRegistryStyles();
6938
7275
  const baseColors = await getRegistryBaseColors();
6939
- const options = await prompts3([
7276
+ const options2 = await prompts3([
6940
7277
  {
6941
7278
  type: "toggle",
6942
7279
  name: "typescript",
@@ -7006,16 +7343,16 @@ async function promptForConfig(cwd, defaultConfig = null, skip = false) {
7006
7343
  ]);
7007
7344
  const config = rawConfigSchema.parse({
7008
7345
  $schema: "https://shadcn-svelte.com/schema.json",
7009
- style: options.style,
7010
- typescript: options.typescript,
7346
+ style: options2.style,
7347
+ typescript: options2.typescript,
7011
7348
  tailwind: {
7012
- config: options.tailwindConfig,
7013
- css: options.tailwindCss,
7014
- baseColor: options.tailwindBaseColor
7349
+ config: options2.tailwindConfig,
7350
+ css: options2.tailwindCss,
7351
+ baseColor: options2.tailwindBaseColor
7015
7352
  },
7016
7353
  aliases: {
7017
- utils: options.utils,
7018
- components: options.components
7354
+ utils: options2.utils,
7355
+ components: options2.components
7019
7356
  }
7020
7357
  });
7021
7358
  if (!skip) {
@@ -7104,12 +7441,12 @@ var update = new Command3().command("update").description("update components in
7104
7441
  logger.warn("Make sure you have committed your changes before proceeding.");
7105
7442
  logger.warn("");
7106
7443
  try {
7107
- const options = updateOptionsSchema.parse({
7444
+ const options2 = updateOptionsSchema.parse({
7108
7445
  components: comps,
7109
7446
  ...opts
7110
7447
  });
7111
- const components = options.components;
7112
- const cwd = path12.resolve(options.cwd);
7448
+ const components = options2.components;
7449
+ const cwd = path12.resolve(options2.cwd);
7113
7450
  if (!existsSync4(cwd)) {
7114
7451
  logger.error(`The path ${cwd} does not exist. Please try again.`);
7115
7452
  process.exitCode = 1;
@@ -7149,7 +7486,7 @@ var update = new Command3().command("update").description("update components in
7149
7486
  type: "components:ui",
7150
7487
  files: []
7151
7488
  });
7152
- let selectedComponents = options.all ? existingComponents : [];
7489
+ let selectedComponents = options2.all ? existingComponents : [];
7153
7490
  if (!selectedComponents.length && components !== void 0) {
7154
7491
  selectedComponents = existingComponents.filter(
7155
7492
  (component) => components.includes(component.name)
@@ -7235,7 +7572,7 @@ The ${logger.highlight(
7235
7572
  files2.map((file) => chalk5.white(`- ${path12.relative(cwd, file)}`)).join("\n")
7236
7573
  );
7237
7574
  }
7238
- if (Object.keys(componentsToRemove)) {
7575
+ if (Object.keys(componentsToRemove).length > 0) {
7239
7576
  logger.warn("\nYou may want to remove them.");
7240
7577
  }
7241
7578
  } catch (e) {