@depot/cli 0.0.1-cli.2.36.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/lib/main.js ADDED
@@ -0,0 +1,2378 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __export = (target, all) => {
12
+ for (var name in all)
13
+ __defProp(target, name, { get: all[name], enumerable: true });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
31
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
+ var __accessCheck = (obj, member, msg) => {
33
+ if (!member.has(obj))
34
+ throw TypeError("Cannot " + msg);
35
+ };
36
+ var __privateGet = (obj, member, getter) => {
37
+ __accessCheck(obj, member, "read from private field");
38
+ return getter ? getter.call(obj) : member.get(obj);
39
+ };
40
+ var __privateAdd = (obj, member, value) => {
41
+ if (member.has(obj))
42
+ throw TypeError("Cannot add the same private member more than once");
43
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
44
+ };
45
+ var __privateSet = (obj, member, value, setter) => {
46
+ __accessCheck(obj, member, "write to private field");
47
+ setter ? setter.call(obj, value) : member.set(obj, value);
48
+ return value;
49
+ };
50
+ var __privateMethod = (obj, member, method) => {
51
+ __accessCheck(obj, member, "access private method");
52
+ return method;
53
+ };
54
+
55
+ // node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
56
+ var require_windows = __commonJS({
57
+ "node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module2) {
58
+ module2.exports = isexe;
59
+ isexe.sync = sync;
60
+ var fs2 = require("fs");
61
+ function checkPathExt(path5, options) {
62
+ var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
63
+ if (!pathext) {
64
+ return true;
65
+ }
66
+ pathext = pathext.split(";");
67
+ if (pathext.indexOf("") !== -1) {
68
+ return true;
69
+ }
70
+ for (var i = 0; i < pathext.length; i++) {
71
+ var p = pathext[i].toLowerCase();
72
+ if (p && path5.substr(-p.length).toLowerCase() === p) {
73
+ return true;
74
+ }
75
+ }
76
+ return false;
77
+ }
78
+ function checkStat(stat, path5, options) {
79
+ if (!stat.isSymbolicLink() && !stat.isFile()) {
80
+ return false;
81
+ }
82
+ return checkPathExt(path5, options);
83
+ }
84
+ function isexe(path5, options, cb) {
85
+ fs2.stat(path5, function(er, stat) {
86
+ cb(er, er ? false : checkStat(stat, path5, options));
87
+ });
88
+ }
89
+ function sync(path5, options) {
90
+ return checkStat(fs2.statSync(path5), path5, options);
91
+ }
92
+ }
93
+ });
94
+
95
+ // node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
96
+ var require_mode = __commonJS({
97
+ "node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module2) {
98
+ module2.exports = isexe;
99
+ isexe.sync = sync;
100
+ var fs2 = require("fs");
101
+ function isexe(path5, options, cb) {
102
+ fs2.stat(path5, function(er, stat) {
103
+ cb(er, er ? false : checkStat(stat, options));
104
+ });
105
+ }
106
+ function sync(path5, options) {
107
+ return checkStat(fs2.statSync(path5), options);
108
+ }
109
+ function checkStat(stat, options) {
110
+ return stat.isFile() && checkMode(stat, options);
111
+ }
112
+ function checkMode(stat, options) {
113
+ var mod = stat.mode;
114
+ var uid = stat.uid;
115
+ var gid = stat.gid;
116
+ var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
117
+ var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
118
+ var u = parseInt("100", 8);
119
+ var g = parseInt("010", 8);
120
+ var o = parseInt("001", 8);
121
+ var ug = u | g;
122
+ var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
123
+ return ret;
124
+ }
125
+ }
126
+ });
127
+
128
+ // node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
129
+ var require_isexe = __commonJS({
130
+ "node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module2) {
131
+ var fs2 = require("fs");
132
+ var core;
133
+ if (process.platform === "win32" || global.TESTING_WINDOWS) {
134
+ core = require_windows();
135
+ } else {
136
+ core = require_mode();
137
+ }
138
+ module2.exports = isexe;
139
+ isexe.sync = sync;
140
+ function isexe(path5, options, cb) {
141
+ if (typeof options === "function") {
142
+ cb = options;
143
+ options = {};
144
+ }
145
+ if (!cb) {
146
+ if (typeof Promise !== "function") {
147
+ throw new TypeError("callback not provided");
148
+ }
149
+ return new Promise(function(resolve, reject) {
150
+ isexe(path5, options || {}, function(er, is) {
151
+ if (er) {
152
+ reject(er);
153
+ } else {
154
+ resolve(is);
155
+ }
156
+ });
157
+ });
158
+ }
159
+ core(path5, options || {}, function(er, is) {
160
+ if (er) {
161
+ if (er.code === "EACCES" || options && options.ignoreErrors) {
162
+ er = null;
163
+ is = false;
164
+ }
165
+ }
166
+ cb(er, is);
167
+ });
168
+ }
169
+ function sync(path5, options) {
170
+ try {
171
+ return core.sync(path5, options || {});
172
+ } catch (er) {
173
+ if (options && options.ignoreErrors || er.code === "EACCES") {
174
+ return false;
175
+ } else {
176
+ throw er;
177
+ }
178
+ }
179
+ }
180
+ }
181
+ });
182
+
183
+ // node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
184
+ var require_which = __commonJS({
185
+ "node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module2) {
186
+ var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
187
+ var path5 = require("path");
188
+ var COLON = isWindows ? ";" : ":";
189
+ var isexe = require_isexe();
190
+ var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
191
+ var getPathInfo = (cmd, opt) => {
192
+ const colon = opt.colon || COLON;
193
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
194
+ // windows always checks the cwd first
195
+ ...isWindows ? [process.cwd()] : [],
196
+ ...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
197
+ "").split(colon)
198
+ ];
199
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
200
+ const pathExt = isWindows ? pathExtExe.split(colon) : [""];
201
+ if (isWindows) {
202
+ if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
203
+ pathExt.unshift("");
204
+ }
205
+ return {
206
+ pathEnv,
207
+ pathExt,
208
+ pathExtExe
209
+ };
210
+ };
211
+ var which = (cmd, opt, cb) => {
212
+ if (typeof opt === "function") {
213
+ cb = opt;
214
+ opt = {};
215
+ }
216
+ if (!opt)
217
+ opt = {};
218
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
219
+ const found = [];
220
+ const step = (i) => new Promise((resolve, reject) => {
221
+ if (i === pathEnv.length)
222
+ return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
223
+ const ppRaw = pathEnv[i];
224
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
225
+ const pCmd = path5.join(pathPart, cmd);
226
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
227
+ resolve(subStep(p, i, 0));
228
+ });
229
+ const subStep = (p, i, ii) => new Promise((resolve, reject) => {
230
+ if (ii === pathExt.length)
231
+ return resolve(step(i + 1));
232
+ const ext = pathExt[ii];
233
+ isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
234
+ if (!er && is) {
235
+ if (opt.all)
236
+ found.push(p + ext);
237
+ else
238
+ return resolve(p + ext);
239
+ }
240
+ return resolve(subStep(p, i, ii + 1));
241
+ });
242
+ });
243
+ return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
244
+ };
245
+ var whichSync = (cmd, opt) => {
246
+ opt = opt || {};
247
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
248
+ const found = [];
249
+ for (let i = 0; i < pathEnv.length; i++) {
250
+ const ppRaw = pathEnv[i];
251
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
252
+ const pCmd = path5.join(pathPart, cmd);
253
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
254
+ for (let j = 0; j < pathExt.length; j++) {
255
+ const cur = p + pathExt[j];
256
+ try {
257
+ const is = isexe.sync(cur, { pathExt: pathExtExe });
258
+ if (is) {
259
+ if (opt.all)
260
+ found.push(cur);
261
+ else
262
+ return cur;
263
+ }
264
+ } catch (ex) {
265
+ }
266
+ }
267
+ }
268
+ if (opt.all && found.length)
269
+ return found;
270
+ if (opt.nothrow)
271
+ return null;
272
+ throw getNotFoundError(cmd);
273
+ };
274
+ module2.exports = which;
275
+ which.sync = whichSync;
276
+ }
277
+ });
278
+
279
+ // node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
280
+ var require_path_key = __commonJS({
281
+ "node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js"(exports, module2) {
282
+ "use strict";
283
+ var pathKey2 = (options = {}) => {
284
+ const environment = options.env || process.env;
285
+ const platform = options.platform || process.platform;
286
+ if (platform !== "win32") {
287
+ return "PATH";
288
+ }
289
+ return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
290
+ };
291
+ module2.exports = pathKey2;
292
+ module2.exports.default = pathKey2;
293
+ }
294
+ });
295
+
296
+ // node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/resolveCommand.js
297
+ var require_resolveCommand = __commonJS({
298
+ "node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module2) {
299
+ "use strict";
300
+ var path5 = require("path");
301
+ var which = require_which();
302
+ var getPathKey = require_path_key();
303
+ function resolveCommandAttempt(parsed, withoutPathExt) {
304
+ const env = parsed.options.env || process.env;
305
+ const cwd = process.cwd();
306
+ const hasCustomCwd = parsed.options.cwd != null;
307
+ const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
308
+ if (shouldSwitchCwd) {
309
+ try {
310
+ process.chdir(parsed.options.cwd);
311
+ } catch (err) {
312
+ }
313
+ }
314
+ let resolved;
315
+ try {
316
+ resolved = which.sync(parsed.command, {
317
+ path: env[getPathKey({ env })],
318
+ pathExt: withoutPathExt ? path5.delimiter : void 0
319
+ });
320
+ } catch (e) {
321
+ } finally {
322
+ if (shouldSwitchCwd) {
323
+ process.chdir(cwd);
324
+ }
325
+ }
326
+ if (resolved) {
327
+ resolved = path5.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
328
+ }
329
+ return resolved;
330
+ }
331
+ function resolveCommand(parsed) {
332
+ return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
333
+ }
334
+ module2.exports = resolveCommand;
335
+ }
336
+ });
337
+
338
+ // node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/escape.js
339
+ var require_escape = __commonJS({
340
+ "node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/escape.js"(exports, module2) {
341
+ "use strict";
342
+ var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
343
+ function escapeCommand(arg) {
344
+ arg = arg.replace(metaCharsRegExp, "^$1");
345
+ return arg;
346
+ }
347
+ function escapeArgument(arg, doubleEscapeMetaChars) {
348
+ arg = `${arg}`;
349
+ arg = arg.replace(/(\\*)"/g, '$1$1\\"');
350
+ arg = arg.replace(/(\\*)$/, "$1$1");
351
+ arg = `"${arg}"`;
352
+ arg = arg.replace(metaCharsRegExp, "^$1");
353
+ if (doubleEscapeMetaChars) {
354
+ arg = arg.replace(metaCharsRegExp, "^$1");
355
+ }
356
+ return arg;
357
+ }
358
+ module2.exports.command = escapeCommand;
359
+ module2.exports.argument = escapeArgument;
360
+ }
361
+ });
362
+
363
+ // node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
364
+ var require_shebang_regex = __commonJS({
365
+ "node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js"(exports, module2) {
366
+ "use strict";
367
+ module2.exports = /^#!(.*)/;
368
+ }
369
+ });
370
+
371
+ // node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
372
+ var require_shebang_command = __commonJS({
373
+ "node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js"(exports, module2) {
374
+ "use strict";
375
+ var shebangRegex = require_shebang_regex();
376
+ module2.exports = (string = "") => {
377
+ const match = string.match(shebangRegex);
378
+ if (!match) {
379
+ return null;
380
+ }
381
+ const [path5, argument] = match[0].replace(/#! ?/, "").split(" ");
382
+ const binary = path5.split("/").pop();
383
+ if (binary === "env") {
384
+ return argument;
385
+ }
386
+ return argument ? `${binary} ${argument}` : binary;
387
+ };
388
+ }
389
+ });
390
+
391
+ // node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/readShebang.js
392
+ var require_readShebang = __commonJS({
393
+ "node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module2) {
394
+ "use strict";
395
+ var fs2 = require("fs");
396
+ var shebangCommand = require_shebang_command();
397
+ function readShebang(command) {
398
+ const size = 150;
399
+ const buffer = Buffer.alloc(size);
400
+ let fd;
401
+ try {
402
+ fd = fs2.openSync(command, "r");
403
+ fs2.readSync(fd, buffer, 0, size, 0);
404
+ fs2.closeSync(fd);
405
+ } catch (e) {
406
+ }
407
+ return shebangCommand(buffer.toString());
408
+ }
409
+ module2.exports = readShebang;
410
+ }
411
+ });
412
+
413
+ // node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/parse.js
414
+ var require_parse = __commonJS({
415
+ "node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/parse.js"(exports, module2) {
416
+ "use strict";
417
+ var path5 = require("path");
418
+ var resolveCommand = require_resolveCommand();
419
+ var escape = require_escape();
420
+ var readShebang = require_readShebang();
421
+ var isWin = process.platform === "win32";
422
+ var isExecutableRegExp = /\.(?:com|exe)$/i;
423
+ var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
424
+ function detectShebang(parsed) {
425
+ parsed.file = resolveCommand(parsed);
426
+ const shebang = parsed.file && readShebang(parsed.file);
427
+ if (shebang) {
428
+ parsed.args.unshift(parsed.file);
429
+ parsed.command = shebang;
430
+ return resolveCommand(parsed);
431
+ }
432
+ return parsed.file;
433
+ }
434
+ function parseNonShell(parsed) {
435
+ if (!isWin) {
436
+ return parsed;
437
+ }
438
+ const commandFile = detectShebang(parsed);
439
+ const needsShell = !isExecutableRegExp.test(commandFile);
440
+ if (parsed.options.forceShell || needsShell) {
441
+ const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
442
+ parsed.command = path5.normalize(parsed.command);
443
+ parsed.command = escape.command(parsed.command);
444
+ parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
445
+ const shellCommand = [parsed.command].concat(parsed.args).join(" ");
446
+ parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
447
+ parsed.command = process.env.comspec || "cmd.exe";
448
+ parsed.options.windowsVerbatimArguments = true;
449
+ }
450
+ return parsed;
451
+ }
452
+ function parse(command, args, options) {
453
+ if (args && !Array.isArray(args)) {
454
+ options = args;
455
+ args = null;
456
+ }
457
+ args = args ? args.slice(0) : [];
458
+ options = Object.assign({}, options);
459
+ const parsed = {
460
+ command,
461
+ args,
462
+ options,
463
+ file: void 0,
464
+ original: {
465
+ command,
466
+ args
467
+ }
468
+ };
469
+ return options.shell ? parsed : parseNonShell(parsed);
470
+ }
471
+ module2.exports = parse;
472
+ }
473
+ });
474
+
475
+ // node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/enoent.js
476
+ var require_enoent = __commonJS({
477
+ "node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/enoent.js"(exports, module2) {
478
+ "use strict";
479
+ var isWin = process.platform === "win32";
480
+ function notFoundError(original, syscall) {
481
+ return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
482
+ code: "ENOENT",
483
+ errno: "ENOENT",
484
+ syscall: `${syscall} ${original.command}`,
485
+ path: original.command,
486
+ spawnargs: original.args
487
+ });
488
+ }
489
+ function hookChildProcess(cp, parsed) {
490
+ if (!isWin) {
491
+ return;
492
+ }
493
+ const originalEmit = cp.emit;
494
+ cp.emit = function(name, arg1) {
495
+ if (name === "exit") {
496
+ const err = verifyENOENT(arg1, parsed, "spawn");
497
+ if (err) {
498
+ return originalEmit.call(cp, "error", err);
499
+ }
500
+ }
501
+ return originalEmit.apply(cp, arguments);
502
+ };
503
+ }
504
+ function verifyENOENT(status, parsed) {
505
+ if (isWin && status === 1 && !parsed.file) {
506
+ return notFoundError(parsed.original, "spawn");
507
+ }
508
+ return null;
509
+ }
510
+ function verifyENOENTSync(status, parsed) {
511
+ if (isWin && status === 1 && !parsed.file) {
512
+ return notFoundError(parsed.original, "spawnSync");
513
+ }
514
+ return null;
515
+ }
516
+ module2.exports = {
517
+ hookChildProcess,
518
+ verifyENOENT,
519
+ verifyENOENTSync,
520
+ notFoundError
521
+ };
522
+ }
523
+ });
524
+
525
+ // node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/index.js
526
+ var require_cross_spawn = __commonJS({
527
+ "node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/index.js"(exports, module2) {
528
+ "use strict";
529
+ var cp = require("child_process");
530
+ var parse = require_parse();
531
+ var enoent = require_enoent();
532
+ function spawn(command, args, options) {
533
+ const parsed = parse(command, args, options);
534
+ const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
535
+ enoent.hookChildProcess(spawned, parsed);
536
+ return spawned;
537
+ }
538
+ function spawnSync(command, args, options) {
539
+ const parsed = parse(command, args, options);
540
+ const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
541
+ result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
542
+ return result;
543
+ }
544
+ module2.exports = spawn;
545
+ module2.exports.spawn = spawn;
546
+ module2.exports.sync = spawnSync;
547
+ module2.exports._parse = parse;
548
+ module2.exports._enoent = enoent;
549
+ }
550
+ });
551
+
552
+ // node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js
553
+ var require_merge_stream = __commonJS({
554
+ "node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js"(exports, module2) {
555
+ "use strict";
556
+ var { PassThrough } = require("stream");
557
+ module2.exports = function() {
558
+ var sources = [];
559
+ var output = new PassThrough({ objectMode: true });
560
+ output.setMaxListeners(0);
561
+ output.add = add;
562
+ output.isEmpty = isEmpty;
563
+ output.on("unpipe", remove);
564
+ Array.prototype.slice.call(arguments).forEach(add);
565
+ return output;
566
+ function add(source) {
567
+ if (Array.isArray(source)) {
568
+ source.forEach(add);
569
+ return this;
570
+ }
571
+ sources.push(source);
572
+ source.once("end", remove.bind(null, source));
573
+ source.once("error", output.emit.bind(output, "error"));
574
+ source.pipe(output, { end: false });
575
+ return this;
576
+ }
577
+ function isEmpty() {
578
+ return sources.length == 0;
579
+ }
580
+ function remove(source) {
581
+ sources = sources.filter(function(it) {
582
+ return it !== source;
583
+ });
584
+ if (!sources.length && output.readable) {
585
+ output.end();
586
+ }
587
+ }
588
+ };
589
+ }
590
+ });
591
+
592
+ // src/main.ts
593
+ var main_exports = {};
594
+ __export(main_exports, {
595
+ depot: () => depot,
596
+ depotBinaryPath: () => depotBinaryPath
597
+ });
598
+ module.exports = __toCommonJS(main_exports);
599
+
600
+ // node_modules/.pnpm/execa@8.0.1/node_modules/execa/index.js
601
+ var import_node_buffer2 = require("buffer");
602
+ var import_node_path2 = __toESM(require("path"), 1);
603
+ var import_node_child_process3 = __toESM(require("child_process"), 1);
604
+ var import_node_process4 = __toESM(require("process"), 1);
605
+ var import_cross_spawn = __toESM(require_cross_spawn(), 1);
606
+
607
+ // node_modules/.pnpm/strip-final-newline@3.0.0/node_modules/strip-final-newline/index.js
608
+ function stripFinalNewline(input) {
609
+ const LF = typeof input === "string" ? "\n" : "\n".charCodeAt();
610
+ const CR = typeof input === "string" ? "\r" : "\r".charCodeAt();
611
+ if (input[input.length - 1] === LF) {
612
+ input = input.slice(0, -1);
613
+ }
614
+ if (input[input.length - 1] === CR) {
615
+ input = input.slice(0, -1);
616
+ }
617
+ return input;
618
+ }
619
+
620
+ // node_modules/.pnpm/npm-run-path@5.1.0/node_modules/npm-run-path/index.js
621
+ var import_node_process = __toESM(require("process"), 1);
622
+ var import_node_path = __toESM(require("path"), 1);
623
+ var import_node_url = __toESM(require("url"), 1);
624
+
625
+ // node_modules/.pnpm/path-key@4.0.0/node_modules/path-key/index.js
626
+ function pathKey(options = {}) {
627
+ const {
628
+ env = process.env,
629
+ platform = process.platform
630
+ } = options;
631
+ if (platform !== "win32") {
632
+ return "PATH";
633
+ }
634
+ return Object.keys(env).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
635
+ }
636
+
637
+ // node_modules/.pnpm/npm-run-path@5.1.0/node_modules/npm-run-path/index.js
638
+ function npmRunPath(options = {}) {
639
+ const {
640
+ cwd = import_node_process.default.cwd(),
641
+ path: path_ = import_node_process.default.env[pathKey()],
642
+ execPath = import_node_process.default.execPath
643
+ } = options;
644
+ let previous;
645
+ const cwdString = cwd instanceof URL ? import_node_url.default.fileURLToPath(cwd) : cwd;
646
+ let cwdPath = import_node_path.default.resolve(cwdString);
647
+ const result = [];
648
+ while (previous !== cwdPath) {
649
+ result.push(import_node_path.default.join(cwdPath, "node_modules/.bin"));
650
+ previous = cwdPath;
651
+ cwdPath = import_node_path.default.resolve(cwdPath, "..");
652
+ }
653
+ result.push(import_node_path.default.resolve(cwdString, execPath, ".."));
654
+ return [...result, path_].join(import_node_path.default.delimiter);
655
+ }
656
+ function npmRunPathEnv({ env = import_node_process.default.env, ...options } = {}) {
657
+ env = { ...env };
658
+ const path5 = pathKey({ env });
659
+ options.path = env[path5];
660
+ env[path5] = npmRunPath(options);
661
+ return env;
662
+ }
663
+
664
+ // node_modules/.pnpm/mimic-fn@4.0.0/node_modules/mimic-fn/index.js
665
+ var copyProperty = (to, from, property, ignoreNonConfigurable) => {
666
+ if (property === "length" || property === "prototype") {
667
+ return;
668
+ }
669
+ if (property === "arguments" || property === "caller") {
670
+ return;
671
+ }
672
+ const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
673
+ const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
674
+ if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
675
+ return;
676
+ }
677
+ Object.defineProperty(to, property, fromDescriptor);
678
+ };
679
+ var canCopyProperty = function(toDescriptor, fromDescriptor) {
680
+ return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
681
+ };
682
+ var changePrototype = (to, from) => {
683
+ const fromPrototype = Object.getPrototypeOf(from);
684
+ if (fromPrototype === Object.getPrototypeOf(to)) {
685
+ return;
686
+ }
687
+ Object.setPrototypeOf(to, fromPrototype);
688
+ };
689
+ var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
690
+ ${fromBody}`;
691
+ var toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
692
+ var toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
693
+ var changeToString = (to, from, name) => {
694
+ const withName = name === "" ? "" : `with ${name.trim()}() `;
695
+ const newToString = wrappedToString.bind(null, withName, from.toString());
696
+ Object.defineProperty(newToString, "name", toStringName);
697
+ Object.defineProperty(to, "toString", { ...toStringDescriptor, value: newToString });
698
+ };
699
+ function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
700
+ const { name } = to;
701
+ for (const property of Reflect.ownKeys(from)) {
702
+ copyProperty(to, from, property, ignoreNonConfigurable);
703
+ }
704
+ changePrototype(to, from);
705
+ changeToString(to, from, name);
706
+ return to;
707
+ }
708
+
709
+ // node_modules/.pnpm/onetime@6.0.0/node_modules/onetime/index.js
710
+ var calledFunctions = /* @__PURE__ */ new WeakMap();
711
+ var onetime = (function_, options = {}) => {
712
+ if (typeof function_ !== "function") {
713
+ throw new TypeError("Expected a function");
714
+ }
715
+ let returnValue;
716
+ let callCount = 0;
717
+ const functionName = function_.displayName || function_.name || "<anonymous>";
718
+ const onetime2 = function(...arguments_) {
719
+ calledFunctions.set(onetime2, ++callCount);
720
+ if (callCount === 1) {
721
+ returnValue = function_.apply(this, arguments_);
722
+ function_ = null;
723
+ } else if (options.throw === true) {
724
+ throw new Error(`Function \`${functionName}\` can only be called once`);
725
+ }
726
+ return returnValue;
727
+ };
728
+ mimicFunction(onetime2, function_);
729
+ calledFunctions.set(onetime2, callCount);
730
+ return onetime2;
731
+ };
732
+ onetime.callCount = (function_) => {
733
+ if (!calledFunctions.has(function_)) {
734
+ throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
735
+ }
736
+ return calledFunctions.get(function_);
737
+ };
738
+ var onetime_default = onetime;
739
+
740
+ // node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/error.js
741
+ var import_node_process2 = __toESM(require("process"), 1);
742
+
743
+ // node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/main.js
744
+ var import_node_os2 = require("os");
745
+
746
+ // node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/realtime.js
747
+ var getRealtimeSignals = () => {
748
+ const length = SIGRTMAX - SIGRTMIN + 1;
749
+ return Array.from({ length }, getRealtimeSignal);
750
+ };
751
+ var getRealtimeSignal = (value, index) => ({
752
+ name: `SIGRT${index + 1}`,
753
+ number: SIGRTMIN + index,
754
+ action: "terminate",
755
+ description: "Application-specific signal (realtime)",
756
+ standard: "posix"
757
+ });
758
+ var SIGRTMIN = 34;
759
+ var SIGRTMAX = 64;
760
+
761
+ // node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/signals.js
762
+ var import_node_os = require("os");
763
+
764
+ // node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/core.js
765
+ var SIGNALS = [
766
+ {
767
+ name: "SIGHUP",
768
+ number: 1,
769
+ action: "terminate",
770
+ description: "Terminal closed",
771
+ standard: "posix"
772
+ },
773
+ {
774
+ name: "SIGINT",
775
+ number: 2,
776
+ action: "terminate",
777
+ description: "User interruption with CTRL-C",
778
+ standard: "ansi"
779
+ },
780
+ {
781
+ name: "SIGQUIT",
782
+ number: 3,
783
+ action: "core",
784
+ description: "User interruption with CTRL-\\",
785
+ standard: "posix"
786
+ },
787
+ {
788
+ name: "SIGILL",
789
+ number: 4,
790
+ action: "core",
791
+ description: "Invalid machine instruction",
792
+ standard: "ansi"
793
+ },
794
+ {
795
+ name: "SIGTRAP",
796
+ number: 5,
797
+ action: "core",
798
+ description: "Debugger breakpoint",
799
+ standard: "posix"
800
+ },
801
+ {
802
+ name: "SIGABRT",
803
+ number: 6,
804
+ action: "core",
805
+ description: "Aborted",
806
+ standard: "ansi"
807
+ },
808
+ {
809
+ name: "SIGIOT",
810
+ number: 6,
811
+ action: "core",
812
+ description: "Aborted",
813
+ standard: "bsd"
814
+ },
815
+ {
816
+ name: "SIGBUS",
817
+ number: 7,
818
+ action: "core",
819
+ description: "Bus error due to misaligned, non-existing address or paging error",
820
+ standard: "bsd"
821
+ },
822
+ {
823
+ name: "SIGEMT",
824
+ number: 7,
825
+ action: "terminate",
826
+ description: "Command should be emulated but is not implemented",
827
+ standard: "other"
828
+ },
829
+ {
830
+ name: "SIGFPE",
831
+ number: 8,
832
+ action: "core",
833
+ description: "Floating point arithmetic error",
834
+ standard: "ansi"
835
+ },
836
+ {
837
+ name: "SIGKILL",
838
+ number: 9,
839
+ action: "terminate",
840
+ description: "Forced termination",
841
+ standard: "posix",
842
+ forced: true
843
+ },
844
+ {
845
+ name: "SIGUSR1",
846
+ number: 10,
847
+ action: "terminate",
848
+ description: "Application-specific signal",
849
+ standard: "posix"
850
+ },
851
+ {
852
+ name: "SIGSEGV",
853
+ number: 11,
854
+ action: "core",
855
+ description: "Segmentation fault",
856
+ standard: "ansi"
857
+ },
858
+ {
859
+ name: "SIGUSR2",
860
+ number: 12,
861
+ action: "terminate",
862
+ description: "Application-specific signal",
863
+ standard: "posix"
864
+ },
865
+ {
866
+ name: "SIGPIPE",
867
+ number: 13,
868
+ action: "terminate",
869
+ description: "Broken pipe or socket",
870
+ standard: "posix"
871
+ },
872
+ {
873
+ name: "SIGALRM",
874
+ number: 14,
875
+ action: "terminate",
876
+ description: "Timeout or timer",
877
+ standard: "posix"
878
+ },
879
+ {
880
+ name: "SIGTERM",
881
+ number: 15,
882
+ action: "terminate",
883
+ description: "Termination",
884
+ standard: "ansi"
885
+ },
886
+ {
887
+ name: "SIGSTKFLT",
888
+ number: 16,
889
+ action: "terminate",
890
+ description: "Stack is empty or overflowed",
891
+ standard: "other"
892
+ },
893
+ {
894
+ name: "SIGCHLD",
895
+ number: 17,
896
+ action: "ignore",
897
+ description: "Child process terminated, paused or unpaused",
898
+ standard: "posix"
899
+ },
900
+ {
901
+ name: "SIGCLD",
902
+ number: 17,
903
+ action: "ignore",
904
+ description: "Child process terminated, paused or unpaused",
905
+ standard: "other"
906
+ },
907
+ {
908
+ name: "SIGCONT",
909
+ number: 18,
910
+ action: "unpause",
911
+ description: "Unpaused",
912
+ standard: "posix",
913
+ forced: true
914
+ },
915
+ {
916
+ name: "SIGSTOP",
917
+ number: 19,
918
+ action: "pause",
919
+ description: "Paused",
920
+ standard: "posix",
921
+ forced: true
922
+ },
923
+ {
924
+ name: "SIGTSTP",
925
+ number: 20,
926
+ action: "pause",
927
+ description: 'Paused using CTRL-Z or "suspend"',
928
+ standard: "posix"
929
+ },
930
+ {
931
+ name: "SIGTTIN",
932
+ number: 21,
933
+ action: "pause",
934
+ description: "Background process cannot read terminal input",
935
+ standard: "posix"
936
+ },
937
+ {
938
+ name: "SIGBREAK",
939
+ number: 21,
940
+ action: "terminate",
941
+ description: "User interruption with CTRL-BREAK",
942
+ standard: "other"
943
+ },
944
+ {
945
+ name: "SIGTTOU",
946
+ number: 22,
947
+ action: "pause",
948
+ description: "Background process cannot write to terminal output",
949
+ standard: "posix"
950
+ },
951
+ {
952
+ name: "SIGURG",
953
+ number: 23,
954
+ action: "ignore",
955
+ description: "Socket received out-of-band data",
956
+ standard: "bsd"
957
+ },
958
+ {
959
+ name: "SIGXCPU",
960
+ number: 24,
961
+ action: "core",
962
+ description: "Process timed out",
963
+ standard: "bsd"
964
+ },
965
+ {
966
+ name: "SIGXFSZ",
967
+ number: 25,
968
+ action: "core",
969
+ description: "File too big",
970
+ standard: "bsd"
971
+ },
972
+ {
973
+ name: "SIGVTALRM",
974
+ number: 26,
975
+ action: "terminate",
976
+ description: "Timeout or timer",
977
+ standard: "bsd"
978
+ },
979
+ {
980
+ name: "SIGPROF",
981
+ number: 27,
982
+ action: "terminate",
983
+ description: "Timeout or timer",
984
+ standard: "bsd"
985
+ },
986
+ {
987
+ name: "SIGWINCH",
988
+ number: 28,
989
+ action: "ignore",
990
+ description: "Terminal window size changed",
991
+ standard: "bsd"
992
+ },
993
+ {
994
+ name: "SIGIO",
995
+ number: 29,
996
+ action: "terminate",
997
+ description: "I/O is available",
998
+ standard: "other"
999
+ },
1000
+ {
1001
+ name: "SIGPOLL",
1002
+ number: 29,
1003
+ action: "terminate",
1004
+ description: "Watched event",
1005
+ standard: "other"
1006
+ },
1007
+ {
1008
+ name: "SIGINFO",
1009
+ number: 29,
1010
+ action: "ignore",
1011
+ description: "Request for process information",
1012
+ standard: "other"
1013
+ },
1014
+ {
1015
+ name: "SIGPWR",
1016
+ number: 30,
1017
+ action: "terminate",
1018
+ description: "Device running out of power",
1019
+ standard: "systemv"
1020
+ },
1021
+ {
1022
+ name: "SIGSYS",
1023
+ number: 31,
1024
+ action: "core",
1025
+ description: "Invalid system call",
1026
+ standard: "other"
1027
+ },
1028
+ {
1029
+ name: "SIGUNUSED",
1030
+ number: 31,
1031
+ action: "terminate",
1032
+ description: "Invalid system call",
1033
+ standard: "other"
1034
+ }
1035
+ ];
1036
+
1037
+ // node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/signals.js
1038
+ var getSignals = () => {
1039
+ const realtimeSignals = getRealtimeSignals();
1040
+ const signals2 = [...SIGNALS, ...realtimeSignals].map(normalizeSignal);
1041
+ return signals2;
1042
+ };
1043
+ var normalizeSignal = ({
1044
+ name,
1045
+ number: defaultNumber,
1046
+ description,
1047
+ action,
1048
+ forced = false,
1049
+ standard
1050
+ }) => {
1051
+ const {
1052
+ signals: { [name]: constantSignal }
1053
+ } = import_node_os.constants;
1054
+ const supported = constantSignal !== void 0;
1055
+ const number = supported ? constantSignal : defaultNumber;
1056
+ return { name, number, description, supported, action, forced, standard };
1057
+ };
1058
+
1059
+ // node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/main.js
1060
+ var getSignalsByName = () => {
1061
+ const signals2 = getSignals();
1062
+ return Object.fromEntries(signals2.map(getSignalByName));
1063
+ };
1064
+ var getSignalByName = ({
1065
+ name,
1066
+ number,
1067
+ description,
1068
+ supported,
1069
+ action,
1070
+ forced,
1071
+ standard
1072
+ }) => [name, { name, number, description, supported, action, forced, standard }];
1073
+ var signalsByName = getSignalsByName();
1074
+ var getSignalsByNumber = () => {
1075
+ const signals2 = getSignals();
1076
+ const length = SIGRTMAX + 1;
1077
+ const signalsA = Array.from(
1078
+ { length },
1079
+ (value, number) => getSignalByNumber(number, signals2)
1080
+ );
1081
+ return Object.assign({}, ...signalsA);
1082
+ };
1083
+ var getSignalByNumber = (number, signals2) => {
1084
+ const signal = findSignalByNumber(number, signals2);
1085
+ if (signal === void 0) {
1086
+ return {};
1087
+ }
1088
+ const { name, description, supported, action, forced, standard } = signal;
1089
+ return {
1090
+ [number]: {
1091
+ name,
1092
+ number,
1093
+ description,
1094
+ supported,
1095
+ action,
1096
+ forced,
1097
+ standard
1098
+ }
1099
+ };
1100
+ };
1101
+ var findSignalByNumber = (number, signals2) => {
1102
+ const signal = signals2.find(({ name }) => import_node_os2.constants.signals[name] === number);
1103
+ if (signal !== void 0) {
1104
+ return signal;
1105
+ }
1106
+ return signals2.find((signalA) => signalA.number === number);
1107
+ };
1108
+ var signalsByNumber = getSignalsByNumber();
1109
+
1110
+ // node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/error.js
1111
+ var getErrorPrefix = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled }) => {
1112
+ if (timedOut) {
1113
+ return `timed out after ${timeout} milliseconds`;
1114
+ }
1115
+ if (isCanceled) {
1116
+ return "was canceled";
1117
+ }
1118
+ if (errorCode !== void 0) {
1119
+ return `failed with ${errorCode}`;
1120
+ }
1121
+ if (signal !== void 0) {
1122
+ return `was killed with ${signal} (${signalDescription})`;
1123
+ }
1124
+ if (exitCode !== void 0) {
1125
+ return `failed with exit code ${exitCode}`;
1126
+ }
1127
+ return "failed";
1128
+ };
1129
+ var makeError = ({
1130
+ stdout,
1131
+ stderr,
1132
+ all,
1133
+ error,
1134
+ signal,
1135
+ exitCode,
1136
+ command,
1137
+ escapedCommand,
1138
+ timedOut,
1139
+ isCanceled,
1140
+ killed,
1141
+ parsed: { options: { timeout, cwd = import_node_process2.default.cwd() } }
1142
+ }) => {
1143
+ exitCode = exitCode === null ? void 0 : exitCode;
1144
+ signal = signal === null ? void 0 : signal;
1145
+ const signalDescription = signal === void 0 ? void 0 : signalsByName[signal].description;
1146
+ const errorCode = error && error.code;
1147
+ const prefix = getErrorPrefix({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled });
1148
+ const execaMessage = `Command ${prefix}: ${command}`;
1149
+ const isError = Object.prototype.toString.call(error) === "[object Error]";
1150
+ const shortMessage = isError ? `${execaMessage}
1151
+ ${error.message}` : execaMessage;
1152
+ const message = [shortMessage, stderr, stdout].filter(Boolean).join("\n");
1153
+ if (isError) {
1154
+ error.originalMessage = error.message;
1155
+ error.message = message;
1156
+ } else {
1157
+ error = new Error(message);
1158
+ }
1159
+ error.shortMessage = shortMessage;
1160
+ error.command = command;
1161
+ error.escapedCommand = escapedCommand;
1162
+ error.exitCode = exitCode;
1163
+ error.signal = signal;
1164
+ error.signalDescription = signalDescription;
1165
+ error.stdout = stdout;
1166
+ error.stderr = stderr;
1167
+ error.cwd = cwd;
1168
+ if (all !== void 0) {
1169
+ error.all = all;
1170
+ }
1171
+ if ("bufferedData" in error) {
1172
+ delete error.bufferedData;
1173
+ }
1174
+ error.failed = true;
1175
+ error.timedOut = Boolean(timedOut);
1176
+ error.isCanceled = isCanceled;
1177
+ error.killed = killed && !timedOut;
1178
+ return error;
1179
+ };
1180
+
1181
+ // node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/stdio.js
1182
+ var aliases = ["stdin", "stdout", "stderr"];
1183
+ var hasAlias = (options) => aliases.some((alias) => options[alias] !== void 0);
1184
+ var normalizeStdio = (options) => {
1185
+ if (!options) {
1186
+ return;
1187
+ }
1188
+ const { stdio } = options;
1189
+ if (stdio === void 0) {
1190
+ return aliases.map((alias) => options[alias]);
1191
+ }
1192
+ if (hasAlias(options)) {
1193
+ throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map((alias) => `\`${alias}\``).join(", ")}`);
1194
+ }
1195
+ if (typeof stdio === "string") {
1196
+ return stdio;
1197
+ }
1198
+ if (!Array.isArray(stdio)) {
1199
+ throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
1200
+ }
1201
+ const length = Math.max(stdio.length, aliases.length);
1202
+ return Array.from({ length }, (value, index) => stdio[index]);
1203
+ };
1204
+
1205
+ // node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/kill.js
1206
+ var import_node_os3 = __toESM(require("os"), 1);
1207
+
1208
+ // node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
1209
+ var signals = [];
1210
+ signals.push("SIGHUP", "SIGINT", "SIGTERM");
1211
+ if (process.platform !== "win32") {
1212
+ signals.push(
1213
+ "SIGALRM",
1214
+ "SIGABRT",
1215
+ "SIGVTALRM",
1216
+ "SIGXCPU",
1217
+ "SIGXFSZ",
1218
+ "SIGUSR2",
1219
+ "SIGTRAP",
1220
+ "SIGSYS",
1221
+ "SIGQUIT",
1222
+ "SIGIOT"
1223
+ // should detect profiler and enable/disable accordingly.
1224
+ // see #21
1225
+ // 'SIGPROF'
1226
+ );
1227
+ }
1228
+ if (process.platform === "linux") {
1229
+ signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
1230
+ }
1231
+
1232
+ // node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
1233
+ var processOk = (process7) => !!process7 && typeof process7 === "object" && typeof process7.removeListener === "function" && typeof process7.emit === "function" && typeof process7.reallyExit === "function" && typeof process7.listeners === "function" && typeof process7.kill === "function" && typeof process7.pid === "number" && typeof process7.on === "function";
1234
+ var kExitEmitter = Symbol.for("signal-exit emitter");
1235
+ var global2 = globalThis;
1236
+ var ObjectDefineProperty = Object.defineProperty.bind(Object);
1237
+ var Emitter = class {
1238
+ emitted = {
1239
+ afterExit: false,
1240
+ exit: false
1241
+ };
1242
+ listeners = {
1243
+ afterExit: [],
1244
+ exit: []
1245
+ };
1246
+ count = 0;
1247
+ id = Math.random();
1248
+ constructor() {
1249
+ if (global2[kExitEmitter]) {
1250
+ return global2[kExitEmitter];
1251
+ }
1252
+ ObjectDefineProperty(global2, kExitEmitter, {
1253
+ value: this,
1254
+ writable: false,
1255
+ enumerable: false,
1256
+ configurable: false
1257
+ });
1258
+ }
1259
+ on(ev, fn) {
1260
+ this.listeners[ev].push(fn);
1261
+ }
1262
+ removeListener(ev, fn) {
1263
+ const list = this.listeners[ev];
1264
+ const i = list.indexOf(fn);
1265
+ if (i === -1) {
1266
+ return;
1267
+ }
1268
+ if (i === 0 && list.length === 1) {
1269
+ list.length = 0;
1270
+ } else {
1271
+ list.splice(i, 1);
1272
+ }
1273
+ }
1274
+ emit(ev, code, signal) {
1275
+ if (this.emitted[ev]) {
1276
+ return false;
1277
+ }
1278
+ this.emitted[ev] = true;
1279
+ let ret = false;
1280
+ for (const fn of this.listeners[ev]) {
1281
+ ret = fn(code, signal) === true || ret;
1282
+ }
1283
+ if (ev === "exit") {
1284
+ ret = this.emit("afterExit", code, signal) || ret;
1285
+ }
1286
+ return ret;
1287
+ }
1288
+ };
1289
+ var SignalExitBase = class {
1290
+ };
1291
+ var signalExitWrap = (handler) => {
1292
+ return {
1293
+ onExit(cb, opts) {
1294
+ return handler.onExit(cb, opts);
1295
+ },
1296
+ load() {
1297
+ return handler.load();
1298
+ },
1299
+ unload() {
1300
+ return handler.unload();
1301
+ }
1302
+ };
1303
+ };
1304
+ var SignalExitFallback = class extends SignalExitBase {
1305
+ onExit() {
1306
+ return () => {
1307
+ };
1308
+ }
1309
+ load() {
1310
+ }
1311
+ unload() {
1312
+ }
1313
+ };
1314
+ var _hupSig, _emitter, _process, _originalProcessEmit, _originalProcessReallyExit, _sigListeners, _loaded, _processReallyExit, processReallyExit_fn, _processEmit, processEmit_fn;
1315
+ var SignalExit = class extends SignalExitBase {
1316
+ constructor(process7) {
1317
+ super();
1318
+ __privateAdd(this, _processReallyExit);
1319
+ __privateAdd(this, _processEmit);
1320
+ // "SIGHUP" throws an `ENOSYS` error on Windows,
1321
+ // so use a supported signal instead
1322
+ /* c8 ignore start */
1323
+ __privateAdd(this, _hupSig, process4.platform === "win32" ? "SIGINT" : "SIGHUP");
1324
+ /* c8 ignore stop */
1325
+ __privateAdd(this, _emitter, new Emitter());
1326
+ __privateAdd(this, _process, void 0);
1327
+ __privateAdd(this, _originalProcessEmit, void 0);
1328
+ __privateAdd(this, _originalProcessReallyExit, void 0);
1329
+ __privateAdd(this, _sigListeners, {});
1330
+ __privateAdd(this, _loaded, false);
1331
+ __privateSet(this, _process, process7);
1332
+ __privateSet(this, _sigListeners, {});
1333
+ for (const sig of signals) {
1334
+ __privateGet(this, _sigListeners)[sig] = () => {
1335
+ const listeners = __privateGet(this, _process).listeners(sig);
1336
+ let { count } = __privateGet(this, _emitter);
1337
+ const p = process7;
1338
+ if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
1339
+ count += p.__signal_exit_emitter__.count;
1340
+ }
1341
+ if (listeners.length === count) {
1342
+ this.unload();
1343
+ const ret = __privateGet(this, _emitter).emit("exit", null, sig);
1344
+ const s = sig === "SIGHUP" ? __privateGet(this, _hupSig) : sig;
1345
+ if (!ret)
1346
+ process7.kill(process7.pid, s);
1347
+ }
1348
+ };
1349
+ }
1350
+ __privateSet(this, _originalProcessReallyExit, process7.reallyExit);
1351
+ __privateSet(this, _originalProcessEmit, process7.emit);
1352
+ }
1353
+ onExit(cb, opts) {
1354
+ if (!processOk(__privateGet(this, _process))) {
1355
+ return () => {
1356
+ };
1357
+ }
1358
+ if (__privateGet(this, _loaded) === false) {
1359
+ this.load();
1360
+ }
1361
+ const ev = (opts == null ? void 0 : opts.alwaysLast) ? "afterExit" : "exit";
1362
+ __privateGet(this, _emitter).on(ev, cb);
1363
+ return () => {
1364
+ __privateGet(this, _emitter).removeListener(ev, cb);
1365
+ if (__privateGet(this, _emitter).listeners["exit"].length === 0 && __privateGet(this, _emitter).listeners["afterExit"].length === 0) {
1366
+ this.unload();
1367
+ }
1368
+ };
1369
+ }
1370
+ load() {
1371
+ if (__privateGet(this, _loaded)) {
1372
+ return;
1373
+ }
1374
+ __privateSet(this, _loaded, true);
1375
+ __privateGet(this, _emitter).count += 1;
1376
+ for (const sig of signals) {
1377
+ try {
1378
+ const fn = __privateGet(this, _sigListeners)[sig];
1379
+ if (fn)
1380
+ __privateGet(this, _process).on(sig, fn);
1381
+ } catch (_) {
1382
+ }
1383
+ }
1384
+ __privateGet(this, _process).emit = (ev, ...a) => {
1385
+ return __privateMethod(this, _processEmit, processEmit_fn).call(this, ev, ...a);
1386
+ };
1387
+ __privateGet(this, _process).reallyExit = (code) => {
1388
+ return __privateMethod(this, _processReallyExit, processReallyExit_fn).call(this, code);
1389
+ };
1390
+ }
1391
+ unload() {
1392
+ if (!__privateGet(this, _loaded)) {
1393
+ return;
1394
+ }
1395
+ __privateSet(this, _loaded, false);
1396
+ signals.forEach((sig) => {
1397
+ const listener = __privateGet(this, _sigListeners)[sig];
1398
+ if (!listener) {
1399
+ throw new Error("Listener not defined for signal: " + sig);
1400
+ }
1401
+ try {
1402
+ __privateGet(this, _process).removeListener(sig, listener);
1403
+ } catch (_) {
1404
+ }
1405
+ });
1406
+ __privateGet(this, _process).emit = __privateGet(this, _originalProcessEmit);
1407
+ __privateGet(this, _process).reallyExit = __privateGet(this, _originalProcessReallyExit);
1408
+ __privateGet(this, _emitter).count -= 1;
1409
+ }
1410
+ };
1411
+ _hupSig = new WeakMap();
1412
+ _emitter = new WeakMap();
1413
+ _process = new WeakMap();
1414
+ _originalProcessEmit = new WeakMap();
1415
+ _originalProcessReallyExit = new WeakMap();
1416
+ _sigListeners = new WeakMap();
1417
+ _loaded = new WeakMap();
1418
+ _processReallyExit = new WeakSet();
1419
+ processReallyExit_fn = function(code) {
1420
+ if (!processOk(__privateGet(this, _process))) {
1421
+ return 0;
1422
+ }
1423
+ __privateGet(this, _process).exitCode = code || 0;
1424
+ __privateGet(this, _emitter).emit("exit", __privateGet(this, _process).exitCode, null);
1425
+ return __privateGet(this, _originalProcessReallyExit).call(__privateGet(this, _process), __privateGet(this, _process).exitCode);
1426
+ };
1427
+ _processEmit = new WeakSet();
1428
+ processEmit_fn = function(ev, ...args) {
1429
+ const og = __privateGet(this, _originalProcessEmit);
1430
+ if (ev === "exit" && processOk(__privateGet(this, _process))) {
1431
+ if (typeof args[0] === "number") {
1432
+ __privateGet(this, _process).exitCode = args[0];
1433
+ }
1434
+ const ret = og.call(__privateGet(this, _process), ev, ...args);
1435
+ __privateGet(this, _emitter).emit("exit", __privateGet(this, _process).exitCode, null);
1436
+ return ret;
1437
+ } else {
1438
+ return og.call(__privateGet(this, _process), ev, ...args);
1439
+ }
1440
+ };
1441
+ var process4 = globalThis.process;
1442
+ var {
1443
+ /**
1444
+ * Called when the process is exiting, whether via signal, explicit
1445
+ * exit, or running out of stuff to do.
1446
+ *
1447
+ * If the global process object is not suitable for instrumentation,
1448
+ * then this will be a no-op.
1449
+ *
1450
+ * Returns a function that may be used to unload signal-exit.
1451
+ */
1452
+ onExit,
1453
+ /**
1454
+ * Load the listeners. Likely you never need to call this, unless
1455
+ * doing a rather deep integration with signal-exit functionality.
1456
+ * Mostly exposed for the benefit of testing.
1457
+ *
1458
+ * @internal
1459
+ */
1460
+ load,
1461
+ /**
1462
+ * Unload the listeners. Likely you never need to call this, unless
1463
+ * doing a rather deep integration with signal-exit functionality.
1464
+ * Mostly exposed for the benefit of testing.
1465
+ *
1466
+ * @internal
1467
+ */
1468
+ unload
1469
+ } = signalExitWrap(processOk(process4) ? new SignalExit(process4) : new SignalExitFallback());
1470
+
1471
+ // node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/kill.js
1472
+ var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
1473
+ var spawnedKill = (kill, signal = "SIGTERM", options = {}) => {
1474
+ const killResult = kill(signal);
1475
+ setKillTimeout(kill, signal, options, killResult);
1476
+ return killResult;
1477
+ };
1478
+ var setKillTimeout = (kill, signal, options, killResult) => {
1479
+ if (!shouldForceKill(signal, options, killResult)) {
1480
+ return;
1481
+ }
1482
+ const timeout = getForceKillAfterTimeout(options);
1483
+ const t = setTimeout(() => {
1484
+ kill("SIGKILL");
1485
+ }, timeout);
1486
+ if (t.unref) {
1487
+ t.unref();
1488
+ }
1489
+ };
1490
+ var shouldForceKill = (signal, { forceKillAfterTimeout }, killResult) => isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
1491
+ var isSigterm = (signal) => signal === import_node_os3.default.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
1492
+ var getForceKillAfterTimeout = ({ forceKillAfterTimeout = true }) => {
1493
+ if (forceKillAfterTimeout === true) {
1494
+ return DEFAULT_FORCE_KILL_TIMEOUT;
1495
+ }
1496
+ if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
1497
+ throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
1498
+ }
1499
+ return forceKillAfterTimeout;
1500
+ };
1501
+ var spawnedCancel = (spawned, context) => {
1502
+ const killResult = spawned.kill();
1503
+ if (killResult) {
1504
+ context.isCanceled = true;
1505
+ }
1506
+ };
1507
+ var timeoutKill = (spawned, signal, reject) => {
1508
+ spawned.kill(signal);
1509
+ reject(Object.assign(new Error("Timed out"), { timedOut: true, signal }));
1510
+ };
1511
+ var setupTimeout = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise) => {
1512
+ if (timeout === 0 || timeout === void 0) {
1513
+ return spawnedPromise;
1514
+ }
1515
+ let timeoutId;
1516
+ const timeoutPromise = new Promise((resolve, reject) => {
1517
+ timeoutId = setTimeout(() => {
1518
+ timeoutKill(spawned, killSignal, reject);
1519
+ }, timeout);
1520
+ });
1521
+ const safeSpawnedPromise = spawnedPromise.finally(() => {
1522
+ clearTimeout(timeoutId);
1523
+ });
1524
+ return Promise.race([timeoutPromise, safeSpawnedPromise]);
1525
+ };
1526
+ var validateTimeout = ({ timeout }) => {
1527
+ if (timeout !== void 0 && (!Number.isFinite(timeout) || timeout < 0)) {
1528
+ throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
1529
+ }
1530
+ };
1531
+ var setExitHandler = async (spawned, { cleanup, detached }, timedPromise) => {
1532
+ if (!cleanup || detached) {
1533
+ return timedPromise;
1534
+ }
1535
+ const removeExitHandler = onExit(() => {
1536
+ spawned.kill();
1537
+ });
1538
+ return timedPromise.finally(() => {
1539
+ removeExitHandler();
1540
+ });
1541
+ };
1542
+
1543
+ // node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/pipe.js
1544
+ var import_node_fs = require("fs");
1545
+ var import_node_child_process = require("child_process");
1546
+
1547
+ // node_modules/.pnpm/is-stream@3.0.0/node_modules/is-stream/index.js
1548
+ function isStream(stream) {
1549
+ return stream !== null && typeof stream === "object" && typeof stream.pipe === "function";
1550
+ }
1551
+ function isWritableStream(stream) {
1552
+ return isStream(stream) && stream.writable !== false && typeof stream._write === "function" && typeof stream._writableState === "object";
1553
+ }
1554
+
1555
+ // node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/pipe.js
1556
+ var isExecaChildProcess = (target) => target instanceof import_node_child_process.ChildProcess && typeof target.then === "function";
1557
+ var pipeToTarget = (spawned, streamName, target) => {
1558
+ if (typeof target === "string") {
1559
+ spawned[streamName].pipe((0, import_node_fs.createWriteStream)(target));
1560
+ return spawned;
1561
+ }
1562
+ if (isWritableStream(target)) {
1563
+ spawned[streamName].pipe(target);
1564
+ return spawned;
1565
+ }
1566
+ if (!isExecaChildProcess(target)) {
1567
+ throw new TypeError("The second argument must be a string, a stream or an Execa child process.");
1568
+ }
1569
+ if (!isWritableStream(target.stdin)) {
1570
+ throw new TypeError("The target child process's stdin must be available.");
1571
+ }
1572
+ spawned[streamName].pipe(target.stdin);
1573
+ return target;
1574
+ };
1575
+ var addPipeMethods = (spawned) => {
1576
+ if (spawned.stdout !== null) {
1577
+ spawned.pipeStdout = pipeToTarget.bind(void 0, spawned, "stdout");
1578
+ }
1579
+ if (spawned.stderr !== null) {
1580
+ spawned.pipeStderr = pipeToTarget.bind(void 0, spawned, "stderr");
1581
+ }
1582
+ if (spawned.all !== void 0) {
1583
+ spawned.pipeAll = pipeToTarget.bind(void 0, spawned, "all");
1584
+ }
1585
+ };
1586
+
1587
+ // node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/stream.js
1588
+ var import_node_fs2 = require("fs");
1589
+ var import_promises = require("timers/promises");
1590
+
1591
+ // node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/contents.js
1592
+ var getStreamContents = async (stream, { init, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, finalize }, { maxBuffer = Number.POSITIVE_INFINITY } = {}) => {
1593
+ if (!isAsyncIterable(stream)) {
1594
+ throw new Error("The first argument must be a Readable, a ReadableStream, or an async iterable.");
1595
+ }
1596
+ const state = init();
1597
+ state.length = 0;
1598
+ try {
1599
+ for await (const chunk of stream) {
1600
+ const chunkType = getChunkType(chunk);
1601
+ const convertedChunk = convertChunk[chunkType](chunk, state);
1602
+ appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
1603
+ }
1604
+ appendFinalChunk({ state, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer });
1605
+ return finalize(state);
1606
+ } catch (error) {
1607
+ error.bufferedData = finalize(state);
1608
+ throw error;
1609
+ }
1610
+ };
1611
+ var appendFinalChunk = ({ state, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer }) => {
1612
+ const convertedChunk = getFinalChunk(state);
1613
+ if (convertedChunk !== void 0) {
1614
+ appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
1615
+ }
1616
+ };
1617
+ var appendChunk = ({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer }) => {
1618
+ const chunkSize = getSize(convertedChunk);
1619
+ const newLength = state.length + chunkSize;
1620
+ if (newLength <= maxBuffer) {
1621
+ addNewChunk(convertedChunk, state, addChunk, newLength);
1622
+ return;
1623
+ }
1624
+ const truncatedChunk = truncateChunk(convertedChunk, maxBuffer - state.length);
1625
+ if (truncatedChunk !== void 0) {
1626
+ addNewChunk(truncatedChunk, state, addChunk, maxBuffer);
1627
+ }
1628
+ throw new MaxBufferError();
1629
+ };
1630
+ var addNewChunk = (convertedChunk, state, addChunk, newLength) => {
1631
+ state.contents = addChunk(convertedChunk, state, newLength);
1632
+ state.length = newLength;
1633
+ };
1634
+ var isAsyncIterable = (stream) => typeof stream === "object" && stream !== null && typeof stream[Symbol.asyncIterator] === "function";
1635
+ var getChunkType = (chunk) => {
1636
+ var _a;
1637
+ const typeOfChunk = typeof chunk;
1638
+ if (typeOfChunk === "string") {
1639
+ return "string";
1640
+ }
1641
+ if (typeOfChunk !== "object" || chunk === null) {
1642
+ return "others";
1643
+ }
1644
+ if ((_a = globalThis.Buffer) == null ? void 0 : _a.isBuffer(chunk)) {
1645
+ return "buffer";
1646
+ }
1647
+ const prototypeName = objectToString.call(chunk);
1648
+ if (prototypeName === "[object ArrayBuffer]") {
1649
+ return "arrayBuffer";
1650
+ }
1651
+ if (prototypeName === "[object DataView]") {
1652
+ return "dataView";
1653
+ }
1654
+ if (Number.isInteger(chunk.byteLength) && Number.isInteger(chunk.byteOffset) && objectToString.call(chunk.buffer) === "[object ArrayBuffer]") {
1655
+ return "typedArray";
1656
+ }
1657
+ return "others";
1658
+ };
1659
+ var { toString: objectToString } = Object.prototype;
1660
+ var MaxBufferError = class extends Error {
1661
+ name = "MaxBufferError";
1662
+ constructor() {
1663
+ super("maxBuffer exceeded");
1664
+ }
1665
+ };
1666
+
1667
+ // node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/utils.js
1668
+ var identity = (value) => value;
1669
+ var noop = () => void 0;
1670
+ var getContentsProp = ({ contents }) => contents;
1671
+ var throwObjectStream = (chunk) => {
1672
+ throw new Error(`Streams in object mode are not supported: ${String(chunk)}`);
1673
+ };
1674
+ var getLengthProp = (convertedChunk) => convertedChunk.length;
1675
+
1676
+ // node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/array-buffer.js
1677
+ async function getStreamAsArrayBuffer(stream, options) {
1678
+ return getStreamContents(stream, arrayBufferMethods, options);
1679
+ }
1680
+ var initArrayBuffer = () => ({ contents: new ArrayBuffer(0) });
1681
+ var useTextEncoder = (chunk) => textEncoder.encode(chunk);
1682
+ var textEncoder = new TextEncoder();
1683
+ var useUint8Array = (chunk) => new Uint8Array(chunk);
1684
+ var useUint8ArrayWithOffset = (chunk) => new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
1685
+ var truncateArrayBufferChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
1686
+ var addArrayBufferChunk = (convertedChunk, { contents, length: previousLength }, length) => {
1687
+ const newContents = hasArrayBufferResize() ? resizeArrayBuffer(contents, length) : resizeArrayBufferSlow(contents, length);
1688
+ new Uint8Array(newContents).set(convertedChunk, previousLength);
1689
+ return newContents;
1690
+ };
1691
+ var resizeArrayBufferSlow = (contents, length) => {
1692
+ if (length <= contents.byteLength) {
1693
+ return contents;
1694
+ }
1695
+ const arrayBuffer = new ArrayBuffer(getNewContentsLength(length));
1696
+ new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
1697
+ return arrayBuffer;
1698
+ };
1699
+ var resizeArrayBuffer = (contents, length) => {
1700
+ if (length <= contents.maxByteLength) {
1701
+ contents.resize(length);
1702
+ return contents;
1703
+ }
1704
+ const arrayBuffer = new ArrayBuffer(length, { maxByteLength: getNewContentsLength(length) });
1705
+ new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
1706
+ return arrayBuffer;
1707
+ };
1708
+ var getNewContentsLength = (length) => SCALE_FACTOR ** Math.ceil(Math.log(length) / Math.log(SCALE_FACTOR));
1709
+ var SCALE_FACTOR = 2;
1710
+ var finalizeArrayBuffer = ({ contents, length }) => hasArrayBufferResize() ? contents : contents.slice(0, length);
1711
+ var hasArrayBufferResize = () => "resize" in ArrayBuffer.prototype;
1712
+ var arrayBufferMethods = {
1713
+ init: initArrayBuffer,
1714
+ convertChunk: {
1715
+ string: useTextEncoder,
1716
+ buffer: useUint8Array,
1717
+ arrayBuffer: useUint8Array,
1718
+ dataView: useUint8ArrayWithOffset,
1719
+ typedArray: useUint8ArrayWithOffset,
1720
+ others: throwObjectStream
1721
+ },
1722
+ getSize: getLengthProp,
1723
+ truncateChunk: truncateArrayBufferChunk,
1724
+ addChunk: addArrayBufferChunk,
1725
+ getFinalChunk: noop,
1726
+ finalize: finalizeArrayBuffer
1727
+ };
1728
+
1729
+ // node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/buffer.js
1730
+ async function getStreamAsBuffer(stream, options) {
1731
+ if (!("Buffer" in globalThis)) {
1732
+ throw new Error("getStreamAsBuffer() is only supported in Node.js");
1733
+ }
1734
+ try {
1735
+ return arrayBufferToNodeBuffer(await getStreamAsArrayBuffer(stream, options));
1736
+ } catch (error) {
1737
+ if (error.bufferedData !== void 0) {
1738
+ error.bufferedData = arrayBufferToNodeBuffer(error.bufferedData);
1739
+ }
1740
+ throw error;
1741
+ }
1742
+ }
1743
+ var arrayBufferToNodeBuffer = (arrayBuffer) => globalThis.Buffer.from(arrayBuffer);
1744
+
1745
+ // node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/string.js
1746
+ async function getStreamAsString(stream, options) {
1747
+ return getStreamContents(stream, stringMethods, options);
1748
+ }
1749
+ var initString = () => ({ contents: "", textDecoder: new TextDecoder() });
1750
+ var useTextDecoder = (chunk, { textDecoder }) => textDecoder.decode(chunk, { stream: true });
1751
+ var addStringChunk = (convertedChunk, { contents }) => contents + convertedChunk;
1752
+ var truncateStringChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
1753
+ var getFinalStringChunk = ({ textDecoder }) => {
1754
+ const finalChunk = textDecoder.decode();
1755
+ return finalChunk === "" ? void 0 : finalChunk;
1756
+ };
1757
+ var stringMethods = {
1758
+ init: initString,
1759
+ convertChunk: {
1760
+ string: identity,
1761
+ buffer: useTextDecoder,
1762
+ arrayBuffer: useTextDecoder,
1763
+ dataView: useTextDecoder,
1764
+ typedArray: useTextDecoder,
1765
+ others: throwObjectStream
1766
+ },
1767
+ getSize: getLengthProp,
1768
+ truncateChunk: truncateStringChunk,
1769
+ addChunk: addStringChunk,
1770
+ getFinalChunk: getFinalStringChunk,
1771
+ finalize: getContentsProp
1772
+ };
1773
+
1774
+ // node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/stream.js
1775
+ var import_merge_stream = __toESM(require_merge_stream(), 1);
1776
+ var validateInputOptions = (input) => {
1777
+ if (input !== void 0) {
1778
+ throw new TypeError("The `input` and `inputFile` options cannot be both set.");
1779
+ }
1780
+ };
1781
+ var getInputSync = ({ input, inputFile }) => {
1782
+ if (typeof inputFile !== "string") {
1783
+ return input;
1784
+ }
1785
+ validateInputOptions(input);
1786
+ return (0, import_node_fs2.readFileSync)(inputFile);
1787
+ };
1788
+ var handleInputSync = (options) => {
1789
+ const input = getInputSync(options);
1790
+ if (isStream(input)) {
1791
+ throw new TypeError("The `input` option cannot be a stream in sync mode");
1792
+ }
1793
+ return input;
1794
+ };
1795
+ var getInput = ({ input, inputFile }) => {
1796
+ if (typeof inputFile !== "string") {
1797
+ return input;
1798
+ }
1799
+ validateInputOptions(input);
1800
+ return (0, import_node_fs2.createReadStream)(inputFile);
1801
+ };
1802
+ var handleInput = (spawned, options) => {
1803
+ const input = getInput(options);
1804
+ if (input === void 0) {
1805
+ return;
1806
+ }
1807
+ if (isStream(input)) {
1808
+ input.pipe(spawned.stdin);
1809
+ } else {
1810
+ spawned.stdin.end(input);
1811
+ }
1812
+ };
1813
+ var makeAllStream = (spawned, { all }) => {
1814
+ if (!all || !spawned.stdout && !spawned.stderr) {
1815
+ return;
1816
+ }
1817
+ const mixed = (0, import_merge_stream.default)();
1818
+ if (spawned.stdout) {
1819
+ mixed.add(spawned.stdout);
1820
+ }
1821
+ if (spawned.stderr) {
1822
+ mixed.add(spawned.stderr);
1823
+ }
1824
+ return mixed;
1825
+ };
1826
+ var getBufferedData = async (stream, streamPromise) => {
1827
+ if (!stream || streamPromise === void 0) {
1828
+ return;
1829
+ }
1830
+ await (0, import_promises.setTimeout)(0);
1831
+ stream.destroy();
1832
+ try {
1833
+ return await streamPromise;
1834
+ } catch (error) {
1835
+ return error.bufferedData;
1836
+ }
1837
+ };
1838
+ var getStreamPromise = (stream, { encoding, buffer, maxBuffer }) => {
1839
+ if (!stream || !buffer) {
1840
+ return;
1841
+ }
1842
+ if (encoding === "utf8" || encoding === "utf-8") {
1843
+ return getStreamAsString(stream, { maxBuffer });
1844
+ }
1845
+ if (encoding === null || encoding === "buffer") {
1846
+ return getStreamAsBuffer(stream, { maxBuffer });
1847
+ }
1848
+ return applyEncoding(stream, maxBuffer, encoding);
1849
+ };
1850
+ var applyEncoding = async (stream, maxBuffer, encoding) => {
1851
+ const buffer = await getStreamAsBuffer(stream, { maxBuffer });
1852
+ return buffer.toString(encoding);
1853
+ };
1854
+ var getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone) => {
1855
+ const stdoutPromise = getStreamPromise(stdout, { encoding, buffer, maxBuffer });
1856
+ const stderrPromise = getStreamPromise(stderr, { encoding, buffer, maxBuffer });
1857
+ const allPromise = getStreamPromise(all, { encoding, buffer, maxBuffer: maxBuffer * 2 });
1858
+ try {
1859
+ return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
1860
+ } catch (error) {
1861
+ return Promise.all([
1862
+ { error, signal: error.signal, timedOut: error.timedOut },
1863
+ getBufferedData(stdout, stdoutPromise),
1864
+ getBufferedData(stderr, stderrPromise),
1865
+ getBufferedData(all, allPromise)
1866
+ ]);
1867
+ }
1868
+ };
1869
+
1870
+ // node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/promise.js
1871
+ var nativePromisePrototype = (/* @__PURE__ */ (async () => {
1872
+ })()).constructor.prototype;
1873
+ var descriptors = ["then", "catch", "finally"].map((property) => [
1874
+ property,
1875
+ Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
1876
+ ]);
1877
+ var mergePromise = (spawned, promise) => {
1878
+ for (const [property, descriptor] of descriptors) {
1879
+ const value = typeof promise === "function" ? (...args) => Reflect.apply(descriptor.value, promise(), args) : descriptor.value.bind(promise);
1880
+ Reflect.defineProperty(spawned, property, { ...descriptor, value });
1881
+ }
1882
+ };
1883
+ var getSpawnedPromise = (spawned) => new Promise((resolve, reject) => {
1884
+ spawned.on("exit", (exitCode, signal) => {
1885
+ resolve({ exitCode, signal });
1886
+ });
1887
+ spawned.on("error", (error) => {
1888
+ reject(error);
1889
+ });
1890
+ if (spawned.stdin) {
1891
+ spawned.stdin.on("error", (error) => {
1892
+ reject(error);
1893
+ });
1894
+ }
1895
+ });
1896
+
1897
+ // node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/command.js
1898
+ var import_node_buffer = require("buffer");
1899
+ var import_node_child_process2 = require("child_process");
1900
+ var normalizeArgs = (file, args = []) => {
1901
+ if (!Array.isArray(args)) {
1902
+ return [file];
1903
+ }
1904
+ return [file, ...args];
1905
+ };
1906
+ var NO_ESCAPE_REGEXP = /^[\w.-]+$/;
1907
+ var escapeArg = (arg) => {
1908
+ if (typeof arg !== "string" || NO_ESCAPE_REGEXP.test(arg)) {
1909
+ return arg;
1910
+ }
1911
+ return `"${arg.replaceAll('"', '\\"')}"`;
1912
+ };
1913
+ var joinCommand = (file, args) => normalizeArgs(file, args).join(" ");
1914
+ var getEscapedCommand = (file, args) => normalizeArgs(file, args).map((arg) => escapeArg(arg)).join(" ");
1915
+ var SPACES_REGEXP = / +/g;
1916
+ var parseExpression = (expression) => {
1917
+ const typeOfExpression = typeof expression;
1918
+ if (typeOfExpression === "string") {
1919
+ return expression;
1920
+ }
1921
+ if (typeOfExpression === "number") {
1922
+ return String(expression);
1923
+ }
1924
+ if (typeOfExpression === "object" && expression !== null && !(expression instanceof import_node_child_process2.ChildProcess) && "stdout" in expression) {
1925
+ const typeOfStdout = typeof expression.stdout;
1926
+ if (typeOfStdout === "string") {
1927
+ return expression.stdout;
1928
+ }
1929
+ if (import_node_buffer.Buffer.isBuffer(expression.stdout)) {
1930
+ return expression.stdout.toString();
1931
+ }
1932
+ throw new TypeError(`Unexpected "${typeOfStdout}" stdout in template expression`);
1933
+ }
1934
+ throw new TypeError(`Unexpected "${typeOfExpression}" in template expression`);
1935
+ };
1936
+ var concatTokens = (tokens, nextTokens, isNew) => isNew || tokens.length === 0 || nextTokens.length === 0 ? [...tokens, ...nextTokens] : [
1937
+ ...tokens.slice(0, -1),
1938
+ `${tokens.at(-1)}${nextTokens[0]}`,
1939
+ ...nextTokens.slice(1)
1940
+ ];
1941
+ var parseTemplate = ({ templates, expressions, tokens, index, template }) => {
1942
+ const templateString = template ?? templates.raw[index];
1943
+ const templateTokens = templateString.split(SPACES_REGEXP).filter(Boolean);
1944
+ const newTokens = concatTokens(
1945
+ tokens,
1946
+ templateTokens,
1947
+ templateString.startsWith(" ")
1948
+ );
1949
+ if (index === expressions.length) {
1950
+ return newTokens;
1951
+ }
1952
+ const expression = expressions[index];
1953
+ const expressionTokens = Array.isArray(expression) ? expression.map((expression2) => parseExpression(expression2)) : [parseExpression(expression)];
1954
+ return concatTokens(
1955
+ newTokens,
1956
+ expressionTokens,
1957
+ templateString.endsWith(" ")
1958
+ );
1959
+ };
1960
+ var parseTemplates = (templates, expressions) => {
1961
+ let tokens = [];
1962
+ for (const [index, template] of templates.entries()) {
1963
+ tokens = parseTemplate({ templates, expressions, tokens, index, template });
1964
+ }
1965
+ return tokens;
1966
+ };
1967
+
1968
+ // node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/verbose.js
1969
+ var import_node_util = require("util");
1970
+ var import_node_process3 = __toESM(require("process"), 1);
1971
+ var verboseDefault = (0, import_node_util.debuglog)("execa").enabled;
1972
+ var padField = (field, padding) => String(field).padStart(padding, "0");
1973
+ var getTimestamp = () => {
1974
+ const date = /* @__PURE__ */ new Date();
1975
+ return `${padField(date.getHours(), 2)}:${padField(date.getMinutes(), 2)}:${padField(date.getSeconds(), 2)}.${padField(date.getMilliseconds(), 3)}`;
1976
+ };
1977
+ var logCommand = (escapedCommand, { verbose }) => {
1978
+ if (!verbose) {
1979
+ return;
1980
+ }
1981
+ import_node_process3.default.stderr.write(`[${getTimestamp()}] ${escapedCommand}
1982
+ `);
1983
+ };
1984
+
1985
+ // node_modules/.pnpm/execa@8.0.1/node_modules/execa/index.js
1986
+ var DEFAULT_MAX_BUFFER = 1e3 * 1e3 * 100;
1987
+ var getEnv = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
1988
+ const env = extendEnv ? { ...import_node_process4.default.env, ...envOption } : envOption;
1989
+ if (preferLocal) {
1990
+ return npmRunPathEnv({ env, cwd: localDir, execPath });
1991
+ }
1992
+ return env;
1993
+ };
1994
+ var handleArguments = (file, args, options = {}) => {
1995
+ const parsed = import_cross_spawn.default._parse(file, args, options);
1996
+ file = parsed.command;
1997
+ args = parsed.args;
1998
+ options = parsed.options;
1999
+ options = {
2000
+ maxBuffer: DEFAULT_MAX_BUFFER,
2001
+ buffer: true,
2002
+ stripFinalNewline: true,
2003
+ extendEnv: true,
2004
+ preferLocal: false,
2005
+ localDir: options.cwd || import_node_process4.default.cwd(),
2006
+ execPath: import_node_process4.default.execPath,
2007
+ encoding: "utf8",
2008
+ reject: true,
2009
+ cleanup: true,
2010
+ all: false,
2011
+ windowsHide: true,
2012
+ verbose: verboseDefault,
2013
+ ...options
2014
+ };
2015
+ options.env = getEnv(options);
2016
+ options.stdio = normalizeStdio(options);
2017
+ if (import_node_process4.default.platform === "win32" && import_node_path2.default.basename(file, ".exe") === "cmd") {
2018
+ args.unshift("/q");
2019
+ }
2020
+ return { file, args, options, parsed };
2021
+ };
2022
+ var handleOutput = (options, value, error) => {
2023
+ if (typeof value !== "string" && !import_node_buffer2.Buffer.isBuffer(value)) {
2024
+ return error === void 0 ? void 0 : "";
2025
+ }
2026
+ if (options.stripFinalNewline) {
2027
+ return stripFinalNewline(value);
2028
+ }
2029
+ return value;
2030
+ };
2031
+ function execa(file, args, options) {
2032
+ const parsed = handleArguments(file, args, options);
2033
+ const command = joinCommand(file, args);
2034
+ const escapedCommand = getEscapedCommand(file, args);
2035
+ logCommand(escapedCommand, parsed.options);
2036
+ validateTimeout(parsed.options);
2037
+ let spawned;
2038
+ try {
2039
+ spawned = import_node_child_process3.default.spawn(parsed.file, parsed.args, parsed.options);
2040
+ } catch (error) {
2041
+ const dummySpawned = new import_node_child_process3.default.ChildProcess();
2042
+ const errorPromise = Promise.reject(makeError({
2043
+ error,
2044
+ stdout: "",
2045
+ stderr: "",
2046
+ all: "",
2047
+ command,
2048
+ escapedCommand,
2049
+ parsed,
2050
+ timedOut: false,
2051
+ isCanceled: false,
2052
+ killed: false
2053
+ }));
2054
+ mergePromise(dummySpawned, errorPromise);
2055
+ return dummySpawned;
2056
+ }
2057
+ const spawnedPromise = getSpawnedPromise(spawned);
2058
+ const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
2059
+ const processDone = setExitHandler(spawned, parsed.options, timedPromise);
2060
+ const context = { isCanceled: false };
2061
+ spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));
2062
+ spawned.cancel = spawnedCancel.bind(null, spawned, context);
2063
+ const handlePromise = async () => {
2064
+ const [{ error, exitCode, signal, timedOut }, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);
2065
+ const stdout = handleOutput(parsed.options, stdoutResult);
2066
+ const stderr = handleOutput(parsed.options, stderrResult);
2067
+ const all = handleOutput(parsed.options, allResult);
2068
+ if (error || exitCode !== 0 || signal !== null) {
2069
+ const returnedError = makeError({
2070
+ error,
2071
+ exitCode,
2072
+ signal,
2073
+ stdout,
2074
+ stderr,
2075
+ all,
2076
+ command,
2077
+ escapedCommand,
2078
+ parsed,
2079
+ timedOut,
2080
+ isCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),
2081
+ killed: spawned.killed
2082
+ });
2083
+ if (!parsed.options.reject) {
2084
+ return returnedError;
2085
+ }
2086
+ throw returnedError;
2087
+ }
2088
+ return {
2089
+ command,
2090
+ escapedCommand,
2091
+ exitCode: 0,
2092
+ stdout,
2093
+ stderr,
2094
+ all,
2095
+ failed: false,
2096
+ timedOut: false,
2097
+ isCanceled: false,
2098
+ killed: false
2099
+ };
2100
+ };
2101
+ const handlePromiseOnce = onetime_default(handlePromise);
2102
+ handleInput(spawned, parsed.options);
2103
+ spawned.all = makeAllStream(spawned, parsed.options);
2104
+ addPipeMethods(spawned);
2105
+ mergePromise(spawned, handlePromiseOnce);
2106
+ return spawned;
2107
+ }
2108
+ function execaSync(file, args, options) {
2109
+ const parsed = handleArguments(file, args, options);
2110
+ const command = joinCommand(file, args);
2111
+ const escapedCommand = getEscapedCommand(file, args);
2112
+ logCommand(escapedCommand, parsed.options);
2113
+ const input = handleInputSync(parsed.options);
2114
+ let result;
2115
+ try {
2116
+ result = import_node_child_process3.default.spawnSync(parsed.file, parsed.args, { ...parsed.options, input });
2117
+ } catch (error) {
2118
+ throw makeError({
2119
+ error,
2120
+ stdout: "",
2121
+ stderr: "",
2122
+ all: "",
2123
+ command,
2124
+ escapedCommand,
2125
+ parsed,
2126
+ timedOut: false,
2127
+ isCanceled: false,
2128
+ killed: false
2129
+ });
2130
+ }
2131
+ const stdout = handleOutput(parsed.options, result.stdout, result.error);
2132
+ const stderr = handleOutput(parsed.options, result.stderr, result.error);
2133
+ if (result.error || result.status !== 0 || result.signal !== null) {
2134
+ const error = makeError({
2135
+ stdout,
2136
+ stderr,
2137
+ error: result.error,
2138
+ signal: result.signal,
2139
+ exitCode: result.status,
2140
+ command,
2141
+ escapedCommand,
2142
+ parsed,
2143
+ timedOut: result.error && result.error.code === "ETIMEDOUT",
2144
+ isCanceled: false,
2145
+ killed: result.signal !== null
2146
+ });
2147
+ if (!parsed.options.reject) {
2148
+ return error;
2149
+ }
2150
+ throw error;
2151
+ }
2152
+ return {
2153
+ command,
2154
+ escapedCommand,
2155
+ exitCode: 0,
2156
+ stdout,
2157
+ stderr,
2158
+ failed: false,
2159
+ timedOut: false,
2160
+ isCanceled: false,
2161
+ killed: false
2162
+ };
2163
+ }
2164
+ var normalizeScriptStdin = ({ input, inputFile, stdio }) => input === void 0 && inputFile === void 0 && stdio === void 0 ? { stdin: "inherit" } : {};
2165
+ var normalizeScriptOptions = (options = {}) => ({
2166
+ preferLocal: true,
2167
+ ...normalizeScriptStdin(options),
2168
+ ...options
2169
+ });
2170
+ function create$(options) {
2171
+ function $2(templatesOrOptions, ...expressions) {
2172
+ if (!Array.isArray(templatesOrOptions)) {
2173
+ return create$({ ...options, ...templatesOrOptions });
2174
+ }
2175
+ const [file, ...args] = parseTemplates(templatesOrOptions, expressions);
2176
+ return execa(file, args, normalizeScriptOptions(options));
2177
+ }
2178
+ $2.sync = (templates, ...expressions) => {
2179
+ if (!Array.isArray(templates)) {
2180
+ throw new TypeError("Please use $(options).sync`command` instead of $.sync(options)`command`.");
2181
+ }
2182
+ const [file, ...args] = parseTemplates(templates, expressions);
2183
+ return execaSync(file, args, normalizeScriptOptions(options));
2184
+ };
2185
+ return $2;
2186
+ }
2187
+ var $ = create$();
2188
+
2189
+ // src/main.ts
2190
+ var path4 = __toESM(require("path"));
2191
+
2192
+ // src/platform.ts
2193
+ var fs = __toESM(require("fs"));
2194
+ var os2 = __toESM(require("os"));
2195
+ var path3 = __toESM(require("path"));
2196
+ var DEPOT_BINARY_PATH = process.env.DEPOT_BINARY_PATH || DEPOT_BINARY_PATH;
2197
+ var isValidBinaryPath = (x) => !!x;
2198
+ var packageDarwin_arm64 = "@depot/cli-darwin-arm64";
2199
+ var packageDarwin_x64 = "@depot/cli-darwin-x64";
2200
+ var knownWindowsPackages = {
2201
+ "win32 arm LE": "@depot/cli-win32-arm",
2202
+ "win32 arm64 LE": "@depot/cli-win32-arm64",
2203
+ "win32 ia32 LE": "@depot/cli-win32-ia32",
2204
+ "win32 x64 LE": "@depot/cli-win32-x64"
2205
+ };
2206
+ var knownUnixlikePackages = {
2207
+ "darwin arm64 LE": "@depot/cli-darwin-arm64",
2208
+ "darwin x64 LE": "@depot/cli-darwin-x64",
2209
+ "linux arm LE": "@depot/cli-linux-arm",
2210
+ "linux arm64 LE": "@depot/cli-linux-arm64",
2211
+ "linux ia32 LE": "@depot/cli-linux-ia32",
2212
+ "linux x64 LE": "@depot/cli-linux-x64"
2213
+ };
2214
+ function pkgAndSubpathForCurrentPlatform() {
2215
+ let pkg;
2216
+ let subpath;
2217
+ let platformKey = `${process.platform} ${os2.arch()} ${os2.endianness()}`;
2218
+ if (platformKey in knownWindowsPackages) {
2219
+ pkg = knownWindowsPackages[platformKey];
2220
+ subpath = "bin/depot.exe";
2221
+ } else if (platformKey in knownUnixlikePackages) {
2222
+ pkg = knownUnixlikePackages[platformKey];
2223
+ subpath = "bin/depot";
2224
+ } else {
2225
+ throw new Error(`Unsupported platform: ${platformKey}`);
2226
+ }
2227
+ return { pkg, subpath };
2228
+ }
2229
+ function pkgForSomeOtherPlatform() {
2230
+ const libMainJS = require.resolve("@depot/cli");
2231
+ const nodeModulesDirectory = path3.dirname(path3.dirname(path3.dirname(libMainJS)));
2232
+ if (path3.basename(nodeModulesDirectory) === "node_modules") {
2233
+ for (const unixKey in knownUnixlikePackages) {
2234
+ try {
2235
+ const pkg = knownUnixlikePackages[unixKey];
2236
+ if (fs.existsSync(path3.join(nodeModulesDirectory, pkg)))
2237
+ return pkg;
2238
+ } catch {
2239
+ }
2240
+ }
2241
+ for (const windowsKey in knownWindowsPackages) {
2242
+ try {
2243
+ const pkg = knownWindowsPackages[windowsKey];
2244
+ if (fs.existsSync(path3.join(nodeModulesDirectory, pkg)))
2245
+ return pkg;
2246
+ } catch {
2247
+ }
2248
+ }
2249
+ }
2250
+ return null;
2251
+ }
2252
+ function downloadedBinPath(pkg, subpath) {
2253
+ const libDir = path3.dirname(require.resolve("@depot/cli"));
2254
+ return path3.join(libDir, `downloaded-${pkg.replace("/", "-")}-${path3.basename(subpath)}`);
2255
+ }
2256
+ function generateBinPath() {
2257
+ if (isValidBinaryPath(DEPOT_BINARY_PATH)) {
2258
+ if (!fs.existsSync(DEPOT_BINARY_PATH)) {
2259
+ console.warn(`[@depot/cli] Ignoring bad configuration: DEPOT_BINARY_PATH=${DEPOT_BINARY_PATH}`);
2260
+ } else {
2261
+ return { binPath: DEPOT_BINARY_PATH };
2262
+ }
2263
+ }
2264
+ const { pkg, subpath } = pkgAndSubpathForCurrentPlatform();
2265
+ let binPath;
2266
+ try {
2267
+ binPath = require.resolve(`${pkg}/${subpath}`);
2268
+ } catch (e) {
2269
+ binPath = downloadedBinPath(pkg, subpath);
2270
+ if (!fs.existsSync(binPath)) {
2271
+ try {
2272
+ require.resolve(pkg);
2273
+ } catch {
2274
+ const otherPkg = pkgForSomeOtherPlatform();
2275
+ if (otherPkg) {
2276
+ let suggestions = `
2277
+ Specifically the "${otherPkg}" package is present but this platform
2278
+ needs the "${pkg}" package instead. People often get into this
2279
+ situation by installing @depot/cli on Windows or macOS and copying "node_modules"
2280
+ into a Docker image that runs Linux, or by copying "node_modules" between
2281
+ Windows and WSL environments.
2282
+
2283
+ If you are installing with npm, you can try not copying the "node_modules"
2284
+ directory when you copy the files over, and running "npm ci" or "npm install"
2285
+ on the destination platform after the copy. Or you could consider using yarn
2286
+ instead of npm which has built-in support for installing a package on multiple
2287
+ platforms simultaneously.
2288
+
2289
+ If you are installing with yarn, you can try listing both this platform and the
2290
+ other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
2291
+ feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
2292
+ Keep in mind that this means multiple copies of @depot/cli will be present.
2293
+ `;
2294
+ if (pkg === packageDarwin_x64 && otherPkg === packageDarwin_arm64 || pkg === packageDarwin_arm64 && otherPkg === packageDarwin_x64) {
2295
+ suggestions = `
2296
+ Specifically the "${otherPkg}" package is present but this platform
2297
+ needs the "${pkg}" package instead. People often get into this
2298
+ situation by installing @depot/cli with npm running inside of Rosetta 2 and then
2299
+ trying to use it with node running outside of Rosetta 2, or vice versa (Rosetta
2300
+ 2 is Apple's on-the-fly x86_64-to-arm64 translation service).
2301
+
2302
+ If you are installing with npm, you can try ensuring that both npm and node are
2303
+ not running under Rosetta 2 and then reinstalling @depot/cli. This likely involves
2304
+ changing how you installed npm and/or node. For example, installing node with
2305
+ the universal installer here should work: https://nodejs.org/en/download/. Or
2306
+ you could consider using yarn instead of npm which has built-in support for
2307
+ installing a package on multiple platforms simultaneously.
2308
+
2309
+ If you are installing with yarn, you can try listing both "arm64" and "x64"
2310
+ in your ".yarnrc.yml" file using the "supportedArchitectures" feature:
2311
+ https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
2312
+ Keep in mind that this means multiple copies of @depot/cli will be present.
2313
+ `;
2314
+ }
2315
+ throw new Error(`
2316
+ You installed @depot/cli for another platform than the one you're currently using.
2317
+ This won't work because @depot/cli is written with native code and needs to
2318
+ install a platform-specific binary executable.
2319
+ ${suggestions}
2320
+ `);
2321
+ }
2322
+ throw new Error(`The package "${pkg}" could not be found, and is needed by @depot/cli.
2323
+
2324
+ If you are installing @depot/cli with npm, make sure that you don't specify the
2325
+ "--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
2326
+ of "package.json" is used by @depot/cli to install the correct binary executable
2327
+ for your current platform.`);
2328
+ }
2329
+ throw e;
2330
+ }
2331
+ }
2332
+ if (/\.zip\//.test(binPath)) {
2333
+ let pnpapi;
2334
+ try {
2335
+ pnpapi = require("pnpapi");
2336
+ } catch (e) {
2337
+ }
2338
+ if (pnpapi) {
2339
+ const root = pnpapi.getPackageInformation(pnpapi.topLevel).packageLocation;
2340
+ const binTargetPath = path3.join(
2341
+ root,
2342
+ "node_modules",
2343
+ ".cache",
2344
+ "@depot/cli",
2345
+ `pnpapi-${pkg.replace("/", "-")}-${"2.36.3"}-${path3.basename(subpath)}`
2346
+ );
2347
+ if (!fs.existsSync(binTargetPath)) {
2348
+ fs.mkdirSync(path3.dirname(binTargetPath), { recursive: true });
2349
+ fs.copyFileSync(binPath, binTargetPath);
2350
+ fs.chmodSync(binTargetPath, 493);
2351
+ }
2352
+ return { binPath: binTargetPath };
2353
+ }
2354
+ }
2355
+ return { binPath };
2356
+ }
2357
+
2358
+ // src/main.ts
2359
+ function depotBinaryPath() {
2360
+ if (!DEPOT_BINARY_PATH && (path4.basename(__filename) !== "main.js" || path4.basename(__dirname) !== "lib")) {
2361
+ throw new Error(
2362
+ `The Depot CLI cannot be bundled. Please mark the "@depot/cli" package as external so it's not included in the bundle.
2363
+
2364
+ More information: The file containing the code for depot's JavaScript API (${__filename}) does not appear to be inside the @depot/cli package on the file system, which usually means that the @depot/cli package was bundled into another file. This is problematic because the API needs to run a binary executable inside the @depot/cli package which is located using a relative path from the API code to the executable. If the @depot/cli package is bundled, the relative path will be incorrect and the executable won't be found.`
2365
+ );
2366
+ }
2367
+ const { binPath } = generateBinPath();
2368
+ return binPath;
2369
+ }
2370
+ function depot(...args) {
2371
+ const bin = depotBinaryPath();
2372
+ return execa(bin, ...args);
2373
+ }
2374
+ // Annotate the CommonJS export names for ESM import in node:
2375
+ 0 && (module.exports = {
2376
+ depot,
2377
+ depotBinaryPath
2378
+ });