'use strict'; var chunk6D5PUESK_cjs = require('./chunk-6D5PUESK.cjs'); var path = require('path'); var jsRuntime = require('js-runtime'); // ../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js var require_universalify = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js"(exports) { chunk6D5PUESK_cjs.init_cjs_shims(); exports.fromCallback = function(fn) { return Object.defineProperty(function(...args) { if (typeof args[args.length - 1] === "function") fn.apply(this, args); else { return new Promise((resolve2, reject) => { args.push((err, res) => err != null ? reject(err) : resolve2(res)); fn.apply(this, args); }); } }, "name", { value: fn.name }); }; exports.fromPromise = function(fn) { return Object.defineProperty(function(...args) { const cb = args[args.length - 1]; if (typeof cb !== "function") return fn.apply(this, args); else { args.pop(); fn.apply(this, args).then((r) => cb(null, r), cb); } }, "name", { value: fn.name }); }; } }); // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js var require_polyfills = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var constants = chunk6D5PUESK_cjs.__require("constants"); var origCwd = process.cwd; var cwd = null; var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform; process.cwd = function() { if (!cwd) cwd = origCwd.call(process); return cwd; }; try { process.cwd(); } catch (er) { } if (typeof process.chdir === "function") { chdir = process.chdir; process.chdir = function(d) { cwd = null; chdir.call(process, d); }; if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir); } var chdir; module.exports = patch; function patch(fs4) { if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { patchLchmod(fs4); } if (!fs4.lutimes) { patchLutimes(fs4); } fs4.chown = chownFix(fs4.chown); fs4.fchown = chownFix(fs4.fchown); fs4.lchown = chownFix(fs4.lchown); fs4.chmod = chmodFix(fs4.chmod); fs4.fchmod = chmodFix(fs4.fchmod); fs4.lchmod = chmodFix(fs4.lchmod); fs4.chownSync = chownFixSync(fs4.chownSync); fs4.fchownSync = chownFixSync(fs4.fchownSync); fs4.lchownSync = chownFixSync(fs4.lchownSync); fs4.chmodSync = chmodFixSync(fs4.chmodSync); fs4.fchmodSync = chmodFixSync(fs4.fchmodSync); fs4.lchmodSync = chmodFixSync(fs4.lchmodSync); fs4.stat = statFix(fs4.stat); fs4.fstat = statFix(fs4.fstat); fs4.lstat = statFix(fs4.lstat); fs4.statSync = statFixSync(fs4.statSync); fs4.fstatSync = statFixSync(fs4.fstatSync); fs4.lstatSync = statFixSync(fs4.lstatSync); if (fs4.chmod && !fs4.lchmod) { fs4.lchmod = function(path, mode, cb) { if (cb) process.nextTick(cb); }; fs4.lchmodSync = function() { }; } if (fs4.chown && !fs4.lchown) { fs4.lchown = function(path, uid, gid, cb) { if (cb) process.nextTick(cb); }; fs4.lchownSync = function() { }; } if (platform === "win32") { fs4.rename = typeof fs4.rename !== "function" ? fs4.rename : function(fs$rename) { function rename(from, to, cb) { var start = Date.now(); var backoff = 0; fs$rename(from, to, function CB(er) { if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) { setTimeout(function() { fs4.stat(to, function(stater, st) { if (stater && stater.code === "ENOENT") fs$rename(from, to, CB); else cb(er); }); }, backoff); if (backoff < 100) backoff += 10; return; } if (cb) cb(er); }); } if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename); return rename; }(fs4.rename); } fs4.read = typeof fs4.read !== "function" ? fs4.read : function(fs$read) { function read2(fd, buffer, offset, length, position, callback_) { var callback; if (callback_ && typeof callback_ === "function") { var eagCounter = 0; callback = function(er, _, __) { if (er && er.code === "EAGAIN" && eagCounter < 10) { eagCounter++; return fs$read.call(fs4, fd, buffer, offset, length, position, callback); } callback_.apply(this, arguments); }; } return fs$read.call(fs4, fd, buffer, offset, length, position, callback); } if (Object.setPrototypeOf) Object.setPrototypeOf(read2, fs$read); return read2; }(fs4.read); fs4.readSync = typeof fs4.readSync !== "function" ? fs4.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { try { return fs$readSync.call(fs4, fd, buffer, offset, length, position); } catch (er) { if (er.code === "EAGAIN" && eagCounter < 10) { eagCounter++; continue; } throw er; } } }; }(fs4.readSync); function patchLchmod(fs5) { fs5.lchmod = function(path, mode, callback) { fs5.open( path, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) { if (err) { if (callback) callback(err); return; } fs5.fchmod(fd, mode, function(err2) { fs5.close(fd, function(err22) { if (callback) callback(err2 || err22); }); }); } ); }; fs5.lchmodSync = function(path, mode) { var fd = fs5.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode); var threw = true; var ret; try { ret = fs5.fchmodSync(fd, mode); threw = false; } finally { if (threw) { try { fs5.closeSync(fd); } catch (er) { } } else { fs5.closeSync(fd); } } return ret; }; } function patchLutimes(fs5) { if (constants.hasOwnProperty("O_SYMLINK") && fs5.futimes) { fs5.lutimes = function(path, at, mt, cb) { fs5.open(path, constants.O_SYMLINK, function(er, fd) { if (er) { if (cb) cb(er); return; } fs5.futimes(fd, at, mt, function(er2) { fs5.close(fd, function(er22) { if (cb) cb(er2 || er22); }); }); }); }; fs5.lutimesSync = function(path, at, mt) { var fd = fs5.openSync(path, constants.O_SYMLINK); var ret; var threw = true; try { ret = fs5.futimesSync(fd, at, mt); threw = false; } finally { if (threw) { try { fs5.closeSync(fd); } catch (er) { } } else { fs5.closeSync(fd); } } return ret; }; } else if (fs5.futimes) { fs5.lutimes = function(_a, _b, _c, cb) { if (cb) process.nextTick(cb); }; fs5.lutimesSync = function() { }; } } function chmodFix(orig) { if (!orig) return orig; return function(target, mode, cb) { return orig.call(fs4, target, mode, function(er) { if (chownErOk(er)) er = null; if (cb) cb.apply(this, arguments); }); }; } function chmodFixSync(orig) { if (!orig) return orig; return function(target, mode) { try { return orig.call(fs4, target, mode); } catch (er) { if (!chownErOk(er)) throw er; } }; } function chownFix(orig) { if (!orig) return orig; return function(target, uid, gid, cb) { return orig.call(fs4, target, uid, gid, function(er) { if (chownErOk(er)) er = null; if (cb) cb.apply(this, arguments); }); }; } function chownFixSync(orig) { if (!orig) return orig; return function(target, uid, gid) { try { return orig.call(fs4, target, uid, gid); } catch (er) { if (!chownErOk(er)) throw er; } }; } function statFix(orig) { if (!orig) return orig; return function(target, options, cb) { if (typeof options === "function") { cb = options; options = null; } function callback(er, stats) { if (stats) { if (stats.uid < 0) stats.uid += 4294967296; if (stats.gid < 0) stats.gid += 4294967296; } if (cb) cb.apply(this, arguments); } return options ? orig.call(fs4, target, options, callback) : orig.call(fs4, target, callback); }; } function statFixSync(orig) { if (!orig) return orig; return function(target, options) { var stats = options ? orig.call(fs4, target, options) : orig.call(fs4, target); if (stats) { if (stats.uid < 0) stats.uid += 4294967296; if (stats.gid < 0) stats.gid += 4294967296; } return stats; }; } function chownErOk(er) { if (!er) return true; if (er.code === "ENOSYS") return true; var nonroot = !process.getuid || process.getuid() !== 0; if (nonroot) { if (er.code === "EINVAL" || er.code === "EPERM") return true; } return false; } } } }); // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js var require_legacy_streams = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var Stream = chunk6D5PUESK_cjs.__require("stream").Stream; module.exports = legacy; function legacy(fs4) { return { ReadStream, WriteStream }; function ReadStream(path, options) { if (!(this instanceof ReadStream)) return new ReadStream(path, options); Stream.call(this); var self = this; this.path = path; this.fd = null; this.readable = true; this.paused = false; this.flags = "r"; this.mode = 438; this.bufferSize = 64 * 1024; options = options || {}; var keys = Object.keys(options); for (var index = 0, length = keys.length; index < length; index++) { var key = keys[index]; this[key] = options[key]; } if (this.encoding) this.setEncoding(this.encoding); if (this.start !== void 0) { if ("number" !== typeof this.start) { throw TypeError("start must be a Number"); } if (this.end === void 0) { this.end = Infinity; } else if ("number" !== typeof this.end) { throw TypeError("end must be a Number"); } if (this.start > this.end) { throw new Error("start must be <= end"); } this.pos = this.start; } if (this.fd !== null) { process.nextTick(function() { self._read(); }); return; } fs4.open(this.path, this.flags, this.mode, function(err, fd) { if (err) { self.emit("error", err); self.readable = false; return; } self.fd = fd; self.emit("open", fd); self._read(); }); } function WriteStream(path, options) { if (!(this instanceof WriteStream)) return new WriteStream(path, options); Stream.call(this); this.path = path; this.fd = null; this.writable = true; this.flags = "w"; this.encoding = "binary"; this.mode = 438; this.bytesWritten = 0; options = options || {}; var keys = Object.keys(options); for (var index = 0, length = keys.length; index < length; index++) { var key = keys[index]; this[key] = options[key]; } if (this.start !== void 0) { if ("number" !== typeof this.start) { throw TypeError("start must be a Number"); } if (this.start < 0) { throw new Error("start must be >= zero"); } this.pos = this.start; } this.busy = false; this._queue = []; if (this.fd === null) { this._open = fs4.open; this._queue.push([this._open, this.path, this.flags, this.mode, void 0]); this.flush(); } } } } }); // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js var require_clone = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); module.exports = clone; var getPrototypeOf = Object.getPrototypeOf || function(obj) { return obj.__proto__; }; function clone(obj) { if (obj === null || typeof obj !== "object") return obj; if (obj instanceof Object) var copy = { __proto__: getPrototypeOf(obj) }; else var copy = /* @__PURE__ */ Object.create(null); Object.getOwnPropertyNames(obj).forEach(function(key) { Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)); }); return copy; } } }); // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js var require_graceful_fs = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var fs4 = chunk6D5PUESK_cjs.__require("fs"); var polyfills = require_polyfills(); var legacy = require_legacy_streams(); var clone = require_clone(); var util = chunk6D5PUESK_cjs.__require("util"); var gracefulQueue; var previousSymbol; if (typeof Symbol === "function" && typeof Symbol.for === "function") { gracefulQueue = Symbol.for("graceful-fs.queue"); previousSymbol = Symbol.for("graceful-fs.previous"); } else { gracefulQueue = "___graceful-fs.queue"; previousSymbol = "___graceful-fs.previous"; } function noop() { } function publishQueue(context, queue2) { Object.defineProperty(context, gracefulQueue, { get: function() { return queue2; } }); } var debug = noop; if (util.debuglog) debug = util.debuglog("gfs4"); else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) debug = function() { var m = util.format.apply(util, arguments); m = "GFS4: " + m.split(/\n/).join("\nGFS4: "); console.error(m); }; if (!fs4[gracefulQueue]) { queue = global[gracefulQueue] || []; publishQueue(fs4, queue); fs4.close = function(fs$close) { function close(fd, cb) { return fs$close.call(fs4, fd, function(err) { if (!err) { resetQueue(); } if (typeof cb === "function") cb.apply(this, arguments); }); } Object.defineProperty(close, previousSymbol, { value: fs$close }); return close; }(fs4.close); fs4.closeSync = function(fs$closeSync) { function closeSync(fd) { fs$closeSync.apply(fs4, arguments); resetQueue(); } Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync }); return closeSync; }(fs4.closeSync); if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) { process.on("exit", function() { debug(fs4[gracefulQueue]); chunk6D5PUESK_cjs.__require("assert").equal(fs4[gracefulQueue].length, 0); }); } } var queue; if (!global[gracefulQueue]) { publishQueue(global, fs4[gracefulQueue]); } module.exports = patch(clone(fs4)); if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs4.__patched) { module.exports = patch(fs4); fs4.__patched = true; } function patch(fs5) { polyfills(fs5); fs5.gracefulify = patch; fs5.createReadStream = createReadStream; fs5.createWriteStream = createWriteStream; var fs$readFile = fs5.readFile; fs5.readFile = readFile; function readFile(path, options, cb) { if (typeof options === "function") cb = options, options = null; return go$readFile(path, options, cb); function go$readFile(path2, options2, cb2, startTime) { return fs$readFile(path2, options2, function(err) { if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([go$readFile, [path2, options2, cb2], err, startTime || Date.now(), Date.now()]); else { if (typeof cb2 === "function") cb2.apply(this, arguments); } }); } } var fs$writeFile = fs5.writeFile; fs5.writeFile = writeFile; function writeFile(path, data, options, cb) { if (typeof options === "function") cb = options, options = null; return go$writeFile(path, data, options, cb); function go$writeFile(path2, data2, options2, cb2, startTime) { return fs$writeFile(path2, data2, options2, function(err) { if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([go$writeFile, [path2, data2, options2, cb2], err, startTime || Date.now(), Date.now()]); else { if (typeof cb2 === "function") cb2.apply(this, arguments); } }); } } var fs$appendFile = fs5.appendFile; if (fs$appendFile) fs5.appendFile = appendFile; function appendFile(path, data, options, cb) { if (typeof options === "function") cb = options, options = null; return go$appendFile(path, data, options, cb); function go$appendFile(path2, data2, options2, cb2, startTime) { return fs$appendFile(path2, data2, options2, function(err) { if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([go$appendFile, [path2, data2, options2, cb2], err, startTime || Date.now(), Date.now()]); else { if (typeof cb2 === "function") cb2.apply(this, arguments); } }); } } var fs$copyFile = fs5.copyFile; if (fs$copyFile) fs5.copyFile = copyFile; function copyFile(src, dest, flags, cb) { if (typeof flags === "function") { cb = flags; flags = 0; } return go$copyFile(src, dest, flags, cb); function go$copyFile(src2, dest2, flags2, cb2, startTime) { return fs$copyFile(src2, dest2, flags2, function(err) { if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]); else { if (typeof cb2 === "function") cb2.apply(this, arguments); } }); } } var fs$readdir = fs5.readdir; fs5.readdir = readdir; var noReaddirOptionVersions = /^v[0-5]\./; function readdir(path, options, cb) { if (typeof options === "function") cb = options, options = null; var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path2, options2, cb2, startTime) { return fs$readdir(path2, fs$readdirCallback( path2, options2, cb2, startTime )); } : function go$readdir2(path2, options2, cb2, startTime) { return fs$readdir(path2, options2, fs$readdirCallback( path2, options2, cb2, startTime )); }; return go$readdir(path, options, cb); function fs$readdirCallback(path2, options2, cb2, startTime) { return function(err, files) { if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([ go$readdir, [path2, options2, cb2], err, startTime || Date.now(), Date.now() ]); else { if (files && files.sort) files.sort(); if (typeof cb2 === "function") cb2.call(this, err, files); } }; } } if (process.version.substr(0, 4) === "v0.8") { var legStreams = legacy(fs5); ReadStream = legStreams.ReadStream; WriteStream = legStreams.WriteStream; } var fs$ReadStream = fs5.ReadStream; if (fs$ReadStream) { ReadStream.prototype = Object.create(fs$ReadStream.prototype); ReadStream.prototype.open = ReadStream$open; } var fs$WriteStream = fs5.WriteStream; if (fs$WriteStream) { WriteStream.prototype = Object.create(fs$WriteStream.prototype); WriteStream.prototype.open = WriteStream$open; } Object.defineProperty(fs5, "ReadStream", { get: function() { return ReadStream; }, set: function(val) { ReadStream = val; }, enumerable: true, configurable: true }); Object.defineProperty(fs5, "WriteStream", { get: function() { return WriteStream; }, set: function(val) { WriteStream = val; }, enumerable: true, configurable: true }); var FileReadStream = ReadStream; Object.defineProperty(fs5, "FileReadStream", { get: function() { return FileReadStream; }, set: function(val) { FileReadStream = val; }, enumerable: true, configurable: true }); var FileWriteStream = WriteStream; Object.defineProperty(fs5, "FileWriteStream", { get: function() { return FileWriteStream; }, set: function(val) { FileWriteStream = val; }, enumerable: true, configurable: true }); function ReadStream(path, options) { if (this instanceof ReadStream) return fs$ReadStream.apply(this, arguments), this; else return ReadStream.apply(Object.create(ReadStream.prototype), arguments); } function ReadStream$open() { var that = this; open(that.path, that.flags, that.mode, function(err, fd) { if (err) { if (that.autoClose) that.destroy(); that.emit("error", err); } else { that.fd = fd; that.emit("open", fd); that.read(); } }); } function WriteStream(path, options) { if (this instanceof WriteStream) return fs$WriteStream.apply(this, arguments), this; else return WriteStream.apply(Object.create(WriteStream.prototype), arguments); } function WriteStream$open() { var that = this; open(that.path, that.flags, that.mode, function(err, fd) { if (err) { that.destroy(); that.emit("error", err); } else { that.fd = fd; that.emit("open", fd); } }); } function createReadStream(path, options) { return new fs5.ReadStream(path, options); } function createWriteStream(path, options) { return new fs5.WriteStream(path, options); } var fs$open = fs5.open; fs5.open = open; function open(path, flags, mode, cb) { if (typeof mode === "function") cb = mode, mode = null; return go$open(path, flags, mode, cb); function go$open(path2, flags2, mode2, cb2, startTime) { return fs$open(path2, flags2, mode2, function(err, fd) { if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([go$open, [path2, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]); else { if (typeof cb2 === "function") cb2.apply(this, arguments); } }); } } return fs5; } function enqueue(elem) { debug("ENQUEUE", elem[0].name, elem[1]); fs4[gracefulQueue].push(elem); retry(); } var retryTimer; function resetQueue() { var now = Date.now(); for (var i = 0; i < fs4[gracefulQueue].length; ++i) { if (fs4[gracefulQueue][i].length > 2) { fs4[gracefulQueue][i][3] = now; fs4[gracefulQueue][i][4] = now; } } retry(); } function retry() { clearTimeout(retryTimer); retryTimer = void 0; if (fs4[gracefulQueue].length === 0) return; var elem = fs4[gracefulQueue].shift(); var fn = elem[0]; var args = elem[1]; var err = elem[2]; var startTime = elem[3]; var lastTime = elem[4]; if (startTime === void 0) { debug("RETRY", fn.name, args); fn.apply(null, args); } else if (Date.now() - startTime >= 6e4) { debug("TIMEOUT", fn.name, args); var cb = args.pop(); if (typeof cb === "function") cb.call(null, err); } else { var sinceAttempt = Date.now() - lastTime; var sinceStart = Math.max(lastTime - startTime, 1); var desiredDelay = Math.min(sinceStart * 1.2, 100); if (sinceAttempt >= desiredDelay) { debug("RETRY", fn.name, args); fn.apply(null, args.concat([startTime])); } else { fs4[gracefulQueue].push(elem); } } if (retryTimer === void 0) { retryTimer = setTimeout(retry, 0); } } } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/fs/index.js var require_fs = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/fs/index.js"(exports) { chunk6D5PUESK_cjs.init_cjs_shims(); var u = require_universalify().fromCallback; var fs4 = require_graceful_fs(); var api = [ "access", "appendFile", "chmod", "chown", "close", "copyFile", "fchmod", "fchown", "fdatasync", "fstat", "fsync", "ftruncate", "futimes", "lchmod", "lchown", "link", "lstat", "mkdir", "mkdtemp", "open", "opendir", "readdir", "readFile", "readlink", "realpath", "rename", "rm", "rmdir", "stat", "symlink", "truncate", "unlink", "utimes", "writeFile" ].filter((key) => { return typeof fs4[key] === "function"; }); Object.assign(exports, fs4); api.forEach((method) => { exports[method] = u(fs4[method]); }); exports.exists = function(filename, callback) { if (typeof callback === "function") { return fs4.exists(filename, callback); } return new Promise((resolve2) => { return fs4.exists(filename, resolve2); }); }; exports.read = function(fd, buffer, offset, length, position, callback) { if (typeof callback === "function") { return fs4.read(fd, buffer, offset, length, position, callback); } return new Promise((resolve2, reject) => { fs4.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => { if (err) return reject(err); resolve2({ bytesRead, buffer: buffer2 }); }); }); }; exports.write = function(fd, buffer, ...args) { if (typeof args[args.length - 1] === "function") { return fs4.write(fd, buffer, ...args); } return new Promise((resolve2, reject) => { fs4.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => { if (err) return reject(err); resolve2({ bytesWritten, buffer: buffer2 }); }); }); }; exports.readv = function(fd, buffers, ...args) { if (typeof args[args.length - 1] === "function") { return fs4.readv(fd, buffers, ...args); } return new Promise((resolve2, reject) => { fs4.readv(fd, buffers, ...args, (err, bytesRead, buffers2) => { if (err) return reject(err); resolve2({ bytesRead, buffers: buffers2 }); }); }); }; exports.writev = function(fd, buffers, ...args) { if (typeof args[args.length - 1] === "function") { return fs4.writev(fd, buffers, ...args); } return new Promise((resolve2, reject) => { fs4.writev(fd, buffers, ...args, (err, bytesWritten, buffers2) => { if (err) return reject(err); resolve2({ bytesWritten, buffers: buffers2 }); }); }); }; if (typeof fs4.realpath.native === "function") { exports.realpath.native = u(fs4.realpath.native); } else { process.emitWarning( "fs.realpath.native is not a function. Is fs being monkey-patched?", "Warning", "fs-extra-WARN0003" ); } } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/utils.js var require_utils = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/utils.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var path = chunk6D5PUESK_cjs.__require("path"); module.exports.checkPath = function checkPath(pth) { if (process.platform === "win32") { const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, "")); if (pathHasInvalidWinCharacters) { const error = new Error(`Path contains invalid characters: ${pth}`); error.code = "EINVAL"; throw error; } } }; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/make-dir.js var require_make_dir = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/make-dir.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var fs4 = require_fs(); var { checkPath } = require_utils(); var getMode = (options) => { const defaults = { mode: 511 }; if (typeof options === "number") return options; return { ...defaults, ...options }.mode; }; module.exports.makeDir = async (dir, options) => { checkPath(dir); return fs4.mkdir(dir, { mode: getMode(options), recursive: true }); }; module.exports.makeDirSync = (dir, options) => { checkPath(dir); return fs4.mkdirSync(dir, { mode: getMode(options), recursive: true }); }; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/index.js var require_mkdirs = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/index.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var u = require_universalify().fromPromise; var { makeDir: _makeDir, makeDirSync } = require_make_dir(); var makeDir = u(_makeDir); module.exports = { mkdirs: makeDir, mkdirsSync: makeDirSync, // alias mkdirp: makeDir, mkdirpSync: makeDirSync, ensureDir: makeDir, ensureDirSync: makeDirSync }; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/path-exists/index.js var require_path_exists = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/path-exists/index.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var u = require_universalify().fromPromise; var fs4 = require_fs(); function pathExists(path) { return fs4.access(path).then(() => true).catch(() => false); } module.exports = { pathExists: u(pathExists), pathExistsSync: fs4.existsSync }; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/utimes.js var require_utimes = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/utimes.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var fs4 = require_fs(); var u = require_universalify().fromPromise; async function utimesMillis(path, atime, mtime) { const fd = await fs4.open(path, "r+"); let closeErr = null; try { await fs4.futimes(fd, atime, mtime); } finally { try { await fs4.close(fd); } catch (e) { closeErr = e; } } if (closeErr) { throw closeErr; } } function utimesMillisSync(path, atime, mtime) { const fd = fs4.openSync(path, "r+"); fs4.futimesSync(fd, atime, mtime); return fs4.closeSync(fd); } module.exports = { utimesMillis: u(utimesMillis), utimesMillisSync }; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/stat.js var require_stat = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/stat.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var fs4 = require_fs(); var path = chunk6D5PUESK_cjs.__require("path"); var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs4.stat(file, { bigint: true }) : (file) => fs4.lstat(file, { bigint: true }); return Promise.all([ statFunc(src), statFunc(dest).catch((err) => { if (err.code === "ENOENT") return null; throw err; }) ]).then(([srcStat, destStat]) => ({ srcStat, destStat })); } function getStatsSync(src, dest, opts) { let destStat; const statFunc = opts.dereference ? (file) => fs4.statSync(file, { bigint: true }) : (file) => fs4.lstatSync(file, { bigint: true }); const srcStat = statFunc(src); try { destStat = statFunc(dest); } catch (err) { if (err.code === "ENOENT") return { srcStat, destStat: null }; throw err; } return { srcStat, destStat }; } async function checkPaths(src, dest, funcName, opts) { const { srcStat, destStat } = await getStats(src, dest, opts); if (destStat) { if (areIdentical(srcStat, destStat)) { const srcBaseName = path.basename(src); const destBaseName = path.basename(dest); if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { return { srcStat, destStat, isChangingCase: true }; } throw new Error("Source and destination must not be the same."); } if (srcStat.isDirectory() && !destStat.isDirectory()) { throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } if (!srcStat.isDirectory() && destStat.isDirectory()) { throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); } } if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { throw new Error(errMsg(src, dest, funcName)); } return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); if (destStat) { if (areIdentical(srcStat, destStat)) { const srcBaseName = path.basename(src); const destBaseName = path.basename(dest); if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { return { srcStat, destStat, isChangingCase: true }; } throw new Error("Source and destination must not be the same."); } if (srcStat.isDirectory() && !destStat.isDirectory()) { throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } if (!srcStat.isDirectory() && destStat.isDirectory()) { throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); } } if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { throw new Error(errMsg(src, dest, funcName)); } return { srcStat, destStat }; } async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) return; let destStat; try { destStat = await fs4.stat(destParent, { bigint: true }); } catch (err) { if (err.code === "ENOENT") return; throw err; } if (areIdentical(srcStat, destStat)) { throw new Error(errMsg(src, dest, funcName)); } return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) return; let destStat; try { destStat = fs4.statSync(destParent, { bigint: true }); } catch (err) { if (err.code === "ENOENT") return; throw err; } if (areIdentical(srcStat, destStat)) { throw new Error(errMsg(src, dest, funcName)); } return checkParentPathsSync(src, srcStat, destParent, funcName); } function areIdentical(srcStat, destStat) { return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev; } function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module.exports = { // checkPaths checkPaths: u(checkPaths), checkPathsSync, // checkParent checkParentPaths: u(checkParentPaths), checkParentPathsSync, // Misc isSrcSubdir, areIdentical }; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy.js var require_copy = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var fs4 = require_fs(); var path = chunk6D5PUESK_cjs.__require("path"); var { mkdirs } = require_mkdirs(); var { pathExists } = require_path_exists(); var { utimesMillis } = require_utimes(); var stat = require_stat(); async function copy(src, dest, opts = {}) { if (typeof opts === "function") { opts = { filter: opts }; } opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { process.emitWarning( "Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269", "Warning", "fs-extra-WARN0001" ); } const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); await stat.checkParentPaths(src, srcStat, dest, "copy"); const include = await runFilter(src, dest, opts); if (!include) return; const destParent = path.dirname(dest); const dirExists = await pathExists(destParent); if (!dirExists) { await mkdirs(destParent); } await getStatsAndPerformCopy(destStat, src, dest, opts); } async function runFilter(src, dest, opts) { if (!opts.filter) return true; return opts.filter(src, dest); } async function getStatsAndPerformCopy(destStat, src, dest, opts) { const statFn = opts.dereference ? fs4.stat : fs4.lstat; const srcStat = await statFn(src); if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts); if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts); if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts); if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`); if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`); throw new Error(`Unknown file: ${src}`); } async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { await fs4.unlink(dest); return copyFile(srcStat, src, dest, opts); } if (opts.errorOnExist) { throw new Error(`'${dest}' already exists`); } } async function copyFile(srcStat, src, dest, opts) { await fs4.copyFile(src, dest); if (opts.preserveTimestamps) { if (fileIsNotWritable(srcStat.mode)) { await makeFileWritable(dest, srcStat.mode); } const updatedSrcStat = await fs4.stat(src); await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } return fs4.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } function makeFileWritable(dest, srcMode) { return fs4.chmod(dest, srcMode | 128); } async function onDir(srcStat, destStat, src, dest, opts) { if (!destStat) { await fs4.mkdir(dest); } const items = await fs4.readdir(src); await Promise.all(items.map(async (item) => { const srcItem = path.join(src, item); const destItem = path.join(dest, item); const include = await runFilter(srcItem, destItem, opts); if (!include) return; const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); })); if (!destStat) { await fs4.chmod(dest, srcStat.mode); } } async function onLink(destStat, src, dest, opts) { let resolvedSrc = await fs4.readlink(src); if (opts.dereference) { resolvedSrc = path.resolve(process.cwd(), resolvedSrc); } if (!destStat) { return fs4.symlink(resolvedSrc, dest); } let resolvedDest = null; try { resolvedDest = await fs4.readlink(dest); } catch (e) { if (e.code === "EINVAL" || e.code === "UNKNOWN") return fs4.symlink(resolvedSrc, dest); throw e; } if (opts.dereference) { resolvedDest = path.resolve(process.cwd(), resolvedDest); } if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); } if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); } await fs4.unlink(dest); return fs4.symlink(resolvedSrc, dest); } module.exports = copy; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy-sync.js var require_copy_sync = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy-sync.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var fs4 = require_graceful_fs(); var path = chunk6D5PUESK_cjs.__require("path"); var mkdirsSync = require_mkdirs().mkdirsSync; var utimesMillisSync = require_utimes().utimesMillisSync; var stat = require_stat(); function copySync(src, dest, opts) { if (typeof opts === "function") { opts = { filter: opts }; } opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { process.emitWarning( "Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269", "Warning", "fs-extra-WARN0002" ); } const { srcStat, destStat } = stat.checkPathsSync(src, dest, "copy", opts); stat.checkParentPathsSync(src, srcStat, dest, "copy"); if (opts.filter && !opts.filter(src, dest)) return; const destParent = path.dirname(dest); if (!fs4.existsSync(destParent)) mkdirsSync(destParent); return getStats(destStat, src, dest, opts); } function getStats(destStat, src, dest, opts) { const statSync = opts.dereference ? fs4.statSync : fs4.lstatSync; const srcStat = statSync(src); if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts); else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts); else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts); else if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`); else if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`); throw new Error(`Unknown file: ${src}`); } function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) return copyFile(srcStat, src, dest, opts); return mayCopyFile(srcStat, src, dest, opts); } function mayCopyFile(srcStat, src, dest, opts) { if (opts.overwrite) { fs4.unlinkSync(dest); return copyFile(srcStat, src, dest, opts); } else if (opts.errorOnExist) { throw new Error(`'${dest}' already exists`); } } function copyFile(srcStat, src, dest, opts) { fs4.copyFileSync(src, dest); if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest); return setDestMode(dest, srcStat.mode); } function handleTimestamps(srcMode, src, dest) { if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode); return setDestTimestamps(src, dest); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } function makeFileWritable(dest, srcMode) { return setDestMode(dest, srcMode | 128); } function setDestMode(dest, srcMode) { return fs4.chmodSync(dest, srcMode); } function setDestTimestamps(src, dest) { const updatedSrcStat = fs4.statSync(src); return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } function onDir(srcStat, destStat, src, dest, opts) { if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts); return copyDir(src, dest, opts); } function mkDirAndCopy(srcMode, src, dest, opts) { fs4.mkdirSync(dest); copyDir(src, dest, opts); return setDestMode(dest, srcMode); } function copyDir(src, dest, opts) { fs4.readdirSync(src).forEach((item) => copyDirItem(item, src, dest, opts)); } function copyDirItem(item, src, dest, opts) { const srcItem = path.join(src, item); const destItem = path.join(dest, item); if (opts.filter && !opts.filter(srcItem, destItem)) return; const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy", opts); return getStats(destStat, srcItem, destItem, opts); } function onLink(destStat, src, dest, opts) { let resolvedSrc = fs4.readlinkSync(src); if (opts.dereference) { resolvedSrc = path.resolve(process.cwd(), resolvedSrc); } if (!destStat) { return fs4.symlinkSync(resolvedSrc, dest); } else { let resolvedDest; try { resolvedDest = fs4.readlinkSync(dest); } catch (err) { if (err.code === "EINVAL" || err.code === "UNKNOWN") return fs4.symlinkSync(resolvedSrc, dest); throw err; } if (opts.dereference) { resolvedDest = path.resolve(process.cwd(), resolvedDest); } if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); } if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); } return copyLink(resolvedSrc, dest); } } function copyLink(resolvedSrc, dest) { fs4.unlinkSync(dest); return fs4.symlinkSync(resolvedSrc, dest); } module.exports = copySync; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/index.js var require_copy2 = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/index.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var u = require_universalify().fromPromise; module.exports = { copy: u(require_copy()), copySync: require_copy_sync() }; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/remove/index.js var require_remove = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/remove/index.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var fs4 = require_graceful_fs(); var u = require_universalify().fromCallback; function remove(path, callback) { fs4.rm(path, { recursive: true, force: true }, callback); } function removeSync(path) { fs4.rmSync(path, { recursive: true, force: true }); } module.exports = { remove: u(remove), removeSync }; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/empty/index.js var require_empty = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/empty/index.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var u = require_universalify().fromPromise; var fs4 = require_fs(); var path = chunk6D5PUESK_cjs.__require("path"); var mkdir = require_mkdirs(); var remove = require_remove(); var emptyDir = u(async function emptyDir2(dir) { let items; try { items = await fs4.readdir(dir); } catch { return mkdir.mkdirs(dir); } return Promise.all(items.map((item) => remove.remove(path.join(dir, item)))); }); function emptyDirSync(dir) { let items; try { items = fs4.readdirSync(dir); } catch { return mkdir.mkdirsSync(dir); } items.forEach((item) => { item = path.join(dir, item); remove.removeSync(item); }); } module.exports = { emptyDirSync, emptydirSync: emptyDirSync, emptyDir, emptydir: emptyDir }; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/file.js var require_file = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/file.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var u = require_universalify().fromPromise; var path = chunk6D5PUESK_cjs.__require("path"); var fs4 = require_fs(); var mkdir = require_mkdirs(); async function createFile(file) { let stats; try { stats = await fs4.stat(file); } catch { } if (stats && stats.isFile()) return; const dir = path.dirname(file); let dirStats = null; try { dirStats = await fs4.stat(dir); } catch (err) { if (err.code === "ENOENT") { await mkdir.mkdirs(dir); await fs4.writeFile(file, ""); return; } else { throw err; } } if (dirStats.isDirectory()) { await fs4.writeFile(file, ""); } else { await fs4.readdir(dir); } } function createFileSync(file) { let stats; try { stats = fs4.statSync(file); } catch { } if (stats && stats.isFile()) return; const dir = path.dirname(file); try { if (!fs4.statSync(dir).isDirectory()) { fs4.readdirSync(dir); } } catch (err) { if (err && err.code === "ENOENT") mkdir.mkdirsSync(dir); else throw err; } fs4.writeFileSync(file, ""); } module.exports = { createFile: u(createFile), createFileSync }; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/link.js var require_link = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/link.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var u = require_universalify().fromPromise; var path = chunk6D5PUESK_cjs.__require("path"); var fs4 = require_fs(); var mkdir = require_mkdirs(); var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); async function createLink(srcpath, dstpath) { let dstStat; try { dstStat = await fs4.lstat(dstpath); } catch { } let srcStat; try { srcStat = await fs4.lstat(srcpath); } catch (err) { err.message = err.message.replace("lstat", "ensureLink"); throw err; } if (dstStat && areIdentical(srcStat, dstStat)) return; const dir = path.dirname(dstpath); const dirExists = await pathExists(dir); if (!dirExists) { await mkdir.mkdirs(dir); } await fs4.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; try { dstStat = fs4.lstatSync(dstpath); } catch { } try { const srcStat = fs4.lstatSync(srcpath); if (dstStat && areIdentical(srcStat, dstStat)) return; } catch (err) { err.message = err.message.replace("lstat", "ensureLink"); throw err; } const dir = path.dirname(dstpath); const dirExists = fs4.existsSync(dir); if (dirExists) return fs4.linkSync(srcpath, dstpath); mkdir.mkdirsSync(dir); return fs4.linkSync(srcpath, dstpath); } module.exports = { createLink: u(createLink), createLinkSync }; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-paths.js var require_symlink_paths = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var path = chunk6D5PUESK_cjs.__require("path"); var fs4 = require_fs(); var { pathExists } = require_path_exists(); var u = require_universalify().fromPromise; async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { try { await fs4.lstat(srcpath); } catch (err) { err.message = err.message.replace("lstat", "ensureSymlink"); throw err; } return { toCwd: srcpath, toDst: srcpath }; } const dstdir = path.dirname(dstpath); const relativeToDst = path.join(dstdir, srcpath); const exists = await pathExists(relativeToDst); if (exists) { return { toCwd: relativeToDst, toDst: srcpath }; } try { await fs4.lstat(srcpath); } catch (err) { err.message = err.message.replace("lstat", "ensureSymlink"); throw err; } return { toCwd: srcpath, toDst: path.relative(dstdir, srcpath) }; } function symlinkPathsSync(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { const exists2 = fs4.existsSync(srcpath); if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; } const dstdir = path.dirname(dstpath); const relativeToDst = path.join(dstdir, srcpath); const exists = fs4.existsSync(relativeToDst); if (exists) { return { toCwd: relativeToDst, toDst: srcpath }; } const srcExists = fs4.existsSync(srcpath); if (!srcExists) throw new Error("relative srcpath does not exist"); return { toCwd: srcpath, toDst: path.relative(dstdir, srcpath) }; } module.exports = { symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-type.js var require_symlink_type = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-type.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var fs4 = require_fs(); var u = require_universalify().fromPromise; async function symlinkType(srcpath, type) { if (type) return type; let stats; try { stats = await fs4.lstat(srcpath); } catch { return "file"; } return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { if (type) return type; let stats; try { stats = fs4.lstatSync(srcpath); } catch { return "file"; } return stats && stats.isDirectory() ? "dir" : "file"; } module.exports = { symlinkType: u(symlinkType), symlinkTypeSync }; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink.js var require_symlink = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var u = require_universalify().fromPromise; var path = chunk6D5PUESK_cjs.__require("path"); var fs4 = require_fs(); var { mkdirs, mkdirsSync } = require_mkdirs(); var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); var { symlinkType, symlinkTypeSync } = require_symlink_type(); var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); async function createSymlink(srcpath, dstpath, type) { let stats; try { stats = await fs4.lstat(dstpath); } catch { } if (stats && stats.isSymbolicLink()) { const [srcStat, dstStat] = await Promise.all([ fs4.stat(srcpath), fs4.stat(dstpath) ]); if (areIdentical(srcStat, dstStat)) return; } const relative2 = await symlinkPaths(srcpath, dstpath); srcpath = relative2.toDst; const toType = await symlinkType(relative2.toCwd, type); const dir = path.dirname(dstpath); if (!await pathExists(dir)) { await mkdirs(dir); } return fs4.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; try { stats = fs4.lstatSync(dstpath); } catch { } if (stats && stats.isSymbolicLink()) { const srcStat = fs4.statSync(srcpath); const dstStat = fs4.statSync(dstpath); if (areIdentical(srcStat, dstStat)) return; } const relative2 = symlinkPathsSync(srcpath, dstpath); srcpath = relative2.toDst; type = symlinkTypeSync(relative2.toCwd, type); const dir = path.dirname(dstpath); const exists = fs4.existsSync(dir); if (exists) return fs4.symlinkSync(srcpath, dstpath, type); mkdirsSync(dir); return fs4.symlinkSync(srcpath, dstpath, type); } module.exports = { createSymlink: u(createSymlink), createSymlinkSync }; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/index.js var require_ensure = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/index.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var { createFile, createFileSync } = require_file(); var { createLink, createLinkSync } = require_link(); var { createSymlink, createSymlinkSync } = require_symlink(); module.exports = { // file createFile, createFileSync, ensureFile: createFile, ensureFileSync: createFileSync, // link createLink, createLinkSync, ensureLink: createLink, ensureLinkSync: createLinkSync, // symlink createSymlink, createSymlinkSync, ensureSymlink: createSymlink, ensureSymlinkSync: createSymlinkSync }; } }); // ../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/utils.js var require_utils2 = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/utils.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); function stringify(obj, { EOL = "\n", finalEOL = true, replacer = null, spaces } = {}) { const EOF = finalEOL ? EOL : ""; const str = JSON.stringify(obj, replacer, spaces); return str.replace(/\n/g, EOL) + EOF; } function stripBom(content) { if (Buffer.isBuffer(content)) content = content.toString("utf8"); return content.replace(/^\uFEFF/, ""); } module.exports = { stringify, stripBom }; } }); // ../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/index.js var require_jsonfile = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/index.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var _fs; try { _fs = require_graceful_fs(); } catch (_) { _fs = chunk6D5PUESK_cjs.__require("fs"); } var universalify = require_universalify(); var { stringify, stripBom } = require_utils2(); async function _readFile(file, options = {}) { if (typeof options === "string") { options = { encoding: options }; } const fs4 = options.fs || _fs; const shouldThrow = "throws" in options ? options.throws : true; let data = await universalify.fromCallback(fs4.readFile)(file, options); data = stripBom(data); let obj; try { obj = JSON.parse(data, options ? options.reviver : null); } catch (err) { if (shouldThrow) { err.message = `${file}: ${err.message}`; throw err; } else { return null; } } return obj; } var readFile = universalify.fromPromise(_readFile); function readFileSync(file, options = {}) { if (typeof options === "string") { options = { encoding: options }; } const fs4 = options.fs || _fs; const shouldThrow = "throws" in options ? options.throws : true; try { let content = fs4.readFileSync(file, options); content = stripBom(content); return JSON.parse(content, options.reviver); } catch (err) { if (shouldThrow) { err.message = `${file}: ${err.message}`; throw err; } else { return null; } } } async function _writeFile(file, obj, options = {}) { const fs4 = options.fs || _fs; const str = stringify(obj, options); await universalify.fromCallback(fs4.writeFile)(file, str, options); } var writeFile = universalify.fromPromise(_writeFile); function writeFileSync(file, obj, options = {}) { const fs4 = options.fs || _fs; const str = stringify(obj, options); return fs4.writeFileSync(file, str, options); } var jsonfile = { readFile, readFileSync, writeFile, writeFileSync }; module.exports = jsonfile; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/jsonfile.js var require_jsonfile2 = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/jsonfile.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var jsonFile = require_jsonfile(); module.exports = { // jsonfile exports readJson: jsonFile.readFile, readJsonSync: jsonFile.readFileSync, writeJson: jsonFile.writeFile, writeJsonSync: jsonFile.writeFileSync }; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/output-file/index.js var require_output_file = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/output-file/index.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var u = require_universalify().fromPromise; var fs4 = require_fs(); var path = chunk6D5PUESK_cjs.__require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); if (!await pathExists(dir)) { await mkdir.mkdirs(dir); } return fs4.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); if (!fs4.existsSync(dir)) { mkdir.mkdirsSync(dir); } fs4.writeFileSync(file, ...args); } module.exports = { outputFile: u(outputFile), outputFileSync }; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/output-json.js var require_output_json = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/output-json.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var { stringify } = require_utils2(); var { outputFile } = require_output_file(); async function outputJson(file, data, options = {}) { const str = stringify(data, options); await outputFile(file, str, options); } module.exports = outputJson; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/output-json-sync.js var require_output_json_sync = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/output-json-sync.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var { stringify } = require_utils2(); var { outputFileSync } = require_output_file(); function outputJsonSync(file, data, options) { const str = stringify(data, options); outputFileSync(file, str, options); } module.exports = outputJsonSync; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/index.js var require_json = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/index.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var u = require_universalify().fromPromise; var jsonFile = require_jsonfile2(); jsonFile.outputJson = u(require_output_json()); jsonFile.outputJsonSync = require_output_json_sync(); jsonFile.outputJSON = jsonFile.outputJson; jsonFile.outputJSONSync = jsonFile.outputJsonSync; jsonFile.writeJSON = jsonFile.writeJson; jsonFile.writeJSONSync = jsonFile.writeJsonSync; jsonFile.readJSON = jsonFile.readJson; jsonFile.readJSONSync = jsonFile.readJsonSync; module.exports = jsonFile; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move.js var require_move = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var fs4 = require_fs(); var path = chunk6D5PUESK_cjs.__require("path"); var { copy } = require_copy2(); var { remove } = require_remove(); var { mkdirp } = require_mkdirs(); var { pathExists } = require_path_exists(); var stat = require_stat(); async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); await stat.checkParentPaths(src, srcStat, dest, "move"); const destParent = path.dirname(dest); const parsedParentPath = path.parse(destParent); if (parsedParentPath.root !== destParent) { await mkdirp(destParent); } return doRename(src, dest, overwrite, isChangingCase); } async function doRename(src, dest, overwrite, isChangingCase) { if (!isChangingCase) { if (overwrite) { await remove(dest); } else if (await pathExists(dest)) { throw new Error("dest already exists."); } } try { await fs4.rename(src, dest); } catch (err) { if (err.code !== "EXDEV") { throw err; } await moveAcrossDevice(src, dest, overwrite); } } async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; await copy(src, dest, opts); return remove(src); } module.exports = move; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move-sync.js var require_move_sync = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move-sync.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var fs4 = require_graceful_fs(); var path = chunk6D5PUESK_cjs.__require("path"); var copySync = require_copy2().copySync; var removeSync = require_remove().removeSync; var mkdirpSync = require_mkdirs().mkdirpSync; var stat = require_stat(); function moveSync(src, dest, opts) { opts = opts || {}; const overwrite = opts.overwrite || opts.clobber || false; const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts); stat.checkParentPathsSync(src, srcStat, dest, "move"); if (!isParentRoot(dest)) mkdirpSync(path.dirname(dest)); return doRename(src, dest, overwrite, isChangingCase); } function isParentRoot(dest) { const parent = path.dirname(dest); const parsedPath = path.parse(parent); return parsedPath.root === parent; } function doRename(src, dest, overwrite, isChangingCase) { if (isChangingCase) return rename(src, dest, overwrite); if (overwrite) { removeSync(dest); return rename(src, dest, overwrite); } if (fs4.existsSync(dest)) throw new Error("dest already exists."); return rename(src, dest, overwrite); } function rename(src, dest, overwrite) { try { fs4.renameSync(src, dest); } catch (err) { if (err.code !== "EXDEV") throw err; return moveAcrossDevice(src, dest, overwrite); } } function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; copySync(src, dest, opts); return removeSync(src); } module.exports = moveSync; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/index.js var require_move2 = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/index.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); var u = require_universalify().fromPromise; module.exports = { move: u(require_move()), moveSync: require_move_sync() }; } }); // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/index.js var require_lib = chunk6D5PUESK_cjs.__commonJS({ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/index.js"(exports, module) { chunk6D5PUESK_cjs.init_cjs_shims(); module.exports = { // Export promiseified graceful-fs: ...require_fs(), // Export extra methods: ...require_copy2(), ...require_empty(), ...require_ensure(), ...require_json(), ...require_mkdirs(), ...require_move2(), ...require_output_file(), ...require_path_exists(), ...require_remove() }; } }); // src/index.ts chunk6D5PUESK_cjs.init_cjs_shims(); // src/clean.ts chunk6D5PUESK_cjs.init_cjs_shims(); var import_fs_extra = chunk6D5PUESK_cjs.__toESM(require_lib(), 1); async function clean(path) { return import_fs_extra.default.remove(path); } // src/read.ts chunk6D5PUESK_cjs.init_cjs_shims(); var import_fs_extra2 = chunk6D5PUESK_cjs.__toESM(require_lib(), 1); function slash(path, platform = "linux") { const isWindowsPath = /^\\\\\?\\/.test(path); if (["linux", "mac"].includes(platform) && !isWindowsPath) { return path.replaceAll(/\\/g, "/").replace("../", "").trimEnd(); } return path.replaceAll(/\\/g, "/").replace("../", "").trimEnd(); } function getRelativePath(rootDir, filePath, platform = "linux") { if (!rootDir || !filePath) { throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ""} ${filePath || ""}`); } const relativePath = path.relative(rootDir, filePath); const slashedPath = slash(relativePath, platform); if (slashedPath.startsWith("../")) { return slashedPath; } return `./${slashedPath}`; } var reader = jsRuntime.switcher( { node: async (path) => { return import_fs_extra2.default.readFile(path, { encoding: "utf8" }); }, bun: async (path) => { const file = Bun.file(path); return file.text(); } }, "node" ); var syncReader = jsRuntime.switcher( { node: (path) => { return import_fs_extra2.default.readFileSync(path, { encoding: "utf8" }); }, bun: () => { throw new Error("Bun cannot read sync"); } }, "node" ); async function read(path) { return reader(path); } function readSync(path) { return syncReader(path); } // src/write.ts chunk6D5PUESK_cjs.init_cjs_shims(); var import_fs_extra3 = chunk6D5PUESK_cjs.__toESM(require_lib(), 1); var writer = jsRuntime.switcher( { node: async (path$1, data, { sanity }) => { try { const oldContent = await import_fs_extra3.default.readFile(path.resolve(path$1), { encoding: "utf-8" }); if (oldContent?.toString() === data?.toString()) { return; } } catch (_err) { } await import_fs_extra3.default.outputFile(path.resolve(path$1), data, { encoding: "utf-8" }); if (sanity) { const savedData = await import_fs_extra3.default.readFile(path.resolve(path$1), { encoding: "utf-8" }); if (savedData?.toString() !== data?.toString()) { throw new Error(`Sanity check failed for ${path$1} Data[${data.length}]: ${data} Saved[${savedData.length}]: ${savedData} `); } return savedData; } return data; }, bun: async (path$1, data, { sanity }) => { try { await Bun.write(path.resolve(path$1), data); if (sanity) { const file = Bun.file(path.resolve(path$1)); const savedData = await file.text(); if (savedData?.toString() !== data?.toString()) { throw new Error(`Sanity check failed for ${path$1} Data[${path$1.length}]: ${path$1} Saved[${savedData.length}]: ${savedData} `); } return savedData; } return data; } catch (e) { console.error(e); } } }, "node" ); async function write(path, data, options = {}) { if (data.trim() === "") { return void 0; } return writer(path, data.trim(), options); } // src/index.ts function trimExtName(text) { return text.replace(/\.[^/.]+$/, ""); } exports.clean = clean; exports.getRelativePath = getRelativePath; exports.read = read; exports.readSync = readSync; exports.trimExtName = trimExtName; exports.write = write; //# sourceMappingURL=index.cjs.map //# sourceMappingURL=index.cjs.map