aboutsummaryrefslogtreecommitdiff
path: root/src/js
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-08-30 00:16:08 -0700
committerGravatar GitHub <noreply@github.com> 2023-08-30 00:16:08 -0700
commite3dc5b6b4ce2c10d1e9c61fec2e86409e4ce48b0 (patch)
treeacf51076ff9001863beb91555a595917f0dbdf18 /src/js
parentf2553d24543d72a777ba60213473332809866cb2 (diff)
downloadbun-e3dc5b6b4ce2c10d1e9c61fec2e86409e4ce48b0.tar.gz
bun-e3dc5b6b4ce2c10d1e9c61fec2e86409e4ce48b0.tar.zst
bun-e3dc5b6b4ce2c10d1e9c61fec2e86409e4ce48b0.zip
reset signal handlers in Bun.spawn (#4405)
* see if this fixes it * We don't need this * Remove extra flag --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/js')
-rw-r--r--src/js/node/child_process.js11
-rw-r--r--src/js/out/InternalModuleRegistryConstants.h6
2 files changed, 11 insertions, 6 deletions
diff --git a/src/js/node/child_process.js b/src/js/node/child_process.js
index ef96dbce5..6878f3ca1 100644
--- a/src/js/node/child_process.js
+++ b/src/js/node/child_process.js
@@ -888,9 +888,13 @@ function normalizeSpawnArguments(file, args, options) {
cwd = getValidatedPath(cwd, "options.cwd");
}
- // TODO: Detached check
// TODO: Gid check
// TODO: Uid check
+ var detached = false;
+ const { detached: detachedOption } = options;
+ if (detachedOption != null) {
+ detached = !!detachedOption;
+ }
// Validate the shell, if present.
if (options.shell != null && typeof options.shell !== "boolean" && typeof options.shell !== "string") {
@@ -945,7 +949,7 @@ function normalizeSpawnArguments(file, args, options) {
// TODO: Windows env support here...
- return { ...options, file, args, cwd, envPairs };
+ return { ...options, detached, file, args, cwd, envPairs };
}
function checkExecSyncError(ret, args, cmd) {
@@ -1155,7 +1159,7 @@ class ChildProcess extends EventEmitter {
const bunStdio = getBunStdioFromOptions(stdio);
var env = options.envPairs || undefined;
-
+ const detachedOption = options.detached;
this.#encoding = options.encoding || undefined;
this.#stdioOptions = bunStdio;
this.#handle = Bun.spawn({
@@ -1165,6 +1169,7 @@ class ChildProcess extends EventEmitter {
stderr: bunStdio[2],
cwd: options.cwd || undefined,
env: env || process.env,
+ detached: typeof detachedOption !== "undefined" ? !!detachedOption : false,
onExit: (handle, exitCode, signalCode, err) => {
this.#handle = handle;
this.pid = this.#handle.pid;
diff --git a/src/js/out/InternalModuleRegistryConstants.h b/src/js/out/InternalModuleRegistryConstants.h
index 66a8f169d..833bf698b 100644
--- a/src/js/out/InternalModuleRegistryConstants.h
+++ b/src/js/out/InternalModuleRegistryConstants.h
@@ -34,7 +34,7 @@ static constexpr ASCIILiteral NodeAsyncHooksCode = "(function (){\"use strict\";
//
//
-static constexpr ASCIILiteral NodeChildProcessCode = "(function (){\"use strict\";// src/js/out/tmp/node/child_process.ts\nvar spawn = function(file, args, options) {\n options = normalizeSpawnArguments(file, args, options), validateTimeout(options.timeout), validateAbortSignal(options.signal, \"options.signal\");\n const killSignal2 = sanitizeKillSignal(options.killSignal), child = new ChildProcess;\n if (child.spawn(options), options.timeout > 0) {\n let timeoutId = setTimeout(() => {\n if (timeoutId) {\n try {\n child.kill(killSignal2);\n } catch (err) {\n child.emit(\"error\", err);\n }\n timeoutId = null;\n }\n });\n child.once(\"exit\", () => {\n if (timeoutId)\n clearTimeout(timeoutId), timeoutId = null;\n });\n }\n if (options.signal) {\n let onAbortListener2 = function() {\n abortChildProcess(child, killSignal2, options.signal.reason);\n };\n var onAbortListener = onAbortListener2;\n const signal = options.signal;\n if (signal.aborted)\n process.nextTick(onAbortListener2);\n else\n signal.addEventListener(\"abort\", onAbortListener2, { once: !0 }), child.once(\"exit\", () => signal.removeEventListener(\"abort\", onAbortListener2));\n }\n return child;\n}, execFile = function(file, args, options, callback) {\n ({ file, args, options, callback } = normalizeExecFileArgs(file, args, options, callback)), options = {\n encoding: \"utf8\",\n timeout: 0,\n maxBuffer: MAX_BUFFER,\n killSignal: \"SIGTERM\",\n cwd: null,\n env: null,\n shell: !1,\n ...options\n };\n const maxBuffer = options.maxBuffer;\n validateTimeout(options.timeout), validateMaxBuffer(maxBuffer), options.killSignal = sanitizeKillSignal(options.killSignal);\n const child = spawn(file, args, {\n cwd: options.cwd,\n env: options.env,\n shell: options.shell,\n signal: options.signal\n });\n let encoding;\n const _stdout = [], _stderr = [];\n if (options.encoding !== \"buffer\" && BufferIsEncoding(options.encoding))\n encoding = options.encoding;\n else\n encoding = null;\n let stdoutLen = 0, stderrLen = 0, killed = !1, exited = !1, timeoutId, encodedStdoutLen, encodedStderrLen, ex = null, cmd = file;\n function exitHandler(code, signal) {\n if (exited)\n return;\n if (exited = !0, timeoutId)\n clearTimeout(timeoutId), timeoutId = null;\n if (!callback)\n return;\n const readableEncoding = child\?.stdout\?.readableEncoding;\n let stdout, stderr;\n if (encoding || child.stdout && readableEncoding)\n stdout = ArrayPrototypeJoin.call(_stdout, \"\");\n else\n stdout = BufferConcat(_stdout);\n if (encoding || child.stderr && readableEncoding)\n stderr = ArrayPrototypeJoin.call(_stderr, \"\");\n else\n stderr = BufferConcat(_stderr);\n if (!ex && code === 0 && signal === null) {\n callback(null, stdout, stderr);\n return;\n }\n if (args\?.length)\n cmd += ` ${ArrayPrototypeJoin.call(args, \" \")}`;\n if (!ex) {\n let message = `Command failed: ${cmd}`;\n if (stderr)\n message += `\\n${stderr}`;\n ex = genericNodeError(message, {\n code,\n killed: child.killed || killed,\n signal\n });\n }\n ex.cmd = cmd, callback(ex, stdout, stderr);\n }\n function errorHandler(e) {\n if (ex = e, child.stdout)\n child.stdout.destroy();\n if (child.stderr)\n child.stderr.destroy();\n exitHandler();\n }\n function kill() {\n if (child.stdout)\n child.stdout.destroy();\n if (child.stderr)\n child.stderr.destroy();\n killed = !0;\n try {\n child.kill(options.killSignal);\n } catch (e) {\n ex = e, exitHandler();\n }\n }\n if (options.timeout > 0)\n timeoutId = setTimeout(function delayedKill() {\n kill(), timeoutId = null;\n }, options.timeout);\n if (child.stdout) {\n if (encoding)\n child.stdout.setEncoding(encoding);\n child.stdout.on(\"data\", maxBuffer === Infinity \? function onUnlimitedSizeBufferedData(chunk) {\n ArrayPrototypePush.call(_stdout, chunk);\n } : encoding \? function onChildStdoutEncoded(chunk) {\n if (stdoutLen += chunk.length, stdoutLen * 4 > maxBuffer) {\n const encoding2 = child.stdout.readableEncoding, actualLen = Buffer.byteLength(chunk, encoding2);\n if (encodedStdoutLen === void 0)\n for (let i = 0;i < _stdout.length; i++)\n encodedStdoutLen += Buffer.byteLength(_stdout[i], encoding2);\n else\n encodedStdoutLen += actualLen;\n const truncatedLen = maxBuffer - (encodedStdoutLen - actualLen);\n ArrayPrototypePush.call(_stdout, StringPrototypeSlice.apply(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stdout\"), kill();\n } else\n ArrayPrototypePush.call(_stdout, chunk);\n } : function onChildStdoutRaw(chunk) {\n if (stdoutLen += chunk.length, stdoutLen > maxBuffer) {\n const truncatedLen = maxBuffer - (stdoutLen - chunk.length);\n ArrayPrototypePush.call(_stdout, chunk.slice(0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stdout\"), kill();\n } else\n ArrayPrototypePush.call(_stdout, chunk);\n });\n }\n if (child.stderr) {\n if (encoding)\n child.stderr.setEncoding(encoding);\n child.stderr.on(\"data\", maxBuffer === Infinity \? function onUnlimitedSizeBufferedData(chunk) {\n ArrayPrototypePush.call(_stderr, chunk);\n } : encoding \? function onChildStderrEncoded(chunk) {\n if (stderrLen += chunk.length, stderrLen * 4 > maxBuffer) {\n const encoding2 = child.stderr.readableEncoding, actualLen = Buffer.byteLength(chunk, encoding2);\n if (encodedStderrLen === void 0)\n for (let i = 0;i < _stderr.length; i++)\n encodedStderrLen += Buffer.byteLength(_stderr[i], encoding2);\n else\n encodedStderrLen += actualLen;\n const truncatedLen = maxBuffer - (encodedStderrLen - actualLen);\n ArrayPrototypePush.call(_stderr, StringPrototypeSlice.call(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stderr\"), kill();\n } else\n ArrayPrototypePush.call(_stderr, chunk);\n } : function onChildStderrRaw(chunk) {\n if (stderrLen += chunk.length, stderrLen > maxBuffer) {\n const truncatedLen = maxBuffer - (stderrLen - chunk.length);\n ArrayPrototypePush.call(_stderr, StringPrototypeSlice.call(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stderr\"), kill();\n } else\n ArrayPrototypePush.call(_stderr, chunk);\n });\n }\n return child.addListener(\"close\", exitHandler), child.addListener(\"error\", errorHandler), child;\n}, exec = function(command, options, callback) {\n const opts = normalizeExecArgs(command, options, callback);\n return execFile(opts.file, opts.options, opts.callback);\n}, spawnSync = function(file, args, options) {\n options = {\n maxBuffer: MAX_BUFFER,\n ...normalizeSpawnArguments(file, args, options)\n };\n const { maxBuffer, encoding } = options;\n validateTimeout(options.timeout), validateMaxBuffer(maxBuffer), options.killSignal = sanitizeKillSignal(options.killSignal);\n const stdio = options.stdio || \"pipe\", bunStdio = getBunStdioFromOptions(stdio);\n var { input } = options;\n if (input)\n if (ArrayBufferIsView(input))\n bunStdio[0] = input;\n else if (typeof input === \"string\")\n bunStdio[0] = Buffer.from(input, encoding || \"utf8\");\n else\n throw new ERR_INVALID_ARG_TYPE(\"options.stdio[0]\", [\"Buffer\", \"TypedArray\", \"DataView\", \"string\"], input);\n const { stdout, stderr, success, exitCode } = Bun.spawnSync({\n cmd: options.args,\n env: options.env || void 0,\n cwd: options.cwd || void 0,\n stdin: bunStdio[0],\n stdout: bunStdio[1],\n stderr: bunStdio[2]\n }), result = {\n signal: null,\n status: exitCode,\n output: [null, stdout, stderr]\n };\n if (stdout && encoding && encoding !== \"buffer\")\n result.output[1] = result.output[1]\?.toString(encoding);\n if (stderr && encoding && encoding !== \"buffer\")\n result.output[2] = result.output[2]\?.toString(encoding);\n if (result.stdout = result.output[1], result.stderr = result.output[2], !success)\n result.error = new SystemError(result.output[2], options.file, \"spawnSync\", -1, result.status), result.error.spawnargs = ArrayPrototypeSlice.call(options.args, 1);\n return result;\n}, execFileSync = function(file, args, options) {\n ({ file, args, options } = normalizeExecFileArgs(file, args, options));\n const ret = spawnSync(file, args, options), errArgs = [options.argv0 || file];\n ArrayPrototypePush.apply(errArgs, args);\n const err = checkExecSyncError(ret, errArgs);\n if (err)\n throw err;\n return ret.stdout;\n}, execSync = function(command, options) {\n const opts = normalizeExecArgs(command, options, null), ret = spawnSync(opts.file, opts.options), err = checkExecSyncError(ret, void 0, command);\n if (err)\n throw err;\n return ret.stdout;\n}, stdioStringToArray = function(stdio, channel) {\n const options = [];\n switch (stdio) {\n case \"ignore\":\n case \"overlapped\":\n case \"pipe\":\n ArrayPrototypePush.call(options, stdio, stdio, stdio);\n break;\n case \"inherit\":\n ArrayPrototypePush.call(options, 0, 1, 2);\n break;\n default:\n throw new ERR_INVALID_ARG_VALUE(\"stdio\", stdio);\n }\n if (channel)\n ArrayPrototypePush.call(options, channel);\n return options;\n}, fork = function(modulePath, args = [], options) {\n modulePath = getValidatedPath(modulePath, \"modulePath\");\n let execArgv;\n if (args == null)\n args = [];\n else if (typeof args === \"object\" && !ArrayIsArray(args))\n options = args, args = [];\n else\n validateArray(args, \"args\");\n if (options != null)\n validateObject(options, \"options\");\n if (options = { __proto__: null, ...options, shell: !1 }, options.execPath = options.execPath || process.execPath, validateArgumentNullCheck(options.execPath, \"options.execPath\"), execArgv = options.execArgv || process.execArgv, validateArgumentsNullCheck(execArgv, \"options.execArgv\"), execArgv === process.execArgv && process._eval != null) {\n const index = ArrayPrototypeLastIndexOf.call(execArgv, process._eval);\n if (index > 0)\n execArgv = ArrayPrototypeSlice.call(execArgv), ArrayPrototypeSplice.call(execArgv, index - 1, 2);\n }\n if (args = [...execArgv, modulePath, ...args], typeof options.stdio === \"string\")\n options.stdio = stdioStringToArray(options.stdio, \"ipc\");\n else if (!ArrayIsArray(options.stdio))\n options.stdio = stdioStringToArray(options.silent \? \"pipe\" : \"inherit\", \"ipc\");\n else if (!ArrayPrototypeIncludes.call(options.stdio, \"ipc\"))\n throw new ERR_CHILD_PROCESS_IPC_REQUIRED(\"options.stdio\");\n return spawn(options.execPath, args, options);\n}, convertToValidSignal = function(signal) {\n if (typeof signal === \"number\" && getSignalsToNamesMapping()[signal])\n return signal;\n if (typeof signal === \"string\") {\n const signalName = signals[StringPrototypeToUpperCase.call(signal)];\n if (signalName)\n return signalName;\n }\n throw new ERR_UNKNOWN_SIGNAL(signal);\n}, sanitizeKillSignal = function(killSignal2) {\n if (typeof killSignal2 === \"string\" || typeof killSignal2 === \"number\")\n return convertToValidSignal(killSignal2);\n else if (killSignal2 != null)\n throw new ERR_INVALID_ARG_TYPE(\"options.killSignal\", [\"string\", \"number\"], killSignal2);\n}, getSignalsToNamesMapping = function() {\n if (signalsToNamesMapping !== void 0)\n return signalsToNamesMapping;\n signalsToNamesMapping = ObjectCreate(null);\n for (let key in signals)\n signalsToNamesMapping[signals[key]] = key;\n return signalsToNamesMapping;\n}, normalizeExecFileArgs = function(file, args, options, callback) {\n if (ArrayIsArray(args))\n args = ArrayPrototypeSlice.call(args);\n else if (args != null && typeof args === \"object\")\n callback = options, options = args, args = null;\n else if (typeof args === \"function\")\n callback = args, options = null, args = null;\n if (args == null)\n args = [];\n if (typeof options === \"function\")\n callback = options;\n else if (options != null)\n validateObject(options, \"options\");\n if (options == null)\n options = kEmptyObject;\n if (callback != null)\n validateFunction(callback, \"callback\");\n if (options.argv0 != null)\n validateString(options.argv0, \"options.argv0\"), validateArgumentNullCheck(options.argv0, \"options.argv0\");\n return { file, args, options, callback };\n}, normalizeExecArgs = function(command, options, callback) {\n if (validateString(command, \"command\"), validateArgumentNullCheck(command, \"command\"), typeof options === \"function\")\n callback = options, options = void 0;\n return options = { ...options }, options.shell = typeof options.shell === \"string\" \? options.shell : !0, {\n file: command,\n options,\n callback\n };\n}, normalizeSpawnArguments = function(file, args, options) {\n if (validateString(file, \"file\"), validateArgumentNullCheck(file, \"file\"), file.length === 0)\n throw new ERR_INVALID_ARG_VALUE(\"file\", file, \"cannot be empty\");\n if (ArrayIsArray(args))\n args = ArrayPrototypeSlice.call(args);\n else if (args == null)\n args = [];\n else if (typeof args !== \"object\")\n throw new ERR_INVALID_ARG_TYPE(\"args\", \"object\", args);\n else\n options = args, args = [];\n if (validateArgumentsNullCheck(args, \"args\"), options === void 0)\n options = {};\n else\n validateObject(options, \"options\");\n let cwd = options.cwd;\n if (cwd != null)\n cwd = getValidatedPath(cwd, \"options.cwd\");\n if (options.shell != null && typeof options.shell !== \"boolean\" && typeof options.shell !== \"string\")\n throw new ERR_INVALID_ARG_TYPE(\"options.shell\", [\"boolean\", \"string\"], options.shell);\n if (options.argv0 != null)\n validateString(options.argv0, \"options.argv0\"), validateArgumentNullCheck(options.argv0, \"options.argv0\");\n if (options.shell) {\n validateArgumentNullCheck(options.shell, \"options.shell\");\n const command = ArrayPrototypeJoin.call([file, ...args], \" \");\n if (typeof options.shell === \"string\")\n file = options.shell;\n else\n file = \"sh\";\n args = [\"-c\", command];\n }\n if (typeof options.argv0 === \"string\")\n ArrayPrototypeUnshift.call(args, options.argv0);\n else\n ArrayPrototypeUnshift.call(args, file);\n const envPairs = options.env || process.env;\n return { ...options, file, args, cwd, envPairs };\n}, checkExecSyncError = function(ret, args, cmd) {\n let err;\n if (ret.error)\n err = ret.error, ObjectAssign(err, ret);\n else if (ret.status !== 0) {\n let msg = \"Command failed: \";\n if (msg += cmd || ArrayPrototypeJoin.call(args, \" \"), ret.stderr && ret.stderr.length > 0)\n msg += `\\n${ret.stderr.toString()}`;\n err = genericNodeError(msg, ret);\n }\n return err;\n}, nodeToBun = function(item) {\n if (typeof item === \"number\")\n return item;\n else {\n const result = nodeToBunLookup[item];\n if (result === void 0)\n throw new Error(\"Invalid stdio option\");\n return result;\n }\n}, fdToStdioName = function(fd) {\n switch (fd) {\n case 0:\n return \"stdin\";\n case 1:\n return \"stdout\";\n case 2:\n return \"stderr\";\n default:\n return null;\n }\n}, getBunStdioFromOptions = function(stdio) {\n return normalizeStdio(stdio).map((item) => nodeToBun(item));\n}, normalizeStdio = function(stdio) {\n if (typeof stdio === \"string\")\n switch (stdio) {\n case \"ignore\":\n return [\"ignore\", \"ignore\", \"ignore\"];\n case \"pipe\":\n return [\"pipe\", \"pipe\", \"pipe\"];\n case \"inherit\":\n return [\"inherit\", \"inherit\", \"inherit\"];\n default:\n throw new ERR_INVALID_OPT_VALUE(\"stdio\", stdio);\n }\n else if (ArrayIsArray(stdio)) {\n let processedStdio;\n if (stdio.length === 0)\n processedStdio = [\"pipe\", \"pipe\", \"pipe\"];\n else if (stdio.length === 1)\n processedStdio = [stdio[0], \"pipe\", \"pipe\"];\n else if (stdio.length === 2)\n processedStdio = [stdio[0], stdio[1], \"pipe\"];\n else if (stdio.length >= 3)\n processedStdio = [stdio[0], stdio[1], stdio[2]];\n return processedStdio.map((item) => !item \? \"pipe\" : item);\n } else\n throw new ERR_INVALID_OPT_VALUE(\"stdio\", stdio);\n}, flushStdio = function(subprocess) {\n const stdio = subprocess.stdio;\n if (stdio == null)\n return;\n for (let i = 0;i < stdio.length; i++) {\n const stream = stdio[i];\n if (!stream || !stream.readable)\n continue;\n stream.resume();\n }\n}, onSpawnNT = function(self) {\n self.emit(\"spawn\");\n}, abortChildProcess = function(child, killSignal2, reason) {\n if (!child)\n return;\n try {\n if (child.kill(killSignal2))\n child.emit(\"error\", new AbortError(void 0, { cause: reason }));\n } catch (err) {\n child.emit(\"error\", err);\n }\n}, validateMaxBuffer = function(maxBuffer) {\n if (maxBuffer != null && !(typeof maxBuffer === \"number\" && maxBuffer >= 0))\n throw new ERR_OUT_OF_RANGE(\"options.maxBuffer\", \"a positive number\", maxBuffer);\n}, validateArgumentNullCheck = function(arg, propName) {\n if (typeof arg === \"string\" && StringPrototypeIncludes.call(arg, \"\\0\"))\n throw new ERR_INVALID_ARG_VALUE(propName, arg, \"must be a string without null bytes\");\n}, validateArgumentsNullCheck = function(args, propName) {\n for (let i = 0;i < args.length; ++i)\n validateArgumentNullCheck(args[i], `${propName}[${i}]`);\n}, validateTimeout = function(timeout) {\n if (timeout != null && !(NumberIsInteger(timeout) && timeout >= 0))\n throw new ERR_OUT_OF_RANGE(\"timeout\", \"an unsigned integer\", timeout);\n};\nvar validateFunction = function(value, name) {\n if (typeof value !== \"function\")\n throw new ERR_INVALID_ARG_TYPE(name, \"Function\", value);\n}, validateString = function(value, name) {\n if (typeof value !== \"string\")\n throw new ERR_INVALID_ARG_TYPE(name, \"string\", value);\n}, nullCheck = function(path, propName, throwError = !0) {\n const pathIsString = typeof path === \"string\", pathIsUint8Array = isUint8Array(path);\n if (!pathIsString && !pathIsUint8Array || pathIsString && !StringPrototypeIncludes.call(path, \"\\0\") || pathIsUint8Array && !Uint8ArrayPrototypeIncludes.call(path, 0))\n return;\n const err = new ERR_INVALID_ARG_VALUE(propName, path, \"must be a string or Uint8Array without null bytes\");\n if (throwError)\n throw err;\n return err;\n}, validatePath = function(path, propName = \"path\") {\n if (typeof path !== \"string\" && !isUint8Array(path))\n throw new ERR_INVALID_ARG_TYPE(propName, [\"string\", \"Buffer\", \"URL\"], path);\n const err = nullCheck(path, propName, !1);\n if (err !== void 0)\n throw err;\n}, getValidatedPath = function(fileURLOrPath, propName = \"path\") {\n const path = toPathIfFileURL(fileURLOrPath);\n return validatePath(path, propName), path;\n}, isUint8Array = function(value) {\n return typeof value === \"object\" && value !== null && value instanceof Uint8Array;\n}, isURLInstance = function(fileURLOrPath) {\n return fileURLOrPath != null && fileURLOrPath.href && fileURLOrPath.origin;\n}, toPathIfFileURL = function(fileURLOrPath) {\n if (!isURLInstance(fileURLOrPath))\n return fileURLOrPath;\n return Bun.fileURLToPath(fileURLOrPath);\n}, genericNodeError = function(message, options) {\n const err = new Error(message);\n return err.code = options.code, err.killed = options.killed, err.signal = options.signal, err;\n}, ERR_OUT_OF_RANGE = function(str, range, input, replaceDefaultBoolean = !1) {\n return new RangeError(`The value of ${str} is out of range. It must be ${range}. Received ${input}`);\n}, ERR_CHILD_PROCESS_STDIO_MAXBUFFER = function(stdio) {\n return Error(`${stdio} maxBuffer length exceeded`);\n}, ERR_UNKNOWN_SIGNAL = function(name) {\n const err = @makeTypeError(`Unknown signal: ${name}`);\n return err.code = \"ERR_UNKNOWN_SIGNAL\", err;\n}, ERR_INVALID_ARG_TYPE = function(name, type, value) {\n const err = @makeTypeError(`The \"${name}\" argument must be of type ${type}. Received ${value\?.toString()}`);\n return err.code = \"ERR_INVALID_ARG_TYPE\", err;\n}, ERR_INVALID_OPT_VALUE = function(name, value) {\n return @makeTypeError(`The value \"${value}\" is invalid for option \"${name}\"`);\n}, ERR_INVALID_ARG_VALUE = function(name, value, reason) {\n return new Error(`The value \"${value}\" is invalid for argument '${name}'. Reason: ${reason}`);\n}, ERR_CHILD_PROCESS_IPC_REQUIRED = function(name) {\n const err = @makeTypeError(`Forked processes must have an IPC channel, missing value 'ipc' in ${name}`);\n return err.code = \"ERR_CHILD_PROCESS_IPC_REQUIRED\", err;\n}, $, EventEmitter = @getInternalField(@internalModuleRegistry, 16) || @createInternalModuleById(16), StreamModule = @getInternalField(@internalModuleRegistry, 35) || @createInternalModuleById(35), {\n constants: { signals }\n} = @getInternalField(@internalModuleRegistry, 24) || @createInternalModuleById(24), { promisify } = @getInternalField(@internalModuleRegistry, 44) || @createInternalModuleById(44), ObjectCreate = Object.create, ObjectAssign = Object.assign, ObjectDefineProperty = Object.defineProperty, BufferConcat = Buffer.concat, BufferIsEncoding = Buffer.isEncoding, kEmptyObject = ObjectCreate(null), ArrayPrototypePush = Array.prototype.push, ArrayPrototypeJoin = Array.prototype.join, ArrayPrototypeMap = Array.prototype.map, ArrayPrototypeIncludes = Array.prototype.includes, ArrayPrototypeSlice = Array.prototype.slice, ArrayPrototypeUnshift = Array.prototype.unshift, ArrayPrototypeLastIndexOf = Array.prototype.lastIndexOf, ArrayPrototypeSplice = Array.prototype.splice, ArrayIsArray = Array.isArray, ArrayBufferIsView = ArrayBuffer.isView, NumberIsInteger = Number.isInteger;\nvar StringPrototypeToUpperCase = String.prototype.toUpperCase, StringPrototypeIncludes = String.prototype.includes, StringPrototypeSlice = String.prototype.slice, Uint8ArrayPrototypeIncludes = Uint8Array.prototype.includes, MAX_BUFFER = 1048576, NativeWritable, ReadableFromWeb, customPromiseExecFunction = (orig) => {\n return (...args) => {\n let resolve, reject;\n const promise = new Promise((res, rej) => {\n resolve = res, reject = rej;\n });\n return promise.child = orig(...args, (err, stdout, stderr) => {\n if (err !== null)\n err.stdout = stdout, err.stderr = stderr, reject(err);\n else\n resolve({ stdout, stderr });\n }), promise;\n };\n};\nObjectDefineProperty(exec, promisify.custom, {\n __proto__: null,\n enumerable: !1,\n value: customPromiseExecFunction(exec)\n});\nvar signalsToNamesMapping;\n\nclass ChildProcess extends EventEmitter {\n constructor() {\n super(...arguments);\n }\n #handle;\n #exited = !1;\n #closesNeeded = 1;\n #closesGot = 0;\n connected = !1;\n signalCode = null;\n exitCode = null;\n spawnfile;\n spawnargs;\n pid;\n channel;\n get killed() {\n if (this.#handle == null)\n return !1;\n }\n #handleOnExit(exitCode, signalCode, err) {\n if (this.#exited)\n return;\n if (signalCode)\n this.signalCode = signalCode;\n else\n this.exitCode = exitCode;\n if (this.#stdin)\n this.#stdin.destroy();\n if (this.#handle)\n this.#handle = null;\n if (exitCode < 0) {\n const err2 = new SystemError(`Spawned process exited with error code: ${exitCode}`, void 0, \"spawn\", \"EUNKNOWN\", \"ERR_CHILD_PROCESS_UNKNOWN_ERROR\");\n if (this.spawnfile)\n err2.path = this.spawnfile;\n err2.spawnargs = ArrayPrototypeSlice.call(this.spawnargs, 1), this.emit(\"error\", err2);\n } else\n this.emit(\"exit\", this.exitCode, this.signalCode);\n process.nextTick(flushStdio, this), this.#maybeClose(), this.#exited = !0, this.#stdioOptions = [\"destroyed\", \"destroyed\", \"destroyed\"];\n }\n #getBunSpawnIo(i, encoding) {\n NativeWritable ||= StreamModule.NativeWritable, ReadableFromWeb ||= StreamModule.Readable.fromWeb;\n const io = this.#stdioOptions[i];\n switch (i) {\n case 0:\n switch (io) {\n case \"pipe\":\n return new NativeWritable(this.#handle.stdin);\n case \"inherit\":\n return process.stdin || null;\n case \"destroyed\":\n return new ShimmedStdin;\n default:\n return null;\n }\n case 2:\n case 1:\n switch (io) {\n case \"pipe\":\n return ReadableFromWeb(this.#handle[fdToStdioName(i)], { encoding });\n case \"inherit\":\n return process[fdToStdioName(i)] || null;\n case \"destroyed\":\n return new ShimmedStdioOutStream;\n default:\n return null;\n }\n }\n }\n #stdin;\n #stdout;\n #stderr;\n #stdioObject;\n #encoding;\n #stdioOptions;\n #createStdioObject() {\n return Object.create(null, {\n 0: {\n get: () => this.stdin\n },\n 1: {\n get: () => this.stdout\n },\n 2: {\n get: () => this.stderr\n }\n });\n }\n get stdin() {\n return this.#stdin \?\?= this.#getBunSpawnIo(0, this.#encoding);\n }\n get stdout() {\n return this.#stdout \?\?= this.#getBunSpawnIo(1, this.#encoding);\n }\n get stderr() {\n return this.#stderr \?\?= this.#getBunSpawnIo(2, this.#encoding);\n }\n get stdio() {\n return this.#stdioObject \?\?= this.#createStdioObject();\n }\n spawn(options) {\n validateObject(options, \"options\"), validateString(options.file, \"options.file\");\n var file = this.spawnfile = options.file, spawnargs;\n if (options.args == null)\n spawnargs = this.spawnargs = [];\n else\n validateArray(options.args, \"options.args\"), spawnargs = this.spawnargs = options.args;\n const stdio = options.stdio || [\"pipe\", \"pipe\", \"pipe\"], bunStdio = getBunStdioFromOptions(stdio);\n var env = options.envPairs || void 0;\n this.#encoding = options.encoding || void 0, this.#stdioOptions = bunStdio, this.#handle = Bun.spawn({\n cmd: spawnargs,\n stdin: bunStdio[0],\n stdout: bunStdio[1],\n stderr: bunStdio[2],\n cwd: options.cwd || void 0,\n env: env || process.env,\n onExit: (handle, exitCode, signalCode, err) => {\n this.#handle = handle, this.pid = this.#handle.pid, process.nextTick((exitCode2, signalCode2, err2) => this.#handleOnExit(exitCode2, signalCode2, err2), exitCode, signalCode, err);\n },\n lazy: !0\n }), this.pid = this.#handle.pid, onSpawnNT(this);\n }\n send() {\n console.log(\"ChildProcess.prototype.send() - Sorry! Not implemented yet\");\n }\n disconnect() {\n console.log(\"ChildProcess.prototype.disconnect() - Sorry! Not implemented yet\");\n }\n kill(sig) {\n const signal = sig === 0 \? sig : convertToValidSignal(sig === void 0 \? \"SIGTERM\" : sig);\n if (this.#handle)\n this.#handle.kill(signal);\n return this.#maybeClose(), !0;\n }\n #maybeClose() {\n if (this.#closesGot++, this.#closesGot === this.#closesNeeded)\n this.emit(\"close\", this.exitCode, this.signalCode);\n }\n ref() {\n if (this.#handle)\n this.#handle.ref();\n }\n unref() {\n if (this.#handle)\n this.#handle.unref();\n }\n}\nvar nodeToBunLookup = {\n ignore: null,\n pipe: \"pipe\",\n overlapped: \"pipe\",\n inherit: \"inherit\"\n};\n\nclass ShimmedStdin extends EventEmitter {\n constructor() {\n super();\n }\n write() {\n return !1;\n }\n destroy() {\n }\n end() {\n }\n pipe() {\n }\n}\n\nclass ShimmedStdioOutStream extends EventEmitter {\n constructor() {\n super(...arguments);\n }\n pipe() {\n }\n}\nvar validateAbortSignal = (signal, name) => {\n if (signal !== void 0 && (signal === null || typeof signal !== \"object\" || !(\"aborted\" in signal)))\n throw new ERR_INVALID_ARG_TYPE(name, \"AbortSignal\", signal);\n};\nvar validateObject = (value, name, options = null) => {\n const allowArray = options\?.allowArray \?\? !1, allowFunction = options\?.allowFunction \?\? !1;\n if (!(options\?.nullable \?\? !1) && value === null || !allowArray && ArrayIsArray.call(value) || typeof value !== \"object\" && (!allowFunction || typeof value !== \"function\"))\n throw new ERR_INVALID_ARG_TYPE(name, \"object\", value);\n}, validateArray = (value, name, minLength = 0) => {\n if (!ArrayIsArray(value))\n throw new ERR_INVALID_ARG_TYPE(name, \"Array\", value);\n if (value.length < minLength) {\n const reason = `must be longer than ${minLength}`;\n throw new ERR_INVALID_ARG_VALUE(name, value, reason);\n }\n}, Error = globalThis.Error, TypeError = globalThis.TypeError, RangeError = globalThis.RangeError;\n\nclass AbortError extends Error {\n code = \"ABORT_ERR\";\n name = \"AbortError\";\n constructor(message = \"The operation was aborted\", options = void 0) {\n if (options !== void 0 && typeof options !== \"object\")\n throw new ERR_INVALID_ARG_TYPE(\"options\", \"Object\", options);\n super(message, options);\n }\n}\n\nclass SystemError extends Error {\n path;\n syscall;\n errno;\n code;\n constructor(message, path, syscall, errno, code) {\n super(message);\n this.path = path, this.syscall = syscall, this.errno = errno, this.code = code;\n }\n get name() {\n return \"SystemError\";\n }\n}\n$ = {\n ChildProcess,\n spawn,\n execFile,\n exec,\n fork,\n spawnSync,\n execFileSync,\n execSync\n};\nreturn $})\n"_s;
+static constexpr ASCIILiteral NodeChildProcessCode = "(function (){\"use strict\";// src/js/out/tmp/node/child_process.ts\nvar spawn = function(file, args, options) {\n options = normalizeSpawnArguments(file, args, options), validateTimeout(options.timeout), validateAbortSignal(options.signal, \"options.signal\");\n const killSignal2 = sanitizeKillSignal(options.killSignal), child = new ChildProcess;\n if (child.spawn(options), options.timeout > 0) {\n let timeoutId = setTimeout(() => {\n if (timeoutId) {\n try {\n child.kill(killSignal2);\n } catch (err) {\n child.emit(\"error\", err);\n }\n timeoutId = null;\n }\n });\n child.once(\"exit\", () => {\n if (timeoutId)\n clearTimeout(timeoutId), timeoutId = null;\n });\n }\n if (options.signal) {\n let onAbortListener2 = function() {\n abortChildProcess(child, killSignal2, options.signal.reason);\n };\n var onAbortListener = onAbortListener2;\n const signal = options.signal;\n if (signal.aborted)\n process.nextTick(onAbortListener2);\n else\n signal.addEventListener(\"abort\", onAbortListener2, { once: !0 }), child.once(\"exit\", () => signal.removeEventListener(\"abort\", onAbortListener2));\n }\n return child;\n}, execFile = function(file, args, options, callback) {\n ({ file, args, options, callback } = normalizeExecFileArgs(file, args, options, callback)), options = {\n encoding: \"utf8\",\n timeout: 0,\n maxBuffer: MAX_BUFFER,\n killSignal: \"SIGTERM\",\n cwd: null,\n env: null,\n shell: !1,\n ...options\n };\n const maxBuffer = options.maxBuffer;\n validateTimeout(options.timeout), validateMaxBuffer(maxBuffer), options.killSignal = sanitizeKillSignal(options.killSignal);\n const child = spawn(file, args, {\n cwd: options.cwd,\n env: options.env,\n shell: options.shell,\n signal: options.signal\n });\n let encoding;\n const _stdout = [], _stderr = [];\n if (options.encoding !== \"buffer\" && BufferIsEncoding(options.encoding))\n encoding = options.encoding;\n else\n encoding = null;\n let stdoutLen = 0, stderrLen = 0, killed = !1, exited = !1, timeoutId, encodedStdoutLen, encodedStderrLen, ex = null, cmd = file;\n function exitHandler(code, signal) {\n if (exited)\n return;\n if (exited = !0, timeoutId)\n clearTimeout(timeoutId), timeoutId = null;\n if (!callback)\n return;\n const readableEncoding = child\?.stdout\?.readableEncoding;\n let stdout, stderr;\n if (encoding || child.stdout && readableEncoding)\n stdout = ArrayPrototypeJoin.call(_stdout, \"\");\n else\n stdout = BufferConcat(_stdout);\n if (encoding || child.stderr && readableEncoding)\n stderr = ArrayPrototypeJoin.call(_stderr, \"\");\n else\n stderr = BufferConcat(_stderr);\n if (!ex && code === 0 && signal === null) {\n callback(null, stdout, stderr);\n return;\n }\n if (args\?.length)\n cmd += ` ${ArrayPrototypeJoin.call(args, \" \")}`;\n if (!ex) {\n let message = `Command failed: ${cmd}`;\n if (stderr)\n message += `\\n${stderr}`;\n ex = genericNodeError(message, {\n code,\n killed: child.killed || killed,\n signal\n });\n }\n ex.cmd = cmd, callback(ex, stdout, stderr);\n }\n function errorHandler(e) {\n if (ex = e, child.stdout)\n child.stdout.destroy();\n if (child.stderr)\n child.stderr.destroy();\n exitHandler();\n }\n function kill() {\n if (child.stdout)\n child.stdout.destroy();\n if (child.stderr)\n child.stderr.destroy();\n killed = !0;\n try {\n child.kill(options.killSignal);\n } catch (e) {\n ex = e, exitHandler();\n }\n }\n if (options.timeout > 0)\n timeoutId = setTimeout(function delayedKill() {\n kill(), timeoutId = null;\n }, options.timeout);\n if (child.stdout) {\n if (encoding)\n child.stdout.setEncoding(encoding);\n child.stdout.on(\"data\", maxBuffer === Infinity \? function onUnlimitedSizeBufferedData(chunk) {\n ArrayPrototypePush.call(_stdout, chunk);\n } : encoding \? function onChildStdoutEncoded(chunk) {\n if (stdoutLen += chunk.length, stdoutLen * 4 > maxBuffer) {\n const encoding2 = child.stdout.readableEncoding, actualLen = Buffer.byteLength(chunk, encoding2);\n if (encodedStdoutLen === void 0)\n for (let i = 0;i < _stdout.length; i++)\n encodedStdoutLen += Buffer.byteLength(_stdout[i], encoding2);\n else\n encodedStdoutLen += actualLen;\n const truncatedLen = maxBuffer - (encodedStdoutLen - actualLen);\n ArrayPrototypePush.call(_stdout, StringPrototypeSlice.apply(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stdout\"), kill();\n } else\n ArrayPrototypePush.call(_stdout, chunk);\n } : function onChildStdoutRaw(chunk) {\n if (stdoutLen += chunk.length, stdoutLen > maxBuffer) {\n const truncatedLen = maxBuffer - (stdoutLen - chunk.length);\n ArrayPrototypePush.call(_stdout, chunk.slice(0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stdout\"), kill();\n } else\n ArrayPrototypePush.call(_stdout, chunk);\n });\n }\n if (child.stderr) {\n if (encoding)\n child.stderr.setEncoding(encoding);\n child.stderr.on(\"data\", maxBuffer === Infinity \? function onUnlimitedSizeBufferedData(chunk) {\n ArrayPrototypePush.call(_stderr, chunk);\n } : encoding \? function onChildStderrEncoded(chunk) {\n if (stderrLen += chunk.length, stderrLen * 4 > maxBuffer) {\n const encoding2 = child.stderr.readableEncoding, actualLen = Buffer.byteLength(chunk, encoding2);\n if (encodedStderrLen === void 0)\n for (let i = 0;i < _stderr.length; i++)\n encodedStderrLen += Buffer.byteLength(_stderr[i], encoding2);\n else\n encodedStderrLen += actualLen;\n const truncatedLen = maxBuffer - (encodedStderrLen - actualLen);\n ArrayPrototypePush.call(_stderr, StringPrototypeSlice.call(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stderr\"), kill();\n } else\n ArrayPrototypePush.call(_stderr, chunk);\n } : function onChildStderrRaw(chunk) {\n if (stderrLen += chunk.length, stderrLen > maxBuffer) {\n const truncatedLen = maxBuffer - (stderrLen - chunk.length);\n ArrayPrototypePush.call(_stderr, StringPrototypeSlice.call(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stderr\"), kill();\n } else\n ArrayPrototypePush.call(_stderr, chunk);\n });\n }\n return child.addListener(\"close\", exitHandler), child.addListener(\"error\", errorHandler), child;\n}, exec = function(command, options, callback) {\n const opts = normalizeExecArgs(command, options, callback);\n return execFile(opts.file, opts.options, opts.callback);\n}, spawnSync = function(file, args, options) {\n options = {\n maxBuffer: MAX_BUFFER,\n ...normalizeSpawnArguments(file, args, options)\n };\n const { maxBuffer, encoding } = options;\n validateTimeout(options.timeout), validateMaxBuffer(maxBuffer), options.killSignal = sanitizeKillSignal(options.killSignal);\n const stdio = options.stdio || \"pipe\", bunStdio = getBunStdioFromOptions(stdio);\n var { input } = options;\n if (input)\n if (ArrayBufferIsView(input))\n bunStdio[0] = input;\n else if (typeof input === \"string\")\n bunStdio[0] = Buffer.from(input, encoding || \"utf8\");\n else\n throw new ERR_INVALID_ARG_TYPE(\"options.stdio[0]\", [\"Buffer\", \"TypedArray\", \"DataView\", \"string\"], input);\n const { stdout, stderr, success, exitCode } = Bun.spawnSync({\n cmd: options.args,\n env: options.env || void 0,\n cwd: options.cwd || void 0,\n stdin: bunStdio[0],\n stdout: bunStdio[1],\n stderr: bunStdio[2]\n }), result = {\n signal: null,\n status: exitCode,\n output: [null, stdout, stderr]\n };\n if (stdout && encoding && encoding !== \"buffer\")\n result.output[1] = result.output[1]\?.toString(encoding);\n if (stderr && encoding && encoding !== \"buffer\")\n result.output[2] = result.output[2]\?.toString(encoding);\n if (result.stdout = result.output[1], result.stderr = result.output[2], !success)\n result.error = new SystemError(result.output[2], options.file, \"spawnSync\", -1, result.status), result.error.spawnargs = ArrayPrototypeSlice.call(options.args, 1);\n return result;\n}, execFileSync = function(file, args, options) {\n ({ file, args, options } = normalizeExecFileArgs(file, args, options));\n const ret = spawnSync(file, args, options), errArgs = [options.argv0 || file];\n ArrayPrototypePush.apply(errArgs, args);\n const err = checkExecSyncError(ret, errArgs);\n if (err)\n throw err;\n return ret.stdout;\n}, execSync = function(command, options) {\n const opts = normalizeExecArgs(command, options, null), ret = spawnSync(opts.file, opts.options), err = checkExecSyncError(ret, void 0, command);\n if (err)\n throw err;\n return ret.stdout;\n}, stdioStringToArray = function(stdio, channel) {\n const options = [];\n switch (stdio) {\n case \"ignore\":\n case \"overlapped\":\n case \"pipe\":\n ArrayPrototypePush.call(options, stdio, stdio, stdio);\n break;\n case \"inherit\":\n ArrayPrototypePush.call(options, 0, 1, 2);\n break;\n default:\n throw new ERR_INVALID_ARG_VALUE(\"stdio\", stdio);\n }\n if (channel)\n ArrayPrototypePush.call(options, channel);\n return options;\n}, fork = function(modulePath, args = [], options) {\n modulePath = getValidatedPath(modulePath, \"modulePath\");\n let execArgv;\n if (args == null)\n args = [];\n else if (typeof args === \"object\" && !ArrayIsArray(args))\n options = args, args = [];\n else\n validateArray(args, \"args\");\n if (options != null)\n validateObject(options, \"options\");\n if (options = { __proto__: null, ...options, shell: !1 }, options.execPath = options.execPath || process.execPath, validateArgumentNullCheck(options.execPath, \"options.execPath\"), execArgv = options.execArgv || process.execArgv, validateArgumentsNullCheck(execArgv, \"options.execArgv\"), execArgv === process.execArgv && process._eval != null) {\n const index = ArrayPrototypeLastIndexOf.call(execArgv, process._eval);\n if (index > 0)\n execArgv = ArrayPrototypeSlice.call(execArgv), ArrayPrototypeSplice.call(execArgv, index - 1, 2);\n }\n if (args = [...execArgv, modulePath, ...args], typeof options.stdio === \"string\")\n options.stdio = stdioStringToArray(options.stdio, \"ipc\");\n else if (!ArrayIsArray(options.stdio))\n options.stdio = stdioStringToArray(options.silent \? \"pipe\" : \"inherit\", \"ipc\");\n else if (!ArrayPrototypeIncludes.call(options.stdio, \"ipc\"))\n throw new ERR_CHILD_PROCESS_IPC_REQUIRED(\"options.stdio\");\n return spawn(options.execPath, args, options);\n}, convertToValidSignal = function(signal) {\n if (typeof signal === \"number\" && getSignalsToNamesMapping()[signal])\n return signal;\n if (typeof signal === \"string\") {\n const signalName = signals[StringPrototypeToUpperCase.call(signal)];\n if (signalName)\n return signalName;\n }\n throw new ERR_UNKNOWN_SIGNAL(signal);\n}, sanitizeKillSignal = function(killSignal2) {\n if (typeof killSignal2 === \"string\" || typeof killSignal2 === \"number\")\n return convertToValidSignal(killSignal2);\n else if (killSignal2 != null)\n throw new ERR_INVALID_ARG_TYPE(\"options.killSignal\", [\"string\", \"number\"], killSignal2);\n}, getSignalsToNamesMapping = function() {\n if (signalsToNamesMapping !== void 0)\n return signalsToNamesMapping;\n signalsToNamesMapping = ObjectCreate(null);\n for (let key in signals)\n signalsToNamesMapping[signals[key]] = key;\n return signalsToNamesMapping;\n}, normalizeExecFileArgs = function(file, args, options, callback) {\n if (ArrayIsArray(args))\n args = ArrayPrototypeSlice.call(args);\n else if (args != null && typeof args === \"object\")\n callback = options, options = args, args = null;\n else if (typeof args === \"function\")\n callback = args, options = null, args = null;\n if (args == null)\n args = [];\n if (typeof options === \"function\")\n callback = options;\n else if (options != null)\n validateObject(options, \"options\");\n if (options == null)\n options = kEmptyObject;\n if (callback != null)\n validateFunction(callback, \"callback\");\n if (options.argv0 != null)\n validateString(options.argv0, \"options.argv0\"), validateArgumentNullCheck(options.argv0, \"options.argv0\");\n return { file, args, options, callback };\n}, normalizeExecArgs = function(command, options, callback) {\n if (validateString(command, \"command\"), validateArgumentNullCheck(command, \"command\"), typeof options === \"function\")\n callback = options, options = void 0;\n return options = { ...options }, options.shell = typeof options.shell === \"string\" \? options.shell : !0, {\n file: command,\n options,\n callback\n };\n}, normalizeSpawnArguments = function(file, args, options) {\n if (validateString(file, \"file\"), validateArgumentNullCheck(file, \"file\"), file.length === 0)\n throw new ERR_INVALID_ARG_VALUE(\"file\", file, \"cannot be empty\");\n if (ArrayIsArray(args))\n args = ArrayPrototypeSlice.call(args);\n else if (args == null)\n args = [];\n else if (typeof args !== \"object\")\n throw new ERR_INVALID_ARG_TYPE(\"args\", \"object\", args);\n else\n options = args, args = [];\n if (validateArgumentsNullCheck(args, \"args\"), options === void 0)\n options = {};\n else\n validateObject(options, \"options\");\n let cwd = options.cwd;\n if (cwd != null)\n cwd = getValidatedPath(cwd, \"options.cwd\");\n var detached = !1;\n const { detached: detachedOption } = options;\n if (detachedOption != null)\n detached = !!detachedOption;\n if (options.shell != null && typeof options.shell !== \"boolean\" && typeof options.shell !== \"string\")\n throw new ERR_INVALID_ARG_TYPE(\"options.shell\", [\"boolean\", \"string\"], options.shell);\n if (options.argv0 != null)\n validateString(options.argv0, \"options.argv0\"), validateArgumentNullCheck(options.argv0, \"options.argv0\");\n if (options.shell) {\n validateArgumentNullCheck(options.shell, \"options.shell\");\n const command = ArrayPrototypeJoin.call([file, ...args], \" \");\n if (typeof options.shell === \"string\")\n file = options.shell;\n else\n file = \"sh\";\n args = [\"-c\", command];\n }\n if (typeof options.argv0 === \"string\")\n ArrayPrototypeUnshift.call(args, options.argv0);\n else\n ArrayPrototypeUnshift.call(args, file);\n const envPairs = options.env || process.env;\n return { ...options, detached, file, args, cwd, envPairs };\n}, checkExecSyncError = function(ret, args, cmd) {\n let err;\n if (ret.error)\n err = ret.error, ObjectAssign(err, ret);\n else if (ret.status !== 0) {\n let msg = \"Command failed: \";\n if (msg += cmd || ArrayPrototypeJoin.call(args, \" \"), ret.stderr && ret.stderr.length > 0)\n msg += `\\n${ret.stderr.toString()}`;\n err = genericNodeError(msg, ret);\n }\n return err;\n}, nodeToBun = function(item) {\n if (typeof item === \"number\")\n return item;\n else {\n const result = nodeToBunLookup[item];\n if (result === void 0)\n throw new Error(\"Invalid stdio option\");\n return result;\n }\n}, fdToStdioName = function(fd) {\n switch (fd) {\n case 0:\n return \"stdin\";\n case 1:\n return \"stdout\";\n case 2:\n return \"stderr\";\n default:\n return null;\n }\n}, getBunStdioFromOptions = function(stdio) {\n return normalizeStdio(stdio).map((item) => nodeToBun(item));\n}, normalizeStdio = function(stdio) {\n if (typeof stdio === \"string\")\n switch (stdio) {\n case \"ignore\":\n return [\"ignore\", \"ignore\", \"ignore\"];\n case \"pipe\":\n return [\"pipe\", \"pipe\", \"pipe\"];\n case \"inherit\":\n return [\"inherit\", \"inherit\", \"inherit\"];\n default:\n throw new ERR_INVALID_OPT_VALUE(\"stdio\", stdio);\n }\n else if (ArrayIsArray(stdio)) {\n let processedStdio;\n if (stdio.length === 0)\n processedStdio = [\"pipe\", \"pipe\", \"pipe\"];\n else if (stdio.length === 1)\n processedStdio = [stdio[0], \"pipe\", \"pipe\"];\n else if (stdio.length === 2)\n processedStdio = [stdio[0], stdio[1], \"pipe\"];\n else if (stdio.length >= 3)\n processedStdio = [stdio[0], stdio[1], stdio[2]];\n return processedStdio.map((item) => !item \? \"pipe\" : item);\n } else\n throw new ERR_INVALID_OPT_VALUE(\"stdio\", stdio);\n}, flushStdio = function(subprocess) {\n const stdio = subprocess.stdio;\n if (stdio == null)\n return;\n for (let i = 0;i < stdio.length; i++) {\n const stream = stdio[i];\n if (!stream || !stream.readable)\n continue;\n stream.resume();\n }\n}, onSpawnNT = function(self) {\n self.emit(\"spawn\");\n}, abortChildProcess = function(child, killSignal2, reason) {\n if (!child)\n return;\n try {\n if (child.kill(killSignal2))\n child.emit(\"error\", new AbortError(void 0, { cause: reason }));\n } catch (err) {\n child.emit(\"error\", err);\n }\n}, validateMaxBuffer = function(maxBuffer) {\n if (maxBuffer != null && !(typeof maxBuffer === \"number\" && maxBuffer >= 0))\n throw new ERR_OUT_OF_RANGE(\"options.maxBuffer\", \"a positive number\", maxBuffer);\n}, validateArgumentNullCheck = function(arg, propName) {\n if (typeof arg === \"string\" && StringPrototypeIncludes.call(arg, \"\\0\"))\n throw new ERR_INVALID_ARG_VALUE(propName, arg, \"must be a string without null bytes\");\n}, validateArgumentsNullCheck = function(args, propName) {\n for (let i = 0;i < args.length; ++i)\n validateArgumentNullCheck(args[i], `${propName}[${i}]`);\n}, validateTimeout = function(timeout) {\n if (timeout != null && !(NumberIsInteger(timeout) && timeout >= 0))\n throw new ERR_OUT_OF_RANGE(\"timeout\", \"an unsigned integer\", timeout);\n};\nvar validateFunction = function(value, name) {\n if (typeof value !== \"function\")\n throw new ERR_INVALID_ARG_TYPE(name, \"Function\", value);\n}, validateString = function(value, name) {\n if (typeof value !== \"string\")\n throw new ERR_INVALID_ARG_TYPE(name, \"string\", value);\n}, nullCheck = function(path, propName, throwError = !0) {\n const pathIsString = typeof path === \"string\", pathIsUint8Array = isUint8Array(path);\n if (!pathIsString && !pathIsUint8Array || pathIsString && !StringPrototypeIncludes.call(path, \"\\0\") || pathIsUint8Array && !Uint8ArrayPrototypeIncludes.call(path, 0))\n return;\n const err = new ERR_INVALID_ARG_VALUE(propName, path, \"must be a string or Uint8Array without null bytes\");\n if (throwError)\n throw err;\n return err;\n}, validatePath = function(path, propName = \"path\") {\n if (typeof path !== \"string\" && !isUint8Array(path))\n throw new ERR_INVALID_ARG_TYPE(propName, [\"string\", \"Buffer\", \"URL\"], path);\n const err = nullCheck(path, propName, !1);\n if (err !== void 0)\n throw err;\n}, getValidatedPath = function(fileURLOrPath, propName = \"path\") {\n const path = toPathIfFileURL(fileURLOrPath);\n return validatePath(path, propName), path;\n}, isUint8Array = function(value) {\n return typeof value === \"object\" && value !== null && value instanceof Uint8Array;\n}, isURLInstance = function(fileURLOrPath) {\n return fileURLOrPath != null && fileURLOrPath.href && fileURLOrPath.origin;\n}, toPathIfFileURL = function(fileURLOrPath) {\n if (!isURLInstance(fileURLOrPath))\n return fileURLOrPath;\n return Bun.fileURLToPath(fileURLOrPath);\n}, genericNodeError = function(message, options) {\n const err = new Error(message);\n return err.code = options.code, err.killed = options.killed, err.signal = options.signal, err;\n}, ERR_OUT_OF_RANGE = function(str, range, input, replaceDefaultBoolean = !1) {\n return new RangeError(`The value of ${str} is out of range. It must be ${range}. Received ${input}`);\n}, ERR_CHILD_PROCESS_STDIO_MAXBUFFER = function(stdio) {\n return Error(`${stdio} maxBuffer length exceeded`);\n}, ERR_UNKNOWN_SIGNAL = function(name) {\n const err = @makeTypeError(`Unknown signal: ${name}`);\n return err.code = \"ERR_UNKNOWN_SIGNAL\", err;\n}, ERR_INVALID_ARG_TYPE = function(name, type, value) {\n const err = @makeTypeError(`The \"${name}\" argument must be of type ${type}. Received ${value\?.toString()}`);\n return err.code = \"ERR_INVALID_ARG_TYPE\", err;\n}, ERR_INVALID_OPT_VALUE = function(name, value) {\n return @makeTypeError(`The value \"${value}\" is invalid for option \"${name}\"`);\n}, ERR_INVALID_ARG_VALUE = function(name, value, reason) {\n return new Error(`The value \"${value}\" is invalid for argument '${name}'. Reason: ${reason}`);\n}, ERR_CHILD_PROCESS_IPC_REQUIRED = function(name) {\n const err = @makeTypeError(`Forked processes must have an IPC channel, missing value 'ipc' in ${name}`);\n return err.code = \"ERR_CHILD_PROCESS_IPC_REQUIRED\", err;\n}, $, EventEmitter = @getInternalField(@internalModuleRegistry, 16) || @createInternalModuleById(16), StreamModule = @getInternalField(@internalModuleRegistry, 35) || @createInternalModuleById(35), {\n constants: { signals }\n} = @getInternalField(@internalModuleRegistry, 24) || @createInternalModuleById(24), { promisify } = @getInternalField(@internalModuleRegistry, 44) || @createInternalModuleById(44), ObjectCreate = Object.create, ObjectAssign = Object.assign, ObjectDefineProperty = Object.defineProperty, BufferConcat = Buffer.concat, BufferIsEncoding = Buffer.isEncoding, kEmptyObject = ObjectCreate(null), ArrayPrototypePush = Array.prototype.push, ArrayPrototypeJoin = Array.prototype.join, ArrayPrototypeMap = Array.prototype.map, ArrayPrototypeIncludes = Array.prototype.includes, ArrayPrototypeSlice = Array.prototype.slice, ArrayPrototypeUnshift = Array.prototype.unshift, ArrayPrototypeLastIndexOf = Array.prototype.lastIndexOf, ArrayPrototypeSplice = Array.prototype.splice, ArrayIsArray = Array.isArray, ArrayBufferIsView = ArrayBuffer.isView, NumberIsInteger = Number.isInteger;\nvar StringPrototypeToUpperCase = String.prototype.toUpperCase, StringPrototypeIncludes = String.prototype.includes, StringPrototypeSlice = String.prototype.slice, Uint8ArrayPrototypeIncludes = Uint8Array.prototype.includes, MAX_BUFFER = 1048576, NativeWritable, ReadableFromWeb, customPromiseExecFunction = (orig) => {\n return (...args) => {\n let resolve, reject;\n const promise = new Promise((res, rej) => {\n resolve = res, reject = rej;\n });\n return promise.child = orig(...args, (err, stdout, stderr) => {\n if (err !== null)\n err.stdout = stdout, err.stderr = stderr, reject(err);\n else\n resolve({ stdout, stderr });\n }), promise;\n };\n};\nObjectDefineProperty(exec, promisify.custom, {\n __proto__: null,\n enumerable: !1,\n value: customPromiseExecFunction(exec)\n});\nvar signalsToNamesMapping;\n\nclass ChildProcess extends EventEmitter {\n constructor() {\n super(...arguments);\n }\n #handle;\n #exited = !1;\n #closesNeeded = 1;\n #closesGot = 0;\n connected = !1;\n signalCode = null;\n exitCode = null;\n spawnfile;\n spawnargs;\n pid;\n channel;\n get killed() {\n if (this.#handle == null)\n return !1;\n }\n #handleOnExit(exitCode, signalCode, err) {\n if (this.#exited)\n return;\n if (signalCode)\n this.signalCode = signalCode;\n else\n this.exitCode = exitCode;\n if (this.#stdin)\n this.#stdin.destroy();\n if (this.#handle)\n this.#handle = null;\n if (exitCode < 0) {\n const err2 = new SystemError(`Spawned process exited with error code: ${exitCode}`, void 0, \"spawn\", \"EUNKNOWN\", \"ERR_CHILD_PROCESS_UNKNOWN_ERROR\");\n if (this.spawnfile)\n err2.path = this.spawnfile;\n err2.spawnargs = ArrayPrototypeSlice.call(this.spawnargs, 1), this.emit(\"error\", err2);\n } else\n this.emit(\"exit\", this.exitCode, this.signalCode);\n process.nextTick(flushStdio, this), this.#maybeClose(), this.#exited = !0, this.#stdioOptions = [\"destroyed\", \"destroyed\", \"destroyed\"];\n }\n #getBunSpawnIo(i, encoding) {\n NativeWritable ||= StreamModule.NativeWritable, ReadableFromWeb ||= StreamModule.Readable.fromWeb;\n const io = this.#stdioOptions[i];\n switch (i) {\n case 0:\n switch (io) {\n case \"pipe\":\n return new NativeWritable(this.#handle.stdin);\n case \"inherit\":\n return process.stdin || null;\n case \"destroyed\":\n return new ShimmedStdin;\n default:\n return null;\n }\n case 2:\n case 1:\n switch (io) {\n case \"pipe\":\n return ReadableFromWeb(this.#handle[fdToStdioName(i)], { encoding });\n case \"inherit\":\n return process[fdToStdioName(i)] || null;\n case \"destroyed\":\n return new ShimmedStdioOutStream;\n default:\n return null;\n }\n }\n }\n #stdin;\n #stdout;\n #stderr;\n #stdioObject;\n #encoding;\n #stdioOptions;\n #createStdioObject() {\n return Object.create(null, {\n 0: {\n get: () => this.stdin\n },\n 1: {\n get: () => this.stdout\n },\n 2: {\n get: () => this.stderr\n }\n });\n }\n get stdin() {\n return this.#stdin \?\?= this.#getBunSpawnIo(0, this.#encoding);\n }\n get stdout() {\n return this.#stdout \?\?= this.#getBunSpawnIo(1, this.#encoding);\n }\n get stderr() {\n return this.#stderr \?\?= this.#getBunSpawnIo(2, this.#encoding);\n }\n get stdio() {\n return this.#stdioObject \?\?= this.#createStdioObject();\n }\n spawn(options) {\n validateObject(options, \"options\"), validateString(options.file, \"options.file\");\n var file = this.spawnfile = options.file, spawnargs;\n if (options.args == null)\n spawnargs = this.spawnargs = [];\n else\n validateArray(options.args, \"options.args\"), spawnargs = this.spawnargs = options.args;\n const stdio = options.stdio || [\"pipe\", \"pipe\", \"pipe\"], bunStdio = getBunStdioFromOptions(stdio);\n var env = options.envPairs || void 0;\n const detachedOption = options.detached;\n this.#encoding = options.encoding || void 0, this.#stdioOptions = bunStdio, this.#handle = Bun.spawn({\n cmd: spawnargs,\n stdin: bunStdio[0],\n stdout: bunStdio[1],\n stderr: bunStdio[2],\n cwd: options.cwd || void 0,\n env: env || process.env,\n detached: typeof detachedOption !== \"undefined\" \? !!detachedOption : !1,\n onExit: (handle, exitCode, signalCode, err) => {\n this.#handle = handle, this.pid = this.#handle.pid, process.nextTick((exitCode2, signalCode2, err2) => this.#handleOnExit(exitCode2, signalCode2, err2), exitCode, signalCode, err);\n },\n lazy: !0\n }), this.pid = this.#handle.pid, onSpawnNT(this);\n }\n send() {\n console.log(\"ChildProcess.prototype.send() - Sorry! Not implemented yet\");\n }\n disconnect() {\n console.log(\"ChildProcess.prototype.disconnect() - Sorry! Not implemented yet\");\n }\n kill(sig) {\n const signal = sig === 0 \? sig : convertToValidSignal(sig === void 0 \? \"SIGTERM\" : sig);\n if (this.#handle)\n this.#handle.kill(signal);\n return this.#maybeClose(), !0;\n }\n #maybeClose() {\n if (this.#closesGot++, this.#closesGot === this.#closesNeeded)\n this.emit(\"close\", this.exitCode, this.signalCode);\n }\n ref() {\n if (this.#handle)\n this.#handle.ref();\n }\n unref() {\n if (this.#handle)\n this.#handle.unref();\n }\n}\nvar nodeToBunLookup = {\n ignore: null,\n pipe: \"pipe\",\n overlapped: \"pipe\",\n inherit: \"inherit\"\n};\n\nclass ShimmedStdin extends EventEmitter {\n constructor() {\n super();\n }\n write() {\n return !1;\n }\n destroy() {\n }\n end() {\n }\n pipe() {\n }\n}\n\nclass ShimmedStdioOutStream extends EventEmitter {\n constructor() {\n super(...arguments);\n }\n pipe() {\n }\n}\nvar validateAbortSignal = (signal, name) => {\n if (signal !== void 0 && (signal === null || typeof signal !== \"object\" || !(\"aborted\" in signal)))\n throw new ERR_INVALID_ARG_TYPE(name, \"AbortSignal\", signal);\n};\nvar validateObject = (value, name, options = null) => {\n const allowArray = options\?.allowArray \?\? !1, allowFunction = options\?.allowFunction \?\? !1;\n if (!(options\?.nullable \?\? !1) && value === null || !allowArray && ArrayIsArray.call(value) || typeof value !== \"object\" && (!allowFunction || typeof value !== \"function\"))\n throw new ERR_INVALID_ARG_TYPE(name, \"object\", value);\n}, validateArray = (value, name, minLength = 0) => {\n if (!ArrayIsArray(value))\n throw new ERR_INVALID_ARG_TYPE(name, \"Array\", value);\n if (value.length < minLength) {\n const reason = `must be longer than ${minLength}`;\n throw new ERR_INVALID_ARG_VALUE(name, value, reason);\n }\n}, Error = globalThis.Error, TypeError = globalThis.TypeError, RangeError = globalThis.RangeError;\n\nclass AbortError extends Error {\n code = \"ABORT_ERR\";\n name = \"AbortError\";\n constructor(message = \"The operation was aborted\", options = void 0) {\n if (options !== void 0 && typeof options !== \"object\")\n throw new ERR_INVALID_ARG_TYPE(\"options\", \"Object\", options);\n super(message, options);\n }\n}\n\nclass SystemError extends Error {\n path;\n syscall;\n errno;\n code;\n constructor(message, path, syscall, errno, code) {\n super(message);\n this.path = path, this.syscall = syscall, this.errno = errno, this.code = code;\n }\n get name() {\n return \"SystemError\";\n }\n}\n$ = {\n ChildProcess,\n spawn,\n execFile,\n exec,\n fork,\n spawnSync,\n execFileSync,\n execSync\n};\nreturn $})\n"_s;
//
//
@@ -267,7 +267,7 @@ static constexpr ASCIILiteral NodeAsyncHooksCode = "(function (){\"use strict\";
//
//
-static constexpr ASCIILiteral NodeChildProcessCode = "(function (){\"use strict\";// src/js/out/tmp/node/child_process.ts\nvar spawn = function(file, args, options) {\n options = normalizeSpawnArguments(file, args, options), validateTimeout(options.timeout), validateAbortSignal(options.signal, \"options.signal\");\n const killSignal2 = sanitizeKillSignal(options.killSignal), child = new ChildProcess;\n if (child.spawn(options), options.timeout > 0) {\n let timeoutId = setTimeout(() => {\n if (timeoutId) {\n try {\n child.kill(killSignal2);\n } catch (err) {\n child.emit(\"error\", err);\n }\n timeoutId = null;\n }\n });\n child.once(\"exit\", () => {\n if (timeoutId)\n clearTimeout(timeoutId), timeoutId = null;\n });\n }\n if (options.signal) {\n let onAbortListener2 = function() {\n abortChildProcess(child, killSignal2, options.signal.reason);\n };\n var onAbortListener = onAbortListener2;\n const signal = options.signal;\n if (signal.aborted)\n process.nextTick(onAbortListener2);\n else\n signal.addEventListener(\"abort\", onAbortListener2, { once: !0 }), child.once(\"exit\", () => signal.removeEventListener(\"abort\", onAbortListener2));\n }\n return child;\n}, execFile = function(file, args, options, callback) {\n ({ file, args, options, callback } = normalizeExecFileArgs(file, args, options, callback)), options = {\n encoding: \"utf8\",\n timeout: 0,\n maxBuffer: MAX_BUFFER,\n killSignal: \"SIGTERM\",\n cwd: null,\n env: null,\n shell: !1,\n ...options\n };\n const maxBuffer = options.maxBuffer;\n validateTimeout(options.timeout), validateMaxBuffer(maxBuffer), options.killSignal = sanitizeKillSignal(options.killSignal);\n const child = spawn(file, args, {\n cwd: options.cwd,\n env: options.env,\n shell: options.shell,\n signal: options.signal\n });\n let encoding;\n const _stdout = [], _stderr = [];\n if (options.encoding !== \"buffer\" && BufferIsEncoding(options.encoding))\n encoding = options.encoding;\n else\n encoding = null;\n let stdoutLen = 0, stderrLen = 0, killed = !1, exited = !1, timeoutId, encodedStdoutLen, encodedStderrLen, ex = null, cmd = file;\n function exitHandler(code, signal) {\n if (exited)\n return;\n if (exited = !0, timeoutId)\n clearTimeout(timeoutId), timeoutId = null;\n if (!callback)\n return;\n const readableEncoding = child\?.stdout\?.readableEncoding;\n let stdout, stderr;\n if (encoding || child.stdout && readableEncoding)\n stdout = ArrayPrototypeJoin.call(_stdout, \"\");\n else\n stdout = BufferConcat(_stdout);\n if (encoding || child.stderr && readableEncoding)\n stderr = ArrayPrototypeJoin.call(_stderr, \"\");\n else\n stderr = BufferConcat(_stderr);\n if (!ex && code === 0 && signal === null) {\n callback(null, stdout, stderr);\n return;\n }\n if (args\?.length)\n cmd += ` ${ArrayPrototypeJoin.call(args, \" \")}`;\n if (!ex) {\n let message = `Command failed: ${cmd}`;\n if (stderr)\n message += `\\n${stderr}`;\n ex = genericNodeError(message, {\n code,\n killed: child.killed || killed,\n signal\n });\n }\n ex.cmd = cmd, callback(ex, stdout, stderr);\n }\n function errorHandler(e) {\n if (ex = e, child.stdout)\n child.stdout.destroy();\n if (child.stderr)\n child.stderr.destroy();\n exitHandler();\n }\n function kill() {\n if (child.stdout)\n child.stdout.destroy();\n if (child.stderr)\n child.stderr.destroy();\n killed = !0;\n try {\n child.kill(options.killSignal);\n } catch (e) {\n ex = e, exitHandler();\n }\n }\n if (options.timeout > 0)\n timeoutId = setTimeout(function delayedKill() {\n kill(), timeoutId = null;\n }, options.timeout);\n if (child.stdout) {\n if (encoding)\n child.stdout.setEncoding(encoding);\n child.stdout.on(\"data\", maxBuffer === Infinity \? function onUnlimitedSizeBufferedData(chunk) {\n ArrayPrototypePush.call(_stdout, chunk);\n } : encoding \? function onChildStdoutEncoded(chunk) {\n if (stdoutLen += chunk.length, stdoutLen * 4 > maxBuffer) {\n const encoding2 = child.stdout.readableEncoding, actualLen = Buffer.byteLength(chunk, encoding2);\n if (encodedStdoutLen === void 0)\n for (let i = 0;i < _stdout.length; i++)\n encodedStdoutLen += Buffer.byteLength(_stdout[i], encoding2);\n else\n encodedStdoutLen += actualLen;\n const truncatedLen = maxBuffer - (encodedStdoutLen - actualLen);\n ArrayPrototypePush.call(_stdout, StringPrototypeSlice.apply(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stdout\"), kill();\n } else\n ArrayPrototypePush.call(_stdout, chunk);\n } : function onChildStdoutRaw(chunk) {\n if (stdoutLen += chunk.length, stdoutLen > maxBuffer) {\n const truncatedLen = maxBuffer - (stdoutLen - chunk.length);\n ArrayPrototypePush.call(_stdout, chunk.slice(0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stdout\"), kill();\n } else\n ArrayPrototypePush.call(_stdout, chunk);\n });\n }\n if (child.stderr) {\n if (encoding)\n child.stderr.setEncoding(encoding);\n child.stderr.on(\"data\", maxBuffer === Infinity \? function onUnlimitedSizeBufferedData(chunk) {\n ArrayPrototypePush.call(_stderr, chunk);\n } : encoding \? function onChildStderrEncoded(chunk) {\n if (stderrLen += chunk.length, stderrLen * 4 > maxBuffer) {\n const encoding2 = child.stderr.readableEncoding, actualLen = Buffer.byteLength(chunk, encoding2);\n if (encodedStderrLen === void 0)\n for (let i = 0;i < _stderr.length; i++)\n encodedStderrLen += Buffer.byteLength(_stderr[i], encoding2);\n else\n encodedStderrLen += actualLen;\n const truncatedLen = maxBuffer - (encodedStderrLen - actualLen);\n ArrayPrototypePush.call(_stderr, StringPrototypeSlice.call(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stderr\"), kill();\n } else\n ArrayPrototypePush.call(_stderr, chunk);\n } : function onChildStderrRaw(chunk) {\n if (stderrLen += chunk.length, stderrLen > maxBuffer) {\n const truncatedLen = maxBuffer - (stderrLen - chunk.length);\n ArrayPrototypePush.call(_stderr, StringPrototypeSlice.call(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stderr\"), kill();\n } else\n ArrayPrototypePush.call(_stderr, chunk);\n });\n }\n return child.addListener(\"close\", exitHandler), child.addListener(\"error\", errorHandler), child;\n}, exec = function(command, options, callback) {\n const opts = normalizeExecArgs(command, options, callback);\n return execFile(opts.file, opts.options, opts.callback);\n}, spawnSync = function(file, args, options) {\n options = {\n maxBuffer: MAX_BUFFER,\n ...normalizeSpawnArguments(file, args, options)\n };\n const { maxBuffer, encoding } = options;\n validateTimeout(options.timeout), validateMaxBuffer(maxBuffer), options.killSignal = sanitizeKillSignal(options.killSignal);\n const stdio = options.stdio || \"pipe\", bunStdio = getBunStdioFromOptions(stdio);\n var { input } = options;\n if (input)\n if (ArrayBufferIsView(input))\n bunStdio[0] = input;\n else if (typeof input === \"string\")\n bunStdio[0] = Buffer.from(input, encoding || \"utf8\");\n else\n throw new ERR_INVALID_ARG_TYPE(\"options.stdio[0]\", [\"Buffer\", \"TypedArray\", \"DataView\", \"string\"], input);\n const { stdout, stderr, success, exitCode } = Bun.spawnSync({\n cmd: options.args,\n env: options.env || void 0,\n cwd: options.cwd || void 0,\n stdin: bunStdio[0],\n stdout: bunStdio[1],\n stderr: bunStdio[2]\n }), result = {\n signal: null,\n status: exitCode,\n output: [null, stdout, stderr]\n };\n if (stdout && encoding && encoding !== \"buffer\")\n result.output[1] = result.output[1]\?.toString(encoding);\n if (stderr && encoding && encoding !== \"buffer\")\n result.output[2] = result.output[2]\?.toString(encoding);\n if (result.stdout = result.output[1], result.stderr = result.output[2], !success)\n result.error = new SystemError(result.output[2], options.file, \"spawnSync\", -1, result.status), result.error.spawnargs = ArrayPrototypeSlice.call(options.args, 1);\n return result;\n}, execFileSync = function(file, args, options) {\n ({ file, args, options } = normalizeExecFileArgs(file, args, options));\n const ret = spawnSync(file, args, options), errArgs = [options.argv0 || file];\n ArrayPrototypePush.apply(errArgs, args);\n const err = checkExecSyncError(ret, errArgs);\n if (err)\n throw err;\n return ret.stdout;\n}, execSync = function(command, options) {\n const opts = normalizeExecArgs(command, options, null), ret = spawnSync(opts.file, opts.options), err = checkExecSyncError(ret, void 0, command);\n if (err)\n throw err;\n return ret.stdout;\n}, stdioStringToArray = function(stdio, channel) {\n const options = [];\n switch (stdio) {\n case \"ignore\":\n case \"overlapped\":\n case \"pipe\":\n ArrayPrototypePush.call(options, stdio, stdio, stdio);\n break;\n case \"inherit\":\n ArrayPrototypePush.call(options, 0, 1, 2);\n break;\n default:\n throw new ERR_INVALID_ARG_VALUE(\"stdio\", stdio);\n }\n if (channel)\n ArrayPrototypePush.call(options, channel);\n return options;\n}, fork = function(modulePath, args = [], options) {\n modulePath = getValidatedPath(modulePath, \"modulePath\");\n let execArgv;\n if (args == null)\n args = [];\n else if (typeof args === \"object\" && !ArrayIsArray(args))\n options = args, args = [];\n else\n validateArray(args, \"args\");\n if (options != null)\n validateObject(options, \"options\");\n if (options = { __proto__: null, ...options, shell: !1 }, options.execPath = options.execPath || process.execPath, validateArgumentNullCheck(options.execPath, \"options.execPath\"), execArgv = options.execArgv || process.execArgv, validateArgumentsNullCheck(execArgv, \"options.execArgv\"), execArgv === process.execArgv && process._eval != null) {\n const index = ArrayPrototypeLastIndexOf.call(execArgv, process._eval);\n if (index > 0)\n execArgv = ArrayPrototypeSlice.call(execArgv), ArrayPrototypeSplice.call(execArgv, index - 1, 2);\n }\n if (args = [...execArgv, modulePath, ...args], typeof options.stdio === \"string\")\n options.stdio = stdioStringToArray(options.stdio, \"ipc\");\n else if (!ArrayIsArray(options.stdio))\n options.stdio = stdioStringToArray(options.silent \? \"pipe\" : \"inherit\", \"ipc\");\n else if (!ArrayPrototypeIncludes.call(options.stdio, \"ipc\"))\n throw new ERR_CHILD_PROCESS_IPC_REQUIRED(\"options.stdio\");\n return spawn(options.execPath, args, options);\n}, convertToValidSignal = function(signal) {\n if (typeof signal === \"number\" && getSignalsToNamesMapping()[signal])\n return signal;\n if (typeof signal === \"string\") {\n const signalName = signals[StringPrototypeToUpperCase.call(signal)];\n if (signalName)\n return signalName;\n }\n throw new ERR_UNKNOWN_SIGNAL(signal);\n}, sanitizeKillSignal = function(killSignal2) {\n if (typeof killSignal2 === \"string\" || typeof killSignal2 === \"number\")\n return convertToValidSignal(killSignal2);\n else if (killSignal2 != null)\n throw new ERR_INVALID_ARG_TYPE(\"options.killSignal\", [\"string\", \"number\"], killSignal2);\n}, getSignalsToNamesMapping = function() {\n if (signalsToNamesMapping !== void 0)\n return signalsToNamesMapping;\n signalsToNamesMapping = ObjectCreate(null);\n for (let key in signals)\n signalsToNamesMapping[signals[key]] = key;\n return signalsToNamesMapping;\n}, normalizeExecFileArgs = function(file, args, options, callback) {\n if (ArrayIsArray(args))\n args = ArrayPrototypeSlice.call(args);\n else if (args != null && typeof args === \"object\")\n callback = options, options = args, args = null;\n else if (typeof args === \"function\")\n callback = args, options = null, args = null;\n if (args == null)\n args = [];\n if (typeof options === \"function\")\n callback = options;\n else if (options != null)\n validateObject(options, \"options\");\n if (options == null)\n options = kEmptyObject;\n if (callback != null)\n validateFunction(callback, \"callback\");\n if (options.argv0 != null)\n validateString(options.argv0, \"options.argv0\"), validateArgumentNullCheck(options.argv0, \"options.argv0\");\n return { file, args, options, callback };\n}, normalizeExecArgs = function(command, options, callback) {\n if (validateString(command, \"command\"), validateArgumentNullCheck(command, \"command\"), typeof options === \"function\")\n callback = options, options = void 0;\n return options = { ...options }, options.shell = typeof options.shell === \"string\" \? options.shell : !0, {\n file: command,\n options,\n callback\n };\n}, normalizeSpawnArguments = function(file, args, options) {\n if (validateString(file, \"file\"), validateArgumentNullCheck(file, \"file\"), file.length === 0)\n throw new ERR_INVALID_ARG_VALUE(\"file\", file, \"cannot be empty\");\n if (ArrayIsArray(args))\n args = ArrayPrototypeSlice.call(args);\n else if (args == null)\n args = [];\n else if (typeof args !== \"object\")\n throw new ERR_INVALID_ARG_TYPE(\"args\", \"object\", args);\n else\n options = args, args = [];\n if (validateArgumentsNullCheck(args, \"args\"), options === void 0)\n options = {};\n else\n validateObject(options, \"options\");\n let cwd = options.cwd;\n if (cwd != null)\n cwd = getValidatedPath(cwd, \"options.cwd\");\n if (options.shell != null && typeof options.shell !== \"boolean\" && typeof options.shell !== \"string\")\n throw new ERR_INVALID_ARG_TYPE(\"options.shell\", [\"boolean\", \"string\"], options.shell);\n if (options.argv0 != null)\n validateString(options.argv0, \"options.argv0\"), validateArgumentNullCheck(options.argv0, \"options.argv0\");\n if (options.shell) {\n validateArgumentNullCheck(options.shell, \"options.shell\");\n const command = ArrayPrototypeJoin.call([file, ...args], \" \");\n if (typeof options.shell === \"string\")\n file = options.shell;\n else\n file = \"sh\";\n args = [\"-c\", command];\n }\n if (typeof options.argv0 === \"string\")\n ArrayPrototypeUnshift.call(args, options.argv0);\n else\n ArrayPrototypeUnshift.call(args, file);\n const envPairs = options.env || process.env;\n return { ...options, file, args, cwd, envPairs };\n}, checkExecSyncError = function(ret, args, cmd) {\n let err;\n if (ret.error)\n err = ret.error, ObjectAssign(err, ret);\n else if (ret.status !== 0) {\n let msg = \"Command failed: \";\n if (msg += cmd || ArrayPrototypeJoin.call(args, \" \"), ret.stderr && ret.stderr.length > 0)\n msg += `\\n${ret.stderr.toString()}`;\n err = genericNodeError(msg, ret);\n }\n return err;\n}, nodeToBun = function(item) {\n if (typeof item === \"number\")\n return item;\n else {\n const result = nodeToBunLookup[item];\n if (result === void 0)\n throw new Error(\"Invalid stdio option\");\n return result;\n }\n}, fdToStdioName = function(fd) {\n switch (fd) {\n case 0:\n return \"stdin\";\n case 1:\n return \"stdout\";\n case 2:\n return \"stderr\";\n default:\n return null;\n }\n}, getBunStdioFromOptions = function(stdio) {\n return normalizeStdio(stdio).map((item) => nodeToBun(item));\n}, normalizeStdio = function(stdio) {\n if (typeof stdio === \"string\")\n switch (stdio) {\n case \"ignore\":\n return [\"ignore\", \"ignore\", \"ignore\"];\n case \"pipe\":\n return [\"pipe\", \"pipe\", \"pipe\"];\n case \"inherit\":\n return [\"inherit\", \"inherit\", \"inherit\"];\n default:\n throw new ERR_INVALID_OPT_VALUE(\"stdio\", stdio);\n }\n else if (ArrayIsArray(stdio)) {\n let processedStdio;\n if (stdio.length === 0)\n processedStdio = [\"pipe\", \"pipe\", \"pipe\"];\n else if (stdio.length === 1)\n processedStdio = [stdio[0], \"pipe\", \"pipe\"];\n else if (stdio.length === 2)\n processedStdio = [stdio[0], stdio[1], \"pipe\"];\n else if (stdio.length >= 3)\n processedStdio = [stdio[0], stdio[1], stdio[2]];\n return processedStdio.map((item) => !item \? \"pipe\" : item);\n } else\n throw new ERR_INVALID_OPT_VALUE(\"stdio\", stdio);\n}, flushStdio = function(subprocess) {\n const stdio = subprocess.stdio;\n if (stdio == null)\n return;\n for (let i = 0;i < stdio.length; i++) {\n const stream = stdio[i];\n if (!stream || !stream.readable)\n continue;\n stream.resume();\n }\n}, onSpawnNT = function(self) {\n self.emit(\"spawn\");\n}, abortChildProcess = function(child, killSignal2, reason) {\n if (!child)\n return;\n try {\n if (child.kill(killSignal2))\n child.emit(\"error\", new AbortError(void 0, { cause: reason }));\n } catch (err) {\n child.emit(\"error\", err);\n }\n}, validateMaxBuffer = function(maxBuffer) {\n if (maxBuffer != null && !(typeof maxBuffer === \"number\" && maxBuffer >= 0))\n throw new ERR_OUT_OF_RANGE(\"options.maxBuffer\", \"a positive number\", maxBuffer);\n}, validateArgumentNullCheck = function(arg, propName) {\n if (typeof arg === \"string\" && StringPrototypeIncludes.call(arg, \"\\0\"))\n throw new ERR_INVALID_ARG_VALUE(propName, arg, \"must be a string without null bytes\");\n}, validateArgumentsNullCheck = function(args, propName) {\n for (let i = 0;i < args.length; ++i)\n validateArgumentNullCheck(args[i], `${propName}[${i}]`);\n}, validateTimeout = function(timeout) {\n if (timeout != null && !(NumberIsInteger(timeout) && timeout >= 0))\n throw new ERR_OUT_OF_RANGE(\"timeout\", \"an unsigned integer\", timeout);\n};\nvar validateFunction = function(value, name) {\n if (typeof value !== \"function\")\n throw new ERR_INVALID_ARG_TYPE(name, \"Function\", value);\n}, validateString = function(value, name) {\n if (typeof value !== \"string\")\n throw new ERR_INVALID_ARG_TYPE(name, \"string\", value);\n}, nullCheck = function(path, propName, throwError = !0) {\n const pathIsString = typeof path === \"string\", pathIsUint8Array = isUint8Array(path);\n if (!pathIsString && !pathIsUint8Array || pathIsString && !StringPrototypeIncludes.call(path, \"\\0\") || pathIsUint8Array && !Uint8ArrayPrototypeIncludes.call(path, 0))\n return;\n const err = new ERR_INVALID_ARG_VALUE(propName, path, \"must be a string or Uint8Array without null bytes\");\n if (throwError)\n throw err;\n return err;\n}, validatePath = function(path, propName = \"path\") {\n if (typeof path !== \"string\" && !isUint8Array(path))\n throw new ERR_INVALID_ARG_TYPE(propName, [\"string\", \"Buffer\", \"URL\"], path);\n const err = nullCheck(path, propName, !1);\n if (err !== void 0)\n throw err;\n}, getValidatedPath = function(fileURLOrPath, propName = \"path\") {\n const path = toPathIfFileURL(fileURLOrPath);\n return validatePath(path, propName), path;\n}, isUint8Array = function(value) {\n return typeof value === \"object\" && value !== null && value instanceof Uint8Array;\n}, isURLInstance = function(fileURLOrPath) {\n return fileURLOrPath != null && fileURLOrPath.href && fileURLOrPath.origin;\n}, toPathIfFileURL = function(fileURLOrPath) {\n if (!isURLInstance(fileURLOrPath))\n return fileURLOrPath;\n return Bun.fileURLToPath(fileURLOrPath);\n}, genericNodeError = function(message, options) {\n const err = new Error(message);\n return err.code = options.code, err.killed = options.killed, err.signal = options.signal, err;\n}, ERR_OUT_OF_RANGE = function(str, range, input, replaceDefaultBoolean = !1) {\n return new RangeError(`The value of ${str} is out of range. It must be ${range}. Received ${input}`);\n}, ERR_CHILD_PROCESS_STDIO_MAXBUFFER = function(stdio) {\n return Error(`${stdio} maxBuffer length exceeded`);\n}, ERR_UNKNOWN_SIGNAL = function(name) {\n const err = @makeTypeError(`Unknown signal: ${name}`);\n return err.code = \"ERR_UNKNOWN_SIGNAL\", err;\n}, ERR_INVALID_ARG_TYPE = function(name, type, value) {\n const err = @makeTypeError(`The \"${name}\" argument must be of type ${type}. Received ${value\?.toString()}`);\n return err.code = \"ERR_INVALID_ARG_TYPE\", err;\n}, ERR_INVALID_OPT_VALUE = function(name, value) {\n return @makeTypeError(`The value \"${value}\" is invalid for option \"${name}\"`);\n}, ERR_INVALID_ARG_VALUE = function(name, value, reason) {\n return new Error(`The value \"${value}\" is invalid for argument '${name}'. Reason: ${reason}`);\n}, ERR_CHILD_PROCESS_IPC_REQUIRED = function(name) {\n const err = @makeTypeError(`Forked processes must have an IPC channel, missing value 'ipc' in ${name}`);\n return err.code = \"ERR_CHILD_PROCESS_IPC_REQUIRED\", err;\n}, $, EventEmitter = @getInternalField(@internalModuleRegistry, 16) || @createInternalModuleById(16), StreamModule = @getInternalField(@internalModuleRegistry, 35) || @createInternalModuleById(35), {\n constants: { signals }\n} = @getInternalField(@internalModuleRegistry, 24) || @createInternalModuleById(24), { promisify } = @getInternalField(@internalModuleRegistry, 44) || @createInternalModuleById(44), ObjectCreate = Object.create, ObjectAssign = Object.assign, ObjectDefineProperty = Object.defineProperty, BufferConcat = Buffer.concat, BufferIsEncoding = Buffer.isEncoding, kEmptyObject = ObjectCreate(null), ArrayPrototypePush = Array.prototype.push, ArrayPrototypeJoin = Array.prototype.join, ArrayPrototypeMap = Array.prototype.map, ArrayPrototypeIncludes = Array.prototype.includes, ArrayPrototypeSlice = Array.prototype.slice, ArrayPrototypeUnshift = Array.prototype.unshift, ArrayPrototypeLastIndexOf = Array.prototype.lastIndexOf, ArrayPrototypeSplice = Array.prototype.splice, ArrayIsArray = Array.isArray, ArrayBufferIsView = ArrayBuffer.isView, NumberIsInteger = Number.isInteger;\nvar StringPrototypeToUpperCase = String.prototype.toUpperCase, StringPrototypeIncludes = String.prototype.includes, StringPrototypeSlice = String.prototype.slice, Uint8ArrayPrototypeIncludes = Uint8Array.prototype.includes, MAX_BUFFER = 1048576, NativeWritable, ReadableFromWeb, customPromiseExecFunction = (orig) => {\n return (...args) => {\n let resolve, reject;\n const promise = new Promise((res, rej) => {\n resolve = res, reject = rej;\n });\n return promise.child = orig(...args, (err, stdout, stderr) => {\n if (err !== null)\n err.stdout = stdout, err.stderr = stderr, reject(err);\n else\n resolve({ stdout, stderr });\n }), promise;\n };\n};\nObjectDefineProperty(exec, promisify.custom, {\n __proto__: null,\n enumerable: !1,\n value: customPromiseExecFunction(exec)\n});\nvar signalsToNamesMapping;\n\nclass ChildProcess extends EventEmitter {\n constructor() {\n super(...arguments);\n }\n #handle;\n #exited = !1;\n #closesNeeded = 1;\n #closesGot = 0;\n connected = !1;\n signalCode = null;\n exitCode = null;\n spawnfile;\n spawnargs;\n pid;\n channel;\n get killed() {\n if (this.#handle == null)\n return !1;\n }\n #handleOnExit(exitCode, signalCode, err) {\n if (this.#exited)\n return;\n if (signalCode)\n this.signalCode = signalCode;\n else\n this.exitCode = exitCode;\n if (this.#stdin)\n this.#stdin.destroy();\n if (this.#handle)\n this.#handle = null;\n if (exitCode < 0) {\n const err2 = new SystemError(`Spawned process exited with error code: ${exitCode}`, void 0, \"spawn\", \"EUNKNOWN\", \"ERR_CHILD_PROCESS_UNKNOWN_ERROR\");\n if (this.spawnfile)\n err2.path = this.spawnfile;\n err2.spawnargs = ArrayPrototypeSlice.call(this.spawnargs, 1), this.emit(\"error\", err2);\n } else\n this.emit(\"exit\", this.exitCode, this.signalCode);\n process.nextTick(flushStdio, this), this.#maybeClose(), this.#exited = !0, this.#stdioOptions = [\"destroyed\", \"destroyed\", \"destroyed\"];\n }\n #getBunSpawnIo(i, encoding) {\n NativeWritable ||= StreamModule.NativeWritable, ReadableFromWeb ||= StreamModule.Readable.fromWeb;\n const io = this.#stdioOptions[i];\n switch (i) {\n case 0:\n switch (io) {\n case \"pipe\":\n return new NativeWritable(this.#handle.stdin);\n case \"inherit\":\n return process.stdin || null;\n case \"destroyed\":\n return new ShimmedStdin;\n default:\n return null;\n }\n case 2:\n case 1:\n switch (io) {\n case \"pipe\":\n return ReadableFromWeb(this.#handle[fdToStdioName(i)], { encoding });\n case \"inherit\":\n return process[fdToStdioName(i)] || null;\n case \"destroyed\":\n return new ShimmedStdioOutStream;\n default:\n return null;\n }\n }\n }\n #stdin;\n #stdout;\n #stderr;\n #stdioObject;\n #encoding;\n #stdioOptions;\n #createStdioObject() {\n return Object.create(null, {\n 0: {\n get: () => this.stdin\n },\n 1: {\n get: () => this.stdout\n },\n 2: {\n get: () => this.stderr\n }\n });\n }\n get stdin() {\n return this.#stdin \?\?= this.#getBunSpawnIo(0, this.#encoding);\n }\n get stdout() {\n return this.#stdout \?\?= this.#getBunSpawnIo(1, this.#encoding);\n }\n get stderr() {\n return this.#stderr \?\?= this.#getBunSpawnIo(2, this.#encoding);\n }\n get stdio() {\n return this.#stdioObject \?\?= this.#createStdioObject();\n }\n spawn(options) {\n validateObject(options, \"options\"), validateString(options.file, \"options.file\");\n var file = this.spawnfile = options.file, spawnargs;\n if (options.args == null)\n spawnargs = this.spawnargs = [];\n else\n validateArray(options.args, \"options.args\"), spawnargs = this.spawnargs = options.args;\n const stdio = options.stdio || [\"pipe\", \"pipe\", \"pipe\"], bunStdio = getBunStdioFromOptions(stdio);\n var env = options.envPairs || void 0;\n this.#encoding = options.encoding || void 0, this.#stdioOptions = bunStdio, this.#handle = Bun.spawn({\n cmd: spawnargs,\n stdin: bunStdio[0],\n stdout: bunStdio[1],\n stderr: bunStdio[2],\n cwd: options.cwd || void 0,\n env: env || process.env,\n onExit: (handle, exitCode, signalCode, err) => {\n this.#handle = handle, this.pid = this.#handle.pid, process.nextTick((exitCode2, signalCode2, err2) => this.#handleOnExit(exitCode2, signalCode2, err2), exitCode, signalCode, err);\n },\n lazy: !0\n }), this.pid = this.#handle.pid, onSpawnNT(this);\n }\n send() {\n console.log(\"ChildProcess.prototype.send() - Sorry! Not implemented yet\");\n }\n disconnect() {\n console.log(\"ChildProcess.prototype.disconnect() - Sorry! Not implemented yet\");\n }\n kill(sig) {\n const signal = sig === 0 \? sig : convertToValidSignal(sig === void 0 \? \"SIGTERM\" : sig);\n if (this.#handle)\n this.#handle.kill(signal);\n return this.#maybeClose(), !0;\n }\n #maybeClose() {\n if (this.#closesGot++, this.#closesGot === this.#closesNeeded)\n this.emit(\"close\", this.exitCode, this.signalCode);\n }\n ref() {\n if (this.#handle)\n this.#handle.ref();\n }\n unref() {\n if (this.#handle)\n this.#handle.unref();\n }\n}\nvar nodeToBunLookup = {\n ignore: null,\n pipe: \"pipe\",\n overlapped: \"pipe\",\n inherit: \"inherit\"\n};\n\nclass ShimmedStdin extends EventEmitter {\n constructor() {\n super();\n }\n write() {\n return !1;\n }\n destroy() {\n }\n end() {\n }\n pipe() {\n }\n}\n\nclass ShimmedStdioOutStream extends EventEmitter {\n constructor() {\n super(...arguments);\n }\n pipe() {\n }\n}\nvar validateAbortSignal = (signal, name) => {\n if (signal !== void 0 && (signal === null || typeof signal !== \"object\" || !(\"aborted\" in signal)))\n throw new ERR_INVALID_ARG_TYPE(name, \"AbortSignal\", signal);\n};\nvar validateObject = (value, name, options = null) => {\n const allowArray = options\?.allowArray \?\? !1, allowFunction = options\?.allowFunction \?\? !1;\n if (!(options\?.nullable \?\? !1) && value === null || !allowArray && ArrayIsArray.call(value) || typeof value !== \"object\" && (!allowFunction || typeof value !== \"function\"))\n throw new ERR_INVALID_ARG_TYPE(name, \"object\", value);\n}, validateArray = (value, name, minLength = 0) => {\n if (!ArrayIsArray(value))\n throw new ERR_INVALID_ARG_TYPE(name, \"Array\", value);\n if (value.length < minLength) {\n const reason = `must be longer than ${minLength}`;\n throw new ERR_INVALID_ARG_VALUE(name, value, reason);\n }\n}, Error = globalThis.Error, TypeError = globalThis.TypeError, RangeError = globalThis.RangeError;\n\nclass AbortError extends Error {\n code = \"ABORT_ERR\";\n name = \"AbortError\";\n constructor(message = \"The operation was aborted\", options = void 0) {\n if (options !== void 0 && typeof options !== \"object\")\n throw new ERR_INVALID_ARG_TYPE(\"options\", \"Object\", options);\n super(message, options);\n }\n}\n\nclass SystemError extends Error {\n path;\n syscall;\n errno;\n code;\n constructor(message, path, syscall, errno, code) {\n super(message);\n this.path = path, this.syscall = syscall, this.errno = errno, this.code = code;\n }\n get name() {\n return \"SystemError\";\n }\n}\n$ = {\n ChildProcess,\n spawn,\n execFile,\n exec,\n fork,\n spawnSync,\n execFileSync,\n execSync\n};\nreturn $})\n"_s;
+static constexpr ASCIILiteral NodeChildProcessCode = "(function (){\"use strict\";// src/js/out/tmp/node/child_process.ts\nvar spawn = function(file, args, options) {\n options = normalizeSpawnArguments(file, args, options), validateTimeout(options.timeout), validateAbortSignal(options.signal, \"options.signal\");\n const killSignal2 = sanitizeKillSignal(options.killSignal), child = new ChildProcess;\n if (child.spawn(options), options.timeout > 0) {\n let timeoutId = setTimeout(() => {\n if (timeoutId) {\n try {\n child.kill(killSignal2);\n } catch (err) {\n child.emit(\"error\", err);\n }\n timeoutId = null;\n }\n });\n child.once(\"exit\", () => {\n if (timeoutId)\n clearTimeout(timeoutId), timeoutId = null;\n });\n }\n if (options.signal) {\n let onAbortListener2 = function() {\n abortChildProcess(child, killSignal2, options.signal.reason);\n };\n var onAbortListener = onAbortListener2;\n const signal = options.signal;\n if (signal.aborted)\n process.nextTick(onAbortListener2);\n else\n signal.addEventListener(\"abort\", onAbortListener2, { once: !0 }), child.once(\"exit\", () => signal.removeEventListener(\"abort\", onAbortListener2));\n }\n return child;\n}, execFile = function(file, args, options, callback) {\n ({ file, args, options, callback } = normalizeExecFileArgs(file, args, options, callback)), options = {\n encoding: \"utf8\",\n timeout: 0,\n maxBuffer: MAX_BUFFER,\n killSignal: \"SIGTERM\",\n cwd: null,\n env: null,\n shell: !1,\n ...options\n };\n const maxBuffer = options.maxBuffer;\n validateTimeout(options.timeout), validateMaxBuffer(maxBuffer), options.killSignal = sanitizeKillSignal(options.killSignal);\n const child = spawn(file, args, {\n cwd: options.cwd,\n env: options.env,\n shell: options.shell,\n signal: options.signal\n });\n let encoding;\n const _stdout = [], _stderr = [];\n if (options.encoding !== \"buffer\" && BufferIsEncoding(options.encoding))\n encoding = options.encoding;\n else\n encoding = null;\n let stdoutLen = 0, stderrLen = 0, killed = !1, exited = !1, timeoutId, encodedStdoutLen, encodedStderrLen, ex = null, cmd = file;\n function exitHandler(code, signal) {\n if (exited)\n return;\n if (exited = !0, timeoutId)\n clearTimeout(timeoutId), timeoutId = null;\n if (!callback)\n return;\n const readableEncoding = child\?.stdout\?.readableEncoding;\n let stdout, stderr;\n if (encoding || child.stdout && readableEncoding)\n stdout = ArrayPrototypeJoin.call(_stdout, \"\");\n else\n stdout = BufferConcat(_stdout);\n if (encoding || child.stderr && readableEncoding)\n stderr = ArrayPrototypeJoin.call(_stderr, \"\");\n else\n stderr = BufferConcat(_stderr);\n if (!ex && code === 0 && signal === null) {\n callback(null, stdout, stderr);\n return;\n }\n if (args\?.length)\n cmd += ` ${ArrayPrototypeJoin.call(args, \" \")}`;\n if (!ex) {\n let message = `Command failed: ${cmd}`;\n if (stderr)\n message += `\\n${stderr}`;\n ex = genericNodeError(message, {\n code,\n killed: child.killed || killed,\n signal\n });\n }\n ex.cmd = cmd, callback(ex, stdout, stderr);\n }\n function errorHandler(e) {\n if (ex = e, child.stdout)\n child.stdout.destroy();\n if (child.stderr)\n child.stderr.destroy();\n exitHandler();\n }\n function kill() {\n if (child.stdout)\n child.stdout.destroy();\n if (child.stderr)\n child.stderr.destroy();\n killed = !0;\n try {\n child.kill(options.killSignal);\n } catch (e) {\n ex = e, exitHandler();\n }\n }\n if (options.timeout > 0)\n timeoutId = setTimeout(function delayedKill() {\n kill(), timeoutId = null;\n }, options.timeout);\n if (child.stdout) {\n if (encoding)\n child.stdout.setEncoding(encoding);\n child.stdout.on(\"data\", maxBuffer === Infinity \? function onUnlimitedSizeBufferedData(chunk) {\n ArrayPrototypePush.call(_stdout, chunk);\n } : encoding \? function onChildStdoutEncoded(chunk) {\n if (stdoutLen += chunk.length, stdoutLen * 4 > maxBuffer) {\n const encoding2 = child.stdout.readableEncoding, actualLen = Buffer.byteLength(chunk, encoding2);\n if (encodedStdoutLen === void 0)\n for (let i = 0;i < _stdout.length; i++)\n encodedStdoutLen += Buffer.byteLength(_stdout[i], encoding2);\n else\n encodedStdoutLen += actualLen;\n const truncatedLen = maxBuffer - (encodedStdoutLen - actualLen);\n ArrayPrototypePush.call(_stdout, StringPrototypeSlice.apply(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stdout\"), kill();\n } else\n ArrayPrototypePush.call(_stdout, chunk);\n } : function onChildStdoutRaw(chunk) {\n if (stdoutLen += chunk.length, stdoutLen > maxBuffer) {\n const truncatedLen = maxBuffer - (stdoutLen - chunk.length);\n ArrayPrototypePush.call(_stdout, chunk.slice(0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stdout\"), kill();\n } else\n ArrayPrototypePush.call(_stdout, chunk);\n });\n }\n if (child.stderr) {\n if (encoding)\n child.stderr.setEncoding(encoding);\n child.stderr.on(\"data\", maxBuffer === Infinity \? function onUnlimitedSizeBufferedData(chunk) {\n ArrayPrototypePush.call(_stderr, chunk);\n } : encoding \? function onChildStderrEncoded(chunk) {\n if (stderrLen += chunk.length, stderrLen * 4 > maxBuffer) {\n const encoding2 = child.stderr.readableEncoding, actualLen = Buffer.byteLength(chunk, encoding2);\n if (encodedStderrLen === void 0)\n for (let i = 0;i < _stderr.length; i++)\n encodedStderrLen += Buffer.byteLength(_stderr[i], encoding2);\n else\n encodedStderrLen += actualLen;\n const truncatedLen = maxBuffer - (encodedStderrLen - actualLen);\n ArrayPrototypePush.call(_stderr, StringPrototypeSlice.call(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stderr\"), kill();\n } else\n ArrayPrototypePush.call(_stderr, chunk);\n } : function onChildStderrRaw(chunk) {\n if (stderrLen += chunk.length, stderrLen > maxBuffer) {\n const truncatedLen = maxBuffer - (stderrLen - chunk.length);\n ArrayPrototypePush.call(_stderr, StringPrototypeSlice.call(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stderr\"), kill();\n } else\n ArrayPrototypePush.call(_stderr, chunk);\n });\n }\n return child.addListener(\"close\", exitHandler), child.addListener(\"error\", errorHandler), child;\n}, exec = function(command, options, callback) {\n const opts = normalizeExecArgs(command, options, callback);\n return execFile(opts.file, opts.options, opts.callback);\n}, spawnSync = function(file, args, options) {\n options = {\n maxBuffer: MAX_BUFFER,\n ...normalizeSpawnArguments(file, args, options)\n };\n const { maxBuffer, encoding } = options;\n validateTimeout(options.timeout), validateMaxBuffer(maxBuffer), options.killSignal = sanitizeKillSignal(options.killSignal);\n const stdio = options.stdio || \"pipe\", bunStdio = getBunStdioFromOptions(stdio);\n var { input } = options;\n if (input)\n if (ArrayBufferIsView(input))\n bunStdio[0] = input;\n else if (typeof input === \"string\")\n bunStdio[0] = Buffer.from(input, encoding || \"utf8\");\n else\n throw new ERR_INVALID_ARG_TYPE(\"options.stdio[0]\", [\"Buffer\", \"TypedArray\", \"DataView\", \"string\"], input);\n const { stdout, stderr, success, exitCode } = Bun.spawnSync({\n cmd: options.args,\n env: options.env || void 0,\n cwd: options.cwd || void 0,\n stdin: bunStdio[0],\n stdout: bunStdio[1],\n stderr: bunStdio[2]\n }), result = {\n signal: null,\n status: exitCode,\n output: [null, stdout, stderr]\n };\n if (stdout && encoding && encoding !== \"buffer\")\n result.output[1] = result.output[1]\?.toString(encoding);\n if (stderr && encoding && encoding !== \"buffer\")\n result.output[2] = result.output[2]\?.toString(encoding);\n if (result.stdout = result.output[1], result.stderr = result.output[2], !success)\n result.error = new SystemError(result.output[2], options.file, \"spawnSync\", -1, result.status), result.error.spawnargs = ArrayPrototypeSlice.call(options.args, 1);\n return result;\n}, execFileSync = function(file, args, options) {\n ({ file, args, options } = normalizeExecFileArgs(file, args, options));\n const ret = spawnSync(file, args, options), errArgs = [options.argv0 || file];\n ArrayPrototypePush.apply(errArgs, args);\n const err = checkExecSyncError(ret, errArgs);\n if (err)\n throw err;\n return ret.stdout;\n}, execSync = function(command, options) {\n const opts = normalizeExecArgs(command, options, null), ret = spawnSync(opts.file, opts.options), err = checkExecSyncError(ret, void 0, command);\n if (err)\n throw err;\n return ret.stdout;\n}, stdioStringToArray = function(stdio, channel) {\n const options = [];\n switch (stdio) {\n case \"ignore\":\n case \"overlapped\":\n case \"pipe\":\n ArrayPrototypePush.call(options, stdio, stdio, stdio);\n break;\n case \"inherit\":\n ArrayPrototypePush.call(options, 0, 1, 2);\n break;\n default:\n throw new ERR_INVALID_ARG_VALUE(\"stdio\", stdio);\n }\n if (channel)\n ArrayPrototypePush.call(options, channel);\n return options;\n}, fork = function(modulePath, args = [], options) {\n modulePath = getValidatedPath(modulePath, \"modulePath\");\n let execArgv;\n if (args == null)\n args = [];\n else if (typeof args === \"object\" && !ArrayIsArray(args))\n options = args, args = [];\n else\n validateArray(args, \"args\");\n if (options != null)\n validateObject(options, \"options\");\n if (options = { __proto__: null, ...options, shell: !1 }, options.execPath = options.execPath || process.execPath, validateArgumentNullCheck(options.execPath, \"options.execPath\"), execArgv = options.execArgv || process.execArgv, validateArgumentsNullCheck(execArgv, \"options.execArgv\"), execArgv === process.execArgv && process._eval != null) {\n const index = ArrayPrototypeLastIndexOf.call(execArgv, process._eval);\n if (index > 0)\n execArgv = ArrayPrototypeSlice.call(execArgv), ArrayPrototypeSplice.call(execArgv, index - 1, 2);\n }\n if (args = [...execArgv, modulePath, ...args], typeof options.stdio === \"string\")\n options.stdio = stdioStringToArray(options.stdio, \"ipc\");\n else if (!ArrayIsArray(options.stdio))\n options.stdio = stdioStringToArray(options.silent \? \"pipe\" : \"inherit\", \"ipc\");\n else if (!ArrayPrototypeIncludes.call(options.stdio, \"ipc\"))\n throw new ERR_CHILD_PROCESS_IPC_REQUIRED(\"options.stdio\");\n return spawn(options.execPath, args, options);\n}, convertToValidSignal = function(signal) {\n if (typeof signal === \"number\" && getSignalsToNamesMapping()[signal])\n return signal;\n if (typeof signal === \"string\") {\n const signalName = signals[StringPrototypeToUpperCase.call(signal)];\n if (signalName)\n return signalName;\n }\n throw new ERR_UNKNOWN_SIGNAL(signal);\n}, sanitizeKillSignal = function(killSignal2) {\n if (typeof killSignal2 === \"string\" || typeof killSignal2 === \"number\")\n return convertToValidSignal(killSignal2);\n else if (killSignal2 != null)\n throw new ERR_INVALID_ARG_TYPE(\"options.killSignal\", [\"string\", \"number\"], killSignal2);\n}, getSignalsToNamesMapping = function() {\n if (signalsToNamesMapping !== void 0)\n return signalsToNamesMapping;\n signalsToNamesMapping = ObjectCreate(null);\n for (let key in signals)\n signalsToNamesMapping[signals[key]] = key;\n return signalsToNamesMapping;\n}, normalizeExecFileArgs = function(file, args, options, callback) {\n if (ArrayIsArray(args))\n args = ArrayPrototypeSlice.call(args);\n else if (args != null && typeof args === \"object\")\n callback = options, options = args, args = null;\n else if (typeof args === \"function\")\n callback = args, options = null, args = null;\n if (args == null)\n args = [];\n if (typeof options === \"function\")\n callback = options;\n else if (options != null)\n validateObject(options, \"options\");\n if (options == null)\n options = kEmptyObject;\n if (callback != null)\n validateFunction(callback, \"callback\");\n if (options.argv0 != null)\n validateString(options.argv0, \"options.argv0\"), validateArgumentNullCheck(options.argv0, \"options.argv0\");\n return { file, args, options, callback };\n}, normalizeExecArgs = function(command, options, callback) {\n if (validateString(command, \"command\"), validateArgumentNullCheck(command, \"command\"), typeof options === \"function\")\n callback = options, options = void 0;\n return options = { ...options }, options.shell = typeof options.shell === \"string\" \? options.shell : !0, {\n file: command,\n options,\n callback\n };\n}, normalizeSpawnArguments = function(file, args, options) {\n if (validateString(file, \"file\"), validateArgumentNullCheck(file, \"file\"), file.length === 0)\n throw new ERR_INVALID_ARG_VALUE(\"file\", file, \"cannot be empty\");\n if (ArrayIsArray(args))\n args = ArrayPrototypeSlice.call(args);\n else if (args == null)\n args = [];\n else if (typeof args !== \"object\")\n throw new ERR_INVALID_ARG_TYPE(\"args\", \"object\", args);\n else\n options = args, args = [];\n if (validateArgumentsNullCheck(args, \"args\"), options === void 0)\n options = {};\n else\n validateObject(options, \"options\");\n let cwd = options.cwd;\n if (cwd != null)\n cwd = getValidatedPath(cwd, \"options.cwd\");\n var detached = !1;\n const { detached: detachedOption } = options;\n if (detachedOption != null)\n detached = !!detachedOption;\n if (options.shell != null && typeof options.shell !== \"boolean\" && typeof options.shell !== \"string\")\n throw new ERR_INVALID_ARG_TYPE(\"options.shell\", [\"boolean\", \"string\"], options.shell);\n if (options.argv0 != null)\n validateString(options.argv0, \"options.argv0\"), validateArgumentNullCheck(options.argv0, \"options.argv0\");\n if (options.shell) {\n validateArgumentNullCheck(options.shell, \"options.shell\");\n const command = ArrayPrototypeJoin.call([file, ...args], \" \");\n if (typeof options.shell === \"string\")\n file = options.shell;\n else\n file = \"sh\";\n args = [\"-c\", command];\n }\n if (typeof options.argv0 === \"string\")\n ArrayPrototypeUnshift.call(args, options.argv0);\n else\n ArrayPrototypeUnshift.call(args, file);\n const envPairs = options.env || process.env;\n return { ...options, detached, file, args, cwd, envPairs };\n}, checkExecSyncError = function(ret, args, cmd) {\n let err;\n if (ret.error)\n err = ret.error, ObjectAssign(err, ret);\n else if (ret.status !== 0) {\n let msg = \"Command failed: \";\n if (msg += cmd || ArrayPrototypeJoin.call(args, \" \"), ret.stderr && ret.stderr.length > 0)\n msg += `\\n${ret.stderr.toString()}`;\n err = genericNodeError(msg, ret);\n }\n return err;\n}, nodeToBun = function(item) {\n if (typeof item === \"number\")\n return item;\n else {\n const result = nodeToBunLookup[item];\n if (result === void 0)\n throw new Error(\"Invalid stdio option\");\n return result;\n }\n}, fdToStdioName = function(fd) {\n switch (fd) {\n case 0:\n return \"stdin\";\n case 1:\n return \"stdout\";\n case 2:\n return \"stderr\";\n default:\n return null;\n }\n}, getBunStdioFromOptions = function(stdio) {\n return normalizeStdio(stdio).map((item) => nodeToBun(item));\n}, normalizeStdio = function(stdio) {\n if (typeof stdio === \"string\")\n switch (stdio) {\n case \"ignore\":\n return [\"ignore\", \"ignore\", \"ignore\"];\n case \"pipe\":\n return [\"pipe\", \"pipe\", \"pipe\"];\n case \"inherit\":\n return [\"inherit\", \"inherit\", \"inherit\"];\n default:\n throw new ERR_INVALID_OPT_VALUE(\"stdio\", stdio);\n }\n else if (ArrayIsArray(stdio)) {\n let processedStdio;\n if (stdio.length === 0)\n processedStdio = [\"pipe\", \"pipe\", \"pipe\"];\n else if (stdio.length === 1)\n processedStdio = [stdio[0], \"pipe\", \"pipe\"];\n else if (stdio.length === 2)\n processedStdio = [stdio[0], stdio[1], \"pipe\"];\n else if (stdio.length >= 3)\n processedStdio = [stdio[0], stdio[1], stdio[2]];\n return processedStdio.map((item) => !item \? \"pipe\" : item);\n } else\n throw new ERR_INVALID_OPT_VALUE(\"stdio\", stdio);\n}, flushStdio = function(subprocess) {\n const stdio = subprocess.stdio;\n if (stdio == null)\n return;\n for (let i = 0;i < stdio.length; i++) {\n const stream = stdio[i];\n if (!stream || !stream.readable)\n continue;\n stream.resume();\n }\n}, onSpawnNT = function(self) {\n self.emit(\"spawn\");\n}, abortChildProcess = function(child, killSignal2, reason) {\n if (!child)\n return;\n try {\n if (child.kill(killSignal2))\n child.emit(\"error\", new AbortError(void 0, { cause: reason }));\n } catch (err) {\n child.emit(\"error\", err);\n }\n}, validateMaxBuffer = function(maxBuffer) {\n if (maxBuffer != null && !(typeof maxBuffer === \"number\" && maxBuffer >= 0))\n throw new ERR_OUT_OF_RANGE(\"options.maxBuffer\", \"a positive number\", maxBuffer);\n}, validateArgumentNullCheck = function(arg, propName) {\n if (typeof arg === \"string\" && StringPrototypeIncludes.call(arg, \"\\0\"))\n throw new ERR_INVALID_ARG_VALUE(propName, arg, \"must be a string without null bytes\");\n}, validateArgumentsNullCheck = function(args, propName) {\n for (let i = 0;i < args.length; ++i)\n validateArgumentNullCheck(args[i], `${propName}[${i}]`);\n}, validateTimeout = function(timeout) {\n if (timeout != null && !(NumberIsInteger(timeout) && timeout >= 0))\n throw new ERR_OUT_OF_RANGE(\"timeout\", \"an unsigned integer\", timeout);\n};\nvar validateFunction = function(value, name) {\n if (typeof value !== \"function\")\n throw new ERR_INVALID_ARG_TYPE(name, \"Function\", value);\n}, validateString = function(value, name) {\n if (typeof value !== \"string\")\n throw new ERR_INVALID_ARG_TYPE(name, \"string\", value);\n}, nullCheck = function(path, propName, throwError = !0) {\n const pathIsString = typeof path === \"string\", pathIsUint8Array = isUint8Array(path);\n if (!pathIsString && !pathIsUint8Array || pathIsString && !StringPrototypeIncludes.call(path, \"\\0\") || pathIsUint8Array && !Uint8ArrayPrototypeIncludes.call(path, 0))\n return;\n const err = new ERR_INVALID_ARG_VALUE(propName, path, \"must be a string or Uint8Array without null bytes\");\n if (throwError)\n throw err;\n return err;\n}, validatePath = function(path, propName = \"path\") {\n if (typeof path !== \"string\" && !isUint8Array(path))\n throw new ERR_INVALID_ARG_TYPE(propName, [\"string\", \"Buffer\", \"URL\"], path);\n const err = nullCheck(path, propName, !1);\n if (err !== void 0)\n throw err;\n}, getValidatedPath = function(fileURLOrPath, propName = \"path\") {\n const path = toPathIfFileURL(fileURLOrPath);\n return validatePath(path, propName), path;\n}, isUint8Array = function(value) {\n return typeof value === \"object\" && value !== null && value instanceof Uint8Array;\n}, isURLInstance = function(fileURLOrPath) {\n return fileURLOrPath != null && fileURLOrPath.href && fileURLOrPath.origin;\n}, toPathIfFileURL = function(fileURLOrPath) {\n if (!isURLInstance(fileURLOrPath))\n return fileURLOrPath;\n return Bun.fileURLToPath(fileURLOrPath);\n}, genericNodeError = function(message, options) {\n const err = new Error(message);\n return err.code = options.code, err.killed = options.killed, err.signal = options.signal, err;\n}, ERR_OUT_OF_RANGE = function(str, range, input, replaceDefaultBoolean = !1) {\n return new RangeError(`The value of ${str} is out of range. It must be ${range}. Received ${input}`);\n}, ERR_CHILD_PROCESS_STDIO_MAXBUFFER = function(stdio) {\n return Error(`${stdio} maxBuffer length exceeded`);\n}, ERR_UNKNOWN_SIGNAL = function(name) {\n const err = @makeTypeError(`Unknown signal: ${name}`);\n return err.code = \"ERR_UNKNOWN_SIGNAL\", err;\n}, ERR_INVALID_ARG_TYPE = function(name, type, value) {\n const err = @makeTypeError(`The \"${name}\" argument must be of type ${type}. Received ${value\?.toString()}`);\n return err.code = \"ERR_INVALID_ARG_TYPE\", err;\n}, ERR_INVALID_OPT_VALUE = function(name, value) {\n return @makeTypeError(`The value \"${value}\" is invalid for option \"${name}\"`);\n}, ERR_INVALID_ARG_VALUE = function(name, value, reason) {\n return new Error(`The value \"${value}\" is invalid for argument '${name}'. Reason: ${reason}`);\n}, ERR_CHILD_PROCESS_IPC_REQUIRED = function(name) {\n const err = @makeTypeError(`Forked processes must have an IPC channel, missing value 'ipc' in ${name}`);\n return err.code = \"ERR_CHILD_PROCESS_IPC_REQUIRED\", err;\n}, $, EventEmitter = @getInternalField(@internalModuleRegistry, 16) || @createInternalModuleById(16), StreamModule = @getInternalField(@internalModuleRegistry, 35) || @createInternalModuleById(35), {\n constants: { signals }\n} = @getInternalField(@internalModuleRegistry, 24) || @createInternalModuleById(24), { promisify } = @getInternalField(@internalModuleRegistry, 44) || @createInternalModuleById(44), ObjectCreate = Object.create, ObjectAssign = Object.assign, ObjectDefineProperty = Object.defineProperty, BufferConcat = Buffer.concat, BufferIsEncoding = Buffer.isEncoding, kEmptyObject = ObjectCreate(null), ArrayPrototypePush = Array.prototype.push, ArrayPrototypeJoin = Array.prototype.join, ArrayPrototypeMap = Array.prototype.map, ArrayPrototypeIncludes = Array.prototype.includes, ArrayPrototypeSlice = Array.prototype.slice, ArrayPrototypeUnshift = Array.prototype.unshift, ArrayPrototypeLastIndexOf = Array.prototype.lastIndexOf, ArrayPrototypeSplice = Array.prototype.splice, ArrayIsArray = Array.isArray, ArrayBufferIsView = ArrayBuffer.isView, NumberIsInteger = Number.isInteger;\nvar StringPrototypeToUpperCase = String.prototype.toUpperCase, StringPrototypeIncludes = String.prototype.includes, StringPrototypeSlice = String.prototype.slice, Uint8ArrayPrototypeIncludes = Uint8Array.prototype.includes, MAX_BUFFER = 1048576, NativeWritable, ReadableFromWeb, customPromiseExecFunction = (orig) => {\n return (...args) => {\n let resolve, reject;\n const promise = new Promise((res, rej) => {\n resolve = res, reject = rej;\n });\n return promise.child = orig(...args, (err, stdout, stderr) => {\n if (err !== null)\n err.stdout = stdout, err.stderr = stderr, reject(err);\n else\n resolve({ stdout, stderr });\n }), promise;\n };\n};\nObjectDefineProperty(exec, promisify.custom, {\n __proto__: null,\n enumerable: !1,\n value: customPromiseExecFunction(exec)\n});\nvar signalsToNamesMapping;\n\nclass ChildProcess extends EventEmitter {\n constructor() {\n super(...arguments);\n }\n #handle;\n #exited = !1;\n #closesNeeded = 1;\n #closesGot = 0;\n connected = !1;\n signalCode = null;\n exitCode = null;\n spawnfile;\n spawnargs;\n pid;\n channel;\n get killed() {\n if (this.#handle == null)\n return !1;\n }\n #handleOnExit(exitCode, signalCode, err) {\n if (this.#exited)\n return;\n if (signalCode)\n this.signalCode = signalCode;\n else\n this.exitCode = exitCode;\n if (this.#stdin)\n this.#stdin.destroy();\n if (this.#handle)\n this.#handle = null;\n if (exitCode < 0) {\n const err2 = new SystemError(`Spawned process exited with error code: ${exitCode}`, void 0, \"spawn\", \"EUNKNOWN\", \"ERR_CHILD_PROCESS_UNKNOWN_ERROR\");\n if (this.spawnfile)\n err2.path = this.spawnfile;\n err2.spawnargs = ArrayPrototypeSlice.call(this.spawnargs, 1), this.emit(\"error\", err2);\n } else\n this.emit(\"exit\", this.exitCode, this.signalCode);\n process.nextTick(flushStdio, this), this.#maybeClose(), this.#exited = !0, this.#stdioOptions = [\"destroyed\", \"destroyed\", \"destroyed\"];\n }\n #getBunSpawnIo(i, encoding) {\n NativeWritable ||= StreamModule.NativeWritable, ReadableFromWeb ||= StreamModule.Readable.fromWeb;\n const io = this.#stdioOptions[i];\n switch (i) {\n case 0:\n switch (io) {\n case \"pipe\":\n return new NativeWritable(this.#handle.stdin);\n case \"inherit\":\n return process.stdin || null;\n case \"destroyed\":\n return new ShimmedStdin;\n default:\n return null;\n }\n case 2:\n case 1:\n switch (io) {\n case \"pipe\":\n return ReadableFromWeb(this.#handle[fdToStdioName(i)], { encoding });\n case \"inherit\":\n return process[fdToStdioName(i)] || null;\n case \"destroyed\":\n return new ShimmedStdioOutStream;\n default:\n return null;\n }\n }\n }\n #stdin;\n #stdout;\n #stderr;\n #stdioObject;\n #encoding;\n #stdioOptions;\n #createStdioObject() {\n return Object.create(null, {\n 0: {\n get: () => this.stdin\n },\n 1: {\n get: () => this.stdout\n },\n 2: {\n get: () => this.stderr\n }\n });\n }\n get stdin() {\n return this.#stdin \?\?= this.#getBunSpawnIo(0, this.#encoding);\n }\n get stdout() {\n return this.#stdout \?\?= this.#getBunSpawnIo(1, this.#encoding);\n }\n get stderr() {\n return this.#stderr \?\?= this.#getBunSpawnIo(2, this.#encoding);\n }\n get stdio() {\n return this.#stdioObject \?\?= this.#createStdioObject();\n }\n spawn(options) {\n validateObject(options, \"options\"), validateString(options.file, \"options.file\");\n var file = this.spawnfile = options.file, spawnargs;\n if (options.args == null)\n spawnargs = this.spawnargs = [];\n else\n validateArray(options.args, \"options.args\"), spawnargs = this.spawnargs = options.args;\n const stdio = options.stdio || [\"pipe\", \"pipe\", \"pipe\"], bunStdio = getBunStdioFromOptions(stdio);\n var env = options.envPairs || void 0;\n const detachedOption = options.detached;\n this.#encoding = options.encoding || void 0, this.#stdioOptions = bunStdio, this.#handle = Bun.spawn({\n cmd: spawnargs,\n stdin: bunStdio[0],\n stdout: bunStdio[1],\n stderr: bunStdio[2],\n cwd: options.cwd || void 0,\n env: env || process.env,\n detached: typeof detachedOption !== \"undefined\" \? !!detachedOption : !1,\n onExit: (handle, exitCode, signalCode, err) => {\n this.#handle = handle, this.pid = this.#handle.pid, process.nextTick((exitCode2, signalCode2, err2) => this.#handleOnExit(exitCode2, signalCode2, err2), exitCode, signalCode, err);\n },\n lazy: !0\n }), this.pid = this.#handle.pid, onSpawnNT(this);\n }\n send() {\n console.log(\"ChildProcess.prototype.send() - Sorry! Not implemented yet\");\n }\n disconnect() {\n console.log(\"ChildProcess.prototype.disconnect() - Sorry! Not implemented yet\");\n }\n kill(sig) {\n const signal = sig === 0 \? sig : convertToValidSignal(sig === void 0 \? \"SIGTERM\" : sig);\n if (this.#handle)\n this.#handle.kill(signal);\n return this.#maybeClose(), !0;\n }\n #maybeClose() {\n if (this.#closesGot++, this.#closesGot === this.#closesNeeded)\n this.emit(\"close\", this.exitCode, this.signalCode);\n }\n ref() {\n if (this.#handle)\n this.#handle.ref();\n }\n unref() {\n if (this.#handle)\n this.#handle.unref();\n }\n}\nvar nodeToBunLookup = {\n ignore: null,\n pipe: \"pipe\",\n overlapped: \"pipe\",\n inherit: \"inherit\"\n};\n\nclass ShimmedStdin extends EventEmitter {\n constructor() {\n super();\n }\n write() {\n return !1;\n }\n destroy() {\n }\n end() {\n }\n pipe() {\n }\n}\n\nclass ShimmedStdioOutStream extends EventEmitter {\n constructor() {\n super(...arguments);\n }\n pipe() {\n }\n}\nvar validateAbortSignal = (signal, name) => {\n if (signal !== void 0 && (signal === null || typeof signal !== \"object\" || !(\"aborted\" in signal)))\n throw new ERR_INVALID_ARG_TYPE(name, \"AbortSignal\", signal);\n};\nvar validateObject = (value, name, options = null) => {\n const allowArray = options\?.allowArray \?\? !1, allowFunction = options\?.allowFunction \?\? !1;\n if (!(options\?.nullable \?\? !1) && value === null || !allowArray && ArrayIsArray.call(value) || typeof value !== \"object\" && (!allowFunction || typeof value !== \"function\"))\n throw new ERR_INVALID_ARG_TYPE(name, \"object\", value);\n}, validateArray = (value, name, minLength = 0) => {\n if (!ArrayIsArray(value))\n throw new ERR_INVALID_ARG_TYPE(name, \"Array\", value);\n if (value.length < minLength) {\n const reason = `must be longer than ${minLength}`;\n throw new ERR_INVALID_ARG_VALUE(name, value, reason);\n }\n}, Error = globalThis.Error, TypeError = globalThis.TypeError, RangeError = globalThis.RangeError;\n\nclass AbortError extends Error {\n code = \"ABORT_ERR\";\n name = \"AbortError\";\n constructor(message = \"The operation was aborted\", options = void 0) {\n if (options !== void 0 && typeof options !== \"object\")\n throw new ERR_INVALID_ARG_TYPE(\"options\", \"Object\", options);\n super(message, options);\n }\n}\n\nclass SystemError extends Error {\n path;\n syscall;\n errno;\n code;\n constructor(message, path, syscall, errno, code) {\n super(message);\n this.path = path, this.syscall = syscall, this.errno = errno, this.code = code;\n }\n get name() {\n return \"SystemError\";\n }\n}\n$ = {\n ChildProcess,\n spawn,\n execFile,\n exec,\n fork,\n spawnSync,\n execFileSync,\n execSync\n};\nreturn $})\n"_s;
//
//
@@ -501,7 +501,7 @@ static constexpr ASCIILiteral NodeAsyncHooksCode = "(function (){\"use strict\";
//
//
-static constexpr ASCIILiteral NodeChildProcessCode = "(function (){\"use strict\";// src/js/out/tmp/node/child_process.ts\nvar spawn = function(file, args, options) {\n options = normalizeSpawnArguments(file, args, options), validateTimeout(options.timeout), validateAbortSignal(options.signal, \"options.signal\");\n const killSignal2 = sanitizeKillSignal(options.killSignal), child = new ChildProcess;\n if (child.spawn(options), options.timeout > 0) {\n let timeoutId = setTimeout(() => {\n if (timeoutId) {\n try {\n child.kill(killSignal2);\n } catch (err) {\n child.emit(\"error\", err);\n }\n timeoutId = null;\n }\n });\n child.once(\"exit\", () => {\n if (timeoutId)\n clearTimeout(timeoutId), timeoutId = null;\n });\n }\n if (options.signal) {\n let onAbortListener2 = function() {\n abortChildProcess(child, killSignal2, options.signal.reason);\n };\n var onAbortListener = onAbortListener2;\n const signal = options.signal;\n if (signal.aborted)\n process.nextTick(onAbortListener2);\n else\n signal.addEventListener(\"abort\", onAbortListener2, { once: !0 }), child.once(\"exit\", () => signal.removeEventListener(\"abort\", onAbortListener2));\n }\n return child;\n}, execFile = function(file, args, options, callback) {\n ({ file, args, options, callback } = normalizeExecFileArgs(file, args, options, callback)), options = {\n encoding: \"utf8\",\n timeout: 0,\n maxBuffer: MAX_BUFFER,\n killSignal: \"SIGTERM\",\n cwd: null,\n env: null,\n shell: !1,\n ...options\n };\n const maxBuffer = options.maxBuffer;\n validateTimeout(options.timeout), validateMaxBuffer(maxBuffer), options.killSignal = sanitizeKillSignal(options.killSignal);\n const child = spawn(file, args, {\n cwd: options.cwd,\n env: options.env,\n shell: options.shell,\n signal: options.signal\n });\n let encoding;\n const _stdout = [], _stderr = [];\n if (options.encoding !== \"buffer\" && BufferIsEncoding(options.encoding))\n encoding = options.encoding;\n else\n encoding = null;\n let stdoutLen = 0, stderrLen = 0, killed = !1, exited = !1, timeoutId, encodedStdoutLen, encodedStderrLen, ex = null, cmd = file;\n function exitHandler(code, signal) {\n if (exited)\n return;\n if (exited = !0, timeoutId)\n clearTimeout(timeoutId), timeoutId = null;\n if (!callback)\n return;\n const readableEncoding = child\?.stdout\?.readableEncoding;\n let stdout, stderr;\n if (encoding || child.stdout && readableEncoding)\n stdout = ArrayPrototypeJoin.call(_stdout, \"\");\n else\n stdout = BufferConcat(_stdout);\n if (encoding || child.stderr && readableEncoding)\n stderr = ArrayPrototypeJoin.call(_stderr, \"\");\n else\n stderr = BufferConcat(_stderr);\n if (!ex && code === 0 && signal === null) {\n callback(null, stdout, stderr);\n return;\n }\n if (args\?.length)\n cmd += ` ${ArrayPrototypeJoin.call(args, \" \")}`;\n if (!ex) {\n let message = `Command failed: ${cmd}`;\n if (stderr)\n message += `\\n${stderr}`;\n ex = genericNodeError(message, {\n code,\n killed: child.killed || killed,\n signal\n });\n }\n ex.cmd = cmd, callback(ex, stdout, stderr);\n }\n function errorHandler(e) {\n if (ex = e, child.stdout)\n child.stdout.destroy();\n if (child.stderr)\n child.stderr.destroy();\n exitHandler();\n }\n function kill() {\n if (child.stdout)\n child.stdout.destroy();\n if (child.stderr)\n child.stderr.destroy();\n killed = !0;\n try {\n child.kill(options.killSignal);\n } catch (e) {\n ex = e, exitHandler();\n }\n }\n if (options.timeout > 0)\n timeoutId = setTimeout(function delayedKill() {\n kill(), timeoutId = null;\n }, options.timeout);\n if (child.stdout) {\n if (encoding)\n child.stdout.setEncoding(encoding);\n child.stdout.on(\"data\", maxBuffer === Infinity \? function onUnlimitedSizeBufferedData(chunk) {\n ArrayPrototypePush.call(_stdout, chunk);\n } : encoding \? function onChildStdoutEncoded(chunk) {\n if (stdoutLen += chunk.length, stdoutLen * 4 > maxBuffer) {\n const encoding2 = child.stdout.readableEncoding, actualLen = Buffer.byteLength(chunk, encoding2);\n if (encodedStdoutLen === void 0)\n for (let i = 0;i < _stdout.length; i++)\n encodedStdoutLen += Buffer.byteLength(_stdout[i], encoding2);\n else\n encodedStdoutLen += actualLen;\n const truncatedLen = maxBuffer - (encodedStdoutLen - actualLen);\n ArrayPrototypePush.call(_stdout, StringPrototypeSlice.apply(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stdout\"), kill();\n } else\n ArrayPrototypePush.call(_stdout, chunk);\n } : function onChildStdoutRaw(chunk) {\n if (stdoutLen += chunk.length, stdoutLen > maxBuffer) {\n const truncatedLen = maxBuffer - (stdoutLen - chunk.length);\n ArrayPrototypePush.call(_stdout, chunk.slice(0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stdout\"), kill();\n } else\n ArrayPrototypePush.call(_stdout, chunk);\n });\n }\n if (child.stderr) {\n if (encoding)\n child.stderr.setEncoding(encoding);\n child.stderr.on(\"data\", maxBuffer === Infinity \? function onUnlimitedSizeBufferedData(chunk) {\n ArrayPrototypePush.call(_stderr, chunk);\n } : encoding \? function onChildStderrEncoded(chunk) {\n if (stderrLen += chunk.length, stderrLen * 4 > maxBuffer) {\n const encoding2 = child.stderr.readableEncoding, actualLen = Buffer.byteLength(chunk, encoding2);\n if (encodedStderrLen === void 0)\n for (let i = 0;i < _stderr.length; i++)\n encodedStderrLen += Buffer.byteLength(_stderr[i], encoding2);\n else\n encodedStderrLen += actualLen;\n const truncatedLen = maxBuffer - (encodedStderrLen - actualLen);\n ArrayPrototypePush.call(_stderr, StringPrototypeSlice.call(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stderr\"), kill();\n } else\n ArrayPrototypePush.call(_stderr, chunk);\n } : function onChildStderrRaw(chunk) {\n if (stderrLen += chunk.length, stderrLen > maxBuffer) {\n const truncatedLen = maxBuffer - (stderrLen - chunk.length);\n ArrayPrototypePush.call(_stderr, StringPrototypeSlice.call(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stderr\"), kill();\n } else\n ArrayPrototypePush.call(_stderr, chunk);\n });\n }\n return child.addListener(\"close\", exitHandler), child.addListener(\"error\", errorHandler), child;\n}, exec = function(command, options, callback) {\n const opts = normalizeExecArgs(command, options, callback);\n return execFile(opts.file, opts.options, opts.callback);\n}, spawnSync = function(file, args, options) {\n options = {\n maxBuffer: MAX_BUFFER,\n ...normalizeSpawnArguments(file, args, options)\n };\n const { maxBuffer, encoding } = options;\n validateTimeout(options.timeout), validateMaxBuffer(maxBuffer), options.killSignal = sanitizeKillSignal(options.killSignal);\n const stdio = options.stdio || \"pipe\", bunStdio = getBunStdioFromOptions(stdio);\n var { input } = options;\n if (input)\n if (ArrayBufferIsView(input))\n bunStdio[0] = input;\n else if (typeof input === \"string\")\n bunStdio[0] = Buffer.from(input, encoding || \"utf8\");\n else\n throw new ERR_INVALID_ARG_TYPE(\"options.stdio[0]\", [\"Buffer\", \"TypedArray\", \"DataView\", \"string\"], input);\n const { stdout, stderr, success, exitCode } = Bun.spawnSync({\n cmd: options.args,\n env: options.env || void 0,\n cwd: options.cwd || void 0,\n stdin: bunStdio[0],\n stdout: bunStdio[1],\n stderr: bunStdio[2]\n }), result = {\n signal: null,\n status: exitCode,\n output: [null, stdout, stderr]\n };\n if (stdout && encoding && encoding !== \"buffer\")\n result.output[1] = result.output[1]\?.toString(encoding);\n if (stderr && encoding && encoding !== \"buffer\")\n result.output[2] = result.output[2]\?.toString(encoding);\n if (result.stdout = result.output[1], result.stderr = result.output[2], !success)\n result.error = new SystemError(result.output[2], options.file, \"spawnSync\", -1, result.status), result.error.spawnargs = ArrayPrototypeSlice.call(options.args, 1);\n return result;\n}, execFileSync = function(file, args, options) {\n ({ file, args, options } = normalizeExecFileArgs(file, args, options));\n const ret = spawnSync(file, args, options), errArgs = [options.argv0 || file];\n ArrayPrototypePush.apply(errArgs, args);\n const err = checkExecSyncError(ret, errArgs);\n if (err)\n throw err;\n return ret.stdout;\n}, execSync = function(command, options) {\n const opts = normalizeExecArgs(command, options, null), ret = spawnSync(opts.file, opts.options), err = checkExecSyncError(ret, void 0, command);\n if (err)\n throw err;\n return ret.stdout;\n}, stdioStringToArray = function(stdio, channel) {\n const options = [];\n switch (stdio) {\n case \"ignore\":\n case \"overlapped\":\n case \"pipe\":\n ArrayPrototypePush.call(options, stdio, stdio, stdio);\n break;\n case \"inherit\":\n ArrayPrototypePush.call(options, 0, 1, 2);\n break;\n default:\n throw new ERR_INVALID_ARG_VALUE(\"stdio\", stdio);\n }\n if (channel)\n ArrayPrototypePush.call(options, channel);\n return options;\n}, fork = function(modulePath, args = [], options) {\n modulePath = getValidatedPath(modulePath, \"modulePath\");\n let execArgv;\n if (args == null)\n args = [];\n else if (typeof args === \"object\" && !ArrayIsArray(args))\n options = args, args = [];\n else\n validateArray(args, \"args\");\n if (options != null)\n validateObject(options, \"options\");\n if (options = { __proto__: null, ...options, shell: !1 }, options.execPath = options.execPath || process.execPath, validateArgumentNullCheck(options.execPath, \"options.execPath\"), execArgv = options.execArgv || process.execArgv, validateArgumentsNullCheck(execArgv, \"options.execArgv\"), execArgv === process.execArgv && process._eval != null) {\n const index = ArrayPrototypeLastIndexOf.call(execArgv, process._eval);\n if (index > 0)\n execArgv = ArrayPrototypeSlice.call(execArgv), ArrayPrototypeSplice.call(execArgv, index - 1, 2);\n }\n if (args = [...execArgv, modulePath, ...args], typeof options.stdio === \"string\")\n options.stdio = stdioStringToArray(options.stdio, \"ipc\");\n else if (!ArrayIsArray(options.stdio))\n options.stdio = stdioStringToArray(options.silent \? \"pipe\" : \"inherit\", \"ipc\");\n else if (!ArrayPrototypeIncludes.call(options.stdio, \"ipc\"))\n throw new ERR_CHILD_PROCESS_IPC_REQUIRED(\"options.stdio\");\n return spawn(options.execPath, args, options);\n}, convertToValidSignal = function(signal) {\n if (typeof signal === \"number\" && getSignalsToNamesMapping()[signal])\n return signal;\n if (typeof signal === \"string\") {\n const signalName = signals[StringPrototypeToUpperCase.call(signal)];\n if (signalName)\n return signalName;\n }\n throw new ERR_UNKNOWN_SIGNAL(signal);\n}, sanitizeKillSignal = function(killSignal2) {\n if (typeof killSignal2 === \"string\" || typeof killSignal2 === \"number\")\n return convertToValidSignal(killSignal2);\n else if (killSignal2 != null)\n throw new ERR_INVALID_ARG_TYPE(\"options.killSignal\", [\"string\", \"number\"], killSignal2);\n}, getSignalsToNamesMapping = function() {\n if (signalsToNamesMapping !== void 0)\n return signalsToNamesMapping;\n signalsToNamesMapping = ObjectCreate(null);\n for (let key in signals)\n signalsToNamesMapping[signals[key]] = key;\n return signalsToNamesMapping;\n}, normalizeExecFileArgs = function(file, args, options, callback) {\n if (ArrayIsArray(args))\n args = ArrayPrototypeSlice.call(args);\n else if (args != null && typeof args === \"object\")\n callback = options, options = args, args = null;\n else if (typeof args === \"function\")\n callback = args, options = null, args = null;\n if (args == null)\n args = [];\n if (typeof options === \"function\")\n callback = options;\n else if (options != null)\n validateObject(options, \"options\");\n if (options == null)\n options = kEmptyObject;\n if (callback != null)\n validateFunction(callback, \"callback\");\n if (options.argv0 != null)\n validateString(options.argv0, \"options.argv0\"), validateArgumentNullCheck(options.argv0, \"options.argv0\");\n return { file, args, options, callback };\n}, normalizeExecArgs = function(command, options, callback) {\n if (validateString(command, \"command\"), validateArgumentNullCheck(command, \"command\"), typeof options === \"function\")\n callback = options, options = void 0;\n return options = { ...options }, options.shell = typeof options.shell === \"string\" \? options.shell : !0, {\n file: command,\n options,\n callback\n };\n}, normalizeSpawnArguments = function(file, args, options) {\n if (validateString(file, \"file\"), validateArgumentNullCheck(file, \"file\"), file.length === 0)\n throw new ERR_INVALID_ARG_VALUE(\"file\", file, \"cannot be empty\");\n if (ArrayIsArray(args))\n args = ArrayPrototypeSlice.call(args);\n else if (args == null)\n args = [];\n else if (typeof args !== \"object\")\n throw new ERR_INVALID_ARG_TYPE(\"args\", \"object\", args);\n else\n options = args, args = [];\n if (validateArgumentsNullCheck(args, \"args\"), options === void 0)\n options = {};\n else\n validateObject(options, \"options\");\n let cwd = options.cwd;\n if (cwd != null)\n cwd = getValidatedPath(cwd, \"options.cwd\");\n if (options.shell != null && typeof options.shell !== \"boolean\" && typeof options.shell !== \"string\")\n throw new ERR_INVALID_ARG_TYPE(\"options.shell\", [\"boolean\", \"string\"], options.shell);\n if (options.argv0 != null)\n validateString(options.argv0, \"options.argv0\"), validateArgumentNullCheck(options.argv0, \"options.argv0\");\n if (options.shell) {\n validateArgumentNullCheck(options.shell, \"options.shell\");\n const command = ArrayPrototypeJoin.call([file, ...args], \" \");\n if (typeof options.shell === \"string\")\n file = options.shell;\n else\n file = \"sh\";\n args = [\"-c\", command];\n }\n if (typeof options.argv0 === \"string\")\n ArrayPrototypeUnshift.call(args, options.argv0);\n else\n ArrayPrototypeUnshift.call(args, file);\n const envPairs = options.env || process.env;\n return { ...options, file, args, cwd, envPairs };\n}, checkExecSyncError = function(ret, args, cmd) {\n let err;\n if (ret.error)\n err = ret.error, ObjectAssign(err, ret);\n else if (ret.status !== 0) {\n let msg = \"Command failed: \";\n if (msg += cmd || ArrayPrototypeJoin.call(args, \" \"), ret.stderr && ret.stderr.length > 0)\n msg += `\\n${ret.stderr.toString()}`;\n err = genericNodeError(msg, ret);\n }\n return err;\n}, nodeToBun = function(item) {\n if (typeof item === \"number\")\n return item;\n else {\n const result = nodeToBunLookup[item];\n if (result === void 0)\n throw new Error(\"Invalid stdio option\");\n return result;\n }\n}, fdToStdioName = function(fd) {\n switch (fd) {\n case 0:\n return \"stdin\";\n case 1:\n return \"stdout\";\n case 2:\n return \"stderr\";\n default:\n return null;\n }\n}, getBunStdioFromOptions = function(stdio) {\n return normalizeStdio(stdio).map((item) => nodeToBun(item));\n}, normalizeStdio = function(stdio) {\n if (typeof stdio === \"string\")\n switch (stdio) {\n case \"ignore\":\n return [\"ignore\", \"ignore\", \"ignore\"];\n case \"pipe\":\n return [\"pipe\", \"pipe\", \"pipe\"];\n case \"inherit\":\n return [\"inherit\", \"inherit\", \"inherit\"];\n default:\n throw new ERR_INVALID_OPT_VALUE(\"stdio\", stdio);\n }\n else if (ArrayIsArray(stdio)) {\n let processedStdio;\n if (stdio.length === 0)\n processedStdio = [\"pipe\", \"pipe\", \"pipe\"];\n else if (stdio.length === 1)\n processedStdio = [stdio[0], \"pipe\", \"pipe\"];\n else if (stdio.length === 2)\n processedStdio = [stdio[0], stdio[1], \"pipe\"];\n else if (stdio.length >= 3)\n processedStdio = [stdio[0], stdio[1], stdio[2]];\n return processedStdio.map((item) => !item \? \"pipe\" : item);\n } else\n throw new ERR_INVALID_OPT_VALUE(\"stdio\", stdio);\n}, flushStdio = function(subprocess) {\n const stdio = subprocess.stdio;\n if (stdio == null)\n return;\n for (let i = 0;i < stdio.length; i++) {\n const stream = stdio[i];\n if (!stream || !stream.readable)\n continue;\n stream.resume();\n }\n}, onSpawnNT = function(self) {\n self.emit(\"spawn\");\n}, abortChildProcess = function(child, killSignal2, reason) {\n if (!child)\n return;\n try {\n if (child.kill(killSignal2))\n child.emit(\"error\", new AbortError(void 0, { cause: reason }));\n } catch (err) {\n child.emit(\"error\", err);\n }\n}, validateMaxBuffer = function(maxBuffer) {\n if (maxBuffer != null && !(typeof maxBuffer === \"number\" && maxBuffer >= 0))\n throw new ERR_OUT_OF_RANGE(\"options.maxBuffer\", \"a positive number\", maxBuffer);\n}, validateArgumentNullCheck = function(arg, propName) {\n if (typeof arg === \"string\" && StringPrototypeIncludes.call(arg, \"\\0\"))\n throw new ERR_INVALID_ARG_VALUE(propName, arg, \"must be a string without null bytes\");\n}, validateArgumentsNullCheck = function(args, propName) {\n for (let i = 0;i < args.length; ++i)\n validateArgumentNullCheck(args[i], `${propName}[${i}]`);\n}, validateTimeout = function(timeout) {\n if (timeout != null && !(NumberIsInteger(timeout) && timeout >= 0))\n throw new ERR_OUT_OF_RANGE(\"timeout\", \"an unsigned integer\", timeout);\n};\nvar validateFunction = function(value, name) {\n if (typeof value !== \"function\")\n throw new ERR_INVALID_ARG_TYPE(name, \"Function\", value);\n}, validateString = function(value, name) {\n if (typeof value !== \"string\")\n throw new ERR_INVALID_ARG_TYPE(name, \"string\", value);\n}, nullCheck = function(path, propName, throwError = !0) {\n const pathIsString = typeof path === \"string\", pathIsUint8Array = isUint8Array(path);\n if (!pathIsString && !pathIsUint8Array || pathIsString && !StringPrototypeIncludes.call(path, \"\\0\") || pathIsUint8Array && !Uint8ArrayPrototypeIncludes.call(path, 0))\n return;\n const err = new ERR_INVALID_ARG_VALUE(propName, path, \"must be a string or Uint8Array without null bytes\");\n if (throwError)\n throw err;\n return err;\n}, validatePath = function(path, propName = \"path\") {\n if (typeof path !== \"string\" && !isUint8Array(path))\n throw new ERR_INVALID_ARG_TYPE(propName, [\"string\", \"Buffer\", \"URL\"], path);\n const err = nullCheck(path, propName, !1);\n if (err !== void 0)\n throw err;\n}, getValidatedPath = function(fileURLOrPath, propName = \"path\") {\n const path = toPathIfFileURL(fileURLOrPath);\n return validatePath(path, propName), path;\n}, isUint8Array = function(value) {\n return typeof value === \"object\" && value !== null && value instanceof Uint8Array;\n}, isURLInstance = function(fileURLOrPath) {\n return fileURLOrPath != null && fileURLOrPath.href && fileURLOrPath.origin;\n}, toPathIfFileURL = function(fileURLOrPath) {\n if (!isURLInstance(fileURLOrPath))\n return fileURLOrPath;\n return Bun.fileURLToPath(fileURLOrPath);\n}, genericNodeError = function(message, options) {\n const err = new Error(message);\n return err.code = options.code, err.killed = options.killed, err.signal = options.signal, err;\n}, ERR_OUT_OF_RANGE = function(str, range, input, replaceDefaultBoolean = !1) {\n return new RangeError(`The value of ${str} is out of range. It must be ${range}. Received ${input}`);\n}, ERR_CHILD_PROCESS_STDIO_MAXBUFFER = function(stdio) {\n return Error(`${stdio} maxBuffer length exceeded`);\n}, ERR_UNKNOWN_SIGNAL = function(name) {\n const err = @makeTypeError(`Unknown signal: ${name}`);\n return err.code = \"ERR_UNKNOWN_SIGNAL\", err;\n}, ERR_INVALID_ARG_TYPE = function(name, type, value) {\n const err = @makeTypeError(`The \"${name}\" argument must be of type ${type}. Received ${value\?.toString()}`);\n return err.code = \"ERR_INVALID_ARG_TYPE\", err;\n}, ERR_INVALID_OPT_VALUE = function(name, value) {\n return @makeTypeError(`The value \"${value}\" is invalid for option \"${name}\"`);\n}, ERR_INVALID_ARG_VALUE = function(name, value, reason) {\n return new Error(`The value \"${value}\" is invalid for argument '${name}'. Reason: ${reason}`);\n}, ERR_CHILD_PROCESS_IPC_REQUIRED = function(name) {\n const err = @makeTypeError(`Forked processes must have an IPC channel, missing value 'ipc' in ${name}`);\n return err.code = \"ERR_CHILD_PROCESS_IPC_REQUIRED\", err;\n}, $, EventEmitter = @getInternalField(@internalModuleRegistry, 16) || @createInternalModuleById(16), StreamModule = @getInternalField(@internalModuleRegistry, 35) || @createInternalModuleById(35), {\n constants: { signals }\n} = @getInternalField(@internalModuleRegistry, 24) || @createInternalModuleById(24), { promisify } = @getInternalField(@internalModuleRegistry, 44) || @createInternalModuleById(44), ObjectCreate = Object.create, ObjectAssign = Object.assign, ObjectDefineProperty = Object.defineProperty, BufferConcat = Buffer.concat, BufferIsEncoding = Buffer.isEncoding, kEmptyObject = ObjectCreate(null), ArrayPrototypePush = Array.prototype.push, ArrayPrototypeJoin = Array.prototype.join, ArrayPrototypeMap = Array.prototype.map, ArrayPrototypeIncludes = Array.prototype.includes, ArrayPrototypeSlice = Array.prototype.slice, ArrayPrototypeUnshift = Array.prototype.unshift, ArrayPrototypeLastIndexOf = Array.prototype.lastIndexOf, ArrayPrototypeSplice = Array.prototype.splice, ArrayIsArray = Array.isArray, ArrayBufferIsView = ArrayBuffer.isView, NumberIsInteger = Number.isInteger;\nvar StringPrototypeToUpperCase = String.prototype.toUpperCase, StringPrototypeIncludes = String.prototype.includes, StringPrototypeSlice = String.prototype.slice, Uint8ArrayPrototypeIncludes = Uint8Array.prototype.includes, MAX_BUFFER = 1048576, NativeWritable, ReadableFromWeb, customPromiseExecFunction = (orig) => {\n return (...args) => {\n let resolve, reject;\n const promise = new Promise((res, rej) => {\n resolve = res, reject = rej;\n });\n return promise.child = orig(...args, (err, stdout, stderr) => {\n if (err !== null)\n err.stdout = stdout, err.stderr = stderr, reject(err);\n else\n resolve({ stdout, stderr });\n }), promise;\n };\n};\nObjectDefineProperty(exec, promisify.custom, {\n __proto__: null,\n enumerable: !1,\n value: customPromiseExecFunction(exec)\n});\nvar signalsToNamesMapping;\n\nclass ChildProcess extends EventEmitter {\n constructor() {\n super(...arguments);\n }\n #handle;\n #exited = !1;\n #closesNeeded = 1;\n #closesGot = 0;\n connected = !1;\n signalCode = null;\n exitCode = null;\n spawnfile;\n spawnargs;\n pid;\n channel;\n get killed() {\n if (this.#handle == null)\n return !1;\n }\n #handleOnExit(exitCode, signalCode, err) {\n if (this.#exited)\n return;\n if (signalCode)\n this.signalCode = signalCode;\n else\n this.exitCode = exitCode;\n if (this.#stdin)\n this.#stdin.destroy();\n if (this.#handle)\n this.#handle = null;\n if (exitCode < 0) {\n const err2 = new SystemError(`Spawned process exited with error code: ${exitCode}`, void 0, \"spawn\", \"EUNKNOWN\", \"ERR_CHILD_PROCESS_UNKNOWN_ERROR\");\n if (this.spawnfile)\n err2.path = this.spawnfile;\n err2.spawnargs = ArrayPrototypeSlice.call(this.spawnargs, 1), this.emit(\"error\", err2);\n } else\n this.emit(\"exit\", this.exitCode, this.signalCode);\n process.nextTick(flushStdio, this), this.#maybeClose(), this.#exited = !0, this.#stdioOptions = [\"destroyed\", \"destroyed\", \"destroyed\"];\n }\n #getBunSpawnIo(i, encoding) {\n NativeWritable ||= StreamModule.NativeWritable, ReadableFromWeb ||= StreamModule.Readable.fromWeb;\n const io = this.#stdioOptions[i];\n switch (i) {\n case 0:\n switch (io) {\n case \"pipe\":\n return new NativeWritable(this.#handle.stdin);\n case \"inherit\":\n return process.stdin || null;\n case \"destroyed\":\n return new ShimmedStdin;\n default:\n return null;\n }\n case 2:\n case 1:\n switch (io) {\n case \"pipe\":\n return ReadableFromWeb(this.#handle[fdToStdioName(i)], { encoding });\n case \"inherit\":\n return process[fdToStdioName(i)] || null;\n case \"destroyed\":\n return new ShimmedStdioOutStream;\n default:\n return null;\n }\n }\n }\n #stdin;\n #stdout;\n #stderr;\n #stdioObject;\n #encoding;\n #stdioOptions;\n #createStdioObject() {\n return Object.create(null, {\n 0: {\n get: () => this.stdin\n },\n 1: {\n get: () => this.stdout\n },\n 2: {\n get: () => this.stderr\n }\n });\n }\n get stdin() {\n return this.#stdin \?\?= this.#getBunSpawnIo(0, this.#encoding);\n }\n get stdout() {\n return this.#stdout \?\?= this.#getBunSpawnIo(1, this.#encoding);\n }\n get stderr() {\n return this.#stderr \?\?= this.#getBunSpawnIo(2, this.#encoding);\n }\n get stdio() {\n return this.#stdioObject \?\?= this.#createStdioObject();\n }\n spawn(options) {\n validateObject(options, \"options\"), validateString(options.file, \"options.file\");\n var file = this.spawnfile = options.file, spawnargs;\n if (options.args == null)\n spawnargs = this.spawnargs = [];\n else\n validateArray(options.args, \"options.args\"), spawnargs = this.spawnargs = options.args;\n const stdio = options.stdio || [\"pipe\", \"pipe\", \"pipe\"], bunStdio = getBunStdioFromOptions(stdio);\n var env = options.envPairs || void 0;\n this.#encoding = options.encoding || void 0, this.#stdioOptions = bunStdio, this.#handle = Bun.spawn({\n cmd: spawnargs,\n stdin: bunStdio[0],\n stdout: bunStdio[1],\n stderr: bunStdio[2],\n cwd: options.cwd || void 0,\n env: env || process.env,\n onExit: (handle, exitCode, signalCode, err) => {\n this.#handle = handle, this.pid = this.#handle.pid, process.nextTick((exitCode2, signalCode2, err2) => this.#handleOnExit(exitCode2, signalCode2, err2), exitCode, signalCode, err);\n },\n lazy: !0\n }), this.pid = this.#handle.pid, onSpawnNT(this);\n }\n send() {\n console.log(\"ChildProcess.prototype.send() - Sorry! Not implemented yet\");\n }\n disconnect() {\n console.log(\"ChildProcess.prototype.disconnect() - Sorry! Not implemented yet\");\n }\n kill(sig) {\n const signal = sig === 0 \? sig : convertToValidSignal(sig === void 0 \? \"SIGTERM\" : sig);\n if (this.#handle)\n this.#handle.kill(signal);\n return this.#maybeClose(), !0;\n }\n #maybeClose() {\n if (this.#closesGot++, this.#closesGot === this.#closesNeeded)\n this.emit(\"close\", this.exitCode, this.signalCode);\n }\n ref() {\n if (this.#handle)\n this.#handle.ref();\n }\n unref() {\n if (this.#handle)\n this.#handle.unref();\n }\n}\nvar nodeToBunLookup = {\n ignore: null,\n pipe: \"pipe\",\n overlapped: \"pipe\",\n inherit: \"inherit\"\n};\n\nclass ShimmedStdin extends EventEmitter {\n constructor() {\n super();\n }\n write() {\n return !1;\n }\n destroy() {\n }\n end() {\n }\n pipe() {\n }\n}\n\nclass ShimmedStdioOutStream extends EventEmitter {\n constructor() {\n super(...arguments);\n }\n pipe() {\n }\n}\nvar validateAbortSignal = (signal, name) => {\n if (signal !== void 0 && (signal === null || typeof signal !== \"object\" || !(\"aborted\" in signal)))\n throw new ERR_INVALID_ARG_TYPE(name, \"AbortSignal\", signal);\n};\nvar validateObject = (value, name, options = null) => {\n const allowArray = options\?.allowArray \?\? !1, allowFunction = options\?.allowFunction \?\? !1;\n if (!(options\?.nullable \?\? !1) && value === null || !allowArray && ArrayIsArray.call(value) || typeof value !== \"object\" && (!allowFunction || typeof value !== \"function\"))\n throw new ERR_INVALID_ARG_TYPE(name, \"object\", value);\n}, validateArray = (value, name, minLength = 0) => {\n if (!ArrayIsArray(value))\n throw new ERR_INVALID_ARG_TYPE(name, \"Array\", value);\n if (value.length < minLength) {\n const reason = `must be longer than ${minLength}`;\n throw new ERR_INVALID_ARG_VALUE(name, value, reason);\n }\n}, Error = globalThis.Error, TypeError = globalThis.TypeError, RangeError = globalThis.RangeError;\n\nclass AbortError extends Error {\n code = \"ABORT_ERR\";\n name = \"AbortError\";\n constructor(message = \"The operation was aborted\", options = void 0) {\n if (options !== void 0 && typeof options !== \"object\")\n throw new ERR_INVALID_ARG_TYPE(\"options\", \"Object\", options);\n super(message, options);\n }\n}\n\nclass SystemError extends Error {\n path;\n syscall;\n errno;\n code;\n constructor(message, path, syscall, errno, code) {\n super(message);\n this.path = path, this.syscall = syscall, this.errno = errno, this.code = code;\n }\n get name() {\n return \"SystemError\";\n }\n}\n$ = {\n ChildProcess,\n spawn,\n execFile,\n exec,\n fork,\n spawnSync,\n execFileSync,\n execSync\n};\nreturn $})\n"_s;
+static constexpr ASCIILiteral NodeChildProcessCode = "(function (){\"use strict\";// src/js/out/tmp/node/child_process.ts\nvar spawn = function(file, args, options) {\n options = normalizeSpawnArguments(file, args, options), validateTimeout(options.timeout), validateAbortSignal(options.signal, \"options.signal\");\n const killSignal2 = sanitizeKillSignal(options.killSignal), child = new ChildProcess;\n if (child.spawn(options), options.timeout > 0) {\n let timeoutId = setTimeout(() => {\n if (timeoutId) {\n try {\n child.kill(killSignal2);\n } catch (err) {\n child.emit(\"error\", err);\n }\n timeoutId = null;\n }\n });\n child.once(\"exit\", () => {\n if (timeoutId)\n clearTimeout(timeoutId), timeoutId = null;\n });\n }\n if (options.signal) {\n let onAbortListener2 = function() {\n abortChildProcess(child, killSignal2, options.signal.reason);\n };\n var onAbortListener = onAbortListener2;\n const signal = options.signal;\n if (signal.aborted)\n process.nextTick(onAbortListener2);\n else\n signal.addEventListener(\"abort\", onAbortListener2, { once: !0 }), child.once(\"exit\", () => signal.removeEventListener(\"abort\", onAbortListener2));\n }\n return child;\n}, execFile = function(file, args, options, callback) {\n ({ file, args, options, callback } = normalizeExecFileArgs(file, args, options, callback)), options = {\n encoding: \"utf8\",\n timeout: 0,\n maxBuffer: MAX_BUFFER,\n killSignal: \"SIGTERM\",\n cwd: null,\n env: null,\n shell: !1,\n ...options\n };\n const maxBuffer = options.maxBuffer;\n validateTimeout(options.timeout), validateMaxBuffer(maxBuffer), options.killSignal = sanitizeKillSignal(options.killSignal);\n const child = spawn(file, args, {\n cwd: options.cwd,\n env: options.env,\n shell: options.shell,\n signal: options.signal\n });\n let encoding;\n const _stdout = [], _stderr = [];\n if (options.encoding !== \"buffer\" && BufferIsEncoding(options.encoding))\n encoding = options.encoding;\n else\n encoding = null;\n let stdoutLen = 0, stderrLen = 0, killed = !1, exited = !1, timeoutId, encodedStdoutLen, encodedStderrLen, ex = null, cmd = file;\n function exitHandler(code, signal) {\n if (exited)\n return;\n if (exited = !0, timeoutId)\n clearTimeout(timeoutId), timeoutId = null;\n if (!callback)\n return;\n const readableEncoding = child\?.stdout\?.readableEncoding;\n let stdout, stderr;\n if (encoding || child.stdout && readableEncoding)\n stdout = ArrayPrototypeJoin.call(_stdout, \"\");\n else\n stdout = BufferConcat(_stdout);\n if (encoding || child.stderr && readableEncoding)\n stderr = ArrayPrototypeJoin.call(_stderr, \"\");\n else\n stderr = BufferConcat(_stderr);\n if (!ex && code === 0 && signal === null) {\n callback(null, stdout, stderr);\n return;\n }\n if (args\?.length)\n cmd += ` ${ArrayPrototypeJoin.call(args, \" \")}`;\n if (!ex) {\n let message = `Command failed: ${cmd}`;\n if (stderr)\n message += `\\n${stderr}`;\n ex = genericNodeError(message, {\n code,\n killed: child.killed || killed,\n signal\n });\n }\n ex.cmd = cmd, callback(ex, stdout, stderr);\n }\n function errorHandler(e) {\n if (ex = e, child.stdout)\n child.stdout.destroy();\n if (child.stderr)\n child.stderr.destroy();\n exitHandler();\n }\n function kill() {\n if (child.stdout)\n child.stdout.destroy();\n if (child.stderr)\n child.stderr.destroy();\n killed = !0;\n try {\n child.kill(options.killSignal);\n } catch (e) {\n ex = e, exitHandler();\n }\n }\n if (options.timeout > 0)\n timeoutId = setTimeout(function delayedKill() {\n kill(), timeoutId = null;\n }, options.timeout);\n if (child.stdout) {\n if (encoding)\n child.stdout.setEncoding(encoding);\n child.stdout.on(\"data\", maxBuffer === Infinity \? function onUnlimitedSizeBufferedData(chunk) {\n ArrayPrototypePush.call(_stdout, chunk);\n } : encoding \? function onChildStdoutEncoded(chunk) {\n if (stdoutLen += chunk.length, stdoutLen * 4 > maxBuffer) {\n const encoding2 = child.stdout.readableEncoding, actualLen = Buffer.byteLength(chunk, encoding2);\n if (encodedStdoutLen === void 0)\n for (let i = 0;i < _stdout.length; i++)\n encodedStdoutLen += Buffer.byteLength(_stdout[i], encoding2);\n else\n encodedStdoutLen += actualLen;\n const truncatedLen = maxBuffer - (encodedStdoutLen - actualLen);\n ArrayPrototypePush.call(_stdout, StringPrototypeSlice.apply(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stdout\"), kill();\n } else\n ArrayPrototypePush.call(_stdout, chunk);\n } : function onChildStdoutRaw(chunk) {\n if (stdoutLen += chunk.length, stdoutLen > maxBuffer) {\n const truncatedLen = maxBuffer - (stdoutLen - chunk.length);\n ArrayPrototypePush.call(_stdout, chunk.slice(0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stdout\"), kill();\n } else\n ArrayPrototypePush.call(_stdout, chunk);\n });\n }\n if (child.stderr) {\n if (encoding)\n child.stderr.setEncoding(encoding);\n child.stderr.on(\"data\", maxBuffer === Infinity \? function onUnlimitedSizeBufferedData(chunk) {\n ArrayPrototypePush.call(_stderr, chunk);\n } : encoding \? function onChildStderrEncoded(chunk) {\n if (stderrLen += chunk.length, stderrLen * 4 > maxBuffer) {\n const encoding2 = child.stderr.readableEncoding, actualLen = Buffer.byteLength(chunk, encoding2);\n if (encodedStderrLen === void 0)\n for (let i = 0;i < _stderr.length; i++)\n encodedStderrLen += Buffer.byteLength(_stderr[i], encoding2);\n else\n encodedStderrLen += actualLen;\n const truncatedLen = maxBuffer - (encodedStderrLen - actualLen);\n ArrayPrototypePush.call(_stderr, StringPrototypeSlice.call(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stderr\"), kill();\n } else\n ArrayPrototypePush.call(_stderr, chunk);\n } : function onChildStderrRaw(chunk) {\n if (stderrLen += chunk.length, stderrLen > maxBuffer) {\n const truncatedLen = maxBuffer - (stderrLen - chunk.length);\n ArrayPrototypePush.call(_stderr, StringPrototypeSlice.call(chunk, 0, truncatedLen)), ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER(\"stderr\"), kill();\n } else\n ArrayPrototypePush.call(_stderr, chunk);\n });\n }\n return child.addListener(\"close\", exitHandler), child.addListener(\"error\", errorHandler), child;\n}, exec = function(command, options, callback) {\n const opts = normalizeExecArgs(command, options, callback);\n return execFile(opts.file, opts.options, opts.callback);\n}, spawnSync = function(file, args, options) {\n options = {\n maxBuffer: MAX_BUFFER,\n ...normalizeSpawnArguments(file, args, options)\n };\n const { maxBuffer, encoding } = options;\n validateTimeout(options.timeout), validateMaxBuffer(maxBuffer), options.killSignal = sanitizeKillSignal(options.killSignal);\n const stdio = options.stdio || \"pipe\", bunStdio = getBunStdioFromOptions(stdio);\n var { input } = options;\n if (input)\n if (ArrayBufferIsView(input))\n bunStdio[0] = input;\n else if (typeof input === \"string\")\n bunStdio[0] = Buffer.from(input, encoding || \"utf8\");\n else\n throw new ERR_INVALID_ARG_TYPE(\"options.stdio[0]\", [\"Buffer\", \"TypedArray\", \"DataView\", \"string\"], input);\n const { stdout, stderr, success, exitCode } = Bun.spawnSync({\n cmd: options.args,\n env: options.env || void 0,\n cwd: options.cwd || void 0,\n stdin: bunStdio[0],\n stdout: bunStdio[1],\n stderr: bunStdio[2]\n }), result = {\n signal: null,\n status: exitCode,\n output: [null, stdout, stderr]\n };\n if (stdout && encoding && encoding !== \"buffer\")\n result.output[1] = result.output[1]\?.toString(encoding);\n if (stderr && encoding && encoding !== \"buffer\")\n result.output[2] = result.output[2]\?.toString(encoding);\n if (result.stdout = result.output[1], result.stderr = result.output[2], !success)\n result.error = new SystemError(result.output[2], options.file, \"spawnSync\", -1, result.status), result.error.spawnargs = ArrayPrototypeSlice.call(options.args, 1);\n return result;\n}, execFileSync = function(file, args, options) {\n ({ file, args, options } = normalizeExecFileArgs(file, args, options));\n const ret = spawnSync(file, args, options), errArgs = [options.argv0 || file];\n ArrayPrototypePush.apply(errArgs, args);\n const err = checkExecSyncError(ret, errArgs);\n if (err)\n throw err;\n return ret.stdout;\n}, execSync = function(command, options) {\n const opts = normalizeExecArgs(command, options, null), ret = spawnSync(opts.file, opts.options), err = checkExecSyncError(ret, void 0, command);\n if (err)\n throw err;\n return ret.stdout;\n}, stdioStringToArray = function(stdio, channel) {\n const options = [];\n switch (stdio) {\n case \"ignore\":\n case \"overlapped\":\n case \"pipe\":\n ArrayPrototypePush.call(options, stdio, stdio, stdio);\n break;\n case \"inherit\":\n ArrayPrototypePush.call(options, 0, 1, 2);\n break;\n default:\n throw new ERR_INVALID_ARG_VALUE(\"stdio\", stdio);\n }\n if (channel)\n ArrayPrototypePush.call(options, channel);\n return options;\n}, fork = function(modulePath, args = [], options) {\n modulePath = getValidatedPath(modulePath, \"modulePath\");\n let execArgv;\n if (args == null)\n args = [];\n else if (typeof args === \"object\" && !ArrayIsArray(args))\n options = args, args = [];\n else\n validateArray(args, \"args\");\n if (options != null)\n validateObject(options, \"options\");\n if (options = { __proto__: null, ...options, shell: !1 }, options.execPath = options.execPath || process.execPath, validateArgumentNullCheck(options.execPath, \"options.execPath\"), execArgv = options.execArgv || process.execArgv, validateArgumentsNullCheck(execArgv, \"options.execArgv\"), execArgv === process.execArgv && process._eval != null) {\n const index = ArrayPrototypeLastIndexOf.call(execArgv, process._eval);\n if (index > 0)\n execArgv = ArrayPrototypeSlice.call(execArgv), ArrayPrototypeSplice.call(execArgv, index - 1, 2);\n }\n if (args = [...execArgv, modulePath, ...args], typeof options.stdio === \"string\")\n options.stdio = stdioStringToArray(options.stdio, \"ipc\");\n else if (!ArrayIsArray(options.stdio))\n options.stdio = stdioStringToArray(options.silent \? \"pipe\" : \"inherit\", \"ipc\");\n else if (!ArrayPrototypeIncludes.call(options.stdio, \"ipc\"))\n throw new ERR_CHILD_PROCESS_IPC_REQUIRED(\"options.stdio\");\n return spawn(options.execPath, args, options);\n}, convertToValidSignal = function(signal) {\n if (typeof signal === \"number\" && getSignalsToNamesMapping()[signal])\n return signal;\n if (typeof signal === \"string\") {\n const signalName = signals[StringPrototypeToUpperCase.call(signal)];\n if (signalName)\n return signalName;\n }\n throw new ERR_UNKNOWN_SIGNAL(signal);\n}, sanitizeKillSignal = function(killSignal2) {\n if (typeof killSignal2 === \"string\" || typeof killSignal2 === \"number\")\n return convertToValidSignal(killSignal2);\n else if (killSignal2 != null)\n throw new ERR_INVALID_ARG_TYPE(\"options.killSignal\", [\"string\", \"number\"], killSignal2);\n}, getSignalsToNamesMapping = function() {\n if (signalsToNamesMapping !== void 0)\n return signalsToNamesMapping;\n signalsToNamesMapping = ObjectCreate(null);\n for (let key in signals)\n signalsToNamesMapping[signals[key]] = key;\n return signalsToNamesMapping;\n}, normalizeExecFileArgs = function(file, args, options, callback) {\n if (ArrayIsArray(args))\n args = ArrayPrototypeSlice.call(args);\n else if (args != null && typeof args === \"object\")\n callback = options, options = args, args = null;\n else if (typeof args === \"function\")\n callback = args, options = null, args = null;\n if (args == null)\n args = [];\n if (typeof options === \"function\")\n callback = options;\n else if (options != null)\n validateObject(options, \"options\");\n if (options == null)\n options = kEmptyObject;\n if (callback != null)\n validateFunction(callback, \"callback\");\n if (options.argv0 != null)\n validateString(options.argv0, \"options.argv0\"), validateArgumentNullCheck(options.argv0, \"options.argv0\");\n return { file, args, options, callback };\n}, normalizeExecArgs = function(command, options, callback) {\n if (validateString(command, \"command\"), validateArgumentNullCheck(command, \"command\"), typeof options === \"function\")\n callback = options, options = void 0;\n return options = { ...options }, options.shell = typeof options.shell === \"string\" \? options.shell : !0, {\n file: command,\n options,\n callback\n };\n}, normalizeSpawnArguments = function(file, args, options) {\n if (validateString(file, \"file\"), validateArgumentNullCheck(file, \"file\"), file.length === 0)\n throw new ERR_INVALID_ARG_VALUE(\"file\", file, \"cannot be empty\");\n if (ArrayIsArray(args))\n args = ArrayPrototypeSlice.call(args);\n else if (args == null)\n args = [];\n else if (typeof args !== \"object\")\n throw new ERR_INVALID_ARG_TYPE(\"args\", \"object\", args);\n else\n options = args, args = [];\n if (validateArgumentsNullCheck(args, \"args\"), options === void 0)\n options = {};\n else\n validateObject(options, \"options\");\n let cwd = options.cwd;\n if (cwd != null)\n cwd = getValidatedPath(cwd, \"options.cwd\");\n var detached = !1;\n const { detached: detachedOption } = options;\n if (detachedOption != null)\n detached = !!detachedOption;\n if (options.shell != null && typeof options.shell !== \"boolean\" && typeof options.shell !== \"string\")\n throw new ERR_INVALID_ARG_TYPE(\"options.shell\", [\"boolean\", \"string\"], options.shell);\n if (options.argv0 != null)\n validateString(options.argv0, \"options.argv0\"), validateArgumentNullCheck(options.argv0, \"options.argv0\");\n if (options.shell) {\n validateArgumentNullCheck(options.shell, \"options.shell\");\n const command = ArrayPrototypeJoin.call([file, ...args], \" \");\n if (typeof options.shell === \"string\")\n file = options.shell;\n else\n file = \"sh\";\n args = [\"-c\", command];\n }\n if (typeof options.argv0 === \"string\")\n ArrayPrototypeUnshift.call(args, options.argv0);\n else\n ArrayPrototypeUnshift.call(args, file);\n const envPairs = options.env || process.env;\n return { ...options, detached, file, args, cwd, envPairs };\n}, checkExecSyncError = function(ret, args, cmd) {\n let err;\n if (ret.error)\n err = ret.error, ObjectAssign(err, ret);\n else if (ret.status !== 0) {\n let msg = \"Command failed: \";\n if (msg += cmd || ArrayPrototypeJoin.call(args, \" \"), ret.stderr && ret.stderr.length > 0)\n msg += `\\n${ret.stderr.toString()}`;\n err = genericNodeError(msg, ret);\n }\n return err;\n}, nodeToBun = function(item) {\n if (typeof item === \"number\")\n return item;\n else {\n const result = nodeToBunLookup[item];\n if (result === void 0)\n throw new Error(\"Invalid stdio option\");\n return result;\n }\n}, fdToStdioName = function(fd) {\n switch (fd) {\n case 0:\n return \"stdin\";\n case 1:\n return \"stdout\";\n case 2:\n return \"stderr\";\n default:\n return null;\n }\n}, getBunStdioFromOptions = function(stdio) {\n return normalizeStdio(stdio).map((item) => nodeToBun(item));\n}, normalizeStdio = function(stdio) {\n if (typeof stdio === \"string\")\n switch (stdio) {\n case \"ignore\":\n return [\"ignore\", \"ignore\", \"ignore\"];\n case \"pipe\":\n return [\"pipe\", \"pipe\", \"pipe\"];\n case \"inherit\":\n return [\"inherit\", \"inherit\", \"inherit\"];\n default:\n throw new ERR_INVALID_OPT_VALUE(\"stdio\", stdio);\n }\n else if (ArrayIsArray(stdio)) {\n let processedStdio;\n if (stdio.length === 0)\n processedStdio = [\"pipe\", \"pipe\", \"pipe\"];\n else if (stdio.length === 1)\n processedStdio = [stdio[0], \"pipe\", \"pipe\"];\n else if (stdio.length === 2)\n processedStdio = [stdio[0], stdio[1], \"pipe\"];\n else if (stdio.length >= 3)\n processedStdio = [stdio[0], stdio[1], stdio[2]];\n return processedStdio.map((item) => !item \? \"pipe\" : item);\n } else\n throw new ERR_INVALID_OPT_VALUE(\"stdio\", stdio);\n}, flushStdio = function(subprocess) {\n const stdio = subprocess.stdio;\n if (stdio == null)\n return;\n for (let i = 0;i < stdio.length; i++) {\n const stream = stdio[i];\n if (!stream || !stream.readable)\n continue;\n stream.resume();\n }\n}, onSpawnNT = function(self) {\n self.emit(\"spawn\");\n}, abortChildProcess = function(child, killSignal2, reason) {\n if (!child)\n return;\n try {\n if (child.kill(killSignal2))\n child.emit(\"error\", new AbortError(void 0, { cause: reason }));\n } catch (err) {\n child.emit(\"error\", err);\n }\n}, validateMaxBuffer = function(maxBuffer) {\n if (maxBuffer != null && !(typeof maxBuffer === \"number\" && maxBuffer >= 0))\n throw new ERR_OUT_OF_RANGE(\"options.maxBuffer\", \"a positive number\", maxBuffer);\n}, validateArgumentNullCheck = function(arg, propName) {\n if (typeof arg === \"string\" && StringPrototypeIncludes.call(arg, \"\\0\"))\n throw new ERR_INVALID_ARG_VALUE(propName, arg, \"must be a string without null bytes\");\n}, validateArgumentsNullCheck = function(args, propName) {\n for (let i = 0;i < args.length; ++i)\n validateArgumentNullCheck(args[i], `${propName}[${i}]`);\n}, validateTimeout = function(timeout) {\n if (timeout != null && !(NumberIsInteger(timeout) && timeout >= 0))\n throw new ERR_OUT_OF_RANGE(\"timeout\", \"an unsigned integer\", timeout);\n};\nvar validateFunction = function(value, name) {\n if (typeof value !== \"function\")\n throw new ERR_INVALID_ARG_TYPE(name, \"Function\", value);\n}, validateString = function(value, name) {\n if (typeof value !== \"string\")\n throw new ERR_INVALID_ARG_TYPE(name, \"string\", value);\n}, nullCheck = function(path, propName, throwError = !0) {\n const pathIsString = typeof path === \"string\", pathIsUint8Array = isUint8Array(path);\n if (!pathIsString && !pathIsUint8Array || pathIsString && !StringPrototypeIncludes.call(path, \"\\0\") || pathIsUint8Array && !Uint8ArrayPrototypeIncludes.call(path, 0))\n return;\n const err = new ERR_INVALID_ARG_VALUE(propName, path, \"must be a string or Uint8Array without null bytes\");\n if (throwError)\n throw err;\n return err;\n}, validatePath = function(path, propName = \"path\") {\n if (typeof path !== \"string\" && !isUint8Array(path))\n throw new ERR_INVALID_ARG_TYPE(propName, [\"string\", \"Buffer\", \"URL\"], path);\n const err = nullCheck(path, propName, !1);\n if (err !== void 0)\n throw err;\n}, getValidatedPath = function(fileURLOrPath, propName = \"path\") {\n const path = toPathIfFileURL(fileURLOrPath);\n return validatePath(path, propName), path;\n}, isUint8Array = function(value) {\n return typeof value === \"object\" && value !== null && value instanceof Uint8Array;\n}, isURLInstance = function(fileURLOrPath) {\n return fileURLOrPath != null && fileURLOrPath.href && fileURLOrPath.origin;\n}, toPathIfFileURL = function(fileURLOrPath) {\n if (!isURLInstance(fileURLOrPath))\n return fileURLOrPath;\n return Bun.fileURLToPath(fileURLOrPath);\n}, genericNodeError = function(message, options) {\n const err = new Error(message);\n return err.code = options.code, err.killed = options.killed, err.signal = options.signal, err;\n}, ERR_OUT_OF_RANGE = function(str, range, input, replaceDefaultBoolean = !1) {\n return new RangeError(`The value of ${str} is out of range. It must be ${range}. Received ${input}`);\n}, ERR_CHILD_PROCESS_STDIO_MAXBUFFER = function(stdio) {\n return Error(`${stdio} maxBuffer length exceeded`);\n}, ERR_UNKNOWN_SIGNAL = function(name) {\n const err = @makeTypeError(`Unknown signal: ${name}`);\n return err.code = \"ERR_UNKNOWN_SIGNAL\", err;\n}, ERR_INVALID_ARG_TYPE = function(name, type, value) {\n const err = @makeTypeError(`The \"${name}\" argument must be of type ${type}. Received ${value\?.toString()}`);\n return err.code = \"ERR_INVALID_ARG_TYPE\", err;\n}, ERR_INVALID_OPT_VALUE = function(name, value) {\n return @makeTypeError(`The value \"${value}\" is invalid for option \"${name}\"`);\n}, ERR_INVALID_ARG_VALUE = function(name, value, reason) {\n return new Error(`The value \"${value}\" is invalid for argument '${name}'. Reason: ${reason}`);\n}, ERR_CHILD_PROCESS_IPC_REQUIRED = function(name) {\n const err = @makeTypeError(`Forked processes must have an IPC channel, missing value 'ipc' in ${name}`);\n return err.code = \"ERR_CHILD_PROCESS_IPC_REQUIRED\", err;\n}, $, EventEmitter = @getInternalField(@internalModuleRegistry, 16) || @createInternalModuleById(16), StreamModule = @getInternalField(@internalModuleRegistry, 35) || @createInternalModuleById(35), {\n constants: { signals }\n} = @getInternalField(@internalModuleRegistry, 24) || @createInternalModuleById(24), { promisify } = @getInternalField(@internalModuleRegistry, 44) || @createInternalModuleById(44), ObjectCreate = Object.create, ObjectAssign = Object.assign, ObjectDefineProperty = Object.defineProperty, BufferConcat = Buffer.concat, BufferIsEncoding = Buffer.isEncoding, kEmptyObject = ObjectCreate(null), ArrayPrototypePush = Array.prototype.push, ArrayPrototypeJoin = Array.prototype.join, ArrayPrototypeMap = Array.prototype.map, ArrayPrototypeIncludes = Array.prototype.includes, ArrayPrototypeSlice = Array.prototype.slice, ArrayPrototypeUnshift = Array.prototype.unshift, ArrayPrototypeLastIndexOf = Array.prototype.lastIndexOf, ArrayPrototypeSplice = Array.prototype.splice, ArrayIsArray = Array.isArray, ArrayBufferIsView = ArrayBuffer.isView, NumberIsInteger = Number.isInteger;\nvar StringPrototypeToUpperCase = String.prototype.toUpperCase, StringPrototypeIncludes = String.prototype.includes, StringPrototypeSlice = String.prototype.slice, Uint8ArrayPrototypeIncludes = Uint8Array.prototype.includes, MAX_BUFFER = 1048576, NativeWritable, ReadableFromWeb, customPromiseExecFunction = (orig) => {\n return (...args) => {\n let resolve, reject;\n const promise = new Promise((res, rej) => {\n resolve = res, reject = rej;\n });\n return promise.child = orig(...args, (err, stdout, stderr) => {\n if (err !== null)\n err.stdout = stdout, err.stderr = stderr, reject(err);\n else\n resolve({ stdout, stderr });\n }), promise;\n };\n};\nObjectDefineProperty(exec, promisify.custom, {\n __proto__: null,\n enumerable: !1,\n value: customPromiseExecFunction(exec)\n});\nvar signalsToNamesMapping;\n\nclass ChildProcess extends EventEmitter {\n constructor() {\n super(...arguments);\n }\n #handle;\n #exited = !1;\n #closesNeeded = 1;\n #closesGot = 0;\n connected = !1;\n signalCode = null;\n exitCode = null;\n spawnfile;\n spawnargs;\n pid;\n channel;\n get killed() {\n if (this.#handle == null)\n return !1;\n }\n #handleOnExit(exitCode, signalCode, err) {\n if (this.#exited)\n return;\n if (signalCode)\n this.signalCode = signalCode;\n else\n this.exitCode = exitCode;\n if (this.#stdin)\n this.#stdin.destroy();\n if (this.#handle)\n this.#handle = null;\n if (exitCode < 0) {\n const err2 = new SystemError(`Spawned process exited with error code: ${exitCode}`, void 0, \"spawn\", \"EUNKNOWN\", \"ERR_CHILD_PROCESS_UNKNOWN_ERROR\");\n if (this.spawnfile)\n err2.path = this.spawnfile;\n err2.spawnargs = ArrayPrototypeSlice.call(this.spawnargs, 1), this.emit(\"error\", err2);\n } else\n this.emit(\"exit\", this.exitCode, this.signalCode);\n process.nextTick(flushStdio, this), this.#maybeClose(), this.#exited = !0, this.#stdioOptions = [\"destroyed\", \"destroyed\", \"destroyed\"];\n }\n #getBunSpawnIo(i, encoding) {\n NativeWritable ||= StreamModule.NativeWritable, ReadableFromWeb ||= StreamModule.Readable.fromWeb;\n const io = this.#stdioOptions[i];\n switch (i) {\n case 0:\n switch (io) {\n case \"pipe\":\n return new NativeWritable(this.#handle.stdin);\n case \"inherit\":\n return process.stdin || null;\n case \"destroyed\":\n return new ShimmedStdin;\n default:\n return null;\n }\n case 2:\n case 1:\n switch (io) {\n case \"pipe\":\n return ReadableFromWeb(this.#handle[fdToStdioName(i)], { encoding });\n case \"inherit\":\n return process[fdToStdioName(i)] || null;\n case \"destroyed\":\n return new ShimmedStdioOutStream;\n default:\n return null;\n }\n }\n }\n #stdin;\n #stdout;\n #stderr;\n #stdioObject;\n #encoding;\n #stdioOptions;\n #createStdioObject() {\n return Object.create(null, {\n 0: {\n get: () => this.stdin\n },\n 1: {\n get: () => this.stdout\n },\n 2: {\n get: () => this.stderr\n }\n });\n }\n get stdin() {\n return this.#stdin \?\?= this.#getBunSpawnIo(0, this.#encoding);\n }\n get stdout() {\n return this.#stdout \?\?= this.#getBunSpawnIo(1, this.#encoding);\n }\n get stderr() {\n return this.#stderr \?\?= this.#getBunSpawnIo(2, this.#encoding);\n }\n get stdio() {\n return this.#stdioObject \?\?= this.#createStdioObject();\n }\n spawn(options) {\n validateObject(options, \"options\"), validateString(options.file, \"options.file\");\n var file = this.spawnfile = options.file, spawnargs;\n if (options.args == null)\n spawnargs = this.spawnargs = [];\n else\n validateArray(options.args, \"options.args\"), spawnargs = this.spawnargs = options.args;\n const stdio = options.stdio || [\"pipe\", \"pipe\", \"pipe\"], bunStdio = getBunStdioFromOptions(stdio);\n var env = options.envPairs || void 0;\n const detachedOption = options.detached;\n this.#encoding = options.encoding || void 0, this.#stdioOptions = bunStdio, this.#handle = Bun.spawn({\n cmd: spawnargs,\n stdin: bunStdio[0],\n stdout: bunStdio[1],\n stderr: bunStdio[2],\n cwd: options.cwd || void 0,\n env: env || process.env,\n detached: typeof detachedOption !== \"undefined\" \? !!detachedOption : !1,\n onExit: (handle, exitCode, signalCode, err) => {\n this.#handle = handle, this.pid = this.#handle.pid, process.nextTick((exitCode2, signalCode2, err2) => this.#handleOnExit(exitCode2, signalCode2, err2), exitCode, signalCode, err);\n },\n lazy: !0\n }), this.pid = this.#handle.pid, onSpawnNT(this);\n }\n send() {\n console.log(\"ChildProcess.prototype.send() - Sorry! Not implemented yet\");\n }\n disconnect() {\n console.log(\"ChildProcess.prototype.disconnect() - Sorry! Not implemented yet\");\n }\n kill(sig) {\n const signal = sig === 0 \? sig : convertToValidSignal(sig === void 0 \? \"SIGTERM\" : sig);\n if (this.#handle)\n this.#handle.kill(signal);\n return this.#maybeClose(), !0;\n }\n #maybeClose() {\n if (this.#closesGot++, this.#closesGot === this.#closesNeeded)\n this.emit(\"close\", this.exitCode, this.signalCode);\n }\n ref() {\n if (this.#handle)\n this.#handle.ref();\n }\n unref() {\n if (this.#handle)\n this.#handle.unref();\n }\n}\nvar nodeToBunLookup = {\n ignore: null,\n pipe: \"pipe\",\n overlapped: \"pipe\",\n inherit: \"inherit\"\n};\n\nclass ShimmedStdin extends EventEmitter {\n constructor() {\n super();\n }\n write() {\n return !1;\n }\n destroy() {\n }\n end() {\n }\n pipe() {\n }\n}\n\nclass ShimmedStdioOutStream extends EventEmitter {\n constructor() {\n super(...arguments);\n }\n pipe() {\n }\n}\nvar validateAbortSignal = (signal, name) => {\n if (signal !== void 0 && (signal === null || typeof signal !== \"object\" || !(\"aborted\" in signal)))\n throw new ERR_INVALID_ARG_TYPE(name, \"AbortSignal\", signal);\n};\nvar validateObject = (value, name, options = null) => {\n const allowArray = options\?.allowArray \?\? !1, allowFunction = options\?.allowFunction \?\? !1;\n if (!(options\?.nullable \?\? !1) && value === null || !allowArray && ArrayIsArray.call(value) || typeof value !== \"object\" && (!allowFunction || typeof value !== \"function\"))\n throw new ERR_INVALID_ARG_TYPE(name, \"object\", value);\n}, validateArray = (value, name, minLength = 0) => {\n if (!ArrayIsArray(value))\n throw new ERR_INVALID_ARG_TYPE(name, \"Array\", value);\n if (value.length < minLength) {\n const reason = `must be longer than ${minLength}`;\n throw new ERR_INVALID_ARG_VALUE(name, value, reason);\n }\n}, Error = globalThis.Error, TypeError = globalThis.TypeError, RangeError = globalThis.RangeError;\n\nclass AbortError extends Error {\n code = \"ABORT_ERR\";\n name = \"AbortError\";\n constructor(message = \"The operation was aborted\", options = void 0) {\n if (options !== void 0 && typeof options !== \"object\")\n throw new ERR_INVALID_ARG_TYPE(\"options\", \"Object\", options);\n super(message, options);\n }\n}\n\nclass SystemError extends Error {\n path;\n syscall;\n errno;\n code;\n constructor(message, path, syscall, errno, code) {\n super(message);\n this.path = path, this.syscall = syscall, this.errno = errno, this.code = code;\n }\n get name() {\n return \"SystemError\";\n }\n}\n$ = {\n ChildProcess,\n spawn,\n execFile,\n exec,\n fork,\n spawnSync,\n execFileSync,\n execSync\n};\nreturn $})\n"_s;
//
//