UNPKG

@shopify/cli

Version:

A CLI tool to build for the Shopify platform

1,287 lines (1,266 loc) • 8.73 MB
import { require_globby } from "./chunk-EFOOQV72.js"; import { base_command_default } from "./chunk-MBL5HIUY.js"; import { businessPlatformRequest, ensureAuthenticatedAdmin, ensureAuthenticatedBusinessPlatform, fanoutHooks, graphqlRequest, logout, normalizeStoreFqdn } from "./chunk-SKMKK4HY.js"; import { findUpAndReadPackageJson, getPackageManager, installNodeModules, packageManagerFromUserAgent, readAndParsePackageJson, writePackageJSON } from "./chunk-OIOM46UG.js"; import { AbortError, BugError, ansi_escapes_default, camelize, capitalize, copyFile, currentProcessIsGlobal, fileExists, findPathUp, formatPackageManagerCommand, glob, hasGit, hyphenate, isDirectory, isTerminalInteractive, linesToColumns, mkdir, outputContent, outputDebug, outputInfo, outputToken, readFile, removeFile, renderConfirmationPrompt, renderFatalError, renderInfo, renderSelectPrompt, renderSuccess, renderTasks, renderTextPrompt, renderWarning, require_cross_spawn, require_source, require_supports_hyperlinks, rmdir, runWithTimer, source_default, writeFile } from "./chunk-HJSZAWSQ.js"; import { require_ansi_escapes, require_ansi_styles, require_clean_stack, require_color_convert, require_color_name, require_commonjs, require_ejs, require_get_package_type, require_is_fullwidth_code_point, require_string_width, require_strip_ansi, require_typescript, require_widest_line, require_wordwrap, require_wrap_ansi } from "./chunk-VLBE545G.js"; import { require_src, require_supports_color } from "./chunk-UMUTXITN.js"; import { require_source_map_support } from "./chunk-KUJQ4AB6.js"; import { require_is_wsl } from "./chunk-G2ZZKGSV.js"; import { require_indent_string } from "./chunk-UV5N2VL7.js"; import { basename, cwd, dirname, extname, joinPath, relativePath, relativizePath, resolvePath } from "./chunk-EG6MBBEN.js"; import { __commonJS, __require, __toESM, init_cjs_shims } from "./chunk-PKR7KJ6P.js"; // ../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/cli-ux/write.js var require_write = __commonJS({ "../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/cli-ux/write.js"(exports) { "use strict"; init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: !0 }); var stdout = (msg) => { process.stdout.write(msg); }, stderr = (msg) => { process.stderr.write(msg); }; exports.default = { stderr, stdout }; } }); // ../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/util/fs.js var require_fs = __commonJS({ "../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/util/fs.js"(exports) { "use strict"; init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: !0 }); exports.existsSync = exports.safeReadJson = exports.readJsonSync = exports.readJson = exports.fileExists = exports.dirExists = void 0; var node_fs_1 = __require("node:fs"), promises_1 = __require("node:fs/promises"), dirExists = async (input) => { let dirStat; try { dirStat = await (0, promises_1.stat)(input); } catch { throw new Error(`No directory found at ${input}`); } if (!dirStat.isDirectory()) throw new Error(`${input} exists but is not a directory`); return input; }; exports.dirExists = dirExists; var fileExists2 = async (input) => { let fileStat; try { fileStat = await (0, promises_1.stat)(input); } catch { throw new Error(`No file found at ${input}`); } if (!fileStat.isFile()) throw new Error(`${input} exists but is not a file`); return input; }; exports.fileExists = fileExists2; async function readJson(path3) { let contents = await (0, promises_1.readFile)(path3, "utf8"); return JSON.parse(contents); } exports.readJson = readJson; function readJsonSync(path3, parse2 = !0) { let contents = (0, node_fs_1.readFileSync)(path3, "utf8"); return parse2 ? JSON.parse(contents) : contents; } exports.readJsonSync = readJsonSync; async function safeReadJson(path3) { try { return await readJson(path3); } catch { } } exports.safeReadJson = safeReadJson; function existsSync2(path3) { return (0, node_fs_1.existsSync)(path3); } exports.existsSync = existsSync2; } }); // ../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/util/util.js var require_util = __commonJS({ "../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/util/util.js"(exports) { "use strict"; init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: !0 }); exports.mergeNestedObjects = exports.mapValues = exports.uniq = exports.isNotFalsy = exports.isTruthy = exports.capitalize = exports.sumBy = exports.maxBy = exports.isProd = exports.castArray = exports.sortBy = exports.last = exports.uniqBy = exports.compact = exports.pickBy = void 0; function pickBy(obj, fn) { return Object.entries(obj).reduce((o, [k, v]) => (fn(v) && (o[k] = v), o), {}); } exports.pickBy = pickBy; function compact(a) { return a.filter((a2) => !!a2); } exports.compact = compact; function uniqBy(arr, fn) { return arr.filter((a, i) => { let aVal = fn(a); return !arr.some((b, j) => j > i && fn(b) === aVal); }); } exports.uniqBy = uniqBy; function last2(arr) { if (arr) return arr.at(-1); } exports.last = last2; function compare(a, b) { if (a = a === void 0 ? 0 : a, b = b === void 0 ? 0 : b, Array.isArray(a) && Array.isArray(b)) { if (a.length === 0 && b.length === 0) return 0; let diff = compare(a[0], b[0]); return diff !== 0 ? diff : compare(a.slice(1), b.slice(1)); } return a < b ? -1 : a > b ? 1 : 0; } function sortBy(arr, fn) { return arr.sort((a, b) => compare(fn(a), fn(b))); } exports.sortBy = sortBy; function castArray(input) { return input === void 0 ? [] : Array.isArray(input) ? input : [input]; } exports.castArray = castArray; function isProd() { return !["development", "test"].includes(process.env.NODE_ENV ?? ""); } exports.isProd = isProd; function maxBy(arr, fn) { if (arr.length !== 0) return arr.reduce((maxItem, i) => { let curr = fn(i), max = fn(maxItem); return curr > max ? i : maxItem; }); } exports.maxBy = maxBy; function sumBy(arr, fn) { return arr.reduce((sum, i) => sum + fn(i), 0); } exports.sumBy = sumBy; function capitalize2(s) { return s ? s.charAt(0).toUpperCase() + s.slice(1).toLowerCase() : ""; } exports.capitalize = capitalize2; function isTruthy(input) { return ["1", "true", "y", "yes"].includes(input.toLowerCase()); } exports.isTruthy = isTruthy; function isNotFalsy(input) { return !["0", "false", "n", "no"].includes(input.toLowerCase()); } exports.isNotFalsy = isNotFalsy; function uniq(arr) { return [...new Set(arr)].sort(); } exports.uniq = uniq; function mapValues(obj, fn) { return Object.entries(obj).reduce((o, [k, v]) => (o[k] = fn(v, k), o), {}); } exports.mapValues = mapValues; function get(obj, path3) { return path3.split(".").reduce((o, p) => o?.[p], obj); } function mergeNestedObjects(objs, path3) { return Object.fromEntries(objs.flatMap((o) => Object.entries(get(o, path3) ?? {})).reverse()); } exports.mergeNestedObjects = mergeNestedObjects; } }); // ../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/args.js var require_args = __commonJS({ "../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/args.js"(exports) { "use strict"; init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: !0 }); exports.string = exports.url = exports.file = exports.directory = exports.integer = exports.boolean = exports.custom = void 0; var node_url_1 = __require("node:url"), fs_1 = require_fs(), util_1 = require_util(); function custom(defaults) { return (options = {}) => ({ parse: async (i, _context, _opts) => i, ...defaults, ...options, input: [], type: "option" }); } exports.custom = custom; exports.boolean = custom({ parse: async (b) => !!b && (0, util_1.isNotFalsy)(b) }); exports.integer = custom({ async parse(input, _, opts) { if (!/^-?\d+$/.test(input)) throw new Error(`Expected an integer but received: ${input}`); let num = Number.parseInt(input, 10); if (opts.min !== void 0 && num < opts.min) throw new Error(`Expected an integer greater than or equal to ${opts.min} but received: ${input}`); if (opts.max !== void 0 && num > opts.max) throw new Error(`Expected an integer less than or equal to ${opts.max} but received: ${input}`); return num; } }); exports.directory = custom({ async parse(input, _, opts) { return opts.exists ? (0, fs_1.dirExists)(input) : input; } }); exports.file = custom({ async parse(input, _, opts) { return opts.exists ? (0, fs_1.fileExists)(input) : input; } }); exports.url = custom({ async parse(input) { try { return new node_url_1.URL(input); } catch { throw new Error(`Expected a valid url but received: ${input}`); } } }); var stringArg = custom({}); exports.string = stringArg; } }); // ../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/package.json var require_package = __commonJS({ "../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/package.json"(exports, module) { module.exports = { name: "@oclif/core", description: "base library for oclif CLIs", version: "3.26.5", author: "Salesforce", bugs: "https://github.com/oclif/core/issues", dependencies: { "@types/cli-progress": "^3.11.5", "ansi-escapes": "^4.3.2", "ansi-styles": "^4.3.0", cardinal: "^2.1.1", chalk: "^4.1.2", "clean-stack": "^3.0.1", "cli-progress": "^3.12.0", color: "^4.2.3", debug: "^4.3.4", ejs: "^3.1.10", "get-package-type": "^0.1.0", globby: "^11.1.0", hyperlinker: "^1.0.0", "indent-string": "^4.0.0", "is-wsl": "^2.2.0", "js-yaml": "^3.14.1", minimatch: "^9.0.4", "natural-orderby": "^2.0.3", "object-treeify": "^1.1.33", "password-prompt": "^1.1.3", "slice-ansi": "^4.0.0", "string-width": "^4.2.3", "strip-ansi": "^6.0.1", "supports-color": "^8.1.1", "supports-hyperlinks": "^2.2.0", "widest-line": "^3.1.0", wordwrap: "^1.0.0", "wrap-ansi": "^7.0.0" }, devDependencies: { "@commitlint/config-conventional": "^17.8.1", "@oclif/plugin-help": "^6", "@oclif/plugin-plugins": "^4", "@oclif/prettier-config": "^0.2.1", "@oclif/test": "^3.2.11", "@types/ansi-styles": "^3.2.1", "@types/benchmark": "^2.1.5", "@types/chai": "^4.3.11", "@types/chai-as-promised": "^7.1.8", "@types/clean-stack": "^2.1.1", "@types/color": "^3.0.6", "@types/debug": "^4.1.10", "@types/ejs": "^3.1.5", "@types/indent-string": "^4.0.1", "@types/js-yaml": "^3.12.7", "@types/mocha": "^10.0.6", "@types/node": "^18", "@types/node-notifier": "^8.0.5", "@types/pnpapi": "^0.0.5", "@types/slice-ansi": "^4.0.0", "@types/strip-ansi": "^5.2.1", "@types/supports-color": "^8.1.1", "@types/wordwrap": "^1.0.3", "@types/wrap-ansi": "^3.0.0", benchmark: "^2.1.4", chai: "^4.4.1", "chai-as-promised": "^7.1.1", commitlint: "^17.8.1", "cross-env": "^7.0.3", eslint: "^8.57.0", "eslint-config-oclif": "^5.1.3", "eslint-config-oclif-typescript": "^3.1.6", "eslint-config-prettier": "^9.1.0", "fancy-test": "^3.0.14", globby: "^11.1.0", husky: "^8", "lint-staged": "^14.0.1", madge: "^6.1.0", mocha: "^10.4.0", nyc: "^15.1.0", prettier: "^3.2.5", shx: "^0.3.4", sinon: "^16.1.3", "ts-node": "^10.9.2", tsd: "^0.31.0", typescript: "^5" }, engines: { node: ">=18.0.0" }, files: [ "/lib", "/flush.js", "/flush.d.ts", "/handle.js" ], homepage: "https://github.com/oclif/core", keywords: [ "oclif", "cli", "command", "command line", "parser", "args", "argv" ], license: "MIT", main: "./lib/index.js", repository: "oclif/core", oclif: { bin: "oclif", devPlugins: [ "@oclif/plugin-help", "@oclif/plugin-plugins" ] }, publishConfig: { access: "public" }, scripts: { build: "shx rm -rf lib && tsc", commitlint: "commitlint", compile: "tsc", format: 'prettier --write "+(src|test)/**/*.+(ts|js|json)"', lint: "eslint . --ext .ts", posttest: "yarn lint && yarn test:circular-deps", prepack: "yarn run build", prepare: "husky install", pretest: "yarn build && tsc -p test --noEmit --skipLibCheck", "test:circular-deps": "madge lib/ -c", "test:debug": 'nyc mocha --debug-brk --inspect "test/**/*.test.ts"', "test:integration": 'mocha --forbid-only "test/**/*.integration.ts" --parallel --timeout 1200000', "test:interoperability": "cross-env DEBUG=integration:* ts-node test/integration/interop.ts", "test:perf": "ts-node test/perf/parser.perf.ts", test: 'nyc mocha --forbid-only "test/**/*.test.ts"' }, types: "lib/index.d.ts" }; } }); // ../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/cache.js var require_cache = __commonJS({ "../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/cache.js"(exports) { "use strict"; init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: !0 }); var node_fs_1 = __require("node:fs"), node_path_1 = __require("node:path"), Cache = class _Cache extends Map { static instance; constructor() { super(), this.set("@oclif/core", this.getOclifCoreMeta()); } static getInstance() { return _Cache.instance || (_Cache.instance = new _Cache()), _Cache.instance; } get(key) { return super.get(key); } getOclifCoreMeta() { try { return { name: "@oclif/core", version: require_package().version }; } catch { try { return { name: "@oclif/core", version: JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(__dirname, "..", "package.json"), "utf8")) }; } catch { return { name: "@oclif/core", version: "unknown" }; } } } }; exports.default = Cache; } }); // ../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/settings.js var require_settings = __commonJS({ "../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/settings.js"(exports) { "use strict"; init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: !0 }); exports.settings = void 0; global.oclif || (global.oclif = {}); exports.settings = global.oclif; } }); // ../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/screen.js var require_screen = __commonJS({ "../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/screen.js"(exports) { "use strict"; init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: !0 }); exports.errtermwidth = exports.stdtermwidth = void 0; var settings_1 = require_settings(); function termwidth(stream) { if (!stream.isTTY) return 80; let width = stream.getWindowSize()[0]; return width < 1 ? 80 : width < 40 ? 40 : width; } var columns = Number.parseInt(process.env.OCLIF_COLUMNS, 10) || settings_1.settings.columns; exports.stdtermwidth = columns || termwidth(process.stdout); exports.errtermwidth = columns || termwidth(process.stderr); } }); // ../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/errors/logger.js var require_logger = __commonJS({ "../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/errors/logger.js"(exports) { "use strict"; init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: !0 }); exports.Logger = void 0; var promises_1 = __require("node:fs/promises"), node_path_1 = __require("node:path"), stripAnsi = require_strip_ansi(), timestamp = () => (/* @__PURE__ */ new Date()).toISOString(), timer, wait = (ms) => new Promise((resolve2) => { timer && timer.unref(), timer = setTimeout(() => resolve2(null), ms); }); function chomp(s) { return s.endsWith(` `) ? s.replace(/\n$/, "") : s; } var Logger = class { file; buffer = []; flushing = Promise.resolve(); constructor(file) { this.file = file; } async flush(waitForMs = 0) { await wait(waitForMs), this.flushing = this.flushing.then(async () => { if (this.buffer.length === 0) return; let mylines = this.buffer; this.buffer = [], await (0, promises_1.mkdir)((0, node_path_1.dirname)(this.file), { recursive: !0 }), await (0, promises_1.appendFile)(this.file, mylines.join(` `) + ` `); }), await this.flushing; } log(msg) { msg = stripAnsi(chomp(msg)); let lines = msg.split(` `).map((l) => `${timestamp()} ${l}`.trimEnd()); this.buffer.push(...lines), this.flush(50).catch(console.error); } }; exports.Logger = Logger; } }); // ../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/errors/config.js var require_config = __commonJS({ "../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/errors/config.js"(exports) { "use strict"; init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: !0 }); exports.config = void 0; var settings_1 = require_settings(), logger_1 = require_logger(); function displayWarnings() { process.listenerCount("warning") > 1 || process.on("warning", (warning) => { console.error(warning.stack), warning.detail && console.error(warning.detail); }); } exports.config = { get debug() { return !!settings_1.settings.debug; }, set debug(enabled) { settings_1.settings.debug = enabled, enabled && displayWarnings(); }, get errlog() { return settings_1.settings.errlog; }, set errlog(errlog) { errlog ? (this.errorLogger = new logger_1.Logger(errlog), settings_1.settings.errlog = errlog) : (delete this.errorLogger, delete settings_1.settings.errlog); }, errorLogger: void 0 }; } }); // ../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/errors/errors/cli.js var require_cli = __commonJS({ "../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/errors/errors/cli.js"(exports) { "use strict"; init_cjs_shims(); var __importDefault = exports && exports.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: !0 }); exports.CLIError = exports.addOclifExitCode = void 0; var chalk_1 = __importDefault(require_source()), clean_stack_1 = __importDefault(require_clean_stack()), indent_string_1 = __importDefault(require_indent_string()), wrap_ansi_1 = __importDefault(require_wrap_ansi()), cache_1 = __importDefault(require_cache()), screen_1 = require_screen(), config_1 = require_config(); function addOclifExitCode(error, options) { return "oclif" in error || (error.oclif = {}), error.oclif.exit = options?.exit === void 0 ? cache_1.default.getInstance().get("exitCodes")?.default ?? 2 : options.exit, error; } exports.addOclifExitCode = addOclifExitCode; var CLIError = class extends Error { code; oclif = {}; skipOclifErrorHandling; suggestions; constructor(error, options = {}) { super(error instanceof Error ? error.message : error), addOclifExitCode(this, options), this.code = options.code, this.suggestions = options.suggestions; } get bang() { try { return chalk_1.default.red(process.platform === "win32" ? "\xBB" : "\u203A"); } catch { } } get stack() { return (0, clean_stack_1.default)(super.stack, { pretty: !0 }); } /** * @deprecated `render` Errors display should be handled by display function, like pretty-print * @return {string} returns a string representing the dispay of the error */ render() { if (config_1.config.debug) return this.stack; let output = `${this.name}: ${this.message}`; return output = (0, wrap_ansi_1.default)(output, screen_1.errtermwidth - 6, { hard: !0, trim: !1 }), output = (0, indent_string_1.default)(output, 3), output = (0, indent_string_1.default)(output, 1, { includeEmptyLines: !0, indent: this.bang }), output = (0, indent_string_1.default)(output, 1), output; } }; exports.CLIError = CLIError; (function(CLIError2) { class Warn extends CLIError2 { constructor(err) { super(err instanceof Error ? err.message : err), this.name = "Warning"; } get bang() { try { return chalk_1.default.yellow(process.platform === "win32" ? "\xBB" : "\u203A"); } catch { } } } CLIError2.Warn = Warn; })(CLIError || (exports.CLIError = CLIError = {})); } }); // ../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/errors/errors/exit.js var require_exit = __commonJS({ "../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/errors/errors/exit.js"(exports) { "use strict"; init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: !0 }); exports.ExitError = void 0; var cli_1 = require_cli(), ExitError = class extends cli_1.CLIError { code = "EEXIT"; constructor(exitCode = 1) { super(`EEXIT: ${exitCode}`, { exit: exitCode }); } render() { return ""; } }; exports.ExitError = ExitError; } }); // ../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/errors/errors/pretty-print.js var require_pretty_print = __commonJS({ "../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/errors/errors/pretty-print.js"(exports) { "use strict"; init_cjs_shims(); var __importDefault = exports && exports.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: !0 }); exports.applyPrettyPrintOptions = void 0; var indent_string_1 = __importDefault(require_indent_string()), wrap_ansi_1 = __importDefault(require_wrap_ansi()), screen_1 = require_screen(), config_1 = require_config(); function applyPrettyPrintOptions(error, options) { let prettyErrorKeys = ["message", "code", "ref", "suggestions"]; for (let key of prettyErrorKeys) !(key in error) && options[key] && (error[key] = options[key]); return error; } exports.applyPrettyPrintOptions = applyPrettyPrintOptions; var formatSuggestions = (suggestions) => { let label = "Try this:"; if (!suggestions || suggestions.length === 0) return; if (suggestions.length === 1) return `${label} ${suggestions[0]}`; let multiple = suggestions.map((suggestion) => `* ${suggestion}`).join(` `); return `${label} ${(0, indent_string_1.default)(multiple, 2)}`; }; function prettyPrint(error) { if (config_1.config.debug) return error.stack; let { bang, code, message, name: errorSuffix, ref, suggestions } = error, formattedHeader = message ? `${errorSuffix || "Error"}: ${message}` : void 0, formattedCode = code ? `Code: ${code}` : void 0, formattedSuggestions = formatSuggestions(suggestions), formattedReference = ref ? `Reference: ${ref}` : void 0, formatted = [formattedHeader, formattedCode, formattedSuggestions, formattedReference].filter(Boolean).join(` `), output = (0, wrap_ansi_1.default)(formatted, screen_1.errtermwidth - 6, { hard: !0, trim: !1 }); return output = (0, indent_string_1.default)(output, 3), output = (0, indent_string_1.default)(output, 1, { includeEmptyLines: !0, indent: bang || "" }), output = (0, indent_string_1.default)(output, 1), output; } exports.default = prettyPrint; } }); // ../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/errors/error.js var require_error = __commonJS({ "../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/errors/error.js"(exports) { "use strict"; init_cjs_shims(); var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) { k2 === void 0 && (k2 = k); var desc = Object.getOwnPropertyDescriptor(m, k); (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) && (desc = { enumerable: !0, get: function() { return m[k]; } }), Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { k2 === void 0 && (k2 = k), o[k2] = m[k]; })), __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: !0, value: v }); }) : function(o, v) { o.default = v; }), __importStar = exports && exports.__importStar || function(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) k !== "default" && Object.prototype.hasOwnProperty.call(mod, k) && __createBinding(result, mod, k); return __setModuleDefault(result, mod), result; }, __importDefault = exports && exports.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: !0 }); exports.error = void 0; var write_1 = __importDefault(require_write()), config_1 = require_config(), cli_1 = require_cli(), pretty_print_1 = __importStar(require_pretty_print()); function error(input, options = {}) { let err; if (typeof input == "string") err = new cli_1.CLIError(input, options); else if (input instanceof Error) err = (0, cli_1.addOclifExitCode)(input, options); else throw new TypeError("first argument must be a string or instance of Error"); if (err = (0, pretty_print_1.applyPrettyPrintOptions)(err, options), options.exit === !1) { let message = (0, pretty_print_1.default)(err); message && write_1.default.stderr(message + ` `), config_1.config.errorLogger && config_1.config.errorLogger.log(err?.stack ?? ""); } else throw err; } exports.error = error; exports.default = error; } }); // ../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/errors/errors/module-load.js var require_module_load = __commonJS({ "../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/errors/errors/module-load.js"(exports) { "use strict"; init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: !0 }); exports.ModuleLoadError = void 0; var cli_1 = require_cli(), ModuleLoadError = class extends cli_1.CLIError { code = "MODULE_NOT_FOUND"; constructor(message) { super(`[MODULE_NOT_FOUND] ${message}`, { exit: 1 }), this.name = "ModuleLoadError"; } }; exports.ModuleLoadError = ModuleLoadError; } }); // ../../node_modules/.pnpm/is-arrayish@0.3.4/node_modules/is-arrayish/index.js var require_is_arrayish = __commonJS({ "../../node_modules/.pnpm/is-arrayish@0.3.4/node_modules/is-arrayish/index.js"(exports, module) { init_cjs_shims(); module.exports = function(obj) { return !obj || typeof obj == "string" ? !1 : obj instanceof Array || Array.isArray(obj) || obj.length >= 0 && (obj.splice instanceof Function || Object.getOwnPropertyDescriptor(obj, obj.length - 1) && obj.constructor.name !== "String"); }; } }); // ../../node_modules/.pnpm/simple-swizzle@0.2.4/node_modules/simple-swizzle/index.js var require_simple_swizzle = __commonJS({ "../../node_modules/.pnpm/simple-swizzle@0.2.4/node_modules/simple-swizzle/index.js"(exports, module) { "use strict"; init_cjs_shims(); var isArrayish = require_is_arrayish(), concat = Array.prototype.concat, slice = Array.prototype.slice, swizzle = module.exports = function(args) { for (var results = [], i = 0, len = args.length; i < len; i++) { var arg = args[i]; isArrayish(arg) ? results = concat.call(results, slice.call(arg)) : results.push(arg); } return results; }; swizzle.wrap = function(fn) { return function() { return fn(swizzle(arguments)); }; }; } }); // ../../node_modules/.pnpm/color-string@1.9.1/node_modules/color-string/index.js var require_color_string = __commonJS({ "../../node_modules/.pnpm/color-string@1.9.1/node_modules/color-string/index.js"(exports, module) { init_cjs_shims(); var colorNames = require_color_name(), swizzle = require_simple_swizzle(), hasOwnProperty = Object.hasOwnProperty, reverseNames = /* @__PURE__ */ Object.create(null); for (name in colorNames) hasOwnProperty.call(colorNames, name) && (reverseNames[colorNames[name]] = name); var name, cs = module.exports = { to: {}, get: {} }; cs.get = function(string) { var prefix = string.substring(0, 3).toLowerCase(), val, model; switch (prefix) { case "hsl": val = cs.get.hsl(string), model = "hsl"; break; case "hwb": val = cs.get.hwb(string), model = "hwb"; break; default: val = cs.get.rgb(string), model = "rgb"; break; } return val ? { model, value: val } : null; }; cs.get.rgb = function(string) { if (!string) return null; var abbr = /^#([a-f0-9]{3,4})$/i, hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i, rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/, per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/, keyword = /^(\w+)$/, rgb = [0, 0, 0, 1], match, i, hexAlpha; if (match = string.match(hex)) { for (hexAlpha = match[2], match = match[1], i = 0; i < 3; i++) { var i2 = i * 2; rgb[i] = parseInt(match.slice(i2, i2 + 2), 16); } hexAlpha && (rgb[3] = parseInt(hexAlpha, 16) / 255); } else if (match = string.match(abbr)) { for (match = match[1], hexAlpha = match[3], i = 0; i < 3; i++) rgb[i] = parseInt(match[i] + match[i], 16); hexAlpha && (rgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255); } else if (match = string.match(rgba)) { for (i = 0; i < 3; i++) rgb[i] = parseInt(match[i + 1], 0); match[4] && (match[5] ? rgb[3] = parseFloat(match[4]) * 0.01 : rgb[3] = parseFloat(match[4])); } else if (match = string.match(per)) { for (i = 0; i < 3; i++) rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55); match[4] && (match[5] ? rgb[3] = parseFloat(match[4]) * 0.01 : rgb[3] = parseFloat(match[4])); } else return (match = string.match(keyword)) ? match[1] === "transparent" ? [0, 0, 0, 0] : hasOwnProperty.call(colorNames, match[1]) ? (rgb = colorNames[match[1]], rgb[3] = 1, rgb) : null : null; for (i = 0; i < 3; i++) rgb[i] = clamp(rgb[i], 0, 255); return rgb[3] = clamp(rgb[3], 0, 1), rgb; }; cs.get.hsl = function(string) { if (!string) return null; var hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/, match = string.match(hsl); if (match) { var alpha = parseFloat(match[4]), h = (parseFloat(match[1]) % 360 + 360) % 360, s = clamp(parseFloat(match[2]), 0, 100), l = clamp(parseFloat(match[3]), 0, 100), a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1); return [h, s, l, a]; } return null; }; cs.get.hwb = function(string) { if (!string) return null; var hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/, match = string.match(hwb); if (match) { var alpha = parseFloat(match[4]), h = (parseFloat(match[1]) % 360 + 360) % 360, w = clamp(parseFloat(match[2]), 0, 100), b = clamp(parseFloat(match[3]), 0, 100), a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1); return [h, w, b, a]; } return null; }; cs.to.hex = function() { var rgba = swizzle(arguments); return "#" + hexDouble(rgba[0]) + hexDouble(rgba[1]) + hexDouble(rgba[2]) + (rgba[3] < 1 ? hexDouble(Math.round(rgba[3] * 255)) : ""); }; cs.to.rgb = function() { var rgba = swizzle(arguments); return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + Math.round(rgba[0]) + ", " + Math.round(rgba[1]) + ", " + Math.round(rgba[2]) + ")" : "rgba(" + Math.round(rgba[0]) + ", " + Math.round(rgba[1]) + ", " + Math.round(rgba[2]) + ", " + rgba[3] + ")"; }; cs.to.rgb.percent = function() { var rgba = swizzle(arguments), r = Math.round(rgba[0] / 255 * 100), g = Math.round(rgba[1] / 255 * 100), b = Math.round(rgba[2] / 255 * 100); return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + r + "%, " + g + "%, " + b + "%)" : "rgba(" + r + "%, " + g + "%, " + b + "%, " + rgba[3] + ")"; }; cs.to.hsl = function() { var hsla = swizzle(arguments); return hsla.length < 4 || hsla[3] === 1 ? "hsl(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%)" : "hsla(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%, " + hsla[3] + ")"; }; cs.to.hwb = function() { var hwba = swizzle(arguments), a = ""; return hwba.length >= 4 && hwba[3] !== 1 && (a = ", " + hwba[3]), "hwb(" + hwba[0] + ", " + hwba[1] + "%, " + hwba[2] + "%" + a + ")"; }; cs.to.keyword = function(rgb) { return reverseNames[rgb.slice(0, 3)]; }; function clamp(num, min, max) { return Math.min(Math.max(min, num), max); } function hexDouble(num) { var str = Math.round(num).toString(16).toUpperCase(); return str.length < 2 ? "0" + str : str; } } }); // ../../node_modules/.pnpm/color@4.2.3/node_modules/color/index.js var require_color = __commonJS({ "../../node_modules/.pnpm/color@4.2.3/node_modules/color/index.js"(exports, module) { init_cjs_shims(); var colorString = require_color_string(), convert = require_color_convert(), skippedModels = [ // To be honest, I don't really feel like keyword belongs in color convert, but eh. "keyword", // Gray conflicts with some method names, and has its own method defined. "gray", // Shouldn't really be in color-convert either... "hex" ], hashedModelKeys = {}; for (let model of Object.keys(convert)) hashedModelKeys[[...convert[model].labels].sort().join("")] = model; var limiters = {}; function Color(object, model) { if (!(this instanceof Color)) return new Color(object, model); if (model && model in skippedModels && (model = null), model && !(model in convert)) throw new Error("Unknown model: " + model); let i, channels; if (object == null) this.model = "rgb", this.color = [0, 0, 0], this.valpha = 1; else if (object instanceof Color) this.model = object.model, this.color = [...object.color], this.valpha = object.valpha; else if (typeof object == "string") { let result = colorString.get(object); if (result === null) throw new Error("Unable to parse color from string: " + object); this.model = result.model, channels = convert[this.model].channels, this.color = result.value.slice(0, channels), this.valpha = typeof result.value[channels] == "number" ? result.value[channels] : 1; } else if (object.length > 0) { this.model = model || "rgb", channels = convert[this.model].channels; let newArray = Array.prototype.slice.call(object, 0, channels); this.color = zeroArray(newArray, channels), this.valpha = typeof object[channels] == "number" ? object[channels] : 1; } else if (typeof object == "number") this.model = "rgb", this.color = [ object >> 16 & 255, object >> 8 & 255, object & 255 ], this.valpha = 1; else { this.valpha = 1; let keys = Object.keys(object); "alpha" in object && (keys.splice(keys.indexOf("alpha"), 1), this.valpha = typeof object.alpha == "number" ? object.alpha : 0); let hashedKeys = keys.sort().join(""); if (!(hashedKeys in hashedModelKeys)) throw new Error("Unable to parse color from object: " + JSON.stringify(object)); this.model = hashedModelKeys[hashedKeys]; let { labels } = convert[this.model], color = []; for (i = 0; i < labels.length; i++) color.push(object[labels[i]]); this.color = zeroArray(color); } if (limiters[this.model]) for (channels = convert[this.model].channels, i = 0; i < channels; i++) { let limit = limiters[this.model][i]; limit && (this.color[i] = limit(this.color[i])); } this.valpha = Math.max(0, Math.min(1, this.valpha)), Object.freeze && Object.freeze(this); } Color.prototype = { toString() { return this.string(); }, toJSON() { return this[this.model](); }, string(places) { let self2 = this.model in colorString.to ? this : this.rgb(); self2 = self2.round(typeof places == "number" ? places : 1); let args = self2.valpha === 1 ? self2.color : [...self2.color, this.valpha]; return colorString.to[self2.model](args); }, percentString(places) { let self2 = this.rgb().round(typeof places == "number" ? places : 1), args = self2.valpha === 1 ? self2.color : [...self2.color, this.valpha]; return colorString.to.rgb.percent(args); }, array() { return this.valpha === 1 ? [...this.color] : [...this.color, this.valpha]; }, object() { let result = {}, { channels } = convert[this.model], { labels } = convert[this.model]; for (let i = 0; i < channels; i++) result[labels[i]] = this.color[i]; return this.valpha !== 1 && (result.alpha = this.valpha), result; }, unitArray() { let rgb = this.rgb().color; return rgb[0] /= 255, rgb[1] /= 255, rgb[2] /= 255, this.valpha !== 1 && rgb.push(this.valpha), rgb; }, unitObject() { let rgb = this.rgb().object(); return rgb.r /= 255, rgb.g /= 255, rgb.b /= 255, this.valpha !== 1 && (rgb.alpha = this.valpha), rgb; }, round(places) { return places = Math.max(places || 0, 0), new Color([...this.color.map(roundToPlace(places)), this.valpha], this.model); }, alpha(value) { return value !== void 0 ? new Color([...this.color, Math.max(0, Math.min(1, value))], this.model) : this.valpha; }, // Rgb red: getset("rgb", 0, maxfn(255)), green: getset("rgb", 1, maxfn(255)), blue: getset("rgb", 2, maxfn(255)), hue: getset(["hsl", "hsv", "hsl", "hwb", "hcg"], 0, (value) => (value % 360 + 360) % 360), saturationl: getset("hsl", 1, maxfn(100)), lightness: getset("hsl", 2, maxfn(100)), saturationv: getset("hsv", 1, maxfn(100)), value: getset("hsv", 2, maxfn(100)), chroma: getset("hcg", 1, maxfn(100)), gray: getset("hcg", 2, maxfn(100)), white: getset("hwb", 1, maxfn(100)), wblack: getset("hwb", 2, maxfn(100)), cyan: getset("cmyk", 0, maxfn(100)), magenta: getset("cmyk", 1, maxfn(100)), yellow: getset("cmyk", 2, maxfn(100)), black: getset("cmyk", 3, maxfn(100)), x: getset("xyz", 0, maxfn(95.047)), y: getset("xyz", 1, maxfn(100)), z: getset("xyz", 2, maxfn(108.833)), l: getset("lab", 0, maxfn(100)), a: getset("lab", 1), b: getset("lab", 2), keyword(value) { return value !== void 0 ? new Color(value) : convert[this.model].keyword(this.color); }, hex(value) { return value !== void 0 ? new Color(value) : colorString.to.hex(this.rgb().round().color); }, hexa(value) { if (value !== void 0) return new Color(value); let rgbArray = this.rgb().round().color, alphaHex = Math.round(this.valpha * 255).toString(16).toUpperCase(); return alphaHex.length === 1 && (alphaHex = "0" + alphaHex), colorString.to.hex(rgbArray) + alphaHex; }, rgbNumber() { let rgb = this.rgb().color; return (rgb[0] & 255) << 16 | (rgb[1] & 255) << 8 | rgb[2] & 255; }, luminosity() { let rgb = this.rgb().color, lum = []; for (let [i, element] of rgb.entries()) { let chan = element / 255; lum[i] = chan <= 0.04045 ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4; } return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2]; }, contrast(color2) { let lum1 = this.luminosity(), lum2 = color2.luminosity(); return lum1 > lum2 ? (lum1 + 0.05) / (lum2 + 0.05) : (lum2 + 0.05) / (lum1 + 0.05); }, level(color2) { let contrastRatio = this.contrast(color2); return contrastRatio >= 7 ? "AAA" : contrastRatio >= 4.5 ? "AA" : ""; }, isDark() { let rgb = this.rgb().color; return (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 1e4 < 128; }, isLight() { return !this.isDark(); }, negate() { let rgb = this.rgb(); for (let i = 0; i < 3; i++) rgb.color[i] = 255 - rgb.color[i]; return rgb; }, lighten(ratio) { let hsl = this.hsl(); return hsl.color[2] += hsl.color[2] * ratio, hsl; }, darken(ratio) { let hsl = this.hsl(); return hsl.color[2] -= hsl.color[2] * ratio, hsl; }, saturate(ratio) { let hsl = this.hsl(); return hsl.color[1] += hsl.color[1] * ratio, hsl; }, desaturate(ratio) { let hsl = this.hsl(); return hsl.color[1] -= hsl.color[1] * ratio, hsl; }, whiten(ratio) { let hwb = this.hwb(); return hwb.color[1] += hwb.color[1] * ratio, hwb; }, blacken(ratio) { let hwb = this.hwb(); return hwb.color[2] += hwb.color[2] * ratio, hwb; }, grayscale() { let rgb = this.rgb().color, value = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11; return Color.rgb(value, value, value); }, fade(ratio) { return this.alpha(this.valpha - this.valpha * ratio); }, opaquer(ratio) { return this.alpha(this.valpha + this.valpha * ratio); }, rotate(degrees) { let hsl = this.hsl(), hue = hsl.color[0]; return hue = (hue + degrees) % 360, hue = hue < 0 ? 360 + hue : hue, hsl.color[0] = hue, hsl; }, mix(mixinColor, weight) { if (!mixinColor || !mixinColor.rgb) throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof mixinColor); let color1 = mixinColor.rgb(), color2 = this.rgb(), p = weight === void 0 ? 0.5 : weight, w = 2 * p - 1, a = color1.alpha() - color2.alpha(), w1 = ((w * a === -1 ? w : (w + a) / (1 + w * a)) + 1) / 2, w2 = 1 - w1; return Color.rgb( w1 * color1.red() + w2 * color2.red(), w1 * color1.green() + w2 * color2.green(), w1 * color1.blue() + w2 * color2.blue(), color1.alpha() * p + color2.alpha() * (1 - p) ); } }; for (let model of Object.keys(convert)) { if (skippedModels.includes(model)) continue; let { channels } = convert[model]; Color.prototype[model] = function(...args) { return this.model === model ? new Color(this) : args.length > 0 ? new Color(args, model) : new Color([...assertArray(convert[this.model][model].raw(this.color)), this.valpha], model); }, Color[model] = function(...args) { let color = args[0]; return typeof color == "number" && (color = zeroArray(args, channels)), new Color(color, model); }; } function roundTo(number, places) { return Number(number.toFixed(places)); } function roundToPlace(places) { return function(number) { return roundTo(number, places); }; } function getset(model, channel, modifier) { model = Array.isArray(model) ? model : [model]; for (let m of model) (limiters[m] || (limiters[m] = []))[channel] = modifier; return model = model[0], function(value) { let result; return value !== void 0 ? (modifier && (value = modifier(value)), result = this[model](), result.color[channel] = value, result) : (result = this[model]().color[channel], modifier && (result = modifier(result)), result); }; } function maxfn(max) { return function(v) { return Math.max(0, Math.min(max, v)); }; } function assertArray(value) { return Array.isArray(value) ? value : [value]; } function zeroArray(array, length) { for (let i = 0; i < length; i++) typeof array[i] != "number" && (array[i] = 0); return array; } module.exports = Color; } }); // ../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/interfaces/theme.js var require_theme = __commonJS({ "../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/interfaces/theme.js"(exports) { "use strict"; init_cjs_shims(); Object.defineProperty(exports, "__esModule", { value: !0 }); exports.THEME_KEYS = exports.STANDARD_CHALK = void 0; exports.STANDARD_CHALK = [ "white", "black", "blue", "yellow", "green", "red", "magenta", "cyan", "gray", "blackBright", "redBright", "greenBright", "yellowBright", "blueBright", "magentaBright", "cyanBright", "whiteBright", "bgBlack", "bgRed", "bgGreen", "bgYellow", "bgBlue", "bgMagenta", "bgCyan", "bgWhite", "bgGray", "bgBlackBright", "bgRedBright", "bgGreenBright", "bgYellowBright", "bgBlueBright", "bgMagentaBright", "bgCyanBright", "bgWhiteBright", "bold", "underline", "dim", "italic", "strikethrough" ]; exports.THEME_KEYS = [ "alias", "bin", "command", "commandSummary", "dollarSign", "flag", "flagDefaultValue", "flagOptions", "flagRequired", "flagSeparator", "sectionDescription", "sectionHeader", "topic", "version" ]; } }); // ../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/cli-ux/theme.js var require_theme2 = __commonJS({ "../../node_modules/.pnpm/@oclif+core@3.26.5/node_modules/@oclif/core/lib/cli-ux/theme.js"(exports) { "use strict"; init_cjs_shims(); var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) { k2 === void 0 && (k2 = k); var desc = Object.getOwnPropertyDescriptor(m, k); (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) && (desc = { enumerable: !0, get: function() { return m[k]; } }), Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { k2 === void 0 && (k2 = k), o[k2] = m[k]; })), __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: !0, value: v }); }) : function(o, v) { o.default = v; }), __importStar = exports && exports.__importStar || function(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) k !== "default" && Object.prototype.hasOwnProperty.call(mod, k) && __createBinding(result, mod, k); return __setModuleDefault(result, mod), result; }, __importDefault = exports && exports.__importDefault || function(m