UNPKG

prettier

Version:

Prettier is an opinionated code formatter

1,223 lines (1,193 loc) 485 kB
import { createRequire as __prettierCreateRequire } from "module"; import { fileURLToPath as __prettierFileUrlToPath } from "url"; import { dirname as __prettierDirname } from "path"; const require = __prettierCreateRequire(import.meta.url); const __filename = __prettierFileUrlToPath(import.meta.url); const __dirname = __prettierDirname(__filename); var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __typeError = (msg) => { throw TypeError(msg); }; var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) { if (typeof require !== "undefined") return require.apply(this, arguments); throw Error('Dynamic require of "' + x + '" is not supported'); }); var __esm = (fn, res) => function __init() { return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; }; var __commonJS = (cb, mod) => function __require2() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key2 of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key2) && key2 !== except) __defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg); var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)); var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value); var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value); // node_modules/find-up-path/dist/index.js import fs from "fs"; import path from "path"; import process2 from "process"; var findUpPath, dist_default; var init_dist = __esm({ "node_modules/find-up-path/dist/index.js"() { findUpPath = (fileName, folderPath = process2.cwd(), maxDepth = 25) => { let filePath = path.normalize(path.join(folderPath, fileName)); let depth = 1; while (true) { if (depth > maxDepth) return; if (fs.existsSync(filePath)) return filePath; folderPath = path.resolve(folderPath, ".."); const filePathNext = path.normalize(path.join(folderPath, fileName)); if (filePathNext === filePath) return; filePath = filePathNext; depth += 1; } }; dist_default = findUpPath; } }); // node_modules/find-up-json/dist/utils.js var attempt; var init_utils = __esm({ "node_modules/find-up-json/dist/utils.js"() { attempt = (fn, fallback) => { try { return fn(); } catch { return fallback; } }; } }); // node_modules/find-up-json/dist/index.js import { Buffer as Buffer2 } from "buffer"; import fs2 from "fs"; import process3 from "process"; var findUp, dist_default2; var init_dist2 = __esm({ "node_modules/find-up-json/dist/index.js"() { init_dist(); init_utils(); findUp = (fileName, folderPath = process3.cwd(), maxDepth = 25) => { const path17 = dist_default(fileName, folderPath, maxDepth); if (!path17) return; const buffer2 = attempt(() => fs2.readFileSync(path17), Buffer2.alloc(0)); const content = attempt(() => JSON.parse(buffer2.toString()), {}); return { path: path17, buffer: buffer2, content }; }; dist_default2 = findUp; } }); // node_modules/get-current-package/dist/index.js import fs3 from "fs"; import path2 from "path"; import process4 from "process"; var getCurrentPackage, dist_default3; var init_dist3 = __esm({ "node_modules/get-current-package/dist/index.js"() { init_dist2(); getCurrentPackage = () => { try { const filePath = fs3.realpathSync(process4.argv[1]); const folderPath = path2.dirname(filePath); const pkg = dist_default2("package.json", folderPath); return pkg == null ? void 0 : pkg.content; } catch { return; } }; dist_default3 = getCurrentPackage; } }); // node_modules/tiny-colors/dist/constants.js var _a, ENV, _a2, ARGV, _a3, _b, _c, ENABLED; var init_constants = __esm({ "node_modules/tiny-colors/dist/constants.js"() { ENV = ((_a = globalThis.process) == null ? void 0 : _a.env) || {}; ARGV = ((_a2 = globalThis.process) == null ? void 0 : _a2.argv) || []; ENABLED = !("NO_COLOR" in ENV) && ENV.COLOR !== "0" && ENV.TERM !== "dumb" && !ARGV.includes("--no-color") && !ARGV.includes("--no-colors") && (ENV.COLOR === "1" || !((_a3 = globalThis.process) == null ? void 0 : _a3.stdout) || ((_c = (_b = globalThis.process) == null ? void 0 : _b.stdout) == null ? void 0 : _c.isTTY) === true); } }); // node_modules/tiny-colors/dist/index.js var chain, wrap, colors, dist_default4; var init_dist4 = __esm({ "node_modules/tiny-colors/dist/index.js"() { init_constants(); chain = (modifier) => { return new Proxy(modifier, { get(target, prop) { if (prop in colors) { return chain((string2) => modifier(colors[prop](string2))); } else { return target[prop]; } } }); }; wrap = (start, end) => { return chain((string2) => { if (!ENABLED) return string2; return `\x1B[${start}m${string2}\x1B[${end}m`; }); }; colors = { /* MODIFIERS */ reset: wrap(0, 0), bold: wrap(1, 22), dim: wrap(2, 22), italic: wrap(3, 23), underline: wrap(4, 24), overline: wrap(53, 55), inverse: wrap(7, 27), hidden: wrap(8, 28), strikethrough: wrap(9, 29), /* FOREGOUND */ black: wrap(30, 39), red: wrap(31, 39), green: wrap(32, 39), yellow: wrap(33, 39), blue: wrap(34, 39), magenta: wrap(35, 39), cyan: wrap(36, 39), white: wrap(37, 39), gray: wrap(90, 39), /* BACKGROUND */ bgBlack: wrap(40, 49), bgRed: wrap(41, 49), bgGreen: wrap(42, 49), bgYellow: wrap(43, 49), bgBlue: wrap(44, 49), bgMagenta: wrap(45, 49), bgCyan: wrap(46, 49), bgWhite: wrap(47, 49), bgGray: wrap(100, 49) }; dist_default4 = colors; } }); // node_modules/tiny-parse-argv/dist/utils.js var castArray, isBoolean, isNil, isNull, isOverridable, isUndefined, setNormal, setVariadic, uniq, uniqBy, without, zip; var init_utils2 = __esm({ "node_modules/tiny-parse-argv/dist/utils.js"() { castArray = (value) => { return Array.isArray(value) ? value : [value]; }; isBoolean = (value) => { return value === true || value === false; }; isNil = (value) => { return value === null || value === void 0; }; isNull = (value) => { return value === null; }; isOverridable = (value) => { return isNil(value) || isBoolean(value) || value === ""; }; isUndefined = (value) => { return value === void 0; }; setNormal = (target, key2, value, override) => { if (override) { target[key2] = value; } else if (Array.isArray(target[key2])) { target[key2].push(value); } else if (isOverridable(target[key2])) { target[key2] = value; } else { target[key2] = [target[key2], value]; } }; setVariadic = (target, key2, value, override) => { const values = castArray(value); if (override) { target[key2] = values; } else if (Array.isArray(target[key2])) { target[key2].push(...values); } else if (isOverridable(target[key2])) { target[key2] = values; } else { target[key2] = [target[key2], ...values]; } }; uniq = (values) => { return Array.from(new Set(values)); }; uniqBy = (values, iterator) => { const ids = /* @__PURE__ */ new Set(); return values.filter((value, index, arr) => { const id = iterator(value, index, arr); if (ids.has(id)) return false; ids.add(id); return true; }); }; without = (values, value) => { return values.filter((other) => other !== value); }; zip = (keys, value) => { return Object.fromEntries(Array.from(keys).map((key2) => [key2, value])); }; } }); // node_modules/tiny-parse-argv/dist/index.js var getAliasesMap, getAliasedMap, getAliasedSet, getAliasedDefaults, getAliasedIncompatibles, setAliased, parseDoubleHyphen, parseWithRegExp, parseCharSeparator, parseEqualsSeparator, parseImplicitSeparator, parseProto, parseOption, parseOptionNegation, parseValue, unquote, parseArgv, dist_default5; var init_dist5 = __esm({ "node_modules/tiny-parse-argv/dist/index.js"() { init_utils2(); getAliasesMap = (aliases = {}) => { const map2 = {}; for (const key2 in aliases) { const values = uniq([key2, ...aliases[key2] || []]); for (const value of values) { if (value in map2) continue; map2[value] = without(values, value); } } return map2; }; getAliasedMap = (aliases, object) => { const map2 = /* @__PURE__ */ new Map(); for (const key2 in object) { const value = object[key2]; if (isUndefined(value)) continue; map2.set(key2, value); const keyAliases = aliases[key2]; if (!keyAliases) continue; for (const key3 of keyAliases) { map2.set(key3, value); } } return map2; }; getAliasedSet = (aliases, values = []) => { const valuesAliases = values.flatMap((value) => aliases[value] || []); const valuesAliased = /* @__PURE__ */ new Set([...values, ...valuesAliases]); return valuesAliased; }; getAliasedDefaults = (aliases, defaults = {}) => { const defaultsAliased = {}; for (const key2 in defaults) { const value = defaults[key2]; const keys = uniq([key2, ...aliases[key2] || []]); for (const key3 of keys) { if (key3 in defaultsAliased) continue; defaultsAliased[key3] = value; } } return defaultsAliased; }; getAliasedIncompatibles = (aliases, incompatibles = {}) => { const incompatiblesAliased = {}; for (const source2 in incompatibles) { const sources = getAliasedSet(aliases, [source2]); const targets = getAliasedSet(aliases, incompatibles[source2]); for (const source3 of sources) { for (const target of targets) { const sourceSet = incompatiblesAliased[source3] || (incompatiblesAliased[source3] = /* @__PURE__ */ new Set()); const targetSet = incompatiblesAliased[target] || (incompatiblesAliased[target] = /* @__PURE__ */ new Set()); sourceSet.add(target); targetSet.add(source3); } } } return incompatiblesAliased; }; setAliased = (target, key2, value, unary, variadic, aliases) => { var _a4; const set3 = variadic ? setVariadic : setNormal; set3(target, key2, value, unary); (_a4 = aliases[key2]) == null ? void 0 : _a4.forEach((alias) => { set3(target, alias, value, unary); }); }; parseDoubleHyphen = (argv) => { const index = argv.indexOf("--"); if (index < 0) return [argv, []]; const parse8 = argv.slice(0, index); const preserve = argv.slice(index + 1); return [parse8, preserve]; }; parseWithRegExp = (argv, re, callback) => { return argv.flatMap((arg) => { const match2 = re.exec(arg); if (!match2) return arg; return callback(...match2); }); }; parseCharSeparator = (argv) => { const re = /^-([a-zA-Z0-9\.]{2,})([^]*)$/; return parseWithRegExp(argv, re, (_, chars2) => chars2.split("").map((char) => `-${char}`)); }; parseEqualsSeparator = (argv) => { const re = /^(--?[^=][^=]*?)=([^]*)$/; const shieldValue = (value) => value.startsWith("-") ? `"${value}"` : value; return parseWithRegExp(argv, re, (_, key2, value) => [key2, shieldValue(value)]); }; parseImplicitSeparator = (argv) => { const re = /^(--?(?:no-)?\S*?[a-zA-Z]\S*?)((?:[0-9\/]|-(?=$))[^]*)$/; return parseWithRegExp(argv, re, (_, key2, value) => [key2, value]); }; parseProto = (argv) => { const re = /^--?(no-)?(__proto__|prototype|constructor)$/; return argv.filter((arg, index) => !re.test(arg) && !re.test(argv[index - 1])); }; parseOption = (arg) => { const optionRe = /^(--?)([^]+)$/; const match2 = optionRe.exec(arg); if (!match2) return; return match2[2]; }; parseOptionNegation = (arg) => { const negationRe = /^no-([^]+)$/; const match2 = negationRe.exec(arg); if (!match2) return [arg, true]; return [match2[1], false]; }; parseValue = (key2, valueRaw, booleans, integers, numbers, strings, validators) => { var _a4; const value = unquote(String(valueRaw)); if (((_a4 = validators.get(key2)) == null ? void 0 : _a4(value)) === false) { return null; } if (booleans.has(key2)) { if (value === "true") return true; if (value === "false") return false; } if (integers.has(key2)) { const integer = Number(value); if (Number.isInteger(integer)) return integer; return null; } if (numbers.has(key2)) { const number = Number(value); if (!Number.isNaN(number)) return number; return null; } if (strings.has(key2) || value !== valueRaw) { return value; } const numberRe = /^0[xX][0-9a-fA-F]+$|^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][-+]?\d+)?$/; if (numberRe.test(value)) { return Number(value); } else { return value; } }; unquote = (value) => { return value.replace(/^(['"])(\1*)(.*)(\1\2)$/, "$3"); }; parseArgv = (argv, options = {}) => { const aliases = getAliasesMap(options.alias); const booleans = getAliasedSet(aliases, options.boolean); const integers = getAliasedSet(aliases, options.integer); const numbers = getAliasedSet(aliases, options.number); const strings = getAliasedSet(aliases, options.string); const eagers = getAliasedSet(aliases, options.eager); const unarys = getAliasedSet(aliases, options.unary); const variadics = getAliasedSet(aliases, options.variadic); const defaults = getAliasedDefaults(aliases, options.default); const incompatibles = getAliasedIncompatibles(aliases, options.incompatible); const validators = getAliasedMap(aliases, options.validators); const required = options.required || []; const known = /* @__PURE__ */ new Set([...booleans, ...integers, ...numbers, ...strings, ...Object.keys(defaults)]); const found = []; const onIncompatible = options.onIncompatible; const onInvalid = options.onInvalid; const onMissing = options.onMissing; const onUnknown = options.onUnknown; const [parse8, preserve] = parseDoubleHyphen(argv); const parsed = { _: [], "--": preserve }; const args = parseCharSeparator(parseImplicitSeparator(parseEqualsSeparator(parseProto(parse8)))); let optionPrev = ""; let optionEagerPrev = ""; for (let i = 0, l = args.length; i < l; i++) { const arg = args[i]; const option = parseOption(arg); if (option) { const [key2, positive] = parseOptionNegation(option); if (isOverridable(parsed[key2])) { if (!integers.has(key2) && !numbers.has(key2) && !strings.has(key2)) { const unary = unarys.has(key2); const variadic = variadics.has(key2); const value = variadic ? [positive] : positive; setAliased(parsed, key2, value, unary, variadic, aliases); } } found.push(key2); optionPrev = option; optionEagerPrev = eagers.has(key2) ? option : ""; } else { const value = parseValue(optionPrev, arg, booleans, integers, numbers, strings, validators); if (optionPrev && (!booleans.has(optionPrev) || isBoolean(value))) { if (!isNull(value)) { const unary = unarys.has(optionPrev); const variadic = variadics.has(optionPrev); setAliased(parsed, optionPrev, value, unary, variadic, aliases); } } else if (optionEagerPrev && !booleans.has(optionEagerPrev)) { if (!isNull(value)) { const unary = unarys.has(optionEagerPrev); const variadic = variadics.has(optionEagerPrev); setAliased(parsed, optionEagerPrev, value, unary, variadic, aliases); } } else { parsed._.push(String(value ?? arg)); optionEagerPrev = ""; } optionPrev = ""; } } const parsedWithDefaults = { ...defaults, ...parsed }; const parsedWithDefaultsAndBooleans = { ...zip(booleans, false), ...parsedWithDefaults }; if (onUnknown) { const unknowns = Object.keys(parsedWithDefaults).filter((key2) => key2 !== "_" && key2 !== "--" && !known.has(key2)); if (unknowns.length) { onUnknown(unknowns); } } if (onMissing) { const missings = required.filter((key2) => !(key2 in parsedWithDefaults)); if (missings.length) { onMissing(missings); } } if (onInvalid) { const invalids = found.filter((key2) => parsedWithDefaults[key2] === void 0); if (invalids.length) { onInvalid(invalids); } } if (onIncompatible) { const options2 = uniq(found); const pairs2 = []; for (let si = 0, sl = options2.length; si < sl; si++) { const source2 = options2[si]; const sourceIncompatibles = incompatibles[source2]; if (!sourceIncompatibles) continue; for (let ti = si + 1, tl = sl; ti < tl; ti++) { const target = options2[ti]; if (!sourceIncompatibles.has(target)) continue; pairs2.push([source2, target]); } } if (pairs2.length) { const pairsUnique = uniqBy(pairs2, (pair) => [...pair].sort().join()); onIncompatible(pairsUnique); } } return parsedWithDefaultsAndBooleans; }; dist_default5 = parseArgv; } }); // node_modules/ionstore/dist/utils.js var attempt2; var init_utils3 = __esm({ "node_modules/ionstore/dist/utils.js"() { attempt2 = (fn, fallback) => { try { return fn(); } catch { return fallback; } }; } }); // node_modules/ionstore/dist/abstract.js var __classPrivateFieldSet, __classPrivateFieldGet, _AbstractStore_save, AbstractStore, abstract_default; var init_abstract = __esm({ "node_modules/ionstore/dist/abstract.js"() { init_utils3(); __classPrivateFieldSet = function(receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value; }; __classPrivateFieldGet = function(receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; AbstractStore = class extends Map { /* CONSTRUCTOR */ constructor(options) { super(); _AbstractStore_save.set(this, void 0); const { id, backend } = options; if (!/^[a-zA-Z0-9_-]+$/.test(id)) throw new Error(`Invalid store id: "${id}"`); const read3 = () => attempt2(() => backend.read(id), []); const write = () => attempt2(() => backend.write(id, this.entries()), null); for (const [key2, value] of read3()) { super.set(key2, value); } __classPrivateFieldSet(this, _AbstractStore_save, write, "f"); return this; } /* API */ clear() { if (!this.size) return; super.clear(); __classPrivateFieldGet(this, _AbstractStore_save, "f").call(this); } delete(key2) { const deleted = super.delete(key2); if (!deleted) return false; __classPrivateFieldGet(this, _AbstractStore_save, "f").call(this); return true; } set(key2, value) { const valuePrev = this.get(key2); if (value === valuePrev) return this; super.set(key2, value); __classPrivateFieldGet(this, _AbstractStore_save, "f").call(this); return this; } }; _AbstractStore_save = /* @__PURE__ */ new WeakMap(); abstract_default = AbstractStore; } }); // node_modules/ionstore/dist/node.js import fs4 from "fs"; import os from "os"; import path3 from "path"; var NodeStore, node_default; var init_node = __esm({ "node_modules/ionstore/dist/node.js"() { init_abstract(); NodeStore = class extends abstract_default { /* CONSTRUCTOR */ constructor(id) { super({ id, backend: { read: (id2) => { const filePath = path3.join(os.tmpdir(), `ionstore_${id2}.json`); const content = fs4.readFileSync(filePath, "utf8"); return JSON.parse(content); }, write: (id2, data) => { const filePath = path3.join(os.tmpdir(), `ionstore_${id2}.json`); const content = JSON.stringify(Array.from(data)); return fs4.writeFileSync(filePath, content); } } }); } }; node_default = NodeStore; } }); // node_modules/when-exit/dist/node/constants.js import process5 from "process"; var IS_LINUX, IS_WINDOWS; var init_constants2 = __esm({ "node_modules/when-exit/dist/node/constants.js"() { IS_LINUX = process5.platform === "linux"; IS_WINDOWS = process5.platform === "win32"; } }); // node_modules/when-exit/dist/node/signals.js var Signals, signals_default; var init_signals = __esm({ "node_modules/when-exit/dist/node/signals.js"() { init_constants2(); Signals = ["SIGABRT", "SIGALRM", "SIGHUP", "SIGINT", "SIGTERM"]; if (!IS_WINDOWS) { Signals.push("SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT"); } if (IS_LINUX) { Signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT", "SIGUNUSED"); } signals_default = Signals; } }); // node_modules/when-exit/dist/node/interceptor.js import process6 from "process"; var Interceptor, interceptor_default; var init_interceptor = __esm({ "node_modules/when-exit/dist/node/interceptor.js"() { init_constants2(); init_signals(); Interceptor = class { /* CONSTRUCTOR */ constructor() { this.callbacks = /* @__PURE__ */ new Set(); this.exited = false; this.exit = (signal) => { if (this.exited) return; this.exited = true; for (const callback of this.callbacks) { callback(); } if (signal) { if (IS_WINDOWS && (signal !== "SIGINT" && signal !== "SIGTERM" && signal !== "SIGKILL")) { process6.kill(process6.pid, "SIGTERM"); } else { process6.kill(process6.pid, signal); } } }; this.hook = () => { process6.once("exit", () => this.exit()); for (const signal of signals_default) { try { process6.once(signal, () => this.exit(signal)); } catch { } } }; this.register = (callback) => { this.callbacks.add(callback); return () => { this.callbacks.delete(callback); }; }; this.hook(); } }; interceptor_default = new Interceptor(); } }); // node_modules/when-exit/dist/node/index.js var whenExit, node_default2; var init_node2 = __esm({ "node_modules/when-exit/dist/node/index.js"() { init_interceptor(); whenExit = interceptor_default.register; node_default2 = whenExit; } }); // node_modules/tiny-updater/dist/compare.js var compare, compare_default; var init_compare = __esm({ "node_modules/tiny-updater/dist/compare.js"() { compare = (a, b) => { const pa = a.split("."); const pb = b.split("."); for (let i = 0; i < 3; i++) { let na = Number(pa[i]); let nb = Number(pb[i]); if (na > nb) return 1; if (nb > na) return -1; if (!isNaN(na) && isNaN(nb)) return 1; if (isNaN(na) && !isNaN(nb)) return -1; } return 0; }; compare_default = compare; } }); // node_modules/tiny-updater/dist/utils.js var Utils, utils_default; var init_utils4 = __esm({ "node_modules/tiny-updater/dist/utils.js"() { init_dist4(); init_node2(); init_compare(); Utils = { /* API */ fetch: async (url3) => { const signal = Utils.getExitSignal(); const request = await fetch(url3, { signal }); const json2 = await request.json(); return json2; }, getExitSignal: () => { const aborter = new AbortController(); node_default2(() => aborter.abort()); return aborter.signal; }, getLatestVersion: async (name) => { const latestUrl = `https://registry.npmjs.org/${name}/latest`; const latest = await Utils.fetch(latestUrl); return latest.version; }, isNumber: (value) => { return typeof value === "number"; }, isString: (value) => { return typeof value === "string"; }, isUpdateAvailable: (current, latest) => { return compare_default(current, latest) === -1; }, noop: () => { return; }, notify: (name, version, latest) => { var _a4, _b2; if (!((_b2 = (_a4 = globalThis.process) == null ? void 0 : _a4.stdout) == null ? void 0 : _b2.isTTY)) return; const log = () => console.log(` \u{1F4E6} Update available for ${dist_default4.cyan(name)}: ${dist_default4.gray(version)} \u2192 ${dist_default4.green(latest)}`); node_default2(log); } }; utils_default = Utils; } }); // node_modules/tiny-updater/dist/store.js var Store, store_default; var init_store = __esm({ "node_modules/tiny-updater/dist/store.js"() { init_node(); init_utils4(); Store = class { constructor() { this.store = new node_default("tiny-updater"); this.get = (name) => { try { const recordRaw = this.store.get(name); if (!recordRaw) return; const record = JSON.parse(recordRaw); if (!utils_default.isNumber(record.timestampFetch)) return; if (!utils_default.isNumber(record.timestampNotification)) return; if (!utils_default.isString(record.version)) return; return record; } catch { return; } }; this.set = (name, record) => { this.store.set(name, JSON.stringify(record)); }; } }; store_default = new Store(); } }); // node_modules/tiny-updater/dist/index.js var updater, dist_default6; var init_dist6 = __esm({ "node_modules/tiny-updater/dist/index.js"() { init_store(); init_utils4(); updater = async ({ name, version, ttl = 0 }) => { const record = store_default.get(name); const timestamp2 = Date.now(); const isFresh = !record || timestamp2 - record.timestampFetch >= ttl; const latest = isFresh ? await utils_default.getLatestVersion(name).catch(utils_default.noop) : record == null ? void 0 : record.version; if (!latest) return false; if (isFresh) { const record2 = { timestampFetch: timestamp2, timestampNotification: timestamp2, version: latest }; store_default.set(name, record2); } if (!utils_default.isUpdateAvailable(version, latest)) { return false; } if (isFresh) { utils_default.notify(name, version, latest); } return true; }; dist_default6 = updater; } }); // node_modules/fast-string-truncated-width/dist/utils.js var isAmbiguous, isFullWidth, isWide; var init_utils5 = __esm({ "node_modules/fast-string-truncated-width/dist/utils.js"() { isAmbiguous = (x) => { return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109; }; isFullWidth = (x) => { return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510; }; isWide = (x) => { return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9800 && x <= 9811 || x === 9855 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 19968 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101632 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129672 || x >= 129680 && x <= 129725 || x >= 129727 && x <= 129733 || x >= 129742 && x <= 129755 || x >= 129760 && x <= 129768 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141; }; } }); // node_modules/fast-string-truncated-width/dist/index.js var ANSI_RE, CONTROL_RE, TAB_RE, EMOJI_RE, LATIN_RE, MODIFIER_RE, NO_TRUNCATION, getStringTruncatedWidth, dist_default7; var init_dist7 = __esm({ "node_modules/fast-string-truncated-width/dist/index.js"() { init_utils5(); ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y; CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y; TAB_RE = /\t{1,1000}/y; EMOJI_RE = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu; LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y; MODIFIER_RE = /\p{M}+/gu; NO_TRUNCATION = { limit: Infinity, ellipsis: "" }; getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => { const LIMIT = truncationOptions.limit ?? Infinity; const ELLIPSIS2 = truncationOptions.ellipsis ?? ""; const ELLIPSIS_WIDTH2 = (truncationOptions == null ? void 0 : truncationOptions.ellipsisWidth) ?? (ELLIPSIS2 ? getStringTruncatedWidth(ELLIPSIS2, NO_TRUNCATION, widthOptions).width : 0); const ANSI_WIDTH = widthOptions.ansiWidth ?? 0; const CONTROL_WIDTH = widthOptions.controlWidth ?? 0; const TAB_WIDTH = widthOptions.tabWidth ?? 8; const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1; const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2; const FULL_WIDTH_WIDTH = widthOptions.fullWidthWidth ?? 2; const REGULAR_WIDTH = widthOptions.regularWidth ?? 1; const WIDE_WIDTH = widthOptions.wideWidth ?? 2; let indexPrev = 0; let index = 0; let length = input.length; let lengthExtra = 0; let truncationEnabled = false; let truncationIndex = length; let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH2); let unmatchedStart = 0; let unmatchedEnd = 0; let width = 0; let widthExtra = 0; outer: while (true) { if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) { const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index); lengthExtra = 0; for (const char of unmatched.replaceAll(MODIFIER_RE, "")) { const codePoint = char.codePointAt(0) || 0; if (isFullWidth(codePoint)) { widthExtra = FULL_WIDTH_WIDTH; } else if (isWide(codePoint)) { widthExtra = WIDE_WIDTH; } else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) { widthExtra = AMBIGUOUS_WIDTH; } else { widthExtra = REGULAR_WIDTH; } if (width + widthExtra > truncationLimit) { truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra); } if (width + widthExtra > LIMIT) { truncationEnabled = true; break outer; } lengthExtra += char.length; width += widthExtra; } unmatchedStart = unmatchedEnd = 0; } if (index >= length) break; LATIN_RE.lastIndex = index; if (LATIN_RE.test(input)) { lengthExtra = LATIN_RE.lastIndex - index; widthExtra = lengthExtra * REGULAR_WIDTH; if (width + widthExtra > truncationLimit) { truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH)); } if (width + widthExtra > LIMIT) { truncationEnabled = true; break; } width += widthExtra; unmatchedStart = indexPrev; unmatchedEnd = index; index = indexPrev = LATIN_RE.lastIndex; continue; } ANSI_RE.lastIndex = index; if (ANSI_RE.test(input)) { if (width + ANSI_WIDTH > truncationLimit) { truncationIndex = Math.min(truncationIndex, index); } if (width + ANSI_WIDTH > LIMIT) { truncationEnabled = true; break; } width += ANSI_WIDTH; unmatchedStart = indexPrev; unmatchedEnd = index; index = indexPrev = ANSI_RE.lastIndex; continue; } CONTROL_RE.lastIndex = index; if (CONTROL_RE.test(input)) { lengthExtra = CONTROL_RE.lastIndex - index; widthExtra = lengthExtra * CONTROL_WIDTH; if (width + widthExtra > truncationLimit) { truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH)); } if (width + widthExtra > LIMIT) { truncationEnabled = true; break; } width += widthExtra; unmatchedStart = indexPrev; unmatchedEnd = index; index = indexPrev = CONTROL_RE.lastIndex; continue; } TAB_RE.lastIndex = index; if (TAB_RE.test(input)) { lengthExtra = TAB_RE.lastIndex - index; widthExtra = lengthExtra * TAB_WIDTH; if (width + widthExtra > truncationLimit) { truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH)); } if (width + widthExtra > LIMIT) { truncationEnabled = true; break; } width += widthExtra; unmatchedStart = indexPrev; unmatchedEnd = index; index = indexPrev = TAB_RE.lastIndex; continue; } EMOJI_RE.lastIndex = index; if (EMOJI_RE.test(input)) { if (width + EMOJI_WIDTH > truncationLimit) { truncationIndex = Math.min(truncationIndex, index); } if (width + EMOJI_WIDTH > LIMIT) { truncationEnabled = true; break; } width += EMOJI_WIDTH; unmatchedStart = indexPrev; unmatchedEnd = index; index = indexPrev = EMOJI_RE.lastIndex; continue; } index += 1; } return { width: truncationEnabled ? truncationLimit : width, index: truncationEnabled ? truncationIndex : length, truncated: truncationEnabled, ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH2 }; }; dist_default7 = getStringTruncatedWidth; } }); // node_modules/fast-string-width/dist/index.js var NO_TRUNCATION2, fastStringWidth, dist_default8; var init_dist8 = __esm({ "node_modules/fast-string-width/dist/index.js"() { init_dist7(); NO_TRUNCATION2 = { limit: Infinity, ellipsis: "", ellipsisWidth: 0 }; fastStringWidth = (input, options = {}) => { return dist_default7(input, NO_TRUNCATION2, options).width; }; dist_default8 = fastStringWidth; } }); // node_modules/tiny-bin/dist/objects/addon.js var Addon, addon_default; var init_addon = __esm({ "node_modules/tiny-bin/dist/objects/addon.js"() { Addon = class { /* CONSTRUCTOR */ constructor(bin2) { this.bin = bin2; this.stdout = bin2.stdout; this.stderr = bin2.stderr; } }; addon_default = Addon; } }); // node_modules/ansi-purge/dist/constants.js var ANSI_RE2; var init_constants3 = __esm({ "node_modules/ansi-purge/dist/constants.js"() { ANSI_RE2 = /([\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><])/g; } }); // node_modules/ansi-purge/dist/index.js var purge, dist_default9; var init_dist9 = __esm({ "node_modules/ansi-purge/dist/index.js"() { init_constants3(); purge = (str2) => { return str2.replace(ANSI_RE2, ""); }; dist_default9 = purge; } }); // node_modules/tiny-levenshtein/dist/matrix.js var Matrix, matrix_default; var init_matrix = __esm({ "node_modules/tiny-levenshtein/dist/matrix.js"() { Matrix = class { /* CONSTRUCTOR */ constructor(rows, columns, Buffer3 = Uint32Array) { this.rows = rows; this.columns = columns; this.buffer = new Buffer3(this.rows * this.columns); } /* API */ get(row, column2) { const index = row * this.columns + column2; return this.buffer[index]; } set(row, column2, value) { const index = row * this.columns + column2; return this.buffer[index] = value; } }; matrix_default = Matrix; } }); // node_modules/tiny-levenshtein/dist/index.js var levenshtein, dist_default10; var init_dist10 = __esm({ "node_modules/tiny-levenshtein/dist/index.js"() { init_matrix(); levenshtein = (a, b) => { if (a === b) return 0; let start = 0; let aEnd = a.length - 1; let bEnd = b.length - 1; while (start <= aEnd && start <= bEnd) { if (a.charCodeAt(start) !== b.charCodeAt(start)) break; start += 1; } while (aEnd >= start && bEnd >= start) { if (a.charCodeAt(aEnd) !== b.charCodeAt(bEnd)) break; aEnd -= 1; bEnd -= 1; } const aLength = aEnd - start + 1; const bLength = bEnd - start + 1; if (!aLength) return bLength; if (!bLength) return aLength; const maxDistance = Math.max(aLength, bLength); const Buffer3 = maxDistance < 255 ? Uint8Array : maxDistance < 65535 ? Uint16Array : Uint32Array; const matrix = new matrix_default(aLength + 1, bLength + 1, Buffer3); for (let i = 1, l = aLength; i <= l; i++) { matrix.set(i, 0, i); } for (let i = 1, l = bLength; i <= l; i++) { matrix.set(0, i, i); } for (let i = 1; i <= aLength; i++) { for (let j = 1; j <= bLength; j++) { const cost = a.charCodeAt(start + i - 1) === b.charCodeAt(start + j - 1) ? 0 : 1; const deletion = matrix.get(i - 1, j) + 1; const insertion = matrix.get(i, j - 1) + 1; const substitution = matrix.get(i - 1, j - 1) + cost; const value = Math.min(deletion, insertion, substitution); matrix.set(i, j, value); } } const distance = matrix.get(aLength, bLength); return distance; }; dist_default10 = levenshtein; } }); // node_modules/tiny-bin/dist/utils.js var camelCase, castArray2, defer, getClosest, groupBy, identity, isArray, isUndefined2, pushBack, sum; var init_utils6 = __esm({ "node_modules/tiny-bin/dist/utils.js"() { init_dist9(); init_dist10(); camelCase = /* @__PURE__ */ (() => { const dividerRe = /[_.\s-]+/g; const prefixRe = /^[_.\s-]+/g; const upperDigitRe = /\d+[\p{Alpha}\p{N}_]/gu; const upperDividerRe = /[_.\s-]+[\p{Alpha}\p{N}_]/gu; const toUpperCase = (str2) => str2.toUpperCase(); return (str2) => { return str2.trim().toLowerCase().replace(prefixRe, "").replace(upperDigitRe, toUpperCase).replace(upperDividerRe, toUpperCase).replace(dividerRe, ""); }; })(); castArray2 = (value) => { return Array.isArray(value) ? value : [value]; }; defer = (fn) => { setTimeout(fn, 0); }; getClosest = (values, value, maxDistance = 3, caseInsensitive = false) => { if (!values.length) return; const target = caseInsensitive ? value.toLowerCase() : value; const targets = caseInsensitive ? values.map((value2) => value2.toLowerCase()) : values; const distances = targets.map((other) => dist_default10(target, other)); const minDistance = Math.min(...distances); if (minDistance > maxDistance) return; const minDistanceIndex = distances.indexOf(minDistance); const closest = values[minDistanceIndex]; return closest; }; groupBy = (values, iterator) => { const groups = /* @__PURE__ */ new Map(); for (let i = 0, l = values.length; i < l; i++) { const value = values[i]; const key2 = iterator(value, i, values); const group = groups.get(key2) || []; group.push(value); groups.set(key2, group); } return groups; }; ide