diff options
author | 2023-08-10 19:00:06 -0700 | |
---|---|---|
committer | 2023-08-10 19:00:06 -0700 | |
commit | 513a6d0df3d4d991e76f8e7762df7a07a8087a81 (patch) | |
tree | d8f11c4b1a927d6de9cf674c6a8a9a247608def3 | |
parent | 115704b27b85922b32214981b28dfd243e4a7740 (diff) | |
download | bun-513a6d0df3d4d991e76f8e7762df7a07a8087a81.tar.gz bun-513a6d0df3d4d991e76f8e7762df7a07a8087a81.tar.zst bun-513a6d0df3d4d991e76f8e7762df7a07a8087a81.zip |
run files without extensions (#4113)
* run script without extension
* process stdio write fix
-rw-r--r-- | src/cli/run_command.zig | 17 | ||||
-rw-r--r-- | src/js/builtins/ProcessObjectInternals.ts | 30 | ||||
-rw-r--r-- | src/js/out/InternalModuleRegistryConstants.h | 6 | ||||
-rw-r--r-- | src/js/out/WebCoreJSBuiltins.cpp | 4 |
4 files changed, 46 insertions, 11 deletions
diff --git a/src/cli/run_command.zig b/src/cli/run_command.zig index 106e87a3c..490cbe111 100644 --- a/src/cli/run_command.zig +++ b/src/cli/run_command.zig @@ -1078,6 +1078,23 @@ pub const RunCommand = struct { } return true; + } else if ((script_name_to_search.len > 1 and script_name_to_search[0] == '/') or + (script_name_to_search.len > 2 and script_name_to_search[0] == '.' and script_name_to_search[1] == '/' and + script_name_to_search[script_name_to_search.len - 1] != '/')) + { + Run.boot(ctx, ctx.allocator.dupe(u8, script_name_to_search) catch unreachable) catch |err| { + if (Output.enable_ansi_colors) { + ctx.log.printForLogLevelWithEnableAnsiColors(Output.errorWriter(), true) catch {}; + } else { + ctx.log.printForLogLevelWithEnableAnsiColors(Output.errorWriter(), false) catch {}; + } + + Output.prettyErrorln("<r><red>error<r>: Failed to run <b>{s}<r> due to error <b>{s}<r>", .{ + std.fs.path.basename(script_name_to_search), + @errorName(err), + }); + Global.exit(1); + }; } }, } diff --git a/src/js/builtins/ProcessObjectInternals.ts b/src/js/builtins/ProcessObjectInternals.ts index fc6b3800f..af51d25cd 100644 --- a/src/js/builtins/ProcessObjectInternals.ts +++ b/src/js/builtins/ProcessObjectInternals.ts @@ -71,6 +71,14 @@ export function getStdioWriteStream(fd_, getWindowSize) { return fd_; } + get writable() { + return this.#writable; + } + + get readable() { + return this.#readable; + } + constructor(fd) { super({ readable: true, writable: true }); this.#fdPath = `/dev/fd/${fd}`; @@ -120,9 +128,9 @@ export function getStdioWriteStream(fd_, getWindowSize) { _write(chunk, encoding, callback) { if (!this.#writeStream) { var { createWriteStream } = require("node:fs"); - var stream = (this.#writeStream = createWriteStream(this.#fdPath)); + this.#writeStream = createWriteStream(this.#fdPath); - stream.on("finish", () => { + this.#writeStream.on("finish", () => { if (this.#onFinish) { const cb = this.#onFinish; this.#onFinish = null; @@ -130,7 +138,7 @@ export function getStdioWriteStream(fd_, getWindowSize) { } }); - stream.on("drain", () => { + this.#writeStream.on("drain", () => { if (this.#onDrain) { const cb = this.#onDrain; this.#onDrain = null; @@ -138,15 +146,15 @@ export function getStdioWriteStream(fd_, getWindowSize) { } }); - eos(stream, err => { + eos(this.#writeStream, err => { this.#writable = false; if (err) { - destroy(stream, err); + destroy(this.#writeStream, err); } this.#onFinished(err); }); } - if (stream.write(chunk, encoding)) { + if (this.#writeStream.write(chunk, encoding)) { callback(); } else { this.#onDrain = callback; @@ -296,6 +304,16 @@ export function getStdioWriteStream(fd_, getWindowSize) { return this.#innerStream._readableState; } + get writable() { + this.#ensureInnerStream(); + return this.#innerStream.writable; + } + + get readable() { + this.#ensureInnerStream(); + return this.#innerStream.readable; + } + pipe(destination) { this.#ensureInnerStream(); return this.#innerStream.pipe(destination); diff --git a/src/js/out/InternalModuleRegistryConstants.h b/src/js/out/InternalModuleRegistryConstants.h index dd4b71b09..1486d7276 100644 --- a/src/js/out/InternalModuleRegistryConstants.h +++ b/src/js/out/InternalModuleRegistryConstants.h @@ -173,7 +173,7 @@ static constexpr ASCIILiteral NodeUrlCode = "(function (){\"use strict\";const{U // // -static constexpr ASCIILiteral NodeUtilCode = "(function (){\"use strict\";const types=@requireNativeModule(\"node:util/types\");var cjs_exports={};function isBufferInterface({copy,fill,readUint8}){return typeof copy===\"function\"&&typeof fill===\"function\"&&typeof readUint8===\"function\"}function isBuffer(value){return Buffer.isBuffer(value)||typeof value===\"object\"&&isBufferInterface(value||{})}function isFunction(value){return typeof value===\"function\"}const deepEquals=Bun.deepEquals,isDeepStrictEqual=(a,b)=>deepEquals(a,b,!0);var getOwnPropertyDescriptors=Object.getOwnPropertyDescriptors,formatRegExp=/%[sdjfoc%]/g;function formatWithOptions(inspectOptions,f){if(!isString(f)){var objects=[];for(var i=0;i<arguments.length;i++)objects.push(inspect(arguments[i],inspectOptions));return objects.join(\" \")}var i=2,args=arguments,len=args.length,str=String(f).replace(formatRegExp,function(x2){if(x2===\"%%\")return\"%\";if(i>=len)return x2;switch(x2){case\"%s\":return String(args[i++]);case\"%f\":case\"%d\":return Number(args[i++]);case\"%j\":try{return JSON.stringify(args[i++])}catch(_){return\"[Circular]\"}case\"%o\":return inspect(args[i++],{showHidden:!0,showProxy:!0,...inspectOptions});case\"%O\":return inspect(args[i++],{showHidden:!0,showProxy:!0,...inspectOptions});default:return x2}});for(var x=args[i];i<len;x=args[++i])if(isNull(x)||!isObject(x))str+=\" \"+x;else str+=\" \"+inspect(x,inspectOptions);return str}function format(...args){return formatWithOptions({},...args)}function deprecate(fn,msg,code){if(process.noDeprecation===!0)return fn;var warned=!1;function deprecated(){if(!warned){if(process.throwDeprecation){var err=new Error(msg);if(code)err.code=code;throw err}else if(process.traceDeprecation)console.trace(msg);else console.error(msg);warned=!0}return fn.apply(this,arguments)}return deprecated}var debugs={},debugEnvRegex=/^$/;if(process.env.NODE_DEBUG)debugEnv=process.env.NODE_DEBUG,debugEnv=debugEnv.replace(/[|\\\\{}()[\\]^$+\?.]/g,\"\\\\$&\").replace(/\\*/g,\".*\").replace(/,/g,\"$|^\").toUpperCase(),debugEnvRegex=new RegExp(\"^\"+debugEnv+\"$\",\"i\");var debugEnv;function debuglog(set){if(set=set.toUpperCase(),!debugs[set])if(debugEnvRegex.test(set)){var pid=process.pid;debugs[set]=function(){var msg=format.apply(cjs_exports,arguments);console.error(\"%s %d: %s\",set,pid,msg)}}else debugs[set]=function(){};return debugs[set]}function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};if(arguments.length>=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean(opts))ctx.showHidden=opts;else if(opts)_extend(ctx,opts);if(isUndefined(ctx.showHidden))ctx.showHidden=!1;if(isUndefined(ctx.depth))ctx.depth=2;if(isUndefined(ctx.colors))ctx.colors=!1;if(isUndefined(ctx.customInspect))ctx.customInspect=!0;if(ctx.colors)ctx.stylize=stylizeWithColor;return formatValue(ctx,obj,ctx.depth)}inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},inspect.styles={special:\"cyan\",number:\"yellow\",boolean:\"yellow\",undefined:\"grey\",null:\"bold\",string:\"green\",date:\"magenta\",regexp:\"red\"};function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style)return\"\\x1B[\"+inspect.colors[style][0]+\"m\"+str+\"\\x1B[\"+inspect.colors[style][1]+\"m\";else return str}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};return array.forEach(function(val,idx){hash[val]=!0}),hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==inspect&&!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString(ret))ret=formatValue(ctx,ret,recurseTimes);return ret}var primitive=formatPrimitive(ctx,value);if(primitive)return primitive;var keys=Object.keys(value),visibleKeys=arrayToHash(keys);if(ctx.showHidden)keys=Object.getOwnPropertyNames(value);if(isError(value)&&(keys.indexOf(\"message\")>=0||keys.indexOf(\"description\")>=0))return formatError(value);if(keys.length===0){if(isFunction(value)){var name=value.name\?\": \"+value.name:\"\";return ctx.stylize(\"[Function\"+name+\"]\",\"special\")}if(isRegExp(value))return ctx.stylize(RegExp.prototype.toString.call(value),\"regexp\");if(isDate(value))return ctx.stylize(Date.prototype.toString.call(value),\"date\");if(isError(value))return formatError(value)}var base=\"\",array=!1,braces=[\"{\",\"}\"];if(@isArray(value))array=!0,braces=[\"[\",\"]\"];if(isFunction(value)){var n=value.name\?\": \"+value.name:\"\";base=\" [Function\"+n+\"]\"}if(isRegExp(value))base=\" \"+RegExp.prototype.toString.call(value);if(isDate(value))base=\" \"+Date.prototype.toUTCString.call(value);if(isError(value))base=\" \"+formatError(value);if(keys.length===0&&(!array||value.length==0))return braces[0]+base+braces[1];if(recurseTimes<0)if(isRegExp(value))return ctx.stylize(RegExp.prototype.toString.call(value),\"regexp\");else return ctx.stylize(\"[Object]\",\"special\");ctx.seen.push(value);var output;if(array)output=formatArray(ctx,value,recurseTimes,visibleKeys,keys);else output=keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)});return ctx.seen.pop(),reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize(\"undefined\",\"undefined\");if(isString(value)){var simple=\"'\"+JSON.stringify(value).replace(/^\"|\"$/g,\"\").replace(/'/g,\"\\\\'\").replace(/\\\\\"/g,'\"')+\"'\";return ctx.stylize(simple,\"string\")}if(isNumber(value))return ctx.stylize(\"\"+value,\"number\");if(isBoolean(value))return ctx.stylize(\"\"+value,\"boolean\");if(isNull(value))return ctx.stylize(\"null\",\"null\")}function formatError(value){return\"[\"+Error.prototype.toString.call(value)+\"]\"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i=0,l=value.length;i<l;++i)if(hasOwnProperty(value,String(i)))output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i),!0));else output.push(\"\");return keys.forEach(function(key){if(!key.match(/^\\d+$/))output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,!0))}),output}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;if(desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]},desc.get)if(desc.set)str=ctx.stylize(\"[Getter/Setter]\",\"special\");else str=ctx.stylize(\"[Getter]\",\"special\");else if(desc.set)str=ctx.stylize(\"[Setter]\",\"special\");if(!hasOwnProperty(visibleKeys,key))name=\"[\"+key+\"]\";if(!str)if(ctx.seen.indexOf(desc.value)<0){if(isNull(recurseTimes))str=formatValue(ctx,desc.value,null);else str=formatValue(ctx,desc.value,recurseTimes-1);if(str.indexOf(\"\\n\")>-1)if(array)str=str.split(\"\\n\").map(function(line){return\" \"+line}).join(\"\\n\").substr(2);else str=\"\\n\"+str.split(\"\\n\").map(function(line){return\" \"+line}).join(\"\\n\")}else str=ctx.stylize(\"[Circular]\",\"special\");if(isUndefined(name)){if(array&&key.match(/^\\d+$/))return str;if(name=JSON.stringify(\"\"+key),name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/))name=name.substr(1,name.length-2),name=ctx.stylize(name,\"name\");else name=name.replace(/'/g,\"\\\\'\").replace(/\\\\\"/g,'\"').replace(/(^\"|\"$)/g,\"'\"),name=ctx.stylize(name,\"string\")}return name+\": \"+str}function reduceToSingleString(output,base,braces){var numLinesEst=0,length=output.reduce(function(prev,cur){if(numLinesEst++,cur.indexOf(\"\\n\")>=0)numLinesEst++;return prev+cur.replace(/\\u001b\\[\\d\\d\?m/g,\"\").length+1},0);if(length>60)return braces[0]+(base===\"\"\?\"\":base+\"\\n \")+\" \"+output.join(\",\\n \")+\" \"+braces[1];return braces[0]+base+\" \"+output.join(\", \")+\" \"+braces[1]}function isBoolean(arg){return typeof arg===\"boolean\"}function isNull(arg){return arg===null}function isNullOrUndefined(arg){return arg==null}function isNumber(arg){return typeof arg===\"number\"}function isString(arg){return typeof arg===\"string\"}function isSymbol(arg){return typeof arg===\"symbol\"}function isUndefined(arg){return arg===void 0}var isRegExp=types.isRegExp;function isObject(arg){return typeof arg===\"object\"&&arg!==null}var{isDate,isNativeError:isError}=types;function isPrimitive(arg){return arg===null||typeof arg===\"boolean\"||typeof arg===\"number\"||typeof arg===\"string\"||typeof arg===\"symbol\"||typeof arg===\"undefined\"}function pad(n){return n<10\?\"0\"+n.toString(10):n.toString(10)}var months=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"];function timestamp(){var d=new Date,time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(\":\");return[d.getDate(),months[d.getMonth()],time].join(\" \")}var log=function log(){console.log(\"%s - %s\",timestamp(),format.apply(cjs_exports,arguments))},inherits=function inherits(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})},_extend=function(origin,add){if(!add||!isObject(add))return origin;var keys=Object.keys(add),i=keys.length;while(i--)origin[keys[i]]=add[keys[i]];return origin};function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}var kCustomPromisifiedSymbol=Symbol.for(\"util.promisify.custom\"),promisify=function promisify(original){if(typeof original!==\"function\")@throwTypeError('The \"original\" argument must be of type Function');if(kCustomPromisifiedSymbol&&original[kCustomPromisifiedSymbol]){var fn=original[kCustomPromisifiedSymbol];if(typeof fn!==\"function\")@throwTypeError('The \"util.promisify.custom\" argument must be of type Function');return Object.defineProperty(fn,kCustomPromisifiedSymbol,{value:fn,enumerable:!1,writable:!1,configurable:!0}),fn}function fn(){var promiseResolve,promiseReject,promise=new Promise(function(resolve,reject){promiseResolve=resolve,promiseReject=reject}),args=[];for(var i=0;i<arguments.length;i++)args.push(arguments[i]);args.push(function(err,value){if(err)promiseReject(err);else promiseResolve(value)});try{original.apply(this,args)}catch(err){promiseReject(err)}return promise}if(Object.setPrototypeOf(fn,Object.getPrototypeOf(original)),kCustomPromisifiedSymbol)Object.defineProperty(fn,kCustomPromisifiedSymbol,{value:fn,enumerable:!1,writable:!1,configurable:!0});return Object.defineProperties(fn,getOwnPropertyDescriptors(original))};promisify.custom=kCustomPromisifiedSymbol;function callbackifyOnRejected(reason,cb){if(!reason){var newReason=new Error(\"Promise was rejected with a falsy value\");newReason.reason=reason,newReason.code=\"ERR_FALSY_VALUE_REJECTION\",reason=newReason}return cb(reason)}function callbackify(original){if(typeof original!==\"function\")@throwTypeError('The \"original\" argument must be of type Function');function callbackified(){var args=Array.prototype.slice.call(arguments),maybeCb=args.pop();if(typeof maybeCb!==\"function\")@throwTypeError(\"The last argument must be of type Function\");var self=this,cb=function(){return maybeCb.apply(self,arguments)};original.apply(this,args).then(function(ret){process.nextTick(cb,null,ret)},function(rej){process.nextTick(callbackifyOnRejected,rej,cb)})}return Object.setPrototypeOf(callbackified,Object.getPrototypeOf(original)),Object.defineProperties(callbackified,getOwnPropertyDescriptors(original)),callbackified}var toUSVString=(input)=>{return(input+\"\").toWellFormed()};return Object.assign(cjs_exports,{format,formatWithOptions,deprecate,debuglog,_extend,inspect,types,isArray:@isArray,isBoolean,isNull,isNullOrUndefined,isNumber,isString,isSymbol,isUndefined,isRegExp,isObject,isDate,isFunction,isError,isPrimitive,isBuffer,log,inherits,toUSVString,promisify,callbackify,isDeepStrictEqual,TextDecoder,TextEncoder})})\n"_s; +static constexpr ASCIILiteral NodeUtilCode = "(function (){\"use strict\";const types=@requireNativeModule(\"node:util/types\");var cjs_exports={};function isBufferInterface({copy,fill,readUint8}){return typeof copy===\"function\"&&typeof fill===\"function\"&&typeof readUint8===\"function\"}function isBuffer(value){return Buffer.isBuffer(value)||typeof value===\"object\"&&isBufferInterface(value||{})}function isFunction(value){return typeof value===\"function\"}const deepEquals=Bun.deepEquals,isDeepStrictEqual=(a,b)=>deepEquals(a,b,!0);var getOwnPropertyDescriptors=Object.getOwnPropertyDescriptors,formatRegExp=/%[sdjfoc%]/g;function formatWithOptions(inspectOptions,f){if(!isString(f)){var objects=[];for(var i=0;i<arguments.length;i++)objects.push(inspect(arguments[i],inspectOptions));return objects.join(\" \")}var i=2,args=arguments,len=args.length,str=String(f).replace(formatRegExp,function(x2){if(x2===\"%%\")return\"%\";if(i>=len)return x2;switch(x2){case\"%s\":return String(args[i++]);case\"%f\":return Number(args[i++]);case\"%d\":return Math.round(Number(args[i++]));case\"%j\":try{return JSON.stringify(args[i++])}catch(_){return\"[Circular]\"}case\"%o\":return inspect(args[i++],{showHidden:!0,showProxy:!0,...inspectOptions});case\"%O\":return inspect(args[i++],{showHidden:!0,showProxy:!0,...inspectOptions});default:return x2}});for(var x=args[i];i<len;x=args[++i])if(isNull(x)||!isObject(x))str+=\" \"+x;else str+=\" \"+inspect(x,inspectOptions);return str}function format(...args){return formatWithOptions({},...args)}function deprecate(fn,msg,code){if(process.noDeprecation===!0)return fn;var warned=!1;function deprecated(){if(!warned){if(process.throwDeprecation){var err=new Error(msg);if(code)err.code=code;throw err}else if(process.traceDeprecation)console.trace(msg);else console.error(msg);warned=!0}return fn.apply(this,arguments)}return deprecated}var debugs={},debugEnvRegex=/^$/;if(process.env.NODE_DEBUG)debugEnv=process.env.NODE_DEBUG,debugEnv=debugEnv.replace(/[|\\\\{}()[\\]^$+\?.]/g,\"\\\\$&\").replace(/\\*/g,\".*\").replace(/,/g,\"$|^\").toUpperCase(),debugEnvRegex=new RegExp(\"^\"+debugEnv+\"$\",\"i\");var debugEnv;function debuglog(set){if(set=set.toUpperCase(),!debugs[set])if(debugEnvRegex.test(set)){var pid=process.pid;debugs[set]=function(){var msg=format.apply(cjs_exports,arguments);console.error(\"%s %d: %s\",set,pid,msg)}}else debugs[set]=function(){};return debugs[set]}function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};if(arguments.length>=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean(opts))ctx.showHidden=opts;else if(opts)_extend(ctx,opts);if(isUndefined(ctx.showHidden))ctx.showHidden=!1;if(isUndefined(ctx.depth))ctx.depth=2;if(isUndefined(ctx.colors))ctx.colors=!1;if(isUndefined(ctx.customInspect))ctx.customInspect=!0;if(ctx.colors)ctx.stylize=stylizeWithColor;return formatValue(ctx,obj,ctx.depth)}inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},inspect.styles={special:\"cyan\",number:\"yellow\",boolean:\"yellow\",undefined:\"grey\",null:\"bold\",string:\"green\",date:\"magenta\",regexp:\"red\"};function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style)return\"\\x1B[\"+inspect.colors[style][0]+\"m\"+str+\"\\x1B[\"+inspect.colors[style][1]+\"m\";else return str}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};return array.forEach(function(val,idx){hash[val]=!0}),hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==inspect&&!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString(ret))ret=formatValue(ctx,ret,recurseTimes);return ret}var primitive=formatPrimitive(ctx,value);if(primitive)return primitive;var keys=Object.keys(value),visibleKeys=arrayToHash(keys);if(ctx.showHidden)keys=Object.getOwnPropertyNames(value);if(isError(value)&&(keys.indexOf(\"message\")>=0||keys.indexOf(\"description\")>=0))return formatError(value);if(keys.length===0){if(isFunction(value)){var name=value.name\?\": \"+value.name:\"\";return ctx.stylize(\"[Function\"+name+\"]\",\"special\")}if(isRegExp(value))return ctx.stylize(RegExp.prototype.toString.call(value),\"regexp\");if(isDate(value))return ctx.stylize(Date.prototype.toString.call(value),\"date\");if(isError(value))return formatError(value)}var base=\"\",array=!1,braces=[\"{\",\"}\"];if(@isArray(value))array=!0,braces=[\"[\",\"]\"];if(isFunction(value)){var n=value.name\?\": \"+value.name:\"\";base=\" [Function\"+n+\"]\"}if(isRegExp(value))base=\" \"+RegExp.prototype.toString.call(value);if(isDate(value))base=\" \"+Date.prototype.toUTCString.call(value);if(isError(value))base=\" \"+formatError(value);if(keys.length===0&&(!array||value.length==0))return braces[0]+base+braces[1];if(recurseTimes<0)if(isRegExp(value))return ctx.stylize(RegExp.prototype.toString.call(value),\"regexp\");else return ctx.stylize(\"[Object]\",\"special\");ctx.seen.push(value);var output;if(array)output=formatArray(ctx,value,recurseTimes,visibleKeys,keys);else output=keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)});return ctx.seen.pop(),reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize(\"undefined\",\"undefined\");if(isString(value)){var simple=\"'\"+JSON.stringify(value).replace(/^\"|\"$/g,\"\").replace(/'/g,\"\\\\'\").replace(/\\\\\"/g,'\"')+\"'\";return ctx.stylize(simple,\"string\")}if(isNumber(value))return ctx.stylize(\"\"+value,\"number\");if(isBoolean(value))return ctx.stylize(\"\"+value,\"boolean\");if(isNull(value))return ctx.stylize(\"null\",\"null\")}function formatError(value){return\"[\"+Error.prototype.toString.call(value)+\"]\"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i=0,l=value.length;i<l;++i)if(hasOwnProperty(value,String(i)))output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i),!0));else output.push(\"\");return keys.forEach(function(key){if(!key.match(/^\\d+$/))output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,!0))}),output}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;if(desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]},desc.get)if(desc.set)str=ctx.stylize(\"[Getter/Setter]\",\"special\");else str=ctx.stylize(\"[Getter]\",\"special\");else if(desc.set)str=ctx.stylize(\"[Setter]\",\"special\");if(!hasOwnProperty(visibleKeys,key))name=\"[\"+key+\"]\";if(!str)if(ctx.seen.indexOf(desc.value)<0){if(isNull(recurseTimes))str=formatValue(ctx,desc.value,null);else str=formatValue(ctx,desc.value,recurseTimes-1);if(str.indexOf(\"\\n\")>-1)if(array)str=str.split(\"\\n\").map(function(line){return\" \"+line}).join(\"\\n\").substr(2);else str=\"\\n\"+str.split(\"\\n\").map(function(line){return\" \"+line}).join(\"\\n\")}else str=ctx.stylize(\"[Circular]\",\"special\");if(isUndefined(name)){if(array&&key.match(/^\\d+$/))return str;if(name=JSON.stringify(\"\"+key),name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/))name=name.substr(1,name.length-2),name=ctx.stylize(name,\"name\");else name=name.replace(/'/g,\"\\\\'\").replace(/\\\\\"/g,'\"').replace(/(^\"|\"$)/g,\"'\"),name=ctx.stylize(name,\"string\")}return name+\": \"+str}function reduceToSingleString(output,base,braces){var numLinesEst=0,length=output.reduce(function(prev,cur){if(numLinesEst++,cur.indexOf(\"\\n\")>=0)numLinesEst++;return prev+cur.replace(/\\u001b\\[\\d\\d\?m/g,\"\").length+1},0);if(length>60)return braces[0]+(base===\"\"\?\"\":base+\"\\n \")+\" \"+output.join(\",\\n \")+\" \"+braces[1];return braces[0]+base+\" \"+output.join(\", \")+\" \"+braces[1]}function isBoolean(arg){return typeof arg===\"boolean\"}function isNull(arg){return arg===null}function isNullOrUndefined(arg){return arg==null}function isNumber(arg){return typeof arg===\"number\"}function isString(arg){return typeof arg===\"string\"}function isSymbol(arg){return typeof arg===\"symbol\"}function isUndefined(arg){return arg===void 0}var isRegExp=types.isRegExp;function isObject(arg){return typeof arg===\"object\"&&arg!==null}var{isDate,isNativeError:isError}=types;function isPrimitive(arg){return arg===null||typeof arg===\"boolean\"||typeof arg===\"number\"||typeof arg===\"string\"||typeof arg===\"symbol\"||typeof arg===\"undefined\"}function pad(n){return n<10\?\"0\"+n.toString(10):n.toString(10)}var months=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"];function timestamp(){var d=new Date,time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(\":\");return[d.getDate(),months[d.getMonth()],time].join(\" \")}var log=function log(){console.log(\"%s - %s\",timestamp(),format.apply(cjs_exports,arguments))},inherits=function inherits(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})},_extend=function(origin,add){if(!add||!isObject(add))return origin;var keys=Object.keys(add),i=keys.length;while(i--)origin[keys[i]]=add[keys[i]];return origin};function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}var kCustomPromisifiedSymbol=Symbol.for(\"util.promisify.custom\"),promisify=function promisify(original){if(typeof original!==\"function\")@throwTypeError('The \"original\" argument must be of type Function');if(kCustomPromisifiedSymbol&&original[kCustomPromisifiedSymbol]){var fn=original[kCustomPromisifiedSymbol];if(typeof fn!==\"function\")@throwTypeError('The \"util.promisify.custom\" argument must be of type Function');return Object.defineProperty(fn,kCustomPromisifiedSymbol,{value:fn,enumerable:!1,writable:!1,configurable:!0}),fn}function fn(){var promiseResolve,promiseReject,promise=new Promise(function(resolve,reject){promiseResolve=resolve,promiseReject=reject}),args=[];for(var i=0;i<arguments.length;i++)args.push(arguments[i]);args.push(function(err,value){if(err)promiseReject(err);else promiseResolve(value)});try{original.apply(this,args)}catch(err){promiseReject(err)}return promise}if(Object.setPrototypeOf(fn,Object.getPrototypeOf(original)),kCustomPromisifiedSymbol)Object.defineProperty(fn,kCustomPromisifiedSymbol,{value:fn,enumerable:!1,writable:!1,configurable:!0});return Object.defineProperties(fn,getOwnPropertyDescriptors(original))};promisify.custom=kCustomPromisifiedSymbol;function callbackifyOnRejected(reason,cb){if(!reason){var newReason=new Error(\"Promise was rejected with a falsy value\");newReason.reason=reason,newReason.code=\"ERR_FALSY_VALUE_REJECTION\",reason=newReason}return cb(reason)}function callbackify(original){if(typeof original!==\"function\")@throwTypeError('The \"original\" argument must be of type Function');function callbackified(){var args=Array.prototype.slice.call(arguments),maybeCb=args.pop();if(typeof maybeCb!==\"function\")@throwTypeError(\"The last argument must be of type Function\");var self=this,cb=function(){return maybeCb.apply(self,arguments)};original.apply(this,args).then(function(ret){process.nextTick(cb,null,ret)},function(rej){process.nextTick(callbackifyOnRejected,rej,cb)})}return Object.setPrototypeOf(callbackified,Object.getPrototypeOf(original)),Object.defineProperties(callbackified,getOwnPropertyDescriptors(original)),callbackified}var toUSVString=(input)=>{return(input+\"\").toWellFormed()};return Object.assign(cjs_exports,{format,formatWithOptions,deprecate,debuglog,_extend,inspect,types,isArray:@isArray,isBoolean,isNull,isNullOrUndefined,isNumber,isString,isSymbol,isUndefined,isRegExp,isObject,isDate,isFunction,isError,isPrimitive,isBuffer,log,inherits,toUSVString,promisify,callbackify,isDeepStrictEqual,TextDecoder,TextEncoder})})\n"_s; // // @@ -398,7 +398,7 @@ static constexpr ASCIILiteral NodeUrlCode = "(function (){\"use strict\";const{U // // -static constexpr ASCIILiteral NodeUtilCode = "(function (){\"use strict\";const types=@requireNativeModule(\"node:util/types\");var cjs_exports={};function isBufferInterface({copy,fill,readUint8}){return typeof copy===\"function\"&&typeof fill===\"function\"&&typeof readUint8===\"function\"}function isBuffer(value){return Buffer.isBuffer(value)||typeof value===\"object\"&&isBufferInterface(value||{})}function isFunction(value){return typeof value===\"function\"}const deepEquals=Bun.deepEquals,isDeepStrictEqual=(a,b)=>deepEquals(a,b,!0);var getOwnPropertyDescriptors=Object.getOwnPropertyDescriptors,formatRegExp=/%[sdjfoc%]/g;function formatWithOptions(inspectOptions,f){if(!isString(f)){var objects=[];for(var i=0;i<arguments.length;i++)objects.push(inspect(arguments[i],inspectOptions));return objects.join(\" \")}var i=2,args=arguments,len=args.length,str=String(f).replace(formatRegExp,function(x2){if(x2===\"%%\")return\"%\";if(i>=len)return x2;switch(x2){case\"%s\":return String(args[i++]);case\"%f\":case\"%d\":return Number(args[i++]);case\"%j\":try{return JSON.stringify(args[i++])}catch(_){return\"[Circular]\"}case\"%o\":return inspect(args[i++],{showHidden:!0,showProxy:!0,...inspectOptions});case\"%O\":return inspect(args[i++],{showHidden:!0,showProxy:!0,...inspectOptions});default:return x2}});for(var x=args[i];i<len;x=args[++i])if(isNull(x)||!isObject(x))str+=\" \"+x;else str+=\" \"+inspect(x,inspectOptions);return str}function format(...args){return formatWithOptions({},...args)}function deprecate(fn,msg,code){if(process.noDeprecation===!0)return fn;var warned=!1;function deprecated(){if(!warned){if(process.throwDeprecation){var err=new Error(msg);if(code)err.code=code;throw err}else if(process.traceDeprecation)console.trace(msg);else console.error(msg);warned=!0}return fn.apply(this,arguments)}return deprecated}var debugs={},debugEnvRegex=/^$/;if(process.env.NODE_DEBUG)debugEnv=process.env.NODE_DEBUG,debugEnv=debugEnv.replace(/[|\\\\{}()[\\]^$+\?.]/g,\"\\\\$&\").replace(/\\*/g,\".*\").replace(/,/g,\"$|^\").toUpperCase(),debugEnvRegex=new RegExp(\"^\"+debugEnv+\"$\",\"i\");var debugEnv;function debuglog(set){if(set=set.toUpperCase(),!debugs[set])if(debugEnvRegex.test(set)){var pid=process.pid;debugs[set]=function(){var msg=format.apply(cjs_exports,arguments);console.error(\"%s %d: %s\",set,pid,msg)}}else debugs[set]=function(){};return debugs[set]}function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};if(arguments.length>=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean(opts))ctx.showHidden=opts;else if(opts)_extend(ctx,opts);if(isUndefined(ctx.showHidden))ctx.showHidden=!1;if(isUndefined(ctx.depth))ctx.depth=2;if(isUndefined(ctx.colors))ctx.colors=!1;if(isUndefined(ctx.customInspect))ctx.customInspect=!0;if(ctx.colors)ctx.stylize=stylizeWithColor;return formatValue(ctx,obj,ctx.depth)}inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},inspect.styles={special:\"cyan\",number:\"yellow\",boolean:\"yellow\",undefined:\"grey\",null:\"bold\",string:\"green\",date:\"magenta\",regexp:\"red\"};function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style)return\"\\x1B[\"+inspect.colors[style][0]+\"m\"+str+\"\\x1B[\"+inspect.colors[style][1]+\"m\";else return str}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};return array.forEach(function(val,idx){hash[val]=!0}),hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==inspect&&!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString(ret))ret=formatValue(ctx,ret,recurseTimes);return ret}var primitive=formatPrimitive(ctx,value);if(primitive)return primitive;var keys=Object.keys(value),visibleKeys=arrayToHash(keys);if(ctx.showHidden)keys=Object.getOwnPropertyNames(value);if(isError(value)&&(keys.indexOf(\"message\")>=0||keys.indexOf(\"description\")>=0))return formatError(value);if(keys.length===0){if(isFunction(value)){var name=value.name\?\": \"+value.name:\"\";return ctx.stylize(\"[Function\"+name+\"]\",\"special\")}if(isRegExp(value))return ctx.stylize(RegExp.prototype.toString.call(value),\"regexp\");if(isDate(value))return ctx.stylize(Date.prototype.toString.call(value),\"date\");if(isError(value))return formatError(value)}var base=\"\",array=!1,braces=[\"{\",\"}\"];if(@isArray(value))array=!0,braces=[\"[\",\"]\"];if(isFunction(value)){var n=value.name\?\": \"+value.name:\"\";base=\" [Function\"+n+\"]\"}if(isRegExp(value))base=\" \"+RegExp.prototype.toString.call(value);if(isDate(value))base=\" \"+Date.prototype.toUTCString.call(value);if(isError(value))base=\" \"+formatError(value);if(keys.length===0&&(!array||value.length==0))return braces[0]+base+braces[1];if(recurseTimes<0)if(isRegExp(value))return ctx.stylize(RegExp.prototype.toString.call(value),\"regexp\");else return ctx.stylize(\"[Object]\",\"special\");ctx.seen.push(value);var output;if(array)output=formatArray(ctx,value,recurseTimes,visibleKeys,keys);else output=keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)});return ctx.seen.pop(),reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize(\"undefined\",\"undefined\");if(isString(value)){var simple=\"'\"+JSON.stringify(value).replace(/^\"|\"$/g,\"\").replace(/'/g,\"\\\\'\").replace(/\\\\\"/g,'\"')+\"'\";return ctx.stylize(simple,\"string\")}if(isNumber(value))return ctx.stylize(\"\"+value,\"number\");if(isBoolean(value))return ctx.stylize(\"\"+value,\"boolean\");if(isNull(value))return ctx.stylize(\"null\",\"null\")}function formatError(value){return\"[\"+Error.prototype.toString.call(value)+\"]\"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i=0,l=value.length;i<l;++i)if(hasOwnProperty(value,String(i)))output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i),!0));else output.push(\"\");return keys.forEach(function(key){if(!key.match(/^\\d+$/))output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,!0))}),output}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;if(desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]},desc.get)if(desc.set)str=ctx.stylize(\"[Getter/Setter]\",\"special\");else str=ctx.stylize(\"[Getter]\",\"special\");else if(desc.set)str=ctx.stylize(\"[Setter]\",\"special\");if(!hasOwnProperty(visibleKeys,key))name=\"[\"+key+\"]\";if(!str)if(ctx.seen.indexOf(desc.value)<0){if(isNull(recurseTimes))str=formatValue(ctx,desc.value,null);else str=formatValue(ctx,desc.value,recurseTimes-1);if(str.indexOf(\"\\n\")>-1)if(array)str=str.split(\"\\n\").map(function(line){return\" \"+line}).join(\"\\n\").substr(2);else str=\"\\n\"+str.split(\"\\n\").map(function(line){return\" \"+line}).join(\"\\n\")}else str=ctx.stylize(\"[Circular]\",\"special\");if(isUndefined(name)){if(array&&key.match(/^\\d+$/))return str;if(name=JSON.stringify(\"\"+key),name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/))name=name.substr(1,name.length-2),name=ctx.stylize(name,\"name\");else name=name.replace(/'/g,\"\\\\'\").replace(/\\\\\"/g,'\"').replace(/(^\"|\"$)/g,\"'\"),name=ctx.stylize(name,\"string\")}return name+\": \"+str}function reduceToSingleString(output,base,braces){var numLinesEst=0,length=output.reduce(function(prev,cur){if(numLinesEst++,cur.indexOf(\"\\n\")>=0)numLinesEst++;return prev+cur.replace(/\\u001b\\[\\d\\d\?m/g,\"\").length+1},0);if(length>60)return braces[0]+(base===\"\"\?\"\":base+\"\\n \")+\" \"+output.join(\",\\n \")+\" \"+braces[1];return braces[0]+base+\" \"+output.join(\", \")+\" \"+braces[1]}function isBoolean(arg){return typeof arg===\"boolean\"}function isNull(arg){return arg===null}function isNullOrUndefined(arg){return arg==null}function isNumber(arg){return typeof arg===\"number\"}function isString(arg){return typeof arg===\"string\"}function isSymbol(arg){return typeof arg===\"symbol\"}function isUndefined(arg){return arg===void 0}var isRegExp=types.isRegExp;function isObject(arg){return typeof arg===\"object\"&&arg!==null}var{isDate,isNativeError:isError}=types;function isPrimitive(arg){return arg===null||typeof arg===\"boolean\"||typeof arg===\"number\"||typeof arg===\"string\"||typeof arg===\"symbol\"||typeof arg===\"undefined\"}function pad(n){return n<10\?\"0\"+n.toString(10):n.toString(10)}var months=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"];function timestamp(){var d=new Date,time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(\":\");return[d.getDate(),months[d.getMonth()],time].join(\" \")}var log=function log(){console.log(\"%s - %s\",timestamp(),format.apply(cjs_exports,arguments))},inherits=function inherits(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})},_extend=function(origin,add){if(!add||!isObject(add))return origin;var keys=Object.keys(add),i=keys.length;while(i--)origin[keys[i]]=add[keys[i]];return origin};function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}var kCustomPromisifiedSymbol=Symbol.for(\"util.promisify.custom\"),promisify=function promisify(original){if(typeof original!==\"function\")@throwTypeError('The \"original\" argument must be of type Function');if(kCustomPromisifiedSymbol&&original[kCustomPromisifiedSymbol]){var fn=original[kCustomPromisifiedSymbol];if(typeof fn!==\"function\")@throwTypeError('The \"util.promisify.custom\" argument must be of type Function');return Object.defineProperty(fn,kCustomPromisifiedSymbol,{value:fn,enumerable:!1,writable:!1,configurable:!0}),fn}function fn(){var promiseResolve,promiseReject,promise=new Promise(function(resolve,reject){promiseResolve=resolve,promiseReject=reject}),args=[];for(var i=0;i<arguments.length;i++)args.push(arguments[i]);args.push(function(err,value){if(err)promiseReject(err);else promiseResolve(value)});try{original.apply(this,args)}catch(err){promiseReject(err)}return promise}if(Object.setPrototypeOf(fn,Object.getPrototypeOf(original)),kCustomPromisifiedSymbol)Object.defineProperty(fn,kCustomPromisifiedSymbol,{value:fn,enumerable:!1,writable:!1,configurable:!0});return Object.defineProperties(fn,getOwnPropertyDescriptors(original))};promisify.custom=kCustomPromisifiedSymbol;function callbackifyOnRejected(reason,cb){if(!reason){var newReason=new Error(\"Promise was rejected with a falsy value\");newReason.reason=reason,newReason.code=\"ERR_FALSY_VALUE_REJECTION\",reason=newReason}return cb(reason)}function callbackify(original){if(typeof original!==\"function\")@throwTypeError('The \"original\" argument must be of type Function');function callbackified(){var args=Array.prototype.slice.call(arguments),maybeCb=args.pop();if(typeof maybeCb!==\"function\")@throwTypeError(\"The last argument must be of type Function\");var self=this,cb=function(){return maybeCb.apply(self,arguments)};original.apply(this,args).then(function(ret){process.nextTick(cb,null,ret)},function(rej){process.nextTick(callbackifyOnRejected,rej,cb)})}return Object.setPrototypeOf(callbackified,Object.getPrototypeOf(original)),Object.defineProperties(callbackified,getOwnPropertyDescriptors(original)),callbackified}var toUSVString=(input)=>{return(input+\"\").toWellFormed()};return Object.assign(cjs_exports,{format,formatWithOptions,deprecate,debuglog,_extend,inspect,types,isArray:@isArray,isBoolean,isNull,isNullOrUndefined,isNumber,isString,isSymbol,isUndefined,isRegExp,isObject,isDate,isFunction,isError,isPrimitive,isBuffer,log,inherits,toUSVString,promisify,callbackify,isDeepStrictEqual,TextDecoder,TextEncoder})})\n"_s; +static constexpr ASCIILiteral NodeUtilCode = "(function (){\"use strict\";const types=@requireNativeModule(\"node:util/types\");var cjs_exports={};function isBufferInterface({copy,fill,readUint8}){return typeof copy===\"function\"&&typeof fill===\"function\"&&typeof readUint8===\"function\"}function isBuffer(value){return Buffer.isBuffer(value)||typeof value===\"object\"&&isBufferInterface(value||{})}function isFunction(value){return typeof value===\"function\"}const deepEquals=Bun.deepEquals,isDeepStrictEqual=(a,b)=>deepEquals(a,b,!0);var getOwnPropertyDescriptors=Object.getOwnPropertyDescriptors,formatRegExp=/%[sdjfoc%]/g;function formatWithOptions(inspectOptions,f){if(!isString(f)){var objects=[];for(var i=0;i<arguments.length;i++)objects.push(inspect(arguments[i],inspectOptions));return objects.join(\" \")}var i=2,args=arguments,len=args.length,str=String(f).replace(formatRegExp,function(x2){if(x2===\"%%\")return\"%\";if(i>=len)return x2;switch(x2){case\"%s\":return String(args[i++]);case\"%f\":return Number(args[i++]);case\"%d\":return Math.round(Number(args[i++]));case\"%j\":try{return JSON.stringify(args[i++])}catch(_){return\"[Circular]\"}case\"%o\":return inspect(args[i++],{showHidden:!0,showProxy:!0,...inspectOptions});case\"%O\":return inspect(args[i++],{showHidden:!0,showProxy:!0,...inspectOptions});default:return x2}});for(var x=args[i];i<len;x=args[++i])if(isNull(x)||!isObject(x))str+=\" \"+x;else str+=\" \"+inspect(x,inspectOptions);return str}function format(...args){return formatWithOptions({},...args)}function deprecate(fn,msg,code){if(process.noDeprecation===!0)return fn;var warned=!1;function deprecated(){if(!warned){if(process.throwDeprecation){var err=new Error(msg);if(code)err.code=code;throw err}else if(process.traceDeprecation)console.trace(msg);else console.error(msg);warned=!0}return fn.apply(this,arguments)}return deprecated}var debugs={},debugEnvRegex=/^$/;if(process.env.NODE_DEBUG)debugEnv=process.env.NODE_DEBUG,debugEnv=debugEnv.replace(/[|\\\\{}()[\\]^$+\?.]/g,\"\\\\$&\").replace(/\\*/g,\".*\").replace(/,/g,\"$|^\").toUpperCase(),debugEnvRegex=new RegExp(\"^\"+debugEnv+\"$\",\"i\");var debugEnv;function debuglog(set){if(set=set.toUpperCase(),!debugs[set])if(debugEnvRegex.test(set)){var pid=process.pid;debugs[set]=function(){var msg=format.apply(cjs_exports,arguments);console.error(\"%s %d: %s\",set,pid,msg)}}else debugs[set]=function(){};return debugs[set]}function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};if(arguments.length>=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean(opts))ctx.showHidden=opts;else if(opts)_extend(ctx,opts);if(isUndefined(ctx.showHidden))ctx.showHidden=!1;if(isUndefined(ctx.depth))ctx.depth=2;if(isUndefined(ctx.colors))ctx.colors=!1;if(isUndefined(ctx.customInspect))ctx.customInspect=!0;if(ctx.colors)ctx.stylize=stylizeWithColor;return formatValue(ctx,obj,ctx.depth)}inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},inspect.styles={special:\"cyan\",number:\"yellow\",boolean:\"yellow\",undefined:\"grey\",null:\"bold\",string:\"green\",date:\"magenta\",regexp:\"red\"};function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style)return\"\\x1B[\"+inspect.colors[style][0]+\"m\"+str+\"\\x1B[\"+inspect.colors[style][1]+\"m\";else return str}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};return array.forEach(function(val,idx){hash[val]=!0}),hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==inspect&&!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString(ret))ret=formatValue(ctx,ret,recurseTimes);return ret}var primitive=formatPrimitive(ctx,value);if(primitive)return primitive;var keys=Object.keys(value),visibleKeys=arrayToHash(keys);if(ctx.showHidden)keys=Object.getOwnPropertyNames(value);if(isError(value)&&(keys.indexOf(\"message\")>=0||keys.indexOf(\"description\")>=0))return formatError(value);if(keys.length===0){if(isFunction(value)){var name=value.name\?\": \"+value.name:\"\";return ctx.stylize(\"[Function\"+name+\"]\",\"special\")}if(isRegExp(value))return ctx.stylize(RegExp.prototype.toString.call(value),\"regexp\");if(isDate(value))return ctx.stylize(Date.prototype.toString.call(value),\"date\");if(isError(value))return formatError(value)}var base=\"\",array=!1,braces=[\"{\",\"}\"];if(@isArray(value))array=!0,braces=[\"[\",\"]\"];if(isFunction(value)){var n=value.name\?\": \"+value.name:\"\";base=\" [Function\"+n+\"]\"}if(isRegExp(value))base=\" \"+RegExp.prototype.toString.call(value);if(isDate(value))base=\" \"+Date.prototype.toUTCString.call(value);if(isError(value))base=\" \"+formatError(value);if(keys.length===0&&(!array||value.length==0))return braces[0]+base+braces[1];if(recurseTimes<0)if(isRegExp(value))return ctx.stylize(RegExp.prototype.toString.call(value),\"regexp\");else return ctx.stylize(\"[Object]\",\"special\");ctx.seen.push(value);var output;if(array)output=formatArray(ctx,value,recurseTimes,visibleKeys,keys);else output=keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)});return ctx.seen.pop(),reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize(\"undefined\",\"undefined\");if(isString(value)){var simple=\"'\"+JSON.stringify(value).replace(/^\"|\"$/g,\"\").replace(/'/g,\"\\\\'\").replace(/\\\\\"/g,'\"')+\"'\";return ctx.stylize(simple,\"string\")}if(isNumber(value))return ctx.stylize(\"\"+value,\"number\");if(isBoolean(value))return ctx.stylize(\"\"+value,\"boolean\");if(isNull(value))return ctx.stylize(\"null\",\"null\")}function formatError(value){return\"[\"+Error.prototype.toString.call(value)+\"]\"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i=0,l=value.length;i<l;++i)if(hasOwnProperty(value,String(i)))output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i),!0));else output.push(\"\");return keys.forEach(function(key){if(!key.match(/^\\d+$/))output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,!0))}),output}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;if(desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]},desc.get)if(desc.set)str=ctx.stylize(\"[Getter/Setter]\",\"special\");else str=ctx.stylize(\"[Getter]\",\"special\");else if(desc.set)str=ctx.stylize(\"[Setter]\",\"special\");if(!hasOwnProperty(visibleKeys,key))name=\"[\"+key+\"]\";if(!str)if(ctx.seen.indexOf(desc.value)<0){if(isNull(recurseTimes))str=formatValue(ctx,desc.value,null);else str=formatValue(ctx,desc.value,recurseTimes-1);if(str.indexOf(\"\\n\")>-1)if(array)str=str.split(\"\\n\").map(function(line){return\" \"+line}).join(\"\\n\").substr(2);else str=\"\\n\"+str.split(\"\\n\").map(function(line){return\" \"+line}).join(\"\\n\")}else str=ctx.stylize(\"[Circular]\",\"special\");if(isUndefined(name)){if(array&&key.match(/^\\d+$/))return str;if(name=JSON.stringify(\"\"+key),name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/))name=name.substr(1,name.length-2),name=ctx.stylize(name,\"name\");else name=name.replace(/'/g,\"\\\\'\").replace(/\\\\\"/g,'\"').replace(/(^\"|\"$)/g,\"'\"),name=ctx.stylize(name,\"string\")}return name+\": \"+str}function reduceToSingleString(output,base,braces){var numLinesEst=0,length=output.reduce(function(prev,cur){if(numLinesEst++,cur.indexOf(\"\\n\")>=0)numLinesEst++;return prev+cur.replace(/\\u001b\\[\\d\\d\?m/g,\"\").length+1},0);if(length>60)return braces[0]+(base===\"\"\?\"\":base+\"\\n \")+\" \"+output.join(\",\\n \")+\" \"+braces[1];return braces[0]+base+\" \"+output.join(\", \")+\" \"+braces[1]}function isBoolean(arg){return typeof arg===\"boolean\"}function isNull(arg){return arg===null}function isNullOrUndefined(arg){return arg==null}function isNumber(arg){return typeof arg===\"number\"}function isString(arg){return typeof arg===\"string\"}function isSymbol(arg){return typeof arg===\"symbol\"}function isUndefined(arg){return arg===void 0}var isRegExp=types.isRegExp;function isObject(arg){return typeof arg===\"object\"&&arg!==null}var{isDate,isNativeError:isError}=types;function isPrimitive(arg){return arg===null||typeof arg===\"boolean\"||typeof arg===\"number\"||typeof arg===\"string\"||typeof arg===\"symbol\"||typeof arg===\"undefined\"}function pad(n){return n<10\?\"0\"+n.toString(10):n.toString(10)}var months=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"];function timestamp(){var d=new Date,time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(\":\");return[d.getDate(),months[d.getMonth()],time].join(\" \")}var log=function log(){console.log(\"%s - %s\",timestamp(),format.apply(cjs_exports,arguments))},inherits=function inherits(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})},_extend=function(origin,add){if(!add||!isObject(add))return origin;var keys=Object.keys(add),i=keys.length;while(i--)origin[keys[i]]=add[keys[i]];return origin};function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}var kCustomPromisifiedSymbol=Symbol.for(\"util.promisify.custom\"),promisify=function promisify(original){if(typeof original!==\"function\")@throwTypeError('The \"original\" argument must be of type Function');if(kCustomPromisifiedSymbol&&original[kCustomPromisifiedSymbol]){var fn=original[kCustomPromisifiedSymbol];if(typeof fn!==\"function\")@throwTypeError('The \"util.promisify.custom\" argument must be of type Function');return Object.defineProperty(fn,kCustomPromisifiedSymbol,{value:fn,enumerable:!1,writable:!1,configurable:!0}),fn}function fn(){var promiseResolve,promiseReject,promise=new Promise(function(resolve,reject){promiseResolve=resolve,promiseReject=reject}),args=[];for(var i=0;i<arguments.length;i++)args.push(arguments[i]);args.push(function(err,value){if(err)promiseReject(err);else promiseResolve(value)});try{original.apply(this,args)}catch(err){promiseReject(err)}return promise}if(Object.setPrototypeOf(fn,Object.getPrototypeOf(original)),kCustomPromisifiedSymbol)Object.defineProperty(fn,kCustomPromisifiedSymbol,{value:fn,enumerable:!1,writable:!1,configurable:!0});return Object.defineProperties(fn,getOwnPropertyDescriptors(original))};promisify.custom=kCustomPromisifiedSymbol;function callbackifyOnRejected(reason,cb){if(!reason){var newReason=new Error(\"Promise was rejected with a falsy value\");newReason.reason=reason,newReason.code=\"ERR_FALSY_VALUE_REJECTION\",reason=newReason}return cb(reason)}function callbackify(original){if(typeof original!==\"function\")@throwTypeError('The \"original\" argument must be of type Function');function callbackified(){var args=Array.prototype.slice.call(arguments),maybeCb=args.pop();if(typeof maybeCb!==\"function\")@throwTypeError(\"The last argument must be of type Function\");var self=this,cb=function(){return maybeCb.apply(self,arguments)};original.apply(this,args).then(function(ret){process.nextTick(cb,null,ret)},function(rej){process.nextTick(callbackifyOnRejected,rej,cb)})}return Object.setPrototypeOf(callbackified,Object.getPrototypeOf(original)),Object.defineProperties(callbackified,getOwnPropertyDescriptors(original)),callbackified}var toUSVString=(input)=>{return(input+\"\").toWellFormed()};return Object.assign(cjs_exports,{format,formatWithOptions,deprecate,debuglog,_extend,inspect,types,isArray:@isArray,isBoolean,isNull,isNullOrUndefined,isNumber,isString,isSymbol,isUndefined,isRegExp,isObject,isDate,isFunction,isError,isPrimitive,isBuffer,log,inherits,toUSVString,promisify,callbackify,isDeepStrictEqual,TextDecoder,TextEncoder})})\n"_s; // // @@ -624,7 +624,7 @@ static constexpr ASCIILiteral NodeUrlCode = "(function (){\"use strict\";const{U // // -static constexpr ASCIILiteral NodeUtilCode = "(function (){\"use strict\";const types=@requireNativeModule(\"node:util/types\");var cjs_exports={};function isBufferInterface({copy,fill,readUint8}){return typeof copy===\"function\"&&typeof fill===\"function\"&&typeof readUint8===\"function\"}function isBuffer(value){return Buffer.isBuffer(value)||typeof value===\"object\"&&isBufferInterface(value||{})}function isFunction(value){return typeof value===\"function\"}const deepEquals=Bun.deepEquals,isDeepStrictEqual=(a,b)=>deepEquals(a,b,!0);var getOwnPropertyDescriptors=Object.getOwnPropertyDescriptors,formatRegExp=/%[sdjfoc%]/g;function formatWithOptions(inspectOptions,f){if(!isString(f)){var objects=[];for(var i=0;i<arguments.length;i++)objects.push(inspect(arguments[i],inspectOptions));return objects.join(\" \")}var i=2,args=arguments,len=args.length,str=String(f).replace(formatRegExp,function(x2){if(x2===\"%%\")return\"%\";if(i>=len)return x2;switch(x2){case\"%s\":return String(args[i++]);case\"%f\":case\"%d\":return Number(args[i++]);case\"%j\":try{return JSON.stringify(args[i++])}catch(_){return\"[Circular]\"}case\"%o\":return inspect(args[i++],{showHidden:!0,showProxy:!0,...inspectOptions});case\"%O\":return inspect(args[i++],{showHidden:!0,showProxy:!0,...inspectOptions});default:return x2}});for(var x=args[i];i<len;x=args[++i])if(isNull(x)||!isObject(x))str+=\" \"+x;else str+=\" \"+inspect(x,inspectOptions);return str}function format(...args){return formatWithOptions({},...args)}function deprecate(fn,msg,code){if(process.noDeprecation===!0)return fn;var warned=!1;function deprecated(){if(!warned){if(process.throwDeprecation){var err=new Error(msg);if(code)err.code=code;throw err}else if(process.traceDeprecation)console.trace(msg);else console.error(msg);warned=!0}return fn.apply(this,arguments)}return deprecated}var debugs={},debugEnvRegex=/^$/;if(process.env.NODE_DEBUG)debugEnv=process.env.NODE_DEBUG,debugEnv=debugEnv.replace(/[|\\\\{}()[\\]^$+\?.]/g,\"\\\\$&\").replace(/\\*/g,\".*\").replace(/,/g,\"$|^\").toUpperCase(),debugEnvRegex=new RegExp(\"^\"+debugEnv+\"$\",\"i\");var debugEnv;function debuglog(set){if(set=set.toUpperCase(),!debugs[set])if(debugEnvRegex.test(set)){var pid=process.pid;debugs[set]=function(){var msg=format.apply(cjs_exports,arguments);console.error(\"%s %d: %s\",set,pid,msg)}}else debugs[set]=function(){};return debugs[set]}function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};if(arguments.length>=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean(opts))ctx.showHidden=opts;else if(opts)_extend(ctx,opts);if(isUndefined(ctx.showHidden))ctx.showHidden=!1;if(isUndefined(ctx.depth))ctx.depth=2;if(isUndefined(ctx.colors))ctx.colors=!1;if(isUndefined(ctx.customInspect))ctx.customInspect=!0;if(ctx.colors)ctx.stylize=stylizeWithColor;return formatValue(ctx,obj,ctx.depth)}inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},inspect.styles={special:\"cyan\",number:\"yellow\",boolean:\"yellow\",undefined:\"grey\",null:\"bold\",string:\"green\",date:\"magenta\",regexp:\"red\"};function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style)return\"\\x1B[\"+inspect.colors[style][0]+\"m\"+str+\"\\x1B[\"+inspect.colors[style][1]+\"m\";else return str}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};return array.forEach(function(val,idx){hash[val]=!0}),hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==inspect&&!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString(ret))ret=formatValue(ctx,ret,recurseTimes);return ret}var primitive=formatPrimitive(ctx,value);if(primitive)return primitive;var keys=Object.keys(value),visibleKeys=arrayToHash(keys);if(ctx.showHidden)keys=Object.getOwnPropertyNames(value);if(isError(value)&&(keys.indexOf(\"message\")>=0||keys.indexOf(\"description\")>=0))return formatError(value);if(keys.length===0){if(isFunction(value)){var name=value.name\?\": \"+value.name:\"\";return ctx.stylize(\"[Function\"+name+\"]\",\"special\")}if(isRegExp(value))return ctx.stylize(RegExp.prototype.toString.call(value),\"regexp\");if(isDate(value))return ctx.stylize(Date.prototype.toString.call(value),\"date\");if(isError(value))return formatError(value)}var base=\"\",array=!1,braces=[\"{\",\"}\"];if(@isArray(value))array=!0,braces=[\"[\",\"]\"];if(isFunction(value)){var n=value.name\?\": \"+value.name:\"\";base=\" [Function\"+n+\"]\"}if(isRegExp(value))base=\" \"+RegExp.prototype.toString.call(value);if(isDate(value))base=\" \"+Date.prototype.toUTCString.call(value);if(isError(value))base=\" \"+formatError(value);if(keys.length===0&&(!array||value.length==0))return braces[0]+base+braces[1];if(recurseTimes<0)if(isRegExp(value))return ctx.stylize(RegExp.prototype.toString.call(value),\"regexp\");else return ctx.stylize(\"[Object]\",\"special\");ctx.seen.push(value);var output;if(array)output=formatArray(ctx,value,recurseTimes,visibleKeys,keys);else output=keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)});return ctx.seen.pop(),reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize(\"undefined\",\"undefined\");if(isString(value)){var simple=\"'\"+JSON.stringify(value).replace(/^\"|\"$/g,\"\").replace(/'/g,\"\\\\'\").replace(/\\\\\"/g,'\"')+\"'\";return ctx.stylize(simple,\"string\")}if(isNumber(value))return ctx.stylize(\"\"+value,\"number\");if(isBoolean(value))return ctx.stylize(\"\"+value,\"boolean\");if(isNull(value))return ctx.stylize(\"null\",\"null\")}function formatError(value){return\"[\"+Error.prototype.toString.call(value)+\"]\"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i=0,l=value.length;i<l;++i)if(hasOwnProperty(value,String(i)))output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i),!0));else output.push(\"\");return keys.forEach(function(key){if(!key.match(/^\\d+$/))output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,!0))}),output}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;if(desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]},desc.get)if(desc.set)str=ctx.stylize(\"[Getter/Setter]\",\"special\");else str=ctx.stylize(\"[Getter]\",\"special\");else if(desc.set)str=ctx.stylize(\"[Setter]\",\"special\");if(!hasOwnProperty(visibleKeys,key))name=\"[\"+key+\"]\";if(!str)if(ctx.seen.indexOf(desc.value)<0){if(isNull(recurseTimes))str=formatValue(ctx,desc.value,null);else str=formatValue(ctx,desc.value,recurseTimes-1);if(str.indexOf(\"\\n\")>-1)if(array)str=str.split(\"\\n\").map(function(line){return\" \"+line}).join(\"\\n\").substr(2);else str=\"\\n\"+str.split(\"\\n\").map(function(line){return\" \"+line}).join(\"\\n\")}else str=ctx.stylize(\"[Circular]\",\"special\");if(isUndefined(name)){if(array&&key.match(/^\\d+$/))return str;if(name=JSON.stringify(\"\"+key),name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/))name=name.substr(1,name.length-2),name=ctx.stylize(name,\"name\");else name=name.replace(/'/g,\"\\\\'\").replace(/\\\\\"/g,'\"').replace(/(^\"|\"$)/g,\"'\"),name=ctx.stylize(name,\"string\")}return name+\": \"+str}function reduceToSingleString(output,base,braces){var numLinesEst=0,length=output.reduce(function(prev,cur){if(numLinesEst++,cur.indexOf(\"\\n\")>=0)numLinesEst++;return prev+cur.replace(/\\u001b\\[\\d\\d\?m/g,\"\").length+1},0);if(length>60)return braces[0]+(base===\"\"\?\"\":base+\"\\n \")+\" \"+output.join(\",\\n \")+\" \"+braces[1];return braces[0]+base+\" \"+output.join(\", \")+\" \"+braces[1]}function isBoolean(arg){return typeof arg===\"boolean\"}function isNull(arg){return arg===null}function isNullOrUndefined(arg){return arg==null}function isNumber(arg){return typeof arg===\"number\"}function isString(arg){return typeof arg===\"string\"}function isSymbol(arg){return typeof arg===\"symbol\"}function isUndefined(arg){return arg===void 0}var isRegExp=types.isRegExp;function isObject(arg){return typeof arg===\"object\"&&arg!==null}var{isDate,isNativeError:isError}=types;function isPrimitive(arg){return arg===null||typeof arg===\"boolean\"||typeof arg===\"number\"||typeof arg===\"string\"||typeof arg===\"symbol\"||typeof arg===\"undefined\"}function pad(n){return n<10\?\"0\"+n.toString(10):n.toString(10)}var months=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"];function timestamp(){var d=new Date,time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(\":\");return[d.getDate(),months[d.getMonth()],time].join(\" \")}var log=function log(){console.log(\"%s - %s\",timestamp(),format.apply(cjs_exports,arguments))},inherits=function inherits(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})},_extend=function(origin,add){if(!add||!isObject(add))return origin;var keys=Object.keys(add),i=keys.length;while(i--)origin[keys[i]]=add[keys[i]];return origin};function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}var kCustomPromisifiedSymbol=Symbol.for(\"util.promisify.custom\"),promisify=function promisify(original){if(typeof original!==\"function\")@throwTypeError('The \"original\" argument must be of type Function');if(kCustomPromisifiedSymbol&&original[kCustomPromisifiedSymbol]){var fn=original[kCustomPromisifiedSymbol];if(typeof fn!==\"function\")@throwTypeError('The \"util.promisify.custom\" argument must be of type Function');return Object.defineProperty(fn,kCustomPromisifiedSymbol,{value:fn,enumerable:!1,writable:!1,configurable:!0}),fn}function fn(){var promiseResolve,promiseReject,promise=new Promise(function(resolve,reject){promiseResolve=resolve,promiseReject=reject}),args=[];for(var i=0;i<arguments.length;i++)args.push(arguments[i]);args.push(function(err,value){if(err)promiseReject(err);else promiseResolve(value)});try{original.apply(this,args)}catch(err){promiseReject(err)}return promise}if(Object.setPrototypeOf(fn,Object.getPrototypeOf(original)),kCustomPromisifiedSymbol)Object.defineProperty(fn,kCustomPromisifiedSymbol,{value:fn,enumerable:!1,writable:!1,configurable:!0});return Object.defineProperties(fn,getOwnPropertyDescriptors(original))};promisify.custom=kCustomPromisifiedSymbol;function callbackifyOnRejected(reason,cb){if(!reason){var newReason=new Error(\"Promise was rejected with a falsy value\");newReason.reason=reason,newReason.code=\"ERR_FALSY_VALUE_REJECTION\",reason=newReason}return cb(reason)}function callbackify(original){if(typeof original!==\"function\")@throwTypeError('The \"original\" argument must be of type Function');function callbackified(){var args=Array.prototype.slice.call(arguments),maybeCb=args.pop();if(typeof maybeCb!==\"function\")@throwTypeError(\"The last argument must be of type Function\");var self=this,cb=function(){return maybeCb.apply(self,arguments)};original.apply(this,args).then(function(ret){process.nextTick(cb,null,ret)},function(rej){process.nextTick(callbackifyOnRejected,rej,cb)})}return Object.setPrototypeOf(callbackified,Object.getPrototypeOf(original)),Object.defineProperties(callbackified,getOwnPropertyDescriptors(original)),callbackified}var toUSVString=(input)=>{return(input+\"\").toWellFormed()};return Object.assign(cjs_exports,{format,formatWithOptions,deprecate,debuglog,_extend,inspect,types,isArray:@isArray,isBoolean,isNull,isNullOrUndefined,isNumber,isString,isSymbol,isUndefined,isRegExp,isObject,isDate,isFunction,isError,isPrimitive,isBuffer,log,inherits,toUSVString,promisify,callbackify,isDeepStrictEqual,TextDecoder,TextEncoder})})\n"_s; +static constexpr ASCIILiteral NodeUtilCode = "(function (){\"use strict\";const types=@requireNativeModule(\"node:util/types\");var cjs_exports={};function isBufferInterface({copy,fill,readUint8}){return typeof copy===\"function\"&&typeof fill===\"function\"&&typeof readUint8===\"function\"}function isBuffer(value){return Buffer.isBuffer(value)||typeof value===\"object\"&&isBufferInterface(value||{})}function isFunction(value){return typeof value===\"function\"}const deepEquals=Bun.deepEquals,isDeepStrictEqual=(a,b)=>deepEquals(a,b,!0);var getOwnPropertyDescriptors=Object.getOwnPropertyDescriptors,formatRegExp=/%[sdjfoc%]/g;function formatWithOptions(inspectOptions,f){if(!isString(f)){var objects=[];for(var i=0;i<arguments.length;i++)objects.push(inspect(arguments[i],inspectOptions));return objects.join(\" \")}var i=2,args=arguments,len=args.length,str=String(f).replace(formatRegExp,function(x2){if(x2===\"%%\")return\"%\";if(i>=len)return x2;switch(x2){case\"%s\":return String(args[i++]);case\"%f\":return Number(args[i++]);case\"%d\":return Math.round(Number(args[i++]));case\"%j\":try{return JSON.stringify(args[i++])}catch(_){return\"[Circular]\"}case\"%o\":return inspect(args[i++],{showHidden:!0,showProxy:!0,...inspectOptions});case\"%O\":return inspect(args[i++],{showHidden:!0,showProxy:!0,...inspectOptions});default:return x2}});for(var x=args[i];i<len;x=args[++i])if(isNull(x)||!isObject(x))str+=\" \"+x;else str+=\" \"+inspect(x,inspectOptions);return str}function format(...args){return formatWithOptions({},...args)}function deprecate(fn,msg,code){if(process.noDeprecation===!0)return fn;var warned=!1;function deprecated(){if(!warned){if(process.throwDeprecation){var err=new Error(msg);if(code)err.code=code;throw err}else if(process.traceDeprecation)console.trace(msg);else console.error(msg);warned=!0}return fn.apply(this,arguments)}return deprecated}var debugs={},debugEnvRegex=/^$/;if(process.env.NODE_DEBUG)debugEnv=process.env.NODE_DEBUG,debugEnv=debugEnv.replace(/[|\\\\{}()[\\]^$+\?.]/g,\"\\\\$&\").replace(/\\*/g,\".*\").replace(/,/g,\"$|^\").toUpperCase(),debugEnvRegex=new RegExp(\"^\"+debugEnv+\"$\",\"i\");var debugEnv;function debuglog(set){if(set=set.toUpperCase(),!debugs[set])if(debugEnvRegex.test(set)){var pid=process.pid;debugs[set]=function(){var msg=format.apply(cjs_exports,arguments);console.error(\"%s %d: %s\",set,pid,msg)}}else debugs[set]=function(){};return debugs[set]}function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};if(arguments.length>=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean(opts))ctx.showHidden=opts;else if(opts)_extend(ctx,opts);if(isUndefined(ctx.showHidden))ctx.showHidden=!1;if(isUndefined(ctx.depth))ctx.depth=2;if(isUndefined(ctx.colors))ctx.colors=!1;if(isUndefined(ctx.customInspect))ctx.customInspect=!0;if(ctx.colors)ctx.stylize=stylizeWithColor;return formatValue(ctx,obj,ctx.depth)}inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},inspect.styles={special:\"cyan\",number:\"yellow\",boolean:\"yellow\",undefined:\"grey\",null:\"bold\",string:\"green\",date:\"magenta\",regexp:\"red\"};function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style)return\"\\x1B[\"+inspect.colors[style][0]+\"m\"+str+\"\\x1B[\"+inspect.colors[style][1]+\"m\";else return str}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};return array.forEach(function(val,idx){hash[val]=!0}),hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==inspect&&!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString(ret))ret=formatValue(ctx,ret,recurseTimes);return ret}var primitive=formatPrimitive(ctx,value);if(primitive)return primitive;var keys=Object.keys(value),visibleKeys=arrayToHash(keys);if(ctx.showHidden)keys=Object.getOwnPropertyNames(value);if(isError(value)&&(keys.indexOf(\"message\")>=0||keys.indexOf(\"description\")>=0))return formatError(value);if(keys.length===0){if(isFunction(value)){var name=value.name\?\": \"+value.name:\"\";return ctx.stylize(\"[Function\"+name+\"]\",\"special\")}if(isRegExp(value))return ctx.stylize(RegExp.prototype.toString.call(value),\"regexp\");if(isDate(value))return ctx.stylize(Date.prototype.toString.call(value),\"date\");if(isError(value))return formatError(value)}var base=\"\",array=!1,braces=[\"{\",\"}\"];if(@isArray(value))array=!0,braces=[\"[\",\"]\"];if(isFunction(value)){var n=value.name\?\": \"+value.name:\"\";base=\" [Function\"+n+\"]\"}if(isRegExp(value))base=\" \"+RegExp.prototype.toString.call(value);if(isDate(value))base=\" \"+Date.prototype.toUTCString.call(value);if(isError(value))base=\" \"+formatError(value);if(keys.length===0&&(!array||value.length==0))return braces[0]+base+braces[1];if(recurseTimes<0)if(isRegExp(value))return ctx.stylize(RegExp.prototype.toString.call(value),\"regexp\");else return ctx.stylize(\"[Object]\",\"special\");ctx.seen.push(value);var output;if(array)output=formatArray(ctx,value,recurseTimes,visibleKeys,keys);else output=keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)});return ctx.seen.pop(),reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize(\"undefined\",\"undefined\");if(isString(value)){var simple=\"'\"+JSON.stringify(value).replace(/^\"|\"$/g,\"\").replace(/'/g,\"\\\\'\").replace(/\\\\\"/g,'\"')+\"'\";return ctx.stylize(simple,\"string\")}if(isNumber(value))return ctx.stylize(\"\"+value,\"number\");if(isBoolean(value))return ctx.stylize(\"\"+value,\"boolean\");if(isNull(value))return ctx.stylize(\"null\",\"null\")}function formatError(value){return\"[\"+Error.prototype.toString.call(value)+\"]\"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i=0,l=value.length;i<l;++i)if(hasOwnProperty(value,String(i)))output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i),!0));else output.push(\"\");return keys.forEach(function(key){if(!key.match(/^\\d+$/))output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,!0))}),output}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;if(desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]},desc.get)if(desc.set)str=ctx.stylize(\"[Getter/Setter]\",\"special\");else str=ctx.stylize(\"[Getter]\",\"special\");else if(desc.set)str=ctx.stylize(\"[Setter]\",\"special\");if(!hasOwnProperty(visibleKeys,key))name=\"[\"+key+\"]\";if(!str)if(ctx.seen.indexOf(desc.value)<0){if(isNull(recurseTimes))str=formatValue(ctx,desc.value,null);else str=formatValue(ctx,desc.value,recurseTimes-1);if(str.indexOf(\"\\n\")>-1)if(array)str=str.split(\"\\n\").map(function(line){return\" \"+line}).join(\"\\n\").substr(2);else str=\"\\n\"+str.split(\"\\n\").map(function(line){return\" \"+line}).join(\"\\n\")}else str=ctx.stylize(\"[Circular]\",\"special\");if(isUndefined(name)){if(array&&key.match(/^\\d+$/))return str;if(name=JSON.stringify(\"\"+key),name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/))name=name.substr(1,name.length-2),name=ctx.stylize(name,\"name\");else name=name.replace(/'/g,\"\\\\'\").replace(/\\\\\"/g,'\"').replace(/(^\"|\"$)/g,\"'\"),name=ctx.stylize(name,\"string\")}return name+\": \"+str}function reduceToSingleString(output,base,braces){var numLinesEst=0,length=output.reduce(function(prev,cur){if(numLinesEst++,cur.indexOf(\"\\n\")>=0)numLinesEst++;return prev+cur.replace(/\\u001b\\[\\d\\d\?m/g,\"\").length+1},0);if(length>60)return braces[0]+(base===\"\"\?\"\":base+\"\\n \")+\" \"+output.join(\",\\n \")+\" \"+braces[1];return braces[0]+base+\" \"+output.join(\", \")+\" \"+braces[1]}function isBoolean(arg){return typeof arg===\"boolean\"}function isNull(arg){return arg===null}function isNullOrUndefined(arg){return arg==null}function isNumber(arg){return typeof arg===\"number\"}function isString(arg){return typeof arg===\"string\"}function isSymbol(arg){return typeof arg===\"symbol\"}function isUndefined(arg){return arg===void 0}var isRegExp=types.isRegExp;function isObject(arg){return typeof arg===\"object\"&&arg!==null}var{isDate,isNativeError:isError}=types;function isPrimitive(arg){return arg===null||typeof arg===\"boolean\"||typeof arg===\"number\"||typeof arg===\"string\"||typeof arg===\"symbol\"||typeof arg===\"undefined\"}function pad(n){return n<10\?\"0\"+n.toString(10):n.toString(10)}var months=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"];function timestamp(){var d=new Date,time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(\":\");return[d.getDate(),months[d.getMonth()],time].join(\" \")}var log=function log(){console.log(\"%s - %s\",timestamp(),format.apply(cjs_exports,arguments))},inherits=function inherits(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})},_extend=function(origin,add){if(!add||!isObject(add))return origin;var keys=Object.keys(add),i=keys.length;while(i--)origin[keys[i]]=add[keys[i]];return origin};function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}var kCustomPromisifiedSymbol=Symbol.for(\"util.promisify.custom\"),promisify=function promisify(original){if(typeof original!==\"function\")@throwTypeError('The \"original\" argument must be of type Function');if(kCustomPromisifiedSymbol&&original[kCustomPromisifiedSymbol]){var fn=original[kCustomPromisifiedSymbol];if(typeof fn!==\"function\")@throwTypeError('The \"util.promisify.custom\" argument must be of type Function');return Object.defineProperty(fn,kCustomPromisifiedSymbol,{value:fn,enumerable:!1,writable:!1,configurable:!0}),fn}function fn(){var promiseResolve,promiseReject,promise=new Promise(function(resolve,reject){promiseResolve=resolve,promiseReject=reject}),args=[];for(var i=0;i<arguments.length;i++)args.push(arguments[i]);args.push(function(err,value){if(err)promiseReject(err);else promiseResolve(value)});try{original.apply(this,args)}catch(err){promiseReject(err)}return promise}if(Object.setPrototypeOf(fn,Object.getPrototypeOf(original)),kCustomPromisifiedSymbol)Object.defineProperty(fn,kCustomPromisifiedSymbol,{value:fn,enumerable:!1,writable:!1,configurable:!0});return Object.defineProperties(fn,getOwnPropertyDescriptors(original))};promisify.custom=kCustomPromisifiedSymbol;function callbackifyOnRejected(reason,cb){if(!reason){var newReason=new Error(\"Promise was rejected with a falsy value\");newReason.reason=reason,newReason.code=\"ERR_FALSY_VALUE_REJECTION\",reason=newReason}return cb(reason)}function callbackify(original){if(typeof original!==\"function\")@throwTypeError('The \"original\" argument must be of type Function');function callbackified(){var args=Array.prototype.slice.call(arguments),maybeCb=args.pop();if(typeof maybeCb!==\"function\")@throwTypeError(\"The last argument must be of type Function\");var self=this,cb=function(){return maybeCb.apply(self,arguments)};original.apply(this,args).then(function(ret){process.nextTick(cb,null,ret)},function(rej){process.nextTick(callbackifyOnRejected,rej,cb)})}return Object.setPrototypeOf(callbackified,Object.getPrototypeOf(original)),Object.defineProperties(callbackified,getOwnPropertyDescriptors(original)),callbackified}var toUSVString=(input)=>{return(input+\"\").toWellFormed()};return Object.assign(cjs_exports,{format,formatWithOptions,deprecate,debuglog,_extend,inspect,types,isArray:@isArray,isBoolean,isNull,isNullOrUndefined,isNumber,isString,isSymbol,isUndefined,isRegExp,isObject,isDate,isFunction,isError,isPrimitive,isBuffer,log,inherits,toUSVString,promisify,callbackify,isDeepStrictEqual,TextDecoder,TextEncoder})})\n"_s; // // diff --git a/src/js/out/WebCoreJSBuiltins.cpp b/src/js/out/WebCoreJSBuiltins.cpp index f3568455b..5dbc6c2c9 100644 --- a/src/js/out/WebCoreJSBuiltins.cpp +++ b/src/js/out/WebCoreJSBuiltins.cpp @@ -646,9 +646,9 @@ const char* const s_processObjectInternalsBindingCode = "(function (bindingName) const JSC::ConstructAbility s_processObjectInternalsGetStdioWriteStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; const JSC::ConstructorKind s_processObjectInternalsGetStdioWriteStreamCodeConstructorKind = JSC::ConstructorKind::None; const JSC::ImplementationVisibility s_processObjectInternalsGetStdioWriteStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; -const int s_processObjectInternalsGetStdioWriteStreamCodeLength = 7529; +const int s_processObjectInternalsGetStdioWriteStreamCodeLength = 7801; static const JSC::Intrinsic s_processObjectInternalsGetStdioWriteStreamCodeIntrinsic = JSC::NoIntrinsic; -const char* const s_processObjectInternalsGetStdioWriteStreamCode = "(function (fd_,getWindowSize){\"use strict\";var EventEmitter=@getInternalField(@internalModuleRegistry,15)||@createInternalModuleById(15);function createStdioWriteStream(fd_2){var{Duplex,eos,destroy}=@getInternalField(@internalModuleRegistry,34)||@createInternalModuleById(34),StdioWriteStream=class StdioWriteStream2 extends Duplex{#writeStream;#readStream;#readable=!0;#writable=!0;#fdPath;#onClose;#onDrain;#onFinish;#onReadable;#isTTY;get isTTY(){return this.#isTTY\?\?=@requireNativeModule(\"node:tty\").isatty(fd_2)}get fd(){return fd_2}constructor(fd){super({readable:!0,writable:!0});this.#fdPath=`/dev/fd/${fd}`}#onFinished(err){const cb=this.#onClose;if(this.#onClose=null,cb)cb(err);else if(err)this.destroy(err);else if(!this.#readable&&!this.#writable)this.destroy()}_destroy(err,callback){if(!err&&this.#onClose!==null){var AbortError=class AbortError2 extends Error{code;name;constructor(message=\"The operation was aborted\",options=void 0){if(options!==void 0&&typeof options!==\"object\")throw new Error(`Invalid AbortError options:\\n\\n${JSON.stringify(options,null,2)}`);super(message,options);this.code=\"ABORT_ERR\",this.name=\"AbortError\"}};err=new AbortError}if(this.#onDrain=null,this.#onFinish=null,this.#onClose===null)callback(err);else{if(this.#onClose=callback,this.#writeStream)destroy(this.#writeStream,err);if(this.#readStream)destroy(this.#readStream,err)}}_write(chunk,encoding,callback){if(!this.#writeStream){var{createWriteStream}=@getInternalField(@internalModuleRegistry,16)||@createInternalModuleById(16),stream=this.#writeStream=createWriteStream(this.#fdPath);stream.on(\"finish\",()=>{if(this.#onFinish){const cb=this.#onFinish;this.#onFinish=null,cb()}}),stream.on(\"drain\",()=>{if(this.#onDrain){const cb=this.#onDrain;this.#onDrain=null,cb()}}),eos(stream,(err)=>{if(this.#writable=!1,err)destroy(stream,err);this.#onFinished(err)})}if(stream.write(chunk,encoding))callback();else this.#onDrain=callback}_final(callback){this.#writeStream&&this.#writeStream.end(),this.#onFinish=callback}#loadReadStream(){var{createReadStream}=@getInternalField(@internalModuleRegistry,16)||@createInternalModuleById(16),readStream=this.#readStream=createReadStream(this.#fdPath);return readStream.on(\"readable\",()=>{if(this.#onReadable){const cb=this.#onReadable;this.#onReadable=null,cb()}else this.read()}),readStream.on(\"end\",()=>{this.push(null)}),eos(readStream,(err)=>{if(this.#readable=!1,err)destroy(readStream,err);this.#onFinished(err)}),readStream}_read(){var stream=this.#readStream;if(!stream)stream=this.#loadReadStream();while(!0){const buf=stream.read();if(buf===null||!this.push(buf))return}}};return new StdioWriteStream(fd_2)}function isFastEncoding(encoding){if(!encoding)return!0;var normalied=encoding.toLowerCase();return normalied===\"utf8\"||normalied===\"utf-8\"||normalied===\"buffer\"||normalied===\"binary\"}var readline,windowSizeArray=[0,0],FastStdioWriteStreamInternal=class StdioWriteStream extends EventEmitter{#fd;#innerStream;#writer;#isTTY;bytesWritten=0;setDefaultEncoding(encoding){if(this.#innerStream||!isFastEncoding(encoding))return this.#ensureInnerStream(),this.#innerStream.setDefaultEncoding(encoding)}#createWriter(){switch(this.#fd){case 1:{var writer=@Bun.stdout.writer({highWaterMark:0});return writer.unref(),writer}case 2:{var writer=@Bun.stderr.writer({highWaterMark:0});return writer.unref(),writer}default:throw new Error(\"Unsupported writer\")}}#getWriter(){return this.#writer\?\?=this.#createWriter()}constructor(fd_2){super();this.#fd=fd_2}get fd(){return this.#fd}ref(){this.#getWriter().ref()}unref(){this.#getWriter().unref()}on(event,listener){if(event===\"close\"||event===\"finish\")return this.#ensureInnerStream(),this.#innerStream.on(event,listener);if(event===\"drain\")return super.on(\"drain\",listener);if(event===\"error\")return super.on(\"error\",listener);return super.on(event,listener)}get _writableState(){return this.#ensureInnerStream(),this.#innerStream._writableState}get _readableState(){return this.#ensureInnerStream(),this.#innerStream._readableState}pipe(destination){return this.#ensureInnerStream(),this.#innerStream.pipe(destination)}unpipe(destination){return this.#ensureInnerStream(),this.#innerStream.unpipe(destination)}#ensureInnerStream(){if(this.#innerStream)return;this.#innerStream=createStdioWriteStream(this.#fd);const events=this.eventNames();for(let event of events)this.#innerStream.on(event,(...args)=>{this.emit(event,...args)})}#write1(chunk){var writer=this.#getWriter();const writeResult=writer.write(chunk);this.bytesWritten+=writeResult;const flushResult=writer.flush(!1);return!!(writeResult||flushResult)}#writeWithEncoding(chunk,encoding){if(!isFastEncoding(encoding))return this.#ensureInnerStream(),this.#innerStream.write(chunk,encoding);return this.#write1(chunk)}#performCallback(cb,err){if(err)this.emit(\"error\",err);try{cb(err\?err:null)}catch(err2){this.emit(\"error\",err2)}}#writeWithCallbackAndEncoding(chunk,encoding,callback){if(!isFastEncoding(encoding))return this.#ensureInnerStream(),this.#innerStream.write(chunk,encoding,callback);var writer=this.#getWriter();const writeResult=writer.write(chunk),flushResult=writer.flush(!0);if(flushResult\?.then)return flushResult.then(()=>{this.#performCallback(callback),this.emit(\"drain\")},(err)=>this.#performCallback(callback,err)),!1;return queueMicrotask(()=>{this.#performCallback(callback)}),!!(writeResult||flushResult)}get isTTY(){return!1}write(chunk,encoding,callback){const result=this._write(chunk,encoding,callback);if(result)this.emit(\"drain\");return result}get hasColors(){return @Bun.tty[this.#fd].hasColors}_write(chunk,encoding,callback){var inner=this.#innerStream;if(inner)return inner.write(chunk,encoding,callback);switch(arguments.length){case 0:{var error=new Error(\"Invalid arguments\");throw error.code=\"ERR_INVALID_ARG_TYPE\",error}case 1:return this.#write1(chunk);case 2:if(typeof encoding===\"function\")return this.#writeWithCallbackAndEncoding(chunk,\"\",encoding);else if(typeof encoding===\"string\")return this.#writeWithEncoding(chunk,encoding);default:{if(typeof encoding!==\"undefined\"&&typeof encoding!==\"string\"||typeof callback!==\"undefined\"&&typeof callback!==\"function\"){var error=new Error(\"Invalid arguments\");throw error.code=\"ERR_INVALID_ARG_TYPE\",error}if(typeof callback===\"undefined\")return this.#writeWithEncoding(chunk,encoding);return this.#writeWithCallbackAndEncoding(chunk,encoding,callback)}}}destroy(){return this}end(){return this}};if(getWindowSize(fd_,windowSizeArray)){var WriteStream=class WriteStream2 extends FastStdioWriteStreamInternal{get isTTY(){return!0}cursorTo(x,y,callback){return(readline\?\?=@getInternalField(@internalModuleRegistry,30)||@createInternalModuleById(30)).cursorTo(this,x,y,callback)}moveCursor(dx,dy,callback){return(readline\?\?=@getInternalField(@internalModuleRegistry,30)||@createInternalModuleById(30)).moveCursor(this,dx,dy,callback)}clearLine(dir,callback){return(readline\?\?=@getInternalField(@internalModuleRegistry,30)||@createInternalModuleById(30)).clearLine(this,dir,callback)}clearScreenDown(callback){return(readline\?\?=@getInternalField(@internalModuleRegistry,30)||@createInternalModuleById(30)).clearScreenDown(this,callback)}getWindowSize(){if(getWindowSize(fd_,windowSizeArray)===!0)return[windowSizeArray[0],windowSizeArray[1]]}get columns(){if(getWindowSize(fd_,windowSizeArray)===!0)return windowSizeArray[0]}get rows(){if(getWindowSize(fd_,windowSizeArray)===!0)return windowSizeArray[1]}};return new WriteStream(fd_)}return new FastStdioWriteStreamInternal(fd_)})\n"; +const char* const s_processObjectInternalsGetStdioWriteStreamCode = "(function (fd_,getWindowSize){\"use strict\";var EventEmitter=@getInternalField(@internalModuleRegistry,15)||@createInternalModuleById(15);function createStdioWriteStream(fd_2){var{Duplex,eos,destroy}=@getInternalField(@internalModuleRegistry,34)||@createInternalModuleById(34),StdioWriteStream=class StdioWriteStream2 extends Duplex{#writeStream;#readStream;#readable=!0;#writable=!0;#fdPath;#onClose;#onDrain;#onFinish;#onReadable;#isTTY;get isTTY(){return this.#isTTY\?\?=@requireNativeModule(\"node:tty\").isatty(fd_2)}get fd(){return fd_2}get writable(){return this.#writable}get readable(){return this.#readable}constructor(fd){super({readable:!0,writable:!0});this.#fdPath=`/dev/fd/${fd}`}#onFinished(err){const cb=this.#onClose;if(this.#onClose=null,cb)cb(err);else if(err)this.destroy(err);else if(!this.#readable&&!this.#writable)this.destroy()}_destroy(err,callback){if(!err&&this.#onClose!==null){var AbortError=class AbortError2 extends Error{code;name;constructor(message=\"The operation was aborted\",options=void 0){if(options!==void 0&&typeof options!==\"object\")throw new Error(`Invalid AbortError options:\\n\\n${JSON.stringify(options,null,2)}`);super(message,options);this.code=\"ABORT_ERR\",this.name=\"AbortError\"}};err=new AbortError}if(this.#onDrain=null,this.#onFinish=null,this.#onClose===null)callback(err);else{if(this.#onClose=callback,this.#writeStream)destroy(this.#writeStream,err);if(this.#readStream)destroy(this.#readStream,err)}}_write(chunk,encoding,callback){if(!this.#writeStream){var{createWriteStream}=@getInternalField(@internalModuleRegistry,16)||@createInternalModuleById(16);this.#writeStream=createWriteStream(this.#fdPath),this.#writeStream.on(\"finish\",()=>{if(this.#onFinish){const cb=this.#onFinish;this.#onFinish=null,cb()}}),this.#writeStream.on(\"drain\",()=>{if(this.#onDrain){const cb=this.#onDrain;this.#onDrain=null,cb()}}),eos(this.#writeStream,(err)=>{if(this.#writable=!1,err)destroy(this.#writeStream,err);this.#onFinished(err)})}if(this.#writeStream.write(chunk,encoding))callback();else this.#onDrain=callback}_final(callback){this.#writeStream&&this.#writeStream.end(),this.#onFinish=callback}#loadReadStream(){var{createReadStream}=@getInternalField(@internalModuleRegistry,16)||@createInternalModuleById(16),readStream=this.#readStream=createReadStream(this.#fdPath);return readStream.on(\"readable\",()=>{if(this.#onReadable){const cb=this.#onReadable;this.#onReadable=null,cb()}else this.read()}),readStream.on(\"end\",()=>{this.push(null)}),eos(readStream,(err)=>{if(this.#readable=!1,err)destroy(readStream,err);this.#onFinished(err)}),readStream}_read(){var stream=this.#readStream;if(!stream)stream=this.#loadReadStream();while(!0){const buf=stream.read();if(buf===null||!this.push(buf))return}}};return new StdioWriteStream(fd_2)}function isFastEncoding(encoding){if(!encoding)return!0;var normalied=encoding.toLowerCase();return normalied===\"utf8\"||normalied===\"utf-8\"||normalied===\"buffer\"||normalied===\"binary\"}var readline,windowSizeArray=[0,0],FastStdioWriteStreamInternal=class StdioWriteStream extends EventEmitter{#fd;#innerStream;#writer;#isTTY;bytesWritten=0;setDefaultEncoding(encoding){if(this.#innerStream||!isFastEncoding(encoding))return this.#ensureInnerStream(),this.#innerStream.setDefaultEncoding(encoding)}#createWriter(){switch(this.#fd){case 1:{var writer=@Bun.stdout.writer({highWaterMark:0});return writer.unref(),writer}case 2:{var writer=@Bun.stderr.writer({highWaterMark:0});return writer.unref(),writer}default:throw new Error(\"Unsupported writer\")}}#getWriter(){return this.#writer\?\?=this.#createWriter()}constructor(fd_2){super();this.#fd=fd_2}get fd(){return this.#fd}ref(){this.#getWriter().ref()}unref(){this.#getWriter().unref()}on(event,listener){if(event===\"close\"||event===\"finish\")return this.#ensureInnerStream(),this.#innerStream.on(event,listener);if(event===\"drain\")return super.on(\"drain\",listener);if(event===\"error\")return super.on(\"error\",listener);return super.on(event,listener)}get _writableState(){return this.#ensureInnerStream(),this.#innerStream._writableState}get _readableState(){return this.#ensureInnerStream(),this.#innerStream._readableState}get writable(){return this.#ensureInnerStream(),this.#innerStream.writable}get readable(){return this.#ensureInnerStream(),this.#innerStream.readable}pipe(destination){return this.#ensureInnerStream(),this.#innerStream.pipe(destination)}unpipe(destination){return this.#ensureInnerStream(),this.#innerStream.unpipe(destination)}#ensureInnerStream(){if(this.#innerStream)return;this.#innerStream=createStdioWriteStream(this.#fd);const events=this.eventNames();for(let event of events)this.#innerStream.on(event,(...args)=>{this.emit(event,...args)})}#write1(chunk){var writer=this.#getWriter();const writeResult=writer.write(chunk);this.bytesWritten+=writeResult;const flushResult=writer.flush(!1);return!!(writeResult||flushResult)}#writeWithEncoding(chunk,encoding){if(!isFastEncoding(encoding))return this.#ensureInnerStream(),this.#innerStream.write(chunk,encoding);return this.#write1(chunk)}#performCallback(cb,err){if(err)this.emit(\"error\",err);try{cb(err\?err:null)}catch(err2){this.emit(\"error\",err2)}}#writeWithCallbackAndEncoding(chunk,encoding,callback){if(!isFastEncoding(encoding))return this.#ensureInnerStream(),this.#innerStream.write(chunk,encoding,callback);var writer=this.#getWriter();const writeResult=writer.write(chunk),flushResult=writer.flush(!0);if(flushResult\?.then)return flushResult.then(()=>{this.#performCallback(callback),this.emit(\"drain\")},(err)=>this.#performCallback(callback,err)),!1;return queueMicrotask(()=>{this.#performCallback(callback)}),!!(writeResult||flushResult)}get isTTY(){return!1}write(chunk,encoding,callback){const result=this._write(chunk,encoding,callback);if(result)this.emit(\"drain\");return result}get hasColors(){return @Bun.tty[this.#fd].hasColors}_write(chunk,encoding,callback){var inner=this.#innerStream;if(inner)return inner.write(chunk,encoding,callback);switch(arguments.length){case 0:{var error=new Error(\"Invalid arguments\");throw error.code=\"ERR_INVALID_ARG_TYPE\",error}case 1:return this.#write1(chunk);case 2:if(typeof encoding===\"function\")return this.#writeWithCallbackAndEncoding(chunk,\"\",encoding);else if(typeof encoding===\"string\")return this.#writeWithEncoding(chunk,encoding);default:{if(typeof encoding!==\"undefined\"&&typeof encoding!==\"string\"||typeof callback!==\"undefined\"&&typeof callback!==\"function\"){var error=new Error(\"Invalid arguments\");throw error.code=\"ERR_INVALID_ARG_TYPE\",error}if(typeof callback===\"undefined\")return this.#writeWithEncoding(chunk,encoding);return this.#writeWithCallbackAndEncoding(chunk,encoding,callback)}}}destroy(){return this}end(){return this}};if(getWindowSize(fd_,windowSizeArray)){var WriteStream=class WriteStream2 extends FastStdioWriteStreamInternal{get isTTY(){return!0}cursorTo(x,y,callback){return(readline\?\?=@getInternalField(@internalModuleRegistry,30)||@createInternalModuleById(30)).cursorTo(this,x,y,callback)}moveCursor(dx,dy,callback){return(readline\?\?=@getInternalField(@internalModuleRegistry,30)||@createInternalModuleById(30)).moveCursor(this,dx,dy,callback)}clearLine(dir,callback){return(readline\?\?=@getInternalField(@internalModuleRegistry,30)||@createInternalModuleById(30)).clearLine(this,dir,callback)}clearScreenDown(callback){return(readline\?\?=@getInternalField(@internalModuleRegistry,30)||@createInternalModuleById(30)).clearScreenDown(this,callback)}getWindowSize(){if(getWindowSize(fd_,windowSizeArray)===!0)return[windowSizeArray[0],windowSizeArray[1]]}get columns(){if(getWindowSize(fd_,windowSizeArray)===!0)return windowSizeArray[0]}get rows(){if(getWindowSize(fd_,windowSizeArray)===!0)return windowSizeArray[1]}};return new WriteStream(fd_)}return new FastStdioWriteStreamInternal(fd_)})\n"; // getStdinStream const JSC::ConstructAbility s_processObjectInternalsGetStdinStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; |