@prisma/migrate 6.17.0-integration-feat-orm-1074-package-dev-export.1 → 6.17.0-integration-feat-mapped-enums.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/Migrate.js +4 -3
  2. package/dist/bin.js +28 -27
  3. package/dist/{chunk-F3JIZWIS.js → chunk-3BC6W7CG.js} +13 -13
  4. package/dist/chunk-3WDCTXHL.js +270 -0
  5. package/dist/{chunk-U62JTEME.js → chunk-4GL5WXCD.js} +5 -5
  6. package/dist/{chunk-YEUENY2G.js → chunk-6OQEB4QQ.js} +5 -5
  7. package/dist/{chunk-R2YKCEAN.js → chunk-7E5C5GNE.js} +5 -5
  8. package/dist/{chunk-IKB544RB.js → chunk-CWXY4DCV.js} +8 -21
  9. package/dist/{chunk-DYXEUKV3.js → chunk-D4TRX77Y.js} +6 -6
  10. package/dist/{chunk-YQ6GTOKJ.js → chunk-NI5KWETZ.js} +8 -8
  11. package/dist/{chunk-RNQEWSLQ.js → chunk-NL3WCYT3.js} +6 -6
  12. package/dist/{chunk-BKW5AGJV.js → chunk-NXWNFR5U.js} +5 -5
  13. package/dist/chunk-PHXLQVPT.js +1890 -0
  14. package/dist/{chunk-WXE3X4AN.js → chunk-R7B3TZ5A.js} +5 -5
  15. package/dist/{chunk-G56DQP5E.js → chunk-UPOG7SD7.js} +5 -5
  16. package/dist/{chunk-QF5OMSPA.js → chunk-USJF4W7L.js} +5 -5
  17. package/dist/{chunk-IINN7QUV.js → chunk-VU5BLQUI.js} +8 -8
  18. package/dist/{chunk-URKH6SE2.js → chunk-VV4M6AN7.js} +5 -251
  19. package/dist/{chunk-B64PYCYC.js → chunk-ZYGQLUWA.js} +8 -8
  20. package/dist/commands/DbExecute.js +5 -4
  21. package/dist/commands/DbPull.js +6 -5
  22. package/dist/commands/DbPush.js +5 -4
  23. package/dist/commands/DbSeed.js +4 -3
  24. package/dist/commands/MigrateDeploy.js +5 -4
  25. package/dist/commands/MigrateDev.js +6 -5
  26. package/dist/commands/MigrateDiff.js +5 -4
  27. package/dist/commands/MigrateReset.js +6 -5
  28. package/dist/commands/MigrateResolve.js +5 -4
  29. package/dist/commands/MigrateStatus.js +5 -4
  30. package/dist/index.js +30 -29
  31. package/dist/utils/getDatabaseVersionSafe.js +5 -4
  32. package/dist/utils/introspectSql.js +5 -4
  33. package/dist/utils/seed.js +4 -3
  34. package/dist/utils/setupMysql.js +2527 -1451
  35. package/dist/utils/spinner.js +4 -3
  36. package/package.json +12 -14
  37. package/dist/chunk-HFXUQT52.js +0 -1982
@@ -0,0 +1,1890 @@
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 __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var chunk_PHXLQVPT_exports = {};
30
+ __export(chunk_PHXLQVPT_exports, {
31
+ executeSeedCommand: () => executeSeedCommand,
32
+ getSeedCommandFromPackageJson: () => getSeedCommandFromPackageJson
33
+ });
34
+ module.exports = __toCommonJS(chunk_PHXLQVPT_exports);
35
+ var import_chunk_3WDCTXHL = require("./chunk-3WDCTXHL.js");
36
+ var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
37
+ var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
38
+ var import_node_path = __toESM(require("node:path"));
39
+ var import_config = require("@prisma/config");
40
+ var import_debug = __toESM(require("@prisma/debug"));
41
+ var import_node_buffer = require("node:buffer");
42
+ var import_node_path2 = __toESM(require("node:path"));
43
+ var import_node_child_process = __toESM(require("node:child_process"));
44
+ var import_node_process = __toESM(require("node:process"));
45
+ var import_node_process2 = __toESM(require("node:process"));
46
+ var import_node_path3 = __toESM(require("node:path"));
47
+ var import_node_url = require("node:url");
48
+ var import_node_process3 = __toESM(require("node:process"));
49
+ var import_node_os = require("node:os");
50
+ var import_node_os2 = require("node:os");
51
+ var import_node_os3 = __toESM(require("node:os"));
52
+ var import_node_fs = require("node:fs");
53
+ var import_node_child_process2 = require("node:child_process");
54
+ var import_node_fs2 = require("node:fs");
55
+ var import_promises = require("node:timers/promises");
56
+ var import_node_buffer2 = require("node:buffer");
57
+ var import_node_child_process3 = require("node:child_process");
58
+ var import_node_util = require("node:util");
59
+ var import_node_process4 = __toESM(require("node:process"));
60
+ var require_windows = (0, import_chunk_2ESYSVXG.__commonJS)({
61
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module2) {
62
+ "use strict";
63
+ module2.exports = isexe;
64
+ isexe.sync = sync;
65
+ var fs = (0, import_chunk_2ESYSVXG.__require)("fs");
66
+ function checkPathExt(path4, options) {
67
+ var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
68
+ if (!pathext) {
69
+ return true;
70
+ }
71
+ pathext = pathext.split(";");
72
+ if (pathext.indexOf("") !== -1) {
73
+ return true;
74
+ }
75
+ for (var i = 0; i < pathext.length; i++) {
76
+ var p = pathext[i].toLowerCase();
77
+ if (p && path4.substr(-p.length).toLowerCase() === p) {
78
+ return true;
79
+ }
80
+ }
81
+ return false;
82
+ }
83
+ function checkStat(stat, path4, options) {
84
+ if (!stat.isSymbolicLink() && !stat.isFile()) {
85
+ return false;
86
+ }
87
+ return checkPathExt(path4, options);
88
+ }
89
+ function isexe(path4, options, cb) {
90
+ fs.stat(path4, function(er, stat) {
91
+ cb(er, er ? false : checkStat(stat, path4, options));
92
+ });
93
+ }
94
+ function sync(path4, options) {
95
+ return checkStat(fs.statSync(path4), path4, options);
96
+ }
97
+ }
98
+ });
99
+ var require_mode = (0, import_chunk_2ESYSVXG.__commonJS)({
100
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module2) {
101
+ "use strict";
102
+ module2.exports = isexe;
103
+ isexe.sync = sync;
104
+ var fs = (0, import_chunk_2ESYSVXG.__require)("fs");
105
+ function isexe(path4, options, cb) {
106
+ fs.stat(path4, function(er, stat) {
107
+ cb(er, er ? false : checkStat(stat, options));
108
+ });
109
+ }
110
+ function sync(path4, options) {
111
+ return checkStat(fs.statSync(path4), options);
112
+ }
113
+ function checkStat(stat, options) {
114
+ return stat.isFile() && checkMode(stat, options);
115
+ }
116
+ function checkMode(stat, options) {
117
+ var mod = stat.mode;
118
+ var uid = stat.uid;
119
+ var gid = stat.gid;
120
+ var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
121
+ var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
122
+ var u = parseInt("100", 8);
123
+ var g = parseInt("010", 8);
124
+ var o = parseInt("001", 8);
125
+ var ug = u | g;
126
+ var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
127
+ return ret;
128
+ }
129
+ }
130
+ });
131
+ var require_isexe = (0, import_chunk_2ESYSVXG.__commonJS)({
132
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module2) {
133
+ "use strict";
134
+ var fs = (0, import_chunk_2ESYSVXG.__require)("fs");
135
+ var core;
136
+ if (process.platform === "win32" || global.TESTING_WINDOWS) {
137
+ core = require_windows();
138
+ } else {
139
+ core = require_mode();
140
+ }
141
+ module2.exports = isexe;
142
+ isexe.sync = sync;
143
+ function isexe(path4, options, cb) {
144
+ if (typeof options === "function") {
145
+ cb = options;
146
+ options = {};
147
+ }
148
+ if (!cb) {
149
+ if (typeof Promise !== "function") {
150
+ throw new TypeError("callback not provided");
151
+ }
152
+ return new Promise(function(resolve, reject) {
153
+ isexe(path4, options || {}, function(er, is) {
154
+ if (er) {
155
+ reject(er);
156
+ } else {
157
+ resolve(is);
158
+ }
159
+ });
160
+ });
161
+ }
162
+ core(path4, options || {}, function(er, is) {
163
+ if (er) {
164
+ if (er.code === "EACCES" || options && options.ignoreErrors) {
165
+ er = null;
166
+ is = false;
167
+ }
168
+ }
169
+ cb(er, is);
170
+ });
171
+ }
172
+ function sync(path4, options) {
173
+ try {
174
+ return core.sync(path4, options || {});
175
+ } catch (er) {
176
+ if (options && options.ignoreErrors || er.code === "EACCES") {
177
+ return false;
178
+ } else {
179
+ throw er;
180
+ }
181
+ }
182
+ }
183
+ }
184
+ });
185
+ var require_which = (0, import_chunk_2ESYSVXG.__commonJS)({
186
+ "../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module2) {
187
+ "use strict";
188
+ var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
189
+ var path4 = (0, import_chunk_2ESYSVXG.__require)("path");
190
+ var COLON = isWindows ? ";" : ":";
191
+ var isexe = require_isexe();
192
+ var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
193
+ var getPathInfo = (cmd, opt) => {
194
+ const colon = opt.colon || COLON;
195
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
196
+ // windows always checks the cwd first
197
+ ...isWindows ? [process.cwd()] : [],
198
+ ...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
199
+ "").split(colon)
200
+ ];
201
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
202
+ const pathExt = isWindows ? pathExtExe.split(colon) : [""];
203
+ if (isWindows) {
204
+ if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
205
+ pathExt.unshift("");
206
+ }
207
+ return {
208
+ pathEnv,
209
+ pathExt,
210
+ pathExtExe
211
+ };
212
+ };
213
+ var which = (cmd, opt, cb) => {
214
+ if (typeof opt === "function") {
215
+ cb = opt;
216
+ opt = {};
217
+ }
218
+ if (!opt)
219
+ opt = {};
220
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
221
+ const found = [];
222
+ const step = (i) => new Promise((resolve, reject) => {
223
+ if (i === pathEnv.length)
224
+ return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
225
+ const ppRaw = pathEnv[i];
226
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
227
+ const pCmd = path4.join(pathPart, cmd);
228
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
229
+ resolve(subStep(p, i, 0));
230
+ });
231
+ const subStep = (p, i, ii) => new Promise((resolve, reject) => {
232
+ if (ii === pathExt.length)
233
+ return resolve(step(i + 1));
234
+ const ext = pathExt[ii];
235
+ isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
236
+ if (!er && is) {
237
+ if (opt.all)
238
+ found.push(p + ext);
239
+ else
240
+ return resolve(p + ext);
241
+ }
242
+ return resolve(subStep(p, i, ii + 1));
243
+ });
244
+ });
245
+ return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
246
+ };
247
+ var whichSync = (cmd, opt) => {
248
+ opt = opt || {};
249
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
250
+ const found = [];
251
+ for (let i = 0; i < pathEnv.length; i++) {
252
+ const ppRaw = pathEnv[i];
253
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
254
+ const pCmd = path4.join(pathPart, cmd);
255
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
256
+ for (let j = 0; j < pathExt.length; j++) {
257
+ const cur = p + pathExt[j];
258
+ try {
259
+ const is = isexe.sync(cur, { pathExt: pathExtExe });
260
+ if (is) {
261
+ if (opt.all)
262
+ found.push(cur);
263
+ else
264
+ return cur;
265
+ }
266
+ } catch (ex) {
267
+ }
268
+ }
269
+ }
270
+ if (opt.all && found.length)
271
+ return found;
272
+ if (opt.nothrow)
273
+ return null;
274
+ throw getNotFoundError(cmd);
275
+ };
276
+ module2.exports = which;
277
+ which.sync = whichSync;
278
+ }
279
+ });
280
+ var require_path_key = (0, import_chunk_2ESYSVXG.__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
+ var require_resolveCommand = (0, import_chunk_2ESYSVXG.__commonJS)({
296
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module2) {
297
+ "use strict";
298
+ var path4 = (0, import_chunk_2ESYSVXG.__require)("path");
299
+ var which = require_which();
300
+ var getPathKey = require_path_key();
301
+ function resolveCommandAttempt(parsed, withoutPathExt) {
302
+ const env = parsed.options.env || process.env;
303
+ const cwd = process.cwd();
304
+ const hasCustomCwd = parsed.options.cwd != null;
305
+ const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
306
+ if (shouldSwitchCwd) {
307
+ try {
308
+ process.chdir(parsed.options.cwd);
309
+ } catch (err) {
310
+ }
311
+ }
312
+ let resolved;
313
+ try {
314
+ resolved = which.sync(parsed.command, {
315
+ path: env[getPathKey({ env })],
316
+ pathExt: withoutPathExt ? path4.delimiter : void 0
317
+ });
318
+ } catch (e) {
319
+ } finally {
320
+ if (shouldSwitchCwd) {
321
+ process.chdir(cwd);
322
+ }
323
+ }
324
+ if (resolved) {
325
+ resolved = path4.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
326
+ }
327
+ return resolved;
328
+ }
329
+ function resolveCommand(parsed) {
330
+ return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
331
+ }
332
+ module2.exports = resolveCommand;
333
+ }
334
+ });
335
+ var require_escape = (0, import_chunk_2ESYSVXG.__commonJS)({
336
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js"(exports, module2) {
337
+ "use strict";
338
+ var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
339
+ function escapeCommand(arg) {
340
+ arg = arg.replace(metaCharsRegExp, "^$1");
341
+ return arg;
342
+ }
343
+ function escapeArgument(arg, doubleEscapeMetaChars) {
344
+ arg = `${arg}`;
345
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
346
+ arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
347
+ arg = `"${arg}"`;
348
+ arg = arg.replace(metaCharsRegExp, "^$1");
349
+ if (doubleEscapeMetaChars) {
350
+ arg = arg.replace(metaCharsRegExp, "^$1");
351
+ }
352
+ return arg;
353
+ }
354
+ module2.exports.command = escapeCommand;
355
+ module2.exports.argument = escapeArgument;
356
+ }
357
+ });
358
+ var require_shebang_regex = (0, import_chunk_2ESYSVXG.__commonJS)({
359
+ "../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js"(exports, module2) {
360
+ "use strict";
361
+ module2.exports = /^#!(.*)/;
362
+ }
363
+ });
364
+ var require_shebang_command = (0, import_chunk_2ESYSVXG.__commonJS)({
365
+ "../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js"(exports, module2) {
366
+ "use strict";
367
+ var shebangRegex = require_shebang_regex();
368
+ module2.exports = (string = "") => {
369
+ const match = string.match(shebangRegex);
370
+ if (!match) {
371
+ return null;
372
+ }
373
+ const [path4, argument] = match[0].replace(/#! ?/, "").split(" ");
374
+ const binary = path4.split("/").pop();
375
+ if (binary === "env") {
376
+ return argument;
377
+ }
378
+ return argument ? `${binary} ${argument}` : binary;
379
+ };
380
+ }
381
+ });
382
+ var require_readShebang = (0, import_chunk_2ESYSVXG.__commonJS)({
383
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module2) {
384
+ "use strict";
385
+ var fs = (0, import_chunk_2ESYSVXG.__require)("fs");
386
+ var shebangCommand = require_shebang_command();
387
+ function readShebang(command) {
388
+ const size = 150;
389
+ const buffer = Buffer.alloc(size);
390
+ let fd;
391
+ try {
392
+ fd = fs.openSync(command, "r");
393
+ fs.readSync(fd, buffer, 0, size, 0);
394
+ fs.closeSync(fd);
395
+ } catch (e) {
396
+ }
397
+ return shebangCommand(buffer.toString());
398
+ }
399
+ module2.exports = readShebang;
400
+ }
401
+ });
402
+ var require_parse = (0, import_chunk_2ESYSVXG.__commonJS)({
403
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports, module2) {
404
+ "use strict";
405
+ var path4 = (0, import_chunk_2ESYSVXG.__require)("path");
406
+ var resolveCommand = require_resolveCommand();
407
+ var escape = require_escape();
408
+ var readShebang = require_readShebang();
409
+ var isWin = process.platform === "win32";
410
+ var isExecutableRegExp = /\.(?:com|exe)$/i;
411
+ var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
412
+ function detectShebang(parsed) {
413
+ parsed.file = resolveCommand(parsed);
414
+ const shebang = parsed.file && readShebang(parsed.file);
415
+ if (shebang) {
416
+ parsed.args.unshift(parsed.file);
417
+ parsed.command = shebang;
418
+ return resolveCommand(parsed);
419
+ }
420
+ return parsed.file;
421
+ }
422
+ function parseNonShell(parsed) {
423
+ if (!isWin) {
424
+ return parsed;
425
+ }
426
+ const commandFile = detectShebang(parsed);
427
+ const needsShell = !isExecutableRegExp.test(commandFile);
428
+ if (parsed.options.forceShell || needsShell) {
429
+ const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
430
+ parsed.command = path4.normalize(parsed.command);
431
+ parsed.command = escape.command(parsed.command);
432
+ parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
433
+ const shellCommand = [parsed.command].concat(parsed.args).join(" ");
434
+ parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
435
+ parsed.command = process.env.comspec || "cmd.exe";
436
+ parsed.options.windowsVerbatimArguments = true;
437
+ }
438
+ return parsed;
439
+ }
440
+ function parse(command, args, options) {
441
+ if (args && !Array.isArray(args)) {
442
+ options = args;
443
+ args = null;
444
+ }
445
+ args = args ? args.slice(0) : [];
446
+ options = Object.assign({}, options);
447
+ const parsed = {
448
+ command,
449
+ args,
450
+ options,
451
+ file: void 0,
452
+ original: {
453
+ command,
454
+ args
455
+ }
456
+ };
457
+ return options.shell ? parsed : parseNonShell(parsed);
458
+ }
459
+ module2.exports = parse;
460
+ }
461
+ });
462
+ var require_enoent = (0, import_chunk_2ESYSVXG.__commonJS)({
463
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js"(exports, module2) {
464
+ "use strict";
465
+ var isWin = process.platform === "win32";
466
+ function notFoundError(original, syscall) {
467
+ return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
468
+ code: "ENOENT",
469
+ errno: "ENOENT",
470
+ syscall: `${syscall} ${original.command}`,
471
+ path: original.command,
472
+ spawnargs: original.args
473
+ });
474
+ }
475
+ function hookChildProcess(cp, parsed) {
476
+ if (!isWin) {
477
+ return;
478
+ }
479
+ const originalEmit = cp.emit;
480
+ cp.emit = function(name, arg1) {
481
+ if (name === "exit") {
482
+ const err = verifyENOENT(arg1, parsed);
483
+ if (err) {
484
+ return originalEmit.call(cp, "error", err);
485
+ }
486
+ }
487
+ return originalEmit.apply(cp, arguments);
488
+ };
489
+ }
490
+ function verifyENOENT(status, parsed) {
491
+ if (isWin && status === 1 && !parsed.file) {
492
+ return notFoundError(parsed.original, "spawn");
493
+ }
494
+ return null;
495
+ }
496
+ function verifyENOENTSync(status, parsed) {
497
+ if (isWin && status === 1 && !parsed.file) {
498
+ return notFoundError(parsed.original, "spawnSync");
499
+ }
500
+ return null;
501
+ }
502
+ module2.exports = {
503
+ hookChildProcess,
504
+ verifyENOENT,
505
+ verifyENOENTSync,
506
+ notFoundError
507
+ };
508
+ }
509
+ });
510
+ var require_cross_spawn = (0, import_chunk_2ESYSVXG.__commonJS)({
511
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js"(exports, module2) {
512
+ "use strict";
513
+ var cp = (0, import_chunk_2ESYSVXG.__require)("child_process");
514
+ var parse = require_parse();
515
+ var enoent = require_enoent();
516
+ function spawn(command, args, options) {
517
+ const parsed = parse(command, args, options);
518
+ const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
519
+ enoent.hookChildProcess(spawned, parsed);
520
+ return spawned;
521
+ }
522
+ function spawnSync(command, args, options) {
523
+ const parsed = parse(command, args, options);
524
+ const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
525
+ result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
526
+ return result;
527
+ }
528
+ module2.exports = spawn;
529
+ module2.exports.spawn = spawn;
530
+ module2.exports.sync = spawnSync;
531
+ module2.exports._parse = parse;
532
+ module2.exports._enoent = enoent;
533
+ }
534
+ });
535
+ var require_merge_stream = (0, import_chunk_2ESYSVXG.__commonJS)({
536
+ "../../node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js"(exports, module2) {
537
+ "use strict";
538
+ var { PassThrough } = (0, import_chunk_2ESYSVXG.__require)("stream");
539
+ module2.exports = function() {
540
+ var sources = [];
541
+ var output = new PassThrough({ objectMode: true });
542
+ output.setMaxListeners(0);
543
+ output.add = add;
544
+ output.isEmpty = isEmpty;
545
+ output.on("unpipe", remove);
546
+ Array.prototype.slice.call(arguments).forEach(add);
547
+ return output;
548
+ function add(source) {
549
+ if (Array.isArray(source)) {
550
+ source.forEach(add);
551
+ return this;
552
+ }
553
+ sources.push(source);
554
+ source.once("end", remove.bind(null, source));
555
+ source.once("error", output.emit.bind(output, "error"));
556
+ source.pipe(output, { end: false });
557
+ return this;
558
+ }
559
+ function isEmpty() {
560
+ return sources.length == 0;
561
+ }
562
+ function remove(source) {
563
+ sources = sources.filter(function(it) {
564
+ return it !== source;
565
+ });
566
+ if (!sources.length && output.readable) {
567
+ output.end();
568
+ }
569
+ }
570
+ };
571
+ }
572
+ });
573
+ var import_cross_spawn = (0, import_chunk_2ESYSVXG.__toESM)(require_cross_spawn(), 1);
574
+ function stripFinalNewline(input) {
575
+ const LF = typeof input === "string" ? "\n" : "\n".charCodeAt();
576
+ const CR = typeof input === "string" ? "\r" : "\r".charCodeAt();
577
+ if (input[input.length - 1] === LF) {
578
+ input = input.slice(0, -1);
579
+ }
580
+ if (input[input.length - 1] === CR) {
581
+ input = input.slice(0, -1);
582
+ }
583
+ return input;
584
+ }
585
+ function pathKey(options = {}) {
586
+ const {
587
+ env = process.env,
588
+ platform = process.platform
589
+ } = options;
590
+ if (platform !== "win32") {
591
+ return "PATH";
592
+ }
593
+ return Object.keys(env).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
594
+ }
595
+ var npmRunPath = ({
596
+ cwd = import_node_process2.default.cwd(),
597
+ path: pathOption = import_node_process2.default.env[pathKey()],
598
+ preferLocal = true,
599
+ execPath = import_node_process2.default.execPath,
600
+ addExecPath = true
601
+ } = {}) => {
602
+ const cwdString = cwd instanceof URL ? (0, import_node_url.fileURLToPath)(cwd) : cwd;
603
+ const cwdPath = import_node_path3.default.resolve(cwdString);
604
+ const result = [];
605
+ if (preferLocal) {
606
+ applyPreferLocal(result, cwdPath);
607
+ }
608
+ if (addExecPath) {
609
+ applyExecPath(result, execPath, cwdPath);
610
+ }
611
+ return [...result, pathOption].join(import_node_path3.default.delimiter);
612
+ };
613
+ var applyPreferLocal = (result, cwdPath) => {
614
+ let previous;
615
+ while (previous !== cwdPath) {
616
+ result.push(import_node_path3.default.join(cwdPath, "node_modules/.bin"));
617
+ previous = cwdPath;
618
+ cwdPath = import_node_path3.default.resolve(cwdPath, "..");
619
+ }
620
+ };
621
+ var applyExecPath = (result, execPath, cwdPath) => {
622
+ const execPathString = execPath instanceof URL ? (0, import_node_url.fileURLToPath)(execPath) : execPath;
623
+ result.push(import_node_path3.default.resolve(cwdPath, execPathString, ".."));
624
+ };
625
+ var npmRunPathEnv = ({ env = import_node_process2.default.env, ...options } = {}) => {
626
+ env = { ...env };
627
+ const pathName = pathKey({ env });
628
+ options.path = env[pathName];
629
+ env[pathName] = npmRunPath(options);
630
+ return env;
631
+ };
632
+ var copyProperty = (to, from, property, ignoreNonConfigurable) => {
633
+ if (property === "length" || property === "prototype") {
634
+ return;
635
+ }
636
+ if (property === "arguments" || property === "caller") {
637
+ return;
638
+ }
639
+ const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
640
+ const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
641
+ if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
642
+ return;
643
+ }
644
+ Object.defineProperty(to, property, fromDescriptor);
645
+ };
646
+ var canCopyProperty = function(toDescriptor, fromDescriptor) {
647
+ return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
648
+ };
649
+ var changePrototype = (to, from) => {
650
+ const fromPrototype = Object.getPrototypeOf(from);
651
+ if (fromPrototype === Object.getPrototypeOf(to)) {
652
+ return;
653
+ }
654
+ Object.setPrototypeOf(to, fromPrototype);
655
+ };
656
+ var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
657
+ ${fromBody}`;
658
+ var toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
659
+ var toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
660
+ var changeToString = (to, from, name) => {
661
+ const withName = name === "" ? "" : `with ${name.trim()}() `;
662
+ const newToString = wrappedToString.bind(null, withName, from.toString());
663
+ Object.defineProperty(newToString, "name", toStringName);
664
+ Object.defineProperty(to, "toString", { ...toStringDescriptor, value: newToString });
665
+ };
666
+ function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
667
+ const { name } = to;
668
+ for (const property of Reflect.ownKeys(from)) {
669
+ copyProperty(to, from, property, ignoreNonConfigurable);
670
+ }
671
+ changePrototype(to, from);
672
+ changeToString(to, from, name);
673
+ return to;
674
+ }
675
+ var calledFunctions = /* @__PURE__ */ new WeakMap();
676
+ var onetime = (function_, options = {}) => {
677
+ if (typeof function_ !== "function") {
678
+ throw new TypeError("Expected a function");
679
+ }
680
+ let returnValue;
681
+ let callCount = 0;
682
+ const functionName = function_.displayName || function_.name || "<anonymous>";
683
+ const onetime2 = function(...arguments_) {
684
+ calledFunctions.set(onetime2, ++callCount);
685
+ if (callCount === 1) {
686
+ returnValue = function_.apply(this, arguments_);
687
+ function_ = null;
688
+ } else if (options.throw === true) {
689
+ throw new Error(`Function \`${functionName}\` can only be called once`);
690
+ }
691
+ return returnValue;
692
+ };
693
+ mimicFunction(onetime2, function_);
694
+ calledFunctions.set(onetime2, callCount);
695
+ return onetime2;
696
+ };
697
+ onetime.callCount = (function_) => {
698
+ if (!calledFunctions.has(function_)) {
699
+ throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
700
+ }
701
+ return calledFunctions.get(function_);
702
+ };
703
+ var onetime_default = onetime;
704
+ var getRealtimeSignals = () => {
705
+ const length = SIGRTMAX - SIGRTMIN + 1;
706
+ return Array.from({ length }, getRealtimeSignal);
707
+ };
708
+ var getRealtimeSignal = (value, index) => ({
709
+ name: `SIGRT${index + 1}`,
710
+ number: SIGRTMIN + index,
711
+ action: "terminate",
712
+ description: "Application-specific signal (realtime)",
713
+ standard: "posix"
714
+ });
715
+ var SIGRTMIN = 34;
716
+ var SIGRTMAX = 64;
717
+ var SIGNALS = [
718
+ {
719
+ name: "SIGHUP",
720
+ number: 1,
721
+ action: "terminate",
722
+ description: "Terminal closed",
723
+ standard: "posix"
724
+ },
725
+ {
726
+ name: "SIGINT",
727
+ number: 2,
728
+ action: "terminate",
729
+ description: "User interruption with CTRL-C",
730
+ standard: "ansi"
731
+ },
732
+ {
733
+ name: "SIGQUIT",
734
+ number: 3,
735
+ action: "core",
736
+ description: "User interruption with CTRL-\\",
737
+ standard: "posix"
738
+ },
739
+ {
740
+ name: "SIGILL",
741
+ number: 4,
742
+ action: "core",
743
+ description: "Invalid machine instruction",
744
+ standard: "ansi"
745
+ },
746
+ {
747
+ name: "SIGTRAP",
748
+ number: 5,
749
+ action: "core",
750
+ description: "Debugger breakpoint",
751
+ standard: "posix"
752
+ },
753
+ {
754
+ name: "SIGABRT",
755
+ number: 6,
756
+ action: "core",
757
+ description: "Aborted",
758
+ standard: "ansi"
759
+ },
760
+ {
761
+ name: "SIGIOT",
762
+ number: 6,
763
+ action: "core",
764
+ description: "Aborted",
765
+ standard: "bsd"
766
+ },
767
+ {
768
+ name: "SIGBUS",
769
+ number: 7,
770
+ action: "core",
771
+ description: "Bus error due to misaligned, non-existing address or paging error",
772
+ standard: "bsd"
773
+ },
774
+ {
775
+ name: "SIGEMT",
776
+ number: 7,
777
+ action: "terminate",
778
+ description: "Command should be emulated but is not implemented",
779
+ standard: "other"
780
+ },
781
+ {
782
+ name: "SIGFPE",
783
+ number: 8,
784
+ action: "core",
785
+ description: "Floating point arithmetic error",
786
+ standard: "ansi"
787
+ },
788
+ {
789
+ name: "SIGKILL",
790
+ number: 9,
791
+ action: "terminate",
792
+ description: "Forced termination",
793
+ standard: "posix",
794
+ forced: true
795
+ },
796
+ {
797
+ name: "SIGUSR1",
798
+ number: 10,
799
+ action: "terminate",
800
+ description: "Application-specific signal",
801
+ standard: "posix"
802
+ },
803
+ {
804
+ name: "SIGSEGV",
805
+ number: 11,
806
+ action: "core",
807
+ description: "Segmentation fault",
808
+ standard: "ansi"
809
+ },
810
+ {
811
+ name: "SIGUSR2",
812
+ number: 12,
813
+ action: "terminate",
814
+ description: "Application-specific signal",
815
+ standard: "posix"
816
+ },
817
+ {
818
+ name: "SIGPIPE",
819
+ number: 13,
820
+ action: "terminate",
821
+ description: "Broken pipe or socket",
822
+ standard: "posix"
823
+ },
824
+ {
825
+ name: "SIGALRM",
826
+ number: 14,
827
+ action: "terminate",
828
+ description: "Timeout or timer",
829
+ standard: "posix"
830
+ },
831
+ {
832
+ name: "SIGTERM",
833
+ number: 15,
834
+ action: "terminate",
835
+ description: "Termination",
836
+ standard: "ansi"
837
+ },
838
+ {
839
+ name: "SIGSTKFLT",
840
+ number: 16,
841
+ action: "terminate",
842
+ description: "Stack is empty or overflowed",
843
+ standard: "other"
844
+ },
845
+ {
846
+ name: "SIGCHLD",
847
+ number: 17,
848
+ action: "ignore",
849
+ description: "Child process terminated, paused or unpaused",
850
+ standard: "posix"
851
+ },
852
+ {
853
+ name: "SIGCLD",
854
+ number: 17,
855
+ action: "ignore",
856
+ description: "Child process terminated, paused or unpaused",
857
+ standard: "other"
858
+ },
859
+ {
860
+ name: "SIGCONT",
861
+ number: 18,
862
+ action: "unpause",
863
+ description: "Unpaused",
864
+ standard: "posix",
865
+ forced: true
866
+ },
867
+ {
868
+ name: "SIGSTOP",
869
+ number: 19,
870
+ action: "pause",
871
+ description: "Paused",
872
+ standard: "posix",
873
+ forced: true
874
+ },
875
+ {
876
+ name: "SIGTSTP",
877
+ number: 20,
878
+ action: "pause",
879
+ description: 'Paused using CTRL-Z or "suspend"',
880
+ standard: "posix"
881
+ },
882
+ {
883
+ name: "SIGTTIN",
884
+ number: 21,
885
+ action: "pause",
886
+ description: "Background process cannot read terminal input",
887
+ standard: "posix"
888
+ },
889
+ {
890
+ name: "SIGBREAK",
891
+ number: 21,
892
+ action: "terminate",
893
+ description: "User interruption with CTRL-BREAK",
894
+ standard: "other"
895
+ },
896
+ {
897
+ name: "SIGTTOU",
898
+ number: 22,
899
+ action: "pause",
900
+ description: "Background process cannot write to terminal output",
901
+ standard: "posix"
902
+ },
903
+ {
904
+ name: "SIGURG",
905
+ number: 23,
906
+ action: "ignore",
907
+ description: "Socket received out-of-band data",
908
+ standard: "bsd"
909
+ },
910
+ {
911
+ name: "SIGXCPU",
912
+ number: 24,
913
+ action: "core",
914
+ description: "Process timed out",
915
+ standard: "bsd"
916
+ },
917
+ {
918
+ name: "SIGXFSZ",
919
+ number: 25,
920
+ action: "core",
921
+ description: "File too big",
922
+ standard: "bsd"
923
+ },
924
+ {
925
+ name: "SIGVTALRM",
926
+ number: 26,
927
+ action: "terminate",
928
+ description: "Timeout or timer",
929
+ standard: "bsd"
930
+ },
931
+ {
932
+ name: "SIGPROF",
933
+ number: 27,
934
+ action: "terminate",
935
+ description: "Timeout or timer",
936
+ standard: "bsd"
937
+ },
938
+ {
939
+ name: "SIGWINCH",
940
+ number: 28,
941
+ action: "ignore",
942
+ description: "Terminal window size changed",
943
+ standard: "bsd"
944
+ },
945
+ {
946
+ name: "SIGIO",
947
+ number: 29,
948
+ action: "terminate",
949
+ description: "I/O is available",
950
+ standard: "other"
951
+ },
952
+ {
953
+ name: "SIGPOLL",
954
+ number: 29,
955
+ action: "terminate",
956
+ description: "Watched event",
957
+ standard: "other"
958
+ },
959
+ {
960
+ name: "SIGINFO",
961
+ number: 29,
962
+ action: "ignore",
963
+ description: "Request for process information",
964
+ standard: "other"
965
+ },
966
+ {
967
+ name: "SIGPWR",
968
+ number: 30,
969
+ action: "terminate",
970
+ description: "Device running out of power",
971
+ standard: "systemv"
972
+ },
973
+ {
974
+ name: "SIGSYS",
975
+ number: 31,
976
+ action: "core",
977
+ description: "Invalid system call",
978
+ standard: "other"
979
+ },
980
+ {
981
+ name: "SIGUNUSED",
982
+ number: 31,
983
+ action: "terminate",
984
+ description: "Invalid system call",
985
+ standard: "other"
986
+ }
987
+ ];
988
+ var getSignals = () => {
989
+ const realtimeSignals = getRealtimeSignals();
990
+ const signals = [...SIGNALS, ...realtimeSignals].map(normalizeSignal);
991
+ return signals;
992
+ };
993
+ var normalizeSignal = ({
994
+ name,
995
+ number: defaultNumber,
996
+ description,
997
+ action,
998
+ forced = false,
999
+ standard
1000
+ }) => {
1001
+ const {
1002
+ signals: { [name]: constantSignal }
1003
+ } = import_node_os2.constants;
1004
+ const supported = constantSignal !== void 0;
1005
+ const number = supported ? constantSignal : defaultNumber;
1006
+ return { name, number, description, supported, action, forced, standard };
1007
+ };
1008
+ var getSignalsByName = () => {
1009
+ const signals = getSignals();
1010
+ return Object.fromEntries(signals.map(getSignalByName));
1011
+ };
1012
+ var getSignalByName = ({
1013
+ name,
1014
+ number,
1015
+ description,
1016
+ supported,
1017
+ action,
1018
+ forced,
1019
+ standard
1020
+ }) => [name, { name, number, description, supported, action, forced, standard }];
1021
+ var signalsByName = getSignalsByName();
1022
+ var getSignalsByNumber = () => {
1023
+ const signals = getSignals();
1024
+ const length = SIGRTMAX + 1;
1025
+ const signalsA = Array.from(
1026
+ { length },
1027
+ (value, number) => getSignalByNumber(number, signals)
1028
+ );
1029
+ return Object.assign({}, ...signalsA);
1030
+ };
1031
+ var getSignalByNumber = (number, signals) => {
1032
+ const signal = findSignalByNumber(number, signals);
1033
+ if (signal === void 0) {
1034
+ return {};
1035
+ }
1036
+ const { name, description, supported, action, forced, standard } = signal;
1037
+ return {
1038
+ [number]: {
1039
+ name,
1040
+ number,
1041
+ description,
1042
+ supported,
1043
+ action,
1044
+ forced,
1045
+ standard
1046
+ }
1047
+ };
1048
+ };
1049
+ var findSignalByNumber = (number, signals) => {
1050
+ const signal = signals.find(({ name }) => import_node_os.constants.signals[name] === number);
1051
+ if (signal !== void 0) {
1052
+ return signal;
1053
+ }
1054
+ return signals.find((signalA) => signalA.number === number);
1055
+ };
1056
+ var signalsByNumber = getSignalsByNumber();
1057
+ var getErrorPrefix = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled }) => {
1058
+ if (timedOut) {
1059
+ return `timed out after ${timeout} milliseconds`;
1060
+ }
1061
+ if (isCanceled) {
1062
+ return "was canceled";
1063
+ }
1064
+ if (errorCode !== void 0) {
1065
+ return `failed with ${errorCode}`;
1066
+ }
1067
+ if (signal !== void 0) {
1068
+ return `was killed with ${signal} (${signalDescription})`;
1069
+ }
1070
+ if (exitCode !== void 0) {
1071
+ return `failed with exit code ${exitCode}`;
1072
+ }
1073
+ return "failed";
1074
+ };
1075
+ var makeError = ({
1076
+ stdout,
1077
+ stderr,
1078
+ all,
1079
+ error,
1080
+ signal,
1081
+ exitCode,
1082
+ command,
1083
+ escapedCommand,
1084
+ timedOut,
1085
+ isCanceled,
1086
+ killed,
1087
+ parsed: { options: { timeout, cwd = import_node_process3.default.cwd() } }
1088
+ }) => {
1089
+ exitCode = exitCode === null ? void 0 : exitCode;
1090
+ signal = signal === null ? void 0 : signal;
1091
+ const signalDescription = signal === void 0 ? void 0 : signalsByName[signal].description;
1092
+ const errorCode = error && error.code;
1093
+ const prefix = getErrorPrefix({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled });
1094
+ const execaMessage = `Command ${prefix}: ${command}`;
1095
+ const isError = Object.prototype.toString.call(error) === "[object Error]";
1096
+ const shortMessage = isError ? `${execaMessage}
1097
+ ${error.message}` : execaMessage;
1098
+ const message = [shortMessage, stderr, stdout].filter(Boolean).join("\n");
1099
+ if (isError) {
1100
+ error.originalMessage = error.message;
1101
+ error.message = message;
1102
+ } else {
1103
+ error = new Error(message);
1104
+ }
1105
+ error.shortMessage = shortMessage;
1106
+ error.command = command;
1107
+ error.escapedCommand = escapedCommand;
1108
+ error.exitCode = exitCode;
1109
+ error.signal = signal;
1110
+ error.signalDescription = signalDescription;
1111
+ error.stdout = stdout;
1112
+ error.stderr = stderr;
1113
+ error.cwd = cwd;
1114
+ if (all !== void 0) {
1115
+ error.all = all;
1116
+ }
1117
+ if ("bufferedData" in error) {
1118
+ delete error.bufferedData;
1119
+ }
1120
+ error.failed = true;
1121
+ error.timedOut = Boolean(timedOut);
1122
+ error.isCanceled = isCanceled;
1123
+ error.killed = killed && !timedOut;
1124
+ return error;
1125
+ };
1126
+ var aliases = ["stdin", "stdout", "stderr"];
1127
+ var hasAlias = (options) => aliases.some((alias) => options[alias] !== void 0);
1128
+ var normalizeStdio = (options) => {
1129
+ if (!options) {
1130
+ return;
1131
+ }
1132
+ const { stdio } = options;
1133
+ if (stdio === void 0) {
1134
+ return aliases.map((alias) => options[alias]);
1135
+ }
1136
+ if (hasAlias(options)) {
1137
+ throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map((alias) => `\`${alias}\``).join(", ")}`);
1138
+ }
1139
+ if (typeof stdio === "string") {
1140
+ return stdio;
1141
+ }
1142
+ if (!Array.isArray(stdio)) {
1143
+ throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
1144
+ }
1145
+ const length = Math.max(stdio.length, aliases.length);
1146
+ return Array.from({ length }, (value, index) => stdio[index]);
1147
+ };
1148
+ var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
1149
+ var spawnedKill = (kill, signal = "SIGTERM", options = {}) => {
1150
+ const killResult = kill(signal);
1151
+ setKillTimeout(kill, signal, options, killResult);
1152
+ return killResult;
1153
+ };
1154
+ var setKillTimeout = (kill, signal, options, killResult) => {
1155
+ if (!shouldForceKill(signal, options, killResult)) {
1156
+ return;
1157
+ }
1158
+ const timeout = getForceKillAfterTimeout(options);
1159
+ const t = setTimeout(() => {
1160
+ kill("SIGKILL");
1161
+ }, timeout);
1162
+ if (t.unref) {
1163
+ t.unref();
1164
+ }
1165
+ };
1166
+ var shouldForceKill = (signal, { forceKillAfterTimeout }, killResult) => isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
1167
+ var isSigterm = (signal) => signal === import_node_os3.default.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
1168
+ var getForceKillAfterTimeout = ({ forceKillAfterTimeout = true }) => {
1169
+ if (forceKillAfterTimeout === true) {
1170
+ return DEFAULT_FORCE_KILL_TIMEOUT;
1171
+ }
1172
+ if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
1173
+ throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
1174
+ }
1175
+ return forceKillAfterTimeout;
1176
+ };
1177
+ var spawnedCancel = (spawned, context) => {
1178
+ const killResult = spawned.kill();
1179
+ if (killResult) {
1180
+ context.isCanceled = true;
1181
+ }
1182
+ };
1183
+ var timeoutKill = (spawned, signal, reject) => {
1184
+ spawned.kill(signal);
1185
+ reject(Object.assign(new Error("Timed out"), { timedOut: true, signal }));
1186
+ };
1187
+ var setupTimeout = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise) => {
1188
+ if (timeout === 0 || timeout === void 0) {
1189
+ return spawnedPromise;
1190
+ }
1191
+ let timeoutId;
1192
+ const timeoutPromise = new Promise((resolve, reject) => {
1193
+ timeoutId = setTimeout(() => {
1194
+ timeoutKill(spawned, killSignal, reject);
1195
+ }, timeout);
1196
+ });
1197
+ const safeSpawnedPromise = spawnedPromise.finally(() => {
1198
+ clearTimeout(timeoutId);
1199
+ });
1200
+ return Promise.race([timeoutPromise, safeSpawnedPromise]);
1201
+ };
1202
+ var validateTimeout = ({ timeout }) => {
1203
+ if (timeout !== void 0 && (!Number.isFinite(timeout) || timeout < 0)) {
1204
+ throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
1205
+ }
1206
+ };
1207
+ var setExitHandler = async (spawned, { cleanup, detached }, timedPromise) => {
1208
+ if (!cleanup || detached) {
1209
+ return timedPromise;
1210
+ }
1211
+ const removeExitHandler = (0, import_chunk_3WDCTXHL.onExit)(() => {
1212
+ spawned.kill();
1213
+ });
1214
+ return timedPromise.finally(() => {
1215
+ removeExitHandler();
1216
+ });
1217
+ };
1218
+ function isStream(stream) {
1219
+ return stream !== null && typeof stream === "object" && typeof stream.pipe === "function";
1220
+ }
1221
+ function isWritableStream(stream) {
1222
+ return isStream(stream) && stream.writable !== false && typeof stream._write === "function" && typeof stream._writableState === "object";
1223
+ }
1224
+ var isExecaChildProcess = (target) => target instanceof import_node_child_process2.ChildProcess && typeof target.then === "function";
1225
+ var pipeToTarget = (spawned, streamName, target) => {
1226
+ if (typeof target === "string") {
1227
+ spawned[streamName].pipe((0, import_node_fs.createWriteStream)(target));
1228
+ return spawned;
1229
+ }
1230
+ if (isWritableStream(target)) {
1231
+ spawned[streamName].pipe(target);
1232
+ return spawned;
1233
+ }
1234
+ if (!isExecaChildProcess(target)) {
1235
+ throw new TypeError("The second argument must be a string, a stream or an Execa child process.");
1236
+ }
1237
+ if (!isWritableStream(target.stdin)) {
1238
+ throw new TypeError("The target child process's stdin must be available.");
1239
+ }
1240
+ spawned[streamName].pipe(target.stdin);
1241
+ return target;
1242
+ };
1243
+ var addPipeMethods = (spawned) => {
1244
+ if (spawned.stdout !== null) {
1245
+ spawned.pipeStdout = pipeToTarget.bind(void 0, spawned, "stdout");
1246
+ }
1247
+ if (spawned.stderr !== null) {
1248
+ spawned.pipeStderr = pipeToTarget.bind(void 0, spawned, "stderr");
1249
+ }
1250
+ if (spawned.all !== void 0) {
1251
+ spawned.pipeAll = pipeToTarget.bind(void 0, spawned, "all");
1252
+ }
1253
+ };
1254
+ var getStreamContents = async (stream, { init, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, finalize }, { maxBuffer = Number.POSITIVE_INFINITY } = {}) => {
1255
+ if (!isAsyncIterable(stream)) {
1256
+ throw new Error("The first argument must be a Readable, a ReadableStream, or an async iterable.");
1257
+ }
1258
+ const state = init();
1259
+ state.length = 0;
1260
+ try {
1261
+ for await (const chunk of stream) {
1262
+ const chunkType = getChunkType(chunk);
1263
+ const convertedChunk = convertChunk[chunkType](chunk, state);
1264
+ appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
1265
+ }
1266
+ appendFinalChunk({ state, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer });
1267
+ return finalize(state);
1268
+ } catch (error) {
1269
+ error.bufferedData = finalize(state);
1270
+ throw error;
1271
+ }
1272
+ };
1273
+ var appendFinalChunk = ({ state, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer }) => {
1274
+ const convertedChunk = getFinalChunk(state);
1275
+ if (convertedChunk !== void 0) {
1276
+ appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
1277
+ }
1278
+ };
1279
+ var appendChunk = ({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer }) => {
1280
+ const chunkSize = getSize(convertedChunk);
1281
+ const newLength = state.length + chunkSize;
1282
+ if (newLength <= maxBuffer) {
1283
+ addNewChunk(convertedChunk, state, addChunk, newLength);
1284
+ return;
1285
+ }
1286
+ const truncatedChunk = truncateChunk(convertedChunk, maxBuffer - state.length);
1287
+ if (truncatedChunk !== void 0) {
1288
+ addNewChunk(truncatedChunk, state, addChunk, maxBuffer);
1289
+ }
1290
+ throw new MaxBufferError();
1291
+ };
1292
+ var addNewChunk = (convertedChunk, state, addChunk, newLength) => {
1293
+ state.contents = addChunk(convertedChunk, state, newLength);
1294
+ state.length = newLength;
1295
+ };
1296
+ var isAsyncIterable = (stream) => typeof stream === "object" && stream !== null && typeof stream[Symbol.asyncIterator] === "function";
1297
+ var getChunkType = (chunk) => {
1298
+ const typeOfChunk = typeof chunk;
1299
+ if (typeOfChunk === "string") {
1300
+ return "string";
1301
+ }
1302
+ if (typeOfChunk !== "object" || chunk === null) {
1303
+ return "others";
1304
+ }
1305
+ if (globalThis.Buffer?.isBuffer(chunk)) {
1306
+ return "buffer";
1307
+ }
1308
+ const prototypeName = objectToString.call(chunk);
1309
+ if (prototypeName === "[object ArrayBuffer]") {
1310
+ return "arrayBuffer";
1311
+ }
1312
+ if (prototypeName === "[object DataView]") {
1313
+ return "dataView";
1314
+ }
1315
+ if (Number.isInteger(chunk.byteLength) && Number.isInteger(chunk.byteOffset) && objectToString.call(chunk.buffer) === "[object ArrayBuffer]") {
1316
+ return "typedArray";
1317
+ }
1318
+ return "others";
1319
+ };
1320
+ var { toString: objectToString } = Object.prototype;
1321
+ var MaxBufferError = class extends Error {
1322
+ name = "MaxBufferError";
1323
+ constructor() {
1324
+ super("maxBuffer exceeded");
1325
+ }
1326
+ };
1327
+ var identity = (value) => value;
1328
+ var noop = () => void 0;
1329
+ var getContentsProp = ({ contents }) => contents;
1330
+ var throwObjectStream = (chunk) => {
1331
+ throw new Error(`Streams in object mode are not supported: ${String(chunk)}`);
1332
+ };
1333
+ var getLengthProp = (convertedChunk) => convertedChunk.length;
1334
+ async function getStreamAsArrayBuffer(stream, options) {
1335
+ return getStreamContents(stream, arrayBufferMethods, options);
1336
+ }
1337
+ var initArrayBuffer = () => ({ contents: new ArrayBuffer(0) });
1338
+ var useTextEncoder = (chunk) => textEncoder.encode(chunk);
1339
+ var textEncoder = new TextEncoder();
1340
+ var useUint8Array = (chunk) => new Uint8Array(chunk);
1341
+ var useUint8ArrayWithOffset = (chunk) => new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
1342
+ var truncateArrayBufferChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
1343
+ var addArrayBufferChunk = (convertedChunk, { contents, length: previousLength }, length) => {
1344
+ const newContents = hasArrayBufferResize() ? resizeArrayBuffer(contents, length) : resizeArrayBufferSlow(contents, length);
1345
+ new Uint8Array(newContents).set(convertedChunk, previousLength);
1346
+ return newContents;
1347
+ };
1348
+ var resizeArrayBufferSlow = (contents, length) => {
1349
+ if (length <= contents.byteLength) {
1350
+ return contents;
1351
+ }
1352
+ const arrayBuffer = new ArrayBuffer(getNewContentsLength(length));
1353
+ new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
1354
+ return arrayBuffer;
1355
+ };
1356
+ var resizeArrayBuffer = (contents, length) => {
1357
+ if (length <= contents.maxByteLength) {
1358
+ contents.resize(length);
1359
+ return contents;
1360
+ }
1361
+ const arrayBuffer = new ArrayBuffer(length, { maxByteLength: getNewContentsLength(length) });
1362
+ new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
1363
+ return arrayBuffer;
1364
+ };
1365
+ var getNewContentsLength = (length) => SCALE_FACTOR ** Math.ceil(Math.log(length) / Math.log(SCALE_FACTOR));
1366
+ var SCALE_FACTOR = 2;
1367
+ var finalizeArrayBuffer = ({ contents, length }) => hasArrayBufferResize() ? contents : contents.slice(0, length);
1368
+ var hasArrayBufferResize = () => "resize" in ArrayBuffer.prototype;
1369
+ var arrayBufferMethods = {
1370
+ init: initArrayBuffer,
1371
+ convertChunk: {
1372
+ string: useTextEncoder,
1373
+ buffer: useUint8Array,
1374
+ arrayBuffer: useUint8Array,
1375
+ dataView: useUint8ArrayWithOffset,
1376
+ typedArray: useUint8ArrayWithOffset,
1377
+ others: throwObjectStream
1378
+ },
1379
+ getSize: getLengthProp,
1380
+ truncateChunk: truncateArrayBufferChunk,
1381
+ addChunk: addArrayBufferChunk,
1382
+ getFinalChunk: noop,
1383
+ finalize: finalizeArrayBuffer
1384
+ };
1385
+ async function getStreamAsBuffer(stream, options) {
1386
+ if (!("Buffer" in globalThis)) {
1387
+ throw new Error("getStreamAsBuffer() is only supported in Node.js");
1388
+ }
1389
+ try {
1390
+ return arrayBufferToNodeBuffer(await getStreamAsArrayBuffer(stream, options));
1391
+ } catch (error) {
1392
+ if (error.bufferedData !== void 0) {
1393
+ error.bufferedData = arrayBufferToNodeBuffer(error.bufferedData);
1394
+ }
1395
+ throw error;
1396
+ }
1397
+ }
1398
+ var arrayBufferToNodeBuffer = (arrayBuffer) => globalThis.Buffer.from(arrayBuffer);
1399
+ async function getStreamAsString(stream, options) {
1400
+ return getStreamContents(stream, stringMethods, options);
1401
+ }
1402
+ var initString = () => ({ contents: "", textDecoder: new TextDecoder() });
1403
+ var useTextDecoder = (chunk, { textDecoder }) => textDecoder.decode(chunk, { stream: true });
1404
+ var addStringChunk = (convertedChunk, { contents }) => contents + convertedChunk;
1405
+ var truncateStringChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
1406
+ var getFinalStringChunk = ({ textDecoder }) => {
1407
+ const finalChunk = textDecoder.decode();
1408
+ return finalChunk === "" ? void 0 : finalChunk;
1409
+ };
1410
+ var stringMethods = {
1411
+ init: initString,
1412
+ convertChunk: {
1413
+ string: identity,
1414
+ buffer: useTextDecoder,
1415
+ arrayBuffer: useTextDecoder,
1416
+ dataView: useTextDecoder,
1417
+ typedArray: useTextDecoder,
1418
+ others: throwObjectStream
1419
+ },
1420
+ getSize: getLengthProp,
1421
+ truncateChunk: truncateStringChunk,
1422
+ addChunk: addStringChunk,
1423
+ getFinalChunk: getFinalStringChunk,
1424
+ finalize: getContentsProp
1425
+ };
1426
+ var import_merge_stream = (0, import_chunk_2ESYSVXG.__toESM)(require_merge_stream(), 1);
1427
+ var validateInputOptions = (input) => {
1428
+ if (input !== void 0) {
1429
+ throw new TypeError("The `input` and `inputFile` options cannot be both set.");
1430
+ }
1431
+ };
1432
+ var getInputSync = ({ input, inputFile }) => {
1433
+ if (typeof inputFile !== "string") {
1434
+ return input;
1435
+ }
1436
+ validateInputOptions(input);
1437
+ return (0, import_node_fs2.readFileSync)(inputFile);
1438
+ };
1439
+ var handleInputSync = (options) => {
1440
+ const input = getInputSync(options);
1441
+ if (isStream(input)) {
1442
+ throw new TypeError("The `input` option cannot be a stream in sync mode");
1443
+ }
1444
+ return input;
1445
+ };
1446
+ var getInput = ({ input, inputFile }) => {
1447
+ if (typeof inputFile !== "string") {
1448
+ return input;
1449
+ }
1450
+ validateInputOptions(input);
1451
+ return (0, import_node_fs2.createReadStream)(inputFile);
1452
+ };
1453
+ var handleInput = (spawned, options) => {
1454
+ const input = getInput(options);
1455
+ if (input === void 0) {
1456
+ return;
1457
+ }
1458
+ if (isStream(input)) {
1459
+ input.pipe(spawned.stdin);
1460
+ } else {
1461
+ spawned.stdin.end(input);
1462
+ }
1463
+ };
1464
+ var makeAllStream = (spawned, { all }) => {
1465
+ if (!all || !spawned.stdout && !spawned.stderr) {
1466
+ return;
1467
+ }
1468
+ const mixed = (0, import_merge_stream.default)();
1469
+ if (spawned.stdout) {
1470
+ mixed.add(spawned.stdout);
1471
+ }
1472
+ if (spawned.stderr) {
1473
+ mixed.add(spawned.stderr);
1474
+ }
1475
+ return mixed;
1476
+ };
1477
+ var getBufferedData = async (stream, streamPromise) => {
1478
+ if (!stream || streamPromise === void 0) {
1479
+ return;
1480
+ }
1481
+ await (0, import_promises.setTimeout)(0);
1482
+ stream.destroy();
1483
+ try {
1484
+ return await streamPromise;
1485
+ } catch (error) {
1486
+ return error.bufferedData;
1487
+ }
1488
+ };
1489
+ var getStreamPromise = (stream, { encoding, buffer, maxBuffer }) => {
1490
+ if (!stream || !buffer) {
1491
+ return;
1492
+ }
1493
+ if (encoding === "utf8" || encoding === "utf-8") {
1494
+ return getStreamAsString(stream, { maxBuffer });
1495
+ }
1496
+ if (encoding === null || encoding === "buffer") {
1497
+ return getStreamAsBuffer(stream, { maxBuffer });
1498
+ }
1499
+ return applyEncoding(stream, maxBuffer, encoding);
1500
+ };
1501
+ var applyEncoding = async (stream, maxBuffer, encoding) => {
1502
+ const buffer = await getStreamAsBuffer(stream, { maxBuffer });
1503
+ return buffer.toString(encoding);
1504
+ };
1505
+ var getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone) => {
1506
+ const stdoutPromise = getStreamPromise(stdout, { encoding, buffer, maxBuffer });
1507
+ const stderrPromise = getStreamPromise(stderr, { encoding, buffer, maxBuffer });
1508
+ const allPromise = getStreamPromise(all, { encoding, buffer, maxBuffer: maxBuffer * 2 });
1509
+ try {
1510
+ return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
1511
+ } catch (error) {
1512
+ return Promise.all([
1513
+ { error, signal: error.signal, timedOut: error.timedOut },
1514
+ getBufferedData(stdout, stdoutPromise),
1515
+ getBufferedData(stderr, stderrPromise),
1516
+ getBufferedData(all, allPromise)
1517
+ ]);
1518
+ }
1519
+ };
1520
+ var nativePromisePrototype = (async () => {
1521
+ })().constructor.prototype;
1522
+ var descriptors = ["then", "catch", "finally"].map((property) => [
1523
+ property,
1524
+ Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
1525
+ ]);
1526
+ var mergePromise = (spawned, promise) => {
1527
+ for (const [property, descriptor] of descriptors) {
1528
+ const value = typeof promise === "function" ? (...args) => Reflect.apply(descriptor.value, promise(), args) : descriptor.value.bind(promise);
1529
+ Reflect.defineProperty(spawned, property, { ...descriptor, value });
1530
+ }
1531
+ };
1532
+ var getSpawnedPromise = (spawned) => new Promise((resolve, reject) => {
1533
+ spawned.on("exit", (exitCode, signal) => {
1534
+ resolve({ exitCode, signal });
1535
+ });
1536
+ spawned.on("error", (error) => {
1537
+ reject(error);
1538
+ });
1539
+ if (spawned.stdin) {
1540
+ spawned.stdin.on("error", (error) => {
1541
+ reject(error);
1542
+ });
1543
+ }
1544
+ });
1545
+ var normalizeArgs = (file, args = []) => {
1546
+ if (!Array.isArray(args)) {
1547
+ return [file];
1548
+ }
1549
+ return [file, ...args];
1550
+ };
1551
+ var NO_ESCAPE_REGEXP = /^[\w.-]+$/;
1552
+ var escapeArg = (arg) => {
1553
+ if (typeof arg !== "string" || NO_ESCAPE_REGEXP.test(arg)) {
1554
+ return arg;
1555
+ }
1556
+ return `"${arg.replaceAll('"', '\\"')}"`;
1557
+ };
1558
+ var joinCommand = (file, args) => normalizeArgs(file, args).join(" ");
1559
+ var getEscapedCommand = (file, args) => normalizeArgs(file, args).map((arg) => escapeArg(arg)).join(" ");
1560
+ var SPACES_REGEXP = / +/g;
1561
+ var parseCommand = (command) => {
1562
+ const tokens = [];
1563
+ for (const token of command.trim().split(SPACES_REGEXP)) {
1564
+ const previousToken = tokens.at(-1);
1565
+ if (previousToken && previousToken.endsWith("\\")) {
1566
+ tokens[tokens.length - 1] = `${previousToken.slice(0, -1)} ${token}`;
1567
+ } else {
1568
+ tokens.push(token);
1569
+ }
1570
+ }
1571
+ return tokens;
1572
+ };
1573
+ var parseExpression = (expression) => {
1574
+ const typeOfExpression = typeof expression;
1575
+ if (typeOfExpression === "string") {
1576
+ return expression;
1577
+ }
1578
+ if (typeOfExpression === "number") {
1579
+ return String(expression);
1580
+ }
1581
+ if (typeOfExpression === "object" && expression !== null && !(expression instanceof import_node_child_process3.ChildProcess) && "stdout" in expression) {
1582
+ const typeOfStdout = typeof expression.stdout;
1583
+ if (typeOfStdout === "string") {
1584
+ return expression.stdout;
1585
+ }
1586
+ if (import_node_buffer2.Buffer.isBuffer(expression.stdout)) {
1587
+ return expression.stdout.toString();
1588
+ }
1589
+ throw new TypeError(`Unexpected "${typeOfStdout}" stdout in template expression`);
1590
+ }
1591
+ throw new TypeError(`Unexpected "${typeOfExpression}" in template expression`);
1592
+ };
1593
+ var concatTokens = (tokens, nextTokens, isNew) => isNew || tokens.length === 0 || nextTokens.length === 0 ? [...tokens, ...nextTokens] : [
1594
+ ...tokens.slice(0, -1),
1595
+ `${tokens.at(-1)}${nextTokens[0]}`,
1596
+ ...nextTokens.slice(1)
1597
+ ];
1598
+ var parseTemplate = ({ templates, expressions, tokens, index, template }) => {
1599
+ const templateString = template ?? templates.raw[index];
1600
+ const templateTokens = templateString.split(SPACES_REGEXP).filter(Boolean);
1601
+ const newTokens = concatTokens(
1602
+ tokens,
1603
+ templateTokens,
1604
+ templateString.startsWith(" ")
1605
+ );
1606
+ if (index === expressions.length) {
1607
+ return newTokens;
1608
+ }
1609
+ const expression = expressions[index];
1610
+ const expressionTokens = Array.isArray(expression) ? expression.map((expression2) => parseExpression(expression2)) : [parseExpression(expression)];
1611
+ return concatTokens(
1612
+ newTokens,
1613
+ expressionTokens,
1614
+ templateString.endsWith(" ")
1615
+ );
1616
+ };
1617
+ var parseTemplates = (templates, expressions) => {
1618
+ let tokens = [];
1619
+ for (const [index, template] of templates.entries()) {
1620
+ tokens = parseTemplate({ templates, expressions, tokens, index, template });
1621
+ }
1622
+ return tokens;
1623
+ };
1624
+ var verboseDefault = (0, import_node_util.debuglog)("execa").enabled;
1625
+ var padField = (field, padding) => String(field).padStart(padding, "0");
1626
+ var getTimestamp = () => {
1627
+ const date = /* @__PURE__ */ new Date();
1628
+ return `${padField(date.getHours(), 2)}:${padField(date.getMinutes(), 2)}:${padField(date.getSeconds(), 2)}.${padField(date.getMilliseconds(), 3)}`;
1629
+ };
1630
+ var logCommand = (escapedCommand, { verbose }) => {
1631
+ if (!verbose) {
1632
+ return;
1633
+ }
1634
+ import_node_process4.default.stderr.write(`[${getTimestamp()}] ${escapedCommand}
1635
+ `);
1636
+ };
1637
+ var DEFAULT_MAX_BUFFER = 1e3 * 1e3 * 100;
1638
+ var getEnv = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
1639
+ const env = extendEnv ? { ...import_node_process.default.env, ...envOption } : envOption;
1640
+ if (preferLocal) {
1641
+ return npmRunPathEnv({ env, cwd: localDir, execPath });
1642
+ }
1643
+ return env;
1644
+ };
1645
+ var handleArguments = (file, args, options = {}) => {
1646
+ const parsed = import_cross_spawn.default._parse(file, args, options);
1647
+ file = parsed.command;
1648
+ args = parsed.args;
1649
+ options = parsed.options;
1650
+ options = {
1651
+ maxBuffer: DEFAULT_MAX_BUFFER,
1652
+ buffer: true,
1653
+ stripFinalNewline: true,
1654
+ extendEnv: true,
1655
+ preferLocal: false,
1656
+ localDir: options.cwd || import_node_process.default.cwd(),
1657
+ execPath: import_node_process.default.execPath,
1658
+ encoding: "utf8",
1659
+ reject: true,
1660
+ cleanup: true,
1661
+ all: false,
1662
+ windowsHide: true,
1663
+ verbose: verboseDefault,
1664
+ ...options
1665
+ };
1666
+ options.env = getEnv(options);
1667
+ options.stdio = normalizeStdio(options);
1668
+ if (import_node_process.default.platform === "win32" && import_node_path2.default.basename(file, ".exe") === "cmd") {
1669
+ args.unshift("/q");
1670
+ }
1671
+ return { file, args, options, parsed };
1672
+ };
1673
+ var handleOutput = (options, value, error) => {
1674
+ if (typeof value !== "string" && !import_node_buffer.Buffer.isBuffer(value)) {
1675
+ return error === void 0 ? void 0 : "";
1676
+ }
1677
+ if (options.stripFinalNewline) {
1678
+ return stripFinalNewline(value);
1679
+ }
1680
+ return value;
1681
+ };
1682
+ function execa(file, args, options) {
1683
+ const parsed = handleArguments(file, args, options);
1684
+ const command = joinCommand(file, args);
1685
+ const escapedCommand = getEscapedCommand(file, args);
1686
+ logCommand(escapedCommand, parsed.options);
1687
+ validateTimeout(parsed.options);
1688
+ let spawned;
1689
+ try {
1690
+ spawned = import_node_child_process.default.spawn(parsed.file, parsed.args, parsed.options);
1691
+ } catch (error) {
1692
+ const dummySpawned = new import_node_child_process.default.ChildProcess();
1693
+ const errorPromise = Promise.reject(makeError({
1694
+ error,
1695
+ stdout: "",
1696
+ stderr: "",
1697
+ all: "",
1698
+ command,
1699
+ escapedCommand,
1700
+ parsed,
1701
+ timedOut: false,
1702
+ isCanceled: false,
1703
+ killed: false
1704
+ }));
1705
+ mergePromise(dummySpawned, errorPromise);
1706
+ return dummySpawned;
1707
+ }
1708
+ const spawnedPromise = getSpawnedPromise(spawned);
1709
+ const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
1710
+ const processDone = setExitHandler(spawned, parsed.options, timedPromise);
1711
+ const context = { isCanceled: false };
1712
+ spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));
1713
+ spawned.cancel = spawnedCancel.bind(null, spawned, context);
1714
+ const handlePromise = async () => {
1715
+ const [{ error, exitCode, signal, timedOut }, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);
1716
+ const stdout = handleOutput(parsed.options, stdoutResult);
1717
+ const stderr = handleOutput(parsed.options, stderrResult);
1718
+ const all = handleOutput(parsed.options, allResult);
1719
+ if (error || exitCode !== 0 || signal !== null) {
1720
+ const returnedError = makeError({
1721
+ error,
1722
+ exitCode,
1723
+ signal,
1724
+ stdout,
1725
+ stderr,
1726
+ all,
1727
+ command,
1728
+ escapedCommand,
1729
+ parsed,
1730
+ timedOut,
1731
+ isCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),
1732
+ killed: spawned.killed
1733
+ });
1734
+ if (!parsed.options.reject) {
1735
+ return returnedError;
1736
+ }
1737
+ throw returnedError;
1738
+ }
1739
+ return {
1740
+ command,
1741
+ escapedCommand,
1742
+ exitCode: 0,
1743
+ stdout,
1744
+ stderr,
1745
+ all,
1746
+ failed: false,
1747
+ timedOut: false,
1748
+ isCanceled: false,
1749
+ killed: false
1750
+ };
1751
+ };
1752
+ const handlePromiseOnce = onetime_default(handlePromise);
1753
+ handleInput(spawned, parsed.options);
1754
+ spawned.all = makeAllStream(spawned, parsed.options);
1755
+ addPipeMethods(spawned);
1756
+ mergePromise(spawned, handlePromiseOnce);
1757
+ return spawned;
1758
+ }
1759
+ function execaSync(file, args, options) {
1760
+ const parsed = handleArguments(file, args, options);
1761
+ const command = joinCommand(file, args);
1762
+ const escapedCommand = getEscapedCommand(file, args);
1763
+ logCommand(escapedCommand, parsed.options);
1764
+ const input = handleInputSync(parsed.options);
1765
+ let result;
1766
+ try {
1767
+ result = import_node_child_process.default.spawnSync(parsed.file, parsed.args, { ...parsed.options, input });
1768
+ } catch (error) {
1769
+ throw makeError({
1770
+ error,
1771
+ stdout: "",
1772
+ stderr: "",
1773
+ all: "",
1774
+ command,
1775
+ escapedCommand,
1776
+ parsed,
1777
+ timedOut: false,
1778
+ isCanceled: false,
1779
+ killed: false
1780
+ });
1781
+ }
1782
+ const stdout = handleOutput(parsed.options, result.stdout, result.error);
1783
+ const stderr = handleOutput(parsed.options, result.stderr, result.error);
1784
+ if (result.error || result.status !== 0 || result.signal !== null) {
1785
+ const error = makeError({
1786
+ stdout,
1787
+ stderr,
1788
+ error: result.error,
1789
+ signal: result.signal,
1790
+ exitCode: result.status,
1791
+ command,
1792
+ escapedCommand,
1793
+ parsed,
1794
+ timedOut: result.error && result.error.code === "ETIMEDOUT",
1795
+ isCanceled: false,
1796
+ killed: result.signal !== null
1797
+ });
1798
+ if (!parsed.options.reject) {
1799
+ return error;
1800
+ }
1801
+ throw error;
1802
+ }
1803
+ return {
1804
+ command,
1805
+ escapedCommand,
1806
+ exitCode: 0,
1807
+ stdout,
1808
+ stderr,
1809
+ failed: false,
1810
+ timedOut: false,
1811
+ isCanceled: false,
1812
+ killed: false
1813
+ };
1814
+ }
1815
+ var normalizeScriptStdin = ({ input, inputFile, stdio }) => input === void 0 && inputFile === void 0 && stdio === void 0 ? { stdin: "inherit" } : {};
1816
+ var normalizeScriptOptions = (options = {}) => ({
1817
+ preferLocal: true,
1818
+ ...normalizeScriptStdin(options),
1819
+ ...options
1820
+ });
1821
+ function create$(options) {
1822
+ function $2(templatesOrOptions, ...expressions) {
1823
+ if (!Array.isArray(templatesOrOptions)) {
1824
+ return create$({ ...options, ...templatesOrOptions });
1825
+ }
1826
+ const [file, ...args] = parseTemplates(templatesOrOptions, expressions);
1827
+ return execa(file, args, normalizeScriptOptions(options));
1828
+ }
1829
+ $2.sync = (templates, ...expressions) => {
1830
+ if (!Array.isArray(templates)) {
1831
+ throw new TypeError("Please use $(options).sync`command` instead of $.sync(options)`command`.");
1832
+ }
1833
+ const [file, ...args] = parseTemplates(templates, expressions);
1834
+ return execaSync(file, args, normalizeScriptOptions(options));
1835
+ };
1836
+ return $2;
1837
+ }
1838
+ var $ = create$();
1839
+ function execaCommand(command, options) {
1840
+ const [file, ...args] = parseCommand(command);
1841
+ return execa(file, args, options);
1842
+ }
1843
+ var debug = (0, import_debug.default)("prisma:migrate:seed");
1844
+ async function getSeedCommandFromPackageJson(cwd) {
1845
+ const prismaConfig = await (0, import_config.loadConfigFromPackageJson)(cwd);
1846
+ debug({ prismaConfig });
1847
+ if (!prismaConfig?.config?.seed) {
1848
+ return null;
1849
+ }
1850
+ const seedCommandFromPkgJson = prismaConfig.config.seed;
1851
+ if (typeof seedCommandFromPkgJson !== "string") {
1852
+ throw new Error(
1853
+ `Provided seed command \`${seedCommandFromPkgJson}\` from \`${import_node_path.default.relative(
1854
+ cwd,
1855
+ prismaConfig.loadedFromFile
1856
+ )}\` must be of type string`
1857
+ );
1858
+ }
1859
+ if (!seedCommandFromPkgJson) {
1860
+ throw new Error(
1861
+ `Provided seed command \`${seedCommandFromPkgJson}\` from \`${import_node_path.default.relative(
1862
+ cwd,
1863
+ prismaConfig.loadedFromFile
1864
+ )}\` cannot be empty`
1865
+ );
1866
+ }
1867
+ return prismaConfig.config.seed;
1868
+ }
1869
+ async function executeSeedCommand({
1870
+ commandFromConfig,
1871
+ extraArgs
1872
+ }) {
1873
+ const command = extraArgs ? `${commandFromConfig} ${extraArgs}` : commandFromConfig;
1874
+ process.stdout.write(`Running seed command \`${(0, import_chunk_SKRR5WT4.italic)(command)}\` ...
1875
+ `);
1876
+ try {
1877
+ await execaCommand(command, {
1878
+ stdout: "inherit",
1879
+ stderr: "inherit"
1880
+ });
1881
+ } catch (_e) {
1882
+ const e = _e;
1883
+ debug({ e });
1884
+ console.error((0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`
1885
+ An error occurred while running the seed command:`)));
1886
+ console.error((0, import_chunk_SKRR5WT4.red)(e.stderr || String(e)));
1887
+ return false;
1888
+ }
1889
+ return true;
1890
+ }