@skybloxsystems/ticket-bot
Version:
1,585 lines (1,566 loc) • 629 kB
JavaScript
"use strict";
var __getOwnPropNames = Object.getOwnPropertyNames;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
// ../error/lib/index.js
var require_lib = __commonJS({
"../error/lib/index.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.FetchError = void 0;
var PnpmError = class extends Error {
constructor(code, message, opts) {
super(message);
this.code = `ERR_PNPM_${code}`;
this.hint = opts === null || opts === void 0 ? void 0 : opts.hint;
this.attempts = opts === null || opts === void 0 ? void 0 : opts.attempts;
}
};
exports2.default = PnpmError;
var FetchError = class extends PnpmError {
constructor(request, response, hint) {
const message = `GET ${request.url}: ${response.statusText} - ${response.status}`;
const authHeaderValue = request.authHeaderValue ? hideAuthInformation(request.authHeaderValue) : void 0;
if (response.status === 401 || response.status === 403 || response.status === 404) {
hint = hint ? `${hint}
` : "";
if (authHeaderValue) {
hint += `An authorization header was used: ${authHeaderValue}`;
} else {
hint += "No authorization header was set for the request.";
}
}
super(`FETCH_${response.status}`, message, { hint });
this.request = request;
this.response = response;
}
};
exports2.FetchError = FetchError;
function hideAuthInformation(authHeaderValue) {
const [authType, token] = authHeaderValue.split(" ");
return `${authType} ${token.substring(0, 4)}[hidden]`;
}
}
});
// ../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js
var require_yocto_queue = __commonJS({
"../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports2, module2) {
var Node = class {
constructor(value) {
this.value = value;
this.next = void 0;
}
};
var Queue = class {
constructor() {
this.clear();
}
enqueue(value) {
const node = new Node(value);
if (this._head) {
this._tail.next = node;
this._tail = node;
} else {
this._head = node;
this._tail = node;
}
this._size++;
}
dequeue() {
const current = this._head;
if (!current) {
return;
}
this._head = this._head.next;
this._size--;
return current.value;
}
clear() {
this._head = void 0;
this._tail = void 0;
this._size = 0;
}
get size() {
return this._size;
}
*[Symbol.iterator]() {
let current = this._head;
while (current) {
yield current.value;
current = current.next;
}
}
};
module2.exports = Queue;
}
});
// ../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js
var require_p_limit = __commonJS({
"../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports2, module2) {
"use strict";
var Queue = require_yocto_queue();
var pLimit = (concurrency) => {
if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
}
const queue = new Queue();
let activeCount = 0;
const next = () => {
activeCount--;
if (queue.size > 0) {
queue.dequeue()();
}
};
const run = async (fn, resolve, ...args) => {
activeCount++;
const result = (async () => fn(...args))();
resolve(result);
try {
await result;
} catch {
}
next();
};
const enqueue = (fn, resolve, ...args) => {
queue.enqueue(run.bind(null, fn, resolve, ...args));
(async () => {
await Promise.resolve();
if (activeCount < concurrency && queue.size > 0) {
queue.dequeue()();
}
})();
};
const generator = (fn, ...args) => new Promise((resolve) => {
enqueue(fn, resolve, ...args);
});
Object.defineProperties(generator, {
activeCount: {
get: () => activeCount
},
pendingCount: {
get: () => queue.size
},
clearQueue: {
value: () => {
queue.clear();
}
}
});
return generator;
};
module2.exports = pLimit;
}
});
// ../../node_modules/.pnpm/p-locate@5.0.0/node_modules/p-locate/index.js
var require_p_locate = __commonJS({
"../../node_modules/.pnpm/p-locate@5.0.0/node_modules/p-locate/index.js"(exports2, module2) {
"use strict";
var pLimit = require_p_limit();
var EndError = class extends Error {
constructor(value) {
super();
this.value = value;
}
};
var testElement = async (element, tester) => tester(await element);
var finder = async (element) => {
const values = await Promise.all(element);
if (values[1] === true) {
throw new EndError(values[0]);
}
return false;
};
var pLocate = async (iterable, tester, options) => {
options = {
concurrency: Infinity,
preserveOrder: true,
...options
};
const limit = pLimit(options.concurrency);
const items = [...iterable].map((element) => [element, limit(testElement, element, tester)]);
const checkLimit = pLimit(options.preserveOrder ? 1 : Infinity);
try {
await Promise.all(items.map((element) => checkLimit(finder, element)));
} catch (error) {
if (error instanceof EndError) {
return error.value;
}
throw error;
}
};
module2.exports = pLocate;
}
});
// ../../node_modules/.pnpm/locate-path@6.0.0/node_modules/locate-path/index.js
var require_locate_path = __commonJS({
"../../node_modules/.pnpm/locate-path@6.0.0/node_modules/locate-path/index.js"(exports2, module2) {
"use strict";
var path = require("path");
var fs = require("fs");
var { promisify } = require("util");
var pLocate = require_p_locate();
var fsStat = promisify(fs.stat);
var fsLStat = promisify(fs.lstat);
var typeMappings = {
directory: "isDirectory",
file: "isFile"
};
function checkType({ type }) {
if (type in typeMappings) {
return;
}
throw new Error(`Invalid type specified: ${type}`);
}
var matchType = (type, stat) => type === void 0 || stat[typeMappings[type]]();
module2.exports = async (paths, options) => {
options = {
cwd: process.cwd(),
type: "file",
allowSymlinks: true,
...options
};
checkType(options);
const statFn = options.allowSymlinks ? fsStat : fsLStat;
return pLocate(paths, async (path_) => {
try {
const stat = await statFn(path.resolve(options.cwd, path_));
return matchType(options.type, stat);
} catch {
return false;
}
}, options);
};
module2.exports.sync = (paths, options) => {
options = {
cwd: process.cwd(),
allowSymlinks: true,
type: "file",
...options
};
checkType(options);
const statFn = options.allowSymlinks ? fs.statSync : fs.lstatSync;
for (const path_ of paths) {
try {
const stat = statFn(path.resolve(options.cwd, path_));
if (matchType(options.type, stat)) {
return path_;
}
} catch {
}
}
};
}
});
// ../../node_modules/.pnpm/path-exists@4.0.0/node_modules/path-exists/index.js
var require_path_exists = __commonJS({
"../../node_modules/.pnpm/path-exists@4.0.0/node_modules/path-exists/index.js"(exports2, module2) {
"use strict";
var fs = require("fs");
var { promisify } = require("util");
var pAccess = promisify(fs.access);
module2.exports = async (path) => {
try {
await pAccess(path);
return true;
} catch (_) {
return false;
}
};
module2.exports.sync = (path) => {
try {
fs.accessSync(path);
return true;
} catch (_) {
return false;
}
};
}
});
// ../../node_modules/.pnpm/find-up@5.0.0/node_modules/find-up/index.js
var require_find_up = __commonJS({
"../../node_modules/.pnpm/find-up@5.0.0/node_modules/find-up/index.js"(exports2, module2) {
"use strict";
var path = require("path");
var locatePath = require_locate_path();
var pathExists = require_path_exists();
var stop = Symbol("findUp.stop");
module2.exports = async (name, options = {}) => {
let directory = path.resolve(options.cwd || "");
const { root } = path.parse(directory);
const paths = [].concat(name);
const runMatcher = async (locateOptions) => {
if (typeof name !== "function") {
return locatePath(paths, locateOptions);
}
const foundPath = await name(locateOptions.cwd);
if (typeof foundPath === "string") {
return locatePath([foundPath], locateOptions);
}
return foundPath;
};
while (true) {
const foundPath = await runMatcher({ ...options, cwd: directory });
if (foundPath === stop) {
return;
}
if (foundPath) {
return path.resolve(directory, foundPath);
}
if (directory === root) {
return;
}
directory = path.dirname(directory);
}
};
module2.exports.sync = (name, options = {}) => {
let directory = path.resolve(options.cwd || "");
const { root } = path.parse(directory);
const paths = [].concat(name);
const runMatcher = (locateOptions) => {
if (typeof name !== "function") {
return locatePath.sync(paths, locateOptions);
}
const foundPath = name(locateOptions.cwd);
if (typeof foundPath === "string") {
return locatePath.sync([foundPath], locateOptions);
}
return foundPath;
};
while (true) {
const foundPath = runMatcher({ ...options, cwd: directory });
if (foundPath === stop) {
return;
}
if (foundPath) {
return path.resolve(directory, foundPath);
}
if (directory === root) {
return;
}
directory = path.dirname(directory);
}
};
module2.exports.exists = pathExists;
module2.exports.sync.exists = pathExists.sync;
module2.exports.stop = stop;
}
});
// ../find-workspace-dir/lib/index.js
var require_lib2 = __commonJS({
"../find-workspace-dir/lib/index.js"(exports2) {
"use strict";
var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports2, "__esModule", { value: true });
var path_12 = __importDefault2(require("path"));
var error_1 = __importDefault2(require_lib());
var find_up_1 = __importDefault2(require_find_up());
var WORKSPACE_DIR_ENV_VAR = "NPM_CONFIG_WORKSPACE_DIR";
var WORKSPACE_MANIFEST_FILENAME = "pnpm-workspace.yaml";
async function findWorkspaceDir(cwd) {
var _a;
const workspaceManifestDirEnvVar = (_a = process.env[WORKSPACE_DIR_ENV_VAR]) !== null && _a !== void 0 ? _a : process.env[WORKSPACE_DIR_ENV_VAR.toLowerCase()];
const workspaceManifestLocation = workspaceManifestDirEnvVar ? path_12.default.join(workspaceManifestDirEnvVar, "pnpm-workspace.yaml") : await (0, find_up_1.default)([WORKSPACE_MANIFEST_FILENAME, "pnpm-workspace.yml"], { cwd });
if (workspaceManifestLocation === null || workspaceManifestLocation === void 0 ? void 0 : workspaceManifestLocation.endsWith(".yml")) {
throw new error_1.default("BAD_WORKSPACE_MANIFEST_NAME", `The workspace manifest file should be named "pnpm-workspace.yaml". File found: ${workspaceManifestLocation}`);
}
return workspaceManifestLocation && path_12.default.dirname(workspaceManifestLocation);
}
exports2.default = findWorkspaceDir;
}
});
// ../../node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/old.js
var require_old = __commonJS({
"../../node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/old.js"(exports2) {
var pathModule = require("path");
var isWindows = process.platform === "win32";
var fs = require("fs");
var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
function rethrow() {
var callback;
if (DEBUG) {
var backtrace = new Error();
callback = debugCallback;
} else
callback = missingCallback;
return callback;
function debugCallback(err) {
if (err) {
backtrace.message = err.message;
err = backtrace;
missingCallback(err);
}
}
function missingCallback(err) {
if (err) {
if (process.throwDeprecation)
throw err;
else if (!process.noDeprecation) {
var msg = "fs: missing callback " + (err.stack || err.message);
if (process.traceDeprecation)
console.trace(msg);
else
console.error(msg);
}
}
}
}
function maybeCallback(cb) {
return typeof cb === "function" ? cb : rethrow();
}
var normalize = pathModule.normalize;
if (isWindows) {
nextPartRe = /(.*?)(?:[\/\\]+|$)/g;
} else {
nextPartRe = /(.*?)(?:[\/]+|$)/g;
}
var nextPartRe;
if (isWindows) {
splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;
} else {
splitRootRe = /^[\/]*/;
}
var splitRootRe;
exports2.realpathSync = function realpathSync(p, cache) {
p = pathModule.resolve(p);
if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
return cache[p];
}
var original = p, seenLinks = {}, knownHard = {};
var pos;
var current;
var base;
var previous;
start();
function start() {
var m = splitRootRe.exec(p);
pos = m[0].length;
current = m[0];
base = m[0];
previous = "";
if (isWindows && !knownHard[base]) {
fs.lstatSync(base);
knownHard[base] = true;
}
}
while (pos < p.length) {
nextPartRe.lastIndex = pos;
var result = nextPartRe.exec(p);
previous = current;
current += result[0];
base = previous + result[1];
pos = nextPartRe.lastIndex;
if (knownHard[base] || cache && cache[base] === base) {
continue;
}
var resolvedLink;
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
resolvedLink = cache[base];
} else {
var stat = fs.lstatSync(base);
if (!stat.isSymbolicLink()) {
knownHard[base] = true;
if (cache)
cache[base] = base;
continue;
}
var linkTarget = null;
if (!isWindows) {
var id = stat.dev.toString(32) + ":" + stat.ino.toString(32);
if (seenLinks.hasOwnProperty(id)) {
linkTarget = seenLinks[id];
}
}
if (linkTarget === null) {
fs.statSync(base);
linkTarget = fs.readlinkSync(base);
}
resolvedLink = pathModule.resolve(previous, linkTarget);
if (cache)
cache[base] = resolvedLink;
if (!isWindows)
seenLinks[id] = linkTarget;
}
p = pathModule.resolve(resolvedLink, p.slice(pos));
start();
}
if (cache)
cache[original] = p;
return p;
};
exports2.realpath = function realpath(p, cache, cb) {
if (typeof cb !== "function") {
cb = maybeCallback(cache);
cache = null;
}
p = pathModule.resolve(p);
if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
return process.nextTick(cb.bind(null, null, cache[p]));
}
var original = p, seenLinks = {}, knownHard = {};
var pos;
var current;
var base;
var previous;
start();
function start() {
var m = splitRootRe.exec(p);
pos = m[0].length;
current = m[0];
base = m[0];
previous = "";
if (isWindows && !knownHard[base]) {
fs.lstat(base, function(err) {
if (err)
return cb(err);
knownHard[base] = true;
LOOP();
});
} else {
process.nextTick(LOOP);
}
}
function LOOP() {
if (pos >= p.length) {
if (cache)
cache[original] = p;
return cb(null, p);
}
nextPartRe.lastIndex = pos;
var result = nextPartRe.exec(p);
previous = current;
current += result[0];
base = previous + result[1];
pos = nextPartRe.lastIndex;
if (knownHard[base] || cache && cache[base] === base) {
return process.nextTick(LOOP);
}
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
return gotResolvedLink(cache[base]);
}
return fs.lstat(base, gotStat);
}
function gotStat(err, stat) {
if (err)
return cb(err);
if (!stat.isSymbolicLink()) {
knownHard[base] = true;
if (cache)
cache[base] = base;
return process.nextTick(LOOP);
}
if (!isWindows) {
var id = stat.dev.toString(32) + ":" + stat.ino.toString(32);
if (seenLinks.hasOwnProperty(id)) {
return gotTarget(null, seenLinks[id], base);
}
}
fs.stat(base, function(err2) {
if (err2)
return cb(err2);
fs.readlink(base, function(err3, target) {
if (!isWindows)
seenLinks[id] = target;
gotTarget(err3, target);
});
});
}
function gotTarget(err, target, base2) {
if (err)
return cb(err);
var resolvedLink = pathModule.resolve(previous, target);
if (cache)
cache[base2] = resolvedLink;
gotResolvedLink(resolvedLink);
}
function gotResolvedLink(resolvedLink) {
p = pathModule.resolve(resolvedLink, p.slice(pos));
start();
}
};
}
});
// ../../node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/index.js
var require_fs = __commonJS({
"../../node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/index.js"(exports2, module2) {
module2.exports = realpath;
realpath.realpath = realpath;
realpath.sync = realpathSync;
realpath.realpathSync = realpathSync;
realpath.monkeypatch = monkeypatch;
realpath.unmonkeypatch = unmonkeypatch;
var fs = require("fs");
var origRealpath = fs.realpath;
var origRealpathSync = fs.realpathSync;
var version = process.version;
var ok = /^v[0-5]\./.test(version);
var old = require_old();
function newError(er) {
return er && er.syscall === "realpath" && (er.code === "ELOOP" || er.code === "ENOMEM" || er.code === "ENAMETOOLONG");
}
function realpath(p, cache, cb) {
if (ok) {
return origRealpath(p, cache, cb);
}
if (typeof cache === "function") {
cb = cache;
cache = null;
}
origRealpath(p, cache, function(er, result) {
if (newError(er)) {
old.realpath(p, cache, cb);
} else {
cb(er, result);
}
});
}
function realpathSync(p, cache) {
if (ok) {
return origRealpathSync(p, cache);
}
try {
return origRealpathSync(p, cache);
} catch (er) {
if (newError(er)) {
return old.realpathSync(p, cache);
} else {
throw er;
}
}
}
function monkeypatch() {
fs.realpath = realpath;
fs.realpathSync = realpathSync;
}
function unmonkeypatch() {
fs.realpath = origRealpath;
fs.realpathSync = origRealpathSync;
}
}
});
// ../../node_modules/.pnpm/concat-map@0.0.1/node_modules/concat-map/index.js
var require_concat_map = __commonJS({
"../../node_modules/.pnpm/concat-map@0.0.1/node_modules/concat-map/index.js"(exports2, module2) {
module2.exports = function(xs, fn) {
var res = [];
for (var i = 0; i < xs.length; i++) {
var x = fn(xs[i], i);
if (isArray(x))
res.push.apply(res, x);
else
res.push(x);
}
return res;
};
var isArray = Array.isArray || function(xs) {
return Object.prototype.toString.call(xs) === "[object Array]";
};
}
});
// ../../node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js
var require_balanced_match = __commonJS({
"../../node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js"(exports2, module2) {
"use strict";
module2.exports = balanced;
function balanced(a, b, str) {
if (a instanceof RegExp)
a = maybeMatch(a, str);
if (b instanceof RegExp)
b = maybeMatch(b, str);
var r = range(a, b, str);
return r && {
start: r[0],
end: r[1],
pre: str.slice(0, r[0]),
body: str.slice(r[0] + a.length, r[1]),
post: str.slice(r[1] + b.length)
};
}
function maybeMatch(reg, str) {
var m = str.match(reg);
return m ? m[0] : null;
}
balanced.range = range;
function range(a, b, str) {
var begs, beg, left, right, result;
var ai = str.indexOf(a);
var bi = str.indexOf(b, ai + 1);
var i = ai;
if (ai >= 0 && bi > 0) {
if (a === b) {
return [ai, bi];
}
begs = [];
left = str.length;
while (i >= 0 && !result) {
if (i == ai) {
begs.push(i);
ai = str.indexOf(a, i + 1);
} else if (begs.length == 1) {
result = [begs.pop(), bi];
} else {
beg = begs.pop();
if (beg < left) {
left = beg;
right = bi;
}
bi = str.indexOf(b, i + 1);
}
i = ai < bi && ai >= 0 ? ai : bi;
}
if (begs.length) {
result = [left, right];
}
}
return result;
}
}
});
// ../../node_modules/.pnpm/brace-expansion@1.1.11/node_modules/brace-expansion/index.js
var require_brace_expansion = __commonJS({
"../../node_modules/.pnpm/brace-expansion@1.1.11/node_modules/brace-expansion/index.js"(exports2, module2) {
var concatMap = require_concat_map();
var balanced = require_balanced_match();
module2.exports = expandTop;
var escSlash = "\0SLASH" + Math.random() + "\0";
var escOpen = "\0OPEN" + Math.random() + "\0";
var escClose = "\0CLOSE" + Math.random() + "\0";
var escComma = "\0COMMA" + Math.random() + "\0";
var escPeriod = "\0PERIOD" + Math.random() + "\0";
function numeric(str) {
return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
}
function escapeBraces(str) {
return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
}
function unescapeBraces(str) {
return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
}
function parseCommaParts(str) {
if (!str)
return [""];
var parts = [];
var m = balanced("{", "}", str);
if (!m)
return str.split(",");
var pre = m.pre;
var body = m.body;
var post = m.post;
var p = pre.split(",");
p[p.length - 1] += "{" + body + "}";
var postParts = parseCommaParts(post);
if (post.length) {
p[p.length - 1] += postParts.shift();
p.push.apply(p, postParts);
}
parts.push.apply(parts, p);
return parts;
}
function expandTop(str) {
if (!str)
return [];
if (str.substr(0, 2) === "{}") {
str = "\\{\\}" + str.substr(2);
}
return expand(escapeBraces(str), true).map(unescapeBraces);
}
function embrace(str) {
return "{" + str + "}";
}
function isPadded(el) {
return /^-?0\d/.test(el);
}
function lte(i, y) {
return i <= y;
}
function gte(i, y) {
return i >= y;
}
function expand(str, isTop) {
var expansions = [];
var m = balanced("{", "}", str);
if (!m || /\$$/.test(m.pre))
return [str];
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
var isSequence = isNumericSequence || isAlphaSequence;
var isOptions = m.body.indexOf(",") >= 0;
if (!isSequence && !isOptions) {
if (m.post.match(/,.*\}/)) {
str = m.pre + "{" + m.body + escClose + m.post;
return expand(str);
}
return [str];
}
var n;
if (isSequence) {
n = m.body.split(/\.\./);
} else {
n = parseCommaParts(m.body);
if (n.length === 1) {
n = expand(n[0], false).map(embrace);
if (n.length === 1) {
var post = m.post.length ? expand(m.post, false) : [""];
return post.map(function(p) {
return m.pre + n[0] + p;
});
}
}
}
var pre = m.pre;
var post = m.post.length ? expand(m.post, false) : [""];
var N;
if (isSequence) {
var x = numeric(n[0]);
var y = numeric(n[1]);
var width = Math.max(n[0].length, n[1].length);
var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
var test = lte;
var reverse = y < x;
if (reverse) {
incr *= -1;
test = gte;
}
var pad = n.some(isPadded);
N = [];
for (var i = x; test(i, y); i += incr) {
var c;
if (isAlphaSequence) {
c = String.fromCharCode(i);
if (c === "\\")
c = "";
} else {
c = String(i);
if (pad) {
var need = width - c.length;
if (need > 0) {
var z = new Array(need + 1).join("0");
if (i < 0)
c = "-" + z + c.slice(1);
else
c = z + c;
}
}
}
N.push(c);
}
} else {
N = concatMap(n, function(el) {
return expand(el, false);
});
}
for (var j = 0; j < N.length; j++) {
for (var k = 0; k < post.length; k++) {
var expansion = pre + N[j] + post[k];
if (!isTop || isSequence || expansion)
expansions.push(expansion);
}
}
return expansions;
}
}
});
// ../../node_modules/.pnpm/minimatch@3.0.4/node_modules/minimatch/minimatch.js
var require_minimatch = __commonJS({
"../../node_modules/.pnpm/minimatch@3.0.4/node_modules/minimatch/minimatch.js"(exports2, module2) {
module2.exports = minimatch;
minimatch.Minimatch = Minimatch;
var path = { sep: "/" };
try {
path = require("path");
} catch (er) {
}
var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
var expand = require_brace_expansion();
var plTypes = {
"!": { open: "(?:(?!(?:", close: "))[^/]*?)" },
"?": { open: "(?:", close: ")?" },
"+": { open: "(?:", close: ")+" },
"*": { open: "(?:", close: ")*" },
"@": { open: "(?:", close: ")" }
};
var qmark = "[^/]";
var star = qmark + "*?";
var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
var reSpecials = charSet("().*{}+?[]^$\\!");
function charSet(s) {
return s.split("").reduce(function(set, c) {
set[c] = true;
return set;
}, {});
}
var slashSplit = /\/+/;
minimatch.filter = filter;
function filter(pattern, options) {
options = options || {};
return function(p, i, list) {
return minimatch(p, pattern, options);
};
}
function ext(a, b) {
a = a || {};
b = b || {};
var t = {};
Object.keys(b).forEach(function(k) {
t[k] = b[k];
});
Object.keys(a).forEach(function(k) {
t[k] = a[k];
});
return t;
}
minimatch.defaults = function(def) {
if (!def || !Object.keys(def).length)
return minimatch;
var orig = minimatch;
var m = function minimatch2(p, pattern, options) {
return orig.minimatch(p, pattern, ext(def, options));
};
m.Minimatch = function Minimatch2(pattern, options) {
return new orig.Minimatch(pattern, ext(def, options));
};
return m;
};
Minimatch.defaults = function(def) {
if (!def || !Object.keys(def).length)
return Minimatch;
return minimatch.defaults(def).Minimatch;
};
function minimatch(p, pattern, options) {
if (typeof pattern !== "string") {
throw new TypeError("glob pattern string required");
}
if (!options)
options = {};
if (!options.nocomment && pattern.charAt(0) === "#") {
return false;
}
if (pattern.trim() === "")
return p === "";
return new Minimatch(pattern, options).match(p);
}
function Minimatch(pattern, options) {
if (!(this instanceof Minimatch)) {
return new Minimatch(pattern, options);
}
if (typeof pattern !== "string") {
throw new TypeError("glob pattern string required");
}
if (!options)
options = {};
pattern = pattern.trim();
if (path.sep !== "/") {
pattern = pattern.split(path.sep).join("/");
}
this.options = options;
this.set = [];
this.pattern = pattern;
this.regexp = null;
this.negate = false;
this.comment = false;
this.empty = false;
this.make();
}
Minimatch.prototype.debug = function() {
};
Minimatch.prototype.make = make;
function make() {
if (this._made)
return;
var pattern = this.pattern;
var options = this.options;
if (!options.nocomment && pattern.charAt(0) === "#") {
this.comment = true;
return;
}
if (!pattern) {
this.empty = true;
return;
}
this.parseNegate();
var set = this.globSet = this.braceExpand();
if (options.debug)
this.debug = console.error;
this.debug(this.pattern, set);
set = this.globParts = set.map(function(s) {
return s.split(slashSplit);
});
this.debug(this.pattern, set);
set = set.map(function(s, si, set2) {
return s.map(this.parse, this);
}, this);
this.debug(this.pattern, set);
set = set.filter(function(s) {
return s.indexOf(false) === -1;
});
this.debug(this.pattern, set);
this.set = set;
}
Minimatch.prototype.parseNegate = parseNegate;
function parseNegate() {
var pattern = this.pattern;
var negate = false;
var options = this.options;
var negateOffset = 0;
if (options.nonegate)
return;
for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === "!"; i++) {
negate = !negate;
negateOffset++;
}
if (negateOffset)
this.pattern = pattern.substr(negateOffset);
this.negate = negate;
}
minimatch.braceExpand = function(pattern, options) {
return braceExpand(pattern, options);
};
Minimatch.prototype.braceExpand = braceExpand;
function braceExpand(pattern, options) {
if (!options) {
if (this instanceof Minimatch) {
options = this.options;
} else {
options = {};
}
}
pattern = typeof pattern === "undefined" ? this.pattern : pattern;
if (typeof pattern === "undefined") {
throw new TypeError("undefined pattern");
}
if (options.nobrace || !pattern.match(/\{.*\}/)) {
return [pattern];
}
return expand(pattern);
}
Minimatch.prototype.parse = parse;
var SUBPARSE = {};
function parse(pattern, isSub) {
if (pattern.length > 1024 * 64) {
throw new TypeError("pattern is too long");
}
var options = this.options;
if (!options.noglobstar && pattern === "**")
return GLOBSTAR;
if (pattern === "")
return "";
var re = "";
var hasMagic = !!options.nocase;
var escaping = false;
var patternListStack = [];
var negativeLists = [];
var stateChar;
var inClass = false;
var reClassStart = -1;
var classStart = -1;
var patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
var self = this;
function clearStateChar() {
if (stateChar) {
switch (stateChar) {
case "*":
re += star;
hasMagic = true;
break;
case "?":
re += qmark;
hasMagic = true;
break;
default:
re += "\\" + stateChar;
break;
}
self.debug("clearStateChar %j %j", stateChar, re);
stateChar = false;
}
}
for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) {
this.debug("%s %s %s %j", pattern, i, re, c);
if (escaping && reSpecials[c]) {
re += "\\" + c;
escaping = false;
continue;
}
switch (c) {
case "/":
return false;
case "\\":
clearStateChar();
escaping = true;
continue;
case "?":
case "*":
case "+":
case "@":
case "!":
this.debug("%s %s %s %j <-- stateChar", pattern, i, re, c);
if (inClass) {
this.debug(" in class");
if (c === "!" && i === classStart + 1)
c = "^";
re += c;
continue;
}
self.debug("call clearStateChar %j", stateChar);
clearStateChar();
stateChar = c;
if (options.noext)
clearStateChar();
continue;
case "(":
if (inClass) {
re += "(";
continue;
}
if (!stateChar) {
re += "\\(";
continue;
}
patternListStack.push({
type: stateChar,
start: i - 1,
reStart: re.length,
open: plTypes[stateChar].open,
close: plTypes[stateChar].close
});
re += stateChar === "!" ? "(?:(?!(?:" : "(?:";
this.debug("plType %j %j", stateChar, re);
stateChar = false;
continue;
case ")":
if (inClass || !patternListStack.length) {
re += "\\)";
continue;
}
clearStateChar();
hasMagic = true;
var pl = patternListStack.pop();
re += pl.close;
if (pl.type === "!") {
negativeLists.push(pl);
}
pl.reEnd = re.length;
continue;
case "|":
if (inClass || !patternListStack.length || escaping) {
re += "\\|";
escaping = false;
continue;
}
clearStateChar();
re += "|";
continue;
case "[":
clearStateChar();
if (inClass) {
re += "\\" + c;
continue;
}
inClass = true;
classStart = i;
reClassStart = re.length;
re += c;
continue;
case "]":
if (i === classStart + 1 || !inClass) {
re += "\\" + c;
escaping = false;
continue;
}
if (inClass) {
var cs = pattern.substring(classStart + 1, i);
try {
RegExp("[" + cs + "]");
} catch (er) {
var sp = this.parse(cs, SUBPARSE);
re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]";
hasMagic = hasMagic || sp[1];
inClass = false;
continue;
}
}
hasMagic = true;
inClass = false;
re += c;
continue;
default:
clearStateChar();
if (escaping) {
escaping = false;
} else if (reSpecials[c] && !(c === "^" && inClass)) {
re += "\\";
}
re += c;
}
}
if (inClass) {
cs = pattern.substr(classStart + 1);
sp = this.parse(cs, SUBPARSE);
re = re.substr(0, reClassStart) + "\\[" + sp[0];
hasMagic = hasMagic || sp[1];
}
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
var tail = re.slice(pl.reStart + pl.open.length);
this.debug("setting tail", re, pl);
tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function(_, $1, $2) {
if (!$2) {
$2 = "\\";
}
return $1 + $1 + $2 + "|";
});
this.debug("tail=%j\n %s", tail, tail, pl, re);
var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
hasMagic = true;
re = re.slice(0, pl.reStart) + t + "\\(" + tail;
}
clearStateChar();
if (escaping) {
re += "\\\\";
}
var addPatternStart = false;
switch (re.charAt(0)) {
case ".":
case "[":
case "(":
addPatternStart = true;
}
for (var n = negativeLists.length - 1; n > -1; n--) {
var nl = negativeLists[n];
var nlBefore = re.slice(0, nl.reStart);
var nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
var nlLast = re.slice(nl.reEnd - 8, nl.reEnd);
var nlAfter = re.slice(nl.reEnd);
nlLast += nlAfter;
var openParensBefore = nlBefore.split("(").length - 1;
var cleanAfter = nlAfter;
for (i = 0; i < openParensBefore; i++) {
cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
}
nlAfter = cleanAfter;
var dollar = "";
if (nlAfter === "" && isSub !== SUBPARSE) {
dollar = "$";
}
var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast;
re = newRe;
}
if (re !== "" && hasMagic) {
re = "(?=.)" + re;
}
if (addPatternStart) {
re = patternStart + re;
}
if (isSub === SUBPARSE) {
return [re, hasMagic];
}
if (!hasMagic) {
return globUnescape(pattern);
}
var flags = options.nocase ? "i" : "";
try {
var regExp = new RegExp("^" + re + "$", flags);
} catch (er) {
return new RegExp("$.");
}
regExp._glob = pattern;
regExp._src = re;
return regExp;
}
minimatch.makeRe = function(pattern, options) {
return new Minimatch(pattern, options || {}).makeRe();
};
Minimatch.prototype.makeRe = makeRe;
function makeRe() {
if (this.regexp || this.regexp === false)
return this.regexp;
var set = this.set;
if (!set.length) {
this.regexp = false;
return this.regexp;
}
var options = this.options;
var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
var flags = options.nocase ? "i" : "";
var re = set.map(function(pattern) {
return pattern.map(function(p) {
return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src;
}).join("\\/");
}).join("|");
re = "^(?:" + re + ")$";
if (this.negate)
re = "^(?!" + re + ").*$";
try {
this.regexp = new RegExp(re, flags);
} catch (ex) {
this.regexp = false;
}
return this.regexp;
}
minimatch.match = function(list, pattern, options) {
options = options || {};
var mm = new Minimatch(pattern, options);
list = list.filter(function(f) {
return mm.match(f);
});
if (mm.options.nonull && !list.length) {
list.push(pattern);
}
return list;
};
Minimatch.prototype.match = match;
function match(f, partial) {
this.debug("match", f, this.pattern);
if (this.comment)
return false;
if (this.empty)
return f === "";
if (f === "/" && partial)
return true;
var options = this.options;
if (path.sep !== "/") {
f = f.split(path.sep).join("/");
}
f = f.split(slashSplit);
this.debug(this.pattern, "split", f);
var set = this.set;
this.debug(this.pattern, "set", set);
var filename;
var i;
for (i = f.length - 1; i >= 0; i--) {
filename = f[i];
if (filename)
break;
}
for (i = 0; i < set.length; i++) {
var pattern = set[i];
var file = f;
if (options.matchBase && pattern.length === 1) {
file = [filename];
}
var hit = this.matchOne(file, pattern, partial);
if (hit) {
if (options.flipNegate)
return true;
return !this.negate;
}
}
if (options.flipNegate)
return false;
return this.negate;
}
Minimatch.prototype.matchOne = function(file, pattern, partial) {
var options = this.options;
this.debug("matchOne", { "this": this, file, pattern });
this.debug("matchOne", file.length, pattern.length);
for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
this.debug("matchOne loop");
var p = pattern[pi];
var f = file[fi];
this.debug(pattern, p, f);
if (p === false)
return false;
if (p === GLOBSTAR) {
this.debug("GLOBSTAR", [pattern, p, f]);
var fr = fi;
var pr = pi + 1;
if (pr === pl) {
this.debug("** at the end");
for (; fi < fl; fi++) {
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
return false;
}
return true;
}
while (fr < fl) {
var swallowee = file[fr];
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
this.debug("globstar found match!", fr, fl, swallowee);
return true;
} else {
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
this.debug("dot detected!", file, fr, pattern, pr);
break;
}
this.debug("globstar swallow a segment, and continue");
fr++;
}
}
if (partial) {
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
if (fr === fl)
return true;
}
return false;
}
var hit;
if (typeof p === "string") {
if (options.nocase) {
hit = f.toLowerCase() === p.toLowerCase();
} else {
hit = f === p;
}
this.debug("string match", p, f, hit);
} else {
hit = f.match(p);
this.debug("pattern match", p, f, hit);
}
if (!hit)
return false;
}
if (fi === fl && pi === pl) {
return true;
} else if (fi === fl) {
return partial;
} else if (pi === pl) {
var emptyFileEnd = fi === fl - 1 && file[fi] === "";
return emptyFileEnd;
}
throw new Error("wtf?");
};
function globUnescape(s) {
return s.replace(/\\(.)/g, "$1");
}
function regExpEscape(s) {
return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
}
}
});
// ../../node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js
var require_inherits_browser = __commonJS({
"../../node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js"(exports2, module2) {
if (typeof Object.create === "function") {
module2.exports = function inherits(ctor, superCtor) {
if (superCtor) {
ctor.super_ = superCtor;
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
}
};
} else {
module2.exports = function inherits(ctor, superCtor) {
if (superCtor) {
ctor.super_ = superCtor;
var TempCtor = function() {
};
TempCtor.prototype = superCtor.prototype;
ctor.prototype = new TempCtor();
ctor.prototype.constructor = ctor;
}
};
}
}
});
// ../../node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits.js
var require_inherits = __commonJS({
"../../node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits.js"(exports2, module2) {
try {
util = require("util");
if (typeof util.inherits !== "function")
throw "";
module2.exports = util.inherits;
} catch (e) {
module2.exports = require_inherits_browser();
}
var util;
}
});
// ../../node_modules/.pnpm/path-is-absolute@1.0.1/node_modules/path-is-absolute/index.js
var require_path_is_absolute = __commonJS({
"../../node_modules/.pnpm/path-is-absolute@1.0.1/node_modules/path-is-absolute/index.js"(exports2, module2) {
"use strict";
function posix(path) {
return path.charAt(0) === "/";
}
function win32(path) {
var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
var result = splitDeviceRe.exec(path);
var device = result[1] || "";
var isUnc = Boolean(device && device.charAt(1) !== ":");
return Boolean(result[2] || isUnc);
}
module2.exports = process.platform === "win32" ? win32 : posix;
module2.exports.posix = posix;
module2.exports.win32 = win32;
}
});
// ../../node_modules/.pnpm/glob@7.2.0/node_modules/glob/common.js
var require_common = __commonJS({
"../../node_modules/.pnpm/glob@7.2.0/node_modules/glob/common.js"(exports2) {
exports2.setopts = setopts;
exports2.ownProp = ownProp;
exports2.makeAbs = makeAbs;
exports2.finish = finish;
exports2.mark = mark;
exports2.isIgnored = isIgnored;
exports2.childrenIgnored = childrenIgnored;
function ownProp(obj, field) {
return Object.prototype.hasOwnProperty.call(obj, field);
}
var fs = require("fs");
var path = require("path");
var minimatch = require_minimatch();
var isAbsolute = require_path_is_absolute();
var Minimatch = minimatch.Minimatch;
function alphasort(a, b) {
return a.localeCompare(b, "en");
}
function setupIgnores(self, options) {
self.ignore = options.ignore || [];
if (!Array.isArray(self.ignore))
self.ignore = [self.ignore];
if (self.ignore.length) {
self.ignore = self.ignore.map(ignoreMap);
}
}
function ignoreMap(pattern) {
var gmatcher = null;
if (pattern.slice(-3) === "/**") {
var gpattern = pattern.replace(/(\/\*\*)+$/, "");
gmatcher = new Minimatch(gpattern, { dot: true });
}
return {
matcher: new Minimatch(pattern, { dot: true }),
gmatcher
};
}
function setopts(self, pattern, options) {
if (!options)
options = {};
if (options.matchBase && pattern.indexOf("/") === -1) {
if (options.noglobstar) {
throw new Error("base matching requires globstar");
}
pattern = "**/" + pattern;
}
self.silent = !!options.silent;
self.pattern = pattern;
self.strict = options.strict !== false;
self.realpath = !!options.realpath;
self.realpathCache = options.realpathCache || /* @__PURE__ */ Object.create(null);
self.follow = !!options.follow;
self.dot = !!options.dot;
self.mark = !!options.mark;
self.nodir = !!options.nodir;
if (self.nodir)
self.mark = true;
self.sync = !!options.sync;
self.nounique = !!options.nounique;
self.nonull = !!options.nonull;
self.nosort = !!options.nosort;
self.nocase = !!options.nocase;
self.stat = !!options.stat;
self.noprocess = !!options.noprocess;
self.absolute = !!options.absolute;
self.fs = options.fs || fs;
self.maxLength = options.maxLength || Infinity;
self.cache = options.cache || /* @__PURE__