UNPKG

@storm-stack/core

Version:

A build toolkit and runtime used by Storm Software in TypeScript applications

1,336 lines (1,317 loc) 218 kB
'use strict'; var chunkG5M2PQ74_cjs = require('./chunk-G5M2PQ74.cjs'); var chunk5E7Z7PEP_cjs = require('./chunk-5E7Z7PEP.cjs'); var chunkI5HAGX52_cjs = require('./chunk-I5HAGX52.cjs'); var chunkA43FUIC2_cjs = require('./chunk-A43FUIC2.cjs'); var types = require('@storm-software/config-tools/types'); var bufferToString = require('@stryke/convert/buffer-to-string'); var toArray = require('@stryke/convert/to-array'); var hash = require('@stryke/hash/hash'); var filePathFns = require('@stryke/path/file-path-fns'); var isParentPath = require('@stryke/path/is-parent-path'); var isType = require('@stryke/path/is-type'); var joinPaths = require('@stryke/path/join-paths'); var prettyBytes = require('@stryke/string-format/pretty-bytes'); var isBuffer = require('@stryke/type-checks/is-buffer'); var isFunction = require('@stryke/type-checks/is-function'); var isSetString = require('@stryke/type-checks/is-set-string'); var defu = require('defu'); var buffer = require('buffer'); var fs = require('fs'); var prettier = require('prettier'); var unionfs = require('unionfs'); function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; } var defu__default = /*#__PURE__*/_interopDefault(defu); var fs__default = /*#__PURE__*/_interopDefault(fs); // ../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/constants.js var require_constants = chunkA43FUIC2_cjs.__commonJS({ "../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/constants.js"(exports) { chunkA43FUIC2_cjs.init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: true }); exports.constants = exports.SEP = void 0; exports.SEP = "/"; exports.constants = { O_RDONLY: 0, O_WRONLY: 1, O_RDWR: 2, S_IFMT: 61440, S_IFREG: 32768, S_IFDIR: 16384, S_IFCHR: 8192, S_IFBLK: 24576, S_IFIFO: 4096, S_IFLNK: 40960, S_IFSOCK: 49152, O_CREAT: 64, O_EXCL: 128, O_NOCTTY: 256, O_TRUNC: 512, O_APPEND: 1024, O_DIRECTORY: 65536, O_NOATIME: 262144, O_NOFOLLOW: 131072, O_SYNC: 1052672, O_SYMLINK: 2097152, O_DIRECT: 16384, O_NONBLOCK: 2048, S_IRWXU: 448, S_IRUSR: 256, S_IWUSR: 128, S_IXUSR: 64, S_IRWXG: 56, S_IRGRP: 32, S_IWGRP: 16, S_IXGRP: 8, S_IRWXO: 7, S_IROTH: 4, S_IWOTH: 2, S_IXOTH: 1, F_OK: 0, R_OK: 4, W_OK: 2, X_OK: 1, UV_FS_SYMLINK_DIR: 1, UV_FS_SYMLINK_JUNCTION: 2, UV_FS_COPYFILE_EXCL: 1, UV_FS_COPYFILE_FICLONE: 2, UV_FS_COPYFILE_FICLONE_FORCE: 4, COPYFILE_EXCL: 1, COPYFILE_FICLONE: 2, COPYFILE_FICLONE_FORCE: 4 }; } }); // ../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/node/Stats.js var require_Stats = chunkA43FUIC2_cjs.__commonJS({ "../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/node/Stats.js"(exports) { chunkA43FUIC2_cjs.init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: true }); exports.Stats = void 0; var constants_1 = require_constants(); var { S_IFMT, S_IFDIR, S_IFREG, S_IFBLK, S_IFCHR, S_IFLNK, S_IFIFO, S_IFSOCK } = constants_1.constants; var Stats = class Stats2 { static { chunkA43FUIC2_cjs.__name(this, "Stats"); } static build(node, bigint = false) { const stats = new Stats2(); const { uid, gid, atime, mtime, ctime } = node; const getStatNumber = !bigint ? (number) => number : (number) => BigInt(number); stats.uid = getStatNumber(uid); stats.gid = getStatNumber(gid); stats.rdev = getStatNumber(node.rdev); stats.blksize = getStatNumber(4096); stats.ino = getStatNumber(node.ino); stats.size = getStatNumber(node.getSize()); stats.blocks = getStatNumber(1); stats.atime = atime; stats.mtime = mtime; stats.ctime = ctime; stats.birthtime = ctime; stats.atimeMs = getStatNumber(atime.getTime()); stats.mtimeMs = getStatNumber(mtime.getTime()); const ctimeMs = getStatNumber(ctime.getTime()); stats.ctimeMs = ctimeMs; stats.birthtimeMs = ctimeMs; if (bigint) { stats.atimeNs = BigInt(atime.getTime()) * BigInt(1e6); stats.mtimeNs = BigInt(mtime.getTime()) * BigInt(1e6); const ctimeNs = BigInt(ctime.getTime()) * BigInt(1e6); stats.ctimeNs = ctimeNs; stats.birthtimeNs = ctimeNs; } stats.dev = getStatNumber(0); stats.mode = getStatNumber(node.mode); stats.nlink = getStatNumber(node.nlink); return stats; } _checkModeProperty(property) { return (Number(this.mode) & S_IFMT) === property; } isDirectory() { return this._checkModeProperty(S_IFDIR); } isFile() { return this._checkModeProperty(S_IFREG); } isBlockDevice() { return this._checkModeProperty(S_IFBLK); } isCharacterDevice() { return this._checkModeProperty(S_IFCHR); } isSymbolicLink() { return this._checkModeProperty(S_IFLNK); } isFIFO() { return this._checkModeProperty(S_IFIFO); } isSocket() { return this._checkModeProperty(S_IFSOCK); } }; exports.Stats = Stats; exports.default = Stats; } }); // ../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/internal/buffer.js var require_buffer = chunkA43FUIC2_cjs.__commonJS({ "../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/internal/buffer.js"(exports) { chunkA43FUIC2_cjs.init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: true }); exports.bufferFrom = exports.bufferAllocUnsafe = exports.Buffer = void 0; var buffer_1 = chunkA43FUIC2_cjs.__require("buffer"); Object.defineProperty(exports, "Buffer", { enumerable: true, get: /* @__PURE__ */ chunkA43FUIC2_cjs.__name(function() { return buffer_1.Buffer; }, "get") }); function bufferV0P12Ponyfill(arg0, ...args) { return new buffer_1.Buffer(arg0, ...args); } chunkA43FUIC2_cjs.__name(bufferV0P12Ponyfill, "bufferV0P12Ponyfill"); var bufferAllocUnsafe = buffer_1.Buffer.allocUnsafe || bufferV0P12Ponyfill; exports.bufferAllocUnsafe = bufferAllocUnsafe; var bufferFrom = buffer_1.Buffer.from || bufferV0P12Ponyfill; exports.bufferFrom = bufferFrom; } }); // ../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/internal/errors.js var require_errors = chunkA43FUIC2_cjs.__commonJS({ "../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/internal/errors.js"(exports) { chunkA43FUIC2_cjs.init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: true }); exports.AssertionError = exports.RangeError = exports.TypeError = exports.Error = void 0; exports.message = message; exports.E = E; var assert = chunkA43FUIC2_cjs.__require("assert"); var util = chunkA43FUIC2_cjs.__require("util"); var kCode = typeof Symbol === "undefined" ? "_kCode" : Symbol("code"); var messages = {}; function makeNodeError(Base) { return class NodeError extends Base { static { chunkA43FUIC2_cjs.__name(this, "NodeError"); } constructor(key, ...args) { super(message(key, args)); this.code = key; this[kCode] = key; this.name = `${super.name} [${this[kCode]}]`; } }; } chunkA43FUIC2_cjs.__name(makeNodeError, "makeNodeError"); var g = typeof globalThis !== "undefined" ? globalThis : global; var AssertionError = class AssertionError extends g.Error { static { chunkA43FUIC2_cjs.__name(this, "AssertionError"); } constructor(options) { if (typeof options !== "object" || options === null) { throw new exports.TypeError("ERR_INVALID_ARG_TYPE", "options", "object"); } if (options.message) { super(options.message); } else { super(`${util.inspect(options.actual).slice(0, 128)} ${options.operator} ${util.inspect(options.expected).slice(0, 128)}`); } this.generatedMessage = !options.message; this.name = "AssertionError [ERR_ASSERTION]"; this.code = "ERR_ASSERTION"; this.actual = options.actual; this.expected = options.expected; this.operator = options.operator; exports.Error.captureStackTrace(this, options.stackStartFunction); } }; exports.AssertionError = AssertionError; function message(key, args) { assert.strictEqual(typeof key, "string"); const msg = messages[key]; assert(msg, `An invalid error message key was used: ${key}.`); let fmt; if (typeof msg === "function") { fmt = msg; } else { fmt = util.format; if (args === void 0 || args.length === 0) return msg; args.unshift(msg); } return String(fmt.apply(null, args)); } chunkA43FUIC2_cjs.__name(message, "message"); function E(sym, val) { messages[sym] = typeof val === "function" ? val : String(val); } chunkA43FUIC2_cjs.__name(E, "E"); exports.Error = makeNodeError(g.Error); exports.TypeError = makeNodeError(g.TypeError); exports.RangeError = makeNodeError(g.RangeError); E("ERR_ARG_NOT_ITERABLE", "%s must be iterable"); E("ERR_ASSERTION", "%s"); E("ERR_BUFFER_OUT_OF_BOUNDS", bufferOutOfBounds); E("ERR_CHILD_CLOSED_BEFORE_REPLY", "Child closed before reply received"); E("ERR_CONSOLE_WRITABLE_STREAM", "Console expects a writable stream instance for %s"); E("ERR_CPU_USAGE", "Unable to obtain cpu usage %s"); E("ERR_DNS_SET_SERVERS_FAILED", (err, servers) => `c-ares failed to set servers: "${err}" [${servers}]`); E("ERR_FALSY_VALUE_REJECTION", "Promise was rejected with falsy value"); E("ERR_ENCODING_NOT_SUPPORTED", (enc) => `The "${enc}" encoding is not supported`); E("ERR_ENCODING_INVALID_ENCODED_DATA", (enc) => `The encoded data was not valid for encoding ${enc}`); E("ERR_HTTP_HEADERS_SENT", "Cannot render headers after they are sent to the client"); E("ERR_HTTP_INVALID_STATUS_CODE", "Invalid status code: %s"); E("ERR_HTTP_TRAILER_INVALID", "Trailers are invalid with this transfer encoding"); E("ERR_INDEX_OUT_OF_RANGE", "Index out of range"); E("ERR_INVALID_ARG_TYPE", invalidArgType); E("ERR_INVALID_ARRAY_LENGTH", (name, len, actual) => { assert.strictEqual(typeof actual, "number"); return `The array "${name}" (length ${actual}) must be of length ${len}.`; }); E("ERR_INVALID_BUFFER_SIZE", "Buffer size must be a multiple of %s"); E("ERR_INVALID_CALLBACK", "Callback must be a function"); E("ERR_INVALID_CHAR", "Invalid character in %s"); E("ERR_INVALID_CURSOR_POS", "Cannot set cursor row without setting its column"); E("ERR_INVALID_FD", '"fd" must be a positive integer: %s'); E("ERR_INVALID_FILE_URL_HOST", 'File URL host must be "localhost" or empty on %s'); E("ERR_INVALID_FILE_URL_PATH", "File URL path %s"); E("ERR_INVALID_HANDLE_TYPE", "This handle type cannot be sent"); E("ERR_INVALID_IP_ADDRESS", "Invalid IP address: %s"); E("ERR_INVALID_OPT_VALUE", (name, value) => { return `The value "${String(value)}" is invalid for option "${name}"`; }); E("ERR_INVALID_OPT_VALUE_ENCODING", (value) => `The value "${String(value)}" is invalid for option "encoding"`); E("ERR_INVALID_REPL_EVAL_CONFIG", 'Cannot specify both "breakEvalOnSigint" and "eval" for REPL'); E("ERR_INVALID_SYNC_FORK_INPUT", "Asynchronous forks do not support Buffer, Uint8Array or string input: %s"); E("ERR_INVALID_THIS", 'Value of "this" must be of type %s'); E("ERR_INVALID_TUPLE", "%s must be an iterable %s tuple"); E("ERR_INVALID_URL", "Invalid URL: %s"); E("ERR_INVALID_URL_SCHEME", (expected) => `The URL must be ${oneOf(expected, "scheme")}`); E("ERR_IPC_CHANNEL_CLOSED", "Channel closed"); E("ERR_IPC_DISCONNECTED", "IPC channel is already disconnected"); E("ERR_IPC_ONE_PIPE", "Child process can have only one IPC pipe"); E("ERR_IPC_SYNC_FORK", "IPC cannot be used with synchronous forks"); E("ERR_MISSING_ARGS", missingArgs); E("ERR_MULTIPLE_CALLBACK", "Callback called multiple times"); E("ERR_NAPI_CONS_FUNCTION", "Constructor must be a function"); E("ERR_NAPI_CONS_PROTOTYPE_OBJECT", "Constructor.prototype must be an object"); E("ERR_NO_CRYPTO", "Node.js is not compiled with OpenSSL crypto support"); E("ERR_NO_LONGER_SUPPORTED", "%s is no longer supported"); E("ERR_PARSE_HISTORY_DATA", "Could not parse history data in %s"); E("ERR_SOCKET_ALREADY_BOUND", "Socket is already bound"); E("ERR_SOCKET_BAD_PORT", "Port should be > 0 and < 65536"); E("ERR_SOCKET_BAD_TYPE", "Bad socket type specified. Valid types are: udp4, udp6"); E("ERR_SOCKET_CANNOT_SEND", "Unable to send data"); E("ERR_SOCKET_CLOSED", "Socket is closed"); E("ERR_SOCKET_DGRAM_NOT_RUNNING", "Not running"); E("ERR_STDERR_CLOSE", "process.stderr cannot be closed"); E("ERR_STDOUT_CLOSE", "process.stdout cannot be closed"); E("ERR_STREAM_WRAP", "Stream has StringDecoder set or is in objectMode"); E("ERR_TLS_CERT_ALTNAME_INVALID", "Hostname/IP does not match certificate's altnames: %s"); E("ERR_TLS_DH_PARAM_SIZE", (size) => `DH parameter size ${size} is less than 2048`); E("ERR_TLS_HANDSHAKE_TIMEOUT", "TLS handshake timeout"); E("ERR_TLS_RENEGOTIATION_FAILED", "Failed to renegotiate"); E("ERR_TLS_REQUIRED_SERVER_NAME", '"servername" is required parameter for Server.addContext'); E("ERR_TLS_SESSION_ATTACK", "TSL session renegotiation attack detected"); E("ERR_TRANSFORM_ALREADY_TRANSFORMING", "Calling transform done when still transforming"); E("ERR_TRANSFORM_WITH_LENGTH_0", "Calling transform done when writableState.length != 0"); E("ERR_UNKNOWN_ENCODING", "Unknown encoding: %s"); E("ERR_UNKNOWN_SIGNAL", "Unknown signal: %s"); E("ERR_UNKNOWN_STDIN_TYPE", "Unknown stdin file type"); E("ERR_UNKNOWN_STREAM_TYPE", "Unknown stream file type"); E("ERR_V8BREAKITERATOR", "Full ICU data not installed. See https://github.com/nodejs/node/wiki/Intl"); E("ERR_DIR_CLOSED", "Directory handle was closed"); E("ERR_DIR_CONCURRENT_OPERATION", "Cannot do synchronous work on directory handle with concurrent asynchronous operations"); function invalidArgType(name, expected, actual) { assert(name, "name is required"); let determiner; if (expected.includes("not ")) { determiner = "must not be"; expected = expected.split("not ")[1]; } else { determiner = "must be"; } let msg; if (Array.isArray(name)) { const names = name.map((val) => `"${val}"`).join(", "); msg = `The ${names} arguments ${determiner} ${oneOf(expected, "type")}`; } else if (name.includes(" argument")) { msg = `The ${name} ${determiner} ${oneOf(expected, "type")}`; } else { const type = name.includes(".") ? "property" : "argument"; msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, "type")}`; } if (arguments.length >= 3) { msg += `. Received type ${actual !== null ? typeof actual : "null"}`; } return msg; } chunkA43FUIC2_cjs.__name(invalidArgType, "invalidArgType"); function missingArgs(...args) { assert(args.length > 0, "At least one arg needs to be specified"); let msg = "The "; const len = args.length; args = args.map((a) => `"${a}"`); switch (len) { case 1: msg += `${args[0]} argument`; break; case 2: msg += `${args[0]} and ${args[1]} arguments`; break; default: msg += args.slice(0, len - 1).join(", "); msg += `, and ${args[len - 1]} arguments`; break; } return `${msg} must be specified`; } chunkA43FUIC2_cjs.__name(missingArgs, "missingArgs"); function oneOf(expected, thing) { assert(expected, "expected is required"); assert(typeof thing === "string", "thing is required"); if (Array.isArray(expected)) { const len = expected.length; assert(len > 0, "At least one expected value needs to be specified"); expected = expected.map((i) => String(i)); if (len > 2) { return `one of ${thing} ${expected.slice(0, len - 1).join(", ")}, or ` + expected[len - 1]; } else if (len === 2) { return `one of ${thing} ${expected[0]} or ${expected[1]}`; } else { return `of ${thing} ${expected[0]}`; } } else { return `of ${thing} ${String(expected)}`; } } chunkA43FUIC2_cjs.__name(oneOf, "oneOf"); function bufferOutOfBounds(name, isWriting) { if (isWriting) { return "Attempt to write outside buffer bounds"; } else { return `"${name}" is outside of buffer bounds`; } } chunkA43FUIC2_cjs.__name(bufferOutOfBounds, "bufferOutOfBounds"); } }); // ../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/encoding.js var require_encoding = chunkA43FUIC2_cjs.__commonJS({ "../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/encoding.js"(exports) { chunkA43FUIC2_cjs.init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: true }); exports.ENCODING_UTF8 = void 0; exports.assertEncoding = assertEncoding; exports.strToEncoding = strToEncoding; var buffer_1 = require_buffer(); var errors = require_errors(); exports.ENCODING_UTF8 = "utf8"; function assertEncoding(encoding) { if (encoding && !buffer_1.Buffer.isEncoding(encoding)) throw new errors.TypeError("ERR_INVALID_OPT_VALUE_ENCODING", encoding); } chunkA43FUIC2_cjs.__name(assertEncoding, "assertEncoding"); function strToEncoding(str, encoding) { if (!encoding || encoding === exports.ENCODING_UTF8) return str; if (encoding === "buffer") return new buffer_1.Buffer(str); return new buffer_1.Buffer(str).toString(encoding); } chunkA43FUIC2_cjs.__name(strToEncoding, "strToEncoding"); } }); // ../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/node/Dirent.js var require_Dirent = chunkA43FUIC2_cjs.__commonJS({ "../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/node/Dirent.js"(exports) { chunkA43FUIC2_cjs.init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: true }); exports.Dirent = void 0; var constants_1 = require_constants(); var encoding_1 = require_encoding(); var { S_IFMT, S_IFDIR, S_IFREG, S_IFBLK, S_IFCHR, S_IFLNK, S_IFIFO, S_IFSOCK } = constants_1.constants; var Dirent = class Dirent2 { static { chunkA43FUIC2_cjs.__name(this, "Dirent"); } constructor() { this.name = ""; this.path = ""; this.parentPath = ""; this.mode = 0; } static build(link, encoding) { const dirent = new Dirent2(); const { mode } = link.getNode(); dirent.name = (0, encoding_1.strToEncoding)(link.getName(), encoding); dirent.mode = mode; dirent.path = link.getParentPath(); dirent.parentPath = dirent.path; return dirent; } _checkModeProperty(property) { return (this.mode & S_IFMT) === property; } isDirectory() { return this._checkModeProperty(S_IFDIR); } isFile() { return this._checkModeProperty(S_IFREG); } isBlockDevice() { return this._checkModeProperty(S_IFBLK); } isCharacterDevice() { return this._checkModeProperty(S_IFCHR); } isSymbolicLink() { return this._checkModeProperty(S_IFLNK); } isFIFO() { return this._checkModeProperty(S_IFIFO); } isSocket() { return this._checkModeProperty(S_IFSOCK); } }; exports.Dirent = Dirent; exports.default = Dirent; } }); // ../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/core/types.js var require_types = chunkA43FUIC2_cjs.__commonJS({ "../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/core/types.js"(exports) { chunkA43FUIC2_cjs.init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: true }); } }); // ../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/core/json.js var require_json = chunkA43FUIC2_cjs.__commonJS({ "../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/core/json.js"(exports) { chunkA43FUIC2_cjs.init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: true }); exports.flattenJSON = void 0; var buffer_1 = require_buffer(); var pathModule = chunkA43FUIC2_cjs.__require("path"); var { join } = pathModule.posix ? pathModule.posix : pathModule; var flattenJSON = /* @__PURE__ */ chunkA43FUIC2_cjs.__name((nestedJSON) => { const flatJSON = {}; function flatten(pathPrefix, node) { for (const path in node) { const contentOrNode = node[path]; const joinedPath = join(pathPrefix, path); if (typeof contentOrNode === "string" || contentOrNode instanceof buffer_1.Buffer) { flatJSON[joinedPath] = contentOrNode; } else if (typeof contentOrNode === "object" && contentOrNode !== null && Object.keys(contentOrNode).length > 0) { flatten(joinedPath, contentOrNode); } else { flatJSON[joinedPath] = null; } } } chunkA43FUIC2_cjs.__name(flatten, "flatten"); flatten("", nestedJSON); return flatJSON; }, "flattenJSON"); exports.flattenJSON = flattenJSON; } }); // ../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/process.js var require_process = chunkA43FUIC2_cjs.__commonJS({ "../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/process.js"(exports) { chunkA43FUIC2_cjs.init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: true }); exports.createProcess = createProcess; var maybeReturnProcess = /* @__PURE__ */ chunkA43FUIC2_cjs.__name(() => { if (typeof process !== "undefined") { return process; } try { return chunkA43FUIC2_cjs.__require("process"); } catch (_a) { return void 0; } }, "maybeReturnProcess"); function createProcess() { const p = maybeReturnProcess() || {}; if (!p.cwd) p.cwd = () => "/"; if (!p.emitWarning) p.emitWarning = (message, type) => { console.warn(`${type}${type ? ": " : ""}${message}`); }; if (!p.env) p.env = {}; return p; } chunkA43FUIC2_cjs.__name(createProcess, "createProcess"); exports.default = createProcess(); } }); // ../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/core/Node.js var require_Node = chunkA43FUIC2_cjs.__commonJS({ "../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/core/Node.js"(exports) { chunkA43FUIC2_cjs.init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: true }); exports.Node = void 0; var process_1 = require_process(); var buffer_1 = require_buffer(); var constants_1 = require_constants(); var events_1 = chunkA43FUIC2_cjs.__require("events"); var { S_IFMT, S_IFDIR, S_IFREG, S_IFLNK, S_IFCHR } = constants_1.constants; var getuid = /* @__PURE__ */ chunkA43FUIC2_cjs.__name(() => { var _a, _b; return (_b = (_a = process_1.default.getuid) === null || _a === void 0 ? void 0 : _a.call(process_1.default)) !== null && _b !== void 0 ? _b : 0; }, "getuid"); var getgid = /* @__PURE__ */ chunkA43FUIC2_cjs.__name(() => { var _a, _b; return (_b = (_a = process_1.default.getgid) === null || _a === void 0 ? void 0 : _a.call(process_1.default)) !== null && _b !== void 0 ? _b : 0; }, "getgid"); var Node = class Node extends events_1.EventEmitter { static { chunkA43FUIC2_cjs.__name(this, "Node"); } constructor(ino, mode = 438) { super(); this._uid = getuid(); this._gid = getgid(); this._atime = /* @__PURE__ */ new Date(); this._mtime = /* @__PURE__ */ new Date(); this._ctime = /* @__PURE__ */ new Date(); this.rdev = 0; this._nlink = 1; this.mode = mode; this.ino = ino; } set ctime(ctime) { this._ctime = ctime; } get ctime() { return this._ctime; } set uid(uid) { this._uid = uid; this.ctime = /* @__PURE__ */ new Date(); } get uid() { return this._uid; } set gid(gid) { this._gid = gid; this.ctime = /* @__PURE__ */ new Date(); } get gid() { return this._gid; } set atime(atime) { this._atime = atime; this.ctime = /* @__PURE__ */ new Date(); } get atime() { return this._atime; } set mtime(mtime) { this._mtime = mtime; this.ctime = /* @__PURE__ */ new Date(); } get mtime() { return this._mtime; } get perm() { return this.mode & ~S_IFMT; } set perm(perm) { this.mode = this.mode & S_IFMT | perm & ~S_IFMT; this.ctime = /* @__PURE__ */ new Date(); } set nlink(nlink) { this._nlink = nlink; this.ctime = /* @__PURE__ */ new Date(); } get nlink() { return this._nlink; } getString(encoding = "utf8") { this.atime = /* @__PURE__ */ new Date(); return this.getBuffer().toString(encoding); } setString(str) { this.buf = (0, buffer_1.bufferFrom)(str, "utf8"); this.touch(); } getBuffer() { this.atime = /* @__PURE__ */ new Date(); if (!this.buf) this.setBuffer((0, buffer_1.bufferAllocUnsafe)(0)); return (0, buffer_1.bufferFrom)(this.buf); } setBuffer(buf) { this.buf = (0, buffer_1.bufferFrom)(buf); this.touch(); } getSize() { return this.buf ? this.buf.length : 0; } setModeProperty(property) { this.mode = property; } isFile() { return (this.mode & S_IFMT) === S_IFREG; } isDirectory() { return (this.mode & S_IFMT) === S_IFDIR; } isSymlink() { return (this.mode & S_IFMT) === S_IFLNK; } isCharacterDevice() { return (this.mode & S_IFMT) === S_IFCHR; } makeSymlink(symlink) { this.mode = S_IFLNK | 438; this.symlink = symlink; } write(buf, off = 0, len = buf.length, pos = 0) { if (!this.buf) this.buf = (0, buffer_1.bufferAllocUnsafe)(0); if (pos + len > this.buf.length) { const newBuf = (0, buffer_1.bufferAllocUnsafe)(pos + len); this.buf.copy(newBuf, 0, 0, this.buf.length); this.buf = newBuf; } buf.copy(this.buf, pos, off, off + len); this.touch(); return len; } // Returns the number of bytes read. read(buf, off = 0, len = buf.byteLength, pos = 0) { this.atime = /* @__PURE__ */ new Date(); if (!this.buf) this.buf = (0, buffer_1.bufferAllocUnsafe)(0); if (pos >= this.buf.length) return 0; let actualLen = len; if (actualLen > buf.byteLength) { actualLen = buf.byteLength; } if (actualLen + pos > this.buf.length) { actualLen = this.buf.length - pos; } const buf2 = buf instanceof buffer_1.Buffer ? buf : buffer_1.Buffer.from(buf.buffer); this.buf.copy(buf2, off, pos, pos + actualLen); return actualLen; } truncate(len = 0) { if (!len) this.buf = (0, buffer_1.bufferAllocUnsafe)(0); else { if (!this.buf) this.buf = (0, buffer_1.bufferAllocUnsafe)(0); if (len <= this.buf.length) { this.buf = this.buf.slice(0, len); } else { const buf = (0, buffer_1.bufferAllocUnsafe)(len); this.buf.copy(buf); buf.fill(0, this.buf.length); this.buf = buf; } } this.touch(); } chmod(perm) { this.mode = this.mode & S_IFMT | perm & ~S_IFMT; this.touch(); } chown(uid, gid) { this.uid = uid; this.gid = gid; this.touch(); } touch() { this.mtime = /* @__PURE__ */ new Date(); this.emit("change", this); } canRead(uid = getuid(), gid = getgid()) { if (this.perm & 4) { return true; } if (gid === this.gid) { if (this.perm & 32) { return true; } } if (uid === this.uid) { if (this.perm & 256) { return true; } } return false; } canWrite(uid = getuid(), gid = getgid()) { if (this.perm & 2) { return true; } if (gid === this.gid) { if (this.perm & 16) { return true; } } if (uid === this.uid) { if (this.perm & 128) { return true; } } return false; } canExecute(uid = getuid(), gid = getgid()) { if (this.perm & 1) { return true; } if (gid === this.gid) { if (this.perm & 8) { return true; } } if (uid === this.uid) { if (this.perm & 64) { return true; } } return false; } del() { this.emit("delete", this); } toJSON() { return { ino: this.ino, uid: this.uid, gid: this.gid, atime: this.atime.getTime(), mtime: this.mtime.getTime(), ctime: this.ctime.getTime(), perm: this.perm, mode: this.mode, nlink: this.nlink, symlink: this.symlink, data: this.getString() }; } }; exports.Node = Node; } }); // ../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/core/Link.js var require_Link = chunkA43FUIC2_cjs.__commonJS({ "../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/core/Link.js"(exports) { chunkA43FUIC2_cjs.init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: true }); exports.Link = void 0; var events_1 = chunkA43FUIC2_cjs.__require("events"); var constants_1 = require_constants(); var { S_IFREG } = constants_1.constants; var Link = class Link2 extends events_1.EventEmitter { static { chunkA43FUIC2_cjs.__name(this, "Link"); } get steps() { return this._steps; } // Recursively sync children steps, e.g. in case of dir rename set steps(val) { this._steps = val; for (const [child, link] of this.children.entries()) { if (child === "." || child === "..") { continue; } link === null || link === void 0 ? void 0 : link.syncSteps(); } } constructor(vol, parent, name) { super(); this.children = /* @__PURE__ */ new Map(); this._steps = []; this.ino = 0; this.length = 0; this.vol = vol; this.parent = parent; this.name = name; this.syncSteps(); } setNode(node) { this.node = node; this.ino = node.ino; } getNode() { return this.node; } createChild(name, node = this.vol.createNode(S_IFREG | 438)) { const link = new Link2(this.vol, this, name); link.setNode(node); if (node.isDirectory()) { link.children.set(".", link); link.getNode().nlink++; } this.setChild(name, link); return link; } setChild(name, link = new Link2(this.vol, this, name)) { this.children.set(name, link); link.parent = this; this.length++; const node = link.getNode(); if (node.isDirectory()) { link.children.set("..", this); this.getNode().nlink++; } this.getNode().mtime = /* @__PURE__ */ new Date(); this.emit("child:add", link, this); return link; } deleteChild(link) { const node = link.getNode(); if (node.isDirectory()) { link.children.delete(".."); this.getNode().nlink--; } this.children.delete(link.getName()); this.length--; this.getNode().mtime = /* @__PURE__ */ new Date(); this.emit("child:delete", link, this); } getChild(name) { this.getNode().atime = /* @__PURE__ */ new Date(); return this.children.get(name); } getPath() { return this.steps.join( "/" /* PATH.SEP */ ); } getParentPath() { return this.steps.slice(0, -1).join( "/" /* PATH.SEP */ ); } getName() { return this.steps[this.steps.length - 1]; } toJSON() { return { steps: this.steps, ino: this.ino, children: Array.from(this.children.keys()) }; } syncSteps() { this.steps = this.parent ? this.parent.steps.concat([ this.name ]) : [ this.name ]; } }; exports.Link = Link; } }); // ../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/core/File.js var require_File = chunkA43FUIC2_cjs.__commonJS({ "../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/core/File.js"(exports) { chunkA43FUIC2_cjs.init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: true }); exports.File = void 0; var constants_1 = require_constants(); var { O_APPEND } = constants_1.constants; var File = class File { static { chunkA43FUIC2_cjs.__name(this, "File"); } /** * Open a Link-Node pair. `node` is provided separately as that might be a different node * rather the one `link` points to, because it might be a symlink. * @param link * @param node * @param flags * @param fd */ constructor(link, node, flags, fd) { this.link = link; this.node = node; this.flags = flags; this.fd = fd; this.position = 0; if (this.flags & O_APPEND) this.position = this.getSize(); } getString(encoding = "utf8") { return this.node.getString(); } setString(str) { this.node.setString(str); } getBuffer() { return this.node.getBuffer(); } setBuffer(buf) { this.node.setBuffer(buf); } getSize() { return this.node.getSize(); } truncate(len) { this.node.truncate(len); } seekTo(position) { this.position = position; } write(buf, offset = 0, length = buf.length, position) { if (typeof position !== "number") position = this.position; const bytes = this.node.write(buf, offset, length, position); this.position = position + bytes; return bytes; } read(buf, offset = 0, length = buf.byteLength, position) { if (typeof position !== "number") position = this.position; const bytes = this.node.read(buf, offset, length, position); this.position = position + bytes; return bytes; } chmod(perm) { this.node.chmod(perm); } chown(uid, gid) { this.node.chown(uid, gid); } }; exports.File = File; } }); // ../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/node/constants.js var require_constants2 = chunkA43FUIC2_cjs.__commonJS({ "../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/node/constants.js"(exports) { chunkA43FUIC2_cjs.init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: true }); exports.FLAGS = exports.ERRSTR = void 0; var constants_1 = require_constants(); exports.ERRSTR = { PATH_STR: "path must be a string, Buffer, or Uint8Array", // FD: 'file descriptor must be a unsigned 32-bit integer', FD: "fd must be a file descriptor", MODE_INT: "mode must be an int", CB: "callback must be a function", UID: "uid must be an unsigned int", GID: "gid must be an unsigned int", LEN: "len must be an integer", ATIME: "atime must be an integer", MTIME: "mtime must be an integer", PREFIX: "filename prefix is required", BUFFER: "buffer must be an instance of Buffer or StaticBuffer", OFFSET: "offset must be an integer", LENGTH: "length must be an integer", POSITION: "position must be an integer" }; var { O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_EXCL, O_TRUNC, O_APPEND, O_SYNC } = constants_1.constants; var FLAGS; (function(FLAGS2) { FLAGS2[FLAGS2["r"] = O_RDONLY] = "r"; FLAGS2[FLAGS2["r+"] = O_RDWR] = "r+"; FLAGS2[FLAGS2["rs"] = O_RDONLY | O_SYNC] = "rs"; FLAGS2[FLAGS2["sr"] = FLAGS2.rs] = "sr"; FLAGS2[FLAGS2["rs+"] = O_RDWR | O_SYNC] = "rs+"; FLAGS2[FLAGS2["sr+"] = FLAGS2["rs+"]] = "sr+"; FLAGS2[FLAGS2["w"] = O_WRONLY | O_CREAT | O_TRUNC] = "w"; FLAGS2[FLAGS2["wx"] = O_WRONLY | O_CREAT | O_TRUNC | O_EXCL] = "wx"; FLAGS2[FLAGS2["xw"] = FLAGS2.wx] = "xw"; FLAGS2[FLAGS2["w+"] = O_RDWR | O_CREAT | O_TRUNC] = "w+"; FLAGS2[FLAGS2["wx+"] = O_RDWR | O_CREAT | O_TRUNC | O_EXCL] = "wx+"; FLAGS2[FLAGS2["xw+"] = FLAGS2["wx+"]] = "xw+"; FLAGS2[FLAGS2["a"] = O_WRONLY | O_APPEND | O_CREAT] = "a"; FLAGS2[FLAGS2["ax"] = O_WRONLY | O_APPEND | O_CREAT | O_EXCL] = "ax"; FLAGS2[FLAGS2["xa"] = FLAGS2.ax] = "xa"; FLAGS2[FLAGS2["a+"] = O_RDWR | O_APPEND | O_CREAT] = "a+"; FLAGS2[FLAGS2["ax+"] = O_RDWR | O_APPEND | O_CREAT | O_EXCL] = "ax+"; FLAGS2[FLAGS2["xa+"] = FLAGS2["ax+"]] = "xa+"; })(FLAGS || (exports.FLAGS = FLAGS = {})); } }); // ../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/queueMicrotask.js var require_queueMicrotask = chunkA43FUIC2_cjs.__commonJS({ "../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/queueMicrotask.js"(exports) { chunkA43FUIC2_cjs.init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = typeof queueMicrotask === "function" ? queueMicrotask : (cb) => Promise.resolve().then(() => cb()).catch(() => { }); } }); // ../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/core/util.js var require_util = chunkA43FUIC2_cjs.__commonJS({ "../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/core/util.js"(exports) { chunkA43FUIC2_cjs.init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: true }); exports.filenameToSteps = exports.resolve = exports.unixify = exports.isWin = void 0; exports.isFd = isFd; exports.validateFd = validateFd; exports.dataToBuffer = dataToBuffer; var pathModule = chunkA43FUIC2_cjs.__require("path"); var buffer_1 = require_buffer(); var process_1 = require_process(); var encoding_1 = require_encoding(); var constants_1 = require_constants2(); exports.isWin = process_1.default.platform === "win32"; var resolveCrossPlatform = pathModule.resolve; var { sep } = pathModule.posix ? pathModule.posix : pathModule; var isSeparator = /* @__PURE__ */ chunkA43FUIC2_cjs.__name((str, i) => { let char = str[i]; return i > 0 && (char === "/" || exports.isWin && char === "\\"); }, "isSeparator"); var removeTrailingSeparator = /* @__PURE__ */ chunkA43FUIC2_cjs.__name((str) => { let i = str.length - 1; if (i < 2) return str; while (isSeparator(str, i)) i--; return str.substr(0, i + 1); }, "removeTrailingSeparator"); var normalizePath = /* @__PURE__ */ chunkA43FUIC2_cjs.__name((str, stripTrailing) => { if (typeof str !== "string") throw new TypeError("expected a string"); str = str.replace(/[\\\/]+/g, "/"); if (stripTrailing !== false) str = removeTrailingSeparator(str); return str; }, "normalizePath"); var unixify = /* @__PURE__ */ chunkA43FUIC2_cjs.__name((filepath, stripTrailing = true) => { if (exports.isWin) { filepath = normalizePath(filepath, stripTrailing); return filepath.replace(/^([a-zA-Z]+:|\.\/)/, ""); } return filepath; }, "unixify"); exports.unixify = unixify; var resolve = /* @__PURE__ */ chunkA43FUIC2_cjs.__name((filename, base = process_1.default.cwd()) => resolveCrossPlatform(base, filename), "resolve"); exports.resolve = resolve; if (exports.isWin) { const _resolve = resolve; exports.resolve = resolve = /* @__PURE__ */ chunkA43FUIC2_cjs.__name((filename, base) => (0, exports.unixify)(_resolve(filename, base)), "resolve"); } var filenameToSteps = /* @__PURE__ */ chunkA43FUIC2_cjs.__name((filename, base) => { const fullPath = resolve(filename, base); const fullPathSansSlash = fullPath.substring(1); if (!fullPathSansSlash) return []; return fullPathSansSlash.split(sep); }, "filenameToSteps"); exports.filenameToSteps = filenameToSteps; function isFd(path) { return path >>> 0 === path; } chunkA43FUIC2_cjs.__name(isFd, "isFd"); function validateFd(fd) { if (!isFd(fd)) throw TypeError(constants_1.ERRSTR.FD); } chunkA43FUIC2_cjs.__name(validateFd, "validateFd"); function dataToBuffer(data, encoding = encoding_1.ENCODING_UTF8) { if (buffer_1.Buffer.isBuffer(data)) return data; else if (data instanceof Uint8Array) return (0, buffer_1.bufferFrom)(data); else return (0, buffer_1.bufferFrom)(String(data), encoding); } chunkA43FUIC2_cjs.__name(dataToBuffer, "dataToBuffer"); } }); // ../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/node/util.js var require_util2 = chunkA43FUIC2_cjs.__commonJS({ "../../node_modules/.pnpm/memfs@4.38.2/node_modules/memfs/lib/node/util.js"(exports) { chunkA43FUIC2_cjs.init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: true }); exports.getWriteSyncArgs = exports.getWriteArgs = exports.bufToUint8 = void 0; exports.promisify = promisify; exports.validateCallback = validateCallback; exports.modeToNumber = modeToNumber; exports.nullCheck = nullCheck; exports.pathToFilename = pathToFilename; exports.createError = createError; exports.genRndStr6 = genRndStr6; exports.flagsToNumber = flagsToNumber; exports.streamToBuffer = streamToBuffer; exports.bufferToEncoding = bufferToEncoding; exports.isReadableStream = isReadableStream; var constants_1 = require_constants2(); var errors = require_errors(); var buffer_1 = require_buffer(); var buffer_2 = require_buffer(); var queueMicrotask_1 = require_queueMicrotask(); var util_1 = require_util(); function promisify(fs2, fn, getResult = (input) => input) { return (...args) => new Promise((resolve, reject) => { fs2[fn].bind(fs2)(...args, (error, result) => { if (error) return reject(error); return resolve(getResult(result)); }); }); } chunkA43FUIC2_cjs.__name(promisify, "promisify"); function validateCallback(callback) { if (typeof callback !== "function") throw TypeError(constants_1.ERRSTR.CB); return callback; } chunkA43FUIC2_cjs.__name(validateCallback, "validateCallback"); function _modeToNumber(mode, def) { if (typeof mode === "number") return mode; if (typeof mode === "string") return parseInt(mode, 8); if (def) return modeToNumber(def); return void 0; } chunkA43FUIC2_cjs.__name(_modeToNumber, "_modeToNumber"); function modeToNumber(mode, def) { const result = _modeToNumber(mode, def); if (typeof result !== "number" || isNaN(result)) throw new TypeError(constants_1.ERRSTR.MODE_INT); return result; } chunkA43FUIC2_cjs.__name(modeToNumber, "modeToNumber"); function nullCheck(path, callback) { if (("" + path).indexOf("\0") !== -1) { const er = new Error("Path must be a string without null bytes"); er.code = "ENOENT"; if (typeof callback !== "function") throw er; (0, queueMicrotask_1.default)(() => { callback(er); }); return false; } return true; } chunkA43FUIC2_cjs.__name(nullCheck, "nullCheck"); function getPathFromURLPosix(url) { if (url.hostname !== "") { throw new errors.TypeError("ERR_INVALID_FILE_URL_HOST", process.platform); } const pathname = url.pathname; for (let n = 0; n < pathname.length; n++) { if (pathname[n] === "%") { const third = pathname.codePointAt(n + 2) | 32; if (pathname[n + 1] === "2" && third === 102) { throw new errors.TypeError("ERR_INVALID_FILE_URL_PATH", "must not include encoded / characters"); } } } return decodeURIComponent(pathname); } chunkA43FUIC2_cjs.__name(getPathFromURLPosix, "getPathFromURLPosix"); function pathToFilename(path) { if (path instanceof Uint8Array) { path = (0, buffer_2.bufferFrom)(path); } if (typeof path !== "string" && !buffer_1.Buffer.isBuffer(path)) { try { if (!(path instanceof chunkA43FUIC2_cjs.__require("url").URL)) throw new TypeError(constants_1.ERRSTR.PATH_STR); } catch (err) { throw new TypeError(constants_1.ERRSTR.PATH_STR); } path = getPathFromURLPosix(path); } const pathString = String(path); nullCheck(pathString); return pathString; } chunkA43FUIC2_cjs.__name(pathToFilename, "pathToFilename"); var ENOENT = "ENOENT"; var EBADF = "EBADF"; var EINVAL = "EINVAL"; var EPERM = "EPERM"; var EPROTO = "EPROTO"; var EEXIST = "EEXIST"; var ENOTDIR = "ENOTDIR"; var EMFILE = "EMFILE"; var EACCES = "EACCES"; var EISDIR = "EISDIR"; var ENOTEMPTY = "ENOTEMPTY"; var ENOSYS = "ENOSYS"; var ERR_FS_EISDIR = "ERR_FS_EISDIR"; var ERR_OUT_OF_RANGE = "ERR_OUT_OF_RANGE"; function formatError(errorCode, func = "", path = "", path2 = "") { let pathFormatted = ""; if (path) pathFormatted = ` '${path}'`; if (path2) pathFormatted += ` -> '${path2}'`; switch (errorCode) { case ENOENT: return `ENOENT: no such file or directory, ${func}${pathFormatted}`; case EBADF: return `EBADF: bad file descriptor, ${func}${pathFormatted}`; case EINVAL: return `EINVAL: invalid argument, ${func}${pathFormatted}`; case EPERM: return `EPERM: operation not permitted, ${func}${pathFormatted}`; case EPROTO: return `EPROTO: protocol error, ${func}${pathFormatted}`; case EEXIST: return `EEXIST: file already exists, ${func}${pathFormatted}`; case ENOTDIR: return `ENOTDIR: not a directory, ${func}${pathFormatted}`; case EISDIR: return `EISDIR: illegal operation on a directory, ${func}${pathFormatted}`; case EACCES: return `EACCES: permission denied, ${func}${pathFormatted}`; case ENOTEMPTY: return `ENOTEMPTY: directory not empty, ${func}${pathFormatted}`; case EMFILE: return `EMFILE: too many open files, ${func}${pathFormatted}`; case ENOSYS: return `ENOSYS: function not implemented, ${func}${pathFormatted}`; case ERR_FS_EISDIR: return `[ERR_FS_EISDIR]: Path is a directory: ${func} returned EISDIR (is a directory) ${path}`; case ERR_OUT_OF_RANGE: return `[ERR_OUT_OF_RANGE]: value out of range, ${func}${pathFormatted}`; default: return `${errorCode}: error occurred, ${func}${pathFormatted}`; } } chunkA43FUIC2_cjs.__name(formatError, "formatError"); function createError(errorCode, func = "", path = "", path2 = "", Constructor = Error) { const error = new Constructor(formatError(errorCode, func, path, path2)); error.code = errorCode; if (path) { error.path = path; } return error; } chunkA43FUIC2_cjs.__name(createError, "createError"); function genRndStr6() { return Math.random().toString(36).slice(2, 8).padEnd(6, "0"); } chunkA43FUIC2_cjs.__name(genRndStr6, "genRndStr6"); function flagsToNumber(flags) { if (typeof flags === "number") return flags; if (typeof flags === "string") { const flagsNum = constants_1.FLAGS[flags]; if (typeof flagsNum !== "undefined") return flagsNum; } throw new errors.TypeError("ERR_INVALID_OPT_VALUE", "flags", flags); } chunkA43FUIC2_cjs.__name(flagsToNumber, "flagsToNumber"); function streamToBuffer(stream) { const chunks = []; return new Promise((resolve, reject) => { stream.on("data", (chunk) => chunks.push(chunk)); stream.on("end", () => resolve(buffer_1.Buffer.concat(chunks))); stream.on("error", reject); }); } chunkA43FUIC2_cjs.__name(streamToBuffer, "streamToBuffer"); var bufToUint8 = /* @__PUR